@restatedev/restate-sdk-core 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/core.d.ts +29 -27
- package/dist/core.d.ts.map +1 -1
- package/dist/duration.d.ts +8 -11
- package/dist/duration.d.ts.map +1 -1
- package/dist/duration.js +23 -9
- package/dist/duration.js.map +1 -1
- package/dist/entry_codec.d.ts +19 -22
- package/dist/entry_codec.d.ts.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/interface.cjs +71 -0
- package/dist/interface.d.cts +83 -0
- package/dist/interface.d.cts.map +1 -0
- package/dist/interface.d.ts +78 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/interface.js +65 -0
- package/dist/interface.js.map +1 -0
- package/dist/serde_api.d.ts +106 -111
- package/dist/serde_api.d.ts.map +1 -1
- package/dist/serde_api.js +151 -87
- package/dist/serde_api.js.map +1 -1
- package/dist/standard_schema.d.ts +108 -109
- package/dist/standard_schema.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 - Restate Software, Inc., Restate GmbH
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
5
|
+
* which is released under the MIT license.
|
|
6
|
+
*
|
|
7
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
8
|
+
* directory of this repository or package, or at
|
|
9
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
10
|
+
*/
|
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
|
+
import { serde } from "./serde_api.js";
|
|
13
|
+
export function makeHandlerDescriptor(inputSerde, outputSerde, shared) {
|
|
14
|
+
return {
|
|
15
|
+
_inputSerde: inputSerde,
|
|
16
|
+
_outputSerde: outputSerde,
|
|
17
|
+
_shared: shared,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Declare a service interface (contract) as a runtime value carrying handler
|
|
22
|
+
* names + input/output serdes, without an implementation. Place it in a shared
|
|
23
|
+
* package that both the server (via `implement()`) and callers (via
|
|
24
|
+
* `ctx.serviceClient(iface)` / `connect().serviceClient(iface)`) import.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const greeter = iface.service("greeter", {
|
|
29
|
+
* greet: iface.schemas({ input: GreetReq, output: GreetRes }),
|
|
30
|
+
* ping: iface.json<void, string>(),
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export const iface = {
|
|
35
|
+
service: function (name, handlers) {
|
|
36
|
+
return { name, _kind: "service", _handlers: handlers };
|
|
37
|
+
},
|
|
38
|
+
object: function (name, handlers) {
|
|
39
|
+
return { name, _kind: "object", _handlers: handlers };
|
|
40
|
+
},
|
|
41
|
+
workflow: function (name, handlers) {
|
|
42
|
+
return { name, _kind: "workflow", _handlers: handlers };
|
|
43
|
+
},
|
|
44
|
+
json: function () {
|
|
45
|
+
return makeHandlerDescriptor(undefined, undefined, false);
|
|
46
|
+
},
|
|
47
|
+
serdes: function (opts) {
|
|
48
|
+
return makeHandlerDescriptor(opts.input, opts.output, false);
|
|
49
|
+
},
|
|
50
|
+
schemas: function (opts) {
|
|
51
|
+
return makeHandlerDescriptor(opts.input ? serde.schema(opts.input) : undefined, opts.output ? serde.schema(opts.output) : undefined, false);
|
|
52
|
+
},
|
|
53
|
+
shared: {
|
|
54
|
+
json: function () {
|
|
55
|
+
return makeHandlerDescriptor(undefined, undefined, true);
|
|
56
|
+
},
|
|
57
|
+
serdes: function (opts) {
|
|
58
|
+
return makeHandlerDescriptor(opts.input, opts.output, true);
|
|
59
|
+
},
|
|
60
|
+
schemas: function (opts) {
|
|
61
|
+
return makeHandlerDescriptor(opts.input ? serde.schema(opts.input) : undefined, opts.output ? serde.schema(opts.output) : undefined, true);
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +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;AAsBvC,MAAM,UAAU,qBAAqB,CACnC,UAAqB,EACrB,WAAsB,EACtB,MAAe;IAEf,OAAO;QACL,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,WAAW;QACzB,OAAO,EAAE,MAAM;KAChB,CAAC;AACJ,CAAC;AA4ID;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAqB;IACrC,OAAO,EAAE,UAGP,IAAO,EAAE,QAAW;QACpB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IACzD,CAAC;IACD,MAAM,EAAE,UAGN,IAAO,EAAE,QAAW;QACpB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IACxD,CAAC;IACD,QAAQ,EAAE,UAGR,IAAO,EAAE,QAAW;QACpB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IAC1D,CAAC;IACD,IAAI,EAAE;QACJ,OAAO,qBAAqB,CAAc,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,EAAE,UAAwD,IAG/D;QACC,OAAO,qBAAqB,CAC1B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,KAAK,CACN,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,UAGP,IAGD;QAKC,OAAO,qBAAqB,CAC1B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EACjD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,EACnD,KAAK,CACN,CAAC;IACJ,CAAC;IACD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,OAAO,qBAAqB,CAAa,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,EAAE,UAAwD,IAG/D;YACC,OAAO,qBAAqB,CAC1B,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CACL,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,UAGP,IAGD;YAKC,OAAO,qBAAqB,CAC1B,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EACjD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,EACnD,IAAI,CACL,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
package/dist/serde_api.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { StandardSchemaV1 } from "./standard_schema.js";
|
|
2
|
-
|
|
3
|
-
//#region src/serde_api.d.ts
|
|
4
|
-
|
|
1
|
+
import type { StandardSchemaV1 } from "./standard_schema.js";
|
|
5
2
|
/**
|
|
6
3
|
* Serializer/deserializer pair for any Restate-managed value of type `T` —
|
|
7
4
|
* handler inputs and outputs, service state, side-effect results,
|
|
@@ -19,117 +16,115 @@ import { StandardSchemaV1 } from "./standard_schema.js";
|
|
|
19
16
|
* It also advertises metadata (`contentType`, `jsonSchema`) that surfaces in
|
|
20
17
|
* service discovery.
|
|
21
18
|
*/
|
|
22
|
-
interface Serde<T> {
|
|
23
|
-
/**
|
|
24
|
-
* MIME type of the bytes produced by `serialize` (and accepted by
|
|
25
|
-
* `deserialize`).
|
|
26
|
-
*/
|
|
27
|
-
contentType?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Optional JSON Schema describing the logical shape of `T`. Surfaced in
|
|
30
|
-
* discovery so that tooling can generate forms, auto-complete payloads,
|
|
31
|
-
* etc. Has no effect on serialization at runtime.
|
|
32
|
-
*/
|
|
33
|
-
jsonSchema?: object;
|
|
34
|
-
/**
|
|
35
|
-
* Optional bridge between the serde's wire format and a JSON
|
|
36
|
-
* representation that humans (and tooling like the Restate UI) can read
|
|
37
|
-
* and edit.
|
|
38
|
-
*
|
|
39
|
-
* Only useful for serdes whose wire format isn't already plain JSON —
|
|
40
|
-
* protobuf, MessagePack, length-prefixed binary, JSON variants that need
|
|
41
|
-
* post-processing for bigints/dates, etc. Both methods may be async if the
|
|
42
|
-
* conversion needs I/O.
|
|
43
|
-
*
|
|
44
|
-
* ### Preview flow
|
|
45
|
-
*
|
|
46
|
-
* Together with `serialize` / `deserialize`, the four functions chain in
|
|
47
|
-
* both directions between a JSON string and on-the-wire bytes:
|
|
48
|
-
*
|
|
49
|
-
* ```text
|
|
50
|
-
* JSON string ──fromJsonString──► T ──serialize──► wire bytes
|
|
51
|
-
* wire bytes ──deserialize────► T ──toJsonString──► JSON string
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* The split keeps `serialize` / `deserialize` responsible for the full
|
|
55
|
-
* on-the-wire format; `preview` only handles the JSON ↔ `T` bridge.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* // Wire format is protobuf; the protobuf-es runtime already ships
|
|
60
|
-
* // `toJsonString` / `fromJsonString`, so preview is a direct pass-through.
|
|
61
|
-
* import {
|
|
62
|
-
* fromBinary,
|
|
63
|
-
* fromJsonString,
|
|
64
|
-
* toBinary,
|
|
65
|
-
* toJsonString,
|
|
66
|
-
* } from "@bufbuild/protobuf";
|
|
67
|
-
* import { PersonSchema, type Person } from "./person_pb.js";
|
|
68
|
-
*
|
|
69
|
-
* const personSerde: Serde<Person> = {
|
|
70
|
-
* contentType: "application/protobuf",
|
|
71
|
-
* serialize(message) { return toBinary(PersonSchema, message); },
|
|
72
|
-
* deserialize(bytes) { return fromBinary(PersonSchema, bytes); },
|
|
73
|
-
* preview: {
|
|
74
|
-
* toJsonString: (v) => toJsonString(PersonSchema, v),
|
|
75
|
-
* fromJsonString: (j) => fromJsonString(PersonSchema, j),
|
|
76
|
-
* },
|
|
77
|
-
* };
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
preview?: {
|
|
19
|
+
export interface Serde<T> {
|
|
81
20
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* the same logical value.
|
|
21
|
+
* MIME type of the bytes produced by `serialize` (and accepted by
|
|
22
|
+
* `deserialize`).
|
|
85
23
|
*/
|
|
86
|
-
|
|
24
|
+
contentType?: string;
|
|
87
25
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
26
|
+
* Optional JSON Schema describing the logical shape of `T`. Surfaced in
|
|
27
|
+
* discovery so that tooling can generate forms, auto-complete payloads,
|
|
28
|
+
* etc. Has no effect on serialization at runtime.
|
|
29
|
+
*/
|
|
30
|
+
jsonSchema?: object;
|
|
31
|
+
/**
|
|
32
|
+
* Optional bridge between the serde's wire format and a JSON
|
|
33
|
+
* representation that humans (and tooling like the Restate UI) can read
|
|
34
|
+
* and edit.
|
|
35
|
+
*
|
|
36
|
+
* Only useful for serdes whose wire format isn't already plain JSON —
|
|
37
|
+
* protobuf, MessagePack, length-prefixed binary, JSON variants that need
|
|
38
|
+
* post-processing for bigints/dates, etc. Both methods may be async if the
|
|
39
|
+
* conversion needs I/O.
|
|
40
|
+
*
|
|
41
|
+
* ### Preview flow
|
|
42
|
+
*
|
|
43
|
+
* Together with `serialize` / `deserialize`, the four functions chain in
|
|
44
|
+
* both directions between a JSON string and on-the-wire bytes:
|
|
45
|
+
*
|
|
46
|
+
* ```text
|
|
47
|
+
* JSON string ──fromJsonString──► T ──serialize──► wire bytes
|
|
48
|
+
* wire bytes ──deserialize────► T ──toJsonString──► JSON string
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* The split keeps `serialize` / `deserialize` responsible for the full
|
|
52
|
+
* on-the-wire format; `preview` only handles the JSON ↔ `T` bridge.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* // Wire format is protobuf; the protobuf-es runtime already ships
|
|
57
|
+
* // `toJsonString` / `fromJsonString`, so preview is a direct pass-through.
|
|
58
|
+
* import {
|
|
59
|
+
* fromBinary,
|
|
60
|
+
* fromJsonString,
|
|
61
|
+
* toBinary,
|
|
62
|
+
* toJsonString,
|
|
63
|
+
* } from "@bufbuild/protobuf";
|
|
64
|
+
* import { PersonSchema, type Person } from "./person_pb.js";
|
|
65
|
+
*
|
|
66
|
+
* const personSerde: Serde<Person> = {
|
|
67
|
+
* contentType: "application/protobuf",
|
|
68
|
+
* serialize(message) { return toBinary(PersonSchema, message); },
|
|
69
|
+
* deserialize(bytes) { return fromBinary(PersonSchema, bytes); },
|
|
70
|
+
* preview: {
|
|
71
|
+
* toJsonString: (v) => toJsonString(PersonSchema, v),
|
|
72
|
+
* fromJsonString: (j) => fromJsonString(PersonSchema, j),
|
|
73
|
+
* },
|
|
74
|
+
* };
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
preview?: {
|
|
78
|
+
/**
|
|
79
|
+
* Convert a value into a JSON string for display or editing by humans.
|
|
80
|
+
* The returned string must round-trip through `fromJsonString` back to
|
|
81
|
+
* the same logical value.
|
|
82
|
+
*/
|
|
83
|
+
toJsonString(value: T): Promise<string> | string;
|
|
84
|
+
/**
|
|
85
|
+
* Parse a human-supplied JSON string back into a value of type `T`.
|
|
86
|
+
* Should throw (or reject) if `json` is invalid for this serde.
|
|
87
|
+
*/
|
|
88
|
+
fromJsonString(json: string): Promise<T> | T;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Convert a value of type `T` into its on-the-wire bytes. This is the
|
|
92
|
+
* format Restate sends between services and persists in the journal.
|
|
93
|
+
*
|
|
94
|
+
* Must be the inverse of `deserialize` — `deserialize(serialize(v))`
|
|
95
|
+
* should produce a value equivalent to `v`.
|
|
90
96
|
*/
|
|
91
|
-
fromJsonString(json: string): Promise<T> | T;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Convert a value of type `T` into its on-the-wire bytes. This is the
|
|
95
|
-
* format Restate sends between services and persists in the journal.
|
|
96
|
-
*
|
|
97
|
-
* Must be the inverse of `deserialize` — `deserialize(serialize(v))`
|
|
98
|
-
* should produce a value equivalent to `v`.
|
|
99
|
-
*/
|
|
100
|
-
serialize(value: T): Uint8Array;
|
|
101
|
-
/**
|
|
102
|
-
* Convert on-the-wire bytes back into a value of type `T`. Must be the
|
|
103
|
-
* inverse of `serialize`.
|
|
104
|
-
*
|
|
105
|
-
* May throw if `data` doesn't conform to the expected wire format.
|
|
106
|
-
*/
|
|
107
|
-
deserialize(data: Uint8Array): T;
|
|
108
|
-
}
|
|
109
|
-
declare namespace serde {
|
|
110
|
-
class JsonSerde<T> implements Serde<T | undefined> {
|
|
111
|
-
readonly jsonSchema?: object | undefined;
|
|
112
|
-
contentType: string;
|
|
113
|
-
constructor(jsonSchema?: object | undefined);
|
|
114
97
|
serialize(value: T): Uint8Array;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Convert on-the-wire bytes back into a value of type `T`. Must be the
|
|
100
|
+
* inverse of `serialize`.
|
|
101
|
+
*
|
|
102
|
+
* May throw if `data` doesn't conform to the expected wire format.
|
|
103
|
+
*/
|
|
104
|
+
deserialize(data: Uint8Array): T;
|
|
105
|
+
}
|
|
106
|
+
export declare namespace serde {
|
|
107
|
+
class JsonSerde<T> implements Serde<T | undefined> {
|
|
108
|
+
readonly jsonSchema?: object | undefined;
|
|
109
|
+
contentType: string;
|
|
110
|
+
constructor(jsonSchema?: object | undefined);
|
|
111
|
+
serialize(value: T): Uint8Array;
|
|
112
|
+
deserialize(data: Uint8Array): T | undefined;
|
|
113
|
+
schema<U>(schema: object): Serde<U>;
|
|
114
|
+
}
|
|
115
|
+
const json: JsonSerde<any>;
|
|
116
|
+
const binary: Serde<Uint8Array>;
|
|
117
|
+
const empty: Serde<void>;
|
|
118
|
+
/**
|
|
119
|
+
* A Standard Schema-based serde.
|
|
120
|
+
*
|
|
121
|
+
* @param schema the standard schema
|
|
122
|
+
* @param validateOptions options passed to `StandardSchemaV1.Options.libraryOptions` when validating
|
|
123
|
+
* @param jsonSchemaOptions options passed to `StandardJsonSchemaV1.Options.libraryOptions` for code generation
|
|
124
|
+
* @returns a serde that will validate the data with the standard schema
|
|
125
|
+
*/
|
|
126
|
+
const schema: <T extends {
|
|
127
|
+
"~standard": StandardSchemaV1.Props;
|
|
128
|
+
}>(schema: T, validateOptions?: Record<string, unknown>, jsonSchemaOptions?: Record<string, unknown>) => Serde<StandardSchemaV1.InferOutput<T>>;
|
|
132
129
|
}
|
|
133
|
-
//#endregion
|
|
134
|
-
export { Serde, serde };
|
|
135
130
|
//# sourceMappingURL=serde_api.d.ts.map
|
package/dist/serde_api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serde_api.d.ts","
|
|
1
|
+
{"version":3,"file":"serde_api.d.ts","sourceRoot":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AM,KAAK,EAAE,KAAK,CAAC,IAAI,CAAmB,CAAC;IAElD;;;;;;;OAOG;IACI,MAAM,MAAM,GAAI,CAAC,SAAS;QAAE,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAA;KAAE,EACtE,QAAQ,CAAC,EACT,kBAAkB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,oBAAoB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1C,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC,CAEvC,CAAC;CACH"}
|
package/dist/serde_api.js
CHANGED
|
@@ -1,93 +1,157 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Restate SDK for Node.js/TypeScript,
|
|
5
|
+
* which is released under the MIT license.
|
|
6
|
+
*
|
|
7
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
8
|
+
* directory of this repository or package, or at
|
|
9
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
10
|
+
*/
|
|
11
|
+
class BinarySerde {
|
|
12
|
+
contentType = "application/octet-stream";
|
|
13
|
+
serialize(value) {
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
deserialize(data) {
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
class VoidSerde {
|
|
21
|
+
serialize(value) {
|
|
22
|
+
if (value !== undefined) {
|
|
23
|
+
throw new Error("Expected undefined value");
|
|
24
|
+
}
|
|
25
|
+
return new Uint8Array(0);
|
|
26
|
+
}
|
|
27
|
+
deserialize(data) {
|
|
28
|
+
if (data.length !== 0) {
|
|
29
|
+
throw new Error("Expected empty data");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
class StandardSchemaSerde {
|
|
34
|
+
schema;
|
|
35
|
+
validateOptions;
|
|
36
|
+
contentType = "application/json";
|
|
37
|
+
jsonSchema;
|
|
38
|
+
constructor(schema, validateOptions, jsonSchemaOptions) {
|
|
39
|
+
this.schema = schema;
|
|
40
|
+
this.validateOptions = validateOptions;
|
|
41
|
+
// Extract JSON schema if available
|
|
42
|
+
const standard = schema["~standard"];
|
|
43
|
+
if (isStandardJSONSchemaV1(standard)) {
|
|
44
|
+
try {
|
|
45
|
+
this.jsonSchema = standard.jsonSchema.output({
|
|
46
|
+
target: "draft-2020-12",
|
|
47
|
+
libraryOptions: jsonSchemaOptions,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// If JSON schema generation fails, leave it undefined
|
|
52
|
+
this.jsonSchema = undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Check if schema is for void/undefined type
|
|
56
|
+
// Standard Schema doesn't have a direct way to detect void types,
|
|
57
|
+
// so we serialize undefined and check if validation succeeds
|
|
58
|
+
const testResult = standard.validate(undefined);
|
|
59
|
+
// Handle both sync and async validation results
|
|
60
|
+
if (testResult && typeof testResult === "object" && "then" in testResult) {
|
|
61
|
+
// If it's a Promise, we can't determine contentType synchronously
|
|
62
|
+
// Keep contentType as "application/json"
|
|
63
|
+
}
|
|
64
|
+
else if (!testResult.issues) {
|
|
65
|
+
this.contentType = undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
serialize(value) {
|
|
69
|
+
if (value === undefined) {
|
|
70
|
+
return new Uint8Array(0);
|
|
71
|
+
}
|
|
72
|
+
return new TextEncoder().encode(JSON.stringify(value));
|
|
73
|
+
}
|
|
74
|
+
deserialize(data) {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
76
|
+
const js = data.length === 0
|
|
77
|
+
? undefined
|
|
78
|
+
: JSON.parse(new TextDecoder().decode(data));
|
|
79
|
+
const result = this.schema["~standard"].validate(js, this.validateOptions);
|
|
80
|
+
// Standard Schema validate can return a Promise, but Serde must be synchronous
|
|
81
|
+
if (result && typeof result === "object" && "then" in result) {
|
|
82
|
+
throw new TypeError("Async validation is not supported in Serde. Restate SDK supports only synchronous validation.");
|
|
83
|
+
}
|
|
84
|
+
if (result.issues) {
|
|
85
|
+
const errorMessages = result.issues
|
|
86
|
+
.map(formatStandardSchemaIssue)
|
|
87
|
+
.join("\n");
|
|
88
|
+
throw new TypeError(`Standard schema validation failed:\n${errorMessages}`);
|
|
89
|
+
}
|
|
90
|
+
return result.value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
53
93
|
function formatStandardSchemaIssue(issue) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
94
|
+
if (issue.path && issue.path.length > 0) {
|
|
95
|
+
const jsonPointer = "/" +
|
|
96
|
+
issue.path
|
|
97
|
+
.map((p) => {
|
|
98
|
+
// Handle both PathSegment objects and primitive PropertyKey values
|
|
99
|
+
if (typeof p === "object" && p !== null && "key" in p) {
|
|
100
|
+
return String(p.key);
|
|
101
|
+
}
|
|
102
|
+
return String(p);
|
|
103
|
+
})
|
|
104
|
+
.join("/");
|
|
105
|
+
return `* (at ${jsonPointer}) ${issue.message}`;
|
|
106
|
+
}
|
|
107
|
+
return `* ${issue.message}`;
|
|
59
108
|
}
|
|
60
109
|
function isStandardJSONSchemaV1(standard) {
|
|
61
|
-
|
|
110
|
+
return (standard != undefined &&
|
|
111
|
+
"jsonSchema" in standard &&
|
|
112
|
+
typeof standard.jsonSchema === "object" &&
|
|
113
|
+
standard.jsonSchema !== null &&
|
|
114
|
+
"output" in standard.jsonSchema &&
|
|
115
|
+
typeof standard.jsonSchema.output === "function");
|
|
62
116
|
}
|
|
63
|
-
|
|
64
|
-
(function(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
117
|
+
export var serde;
|
|
118
|
+
(function (serde) {
|
|
119
|
+
class JsonSerde {
|
|
120
|
+
jsonSchema;
|
|
121
|
+
contentType = "application/json";
|
|
122
|
+
constructor(jsonSchema) {
|
|
123
|
+
this.jsonSchema = jsonSchema;
|
|
124
|
+
}
|
|
125
|
+
serialize(value) {
|
|
126
|
+
if (value === undefined) {
|
|
127
|
+
return new Uint8Array(0);
|
|
128
|
+
}
|
|
129
|
+
return new TextEncoder().encode(JSON.stringify(value));
|
|
130
|
+
}
|
|
131
|
+
deserialize(data) {
|
|
132
|
+
if (data.length === 0) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
return JSON.parse(new TextDecoder().decode(data));
|
|
136
|
+
}
|
|
137
|
+
schema(schema) {
|
|
138
|
+
return new JsonSerde(schema);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
serde.JsonSerde = JsonSerde;
|
|
142
|
+
serde.json = new JsonSerde();
|
|
143
|
+
serde.binary = new BinarySerde();
|
|
144
|
+
serde.empty = new VoidSerde();
|
|
145
|
+
/**
|
|
146
|
+
* A Standard Schema-based serde.
|
|
147
|
+
*
|
|
148
|
+
* @param schema the standard schema
|
|
149
|
+
* @param validateOptions options passed to `StandardSchemaV1.Options.libraryOptions` when validating
|
|
150
|
+
* @param jsonSchemaOptions options passed to `StandardJsonSchemaV1.Options.libraryOptions` for code generation
|
|
151
|
+
* @returns a serde that will validate the data with the standard schema
|
|
152
|
+
*/
|
|
153
|
+
serde.schema = (schema, validateOptions, jsonSchemaOptions) => {
|
|
154
|
+
return new StandardSchemaSerde(schema, validateOptions, jsonSchemaOptions);
|
|
155
|
+
};
|
|
89
156
|
})(serde || (serde = {}));
|
|
90
|
-
|
|
91
|
-
//#endregion
|
|
92
|
-
export { serde };
|
|
93
157
|
//# sourceMappingURL=serde_api.js.map
|
package/dist/serde_api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serde_api.js","names":["schema: T","validateOptions?: Record<string, unknown>","jsonSchema?: object"],"sources":["../src/serde_api.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-namespace */\n\nimport type {\n StandardJSONSchemaV1,\n StandardSchemaV1,\n} from \"./standard_schema.js\";\n\n/**\n * Serializer/deserializer pair for any Restate-managed value of type `T` —\n * handler inputs and outputs, service state, side-effect results,\n * awakeables, durable promises, and so on.\n *\n * A `Serde<T>` is responsible for two conversions:\n *\n * - **Wire format**: `serialize` / `deserialize` convert a value `T` to and\n * from the raw bytes that flow over the network and get stored in the\n * journal.\n * - **JSON preview (optional)**: `preview.toJsonString` /\n * `preview.fromJsonString` convert a value `T` to and from a JSON string,\n * used by tooling to render and edit values that humans can read.\n *\n * It also advertises metadata (`contentType`, `jsonSchema`) that surfaces in\n * service discovery.\n */\nexport interface Serde<T> {\n /**\n * MIME type of the bytes produced by `serialize` (and accepted by\n * `deserialize`).\n */\n contentType?: string;\n\n /**\n * Optional JSON Schema describing the logical shape of `T`. Surfaced in\n * discovery so that tooling can generate forms, auto-complete payloads,\n * etc. Has no effect on serialization at runtime.\n */\n jsonSchema?: object;\n\n /**\n * Optional bridge between the serde's wire format and a JSON\n * representation that humans (and tooling like the Restate UI) can read\n * and edit.\n *\n * Only useful for serdes whose wire format isn't already plain JSON —\n * protobuf, MessagePack, length-prefixed binary, JSON variants that need\n * post-processing for bigints/dates, etc. Both methods may be async if the\n * conversion needs I/O.\n *\n * ### Preview flow\n *\n * Together with `serialize` / `deserialize`, the four functions chain in\n * both directions between a JSON string and on-the-wire bytes:\n *\n * ```text\n * JSON string ──fromJsonString──► T ──serialize──► wire bytes\n * wire bytes ──deserialize────► T ──toJsonString──► JSON string\n * ```\n *\n * The split keeps `serialize` / `deserialize` responsible for the full\n * on-the-wire format; `preview` only handles the JSON ↔ `T` bridge.\n *\n * @example\n * ```ts\n * // Wire format is protobuf; the protobuf-es runtime already ships\n * // `toJsonString` / `fromJsonString`, so preview is a direct pass-through.\n * import {\n * fromBinary,\n * fromJsonString,\n * toBinary,\n * toJsonString,\n * } from \"@bufbuild/protobuf\";\n * import { PersonSchema, type Person } from \"./person_pb.js\";\n *\n * const personSerde: Serde<Person> = {\n * contentType: \"application/protobuf\",\n * serialize(message) { return toBinary(PersonSchema, message); },\n * deserialize(bytes) { return fromBinary(PersonSchema, bytes); },\n * preview: {\n * toJsonString: (v) => toJsonString(PersonSchema, v),\n * fromJsonString: (j) => fromJsonString(PersonSchema, j),\n * },\n * };\n * ```\n */\n preview?: {\n /**\n * Convert a value into a JSON string for display or editing by humans.\n * The returned string must round-trip through `fromJsonString` back to\n * the same logical value.\n */\n toJsonString(value: T): Promise<string> | string;\n\n /**\n * Parse a human-supplied JSON string back into a value of type `T`.\n * Should throw (or reject) if `json` is invalid for this serde.\n */\n fromJsonString(json: string): Promise<T> | T;\n };\n\n /**\n * Convert a value of type `T` into its on-the-wire bytes. This is the\n * format Restate sends between services and persists in the journal.\n *\n * Must be the inverse of `deserialize` — `deserialize(serialize(v))`\n * should produce a value equivalent to `v`.\n */\n serialize(value: T): Uint8Array;\n\n /**\n * Convert on-the-wire bytes back into a value of type `T`. Must be the\n * inverse of `serialize`.\n *\n * May throw if `data` doesn't conform to the expected wire format.\n */\n deserialize(data: Uint8Array): T;\n}\n\nclass BinarySerde implements Serde<Uint8Array> {\n contentType = \"application/octet-stream\";\n\n serialize(value: Uint8Array): Uint8Array {\n return value;\n }\n\n deserialize(data: Uint8Array): Uint8Array {\n return data;\n }\n}\n\nclass VoidSerde implements Serde<void> {\n serialize(value: any): Uint8Array {\n if (value !== undefined) {\n throw new Error(\"Expected undefined value\");\n }\n return new Uint8Array(0);\n }\n\n deserialize(data: Uint8Array): void {\n if (data.length !== 0) {\n throw new Error(\"Expected empty data\");\n }\n }\n}\n\nclass StandardSchemaSerde<\n T extends { \"~standard\": StandardSchemaV1.Props },\n> implements Serde<StandardSchemaV1.InferOutput<T>> {\n contentType? = \"application/json\";\n jsonSchema?: object | undefined;\n\n constructor(\n private readonly schema: T,\n private readonly validateOptions?: Record<string, unknown>,\n jsonSchemaOptions?: Record<string, unknown>\n ) {\n // Extract JSON schema if available\n const standard = schema[\"~standard\"];\n if (isStandardJSONSchemaV1(standard)) {\n try {\n this.jsonSchema = (\n standard as unknown as StandardJSONSchemaV1.Props\n ).jsonSchema.output({\n target: \"draft-2020-12\",\n libraryOptions: jsonSchemaOptions,\n });\n } catch {\n // If JSON schema generation fails, leave it undefined\n this.jsonSchema = undefined;\n }\n }\n\n // Check if schema is for void/undefined type\n // Standard Schema doesn't have a direct way to detect void types,\n // so we serialize undefined and check if validation succeeds\n const testResult = standard.validate(undefined);\n // Handle both sync and async validation results\n if (testResult && typeof testResult === \"object\" && \"then\" in testResult) {\n // If it's a Promise, we can't determine contentType synchronously\n // Keep contentType as \"application/json\"\n } else if (!testResult.issues) {\n this.contentType = undefined;\n }\n }\n\n serialize(value: StandardSchemaV1.InferOutput<T>): Uint8Array {\n if (value === undefined) {\n return new Uint8Array(0);\n }\n return new TextEncoder().encode(JSON.stringify(value));\n }\n\n deserialize(data: Uint8Array): StandardSchemaV1.InferOutput<T> {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const js =\n data.length === 0\n ? undefined\n : JSON.parse(new TextDecoder().decode(data));\n\n const result = this.schema[\"~standard\"].validate(js, this.validateOptions);\n\n // Standard Schema validate can return a Promise, but Serde must be synchronous\n if (result && typeof result === \"object\" && \"then\" in result) {\n throw new TypeError(\n \"Async validation is not supported in Serde. Restate SDK supports only synchronous validation.\"\n );\n }\n\n if (result.issues) {\n const errorMessages = result.issues\n .map(formatStandardSchemaIssue)\n .join(\"\\n\");\n throw new TypeError(\n `Standard schema validation failed:\\n${errorMessages}`\n );\n }\n\n return result.value as StandardSchemaV1.InferOutput<T>;\n }\n}\n\nfunction formatStandardSchemaIssue(issue: StandardSchemaV1.Issue): string {\n if (issue.path && issue.path.length > 0) {\n const jsonPointer =\n \"/\" +\n issue.path\n .map((p) => {\n // Handle both PathSegment objects and primitive PropertyKey values\n if (typeof p === \"object\" && p !== null && \"key\" in p) {\n return String(p.key);\n }\n return String(p);\n })\n .join(\"/\");\n return `* (at ${jsonPointer}) ${issue.message}`;\n }\n return `* ${issue.message}`;\n}\n\nfunction isStandardJSONSchemaV1(standard: StandardSchemaV1.Props): boolean {\n return (\n standard != undefined &&\n \"jsonSchema\" in standard &&\n typeof standard.jsonSchema === \"object\" &&\n standard.jsonSchema !== null &&\n \"output\" in standard.jsonSchema &&\n typeof standard.jsonSchema.output === \"function\"\n );\n}\n\nexport namespace serde {\n export class JsonSerde<T> implements Serde<T | undefined> {\n contentType = \"application/json\";\n\n constructor(readonly jsonSchema?: object) {}\n\n serialize(value: T): Uint8Array {\n if (value === undefined) {\n return new Uint8Array(0);\n }\n return new TextEncoder().encode(JSON.stringify(value));\n }\n\n deserialize(data: Uint8Array): T | undefined {\n if (data.length === 0) {\n return undefined;\n }\n return JSON.parse(new TextDecoder().decode(data)) as T;\n }\n\n schema<U>(schema: object): Serde<U> {\n return new JsonSerde<U>(schema) as Serde<U>;\n }\n }\n\n export const json: JsonSerde<any> = new JsonSerde<any>();\n export const binary: Serde<Uint8Array> = new BinarySerde();\n export const empty: Serde<void> = new VoidSerde();\n\n /**\n * A Standard Schema-based serde.\n *\n * @param schema the standard schema\n * @param validateOptions options passed to `StandardSchemaV1.Options.libraryOptions` when validating\n * @param jsonSchemaOptions options passed to `StandardJsonSchemaV1.Options.libraryOptions` for code generation\n * @returns a serde that will validate the data with the standard schema\n */\n export const schema = <T extends { \"~standard\": StandardSchemaV1.Props }>(\n schema: T,\n validateOptions?: Record<string, unknown>,\n jsonSchemaOptions?: Record<string, unknown>\n ): Serde<StandardSchemaV1.InferOutput<T>> => {\n return new StandardSchemaSerde(schema, validateOptions, jsonSchemaOptions);\n };\n}\n"],"mappings":";AAiIA,IAAM,cAAN,MAA+C;CAC7C,cAAc;CAEd,UAAU,OAA+B;AACvC,SAAO;;CAGT,YAAY,MAA8B;AACxC,SAAO;;;AAIX,IAAM,YAAN,MAAuC;CACrC,UAAU,OAAwB;AAChC,MAAI,UAAU,OACZ,OAAM,IAAI,MAAM,2BAA2B;AAE7C,SAAO,IAAI,WAAW,EAAE;;CAG1B,YAAY,MAAwB;AAClC,MAAI,KAAK,WAAW,EAClB,OAAM,IAAI,MAAM,sBAAsB;;;AAK5C,IAAM,sBAAN,MAEoD;CAClD,cAAe;CACf;CAEA,YACE,AA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