@topgunbuild/core 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -402,6 +402,706 @@ declare function hashORMapRecord<V>(record: ORMapRecord<V>): number;
402
402
  */
403
403
  declare function compareTimestamps(a: Timestamp, b: Timestamp): number;
404
404
 
405
+ /**
406
+ * State of a PN Counter CRDT.
407
+ * Tracks positive and negative increments per node for convergence.
408
+ */
409
+ interface PNCounterState {
410
+ /** Positive increments per node */
411
+ positive: Map<string, number>;
412
+ /** Negative increments per node */
413
+ negative: Map<string, number>;
414
+ }
415
+ /**
416
+ * Serializable form of PNCounterState for network/storage.
417
+ */
418
+ interface PNCounterStateObject {
419
+ /** Positive increments per node as object */
420
+ p: Record<string, number>;
421
+ /** Negative increments per node as object */
422
+ n: Record<string, number>;
423
+ }
424
+ /**
425
+ * Configuration for creating a PN Counter.
426
+ */
427
+ interface PNCounterConfig {
428
+ /** Unique node identifier for this counter instance */
429
+ nodeId: string;
430
+ /** Initial state to restore from */
431
+ initialState?: PNCounterState;
432
+ }
433
+ /**
434
+ * Interface for PN Counter CRDT.
435
+ */
436
+ interface PNCounter {
437
+ /** Get current value */
438
+ get(): number;
439
+ /** Increment by 1, return new value */
440
+ increment(): number;
441
+ /** Decrement by 1, return new value */
442
+ decrement(): number;
443
+ /** Add delta (positive or negative), return new value */
444
+ addAndGet(delta: number): number;
445
+ /** Get state for sync */
446
+ getState(): PNCounterState;
447
+ /** Merge remote state */
448
+ merge(remote: PNCounterState): void;
449
+ /** Subscribe to value changes */
450
+ subscribe(listener: (value: number) => void): () => void;
451
+ }
452
+ /**
453
+ * Positive-Negative Counter CRDT implementation.
454
+ *
455
+ * A PN Counter is a CRDT that supports increment and decrement operations
456
+ * on any node, works offline, and guarantees convergence without coordination.
457
+ *
458
+ * How it works:
459
+ * - Tracks positive increments per node in a G-Counter
460
+ * - Tracks negative increments per node in another G-Counter
461
+ * - Value = sum(positive) - sum(negative)
462
+ * - Merge takes max for each node in both counters
463
+ *
464
+ * @example
465
+ * ```typescript
466
+ * const counter = new PNCounterImpl({ nodeId: 'node-1' });
467
+ * counter.increment(); // 1
468
+ * counter.increment(); // 2
469
+ * counter.decrement(); // 1
470
+ * counter.addAndGet(5); // 6
471
+ * ```
472
+ */
473
+ declare class PNCounterImpl implements PNCounter {
474
+ private readonly nodeId;
475
+ private state;
476
+ private listeners;
477
+ constructor(config: PNCounterConfig);
478
+ /**
479
+ * Get the current counter value.
480
+ * Value = sum(positive) - sum(negative)
481
+ */
482
+ get(): number;
483
+ /**
484
+ * Increment by 1 and return the new value.
485
+ */
486
+ increment(): number;
487
+ /**
488
+ * Decrement by 1 and return the new value.
489
+ */
490
+ decrement(): number;
491
+ /**
492
+ * Add a delta (positive or negative) and return the new value.
493
+ * @param delta The amount to add (can be negative)
494
+ */
495
+ addAndGet(delta: number): number;
496
+ /**
497
+ * Get a copy of the current state for synchronization.
498
+ */
499
+ getState(): PNCounterState;
500
+ /**
501
+ * Merge remote state into this counter.
502
+ * Takes the maximum value for each node in both positive and negative counters.
503
+ * This operation is commutative, associative, and idempotent (CRDT properties).
504
+ *
505
+ * @param remote The remote state to merge
506
+ */
507
+ merge(remote: PNCounterState): void;
508
+ /**
509
+ * Subscribe to value changes.
510
+ * The listener is immediately called with the current value.
511
+ *
512
+ * @param listener Callback function receiving the new value
513
+ * @returns Unsubscribe function
514
+ */
515
+ subscribe(listener: (value: number) => void): () => void;
516
+ private notifyListeners;
517
+ /**
518
+ * Get the node ID of this counter instance.
519
+ */
520
+ getNodeId(): string;
521
+ /**
522
+ * Serialize state to binary format (msgpack).
523
+ */
524
+ static serialize(state: PNCounterState): Uint8Array;
525
+ /**
526
+ * Deserialize binary data to state.
527
+ */
528
+ static deserialize(data: Uint8Array): PNCounterState;
529
+ /**
530
+ * Convert state to plain object (for JSON/network).
531
+ */
532
+ static stateToObject(state: PNCounterState): PNCounterStateObject;
533
+ /**
534
+ * Convert plain object to state.
535
+ */
536
+ static objectToState(obj: PNCounterStateObject): PNCounterState;
537
+ }
538
+
539
+ /**
540
+ * Fixed-size circular buffer with sequence numbers.
541
+ * Older entries are overwritten when capacity is reached.
542
+ *
543
+ * @template T - Type of items stored in the buffer
544
+ */
545
+ declare class Ringbuffer<T> {
546
+ private buffer;
547
+ private readonly _capacity;
548
+ private headSequence;
549
+ private tailSequence;
550
+ constructor(capacity: number);
551
+ /**
552
+ * Add item to buffer, returns sequence number.
553
+ */
554
+ add(item: T): bigint;
555
+ /**
556
+ * Read item at sequence.
557
+ * Returns undefined if sequence is out of range.
558
+ */
559
+ read(sequence: bigint): T | undefined;
560
+ /**
561
+ * Read range of items (inclusive).
562
+ * Automatically clamps to available range.
563
+ */
564
+ readRange(startSeq: bigint, endSeq: bigint): T[];
565
+ /**
566
+ * Read from sequence with limit.
567
+ */
568
+ readFrom(startSeq: bigint, limit?: number): T[];
569
+ /**
570
+ * Get the oldest available sequence number.
571
+ */
572
+ getHeadSequence(): bigint;
573
+ /**
574
+ * Get the next sequence number to be written.
575
+ */
576
+ getTailSequence(): bigint;
577
+ /**
578
+ * Get the number of items currently in the buffer.
579
+ */
580
+ size(): number;
581
+ /**
582
+ * Get the maximum capacity of the buffer.
583
+ */
584
+ getCapacity(): number;
585
+ /**
586
+ * Clear all items from the buffer.
587
+ */
588
+ clear(): void;
589
+ /**
590
+ * Check if a sequence is available in the buffer.
591
+ */
592
+ isAvailable(sequence: bigint): boolean;
593
+ /**
594
+ * Get remaining capacity before oldest entries are overwritten.
595
+ */
596
+ remainingCapacity(): number;
597
+ }
598
+
599
+ /**
600
+ * Type of journal event.
601
+ */
602
+ type JournalEventType = 'PUT' | 'UPDATE' | 'DELETE';
603
+ /**
604
+ * Single event in the journal.
605
+ */
606
+ interface JournalEvent<V = unknown> {
607
+ /** Monotonically increasing sequence number */
608
+ sequence: bigint;
609
+ /** Event type */
610
+ type: JournalEventType;
611
+ /** Map name */
612
+ mapName: string;
613
+ /** Entry key */
614
+ key: string;
615
+ /** New value (undefined for DELETE) */
616
+ value?: V;
617
+ /** Previous value (for UPDATE and DELETE) */
618
+ previousValue?: V;
619
+ /** HLC timestamp */
620
+ timestamp: Timestamp;
621
+ /** Node that made the change */
622
+ nodeId: string;
623
+ /** Optional metadata */
624
+ metadata?: Record<string, unknown>;
625
+ }
626
+ /**
627
+ * Input for appending events (without sequence).
628
+ */
629
+ type JournalEventInput<V = unknown> = Omit<JournalEvent<V>, 'sequence'>;
630
+ /**
631
+ * Event Journal configuration.
632
+ */
633
+ interface EventJournalConfig {
634
+ /** Maximum number of events to keep in memory */
635
+ capacity: number;
636
+ /** Time-to-live for events (ms), 0 = infinite */
637
+ ttlMs: number;
638
+ /** Persist to storage adapter */
639
+ persistent: boolean;
640
+ /** Maps to include (empty = all) */
641
+ includeMaps?: string[];
642
+ /** Maps to exclude */
643
+ excludeMaps?: string[];
644
+ }
645
+ /**
646
+ * Default configuration for Event Journal.
647
+ */
648
+ declare const DEFAULT_EVENT_JOURNAL_CONFIG: EventJournalConfig;
649
+ /**
650
+ * Event Journal interface.
651
+ */
652
+ interface EventJournal {
653
+ /** Append event to journal */
654
+ append<V>(event: JournalEventInput<V>): JournalEvent<V>;
655
+ /** Read events from sequence (inclusive) */
656
+ readFrom(sequence: bigint, limit?: number): JournalEvent[];
657
+ /** Read events in range */
658
+ readRange(startSeq: bigint, endSeq: bigint): JournalEvent[];
659
+ /** Get latest sequence number */
660
+ getLatestSequence(): bigint;
661
+ /** Get oldest sequence number (after compaction) */
662
+ getOldestSequence(): bigint;
663
+ /** Subscribe to new events */
664
+ subscribe(listener: (event: JournalEvent) => void, fromSequence?: bigint): () => void;
665
+ /** Get capacity info */
666
+ getCapacity(): {
667
+ used: number;
668
+ total: number;
669
+ };
670
+ /** Force compaction */
671
+ compact(): Promise<void>;
672
+ /** Dispose resources */
673
+ dispose(): void;
674
+ }
675
+ /**
676
+ * Journal event listener type.
677
+ */
678
+ type JournalEventListener = (event: JournalEvent) => void;
679
+ /**
680
+ * Event Journal implementation using Ringbuffer.
681
+ * Records all Map changes as an append-only log.
682
+ */
683
+ declare class EventJournalImpl implements EventJournal {
684
+ private readonly config;
685
+ private readonly buffer;
686
+ private readonly listeners;
687
+ private ttlTimer?;
688
+ constructor(config?: Partial<EventJournalConfig>);
689
+ /**
690
+ * Append event to journal.
691
+ * Returns the event with assigned sequence number.
692
+ * Returns event with sequence -1n if map is filtered out.
693
+ */
694
+ append<V>(eventData: JournalEventInput<V>): JournalEvent<V>;
695
+ /**
696
+ * Read events from sequence with optional limit.
697
+ */
698
+ readFrom(sequence: bigint, limit?: number): JournalEvent[];
699
+ /**
700
+ * Read events in range (inclusive).
701
+ */
702
+ readRange(startSeq: bigint, endSeq: bigint): JournalEvent[];
703
+ /**
704
+ * Get latest sequence number.
705
+ * Returns 0n if no events have been added.
706
+ */
707
+ getLatestSequence(): bigint;
708
+ /**
709
+ * Get oldest available sequence number.
710
+ */
711
+ getOldestSequence(): bigint;
712
+ /**
713
+ * Subscribe to new events.
714
+ * Optionally replay events from a specific sequence.
715
+ *
716
+ * @param listener Callback for each event
717
+ * @param fromSequence Optional sequence to start replay from
718
+ * @returns Unsubscribe function
719
+ */
720
+ subscribe(listener: JournalEventListener, fromSequence?: bigint): () => void;
721
+ /**
722
+ * Get capacity information.
723
+ */
724
+ getCapacity(): {
725
+ used: number;
726
+ total: number;
727
+ };
728
+ /**
729
+ * Force compaction.
730
+ * Note: The ringbuffer handles eviction automatically.
731
+ * This method is provided for explicit cleanup of old events.
732
+ */
733
+ compact(): Promise<void>;
734
+ /**
735
+ * Check if a map should be captured.
736
+ */
737
+ private shouldCapture;
738
+ /**
739
+ * Start TTL cleanup timer.
740
+ */
741
+ private startTTLCleanup;
742
+ /**
743
+ * Dispose resources.
744
+ */
745
+ dispose(): void;
746
+ /**
747
+ * Get all current listeners count (for testing).
748
+ */
749
+ getListenerCount(): number;
750
+ /**
751
+ * Get configuration (for testing).
752
+ */
753
+ getConfig(): EventJournalConfig;
754
+ }
755
+
756
+ /**
757
+ * Function executed on the server against a single entry.
758
+ * Receives the current value (or undefined if key doesn't exist).
759
+ * Returns the new value (or undefined to delete the entry).
760
+ */
761
+ type EntryProcessorFn<V, R = V> = (value: V | undefined, key: string, args?: unknown) => {
762
+ value: V | undefined;
763
+ result?: R;
764
+ };
765
+ /**
766
+ * Zod schema for entry processor definition validation.
767
+ */
768
+ declare const EntryProcessorDefSchema: z.ZodObject<{
769
+ name: z.ZodString;
770
+ code: z.ZodString;
771
+ args: z.ZodOptional<z.ZodUnknown>;
772
+ }, z.core.$strip>;
773
+ /**
774
+ * Serializable entry processor definition.
775
+ * Code is sent as string and executed in isolated sandbox.
776
+ */
777
+ interface EntryProcessorDef<V = unknown, R = V> {
778
+ /** Unique processor name for caching compiled code */
779
+ name: string;
780
+ /** JavaScript function body as string */
781
+ code: string;
782
+ /** Optional arguments passed to the processor */
783
+ args?: unknown;
784
+ /** Type markers (not serialized) */
785
+ __valueType?: V;
786
+ __resultType?: R;
787
+ }
788
+ /**
789
+ * Result of entry processor execution.
790
+ */
791
+ interface EntryProcessorResult<R = unknown> {
792
+ /** Whether the operation succeeded */
793
+ success: boolean;
794
+ /** Custom result returned by processor */
795
+ result?: R;
796
+ /** Error message if failed */
797
+ error?: string;
798
+ /** New value after processing (for client cache update) */
799
+ newValue?: unknown;
800
+ }
801
+ /**
802
+ * Patterns that are denied in processor code for security reasons.
803
+ */
804
+ declare const FORBIDDEN_PATTERNS: RegExp[];
805
+ /**
806
+ * Validates processor code against forbidden patterns.
807
+ * Returns true if code is safe, false otherwise.
808
+ */
809
+ declare function validateProcessorCode(code: string): {
810
+ valid: boolean;
811
+ error?: string;
812
+ };
813
+ /**
814
+ * Built-in processors for common operations.
815
+ * These are type-safe and pre-validated.
816
+ */
817
+ declare const BuiltInProcessors: {
818
+ /**
819
+ * Increment numeric value by delta.
820
+ * If value doesn't exist, starts from 0.
821
+ */
822
+ INCREMENT: (delta?: number) => EntryProcessorDef<number, number>;
823
+ /**
824
+ * Decrement numeric value by delta.
825
+ * If value doesn't exist, starts from 0.
826
+ */
827
+ DECREMENT: (delta?: number) => EntryProcessorDef<number, number>;
828
+ /**
829
+ * Decrement with floor (won't go below 0).
830
+ * Returns both the new value and whether it was floored.
831
+ */
832
+ DECREMENT_FLOOR: (delta?: number) => EntryProcessorDef<number, {
833
+ newValue: number;
834
+ wasFloored: boolean;
835
+ }>;
836
+ /**
837
+ * Multiply numeric value by factor.
838
+ * If value doesn't exist, starts from 1.
839
+ */
840
+ MULTIPLY: (factor: number) => EntryProcessorDef<number, number>;
841
+ /**
842
+ * Set value only if key doesn't exist.
843
+ * Returns true if value was set, false if key already existed.
844
+ */
845
+ PUT_IF_ABSENT: <V>(newValue: V) => EntryProcessorDef<V, boolean>;
846
+ /**
847
+ * Replace value only if key exists.
848
+ * Returns the old value if replaced, undefined otherwise.
849
+ */
850
+ REPLACE: <V>(newValue: V) => EntryProcessorDef<V, V | undefined>;
851
+ /**
852
+ * Replace value only if it matches expected value.
853
+ * Returns true if replaced, false otherwise.
854
+ */
855
+ REPLACE_IF_EQUALS: <V>(expectedValue: V, newValue: V) => EntryProcessorDef<V, boolean>;
856
+ /**
857
+ * Delete entry only if value matches.
858
+ * Returns true if deleted, false otherwise.
859
+ */
860
+ DELETE_IF_EQUALS: <V>(expectedValue: V) => EntryProcessorDef<V, boolean>;
861
+ /**
862
+ * Append item to array.
863
+ * Creates array if it doesn't exist.
864
+ * Returns new array length.
865
+ */
866
+ ARRAY_PUSH: <T>(item: T) => EntryProcessorDef<T[], number>;
867
+ /**
868
+ * Remove last item from array.
869
+ * Returns the removed item or undefined.
870
+ */
871
+ ARRAY_POP: <T>() => EntryProcessorDef<T[], T | undefined>;
872
+ /**
873
+ * Remove item from array by value (first occurrence).
874
+ * Returns true if item was found and removed.
875
+ */
876
+ ARRAY_REMOVE: <T>(item: T) => EntryProcessorDef<T[], boolean>;
877
+ /**
878
+ * Update nested property using dot notation path.
879
+ * Creates intermediate objects if they don't exist.
880
+ */
881
+ SET_PROPERTY: <V>(path: string, propValue: unknown) => EntryProcessorDef<V, V>;
882
+ /**
883
+ * Delete nested property using dot notation path.
884
+ * Returns the deleted value or undefined.
885
+ */
886
+ DELETE_PROPERTY: <V>(path: string) => EntryProcessorDef<V, unknown>;
887
+ /**
888
+ * Get current value without modifying it.
889
+ * Useful for conditional reads.
890
+ */
891
+ GET: <V>() => EntryProcessorDef<V, V | undefined>;
892
+ /**
893
+ * Conditional update based on version/timestamp.
894
+ * Only updates if current version matches expected.
895
+ * Useful for optimistic locking.
896
+ */
897
+ CONDITIONAL_UPDATE: <V extends {
898
+ version?: number;
899
+ }>(expectedVersion: number, newData: Partial<V>) => EntryProcessorDef<V, {
900
+ updated: boolean;
901
+ conflict: boolean;
902
+ }>;
903
+ /**
904
+ * Merge object properties into existing value.
905
+ * Shallow merge only.
906
+ */
907
+ MERGE: <V extends Record<string, unknown>>(properties: Partial<V>) => EntryProcessorDef<V, V>;
908
+ };
909
+ /**
910
+ * Rate limiting configuration for processor execution.
911
+ */
912
+ interface ProcessorRateLimitConfig {
913
+ /** Max processor executions per second per client */
914
+ maxExecutionsPerSecond: number;
915
+ /** Max processor code size in bytes */
916
+ maxCodeSizeBytes: number;
917
+ /** Max args size in bytes (JSON stringified) */
918
+ maxArgsSizeBytes: number;
919
+ }
920
+ /**
921
+ * Default rate limit configuration.
922
+ */
923
+ declare const DEFAULT_PROCESSOR_RATE_LIMITS: ProcessorRateLimitConfig;
924
+
925
+ /**
926
+ * Context provided to a conflict resolver during merge operations.
927
+ */
928
+ interface MergeContext<V = unknown> {
929
+ /** Map name being modified */
930
+ mapName: string;
931
+ /** Entry key being modified */
932
+ key: string;
933
+ /** Current server/local value (undefined if key doesn't exist) */
934
+ localValue: V | undefined;
935
+ /** Incoming client/remote value */
936
+ remoteValue: V;
937
+ /** Local HLC timestamp (undefined if key doesn't exist) */
938
+ localTimestamp?: Timestamp;
939
+ /** Remote HLC timestamp */
940
+ remoteTimestamp: Timestamp;
941
+ /** Client/node ID that sent the update */
942
+ remoteNodeId: string;
943
+ /** Authentication context (optional) */
944
+ auth?: {
945
+ userId?: string;
946
+ roles?: string[];
947
+ metadata?: Record<string, unknown>;
948
+ };
949
+ /** Read other entries for cross-key validation */
950
+ readEntry: (key: string) => V | undefined;
951
+ }
952
+ /**
953
+ * Result of conflict resolution.
954
+ */
955
+ type MergeResult<V = unknown> = {
956
+ action: 'accept';
957
+ value: V;
958
+ } | {
959
+ action: 'reject';
960
+ reason: string;
961
+ } | {
962
+ action: 'merge';
963
+ value: V;
964
+ } | {
965
+ action: 'local';
966
+ };
967
+ /**
968
+ * Conflict resolver function signature.
969
+ */
970
+ type ConflictResolverFn<V = unknown> = (context: MergeContext<V>) => MergeResult<V> | Promise<MergeResult<V>>;
971
+ /**
972
+ * Conflict resolver definition (can be native function or sandboxed code).
973
+ */
974
+ interface ConflictResolverDef<V = unknown> {
975
+ /** Unique resolver name */
976
+ name: string;
977
+ /** JavaScript function body as string (for sandboxed execution) */
978
+ code?: string;
979
+ /** Native function (for trusted server-side resolvers) */
980
+ fn?: ConflictResolverFn<V>;
981
+ /** Priority (higher = runs first, default 50) */
982
+ priority?: number;
983
+ /** Apply only to specific keys (glob pattern) */
984
+ keyPattern?: string;
985
+ }
986
+ /**
987
+ * Zod schema for validating conflict resolver definitions from network.
988
+ */
989
+ declare const ConflictResolverDefSchema: z.ZodObject<{
990
+ name: z.ZodString;
991
+ code: z.ZodOptional<z.ZodString>;
992
+ priority: z.ZodDefault<z.ZodNumber>;
993
+ keyPattern: z.ZodOptional<z.ZodString>;
994
+ }, z.core.$strip>;
995
+ /**
996
+ * Patterns that are denied in resolver code for security reasons.
997
+ * Same patterns as EntryProcessor for consistency.
998
+ */
999
+ declare const RESOLVER_FORBIDDEN_PATTERNS: RegExp[];
1000
+ /**
1001
+ * Validates resolver code against forbidden patterns.
1002
+ */
1003
+ declare function validateResolverCode(code: string): {
1004
+ valid: boolean;
1005
+ error?: string;
1006
+ };
1007
+ /**
1008
+ * Rate limiting configuration for resolver registration.
1009
+ */
1010
+ interface ResolverRateLimitConfig {
1011
+ /** Max resolver registrations per client */
1012
+ maxResolversPerClient: number;
1013
+ /** Max resolver code size in bytes */
1014
+ maxCodeSizeBytes: number;
1015
+ }
1016
+ /**
1017
+ * Default rate limit configuration.
1018
+ */
1019
+ declare const DEFAULT_RESOLVER_RATE_LIMITS: ResolverRateLimitConfig;
1020
+ /**
1021
+ * Compares two HLC timestamps.
1022
+ * Returns negative if a < b, positive if a > b, 0 if equal.
1023
+ */
1024
+ declare function compareHLCTimestamps(a: Timestamp, b: Timestamp): number;
1025
+ /**
1026
+ * Deep merges two objects.
1027
+ * Remote values take precedence at each level.
1028
+ */
1029
+ declare function deepMerge<T extends object>(target: T, source: T): T;
1030
+ /**
1031
+ * Built-in conflict resolvers for common patterns.
1032
+ * These are type-safe and pre-validated.
1033
+ */
1034
+ declare const BuiltInResolvers: {
1035
+ /**
1036
+ * Standard Last-Write-Wins - accept if remote timestamp is newer.
1037
+ */
1038
+ LWW: <V>() => ConflictResolverDef<V>;
1039
+ /**
1040
+ * First-Write-Wins - reject if local value exists.
1041
+ * Useful for booking systems, unique constraints.
1042
+ */
1043
+ FIRST_WRITE_WINS: <V>() => ConflictResolverDef<V>;
1044
+ /**
1045
+ * Numeric minimum - keep lowest value.
1046
+ * Useful for auction systems (lowest bid wins).
1047
+ */
1048
+ NUMERIC_MIN: () => ConflictResolverDef<number>;
1049
+ /**
1050
+ * Numeric maximum - keep highest value.
1051
+ * Useful for high score tracking.
1052
+ */
1053
+ NUMERIC_MAX: () => ConflictResolverDef<number>;
1054
+ /**
1055
+ * Non-negative - reject if value would be negative.
1056
+ * Useful for inventory systems.
1057
+ */
1058
+ NON_NEGATIVE: () => ConflictResolverDef<number>;
1059
+ /**
1060
+ * Array union - merge arrays by taking union of elements.
1061
+ * Useful for tags, categories.
1062
+ */
1063
+ ARRAY_UNION: <T>() => ConflictResolverDef<T[]>;
1064
+ /**
1065
+ * Deep merge - recursively merge objects.
1066
+ * Remote values take precedence at leaf level.
1067
+ */
1068
+ DEEP_MERGE: <V extends object>() => ConflictResolverDef<V>;
1069
+ /**
1070
+ * Server-only - reject all client writes.
1071
+ * Useful for server-controlled state.
1072
+ */
1073
+ SERVER_ONLY: <V>() => ConflictResolverDef<V>;
1074
+ /**
1075
+ * Owner-only - only the original creator can modify.
1076
+ * Requires value to have an `ownerId` property.
1077
+ */
1078
+ OWNER_ONLY: <V extends {
1079
+ ownerId?: string;
1080
+ }>() => ConflictResolverDef<V>;
1081
+ /**
1082
+ * Immutable - reject any modifications after initial write.
1083
+ */
1084
+ IMMUTABLE: <V>() => ConflictResolverDef<V>;
1085
+ /**
1086
+ * Version check - only accept if version increments by 1.
1087
+ * Useful for optimistic locking.
1088
+ */
1089
+ VERSION_INCREMENT: <V extends {
1090
+ version?: number;
1091
+ }>() => ConflictResolverDef<V>;
1092
+ };
1093
+ /**
1094
+ * Event emitted when a merge is rejected.
1095
+ */
1096
+ interface MergeRejection {
1097
+ mapName: string;
1098
+ key: string;
1099
+ attemptedValue: unknown;
1100
+ reason: string;
1101
+ timestamp: Timestamp;
1102
+ nodeId: string;
1103
+ }
1104
+
405
1105
  /**
406
1106
  * Hash utilities for TopGun
407
1107
  *
@@ -796,6 +1496,46 @@ declare const TopicMessageEventSchema: z.ZodObject<{
796
1496
  timestamp: z.ZodNumber;
797
1497
  }, z.core.$strip>;
798
1498
  }, z.core.$strip>;
1499
+ declare const PNCounterStateObjectSchema: z.ZodObject<{
1500
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1501
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1502
+ }, z.core.$strip>;
1503
+ declare const CounterRequestSchema: z.ZodObject<{
1504
+ type: z.ZodLiteral<"COUNTER_REQUEST">;
1505
+ payload: z.ZodObject<{
1506
+ name: z.ZodString;
1507
+ }, z.core.$strip>;
1508
+ }, z.core.$strip>;
1509
+ declare const CounterSyncSchema: z.ZodObject<{
1510
+ type: z.ZodLiteral<"COUNTER_SYNC">;
1511
+ payload: z.ZodObject<{
1512
+ name: z.ZodString;
1513
+ state: z.ZodObject<{
1514
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1515
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1516
+ }, z.core.$strip>;
1517
+ }, z.core.$strip>;
1518
+ }, z.core.$strip>;
1519
+ declare const CounterResponseSchema: z.ZodObject<{
1520
+ type: z.ZodLiteral<"COUNTER_RESPONSE">;
1521
+ payload: z.ZodObject<{
1522
+ name: z.ZodString;
1523
+ state: z.ZodObject<{
1524
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1525
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1526
+ }, z.core.$strip>;
1527
+ }, z.core.$strip>;
1528
+ }, z.core.$strip>;
1529
+ declare const CounterUpdateSchema: z.ZodObject<{
1530
+ type: z.ZodLiteral<"COUNTER_UPDATE">;
1531
+ payload: z.ZodObject<{
1532
+ name: z.ZodString;
1533
+ state: z.ZodObject<{
1534
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
1535
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
1536
+ }, z.core.$strip>;
1537
+ }, z.core.$strip>;
1538
+ }, z.core.$strip>;
799
1539
  declare const PingMessageSchema: z.ZodObject<{
800
1540
  type: z.ZodLiteral<"PING">;
801
1541
  timestamp: z.ZodNumber;
@@ -951,6 +1691,274 @@ declare const PartitionMapRequestSchema: z.ZodObject<{
951
1691
  currentVersion: z.ZodOptional<z.ZodNumber>;
952
1692
  }, z.core.$strip>>;
953
1693
  }, z.core.$strip>;
1694
+ /**
1695
+ * Entry processor definition schema.
1696
+ */
1697
+ declare const EntryProcessorSchema: z.ZodObject<{
1698
+ name: z.ZodString;
1699
+ code: z.ZodString;
1700
+ args: z.ZodOptional<z.ZodUnknown>;
1701
+ }, z.core.$strip>;
1702
+ /**
1703
+ * ENTRY_PROCESS: Client requests atomic operation on single key.
1704
+ */
1705
+ declare const EntryProcessRequestSchema: z.ZodObject<{
1706
+ type: z.ZodLiteral<"ENTRY_PROCESS">;
1707
+ requestId: z.ZodString;
1708
+ mapName: z.ZodString;
1709
+ key: z.ZodString;
1710
+ processor: z.ZodObject<{
1711
+ name: z.ZodString;
1712
+ code: z.ZodString;
1713
+ args: z.ZodOptional<z.ZodUnknown>;
1714
+ }, z.core.$strip>;
1715
+ }, z.core.$strip>;
1716
+ /**
1717
+ * ENTRY_PROCESS_BATCH: Client requests atomic operation on multiple keys.
1718
+ */
1719
+ declare const EntryProcessBatchRequestSchema: z.ZodObject<{
1720
+ type: z.ZodLiteral<"ENTRY_PROCESS_BATCH">;
1721
+ requestId: z.ZodString;
1722
+ mapName: z.ZodString;
1723
+ keys: z.ZodArray<z.ZodString>;
1724
+ processor: z.ZodObject<{
1725
+ name: z.ZodString;
1726
+ code: z.ZodString;
1727
+ args: z.ZodOptional<z.ZodUnknown>;
1728
+ }, z.core.$strip>;
1729
+ }, z.core.$strip>;
1730
+ /**
1731
+ * ENTRY_PROCESS_RESPONSE: Server responds to single-key processor request.
1732
+ */
1733
+ declare const EntryProcessResponseSchema: z.ZodObject<{
1734
+ type: z.ZodLiteral<"ENTRY_PROCESS_RESPONSE">;
1735
+ requestId: z.ZodString;
1736
+ success: z.ZodBoolean;
1737
+ result: z.ZodOptional<z.ZodUnknown>;
1738
+ newValue: z.ZodOptional<z.ZodUnknown>;
1739
+ error: z.ZodOptional<z.ZodString>;
1740
+ }, z.core.$strip>;
1741
+ /**
1742
+ * Individual key result in batch response.
1743
+ */
1744
+ declare const EntryProcessKeyResultSchema: z.ZodObject<{
1745
+ success: z.ZodBoolean;
1746
+ result: z.ZodOptional<z.ZodUnknown>;
1747
+ newValue: z.ZodOptional<z.ZodUnknown>;
1748
+ error: z.ZodOptional<z.ZodString>;
1749
+ }, z.core.$strip>;
1750
+ /**
1751
+ * ENTRY_PROCESS_BATCH_RESPONSE: Server responds to multi-key processor request.
1752
+ */
1753
+ declare const EntryProcessBatchResponseSchema: z.ZodObject<{
1754
+ type: z.ZodLiteral<"ENTRY_PROCESS_BATCH_RESPONSE">;
1755
+ requestId: z.ZodString;
1756
+ results: z.ZodRecord<z.ZodString, z.ZodObject<{
1757
+ success: z.ZodBoolean;
1758
+ result: z.ZodOptional<z.ZodUnknown>;
1759
+ newValue: z.ZodOptional<z.ZodUnknown>;
1760
+ error: z.ZodOptional<z.ZodString>;
1761
+ }, z.core.$strip>>;
1762
+ }, z.core.$strip>;
1763
+ /**
1764
+ * Journal event type schema.
1765
+ */
1766
+ declare const JournalEventTypeSchema: z.ZodEnum<{
1767
+ PUT: "PUT";
1768
+ UPDATE: "UPDATE";
1769
+ DELETE: "DELETE";
1770
+ }>;
1771
+ /**
1772
+ * Journal event data (serialized for network).
1773
+ */
1774
+ declare const JournalEventDataSchema: z.ZodObject<{
1775
+ sequence: z.ZodString;
1776
+ type: z.ZodEnum<{
1777
+ PUT: "PUT";
1778
+ UPDATE: "UPDATE";
1779
+ DELETE: "DELETE";
1780
+ }>;
1781
+ mapName: z.ZodString;
1782
+ key: z.ZodString;
1783
+ value: z.ZodOptional<z.ZodUnknown>;
1784
+ previousValue: z.ZodOptional<z.ZodUnknown>;
1785
+ timestamp: z.ZodObject<{
1786
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1787
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1788
+ nodeId: z.ZodString;
1789
+ }, z.core.$strip>;
1790
+ nodeId: z.ZodString;
1791
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1792
+ }, z.core.$strip>;
1793
+ /**
1794
+ * JOURNAL_SUBSCRIBE: Client subscribes to journal events.
1795
+ */
1796
+ declare const JournalSubscribeRequestSchema: z.ZodObject<{
1797
+ type: z.ZodLiteral<"JOURNAL_SUBSCRIBE">;
1798
+ requestId: z.ZodString;
1799
+ fromSequence: z.ZodOptional<z.ZodString>;
1800
+ mapName: z.ZodOptional<z.ZodString>;
1801
+ types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1802
+ PUT: "PUT";
1803
+ UPDATE: "UPDATE";
1804
+ DELETE: "DELETE";
1805
+ }>>>;
1806
+ }, z.core.$strip>;
1807
+ /**
1808
+ * JOURNAL_UNSUBSCRIBE: Client unsubscribes from journal events.
1809
+ */
1810
+ declare const JournalUnsubscribeRequestSchema: z.ZodObject<{
1811
+ type: z.ZodLiteral<"JOURNAL_UNSUBSCRIBE">;
1812
+ subscriptionId: z.ZodString;
1813
+ }, z.core.$strip>;
1814
+ /**
1815
+ * JOURNAL_EVENT: Server sends journal event to client.
1816
+ */
1817
+ declare const JournalEventMessageSchema: z.ZodObject<{
1818
+ type: z.ZodLiteral<"JOURNAL_EVENT">;
1819
+ event: z.ZodObject<{
1820
+ sequence: z.ZodString;
1821
+ type: z.ZodEnum<{
1822
+ PUT: "PUT";
1823
+ UPDATE: "UPDATE";
1824
+ DELETE: "DELETE";
1825
+ }>;
1826
+ mapName: z.ZodString;
1827
+ key: z.ZodString;
1828
+ value: z.ZodOptional<z.ZodUnknown>;
1829
+ previousValue: z.ZodOptional<z.ZodUnknown>;
1830
+ timestamp: z.ZodObject<{
1831
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1832
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1833
+ nodeId: z.ZodString;
1834
+ }, z.core.$strip>;
1835
+ nodeId: z.ZodString;
1836
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1837
+ }, z.core.$strip>;
1838
+ }, z.core.$strip>;
1839
+ /**
1840
+ * JOURNAL_READ: Client requests events from journal.
1841
+ */
1842
+ declare const JournalReadRequestSchema: z.ZodObject<{
1843
+ type: z.ZodLiteral<"JOURNAL_READ">;
1844
+ requestId: z.ZodString;
1845
+ fromSequence: z.ZodString;
1846
+ limit: z.ZodOptional<z.ZodNumber>;
1847
+ mapName: z.ZodOptional<z.ZodString>;
1848
+ }, z.core.$strip>;
1849
+ /**
1850
+ * JOURNAL_READ_RESPONSE: Server responds with journal events.
1851
+ */
1852
+ declare const JournalReadResponseSchema: z.ZodObject<{
1853
+ type: z.ZodLiteral<"JOURNAL_READ_RESPONSE">;
1854
+ requestId: z.ZodString;
1855
+ events: z.ZodArray<z.ZodObject<{
1856
+ sequence: z.ZodString;
1857
+ type: z.ZodEnum<{
1858
+ PUT: "PUT";
1859
+ UPDATE: "UPDATE";
1860
+ DELETE: "DELETE";
1861
+ }>;
1862
+ mapName: z.ZodString;
1863
+ key: z.ZodString;
1864
+ value: z.ZodOptional<z.ZodUnknown>;
1865
+ previousValue: z.ZodOptional<z.ZodUnknown>;
1866
+ timestamp: z.ZodObject<{
1867
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1868
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1869
+ nodeId: z.ZodString;
1870
+ }, z.core.$strip>;
1871
+ nodeId: z.ZodString;
1872
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1873
+ }, z.core.$strip>>;
1874
+ hasMore: z.ZodBoolean;
1875
+ }, z.core.$strip>;
1876
+ /**
1877
+ * Conflict resolver definition schema (wire format).
1878
+ */
1879
+ declare const ConflictResolverSchema: z.ZodObject<{
1880
+ name: z.ZodString;
1881
+ code: z.ZodString;
1882
+ priority: z.ZodOptional<z.ZodNumber>;
1883
+ keyPattern: z.ZodOptional<z.ZodString>;
1884
+ }, z.core.$strip>;
1885
+ /**
1886
+ * REGISTER_RESOLVER: Client registers a conflict resolver on server.
1887
+ */
1888
+ declare const RegisterResolverRequestSchema: z.ZodObject<{
1889
+ type: z.ZodLiteral<"REGISTER_RESOLVER">;
1890
+ requestId: z.ZodString;
1891
+ mapName: z.ZodString;
1892
+ resolver: z.ZodObject<{
1893
+ name: z.ZodString;
1894
+ code: z.ZodString;
1895
+ priority: z.ZodOptional<z.ZodNumber>;
1896
+ keyPattern: z.ZodOptional<z.ZodString>;
1897
+ }, z.core.$strip>;
1898
+ }, z.core.$strip>;
1899
+ /**
1900
+ * REGISTER_RESOLVER_RESPONSE: Server acknowledges resolver registration.
1901
+ */
1902
+ declare const RegisterResolverResponseSchema: z.ZodObject<{
1903
+ type: z.ZodLiteral<"REGISTER_RESOLVER_RESPONSE">;
1904
+ requestId: z.ZodString;
1905
+ success: z.ZodBoolean;
1906
+ error: z.ZodOptional<z.ZodString>;
1907
+ }, z.core.$strip>;
1908
+ /**
1909
+ * UNREGISTER_RESOLVER: Client unregisters a conflict resolver.
1910
+ */
1911
+ declare const UnregisterResolverRequestSchema: z.ZodObject<{
1912
+ type: z.ZodLiteral<"UNREGISTER_RESOLVER">;
1913
+ requestId: z.ZodString;
1914
+ mapName: z.ZodString;
1915
+ resolverName: z.ZodString;
1916
+ }, z.core.$strip>;
1917
+ /**
1918
+ * UNREGISTER_RESOLVER_RESPONSE: Server acknowledges resolver unregistration.
1919
+ */
1920
+ declare const UnregisterResolverResponseSchema: z.ZodObject<{
1921
+ type: z.ZodLiteral<"UNREGISTER_RESOLVER_RESPONSE">;
1922
+ requestId: z.ZodString;
1923
+ success: z.ZodBoolean;
1924
+ error: z.ZodOptional<z.ZodString>;
1925
+ }, z.core.$strip>;
1926
+ /**
1927
+ * MERGE_REJECTED: Server notifies client that a merge was rejected.
1928
+ */
1929
+ declare const MergeRejectedMessageSchema: z.ZodObject<{
1930
+ type: z.ZodLiteral<"MERGE_REJECTED">;
1931
+ mapName: z.ZodString;
1932
+ key: z.ZodString;
1933
+ attemptedValue: z.ZodUnknown;
1934
+ reason: z.ZodString;
1935
+ timestamp: z.ZodObject<{
1936
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1937
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
1938
+ nodeId: z.ZodString;
1939
+ }, z.core.$strip>;
1940
+ }, z.core.$strip>;
1941
+ /**
1942
+ * LIST_RESOLVERS: Client requests list of registered resolvers.
1943
+ */
1944
+ declare const ListResolversRequestSchema: z.ZodObject<{
1945
+ type: z.ZodLiteral<"LIST_RESOLVERS">;
1946
+ requestId: z.ZodString;
1947
+ mapName: z.ZodOptional<z.ZodString>;
1948
+ }, z.core.$strip>;
1949
+ /**
1950
+ * LIST_RESOLVERS_RESPONSE: Server responds with registered resolvers.
1951
+ */
1952
+ declare const ListResolversResponseSchema: z.ZodObject<{
1953
+ type: z.ZodLiteral<"LIST_RESOLVERS_RESPONSE">;
1954
+ requestId: z.ZodString;
1955
+ resolvers: z.ZodArray<z.ZodObject<{
1956
+ mapName: z.ZodString;
1957
+ name: z.ZodString;
1958
+ priority: z.ZodOptional<z.ZodNumber>;
1959
+ keyPattern: z.ZodOptional<z.ZodString>;
1960
+ }, z.core.$strip>>;
1961
+ }, z.core.$strip>;
954
1962
  /**
955
1963
  * Individual operation result within a batch ACK
956
1964
  */
