@isoloop/bus 0.1.0-next.11 → 0.1.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/package.json +15 -4
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @isoloop/bus
|
|
2
|
+
|
|
3
|
+
The [Isoloop](https://isoloop.dev) bus: a log of typed topics in its own worker, through which the parts of your app share data and catch up after a restart.
|
|
4
|
+
|
|
5
|
+
## What you get
|
|
6
|
+
|
|
7
|
+
- **Contracts:** topics with schemas from any [Standard Schema](https://standardschema.dev) library, typed where you use them and checked on every publish.
|
|
8
|
+
- **Retention:** keep the newest records, a span of time, or the latest record for each key.
|
|
9
|
+
- **Replay:** a subscriber that starts late, or restarts, reads what it needs from the log.
|
|
10
|
+
- **Backpressure:** records wait in the log for a busy subscriber, within the topic's retention.
|
|
11
|
+
- **History that lasts:** a persistent topic's records and committed positions survive a reload and a restart of the bus.
|
|
12
|
+
- **Request and reply** (experimental): ask on a topic and get a typed answer.
|
|
13
|
+
- **Contract tests:** `testContracts` from `@isoloop/bus/testing` checks your schemas against samples.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install @isoloop/bus@next zod
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { contracts, topic } from '@isoloop/bus';
|
|
25
|
+
import { z } from 'zod';
|
|
26
|
+
|
|
27
|
+
export const cartItems = topic('cart.items.v1', {
|
|
28
|
+
schema: z.object({ sku: z.string(), qty: z.number().int().positive() }),
|
|
29
|
+
retention: { kind: 'compacted' },
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default contracts(cartItems);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Learn more
|
|
36
|
+
|
|
37
|
+
- [The bus](https://isoloop.dev/docs/bus/)
|
|
38
|
+
- [Contracts and grants](https://isoloop.dev/docs/contracts/)
|
|
39
|
+
- [API reference](https://isoloop.dev/docs/api/bus/)
|
package/package.json
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isoloop/bus",
|
|
3
|
-
"version": "0.1.0-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-next.12",
|
|
4
|
+
"description": "The Isoloop message bus: typed topics in a worker, with retention, replay and durable history.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"isoloop",
|
|
7
|
+
"web-workers",
|
|
8
|
+
"event-loop",
|
|
9
|
+
"isolation",
|
|
10
|
+
"message-bus",
|
|
11
|
+
"pubsub",
|
|
12
|
+
"event-log",
|
|
13
|
+
"replay"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://isoloop.dev/docs/api/bus/",
|
|
5
16
|
"license": "MIT",
|
|
6
17
|
"type": "module",
|
|
7
18
|
"sideEffects": [
|
|
@@ -30,8 +41,8 @@
|
|
|
30
41
|
}
|
|
31
42
|
},
|
|
32
43
|
"dependencies": {
|
|
33
|
-
"@isoloop/codec": "0.1.0-next.
|
|
34
|
-
"@isoloop/protocol": "0.1.0-next.
|
|
44
|
+
"@isoloop/codec": "0.1.0-next.12",
|
|
45
|
+
"@isoloop/protocol": "0.1.0-next.12"
|
|
35
46
|
},
|
|
36
47
|
"devDependencies": {
|
|
37
48
|
"fast-check": "4.10.2",
|