@btravstack/amqp-worker 0.26.0 → 0.28.0
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +13 -9
- package/dist/index.d.mts +13 -9
- package/dist/index.mjs +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -242,7 +242,7 @@ const amqp = (options) => {
|
|
|
242
242
|
* AmqpHandlers(orderContract)([orderNotifications, orderAudit])
|
|
243
243
|
* ```
|
|
244
244
|
*
|
|
245
|
-
* The first is `{ inject
|
|
245
|
+
* The first is `{ inject?, unit?, sync }`, whose `sync` hands back the whole
|
|
246
246
|
* handlers record — one `unit:` record for every entry in it. The second takes
|
|
247
247
|
* the pieces `AmqpHandler(contract, key)` builds: they are the provider's deps,
|
|
248
248
|
* keyed by the contract key each piece's port id carries, so the services
|
package/dist/index.d.cts
CHANGED
|
@@ -68,8 +68,8 @@ type MintedHandler<C extends AnyAmqpContract, K extends HandlerKeyOf<C>, N, U ex
|
|
|
68
68
|
* of the fork the delivery opened; the root's `unit.message` module must export
|
|
69
69
|
* every one of them.
|
|
70
70
|
*/
|
|
71
|
-
export declare const AmqpHandler: <C extends AnyAmqpContract, const K extends HandlerKeyOf<C>>(contract: C, key: K) => <const D extends Readonly<Record<string, AnyPort
|
|
72
|
-
readonly inject
|
|
71
|
+
export declare const AmqpHandler: <C extends AnyAmqpContract, const K extends HandlerKeyOf<C>>(contract: C, key: K) => <const D extends Readonly<Record<string, AnyPort>> = Record<never, never>, const U extends Readonly<Record<string, AnyPort>> = Record<never, never>>(options: {
|
|
72
|
+
readonly inject?: D;
|
|
73
73
|
/** The unit-scoped ports this handler reads off `context.unit`. */
|
|
74
74
|
readonly unit?: U;
|
|
75
75
|
readonly sync: (services: { readonly [N in keyof D]: ServiceOf<InstanceType<D[N]>>; }) => WorkerInferHandlers<C, {
|
|
@@ -77,7 +77,9 @@ export declare const AmqpHandler: <C extends AnyAmqpContract, const K extends Ha
|
|
|
77
77
|
}>[K & keyof WorkerInferHandlers<C, {
|
|
78
78
|
readonly unit: UnitRecordOf<U>;
|
|
79
79
|
}>];
|
|
80
|
-
}
|
|
80
|
+
} & ([keyof D] extends [never] ? unknown : {
|
|
81
|
+
readonly inject: D;
|
|
82
|
+
})) => MintedHandler<C, K, InstanceType<D[keyof D]>, U>;
|
|
81
83
|
//#endregion
|
|
82
84
|
//#region src/amqp-runtime.d.ts
|
|
83
85
|
/** What the worker publishes once it is consuming, read back through `RunningApp.runtimeInfo()`. */
|
|
@@ -185,21 +187,23 @@ type Uncovered<C extends AnyAmqpContract, T extends readonly PieceOf<C>[]> = Exc
|
|
|
185
187
|
* The record arm: the whole handlers record from one `sync`, with one `unit:`
|
|
186
188
|
* record shared by every entry in it.
|
|
187
189
|
*
|
|
188
|
-
* It is `{ inject
|
|
190
|
+
* It is `{ inject?, unit?, sync }` — di's other arms are gone — for PARITY, not
|
|
189
191
|
* for a type-system reason: `value` could have carried the record just as well,
|
|
190
192
|
* since `U` infers from `unit` and never from the arm. `@btravstack/http-server`'s
|
|
191
|
-
* `api.OrpcRouter(contract)` is `{ inject
|
|
193
|
+
* `api.OrpcRouter(contract)` is `{ inject?, unit?, sync }` and so are all three
|
|
192
194
|
* packages' piece factories, so one arm across the family is one surface to
|
|
193
195
|
* learn and one to keep.
|
|
194
196
|
*/
|
|
195
|
-
type Whole<C extends AnyAmqpContract> = <const D extends Readonly<Record<string, AnyPort
|
|
196
|
-
readonly inject
|
|
197
|
+
type Whole<C extends AnyAmqpContract> = <const D extends Readonly<Record<string, AnyPort>> = Record<never, never>, const U extends Readonly<Record<string, AnyPort>> = Record<never, never>>(options: {
|
|
198
|
+
readonly inject?: D;
|
|
197
199
|
/** The unit-scoped ports every handler in the record reads off `context.unit`. */
|
|
198
200
|
readonly unit?: U;
|
|
199
201
|
readonly sync: (services: { readonly [N in keyof D]: ServiceOf<InstanceType<D[N]>>; }) => WorkerInferHandlers<C, {
|
|
200
202
|
readonly unit: UnitRecordOf<U>;
|
|
201
203
|
}>;
|
|
202
|
-
}
|
|
204
|
+
} & ([keyof D] extends [never] ? unknown : {
|
|
205
|
+
readonly inject: D;
|
|
206
|
+
})) => Provider<HandlersInstanceOf<C>, never, InstanceType<D[keyof D]>> & {
|
|
203
207
|
readonly port: HandlersPortOf<C>;
|
|
204
208
|
/** Phantom: the declared ports, which `AmqpModule` gates `unit.message` against. */
|
|
205
209
|
readonly _declaredUnit?: InstanceType<U[keyof U]>;
|
|
@@ -226,7 +230,7 @@ type Compose<C extends AnyAmqpContract> = <const T extends readonly PieceOf<C>[]
|
|
|
226
230
|
* AmqpHandlers(orderContract)([orderNotifications, orderAudit])
|
|
227
231
|
* ```
|
|
228
232
|
*
|
|
229
|
-
* The first is `{ inject
|
|
233
|
+
* The first is `{ inject?, unit?, sync }`, whose `sync` hands back the whole
|
|
230
234
|
* handlers record — one `unit:` record for every entry in it. The second takes
|
|
231
235
|
* the pieces `AmqpHandler(contract, key)` builds: they are the provider's deps,
|
|
232
236
|
* keyed by the contract key each piece's port id carries, so the services
|
package/dist/index.d.mts
CHANGED
|
@@ -68,8 +68,8 @@ type MintedHandler<C extends AnyAmqpContract, K extends HandlerKeyOf<C>, N, U ex
|
|
|
68
68
|
* of the fork the delivery opened; the root's `unit.message` module must export
|
|
69
69
|
* every one of them.
|
|
70
70
|
*/
|
|
71
|
-
export declare const AmqpHandler: <C extends AnyAmqpContract, const K extends HandlerKeyOf<C>>(contract: C, key: K) => <const D extends Readonly<Record<string, AnyPort
|
|
72
|
-
readonly inject
|
|
71
|
+
export declare const AmqpHandler: <C extends AnyAmqpContract, const K extends HandlerKeyOf<C>>(contract: C, key: K) => <const D extends Readonly<Record<string, AnyPort>> = Record<never, never>, const U extends Readonly<Record<string, AnyPort>> = Record<never, never>>(options: {
|
|
72
|
+
readonly inject?: D;
|
|
73
73
|
/** The unit-scoped ports this handler reads off `context.unit`. */
|
|
74
74
|
readonly unit?: U;
|
|
75
75
|
readonly sync: (services: { readonly [N in keyof D]: ServiceOf<InstanceType<D[N]>>; }) => WorkerInferHandlers<C, {
|
|
@@ -77,7 +77,9 @@ export declare const AmqpHandler: <C extends AnyAmqpContract, const K extends Ha
|
|
|
77
77
|
}>[K & keyof WorkerInferHandlers<C, {
|
|
78
78
|
readonly unit: UnitRecordOf<U>;
|
|
79
79
|
}>];
|
|
80
|
-
}
|
|
80
|
+
} & ([keyof D] extends [never] ? unknown : {
|
|
81
|
+
readonly inject: D;
|
|
82
|
+
})) => MintedHandler<C, K, InstanceType<D[keyof D]>, U>;
|
|
81
83
|
//#endregion
|
|
82
84
|
//#region src/amqp-runtime.d.ts
|
|
83
85
|
/** What the worker publishes once it is consuming, read back through `RunningApp.runtimeInfo()`. */
|
|
@@ -185,21 +187,23 @@ type Uncovered<C extends AnyAmqpContract, T extends readonly PieceOf<C>[]> = Exc
|
|
|
185
187
|
* The record arm: the whole handlers record from one `sync`, with one `unit:`
|
|
186
188
|
* record shared by every entry in it.
|
|
187
189
|
*
|
|
188
|
-
* It is `{ inject
|
|
190
|
+
* It is `{ inject?, unit?, sync }` — di's other arms are gone — for PARITY, not
|
|
189
191
|
* for a type-system reason: `value` could have carried the record just as well,
|
|
190
192
|
* since `U` infers from `unit` and never from the arm. `@btravstack/http-server`'s
|
|
191
|
-
* `api.OrpcRouter(contract)` is `{ inject
|
|
193
|
+
* `api.OrpcRouter(contract)` is `{ inject?, unit?, sync }` and so are all three
|
|
192
194
|
* packages' piece factories, so one arm across the family is one surface to
|
|
193
195
|
* learn and one to keep.
|
|
194
196
|
*/
|
|
195
|
-
type Whole<C extends AnyAmqpContract> = <const D extends Readonly<Record<string, AnyPort
|
|
196
|
-
readonly inject
|
|
197
|
+
type Whole<C extends AnyAmqpContract> = <const D extends Readonly<Record<string, AnyPort>> = Record<never, never>, const U extends Readonly<Record<string, AnyPort>> = Record<never, never>>(options: {
|
|
198
|
+
readonly inject?: D;
|
|
197
199
|
/** The unit-scoped ports every handler in the record reads off `context.unit`. */
|
|
198
200
|
readonly unit?: U;
|
|
199
201
|
readonly sync: (services: { readonly [N in keyof D]: ServiceOf<InstanceType<D[N]>>; }) => WorkerInferHandlers<C, {
|
|
200
202
|
readonly unit: UnitRecordOf<U>;
|
|
201
203
|
}>;
|
|
202
|
-
}
|
|
204
|
+
} & ([keyof D] extends [never] ? unknown : {
|
|
205
|
+
readonly inject: D;
|
|
206
|
+
})) => Provider<HandlersInstanceOf<C>, never, InstanceType<D[keyof D]>> & {
|
|
203
207
|
readonly port: HandlersPortOf<C>;
|
|
204
208
|
/** Phantom: the declared ports, which `AmqpModule` gates `unit.message` against. */
|
|
205
209
|
readonly _declaredUnit?: InstanceType<U[keyof U]>;
|
|
@@ -226,7 +230,7 @@ type Compose<C extends AnyAmqpContract> = <const T extends readonly PieceOf<C>[]
|
|
|
226
230
|
* AmqpHandlers(orderContract)([orderNotifications, orderAudit])
|
|
227
231
|
* ```
|
|
228
232
|
*
|
|
229
|
-
* The first is `{ inject
|
|
233
|
+
* The first is `{ inject?, unit?, sync }`, whose `sync` hands back the whole
|
|
230
234
|
* handlers record — one `unit:` record for every entry in it. The second takes
|
|
231
235
|
* the pieces `AmqpHandler(contract, key)` builds: they are the provider's deps,
|
|
232
236
|
* keyed by the contract key each piece's port id carries, so the services
|
package/dist/index.mjs
CHANGED
|
@@ -241,7 +241,7 @@ const amqp = (options) => {
|
|
|
241
241
|
* AmqpHandlers(orderContract)([orderNotifications, orderAudit])
|
|
242
242
|
* ```
|
|
243
243
|
*
|
|
244
|
-
* The first is `{ inject
|
|
244
|
+
* The first is `{ inject?, unit?, sync }`, whose `sync` hands back the whole
|
|
245
245
|
* handlers record — one `unit:` record for every entry in it. The second takes
|
|
246
246
|
* the pieces `AmqpHandler(contract, key)` builds: they are the provider's deps,
|
|
247
247
|
* keyed by the contract key each piece's port id carries, so the services
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/amqp-worker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "The AMQP starter for @btravstack/core: the handlers as a port, one unit per delivery, and a drain the kernel's deadline releases",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"amqp",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"@amqp-contract/contract": "3.0.0-beta.11",
|
|
48
48
|
"@amqp-contract/testing": "3.0.0-beta.11",
|
|
49
49
|
"@amqp-contract/worker": "3.0.0-beta.11",
|
|
50
|
-
"@btravstack/config": "0.
|
|
51
|
-
"@btravstack/core": "0.
|
|
52
|
-
"@btravstack/di": "0.
|
|
50
|
+
"@btravstack/config": "0.28.0",
|
|
51
|
+
"@btravstack/core": "0.28.0",
|
|
52
|
+
"@btravstack/di": "0.28.0",
|
|
53
53
|
"@btravstack/internal-test-infra": "0.0.0",
|
|
54
|
-
"@btravstack/testing": "0.
|
|
54
|
+
"@btravstack/testing": "0.28.0",
|
|
55
55
|
"@btravstack/tsconfig": "0.4.0",
|
|
56
56
|
"@opentelemetry/api": "1.9.1",
|
|
57
57
|
"@types/node": "26.6.4",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@amqp-contract/worker": "^3.0.0-beta.7",
|
|
69
|
-
"@btravstack/config": "^0.
|
|
70
|
-
"@btravstack/core": "^0.
|
|
71
|
-
"@btravstack/di": "^0.
|
|
69
|
+
"@btravstack/config": "^0.28.0",
|
|
70
|
+
"@btravstack/core": "^0.28.0",
|
|
71
|
+
"@btravstack/di": "^0.28.0",
|
|
72
72
|
"@opentelemetry/api": "^1",
|
|
73
73
|
"unthrown": "^5.7.0"
|
|
74
74
|
},
|