@owlmeans/queue 0.1.18-rc.4 → 0.1.18-rc.40

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.
Files changed (71) hide show
  1. package/README.md +285 -8
  2. package/agent-meta/manifest.json +9 -2
  3. package/agent-meta/skills/queue/SKILL.md +241 -12
  4. package/agent-meta/skills/scheduled-jobs/SKILL.md +151 -0
  5. package/build/bridge.d.ts +30 -0
  6. package/build/bridge.d.ts.map +1 -0
  7. package/build/bridge.js +108 -0
  8. package/build/bridge.js.map +1 -0
  9. package/build/config.d.ts +50 -0
  10. package/build/config.d.ts.map +1 -0
  11. package/build/config.js +141 -0
  12. package/build/config.js.map +1 -0
  13. package/build/consts.d.ts +33 -0
  14. package/build/consts.d.ts.map +1 -0
  15. package/build/consts.js +35 -0
  16. package/build/consts.js.map +1 -0
  17. package/build/errors.d.ts +68 -0
  18. package/build/errors.d.ts.map +1 -0
  19. package/build/errors.js +103 -0
  20. package/build/errors.js.map +1 -0
  21. package/build/index.d.ts +10 -0
  22. package/build/index.d.ts.map +1 -1
  23. package/build/index.js +10 -1
  24. package/build/index.js.map +1 -1
  25. package/build/protocol.d.ts +10 -0
  26. package/build/protocol.d.ts.map +1 -0
  27. package/build/protocol.js +56 -0
  28. package/build/protocol.js.map +1 -0
  29. package/build/route.d.ts +9 -0
  30. package/build/route.d.ts.map +1 -0
  31. package/build/route.js +31 -0
  32. package/build/route.js.map +1 -0
  33. package/build/transport.d.ts +15 -0
  34. package/build/transport.d.ts.map +1 -0
  35. package/build/transport.js +59 -0
  36. package/build/transport.js.map +1 -0
  37. package/build/types.d.ts +309 -0
  38. package/build/types.d.ts.map +1 -0
  39. package/build/types.js +2 -0
  40. package/build/types.js.map +1 -0
  41. package/build/types.local.d.ts +3 -0
  42. package/build/types.local.d.ts.map +1 -0
  43. package/build/types.local.js +2 -0
  44. package/build/types.local.js.map +1 -0
  45. package/build/utils.d.ts +4 -0
  46. package/build/utils.d.ts.map +1 -0
  47. package/build/utils.js +4 -0
  48. package/build/utils.js.map +1 -0
  49. package/build/worker.d.ts +27 -0
  50. package/build/worker.d.ts.map +1 -0
  51. package/build/worker.js +59 -0
  52. package/build/worker.js.map +1 -0
  53. package/package.json +13 -3
  54. package/src/bridge.ts +126 -0
  55. package/src/config.ts +171 -0
  56. package/src/consts.ts +38 -0
  57. package/src/errors.ts +121 -0
  58. package/src/index.ts +10 -0
  59. package/src/protocol.ts +74 -0
  60. package/src/route.ts +40 -0
  61. package/src/transport.ts +77 -0
  62. package/src/types.local.ts +3 -0
  63. package/src/types.ts +323 -0
  64. package/src/utils.ts +5 -0
  65. package/src/worker.ts +73 -0
  66. package/tests/bridge.spec.ts +64 -0
  67. package/tests/config.spec.ts +66 -0
  68. package/tests/protocol.spec.ts +58 -0
  69. package/tests/schedule.spec.ts +100 -0
  70. package/tsconfig.json +1 -0
  71. package/build/.gitkeep +0 -0
