@aws/durable-execution-sdk-js 1.0.0 → 1.0.1

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 (74) hide show
  1. package/README.md +3 -50
  2. package/dist/index.mjs +1874 -2017
  3. package/dist/index.mjs.map +1 -1
  4. package/dist-cjs/index.js +1873 -2016
  5. package/dist-cjs/index.js.map +1 -1
  6. package/dist-types/context/durable-context/durable-context.d.ts +0 -6
  7. package/dist-types/context/durable-context/durable-context.d.ts.map +1 -1
  8. package/dist-types/errors/durable-error/durable-error.d.ts +6 -0
  9. package/dist-types/errors/durable-error/durable-error.d.ts.map +1 -1
  10. package/dist-types/errors/step-errors/step-errors.d.ts +1 -0
  11. package/dist-types/errors/step-errors/step-errors.d.ts.map +1 -1
  12. package/dist-types/handlers/callback-handler/callback-promise.d.ts +2 -2
  13. package/dist-types/handlers/callback-handler/callback-promise.d.ts.map +1 -1
  14. package/dist-types/handlers/callback-handler/callback.d.ts +1 -2
  15. package/dist-types/handlers/callback-handler/callback.d.ts.map +1 -1
  16. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts +1 -0
  17. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts.map +1 -1
  18. package/dist-types/handlers/invoke-handler/invoke-handler.d.ts +1 -2
  19. package/dist-types/handlers/invoke-handler/invoke-handler.d.ts.map +1 -1
  20. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.d.ts.map +1 -1
  21. package/dist-types/handlers/step-handler/step-handler.d.ts +1 -9
  22. package/dist-types/handlers/step-handler/step-handler.d.ts.map +1 -1
  23. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts +1 -6
  24. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts.map +1 -1
  25. package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts +2 -0
  26. package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts.map +1 -0
  27. package/dist-types/handlers/wait-handler/wait-handler.d.ts +1 -2
  28. package/dist-types/handlers/wait-handler/wait-handler.d.ts.map +1 -1
  29. package/dist-types/testing/create-test-checkpoint-manager.d.ts.map +1 -1
  30. package/dist-types/testing/create-test-durable-context.d.ts.map +1 -1
  31. package/dist-types/testing/mock-checkpoint-manager.d.ts +0 -1
  32. package/dist-types/testing/mock-checkpoint-manager.d.ts.map +1 -1
  33. package/dist-types/testing/mock-checkpoint.d.ts +1 -0
  34. package/dist-types/testing/mock-checkpoint.d.ts.map +1 -1
  35. package/dist-types/types/batch.d.ts +8 -0
  36. package/dist-types/types/batch.d.ts.map +1 -1
  37. package/dist-types/types/core.d.ts +1 -3
  38. package/dist-types/types/core.d.ts.map +1 -1
  39. package/dist-types/types/durable-context.d.ts +8 -6
  40. package/dist-types/types/durable-context.d.ts.map +1 -1
  41. package/dist-types/types/index.d.ts +2 -0
  42. package/dist-types/types/index.d.ts.map +1 -1
  43. package/dist-types/types/operation-lifecycle-state.d.ts +27 -0
  44. package/dist-types/types/operation-lifecycle-state.d.ts.map +1 -0
  45. package/dist-types/types/operation-lifecycle.d.ts +27 -0
  46. package/dist-types/types/operation-lifecycle.d.ts.map +1 -0
  47. package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts +2 -0
  48. package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts.map +1 -0
  49. package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts +2 -0
  50. package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts.map +1 -0
  51. package/dist-types/utils/checkpoint/checkpoint-helper.d.ts +37 -0
  52. package/dist-types/utils/checkpoint/checkpoint-helper.d.ts.map +1 -1
  53. package/dist-types/utils/checkpoint/checkpoint-manager.d.ts +37 -12
  54. package/dist-types/utils/checkpoint/checkpoint-manager.d.ts.map +1 -1
  55. package/dist-types/utils/constants/constants.d.ts +0 -1
  56. package/dist-types/utils/constants/constants.d.ts.map +1 -1
  57. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts +3 -1
  58. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts.map +1 -1
  59. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts +2 -0
  60. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts.map +1 -0
  61. package/dist-types/utils/termination-helper/termination-helper.d.ts +0 -9
  62. package/dist-types/utils/termination-helper/termination-helper.d.ts.map +1 -1
  63. package/dist-types/with-durable-execution.d.ts.map +1 -1
  64. package/package.json +8 -3
  65. package/dist-types/utils/checkpoint/checkpoint-ancestor-checking.test.d.ts +0 -2
  66. package/dist-types/utils/checkpoint/checkpoint-ancestor-checking.test.d.ts.map +0 -1
  67. package/dist-types/utils/termination-helper/active-operations-tracker.d.ts +0 -31
  68. package/dist-types/utils/termination-helper/active-operations-tracker.d.ts.map +0 -1
  69. package/dist-types/utils/termination-helper/active-operations-tracker.test.d.ts +0 -2
  70. package/dist-types/utils/termination-helper/active-operations-tracker.test.d.ts.map +0 -1
  71. package/dist-types/utils/wait-before-continue/wait-before-continue.d.ts +0 -35
  72. package/dist-types/utils/wait-before-continue/wait-before-continue.d.ts.map +0 -1
  73. package/dist-types/utils/wait-before-continue/wait-before-continue.test.d.ts +0 -2
  74. package/dist-types/utils/wait-before-continue/wait-before-continue.test.d.ts.map +0 -1
@@ -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;AAEzD,MAAM,WAAW,UAAU;IACzB,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,M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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,75 @@ 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 pendingCompletions;
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;
28
23
  private isTerminating;
