@fluidframework/sequence 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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.
Files changed (94) hide show
  1. package/.eslintrc.js +9 -12
  2. package/.mocharc.js +2 -2
  3. package/.vscode/launch.json +15 -14
  4. package/README.md +188 -179
  5. package/api-extractor.json +2 -2
  6. package/dist/defaultMap.d.ts.map +1 -1
  7. package/dist/defaultMap.js +5 -4
  8. package/dist/defaultMap.js.map +1 -1
  9. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  10. package/dist/defaultMapInterfaces.js.map +1 -1
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/intervalCollection.d.ts.map +1 -1
  15. package/dist/intervalCollection.js +50 -36
  16. package/dist/intervalCollection.js.map +1 -1
  17. package/dist/intervalTree.d.ts.map +1 -1
  18. package/dist/intervalTree.js.map +1 -1
  19. package/dist/localValues.d.ts.map +1 -1
  20. package/dist/localValues.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/sequence.d.ts +1 -1
  25. package/dist/sequence.d.ts.map +1 -1
  26. package/dist/sequence.js +13 -17
  27. package/dist/sequence.js.map +1 -1
  28. package/dist/sequenceDeltaEvent.d.ts.map +1 -1
  29. package/dist/sequenceDeltaEvent.js.map +1 -1
  30. package/dist/sequenceFactory.d.ts.map +1 -1
  31. package/dist/sequenceFactory.js.map +1 -1
  32. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  33. package/dist/sharedIntervalCollection.js.map +1 -1
  34. package/dist/sharedSequence.d.ts.map +1 -1
  35. package/dist/sharedSequence.js +3 -3
  36. package/dist/sharedSequence.js.map +1 -1
  37. package/dist/sharedString.d.ts.map +1 -1
  38. package/dist/sharedString.js +5 -4
  39. package/dist/sharedString.js.map +1 -1
  40. package/lib/defaultMap.d.ts.map +1 -1
  41. package/lib/defaultMap.js +6 -5
  42. package/lib/defaultMap.js.map +1 -1
  43. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  44. package/lib/defaultMapInterfaces.js.map +1 -1
  45. package/lib/index.d.ts +2 -2
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/index.js +2 -2
  48. package/lib/index.js.map +1 -1
  49. package/lib/intervalCollection.d.ts.map +1 -1
  50. package/lib/intervalCollection.js +50 -36
  51. package/lib/intervalCollection.js.map +1 -1
  52. package/lib/intervalTree.d.ts.map +1 -1
  53. package/lib/intervalTree.js.map +1 -1
  54. package/lib/localValues.d.ts.map +1 -1
  55. package/lib/localValues.js +1 -1
  56. package/lib/localValues.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.js +1 -1
  59. package/lib/packageVersion.js.map +1 -1
  60. package/lib/sequence.d.ts +1 -1
  61. package/lib/sequence.d.ts.map +1 -1
  62. package/lib/sequence.js +15 -19
  63. package/lib/sequence.js.map +1 -1
  64. package/lib/sequenceDeltaEvent.d.ts.map +1 -1
  65. package/lib/sequenceDeltaEvent.js.map +1 -1
  66. package/lib/sequenceFactory.d.ts.map +1 -1
  67. package/lib/sequenceFactory.js +1 -1
  68. package/lib/sequenceFactory.js.map +1 -1
  69. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  70. package/lib/sharedIntervalCollection.js.map +1 -1
  71. package/lib/sharedSequence.d.ts.map +1 -1
  72. package/lib/sharedSequence.js +4 -4
  73. package/lib/sharedSequence.js.map +1 -1
  74. package/lib/sharedString.d.ts.map +1 -1
  75. package/lib/sharedString.js +5 -4
  76. package/lib/sharedString.js.map +1 -1
  77. package/package.json +55 -55
  78. package/prettier.config.cjs +1 -1
  79. package/src/defaultMap.ts +406 -405
  80. package/src/defaultMapInterfaces.ts +120 -115
  81. package/src/index.ts +27 -17
  82. package/src/intervalCollection.ts +2198 -1997
  83. package/src/intervalTree.ts +139 -139
  84. package/src/localValues.ts +64 -73
  85. package/src/packageVersion.ts +1 -1
  86. package/src/sequence.ts +739 -694
  87. package/src/sequenceDeltaEvent.ts +143 -137
  88. package/src/sequenceFactory.ts +48 -46
  89. package/src/sharedIntervalCollection.ts +150 -136
  90. package/src/sharedSequence.ts +165 -160
  91. package/src/sharedString.ts +385 -343
  92. package/tsconfig.esnext.json +6 -6
  93. package/tsconfig.json +8 -12
  94. package/.editorconfig +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQ9D,OAAO,EAA6B,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAE9F,OAAO,EACH,uBAAuB,EAEvB,YAAY,GACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGH,2BAA2B,GAE9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IASxC,IAAW,IAAI;QACX,OAAO,+BAA+B,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,+BAA+B,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,GAAG,GAAG,IAAI,wBAAwB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,MAAM,CA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AAC,CAAC;QACjE,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAES,aAAa,CAAC,UAA4B;QAChD,OAAO,uBAAuB,CAAC,gBAAgB,EAAE,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACrG,CAAC;IAES,YAAY,CAAC,OAAY,EAAE,eAAwB;QACzD,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAA2C,CAAC,CAAC;IACtG,CAAC;IAES,YAAY,KAAK,CAAC;IAE5B;;OAEG;IACO,KAAK,CAAC,QAAQ,CAAC,OAA+B;QACpD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAES,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;SACjG;IACL,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;KA/DoB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n createSingleBlobSummary,\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n Interval,\n IntervalCollection,\n IntervalCollectionValueType,\n ISerializableInterval,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IMapMessageLocalMetadata } from \"./defaultMapInterfaces\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection.\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n public static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedIntervalCollectionFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public get type() {\n return SharedIntervalCollectionFactory.Type;\n }\n\n public get attributes() {\n return SharedIntervalCollectionFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedIntervalCollection> {\n const map = new SharedIntervalCollection(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n public create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n const map = new SharedIntervalCollection(\n id,\n runtime,\n this.attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n getIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollection\n extends SharedObject implements ISharedIntervalCollection<Interval> {\n /**\n * Create a SharedIntervalCollection\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedIntervalCollectionFactory.Type) as SharedIntervalCollection;\n }\n\n /**\n * Get a factory for SharedIntervalCollection to register with the data store.\n *\n * @returns a factory that creates and load SharedIntervalCollection\n */\n public static getFactory(): IChannelFactory {\n return new SharedIntervalCollectionFactory();\n }\n\n public readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n private readonly intervalCollections: DefaultMap<IntervalCollection<Interval>>;\n\n /**\n * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n * be provided\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_sharedIntervalCollection_\");\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new IntervalCollectionValueType(),\n );\n }\n\n public getIntervalCollection(label: string): IntervalCollection<Interval> {\n const realLabel = this.getIntervalCollectionPath(label);\n const sharedCollection = this.intervalCollections.get(realLabel);\n return sharedCollection;\n }\n\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n return createSingleBlobSummary(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata);\n }\n\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);\n }\n }\n\n /**\n * Creates the full path of the intervalCollection label\n * @param label - the incoming label\n */\n protected getIntervalCollectionPath(label: string): string {\n return label;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQ9D,OAAO,EAA6B,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAE9F,OAAO,EACN,uBAAuB,EAEvB,YAAY,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGN,2BAA2B,GAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAS3C,IAAW,IAAI;QACd,OAAO,+BAA+B,CAAC,IAAI,CAAC;IAC7C,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,+BAA+B,CAAC,UAAU,CAAC;IACnD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,GAAG,GAAG,IAAI,wBAAwB,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,GAAG,CAAC;IACZ,CAAC;IAEM,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,GAAG,GAAG,IAAI,wBAAwB,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACvE,GAAG,CA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,CAAC,SAAS,CAAC,UAAU,CAAC,CAC9C,CAAC;IACH,CAAC;IAES,YAAY,CAAC,OAAY,EAAE,eAAwB;QAC5D,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAC1C,OAAO,EACP,eAA2C,CAC3C,CAAC;IACH,CAAC;IAES,YAAY,KAAI,CAAC;IAE3B;;OAEG;IACO,KAAK,CAAC,QAAQ,CAAC,OAA+B;QACvD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAES,WAAW,CACpB,OAAkC,EAClC,KAAc,EACd,eAAwB;QAExB,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE;YAC3C,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CACzC,OAAO,CAAC,QAAQ,EAChB,KAAK,EACL,OAAO,EACP,eAAe,CACf,CAAC;SACF;IACF,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAChD,OAAO,KAAK,CAAC;IACd,CAAC;IAES,cAAc;QACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;KA1EiB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n\tcreateSingleBlobSummary,\n\tIFluidSerializer,\n\tSharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n\tInterval,\n\tIntervalCollection,\n\tIntervalCollectionValueType,\n\tISerializableInterval,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IMapMessageLocalMetadata } from \"./defaultMapInterfaces\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection.\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: SharedIntervalCollectionFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic get type() {\n\t\treturn SharedIntervalCollectionFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn SharedIntervalCollectionFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<SharedIntervalCollection> {\n\t\tconst map = new SharedIntervalCollection(id, runtime, attributes);\n\t\tawait map.load(services);\n\n\t\treturn map;\n\t}\n\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n\t\tconst map = new SharedIntervalCollection(id, runtime, this.attributes);\n\t\tmap.initializeLocal();\n\n\t\treturn map;\n\t}\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n\tgetIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollection\n\textends SharedObject\n\timplements ISharedIntervalCollection<Interval>\n{\n\t/**\n\t * Create a SharedIntervalCollection\n\t *\n\t * @param runtime - data store runtime the new shared map belongs to\n\t * @param id - optional name of the shared map\n\t * @returns newly create shared map (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(\n\t\t\tid,\n\t\t\tSharedIntervalCollectionFactory.Type,\n\t\t) as SharedIntervalCollection;\n\t}\n\n\t/**\n\t * Get a factory for SharedIntervalCollection to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedIntervalCollection\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new SharedIntervalCollectionFactory();\n\t}\n\n\tpublic readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n\tprivate readonly intervalCollections: DefaultMap<IntervalCollection<Interval>>;\n\n\t/**\n\t * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n\t * be provided\n\t */\n\tconstructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n\t\tsuper(id, runtime, attributes, \"fluid_sharedIntervalCollection_\");\n\t\tthis.intervalCollections = new DefaultMap(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n\t\t\tnew IntervalCollectionValueType(),\n\t\t);\n\t}\n\n\tpublic getIntervalCollection(label: string): IntervalCollection<Interval> {\n\t\tconst realLabel = this.getIntervalCollectionPath(label);\n\t\tconst sharedCollection = this.intervalCollections.get(realLabel);\n\t\treturn sharedCollection;\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\treturn createSingleBlobSummary(\n\t\t\tsnapshotFileName,\n\t\t\tthis.intervalCollections.serialize(serializer),\n\t\t);\n\t}\n\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tthis.intervalCollections.tryResubmitMessage(\n\t\t\tcontent,\n\t\t\tlocalOpMetadata as IMapMessageLocalMetadata,\n\t\t);\n\t}\n\n\tprotected onDisconnect() {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService) {\n\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\tconst header = bufferToString(blob, \"utf8\");\n\t\tthis.intervalCollections.populate(header);\n\t}\n\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tthis.intervalCollections.tryProcessMessage(\n\t\t\t\tmessage.contents,\n\t\t\t\tlocal,\n\t\t\t\tmessage,\n\t\t\t\tlocalOpMetadata,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Creates the full path of the intervalCollection label\n\t * @param label - the incoming label\n\t */\n\tprotected getIntervalCollectionPath(label: string): string {\n\t\treturn label;\n\t}\n\n\tprotected applyStashedOp() {\n\t\tthrow new Error(\"not implemented\");\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedSequence.d.ts","sourceRoot":"","sources":["../src/sharedSequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EACnD,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACjH,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAInD,MAAM,WAAW,eAAe,CAAC,CAAC,CAAE,SAAQ,YAAY;IACpD,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;CAC5B;AAED,qBAAa,WAAW,CAAC,CAAC,CAAE,SAAQ,WAAW;IAkBxB,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE;IAjB3C,gBAAuB,UAAU,EAAE,MAAM,CAA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AIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,WAAW;IAWxE;;;OAGG;IACI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAIxC;;OAEG;IACI,YAAY,IAAI,MAAM;IAI7B;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE;CAoC/D"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { assert } from "@fluidframework/common-utils";
6
- import { BaseSegment, } from "@fluidframework/merge-tree";
6
+ import { BaseSegment } from "@fluidframework/merge-tree";
7
7
  import { SharedSegmentSequence } from "./sequence";
8
8
  const MaxRun = 128;
9
9
  export class SubSequence extends BaseSegment {
@@ -38,8 +38,8 @@ export class SubSequence extends BaseSegment {
38
38
  return b;
39
39
  }
40
40
  canAppend(segment) {
41
- return SubSequence.is(segment)
42
- && (this.cachedLength <= MaxRun || segment.cachedLength <= MaxRun);
41
+ return (SubSequence.is(segment) &&
42
+ (this.cachedLength <= MaxRun || segment.cachedLength <= MaxRun));
43
43
  }
44
44
  toString() {
45
45
  return this.items.toString();
@@ -62,7 +62,7 @@ export class SubSequence extends BaseSegment {
62
62
  }
63
63
  this.items = remnantItems;
64
64
  this.cachedLength = this.items.length;
65
- return (this.items.length === 0);
65
+ return this.items.length === 0;
66
66
  }
67
67
  createSplitSegmentAt(pos) {
68
68
  if (pos > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"sharedSequence.js","sourceRoot":"","sources":["../src/sharedSequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACH,WAAW,GACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,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AAY;QACvC,MAAM,KAAK,GAAsB,EAAE,CAAC;QACpC,IAAI,YAAkC,CAAC;QAEvC,oCAAoC;QACpC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,IAAI,KAAK,EAAE;YACnC,OAAO,KAAK,CAAC;SAChB;QAED,IAAI,CAAC,YAAY,CACb,CAAC,OAAiB,EAAE,EAAE;YAClB,IAAI,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;gBACzB,IAAI,YAAY,KAAK,SAAS,EAAE;oBAC5B,YAAY,GAAG,OAAO,CAAC;iBAC1B;gBACD,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;aAChC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC,EACD,KAAK,EACL,GAAG,CAAC,CAAC;QAET,kEAAkE;QAClE,gEAAgE;QAChE,+DAA+D;QAC/D,iEAAiE;QACjE,aAAa;QACb,IAAI,YAAY,KAAK,SAAS,EAAE;YAC5B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;SAC3D;QACD,IAAI,GAAG,KAAK,SAAS,EAAE;YACnB,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport {\n BaseSegment, IJSONSegment, ISegment, PropertySet,\n} from \"@fluidframework/merge-tree\";\nimport { IChannelAttributes, IFluidDataStoreRuntime, Serializable } from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence } from \"./sequence\";\n\nconst MaxRun = 128;\n\nexport interface IJSONRunSegment<T> extends IJSONSegment {\n items: Serializable<T>[];\n}\n\nexport class SubSequence<T> extends BaseSegment {\n public static readonly typeString: string = \"SubSequence\";\n public static is(segment: ISegment): segment is SubSequence<any> {\n return segment.type === SubSequence.typeString;\n }\n public static fromJSONObject<U>(spec: Serializable) {\n if (spec && typeof spec === \"object\" && \"items\" in spec) {\n const segment = new SubSequence<U>(spec.items);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n\n public readonly type = SubSequence.typeString;\n\n constructor(public items: Serializable<T>[]) {\n super();\n this.cachedLength = items.length;\n }\n\n public toJSONObject() {\n const obj: IJSONRunSegment<T> = { items: this.items };\n super.addSerializedProps(obj);\n return obj;\n }\n\n public clone(start = 0, end?: number) {\n const clonedItems = this.items.slice(start, end);\n const b = new SubSequence(clonedItems);\n this.cloneInto(b);\n return b;\n }\n\n public canAppend(segment: ISegment): boolean {\n return SubSequence.is(segment)\n && (this.cachedLength <= MaxRun || segment.cachedLength <= MaxRun);\n }\n\n public toString() {\n return this.items.toString();\n }\n\n public append(segment: ISegment) {\n assert(SubSequence.is(segment), 0x448 /* can only append to another run segment */);\n super.append(segment);\n this.items = this.items.concat(segment.items);\n }\n\n // TODO: retain removed items for undo\n // returns true if entire run removed\n public removeRange(start: number, end: number) {\n let remnantItems: Serializable<T>[] = [];\n const len = this.items.length;\n if (start > 0) {\n remnantItems = remnantItems.concat(this.items.slice(0, start));\n }\n if (end < len) {\n remnantItems = remnantItems.concat(this.items.slice(end));\n }\n this.items = remnantItems;\n this.cachedLength = this.items.length;\n return (this.items.length === 0);\n }\n\n protected createSplitSegmentAt(pos: number) {\n if (pos > 0) {\n const remainingItems = this.items.slice(pos);\n this.items = this.items.slice(0, pos);\n this.cachedLength = this.items.length;\n const leafSegment = new SubSequence(remainingItems);\n return leafSegment;\n }\n }\n}\n\nexport class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {\n constructor(\n document: IFluidDataStoreRuntime,\n public id: string,\n attributes: IChannelAttributes,\n specToSegment: (spec: IJSONSegment) => ISegment,\n ) {\n super(document, id, attributes, specToSegment);\n }\n\n /**\n * @param pos - The position to insert the items at.\n * @param items - The items to insert.\n * @param props - Optional. Properties to set on the inserted items.\n */\n public insert(pos: number, items: Serializable<T>[], props?: PropertySet) {\n const segment = new SubSequence<T>(items);\n if (props) {\n segment.addProperties(props);\n }\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n */\n public remove(start: number, end: number) {\n this.removeRange(start, end);\n }\n\n /**\n * Returns the total count of items in the sequence\n */\n public getItemCount(): number {\n return this.getLength();\n }\n\n /**\n * Gets the items in the specified range\n *\n * @param start - The inclusive start of the range\n * @param end - The exclusive end of the range\n */\n public getItems(start: number, end?: number): Serializable<T>[] {\n const items: Serializable<T>[] = [];\n let firstSegment: ISegment | undefined;\n\n // Return if the range is incorrect.\n if (end !== undefined && end <= start) {\n return items;\n }\n\n this.walkSegments(\n (segment: ISegment) => {\n if (SubSequence.is(segment)) {\n if (firstSegment === undefined) {\n firstSegment = segment;\n }\n items.push(...segment.items);\n }\n return true;\n },\n start,\n end);\n\n // The above call to walkSegments adds all the items in the walked\n // segments. However, we only want items beginning at |start| in\n // the first segment. Similarly, if |end| is passed in, we only\n // want items until |end| in the last segment. Remove the rest of\n // the items.\n if (firstSegment !== undefined) {\n items.splice(0, start - this.getPosition(firstSegment));\n }\n if (end !== undefined) {\n items.splice(end - start);\n }\n return items;\n }\n}\n"]}
1
+ {"version":3,"file":"sharedSequence.js","sourceRoot":"","sources":["../src/sharedSequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAuC,MAAM,4BAA4B,CAAC;AAM9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,GAAG,GAAG,CAAC;AAMnB,MAAM,OAAO,WAAe,SAAQ,W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AG,KAAK,SAAS,IAAI,GAAG,IAAI,KAAK,EAAE;YACtC,OAAO,KAAK,CAAC;SACb;QAED,IAAI,CAAC,YAAY,CAChB,CAAC,OAAiB,EAAE,EAAE;YACrB,IAAI,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE;gBAC5B,IAAI,YAAY,KAAK,SAAS,EAAE;oBAC/B,YAAY,GAAG,OAAO,CAAC;iBACvB;gBACD,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;aAC7B;YACD,OAAO,IAAI,CAAC;QACb,CAAC,EACD,KAAK,EACL,GAAG,CACH,CAAC;QAEF,kEAAkE;QAClE,gEAAgE;QAChE,+DAA+D;QAC/D,iEAAiE;QACjE,aAAa;QACb,IAAI,YAAY,KAAK,SAAS,EAAE;YAC/B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;SACxD;QACD,IAAI,GAAG,KAAK,SAAS,EAAE;YACtB,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC;SAC1B;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { BaseSegment, IJSONSegment, ISegment, PropertySet } from \"@fluidframework/merge-tree\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tSerializable,\n} from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence } from \"./sequence\";\n\nconst MaxRun = 128;\n\nexport interface IJSONRunSegment<T> extends IJSONSegment {\n\titems: Serializable<T>[];\n}\n\nexport class SubSequence<T> extends BaseSegment {\n\tpublic static readonly typeString: string = \"SubSequence\";\n\tpublic static is(segment: ISegment): segment is SubSequence<any> {\n\t\treturn segment.type === SubSequence.typeString;\n\t}\n\tpublic static fromJSONObject<U>(spec: Serializable) {\n\t\tif (spec && typeof spec === \"object\" && \"items\" in spec) {\n\t\t\tconst segment = new SubSequence<U>(spec.items);\n\t\t\tif (spec.props) {\n\t\t\t\tsegment.addProperties(spec.props);\n\t\t\t}\n\t\t\treturn segment;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic readonly type = SubSequence.typeString;\n\n\tconstructor(public items: Serializable<T>[]) {\n\t\tsuper();\n\t\tthis.cachedLength = items.length;\n\t}\n\n\tpublic toJSONObject() {\n\t\tconst obj: IJSONRunSegment<T> = { items: this.items };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tpublic clone(start = 0, end?: number) {\n\t\tconst clonedItems = this.items.slice(start, end);\n\t\tconst b = new SubSequence(clonedItems);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn (\n\t\t\tSubSequence.is(segment) &&\n\t\t\t(this.cachedLength <= MaxRun || segment.cachedLength <= MaxRun)\n\t\t);\n\t}\n\n\tpublic toString() {\n\t\treturn this.items.toString();\n\t}\n\n\tpublic append(segment: ISegment) {\n\t\tassert(SubSequence.is(segment), 0x448 /* can only append to another run segment */);\n\t\tsuper.append(segment);\n\t\tthis.items = this.items.concat(segment.items);\n\t}\n\n\t// TODO: retain removed items for undo\n\t// returns true if entire run removed\n\tpublic removeRange(start: number, end: number) {\n\t\tlet remnantItems: Serializable<T>[] = [];\n\t\tconst len = this.items.length;\n\t\tif (start > 0) {\n\t\t\tremnantItems = remnantItems.concat(this.items.slice(0, start));\n\t\t}\n\t\tif (end < len) {\n\t\t\tremnantItems = remnantItems.concat(this.items.slice(end));\n\t\t}\n\t\tthis.items = remnantItems;\n\t\tthis.cachedLength = this.items.length;\n\t\treturn this.items.length === 0;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\tif (pos > 0) {\n\t\t\tconst remainingItems = this.items.slice(pos);\n\t\t\tthis.items = this.items.slice(0, pos);\n\t\t\tthis.cachedLength = this.items.length;\n\t\t\tconst leafSegment = new SubSequence(remainingItems);\n\t\t\treturn leafSegment;\n\t\t}\n\t}\n}\n\nexport class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {\n\tconstructor(\n\t\tdocument: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\tspecToSegment: (spec: IJSONSegment) => ISegment,\n\t) {\n\t\tsuper(document, id, attributes, specToSegment);\n\t}\n\n\t/**\n\t * @param pos - The position to insert the items at.\n\t * @param items - The items to insert.\n\t * @param props - Optional. Properties to set on the inserted items.\n\t */\n\tpublic insert(pos: number, items: Serializable<T>[], props?: PropertySet) {\n\t\tconst segment = new SubSequence<T>(items);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\t\tconst insertOp = this.client.insertSegmentLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t}\n\n\t/**\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to remove\n\t */\n\tpublic remove(start: number, end: number) {\n\t\tthis.removeRange(start, end);\n\t}\n\n\t/**\n\t * Returns the total count of items in the sequence\n\t */\n\tpublic getItemCount(): number {\n\t\treturn this.getLength();\n\t}\n\n\t/**\n\t * Gets the items in the specified range\n\t *\n\t * @param start - The inclusive start of the range\n\t * @param end - The exclusive end of the range\n\t */\n\tpublic getItems(start: number, end?: number): Serializable<T>[] {\n\t\tconst items: Serializable<T>[] = [];\n\t\tlet firstSegment: ISegment | undefined;\n\n\t\t// Return if the range is incorrect.\n\t\tif (end !== undefined && end <= start) {\n\t\t\treturn items;\n\t\t}\n\n\t\tthis.walkSegments(\n\t\t\t(segment: ISegment) => {\n\t\t\t\tif (SubSequence.is(segment)) {\n\t\t\t\t\tif (firstSegment === undefined) {\n\t\t\t\t\t\tfirstSegment = segment;\n\t\t\t\t\t}\n\t\t\t\t\titems.push(...segment.items);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\n\t\t// The above call to walkSegments adds all the items in the walked\n\t\t// segments. However, we only want items beginning at |start| in\n\t\t// the first segment. Similarly, if |end| is passed in, we only\n\t\t// want items until |end| in the last segment. Remove the rest of\n\t\t// the items.\n\t\tif (firstSegment !== undefined) {\n\t\t\titems.splice(0, start - this.getPosition(firstSegment));\n\t\t}\n\t\tif (end !== undefined) {\n\t\t\titems.splice(end - start);\n\t\t}\n\t\treturn items;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,QAAQ,EAER,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EAEb,WAAW,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,mBAAmB,CAAC;IAC7E;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAEjE;;;;;OAKG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,mBAAmB,GAAG,SAAS,CAAC;IAExG;;OAEG;IACH,kBAAkB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM,CAAC;CAC9D;AAED,oB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AS;IAIxD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;CAOhE;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAChC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACV;IACF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC1B,CAWA"}
@@ -268,7 +268,7 @@ const gatherTextAndMarkers = (segment, pos, refSeq, clientId, start, end, accumT
268
268
  }
269
269
  textSegment.text += endTags;
270
270
  textSegment.text += beginTags;
271
- if ((start <= 0) && (end >= segment.text.length)) {
271
+ if (start <= 0 && end >= segment.text.length) {
272
272
  textSegment.text += segment.text;
273
273
  }
274
274
  else {
@@ -279,9 +279,10 @@ const gatherTextAndMarkers = (segment, pos, refSeq, clientId, start, end, accumT
279
279
  }
280
280
  }
281
281
  else {
282
- if (placeholder && (placeholder.length > 0)) {
283
- const placeholderText = placeholder === "*" ?
284
- `\n${segment.toString()}` : placeholder.repeat(segment.cachedLength);
282
+ if (placeholder && placeholder.length > 0) {
283
+ const placeholderText = placeholder === "*"
284
+ ? `\n${segment.toString()}`
285
+ : placeholder.repeat(segment.cachedLength);
285
286
  textSegment.text += placeholderText;
286
287
  }
287
288
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQH,MAAM,EAIN,eAAe,EACf,WAAW,GACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA8BxD;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAa,SAAQ,q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AAC,CAAC,EAAE;YACzC,MAAM,eAAe,GAAG,WAAW,KAAK,GAAG,CAAC,CAAC;gBACzC,KAAK,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACzE,WAAW,CAAC,IAAI,IAAI,eAAe,CAAC;SACvC;aAAM;YACH,MAAM,MAAM,GAAG,OAAiB,CAAC;YACjC,IAAI,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;gBACxD,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC9C,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;aACzB;SACJ;KACJ;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ICombiningOp,\n IMergeTreeInsertMsg,\n IMergeTreeRemoveMsg,\n IMergeTreeTextHelper,\n IRelativePosition,\n ISegment,\n ISegmentAction,\n Marker,\n PropertySet,\n ReferencePosition,\n ReferenceType,\n refHasTileLabel,\n TextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { IFluidDataStoreRuntime, IChannelAttributes } from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence } from \"./sequence\";\nimport { SharedStringFactory } from \"./sequenceFactory\";\n\n/**\n * Fluid object interface describing access methods on a SharedString\n */\nexport interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {\n /**\n * Inserts the text at the position.\n * @param pos - The position to insert the text at\n * @param text - The text to insert\n * @param props - The properties of the text\n */\n insertText(pos: number, text: string, props?: PropertySet): void;\n\n /**\n * Inserts a marker at the position.\n * @param pos - The position to insert the marker at\n * @param refType - The reference type of the marker\n * @param props - The properties of the marker\n */\n insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;\n\n /**\n * {@inheritDoc SharedSegmentSequence.posFromRelativePos}\n */\n posFromRelativePos(relativePos: IRelativePosition): number;\n}\n\nexport type SharedStringSegment = TextSegment | Marker;\n\n/**\n * The Shared String is a specialized data structure for handling collaborative\n * text. It is based on a more general Sequence data structure but has\n * additional features that make working with text easier.\n *\n * In addition to text, a Shared String can also contain markers. Markers can be\n * used to store metadata at positions within the text, like the details of an\n * image or Fluid object that should be rendered with the text.\n *\n */\nexport class SharedString extends SharedSegmentSequence<SharedStringSegment> implements ISharedString {\n /**\n * Create a new shared string.\n * @param runtime - data store runtime the new shared string belongs to\n * @param id - optional name of the shared string\n * @returns newly create shared string (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedStringFactory.Type) as SharedString;\n }\n\n /**\n * Get a factory for SharedString to register with the data store.\n * @returns a factory that creates and load SharedString\n */\n public static getFactory() {\n return new SharedStringFactory();\n }\n\n public get ISharedString(): ISharedString {\n return this;\n }\n\n private readonly mergeTreeTextHelper: IMergeTreeTextHelper;\n\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SharedStringFactory.segmentFromSpec as any);\n this.mergeTreeTextHelper = this.client.createTextHelper();\n }\n\n /**\n * Inserts a marker at a relative position.\n * @param relativePos1 - The relative position to insert the marker at\n * @param refType - The reference type of the marker\n * @param props - The properties of the marker\n */\n public insertMarkerRelative(\n relativePos1: IRelativePosition,\n refType: ReferenceType,\n props?: PropertySet) {\n const segment = new Marker(refType);\n if (props) {\n segment.addProperties(props);\n }\n\n const pos = this.posFromRelativePos(relativePos1);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * {@inheritDoc ISharedString.insertMarker}\n */\n public insertMarker(\n pos: number,\n refType: ReferenceType,\n props?: PropertySet): IMergeTreeInsertMsg | undefined {\n const segment = new Marker(refType);\n if (props) {\n segment.addProperties(props);\n }\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n return insertOp;\n }\n\n /**\n * Inserts the text at the position.\n * @param relativePos1 - The relative position to insert the text at\n * @param text - The text to insert\n * @param props - The properties of text\n */\n public insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {\n const segment = new TextSegment(text);\n if (props) {\n segment.addProperties(props);\n }\n\n const pos = this.posFromRelativePos(relativePos1);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * {@inheritDoc ISharedString.insertText}\n */\n public insertText(pos: number, text: string, props?: PropertySet) {\n const segment = new TextSegment(text);\n if (props) {\n segment.addProperties(props);\n }\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * Replaces a range with the provided text.\n * @param start - The inclusive start of the range to replace\n * @param end - The exclusive end of the range to replace\n * @param text - The text to replace the range with\n * @param props - Optional. The properties of the replacement text\n */\n public replaceText(start: number, end: number, text: string, props?: PropertySet) {\n this.replaceRange(start, end, TextSegment.make(text, props));\n }\n\n /**\n * Removes the text in the given range.\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to replace\n * @returns the message sent.\n */\n public removeText(start: number, end: number): IMergeTreeRemoveMsg {\n return this.removeRange(start, end);\n }\n\n /**\n * Annotates the marker with the provided properties and calls the callback on consensus.\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param consensusCallback - The callback called when consensus is reached\n */\n public annotateMarkerNotifyConsensus(\n marker: Marker,\n props: PropertySet,\n callback: (m: Marker) => void) {\n const annotateOp = this.client.annotateMarkerNotifyConsensus(marker, props, callback);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n /**\n * Annotates the marker with the provided properties.\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n */\n public annotateMarker(\n marker: Marker,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp = this.client.annotateMarker(marker, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n /**\n * Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.\n * Note that Markers receive `ReferenceType.Tile` by default.\n * @param startPos - Position at which to start the search\n * @param clientId - clientId dictating the perspective to search from\n * @param tileLabel - Label of the tile to search for\n * @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`\n */\n public findTile(startPos: number | undefined, tileLabel: string, preceding = true): {\n tile: ReferencePosition;\n pos: number;\n } | undefined {\n return this.client.findTile(startPos ?? 0, tileLabel, preceding);\n }\n\n /**\n * Retrieve text from the SharedString in string format.\n * @param start - The starting index of the text to retrieve, or 0 if omitted.\n * @param end - The ending index of the text to retrieve, or the end of the string if omitted\n * @returns The requested text content as a string.\n */\n public getText(start?: number, end?: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \"\", start, end);\n }\n\n /**\n * Adds spaces for markers and handles, so that position calculations account for them.\n */\n public getTextWithPlaceholders(start?: number, end?: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \" \", start, end);\n }\n\n public getTextRangeWithMarkers(start: number, end: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \"*\", start, end);\n }\n\n /**\n * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided\n * id in this `SharedString`.\n */\n public getMarkerFromId(id: string): ISegment | undefined {\n return this.client.getMarkerFromId(id);\n }\n\n /**\n * Revert an op\n */\n protected rollback(content: any, localOpMetadata: unknown): void {\n if (this.client.rollback !== undefined) {\n this.client.rollback(content, localOpMetadata);\n } else {\n super.rollback(content, localOpMetadata);\n }\n }\n}\n\ninterface ITextAndMarkerAccumulator {\n parallelText: string[];\n parallelMarkers: Marker[];\n parallelMarkerLabel: string;\n placeholder?: string;\n tagsInProgress: string[];\n textSegment: TextSegment;\n}\n\n/**\n * Splits the text into regions ending with markers with the given `label`.\n * @param sharedString - String to retrieve text and markers from\n * @param label - label to split on\n * @returns Two parallel lists of text and markers, split by markers with the provided `label`.\n *\n * For example:\n * ```typescript\n * // Say sharedstring has contents \"hello<paragraph marker 1>world<paragraph marker 2>missing\".\n * const { parallelText, parallelMarkers } = getTextAndMarkers(sharedString, \"paragraph\");\n * // parallelText === [\"hello\", \"world\"]\n * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]\n * // Note parallelText does not include \"missing\".\n * ```\n */\nexport function getTextAndMarkers(sharedString: SharedString, label: string, start?: number, end?: number): {\n parallelText: string[];\n parallelMarkers: Marker[];\n} {\n const accum: ITextAndMarkerAccumulator = {\n parallelMarkerLabel: label,\n parallelMarkers: [],\n parallelText: [],\n tagsInProgress: [],\n textSegment: new TextSegment(\"\"),\n };\n\n sharedString.walkSegments(gatherTextAndMarkers, start, end, accum);\n return { parallelText: accum.parallelText, parallelMarkers: accum.parallelMarkers };\n}\n\nconst gatherTextAndMarkers: ISegmentAction<ITextAndMarkerAccumulator> = (\n segment: ISegment,\n pos: number,\n refSeq: number,\n clientId: number,\n start: number,\n end: number,\n accumText: ITextAndMarkerAccumulator,\n) => {\n const { placeholder, tagsInProgress, textSegment } = accumText;\n if (TextSegment.is(segment)) {\n let beginTags = \"\";\n let endTags = \"\";\n // TODO: let clients pass in function to get tag\n const tags = [] as string[];\n const initTags = [] as string[];\n\n if (segment.properties?.[\"font-weight\"]) {\n tags.push(\"b\");\n }\n if (segment.properties?.[\"text-decoration\"]) {\n tags.push(\"u\");\n }\n const remTags = [] as string[];\n if (tags.length > 0) {\n for (const tag of tags) {\n if (!tagsInProgress.includes(tag)) {\n beginTags += `<${tag}>`;\n initTags.push(tag);\n }\n }\n for (const accumTag of tagsInProgress) {\n if (!tags.includes(accumTag)) {\n endTags += `</${accumTag}>`;\n remTags.push(accumTag);\n }\n }\n for (const initTag of initTags.reverse()) {\n tagsInProgress.push(initTag);\n }\n } else {\n for (const accumTag of tagsInProgress) {\n endTags += `</${accumTag}>`;\n remTags.push(accumTag);\n }\n }\n for (const remTag of remTags) {\n const remdex = tagsInProgress.indexOf(remTag);\n if (remdex >= 0) {\n tagsInProgress.splice(remdex, 1);\n }\n }\n textSegment.text += endTags;\n textSegment.text += beginTags;\n if ((start <= 0) && (end >= segment.text.length)) {\n textSegment.text += segment.text;\n } else {\n const seglen = segment.text.length;\n const _start = start < 0 ? 0 : start;\n const _end = end >= seglen ? undefined : end;\n textSegment.text += segment.text.substring(_start, _end);\n }\n } else {\n if (placeholder && (placeholder.length > 0)) {\n const placeholderText = placeholder === \"*\" ?\n `\\n${segment.toString()}` : placeholder.repeat(segment.cachedLength);\n textSegment.text += placeholderText;\n } else {\n const marker = segment as Marker;\n if (refHasTileLabel(marker, accumText.parallelMarkerLabel)) {\n accumText.parallelMarkers.push(marker);\n accumText.parallelText.push(textSegment.text);\n textSegment.text = \"\";\n }\n }\n }\n\n return true;\n};\n"]}
1
+ {"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQN,MAAM,EAIN,eAAe,EACf,WAAW,GACX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAkCxD;;;;;;;;;GASG;AACH,MAAM,OAAO,YACZ,SAAQ,qBAA0C;IA2BlD,YACC,QAAgC,EACzB,EAAU,EACjB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EAAE,EAAE;gBAC3B,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC7C,WAAW,CAAC,IAAI,IAAI,eAAe,CAAC;SACpC;aAAM;YACN,MAAM,MAAM,GAAG,OAAiB,CAAC;YACjC,IAAI,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;gBAC3D,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC9C,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;aACtB;SACD;KACD;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tICombiningOp,\n\tIMergeTreeInsertMsg,\n\tIMergeTreeRemoveMsg,\n\tIMergeTreeTextHelper,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tMarker,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\trefHasTileLabel,\n\tTextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { IFluidDataStoreRuntime, IChannelAttributes } from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence } from \"./sequence\";\nimport { SharedStringFactory } from \"./sequenceFactory\";\n\n/**\n * Fluid object interface describing access methods on a SharedString\n */\nexport interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {\n\t/**\n\t * Inserts the text at the position.\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of the text\n\t */\n\tinsertText(pos: number, text: string, props?: PropertySet): void;\n\n\t/**\n\t * Inserts a marker at the position.\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tinsertMarker(\n\t\tpos: number,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): IMergeTreeInsertMsg | undefined;\n\n\t/**\n\t * {@inheritDoc SharedSegmentSequence.posFromRelativePos}\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n}\n\nexport type SharedStringSegment = TextSegment | Marker;\n\n/**\n * The Shared String is a specialized data structure for handling collaborative\n * text. It is based on a more general Sequence data structure but has\n * additional features that make working with text easier.\n *\n * In addition to text, a Shared String can also contain markers. Markers can be\n * used to store metadata at positions within the text, like the details of an\n * image or Fluid object that should be rendered with the text.\n *\n */\nexport class SharedString\n\textends SharedSegmentSequence<SharedStringSegment>\n\timplements ISharedString\n{\n\t/**\n\t * Create a new shared string.\n\t * @param runtime - data store runtime the new shared string belongs to\n\t * @param id - optional name of the shared string\n\t * @returns newly create shared string (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(id, SharedStringFactory.Type) as SharedString;\n\t}\n\n\t/**\n\t * Get a factory for SharedString to register with the data store.\n\t * @returns a factory that creates and load SharedString\n\t */\n\tpublic static getFactory() {\n\t\treturn new SharedStringFactory();\n\t}\n\n\tpublic get ISharedString(): ISharedString {\n\t\treturn this;\n\t}\n\n\tprivate readonly mergeTreeTextHelper: IMergeTreeTextHelper;\n\n\tconstructor(\n\t\tdocument: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(document, id, attributes, SharedStringFactory.segmentFromSpec as any);\n\t\tthis.mergeTreeTextHelper = this.client.createTextHelper();\n\t}\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tpublic insertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t) {\n\t\tconst segment = new Marker(refType);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tconst insertOp = this.client.insertSegmentLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertMarker}\n\t */\n\tpublic insertMarker(\n\t\tpos: number,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): IMergeTreeInsertMsg | undefined {\n\t\tconst segment = new Marker(refType);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst insertOp = this.client.insertSegmentLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t\treturn insertOp;\n\t}\n\n\t/**\n\t * Inserts the text at the position.\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tpublic insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {\n\t\tconst segment = new TextSegment(text);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tconst insertOp = this.client.insertSegmentLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertText}\n\t */\n\tpublic insertText(pos: number, text: string, props?: PropertySet) {\n\t\tconst segment = new TextSegment(text);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst insertOp = this.client.insertSegmentLocal(pos, segment);\n\t\tif (insertOp) {\n\t\t\tthis.submitSequenceMessage(insertOp);\n\t\t}\n\t}\n\n\t/**\n\t * Replaces a range with the provided text.\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tpublic replaceText(start: number, end: number, text: string, props?: PropertySet) {\n\t\tthis.replaceRange(start, end, TextSegment.make(text, props));\n\t}\n\n\t/**\n\t * Removes the text in the given range.\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to replace\n\t * @returns the message sent.\n\t */\n\tpublic removeText(start: number, end: number): IMergeTreeRemoveMsg {\n\t\treturn this.removeRange(start, end);\n\t}\n\n\t/**\n\t * Annotates the marker with the provided properties and calls the callback on consensus.\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t * @param consensusCallback - The callback called when consensus is reached\n\t */\n\tpublic annotateMarkerNotifyConsensus(\n\t\tmarker: Marker,\n\t\tprops: PropertySet,\n\t\tcallback: (m: Marker) => void,\n\t) {\n\t\tconst annotateOp = this.client.annotateMarkerNotifyConsensus(marker, props, callback);\n\t\tif (annotateOp) {\n\t\t\tthis.submitSequenceMessage(annotateOp);\n\t\t}\n\t}\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n\t */\n\tpublic annotateMarker(marker: Marker, props: PropertySet, combiningOp?: ICombiningOp) {\n\t\tconst annotateOp = this.client.annotateMarker(marker, props, combiningOp);\n\t\tif (annotateOp) {\n\t\t\tthis.submitSequenceMessage(annotateOp);\n\t\t}\n\t}\n\n\t/**\n\t * Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.\n\t * Note that Markers receive `ReferenceType.Tile` by default.\n\t * @param startPos - Position at which to start the search\n\t * @param clientId - clientId dictating the perspective to search from\n\t * @param tileLabel - Label of the tile to search for\n\t * @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`\n\t */\n\tpublic findTile(\n\t\tstartPos: number | undefined,\n\t\ttileLabel: string,\n\t\tpreceding = true,\n\t):\n\t\t| {\n\t\t\t\ttile: ReferencePosition;\n\t\t\t\tpos: number;\n\t\t }\n\t\t| undefined {\n\t\treturn this.client.findTile(startPos ?? 0, tileLabel, preceding);\n\t}\n\n\t/**\n\t * Retrieve text from the SharedString in string format.\n\t * @param start - The starting index of the text to retrieve, or 0 if omitted.\n\t * @param end - The ending index of the text to retrieve, or the end of the string if omitted\n\t * @returns The requested text content as a string.\n\t */\n\tpublic getText(start?: number, end?: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\"\",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * Adds spaces for markers and handles, so that position calculations account for them.\n\t */\n\tpublic getTextWithPlaceholders(start?: number, end?: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\" \",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\tpublic getTextRangeWithMarkers(start: number, end: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\"*\",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided\n\t * id in this `SharedString`.\n\t */\n\tpublic getMarkerFromId(id: string): ISegment | undefined {\n\t\treturn this.client.getMarkerFromId(id);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tif (this.client.rollback !== undefined) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t} else {\n\t\t\tsuper.rollback(content, localOpMetadata);\n\t\t}\n\t}\n}\n\ninterface ITextAndMarkerAccumulator {\n\tparallelText: string[];\n\tparallelMarkers: Marker[];\n\tparallelMarkerLabel: string;\n\tplaceholder?: string;\n\ttagsInProgress: string[];\n\ttextSegment: TextSegment;\n}\n\n/**\n * Splits the text into regions ending with markers with the given `label`.\n * @param sharedString - String to retrieve text and markers from\n * @param label - label to split on\n * @returns Two parallel lists of text and markers, split by markers with the provided `label`.\n *\n * For example:\n * ```typescript\n * // Say sharedstring has contents \"hello<paragraph marker 1>world<paragraph marker 2>missing\".\n * const { parallelText, parallelMarkers } = getTextAndMarkers(sharedString, \"paragraph\");\n * // parallelText === [\"hello\", \"world\"]\n * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]\n * // Note parallelText does not include \"missing\".\n * ```\n */\nexport function getTextAndMarkers(\n\tsharedString: SharedString,\n\tlabel: string,\n\tstart?: number,\n\tend?: number,\n): {\n\tparallelText: string[];\n\tparallelMarkers: Marker[];\n} {\n\tconst accum: ITextAndMarkerAccumulator = {\n\t\tparallelMarkerLabel: label,\n\t\tparallelMarkers: [],\n\t\tparallelText: [],\n\t\ttagsInProgress: [],\n\t\ttextSegment: new TextSegment(\"\"),\n\t};\n\n\tsharedString.walkSegments(gatherTextAndMarkers, start, end, accum);\n\treturn { parallelText: accum.parallelText, parallelMarkers: accum.parallelMarkers };\n}\n\nconst gatherTextAndMarkers: ISegmentAction<ITextAndMarkerAccumulator> = (\n\tsegment: ISegment,\n\tpos: number,\n\trefSeq: number,\n\tclientId: number,\n\tstart: number,\n\tend: number,\n\taccumText: ITextAndMarkerAccumulator,\n) => {\n\tconst { placeholder, tagsInProgress, textSegment } = accumText;\n\tif (TextSegment.is(segment)) {\n\t\tlet beginTags = \"\";\n\t\tlet endTags = \"\";\n\t\t// TODO: let clients pass in function to get tag\n\t\tconst tags = [] as string[];\n\t\tconst initTags = [] as string[];\n\n\t\tif (segment.properties?.[\"font-weight\"]) {\n\t\t\ttags.push(\"b\");\n\t\t}\n\t\tif (segment.properties?.[\"text-decoration\"]) {\n\t\t\ttags.push(\"u\");\n\t\t}\n\t\tconst remTags = [] as string[];\n\t\tif (tags.length > 0) {\n\t\t\tfor (const tag of tags) {\n\t\t\t\tif (!tagsInProgress.includes(tag)) {\n\t\t\t\t\tbeginTags += `<${tag}>`;\n\t\t\t\t\tinitTags.push(tag);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const accumTag of tagsInProgress) {\n\t\t\t\tif (!tags.includes(accumTag)) {\n\t\t\t\t\tendTags += `</${accumTag}>`;\n\t\t\t\t\tremTags.push(accumTag);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const initTag of initTags.reverse()) {\n\t\t\t\ttagsInProgress.push(initTag);\n\t\t\t}\n\t\t} else {\n\t\t\tfor (const accumTag of tagsInProgress) {\n\t\t\t\tendTags += `</${accumTag}>`;\n\t\t\t\tremTags.push(accumTag);\n\t\t\t}\n\t\t}\n\t\tfor (const remTag of remTags) {\n\t\t\tconst remdex = tagsInProgress.indexOf(remTag);\n\t\t\tif (remdex >= 0) {\n\t\t\t\ttagsInProgress.splice(remdex, 1);\n\t\t\t}\n\t\t}\n\t\ttextSegment.text += endTags;\n\t\ttextSegment.text += beginTags;\n\t\tif (start <= 0 && end >= segment.text.length) {\n\t\t\ttextSegment.text += segment.text;\n\t\t} else {\n\t\t\tconst seglen = segment.text.length;\n\t\t\tconst _start = start < 0 ? 0 : start;\n\t\t\tconst _end = end >= seglen ? undefined : end;\n\t\t\ttextSegment.text += segment.text.substring(_start, _end);\n\t\t}\n\t} else {\n\t\tif (placeholder && placeholder.length > 0) {\n\t\t\tconst placeholderText =\n\t\t\t\tplaceholder === \"*\"\n\t\t\t\t\t? `\\n${segment.toString()}`\n\t\t\t\t\t: placeholder.repeat(segment.cachedLength);\n\t\t\ttextSegment.text += placeholderText;\n\t\t} else {\n\t\t\tconst marker = segment as Marker;\n\t\t\tif (refHasTileLabel(marker, accumText.parallelMarkerLabel)) {\n\t\t\t\taccumText.parallelMarkers.push(marker);\n\t\t\t\taccumText.parallelText.push(textSegment.text);\n\t\t\t\ttextSegment.text = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/sequence",
3
- "version": "2.0.0-internal.3.0.2",
3
+ "version": "2.0.0-internal.3.2.0",
4
4
  "description": "Distributed sequence",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,39 +14,6 @@
14
14
  "main": "dist/index.js",
15
15
  "module": "lib/index.js",
16
16
  "types": "dist/index.d.ts",
17
- "scripts": {
18
- "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
19
- "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
20
- "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
21
- "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
22
- "build:esnext": "tsc --project ./tsconfig.esnext.json",
23
- "build:full": "npm run build",
24
- "build:full:compile": "npm run build:compile",
25
- "build:genver": "gen-version",
26
- "build:test": "tsc --project ./src/test/tsconfig.json",
27
- "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
28
- "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
29
- "eslint": "eslint --format stylish src",
30
- "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
31
- "format": "npm run prettier:fix",
32
- "lint": "npm run eslint",
33
- "lint:fix": "npm run eslint:fix",
34
- "postpack": "tar -cf ./sequence.test-files.tar ./src/test ./dist/test",
35
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
36
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
37
- "test": "npm run test:mocha",
38
- "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
39
- "test:memory": "mocha --config src/test/memory/.mocharc.js",
40
- "test:memory-profiling:report": "mocha --config src/test/memory/.mocharc.js",
41
- "test:mocha": "mocha --ignore 'dist/test/memory/**/*' --recursive 'dist/test/**/*.spec.js' -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
42
- "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
43
- "test:newsnapfiles": "node dist/test/createSnapshotFiles.js",
44
- "test:stress": "cross-env FUZZ_TEST_COUNT=100 FUZZ_STRESS_RUN=true mocha --ignore 'dist/test/memory/**/*' --recursive 'dist/test/**/*.fuzz.spec.js' -r @fluidframework/mocha-test-setup --unhandled-rejections=strict",
45
- "testfarm": "node dist/test/testFarm.js",
46
- "tsc": "tsc",
47
- "typetests:gen": "flub generate typetests --generate --dir .",
48
- "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
49
- },
50
17
  "nyc": {
51
18
  "all": true,
52
19
  "cache-dir": "nyc/.cache",
@@ -69,32 +36,32 @@
69
36
  },
70
37
  "dependencies": {
71
38
  "@fluidframework/common-definitions": "^0.20.1",
72
- "@fluidframework/common-utils": "^1.0.0",
73
- "@fluidframework/container-definitions": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
74
- "@fluidframework/container-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
75
- "@fluidframework/core-interfaces": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
76
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
77
- "@fluidframework/merge-tree": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
39
+ "@fluidframework/common-utils": "^1.1.1",
40
+ "@fluidframework/container-definitions": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
41
+ "@fluidframework/container-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
42
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
43
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
44
+ "@fluidframework/merge-tree": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
78
45
  "@fluidframework/protocol-definitions": "^1.1.0",
79
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
80
- "@fluidframework/runtime-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
81
- "@fluidframework/shared-object-base": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
82
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
46
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
47
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
48
+ "@fluidframework/shared-object-base": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
49
+ "@fluidframework/telemetry-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
83
50
  "uuid": "^8.3.1"
84
51
  },
85
52
  "devDependencies": {
86
- "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
87
- "@fluid-internal/test-dds-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
53
+ "@fluid-internal/stochastic-test-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
54
+ "@fluid-internal/test-dds-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
88
55
  "@fluid-tools/benchmark": "^0.45.0",
89
- "@fluid-tools/build-cli": "^0.8.0",
56
+ "@fluid-tools/build-cli": "^0.10.0",
90
57
  "@fluidframework/build-common": "^1.1.0",
91
- "@fluidframework/build-tools": "^0.8.0",
58
+ "@fluidframework/build-tools": "^0.10.0",
92
59
  "@fluidframework/eslint-config-fluid": "^2.0.0",
93
60
  "@fluidframework/gitresources": "^0.1038.2000",
94
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
95
- "@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.0.0-internal.3.0.0",
61
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
62
+ "@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.0.0-internal.3.1.0",
96
63
  "@fluidframework/server-services-client": "^0.1038.2000",
97
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.3.0.2 <2.0.0-internal.4.0.0",
64
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.3.2.0 <2.0.0-internal.4.0.0",
98
65
  "@microsoft/api-extractor": "^7.22.2",
99
66
  "@rushstack/eslint-config": "^2.5.1",
100
67
  "@types/diff": "^3.5.1",
@@ -114,9 +81,42 @@
114
81
  "typescript": "~4.5.5"
115
82
  },
116
83
  "typeValidation": {
117
- "version": "2.0.0-internal.3.0.1",
118
- "previousVersionStyle": "previousPatch",
119
- "baselineRange": "2.0.0-internal.3.0.0",
84
+ "version": "2.0.0-internal.3.2.0",
85
+ "previousVersionStyle": "~previousMinor",
86
+ "baselineRange": ">=2.0.0-internal.3.1.0 <2.0.0-internal.3.2.0",
87
+ "baselineVersion": "2.0.0-internal.3.1.0",
120
88
  "broken": {}
89
+ },
90
+ "scripts": {
91
+ "build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
92
+ "build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
93
+ "build:compile": "concurrently npm:build:commonjs npm:build:esnext",
94
+ "build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
95
+ "build:esnext": "tsc --project ./tsconfig.esnext.json",
96
+ "build:full": "npm run build",
97
+ "build:full:compile": "npm run build:compile",
98
+ "build:genver": "gen-version",
99
+ "build:test": "tsc --project ./src/test/tsconfig.json",
100
+ "ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
101
+ "clean": "rimraf dist lib *.tsbuildinfo *.build.log",
102
+ "eslint": "eslint --format stylish src",
103
+ "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
104
+ "format": "npm run prettier:fix",
105
+ "lint": "npm run prettier && npm run eslint",
106
+ "lint:fix": "npm run prettier:fix && npm run eslint:fix",
107
+ "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
108
+ "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
109
+ "test": "npm run test:mocha",
110
+ "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
111
+ "test:memory": "mocha --config src/test/memory/.mocharc.js",
112
+ "test:memory-profiling:report": "mocha --config src/test/memory/.mocharc.js",
113
+ "test:mocha": "mocha --ignore 'dist/test/memory/**/*' --recursive 'dist/test/**/*.spec.js' -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
114
+ "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
115
+ "test:newsnapfiles": "node dist/test/createSnapshotFiles.js",
116
+ "test:stress": "cross-env FUZZ_TEST_COUNT=100 FUZZ_STRESS_RUN=true mocha --ignore 'dist/test/memory/**/*' --recursive 'dist/test/**/*.fuzz.spec.js' -r @fluidframework/mocha-test-setup --unhandled-rejections=strict",
117
+ "testfarm": "node dist/test/testFarm.js",
118
+ "tsc": "tsc",
119
+ "typetests:gen": "flub generate typetests --generate --dir .",
120
+ "typetests:prepare": "flub generate typetests --prepare --dir . --pin"
121
121
  }
122
- }
122
+ }
@@ -4,5 +4,5 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- ...require("@fluidframework/build-common/prettier.config.cjs"),
7
+ ...require("@fluidframework/build-common/prettier.config.cjs"),
8
8
  };