@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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -2
  3. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/api.d.cts +219 -0
  5. package/dist/api.d.cts.map +1 -0
  6. package/dist/api.d.ts +219 -0
  7. package/dist/api.d.ts.map +1 -0
  8. package/dist/client.cjs +101 -0
  9. package/dist/client.d.cts +26 -0
  10. package/dist/client.d.cts.map +1 -0
  11. package/dist/client.d.ts +26 -0
  12. package/dist/client.d.ts.map +1 -0
  13. package/dist/client.js +99 -0
  14. package/dist/client.js.map +1 -0
  15. package/dist/errors.cjs +52 -0
  16. package/dist/errors.d.cts +42 -0
  17. package/dist/errors.d.cts.map +1 -0
  18. package/dist/errors.d.ts +42 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +51 -0
  21. package/dist/errors.js.map +1 -0
  22. package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.cjs +137 -0
  23. package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.d.cts +1 -0
  24. package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.d.ts +2 -0
  25. package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js +131 -0
  26. package/dist/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.js.map +1 -0
  27. package/dist/index.cjs +5 -0
  28. package/dist/index.d.cts +4 -0
  29. package/dist/index.d.ts +4 -0
  30. package/dist/index.js +4 -0
  31. package/dist/package.cjs +11 -0
  32. package/dist/package.js +6 -0
  33. package/dist/package.js.map +1 -0
  34. package/dist/producer.cjs +245 -0
  35. package/dist/producer.js +244 -0
  36. package/dist/producer.js.map +1 -0
  37. package/dist/proto.cjs +37 -0
  38. package/dist/proto.js +35 -0
  39. package/dist/proto.js.map +1 -0
  40. package/dist/queue.cjs +40 -0
  41. package/dist/queue.js +40 -0
  42. package/dist/queue.js.map +1 -0
  43. package/package.json +61 -3
