@topgunbuild/core 0.2.1 → 0.3.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 CHANGED
@@ -509,15 +509,15 @@ declare const WriteConcernSchema: z.ZodEnum<{
509
509
  }>;
510
510
  type WriteConcernValue = z.infer<typeof WriteConcernSchema>;
511
511
  declare const TimestampSchema: z.ZodObject<{
512
- millis: z.ZodNumber;
513
- counter: z.ZodNumber;
512
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
513
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
514
514
  nodeId: z.ZodString;
515
515
  }, z.core.$strip>;
516
516
  declare const LWWRecordSchema: z.ZodObject<{
517
517
  value: z.ZodNullable<z.ZodAny>;
518
518
  timestamp: z.ZodObject<{
519
- millis: z.ZodNumber;
520
- counter: z.ZodNumber;
519
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
520
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
521
521
  nodeId: z.ZodString;
522
522
  }, z.core.$strip>;
523
523
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -525,8 +525,8 @@ declare const LWWRecordSchema: z.ZodObject<{
525
525
  declare const ORMapRecordSchema: z.ZodObject<{
526
526
  value: z.ZodAny;
527
527
  timestamp: z.ZodObject<{
528
- millis: z.ZodNumber;
529
- counter: z.ZodNumber;
528
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
529
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
530
530
  nodeId: z.ZodString;
531
531
  }, z.core.$strip>;
532
532
  tag: z.ZodString;
@@ -564,8 +564,8 @@ declare const ClientOpSchema: z.ZodObject<{
564
564
  record: z.ZodOptional<z.ZodNullable<z.ZodObject<{
565
565
  value: z.ZodNullable<z.ZodAny>;
566
566
  timestamp: z.ZodObject<{
567
- millis: z.ZodNumber;
568
- counter: z.ZodNumber;
567
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
568
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
569
569
  nodeId: z.ZodString;
570
570
  }, z.core.$strip>;
571
571
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -573,8 +573,8 @@ declare const ClientOpSchema: z.ZodObject<{
573
573
  orRecord: z.ZodOptional<z.ZodNullable<z.ZodObject<{
574
574
  value: z.ZodAny;
575
575
  timestamp: z.ZodObject<{
576
- millis: z.ZodNumber;
577
- counter: z.ZodNumber;
576
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
577
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
578
578
  nodeId: z.ZodString;
579
579
  }, z.core.$strip>;
580
580
  tag: z.ZodString;
@@ -627,8 +627,8 @@ declare const ClientOpMessageSchema: z.ZodObject<{
627
627
  record: z.ZodOptional<z.ZodNullable<z.ZodObject<{
628
628
  value: z.ZodNullable<z.ZodAny>;
629
629
  timestamp: z.ZodObject<{
630
- millis: z.ZodNumber;
631
- counter: z.ZodNumber;
630
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
631
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
632
632
  nodeId: z.ZodString;
633
633
  }, z.core.$strip>;
634
634
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -636,8 +636,8 @@ declare const ClientOpMessageSchema: z.ZodObject<{
636
636
  orRecord: z.ZodOptional<z.ZodNullable<z.ZodObject<{
637
637
  value: z.ZodAny;
638
638
  timestamp: z.ZodObject<{
639
- millis: z.ZodNumber;
640
- counter: z.ZodNumber;
639
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
640
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
641
641
  nodeId: z.ZodString;
642
642
  }, z.core.$strip>;
643
643
  tag: z.ZodString;
@@ -665,8 +665,8 @@ declare const OpBatchMessageSchema: z.ZodObject<{
665
665
  record: z.ZodOptional<z.ZodNullable<z.ZodObject<{
666
666
  value: z.ZodNullable<z.ZodAny>;
667
667
  timestamp: z.ZodObject<{
668
- millis: z.ZodNumber;
669
- counter: z.ZodNumber;
668
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
669
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
670
670
  nodeId: z.ZodString;
671
671
  }, z.core.$strip>;
672
672
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -674,8 +674,8 @@ declare const OpBatchMessageSchema: z.ZodObject<{
674
674
  orRecord: z.ZodOptional<z.ZodNullable<z.ZodObject<{
675
675
  value: z.ZodAny;
676
676
  timestamp: z.ZodObject<{
677
- millis: z.ZodNumber;
678
- counter: z.ZodNumber;
677
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
678
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
679
679
  nodeId: z.ZodString;
680
680
  }, z.core.$strip>;
681
681
  tag: z.ZodString;
@@ -712,8 +712,8 @@ declare const SyncRespRootMessageSchema: z.ZodObject<{
712
712
  mapName: z.ZodString;
713
713
  rootHash: z.ZodNumber;
714
714
  timestamp: z.ZodObject<{
715
- millis: z.ZodNumber;
716
- counter: z.ZodNumber;
715
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
716
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
717
717
  nodeId: z.ZodString;
718
718
  }, z.core.$strip>;
719
719
  }, z.core.$strip>;
@@ -736,8 +736,8 @@ declare const SyncRespLeafMessageSchema: z.ZodObject<{
736
736
  record: z.ZodObject<{
737
737
  value: z.ZodNullable<z.ZodAny>;
738
738
  timestamp: z.ZodObject<{
739
- millis: z.ZodNumber;
740
- counter: z.ZodNumber;
739
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
740
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
741
741
  nodeId: z.ZodString;
742
742
  }, z.core.$strip>;
743
743
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -835,8 +835,8 @@ declare const ORMapSyncRespRootSchema: z.ZodObject<{
835
835
  mapName: z.ZodString;
836
836
  rootHash: z.ZodNumber;
837
837
  timestamp: z.ZodObject<{
838
- millis: z.ZodNumber;
839
- counter: z.ZodNumber;
838
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
839
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
840
840
  nodeId: z.ZodString;
841
841
  }, z.core.$strip>;
842
842
  }, z.core.$strip>;
@@ -875,8 +875,8 @@ declare const ORMapSyncRespLeafSchema: z.ZodObject<{
875
875
  records: z.ZodArray<z.ZodObject<{
876
876
  value: z.ZodAny;
877
877
  timestamp: z.ZodObject<{
878
- millis: z.ZodNumber;
879
- counter: z.ZodNumber;
878
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
879
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
880
880
  nodeId: z.ZodString;
881
881
  }, z.core.$strip>;
882
882
  tag: z.ZodString;
@@ -908,8 +908,8 @@ declare const ORMapDiffResponseSchema: z.ZodObject<{
908
908
  records: z.ZodArray<z.ZodObject<{
909
909
  value: z.ZodAny;
910
910
  timestamp: z.ZodObject<{
911
- millis: z.ZodNumber;
912
- counter: z.ZodNumber;
911
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
912
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
913
913
  nodeId: z.ZodString;
914
914
  }, z.core.$strip>;
915
915
  tag: z.ZodString;
@@ -931,8 +931,8 @@ declare const ORMapPushDiffSchema: z.ZodObject<{
931
931
  records: z.ZodArray<z.ZodObject<{
932
932
  value: z.ZodAny;
933
933
  timestamp: z.ZodObject<{
934
- millis: z.ZodNumber;
935
- counter: z.ZodNumber;
934
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
935
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
936
936
  nodeId: z.ZodString;
937
937
  }, z.core.$strip>;
938
938
  tag: z.ZodString;
@@ -942,6 +942,15 @@ declare const ORMapPushDiffSchema: z.ZodObject<{
942
942
  }, z.core.$strip>>;
943
943
  }, z.core.$strip>;
944
944
  }, z.core.$strip>;
945
+ /**
946
+ * PARTITION_MAP_REQUEST: Client requests current partition map
947
+ */
948
+ declare const PartitionMapRequestSchema: z.ZodObject<{
949
+ type: z.ZodLiteral<"PARTITION_MAP_REQUEST">;
950
+ payload: z.ZodOptional<z.ZodObject<{
951
+ currentVersion: z.ZodOptional<z.ZodNumber>;
952
+ }, z.core.$strip>>;
953
+ }, z.core.$strip>;
945
954
  /**
946
955
  * Individual operation result within a batch ACK
947
956
  */
@@ -1031,8 +1040,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1031
1040
  record: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1032
1041
  value: z.ZodNullable<z.ZodAny>;
1033
1042
  timestamp: z.ZodObject<{
1034
- millis: z.ZodNumber;
1035
- counter: z.ZodNumber;
1043
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1044
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1036
1045
  nodeId: z.ZodString;
1037
1046
  }, z.core.$strip>;
1038
1047
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -1040,8 +1049,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1040
1049
  orRecord: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1041
1050
  value: z.ZodAny;
1042
1051
  timestamp: z.ZodObject<{
1043
- millis: z.ZodNumber;
1044
- counter: z.ZodNumber;
1052
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1053
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1045
1054
  nodeId: z.ZodString;
1046
1055
  }, z.core.$strip>;
1047
1056
  tag: z.ZodString;
@@ -1068,8 +1077,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1068
1077
  record: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1069
1078
  value: z.ZodNullable<z.ZodAny>;
1070
1079
  timestamp: z.ZodObject<{
1071
- millis: z.ZodNumber;
1072
- counter: z.ZodNumber;
1080
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1081
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1073
1082
  nodeId: z.ZodString;
1074
1083
  }, z.core.$strip>;
1075
1084
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -1077,8 +1086,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1077
1086
  orRecord: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1078
1087
  value: z.ZodAny;
1079
1088
  timestamp: z.ZodObject<{
1080
- millis: z.ZodNumber;
1081
- counter: z.ZodNumber;
1089
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1090
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1082
1091
  nodeId: z.ZodString;
1083
1092
  }, z.core.$strip>;
1084
1093
  tag: z.ZodString;
@@ -1113,8 +1122,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1113
1122
  mapName: z.ZodString;
1114
1123
  rootHash: z.ZodNumber;
1115
1124
  timestamp: z.ZodObject<{
1116
- millis: z.ZodNumber;
1117
- counter: z.ZodNumber;
1125
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1126
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1118
1127
  nodeId: z.ZodString;
1119
1128
  }, z.core.$strip>;
1120
1129
  }, z.core.$strip>;
@@ -1135,8 +1144,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1135
1144
  record: z.ZodObject<{
1136
1145
  value: z.ZodNullable<z.ZodAny>;
1137
1146
  timestamp: z.ZodObject<{
1138
- millis: z.ZodNumber;
1139
- counter: z.ZodNumber;
1147
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1148
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1140
1149
  nodeId: z.ZodString;
1141
1150
  }, z.core.$strip>;
1142
1151
  ttlMs: z.ZodOptional<z.ZodNumber>;
@@ -1198,8 +1207,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1198
1207
  mapName: z.ZodString;
1199
1208
  rootHash: z.ZodNumber;
1200
1209
  timestamp: z.ZodObject<{
1201
- millis: z.ZodNumber;
1202
- counter: z.ZodNumber;
1210
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1211
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1203
1212
  nodeId: z.ZodString;
1204
1213
  }, z.core.$strip>;
1205
1214
  }, z.core.$strip>;
@@ -1226,8 +1235,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1226
1235
  records: z.ZodArray<z.ZodObject<{
1227
1236
  value: z.ZodAny;
1228
1237
  timestamp: z.ZodObject<{
1229
- millis: z.ZodNumber;
1230
- counter: z.ZodNumber;
1238
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1239
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1231
1240
  nodeId: z.ZodString;
1232
1241
  }, z.core.$strip>;
1233
1242
  tag: z.ZodString;
@@ -1251,8 +1260,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1251
1260
  records: z.ZodArray<z.ZodObject<{
1252
1261
  value: z.ZodAny;
1253
1262
  timestamp: z.ZodObject<{
1254
- millis: z.ZodNumber;
1255
- counter: z.ZodNumber;
1263
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1264
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1256
1265
  nodeId: z.ZodString;
1257
1266
  }, z.core.$strip>;
1258
1267
  tag: z.ZodString;
@@ -1270,8 +1279,8 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1270
1279
  records: z.ZodArray<z.ZodObject<{
1271
1280
  value: z.ZodAny;
1272
1281
  timestamp: z.ZodObject<{
1273
- millis: z.ZodNumber;
1274
- counter: z.ZodNumber;
1282
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1283
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1275
1284
  nodeId: z.ZodString;
1276
1285
  }, z.core.$strip>;
1277
1286
  tag: z.ZodString;
@@ -1280,6 +1289,11 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1280
1289
  tombstones: z.ZodArray<z.ZodString>;
1281
1290
  }, z.core.$strip>>;
1282
1291
  }, z.core.$strip>;
1292
+ }, z.core.$strip>, z.ZodObject<{
1293
+ type: z.ZodLiteral<"PARTITION_MAP_REQUEST">;
1294
+ payload: z.ZodOptional<z.ZodObject<{
1295
+ currentVersion: z.ZodOptional<z.ZodNumber>;
1296
+ }, z.core.$strip>>;
1283
1297
  }, z.core.$strip>], "type">;
1284
1298
  type Query = z.infer<typeof QuerySchema>;
1285
1299
  type ClientOp = z.infer<typeof ClientOpSchema>;
@@ -1348,7 +1362,7 @@ declare const DEFAULT_WRITE_CONCERN_TIMEOUT = 5000;
1348
1362
  /**
1349
1363
  * Write options for PUT/REMOVE operations
1350
1364
  */
1351
- interface WriteOptions {
1365
+ interface WriteOptions$1 {
1352
1366
  /**
1353
1367
  * Write acknowledgment level.
1354
1368
  * @default WriteConcern.MEMORY
@@ -1417,4 +1431,346 @@ declare function isWriteConcernAchieved(achieved: Set<WriteConcern>, target: Wri
1417
1431
  */
1418
1432
  declare function getHighestWriteConcernLevel(achieved: Set<WriteConcern>): WriteConcern;
1419
1433
 
1420
- export { AuthMessageSchema, type BatchMessage, BatchMessageSchema, type ClientOp, ClientOpMessageSchema, ClientOpSchema, DEFAULT_WRITE_CONCERN_TIMEOUT, HLC, LWWMap, type LWWRecord, LWWRecordSchema, LockReleaseSchema, LockRequestSchema, type MergeKeyResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapRecord, ORMapRecordSchema, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, type PendingWrite, type PermissionPolicy, type PermissionType, type PingMessage, PingMessageSchema, type PongMessage, PongMessageSchema, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type Query, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type Timestamp, TimestampSchema, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, WRITE_CONCERN_ORDER, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions, type WriteResult, combineHashes, compareTimestamps, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isUsingNativeHash, isWriteConcernAchieved, resetNativeHash, serialize, timestampToString };
1434
+ /**
1435
+ * Cluster types for Phase 4: Clustering Improvements
1436
+ *
1437
+ * These types are shared between client and server packages
1438
+ * for partition-aware routing and cluster communication.
1439
+ */
1440
+ type NodeStatus = 'ACTIVE' | 'JOINING' | 'LEAVING' | 'SUSPECTED' | 'FAILED';
1441
+ interface NodeInfo {
1442
+ nodeId: string;
1443
+ endpoints: {
1444
+ websocket: string;
1445
+ http?: string;
1446
+ };
1447
+ status: NodeStatus;
1448
+ }
1449
+ interface PartitionInfo {
1450
+ partitionId: number;
1451
+ ownerNodeId: string;
1452
+ backupNodeIds: string[];
1453
+ }
1454
+ interface PartitionMap {
1455
+ version: number;
1456
+ partitionCount: number;
1457
+ nodes: NodeInfo[];
1458
+ partitions: PartitionInfo[];
1459
+ generatedAt: number;
1460
+ }
1461
+ interface PartitionMapMessage {
1462
+ type: 'PARTITION_MAP';
1463
+ payload: PartitionMap;
1464
+ }
1465
+ interface PartitionMapRequestMessage {
1466
+ type: 'PARTITION_MAP_REQUEST';
1467
+ payload?: {
1468
+ currentVersion?: number;
1469
+ };
1470
+ }
1471
+ interface PartitionChange {
1472
+ partitionId: number;
1473
+ previousOwner: string;
1474
+ newOwner: string;
1475
+ reason: 'REBALANCE' | 'FAILOVER' | 'JOIN' | 'LEAVE';
1476
+ }
1477
+ interface PartitionMapDeltaMessage {
1478
+ type: 'PARTITION_MAP_DELTA';
1479
+ payload: {
1480
+ version: number;
1481
+ previousVersion: number;
1482
+ changes: PartitionChange[];
1483
+ timestamp: number;
1484
+ };
1485
+ }
1486
+ interface NotOwnerError {
1487
+ code: 'NOT_OWNER';
1488
+ message: string;
1489
+ hint: {
1490
+ partitionId: number;
1491
+ currentOwner: string;
1492
+ mapVersion: number;
1493
+ };
1494
+ }
1495
+ interface StaleMapError {
1496
+ code: 'STALE_MAP';
1497
+ message: string;
1498
+ hint: {
1499
+ clientVersion: number;
1500
+ serverVersion: number;
1501
+ };
1502
+ }
1503
+ type RoutingError = NotOwnerError | StaleMapError;
1504
+ interface ConnectionPoolConfig {
1505
+ /** Maximum connections per node (default: 1) */
1506
+ maxConnectionsPerNode: number;
1507
+ /** Connection timeout in ms (default: 5000) */
1508
+ connectionTimeoutMs: number;
1509
+ /** Health check interval in ms (default: 10000) */
1510
+ healthCheckIntervalMs: number;
1511
+ /** Reconnect delay base in ms (default: 1000) */
1512
+ reconnectDelayMs: number;
1513
+ /** Maximum reconnect delay in ms (default: 30000) */
1514
+ maxReconnectDelayMs: number;
1515
+ /** Maximum reconnect attempts before marking unhealthy (default: 5) */
1516
+ maxReconnectAttempts: number;
1517
+ }
1518
+ declare const DEFAULT_CONNECTION_POOL_CONFIG: ConnectionPoolConfig;
1519
+ interface PartitionRouterConfig {
1520
+ /** Fallback mode when routing fails: 'forward' uses primary, 'error' throws */
1521
+ fallbackMode: 'forward' | 'error';
1522
+ /** How often to refresh stale partition map in ms (default: 30000) */
1523
+ mapRefreshIntervalMs: number;
1524
+ /** Max staleness before forcing refresh in ms (default: 60000) */
1525
+ maxMapStalenessMs: number;
1526
+ }
1527
+ declare const DEFAULT_PARTITION_ROUTER_CONFIG: PartitionRouterConfig;
1528
+ /**
1529
+ * Circuit breaker configuration.
1530
+ */
1531
+ interface CircuitBreakerConfig {
1532
+ /** Number of failures before opening circuit (default: 5) */
1533
+ failureThreshold: number;
1534
+ /** Time in ms before attempting to close circuit (default: 30000) */
1535
+ resetTimeoutMs: number;
1536
+ }
1537
+ declare const DEFAULT_CIRCUIT_BREAKER_CONFIG: CircuitBreakerConfig;
1538
+ interface ClusterClientConfig {
1539
+ /** Enable cluster mode */
1540
+ enabled: boolean;
1541
+ /** Initial seed nodes to connect to */
1542
+ seedNodes: string[];
1543
+ /** Routing mode: 'direct' routes to owner, 'forward' uses server forwarding */
1544
+ routingMode: 'direct' | 'forward';
1545
+ /** Connection pool configuration */
1546
+ connectionPool?: Partial<ConnectionPoolConfig>;
1547
+ /** Partition router configuration */
1548
+ routing?: Partial<PartitionRouterConfig>;
1549
+ /** Circuit breaker configuration */
1550
+ circuitBreaker?: Partial<CircuitBreakerConfig>;
1551
+ }
1552
+ type ConnectionState = 'DISCONNECTED' | 'CONNECTING' | 'CONNECTED' | 'AUTHENTICATED' | 'RECONNECTING' | 'FAILED';
1553
+ interface NodeHealth {
1554
+ nodeId: string;
1555
+ state: ConnectionState;
1556
+ lastSeen: number;
1557
+ latencyMs: number;
1558
+ reconnectAttempts: number;
1559
+ }
1560
+ interface ClusterEvents {
1561
+ 'node:connected': {
1562
+ nodeId: string;
1563
+ };
1564
+ 'node:disconnected': {
1565
+ nodeId: string;
1566
+ reason: string;
1567
+ };
1568
+ 'node:healthy': {
1569
+ nodeId: string;
1570
+ };
1571
+ 'node:unhealthy': {
1572
+ nodeId: string;
1573
+ reason: string;
1574
+ };
1575
+ 'partitionMap:updated': {
1576
+ version: number;
1577
+ changesCount: number;
1578
+ };
1579
+ 'partitionMap:stale': {
1580
+ currentVersion: number;
1581
+ lastRefresh: number;
1582
+ };
1583
+ 'routing:miss': {
1584
+ key: string;
1585
+ expectedOwner: string;
1586
+ actualOwner: string;
1587
+ };
1588
+ }
1589
+ declare enum PartitionState {
1590
+ STABLE = "STABLE",// Normal operation
1591
+ MIGRATING = "MIGRATING",// Data being transferred
1592
+ SYNC = "SYNC",// Verifying consistency
1593
+ FAILED = "FAILED"
1594
+ }
1595
+ interface PartitionMigration {
1596
+ partitionId: number;
1597
+ state: PartitionState;
1598
+ sourceNode: string;
1599
+ targetNode: string;
1600
+ startTime: number;
1601
+ bytesTransferred: number;
1602
+ totalBytes: number;
1603
+ retryCount: number;
1604
+ }
1605
+ interface MigrationConfig {
1606
+ /** Partitions per batch (default: 10) */
1607
+ batchSize: number;
1608
+ /** Delay between batches in ms (default: 5000) */
1609
+ batchIntervalMs: number;
1610
+ /** Bytes per chunk (default: 64KB) */
1611
+ transferChunkSize: number;
1612
+ /** Retries per partition (default: 3) */
1613
+ maxRetries: number;
1614
+ /** Sync phase timeout in ms (default: 30000) */
1615
+ syncTimeoutMs: number;
1616
+ /** Concurrent transfers (default: 4) */
1617
+ parallelTransfers: number;
1618
+ }
1619
+ declare const DEFAULT_MIGRATION_CONFIG: MigrationConfig;
1620
+ interface MigrationStatus {
1621
+ inProgress: boolean;
1622
+ active: PartitionMigration[];
1623
+ queued: number;
1624
+ completed: number;
1625
+ failed: number;
1626
+ estimatedTimeRemainingMs: number;
1627
+ }
1628
+ interface MigrationMetrics {
1629
+ migrationsStarted: number;
1630
+ migrationsCompleted: number;
1631
+ migrationsFailed: number;
1632
+ chunksTransferred: number;
1633
+ bytesTransferred: number;
1634
+ activeMigrations: number;
1635
+ queuedMigrations: number;
1636
+ }
1637
+ interface MigrationStartMessage {
1638
+ type: 'MIGRATION_START';
1639
+ payload: {
1640
+ partitionId: number;
1641
+ sourceNode: string;
1642
+ estimatedSize: number;
1643
+ };
1644
+ }
1645
+ interface MigrationChunkMessage {
1646
+ type: 'MIGRATION_CHUNK';
1647
+ payload: {
1648
+ partitionId: number;
1649
+ chunkIndex: number;
1650
+ totalChunks: number;
1651
+ data: Uint8Array;
1652
+ checksum: string;
1653
+ };
1654
+ }
1655
+ interface MigrationChunkAckMessage {
1656
+ type: 'MIGRATION_CHUNK_ACK';
1657
+ payload: {
1658
+ partitionId: number;
1659
+ chunkIndex: number;
1660
+ success: boolean;
1661
+ };
1662
+ }
1663
+ interface MigrationCompleteMessage {
1664
+ type: 'MIGRATION_COMPLETE';
1665
+ payload: {
1666
+ partitionId: number;
1667
+ totalRecords: number;
1668
+ checksum: string;
1669
+ };
1670
+ }
1671
+ interface MigrationVerifyMessage {
1672
+ type: 'MIGRATION_VERIFY';
1673
+ payload: {
1674
+ partitionId: number;
1675
+ success: boolean;
1676
+ checksumMatch: boolean;
1677
+ };
1678
+ }
1679
+ type MigrationMessage = MigrationStartMessage | MigrationChunkMessage | MigrationChunkAckMessage | MigrationCompleteMessage | MigrationVerifyMessage;
1680
+ declare enum ConsistencyLevel {
1681
+ /** Wait for all replicas (owner + all backups) */
1682
+ STRONG = "STRONG",
1683
+ /** Wait for majority (owner + N/2 backups) */
1684
+ QUORUM = "QUORUM",
1685
+ /** Acknowledge after owner write only, background replication */
1686
+ EVENTUAL = "EVENTUAL"
1687
+ }
1688
+ interface WriteOptions {
1689
+ consistency?: ConsistencyLevel;
1690
+ /** Replication timeout in ms */
1691
+ timeout?: number;
1692
+ }
1693
+ interface ReadOptions {
1694
+ consistency?: ConsistencyLevel;
1695
+ /** Read from backup if owner unavailable */
1696
+ allowStale?: boolean;
1697
+ /** Max acceptable lag in ms */
1698
+ maxStaleness?: number;
1699
+ }
1700
+ interface ReplicationConfig {
1701
+ defaultConsistency: ConsistencyLevel;
1702
+ /** Max queued operations (default: 10000) */
1703
+ queueSizeLimit: number;
1704
+ /** Operations per batch (default: 100) */
1705
+ batchSize: number;
1706
+ /** Batch flush interval in ms (default: 50) */
1707
+ batchIntervalMs: number;
1708
+ /** Ack timeout in ms (default: 5000) */
1709
+ ackTimeoutMs: number;
1710
+ /** Retries before marking node unhealthy (default: 3) */
1711
+ maxRetries: number;
1712
+ }
1713
+ declare const DEFAULT_REPLICATION_CONFIG: ReplicationConfig;
1714
+ interface ReplicationTask {
1715
+ opId: string;
1716
+ operation: unknown;
1717
+ consistency: ConsistencyLevel;
1718
+ timestamp: number;
1719
+ retryCount: number;
1720
+ }
1721
+ interface ReplicationLag {
1722
+ /** Current lag in ms */
1723
+ current: number;
1724
+ /** Average lag */
1725
+ avg: number;
1726
+ /** Maximum observed lag */
1727
+ max: number;
1728
+ /** 99th percentile lag */
1729
+ percentile99: number;
1730
+ }
1731
+ interface ReplicationHealth {
1732
+ healthy: boolean;
1733
+ unhealthyNodes: string[];
1734
+ laggyNodes: string[];
1735
+ avgLagMs: number;
1736
+ }
1737
+ interface ReplicationResult {
1738
+ success: boolean;
1739
+ ackedBy: string[];
1740
+ }
1741
+ interface ReplicationMessage {
1742
+ type: 'REPLICATION';
1743
+ payload: {
1744
+ opId: string;
1745
+ operation: unknown;
1746
+ consistency: ConsistencyLevel;
1747
+ };
1748
+ }
1749
+ interface ReplicationBatchMessage {
1750
+ type: 'REPLICATION_BATCH';
1751
+ payload: {
1752
+ operations: unknown[];
1753
+ opIds: string[];
1754
+ };
1755
+ }
1756
+ interface ReplicationAckMessage {
1757
+ type: 'REPLICATION_ACK';
1758
+ payload: {
1759
+ opId: string;
1760
+ success: boolean;
1761
+ timestamp: number;
1762
+ };
1763
+ }
1764
+ interface ReplicationBatchAckMessage {
1765
+ type: 'REPLICATION_BATCH_ACK';
1766
+ payload: {
1767
+ opIds: string[];
1768
+ success: boolean;
1769
+ timestamp: number;
1770
+ };
1771
+ }
1772
+ type ReplicationProtocolMessage = ReplicationMessage | ReplicationBatchMessage | ReplicationAckMessage | ReplicationBatchAckMessage;
1773
+ declare const PARTITION_COUNT = 271;
1774
+ declare const DEFAULT_BACKUP_COUNT = 1;
1775
+
1776
+ export { AuthMessageSchema, type BatchMessage, BatchMessageSchema, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type WriteOptions as ClusterWriteOptions, type ConnectionPoolConfig, type ConnectionState, ConsistencyLevel, DEFAULT_BACKUP_COUNT, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_PARTITION_ROUTER_CONFIG, DEFAULT_REPLICATION_CONFIG, DEFAULT_WRITE_CONCERN_TIMEOUT, HLC, LWWMap, type LWWRecord, LWWRecordSchema, LockReleaseSchema, LockRequestSchema, type MergeKeyResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapRecord, ORMapRecordSchema, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, PARTITION_COUNT, type PartitionChange, type PartitionInfo, type PartitionMap, type PartitionMapDeltaMessage, type PartitionMapMessage, type PartitionMapRequestMessage, PartitionMapRequestSchema, type PartitionMigration, type PartitionRouterConfig, PartitionState, type PendingWrite, type PermissionPolicy, type PermissionType, type PingMessage, PingMessageSchema, type PongMessage, PongMessageSchema, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type Query, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, type ReplicationAckMessage, type ReplicationBatchAckMessage, type ReplicationBatchMessage, type ReplicationConfig, type ReplicationHealth, type ReplicationLag, type ReplicationMessage, type ReplicationProtocolMessage, type ReplicationResult, type ReplicationTask, type RoutingError, type StaleMapError, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type Timestamp, TimestampSchema, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, WRITE_CONCERN_ORDER, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareTimestamps, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isUsingNativeHash, isWriteConcernAchieved, resetNativeHash, serialize, timestampToString };