@memberjunction/work-queue-core 0.0.0 → 6.2.0-edge.3

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 (131) hide show
  1. package/LICENSE +183 -0
  2. package/README.md +128 -43
  3. package/dist/api/WorkQueueApiPublisher.d.ts +35 -0
  4. package/dist/api/WorkQueueApiPublisher.d.ts.map +1 -0
  5. package/dist/api/WorkQueueApiPublisher.js +136 -0
  6. package/dist/api/WorkQueueApiPublisher.js.map +1 -0
  7. package/dist/api/restContract.d.ts +50 -0
  8. package/dist/api/restContract.d.ts.map +1 -0
  9. package/dist/api/restContract.js +247 -0
  10. package/dist/api/restContract.js.map +1 -0
  11. package/dist/backoff.d.ts +15 -0
  12. package/dist/backoff.d.ts.map +1 -0
  13. package/dist/backoff.js +29 -0
  14. package/dist/backoff.js.map +1 -0
  15. package/dist/compatibility.d.ts +10 -0
  16. package/dist/compatibility.d.ts.map +1 -0
  17. package/dist/compatibility.js +41 -0
  18. package/dist/compatibility.js.map +1 -0
  19. package/dist/envelope.d.ts +33 -0
  20. package/dist/envelope.d.ts.map +1 -0
  21. package/dist/envelope.js +2 -0
  22. package/dist/envelope.js.map +1 -0
  23. package/dist/errors.d.ts +14 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/errors.js +23 -0
  26. package/dist/errors.js.map +1 -0
  27. package/dist/filter.d.ts +12 -0
  28. package/dist/filter.d.ts.map +1 -0
  29. package/dist/filter.js +187 -0
  30. package/dist/filter.js.map +1 -0
  31. package/dist/filterTypes.d.ts +25 -0
  32. package/dist/filterTypes.d.ts.map +1 -0
  33. package/dist/filterTypes.js +2 -0
  34. package/dist/filterTypes.js.map +1 -0
  35. package/dist/handler.d.ts +56 -0
  36. package/dist/handler.d.ts.map +1 -0
  37. package/dist/handler.js +25 -0
  38. package/dist/handler.js.map +1 -0
  39. package/dist/index.d.ts +24 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +27 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/manifest.d.ts +46 -0
  44. package/dist/manifest.d.ts.map +1 -0
  45. package/dist/manifest.js +2 -0
  46. package/dist/manifest.js.map +1 -0
  47. package/dist/memory/InMemoryConsumer.d.ts +18 -0
  48. package/dist/memory/InMemoryConsumer.d.ts.map +1 -0
  49. package/dist/memory/InMemoryConsumer.js +36 -0
  50. package/dist/memory/InMemoryConsumer.js.map +1 -0
  51. package/dist/memory/InMemoryOperator.d.ts +13 -0
  52. package/dist/memory/InMemoryOperator.d.ts.map +1 -0
  53. package/dist/memory/InMemoryOperator.js +25 -0
  54. package/dist/memory/InMemoryOperator.js.map +1 -0
  55. package/dist/memory/InMemoryStore.d.ts +82 -0
  56. package/dist/memory/InMemoryStore.d.ts.map +1 -0
  57. package/dist/memory/InMemoryStore.js +436 -0
  58. package/dist/memory/InMemoryStore.js.map +1 -0
  59. package/dist/memory/InMemoryTransport.d.ts +29 -0
  60. package/dist/memory/InMemoryTransport.d.ts.map +1 -0
  61. package/dist/memory/InMemoryTransport.js +48 -0
  62. package/dist/memory/InMemoryTransport.js.map +1 -0
  63. package/dist/operator.d.ts +60 -0
  64. package/dist/operator.d.ts.map +1 -0
  65. package/dist/operator.js +2 -0
  66. package/dist/operator.js.map +1 -0
  67. package/dist/policy.d.ts +24 -0
  68. package/dist/policy.d.ts.map +1 -0
  69. package/dist/policy.js +10 -0
  70. package/dist/policy.js.map +1 -0
  71. package/dist/publishing.d.ts +58 -0
  72. package/dist/publishing.d.ts.map +1 -0
  73. package/dist/publishing.js +40 -0
  74. package/dist/publishing.js.map +1 -0
  75. package/dist/runtime/ConsumerRuntime.d.ts +46 -0
  76. package/dist/runtime/ConsumerRuntime.d.ts.map +1 -0
  77. package/dist/runtime/ConsumerRuntime.js +252 -0
  78. package/dist/runtime/ConsumerRuntime.js.map +1 -0
  79. package/dist/runtime/DeliveryExecution.d.ts +83 -0
  80. package/dist/runtime/DeliveryExecution.d.ts.map +1 -0
  81. package/dist/runtime/DeliveryExecution.js +0 -0
  82. package/dist/runtime/DeliveryExecution.js.map +1 -0
  83. package/dist/runtime/outcomes.d.ts +28 -0
  84. package/dist/runtime/outcomes.d.ts.map +1 -0
  85. package/dist/runtime/outcomes.js +65 -0
  86. package/dist/runtime/outcomes.js.map +1 -0
  87. package/dist/runtime/types.d.ts +14 -0
  88. package/dist/runtime/types.d.ts.map +1 -0
  89. package/dist/runtime/types.js +2 -0
  90. package/dist/runtime/types.js.map +1 -0
  91. package/dist/testing/ConformanceHarness.d.ts +45 -0
  92. package/dist/testing/ConformanceHarness.d.ts.map +1 -0
  93. package/dist/testing/ConformanceHarness.js +2 -0
  94. package/dist/testing/ConformanceHarness.js.map +1 -0
  95. package/dist/testing/ConformanceScenario.d.ts +29 -0
  96. package/dist/testing/ConformanceScenario.d.ts.map +1 -0
  97. package/dist/testing/ConformanceScenario.js +83 -0
  98. package/dist/testing/ConformanceScenario.js.map +1 -0
  99. package/dist/testing/RunConformanceChecks.d.ts +10 -0
  100. package/dist/testing/RunConformanceChecks.d.ts.map +1 -0
  101. package/dist/testing/RunConformanceChecks.js +50 -0
  102. package/dist/testing/RunConformanceChecks.js.map +1 -0
  103. package/dist/testing/assertions.d.ts +13 -0
  104. package/dist/testing/assertions.d.ts.map +1 -0
  105. package/dist/testing/assertions.js +66 -0
  106. package/dist/testing/assertions.js.map +1 -0
  107. package/dist/testing/conformanceCases.d.ts +4 -0
  108. package/dist/testing/conformanceCases.d.ts.map +1 -0
  109. package/dist/testing/conformanceCases.js +359 -0
  110. package/dist/testing/conformanceCases.js.map +1 -0
  111. package/dist/testing/fixtures.d.ts +21 -0
  112. package/dist/testing/fixtures.d.ts.map +1 -0
  113. package/dist/testing/fixtures.js +39 -0
  114. package/dist/testing/fixtures.js.map +1 -0
  115. package/dist/testing/index.d.ts +6 -0
  116. package/dist/testing/index.d.ts.map +1 -0
  117. package/dist/testing/index.js +5 -0
  118. package/dist/testing/index.js.map +1 -0
  119. package/dist/testing/vitest.d.ts +4 -0
  120. package/dist/testing/vitest.d.ts.map +1 -0
  121. package/dist/testing/vitest.js +19 -0
  122. package/dist/testing/vitest.js.map +1 -0
  123. package/dist/transport.d.ts +106 -0
  124. package/dist/transport.d.ts.map +1 -0
  125. package/dist/transport.js +2 -0
  126. package/dist/transport.js.map +1 -0
  127. package/dist/validation.d.ts +26 -0
  128. package/dist/validation.d.ts.map +1 -0
  129. package/dist/validation.js +177 -0
  130. package/dist/validation.js.map +1 -0
  131. package/package.json +49 -8
