@fluidframework/sequence 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/sequence.api.md +87 -84
- package/dist/defaultMap.d.ts +3 -3
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +7 -2
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts +11 -10
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/intervalCollection.d.ts +68 -14
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +50 -45
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointInRangeIndex.js +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointIndex.js +1 -1
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.d.ts +2 -2
- package/dist/intervalIndex/idIntervalIndex.js +1 -1
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
- package/dist/intervalIndex/overlappingIntervalsIndex.js +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/startpointInRangeIndex.js +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervals/interval.d.ts +2 -7
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +1 -5
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +15 -14
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +4 -3
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +3 -12
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +3 -11
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/localValues.d.ts +2 -1
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/revertibles.d.ts +9 -15
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +41 -21
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence-alpha.d.ts +1306 -0
- package/dist/sequence-beta.d.ts +270 -0
- package/dist/sequence-public.d.ts +270 -0
- package/dist/sequence-untrimmed.d.ts +1790 -0
- package/dist/sequence.d.ts +2 -3
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +4 -5
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +4 -4
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +4 -3
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts +1 -1
- package/dist/sequenceFactory.js +1 -1
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +3 -3
- package/dist/sharedIntervalCollection.js +2 -2
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts +3 -3
- package/dist/sharedSequence.js +2 -2
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +8 -5
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +6 -3
- package/dist/sharedString.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/defaultMap.d.ts +3 -3
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +29 -20
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +11 -10
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js +2 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/index.js +45 -10
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +68 -14
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +174 -156
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointInRangeIndex.js +18 -13
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointIndex.js +14 -9
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.d.ts +2 -2
- package/lib/intervalIndex/idIntervalIndex.js +9 -5
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
- package/lib/intervalIndex/index.js +19 -6
- package/lib/intervalIndex/index.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +1 -1
- package/lib/intervalIndex/intervalIndex.js +2 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/intervalIndexUtils.js +8 -4
- package/lib/intervalIndex/intervalIndexUtils.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
- package/lib/intervalIndex/overlappingIntervalsIndex.js +16 -11
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +15 -11
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js +2 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/startpointInRangeIndex.js +18 -13
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervalTree.js +9 -4
- package/lib/intervalTree.js.map +1 -1
- package/lib/intervals/index.js +18 -3
- package/lib/intervals/index.js.map +1 -1
- package/lib/intervals/interval.d.ts +2 -7
- package/lib/intervals/interval.d.ts.map +1 -1
- package/lib/intervals/interval.js +19 -18
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +15 -14
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js +22 -16
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +3 -12
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +68 -70
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/localValues.d.ts +2 -1
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js +9 -4
- package/lib/localValues.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +5 -2
- package/lib/packageVersion.js.map +1 -1
- package/lib/revertibles.d.ts +9 -15
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +98 -68
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence-alpha.d.ts +1306 -0
- package/lib/sequence-beta.d.ts +270 -0
- package/lib/sequence-public.d.ts +270 -0
- package/lib/sequence-untrimmed.d.ts +1790 -0
- package/lib/sequence.d.ts +2 -3
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +46 -46
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +4 -4
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +17 -10
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts +1 -1
- package/lib/sequenceFactory.js +14 -10
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +3 -3
- package/lib/sharedIntervalCollection.js +20 -15
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.d.ts +3 -3
- package/lib/sharedSequence.js +13 -8
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts +8 -5
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +27 -19
- package/lib/sharedString.js.map +1 -1
- package/package.json +43 -29
- package/sequence.test-files.tar +0 -0
- package/src/defaultMap.ts +22 -16
- package/src/defaultMapInterfaces.ts +15 -12
- package/src/intervalCollection.ts +131 -67
- package/src/intervalIndex/endpointInRangeIndex.ts +2 -2
- package/src/intervalIndex/endpointIndex.ts +2 -2
- package/src/intervalIndex/idIntervalIndex.ts +2 -2
- package/src/intervalIndex/intervalIndex.ts +1 -1
- package/src/intervalIndex/overlappingIntervalsIndex.ts +2 -2
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +1 -1
- package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -1
- package/src/intervalIndex/startpointInRangeIndex.ts +2 -2
- package/src/intervals/interval.ts +2 -7
- package/src/intervals/intervalUtils.ts +16 -15
- package/src/intervals/sequenceInterval.ts +3 -12
- package/src/localValues.ts +2 -1
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +95 -24
- package/src/sequence.ts +5 -7
- package/src/sequenceDeltaEvent.ts +6 -4
- package/src/sequenceFactory.ts +1 -1
- package/src/sharedIntervalCollection.ts +3 -3
- package/src/sharedSequence.ts +3 -3
- package/src/sharedString.ts +8 -5
- package/tsconfig.esnext.json +1 -2
- package/tsconfig.json +5 -3
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SequenceMaintenanceEvent = exports.SequenceDeltaEvent = exports.SequenceEvent = void 0;
|
|
8
|
+
/* eslint-disable import/no-deprecated */
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
+
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
7
11
|
/**
|
|
8
12
|
* Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.
|
|
9
13
|
*
|
|
10
14
|
* The properties of this object and its sub-objects represent the state of the sequence at the
|
|
11
15
|
* point in time at which the operation was applied.
|
|
12
16
|
* They will not take into any future modifications performed to the underlying sequence and merge tree.
|
|
13
|
-
* @
|
|
17
|
+
* @alpha
|
|
14
18
|
*/
|
|
15
|
-
|
|
19
|
+
class SequenceEvent {
|
|
16
20
|
constructor(deltaArgs, mergeTreeClient) {
|
|
17
21
|
this.deltaArgs = deltaArgs;
|
|
18
22
|
this.mergeTreeClient = mergeTreeClient;
|
|
19
|
-
assert(deltaArgs.deltaSegments.length > 0, 0x2d8 /* "Empty change event should not be emitted." */);
|
|
23
|
+
(0, core_utils_1.assert)(deltaArgs.deltaSegments.length > 0, 0x2d8 /* "Empty change event should not be emitted." */);
|
|
20
24
|
this.deltaOperation = deltaArgs.operation;
|
|
21
25
|
this.sortedRanges = new Lazy(() => {
|
|
22
|
-
const set = new SortedSegmentSet();
|
|
26
|
+
const set = new merge_tree_1.SortedSegmentSet();
|
|
23
27
|
this.deltaArgs.deltaSegments.forEach((delta) => {
|
|
24
28
|
const newRange = {
|
|
25
29
|
operation: this.deltaArgs.operation,
|
|
@@ -60,6 +64,7 @@ export class SequenceEvent {
|
|
|
60
64
|
return this.pLast.value;
|
|
61
65
|
}
|
|
62
66
|
}
|
|
67
|
+
exports.SequenceEvent = SequenceEvent;
|
|
63
68
|
/**
|
|
64
69
|
* The event object returned on sequenceDelta events.
|
|
65
70
|
*
|
|
@@ -70,29 +75,31 @@ export class SequenceEvent {
|
|
|
70
75
|
* For group ops, each op will get its own event, and the group op property will be set on the op args.
|
|
71
76
|
*
|
|
72
77
|
* Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.
|
|
73
|
-
* @
|
|
78
|
+
* @alpha
|
|
74
79
|
*/
|
|
75
|
-
|
|
80
|
+
class SequenceDeltaEvent extends SequenceEvent {
|
|
76
81
|
constructor(opArgs, deltaArgs, mergeTreeClient) {
|
|
77
82
|
super(deltaArgs, mergeTreeClient);
|
|
78
83
|
this.opArgs = opArgs;
|
|
79
84
|
this.isLocal = opArgs.sequencedMessage === undefined;
|
|
80
85
|
}
|
|
81
86
|
}
|
|
87
|
+
exports.SequenceDeltaEvent = SequenceDeltaEvent;
|
|
82
88
|
/**
|
|
83
89
|
* The event object returned on maintenance events.
|
|
84
90
|
*
|
|
85
91
|
* The properties of this object and its sub-objects represent the state of the sequence at the
|
|
86
92
|
* point in time at which the operation was applied.
|
|
87
93
|
* They will not take into consideration any future modifications performed to the underlying sequence and merge tree.
|
|
88
|
-
* @
|
|
94
|
+
* @alpha
|
|
89
95
|
*/
|
|
90
|
-
|
|
96
|
+
class SequenceMaintenanceEvent extends SequenceEvent {
|
|
91
97
|
constructor(opArgs, deltaArgs, mergeTreeClient) {
|
|
92
98
|
super(deltaArgs, mergeTreeClient);
|
|
93
99
|
this.opArgs = opArgs;
|
|
94
100
|
}
|
|
95
101
|
}
|
|
102
|
+
exports.SequenceMaintenanceEvent = SequenceMaintenanceEvent;
|
|
96
103
|
class Lazy {
|
|
97
104
|
constructor(valueGenerator) {
|
|
98
105
|
this.valueGenerator = valueGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceDeltaEvent.js","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"sequenceDeltaEvent.js","sourceRoot":"","sources":["../src/sequenceDeltaEvent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAAyC;AAEzC,2DAAoD;AACpD,2DAWoC;AAEpC;;;;;;;GAOG;AACH,MAAsB,aAAa;IAQlC,YACiB,SAAkD,EACjD,eAAuB;QADxB,cAAS,GAAT,SAAS,CAAyC;QACjD,oBAAe,GAAf,eAAe,CAAQ;QAExC,IAAA,mBAAM,EACL,SAAS,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAClC,KAAK,CAAC,iDAAiD,CACvD,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,SAAS,CAAC;QAE1C,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CAAoD,GAAG,EAAE;YACpF,MAAM,GAAG,GAAG,IAAI,6BAAgB,EAAmC,CAAC;YACpE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC9C,MAAM,QAAQ,GAAoC;oBACjD,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS;oBACnC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC;oBACzD,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,EAAE;oBAC1C,OAA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iB,MAAyC,EACzD,SAA4C,EAC5C,eAAuB;QAEvB,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAJlB,WAAM,GAAN,MAAM,CAAmC;IAK1D,CAAC;CACD;AARD,4DAQC;AA2CD,MAAM,IAAI;IAGT,YAA6B,cAAuB;QAAvB,mBAAc,GAAd,cAAc,CAAS;QACnD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IACzB,CAAC;IAED,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,IAAW,KAAK;QACf,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;SACpC;QACD,OAAO,IAAI,CAAC,MAAW,CAAC;IACzB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-deprecated */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tClient,\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n\tIMergeTreeMaintenanceCallbackArgs,\n\tISegment,\n\tMergeTreeDeltaOperationType,\n\tMergeTreeDeltaOperationTypes,\n\tMergeTreeMaintenanceType,\n\tPropertySet,\n\tSortedSegmentSet,\n} from \"@fluidframework/merge-tree\";\n\n/**\n * Base class for SequenceDeltaEvent and SequenceMaintenanceEvent.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into any future modifications performed to the underlying sequence and merge tree.\n * @alpha\n */\nexport abstract class SequenceEvent<\n\tTOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,\n> {\n\tpublic readonly deltaOperation: TOperation;\n\tprivate readonly sortedRanges: Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>;\n\tprivate readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;\n\tprivate readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;\n\n\tconstructor(\n\t\tpublic readonly deltaArgs: IMergeTreeDeltaCallbackArgs<TOperation>,\n\t\tprivate readonly mergeTreeClient: Client,\n\t) {\n\t\tassert(\n\t\t\tdeltaArgs.deltaSegments.length > 0,\n\t\t\t0x2d8 /* \"Empty change event should not be emitted.\" */,\n\t\t);\n\t\tthis.deltaOperation = deltaArgs.operation;\n\n\t\tthis.sortedRanges = new Lazy<SortedSegmentSet<ISequenceDeltaRange<TOperation>>>(() => {\n\t\t\tconst set = new SortedSegmentSet<ISequenceDeltaRange<TOperation>>();\n\t\t\tthis.deltaArgs.deltaSegments.forEach((delta) => {\n\t\t\t\tconst newRange: ISequenceDeltaRange<TOperation> = {\n\t\t\t\t\toperation: this.deltaArgs.operation,\n\t\t\t\t\tposition: this.mergeTreeClient.getPosition(delta.segment),\n\t\t\t\t\tpropertyDeltas: delta.propertyDeltas ?? {},\n\t\t\t\t\tsegment: delta.segment,\n\t\t\t\t};\n\t\t\t\tset.addOrUpdate(newRange);\n\t\t\t});\n\t\t\treturn set;\n\t\t});\n\n\t\tthis.pFirst = new Lazy<ISequenceDeltaRange<TOperation>>(\n\t\t\t() => this.sortedRanges.value.items[0],\n\t\t);\n\n\t\tthis.pLast = new Lazy<ISequenceDeltaRange<TOperation>>(\n\t\t\t() => this.sortedRanges.value.items[this.sortedRanges.value.size - 1],\n\t\t);\n\t}\n\n\t/**\n\t * The in-order ranges affected by this delta.\n\t * These may not be continuous.\n\t */\n\tpublic get ranges(): readonly Readonly<ISequenceDeltaRange<TOperation>>[] {\n\t\treturn this.sortedRanges.value.items;\n\t}\n\n\t/**\n\t * The client id of the client that made the change which caused the delta event\n\t */\n\tpublic get clientId(): string | undefined {\n\t\treturn this.mergeTreeClient.longClientId;\n\t}\n\n\t/**\n\t * The first of the modified ranges.\n\t */\n\tpublic get first(): Readonly<ISequenceDeltaRange<TOperation>> {\n\t\treturn this.pFirst.value;\n\t}\n\n\t/**\n\t * The last of the modified ranges.\n\t */\n\tpublic get last(): Readonly<ISequenceDeltaRange<TOperation>> {\n\t\treturn this.pLast.value;\n\t}\n}\n\n/**\n * The event object returned on sequenceDelta events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n *\n * For group ops, each op will get its own event, and the group op property will be set on the op args.\n *\n * Ops may get multiple events. For instance, an insert-replace will get a remove then an insert event.\n * @alpha\n */\nexport class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationType> {\n\t/**\n\t * Whether the event was caused by a locally-made change.\n\t */\n\tpublic readonly isLocal: boolean;\n\n\tconstructor(\n\t\tpublic readonly opArgs: IMergeTreeDeltaOpArgs,\n\t\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n\t\tmergeTreeClient: Client,\n\t) {\n\t\tsuper(deltaArgs, mergeTreeClient);\n\t\tthis.isLocal = opArgs.sequencedMessage === undefined;\n\t}\n}\n\n/**\n * The event object returned on maintenance events.\n *\n * The properties of this object and its sub-objects represent the state of the sequence at the\n * point in time at which the operation was applied.\n * They will not take into consideration any future modifications performed to the underlying sequence and merge tree.\n * @alpha\n */\nexport class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {\n\tconstructor(\n\t\tpublic readonly opArgs: IMergeTreeDeltaOpArgs | undefined,\n\t\tdeltaArgs: IMergeTreeMaintenanceCallbackArgs,\n\t\tmergeTreeClient: Client,\n\t) {\n\t\tsuper(deltaArgs, mergeTreeClient);\n\t}\n}\n\n/**\n * A range that has changed corresponding to a segment modification.\n * @alpha\n */\nexport interface ISequenceDeltaRange<\n\tTOperation extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationTypes,\n> {\n\t/**\n\t * The type of operation that changed this range.\n\t *\n\t * @remarks Consuming code should typically compare this to the enum values defined in\n\t * `MergeTreeDeltaOperationTypes`.\n\t */\n\toperation: TOperation;\n\n\t/**\n\t * The index of the start of the range.\n\t */\n\tposition: number;\n\n\t/**\n\t * The segment that corresponds to the range.\n\t */\n\tsegment: ISegment;\n\n\t/**\n\t * Deltas object which contains all modified properties with their previous values.\n\t * Since `undefined` doesn't survive a round-trip through JSON serialization, the old value being absent\n\t * is instead encoded with `null`.\n\t *\n\t * @remarks This object is motivated by undo/redo scenarios, and provides a convenient \"inverse op\" to apply to\n\t * undo a property change.\n\t *\n\t * @example\n\t *\n\t * If a segment initially had properties `{ foo: \"1\", bar: 2 }` and it was annotated with\n\t * `{ foo: 3, baz: 5 }`, the corresponding event would have a `propertyDeltas` of `{ foo: \"1\", baz: null }`.\n\t */\n\tpropertyDeltas: PropertySet;\n}\n\nclass Lazy<T> {\n\tprivate pValue: T | undefined;\n\tprivate pEvaluated: boolean;\n\tconstructor(private readonly valueGenerator: () => T) {\n\t\tthis.pEvaluated = false;\n\t}\n\n\tpublic get evaluated(): boolean {\n\t\treturn this.pEvaluated;\n\t}\n\n\tpublic get value(): T {\n\t\tif (!this.pEvaluated) {\n\t\t\tthis.pEvaluated = true;\n\t\t\tthis.pValue = this.valueGenerator();\n\t\t}\n\t\treturn this.pValue as T;\n\t}\n}\n"]}
|
package/lib/sequenceFactory.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { IChannelAttributes, IFluidDataStoreRuntime, IChannelServices, IChannelFactory } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { SharedString, SharedStringSegment } from "./sharedString";
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
8
|
+
* @alpha
|
|
9
9
|
*/
|
|
10
10
|
export declare class SharedStringFactory implements IChannelFactory {
|
|
11
11
|
static Type: string;
|
package/lib/sequenceFactory.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SharedStringFactory = void 0;
|
|
8
|
+
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
9
|
+
const packageVersion_1 = require("./packageVersion");
|
|
10
|
+
const sharedString_1 = require("./sharedString");
|
|
8
11
|
/**
|
|
9
|
-
* @
|
|
12
|
+
* @alpha
|
|
10
13
|
*/
|
|
11
|
-
|
|
14
|
+
class SharedStringFactory {
|
|
12
15
|
static segmentFromSpec(spec) {
|
|
13
|
-
const maybeText = TextSegment.fromJSONObject(spec);
|
|
16
|
+
const maybeText = merge_tree_1.TextSegment.fromJSONObject(spec);
|
|
14
17
|
if (maybeText) {
|
|
15
18
|
return maybeText;
|
|
16
19
|
}
|
|
17
|
-
const maybeMarker = Marker.fromJSONObject(spec);
|
|
20
|
+
const maybeMarker = merge_tree_1.Marker.fromJSONObject(spec);
|
|
18
21
|
if (maybeMarker) {
|
|
19
22
|
return maybeMarker;
|
|
20
23
|
}
|
|
@@ -30,22 +33,23 @@ export class SharedStringFactory {
|
|
|
30
33
|
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
|
|
31
34
|
*/
|
|
32
35
|
async load(runtime, id, services, attributes) {
|
|
33
|
-
const sharedString = new SharedString(runtime, id, attributes);
|
|
36
|
+
const sharedString = new sharedString_1.SharedString(runtime, id, attributes);
|
|
34
37
|
await sharedString.load(services);
|
|
35
38
|
return sharedString;
|
|
36
39
|
}
|
|
37
40
|
create(document, id) {
|
|
38
|
-
const sharedString = new SharedString(document, id, this.attributes);
|
|
41
|
+
const sharedString = new sharedString_1.SharedString(document, id, this.attributes);
|
|
39
42
|
sharedString.initializeLocal();
|
|
40
43
|
return sharedString;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
46
|
+
exports.SharedStringFactory = SharedStringFactory;
|
|
43
47
|
// TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically
|
|
44
48
|
// load code (UPDATE: paparazzi is gone... anything to do here?)
|
|
45
49
|
SharedStringFactory.Type = "https://graph.microsoft.com/types/mergeTree";
|
|
46
50
|
SharedStringFactory.Attributes = {
|
|
47
51
|
type: SharedStringFactory.Type,
|
|
48
52
|
snapshotFormatVersion: "0.1",
|
|
49
|
-
packageVersion: pkgVersion,
|
|
53
|
+
packageVersion: packageVersion_1.pkgVersion,
|
|
50
54
|
};
|
|
51
55
|
//# sourceMappingURL=sequenceFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceFactory.js","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"sequenceFactory.js","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,2DAAiE;AACjE,qDAA8C;AAC9C,iDAAmE;AAEnE;;GAEG;AACH,MAAa,mBAAmB;IAWxB,MAAM,CAAC,eAAe,CAAC,IAAS;QACtC,MAAM,SAAS,GAAG,wBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,SAAS,EAAE;YACd,OAAO,SAAS,CAAC;SACjB;QAED,MAAM,WAAW,GAAG,mBAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,WAAW,EAAE;YAChB,OAAO,WAAW,CAAC;SACnB;QAED,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC7C,CAAC;IAED,IAAW,IAAI;QACd,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAC/D,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACrB,CAAC;;AAnDF,kDAoDC;AAnDA,+GAA+G;AAC/G,gEAAgE;AAClD,wBAAI,GAAG,6CAA6C,CAAC;AAE5C,8BAAU,GAAuB;IACvD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { Marker, TextSegment } from \"@fluidframework/merge-tree\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\n\n/**\n * @alpha\n */\nexport class SharedStringFactory implements IChannelFactory {\n\t// TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically\n\t// load code (UPDATE: paparazzi is gone... anything to do here?)\n\tpublic static Type = \"https://graph.microsoft.com/types/mergeTree\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: SharedStringFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic static segmentFromSpec(spec: any): SharedStringSegment {\n\t\tconst maybeText = TextSegment.fromJSONObject(spec);\n\t\tif (maybeText) {\n\t\t\treturn maybeText;\n\t\t}\n\n\t\tconst maybeMarker = Marker.fromJSONObject(spec);\n\t\tif (maybeMarker) {\n\t\t\treturn maybeMarker;\n\t\t}\n\n\t\tthrow new Error(`Unrecognized IJSONObject`);\n\t}\n\n\tpublic get type() {\n\t\treturn SharedStringFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn SharedStringFactory.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<SharedString> {\n\t\tconst sharedString = new SharedString(runtime, id, attributes);\n\t\tawait sharedString.load(services);\n\t\treturn sharedString;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): SharedString {\n\t\tconst sharedString = new SharedString(document, id, this.attributes);\n\t\tsharedString.initializeLocal();\n\t\treturn sharedString;\n\t}\n}\n"]}
|
|
@@ -11,7 +11,7 @@ import { IIntervalCollection } from "./intervalCollection";
|
|
|
11
11
|
/**
|
|
12
12
|
* The factory that defines the SharedIntervalCollection.
|
|
13
13
|
* @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
|
|
14
|
-
* @
|
|
14
|
+
* @internal
|
|
15
15
|
*/
|
|
16
16
|
export declare class SharedIntervalCollectionFactory implements IChannelFactory {
|
|
17
17
|
static readonly Type = "https://graph.microsoft.com/types/sharedIntervalCollection";
|
|
@@ -25,14 +25,14 @@ export declare class SharedIntervalCollectionFactory implements IChannelFactory
|
|
|
25
25
|
create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* @
|
|
28
|
+
* @alpha
|
|
29
29
|
*/
|
|
30
30
|
export interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {
|
|
31
31
|
getIntervalCollection(label: string): IIntervalCollection<TInterval>;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
|
|
35
|
-
* @
|
|
35
|
+
* @internal
|
|
36
36
|
*/
|
|
37
37
|
export declare class SharedIntervalCollection extends SharedObject implements ISharedIntervalCollection<Interval> {
|
|
38
38
|
/**
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
5
6
|
var _a;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.SharedIntervalCollection = exports.SharedIntervalCollectionFactory = void 0;
|
|
9
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
|
+
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
11
|
+
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
12
|
+
const intervalCollection_1 = require("./intervalCollection");
|
|
13
|
+
const defaultMap_1 = require("./defaultMap");
|
|
14
|
+
const packageVersion_1 = require("./packageVersion");
|
|
12
15
|
const snapshotFileName = "header";
|
|
13
16
|
/**
|
|
14
17
|
* The factory that defines the SharedIntervalCollection.
|
|
15
18
|
* @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
|
|
16
|
-
* @
|
|
19
|
+
* @internal
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
class SharedIntervalCollectionFactory {
|
|
19
22
|
get type() {
|
|
20
23
|
return SharedIntervalCollectionFactory.Type;
|
|
21
24
|
}
|
|
@@ -36,17 +39,18 @@ export class SharedIntervalCollectionFactory {
|
|
|
36
39
|
return map;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
42
|
+
exports.SharedIntervalCollectionFactory = SharedIntervalCollectionFactory;
|
|
39
43
|
SharedIntervalCollectionFactory.Type = "https://graph.microsoft.com/types/sharedIntervalCollection";
|
|
40
44
|
SharedIntervalCollectionFactory.Attributes = {
|
|
41
45
|
type: SharedIntervalCollectionFactory.Type,
|
|
42
46
|
snapshotFormatVersion: "0.1",
|
|
43
|
-
packageVersion: pkgVersion,
|
|
47
|
+
packageVersion: packageVersion_1.pkgVersion,
|
|
44
48
|
};
|
|
45
49
|
/**
|
|
46
50
|
* @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
|
|
47
|
-
* @
|
|
51
|
+
* @internal
|
|
48
52
|
*/
|
|
49
|
-
|
|
53
|
+
class SharedIntervalCollection extends shared_object_base_1.SharedObject {
|
|
50
54
|
/**
|
|
51
55
|
* Create a SharedIntervalCollection
|
|
52
56
|
*
|
|
@@ -72,7 +76,7 @@ export class SharedIntervalCollection extends SharedObject {
|
|
|
72
76
|
constructor(id, runtime, attributes) {
|
|
73
77
|
super(id, runtime, attributes, "fluid_sharedIntervalCollection_");
|
|
74
78
|
this[_a] = "SharedIntervalCollection";
|
|
75
|
-
this.intervalCollections = new DefaultMap(this.serializer, this.handle, (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata), new IntervalCollectionValueType(), runtime.options);
|
|
79
|
+
this.intervalCollections = new defaultMap_1.DefaultMap(this.serializer, this.handle, (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata), new intervalCollection_1.IntervalCollectionValueType(), runtime.options);
|
|
76
80
|
}
|
|
77
81
|
getIntervalCollection(label) {
|
|
78
82
|
const realLabel = this.getIntervalCollectionPath(label);
|
|
@@ -80,7 +84,7 @@ export class SharedIntervalCollection extends SharedObject {
|
|
|
80
84
|
return sharedCollection;
|
|
81
85
|
}
|
|
82
86
|
summarizeCore(serializer) {
|
|
83
|
-
return createSingleBlobSummary(snapshotFileName, this.intervalCollections.serialize(serializer));
|
|
87
|
+
return (0, shared_object_base_1.createSingleBlobSummary)(snapshotFileName, this.intervalCollections.serialize(serializer));
|
|
84
88
|
}
|
|
85
89
|
reSubmitCore(content, localOpMetadata) {
|
|
86
90
|
this.intervalCollections.tryResubmitMessage(content, localOpMetadata);
|
|
@@ -91,11 +95,11 @@ export class SharedIntervalCollection extends SharedObject {
|
|
|
91
95
|
*/
|
|
92
96
|
async loadCore(storage) {
|
|
93
97
|
const blob = await storage.readBlob(snapshotFileName);
|
|
94
|
-
const header = bufferToString(blob, "utf8");
|
|
98
|
+
const header = (0, client_utils_1.bufferToString)(blob, "utf8");
|
|
95
99
|
this.intervalCollections.populate(header);
|
|
96
100
|
}
|
|
97
101
|
processCore(message, local, localOpMetadata) {
|
|
98
|
-
if (message.type === MessageType.Operation) {
|
|
102
|
+
if (message.type === protocol_definitions_1.MessageType.Operation) {
|
|
99
103
|
this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);
|
|
100
104
|
}
|
|
101
105
|
}
|
|
@@ -110,5 +114,6 @@ export class SharedIntervalCollection extends SharedObject {
|
|
|
110
114
|
throw new Error("not implemented");
|
|
111
115
|
}
|
|
112
116
|
}
|
|
117
|
+
exports.SharedIntervalCollection = SharedIntervalCollection;
|
|
113
118
|
_a = Symbol.toStringTag;
|
|
114
119
|
//# sourceMappingURL=sharedIntervalCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+DAA8D;AAQ9D,+EAA8F;AAE9F,2EAI4C;AAE5C,6DAI8B;AAC9B,6CAAyD;AACzD,qDAA8C;AAG9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,+BAA+B;IAS3C,IAAW,IAAI;QACd,OAAO,+BAA+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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;AAtGD,4DAsGC;KA3EiB,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 \"@fluid-internal/client-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 { Interval, ISerializableInterval } from \"./intervals\";\nimport {\n\tIntervalCollection,\n\tIIntervalCollection,\n\tIntervalCollectionValueType,\n} from \"./intervalCollection\";\nimport { DefaultMap, IMapOperation } 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 * @internal\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\n/**\n * @alpha\n */\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n\tgetIntervalCollection(label: string): IIntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n * @internal\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\truntime.options,\n\t\t);\n\t}\n\n\tpublic getIntervalCollection(label: string): IIntervalCollection<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 as IMapOperation,\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"]}
|
package/lib/sharedSequence.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ import { IChannelAttributes, IFluidDataStoreRuntime, Serializable } from "@fluid
|
|
|
7
7
|
import { SharedSegmentSequence } from "./sequence";
|
|
8
8
|
/**
|
|
9
9
|
* @deprecated IJSONRunSegment will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
|
|
10
|
-
* @
|
|
10
|
+
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export interface IJSONRunSegment<T> extends IJSONSegment {
|
|
13
13
|
items: Serializable<T>[];
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* @deprecated SubSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
|
|
17
|
-
* @
|
|
17
|
+
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export declare class SubSequence<T> extends BaseSegment {
|
|
20
20
|
items: Serializable<T>[];
|
|
@@ -33,7 +33,7 @@ export declare class SubSequence<T> extends BaseSegment {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* @deprecated SharedSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
|
|
36
|
-
* @
|
|
36
|
+
* @internal
|
|
37
37
|
*/
|
|
38
38
|
export declare class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
|
|
39
39
|
id: string;
|
package/lib/sharedSequence.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*!
|
|
2
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
4
|
* Licensed under the MIT License.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SharedSequence = exports.SubSequence = void 0;
|
|
8
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
+
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
10
|
+
const sequence_1 = require("./sequence");
|
|
8
11
|
const MaxRun = 128;
|
|
9
12
|
/**
|
|
10
13
|
* @deprecated SubSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
|
|
11
|
-
* @
|
|
14
|
+
* @internal
|
|
12
15
|
*/
|
|
13
|
-
|
|
16
|
+
class SubSequence extends merge_tree_1.BaseSegment {
|
|
14
17
|
static is(segment) {
|
|
15
18
|
return segment.type === SubSequence.typeString;
|
|
16
19
|
}
|
|
@@ -49,7 +52,7 @@ export class SubSequence extends BaseSegment {
|
|
|
49
52
|
return this.items.toString();
|
|
50
53
|
}
|
|
51
54
|
append(segment) {
|
|
52
|
-
assert(SubSequence.is(segment), 0x448 /* can only append to another run segment */);
|
|
55
|
+
(0, core_utils_1.assert)(SubSequence.is(segment), 0x448 /* can only append to another run segment */);
|
|
53
56
|
super.append(segment);
|
|
54
57
|
this.items = this.items.concat(segment.items);
|
|
55
58
|
}
|
|
@@ -78,12 +81,13 @@ export class SubSequence extends BaseSegment {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
}
|
|
84
|
+
exports.SubSequence = SubSequence;
|
|
81
85
|
SubSequence.typeString = "SubSequence";
|
|
82
86
|
/**
|
|
83
87
|
* @deprecated SharedSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
|
|
84
|
-
* @
|
|
88
|
+
* @internal
|
|
85
89
|
*/
|
|
86
|
-
|
|
90
|
+
class SharedSequence extends sequence_1.SharedSegmentSequence {
|
|
87
91
|
constructor(document, id, attributes, specToSegment) {
|
|
88
92
|
super(document, id, attributes, specToSegment);
|
|
89
93
|
this.id = id;
|
|
@@ -149,4 +153,5 @@ export class SharedSequence extends SharedSegmentSequence {
|
|
|
149
153
|
return items;
|
|
150
154
|
}
|
|
151
155
|
}
|
|
156
|
+
exports.SharedSequence = SharedSequence;
|
|
152
157
|
//# sourceMappingURL=sharedSequence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedSequence.js","sourceRoot":"","sources":["../src/sharedSequence.ts"],"names":[],"mappings":"AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"sharedSequence.js","sourceRoot":"","sources":["../src/sharedSequence.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,2DAA8F;AAM9F,yCAAmD;AAEnD,MAAM,MAAM,GAAG,GAAG,CAAC;AAUnB;;;GAGG;AACH,MAAa,WAAe,SAAQ,wBAAW;IAEvC,MAAM,CAAC,EAAE,CAAC,OAAiB;QACjC,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU,CAAC;IAChD,CAAC;IACM,MAAM,CAAC,cAAc,CAAI,IAAkB;QACjD,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,IAAI,EAAE;YACxD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAI,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,IAAI,IAAI,CAAC,KAAK,EAAE;gBACf,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAClC;YACD,OAAO,OAAO,CAAC;SACf;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAID,YAAmB,KAAwB;QAC1C,KAAK,EAAE,CAAC;QADU,UAAK,GAAL,KAAK,CAAmB;QAF3B,SAAI,GAAG,WAAW,CAAC,UAAU,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC;IAClC,CAAC;IAEM,YAAY;QAClB,MAAM,GAAG,GAAuB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;IACZ,CAAC;IAEM,K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G;IACI,MAAM,CAAC,KAAa,EAAE,GAAW;QACvC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,YAAY;QAClB,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAa,EAAE,GAAY;QAC1C,MAAM,KAAK,GAAsB,EAAE,CAAC;QACpC,IAAI,YAAkC,CAAC;QAEvC,oCAAoC;QACpC,IAAI,GAAG,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;AAhFD,wCAgFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-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\n/**\n * @deprecated IJSONRunSegment will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package\n * @internal\n */\nexport interface IJSONRunSegment<T> extends IJSONSegment {\n\titems: Serializable<T>[];\n}\n\n/**\n * @deprecated SubSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package\n * @internal\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\n/**\n * @deprecated SharedSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package\n * @internal\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\tthis.client.insertSegmentLocal(pos, segment);\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"]}
|
package/lib/sharedString.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { SharedSegmentSequence } from "./sequence";
|
|
|
8
8
|
import { SharedStringFactory } from "./sequenceFactory";
|
|
9
9
|
/**
|
|
10
10
|
* Fluid object interface describing access methods on a SharedString
|
|
11
|
-
* @
|
|
11
|
+
* @alpha
|
|
12
12
|
*/
|
|
13
13
|
export interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {
|
|
14
14
|
/**
|
|
@@ -31,7 +31,7 @@ export interface ISharedString extends SharedSegmentSequence<SharedStringSegment
|
|
|
31
31
|
posFromRelativePos(relativePos: IRelativePosition): number;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* @
|
|
34
|
+
* @alpha
|
|
35
35
|
*/
|
|
36
36
|
export type SharedStringSegment = TextSegment | Marker;
|
|
37
37
|
/**
|
|
@@ -42,8 +42,7 @@ export type SharedStringSegment = TextSegment | Marker;
|
|
|
42
42
|
* In addition to text, a Shared String can also contain markers. Markers can be
|
|
43
43
|
* used to store metadata at positions within the text, like the details of an
|
|
44
44
|
* image or Fluid object that should be rendered with the text.
|
|
45
|
-
*
|
|
46
|
-
* @public
|
|
45
|
+
* @alpha
|
|
47
46
|
*/
|
|
48
47
|
export declare class SharedString extends SharedSegmentSequence<SharedStringSegment> implements ISharedString {
|
|
49
48
|
id: string;
|
|
@@ -104,6 +103,10 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
|
|
|
104
103
|
* @param marker - The marker to annotate
|
|
105
104
|
* @param props - The properties to annotate the marker with
|
|
106
105
|
* @param consensusCallback - The callback called when consensus is reached
|
|
106
|
+
*
|
|
107
|
+
* @deprecated We no longer intend to support this functionality and it will
|
|
108
|
+
* be removed in a future release. There is no replacement for this
|
|
109
|
+
* functionality.
|
|
107
110
|
*/
|
|
108
111
|
annotateMarkerNotifyConsensus(marker: Marker, props: PropertySet, callback: (m: Marker) => void): void;
|
|
109
112
|
/**
|
|
@@ -170,7 +173,7 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
|
|
|
170
173
|
* // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]
|
|
171
174
|
* // Note parallelText does not include "missing".
|
|
172
175
|
* ```
|
|
173
|
-
* @
|
|
176
|
+
* @internal
|
|
174
177
|
*/
|
|
175
178
|
export declare function getTextAndMarkers(sharedString: SharedString, label: string, start?: number, end?: number): {
|
|
176
179
|
parallelText: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,QAAQ,EAER,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EAEb,WAAW,EACX,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;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,mBAAmB,CAAC;IAChF;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAEjE;;;;;OAKG;IACH,YAAY,CACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,aAAa,EACtB,KAAK,CAAC,EAAE,WAAW,GACjB,mBAAmB,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,kBAAkB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM,CAAC;CAC3D;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,MAAM,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,QAAQ,EAER,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EAEb,WAAW,EACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,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