@s2-dev/streamstore 0.16.12 → 0.17.1
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/cjs/basin.d.ts +6 -2
- package/dist/cjs/basin.d.ts.map +1 -1
- package/dist/cjs/basin.js +11 -5
- package/dist/cjs/basin.js.map +1 -1
- package/dist/cjs/batch-transform.d.ts +64 -0
- package/dist/cjs/batch-transform.d.ts.map +1 -0
- package/dist/cjs/batch-transform.js +144 -0
- package/dist/cjs/batch-transform.js.map +1 -0
- package/dist/cjs/generated/proto/s2.d.ts.map +1 -0
- package/dist/cjs/generated/proto/s2.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/stream/factory.d.ts +15 -0
- package/dist/cjs/lib/stream/factory.d.ts.map +1 -0
- package/dist/cjs/lib/stream/factory.js +36 -0
- package/dist/cjs/lib/stream/factory.js.map +1 -0
- package/dist/cjs/lib/stream/runtime.d.ts +13 -0
- package/dist/cjs/lib/stream/runtime.d.ts.map +1 -0
- package/dist/cjs/lib/stream/runtime.js +50 -0
- package/dist/cjs/lib/stream/runtime.js.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/index.d.ts +79 -0
- package/dist/cjs/lib/stream/transport/fetch/index.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/index.js +382 -0
- package/dist/cjs/lib/stream/transport/fetch/index.js.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.d.ts +7 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.js +170 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.js.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.d.ts +47 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.js +123 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.js.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/index.d.ts +23 -0
- package/dist/cjs/lib/stream/transport/s2s/index.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/index.js +789 -0
- package/dist/cjs/lib/stream/transport/s2s/index.js.map +1 -0
- package/dist/cjs/lib/stream/types.d.ts +53 -0
- package/dist/cjs/lib/stream/types.d.ts.map +1 -0
- package/dist/cjs/lib/stream/types.js +3 -0
- package/dist/cjs/lib/stream/types.js.map +1 -0
- package/dist/cjs/stream.d.ts +22 -116
- package/dist/cjs/stream.d.ts.map +1 -1
- package/dist/cjs/stream.js +35 -551
- package/dist/cjs/stream.js.map +1 -1
- package/dist/cjs/utils.d.ts +32 -6
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +129 -34
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/basin.d.ts +6 -2
- package/dist/esm/basin.d.ts.map +1 -1
- package/dist/esm/basin.js +11 -5
- package/dist/esm/basin.js.map +1 -1
- package/dist/esm/batch-transform.d.ts +64 -0
- package/dist/esm/batch-transform.d.ts.map +1 -0
- package/dist/esm/batch-transform.js +140 -0
- package/dist/esm/batch-transform.js.map +1 -0
- package/dist/esm/generated/proto/s2.d.ts.map +1 -0
- package/dist/esm/generated/proto/s2.js.map +1 -0
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/stream/factory.d.ts +15 -0
- package/dist/esm/lib/stream/factory.d.ts.map +1 -0
- package/dist/esm/lib/stream/factory.js +33 -0
- package/dist/esm/lib/stream/factory.js.map +1 -0
- package/dist/esm/lib/stream/runtime.d.ts +13 -0
- package/dist/esm/lib/stream/runtime.d.ts.map +1 -0
- package/dist/esm/lib/stream/runtime.js +46 -0
- package/dist/esm/lib/stream/runtime.js.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/index.d.ts +79 -0
- package/dist/esm/lib/stream/transport/fetch/index.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/index.js +376 -0
- package/dist/esm/lib/stream/transport/fetch/index.js.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/shared.d.ts +7 -0
- package/dist/esm/lib/stream/transport/fetch/shared.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/shared.js +166 -0
- package/dist/esm/lib/stream/transport/fetch/shared.js.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/framing.d.ts +47 -0
- package/dist/esm/lib/stream/transport/s2s/framing.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/framing.js +118 -0
- package/dist/esm/lib/stream/transport/s2s/framing.js.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/index.d.ts +23 -0
- package/dist/esm/lib/stream/transport/s2s/index.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/index.js +785 -0
- package/dist/esm/lib/stream/transport/s2s/index.js.map +1 -0
- package/dist/esm/lib/stream/types.d.ts +53 -0
- package/dist/esm/lib/stream/types.d.ts.map +1 -0
- package/dist/esm/lib/stream/types.js +2 -0
- package/dist/esm/lib/stream/types.js.map +1 -0
- package/dist/esm/stream.d.ts +22 -116
- package/dist/esm/stream.d.ts.map +1 -1
- package/dist/esm/stream.js +36 -551
- package/dist/esm/stream.js.map +1 -1
- package/dist/esm/utils.d.ts +32 -6
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +126 -34
- package/dist/esm/utils.js.map +1 -1
- package/package.json +5 -2
- package/dist/cjs/generated/proto/s2/v1/s2.d.ts.map +0 -1
- package/dist/cjs/generated/proto/s2/v1/s2.js.map +0 -1
- package/dist/esm/generated/proto/s2/v1/s2.d.ts.map +0 -1
- package/dist/esm/generated/proto/s2/v1/s2.js.map +0 -1
- /package/dist/cjs/generated/proto/{s2/v1/s2.d.ts → s2.d.ts} +0 -0
- /package/dist/cjs/generated/proto/{s2/v1/s2.js → s2.js} +0 -0
- /package/dist/esm/generated/proto/{s2/v1/s2.d.ts → s2.d.ts} +0 -0
- /package/dist/esm/generated/proto/{s2/v1/s2.js → s2.js} +0 -0
package/dist/cjs/stream.js
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.S2Stream = void 0;
|
|
4
4
|
const error_js_1 = require("./error.js");
|
|
5
5
|
const index_js_1 = require("./generated/index.js");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const factory_js_1 = require("./lib/stream/factory.js");
|
|
7
|
+
const shared_js_1 = require("./lib/stream/transport/fetch/shared.js");
|
|
8
8
|
class S2Stream {
|
|
9
9
|
client;
|
|
10
|
+
transportConfig;
|
|
11
|
+
_transport;
|
|
10
12
|
name;
|
|
11
|
-
constructor(name, client) {
|
|
13
|
+
constructor(name, client, transportConfig) {
|
|
12
14
|
this.name = name;
|
|
13
15
|
this.client = client;
|
|
16
|
+
this.transportConfig = transportConfig;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get or create the transport instance
|
|
20
|
+
*/
|
|
21
|
+
async getTransport() {
|
|
22
|
+
if (!this._transport) {
|
|
23
|
+
this._transport = await (0, factory_js_1.createSessionTransport)(this.transportConfig);
|
|
24
|
+
}
|
|
25
|
+
return this._transport;
|
|
14
26
|
}
|
|
15
27
|
/**
|
|
16
28
|
* Check the tail of the stream.
|
|
@@ -43,138 +55,24 @@ class S2Stream {
|
|
|
43
55
|
* - Use `readSession` for streaming reads
|
|
44
56
|
*/
|
|
45
57
|
async read(args, options) {
|
|
46
|
-
|
|
47
|
-
const response = await (0, index_js_1.read)({
|
|
48
|
-
client: this.client,
|
|
49
|
-
path: {
|
|
50
|
-
stream: this.name,
|
|
51
|
-
},
|
|
52
|
-
headers: {
|
|
53
|
-
...(as === "bytes" ? { "s2-format": "base64" } : {}),
|
|
54
|
-
},
|
|
55
|
-
query: queryParams,
|
|
56
|
-
...options,
|
|
57
|
-
});
|
|
58
|
-
if (response.error) {
|
|
59
|
-
if ("message" in response.error) {
|
|
60
|
-
throw new error_js_1.S2Error({
|
|
61
|
-
message: response.error.message,
|
|
62
|
-
code: response.error.code ?? undefined,
|
|
63
|
-
status: response.response.status,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
// special case for 416 - Range Not Satisfiable
|
|
68
|
-
throw new error_js_1.RangeNotSatisfiableError({
|
|
69
|
-
status: response.response.status,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (args?.as === "bytes") {
|
|
74
|
-
const res = {
|
|
75
|
-
...response.data,
|
|
76
|
-
records: response.data.records?.map((record) => ({
|
|
77
|
-
...record,
|
|
78
|
-
body: record.body ? (0, base64_js_1.decodeFromBase64)(record.body) : undefined,
|
|
79
|
-
headers: record.headers?.map((header) => header.map((h) => (0, base64_js_1.decodeFromBase64)(h))),
|
|
80
|
-
})),
|
|
81
|
-
};
|
|
82
|
-
return res;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
const res = response.data;
|
|
86
|
-
return res;
|
|
87
|
-
}
|
|
58
|
+
return await (0, shared_js_1.streamRead)(this.name, this.client, args, options);
|
|
88
59
|
}
|
|
89
60
|
/**
|
|
90
61
|
* Append one or more records to the stream.
|
|
91
62
|
*
|
|
92
|
-
* - Automatically base64-encodes when
|
|
63
|
+
* - Automatically base64-encodes when format is "bytes".
|
|
93
64
|
* - Supports conditional appends via `fencing_token` and `match_seq_num`.
|
|
94
65
|
* - Returns the acknowledged range and the stream tail after the append.
|
|
66
|
+
*
|
|
67
|
+
* All records in a single append call must use the same format (either all string or all bytes).
|
|
68
|
+
* For high-throughput sequential appends, use `appendSession()` instead.
|
|
69
|
+
*
|
|
70
|
+
* @param records The record(s) to append
|
|
71
|
+
* @param args Optional append arguments (fencing_token, match_seq_num)
|
|
72
|
+
* @param options Optional request options
|
|
95
73
|
*/
|
|
96
74
|
async append(records, args, options) {
|
|
97
|
-
|
|
98
|
-
const normalizeHeaders = (headers) => {
|
|
99
|
-
if (headers === undefined) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
else if (Array.isArray(headers)) {
|
|
103
|
-
return headers;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
return Object.entries(headers).map(([key, value]) => [key, value]);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const recordsWithNormalizedHeaders = recordsArray.map((record) => ({
|
|
110
|
-
...record,
|
|
111
|
-
headers: normalizeHeaders(record.headers),
|
|
112
|
-
}));
|
|
113
|
-
const hasBytes = recordsWithNormalizedHeaders.some((record) => record.body instanceof Uint8Array) ||
|
|
114
|
-
recordsWithNormalizedHeaders.some((record) => record.headers?.some((header) => header[0] instanceof Uint8Array || header[1] instanceof Uint8Array));
|
|
115
|
-
const encodedRecords = recordsWithNormalizedHeaders.map((record) => ({
|
|
116
|
-
...record,
|
|
117
|
-
body: record.body instanceof Uint8Array
|
|
118
|
-
? (0, base64_js_1.encodeToBase64)(record.body)
|
|
119
|
-
: hasBytes && record.body
|
|
120
|
-
? (0, base64_js_1.encodeToBase64)(new TextEncoder().encode(record.body))
|
|
121
|
-
: record.body,
|
|
122
|
-
headers: record.headers?.map((header) => header.map((h) => h instanceof Uint8Array
|
|
123
|
-
? (0, base64_js_1.encodeToBase64)(h)
|
|
124
|
-
: hasBytes
|
|
125
|
-
? (0, base64_js_1.encodeToBase64)(new TextEncoder().encode(h))
|
|
126
|
-
: h)),
|
|
127
|
-
}));
|
|
128
|
-
const response = await (0, index_js_1.append)({
|
|
129
|
-
client: this.client,
|
|
130
|
-
path: {
|
|
131
|
-
stream: this.name,
|
|
132
|
-
},
|
|
133
|
-
body: {
|
|
134
|
-
...args,
|
|
135
|
-
records: encodedRecords,
|
|
136
|
-
},
|
|
137
|
-
headers: {
|
|
138
|
-
...(hasBytes ? { "s2-format": "base64" } : {}),
|
|
139
|
-
},
|
|
140
|
-
...options,
|
|
141
|
-
});
|
|
142
|
-
if (response.error) {
|
|
143
|
-
if ("message" in response.error) {
|
|
144
|
-
throw new error_js_1.S2Error({
|
|
145
|
-
message: response.error.message,
|
|
146
|
-
code: response.error.code ?? undefined,
|
|
147
|
-
status: response.response.status,
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
// special case for 412 - append condition failed
|
|
152
|
-
if ("seq_num_mismatch" in response.error) {
|
|
153
|
-
throw new error_js_1.SeqNumMismatchError({
|
|
154
|
-
message: "Append condition failed: sequence number mismatch",
|
|
155
|
-
code: "APPEND_CONDITION_FAILED",
|
|
156
|
-
status: response.response.status,
|
|
157
|
-
expectedSeqNum: response.error.seq_num_mismatch,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
else if ("fencing_token_mismatch" in response.error) {
|
|
161
|
-
throw new error_js_1.FencingTokenMismatchError({
|
|
162
|
-
message: "Append condition failed: fencing token mismatch",
|
|
163
|
-
code: "APPEND_CONDITION_FAILED",
|
|
164
|
-
status: response.response.status,
|
|
165
|
-
expectedFencingToken: response.error.fencing_token_mismatch,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// fallback for unknown 412 error format
|
|
170
|
-
throw new error_js_1.S2Error({
|
|
171
|
-
message: "Append condition failed",
|
|
172
|
-
status: response.response.status,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return response.data;
|
|
75
|
+
return await (0, shared_js_1.streamAppend)(this.name, this.client, records, args, options);
|
|
178
76
|
}
|
|
179
77
|
/**
|
|
180
78
|
* Open a streaming read session
|
|
@@ -183,435 +81,21 @@ class S2Stream {
|
|
|
183
81
|
* When `as: "bytes"` is provided, bodies and headers are decoded to `Uint8Array`.
|
|
184
82
|
*/
|
|
185
83
|
async readSession(args, options) {
|
|
186
|
-
|
|
84
|
+
const transport = await this.getTransport();
|
|
85
|
+
return await transport.makeReadSession(this.name, args, options);
|
|
187
86
|
}
|
|
188
87
|
/**
|
|
189
|
-
* Create an append session that
|
|
88
|
+
* Create an append session that guarantees ordering of submissions.
|
|
190
89
|
*
|
|
191
90
|
* Use this to coordinate high-throughput, sequential appends with backpressure.
|
|
91
|
+
* Records can be either string or bytes format - the format is specified in each record.
|
|
92
|
+
*
|
|
93
|
+
* @param options Optional request options
|
|
192
94
|
*/
|
|
193
|
-
async appendSession(
|
|
194
|
-
|
|
95
|
+
async appendSession(sessionOptions, requestOptions) {
|
|
96
|
+
const transport = await this.getTransport();
|
|
97
|
+
return await transport.makeAppendSession(this.name, sessionOptions, requestOptions);
|
|
195
98
|
}
|
|
196
99
|
}
|
|
197
100
|
exports.S2Stream = S2Stream;
|
|
198
|
-
class ReadSession extends event_stream_js_1.EventStream {
|
|
199
|
-
static async create(client, name, args, options) {
|
|
200
|
-
const { as, ...queryParams } = args ?? {};
|
|
201
|
-
const response = await (0, index_js_1.read)({
|
|
202
|
-
client,
|
|
203
|
-
path: {
|
|
204
|
-
stream: name,
|
|
205
|
-
},
|
|
206
|
-
headers: {
|
|
207
|
-
accept: "text/event-stream",
|
|
208
|
-
...(as === "bytes" ? { "s2-format": "base64" } : {}),
|
|
209
|
-
},
|
|
210
|
-
query: queryParams,
|
|
211
|
-
parseAs: "stream",
|
|
212
|
-
...options,
|
|
213
|
-
});
|
|
214
|
-
if (response.error) {
|
|
215
|
-
if ("message" in response.error) {
|
|
216
|
-
throw new error_js_1.S2Error({
|
|
217
|
-
message: response.error.message,
|
|
218
|
-
code: response.error.code ?? undefined,
|
|
219
|
-
status: response.response.status,
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
// special case for 416 - Range Not Satisfiable
|
|
224
|
-
throw new error_js_1.RangeNotSatisfiableError({
|
|
225
|
-
status: response.response.status,
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (!response.response.body) {
|
|
230
|
-
throw new error_js_1.S2Error({
|
|
231
|
-
message: "No body in SSE response",
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
return new ReadSession(response.response.body, args?.as ?? "string");
|
|
235
|
-
}
|
|
236
|
-
_streamPosition = undefined;
|
|
237
|
-
constructor(stream, format) {
|
|
238
|
-
super(stream, (msg) => {
|
|
239
|
-
// Parse SSE events according to the S2 protocol
|
|
240
|
-
if (msg.event === "batch" && msg.data) {
|
|
241
|
-
const batch = JSON.parse(msg.data);
|
|
242
|
-
// If format is bytes, decode base64 to Uint8Array
|
|
243
|
-
if (format === "bytes") {
|
|
244
|
-
for (const record of batch.records ?? []) {
|
|
245
|
-
if (record.body && typeof record.body === "string") {
|
|
246
|
-
record.body = (0, base64_js_1.decodeFromBase64)(record.body);
|
|
247
|
-
}
|
|
248
|
-
if (record.headers) {
|
|
249
|
-
record.headers = record.headers.map((header) => header.map((h) => typeof h === "string" ? (0, base64_js_1.decodeFromBase64)(h) : h));
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
if (batch.tail) {
|
|
254
|
-
this._streamPosition = batch.tail;
|
|
255
|
-
}
|
|
256
|
-
return { done: false, batch: true, value: batch.records ?? [] };
|
|
257
|
-
}
|
|
258
|
-
if (msg.event === "error") {
|
|
259
|
-
// Handle error events
|
|
260
|
-
throw new error_js_1.S2Error({ message: msg.data ?? "Unknown error" });
|
|
261
|
-
}
|
|
262
|
-
// Skip ping events and other events
|
|
263
|
-
return { done: false };
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
get streamPosition() {
|
|
267
|
-
return this._streamPosition;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
exports.ReadSession = ReadSession;
|
|
271
|
-
class AcksStream extends ReadableStream {
|
|
272
|
-
constructor(setController) {
|
|
273
|
-
super({
|
|
274
|
-
start: (controller) => {
|
|
275
|
-
setController(controller);
|
|
276
|
-
},
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
async [Symbol.asyncDispose]() {
|
|
280
|
-
await this.cancel("disposed");
|
|
281
|
-
}
|
|
282
|
-
// Polyfill for older browsers
|
|
283
|
-
[Symbol.asyncIterator]() {
|
|
284
|
-
const fn = ReadableStream.prototype[Symbol.asyncIterator];
|
|
285
|
-
if (typeof fn === "function")
|
|
286
|
-
return fn.call(this);
|
|
287
|
-
const reader = this.getReader();
|
|
288
|
-
return {
|
|
289
|
-
next: async () => {
|
|
290
|
-
const r = await reader.read();
|
|
291
|
-
if (r.done) {
|
|
292
|
-
reader.releaseLock();
|
|
293
|
-
return { done: true, value: undefined };
|
|
294
|
-
}
|
|
295
|
-
return { done: false, value: r.value };
|
|
296
|
-
},
|
|
297
|
-
throw: async (e) => {
|
|
298
|
-
await reader.cancel(e);
|
|
299
|
-
reader.releaseLock();
|
|
300
|
-
return { done: true, value: undefined };
|
|
301
|
-
},
|
|
302
|
-
return: async () => {
|
|
303
|
-
await reader.cancel("done");
|
|
304
|
-
reader.releaseLock();
|
|
305
|
-
return { done: true, value: undefined };
|
|
306
|
-
},
|
|
307
|
-
[Symbol.asyncIterator]() {
|
|
308
|
-
return this;
|
|
309
|
-
},
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Batches individual records and submits them to an AppendSession.
|
|
315
|
-
* Handles linger duration, batch size limits, and auto-incrementing match_seq_num.
|
|
316
|
-
*/
|
|
317
|
-
class Batcher extends WritableStream {
|
|
318
|
-
session;
|
|
319
|
-
currentBatch = [];
|
|
320
|
-
currentBatchResolvers = [];
|
|
321
|
-
lingerTimer = null;
|
|
322
|
-
closed = false;
|
|
323
|
-
maxBatchSize;
|
|
324
|
-
lingerDuration;
|
|
325
|
-
fencing_token;
|
|
326
|
-
next_match_seq_num;
|
|
327
|
-
constructor(session, args) {
|
|
328
|
-
let writableController;
|
|
329
|
-
super({
|
|
330
|
-
start: (controller) => {
|
|
331
|
-
writableController = controller;
|
|
332
|
-
},
|
|
333
|
-
write: (chunk) => {
|
|
334
|
-
const records = Array.isArray(chunk) ? chunk : [chunk];
|
|
335
|
-
this.submit(records);
|
|
336
|
-
},
|
|
337
|
-
close: () => {
|
|
338
|
-
this.closed = true;
|
|
339
|
-
this.flush();
|
|
340
|
-
this.cleanup();
|
|
341
|
-
},
|
|
342
|
-
abort: (reason) => {
|
|
343
|
-
this.closed = true;
|
|
344
|
-
// Reject all pending promises in the current batch
|
|
345
|
-
const error = new error_js_1.S2Error({
|
|
346
|
-
message: `Batcher was aborted: ${reason}`,
|
|
347
|
-
});
|
|
348
|
-
for (const resolver of this.currentBatchResolvers) {
|
|
349
|
-
resolver.reject(error);
|
|
350
|
-
}
|
|
351
|
-
this.currentBatch = [];
|
|
352
|
-
this.currentBatchResolvers = [];
|
|
353
|
-
this.cleanup();
|
|
354
|
-
},
|
|
355
|
-
});
|
|
356
|
-
this.session = session;
|
|
357
|
-
this.maxBatchSize = args?.maxBatchSize ?? 1000;
|
|
358
|
-
this.lingerDuration = args?.lingerDuration ?? 5;
|
|
359
|
-
this.fencing_token = args?.fencing_token;
|
|
360
|
-
this.next_match_seq_num = args?.match_seq_num;
|
|
361
|
-
}
|
|
362
|
-
async [Symbol.asyncDispose]() {
|
|
363
|
-
await this.close();
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Submit one or more records to be batched.
|
|
367
|
-
* For array submits, the entire array is treated as an atomic unit and will never be split across batches.
|
|
368
|
-
* If it doesn't fit in the current batch, the current batch is flushed and the array is queued in the next batch.
|
|
369
|
-
* Returns a promise that resolves when the batch containing these records is acknowledged.
|
|
370
|
-
*/
|
|
371
|
-
submit(records) {
|
|
372
|
-
if (this.closed) {
|
|
373
|
-
return Promise.reject(new error_js_1.S2Error({ message: "Batcher is closed" }));
|
|
374
|
-
}
|
|
375
|
-
return new Promise((resolve, reject) => {
|
|
376
|
-
const recordsArray = Array.isArray(records) ? records : [records];
|
|
377
|
-
const isArraySubmit = Array.isArray(records) && records.length > 1;
|
|
378
|
-
// Start linger timer on first record added to an empty batch
|
|
379
|
-
if (this.currentBatch.length === 0 && this.lingerDuration > 0) {
|
|
380
|
-
this.startLingerTimer();
|
|
381
|
-
}
|
|
382
|
-
if (isArraySubmit) {
|
|
383
|
-
// Treat the entire array as atomic: if it doesn't fit, flush current batch first
|
|
384
|
-
if (this.currentBatch.length > 0 &&
|
|
385
|
-
this.currentBatch.length + recordsArray.length > this.maxBatchSize) {
|
|
386
|
-
this.flush();
|
|
387
|
-
// After flush, if linger is enabled, restart the timer for the new batch
|
|
388
|
-
if (this.lingerDuration > 0) {
|
|
389
|
-
this.startLingerTimer();
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
// Add the entire array (even if it exceeds maxBatchSize) as a single batch unit
|
|
393
|
-
this.currentBatch.push(...recordsArray);
|
|
394
|
-
this.currentBatchResolvers.push({ resolve, reject });
|
|
395
|
-
// Do not auto-flush here; allow linger timer or explicit flush to send the batch
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
// Single record submit — normal behavior
|
|
399
|
-
if (this.currentBatch.length >= this.maxBatchSize) {
|
|
400
|
-
this.flush();
|
|
401
|
-
if (this.lingerDuration > 0) {
|
|
402
|
-
this.startLingerTimer();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
this.currentBatch.push(recordsArray[0]);
|
|
406
|
-
this.currentBatchResolvers.push({ resolve, reject });
|
|
407
|
-
if (this.currentBatch.length >= this.maxBatchSize) {
|
|
408
|
-
this.flush();
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Flush the current batch to the session.
|
|
415
|
-
*/
|
|
416
|
-
flush() {
|
|
417
|
-
this.cancelLingerTimer();
|
|
418
|
-
if (this.currentBatch.length === 0) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const args = {
|
|
422
|
-
records: this.currentBatch,
|
|
423
|
-
fencing_token: this.fencing_token,
|
|
424
|
-
match_seq_num: this.next_match_seq_num,
|
|
425
|
-
};
|
|
426
|
-
// Auto-increment match_seq_num for next batch
|
|
427
|
-
if (this.next_match_seq_num !== undefined) {
|
|
428
|
-
this.next_match_seq_num += this.currentBatch.length;
|
|
429
|
-
}
|
|
430
|
-
// Capture resolvers for this batch
|
|
431
|
-
const batchResolvers = this.currentBatchResolvers;
|
|
432
|
-
this.currentBatchResolvers = [];
|
|
433
|
-
this.currentBatch = [];
|
|
434
|
-
// Submit to session and handle promise
|
|
435
|
-
const promise = this.session.submit(args.records, {
|
|
436
|
-
fencing_token: args.fencing_token,
|
|
437
|
-
match_seq_num: args.match_seq_num,
|
|
438
|
-
});
|
|
439
|
-
// Resolve/reject all resolvers for this batch when the ack comes back
|
|
440
|
-
promise.then((ack) => {
|
|
441
|
-
for (const resolver of batchResolvers) {
|
|
442
|
-
resolver.resolve(ack);
|
|
443
|
-
}
|
|
444
|
-
}, (error) => {
|
|
445
|
-
for (const resolver of batchResolvers) {
|
|
446
|
-
resolver.reject(error);
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
startLingerTimer() {
|
|
451
|
-
this.cancelLingerTimer();
|
|
452
|
-
this.lingerTimer = setTimeout(() => {
|
|
453
|
-
this.lingerTimer = null;
|
|
454
|
-
if (!this.closed && this.currentBatch.length > 0) {
|
|
455
|
-
this.flush();
|
|
456
|
-
}
|
|
457
|
-
}, this.lingerDuration);
|
|
458
|
-
}
|
|
459
|
-
cancelLingerTimer() {
|
|
460
|
-
if (this.lingerTimer) {
|
|
461
|
-
clearTimeout(this.lingerTimer);
|
|
462
|
-
this.lingerTimer = null;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
cleanup() {
|
|
466
|
-
this.cancelLingerTimer();
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Session for appending records to a stream.
|
|
471
|
-
* Queues append requests and ensures only one is in-flight at a time.
|
|
472
|
-
*/
|
|
473
|
-
class AppendSession extends WritableStream {
|
|
474
|
-
_lastSeenPosition = undefined;
|
|
475
|
-
queue = [];
|
|
476
|
-
pendingResolvers = [];
|
|
477
|
-
inFlight = false;
|
|
478
|
-
options;
|
|
479
|
-
stream;
|
|
480
|
-
acksController;
|
|
481
|
-
_acksStream;
|
|
482
|
-
closed = false;
|
|
483
|
-
processingPromise = null;
|
|
484
|
-
static async create(stream, options) {
|
|
485
|
-
return new AppendSession(stream, options);
|
|
486
|
-
}
|
|
487
|
-
constructor(stream, options) {
|
|
488
|
-
let writableController;
|
|
489
|
-
super({
|
|
490
|
-
start: (controller) => {
|
|
491
|
-
writableController = controller;
|
|
492
|
-
},
|
|
493
|
-
write: (chunk) => {
|
|
494
|
-
this.submit(chunk.records, {
|
|
495
|
-
fencing_token: chunk.fencing_token,
|
|
496
|
-
match_seq_num: chunk.match_seq_num,
|
|
497
|
-
});
|
|
498
|
-
},
|
|
499
|
-
close: async () => {
|
|
500
|
-
this.closed = true;
|
|
501
|
-
await this.waitForDrain();
|
|
502
|
-
},
|
|
503
|
-
abort: async (reason) => {
|
|
504
|
-
this.closed = true;
|
|
505
|
-
this.queue = [];
|
|
506
|
-
// Reject all pending promises
|
|
507
|
-
const error = new error_js_1.S2Error({
|
|
508
|
-
message: `AppendSession was aborted: ${reason}`,
|
|
509
|
-
});
|
|
510
|
-
for (const resolver of this.pendingResolvers) {
|
|
511
|
-
resolver.reject(error);
|
|
512
|
-
}
|
|
513
|
-
this.pendingResolvers = [];
|
|
514
|
-
},
|
|
515
|
-
});
|
|
516
|
-
this.options = options;
|
|
517
|
-
this.stream = stream;
|
|
518
|
-
}
|
|
519
|
-
async [Symbol.asyncDispose]() {
|
|
520
|
-
await this.close();
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Create a batcher that batches individual records and submits them to this session.
|
|
524
|
-
*/
|
|
525
|
-
makeBatcher(args) {
|
|
526
|
-
return new Batcher(this, args);
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Get a stream of acknowledgements for appends.
|
|
530
|
-
*/
|
|
531
|
-
acks() {
|
|
532
|
-
if (!this._acksStream) {
|
|
533
|
-
this._acksStream = new AcksStream((controller) => {
|
|
534
|
-
this.acksController = controller;
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
return this._acksStream;
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Submit an append request to the session.
|
|
541
|
-
* The request will be queued and sent when no other request is in-flight.
|
|
542
|
-
* Returns a promise that resolves when the append is acknowledged or rejects on error.
|
|
543
|
-
*/
|
|
544
|
-
submit(records, args) {
|
|
545
|
-
if (this.closed) {
|
|
546
|
-
return Promise.reject(new error_js_1.S2Error({ message: "AppendSession is closed" }));
|
|
547
|
-
}
|
|
548
|
-
return new Promise((resolve, reject) => {
|
|
549
|
-
this.queue.push({
|
|
550
|
-
records: Array.isArray(records) ? records : [records],
|
|
551
|
-
...args,
|
|
552
|
-
});
|
|
553
|
-
this.pendingResolvers.push({ resolve, reject });
|
|
554
|
-
// Start processing if not already running
|
|
555
|
-
if (!this.processingPromise) {
|
|
556
|
-
this.processingPromise = this.processLoop();
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Main processing loop that sends queued requests one at a time.
|
|
562
|
-
*/
|
|
563
|
-
async processLoop() {
|
|
564
|
-
while (this.queue.length > 0) {
|
|
565
|
-
this.inFlight = true;
|
|
566
|
-
const args = this.queue.shift();
|
|
567
|
-
const resolver = this.pendingResolvers.shift();
|
|
568
|
-
try {
|
|
569
|
-
const ack = await this.stream.append(args.records, {
|
|
570
|
-
fencing_token: args.fencing_token,
|
|
571
|
-
match_seq_num: args.match_seq_num,
|
|
572
|
-
}, this.options);
|
|
573
|
-
this._lastSeenPosition = ack;
|
|
574
|
-
// Emit ack to the acks stream if it exists
|
|
575
|
-
if (this.acksController) {
|
|
576
|
-
this.acksController.enqueue(ack);
|
|
577
|
-
}
|
|
578
|
-
// Resolve the promise for this request
|
|
579
|
-
resolver.resolve(ack);
|
|
580
|
-
}
|
|
581
|
-
catch (error) {
|
|
582
|
-
this.inFlight = false;
|
|
583
|
-
this.processingPromise = null;
|
|
584
|
-
// Reject the promise for this request
|
|
585
|
-
resolver.reject(error);
|
|
586
|
-
// Reject all remaining pending promises
|
|
587
|
-
for (const pendingResolver of this.pendingResolvers) {
|
|
588
|
-
pendingResolver.reject(error);
|
|
589
|
-
}
|
|
590
|
-
this.pendingResolvers = [];
|
|
591
|
-
// Clear the queue
|
|
592
|
-
this.queue = [];
|
|
593
|
-
// Do not rethrow here to avoid unhandled rejection; callers already received rejection
|
|
594
|
-
}
|
|
595
|
-
this.inFlight = false;
|
|
596
|
-
}
|
|
597
|
-
this.processingPromise = null;
|
|
598
|
-
}
|
|
599
|
-
async waitForDrain() {
|
|
600
|
-
// Wait for processing to complete
|
|
601
|
-
if (this.processingPromise) {
|
|
602
|
-
await this.processingPromise;
|
|
603
|
-
}
|
|
604
|
-
// Wait until queue is empty and nothing is in flight
|
|
605
|
-
while (this.queue.length > 0 || this.inFlight) {
|
|
606
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
607
|
-
}
|
|
608
|
-
// Close the acks stream if it exists
|
|
609
|
-
if (this.acksController) {
|
|
610
|
-
this.acksController.close();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
get lastSeenPosition() {
|
|
614
|
-
return this._lastSeenPosition;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
101
|
//# sourceMappingURL=stream.js.map
|
package/dist/cjs/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":";;;AACA,yCAKoB;AAEpB,mDAW8B;AAC9B,+CAAmE;AACnE,2DAAoD;AA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