@@ -0,0 +1,60 @@
1
+ import type { WorkMessage } from './envelope.js';
2
+ import type { SubscriptionBinding } from './transport.js';
3
+ export interface SubscriptionStats {
4
+ SubscriptionName: string;
5
+ Pending: number;
6
+ InFlight: number;
7
+ DeadLettered: number;
8
+ /** null when not applicable/unsupported */
9
+ BlockedKeys: number | null;
10
+ /** AWS: always null in Phase 1 (no CloudWatch client; use the CloudWatch alarm) */
11
+ OldestPendingAgeSeconds: number | null;
12
+ /** null unless CompletedCounts */
13
+ CompletedLastHour: number | null;
14
+ AsOf: string;
15
+ }
16
+ export interface DeadLetterRecord {
17
+ /** Database: Delivery.ID; AWS: envelope MessageID */
18
+ DeliveryID: string;
19
+ Message: WorkMessage;
20
+ PartitionKey: string | null;
21
+ Attempts: number;
22
+ /** handler reason, 'MaxAttemptsExceeded', 'LeaseExpired', 'HandlerNotRegistered', 'RedrivePolicy', 'InvalidEnvelope', … */
23
+ Reason: string;
24
+ LastError: string | null;
25
+ DeadLetteredAt: string | null;
26
+ /** Ordered head on the Database transport */
27
+ BlocksKey: boolean;
28
+ }
29
+ /** Derived from the delivery rows; nothing about a partition is stored elsewhere (spec 03 §7). */
30
+ export type PartitionCondition = 'Idle' | 'InFlight' | 'Blocked';
31
+ export interface PartitionStateRecord {
32
+ PartitionKey: string;
33
+ Condition: PartitionCondition;
34
+ HeadDeliveryID: string | null;
35
+ WaitingItems: number;
36
+ }
37
+ export interface Page<T> {
38
+ Items: T[];
39
+ NextCursor: string | null;
40
+ }
41
+ export type OperatorResult = {
42
+ Supported: false;
43
+ }
44
+ /** CancelRequested: present (true) only when an InFlight delivery was asked to stop (spec 03 §7). */
45
+ | {
46
+ Supported: true;
47
+ Changed: boolean;
48
+ CancelRequested?: boolean;
49
+ };
50
+ export interface ITransportOperator {
51
+ GetStats(subscription: SubscriptionBinding): Promise<SubscriptionStats>;
52
+ ListDeadLetters(subscription: SubscriptionBinding, cursor: string | null, pageSize: number): Promise<Page<DeadLetterRecord> | null>;
53
+ /** condition null = all non-Idle keys. Returns null when !ListPartitions. */
54
+ ListPartitions(subscription: SubscriptionBinding, condition: PartitionCondition | null, cursor: string | null, pageSize: number): Promise<Page<PartitionStateRecord> | null>;
55
+ Replay(subscription: SubscriptionBinding, deliveryID: string, actorUserID: string | null, note: string | null): Promise<OperatorResult>;
56
+ /** Pending (requires CancelPending) or DeadLettered → Discarded immediately.
57
+ * InFlight (requires CancelInFlight) → CancelRequestedAt set, `CancelRequested: true` (spec 03 §7). */
58
+ Discard(subscription: SubscriptionBinding, deliveryID: string, reason: string, actorUserID: string | null): Promise<OperatorResult>;
59
+ }
60
+ //# sourceMappingURL=operator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mFAAmF;IACnF,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,kCAAkC;IAClC,iBAAiB,EAAE,MAAM,G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,IAAI,CAAC,CAAC;IACpI,6EAA6E;IAC7E,cAAc,CACV,YAAY,EAAE,mBAAmB,EACjC,SAAS,EAAE,kBAAkB,GAAG,IAAI,EACpC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxI;4GACwG;IACxG,OAAO,CAAC,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACvI"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=operator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operator.js","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ /** `Ordered` is supported by the Database transport only (spec 03 §3.1). */
2
+ export type PartitionMode = 'None' | 'Exclusive' | 'Ordered';
3
+ export type HeartbeatMode = 'Auto' | 'Manual';
4
+ export type HostType = 'MJWorker' | 'External';
5
+ export type DeliveryStatus = 'Pending' | 'InFlight' | 'Completed' | 'DeadLettered' | 'Discarded';
6
+ export interface SubscriptionPolicy {
7
+ SubscriptionName: string;
8
+ TopicName: string;
9
+ PartitionMode: PartitionMode;
10
+ /** default 5 */
11
+ MaxAttempts: number;
12
+ /** default 10 */
13
+ BackoffBaseSeconds: number;
14
+ /** default 900 */
15
+ BackoffMaxSeconds: number;
16
+ /** default 60 */
17
+ LeaseSeconds: number;
18
+ /** default 'Auto' */
19
+ HeartbeatMode: HeartbeatMode;
20
+ MaxProcessingSeconds?: number;
21
+ }
22
+ /** Column defaults from spec 03 §6.3, for callers that build policies outside the database. */
23
+ export declare const SUBSCRIPTION_POLICY_DEFAULTS: Readonly<Pick<SubscriptionPolicy, 'PartitionMode' | 'MaxAttempts' | 'BackoffBaseSeconds' | 'BackoffMaxSeconds' | 'LeaseSeconds' | 'HeartbeatMode'>>;
24
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAC7D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAC9C,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,WAAW,CAAC;AAEjG,MAAM,WAAW,kBAAkB;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,+FAA+F;AAC/F,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAC/C,IAAI,CAAC,kBAAkB,EAAE,eAAe,GAAG,aAAa,GAAG,oBAAoB,GAAG,mBAAmB,GAAG,cAAc,GAAG,eAAe,CAAC,CAQ5I,CAAC"}
package/dist/policy.js ADDED
@@ -0,0 +1,10 @@
1
+ /** Column defaults from spec 03 §6.3, for callers that build policies outside the database. */
2
+ export const SUBSCRIPTION_POLICY_DEFAULTS = {
3
+ PartitionMode: 'None',
4
+ MaxAttempts: 5,
5
+ BackoffBaseSeconds: 10,
6
+ BackoffMaxSeconds: 900,
7
+ LeaseSeconds: 60,
8
+ HeartbeatMode: 'Auto',
9
+ };
10
+ //# sourceMappingURL=policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAuBA,+FAA+F;AAC/F,MAAM,CAAC,MAAM,4BAA4B,GAErC;IACA,aAAa,EAAE,MAAM;IACrB,WAAW,EAAE,CAAC;IACd,kBAAkB,EAAE,EAAE;IACtB,iBAAiB,EAAE,GAAG;IACtB,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE,MAAM;CACxB,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { WorkJson, WorkPayloadRef } from './envelope.js';
2
+ export interface PublishRequest<TPayload extends WorkJson = WorkJson> {
3
+ MessageID?: string;
4
+ PartitionKey?: string;
5
+ Attributes?: Record<string, string>;
6
+ Payload?: TPayload;
7
+ PayloadRef?: WorkPayloadRef;
8
+ CorrelationID?: string;
9
+ /** Suppresses a second publish with the same key to the same topic inside the TTL window. */
10
+ DeduplicationKey?: string;
11
+ /** Default: topic DefaultDeduplicationTTLSeconds. */
12
+ DeduplicationTTLSeconds?: number;
13
+ }
14
+ export type PublishStatus = 'Accepted' | 'Duplicate' | 'Rejected';
15
+ export interface PublishError {
16
+ Code: string;
17
+ Message: string;
18
+ Retryable: boolean;
19
+ }
20
+ export interface PublishResult {
21
+ /** For Duplicate: the MessageID of the publish that owns the key (or the existing MessageID). */
22
+ MessageID: string;
23
+ Status: PublishStatus;
24
+ Error?: PublishError;
25
+ }
26
+ export interface IWorkPublisher {
27
+ /** Batch publish. Results are positionally aligned with requests. Partial success is possible. */
28
+ Publish<TPayload extends WorkJson>(topic: string, requests: PublishRequest<TPayload>[]): Promise<PublishResult[]>;
29
+ }
30
+ /**
31
+ * Every publish error code used anywhere in the work queue (spec 03 §1.1). Core produces the
32
+ * envelope codes; the engine, drivers, REST extension and API client produce the rest.
33
+ */
34
+ export declare const PublishErrorCodes: {
35
+ readonly PayloadTooLarge: "PayloadTooLarge";
36
+ readonly InvalidAttributes: "InvalidAttributes";
37
+ readonly InvalidPayload: "InvalidPayload";
38
+ readonly InvalidPartitionKey: "InvalidPartitionKey";
39
+ readonly InvalidMessageID: "InvalidMessageID";
40
+ readonly InvalidDeduplication: "InvalidDeduplication";
41
+ readonly TopicNotFound: "TopicNotFound";
42
+ readonly TopicDisabled: "TopicDisabled";
43
+ readonly TopicNotExternallyPublishable: "TopicNotExternallyPublishable";
44
+ readonly Forbidden: "Forbidden";
45
+ readonly TopicUnbound: "TopicUnbound";
46
+ readonly MessageIDConflict: "MessageIDConflict";
47
+ readonly DeduplicationPending: "DeduplicationPending";
48
+ readonly TransportUnavailable: "TransportUnavailable";
49
+ readonly TransportRejected: "TransportRejected";
50
+ readonly BadRequest: "BadRequest";
51
+ readonly Unauthorized: "Unauthorized";
52
+ readonly InvalidResponse: "InvalidResponse";
53
+ };
54
+ export type PublishErrorCode = (typeof PublishErrorCodes)[keyof typeof PublishErrorCodes];
55
+ export declare function IsRetryablePublishErrorCode(code: string): boolean;
56
+ export declare function CreatePublishError(code: string, message: string): PublishError;
57
+ export declare function RejectedPublishResult(messageID: string, code: string, message: string): PublishResult;
58
+ //# sourceMappingURL=publishing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishing.d.ts","sourceRoot":"","sources":["../src/publishing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,WAAW,cAAc,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,E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AAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAErG"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Every publish error code used anywhere in the work queue (spec 03 §1.1). Core produces the
3
+ * envelope codes; the engine, drivers, REST extension and API client produce the rest.
4
+ */
5
+ export const PublishErrorCodes = {
6
+ PayloadTooLarge: 'PayloadTooLarge',
7
+ InvalidAttributes: 'InvalidAttributes',
8
+ InvalidPayload: 'InvalidPayload',
9
+ InvalidPartitionKey: 'InvalidPartitionKey',
10
+ InvalidMessageID: 'InvalidMessageID',
11
+ InvalidDeduplication: 'InvalidDeduplication',
12
+ TopicNotFound: 'TopicNotFound',
13
+ TopicDisabled: 'TopicDisabled',
14
+ TopicNotExternallyPublishable: 'TopicNotExternallyPublishable',
15
+ Forbidden: 'Forbidden',
16
+ TopicUnbound: 'TopicUnbound',
17
+ MessageIDConflict: 'MessageIDConflict',
18
+ DeduplicationPending: 'DeduplicationPending',
19
+ TransportUnavailable: 'TransportUnavailable',
20
+ TransportRejected: 'TransportRejected',
21
+ BadRequest: 'BadRequest',
22
+ Unauthorized: 'Unauthorized',
23
+ InvalidResponse: 'InvalidResponse',
24
+ };
25
+ const RETRYABLE_PUBLISH_ERROR_CODES = new Set([
26
+ PublishErrorCodes.TopicUnbound,
27
+ PublishErrorCodes.DeduplicationPending,
28
+ PublishErrorCodes.TransportUnavailable,
29
+ PublishErrorCodes.InvalidResponse,
30
+ ]);
31
+ export function IsRetryablePublishErrorCode(code) {
32
+ return RETRYABLE_PUBLISH_ERROR_CODES.has(code);
33
+ }
34
+ export function CreatePublishError(code, message) {
35
+ return { Code: code, Message: message, Retryable: IsRetryablePublishErrorCode(code) };
36
+ }
37
+ export function RejectedPublishResult(messageID, code, message) {
38
+ return { MessageID: messageID, Status: 'Rejected', Error: CreatePublishError(code, message) };
39
+ }
40
+ //# sourceMappingURL=publishing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publishing.js","sourceRoot":"","sources":["../src/publishing.ts"],"names":[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AAC"}
@@ -0,0 +1,46 @@
1
+ import type { WorkJson } from '../envelope.js';
2
+ import type { WorkHandler, WorkLogger } from '../handler.js';
3
+ import type { SubscriptionPolicy } from '../policy.js';
4
+ import type { ITransportConsumer, ReceivedDelivery, SettleResult } from '../transport.js';
5
+ import type { ConsumerRuntimeOptions } from './types.js';
6
+ /** Transport-agnostic loop: receive → run handler with lease management → settle. */
7
+ export declare class ConsumerRuntime<TPayload extends WorkJson = WorkJson> {
8
+ private readonly consumer;
9
+ private readonly handlerFactory;
10
+ private readonly policy;
11
+ private readonly options;
12
+ private readonly log;
13
+ private readonly now;
14
+ private running;
15
+ private loopPromise;
16
+ /** Keyed by DeliveryExecution.ExecutionKey (DeliveryID + LeaseToken), never by DeliveryID alone. */
17
+ private readonly executions;
18
+ private receiveController;
19
+ private wakeResolver;
20
+ private wakeTimer;
21
+ private kickPending;
22
+ constructor(consumer: ITransportConsumer<TPayload>, handlerFactory: () => WorkHandler<TPayload>, policy: SubscriptionPolicy, options: ConsumerRuntimeOptions, log: WorkLogger, now?: () => number);
23
+ get InFlightCount(): number;
24
+ get IsRunning(): boolean;
25
+ Start(): void;
26
+ /** Wake an idle loop immediately (used after in-process publish). */
27
+ Kick(): void;
28
+ /** Stops receiving, waits up to ShutdownDrainMs, then aborts remaining handlers and releases their deliveries. */
29
+ Stop(): Promise<void>;
30
+ /** Process exactly the given deliveries (Lambda mode: no loop). Results align with the input. */
31
+ ProcessBatch(deliveries: ReceivedDelivery<TPayload>[]): Promise<SettleResult[]>;
32
+ private loop;
33
+ private receive;
34
+ private releaseUnstarted;
35
+ private startExecution;
36
+ private reportSettle;
37
+ private waitForExecutions;
38
+ /** Resolves true when `work` finishes within `timeoutMs`, false otherwise. Never rejects on timeout. */
39
+ private within;
40
+ private groupIntoLanes;
41
+ private runLane;
42
+ private releaseSkipped;
43
+ private sleep;
44
+ private wake;
45
+ }
46
+ //# sourceMappingURL=ConsumerRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"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CAE9B;IAEM,KAAK,IAAI,IAAI;IAgBpB,qEAAqE;IAC9D,IAAI,IAAI,IAAI;IAKnB,kHAAkH;IACrG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BlC,iGAAiG;IACpF,YAAY,CAAC,UAAU,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;YAgB9E,IAAI;YA8BJ,OAAO;YAcP,gBAAgB;IAc9B,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,YAAY;YAUN,iBAAiB;IAQ/B,wGAAwG;YAC1F,MAAM;IAcpB,OAAO,CAAC,cAAc;YAWR,OAAO;YAeP,cAAc;IAQ5B,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,IAAI;CAWf"}
@@ -0,0 +1,252 @@
1
+ import { DeliveryExecution } from './DeliveryExecution.js';
2
+ import { ErrorMessageOf } from './outcomes.js';
3
+ /** Transport-agnostic loop: receive → run handler with lease management → settle. */
4
+ export class ConsumerRuntime {
5
+ constructor(consumer, handlerFactory, policy, options, log, now = () => Date.now()) {
6
+ this.consumer = consumer;
7
+ this.handlerFactory = handlerFactory;
8
+ this.policy = policy;
9
+ this.options = options;
10
+ this.log = log;
11
+ this.now = now;
12
+ this.running = false;
13
+ this.loopPromise = null;
14
+ /** Keyed by DeliveryExecution.ExecutionKey (DeliveryID + LeaseToken), never by DeliveryID alone. */
15
+ this.executions = new Map();
16
+ this.receiveController = new AbortController();
17
+ this.wakeResolver = null;
18
+ this.wakeTimer = null;
19
+ this.kickPending = false;
20
+ }
21
+ get InFlightCount() {
22
+ return this.executions.size;
23
+ }
24
+ get IsRunning() {
25
+ return this.running;
26
+ }
27
+ Start() {
28
+ if (this.running) {
29
+ return;
30
+ }
31
+ this.running = true;
32
+ this.receiveController = new AbortController();
33
+ this.loopPromise = this.loop().catch((error) => {
34
+ // The loop catches everything it awaits; this is the backstop for a throwing logger or similar.
35
+ this.running = false;
36
+ this.log.Error('Consumer loop stopped unexpectedly', error instanceof Error ? error : undefined, {
37
+ Subscription: this.policy.SubscriptionName,
38
+ Error: ErrorMessageOf(error),
39
+ });
40
+ });
41
+ }
42
+ /** Wake an idle loop immediately (used after in-process publish). */
43
+ Kick() {
44
+ this.kickPending = true;
45
+ this.wake();
46
+ }
47
+ /** Stops receiving, waits up to ShutdownDrainMs, then aborts remaining handlers and releases their deliveries. */
48
+ async Stop() {
49
+ this.running = false;
50
+ this.receiveController.abort();
51
+ this.wake();
52
+ if (this.loopPromise !== null) {
53
+ const loopEnded = await this.within(this.loopPromise.then(() => true), this.options.ShutdownDrainMs);
54
+ if (!loopEnded) {
55
+ this.log.Warn('Receive did not return after the abort signal; shutting down without it', {
56
+ Subscription: this.policy.SubscriptionName,
57
+ });
58
+ }
59
+ this.loopPromise = null;
60
+ }
61
+ if (await this.waitForExecutions(this.options.ShutdownDrainMs)) {
62
+ return;
63
+ }
64
+ for (const running of this.executions.values()) {
65
+ running.Execution.Abort('Shutdown');
66
+ }
67
+ if (!(await this.waitForExecutions(this.options.ShutdownDrainMs))) {
68
+ this.log.Warn('Handlers still running after shutdown; their leases will expire and the deliveries will be redelivered', {
69
+ Subscription: this.policy.SubscriptionName,
70
+ Remaining: this.executions.size,
71
+ });
72
+ }
73
+ }
74
+ /** Process exactly the given deliveries (Lambda mode: no loop). Results align with the input. */
75
+ async ProcessBatch(deliveries) {
76
+ const results = [];
77
+ const lanes = [...this.groupIntoLanes(deliveries).values()];
78
+ let nextLane = 0;
79
+ const workerCount = Math.max(1, Math.min(this.options.Concurrency, lanes.length));
80
+ const workers = Array.from({ length: workerCount }, async () => {
81
+ while (nextLane < lanes.length) {
82
+ const lane = lanes[nextLane];
83
+ nextLane += 1;
84
+ await this.runLane(lane, deliveries, results);
85
+ }
86
+ });
87
+ await Promise.all(workers);
88
+ return results;
89
+ }
90
+ async loop() {
91
+ let idleMs = this.options.IdlePollMinMs;
92
+ while (this.running) {
93
+ const free = this.options.Concurrency - this.executions.size;
94
+ if (free <= 0) {
95
+ await this.sleep(this.options.IdlePollMaxMs);
96
+ continue;
97
+ }
98
+ this.kickPending = false;
99
+ const deliveries = await this.receive(Math.min(free, this.options.ReceiveBatchSize));
100
+ if (!this.running) {
101
+ await this.releaseUnstarted(deliveries);
102
+ return;
103
+ }
104
+ if (deliveries.length > 0) {
105
+ idleMs = this.options.IdlePollMinMs;
106
+ deliveries.forEach((delivery) => {
107
+ void this.startExecution(delivery);
108
+ });
109
+ continue;
110
+ }
111
+ if (this.kickPending) {
112
+ idleMs = this.options.IdlePollMinMs;
113
+ continue;
114
+ }
115
+ await this.sleep(idleMs);
116
+ idleMs = this.kickPending ? this.options.IdlePollMinMs : Math.min(idleMs * 2, this.options.IdlePollMaxMs);
117
+ }
118
+ }
119
+ async receive(max) {
120
+ try {
121
+ return await this.consumer.Receive(max, this.options.ReceiveWaitSeconds ?? 0, this.receiveController.signal);
122
+ }
123
+ catch (error) {
124
+ if (this.running) {
125
+ this.log.Error('Receive failed; backing off', error instanceof Error ? error : undefined, {
126
+ Subscription: this.policy.SubscriptionName,
127
+ Error: ErrorMessageOf(error),
128
+ });
129
+ }
130
+ return [];
131
+ }
132
+ }
133
+ async releaseUnstarted(deliveries) {
134
+ for (const delivery of deliveries) {
135
+ try {
136
+ await this.consumer.Release(delivery);
137
+ }
138
+ catch (error) {
139
+ this.log.Warn('Release of an unstarted delivery failed; its lease will expire', {
140
+ Subscription: this.policy.SubscriptionName,
141
+ DeliveryID: delivery.DeliveryID,
142
+ Error: ErrorMessageOf(error),
143
+ });
144
+ }
145
+ }
146
+ }
147
+ startExecution(delivery) {
148
+ const execution = new DeliveryExecution({
149
+ Delivery: delivery,
150
+ Consumer: this.consumer,
151
+ HandlerFactory: this.handlerFactory,
152
+ Policy: this.policy,
153
+ Log: this.log,
154
+ Now: this.now,
155
+ LeaseExpiryGraceMs: this.options.LeaseExpiryGraceMs,
156
+ CancelDrainMs: this.options.ShutdownDrainMs,
157
+ });
158
+ const key = execution.ExecutionKey;
159
+ const done = execution
160
+ .Run()
161
+ .catch((error) => ({ Kind: 'Failed', DeliveryID: delivery.DeliveryID, Error: ErrorMessageOf(error) }))
162
+ .then((result) => {
163
+ this.executions.delete(key);
164
+ this.reportSettle(result);
165
+ this.wake();
166
+ return result;
167
+ });
168
+ this.executions.set(key, { Execution: execution, Done: done });
169
+ return done;
170
+ }
171
+ reportSettle(result) {
172
+ if (result.Kind === 'Failed') {
173
+ this.log.Error('Delivery settle failed', undefined, {
174
+ Subscription: this.policy.SubscriptionName,
175
+ DeliveryID: result.DeliveryID,
176
+ Error: result.Error,
177
+ });
178
+ }
179
+ }
180
+ async waitForExecutions(timeoutMs) {
181
+ if (this.executions.size === 0) {
182
+ return true;
183
+ }
184
+ const allDone = Promise.all([...this.executions.values()].map((running) => running.Done)).then(() => true);
185
+ return this.within(allDone, timeoutMs);
186
+ }
187
+ /** Resolves true when `work` finishes within `timeoutMs`, false otherwise. Never rejects on timeout. */
188
+ async within(work, timeoutMs) {
189
+ const deadline = { Timer: null };
190
+ const timedOut = new Promise((resolve) => {
191
+ deadline.Timer = setTimeout(() => resolve(false), timeoutMs);
192
+ });
193
+ try {
194
+ return await Promise.race([work, timedOut]);
195
+ }
196
+ finally {
197
+ if (deadline.Timer !== null) {
198
+ clearTimeout(deadline.Timer);
199
+ }
200
+ }
201
+ }
202
+ groupIntoLanes(deliveries) {
203
+ const lanes = new Map();
204
+ const partitioned = this.policy.PartitionMode !== 'None';
205
+ deliveries.forEach((delivery, index) => {
206
+ const key = delivery.Message.PartitionKey;
207
+ const laneKey = partitioned && key !== undefined ? `key:${key}` : `item:${index}`;
208
+ lanes.set(laneKey, [...(lanes.get(laneKey) ?? []), index]);
209
+ });
210
+ return lanes;
211
+ }
212
+ async runLane(indices, deliveries, results) {
213
+ let blocked = false;
214
+ for (const index of indices) {
215
+ const delivery = deliveries[index];
216
+ if (blocked) {
217
+ // Spec 03 §3.2: later items of the key are released unrun, so an SQS FIFO group keeps its order.
218
+ results[index] = await this.releaseSkipped(delivery);
219
+ continue;
220
+ }
221
+ const result = await this.startExecution(delivery);
222
+ results[index] = result;
223
+ blocked = !(result.Kind === 'Settled' && result.Status === 'Completed');
224
+ }
225
+ }
226
+ async releaseSkipped(delivery) {
227
+ try {
228
+ return await this.consumer.Release(delivery);
229
+ }
230
+ catch (error) {
231
+ return { Kind: 'Failed', DeliveryID: delivery.DeliveryID, Error: ErrorMessageOf(error) };
232
+ }
233
+ }
234
+ sleep(ms) {
235
+ return new Promise((resolve) => {
236
+ this.wakeResolver = resolve;
237
+ this.wakeTimer = setTimeout(() => this.wake(), ms);
238
+ });
239
+ }
240
+ wake() {
241
+ if (this.wakeTimer !== null) {
242
+ clearTimeout(this.wakeTimer);
243
+ this.wakeTimer = null;
244
+ }
245
+ const resolve = this.wakeResolver;
246
+ this.wakeResolver = null;
247
+ if (resolve !== null) {
248
+ resolve();
249
+ }
250
+ }
251
+ }
252
+ //# sourceMappingURL=ConsumerRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsumerRuntime.js","sourceRoot":"","sources":["../../src/runtime/ConsumerRuntime.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5C,qFAAqF;AACrF,MAAM,OAAO,eAAe;IAUxB,YACqB,QAAsC,EACtC,cAA2C,EAC3C,MAA0B,EAC1B,OAA+B,EAC/B,GAAe,EACf,MAAoB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;QALpC,aAAQ,GAAR,QAAQ,CAA8B;QACtC,mBAAc,GAAd,cAAc,CAA6B;QAC3C,WAAM,GAAN,MAAM,CAAoB;QAC1B,YAAO,GAAP,OAAO,CAAwB;QAC/B,QAAG,GAAH,GAAG,CAAY;QACf,QAAG,GAAH,GAAG,CAAiC;QAfjD,YAAO,GAAG,KAAK,CAAC;QAChB,gBAAW,GAAy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1B,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,83 @@
1
+ import type { WorkJson } from '../envelope.js';
2
+ import type { WorkAbortReason, WorkHandler, WorkLogger } from '../handler.js';
3
+ import type { SubscriptionPolicy } from '../policy.js';
4
+ import type { ITransportConsumer, ReceivedDelivery, SettleResult } from '../transport.js';
5
+ export declare const MIN_AUTO_HEARTBEAT_INTERVAL_MS = 1000;
6
+ /** Clock-skew allowance added to the lease horizon before the run is abandoned (spec 03 §3.2). */
7
+ export declare const LEASE_EXPIRY_GRACE_MS = 5000;
8
+ /** How long a cancelled handler gets to stop before its cancel is acknowledged anyway. */
9
+ export declare const DEFAULT_CANCEL_DRAIN_MS = 30000;
10
+ /** Node fires a setTimeout above 2^31 - 1 ms immediately, so long delays are clamped and re-armed. */
11
+ export declare const MAX_TIMER_DELAY_MS = 2147483647;
12
+ /** A Database DeliveryID is stable across attempts; only DeliveryID + LeaseToken identifies one execution. */
13
+ export declare function ExecutionKeyOf(delivery: ReceivedDelivery): string;
14
+ export interface DeliveryExecutionOptions<TPayload extends WorkJson = WorkJson> {
15
+ Delivery: ReceivedDelivery<TPayload>;
16
+ Consumer: ITransportConsumer<TPayload>;
17
+ HandlerFactory: () => WorkHandler<TPayload>;
18
+ Policy: SubscriptionPolicy;
19
+ Log: WorkLogger;
20
+ Now?: () => number;
21
+ Random?: () => number;
22
+ /** Defaults to LEASE_EXPIRY_GRACE_MS. */
23
+ LeaseExpiryGraceMs?: number;
24
+ /** Defaults to DEFAULT_CANCEL_DRAIN_MS; ConsumerRuntime passes its ShutdownDrainMs. */
25
+ CancelDrainMs?: number;
26
+ }
27
+ /** Runs one handler for one delivery: context, lease heartbeats, lease horizon, processing cap, outcome, settle. */
28
+ export declare class DeliveryExecution<TPayload extends WorkJson = WorkJson> {
29
+ private readonly options;
30
+ private readonly controller;
31
+ /** First abort reason; what the handler sees as Signal.reason. The flags below are independent of it. */
32
+ private abortReason;
33
+ private leaseLost;
34
+ private cancelled;
35
+ private capReached;
36
+ private shutdownRequested;
37
+ private heartbeatTimer;
38
+ private capTimer;
39
+ private horizonTimer;
40
+ private cancelDrainTimer;
41
+ private pendingHeartbeat;
42
+ /** Wall-clock instant this lease is good until; moves forward on every ExtendLease that returns Held. */
43
+ private leaseHorizonMs;
44
+ private capDeadlineMs;
45
+ private readonly horizonPassed;
46
+ private readonly cancelDrainElapsed;
47
+ constructor(options: DeliveryExecutionOptions<TPayload>);
48
+ private now;
49
+ get DeliveryID(): string;
50
+ get ExecutionKey(): string;
51
+ /** The first reason the handler was asked to stop, or null. */
52
+ get StopReason(): WorkAbortReason | null;
53
+ /** Requests the handler to stop. The signal keeps its first reason; a shutdown is remembered regardless. */
54
+ Abort(reason: WorkAbortReason): void;
55
+ Run(): Promise<SettleResult>;
56
+ private invokeHandler;
57
+ private buildContext;
58
+ /** A heartbeat still in flight decides whether we may settle, but never for longer than the lease itself. */
59
+ private awaitPendingHeartbeat;
60
+ private heartbeat;
61
+ private extendLease;
62
+ private onCancelled;
63
+ private acknowledgeCancel;
64
+ private startTimers;
65
+ /** Independent of heartbeats: fires when the lease (plus the skew allowance) runs out without a Held. */
66
+ private armHorizonTimer;
67
+ private onHorizon;
68
+ private armCapTimer;
69
+ private onProcessingCap;
70
+ /** Stops everything except the horizon timer, which must outlive a heartbeat that is still in flight. */
71
+ private stopWorkTimers;
72
+ private clearHeartbeatTimer;
73
+ private clearHorizonTimer;
74
+ private settle;
75
+ /**
76
+ * A settle that reports LeaseLost gets one AcknowledgeCancel attempt (spec 03 §3.2): a cancel that landed
77
+ * between the last heartbeat and this settle then frees its key now instead of at lease expiry. The
78
+ * acknowledgement is a no-op for every other cause of LeaseLost.
79
+ */
80
+ private settleSafely;
81
+ private logData;
82
+ }
83
+ //# sourceMappingURL=DeliveryExecution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeliveryExecution.d.ts","sourceRoot":"","sources":["../../src/runtime/DeliveryExecution.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAe,WAAW,EAAE,UAAU,EAAgB,MAAM,YAAY,CAAC;AACtG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAIvF,eAAO,MAAM,8BAA8B,OAAO,CAAC;AAEnD,kGAAkG;AAClG,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C,sGAAsG;AACtG,eAAO,MAAM,kBAAkB,aAAgB,CAAC;AAEhD,8GAA8G;AAC9G,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAEjE;AAED,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ;IAC1E,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACrC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACvC,cAAc,EAAE,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,EAAE,kBAAkB,CAAC;IAC3B,GAAG,EAAE,UAAU,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IACtB,yCAAyC;IACzC,kBAAkB,CAAC,EAAE,MAAM,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