@aws/durable-execution-sdk-js 0.0.1 → 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 (284) hide show
  1. package/README.md +365 -0
  2. package/dist/index.mjs +4628 -0
  3. package/dist/index.mjs.map +1 -0
  4. package/dist-cjs/index.js +4646 -0
  5. package/dist-cjs/index.js.map +1 -0
  6. package/dist-types/context/durable-context/durable-context.d.ts +70 -0
  7. package/dist-types/context/durable-context/durable-context.d.ts.map +1 -0
  8. package/dist-types/context/durable-context/durable-context.integration.test.d.ts +2 -0
  9. package/dist-types/context/durable-context/durable-context.integration.test.d.ts.map +1 -0
  10. package/dist-types/context/durable-context/durable-context.unit.test.d.ts +2 -0
  11. package/dist-types/context/durable-context/durable-context.unit.test.d.ts.map +1 -0
  12. package/dist-types/context/durable-context/logger-mode-aware.test.d.ts +2 -0
  13. package/dist-types/context/durable-context/logger-mode-aware.test.d.ts.map +1 -0
  14. package/dist-types/context/durable-context/logger-property.test.d.ts +2 -0
  15. package/dist-types/context/durable-context/logger-property.test.d.ts.map +1 -0
  16. package/dist-types/context/durable-context/mode-management/mode-management.d.ts +13 -0
  17. package/dist-types/context/durable-context/mode-management/mode-management.d.ts.map +1 -0
  18. package/dist-types/context/durable-context/mode-management/mode-management.test.d.ts +2 -0
  19. package/dist-types/context/durable-context/mode-management/mode-management.test.d.ts.map +1 -0
  20. package/dist-types/context/execution-context/execution-context.d.ts +9 -0
  21. package/dist-types/context/execution-context/execution-context.d.ts.map +1 -0
  22. package/dist-types/context/execution-context/execution-context.test.d.ts +2 -0
  23. package/dist-types/context/execution-context/execution-context.test.d.ts.map +1 -0
  24. package/dist-types/durable-execution-api-client/durable-execution-api-client-caching.test.d.ts +2 -0
  25. package/dist-types/durable-execution-api-client/durable-execution-api-client-caching.test.d.ts.map +1 -0
  26. package/dist-types/durable-execution-api-client/durable-execution-api-client.d.ts +29 -0
  27. package/dist-types/durable-execution-api-client/durable-execution-api-client.d.ts.map +1 -0
  28. package/dist-types/durable-execution-api-client/durable-execution-api-client.test.d.ts +2 -0
  29. package/dist-types/durable-execution-api-client/durable-execution-api-client.test.d.ts.map +1 -0
  30. package/dist-types/errors/callback-error/callback-error.test.d.ts +2 -0
  31. package/dist-types/errors/callback-error/callback-error.test.d.ts.map +1 -0
  32. package/dist-types/errors/checkpoint-errors/checkpoint-errors.d.ts +21 -0
  33. package/dist-types/errors/checkpoint-errors/checkpoint-errors.d.ts.map +1 -0
  34. package/dist-types/errors/checkpoint-errors/checkpoint-errors.test.d.ts +2 -0
  35. package/dist-types/errors/checkpoint-errors/checkpoint-errors.test.d.ts.map +1 -0
  36. package/dist-types/errors/durable-error/durable-error-coverage.test.d.ts +2 -0
  37. package/dist-types/errors/durable-error/durable-error-coverage.test.d.ts.map +1 -0
  38. package/dist-types/errors/durable-error/durable-error.d.ts +61 -0
  39. package/dist-types/errors/durable-error/durable-error.d.ts.map +1 -0
  40. package/dist-types/errors/durable-error/durable-error.test.d.ts +2 -0
  41. package/dist-types/errors/durable-error/durable-error.test.d.ts.map +1 -0
  42. package/dist-types/errors/durable-error/error-determinism.integration.test.d.ts +2 -0
  43. package/dist-types/errors/durable-error/error-determinism.integration.test.d.ts.map +1 -0
  44. package/dist-types/errors/non-deterministic-error/non-deterministic-error.d.ts +10 -0
  45. package/dist-types/errors/non-deterministic-error/non-deterministic-error.d.ts.map +1 -0
  46. package/dist-types/errors/serdes-errors/serdes-errors.d.ts +27 -0
  47. package/dist-types/errors/serdes-errors/serdes-errors.d.ts.map +1 -0
  48. package/dist-types/errors/serdes-errors/serdes-errors.test.d.ts +2 -0
  49. package/dist-types/errors/serdes-errors/serdes-errors.test.d.ts.map +1 -0
  50. package/dist-types/errors/step-errors/step-errors.d.ts +9 -0
  51. package/dist-types/errors/step-errors/step-errors.d.ts.map +1 -0
  52. package/dist-types/errors/unrecoverable-error/unrecoverable-error.d.ts +41 -0
  53. package/dist-types/errors/unrecoverable-error/unrecoverable-error.d.ts.map +1 -0
  54. package/dist-types/errors/unrecoverable-error/unrecoverable-error.test.d.ts +2 -0
  55. package/dist-types/errors/unrecoverable-error/unrecoverable-error.test.d.ts.map +1 -0
  56. package/dist-types/handlers/callback-handler/callback-promise.d.ts +5 -0
  57. package/dist-types/handlers/callback-handler/callback-promise.d.ts.map +1 -0
  58. package/dist-types/handlers/callback-handler/callback-promise.test.d.ts +2 -0
  59. package/dist-types/handlers/callback-handler/callback-promise.test.d.ts.map +1 -0
  60. package/dist-types/handlers/callback-handler/callback.d.ts +6 -0
  61. package/dist-types/handlers/callback-handler/callback.d.ts.map +1 -0
  62. package/dist-types/handlers/callback-handler/callback.test.d.ts +2 -0
  63. package/dist-types/handlers/callback-handler/callback.test.d.ts.map +1 -0
  64. package/dist-types/handlers/concurrent-execution-handler/batch-result.d.ts +35 -0
  65. package/dist-types/handlers/concurrent-execution-handler/batch-result.d.ts.map +1 -0
  66. package/dist-types/handlers/concurrent-execution-handler/batch-result.test.d.ts +2 -0
  67. package/dist-types/handlers/concurrent-execution-handler/batch-result.test.d.ts.map +1 -0
  68. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler-two-phase.test.d.ts +2 -0
  69. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler-two-phase.test.d.ts.map +1 -0
  70. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts +13 -0
  71. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.d.ts.map +1 -0
  72. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.integration.test.d.ts +2 -0
  73. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.integration.test.d.ts.map +1 -0
  74. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.replay.test.d.ts +2 -0
  75. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.replay.test.d.ts.map +1 -0
  76. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.test.d.ts +2 -0
  77. package/dist-types/handlers/concurrent-execution-handler/concurrent-execution-handler.test.d.ts.map +1 -0
  78. package/dist-types/handlers/invoke-handler/invoke-handler-two-phase.test.d.ts +2 -0
  79. package/dist-types/handlers/invoke-handler/invoke-handler-two-phase.test.d.ts.map +1 -0
  80. package/dist-types/handlers/invoke-handler/invoke-handler.d.ts +7 -0
  81. package/dist-types/handlers/invoke-handler/invoke-handler.d.ts.map +1 -0
  82. package/dist-types/handlers/invoke-handler/invoke-handler.test.d.ts +2 -0
  83. package/dist-types/handlers/invoke-handler/invoke-handler.test.d.ts.map +1 -0
  84. package/dist-types/handlers/map-handler/map-handler-two-phase.test.d.ts +2 -0
  85. package/dist-types/handlers/map-handler/map-handler-two-phase.test.d.ts.map +1 -0
  86. package/dist-types/handlers/map-handler/map-handler.d.ts +3 -0
  87. package/dist-types/handlers/map-handler/map-handler.d.ts.map +1 -0
  88. package/dist-types/handlers/map-handler/map-handler.test.d.ts +2 -0
  89. package/dist-types/handlers/map-handler/map-handler.test.d.ts.map +1 -0
  90. package/dist-types/handlers/parallel-handler/parallel-handler-two-phase.test.d.ts +2 -0
  91. package/dist-types/handlers/parallel-handler/parallel-handler-two-phase.test.d.ts.map +1 -0
  92. package/dist-types/handlers/parallel-handler/parallel-handler.d.ts +3 -0
  93. package/dist-types/handlers/parallel-handler/parallel-handler.d.ts.map +1 -0
  94. package/dist-types/handlers/parallel-handler/parallel-handler.test.d.ts +2 -0
  95. package/dist-types/handlers/parallel-handler/parallel-handler.test.d.ts.map +1 -0
  96. package/dist-types/handlers/promise-handler/promise-handler.d.ts +8 -0
  97. package/dist-types/handlers/promise-handler/promise-handler.d.ts.map +1 -0
  98. package/dist-types/handlers/promise-handler/promise-handler.test.d.ts +2 -0
  99. package/dist-types/handlers/promise-handler/promise-handler.test.d.ts.map +1 -0
  100. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler-two-phase.test.d.ts +2 -0
  101. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler-two-phase.test.d.ts.map +1 -0
  102. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.d.ts +10 -0
  103. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.d.ts.map +1 -0
  104. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.test.d.ts +2 -0
  105. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-handler.test.d.ts.map +1 -0
  106. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-integration.test.d.ts +2 -0
  107. package/dist-types/handlers/run-in-child-context-handler/run-in-child-context-integration.test.d.ts.map +1 -0
  108. package/dist-types/handlers/step-handler/step-handler-two-phase.test.d.ts +2 -0
  109. package/dist-types/handlers/step-handler/step-handler-two-phase.test.d.ts.map +1 -0
  110. package/dist-types/handlers/step-handler/step-handler.d.ts +6 -0
  111. package/dist-types/handlers/step-handler/step-handler.d.ts.map +1 -0
  112. package/dist-types/handlers/step-handler/step-handler.test.d.ts +2 -0
  113. package/dist-types/handlers/step-handler/step-handler.test.d.ts.map +1 -0
  114. package/dist-types/handlers/step-handler/step-handler.timing.test.d.ts +2 -0
  115. package/dist-types/handlers/step-handler/step-handler.timing.test.d.ts.map +1 -0
  116. package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.d.ts +3 -0
  117. package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.d.ts.map +1 -0
  118. package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.test.d.ts +2 -0
  119. package/dist-types/handlers/wait-for-callback-handler/wait-for-callback-handler.test.d.ts.map +1 -0
  120. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler-two-phase.test.d.ts +2 -0
  121. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler-two-phase.test.d.ts.map +1 -0
  122. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts +5 -0
  123. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.d.ts.map +1 -0
  124. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.test.d.ts +2 -0
  125. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.test.d.ts.map +1 -0
  126. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.timing.test.d.ts +2 -0
  127. package/dist-types/handlers/wait-for-condition-handler/wait-for-condition-handler.timing.test.d.ts.map +1 -0
  128. package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts +2 -0
  129. package/dist-types/handlers/wait-handler/wait-handler-comparison.test.d.ts.map +1 -0
  130. package/dist-types/handlers/wait-handler/wait-handler-two-phase.test.d.ts +2 -0
  131. package/dist-types/handlers/wait-handler/wait-handler-two-phase.test.d.ts.map +1 -0
  132. package/dist-types/handlers/wait-handler/wait-handler.d.ts +8 -0
  133. package/dist-types/handlers/wait-handler/wait-handler.d.ts.map +1 -0
  134. package/dist-types/handlers/wait-handler/wait-handler.test.d.ts +2 -0
  135. package/dist-types/handlers/wait-handler/wait-handler.test.d.ts.map +1 -0
  136. package/dist-types/index.d.ts +12 -0
  137. package/dist-types/index.d.ts.map +1 -0
  138. package/dist-types/run-durable.d.ts +2 -0
  139. package/dist-types/run-durable.d.ts.map +1 -0
  140. package/dist-types/termination-manager/termination-manager-checkpoint.test.d.ts +2 -0
  141. package/dist-types/termination-manager/termination-manager-checkpoint.test.d.ts.map +1 -0
  142. package/dist-types/termination-manager/termination-manager.d.ts +15 -0
  143. package/dist-types/termination-manager/termination-manager.d.ts.map +1 -0
  144. package/dist-types/termination-manager/termination-manager.test.d.ts +2 -0
  145. package/dist-types/termination-manager/termination-manager.test.d.ts.map +1 -0
  146. package/dist-types/termination-manager/types.d.ts +26 -0
  147. package/dist-types/termination-manager/types.d.ts.map +1 -0
  148. package/dist-types/testing/create-test-checkpoint-manager.d.ts +5 -0
  149. package/dist-types/testing/create-test-checkpoint-manager.d.ts.map +1 -0
  150. package/dist-types/testing/create-test-durable-context.d.ts +32 -0
  151. package/dist-types/testing/create-test-durable-context.d.ts.map +1 -0
  152. package/dist-types/testing/mock-batch-result.d.ts +26 -0
  153. package/dist-types/testing/mock-batch-result.d.ts.map +1 -0
  154. package/dist-types/testing/mock-checkpoint-manager.d.ts +20 -0
  155. package/dist-types/testing/mock-checkpoint-manager.d.ts.map +1 -0
  156. package/dist-types/testing/mock-checkpoint.d.ts +13 -0
  157. package/dist-types/testing/mock-checkpoint.d.ts.map +1 -0
  158. package/dist-types/testing/mock-context.d.ts +10 -0
  159. package/dist-types/testing/mock-context.d.ts.map +1 -0
  160. package/dist-types/testing/test-constants.d.ts +59 -0
  161. package/dist-types/testing/test-constants.d.ts.map +1 -0
  162. package/dist-types/types/batch.d.ts +185 -0
  163. package/dist-types/types/batch.d.ts.map +1 -0
  164. package/dist-types/types/callback.d.ts +48 -0
  165. package/dist-types/types/callback.d.ts.map +1 -0
  166. package/dist-types/types/child-context.d.ts +24 -0
  167. package/dist-types/types/child-context.d.ts.map +1 -0
  168. package/dist-types/types/core.d.ts +313 -0
  169. package/dist-types/types/core.d.ts.map +1 -0
  170. package/dist-types/types/durable-context.d.ts +669 -0
  171. package/dist-types/types/durable-context.d.ts.map +1 -0
  172. package/dist-types/types/durable-execution.d.ts +192 -0
  173. package/dist-types/types/durable-execution.d.ts.map +1 -0
  174. package/dist-types/types/durable-logger.d.ts +69 -0
  175. package/dist-types/types/durable-logger.d.ts.map +1 -0
  176. package/dist-types/types/durable-promise.d.ts +80 -0
  177. package/dist-types/types/durable-promise.d.ts.map +1 -0
  178. package/dist-types/types/index.d.ts +15 -0
  179. package/dist-types/types/index.d.ts.map +1 -0
  180. package/dist-types/types/invoke.d.ts +12 -0
  181. package/dist-types/types/invoke.d.ts.map +1 -0
  182. package/dist-types/types/logger.d.ts +63 -0
  183. package/dist-types/types/logger.d.ts.map +1 -0
  184. package/dist-types/types/operation-lifecycle-state.d.ts +27 -0
  185. package/dist-types/types/operation-lifecycle-state.d.ts.map +1 -0
  186. package/dist-types/types/operation-lifecycle.d.ts +27 -0
  187. package/dist-types/types/operation-lifecycle.d.ts.map +1 -0
  188. package/dist-types/types/step.d.ts +76 -0
  189. package/dist-types/types/step.d.ts.map +1 -0
  190. package/dist-types/types/wait-condition.d.ts +46 -0
  191. package/dist-types/types/wait-condition.d.ts.map +1 -0
  192. package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts +2 -0
  193. package/dist-types/utils/checkpoint/checkpoint-ancestor.test.d.ts.map +1 -0
  194. package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts +2 -0
  195. package/dist-types/utils/checkpoint/checkpoint-central-termination.test.d.ts.map +1 -0
  196. package/dist-types/utils/checkpoint/checkpoint-error-classification.test.d.ts +2 -0
  197. package/dist-types/utils/checkpoint/checkpoint-error-classification.test.d.ts.map +1 -0
  198. package/dist-types/utils/checkpoint/checkpoint-helper.d.ts +47 -0
  199. package/dist-types/utils/checkpoint/checkpoint-helper.d.ts.map +1 -0
  200. package/dist-types/utils/checkpoint/checkpoint-integration.test.d.ts +2 -0
  201. package/dist-types/utils/checkpoint/checkpoint-integration.test.d.ts.map +1 -0
  202. package/dist-types/utils/checkpoint/checkpoint-manager.d.ts +78 -0
  203. package/dist-types/utils/checkpoint/checkpoint-manager.d.ts.map +1 -0
  204. package/dist-types/utils/checkpoint/checkpoint-queue-completion.test.d.ts +2 -0
  205. package/dist-types/utils/checkpoint/checkpoint-queue-completion.test.d.ts.map +1 -0
  206. package/dist-types/utils/checkpoint/checkpoint-stepdata-update.test.d.ts +2 -0
  207. package/dist-types/utils/checkpoint/checkpoint-stepdata-update.test.d.ts.map +1 -0
  208. package/dist-types/utils/checkpoint/checkpoint-termination.test.d.ts +2 -0
  209. package/dist-types/utils/checkpoint/checkpoint-termination.test.d.ts.map +1 -0
  210. package/dist-types/utils/checkpoint/checkpoint.test.d.ts +2 -0
  211. package/dist-types/utils/checkpoint/checkpoint.test.d.ts.map +1 -0
  212. package/dist-types/utils/constants/constants.d.ts +9 -0
  213. package/dist-types/utils/constants/constants.d.ts.map +1 -0
  214. package/dist-types/utils/context-tracker/context-tracker.d.ts +13 -0
  215. package/dist-types/utils/context-tracker/context-tracker.d.ts.map +1 -0
  216. package/dist-types/utils/context-tracker/context-tracker.test.d.ts +2 -0
  217. package/dist-types/utils/context-tracker/context-tracker.test.d.ts.map +1 -0
  218. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts +22 -0
  219. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.d.ts.map +1 -0
  220. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts +2 -0
  221. package/dist-types/utils/durable-execution-invocation-input/durable-execution-invocation-input.test.d.ts.map +1 -0
  222. package/dist-types/utils/duration/duration.d.ts +8 -0
  223. package/dist-types/utils/duration/duration.d.ts.map +1 -0
  224. package/dist-types/utils/duration/duration.test.d.ts +2 -0
  225. package/dist-types/utils/duration/duration.test.d.ts.map +1 -0
  226. package/dist-types/utils/error-object/error-object-coverage.test.d.ts +2 -0
  227. package/dist-types/utils/error-object/error-object-coverage.test.d.ts.map +1 -0
  228. package/dist-types/utils/error-object/error-object.d.ts +3 -0
  229. package/dist-types/utils/error-object/error-object.d.ts.map +1 -0
  230. package/dist-types/utils/error-object/error-object.test.d.ts +2 -0
  231. package/dist-types/utils/error-object/error-object.test.d.ts.map +1 -0
  232. package/dist-types/utils/logger/default-logger.d.ts +51 -0
  233. package/dist-types/utils/logger/default-logger.d.ts.map +1 -0
  234. package/dist-types/utils/logger/default-logger.test.d.ts +2 -0
  235. package/dist-types/utils/logger/default-logger.test.d.ts.map +1 -0
  236. package/dist-types/utils/logger/logger.d.ts +2 -0
  237. package/dist-types/utils/logger/logger.d.ts.map +1 -0
  238. package/dist-types/utils/logger/logger.test.d.ts +2 -0
  239. package/dist-types/utils/logger/logger.test.d.ts.map +1 -0
  240. package/dist-types/utils/logger/structured-logger-integration.test.d.ts +2 -0
  241. package/dist-types/utils/logger/structured-logger-integration.test.d.ts.map +1 -0
  242. package/dist-types/utils/replay-validation/replay-validation.d.ts +8 -0
  243. package/dist-types/utils/replay-validation/replay-validation.d.ts.map +1 -0
  244. package/dist-types/utils/replay-validation/replay-validation.test.d.ts +2 -0
  245. package/dist-types/utils/replay-validation/replay-validation.test.d.ts.map +1 -0
  246. package/dist-types/utils/retry/retry-config/index.d.ts +167 -0
  247. package/dist-types/utils/retry/retry-config/index.d.ts.map +1 -0
  248. package/dist-types/utils/retry/retry-config/index.test.d.ts +2 -0
  249. package/dist-types/utils/retry/retry-config/index.test.d.ts.map +1 -0
  250. package/dist-types/utils/retry/retry-presets/retry-presets.d.ts +35 -0
  251. package/dist-types/utils/retry/retry-presets/retry-presets.d.ts.map +1 -0
  252. package/dist-types/utils/safe-stringify/safe-stringify.d.ts +2 -0
  253. package/dist-types/utils/safe-stringify/safe-stringify.d.ts.map +1 -0
  254. package/dist-types/utils/safe-stringify/safe-stringify.test.d.ts +2 -0
  255. package/dist-types/utils/safe-stringify/safe-stringify.test.d.ts.map +1 -0
  256. package/dist-types/utils/serdes/serdes.d.ts +152 -0
  257. package/dist-types/utils/serdes/serdes.d.ts.map +1 -0
  258. package/dist-types/utils/serdes/serdes.test.d.ts +2 -0
  259. package/dist-types/utils/serdes/serdes.test.d.ts.map +1 -0
  260. package/dist-types/utils/step-id-utils/step-id-utils.d.ts +16 -0
  261. package/dist-types/utils/step-id-utils/step-id-utils.d.ts.map +1 -0
  262. package/dist-types/utils/step-id-utils/step-id-utils.test.d.ts +2 -0
  263. package/dist-types/utils/step-id-utils/step-id-utils.test.d.ts.map +1 -0
  264. package/dist-types/utils/summary-generators/summary-generators.d.ts +10 -0
  265. package/dist-types/utils/summary-generators/summary-generators.d.ts.map +1 -0
  266. package/dist-types/utils/summary-generators/summary-generators.test.d.ts +2 -0
  267. package/dist-types/utils/summary-generators/summary-generators.test.d.ts.map +1 -0
  268. package/dist-types/utils/termination-helper/termination-deferral.test.d.ts +2 -0
  269. package/dist-types/utils/termination-helper/termination-deferral.test.d.ts.map +1 -0
  270. package/dist-types/utils/termination-helper/termination-helper.d.ts +11 -0
  271. package/dist-types/utils/termination-helper/termination-helper.d.ts.map +1 -0
  272. package/dist-types/utils/termination-helper/termination-helper.test.d.ts +2 -0
  273. package/dist-types/utils/termination-helper/termination-helper.test.d.ts.map +1 -0
  274. package/dist-types/utils/wait-strategy/wait-strategy-config.d.ts +19 -0
  275. package/dist-types/utils/wait-strategy/wait-strategy-config.d.ts.map +1 -0
  276. package/dist-types/utils/wait-strategy/wait-strategy-config.test.d.ts +2 -0
  277. package/dist-types/utils/wait-strategy/wait-strategy-config.test.d.ts.map +1 -0
  278. package/dist-types/with-durable-execution-queue-completion.test.d.ts +2 -0
  279. package/dist-types/with-durable-execution-queue-completion.test.d.ts.map +1 -0
  280. package/dist-types/with-durable-execution.d.ts +75 -0
  281. package/dist-types/with-durable-execution.d.ts.map +1 -0
  282. package/dist-types/with-durable-execution.test.d.ts +2 -0
  283. package/dist-types/with-durable-execution.test.d.ts.map +1 -0
  284. package/package.json +69 -3
