@aws/durable-execution-sdk-js 1.0.0 → 1.0.2
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 +28 -55
- package/dist/index.mjs +1945 -2020
- package/dist/index.mjs.map +1 -1
- package/dist-cjs/index.js +1944 -2019
- package/dist-cjs/index.js.map +1 -1
- package/dist-types/context/durable-context/durable-context.d.ts +0 -6
- package/dist-types/context/durable-context/durable-context.d.ts.map +1 -1
- package/dist-types/errors/durable-error/durable-error.d.ts +6 -0
- package/dist-types/errors/durable-error/durable-error.d.ts.map +1 -1
- package/dist-types/errors/step-errors/step-errors.d.ts +1 -0
- package/dist-types/errors/step-errors/step-errors.d.ts.map +1 -1
- package/dist-types/handlers/callback-handler/callback-promise.d.ts +2 -2
- package/dist-types/handlers/callback-handler/callback-promise.d.ts.map +1 -1
- package/dist-types/handlers/callback-handler/callback.d.ts +1 -2
- package/dist-types/handlers/callback-handler/callback.d.ts.map +1 -1
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts +1 -0
- package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts.map +1 -1
- package/dist-types/handlers/invoke-handler/invoke-handler.d.ts +1 -2
- package/dist-types/handlers/invoke-handler/invoke-handler.d.ts.map +1 -1
- package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.d.ts.map +1 -1
- package/dist-types/handlers/step-handler/step-handler.d.ts +1 -9
- package/dist-types/handlers/step-handler/step-handler.d.ts.map +1 -1
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts +1 -6
- package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts.map +1 -1
- package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts +2 -0
- package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts.map +1 -0
- package/dist-types/handlers/wait-handler/wait-handler.d.ts +1 -2
- package/dist-types/handlers/wait-handler/wait-handler.d.ts.map +1 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/index.d.ts.map +1 -1
- package/dist-types/testing/create-test-checkpoint-manager.d.ts.map +1 -1
- package/dist-types/testing/create-test-durable-context.d.ts.map +1 -1
- package/dist-types/testing/mock-checkpoint-manager.d.ts +0 -1
- package/dist-types/testing/mock-checkpoint-manager.d.ts.map +1 -1
- package/dist-types/testing/mock-checkpoint.d.ts +1 -0
- package/dist-types/testing/mock-checkpoint.d.ts.map +1 -1
- package/dist-types/types/batch.d.ts +8 -0
- package/dist-types/types/batch.d.ts.map +1 -1
- package/dist-types/types/core.d.ts +1 -3
- package/dist-types/types/core.d.ts.map +1 -1
- package/dist-types/types/durable-context.d.ts +8 -6
- package/dist-types/types/durable-context.d.ts.map +1 -1
- package/dist-types/types/index.d.ts +2 -0
- package/dist-types/types/index.d.ts.map +1 -1
- package/dist-types/types/operation-lifecycle-state.d.ts +27 -0
- package/dist-types/types/operation-lifecycle-state.d.ts.map +1 -0
- package/dist-types/types/operation-lifecycle.d.ts +27 -0
- package/dist-types/types/operation-lifecycle.d.ts.map +1 -0
- package/dist-types/types/step.d.ts +45 -0
- package/dist-types/types/step.d.ts.map +1 -1
- package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts +2 -0
- package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts.map +1 -0
- package/dist-types/utils/checkpoint/checkpoint-helper.d.ts +37 -0
- package/dist-types/utils/checkpoint/checkpoint-helper.d.ts.map +1 -1
- package/dist-types/utils/checkpoint/checkpoint-manager.d.ts +43 -12
- package/dist-types/utils/checkpoint/checkpoint-manager.d.ts.map +1 -1
- package/dist-types/utils/constants/constants.d.ts +0 -1
- package/dist-types/utils/constants/constants.d.ts.map +1 -1
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts +3 -1
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts.map +1 -1
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts +2 -0
- package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts.map +1 -0
- package/dist-types/utils/termination-helper/termination-helper.d.ts +0 -9
- package/dist-types/utils/termination-helper/termination-helper.d.ts.map +1 -1
- package/dist-types/with-durable-execution.d.ts.map +1 -1
- package/package.json +8 -4
- package/dist-types/utils/checkpoint/checkpoint-ancestor-checking.test.d.ts +0 -2
- package/dist-types/utils/checkpoint/checkpoint-ancestor-checking.test.d.ts.map +0 -1
- package/dist-types/utils/termination-helper/active-operations-tracker.d.ts +0 -31
- package/dist-types/utils/termination-helper/active-operations-tracker.d.ts.map +0 -1
- package/dist-types/utils/termination-helper/active-operations-tracker.test.d.ts +0 -2
- package/dist-types/utils/termination-helper/active-operations-tracker.test.d.ts.map +0 -1
- package/dist-types/utils/wait-before-continue/wait-before-continue.d.ts +0 -35
- package/dist-types/utils/wait-before-continue/wait-before-continue.d.ts.map +0 -1
- package/dist-types/utils/wait-before-continue/wait-before-continue.test.d.ts +0 -2
- package/dist-types/utils/wait-before-continue/wait-before-continue.test.d.ts.map +0 -1
|
@@ -34,10 +34,55 @@ export interface RetryDecision {
|
|
|
34
34
|
delay?: Duration;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
+
* Execution semantics for step operations.
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* These semantics control how step execution is checkpointed and replayed. **Important**: The guarantees apply *per
|
|
41
|
+
* retry attempt*, not per overall workflow execution.
|
|
42
|
+
*
|
|
43
|
+
* With retries enabled (the default), a step could execute multiple times across different retry attempts even when
|
|
44
|
+
* using `AtMostOncePerRetry`. To achieve step-level at-most-once execution, combine `AtMostOncePerRetry` with a retry
|
|
45
|
+
* strategy that disables retries (`shouldRetry: false`).
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // At-least-once per retry (default) - safe for idempotent operations
|
|
50
|
+
* await context.step("send-notification", async () => sendEmail(), {
|
|
51
|
+
* semantics: StepSemantics.AtLeastOncePerRetry,
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* // At-most-once per retry - for non-idempotent operations
|
|
55
|
+
* await context.step("charge-payment", async () => processPayment(), {
|
|
56
|
+
* semantics: StepSemantics.AtMostOncePerRetry,
|
|
57
|
+
* retryStrategy: () => ({ shouldRetry: false }),
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
37
61
|
* @public
|
|
38
62
|
*/
|
|
39
63
|
export declare enum StepSemantics {
|
|
64
|
+
/**
|
|
65
|
+
* At-most-once execution per retry attempt.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* A checkpoint is created before step execution. If a failure occurs after the checkpoint
|
|
69
|
+
* but before step completion, the previous step retry attempt is skipped on replay.
|
|
70
|
+
*
|
|
71
|
+
* **Note**: This is "at-most-once *per retry*". With multiple retry attempts, the step
|
|
72
|
+
* could still execute multiple times across different retries. To guarantee the step
|
|
73
|
+
* executes at most once, disable retries by returning
|
|
74
|
+
* `{ shouldRetry: false }` from your retry strategy.
|
|
75
|
+
*/
|
|
40
76
|
AtMostOncePerRetry = "AT_MOST_ONCE_PER_RETRY",
|
|
77
|
+
/**
|
|
78
|
+
* At-least-once execution per retry attempt (default).
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* The step will execute at least once on each retry attempt. If the step succeeds
|
|
82
|
+
* but the checkpoint fails (e.g., due to a sandbox crash), the step will re-execute
|
|
83
|
+
* on replay. This is the safer default for operations that are idempotent or can
|
|
84
|
+
* tolerate duplicate execution.
|
|
85
|
+
*/
|
|
41
86
|
AtLeastOncePerRetry = "AT_LEAST_ONCE_PER_RETRY"
|
|
42
87
|
}
|
|
43
88
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/types/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/types/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oBAAY,aAAa;IACvB;;;;;;;;;;;OAWG;IACH,kBAAkB,2BAA2B;IAE7C;;;;;;;;OAQG;IACH,mBAAmB,4BAA4B;CAChD;AAED;;;;;GAKG;AACH,oBAAY,cAAc;IACxB,6CAA6C;IAC7C,IAAI,SAAS;IACb,gEAAgE;IAChE,IAAI,SAAS;IACb,0EAA0E;IAC1E,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,mDAAmD;IACnD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,aAAa,CAAC;IACtE,iFAAiF;IACjF,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,MAAM,SAAS,aAAa,GAAG,aAAa,IAAI,CACtE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,KACzB,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-ancestor.test.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-ancestor.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoint-central-termination.test.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-central-termination.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { OperationUpdate } from "@aws-sdk/client-lambda";
|
|
2
|
+
import { OperationLifecycleState } from "../../types/operation-lifecycle-state";
|
|
3
|
+
import { OperationMetadata, OperationInfo } from "../../types/operation-lifecycle";
|
|
2
4
|
export interface Checkpoint {
|
|
3
5
|
checkpoint(stepId: string, data: Partial<OperationUpdate>): Promise<void>;
|
|
4
6
|
forceCheckpoint?(): Promise<void>;
|
|
@@ -6,5 +8,40 @@ export interface Checkpoint {
|
|
|
6
8
|
setTerminating?(): void;
|
|
7
9
|
hasPendingAncestorCompletion?(stepId: string): boolean;
|
|
8
10
|
waitForQueueCompletion(): Promise<void>;
|
|
11
|
+
markAncestorFinished(stepId: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Update operation lifecycle state
|
|
14
|
+
* @param stepId - The operation ID
|
|
15
|
+
* @param state - The new lifecycle state
|
|
16
|
+
* @param options - Optional metadata (required on first call) and endTimestamp
|
|
17
|
+
*/
|
|
18
|
+
markOperationState(stepId: string, state: OperationLifecycleState, options?: {
|
|
19
|
+
metadata?: OperationMetadata;
|
|
20
|
+
endTimestamp?: Date;
|
|
21
|
+
}): void;
|
|
22
|
+
/**
|
|
23
|
+
* Wait for retry timer to expire, then poll for status change
|
|
24
|
+
* @param stepId - The operation ID
|
|
25
|
+
*/
|
|
26
|
+
waitForRetryTimer(stepId: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Wait for status change (external event like callback, invoke, wait)
|
|
29
|
+
* @param stepId - The operation ID
|
|
30
|
+
*/
|
|
31
|
+
waitForStatusChange(stepId: string): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Mark operation as awaited (IDLE_NOT_AWAITED → IDLE_AWAITED transition)
|
|
34
|
+
* @param stepId - The operation ID
|
|
35
|
+
*/
|
|
36
|
+
markOperationAwaited(stepId: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get current lifecycle state of an operation
|
|
39
|
+
* @param stepId - The operation ID
|
|
40
|
+
*/
|
|
41
|
+
getOperationState(stepId: string): OperationLifecycleState | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Get all operations (for debugging/testing)
|
|
44
|
+
*/
|
|
45
|
+
getAllOperations(): Map<string, OperationInfo>;
|
|
9
46
|
}
|
|
10
47
|
//# sourceMappingURL=checkpoint-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"checkpoint-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EACL,iBAAiB,EACjB,aAAa,EACd,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,UAAU;IAEzB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,eAAe,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,cAAc,CAAC,IAAI,IAAI,CAAC;IACxB,4BAA4B,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACvD,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAI3C;;;;;OAKG;IACH,kBAAkB,CAChB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,uBAAuB,EAC9B,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,iBAAiB,CAAC;QAC7B,YAAY,CAAC,EAAE,IAAI,CAAC;KACrB,GACA,IAAI,CAAC;IAER;;;OAGG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;OAGG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;OAGG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3C;;;OAGG;IACH,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAAC;IAEvE;;OAEG;IACH,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CAChD"}
|
|
@@ -4,50 +4,81 @@ import { TerminationManager } from "../../termination-manager/termination-manage
|
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
5
|
import { DurableLogger } from "../../types/durable-logger";
|
|
6
6
|
import { Checkpoint } from "./checkpoint-helper";
|
|
7
|
+
import { OperationLifecycleState, OperationInfo, OperationMetadata } from "../../types";
|
|
7
8
|
export declare const STEP_DATA_UPDATED_EVENT = "stepDataUpdated";
|
|
8
|
-
interface ActiveOperationsTracker {
|
|
9
|
-
increment(): void;
|
|
10
|
-
decrement(): void;
|
|
11
|
-
}
|
|
12
9
|
export declare class CheckpointManager implements Checkpoint {
|
|
13
10
|
private durableExecutionArn;
|
|
14
11
|
private stepData;
|
|
15
12
|
private storage;
|
|
16
13
|
private terminationManager;
|
|
17
|
-
private activeOperationsTracker;
|
|
18
14
|
private stepDataEmitter;
|
|
19
15
|
private logger;
|
|
20
|
-
private
|
|
16
|
+
private finishedAncestors;
|
|
21
17
|
private queue;
|
|
22
18
|
private isProcessing;
|
|
23
19
|
private currentTaskToken;
|
|
24
20
|
private forceCheckpointPromises;
|
|
25
21
|
private queueCompletionResolver;
|
|
26
|
-
private queueCompletionTimeout;
|
|
27
22
|
private readonly MAX_PAYLOAD_SIZE;
|
|
23
|
+
private readonly MAX_ITEMS_IN_BATCH;
|
|
28
24
|
private isTerminating;
|
|
29
25
|
private static textEncoder;
|
|
30
|
-
|
|
26
|
+
private operations;
|
|
27
|
+
private terminationTimer;
|
|
28
|
+
private terminationReason;
|
|
29
|
+
private readonly TERMINATION_COOLDOWN_MS;
|
|
30
|
+
constructor(durableExecutionArn: string, stepData: Record<string, Operation>, storage: DurableExecutionClient, terminationManager: TerminationManager, initialTaskToken: string, stepDataEmitter: EventEmitter, logger: DurableLogger, finishedAncestors: Set<string>);
|
|
31
31
|
setTerminating(): void;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Mark an ancestor as finished (for run-in-child-context operations)
|
|
34
|
+
*/
|
|
35
|
+
markAncestorFinished(stepId: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Extract parent ID from hierarchical stepId (e.g., "1-2-3" -\> "1-2")
|
|
38
|
+
*/
|
|
39
|
+
private getParentId;
|
|
40
|
+
/**
|
|
41
|
+
* Checks if any ancestor of the given stepId is finished
|
|
42
|
+
* Only applies to operations that are descendants of run-in-child-context operations
|
|
34
43
|
*/
|
|
35
|
-
|
|
44
|
+
private hasFinishedAncestor;
|
|
36
45
|
forceCheckpoint(): Promise<void>;
|
|
37
46
|
waitForQueueCompletion(): Promise<void>;
|
|
38
47
|
clearQueue(): void;
|
|
39
48
|
force(): Promise<void>;
|
|
40
49
|
checkpoint(stepId: string, data: Partial<OperationUpdate>): Promise<void>;
|
|
41
|
-
private hasFinishedAncestor;
|
|
42
50
|
private classifyCheckpointError;
|
|
43
51
|
private processQueue;
|
|
44
52
|
private notifyQueueCompletion;
|
|
45
53
|
private processBatch;
|
|
46
54
|
private updateStepDataFromCheckpointResponse;
|
|
55
|
+
private resolveWaitingOperation;
|
|
47
56
|
getQueueStatus(): {
|
|
48
57
|
queueLength: number;
|
|
49
58
|
isProcessing: boolean;
|
|
50
59
|
};
|
|
60
|
+
markOperationState(stepId: string, state: OperationLifecycleState, options?: {
|
|
61
|
+
metadata?: OperationMetadata;
|
|
62
|
+
endTimestamp?: Date;
|
|
63
|
+
}): void;
|
|
64
|
+
waitForRetryTimer(stepId: string): Promise<void>;
|
|
65
|
+
waitForStatusChange(stepId: string): Promise<void>;
|
|
66
|
+
markOperationAwaited(stepId: string): void;
|
|
67
|
+
getOperationState(stepId: string): OperationLifecycleState | undefined;
|
|
68
|
+
getAllOperations(): Map<string, OperationInfo>;
|
|
69
|
+
private cleanupOperation;
|
|
70
|
+
private cleanupAllOperations;
|
|
71
|
+
/**
|
|
72
|
+
* Determines if the function should terminate.
|
|
73
|
+
* @returns TerminationReason if the function should terminate, or undefined if the function should not terminate
|
|
74
|
+
*/
|
|
75
|
+
private shouldTerminate;
|
|
76
|
+
private checkAndTerminate;
|
|
77
|
+
private abortTermination;
|
|
78
|
+
private scheduleTermination;
|
|
79
|
+
private executeTermination;
|
|
80
|
+
private determineTerminationReason;
|
|
81
|
+
private startTimerWithPolling;
|
|
82
|
+
private forceRefreshAndCheckStatus;
|
|
51
83
|
}
|
|
52
|
-
export {};
|
|
53
84
|
//# sourceMappingURL=checkpoint-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-manager.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,SAAS,
|
|
1
|
+
{"version":3,"file":"checkpoint-manager.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-manager.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC"}
|
package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts
CHANGED
|
@@ -11,10 +11,12 @@ export declare class DurableExecutionInvocationInputWithClient implements Durabl
|
|
|
11
11
|
readonly durableExecutionClient: DurableExecutionClient;
|
|
12
12
|
readonly InitialExecutionState: {
|
|
13
13
|
Operations: Operation[];
|
|
14
|
-
NextMarker
|
|
14
|
+
NextMarker?: string | undefined;
|
|
15
15
|
};
|
|
16
16
|
readonly DurableExecutionArn: string;
|
|
17
17
|
readonly CheckpointToken: string;
|
|
18
18
|
constructor(params: DurableExecutionInvocationInput, durableExecutionClient: DurableExecutionClient);
|
|
19
|
+
static isInstance(event: unknown): event is DurableExecutionInvocationInputWithClient;
|
|
20
|
+
get [Symbol.toStringTag](): string;
|
|
19
21
|
}
|
|
20
22
|
//# sourceMappingURL=durable-execution-invocation-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable-execution-invocation-input.d.ts","sourceRoot":"","sources":["../../../src/utils/durable-execution-invocation-input/durable-execution-invocation-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;GAKG;AACH,qBAAa,yCACX,YAAW,+BAA+B;aAUxB,sBAAsB,EAAE,sBAAsB;IARhE,SAAgB,qBAAqB,EAAE;QACrC,UAAU,EAAE,SAAS,EAAE,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"durable-execution-invocation-input.d.ts","sourceRoot":"","sources":["../../../src/utils/durable-execution-invocation-input/durable-execution-invocation-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;GAKG;AACH,qBAAa,yCACX,YAAW,+BAA+B;aAUxB,sBAAsB,EAAE,sBAAsB;IARhE,SAAgB,qBAAqB,EAAE;QACrC,UAAU,EAAE,SAAS,EAAE,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KACjC,CAAC;IACF,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAC5C,SAAgB,eAAe,EAAE,MAAM,CAAC;gBAEtC,MAAM,EAAE,+BAA+B,EACvB,sBAAsB,EAAE,sBAAsB;IAOhE,MAAM,CAAC,UAAU,CACf,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,yCAAyC;IAerD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable-execution-invocation-input.test.d.ts","sourceRoot":"","sources":["../../../src/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { ExecutionContext } from "../../types";
|
|
2
2
|
import { UnrecoverableError } from "../../errors/unrecoverable-error/unrecoverable-error";
|
|
3
|
-
import { TerminationReason } from "../../termination-manager/types";
|
|
4
|
-
/**
|
|
5
|
-
* Terminates execution and returns a never-resolving promise to prevent code progression
|
|
6
|
-
* @param context - The execution context containing the termination manager
|
|
7
|
-
* @param reason - The termination reason
|
|
8
|
-
* @param message - The termination message
|
|
9
|
-
* @returns A never-resolving promise
|
|
10
|
-
*/
|
|
11
|
-
export declare function terminate<T>(context: ExecutionContext, reason: TerminationReason, message: string): Promise<T>;
|
|
12
3
|
/**
|
|
13
4
|
* Terminates execution for unrecoverable errors and returns a never-resolving promise
|
|
14
5
|
* @param context - The execution context containing the termination manager
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"termination-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/termination-helper/termination-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"termination-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/termination-helper/termination-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAE1F;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-durable-execution.d.ts","sourceRoot":"","sources":["../src/with-durable-execution.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,aAAa,EAMd,MAAM,SAAS,CAAC;AAKjB,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"with-durable-execution.d.ts","sourceRoot":"","sources":["../src/with-durable-execution.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,aAAa,EAMd,MAAM,SAAS,CAAC;AAKjB,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AA4PnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,eAAO,MAAM,oBAAoB,GAE/B,MAAM,GAAG,GAAG,EAEZ,OAAO,GAAG,GAAG,EACb,OAAO,SAAS,aAAa,GAAG,aAAa,EAE7C,SAAS,uBAAuB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAC1D,SAAS,sBAAsB,KAC9B,oBAiBF,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
"name": "@aws/durable-execution-sdk-js",
|
|
3
3
|
"description": "AWS Durable Execution Language SDK for TypeScript",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "1.0.
|
|
6
|
-
"repository":
|
|
5
|
+
"version": "1.0.2",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+ssh://git@github.com/aws/aws-durable-execution-sdk-js.git",
|
|
9
|
+
"directory": "packages/aws-durable-execution-sdk-js"
|
|
10
|
+
},
|
|
7
11
|
"homepage": "https://github.com/aws/aws-durable-execution-sdk-js/tree/main/packages/aws-durable-execution-sdk-js",
|
|
8
12
|
"engines": {
|
|
9
13
|
"node": ">=22"
|
|
@@ -47,10 +51,10 @@
|
|
|
47
51
|
"devDependencies": {
|
|
48
52
|
"@eslint/eslintrc": "^3.3.1",
|
|
49
53
|
"@eslint/js": "^9.29.0",
|
|
54
|
+
"@microsoft/api-extractor": "^7.55.1",
|
|
50
55
|
"@types/aws-lambda": "^8.10.147",
|
|
51
56
|
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
|
52
57
|
"@typescript-eslint/parser": "^8.25.0",
|
|
53
|
-
"aws-lambda": "^1.0.7",
|
|
54
58
|
"eslint": "^9.21.0",
|
|
55
59
|
"eslint-plugin-filename-convention": "file:scripts/eslint-plugin-filename-convention",
|
|
56
60
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
@@ -62,7 +66,7 @@
|
|
|
62
66
|
"typescript": "^5.7.3"
|
|
63
67
|
},
|
|
64
68
|
"dependencies": {
|
|
65
|
-
"@aws-sdk/client-lambda": "
|
|
69
|
+
"@aws-sdk/client-lambda": "^3.943.0"
|
|
66
70
|
},
|
|
67
71
|
"private": false
|
|
68
72
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkpoint-ancestor-checking.test.d.ts","sourceRoot":"","sources":["../../../src/utils/checkpoint/checkpoint-ancestor-checking.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracks active async operations to prevent premature termination
|
|
3
|
-
*/
|
|
4
|
-
export declare class ActiveOperationsTracker {
|
|
5
|
-
private activeCount;
|
|
6
|
-
/**
|
|
7
|
-
* Increment the counter when starting an async operation
|
|
8
|
-
*/
|
|
9
|
-
increment(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Decrement the counter when an async operation completes
|
|
12
|
-
*/
|
|
13
|
-
decrement(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Check if there are any active operations
|
|
16
|
-
*/
|
|
17
|
-
hasActive(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Get the current count of active operations
|
|
20
|
-
*/
|
|
21
|
-
getCount(): number;
|
|
22
|
-
/**
|
|
23
|
-
* Reset the counter (useful for testing)
|
|
24
|
-
*/
|
|
25
|
-
reset(): void;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Wraps an async function to track its execution
|
|
29
|
-
*/
|
|
30
|
-
export declare function trackOperation<T>(tracker: ActiveOperationsTracker, operation: () => Promise<T>): Promise<T>;
|
|
31
|
-
//# sourceMappingURL=active-operations-tracker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"active-operations-tracker.d.ts","sourceRoot":"","sources":["../../../src/utils/termination-helper/active-operations-tracker.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,WAAW,CAAK;IAExB;;OAEG;IACH,SAAS,IAAI,IAAI;IAIjB;;OAEG;IACH,SAAS,IAAI,IAAI;IAIjB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,OAAO,EAAE,uBAAuB,EAChC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"active-operations-tracker.test.d.ts","sourceRoot":"","sources":["../../../src/utils/termination-helper/active-operations-tracker.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ExecutionContext } from "../../types";
|
|
2
|
-
import { Checkpoint } from "../checkpoint/checkpoint-helper";
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
|
-
export interface WaitBeforeContinueOptions {
|
|
5
|
-
/** Check if operations are still running */
|
|
6
|
-
checkHasRunningOperations: boolean;
|
|
7
|
-
/** Check if step status has changed */
|
|
8
|
-
checkStepStatus: boolean;
|
|
9
|
-
/** Check if timer has expired */
|
|
10
|
-
checkTimer: boolean;
|
|
11
|
-
/** Scheduled end timestamp for timer check */
|
|
12
|
-
scheduledEndTimestamp?: Date | null;
|
|
13
|
-
/** Step ID to get current status */
|
|
14
|
-
stepId: string;
|
|
15
|
-
/** Execution context to get step data */
|
|
16
|
-
context: ExecutionContext;
|
|
17
|
-
/** Function to check if operations are running */
|
|
18
|
-
hasRunningOperations: () => boolean;
|
|
19
|
-
/** EventEmitter for operations completion events */
|
|
20
|
-
operationsEmitter: EventEmitter;
|
|
21
|
-
/** Checkpoint manager to force refresh when timer expires */
|
|
22
|
-
checkpoint?: Checkpoint;
|
|
23
|
-
/** Function to set callback that will be invoked when promise is awaited */
|
|
24
|
-
onAwaitedChange?: (callback: () => void) => void;
|
|
25
|
-
}
|
|
26
|
-
export interface WaitBeforeContinueResult {
|
|
27
|
-
reason: "timer" | "operations" | "status" | "timeout";
|
|
28
|
-
timerExpired?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* High-level helper that waits for conditions before continuing execution.
|
|
32
|
-
* Uses event-driven approach for both operations completion and status changes.
|
|
33
|
-
*/
|
|
34
|
-
export declare function waitBeforeContinue(options: WaitBeforeContinueOptions): Promise<WaitBeforeContinueResult>;
|
|
35
|
-
//# sourceMappingURL=wait-before-continue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wait-before-continue.d.ts","sourceRoot":"","sources":["../../../src/utils/wait-before-continue/wait-before-continue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,WAAW,yBAAyB;IACxC,4CAA4C;IAC5C,yBAAyB,EAAE,OAAO,CAAC;IACnC,uCAAuC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,iCAAiC;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,qBAAqB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACpC,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,kDAAkD;IAClD,oBAAoB,EAAE,MAAM,OAAO,CAAC;IACpC,oDAAoD;IACpD,iBAAiB,EAAE,YAAY,CAAC;IAChC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CA+HnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wait-before-continue.test.d.ts","sourceRoot":"","sources":["../../../src/utils/wait-before-continue/wait-before-continue.test.ts"],"names":[],"mappings":""}
|