@restatedev/restate-sdk-integration-client 0.0.0-stage → 1.18.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/LICENSE +21 -0
- package/README.md +132 -2
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/api.d.cts +219 -0
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.ts +219 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/client.cjs +101 -0
- package/dist/client.d.cts +26 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +26 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +99 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.cjs +52 -0
- package/dist/errors.d.cts +42 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +51 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.cjs +137 -0
- package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.d.cts +1 -0
- package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.d.ts +2 -0
- package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js +131 -0
- package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/package.cjs +11 -0
- package/dist/package.js +6 -0
- package/dist/package.js.map +1 -0
- package/dist/producer.cjs +245 -0
- package/dist/producer.js +244 -0
- package/dist/producer.js.map +1 -0
- package/dist/proto.cjs +37 -0
- package/dist/proto.js +35 -0
- package/dist/proto.js.map +1 -0
- package/dist/queue.cjs +40 -0
- package/dist/queue.js +40 -0
- package/dist/queue.js.map +1 -0
- package/package.json +61 -3
package/dist/client.cjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_package = require('./package.cjs');
|
|
3
|
+
const require_ingestion_svc_pb = require('./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.cjs');
|
|
4
|
+
const require_producer = require('./producer.cjs');
|
|
5
|
+
let __connectrpc_connect = require("@connectrpc/connect");
|
|
6
|
+
__connectrpc_connect = require_rolldown_runtime.__toESM(__connectrpc_connect);
|
|
7
|
+
let __connectrpc_connect_node = require("@connectrpc/connect-node");
|
|
8
|
+
__connectrpc_connect_node = require_rolldown_runtime.__toESM(__connectrpc_connect_node);
|
|
9
|
+
|
|
10
|
+
//#region src/client.ts
|
|
11
|
+
const MAX_INTEGRATION_BYTES = 64;
|
|
12
|
+
const MAX_PRODUCER_ID_BYTES = 256;
|
|
13
|
+
const DEFAULT_INTEGRATION = `restate-integration-client-ts/${require_package.version}`;
|
|
14
|
+
const encoder = new TextEncoder();
|
|
15
|
+
/**
|
|
16
|
+
* Creates a client for the Restate ingestion API, the API to turn any source of events into
|
|
17
|
+
* Restate invocations.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const client = connect({ url: "http://localhost:8080" });
|
|
21
|
+
* const producer = client.producer({
|
|
22
|
+
* defaults: { service: "Orders", handler: "ingest" },
|
|
23
|
+
* });
|
|
24
|
+
* for (const order of orders) {
|
|
25
|
+
* await producer.send({ key: order.id, body: JSON.stringify(order) });
|
|
26
|
+
* }
|
|
27
|
+
* await producer.close();
|
|
28
|
+
* await client.close();
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @experimental
|
|
32
|
+
*/
|
|
33
|
+
function connect(opts) {
|
|
34
|
+
let transport = opts.transport;
|
|
35
|
+
let sessionManager;
|
|
36
|
+
if (transport === void 0) {
|
|
37
|
+
const url = parseIngressUrl(opts.url);
|
|
38
|
+
sessionManager = new __connectrpc_connect_node.Http2SessionManager(url);
|
|
39
|
+
transport = (0, __connectrpc_connect_node.createGrpcTransport)({
|
|
40
|
+
baseUrl: url.href,
|
|
41
|
+
sessionManager
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const authToken = opts.authToken?.trim();
|
|
45
|
+
return new IntegrationClientImpl((0, __connectrpc_connect.createClient)(require_ingestion_svc_pb.IngestionSvc, transport), authToken ? { authorization: `Bearer ${authToken}` } : void 0, truncateUtf8(opts.integration !== void 0 ? `${opts.integration.name}/${opts.integration.version}` : DEFAULT_INTEGRATION, MAX_INTEGRATION_BYTES), sessionManager);
|
|
46
|
+
}
|
|
47
|
+
var IntegrationClientImpl = class {
|
|
48
|
+
#rpc;
|
|
49
|
+
#headers;
|
|
50
|
+
#integration;
|
|
51
|
+
#sessionManager;
|
|
52
|
+
#closed = false;
|
|
53
|
+
constructor(rpc, headers, integration, sessionManager) {
|
|
54
|
+
this.#rpc = rpc;
|
|
55
|
+
this.#headers = headers;
|
|
56
|
+
this.#integration = integration;
|
|
57
|
+
this.#sessionManager = sessionManager;
|
|
58
|
+
}
|
|
59
|
+
producer(opts = {}) {
|
|
60
|
+
return this.#newProducer("", false, opts);
|
|
61
|
+
}
|
|
62
|
+
exactlyOnceProducer(producerId, opts = {}) {
|
|
63
|
+
if (typeof producerId !== "string" || producerId.trim() === "") throw new TypeError("producerId must be a non-empty string");
|
|
64
|
+
if (encoder.encode(producerId).byteLength > MAX_PRODUCER_ID_BYTES) throw new RangeError(`producerId must be at most ${MAX_PRODUCER_ID_BYTES} bytes`);
|
|
65
|
+
return this.#newProducer(producerId, true, opts);
|
|
66
|
+
}
|
|
67
|
+
close() {
|
|
68
|
+
this.#closed = true;
|
|
69
|
+
this.#sessionManager?.abort();
|
|
70
|
+
return Promise.resolve();
|
|
71
|
+
}
|
|
72
|
+
#newProducer(producerId, exactlyOnce, options) {
|
|
73
|
+
if (this.#closed) throw new Error("The integration client is closed");
|
|
74
|
+
return new require_producer.ProducerImpl({
|
|
75
|
+
rpc: this.#rpc,
|
|
76
|
+
headers: this.#headers,
|
|
77
|
+
integration: this.#integration,
|
|
78
|
+
producerId,
|
|
79
|
+
exactlyOnce,
|
|
80
|
+
options
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function parseIngressUrl(raw) {
|
|
85
|
+
let url;
|
|
86
|
+
try {
|
|
87
|
+
url = new URL(raw);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
throw new TypeError(`The ingress url is not a valid URL: '${raw}'`, { cause: e });
|
|
90
|
+
}
|
|
91
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new TypeError(`The ingress url must use the http or https scheme, got '${raw}'`);
|
|
92
|
+
return url;
|
|
93
|
+
}
|
|
94
|
+
/** Truncates to at most `maxBytes` of UTF-8, without splitting a character. */
|
|
95
|
+
function truncateUtf8(value, maxBytes) {
|
|
96
|
+
const { read } = encoder.encodeInto(value, new Uint8Array(maxBytes));
|
|
97
|
+
return value.slice(0, read);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
exports.connect = connect;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IntegrationClient, IntegrationClientOptions } from "./api.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/client.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a client for the Restate ingestion API, the API to turn any source of events into
|
|
7
|
+
* Restate invocations.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const client = connect({ url: "http://localhost:8080" });
|
|
11
|
+
* const producer = client.producer({
|
|
12
|
+
* defaults: { service: "Orders", handler: "ingest" },
|
|
13
|
+
* });
|
|
14
|
+
* for (const order of orders) {
|
|
15
|
+
* await producer.send({ key: order.id, body: JSON.stringify(order) });
|
|
16
|
+
* }
|
|
17
|
+
* await producer.close();
|
|
18
|
+
* await client.close();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @experimental
|
|
22
|
+
*/
|
|
23
|
+
declare function connect(opts: IntegrationClientOptions): IntegrationClient;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { connect };
|
|
26
|
+
//# sourceMappingURL=client.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.cts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;AAuDA;;;;;;;;;;;;;;;;iBAAgB,OAAA,OAAc,2BAA2B"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IntegrationClient, IntegrationClientOptions } from "./api.js";
|
|
2
|
+
|
|
3
|
+
//#region src/client.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a client for the Restate ingestion API, the API to turn any source of events into
|
|
7
|
+
* Restate invocations.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const client = connect({ url: "http://localhost:8080" });
|
|
11
|
+
* const producer = client.producer({
|
|
12
|
+
* defaults: { service: "Orders", handler: "ingest" },
|
|
13
|
+
* });
|
|
14
|
+
* for (const order of orders) {
|
|
15
|
+
* await producer.send({ key: order.id, body: JSON.stringify(order) });
|
|
16
|
+
* }
|
|
17
|
+
* await producer.close();
|
|
18
|
+
* await client.close();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @experimental
|
|
22
|
+
*/
|
|
23
|
+
declare function connect(opts: IntegrationClientOptions): IntegrationClient;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { connect };
|
|
26
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;AAuDA;;;;;;;;;;;;;;;;iBAAgB,OAAA,OAAc,2BAA2B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { version } from "./package.js";
|
|
2
|
+
import { IngestionSvc } from "./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js";
|
|
3
|
+
import { ProducerImpl } from "./producer.js";
|
|
4
|
+
import { createClient } from "@connectrpc/connect";
|
|
5
|
+
import { Http2SessionManager, createGrpcTransport } from "@connectrpc/connect-node";
|
|
6
|
+
|
|
7
|
+
//#region src/client.ts
|
|
8
|
+
const MAX_INTEGRATION_BYTES = 64;
|
|
9
|
+
const MAX_PRODUCER_ID_BYTES = 256;
|
|
10
|
+
const DEFAULT_INTEGRATION = `restate-integration-client-ts/${version}`;
|
|
11
|
+
const encoder = new TextEncoder();
|
|
12
|
+
/**
|
|
13
|
+
* Creates a client for the Restate ingestion API, the API to turn any source of events into
|
|
14
|
+
* Restate invocations.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const client = connect({ url: "http://localhost:8080" });
|
|
18
|
+
* const producer = client.producer({
|
|
19
|
+
* defaults: { service: "Orders", handler: "ingest" },
|
|
20
|
+
* });
|
|
21
|
+
* for (const order of orders) {
|
|
22
|
+
* await producer.send({ key: order.id, body: JSON.stringify(order) });
|
|
23
|
+
* }
|
|
24
|
+
* await producer.close();
|
|
25
|
+
* await client.close();
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
|
+
function connect(opts) {
|
|
31
|
+
let transport = opts.transport;
|
|
32
|
+
let sessionManager;
|
|
33
|
+
if (transport === void 0) {
|
|
34
|
+
const url = parseIngressUrl(opts.url);
|
|
35
|
+
sessionManager = new Http2SessionManager(url);
|
|
36
|
+
transport = createGrpcTransport({
|
|
37
|
+
baseUrl: url.href,
|
|
38
|
+
sessionManager
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const authToken = opts.authToken?.trim();
|
|
42
|
+
return new IntegrationClientImpl(createClient(IngestionSvc, transport), authToken ? { authorization: `Bearer ${authToken}` } : void 0, truncateUtf8(opts.integration !== void 0 ? `${opts.integration.name}/${opts.integration.version}` : DEFAULT_INTEGRATION, MAX_INTEGRATION_BYTES), sessionManager);
|
|
43
|
+
}
|
|
44
|
+
var IntegrationClientImpl = class {
|
|
45
|
+
#rpc;
|
|
46
|
+
#headers;
|
|
47
|
+
#integration;
|
|
48
|
+
#sessionManager;
|
|
49
|
+
#closed = false;
|
|
50
|
+
constructor(rpc, headers, integration, sessionManager) {
|
|
51
|
+
this.#rpc = rpc;
|
|
52
|
+
this.#headers = headers;
|
|
53
|
+
this.#integration = integration;
|
|
54
|
+
this.#sessionManager = sessionManager;
|
|
55
|
+
}
|
|
56
|
+
producer(opts = {}) {
|
|
57
|
+
return this.#newProducer("", false, opts);
|
|
58
|
+
}
|
|
59
|
+
exactlyOnceProducer(producerId, opts = {}) {
|
|
60
|
+
if (typeof producerId !== "string" || producerId.trim() === "") throw new TypeError("producerId must be a non-empty string");
|
|
61
|
+
if (encoder.encode(producerId).byteLength > MAX_PRODUCER_ID_BYTES) throw new RangeError(`producerId must be at most ${MAX_PRODUCER_ID_BYTES} bytes`);
|
|
62
|
+
return this.#newProducer(producerId, true, opts);
|
|
63
|
+
}
|
|
64
|
+
close() {
|
|
65
|
+
this.#closed = true;
|
|
66
|
+
this.#sessionManager?.abort();
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
}
|
|
69
|
+
#newProducer(producerId, exactlyOnce, options) {
|
|
70
|
+
if (this.#closed) throw new Error("The integration client is closed");
|
|
71
|
+
return new ProducerImpl({
|
|
72
|
+
rpc: this.#rpc,
|
|
73
|
+
headers: this.#headers,
|
|
74
|
+
integration: this.#integration,
|
|
75
|
+
producerId,
|
|
76
|
+
exactlyOnce,
|
|
77
|
+
options
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
function parseIngressUrl(raw) {
|
|
82
|
+
let url;
|
|
83
|
+
try {
|
|
84
|
+
url = new URL(raw);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
throw new TypeError(`The ingress url is not a valid URL: '${raw}'`, { cause: e });
|
|
87
|
+
}
|
|
88
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new TypeError(`The ingress url must use the http or https scheme, got '${raw}'`);
|
|
89
|
+
return url;
|
|
90
|
+
}
|
|
91
|
+
/** Truncates to at most `maxBytes` of UTF-8, without splitting a character. */
|
|
92
|
+
function truncateUtf8(value, maxBytes) {
|
|
93
|
+
const { read } = encoder.encodeInto(value, new Uint8Array(maxBytes));
|
|
94
|
+
return value.slice(0, read);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
export { connect };
|
|
99
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["pkg.version","sessionManager: Http2SessionManager | undefined","#rpc","#headers","#integration","#sessionManager","#newProducer","#closed","url: URL"],"sources":["../src/client.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2026 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\nimport { type Client, createClient } from \"@connectrpc/connect\";\nimport {\n createGrpcTransport,\n Http2SessionManager,\n} from \"@connectrpc/connect-node\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport type {\n ExactlyOnceInvocation,\n ExactlyOnceProducer,\n IntegrationClient,\n IntegrationClientOptions,\n Invocation,\n Producer,\n ProducerOptions,\n} from \"./api.js\";\nimport { IngestionSvc } from \"./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js\";\nimport { ProducerImpl } from \"./producer.js\";\n\n// Limits enforced by Restate on the Start frame.\nconst MAX_INTEGRATION_BYTES = 64;\nconst MAX_PRODUCER_ID_BYTES = 256;\n\nconst DEFAULT_INTEGRATION = `restate-integration-client-ts/${pkg.version}`;\n\nconst encoder = new TextEncoder();\n\n/**\n * Creates a client for the Restate ingestion API, the API to turn any source of events into\n * Restate invocations.\n *\n * ```ts\n * const client = connect({ url: \"http://localhost:8080\" });\n * const producer = client.producer({\n * defaults: { service: \"Orders\", handler: \"ingest\" },\n * });\n * for (const order of orders) {\n * await producer.send({ key: order.id, body: JSON.stringify(order) });\n * }\n * await producer.close();\n * await client.close();\n * ```\n *\n * @experimental\n */\nexport function connect(opts: IntegrationClientOptions): IntegrationClient {\n let transport = opts.transport;\n let sessionManager: Http2SessionManager | undefined;\n if (transport === undefined) {\n const url = parseIngressUrl(opts.url);\n sessionManager = new Http2SessionManager(url);\n transport = createGrpcTransport({ baseUrl: url.href, sessionManager });\n }\n const authToken = opts.authToken?.trim();\n return new IntegrationClientImpl(\n createClient(IngestionSvc, transport),\n authToken ? { authorization: `Bearer ${authToken}` } : undefined,\n truncateUtf8(\n opts.integration !== undefined\n ? `${opts.integration.name}/${opts.integration.version}`\n : DEFAULT_INTEGRATION,\n MAX_INTEGRATION_BYTES\n ),\n sessionManager\n );\n}\n\nclass IntegrationClientImpl implements IntegrationClient {\n readonly #rpc: Client<typeof IngestionSvc>;\n readonly #headers: Record<string, string> | undefined;\n readonly #integration: string;\n readonly #sessionManager: Http2SessionManager | undefined;\n #closed = false;\n\n constructor(\n rpc: Client<typeof IngestionSvc>,\n headers: Record<string, string> | undefined,\n integration: string,\n sessionManager: Http2SessionManager | undefined\n ) {\n this.#rpc = rpc;\n this.#headers = headers;\n this.#integration = integration;\n this.#sessionManager = sessionManager;\n }\n\n producer(opts: ProducerOptions = {}): Producer {\n return this.#newProducer<Invocation>(\"\", false, opts);\n }\n\n exactlyOnceProducer(\n producerId: string,\n opts: ProducerOptions = {}\n ): ExactlyOnceProducer {\n if (typeof producerId !== \"string\" || producerId.trim() === \"\") {\n throw new TypeError(\"producerId must be a non-empty string\");\n }\n if (encoder.encode(producerId).byteLength > MAX_PRODUCER_ID_BYTES) {\n throw new RangeError(\n `producerId must be at most ${MAX_PRODUCER_ID_BYTES} bytes`\n );\n }\n return this.#newProducer<ExactlyOnceInvocation>(producerId, true, opts);\n }\n\n close(): Promise<void> {\n this.#closed = true;\n this.#sessionManager?.abort();\n return Promise.resolve();\n }\n\n #newProducer<R extends Invocation>(\n producerId: string,\n exactlyOnce: boolean,\n options: ProducerOptions\n ): ProducerImpl<R> {\n if (this.#closed) {\n throw new Error(\"The integration client is closed\");\n }\n return new ProducerImpl<R>({\n rpc: this.#rpc,\n headers: this.#headers,\n integration: this.#integration,\n producerId,\n exactlyOnce,\n options,\n });\n }\n}\n\nfunction parseIngressUrl(raw: string): URL {\n let url: URL;\n try {\n url = new URL(raw);\n } catch (e) {\n throw new TypeError(`The ingress url is not a valid URL: '${raw}'`, {\n cause: e,\n });\n }\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n throw new TypeError(\n `The ingress url must use the http or https scheme, got '${raw}'`\n );\n }\n return url;\n}\n\n/** Truncates to at most `maxBytes` of UTF-8, without splitting a character. */\nfunction truncateUtf8(value: string, maxBytes: number): string {\n const { read } = encoder.encodeInto(value, new Uint8Array(maxBytes));\n return value.slice(0, read);\n}\n"],"mappings":";;;;;;;AA8BA,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAE9B,MAAM,sBAAsB,iCAAiCA;AAE7D,MAAM,UAAU,IAAI,aAAa;;;;;;;;;;;;;;;;;;;AAoBjC,SAAgB,QAAQ,MAAmD;CACzE,IAAI,YAAY,KAAK;CACrB,IAAIC;AACJ,KAAI,cAAc,QAAW;EAC3B,MAAM,MAAM,gBAAgB,KAAK,IAAI;AACrC,mBAAiB,IAAI,oBAAoB,IAAI;AAC7C,cAAY,oBAAoB;GAAE,SAAS,IAAI;GAAM;GAAgB,CAAC;;CAExE,MAAM,YAAY,KAAK,WAAW,MAAM;AACxC,QAAO,IAAI,sBACT,aAAa,cAAc,UAAU,EACrC,YAAY,EAAE,eAAe,UAAU,aAAa,GAAG,QACvD,aACE,KAAK,gBAAgB,SACjB,GAAG,KAAK,YAAY,KAAK,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MAAM,GAAG,KAAK"}
|
package/dist/errors.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const require_ingestion_svc_pb = require('./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/errors.ts
|
|
4
|
+
/**
|
|
5
|
+
* The error producer operations reject with when the ingestion stream fails.
|
|
6
|
+
*
|
|
7
|
+
* Restate tears the stream down after any error. A record-scoped error carries the
|
|
8
|
+
* {@link IntegrationClientError.offset} of the rejected record; to recover, an exactly-once
|
|
9
|
+
* producer resumes from the last committed offset and skips (or fixes) that record.
|
|
10
|
+
*
|
|
11
|
+
* @experimental
|
|
12
|
+
*/
|
|
13
|
+
var IntegrationClientError = class extends Error {
|
|
14
|
+
/** Classification of the failure. */
|
|
15
|
+
kind;
|
|
16
|
+
/**
|
|
17
|
+
* Offset of the record the error is about, or `undefined` when the error concerns the
|
|
18
|
+
* stream as a whole.
|
|
19
|
+
*/
|
|
20
|
+
offset;
|
|
21
|
+
constructor(kind, message, options) {
|
|
22
|
+
super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
|
|
23
|
+
this.name = "IntegrationClientError";
|
|
24
|
+
this.kind = kind;
|
|
25
|
+
if (options?.offset !== void 0) this.offset = options.offset;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function errorFromProto(error) {
|
|
29
|
+
const kind = kindFromProto(error.kind);
|
|
30
|
+
const message = error.message || kind;
|
|
31
|
+
if (error.invocationOffset === void 0) return new IntegrationClientError(kind, message);
|
|
32
|
+
return new IntegrationClientError(kind, `[offset=${error.invocationOffset}] ${message}`, { offset: toSafeNumber(error.invocationOffset) });
|
|
33
|
+
}
|
|
34
|
+
/** Converts a uint64 from the wire, saturating at `Number.MAX_SAFE_INTEGER`. */
|
|
35
|
+
function toSafeNumber(value) {
|
|
36
|
+
return value > BigInt(Number.MAX_SAFE_INTEGER) ? Number.MAX_SAFE_INTEGER : Number(value);
|
|
37
|
+
}
|
|
38
|
+
function kindFromProto(kind) {
|
|
39
|
+
switch (kind) {
|
|
40
|
+
case require_ingestion_svc_pb.ErrorKind.SHUTTING_DOWN: return "shutting_down";
|
|
41
|
+
case require_ingestion_svc_pb.ErrorKind.GO_AWAY: return "go_away";
|
|
42
|
+
case require_ingestion_svc_pb.ErrorKind.NOT_FOUND: return "not_found";
|
|
43
|
+
case require_ingestion_svc_pb.ErrorKind.BAD_REQUEST: return "bad_request";
|
|
44
|
+
case require_ingestion_svc_pb.ErrorKind.UNAVAILABLE: return "unavailable";
|
|
45
|
+
default: return "unknown";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.IntegrationClientError = IntegrationClientError;
|
|
51
|
+
exports.errorFromProto = errorFromProto;
|
|
52
|
+
exports.toSafeNumber = toSafeNumber;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/errors.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Classification of an ingestion stream failure.
|
|
7
|
+
*
|
|
8
|
+
* - `unknown`: transport failure, unexpected end of the stream, or an unclassified error.
|
|
9
|
+
* - `shutting_down`: the Restate node is shutting down.
|
|
10
|
+
* - `go_away`: protocol violation.
|
|
11
|
+
* - `not_found`: unknown target service or handler.
|
|
12
|
+
* - `bad_request`: invalid record, e.g. a missing or unexpected key.
|
|
13
|
+
* - `unavailable`: Restate cannot process the request yet; retry later.
|
|
14
|
+
*
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
type IntegrationClientErrorKind = "unknown" | "shutting_down" | "go_away" | "not_found" | "bad_request" | "unavailable";
|
|
18
|
+
/**
|
|
19
|
+
* The error producer operations reject with when the ingestion stream fails.
|
|
20
|
+
*
|
|
21
|
+
* Restate tears the stream down after any error. A record-scoped error carries the
|
|
22
|
+
* {@link IntegrationClientError.offset} of the rejected record; to recover, an exactly-once
|
|
23
|
+
* producer resumes from the last committed offset and skips (or fixes) that record.
|
|
24
|
+
*
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
|
+
declare class IntegrationClientError extends Error {
|
|
28
|
+
/** Classification of the failure. */
|
|
29
|
+
readonly kind: IntegrationClientErrorKind;
|
|
30
|
+
/**
|
|
31
|
+
* Offset of the record the error is about, or `undefined` when the error concerns the
|
|
32
|
+
* stream as a whole.
|
|
33
|
+
*/
|
|
34
|
+
readonly offset?: number;
|
|
35
|
+
constructor(kind: IntegrationClientErrorKind, message: string, options?: {
|
|
36
|
+
offset?: number;
|
|
37
|
+
cause?: unknown;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { IntegrationClientError, IntegrationClientErrorKind };
|
|
42
|
+
//# sourceMappingURL=errors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.cts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;AA4BA;AAiBA;;;;;;;;;KAjBY,0BAAA;;;;;;;;;;cAiBC,sBAAA,SAA+B,KAAA;;iBAE3B;;;;;;oBASP"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Classification of an ingestion stream failure.
|
|
7
|
+
*
|
|
8
|
+
* - `unknown`: transport failure, unexpected end of the stream, or an unclassified error.
|
|
9
|
+
* - `shutting_down`: the Restate node is shutting down.
|
|
10
|
+
* - `go_away`: protocol violation.
|
|
11
|
+
* - `not_found`: unknown target service or handler.
|
|
12
|
+
* - `bad_request`: invalid record, e.g. a missing or unexpected key.
|
|
13
|
+
* - `unavailable`: Restate cannot process the request yet; retry later.
|
|
14
|
+
*
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
|
+
type IntegrationClientErrorKind = "unknown" | "shutting_down" | "go_away" | "not_found" | "bad_request" | "unavailable";
|
|
18
|
+
/**
|
|
19
|
+
* The error producer operations reject with when the ingestion stream fails.
|
|
20
|
+
*
|
|
21
|
+
* Restate tears the stream down after any error. A record-scoped error carries the
|
|
22
|
+
* {@link IntegrationClientError.offset} of the rejected record; to recover, an exactly-once
|
|
23
|
+
* producer resumes from the last committed offset and skips (or fixes) that record.
|
|
24
|
+
*
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
|
+
declare class IntegrationClientError extends Error {
|
|
28
|
+
/** Classification of the failure. */
|
|
29
|
+
readonly kind: IntegrationClientErrorKind;
|
|
30
|
+
/**
|
|
31
|
+
* Offset of the record the error is about, or `undefined` when the error concerns the
|
|
32
|
+
* stream as a whole.
|
|
33
|
+
*/
|
|
34
|
+
readonly offset?: number;
|
|
35
|
+
constructor(kind: IntegrationClientErrorKind, message: string, options?: {
|
|
36
|
+
offset?: number;
|
|
37
|
+
cause?: unknown;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { IntegrationClientError, IntegrationClientErrorKind };
|
|
42
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","names":[],"sources":["../src/errors.ts"],"sourcesContent":[],"mappings":";;;;;;AA4BA;AAiBA;;;;;;;;;KAjBY,0BAAA;;;;;;;;;;cAiBC,sBAAA,SAA+B,KAAA;;iBAE3B;;;;;;oBASP"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ErrorKind } from "./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js";
|
|
2
|
+
|
|
3
|
+
//#region src/errors.ts
|
|
4
|
+
/**
|
|
5
|
+
* The error producer operations reject with when the ingestion stream fails.
|
|
6
|
+
*
|
|
7
|
+
* Restate tears the stream down after any error. A record-scoped error carries the
|
|
8
|
+
* {@link IntegrationClientError.offset} of the rejected record; to recover, an exactly-once
|
|
9
|
+
* producer resumes from the last committed offset and skips (or fixes) that record.
|
|
10
|
+
*
|
|
11
|
+
* @experimental
|
|
12
|
+
*/
|
|
13
|
+
var IntegrationClientError = class extends Error {
|
|
14
|
+
/** Classification of the failure. */
|
|
15
|
+
kind;
|
|
16
|
+
/**
|
|
17
|
+
* Offset of the record the error is about, or `undefined` when the error concerns the
|
|
18
|
+
* stream as a whole.
|
|
19
|
+
*/
|
|
20
|
+
offset;
|
|
21
|
+
constructor(kind, message, options) {
|
|
22
|
+
super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
|
|
23
|
+
this.name = "IntegrationClientError";
|
|
24
|
+
this.kind = kind;
|
|
25
|
+
if (options?.offset !== void 0) this.offset = options.offset;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function errorFromProto(error) {
|
|
29
|
+
const kind = kindFromProto(error.kind);
|
|
30
|
+
const message = error.message || kind;
|
|
31
|
+
if (error.invocationOffset === void 0) return new IntegrationClientError(kind, message);
|
|
32
|
+
return new IntegrationClientError(kind, `[offset=${error.invocationOffset}] ${message}`, { offset: toSafeNumber(error.invocationOffset) });
|
|
33
|
+
}
|
|
34
|
+
/** Converts a uint64 from the wire, saturating at `Number.MAX_SAFE_INTEGER`. */
|
|
35
|
+
function toSafeNumber(value) {
|
|
36
|
+
return value > BigInt(Number.MAX_SAFE_INTEGER) ? Number.MAX_SAFE_INTEGER : Number(value);
|
|
37
|
+
}
|
|
38
|
+
function kindFromProto(kind) {
|
|
39
|
+
switch (kind) {
|
|
40
|
+
case ErrorKind.SHUTTING_DOWN: return "shutting_down";
|
|
41
|
+
case ErrorKind.GO_AWAY: return "go_away";
|
|
42
|
+
case ErrorKind.NOT_FOUND: return "not_found";
|
|
43
|
+
case ErrorKind.BAD_REQUEST: return "bad_request";
|
|
44
|
+
case ErrorKind.UNAVAILABLE: return "unavailable";
|
|
45
|
+
default: return "unknown";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { IntegrationClientError, errorFromProto, toSafeNumber };
|
|
51
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/*\n * Copyright (c) 2023-2026 - Restate Software, Inc., Restate GmbH\n *\n * This file is part of the Restate SDK for Node.js/TypeScript,\n * which is released under the MIT license.\n *\n * You can find a copy of the license in file LICENSE in the root\n * directory of this repository or package, or at\n * https://github.com/restatedev/sdk-typescript/blob/main/LICENSE\n */\n\nimport {\n ErrorKind,\n type Error as ProtoError,\n} from \"./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js\";\n\n/**\n * Classification of an ingestion stream failure.\n *\n * - `unknown`: transport failure, unexpected end of the stream, or an unclassified error.\n * - `shutting_down`: the Restate node is shutting down.\n * - `go_away`: protocol violation.\n * - `not_found`: unknown target service or handler.\n * - `bad_request`: invalid record, e.g. a missing or unexpected key.\n * - `unavailable`: Restate cannot process the request yet; retry later.\n *\n * @experimental\n */\nexport type IntegrationClientErrorKind =\n | \"unknown\"\n | \"shutting_down\"\n | \"go_away\"\n | \"not_found\"\n | \"bad_request\"\n | \"unavailable\";\n\n/**\n * The error producer operations reject with when the ingestion stream fails.\n *\n * Restate tears the stream down after any error. A record-scoped error carries the\n * {@link IntegrationClientError.offset} of the rejected record; to recover, an exactly-once\n * producer resumes from the last committed offset and skips (or fixes) that record.\n *\n * @experimental\n */\nexport class IntegrationClientError extends Error {\n /** Classification of the failure. */\n readonly kind: IntegrationClientErrorKind;\n\n /**\n * Offset of the record the error is about, or `undefined` when the error concerns the\n * stream as a whole.\n */\n readonly offset?: number;\n\n constructor(\n kind: IntegrationClientErrorKind,\n message: string,\n options?: { offset?: number; cause?: unknown }\n ) {\n super(\n message,\n options?.cause !== undefined ? { cause: options.cause } : undefined\n );\n this.name = \"IntegrationClientError\";\n this.kind = kind;\n if (options?.offset !== undefined) {\n this.offset = options.offset;\n }\n }\n}\n\nexport function errorFromProto(error: ProtoError): IntegrationClientError {\n const kind = kindFromProto(error.kind);\n const message = error.message || kind;\n if (error.invocationOffset === undefined) {\n return new IntegrationClientError(kind, message);\n }\n return new IntegrationClientError(\n kind,\n `[offset=${error.invocationOffset}] ${message}`,\n { offset: toSafeNumber(error.invocationOffset) }\n );\n}\n\n/** Converts a uint64 from the wire, saturating at `Number.MAX_SAFE_INTEGER`. */\nexport function toSafeNumber(value: bigint): number {\n return value > BigInt(Number.MAX_SAFE_INTEGER)\n ? Number.MAX_SAFE_INTEGER\n : Number(value);\n}\n\nfunction kindFromProto(kind: ErrorKind): IntegrationClientErrorKind {\n switch (kind) {\n case ErrorKind.SHUTTING_DOWN:\n return \"shutting_down\";\n case ErrorKind.GO_AWAY:\n return \"go_away\";\n case ErrorKind.NOT_FOUND:\n return \"not_found\";\n case ErrorKind.BAD_REQUEST:\n return \"bad_request\";\n case ErrorKind.UNAVAILABLE:\n return \"unavailable\";\n default:\n return \"unknown\";\n }\n}\n"],"mappings":";;;;;;;;;;;;AA6CA,IAAa,yBAAb,cAA4C,MAAM;;CAEhD,AAAS;;;;;CAMT,AAAS;CAET,YACE,MACA,SACA,SACA;AACA,QACE,SACA,SAAS,UAAU,SAAY,EAAE,OAAO,QAAQ,OAAO,GAAG,OAC3D;AACD,OAAK,OAAO;AACZ,OAAK,OAAO;AACZ,MAAI,SAAS,WAAW,OACtB,MAAK,SAAS,QAAQ;;;AAK5B,SAAgB,eAAe,OAA2C;CACxE,MAAM,OAAO,cAAc,MAAM,KAAK;CACtC,MAAM,UAAU,MAAM,WAAW;AACjC,KAAI,MAAM,qBAAqB,OAC7B,QAAO,IAAI,uBAAuB,MAAM,QAAQ;AAElD,QAAO,IAAI,uBACT,MACA,WAAW,MAAM,iBAAiB,IAAI,WACtC,EAAE,QAAQ,aAAa,MAAM,iBAAiB,EAAE,CACjD;;;AAIH,SAAgB,aAAa,OAAuB;AAClD,QAAO,QAAQ,OAAO,OAAO,iBAAiB,GAC1C,OAAO,mBACP,OAAO,MAAM;;AAGnB,SAAS,cAAc,MAA6C;AAClE,SAAQ,MAAR;EACE,KAAK,UAAU,cACb,QAAO;EACT,KAAK,UAAU,QACb,QAAO;EACT,KAAK,UAAU,UACb,QAAO;EACT,KAAK,UAAU,YACb,QAAO;EACT,KAAK,UAAU,YACb,QAAO;EACT,QACE,QAAO"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __bufbuild_protobuf_codegenv2 = require("@bufbuild/protobuf/codegenv2");
|
|
3
|
+
__bufbuild_protobuf_codegenv2 = require_rolldown_runtime.__toESM(__bufbuild_protobuf_codegenv2);
|
|
4
|
+
|
|
5
|
+
//#region src/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.ts
|
|
6
|
+
/**
|
|
7
|
+
* Describes the file dev/restate/ingress/ingestion/v1/ingestion_svc.proto.
|
|
8
|
+
*/
|
|
9
|
+
const file_dev_restate_ingress_ingestion_v1_ingestion_svc = /* @__PURE__ */ (0, __bufbuild_protobuf_codegenv2.fileDesc)("CjRkZXYvcmVzdGF0ZS9pbmdyZXNzL2luZ2VzdGlvbi92MS9pbmdlc3Rpb25fc3ZjLnByb3RvEiBkZXYucmVzdGF0ZS5pbmdyZXNzLmluZ2VzdGlvbi52MSLSAQoOSW5nZXN0aW9uU3RhcnQSEwoLcHJvZHVjZXJfaWQYASABKAkSEwoLaW50ZWdyYXRpb24YAiABKAkSTwoSZGVkdXBsaWNhdGlvbl9tb2RlGAMgASgOMjMuZGV2LnJlc3RhdGUuaW5ncmVzcy5pbmdlc3Rpb24udjEuRGVkdXBsaWNhdGlvbk1vZGUSRQoIZGVmYXVsdHMYBCABKAsyMy5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kxFRBAAEhAKDE9GRlNFVF9CQVNFRBABKqsBCglFcnJvcktpbmQSFgoSRVJST1JfS0lORF9VTktOT1dOEAASHAoYRVJST1JfS0lORF9TSFVUVElOR19ET1dOEAESFgoSRVJST1JfS0lORF9HT19BV0FZEAISGAoURVJST1JfS0lORF9OT1RfRk9VTkQQAxIaChZFUlJPUl9LSU5EX0JBRF9SRVFVRVNUEAQSGgoWRVJST1JfS0lORF9VTkFWQUlMQUJMRRAFMoUBCgxJbmdlc3Rpb25TdmMSdQoGSW5nZXN0EjIuZGV2LnJlc3RhdGUuaW5ncmVzcy5pbmdlc3Rpb24udjEuSW5nZXN0aW9uUmVxdWVzdBozLmRldi5yZXN0YXRlLmluZ3Jlc3MuaW5nZXN0aW9uLnYxLkluZ2VzdGlvblJlc3BvbnNlKAEwAUIsChhkZXYucmVzdGF0ZS5pbmdlc3Rpb24udjFCDkluZ2VzdGlvblByb3RvUAFiBnByb3RvMw");
|
|
10
|
+
/**
|
|
11
|
+
* Describes the message dev.restate.ingress.ingestion.v1.IngestionDefaults.
|
|
12
|
+
* Use `create(IngestionDefaultsSchema)` to create a new message.
|
|
13
|
+
*/
|
|
14
|
+
const IngestionDefaultsSchema = /* @__PURE__ */ (0, __bufbuild_protobuf_codegenv2.messageDesc)(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 1);
|
|
15
|
+
/**
|
|
16
|
+
* Describes the message dev.restate.ingress.ingestion.v1.IngestionInvocation.
|
|
17
|
+
* Use `create(IngestionInvocationSchema)` to create a new message.
|
|
18
|
+
*/
|
|
19
|
+
const IngestionInvocationSchema = /* @__PURE__ */ (0, __bufbuild_protobuf_codegenv2.messageDesc)(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 2);
|
|
20
|
+
/**
|
|
21
|
+
* Describes the message dev.restate.ingress.ingestion.v1.IngestionRequest.
|
|
22
|
+
* Use `create(IngestionRequestSchema)` to create a new message.
|
|
23
|
+
*/
|
|
24
|
+
const IngestionRequestSchema = /* @__PURE__ */ (0, __bufbuild_protobuf_codegenv2.messageDesc)(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 3);
|
|
25
|
+
/**
|
|
26
|
+
* How the server deduplicates the records of a stream.
|
|
27
|
+
*
|
|
28
|
+
* The mode is fixed for the lifetime of the stream: it is chosen once in the
|
|
29
|
+
* `Start` frame and cannot be changed by a later `IngestionDefaults` frame.
|
|
30
|
+
*
|
|
31
|
+
* Note that this only controls deduplication. Regardless of the mode, every
|
|
32
|
+
* `Invocation` must still carry an `offset`, offsets must still increase
|
|
33
|
+
* monotonically within a stream, and `Response.last_committed` still reports
|
|
34
|
+
* progress in terms of those offsets.
|
|
35
|
+
*
|
|
36
|
+
* @generated from enum dev.restate.ingress.ingestion.v1.DeduplicationMode
|
|
37
|
+
*/
|
|
38
|
+
let DeduplicationMode = /* @__PURE__ */ function(DeduplicationMode$1) {
|
|
39
|
+
/**
|
|
40
|
+
* Disable deduplication: every record accepted by the server becomes an
|
|
41
|
+
* invocation.
|
|
42
|
+
*
|
|
43
|
+
* Nothing is tracked across streams, so resending records after a
|
|
44
|
+
* reconnect duplicates them. Pick this mode only when the producer cannot
|
|
45
|
+
* supply a stable ID, or when duplicates are acceptable or already
|
|
46
|
+
* suppressed elsewhere (for example by an `idempotency_key`).
|
|
47
|
+
*
|
|
48
|
+
* `producer_id` is optional in this mode, but is still recorded on traces
|
|
49
|
+
* and metrics when set.
|
|
50
|
+
*
|
|
51
|
+
* @generated from enum value: DISABLED = 0;
|
|
52
|
+
*/
|
|
53
|
+
DeduplicationMode$1[DeduplicationMode$1["DISABLED"] = 0] = "DISABLED";
|
|
54
|
+
/**
|
|
55
|
+
* Deduplicate on `(producer_id, offset)`.
|
|
56
|
+
*
|
|
57
|
+
* The server tracks the highest committed offset per producer ID and
|
|
58
|
+
* silently drops any record whose offset is not above it, which makes
|
|
59
|
+
* resending a range of records after a reconnect safe: records the server
|
|
60
|
+
* already committed do not become duplicate invocations.
|
|
61
|
+
*
|
|
62
|
+
* This mode requires `producer_id` to be set; using it with an empty
|
|
63
|
+
* producer ID fails the stream with `GO_AWAY`. It also requires the
|
|
64
|
+
* producer to reuse the same ID across streams, since a new ID starts
|
|
65
|
+
* from a fresh deduplication state.
|
|
66
|
+
*
|
|
67
|
+
* @generated from enum value: OFFSET_BASED = 1;
|
|
68
|
+
*/
|
|
69
|
+
DeduplicationMode$1[DeduplicationMode$1["OFFSET_BASED"] = 1] = "OFFSET_BASED";
|
|
70
|
+
return DeduplicationMode$1;
|
|
71
|
+
}({});
|
|
72
|
+
/**
|
|
73
|
+
* @generated from enum dev.restate.ingress.ingestion.v1.ErrorKind
|
|
74
|
+
*/
|
|
75
|
+
let ErrorKind = /* @__PURE__ */ function(ErrorKind$1) {
|
|
76
|
+
/**
|
|
77
|
+
* @generated from enum value: ERROR_KIND_UNKNOWN = 0;
|
|
78
|
+
*/
|
|
79
|
+
ErrorKind$1[ErrorKind$1["UNKNOWN"] = 0] = "UNKNOWN";
|
|
80
|
+
/**
|
|
81
|
+
* The server is shutting down and can't accept more
|
|
82
|
+
* records. The caller must switch to a new ingress
|
|
83
|
+
* node and respect the reported last_committed.
|
|
84
|
+
*
|
|
85
|
+
* @generated from enum value: ERROR_KIND_SHUTTING_DOWN = 1;
|
|
86
|
+
*/
|
|
87
|
+
ErrorKind$1[ErrorKind$1["SHUTTING_DOWN"] = 1] = "SHUTTING_DOWN";
|
|
88
|
+
/**
|
|
89
|
+
* A protocol violation, for example sending another
|
|
90
|
+
* Start message after the initial one or not
|
|
91
|
+
* respecting the send window.
|
|
92
|
+
*
|
|
93
|
+
* @generated from enum value: ERROR_KIND_GO_AWAY = 2;
|
|
94
|
+
*/
|
|
95
|
+
ErrorKind$1[ErrorKind$1["GO_AWAY"] = 2] = "GO_AWAY";
|
|
96
|
+
/**
|
|
97
|
+
* The invocation target was not found (unknown
|
|
98
|
+
* service or handler).
|
|
99
|
+
*
|
|
100
|
+
* @generated from enum value: ERROR_KIND_NOT_FOUND = 3;
|
|
101
|
+
*/
|
|
102
|
+
ErrorKind$1[ErrorKind$1["NOT_FOUND"] = 3] = "NOT_FOUND";
|
|
103
|
+
/**
|
|
104
|
+
* Covers a wide range of client errors, including:
|
|
105
|
+
* - unexpected key
|
|
106
|
+
* - missing key
|
|
107
|
+
* - invalid scope format
|
|
108
|
+
* and similar errors. The `Error.message` should
|
|
109
|
+
* carry more details.
|
|
110
|
+
*
|
|
111
|
+
* @generated from enum value: ERROR_KIND_BAD_REQUEST = 4;
|
|
112
|
+
*/
|
|
113
|
+
ErrorKind$1[ErrorKind$1["BAD_REQUEST"] = 4] = "BAD_REQUEST";
|
|
114
|
+
/**
|
|
115
|
+
* The server can't process the request yet, for
|
|
116
|
+
* example because it has not loaded the schema.
|
|
117
|
+
* The caller should retry later (possibly on a
|
|
118
|
+
* different ingress node) without changing the
|
|
119
|
+
* request.
|
|
120
|
+
*
|
|
121
|
+
* @generated from enum value: ERROR_KIND_UNAVAILABLE = 5;
|
|
122
|
+
*/
|
|
123
|
+
ErrorKind$1[ErrorKind$1["UNAVAILABLE"] = 5] = "UNAVAILABLE";
|
|
124
|
+
return ErrorKind$1;
|
|
125
|
+
}({});
|
|
126
|
+
/**
|
|
127
|
+
* @generated from service dev.restate.ingress.ingestion.v1.IngestionSvc
|
|
128
|
+
*/
|
|
129
|
+
const IngestionSvc = /* @__PURE__ */ (0, __bufbuild_protobuf_codegenv2.serviceDesc)(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 0);
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.DeduplicationMode = DeduplicationMode;
|
|
133
|
+
exports.ErrorKind = ErrorKind;
|
|
134
|
+
exports.IngestionDefaultsSchema = IngestionDefaultsSchema;
|
|
135
|
+
exports.IngestionInvocationSchema = IngestionInvocationSchema;
|
|
136
|
+
exports.IngestionRequestSchema = IngestionRequestSchema;
|
|
137
|
+
exports.IngestionSvc = IngestionSvc;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@bufbuild/protobuf";
|