@@ -0,0 +1,192 @@
1
+ import { CheckpointDurableExecutionRequest, CheckpointDurableExecutionResponse, GetDurableExecutionStateRequest, GetDurableExecutionStateResponse, LambdaClient } from "@aws-sdk/client-lambda";
2
+ import { DurableContext } from "./durable-context";
3
+ import { DurableLogger } from "./durable-logger";
4
+ import { Context } from "aws-lambda";
5
+ import { DurableExecutionInvocationInput, DurableExecutionInvocationOutput } from "./core";
6
+ /**
7
+ * A handler function type for a durable execution that provides automatic state persistence,
8
+ * retry logic, and workflow orchestration capabilities.
9
+ *
10
+ * This handler type is the core interface for building stateful, long-running AWS Durable Executions
11
+ * using the Durable Execution SDK. The handler receives a durable context that enables:
12
+ * - Step-based execution with automatic checkpointing and replay
13
+ * - Built-in retry strategies with exponential backoff and jitter
14
+ * - Workflow orchestration with parallel execution and child contexts
15
+ * - External system integration via callbacks and conditional waiting
16
+ * - Batch operations with concurrency control
17
+ *
18
+ * This handler function must be wrapped by `withDurableExecution()` to enable
19
+ * durable execution capabilities. During replay scenarios, the handler function is re-executed,
20
+ * however the durable context operations that already completed(steps, waits, callbacks, etc.) are
21
+ * not re-executed.
22
+ *
23
+ * @typeParam TEvent - The type of the input event payload (defaults to any)
24
+ * @typeParam TResult - The type of the return value (defaults to any)
25
+ * @typeParam TLogger - The type of a custom logger implementation (defaults to DurableLogger)
26
+ *
27
+ * @param event - The parsed JSON input event data for the invocation
28
+ * @param context - The durable context providing methods for durable operations like steps,
29
+ * waits, parallel execution, external callbacks, and workflow orchestration
30
+ *
31
+ * @returns A promise that resolves with the handler's result value or rejects with an
32
+ * execution error. The result will be automatically serialized and may be
33
+ * checkpointed if it exceeds response size limits.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const durableHandler: DurableExecutionHandler<{ userId: string }, { status: string }> = async (event, context) => {
38
+ * // Execute durable step with automatic retry and checkpointing
39
+ * const user = await context.step("fetch-user", async () =>
40
+ * fetchUserFromDB(event.userId)
41
+ * );
42
+ *
43
+ * // Wait for external callback (e.g., manual approval)
44
+ * const approval = await context.waitForCallback("approval", async (callbackId) => {
45
+ * await sendApprovalRequest(callbackId, user);
46
+ * });
47
+ *
48
+ * // Process in parallel with concurrency control
49
+ * const results = await context.parallel("parallel-tasks", [
50
+ * async (ctx) => ctx.step("task1", () => processTask1(user)),
51
+ * async (ctx) => ctx.step("task2", () => processTask2(user))
52
+ * ]);
53
+ *
54
+ * return { status: "completed" };
55
+ * };
56
+ *
57
+ * export const handler = withDurableExecution(durableHandler);
58
+ * ```
59
+ *
60
+ * @public
61
+ */
62
+ export type DurableExecutionHandler<TEvent = any, TResult = any, TLogger extends DurableLogger = DurableLogger> = (event: TEvent, context: DurableContext<TLogger>) => Promise<TResult>;
63
+ /**
64
+ * Configuration options for durable execution setup.
65
+ *
66
+ * This interface allows customization of the durable execution runtime behavior,
67
+ * primarily for dependency injection and testing scenarios. In most production
68
+ * use cases, the default configuration is sufficient.
69
+ *
70
+ * @public
71
+ */
72
+ export interface DurableExecutionConfig {
73
+ /**
74
+ * Optional custom AWS Lambda client instance for durable execution operations.
75
+ *
76
+ * When provided, this client will be used for all AWS Lambda service calls including
77
+ * checkpoint operations and execution state management. This is useful for:
78
+ * - Custom AWS configurations (regions, credentials, endpoints)
79
+ * - Testing with mocked Lambda clients
80
+ * - Advanced networking configurations (VPC endpoints, proxies)
81
+ * - Custom retry and timeout configurations
82
+ *
83
+ * If not provided, a default Lambda client will be created automatically using
84
+ * the standard AWS SDK configuration chain (environment variables, IAM roles, etc.).
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * import { LambdaClient } from '@aws-sdk/client-lambda';
89
+ *
90
+ * const customClient = new LambdaClient({
91
+ * region: 'us-west-2',
92
+ * maxAttempts: 5,
93
+ * retryMode: 'adaptive'
94
+ * });
95
+ *
96
+ * export const handler = withDurableExecution(myHandler, {
97
+ * client: customClient
98
+ * });
99
+ * ```
100
+ */
101
+ client?: LambdaClient;
102
+ }
103
+ /**
104
+ * Client interface for durable execution backend operations.
105
+ *
106
+ * This interface defines the core operations needed to manage durable execution state
107
+ * and checkpoints. It abstracts the underlying service calls and provides
108
+ * a clean contract for:
109
+ * - Retrieving execution state during replay scenarios
110
+ * - Creating checkpoints for state persistence
111
+ * - Managing long-running workflow state
112
+ *
113
+ * Implementations of this interface handle the communication with AWS services to
114
+ * ensure durable execution capabilities including automatic retry, state recovery,
115
+ * and workflow orchestration.
116
+ *
117
+ * @public
118
+ */
119
+ export interface DurableExecutionClient {
120
+ /**
121
+ * Retrieves the current execution state for a durable execution.
122
+ *
123
+ * This method fetches the persisted state data from the durable execution backend,
124
+ * including step history, checkpoint data, and execution metadata. It's primarily
125
+ * used during replay scenarios to restore the execution context and determine
126
+ * which operations have already been completed.
127
+ *
128
+ * The execution state contains all information needed to resume a durable function
129
+ * from where it left off, enabling fault tolerance and long-running workflows.
130
+ *
131
+ * @param params - Request parameters including execution ARN and state identifiers
132
+ * @param logger - Optional logger instance for operation logging and debugging
133
+ *
134
+ * @returns Promise resolving to the execution state response containing step history,
135
+ * checkpoint data, and execution metadata
136
+ *
137
+ * @throws Will throw an error if the execution state cannot be retrieved due to
138
+ * network issues, authentication problems, or invalid execution ARN
139
+ */
140
+ getExecutionState(params: GetDurableExecutionStateRequest, logger?: DurableLogger): Promise<GetDurableExecutionStateResponse>;
141
+ /**
142
+ * Creates a checkpoint to persist the current execution state.
143
+ *
144
+ * This method saves the current execution progress, step results, and context data
145
+ * to enable recovery and replay capabilities. Checkpoints are created automatically
146
+ * at key points during execution (after steps complete, before waits, etc.) and
147
+ * can also be triggered manually for custom persistence needs.
148
+ *
149
+ * Checkpointing enables:
150
+ * - Automatic recovery from timeouts or failures
151
+ * - Resumption of long-running workflows
152
+ * - Replay semantics for consistent execution
153
+ * - State persistence across execution boundaries
154
+ *
155
+ * @param params - Checkpoint request parameters including execution data and metadata
156
+ * @param logger - Optional logger instance for operation logging and debugging
157
+ *
158
+ * @returns Promise resolving to the checkpoint response with confirmation and metadata
159
+ *
160
+ * @throws Will throw an error if the checkpoint cannot be created due to network issues,
161
+ * authentication problems, or storage limitations
162
+ */
163
+ checkpoint(params: CheckpointDurableExecutionRequest, logger?: DurableLogger): Promise<CheckpointDurableExecutionResponse>;
164
+ }
165
+ /**
166
+ * The handler type returned by `withDurableExecution()` that handles durable execution behaviour.
167
+ *
168
+ * This handler type represents the final lambda function that gets deployed and invoked by the Durable
169
+ * Execution service.
170
+ *
171
+ * The handler receives `DurableExecutionInvocationInput` containing execution metadata, checkpoint tokens,
172
+ * and operation history, then returns `DurableExecutionInvocationOutput` with execution status and results.
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * // Define your durable handler
177
+ * const myHandler: DurableExecutionHandler<MyEvent, MyResult> = async (event, context) => {
178
+ * const result = await context.step("process", async () => processEvent(event));
179
+ * return result;
180
+ * };
181
+ *
182
+ * // Wrap it to create a DurableLambdaHandler
183
+ * export const handler: DurableLambdaHandler = withDurableExecution(myHandler);
184
+ *
185
+ * // Deploy this handler - it will receive DurableExecutionInvocationInput
186
+ * // and handle all the durability management automatically
187
+ * ```
188
+ *
189
+ * @public
190
+ */
191
+ export type DurableLambdaHandler = (event: DurableExecutionInvocationInput, context: Context) => Promise<DurableExecutionInvocationOutput>;
192
+ //# sourceMappingURL=durable-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-execution.d.ts","sourceRoot":"","sources":["../../src/types/durable-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EACL,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,QAAQ,CAAC;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,MAAM,uBAAuB,CAEjC,MAAM,GAAG,GAAG,EAEZ,OAAO,GAAG,GAAG,EACb,OAAO,SAAS,aAAa,GAAG,aAAa,IAC3C,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE1E;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CACf,MAAM,EAAE,+BAA+B,EACvC,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAE7C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,UAAU,CACR,MAAM,EAAE,iCAAiC,EACzC,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,kCAAkC,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,KAAK,EAAE,+BAA+B,EACtC,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,gCAAgC,CAAC,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { DurableLogData, DurableLogLevel } from "./logger";
2
+ /**
3
+ * The durable logging context that can be used to provide durable execution metadata
4
+ * such as executionArn, operationId, and attempt.
5
+ * @public
6
+ */
7
+ export interface DurableLoggingContext {
8
+ getDurableLogData: () => DurableLogData;
9
+ }
10
+ /**
11
+ * This interface provides structured logging capabilities for durable execution contexts.
12
+ * A custom logger must implement this interface to be used by the Durable Execution
13
+ * Language SDK. The SDK will automatically parse the logger and use the appropriate
14
+ * logging method based on the log level.
15
+ *
16
+ * @public
17
+ */
18
+ export interface DurableLogger {
19
+ /**
20
+ * Generic log method with configurable level
21
+ * @param level - Log level (e.g., "INFO", "ERROR", "WARN", "DEBUG")
22
+ * @param message - Log message
23
+ * @param optionalParams - Additional data to include in log entry
24
+ * @example context.logger.log("INFO", "User logged in", \{ userId: "XXX" \})
25
+ */
26
+ log?(level: `${DurableLogLevel}`, ...params: any): void;
27
+ /**
28
+ * Log error messages with optional message and additional parameters
29
+ * @param message - Optional message
30
+ * @param optionalParams - Additional data to include in log entry
31
+ * @example context.logger.error("Database query failed", dbError, \{ query: "SELECT * FROM users" \})
32
+ */
33
+ error(...params: any): void;
34
+ /**
35
+ * Log warning messages with optional additional parameters
36
+ * @param message - Optional message
37
+ * @param optionalParams - Additional data to include in log entry
38
+ * @example context.logger.warn("Rate limit approaching", \{ currentRate: 95, limit: 100 \})
39
+ */
40
+ warn(...params: any): void;
41
+ /**
42
+ * Log informational messages with optional additional parameters
43
+ * @param message - Optional message
44
+ * @param optionalParams - Additional data to include in log entry
45
+ * @example context.logger.info("User action completed", \{ userId: "123", action: "login" \})
46
+ */
47
+ info(...params: any): void;
48
+ /**
49
+ * Log debug messages with optional additional parameters
50
+ * @param message - Optional message
51
+ * @param optionalParams - Additional data to include in log entry
52
+ * @example context.logger.debug("Processing step", \{ stepName: "validation", duration: 150 \})
53
+ */
54
+ debug(...params: any): void;
55
+ /**
56
+ * This function will be called by the language SDK before logging any records. The durableLoggingContext
57
+ * should be stored and used by custom loggers to enable logging of custom durable metadata
58
+ * such as operationId, attempt, executionArn, etc.
59
+ * @param durableLoggingContext - The logging context provided by the Durable Execution Language SDK
60
+ */
61
+ configureDurableLoggingContext?(durableLoggingContext: DurableLoggingContext): void;
62
+ }
63
+ /**
64
+ * The durable logger available inside a context.
65
+ *
66
+ * @public
67
+ */
68
+ export type DurableContextLogger<Logger extends DurableLogger> = Pick<Logger, "log" | "warn" | "info" | "error" | "debug">;
69
+ //# sourceMappingURL=durable-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-logger.d.ts","sourceRoot":"","sources":["../../src/types/durable-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,MAAM,cAAc,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,eAAe,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IAExD;;;;;OAKG;IACH,KAAK,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IACH,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IAE3B;;;;;OAKG;IACH,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IAE3B;;;;;OAKG;IACH,KAAK,CAAC,GAAG,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IAE5B;;;;;OAKG;IACH,8BAA8B,CAAC,CAC7B,qBAAqB,EAAE,qBAAqB,GAC3C,IAAI,CAAC;CACT;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,aAAa,IAAI,IAAI,CACnE,MAAM,EACN,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAC5C,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * A promise that defers execution until it's awaited or .then/.catch/.finally is called
3
+ *
4
+ * @public
5
+ */
6
+ export declare class DurablePromise<T> implements Promise<T> {
7
+ /**
8
+ * The actual promise instance, created only when execution begins.
9
+ * Starts as null and remains null until the DurablePromise is first awaited
10
+ * or chained (.then/.catch/.finally). Once created, it holds the running
11
+ * promise returned by the _executor function.
12
+ *
13
+ * Example lifecycle:
14
+ * ```typescript
15
+ * const dp = new DurablePromise(() => fetch('/api')); // _promise = null
16
+ * console.log(dp.isExecuted); // false
17
+ *
18
+ * const result = await dp; // NOW _promise = fetch('/api') promise
19
+ * console.log(dp.isExecuted); // true
20
+ * ```
21
+ *
22
+ * This lazy initialization prevents the executor from running until needed.
23
+ */
24
+ private _promise;
25
+ /**
26
+ * Function that contains the deferred execution logic.
27
+ * This function is NOT called when the DurablePromise is created - it's only
28
+ * executed when the promise is first awaited or chained (.then/.catch/.finally).
29
+ *
30
+ * Example:
31
+ * ```typescript
32
+ * const durablePromise = new DurablePromise(async () => {
33
+ * console.log("This runs ONLY when awaited, not when created");
34
+ * return await someAsyncOperation();
35
+ * });
36
+ *
37
+ * // At this point, nothing has executed yet
38
+ * console.log("Promise created but not executed");
39
+ *
40
+ * // NOW the executor function runs
41
+ * const result = await durablePromise;
42
+ * ```
43
+ */
44
+ private _executor;
45
+ /** Flag indicating whether the promise has been executed (awaited or chained) */
46
+ private _isExecuted;
47
+ /**
48
+ * Creates a new DurablePromise
49
+ * @param executor - Function containing the deferred execution logic
50
+ */
51
+ constructor(executor: () => Promise<T>);
52
+ /**
53
+ * Ensures the promise is executed, creating the actual promise if needed
54
+ * @returns The underlying promise instance
55
+ */
56
+ private ensureExecution;
57
+ /**
58
+ * Attaches callbacks for the resolution and/or rejection of the Promise
59
+ * Triggers execution if not already started
60
+ */
61
+ then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<TResult1 | TResult2>;
62
+ /**
63
+ * Attaches a callback for only the rejection of the Promise
64
+ * Triggers execution if not already started
65
+ */
66
+ catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
67
+ /**
68
+ * Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected)
69
+ * Triggers execution if not already started
70
+ */
71
+ finally(onfinally?: (() => void) | undefined | null): Promise<T>;
72
+ /** Returns the string tag for the promise type */
73
+ get [Symbol.toStringTag](): string;
74
+ /**
75
+ * Check if the promise has been executed (awaited or had .then/.catch/.finally called)
76
+ * @returns true if execution has started, false otherwise
77
+ */
78
+ get isExecuted(): boolean;
79
+ }
80
+ //# sourceMappingURL=durable-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"durable-promise.d.ts","sourceRoot":"","sources":["../../src/types/durable-promise.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,cAAc,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;IAClD;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,QAAQ,CAA2B;IAE3C;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,SAAS,CAAmB;IAEpC,iFAAiF;IACjF,OAAO,CAAC,WAAW,CAAS;IAE5B;;;OAGG;gBACS,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAItC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAUvB;;;OAGG;IACH,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EACjC,WAAW,CAAC,EACR,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAChD,SAAS,GACT,IAAI,EACR,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GACvD,SAAS,GACT,IAAI,GACP,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAI/B;;;OAGG;IACH,KAAK,CAAC,OAAO,GAAG,KAAK,EACnB,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACrD,SAAS,GACT,IAAI,GACP,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAIvB;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhE,kDAAkD;IAClD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;IAED;;;OAGG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;CACF"}
@@ -0,0 +1,15 @@
1
+ export * from "./core";
2
+ export * from "./logger";
3
+ export * from "./durable-logger";
4
+ export * from "./step";
5
+ export * from "./child-context";
6
+ export * from "./callback";
7
+ export * from "./invoke";
8
+ export * from "./wait-condition";
9
+ export * from "./batch";
10
+ export * from "./durable-context";
11
+ export * from "./durable-promise";
12
+ export * from "./durable-execution";
13
+ export * from "./operation-lifecycle-state";
14
+ export * from "./operation-lifecycle";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Serdes } from "../utils/serdes/serdes";
2
+ /**
3
+ * Configuration options for invoke operations
4
+ * @public
5
+ */
6
+ export interface InvokeConfig<I, O> {
7
+ /** Serialization/deserialization configuration for input payload */
8
+ payloadSerdes?: Serdes<I>;
9
+ /** Serialization/deserialization configuration for result data */
10
+ resultSerdes?: Serdes<O>;
11
+ }
12
+ //# sourceMappingURL=invoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/types/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC;IAChC,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CAC1B"}
@@ -0,0 +1,63 @@
1
+ import { DurableContextLogger, DurableLogger } from "./durable-logger";
2
+ /**
3
+ * Log data passed to the durable logger when `getDurableLogData` is called.
4
+ * @public
5
+ */
6
+ export interface DurableLogData {
7
+ requestId: string;
8
+ executionArn: string;
9
+ tenantId?: string;
10
+ operationId?: string;
11
+ attempt?: number;
12
+ [key: string]: unknown;
13
+ }
14
+ /**
15
+ * Log level supported by the durable logger
16
+ * @public
17
+ */
18
+ export declare enum DurableLogLevel {
19
+ INFO = "INFO",
20
+ WARN = "WARN",
21
+ ERROR = "ERROR",
22
+ DEBUG = "DEBUG"
23
+ }
24
+ /**
25
+ * Configuration options for logger behavior
26
+ * @public
27
+ */
28
+ export interface LoggerConfig<Logger extends DurableLogger> {
29
+ /**
30
+ * Custom logger implementation to use instead of the default console logger
31
+ * @defaultValue Default console logger
32
+ */
33
+ customLogger?: Logger;
34
+ /**
35
+ * Whether to enable mode-aware logging (suppress logs during replay)
36
+ * @defaultValue true
37
+ */
38
+ modeAware?: boolean;
39
+ }
40
+ /**
41
+ * Base interface for operation contexts.
42
+ * Do not use directly - use specific context types like StepContext, WaitForConditionContext, etc.
43
+ * @public
44
+ */
45
+ export interface OperationContext<Logger extends DurableLogger> {
46
+ logger: Logger;
47
+ }
48
+ /**
49
+ * Context for step operations.
50
+ * @public
51
+ */
52
+ export type StepContext<Logger extends DurableLogger> = OperationContext<DurableContextLogger<Logger>>;
53
+ /**
54
+ * Context for waitForCondition operations.
55
+ * @public
56
+ */
57
+ export type WaitForConditionContext<Logger extends DurableLogger> = OperationContext<DurableContextLogger<Logger>>;
58
+ /**
59
+ * Context for step operations.
60
+ * @public
61
+ */
62
+ export type WaitForCallbackContext<Logger extends DurableLogger> = OperationContext<DurableContextLogger<Logger>>;
63
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,oBAAY,eAAe;IACzB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,aAAa;IACxD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,aAAa;IAC5D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,aAAa,IAAI,gBAAgB,CACtE,oBAAoB,CAAC,MAAM,CAAC,CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,CAAC,MAAM,SAAS,aAAa,IAC9D,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,aAAa,IAC7D,gBAAgB,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Represents the lifecycle state of an operation in the durable execution system.
3
+ * This is distinct from AWS SDK's OperationStatus (PENDING, SUCCEEDED, FAILED).
4
+ */
5
+ export declare enum OperationLifecycleState {
6
+ /**
7
+ * Operation is currently executing user code (step function, waitForCondition check)
8
+ */
9
+ EXECUTING = "EXECUTING",
10
+ /**
11
+ * Operation is waiting for retry timer to expire before re-executing user code
12
+ */
13
+ RETRY_WAITING = "RETRY_WAITING",
14
+ /**
15
+ * Operation is waiting for external event (timer, callback, invoke) but not awaited yet (phase 1)
16
+ */
17
+ IDLE_NOT_AWAITED = "IDLE_NOT_AWAITED",
18
+ /**
19
+ * Operation is waiting for external event and has been awaited (phase 2)
20
+ */
21
+ IDLE_AWAITED = "IDLE_AWAITED",
22
+ /**
23
+ * Operation has completed (success or permanent failure)
24
+ */
25
+ COMPLETED = "COMPLETED"
26
+ }
27
+ //# sourceMappingURL=operation-lifecycle-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-lifecycle-state.d.ts","sourceRoot":"","sources":["../../src/types/operation-lifecycle-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,uBAAuB;IACjC;;OAEG;IACH,SAAS,cAAc;IAEvB;;OAEG;IACH,aAAa,kBAAkB;IAE/B;;OAEG;IACH,gBAAgB,qBAAqB;IAErC;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,SAAS,cAAc;CACxB"}
@@ -0,0 +1,27 @@
1
+ import { OperationType } from "@aws-sdk/client-lambda";
2
+ import { OperationSubType } from "./core";
3
+ import { OperationLifecycleState } from "./operation-lifecycle-state";
4
+ /**
5
+ * Metadata about an operation for lifecycle tracking
6
+ */
7
+ export interface OperationMetadata {
8
+ stepId: string;
9
+ name?: string;
10
+ type: OperationType;
11
+ subType: OperationSubType;
12
+ parentId?: string;
13
+ }
14
+ /**
15
+ * Complete information about an operation's lifecycle state
16
+ */
17
+ export interface OperationInfo {
18
+ stepId: string;
19
+ state: OperationLifecycleState;
20
+ metadata: OperationMetadata;
21
+ endTimestamp?: Date;
22
+ timer?: NodeJS.Timeout;
23
+ resolver?: () => void;
24
+ pollCount?: number;
25
+ pollStartTime?: number;
26
+ }
27
+ //# sourceMappingURL=operation-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-lifecycle.d.ts","sourceRoot":"","sources":["../../src/types/operation-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,uBAAuB,CAAC;IAC/B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,76 @@
1
+ import { Serdes } from "../utils/serdes/serdes";
2
+ import { StepContext } from "./logger";
3
+ import { DurableLogger, Duration } from "../types";
4
+ /**
5
+ * Decision returned by a retry strategy function
6
+ *
7
+ * @remarks
8
+ * Returned by retry strategy functions to indicate whether an operation should be retried
9
+ * and how long to wait before the next attempt.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Don't retry
14
+ * { shouldRetry: false }
15
+ *
16
+ * // Retry after 5 seconds
17
+ * { shouldRetry: true, delay: { seconds: 5 } }
18
+ *
19
+ * // Retry after 2 minutes
20
+ * { shouldRetry: true, delay: { minutes: 2 } }
21
+ * ```
22
+ *
23
+ * @see {@link createRetryStrategy} for creating retry strategies
24
+ *
25
+ * @public
26
+ */
27
+ export interface RetryDecision {
28
+ /** Whether the operation should be retried */
29
+ shouldRetry: boolean;
30
+ /**
31
+ * Delay before the next retry attempt
32
+ * @remarks Only used when `shouldRetry` is true. If not specified, defaults to 1 second.
33
+ */
34
+ delay?: Duration;
35
+ }
36
+ /**
37
+ * @public
38
+ */
39
+ export declare enum StepSemantics {
40
+ AtMostOncePerRetry = "AT_MOST_ONCE_PER_RETRY",
41
+ AtLeastOncePerRetry = "AT_LEAST_ONCE_PER_RETRY"
42
+ }
43
+ /**
44
+ * Jitter strategy for retry delays to prevent thundering herd. Jitter reduces simultaneous retry attempts
45
+ * by spreading retries out over a randomized delay interval.
46
+ *
47
+ * @public
48
+ */
49
+ export declare enum JitterStrategy {
50
+ /** No jitter - use exact calculated delay */
51
+ NONE = "NONE",
52
+ /** Full jitter - random delay between 0 and calculated delay */
53
+ FULL = "FULL",
54
+ /** Half jitter - random delay between 50% and 100% of calculated delay */
55
+ HALF = "HALF"
56
+ }
57
+ /**
58
+ * Configuration options for step operations
59
+ * @public
60
+ */
61
+ export interface StepConfig<T> {
62
+ /** Strategy for retrying failed step executions */
63
+ retryStrategy?: (error: Error, attemptCount: number) => RetryDecision;
64
+ /** Execution semantics for the step (at-most-once or at-least-once per retry) */
65
+ semantics?: StepSemantics;
66
+ /** Serialization/deserialization configuration for step data */
67
+ serdes?: Serdes<T>;
68
+ }
69
+ /**
70
+ * Function to be executed as a durable step
71
+ * @param context - Context for logging and other operations during step execution
72
+ * @returns Promise resolving to the step result
73
+ * @public
74
+ */
75
+ export type StepFunc<T, Logger extends DurableLogger = DurableLogger> = (context: StepContext<Logger>) => Promise<T>;
76
+ //# sourceMappingURL=step.d.ts.map
@@ -0,0 +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;;GAEG;AACH,oBAAY,aAAa;IACvB,kBAAkB,2BAA2B;IAC7C,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,46 @@
1
+ import { Serdes } from "../utils/serdes/serdes";
2
+ import { WaitForConditionContext } from "./logger";
3
+ import { DurableLogger, Duration } from "../types";
4
+ /**
5
+ * Function that checks and updates state for waitForCondition operations
6
+ * @param state - Current state value
7
+ * @param context - Context for logging and other operations during state checking
8
+ * @returns Promise resolving to the updated state
9
+ *
10
+ * @public
11
+ */
12
+ export type WaitForConditionCheckFunc<T, Logger extends DurableLogger = DurableLogger> = (state: T, context: WaitForConditionContext<Logger>) => Promise<T>;
13
+ /**
14
+ * Function that determines whether to continue waiting and how long to delay
15
+ * @param state - Current state value
16
+ * @param attempt - Current attempt number (starts at 1)
17
+ * @returns Decision object indicating whether to continue and delay duration
18
+ *
19
+ * @public
20
+ */
21
+ export type WaitForConditionWaitStrategyFunc<T> = (state: T, attempt: number) => WaitForConditionDecision;
22
+ /**
23
+ * Decision object for waitForCondition wait strategy
24
+ *
25
+ * @public
26
+ */
27
+ export type WaitForConditionDecision = {
28
+ shouldContinue: true;
29
+ delay: Duration;
30
+ } | {
31
+ shouldContinue: false;
32
+ };
33
+ /**
34
+ * Configuration options for waitForCondition operations
35
+ *
36
+ * @public
37
+ */
38
+ export interface WaitForConditionConfig<T> {
39
+ /** Strategy function that determines when to continue waiting and how long to delay */
40
+ waitStrategy: WaitForConditionWaitStrategyFunc<T>;
41
+ /** Initial state value to start the condition checking with */
42
+ initialState: T;
43
+ /** Serialization/deserialization configuration for state data */
44
+ serdes?: Serdes<T>;
45
+ }
46
+ //# sourceMappingURL=wait-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-condition.d.ts","sourceRoot":"","sources":["../../src/types/wait-condition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,yBAAyB,CACnC,CAAC,EACD,MAAM,SAAS,aAAa,GAAG,aAAa,IAC1C,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,MAAM,gCAAgC,CAAC,CAAC,IAAI,CAChD,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,MAAM,KACZ,wBAAwB,CAAC;AAE9B;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAChC;IAAE,cAAc,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GACzC;IAAE,cAAc,EAAE,KAAK,CAAA;CAAE,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,uFAAuF;IACvF,YAAY,EAAE,gCAAgC,CAAC,CAAC,CAAC,CAAC;IAClD,+DAA+D;IAC/D,YAAY,EAAE,CAAC,CAAC;IAChB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=checkpoint-ancestor.test.d.ts.map