@@ -0,0 +1,68 @@
1
+ import { ResilientError } from '@owlmeans/error';
2
+ export declare class QueueError extends ResilientError {
3
+ static typeName: string;
4
+ constructor(message?: string);
5
+ }
6
+ /**
7
+ * The caller stopped waiting. The job is untouched — it may still be queued, running, or already
8
+ * finished; only the wait ended. Read the job back to learn which.
9
+ */
10
+ export declare class QueueTimeout extends QueueError {
11
+ static typeName: string;
12
+ constructor(msg: string);
13
+ }
14
+ /** No job with that id in this queue — it never existed, or it was removed after completing. */
15
+ export declare class UnknownJob extends QueueError {
16
+ static typeName: string;
17
+ constructor(msg: string);
18
+ }
19
+ /**
20
+ * A job name the queue does not declare. Declaring every job a queue accepts is what keeps an
21
+ * enqueue from succeeding into a queue where nothing can ever process it.
22
+ */
23
+ export declare class UnknownJobName extends QueueError {
24
+ static typeName: string;
25
+ constructor(msg: string);
26
+ }
27
+ /** A queue asked for that no declaration names. */
28
+ export declare class UnknownQueue extends QueueError {
29
+ static typeName: string;
30
+ constructor(msg: string);
31
+ }
32
+ /**
33
+ * This process was asked to consume a queue it does not listen to. Which queues a process
34
+ * consumes is configuration (`cfg.queue.listen`), so this is a deployment question, not a code
35
+ * one — the same binary is a producer or a worker depending on it.
36
+ */
37
+ export declare class QueueNotListening extends QueueError {
38
+ static typeName: string;
39
+ constructor(msg: string);
40
+ }
41
+ /**
42
+ * The job named an entrypoint this process does not serve. Unlike a missing queue this is not a
43
+ * declaration problem: the alias exists, but nothing here bound it, so the job was taken by a
44
+ * worker that cannot run it.
45
+ */
46
+ export declare class JobNotServed extends QueueError {
47
+ static typeName: string;
48
+ constructor(msg: string);
49
+ }
50
+ /**
51
+ * The signed envelope is older than the configured lifetime. Freshness is judged from when the
52
+ * producer enqueued the job, not from when a worker picked it up, so a long backlog does not
53
+ * invalidate work that was legitimate when it was submitted.
54
+ */
55
+ export declare class EnvelopeExpired extends QueueError {
56
+ static typeName: string;
57
+ constructor(msg: string);
58
+ }
59
+ /**
60
+ * A schedule the broker could not carry out as written: no id, both or neither of `every` and
61
+ * `pattern`, an option that only means something for the other one, or a job option the broker
62
+ * owns for a scheduled run. The message names the schedule id and the reason.
63
+ */
64
+ export declare class ScheduleMisdeclared extends QueueError {
65
+ static typeName: string;
66
+ constructor(msg: string);
67
+ }
68
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,qBAAa,UAAW,SAAQ,cAAc;IAC5C,OAAuB,QAAQ,SAAe;IAE9C,YAAY,OAAO,GAAE,MAAgB,EAEpC;CACF;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C,OAAuB,QAAQ,SAAkC;IAEjE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED,gGAAgG;AAChG,qBAAa,UAAW,SAAQ,UAAU;IACxC,OAAuB,QAAQ,SAAqC;IAEpE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED;;;GAGG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,OAAuB,QAAQ,SAAyC;IAExE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED,mDAAmD;AACnD,qBAAa,YAAa,SAAQ,UAAU;IAC1C,OAAuB,QAAQ,SAAuC;IAEtE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C,OAAuB,QAAQ,SAAuC;IAEtE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C,OAAuB,QAAQ,SAAuC;IAEtE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAuB,QAAQ,SAA0C;IAEzE,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACjD,OAAuB,QAAQ,SAA8C;IAE7E,YAAY,GAAG,EAAE,MAAM,EAGtB;CACF"}
@@ -0,0 +1,103 @@
1
+ import { ResilientError } from '@owlmeans/error';
2
+ export class QueueError extends ResilientError {
3
+ static typeName = 'QueueError';
4
+ constructor(message = 'error') {
5
+ super(QueueError.typeName, `queue:${message}`);
6
+ }
7
+ }
8
+ /**
9
+ * The caller stopped waiting. The job is untouched — it may still be queued, running, or already
10
+ * finished; only the wait ended. Read the job back to learn which.
11
+ */
12
+ export class QueueTimeout extends QueueError {
13
+ static typeName = `${QueueError.typeName}Timeout`;
14
+ constructor(msg) {
15
+ super(`timeout:${msg}`);
16
+ this.type = QueueTimeout.typeName;
17
+ }
18
+ }
19
+ /** No job with that id in this queue — it never existed, or it was removed after completing. */
20
+ export class UnknownJob extends QueueError {
21
+ static typeName = `${QueueError.typeName}UnknownJob`;
22
+ constructor(msg) {
23
+ super(`unknown-job:${msg}`);
24
+ this.type = UnknownJob.typeName;
25
+ }
26
+ }
27
+ /**
28
+ * A job name the queue does not declare. Declaring every job a queue accepts is what keeps an
29
+ * enqueue from succeeding into a queue where nothing can ever process it.
30
+ */
31
+ export class UnknownJobName extends QueueError {
32
+ static typeName = `${QueueError.typeName}UnknownJobName`;
33
+ constructor(msg) {
34
+ super(`unknown-job-name:${msg}`);
35
+ this.type = UnknownJobName.typeName;
36
+ }
37
+ }
38
+ /** A queue asked for that no declaration names. */
39
+ export class UnknownQueue extends QueueError {
40
+ static typeName = `${QueueError.typeName}UnknownQueue`;
41
+ constructor(msg) {
42
+ super(`unknown-queue:${msg}`);
43
+ this.type = UnknownQueue.typeName;
44
+ }
45
+ }
46
+ /**
47
+ * This process was asked to consume a queue it does not listen to. Which queues a process
48
+ * consumes is configuration (`cfg.queue.listen`), so this is a deployment question, not a code
49
+ * one — the same binary is a producer or a worker depending on it.
50
+ */
51
+ export class QueueNotListening extends QueueError {
52
+ static typeName = `${QueueError.typeName}NotListening`;
53
+ constructor(msg) {
54
+ super(`not-listening:${msg}`);
55
+ this.type = QueueNotListening.typeName;
56
+ }
57
+ }
58
+ /**
59
+ * The job named an entrypoint this process does not serve. Unlike a missing queue this is not a
60
+ * declaration problem: the alias exists, but nothing here bound it, so the job was taken by a
61
+ * worker that cannot run it.
62
+ */
63
+ export class JobNotServed extends QueueError {
64
+ static typeName = `${QueueError.typeName}JobNotServed`;
65
+ constructor(msg) {
66
+ super(`job-not-served:${msg}`);
67
+ this.type = JobNotServed.typeName;
68
+ }
69
+ }
70
+ /**
71
+ * The signed envelope is older than the configured lifetime. Freshness is judged from when the
72
+ * producer enqueued the job, not from when a worker picked it up, so a long backlog does not
73
+ * invalidate work that was legitimate when it was submitted.
74
+ */
75
+ export class EnvelopeExpired extends QueueError {
76
+ static typeName = `${QueueError.typeName}EnvelopeExpired`;
77
+ constructor(msg) {
78
+ super(`envelope-expired:${msg}`);
79
+ this.type = EnvelopeExpired.typeName;
80
+ }
81
+ }
82
+ /**
83
+ * A schedule the broker could not carry out as written: no id, both or neither of `every` and
84
+ * `pattern`, an option that only means something for the other one, or a job option the broker
85
+ * owns for a scheduled run. The message names the schedule id and the reason.
86
+ */
87
+ export class ScheduleMisdeclared extends QueueError {
88
+ static typeName = `${QueueError.typeName}ScheduleMisdeclared`;
89
+ constructor(msg) {
90
+ super(`schedule-misdeclared:${msg}`);
91
+ this.type = ScheduleMisdeclared.typeName;
92
+ }
93
+ }
94
+ ResilientError.registerErrorClass(QueueError);
95
+ ResilientError.registerErrorClass(QueueTimeout);
96
+ ResilientError.registerErrorClass(UnknownJob);
97
+ ResilientError.registerErrorClass(UnknownJobName);
98
+ ResilientError.registerErrorClass(UnknownQueue);
99
+ ResilientError.registerErrorClass(QueueNotListening);
100
+ ResilientError.registerErrorClass(JobNotServed);
101
+ ResilientError.registerErrorClass(EnvelopeExpired);
102
+ ResilientError.registerErrorClass(ScheduleMisdeclared);
103
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,OAAO,UAAW,SAAQ,cAAc;IACrC,MAAM,CAAU,QAAQ,GAAG,YAAY,CAAA;IAE9C,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC,CAAA;IAChD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IACnC,MAAM,CAAU,QAAQ,GAAG,GAAG,UAAU,CAAC,QAAQ,SAAS,CAAA;IAEjE,YAAY,GAAW;QACrB,KAAK,CAAC,WAAW,GAAG,EAAE,CAAC,CAAA;QACvB,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAA;IACnC,CAAC;CACF;AAED,gGAAgG;AAChG,MAAM,OAAO,UA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AAG,YAAY,CAAC,QAAQ,CAAA;IACnC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IACtC,MAAM,CAAU,QAAQ,GAAG,GAAG,UAAU,CAAC,QAAQ,iBAAiB,CAAA;IAEzE,YAAY,GAAW;QACrB,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAA;IACtC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAC1C,MAAM,CAAU,QAAQ,GAAG,GAAG,UAAU,CAAC,QAAQ,qBAAqB,CAAA;IAE7E,YAAY,GAAW;QACrB,KAAK,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,QAAQ,CAAA;IAC1C,CAAC;CACF;AAED,cAAc,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;AAC7C,cAAc,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAC/C,cAAc,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;AAC7C,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;AACjD,cAAc,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAC/C,cAAc,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;AACpD,cAAc,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAC/C,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAA;AAClD,cAAc,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -1 +1,11 @@
1
+ export * from './types.js';
2
+ export * from './consts.js';
3
+ export * from './utils.js';
4
+ export * from './errors.js';
5
+ export * from './config.js';
6
+ export * from './transport.js';
7
+ export * from './bridge.js';
8
+ export * from './worker.js';
9
+ export * from './protocol.js';
10
+ export * from './route.js';
1
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
package/build/index.js CHANGED
@@ -1,2 +1,11 @@
1
- "use strict";
1
+ export * from './types.js';
2
+ export * from './consts.js';
3
+ export * from './utils.js';
4
+ export * from './errors.js';
5
+ export * from './config.js';
6
+ export * from './transport.js';
7
+ export * from './bridge.js';
8
+ export * from './worker.js';
9
+ export * from './protocol.js';
10
+ export * from './route.js';
2
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { type EntrypointProtocolDeclaration, type RequestOf, type ResponseOf } from '@owlmeans/entrypoint';
2
+ import type { JobEnvelope, JobOptions, JobRecord, JobReply } from './types.js';
3
+ import type { QueueContext } from './types.local.js';
4
+ /** Enqueue an immutable QUEUE protocol while preserving its exact request and response types. */
5
+ export declare const enqueueProtocol: <Protocol extends EntrypointProtocolDeclaration>(context: QueueContext, declaration: Protocol, request: RequestOf<Protocol>, options?: JobOptions) => Promise<JobRecord<JobEnvelope, JobReply<ResponseOf<Protocol>>>>;
6
+ /** Wait for a protocol job and unwrap the typed entrypoint reply. */
7
+ export declare const waitForProtocol: <Protocol extends EntrypointProtocolDeclaration>(context: QueueContext, declaration: Protocol, job: string | JobRecord<JobEnvelope, JobReply<ResponseOf<Protocol>>>, options?: {
8
+ timeout?: number;
9
+ }) => Promise<ResponseOf<Protocol>>;
10
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,6BAA6B,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAwB,MAAM,sBAAsB,CAAA;AAKhI,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAoBpD,iGAAiG;AACjG,eAAO,MAAM,eAAe,GAAU,QAAQ,SAAS,6BAA6B,WACzE,YAAY,eACR,QAAQ,WACZ,SAAS,CAAC,QAAQ,CAAC,YAClB,UAAU,KACnB,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAkBhE,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,eAAe,GAAU,QAAQ,SAAS,6BAA6B,WACzE,YAAY,eACR,QAAQ,OAChB,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,YAC1D;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAC7B,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAe9B,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { isEntrypointProtocol } from '@owlmeans/entrypoint';
2
+ import { ResilientError } from '@owlmeans/error';
3
+ import { queueOf } from './config.js';
4
+ import { UnknownQueue } from './errors.js';
5
+ import { isQueueRoute, queueRouteOptions } from './route.js';
6
+ const queueFor = (context, declaration) => {
7
+ if (declaration == null || typeof declaration !== 'object' || !isEntrypointProtocol(declaration)) {
8
+ throw new UnknownQueue('protocol declaration required');
9
+ }
10
+ if (!isQueueRoute(declaration.route)) {
11
+ throw new UnknownQueue(`${declaration.alias}: not a queue protocol`);
12
+ }
13
+ const { queue } = queueRouteOptions(declaration.route);
14
+ const configured = queueOf(context.cfg, queue);
15
+ if (!configured.jobs.includes(declaration.alias)) {
16
+ throw new UnknownQueue(`${queue}:${declaration.alias}`);
17
+ }
18
+ return { protocol: declaration, queue };
19
+ };
20
+ /** Enqueue an immutable QUEUE protocol while preserving its exact request and response types. */
21
+ export const enqueueProtocol = async (context, declaration, request, options) => {
22
+ const { protocol, queue } = queueFor(context, declaration);
23
+ const shaped = (request ?? {});
24
+ const envelope = {
25
+ alias: protocol.alias,
26
+ params: shaped.params,
27
+ body: shaped.body,
28
+ query: shaped.query,
29
+ headers: shaped.headers,
30
+ enqueuedAt: new Date().toISOString(),
31
+ };
32
+ return await context.jobs(queue).create({
33
+ queue,
34
+ name: protocol.alias,
35
+ data: envelope,
36
+ opts: options,
37
+ });
38
+ };
39
+ /** Wait for a protocol job and unwrap the typed entrypoint reply. */
40
+ export const waitForProtocol = async (context, declaration, job, options) => {
41
+ const { protocol, queue } = queueFor(context, declaration);
42
+ if (typeof job !== 'string' && (job.queue !== queue || job.name !== protocol.alias)) {
43
+ throw new UnknownQueue(`${job.queue}:${job.name}`);
44
+ }
45
+ const id = typeof job === 'string' ? job : job.id;
46
+ if (id == null) {
47
+ throw new UnknownQueue(`${queue}:${protocol.alias}: missing job id`);
48
+ }
49
+ const reply = await context.jobs(queue)
50
+ .wait(id, options);
51
+ if (reply.error != null) {
52
+ throw ResilientError.ensure(reply.error);
53
+ }
54
+ return reply.value;
55
+ };
56
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChI,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAI5D,MAAM,QAAQ,GAAG,CAAC,OAAqB,EAAE,WAAoB,EAG3D,EAAE;IACF,IAAI,WAAW,IAAI,IAAI,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,CAAC;QACjG,MAAM,IAAI,YAAY,CAAC,+BAA+B,CAAC,CAAA;IACzD,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,YAAY,CAAC,GAAG,WAAW,CAAC,KAAK,wBAAwB,CAAC,CAAA;IACtE,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IACtD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,YAAY,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC,CAAA;IAC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Y,CAAC,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;IACD,MAAM,EAAE,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAA;IACjD,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;QACf,MAAM,IAAI,YAAY,CAAC,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,kBAAkB,CAAC,CAAA;IACtE,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAI,CAA8C,KAAK,CAAC;SACjF,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACpB,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,KAAuB,CAAC,CAAA;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC,KAA6B,CAAA;AAC5C,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { type RouteDeclaration, type RouteModel, type RouteOptions } from '@owlmeans/route';
2
+ import type { QueueRouteOptions } from './types.js';
3
+ /** Declare a backend route carried by a queue. */
4
+ export declare const job: (opts: QueueRouteOptions, secondary?: Omit<QueueRouteOptions, 'queue'>) => Partial<RouteOptions>;
5
+ /** Whether a declaration belongs to the queue transport. */
6
+ export declare const isQueueRoute: (route: RouteDeclaration | RouteModel) => boolean;
7
+ /** Read and validate queue-owned route options. */
8
+ export declare const queueRouteOptions: (route: RouteDeclaration | RouteModel) => Pick<QueueRouteOptions, 'queue' | 'reply'>;
9
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,kDAAkD;AAClD,eAAO,MAAM,GAAG,SACR,iBAAiB,cACX,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,KAC3C,OAAO,CAAC,YAAY,CAMtB,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,YAAY,UAAW,gBAAgB,GAAG,UAAU,KAAG,OACE,CAAA;AAEtE,mDAAmD;AACnD,eAAO,MAAM,iBAAiB,UACrB,gBAAgB,GAAG,UAAU,KACnC,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,OAAO,CAe3C,CAAA"}
package/build/route.js ADDED
@@ -0,0 +1,31 @@
1
+ import { backend } from '@owlmeans/route';
2
+ import { UnknownQueue } from './errors.js';
3
+ import { QUEUE_PROTOCOL } from './consts.js';
4
+ /** Declare a backend route carried by a queue. */
5
+ export const job = (opts, secondary) => {
6
+ const { queue, reply, ...routeOptions } = { ...opts, ...secondary };
7
+ const declaration = backend(routeOptions);
8
+ declaration.protocol = QUEUE_PROTOCOL;
9
+ declaration.protocolOptions = { queue, ...(reply == null ? {} : { reply }) };
10
+ return declaration;
11
+ };
12
+ /** Whether a declaration belongs to the queue transport. */
13
+ export const isQueueRoute = (route) => ('route' in route ? route.route : route).protocol === QUEUE_PROTOCOL;
14
+ /** Read and validate queue-owned route options. */
15
+ export const queueRouteOptions = (route) => {
16
+ const declaration = 'route' in route ? route.route : route;
17
+ if (declaration.protocol !== QUEUE_PROTOCOL
18
+ || declaration.protocolOptions == null
19
+ || typeof declaration.protocolOptions !== 'object') {
20
+ throw new UnknownQueue(`${declaration.alias}: not a queue protocol`);
21
+ }
22
+ const options = declaration.protocolOptions;
23
+ if (typeof options.queue !== 'string' || options.queue.trim() === '') {
24
+ throw new UnknownQueue(`${declaration.alias}: route declares no queue`);
25
+ }
26
+ if (options.reply != null && typeof options.reply !== 'boolean') {
27
+ throw new UnknownQueue(`${declaration.alias}: invalid queue reply option`);
28
+ }
29
+ return { queue: options.queue, reply: options.reply };
30
+ };
31
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../src/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA6D,MAAM,iBAAiB,CAAA;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG5C,kDAAkD;AAClD,MAAM,CAAC,MAAM,GAAG,GAAG,CACjB,IAAuB,EACvB,SAA4C,EACrB,EAAE;IACzB,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,CAAA;IACnE,MAAM,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IACzC,WAAW,CAAC,QAAQ,GAAG,cAAc,CAAA;IACrC,WAAW,CAAC,eAAe,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;IAC5E,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED,4DAA4D;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAW,EAAE,CAC5E,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,KAAK,cAAc,CAAA;AAEtE,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAoC,EACQ,EAAE;IAC9C,MAAM,WAAW,GAAG,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;IAC1D,IAAI,WAAW,CAAC,QAAQ,KAAK,cAAc;WACtC,WAAW,CAAC,eAAe,IAAI,IAAI;WACnC,OAAO,WAAW,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;QACrD,MAAM,IAAI,YAAY,CAAC,GAAG,WAAW,CAAC,KAAK,wBAAwB,CAAC,CAAA;IACtE,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,eAA0C,CAAA;IACtE,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACrE,MAAM,IAAI,YAAY,CAAC,GAAG,WAAW,CAAC,KAAK,2BAA2B,CAAC,CAAA;IACzE,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChE,MAAM,IAAI,YAAY,CAAC,GAAG,WAAW,CAAC,KAAK,8BAA8B,CAAC,CAAA;IAC5E,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAA4B,EAAE,CAAA;AAC9E,CAAC,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { type EntrypointTransport } from '@owlmeans/entrypoint';
2
+ import type { Config, Context } from './types.js';
3
+ /**
4
+ * The producing half of the bridge: it turns a call on a QUEUE entrypoint into a job, and the
5
+ * job's outcome back into a reply.
6
+ *
7
+ * Registering it is the whole opt-in. `apiHandler` looks up a transport by the route's protocol,
8
+ * so a consumer writes `ep.call(...)` against a declaration it shares with every other kind of
9
+ * entrypoint and never learns which one carried it. That is also why the envelope is built from
10
+ * the request rather than from the entrypoint: the far side rebuilds a request, and anything only
11
+ * HTTP understands would not survive the trip anyway.
12
+ */
13
+ export declare const makeQueueTransport: (alias?: string) => EntrypointTransport;
14
+ export declare const appendQueueTransport: <C extends Config, T extends Context<C> = Context<C>>(context: T, alias?: string) => T;
15
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,mBAAmB,EAA4D,MAAM,sBAAsB,CAAA;AAEtK,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAsC,MAAM,YAAY,CAAA;AAIrF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,WAAW,MAAM,wBAiD/C,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,WAC7E,CAAC,UAAU,MAAM,KACzB,CAMF,CAAA"}
@@ -0,0 +1,59 @@
1
+ import { assertContext, createService } from '@owlmeans/context';
2
+ import { EntrypointOutcome, transportAlias } from '@owlmeans/entrypoint';
3
+ import { ResilientError } from '@owlmeans/error';
4
+ import { DEFAULT_JOB_TIMEOUT, QUEUE_PROTOCOL } from './consts.js';
5
+ import { queueRouteOptions } from './route.js';
6
+ /**
7
+ * The producing half of the bridge: it turns a call on a QUEUE entrypoint into a job, and the
8
+ * job's outcome back into a reply.
9
+ *
10
+ * Registering it is the whole opt-in. `apiHandler` looks up a transport by the route's protocol,
11
+ * so a consumer writes `ep.call(...)` against a declaration it shares with every other kind of
12
+ * entrypoint and never learns which one carried it. That is also why the envelope is built from
13
+ * the request rather than from the entrypoint: the far side rebuilds a request, and anything only
14
+ * HTTP understands would not survive the trip anyway.
15
+ */
16
+ export const makeQueueTransport = (alias = transportAlias(QUEUE_PROTOCOL)) => {
17
+ const location = `queue-transport:${alias}`;
18
+ const service = createService(alias, {
19
+ protocol: QUEUE_PROTOCOL,
20
+ handle: (async (req, res) => {
21
+ const context = assertContext(service.ctx, location);
22
+ const entrypoint = context.entrypoint(req.alias);
23
+ const route = entrypoint.route.route;
24
+ const { queue, reply: waitsForReply } = queueRouteOptions(route);
25
+ const jobs = context.jobs(queue);
26
+ const envelope = {
27
+ alias: req.alias,
28
+ params: req.params,
29
+ body: req.body,
30
+ query: req.query,
31
+ headers: req.headers,
32
+ enqueuedAt: new Date().toISOString(),
33
+ };
34
+ const job = await jobs.create({ queue, name: req.alias, data: envelope });
35
+ // `reply: false` says the caller is not waiting for the work, only for the promise that it
36
+ // was taken. `Accepted` plus the job's identity is the whole answer — enough to watch it.
37
+ if (waitsForReply === false) {
38
+ res.resolve({ id: job.id, queue }, EntrypointOutcome.Accepted);
39
+ return;
40
+ }
41
+ const reply = await jobs.wait(job.id, {
42
+ timeout: req.timeout ?? route.timeout ?? DEFAULT_JOB_TIMEOUT
43
+ });
44
+ // A processor reports a domain failure by returning it, so it crosses the hop as the class
45
+ // it was thrown as rather than as a string a caller would have to parse.
46
+ if (reply?.error != null) {
47
+ throw ResilientError.ensure(reply.error);
48
+ }
49
+ res.resolve(reply?.value, reply?.outcome ?? EntrypointOutcome.Ok);
50
+ })
51
+ });
52
+ return service;
53
+ };
54
+ export const appendQueueTransport = (context, alias) => {
55
+ const service = makeQueueTransport(alias);
56
+ context.registerService(service);
57
+ return context;
58
+ };
59
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAyE,iBAAiB,EAAE,cAAc,EAAyB,MAAM,sBAAsB,CAAA;AACtK,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,GAAW,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE;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