@restatedev/restate-sdk 1.11.1 → 1.12.0

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 (128) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +9 -0
  2. package/dist/common_api.cjs +2 -1
  3. package/dist/common_api.d.cts +6 -2
  4. package/dist/common_api.d.cts.map +1 -1
  5. package/dist/common_api.d.ts +6 -2
  6. package/dist/common_api.d.ts.map +1 -1
  7. package/dist/common_api.js +2 -1
  8. package/dist/common_api.js.map +1 -1
  9. package/dist/context.cjs +13 -9
  10. package/dist/context.d.cts +36 -29
  11. package/dist/context.d.cts.map +1 -1
  12. package/dist/context.d.ts +36 -29
  13. package/dist/context.d.ts.map +1 -1
  14. package/dist/context.js +13 -9
  15. package/dist/context.js.map +1 -1
  16. package/dist/context_impl.cjs +150 -91
  17. package/dist/context_impl.d.cts +8 -0
  18. package/dist/context_impl.d.ts +8 -72
  19. package/dist/context_impl.d.ts.map +1 -1
  20. package/dist/context_impl.js +151 -93
  21. package/dist/context_impl.js.map +1 -1
  22. package/dist/endpoint/components.cjs +35 -20
  23. package/dist/endpoint/components.d.cts +5 -0
  24. package/dist/endpoint/components.d.ts +5 -97
  25. package/dist/endpoint/components.d.ts.map +1 -1
  26. package/dist/endpoint/components.js +35 -20
  27. package/dist/endpoint/components.js.map +1 -1
  28. package/dist/endpoint/endpoint.cjs +2 -2
  29. package/dist/endpoint/endpoint.d.cts +5 -0
  30. package/dist/endpoint/endpoint.d.ts +5 -39
  31. package/dist/endpoint/endpoint.js +2 -2
  32. package/dist/endpoint/endpoint.js.map +1 -1
  33. package/dist/endpoint/handlers/generic.cjs +115 -39
  34. package/dist/endpoint/handlers/generic.d.ts.map +1 -1
  35. package/dist/endpoint/handlers/generic.js +115 -39
  36. package/dist/endpoint/handlers/generic.js.map +1 -1
  37. package/dist/endpoint/handlers/types.d.cts +1 -0
  38. package/dist/endpoint/handlers/types.d.ts +1 -41
  39. package/dist/endpoint/handlers/utils.cjs +1 -1
  40. package/dist/endpoint/handlers/utils.js +1 -1
  41. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.cjs +43 -3
  42. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.d.ts +19 -1
  43. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.d.ts.map +1 -1
  44. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.js +43 -3
  45. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.js.map +1 -1
  46. package/dist/endpoint/node_endpoint.cjs +28 -12
  47. package/dist/endpoint/node_endpoint.d.ts +14 -2
  48. package/dist/endpoint/node_endpoint.d.ts.map +1 -1
  49. package/dist/endpoint/node_endpoint.js +27 -11
  50. package/dist/endpoint/node_endpoint.js.map +1 -1
  51. package/dist/endpoint/types.d.cts +1 -1
  52. package/dist/endpoint/types.d.ts +1 -1
  53. package/dist/endpoint.d.cts +87 -5
  54. package/dist/endpoint.d.cts.map +1 -1
  55. package/dist/endpoint.d.ts +87 -5
  56. package/dist/endpoint.d.ts.map +1 -1
  57. package/dist/error_sanitization.cjs +26 -0
  58. package/dist/error_sanitization.d.ts +13 -0
  59. package/dist/error_sanitization.d.ts.map +1 -0
  60. package/dist/error_sanitization.js +26 -0
  61. package/dist/error_sanitization.js.map +1 -0
  62. package/dist/fetch.cjs +3 -1
  63. package/dist/fetch.d.cts +5 -3
  64. package/dist/fetch.d.cts.map +1 -1
  65. package/dist/fetch.d.ts +5 -3
  66. package/dist/fetch.d.ts.map +1 -1
  67. package/dist/fetch.js +3 -2
  68. package/dist/fetch.js.map +1 -1
  69. package/dist/hooks.d.cts +87 -0
  70. package/dist/hooks.d.cts.map +1 -0
  71. package/dist/hooks.d.ts +87 -0
  72. package/dist/hooks.d.ts.map +1 -0
  73. package/dist/hooks.js +2 -0
  74. package/dist/hooks.js.map +1 -0
  75. package/dist/index.cjs +3 -1
  76. package/dist/index.d.cts +6 -4
  77. package/dist/index.d.ts +6 -4
  78. package/dist/index.js +3 -2
  79. package/dist/internal.cjs +3 -1
  80. package/dist/internal.d.cts +186 -2
  81. package/dist/internal.d.cts.map +1 -1
  82. package/dist/internal.d.ts +186 -2
  83. package/dist/internal.d.ts.map +1 -1
  84. package/dist/internal.js +4 -1
  85. package/dist/internal.js.map +1 -1
  86. package/dist/io.d.cts +1 -0
  87. package/dist/io.d.ts +1 -24
  88. package/dist/lambda.cjs +3 -1
  89. package/dist/lambda.d.cts +5 -3
  90. package/dist/lambda.d.cts.map +1 -1
  91. package/dist/lambda.d.ts +5 -3
  92. package/dist/lambda.d.ts.map +1 -1
  93. package/dist/lambda.js +3 -2
  94. package/dist/lambda.js.map +1 -1
  95. package/dist/logging/logger.d.cts +1 -0
  96. package/dist/logging/logger.d.ts +1 -10
  97. package/dist/node.cjs +23 -6
  98. package/dist/node.d.cts +46 -8
  99. package/dist/node.d.cts.map +1 -1
  100. package/dist/node.d.ts +46 -8
  101. package/dist/node.d.ts.map +1 -1
  102. package/dist/node.js +23 -7
  103. package/dist/node.js.map +1 -1
  104. package/dist/package.cjs +1 -1
  105. package/dist/package.js +1 -1
  106. package/dist/package.js.map +1 -1
  107. package/dist/promises.cjs +90 -53
  108. package/dist/promises.d.cts +18 -0
  109. package/dist/promises.d.cts.map +1 -0
  110. package/dist/promises.d.ts +15 -108
  111. package/dist/promises.d.ts.map +1 -1
  112. package/dist/promises.js +85 -48
  113. package/dist/promises.js.map +1 -1
  114. package/dist/types/errors.cjs +13 -0
  115. package/dist/types/errors.d.cts +11 -5
  116. package/dist/types/errors.d.cts.map +1 -1
  117. package/dist/types/errors.d.ts +11 -5
  118. package/dist/types/errors.d.ts.map +1 -1
  119. package/dist/types/errors.js +13 -1
  120. package/dist/types/errors.js.map +1 -1
  121. package/dist/types/rpc.cjs +7 -19
  122. package/dist/types/rpc.d.cts +174 -0
  123. package/dist/types/rpc.d.cts.map +1 -1
  124. package/dist/types/rpc.d.ts +174 -0
  125. package/dist/types/rpc.d.ts.map +1 -1
  126. package/dist/types/rpc.js +7 -19
  127. package/dist/types/rpc.js.map +1 -1
  128. package/package.json +2 -2
