@restatedev/restate-sdk 1.16.8 → 1.17.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.
- package/dist/common_api.cjs +1 -0
- package/dist/common_api.d.cts +4 -3
- package/dist/common_api.d.cts.map +1 -1
- package/dist/common_api.d.ts +4 -3
- package/dist/common_api.d.ts.map +1 -1
- package/dist/common_api.js +3 -2
- package/dist/common_api.js.map +1 -1
- package/dist/context.d.cts +25 -3
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.ts +25 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/context_impl.cjs +26 -18
- package/dist/context_impl.d.cts +1 -1
- package/dist/context_impl.d.ts +1 -1
- package/dist/context_impl.d.ts.map +1 -1
- package/dist/context_impl.js +26 -18
- package/dist/context_impl.js.map +1 -1
- package/dist/endpoint/node_endpoint.cjs +3 -3
- package/dist/endpoint/node_endpoint.js +3 -3
- package/dist/endpoint/node_endpoint.js.map +1 -1
- package/dist/fetch.cjs +8 -0
- package/dist/fetch.d.cts +4 -3
- package/dist/fetch.d.cts.map +1 -1
- package/dist/fetch.d.ts +4 -3
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +3 -2
- package/dist/fetch.js.map +1 -1
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/lambda.cjs +8 -0
- package/dist/lambda.d.cts +4 -3
- package/dist/lambda.d.cts.map +1 -1
- package/dist/lambda.d.ts +4 -3
- package/dist/lambda.d.ts.map +1 -1
- package/dist/lambda.js +3 -2
- package/dist/lambda.js.map +1 -1
- package/dist/node.cjs +8 -0
- package/dist/node.d.cts +4 -3
- package/dist/node.d.cts.map +1 -1
- package/dist/node.d.ts +4 -3
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +3 -2
- package/dist/node.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/dist/types/interface.cjs +34 -0
- package/dist/types/interface.d.cts +46 -0
- package/dist/types/interface.d.cts.map +1 -0
- package/dist/types/interface.d.ts +46 -0
- package/dist/types/interface.d.ts.map +1 -0
- package/dist/types/interface.js +35 -0
- package/dist/types/interface.js.map +1 -0
- package/dist/types/rpc.cjs +48 -14
- package/dist/types/rpc.d.cts +14 -49
- package/dist/types/rpc.d.cts.map +1 -1
- package/dist/types/rpc.d.ts +14 -49
- package/dist/types/rpc.d.ts.map +1 -1
- package/dist/types/rpc.js +46 -14
- package/dist/types/rpc.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CancelledError, PauseError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
|
|
2
2
|
import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
|
|
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 { Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendClientFromDescriptors, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.cjs";
|
|
4
4
|
import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, ScopedContext, 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";
|
|
8
8
|
import { isRestatePromise } from "./promises.cjs";
|
|
9
|
+
import { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement } from "./types/interface.cjs";
|
|
9
10
|
import { EndpointOptions } from "./endpoint/types.cjs";
|
|
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
|
+
import { CombineablePromise, Descriptor, Duration, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, JournalValueCodec, ObjectDescriptor, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceInterface, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.cjs";
|
|
11
12
|
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, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, 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 };
|
|
13
|
+
export { CancelledError, Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, Descriptor, DurablePromise, Duration, EndpointOptions, FnOf, GenericCall, GenericSend, HandlerDescriptor, Hooks, HooksProvider, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferArg, InferInput, InferOutput, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectDescriptor, ObjectHandler, ObjectHandlerOpts, ObjectImplHandlers, ObjectOptions, ObjectOpts, ObjectPerHandlerOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, SendClient, SendClientFromDescriptors, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceHandlerOpts, ServiceImplHandlers, ServiceInterface, ServiceOptions, ServiceOpts, ServicePerHandlerOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowHandlerOpts, WorkflowImplHandlers, WorkflowOptions, WorkflowOpts, WorkflowPerHandlerOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CancelledError, PauseError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
|
|
2
2
|
import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
|
|
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 { Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendClientFromDescriptors, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
|
|
4
4
|
import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, ScopedContext, 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";
|
|
8
8
|
import { isRestatePromise } from "./promises.js";
|
|
9
|
+
import { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement } from "./types/interface.js";
|
|
9
10
|
import { EndpointOptions } from "./endpoint/types.js";
|
|
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
|
+
import { CombineablePromise, Descriptor, Duration, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, JournalValueCodec, ObjectDescriptor, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceInterface, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.js";
|
|
11
12
|
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, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectHandler, ObjectHandlerOpts, ObjectOptions, ObjectOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, 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 };
|
|
13
|
+
export { CancelledError, Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, Descriptor, DurablePromise, Duration, EndpointOptions, FnOf, GenericCall, GenericSend, HandlerDescriptor, Hooks, HooksProvider, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferArg, InferInput, InferOutput, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectDescriptor, ObjectHandler, ObjectHandlerOpts, ObjectImplHandlers, ObjectOptions, ObjectOpts, ObjectPerHandlerOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, SendClient, SendClientFromDescriptors, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceHandlerOpts, ServiceImplHandlers, ServiceInterface, ServiceOptions, ServiceOpts, ServicePerHandlerOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowHandlerOpts, WorkflowImplHandlers, WorkflowOptions, WorkflowOpts, WorkflowPerHandlerOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import { CancelledError, PauseError, RestateError, RetryableError, TerminalError
|
|
|
2
2
|
import { isRestatePromise } from "./promises.js";
|
|
3
3
|
import { InvocationIdParser, RestatePromise } from "./context.js";
|
|
4
4
|
import { Opts, SendOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
|
|
5
|
+
import { implement } from "./types/interface.js";
|
|
5
6
|
import { internal_exports } from "./internal.js";
|
|
6
|
-
import { CombineablePromise, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, serde } from "./common_api.js";
|
|
7
|
+
import { CombineablePromise, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.js";
|
|
7
8
|
import { createEndpointHandler, endpoint, serve } from "./node.js";
|
|
8
9
|
|
|
9
|
-
export { CancelledError, CombineablePromise, InvocationIdParser, Opts, PauseError, RestateError, RestatePromise, RetryableError, SendOpts, TerminalError, TimeoutError, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
|
10
|
+
export { CancelledError, CombineablePromise, InvocationIdParser, Opts, PauseError, RestateError, RestatePromise, RetryableError, SendOpts, TerminalError, TimeoutError, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
package/dist/lambda.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_errors = require('./types/errors.cjs');
|
|
|
3
3
|
const require_promises = require('./promises.cjs');
|
|
4
4
|
const require_context = require('./context.cjs');
|
|
5
5
|
const require_rpc = require('./types/rpc.cjs');
|
|
6
|
+
const require_interface = require('./types/interface.cjs');
|
|
6
7
|
const require_internal = require('./internal.cjs');
|
|
7
8
|
const require_common_api = require('./common_api.cjs');
|
|
8
9
|
const require_withOptions = require('./endpoint/withOptions.cjs');
|
|
@@ -60,6 +61,13 @@ Object.defineProperty(exports, 'handlers', {
|
|
|
60
61
|
return require_rpc.handlers;
|
|
61
62
|
}
|
|
62
63
|
});
|
|
64
|
+
Object.defineProperty(exports, 'iface', {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return __restatedev_restate_sdk_core.iface;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
exports.implement = require_interface.implement;
|
|
63
71
|
Object.defineProperty(exports, 'internal', {
|
|
64
72
|
enumerable: true,
|
|
65
73
|
get: function () {
|
package/dist/lambda.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CancelledError, PauseError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
|
|
2
2
|
import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
|
|
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 { Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendClientFromDescriptors, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.cjs";
|
|
4
4
|
import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, ScopedContext, 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";
|
|
8
8
|
import { isRestatePromise } from "./promises.cjs";
|
|
9
|
+
import { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement } from "./types/interface.cjs";
|
|
9
10
|
import { EndpointOptions } from "./endpoint/types.cjs";
|
|
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
|
+
import { CombineablePromise, Descriptor, Duration, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, JournalValueCodec, ObjectDescriptor, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceInterface, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.cjs";
|
|
11
12
|
import { LambdaEndpoint } from "./endpoint/lambda_endpoint.cjs";
|
|
12
13
|
|
|
13
14
|
//#region src/lambda.d.ts
|
|
@@ -31,5 +32,5 @@ declare function endpoint(): LambdaEndpoint;
|
|
|
31
32
|
*/
|
|
32
33
|
declare function createEndpointHandler(options: EndpointOptions): (event: any, ctx: any) => Promise<any>;
|
|
33
34
|
//#endregion
|
|
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, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, 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
|
+
export { CancelledError, Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, Descriptor, DurablePromise, Duration, EndpointOptions, FnOf, GenericCall, GenericSend, HandlerDescriptor, Hooks, HooksProvider, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferArg, InferInput, InferOutput, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, type LambdaEndpoint, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectDescriptor, ObjectHandler, ObjectHandlerOpts, ObjectImplHandlers, ObjectOptions, ObjectOpts, ObjectPerHandlerOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, SendClient, SendClientFromDescriptors, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceHandlerOpts, ServiceImplHandlers, ServiceInterface, ServiceOptions, ServiceOpts, ServicePerHandlerOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowHandlerOpts, WorkflowImplHandlers, WorkflowOptions, WorkflowOpts, WorkflowPerHandlerOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
|
|
35
36
|
//# sourceMappingURL=lambda.d.cts.map
|
package/dist/lambda.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.cts","names":[],"sources":["../src/lambda.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lambda.d.cts","names":[],"sources":["../src/lambda.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;iBAwBgB,QAAA,CAAA,GAAY;;;;;;;AAA5B;AAiBA;;;;;;iBAAgB,qBAAA,UAA+B,4CAAe"}
|
package/dist/lambda.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CancelledError, PauseError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
|
|
2
2
|
import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
|
|
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 { Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendClientFromDescriptors, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
|
|
4
4
|
import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, ScopedContext, 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";
|
|
8
8
|
import { isRestatePromise } from "./promises.js";
|
|
9
|
+
import { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement } from "./types/interface.js";
|
|
9
10
|
import { EndpointOptions } from "./endpoint/types.js";
|
|
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
|
+
import { CombineablePromise, Descriptor, Duration, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, JournalValueCodec, ObjectDescriptor, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceInterface, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.js";
|
|
11
12
|
import { LambdaEndpoint } from "./endpoint/lambda_endpoint.js";
|
|
12
13
|
|
|
13
14
|
//#region src/lambda.d.ts
|
|
@@ -31,5 +32,5 @@ declare function endpoint(): LambdaEndpoint;
|
|
|
31
32
|
*/
|
|
32
33
|
declare function createEndpointHandler(options: EndpointOptions): (event: any, ctx: any) => Promise<any>;
|
|
33
34
|
//#endregion
|
|
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, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, 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
|
+
export { CancelledError, Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, Descriptor, DurablePromise, Duration, EndpointOptions, FnOf, GenericCall, GenericSend, HandlerDescriptor, Hooks, HooksProvider, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferArg, InferInput, InferOutput, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, type LambdaEndpoint, LogMetadata, LogSource, LoggerContext, LoggerTransport, ObjectContext, ObjectDescriptor, ObjectHandler, ObjectHandlerOpts, ObjectImplHandlers, ObjectOptions, ObjectOpts, ObjectPerHandlerOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, SendClient, SendClientFromDescriptors, SendOpts, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceHandlerOpts, ServiceImplHandlers, ServiceInterface, ServiceOptions, ServiceOpts, ServicePerHandlerOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowHandlerOpts, WorkflowImplHandlers, WorkflowOptions, WorkflowOpts, WorkflowPerHandlerOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_d_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
|
|
35
36
|
//# sourceMappingURL=lambda.d.ts.map
|
package/dist/lambda.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.ts","names":[],"sources":["../src/lambda.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lambda.d.ts","names":[],"sources":["../src/lambda.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;iBAwBgB,QAAA,CAAA,GAAY;;;;;;;AAA5B;AAiBA;;;;;;iBAAgB,qBAAA,UAA+B,4CAAe"}
|
package/dist/lambda.js
CHANGED
|
@@ -2,8 +2,9 @@ import { CancelledError, PauseError, RestateError, RetryableError, TerminalError
|
|
|
2
2
|
import { isRestatePromise } from "./promises.js";
|
|
3
3
|
import { InvocationIdParser, RestatePromise } from "./context.js";
|
|
4
4
|
import { Opts, SendOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
|
|
5
|
+
import { implement } from "./types/interface.js";
|
|
5
6
|
import { internal_exports } from "./internal.js";
|
|
6
|
-
import { CombineablePromise, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, serde } from "./common_api.js";
|
|
7
|
+
import { CombineablePromise, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.js";
|
|
7
8
|
import { withOptions } from "./endpoint/withOptions.js";
|
|
8
9
|
import { LambdaEndpointImpl } from "./endpoint/lambda_endpoint.js";
|
|
9
10
|
|
|
@@ -33,5 +34,5 @@ function createEndpointHandler(options) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
//#endregion
|
|
36
|
-
export { CancelledError, CombineablePromise, InvocationIdParser, Opts, PauseError, RestateError, RestatePromise, RetryableError, SendOpts, TerminalError, TimeoutError, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
|
|
37
|
+
export { CancelledError, CombineablePromise, InvocationIdParser, Opts, PauseError, RestateError, RestatePromise, RetryableError, SendOpts, TerminalError, TimeoutError, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_exports as internal, isRestatePromise, object, rpc, serde, service, workflow };
|
|
37
38
|
//# sourceMappingURL=lambda.js.map
|
package/dist/lambda.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.js","names":[],"sources":["../src/lambda.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\nexport * from \"./common_api.js\";\n\nimport {\n LambdaEndpointImpl,\n type LambdaEndpoint,\n} from \"./endpoint/lambda_endpoint.js\";\nimport type { EndpointOptions } from \"./endpoint/types.js\";\nimport { withOptions } from \"./endpoint/withOptions.js\";\n\n/**\n * Create a new {@link LambdaEndpoint}.\n * @deprecated Please use {@link createEndpointHandler}\n */\nexport function endpoint(): LambdaEndpoint {\n return new LambdaEndpointImpl();\n}\n\n/**\n * Creates a Lambda handler that encapsulates all the Restate services served by this endpoint.\n *\n * @param {EndpointOptions} options - Configuration options for the endpoint handler.\n * @returns A Lambda handler function.\n *\n * @example\n * A typical endpoint served as Lambda would look like this:\n * ```\n * import { createEndpointHandler } from \"@restatedev/restate-sdk/lambda\";\n *\n * export const handler = createEndpointHandler({ services: [myService] })\n */\nexport function createEndpointHandler(options: EndpointOptions) {\n return withOptions<LambdaEndpoint>(\n new LambdaEndpointImpl(),\n options\n ).handler();\n}\nexport { type LambdaEndpoint } from \"./endpoint/lambda_endpoint.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"lambda.js","names":[],"sources":["../src/lambda.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\nexport * from \"./common_api.js\";\n\nimport {\n LambdaEndpointImpl,\n type LambdaEndpoint,\n} from \"./endpoint/lambda_endpoint.js\";\nimport type { EndpointOptions } from \"./endpoint/types.js\";\nimport { withOptions } from \"./endpoint/withOptions.js\";\n\n/**\n * Create a new {@link LambdaEndpoint}.\n * @deprecated Please use {@link createEndpointHandler}\n */\nexport function endpoint(): LambdaEndpoint {\n return new LambdaEndpointImpl();\n}\n\n/**\n * Creates a Lambda handler that encapsulates all the Restate services served by this endpoint.\n *\n * @param {EndpointOptions} options - Configuration options for the endpoint handler.\n * @returns A Lambda handler function.\n *\n * @example\n * A typical endpoint served as Lambda would look like this:\n * ```\n * import { createEndpointHandler } from \"@restatedev/restate-sdk/lambda\";\n *\n * export const handler = createEndpointHandler({ services: [myService] })\n */\nexport function createEndpointHandler(options: EndpointOptions) {\n return withOptions<LambdaEndpoint>(\n new LambdaEndpointImpl(),\n options\n ).handler();\n}\nexport { type LambdaEndpoint } from \"./endpoint/lambda_endpoint.js\";\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAgB,WAA2B;AACzC,QAAO,IAAI,oBAAoB;;;;;;;;;;;;;;;AAgBjC,SAAgB,sBAAsB,SAA0B;AAC9D,QAAO,YACL,IAAI,oBAAoB,EACxB,QACD,CAAC,SAAS"}
|
package/dist/node.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_errors = require('./types/errors.cjs');
|
|
|
3
3
|
const require_promises = require('./promises.cjs');
|
|
4
4
|
const require_context = require('./context.cjs');
|
|
5
5
|
const require_rpc = require('./types/rpc.cjs');
|
|
6
|
+
const require_interface = require('./types/interface.cjs');
|
|
6
7
|
const require_internal = require('./internal.cjs');
|
|
7
8
|
const require_common_api = require('./common_api.cjs');
|
|
8
9
|
const require_withOptions = require('./endpoint/withOptions.cjs');
|
|
@@ -90,6 +91,13 @@ Object.defineProperty(exports, 'handlers', {
|
|
|
90
91
|
return require_rpc.handlers;
|
|
91
92
|
}
|
|
92
93
|
});
|
|
94
|
+
Object.defineProperty(exports, 'iface', {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () {
|
|
97
|
+
return __restatedev_restate_sdk_core.iface;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
exports.implement = require_interface.implement;
|
|
93
101
|
Object.defineProperty(exports, 'internal', {
|
|
94
102
|
enumerable: true,
|
|
95
103
|
get: function () {
|
package/dist/node.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CancelledError, PauseError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.cjs";
|
|
2
2
|
import { Hooks, HooksProvider, Interceptor } from "./hooks.cjs";
|
|
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 { Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendClientFromDescriptors, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.cjs";
|
|
4
4
|
import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, ScopedContext, 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";
|
|
8
8
|
import { isRestatePromise } from "./promises.cjs";
|
|
9
|
+
import { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement } from "./types/interface.cjs";
|
|
9
10
|
import { EndpointOptions } from "./endpoint/types.cjs";
|
|
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
|
+
import { CombineablePromise, Descriptor, Duration, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, JournalValueCodec, ObjectDescriptor, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceInterface, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.cjs";
|
|
11
12
|
import * as http0 from "http";
|
|
12
13
|
import * as http20 from "http2";
|
|
13
14
|
|
|
@@ -86,5 +87,5 @@ declare function serve({
|
|
|
86
87
|
...options
|
|
87
88
|
}: ServeOptions): Promise<number>;
|
|
88
89
|
//#endregion
|
|
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, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, 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
|
+
export { CancelledError, Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, Descriptor, DurablePromise, Duration, EndpointOptions, FnOf, GenericCall, GenericSend, HandlerDescriptor, Hooks, HooksProvider, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferArg, InferInput, InferOutput, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectDescriptor, ObjectHandler, ObjectHandlerOpts, ObjectImplHandlers, ObjectOptions, ObjectOpts, ObjectPerHandlerOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, SendClient, SendClientFromDescriptors, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceHandlerOpts, ServiceImplHandlers, ServiceInterface, ServiceOptions, ServiceOpts, ServicePerHandlerOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowHandlerOpts, WorkflowImplHandlers, WorkflowOptions, WorkflowOpts, WorkflowPerHandlerOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
|
90
91
|
//# sourceMappingURL=node.d.cts.map
|
package/dist/node.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.cts","names":[],"sources":["../src/node.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.d.cts","names":[],"sources":["../src/node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;iBAqBgB,QAAA,CAAA,GAAY;;;;;;;UAUX,mBAAA,SAA4B;EAV7B;AAUhB;AAsCA;;;;;;;EAQiB,aAAA,CAAA,EAAa,OAAA;AAkB9B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA1BgB,qBAAA,UAA+B;YAAmB,KAAA,CAAA;;;UAQjD,YAAA,SAAqB;;;;;;;;;;;;;;;;;iBAkBtB,KAAA;;;GAA4B,eAAY"}
|
package/dist/node.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CancelledError, PauseError, RestateError, RetryableError, RetryableErrorOptions, TerminalError, TimeoutError } from "./types/errors.js";
|
|
2
2
|
import { Hooks, HooksProvider, Interceptor } from "./hooks.js";
|
|
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 { Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, InferArg, ObjectHandlerOpts, ObjectOptions, ObjectOpts, Opts, RemoveVoidArgument, RetryPolicy, SendClient, SendClientFromDescriptors, SendOpts, ServiceHandlerOpts, ServiceOptions, ServiceOpts, WorkflowHandlerOpts, WorkflowOptions, WorkflowOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
|
|
4
4
|
import { Context, ContextDate, DurablePromise, GenericCall, GenericSend, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, KeyValueStore, ObjectContext, ObjectSharedContext, Rand, Request, RestatePromise, RunAction, RunOptions, ScopedContext, 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";
|
|
8
8
|
import { isRestatePromise } from "./promises.js";
|
|
9
|
+
import { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement } from "./types/interface.js";
|
|
9
10
|
import { EndpointOptions } from "./endpoint/types.js";
|
|
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
|
+
import { CombineablePromise, Descriptor, Duration, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, JournalValueCodec, ObjectDescriptor, ObjectHandler, RestateContext, RestateObjectContext, RestateObjectSharedContext, RestateWorkflowContext, RestateWorkflowSharedContext, Serde, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceInterface, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowSharedHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.js";
|
|
11
12
|
import * as http0 from "http";
|
|
12
13
|
import * as http20 from "http2";
|
|
13
14
|
|
|
@@ -86,5 +87,5 @@ declare function serve({
|
|
|
86
87
|
...options
|
|
87
88
|
}: ServeOptions): Promise<number>;
|
|
88
89
|
//#endregion
|
|
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, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, 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
|
+
export { CancelledError, Client, ClientCallOptions, ClientFromDescriptors, ClientSendOptions, CombineablePromise, Context, ContextDate, DefaultServiceOptions, Descriptor, DurablePromise, Duration, EndpointOptions, FnOf, GenericCall, GenericSend, HandlerDescriptor, Hooks, HooksProvider, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferArg, InferInput, InferOutput, Interceptor, InvocationHandle, InvocationId, InvocationIdParser, InvocationPromise, InvocationReference, JournalValueCodec, KeyValueStore, LogMetadata, LogSource, LoggerContext, LoggerTransport, NodeEndpointOptions, ObjectContext, ObjectDescriptor, ObjectHandler, ObjectHandlerOpts, ObjectImplHandlers, ObjectOptions, ObjectOpts, ObjectPerHandlerOpts, ObjectSharedContext, Opts, PauseError, Rand, RemoveVoidArgument, Request, RestateContext, RestateEndpoint, RestateEndpointBase, RestateError, RestateLogLevel, RestateObjectContext, RestateObjectSharedContext, RestatePromise, RestateWorkflowContext, RestateWorkflowSharedContext, RetryPolicy, RetryableError, RetryableErrorOptions, RunAction, RunOptions, ScopedContext, SendClient, SendClientFromDescriptors, SendOpts, Serde, ServeOptions, Service, ServiceDefinition, ServiceDefinitionFrom, ServiceDescriptor, ServiceHandler, ServiceHandlerOpts, ServiceImplHandlers, ServiceInterface, ServiceOptions, ServiceOpts, ServicePerHandlerOpts, SignalReference, Target, TerminalError, TimeoutError, TypedState, UntypedState, VirtualObject, VirtualObjectDefinition, VirtualObjectDefinitionFrom, Workflow, WorkflowContext, WorkflowDefinition, WorkflowDefinitionFrom, WorkflowDescriptor, WorkflowHandler, WorkflowHandlerOpts, WorkflowImplHandlers, WorkflowOptions, WorkflowOpts, WorkflowPerHandlerOpts, WorkflowSharedContext, WorkflowSharedHandler, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_d_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
|
90
91
|
//# sourceMappingURL=node.d.ts.map
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","names":[],"sources":["../src/node.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.d.ts","names":[],"sources":["../src/node.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;iBAqBgB,QAAA,CAAA,GAAY;;;;;;;UAUX,mBAAA,SAA4B;EAV7B;AAUhB;AAsCA;;;;;;;EAQiB,aAAA,CAAA,EAAa,OAAA;AAkB9B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA1BgB,qBAAA,UAA+B;YAAmB,KAAA,CAAA;;;UAQjD,YAAA,SAAqB;;;;;;;;;;;;;;;;;iBAkBtB,KAAA;;;GAA4B,eAAY"}
|
package/dist/node.js
CHANGED
|
@@ -2,8 +2,9 @@ import { CancelledError, PauseError, RestateError, RetryableError, TerminalError
|
|
|
2
2
|
import { isRestatePromise } from "./promises.js";
|
|
3
3
|
import { InvocationIdParser, RestatePromise } from "./context.js";
|
|
4
4
|
import { Opts, SendOpts, handlers, object, rpc, service, workflow } from "./types/rpc.js";
|
|
5
|
+
import { implement } from "./types/interface.js";
|
|
5
6
|
import { internal_exports } from "./internal.js";
|
|
6
|
-
import { CombineablePromise, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, serde } from "./common_api.js";
|
|
7
|
+
import { CombineablePromise, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, iface, serde } from "./common_api.js";
|
|
7
8
|
import { withOptions } from "./endpoint/withOptions.js";
|
|
8
9
|
import { NodeEndpoint } from "./endpoint/node_endpoint.js";
|
|
9
10
|
|
|
@@ -63,5 +64,5 @@ function serve({ port,...options }) {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
//#endregion
|
|
66
|
-
export { CancelledError, CombineablePromise, InvocationIdParser, Opts, PauseError, RestateError, RestatePromise, RetryableError, SendOpts, TerminalError, TimeoutError, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, internal_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
|
67
|
+
export { CancelledError, CombineablePromise, InvocationIdParser, Opts, PauseError, RestateError, RestatePromise, RetryableError, SendOpts, TerminalError, TimeoutError, createEndpointHandler, createObjectHandler, createObjectSharedHandler, createServiceHandler, createWorkflowHandler, createWorkflowSharedHandler, endpoint, handlers, iface, implement, internal_exports as internal, isRestatePromise, object, rpc, serde, serve, service, workflow };
|
|
67
68
|
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","names":[],"sources":["../src/node.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\nexport * from \"./common_api.js\";\nimport type { RestateEndpoint } from \"./endpoint.js\";\nimport { NodeEndpoint } from \"./endpoint/node_endpoint.js\";\nimport type { EndpointOptions } from \"./endpoint/types.js\";\nimport { withOptions } from \"./endpoint/withOptions.js\";\n\n/**\n * Create a new {@link RestateEndpoint}.\n * @deprecated Please use {@link createEndpointHandler}\n */\nexport function endpoint(): RestateEndpoint {\n return new NodeEndpoint();\n}\n\n/**\n * Options for creating a Node.js endpoint handler.\n *\n * Extends {@link EndpointOptions} with Node.js-specific options for controlling\n * the protocol mode.\n */\nexport interface NodeEndpointOptions extends EndpointOptions {\n /**\n * Controls the protocol mode used by the handler.\n *\n * - `undefined` (default): auto-detect based on HTTP version.\n * HTTP/2+ uses bidirectional streaming (`BIDI_STREAM`),\n * HTTP/1.1 uses request-response mode (`REQUEST_RESPONSE`).\n * - `true`: force `BIDI_STREAM` for all requests.\n * - `false`: force `REQUEST_RESPONSE` for all requests.\n */\n bidirectional?: boolean;\n}\n\n/**\n * Creates a request handler for the provided services.\n *\n * The returned handler auto-detects the HTTP protocol version per request:\n * - HTTP/2+ requests use bidirectional streaming (`BIDI_STREAM`)\n * - HTTP/1.1 requests use request-response mode (`REQUEST_RESPONSE`) by default\n *\n * Set `bidirectional: true` to force `BIDI_STREAM` for all requests, or\n * `bidirectional: false` to force `REQUEST_RESPONSE` for all requests.\n *\n * @example HTTP/2 server\n * ```\n * const httpServer = http2.createServer(createEndpointHandler({ services: [myService] }));\n * httpServer.listen(port);\n * ```\n *\n * @example HTTP/1.1 server\n * ```\n * const httpServer = http.createServer(createEndpointHandler({ services: [myService] }));\n * httpServer.listen(port);\n * ```\n *\n * @param {NodeEndpointOptions} options - Configuration options for the endpoint handler.\n * @returns A request handler function compatible with both HTTP/1.1 and HTTP/2 servers.\n */\nexport function createEndpointHandler(options: NodeEndpointOptions) {\n const { bidirectional, ...endpointOptions } = options;\n return withOptions<RestateEndpoint>(\n new NodeEndpoint(),\n endpointOptions\n ).handler({ bidirectional });\n}\n\nexport interface ServeOptions extends EndpointOptions {\n port?: number;\n}\n\n/**\n * Serves this Restate services as HTTP2 server, listening to the given port.\n *\n * If the port is undefined, this method will use the port set in the `PORT`\n * environment variable. If that variable is undefined as well, the method will\n * default to port 9080.\n *\n * The returned promise resolves with the bound port when the server starts listening, or rejects with a failure otherwise.\n *\n * If you need to manually control the server lifecycle, we suggest to manually instantiate the http2 server and use {@link createEndpointHandler}.\n *\n * @param {ServeOptions} options - Configuration options for the endpoint handler.\n * @returns a Promise that resolves with the bound port, or rejects with a failure otherwise.\n */\nexport function serve({ port, ...options }: ServeOptions) {\n return withOptions<RestateEndpoint>(new NodeEndpoint(), options).listen(port);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.js","names":[],"sources":["../src/node.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\nexport * from \"./common_api.js\";\nimport type { RestateEndpoint } from \"./endpoint.js\";\nimport { NodeEndpoint } from \"./endpoint/node_endpoint.js\";\nimport type { EndpointOptions } from \"./endpoint/types.js\";\nimport { withOptions } from \"./endpoint/withOptions.js\";\n\n/**\n * Create a new {@link RestateEndpoint}.\n * @deprecated Please use {@link createEndpointHandler}\n */\nexport function endpoint(): RestateEndpoint {\n return new NodeEndpoint();\n}\n\n/**\n * Options for creating a Node.js endpoint handler.\n *\n * Extends {@link EndpointOptions} with Node.js-specific options for controlling\n * the protocol mode.\n */\nexport interface NodeEndpointOptions extends EndpointOptions {\n /**\n * Controls the protocol mode used by the handler.\n *\n * - `undefined` (default): auto-detect based on HTTP version.\n * HTTP/2+ uses bidirectional streaming (`BIDI_STREAM`),\n * HTTP/1.1 uses request-response mode (`REQUEST_RESPONSE`).\n * - `true`: force `BIDI_STREAM` for all requests.\n * - `false`: force `REQUEST_RESPONSE` for all requests.\n */\n bidirectional?: boolean;\n}\n\n/**\n * Creates a request handler for the provided services.\n *\n * The returned handler auto-detects the HTTP protocol version per request:\n * - HTTP/2+ requests use bidirectional streaming (`BIDI_STREAM`)\n * - HTTP/1.1 requests use request-response mode (`REQUEST_RESPONSE`) by default\n *\n * Set `bidirectional: true` to force `BIDI_STREAM` for all requests, or\n * `bidirectional: false` to force `REQUEST_RESPONSE` for all requests.\n *\n * @example HTTP/2 server\n * ```\n * const httpServer = http2.createServer(createEndpointHandler({ services: [myService] }));\n * httpServer.listen(port);\n * ```\n *\n * @example HTTP/1.1 server\n * ```\n * const httpServer = http.createServer(createEndpointHandler({ services: [myService] }));\n * httpServer.listen(port);\n * ```\n *\n * @param {NodeEndpointOptions} options - Configuration options for the endpoint handler.\n * @returns A request handler function compatible with both HTTP/1.1 and HTTP/2 servers.\n */\nexport function createEndpointHandler(options: NodeEndpointOptions) {\n const { bidirectional, ...endpointOptions } = options;\n return withOptions<RestateEndpoint>(\n new NodeEndpoint(),\n endpointOptions\n ).handler({ bidirectional });\n}\n\nexport interface ServeOptions extends EndpointOptions {\n port?: number;\n}\n\n/**\n * Serves this Restate services as HTTP2 server, listening to the given port.\n *\n * If the port is undefined, this method will use the port set in the `PORT`\n * environment variable. If that variable is undefined as well, the method will\n * default to port 9080.\n *\n * The returned promise resolves with the bound port when the server starts listening, or rejects with a failure otherwise.\n *\n * If you need to manually control the server lifecycle, we suggest to manually instantiate the http2 server and use {@link createEndpointHandler}.\n *\n * @param {ServeOptions} options - Configuration options for the endpoint handler.\n * @returns a Promise that resolves with the bound port, or rejects with a failure otherwise.\n */\nexport function serve({ port, ...options }: ServeOptions) {\n return withOptions<RestateEndpoint>(new NodeEndpoint(), options).listen(port);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,SAAgB,WAA4B;AAC1C,QAAO,IAAI,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+C3B,SAAgB,sBAAsB,SAA8B;CAClE,MAAM,EAAE,cAAe,GAAG,oBAAoB;AAC9C,QAAO,YACL,IAAI,cAAc,EAClB,gBACD,CAAC,QAAQ,EAAE,eAAe,CAAC;;;;;;;;;;;;;;;;AAqB9B,SAAgB,MAAM,EAAE,KAAM,GAAG,WAAyB;AACxD,QAAO,YAA6B,IAAI,cAAc,EAAE,QAAQ,CAAC,OAAO,KAAK"}
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/dist/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk\",\n \"version\": \"1.
|
|
1
|
+
{"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk\",\n \"version\": \"1.17.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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_rpc = require('./rpc.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/types/interface.ts
|
|
4
|
+
function implement(contract, config) {
|
|
5
|
+
const { handlers: perHandlerOpts,...serviceOptions } = config.options ?? {};
|
|
6
|
+
const coreHandlers = {};
|
|
7
|
+
for (const [name, desc] of Object.entries(contract._handlers)) {
|
|
8
|
+
const fn = config.handlers[name];
|
|
9
|
+
if (typeof fn !== "function") throw new Error(`implement(): missing handler "${name}"`);
|
|
10
|
+
const sdkOpts = {
|
|
11
|
+
input: desc._inputSerde,
|
|
12
|
+
output: desc._outputSerde,
|
|
13
|
+
...perHandlerOpts?.[name] ?? {}
|
|
14
|
+
};
|
|
15
|
+
if (contract._kind === "service") coreHandlers[name] = require_rpc.handlers.handler(sdkOpts, fn);
|
|
16
|
+
else if (contract._kind === "object") coreHandlers[name] = desc._shared ? require_rpc.handlers.object.shared(sdkOpts, fn) : require_rpc.handlers.object.exclusive(sdkOpts, fn);
|
|
17
|
+
else coreHandlers[name] = name === "run" ? require_rpc.handlers.workflow.workflow(sdkOpts, fn) : require_rpc.handlers.workflow.shared(sdkOpts, fn);
|
|
18
|
+
}
|
|
19
|
+
const common = {
|
|
20
|
+
name: contract.name,
|
|
21
|
+
handlers: coreHandlers,
|
|
22
|
+
description: config.description,
|
|
23
|
+
metadata: config.metadata,
|
|
24
|
+
options: serviceOptions
|
|
25
|
+
};
|
|
26
|
+
const def = contract._kind === "service" ? require_rpc.service(common) : contract._kind === "object" ? require_rpc.object(common) : require_rpc.workflow(common);
|
|
27
|
+
return Object.assign(def, {
|
|
28
|
+
_kind: contract._kind,
|
|
29
|
+
_handlers: contract._handlers
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.implement = implement;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ObjectHandlerOpts, ObjectOptions, ServiceHandlerOpts, ServiceOptions, WorkflowHandlerOpts, WorkflowOptions } from "./rpc.cjs";
|
|
2
|
+
import { Context, ObjectContext, ObjectSharedContext, WorkflowContext, WorkflowSharedContext } from "../context.cjs";
|
|
3
|
+
import { HandlerDescriptor, InferInput, InferOutput, ObjectDescriptor, ServiceDefinition, ServiceDescriptor, VirtualObjectDefinition, WorkflowDefinition, WorkflowDescriptor } from "@restatedev/restate-sdk-core";
|
|
4
|
+
|
|
5
|
+
//#region src/types/interface.d.ts
|
|
6
|
+
/** @internal A handler function whose input argument is dropped when `I` is `void`. */
|
|
7
|
+
type FnOf<C, I, O> = [I] extends [void] ? (ctx: C) => Promise<O> : (ctx: C, input: I) => Promise<O>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
type ServiceImplHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: FnOf<Context, InferInput<H[K]>, InferOutput<H[K]>> };
|
|
10
|
+
/** @internal Object handler contexts follow the descriptor's shared flag. */
|
|
11
|
+
type ObjectImplHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: H[K] extends HandlerDescriptor<any, any, infer Shared> ? FnOf<Shared extends true ? ObjectSharedContext : ObjectContext, InferInput<H[K]>, InferOutput<H[K]>> : never };
|
|
12
|
+
/** @internal `run` gets a WorkflowContext; every other handler a shared one. */
|
|
13
|
+
type WorkflowImplHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: K extends "run" ? FnOf<WorkflowContext, InferInput<H[K]>, InferOutput<H[K]>> : FnOf<WorkflowSharedContext, InferInput<H[K]>, InferOutput<H[K]>> };
|
|
14
|
+
/** @internal */
|
|
15
|
+
type ServicePerHandlerOpts = Omit<ServiceHandlerOpts<unknown, unknown>, "input" | "output">;
|
|
16
|
+
/** @internal */
|
|
17
|
+
type ObjectPerHandlerOpts = Omit<ObjectHandlerOpts<unknown, unknown>, "input" | "output">;
|
|
18
|
+
/** @internal */
|
|
19
|
+
type WorkflowPerHandlerOpts = Omit<WorkflowHandlerOpts<unknown, unknown>, "input" | "output">;
|
|
20
|
+
declare function implement<P extends string, H extends Record<string, HandlerDescriptor>>(serviceInterface: ServiceDescriptor<P, H>, config: {
|
|
21
|
+
handlers: ServiceImplHandlers<H>;
|
|
22
|
+
description?: string;
|
|
23
|
+
metadata?: Record<string, string>;
|
|
24
|
+
options?: ServiceOptions & {
|
|
25
|
+
handlers?: Partial<Record<keyof H, ServicePerHandlerOpts>>;
|
|
26
|
+
};
|
|
27
|
+
}): ServiceDefinition<P, ServiceImplHandlers<H>> & ServiceDescriptor<P, H>;
|
|
28
|
+
declare function implement<P extends string, H extends Record<string, HandlerDescriptor>>(objectInterface: ObjectDescriptor<P, H>, config: {
|
|
29
|
+
handlers: ObjectImplHandlers<H>;
|
|
30
|
+
description?: string;
|
|
31
|
+
metadata?: Record<string, string>;
|
|
32
|
+
options?: ObjectOptions & {
|
|
33
|
+
handlers?: Partial<Record<keyof H, ObjectPerHandlerOpts>>;
|
|
34
|
+
};
|
|
35
|
+
}): VirtualObjectDefinition<P, ObjectImplHandlers<H>> & ObjectDescriptor<P, H>;
|
|
36
|
+
declare function implement<P extends string, H extends Record<string, HandlerDescriptor>>(workflowInterface: WorkflowDescriptor<P, H>, config: {
|
|
37
|
+
handlers: WorkflowImplHandlers<H>;
|
|
38
|
+
description?: string;
|
|
39
|
+
metadata?: Record<string, string>;
|
|
40
|
+
options?: WorkflowOptions & {
|
|
41
|
+
handlers?: Partial<Record<keyof H, WorkflowPerHandlerOpts>>;
|
|
42
|
+
};
|
|
43
|
+
}): WorkflowDefinition<P, WorkflowImplHandlers<H>> & WorkflowDescriptor<P, H>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement };
|
|
46
|
+
//# sourceMappingURL=interface.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.cts","names":[],"sources":["../../src/types/interface.ts"],"sourcesContent":[],"mappings":";;;;;;KAmDY,iBAAiB,0BACnB,MAAM,QAAQ,WACd,UAAU,MAAM,QAAQ;AAFlC;AAA6B,KAKjB,mBALiB,CAAA,UAKa,MALb,CAAA,MAAA,EAK4B,iBAL5B,CAAA,CAAA,GAAA,QACnB,MAKI,CALJ,GAKQ,IALR,CAKa,OALb,EAKsB,UALtB,CAKiC,CALjC,CAKmC,CALnC,CAAA,CAAA,EAKwC,WALxC,CAKoD,CALpD,CAKsD,CALtD,CAAA,CAAA,CAAA,EAAc;;AACd,KAQE,kBARF,CAAA,UAQ+B,MAR/B,CAAA,MAAA,EAQ8C,iBAR9C,CAAA,CAAA,GAAA,QAAU,MASN,CATM,GASF,CATE,CASA,CATA,CAAA,SASW,iBATX,CAAA,GAAA,EAAA,GAAA,EAAA,KAAA,OAAA,CAAA,GAUd,IAVc,CAWZ,MAXY,SAAA,IAAA,GAWU,mBAXV,GAWgC,aAXhC,EAYZ,UAZY,CAYD,CAZC,CAYC,CAZD,CAAA,CAAA,EAaZ,WAbY,CAaA,CAbA,CAaE,CAbF,CAAA,CAAA,CAAA,GAAA,KAAA,EAAc;;AAAD,KAmBrB,oBAnBqB,CAAA,UAmBU,MAnBV,CAAA,MAAA,EAmByB,iBAnBzB,CAAA,CAAA,GAAA,QAGrB,MAkBI,CAlBJ,GAkBQ,CAlBR,SAAmB,KAAA,GAmBvB,IAnBuB,CAmBlB,eAnBkB,EAmBD,UAnBC,CAmBU,CAnBV,CAmBY,CAnBZ,CAAA,CAAA,EAmBiB,WAnBjB,CAmB6B,CAnB7B,CAmB+B,CAnB/B,CAAA,CAAA,CAAA,GAoBvB,IApBuB,CAoBlB,qBApBkB,EAoBK,UApBL,CAoBgB,CApBhB,CAoBkB,CApBlB,CAAA,CAAA,EAoBuB,WApBvB,CAoBmC,CApBnC,CAoBqC,CApBrC,CAAA,CAAA,CAAA,EAA0B;;AAC3C,KAuBF,qBAAA,GAAwB,IAvBtB,CAwBZ,kBAxBY,CAAA,OAAA,EAAA,OAAA,CAAA,EAAA,OAAA,GAAA,QAAA,CAAA;;AAA6B,KA4B/B,oBAAA,GAAuB,IA5BQ,CA6BzC,iBA7ByC,CAAA,OAAA,EAAA,OAAA,CAAA,EAAA,OAAA,GAAA,QAAA,CAAA;;AAAX,KAiCpB,sBAAA,GAAyB,IAjCL,CAkC9B,mBAlC8B,CAAA,OAAA,EAAA,OAAA,CAAA,EAAA,OAAA,GAAA,QAAA,CAAA;AAA8B,iBAsC9C,SAtC8C,CAAA,UAAA,MAAA,EAAA,UAwClD,MAxCkD,CAAA,MAAA,EAwCnC,iBAxCmC,CAAA,CAAA,CAAA,gBAAA,EA0C1C,iBA1C0C,CA0CxB,CA1CwB,EA0CrB,CA1CqB,CAAA,EAAA,MAAA,EAAA;EAAE,QAAA,EA4ClD,mBA5CkD,CA4C9B,CA5C8B,CAAA;EAAd,WAAA,CAAA,EAAA,MAAA;EAAhC,QAAA,CAAA,EA8CH,MA9CG,CAAA,MAAA,EAAA,MAAA,CAAA;EAAI,OAAA,CAAA,EA+CR,cA/CQ,GAAA;IAIV,QAAA,CAAA,EA4CK,OA5Ca,CA4CL,MA5CK,CAAA,MA4CQ,CA5CR,EA4CW,qBA5CX,CAAA,CAAA;EAA0B,CAAA;CAAf,CAAA,EA+CtC,iBA/CsC,CA+CpB,CA/CoB,EA+CjB,mBA/CiB,CA+CG,CA/CH,CAAA,CAAA,GA+CS,iBA/CT,CA+C2B,CA/C3B,EA+C8B,CA/C9B,CAAA;AAC3B,iBAgDE,SAhDF,CAAA,UAAA,MAAA,EAAA,UAkDF,MAlDE,CAAA,MAAA,EAkDa,iBAlDb,CAAA,CAAA,CAAA,eAAA,EAoDK,gBApDL,CAoDsB,CApDtB,EAoDyB,CApDzB,CAAA,EAAA,MAAA,EAAA;EAAI,QAAA,EAsDJ,kBAtDI,CAsDe,CAtDf,CAAA;EAAE,WAAA,CAAA,EAAA,MAAA;EAAW,QAAA,CAAA,EAwDhB,MAxDgB,CAAA,MAAA,EAAA,MAAA,CAAA;EAEvB,OAAA,CAAA,EAuDM,aAvDN,GAAA;IAAsB,QAAA,CAAA,EAwDb,OAxDa,CAwDL,MAxDK,CAAA,MAwDQ,CAxDR,EAwDW,oBAxDX,CAAA,CAAA;EAAsB,CAAA;CACjC,CAAA,EA0DhB,uBA1DgB,CA0DQ,CA1DR,EA0DW,kBA1DX,CA0D8B,CA1D9B,CAAA,CAAA,GA0DoC,gBA1DpC,CA0DqD,CA1DrD,EA0DwD,CA1DxD,CAAA;AAAE,iBA4DL,SA5DK,CAAA,UAAA,MAAA,EAAA,UA8DT,MA9DS,CAAA,MAAA,EA8DM,iBA9DN,CAAA,CAAA,CAAA,iBAAA,EAgEA,kBAhEA,CAgEmB,CAhEnB,EAgEsB,CAhEtB,CAAA,EAAA,MAAA,EAAA;EAAb,QAAA,EAkEM,oBAlEN,CAkE2B,CAlE3B,CAAA;EACY,WAAA,CAAA,EAAA,MAAA;EAAE,QAAA,CAAA,EAmEP,MAnEO,CAAA,MAAA,EAAA,MAAA,CAAA;EAAd,OAAA,CAAA,EAoEM,eApEN,GAAA;IAHF,QAAA,CAAA,EAwEW,OAxEX,CAwEmB,MAxEnB,CAAA,MAwEgC,CAxEhC,EAwEmC,sBAxEnC,CAAA,CAAA;EAAI,CAAA;AASV,CAAA,CAAA,EAkEG,kBAlES,CAkEU,CAlEV,EAkEa,oBAlEO,CAkEc,CAlEd,CAAA,CAAA,GAkEoB,kBAlEpB,CAkEuC,CAlEvC,EAkE0C,CAlE1C,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ObjectHandlerOpts, ObjectOptions, ServiceHandlerOpts, ServiceOptions, WorkflowHandlerOpts, WorkflowOptions } from "./rpc.js";
|
|
2
|
+
import { Context, ObjectContext, ObjectSharedContext, WorkflowContext, WorkflowSharedContext } from "../context.js";
|
|
3
|
+
import { HandlerDescriptor, InferInput, InferOutput, ObjectDescriptor, ServiceDefinition, ServiceDescriptor, VirtualObjectDefinition, WorkflowDefinition, WorkflowDescriptor } from "@restatedev/restate-sdk-core";
|
|
4
|
+
|
|
5
|
+
//#region src/types/interface.d.ts
|
|
6
|
+
/** @internal A handler function whose input argument is dropped when `I` is `void`. */
|
|
7
|
+
type FnOf<C, I, O> = [I] extends [void] ? (ctx: C) => Promise<O> : (ctx: C, input: I) => Promise<O>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
type ServiceImplHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: FnOf<Context, InferInput<H[K]>, InferOutput<H[K]>> };
|
|
10
|
+
/** @internal Object handler contexts follow the descriptor's shared flag. */
|
|
11
|
+
type ObjectImplHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: H[K] extends HandlerDescriptor<any, any, infer Shared> ? FnOf<Shared extends true ? ObjectSharedContext : ObjectContext, InferInput<H[K]>, InferOutput<H[K]>> : never };
|
|
12
|
+
/** @internal `run` gets a WorkflowContext; every other handler a shared one. */
|
|
13
|
+
type WorkflowImplHandlers<H extends Record<string, HandlerDescriptor>> = { [K in keyof H]: K extends "run" ? FnOf<WorkflowContext, InferInput<H[K]>, InferOutput<H[K]>> : FnOf<WorkflowSharedContext, InferInput<H[K]>, InferOutput<H[K]>> };
|
|
14
|
+
/** @internal */
|
|
15
|
+
type ServicePerHandlerOpts = Omit<ServiceHandlerOpts<unknown, unknown>, "input" | "output">;
|
|
16
|
+
/** @internal */
|
|
17
|
+
type ObjectPerHandlerOpts = Omit<ObjectHandlerOpts<unknown, unknown>, "input" | "output">;
|
|
18
|
+
/** @internal */
|
|
19
|
+
type WorkflowPerHandlerOpts = Omit<WorkflowHandlerOpts<unknown, unknown>, "input" | "output">;
|
|
20
|
+
declare function implement<P extends string, H extends Record<string, HandlerDescriptor>>(serviceInterface: ServiceDescriptor<P, H>, config: {
|
|
21
|
+
handlers: ServiceImplHandlers<H>;
|
|
22
|
+
description?: string;
|
|
23
|
+
metadata?: Record<string, string>;
|
|
24
|
+
options?: ServiceOptions & {
|
|
25
|
+
handlers?: Partial<Record<keyof H, ServicePerHandlerOpts>>;
|
|
26
|
+
};
|
|
27
|
+
}): ServiceDefinition<P, ServiceImplHandlers<H>> & ServiceDescriptor<P, H>;
|
|
28
|
+
declare function implement<P extends string, H extends Record<string, HandlerDescriptor>>(objectInterface: ObjectDescriptor<P, H>, config: {
|
|
29
|
+
handlers: ObjectImplHandlers<H>;
|
|
30
|
+
description?: string;
|
|
31
|
+
metadata?: Record<string, string>;
|
|
32
|
+
options?: ObjectOptions & {
|
|
33
|
+
handlers?: Partial<Record<keyof H, ObjectPerHandlerOpts>>;
|
|
34
|
+
};
|
|
35
|
+
}): VirtualObjectDefinition<P, ObjectImplHandlers<H>> & ObjectDescriptor<P, H>;
|
|
36
|
+
declare function implement<P extends string, H extends Record<string, HandlerDescriptor>>(workflowInterface: WorkflowDescriptor<P, H>, config: {
|
|
37
|
+
handlers: WorkflowImplHandlers<H>;
|
|
38
|
+
description?: string;
|
|
39
|
+
metadata?: Record<string, string>;
|
|
40
|
+
options?: WorkflowOptions & {
|
|
41
|
+
handlers?: Partial<Record<keyof H, WorkflowPerHandlerOpts>>;
|
|
42
|
+
};
|
|
43
|
+
}): WorkflowDefinition<P, WorkflowImplHandlers<H>> & WorkflowDescriptor<P, H>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { FnOf, ObjectImplHandlers, ObjectPerHandlerOpts, ServiceImplHandlers, ServicePerHandlerOpts, WorkflowImplHandlers, WorkflowPerHandlerOpts, implement };
|
|
46
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","names":[],"sources":["../../src/types/interface.ts"],"sourcesContent":[],"mappings":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { handlers, object, service, workflow } from "./rpc.js";
|
|
2
|
+
|
|
3
|
+
//#region src/types/interface.ts
|
|
4
|
+
function implement(contract, config) {
|
|
5
|
+
const { handlers: perHandlerOpts,...serviceOptions } = config.options ?? {};
|
|
6
|
+
const coreHandlers = {};
|
|
7
|
+
for (const [name, desc] of Object.entries(contract._handlers)) {
|
|
8
|
+
const fn = config.handlers[name];
|
|
9
|
+
if (typeof fn !== "function") throw new Error(`implement(): missing handler "${name}"`);
|
|
10
|
+
const sdkOpts = {
|
|
11
|
+
input: desc._inputSerde,
|
|
12
|
+
output: desc._outputSerde,
|
|
13
|
+
...perHandlerOpts?.[name] ?? {}
|
|
14
|
+
};
|
|
15
|
+
if (contract._kind === "service") coreHandlers[name] = handlers.handler(sdkOpts, fn);
|
|
16
|
+
else if (contract._kind === "object") coreHandlers[name] = desc._shared ? handlers.object.shared(sdkOpts, fn) : handlers.object.exclusive(sdkOpts, fn);
|
|
17
|
+
else coreHandlers[name] = name === "run" ? handlers.workflow.workflow(sdkOpts, fn) : handlers.workflow.shared(sdkOpts, fn);
|
|
18
|
+
}
|
|
19
|
+
const common = {
|
|
20
|
+
name: contract.name,
|
|
21
|
+
handlers: coreHandlers,
|
|
22
|
+
description: config.description,
|
|
23
|
+
metadata: config.metadata,
|
|
24
|
+
options: serviceOptions
|
|
25
|
+
};
|
|
26
|
+
const def = contract._kind === "service" ? service(common) : contract._kind === "object" ? object(common) : workflow(common);
|
|
27
|
+
return Object.assign(def, {
|
|
28
|
+
_kind: contract._kind,
|
|
29
|
+
_handlers: contract._handlers
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { implement };
|
|
35
|
+
//# sourceMappingURL=interface.js.map
|