@fluidframework/map 2.0.0-dev.7.3.0.211848 → 2.0.0-dev.7.4.0.214930

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor.json +12 -1
  3. package/dist/{directory.js → directory.cjs} +222 -27
  4. package/dist/directory.cjs.map +1 -0
  5. package/dist/directory.d.ts +485 -2
  6. package/dist/directory.d.ts.map +1 -1
  7. package/dist/{index.js → index.cjs} +4 -4
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/{interfaces.js → interfaces.cjs} +1 -1
  10. package/dist/interfaces.cjs.map +1 -0
  11. package/dist/{internalInterfaces.js → internalInterfaces.cjs} +1 -1
  12. package/dist/internalInterfaces.cjs.map +1 -0
  13. package/dist/{localValues.js → localValues.cjs} +1 -1
  14. package/dist/localValues.cjs.map +1 -0
  15. package/dist/map-alpha.d.ts +950 -0
  16. package/dist/map-beta.d.ts +950 -0
  17. package/dist/map-public.d.ts +950 -0
  18. package/dist/map-untrimmed.d.ts +1035 -0
  19. package/dist/{map.js → map.cjs} +3 -3
  20. package/dist/map.cjs.map +1 -0
  21. package/dist/{mapKernel.js → mapKernel.cjs} +2 -2
  22. package/dist/mapKernel.cjs.map +1 -0
  23. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  24. package/dist/packageVersion.cjs.map +1 -0
  25. package/dist/packageVersion.d.ts +1 -1
  26. package/lib/directory.d.ts +485 -2
  27. package/lib/directory.d.ts.map +1 -1
  28. package/lib/{directory.js → directory.mjs} +222 -27
  29. package/lib/directory.mjs.map +1 -0
  30. package/lib/index.mjs +8 -0
  31. package/lib/index.mjs.map +1 -0
  32. package/lib/{interfaces.js → interfaces.mjs} +1 -1
  33. package/{dist/interfaces.js.map → lib/interfaces.mjs.map} +1 -1
  34. package/lib/{internalInterfaces.js → internalInterfaces.mjs} +1 -1
  35. package/{dist/internalInterfaces.js.map → lib/internalInterfaces.mjs.map} +1 -1
  36. package/lib/{localValues.js → localValues.mjs} +1 -1
  37. package/lib/localValues.mjs.map +1 -0
  38. package/lib/map-alpha.d.ts +950 -0
  39. package/lib/map-beta.d.ts +950 -0
  40. package/lib/map-public.d.ts +950 -0
  41. package/lib/map-untrimmed.d.ts +1035 -0
  42. package/lib/{map.js → map.mjs} +3 -3
  43. package/lib/map.mjs.map +1 -0
  44. package/lib/{mapKernel.js → mapKernel.mjs} +2 -2
  45. package/lib/mapKernel.mjs.map +1 -0
  46. package/lib/packageVersion.d.ts +1 -1
  47. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  48. package/lib/packageVersion.mjs.map +1 -0
  49. package/package.json +45 -27
  50. package/src/directory.ts +261 -22
  51. package/src/packageVersion.ts +1 -1
  52. package/tsc-multi.test.json +4 -0
  53. package/dist/directory.js.map +0 -1
  54. package/dist/index.js.map +0 -1
  55. package/dist/localValues.js.map +0 -1
  56. package/dist/map.js.map +0 -1
  57. package/dist/mapKernel.js.map +0 -1
  58. package/dist/packageVersion.js.map +0 -1
  59. package/lib/directory.js.map +0 -1
  60. package/lib/index.js +0 -19
  61. package/lib/index.js.map +0 -1
  62. package/lib/interfaces.js.map +0 -1
  63. package/lib/internalInterfaces.js.map +0 -1
  64. package/lib/localValues.js.map +0 -1
  65. package/lib/map.js.map +0 -1
  66. package/lib/mapKernel.js.map +0 -1
  67. package/lib/packageVersion.js.map +0 -1
  68. package/tsconfig.esnext.json +0 -6
@@ -2,12 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { TypedEventEmitter } from "@fluid-internal/client-utils";
5
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
7
  import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService, IChannelServices, IChannelFactory } from "@fluidframework/datastore-definitions";
7
8
  import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
8
9
  import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
9
- import { IDirectory, ISerializableValue, ISharedDirectory, ISharedDirectoryEvents } from "./interfaces";
10
- import { LocalValueMaker } from "./localValues";
10
+ import { RedBlackTree } from "@fluidframework/merge-tree";
11
+ import { IDirectory, IDirectoryEvents, ISerializableValue, ISerializedValue, ISharedDirectory, ISharedDirectoryEvents } from "./interfaces";
12
+ import { ILocalValue, LocalValueMaker } from "./localValues";
11
13
  /**
12
14
  * Operation indicating a value should be set for a key.
13
15
  *
@@ -221,6 +223,34 @@ export declare class DirectoryFactory implements IChannelFactory {
221
223
  */
222
224
  create(runtime: IFluidDataStoreRuntime, id: string): ISharedDirectory;
223
225
  }