@@ -1294,6 +2302,168 @@ declare const MessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1294
2302
  payload: z.ZodOptional<z.ZodObject<{
1295
2303
  currentVersion: z.ZodOptional<z.ZodNumber>;
1296
2304
  }, z.core.$strip>>;
2305
+ }, z.core.$strip>, z.ZodObject<{
2306
+ type: z.ZodLiteral<"COUNTER_REQUEST">;
2307
+ payload: z.ZodObject<{
2308
+ name: z.ZodString;
2309
+ }, z.core.$strip>;
2310
+ }, z.core.$strip>, z.ZodObject<{
2311
+ type: z.ZodLiteral<"COUNTER_SYNC">;
2312
+ payload: z.ZodObject<{
2313
+ name: z.ZodString;
2314
+ state: z.ZodObject<{
2315
+ p: z.ZodRecord<z.ZodString, z.ZodNumber>;
2316
+ n: z.ZodRecord<z.ZodString, z.ZodNumber>;
2317
+ }, z.core.$strip>;
2318
+ }, z.core.$strip>;
2319
+ }, z.core.$strip>, z.ZodObject<{
2320
+ type: z.ZodLiteral<"ENTRY_PROCESS">;
2321
+ requestId: z.ZodString;
2322
+ mapName: z.ZodString;
2323
+ key: z.ZodString;
2324
+ processor: z.ZodObject<{
2325
+ name: z.ZodString;
2326
+ code: z.ZodString;
2327
+ args: z.ZodOptional<z.ZodUnknown>;
2328
+ }, z.core.$strip>;
2329
+ }, z.core.$strip>, z.ZodObject<{
2330
+ type: z.ZodLiteral<"ENTRY_PROCESS_BATCH">;
2331
+ requestId: z.ZodString;
2332
+ mapName: z.ZodString;
2333
+ keys: z.ZodArray<z.ZodString>;
2334
+ processor: z.ZodObject<{
2335
+ name: z.ZodString;
2336
+ code: z.ZodString;
2337
+ args: z.ZodOptional<z.ZodUnknown>;
2338
+ }, z.core.$strip>;
2339
+ }, z.core.$strip>, z.ZodObject<{
2340
+ type: z.ZodLiteral<"ENTRY_PROCESS_RESPONSE">;
2341
+ requestId: z.ZodString;
2342
+ success: z.ZodBoolean;
2343
+ result: z.ZodOptional<z.ZodUnknown>;
2344
+ newValue: z.ZodOptional<z.ZodUnknown>;
2345
+ error: z.ZodOptional<z.ZodString>;
2346
+ }, z.core.$strip>, z.ZodObject<{
2347
+ type: z.ZodLiteral<"ENTRY_PROCESS_BATCH_RESPONSE">;
2348
+ requestId: z.ZodString;
2349
+ results: z.ZodRecord<z.ZodString, z.ZodObject<{
2350
+ success: z.ZodBoolean;
2351
+ result: z.ZodOptional<z.ZodUnknown>;
2352
+ newValue: z.ZodOptional<z.ZodUnknown>;
2353
+ error: z.ZodOptional<z.ZodString>;
2354
+ }, z.core.$strip>>;
2355
+ }, z.core.$strip>, z.ZodObject<{
2356
+ type: z.ZodLiteral<"JOURNAL_SUBSCRIBE">;
2357
+ requestId: z.ZodString;
2358
+ fromSequence: z.ZodOptional<z.ZodString>;
2359
+ mapName: z.ZodOptional<z.ZodString>;
2360
+ types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2361
+ PUT: "PUT";
2362
+ UPDATE: "UPDATE";
2363
+ DELETE: "DELETE";
2364
+ }>>>;
2365
+ }, z.core.$strip>, z.ZodObject<{
2366
+ type: z.ZodLiteral<"JOURNAL_UNSUBSCRIBE">;
2367
+ subscriptionId: z.ZodString;
2368
+ }, z.core.$strip>, z.ZodObject<{
2369
+ type: z.ZodLiteral<"JOURNAL_EVENT">;
2370
+ event: z.ZodObject<{
2371
+ sequence: z.ZodString;
2372
+ type: z.ZodEnum<{
2373
+ PUT: "PUT";
2374
+ UPDATE: "UPDATE";
2375
+ DELETE: "DELETE";
2376
+ }>;
2377
+ mapName: z.ZodString;
2378
+ key: z.ZodString;
2379
+ value: z.ZodOptional<z.ZodUnknown>;
2380
+ previousValue: z.ZodOptional<z.ZodUnknown>;
2381
+ timestamp: z.ZodObject<{
2382
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2383
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2384
+ nodeId: z.ZodString;
2385
+ }, z.core.$strip>;
2386
+ nodeId: z.ZodString;
2387
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2388
+ }, z.core.$strip>;
2389
+ }, z.core.$strip>, z.ZodObject<{
2390
+ type: z.ZodLiteral<"JOURNAL_READ">;
2391
+ requestId: z.ZodString;
2392
+ fromSequence: z.ZodString;
2393
+ limit: z.ZodOptional<z.ZodNumber>;
2394
+ mapName: z.ZodOptional<z.ZodString>;
2395
+ }, z.core.$strip>, z.ZodObject<{
2396
+ type: z.ZodLiteral<"JOURNAL_READ_RESPONSE">;
2397
+ requestId: z.ZodString;
2398
+ events: z.ZodArray<z.ZodObject<{
2399
+ sequence: z.ZodString;
2400
+ type: z.ZodEnum<{
2401
+ PUT: "PUT";
2402
+ UPDATE: "UPDATE";
2403
+ DELETE: "DELETE";
2404
+ }>;
2405
+ mapName: z.ZodString;
2406
+ key: z.ZodString;
2407
+ value: z.ZodOptional<z.ZodUnknown>;
2408
+ previousValue: z.ZodOptional<z.ZodUnknown>;
2409
+ timestamp: z.ZodObject<{
2410
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2411
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2412
+ nodeId: z.ZodString;
2413
+ }, z.core.$strip>;
2414
+ nodeId: z.ZodString;
2415
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2416
+ }, z.core.$strip>>;
2417
+ hasMore: z.ZodBoolean;
2418
+ }, z.core.$strip>, z.ZodObject<{
2419
+ type: z.ZodLiteral<"REGISTER_RESOLVER">;
2420
+ requestId: z.ZodString;
2421
+ mapName: z.ZodString;
2422
+ resolver: z.ZodObject<{
2423
+ name: z.ZodString;
2424
+ code: z.ZodString;
2425
+ priority: z.ZodOptional<z.ZodNumber>;
2426
+ keyPattern: z.ZodOptional<z.ZodString>;
2427
+ }, z.core.$strip>;
2428
+ }, z.core.$strip>, z.ZodObject<{
2429
+ type: z.ZodLiteral<"REGISTER_RESOLVER_RESPONSE">;
2430
+ requestId: z.ZodString;
2431
+ success: z.ZodBoolean;
2432
+ error: z.ZodOptional<z.ZodString>;
2433
+ }, z.core.$strip>, z.ZodObject<{
2434
+ type: z.ZodLiteral<"UNREGISTER_RESOLVER">;
2435
+ requestId: z.ZodString;
2436
+ mapName: z.ZodString;
2437
+ resolverName: z.ZodString;
2438
+ }, z.core.$strip>, z.ZodObject<{
2439
+ type: z.ZodLiteral<"UNREGISTER_RESOLVER_RESPONSE">;
2440
+ requestId: z.ZodString;
2441
+ success: z.ZodBoolean;
2442
+ error: z.ZodOptional<z.ZodString>;
2443
+ }, z.core.$strip>, z.ZodObject<{
2444
+ type: z.ZodLiteral<"MERGE_REJECTED">;
2445
+ mapName: z.ZodString;
2446
+ key: z.ZodString;
2447
+ attemptedValue: z.ZodUnknown;
2448
+ reason: z.ZodString;
2449
+ timestamp: z.ZodObject<{
2450
+ millis: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2451
+ counter: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodBigInt]>, z.ZodTransform<number, number | bigint>>;
2452
+ nodeId: z.ZodString;
2453
+ }, z.core.$strip>;
2454
+ }, z.core.$strip>, z.ZodObject<{
2455
+ type: z.ZodLiteral<"LIST_RESOLVERS">;
2456
+ requestId: z.ZodString;
2457
+ mapName: z.ZodOptional<z.ZodString>;
2458
+ }, z.core.$strip>, z.ZodObject<{
2459
+ type: z.ZodLiteral<"LIST_RESOLVERS_RESPONSE">;
2460
+ requestId: z.ZodString;
2461
+ resolvers: z.ZodArray<z.ZodObject<{
2462
+ mapName: z.ZodString;
2463
+ name: z.ZodString;
2464
+ priority: z.ZodOptional<z.ZodNumber>;
2465
+ keyPattern: z.ZodOptional<z.ZodString>;
2466
+ }, z.core.$strip>>;
1297
2467
  }, z.core.$strip>], "type">;
