@topgunbuild/core 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,17 +1,37 @@
1
1
  import { z } from 'zod';
2
+ import pino from 'pino';
2
3
 
3
4
  interface Timestamp {
4
5
  millis: number;
5
6
  counter: number;
6
7
  nodeId: string;
7
8
  }
9
+ /**
10
+ * Configuration options for HLC behavior.
11
+ */
12
+ interface HLCOptions {
13
+ /**
14
+ * When true, update() throws an error if remote timestamp drift exceeds maxDriftMs.
15
+ * When false (default), a warning is logged but the timestamp is accepted.
16
+ */
17
+ strictMode?: boolean;
18
+ /**
19
+ * Maximum allowable clock drift in milliseconds.
20
+ * Remote timestamps beyond this threshold trigger strict mode rejection or warning.
21
+ * Default: 60000 (1 minute)
22
+ */
23
+ maxDriftMs?: number;
24
+ }
8
25
  declare class HLC {
9
26
  private lastMillis;
10
27
  private lastCounter;
11
28
  private readonly nodeId;
12
- private static readonly MAX_DRIFT;
13
- constructor(nodeId: string);
29
+ private readonly strictMode;
30
+ private readonly maxDriftMs;
31
+ constructor(nodeId: string, options?: HLCOptions);
14
32
  get getNodeId(): string;
33
+ get getStrictMode(): boolean;
34
+ get getMaxDriftMs(): number;
15
35
  /**
16
36
  * Generates a new unique timestamp for a local event.
17
37
  * Ensures monotonicity: always greater than any previously generated or received timestamp.
@@ -1107,8 +1127,6 @@ interface MergeRejection {
1107
1127
  *
1108
1128
  * Uses native xxHash64 when available (via @topgunbuild/native),
1109
1129
  * falls back to FNV-1a for JS-only environments.
1110
- *
1111
- * Phase 3.05: Native Hash Integration
1112
1130
  */
1113
1131
  /**
1114
1132
  * Hash a string to a 32-bit unsigned integer.
@@ -1145,6 +1163,14 @@ declare function disableNativeHash(): void;
1145
1163
  * Resets the load state so native module can be loaded again.
1146
1164
  */
1147
1165
  declare function resetNativeHash(): void;
1166
+ /**
1167
+ * Hash an object to a 32-bit unsigned integer.
1168
+ * Uses deterministic JSON serialization + hashString.
1169
+ *
1170
+ * @param obj - Object to hash (must be JSON-serializable)
1171
+ * @returns 32-bit unsigned integer hash
1172
+ */
1173
+ declare function hashObject(obj: unknown): number;
1148
1174
 
1149
1175
  /**
1150
1176
  * Serializes a JavaScript object to MessagePack binary format.
@@ -1377,8 +1403,9 @@ declare const QuerySchema: z.ZodObject<{
1377
1403
  desc: "desc";
1378
1404
  }>>>;
1379
1405
  limit: z.ZodOptional<z.ZodNumber>;
1380
- offset: z.ZodOptional<z.ZodNumber>;
1406
+ cursor: z.ZodOptional<z.ZodString>;
1381
1407
  }, z.core.$strip>;
1408
+ type Query$1 = z.infer<typeof QuerySchema>;
1382
1409
  declare const ClientOpSchema: z.ZodObject<{
1383
1410
  id: z.ZodOptional<z.ZodString>;
1384
1411
  mapName: z.ZodString;
@@ -1413,33 +1440,12 @@ declare const ClientOpSchema: z.ZodObject<{
1413
1440
  }>>;
1414
1441
  timeout: z.ZodOptional<z.ZodNumber>;
1415
1442
  }, z.core.$strip>;
1443
+ type ClientOp = z.infer<typeof ClientOpSchema>;
1416
1444
  declare const AuthMessageSchema: z.ZodObject<{
1417
1445
  type: z.ZodLiteral<"AUTH">;
1418
1446
  token: z.ZodString;
1419
1447
  }, z.core.$strip>;
1420
- declare const QuerySubMessageSchema: z.ZodObject<{
1421
- type: z.ZodLiteral<"QUERY_SUB">;
1422
- payload: z.ZodObject<{
1423
- queryId: z.ZodString;
1424
- mapName: z.ZodString;
1425
- query: z.ZodObject<{
1426
- where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1427
- predicate: z.ZodOptional<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
1428
- sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
1429
- asc: "asc";
1430
- desc: "desc";
1431
- }>>>;
1432
- limit: z.ZodOptional<z.ZodNumber>;
1433
- offset: z.ZodOptional<z.ZodNumber>;
1434
- }, z.core.$strip>;
1435
- }, z.core.$strip>;
1436
- }, z.core.$strip>;
1437
- declare const QueryUnsubMessageSchema: z.ZodObject<{
1438
- type: z.ZodLiteral<"QUERY_UNSUB">;
1439
- payload: z.ZodObject<{
1440
- queryId: z.ZodString;
1441
- }, z.core.$strip>;
1442
- }, z.core.$strip>;
1448
+
1443
1449
  declare const ClientOpMessageSchema: z.ZodObject<{
1444
1450
  type: z.ZodLiteral<"CLIENT_OP">;
1445
1451
  payload: z.ZodObject<{
@@ -1575,109 +1581,6 @@ declare const MerkleReqBucketMessageSchema: z.ZodObject<{
1575
1581
  path: z.ZodString;
1576
1582
  }, z.core.$strip>;
1577
1583
  }, z.core.$strip>;
1578
- declare const LockRequestSchema: z.ZodObject<{
1579
- type: z.ZodLiteral<"LOCK_REQUEST">;
1580
- payload: z.ZodObject<{
1581
- requestId: z.ZodString;
1582
- name: z.ZodString;
1583
- ttl: z.ZodOptional<z.ZodNumber>;
1584
- }, z.core.$strip>;
1585
- }, z.core.$strip>;
1586
- declare const LockReleaseSchema: z.ZodObject<{
1587
- type: z.ZodLiteral<"LOCK_RELEASE">;
1588
- payload: z.ZodObject<{
1589
- requestId: z.ZodOptional<z.ZodString>;
1590
- name: z.ZodString;
1591
- fencingToken: z.ZodNumber;
1592
- }, z.core.$strip>;
1593
- }, z.core.$strip>;
1594
- declare const TopicSubSchema: z.ZodObject<{
1595
- type: z.ZodLiteral<"TOPIC_SUB">;
1596
- payload: z.ZodObject<{
1597
- topic: z.ZodString;
1598
- }, z.core.$strip>;
1599
- }, z.core.$strip>;
1600
- declare const TopicUnsubSchema: z.ZodObject<{
1601
- type: z.ZodLiteral<"TOPIC_UNSUB">;
1602
- payload: z.ZodObject<{
1603
- topic: z.ZodString;
1604
- }, z.core.$strip>;
1605
- }, z.core.$strip>;
1606
- declare const TopicPubSchema: z.ZodObject<{
1607
- type: z.ZodLiteral<"TOPIC_PUB">;
1608
- payload: z.ZodObject<{
1609
- topic: z.ZodString;
1610
- data: z.ZodAny;
1611
- }, z.core.$strip>;
1612
- }, z.core.$strip>;
1613
- declare const TopicMessageEventSchema: z.ZodObject<{
1614
- type: z.ZodLiteral<"TOPIC_MESSAGE">;
1615
- payload: z.ZodObject<{
1616
- topic: z.ZodString;
1617
- data: z.ZodAny;
1618
- publisherId: z.ZodOptional<z.ZodString>;
1619
- timestamp: z.ZodNumber;
1620
- }, z.core.$strip>;
1621
- }, z.core.$strip>;
1622
- declare const PNCounterStateObjectSchema: z.ZodObject<{
1623
- p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1624
- n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1625
- }, z.core.$strip>;
1626
- declare const CounterRequestSchema: z.ZodObject<{
1627
- type: z.ZodLiteral<"COUNTER_REQUEST">;
1628
- payload: z.ZodObject<{
1629
- name: z.ZodString;
1630
- }, z.core.$strip>;
1631
- }, z.core.$strip>;
1632
- declare const CounterSyncSchema: z.ZodObject<{
1633
- type: z.ZodLiteral<"COUNTER_SYNC">;
1634
- payload: z.ZodObject<{
1635
- name: z.ZodString;
1636
- state: z.ZodObject<{
1637
- p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1638
- n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1639
- }, z.core.$strip>;
1640
- }, z.core.$strip>;
1641
- }, z.core.$strip>;
1642
- declare const CounterResponseSchema: z.ZodObject<{
1643
- type: z.ZodLiteral<"COUNTER_RESPONSE">;
1644
- payload: z.ZodObject<{
1645
- name: z.ZodString;
1646
- state: z.ZodObject<{
1647
- p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1648
- n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1649
- }, z.core.$strip>;
1650
- }, z.core.$strip>;
1651
- }, z.core.$strip>;
1652
- declare const CounterUpdateSchema: z.ZodObject<{
1653
- type: z.ZodLiteral<"COUNTER_UPDATE">;
1654
- payload: z.ZodObject<{
1655
- name: z.ZodString;
1656
- state: z.ZodObject<{
1657
- p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1658
- n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1659
- }, z.core.$strip>;
1660
- }, z.core.$strip>;
1661
- }, z.core.$strip>;
1662
- declare const PingMessageSchema: z.ZodObject<{
1663
- type: z.ZodLiteral<"PING">;
1664
- timestamp: z.ZodNumber;
1665
- }, z.core.$strip>;
1666
- declare const PongMessageSchema: z.ZodObject<{
1667
- type: z.ZodLiteral<"PONG">;
1668
- timestamp: z.ZodNumber;
1669
- serverTime: z.ZodNumber;
1670
- }, z.core.$strip>;
1671
- /**
1672
- * BATCH: Server sends multiple messages batched together.
1673
- * Uses length-prefixed binary format for efficiency.
1674
- * Format: [4 bytes: count][4 bytes: len1][msg1][4 bytes: len2][msg2]...
1675
- */
1676
- declare const BatchMessageSchema: z.ZodObject<{
1677
- type: z.ZodLiteral<"BATCH">;
1678
- count: z.ZodNumber;
1679
- data: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
1680
- }, z.core.$strip>;
1681
1584
  /**
1682
1585
  * ORMAP_SYNC_INIT: Client initiates ORMap sync
1683
1586
  * Sends root hash and bucket hashes to server
@@ -1689,9 +1592,6 @@ declare const ORMapSyncInitSchema: z.ZodObject<{
1689
1592
  bucketHashes: z.ZodRecord<z.ZodString, z.ZodNumber>;
1690
1593
  lastSyncTimestamp: z.ZodOptional<z.ZodNumber>;
1691
1594
  }, z.core.$strip>;
1692
- /**
1693
- * ORMAP_SYNC_RESP_ROOT: Server responds with its root hash
1694
- */
1695
1595
  declare const ORMapSyncRespRootSchema: z.ZodObject<{
1696
1596
  type: z.ZodLiteral<"ORMAP_SYNC_RESP_ROOT">;
1697
1597
  payload: z.ZodObject<{
@@ -1704,9 +1604,6 @@ declare const ORMapSyncRespRootSchema: z.ZodObject<{
1704
1604
  }, z.core.$strip>;
1705
1605
  }, z.core.$strip>;
1706
1606
  }, z.core.$strip>;
1707
- /**
1708
- * ORMAP_SYNC_RESP_BUCKETS: Server sends bucket hashes for comparison
1709
- */
1710
1607
  declare const ORMapSyncRespBucketsSchema: z.ZodObject<{
1711
1608
  type: z.ZodLiteral<"ORMAP_SYNC_RESP_BUCKETS">;
1712
1609
  payload: z.ZodObject<{
@@ -1715,9 +1612,6 @@ declare const ORMapSyncRespBucketsSchema: z.ZodObject<{
1715
1612
  buckets: z.ZodRecord<z.ZodString, z.ZodNumber>;
1716
1613
  }, z.core.$strip>;
1717
1614
  }, z.core.$strip>;
1718
- /**
1719
- * ORMAP_MERKLE_REQ_BUCKET: Client requests bucket details
1720
- */
1721
1615
  declare const ORMapMerkleReqBucketSchema: z.ZodObject<{
1722
1616
  type: z.ZodLiteral<"ORMAP_MERKLE_REQ_BUCKET">;
1723
1617
  payload: z.ZodObject<{
@@ -1725,9 +1619,6 @@ declare const ORMapMerkleReqBucketSchema: z.ZodObject<{
1725
1619
  path: z.ZodString;
1726
1620
  }, z.core.$strip>;
1727
1621
  }, z.core.$strip>;
1728
- /**
1729
- * ORMAP_SYNC_RESP_LEAF: Server sends actual records for differing keys
1730
- */
1731
1622
  declare const ORMapSyncRespLeafSchema: z.ZodObject<{
1732
1623
  type: z.ZodLiteral<"ORMAP_SYNC_RESP_LEAF">;
1733
1624
  payload: z.ZodObject<{
@@ -1749,9 +1640,6 @@ declare const ORMapSyncRespLeafSchema: z.ZodObject<{
1749
1640
  }, z.core.$strip>>;
1750
1641
  }, z.core.$strip>;
1751
1642
  }, z.core.$strip>;
1752
- /**
1753
- * ORMAP_DIFF_REQUEST: Client requests data for specific keys
1754
- */
1755
1643
  declare const ORMapDiffRequestSchema: z.ZodObject<{
1756
1644
  type: z.ZodLiteral<"ORMAP_DIFF_REQUEST">;
1757
1645
  payload: z.ZodObject<{
@@ -1759,9 +1647,6 @@ declare const ORMapDiffRequestSchema: z.ZodObject<{
1759
1647
  keys: z.ZodArray<z.ZodString>;
1760
1648
  }, z.core.$strip>;
1761
1649
  }, z.core.$strip>;
1762
- /**
1763
- * ORMAP_DIFF_RESPONSE: Server responds with data for requested keys
1764
- */
1765
1650
  declare const ORMapDiffResponseSchema: z.ZodObject<{
1766
1651
  type: z.ZodLiteral<"ORMAP_DIFF_RESPONSE">;
1767
1652
  payload: z.ZodObject<{
@@ -1782,9 +1667,6 @@ declare const ORMapDiffResponseSchema: z.ZodObject<{
1782
1667
  }, z.core.$strip>>;
1783
1668
  }, z.core.$strip>;
1784
1669
  }, z.core.$strip>;
1785
- /**
1786
- * ORMAP_PUSH_DIFF: Client pushes local diffs to server
1787
- */
1788
1670
  declare const ORMapPushDiffSchema: z.ZodObject<{
1789
1671
  type: z.ZodLiteral<"ORMAP_PUSH_DIFF">;
1790
1672
  payload: z.ZodObject<{
@@ -1805,208 +1687,138 @@ declare const ORMapPushDiffSchema: z.ZodObject<{
1805
1687
  }, z.core.$strip>>;
1806
1688
  }, z.core.$strip>;
1807
1689
  }, z.core.$strip>;
1808
- /**
1809
- * PARTITION_MAP_REQUEST: Client requests current partition map
1810
- */
1811
- declare const PartitionMapRequestSchema: z.ZodObject<{
1812
- type: z.ZodLiteral<"PARTITION_MAP_REQUEST">;
1813
- payload: z.ZodOptional<z.ZodObject<{
1814
- currentVersion: z.ZodOptional<z.ZodNumber>;
1815
- }, z.core.$strip>>;
1816
- }, z.core.$strip>;
1817
- /**
1818
- * Entry processor definition schema.
1819
- */
1820
- declare const EntryProcessorSchema: z.ZodObject<{
1821
- name: z.ZodString;
1822
- code: z.ZodString;
1823
- args: z.ZodOptional<z.ZodUnknown>;
1690
+ declare const OpResultSchema: z.ZodObject<{
1691
+ opId: z.ZodString;
1692
+ success: z.ZodBoolean;
1693
+ achievedLevel: z.ZodEnum<{
1694
+ FIRE_AND_FORGET: "FIRE_AND_FORGET";
1695
+ MEMORY: "MEMORY";
1696
+ APPLIED: "APPLIED";
1697
+ REPLICATED: "REPLICATED";
1698
+ PERSISTED: "PERSISTED";
1699
+ }>;
1700
+ error: z.ZodOptional<z.ZodString>;
1824
1701
  }, z.core.$strip>;
1825
- /**
1826
- * ENTRY_PROCESS: Client requests atomic operation on single key.
1827
- */
1828
- declare const EntryProcessRequestSchema: z.ZodObject<{
1829
- type: z.ZodLiteral<"ENTRY_PROCESS">;
1830
- requestId: z.ZodString;
1831
- mapName: z.ZodString;
1832
- key: z.ZodString;
1833
- processor: z.ZodObject<{
1834
- name: z.ZodString;
1835
- code: z.ZodString;
1836
- args: z.ZodOptional<z.ZodUnknown>;
1702
+ type OpResult = z.infer<typeof OpResultSchema>;
1703
+ declare const OpAckMessageSchema: z.ZodObject<{
1704
+ type: z.ZodLiteral<"OP_ACK">;
1705
+ payload: z.ZodObject<{
1706
+ lastId: z.ZodString;
1707
+ achievedLevel: z.ZodOptional<z.ZodEnum<{
1708
+ FIRE_AND_FORGET: "FIRE_AND_FORGET";
1709
+ MEMORY: "MEMORY";
1710
+ APPLIED: "APPLIED";
1711
+ REPLICATED: "REPLICATED";
1712
+ PERSISTED: "PERSISTED";
1713
+ }>>;
1714
+ results: z.ZodOptional<z.ZodArray<z.ZodObject<{
1715
+ opId: z.ZodString;
1716
+ success: z.ZodBoolean;
1717
+ achievedLevel: z.ZodEnum<{
1718
+ FIRE_AND_FORGET: "FIRE_AND_FORGET";
1719
+ MEMORY: "MEMORY";
1720
+ APPLIED: "APPLIED";
1721
+ REPLICATED: "REPLICATED";
1722
+ PERSISTED: "PERSISTED";
1723
+ }>;
1724
+ error: z.ZodOptional<z.ZodString>;
1725
+ }, z.core.$strip>>>;
1837
1726
  }, z.core.$strip>;
1838
1727
  }, z.core.$strip>;
1839
- /**
1840
- * ENTRY_PROCESS_BATCH: Client requests atomic operation on multiple keys.
1841
- */
1842
- declare const EntryProcessBatchRequestSchema: z.ZodObject<{
1843
- type: z.ZodLiteral<"ENTRY_PROCESS_BATCH">;
1844
- requestId: z.ZodString;
1845
- mapName: z.ZodString;
1846
- keys: z.ZodArray<z.ZodString>;
1847
- processor: z.ZodObject<{
1848
- name: z.ZodString;
1849
- code: z.ZodString;
1850
- args: z.ZodOptional<z.ZodUnknown>;
1728
+ type OpAckMessage = z.infer<typeof OpAckMessageSchema>;
1729
+ declare const OpRejectedMessageSchema: z.ZodObject<{
1730
+ type: z.ZodLiteral<"OP_REJECTED">;
1731
+ payload: z.ZodObject<{
1732
+ opId: z.ZodString;
1733
+ reason: z.ZodString;
1734
+ code: z.ZodOptional<z.ZodNumber>;
1851
1735
  }, z.core.$strip>;
1852
1736
  }, z.core.$strip>;
1737
+ type OpRejectedMessage = z.infer<typeof OpRejectedMessageSchema>;
1853
1738
  /**
1854
- * ENTRY_PROCESS_RESPONSE: Server responds to single-key processor request.
1855
- */
1856
- declare const EntryProcessResponseSchema: z.ZodObject<{
1857
- type: z.ZodLiteral<"ENTRY_PROCESS_RESPONSE">;
1858
- requestId: z.ZodString;
1859
- success: z.ZodBoolean;
1860
- result: z.ZodOptional<z.ZodUnknown>;
1861
- newValue: z.ZodOptional<z.ZodUnknown>;
1862
- error: z.ZodOptional<z.ZodString>;
1863
- }, z.core.$strip>;
1864
- /**
1865
- * Individual key result in batch response.
1739
+ * BATCH: Server sends multiple messages batched together.
1740
+ * Uses length-prefixed binary format for efficiency.
1741
+ * Format: [4 bytes: count][4 bytes: len1][msg1][4 bytes: len2][msg2]...
1866
1742
  */
1867
- declare const EntryProcessKeyResultSchema: z.ZodObject<{
1868
- success: z.ZodBoolean;
1869
- result: z.ZodOptional<z.ZodUnknown>;
1870
- newValue: z.ZodOptional<z.ZodUnknown>;
1871
- error: z.ZodOptional<z.ZodString>;
1743
+ declare const BatchMessageSchema: z.ZodObject<{
1744
+ type: z.ZodLiteral<"BATCH">;
1745
+ count: z.ZodNumber;
1746
+ data: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
1872
1747
  }, z.core.$strip>;
1873
- /**
1874
- * ENTRY_PROCESS_BATCH_RESPONSE: Server responds to multi-key processor request.
1875
- */
1876
- declare const EntryProcessBatchResponseSchema: z.ZodObject<{
1877
- type: z.ZodLiteral<"ENTRY_PROCESS_BATCH_RESPONSE">;
1878
- requestId: z.ZodString;
1879
- results: z.ZodRecord<z.ZodString, z.ZodObject<{
1880
- success: z.ZodBoolean;
1881
- result: z.ZodOptional<z.ZodUnknown>;
1882
- newValue: z.ZodOptional<z.ZodUnknown>;
1883
- error: z.ZodOptional<z.ZodString>;
1884
- }, z.core.$strip>>;
1885
- }, z.core.$strip>;
1886
- /**
1887
- * Journal event type schema.
1888
- */
1889
- declare const JournalEventTypeSchema: z.ZodEnum<{
1890
- PUT: "PUT";
1891
- UPDATE: "UPDATE";
1892
- DELETE: "DELETE";
1893
- }>;
1894
- /**
1895
- * Journal event data (serialized for network).
1896
- */
1897
- declare const JournalEventDataSchema: z.ZodObject<{
1898
- sequence: z.ZodString;
1899
- type: z.ZodEnum<{
1900
- PUT: "PUT";
1901
- UPDATE: "UPDATE";
1902
- DELETE: "DELETE";
1903
- }>;
1904
- mapName: z.ZodString;
1905
- key: z.ZodString;
1906
- value: z.ZodOptional<z.ZodUnknown>;
1907
- previousValue: z.ZodOptional<z.ZodUnknown>;
1908
- timestamp: z.ZodObject<{
1909
- millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1910
- counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1911
- nodeId: z.ZodString;
1912
- }, z.core.$strip>;
1913
- nodeId: z.ZodString;
1914
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1915
- }, z.core.$strip>;
1916
- /**
1917
- * JOURNAL_SUBSCRIBE: Client subscribes to journal events.
1918
- */
1919
- declare const JournalSubscribeRequestSchema: z.ZodObject<{
1920
- type: z.ZodLiteral<"JOURNAL_SUBSCRIBE">;
1921
- requestId: z.ZodString;
1922
- fromSequence: z.ZodOptional<z.ZodString>;
1923
- mapName: z.ZodOptional<z.ZodString>;
1924
- types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1925
- PUT: "PUT";
1926
- UPDATE: "UPDATE";
1927
- DELETE: "DELETE";
1928
- }>>>;
1929
- }, z.core.$strip>;
1930
- /**
1931
- * JOURNAL_UNSUBSCRIBE: Client unsubscribes from journal events.
1932
- */
1933
- declare const JournalUnsubscribeRequestSchema: z.ZodObject<{
1934
- type: z.ZodLiteral<"JOURNAL_UNSUBSCRIBE">;
1935
- subscriptionId: z.ZodString;
1936
- }, z.core.$strip>;
1937
- /**
1938
- * JOURNAL_EVENT: Server sends journal event to client.
1939
- */
1940
- declare const JournalEventMessageSchema: z.ZodObject<{
1941
- type: z.ZodLiteral<"JOURNAL_EVENT">;
1942
- event: z.ZodObject<{
1943
- sequence: z.ZodString;
1944
- type: z.ZodEnum<{
1945
- PUT: "PUT";
1946
- UPDATE: "UPDATE";
1947
- DELETE: "DELETE";
1948
- }>;
1748
+ type BatchMessage = z.infer<typeof BatchMessageSchema>;
1749
+
1750
+ declare const QuerySubMessageSchema: z.ZodObject<{
1751
+ type: z.ZodLiteral<"QUERY_SUB">;
1752
+ payload: z.ZodObject<{
1753
+ queryId: z.ZodString;
1949
1754
  mapName: z.ZodString;
1950
- key: z.ZodString;
1951
- value: z.ZodOptional<z.ZodUnknown>;
1952
- previousValue: z.ZodOptional<z.ZodUnknown>;
1953
- timestamp: z.ZodObject<{
1954
- millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1955
- counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1956
- nodeId: z.ZodString;
1755
+ query: z.ZodObject<{
1756
+ where: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1757
+ predicate: z.ZodOptional<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>;
1758
+ sort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
1759
+ asc: "asc";
1760
+ desc: "desc";
1761
+ }>>>;
1762
+ limit: z.ZodOptional<z.ZodNumber>;
1763
+ cursor: z.ZodOptional<z.ZodString>;
1957
1764
  }, z.core.$strip>;
1958
- nodeId: z.ZodString;
1959
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1960
1765
  }, z.core.$strip>;
1961
1766
  }, z.core.$strip>;
1962
- /**
1963
- * JOURNAL_READ: Client requests events from journal.
1964
- */
1965
- declare const JournalReadRequestSchema: z.ZodObject<{
1966
- type: z.ZodLiteral<"JOURNAL_READ">;
1967
- requestId: z.ZodString;
1968
- fromSequence: z.ZodString;
1969
- limit: z.ZodOptional<z.ZodNumber>;
1970
- mapName: z.ZodOptional<z.ZodString>;
1767
+ declare const QueryUnsubMessageSchema: z.ZodObject<{
1768
+ type: z.ZodLiteral<"QUERY_UNSUB">;
1769
+ payload: z.ZodObject<{
1770
+ queryId: z.ZodString;
1771
+ }, z.core.$strip>;
1971
1772
  }, z.core.$strip>;
1972
- /**
1973
- * JOURNAL_READ_RESPONSE: Server responds with journal events.
1974
- */
1975
- declare const JournalReadResponseSchema: z.ZodObject<{
1976
- type: z.ZodLiteral<"JOURNAL_READ_RESPONSE">;
1977
- requestId: z.ZodString;
1978
- events: z.ZodArray<z.ZodObject<{
1979
- sequence: z.ZodString;
1980
- type: z.ZodEnum<{
1981
- PUT: "PUT";
1982
- UPDATE: "UPDATE";
1983
- DELETE: "DELETE";
1984
- }>;
1985
- mapName: z.ZodString;
1773
+ declare const CursorStatusSchema: z.ZodEnum<{
1774
+ valid: "valid";
1775
+ expired: "expired";
1776
+ invalid: "invalid";
1777
+ none: "none";
1778
+ }>;
1779
+ type CursorStatus$1 = z.infer<typeof CursorStatusSchema>;
1780
+ declare const QueryRespPayloadSchema: z.ZodObject<{
1781
+ queryId: z.ZodString;
1782
+ results: z.ZodArray<z.ZodObject<{
1986
1783
  key: z.ZodString;
1987
- value: z.ZodOptional<z.ZodUnknown>;
1988
- previousValue: z.ZodOptional<z.ZodUnknown>;
1989
- timestamp: z.ZodObject<{
1990
- millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1991
- counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1992
- nodeId: z.ZodString;
1993
- }, z.core.$strip>;
1994
- nodeId: z.ZodString;
1995
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1784
+ value: z.ZodUnknown;
1996
1785
  }, z.core.$strip>>;
1997
- hasMore: z.ZodBoolean;
1786
+ nextCursor: z.ZodOptional<z.ZodString>;
1787
+ hasMore: z.ZodOptional<z.ZodBoolean>;
1788
+ cursorStatus: z.ZodOptional<z.ZodEnum<{
1789
+ valid: "valid";
1790
+ expired: "expired";
1791
+ invalid: "invalid";
1792
+ none: "none";
1793
+ }>>;
1998
1794
  }, z.core.$strip>;
1999
- /**
2000
- * Search options schema for FTS queries.
2001
- */
1795
+ type QueryRespPayload = z.infer<typeof QueryRespPayloadSchema>;
1796
+ declare const QueryRespMessageSchema: z.ZodObject<{
1797
+ type: z.ZodLiteral<"QUERY_RESP">;
1798
+ payload: z.ZodObject<{
1799
+ queryId: z.ZodString;
1800
+ results: z.ZodArray<z.ZodObject<{
1801
+ key: z.ZodString;
1802
+ value: z.ZodUnknown;
1803
+ }, z.core.$strip>>;
1804
+ nextCursor: z.ZodOptional<z.ZodString>;
1805
+ hasMore: z.ZodOptional<z.ZodBoolean>;
1806
+ cursorStatus: z.ZodOptional<z.ZodEnum<{
1807
+ valid: "valid";
1808
+ expired: "expired";
1809
+ invalid: "invalid";
1810
+ none: "none";
1811
+ }>>;
1812
+ }, z.core.$strip>;
1813
+ }, z.core.$strip>;
1814
+ type QueryRespMessage = z.infer<typeof QueryRespMessageSchema>;
1815
+
2002
1816
  declare const SearchOptionsSchema: z.ZodObject<{
2003
1817
  limit: z.ZodOptional<z.ZodNumber>;
2004
1818
  minScore: z.ZodOptional<z.ZodNumber>;
2005
1819
  boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2006
1820
  }, z.core.$strip>;
2007
- /**
2008
- * SEARCH: Client requests one-shot BM25 search.
2009
- */
1821
+ type SearchOptions$1 = z.infer<typeof SearchOptionsSchema>;
2010
1822
  declare const SearchPayloadSchema: z.ZodObject<{
2011
1823
  requestId: z.ZodString;
2012
1824
  mapName: z.ZodString;
@@ -2017,6 +1829,7 @@ declare const SearchPayloadSchema: z.ZodObject<{
2017
1829
  boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2018
1830
  }, z.core.$strip>>;
2019
1831
  }, z.core.$strip>;
1832
+ type SearchPayload = z.infer<typeof SearchPayloadSchema>;
2020
1833
  declare const SearchMessageSchema: z.ZodObject<{
2021
1834
  type: z.ZodLiteral<"SEARCH">;
2022
1835
  payload: z.ZodObject<{
@@ -2030,9 +1843,7 @@ declare const SearchMessageSchema: z.ZodObject<{
2030
1843
  }, z.core.$strip>>;
2031
1844
  }, z.core.$strip>;
2032
1845
  }, z.core.$strip>;
2033
- /**
2034
- * SEARCH_RESP: Server responds with search results.
2035
- */
1846
+ type SearchMessage = z.infer<typeof SearchMessageSchema>;
2036
1847
  declare const SearchRespPayloadSchema: z.ZodObject<{
2037
1848
  requestId: z.ZodString;
2038
1849
  results: z.ZodArray<z.ZodObject<{
@@ -2044,6 +1855,7 @@ declare const SearchRespPayloadSchema: z.ZodObject<{
2044
1855
  totalCount: z.ZodNumber;
2045
1856
  error: z.ZodOptional<z.ZodString>;
2046
1857
  }, z.core.$strip>;
1858
+ type SearchRespPayload = z.infer<typeof SearchRespPayloadSchema>;
2047
1859
  declare const SearchRespMessageSchema: z.ZodObject<{
2048
1860
  type: z.ZodLiteral<"SEARCH_RESP">;
2049
1861
  payload: z.ZodObject<{
@@ -2058,20 +1870,13 @@ declare const SearchRespMessageSchema: z.ZodObject<{
2058
1870
  error: z.ZodOptional<z.ZodString>;
2059
1871
  }, z.core.$strip>;
2060
1872
  }, z.core.$strip>;
2061
- /**
2062
- * Search delta update type.
2063
- * - ENTER: Document entered the result set (new or score exceeded minScore)
2064
- * - UPDATE: Document score changed while remaining in result set
2065
- * - LEAVE: Document left the result set (removed or score dropped below minScore)
2066
- */
1873
+ type SearchRespMessage = z.infer<typeof SearchRespMessageSchema>;
2067
1874
  declare const SearchUpdateTypeSchema: z.ZodEnum<{
2068
1875
  UPDATE: "UPDATE";
2069
1876
  ENTER: "ENTER";
2070
1877
  LEAVE: "LEAVE";
2071
1878
  }>;
2072
- /**
2073
- * SEARCH_SUB: Client subscribes to live search results.
2074
- */
1879
+ type SearchUpdateType = z.infer<typeof SearchUpdateTypeSchema>;
2075
1880
  declare const SearchSubPayloadSchema: z.ZodObject<{
2076
1881
  subscriptionId: z.ZodString;
2077
1882
  mapName: z.ZodString;
@@ -2082,6 +1887,7 @@ declare const SearchSubPayloadSchema: z.ZodObject<{
2082
1887
  boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2083
1888
  }, z.core.$strip>>;
2084
1889
  }, z.core.$strip>;
1890
+ type SearchSubPayload = z.infer<typeof SearchSubPayloadSchema>;
2085
1891
  declare const SearchSubMessageSchema: z.ZodObject<{
2086
1892
  type: z.ZodLiteral<"SEARCH_SUB">;
2087
1893
  payload: z.ZodObject<{
@@ -2095,9 +1901,7 @@ declare const SearchSubMessageSchema: z.ZodObject<{
2095
1901
  }, z.core.$strip>>;
2096
1902
  }, z.core.$strip>;
2097
1903
  }, z.core.$strip>;
2098
- /**
2099
- * SEARCH_UPDATE: Server sends delta update for a subscribed search.
2100
- */
1904
+ type SearchSubMessage = z.infer<typeof SearchSubMessageSchema>;
2101
1905
  declare const SearchUpdatePayloadSchema: z.ZodObject<{
2102
1906
  subscriptionId: z.ZodString;
2103
1907
  key: z.ZodString;
@@ -2110,6 +1914,7 @@ declare const SearchUpdatePayloadSchema: z.ZodObject<{
2110
1914
  LEAVE: "LEAVE";
2111
1915
  }>;
2112
1916
  }, z.core.$strip>;
1917
+ type SearchUpdatePayload = z.infer<typeof SearchUpdatePayloadSchema>;
2113
1918
  declare const SearchUpdateMessageSchema: z.ZodObject<{
2114
1919
  type: z.ZodLiteral<"SEARCH_UPDATE">;
2115
1920
  payload: z.ZodObject<{
@@ -2125,30 +1930,533 @@ declare const SearchUpdateMessageSchema: z.ZodObject<{
2125
1930
  }>;
2126
1931
  }, z.core.$strip>;
2127
1932
  }, z.core.$strip>;
2128
- /**
2129
- * SEARCH_UNSUB: Client unsubscribes from live search.
2130
- */
1933
+ type SearchUpdateMessage = z.infer<typeof SearchUpdateMessageSchema>;
2131
1934
  declare const SearchUnsubPayloadSchema: z.ZodObject<{
2132
1935
  subscriptionId: z.ZodString;
2133
1936
  }, z.core.$strip>;
1937
+ type SearchUnsubPayload = z.infer<typeof SearchUnsubPayloadSchema>;
2134
1938
  declare const SearchUnsubMessageSchema: z.ZodObject<{
2135
1939
  type: z.ZodLiteral<"SEARCH_UNSUB">;
2136
1940
  payload: z.ZodObject<{
2137
1941
  subscriptionId: z.ZodString;
2138
1942
  }, z.core.$strip>;
2139
1943
  }, z.core.$strip>;
2140
- /**
2141
- * Conflict resolver definition schema (wire format).
2142
- */
1944
+ type SearchUnsubMessage = z.infer<typeof SearchUnsubMessageSchema>;
1945
+
1946
+ declare const PartitionMapRequestSchema: z.ZodObject<{
1947
+ type: z.ZodLiteral<"PARTITION_MAP_REQUEST">;
1948
+ payload: z.ZodOptional<z.ZodObject<{
1949
+ currentVersion: z.ZodOptional<z.ZodNumber>;
1950
+ }, z.core.$strip>>;
1951
+ }, z.core.$strip>;
1952
+ declare const ClusterSubRegisterPayloadSchema: z.ZodObject<{
1953
+ subscriptionId: z.ZodString;
1954
+ coordinatorNodeId: z.ZodString;
1955
+ mapName: z.ZodString;
1956
+ type: z.ZodEnum<{
1957
+ SEARCH: "SEARCH";
1958
+ QUERY: "QUERY";
1959
+ }>;
1960
+ searchQuery: z.ZodOptional<z.ZodString>;
1961
+ searchOptions: z.ZodOptional<z.ZodObject<{
1962
+ limit: z.ZodOptional<z.ZodNumber>;
1963
+ minScore: z.ZodOptional<z.ZodNumber>;
1964
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1965
+ }, z.core.$strip>>;
1966
+ queryPredicate: z.ZodOptional<z.ZodAny>;
1967
+ querySort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
1968
+ asc: "asc";
1969
+ desc: "desc";
1970
+ }>>>;
1971
+ }, z.core.$strip>;
1972
+ type ClusterSubRegisterPayload = z.infer<typeof ClusterSubRegisterPayloadSchema>;
1973
+ declare const ClusterSubRegisterMessageSchema: z.ZodObject<{
1974
+ type: z.ZodLiteral<"CLUSTER_SUB_REGISTER">;
1975
+ payload: z.ZodObject<{
1976
+ subscriptionId: z.ZodString;
1977
+ coordinatorNodeId: z.ZodString;
1978
+ mapName: z.ZodString;
1979
+ type: z.ZodEnum<{
1980
+ SEARCH: "SEARCH";
1981
+ QUERY: "QUERY";
1982
+ }>;
1983
+ searchQuery: z.ZodOptional<z.ZodString>;
1984
+ searchOptions: z.ZodOptional<z.ZodObject<{
1985
+ limit: z.ZodOptional<z.ZodNumber>;
1986
+ minScore: z.ZodOptional<z.ZodNumber>;
1987
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
1988
+ }, z.core.$strip>>;
1989
+ queryPredicate: z.ZodOptional<z.ZodAny>;
1990
+ querySort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
1991
+ asc: "asc";
1992
+ desc: "desc";
1993
+ }>>>;
1994
+ }, z.core.$strip>;
1995
+ }, z.core.$strip>;
1996
+ type ClusterSubRegisterMessage = z.infer<typeof ClusterSubRegisterMessageSchema>;
1997
+ declare const ClusterSubAckPayloadSchema: z.ZodObject<{
1998
+ subscriptionId: z.ZodString;
1999
+ nodeId: z.ZodString;
2000
+ success: z.ZodBoolean;
2001
+ error: z.ZodOptional<z.ZodString>;
2002
+ initialResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
2003
+ key: z.ZodString;
2004
+ value: z.ZodUnknown;
2005
+ score: z.ZodOptional<z.ZodNumber>;
2006
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2007
+ }, z.core.$strip>>>;
2008
+ totalHits: z.ZodOptional<z.ZodNumber>;
2009
+ }, z.core.$strip>;
2010
+ type ClusterSubAckPayload = z.infer<typeof ClusterSubAckPayloadSchema>;
2011
+ declare const ClusterSubAckMessageSchema: z.ZodObject<{
2012
+ type: z.ZodLiteral<"CLUSTER_SUB_ACK">;
2013
+ payload: z.ZodObject<{
2014
+ subscriptionId: z.ZodString;
2015
+ nodeId: z.ZodString;
2016
+ success: z.ZodBoolean;
2017
+ error: z.ZodOptional<z.ZodString>;
2018
+ initialResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
2019
+ key: z.ZodString;
2020
+ value: z.ZodUnknown;
2021
+ score: z.ZodOptional<z.ZodNumber>;
2022
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2023
+ }, z.core.$strip>>>;
2024
+ totalHits: z.ZodOptional<z.ZodNumber>;
2025
+ }, z.core.$strip>;
2026
+ }, z.core.$strip>;
2027
+ type ClusterSubAckMessage = z.infer<typeof ClusterSubAckMessageSchema>;
2028
+ declare const ClusterSubUpdatePayloadSchema: z.ZodObject<{
2029
+ subscriptionId: z.ZodString;
2030
+ sourceNodeId: z.ZodString;
2031
+ key: z.ZodString;
2032
+ value: z.ZodUnknown;
2033
+ score: z.ZodOptional<z.ZodNumber>;
2034
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2035
+ changeType: z.ZodEnum<{
2036
+ UPDATE: "UPDATE";
2037
+ ENTER: "ENTER";
2038
+ LEAVE: "LEAVE";
2039
+ }>;
2040
+ timestamp: z.ZodNumber;
2041
+ }, z.core.$strip>;
2042
+ type ClusterSubUpdatePayload = z.infer<typeof ClusterSubUpdatePayloadSchema>;
2043
+ declare const ClusterSubUpdateMessageSchema: z.ZodObject<{
2044
+ type: z.ZodLiteral<"CLUSTER_SUB_UPDATE">;
2045
+ payload: z.ZodObject<{
2046
+ subscriptionId: z.ZodString;
2047
+ sourceNodeId: z.ZodString;
2048
+ key: z.ZodString;
2049
+ value: z.ZodUnknown;
2050
+ score: z.ZodOptional<z.ZodNumber>;
2051
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2052
+ changeType: z.ZodEnum<{
2053
+ UPDATE: "UPDATE";
2054
+ ENTER: "ENTER";
2055
+ LEAVE: "LEAVE";
2056
+ }>;
2057
+ timestamp: z.ZodNumber;
2058
+ }, z.core.$strip>;
2059
+ }, z.core.$strip>;
2060
+ type ClusterSubUpdateMessage = z.infer<typeof ClusterSubUpdateMessageSchema>;
2061
+ declare const ClusterSubUnregisterPayloadSchema: z.ZodObject<{
2062
+ subscriptionId: z.ZodString;
2063
+ }, z.core.$strip>;
2064
+ type ClusterSubUnregisterPayload = z.infer<typeof ClusterSubUnregisterPayloadSchema>;
2065
+ declare const ClusterSubUnregisterMessageSchema: z.ZodObject<{
2066
+ type: z.ZodLiteral<"CLUSTER_SUB_UNREGISTER">;
2067
+ payload: z.ZodObject<{
2068
+ subscriptionId: z.ZodString;
2069
+ }, z.core.$strip>;
2070
+ }, z.core.$strip>;
2071
+ type ClusterSubUnregisterMessage = z.infer<typeof ClusterSubUnregisterMessageSchema>;
2072
+ declare const ClusterSearchReqPayloadSchema: z.ZodObject<{
2073
+ requestId: z.ZodString;
2074
+ mapName: z.ZodString;
2075
+ query: z.ZodString;
2076
+ options: z.ZodObject<{
2077
+ limit: z.ZodNumber;
2078
+ minScore: z.ZodOptional<z.ZodNumber>;
2079
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2080
+ includeMatchedTerms: z.ZodOptional<z.ZodBoolean>;
2081
+ afterScore: z.ZodOptional<z.ZodNumber>;
2082
+ afterKey: z.ZodOptional<z.ZodString>;
2083
+ }, z.core.$strip>;
2084
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
2085
+ }, z.core.$strip>;
2086
+ type ClusterSearchReqPayload = z.infer<typeof ClusterSearchReqPayloadSchema>;
2087
+ declare const ClusterSearchReqMessageSchema: z.ZodObject<{
2088
+ type: z.ZodLiteral<"CLUSTER_SEARCH_REQ">;
2089
+ payload: z.ZodObject<{
2090
+ requestId: z.ZodString;
2091
+ mapName: z.ZodString;
2092
+ query: z.ZodString;
2093
+ options: z.ZodObject<{
2094
+ limit: z.ZodNumber;
2095
+ minScore: z.ZodOptional<z.ZodNumber>;
2096
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2097
+ includeMatchedTerms: z.ZodOptional<z.ZodBoolean>;
2098
+ afterScore: z.ZodOptional<z.ZodNumber>;
2099
+ afterKey: z.ZodOptional<z.ZodString>;
2100
+ }, z.core.$strip>;
2101
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
2102
+ }, z.core.$strip>;
2103
+ }, z.core.$strip>;
2104
+ type ClusterSearchReqMessage = z.infer<typeof ClusterSearchReqMessageSchema>;
2105
+ declare const ClusterSearchRespPayloadSchema: z.ZodObject<{
2106
+ requestId: z.ZodString;
2107
+ nodeId: z.ZodString;
2108
+ results: z.ZodArray<z.ZodObject<{
2109
+ key: z.ZodString;
2110
+ value: z.ZodUnknown;
2111
+ score: z.ZodNumber;
2112
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2113
+ }, z.core.$strip>>;
2114
+ totalHits: z.ZodNumber;
2115
+ executionTimeMs: z.ZodNumber;
2116
+ error: z.ZodOptional<z.ZodString>;
2117
+ }, z.core.$strip>;
2118
+ type ClusterSearchRespPayload = z.infer<typeof ClusterSearchRespPayloadSchema>;
2119
+ declare const ClusterSearchRespMessageSchema: z.ZodObject<{
2120
+ type: z.ZodLiteral<"CLUSTER_SEARCH_RESP">;
2121
+ payload: z.ZodObject<{
2122
+ requestId: z.ZodString;
2123
+ nodeId: z.ZodString;
2124
+ results: z.ZodArray<z.ZodObject<{
2125
+ key: z.ZodString;
2126
+ value: z.ZodUnknown;
2127
+ score: z.ZodNumber;
2128
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2129
+ }, z.core.$strip>>;
2130
+ totalHits: z.ZodNumber;
2131
+ executionTimeMs: z.ZodNumber;
2132
+ error: z.ZodOptional<z.ZodString>;
2133
+ }, z.core.$strip>;
2134
+ }, z.core.$strip>;
2135
+ type ClusterSearchRespMessage = z.infer<typeof ClusterSearchRespMessageSchema>;
2136
+ declare const ClusterSearchSubscribePayloadSchema: z.ZodObject<{
2137
+ subscriptionId: z.ZodString;
2138
+ mapName: z.ZodString;
2139
+ query: z.ZodString;
2140
+ options: z.ZodOptional<z.ZodObject<{
2141
+ limit: z.ZodOptional<z.ZodNumber>;
2142
+ minScore: z.ZodOptional<z.ZodNumber>;
2143
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2144
+ }, z.core.$strip>>;
2145
+ }, z.core.$strip>;
2146
+ type ClusterSearchSubscribePayload = z.infer<typeof ClusterSearchSubscribePayloadSchema>;
2147
+ declare const ClusterSearchSubscribeMessageSchema: z.ZodObject<{
2148
+ type: z.ZodLiteral<"CLUSTER_SEARCH_SUBSCRIBE">;
2149
+ payload: z.ZodObject<{
2150
+ subscriptionId: z.ZodString;
2151
+ mapName: z.ZodString;
2152
+ query: z.ZodString;
2153
+ options: z.ZodOptional<z.ZodObject<{
2154
+ limit: z.ZodOptional<z.ZodNumber>;
2155
+ minScore: z.ZodOptional<z.ZodNumber>;
2156
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2157
+ }, z.core.$strip>>;
2158
+ }, z.core.$strip>;
2159
+ }, z.core.$strip>;
2160
+ type ClusterSearchSubscribeMessage = z.infer<typeof ClusterSearchSubscribeMessageSchema>;
2161
+ declare const ClusterSearchUnsubscribePayloadSchema: z.ZodObject<{
2162
+ subscriptionId: z.ZodString;
2163
+ }, z.core.$strip>;
2164
+ type ClusterSearchUnsubscribePayload = z.infer<typeof ClusterSearchUnsubscribePayloadSchema>;
2165
+ declare const ClusterSearchUnsubscribeMessageSchema: z.ZodObject<{
2166
+ type: z.ZodLiteral<"CLUSTER_SEARCH_UNSUBSCRIBE">;
2167
+ payload: z.ZodObject<{
2168
+ subscriptionId: z.ZodString;
2169
+ }, z.core.$strip>;
2170
+ }, z.core.$strip>;
2171
+ type ClusterSearchUnsubscribeMessage = z.infer<typeof ClusterSearchUnsubscribeMessageSchema>;
2172
+ declare const ClusterSearchUpdatePayloadSchema: z.ZodObject<{
2173
+ subscriptionId: z.ZodString;
2174
+ nodeId: z.ZodString;
2175
+ key: z.ZodString;
2176
+ value: z.ZodUnknown;
2177
+ score: z.ZodNumber;
2178
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2179
+ type: z.ZodEnum<{
2180
+ UPDATE: "UPDATE";
2181
+ ENTER: "ENTER";
2182
+ LEAVE: "LEAVE";
2183
+ }>;
2184
+ }, z.core.$strip>;
2185
+ type ClusterSearchUpdatePayload = z.infer<typeof ClusterSearchUpdatePayloadSchema>;
2186
+ declare const ClusterSearchUpdateMessageSchema: z.ZodObject<{
2187
+ type: z.ZodLiteral<"CLUSTER_SEARCH_UPDATE">;
2188
+ payload: z.ZodObject<{
2189
+ subscriptionId: z.ZodString;
2190
+ nodeId: z.ZodString;
2191
+ key: z.ZodString;
2192
+ value: z.ZodUnknown;
2193
+ score: z.ZodNumber;
2194
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2195
+ type: z.ZodEnum<{
2196
+ UPDATE: "UPDATE";
2197
+ ENTER: "ENTER";
2198
+ LEAVE: "LEAVE";
2199
+ }>;
2200
+ }, z.core.$strip>;
2201
+ }, z.core.$strip>;
2202
+ type ClusterSearchUpdateMessage = z.infer<typeof ClusterSearchUpdateMessageSchema>;
2203
+
2204
+ declare const TopicSubSchema: z.ZodObject<{
2205
+ type: z.ZodLiteral<"TOPIC_SUB">;
2206
+ payload: z.ZodObject<{
2207
+ topic: z.ZodString;
2208
+ }, z.core.$strip>;
2209
+ }, z.core.$strip>;
2210
+ declare const TopicUnsubSchema: z.ZodObject<{
2211
+ type: z.ZodLiteral<"TOPIC_UNSUB">;
2212
+ payload: z.ZodObject<{
2213
+ topic: z.ZodString;
2214
+ }, z.core.$strip>;
2215
+ }, z.core.$strip>;
2216
+ declare const TopicPubSchema: z.ZodObject<{
2217
+ type: z.ZodLiteral<"TOPIC_PUB">;
2218
+ payload: z.ZodObject<{
2219
+ topic: z.ZodString;
2220
+ data: z.ZodAny;
2221
+ }, z.core.$strip>;
2222
+ }, z.core.$strip>;
2223
+ declare const TopicMessageEventSchema: z.ZodObject<{
2224
+ type: z.ZodLiteral<"TOPIC_MESSAGE">;
2225
+ payload: z.ZodObject<{
2226
+ topic: z.ZodString;
2227
+ data: z.ZodAny;
2228
+ publisherId: z.ZodOptional<z.ZodString>;
2229
+ timestamp: z.ZodNumber;
2230
+ }, z.core.$strip>;
2231
+ }, z.core.$strip>;
2232
+ declare const LockRequestSchema: z.ZodObject<{
2233
+ type: z.ZodLiteral<"LOCK_REQUEST">;
2234
+ payload: z.ZodObject<{
2235
+ requestId: z.ZodString;
2236
+ name: z.ZodString;
2237
+ ttl: z.ZodOptional<z.ZodNumber>;
2238
+ }, z.core.$strip>;
2239
+ }, z.core.$strip>;
2240
+ declare const LockReleaseSchema: z.ZodObject<{
2241
+ type: z.ZodLiteral<"LOCK_RELEASE">;
2242
+ payload: z.ZodObject<{
2243
+ requestId: z.ZodOptional<z.ZodString>;
2244
+ name: z.ZodString;
2245
+ fencingToken: z.ZodNumber;
2246
+ }, z.core.$strip>;
2247
+ }, z.core.$strip>;
2248
+ declare const PNCounterStateObjectSchema: z.ZodObject<{
2249
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
2250
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
2251
+ }, z.core.$strip>;
2252
+ declare const CounterRequestSchema: z.ZodObject<{
2253
+ type: z.ZodLiteral<"COUNTER_REQUEST">;
2254
+ payload: z.ZodObject<{
2255
+ name: z.ZodString;
2256
+ }, z.core.$strip>;
2257
+ }, z.core.$strip>;
2258
+ declare const CounterSyncSchema: z.ZodObject<{
2259
+ type: z.ZodLiteral<"COUNTER_SYNC">;
2260
+ payload: z.ZodObject<{
2261
+ name: z.ZodString;
2262
+ state: z.ZodObject<{
2263
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
2264
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
2265
+ }, z.core.$strip>;
2266
+ }, z.core.$strip>;
2267
+ }, z.core.$strip>;
2268
+ declare const CounterResponseSchema: z.ZodObject<{
2269
+ type: z.ZodLiteral<"COUNTER_RESPONSE">;
2270
+ payload: z.ZodObject<{
2271
+ name: z.ZodString;
2272
+ state: z.ZodObject<{
2273
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
2274
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
2275
+ }, z.core.$strip>;
2276
+ }, z.core.$strip>;
2277
+ }, z.core.$strip>;
2278
+ declare const CounterUpdateSchema: z.ZodObject<{
2279
+ type: z.ZodLiteral<"COUNTER_UPDATE">;
2280
+ payload: z.ZodObject<{
2281
+ name: z.ZodString;
2282
+ state: z.ZodObject<{
2283
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
2284
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
2285
+ }, z.core.$strip>;
2286
+ }, z.core.$strip>;
2287
+ }, z.core.$strip>;
2288
+ declare const PingMessageSchema: z.ZodObject<{
2289
+ type: z.ZodLiteral<"PING">;
2290
+ timestamp: z.ZodNumber;
2291
+ }, z.core.$strip>;
2292
+ type PingMessage = z.infer<typeof PingMessageSchema>;
2293
+ declare const PongMessageSchema: z.ZodObject<{
2294
+ type: z.ZodLiteral<"PONG">;
2295
+ timestamp: z.ZodNumber;
2296
+ serverTime: z.ZodNumber;
2297
+ }, z.core.$strip>;
2298
+ type PongMessage = z.infer<typeof PongMessageSchema>;
2299
+ declare const EntryProcessorSchema: z.ZodObject<{
2300
+ name: z.ZodString;
2301
+ code: z.ZodString;
2302
+ args: z.ZodOptional<z.ZodUnknown>;
2303
+ }, z.core.$strip>;
2304
+ declare const EntryProcessRequestSchema: z.ZodObject<{
2305
+ type: z.ZodLiteral<"ENTRY_PROCESS">;
2306
+ requestId: z.ZodString;
2307
+ mapName: z.ZodString;
2308
+ key: z.ZodString;
2309
+ processor: z.ZodObject<{
2310
+ name: z.ZodString;
2311
+ code: z.ZodString;
2312
+ args: z.ZodOptional<z.ZodUnknown>;
2313
+ }, z.core.$strip>;
2314
+ }, z.core.$strip>;
2315
+ type EntryProcessRequest = z.infer<typeof EntryProcessRequestSchema>;
2316
+ declare const EntryProcessBatchRequestSchema: z.ZodObject<{
2317
+ type: z.ZodLiteral<"ENTRY_PROCESS_BATCH">;
2318
+ requestId: z.ZodString;
2319
+ mapName: z.ZodString;
2320
+ keys: z.ZodArray<z.ZodString>;
2321
+ processor: z.ZodObject<{
2322
+ name: z.ZodString;
2323
+ code: z.ZodString;
2324
+ args: z.ZodOptional<z.ZodUnknown>;
2325
+ }, z.core.$strip>;
2326
+ }, z.core.$strip>;
2327
+ type EntryProcessBatchRequest = z.infer<typeof EntryProcessBatchRequestSchema>;
2328
+ declare const EntryProcessResponseSchema: z.ZodObject<{
2329
+ type: z.ZodLiteral<"ENTRY_PROCESS_RESPONSE">;
2330
+ requestId: z.ZodString;
2331
+ success: z.ZodBoolean;
2332
+ result: z.ZodOptional<z.ZodUnknown>;
2333
+ newValue: z.ZodOptional<z.ZodUnknown>;
2334
+ error: z.ZodOptional<z.ZodString>;
2335
+ }, z.core.$strip>;
2336
+ type EntryProcessResponse = z.infer<typeof EntryProcessResponseSchema>;
2337
+ declare const EntryProcessKeyResultSchema: z.ZodObject<{
2338
+ success: z.ZodBoolean;
2339
+ result: z.ZodOptional<z.ZodUnknown>;
2340
+ newValue: z.ZodOptional<z.ZodUnknown>;
2341
+ error: z.ZodOptional<z.ZodString>;
2342
+ }, z.core.$strip>;
2343
+ type EntryProcessKeyResult = z.infer<typeof EntryProcessKeyResultSchema>;
2344
+ declare const EntryProcessBatchResponseSchema: z.ZodObject<{
2345
+ type: z.ZodLiteral<"ENTRY_PROCESS_BATCH_RESPONSE">;
2346
+ requestId: z.ZodString;
2347
+ results: z.ZodRecord<z.ZodString, z.ZodObject<{
2348
+ success: z.ZodBoolean;
2349
+ result: z.ZodOptional<z.ZodUnknown>;
2350
+ newValue: z.ZodOptional<z.ZodUnknown>;
2351
+ error: z.ZodOptional<z.ZodString>;
2352
+ }, z.core.$strip>>;
2353
+ }, z.core.$strip>;
2354
+ type EntryProcessBatchResponse = z.infer<typeof EntryProcessBatchResponseSchema>;
2355
+ declare const JournalEventTypeSchema: z.ZodEnum<{
2356
+ PUT: "PUT";
2357
+ UPDATE: "UPDATE";
2358
+ DELETE: "DELETE";
2359
+ }>;
2360
+ declare const JournalEventDataSchema: z.ZodObject<{
2361
+ sequence: z.ZodString;
2362
+ type: z.ZodEnum<{
2363
+ PUT: "PUT";
2364
+ UPDATE: "UPDATE";
2365
+ DELETE: "DELETE";
2366
+ }>;
2367
+ mapName: z.ZodString;
2368
+ key: z.ZodString;
2369
+ value: z.ZodOptional<z.ZodUnknown>;
2370
+ previousValue: z.ZodOptional<z.ZodUnknown>;
2371
+ timestamp: z.ZodObject<{
2372
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2373
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2374
+ nodeId: z.ZodString;
2375
+ }, z.core.$strip>;
2376
+ nodeId: z.ZodString;
2377
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2378
+ }, z.core.$strip>;
2379
+ type JournalEventData = z.infer<typeof JournalEventDataSchema>;
2380
+ declare const JournalSubscribeRequestSchema: z.ZodObject<{
2381
+ type: z.ZodLiteral<"JOURNAL_SUBSCRIBE">;
2382
+ requestId: z.ZodString;
2383
+ fromSequence: z.ZodOptional<z.ZodString>;
2384
+ mapName: z.ZodOptional<z.ZodString>;
2385
+ types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2386
+ PUT: "PUT";
2387
+ UPDATE: "UPDATE";
2388
+ DELETE: "DELETE";
2389
+ }>>>;
2390
+ }, z.core.$strip>;
2391
+ type JournalSubscribeRequest = z.infer<typeof JournalSubscribeRequestSchema>;
2392
+ declare const JournalUnsubscribeRequestSchema: z.ZodObject<{
2393
+ type: z.ZodLiteral<"JOURNAL_UNSUBSCRIBE">;
2394
+ subscriptionId: z.ZodString;
2395
+ }, z.core.$strip>;
2396
+ type JournalUnsubscribeRequest = z.infer<typeof JournalUnsubscribeRequestSchema>;
2397
+ declare const JournalEventMessageSchema: z.ZodObject<{
2398
+ type: z.ZodLiteral<"JOURNAL_EVENT">;
2399
+ event: z.ZodObject<{
2400
+ sequence: z.ZodString;
2401
+ type: z.ZodEnum<{
2402
+ PUT: "PUT";
2403
+ UPDATE: "UPDATE";
2404
+ DELETE: "DELETE";
2405
+ }>;
2406
+ mapName: z.ZodString;
2407
+ key: z.ZodString;
2408
+ value: z.ZodOptional<z.ZodUnknown>;
2409
+ previousValue: z.ZodOptional<z.ZodUnknown>;
2410
+ timestamp: z.ZodObject<{
2411
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2412
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2413
+ nodeId: z.ZodString;
2414
+ }, z.core.$strip>;
2415
+ nodeId: z.ZodString;
2416
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2417
+ }, z.core.$strip>;
2418
+ }, z.core.$strip>;
2419
+ type JournalEventMessage = z.infer<typeof JournalEventMessageSchema>;
2420
+ declare const JournalReadRequestSchema: z.ZodObject<{
2421
+ type: z.ZodLiteral<"JOURNAL_READ">;
2422
+ requestId: z.ZodString;
2423
+ fromSequence: z.ZodString;
2424
+ limit: z.ZodOptional<z.ZodNumber>;
2425
+ mapName: z.ZodOptional<z.ZodString>;
2426
+ }, z.core.$strip>;
2427
+ type JournalReadRequest = z.infer<typeof JournalReadRequestSchema>;
2428
+ declare const JournalReadResponseSchema: z.ZodObject<{
2429
+ type: z.ZodLiteral<"JOURNAL_READ_RESPONSE">;
2430
+ requestId: z.ZodString;
2431
+ events: z.ZodArray<z.ZodObject<{
2432
+ sequence: z.ZodString;
2433
+ type: z.ZodEnum<{
2434
+ PUT: "PUT";
2435
+ UPDATE: "UPDATE";
2436
+ DELETE: "DELETE";
2437
+ }>;
2438
+ mapName: z.ZodString;
2439
+ key: z.ZodString;
2440
+ value: z.ZodOptional<z.ZodUnknown>;
2441
+ previousValue: z.ZodOptional<z.ZodUnknown>;
2442
+ timestamp: z.ZodObject<{
2443
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2444
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2445
+ nodeId: z.ZodString;
2446
+ }, z.core.$strip>;
2447
+ nodeId: z.ZodString;
2448
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2449
+ }, z.core.$strip>>;
2450
+ hasMore: z.ZodBoolean;
2451
+ }, z.core.$strip>;
2452
+ type JournalReadResponse = z.infer<typeof JournalReadResponseSchema>;
2143
2453
  declare const ConflictResolverSchema: z.ZodObject<{
2144
2454
  name: z.ZodString;
2145
2455
  code: z.ZodString;
2146
2456
  priority: z.ZodOptional<z.ZodNumber>;
2147
2457
  keyPattern: z.ZodOptional<z.ZodString>;
2148
2458
  }, z.core.$strip>;
2149
- /**
2150
- * REGISTER_RESOLVER: Client registers a conflict resolver on server.
2151
- */
2459
+ type ConflictResolver = z.infer<typeof ConflictResolverSchema>;
2152
2460
  declare const RegisterResolverRequestSchema: z.ZodObject<{
2153
2461
  type: z.ZodLiteral<"REGISTER_RESOLVER">;
2154
2462
  requestId: z.ZodString;
@@ -2160,36 +2468,28 @@ declare const RegisterResolverRequestSchema: z.ZodObject<{
2160
2468
  keyPattern: z.ZodOptional<z.ZodString>;
2161
2469
  }, z.core.$strip>;
2162
2470
  }, z.core.$strip>;
2163
- /**
2164
- * REGISTER_RESOLVER_RESPONSE: Server acknowledges resolver registration.
2165
- */
2471
+ type RegisterResolverRequest = z.infer<typeof RegisterResolverRequestSchema>;
2166
2472
  declare const RegisterResolverResponseSchema: z.ZodObject<{
2167
2473
  type: z.ZodLiteral<"REGISTER_RESOLVER_RESPONSE">;
2168
2474
  requestId: z.ZodString;
2169
2475
  success: z.ZodBoolean;
2170
2476
  error: z.ZodOptional<z.ZodString>;
2171
2477
  }, z.core.$strip>;
2172
- /**
2173
- * UNREGISTER_RESOLVER: Client unregisters a conflict resolver.
2174
- */
2478
+ type RegisterResolverResponse = z.infer<typeof RegisterResolverResponseSchema>;
2175
2479
  declare const UnregisterResolverRequestSchema: z.ZodObject<{
2176
2480
  type: z.ZodLiteral<"UNREGISTER_RESOLVER">;
2177
2481
  requestId: z.ZodString;
2178
2482
  mapName: z.ZodString;
2179
2483
  resolverName: z.ZodString;
2180
2484
  }, z.core.$strip>;
2181
- /**
2182
- * UNREGISTER_RESOLVER_RESPONSE: Server acknowledges resolver unregistration.
2183
- */
2485
+ type UnregisterResolverRequest = z.infer<typeof UnregisterResolverRequestSchema>;
2184
2486
  declare const UnregisterResolverResponseSchema: z.ZodObject<{
2185
2487
  type: z.ZodLiteral<"UNREGISTER_RESOLVER_RESPONSE">;
2186
2488
  requestId: z.ZodString;
2187
2489
  success: z.ZodBoolean;
2188
2490
  error: z.ZodOptional<z.ZodString>;
2189
2491
  }, z.core.$strip>;
2190
- /**
2191
- * MERGE_REJECTED: Server notifies client that a merge was rejected.
2192
- */
2492
+ type UnregisterResolverResponse = z.infer<typeof UnregisterResolverResponseSchema>;
2193
2493
  declare const MergeRejectedMessageSchema: z.ZodObject<{
2194
2494
  type: z.ZodLiteral<"MERGE_REJECTED">;
2195
2495
  mapName: z.ZodString;
@@ -2202,17 +2502,13 @@ declare const MergeRejectedMessageSchema: z.ZodObject<{
2202
2502
  nodeId: z.ZodString;
2203
2503
  }, z.core.$strip>;
2204
2504
  }, z.core.$strip>;
2205
- /**
2206
- * LIST_RESOLVERS: Client requests list of registered resolvers.
2207
- */
2505
+ type MergeRejectedMessage = z.infer<typeof MergeRejectedMessageSchema>;
2208
2506
  declare const ListResolversRequestSchema: z.ZodObject<{
2209
2507
  type: z.ZodLiteral<"LIST_RESOLVERS">;
2210
2508
  requestId: z.ZodString;
2211
2509
  mapName: z.ZodOptional<z.ZodString>;
2212
2510
  }, z.core.$strip>;
2213
- /**
2214
- * LIST_RESOLVERS_RESPONSE: Server responds with registered resolvers.
2215
- */
2511
+ type ListResolversRequest = z.infer<typeof ListResolversRequestSchema>;
2216
2512
  declare const ListResolversResponseSchema: z.ZodObject<{
2217
2513
  type: z.ZodLiteral<"LIST_RESOLVERS_RESPONSE">;
2218
2514
  requestId: z.ZodString;
@@ -2223,61 +2519,213 @@ declare const ListResolversResponseSchema: z.ZodObject<{
2223
2519
  keyPattern: z.ZodOptional<z.ZodString>;
2224
2520
  }, z.core.$strip>>;
2225
2521
  }, z.core.$strip>;
2226
- /**
2227
- * Individual operation result within a batch ACK
2228
- */
2229
- declare const OpResultSchema: z.ZodObject<{
2230
- opId: z.ZodString;
2231
- success: z.ZodBoolean;
2232
- achievedLevel: z.ZodEnum<{
2233
- FIRE_AND_FORGET: "FIRE_AND_FORGET";
2234
- MEMORY: "MEMORY";
2235
- APPLIED: "APPLIED";
2236
- REPLICATED: "REPLICATED";
2237
- PERSISTED: "PERSISTED";
2522
+ type ListResolversResponse = z.infer<typeof ListResolversResponseSchema>;
2523
+
2524
+ declare const ServerEventPayloadSchema: z.ZodObject<{
2525
+ mapName: z.ZodString;
2526
+ eventType: z.ZodEnum<{
2527
+ PUT: "PUT";
2528
+ REMOVE: "REMOVE";
2529
+ OR_ADD: "OR_ADD";
2530
+ OR_REMOVE: "OR_REMOVE";
2238
2531
  }>;
2239
- error: z.ZodOptional<z.ZodString>;
2532
+ key: z.ZodString;
2533
+ record: z.ZodOptional<z.ZodObject<{
2534
+ value: z.ZodNullable<z.ZodAny>;
2535
+ timestamp: z.ZodObject<{
2536
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2537
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2538
+ nodeId: z.ZodString;
2539
+ }, z.core.$strip>;
2540
+ ttlMs: z.ZodOptional<z.ZodNumber>;
2541
+ }, z.core.$strip>>;
2542
+ orRecord: z.ZodOptional<z.ZodObject<{
2543
+ value: z.ZodAny;
2544
+ timestamp: z.ZodObject<{
2545
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2546
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2547
+ nodeId: z.ZodString;
2548
+ }, z.core.$strip>;
2549
+ tag: z.ZodString;
2550
+ ttlMs: z.ZodOptional<z.ZodNumber>;
2551
+ }, z.core.$strip>>;
2552
+ orTag: z.ZodOptional<z.ZodString>;
2240
2553
  }, z.core.$strip>;
2241
- /**
2242
- * OP_ACK: Server acknowledges write operations
2243
- * Extended to support Write Concern levels
2244
- */
2245
- declare const OpAckMessageSchema: z.ZodObject<{
2246
- type: z.ZodLiteral<"OP_ACK">;
2554
+ type ServerEventPayload = z.infer<typeof ServerEventPayloadSchema>;
2555
+ declare const ServerEventMessageSchema: z.ZodObject<{
2556
+ type: z.ZodLiteral<"SERVER_EVENT">;
2247
2557
  payload: z.ZodObject<{
2248
- lastId: z.ZodString;
2249
- achievedLevel: z.ZodOptional<z.ZodEnum<{
2250
- FIRE_AND_FORGET: "FIRE_AND_FORGET";
2251
- MEMORY: "MEMORY";
2252
- APPLIED: "APPLIED";
2253
- REPLICATED: "REPLICATED";
2254
- PERSISTED: "PERSISTED";
2255
- }>>;
2256
- results: z.ZodOptional<z.ZodArray<z.ZodObject<{
2257
- opId: z.ZodString;
2258
- success: z.ZodBoolean;
2259
- achievedLevel: z.ZodEnum<{
2260
- FIRE_AND_FORGET: "FIRE_AND_FORGET";
2261
- MEMORY: "MEMORY";
2262
- APPLIED: "APPLIED";
2263
- REPLICATED: "REPLICATED";
2264
- PERSISTED: "PERSISTED";
2558
+ mapName: z.ZodString;
2559
+ eventType: z.ZodEnum<{
2560
+ PUT: "PUT";
2561
+ REMOVE: "REMOVE";
2562
+ OR_ADD: "OR_ADD";
2563
+ OR_REMOVE: "OR_REMOVE";
2564
+ }>;
2565
+ key: z.ZodString;
2566
+ record: z.ZodOptional<z.ZodObject<{
2567
+ value: z.ZodNullable<z.ZodAny>;
2568
+ timestamp: z.ZodObject<{
2569
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2570
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2571
+ nodeId: z.ZodString;
2572
+ }, z.core.$strip>;
2573
+ ttlMs: z.ZodOptional<z.ZodNumber>;
2574
+ }, z.core.$strip>>;
2575
+ orRecord: z.ZodOptional<z.ZodObject<{
2576
+ value: z.ZodAny;
2577
+ timestamp: z.ZodObject<{
2578
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2579
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2580
+ nodeId: z.ZodString;
2581
+ }, z.core.$strip>;
2582
+ tag: z.ZodString;
2583
+ ttlMs: z.ZodOptional<z.ZodNumber>;
2584
+ }, z.core.$strip>>;
2585
+ orTag: z.ZodOptional<z.ZodString>;
2586
+ }, z.core.$strip>;
2587
+ }, z.core.$strip>;
2588
+ type ServerEventMessage = z.infer<typeof ServerEventMessageSchema>;
2589
+ declare const ServerBatchEventMessageSchema: z.ZodObject<{
2590
+ type: z.ZodLiteral<"SERVER_BATCH_EVENT">;
2591
+ payload: z.ZodObject<{
2592
+ events: z.ZodArray<z.ZodObject<{
2593
+ mapName: z.ZodString;
2594
+ eventType: z.ZodEnum<{
2595
+ PUT: "PUT";
2596
+ REMOVE: "REMOVE";
2597
+ OR_ADD: "OR_ADD";
2598
+ OR_REMOVE: "OR_REMOVE";
2265
2599
  }>;
2266
- error: z.ZodOptional<z.ZodString>;
2267
- }, z.core.$strip>>>;
2600
+ key: z.ZodString;
2601
+ record: z.ZodOptional<z.ZodObject<{
2602
+ value: z.ZodNullable<z.ZodAny>;
2603
+ timestamp: z.ZodObject<{
2604
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2605
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2606
+ nodeId: z.ZodString;
2607
+ }, z.core.$strip>;
2608
+ ttlMs: z.ZodOptional<z.ZodNumber>;
2609
+ }, z.core.$strip>>;
2610
+ orRecord: z.ZodOptional<z.ZodObject<{
2611
+ value: z.ZodAny;
2612
+ timestamp: z.ZodObject<{
2613
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2614
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2615
+ nodeId: z.ZodString;
2616
+ }, z.core.$strip>;
2617
+ tag: z.ZodString;
2618
+ ttlMs: z.ZodOptional<z.ZodNumber>;
2619
+ }, z.core.$strip>>;
2620
+ orTag: z.ZodOptional<z.ZodString>;
2621
+ }, z.core.$strip>>;
2268
2622
  }, z.core.$strip>;
2269
2623
  }, z.core.$strip>;
2270
- /**
2271
- * OP_REJECTED: Server rejects a write operation
2272
- */
2273
- declare const OpRejectedMessageSchema: z.ZodObject<{
2274
- type: z.ZodLiteral<"OP_REJECTED">;
2624
+ type ServerBatchEventMessage = z.infer<typeof ServerBatchEventMessageSchema>;
2625
+ declare const QueryUpdatePayloadSchema: z.ZodObject<{
2626
+ queryId: z.ZodString;
2627
+ key: z.ZodString;
2628
+ value: z.ZodUnknown;
2629
+ type: z.ZodEnum<{
2630
+ UPDATE: "UPDATE";
2631
+ REMOVE: "REMOVE";
2632
+ ENTER: "ENTER";
2633
+ }>;
2634
+ }, z.core.$strip>;
2635
+ type QueryUpdatePayload = z.infer<typeof QueryUpdatePayloadSchema>;
2636
+ declare const QueryUpdateMessageSchema: z.ZodObject<{
2637
+ type: z.ZodLiteral<"QUERY_UPDATE">;
2275
2638
  payload: z.ZodObject<{
2276
- opId: z.ZodString;
2277
- reason: z.ZodString;
2278
- code: z.ZodOptional<z.ZodNumber>;
2639
+ queryId: z.ZodString;
2640
+ key: z.ZodString;
2641
+ value: z.ZodUnknown;
2642
+ type: z.ZodEnum<{
2643
+ UPDATE: "UPDATE";
2644
+ REMOVE: "REMOVE";
2645
+ ENTER: "ENTER";
2646
+ }>;
2647
+ }, z.core.$strip>;
2648
+ }, z.core.$strip>;
2649
+ type QueryUpdateMessage = z.infer<typeof QueryUpdateMessageSchema>;
2650
+ declare const GcPrunePayloadSchema: z.ZodObject<{
2651
+ olderThan: z.ZodObject<{
2652
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2653
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2654
+ nodeId: z.ZodString;
2655
+ }, z.core.$strip>;
2656
+ }, z.core.$strip>;
2657
+ type GcPrunePayload = z.infer<typeof GcPrunePayloadSchema>;
2658
+ declare const GcPruneMessageSchema: z.ZodObject<{
2659
+ type: z.ZodLiteral<"GC_PRUNE">;
2660
+ payload: z.ZodObject<{
2661
+ olderThan: z.ZodObject<{
2662
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2663
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2664
+ nodeId: z.ZodString;
2665
+ }, z.core.$strip>;
2279
2666
  }, z.core.$strip>;
2280
2667
  }, z.core.$strip>;
2668
+ type GcPruneMessage = z.infer<typeof GcPruneMessageSchema>;
2669
+ declare const AuthFailMessageSchema: z.ZodObject<{
2670
+ type: z.ZodLiteral<"AUTH_FAIL">;
2671
+ error: z.ZodOptional<z.ZodString>;
2672
+ code: z.ZodOptional<z.ZodNumber>;
2673
+ }, z.core.$strip>;
2674
+ type AuthFailMessage = z.infer<typeof AuthFailMessageSchema>;
2675
+ declare const HybridQueryRespPayloadSchema: z.ZodObject<{
2676
+ subscriptionId: z.ZodString;
2677
+ results: z.ZodArray<z.ZodObject<{
2678
+ key: z.ZodString;
2679
+ value: z.ZodUnknown;
2680
+ score: z.ZodNumber;
2681
+ matchedTerms: z.ZodArray<z.ZodString>;
2682
+ }, z.core.$strip>>;
2683
+ nextCursor: z.ZodOptional<z.ZodString>;
2684
+ hasMore: z.ZodOptional<z.ZodBoolean>;
2685
+ cursorStatus: z.ZodOptional<z.ZodEnum<{
2686
+ valid: "valid";
2687
+ expired: "expired";
2688
+ invalid: "invalid";
2689
+ none: "none";
2690
+ }>>;
2691
+ }, z.core.$strip>;
2692
+ type HybridQueryRespPayload = z.infer<typeof HybridQueryRespPayloadSchema>;
2693
+ declare const HybridQueryDeltaPayloadSchema: z.ZodObject<{
2694
+ subscriptionId: z.ZodString;
2695
+ key: z.ZodString;
2696
+ value: z.ZodNullable<z.ZodUnknown>;
2697
+ score: z.ZodOptional<z.ZodNumber>;
2698
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
2699
+ type: z.ZodEnum<{
2700
+ UPDATE: "UPDATE";
2701
+ ENTER: "ENTER";
2702
+ LEAVE: "LEAVE";
2703
+ }>;
2704
+ }, z.core.$strip>;
2705
+ type HybridQueryDeltaPayload = z.infer<typeof HybridQueryDeltaPayloadSchema>;
2706
+ declare const LockGrantedPayloadSchema: z.ZodObject<{
2707
+ requestId: z.ZodString;
2708
+ fencingToken: z.ZodNumber;
2709
+ }, z.core.$strip>;
2710
+ type LockGrantedPayload = z.infer<typeof LockGrantedPayloadSchema>;
2711
+ declare const LockReleasedPayloadSchema: z.ZodObject<{
2712
+ requestId: z.ZodString;
2713
+ success: z.ZodBoolean;
2714
+ }, z.core.$strip>;
2715
+ type LockReleasedPayload = z.infer<typeof LockReleasedPayloadSchema>;
2716
+ declare const SyncResetRequiredPayloadSchema: z.ZodObject<{
2717
+ mapName: z.ZodString;
2718
+ reason: z.ZodString;
2719
+ }, z.core.$strip>;
2720
+ type SyncResetRequiredPayload = z.infer<typeof SyncResetRequiredPayloadSchema>;
2721
+ type SyncRespRootPayload = z.infer<typeof SyncRespRootMessageSchema>['payload'];
2722
+ type SyncRespBucketsPayload = z.infer<typeof SyncRespBucketsMessageSchema>['payload'];
2723
+ type SyncRespLeafPayload = z.infer<typeof SyncRespLeafMessageSchema>['payload'];
2724
+ type ORMapSyncRespRootPayload = z.infer<typeof ORMapSyncRespRootSchema>['payload'];
2725
+ type ORMapSyncRespBucketsPayload = z.infer<typeof ORMapSyncRespBucketsSchema>['payload'];
2726
+ type ORMapSyncRespLeafPayload = z.infer<typeof ORMapSyncRespLeafSchema>['payload'];
2727
+ type ORMapDiffResponsePayload = z.infer<typeof ORMapDiffResponseSchema>['payload'];
2728
+
2281
2729
  declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2282
2730
  type: z.ZodLiteral<"AUTH">;
2283
2731
  token: z.ZodString;
@@ -2294,7 +2742,7 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2294
2742
  desc: "desc";
2295
2743
  }>>>;
2296
2744
  limit: z.ZodOptional<z.ZodNumber>;
2297
- offset: z.ZodOptional<z.ZodNumber>;
2745
+ cursor: z.ZodOptional<z.ZodString>;
2298
2746
  }, z.core.$strip>;
2299
2747
  }, z.core.$strip>;
2300
2748
  }, z.core.$strip>, z.ZodObject<{
@@ -2784,47 +3232,66 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2784
3232
  payload: z.ZodObject<{
2785
3233
  subscriptionId: z.ZodString;
2786
3234
  }, z.core.$strip>;
2787
- }, z.core.$strip>], "type">;
2788
- type Query$1 = z.infer<typeof QuerySchema>;
2789
- type ClientOp = z.infer<typeof ClientOpSchema>;
2790
- type Message = z.infer<typeof MessageSchema>;
2791
- type PingMessage = z.infer<typeof PingMessageSchema>;
2792
- type PongMessage = z.infer<typeof PongMessageSchema>;
2793
- type BatchMessage = z.infer<typeof BatchMessageSchema>;
2794
- type OpAckMessage = z.infer<typeof OpAckMessageSchema>;
2795
- type OpRejectedMessage = z.infer<typeof OpRejectedMessageSchema>;
2796
- type OpResult = z.infer<typeof OpResultSchema>;
2797
- type EntryProcessRequest = z.infer<typeof EntryProcessRequestSchema>;
2798
- type EntryProcessBatchRequest = z.infer<typeof EntryProcessBatchRequestSchema>;
2799
- type EntryProcessResponse = z.infer<typeof EntryProcessResponseSchema>;
2800
- type EntryProcessBatchResponse = z.infer<typeof EntryProcessBatchResponseSchema>;
2801
- type EntryProcessKeyResult = z.infer<typeof EntryProcessKeyResultSchema>;
2802
- type JournalEventData = z.infer<typeof JournalEventDataSchema>;
2803
- type JournalSubscribeRequest = z.infer<typeof JournalSubscribeRequestSchema>;
2804
- type JournalUnsubscribeRequest = z.infer<typeof JournalUnsubscribeRequestSchema>;
2805
- type JournalEventMessage = z.infer<typeof JournalEventMessageSchema>;
2806
- type JournalReadRequest = z.infer<typeof JournalReadRequestSchema>;
2807
- type JournalReadResponse = z.infer<typeof JournalReadResponseSchema>;
2808
- type ConflictResolver = z.infer<typeof ConflictResolverSchema>;
2809
- type RegisterResolverRequest = z.infer<typeof RegisterResolverRequestSchema>;
2810
- type RegisterResolverResponse = z.infer<typeof RegisterResolverResponseSchema>;
2811
- type UnregisterResolverRequest = z.infer<typeof UnregisterResolverRequestSchema>;
2812
- type UnregisterResolverResponse = z.infer<typeof UnregisterResolverResponseSchema>;
2813
- type MergeRejectedMessage = z.infer<typeof MergeRejectedMessageSchema>;
2814
- type ListResolversRequest = z.infer<typeof ListResolversRequestSchema>;
2815
- type ListResolversResponse = z.infer<typeof ListResolversResponseSchema>;
2816
- type SearchOptions$1 = z.infer<typeof SearchOptionsSchema>;
2817
- type SearchPayload = z.infer<typeof SearchPayloadSchema>;
2818
- type SearchMessage = z.infer<typeof SearchMessageSchema>;
2819
- type SearchRespPayload = z.infer<typeof SearchRespPayloadSchema>;
2820
- type SearchRespMessage = z.infer<typeof SearchRespMessageSchema>;
2821
- type SearchUpdateType = z.infer<typeof SearchUpdateTypeSchema>;
2822
- type SearchSubPayload = z.infer<typeof SearchSubPayloadSchema>;
2823
- type SearchSubMessage = z.infer<typeof SearchSubMessageSchema>;
2824
- type SearchUpdatePayload = z.infer<typeof SearchUpdatePayloadSchema>;
2825
- type SearchUpdateMessage = z.infer<typeof SearchUpdateMessageSchema>;
2826
- type SearchUnsubPayload = z.infer<typeof SearchUnsubPayloadSchema>;
2827
- type SearchUnsubMessage = z.infer<typeof SearchUnsubMessageSchema>;
3235
+ }, z.core.$strip>, z.ZodObject<{
3236
+ type: z.ZodLiteral<"CLUSTER_SUB_REGISTER">;
3237
+ payload: z.ZodObject<{
3238
+ subscriptionId: z.ZodString;
3239
+ coordinatorNodeId: z.ZodString;
3240
+ mapName: z.ZodString;
3241
+ type: z.ZodEnum<{
3242
+ SEARCH: "SEARCH";
3243
+ QUERY: "QUERY";
3244
+ }>;
3245
+ searchQuery: z.ZodOptional<z.ZodString>;
3246
+ searchOptions: z.ZodOptional<z.ZodObject<{
3247
+ limit: z.ZodOptional<z.ZodNumber>;
3248
+ minScore: z.ZodOptional<z.ZodNumber>;
3249
+ boost: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
3250
+ }, z.core.$strip>>;
3251
+ queryPredicate: z.ZodOptional<z.ZodAny>;
3252
+ querySort: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
3253
+ asc: "asc";
3254
+ desc: "desc";
3255
+ }>>>;
3256
+ }, z.core.$strip>;
3257
+ }, z.core.$strip>, z.ZodObject<{
3258
+ type: z.ZodLiteral<"CLUSTER_SUB_ACK">;
3259
+ payload: z.ZodObject<{
3260
+ subscriptionId: z.ZodString;
3261
+ nodeId: z.ZodString;
3262
+ success: z.ZodBoolean;
3263
+ error: z.ZodOptional<z.ZodString>;
3264
+ initialResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
3265
+ key: z.ZodString;
3266
+ value: z.ZodUnknown;
3267
+ score: z.ZodOptional<z.ZodNumber>;
3268
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
3269
+ }, z.core.$strip>>>;
3270
+ totalHits: z.ZodOptional<z.ZodNumber>;
3271
+ }, z.core.$strip>;
3272
+ }, z.core.$strip>, z.ZodObject<{
3273
+ type: z.ZodLiteral<"CLUSTER_SUB_UPDATE">;
3274
+ payload: z.ZodObject<{
3275
+ subscriptionId: z.ZodString;
3276
+ sourceNodeId: z.ZodString;
3277
+ key: z.ZodString;
3278
+ value: z.ZodUnknown;
3279
+ score: z.ZodOptional<z.ZodNumber>;
3280
+ matchedTerms: z.ZodOptional<z.ZodArray<z.ZodString>>;
3281
+ changeType: z.ZodEnum<{
3282
+ UPDATE: "UPDATE";
3283
+ ENTER: "ENTER";
3284
+ LEAVE: "LEAVE";
3285
+ }>;
3286
+ timestamp: z.ZodNumber;
3287
+ }, z.core.$strip>;
3288
+ }, z.core.$strip>, z.ZodObject<{
3289
+ type: z.ZodLiteral<"CLUSTER_SUB_UNREGISTER">;
3290
+ payload: z.ZodObject<{
3291
+ subscriptionId: z.ZodString;
3292
+ }, z.core.$strip>;
3293
+ }, z.core.$strip>], "type">;
3294
+ type Message = z.infer<typeof MessageSchema>;
2828
3295
 
2829
3296
  /**
2830
3297
  * Write Concern - Configurable Acknowledgment Levels
@@ -2953,7 +3420,7 @@ declare function isWriteConcernAchieved(achieved: Set<WriteConcern>, target: Wri
2953
3420
  declare function getHighestWriteConcernLevel(achieved: Set<WriteConcern>): WriteConcern;
2954
3421
 
2955
3422
  /**
2956
- * Cluster types for Phase 4: Clustering Improvements
3423
+ * Cluster types
2957
3424
  *
2958
3425
  * These types are shared between client and server packages
2959
3426
  * for partition-aware routing and cluster communication.
@@ -3925,15 +4392,15 @@ interface LogicalQueryNode {
3925
4392
  */
3926
4393
  type Query = SimpleQueryNode | LogicalQueryNode | FTSQueryNode;
3927
4394
  /**
3928
- * Query execution options for sort/limit/offset.
4395
+ * Query execution options for sort/limit/cursor.
3929
4396
  */
3930
4397
  interface QueryOptions {
3931
4398
  /** Sort by field(s): field name -> direction */
3932
4399
  sort?: Record<string, 'asc' | 'desc'>;
3933
4400
  /** Maximum number of results to return */
3934
4401
  limit?: number;
3935
- /** Number of results to skip */
3936
- offset?: number;
4402
+ /** Cursor for pagination (replaces offset) */
4403
+ cursor?: string;
3937
4404
  }
3938
4405
  /**
3939
4406
  * Execution plan step.
@@ -4039,8 +4506,8 @@ interface QueryPlan {
4039
4506
  };
4040
4507
  /** Limit configuration */
4041
4508
  limit?: number;
4042
- /** Offset configuration */
4043
- offset?: number;
4509
+ /** Cursor for pagination (replaces offset) */
4510
+ cursor?: string;
4044
4511
  }
4045
4512
  /**
4046
4513
  * Check if a query is a simple query node.
@@ -4554,7 +5021,7 @@ declare class InvertedIndex<K, V, A extends string = string> implements Index<K,
4554
5021
  }
4555
5022
 
4556
5023
  /**
4557
- * CompoundIndex Implementation (Phase 9.03)
5024
+ * CompoundIndex Implementation
4558
5025
  *
4559
5026
  * Multi-attribute index for optimizing AND queries.
4560
5027
  * Creates a composite key from multiple attribute values for O(1) lookup.
@@ -4698,7 +5165,7 @@ interface CompoundIndexStats extends IndexStats {
4698
5165
  }
4699
5166
 
4700
5167
  /**
4701
- * Types for Adaptive Indexing System (Phase 8.02)
5168
+ * Types for Adaptive Indexing System
4702
5169
  *
4703
5170
  * Defines interfaces for query pattern tracking, index suggestions,
4704
5171
  * and auto-indexing configuration.
@@ -4732,7 +5199,7 @@ interface QueryStatistics {
4732
5199
  hasIndex: boolean;
4733
5200
  }
4734
5201
  /**
4735
- * Statistics for compound query patterns (Phase 9.03).
5202
+ * * Statistics for compound query patterns.
4736
5203
  * Tracks AND combinations of attributes for compound index suggestions.
4737
5204
  */
4738
5205
  interface CompoundQueryStatistics {
@@ -4840,7 +5307,7 @@ interface AdaptiveIndexingConfig {
4840
5307
  autoIndex?: AutoIndexConfig;
4841
5308
  }
4842
5309
  /**
4843
- * Progress callback for lazy index building (Phase 9.01).
5310
+ * * Progress callback for lazy index building.
4844
5311
  */
4845
5312
  type IndexBuildProgressCallback = (attributeName: string, progress: number, // 0-100
4846
5313
  recordsProcessed: number, totalRecords: number) => void;
@@ -4853,13 +5320,13 @@ interface IndexedMapOptions {
4853
5320
  /** Default indexing strategy (default: 'none') */
4854
5321
  defaultIndexing?: DefaultIndexingStrategy;
4855
5322
  /**
4856
- * Enable lazy index building (Phase 9.01).
5323
+ * Enable lazy index building.
4857
5324
  * When true, indexes are not built until first query.
4858
5325
  * Default: false
4859
5326
  */
4860
5327
  lazyIndexBuilding?: boolean;
4861
5328
  /**
4862
- * Callback for index building progress (Phase 9.01).
5329
+ * Callback for index building progress.
4863
5330
  * Called during lazy index materialization.
4864
5331
  */
4865
5332
  onIndexBuilding?: IndexBuildProgressCallback;
@@ -4868,7 +5335,7 @@ interface IndexedMapOptions {
4868
5335
  /**
4869
5336
  * Lazy Index Types
4870
5337
  *
4871
- * Types and interfaces for lazy index building (Phase 9.01).
5338
+ * Types and interfaces for lazy index building.
4872
5339
  * Lazy indexes defer actual index construction until first query.
4873
5340
  *
4874
5341
  * @module query/indexes/lazy/types
@@ -4917,7 +5384,7 @@ interface LazyIndexOptions {
4917
5384
  /**
4918
5385
  * LazyHashIndex Implementation
4919
5386
  *
4920
- * Hash-based index with deferred building (Phase 9.01).
5387
+ * Hash-based index with deferred building.
4921
5388
  * Records are buffered until first query, then index is materialized.
4922
5389
  *
4923
5390
  * Benefits:
@@ -4974,7 +5441,7 @@ declare class LazyHashIndex<K, V, A> implements LazyIndex<K, V, A> {
4974
5441
  /**
4975
5442
  * LazyNavigableIndex Implementation
4976
5443
  *
4977
- * Sorted index with deferred building (Phase 9.01).
5444
+ * Sorted index with deferred building.
4978
5445
  * Records are buffered until first query, then index is materialized.
4979
5446
  *
4980
5447
  * Benefits:
@@ -5043,7 +5510,7 @@ declare class LazyNavigableIndex<K, V, A extends string | number> implements Laz
5043
5510
  /**
5044
5511
  * LazyInvertedIndex Implementation
5045
5512
  *
5046
- * Full-text search index with deferred building (Phase 9.01).
5513
+ * Full-text search index with deferred building.
5047
5514
  * Records are buffered until first query, then index is materialized.
5048
5515
  *
5049
5516
  * Benefits:
@@ -6088,6 +6555,15 @@ declare function createFieldComparator<V>(field: string, direction: 'asc' | 'des
6088
6555
  * Applies offset/limit to source ResultSet.
6089
6556
  * Implements early termination for efficiency.
6090
6557
  *
6558
+ * NOTE: The offset parameter is intentionally retained in this internal component
6559
+ * even though cursor-based pagination replaced offset in the query API.
6560
+ * This class is used internally by:
6561
+ * - EventJournalService (SQL queries require numeric offset)
6562
+ * - Index result set operations where offset is computed internally
6563
+ * - Unit tests for result set behavior
6564
+ *
6565
+ * The query API (QueryOptions, QueryHandle) uses cursor-based pagination via QueryCursor.
6566
+ *
6091
6567
  * @module query/resultset/LimitResultSet
6092
6568
  */
6093
6569
 
@@ -6172,7 +6648,7 @@ declare class LimitResultSet<K> implements ResultSet<K> {
6172
6648
  declare class IndexRegistry<K, V> {
6173
6649
  /** Indexes grouped by attribute name */
6174
6650
  private attributeIndexes;
6175
- /** Compound indexes (Phase 9.03) - keyed by sorted attribute names */
6651
+ /** Compound indexes - keyed by sorted attribute names */
6176
6652
  private compoundIndexes;
6177
6653
  /** Fallback index for full scan (optional) */
6178
6654
  private fallbackIndex;
@@ -6184,7 +6660,7 @@ declare class IndexRegistry<K, V> {
6184
6660
  */
6185
6661
  addIndex<A>(index: Index<K, V, A>): void;
6186
6662
  /**
6187
- * Register a compound index (Phase 9.03).
6663
+ * Register a compound index.
6188
6664
  *
6189
6665
  * @param index - Compound index to register
6190
6666
  */
@@ -6197,7 +6673,7 @@ declare class IndexRegistry<K, V> {
6197
6673
  */
6198
6674
  removeIndex<A>(index: Index<K, V, A>): boolean;
6199
6675
  /**
6200
- * Remove a compound index (Phase 9.03).
6676
+ * Remove a compound index.
6201
6677
  *
6202
6678
  * @param index - Compound index to remove
6203
6679
  * @returns true if index was found and removed
@@ -6247,7 +6723,7 @@ declare class IndexRegistry<K, V> {
6247
6723
  */
6248
6724
  findIndexes(attributeName: string, queryType: string): Index<K, V, unknown>[];
6249
6725
  /**
6250
- * Find a compound index that covers the given attribute names (Phase 9.03).
6726
+ * Find a compound index that covers the given attribute names.
6251
6727
  * The compound index must cover ALL the attributes (exact match or superset).
6252
6728
  *
6253
6729
  * @param attributeNames - Array of attribute names to search for
@@ -6255,14 +6731,14 @@ declare class IndexRegistry<K, V> {
6255
6731
  */
6256
6732
  findCompoundIndex(attributeNames: string[]): CompoundIndex<K, V> | null;
6257
6733
  /**
6258
- * Check if a compound index exists for the given attributes (Phase 9.03).
6734
+ * Check if a compound index exists for the given attributes.
6259
6735
  *
6260
6736
  * @param attributeNames - Array of attribute names
6261
6737
  * @returns true if a compound index exists
6262
6738
  */
6263
6739
  hasCompoundIndex(attributeNames: string[]): boolean;
6264
6740
  /**
6265
- * Get all compound indexes (Phase 9.03).
6741
+ * Get all compound indexes.
6266
6742
  *
6267
6743
  * @returns Array of all compound indexes
6268
6744
  */
@@ -6331,7 +6807,7 @@ interface IndexRegistryStats {
6331
6807
  totalIndexes: number;
6332
6808
  /** Number of indexed attributes */
6333
6809
  indexedAttributes: number;
6334
- /** Number of compound indexes (Phase 9.03) */
6810
+ /** Number of compound indexes */
6335
6811
  compoundIndexes?: number;
6336
6812
  /** Stats for each index */
6337
6813
  indexes: Array<{
@@ -6524,7 +7000,7 @@ interface QueryOptimizerOptions<K, V> {
6524
7000
  indexRegistry: IndexRegistry<K, V>;
6525
7001
  /** Standing query registry for pre-computed queries (optional) */
6526
7002
  standingQueryRegistry?: StandingQueryRegistry<K, V>;
6527
- /** Full-text index registry for FTS queries (Phase 12) */
7003
+ /** Full-text index registry for FTS queries */
6528
7004
  fullTextIndexes?: Map<string, FullTextIndex>;
6529
7005
  }
6530
7006
  /**
@@ -6553,32 +7029,31 @@ declare class QueryOptimizer<K, V> {
6553
7029
  /**
6554
7030
  * Create a QueryOptimizer.
6555
7031
  *
6556
- * @param indexRegistryOrOptions - IndexRegistry or options object
6557
- * @param standingQueryRegistry - Optional StandingQueryRegistry (deprecated, use options)
7032
+ * @param options - QueryOptimizer options
6558
7033
  */
6559
- constructor(indexRegistryOrOptions: IndexRegistry<K, V> | QueryOptimizerOptions<K, V>, standingQueryRegistry?: StandingQueryRegistry<K, V>);
7034
+ constructor(options: QueryOptimizerOptions<K, V>);
6560
7035
  /**
6561
- * Register a full-text index for a field (Phase 12).
7036
+ * Register a full-text index for a field.
6562
7037
  *
6563
7038
  * @param field - Field name
6564
7039
  * @param index - FullTextIndex instance
6565
7040
  */
6566
7041
  registerFullTextIndex(field: string, index: FullTextIndex): void;
6567
7042
  /**
6568
- * Unregister a full-text index (Phase 12).
7043
+ * Unregister a full-text index.
6569
7044
  *
6570
7045
  * @param field - Field name
6571
7046
  */
6572
7047
  unregisterFullTextIndex(field: string): void;
6573
7048
  /**
6574
- * Get registered full-text index for a field (Phase 12).
7049
+ * Get registered full-text index for a field.
6575
7050
  *
6576
7051
  * @param field - Field name
6577
7052
  * @returns FullTextIndex or undefined
6578
7053
  */
6579
7054
  getFullTextIndex(field: string): FullTextIndex | undefined;
6580
7055
  /**
6581
- * Check if a full-text index exists for a field (Phase 12).
7056
+ * Check if a full-text index exists for a field.
6582
7057
  *
6583
7058
  * @param field - Field name
6584
7059
  * @returns True if FTS index exists
@@ -6608,26 +7083,26 @@ declare class QueryOptimizer<K, V> {
6608
7083
  */
6609
7084
  private optimizeNode;
6610
7085
  /**
6611
- * Optimize a full-text search query (Phase 12).
7086
+ * Optimize a full-text search query.
6612
7087
  */
6613
7088
  private optimizeFTS;
6614
7089
  /**
6615
- * Build an FTS scan step from a query node (Phase 12).
7090
+ * Build an FTS scan step from a query node.
6616
7091
  */
6617
7092
  private buildFTSScanStep;
6618
7093
  /**
6619
- * Estimate cost of FTS query based on index size (Phase 12).
7094
+ * Estimate cost of FTS query based on index size.
6620
7095
  */
6621
7096
  private estimateFTSCost;
6622
7097
  /**
6623
- * Classify predicates by type for hybrid query planning (Phase 12).
7098
+ * Classify predicates by type for hybrid query planning.
6624
7099
  *
6625
7100
  * @param predicates - Array of predicates to classify
6626
7101
  * @returns Classified predicates
6627
7102
  */
6628
7103
  classifyPredicates(predicates: Query[]): ClassifiedPredicates;
6629
7104
  /**
6630
- * Determine fusion strategy based on step types (Phase 12).
7105
+ * Determine fusion strategy based on step types.
6631
7106
  *
6632
7107
  * Strategy selection:
6633
7108
  * - All binary (exact/range with no scores) → 'intersection'
@@ -6639,7 +7114,7 @@ declare class QueryOptimizer<K, V> {
6639
7114
  */
6640
7115
  determineFusionStrategy(steps: PlanStep[]): FusionStrategy;
6641
7116
  /**
6642
- * Check if a plan step returns scored results (Phase 12).
7117
+ * Check if a plan step returns scored results.
6643
7118
  */
6644
7119
  private stepReturnsScored;
6645
7120
  /**
@@ -6655,14 +7130,14 @@ declare class QueryOptimizer<K, V> {
6655
7130
  * Strategy: Find child with lowest cost, use as base, filter with rest.
6656
7131
  *
6657
7132
  * CQEngine "smallest first" strategy:
6658
- * 1. Check for CompoundIndex covering all eq children (Phase 9.03)
7133
+ * 1. Check for CompoundIndex covering all eq children
6659
7134
  * 2. Sort children by merge cost
6660
7135
  * 3. Use intersection if multiple indexes available
6661
7136
  * 4. Apply remaining predicates as filters
6662
7137
  */
6663
7138
  private optimizeAnd;
6664
7139
  /**
6665
- * Try to use a CompoundIndex for an AND query (Phase 9.03).
7140
+ * Try to use a CompoundIndex for an AND query.
6666
7141
  *
6667
7142
  * Returns a compound index scan step if:
6668
7143
  * 1. All children are simple 'eq' queries
@@ -6867,7 +7342,7 @@ interface LiveQueryManagerStats extends StandingQueryRegistryStats {
6867
7342
  }
6868
7343
 
6869
7344
  /**
6870
- * QueryPatternTracker (Phase 8.02.1)
7345
+ * * QueryPatternTracker
6871
7346
  *
6872
7347
  * Collects runtime statistics on query execution patterns.
6873
7348
  * Used by IndexAdvisor to generate index suggestions.
@@ -6915,7 +7390,7 @@ interface QueryPatternTrackerOptions {
6915
7390
  * tracker.recordQuery('category', 'eq', 5.2, 100, false);
6916
7391
  * tracker.recordQuery('category', 'eq', 4.8, 100, false);
6917
7392
  *
6918
- * // Record compound AND queries (Phase 9.03)
7393
+ * * // Record compound AND queries
6919
7394
  * tracker.recordCompoundQuery(['status', 'category'], 10.5, 50, false);
6920
7395
  *
6921
7396
  * // Get statistics
@@ -6942,7 +7417,7 @@ declare class QueryPatternTracker {
6942
7417
  */
6943
7418
  recordQuery(attribute: string, queryType: TrackedQueryType, executionTime: number, resultSize: number, hasIndex: boolean): void;
6944
7419
  /**
6945
- * Record a compound (AND) query execution for pattern tracking (Phase 9.03).
7420
+ * Record a compound (AND) query execution for pattern tracking.
6946
7421
  *
6947
7422
  * @param attributes - Array of attribute names being queried together
6948
7423
  * @param executionTime - Query execution time in milliseconds
@@ -6951,7 +7426,7 @@ declare class QueryPatternTracker {
6951
7426
  */
6952
7427
  recordCompoundQuery(attributes: string[], executionTime: number, resultSize: number, hasCompoundIndex: boolean): void;
6953
7428
  /**
6954
- * Get all compound query statistics (Phase 9.03).
7429
+ * Get all compound query statistics.
6955
7430
  *
6956
7431
  * @returns Array of compound query statistics, sorted by query count descending
6957
7432
  */
@@ -7057,17 +7532,17 @@ declare class QueryPatternTracker {
7057
7532
  */
7058
7533
  private pruneStale;
7059
7534
  /**
7060
- * Evict the oldest compound query entry (Phase 9.03).
7535
+ * Evict the oldest compound query entry.
7061
7536
  */
7062
7537
  private evictOldestCompound;
7063
7538
  /**
7064
- * Prune stale compound statistics (Phase 9.03).
7539
+ * Prune stale compound statistics.
7065
7540
  */
7066
7541
  private pruneStaleCompound;
7067
7542
  }
7068
7543
 
7069
7544
  /**
7070
- * IndexAdvisor (Phase 8.02.2)
7545
+ * * IndexAdvisor
7071
7546
  *
7072
7547
  * Analyzes query patterns and generates index suggestions.
7073
7548
  * Used in production mode to help developers optimize their indexes.
@@ -7222,7 +7697,7 @@ declare class IndexAdvisor {
7222
7697
  }
7223
7698
 
7224
7699
  /**
7225
- * AutoIndexManager (Phase 8.02.3)
7700
+ * * AutoIndexManager
7226
7701
  *
7227
7702
  * Automatically creates indexes based on query patterns.
7228
7703
  * Intended for development mode to simplify index management.
@@ -7370,6 +7845,313 @@ declare class AutoIndexManager<K, V> {
7370
7845
  private createIndex;
7371
7846
  }
7372
7847
 
7848
+ /**
7849
+ * QueryExecutor Implementation
7850
+ *
7851
+ * Executes query plans produced by QueryOptimizer.
7852
+ * Supports hybrid queries with FTS and traditional predicates,
7853
+ * using Reciprocal Rank Fusion (RRF) for result merging.
7854
+ *
7855
+ * @module query/QueryExecutor
7856
+ */
7857
+
7858
+ /**
7859
+ * Query result with optional score and matched terms.
7860
+ */
7861
+ interface QueryResult<K, V> {
7862
+ /** Record key */
7863
+ key: K;
7864
+ /** Record value */
7865
+ value: V;
7866
+ /** BM25 or RRF score (for ranked results) */
7867
+ score?: number;
7868
+ /** Matched search terms (for FTS results) */
7869
+ matchedTerms?: string[];
7870
+ }
7871
+ /**
7872
+ * Cursor status for debugging.
7873
+ */
7874
+ type CursorStatus = 'valid' | 'expired' | 'invalid' | 'none';
7875
+ /**
7876
+ * Extended query result with cursor info.
7877
+ */
7878
+ interface QueryResultWithCursor<K, V> {
7879
+ /** Query results */
7880
+ results: QueryResult<K, V>[];
7881
+ /** Cursor for next page (undefined if no more results) */
7882
+ nextCursor?: string;
7883
+ /** Whether more results are available */
7884
+ hasMore: boolean;
7885
+ /** Debug info: status of input cursor processing */
7886
+ cursorStatus: CursorStatus;
7887
+ }
7888
+
7889
+ /**
7890
+ * QueryCursor - Cursor-based pagination for distributed queries
7891
+ *
7892
+ * Implements opaque cursor encoding for efficient deep pagination in distributed
7893
+ * predicate-based queries. Cursors encode the last seen position per node, enabling
7894
+ * each node to resume from where it left off.
7895
+ *
7896
+ * Problem solved: With offset-based pagination in a distributed system, each node
7897
+ * must return offset+limit results, causing O(N*offset) network overhead.
7898
+ * Cursor-based pagination reduces this to O(N*limit).
7899
+ *
7900
+ * Related: SearchCursor (search/SearchCursor.ts) provides similar functionality for
7901
+ * FTS queries using BM25 scores. Both use shared base64url encoding utilities.
7902
+ *
7903
+ * Future consideration: A shared base class could extract common encode/decode
7904
+ * and timestamp validation logic, but the semantic differences (sortValue vs score,
7905
+ * configurable direction vs fixed DESC) make this a low-priority refactor.
7906
+ *
7907
+ * @module query/QueryCursor
7908
+ */
7909
+ /**
7910
+ * Internal cursor data structure for query pagination.
7911
+ * Encoded as base64url for wire transfer.
7912
+ */
7913
+ interface QueryCursorData {
7914
+ /**
7915
+ * Last seen sort values per node.
7916
+ * For single-field sort only (multi-field sort is out of scope for v1).
7917
+ */
7918
+ nodeValues: Record<string, unknown>;
7919
+ /**
7920
+ * Last seen keys per node (for tie-breaking).
7921
+ */
7922
+ nodeKeys: Record<string, string>;
7923
+ /**
7924
+ * Sort field name (must match query sort).
7925
+ */
7926
+ sortField: string;
7927
+ /**
7928
+ * Sort direction.
7929
+ */
7930
+ sortDirection: 'asc' | 'desc';
7931
+ /**
7932
+ * Hash of query predicate (for validation).
7933
+ */
7934
+ predicateHash: number;
7935
+ /**
7936
+ * Hash of sort configuration (for validation).
7937
+ */
7938
+ sortHash: number;
7939
+ /**
7940
+ * Timestamp when cursor was created (for expiration).
7941
+ */
7942
+ timestamp: number;
7943
+ }
7944
+ /**
7945
+ * Result item with node tracking for cursor generation.
7946
+ */
7947
+ interface CursorableQueryResult {
7948
+ key: string;
7949
+ sortValue: unknown;
7950
+ nodeId?: string;
7951
+ }
7952
+ /**
7953
+ * Options for cursor validation.
7954
+ */
7955
+ interface QueryCursorOptions {
7956
+ /**
7957
+ * Maximum cursor age in milliseconds.
7958
+ * Default: 10 minutes (600,000 ms)
7959
+ */
7960
+ maxAgeMs?: number;
7961
+ }
7962
+ /**
7963
+ * Default cursor expiration time (10 minutes).
7964
+ */
7965
+ declare const DEFAULT_QUERY_CURSOR_MAX_AGE_MS: number;
7966
+ /**
7967
+ * QueryCursor provides cursor-based pagination for distributed queries.
7968
+ *
7969
+ * @example
7970
+ * ```typescript
7971
+ * // Create cursor from query results
7972
+ * const cursor = QueryCursor.fromResults(
7973
+ * results,
7974
+ * { createdAt: 'desc' },
7975
+ * predicate
7976
+ * );
7977
+ *
7978
+ * // Use cursor in next query request
7979
+ * const cursorData = QueryCursor.decode(cursor);
7980
+ * if (cursorData && QueryCursor.isValid(cursorData, predicate, sort)) {
7981
+ * // Filter results using cursor position
7982
+ * const filtered = results.filter(r =>
7983
+ * QueryCursor.isAfterCursor(r, cursorData)
7984
+ * );
7985
+ * }
7986
+ * ```
7987
+ */
7988
+ declare class QueryCursor {
7989
+ /**
7990
+ * Encode cursor data to an opaque base64url string.
7991
+ *
7992
+ * @param data - Cursor data to encode
7993
+ * @returns Opaque cursor string
7994
+ */
7995
+ static encode(data: QueryCursorData): string;
7996
+ /**
7997
+ * Decode cursor string back to data.
7998
+ *
7999
+ * @param cursor - Opaque cursor string
8000
+ * @returns Decoded cursor data, or null if invalid
8001
+ */
8002
+ static decode(cursor: string): QueryCursorData | null;
8003
+ /**
8004
+ * Create a cursor from query results.
8005
+ *
8006
+ * The cursor captures the last seen position for each node that contributed
8007
+ * results, enabling efficient resumption in the next page request.
8008
+ *
8009
+ * @param results - Array of results with sort values and optional node tracking
8010
+ * @param sort - Sort configuration (single field only for v1)
8011
+ * @param predicate - Query predicate (for validation)
8012
+ * @returns Encoded cursor string
8013
+ */
8014
+ static fromResults(results: CursorableQueryResult[], sort: Record<string, 'asc' | 'desc'>, predicate?: unknown): string;
8015
+ /**
8016
+ * Create a cursor from the last result only.
8017
+ * Useful for local-only queries.
8018
+ *
8019
+ * @param lastResult - The last result in the current page
8020
+ * @param sort - Sort configuration
8021
+ * @param predicate - Query predicate
8022
+ * @returns Encoded cursor string
8023
+ */
8024
+ static fromLastResult(lastResult: CursorableQueryResult, sort: Record<string, 'asc' | 'desc'>, predicate?: unknown): string;
8025
+ /**
8026
+ * Validate that a cursor is valid for the given query.
8027
+ *
8028
+ * Checks:
8029
+ * 1. Predicate hash matches (cursor was created for this query)
8030
+ * 2. Sort hash matches (sort configuration unchanged)
8031
+ * 3. Cursor is not expired
8032
+ *
8033
+ * @param cursor - Decoded cursor data
8034
+ * @param predicate - Query predicate to validate against
8035
+ * @param sort - Sort configuration to validate against
8036
+ * @param options - Validation options
8037
+ * @returns true if cursor is valid
8038
+ */
8039
+ static isValid(cursor: QueryCursorData, predicate: unknown, sort: Record<string, 'asc' | 'desc'>, options?: QueryCursorOptions): boolean;
8040
+ /**
8041
+ * Get the cursor position for a specific node.
8042
+ *
8043
+ * @param cursor - Decoded cursor data
8044
+ * @param nodeId - Node ID to get position for (defaults to 'local')
8045
+ * @returns Position info or null if node not in cursor
8046
+ */
8047
+ static getNodePosition(cursor: QueryCursorData, nodeId?: string): {
8048
+ afterValue: unknown;
8049
+ afterKey: string;
8050
+ } | null;
8051
+ /**
8052
+ * Check if a result should be included based on cursor position.
8053
+ *
8054
+ * For ASC sort: value > cursorValue OR (value === cursorValue AND key > cursorKey)
8055
+ * For DESC sort: value < cursorValue OR (value === cursorValue AND key > cursorKey)
8056
+ *
8057
+ * @param result - Result to check
8058
+ * @param cursor - Decoded cursor data
8059
+ * @returns true if result should be included (is after cursor)
8060
+ */
8061
+ static isAfterCursor(result: CursorableQueryResult, cursor: QueryCursorData): boolean;
8062
+ /**
8063
+ * Compare two values with type-aware comparison.
8064
+ * Delegates to shared compareValues utility.
8065
+ *
8066
+ * @param a - First value
8067
+ * @param b - Second value
8068
+ * @returns Negative if a < b, 0 if equal, positive if a > b
8069
+ */
8070
+ static compareValues(a: unknown, b: unknown): number;
8071
+ /**
8072
+ * Merge multiple cursors into one.
8073
+ * Useful when combining results from multiple sub-queries or nodes.
8074
+ *
8075
+ * Keeps the furthest position for each node.
8076
+ *
8077
+ * @param cursors - Array of decoded cursor data
8078
+ * @param sort - Sort configuration
8079
+ * @param predicate - Query predicate
8080
+ * @returns New merged cursor
8081
+ */
8082
+ static merge(cursors: QueryCursorData[], sort: Record<string, 'asc' | 'desc'>, predicate?: unknown): QueryCursorData;
8083
+ /**
8084
+ * Extract sort value from a record for cursor generation.
8085
+ *
8086
+ * @param record - Record to extract sort value from
8087
+ * @param sortField - Field to extract
8088
+ * @returns Sort value
8089
+ */
8090
+ static extractSortValue(record: Record<string, unknown>, sortField: string): unknown;
8091
+ }
8092
+
8093
+ /**
8094
+ * Universal Base64URL encoding/decoding utilities.
8095
+ *
8096
+ * Works in both Node.js and browser environments.
8097
+ * Used by QueryCursor and SearchCursor for opaque cursor encoding.
8098
+ *
8099
+ * @module utils/base64url
8100
+ */
8101
+ /**
8102
+ * Encode a string to base64url format.
8103
+ * URL-safe, no padding characters.
8104
+ *
8105
+ * @param str - UTF-8 string to encode
8106
+ * @returns Base64url encoded string
8107
+ */
8108
+ declare function encodeBase64Url(str: string): string;
8109
+ /**
8110
+ * Decode a base64url string back to UTF-8.
8111
+ *
8112
+ * @param encoded - Base64url encoded string
8113
+ * @returns Decoded UTF-8 string
8114
+ * @throws Error if decoding fails
8115
+ */
8116
+ declare function decodeBase64Url(encoded: string): string;
8117
+
8118
+ /**
8119
+ * Universal value comparison utilities.
8120
+ *
8121
+ * Provides type-aware comparison for sorting and cursor-based pagination.
8122
+ * Used by QueryCursor, QueryExecutor, and other components that need
8123
+ * consistent value ordering.
8124
+ *
8125
+ * @module utils/compare
8126
+ */
8127
+ /**
8128
+ * Compare two values with type-aware comparison.
8129
+ *
8130
+ * Comparison order:
8131
+ * 1. null/undefined (always less than defined values)
8132
+ * 2. Numbers (numeric comparison)
8133
+ * 3. Date objects (by timestamp)
8134
+ * 4. Strings (ISO date parsing attempted, then localeCompare)
8135
+ * 5. Booleans (false < true)
8136
+ * 6. Fallback: string conversion and localeCompare
8137
+ *
8138
+ * @param a - First value
8139
+ * @param b - Second value
8140
+ * @returns Negative if a < b, 0 if equal, positive if a > b
8141
+ *
8142
+ * @example
8143
+ * ```typescript
8144
+ * compareValues(1, 2); // -1
8145
+ * compareValues('b', 'a'); // 1
8146
+ * compareValues(null, 1); // -1
8147
+ * compareValues(new Date('2024-01-01'), new Date('2024-01-02')); // -86400000
8148
+ * ```
8149
+ */
8150
+ declare function compareValues(a: unknown, b: unknown): number;
8151
+
8152
+ declare const logger: pino.Logger<never, boolean>;
8153
+ type Logger = typeof logger;
8154
+
7373
8155
  /**
7374
8156
  * IndexedLWWMap Implementation
7375
8157
  *
@@ -7381,7 +8163,7 @@ declare class AutoIndexManager<K, V> {
7381
8163
  * - Live queries with StandingQueryIndex
7382
8164
  * - Automatic index updates on CRDT operations
7383
8165
  * - Cost-based query optimization
7384
- * - Adaptive indexing with query pattern tracking (Phase 8.02)
8166
+ * - Adaptive indexing with query pattern tracking
7385
8167
  *
7386
8168
  * @module IndexedLWWMap
7387
8169
  */
@@ -7474,7 +8256,7 @@ declare class IndexedLWWMap<K extends string, V> extends LWWMap<K, V> {
7474
8256
  * Execute a query using indexes.
7475
8257
  * Returns lazy ResultSet of matching keys.
7476
8258
  *
7477
- * Also tracks query patterns for adaptive indexing (Phase 8.02).
8259
+ * Also tracks query patterns for adaptive indexing.
7478
8260
  *
7479
8261
  * @param query - Query to execute
7480
8262
  * @returns ResultSet of matching keys
@@ -7698,7 +8480,7 @@ declare class IndexedLWWMap<K extends string, V> extends LWWMap<K, V> {
7698
8480
  * - Composite key indexing (key:tag)
7699
8481
  * - Automatic index updates on CRDT operations
7700
8482
  * - Lazy filtering for tombstones
7701
- * - Adaptive indexing with query pattern tracking (Phase 8.02)
8483
+ * - Adaptive indexing with query pattern tracking
7702
8484
  *
7703
8485
  * @module IndexedORMap
7704
8486
  */
@@ -7852,7 +8634,7 @@ declare class IndexedORMap<K extends string, V> extends ORMap<K, V> {
7852
8634
  * Execute a query across all records.
7853
8635
  * Returns array of matching results with key, tag, and value.
7854
8636
  *
7855
- * Also tracks query patterns for adaptive indexing (Phase 8.02).
8637
+ * Also tracks query patterns for adaptive indexing.
7856
8638
  *
7857
8639
  * @param query - Query to execute
7858
8640
  * @returns Array of query results
@@ -8125,4 +8907,409 @@ declare class ReciprocalRankFusion {
8125
8907
  getK(): number;
8126
8908
  }
8127
8909
 
8128
- export { type Attribute, AuthMessageSchema, type BM25Options, BM25Scorer, type BatchMessage, BatchMessageSchema, BuiltInProcessors, BuiltInResolvers, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type WriteOptions as ClusterWriteOptions, type CompareFn, type ConflictResolver, type ConflictResolverDef, ConflictResolverDefSchema, type ConflictResolverFn, ConflictResolverSchema, type ConnectionPoolConfig, type ConnectionState, ConsistencyLevel, CounterRequestSchema, CounterResponseSchema, CounterSyncSchema, CounterUpdateSchema, DEFAULT_BACKUP_COUNT, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_EVENT_JOURNAL_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_PARTITION_ROUTER_CONFIG, DEFAULT_PROCESSOR_RATE_LIMITS, DEFAULT_REPLICATION_CONFIG, DEFAULT_RESOLVER_RATE_LIMITS, DEFAULT_STOP_WORDS, DEFAULT_WRITE_CONCERN_TIMEOUT, ENGLISH_STOPWORDS, type EntryProcessBatchRequest, EntryProcessBatchRequestSchema, type EntryProcessBatchResponse, EntryProcessBatchResponseSchema, type EntryProcessKeyResult, EntryProcessKeyResultSchema, type EntryProcessRequest, EntryProcessRequestSchema, type EntryProcessResponse, EntryProcessResponseSchema, type EntryProcessorDef, EntryProcessorDefSchema, type EntryProcessorFn, type EntryProcessorResult, EntryProcessorSchema, type EventJournal, type EventJournalConfig, EventJournalImpl, FORBIDDEN_PATTERNS, BM25InvertedIndex as FTSInvertedIndex, type SearchOptions as FTSSearchOptions, type SearchResult as FTSSearchResult, BM25Tokenizer as FTSTokenizer, type TokenizerOptions as FTSTokenizerOptions, FallbackIndex, type FilterStep, FilteringResultSet, type FullScanStep, FullTextIndex, type FullTextIndexConfig, HLC, HashIndex, type Index, type IndexQuery, IndexRegistry, type IndexRegistryStats, type IndexScanStep, type IndexStats, IndexedLWWMap, IndexedORMap, IntersectionResultSet, type IntersectionStep, InvertedIndex, type InvertedIndexStats, type IteratorFactory, type JournalEvent, type JournalEventData, JournalEventDataSchema, type JournalEventInput, type JournalEventListener, type JournalEventMessage, JournalEventMessageSchema, type JournalEventType, JournalEventTypeSchema, type JournalReadRequest, JournalReadRequestSchema, type JournalReadResponse, JournalReadResponseSchema, type JournalSubscribeRequest, JournalSubscribeRequestSchema, type JournalUnsubscribeRequest, JournalUnsubscribeRequestSchema, LWWMap, type LWWRecord, LWWRecordSchema, LazyResultSet, LimitResultSet, type ListResolversRequest, ListResolversRequestSchema, type ListResolversResponse, ListResolversResponseSchema, type LiveQueryCallback, type LiveQueryDeltaEvent, type LiveQueryEvent, type LiveQueryInitialEvent, LiveQueryManager, type LiveQueryManagerOptions, type LiveQueryManagerStats, LockReleaseSchema, LockRequestSchema, type LogicalQueryNode, LowercaseFilter, type MatchOptions, MaxLengthFilter, type MergeContext, type MergeKeyResult, type MergeRejectedMessage, MergeRejectedMessageSchema, type MergeRejection, type MergeResult, type MergedResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, MinLengthFilter, MultiValueAttribute, NGramTokenizer, NavigableIndex, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, type NotStep, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapQueryResult, type ORMapRecord, ORMapRecordSchema, type ORMapSearchResult, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, PARTITION_COUNT, type PNCounter, type PNCounterConfig, PNCounterImpl, type PNCounterState, type PNCounterStateObject, PNCounterStateObjectSchema, 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 PlanStep, type PongMessage, PongMessageSchema, type Posting, type PredicateFn, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type ProcessorRateLimitConfig, type Query$1 as Query, type Query as QueryExpression, type QueryNode, QueryOptimizer, type QueryOptimizerOptions, type QueryOptions, type QueryPlan, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, RESOLVER_FORBIDDEN_PATTERNS, type RRFConfig, type RankedResult, ReciprocalRankFusion, type RegisterResolverRequest, RegisterResolverRequestSchema, type RegisterResolverResponse, RegisterResolverResponseSchema, type ReplicationAckMessage, type ReplicationBatchAckMessage, type ReplicationBatchMessage, type ReplicationConfig, type ReplicationHealth, type ReplicationLag, type ReplicationMessage, type ReplicationProtocolMessage, type ReplicationResult, type ReplicationTask, type ResolverRateLimitConfig, type ResultSet, Ringbuffer, type RoutingError, type ScoredDocument, type SearchMessage, SearchMessageSchema, type SearchOptions$1 as SearchOptions, SearchOptionsSchema, type SearchPayload, SearchPayloadSchema, type SearchRespMessage, SearchRespMessageSchema, type SearchRespPayload, SearchRespPayloadSchema, type SearchSubMessage, SearchSubMessageSchema, type SearchSubPayload, SearchSubPayloadSchema, type SearchUnsubMessage, SearchUnsubMessageSchema, type SearchUnsubPayload, SearchUnsubPayloadSchema, type SearchUpdateMessage, SearchUpdateMessageSchema, type SearchUpdatePayload, SearchUpdatePayloadSchema, type SearchUpdateType, SearchUpdateTypeSchema, type SerializedIndex, SetResultSet, SimpleAttribute, type SimpleQueryNode, SortedMap, SortedResultSet, type StaleMapError, type StandingQueryChange, StandingQueryIndex, type StandingQueryIndexOptions, StandingQueryRegistry, type StandingQueryRegistryOptions, type StandingQueryRegistryStats, StopWordFilter, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type TermInfo, type Timestamp, TimestampSchema, type TokenFilter, TokenizationPipeline, type TokenizationPipelineOptions, type Tokenizer, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, TrimFilter, UnionResultSet, type UnionStep, UniqueFilter, type UnregisterResolverRequest, UnregisterResolverRequestSchema, type UnregisterResolverResponse, UnregisterResolverResponseSchema, WRITE_CONCERN_ORDER, WhitespaceTokenizer, WordBoundaryTokenizer, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareHLCTimestamps, compareTimestamps, createFieldComparator, createPredicateMatcher, deepMerge, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isLogicalQuery, isSimpleQuery, isUsingNativeHash, isWriteConcernAchieved, multiAttribute, porterStem, resetNativeHash, serialize, simpleAttribute, timestampToString, validateProcessorCode, validateResolverCode };
8910
+ /**
8911
+ * SearchCursor - Cursor-based pagination for distributed search
8912
+ *
8913
+ * Implements opaque cursor encoding for efficient deep pagination in distributed
8914
+ * search queries. Cursors encode the last seen position per node, enabling
8915
+ * each node to resume from where it left off.
8916
+ *
8917
+ * Problem solved: With offset-based pagination in a distributed system, each node
8918
+ * must return offset+limit results, causing O(N*offset) network overhead.
8919
+ * Cursor-based pagination reduces this to O(N*limit).
8920
+ *
8921
+ * Related: QueryCursor (query/QueryCursor.ts) provides similar functionality for
8922
+ * predicate-based queries. Both use shared base64url encoding utilities.
8923
+ *
8924
+ * Future consideration: A shared base class could extract common encode/decode
8925
+ * and timestamp validation logic, but the semantic differences (score vs sortValue,
8926
+ * fixed DESC vs configurable direction) make this a low-priority refactor.
8927
+ *
8928
+ * @module search/SearchCursor
8929
+ */
8930
+ /**
8931
+ * Internal cursor data structure.
8932
+ * Encoded as base64url for wire transfer.
8933
+ */
8934
+ interface SearchCursorData {
8935
+ /** Last seen scores per node */
8936
+ nodeScores: Record<string, number>;
8937
+ /** Last seen keys per node (for tie-breaking when scores are equal) */
8938
+ nodeKeys: Record<string, string>;
8939
+ /** Hash of original query (for validation) */
8940
+ queryHash: number;
8941
+ /** Timestamp when cursor was created (for expiration) */
8942
+ timestamp: number;
8943
+ }
8944
+ /**
8945
+ * Result item with node tracking for cursor generation.
8946
+ */
8947
+ interface CursorableResult {
8948
+ key: string;
8949
+ score: number;
8950
+ nodeId: string;
8951
+ }
8952
+ /**
8953
+ * Default cursor expiration time (5 minutes).
8954
+ */
8955
+ declare const DEFAULT_CURSOR_MAX_AGE_MS: number;
8956
+ /**
8957
+ * SearchCursor provides cursor-based pagination for distributed search.
8958
+ *
8959
+ * @example
8960
+ * ```typescript
8961
+ * // Create cursor from search results
8962
+ * const cursor = SearchCursor.fromResults(results, 'machine learning');
8963
+ *
8964
+ * // Use cursor in next search request
8965
+ * const cursorData = SearchCursor.decode(cursor);
8966
+ * if (cursorData && SearchCursor.isValid(cursorData, 'machine learning')) {
8967
+ * // Each node filters: score < cursorData.nodeScores[nodeId]
8968
+ * // OR (score === nodeScores[nodeId] && key > nodeKeys[nodeId])
8969
+ * }
8970
+ * ```
8971
+ */
8972
+ declare class SearchCursor {
8973
+ /**
8974
+ * Encode cursor data to an opaque base64url string.
8975
+ *
8976
+ * @param data - Cursor data to encode
8977
+ * @returns Opaque cursor string
8978
+ */
8979
+ static encode(data: SearchCursorData): string;
8980
+ /**
8981
+ * Decode cursor string back to data.
8982
+ *
8983
+ * @param cursor - Opaque cursor string
8984
+ * @returns Decoded cursor data, or null if invalid
8985
+ */
8986
+ static decode(cursor: string): SearchCursorData | null;
8987
+ /**
8988
+ * Create a cursor from the last results of a search.
8989
+ *
8990
+ * The cursor captures the last seen position for each node that contributed
8991
+ * results, enabling efficient resumption in the next page request.
8992
+ *
8993
+ * @param results - Array of results with node tracking
8994
+ * @param query - Original query string (for validation)
8995
+ * @returns Encoded cursor string
8996
+ */
8997
+ static fromResults(results: CursorableResult[], query: string): string;
8998
+ /**
8999
+ * Create a cursor from the last result only.
9000
+ * Useful when you only have the final merged result.
9001
+ *
9002
+ * @param lastResult - The last result in the current page
9003
+ * @param query - Original query string
9004
+ * @returns Encoded cursor string
9005
+ */
9006
+ static fromLastResult(lastResult: CursorableResult, query: string): string;
9007
+ /**
9008
+ * Generate a hash for a query string.
9009
+ * Used to validate that cursor matches the current query.
9010
+ *
9011
+ * @param query - Query string to hash
9012
+ * @returns Numeric hash
9013
+ */
9014
+ static hashQuery(query: string): number;
9015
+ /**
9016
+ * Validate that a cursor is valid for the given query.
9017
+ *
9018
+ * Checks:
9019
+ * 1. Query hash matches (cursor was created for this query)
9020
+ * 2. Cursor is not expired
9021
+ *
9022
+ * @param cursor - Decoded cursor data
9023
+ * @param query - Query string to validate against
9024
+ * @param maxAgeMs - Maximum cursor age in milliseconds (default: 5 minutes)
9025
+ * @returns true if cursor is valid
9026
+ */
9027
+ static isValid(cursor: SearchCursorData, query: string, maxAgeMs?: number): boolean;
9028
+ /**
9029
+ * Get the cursor position for a specific node.
9030
+ *
9031
+ * @param cursor - Decoded cursor data
9032
+ * @param nodeId - Node ID to get position for
9033
+ * @returns Position info or null if node not in cursor
9034
+ */
9035
+ static getNodePosition(cursor: SearchCursorData, nodeId: string): {
9036
+ afterScore: number;
9037
+ afterKey: string;
9038
+ } | null;
9039
+ /**
9040
+ * Check if a result should be included based on cursor position.
9041
+ *
9042
+ * Results are ordered by score descending, then key ascending for tie-breaking.
9043
+ * A result should be included if it comes AFTER the cursor position:
9044
+ * - score < cursorScore, OR
9045
+ * - score === cursorScore AND key > cursorKey
9046
+ *
9047
+ * @param result - Result to check
9048
+ * @param cursor - Decoded cursor data
9049
+ * @returns true if result should be included (is after cursor)
9050
+ */
9051
+ static isAfterCursor(result: CursorableResult, cursor: SearchCursorData): boolean;
9052
+ /**
9053
+ * Merge multiple cursors into one.
9054
+ * Useful when combining results from multiple sub-queries.
9055
+ *
9056
+ * @param cursors - Array of decoded cursor data
9057
+ * @param query - Original query string
9058
+ * @returns New merged cursor
9059
+ */
9060
+ static merge(cursors: SearchCursorData[], query: string): SearchCursorData;
9061
+ }
9062
+
9063
+ /**
9064
+ * Snapshot of a CRDT operation for debugging and replay.
9065
+ */
9066
+ interface CRDTSnapshot {
9067
+ id: string;
9068
+ timestamp: Timestamp;
9069
+ operation: 'set' | 'delete' | 'merge';
9070
+ mapId: string;
9071
+ key?: string;
9072
+ value?: unknown;
9073
+ oldValue?: unknown;
9074
+ nodeId: string;
9075
+ merkleRoot?: string;
9076
+ metadata?: Record<string, unknown>;
9077
+ }
9078
+ /**
9079
+ * Information about a resolved conflict.
9080
+ */
9081
+ interface ConflictInfo {
9082
+ mapId: string;
9083
+ key: string;
9084
+ winnerTimestamp: Timestamp;
9085
+ winnerNodeId: string;
9086
+ winnerValue: unknown;
9087
+ loserTimestamp: Timestamp;
9088
+ loserNodeId: string;
9089
+ loserValue: unknown;
9090
+ resolvedAt: Date;
9091
+ }
9092
+ /**
9093
+ * Statistics about CRDT operations.
9094
+ */
9095
+ interface DebugStatistics {
9096
+ totalOperations: number;
9097
+ operationsByType: Record<string, number>;
9098
+ operationsByNode: Record<string, number>;
9099
+ conflictsResolved: number;
9100
+ timeRange: {
9101
+ start: Timestamp | null;
9102
+ end: Timestamp | null;
9103
+ };
9104
+ uniqueKeys: number;
9105
+ averageOpsPerSecond: number;
9106
+ }
9107
+ /**
9108
+ * Options for querying operations.
9109
+ */
9110
+ interface OperationQueryOptions {
9111
+ mapId?: string;
9112
+ nodeId?: string;
9113
+ operation?: string;
9114
+ since?: Timestamp;
9115
+ until?: Timestamp;
9116
+ limit?: number;
9117
+ }
9118
+ /**
9119
+ * CRDTDebugger - Records and analyzes CRDT operations for debugging.
9120
+ *
9121
+ * Features:
9122
+ * - Record all CRDT operations (set, delete, merge)
9123
+ * - Detect and track conflicts
9124
+ * - Replay operations to any point in time
9125
+ * - Export/import operation history
9126
+ * - Statistics and analysis
9127
+ *
9128
+ * @see PHASE_14C_OBSERVABILITY.md for specification
9129
+ */
9130
+ declare class CRDTDebugger {
9131
+ private snapshots;
9132
+ private conflicts;
9133
+ private maxSnapshots;
9134
+ private enabled;
9135
+ private idCounter;
9136
+ constructor(options?: {
9137
+ maxSnapshots?: number;
9138
+ enabled?: boolean;
9139
+ });
9140
+ isEnabled(): boolean;
9141
+ enable(): void;
9142
+ disable(): void;
9143
+ recordOperation(snapshot: Omit<CRDTSnapshot, 'id'>): void;
9144
+ recordSet(mapId: string, key: string, value: unknown, timestamp: Timestamp, nodeId: string, oldValue?: unknown, merkleRoot?: string): void;
9145
+ recordDelete(mapId: string, key: string, timestamp: Timestamp, nodeId: string, oldValue?: unknown, merkleRoot?: string): void;
9146
+ recordMerge(mapId: string, key: string, value: unknown, timestamp: Timestamp, nodeId: string, wasUpdated: boolean, oldValue?: unknown, merkleRoot?: string): void;
9147
+ recordConflict(conflict: ConflictInfo): void;
9148
+ getOperations(options?: OperationQueryOptions): CRDTSnapshot[];
9149
+ getConflicts(mapId?: string): ConflictInfo[];
9150
+ getLastOperation(): CRDTSnapshot | undefined;
9151
+ getOperationsForKey(mapId: string, key: string): CRDTSnapshot[];
9152
+ getStatistics(mapId?: string): DebugStatistics;
9153
+ /**
9154
+ * Replays operations up to the target timestamp and returns the map state.
9155
+ */
9156
+ replayUntil<K extends string, V>(targetTimestamp: Timestamp, mapId?: string, hlc?: HLC): LWWMap<K, V>;
9157
+ /**
9158
+ * Creates a timeline of operations grouped by time intervals.
9159
+ */
9160
+ getTimeline(intervalMs?: number, mapId?: string): Array<{
9161
+ timestamp: number;
9162
+ operations: CRDTSnapshot[];
9163
+ }>;
9164
+ exportHistory(format?: 'json' | 'csv' | 'ndjson'): string;
9165
+ private toCSV;
9166
+ importHistory(json: string): void;
9167
+ /**
9168
+ * Compares two points in time and returns the differences.
9169
+ */
9170
+ diff(fromTimestamp: Timestamp, toTimestamp: Timestamp, mapId?: string): {
9171
+ added: CRDTSnapshot[];
9172
+ modified: CRDTSnapshot[];
9173
+ deleted: CRDTSnapshot[];
9174
+ };
9175
+ clear(): void;
9176
+ private compareTimestamp;
9177
+ }
9178
+ declare function getCRDTDebugger(): CRDTDebugger;
9179
+ declare function resetCRDTDebugger(): void;
9180
+
9181
+ /**
9182
+ * BM25 scoring debug information.
9183
+ */
9184
+ interface BM25DebugInfo {
9185
+ score: number;
9186
+ matchedTerms: string[];
9187
+ tf: Record<string, number>;
9188
+ idf: Record<string, number>;
9189
+ fieldWeights: Record<string, number>;
9190
+ avgDocLength: number;
9191
+ docLength: number;
9192
+ k1: number;
9193
+ b: number;
9194
+ }
9195
+ /**
9196
+ * Exact match debug information.
9197
+ */
9198
+ interface ExactMatchDebugInfo {
9199
+ score: number;
9200
+ matchedFields: string[];
9201
+ boostApplied: number;
9202
+ }
9203
+ /**
9204
+ * Reciprocal Rank Fusion (RRF) debug information.
9205
+ */
9206
+ interface RRFDebugInfo {
9207
+ rank: number;
9208
+ score: number;
9209
+ k: number;
9210
+ contributingRanks: {
9211
+ source: string;
9212
+ rank: number;
9213
+ }[];
9214
+ }
9215
+ /**
9216
+ * Vector similarity debug information.
9217
+ */
9218
+ interface VectorDebugInfo {
9219
+ score: number;
9220
+ distance: number;
9221
+ similarity: 'cosine' | 'euclidean' | 'dot';
9222
+ }
9223
+ /**
9224
+ * Debug information for a single search result.
9225
+ */
9226
+ interface SearchResultDebug {
9227
+ docId: string;
9228
+ finalScore: number;
9229
+ scoreBreakdown: {
9230
+ bm25?: BM25DebugInfo;
9231
+ exact?: ExactMatchDebugInfo;
9232
+ rrf?: RRFDebugInfo;
9233
+ vector?: VectorDebugInfo;
9234
+ };
9235
+ matchedDocument?: Record<string, unknown>;
9236
+ }
9237
+ /**
9238
+ * Index statistics for a search operation.
9239
+ */
9240
+ interface SearchIndexStats {
9241
+ indexType: string;
9242
+ indexSize: number;
9243
+ termsSearched: number;
9244
+ }
9245
+ /**
9246
+ * Timing information for search operations.
9247
+ */
9248
+ interface SearchTiming {
9249
+ tokenization: number;
9250
+ indexLookup: number;
9251
+ scoring: number;
9252
+ ranking: number;
9253
+ fusion?: number;
9254
+ total: number;
9255
+ }
9256
+ /**
9257
+ * Complete debug information for a search query.
9258
+ */
9259
+ interface SearchDebugInfo {
9260
+ query: string;
9261
+ queryTokens: string[];
9262
+ mapId: string;
9263
+ searchType: 'bm25' | 'exact' | 'hybrid' | 'vector';
9264
+ totalDocuments: number;
9265
+ matchingDocuments: number;
9266
+ results: SearchResultDebug[];
9267
+ timing: SearchTiming;
9268
+ indexStats: SearchIndexStats;
9269
+ }
9270
+ /**
9271
+ * SearchDebugger - Records and analyzes search operations for debugging.
9272
+ *
9273
+ * Features:
9274
+ * - Record search queries with full debug info
9275
+ * - BM25 score breakdown per term
9276
+ * - RRF fusion explanation
9277
+ * - Timing breakdown
9278
+ * - Query history
9279
+ *
9280
+ * @see PHASE_14C_OBSERVABILITY.md for specification
9281
+ */
9282
+ declare class SearchDebugger {
9283
+ private enabled;
9284
+ private lastQuery;
9285
+ private history;
9286
+ private maxHistory;
9287
+ constructor(options?: {
9288
+ enabled?: boolean;
9289
+ maxHistory?: number;
9290
+ });
9291
+ isEnabled(): boolean;
9292
+ enable(): void;
9293
+ disable(): void;
9294
+ recordSearch(debugInfo: SearchDebugInfo): void;
9295
+ getLastQuery(): SearchDebugInfo | null;
9296
+ getHistory(): SearchDebugInfo[];
9297
+ getHistoryByMap(mapId: string): SearchDebugInfo[];
9298
+ explainResult(docId: string): SearchResultDebug | undefined;
9299
+ formatExplanation(docId: string): string;
9300
+ formatQuerySummary(): string;
9301
+ formatAllResults(): string;
9302
+ exportDebugInfo(): string;
9303
+ exportHistory(): string;
9304
+ getSearchStats(): {
9305
+ totalQueries: number;
9306
+ averageResultCount: number;
9307
+ averageLatencyMs: number;
9308
+ queryTypeBreakdown: Record<string, number>;
9309
+ };
9310
+ clear(): void;
9311
+ }
9312
+ declare function getSearchDebugger(): SearchDebugger;
9313
+ declare function resetSearchDebugger(): void;
9314
+
9315
+ export { type Attribute, type AuthFailMessage, AuthFailMessageSchema, AuthMessageSchema, type BM25DebugInfo, type BM25Options, BM25Scorer, type BatchMessage, BatchMessageSchema, BuiltInProcessors, BuiltInResolvers, CRDTDebugger, type CRDTSnapshot, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type ClusterSearchReqMessage, ClusterSearchReqMessageSchema, type ClusterSearchReqPayload, ClusterSearchReqPayloadSchema, type ClusterSearchRespMessage, ClusterSearchRespMessageSchema, type ClusterSearchRespPayload, ClusterSearchRespPayloadSchema, type ClusterSearchSubscribeMessage, ClusterSearchSubscribeMessageSchema, type ClusterSearchSubscribePayload, ClusterSearchSubscribePayloadSchema, type ClusterSearchUnsubscribeMessage, ClusterSearchUnsubscribeMessageSchema, type ClusterSearchUnsubscribePayload, ClusterSearchUnsubscribePayloadSchema, type ClusterSearchUpdateMessage, ClusterSearchUpdateMessageSchema, type ClusterSearchUpdatePayload, ClusterSearchUpdatePayloadSchema, type ClusterSubAckMessage, ClusterSubAckMessageSchema, type ClusterSubAckPayload, ClusterSubAckPayloadSchema, type ClusterSubRegisterMessage, ClusterSubRegisterMessageSchema, type ClusterSubRegisterPayload, ClusterSubRegisterPayloadSchema, type ClusterSubUnregisterMessage, ClusterSubUnregisterMessageSchema, type ClusterSubUnregisterPayload, ClusterSubUnregisterPayloadSchema, type ClusterSubUpdateMessage, ClusterSubUpdateMessageSchema, type ClusterSubUpdatePayload, ClusterSubUpdatePayloadSchema, type WriteOptions as ClusterWriteOptions, type CompareFn, type ConflictInfo, type ConflictResolver, type ConflictResolverDef, ConflictResolverDefSchema, type ConflictResolverFn, ConflictResolverSchema, type ConnectionPoolConfig, type ConnectionState, ConsistencyLevel, CounterRequestSchema, CounterResponseSchema, CounterSyncSchema, CounterUpdateSchema, type CursorStatus$1 as CursorStatus, CursorStatusSchema, type CursorableQueryResult, type CursorableResult, DEFAULT_BACKUP_COUNT, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_CURSOR_MAX_AGE_MS, DEFAULT_EVENT_JOURNAL_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_PARTITION_ROUTER_CONFIG, DEFAULT_PROCESSOR_RATE_LIMITS, DEFAULT_QUERY_CURSOR_MAX_AGE_MS, DEFAULT_REPLICATION_CONFIG, DEFAULT_RESOLVER_RATE_LIMITS, DEFAULT_STOP_WORDS, DEFAULT_WRITE_CONCERN_TIMEOUT, type DebugStatistics, ENGLISH_STOPWORDS, type EntryProcessBatchRequest, EntryProcessBatchRequestSchema, type EntryProcessBatchResponse, EntryProcessBatchResponseSchema, type EntryProcessKeyResult, EntryProcessKeyResultSchema, type EntryProcessRequest, EntryProcessRequestSchema, type EntryProcessResponse, EntryProcessResponseSchema, type EntryProcessorDef, EntryProcessorDefSchema, type EntryProcessorFn, type EntryProcessorResult, EntryProcessorSchema, type EventJournal, type EventJournalConfig, EventJournalImpl, type ExactMatchDebugInfo, FORBIDDEN_PATTERNS, BM25InvertedIndex as FTSInvertedIndex, type SearchOptions as FTSSearchOptions, type SearchResult as FTSSearchResult, BM25Tokenizer as FTSTokenizer, type TokenizerOptions as FTSTokenizerOptions, FallbackIndex, type FilterStep, FilteringResultSet, type FullScanStep, FullTextIndex, type FullTextIndexConfig, type GcPruneMessage, GcPruneMessageSchema, type GcPrunePayload, GcPrunePayloadSchema, HLC, HashIndex, type HybridQueryDeltaPayload, HybridQueryDeltaPayloadSchema, type HybridQueryRespPayload, HybridQueryRespPayloadSchema, type Index, type IndexQuery, IndexRegistry, type IndexRegistryStats, type IndexScanStep, type IndexStats, IndexedLWWMap, IndexedORMap, IntersectionResultSet, type IntersectionStep, InvertedIndex, type InvertedIndexStats, type IteratorFactory, type JournalEvent, type JournalEventData, JournalEventDataSchema, type JournalEventInput, type JournalEventListener, type JournalEventMessage, JournalEventMessageSchema, type JournalEventType, JournalEventTypeSchema, type JournalReadRequest, JournalReadRequestSchema, type JournalReadResponse, JournalReadResponseSchema, type JournalSubscribeRequest, JournalSubscribeRequestSchema, type JournalUnsubscribeRequest, JournalUnsubscribeRequestSchema, LWWMap, type LWWRecord, LWWRecordSchema, LazyResultSet, LimitResultSet, type ListResolversRequest, ListResolversRequestSchema, type ListResolversResponse, ListResolversResponseSchema, type LiveQueryCallback, type LiveQueryDeltaEvent, type LiveQueryEvent, type LiveQueryInitialEvent, LiveQueryManager, type LiveQueryManagerOptions, type LiveQueryManagerStats, type LockGrantedPayload, LockGrantedPayloadSchema, LockReleaseSchema, type LockReleasedPayload, LockReleasedPayloadSchema, LockRequestSchema, type Logger, type LogicalQueryNode, LowercaseFilter, type MatchOptions, MaxLengthFilter, type MergeContext, type MergeKeyResult, type MergeRejectedMessage, MergeRejectedMessageSchema, type MergeRejection, type MergeResult, type MergedResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, MinLengthFilter, MultiValueAttribute, NGramTokenizer, NavigableIndex, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, type NotStep, ORMap, ORMapDiffRequestSchema, type ORMapDiffResponsePayload, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapQueryResult, type ORMapRecord, ORMapRecordSchema, type ORMapSearchResult, type ORMapSnapshot, ORMapSyncInitSchema, type ORMapSyncRespBucketsPayload, ORMapSyncRespBucketsSchema, type ORMapSyncRespLeafPayload, ORMapSyncRespLeafSchema, type ORMapSyncRespRootPayload, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, type OperationQueryOptions, PARTITION_COUNT, type PNCounter, type PNCounterConfig, PNCounterImpl, type PNCounterState, type PNCounterStateObject, PNCounterStateObjectSchema, 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 PlanStep, type PongMessage, PongMessageSchema, type Posting, type PredicateFn, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type ProcessorRateLimitConfig, type Query$1 as Query, QueryCursor, type QueryCursorData, type QueryCursorOptions, type Query as QueryExpression, type QueryNode, QueryOptimizer, type QueryOptimizerOptions, type QueryOptions, type QueryPlan, type QueryRespMessage, QueryRespMessageSchema, type QueryRespPayload, QueryRespPayloadSchema, type QueryResultWithCursor, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, type QueryUpdateMessage, QueryUpdateMessageSchema, type QueryUpdatePayload, QueryUpdatePayloadSchema, RESOLVER_FORBIDDEN_PATTERNS, type RRFConfig, type RRFDebugInfo, type RankedResult, ReciprocalRankFusion, type RegisterResolverRequest, RegisterResolverRequestSchema, type RegisterResolverResponse, RegisterResolverResponseSchema, type ReplicationAckMessage, type ReplicationBatchAckMessage, type ReplicationBatchMessage, type ReplicationConfig, type ReplicationHealth, type ReplicationLag, type ReplicationMessage, type ReplicationProtocolMessage, type ReplicationResult, type ReplicationTask, type ResolverRateLimitConfig, type ResultSet, Ringbuffer, type RoutingError, type ScoredDocument, SearchCursor, type SearchCursorData, type SearchDebugInfo, SearchDebugger, type SearchIndexStats, type SearchMessage, SearchMessageSchema, type SearchOptions$1 as SearchOptions, SearchOptionsSchema, type SearchPayload, SearchPayloadSchema, type SearchRespMessage, SearchRespMessageSchema, type SearchRespPayload, SearchRespPayloadSchema, type SearchResultDebug, type SearchSubMessage, SearchSubMessageSchema, type SearchSubPayload, SearchSubPayloadSchema, type SearchTiming, type SearchUnsubMessage, SearchUnsubMessageSchema, type SearchUnsubPayload, SearchUnsubPayloadSchema, type SearchUpdateMessage, SearchUpdateMessageSchema, type SearchUpdatePayload, SearchUpdatePayloadSchema, type SearchUpdateType, SearchUpdateTypeSchema, type SerializedIndex, type ServerBatchEventMessage, ServerBatchEventMessageSchema, type ServerEventMessage, ServerEventMessageSchema, type ServerEventPayload, ServerEventPayloadSchema, SetResultSet, SimpleAttribute, type SimpleQueryNode, SortedMap, SortedResultSet, type StaleMapError, type StandingQueryChange, StandingQueryIndex, type StandingQueryIndexOptions, StandingQueryRegistry, type StandingQueryRegistryOptions, type StandingQueryRegistryStats, StopWordFilter, SyncInitMessageSchema, type SyncResetRequiredPayload, SyncResetRequiredPayloadSchema, SyncRespBucketsMessageSchema, type SyncRespBucketsPayload, SyncRespLeafMessageSchema, type SyncRespLeafPayload, SyncRespRootMessageSchema, type SyncRespRootPayload, type TermInfo, type Timestamp, TimestampSchema, type TokenFilter, TokenizationPipeline, type TokenizationPipelineOptions, type Tokenizer, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, TrimFilter, UnionResultSet, type UnionStep, UniqueFilter, type UnregisterResolverRequest, UnregisterResolverRequestSchema, type UnregisterResolverResponse, UnregisterResolverResponseSchema, type VectorDebugInfo, WRITE_CONCERN_ORDER, WhitespaceTokenizer, WordBoundaryTokenizer, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareHLCTimestamps, compareTimestamps, compareValues, createFieldComparator, createPredicateMatcher, decodeBase64Url, deepMerge, deserialize, disableNativeHash, encodeBase64Url, evaluatePredicate, getCRDTDebugger, getHighestWriteConcernLevel, getSearchDebugger, hashORMapEntry, hashORMapRecord, hashObject, hashString, isLogicalQuery, isSimpleQuery, isUsingNativeHash, isWriteConcernAchieved, logger, multiAttribute, porterStem, resetCRDTDebugger, resetNativeHash, resetSearchDebugger, serialize, simpleAttribute, timestampToString, validateProcessorCode, validateResolverCode };