226
+ /**
227
+ * The combination of sequence numebr and client sequence number of a subdirectory
228
+ */
229
+ interface SequenceData {
230
+ seq: number;
231
+ clientSeq?: number;
232
+ }
233
+ /**
234
+ * A utility class for tracking associations between keys and their creation indices.
235
+ * This is relevant to support map iteration in insertion order, see
236
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator/%40%40iterator
237
+ *
238
+ * TODO: It can be combined with the creation tracker utilized in SharedMap
239
+ */
240
+ declare class DirectoryCreationTracker {
241
+ readonly indexToKey: RedBlackTree<SequenceData, string>;
242
+ readonly keyToIndex: Map<string, SequenceData>;
243
+ constructor();
244
+ set(key: string, seqData: SequenceData): void;
245
+ has(keyOrSeqData: string | SequenceData): boolean;
246
+ delete(keyOrSeqData: string | SequenceData): void;
247
+ /**
248
+ * Retrieves all subdirectories with creation order that satisfy an optional constraint function.
249
+ * @param constraint - An optional constraint function that filters keys.
250
+ * @returns An array of keys that satisfy the constraint (or all keys if no constraint is provided).
251
+ */
252
+ keys(constraint?: (key: string) => boolean): string[];
253
+ }
224
254
  /**
225
255
  * {@inheritDoc ISharedDirectory}
226
256
  *
@@ -438,4 +468,457 @@ export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents
438
468
  protected applyStashedOp(op: unknown): unknown;
439
469
  private serializeDirectory;
440
470
  }
471
+ interface IKeyEditLocalOpMetadata {
472
+ type: "edit";
473
+ pendingMessageId: number;
474
+ previousValue: ILocalValue | undefined;
475
+ }
476
+ interface IClearLocalOpMetadata {
477
+ type: "clear";
478
+ pendingMessageId: number;
479
+ previousStorage: Map<string, ILocalValue>;
480
+ }
481
+ interface ICreateSubDirLocalOpMetadata {
482
+ type: "createSubDir";
483
+ }
484
+ interface IDeleteSubDirLocalOpMetadata {
485
+ type: "deleteSubDir";
486
+ subDirectory: SubDirectory | undefined;
487
+ }
488
+ type SubDirLocalOpMetadata = ICreateSubDirLocalOpMetadata | IDeleteSubDirLocalOpMetadata;
489
+ export type DirectoryLocalOpMetadata = IClearLocalOpMetadata | IKeyEditLocalOpMetadata | SubDirLocalOpMetadata;
490
+ /**
491
+ * Node of the directory tree.
492
+ * @sealed
493
+ */
494
+ declare class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirectory {
495
+ private readonly seqData;
496
+ private readonly clientIds;
497
+ private readonly directory;
498
+ private readonly runtime;
499
+ private readonly serializer;
500
+ readonly absolutePath: string;
501
+ /**
502
+ * Tells if the sub directory is deleted or not.
503
+ */
504
+ private _deleted;
505
+ /**
506
+ * String representation for the class.
507
+ */
508
+ [Symbol.toStringTag]: string;
509
+ /**
510
+ * The in-memory data the directory is storing.
511
+ */
512
+ private readonly _storage;
513
+ /**
514
+ * The subdirectories the directory is holding.
515
+ */
516
+ private readonly _subdirectories;
517
+ /**
518
+ * Keys that have been modified locally but not yet ack'd from the server. This is for operations on keys like
519
+ * set/delete operations on keys. The value of this map is list of pendingMessageIds at which that key
520
+ * was modified. We don't store the type of ops, and behaviour of key ops are different from behaviour of sub
521
+ * directory ops, so we have separate map from subDirectories tracker.
522
+ */
523
+ private readonly pendingKeys;
524
+ /**
525
+ * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the record
526
+ * of delete op that are pending or yet to be acked from server. This is maintained just to track the locally
527
+ * deleted sub directory.
528
+ */
529
+ private readonly pendingDeleteSubDirectoriesTracker;
530
+ /**
531
+ * Subdirectories that have been created locally but not yet ack'd from the server. This maintains the record
532
+ * of create op that are pending or yet to be acked from server. This is maintained just to track the locally
533
+ * created sub directory.
534
+ */
535
+ private readonly pendingCreateSubDirectoriesTracker;
536
+ /**
537
+ * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.
538
+ */
539
+ private pendingMessageId;
540
+ /**
541
+ * The pending ids of any clears that have been performed locally but not yet ack'd from the server
542
+ */
543
+ private readonly pendingClearMessageIds;
544
+ /**
545
+ * Assigns a unique ID to each subdirectory created locally but pending for acknowledgement, facilitating the tracking
546
+ * of the creation order.
547
+ */
548
+ localCreationSeq: number;
549
+ /**
550
+ * Maintains a bidirectional association between ack'd subdirectories and their seqData.
551
+ * This helps to ensure iteration order which is consistent with the JS map spec.
552
+ */
553
+ readonly ackedCreationSeqTracker: DirectoryCreationTracker;
554
+ /**
555
+ * Similar to {@link ackedCreationSeqTracker}, but for local (unacked) entries.
556
+ */
557
+ readonly localCreationSeqTracker: DirectoryCreationTracker;
558
+ /**
559
+ * Constructor.
560
+ * @param sequenceNumber - Message seq number at which this was created.
561
+ * @param clientIds - Ids of client which created this directory.
562
+ * @param directory - Reference back to the SharedDirectory to perform operations
563
+ * @param runtime - The data store runtime this directory is associated with
564
+ * @param serializer - The serializer to serialize / parse handles
565
+ * @param absolutePath - The absolute path of this IDirectory
566
+ */
567
+ constructor(seqData: SequenceData, clientIds: Set<string>, directory: SharedDirectory, runtime: IFluidDataStoreRuntime, serializer: IFluidSerializer, absolutePath: string);
568
+ dispose(error?: Error): void;
569
+ /**
570
+ * Unmark the deleted property only when rolling back delete.
571
+ */
572
+ private undispose;
573
+ get disposed(): boolean;
574
+ private throwIfDisposed;
575
+ /**
576
+ * Checks whether the given key exists in this IDirectory.
577
+ * @param key - The key to check
578
+ * @returns True if the key exists, false otherwise
579
+ */
580
+ has(key: string): boolean;
581
+ /**
582
+ * {@inheritDoc IDirectory.get}
583
+ */
584
+ get<T = unknown>(key: string): T | undefined;
585
+ /**
586
+ * {@inheritDoc IDirectory.set}
587
+ */
588
+ set<T = unknown>(key: string, value: T): this;
589
+ /**
590
+ * {@inheritDoc IDirectory.countSubDirectory}
591
+ */
592
+ countSubDirectory(): number;
593
+ /**
594
+ * {@inheritDoc IDirectory.createSubDirectory}
595
+ */
596
+ createSubDirectory(subdirName: string): IDirectory;
597
+ /**
598
+ * @returns The Sequence Data which should be used for local changes.
599
+ * @remarks While detached, 0 is used rather than -1 to represent a change which should be universally known (as opposed to known
600
+ * only by the local client). This ensures that if the directory is later attached, none of its data needs to be updated (the values
601
+ * last set while detached will now be known to any new client, until they are changed).
602
+ *
603
+ * The client sequence number is incremented by 1 for maintaining the internal order of locally created subdirectories
604
+ * TODO: Convert these conventions to named constants. The semantics used here match those for merge-tree.
605
+ */
606
+ private getLocalSeq;
607
+ /**
608
+ * {@inheritDoc IDirectory.getSubDirectory}
609
+ */
610
+ getSubDirectory(subdirName: string): IDirectory | undefined;
611
+ /**
612
+ * {@inheritDoc IDirectory.hasSubDirectory}
613
+ */
614
+ hasSubDirectory(subdirName: string): boolean;
615
+ /**
616
+ * {@inheritDoc IDirectory.deleteSubDirectory}
617
+ */
618
+ deleteSubDirectory(subdirName: string): boolean;
619
+ /**
620
+ * {@inheritDoc IDirectory.subdirectories}
621
+ */
622
+ subdirectories(): IterableIterator<[string, IDirectory]>;
623
+ /**
624
+ * {@inheritDoc IDirectory.getWorkingDirectory}
625
+ */
626
+ getWorkingDirectory(relativePath: string): IDirectory | undefined;
627
+ /**
628
+ * This checks if there is pending delete op for local delete for a given child subdirectory.
629
+ * @param subDirName - directory name.
630
+ * @returns true if there is pending delete.
631
+ */
632
+ isSubDirectoryDeletePending(subDirName: string): boolean;
633
+ /**
634
+ * Deletes the given key from within this IDirectory.
635
+ * @param key - The key to delete
636
+ * @returns True if the key existed and was deleted, false if it did not exist
637
+ */
638
+ delete(key: string): boolean;
639
+ /**
640
+ * Deletes all keys from within this IDirectory.
641
+ */
642
+ clear(): void;
643
+ /**
644
+ * Issue a callback on each entry under this IDirectory.
645
+ * @param callback - Callback to issue
646
+ */
647
+ forEach(callback: (value: unknown, key: string, map: Map<string, unknown>) => void): void;
648
+ /**
649
+ * The number of entries under this IDirectory.
650
+ */
651
+ get size(): number;
652
+ /**
653
+ * Get an iterator over the entries under this IDirectory.
654
+ * @returns The iterator
655
+ */
656
+ entries(): IterableIterator<[string, unknown]>;
657
+ /**
658
+ * Get an iterator over the keys under this IDirectory.
659
+ * @returns The iterator
660
+ */
661
+ keys(): IterableIterator<string>;
662
+ /**
663
+ * Get an iterator over the values under this IDirectory.
664
+ * @returns The iterator
665
+ */
666
+ values(): IterableIterator<unknown>;
667
+ /**
668
+ * Get an iterator over the entries under this IDirectory.
669
+ * @returns The iterator
670
+ */
671
+ [Symbol.iterator](): IterableIterator<[string, unknown]>;
672
+ /**
673
+ * Process a clear operation.
674
+ * @param msg - The message from the server to apply.
675
+ * @param op - The op to process
676
+ * @param local - Whether the message originated from the local client
677
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
678
+ * For messages from a remote client, this will be undefined.
679
+ * @internal
680
+ */
681
+ processClearMessage(msg: ISequencedDocumentMessage, op: IDirectoryClearOperation, local: boolean, localOpMetadata: unknown): void;
682
+ /**
683
+ * Apply clear operation locally and generate metadata
684
+ * @param op - Op to apply
685
+ * @returns metadata generated for stahed op
686
+ */
687
+ applyStashedClearMessage(op: IDirectoryClearOperation): IClearLocalOpMetadata;
688
+ /**
689
+ * Process a delete operation.
690
+ * @param msg - The message from the server to apply.
691
+ * @param op - The op to process
692
+ * @param local - Whether the message originated from the local client
693
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
694
+ * For messages from a remote client, this will be undefined.
695
+ * @internal
696
+ */
697
+ processDeleteMessage(msg: ISequencedDocumentMessage, op: IDirectoryDeleteOperation, local: boolean, localOpMetadata: unknown): void;
698
+ /**
699
+ * Apply delete operation locally and generate metadata
700
+ * @param op - Op to apply
701
+ * @returns metadata generated for stahed op
702
+ */
703
+ applyStashedDeleteMessage(op: IDirectoryDeleteOperation): IKeyEditLocalOpMetadata;
704
+ /**
705
+ * Process a set operation.
706
+ * @param msg - The message from the server to apply.
707
+ * @param op - The op to process
708
+ * @param local - Whether the message originated from the local client
709
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
710
+ * For messages from a remote client, this will be undefined.
711
+ * @internal
712
+ */
713
+ processSetMessage(msg: ISequencedDocumentMessage, op: IDirectorySetOperation, context: ILocalValue | undefined, local: boolean, localOpMetadata: unknown): void;
714
+ /**
715
+ * Apply set operation locally and generate metadata
716
+ * @param op - Op to apply
717
+ * @returns metadata generated for stahed op
718
+ */
719
+ applyStashedSetMessage(op: IDirectorySetOperation, context: ILocalValue): IKeyEditLocalOpMetadata;
720
+ /**
721
+ * Process a create subdirectory operation.
722
+ * @param msg - The message from the server to apply.
723
+ * @param op - The op to process
724
+ * @param local - Whether the message originated from the local client
725
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
726
+ * For messages from a remote client, this will be undefined.
727
+ * @internal
728
+ */
729
+ processCreateSubDirectoryMessage(msg: ISequencedDocumentMessage, op: IDirectoryCreateSubDirectoryOperation, local: boolean, localOpMetadata: unknown): void;
730
+ /**
731
+ * Apply createSubDirectory operation locally and generate metadata
732
+ * @param op - Op to apply
733
+ * @returns metadata generated for stahed op
734
+ */
735
+ applyStashedCreateSubDirMessage(op: IDirectoryCreateSubDirectoryOperation): ICreateSubDirLocalOpMetadata;
736
+ /**
737
+ * Process a delete subdirectory operation.
738
+ * @param msg - The message from the server to apply.
739
+ * @param op - The op to process
740
+ * @param local - Whether the message originated from the local client
741
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
742
+ * For messages from a remote client, this will be undefined.
743
+ * @internal
744
+ */
745
+ processDeleteSubDirectoryMessage(msg: ISequencedDocumentMessage, op: IDirectoryDeleteSubDirectoryOperation, local: boolean, localOpMetadata: unknown): void;
746
+ /**
747
+ * Apply deleteSubDirectory operation locally and generate metadata
748
+ * @param op - Op to apply
749
+ * @returns metadata generated for stahed op
750
+ */
751
+ applyStashedDeleteSubDirMessage(op: IDirectoryDeleteSubDirectoryOperation): IDeleteSubDirLocalOpMetadata;
752
+ /**
753
+ * Submit a clear operation.
754
+ * @param op - The operation
755
+ */
756
+ private submitClearMessage;
757
+ /**
758
+ * Resubmit a clear operation.
759
+ * @param op - The operation
760
+ * @internal
761
+ */
762
+ resubmitClearMessage(op: IDirectoryClearOperation, localOpMetadata: unknown): void;
763
+ /**
764
+ * Get a new pending message id for the op and cache it to track the pending op
765
+ */
766
+ private getKeyMessageId;
767
+ /**
768
+ * Submit a key operation.
769
+ * @param op - The operation
770
+ * @param previousValue - The value of the key before this op
771
+ */
772
+ private submitKeyMessage;
773
+ /**
774
+ * Submit a key message to remote clients based on a previous submit.
775
+ * @param op - The map key message
776
+ * @param localOpMetadata - Metadata from the previous submit
777
+ * @internal
778
+ */
779
+ resubmitKeyMessage(op: IDirectoryKeyOperation, localOpMetadata: unknown): void;
780
+ private incrementPendingSubDirCount;
781
+ private decrementPendingSubDirCount;
782
+ /**
783
+ * Update the count for pending create/delete of the sub directory so that it can be validated on receiving op
784
+ * or while resubmitting the op.
785
+ */
786
+ private updatePendingSubDirMessageCount;
787
+ /**
788
+ * Submit a create subdirectory operation.
789
+ * @param op - The operation
790
+ */
791
+ private submitCreateSubDirectoryMessage;
792
+ /**
793
+ * Submit a delete subdirectory operation.
794
+ * @param op - The operation
795
+ * @param subDir - Any subdirectory deleted by the op
796
+ */
797
+ private submitDeleteSubDirectoryMessage;
798
+ /**
799
+ * Submit a subdirectory operation again
800
+ * @param op - The operation
801
+ * @param localOpMetadata - metadata submitted with the op originally
802
+ * @internal
803
+ */
804
+ resubmitSubDirectoryMessage(op: IDirectorySubDirectoryOperation, localOpMetadata: unknown): void;
805
+ /**
806
+ * Get the storage of this subdirectory in a serializable format, to be used in snapshotting.
807
+ * @param serializer - The serializer to use to serialize handles in its values.
808
+ * @returns The JSONable string representing the storage of this subdirectory
809
+ * @internal
810
+ */
811
+ getSerializedStorage(serializer: IFluidSerializer): Generator<[string, ISerializedValue], void>;
812
+ getSerializableCreateInfo(): ICreateInfo;
813
+ /**
814
+ * Populate a key value in this subdirectory's storage, to be used when loading from snapshot.
815
+ * @param key - The key to populate
816
+ * @param localValue - The local value to populate into it
817
+ * @internal
818
+ */
819
+ populateStorage(key: string, localValue: ILocalValue): void;
820
+ /**
821
+ * Populate a subdirectory into this subdirectory, to be used when loading from snapshot.
822
+ * @param subdirName - The name of the subdirectory to add
823
+ * @param newSubDir - The new subdirectory to add
824
+ * @internal
825
+ */
826
+ populateSubDirectory(subdirName: string, newSubDir: SubDirectory): void;
827
+ /**
828
+ * Retrieve the local value at the given key. This is used to get value type information stashed on the local
829
+ * value so op handlers can be retrieved
830
+ * @param key - The key to retrieve from
831
+ * @returns The local value
832
+ * @internal
833
+ */
834
+ getLocalValue<T extends ILocalValue = ILocalValue>(key: string): T;
835
+ /**
836
+ * Remove the pendingMessageId from the map tracking it on rollback
837
+ * @param map - map tracking the pending messages
838
+ * @param key - key of the edit in the op
839
+ */
840
+ private rollbackPendingMessageId;
841
+ /**
842
+ * Rollback a local op
843
+ * @param op - The operation to rollback
844
+ * @param localOpMetadata - The local metadata associated with the op.
845
+ */
846
+ rollback(op: any, localOpMetadata: unknown): void;
847
+ /**
848
+ * Converts the given relative path into an absolute path.
849
+ * @param path - Relative path to convert
850
+ * @returns The equivalent absolute path
851
+ */
852
+ private makeAbsolute;
853
+ /**
854
+ * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should
855
+ * not process the incoming operation.
856
+ * @param op - Operation to check
857
+ * @param local - Whether the operation originated from the local client
858
+ * @param localOpMetadata - For local client ops, this is the metadata that was submitted with the op.
859
+ * For ops from a remote client, this will be undefined.
860
+ * @returns True if the operation should be processed, false otherwise
861
+ */
862
+ private needProcessStorageOperation;
863
+ /**
864
+ * This return true if the message is for the current instance of this sub directory. As the sub directory
865
+ * can be deleted and created again, then this finds if the message is for current instance of directory or not.
866
+ * @param msg - message for the directory
867
+ */
868
+ private isMessageForCurrentInstanceOfSubDirectory;
869
+ /**
870
+ * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should
871
+ * not process the incoming operation.
872
+ * @param op - Operation to check
873
+ * @param local - Whether the message originated from the local client
874
+ * @param message - The message
875
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
876
+ * For messages from a remote client, this will be undefined.
877
+ * @returns True if the operation should be processed, false otherwise
878
+ */
879
+ private needProcessSubDirectoryOperation;
880
+ /**
881
+ * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.
882
+ */
883
+ private clearExceptPendingKeys;
884
+ /**
885
+ * Clear implementation used for both locally sourced clears as well as incoming remote clears.
886
+ * @param local - Whether the message originated from the local client
887
+ */
888
+ private clearCore;
889
+ /**
890
+ * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.
891
+ * @param key - The key being deleted
892
+ * @param local - Whether the message originated from the local client
893
+ * @returns Previous local value of the key if it existed, undefined if it did not exist
894
+ */
895
+ private deleteCore;
896
+ /**
897
+ * Set implementation used for both locally sourced sets as well as incoming remote sets.
898
+ * @param key - The key being set
899
+ * @param value - The value being set
900
+ * @param local - Whether the message originated from the local client
901
+ * @returns Previous local value of the key, if any
902
+ */
903
+ private setCore;
904
+ /**
905
+ * Create subdirectory implementation used for both locally sourced creation as well as incoming remote creation.
906
+ * @param subdirName - The name of the subdirectory being created
907
+ * @param local - Whether the message originated from the local client
908
+ * @param seqData - Sequence number and client sequence number at which this directory is created
909
+ * @param clientId - Id of client which created this directory.
910
+ * @returns True if is newly created, false if it already existed.
911
+ */
912
+ private createSubDirectoryCore;
913
+ private registerEventsOnSubDirectory;
914
+ /**
915
+ * Delete subdirectory implementation used for both locally sourced creation as well as incoming remote creation.
916
+ * @param subdirName - The name of the subdirectory being deleted
917
+ * @param local - Whether the message originated from the local client
918
+ */
919
+ private deleteSubDirectoryCore;
920
+ private disposeSubDirectoryTree;
921
+ private undeleteSubDirectoryTree;
922
+ }
923
+ export {};
441
924
  //# sourceMappingURL=directory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAa,MAAM,oCAAoC,CAAC;AAG/F,OAAO,EACN,UAAU,EAIV,kBAAkB,EAElB,gBAAgB,EAChB,sBAAsB,EAEtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,eAAe,EAAoB,MAAM,eAAe,CAAC;AAsC/E;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IAEH,KAAK,EAAE,kBAAkB,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,sBAAsB,GAAG,yBAAyB,CAAC;AAExF;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,IAAI,EAAE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ACH,OAAO,CAAC,gCAAgC;IA4GxC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B;;;OAGG;IACH,OAAO,CAAC,SAAS;IAKjB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAalB;;;;;;OAMG;IACH,OAAO,CAAC,OAAO;IAWf;;;;;;;OAOG;IACH,OAAO,CAAC,sBAAsB;IAqC9B,OAAO,CAAC,4BAA4B;IASpC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAsB9B,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,wBAAwB;CAQhC"}
