@restatedev/restate-sdk 1.14.5 → 1.15.0-rc.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 (55) hide show
  1. package/dist/common_api.d.cts +1 -1
  2. package/dist/common_api.d.cts.map +1 -1
  3. package/dist/common_api.d.ts +1 -1
  4. package/dist/common_api.d.ts.map +1 -1
  5. package/dist/common_api.js.map +1 -1
  6. package/dist/context.cjs +4 -4
  7. package/dist/context.d.cts +73 -8
  8. package/dist/context.d.cts.map +1 -1
  9. package/dist/context.d.ts +73 -8
  10. package/dist/context.d.ts.map +1 -1
  11. package/dist/context.js +4 -4
  12. package/dist/context.js.map +1 -1
  13. package/dist/context_impl.cjs +50 -47
  14. package/dist/context_impl.d.ts.map +1 -1
  15. package/dist/context_impl.js +50 -47
  16. package/dist/context_impl.js.map +1 -1
  17. package/dist/endpoint/endpoint.cjs +1 -1
  18. package/dist/endpoint/endpoint.js +1 -1
  19. package/dist/endpoint/endpoint.js.map +1 -1
  20. package/dist/endpoint/handlers/generic.cjs +1 -2
  21. package/dist/endpoint/handlers/generic.d.ts.map +1 -1
  22. package/dist/endpoint/handlers/generic.js +1 -2
  23. package/dist/endpoint/handlers/generic.js.map +1 -1
  24. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.cjs +789 -1084
  25. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.d.ts +135 -135
  26. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.d.ts.map +1 -1
  27. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.js +789 -1084
  28. package/dist/endpoint/handlers/vm/sdk_shared_core_wasm_bindings.js.map +1 -1
  29. package/dist/fetch.d.cts +2 -2
  30. package/dist/fetch.d.ts +2 -2
  31. package/dist/index.d.cts +2 -2
  32. package/dist/index.d.ts +2 -2
  33. package/dist/internal.d.cts +2 -89
  34. package/dist/internal.d.cts.map +1 -1
  35. package/dist/internal.d.ts +2 -89
  36. package/dist/internal.d.ts.map +1 -1
  37. package/dist/internal.js.map +1 -1
  38. package/dist/lambda.d.cts +2 -2
  39. package/dist/lambda.d.ts +2 -2
  40. package/dist/node.d.cts +2 -2
  41. package/dist/node.d.ts +2 -2
  42. package/dist/package.cjs +1 -1
  43. package/dist/package.js +1 -1
  44. package/dist/package.js.map +1 -1
  45. package/dist/promises.cjs +23 -19
  46. package/dist/promises.d.cts.map +1 -1
  47. package/dist/promises.d.ts.map +1 -1
  48. package/dist/promises.js +23 -19
  49. package/dist/promises.js.map +1 -1
  50. package/package.json +2 -2
  51. package/dist/utils/completable_promise.cjs +0 -22
  52. package/dist/utils/completable_promise.d.ts +0 -9
  53. package/dist/utils/completable_promise.d.ts.map +0 -1
  54. package/dist/utils/completable_promise.js +0 -22
  55. package/dist/utils/completable_promise.js.map +0 -1
package/dist/fetch.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
3
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";
4
- import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request as Request$1, RestatePromise, RunAction, RunOptions, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request as Request$1, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.cjs";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.cjs";
7
7
  import { internal_d_exports } from "./internal.cjs";