@@ -0,0 +1,131 @@
1
+ import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
2
+
3
+ //#region src/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.ts
4
+ /**
5
+ * Describes the file dev/restate/ingress/ingestion/v1/ingestion_svc.proto.
6
+ */
7
+ const file_dev_restate_ingress_ingestion_v1_ingestion_svc = /* @__PURE__ */ fileDesc("CjRkZXYvcmVzdGF0ZS9pbmdyZXNzL2luZ2VzdGlvbi92MS9pbmdlc3Rpb25fc3ZjLnByb3RvEiBkZXYucmVzdGF0ZS5pbmdyZXNzLmluZ2VzdGlvbi52MSLSAQoOSW5nZXN0aW9uU3RhcnQSEwoLcHJvZHVjZXJfaWQYASABKAkSEwoLaW50ZWdyYXRpb24YAiABKAkSTwoSZGVkdXBsaWNhdGlvbl9tb2RlGAMgASgOMjMuZGV2LnJlc3RhdGUuaW5ncmVzcy5pbmdlc3Rpb24udjEuRGVkdXBsaWNhdGlvbk1vZGUSRQoIZGVmYXVsdHMYBCABKAsyMy5kZXYucmVzdGF0ZS5pbmdyZXNzLmluZ2VzdGlvbi52MS5Jbmdlc3Rpb25EZWZhdWx0cyK+AgoRSW5nZXN0aW9uRGVmYXVsdHMSEgoFc2NvcGUYAiABKAlIAIgBARIWCglsaW1pdF9rZXkYAyABKAlIAYgBARIUCgdzZXJ2aWNlGAQgASgJSAKIAQESFAoHaGFuZGxlchgFIAEoCUgDiAEBEhAKA2tleRgGIAEoCUgEiAEBElEKB2hlYWRlcnMYCCADKAsyQC5kZXYucmVzdGF0ZS5pbmdyZXNzLmluZ2VzdGlvbi52MS5Jbmdlc3Rpb25EZWZhdWx0cy5IZWFkZXJzRW50cnkaLgoMSGVhZGVyc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFC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GlvblJlc3BvbnNlKAEwAUIsChhkZXYucmVzdGF0ZS5pbmdlc3Rpb24udjFCDkluZ2VzdGlvblByb3RvUAFiBnByb3RvMw");
8
+ /**
9
+ * Describes the message dev.restate.ingress.ingestion.v1.IngestionDefaults.
10
+ * Use `create(IngestionDefaultsSchema)` to create a new message.
11
+ */
12
+ const IngestionDefaultsSchema = /* @__PURE__ */ messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 1);
13
+ /**
14
+ * Describes the message dev.restate.ingress.ingestion.v1.IngestionInvocation.
15
+ * Use `create(IngestionInvocationSchema)` to create a new message.
16
+ */
17
+ const IngestionInvocationSchema = /* @__PURE__ */ messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 2);
18
+ /**
19
+ * Describes the message dev.restate.ingress.ingestion.v1.IngestionRequest.
20
+ * Use `create(IngestionRequestSchema)` to create a new message.
21
+ */
22
+ const IngestionRequestSchema = /* @__PURE__ */ messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 3);
23
+ /**
24
+ * How the server deduplicates the records of a stream.
25
+ *
26
+ * The mode is fixed for the lifetime of the stream: it is chosen once in the
27
+ * `Start` frame and cannot be changed by a later `IngestionDefaults` frame.
28
+ *
29
+ * Note that this only controls deduplication. Regardless of the mode, every
30
+ * `Invocation` must still carry an `offset`, offsets must still increase
31
+ * monotonically within a stream, and `Response.last_committed` still reports
32
+ * progress in terms of those offsets.
33
+ *
34
+ * @generated from enum dev.restate.ingress.ingestion.v1.DeduplicationMode
35
+ */
36
+ let DeduplicationMode = /* @__PURE__ */ function(DeduplicationMode$1) {
37
+ /**
38
+ * Disable deduplication: every record accepted by the server becomes an
39
+ * invocation.
40
+ *
41
+ * Nothing is tracked across streams, so resending records after a
42
+ * reconnect duplicates them. Pick this mode only when the producer cannot
43
+ * supply a stable ID, or when duplicates are acceptable or already
44
+ * suppressed elsewhere (for example by an `idempotency_key`).
45
+ *
46
+ * `producer_id` is optional in this mode, but is still recorded on traces
47
+ * and metrics when set.
48
+ *
49
+ * @generated from enum value: DISABLED = 0;
50
+ */
51
+ DeduplicationMode$1[DeduplicationMode$1["DISABLED"] = 0] = "DISABLED";
52
+ /**
53
+ * Deduplicate on `(producer_id, offset)`.
54
+ *
55
+ * The server tracks the highest committed offset per producer ID and
56
+ * silently drops any record whose offset is not above it, which makes
57
+ * resending a range of records after a reconnect safe: records the server
58
+ * already committed do not become duplicate invocations.
59
+ *
60
+ * This mode requires `producer_id` to be set; using it with an empty
61
+ * producer ID fails the stream with `GO_AWAY`. It also requires the
62
+ * producer to reuse the same ID across streams, since a new ID starts
63
+ * from a fresh deduplication state.
64
+ *
65
+ * @generated from enum value: OFFSET_BASED = 1;
66
+ */
67
+ DeduplicationMode$1[DeduplicationMode$1["OFFSET_BASED"] = 1] = "OFFSET_BASED";
68
+ return DeduplicationMode$1;
69
+ }({});
70
+ /**
71
+ * @generated from enum dev.restate.ingress.ingestion.v1.ErrorKind
72
+ */
73
+ let ErrorKind = /* @__PURE__ */ function(ErrorKind$1) {
74
+ /**
75
+ * @generated from enum value: ERROR_KIND_UNKNOWN = 0;
76
+ */
77
+ ErrorKind$1[ErrorKind$1["UNKNOWN"] = 0] = "UNKNOWN";
78
+ /**
79
+ * The server is shutting down and can't accept more
80
+ * records. The caller must switch to a new ingress
81
+ * node and respect the reported last_committed.
82
+ *
83
+ * @generated from enum value: ERROR_KIND_SHUTTING_DOWN = 1;
84
+ */
85
+ ErrorKind$1[ErrorKind$1["SHUTTING_DOWN"] = 1] = "SHUTTING_DOWN";
86
+ /**
87
+ * A protocol violation, for example sending another
88
+ * Start message after the initial one or not
89
+ * respecting the send window.
90
+ *
91
+ * @generated from enum value: ERROR_KIND_GO_AWAY = 2;
92
+ */
93
+ ErrorKind$1[ErrorKind$1["GO_AWAY"] = 2] = "GO_AWAY";
94
+ /**
95
+ * The invocation target was not found (unknown
96
+ * service or handler).
97
+ *
98
+ * @generated from enum value: ERROR_KIND_NOT_FOUND = 3;
99
+ */
100
+ ErrorKind$1[ErrorKind$1["NOT_FOUND"] = 3] = "NOT_FOUND";
101
+ /**
102
+ * Covers a wide range of client errors, including:
103
+ * - unexpected key
104
+ * - missing key
105
+ * - invalid scope format
106
+ * and similar errors. The `Error.message` should
107
+ * carry more details.
108
+ *
109
+ * @generated from enum value: ERROR_KIND_BAD_REQUEST = 4;
110
+ */
111
+ ErrorKind$1[ErrorKind$1["BAD_REQUEST"] = 4] = "BAD_REQUEST";
112
+ /**
113
+ * The server can't process the request yet, for
114
+ * example because it has not loaded the schema.
115
+ * The caller should retry later (possibly on a
116
+ * different ingress node) without changing the
117
+ * request.
118
+ *
119
+ * @generated from enum value: ERROR_KIND_UNAVAILABLE = 5;
120
+ */
121
+ ErrorKind$1[ErrorKind$1["UNAVAILABLE"] = 5] = "UNAVAILABLE";
122
+ return ErrorKind$1;
123
+ }({});
124
+ /**
125
+ * @generated from service dev.restate.ingress.ingestion.v1.IngestionSvc
126
+ */
127
+ const IngestionSvc = /* @__PURE__ */ serviceDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 0);
128
+
129
+ //#endregion
130
+ export { DeduplicationMode, ErrorKind, IngestionDefaultsSchema, IngestionInvocationSchema, IngestionRequestSchema, IngestionSvc };
131
+ //# sourceMappingURL=ingestion_svc_pb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingestion_svc_pb.js","names":["file_dev_restate_ingress_ingestion_v1_ingestion_svc: GenFile","IngestionDefaultsSchema: GenMessage<IngestionDefaults>","IngestionInvocationSchema: GenMessage<IngestionInvocation>","IngestionRequestSchema: GenMessage<IngestionRequest>","IngestionSvc: GenService<{\n /**\n * Opens a bidirectional node-to-node stream.\n *\n * @generated from rpc dev.restate.ingress.ingestion.v1.IngestionSvc.Ingest\n */\n ingest: {\n methodKind: \"bidi_streaming\";\n input: typeof IngestionRequestSchema;\n output: typeof IngestionResponseSchema;\n };\n}>"],"sources":["../../../../../../../src/generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.ts"],"sourcesContent":["// Copyright (c) 2026 - Restate Software, Inc., Restate GmbH\n//\n// This file is part of the Restate service protocol, which is\n// 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/proto/blob/main/LICENSE\n\n// @generated by protoc-gen-es v2.16.0 with parameter \"target=ts,import_extension=js\"\n// @generated from file dev/restate/ingress/ingestion/v1/ingestion_svc.proto (package dev.restate.ingress.ingestion.v1, syntax proto3)\n/* eslint-disable */\n\nimport type {\n GenEnum,\n GenFile,\n GenMessage,\n GenService,\n} from \"@bufbuild/protobuf/codegenv2\";\nimport {\n enumDesc,\n fileDesc,\n messageDesc,\n serviceDesc,\n} from \"@bufbuild/protobuf/codegenv2\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file dev/restate/ingress/ingestion/v1/ingestion_svc.proto.\n */\nexport const file_dev_restate_ingress_ingestion_v1_ingestion_svc: GenFile =\n /*@__PURE__*/\n fileDesc(\n \"CjRkZXYvcmVzdGF0ZS9pbmdyZXNzL2luZ2VzdGlvbi92MS9pbmdlc3Rpb25fc3ZjLnByb3RvEiBkZXYucmVzdGF0ZS5pbmdyZXNzLmluZ2VzdGlvbi52MSLSAQoOSW5nZXN0aW9uU3RhcnQSEwoLcHJvZHVjZXJfaWQYASABKAkSEwoLaW50ZWdyYXRpb24YAiABKAkSTwoSZGVkdXBsaWNhdGlvbl9tb2RlGAMgASgOMjMuZGV2LnJlc3RhdGUuaW5ncmVzcy5pbmdlc3Rpb24udjEuRGVkdXBsaWNhdGlvbk1vZGUSRQoIZGVmYXVsdHMYBCABKAsyMy5kZXYucmVzdGF0ZS5pbmdyZXNzLmluZ2VzdGlvbi52MS5Jbmdlc3Rpb25EZWZhdWx0cyK+AgoRSW5nZXN0aW9uRGVmYXVsdHMSEgoFc2NvcGUYAiABKAlIAIgBARIWCglsaW1pdF9rZXkYAyABKAlIAYgBARIUCgdzZXJ2aWNlGAQgASgJSAKIAQ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PUl9LSU5EX0JBRF9SRVFVRVNUEAQSGgoWRVJST1JfS0lORF9VTkFWQUlMQUJMRRAFMoUBCgxJbmdlc3Rpb25TdmMSdQoGSW5nZXN0EjIuZGV2LnJlc3RhdGUuaW5ncmVzcy5pbmdlc3Rpb24udjEuSW5nZXN0aW9uUmVxdWVzdBozLmRldi5yZXN0YXRlLmluZ3Jlc3MuaW5nZXN0aW9uLnYxLkluZ2VzdGlvblJlc3BvbnNlKAEwAUIsChhkZXYucmVzdGF0ZS5pbmdlc3Rpb24udjFCDkluZ2VzdGlvblByb3RvUAFiBnByb3RvMw\"\n );\n\n/**\n * Required.\n * A Start frame must be sent before any IngestionDefaults or\n * IngestionInvocation frame.\n * Sending a Start frame again during the lifetime of\n * the stream is illegal: the server will return an\n * error and terminate the stream.\n *\n * Invalid Start message will cause an error\n * to be returned immediately, and stream to be teared down\n * immediately\n *\n * @generated from message dev.restate.ingress.ingestion.v1.IngestionStart\n */\nexport type IngestionStart =\n Message<\"dev.restate.ingress.ingestion.v1.IngestionStart\"> & {\n /**\n * Stable identity of the *producer*, not of this particular stream.\n *\n * The ID is an opaque string: this API is generic, so the server\n * attaches no format or meaning to it. It is entirely up to the producer\n * to pick an ID that uniquely identifies a single source of sequential,\n * ordered messages, since offsets are only meaningful relative to that\n * source. For a Kafka-based producer, for instance, an ID composed of\n * cluster + topic + consumer-group + partition would identify such a\n * source.\n *\n * Depending on the DedupMode, the same producer must reuse the same\n * ID across streams (including after reconnects), otherwise deduplication\n * cannot work: the server tracks committed offsets per producer ID,\n * so a new ID starts a fresh deduplication state and previously committed\n * records may be duplicated.\n *\n * The ID must be unique across producers: two distinct producers\n * sharing an ID will be treated as one and will shadow each other's\n * offsets.\n *\n * Max length is 256 bytes.\n *\n * @generated from field: string producer_id = 1;\n */\n producerId: string;\n\n /**\n * Integration identification in format `name/version`\n * Max length is 64 bytes\n *\n * @generated from field: string integration = 2;\n */\n integration: string;\n\n /**\n * Deduplication strategy for this stream. Defaults to `DISABLED`.\n *\n * @generated from field: dev.restate.ingress.ingestion.v1.DeduplicationMode deduplication_mode = 3;\n */\n deduplicationMode: DeduplicationMode;\n\n /**\n * Initial ingestion defaults for the stream, letting the client\n * establish its defaults up front instead of following\n * the Start frame with a separate IngestionDefaults frame.\n * Clients can still send further IngestionDefaults frames later\n * to update these defaults during the stream.\n *\n * @generated from field: dev.restate.ingress.ingestion.v1.IngestionDefaults defaults = 4;\n */\n defaults?: IngestionDefaults | undefined;\n };\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.IngestionStart.\n * Use `create(IngestionStartSchema)` to create a new message.\n */\nexport const IngestionStartSchema: GenMessage<IngestionStart> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 0);\n\n/**\n * An IngestionDefaults message defines the default values applied to all\n * subsequent records in the stream.\n * Each IngestionDefaults message must specify every field it wants to set.\n * Each IngestionDefaults message overwrites the values set by previous IngestionDefaults messages.\n * Leaving an optional field unset clears any previously established\n * default, so later records must supply the value explicitly if needed.\n *\n * It's okay to send IngestionDefaults more than once to tweak and change the defaults\n * during the life time of the stream.\n *\n * Every field here has a matching field on `Invocation`. For those fields the\n * per-record value wins: if the `Invocation` sets the field, its value is used\n * and the default from `IngestionDefaults` is ignored; if it leaves the field unset, the\n * current default from `IngestionDefaults` is used instead. If neither is set, the field\n * is treated as absent, which may be an error for fields that are required for\n * the given target (e.g. `key` for virtual objects and workflows).\n *\n * `headers` are extended with the Invocation's `additional_headers`\n * overriding existing keys.\n *\n * Note: Keep the field tags uniform with the Invocation message\n * This allows parsing IngestionInvocation message as IngestionDefaults.\n *\n * @generated from message dev.restate.ingress.ingestion.v1.IngestionDefaults\n */\nexport type IngestionDefaults =\n Message<\"dev.restate.ingress.ingestion.v1.IngestionDefaults\"> & {\n /**\n * scope is limited to 36 bytes.\n *\n * @generated from field: optional string scope = 2;\n */\n scope?: string | undefined;\n\n /**\n * @generated from field: optional string limit_key = 3;\n */\n limitKey?: string | undefined;\n\n /**\n * @generated from field: optional string service = 4;\n */\n service?: string | undefined;\n\n /**\n * @generated from field: optional string handler = 5;\n */\n handler?: string | undefined;\n\n /**\n * @generated from field: optional string key = 6;\n */\n key?: string | undefined;\n\n /**\n * Total headers size should not exceed a max of 2KiB (keys + values)\n *\n * @generated from field: map<string, string> headers = 8;\n */\n headers: { [key: string]: string };\n };\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.IngestionDefaults.\n * Use `create(IngestionDefaultsSchema)` to create a new message.\n */\nexport const IngestionDefaultsSchema: GenMessage<IngestionDefaults> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 1);\n\n/**\n * @generated from message dev.restate.ingress.ingestion.v1.IngestionInvocation\n */\nexport type IngestionInvocation =\n Message<\"dev.restate.ingress.ingestion.v1.IngestionInvocation\"> & {\n /**\n * Position of this record within the producer's sequence, and the value\n * deduplication is based on.\n *\n * It must increase monotonically for a given producer ID, across the whole\n * lifetime of that producer and not just within a single stream. On\n * reconnect, resume from the `Response.last_committed` reported for the\n * producer rather than restarting the numbering.\n *\n * Offsets do not have to be contiguous; gaps are allowed, so it is fine to\n * skip records. Only the ordering matters. Offsets are 0-based, so 0 is a\n * valid first offset.\n *\n * Within a single stream the server enforces this: sending an offset lower\n * than one already sent on the same stream is a protocol violation and\n * fails the stream with `GO_AWAY`.\n *\n * Across streams nothing is enforced, since the server does not remember\n * what a previous stream sent. Reusing an offset already committed by an\n * earlier stream of the same producer is not reported as an error: the\n * record is treated as a duplicate and silently dropped, meaning it does\n * not become an invocation and produces no `Error` frame. A client that\n * restarts its numbering after a reconnect will therefore see its records\n * disappear without any signal.\n *\n * @generated from field: uint64 offset = 1;\n */\n offset: bigint;\n\n /**\n * scope is limited to 36 bytes.\n *\n * @generated from field: optional string scope = 2;\n */\n scope?: string | undefined;\n\n /**\n * @generated from field: optional string limit_key = 3;\n */\n limitKey?: string | undefined;\n\n /**\n * @generated from field: optional string service = 4;\n */\n service?: string | undefined;\n\n /**\n * @generated from field: optional string handler = 5;\n */\n handler?: string | undefined;\n\n /**\n * Required when the target service is a virtual object (VO).\n * or workflow. This can also be set via a preceding IngestionDefaults message.\n *\n * @generated from field: optional string key = 6;\n */\n key?: string | undefined;\n\n /**\n * @generated from field: optional string idempotency_key = 7;\n */\n idempotencyKey?: string | undefined;\n\n /**\n * IngestionDefaults::headers + IngestionInvocation::headers size\n * should not exceed a max of 2KiB (keys + values)\n *\n * @generated from field: map<string, string> additional_headers = 8;\n */\n additionalHeaders: { [key: string]: string };\n\n /**\n * starttime timestamp in ms.\n *\n * @generated from field: optional uint64 invoke_time_ts_ms = 10;\n */\n invokeTimeTsMs?: bigint | undefined;\n\n /**\n * This uses the w3c tracecontext format\n * https://www.w3.org/TR/trace-context/\n *\n * @generated from field: optional string traceparent = 11;\n */\n traceparent?: string | undefined;\n\n /**\n * @generated from field: optional string tracestate = 12;\n */\n tracestate?: string | undefined;\n\n /**\n * @generated from field: bytes payload = 13;\n */\n payload: Uint8Array;\n };\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.IngestionInvocation.\n * Use `create(IngestionInvocationSchema)` to create a new message.\n */\nexport const IngestionInvocationSchema: GenMessage<IngestionInvocation> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 2);\n\n/**\n * @generated from message dev.restate.ingress.ingestion.v1.IngestionRequest\n */\nexport type IngestionRequest =\n Message<\"dev.restate.ingress.ingestion.v1.IngestionRequest\"> & {\n /**\n * @generated from oneof dev.restate.ingress.ingestion.v1.IngestionRequest.kind\n */\n kind:\n | {\n /**\n * @generated from field: dev.restate.ingress.ingestion.v1.IngestionStart start = 1;\n */\n value: IngestionStart;\n case: \"start\";\n }\n | {\n /**\n * @generated from field: dev.restate.ingress.ingestion.v1.IngestionDefaults defaults = 2;\n */\n value: IngestionDefaults;\n case: \"defaults\";\n }\n | {\n /**\n * @generated from field: dev.restate.ingress.ingestion.v1.IngestionInvocation invocation = 3;\n */\n value: IngestionInvocation;\n case: \"invocation\";\n }\n | { case: undefined; value?: undefined };\n };\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.IngestionRequest.\n * Use `create(IngestionRequestSchema)` to create a new message.\n */\nexport const IngestionRequestSchema: GenMessage<IngestionRequest> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 3);\n\n/**\n * Application-layer flow-control message.\n * It tells the client how many more bytes it can send\n * before it must wait for the next window update.\n *\n * This frame only replenishes the window; it carries no\n * acknowledgement. Acking is the job of the enclosing\n * IngestionResponse.last_committed, which is set\n * regardless of which variant the response carries.\n *\n * If the next invocation is bigger than the available\n * window, it's legal to send it anyway (letting the\n * window go negative) so the client doesn't block. Once\n * the window reaches 0 (or less) it's illegal to send\n * more requests until the next window update; sending\n * more invocations while the window is depleted can\n * result in a GO_AWAY error.\n *\n * Before the first WindowUpdate is received, the client\n * may assume an initial window of 32 KiB. This is the\n * smallest window the server will ever grant, so it's\n * always safe to start sending against it; every\n * WindowUpdate that follows can only grow the window\n * beyond that point.\n *\n * Only IngestionInvocation frames are counted against the window;\n * IngestionStart and IngestionDefaults frames are free and never\n * consume it.\n *\n * @generated from message dev.restate.ingress.ingestion.v1.WindowUpdate\n */\nexport type WindowUpdate =\n Message<\"dev.restate.ingress.ingestion.v1.WindowUpdate\"> & {\n /**\n * @generated from field: uint32 increment_bytes = 1;\n */\n incrementBytes: number;\n };\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.WindowUpdate.\n * Use `create(WindowUpdateSchema)` to create a new message.\n */\nexport const WindowUpdateSchema: GenMessage<WindowUpdate> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 4);\n\n/**\n * An error frame. It is always the last frame of the stream: whether the\n * error is stream-scoped or record-scoped, the server tears the stream down\n * right after sending it and processes no further messages.\n *\n * Record-scoped errors are the ones that carry `invocation_offset`: the\n * record at that offset was rejected (for example a missing key, an unknown\n * handler, or an internal ingestion failure) while the stream itself is\n * still well-formed. Stream-scoped errors leave `invocation_offset` unset\n * and describe a condition of the stream as a whole (shutdown, a protocol\n * violation, or invalid `Start`/`IngestionDefaults`).\n *\n * Even a record-scoped error terminates the stream, on purpose. Skipping the\n * faulty record and continuing would commit the records that follow it and\n * move the deduplication high water mark past the failed offset, making it\n * impossible to ever ingest that record afterwards. Terminating instead\n * keeps the high water mark where it is and leaves the decision to the\n * client.\n *\n * Recovery is therefore the client's responsibility: reconnect with the same\n * producer ID, resume from the `last_committed` reported on the response\n * that carried this error, and skip (or fix) the offending record before\n * resending the rest. Note that records after the failed offset may have\n * already been sent by the client but were not committed; they must be\n * resent.\n *\n * @generated from message dev.restate.ingress.ingestion.v1.Error\n */\nexport type Error = Message<\"dev.restate.ingress.ingestion.v1.Error\"> & {\n /**\n * if set, the error is associated\n * with the invocation with that offset\n *\n * @generated from field: optional uint64 invocation_offset = 1;\n */\n invocationOffset?: bigint | undefined;\n\n /**\n * @generated from field: dev.restate.ingress.ingestion.v1.ErrorKind kind = 2;\n */\n kind: ErrorKind;\n\n /**\n * @generated from field: string message = 3;\n */\n message: string;\n};\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.Error.\n * Use `create(ErrorSchema)` to create a new message.\n */\nexport const ErrorSchema: GenMessage<Error> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 5);\n\n/**\n * @generated from message dev.restate.ingress.ingestion.v1.IngestionResponse\n */\nexport type IngestionResponse =\n Message<\"dev.restate.ingress.ingestion.v1.IngestionResponse\"> & {\n /**\n * Acknowledgement. When set, every record up to and\n * including this offset has been committed.\n *\n * It is set on every response that has something to ack,\n * including responses carrying an Error, so a client whose\n * stream is torn down can always resume from the offset on\n * the last response it saw.\n *\n * It is unset only when nothing has been committed yet on\n * this stream. The field must be optional because offsets\n * are 0-based: \"offset 0 committed\" has to stay\n * distinguishable from \"nothing committed\", which matters\n * when an error is returned on the very first ingestion\n * message.\n *\n * @generated from field: optional uint64 last_committed = 1;\n */\n lastCommitted?: bigint | undefined;\n\n /**\n * @generated from oneof dev.restate.ingress.ingestion.v1.IngestionResponse.response\n */\n response:\n | {\n /**\n * @generated from field: dev.restate.ingress.ingestion.v1.WindowUpdate window_update = 2;\n */\n value: WindowUpdate;\n case: \"windowUpdate\";\n }\n | {\n /**\n * @generated from field: dev.restate.ingress.ingestion.v1.Error error = 3;\n */\n value: Error;\n case: \"error\";\n }\n | { case: undefined; value?: undefined };\n };\n\n/**\n * Describes the message dev.restate.ingress.ingestion.v1.IngestionResponse.\n * Use `create(IngestionResponseSchema)` to create a new message.\n */\nexport const IngestionResponseSchema: GenMessage<IngestionResponse> =\n /*@__PURE__*/\n messageDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 6);\n\n/**\n * How the server deduplicates the records of a stream.\n *\n * The mode is fixed for the lifetime of the stream: it is chosen once in the\n * `Start` frame and cannot be changed by a later `IngestionDefaults` frame.\n *\n * Note that this only controls deduplication. Regardless of the mode, every\n * `Invocation` must still carry an `offset`, offsets must still increase\n * monotonically within a stream, and `Response.last_committed` still reports\n * progress in terms of those offsets.\n *\n * @generated from enum dev.restate.ingress.ingestion.v1.DeduplicationMode\n */\nexport enum DeduplicationMode {\n /**\n * Disable deduplication: every record accepted by the server becomes an\n * invocation.\n *\n * Nothing is tracked across streams, so resending records after a\n * reconnect duplicates them. Pick this mode only when the producer cannot\n * supply a stable ID, or when duplicates are acceptable or already\n * suppressed elsewhere (for example by an `idempotency_key`).\n *\n * `producer_id` is optional in this mode, but is still recorded on traces\n * and metrics when set.\n *\n * @generated from enum value: DISABLED = 0;\n */\n DISABLED = 0,\n\n /**\n * Deduplicate on `(producer_id, offset)`.\n *\n * The server tracks the highest committed offset per producer ID and\n * silently drops any record whose offset is not above it, which makes\n * resending a range of records after a reconnect safe: records the server\n * already committed do not become duplicate invocations.\n *\n * This mode requires `producer_id` to be set; using it with an empty\n * producer ID fails the stream with `GO_AWAY`. It also requires the\n * producer to reuse the same ID across streams, since a new ID starts\n * from a fresh deduplication state.\n *\n * @generated from enum value: OFFSET_BASED = 1;\n */\n OFFSET_BASED = 1,\n}\n\n/**\n * Describes the enum dev.restate.ingress.ingestion.v1.DeduplicationMode.\n */\nexport const DeduplicationModeSchema: GenEnum<DeduplicationMode> =\n /*@__PURE__*/\n enumDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 0);\n\n/**\n * @generated from enum dev.restate.ingress.ingestion.v1.ErrorKind\n */\nexport enum ErrorKind {\n /**\n * @generated from enum value: ERROR_KIND_UNKNOWN = 0;\n */\n UNKNOWN = 0,\n\n /**\n * The server is shutting down and can't accept more\n * records. The caller must switch to a new ingress\n * node and respect the reported last_committed.\n *\n * @generated from enum value: ERROR_KIND_SHUTTING_DOWN = 1;\n */\n SHUTTING_DOWN = 1,\n\n /**\n * A protocol violation, for example sending another\n * Start message after the initial one or not\n * respecting the send window.\n *\n * @generated from enum value: ERROR_KIND_GO_AWAY = 2;\n */\n GO_AWAY = 2,\n\n /**\n * The invocation target was not found (unknown\n * service or handler).\n *\n * @generated from enum value: ERROR_KIND_NOT_FOUND = 3;\n */\n NOT_FOUND = 3,\n\n /**\n * Covers a wide range of client errors, including:\n * - unexpected key\n * - missing key\n * - invalid scope format\n * and similar errors. The `Error.message` should\n * carry more details.\n *\n * @generated from enum value: ERROR_KIND_BAD_REQUEST = 4;\n */\n BAD_REQUEST = 4,\n\n /**\n * The server can't process the request yet, for\n * example because it has not loaded the schema.\n * The caller should retry later (possibly on a\n * different ingress node) without changing the\n * request.\n *\n * @generated from enum value: ERROR_KIND_UNAVAILABLE = 5;\n */\n UNAVAILABLE = 5,\n}\n\n/**\n * Describes the enum dev.restate.ingress.ingestion.v1.ErrorKind.\n */\nexport const ErrorKindSchema: GenEnum<ErrorKind> =\n /*@__PURE__*/\n enumDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 1);\n\n/**\n * @generated from service dev.restate.ingress.ingestion.v1.IngestionSvc\n */\nexport const IngestionSvc: GenService<{\n /**\n * Opens a bidirectional node-to-node stream.\n *\n * @generated from rpc dev.restate.ingress.ingestion.v1.IngestionSvc.Ingest\n */\n ingest: {\n methodKind: \"bidi_streaming\";\n input: typeof IngestionRequestSchema;\n output: typeof IngestionResponseSchema;\n };\n}> =\n /*@__PURE__*/\n serviceDesc(file_dev_restate_ingress_ingestion_v1_ingestion_svc, 0);\n"],"mappings":";;;;;;AA8BA,MAAaA,sDAEX,yBACE,y7FACD;;;;;AAmJH,MAAaC,0BAEX,4BAAY,qDAAqD,EAAE;;;;;AA6GrE,MAAaC,4BAEX,4BAAY,qDAAqD,EAAE;;;;;AAuCrE,MAAaC,yBAEX,4BAAY,qDAAqD,EAAE;;;;;;;;;;;;;;AA4KrE,IAAY,kEAAL;;;;;;;;;;;;;;;AAeL;;;;;;;;;;;;;;;;AAiBA;;;;;;AAaF,IAAY,kDAAL;;;;AAIL;;;;;;;;AASA;;;;;;;;AASA;;;;;;;AAQA;;;;;;;;;;;AAYA;;;;;;;;;;AAWA;;;;;;AAaF,MAAaC,eAaX,4BAAY,qDAAqD,EAAE"}
package/dist/index.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const require_errors = require('./errors.cjs');
2
+ const require_client = require('./client.cjs');
3
+
4
+ exports.IntegrationClientError = require_errors.IntegrationClientError;
5
+ exports.connect = require_client.connect;
@@ -0,0 +1,4 @@
1
+ import { ExactlyOnceInvocation, ExactlyOnceProducer, IntegrationClient, IntegrationClientOptions, Invocation, InvocationDefaults, Producer, ProducerBase, ProducerOptions, SendOptions } from "./api.cjs";
2
+ import { connect } from "./client.cjs";
3
+ import { IntegrationClientError, IntegrationClientErrorKind } from "./errors.cjs";
4
+ export { type ExactlyOnceInvocation, type ExactlyOnceProducer, type IntegrationClient, IntegrationClientError, type IntegrationClientErrorKind, type IntegrationClientOptions, type Invocation, type InvocationDefaults, type Producer, type ProducerBase, type ProducerOptions, type SendOptions, connect };
@@ -0,0 +1,4 @@
1
+ import { ExactlyOnceInvocation, ExactlyOnceProducer, IntegrationClient, IntegrationClientOptions, Invocation, InvocationDefaults, Producer, ProducerBase, ProducerOptions, SendOptions } from "./api.js";
2
+ import { connect } from "./client.js";
3
+ import { IntegrationClientError, IntegrationClientErrorKind } from "./errors.js";
4
+ export { type ExactlyOnceInvocation, type ExactlyOnceProducer, type IntegrationClient, IntegrationClientError, type IntegrationClientErrorKind, type IntegrationClientOptions, type Invocation, type InvocationDefaults, type Producer, type ProducerBase, type ProducerOptions, type SendOptions, connect };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { IntegrationClientError } from "./errors.js";
2
+ import { connect } from "./client.js";
3
+
4
+ export { IntegrationClientError, connect };
@@ -0,0 +1,11 @@
1
+
2
+ //#region package.json
3
+ var version = "1.18.0";
4
+
5
+ //#endregion
6
+ Object.defineProperty(exports, 'version', {
7
+ enumerable: true,
8
+ get: function () {
9
+ return version;
10
+ }
11
+ });
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "1.18.0";
3
+
4
+ //#endregion
5
+ export { version };
6
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@restatedev/restate-sdk-integration-client\",\n \"version\": \"1.18.0\",\n \"description\": \"Client for the Restate ingress integration (ingestion) API\",\n \"author\": \"Restate Developers\",\n \"email\": \"code@restate.dev\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/restatedev/sdk-typescript#readme\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/restatedev/sdk-typescript.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/restatedev/sdk-typescript/issues\"\n },\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.cts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\",\n \"README.md\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"test\": \"turbo run _test --filter={.}...\",\n \"_test\": \"vitest run\",\n \"test:e2e\": \"vitest run --config vitest.e2e.config.ts\",\n \"generate:proto\": \"buf generate\",\n \"build\": \"turbo run _build --filter={.}...\",\n \"_build\": \"tsc --noEmit && tsdown\",\n \"dev\": \"tsc --noEmit --watch\",\n \"clean\": \"rm -rf dist *.tsbuildinfo .turbo\",\n \"check:types\": \"turbo run _check:types --filter={.}...\",\n \"_check:types\": \"tsc --noEmit --project tsconfig.build.json\",\n \"lint\": \"eslint .\",\n \"check:exports\": \"turbo run _check:exports --filter={.}...\",\n \"_check:exports\": \"attw --pack .\",\n \"check:api\": \"turbo run _check:api --filter={.}...\",\n \"_check:api\": \"api-extractor run --local\"\n },\n \"dependencies\": {\n \"@bufbuild/protobuf\": \"^2.16.0\",\n \"@connectrpc/connect\": \"^2.2.0\",\n \"@connectrpc/connect-node\": \"^2.2.0\"\n },\n \"devDependencies\": {\n \"@bufbuild/buf\": \"1.75.0\",\n \"@bufbuild/protoc-gen-es\": \"^2.16.0\",\n \"@restatedev/restate-sdk\": \"workspace:*\",\n \"@restatedev/restate-sdk-clients\": \"workspace:*\",\n \"@restatedev/restate-sdk-testcontainers\": \"workspace:*\",\n \"testcontainers\": \"^11.13.0\"\n }\n}\n"],"mappings":";cAEa"}
@@ -0,0 +1,245 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_ingestion_svc_pb = require('./generated/dev/restate/ingress/ingestion/v1/ingestion_svc_pb.cjs');
3
+ const require_errors = require('./errors.cjs');
4
+ const require_proto = require('./proto.cjs');
5
+ const require_queue = require('./queue.cjs');
6
+ let __bufbuild_protobuf = require("@bufbuild/protobuf");
7
+ __bufbuild_protobuf = require_rolldown_runtime.__toESM(__bufbuild_protobuf);
8
+
9
+ //#region src/producer.ts
10
+ const INITIAL_WINDOW_BYTES = 32 * 1024;
11
+ const DEFAULT_BUFFER_BYTES = 32 * 1024 * 1024;
12
+ /**
13
+ * Owns one ingestion stream.
14
+ *
15
+ * A record goes from `send` to the admission queue, where it waits in FIFO order while the
16
+ * buffer is full, then to the buffer, then to the request generator that Connect consumes. Connect
17
+ * pulls the next request only once HTTP/2 has accepted the previous one, and the buffer hands a
18
+ * record to the generator only while the Restate window has credit, so both transport and Restate
19
+ * backpressure propagate back to `send`.
20
+ */
21
+ var ProducerImpl = class {
22
+ #producerId;
23
+ #exactlyOnce;
24
+ #bufferBytes;
25
+ #onCommitted;
26
+ #call = new AbortController();
27
+ #responsesDone;
28
+ #admission = new require_queue.Queue();
29
+ #buffer = new require_queue.Queue();
30
+ #bufferedBytes = 0;
31
+ #commitWaiters = new require_queue.Queue();
32
+ #budget = INITIAL_WINDOW_BYTES;
33
+ #lastSent = -1;
34
+ #lastCommitted = -1;
35
+ #pull;
36
+ #requestsEnded = false;
37
+ #closing;
38
+ #failed = false;
39
+ #failure;
40
+ #writable;
41
+ #writableController;
42
+ constructor(config) {
43
+ const bufferBytes = config.options.bufferBytes ?? DEFAULT_BUFFER_BYTES;
44
+ if (!Number.isSafeInteger(bufferBytes) || bufferBytes < 0) throw new RangeError(`bufferBytes must be a non-negative integer, got ${bufferBytes}`);
45
+ this.#producerId = config.producerId;
46
+ this.#exactlyOnce = config.exactlyOnce;
47
+ this.#bufferBytes = bufferBytes;
48
+ this.#onCommitted = config.options.onCommitted;
49
+ const start = (0, __bufbuild_protobuf.create)(require_ingestion_svc_pb.IngestionRequestSchema, { kind: {
50
+ case: "start",
51
+ value: {
52
+ producerId: config.producerId,
53
+ integration: config.integration,
54
+ deduplicationMode: config.exactlyOnce ? require_ingestion_svc_pb.DeduplicationMode.OFFSET_BASED : require_ingestion_svc_pb.DeduplicationMode.DISABLED,
55
+ defaults: config.options.defaults !== void 0 ? require_proto.toProtoDefaults(config.options.defaults) : void 0
56
+ }
57
+ } });
58
+ const responses = config.rpc.ingest(this.#requests(start), {
59
+ signal: this.#call.signal,
60
+ headers: config.headers
61
+ });
62
+ this.#responsesDone = this.#readResponses(responses);
63
+ }
64
+ get producerId() {
65
+ return this.#producerId;
66
+ }
67
+ send(record, opts) {
68
+ if (this.#failed) return Promise.reject(this.#failure);
69
+ if (this.#closing !== void 0) return Promise.reject(/* @__PURE__ */ new Error("The producer is closed"));
70
+ let offset;
71
+ if (this.#exactlyOnce) {
72
+ offset = record.offset;
73
+ if (!Number.isSafeInteger(offset) || offset < 0) return Promise.reject(/* @__PURE__ */ new RangeError(`offset must be a non-negative safe integer, got ${offset}`));
74
+ if (offset <= this.#lastSent) return Promise.reject(/* @__PURE__ */ new RangeError(`offset must be strictly increasing: last sent ${this.#lastSent}, got ${offset}`));
75
+ } else {
76
+ offset = this.#lastSent + 1;
77
+ if (!Number.isSafeInteger(offset)) return Promise.reject(/* @__PURE__ */ new RangeError("The producer offset sequence is exhausted"));
78
+ }
79
+ let pending;
80
+ try {
81
+ const invocation = require_proto.toProtoInvocation(record, offset);
82
+ pending = {
83
+ offset,
84
+ size: (0, __bufbuild_protobuf.toBinary)(require_ingestion_svc_pb.IngestionInvocationSchema, invocation).byteLength,
85
+ request: (0, __bufbuild_protobuf.create)(require_ingestion_svc_pb.IngestionRequestSchema, { kind: {
86
+ case: "invocation",
87
+ value: invocation
88
+ } })
89
+ };
90
+ } catch (e) {
91
+ return Promise.reject(e);
92
+ }
93
+ if (this.#bufferBytes > 0 && pending.size > this.#bufferBytes) return Promise.reject(/* @__PURE__ */ new RangeError(`The serialized record takes ${pending.size} bytes, more than bufferBytes (${this.#bufferBytes})`));
94
+ this.#lastSent = offset;
95
+ const accepted = new Promise((resolve, reject) => {
96
+ this.#admission.push({
97
+ record: pending,
98
+ resolve,
99
+ reject
100
+ });
101
+ });
102
+ this.#drive();
103
+ if (opts?.waitCommitted !== true) return accepted;
104
+ return Promise.all([accepted, this.#committed(offset)]).then(() => offset);
105
+ }
106
+ flush() {
107
+ return this.#committed(this.#lastSent);
108
+ }
109
+ close() {
110
+ this.#closing ??= this.#close();
111
+ return this.#closing;
112
+ }
113
+ abort(reason) {
114
+ this.#fail(reason ?? new require_errors.IntegrationClientError("unknown", "The producer was aborted"));
115
+ }
116
+ get writable() {
117
+ this.#writable ??= new WritableStream({
118
+ start: (controller) => {
119
+ this.#writableController = controller;
120
+ if (this.#failed) controller.error(this.#failure);
121
+ },
122
+ write: async (record) => {
123
+ await this.send(record);
124
+ },
125
+ close: () => this.close(),
126
+ abort: (reason) => this.abort(reason)
127
+ });
128
+ return this.#writable;
129
+ }
130
+ async #close() {
131
+ if (this.#failed) throw this.#failure;
132
+ await this.flush();
133
+ this.#requestsEnded = true;
134
+ this.#drive();
135
+ await this.#responsesDone;
136
+ if (this.#failed) throw this.#failure;
137
+ }
138
+ async *#requests(start) {
139
+ yield start;
140
+ for (;;) {
141
+ const request = await new Promise((resolve) => {
142
+ this.#pull = resolve;
143
+ this.#drive();
144
+ });
145
+ if (request === void 0) return;
146
+ yield request;
147
+ }
148
+ }
149
+ /** Moves records along: hands the buffer head to the waiting generator, admits waiting sends. */
150
+ #drive() {
151
+ for (;;) {
152
+ if (this.#pull !== void 0) {
153
+ if (this.#failed || this.#requestsEnded && this.#buffer.length === 0) {
154
+ this.#takePull()(void 0);
155
+ return;
156
+ }
157
+ if (this.#budget > 0) {
158
+ const record = this.#buffer.shift();
159
+ if (record !== void 0) {
160
+ this.#bufferedBytes -= record.size;
161
+ this.#budget -= record.size;
162
+ this.#takePull()(record.request);
163
+ continue;
164
+ }
165
+ }
166
+ }
167
+ const waiter = this.#admission.peek();
168
+ if (waiter === void 0 || !this.#canAdmit(waiter.record.size)) return;
169
+ this.#admission.shift();
170
+ this.#buffer.push(waiter.record);
171
+ this.#bufferedBytes += waiter.record.size;
172
+ waiter.resolve(waiter.record.offset);
173
+ }
174
+ }
175
+ #canAdmit(size) {
176
+ if (this.#failed) return false;
177
+ if (this.#bufferBytes === 0) return this.#pull !== void 0 && this.#budget > 0 && this.#buffer.length === 0;
178
+ return this.#bufferedBytes + size <= this.#bufferBytes;
179
+ }
180
+ #takePull() {
181
+ const pull = this.#pull;
182
+ this.#pull = void 0;
183
+ return pull;
184
+ }
185
+ #committed(offset) {
186
+ if (offset <= this.#lastCommitted) return Promise.resolve(this.#lastCommitted);
187
+ if (this.#failed) return Promise.reject(this.#failure);
188
+ return new Promise((resolve, reject) => {
189
+ this.#commitWaiters.push({
190
+ offset,
191
+ resolve,
192
+ reject
193
+ });
194
+ });
195
+ }
196
+ async #readResponses(responses) {
197
+ try {
198
+ for await (const response of responses) {
199
+ if (response.lastCommitted !== void 0) this.#advanceCommitted(require_errors.toSafeNumber(response.lastCommitted));
200
+ if (this.#failed) return;
201
+ if (response.response.case === "windowUpdate") {
202
+ this.#budget += response.response.value.incrementBytes;
203
+ this.#drive();
204
+ } else if (response.response.case === "error") {
205
+ this.#fail(require_errors.errorFromProto(response.response.value));
206
+ return;
207
+ }
208
+ }
209
+ if (!this.#requestsEnded) this.#fail(new require_errors.IntegrationClientError("unknown", "The ingestion stream was closed by the server"));
210
+ } catch (e) {
211
+ this.#fail(new require_errors.IntegrationClientError("unknown", `The ingestion stream failed: ${e instanceof Error ? e.message : String(e)}`, { cause: e }));
212
+ }
213
+ }
214
+ #advanceCommitted(watermark) {
215
+ if (watermark <= this.#lastCommitted) return;
216
+ this.#lastCommitted = watermark;
217
+ for (let waiter = this.#commitWaiters.peek(); waiter !== void 0 && waiter.offset <= watermark; waiter = this.#commitWaiters.peek()) {
218
+ this.#commitWaiters.shift();
219
+ waiter.resolve(watermark);
220
+ }
221
+ if (this.#onCommitted !== void 0) try {
222
+ this.#onCommitted(watermark);
223
+ } catch (e) {
224
+ this.#fail(e);
225
+ }
226
+ }
227
+ /** Makes the producer terminally failed: cancels the stream and rejects everything pending. */
228
+ #fail(reason) {
229
+ if (this.#failed) return;
230
+ this.#failed = true;
231
+ this.#failure = reason;
232
+ this.#buffer.drain();
233
+ this.#bufferedBytes = 0;
234
+ const admission = this.#admission.drain();
235
+ const commits = this.#commitWaiters.drain();
236
+ if (this.#pull !== void 0) this.#takePull()(void 0);
237
+ this.#call.abort(reason);
238
+ this.#writableController?.error(reason);
239
+ for (const waiter of admission) waiter.reject(reason);
240
+ for (const waiter of commits) waiter.reject(reason);
241
+ }
242
+ };
243
+
244
+ //#endregion
245
+ exports.ProducerImpl = ProducerImpl;