@@ -16,12 +16,12 @@ exports.SharedMap = exports.MapFactory = exports.LocalValueMaker = exports.Share
16
16
  *
17
17
  * @packageDocumentation
18
18
  */
19
- var directory_1 = require("./directory");
19
+ var directory_1 = require("./directory.cjs");
20
20
  Object.defineProperty(exports, "DirectoryFactory", { enumerable: true, get: function () { return directory_1.DirectoryFactory; } });
21
21
  Object.defineProperty(exports, "SharedDirectory", { enumerable: true, get: function () { return directory_1.SharedDirectory; } });
22
- var localValues_1 = require("./localValues");
22
+ var localValues_1 = require("./localValues.cjs");
23
23
  Object.defineProperty(exports, "LocalValueMaker", { enumerable: true, get: function () { return localValues_1.LocalValueMaker; } });
24
- var map_1 = require("./map");
24
+ var map_1 = require("./map.cjs");
25
25
  Object.defineProperty(exports, "MapFactory", { enumerable: true, get: function () { return map_1.MapFactory; } });
26
26
  Object.defineProperty(exports, "SharedMap", { enumerable: true, get: function () { return map_1.SharedMap; } });
27
- //# sourceMappingURL=index.js.map
27
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;GAUG;AAEH,6CAeqB;AAdpB,6GAAA,gBAAgB,OAAA;AAahB,4GAAA,eAAe,OAAA;AAchB,iDAA6D;AAApD,8GAAA,eAAe,OAAA;AACxB,iCAA8C;AAArC,iGAAA,UAAU,OAAA;AAAE,gGAAA,SAAS,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `map` library provides interfaces and implementing classes for map-like distributed data structures.\n *\n * @remarks The following distributed data structures are defined in this library:\n *\n * - {@link SharedMap}\n *\n * - {@link SharedDirectory}\n *\n * @packageDocumentation\n */\n\nexport {\n\tDirectoryFactory,\n\tICreateInfo,\n\tIDirectoryClearOperation,\n\tIDirectoryCreateSubDirectoryOperation,\n\tIDirectoryDataObject,\n\tIDirectoryDeleteOperation,\n\tIDirectoryDeleteSubDirectoryOperation,\n\tIDirectoryKeyOperation,\n\tIDirectoryNewStorageFormat,\n\tIDirectoryOperation,\n\tIDirectorySetOperation,\n\tIDirectoryStorageOperation,\n\tIDirectorySubDirectoryOperation,\n\tSharedDirectory,\n} from \"./directory\";\nexport {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\tISerializableValue,\n\tISerializedValue,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tISharedMap,\n\tISharedMapEvents,\n\tIValueChanged,\n} from \"./interfaces\";\nexport { LocalValueMaker, ILocalValue } from \"./localValues\";\nexport { MapFactory, SharedMap } from \"./map\";\n"]}
@@ -4,4 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=interfaces.js.map
7
+ //# sourceMappingURL=interfaces.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.cjs","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport {\n\tIDisposable,\n\tIEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n *\n * @public\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpreviousValue: any;\n}\n\n/**\n * Interface describing actions on a directory.\n *\n * @remarks When used as a Map, operates on its keys.\n *\n * @public\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IDirectory\n\textends Map<string, any>,\n\t\tIEventProvider<IDirectoryEvents>,\n\t\tPartial<IDisposable> {\n\t/**\n\t * The absolute path of the directory.\n\t */\n\treadonly absolutePath: string;\n\n\t/**\n\t * Retrieves the value stored at the given key from the directory.\n\t * @param key - Key to retrieve from\n\t * @returns The stored value, or undefined if the key is not set\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget<T = any>(key: string): T | undefined;\n\n\t/**\n\t * Sets the value stored at key to the provided value.\n\t * @param key - Key to set at\n\t * @param value - Value to set\n\t * @returns The IDirectory itself\n\t */\n\tset<T = unknown>(key: string, value: T): this;\n\n\t/**\n\t * Get the number of sub directory within the directory.\n\t * @returns The number of sub directory within a directory.\n\t */\n\tcountSubDirectory?(): number;\n\n\t/**\n\t * Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the\n\t * same name already exists.\n\t * @param subdirName - Name of the new child directory to create\n\t * @returns The IDirectory child that was created or retrieved\n\t */\n\tcreateSubDirectory(subdirName: string): IDirectory;\n\n\t/**\n\t * Gets an IDirectory child of this IDirectory, if it exists.\n\t * @param subdirName - Name of the child directory to get\n\t * @returns The requested IDirectory\n\t */\n\tgetSubDirectory(subdirName: string): IDirectory | undefined;\n\n\t/**\n\t * Checks whether this directory has a child directory with the given name.\n\t * @param subdirName - Name of the child directory to check\n\t * @returns True if it exists, false otherwise\n\t */\n\thasSubDirectory(subdirName: string): boolean;\n\n\t/**\n\t * Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.\n\t * @param subdirName - Name of the child directory to delete\n\t * @returns True if the IDirectory existed and was deleted, false if it did not exist\n\t */\n\tdeleteSubDirectory(subdirName: string): boolean;\n\n\t/**\n\t * Gets an iterator over the IDirectory children of this IDirectory.\n\t * @returns The IDirectory iterator\n\t */\n\tsubdirectories(): IterableIterator<[string, IDirectory]>;\n\n\t/**\n\t * Get an IDirectory within the directory, in order to use relative paths from that location.\n\t * @param relativePath - Path of the IDirectory to get, relative to this IDirectory\n\t * @returns The requested IDirectory\n\t */\n\tgetWorkingDirectory(relativePath: string): IDirectory | undefined;\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n *\n * @remarks\n * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.\n *\n * @public\n */\nexport interface ISharedDirectoryEvents extends ISharedObjectEvents {\n\t/**\n\t * Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any\n\t * subdirectory.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed, its value prior to the change, and the path to the\n\t * key that changed.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (\n\t\t\tchanged: IDirectoryValueChanged,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n\n\t/**\n\t * Emitted when the {@link ISharedDirectory} is cleared.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `local` - Whether the clear originated from this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(event: \"clear\", listener: (local: boolean, target: IEventThisPlaceHolder) => void);\n\n\t/**\n\t * Emitted when a subdirectory is created.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is created.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the create originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryCreated\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is deleted.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the delete originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryDeleted\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n *\n * @public\n */\nexport interface IDirectoryEvents extends IEvent {\n\t/**\n\t * Emitted when a key is set or deleted. As opposed to the\n\t * {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly\n\t * contains the key.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed and its value prior to the change.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(\n\t\tevent: \"containedValueChanged\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is created. Also emitted when a delete\n\t * of a subdirectory is rolled back.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is created.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the creation originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryCreated\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is deleted.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the delete originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryDeleted\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when this sub directory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(event: \"disposed\", listener: (target: IEventThisPlaceHolder) => void);\n\n\t/**\n\t * Emitted when this previously deleted sub directory is restored.\n\t * This event only needs to be handled in the case of rollback. If your application does\n\t * not use the local rollback feature, you can ignore this event.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(event: \"undisposed\", listener: (target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Provides a hierarchical organization of map-like data structures as SubDirectories.\n * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.\n * SubDirectories can be retrieved for use as working directories.\n *\n * @public\n */\nexport interface ISharedDirectory\n\textends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,\n\t\tOmit<IDirectory, \"on\" | \"once\" | \"off\"> {\n\t// The Omit type excludes symbols, which we don't want to exclude. Adding them back here manually.\n\t// https://github.com/microsoft/TypeScript/issues/31671\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[Symbol.iterator](): IterableIterator<[string, any]>;\n\treadonly [Symbol.toStringTag]: string;\n}\n\n/**\n * Type of \"valueChanged\" event parameter for {@link ISharedDirectory}.\n *\n * @public\n */\nexport interface IDirectoryValueChanged extends IValueChanged {\n\t/**\n\t * The absolute path to the IDirectory storing the key which changed.\n\t */\n\tpath: string;\n}\n\n/**\n * Events emitted in response to changes to the {@link ISharedMap | map} data.\n *\n * @public\n */\nexport interface ISharedMapEvents extends ISharedObjectEvents {\n\t/**\n\t * Emitted when a key is set or deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed and its value prior to the change.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link ISharedMap} itself.\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when the map is cleared.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `local` - Whether the clear originated from this client.\n\t *\n\t * - `target` - The {@link ISharedMap} itself.\n\t */\n\t(event: \"clear\", listener: (local: boolean, target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting\n * and retrieving values that JavaScript developers are accustomed to with the\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.\n * However, the keys of a SharedMap must be strings, and the values must either be a JSON-serializable object or a\n * {@link @fluidframework/datastore#FluidObjectHandle}.\n *\n * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.\n *\n * @public\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {\n\t/**\n\t * Retrieves the given key from the map if it exists.\n\t * @param key - Key to retrieve from\n\t * @returns The stored value, or undefined if the key is not set\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget<T = any>(key: string): T | undefined;\n\n\t/**\n\t * Sets the value stored at key to the provided value.\n\t * @param key - Key to set\n\t * @param value - Value to set\n\t * @returns The {@link ISharedMap} itself\n\t */\n\tset<T = unknown>(key: string, value: T): this;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * {@link ISerializableValue.\"type\"} to understand whether they're storing a Plain JavaScript object,\n * a {@link @fluidframework/shared-object-base#SharedObject}, or a value type.\n *\n * @remarks\n *\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will\n * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members\n * that are ISerializedHandle (the serialized form of a handle).\n *\n * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how\n * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.\n * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a\n * channel ID.\n *\n * @deprecated This type is legacy and deprecated.\n *\n * @public\n */\nexport interface ISerializableValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tvalue: any;\n}\n\n/**\n * Serialized {@link ISerializableValue} counterpart.\n *\n * @public\n */\nexport interface ISerializedValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t *\n\t * @remarks Will be undefined if the original value was undefined.\n\t */\n\tvalue: string | undefined;\n}\n"]}
@@ -4,4 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=internalInterfaces.js.map
7
+ //# sourceMappingURL=internalInterfaces.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internalInterfaces.cjs","sourceRoot":"","sources":["../src/internalInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue } from \"./interfaces\";\nimport { ILocalValue } from \"./localValues\";\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IMapSetOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"set\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value to be set on the key.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tvalue: ISerializableValue;\n}\n\n/**\n * Operation indicating the map should be cleared.\n */\nexport interface IMapClearOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n}\n\n/**\n * Operation indicating a key should be deleted from the map.\n */\nexport interface IMapDeleteOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"delete\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n}\n\n/**\n * Metadata for an local `edit` operation.\n */\nexport interface IMapKeyEditLocalOpMetadata {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"edit\";\n\n\t/**\n\t * Unique identifier for the local operation.\n\t */\n\tpendingMessageId: number;\n\n\t/**\n\t * Local value prior to the edit.\n\t */\n\tpreviousValue: ILocalValue;\n}\n\n/**\n * Metadata for an local `add` operation.\n */\nexport interface IMapKeyAddLocalOpMetadata {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"add\";\n\n\t/**\n\t * Unique identifier for the local operation.\n\t */\n\tpendingMessageId: number;\n}\n\n/**\n * Metadata for an local `clear` operation.\n */\nexport interface IMapClearLocalOpMetadata {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n\n\t/**\n\t * Unique identifier for the local operation.\n\t */\n\tpendingMessageId: number;\n\n\t/**\n\t * Local map contents prior to clearing it.\n\t */\n\tpreviousMap?: Map<string, ILocalValue>;\n}\n\n/**\n * Metadata for a local operation associated with a specific key entry in the map.\n */\nexport type MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\n\n/**\n * Metadata for a local operation.\n */\nexport type MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n"]}
@@ -97,4 +97,4 @@ class LocalValueMaker {
97
97
  }
