@topgunbuild/core 0.3.0 → 0.4.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 +1190 -1
- package/dist/index.d.ts +1190 -1
- package/dist/index.js +1396 -195
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1353 -194
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- package/LICENSE +0 -97
package/dist/index.js
CHANGED
|
@@ -22,21 +22,51 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AuthMessageSchema: () => AuthMessageSchema,
|
|
24
24
|
BatchMessageSchema: () => BatchMessageSchema,
|
|
25
|
+
BuiltInProcessors: () => BuiltInProcessors,
|
|
26
|
+
BuiltInResolvers: () => BuiltInResolvers,
|
|
25
27
|
ClientOpMessageSchema: () => ClientOpMessageSchema,
|
|
26
28
|
ClientOpSchema: () => ClientOpSchema,
|
|
29
|
+
ConflictResolverDefSchema: () => ConflictResolverDefSchema,
|
|
30
|
+
ConflictResolverSchema: () => ConflictResolverSchema,
|
|
27
31
|
ConsistencyLevel: () => ConsistencyLevel,
|
|
32
|
+
CounterRequestSchema: () => CounterRequestSchema,
|
|
33
|
+
CounterResponseSchema: () => CounterResponseSchema,
|
|
34
|
+
CounterSyncSchema: () => CounterSyncSchema,
|
|
35
|
+
CounterUpdateSchema: () => CounterUpdateSchema,
|
|
28
36
|
DEFAULT_BACKUP_COUNT: () => DEFAULT_BACKUP_COUNT,
|
|
29
37
|
DEFAULT_CIRCUIT_BREAKER_CONFIG: () => DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
30
38
|
DEFAULT_CONNECTION_POOL_CONFIG: () => DEFAULT_CONNECTION_POOL_CONFIG,
|
|
39
|
+
DEFAULT_EVENT_JOURNAL_CONFIG: () => DEFAULT_EVENT_JOURNAL_CONFIG,
|
|
31
40
|
DEFAULT_MIGRATION_CONFIG: () => DEFAULT_MIGRATION_CONFIG,
|
|
32
41
|
DEFAULT_PARTITION_ROUTER_CONFIG: () => DEFAULT_PARTITION_ROUTER_CONFIG,
|
|
42
|
+
DEFAULT_PROCESSOR_RATE_LIMITS: () => DEFAULT_PROCESSOR_RATE_LIMITS,
|
|
33
43
|
DEFAULT_REPLICATION_CONFIG: () => DEFAULT_REPLICATION_CONFIG,
|
|
44
|
+
DEFAULT_RESOLVER_RATE_LIMITS: () => DEFAULT_RESOLVER_RATE_LIMITS,
|
|
34
45
|
DEFAULT_WRITE_CONCERN_TIMEOUT: () => DEFAULT_WRITE_CONCERN_TIMEOUT,
|
|
46
|
+
EntryProcessBatchRequestSchema: () => EntryProcessBatchRequestSchema,
|
|
47
|
+
EntryProcessBatchResponseSchema: () => EntryProcessBatchResponseSchema,
|
|
48
|
+
EntryProcessKeyResultSchema: () => EntryProcessKeyResultSchema,
|
|
49
|
+
EntryProcessRequestSchema: () => EntryProcessRequestSchema,
|
|
50
|
+
EntryProcessResponseSchema: () => EntryProcessResponseSchema,
|
|
51
|
+
EntryProcessorDefSchema: () => EntryProcessorDefSchema,
|
|
52
|
+
EntryProcessorSchema: () => EntryProcessorSchema,
|
|
53
|
+
EventJournalImpl: () => EventJournalImpl,
|
|
54
|
+
FORBIDDEN_PATTERNS: () => FORBIDDEN_PATTERNS,
|
|
35
55
|
HLC: () => HLC,
|
|
56
|
+
JournalEventDataSchema: () => JournalEventDataSchema,
|
|
57
|
+
JournalEventMessageSchema: () => JournalEventMessageSchema,
|
|
58
|
+
JournalEventTypeSchema: () => JournalEventTypeSchema,
|
|
59
|
+
JournalReadRequestSchema: () => JournalReadRequestSchema,
|
|
60
|
+
JournalReadResponseSchema: () => JournalReadResponseSchema,
|
|
61
|
+
JournalSubscribeRequestSchema: () => JournalSubscribeRequestSchema,
|
|
62
|
+
JournalUnsubscribeRequestSchema: () => JournalUnsubscribeRequestSchema,
|
|
36
63
|
LWWMap: () => LWWMap,
|
|
37
64
|
LWWRecordSchema: () => LWWRecordSchema,
|
|
65
|
+
ListResolversRequestSchema: () => ListResolversRequestSchema,
|
|
66
|
+
ListResolversResponseSchema: () => ListResolversResponseSchema,
|
|
38
67
|
LockReleaseSchema: () => LockReleaseSchema,
|
|
39
68
|
LockRequestSchema: () => LockRequestSchema,
|
|
69
|
+
MergeRejectedMessageSchema: () => MergeRejectedMessageSchema,
|
|
40
70
|
MerkleReqBucketMessageSchema: () => MerkleReqBucketMessageSchema,
|
|
41
71
|
MerkleTree: () => MerkleTree,
|
|
42
72
|
MessageSchema: () => MessageSchema,
|
|
@@ -56,6 +86,8 @@ __export(index_exports, {
|
|
|
56
86
|
OpRejectedMessageSchema: () => OpRejectedMessageSchema,
|
|
57
87
|
OpResultSchema: () => OpResultSchema,
|
|
58
88
|
PARTITION_COUNT: () => PARTITION_COUNT,
|
|
89
|
+
PNCounterImpl: () => PNCounterImpl,
|
|
90
|
+
PNCounterStateObjectSchema: () => PNCounterStateObjectSchema,
|
|
59
91
|
PartitionMapRequestSchema: () => PartitionMapRequestSchema,
|
|
60
92
|
PartitionState: () => PartitionState,
|
|
61
93
|
PingMessageSchema: () => PingMessageSchema,
|
|
@@ -66,6 +98,10 @@ __export(index_exports, {
|
|
|
66
98
|
QuerySchema: () => QuerySchema,
|
|
67
99
|
QuerySubMessageSchema: () => QuerySubMessageSchema,
|
|
68
100
|
QueryUnsubMessageSchema: () => QueryUnsubMessageSchema,
|
|
101
|
+
RESOLVER_FORBIDDEN_PATTERNS: () => RESOLVER_FORBIDDEN_PATTERNS,
|
|
102
|
+
RegisterResolverRequestSchema: () => RegisterResolverRequestSchema,
|
|
103
|
+
RegisterResolverResponseSchema: () => RegisterResolverResponseSchema,
|
|
104
|
+
Ringbuffer: () => Ringbuffer,
|
|
69
105
|
SyncInitMessageSchema: () => SyncInitMessageSchema,
|
|
70
106
|
SyncRespBucketsMessageSchema: () => SyncRespBucketsMessageSchema,
|
|
71
107
|
SyncRespLeafMessageSchema: () => SyncRespLeafMessageSchema,
|
|
@@ -75,11 +111,15 @@ __export(index_exports, {
|
|
|
75
111
|
TopicPubSchema: () => TopicPubSchema,
|
|
76
112
|
TopicSubSchema: () => TopicSubSchema,
|
|
77
113
|
TopicUnsubSchema: () => TopicUnsubSchema,
|
|
114
|
+
UnregisterResolverRequestSchema: () => UnregisterResolverRequestSchema,
|
|
115
|
+
UnregisterResolverResponseSchema: () => UnregisterResolverResponseSchema,
|
|
78
116
|
WRITE_CONCERN_ORDER: () => WRITE_CONCERN_ORDER,
|
|
79
117
|
WriteConcern: () => WriteConcern,
|
|
80
118
|
WriteConcernSchema: () => WriteConcernSchema,
|
|
81
119
|
combineHashes: () => combineHashes,
|
|
120
|
+
compareHLCTimestamps: () => compareHLCTimestamps,
|
|
82
121
|
compareTimestamps: () => compareTimestamps,
|
|
122
|
+
deepMerge: () => deepMerge,
|
|
83
123
|
deserialize: () => deserialize,
|
|
84
124
|
disableNativeHash: () => disableNativeHash,
|
|
85
125
|
evaluatePredicate: () => evaluatePredicate,
|
|
@@ -91,7 +131,9 @@ __export(index_exports, {
|
|
|
91
131
|
isWriteConcernAchieved: () => isWriteConcernAchieved,
|
|
92
132
|
resetNativeHash: () => resetNativeHash,
|
|
93
133
|
serialize: () => serialize,
|
|
94
|
-
timestampToString: () => timestampToString
|
|
134
|
+
timestampToString: () => timestampToString,
|
|
135
|
+
validateProcessorCode: () => validateProcessorCode,
|
|
136
|
+
validateResolverCode: () => validateResolverCode
|
|
95
137
|
});
|
|
96
138
|
module.exports = __toCommonJS(index_exports);
|
|
97
139
|
|
|
@@ -1060,6 +1102,935 @@ function deserialize(data) {
|
|
|
1060
1102
|
return (0, import_msgpackr.unpack)(buffer);
|
|
1061
1103
|
}
|
|
1062
1104
|
|
|
1105
|
+
// src/PNCounter.ts
|
|
1106
|
+
var PNCounterImpl = class {
|
|
1107
|
+
constructor(config) {
|
|
1108
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
1109
|
+
this.nodeId = config.nodeId;
|
|
1110
|
+
this.state = config.initialState ?? {
|
|
1111
|
+
positive: /* @__PURE__ */ new Map(),
|
|
1112
|
+
negative: /* @__PURE__ */ new Map()
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Get the current counter value.
|
|
1117
|
+
* Value = sum(positive) - sum(negative)
|
|
1118
|
+
*/
|
|
1119
|
+
get() {
|
|
1120
|
+
let sum = 0;
|
|
1121
|
+
for (const v of this.state.positive.values()) sum += v;
|
|
1122
|
+
for (const v of this.state.negative.values()) sum -= v;
|
|
1123
|
+
return sum;
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Increment by 1 and return the new value.
|
|
1127
|
+
*/
|
|
1128
|
+
increment() {
|
|
1129
|
+
return this.addAndGet(1);
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Decrement by 1 and return the new value.
|
|
1133
|
+
*/
|
|
1134
|
+
decrement() {
|
|
1135
|
+
return this.addAndGet(-1);
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Add a delta (positive or negative) and return the new value.
|
|
1139
|
+
* @param delta The amount to add (can be negative)
|
|
1140
|
+
*/
|
|
1141
|
+
addAndGet(delta) {
|
|
1142
|
+
if (delta === 0) return this.get();
|
|
1143
|
+
if (delta > 0) {
|
|
1144
|
+
const current = this.state.positive.get(this.nodeId) ?? 0;
|
|
1145
|
+
this.state.positive.set(this.nodeId, current + delta);
|
|
1146
|
+
} else {
|
|
1147
|
+
const current = this.state.negative.get(this.nodeId) ?? 0;
|
|
1148
|
+
this.state.negative.set(this.nodeId, current + Math.abs(delta));
|
|
1149
|
+
}
|
|
1150
|
+
const newValue = this.get();
|
|
1151
|
+
this.notifyListeners(newValue);
|
|
1152
|
+
return newValue;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Get a copy of the current state for synchronization.
|
|
1156
|
+
*/
|
|
1157
|
+
getState() {
|
|
1158
|
+
return {
|
|
1159
|
+
positive: new Map(this.state.positive),
|
|
1160
|
+
negative: new Map(this.state.negative)
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Merge remote state into this counter.
|
|
1165
|
+
* Takes the maximum value for each node in both positive and negative counters.
|
|
1166
|
+
* This operation is commutative, associative, and idempotent (CRDT properties).
|
|
1167
|
+
*
|
|
1168
|
+
* @param remote The remote state to merge
|
|
1169
|
+
*/
|
|
1170
|
+
merge(remote) {
|
|
1171
|
+
let changed = false;
|
|
1172
|
+
for (const [nodeId, value] of remote.positive) {
|
|
1173
|
+
const current = this.state.positive.get(nodeId) ?? 0;
|
|
1174
|
+
if (value > current) {
|
|
1175
|
+
this.state.positive.set(nodeId, value);
|
|
1176
|
+
changed = true;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
for (const [nodeId, value] of remote.negative) {
|
|
1180
|
+
const current = this.state.negative.get(nodeId) ?? 0;
|
|
1181
|
+
if (value > current) {
|
|
1182
|
+
this.state.negative.set(nodeId, value);
|
|
1183
|
+
changed = true;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (changed) {
|
|
1187
|
+
this.notifyListeners(this.get());
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Subscribe to value changes.
|
|
1192
|
+
* The listener is immediately called with the current value.
|
|
1193
|
+
*
|
|
1194
|
+
* @param listener Callback function receiving the new value
|
|
1195
|
+
* @returns Unsubscribe function
|
|
1196
|
+
*/
|
|
1197
|
+
subscribe(listener) {
|
|
1198
|
+
this.listeners.add(listener);
|
|
1199
|
+
listener(this.get());
|
|
1200
|
+
return () => this.listeners.delete(listener);
|
|
1201
|
+
}
|
|
1202
|
+
notifyListeners(value) {
|
|
1203
|
+
for (const listener of this.listeners) {
|
|
1204
|
+
try {
|
|
1205
|
+
listener(value);
|
|
1206
|
+
} catch (e) {
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Get the node ID of this counter instance.
|
|
1212
|
+
*/
|
|
1213
|
+
getNodeId() {
|
|
1214
|
+
return this.nodeId;
|
|
1215
|
+
}
|
|
1216
|
+
// ============================================
|
|
1217
|
+
// Serialization
|
|
1218
|
+
// ============================================
|
|
1219
|
+
/**
|
|
1220
|
+
* Serialize state to binary format (msgpack).
|
|
1221
|
+
*/
|
|
1222
|
+
static serialize(state) {
|
|
1223
|
+
const obj = {
|
|
1224
|
+
p: Object.fromEntries(state.positive),
|
|
1225
|
+
n: Object.fromEntries(state.negative)
|
|
1226
|
+
};
|
|
1227
|
+
return serialize(obj);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Deserialize binary data to state.
|
|
1231
|
+
*/
|
|
1232
|
+
static deserialize(data) {
|
|
1233
|
+
const obj = deserialize(data);
|
|
1234
|
+
return {
|
|
1235
|
+
positive: new Map(Object.entries(obj.p)),
|
|
1236
|
+
negative: new Map(Object.entries(obj.n))
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Convert state to plain object (for JSON/network).
|
|
1241
|
+
*/
|
|
1242
|
+
static stateToObject(state) {
|
|
1243
|
+
return {
|
|
1244
|
+
p: Object.fromEntries(state.positive),
|
|
1245
|
+
n: Object.fromEntries(state.negative)
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Convert plain object to state.
|
|
1250
|
+
*/
|
|
1251
|
+
static objectToState(obj) {
|
|
1252
|
+
return {
|
|
1253
|
+
positive: new Map(Object.entries(obj.p)),
|
|
1254
|
+
negative: new Map(Object.entries(obj.n))
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
// src/Ringbuffer.ts
|
|
1260
|
+
var Ringbuffer = class {
|
|
1261
|
+
// Next sequence to write
|
|
1262
|
+
constructor(capacity) {
|
|
1263
|
+
this.headSequence = 0n;
|
|
1264
|
+
// Oldest available sequence
|
|
1265
|
+
this.tailSequence = 0n;
|
|
1266
|
+
if (capacity < 1) {
|
|
1267
|
+
throw new Error("Capacity must be >= 1");
|
|
1268
|
+
}
|
|
1269
|
+
this._capacity = capacity;
|
|
1270
|
+
this.buffer = new Array(capacity);
|
|
1271
|
+
}
|
|
1272
|
+
/**
|
|
1273
|
+
* Add item to buffer, returns sequence number.
|
|
1274
|
+
*/
|
|
1275
|
+
add(item) {
|
|
1276
|
+
const sequence = this.tailSequence;
|
|
1277
|
+
const index = Number(sequence % BigInt(this._capacity));
|
|
1278
|
+
this.buffer[index] = item;
|
|
1279
|
+
this.tailSequence++;
|
|
1280
|
+
if (this.tailSequence - this.headSequence > this._capacity) {
|
|
1281
|
+
this.headSequence = this.tailSequence - BigInt(this._capacity);
|
|
1282
|
+
}
|
|
1283
|
+
return sequence;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* Read item at sequence.
|
|
1287
|
+
* Returns undefined if sequence is out of range.
|
|
1288
|
+
*/
|
|
1289
|
+
read(sequence) {
|
|
1290
|
+
if (sequence < this.headSequence || sequence >= this.tailSequence) {
|
|
1291
|
+
return void 0;
|
|
1292
|
+
}
|
|
1293
|
+
const index = Number(sequence % BigInt(this._capacity));
|
|
1294
|
+
return this.buffer[index];
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Read range of items (inclusive).
|
|
1298
|
+
* Automatically clamps to available range.
|
|
1299
|
+
*/
|
|
1300
|
+
readRange(startSeq, endSeq) {
|
|
1301
|
+
const items = [];
|
|
1302
|
+
const actualStart = startSeq < this.headSequence ? this.headSequence : startSeq;
|
|
1303
|
+
const actualEnd = endSeq >= this.tailSequence ? this.tailSequence - 1n : endSeq;
|
|
1304
|
+
for (let seq = actualStart; seq <= actualEnd; seq++) {
|
|
1305
|
+
const item = this.read(seq);
|
|
1306
|
+
if (item !== void 0) {
|
|
1307
|
+
items.push(item);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
return items;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Read from sequence with limit.
|
|
1314
|
+
*/
|
|
1315
|
+
readFrom(startSeq, limit = 100) {
|
|
1316
|
+
const endSeq = startSeq + BigInt(limit) - 1n;
|
|
1317
|
+
return this.readRange(startSeq, endSeq);
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Get the oldest available sequence number.
|
|
1321
|
+
*/
|
|
1322
|
+
getHeadSequence() {
|
|
1323
|
+
return this.headSequence;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Get the next sequence number to be written.
|
|
1327
|
+
*/
|
|
1328
|
+
getTailSequence() {
|
|
1329
|
+
return this.tailSequence;
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Get the number of items currently in the buffer.
|
|
1333
|
+
*/
|
|
1334
|
+
size() {
|
|
1335
|
+
return Number(this.tailSequence - this.headSequence);
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Get the maximum capacity of the buffer.
|
|
1339
|
+
*/
|
|
1340
|
+
getCapacity() {
|
|
1341
|
+
return this._capacity;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Clear all items from the buffer.
|
|
1345
|
+
*/
|
|
1346
|
+
clear() {
|
|
1347
|
+
this.buffer = new Array(this._capacity);
|
|
1348
|
+
this.headSequence = 0n;
|
|
1349
|
+
this.tailSequence = 0n;
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Check if a sequence is available in the buffer.
|
|
1353
|
+
*/
|
|
1354
|
+
isAvailable(sequence) {
|
|
1355
|
+
return sequence >= this.headSequence && sequence < this.tailSequence;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Get remaining capacity before oldest entries are overwritten.
|
|
1359
|
+
*/
|
|
1360
|
+
remainingCapacity() {
|
|
1361
|
+
return this._capacity - this.size();
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
// src/EventJournal.ts
|
|
1366
|
+
var DEFAULT_EVENT_JOURNAL_CONFIG = {
|
|
1367
|
+
capacity: 1e4,
|
|
1368
|
+
ttlMs: 0,
|
|
1369
|
+
// Infinite
|
|
1370
|
+
persistent: true,
|
|
1371
|
+
includeMaps: [],
|
|
1372
|
+
excludeMaps: []
|
|
1373
|
+
};
|
|
1374
|
+
var EventJournalImpl = class {
|
|
1375
|
+
constructor(config = {}) {
|
|
1376
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
1377
|
+
this.config = { ...DEFAULT_EVENT_JOURNAL_CONFIG, ...config };
|
|
1378
|
+
this.buffer = new Ringbuffer(this.config.capacity);
|
|
1379
|
+
if (this.config.ttlMs > 0) {
|
|
1380
|
+
this.startTTLCleanup();
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Append event to journal.
|
|
1385
|
+
* Returns the event with assigned sequence number.
|
|
1386
|
+
* Returns event with sequence -1n if map is filtered out.
|
|
1387
|
+
*/
|
|
1388
|
+
append(eventData) {
|
|
1389
|
+
if (!this.shouldCapture(eventData.mapName)) {
|
|
1390
|
+
return { ...eventData, sequence: -1n };
|
|
1391
|
+
}
|
|
1392
|
+
const event = {
|
|
1393
|
+
...eventData,
|
|
1394
|
+
sequence: 0n
|
|
1395
|
+
// Will be set by buffer
|
|
1396
|
+
};
|
|
1397
|
+
const sequence = this.buffer.add(event);
|
|
1398
|
+
event.sequence = sequence;
|
|
1399
|
+
for (const listener of this.listeners) {
|
|
1400
|
+
try {
|
|
1401
|
+
listener(event);
|
|
1402
|
+
} catch (e) {
|
|
1403
|
+
console.error("EventJournal listener error:", e);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
return event;
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Read events from sequence with optional limit.
|
|
1410
|
+
*/
|
|
1411
|
+
readFrom(sequence, limit = 100) {
|
|
1412
|
+
return this.buffer.readFrom(sequence, limit);
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Read events in range (inclusive).
|
|
1416
|
+
*/
|
|
1417
|
+
readRange(startSeq, endSeq) {
|
|
1418
|
+
return this.buffer.readRange(startSeq, endSeq);
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Get latest sequence number.
|
|
1422
|
+
* Returns 0n if no events have been added.
|
|
1423
|
+
*/
|
|
1424
|
+
getLatestSequence() {
|
|
1425
|
+
const tail = this.buffer.getTailSequence();
|
|
1426
|
+
return tail > 0n ? tail - 1n : 0n;
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Get oldest available sequence number.
|
|
1430
|
+
*/
|
|
1431
|
+
getOldestSequence() {
|
|
1432
|
+
return this.buffer.getHeadSequence();
|
|
1433
|
+
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Subscribe to new events.
|
|
1436
|
+
* Optionally replay events from a specific sequence.
|
|
1437
|
+
*
|
|
1438
|
+
* @param listener Callback for each event
|
|
1439
|
+
* @param fromSequence Optional sequence to start replay from
|
|
1440
|
+
* @returns Unsubscribe function
|
|
1441
|
+
*/
|
|
1442
|
+
subscribe(listener, fromSequence) {
|
|
1443
|
+
if (fromSequence !== void 0) {
|
|
1444
|
+
const events = this.readFrom(fromSequence, this.config.capacity);
|
|
1445
|
+
for (const event of events) {
|
|
1446
|
+
try {
|
|
1447
|
+
listener(event);
|
|
1448
|
+
} catch (e) {
|
|
1449
|
+
console.error("EventJournal replay error:", e);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
this.listeners.add(listener);
|
|
1454
|
+
return () => this.listeners.delete(listener);
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Get capacity information.
|
|
1458
|
+
*/
|
|
1459
|
+
getCapacity() {
|
|
1460
|
+
return {
|
|
1461
|
+
used: this.buffer.size(),
|
|
1462
|
+
total: this.buffer.getCapacity()
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* Force compaction.
|
|
1467
|
+
* Note: The ringbuffer handles eviction automatically.
|
|
1468
|
+
* This method is provided for explicit cleanup of old events.
|
|
1469
|
+
*/
|
|
1470
|
+
async compact() {
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Check if a map should be captured.
|
|
1474
|
+
*/
|
|
1475
|
+
shouldCapture(mapName) {
|
|
1476
|
+
const { includeMaps, excludeMaps } = this.config;
|
|
1477
|
+
if (excludeMaps && excludeMaps.includes(mapName)) {
|
|
1478
|
+
return false;
|
|
1479
|
+
}
|
|
1480
|
+
if (includeMaps && includeMaps.length > 0) {
|
|
1481
|
+
return includeMaps.includes(mapName);
|
|
1482
|
+
}
|
|
1483
|
+
return true;
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Start TTL cleanup timer.
|
|
1487
|
+
*/
|
|
1488
|
+
startTTLCleanup() {
|
|
1489
|
+
const interval = Math.min(this.config.ttlMs, 6e4);
|
|
1490
|
+
this.ttlTimer = setInterval(() => {
|
|
1491
|
+
this.compact();
|
|
1492
|
+
}, interval);
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Dispose resources.
|
|
1496
|
+
*/
|
|
1497
|
+
dispose() {
|
|
1498
|
+
if (this.ttlTimer) {
|
|
1499
|
+
clearInterval(this.ttlTimer);
|
|
1500
|
+
this.ttlTimer = void 0;
|
|
1501
|
+
}
|
|
1502
|
+
this.listeners.clear();
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Get all current listeners count (for testing).
|
|
1506
|
+
*/
|
|
1507
|
+
getListenerCount() {
|
|
1508
|
+
return this.listeners.size;
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Get configuration (for testing).
|
|
1512
|
+
*/
|
|
1513
|
+
getConfig() {
|
|
1514
|
+
return { ...this.config };
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
// src/EntryProcessor.ts
|
|
1519
|
+
var import_zod = require("zod");
|
|
1520
|
+
var EntryProcessorDefSchema = import_zod.z.object({
|
|
1521
|
+
name: import_zod.z.string().min(1).max(100),
|
|
1522
|
+
code: import_zod.z.string().min(1).max(1e4),
|
|
1523
|
+
// Max 10KB code
|
|
1524
|
+
args: import_zod.z.unknown().optional()
|
|
1525
|
+
});
|
|
1526
|
+
var FORBIDDEN_PATTERNS = [
|
|
1527
|
+
/\beval\b/,
|
|
1528
|
+
/\bFunction\b/,
|
|
1529
|
+
/\bprocess\b/,
|
|
1530
|
+
/\bglobal\b/,
|
|
1531
|
+
/\brequire\b/,
|
|
1532
|
+
/\bimport\b/,
|
|
1533
|
+
/\bfetch\b/,
|
|
1534
|
+
/\bXMLHttpRequest\b/,
|
|
1535
|
+
/\bsetTimeout\b/,
|
|
1536
|
+
/\bsetInterval\b/,
|
|
1537
|
+
/\bsetImmediate\b/
|
|
1538
|
+
];
|
|
1539
|
+
function validateProcessorCode(code) {
|
|
1540
|
+
for (const pattern of FORBIDDEN_PATTERNS) {
|
|
1541
|
+
if (pattern.test(code)) {
|
|
1542
|
+
return {
|
|
1543
|
+
valid: false,
|
|
1544
|
+
error: `Forbidden pattern detected: ${pattern.source}`
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
return { valid: true };
|
|
1549
|
+
}
|
|
1550
|
+
var BuiltInProcessors = {
|
|
1551
|
+
/**
|
|
1552
|
+
* Increment numeric value by delta.
|
|
1553
|
+
* If value doesn't exist, starts from 0.
|
|
1554
|
+
*/
|
|
1555
|
+
INCREMENT: (delta = 1) => ({
|
|
1556
|
+
name: "builtin:increment",
|
|
1557
|
+
code: `
|
|
1558
|
+
const current = value ?? 0;
|
|
1559
|
+
const newValue = current + args;
|
|
1560
|
+
return { value: newValue, result: newValue };
|
|
1561
|
+
`,
|
|
1562
|
+
args: delta
|
|
1563
|
+
}),
|
|
1564
|
+
/**
|
|
1565
|
+
* Decrement numeric value by delta.
|
|
1566
|
+
* If value doesn't exist, starts from 0.
|
|
1567
|
+
*/
|
|
1568
|
+
DECREMENT: (delta = 1) => ({
|
|
1569
|
+
name: "builtin:decrement",
|
|
1570
|
+
code: `
|
|
1571
|
+
const current = value ?? 0;
|
|
1572
|
+
const newValue = current - args;
|
|
1573
|
+
return { value: newValue, result: newValue };
|
|
1574
|
+
`,
|
|
1575
|
+
args: delta
|
|
1576
|
+
}),
|
|
1577
|
+
/**
|
|
1578
|
+
* Decrement with floor (won't go below 0).
|
|
1579
|
+
* Returns both the new value and whether it was floored.
|
|
1580
|
+
*/
|
|
1581
|
+
DECREMENT_FLOOR: (delta = 1) => ({
|
|
1582
|
+
name: "builtin:decrement_floor",
|
|
1583
|
+
code: `
|
|
1584
|
+
const current = value ?? 0;
|
|
1585
|
+
const target = current - args;
|
|
1586
|
+
const newValue = Math.max(0, target);
|
|
1587
|
+
return {
|
|
1588
|
+
value: newValue,
|
|
1589
|
+
result: { newValue, wasFloored: target < 0 }
|
|
1590
|
+
};
|
|
1591
|
+
`,
|
|
1592
|
+
args: delta
|
|
1593
|
+
}),
|
|
1594
|
+
/**
|
|
1595
|
+
* Multiply numeric value by factor.
|
|
1596
|
+
* If value doesn't exist, starts from 1.
|
|
1597
|
+
*/
|
|
1598
|
+
MULTIPLY: (factor) => ({
|
|
1599
|
+
name: "builtin:multiply",
|
|
1600
|
+
code: `
|
|
1601
|
+
const current = value ?? 1;
|
|
1602
|
+
const newValue = current * args;
|
|
1603
|
+
return { value: newValue, result: newValue };
|
|
1604
|
+
`,
|
|
1605
|
+
args: factor
|
|
1606
|
+
}),
|
|
1607
|
+
/**
|
|
1608
|
+
* Set value only if key doesn't exist.
|
|
1609
|
+
* Returns true if value was set, false if key already existed.
|
|
1610
|
+
*/
|
|
1611
|
+
PUT_IF_ABSENT: (newValue) => ({
|
|
1612
|
+
name: "builtin:put_if_absent",
|
|
1613
|
+
code: `
|
|
1614
|
+
if (value !== undefined) {
|
|
1615
|
+
return { value, result: false };
|
|
1616
|
+
}
|
|
1617
|
+
return { value: args, result: true };
|
|
1618
|
+
`,
|
|
1619
|
+
args: newValue
|
|
1620
|
+
}),
|
|
1621
|
+
/**
|
|
1622
|
+
* Replace value only if key exists.
|
|
1623
|
+
* Returns the old value if replaced, undefined otherwise.
|
|
1624
|
+
*/
|
|
1625
|
+
REPLACE: (newValue) => ({
|
|
1626
|
+
name: "builtin:replace",
|
|
1627
|
+
code: `
|
|
1628
|
+
if (value === undefined) {
|
|
1629
|
+
return { value: undefined, result: undefined };
|
|
1630
|
+
}
|
|
1631
|
+
return { value: args, result: value };
|
|
1632
|
+
`,
|
|
1633
|
+
args: newValue
|
|
1634
|
+
}),
|
|
1635
|
+
/**
|
|
1636
|
+
* Replace value only if it matches expected value.
|
|
1637
|
+
* Returns true if replaced, false otherwise.
|
|
1638
|
+
*/
|
|
1639
|
+
REPLACE_IF_EQUALS: (expectedValue, newValue) => ({
|
|
1640
|
+
name: "builtin:replace_if_equals",
|
|
1641
|
+
code: `
|
|
1642
|
+
if (JSON.stringify(value) === JSON.stringify(args.expected)) {
|
|
1643
|
+
return { value: args.newValue, result: true };
|
|
1644
|
+
}
|
|
1645
|
+
return { value, result: false };
|
|
1646
|
+
`,
|
|
1647
|
+
args: { expected: expectedValue, newValue }
|
|
1648
|
+
}),
|
|
1649
|
+
/**
|
|
1650
|
+
* Delete entry only if value matches.
|
|
1651
|
+
* Returns true if deleted, false otherwise.
|
|
1652
|
+
*/
|
|
1653
|
+
DELETE_IF_EQUALS: (expectedValue) => ({
|
|
1654
|
+
name: "builtin:delete_if_equals",
|
|
1655
|
+
code: `
|
|
1656
|
+
if (JSON.stringify(value) === JSON.stringify(args)) {
|
|
1657
|
+
return { value: undefined, result: true };
|
|
1658
|
+
}
|
|
1659
|
+
return { value, result: false };
|
|
1660
|
+
`,
|
|
1661
|
+
args: expectedValue
|
|
1662
|
+
}),
|
|
1663
|
+
/**
|
|
1664
|
+
* Append item to array.
|
|
1665
|
+
* Creates array if it doesn't exist.
|
|
1666
|
+
* Returns new array length.
|
|
1667
|
+
*/
|
|
1668
|
+
ARRAY_PUSH: (item) => ({
|
|
1669
|
+
name: "builtin:array_push",
|
|
1670
|
+
code: `
|
|
1671
|
+
const arr = value ?? [];
|
|
1672
|
+
arr.push(args);
|
|
1673
|
+
return { value: arr, result: arr.length };
|
|
1674
|
+
`,
|
|
1675
|
+
args: item
|
|
1676
|
+
}),
|
|
1677
|
+
/**
|
|
1678
|
+
* Remove last item from array.
|
|
1679
|
+
* Returns the removed item or undefined.
|
|
1680
|
+
*/
|
|
1681
|
+
ARRAY_POP: () => ({
|
|
1682
|
+
name: "builtin:array_pop",
|
|
1683
|
+
code: `
|
|
1684
|
+
if (!value || value.length === 0) {
|
|
1685
|
+
return { value: value ?? [], result: undefined };
|
|
1686
|
+
}
|
|
1687
|
+
const removed = value.pop();
|
|
1688
|
+
return { value, result: removed };
|
|
1689
|
+
`
|
|
1690
|
+
}),
|
|
1691
|
+
/**
|
|
1692
|
+
* Remove item from array by value (first occurrence).
|
|
1693
|
+
* Returns true if item was found and removed.
|
|
1694
|
+
*/
|
|
1695
|
+
ARRAY_REMOVE: (item) => ({
|
|
1696
|
+
name: "builtin:array_remove",
|
|
1697
|
+
code: `
|
|
1698
|
+
if (!value) {
|
|
1699
|
+
return { value: [], result: false };
|
|
1700
|
+
}
|
|
1701
|
+
const idx = value.findIndex(v => JSON.stringify(v) === JSON.stringify(args));
|
|
1702
|
+
if (idx === -1) {
|
|
1703
|
+
return { value, result: false };
|
|
1704
|
+
}
|
|
1705
|
+
value.splice(idx, 1);
|
|
1706
|
+
return { value, result: true };
|
|
1707
|
+
`,
|
|
1708
|
+
args: item
|
|
1709
|
+
}),
|
|
1710
|
+
/**
|
|
1711
|
+
* Update nested property using dot notation path.
|
|
1712
|
+
* Creates intermediate objects if they don't exist.
|
|
1713
|
+
*/
|
|
1714
|
+
SET_PROPERTY: (path, propValue) => ({
|
|
1715
|
+
name: "builtin:set_property",
|
|
1716
|
+
code: `
|
|
1717
|
+
const obj = value ?? {};
|
|
1718
|
+
const parts = args.path.split('.');
|
|
1719
|
+
let current = obj;
|
|
1720
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
1721
|
+
current[parts[i]] = current[parts[i]] ?? {};
|
|
1722
|
+
current = current[parts[i]];
|
|
1723
|
+
}
|
|
1724
|
+
current[parts[parts.length - 1]] = args.value;
|
|
1725
|
+
return { value: obj, result: obj };
|
|
1726
|
+
`,
|
|
1727
|
+
args: { path, value: propValue }
|
|
1728
|
+
}),
|
|
1729
|
+
/**
|
|
1730
|
+
* Delete nested property using dot notation path.
|
|
1731
|
+
* Returns the deleted value or undefined.
|
|
1732
|
+
*/
|
|
1733
|
+
DELETE_PROPERTY: (path) => ({
|
|
1734
|
+
name: "builtin:delete_property",
|
|
1735
|
+
code: `
|
|
1736
|
+
if (!value) {
|
|
1737
|
+
return { value, result: undefined };
|
|
1738
|
+
}
|
|
1739
|
+
const parts = args.split('.');
|
|
1740
|
+
let current = value;
|
|
1741
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
1742
|
+
if (!current[parts[i]]) {
|
|
1743
|
+
return { value, result: undefined };
|
|
1744
|
+
}
|
|
1745
|
+
current = current[parts[i]];
|
|
1746
|
+
}
|
|
1747
|
+
const lastKey = parts[parts.length - 1];
|
|
1748
|
+
const deleted = current[lastKey];
|
|
1749
|
+
delete current[lastKey];
|
|
1750
|
+
return { value, result: deleted };
|
|
1751
|
+
`,
|
|
1752
|
+
args: path
|
|
1753
|
+
}),
|
|
1754
|
+
/**
|
|
1755
|
+
* Get current value without modifying it.
|
|
1756
|
+
* Useful for conditional reads.
|
|
1757
|
+
*/
|
|
1758
|
+
GET: () => ({
|
|
1759
|
+
name: "builtin:get",
|
|
1760
|
+
code: `
|
|
1761
|
+
return { value, result: value };
|
|
1762
|
+
`
|
|
1763
|
+
}),
|
|
1764
|
+
/**
|
|
1765
|
+
* Conditional update based on version/timestamp.
|
|
1766
|
+
* Only updates if current version matches expected.
|
|
1767
|
+
* Useful for optimistic locking.
|
|
1768
|
+
*/
|
|
1769
|
+
CONDITIONAL_UPDATE: (expectedVersion, newData) => ({
|
|
1770
|
+
name: "builtin:conditional_update",
|
|
1771
|
+
code: `
|
|
1772
|
+
if (!value || value.version !== args.expectedVersion) {
|
|
1773
|
+
return {
|
|
1774
|
+
value,
|
|
1775
|
+
result: { updated: false, conflict: true }
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
const updated = {
|
|
1779
|
+
...value,
|
|
1780
|
+
...args.newData,
|
|
1781
|
+
version: (value.version ?? 0) + 1,
|
|
1782
|
+
};
|
|
1783
|
+
return {
|
|
1784
|
+
value: updated,
|
|
1785
|
+
result: { updated: true, conflict: false }
|
|
1786
|
+
};
|
|
1787
|
+
`,
|
|
1788
|
+
args: { expectedVersion, newData }
|
|
1789
|
+
}),
|
|
1790
|
+
/**
|
|
1791
|
+
* Merge object properties into existing value.
|
|
1792
|
+
* Shallow merge only.
|
|
1793
|
+
*/
|
|
1794
|
+
MERGE: (properties) => ({
|
|
1795
|
+
name: "builtin:merge",
|
|
1796
|
+
code: `
|
|
1797
|
+
const merged = { ...(value ?? {}), ...args };
|
|
1798
|
+
return { value: merged, result: merged };
|
|
1799
|
+
`,
|
|
1800
|
+
args: properties
|
|
1801
|
+
})
|
|
1802
|
+
};
|
|
1803
|
+
var DEFAULT_PROCESSOR_RATE_LIMITS = {
|
|
1804
|
+
maxExecutionsPerSecond: 100,
|
|
1805
|
+
maxCodeSizeBytes: 10240,
|
|
1806
|
+
// 10KB
|
|
1807
|
+
maxArgsSizeBytes: 1048576
|
|
1808
|
+
// 1MB
|
|
1809
|
+
};
|
|
1810
|
+
|
|
1811
|
+
// src/ConflictResolver.ts
|
|
1812
|
+
var import_zod2 = require("zod");
|
|
1813
|
+
var ConflictResolverDefSchema = import_zod2.z.object({
|
|
1814
|
+
name: import_zod2.z.string().min(1).max(100),
|
|
1815
|
+
code: import_zod2.z.string().max(5e4).optional(),
|
|
1816
|
+
priority: import_zod2.z.number().int().min(0).max(100).default(50),
|
|
1817
|
+
keyPattern: import_zod2.z.string().optional()
|
|
1818
|
+
});
|
|
1819
|
+
var RESOLVER_FORBIDDEN_PATTERNS = [
|
|
1820
|
+
/\beval\b/,
|
|
1821
|
+
/\bFunction\b/,
|
|
1822
|
+
/\bprocess\b/,
|
|
1823
|
+
/\bglobal\b/,
|
|
1824
|
+
/\brequire\b/,
|
|
1825
|
+
/\bimport\b/,
|
|
1826
|
+
/\bfetch\b/,
|
|
1827
|
+
/\bXMLHttpRequest\b/,
|
|
1828
|
+
/\bsetTimeout\b/,
|
|
1829
|
+
/\bsetInterval\b/,
|
|
1830
|
+
/\bsetImmediate\b/
|
|
1831
|
+
];
|
|
1832
|
+
function validateResolverCode(code) {
|
|
1833
|
+
for (const pattern of RESOLVER_FORBIDDEN_PATTERNS) {
|
|
1834
|
+
if (pattern.test(code)) {
|
|
1835
|
+
return {
|
|
1836
|
+
valid: false,
|
|
1837
|
+
error: `Forbidden pattern detected: ${pattern.source}`
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
return { valid: true };
|
|
1842
|
+
}
|
|
1843
|
+
var DEFAULT_RESOLVER_RATE_LIMITS = {
|
|
1844
|
+
maxResolversPerClient: 50,
|
|
1845
|
+
maxCodeSizeBytes: 5e4
|
|
1846
|
+
// 50KB
|
|
1847
|
+
};
|
|
1848
|
+
function compareHLCTimestamps(a, b) {
|
|
1849
|
+
return HLC.compare(a, b);
|
|
1850
|
+
}
|
|
1851
|
+
function deepMerge(target, source) {
|
|
1852
|
+
const result = { ...target };
|
|
1853
|
+
for (const key of Object.keys(source)) {
|
|
1854
|
+
const sourceVal = source[key];
|
|
1855
|
+
const targetVal = target[key];
|
|
1856
|
+
if (typeof sourceVal === "object" && sourceVal !== null && typeof targetVal === "object" && targetVal !== null && !Array.isArray(sourceVal)) {
|
|
1857
|
+
result[key] = deepMerge(
|
|
1858
|
+
targetVal,
|
|
1859
|
+
sourceVal
|
|
1860
|
+
);
|
|
1861
|
+
} else {
|
|
1862
|
+
result[key] = sourceVal;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return result;
|
|
1866
|
+
}
|
|
1867
|
+
var BuiltInResolvers = {
|
|
1868
|
+
/**
|
|
1869
|
+
* Standard Last-Write-Wins - accept if remote timestamp is newer.
|
|
1870
|
+
*/
|
|
1871
|
+
LWW: () => ({
|
|
1872
|
+
name: "builtin:lww",
|
|
1873
|
+
fn: (ctx) => {
|
|
1874
|
+
if (!ctx.localTimestamp) {
|
|
1875
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1876
|
+
}
|
|
1877
|
+
const cmp = compareHLCTimestamps(ctx.remoteTimestamp, ctx.localTimestamp);
|
|
1878
|
+
if (cmp > 0) {
|
|
1879
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1880
|
+
}
|
|
1881
|
+
return { action: "local" };
|
|
1882
|
+
},
|
|
1883
|
+
priority: 0
|
|
1884
|
+
// Lowest priority - fallback
|
|
1885
|
+
}),
|
|
1886
|
+
/**
|
|
1887
|
+
* First-Write-Wins - reject if local value exists.
|
|
1888
|
+
* Useful for booking systems, unique constraints.
|
|
1889
|
+
*/
|
|
1890
|
+
FIRST_WRITE_WINS: () => ({
|
|
1891
|
+
name: "builtin:first_write_wins",
|
|
1892
|
+
fn: (ctx) => {
|
|
1893
|
+
if (ctx.localValue !== void 0) {
|
|
1894
|
+
return { action: "reject", reason: "Entry already exists" };
|
|
1895
|
+
}
|
|
1896
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1897
|
+
},
|
|
1898
|
+
priority: 100
|
|
1899
|
+
}),
|
|
1900
|
+
/**
|
|
1901
|
+
* Numeric minimum - keep lowest value.
|
|
1902
|
+
* Useful for auction systems (lowest bid wins).
|
|
1903
|
+
*/
|
|
1904
|
+
NUMERIC_MIN: () => ({
|
|
1905
|
+
name: "builtin:numeric_min",
|
|
1906
|
+
fn: (ctx) => {
|
|
1907
|
+
const local = ctx.localValue ?? Infinity;
|
|
1908
|
+
const remote = ctx.remoteValue;
|
|
1909
|
+
return { action: "merge", value: Math.min(local, remote) };
|
|
1910
|
+
},
|
|
1911
|
+
priority: 50
|
|
1912
|
+
}),
|
|
1913
|
+
/**
|
|
1914
|
+
* Numeric maximum - keep highest value.
|
|
1915
|
+
* Useful for high score tracking.
|
|
1916
|
+
*/
|
|
1917
|
+
NUMERIC_MAX: () => ({
|
|
1918
|
+
name: "builtin:numeric_max",
|
|
1919
|
+
fn: (ctx) => {
|
|
1920
|
+
const local = ctx.localValue ?? -Infinity;
|
|
1921
|
+
const remote = ctx.remoteValue;
|
|
1922
|
+
return { action: "merge", value: Math.max(local, remote) };
|
|
1923
|
+
},
|
|
1924
|
+
priority: 50
|
|
1925
|
+
}),
|
|
1926
|
+
/**
|
|
1927
|
+
* Non-negative - reject if value would be negative.
|
|
1928
|
+
* Useful for inventory systems.
|
|
1929
|
+
*/
|
|
1930
|
+
NON_NEGATIVE: () => ({
|
|
1931
|
+
name: "builtin:non_negative",
|
|
1932
|
+
fn: (ctx) => {
|
|
1933
|
+
if (typeof ctx.remoteValue !== "number" || ctx.remoteValue < 0) {
|
|
1934
|
+
return { action: "reject", reason: "Value cannot be negative" };
|
|
1935
|
+
}
|
|
1936
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1937
|
+
},
|
|
1938
|
+
priority: 90
|
|
1939
|
+
}),
|
|
1940
|
+
/**
|
|
1941
|
+
* Array union - merge arrays by taking union of elements.
|
|
1942
|
+
* Useful for tags, categories.
|
|
1943
|
+
*/
|
|
1944
|
+
ARRAY_UNION: () => ({
|
|
1945
|
+
name: "builtin:array_union",
|
|
1946
|
+
fn: (ctx) => {
|
|
1947
|
+
const local = ctx.localValue ?? [];
|
|
1948
|
+
const remote = ctx.remoteValue ?? [];
|
|
1949
|
+
const merged = [.../* @__PURE__ */ new Set([...local, ...remote])];
|
|
1950
|
+
return { action: "merge", value: merged };
|
|
1951
|
+
},
|
|
1952
|
+
priority: 50
|
|
1953
|
+
}),
|
|
1954
|
+
/**
|
|
1955
|
+
* Deep merge - recursively merge objects.
|
|
1956
|
+
* Remote values take precedence at leaf level.
|
|
1957
|
+
*/
|
|
1958
|
+
DEEP_MERGE: () => ({
|
|
1959
|
+
name: "builtin:deep_merge",
|
|
1960
|
+
fn: (ctx) => {
|
|
1961
|
+
const local = ctx.localValue ?? {};
|
|
1962
|
+
const remote = ctx.remoteValue;
|
|
1963
|
+
const merged = deepMerge(local, remote);
|
|
1964
|
+
return { action: "merge", value: merged };
|
|
1965
|
+
},
|
|
1966
|
+
priority: 50
|
|
1967
|
+
}),
|
|
1968
|
+
/**
|
|
1969
|
+
* Server-only - reject all client writes.
|
|
1970
|
+
* Useful for server-controlled state.
|
|
1971
|
+
*/
|
|
1972
|
+
SERVER_ONLY: () => ({
|
|
1973
|
+
name: "builtin:server_only",
|
|
1974
|
+
fn: (ctx) => {
|
|
1975
|
+
if (ctx.auth?.roles?.includes("server") || ctx.remoteNodeId.startsWith("server:")) {
|
|
1976
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1977
|
+
}
|
|
1978
|
+
return { action: "reject", reason: "Only server can write to this entry" };
|
|
1979
|
+
},
|
|
1980
|
+
priority: 100
|
|
1981
|
+
}),
|
|
1982
|
+
/**
|
|
1983
|
+
* Owner-only - only the original creator can modify.
|
|
1984
|
+
* Requires value to have an `ownerId` property.
|
|
1985
|
+
*/
|
|
1986
|
+
OWNER_ONLY: () => ({
|
|
1987
|
+
name: "builtin:owner_only",
|
|
1988
|
+
fn: (ctx) => {
|
|
1989
|
+
if (!ctx.localValue) {
|
|
1990
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1991
|
+
}
|
|
1992
|
+
const ownerId = ctx.localValue.ownerId;
|
|
1993
|
+
if (ownerId && ctx.auth?.userId !== ownerId) {
|
|
1994
|
+
return { action: "reject", reason: "Only owner can modify this entry" };
|
|
1995
|
+
}
|
|
1996
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
1997
|
+
},
|
|
1998
|
+
priority: 95
|
|
1999
|
+
}),
|
|
2000
|
+
/**
|
|
2001
|
+
* Immutable - reject any modifications after initial write.
|
|
2002
|
+
*/
|
|
2003
|
+
IMMUTABLE: () => ({
|
|
2004
|
+
name: "builtin:immutable",
|
|
2005
|
+
fn: (ctx) => {
|
|
2006
|
+
if (ctx.localValue !== void 0) {
|
|
2007
|
+
return { action: "reject", reason: "Entry is immutable" };
|
|
2008
|
+
}
|
|
2009
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
2010
|
+
},
|
|
2011
|
+
priority: 100
|
|
2012
|
+
}),
|
|
2013
|
+
/**
|
|
2014
|
+
* Version check - only accept if version increments by 1.
|
|
2015
|
+
* Useful for optimistic locking.
|
|
2016
|
+
*/
|
|
2017
|
+
VERSION_INCREMENT: () => ({
|
|
2018
|
+
name: "builtin:version_increment",
|
|
2019
|
+
fn: (ctx) => {
|
|
2020
|
+
const localVersion = ctx.localValue?.version ?? 0;
|
|
2021
|
+
const remoteVersion = ctx.remoteValue?.version ?? 0;
|
|
2022
|
+
if (remoteVersion !== localVersion + 1) {
|
|
2023
|
+
return {
|
|
2024
|
+
action: "reject",
|
|
2025
|
+
reason: `Version conflict: expected ${localVersion + 1}, got ${remoteVersion}`
|
|
2026
|
+
};
|
|
2027
|
+
}
|
|
2028
|
+
return { action: "accept", value: ctx.remoteValue };
|
|
2029
|
+
},
|
|
2030
|
+
priority: 90
|
|
2031
|
+
})
|
|
2032
|
+
};
|
|
2033
|
+
|
|
1063
2034
|
// src/predicate.ts
|
|
1064
2035
|
var Predicates = class {
|
|
1065
2036
|
static equal(attribute, value) {
|
|
@@ -1147,31 +2118,31 @@ function evaluatePredicate(predicate, data) {
|
|
|
1147
2118
|
}
|
|
1148
2119
|
|
|
1149
2120
|
// src/schemas.ts
|
|
1150
|
-
var
|
|
1151
|
-
var WriteConcernSchema =
|
|
2121
|
+
var import_zod3 = require("zod");
|
|
2122
|
+
var WriteConcernSchema = import_zod3.z.enum([
|
|
1152
2123
|
"FIRE_AND_FORGET",
|
|
1153
2124
|
"MEMORY",
|
|
1154
2125
|
"APPLIED",
|
|
1155
2126
|
"REPLICATED",
|
|
1156
2127
|
"PERSISTED"
|
|
1157
2128
|
]);
|
|
1158
|
-
var TimestampSchema =
|
|
1159
|
-
millis:
|
|
1160
|
-
counter:
|
|
1161
|
-
nodeId:
|
|
2129
|
+
var TimestampSchema = import_zod3.z.object({
|
|
2130
|
+
millis: import_zod3.z.union([import_zod3.z.number(), import_zod3.z.bigint()]).transform(Number),
|
|
2131
|
+
counter: import_zod3.z.union([import_zod3.z.number(), import_zod3.z.bigint()]).transform(Number),
|
|
2132
|
+
nodeId: import_zod3.z.string()
|
|
1162
2133
|
});
|
|
1163
|
-
var LWWRecordSchema =
|
|
1164
|
-
value:
|
|
2134
|
+
var LWWRecordSchema = import_zod3.z.object({
|
|
2135
|
+
value: import_zod3.z.any().nullable(),
|
|
1165
2136
|
timestamp: TimestampSchema,
|
|
1166
|
-
ttlMs:
|
|
2137
|
+
ttlMs: import_zod3.z.number().optional()
|
|
1167
2138
|
});
|
|
1168
|
-
var ORMapRecordSchema =
|
|
1169
|
-
value:
|
|
2139
|
+
var ORMapRecordSchema = import_zod3.z.object({
|
|
2140
|
+
value: import_zod3.z.any(),
|
|
1170
2141
|
timestamp: TimestampSchema,
|
|
1171
|
-
tag:
|
|
1172
|
-
ttlMs:
|
|
2142
|
+
tag: import_zod3.z.string(),
|
|
2143
|
+
ttlMs: import_zod3.z.number().optional()
|
|
1173
2144
|
});
|
|
1174
|
-
var PredicateOpSchema =
|
|
2145
|
+
var PredicateOpSchema = import_zod3.z.enum([
|
|
1175
2146
|
"eq",
|
|
1176
2147
|
"neq",
|
|
1177
2148
|
"gt",
|
|
@@ -1184,272 +2155,438 @@ var PredicateOpSchema = import_zod.z.enum([
|
|
|
1184
2155
|
"or",
|
|
1185
2156
|
"not"
|
|
1186
2157
|
]);
|
|
1187
|
-
var PredicateNodeSchema =
|
|
2158
|
+
var PredicateNodeSchema = import_zod3.z.lazy(() => import_zod3.z.object({
|
|
1188
2159
|
op: PredicateOpSchema,
|
|
1189
|
-
attribute:
|
|
1190
|
-
value:
|
|
1191
|
-
children:
|
|
2160
|
+
attribute: import_zod3.z.string().optional(),
|
|
2161
|
+
value: import_zod3.z.any().optional(),
|
|
2162
|
+
children: import_zod3.z.array(PredicateNodeSchema).optional()
|
|
1192
2163
|
}));
|
|
1193
|
-
var QuerySchema =
|
|
1194
|
-
where:
|
|
2164
|
+
var QuerySchema = import_zod3.z.object({
|
|
2165
|
+
where: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.any()).optional(),
|
|
1195
2166
|
predicate: PredicateNodeSchema.optional(),
|
|
1196
|
-
sort:
|
|
1197
|
-
limit:
|
|
1198
|
-
offset:
|
|
1199
|
-
});
|
|
1200
|
-
var ClientOpSchema =
|
|
1201
|
-
id:
|
|
1202
|
-
mapName:
|
|
1203
|
-
key:
|
|
2167
|
+
sort: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.enum(["asc", "desc"])).optional(),
|
|
2168
|
+
limit: import_zod3.z.number().optional(),
|
|
2169
|
+
offset: import_zod3.z.number().optional()
|
|
2170
|
+
});
|
|
2171
|
+
var ClientOpSchema = import_zod3.z.object({
|
|
2172
|
+
id: import_zod3.z.string().optional(),
|
|
2173
|
+
mapName: import_zod3.z.string(),
|
|
2174
|
+
key: import_zod3.z.string(),
|
|
1204
2175
|
// Permissive opType to match ServerCoordinator behavior logic
|
|
1205
2176
|
// It can be 'REMOVE', 'OR_ADD', 'OR_REMOVE' or undefined/other (implies PUT/LWW)
|
|
1206
|
-
opType:
|
|
2177
|
+
opType: import_zod3.z.string().optional(),
|
|
1207
2178
|
record: LWWRecordSchema.nullable().optional(),
|
|
1208
2179
|
orRecord: ORMapRecordSchema.nullable().optional(),
|
|
1209
|
-
orTag:
|
|
2180
|
+
orTag: import_zod3.z.string().nullable().optional(),
|
|
1210
2181
|
// Write Concern fields (Phase 5.01)
|
|
1211
2182
|
writeConcern: WriteConcernSchema.optional(),
|
|
1212
|
-
timeout:
|
|
2183
|
+
timeout: import_zod3.z.number().optional()
|
|
1213
2184
|
});
|
|
1214
|
-
var AuthMessageSchema =
|
|
1215
|
-
type:
|
|
1216
|
-
token:
|
|
2185
|
+
var AuthMessageSchema = import_zod3.z.object({
|
|
2186
|
+
type: import_zod3.z.literal("AUTH"),
|
|
2187
|
+
token: import_zod3.z.string()
|
|
1217
2188
|
});
|
|
1218
|
-
var QuerySubMessageSchema =
|
|
1219
|
-
type:
|
|
1220
|
-
payload:
|
|
1221
|
-
queryId:
|
|
1222
|
-
mapName:
|
|
2189
|
+
var QuerySubMessageSchema = import_zod3.z.object({
|
|
2190
|
+
type: import_zod3.z.literal("QUERY_SUB"),
|
|
2191
|
+
payload: import_zod3.z.object({
|
|
2192
|
+
queryId: import_zod3.z.string(),
|
|
2193
|
+
mapName: import_zod3.z.string(),
|
|
1223
2194
|
query: QuerySchema
|
|
1224
2195
|
})
|
|
1225
2196
|
});
|
|
1226
|
-
var QueryUnsubMessageSchema =
|
|
1227
|
-
type:
|
|
1228
|
-
payload:
|
|
1229
|
-
queryId:
|
|
2197
|
+
var QueryUnsubMessageSchema = import_zod3.z.object({
|
|
2198
|
+
type: import_zod3.z.literal("QUERY_UNSUB"),
|
|
2199
|
+
payload: import_zod3.z.object({
|
|
2200
|
+
queryId: import_zod3.z.string()
|
|
1230
2201
|
})
|
|
1231
2202
|
});
|
|
1232
|
-
var ClientOpMessageSchema =
|
|
1233
|
-
type:
|
|
2203
|
+
var ClientOpMessageSchema = import_zod3.z.object({
|
|
2204
|
+
type: import_zod3.z.literal("CLIENT_OP"),
|
|
1234
2205
|
payload: ClientOpSchema
|
|
1235
2206
|
});
|
|
1236
|
-
var OpBatchMessageSchema =
|
|
1237
|
-
type:
|
|
1238
|
-
payload:
|
|
1239
|
-
ops:
|
|
2207
|
+
var OpBatchMessageSchema = import_zod3.z.object({
|
|
2208
|
+
type: import_zod3.z.literal("OP_BATCH"),
|
|
2209
|
+
payload: import_zod3.z.object({
|
|
2210
|
+
ops: import_zod3.z.array(ClientOpSchema),
|
|
1240
2211
|
// Batch-level Write Concern (can be overridden per-op)
|
|
1241
2212
|
writeConcern: WriteConcernSchema.optional(),
|
|
1242
|
-
timeout:
|
|
2213
|
+
timeout: import_zod3.z.number().optional()
|
|
1243
2214
|
})
|
|
1244
2215
|
});
|
|
1245
|
-
var SyncInitMessageSchema =
|
|
1246
|
-
type:
|
|
1247
|
-
mapName:
|
|
1248
|
-
lastSyncTimestamp:
|
|
2216
|
+
var SyncInitMessageSchema = import_zod3.z.object({
|
|
2217
|
+
type: import_zod3.z.literal("SYNC_INIT"),
|
|
2218
|
+
mapName: import_zod3.z.string(),
|
|
2219
|
+
lastSyncTimestamp: import_zod3.z.number().optional()
|
|
1249
2220
|
});
|
|
1250
|
-
var SyncRespRootMessageSchema =
|
|
1251
|
-
type:
|
|
1252
|
-
payload:
|
|
1253
|
-
mapName:
|
|
1254
|
-
rootHash:
|
|
2221
|
+
var SyncRespRootMessageSchema = import_zod3.z.object({
|
|
2222
|
+
type: import_zod3.z.literal("SYNC_RESP_ROOT"),
|
|
2223
|
+
payload: import_zod3.z.object({
|
|
2224
|
+
mapName: import_zod3.z.string(),
|
|
2225
|
+
rootHash: import_zod3.z.number(),
|
|
1255
2226
|
timestamp: TimestampSchema
|
|
1256
2227
|
})
|
|
1257
2228
|
});
|
|
1258
|
-
var SyncRespBucketsMessageSchema =
|
|
1259
|
-
type:
|
|
1260
|
-
payload:
|
|
1261
|
-
mapName:
|
|
1262
|
-
path:
|
|
1263
|
-
buckets:
|
|
2229
|
+
var SyncRespBucketsMessageSchema = import_zod3.z.object({
|
|
2230
|
+
type: import_zod3.z.literal("SYNC_RESP_BUCKETS"),
|
|
2231
|
+
payload: import_zod3.z.object({
|
|
2232
|
+
mapName: import_zod3.z.string(),
|
|
2233
|
+
path: import_zod3.z.string(),
|
|
2234
|
+
buckets: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())
|
|
1264
2235
|
})
|
|
1265
2236
|
});
|
|
1266
|
-
var SyncRespLeafMessageSchema =
|
|
1267
|
-
type:
|
|
1268
|
-
payload:
|
|
1269
|
-
mapName:
|
|
1270
|
-
path:
|
|
1271
|
-
records:
|
|
1272
|
-
key:
|
|
2237
|
+
var SyncRespLeafMessageSchema = import_zod3.z.object({
|
|
2238
|
+
type: import_zod3.z.literal("SYNC_RESP_LEAF"),
|
|
2239
|
+
payload: import_zod3.z.object({
|
|
2240
|
+
mapName: import_zod3.z.string(),
|
|
2241
|
+
path: import_zod3.z.string(),
|
|
2242
|
+
records: import_zod3.z.array(import_zod3.z.object({
|
|
2243
|
+
key: import_zod3.z.string(),
|
|
1273
2244
|
record: LWWRecordSchema
|
|
1274
2245
|
}))
|
|
1275
2246
|
})
|
|
1276
2247
|
});
|
|
1277
|
-
var MerkleReqBucketMessageSchema =
|
|
1278
|
-
type:
|
|
1279
|
-
payload:
|
|
1280
|
-
mapName:
|
|
1281
|
-
path:
|
|
2248
|
+
var MerkleReqBucketMessageSchema = import_zod3.z.object({
|
|
2249
|
+
type: import_zod3.z.literal("MERKLE_REQ_BUCKET"),
|
|
2250
|
+
payload: import_zod3.z.object({
|
|
2251
|
+
mapName: import_zod3.z.string(),
|
|
2252
|
+
path: import_zod3.z.string()
|
|
1282
2253
|
})
|
|
1283
2254
|
});
|
|
1284
|
-
var LockRequestSchema =
|
|
1285
|
-
type:
|
|
1286
|
-
payload:
|
|
1287
|
-
requestId:
|
|
1288
|
-
name:
|
|
1289
|
-
ttl:
|
|
2255
|
+
var LockRequestSchema = import_zod3.z.object({
|
|
2256
|
+
type: import_zod3.z.literal("LOCK_REQUEST"),
|
|
2257
|
+
payload: import_zod3.z.object({
|
|
2258
|
+
requestId: import_zod3.z.string(),
|
|
2259
|
+
name: import_zod3.z.string(),
|
|
2260
|
+
ttl: import_zod3.z.number().optional()
|
|
1290
2261
|
})
|
|
1291
2262
|
});
|
|
1292
|
-
var LockReleaseSchema =
|
|
1293
|
-
type:
|
|
1294
|
-
payload:
|
|
1295
|
-
requestId:
|
|
1296
|
-
name:
|
|
1297
|
-
fencingToken:
|
|
2263
|
+
var LockReleaseSchema = import_zod3.z.object({
|
|
2264
|
+
type: import_zod3.z.literal("LOCK_RELEASE"),
|
|
2265
|
+
payload: import_zod3.z.object({
|
|
2266
|
+
requestId: import_zod3.z.string().optional(),
|
|
2267
|
+
name: import_zod3.z.string(),
|
|
2268
|
+
fencingToken: import_zod3.z.number()
|
|
1298
2269
|
})
|
|
1299
2270
|
});
|
|
1300
|
-
var TopicSubSchema =
|
|
1301
|
-
type:
|
|
1302
|
-
payload:
|
|
1303
|
-
topic:
|
|
2271
|
+
var TopicSubSchema = import_zod3.z.object({
|
|
2272
|
+
type: import_zod3.z.literal("TOPIC_SUB"),
|
|
2273
|
+
payload: import_zod3.z.object({
|
|
2274
|
+
topic: import_zod3.z.string()
|
|
1304
2275
|
})
|
|
1305
2276
|
});
|
|
1306
|
-
var TopicUnsubSchema =
|
|
1307
|
-
type:
|
|
1308
|
-
payload:
|
|
1309
|
-
topic:
|
|
2277
|
+
var TopicUnsubSchema = import_zod3.z.object({
|
|
2278
|
+
type: import_zod3.z.literal("TOPIC_UNSUB"),
|
|
2279
|
+
payload: import_zod3.z.object({
|
|
2280
|
+
topic: import_zod3.z.string()
|
|
1310
2281
|
})
|
|
1311
2282
|
});
|
|
1312
|
-
var TopicPubSchema =
|
|
1313
|
-
type:
|
|
1314
|
-
payload:
|
|
1315
|
-
topic:
|
|
1316
|
-
data:
|
|
2283
|
+
var TopicPubSchema = import_zod3.z.object({
|
|
2284
|
+
type: import_zod3.z.literal("TOPIC_PUB"),
|
|
2285
|
+
payload: import_zod3.z.object({
|
|
2286
|
+
topic: import_zod3.z.string(),
|
|
2287
|
+
data: import_zod3.z.any()
|
|
1317
2288
|
})
|
|
1318
2289
|
});
|
|
1319
|
-
var TopicMessageEventSchema =
|
|
1320
|
-
type:
|
|
1321
|
-
payload:
|
|
1322
|
-
topic:
|
|
1323
|
-
data:
|
|
1324
|
-
publisherId:
|
|
1325
|
-
timestamp:
|
|
2290
|
+
var TopicMessageEventSchema = import_zod3.z.object({
|
|
2291
|
+
type: import_zod3.z.literal("TOPIC_MESSAGE"),
|
|
2292
|
+
payload: import_zod3.z.object({
|
|
2293
|
+
topic: import_zod3.z.string(),
|
|
2294
|
+
data: import_zod3.z.any(),
|
|
2295
|
+
publisherId: import_zod3.z.string().optional(),
|
|
2296
|
+
timestamp: import_zod3.z.number()
|
|
1326
2297
|
})
|
|
1327
2298
|
});
|
|
1328
|
-
var
|
|
1329
|
-
|
|
1330
|
-
|
|
2299
|
+
var PNCounterStateObjectSchema = import_zod3.z.object({
|
|
2300
|
+
p: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number()),
|
|
2301
|
+
// positive counts per node
|
|
2302
|
+
n: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())
|
|
2303
|
+
// negative counts per node
|
|
2304
|
+
});
|
|
2305
|
+
var CounterRequestSchema = import_zod3.z.object({
|
|
2306
|
+
type: import_zod3.z.literal("COUNTER_REQUEST"),
|
|
2307
|
+
payload: import_zod3.z.object({
|
|
2308
|
+
name: import_zod3.z.string()
|
|
2309
|
+
})
|
|
2310
|
+
});
|
|
2311
|
+
var CounterSyncSchema = import_zod3.z.object({
|
|
2312
|
+
type: import_zod3.z.literal("COUNTER_SYNC"),
|
|
2313
|
+
payload: import_zod3.z.object({
|
|
2314
|
+
name: import_zod3.z.string(),
|
|
2315
|
+
state: PNCounterStateObjectSchema
|
|
2316
|
+
})
|
|
2317
|
+
});
|
|
2318
|
+
var CounterResponseSchema = import_zod3.z.object({
|
|
2319
|
+
type: import_zod3.z.literal("COUNTER_RESPONSE"),
|
|
2320
|
+
payload: import_zod3.z.object({
|
|
2321
|
+
name: import_zod3.z.string(),
|
|
2322
|
+
state: PNCounterStateObjectSchema
|
|
2323
|
+
})
|
|
2324
|
+
});
|
|
2325
|
+
var CounterUpdateSchema = import_zod3.z.object({
|
|
2326
|
+
type: import_zod3.z.literal("COUNTER_UPDATE"),
|
|
2327
|
+
payload: import_zod3.z.object({
|
|
2328
|
+
name: import_zod3.z.string(),
|
|
2329
|
+
state: PNCounterStateObjectSchema
|
|
2330
|
+
})
|
|
2331
|
+
});
|
|
2332
|
+
var PingMessageSchema = import_zod3.z.object({
|
|
2333
|
+
type: import_zod3.z.literal("PING"),
|
|
2334
|
+
timestamp: import_zod3.z.number()
|
|
1331
2335
|
// Client's Date.now()
|
|
1332
2336
|
});
|
|
1333
|
-
var PongMessageSchema =
|
|
1334
|
-
type:
|
|
1335
|
-
timestamp:
|
|
2337
|
+
var PongMessageSchema = import_zod3.z.object({
|
|
2338
|
+
type: import_zod3.z.literal("PONG"),
|
|
2339
|
+
timestamp: import_zod3.z.number(),
|
|
1336
2340
|
// Echo back client's timestamp
|
|
1337
|
-
serverTime:
|
|
2341
|
+
serverTime: import_zod3.z.number()
|
|
1338
2342
|
// Server's Date.now() (for clock skew detection)
|
|
1339
2343
|
});
|
|
1340
|
-
var BatchMessageSchema =
|
|
1341
|
-
type:
|
|
1342
|
-
count:
|
|
1343
|
-
data:
|
|
2344
|
+
var BatchMessageSchema = import_zod3.z.object({
|
|
2345
|
+
type: import_zod3.z.literal("BATCH"),
|
|
2346
|
+
count: import_zod3.z.number(),
|
|
2347
|
+
data: import_zod3.z.instanceof(Uint8Array)
|
|
1344
2348
|
});
|
|
1345
|
-
var ORMapSyncInitSchema =
|
|
1346
|
-
type:
|
|
1347
|
-
mapName:
|
|
1348
|
-
rootHash:
|
|
1349
|
-
bucketHashes:
|
|
2349
|
+
var ORMapSyncInitSchema = import_zod3.z.object({
|
|
2350
|
+
type: import_zod3.z.literal("ORMAP_SYNC_INIT"),
|
|
2351
|
+
mapName: import_zod3.z.string(),
|
|
2352
|
+
rootHash: import_zod3.z.number(),
|
|
2353
|
+
bucketHashes: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number()),
|
|
1350
2354
|
// path -> hash
|
|
1351
|
-
lastSyncTimestamp:
|
|
2355
|
+
lastSyncTimestamp: import_zod3.z.number().optional()
|
|
1352
2356
|
});
|
|
1353
|
-
var ORMapSyncRespRootSchema =
|
|
1354
|
-
type:
|
|
1355
|
-
payload:
|
|
1356
|
-
mapName:
|
|
1357
|
-
rootHash:
|
|
2357
|
+
var ORMapSyncRespRootSchema = import_zod3.z.object({
|
|
2358
|
+
type: import_zod3.z.literal("ORMAP_SYNC_RESP_ROOT"),
|
|
2359
|
+
payload: import_zod3.z.object({
|
|
2360
|
+
mapName: import_zod3.z.string(),
|
|
2361
|
+
rootHash: import_zod3.z.number(),
|
|
1358
2362
|
timestamp: TimestampSchema
|
|
1359
2363
|
})
|
|
1360
2364
|
});
|
|
1361
|
-
var ORMapSyncRespBucketsSchema =
|
|
1362
|
-
type:
|
|
1363
|
-
payload:
|
|
1364
|
-
mapName:
|
|
1365
|
-
path:
|
|
1366
|
-
buckets:
|
|
2365
|
+
var ORMapSyncRespBucketsSchema = import_zod3.z.object({
|
|
2366
|
+
type: import_zod3.z.literal("ORMAP_SYNC_RESP_BUCKETS"),
|
|
2367
|
+
payload: import_zod3.z.object({
|
|
2368
|
+
mapName: import_zod3.z.string(),
|
|
2369
|
+
path: import_zod3.z.string(),
|
|
2370
|
+
buckets: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number())
|
|
1367
2371
|
})
|
|
1368
2372
|
});
|
|
1369
|
-
var ORMapMerkleReqBucketSchema =
|
|
1370
|
-
type:
|
|
1371
|
-
payload:
|
|
1372
|
-
mapName:
|
|
1373
|
-
path:
|
|
2373
|
+
var ORMapMerkleReqBucketSchema = import_zod3.z.object({
|
|
2374
|
+
type: import_zod3.z.literal("ORMAP_MERKLE_REQ_BUCKET"),
|
|
2375
|
+
payload: import_zod3.z.object({
|
|
2376
|
+
mapName: import_zod3.z.string(),
|
|
2377
|
+
path: import_zod3.z.string()
|
|
1374
2378
|
})
|
|
1375
2379
|
});
|
|
1376
|
-
var ORMapSyncRespLeafSchema =
|
|
1377
|
-
type:
|
|
1378
|
-
payload:
|
|
1379
|
-
mapName:
|
|
1380
|
-
path:
|
|
1381
|
-
entries:
|
|
1382
|
-
key:
|
|
1383
|
-
records:
|
|
1384
|
-
tombstones:
|
|
2380
|
+
var ORMapSyncRespLeafSchema = import_zod3.z.object({
|
|
2381
|
+
type: import_zod3.z.literal("ORMAP_SYNC_RESP_LEAF"),
|
|
2382
|
+
payload: import_zod3.z.object({
|
|
2383
|
+
mapName: import_zod3.z.string(),
|
|
2384
|
+
path: import_zod3.z.string(),
|
|
2385
|
+
entries: import_zod3.z.array(import_zod3.z.object({
|
|
2386
|
+
key: import_zod3.z.string(),
|
|
2387
|
+
records: import_zod3.z.array(ORMapRecordSchema),
|
|
2388
|
+
tombstones: import_zod3.z.array(import_zod3.z.string())
|
|
1385
2389
|
// Tombstone tags for this key's records
|
|
1386
2390
|
}))
|
|
1387
2391
|
})
|
|
1388
2392
|
});
|
|
1389
|
-
var ORMapDiffRequestSchema =
|
|
1390
|
-
type:
|
|
1391
|
-
payload:
|
|
1392
|
-
mapName:
|
|
1393
|
-
keys:
|
|
2393
|
+
var ORMapDiffRequestSchema = import_zod3.z.object({
|
|
2394
|
+
type: import_zod3.z.literal("ORMAP_DIFF_REQUEST"),
|
|
2395
|
+
payload: import_zod3.z.object({
|
|
2396
|
+
mapName: import_zod3.z.string(),
|
|
2397
|
+
keys: import_zod3.z.array(import_zod3.z.string())
|
|
1394
2398
|
})
|
|
1395
2399
|
});
|
|
1396
|
-
var ORMapDiffResponseSchema =
|
|
1397
|
-
type:
|
|
1398
|
-
payload:
|
|
1399
|
-
mapName:
|
|
1400
|
-
entries:
|
|
1401
|
-
key:
|
|
1402
|
-
records:
|
|
1403
|
-
tombstones:
|
|
2400
|
+
var ORMapDiffResponseSchema = import_zod3.z.object({
|
|
2401
|
+
type: import_zod3.z.literal("ORMAP_DIFF_RESPONSE"),
|
|
2402
|
+
payload: import_zod3.z.object({
|
|
2403
|
+
mapName: import_zod3.z.string(),
|
|
2404
|
+
entries: import_zod3.z.array(import_zod3.z.object({
|
|
2405
|
+
key: import_zod3.z.string(),
|
|
2406
|
+
records: import_zod3.z.array(ORMapRecordSchema),
|
|
2407
|
+
tombstones: import_zod3.z.array(import_zod3.z.string())
|
|
1404
2408
|
}))
|
|
1405
2409
|
})
|
|
1406
2410
|
});
|
|
1407
|
-
var ORMapPushDiffSchema =
|
|
1408
|
-
type:
|
|
1409
|
-
payload:
|
|
1410
|
-
mapName:
|
|
1411
|
-
entries:
|
|
1412
|
-
key:
|
|
1413
|
-
records:
|
|
1414
|
-
tombstones:
|
|
2411
|
+
var ORMapPushDiffSchema = import_zod3.z.object({
|
|
2412
|
+
type: import_zod3.z.literal("ORMAP_PUSH_DIFF"),
|
|
2413
|
+
payload: import_zod3.z.object({
|
|
2414
|
+
mapName: import_zod3.z.string(),
|
|
2415
|
+
entries: import_zod3.z.array(import_zod3.z.object({
|
|
2416
|
+
key: import_zod3.z.string(),
|
|
2417
|
+
records: import_zod3.z.array(ORMapRecordSchema),
|
|
2418
|
+
tombstones: import_zod3.z.array(import_zod3.z.string())
|
|
1415
2419
|
}))
|
|
1416
2420
|
})
|
|
1417
2421
|
});
|
|
1418
|
-
var PartitionMapRequestSchema =
|
|
1419
|
-
type:
|
|
1420
|
-
payload:
|
|
1421
|
-
currentVersion:
|
|
2422
|
+
var PartitionMapRequestSchema = import_zod3.z.object({
|
|
2423
|
+
type: import_zod3.z.literal("PARTITION_MAP_REQUEST"),
|
|
2424
|
+
payload: import_zod3.z.object({
|
|
2425
|
+
currentVersion: import_zod3.z.number().optional()
|
|
1422
2426
|
}).optional()
|
|
1423
2427
|
});
|
|
1424
|
-
var
|
|
1425
|
-
|
|
1426
|
-
|
|
2428
|
+
var EntryProcessorSchema = import_zod3.z.object({
|
|
2429
|
+
name: import_zod3.z.string().min(1).max(100),
|
|
2430
|
+
code: import_zod3.z.string().min(1).max(1e4),
|
|
2431
|
+
args: import_zod3.z.unknown().optional()
|
|
2432
|
+
});
|
|
2433
|
+
var EntryProcessRequestSchema = import_zod3.z.object({
|
|
2434
|
+
type: import_zod3.z.literal("ENTRY_PROCESS"),
|
|
2435
|
+
requestId: import_zod3.z.string(),
|
|
2436
|
+
mapName: import_zod3.z.string(),
|
|
2437
|
+
key: import_zod3.z.string(),
|
|
2438
|
+
processor: EntryProcessorSchema
|
|
2439
|
+
});
|
|
2440
|
+
var EntryProcessBatchRequestSchema = import_zod3.z.object({
|
|
2441
|
+
type: import_zod3.z.literal("ENTRY_PROCESS_BATCH"),
|
|
2442
|
+
requestId: import_zod3.z.string(),
|
|
2443
|
+
mapName: import_zod3.z.string(),
|
|
2444
|
+
keys: import_zod3.z.array(import_zod3.z.string()),
|
|
2445
|
+
processor: EntryProcessorSchema
|
|
2446
|
+
});
|
|
2447
|
+
var EntryProcessResponseSchema = import_zod3.z.object({
|
|
2448
|
+
type: import_zod3.z.literal("ENTRY_PROCESS_RESPONSE"),
|
|
2449
|
+
requestId: import_zod3.z.string(),
|
|
2450
|
+
success: import_zod3.z.boolean(),
|
|
2451
|
+
result: import_zod3.z.unknown().optional(),
|
|
2452
|
+
newValue: import_zod3.z.unknown().optional(),
|
|
2453
|
+
error: import_zod3.z.string().optional()
|
|
2454
|
+
});
|
|
2455
|
+
var EntryProcessKeyResultSchema = import_zod3.z.object({
|
|
2456
|
+
success: import_zod3.z.boolean(),
|
|
2457
|
+
result: import_zod3.z.unknown().optional(),
|
|
2458
|
+
newValue: import_zod3.z.unknown().optional(),
|
|
2459
|
+
error: import_zod3.z.string().optional()
|
|
2460
|
+
});
|
|
2461
|
+
var EntryProcessBatchResponseSchema = import_zod3.z.object({
|
|
2462
|
+
type: import_zod3.z.literal("ENTRY_PROCESS_BATCH_RESPONSE"),
|
|
2463
|
+
requestId: import_zod3.z.string(),
|
|
2464
|
+
results: import_zod3.z.record(import_zod3.z.string(), EntryProcessKeyResultSchema)
|
|
2465
|
+
});
|
|
2466
|
+
var JournalEventTypeSchema = import_zod3.z.enum(["PUT", "UPDATE", "DELETE"]);
|
|
2467
|
+
var JournalEventDataSchema = import_zod3.z.object({
|
|
2468
|
+
sequence: import_zod3.z.string(),
|
|
2469
|
+
// bigint as string
|
|
2470
|
+
type: JournalEventTypeSchema,
|
|
2471
|
+
mapName: import_zod3.z.string(),
|
|
2472
|
+
key: import_zod3.z.string(),
|
|
2473
|
+
value: import_zod3.z.unknown().optional(),
|
|
2474
|
+
previousValue: import_zod3.z.unknown().optional(),
|
|
2475
|
+
timestamp: TimestampSchema,
|
|
2476
|
+
nodeId: import_zod3.z.string(),
|
|
2477
|
+
metadata: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
2478
|
+
});
|
|
2479
|
+
var JournalSubscribeRequestSchema = import_zod3.z.object({
|
|
2480
|
+
type: import_zod3.z.literal("JOURNAL_SUBSCRIBE"),
|
|
2481
|
+
requestId: import_zod3.z.string(),
|
|
2482
|
+
fromSequence: import_zod3.z.string().optional(),
|
|
2483
|
+
// bigint as string
|
|
2484
|
+
mapName: import_zod3.z.string().optional(),
|
|
2485
|
+
types: import_zod3.z.array(JournalEventTypeSchema).optional()
|
|
2486
|
+
});
|
|
2487
|
+
var JournalUnsubscribeRequestSchema = import_zod3.z.object({
|
|
2488
|
+
type: import_zod3.z.literal("JOURNAL_UNSUBSCRIBE"),
|
|
2489
|
+
subscriptionId: import_zod3.z.string()
|
|
2490
|
+
});
|
|
2491
|
+
var JournalEventMessageSchema = import_zod3.z.object({
|
|
2492
|
+
type: import_zod3.z.literal("JOURNAL_EVENT"),
|
|
2493
|
+
event: JournalEventDataSchema
|
|
2494
|
+
});
|
|
2495
|
+
var JournalReadRequestSchema = import_zod3.z.object({
|
|
2496
|
+
type: import_zod3.z.literal("JOURNAL_READ"),
|
|
2497
|
+
requestId: import_zod3.z.string(),
|
|
2498
|
+
fromSequence: import_zod3.z.string(),
|
|
2499
|
+
limit: import_zod3.z.number().optional(),
|
|
2500
|
+
mapName: import_zod3.z.string().optional()
|
|
2501
|
+
});
|
|
2502
|
+
var JournalReadResponseSchema = import_zod3.z.object({
|
|
2503
|
+
type: import_zod3.z.literal("JOURNAL_READ_RESPONSE"),
|
|
2504
|
+
requestId: import_zod3.z.string(),
|
|
2505
|
+
events: import_zod3.z.array(JournalEventDataSchema),
|
|
2506
|
+
hasMore: import_zod3.z.boolean()
|
|
2507
|
+
});
|
|
2508
|
+
var ConflictResolverSchema = import_zod3.z.object({
|
|
2509
|
+
name: import_zod3.z.string().min(1).max(100),
|
|
2510
|
+
code: import_zod3.z.string().max(5e4),
|
|
2511
|
+
priority: import_zod3.z.number().int().min(0).max(100).optional(),
|
|
2512
|
+
keyPattern: import_zod3.z.string().optional()
|
|
2513
|
+
});
|
|
2514
|
+
var RegisterResolverRequestSchema = import_zod3.z.object({
|
|
2515
|
+
type: import_zod3.z.literal("REGISTER_RESOLVER"),
|
|
2516
|
+
requestId: import_zod3.z.string(),
|
|
2517
|
+
mapName: import_zod3.z.string(),
|
|
2518
|
+
resolver: ConflictResolverSchema
|
|
2519
|
+
});
|
|
2520
|
+
var RegisterResolverResponseSchema = import_zod3.z.object({
|
|
2521
|
+
type: import_zod3.z.literal("REGISTER_RESOLVER_RESPONSE"),
|
|
2522
|
+
requestId: import_zod3.z.string(),
|
|
2523
|
+
success: import_zod3.z.boolean(),
|
|
2524
|
+
error: import_zod3.z.string().optional()
|
|
2525
|
+
});
|
|
2526
|
+
var UnregisterResolverRequestSchema = import_zod3.z.object({
|
|
2527
|
+
type: import_zod3.z.literal("UNREGISTER_RESOLVER"),
|
|
2528
|
+
requestId: import_zod3.z.string(),
|
|
2529
|
+
mapName: import_zod3.z.string(),
|
|
2530
|
+
resolverName: import_zod3.z.string()
|
|
2531
|
+
});
|
|
2532
|
+
var UnregisterResolverResponseSchema = import_zod3.z.object({
|
|
2533
|
+
type: import_zod3.z.literal("UNREGISTER_RESOLVER_RESPONSE"),
|
|
2534
|
+
requestId: import_zod3.z.string(),
|
|
2535
|
+
success: import_zod3.z.boolean(),
|
|
2536
|
+
error: import_zod3.z.string().optional()
|
|
2537
|
+
});
|
|
2538
|
+
var MergeRejectedMessageSchema = import_zod3.z.object({
|
|
2539
|
+
type: import_zod3.z.literal("MERGE_REJECTED"),
|
|
2540
|
+
mapName: import_zod3.z.string(),
|
|
2541
|
+
key: import_zod3.z.string(),
|
|
2542
|
+
attemptedValue: import_zod3.z.unknown(),
|
|
2543
|
+
reason: import_zod3.z.string(),
|
|
2544
|
+
timestamp: TimestampSchema
|
|
2545
|
+
});
|
|
2546
|
+
var ListResolversRequestSchema = import_zod3.z.object({
|
|
2547
|
+
type: import_zod3.z.literal("LIST_RESOLVERS"),
|
|
2548
|
+
requestId: import_zod3.z.string(),
|
|
2549
|
+
mapName: import_zod3.z.string().optional()
|
|
2550
|
+
});
|
|
2551
|
+
var ListResolversResponseSchema = import_zod3.z.object({
|
|
2552
|
+
type: import_zod3.z.literal("LIST_RESOLVERS_RESPONSE"),
|
|
2553
|
+
requestId: import_zod3.z.string(),
|
|
2554
|
+
resolvers: import_zod3.z.array(import_zod3.z.object({
|
|
2555
|
+
mapName: import_zod3.z.string(),
|
|
2556
|
+
name: import_zod3.z.string(),
|
|
2557
|
+
priority: import_zod3.z.number().optional(),
|
|
2558
|
+
keyPattern: import_zod3.z.string().optional()
|
|
2559
|
+
}))
|
|
2560
|
+
});
|
|
2561
|
+
var OpResultSchema = import_zod3.z.object({
|
|
2562
|
+
opId: import_zod3.z.string(),
|
|
2563
|
+
success: import_zod3.z.boolean(),
|
|
1427
2564
|
achievedLevel: WriteConcernSchema,
|
|
1428
|
-
error:
|
|
2565
|
+
error: import_zod3.z.string().optional()
|
|
1429
2566
|
});
|
|
1430
|
-
var OpAckMessageSchema =
|
|
1431
|
-
type:
|
|
1432
|
-
payload:
|
|
2567
|
+
var OpAckMessageSchema = import_zod3.z.object({
|
|
2568
|
+
type: import_zod3.z.literal("OP_ACK"),
|
|
2569
|
+
payload: import_zod3.z.object({
|
|
1433
2570
|
/** ID of the last operation in the batch (for backwards compatibility) */
|
|
1434
|
-
lastId:
|
|
2571
|
+
lastId: import_zod3.z.string(),
|
|
1435
2572
|
/** Write Concern level achieved (for simple ACKs) */
|
|
1436
2573
|
achievedLevel: WriteConcernSchema.optional(),
|
|
1437
2574
|
/** Per-operation results (for batch operations with mixed Write Concern) */
|
|
1438
|
-
results:
|
|
2575
|
+
results: import_zod3.z.array(OpResultSchema).optional()
|
|
1439
2576
|
})
|
|
1440
2577
|
});
|
|
1441
|
-
var OpRejectedMessageSchema =
|
|
1442
|
-
type:
|
|
1443
|
-
payload:
|
|
2578
|
+
var OpRejectedMessageSchema = import_zod3.z.object({
|
|
2579
|
+
type: import_zod3.z.literal("OP_REJECTED"),
|
|
2580
|
+
payload: import_zod3.z.object({
|
|
1444
2581
|
/** Operation ID that was rejected */
|
|
1445
|
-
opId:
|
|
2582
|
+
opId: import_zod3.z.string(),
|
|
1446
2583
|
/** Reason for rejection */
|
|
1447
|
-
reason:
|
|
2584
|
+
reason: import_zod3.z.string(),
|
|
1448
2585
|
/** Error code */
|
|
1449
|
-
code:
|
|
2586
|
+
code: import_zod3.z.number().optional()
|
|
1450
2587
|
})
|
|
1451
2588
|
});
|
|
1452
|
-
var MessageSchema =
|
|
2589
|
+
var MessageSchema = import_zod3.z.discriminatedUnion("type", [
|
|
1453
2590
|
AuthMessageSchema,
|
|
1454
2591
|
QuerySubMessageSchema,
|
|
1455
2592
|
QueryUnsubMessageSchema,
|
|
@@ -1477,7 +2614,29 @@ var MessageSchema = import_zod.z.discriminatedUnion("type", [
|
|
|
1477
2614
|
ORMapDiffResponseSchema,
|
|
1478
2615
|
ORMapPushDiffSchema,
|
|
1479
2616
|
// Phase 4: Partition Map
|
|
1480
|
-
PartitionMapRequestSchema
|
|
2617
|
+
PartitionMapRequestSchema,
|
|
2618
|
+
// Phase 5.2: PN Counter
|
|
2619
|
+
CounterRequestSchema,
|
|
2620
|
+
CounterSyncSchema,
|
|
2621
|
+
// Phase 5.03: Entry Processor
|
|
2622
|
+
EntryProcessRequestSchema,
|
|
2623
|
+
EntryProcessBatchRequestSchema,
|
|
2624
|
+
EntryProcessResponseSchema,
|
|
2625
|
+
EntryProcessBatchResponseSchema,
|
|
2626
|
+
// Phase 5.04: Event Journal
|
|
2627
|
+
JournalSubscribeRequestSchema,
|
|
2628
|
+
JournalUnsubscribeRequestSchema,
|
|
2629
|
+
JournalEventMessageSchema,
|
|
2630
|
+
JournalReadRequestSchema,
|
|
2631
|
+
JournalReadResponseSchema,
|
|
2632
|
+
// Phase 5.05: Conflict Resolver
|
|
2633
|
+
RegisterResolverRequestSchema,
|
|
2634
|
+
RegisterResolverResponseSchema,
|
|
2635
|
+
UnregisterResolverRequestSchema,
|
|
2636
|
+
UnregisterResolverResponseSchema,
|
|
2637
|
+
MergeRejectedMessageSchema,
|
|
2638
|
+
ListResolversRequestSchema,
|
|
2639
|
+
ListResolversResponseSchema
|
|
1481
2640
|
]);
|
|
1482
2641
|
|
|
1483
2642
|
// src/types/WriteConcern.ts
|
|
@@ -1567,21 +2726,51 @@ var DEFAULT_BACKUP_COUNT = 1;
|
|
|
1567
2726
|
0 && (module.exports = {
|
|
1568
2727
|
AuthMessageSchema,
|
|
1569
2728
|
BatchMessageSchema,
|
|
2729
|
+
BuiltInProcessors,
|
|
2730
|
+
BuiltInResolvers,
|
|
1570
2731
|
ClientOpMessageSchema,
|
|
1571
2732
|
ClientOpSchema,
|
|
2733
|
+
ConflictResolverDefSchema,
|
|
2734
|
+
ConflictResolverSchema,
|
|
1572
2735
|
ConsistencyLevel,
|
|
2736
|
+
CounterRequestSchema,
|
|
2737
|
+
CounterResponseSchema,
|
|
2738
|
+
CounterSyncSchema,
|
|
2739
|
+
CounterUpdateSchema,
|
|
1573
2740
|
DEFAULT_BACKUP_COUNT,
|
|
1574
2741
|
DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
1575
2742
|
DEFAULT_CONNECTION_POOL_CONFIG,
|
|
2743
|
+
DEFAULT_EVENT_JOURNAL_CONFIG,
|
|
1576
2744
|
DEFAULT_MIGRATION_CONFIG,
|
|
1577
2745
|
DEFAULT_PARTITION_ROUTER_CONFIG,
|
|
2746
|
+
DEFAULT_PROCESSOR_RATE_LIMITS,
|
|
1578
2747
|
DEFAULT_REPLICATION_CONFIG,
|
|
2748
|
+
DEFAULT_RESOLVER_RATE_LIMITS,
|
|
1579
2749
|
DEFAULT_WRITE_CONCERN_TIMEOUT,
|
|
2750
|
+
EntryProcessBatchRequestSchema,
|
|
2751
|
+
EntryProcessBatchResponseSchema,
|
|
2752
|
+
EntryProcessKeyResultSchema,
|
|
2753
|
+
EntryProcessRequestSchema,
|
|
2754
|
+
EntryProcessResponseSchema,
|
|
2755
|
+
EntryProcessorDefSchema,
|
|
2756
|
+
EntryProcessorSchema,
|
|
2757
|
+
EventJournalImpl,
|
|
2758
|
+
FORBIDDEN_PATTERNS,
|
|
1580
2759
|
HLC,
|
|
2760
|
+
JournalEventDataSchema,
|
|
2761
|
+
JournalEventMessageSchema,
|
|
2762
|
+
JournalEventTypeSchema,
|
|
2763
|
+
JournalReadRequestSchema,
|
|
2764
|
+
JournalReadResponseSchema,
|
|
2765
|
+
JournalSubscribeRequestSchema,
|
|
2766
|
+
JournalUnsubscribeRequestSchema,
|
|
1581
2767
|
LWWMap,
|
|
1582
2768
|
LWWRecordSchema,
|
|
2769
|
+
ListResolversRequestSchema,
|
|
2770
|
+
ListResolversResponseSchema,
|
|
1583
2771
|
LockReleaseSchema,
|
|
1584
2772
|
LockRequestSchema,
|
|
2773
|
+
MergeRejectedMessageSchema,
|
|
1585
2774
|
MerkleReqBucketMessageSchema,
|
|
1586
2775
|
MerkleTree,
|
|
1587
2776
|
MessageSchema,
|
|
@@ -1601,6 +2790,8 @@ var DEFAULT_BACKUP_COUNT = 1;
|
|
|
1601
2790
|
OpRejectedMessageSchema,
|
|
1602
2791
|
OpResultSchema,
|
|
1603
2792
|
PARTITION_COUNT,
|
|
2793
|
+
PNCounterImpl,
|
|
2794
|
+
PNCounterStateObjectSchema,
|
|
1604
2795
|
PartitionMapRequestSchema,
|
|
1605
2796
|
PartitionState,
|
|
1606
2797
|
PingMessageSchema,
|
|
@@ -1611,6 +2802,10 @@ var DEFAULT_BACKUP_COUNT = 1;
|
|
|
1611
2802
|
QuerySchema,
|
|
1612
2803
|
QuerySubMessageSchema,
|
|
1613
2804
|
QueryUnsubMessageSchema,
|
|
2805
|
+
RESOLVER_FORBIDDEN_PATTERNS,
|
|
2806
|
+
RegisterResolverRequestSchema,
|
|
2807
|
+
RegisterResolverResponseSchema,
|
|
2808
|
+
Ringbuffer,
|
|
1614
2809
|
SyncInitMessageSchema,
|
|
1615
2810
|
SyncRespBucketsMessageSchema,
|
|
1616
2811
|
SyncRespLeafMessageSchema,
|
|
@@ -1620,11 +2815,15 @@ var DEFAULT_BACKUP_COUNT = 1;
|
|
|
1620
2815
|
TopicPubSchema,
|
|
1621
2816
|
TopicSubSchema,
|
|
1622
2817
|
TopicUnsubSchema,
|
|
2818
|
+
UnregisterResolverRequestSchema,
|
|
2819
|
+
UnregisterResolverResponseSchema,
|
|
1623
2820
|
WRITE_CONCERN_ORDER,
|
|
1624
2821
|
WriteConcern,
|
|
1625
2822
|
WriteConcernSchema,
|
|
1626
2823
|
combineHashes,
|
|
2824
|
+
compareHLCTimestamps,
|
|
1627
2825
|
compareTimestamps,
|
|
2826
|
+
deepMerge,
|
|
1628
2827
|
deserialize,
|
|
1629
2828
|
disableNativeHash,
|
|
1630
2829
|
evaluatePredicate,
|
|
@@ -1636,6 +2835,8 @@ var DEFAULT_BACKUP_COUNT = 1;
|
|
|
1636
2835
|
isWriteConcernAchieved,
|
|
1637
2836
|
resetNativeHash,
|
|
1638
2837
|
serialize,
|
|
1639
|
-
timestampToString
|
|
2838
|
+
timestampToString,
|
|
2839
|
+
validateProcessorCode,
|
|
2840
|
+
validateResolverCode
|
|
1640
2841
|
});
|
|
1641
2842
|
//# sourceMappingURL=index.js.map
|