@@ -51,5 +51,5 @@ interface FetchEndpointOptions extends EndpointOptions {
51
51
  */
52
52
  declare function createEndpointHandler(options: FetchEndpointOptions): (request: Request, ...extraArgs: unknown[]) => Promise<Response>;
53
53
  //#endregion
54
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, type FetchEndpoint, FetchEndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request$1 as Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
54
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, type FetchEndpoint, FetchEndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request$1 as Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
55
55
  //# sourceMappingURL=fetch.d.cts.map
package/dist/fetch.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
3
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";
4
- import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request as Request$1, RestatePromise, RunAction, RunOptions, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request as Request$1, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.js";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.js";
7
7
  import { internal_d_exports } from "./internal.js";
@@ -51,5 +51,5 @@ interface FetchEndpointOptions extends EndpointOptions {
51
51
  */
52
52
  declare function createEndpointHandler(options: FetchEndpointOptions): (request: Request, ...extraArgs: unknown[]) => Promise<Response>;
53
53
  //#endregion
54
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, type FetchEndpoint, FetchEndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request$1 as Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
54
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, type FetchEndpoint, FetchEndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request$1 as Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
55
55
  //# sourceMappingURL=fetch.d.ts.map
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
3
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";
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";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.cjs";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.cjs";
7
7
  import { internal_d_exports } from "./internal.cjs";
@@ -9,4 +9,4 @@ import { isRestatePromise } from "./promises.cjs";
9
9
  import { EndpointOptions } from "./endpoint/types.cjs";
10
10
  import { CombineablePromise, Duration, JournalValueCodec, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, serde } from "./common_api.cjs";
11
11
  import { NodeEndpointOptions, ServeOptions, createEndpointHandler, endpoint, serve } from "./node.cjs";
12
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
12
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
3
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";
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";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.js";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.js";
7
7
  import { internal_d_exports } from "./internal.js";
@@ -9,4 +9,4 @@ import { isRestatePromise } from "./promises.js";
9
9
  import { EndpointOptions } from "./endpoint/types.js";
10
10
  import { CombineablePromise, Duration, JournalValueCodec, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, serde } from "./common_api.js";
11
11
  import { NodeEndpointOptions, ServeOptions, createEndpointHandler, endpoint, serve } from "./node.js";
12
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
12
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
@@ -1,10 +1,9 @@
1
- import { TerminalError, isSuspendedError } from "./types/errors.cjs";
1
+ import { isSuspendedError } from "./types/errors.cjs";
2
2
  import { Context, InvocationId, RestatePromise } from "./context.cjs";
3
- import { Serde } from "@restatedev/restate-sdk-core";
4
3
 
5
4
  //#region src/internal.d.ts
6
5
  declare namespace internal_d_exports {
7
- export { ContextInternal, InvocationReference, SignalReference, isSuspendedError };
6
+ export { ContextInternal, isSuspendedError };
8
7
  }
9
8
  /**
10
9
  * Internal {@link Context} interface exposing additional features.
@@ -119,92 +118,6 @@ interface ContextInternal extends Context {
119
118
  * @experimental
120
119
  */
121
120
  cancelPreviousCalls(): RestatePromise<InvocationId[]>;
122
- /**
123
- * Wait for a named signal to arrive on the current invocation.
124
- *
125
- * Signals are identified by name and are scoped to the current invocation.
126
- * Another handler can send a signal to this invocation using
127
- * {@link InvocationReference.signal}, specifying this invocation's
128
- * ID (available via `ctx.request().id`) and the same signal name.
129
- *
130
- * @param name the name of the signal to wait for.
131
- * @param serde optional custom serializer/deserializer for the payload.
132
- * @returns a {@link RestatePromise} that resolves when the signal arrives.
133
- *
134
- * @example
135
- * const ctxInternal = ctx as restate.internal.ContextInternal;
136
- * const approved = await ctxInternal.signal<boolean>("approved");
137
- *
138
- * @experimental
139
- */
140
- signal<T>(name: string, serde?: Serde<T>): RestatePromise<T>;
141
- /**
142
- * Get a reference to a target invocation, to send signals to it.
143
- *
144
- * @param invocationId the invocation ID of the target invocation.
145
- * @returns an {@link InvocationReference} for the target invocation.
146
- *
147
- * @example
148
- * const ctxInternal = ctx as restate.internal.ContextInternal;
149
- * const target = ctxInternal.invocation(targetInvocationId);
150
- * target.signal("approved").resolve(true);
151
- * target.signal("approved").reject("Request denied");
152
- *
153
- * @experimental
154
- */
155
- invocation(invocationId: InvocationId): InvocationReference;
156
- }
157
- /**
158
- * A reference to a target invocation, used to send signals.
159
- *
160
- * @experimental
161
- */
162
- interface InvocationReference {
163
- /**
164
- * Get a handle to a named signal on the target invocation.
165
- *
166
- * @param name the name of the signal.
167
- * @param serde optional custom serializer/deserializer for the payload.
168
- * @returns a {@link SignalReference} to resolve or reject the signal.
169
- *
170
- * @experimental
171
- */
172
- signal<T>(name: string, serde?: Serde<T>): SignalReference<T>;
173
- /**
174
- * Cancel the target invocation.
175
- */
176
- cancel(): void;
177
- /**
178
- * Attach to the target invocation and wait for its result.
179
- *
180
- * @param serde optional custom serializer/deserializer for the result.
181
- * @returns a {@link RestatePromise} that resolves with the invocation result.
182
- */
183
- attach<T>(serde?: Serde<T>): RestatePromise<T>;
184
- }
185
- /**
186
- * A handle to send a signal value to a target invocation.
187
- *
188
- * @experimental
189
- */
190
- interface SignalReference<T> {
191
- /**
192
- * Resolve the signal with a value.
193
- *
194
- * @param payload the payload to send.
195
- *
196
- * @experimental
197
- */
198
- resolve(payload?: T): void;
199
- /**
200
- * Reject the signal. The target invocation waiting on this signal will be
201
- * woken up with a terminal error containing the provided reason.
202
- *
203
- * @param reason the reason for rejection, either a string message or a {@link TerminalError}.
204
- *
205
- * @experimental
206
- */
207
- reject(reason: string | TerminalError): void;
208
121
  }
209
122
  //#endregion
210
123
  export { internal_d_exports };
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.cts","names":[],"sources":["../src/internal.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;UAaiB,eAAA,SAAwB;EAAxB;;;;;;;;EA+IU,YAAA,EAAA,EAAA,OAAA;EAAe;;;AAQ1C;;;;;;;;;;AA+BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAtFkB;;;;;;;;;;yBAWO,eAAe;;;;;;;;;;;;;;;;;;;kCAoBN,MAAM,KAAK,eAAe;;;;;;;;;;;;;;;2BAgBjC,eAAe;;;;;;;UAQzB,mBAAA;;;;;;;;;;kCAUiB,MAAM,KAAK,gBAAgB;;;;;;;;;;;oBAazC,MAAM,KAAK,eAAe;;;;;;;UAQ7B;;;;;;;;oBAQG;;;;;;;;;0BAUM"}
1
+ {"version":3,"file":"internal.d.cts","names":[],"sources":["../src/internal.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;AAWiB,UAAA,eAAA,SAAwB,OAAR,CAAA;EAgGf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;;;;;;;;;;yBAWO,eAAe"}
@@ -1,10 +1,9 @@
1
- import { TerminalError, isSuspendedError } from "./types/errors.js";
1
+ import { isSuspendedError } from "./types/errors.js";
2
2
  import { Context, InvocationId, RestatePromise } from "./context.js";
3
- import { Serde } from "@restatedev/restate-sdk-core";
4
3
 
5
4
  //#region src/internal.d.ts
6
5
  declare namespace internal_d_exports {
7
- export { ContextInternal, InvocationReference, SignalReference, isSuspendedError };
6
+ export { ContextInternal, isSuspendedError };
8
7
  }
9
8
  /**
10
9
  * Internal {@link Context} interface exposing additional features.
@@ -119,92 +118,6 @@ interface ContextInternal extends Context {
119
118
  * @experimental
120
119
  */
121
120
  cancelPreviousCalls(): RestatePromise<InvocationId[]>;
122
- /**
123
- * Wait for a named signal to arrive on the current invocation.
124
- *
125
- * Signals are identified by name and are scoped to the current invocation.
126
- * Another handler can send a signal to this invocation using
127
- * {@link InvocationReference.signal}, specifying this invocation's
128
- * ID (available via `ctx.request().id`) and the same signal name.
129
- *
130
- * @param name the name of the signal to wait for.
131
- * @param serde optional custom serializer/deserializer for the payload.
132
- * @returns a {@link RestatePromise} that resolves when the signal arrives.
133
- *
134
- * @example
135
- * const ctxInternal = ctx as restate.internal.ContextInternal;
136
- * const approved = await ctxInternal.signal<boolean>("approved");
137
- *
138
- * @experimental
139
- */
140
- signal<T>(name: string, serde?: Serde<T>): RestatePromise<T>;
141
- /**
142
- * Get a reference to a target invocation, to send signals to it.
143
- *
144
- * @param invocationId the invocation ID of the target invocation.
145
- * @returns an {@link InvocationReference} for the target invocation.
146
- *
147
- * @example
148
- * const ctxInternal = ctx as restate.internal.ContextInternal;
149
- * const target = ctxInternal.invocation(targetInvocationId);
150
- * target.signal("approved").resolve(true);
151
- * target.signal("approved").reject("Request denied");
152
- *
153
- * @experimental
154
- */
155
- invocation(invocationId: InvocationId): InvocationReference;
156
- }
157
- /**
158
- * A reference to a target invocation, used to send signals.
159
- *
160
- * @experimental
161
- */
162
- interface InvocationReference {
163
- /**
164
- * Get a handle to a named signal on the target invocation.
165
- *
166
- * @param name the name of the signal.
167
- * @param serde optional custom serializer/deserializer for the payload.
168
- * @returns a {@link SignalReference} to resolve or reject the signal.
169
- *
170
- * @experimental
171
- */
172
- signal<T>(name: string, serde?: Serde<T>): SignalReference<T>;
173
- /**
174
- * Cancel the target invocation.
175
- */
176
- cancel(): void;
177
- /**
178
- * Attach to the target invocation and wait for its result.
179
- *
180
- * @param serde optional custom serializer/deserializer for the result.
181
- * @returns a {@link RestatePromise} that resolves with the invocation result.
182
- */
183
- attach<T>(serde?: Serde<T>): RestatePromise<T>;
184
- }
185
- /**
186
- * A handle to send a signal value to a target invocation.
187
- *
188
- * @experimental
189
- */
190
- interface SignalReference<T> {
191
- /**
192
- * Resolve the signal with a value.
193
- *
194
- * @param payload the payload to send.
195
- *
196
- * @experimental
197
- */
198
- resolve(payload?: T): void;
199
- /**
200
- * Reject the signal. The target invocation waiting on this signal will be
201
- * woken up with a terminal error containing the provided reason.
202
- *
203
- * @param reason the reason for rejection, either a string message or a {@link TerminalError}.
204
- *
205
- * @experimental
206
- */
207
- reject(reason: string | TerminalError): void;
208
121
  }
209
122
  //#endregion
210
123
  export { internal_d_exports };
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","names":[],"sources":["../src/internal.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;UAaiB,eAAA,SAAwB;EAAxB;;;;;;;;EA+IU,YAAA,EAAA,EAAA,OAAA;EAAe;;;AAQ1C;;;;;;;;;;AA+BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAtFkB;;;;;;;;;;yBAWO,eAAe;;;;;;;;;;;;;;;;;;;kCAoBN,MAAM,KAAK,eAAe;;;;;;;;;;;;;;;2BAgBjC,eAAe;;;;;;;UAQzB,mBAAA;;;;;;;;;;kCAUiB,MAAM,KAAK,gBAAgB;;;;;;;;;;;oBAazC,MAAM,KAAK,eAAe;;;;;;;UAQ7B;;;;;;;;oBAQG;;;;;;;;;0BAUM"}
1
+ {"version":3,"file":"internal.d.ts","names":[],"sources":["../src/internal.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;AAWiB,UAAA,eAAA,SAAwB,OAAR,CAAA;EAgGf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;;;;;;;;;;yBAWO,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","names":[],"sources":["../src/internal.ts"],"sourcesContent":["import type { Serde } from \"@restatedev/restate-sdk-core\";\nimport { Context, InvocationId, RestatePromise } from \"./context.js\";\nimport type { TerminalError } from \"./types/errors.js\";\n\nexport { isSuspendedError } from \"./types/errors.js\";\n\n/**\n * Internal {@link Context} interface exposing additional features.\n *\n * Please note that this API is to be considered experimental and might change without notice.\n *\n * @experimental\n */\nexport interface ContextInternal extends Context {\n /**\n * Returns true if the handler is in the processing phase.\n * This is the mechanism used by `ctx.console` to distinguish whether we should log or not in replaying/processing.\n *\n * **WARNING**: This method should not be used to influence control flow, as it will **surely** lead to non-determinism errors!\n *\n * @experimental\n */\n isProcessing(): boolean;\n\n /**\n * Returns a {@link RestatePromise} that resolves with `undefined` when Restate signals cancellation\n * of the current invocation.\n *\n * This method **MUST** only be used when the handler (or its parent service/endpoint) is configured\n * with `explicitCancellation: true`. Without configuring this option, cancellations are propagated automatically,\n * and this promise will **NEVER** resolve.\n *\n * **Promise reuse:** calling this method multiple times returns the **same** promise instance as long as\n * the current cancellation signal has not yet arrived. Once the promise resolves (cancellation received),\n * later calls return a **new** promise that will resolve on the next cancellation signal.\n *\n * @example Race a long-running side effect against cancellation\n * ```ts\n * const greeter = restate.service({\n * name: \"greeter\",\n * handlers: {\n * greet: async (ctx: restate.Context, name: string) => {\n * ctxInternal = ctx as restate.internal.ContextInternal;\n * const result = await RestatePromise.race([\n * ctx.run(() => longRunningTask(name)),\n * ctxInternal.cancellation().map(() => { throw new restate.TerminalError(\"Cancelled\") }),\n * ]);\n * return result;\n * },\n * },\n * options: { explicitCancellation: true },\n * });\n * ```\n *\n * @example Use the cancellation promise to create an AbortSignal for ctx.run\n * ```ts\n * const greeter = restate.service({\n * name: \"greeter\",\n * handlers: {\n * greet: async (ctx: restate.Context, name: string) => {\n * const ctxInternal = ctx as restate.internal.ContextInternal;\n * const controller = new AbortController();\n * const cancellation = ctxInternal.cancellation()\n * .map(() => {\n * controller.abort();\n * throw new restate.TerminalError(\"Cancelled\");\n * });\n *\n * return RestatePromise.race([\n * ctx.run(() => fetch(`https://api.example.com/greet/${name}`, { signal: controller.signal })),\n * cancellation,\n * ]);\n * },\n * },\n * options: { explicitCancellation: true },\n * });\n * ```\n *\n * @example Handle cancellation, perform cleanup, then listen for the next cancellation\n * ```ts\n * const greeter = restate.service({\n * name: \"greeter\",\n * handlers: {\n * greet: async (ctx: restate.Context, name: string) => {\n * const ctxInternal = ctx as restate.internal.ContextInternal;\n * try {\n * return await RestatePromise.race([\n * ctx.run(() => longRunningTask(name)),\n * ctxInternal.cancellation().map(() => { throw new restate.TerminalError(\"Cancelled\") }),\n * ]);\n * } catch (e) {\n * // Perform cleanup\n * await ctx.run(() => cleanupResources(name));\n *\n * // After cancellation is resolved, ctx.cancellation() returns a fresh promise.\n * // Race cleanup confirmation against the next cancellation signal.\n * await RestatePromise.race([\n * ctx.run(() => confirmCleanup(name)),\n * ctxInternal.cancellation().map(() => { throw new restate.TerminalError(\"Canceled during cleanup\") }),\n * ]);\n * }\n * },\n * },\n * options: { explicitCancellation: true },\n * });\n * ```\n *\n * @experimental\n */\n cancellation(): RestatePromise<void>;\n\n /**\n * Cancel all previous calls made from this handler.\n *\n * This method **MUST** only be used when the handler (or its parent service/endpoint) is configured\n * with `explicitCancellation: true`. Without configuring this option, this operation will always be a no-op.\n *\n * @return the invocation id of the canceled calls.\n * @experimental\n */\n cancelPreviousCalls(): RestatePromise<InvocationId[]>;\n\n /**\n * Wait for a named signal to arrive on the current invocation.\n *\n * Signals are identified by name and are scoped to the current invocation.\n * Another handler can send a signal to this invocation using\n * {@link InvocationReference.signal}, specifying this invocation's\n * ID (available via `ctx.request().id`) and the same signal name.\n *\n * @param name the name of the signal to wait for.\n * @param serde optional custom serializer/deserializer for the payload.\n * @returns a {@link RestatePromise} that resolves when the signal arrives.\n *\n * @example\n * const ctxInternal = ctx as restate.internal.ContextInternal;\n * const approved = await ctxInternal.signal<boolean>(\"approved\");\n *\n * @experimental\n */\n signal<T>(name: string, serde?: Serde<T>): RestatePromise<T>;\n\n /**\n * Get a reference to a target invocation, to send signals to it.\n *\n * @param invocationId the invocation ID of the target invocation.\n * @returns an {@link InvocationReference} for the target invocation.\n *\n * @example\n * const ctxInternal = ctx as restate.internal.ContextInternal;\n * const target = ctxInternal.invocation(targetInvocationId);\n * target.signal(\"approved\").resolve(true);\n * target.signal(\"approved\").reject(\"Request denied\");\n *\n * @experimental\n */\n invocation(invocationId: InvocationId): InvocationReference;\n}\n\n/**\n * A reference to a target invocation, used to send signals.\n *\n * @experimental\n */\nexport interface InvocationReference {\n /**\n * Get a handle to a named signal on the target invocation.\n *\n * @param name the name of the signal.\n * @param serde optional custom serializer/deserializer for the payload.\n * @returns a {@link SignalReference} to resolve or reject the signal.\n *\n * @experimental\n */\n signal<T>(name: string, serde?: Serde<T>): SignalReference<T>;\n\n /**\n * Cancel the target invocation.\n */\n cancel(): void;\n\n /**\n * Attach to the target invocation and wait for its result.\n *\n * @param serde optional custom serializer/deserializer for the result.\n * @returns a {@link RestatePromise} that resolves with the invocation result.\n */\n attach<T>(serde?: Serde<T>): RestatePromise<T>;\n}\n\n/**\n * A handle to send a signal value to a target invocation.\n *\n * @experimental\n */\nexport interface SignalReference<T> {\n /**\n * Resolve the signal with a value.\n *\n * @param payload the payload to send.\n *\n * @experimental\n */\n resolve(payload?: T): void;\n\n /**\n * Reject the signal. The target invocation waiting on this signal will be\n * woken up with a terminal error containing the provided reason.\n *\n * @param reason the reason for rejection, either a string message or a {@link TerminalError}.\n *\n * @experimental\n */\n reject(reason: string | TerminalError): void;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"internal.js","names":[],"sources":["../src/internal.ts"],"sourcesContent":["import { Context, InvocationId, RestatePromise } from \"./context.js\";\n\nexport { isSuspendedError } from \"./types/errors.js\";\n\n/**\n * Internal {@link Context} interface exposing additional features.\n *\n * Please note that this API is to be considered experimental and might change without notice.\n *\n * @experimental\n */\nexport interface ContextInternal extends Context {\n /**\n * Returns true if the handler is in the processing phase.\n * This is the mechanism used by `ctx.console` to distinguish whether we should log or not in replaying/processing.\n *\n * **WARNING**: This method should not be used to influence control flow, as it will **surely** lead to non-determinism errors!\n *\n * @experimental\n */\n isProcessing(): boolean;\n\n /**\n * Returns a {@link RestatePromise} that resolves with `undefined` when Restate signals cancellation\n * of the current invocation.\n *\n * This method **MUST** only be used when the handler (or its parent service/endpoint) is configured\n * with `explicitCancellation: true`. Without configuring this option, cancellations are propagated automatically,\n * and this promise will **NEVER** resolve.\n *\n * **Promise reuse:** calling this method multiple times returns the **same** promise instance as long as\n * the current cancellation signal has not yet arrived. Once the promise resolves (cancellation received),\n * later calls return a **new** promise that will resolve on the next cancellation signal.\n *\n * @example Race a long-running side effect against cancellation\n * ```ts\n * const greeter = restate.service({\n * name: \"greeter\",\n * handlers: {\n * greet: async (ctx: restate.Context, name: string) => {\n * ctxInternal = ctx as restate.internal.ContextInternal;\n * const result = await RestatePromise.race([\n * ctx.run(() => longRunningTask(name)),\n * ctxInternal.cancellation().map(() => { throw new restate.TerminalError(\"Cancelled\") }),\n * ]);\n * return result;\n * },\n * },\n * options: { explicitCancellation: true },\n * });\n * ```\n *\n * @example Use the cancellation promise to create an AbortSignal for ctx.run\n * ```ts\n * const greeter = restate.service({\n * name: \"greeter\",\n * handlers: {\n * greet: async (ctx: restate.Context, name: string) => {\n * const ctxInternal = ctx as restate.internal.ContextInternal;\n * const controller = new AbortController();\n * const cancellation = ctxInternal.cancellation()\n * .map(() => {\n * controller.abort();\n * throw new restate.TerminalError(\"Cancelled\");\n * });\n *\n * return RestatePromise.race([\n * ctx.run(() => fetch(`https://api.example.com/greet/${name}`, { signal: controller.signal })),\n * cancellation,\n * ]);\n * },\n * },\n * options: { explicitCancellation: true },\n * });\n * ```\n *\n * @example Handle cancellation, perform cleanup, then listen for the next cancellation\n * ```ts\n * const greeter = restate.service({\n * name: \"greeter\",\n * handlers: {\n * greet: async (ctx: restate.Context, name: string) => {\n * const ctxInternal = ctx as restate.internal.ContextInternal;\n * try {\n * return await RestatePromise.race([\n * ctx.run(() => longRunningTask(name)),\n * ctxInternal.cancellation().map(() => { throw new restate.TerminalError(\"Cancelled\") }),\n * ]);\n * } catch (e) {\n * // Perform cleanup\n * await ctx.run(() => cleanupResources(name));\n *\n * // After cancellation is resolved, ctx.cancellation() returns a fresh promise.\n * // Race cleanup confirmation against the next cancellation signal.\n * await RestatePromise.race([\n * ctx.run(() => confirmCleanup(name)),\n * ctxInternal.cancellation().map(() => { throw new restate.TerminalError(\"Canceled during cleanup\") }),\n * ]);\n * }\n * },\n * },\n * options: { explicitCancellation: true },\n * });\n * ```\n *\n * @experimental\n */\n cancellation(): RestatePromise<void>;\n\n /**\n * Cancel all previous calls made from this handler.\n *\n * This method **MUST** only be used when the handler (or its parent service/endpoint) is configured\n * with `explicitCancellation: true`. Without configuring this option, this operation will always be a no-op.\n *\n * @return the invocation id of the canceled calls.\n * @experimental\n */\n cancelPreviousCalls(): RestatePromise<InvocationId[]>;\n}\n"],"mappings":""}
package/dist/lambda.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
3
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";
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";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.cjs";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.cjs";
7
7
  import { internal_d_exports } from "./internal.cjs";
@@ -31,5 +31,5 @@ declare function endpoint(): LambdaEndpoint;
31
31
  */
32
32
  declare function createEndpointHandler(options: EndpointOptions): (event: any, ctx: any) => Promise<any>;
33
33
  //#endregion
34
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, type LambdaEndpoint, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
34
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, type LambdaEndpoint, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
35
35
  //# sourceMappingURL=lambda.d.cts.map
package/dist/lambda.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
3
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";
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";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.js";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.js";
7
7
  import { internal_d_exports } from "./internal.js";
@@ -31,5 +31,5 @@ declare function endpoint(): LambdaEndpoint;
31
31
  */
32
32
  declare function createEndpointHandler(options: EndpointOptions): (event: any, ctx: any) => Promise<any>;
33
33
  //#endregion
34
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, type LambdaEndpoint, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
34
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, type LambdaEndpoint, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
35
35
  //# sourceMappingURL=lambda.d.ts.map
package/dist/node.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
3
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";
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";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.cjs";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.cjs";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.cjs";
7
7
  import { internal_d_exports } from "./internal.cjs";
@@ -86,5 +86,5 @@ declare function serve({
86
86
  ...options
87
87
  }: ServeOptions): Promise<number>;
88
88
  //#endregion
89
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
89
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
90
90
  //# sourceMappingURL=node.d.cts.map
package/dist/node.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CancelledError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
2
2
  import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
3
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";
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";
4
+ import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, SignalReference, Target, TypedState, UntypedState, WorkflowContext, WorkflowSharedContext } from "./context.js";
5
5
  import { LogMetadata, LogSource, LoggerContext, LoggerTransport, RestateLogLevel } from "./logging/logger_transport.js";
6
6
  import { DefaultServiceOptions, RestateEndpoint, RestateEndpointBase } from "./endpoint.js";
7
7
  import { internal_d_exports } from "./internal.js";
@@ -86,5 +86,5 @@ declare function serve({
86
86
  ...options
87
87
  }: ServeOptions): Promise<number>;
88
88
  //#endregion
89
- export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
89
+ export { CancelledError, Client, ClientCallOptions, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, DurablePromise, Duration, EndpointOptions, GenericCall, GenericSend, Hooks, HooksProvider, InferArg, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, SendClient, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceHandler, ServiceHandlerOpts, ServiceOptions, ServiceOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowHandler, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
90
90
  //# sourceMappingURL=node.d.ts.map
package/dist/package.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region package.json
3
- var version = "1.14.5";
3
+ var version = "1.15.0-rc.0";
4
4
 
5
5
  //#endregion
6
6
  Object.defineProperty(exports, 'version', {
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.14.5";
2
+ var version = "1.15.0-rc.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk\",\n \"version\": \"1.14.5\",\n \"description\": \"Typescript SDK for Restate\",\n \"author\": \"Restate Developers\",\n \"email\": \"code@restate.dev\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/restatedev/sdk-typescript#readme\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/restatedev/sdk-typescript.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/restatedev/sdk-typescript/issues\"\n },\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.cts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./fetch\": {\n \"import\": \"./dist/fetch.js\",\n \"require\": \"./dist/fetch.cjs\"\n },\n \"./lambda\": {\n \"import\": \"./dist/lambda.js\",\n \"require\": \"./dist/lambda.cjs\"\n },\n \"./node\": {\n \"import\": \"./dist/node.js\",\n \"require\": \"./dist/node.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"README.md\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"test\": \"turbo run _test --filter={.}...\",\n \"_test\": \"vitest run\",\n \"build\": \"turbo run _build --filter={.}...\",\n \"_build\": \"tsc --noEmit && tsdown\",\n \"dev\": \"tsc --noEmit --watch\",\n \"clean\": \"rm -rf dist *.tsbuildinfo .turbo\",\n \"check:types\": \"turbo run _check:types --filter={.}...\",\n \"_check:types\": \"tsc --noEmit --project tsconfig.build.json\",\n \"lint\": \"eslint .\",\n \"check:exports\": \"turbo run _check:exports --filter={.}...\",\n \"_check:exports\": \"attw --pack .\",\n \"check:api\": \"turbo run _check:api --filter={.}...\",\n \"_check:api\": \"api-extractor run --local && api-extractor run --local --config api-extractor.fetch.json && api-extractor run --local --config api-extractor.lambda.json && api-extractor run --local --config api-extractor.node.json\",\n \"prepublishOnly\": \"pnpm -w verify\"\n },\n \"dependencies\": {\n \"@restatedev/restate-sdk-core\": \"workspace:*\"\n },\n \"devDependencies\": {\n \"@types/aws-lambda\": \"^8.10.115\"\n },\n \"typesVersions\": {\n \"*\": {\n \"fetch\": [\n \"./dist/fetch.d.ts\"\n ],\n \"lambda\": [\n \"./dist/lambda.d.ts\"\n ],\n \"node\": [\n \"./dist/node.d.ts\"\n ]\n }\n }\n}\n"],"mappings":";cAEa"}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk\",\n \"version\": \"1.15.0-rc.0\",\n \"description\": \"Typescript SDK for Restate\",\n \"author\": \"Restate Developers\",\n \"email\": \"code@restate.dev\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/restatedev/sdk-typescript#readme\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/restatedev/sdk-typescript.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/restatedev/sdk-typescript/issues\"\n },\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.cts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./fetch\": {\n \"import\": \"./dist/fetch.js\",\n \"require\": \"./dist/fetch.cjs\"\n },\n \"./lambda\": {\n \"import\": \"./dist/lambda.js\",\n \"require\": \"./dist/lambda.cjs\"\n },\n \"./node\": {\n \"import\": \"./dist/node.js\",\n \"require\": \"./dist/node.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"README.md\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"test\": \"turbo run _test --filter={.}...\",\n \"_test\": \"vitest run\",\n \"build\": \"turbo run _build --filter={.}...\",\n \"_build\": \"tsc --noEmit && tsdown\",\n \"dev\": \"tsc --noEmit --watch\",\n \"clean\": \"rm -rf dist *.tsbuildinfo .turbo\",\n \"check:types\": \"turbo run _check:types --filter={.}...\",\n \"_check:types\": \"tsc --noEmit --project tsconfig.build.json\",\n \"lint\": \"eslint .\",\n \"check:exports\": \"turbo run _check:exports --filter={.}...\",\n \"_check:exports\": \"attw --pack .\",\n \"check:api\": \"turbo run _check:api --filter={.}...\",\n \"_check:api\": \"api-extractor run --local && api-extractor run --local --config api-extractor.fetch.json && api-extractor run --local --config api-extractor.lambda.json && api-extractor run --local --config api-extractor.node.json\",\n \"prepublishOnly\": \"pnpm -w verify\"\n },\n \"dependencies\": {\n \"@restatedev/restate-sdk-core\": \"workspace:*\"\n },\n \"devDependencies\": {\n \"@types/aws-lambda\": \"^8.10.115\"\n },\n \"typesVersions\": {\n \"*\": {\n \"fetch\": [\n \"./dist/fetch.d.ts\"\n ],\n \"lambda\": [\n \"./dist/lambda.d.ts\"\n ],\n \"node\": [\n \"./dist/node.d.ts\"\n ]\n }\n }\n}\n"],"mappings":";cAEa"}
package/dist/promises.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
2
  const require_errors = require('./types/errors.cjs');