@@ -5,6 +5,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (all) => {
9
+ let target = {};
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ return target;
15
+ };
8
16
  var __copyProps = (to, from, except, desc) => {
9
17
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
18
  key = keys[i];
@@ -22,4 +30,5 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
30
 
23
31
  //#endregion
24
32
 
33
+ exports.__export = __export;
25
34
  exports.__toESM = __toESM;
@@ -1,7 +1,8 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_errors = require('./types/errors.cjs');
3
- const require_rpc = require('./types/rpc.cjs');
3
+ const require_promises = require('./promises.cjs');
4
4
  const require_context = require('./context.cjs');
5
+ const require_rpc = require('./types/rpc.cjs');
5
6
  const require_internal = require('./internal.cjs');
6
7
  let __restatedev_restate_sdk_core = require("@restatedev/restate-sdk-core");
7
8
  __restatedev_restate_sdk_core = require_rolldown_runtime.__toESM(__restatedev_restate_sdk_core);
@@ -1,10 +1,12 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
2
+ import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
2
3
  import { Client, ClientCallOptions, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.cjs";
3
- import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SendOptions, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
5
+ import { internal_d_exports } from "./internal.cjs";
4
6
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.cjs";
5
7
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.cjs";
8
+ import { isRestatePromise } from "./promises.cjs";
6
9
  import { EndpointOptions } from "./endpoint/types.cjs";
7
- import { internal_d_exports } from "./internal.cjs";
8
10
  import { Duration as Duration$1, JournalValueCodec as JournalValueCodec$1, ObjectHandler as ObjectHandler$1, RestateContext as RestateContext$1, RestateObjectContext as RestateObjectContext$1, RestateObjectSharedContext as RestateObjectSharedContext$1, RestateWorkflowContext as RestateWorkflowContext$1, RestateWorkflowSharedContext as RestateWorkflowSharedContext$1, Serde as Serde$1, Service as Service$1, ServiceDefinition as ServiceDefinition$1, ServiceDefinitionFrom as ServiceDefinitionFrom$1, ServiceHandler as ServiceHandler$1, VirtualObject as VirtualObject$1, VirtualObjectDefinition as VirtualObjectDefinition$1, VirtualObjectDefinitionFrom as VirtualObjectDefinitionFrom$1, Workflow as Workflow$1, WorkflowDefinition as WorkflowDefinition$1, WorkflowDefinitionFrom as WorkflowDefinitionFrom$1, WorkflowHandler as WorkflowHandler$1, WorkflowSharedHandler as WorkflowSharedHandler$1, serde } from "@restatedev/restate-sdk-core";
9
11
 
10
12
  //#region src/common_api.d.ts
@@ -12,6 +14,8 @@ import { Duration as Duration$1, JournalValueCodec as JournalValueCodec$1, Objec
12
14
  * @deprecated Use {@link RestatePromise}
13
15
  */
14
16
  declare const CombineablePromise: {
17
+ resolve<T>(value: T): RestatePromise<Awaited<T>>;
18
+ reject<T = never>(reason: TerminalError): RestatePromise<T>;
15
19
  all<const T extends readonly RestatePromise<unknown>[]>(values: T): RestatePromise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
16
20
  race<const T extends readonly RestatePromise<unknown>[]>(values: T): RestatePromise<Awaited<T[number]>>;
17
21
  any<const T extends readonly RestatePromise<unknown>[]>(values: T): RestatePromise<Awaited<T[number]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"common_api.d.cts","names":[],"sources":["../src/common_api.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;cAwCa;6GAsGosrB,IAAA,QAAA,EAAA;;;EAtGpsrB,UAAA,CAAA,gBAAmC,uBAAA,CAAA,OAAA,CAAA,EAAA,CAAA,CAAA,MAAA,GAAA,CAAA,gBAAA,CAAA,kBAAA,MAsGq3vB,CAtGr3vB,GAsGq3vB,oBAtGr3vB,CAsGq3vB,OAtGr3vB,CAsGq3vB,CAtGr3vB,CAsGq3vB,CAtGr3vB,CAAA,CAAA,CAAA,EAAA,CAAA;;;;;AAsGiqrB,KAjGrsrB,kBAiGqsrB,CAAA,CAAA,CAAA,GAjG7qrB,cAiG6qrB,CAjG9prB,CAiG8prB,CAAA;AAAotE,cARx5vB,oBAQw5vB,EAAA,OARp4vB,QAAA,CAAA,OAQo4vB;AAAA,cAPx5vB,mBAOw5vB,EAAA,OAPr4vB,QAAA,CAAA,MAAA,CAAA,SAOq4vB;AAAA,cANx5vB,yBAMw5vB,EAAA,OAN/3vB,QAAA,CAAA,MAAA,CAAA,MAM+3vB;AAAA,cALx5vB,qBAKw5vB,EAAA,OALn4vB,QAAA,CAAA,QAAA,CAAA,QAKm4vB;cAJx5vB,oCAA2B,QAAA,CAAA,QAAA,CAAA"}
1
+ {"version":3,"file":"common_api.d.cts","names":[],"sources":["../src/common_api.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;cAyCa;;;6GAuG08sB,IAAA,QAAA,EAAA;;EAvG18sB,GAAA,CAAA,gBAAA,uBAAmC,CAAA,OAAA,CAAA,EAAA,CAAA,CAAA,MAAA,GAAA,CAAA,gBAAA,QAAA,EAAA,CAAA,MAAA,CAAA,CAAA,CAAA;oHAuG40wB,IAAA,qBAAA,QAAA,EAAA;;;;;KAlGh3wB,wBAAwB,eAAe;cA0FtC,6BAAoB,QAAA,CAAA;cACpB,4BAAmB,QAAA,CAAA,MAAA,CAAA;cACnB,kCAAyB,QAAA,CAAA,MAAA,CAAA;cACzB,8BAAqB,QAAA,CAAA,QAAA,CAAA;AAK01wB,cAJ/2wB,2BAI+2wB,EAAA,OAJp1wB,QAAA,CAAA,QAAA,CAAA,MAIo1wB"}
@@ -1,10 +1,12 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
2
+ import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
2
3
  import { Client, ClientCallOptions, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
3
- import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SendOptions, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
5
+ import { internal_d_exports } from "./internal.js";
4
6
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.js";
5
7
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.js";
8
+ import { isRestatePromise } from "./promises.js";
6
9
  import { EndpointOptions } from "./endpoint/types.js";
7
- import { internal_d_exports } from "./internal.js";
8
10
  import { Duration as Duration$1, JournalValueCodec as JournalValueCodec$1, ObjectHandler as ObjectHandler$1, RestateContext as RestateContext$1, RestateObjectContext as RestateObjectContext$1, RestateObjectSharedContext as RestateObjectSharedContext$1, RestateWorkflowContext as RestateWorkflowContext$1, RestateWorkflowSharedContext as RestateWorkflowSharedContext$1, Serde as Serde$1, Service as Service$1, ServiceDefinition as ServiceDefinition$1, ServiceDefinitionFrom as ServiceDefinitionFrom$1, ServiceHandler as ServiceHandler$1, VirtualObject as VirtualObject$1, VirtualObjectDefinition as VirtualObjectDefinition$1, VirtualObjectDefinitionFrom as VirtualObjectDefinitionFrom$1, Workflow as Workflow$1, WorkflowDefinition as WorkflowDefinition$1, WorkflowDefinitionFrom as WorkflowDefinitionFrom$1, WorkflowHandler as WorkflowHandler$1, WorkflowSharedHandler as WorkflowSharedHandler$1, serde as serde$1 } from "@restatedev/restate-sdk-core";
9
11
 
10
12
  //#region src/common_api.d.ts
@@ -12,6 +14,8 @@ import { Duration as Duration$1, JournalValueCodec as JournalValueCodec$1, Objec
12
14
  * @deprecated Use {@link RestatePromise}
13
15
  */
14
16
  declare const CombineablePromise: {
17
+ resolve<T>(value: T): RestatePromise<Awaited<T>>;
18
+ reject<T = never>(reason: TerminalError): RestatePromise<T>;
15
19
  all<const T extends readonly RestatePromise<unknown>[]>(values: T): RestatePromise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
16
20
  race<const T extends readonly RestatePromise<unknown>[]>(values: T): RestatePromise<Awaited<T[number]>>;
17
21
  any<const T extends readonly RestatePromise<unknown>[]>(values: T): RestatePromise<Awaited<T[number]>>;
@@ -1 +1 @@
1
- {"version":3,"file":"common_api.d.ts","names":[],"sources":["../src/common_api.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;cAwCa;6GAsGosrB,IAAA,QAAA,EAAA;;;EAtGpsrB,UAAA,CAAA,gBAAmC,uBAAA,CAAA,OAAA,CAAA,EAAA,CAAA,CAAA,MAAA,GAAA,CAAA,gBAAA,CAAA,kBAAA,MAsGq3vB,CAtGr3vB,GAsGq3vB,oBAtGr3vB,CAsGq3vB,OAtGr3vB,CAsGq3vB,CAtGr3vB,CAsGq3vB,CAtGr3vB,CAAA,CAAA,CAAA,EAAA,CAAA;;;;;AAsGiqrB,KAjGrsrB,kBAiGqsrB,CAAA,CAAA,CAAA,GAjG7qrB,cAiG6qrB,CAjG9prB,CAiG8prB,CAAA;AAAotE,cARx5vB,oBAQw5vB,EAAA,OARp4vB,QAAA,CAAA,OAQo4vB;AAAA,cAPx5vB,mBAOw5vB,EAAA,OAPr4vB,QAAA,CAAA,MAAA,CAAA,SAOq4vB;AAAA,cANx5vB,yBAMw5vB,EAAA,OAN/3vB,QAAA,CAAA,MAAA,CAAA,MAM+3vB;AAAA,cALx5vB,qBAKw5vB,EAAA,OALn4vB,QAAA,CAAA,QAAA,CAAA,QAKm4vB;cAJx5vB,oCAA2B,QAAA,CAAA,QAAA,CAAA"}
1
+ {"version":3,"file":"common_api.d.ts","names":[],"sources":["../src/common_api.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;cAyCa;;;6GAuG08sB,IAAA,QAAA,EAAA;;EAvG18sB,GAAA,CAAA,gBAAA,uBAAmC,CAAA,OAAA,CAAA,EAAA,CAAA,CAAA,MAAA,GAAA,CAAA,gBAAA,QAAA,EAAA,CAAA,MAAA,CAAA,CAAA,CAAA;oHAuG40wB,IAAA,qBAAA,QAAA,EAAA;;;;;KAlGh3wB,wBAAwB,eAAe;cA0FtC,6BAAoB,QAAA,CAAA;cACpB,4BAAmB,QAAA,CAAA,MAAA,CAAA;cACnB,kCAAyB,QAAA,CAAA,MAAA,CAAA;cACzB,8BAAqB,QAAA,CAAA,QAAA,CAAA;AAK01wB,cAJ/2wB,2BAI+2wB,EAAA,OAJp1wB,QAAA,CAAA,QAAA,CAAA,MAIo1wB"}
@@ -1,6 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, TerminalError, TimeoutError } from "./types/errors.js";
2
- import { Opts, SendOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
2
+ import { isRestatePromise } from "./promises.js";
3
3
  import { InvocationIdParser, RestatePromise } from "./context.js";
4
+ import { Opts, SendOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
4
5
  import { internal_exports } from "./internal.js";
5
6
  import { serde as serde$1 } from "@restatedev/restate-sdk-core";
6
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"common_api.js","names":[],"sources":["../src/common_api.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\nimport { RestatePromise } from \"./context.js\";\n\nexport type {\n Context,\n ObjectContext,\n ObjectSharedContext,\n WorkflowContext,\n WorkflowSharedContext,\n Rand,\n GenericCall,\n GenericSend,\n InvocationId,\n InvocationHandle,\n InvocationPromise,\n TypedState,\n UntypedState,\n ContextDate,\n RunAction,\n RunOptions,\n SendOptions,\n KeyValueStore,\n DurablePromise,\n Request,\n} from \"./context.js\";\nexport { InvocationIdParser, RestatePromise } from \"./context.js\";\n\n/**\n * @deprecated Use {@link RestatePromise}\n */\nexport const CombineablePromise = RestatePromise;\n\n/**\n * @deprecated Use {@link RestatePromise}\n */\nexport type CombineablePromise<T> = RestatePromise<T>;\n\nexport type {\n Serde,\n RestateContext,\n ServiceDefinitionFrom,\n Service,\n VirtualObjectDefinitionFrom,\n VirtualObject,\n WorkflowDefinitionFrom,\n Workflow,\n RestateObjectContext,\n RestateObjectSharedContext,\n RestateWorkflowSharedContext,\n RestateWorkflowContext,\n ServiceHandler,\n ObjectHandler,\n WorkflowHandler,\n WorkflowSharedHandler,\n Duration,\n JournalValueCodec,\n} from \"@restatedev/restate-sdk-core\";\nexport { serde } from \"@restatedev/restate-sdk-core\";\n\nexport type {\n Client,\n SendClient,\n ClientCallOptions,\n ClientSendOptions,\n RemoveVoidArgument,\n InferArg,\n ServiceHandlerOpts,\n WorkflowHandlerOpts,\n ObjectHandlerOpts,\n ServiceOpts,\n ObjectOpts,\n WorkflowOpts,\n ServiceOptions,\n ObjectOptions,\n WorkflowOptions,\n RetryPolicy,\n} from \"./types/rpc.js\";\nexport {\n service,\n object,\n workflow,\n handlers,\n Opts,\n SendOpts,\n} from \"./types/rpc.js\";\n\nexport { rpc } from \"./types/rpc.js\";\n\nexport type {\n ServiceDefinition,\n VirtualObjectDefinition,\n WorkflowDefinition,\n} from \"@restatedev/restate-sdk-core\";\n\nexport type {\n RestateEndpoint,\n RestateEndpointBase,\n DefaultServiceOptions,\n} from \"./endpoint.js\";\n\nexport {\n /**\n * @deprecated YOU MUST NOT USE THIS TYPE\n */\n RestateError,\n TerminalError,\n TimeoutError,\n RetryableError,\n CancelledError,\n type RetryableErrorOptions,\n} from \"./types/errors.js\";\nexport type {\n LoggerTransport,\n LogMetadata,\n RestateLogLevel,\n LoggerContext,\n LogSource,\n} from \"./logging/logger_transport.js\";\nexport type { EndpointOptions } from \"./endpoint/types.js\";\n\n// re-exporting createHandler shortcuts\n\nimport { handlers } from \"./types/rpc.js\";\n\nexport const createServiceHandler = handlers.handler;\nexport const createObjectHandler = handlers.object.exclusive;\nexport const createObjectSharedHandler = handlers.object.shared;\nexport const createWorkflowHandler = handlers.workflow.workflow;\nexport const createWorkflowSharedHandler = handlers.workflow.shared;\n\n// Internal APIs\nexport * as internal from \"./internal.js\";\n"],"mappings":";;;;;;;;;;AAwCA,MAAa,qBAAqB;AA8FlC,MAAa,uBAAuB,SAAS;AAC7C,MAAa,sBAAsB,SAAS,OAAO;AACnD,MAAa,4BAA4B,SAAS,OAAO;AACzD,MAAa,wBAAwB,SAAS,SAAS;AACvD,MAAa,8BAA8B,SAAS,SAAS"}
1
+ {"version":3,"file":"common_api.js","names":[],"sources":["../src/common_api.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\nimport { RestatePromise } from \"./context.js\";\n\nexport type {\n Context,\n ObjectContext,\n ObjectSharedContext,\n WorkflowContext,\n WorkflowSharedContext,\n Rand,\n GenericCall,\n GenericSend,\n InvocationId,\n InvocationHandle,\n InvocationPromise,\n TypedState,\n UntypedState,\n ContextDate,\n RunAction,\n RunOptions,\n KeyValueStore,\n DurablePromise,\n Request,\n Target,\n} from \"./context.js\";\nexport { InvocationIdParser, RestatePromise } from \"./context.js\";\nexport { isRestatePromise } from \"./promises.js\";\n\n/**\n * @deprecated Use {@link RestatePromise}\n */\nexport const CombineablePromise = RestatePromise;\n\n/**\n * @deprecated Use {@link RestatePromise}\n */\nexport type CombineablePromise<T> = RestatePromise<T>;\n\nexport type {\n Serde,\n RestateContext,\n ServiceDefinitionFrom,\n Service,\n VirtualObjectDefinitionFrom,\n VirtualObject,\n WorkflowDefinitionFrom,\n Workflow,\n RestateObjectContext,\n RestateObjectSharedContext,\n RestateWorkflowSharedContext,\n RestateWorkflowContext,\n ServiceHandler,\n ObjectHandler,\n WorkflowHandler,\n WorkflowSharedHandler,\n Duration,\n JournalValueCodec,\n} from \"@restatedev/restate-sdk-core\";\nexport { serde } from \"@restatedev/restate-sdk-core\";\n\nexport type {\n Client,\n SendClient,\n ClientCallOptions,\n ClientSendOptions,\n RemoveVoidArgument,\n InferArg,\n ServiceHandlerOpts,\n WorkflowHandlerOpts,\n ObjectHandlerOpts,\n ServiceOpts,\n ObjectOpts,\n WorkflowOpts,\n ServiceOptions,\n ObjectOptions,\n WorkflowOptions,\n RetryPolicy,\n} from \"./types/rpc.js\";\nexport {\n service,\n object,\n workflow,\n handlers,\n Opts,\n SendOpts,\n} from \"./types/rpc.js\";\n\nexport { rpc } from \"./types/rpc.js\";\n\nexport type {\n ServiceDefinition,\n VirtualObjectDefinition,\n WorkflowDefinition,\n} from \"@restatedev/restate-sdk-core\";\n\nexport type {\n RestateEndpoint,\n RestateEndpointBase,\n DefaultServiceOptions,\n} from \"./endpoint.js\";\n\nexport {\n /**\n * @deprecated YOU MUST NOT USE THIS TYPE\n */\n RestateError,\n TerminalError,\n TimeoutError,\n RetryableError,\n CancelledError,\n type RetryableErrorOptions,\n} from \"./types/errors.js\";\nexport type {\n LoggerTransport,\n LogMetadata,\n RestateLogLevel,\n LoggerContext,\n LogSource,\n} from \"./logging/logger_transport.js\";\nexport type { EndpointOptions } from \"./endpoint/types.js\";\nexport type { Hooks, HooksProvider, Interceptor } from \"./hooks.js\";\n\n// re-exporting createHandler shortcuts\n\nimport { handlers } from \"./types/rpc.js\";\n\nexport const createServiceHandler = handlers.handler;\nexport const createObjectHandler = handlers.object.exclusive;\nexport const createObjectSharedHandler = handlers.object.shared;\nexport const createWorkflowHandler = handlers.workflow.workflow;\nexport const createWorkflowSharedHandler = handlers.workflow.shared;\n\n// Internal APIs\nexport * as internal from \"./internal.js\";\n"],"mappings":";;;;;;;;;;;AAyCA,MAAa,qBAAqB;AA+FlC,MAAa,uBAAuB,SAAS;AAC7C,MAAa,sBAAsB,SAAS,OAAO;AACnD,MAAa,4BAA4B,SAAS,OAAO;AACzD,MAAa,wBAAwB,SAAS,SAAS;AACvD,MAAa,8BAA8B,SAAS,SAAS"}
package/dist/context.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_context_impl = require('./context_impl.cjs');
1
+ const require_promises = require('./promises.cjs');
2
2
 
3
3
  //#region src/context.ts
4
4
  const InvocationIdParser = { fromString(id) {
@@ -6,21 +6,25 @@ const InvocationIdParser = { fromString(id) {
6
6
  return id;
7
7
  } };
8
8
  const RestatePromise = {
9
+ resolve(value) {
10
+ if (value instanceof require_promises.InternalRestatePromise) return value;
11
+ return require_promises.ConstRestatePromise.resolve(value);
12
+ },
13
+ reject(reason) {
14
+ return require_promises.ConstRestatePromise.reject(reason);
15
+ },
9
16
  all(values) {
10
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
11
- return require_context_impl.ContextImpl.createCombinator((p) => Promise.all(p), values);
17
+ return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.all(p), values);
12
18
  },
13
19
  race(values) {
14
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
15
- return require_context_impl.ContextImpl.createCombinator((p) => Promise.race(p), values);
20
+ if (values.length === 0) return require_promises.ConstRestatePromise.pending();
21
+ return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.race(p), values);
16
22
  },
17
23
  any(values) {
18
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
19
- return require_context_impl.ContextImpl.createCombinator((p) => Promise.any(p), values);
24
+ return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.any(p), values);
20
25
  },
21
26
  allSettled(values) {
22
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
23
- return require_context_impl.ContextImpl.createCombinator((p) => Promise.allSettled(p), values);
27
+ return require_promises.CombinatorRestatePromise.fromPromises((p) => Promise.allSettled(p), values);
24
28
  }
25
29
  };
26
30
 
@@ -3,7 +3,12 @@ import { Client, SendClient } from "./types/rpc.cjs";
3
3
  import { Duration, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinitionFrom, VirtualObject, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinitionFrom } from "@restatedev/restate-sdk-core";
4
4
 
5
5
  //#region src/context.d.ts
6
-
6
+ interface Target {
7
+ service: string;
8
+ handler: string;
9
+ key?: string;
10
+ toString(): string;
11
+ }
7
12
  /**
8
13
  * Represents the original request as sent to this handler.
9
14
  *
@@ -11,11 +16,12 @@ import { Duration, RestateContext, RestateObjectContext, RestateObjectSharedCont
11
16
  * request body.
12
17
  */
13
18
  interface Request {
19
+ readonly target: Target;
14
20
  /**
15
21
  * The unique id that identifies the current function invocation. This id is guaranteed to be
16
22
  * unique across invocations, but constant across reties and suspensions.
17
23
  */
18
- readonly id: string;
24
+ readonly id: InvocationId;
19
25
  /**
20
26
  * Request headers - the following headers capture the original invocation headers, as provided to
21
27
  * the ingress.
@@ -97,15 +103,6 @@ interface KeyValueStore<TState extends TypedState> {
97
103
  */
98
104
  clearAll(): void;
99
105
  }
100
- /**
101
- * @deprecated SendOptions on the client factory are deprecated, please use `restate.rpc.sendOpts` instead
102
- */
103
- interface SendOptions {
104
- /**
105
- * @deprecated SendOptions on the client factory are deprecated, please use `restate.rpc.sendOpts` instead
106
- */
107
- delay?: number;
108
- }
109
106
  interface ContextDate {
110
107
  /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
111
108
  * This is equivalent to Date.now()
@@ -128,10 +125,6 @@ type RunOptions<T> = {
128
125
  * When giving up, `ctx.run` will throw a `TerminalError` wrapping the original error message.
129
126
  */
130
127
  maxRetryAttempts?: number;
131
- /**
132
- * @deprecated Use `maxRetryDuration` instead.
133
- */
134
- maxRetryDurationMillis?: number;
135
128
  /**
136
129
  * Max duration of retries, before giving up.
137
130
  *
@@ -140,10 +133,6 @@ type RunOptions<T> = {
140
133
  * If a number is provided, it will be interpreted as milliseconds.
141
134
  */
142
135
  maxRetryDuration?: Duration | number;
143
- /**
144
- * @deprecated Use `initialRetryInterval` instead.
145
- */
146
- initialRetryIntervalMillis?: number;
147
136
  /**
148
137
  * Initial interval for the first retry attempt.
149
138
  * Retry interval will grow by a factor specified in `retryIntervalFactor`.
@@ -153,10 +142,6 @@ type RunOptions<T> = {
153
142
  * If a number is provided, it will be interpreted as milliseconds.
154
143
  */
155
144
  initialRetryInterval?: Duration | number;
156
- /**
157
- * @deprecated Use `maxRetryInterval` instead.
158
- */
159
- maxRetryIntervalMillis?: number;
160
145
  /**
161
146
  * Max interval between retries.
162
147
  * Retry interval will grow by a factor specified in `retryIntervalFactor`.
@@ -355,13 +340,13 @@ interface Context extends RestateContext {
355
340
  * Reject an awakeable. When rejecting, the service waiting on this awakeable will be woken up with a terminal error with the provided reason.
356
341
  * @param id the string ID of the awakeable.
357
342
  * This is supplied by the service that needs to be woken up.
358
- * @param reason the reason of the rejection.
343
+ * @param reason the reason of the rejection, either a string message or a {@link TerminalError}.
359
344
  *
360
345
  * @example
361
346
  * // The sleeping service should have sent the awakeableIdentifier string to this service.
362
347
  * ctx.rejectAwakeable(awakeableIdentifier, "super bad error");
363
348
  */
364
- rejectAwakeable(id: string, reason: string): void;
349
+ rejectAwakeable(id: string, reason: string | TerminalError): void;
365
350
  /**
366
351
  * Sleep until a timeout has passed.
367
352
  * @param duration either Duration type or milliseconds.
@@ -474,7 +459,7 @@ interface Context extends RestateContext {
474
459
  * ctx.serviceSendClient(MyService).anotherAction(1337);
475
460
  * ```
476
461
  */
477
- serviceSendClient<D>(service: ServiceDefinitionFrom<D>, opts?: SendOptions): SendClient<Service<D>>;
462
+ serviceSendClient<D>(service: ServiceDefinitionFrom<D>): SendClient<Service<D>>;
478
463
  /**
479
464
  * Same as {@link serviceSendClient} but for virtual objects.
480
465
  *
@@ -482,7 +467,7 @@ interface Context extends RestateContext {
482
467
  * @param key the virtual object key
483
468
  * @param opts Send options
484
469
  */
485
- objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string, opts?: SendOptions): SendClient<VirtualObject<D>>;
470
+ objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string): SendClient<VirtualObject<D>>;
486
471
  genericCall<REQ = Uint8Array, RES = Uint8Array>(call: GenericCall<REQ, RES>): InvocationPromise<RES>;
487
472
  genericSend<REQ = Uint8Array>(call: GenericSend<REQ>): InvocationHandle;
488
473
  /**
@@ -563,6 +548,8 @@ interface Rand {
563
548
  }
564
549
  /**
565
550
  * A promise that can be combined using Promise combinators in RestateContext.
551
+ *
552
+ * To check at runtime whether a value is a {@link RestatePromise}, use {@link isRestatePromise}.
566
553
  */
567
554
  type RestatePromise<T> = Promise<T> & {
568
555
  /**
@@ -582,6 +569,9 @@ type RestatePromise<T> = Promise<T> & {
582
569
  * {@link Promise.then} is used by Restate to distinguish when awaiting an asynchronous operation,
583
570
  * thus calling `.then` on several Restate promises can lead to concurrency issues.
584
571
  *
572
+ * **NOTE**: Contrary to `.then`, the closure is executed ONLY when the promise is awaited,
573
+ * and not eagerly as soon as the promise completes.
574
+ *
585
575
  * @param mapper the function to execute when this promise is fulfilled.
586
576
  * If the promise completed successfully, `value` is provided as input, otherwise `failure` is provided as input.
587
577
  * If this mapper returns a value, this value will be used to resolve the returned {@link RestatePromise}.
@@ -608,6 +598,23 @@ type InvocationHandle = {
608
598
  };
609
599
  type InvocationPromise<T> = RestatePromise<T> & InvocationHandle;
610
600
  declare const RestatePromise: {
601
+ /**
602
+ * Creates a {@link RestatePromise} that is resolved with the given value.
603
+ *
604
+ * If the value is already a {@link RestatePromise}, it is returned as-is (mirroring
605
+ * the behavior of {@link Promise.resolve} when given a native {@link Promise}).
606
+ *
607
+ * @param value The value to resolve, or an existing {@link RestatePromise} to return.
608
+ * @returns A resolved {@link RestatePromise}, or the input promise unchanged.
609
+ */
610
+ resolve<T>(value: T): RestatePromise<Awaited<T>>;
611
+ /**
612
+ * Creates a {@link RestatePromise} that is rejected with the given {@link TerminalError}.
613
+ *
614
+ * @param reason The {@link TerminalError} to reject with.
615
+ * @returns A rejected {@link RestatePromise}.
616
+ */
617
+ reject<T = never>(reason: TerminalError): RestatePromise<T>;
611
618
  /**
612
619
  * Creates a Promise that is resolved with an array of results when all of the provided Promises
613
620
  * resolve, or rejected when any Promise is rejected.
@@ -653,7 +660,7 @@ declare const RestatePromise: {
653
660
  /**
654
661
  * Workflow bound durable promise
655
662
  *
656
- * See {@link WorkflowSharedContext} promise..
663
+ * See {@link WorkflowSharedContext}.
657
664
  */
658
665
  type DurablePromise<T> = Promise<T> & {
659
666
  /**
@@ -703,5 +710,5 @@ interface WorkflowSharedContext<TState extends TypedState = UntypedState> extend
703
710
  }
704
711
  interface WorkflowContext<TState extends TypedState = UntypedState> extends WorkflowSharedContext<TState>, ObjectContext<TState>, RestateWorkflowContext {}
705
712
  //#endregion
706
- export { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SendOptions, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext };
713
+ export { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext };
707
714
  //# sourceMappingURL=context.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.cts","names":[],"sources":["../src/context.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoCA;;;;AAyCmC,UAzClB,OAAA,CAyCkB;EAAW;AAI9C;AACA;AAKA;EAA8C,SAAA,EAAA,EAAA,MAAA;EAYb;;;;EAEf,SAAA,OAAA,EAtDE,WAsDF,CAAA,MAAA,EAAA,MAAA,CAAA;EAAe;;;;;EACnB,SAAA,cAAA,EAhDa,WAgDb,CAAA,MAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GA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AAe,SAAS,OAAO;;;;eAK7C,QAAQ;;UAGN,IAAA;;;;;;;;;;;;;;;;;KAmBL,oBAAoB,QAAQ;;;;;;;;oBAQpB,oBAAoB,eAAe;;;;;;;;;;;;;;;;;;0BAmB7B,aAAa,kBAAkB,IAAI,eAAe;;;;;;KAOhE,YAAA;;;cAEC;;;;;0BAKa;;KAUd,gBAAA;yBAEa,QAAQ;;KAGrB,uBAAuB,eAAe,KAAK;cAE1C;;;;;;;;;;oBAUO,IAAI,eAAe,QAAQ;;;;;;;4BAanB,gBAAgB,eAAe;;;;;;;;;;+BAa5B,mCACnB,IACP,uCAAuC,IAAI,QAAQ,EAAE;;;;;;;;;;gCAkB1B,mCACpB,IACP,eAAe,QAAQ;;;;;;;;;;;+BAoBG,mCACnB,IACP,eAAe,QAAQ;;;;;;;;;;sCAgBU,mCAC1B,IACP,uCACqB,IAAI,qBAAqB,QAAQ,EAAE;;;;;;;KAgBjD,oBAAoB,QAAQ;;;;UAI9B,QAAQ;;;;;kBAMA,IAAI;;;;;4BAMM;;;;SAKnB,eAAe;;UAGP,qCAAqC,aAAa,sBACzD,oBAAoB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;mCAwBJ,MAAM,KAAK,eAAe;;UAG5C,+BAA+B,aAAa,sBAEzD,sBAAsB,SACtB,cAAc,SACd"}
package/dist/context.d.ts CHANGED
@@ -3,7 +3,12 @@ import { Client, SendClient } from "./types/rpc.js";
3
3
  import { Duration, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinitionFrom, VirtualObject, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinitionFrom } from "@restatedev/restate-sdk-core";
4
4
 
5
5
  //#region src/context.d.ts
6
-
6
+ interface Target {
7
+ service: string;
8
+ handler: string;
9
+ key?: string;
10
+ toString(): string;
11
+ }
7
12
  /**
8
13
  * Represents the original request as sent to this handler.
9
14
  *
@@ -11,11 +16,12 @@ import { Duration, RestateContext, RestateObjectContext, RestateObjectSharedCont
11
16
  * request body.
12
17
  */
13
18
  interface Request {
19
+ readonly target: Target;
14
20
  /**
15
21
  * The unique id that identifies the current function invocation. This id is guaranteed to be
16
22
  * unique across invocations, but constant across reties and suspensions.
17
23
  */
18
- readonly id: string;
24
+ readonly id: InvocationId;
19
25
  /**
20
26
  * Request headers - the following headers capture the original invocation headers, as provided to
21
27
  * the ingress.
@@ -97,15 +103,6 @@ interface KeyValueStore<TState extends TypedState> {
97
103
  */
98
104
  clearAll(): void;
99
105
  }
100
- /**
101
- * @deprecated SendOptions on the client factory are deprecated, please use `restate.rpc.sendOpts` instead
102
- */
103
- interface SendOptions {
104
- /**
105
- * @deprecated SendOptions on the client factory are deprecated, please use `restate.rpc.sendOpts` instead
106
- */
107
- delay?: number;
108
- }
109
106
  interface ContextDate {
110
107
  /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
111
108
  * This is equivalent to Date.now()
@@ -128,10 +125,6 @@ type RunOptions<T> = {
128
125
  * When giving up, `ctx.run` will throw a `TerminalError` wrapping the original error message.
129
126
  */
130
127
  maxRetryAttempts?: number;
131
- /**
132
- * @deprecated Use `maxRetryDuration` instead.
133
- */
134
- maxRetryDurationMillis?: number;
135
128
  /**
136
129
  * Max duration of retries, before giving up.
137
130
  *
@@ -140,10 +133,6 @@ type RunOptions<T> = {
140
133
  * If a number is provided, it will be interpreted as milliseconds.
141
134
  */
142
135
  maxRetryDuration?: Duration | number;
143
- /**
144
- * @deprecated Use `initialRetryInterval` instead.
145
- */
146
- initialRetryIntervalMillis?: number;
147
136
  /**
148
137
  * Initial interval for the first retry attempt.
149
138
  * Retry interval will grow by a factor specified in `retryIntervalFactor`.
@@ -153,10 +142,6 @@ type RunOptions<T> = {
153
142
  * If a number is provided, it will be interpreted as milliseconds.
154
143
  */
155
144
  initialRetryInterval?: Duration | number;
156
- /**
157
- * @deprecated Use `maxRetryInterval` instead.
158
- */
159
- maxRetryIntervalMillis?: number;
160
145
  /**
161
146
  * Max interval between retries.
162
147
  * Retry interval will grow by a factor specified in `retryIntervalFactor`.
@@ -355,13 +340,13 @@ interface Context extends RestateContext {
355
340
  * Reject an awakeable. When rejecting, the service waiting on this awakeable will be woken up with a terminal error with the provided reason.
356
341
  * @param id the string ID of the awakeable.
357
342
  * This is supplied by the service that needs to be woken up.
358
- * @param reason the reason of the rejection.
343
+ * @param reason the reason of the rejection, either a string message or a {@link TerminalError}.
359
344
  *
360
345
  * @example
361
346
  * // The sleeping service should have sent the awakeableIdentifier string to this service.
362
347
  * ctx.rejectAwakeable(awakeableIdentifier, "super bad error");
363
348
  */
364
- rejectAwakeable(id: string, reason: string): void;
349
+ rejectAwakeable(id: string, reason: string | TerminalError): void;
365
350
  /**
366
351
  * Sleep until a timeout has passed.
367
352
  * @param duration either Duration type or milliseconds.
@@ -474,7 +459,7 @@ interface Context extends RestateContext {
474
459
  * ctx.serviceSendClient(MyService).anotherAction(1337);
475
460
  * ```
476
461
  */
477
- serviceSendClient<D>(service: ServiceDefinitionFrom<D>, opts?: SendOptions): SendClient<Service<D>>;
462
+ serviceSendClient<D>(service: ServiceDefinitionFrom<D>): SendClient<Service<D>>;
478
463
  /**
479
464
  * Same as {@link serviceSendClient} but for virtual objects.
480
465
  *
@@ -482,7 +467,7 @@ interface Context extends RestateContext {
482
467
  * @param key the virtual object key
483
468
  * @param opts Send options
484
469
  */
485
- objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string, opts?: SendOptions): SendClient<VirtualObject<D>>;
470
+ objectSendClient<D>(obj: VirtualObjectDefinitionFrom<D>, key: string): SendClient<VirtualObject<D>>;
486
471
  genericCall<REQ = Uint8Array, RES = Uint8Array>(call: GenericCall<REQ, RES>): InvocationPromise<RES>;
487
472
  genericSend<REQ = Uint8Array>(call: GenericSend<REQ>): InvocationHandle;
488
473
  /**
@@ -563,6 +548,8 @@ interface Rand {
563
548
  }
564
549
  /**
565
550
  * A promise that can be combined using Promise combinators in RestateContext.
551
+ *
552
+ * To check at runtime whether a value is a {@link RestatePromise}, use {@link isRestatePromise}.
566
553
  */
567
554
  type RestatePromise<T> = Promise<T> & {
568
555
  /**
@@ -582,6 +569,9 @@ type RestatePromise<T> = Promise<T> & {
582
569
  * {@link Promise.then} is used by Restate to distinguish when awaiting an asynchronous operation,
583
570
  * thus calling `.then` on several Restate promises can lead to concurrency issues.
584
571
  *
572
+ * **NOTE**: Contrary to `.then`, the closure is executed ONLY when the promise is awaited,
573
+ * and not eagerly as soon as the promise completes.
574
+ *
585
575
  * @param mapper the function to execute when this promise is fulfilled.
586
576
  * If the promise completed successfully, `value` is provided as input, otherwise `failure` is provided as input.
587
577
  * If this mapper returns a value, this value will be used to resolve the returned {@link RestatePromise}.
@@ -608,6 +598,23 @@ type InvocationHandle = {
608
598
  };
609
599
  type InvocationPromise<T> = RestatePromise<T> & InvocationHandle;
610
600
  declare const RestatePromise: {
601
+ /**
602
+ * Creates a {@link RestatePromise} that is resolved with the given value.
603
+ *
604
+ * If the value is already a {@link RestatePromise}, it is returned as-is (mirroring
605
+ * the behavior of {@link Promise.resolve} when given a native {@link Promise}).
606
+ *
607
+ * @param value The value to resolve, or an existing {@link RestatePromise} to return.
608
+ * @returns A resolved {@link RestatePromise}, or the input promise unchanged.
609
+ */
610
+ resolve<T>(value: T): RestatePromise<Awaited<T>>;
611
+ /**
612
+ * Creates a {@link RestatePromise} that is rejected with the given {@link TerminalError}.
613
+ *
614
+ * @param reason The {@link TerminalError} to reject with.
615
+ * @returns A rejected {@link RestatePromise}.
616
+ */
617
+ reject<T = never>(reason: TerminalError): RestatePromise<T>;
611
618
  /**
612
619
  * Creates a Promise that is resolved with an array of results when all of the provided Promises
613
620
  * resolve, or rejected when any Promise is rejected.
@@ -653,7 +660,7 @@ declare const RestatePromise: {
653
660
  /**
654
661
  * Workflow bound durable promise
655
662
  *
656
- * See {@link WorkflowSharedContext} promise..
663
+ * See {@link WorkflowSharedContext}.
657
664
  */
658
665
  type DurablePromise<T> = Promise<T> & {
659
666
  /**
@@ -703,5 +710,5 @@ interface WorkflowSharedContext<TState extends TypedState = UntypedState> extend
703
710
  }
704
711
  interface WorkflowContext<TState extends TypedState = UntypedState> extends WorkflowSharedContext<TState>, ObjectContext<TState>, RestateWorkflowContext {}
705
712
  //#endregion
706
- export { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SendOptions, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext };
713
+ export { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext };
707
714
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","names":[],"sources":["../src/context.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAoCA;;;;AAyCmC,UAzClB,OAAA,CAyCkB;EAAW;AAI9C;AACA;AAKA;EAA8C,SAAA,EAAA,EAAA,MAAA;EAYb;;;;EAEf,SAAA,OAAA,EAtDE,WAsDF,CAAA,MAAA,EAAA,MAAA,CAAA;EAAe;;;;;EACnB,SAAA,cAAA,EAhDa,WAgDb,CAAA,MAAA,EAAA,MAAA,GAAA,MAAA,EAAA,GAAA,SAAA,CAAA;EAAe;;;EAA+B,SAAA,IAAA,EA3C3C,UA2C2C;EAAvD;;;;;;;;;EAiBoC,SAAA,SAAA,EAAA,OAAA,EAAA;EAAS;;;;;EACO,SAAA,sBAAA,EA3CtB,WA2CsB;;AAA7C,KAvCA,UAAA,GAAa,MAuCb,CAAA,MAAA,EAAA,GAAA,CAAA;AAUe,KAhDf,YAAA,GAgDe;EACjB,CAAA,EAAA,KAAA;CAAe;;;AAezB;AAOiB,UAlEA,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,eAAe,QAAQ;;;;;;;4BAanB,gBAAgB,eAAe;;;;;;;;;;+BAa5B,mCACnB,IACP,uCAAuC,IAAI,QAAQ,EAAE;;;;;;;;;;gCAkB1B,mCACpB,IACP,eAAe,QAAQ;;;;;;;;;;;+BAoBG,mCACnB,IACP,eAAe,QAAQ;;;;;;;;;;sCAgBU,mCAC1B,IACP,uCACqB,IAAI,qBAAqB,QAAQ,EAAE;;;;;;;KAgBjD,oBAAoB,QAAQ;;;;UAI9B,QAAQ;;;;;kBAMA,IAAI;;;;;4BAMM;;;;SAKnB,eAAe;;UAGP,qCAAqC,aAAa,sBACzD,oBAAoB,SAAS;;;;;;;;;;;;;;;;;;;;;;;;mCAwBJ,MAAM,KAAK,eAAe;;UAG5C,+BAA+B,aAAa,sBAEzD,sBAAsB,SACtB,cAAc,SACd"}
package/dist/context.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ContextImpl } from "./context_impl.js";
1
+ import { CombinatorRestatePromise, ConstRestatePromise, InternalRestatePromise } from "./promises.js";
2
2
 
3
3
  //#region src/context.ts
4
4
  const InvocationIdParser = { fromString(id) {
@@ -6,21 +6,25 @@ const InvocationIdParser = { fromString(id) {
6
6
  return id;
7
7
  } };
8
8
  const RestatePromise = {
9
+ resolve(value) {
10
+ if (value instanceof InternalRestatePromise) return value;
11
+ return ConstRestatePromise.resolve(value);
12
+ },
13
+ reject(reason) {
14
+ return ConstRestatePromise.reject(reason);
15
+ },
9
16
  all(values) {
10
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
11
- return ContextImpl.createCombinator((p) => Promise.all(p), values);
17
+ return CombinatorRestatePromise.fromPromises((p) => Promise.all(p), values);
12
18
  },
13
19
  race(values) {
14
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
15
- return ContextImpl.createCombinator((p) => Promise.race(p), values);
20
+ if (values.length === 0) return ConstRestatePromise.pending();
21
+ return CombinatorRestatePromise.fromPromises((p) => Promise.race(p), values);
16
22
  },
17
23
  any(values) {
18
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
19
- return ContextImpl.createCombinator((p) => Promise.any(p), values);
24
+ return CombinatorRestatePromise.fromPromises((p) => Promise.any(p), values);
20
25
  },
21
26
  allSettled(values) {
22
- if (values.length === 0) throw new Error("Expected combineable promise to have at least one promise");
23
- return ContextImpl.createCombinator((p) => Promise.allSettled(p), values);
27
+ return CombinatorRestatePromise.fromPromises((p) => Promise.allSettled(p), values);
24
28
  }
25
29
  };
26
30