@restatedev/restate-sdk-core 1.17.1 → 1.17.2
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/index.d.cts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/interface.cjs +24 -16
- package/dist/interface.d.cts +37 -11
- package/dist/interface.d.cts.map +1 -1
- package/dist/interface.d.ts +36 -10
- package/dist/interface.d.ts.map +1 -1
- package/dist/interface.js +35 -15
- package/dist/interface.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3,5 +3,5 @@ import { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 } from "./stand
|
|
|
3
3
|
import { Serde, serde } from "./serde_api.cjs";
|
|
4
4
|
import { Duration, durationToMillis, millisOrDurationToMillis } from "./duration.cjs";
|
|
5
5
|
import { JournalValueCodec } from "./entry_codec.cjs";
|
|
6
|
-
import { Descriptor, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, ObjectDescriptor, SerdeType, ServiceDescriptor, ServiceInterface, WorkflowDescriptor, iface, makeHandlerDescriptor } from "./interface.cjs";
|
|
7
|
-
export { type ArgType, type Descriptor, type Duration, type HandlerDescriptor, type HandlerReturnType, type ImplementedDefinition, type ImplementedObjectDefinition, type ImplementedServiceDefinition, type ImplementedWorkflowDefinition, type InferInput, type InferOutput, type JournalValueCodec, type ObjectDescriptor, type ObjectHandler, type ObjectSharedHandler, type RestateContext, type RestateObjectContext, type RestateObjectSharedContext, type RestateWorkflowContext, type RestateWorkflowSharedContext, type Serde, type SerdeType, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type ServiceDescriptor, type ServiceHandler, type ServiceInterface, type StandardJSONSchemaV1, type StandardSchemaV1, type StandardTypedV1, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowDescriptor, type WorkflowHandler, type WorkflowSharedHandler, durationToMillis, iface, makeHandlerDescriptor, millisOrDurationToMillis, serde };
|
|
6
|
+
import { Descriptor, DescriptorOpts, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, ObjectDescriptor, SerdeType, ServiceDescriptor, ServiceInterface, WorkflowDescriptor, iface, makeHandlerDescriptor } from "./interface.cjs";
|
|
7
|
+
export { type ArgType, type Descriptor, type DescriptorOpts, type Duration, type HandlerDescriptor, type HandlerReturnType, type ImplementedDefinition, type ImplementedObjectDefinition, type ImplementedServiceDefinition, type ImplementedWorkflowDefinition, type InferInput, type InferOutput, type JournalValueCodec, type ObjectDescriptor, type ObjectHandler, type ObjectSharedHandler, type RestateContext, type RestateObjectContext, type RestateObjectSharedContext, type RestateWorkflowContext, type RestateWorkflowSharedContext, type Serde, type SerdeType, type Service, type ServiceDefinition, type ServiceDefinitionFrom, type ServiceDescriptor, type ServiceHandler, type ServiceInterface, type StandardJSONSchemaV1, type StandardSchemaV1, type StandardTypedV1, type VirtualObject, type VirtualObjectDefinition, type VirtualObjectDefinitionFrom, type Workflow, type WorkflowDefinition, type WorkflowDefinitionFrom, type WorkflowDescriptor, type WorkflowHandler, type WorkflowSharedHandler, durationToMillis, iface, makeHandlerDescriptor, millisOrDurationToMillis, serde };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export { durationToMillis, millisOrDurationToMillis } from "./duration.js";
|
|
|
6
6
|
export type { JournalValueCodec } from "./entry_codec.js";
|
|
7
7
|
export type { StandardTypedV1, StandardSchemaV1, StandardJSONSchemaV1, } from "./standard_schema.js";
|
|
8
8
|
export { iface, makeHandlerDescriptor } from "./interface.js";
|
|
9
|
-
export type { ServiceInterface, HandlerDescriptor, Descriptor, ServiceDescriptor, ObjectDescriptor, WorkflowDescriptor, ImplementedServiceDefinition, ImplementedObjectDefinition, ImplementedWorkflowDefinition, ImplementedDefinition, InferInput, InferOutput, SerdeType, } from "./interface.js";
|
|
9
|
+
export type { ServiceInterface, DescriptorOpts, HandlerDescriptor, Descriptor, ServiceDescriptor, ObjectDescriptor, WorkflowDescriptor, ImplementedServiceDefinition, ImplementedObjectDefinition, ImplementedWorkflowDefinition, ImplementedDefinition, InferInput, InferOutput, SerdeType, } from "./interface.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,QAAQ,EACR,sBAAsB,EACtB,OAAO,EACP,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAE3E,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,6BAA6B,EAC7B,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,YAAY,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,QAAQ,EACR,sBAAsB,EACtB,OAAO,EACP,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAE3E,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC3B,6BAA6B,EAC7B,qBAAqB,EACrB,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,gBAAgB,CAAC"}
|
package/dist/interface.cjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const require_serde_api = require('./serde_api.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/interface.ts
|
|
4
|
-
function makeHandlerDescriptor(inputSerde, outputSerde, shared) {
|
|
4
|
+
function makeHandlerDescriptor(inputSerde, outputSerde, shared, opts) {
|
|
5
5
|
return {
|
|
6
6
|
_inputSerde: inputSerde,
|
|
7
7
|
_outputSerde: outputSerde,
|
|
8
|
-
_shared: shared
|
|
8
|
+
_shared: shared,
|
|
9
|
+
_description: opts?.description,
|
|
10
|
+
_metadata: opts?.metadata
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
@@ -23,45 +25,51 @@ function makeHandlerDescriptor(inputSerde, outputSerde, shared) {
|
|
|
23
25
|
* ```
|
|
24
26
|
*/
|
|
25
27
|
const iface = {
|
|
26
|
-
service: function(name, handlers) {
|
|
28
|
+
service: function(name, handlers, opts) {
|
|
27
29
|
return {
|
|
28
30
|
name,
|
|
29
31
|
_kind: "service",
|
|
30
|
-
_handlers: handlers
|
|
32
|
+
_handlers: handlers,
|
|
33
|
+
_description: opts?.description,
|
|
34
|
+
_metadata: opts?.metadata
|
|
31
35
|
};
|
|
32
36
|
},
|
|
33
|
-
object: function(name, handlers) {
|
|
37
|
+
object: function(name, handlers, opts) {
|
|
34
38
|
return {
|
|
35
39
|
name,
|
|
36
40
|
_kind: "object",
|
|
37
|
-
_handlers: handlers
|
|
41
|
+
_handlers: handlers,
|
|
42
|
+
_description: opts?.description,
|
|
43
|
+
_metadata: opts?.metadata
|
|
38
44
|
};
|
|
39
45
|
},
|
|
40
|
-
workflow: function(name, handlers) {
|
|
46
|
+
workflow: function(name, handlers, opts) {
|
|
41
47
|
return {
|
|
42
48
|
name,
|
|
43
49
|
_kind: "workflow",
|
|
44
|
-
_handlers: handlers
|
|
50
|
+
_handlers: handlers,
|
|
51
|
+
_description: opts?.description,
|
|
52
|
+
_metadata: opts?.metadata
|
|
45
53
|
};
|
|
46
54
|
},
|
|
47
|
-
json: function() {
|
|
48
|
-
return makeHandlerDescriptor(void 0, void 0, false);
|
|
55
|
+
json: function(opts) {
|
|
56
|
+
return makeHandlerDescriptor(void 0, void 0, false, opts);
|
|
49
57
|
},
|
|
50
58
|
serdes: function(opts) {
|
|
51
|
-
return makeHandlerDescriptor(opts.input, opts.output, false);
|
|
59
|
+
return makeHandlerDescriptor(opts.input, opts.output, false, opts);
|
|
52
60
|
},
|
|
53
61
|
schemas: function(opts) {
|
|
54
|
-
return makeHandlerDescriptor(opts.input ? require_serde_api.serde.schema(opts.input) : void 0, opts.output ? require_serde_api.serde.schema(opts.output) : void 0, false);
|
|
62
|
+
return makeHandlerDescriptor(opts.input ? require_serde_api.serde.schema(opts.input) : void 0, opts.output ? require_serde_api.serde.schema(opts.output) : void 0, false, opts);
|
|
55
63
|
},
|
|
56
64
|
shared: {
|
|
57
|
-
json: function() {
|
|
58
|
-
return makeHandlerDescriptor(void 0, void 0, true);
|
|
65
|
+
json: function(opts) {
|
|
66
|
+
return makeHandlerDescriptor(void 0, void 0, true, opts);
|
|
59
67
|
},
|
|
60
68
|
serdes: function(opts) {
|
|
61
|
-
return makeHandlerDescriptor(opts.input, opts.output, true);
|
|
69
|
+
return makeHandlerDescriptor(opts.input, opts.output, true, opts);
|
|
62
70
|
},
|
|
63
71
|
schemas: function(opts) {
|
|
64
|
-
return makeHandlerDescriptor(opts.input ? require_serde_api.serde.schema(opts.input) : void 0, opts.output ? require_serde_api.serde.schema(opts.output) : void 0, true);
|
|
72
|
+
return makeHandlerDescriptor(opts.input ? require_serde_api.serde.schema(opts.input) : void 0, opts.output ? require_serde_api.serde.schema(opts.output) : void 0, true, opts);
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
};
|
package/dist/interface.d.cts
CHANGED
|
@@ -4,6 +4,24 @@ import { Serde } from "./serde_api.cjs";
|
|
|
4
4
|
|
|
5
5
|
//#region src/interface.d.ts
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Documentation and metadata that can be attached to a service/object/workflow
|
|
9
|
+
* contract or to a single handler declared with {@link iface}.
|
|
10
|
+
*
|
|
11
|
+
* These values are advisory: they are folded into the service definition when the
|
|
12
|
+
* contract is implemented (see `implement()`), and surface in the discovery manifest
|
|
13
|
+
* as `documentation` (from {@link description}) and `metadata`.
|
|
14
|
+
*/
|
|
15
|
+
type DescriptorOpts = {
|
|
16
|
+
/**
|
|
17
|
+
* Human-readable description, shown in documentation/admin tools.
|
|
18
|
+
*/
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Arbitrary key/value metadata, exposed via the Admin API.
|
|
22
|
+
*/
|
|
23
|
+
metadata?: Record<string, string>;
|
|
24
|
+
};
|
|
7
25
|
/**
|
|
8
26
|
* Minimal descriptor stored in {@link Descriptor}._handlers per handler.
|
|
9
27
|
*/
|
|
@@ -12,8 +30,12 @@ type HandlerDescriptor<I$1 = any, O$1 = any, Shared extends boolean = boolean> =
|
|
|
12
30
|
readonly _outputSerde?: Serde<O$1>;
|
|
13
31
|
/** @internal virtual-object handler shared/exclusive marker (phantom + runtime) */
|
|
14
32
|
readonly _shared?: Shared;
|
|
33
|
+
/** @internal handler description declared on the contract */
|
|
34
|
+
readonly _description?: string;
|
|
35
|
+
/** @internal handler metadata declared on the contract */
|
|
36
|
+
readonly _metadata?: Record<string, string>;
|
|
15
37
|
};
|
|
16
|
-
declare function makeHandlerDescriptor<I$1, O$1, Shared extends boolean = false>(inputSerde?: Serde<I$1>, outputSerde?: Serde<O$1>, shared?: Shared): HandlerDescriptor<I$1, O$1, Shared>;
|
|
38
|
+
declare function makeHandlerDescriptor<I$1, O$1, Shared extends boolean = false>(inputSerde?: Serde<I$1>, outputSerde?: Serde<O$1>, shared?: Shared, opts?: DescriptorOpts): HandlerDescriptor<I$1, O$1, Shared>;
|
|
17
39
|
/** Recover the input type declared by a {@link HandlerDescriptor}. */
|
|
18
40
|
type InferInput<D> = D extends HandlerDescriptor<infer I, any, any> ? I : any;
|
|
19
41
|
/** Recover the output type declared by a {@link HandlerDescriptor}. */
|
|
@@ -24,6 +46,10 @@ type Descriptor<P extends string = string, H extends Record<string, HandlerDescr
|
|
|
24
46
|
readonly name: P;
|
|
25
47
|
readonly _kind: Kind;
|
|
26
48
|
readonly _handlers: H;
|
|
49
|
+
/** @internal service description declared on the contract */
|
|
50
|
+
readonly _description?: string;
|
|
51
|
+
/** @internal service metadata declared on the contract */
|
|
52
|
+
readonly _metadata?: Record<string, string>;
|
|
27
53
|
};
|
|
28
54
|
type ServiceDescriptor<P extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P, H, "service">;
|
|
29
55
|
type ObjectDescriptor<P extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P, H, "object">;
|
|
@@ -35,32 +61,32 @@ type ImplementedWorkflowDefinition<P extends string, H extends Record<string, Ha
|
|
|
35
61
|
type ImplementedDefinition<P extends string, H extends Record<string, HandlerDescriptor>, Kind extends "service" | "object" | "workflow"> = Kind extends "service" ? ImplementedServiceDefinition<P, H> : Kind extends "object" ? ImplementedObjectDefinition<P, H> : ImplementedWorkflowDefinition<P, H>;
|
|
36
62
|
/** The shape of the {@link iface} service-interface declaration API. */
|
|
37
63
|
interface ServiceInterface {
|
|
38
|
-
service<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H): ServiceDescriptor<P, H>;
|
|
39
|
-
object<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H): ObjectDescriptor<P, H>;
|
|
40
|
-
workflow<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H): WorkflowDescriptor<P, H>;
|
|
64
|
+
service<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H, opts?: DescriptorOpts): ServiceDescriptor<P, H>;
|
|
65
|
+
object<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H, opts?: DescriptorOpts): ObjectDescriptor<P, H>;
|
|
66
|
+
workflow<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H, opts?: DescriptorOpts): WorkflowDescriptor<P, H>;
|
|
41
67
|
/** `json<I, O>()` — type params, default JSON serde. */
|
|
42
|
-
json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1, false>;
|
|
68
|
+
json<I$1 = void, O$1 = void>(opts?: DescriptorOpts): HandlerDescriptor<I$1, O$1, false>;
|
|
43
69
|
/** `serdes({ input, output })` — explicit Serde per direction. */
|
|
44
70
|
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
45
71
|
input?: SI;
|
|
46
72
|
output?: SO;
|
|
47
|
-
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, false>;
|
|
73
|
+
} & DescriptorOpts): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, false>;
|
|
48
74
|
/** `schemas({ input, output })` — Standard Schema per direction. */
|
|
49
75
|
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
50
76
|
input?: SI;
|
|
51
77
|
output?: SO;
|
|
52
|
-
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, false>;
|
|
78
|
+
} & DescriptorOpts): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, false>;
|
|
53
79
|
/** Shared (read-only) virtual-object / non-`run` workflow handler declarators. */
|
|
54
80
|
shared: {
|
|
55
|
-
json<I$1 = void, O$1 = void>(): HandlerDescriptor<I$1, O$1, true>;
|
|
81
|
+
json<I$1 = void, O$1 = void>(opts?: DescriptorOpts): HandlerDescriptor<I$1, O$1, true>;
|
|
56
82
|
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
57
83
|
input?: SI;
|
|
58
84
|
output?: SO;
|
|
59
|
-
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, true>;
|
|
85
|
+
} & DescriptorOpts): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, true>;
|
|
60
86
|
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
61
87
|
input?: SI;
|
|
62
88
|
output?: SO;
|
|
63
|
-
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, true>;
|
|
89
|
+
} & DescriptorOpts): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, true>;
|
|
64
90
|
};
|
|
65
91
|
}
|
|
66
92
|
/**
|
|
@@ -79,5 +105,5 @@ interface ServiceInterface {
|
|
|
79
105
|
*/
|
|
80
106
|
declare const iface: ServiceInterface;
|
|
81
107
|
//#endregion
|
|
82
|
-
export { Descriptor, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, ObjectDescriptor, SerdeType, ServiceDescriptor, ServiceInterface, WorkflowDescriptor, iface, makeHandlerDescriptor };
|
|
108
|
+
export { Descriptor, DescriptorOpts, HandlerDescriptor, ImplementedDefinition, ImplementedObjectDefinition, ImplementedServiceDefinition, ImplementedWorkflowDefinition, InferInput, InferOutput, ObjectDescriptor, SerdeType, ServiceDescriptor, ServiceInterface, WorkflowDescriptor, iface, makeHandlerDescriptor };
|
|
83
109
|
//# sourceMappingURL=interface.d.cts.map
|
package/dist/interface.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.cts","names":[],"sources":["../src/interface.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"interface.d.cts","names":[],"sources":["../src/interface.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA6BA;AAcA;;;;;AAQqB,KAtBT,cAAA,GAsBS;EAIE;;AAGvB;EACqB,WAAA,CAAA,EAAA,MAAA;EAAN;;;EAEJ,QAAA,CAAA,EAxBE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AA,CAAA,MAAA,IAAA,EAAA,MAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAsED,cAtEC,CAAA,EAuEP,iBAvEO,CAuEW,GAvEX,EAuEc,GAvEd,EAAA,IAAA,CAAA;IAGF,MAAA,CAAA,WAqEU,KArEV,CAAA,GAA4B,CAAA,EAAA,WAqEK,KArEL,CAAA,GAAA,CAAA,CAAA,CAAA,IAAA,EAAA;MAEb,KAAA,CAAA,EAqEX,EArEW;MAAf,MAAA,CAAA,EAsEK,EAtEL;IACU,CAAA,GAsEZ,cAtEY,CAAA,EAuEf,iBAvEe,CAuEG,SAvEH,CAuEa,EAvEb,CAAA,EAuEkB,SAvElB,CAuE4B,EAvE5B,CAAA,EAAA,IAAA,CAAA;IAAlB,OAAA,CAAA,WAwEmB,gBAxEnB,CAAA,GAAA,CAAA,EAAA,WAwEqD,gBAxErD,CAAA,GAAA,CAAA,CAAA,CAAA,IAAA,EAAA;MAA8C,KAAA,CAAA,EA0ElC,EA1EkC;MAAG,MAAA,CAAA,EA2EpC,EA3EoC;IAArB,CAAA,GA4EtB,cA5EsB,CAAA,EA6EzB,iBA7EyB,CA8E1B,gBAAA,CAAiB,WA9ES,CA8EG,WA9EH,CA8Ee,EA9Ef,CAAA,CAAA,EA+E1B,gBAAA,CAAiB,WA/ES,CA+EG,WA/EH,CA+Ee,EA/Ef,CAAA,CAAA,EAAA,IAAA,CAAA;EAAiB,CAAA;AAEjD;;;;;;;;;AAKA;;;;;;AAGuD,cAyF1C,KAzF0C,EAyFnC,gBAzFmC"}
|
package/dist/interface.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import type { Serde } from "./serde_api.js";
|
|
2
2
|
import type { StandardSchemaV1 } from "./standard_schema.js";
|
|
3
3
|
import type { ServiceDefinition, VirtualObjectDefinition, WorkflowDefinition } from "./core.js";
|
|
4
|
+
/**
|
|
5
|
+
* Documentation and metadata that can be attached to a service/object/workflow
|
|
6
|
+
* contract or to a single handler declared with {@link iface}.
|
|
7
|
+
*
|
|
8
|
+
* These values are advisory: they are folded into the service definition when the
|
|
9
|
+
* contract is implemented (see `implement()`), and surface in the discovery manifest
|
|
10
|
+
* as `documentation` (from {@link description}) and `metadata`.
|
|
11
|
+
*/
|
|
12
|
+
export type DescriptorOpts = {
|
|
13
|
+
/**
|
|
14
|
+
* Human-readable description, shown in documentation/admin tools.
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Arbitrary key/value metadata, exposed via the Admin API.
|
|
19
|
+
*/
|
|
20
|
+
metadata?: Record<string, string>;
|
|
21
|
+
};
|
|
4
22
|
/**
|
|
5
23
|
* Minimal descriptor stored in {@link Descriptor}._handlers per handler.
|
|
6
24
|
*/
|
|
@@ -9,8 +27,12 @@ export type HandlerDescriptor<I = any, O = any, Shared extends boolean = boolean
|
|
|
9
27
|
readonly _outputSerde?: Serde<O>;
|
|
10
28
|
/** @internal virtual-object handler shared/exclusive marker (phantom + runtime) */
|
|
11
29
|
readonly _shared?: Shared;
|
|
30
|
+
/** @internal handler description declared on the contract */
|
|
31
|
+
readonly _description?: string;
|
|
32
|
+
/** @internal handler metadata declared on the contract */
|
|
33
|
+
readonly _metadata?: Record<string, string>;
|
|
12
34
|
};
|
|
13
|
-
export declare function makeHandlerDescriptor<I, O, Shared extends boolean = false>(inputSerde?: Serde<I>, outputSerde?: Serde<O>, shared?: Shared): HandlerDescriptor<I, O, Shared>;
|
|
35
|
+
export declare function makeHandlerDescriptor<I, O, Shared extends boolean = false>(inputSerde?: Serde<I>, outputSerde?: Serde<O>, shared?: Shared, opts?: DescriptorOpts): HandlerDescriptor<I, O, Shared>;
|
|
14
36
|
/** Recover the input type declared by a {@link HandlerDescriptor}. */
|
|
15
37
|
export type InferInput<D> = D extends HandlerDescriptor<infer I, any, any> ? I : any;
|
|
16
38
|
/** Recover the output type declared by a {@link HandlerDescriptor}. */
|
|
@@ -21,6 +43,10 @@ export type Descriptor<P extends string = string, H extends Record<string, Handl
|
|
|
21
43
|
readonly name: P;
|
|
22
44
|
readonly _kind: Kind;
|
|
23
45
|
readonly _handlers: H;
|
|
46
|
+
/** @internal service description declared on the contract */
|
|
47
|
+
readonly _description?: string;
|
|
48
|
+
/** @internal service metadata declared on the contract */
|
|
49
|
+
readonly _metadata?: Record<string, string>;
|
|
24
50
|
};
|
|
25
51
|
export type ServiceDescriptor<P extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P, H, "service">;
|
|
26
52
|
export type ObjectDescriptor<P extends string = string, H extends Record<string, HandlerDescriptor> = Record<string, HandlerDescriptor>> = Descriptor<P, H, "object">;
|
|
@@ -32,32 +58,32 @@ export type ImplementedWorkflowDefinition<P extends string, H extends Record<str
|
|
|
32
58
|
export type ImplementedDefinition<P extends string, H extends Record<string, HandlerDescriptor>, Kind extends "service" | "object" | "workflow"> = Kind extends "service" ? ImplementedServiceDefinition<P, H> : Kind extends "object" ? ImplementedObjectDefinition<P, H> : ImplementedWorkflowDefinition<P, H>;
|
|
33
59
|
/** The shape of the {@link iface} service-interface declaration API. */
|
|
34
60
|
export interface ServiceInterface {
|
|
35
|
-
service<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H): ServiceDescriptor<P, H>;
|
|
36
|
-
object<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H): ObjectDescriptor<P, H>;
|
|
37
|
-
workflow<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H): WorkflowDescriptor<P, H>;
|
|
61
|
+
service<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H, opts?: DescriptorOpts): ServiceDescriptor<P, H>;
|
|
62
|
+
object<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H, opts?: DescriptorOpts): ObjectDescriptor<P, H>;
|
|
63
|
+
workflow<P extends string, H extends Record<string, HandlerDescriptor>>(name: P, handlers: H, opts?: DescriptorOpts): WorkflowDescriptor<P, H>;
|
|
38
64
|
/** `json<I, O>()` — type params, default JSON serde. */
|
|
39
|
-
json<I = void, O = void>(): HandlerDescriptor<I, O, false>;
|
|
65
|
+
json<I = void, O = void>(opts?: DescriptorOpts): HandlerDescriptor<I, O, false>;
|
|
40
66
|
/** `serdes({ input, output })` — explicit Serde per direction. */
|
|
41
67
|
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
42
68
|
input?: SI;
|
|
43
69
|
output?: SO;
|
|
44
|
-
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, false>;
|
|
70
|
+
} & DescriptorOpts): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, false>;
|
|
45
71
|
/** `schemas({ input, output })` — Standard Schema per direction. */
|
|
46
72
|
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
47
73
|
input?: SI;
|
|
48
74
|
output?: SO;
|
|
49
|
-
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, false>;
|
|
75
|
+
} & DescriptorOpts): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, false>;
|
|
50
76
|
/** Shared (read-only) virtual-object / non-`run` workflow handler declarators. */
|
|
51
77
|
shared: {
|
|
52
|
-
json<I = void, O = void>(): HandlerDescriptor<I, O, true>;
|
|
78
|
+
json<I = void, O = void>(opts?: DescriptorOpts): HandlerDescriptor<I, O, true>;
|
|
53
79
|
serdes<SI extends Serde<any>, SO extends Serde<any>>(opts: {
|
|
54
80
|
input?: SI;
|
|
55
81
|
output?: SO;
|
|
56
|
-
}): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, true>;
|
|
82
|
+
} & DescriptorOpts): HandlerDescriptor<SerdeType<SI>, SerdeType<SO>, true>;
|
|
57
83
|
schemas<SI extends StandardSchemaV1<any>, SO extends StandardSchemaV1<any>>(opts: {
|
|
58
84
|
input?: SI;
|
|
59
85
|
output?: SO;
|
|
60
|
-
}): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, true>;
|
|
86
|
+
} & DescriptorOpts): HandlerDescriptor<StandardSchemaV1.InferOutput<NonNullable<SI>>, StandardSchemaV1.InferOutput<NonNullable<SO>>, true>;
|
|
61
87
|
};
|
|
62
88
|
}
|
|
63
89
|
/**
|
package/dist/interface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAC3B,CAAC,GAAG,GAAG,EACP,CAAC,GAAG,GAAG,EACP,MAAM,SAAS,OAAO,GAAG,OAAO,IAC9B;IACF,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,mFAAmF;IACnF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,MAAM,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
|
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
12
|
import { serde } from "./serde_api.js";
|
|
13
|
-
export function makeHandlerDescriptor(inputSerde, outputSerde, shared) {
|
|
13
|
+
export function makeHandlerDescriptor(inputSerde, outputSerde, shared, opts) {
|
|
14
14
|
return {
|
|
15
15
|
_inputSerde: inputSerde,
|
|
16
16
|
_outputSerde: outputSerde,
|
|
17
17
|
_shared: shared,
|
|
18
|
+
_description: opts?.description,
|
|
19
|
+
_metadata: opts?.metadata,
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
@@ -32,33 +34,51 @@ export function makeHandlerDescriptor(inputSerde, outputSerde, shared) {
|
|
|
32
34
|
* ```
|
|
33
35
|
*/
|
|
34
36
|
export const iface = {
|
|
35
|
-
service: function (name, handlers) {
|
|
36
|
-
return {
|
|
37
|
+
service: function (name, handlers, opts) {
|
|
38
|
+
return {
|
|
39
|
+
name,
|
|
40
|
+
_kind: "service",
|
|
41
|
+
_handlers: handlers,
|
|
42
|
+
_description: opts?.description,
|
|
43
|
+
_metadata: opts?.metadata,
|
|
44
|
+
};
|
|
37
45
|
},
|
|
38
|
-
object: function (name, handlers) {
|
|
39
|
-
return {
|
|
46
|
+
object: function (name, handlers, opts) {
|
|
47
|
+
return {
|
|
48
|
+
name,
|
|
49
|
+
_kind: "object",
|
|
50
|
+
_handlers: handlers,
|
|
51
|
+
_description: opts?.description,
|
|
52
|
+
_metadata: opts?.metadata,
|
|
53
|
+
};
|
|
40
54
|
},
|
|
41
|
-
workflow: function (name, handlers) {
|
|
42
|
-
return {
|
|
55
|
+
workflow: function (name, handlers, opts) {
|
|
56
|
+
return {
|
|
57
|
+
name,
|
|
58
|
+
_kind: "workflow",
|
|
59
|
+
_handlers: handlers,
|
|
60
|
+
_description: opts?.description,
|
|
61
|
+
_metadata: opts?.metadata,
|
|
62
|
+
};
|
|
43
63
|
},
|
|
44
|
-
json: function () {
|
|
45
|
-
return makeHandlerDescriptor(undefined, undefined, false);
|
|
64
|
+
json: function (opts) {
|
|
65
|
+
return makeHandlerDescriptor(undefined, undefined, false, opts);
|
|
46
66
|
},
|
|
47
67
|
serdes: function (opts) {
|
|
48
|
-
return makeHandlerDescriptor(opts.input, opts.output, false);
|
|
68
|
+
return makeHandlerDescriptor(opts.input, opts.output, false, opts);
|
|
49
69
|
},
|
|
50
70
|
schemas: function (opts) {
|
|
51
|
-
return makeHandlerDescriptor(opts.input ? serde.schema(opts.input) : undefined, opts.output ? serde.schema(opts.output) : undefined, false);
|
|
71
|
+
return makeHandlerDescriptor(opts.input ? serde.schema(opts.input) : undefined, opts.output ? serde.schema(opts.output) : undefined, false, opts);
|
|
52
72
|
},
|
|
53
73
|
shared: {
|
|
54
|
-
json: function () {
|
|
55
|
-
return makeHandlerDescriptor(undefined, undefined, true);
|
|
74
|
+
json: function (opts) {
|
|
75
|
+
return makeHandlerDescriptor(undefined, undefined, true, opts);
|
|
56
76
|
},
|
|
57
77
|
serdes: function (opts) {
|
|
58
|
-
return makeHandlerDescriptor(opts.input, opts.output, true);
|
|
78
|
+
return makeHandlerDescriptor(opts.input, opts.output, true, opts);
|
|
59
79
|
},
|
|
60
80
|
schemas: function (opts) {
|
|
61
|
-
return makeHandlerDescriptor(opts.input ? serde.schema(opts.input) : undefined, opts.output ? serde.schema(opts.output) : undefined, true);
|
|
81
|
+
return makeHandlerDescriptor(opts.input ? serde.schema(opts.input) : undefined, opts.output ? serde.schema(opts.output) : undefined, true, opts);
|
|
62
82
|
},
|
|
63
83
|
},
|
|
64
84
|
};
|
package/dist/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,uDAAuD;AAGvD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources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