@topgunbuild/core 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +667 -239
- package/dist/index.d.ts +667 -239
- package/dist/index.js +206 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -118
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -12
- package/LICENSE +0 -97
package/dist/index.js
CHANGED
|
@@ -30,8 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AuthAckMessageSchema: () => AuthAckMessageSchema,
|
|
33
34
|
AuthFailMessageSchema: () => AuthFailMessageSchema,
|
|
34
35
|
AuthMessageSchema: () => AuthMessageSchema,
|
|
36
|
+
AuthRequiredMessageSchema: () => AuthRequiredMessageSchema,
|
|
35
37
|
BM25Scorer: () => BM25Scorer,
|
|
36
38
|
BatchMessageSchema: () => BatchMessageSchema,
|
|
37
39
|
BuiltInProcessors: () => BuiltInProcessors,
|
|
@@ -39,6 +41,7 @@ __export(index_exports, {
|
|
|
39
41
|
COST_WEIGHTS: () => COST_WEIGHTS,
|
|
40
42
|
CRDTDebugger: () => CRDTDebugger,
|
|
41
43
|
CRDTInvariants: () => CRDTInvariants,
|
|
44
|
+
ChangeEventTypeSchema: () => ChangeEventTypeSchema,
|
|
42
45
|
ClientOpMessageSchema: () => ClientOpMessageSchema,
|
|
43
46
|
ClientOpSchema: () => ClientOpSchema,
|
|
44
47
|
ClusterSearchReqMessageSchema: () => ClusterSearchReqMessageSchema,
|
|
@@ -89,6 +92,7 @@ __export(index_exports, {
|
|
|
89
92
|
EntryProcessResponseSchema: () => EntryProcessResponseSchema,
|
|
90
93
|
EntryProcessorDefSchema: () => EntryProcessorDefSchema,
|
|
91
94
|
EntryProcessorSchema: () => EntryProcessorSchema,
|
|
95
|
+
ErrorMessageSchema: () => ErrorMessageSchema,
|
|
92
96
|
EventJournalImpl: () => EventJournalImpl,
|
|
93
97
|
FORBIDDEN_PATTERNS: () => FORBIDDEN_PATTERNS,
|
|
94
98
|
FTSInvertedIndex: () => BM25InvertedIndex,
|
|
@@ -107,8 +111,6 @@ __export(index_exports, {
|
|
|
107
111
|
HttpSyncErrorSchema: () => HttpSyncErrorSchema,
|
|
108
112
|
HttpSyncRequestSchema: () => HttpSyncRequestSchema,
|
|
109
113
|
HttpSyncResponseSchema: () => HttpSyncResponseSchema,
|
|
110
|
-
HybridQueryDeltaPayloadSchema: () => HybridQueryDeltaPayloadSchema,
|
|
111
|
-
HybridQueryRespPayloadSchema: () => HybridQueryRespPayloadSchema,
|
|
112
114
|
IndexRegistry: () => IndexRegistry,
|
|
113
115
|
IndexedLWWMap: () => IndexedLWWMap,
|
|
114
116
|
IndexedORMap: () => IndexedORMap,
|
|
@@ -129,8 +131,10 @@ __export(index_exports, {
|
|
|
129
131
|
ListResolversRequestSchema: () => ListResolversRequestSchema,
|
|
130
132
|
ListResolversResponseSchema: () => ListResolversResponseSchema,
|
|
131
133
|
LiveQueryManager: () => LiveQueryManager,
|
|
134
|
+
LockGrantedMessageSchema: () => LockGrantedMessageSchema,
|
|
132
135
|
LockGrantedPayloadSchema: () => LockGrantedPayloadSchema,
|
|
133
136
|
LockReleaseSchema: () => LockReleaseSchema,
|
|
137
|
+
LockReleasedMessageSchema: () => LockReleasedMessageSchema,
|
|
134
138
|
LockReleasedPayloadSchema: () => LockReleasedPayloadSchema,
|
|
135
139
|
LockRequestSchema: () => LockRequestSchema,
|
|
136
140
|
LowercaseFilter: () => LowercaseFilter,
|
|
@@ -144,9 +148,11 @@ __export(index_exports, {
|
|
|
144
148
|
MultiValueAttribute: () => MultiValueAttribute,
|
|
145
149
|
NGramTokenizer: () => NGramTokenizer,
|
|
146
150
|
NavigableIndex: () => NavigableIndex,
|
|
151
|
+
NodeInfoSchema: () => NodeInfoSchema,
|
|
147
152
|
ORMap: () => ORMap,
|
|
148
153
|
ORMapDiffRequestSchema: () => ORMapDiffRequestSchema,
|
|
149
154
|
ORMapDiffResponseSchema: () => ORMapDiffResponseSchema,
|
|
155
|
+
ORMapEntrySchema: () => ORMapEntrySchema,
|
|
150
156
|
ORMapMerkleReqBucketSchema: () => ORMapMerkleReqBucketSchema,
|
|
151
157
|
ORMapMerkleTree: () => ORMapMerkleTree,
|
|
152
158
|
ORMapPushDiffSchema: () => ORMapPushDiffSchema,
|
|
@@ -162,6 +168,9 @@ __export(index_exports, {
|
|
|
162
168
|
PARTITION_COUNT: () => PARTITION_COUNT,
|
|
163
169
|
PNCounterImpl: () => PNCounterImpl,
|
|
164
170
|
PNCounterStateObjectSchema: () => PNCounterStateObjectSchema,
|
|
171
|
+
PartitionInfoSchema: () => PartitionInfoSchema,
|
|
172
|
+
PartitionMapMessageSchema: () => PartitionMapMessageSchema,
|
|
173
|
+
PartitionMapPayloadSchema: () => PartitionMapPayloadSchema,
|
|
165
174
|
PartitionMapRequestSchema: () => PartitionMapRequestSchema,
|
|
166
175
|
PartitionState: () => PartitionState,
|
|
167
176
|
PingMessageSchema: () => PingMessageSchema,
|
|
@@ -212,6 +221,7 @@ __export(index_exports, {
|
|
|
212
221
|
StopWordFilter: () => StopWordFilter,
|
|
213
222
|
SyncInitMessageSchema: () => SyncInitMessageSchema,
|
|
214
223
|
SyncMapEntrySchema: () => SyncMapEntrySchema,
|
|
224
|
+
SyncResetRequiredMessageSchema: () => SyncResetRequiredMessageSchema,
|
|
215
225
|
SyncResetRequiredPayloadSchema: () => SyncResetRequiredPayloadSchema,
|
|
216
226
|
SyncRespBucketsMessageSchema: () => SyncRespBucketsMessageSchema,
|
|
217
227
|
SyncRespLeafMessageSchema: () => SyncRespLeafMessageSchema,
|
|
@@ -244,7 +254,6 @@ __export(index_exports, {
|
|
|
244
254
|
decodeBase64Url: () => decodeBase64Url,
|
|
245
255
|
deepMerge: () => deepMerge,
|
|
246
256
|
deserialize: () => deserialize,
|
|
247
|
-
disableNativeHash: () => disableNativeHash,
|
|
248
257
|
encodeBase64Url: () => encodeBase64Url,
|
|
249
258
|
evaluatePredicate: () => evaluatePredicate,
|
|
250
259
|
getCRDTDebugger: () => getCRDTDebugger,
|
|
@@ -256,13 +265,11 @@ __export(index_exports, {
|
|
|
256
265
|
hashString: () => hashString,
|
|
257
266
|
isLogicalQuery: () => isLogicalQuery,
|
|
258
267
|
isSimpleQuery: () => isSimpleQuery,
|
|
259
|
-
isUsingNativeHash: () => isUsingNativeHash,
|
|
260
268
|
isWriteConcernAchieved: () => isWriteConcernAchieved,
|
|
261
269
|
logger: () => logger,
|
|
262
270
|
multiAttribute: () => multiAttribute,
|
|
263
271
|
porterStem: () => porterStem,
|
|
264
272
|
resetCRDTDebugger: () => resetCRDTDebugger,
|
|
265
|
-
resetNativeHash: () => resetNativeHash,
|
|
266
273
|
resetSearchDebugger: () => resetSearchDebugger,
|
|
267
274
|
serialize: () => serialize,
|
|
268
275
|
simpleAttribute: () => simpleAttribute,
|
|
@@ -285,6 +292,9 @@ var logger = (0, import_pino.default)({
|
|
|
285
292
|
// src/HLC.ts
|
|
286
293
|
var HLC = class {
|
|
287
294
|
constructor(nodeId, options = {}) {
|
|
295
|
+
if (nodeId.includes(":")) {
|
|
296
|
+
throw new Error('Node ID must not contain ":" (used as delimiter in timestamp format)');
|
|
297
|
+
}
|
|
288
298
|
this.nodeId = nodeId;
|
|
289
299
|
this.strictMode = options.strictMode ?? false;
|
|
290
300
|
this.maxDriftMs = options.maxDriftMs ?? 6e4;
|
|
@@ -331,27 +341,33 @@ var HLC = class {
|
|
|
331
341
|
* Must be called whenever a message/event is received from another node.
|
|
332
342
|
*/
|
|
333
343
|
update(remote) {
|
|
344
|
+
const remoteMillis = Number(remote.millis);
|
|
345
|
+
const remoteCounter = Number(remote.counter);
|
|
346
|
+
if (!Number.isFinite(remoteMillis) || !Number.isFinite(remoteCounter)) {
|
|
347
|
+
logger.warn({ remoteMillis, remoteCounter, remote }, "HLC.update() received invalid timestamp, ignoring");
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
334
350
|
const systemTime = this.clockSource.now();
|
|
335
|
-
const drift =
|
|
351
|
+
const drift = remoteMillis - systemTime;
|
|
336
352
|
if (drift > this.maxDriftMs) {
|
|
337
353
|
if (this.strictMode) {
|
|
338
|
-
throw new Error(`Clock drift detected: Remote time ${
|
|
354
|
+
throw new Error(`Clock drift detected: Remote time ${remoteMillis} is ${drift}ms ahead of local ${systemTime} (threshold: ${this.maxDriftMs}ms)`);
|
|
339
355
|
} else {
|
|
340
356
|
logger.warn({
|
|
341
357
|
drift,
|
|
342
|
-
remoteMillis
|
|
358
|
+
remoteMillis,
|
|
343
359
|
localMillis: systemTime,
|
|
344
360
|
maxDriftMs: this.maxDriftMs
|
|
345
361
|
}, "Clock drift detected");
|
|
346
362
|
}
|
|
347
363
|
}
|
|
348
|
-
const maxMillis = Math.max(this.lastMillis, systemTime,
|
|
349
|
-
if (maxMillis === this.lastMillis && maxMillis ===
|
|
350
|
-
this.lastCounter = Math.max(this.lastCounter,
|
|
364
|
+
const maxMillis = Math.max(this.lastMillis, systemTime, remoteMillis);
|
|
365
|
+
if (maxMillis === this.lastMillis && maxMillis === remoteMillis) {
|
|
366
|
+
this.lastCounter = Math.max(this.lastCounter, remoteCounter) + 1;
|
|
351
367
|
} else if (maxMillis === this.lastMillis) {
|
|
352
368
|
this.lastCounter++;
|
|
353
|
-
} else if (maxMillis ===
|
|
354
|
-
this.lastCounter =
|
|
369
|
+
} else if (maxMillis === remoteMillis) {
|
|
370
|
+
this.lastCounter = remoteCounter + 1;
|
|
355
371
|
} else {
|
|
356
372
|
this.lastCounter = 0;
|
|
357
373
|
}
|
|
@@ -394,17 +410,7 @@ var HLC = class {
|
|
|
394
410
|
};
|
|
395
411
|
|
|
396
412
|
// src/utils/hash.ts
|
|
397
|
-
|
|
398
|
-
var nativeLoadAttempted = false;
|
|
399
|
-
function tryLoadNative() {
|
|
400
|
-
if (nativeLoadAttempted) return;
|
|
401
|
-
nativeLoadAttempted = true;
|
|
402
|
-
try {
|
|
403
|
-
nativeHash = require("@topgunbuild/native");
|
|
404
|
-
} catch {
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
function fnv1aHash(str) {
|
|
413
|
+
function hashString(str) {
|
|
408
414
|
let hash = 2166136261;
|
|
409
415
|
for (let i = 0; i < str.length; i++) {
|
|
410
416
|
hash ^= str.charCodeAt(i);
|
|
@@ -412,13 +418,6 @@ function fnv1aHash(str) {
|
|
|
412
418
|
}
|
|
413
419
|
return hash >>> 0;
|
|
414
420
|
}
|
|
415
|
-
function hashString(str) {
|
|
416
|
-
tryLoadNative();
|
|
417
|
-
if (nativeHash && nativeHash.isNativeHashAvailable()) {
|
|
418
|
-
return nativeHash.hashString(str);
|
|
419
|
-
}
|
|
420
|
-
return fnv1aHash(str);
|
|
421
|
-
}
|
|
422
421
|
function combineHashes(hashes) {
|
|
423
422
|
let result = 0;
|
|
424
423
|
for (const h of hashes) {
|
|
@@ -426,18 +425,6 @@ function combineHashes(hashes) {
|
|
|
426
425
|
}
|
|
427
426
|
return result >>> 0;
|
|
428
427
|
}
|
|
429
|
-
function isUsingNativeHash() {
|
|
430
|
-
tryLoadNative();
|
|
431
|
-
return nativeHash?.isNativeHashAvailable() === true;
|
|
432
|
-
}
|
|
433
|
-
function disableNativeHash() {
|
|
434
|
-
nativeHash = null;
|
|
435
|
-
nativeLoadAttempted = true;
|
|
436
|
-
}
|
|
437
|
-
function resetNativeHash() {
|
|
438
|
-
nativeHash = null;
|
|
439
|
-
nativeLoadAttempted = false;
|
|
440
|
-
}
|
|
441
428
|
function hashObject(obj) {
|
|
442
429
|
const json = JSON.stringify(obj, (_, value) => {
|
|
443
430
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -1275,11 +1262,49 @@ var ORMap = class {
|
|
|
1275
1262
|
// src/serializer.ts
|
|
1276
1263
|
var import_msgpackr = require("msgpackr");
|
|
1277
1264
|
function serialize(data) {
|
|
1278
|
-
return (0, import_msgpackr.pack)(data);
|
|
1265
|
+
return (0, import_msgpackr.pack)(stripUndefined(data));
|
|
1279
1266
|
}
|
|
1280
1267
|
function deserialize(data) {
|
|
1281
1268
|
const buffer = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
1282
|
-
|
|
1269
|
+
const result = (0, import_msgpackr.unpack)(buffer);
|
|
1270
|
+
return coerceBigInts(result);
|
|
1271
|
+
}
|
|
1272
|
+
function stripUndefined(value) {
|
|
1273
|
+
if (value === void 0) {
|
|
1274
|
+
return null;
|
|
1275
|
+
}
|
|
1276
|
+
if (Array.isArray(value)) {
|
|
1277
|
+
return value.map(stripUndefined);
|
|
1278
|
+
}
|
|
1279
|
+
if (value !== null && typeof value === "object") {
|
|
1280
|
+
const result = {};
|
|
1281
|
+
for (const [k, v] of Object.entries(value)) {
|
|
1282
|
+
if (v !== void 0) {
|
|
1283
|
+
result[k] = stripUndefined(v);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return result;
|
|
1287
|
+
}
|
|
1288
|
+
return value;
|
|
1289
|
+
}
|
|
1290
|
+
function coerceBigInts(value) {
|
|
1291
|
+
if (typeof value === "bigint") {
|
|
1292
|
+
return Number(value);
|
|
1293
|
+
}
|
|
1294
|
+
if (Array.isArray(value)) {
|
|
1295
|
+
for (let i = 0; i < value.length; i++) {
|
|
1296
|
+
value[i] = coerceBigInts(value[i]);
|
|
1297
|
+
}
|
|
1298
|
+
return value;
|
|
1299
|
+
}
|
|
1300
|
+
if (value !== null && typeof value === "object") {
|
|
1301
|
+
const obj = value;
|
|
1302
|
+
for (const key of Object.keys(obj)) {
|
|
1303
|
+
obj[key] = coerceBigInts(obj[key]);
|
|
1304
|
+
}
|
|
1305
|
+
return obj;
|
|
1306
|
+
}
|
|
1307
|
+
return value;
|
|
1283
1308
|
}
|
|
1284
1309
|
|
|
1285
1310
|
// src/PNCounter.ts
|
|
@@ -2454,6 +2479,7 @@ var ORMapRecordSchema = import_zod3.z.object({
|
|
|
2454
2479
|
tag: import_zod3.z.string(),
|
|
2455
2480
|
ttlMs: import_zod3.z.number().optional()
|
|
2456
2481
|
});
|
|
2482
|
+
var ChangeEventTypeSchema = import_zod3.z.enum(["ENTER", "UPDATE", "LEAVE"]);
|
|
2457
2483
|
var PredicateOpSchema = import_zod3.z.enum([
|
|
2458
2484
|
"eq",
|
|
2459
2485
|
"neq",
|
|
@@ -2494,7 +2520,11 @@ var ClientOpSchema = import_zod3.z.object({
|
|
|
2494
2520
|
});
|
|
2495
2521
|
var AuthMessageSchema = import_zod3.z.object({
|
|
2496
2522
|
type: import_zod3.z.literal("AUTH"),
|
|
2497
|
-
token: import_zod3.z.string()
|
|
2523
|
+
token: import_zod3.z.string(),
|
|
2524
|
+
protocolVersion: import_zod3.z.number().optional()
|
|
2525
|
+
});
|
|
2526
|
+
var AuthRequiredMessageSchema = import_zod3.z.object({
|
|
2527
|
+
type: import_zod3.z.literal("AUTH_REQUIRED")
|
|
2498
2528
|
});
|
|
2499
2529
|
|
|
2500
2530
|
// src/schemas/sync-schemas.ts
|
|
@@ -2550,6 +2580,11 @@ var MerkleReqBucketMessageSchema = import_zod4.z.object({
|
|
|
2550
2580
|
path: import_zod4.z.string()
|
|
2551
2581
|
})
|
|
2552
2582
|
});
|
|
2583
|
+
var ORMapEntrySchema = import_zod4.z.object({
|
|
2584
|
+
key: import_zod4.z.string(),
|
|
2585
|
+
records: import_zod4.z.array(ORMapRecordSchema),
|
|
2586
|
+
tombstones: import_zod4.z.array(import_zod4.z.string())
|
|
2587
|
+
});
|
|
2553
2588
|
var ORMapSyncInitSchema = import_zod4.z.object({
|
|
2554
2589
|
type: import_zod4.z.literal("ORMAP_SYNC_INIT"),
|
|
2555
2590
|
mapName: import_zod4.z.string(),
|
|
@@ -2585,11 +2620,7 @@ var ORMapSyncRespLeafSchema = import_zod4.z.object({
|
|
|
2585
2620
|
payload: import_zod4.z.object({
|
|
2586
2621
|
mapName: import_zod4.z.string(),
|
|
2587
2622
|
path: import_zod4.z.string(),
|
|
2588
|
-
entries: import_zod4.z.array(
|
|
2589
|
-
key: import_zod4.z.string(),
|
|
2590
|
-
records: import_zod4.z.array(ORMapRecordSchema),
|
|
2591
|
-
tombstones: import_zod4.z.array(import_zod4.z.string())
|
|
2592
|
-
}))
|
|
2623
|
+
entries: import_zod4.z.array(ORMapEntrySchema)
|
|
2593
2624
|
})
|
|
2594
2625
|
});
|
|
2595
2626
|
var ORMapDiffRequestSchema = import_zod4.z.object({
|
|
@@ -2603,22 +2634,14 @@ var ORMapDiffResponseSchema = import_zod4.z.object({
|
|
|
2603
2634
|
type: import_zod4.z.literal("ORMAP_DIFF_RESPONSE"),
|
|
2604
2635
|
payload: import_zod4.z.object({
|
|
2605
2636
|
mapName: import_zod4.z.string(),
|
|
2606
|
-
entries: import_zod4.z.array(
|
|
2607
|
-
key: import_zod4.z.string(),
|
|
2608
|
-
records: import_zod4.z.array(ORMapRecordSchema),
|
|
2609
|
-
tombstones: import_zod4.z.array(import_zod4.z.string())
|
|
2610
|
-
}))
|
|
2637
|
+
entries: import_zod4.z.array(ORMapEntrySchema)
|
|
2611
2638
|
})
|
|
2612
2639
|
});
|
|
2613
2640
|
var ORMapPushDiffSchema = import_zod4.z.object({
|
|
2614
2641
|
type: import_zod4.z.literal("ORMAP_PUSH_DIFF"),
|
|
2615
2642
|
payload: import_zod4.z.object({
|
|
2616
2643
|
mapName: import_zod4.z.string(),
|
|
2617
|
-
entries: import_zod4.z.array(
|
|
2618
|
-
key: import_zod4.z.string(),
|
|
2619
|
-
records: import_zod4.z.array(ORMapRecordSchema),
|
|
2620
|
-
tombstones: import_zod4.z.array(import_zod4.z.string())
|
|
2621
|
-
}))
|
|
2644
|
+
entries: import_zod4.z.array(ORMapEntrySchema)
|
|
2622
2645
|
})
|
|
2623
2646
|
});
|
|
2624
2647
|
var OpResultSchema = import_zod4.z.object({
|
|
@@ -2713,7 +2736,7 @@ var SearchRespMessageSchema = import_zod6.z.object({
|
|
|
2713
2736
|
type: import_zod6.z.literal("SEARCH_RESP"),
|
|
2714
2737
|
payload: SearchRespPayloadSchema
|
|
2715
2738
|
});
|
|
2716
|
-
var SearchUpdateTypeSchema =
|
|
2739
|
+
var SearchUpdateTypeSchema = ChangeEventTypeSchema;
|
|
2717
2740
|
var SearchSubPayloadSchema = import_zod6.z.object({
|
|
2718
2741
|
subscriptionId: import_zod6.z.string(),
|
|
2719
2742
|
mapName: import_zod6.z.string(),
|
|
@@ -2730,7 +2753,7 @@ var SearchUpdatePayloadSchema = import_zod6.z.object({
|
|
|
2730
2753
|
value: import_zod6.z.unknown(),
|
|
2731
2754
|
score: import_zod6.z.number(),
|
|
2732
2755
|
matchedTerms: import_zod6.z.array(import_zod6.z.string()),
|
|
2733
|
-
|
|
2756
|
+
changeType: SearchUpdateTypeSchema
|
|
2734
2757
|
});
|
|
2735
2758
|
var SearchUpdateMessageSchema = import_zod6.z.object({
|
|
2736
2759
|
type: import_zod6.z.literal("SEARCH_UPDATE"),
|
|
@@ -2752,17 +2775,37 @@ var PartitionMapRequestSchema = import_zod7.z.object({
|
|
|
2752
2775
|
currentVersion: import_zod7.z.number().optional()
|
|
2753
2776
|
}).optional()
|
|
2754
2777
|
});
|
|
2778
|
+
var NodeInfoSchema = import_zod7.z.object({
|
|
2779
|
+
nodeId: import_zod7.z.string(),
|
|
2780
|
+
endpoints: import_zod7.z.object({
|
|
2781
|
+
websocket: import_zod7.z.string(),
|
|
2782
|
+
http: import_zod7.z.string().optional()
|
|
2783
|
+
}),
|
|
2784
|
+
status: import_zod7.z.enum(["ACTIVE", "JOINING", "LEAVING", "SUSPECTED", "FAILED"])
|
|
2785
|
+
});
|
|
2786
|
+
var PartitionInfoSchema = import_zod7.z.object({
|
|
2787
|
+
partitionId: import_zod7.z.number(),
|
|
2788
|
+
ownerNodeId: import_zod7.z.string(),
|
|
2789
|
+
backupNodeIds: import_zod7.z.array(import_zod7.z.string())
|
|
2790
|
+
});
|
|
2791
|
+
var PartitionMapPayloadSchema = import_zod7.z.object({
|
|
2792
|
+
version: import_zod7.z.number(),
|
|
2793
|
+
partitionCount: import_zod7.z.number(),
|
|
2794
|
+
nodes: import_zod7.z.array(NodeInfoSchema),
|
|
2795
|
+
partitions: import_zod7.z.array(PartitionInfoSchema),
|
|
2796
|
+
generatedAt: import_zod7.z.number()
|
|
2797
|
+
});
|
|
2798
|
+
var PartitionMapMessageSchema = import_zod7.z.object({
|
|
2799
|
+
type: import_zod7.z.literal("PARTITION_MAP"),
|
|
2800
|
+
payload: PartitionMapPayloadSchema
|
|
2801
|
+
});
|
|
2755
2802
|
var ClusterSubRegisterPayloadSchema = import_zod7.z.object({
|
|
2756
2803
|
subscriptionId: import_zod7.z.string(),
|
|
2757
2804
|
coordinatorNodeId: import_zod7.z.string(),
|
|
2758
2805
|
mapName: import_zod7.z.string(),
|
|
2759
2806
|
type: import_zod7.z.enum(["SEARCH", "QUERY"]),
|
|
2760
2807
|
searchQuery: import_zod7.z.string().optional(),
|
|
2761
|
-
searchOptions:
|
|
2762
|
-
limit: import_zod7.z.number().int().positive().optional(),
|
|
2763
|
-
minScore: import_zod7.z.number().optional(),
|
|
2764
|
-
boost: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.number()).optional()
|
|
2765
|
-
}).optional(),
|
|
2808
|
+
searchOptions: SearchOptionsSchema.optional(),
|
|
2766
2809
|
queryPredicate: import_zod7.z.any().optional(),
|
|
2767
2810
|
querySort: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.enum(["asc", "desc"])).optional()
|
|
2768
2811
|
});
|
|
@@ -2794,7 +2837,7 @@ var ClusterSubUpdatePayloadSchema = import_zod7.z.object({
|
|
|
2794
2837
|
value: import_zod7.z.unknown(),
|
|
2795
2838
|
score: import_zod7.z.number().optional(),
|
|
2796
2839
|
matchedTerms: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
2797
|
-
changeType:
|
|
2840
|
+
changeType: ChangeEventTypeSchema,
|
|
2798
2841
|
timestamp: import_zod7.z.number()
|
|
2799
2842
|
});
|
|
2800
2843
|
var ClusterSubUpdateMessageSchema = import_zod7.z.object({
|
|
@@ -2812,10 +2855,8 @@ var ClusterSearchReqPayloadSchema = import_zod7.z.object({
|
|
|
2812
2855
|
requestId: import_zod7.z.string(),
|
|
2813
2856
|
mapName: import_zod7.z.string(),
|
|
2814
2857
|
query: import_zod7.z.string(),
|
|
2815
|
-
options:
|
|
2858
|
+
options: SearchOptionsSchema.extend({
|
|
2816
2859
|
limit: import_zod7.z.number().int().positive().max(1e3),
|
|
2817
|
-
minScore: import_zod7.z.number().optional(),
|
|
2818
|
-
boost: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.number()).optional(),
|
|
2819
2860
|
includeMatchedTerms: import_zod7.z.boolean().optional(),
|
|
2820
2861
|
afterScore: import_zod7.z.number().optional(),
|
|
2821
2862
|
afterKey: import_zod7.z.string().optional()
|
|
@@ -2867,7 +2908,7 @@ var ClusterSearchUpdatePayloadSchema = import_zod7.z.object({
|
|
|
2867
2908
|
value: import_zod7.z.unknown(),
|
|
2868
2909
|
score: import_zod7.z.number(),
|
|
2869
2910
|
matchedTerms: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
2870
|
-
|
|
2911
|
+
changeType: ChangeEventTypeSchema
|
|
2871
2912
|
});
|
|
2872
2913
|
var ClusterSearchUpdateMessageSchema = import_zod7.z.object({
|
|
2873
2914
|
type: import_zod7.z.literal("CLUSTER_SEARCH_UPDATE"),
|
|
@@ -3110,7 +3151,7 @@ var QueryUpdatePayloadSchema = import_zod9.z.object({
|
|
|
3110
3151
|
queryId: import_zod9.z.string(),
|
|
3111
3152
|
key: import_zod9.z.string(),
|
|
3112
3153
|
value: import_zod9.z.unknown(),
|
|
3113
|
-
|
|
3154
|
+
changeType: ChangeEventTypeSchema
|
|
3114
3155
|
});
|
|
3115
3156
|
var QueryUpdateMessageSchema = import_zod9.z.object({
|
|
3116
3157
|
type: import_zod9.z.literal("QUERY_UPDATE"),
|
|
@@ -3123,43 +3164,50 @@ var GcPruneMessageSchema = import_zod9.z.object({
|
|
|
3123
3164
|
type: import_zod9.z.literal("GC_PRUNE"),
|
|
3124
3165
|
payload: GcPrunePayloadSchema
|
|
3125
3166
|
});
|
|
3167
|
+
var AuthAckMessageSchema = import_zod9.z.object({
|
|
3168
|
+
type: import_zod9.z.literal("AUTH_ACK"),
|
|
3169
|
+
protocolVersion: import_zod9.z.number().optional(),
|
|
3170
|
+
userId: import_zod9.z.string().optional()
|
|
3171
|
+
});
|
|
3126
3172
|
var AuthFailMessageSchema = import_zod9.z.object({
|
|
3127
3173
|
type: import_zod9.z.literal("AUTH_FAIL"),
|
|
3128
3174
|
error: import_zod9.z.string().optional(),
|
|
3129
3175
|
code: import_zod9.z.number().optional()
|
|
3130
3176
|
});
|
|
3131
|
-
var
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
})),
|
|
3139
|
-
nextCursor: import_zod9.z.string().optional(),
|
|
3140
|
-
hasMore: import_zod9.z.boolean().optional(),
|
|
3141
|
-
cursorStatus: CursorStatusSchema.optional()
|
|
3142
|
-
});
|
|
3143
|
-
var HybridQueryDeltaPayloadSchema = import_zod9.z.object({
|
|
3144
|
-
subscriptionId: import_zod9.z.string(),
|
|
3145
|
-
key: import_zod9.z.string(),
|
|
3146
|
-
value: import_zod9.z.unknown().nullable(),
|
|
3147
|
-
score: import_zod9.z.number().optional(),
|
|
3148
|
-
matchedTerms: import_zod9.z.array(import_zod9.z.string()).optional(),
|
|
3149
|
-
type: import_zod9.z.enum(["ENTER", "UPDATE", "LEAVE"])
|
|
3177
|
+
var ErrorMessageSchema = import_zod9.z.object({
|
|
3178
|
+
type: import_zod9.z.literal("ERROR"),
|
|
3179
|
+
payload: import_zod9.z.object({
|
|
3180
|
+
code: import_zod9.z.number(),
|
|
3181
|
+
message: import_zod9.z.string(),
|
|
3182
|
+
details: import_zod9.z.unknown().optional()
|
|
3183
|
+
})
|
|
3150
3184
|
});
|
|
3151
3185
|
var LockGrantedPayloadSchema = import_zod9.z.object({
|
|
3152
3186
|
requestId: import_zod9.z.string(),
|
|
3187
|
+
name: import_zod9.z.string(),
|
|
3153
3188
|
fencingToken: import_zod9.z.number()
|
|
3154
3189
|
});
|
|
3155
3190
|
var LockReleasedPayloadSchema = import_zod9.z.object({
|
|
3156
3191
|
requestId: import_zod9.z.string(),
|
|
3192
|
+
name: import_zod9.z.string(),
|
|
3157
3193
|
success: import_zod9.z.boolean()
|
|
3158
3194
|
});
|
|
3195
|
+
var LockGrantedMessageSchema = import_zod9.z.object({
|
|
3196
|
+
type: import_zod9.z.literal("LOCK_GRANTED"),
|
|
3197
|
+
payload: LockGrantedPayloadSchema
|
|
3198
|
+
});
|
|
3199
|
+
var LockReleasedMessageSchema = import_zod9.z.object({
|
|
3200
|
+
type: import_zod9.z.literal("LOCK_RELEASED"),
|
|
3201
|
+
payload: LockReleasedPayloadSchema
|
|
3202
|
+
});
|
|
3159
3203
|
var SyncResetRequiredPayloadSchema = import_zod9.z.object({
|
|
3160
3204
|
mapName: import_zod9.z.string(),
|
|
3161
3205
|
reason: import_zod9.z.string()
|
|
3162
3206
|
});
|
|
3207
|
+
var SyncResetRequiredMessageSchema = import_zod9.z.object({
|
|
3208
|
+
type: import_zod9.z.literal("SYNC_RESET_REQUIRED"),
|
|
3209
|
+
payload: SyncResetRequiredPayloadSchema
|
|
3210
|
+
});
|
|
3163
3211
|
|
|
3164
3212
|
// src/schemas/http-sync-schemas.ts
|
|
3165
3213
|
var import_zod10 = require("zod");
|
|
@@ -3241,9 +3289,10 @@ var HttpSyncResponseSchema = import_zod10.z.object({
|
|
|
3241
3289
|
// src/schemas/index.ts
|
|
3242
3290
|
var import_zod11 = require("zod");
|
|
3243
3291
|
var MessageSchema = import_zod11.z.discriminatedUnion("type", [
|
|
3292
|
+
// --- Base ---
|
|
3244
3293
|
AuthMessageSchema,
|
|
3245
|
-
|
|
3246
|
-
|
|
3294
|
+
AuthRequiredMessageSchema,
|
|
3295
|
+
// --- Sync ---
|
|
3247
3296
|
ClientOpMessageSchema,
|
|
3248
3297
|
OpBatchMessageSchema,
|
|
3249
3298
|
SyncInitMessageSchema,
|
|
@@ -3251,13 +3300,10 @@ var MessageSchema = import_zod11.z.discriminatedUnion("type", [
|
|
|
3251
3300
|
SyncRespBucketsMessageSchema,
|
|
3252
3301
|
SyncRespLeafMessageSchema,
|
|
3253
3302
|
MerkleReqBucketMessageSchema,
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
TopicPubSchema,
|
|
3259
|
-
PingMessageSchema,
|
|
3260
|
-
PongMessageSchema,
|
|
3303
|
+
OpAckMessageSchema,
|
|
3304
|
+
OpRejectedMessageSchema,
|
|
3305
|
+
BatchMessageSchema,
|
|
3306
|
+
// --- ORMap Sync ---
|
|
3261
3307
|
ORMapSyncInitSchema,
|
|
3262
3308
|
ORMapSyncRespRootSchema,
|
|
3263
3309
|
ORMapSyncRespBucketsSchema,
|
|
@@ -3266,18 +3312,54 @@ var MessageSchema = import_zod11.z.discriminatedUnion("type", [
|
|
|
3266
3312
|
ORMapDiffRequestSchema,
|
|
3267
3313
|
ORMapDiffResponseSchema,
|
|
3268
3314
|
ORMapPushDiffSchema,
|
|
3315
|
+
// --- Query ---
|
|
3316
|
+
QuerySubMessageSchema,
|
|
3317
|
+
QueryUnsubMessageSchema,
|
|
3318
|
+
QueryRespMessageSchema,
|
|
3319
|
+
QueryUpdateMessageSchema,
|
|
3320
|
+
// --- Search ---
|
|
3321
|
+
SearchMessageSchema,
|
|
3322
|
+
SearchRespMessageSchema,
|
|
3323
|
+
SearchSubMessageSchema,
|
|
3324
|
+
SearchUpdateMessageSchema,
|
|
3325
|
+
SearchUnsubMessageSchema,
|
|
3326
|
+
// --- Cluster ---
|
|
3269
3327
|
PartitionMapRequestSchema,
|
|
3328
|
+
PartitionMapMessageSchema,
|
|
3329
|
+
ClusterSubRegisterMessageSchema,
|
|
3330
|
+
ClusterSubAckMessageSchema,
|
|
3331
|
+
ClusterSubUpdateMessageSchema,
|
|
3332
|
+
ClusterSubUnregisterMessageSchema,
|
|
3333
|
+
ClusterSearchReqMessageSchema,
|
|
3334
|
+
ClusterSearchRespMessageSchema,
|
|
3335
|
+
ClusterSearchSubscribeMessageSchema,
|
|
3336
|
+
ClusterSearchUnsubscribeMessageSchema,
|
|
3337
|
+
ClusterSearchUpdateMessageSchema,
|
|
3338
|
+
// --- Messaging ---
|
|
3339
|
+
TopicSubSchema,
|
|
3340
|
+
TopicUnsubSchema,
|
|
3341
|
+
TopicPubSchema,
|
|
3342
|
+
TopicMessageEventSchema,
|
|
3343
|
+
LockRequestSchema,
|
|
3344
|
+
LockReleaseSchema,
|
|
3270
3345
|
CounterRequestSchema,
|
|
3271
3346
|
CounterSyncSchema,
|
|
3347
|
+
CounterResponseSchema,
|
|
3348
|
+
CounterUpdateSchema,
|
|
3349
|
+
PingMessageSchema,
|
|
3350
|
+
PongMessageSchema,
|
|
3351
|
+
// --- Entry Processor ---
|
|
3272
3352
|
EntryProcessRequestSchema,
|
|
3273
3353
|
EntryProcessBatchRequestSchema,
|
|
3274
3354
|
EntryProcessResponseSchema,
|
|
3275
3355
|
EntryProcessBatchResponseSchema,
|
|
3356
|
+
// --- Journal ---
|
|
3276
3357
|
JournalSubscribeRequestSchema,
|
|
3277
3358
|
JournalUnsubscribeRequestSchema,
|
|
3278
3359
|
JournalEventMessageSchema,
|
|
3279
3360
|
JournalReadRequestSchema,
|
|
3280
3361
|
JournalReadResponseSchema,
|
|
3362
|
+
// --- Conflict Resolver ---
|
|
3281
3363
|
RegisterResolverRequestSchema,
|
|
3282
3364
|
RegisterResolverResponseSchema,
|
|
3283
3365
|
UnregisterResolverRequestSchema,
|
|
@@ -3285,15 +3367,16 @@ var MessageSchema = import_zod11.z.discriminatedUnion("type", [
|
|
|
3285
3367
|
MergeRejectedMessageSchema,
|
|
3286
3368
|
ListResolversRequestSchema,
|
|
3287
3369
|
ListResolversResponseSchema,
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3370
|
+
// --- Server-to-Client ---
|
|
3371
|
+
ServerEventMessageSchema,
|
|
3372
|
+
ServerBatchEventMessageSchema,
|
|
3373
|
+
GcPruneMessageSchema,
|
|
3374
|
+
AuthAckMessageSchema,
|
|
3375
|
+
AuthFailMessageSchema,
|
|
3376
|
+
ErrorMessageSchema,
|
|
3377
|
+
LockGrantedMessageSchema,
|
|
3378
|
+
LockReleasedMessageSchema,
|
|
3379
|
+
SyncResetRequiredMessageSchema
|
|
3297
3380
|
]);
|
|
3298
3381
|
|
|
3299
3382
|
// src/types/WriteConcern.ts
|
|
@@ -13034,8 +13117,10 @@ var ScenarioRunner = class {
|
|
|
13034
13117
|
};
|
|
13035
13118
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13036
13119
|
0 && (module.exports = {
|
|
13120
|
+
AuthAckMessageSchema,
|
|
13037
13121
|
AuthFailMessageSchema,
|
|
13038
13122
|
AuthMessageSchema,
|
|
13123
|
+
AuthRequiredMessageSchema,
|
|
13039
13124
|
BM25Scorer,
|
|
13040
13125
|
BatchMessageSchema,
|
|
13041
13126
|
BuiltInProcessors,
|
|
@@ -13043,6 +13128,7 @@ var ScenarioRunner = class {
|
|
|
13043
13128
|
COST_WEIGHTS,
|
|
13044
13129
|
CRDTDebugger,
|
|
13045
13130
|
CRDTInvariants,
|
|
13131
|
+
ChangeEventTypeSchema,
|
|
13046
13132
|
ClientOpMessageSchema,
|
|
13047
13133
|
ClientOpSchema,
|
|
13048
13134
|
ClusterSearchReqMessageSchema,
|
|
@@ -13093,6 +13179,7 @@ var ScenarioRunner = class {
|
|
|
13093
13179
|
EntryProcessResponseSchema,
|
|
13094
13180
|
EntryProcessorDefSchema,
|
|
13095
13181
|
EntryProcessorSchema,
|
|
13182
|
+
ErrorMessageSchema,
|
|
13096
13183
|
EventJournalImpl,
|
|
13097
13184
|
FORBIDDEN_PATTERNS,
|
|
13098
13185
|
FTSInvertedIndex,
|
|
@@ -13111,8 +13198,6 @@ var ScenarioRunner = class {
|
|
|
13111
13198
|
HttpSyncErrorSchema,
|
|
13112
13199
|
HttpSyncRequestSchema,
|
|
13113
13200
|
HttpSyncResponseSchema,
|
|
13114
|
-
HybridQueryDeltaPayloadSchema,
|
|
13115
|
-
HybridQueryRespPayloadSchema,
|
|
13116
13201
|
IndexRegistry,
|
|
13117
13202
|
IndexedLWWMap,
|
|
13118
13203
|
IndexedORMap,
|
|
@@ -13133,8 +13218,10 @@ var ScenarioRunner = class {
|
|
|
13133
13218
|
ListResolversRequestSchema,
|
|
13134
13219
|
ListResolversResponseSchema,
|
|
13135
13220
|
LiveQueryManager,
|
|
13221
|
+
LockGrantedMessageSchema,
|
|
13136
13222
|
LockGrantedPayloadSchema,
|
|
13137
13223
|
LockReleaseSchema,
|
|
13224
|
+
LockReleasedMessageSchema,
|
|
13138
13225
|
LockReleasedPayloadSchema,
|
|
13139
13226
|
LockRequestSchema,
|
|
13140
13227
|
LowercaseFilter,
|
|
@@ -13148,9 +13235,11 @@ var ScenarioRunner = class {
|
|
|
13148
13235
|
MultiValueAttribute,
|
|
13149
13236
|
NGramTokenizer,
|
|
13150
13237
|
NavigableIndex,
|
|
13238
|
+
NodeInfoSchema,
|
|
13151
13239
|
ORMap,
|
|
13152
13240
|
ORMapDiffRequestSchema,
|
|
13153
13241
|
ORMapDiffResponseSchema,
|
|
13242
|
+
ORMapEntrySchema,
|
|
13154
13243
|
ORMapMerkleReqBucketSchema,
|
|
13155
13244
|
ORMapMerkleTree,
|
|
13156
13245
|
ORMapPushDiffSchema,
|
|
@@ -13166,6 +13255,9 @@ var ScenarioRunner = class {
|
|
|
13166
13255
|
PARTITION_COUNT,
|
|
13167
13256
|
PNCounterImpl,
|
|
13168
13257
|
PNCounterStateObjectSchema,
|
|
13258
|
+
PartitionInfoSchema,
|
|
13259
|
+
PartitionMapMessageSchema,
|
|
13260
|
+
PartitionMapPayloadSchema,
|
|
13169
13261
|
PartitionMapRequestSchema,
|
|
13170
13262
|
PartitionState,
|
|
13171
13263
|
PingMessageSchema,
|
|
@@ -13216,6 +13308,7 @@ var ScenarioRunner = class {
|
|
|
13216
13308
|
StopWordFilter,
|
|
13217
13309
|
SyncInitMessageSchema,
|
|
13218
13310
|
SyncMapEntrySchema,
|
|
13311
|
+
SyncResetRequiredMessageSchema,
|
|
13219
13312
|
SyncResetRequiredPayloadSchema,
|
|
13220
13313
|
SyncRespBucketsMessageSchema,
|
|
13221
13314
|
SyncRespLeafMessageSchema,
|
|
@@ -13248,7 +13341,6 @@ var ScenarioRunner = class {
|
|
|
13248
13341
|
decodeBase64Url,
|
|
13249
13342
|
deepMerge,
|
|
13250
13343
|
deserialize,
|
|
13251
|
-
disableNativeHash,
|
|
13252
13344
|
encodeBase64Url,
|
|
13253
13345
|
evaluatePredicate,
|
|
13254
13346
|
getCRDTDebugger,
|
|
@@ -13260,13 +13352,11 @@ var ScenarioRunner = class {
|
|
|
13260
13352
|
hashString,
|
|
13261
13353
|
isLogicalQuery,
|
|
13262
13354
|
isSimpleQuery,
|
|
13263
|
-
isUsingNativeHash,
|
|
13264
13355
|
isWriteConcernAchieved,
|
|
13265
13356
|
logger,
|
|
13266
13357
|
multiAttribute,
|
|
13267
13358
|
porterStem,
|
|
13268
13359
|
resetCRDTDebugger,
|
|
13269
|
-
resetNativeHash,
|
|
13270
13360
|
resetSearchDebugger,
|
|
13271
13361
|
serialize,
|
|
13272
13362
|
simpleAttribute,
|