3
- const require_completable_promise = require('./utils/completable_promise.cjs');
4
3
  let node_timers_promises = require("node:timers/promises");
5
4
  node_timers_promises = require_rolldown_runtime.__toESM(node_timers_promises);
6
5
 
@@ -30,7 +29,7 @@ function extractContext(n) {
30
29
  var BaseRestatePromise = class extends InternalRestatePromise {
31
30
  [RESTATE_CTX_SYMBOL];
32
31
  pollingPromise;
33
- cancelPromise = new require_completable_promise.CompletablePromise();
32
+ cancelPromise = Promise.withResolvers();
34
33
  constructor(ctx) {
35
34
  super();
36
35
  this[RESTATE_CTX_SYMBOL] = ctx;
@@ -51,7 +50,7 @@ var BaseRestatePromise = class extends InternalRestatePromise {
51
50
  return Promise.race([this.cancelPromise.promise, this.publicPromise()]);
52
51
  }
53
52
  orTimeout(duration) {
54
- return new CombinatorRestatePromise(this[RESTATE_CTX_SYMBOL], ([thisPromise, sleepPromise]) => {
53
+ return new CombinatorRestatePromise(this[RESTATE_CTX_SYMBOL], "Unknown", ([thisPromise, sleepPromise]) => {
55
54
  return new Promise((resolve, reject) => {
56
55
  thisPromise.then(resolve, reject);
57
56
  sleepPromise.then(() => {
@@ -69,14 +68,14 @@ var BaseRestatePromise = class extends InternalRestatePromise {
69
68
  };
70
69
  var SingleRestatePromise = class extends BaseRestatePromise {
71
70
  state = PromiseState.NOT_COMPLETED;
72
- completablePromise = new require_completable_promise.CompletablePromise();
71
+ completablePromise = Promise.withResolvers();
73
72
  constructor(ctx, handle, completer) {
74
73
  super(ctx);
75
74
  this.handle = handle;
76
75
  this.completer = completer;
77
76
  }
78
- uncompletedLeaves() {
79
- return this.state === PromiseState.COMPLETED ? [] : [this.handle];
77
+ unresolvedFuture() {
78
+ return this.state === PromiseState.COMPLETED ? null : { Single: this.handle };
80
79
  }
81
80
  async tryComplete() {
82
81
  if (this.state === PromiseState.COMPLETED) return;
@@ -105,14 +104,15 @@ var InvocationRestatePromise = class extends SingleRestatePromise {
105
104
  var CombinatorRestatePromise = class CombinatorRestatePromise extends BaseRestatePromise {
106
105
  state = PromiseState.NOT_COMPLETED;
107
106
  combinatorPromise;
108
- constructor(ctx, combinatorConstructor, childs) {
107
+ constructor(ctx, combinatorVariant, combinatorConstructor, childs) {
109
108
  super(ctx);
109
+ this.combinatorVariant = combinatorVariant;
110
110
  this.childs = childs;
111
111
  this.combinatorPromise = combinatorConstructor(childs.map((p) => p.publicPromise())).finally(() => {
112
112
  this.state = PromiseState.COMPLETED;
113
113
  });
114
114
  }
115
- static fromPromises(combinatorConstructor, promises) {
115
+ static fromPromises(combinatorVariant, combinatorConstructor, promises) {
116
116
  const castedPromises = [];
117
117
  let foundContext = void 0;
118
118
  for (const [idx, promise] of promises.entries()) {
@@ -125,10 +125,13 @@ var CombinatorRestatePromise = class CombinatorRestatePromise extends BaseRestat
125
125
  castedPromises.push(promise);
126
126
  }
127
127
  if (foundContext === void 0) return ConstRestatePromise.fromPromise(combinatorConstructor(castedPromises), true);
128
- return new CombinatorRestatePromise(foundContext, combinatorConstructor, castedPromises);
128
+ return new CombinatorRestatePromise(foundContext, combinatorVariant, combinatorConstructor, castedPromises);
129
129
  }
130
- uncompletedLeaves() {
131
- return this.state === PromiseState.COMPLETED ? [] : this.childs.flatMap((p) => p.uncompletedLeaves());
130
+ unresolvedFuture() {
131
+ if (this.state === PromiseState.COMPLETED) return null;
132
+ const children = this.childs.map((p) => p.unresolvedFuture()).filter((f) => f !== null);
133
+ if (children.length === 0) return null;
134
+ return { [this.combinatorVariant]: children };
132
135
  }
133
136
  async tryComplete() {
134
137
  await Promise.allSettled(this.childs.map((c) => c.tryComplete()));
@@ -159,8 +162,9 @@ var MappedRestatePromise = class extends BaseRestatePromise {
159
162
  async tryComplete() {
160
163
  await this.inner.tryComplete();
161
164
  }
162
- uncompletedLeaves() {
163
- return this.inner.uncompletedLeaves();
165
+ unresolvedFuture() {
166
+ const inner = this.inner.unresolvedFuture();
167
+ return inner === null ? null : { Unknown: [inner] };
164
168
  }
165
169
  publicPromise() {
166
170
  return this._mappedPromise ??= this.buildMappedPromise();
@@ -221,8 +225,8 @@ var ConstRestatePromise = class ConstRestatePromise extends InternalRestatePromi
221
225
  tryComplete() {
222
226
  return Promise.resolve();
223
227
  }
224
- uncompletedLeaves() {
225
- return [];
228
+ unresolvedFuture() {
229
+ return null;
226
230
  }
227
231
  [Symbol.toStringTag] = "ConstRestatePromise";
228
232
  };
@@ -250,10 +254,10 @@ var PromisesExecutor = class {
250
254
  }
251
255
  return (0, node_timers_promises.setImmediate)().then(async () => {
252
256
  try {
253
- const handles = restatePromise.uncompletedLeaves();
254
- if (handles.length === 0) return;
255
- const doProgressResult = this.coreVm.do_progress(new Uint32Array(handles));
256
- if (doProgressResult === "AnyCompleted") {} else if (doProgressResult === "ReadFromInput" || doProgressResult === "WaitingPendingRun") {
257
+ const unresolvedFuture = restatePromise.unresolvedFuture();
258
+ if (unresolvedFuture === null) return;
259
+ const doProgressResult = this.coreVm.do_progress(unresolvedFuture);
260
+ if (doProgressResult === "AnyCompleted") {} else if (doProgressResult === "WaitExternalProgress") {
257
261
  await this.outputPump.awaitNextProgress();
258
262
  await this.externalProgressChannel.awaitNext();
259
263
  } else if (doProgressResult === "CancelSignalReceived") {
@@ -1 +1 @@
1
- {"version":3,"file":"promises.d.cts","names":[],"sources":["../src/promises.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;iBA+CgB,uBAAuB,QAAQ,UAAU,eAAe"}
1
+ {"version":3,"file":"promises.d.cts","names":[],"sources":["../src/promises.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;iBA8CgB,uBAAuB,QAAQ,UAAU,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"promises.d.ts","names":[],"sources":["../src/promises.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;iBA+CgB,uBAAuB,QAAQ,UAAU,eAAe"}
1
+ {"version":3,"file":"promises.d.ts","names":[],"sources":["../src/promises.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;iBA8CgB,uBAAuB,QAAQ,UAAU,eAAe"}