1298
2468
  type Query = z.infer<typeof QuerySchema>;
1299
2469
  type ClientOp = z.infer<typeof ClientOpSchema>;
@@ -1304,6 +2474,25 @@ type BatchMessage = z.infer<typeof BatchMessageSchema>;
1304
2474
  type OpAckMessage = z.infer<typeof OpAckMessageSchema>;
1305
2475
  type OpRejectedMessage = z.infer<typeof OpRejectedMessageSchema>;
1306
2476
  type OpResult = z.infer<typeof OpResultSchema>;
2477
+ type EntryProcessRequest = z.infer<typeof EntryProcessRequestSchema>;
2478
+ type EntryProcessBatchRequest = z.infer<typeof EntryProcessBatchRequestSchema>;
2479
+ type EntryProcessResponse = z.infer<typeof EntryProcessResponseSchema>;
2480
+ type EntryProcessBatchResponse = z.infer<typeof EntryProcessBatchResponseSchema>;
2481
+ type EntryProcessKeyResult = z.infer<typeof EntryProcessKeyResultSchema>;
2482
+ type JournalEventData = z.infer<typeof JournalEventDataSchema>;
2483
+ type JournalSubscribeRequest = z.infer<typeof JournalSubscribeRequestSchema>;
2484
+ type JournalUnsubscribeRequest = z.infer<typeof JournalUnsubscribeRequestSchema>;
2485
+ type JournalEventMessage = z.infer<typeof JournalEventMessageSchema>;
2486
+ type JournalReadRequest = z.infer<typeof JournalReadRequestSchema>;
2487
+ type JournalReadResponse = z.infer<typeof JournalReadResponseSchema>;
2488
+ type ConflictResolver = z.infer<typeof ConflictResolverSchema>;
2489
+ type RegisterResolverRequest = z.infer<typeof RegisterResolverRequestSchema>;
2490
+ type RegisterResolverResponse = z.infer<typeof RegisterResolverResponseSchema>;
2491
+ type UnregisterResolverRequest = z.infer<typeof UnregisterResolverRequestSchema>;
2492
+ type UnregisterResolverResponse = z.infer<typeof UnregisterResolverResponseSchema>;
2493
+ type MergeRejectedMessage = z.infer<typeof MergeRejectedMessageSchema>;
2494
+ type ListResolversRequest = z.infer<typeof ListResolversRequestSchema>;
2495
+ type ListResolversResponse = z.infer<typeof ListResolversResponseSchema>;
1307
2496
 
