@fluidframework/matrix 2.0.0-internal.8.0.1 → 2.0.0-rc.1.0.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 +38 -0
- package/README.md +0 -6
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +1 -9
- package/api-report/matrix.api.md +1 -2
- package/dist/{handlecache.cjs → handlecache.js} +3 -3
- package/dist/handlecache.js.map +1 -0
- package/dist/{handletable.cjs → handletable.js} +1 -1
- package/dist/handletable.js.map +1 -0
- package/dist/{index.cjs → index.js} +3 -3
- package/dist/index.js.map +1 -0
- package/dist/matrix-alpha.d.ts +1 -2
- package/dist/matrix-beta.d.ts +0 -25
- package/dist/matrix-public.d.ts +0 -25
- package/dist/matrix-untrimmed.d.ts +1 -2
- package/dist/matrix.d.ts +2 -2
- package/dist/matrix.d.ts.map +1 -1
- package/dist/{matrix.cjs → matrix.js} +9 -9
- package/dist/matrix.js.map +1 -0
- package/dist/{ops.cjs → ops.js} +1 -1
- package/dist/ops.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/{packageVersion.cjs → packageVersion.js} +2 -2
- package/dist/packageVersion.js.map +1 -0
- package/dist/{permutationvector.cjs → permutationvector.js} +4 -4
- package/dist/permutationvector.js.map +1 -0
- package/dist/{range.cjs → range.js} +1 -1
- package/dist/range.js.map +1 -0
- package/dist/{runtime.cjs → runtime.js} +3 -3
- package/dist/runtime.js.map +1 -0
- package/dist/{serialization.cjs → serialization.js} +1 -1
- package/dist/serialization.js.map +1 -0
- package/dist/{sparsearray2d.cjs → sparsearray2d.js} +1 -1
- package/dist/sparsearray2d.js.map +1 -0
- package/dist/{types.cjs → types.js} +1 -1
- package/dist/types.js.map +1 -0
- package/dist/{undoprovider.cjs → undoprovider.js} +2 -2
- package/dist/undoprovider.js.map +1 -0
- package/lib/{handlecache.d.ts → handlecache.d.mts} +1 -1
- package/lib/handlecache.d.mts.map +1 -0
- package/lib/{handletable.d.ts → handletable.d.mts} +1 -1
- package/lib/handletable.d.mts.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +1 -1
- package/lib/index.d.mts.map +1 -0
- package/lib/{matrix-alpha.d.ts → matrix-alpha.d.mts} +1 -2
- package/lib/{matrix-beta.d.ts → matrix-beta.d.mts} +0 -25
- package/lib/{matrix-public.d.ts → matrix-public.d.mts} +0 -25
- package/lib/{matrix-untrimmed.d.ts → matrix-untrimmed.d.mts} +1 -2
- package/lib/{matrix.d.ts → matrix.d.mts} +3 -3
- package/lib/matrix.d.mts.map +1 -0
- package/lib/matrix.mjs.map +1 -1
- package/lib/{ops.d.ts → ops.d.mts} +1 -1
- package/lib/ops.d.mts.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/{permutationvector.d.ts → permutationvector.d.mts} +1 -1
- package/lib/permutationvector.d.mts.map +1 -0
- package/lib/{range.d.ts → range.d.mts} +1 -1
- package/lib/range.d.mts.map +1 -0
- package/lib/{runtime.d.ts → runtime.d.mts} +1 -1
- package/lib/runtime.d.mts.map +1 -0
- package/lib/{serialization.d.ts → serialization.d.mts} +1 -1
- package/lib/serialization.d.mts.map +1 -0
- package/lib/{sparsearray2d.d.ts → sparsearray2d.d.mts} +1 -1
- package/lib/sparsearray2d.d.mts.map +1 -0
- package/lib/{types.d.ts → types.d.mts} +1 -1
- package/lib/types.d.mts.map +1 -0
- package/lib/{undoprovider.d.ts → undoprovider.d.mts} +1 -1
- package/lib/undoprovider.d.mts.map +1 -0
- package/package.json +82 -33
- package/src/matrix.ts +1 -2
- package/src/packageVersion.ts +1 -1
- package/dist/handlecache.cjs.map +0 -1
- package/dist/handletable.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/matrix.cjs.map +0 -1
- package/dist/ops.cjs.map +0 -1
- package/dist/packageVersion.cjs.map +0 -1
- package/dist/permutationvector.cjs.map +0 -1
- package/dist/range.cjs.map +0 -1
- package/dist/runtime.cjs.map +0 -1
- package/dist/serialization.cjs.map +0 -1
- package/dist/sparsearray2d.cjs.map +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/undoprovider.cjs.map +0 -1
- package/lib/handlecache.d.ts.map +0 -1
- package/lib/handletable.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/matrix.d.ts.map +0 -1
- package/lib/ops.d.ts.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/permutationvector.d.ts.map +0 -1
- package/lib/range.d.ts.map +0 -1
- package/lib/runtime.d.ts.map +0 -1
- package/lib/serialization.d.ts.map +0 -1
- package/lib/sparsearray2d.d.ts.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/undoprovider.d.ts.map +0 -1
- package/matrix.test-files.tar +0 -0
- package/tsc-multi.test.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @fluidframework/matrix
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.1.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
8
|
+
|
|
9
|
+
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
10
|
+
|
|
11
|
+
- @fluidframework/gitresources
|
|
12
|
+
- @fluidframework/server-kafka-orderer
|
|
13
|
+
- @fluidframework/server-lambdas
|
|
14
|
+
- @fluidframework/server-lambdas-driver
|
|
15
|
+
- @fluidframework/server-local-server
|
|
16
|
+
- @fluidframework/server-memory-orderer
|
|
17
|
+
- @fluidframework/protocol-base
|
|
18
|
+
- @fluidframework/server-routerlicious
|
|
19
|
+
- @fluidframework/server-routerlicious-base
|
|
20
|
+
- @fluidframework/server-services
|
|
21
|
+
- @fluidframework/server-services-client
|
|
22
|
+
- @fluidframework/server-services-core
|
|
23
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
24
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
25
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
26
|
+
- @fluidframework/server-services-shared
|
|
27
|
+
- @fluidframework/server-services-telemetry
|
|
28
|
+
- @fluidframework/server-services-utils
|
|
29
|
+
- @fluidframework/server-test-utils
|
|
30
|
+
- tinylicious
|
|
31
|
+
|
|
32
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
33
|
+
|
|
34
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
35
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
36
|
+
|
|
37
|
+
- shared-object-base: SharedObject processGCDataCore now takes IFluidSerializer rather than SummarySerializer ([#18803](https://github.com/microsoft/FluidFramework/issues/18803)) [396b8e9738](https://github.com/microsoft/FluidFramework/commits/396b8e9738156ff88b62424a0076f09fb5028a32)
|
|
38
|
+
|
|
39
|
+
This change should be a no-op for consumers, and `SummarySerializer` and `IFluidSerializer` expose the same consumer facing APIs. This change just makes our APIs more consistent by only using interfaces, rather than a mix of interfaces and concrete implementations.
|
|
40
|
+
|
|
3
41
|
## 2.0.0-internal.8.0.0
|
|
4
42
|
|
|
5
43
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -13,12 +13,6 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
|
|
|
13
13
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
14
|
library consumers should always prefer `^`.
|
|
15
15
|
|
|
16
|
-
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
17
|
-
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
18
|
-
Standard `^` and `~` ranges will not work as expected.
|
|
19
|
-
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
20
|
-
package for more information including tools to convert between version schemes.
|
|
21
|
-
|
|
22
16
|
<!-- prettier-ignore-end -->
|
|
23
17
|
|
|
24
18
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
package/api-extractor-lint.json
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-lint.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
// TODO: remove once base config has this enabled as an error
|
|
7
|
-
"ae-incompatible-release-tags": {
|
|
8
|
-
"logLevel": "error",
|
|
9
|
-
"addToApiReportFile": false
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json"
|
|
13
4
|
}
|
package/api-extractor.json
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
// TODO: Add missing documentation and remove this rule override
|
|
7
|
-
"ae-undocumented": {
|
|
8
|
-
"logLevel": "none"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
12
4
|
}
|
package/api-report/matrix.api.md
CHANGED
|
@@ -22,7 +22,6 @@ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
|
22
22
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
23
23
|
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
24
24
|
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
25
|
-
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
26
25
|
|
|
27
26
|
// @alpha (undocumented)
|
|
28
27
|
export interface IRevertible {
|
|
@@ -84,7 +83,7 @@ export class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEvents<T>>
|
|
|
84
83
|
openUndo(consumer: IUndoConsumer): void;
|
|
85
84
|
// (undocumented)
|
|
86
85
|
protected processCore(rawMessage: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
87
|
-
protected processGCDataCore(serializer:
|
|
86
|
+
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
88
87
|
// (undocumented)
|
|
89
88
|
removeCols(colStart: number, count: number): void;
|
|
90
89
|
// (undocumented)
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.HandleCache = void 0;
|
|
8
8
|
/* eslint-disable no-bitwise */
|
|
9
9
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
|
-
const handletable_1 = require("./handletable
|
|
11
|
-
const range_1 = require("./range
|
|
10
|
+
const handletable_1 = require("./handletable");
|
|
11
|
+
const range_1 = require("./range");
|
|
12
12
|
/**
|
|
13
13
|
* Used by PermutationVector to cache position -\> handle lookups.
|
|
14
14
|
*
|
|
@@ -108,4 +108,4 @@ class HandleCache {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
exports.HandleCache = HandleCache;
|
|
111
|
-
//# sourceMappingURL=handlecache.
|
|
111
|
+
//# sourceMapping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AAM,CACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,CAAC,CAAC,CAChE,CAAC;YACF,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC7C;IACF,CAAC;IAED,0BAA0B;IAE1B,YAAY,CAAC,KAAa,EAAE,YAAoB,EAAE,aAAqB;QACtE,8EAA8E;QAC9E,6EAA6E;QAC7E,aAAa;QACb,EAAE;QACF,4EAA4E;QAC5E,wBAAwB;QACxB,EAAE;QACF,6FAA6F;QAC7F,2EAA2E;QAC3E,EAAE;QACF,gFAAgF;QAEhF,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;SAC5B;IACF,CAAC;CAGD;AAnHD,kCAmHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IVectorConsumer } from \"@tiny-calc/nano\";\nimport { Handle, isHandleValid } from \"./handletable\";\nimport { PermutationVector, PermutationSegment } from \"./permutationvector\";\nimport { ensureRange } from \"./range\";\n\n/**\n * Used by PermutationVector to cache position -\\> handle lookups.\n *\n * Perf: Possibly, this should eventually be inlined into PermutationVector itself, but\n * so far there's no measurable perf penalty for being a separate object (node 12 x64)\n */\nexport class HandleCache implements IVectorConsumer<Handle> {\n\tprivate handles: Handle[] = [];\n\tprivate start = 0;\n\n\tconstructor(public readonly vector: PermutationVector) {}\n\n\t/**\n\t * Returns the index of the given position in the 'handles' array as a Uint32.\n\t * (If the position is not in the array, returns an integer greater than 'handles.length').\n\t */\n\tprivate getIndex(position: number) {\n\t\treturn (position - this.start) >>> 0;\n\t}\n\n\t/**\n\t * Returns the handle currently assigned to the given 'position' (if any). Check\n\t * the result with 'isValidHandle(..)' to see if a handle has been allocated for\n\t * the given position.\n\t *\n\t * Throws a 'RangeError' if the provided 'position' is out-of-bounds wrt. the\n\t * PermutationVector's length.\n\t */\n\tpublic getHandle(position: number) {\n\t\tconst index = this.getIndex(position);\n\n\t\t// Perf: To encourage inlining, handling of the 'cacheMiss(..)' case has been extracted\n\t\t// to a separate method.\n\n\t\t// Perf: A cache hit implies that 'position' was in bounds. Therefore, we can defer\n\t\t// checking that 'position' is in bounds until 'cacheMiss(..)'. This yields an\n\t\t// ~40% speedup when the position is in the cache (node v12 x64).\n\n\t\treturn index < this.handles.length ? this.handles[index] : this.cacheMiss(position);\n\t}\n\n\t/** Update the cache when a handle has been allocated for a given position. */\n\tpublic addHandle(position: number, handle: Handle) {\n\t\tassert(isHandleValid(handle), 0x017 /* \"Trying to add invalid handle!\" */);\n\n\t\tconst index = this.getIndex(position);\n\t\tif (index < this.handles.length) {\n\t\t\tassert(\n\t\t\t\t!isHandleValid(this.handles[index]),\n\t\t\t\t0x018 /* \"Trying to insert handle into position with already valid handle!\" */,\n\t\t\t);\n\t\t\tthis.handles[index] = handle;\n\t\t}\n\t}\n\n\t/** Used by 'CacheMiss()' to retrieve handles for a range of positions. */\n\tprivate getHandles(start: number, end: number) {\n\t\t// TODO: This can be accelerated substantially using 'walkSegments()'. The only catch\n\t\t// is that\n\n\t\tconst handles: Handle[] = [];\n\t\tconst { vector } = this;\n\n\t\tfor (let pos = start; pos < end; pos++) {\n\t\t\tconst { segment, offset } = vector.getContainingSegment(pos);\n\t\t\tconst asPerm = segment as PermutationSegment;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\thandles.push(asPerm.start + offset!);\n\t\t}\n\n\t\treturn handles;\n\t}\n\n\tprivate cacheMiss(position: number) {\n\t\t// Coercing 'position' to an Uint32 allows us to handle a negative 'position' value\n\t\t// with the same logic that handles 'position' >= length.\n\t\tconst _position = position >>> 0;\n\n\t\t// TODO: To bound memory usage, there should be a limit on the maximum size of\n\t\t// handle[].\n\n\t\t// TODO: To reduce MergeTree lookups, this code should opportunistically grow\n\t\t// the cache to the next MergeTree segment boundary (within the limits of\n\t\t// the handle cache).\n\n\t\tif (_position < this.start) {\n\t\t\tthis.handles = this.getHandles(_position, this.start).concat(this.handles);\n\t\t\tthis.start = _position;\n\t\t\treturn this.handles[0];\n\t\t} else {\n\t\t\tensureRange(_position, this.vector.getLength());\n\n\t\t\tthis.handles = this.handles.concat(\n\t\t\t\tthis.getHandles(this.start + this.handles.length, _position + 1),\n\t\t\t);\n\t\t\treturn this.handles[this.handles.length - 1];\n\t\t}\n\t}\n\n\t// #region IVectorConsumer\n\n\titemsChanged(start: number, removedCount: number, insertedCount: number): void {\n\t\t// If positions were inserted/removed, our current policy is to trim the array\n\t\t// at the beginning of the invalidate range and lazily repopulate the handles\n\t\t// on demand.\n\t\t//\n\t\t// Some alternatives to consider that preserve the previously cached handles\n\t\t// that are still valid:\n\t\t//\n\t\t// * Eagerly populate the 'handles[]' with the newly insert values (currently guaranteed\n\t\t// to be Handle.unallocated, so we don't even need to look them up.)\n\t\t//\n\t\t// * Use a sentinel value or other mechanism to allow \"holes\" in the cache.\n\n\t\tconst index = this.getIndex(start);\n\t\tif (index < this.handles.length) {\n\t\t\tthis.handles.length = index;\n\t\t}\n\t}\n\n\t// #endregion IVectorConsumer\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handletable.js","sourceRoot":"","sources":["../src/handletable.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkBI,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,MAAM,wBAAgB,CAAC;AAA3D,QAAA,aAAa,iBAA8C;AAExE;;GAEG;AACH,MAAa,WAAW;IACvB,4FAA4F;IAC5F,2FAA2F;IAC3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AAG,CAAC,MAAc,EAAE,KAAQ;QAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED,wFAAwF;IACxF,uBAAuB;IACvB,IAAY,IAAI;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAW,CAAC;IAClC,CAAC;IACD,IAAY,IAAI,CAAC,MAAc;QAC9B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAC1B,CAAC;IAEM,iBAAiB;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,MAAM,CAAC,IAAI,CAAI,IAAoB;QACzC,OAAO,IAAI,WAAW,CAAI,IAAI,CAAC,CAAC;IACjC,CAAC;CACD;AApFD,kCAoFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport const enum Handle {\n\t/**\n\t * Sentinel representing the absence of a valid handle.\n\t */\n\tnone = 0,\n\n\t/** Minimum valid handle. */\n\tvalid = 1,\n\n\t/**\n\t * Sentinel representing an unallocated Handle. Used by PermutationVector\n\t * to delay allocate handles when previously empty row/cols become populated.\n\t */\n\tunallocated = -0x80000000,\n}\n\nexport const isHandleValid = (handle: Handle) => handle >= Handle.valid;\n\n/**\n * A handle table provides a fast mapping from an integer `handle` to a value `T`.\n */\nexport class HandleTable<T> {\n\t// Note: the first slot of the 'handles' array is reserved to store the pointer to the first\n\t// free handle. We initialize this slot with a pointer to slot '1', which will cause\n\t// us to delay allocate the following slot in the array on the first allocation.\n\tpublic constructor(private readonly handles: (Handle | T)[] = [1]) {}\n\n\tpublic clear() {\n\t\t// Restore the HandleTable's initial state by deleting all items in the handles array\n\t\t// and then re-inserting the value '1' in the 0th slot. (See comment at `handles` decl\n\t\t// for explanation.)\n\t\tthis.handles.splice(0, this.handles.length, 1);\n\t}\n\n\t/**\n\t * Allocates and returns the next available handle. Note that freed handles are recycled.\n\t */\n\tpublic allocate(): Handle {\n\t\t// Get the handle to the next free slot.\n\t\tconst free = this.next;\n\n\t\t// Update 'next' to point to the new head of the free list. We use the contents of\n\t\t// recycled slots to store the free list. The contents of the handles[free] will point\n\t\t// to the next available slot. If there are no free slots (i.e., 'handles' is full),\n\t\t// the slot will point to 'handles.length'. In this case, the handles array will grow\n\t\t// and we update 'next' to point to the new end of the array.\n\t\tthis.next = (this.handles[free] as Handle) ?? free + 1;\n\n\t\t// Out of paranoia, overwrite the contents of the newly allocated free slot with an\n\t\t// invalid handle value. This may help catch/diagnose bugs in the event the free list\n\t\t// becomes corrupted.\n\t\tthis.handles[free] = Handle.none;\n\n\t\treturn free;\n\t}\n\n\t/**\n\t * Allocates and returns the next available `count` handles.\n\t */\n\tpublic allocateMany(count: Handle) {\n\t\tconst handles = new Uint32Array(count);\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\thandles[i] = this.allocate();\n\t\t}\n\t\treturn handles;\n\t}\n\n\t/**\n\t * Returns the given handle to the free list.\n\t */\n\tpublic free(handle: Handle) {\n\t\tthis.handles[handle] = this.next;\n\t\tthis.next = handle;\n\t}\n\n\t/**\n\t * Get the value `T` associated with the given handle, if any.\n\t */\n\tpublic get(handle: Handle): T {\n\t\treturn this.handles[handle] as T;\n\t}\n\n\t/**\n\t * Set the value `T` associated with the given handle.\n\t */\n\tpublic set(handle: Handle, value: T) {\n\t\tthis.handles[handle] = value;\n\t}\n\n\t// Private helpers to get/set the head of the free list, which is stored in the 0th slot\n\t// of the handle array.\n\tprivate get next() {\n\t\treturn this.handles[0] as Handle;\n\t}\n\tprivate set next(handle: Handle) {\n\t\tthis.handles[0] = handle;\n\t}\n\n\tpublic getSummaryContent() {\n\t\treturn this.handles;\n\t}\n\n\tpublic static load<T>(data: (Handle | T)[]) {\n\t\treturn new HandleTable<T>(data);\n\t}\n}\n"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.SharedMatrixFactory = exports.SharedMatrix = void 0;
|
|
8
|
-
var matrix_1 = require("./matrix
|
|
8
|
+
var matrix_1 = require("./matrix");
|
|
9
9
|
Object.defineProperty(exports, "SharedMatrix", { enumerable: true, get: function () { return matrix_1.SharedMatrix; } });
|
|
10
|
-
var runtime_1 = require("./runtime
|
|
10
|
+
var runtime_1 = require("./runtime");
|
|
11
11
|
Object.defineProperty(exports, "SharedMatrixFactory", { enumerable: true, get: function () { return runtime_1.SharedMatrixFactory; } });
|
|
12
|
-
//# sourceMappingURL=index.
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAyE;AAA3C,sGAAA,YAAY,OAAA;AAC1C,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ISharedMatrixEvents, SharedMatrix, MatrixItem } from \"./matrix\";\nexport { SharedMatrixFactory } from \"./runtime\";\n\n// TODO: We temporarily duplicate these contracts from 'framework/undo-redo' to unblock development\n// of SharedMatrix undo while we decide on the correct layering for undo.\nexport { IUndoConsumer, IRevertible } from \"./types\";\n"]}
|
package/dist/matrix-alpha.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
|
16
16
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
17
|
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
18
18
|
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
19
|
-
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @alpha
|
|
@@ -146,7 +145,7 @@ export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEve
|
|
|
146
145
|
* Runs serializer on the GC data for this SharedMatrix.
|
|
147
146
|
* All the IFluidHandle's stored in the cells represent routes to other objects.
|
|
148
147
|
*/
|
|
149
|
-
protected processGCDataCore(serializer:
|
|
148
|
+
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
150
149
|
/**
|
|
151
150
|
* Advances the 'localSeq' counter for the cell data operation currently being queued.
|
|
152
151
|
*
|
package/dist/matrix-beta.d.ts
CHANGED
|
@@ -16,23 +16,6 @@ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
|
16
16
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
17
|
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
18
18
|
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
19
|
-
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
20
|
-
|
|
21
|
-
/* Excluded from this release type: IChannel */
|
|
22
|
-
|
|
23
|
-
/* Excluded from this release type: IChannelAttributes */
|
|
24
|
-
|
|
25
|
-
/* Excluded from this release type: IChannelFactory */
|
|
26
|
-
|
|
27
|
-
/* Excluded from this release type: IChannelServices */
|
|
28
|
-
|
|
29
|
-
/* Excluded from this release type: IChannelStorageService */
|
|
30
|
-
|
|
31
|
-
/* Excluded from this release type: IEventThisPlaceHolder */
|
|
32
|
-
|
|
33
|
-
/* Excluded from this release type: IFluidDataStoreRuntime */
|
|
34
|
-
|
|
35
|
-
/* Excluded from this release type: IFluidSerializer */
|
|
36
19
|
|
|
37
20
|
/* Excluded from this release type: IJSONSegment */
|
|
38
21
|
|
|
@@ -40,10 +23,6 @@ import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
|
40
23
|
|
|
41
24
|
/* Excluded from this release type: ISharedMatrixEvents */
|
|
42
25
|
|
|
43
|
-
/* Excluded from this release type: ISharedObjectEvents */
|
|
44
|
-
|
|
45
|
-
/* Excluded from this release type: ISummaryTreeWithStats */
|
|
46
|
-
|
|
47
26
|
/* Excluded from this release type: IUndoConsumer */
|
|
48
27
|
|
|
49
28
|
/* Excluded from this release type: MatrixItem */
|
|
@@ -54,8 +33,4 @@ import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
|
54
33
|
|
|
55
34
|
/* Excluded from this release type: SharedMatrixFactory */
|
|
56
35
|
|
|
57
|
-
/* Excluded from this release type: SharedObject */
|
|
58
|
-
|
|
59
|
-
/* Excluded from this release type: SummarySerializer */
|
|
60
|
-
|
|
61
36
|
export { }
|
package/dist/matrix-public.d.ts
CHANGED
|
@@ -16,23 +16,6 @@ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
|
16
16
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
17
|
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
18
18
|
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
19
|
-
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
20
|
-
|
|
21
|
-
/* Excluded from this release type: IChannel */
|
|
22
|
-
|
|
23
|
-
/* Excluded from this release type: IChannelAttributes */
|
|
24
|
-
|
|
25
|
-
/* Excluded from this release type: IChannelFactory */
|
|
26
|
-
|
|
27
|
-
/* Excluded from this release type: IChannelServices */
|
|
28
|
-
|
|
29
|
-
/* Excluded from this release type: IChannelStorageService */
|
|
30
|
-
|
|
31
|
-
/* Excluded from this release type: IEventThisPlaceHolder */
|
|
32
|
-
|
|
33
|
-
/* Excluded from this release type: IFluidDataStoreRuntime */
|
|
34
|
-
|
|
35
|
-
/* Excluded from this release type: IFluidSerializer */
|
|
36
19
|
|
|
37
20
|
/* Excluded from this release type: IJSONSegment */
|
|
38
21
|
|
|
@@ -40,10 +23,6 @@ import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
|
40
23
|
|
|
41
24
|
/* Excluded from this release type: ISharedMatrixEvents */
|
|
42
25
|
|
|
43
|
-
/* Excluded from this release type: ISharedObjectEvents */
|
|
44
|
-
|
|
45
|
-
/* Excluded from this release type: ISummaryTreeWithStats */
|
|
46
|
-
|
|
47
26
|
/* Excluded from this release type: IUndoConsumer */
|
|
48
27
|
|
|
49
28
|
/* Excluded from this release type: MatrixItem */
|
|
@@ -54,8 +33,4 @@ import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
|
54
33
|
|
|
55
34
|
/* Excluded from this release type: SharedMatrixFactory */
|
|
56
35
|
|
|
57
|
-
/* Excluded from this release type: SharedObject */
|
|
58
|
-
|
|
59
|
-
/* Excluded from this release type: SummarySerializer */
|
|
60
|
-
|
|
61
36
|
export { }
|
|
@@ -16,7 +16,6 @@ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
|
|
|
16
16
|
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
17
17
|
import { Serializable } from '@fluidframework/datastore-definitions';
|
|
18
18
|
import { SharedObject } from '@fluidframework/shared-object-base';
|
|
19
|
-
import { SummarySerializer } from '@fluidframework/shared-object-base';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @alpha
|
|
@@ -146,7 +145,7 @@ export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEve
|
|
|
146
145
|
* Runs serializer on the GC data for this SharedMatrix.
|
|
147
146
|
* All the IFluidHandle's stored in the cells represent routes to other objects.
|
|
148
147
|
*/
|
|
149
|
-
protected processGCDataCore(serializer:
|
|
148
|
+
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
150
149
|
/**
|
|
151
150
|
* Advances the 'localSeq' counter for the cell data operation currently being queued.
|
|
152
151
|
*
|
package/dist/matrix.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { IEventThisPlaceHolder } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { IFluidDataStoreRuntime, IChannelStorageService, Serializable, IChannelAttributes } from "@fluidframework/datastore-definitions";
|
|
8
|
-
import { IFluidSerializer, ISharedObjectEvents, SharedObject
|
|
8
|
+
import { IFluidSerializer, ISharedObjectEvents, SharedObject } from "@fluidframework/shared-object-base";
|
|
9
9
|
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
|
|
10
10
|
import { IMatrixProducer, IMatrixConsumer, IMatrixReader, IMatrixWriter } from "@tiny-calc/nano";
|
|
11
11
|
import { IJSONSegment } from "@fluidframework/merge-tree";
|
|
@@ -122,7 +122,7 @@ export declare class SharedMatrix<T = any> extends SharedObject<ISharedMatrixEve
|
|
|
122
122
|
* Runs serializer on the GC data for this SharedMatrix.
|
|
123
123
|
* All the IFluidHandle's stored in the cells represent routes to other objects.
|
|
124
124
|
*/
|
|
125
|
-
protected processGCDataCore(serializer:
|
|
125
|
+
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
126
126
|
/**
|
|
127
127
|
* Advances the 'localSeq' counter for the cell data operation currently being queued.
|
|
128
128
|
*
|
package/dist/matrix.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,gBAAgB,EAChB,mBAAmB,EAGnB,YAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"matrix.d.ts","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,kBAAkB,EAClB,MAAM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C,uBAAuB;IAoB/B,SAAS,CAAC,WAAW,CACpB,UAAU,EAAE,yBAAyB,EACrC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO;IAoHzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQzB;IAGF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQzB;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAMnC;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAMnC;IAEF;;;OAGG;IACI,mBAAmB;IAU1B;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAiBrB,QAAQ;IAoBf;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;CA2D/C"}
|
|
@@ -9,14 +9,14 @@ const core_utils_1 = require("@fluidframework/core-utils");
|
|
|
9
9
|
const shared_object_base_1 = require("@fluidframework/shared-object-base");
|
|
10
10
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
11
11
|
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
12
|
-
const ops_1 = require("./ops
|
|
13
|
-
const permutationvector_1 = require("./permutationvector
|
|
14
|
-
const sparsearray2d_1 = require("./sparsearray2d
|
|
15
|
-
const runtime_1 = require("./runtime
|
|
16
|
-
const handletable_1 = require("./handletable
|
|
17
|
-
const serialization_1 = require("./serialization
|
|
18
|
-
const range_1 = require("./range
|
|
19
|
-
const undoprovider_1 = require("./undoprovider
|
|
12
|
+
const ops_1 = require("./ops");
|
|
13
|
+
const permutationvector_1 = require("./permutationvector");
|
|
14
|
+
const sparsearray2d_1 = require("./sparsearray2d");
|
|
15
|
+
const runtime_1 = require("./runtime");
|
|
16
|
+
const handletable_1 = require("./handletable");
|
|
17
|
+
const serialization_1 = require("./serialization");
|
|
18
|
+
const range_1 = require("./range");
|
|
19
|
+
const undoprovider_1 = require("./undoprovider");
|
|
20
20
|
/**
|
|
21
21
|
* A SharedMatrix holds a rectangular 2D array of values. Supported operations
|
|
22
22
|
* include setting values and inserting/removing rows and columns.
|
|
@@ -625,4 +625,4 @@ class SharedMatrix extends shared_object_base_1.SharedObject {
|
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
exports.SharedMatrix = SharedMatrix;
|
|
628
|
-
//# sourceMappingURL=matrix.
|
|
628
|
+
//# sourceMappingURL=matrix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix.js","sourceRoot":"","sources":["../src/matrix.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AASpD,2EAM4C;AAE5C,iEAA2F;AAE3F,2DAOoC;AACpC,+BAAiC;AACjC,2DAAmF;AACnF,mDAAgD;AAChD,uCAAgD;AAChD,+CAAsD;AACtD,mDAAkD;AAClD,mCAAsC;AAEtC,iDAAoD;AA6EpD;;;;;;;;;;;;GAYG;AACH,MAAa,YACZ,SAAQ,iCAAoC;IAQrC,MAAM,CAAC,UAAU;QACvB,OAAO,IAAI,6BAAmB,EAAE,CAAC;IAClC,CAAC;IAeD;;;;;;;OAOG;IACH,YACC,OAA+B,EACxB,EAAU,EACjB,UAA8B,EAC9B,qCAA+C;QAE/C,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;QAJzC,OAAE,GAAF,EAAE,CAAQ;QA7BD,cAAS,GAAG,IAAI,GAAG,EAAkC,CAAC;QAS/D,UAAK,GAAG,IAAI,6BAAa,EAAiB,CAAC,CAAC,sBAAsB;QACzD,YAAO,GAAG,IAAI,6BAAa,EAAU,CAAC,CAAC,yBAAyB;QACzE,yBAAoB,GAAG,IAAI,6BAAa,EAA4B,CAAC,CAAC,6DAA6D;QAGnI,8BAAyB,GAAG,KAAK,CAAC,CAAC,gDAAgD;QAE3F,4DAA4D;QACpD,mBAAc,GAAW,CAAC,CAAC;QAotBnC,sFAAsF;QACrE,eAAU,GAAG,CAC7B,QAAgB,EAChB,YAAoB,EACpB,aAAqB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,CAAC;SAChB;IACF,CAAC;CACD;AA34BD,oCA24BC","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 { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tSerializable,\n\tIChannelAttributes,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\tIFluidSerializer,\n\tISharedObjectEvents,\n\tmakeHandlesSerializable,\n\tparseHandles,\n\tSharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { ObjectStoragePartition, SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { IMatrixProducer, IMatrixConsumer, IMatrixReader, IMatrixWriter } from \"@tiny-calc/nano\";\nimport {\n\tMergeTreeDeltaType,\n\tIMergeTreeOp,\n\tSegmentGroup,\n\t// eslint-disable-next-line import/no-deprecated\n\tClient,\n\tIJSONSegment,\n} from \"@fluidframework/merge-tree\";\nimport { MatrixOp } from \"./ops\";\nimport { PermutationVector, reinsertSegmentIntoVector } from \"./permutationvector\";\nimport { SparseArray2D } from \"./sparsearray2d\";\nimport { SharedMatrixFactory } from \"./runtime\";\nimport { Handle, isHandleValid } from \"./handletable\";\nimport { deserializeBlob } from \"./serialization\";\nimport { ensureRange } from \"./range\";\nimport { IUndoConsumer } from \"./types\";\nimport { MatrixUndoProvider } from \"./undoprovider\";\n\nconst enum SnapshotPath {\n\trows = \"rows\",\n\tcols = \"cols\",\n\tcells = \"cells\",\n}\n\ninterface ISetOp<T> {\n\ttype: MatrixOp.set;\n\trow: number;\n\tcol: number;\n\tvalue: MatrixItem<T>;\n\tfwwMode?: boolean;\n}\n\ninterface ISetOpMetadata {\n\trowHandle: Handle;\n\tcolHandle: Handle;\n\tlocalSeq: number;\n\trowsRefSeq: number;\n\tcolsRefSeq: number;\n\treferenceSeqNumber: number;\n}\n\n/**\n * Events emitted by Shared Matrix.\n * @alpha\n */\nexport interface ISharedMatrixEvents<T> extends ISharedObjectEvents {\n\t/**\n\t * This event is only emitted when the SetCell Resolution Policy is First Write Win(FWW).\n\t * This is emitted when two clients race and send changes without observing each other changes,\n\t * the changes that gets sequenced last would be rejected, and only client who's changes rejected\n\t * would be notified via this event, with expectation that it will merge its changes back by\n\t * accounting new information (state from winner of the race).\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `row` - Row number at which conflict happened.\n\t *\n\t * - `col` - Col number at which conflict happened.\n\t *\n\t * - `currentValue` - The current value of the cell.\n\t *\n\t * - `conflictingValue` - The value that this client tried to set in the cell and got ignored due to conflict.\n\t *\n\t * - `target` - The {@link SharedMatrix} itself.\n\t */\n\t(\n\t\tevent: \"conflict\",\n\t\tlistener: (\n\t\t\trow: number,\n\t\t\tcol: number,\n\t\t\tcurrentValue: MatrixItem<T>,\n\t\t\tconflictingValue: MatrixItem<T>,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t): void;\n}\n\n/**\n * This represents the item which is used to track the client which modified the cell last.\n */\ninterface CellLastWriteTrackerItem {\n\tseqNum: number; // Seq number of op which last modified this cell\n\tclientId: string; // clientId of the client which last modified this cell\n}\n\n/**\n * A matrix cell value may be undefined (indicating an empty cell) or any serializable type,\n * excluding null. (However, nulls may be embedded inside objects and arrays.)\n * @alpha\n */\n// eslint-disable-next-line @rushstack/no-new-null -- Using 'null' to disallow 'null'.\nexport type MatrixItem<T> = Serializable<Exclude<T, null>> | undefined;\n\n/**\n * A SharedMatrix holds a rectangular 2D array of values. Supported operations\n * include setting values and inserting/removing rows and columns.\n *\n * Matrix values may be any Fluid serializable type, which is the set of JSON\n * serializable types extended to include IFluidHandles.\n *\n * Fluid's SharedMatrix implementation works equally well for dense and sparse\n * matrix data and physically stores data in Z-order to leverage CPU caches and\n * prefetching when reading in either row or column major order. (See README.md\n * for more details.)\n * @alpha\n */\nexport class SharedMatrix<T = any>\n\textends SharedObject<ISharedMatrixEvents<T>>\n\timplements\n\t\tIMatrixProducer<MatrixItem<T>>,\n\t\tIMatrixReader<MatrixItem<T>>,\n\t\tIMatrixWriter<MatrixItem<T>>\n{\n\tprivate readonly consumers = new Set<IMatrixConsumer<MatrixItem<T>>>();\n\n\tpublic static getFactory() {\n\t\treturn new SharedMatrixFactory();\n\t}\n\n\tprivate readonly rows: PermutationVector; // Map logical row to storage handle (if any)\n\tprivate readonly cols: PermutationVector; // Map logical col to storage handle (if any)\n\n\tprivate cells = new SparseArray2D<MatrixItem<T>>(); // Stores cell values.\n\tprivate readonly pending = new SparseArray2D<number>(); // Tracks pending writes.\n\tprivate cellLastWriteTracker = new SparseArray2D<CellLastWriteTrackerItem>(); // Tracks last writes sequence number and clientId in a cell.\n\t// Tracks the seq number of Op at which policy switch happens from Last Write Win to First Write Win.\n\tprivate setCellLwwToFwwPolicySwitchOpSeqNumber: number;\n\tprivate userSwitchedSetCellPolicy = false; // Set to true when the user calls switchPolicy.\n\n\t// Used to track if there is any reentrancy in setCell code.\n\tprivate reentrantCount: number = 0;\n\n\t/**\n\t * Constructor for the Shared Matrix\n\t * @param runtime - DataStore runtime.\n\t * @param id - id of the dds\n\t * @param attributes - channel attributes\n\t * @param _isSetCellConflictResolutionPolicyFWW - Conflict resolution for Matrix set op is First Writer Win in case of\n\t * race condition. Client can still overwrite values in case of no race.\n\t */\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t\t_isSetCellConflictResolutionPolicyFWW?: boolean,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_matrix_\");\n\n\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber =\n\t\t\t_isSetCellConflictResolutionPolicyFWW === true ? 0 : -1;\n\t\tthis.rows = new PermutationVector(\n\t\t\tSnapshotPath.rows,\n\t\t\tthis.logger,\n\t\t\truntime,\n\t\t\tthis.onRowDelta,\n\t\t\tthis.onRowHandlesRecycled,\n\t\t);\n\n\t\tthis.cols = new PermutationVector(\n\t\t\tSnapshotPath.cols,\n\t\t\tthis.logger,\n\t\t\truntime,\n\t\t\tthis.onColDelta,\n\t\t\tthis.onColHandlesRecycled,\n\t\t);\n\t}\n\n\tprivate undo?: MatrixUndoProvider<T>;\n\n\t/**\n\t * Subscribes the given IUndoConsumer to the matrix.\n\t */\n\tpublic openUndo(consumer: IUndoConsumer) {\n\t\tassert(\n\t\t\tthis.undo === undefined,\n\t\t\t0x019 /* \"SharedMatrix.openUndo() supports at most a single IUndoConsumer.\" */,\n\t\t);\n\n\t\tthis.undo = new MatrixUndoProvider(consumer, this, this.rows, this.cols);\n\t}\n\n\t// TODO: closeUndo()?\n\n\tprivate get rowHandles() {\n\t\treturn this.rows.handleCache;\n\t}\n\tprivate get colHandles() {\n\t\treturn this.cols.handleCache;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(id, SharedMatrixFactory.Type) as SharedMatrix<T>;\n\t}\n\n\t// #region IMatrixProducer\n\n\topenMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): IMatrixReader<MatrixItem<T>> {\n\t\tthis.consumers.add(consumer);\n\t\treturn this;\n\t}\n\n\tcloseMatrix(consumer: IMatrixConsumer<MatrixItem<T>>): void {\n\t\tthis.consumers.delete(consumer);\n\t}\n\n\t// #endregion IMatrixProducer\n\n\t// #region IMatrixReader\n\n\tpublic get rowCount() {\n\t\treturn this.rows.getLength();\n\t}\n\tpublic get colCount() {\n\t\treturn this.cols.getLength();\n\t}\n\n\tpublic isSetCellConflictResolutionPolicyFWW() {\n\t\treturn this.setCellLwwToFwwPolicySwitchOpSeqNumber > -1 || this.userSwitchedSetCellPolicy;\n\t}\n\n\tpublic getCell(row: number, col: number): MatrixItem<T> {\n\t\t// Perf: When possible, bounds checking is performed inside the implementation for\n\t\t// 'getHandle()' so that it can be elided in the case of a cache hit. This\n\t\t// yields an ~40% improvement in the case of a cache hit (node v12 x64)\n\n\t\t// Map the logical (row, col) to associated storage handles.\n\t\tconst rowHandle = this.rowHandles.getHandle(row);\n\t\tif (isHandleValid(rowHandle)) {\n\t\t\tconst colHandle = this.colHandles.getHandle(col);\n\t\t\tif (isHandleValid(colHandle)) {\n\t\t\t\treturn this.cells.getCell(rowHandle, colHandle);\n\t\t\t}\n\t\t} else {\n\t\t\t// If we early exit because the given rowHandle is unallocated, we still need to\n\t\t\t// bounds-check the 'col' parameter.\n\t\t\tensureRange(col, this.cols.getLength());\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tpublic get matrixProducer(): IMatrixProducer<MatrixItem<T>> {\n\t\treturn this;\n\t}\n\n\t// #endregion IMatrixReader\n\n\tpublic setCell(row: number, col: number, value: MatrixItem<T>) {\n\t\tassert(\n\t\t\t0 <= row && row < this.rowCount && 0 <= col && col < this.colCount,\n\t\t\t0x01a /* \"Trying to set out-of-bounds cell!\" */,\n\t\t);\n\n\t\tthis.setCellCore(row, col, value);\n\t}\n\n\tpublic setCells(\n\t\trowStart: number,\n\t\tcolStart: number,\n\t\tcolCount: number,\n\t\tvalues: readonly MatrixItem<T>[],\n\t) {\n\t\tconst rowCount = Math.ceil(values.length / colCount);\n\n\t\tassert(\n\t\t\t0 <= rowStart &&\n\t\t\t\trowStart < this.rowCount &&\n\t\t\t\t0 <= colStart &&\n\t\t\t\tcolStart < this.colCount &&\n\t\t\t\t1 <= colCount &&\n\t\t\t\tcolCount <= this.colCount - colStart &&\n\t\t\t\trowCount <= this.rowCount - rowStart,\n\t\t\t0x01b /* \"Trying to set multiple out-of-bounds cells!\" */,\n\t\t);\n\n\t\tconst endCol = colStart + colCount;\n\t\tlet r = rowStart;\n\t\tlet c = colStart;\n\n\t\tfor (const value of values) {\n\t\t\tthis.setCellCore(r, c, value);\n\n\t\t\tif (++c === endCol) {\n\t\t\t\tc = colStart;\n\t\t\t\tr++;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate setCellCore(\n\t\trow: number,\n\t\tcol: number,\n\t\tvalue: MatrixItem<T>,\n\t\trowHandle = this.rows.getAllocatedHandle(row),\n\t\tcolHandle = this.cols.getAllocatedHandle(col),\n\t) {\n\t\tthis.protectAgainstReentrancy(() => {\n\t\t\tif (this.undo !== undefined) {\n\t\t\t\tlet oldValue = this.cells.getCell(rowHandle, colHandle);\n\t\t\t\tif (oldValue === null) {\n\t\t\t\t\toldValue = undefined;\n\t\t\t\t}\n\n\t\t\t\tthis.undo.cellSet(rowHandle, colHandle, oldValue);\n\t\t\t}\n\n\t\t\tthis.cells.setCell(rowHandle, colHandle, value);\n\n\t\t\tif (this.isAttached()) {\n\t\t\t\tthis.sendSetCellOp(row, col, value, rowHandle, colHandle);\n\t\t\t}\n\n\t\t\t// Avoid reentrancy by raising change notifications after the op is queued.\n\t\t\tfor (const consumer of this.consumers.values()) {\n\t\t\t\tconsumer.cellsChanged(row, col, 1, 1, this);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate sendSetCellOp(\n\t\trow: number,\n\t\tcol: number,\n\t\tvalue: MatrixItem<T>,\n\t\trowHandle: Handle,\n\t\tcolHandle: Handle,\n\t\tlocalSeq = this.nextLocalSeq(),\n\t\trowsRefSeq = this.rows.getCollabWindow().currentSeq,\n\t\tcolsRefSeq = this.cols.getCollabWindow().currentSeq,\n\t) {\n\t\tassert(\n\t\t\tthis.isAttached(),\n\t\t\t0x1e2 /* \"Caller must ensure 'isAttached()' before calling 'sendSetCellOp'.\" */,\n\t\t);\n\n\t\tconst op: ISetOp<T> = {\n\t\t\ttype: MatrixOp.set,\n\t\t\trow,\n\t\t\tcol,\n\t\t\tvalue,\n\t\t\tfwwMode:\n\t\t\t\tthis.userSwitchedSetCellPolicy || this.setCellLwwToFwwPolicySwitchOpSeqNumber > -1,\n\t\t};\n\n\t\tconst metadata: ISetOpMetadata = {\n\t\t\trowHandle,\n\t\t\tcolHandle,\n\t\t\tlocalSeq,\n\t\t\trowsRefSeq,\n\t\t\tcolsRefSeq,\n\t\t\treferenceSeqNumber: this.runtime.deltaManager.lastSequenceNumber,\n\t\t};\n\n\t\tthis.submitLocalMessage(op, metadata);\n\t\tthis.pending.setCell(rowHandle, colHandle, localSeq);\n\t}\n\n\t/**\n\t * This makes sure that the code inside the callback is not reentrant. We need to do that because we raise notifications\n\t * to the consumers telling about these changes and they can try to change the matrix while listening to those notifications\n\t * which can make the shared matrix to be in bad state. For example, we are raising notification for a setCell changes and\n\t * a consumer tries to delete that row/col on receiving that notification which can lead to this matrix trying to setCell in\n\t * a deleted row/col.\n\t * @param callback - code that needs to protected against reentrancy.\n\t */\n\tprivate protectAgainstReentrancy(callback: () => void) {\n\t\tassert(this.reentrantCount === 0, 0x85d /* reentrant code */);\n\t\tthis.reentrantCount++;\n\t\tcallback();\n\t\tthis.reentrantCount--;\n\t\tassert(this.reentrantCount === 0, 0x85e /* reentrant code on exit */);\n\t}\n\n\tprivate submitVectorMessage(\n\t\tcurrentVector: PermutationVector,\n\t\toppositeVector: PermutationVector,\n\t\tdimension: SnapshotPath.rows | SnapshotPath.cols,\n\t\tmessage: any,\n\t) {\n\t\t// Ideally, we would have a single 'localSeq' counter that is shared between both PermutationVectors\n\t\t// and the SharedMatrix's cell data. Instead, we externally advance each MergeTree's 'localSeq' counter\n\t\t// for each submitted op it not aware of to keep them synchronized.\n\t\tconst localSeq = currentVector.getCollabWindow().localSeq;\n\t\tconst oppositeWindow = oppositeVector.getCollabWindow();\n\n\t\t// Note that the comparison is '>=' because, in the case the MergeTree is regenerating ops for reconnection,\n\t\t// the MergeTree submits the op with the original 'localSeq'.\n\t\tassert(\n\t\t\tlocalSeq >= oppositeWindow.localSeq,\n\t\t\t0x01c /* \"The 'localSeq' of the vector submitting an op must >= the 'localSeq' of the other vector.\" */,\n\t\t);\n\n\t\toppositeWindow.localSeq = localSeq;\n\n\t\t// If the SharedMatrix is local, it's state will be submitted via a Snapshot when initially connected.\n\t\t// Do not queue a message or track the pending op, as there will never be an ACK, etc.\n\t\tif (this.isAttached()) {\n\t\t\t// Record whether this `op` targets rows or cols. (See dispatch in `processCore()`)\n\t\t\tmessage.target = dimension;\n\n\t\t\tthis.submitLocalMessage(\n\t\t\t\tmessage,\n\t\t\t\tcurrentVector.peekPendingSegmentGroups(\n\t\t\t\t\tmessage.type === MergeTreeDeltaType.GROUP ? message.ops.length : 1,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate submitColMessage(message: any) {\n\t\tthis.submitVectorMessage(this.cols, this.rows, SnapshotPath.cols, message);\n\t}\n\n\tpublic insertCols(colStart: number, count: number) {\n\t\tthis.protectAgainstReentrancy(() =>\n\t\t\tthis.submitColMessage(this.cols.insert(colStart, count)),\n\t\t);\n\t}\n\n\tpublic removeCols(colStart: number, count: number) {\n\t\tthis.protectAgainstReentrancy(() =>\n\t\t\tthis.submitColMessage(this.cols.remove(colStart, count)),\n\t\t);\n\t}\n\n\tprivate submitRowMessage(message: any) {\n\t\tthis.submitVectorMessage(this.rows, this.cols, SnapshotPath.rows, message);\n\t}\n\n\tpublic insertRows(rowStart: number, count: number) {\n\t\tthis.protectAgainstReentrancy(() =>\n\t\t\tthis.submitRowMessage(this.rows.insert(rowStart, count)),\n\t\t);\n\t}\n\n\tpublic removeRows(rowStart: number, count: number) {\n\t\tthis.protectAgainstReentrancy(() =>\n\t\t\tthis.submitRowMessage(this.rows.remove(rowStart, count)),\n\t\t);\n\t}\n\n\t/***/ public _undoRemoveRows(rowStart: number, spec: IJSONSegment) {\n\t\tconst { op, inserted } = reinsertSegmentIntoVector(this.rows, rowStart, spec);\n\t\tthis.submitRowMessage(op);\n\n\t\t// Generate setCell ops for each populated cell in the reinserted rows.\n\t\tlet rowHandle = inserted.start;\n\t\tconst rowCount = inserted.cachedLength;\n\t\tfor (let row = rowStart; row < rowStart + rowCount; row++, rowHandle++) {\n\t\t\tfor (let col = 0; col < this.colCount; col++) {\n\t\t\t\tconst colHandle = this.colHandles.getHandle(col);\n\t\t\t\tconst value = this.cells.getCell(rowHandle, colHandle);\n\t\t\t\tif (this.isAttached() && value !== undefined && value !== null) {\n\t\t\t\t\tthis.sendSetCellOp(row, col, value, rowHandle, colHandle);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Avoid reentrancy by raising change notifications after the op is queued.\n\t\tfor (const consumer of this.consumers.values()) {\n\t\t\tconsumer.cellsChanged(rowStart, /* colStart: */ 0, rowCount, this.colCount, this);\n\t\t}\n\t}\n\n\t/***/ public _undoRemoveCols(colStart: number, spec: IJSONSegment) {\n\t\tconst { op, inserted } = reinsertSegmentIntoVector(this.cols, colStart, spec);\n\t\tthis.submitColMessage(op);\n\n\t\t// Generate setCell ops for each populated cell in the reinserted cols.\n\t\tlet colHandle = inserted.start;\n\t\tconst colCount = inserted.cachedLength;\n\t\tfor (let col = colStart; col < colStart + colCount; col++, colHandle++) {\n\t\t\tfor (let row = 0; row < this.rowCount; row++) {\n\t\t\t\tconst rowHandle = this.rowHandles.getHandle(row);\n\t\t\t\tconst value = this.cells.getCell(rowHandle, colHandle);\n\t\t\t\tif (this.isAttached() && value !== undefined && value !== null) {\n\t\t\t\t\tthis.sendSetCellOp(row, col, value, rowHandle, colHandle);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Avoid reentrancy by raising change notifications after the op is queued.\n\t\tfor (const consumer of this.consumers.values()) {\n\t\t\tconsumer.cellsChanged(/* rowStart: */ 0, colStart, this.rowCount, colCount, this);\n\t\t}\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tbuilder.addWithStats(\n\t\t\tSnapshotPath.rows,\n\t\t\tthis.rows.summarize(this.runtime, this.handle, serializer),\n\t\t);\n\t\tbuilder.addWithStats(\n\t\t\tSnapshotPath.cols,\n\t\t\tthis.cols.summarize(this.runtime, this.handle, serializer),\n\t\t);\n\t\tconst artifactsToSummarize = [\n\t\t\tthis.cells.snapshot(),\n\t\t\tthis.pending.snapshot(),\n\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber,\n\t\t];\n\n\t\t// Only need to store it in the snapshot if we have switched the policy already.\n\t\tif (this.setCellLwwToFwwPolicySwitchOpSeqNumber > -1) {\n\t\t\tartifactsToSummarize.push(this.cellLastWriteTracker.snapshot());\n\t\t}\n\t\tbuilder.addBlob(\n\t\t\tSnapshotPath.cells,\n\t\t\tserializer.stringify(artifactsToSummarize, this.handle),\n\t\t);\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * Runs serializer on the GC data for this SharedMatrix.\n\t * All the IFluidHandle's stored in the cells represent routes to other objects.\n\t */\n\tprotected processGCDataCore(serializer: IFluidSerializer) {\n\t\tfor (let row = 0; row < this.rowCount; row++) {\n\t\t\tfor (let col = 0; col < this.colCount; col++) {\n\t\t\t\tserializer.stringify(this.getCell(row, col), this.handle);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Advances the 'localSeq' counter for the cell data operation currently being queued.\n\t *\n\t * Do not use with 'submitColMessage()/submitRowMessage()' as these helpers + the MergeTree will\n\t * automatically advance 'localSeq'.\n\t */\n\tprivate nextLocalSeq() {\n\t\t// Ideally, we would have a single 'localSeq' counter that is shared between both PermutationVectors\n\t\t// and the SharedMatrix's cell data. Instead, we externally bump each MergeTree's 'localSeq' counter\n\t\t// for SharedMatrix ops it's not aware of to keep them synchronized. (For cell data operations, we\n\t\t// need to bump both counters.)\n\n\t\tthis.cols.getCollabWindow().localSeq++;\n\t\treturn ++this.rows.getCollabWindow().localSeq;\n\t}\n\n\tprotected submitLocalMessage(message: any, localOpMetadata?: any) {\n\t\t// TODO: Recommend moving this assertion into SharedObject\n\t\t// (See https://github.com/microsoft/FluidFramework/issues/2559)\n\t\tassert(\n\t\t\tthis.isAttached() === true,\n\t\t\t0x01d /* \"Trying to submit message to runtime while detached!\" */,\n\t\t);\n\n\t\tsuper.submitLocalMessage(\n\t\t\tmakeHandlesSerializable(message, this.serializer, this.handle),\n\t\t\tlocalOpMetadata,\n\t\t);\n\n\t\t// Ensure that row/col 'localSeq' are synchronized (see 'nextLocalSeq()').\n\t\tassert(\n\t\t\tthis.rows.getCollabWindow().localSeq === this.cols.getCollabWindow().localSeq,\n\t\t\t0x01e /* \"Row and col collab window 'localSeq' desynchronized!\" */,\n\t\t);\n\t}\n\n\tprotected didAttach() {\n\t\t// We've attached we need to start generating and sending ops.\n\t\t// so start collaboration and provide a default client id incase we are not connected\n\t\tif (this.isAttached()) {\n\t\t\tthis.rows.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t\tthis.cols.startOrUpdateCollaboration(this.runtime.clientId ?? \"attached\");\n\t\t}\n\t}\n\n\tprotected onConnect() {\n\t\tassert(\n\t\t\tthis.rows.getCollabWindow().collaborating === this.cols.getCollabWindow().collaborating,\n\t\t\t0x01f /* \"Row and col collab window 'collaborating' status desynchronized!\" */,\n\t\t);\n\n\t\t// Update merge tree collaboration information with new client ID and then resend pending ops\n\t\tthis.rows.startOrUpdateCollaboration(this.runtime.clientId as string);\n\t\tthis.cols.startOrUpdateCollaboration(this.runtime.clientId as string);\n\t}\n\n\tprivate rebasePosition(\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tclient: Client,\n\t\tpos: number,\n\t\treferenceSequenceNumber: number,\n\t\tlocalSeq: number,\n\t): number | undefined {\n\t\tconst { clientId } = client.getCollabWindow();\n\t\tconst { segment, offset } = client.getContainingSegment(\n\t\t\tpos,\n\t\t\t{ referenceSequenceNumber, clientId: client.getLongClientId(clientId) },\n\t\t\tlocalSeq,\n\t\t);\n\t\tif (segment === undefined || offset === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn client.findReconnectionPosition(segment, localSeq) + offset;\n\t}\n\n\tprotected reSubmitCore(content: any, localOpMetadata: unknown) {\n\t\tswitch (content.target) {\n\t\t\tcase SnapshotPath.cols:\n\t\t\t\tthis.submitColMessage(\n\t\t\t\t\tthis.cols.regeneratePendingOp(\n\t\t\t\t\t\tcontent as IMergeTreeOp,\n\t\t\t\t\t\tlocalOpMetadata as SegmentGroup | SegmentGroup[],\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase SnapshotPath.rows:\n\t\t\t\tthis.submitRowMessage(\n\t\t\t\t\tthis.rows.regeneratePendingOp(\n\t\t\t\t\t\tcontent as IMergeTreeOp,\n\t\t\t\t\t\tlocalOpMetadata as SegmentGroup | SegmentGroup[],\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault: {\n\t\t\t\tassert(\n\t\t\t\t\tcontent.type === MatrixOp.set,\n\t\t\t\t\t0x020 /* \"Unknown SharedMatrix 'op' type.\" */,\n\t\t\t\t);\n\n\t\t\t\tconst setOp = content as ISetOp<T>;\n\t\t\t\tconst {\n\t\t\t\t\trowHandle,\n\t\t\t\t\tcolHandle,\n\t\t\t\t\tlocalSeq,\n\t\t\t\t\trowsRefSeq,\n\t\t\t\t\tcolsRefSeq,\n\t\t\t\t\treferenceSeqNumber,\n\t\t\t\t} = localOpMetadata as ISetOpMetadata;\n\n\t\t\t\t// If after rebasing the op, we get a valid row/col number, that means the row/col\n\t\t\t\t// handles have not been recycled and we can safely use them.\n\t\t\t\tconst row = this.rebasePosition(this.rows, setOp.row, rowsRefSeq, localSeq);\n\t\t\t\tconst col = this.rebasePosition(this.cols, setOp.col, colsRefSeq, localSeq);\n\t\t\t\tif (row !== undefined && col !== undefined && row >= 0 && col >= 0) {\n\t\t\t\t\tconst lastCellModificationDetails = this.cellLastWriteTracker.getCell(\n\t\t\t\t\t\trowHandle,\n\t\t\t\t\t\tcolHandle,\n\t\t\t\t\t);\n\t\t\t\t\t// If the mode is LWW, then send the op.\n\t\t\t\t\t// Otherwise if the current mode is FWW and if we generated this op, after seeing the\n\t\t\t\t\t// last set op, or it is the first set op for the cell, then regenerate the op,\n\t\t\t\t\t// otherwise raise conflict. We want to check the current mode here and not that\n\t\t\t\t\t// whether op was made in FWW or not.\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber === -1 ||\n\t\t\t\t\t\tlastCellModificationDetails === undefined ||\n\t\t\t\t\t\treferenceSeqNumber >= lastCellModificationDetails.seqNum\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.sendSetCellOp(\n\t\t\t\t\t\t\trow,\n\t\t\t\t\t\t\tcol,\n\t\t\t\t\t\t\tsetOp.value,\n\t\t\t\t\t\t\trowHandle,\n\t\t\t\t\t\t\tcolHandle,\n\t\t\t\t\t\t\tlocalSeq,\n\t\t\t\t\t\t\trowsRefSeq,\n\t\t\t\t\t\t\tcolsRefSeq,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (this.pending.getCell(rowHandle, colHandle) !== undefined) {\n\t\t\t\t\t\t// Clear the pending changes if any as we are not sending the op.\n\t\t\t\t\t\tthis.pending.setCell(rowHandle, colHandle, undefined);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\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\ttry {\n\t\t\tawait this.rows.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, SnapshotPath.rows),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\t\t\tawait this.cols.load(\n\t\t\t\tthis.runtime,\n\t\t\t\tnew ObjectStoragePartition(storage, SnapshotPath.cols),\n\t\t\t\tthis.serializer,\n\t\t\t);\n\t\t\tconst [\n\t\t\t\tcellData,\n\t\t\t\t_pendingCliSeqData,\n\t\t\t\tsetCellLwwToFwwPolicySwitchOpSeqNumber,\n\t\t\t\tcellLastWriteTracker,\n\t\t\t] = await deserializeBlob(storage, SnapshotPath.cells, this.serializer);\n\n\t\t\tthis.cells = SparseArray2D.load(cellData);\n\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber =\n\t\t\t\tsetCellLwwToFwwPolicySwitchOpSeqNumber ?? -1;\n\t\t\tif (cellLastWriteTracker !== undefined) {\n\t\t\t\tthis.cellLastWriteTracker = SparseArray2D.load(cellLastWriteTracker);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"MatrixLoadFailed\" }, error);\n\t\t}\n\t}\n\n\t/**\n\t * Tells whether the setCell op should be applied or not based on First Write Win policy. It assumes\n\t * we are in FWW mode.\n\t */\n\tprivate shouldSetCellBasedOnFWW(\n\t\trowHandle: Handle,\n\t\tcolHandle: Handle,\n\t\tmessage: ISequencedDocumentMessage,\n\t) {\n\t\tassert(\n\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber > -1,\n\t\t\t0x85f /* should be in Fww mode when calling this method */,\n\t\t);\n\t\tassert(message.clientId !== null, 0x860 /* clientId should not be null */);\n\t\tconst lastCellModificationDetails = this.cellLastWriteTracker.getCell(rowHandle, colHandle);\n\t\t// If someone tried to Overwrite the cell value or first write on this cell or\n\t\t// same client tried to modify the cell.\n\t\treturn (\n\t\t\tlastCellModificationDetails === undefined ||\n\t\t\tlastCellModificationDetails.clientId === message.clientId ||\n\t\t\tmessage.referenceSequenceNumber >= lastCellModificationDetails.seqNum\n\t\t);\n\t}\n\n\tprotected processCore(\n\t\trawMessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tconst msg = parseHandles(rawMessage, this.serializer);\n\n\t\tconst contents = msg.contents;\n\n\t\tswitch (contents.target) {\n\t\t\tcase SnapshotPath.cols:\n\t\t\t\tthis.cols.applyMsg(msg, local);\n\t\t\t\tbreak;\n\t\t\tcase SnapshotPath.rows:\n\t\t\t\tthis.rows.applyMsg(msg, local);\n\t\t\t\tbreak;\n\t\t\tdefault: {\n\t\t\t\tassert(\n\t\t\t\t\tcontents.type === MatrixOp.set,\n\t\t\t\t\t0x021 /* \"SharedMatrix message contents have unexpected type!\" */,\n\t\t\t\t);\n\n\t\t\t\tconst { row, col, value, fwwMode } = contents;\n\t\t\t\tconst isPreviousSetCellPolicyModeFWW =\n\t\t\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber > -1;\n\t\t\t\t// If this is the first op notifying us of the policy change, then set the policy change seq number.\n\t\t\t\tif (this.setCellLwwToFwwPolicySwitchOpSeqNumber === -1 && fwwMode === true) {\n\t\t\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber = rawMessage.sequenceNumber;\n\t\t\t\t}\n\n\t\t\t\tassert(rawMessage.clientId !== null, 0x861 /* clientId should not be null!! */);\n\t\t\t\tif (local) {\n\t\t\t\t\t// We are receiving the ACK for a local pending set operation.\n\t\t\t\t\tconst { rowHandle, colHandle, localSeq } = localOpMetadata as ISetOpMetadata;\n\t\t\t\t\tconst isLatestPendingOp = this.isLatestPendingWrite(\n\t\t\t\t\t\trowHandle,\n\t\t\t\t\t\tcolHandle,\n\t\t\t\t\t\tlocalSeq,\n\t\t\t\t\t);\n\t\t\t\t\t// If policy is switched and cell should be modified too based on policy, then update the tracker.\n\t\t\t\t\t// If policy is not switched, then also update the tracker in case it is the latest.\n\t\t\t\t\tif (\n\t\t\t\t\t\t(this.setCellLwwToFwwPolicySwitchOpSeqNumber > -1 &&\n\t\t\t\t\t\t\tthis.shouldSetCellBasedOnFWW(rowHandle, colHandle, rawMessage)) ||\n\t\t\t\t\t\t(this.setCellLwwToFwwPolicySwitchOpSeqNumber === -1 && isLatestPendingOp)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.cellLastWriteTracker.setCell(rowHandle, colHandle, {\n\t\t\t\t\t\t\tseqNum: rawMessage.sequenceNumber,\n\t\t\t\t\t\t\tclientId: rawMessage.clientId,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isLatestPendingOp) {\n\t\t\t\t\t\tthis.pending.setCell(rowHandle, colHandle, undefined);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst adjustedRow = this.rows.adjustPosition(row, rawMessage);\n\t\t\t\t\tif (adjustedRow !== undefined) {\n\t\t\t\t\t\tconst adjustedCol = this.cols.adjustPosition(col, rawMessage);\n\n\t\t\t\t\t\tif (adjustedCol !== undefined) {\n\t\t\t\t\t\t\tconst rowHandle = this.rows.getAllocatedHandle(adjustedRow);\n\t\t\t\t\t\t\tconst colHandle = this.cols.getAllocatedHandle(adjustedCol);\n\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tisHandleValid(rowHandle) && isHandleValid(colHandle),\n\t\t\t\t\t\t\t\t0x022 /* \"SharedMatrix row and/or col handles are invalid!\" */,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (this.setCellLwwToFwwPolicySwitchOpSeqNumber > -1) {\n\t\t\t\t\t\t\t\t// If someone tried to Overwrite the cell value or first write on this cell or\n\t\t\t\t\t\t\t\t// same client tried to modify the cell or if the previous mode was LWW, then we need to still\n\t\t\t\t\t\t\t\t// overwrite the cell and raise conflict if we have pending changes as our change is going to be lost.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t!isPreviousSetCellPolicyModeFWW ||\n\t\t\t\t\t\t\t\t\tthis.shouldSetCellBasedOnFWW(rowHandle, colHandle, rawMessage)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tconst previousValue = this.cells.getCell(rowHandle, colHandle);\n\t\t\t\t\t\t\t\t\tthis.cells.setCell(rowHandle, colHandle, value);\n\t\t\t\t\t\t\t\t\tthis.cellLastWriteTracker.setCell(rowHandle, colHandle, {\n\t\t\t\t\t\t\t\t\t\tseqNum: rawMessage.sequenceNumber,\n\t\t\t\t\t\t\t\t\t\tclientId: rawMessage.clientId,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tfor (const consumer of this.consumers.values()) {\n\t\t\t\t\t\t\t\t\t\tconsumer.cellsChanged(adjustedRow, adjustedCol, 1, 1, this);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Check is there are any pending changes, which will be rejected. If so raise conflict.\n\t\t\t\t\t\t\t\t\tif (this.pending.getCell(rowHandle, colHandle) !== undefined) {\n\t\t\t\t\t\t\t\t\t\t// Don't reset the pending value yet, as there maybe more fww op from same client, so we want\n\t\t\t\t\t\t\t\t\t\t// to raise conflict event for that op also.\n\t\t\t\t\t\t\t\t\t\tthis.emit(\n\t\t\t\t\t\t\t\t\t\t\t\"conflict\",\n\t\t\t\t\t\t\t\t\t\t\trow,\n\t\t\t\t\t\t\t\t\t\t\tcol,\n\t\t\t\t\t\t\t\t\t\t\tvalue, // Current value\n\t\t\t\t\t\t\t\t\t\t\tpreviousValue, // Ignored local value\n\t\t\t\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (this.pending.getCell(rowHandle, colHandle) === undefined) {\n\t\t\t\t\t\t\t\t// If there is a pending (unACKed) local write to the same cell, skip the current op\n\t\t\t\t\t\t\t\t// since it \"happened before\" the pending write.\n\t\t\t\t\t\t\t\tthis.cells.setCell(rowHandle, colHandle, value);\n\t\t\t\t\t\t\t\tthis.cellLastWriteTracker.setCell(rowHandle, colHandle, {\n\t\t\t\t\t\t\t\t\tseqNum: rawMessage.sequenceNumber,\n\t\t\t\t\t\t\t\t\tclientId: rawMessage.clientId,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tfor (const consumer of this.consumers.values()) {\n\t\t\t\t\t\t\t\t\tconsumer.cellsChanged(adjustedRow, adjustedCol, 1, 1, this);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Invoked by PermutationVector to notify IMatrixConsumers of row insertion/deletions.\n\tprivate readonly onRowDelta = (\n\t\tposition: number,\n\t\tremovedCount: number,\n\t\tinsertedCount: number,\n\t) => {\n\t\tfor (const consumer of this.consumers) {\n\t\t\tconsumer.rowsChanged(position, removedCount, insertedCount, this);\n\t\t}\n\t};\n\n\t// Invoked by PermutationVector to notify IMatrixConsumers of col insertion/deletions.\n\tprivate readonly onColDelta = (\n\t\tposition: number,\n\t\tremovedCount: number,\n\t\tinsertedCount: number,\n\t) => {\n\t\tfor (const consumer of this.consumers) {\n\t\t\tconsumer.colsChanged(position, removedCount, insertedCount, this);\n\t\t}\n\t};\n\n\tprivate readonly onRowHandlesRecycled = (rowHandles: Handle[]) => {\n\t\tfor (const rowHandle of rowHandles) {\n\t\t\tthis.cells.clearRows(/* rowStart: */ rowHandle, /* rowCount: */ 1);\n\t\t\tthis.pending.clearRows(/* rowStart: */ rowHandle, /* rowCount: */ 1);\n\t\t\tthis.cellLastWriteTracker.clearRows(/* rowStart: */ rowHandle, /* rowCount: */ 1);\n\t\t}\n\t};\n\n\tprivate readonly onColHandlesRecycled = (colHandles: Handle[]) => {\n\t\tfor (const colHandle of colHandles) {\n\t\t\tthis.cells.clearCols(/* colStart: */ colHandle, /* colCount: */ 1);\n\t\t\tthis.pending.clearCols(/* colStart: */ colHandle, /* colCount: */ 1);\n\t\t\tthis.cellLastWriteTracker.clearCols(/* colStart: */ colHandle, /* colCount: */ 1);\n\t\t}\n\t};\n\n\t/**\n\t * Api to switch Set Op policy from Last Writer Win to First Writer Win. It only switches from LWW to FWW\n\t * and not from FWW to LWW. The next SetOp which is sent will communicate this policy to other clients.\n\t */\n\tpublic switchSetCellPolicy() {\n\t\tif (this.setCellLwwToFwwPolicySwitchOpSeqNumber === -1) {\n\t\t\tif (this.isAttached()) {\n\t\t\t\tthis.userSwitchedSetCellPolicy = true;\n\t\t\t} else {\n\t\t\t\tthis.setCellLwwToFwwPolicySwitchOpSeqNumber = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns true if the latest pending write to the cell indicated by the given row/col handles\n\t * matches the given 'localSeq'.\n\t *\n\t * A return value of `true` indicates that there are no later local operations queued that will\n\t * clobber the write op at the given 'localSeq'. This includes later ops that overwrite the cell\n\t * with a different value as well as row/col removals that might recycled the given row/col handles.\n\t */\n\tprivate isLatestPendingWrite(rowHandle: Handle, colHandle: Handle, localSeq: number) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst pendingLocalSeq = this.pending.getCell(rowHandle, colHandle)!;\n\n\t\t// Note while we're awaiting the ACK for a local set, it's possible for the row/col to be\n\t\t// locally removed and the row/col handles recycled. If this happens, the pendingLocalSeq will\n\t\t// be 'undefined' or > 'localSeq'.\n\t\tassert(\n\t\t\t!(pendingLocalSeq < localSeq),\n\t\t\t0x023 /* \"The 'localSeq' of pending write (if any) must be <= the localSeq of the currently processed op.\" */,\n\t\t);\n\n\t\t// If this is the most recent write to the cell by the local client, the stored localSeq\n\t\t// will be an exact match for the given 'localSeq'.\n\t\treturn pendingLocalSeq === localSeq;\n\t}\n\n\tpublic toString() {\n\t\tlet s = `client:${\n\t\t\tthis.runtime.clientId\n\t\t}\\nrows: ${this.rows.toString()}\\ncols: ${this.cols.toString()}\\n\\n`;\n\n\t\tfor (let r = 0; r < this.rowCount; r++) {\n\t\t\ts += ` [`;\n\t\t\tfor (let c = 0; c < this.colCount; c++) {\n\t\t\t\tif (c > 0) {\n\t\t\t\t\ts += \", \";\n\t\t\t\t}\n\n\t\t\t\ts += `${this.serializer.stringify(this.getCell(r, c), this.handle)}`;\n\t\t\t}\n\t\t\ts += \"]\\n\";\n\t\t}\n\n\t\treturn `${s}\\n`;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: any): unknown {\n\t\tconst parsedContent = parseHandles(content, this.serializer);\n\t\tif (\n\t\t\tparsedContent.target === SnapshotPath.cols ||\n\t\t\tparsedContent.target === SnapshotPath.rows\n\t\t) {\n\t\t\tconst op = parsedContent as IMergeTreeOp;\n\t\t\tconst currentVector =\n\t\t\t\tparsedContent.target === SnapshotPath.cols ? this.cols : this.rows;\n\t\t\tconst oppositeVector =\n\t\t\t\tparsedContent.target === SnapshotPath.cols ? this.rows : this.cols;\n\t\t\tconst metadata = currentVector.applyStashedOp(op);\n\t\t\tconst localSeq = currentVector.getCollabWindow().localSeq;\n\t\t\tconst oppositeWindow = oppositeVector.getCollabWindow();\n\n\t\t\tassert(\n\t\t\t\tlocalSeq > oppositeWindow.localSeq,\n\t\t\t\t0x2d9,\n\t\t\t\t/* \"The 'localSeq' of the vector applying stashed op must > the 'localSeq' of the other vector.\" */\n\t\t\t);\n\n\t\t\toppositeWindow.localSeq = localSeq;\n\n\t\t\treturn metadata;\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tparsedContent.type === MatrixOp.set,\n\t\t\t\t0x2da /* \"Unknown SharedMatrix 'op' type.\" */,\n\t\t\t);\n\n\t\t\tconst setOp = parsedContent as ISetOp<T>;\n\t\t\tconst rowHandle = this.rows.getAllocatedHandle(setOp.row);\n\t\t\tconst colHandle = this.cols.getAllocatedHandle(setOp.col);\n\t\t\tconst rowsRefSeq = this.rows.getCollabWindow().currentSeq;\n\t\t\tconst colsRefSeq = this.cols.getCollabWindow().currentSeq;\n\t\t\tif (this.undo !== undefined) {\n\t\t\t\tlet oldValue = this.cells.getCell(rowHandle, colHandle);\n\t\t\t\tif (oldValue === null) {\n\t\t\t\t\toldValue = undefined;\n\t\t\t\t}\n\n\t\t\t\tthis.undo.cellSet(rowHandle, colHandle, oldValue);\n\t\t\t}\n\n\t\t\tthis.cells.setCell(rowHandle, colHandle, setOp.value);\n\t\t\tconst localSeq = this.nextLocalSeq();\n\t\t\tconst metadata: ISetOpMetadata = {\n\t\t\t\trowHandle,\n\t\t\t\tcolHandle,\n\t\t\t\tlocalSeq,\n\t\t\t\trowsRefSeq,\n\t\t\t\tcolsRefSeq,\n\t\t\t\treferenceSeqNumber: this.runtime.deltaManager.lastSequenceNumber,\n\t\t\t};\n\n\t\t\tthis.pending.setCell(rowHandle, colHandle, localSeq);\n\t\t\treturn metadata;\n\t\t}\n\t}\n}\n"]}
|
package/dist/{ops.cjs → ops.js}
RENAMED
package/dist/ops.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,IAAY,QAKX;AALD,WAAY,QAAQ;IACnB,mDAAU,CAAA;IACV,mDAAU,CAAA;IACV,qCAAG,CAAA;IACH,qEAAmB,CAAA;AACpB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Serializable } from \"@fluidframework/datastore-definitions\";\n\nexport enum MatrixOp {\n\tspliceCols,\n\tspliceRows,\n\tset,\n\tchangeSetCellPolicy,\n}\n\nexport interface IMatrixMsg {\n\ttype: MatrixOp;\n}\n\nexport interface IMatrixSpliceMsg extends IMatrixMsg {\n\ttype: MatrixOp.spliceCols | MatrixOp.spliceRows;\n\tstart: number;\n\tcount: number;\n}\n\nexport interface IMatrixCellMsg extends IMatrixMsg {\n\ttype: MatrixOp.set;\n\trow: number;\n\tcol: number;\n\tvalue: Serializable<unknown>;\n}\n\nexport interface IMatrixSwitchSetCellPolicy extends IMatrixMsg {\n\ttype: MatrixOp.changeSetCellPolicy;\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/matrix";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-
|
|
8
|
+
export declare const pkgVersion = "2.0.0-rc.1.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,2BAA2B,CAAC;AAChD,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,2BAA2B,CAAC;AAChD,eAAO,MAAM,UAAU,mBAAmB,CAAC"}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/matrix";
|
|
11
|
-
exports.pkgVersion = "2.0.0-
|
|
12
|
-
//# sourceMappingURL=packageVersion.
|
|
11
|
+
exports.pkgVersion = "2.0.0-rc.1.0.0";
|
|
12
|
+
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/matrix\";\nexport const pkgVersion = \"2.0.0-rc.1.0.0\";\n"]}
|
|
@@ -9,9 +9,9 @@ const core_utils_1 = require("@fluidframework/core-utils");
|
|
|
9
9
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
10
10
|
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
11
11
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
12
|
-
const handletable_1 = require("./handletable
|
|
13
|
-
const serialization_1 = require("./serialization
|
|
14
|
-
const handlecache_1 = require("./handlecache
|
|
12
|
+
const handletable_1 = require("./handletable");
|
|
13
|
+
const serialization_1 = require("./serialization");
|
|
14
|
+
const handlecache_1 = require("./handlecache");
|
|
15
15
|
class PermutationSegment extends merge_tree_1.BaseSegment {
|
|
16
16
|
static fromJSONObject(spec) {
|
|
17
17
|
const [length, start] = spec;
|
|
@@ -275,4 +275,4 @@ function reinsertSegmentIntoVector(vector, pos, spec) {
|
|
|
275
275
|
return { op, inserted };
|
|
276
276
|
}
|
|
277
277
|
exports.reinsertSegmentIntoVector = reinsertSegmentIntoVector;
|
|
278
|
-
//# sourceMappingURL=permutationvector.
|
|
278
|
+
//# sourceMappingURL=permutationvector.js.map
|