98
98
  }
99
99
  exports.LocalValueMaker = LocalValueMaker;
100
- //# sourceMappingURL=localValues.js.map
100
+ //# sourceMappingURL=localValues.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localValues.cjs","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAM4C;AA+B5C;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAC/B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAGlB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACN,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,mEAAmE;QACnE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAC7C,CAAC;AACH,CAAC;AAZD,4CAYC;AAED;;GAEG;AACH,MAAa,eAAe;IAC3B;;;OAGG;IACH,YAAmC,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;IAAG,CAAC;IAErD;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,8BAAS,CAAC,8BAAS,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,UAA4B,EAAE,IAAkB;QACrE,2FAA2F;QAC3F,oBAAoB;QACpB,MAAM,KAAK,GAAG,IAAA,qCAAgB,EAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAE7D,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACL,CAAC;IACH,CAAC;CACD;AA3BD,0CA2BC;AAED;;;;;GAKG;AACH,MAAa,eAAe;IAC3B;;;OAGG;IACH,YAAoC,UAA4B;QAA5B,eAAU,GAAV,UAAU,CAAkB;IAAG,CAAC;IAEpE;;;OAGG;IACH,gDAAgD;IACzC,gBAAgB,CAAC,YAAgC;QACvD,2CAA2C;QAC3C,IAAI,YAAY,CAAC,IAAI,KAAK,8BAAS,CAAC,8BAAS,CAAC,MAAM,CAAC,EAAE;YACtD,YAAY,CAAC,IAAI,GAAG,8BAAS,CAAC,8BAAS,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAsB;gBACjC,IAAI,EAAE,kBAAkB;gBACxB,GAAG,EAAE,YAAY,CAAC,KAAe;aACjC,CAAC;YACF,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC;SAC5B;QAED,MAAM,eAAe,GAAY,IAAA,iCAAY,EAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEnF,OAAO,IAAI,eAAe,CAAC,eAAe,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,KAAc;QACjC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACD;AApCD,0CAoCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidSerializer,\n\tISerializedHandle,\n\tparseHandles,\n\tserializeHandles,\n\tValueType,\n} from \"@fluidframework/shared-object-base\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue, ISerializedValue } from \"./interfaces\";\n\n/**\n * A local value to be stored in a container type Distributed Data Store (DDS).\n *\n * @public\n */\nexport interface ILocalValue {\n\t/**\n\t * Type indicator of the value stored within.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The in-memory value stored within.\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treadonly value: any;\n\n\t/**\n\t * Retrieve the serialized form of the value stored within.\n\t * @param serializer - Data store runtime's serializer\n\t * @param bind - Container type's handle\n\t * @returns The serialized form of the contained value\n\t */\n\tmakeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;\n}\n\n/**\n * Converts the provided `localValue` to its serialized form.\n *\n * @param localValue - The value to serialize.\n * @param serializer - Data store runtime's serializer.\n * @param bind - Container type's handle.\n *\n * @see {@link ILocalValue.makeSerialized}\n */\nexport function makeSerializable(\n\tlocalValue: ILocalValue,\n\tserializer: IFluidSerializer,\n\tbind: IFluidHandle,\n\t// eslint-disable-next-line import/no-deprecated\n): ISerializableValue {\n\tconst value = localValue.makeSerialized(serializer, bind);\n\treturn {\n\t\ttype: value.type,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tvalue: value.value && JSON.parse(value.value),\n\t};\n}\n\n/**\n * Manages a contained plain value. May also contain shared object handles.\n */\nexport class PlainLocalValue implements ILocalValue {\n\t/**\n\t * Create a new PlainLocalValue.\n\t * @param value - The value to store, which may contain shared object handles\n\t */\n\tpublic constructor(public readonly value: unknown) {}\n\n\t/**\n\t * {@inheritDoc ILocalValue.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn ValueType[ValueType.Plain];\n\t}\n\n\t/**\n\t * {@inheritDoc ILocalValue.makeSerialized}\n\t */\n\tpublic makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue {\n\t\t// Stringify to convert to the serialized handle values - and then parse in order to create\n\t\t// a POJO for the op\n\t\tconst value = serializeHandles(this.value, serializer, bind);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tvalue,\n\t\t};\n\t}\n}\n\n/**\n * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local\n * values with minimal awareness of how those objects are stored, serialized, and deserialized.\n *\n * @public\n */\nexport class LocalValueMaker {\n\t/**\n\t * Create a new LocalValueMaker.\n\t * @param serializer - The serializer to serialize / parse handles.\n\t */\n\tpublic constructor(private readonly serializer: IFluidSerializer) {}\n\n\t/**\n\t * Create a new local value from an incoming serialized value.\n\t * @param serializable - The serializable value to make local\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic fromSerializable(serializable: ISerializableValue): ILocalValue {\n\t\t// Migrate from old shared value to handles\n\t\tif (serializable.type === ValueType[ValueType.Shared]) {\n\t\t\tserializable.type = ValueType[ValueType.Plain];\n\t\t\tconst handle: ISerializedHandle = {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: serializable.value as string,\n\t\t\t};\n\t\t\tserializable.value = handle;\n\t\t}\n\n\t\tconst translatedValue: unknown = parseHandles(serializable.value, this.serializer);\n\n\t\treturn new PlainLocalValue(translatedValue);\n\t}\n\n\t/**\n\t * Create a new local value containing a given plain object.\n\t * @param value - The value to store\n\t * @returns An ILocalValue containing the value\n\t */\n\tpublic fromInMemory(value: unknown): ILocalValue {\n\t\treturn new PlainLocalValue(value);\n\t}\n}\n"]}