1308
2497
  /**
1309
2498
  * Write Concern - Configurable Acknowledgment Levels
@@ -1773,4 +2962,4 @@ type ReplicationProtocolMessage = ReplicationMessage | ReplicationBatchMessage |
1773
2962
  declare const PARTITION_COUNT = 271;
1774
2963
  declare const DEFAULT_BACKUP_COUNT = 1;
1775
2964
 
1776
- export { AuthMessageSchema, type BatchMessage, BatchMessageSchema, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type WriteOptions as ClusterWriteOptions, type ConnectionPoolConfig, type ConnectionState, ConsistencyLevel, DEFAULT_BACKUP_COUNT, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONNECTION_POOL_CONFIG, DEFAULT_MIGRATION_CONFIG, DEFAULT_PARTITION_ROUTER_CONFIG, DEFAULT_REPLICATION_CONFIG, DEFAULT_WRITE_CONCERN_TIMEOUT, HLC, LWWMap, type LWWRecord, LWWRecordSchema, LockReleaseSchema, LockRequestSchema, type MergeKeyResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapRecord, ORMapRecordSchema, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, PARTITION_COUNT, type PartitionChange, type PartitionInfo, type PartitionMap, type PartitionMapDeltaMessage, type PartitionMapMessage, type PartitionMapRequestMessage, PartitionMapRequestSchema, type PartitionMigration, type PartitionRouterConfig, PartitionState, type PendingWrite, type PermissionPolicy, type PermissionType, type PingMessage, PingMessageSchema, type PongMessage, PongMessageSchema, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type Query, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, type ReplicationAckMessage, type ReplicationBatchAckMessage, type ReplicationBatchMessage, type ReplicationConfig, type ReplicationHealth, type ReplicationLag, type ReplicationMessage, type ReplicationProtocolMessage, type ReplicationResult, type ReplicationTask, type RoutingError, type StaleMapError, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type Timestamp, TimestampSchema, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, WRITE_CONCERN_ORDER, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareTimestamps, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isUsingNativeHash, isWriteConcernAchieved, resetNativeHash, serialize, timestampToString };
2965
+ export { AuthMessageSchema, type BatchMessage, BatchMessageSchema, BuiltInProcessors, BuiltInResolvers, type CircuitBreakerConfig, type ClientOp, ClientOpMessageSchema, ClientOpSchema, type ClusterClientConfig, type ClusterEvents, type ReadOptions as ClusterReadOptions, type WriteOptions as ClusterWriteOptions, 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_WRITE_CONCERN_TIMEOUT, 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, HLC, 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, type ListResolversRequest, ListResolversRequestSchema, type ListResolversResponse, ListResolversResponseSchema, LockReleaseSchema, LockRequestSchema, type MergeContext, type MergeKeyResult, type MergeRejectedMessage, MergeRejectedMessageSchema, type MergeRejection, type MergeResult, MerkleReqBucketMessageSchema, MerkleTree, type Message, MessageSchema, type MigrationChunkAckMessage, type MigrationChunkMessage, type MigrationCompleteMessage, type MigrationConfig, type MigrationMessage, type MigrationMetrics, type MigrationStartMessage, type MigrationStatus, type MigrationVerifyMessage, type NodeHealth, type NodeInfo, type NodeStatus, type NotOwnerError, ORMap, ORMapDiffRequestSchema, ORMapDiffResponseSchema, type ORMapMerkleNode, ORMapMerkleReqBucketSchema, ORMapMerkleTree, ORMapPushDiffSchema, type ORMapRecord, ORMapRecordSchema, type ORMapSnapshot, ORMapSyncInitSchema, ORMapSyncRespBucketsSchema, ORMapSyncRespLeafSchema, ORMapSyncRespRootSchema, type OpAckMessage, OpAckMessageSchema, OpBatchMessageSchema, type OpRejectedMessage, OpRejectedMessageSchema, type OpResult, OpResultSchema, PARTITION_COUNT, type 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 PongMessage, PongMessageSchema, type PredicateNode, PredicateNodeSchema, type PredicateOp, PredicateOpSchema, Predicates, type Principal, type ProcessorRateLimitConfig, type Query, QuerySchema, QuerySubMessageSchema, QueryUnsubMessageSchema, RESOLVER_FORBIDDEN_PATTERNS, 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, Ringbuffer, type RoutingError, type StaleMapError, SyncInitMessageSchema, SyncRespBucketsMessageSchema, SyncRespLeafMessageSchema, SyncRespRootMessageSchema, type Timestamp, TimestampSchema, TopicMessageEventSchema, TopicPubSchema, TopicSubSchema, TopicUnsubSchema, type UnregisterResolverRequest, UnregisterResolverRequestSchema, type UnregisterResolverResponse, UnregisterResolverResponseSchema, WRITE_CONCERN_ORDER, WriteConcern, WriteConcernSchema, type WriteConcernValue, type WriteOptions$1 as WriteOptions, type WriteResult, combineHashes, compareHLCTimestamps, compareTimestamps, deepMerge, deserialize, disableNativeHash, evaluatePredicate, getHighestWriteConcernLevel, hashORMapEntry, hashORMapRecord, hashString, isUsingNativeHash, isWriteConcernAchieved, resetNativeHash, serialize, timestampToString, validateProcessorCode, validateResolverCode };