@topgunbuild/core 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -97
- package/dist/index.d.mts +683 -231
- package/dist/index.d.ts +683 -231
- package/dist/index.js +223 -118
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -120
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
1
|
// src/utils/logger.ts
|
|
9
2
|
import pino from "pino";
|
|
10
3
|
var logLevel = typeof process !== "undefined" && process.env && process.env.LOG_LEVEL || "info";
|
|
@@ -18,6 +11,9 @@ var logger = pino({
|
|
|
18
11
|
// src/HLC.ts
|
|
19
12
|
var HLC = class {
|
|
20
13
|
constructor(nodeId, options = {}) {
|
|
14
|
+
if (nodeId.includes(":")) {
|
|
15
|
+
throw new Error('Node ID must not contain ":" (used as delimiter in timestamp format)');
|
|
16
|
+
}
|
|
21
17
|
this.nodeId = nodeId;
|
|
22
18
|
this.strictMode = options.strictMode ?? false;
|
|
23
19
|
this.maxDriftMs = options.maxDriftMs ?? 6e4;
|
|
@@ -64,27 +60,33 @@ var HLC = class {
|
|
|
64
60
|
* Must be called whenever a message/event is received from another node.
|
|
65
61
|
*/
|
|
66
62
|
update(remote) {
|
|
63
|
+
const remoteMillis = Number(remote.millis);
|
|
64
|
+
const remoteCounter = Number(remote.counter);
|
|
65
|
+
if (!Number.isFinite(remoteMillis) || !Number.isFinite(remoteCounter)) {
|
|
66
|
+
logger.warn({ remoteMillis, remoteCounter, remote }, "HLC.update() received invalid timestamp, ignoring");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
67
69
|
const systemTime = this.clockSource.now();
|
|
68
|
-
const drift =
|
|
70
|
+
const drift = remoteMillis - systemTime;
|
|
69
71
|
if (drift > this.maxDriftMs) {
|
|
70
72
|
if (this.strictMode) {
|
|
71
|
-
throw new Error(`Clock drift detected: Remote time ${
|
|
73
|
+
throw new Error(`Clock drift detected: Remote time ${remoteMillis} is ${drift}ms ahead of local ${systemTime} (threshold: ${this.maxDriftMs}ms)`);
|
|
72
74
|
} else {
|
|
73
75
|
logger.warn({
|
|
74
76
|
drift,
|
|
75
|
-
remoteMillis
|
|
77
|
+
remoteMillis,
|
|
76
78
|
localMillis: systemTime,
|
|
77
79
|
maxDriftMs: this.maxDriftMs
|
|
78
80
|
}, "Clock drift detected");
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
const maxMillis = Math.max(this.lastMillis, systemTime,
|
|
82
|
-
if (maxMillis === this.lastMillis && maxMillis ===
|
|
83
|
-
this.lastCounter = Math.max(this.lastCounter,
|
|
83
|
+
const maxMillis = Math.max(this.lastMillis, systemTime, remoteMillis);
|
|
84
|
+
if (maxMillis === this.lastMillis && maxMillis === remoteMillis) {
|
|
85
|
+
this.lastCounter = Math.max(this.lastCounter, remoteCounter) + 1;
|
|
84
86
|
} else if (maxMillis === this.lastMillis) {
|
|
85
87
|
this.lastCounter++;
|
|
86
|
-
} else if (maxMillis ===
|
|
87
|
-
this.lastCounter =
|
|
88
|
+
} else if (maxMillis === remoteMillis) {
|
|
89
|
+
this.lastCounter = remoteCounter + 1;
|
|
88
90
|
} else {
|
|
89
91
|
this.lastCounter = 0;
|
|
90
92
|
}
|
|
@@ -127,17 +129,7 @@ var HLC = class {
|
|
|
127
129
|
};
|
|
128
130
|
|
|
129
131
|
// src/utils/hash.ts
|
|
130
|
-
|
|
131
|
-
var nativeLoadAttempted = false;
|
|
132
|
-
function tryLoadNative() {
|
|
133
|
-
if (nativeLoadAttempted) return;
|
|
134
|
-
nativeLoadAttempted = true;
|
|
135
|
-
try {
|
|
136
|
-
nativeHash = __require("@topgunbuild/native");
|
|
137
|
-
} catch {
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
function fnv1aHash(str) {
|
|
132
|
+
function hashString(str) {
|
|
141
133
|
let hash = 2166136261;
|
|
142
134
|
for (let i = 0; i < str.length; i++) {
|
|
143
135
|
hash ^= str.charCodeAt(i);
|
|
@@ -145,13 +137,6 @@ function fnv1aHash(str) {
|
|
|
145
137
|
}
|
|
146
138
|
return hash >>> 0;
|
|
147
139
|
}
|
|
148
|
-
function hashString(str) {
|
|
149
|
-
tryLoadNative();
|
|
150
|
-
if (nativeHash && nativeHash.isNativeHashAvailable()) {
|
|
151
|
-
return nativeHash.hashString(str);
|
|
152
|
-
}
|
|
153
|
-
return fnv1aHash(str);
|
|
154
|
-
}
|
|
155
140
|
function combineHashes(hashes) {
|
|
156
141
|
let result = 0;
|
|
157
142
|
for (const h of hashes) {
|
|
@@ -159,18 +144,6 @@ function combineHashes(hashes) {
|
|
|
159
144
|
}
|
|
160
145
|
return result >>> 0;
|
|
161
146
|
}
|
|
162
|
-
function isUsingNativeHash() {
|
|
163
|
-
tryLoadNative();
|
|
164
|
-
return nativeHash?.isNativeHashAvailable() === true;
|
|
165
|
-
}
|
|
166
|
-
function disableNativeHash() {
|
|
167
|
-
nativeHash = null;
|
|
168
|
-
nativeLoadAttempted = true;
|
|
169
|
-
}
|
|
170
|
-
function resetNativeHash() {
|
|
171
|
-
nativeHash = null;
|
|
172
|
-
nativeLoadAttempted = false;
|
|
173
|
-
}
|
|
174
147
|
function hashObject(obj) {
|
|
175
148
|
const json = JSON.stringify(obj, (_, value) => {
|
|
176
149
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -1008,11 +981,49 @@ var ORMap = class {
|
|
|
1008
981
|
// src/serializer.ts
|
|
1009
982
|
import { pack, unpack } from "msgpackr";
|
|
1010
983
|
function serialize(data) {
|
|
1011
|
-
return pack(data);
|
|
984
|
+
return pack(stripUndefined(data));
|
|
1012
985
|
}
|
|
1013
986
|
function deserialize(data) {
|
|
1014
987
|
const buffer = data instanceof ArrayBuffer ? new Uint8Array(data) : data;
|
|
1015
|
-
|
|
988
|
+
const result = unpack(buffer);
|
|
989
|
+
return coerceBigInts(result);
|
|
990
|
+
}
|
|
991
|
+
function stripUndefined(value) {
|
|
992
|
+
if (value === void 0) {
|
|
993
|
+
return null;
|
|
994
|
+
}
|
|
995
|
+
if (Array.isArray(value)) {
|
|
996
|
+
return value.map(stripUndefined);
|
|
997
|
+
}
|
|
998
|
+
if (value !== null && typeof value === "object") {
|
|
999
|
+
const result = {};
|
|
1000
|
+
for (const [k, v] of Object.entries(value)) {
|
|
1001
|
+
if (v !== void 0) {
|
|
1002
|
+
result[k] = stripUndefined(v);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
return result;
|
|
1006
|
+
}
|
|
1007
|
+
return value;
|
|
1008
|
+
}
|
|
1009
|
+
function coerceBigInts(value) {
|
|
1010
|
+
if (typeof value === "bigint") {
|
|
1011
|
+
return Number(value);
|
|
1012
|
+
}
|
|
1013
|
+
if (Array.isArray(value)) {
|
|
1014
|
+
for (let i = 0; i < value.length; i++) {
|
|
1015
|
+
value[i] = coerceBigInts(value[i]);
|
|
1016
|
+
}
|
|
1017
|
+
return value;
|
|
1018
|
+
}
|
|
1019
|
+
if (value !== null && typeof value === "object") {
|
|
1020
|
+
const obj = value;
|
|
1021
|
+
for (const key of Object.keys(obj)) {
|
|
1022
|
+
obj[key] = coerceBigInts(obj[key]);
|
|
1023
|
+
}
|
|
1024
|
+
return obj;
|
|
1025
|
+
}
|
|
1026
|
+
return value;
|
|
1016
1027
|
}
|
|
1017
1028
|
|
|
1018
1029
|
// src/PNCounter.ts
|
|
@@ -2187,6 +2198,7 @@ var ORMapRecordSchema = z3.object({
|
|
|
2187
2198
|
tag: z3.string(),
|
|
2188
2199
|
ttlMs: z3.number().optional()
|
|
2189
2200
|
});
|
|
2201
|
+
var ChangeEventTypeSchema = z3.enum(["ENTER", "UPDATE", "LEAVE"]);
|
|
2190
2202
|
var PredicateOpSchema = z3.enum([
|
|
2191
2203
|
"eq",
|
|
2192
2204
|
"neq",
|
|
@@ -2227,7 +2239,11 @@ var ClientOpSchema = z3.object({
|
|
|
2227
2239
|
});
|
|
2228
2240
|
var AuthMessageSchema = z3.object({
|
|
2229
2241
|
type: z3.literal("AUTH"),
|
|
2230
|
-
token: z3.string()
|
|
2242
|
+
token: z3.string(),
|
|
2243
|
+
protocolVersion: z3.number().optional()
|
|
2244
|
+
});
|
|
2245
|
+
var AuthRequiredMessageSchema = z3.object({
|
|
2246
|
+
type: z3.literal("AUTH_REQUIRED")
|
|
2231
2247
|
});
|
|
2232
2248
|
|
|
2233
2249
|
// src/schemas/sync-schemas.ts
|
|
@@ -2283,6 +2299,11 @@ var MerkleReqBucketMessageSchema = z4.object({
|
|
|
2283
2299
|
path: z4.string()
|
|
2284
2300
|
})
|
|
2285
2301
|
});
|
|
2302
|
+
var ORMapEntrySchema = z4.object({
|
|
2303
|
+
key: z4.string(),
|
|
2304
|
+
records: z4.array(ORMapRecordSchema),
|
|
2305
|
+
tombstones: z4.array(z4.string())
|
|
2306
|
+
});
|
|
2286
2307
|
var ORMapSyncInitSchema = z4.object({
|
|
2287
2308
|
type: z4.literal("ORMAP_SYNC_INIT"),
|
|
2288
2309
|
mapName: z4.string(),
|
|
@@ -2318,11 +2339,7 @@ var ORMapSyncRespLeafSchema = z4.object({
|
|
|
2318
2339
|
payload: z4.object({
|
|
2319
2340
|
mapName: z4.string(),
|
|
2320
2341
|
path: z4.string(),
|
|
2321
|
-
entries: z4.array(
|
|
2322
|
-
key: z4.string(),
|
|
2323
|
-
records: z4.array(ORMapRecordSchema),
|
|
2324
|
-
tombstones: z4.array(z4.string())
|
|
2325
|
-
}))
|
|
2342
|
+
entries: z4.array(ORMapEntrySchema)
|
|
2326
2343
|
})
|
|
2327
2344
|
});
|
|
2328
2345
|
var ORMapDiffRequestSchema = z4.object({
|
|
@@ -2336,22 +2353,14 @@ var ORMapDiffResponseSchema = z4.object({
|
|
|
2336
2353
|
type: z4.literal("ORMAP_DIFF_RESPONSE"),
|
|
2337
2354
|
payload: z4.object({
|
|
2338
2355
|
mapName: z4.string(),
|
|
2339
|
-
entries: z4.array(
|
|
2340
|
-
key: z4.string(),
|
|
2341
|
-
records: z4.array(ORMapRecordSchema),
|
|
2342
|
-
tombstones: z4.array(z4.string())
|
|
2343
|
-
}))
|
|
2356
|
+
entries: z4.array(ORMapEntrySchema)
|
|
2344
2357
|
})
|
|
2345
2358
|
});
|
|
2346
2359
|
var ORMapPushDiffSchema = z4.object({
|
|
2347
2360
|
type: z4.literal("ORMAP_PUSH_DIFF"),
|
|
2348
2361
|
payload: z4.object({
|
|
2349
2362
|
mapName: z4.string(),
|
|
2350
|
-
entries: z4.array(
|
|
2351
|
-
key: z4.string(),
|
|
2352
|
-
records: z4.array(ORMapRecordSchema),
|
|
2353
|
-
tombstones: z4.array(z4.string())
|
|
2354
|
-
}))
|
|
2363
|
+
entries: z4.array(ORMapEntrySchema)
|
|
2355
2364
|
})
|
|
2356
2365
|
});
|
|
2357
2366
|
var OpResultSchema = z4.object({
|
|
@@ -2389,7 +2398,8 @@ var QuerySubMessageSchema = z5.object({
|
|
|
2389
2398
|
payload: z5.object({
|
|
2390
2399
|
queryId: z5.string(),
|
|
2391
2400
|
mapName: z5.string(),
|
|
2392
|
-
query: QuerySchema
|
|
2401
|
+
query: QuerySchema,
|
|
2402
|
+
fields: z5.array(z5.string()).optional()
|
|
2393
2403
|
})
|
|
2394
2404
|
});
|
|
2395
2405
|
var QueryUnsubMessageSchema = z5.object({
|
|
@@ -2407,12 +2417,21 @@ var QueryRespPayloadSchema = z5.object({
|
|
|
2407
2417
|
})),
|
|
2408
2418
|
nextCursor: z5.string().optional(),
|
|
2409
2419
|
hasMore: z5.boolean().optional(),
|
|
2410
|
-
cursorStatus: CursorStatusSchema.optional()
|
|
2420
|
+
cursorStatus: CursorStatusSchema.optional(),
|
|
2421
|
+
merkleRootHash: z5.number().int().optional()
|
|
2411
2422
|
});
|
|
2412
2423
|
var QueryRespMessageSchema = z5.object({
|
|
2413
2424
|
type: z5.literal("QUERY_RESP"),
|
|
2414
2425
|
payload: QueryRespPayloadSchema
|
|
2415
2426
|
});
|
|
2427
|
+
var QuerySyncInitPayloadSchema = z5.object({
|
|
2428
|
+
queryId: z5.string(),
|
|
2429
|
+
rootHash: z5.number().int()
|
|
2430
|
+
});
|
|
2431
|
+
var QuerySyncInitMessageSchema = z5.object({
|
|
2432
|
+
type: z5.literal("QUERY_SYNC_INIT"),
|
|
2433
|
+
payload: QuerySyncInitPayloadSchema
|
|
2434
|
+
});
|
|
2416
2435
|
|
|
2417
2436
|
// src/schemas/search-schemas.ts
|
|
2418
2437
|
import { z as z6 } from "zod";
|
|
@@ -2446,7 +2465,7 @@ var SearchRespMessageSchema = z6.object({
|
|
|
2446
2465
|
type: z6.literal("SEARCH_RESP"),
|
|
2447
2466
|
payload: SearchRespPayloadSchema
|
|
2448
2467
|
});
|
|
2449
|
-
var SearchUpdateTypeSchema =
|
|
2468
|
+
var SearchUpdateTypeSchema = ChangeEventTypeSchema;
|
|
2450
2469
|
var SearchSubPayloadSchema = z6.object({
|
|
2451
2470
|
subscriptionId: z6.string(),
|
|
2452
2471
|
mapName: z6.string(),
|
|
@@ -2463,7 +2482,7 @@ var SearchUpdatePayloadSchema = z6.object({
|
|
|
2463
2482
|
value: z6.unknown(),
|
|
2464
2483
|
score: z6.number(),
|
|
2465
2484
|
matchedTerms: z6.array(z6.string()),
|
|
2466
|
-
|
|
2485
|
+
changeType: SearchUpdateTypeSchema
|
|
2467
2486
|
});
|
|
2468
2487
|
var SearchUpdateMessageSchema = z6.object({
|
|
2469
2488
|
type: z6.literal("SEARCH_UPDATE"),
|
|
@@ -2485,17 +2504,37 @@ var PartitionMapRequestSchema = z7.object({
|
|
|
2485
2504
|
currentVersion: z7.number().optional()
|
|
2486
2505
|
}).optional()
|
|
2487
2506
|
});
|
|
2507
|
+
var NodeInfoSchema = z7.object({
|
|
2508
|
+
nodeId: z7.string(),
|
|
2509
|
+
endpoints: z7.object({
|
|
2510
|
+
websocket: z7.string(),
|
|
2511
|
+
http: z7.string().optional()
|
|
2512
|
+
}),
|
|
2513
|
+
status: z7.enum(["ACTIVE", "JOINING", "LEAVING", "SUSPECTED", "FAILED"])
|
|
2514
|
+
});
|
|
2515
|
+
var PartitionInfoSchema = z7.object({
|
|
2516
|
+
partitionId: z7.number(),
|
|
2517
|
+
ownerNodeId: z7.string(),
|
|
2518
|
+
backupNodeIds: z7.array(z7.string())
|
|
2519
|
+
});
|
|
2520
|
+
var PartitionMapPayloadSchema = z7.object({
|
|
2521
|
+
version: z7.number(),
|
|
2522
|
+
partitionCount: z7.number(),
|
|
2523
|
+
nodes: z7.array(NodeInfoSchema),
|
|
2524
|
+
partitions: z7.array(PartitionInfoSchema),
|
|
2525
|
+
generatedAt: z7.number()
|
|
2526
|
+
});
|
|
2527
|
+
var PartitionMapMessageSchema = z7.object({
|
|
2528
|
+
type: z7.literal("PARTITION_MAP"),
|
|
2529
|
+
payload: PartitionMapPayloadSchema
|
|
2530
|
+
});
|
|
2488
2531
|
var ClusterSubRegisterPayloadSchema = z7.object({
|
|
2489
2532
|
subscriptionId: z7.string(),
|
|
2490
2533
|
coordinatorNodeId: z7.string(),
|
|
2491
2534
|
mapName: z7.string(),
|
|
2492
2535
|
type: z7.enum(["SEARCH", "QUERY"]),
|
|
2493
2536
|
searchQuery: z7.string().optional(),
|
|
2494
|
-
searchOptions:
|
|
2495
|
-
limit: z7.number().int().positive().optional(),
|
|
2496
|
-
minScore: z7.number().optional(),
|
|
2497
|
-
boost: z7.record(z7.string(), z7.number()).optional()
|
|
2498
|
-
}).optional(),
|
|
2537
|
+
searchOptions: SearchOptionsSchema.optional(),
|
|
2499
2538
|
queryPredicate: z7.any().optional(),
|
|
2500
2539
|
querySort: z7.record(z7.string(), z7.enum(["asc", "desc"])).optional()
|
|
2501
2540
|
});
|
|
@@ -2527,7 +2566,7 @@ var ClusterSubUpdatePayloadSchema = z7.object({
|
|
|
2527
2566
|
value: z7.unknown(),
|
|
2528
2567
|
score: z7.number().optional(),
|
|
2529
2568
|
matchedTerms: z7.array(z7.string()).optional(),
|
|
2530
|
-
changeType:
|
|
2569
|
+
changeType: ChangeEventTypeSchema,
|
|
2531
2570
|
timestamp: z7.number()
|
|
2532
2571
|
});
|
|
2533
2572
|
var ClusterSubUpdateMessageSchema = z7.object({
|
|
@@ -2545,10 +2584,8 @@ var ClusterSearchReqPayloadSchema = z7.object({
|
|
|
2545
2584
|
requestId: z7.string(),
|
|
2546
2585
|
mapName: z7.string(),
|
|
2547
2586
|
query: z7.string(),
|
|
2548
|
-
options:
|
|
2587
|
+
options: SearchOptionsSchema.extend({
|
|
2549
2588
|
limit: z7.number().int().positive().max(1e3),
|
|
2550
|
-
minScore: z7.number().optional(),
|
|
2551
|
-
boost: z7.record(z7.string(), z7.number()).optional(),
|
|
2552
2589
|
includeMatchedTerms: z7.boolean().optional(),
|
|
2553
2590
|
afterScore: z7.number().optional(),
|
|
2554
2591
|
afterKey: z7.string().optional()
|
|
@@ -2600,7 +2637,7 @@ var ClusterSearchUpdatePayloadSchema = z7.object({
|
|
|
2600
2637
|
value: z7.unknown(),
|
|
2601
2638
|
score: z7.number(),
|
|
2602
2639
|
matchedTerms: z7.array(z7.string()).optional(),
|
|
2603
|
-
|
|
2640
|
+
changeType: ChangeEventTypeSchema
|
|
2604
2641
|
});
|
|
2605
2642
|
var ClusterSearchUpdateMessageSchema = z7.object({
|
|
2606
2643
|
type: z7.literal("CLUSTER_SEARCH_UPDATE"),
|
|
@@ -2843,7 +2880,7 @@ var QueryUpdatePayloadSchema = z9.object({
|
|
|
2843
2880
|
queryId: z9.string(),
|
|
2844
2881
|
key: z9.string(),
|
|
2845
2882
|
value: z9.unknown(),
|
|
2846
|
-
|
|
2883
|
+
changeType: ChangeEventTypeSchema
|
|
2847
2884
|
});
|
|
2848
2885
|
var QueryUpdateMessageSchema = z9.object({
|
|
2849
2886
|
type: z9.literal("QUERY_UPDATE"),
|
|
@@ -2856,43 +2893,50 @@ var GcPruneMessageSchema = z9.object({
|
|
|
2856
2893
|
type: z9.literal("GC_PRUNE"),
|
|
2857
2894
|
payload: GcPrunePayloadSchema
|
|
2858
2895
|
});
|
|
2896
|
+
var AuthAckMessageSchema = z9.object({
|
|
2897
|
+
type: z9.literal("AUTH_ACK"),
|
|
2898
|
+
protocolVersion: z9.number().optional(),
|
|
2899
|
+
userId: z9.string().optional()
|
|
2900
|
+
});
|
|
2859
2901
|
var AuthFailMessageSchema = z9.object({
|
|
2860
2902
|
type: z9.literal("AUTH_FAIL"),
|
|
2861
2903
|
error: z9.string().optional(),
|
|
2862
2904
|
code: z9.number().optional()
|
|
2863
2905
|
});
|
|
2864
|
-
var
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
})),
|
|
2872
|
-
nextCursor: z9.string().optional(),
|
|
2873
|
-
hasMore: z9.boolean().optional(),
|
|
2874
|
-
cursorStatus: CursorStatusSchema.optional()
|
|
2875
|
-
});
|
|
2876
|
-
var HybridQueryDeltaPayloadSchema = z9.object({
|
|
2877
|
-
subscriptionId: z9.string(),
|
|
2878
|
-
key: z9.string(),
|
|
2879
|
-
value: z9.unknown().nullable(),
|
|
2880
|
-
score: z9.number().optional(),
|
|
2881
|
-
matchedTerms: z9.array(z9.string()).optional(),
|
|
2882
|
-
type: z9.enum(["ENTER", "UPDATE", "LEAVE"])
|
|
2906
|
+
var ErrorMessageSchema = z9.object({
|
|
2907
|
+
type: z9.literal("ERROR"),
|
|
2908
|
+
payload: z9.object({
|
|
2909
|
+
code: z9.number(),
|
|
2910
|
+
message: z9.string(),
|
|
2911
|
+
details: z9.unknown().optional()
|
|
2912
|
+
})
|
|
2883
2913
|
});
|
|
2884
2914
|
var LockGrantedPayloadSchema = z9.object({
|
|
2885
2915
|
requestId: z9.string(),
|
|
2916
|
+
name: z9.string(),
|
|
2886
2917
|
fencingToken: z9.number()
|
|
2887
2918
|
});
|
|
2888
2919
|
var LockReleasedPayloadSchema = z9.object({
|
|
2889
2920
|
requestId: z9.string(),
|
|
2921
|
+
name: z9.string(),
|
|
2890
2922
|
success: z9.boolean()
|
|
2891
2923
|
});
|
|
2924
|
+
var LockGrantedMessageSchema = z9.object({
|
|
2925
|
+
type: z9.literal("LOCK_GRANTED"),
|
|
2926
|
+
payload: LockGrantedPayloadSchema
|
|
2927
|
+
});
|
|
2928
|
+
var LockReleasedMessageSchema = z9.object({
|
|
2929
|
+
type: z9.literal("LOCK_RELEASED"),
|
|
2930
|
+
payload: LockReleasedPayloadSchema
|
|
2931
|
+
});
|
|
2892
2932
|
var SyncResetRequiredPayloadSchema = z9.object({
|
|
2893
2933
|
mapName: z9.string(),
|
|
2894
2934
|
reason: z9.string()
|
|
2895
2935
|
});
|
|
2936
|
+
var SyncResetRequiredMessageSchema = z9.object({
|
|
2937
|
+
type: z9.literal("SYNC_RESET_REQUIRED"),
|
|
2938
|
+
payload: SyncResetRequiredPayloadSchema
|
|
2939
|
+
});
|
|
2896
2940
|
|
|
2897
2941
|
// src/schemas/http-sync-schemas.ts
|
|
2898
2942
|
import { z as z10 } from "zod";
|
|
@@ -2974,9 +3018,10 @@ var HttpSyncResponseSchema = z10.object({
|
|
|
2974
3018
|
// src/schemas/index.ts
|
|
2975
3019
|
import { z as z11 } from "zod";
|
|
2976
3020
|
var MessageSchema = z11.discriminatedUnion("type", [
|
|
3021
|
+
// --- Base ---
|
|
2977
3022
|
AuthMessageSchema,
|
|
2978
|
-
|
|
2979
|
-
|
|
3023
|
+
AuthRequiredMessageSchema,
|
|
3024
|
+
// --- Sync ---
|
|
2980
3025
|
ClientOpMessageSchema,
|
|
2981
3026
|
OpBatchMessageSchema,
|
|
2982
3027
|
SyncInitMessageSchema,
|
|
@@ -2984,13 +3029,10 @@ var MessageSchema = z11.discriminatedUnion("type", [
|
|
|
2984
3029
|
SyncRespBucketsMessageSchema,
|
|
2985
3030
|
SyncRespLeafMessageSchema,
|
|
2986
3031
|
MerkleReqBucketMessageSchema,
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
TopicPubSchema,
|
|
2992
|
-
PingMessageSchema,
|
|
2993
|
-
PongMessageSchema,
|
|
3032
|
+
OpAckMessageSchema,
|
|
3033
|
+
OpRejectedMessageSchema,
|
|
3034
|
+
BatchMessageSchema,
|
|
3035
|
+
// --- ORMap Sync ---
|
|
2994
3036
|
ORMapSyncInitSchema,
|
|
2995
3037
|
ORMapSyncRespRootSchema,
|
|
2996
3038
|
ORMapSyncRespBucketsSchema,
|
|
@@ -2999,18 +3041,55 @@ var MessageSchema = z11.discriminatedUnion("type", [
|
|
|
2999
3041
|
ORMapDiffRequestSchema,
|
|
3000
3042
|
ORMapDiffResponseSchema,
|
|
3001
3043
|
ORMapPushDiffSchema,
|
|
3044
|
+
// --- Query ---
|
|
3045
|
+
QuerySubMessageSchema,
|
|
3046
|
+
QueryUnsubMessageSchema,
|
|
3047
|
+
QueryRespMessageSchema,
|
|
3048
|
+
QuerySyncInitMessageSchema,
|
|
3049
|
+
QueryUpdateMessageSchema,
|
|
3050
|
+
// --- Search ---
|
|
3051
|
+
SearchMessageSchema,
|
|
3052
|
+
SearchRespMessageSchema,
|
|
3053
|
+
SearchSubMessageSchema,
|
|
3054
|
+
SearchUpdateMessageSchema,
|
|
3055
|
+
SearchUnsubMessageSchema,
|
|
3056
|
+
// --- Cluster ---
|
|
3002
3057
|
PartitionMapRequestSchema,
|
|
3058
|
+
PartitionMapMessageSchema,
|
|
3059
|
+
ClusterSubRegisterMessageSchema,
|
|
3060
|
+
ClusterSubAckMessageSchema,
|
|
3061
|
+
ClusterSubUpdateMessageSchema,
|
|
3062
|
+
ClusterSubUnregisterMessageSchema,
|
|
3063
|
+
ClusterSearchReqMessageSchema,
|
|
3064
|
+
ClusterSearchRespMessageSchema,
|
|
3065
|
+
ClusterSearchSubscribeMessageSchema,
|
|
3066
|
+
ClusterSearchUnsubscribeMessageSchema,
|
|
3067
|
+
ClusterSearchUpdateMessageSchema,
|
|
3068
|
+
// --- Messaging ---
|
|
3069
|
+
TopicSubSchema,
|
|
3070
|
+
TopicUnsubSchema,
|
|
3071
|
+
TopicPubSchema,
|
|
3072
|
+
TopicMessageEventSchema,
|
|
3073
|
+
LockRequestSchema,
|
|
3074
|
+
LockReleaseSchema,
|
|
3003
3075
|
CounterRequestSchema,
|
|
3004
3076
|
CounterSyncSchema,
|
|
3077
|
+
CounterResponseSchema,
|
|
3078
|
+
CounterUpdateSchema,
|
|
3079
|
+
PingMessageSchema,
|
|
3080
|
+
PongMessageSchema,
|
|
3081
|
+
// --- Entry Processor ---
|
|
3005
3082
|
EntryProcessRequestSchema,
|
|
3006
3083
|
EntryProcessBatchRequestSchema,
|
|
3007
3084
|
EntryProcessResponseSchema,
|
|
3008
3085
|
EntryProcessBatchResponseSchema,
|
|
3086
|
+
// --- Journal ---
|
|
3009
3087
|
JournalSubscribeRequestSchema,
|
|
3010
3088
|
JournalUnsubscribeRequestSchema,
|
|
3011
3089
|
JournalEventMessageSchema,
|
|
3012
3090
|
JournalReadRequestSchema,
|
|
3013
3091
|
JournalReadResponseSchema,
|
|
3092
|
+
// --- Conflict Resolver ---
|
|
3014
3093
|
RegisterResolverRequestSchema,
|
|
3015
3094
|
RegisterResolverResponseSchema,
|
|
3016
3095
|
UnregisterResolverRequestSchema,
|
|
@@ -3018,15 +3097,16 @@ var MessageSchema = z11.discriminatedUnion("type", [
|
|
|
3018
3097
|
MergeRejectedMessageSchema,
|
|
3019
3098
|
ListResolversRequestSchema,
|
|
3020
3099
|
ListResolversResponseSchema,
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3100
|
+
// --- Server-to-Client ---
|
|
3101
|
+
ServerEventMessageSchema,
|
|
3102
|
+
ServerBatchEventMessageSchema,
|
|
3103
|
+
GcPruneMessageSchema,
|
|
3104
|
+
AuthAckMessageSchema,
|
|
3105
|
+
AuthFailMessageSchema,
|
|
3106
|
+
ErrorMessageSchema,
|
|
3107
|
+
LockGrantedMessageSchema,
|
|
3108
|
+
LockReleasedMessageSchema,
|
|
3109
|
+
SyncResetRequiredMessageSchema
|
|
3030
3110
|
]);
|
|
3031
3111
|
|
|
3032
3112
|
// src/types/WriteConcern.ts
|
|
@@ -12766,8 +12846,10 @@ var ScenarioRunner = class {
|
|
|
12766
12846
|
}
|
|
12767
12847
|
};
|
|
12768
12848
|
export {
|
|
12849
|
+
AuthAckMessageSchema,
|
|
12769
12850
|
AuthFailMessageSchema,
|
|
12770
12851
|
AuthMessageSchema,
|
|
12852
|
+
AuthRequiredMessageSchema,
|
|
12771
12853
|
BM25Scorer,
|
|
12772
12854
|
BatchMessageSchema,
|
|
12773
12855
|
BuiltInProcessors,
|
|
@@ -12775,6 +12857,7 @@ export {
|
|
|
12775
12857
|
COST_WEIGHTS,
|
|
12776
12858
|
CRDTDebugger,
|
|
12777
12859
|
CRDTInvariants,
|
|
12860
|
+
ChangeEventTypeSchema,
|
|
12778
12861
|
ClientOpMessageSchema,
|
|
12779
12862
|
ClientOpSchema,
|
|
12780
12863
|
ClusterSearchReqMessageSchema,
|
|
@@ -12825,6 +12908,7 @@ export {
|
|
|
12825
12908
|
EntryProcessResponseSchema,
|
|
12826
12909
|
EntryProcessorDefSchema,
|
|
12827
12910
|
EntryProcessorSchema,
|
|
12911
|
+
ErrorMessageSchema,
|
|
12828
12912
|
EventJournalImpl,
|
|
12829
12913
|
FORBIDDEN_PATTERNS,
|
|
12830
12914
|
BM25InvertedIndex as FTSInvertedIndex,
|
|
@@ -12843,8 +12927,6 @@ export {
|
|
|
12843
12927
|
HttpSyncErrorSchema,
|
|
12844
12928
|
HttpSyncRequestSchema,
|
|
12845
12929
|
HttpSyncResponseSchema,
|
|
12846
|
-
HybridQueryDeltaPayloadSchema,
|
|
12847
|
-
HybridQueryRespPayloadSchema,
|
|
12848
12930
|
IndexRegistry,
|
|
12849
12931
|
IndexedLWWMap,
|
|
12850
12932
|
IndexedORMap,
|
|
@@ -12865,8 +12947,10 @@ export {
|
|
|
12865
12947
|
ListResolversRequestSchema,
|
|
12866
12948
|
ListResolversResponseSchema,
|
|
12867
12949
|
LiveQueryManager,
|
|
12950
|
+
LockGrantedMessageSchema,
|
|
12868
12951
|
LockGrantedPayloadSchema,
|
|
12869
12952
|
LockReleaseSchema,
|
|
12953
|
+
LockReleasedMessageSchema,
|
|
12870
12954
|
LockReleasedPayloadSchema,
|
|
12871
12955
|
LockRequestSchema,
|
|
12872
12956
|
LowercaseFilter,
|
|
@@ -12880,9 +12964,11 @@ export {
|
|
|
12880
12964
|
MultiValueAttribute,
|
|
12881
12965
|
NGramTokenizer,
|
|
12882
12966
|
NavigableIndex,
|
|
12967
|
+
NodeInfoSchema,
|
|
12883
12968
|
ORMap,
|
|
12884
12969
|
ORMapDiffRequestSchema,
|
|
12885
12970
|
ORMapDiffResponseSchema,
|
|
12971
|
+
ORMapEntrySchema,
|
|
12886
12972
|
ORMapMerkleReqBucketSchema,
|
|
12887
12973
|
ORMapMerkleTree,
|
|
12888
12974
|
ORMapPushDiffSchema,
|
|
@@ -12898,6 +12984,9 @@ export {
|
|
|
12898
12984
|
PARTITION_COUNT,
|
|
12899
12985
|
PNCounterImpl,
|
|
12900
12986
|
PNCounterStateObjectSchema,
|
|
12987
|
+
PartitionInfoSchema,
|
|
12988
|
+
PartitionMapMessageSchema,
|
|
12989
|
+
PartitionMapPayloadSchema,
|
|
12901
12990
|
PartitionMapRequestSchema,
|
|
12902
12991
|
PartitionState,
|
|
12903
12992
|
PingMessageSchema,
|
|
@@ -12911,6 +13000,8 @@ export {
|
|
|
12911
13000
|
QueryRespPayloadSchema,
|
|
12912
13001
|
QuerySchema,
|
|
12913
13002
|
QuerySubMessageSchema,
|
|
13003
|
+
QuerySyncInitMessageSchema,
|
|
13004
|
+
QuerySyncInitPayloadSchema,
|
|
12914
13005
|
QueryUnsubMessageSchema,
|
|
12915
13006
|
QueryUpdateMessageSchema,
|
|
12916
13007
|
QueryUpdatePayloadSchema,
|
|
@@ -12948,6 +13039,7 @@ export {
|
|
|
12948
13039
|
StopWordFilter,
|
|
12949
13040
|
SyncInitMessageSchema,
|
|
12950
13041
|
SyncMapEntrySchema,
|
|
13042
|
+
SyncResetRequiredMessageSchema,
|
|
12951
13043
|
SyncResetRequiredPayloadSchema,
|
|
12952
13044
|
SyncRespBucketsMessageSchema,
|
|
12953
13045
|
SyncRespLeafMessageSchema,
|
|
@@ -12980,7 +13072,6 @@ export {
|
|
|
12980
13072
|
decodeBase64Url,
|
|
12981
13073
|
deepMerge,
|
|
12982
13074
|
deserialize,
|
|
12983
|
-
disableNativeHash,
|
|
12984
13075
|
encodeBase64Url,
|
|
12985
13076
|
evaluatePredicate,
|
|
12986
13077
|
getCRDTDebugger,
|
|
@@ -12992,13 +13083,11 @@ export {
|
|
|
12992
13083
|
hashString,
|
|
12993
13084
|
isLogicalQuery,
|
|
12994
13085
|
isSimpleQuery,
|
|
12995
|
-
isUsingNativeHash,
|
|
12996
13086
|
isWriteConcernAchieved,
|
|
12997
13087
|
logger,
|
|
12998
13088
|
multiAttribute,
|
|
12999
13089
|
porterStem,
|
|
13000
13090
|
resetCRDTDebugger,
|
|
13001
|
-
resetNativeHash,
|
|
13002
13091
|
resetSearchDebugger,
|
|
13003
13092
|
serialize,
|
|
13004
13093
|
simpleAttribute,
|