Updated lints

This commit is contained in:
thomashii@dukefirehawk.com 2023-11-16 23:44:09 +08:00
parent f4a7b46cbc
commit 0aee2f64da
19 changed files with 30 additions and 53 deletions

View file

@ -21,16 +21,14 @@ This is the request body parser powering the [Angel3 framework](https://pub.dev/
### About ### About
I needed something like Express.js's `body-parser` module, so I made it here. It fully supports JSON requests. x-www-form-urlencoded fully supported, as well as query strings. You can also include arrays in your query, in the same way you would for a PHP application. Full file upload support will also be present by the production 1.0.0 release. This package is similar to Express.js's `body-parser` module. It fully supports JSON, x-www-form-urlencoded as well as query strings requests. You can also include arrays in your query, in the same way you would for a PHP application. A benefit of this is that primitive types are automatically deserialized correctly. As in, if you have a `hello=1.5` request, then `body['hello']` will equal `1.5` and not `'1.5'`.
A benefit of this is that primitive types are automatically deserialized correctly. As in, if you have a `hello=1.5` request, then `body['hello']` will equal `1.5` and not `'1.5'`. A very semantic difference, yes, but it relieves stress in my head.
### Installation ### Installation
To install Body Parser for your Dart project, simply add body_parser to your pub dependencies. To install Body Parser for your Dart project, simply add body_parser to your pub dependencies.
dependencies: dependencies:
belatuk_body_parser: ^5.1.0 belatuk_body_parser: ^8.0.0
### Usage ### Usage

View file

@ -14,7 +14,7 @@ In your `pubspec.yaml`:
```yaml ```yaml
dependencies: dependencies:
belatuk_code_buffer: ^5.0.0 belatuk_code_buffer: ^8.0.0
``` ```
## Usage ## Usage

View file

@ -9,4 +9,4 @@ dependencies:
source_span: ^1.8.1 source_span: ^1.8.1
dev_dependencies: dev_dependencies:
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -12,4 +12,4 @@ dependencies:
tuple: ^2.0.0 tuple: ^2.0.0
dev_dependencies: dev_dependencies:
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -18,7 +18,7 @@ In your `pubspec.yaml`:
```yaml ```yaml
dependencies: dependencies:
belatuk_html_builder: ^5.0.0 belatuk_html_builder: ^8.0.0
``` ```
## Usage ## Usage

View file

@ -9,4 +9,4 @@ dependencies:
dev_dependencies: dev_dependencies:
html: ^0.15.0 html: ^0.15.0
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -12,7 +12,7 @@ The ***new and improved*** definitive solution for JSON in Dart. It supports syn
## Installation ## Installation
dependencies: dependencies:
belatuk_json_serializer: ^7.0.0 belatuk_json_serializer: ^8.0.0
## Usage ## Usage

View file

@ -9,4 +9,4 @@ dependencies:
dev_dependencies: dev_dependencies:
stack_trace: ^1.10.0 stack_trace: ^1.10.0
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -7,8 +7,7 @@
**Replacement of `package:merge_map` with breaking changes to support NNBD.** **Replacement of `package:merge_map` with breaking changes to support NNBD.**
Combine multiple Maps into one. Equivalent to Combine multiple Maps into one. Equivalent to
[Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) in JS.
in JS.
## Example ## Example

View file

@ -6,4 +6,4 @@ environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dev_dependencies: dev_dependencies:
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -15,7 +15,7 @@ In your `pubspec.yaml`:
```yaml ```yaml
dependencies: dependencies:
belatuk_pretty_logging: ^6.0.0 belatuk_pretty_logging: ^8.0.0
``` ```
## Usage ## Usage

View file

@ -9,4 +9,4 @@ dependencies:
logging: ^1.0.1 logging: ^1.0.1
dev_dependencies: dev_dependencies:
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -14,7 +14,7 @@ Add `belatuk_pub_sub` as a dependency in your `pubspec.yaml` file:
```yaml ```yaml
dependencies: dependencies:
belatuk_pub_sub: ^6.0.0 belatuk_pub_sub: ^8.0.0
``` ```
Then, be sure to run `dart pub get` in your terminal. Then, be sure to run `dart pub get` in your terminal.
@ -22,17 +22,13 @@ Then, be sure to run `dart pub get` in your terminal.
## Usage ## Usage
`belatuk_pub_sub` is your typical pub/sub API. However, `belatuk_pub_sub` enforces authentication of every `belatuk_pub_sub` is your typical pub/sub API. However, `belatuk_pub_sub` enforces authentication of every
request. It is very possible that `belatuk_pub_sub` will run on both servers and in the browser, request. It is very possible that `belatuk_pub_sub` will run on both server and in the browser,
or on a platform belatuk_pub_sublike Flutter. Thus, there are provisions available to limit or on a platform like Flutter.
access.
**Be careful to not leak any `belatuk_pub_sub` client ID's if operating over a network.** **Be careful to not leak any `belatuk_pub_sub` client ID's if operating over a network.**
If you do, you risk malicious users injecting events into your application, which If you do, you run the risk of malicious users injecting events into your application.
could ultimately spell *disaster*.
A `belatuk_pub_sub` server can operate across multiple *adapters*, which take care of interfacing data over different A `belatuk_pub_sub` server can operate across multiple *adapters*, which take care of interfacing data over different media. For example, a single server can handle pub/sub between multiple Isolates and TCP Sockets, as well as WebSockets, simultaneously.
media. For example, a single server can handle pub/sub between multiple Isolates and TCP Sockets, as well as
WebSockets, simultaneously.
```dart ```dart
import 'package:belatuk_pub_sub/belatuk_pub_sub.dart' as pub_sub; import 'package:belatuk_pub_sub/belatuk_pub_sub.dart' as pub_sub;
@ -52,13 +48,7 @@ main() async {
### Trusted Clients ### Trusted Clients
You can use `package:belatuk_pub_sub` without explicitly registering You can use `package:belatuk_pub_sub` without explicitly registering clients, *if and only if* those clients come from trusted sources. Clients via `Isolate` are always trusted. Clients via `package:json_rpc_2` must be explicitly marked as trusted (i.e. using an IP whitelist mechanism):
clients, *if and only if* those clients come from trusted sources.
Clients via `Isolate` are always trusted.
Clients via `package:json_rpc_2` must be explicitly marked
as trusted (i.e. using an IP whitelist mechanism):
```dart ```dart
JsonRpc2Adapter(..., isTrusted: false); JsonRpc2Adapter(..., isTrusted: false);
@ -71,8 +61,7 @@ pub_sub.IsolateClient(null);
The ID's of all *untrusted* clients who will connect to the server must be known at start-up time. The ID's of all *untrusted* clients who will connect to the server must be known at start-up time.
You may not register new clients after the server has started. This is mostly a security consideration; You may not register new clients after the server has started. This is mostly a security consideration;
if it is impossible to register new clients, then malicious users cannot grant themselves additional mainly to make it impossible to register new clients, thus preventing malicious users from granting themselves additional privileges within the system.
privileges within the system.
```dart ```dart
import 'package:belatuk_pub_sub/belatuk_pub_sub.dart' as pub_sub; import 'package:belatuk_pub_sub/belatuk_pub_sub.dart' as pub_sub;
@ -96,10 +85,7 @@ void main() async {
### Isolates ### Isolates
If you are just running multiple instances of a server, If you are just running multiple instances of a server, use `package:belatuk_pub_sub/isolate.dart`. You'll need one isolate to be the master. Typically this is the first isolate you create.
use `package:belatuk_pub_sub/isolate.dart`.
You'll need one isolate to be the master. Typically this is the first isolate you create.
```dart ```dart
import 'dart:io'; import 'dart:io';
@ -157,9 +143,7 @@ Check out `test/json_rpc_2_test.dart` for an example of serving `belatuk_pub_sub
## Protocol ## Protocol
`belatuk_pub_sub` is built upon a simple RPC, and this package includes `belatuk_pub_sub` is built upon a simple RPC, and this package includes an implementation that runs via `SendPort`s and `ReceivePort`s, as well as one that runs on any `StreamChannel<String>`.
an implementation that runs via `SendPort`s and `ReceivePort`s, as
well as one that runs on any `StreamChannel<String>`.
Data sent over the wire looks like the following: Data sent over the wire looks like the following:
@ -219,14 +203,11 @@ In the case of Isolate clients/servers, events will be simply sent as Lists:
['<event-name>', value] ['<event-name>', value]
``` ```
Clients can send the following (3) methods: Clients can send with the following 3 methods:
* `subscribe` (`event_name`:string): Subscribe to an event. * `subscribe` (`event_name`:string): Subscribe to an event.
* `unsubscribe` (`subscription_id`:string): Unsubscribe from an event you previously subscribed to. * `unsubscribe` (`subscription_id`:string): Unsubscribe from an event you previously subscribed to.
* `publish` (`event_name`:string, `value`:any): Publish an event to all other clients who are subscribed. * `publish` (`event_name`:string, `value`:any): Publish an event to all other clients who are subscribed.
The client and server in `package:belatuk_pub_sub/isolate.dart` must make extra The client and server in `package:belatuk_pub_sub/isolate.dart` must make extra provisions to keep track of client ID's. Since `SendPort`s and `ReceivePort`s do not have any sort of guaranteed-unique ID's, new clients must send their `SendPort` to the server before sending any requests. The server then responds
provisions to keep track of client ID's. Since `SendPort`s and `ReceivePort`s
do not have any sort of guaranteed-unique ID's, new clients must send their
`SendPort` to the server before sending any requests. The server then responds
with an `id` that must be used to identify a `SendPort` to send a response to. with an `id` that must be used to identify a `SendPort` to send a response to.

View file

@ -10,5 +10,5 @@ dependencies:
uuid: ^4.0.0 uuid: ^4.0.0
collection: ^1.17.0 collection: ^1.17.0
dev_dependencies: dev_dependencies:
lints: ^2.0.0 lints: ^3.0.0
test: ^1.24.0 test: ^1.24.0

View file

@ -14,7 +14,7 @@ In your `pubspec.yaml`:
```yaml ```yaml
dependencies: dependencies:
belatuk_range_header: ^6.0.0 belatuk_range_header: ^8.0.0
``` ```
## Usage ## Usage

View file

@ -15,4 +15,4 @@ dev_dependencies:
http_parser: ^4.0.0 http_parser: ^4.0.0
logging: ^1.0.1 logging: ^1.0.1
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -30,8 +30,7 @@ foo.value = 'baz'; // Also throws a StateError - Once a variable is locked, it c
## Visibility ## Visibility
Variables are *public* by default, but can also be marked as *private* or *protected*. This can be helpful if you are trying Variables are *public* by default, but can also be marked as *private* or *protected*. This can be helpful if you are trying to determine which symbols should be exported from a library or class.
to determine which symbols should be exported from a library or class.
```dart ```dart
myVariable.visibility = Visibility.protected; myVariable.visibility = Visibility.protected;

View file

@ -8,4 +8,4 @@ dependencies:
collection: ^1.17.0 collection: ^1.17.0
dev_dependencies: dev_dependencies:
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0

View file

@ -6,4 +6,4 @@ environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'
dev_dependencies: dev_dependencies:
test: ^1.24.0 test: ^1.24.0
lints: ^2.0.0 lints: ^3.0.0