29
24
  private static textEncoder;
30
- constructor(durableExecutionArn: string, stepData: Record<string, Operation>, storage: DurableExecutionClient, terminationManager: TerminationManager, activeOperationsTracker: ActiveOperationsTracker | undefined, initialTaskToken: string, stepDataEmitter: EventEmitter, logger: DurableLogger, pendingCompletions: Set<string>);
25
+ private operations;
26
+ private terminationTimer;
27
+ private terminationReason;
28
+ private readonly TERMINATION_COOLDOWN_MS;
29
+ constructor(durableExecutionArn: string, stepData: Record<string, Operation>, storage: DurableExecutionClient, terminationManager: TerminationManager, initialTaskToken: string, stepDataEmitter: EventEmitter, logger: DurableLogger, finishedAncestors: Set<string>);
31
30
  setTerminating(): void;
32
31
  /**
33
- * Checks if a step ID or any of its ancestors has a pending completion
32
+ * Mark an ancestor as finished (for run-in-child-context operations)
33
+ */
34
+ markAncestorFinished(stepId: string): void;
35
+ /**
36
+ * Extract parent ID from hierarchical stepId (e.g., "1-2-3" -\> "1-2")
34
37
  */
35
- hasPendingAncestorCompletion(stepId: string): boolean;
38
+ private getParentId;
39
+ /**
40
+ * Checks if any ancestor of the given stepId is finished
41
+ * Only applies to operations that are descendants of run-in-child-context operations
42
+ */
43
+ private hasFinishedAncestor;
36
44
  forceCheckpoint(): Promise<void>;
37
45
  waitForQueueCompletion(): Promise<void>;
38
46
  clearQueue(): void;
39
47
  force(): Promise<void>;
40
48
  checkpoint(stepId: string, data: Partial<OperationUpdate>): Promise<void>;
41
- private hasFinishedAncestor;
42
49
  private classifyCheckpointError;
43
50
  private processQueue;
44
51
  private notifyQueueCompletion;
45
52
  private processBatch;
46
53
  private updateStepDataFromCheckpointResponse;
54
+ private resolveWaitingOperation;
47
55
  getQueueStatus(): {
48
56
  queueLength: number;
49
57
  isProcessing: boolean;
50
58
  };
59
+ markOperationState(stepId: string, state: OperationLifecycleState, options?: {
60
+ metadata?: OperationMetadata;
61
+ endTimestamp?: Date;
62
+ }): void;
63
+ waitForRetryTimer(stepId: string): Promise<void>;
64
+ waitForStatusChange(stepId: string): Promise<void>;
65
+ markOperationAwaited(stepId: string): void;
66
+ getOperationState(stepId: string): OperationLifecycleState | undefined;
67
+ getAllOperations(): Map<string, OperationInfo>;
68
+ private cleanupOperation;
69
+ private cleanupAllOperations;
70
+ private checkAndTerminate;
71
+ private abortTermination;
72
+ private scheduleTermination;
73
+ private executeTermination;
74
+ private determineTerminationReason;
75
+ private startTimerWithPolling;
76
+ private forceRefreshAndCheckStatus;
51
77
  }
52
- export {};
53
78
  //# 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,EA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ACd,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC;IAwChB,OAAO,CAAC,uBAAuB;YAuDjB,YAAY;IAyF1B,OAAO,CAAC,qBAAqB;YAOf,YAAY;IA4C1B,OAAO,CAAC,oCAAoC;IA8B5C,OAAO,CAAC,uBAAuB;IAgB/B,cAAc,IAAI;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,OAAO,CAAC;KACvB;IASD,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;IAmCP,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBhD,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBlD,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAgB1C,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAItE,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC;IAM9C,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,iBAAiB;IAsEzB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,0BAA0B;IA2BlC,OAAO,CAAC,qBAAqB;YA4Bf,0BAA0B;CAyDzC"}
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Shared constants to avoid circular dependencies
3
3
  */
4
- export declare const OPERATIONS_COMPLETE_EVENT = "allOperationsComplete";
5
4
  /**
6
5
  * Controls whether stack traces are stored in error objects
7
6
  * TODO: Accept this as configuration parameter in the future
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/utils/constants/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC"}
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"}
@@ -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: string;
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;KACpB,CAAC;IACF,SAAgB,mBAAmB,EAAE,MAAM,CAAC;IAC5C,SAAgB,eAAe,EAAE,MAAM,CAAC;gBAEtC,MAAM,EAAE,+BAA+B,EACvB,sBAAsB,EAAE,sBAAsB;CAMjE"}
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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=durable-execution-invocation-input.test.d.ts.map
@@ -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;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAmFpE;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,CAAC,CAAC,CAkHZ;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,EAC9C,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,kBAAkB,EACzB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,CAAC,CAAC,CAMZ"}
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;AAoOnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,oBAuBF,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;AA+PnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,oBAuBF,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.0",
6
- "repository": "ssh:github.com/aws/aws-durable-execution-sdk-js/tree/main/packages/aws-durable-execution-sdk-js",
5
+ "version": "1.0.1",
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,6 +51,7 @@
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",
@@ -62,7 +67,7 @@
62
67
  "typescript": "^5.7.3"
63
68
  },
64
69
  "dependencies": {
65
- "@aws-sdk/client-lambda": "*"
70
+ "@aws-sdk/client-lambda": "^3.943.0"
66
71
  },
67
72
  "private": false
68
73
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=checkpoint-ancestor-checking.test.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=active-operations-tracker.test.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=wait-before-continue.test.d.ts.map
@@ -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":""}