@fluid-experimental/tree 2.74.0 → 2.81.0-374083
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 +4 -0
- package/assertTagging.config.mjs +14 -0
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/MergeHealth.d.ts.map +1 -1
- package/dist/MergeHealth.js.map +1 -1
- package/dist/SharedTree.js.map +1 -1
- package/dist/SharedTreeEncoder.d.ts.map +1 -1
- package/dist/SharedTreeEncoder.js.map +1 -1
- package/dist/UndoRedoHandler.d.ts.map +1 -1
- package/dist/UndoRedoHandler.js.map +1 -1
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.d.ts +2 -2
- package/dist/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +5 -5
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +1 -0
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +3 -3
- package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/migrationShimFactory.js.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts +2 -2
- package/dist/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/dist/migration-shim/sharedTreeShim.d.ts +5 -5
- package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShim.js.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts +1 -1
- package/dist/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/dist/migration-shim/shimChannelServices.js.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts +2 -2
- package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
- package/dist/migration-shim/shimHandle.d.ts +1 -1
- package/dist/migration-shim/shimHandle.d.ts.map +1 -1
- package/dist/migration-shim/shimHandle.js.map +1 -1
- package/dist/migration-shim/types.d.ts +4 -4
- package/dist/migration-shim/types.d.ts.map +1 -1
- package/dist/migration-shim/types.js.map +1 -1
- package/dist/migration-shim/utils.d.ts +3 -3
- package/dist/migration-shim/utils.d.ts.map +1 -1
- package/dist/migration-shim/utils.js.map +1 -1
- package/eslint.config.mts +5 -4
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js.map +1 -1
- package/lib/MergeHealth.d.ts.map +1 -1
- package/lib/MergeHealth.js.map +1 -1
- package/lib/SharedTree.js.map +1 -1
- package/lib/SharedTreeEncoder.d.ts.map +1 -1
- package/lib/SharedTreeEncoder.js.map +1 -1
- package/lib/UndoRedoHandler.d.ts.map +1 -1
- package/lib/UndoRedoHandler.js.map +1 -1
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/id-compressor/SessionIdNormalizer.js.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.d.ts +2 -2
- package/lib/migration-shim/migrationDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/migrationDeltaHandler.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +5 -5
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +1 -0
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +3 -3
- package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/migrationShimFactory.js.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts +2 -2
- package/lib/migration-shim/sharedTreeDeltaHandler.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeDeltaHandler.js.map +1 -1
- package/lib/migration-shim/sharedTreeShim.d.ts +5 -5
- package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShim.js.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts +1 -1
- package/lib/migration-shim/shimChannelServices.d.ts.map +1 -1
- package/lib/migration-shim/shimChannelServices.js.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts +2 -2
- package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
- package/lib/migration-shim/shimHandle.d.ts +1 -1
- package/lib/migration-shim/shimHandle.d.ts.map +1 -1
- package/lib/migration-shim/shimHandle.js.map +1 -1
- package/lib/migration-shim/types.d.ts +4 -4
- package/lib/migration-shim/types.d.ts.map +1 -1
- package/lib/migration-shim/types.js.map +1 -1
- package/lib/migration-shim/utils.d.ts +3 -3
- package/lib/migration-shim/utils.d.ts.map +1 -1
- package/lib/migration-shim/utils.js.map +1 -1
- package/package.json +32 -32
- package/src/Checkout.ts +1 -1
- package/src/Common.ts +5 -1
- package/src/MergeHealth.ts +5 -5
- package/src/SharedTree.ts +2 -2
- package/src/SharedTreeEncoder.ts +9 -2
- package/src/UndoRedoHandler.ts +5 -5
- package/src/id-compressor/IdCompressor.ts +1 -1
- package/src/id-compressor/SessionIdNormalizer.ts +1 -1
- package/src/migration-shim/migrationDeltaHandler.ts +2 -2
- package/src/migration-shim/migrationShim.ts +11 -13
- package/src/migration-shim/migrationShimFactory.ts +7 -10
- package/src/migration-shim/sharedTreeDeltaHandler.ts +2 -2
- package/src/migration-shim/sharedTreeShim.ts +14 -14
- package/src/migration-shim/sharedTreeShimFactory.ts +5 -5
- package/src/migration-shim/shimChannelServices.ts +4 -4
- package/src/migration-shim/shimDeltaConnection.ts +5 -5
- package/src/migration-shim/shimHandle.ts +1 -1
- package/src/migration-shim/types.ts +8 -8
- package/src/migration-shim/utils.ts +3 -3
- package/.eslintrc.cjs +0 -45
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"sharedTreeShimFactory.d.ts","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC;IAEnE;;;;;OAKG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;;OAKG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;;;OAIG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAQ1B;;;;;OAKG;IACI,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc;CAK1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedTreeShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAS7D,2DAAqD;AACrD,yCAA6C;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAqB;IACjC,YAAoC,OAA+B;QAA/B,YAAO,GAAP,OAAO,CAAwB;IAAG,CAAC;IAEvE;;;;;OAKG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,oKAAoK;QACpK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClG,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AApDD,sDAoDC","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/internal';\nimport {\n\
|
|
1
|
+
{"version":3,"file":"sharedTreeShimFactory.js","sourceRoot":"","sources":["../../src/migration-shim/sharedTreeShimFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAS7D,2DAAqD;AACrD,yCAA6C;AAE7C;;;;;;;;;;;;GAYG;AACH,MAAa,qBAAqB;IACjC,YAAoC,OAA+B;QAA/B,YAAO,GAAP,OAAO,CAAwB;IAAG,CAAC;IAEvE;;;;;OAKG;IACH,IAAW,IAAI;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,oKAAoK;QACpK,IAAA,iBAAM,EAAC,IAAA,0BAAe,EAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAClG,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,cAAc,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,cAAc,GAAG,IAAI,kCAAc,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACrE,cAAc,CAAC,MAAM,EAAE,CAAC;QACxB,OAAO,cAAc,CAAC;IACvB,CAAC;CACD;AApDD,sDAoDC","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/internal';\nimport type {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n} from '@fluidframework/datastore-definitions/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport { SharedTreeShim } from './sharedTreeShim.js';\nimport { attributesMatch } from './utils.js';\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedTreeShim}.\n *\n * Creates the migration shim that allows a migration from legacy shared tree to shared tree.\n * Note: There may be a need for 3 different factories for different parts of the migration.\n * That or three different shims. Potentially we can just do 2 as 2 and 3 can be combined.\n * 1. pre-migration\n * 2. after a summary has been generated but there may still be potential v1 ops\n * 3. post-migration after a summary has been generated and the msn has moved far enough forward for only v2 ops\n *\n * @sealed\n * @internal\n */\nexport class SharedTreeShimFactory implements IChannelFactory {\n\tpublic constructor(private readonly factory: IChannelFactory<ITree>) {}\n\n\t/**\n\t * Can only load the new SharedTree - this allows our snapshots to be simple. We do not have to consider any new\n\t * unique snapshot formats and how to load from them.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.factory.type;\n\t}\n\n\t/**\n\t * Should be the new SharedTree attributes - this should indicate what type of tree snapshot we are expecting or\n\t * are capable of loading from.\n\t *\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn this.factory.attributes;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.load}\n\t *\n\t * Should be loading the SharedTreeShim from a new SharedTree snapshot only.\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<SharedTreeShim> {\n\t\t// TODO: remove attributes check and move it to an automated test that constructing a SharedTreeShimFactory and checking its attributes/type matches the oldFactory.\n\t\tassert(attributesMatch(attributes, this.factory.attributes), 0x7ef /* Attributes do not match */);\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tawait sharedTreeShim.load(services);\n\t\treturn sharedTreeShim;\n\t}\n\n\t/**\n\t * {@link @fluidframework/datastore-definitions#IChannelFactory.create}\n\t *\n\t * Should be only creating the SharedTreeShim, which will only generate a new SharedTree snapshot. That way we do\n\t * not have the capability of accidentally creating a LegacySharedTree snapshot.\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): SharedTreeShim {\n\t\tconst sharedTreeShim = new SharedTreeShim(id, runtime, this.factory);\n\t\tsharedTreeShim.create();\n\t\treturn sharedTreeShim;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import type { IChannelServices, IChannelStorageService, IDeltaConnection } from '@fluidframework/datastore-definitions/internal';
|
|
6
6
|
/**
|
|
7
7
|
* ShimChannelServices wraps an existing IChannelServices object and provides a new ShimDeltaConnection
|
|
8
8
|
* object in place of the original deltaConnection object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimChannelServices.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"shimChannelServices.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,MAAM,gDAAgD,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAC7D,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;gBAC5C,eAAe,EAAE,gBAAgB;IAIpD,IAAW,eAAe,IAAI,gBAAgB,CAE7C;IACD,SAAgB,aAAa,EAAE,sBAAsB,CAAC;CACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimChannelServices.js","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuBH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,uBAAuB;IACnC,YAAmB,eAAiC;QACnD,IAAI,CAAC,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;IACpD,CAAC;IAED,IAAW,eAAe;QACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjD,CAAC;CAED;AATD,0DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\
|
|
1
|
+
{"version":3,"file":"shimChannelServices.js","sourceRoot":"","sources":["../../src/migration-shim/shimChannelServices.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAuBH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,uBAAuB;IACnC,YAAmB,eAAiC;QACnD,IAAI,CAAC,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;IACpD,CAAC;IAED,IAAW,eAAe;QACzB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjD,CAAC;CAED;AATD,0DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannelServices,\n\tIChannelStorageService,\n\tIDeltaConnection,\n} from '@fluidframework/datastore-definitions/internal';\n\n/**\n * ShimChannelServices wraps an existing IChannelServices object and provides a new ShimDeltaConnection\n * object in place of the original deltaConnection object.\n *\n * ShimChannelServices allows us to encapsulate all the wrapping logic without having to modify the original services.\n *\n * At some point, in the SharedObject code we call this.services.deltaConnection.attach(this.handler). Therefore before\n * we call attach, we need to swap out the deltaConnection object for the ShimDeltaConnection object. This makes\n * it consistent as we will always be passing this shim\n */\nexport interface IShimChannelServices extends IChannelServices {\n\treadonly objectStorage: IChannelStorageService;\n\treadonly deltaConnection: IDeltaConnection;\n}\n\n/**\n * NoDeltasChannelServices wraps an existing IChannelServices object. During rehydration of a container, loading in a\n * detached state, we only want to connect to the deltaConnection once on attached. We also only want to set the\n * channel services once. This enables us to allow deltaHandler attach only once, even though there are flows that\n * call only load, only connect, and load and then connect.\n *\n * Steps:\n * 1. Rehydrate/load SharedObject in detached container runtime state\n * 2. Attach detached container runtime\n * 3. Connect SharedObject.\n *\n * Refer to SharedObject.load for the scenario.\n *\n * This potentially can be baked into the ShimChannelServices.\n *\n * TODO: convert this to a test and remove usage of this class\n */\nexport class NoDeltasChannelServices implements IChannelServices {\n\tpublic constructor(channelServices: IChannelServices) {\n\t\tthis.objectStorage = channelServices.objectStorage;\n\t}\n\n\tpublic get deltaConnection(): IDeltaConnection {\n\t\tthrow new Error('No deltaConnection available');\n\t}\n\tpublic readonly objectStorage: IChannelStorageService;\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import type { IChannelAttributes, IDeltaConnection, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
|
|
6
|
+
import type { IShimDeltaHandler, IUnstampedContents } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Represents a connection to a Shim data store that can receive and submit deltas.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimDeltaConnection.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"shimDeltaConnection.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,MAAM,gDAAgD,CAAC;AAExD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;;;;;GASG;AACH,qBAAa,2BAA4B,YAAW,gBAAgB;IAElE,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBADhB,eAAe,EAAE,gBAAgB,EACjC,gBAAgB,EAAE,iBAAiB;IAGrD,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,OAAO,CAAC,SAAS,CAAQ;IAClB,aAAa,IAAI,IAAI;IAKrB,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAS/D,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAUpC,KAAK,IAAI,IAAI;CAGpB;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAE3D,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,eAAe,EAAE,gBAAgB,EACjC,gBAAgB,EAAE,iBAAiB,EACnC,UAAU,EAAE,kBAAkB;IAGhD,IAAW,SAAS,IAAI,OAAO,CAE9B;IAGM,MAAM,CAAC,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAQjF;;;;;;;;OAQG;IACI,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IASpC,KAAK,IAAI,IAAI;CAGpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimDeltaConnection.js","sourceRoot":"","sources":["../../src/migration-shim/shimDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAS7D;;;;;;;;;GASG;AACH,MAAa,2BAA2B;IACvC,YACkB,eAAiC,EACjC,gBAAmC;QADnC,oBAAe,GAAf,eAAe,CAAkB;QACjC,qBAAgB,GAAhB,gBAAgB,CAAmB;QAO7C,cAAS,GAAG,IAAI,CAAC;IANtB,CAAC;IAEJ,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;IACvC,CAAC;IAGM,aAAa;QACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,gCAAgC;IACzB,MAAM,CAAC,cAAuB,EAAE,eAAwB;QAC9D,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;QAC9D,CAAC;QACD,gFAAgF;IACjF,CAAC;IAED,mHAAmH;IACnH,uEAAuE;IAChE,MAAM,CAAC,OAAsB;QACnC,wGAAwG;QACxG,6GAA6G;QAC7G,+EAA+E;QAC/E,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnD,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QACtC,CAAC;IACF,CAAC;IACM,KAAK;QACX,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD;AAtCD,kEAsCC;AAED;;GAEG;AACH,MAAa,oBAAoB;IAChC,YACkB,eAAiC,EACjC,gBAAmC,EACnC,UAA8B;QAF9B,oBAAe,GAAf,eAAe,CAAkB;QACjC,qBAAgB,GAAhB,gBAAgB,CAAmB;QACnC,eAAU,GAAV,UAAU,CAAoB;IAC7C,CAAC;IAEJ,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;IACvC,CAAC;IAED,gCAAgC;IACzB,MAAM,CAAC,cAAkC,EAAE,eAAwB;QACzE,IAAA,iBAAM,EAAC,cAAc,CAAC,mBAAmB,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACxG,cAAc,CAAC,mBAAmB,GAAG;YACpC,GAAG,IAAI,CAAC,UAAU;SAClB,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,OAAsB;QACnC,qDAAqD;QACrD,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnD,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QACtC,CAAC;IACF,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD;AAzCD,oDAyCC","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/internal';\nimport {\n\
|
|
1
|
+
{"version":3,"file":"shimDeltaConnection.js","sourceRoot":"","sources":["../../src/migration-shim/shimDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAS7D;;;;;;;;;GASG;AACH,MAAa,2BAA2B;IACvC,YACk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,gCAAgC;IACzB,MAAM,CAAC,cAAkC,EAAE,eAAwB;QACzE,IAAA,iBAAM,EAAC,cAAc,CAAC,mBAAmB,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACxG,cAAc,CAAC,mBAAmB,GAAG;YACpC,GAAG,IAAI,CAAC,UAAU;SAClB,CAAC;QACF,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,OAAsB;QACnC,qDAAqD;QACrD,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;YACrC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACnD,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QACtC,CAAC;IACF,CAAC;IAEM,KAAK;QACX,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACD;AAzCD,oDAyCC","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/internal';\nimport type {\n\tIChannelAttributes,\n\tIDeltaConnection,\n\tIDeltaHandler,\n} from '@fluidframework/datastore-definitions/internal';\n\nimport type { IShimDeltaHandler, IUnstampedContents } from './types.js';\n\n/**\n * Represents a connection to a Shim data store that can receive and submit deltas.\n *\n * This allows the Shim class to swap out the delta handler on the fly.\n *\n * The PreMigrationDeltaConnection does not stamp ops so that those ops can be considered v1 ops.\n *\n * This special logic allows for connect to be called for the underlying new SharedObject without the need for\n * modifications on the current ChannelDeltaConnection.\n */\nexport class PreMigrationDeltaConnection implements IDeltaConnection {\n\tpublic constructor(\n\t\tprivate readonly deltaConnection: IDeltaConnection,\n\t\tprivate readonly shimDeltaHandler: IShimDeltaHandler\n\t) {}\n\n\tpublic get connected(): boolean {\n\t\treturn this.deltaConnection.connected;\n\t}\n\n\tprivate canSubmit = true;\n\tpublic disableSubmit(): void {\n\t\tthis.canSubmit = false;\n\t}\n\n\t// This is for submitting v1 ops\n\tpublic submit(messageContent: unknown, localOpMetadata: unknown): void {\n\t\tif (this.canSubmit) {\n\t\t\tthis.deltaConnection.submit(messageContent, localOpMetadata);\n\t\t}\n\t\t// We don't want to throw so we can revert local changes on the LegacySharedTree\n\t}\n\n\t// We only want to call attach on the underlying delta connection once, as we'll hit an assert if we call it twice.\n\t// Note: SharedObject.load calls attach as well as SharedObject.connect\n\tpublic attach(handler: IDeltaHandler): void {\n\t\t// There are essentially two delta handlers that process ops, the shim delta handler to process shim ops\n\t\t// preventing them from being processed by the tree delta handler, and the tree delta handler to process tree\n\t\t// ops. Post migration v1 ops can be considered \"shim\" ops as they are dropped.\n\t\tthis.shimDeltaHandler.attachTreeDeltaHandler(handler);\n\t\tif (!this.shimDeltaHandler.attached) {\n\t\t\tthis.deltaConnection.attach(this.shimDeltaHandler);\n\t\t\tthis.shimDeltaHandler.markAttached();\n\t\t}\n\t}\n\tpublic dirty(): void {\n\t\tthis.deltaConnection.dirty();\n\t}\n}\n\n/**\n * A delta connection that stamps ops with a particular channel attributes so that those ops won't get dropped\n */\nexport class StampDeltaConnection implements IDeltaConnection {\n\tpublic constructor(\n\t\tprivate readonly deltaConnection: IDeltaConnection,\n\t\tprivate readonly shimDeltaHandler: IShimDeltaHandler,\n\t\tprivate readonly attributes: IChannelAttributes\n\t) {}\n\n\tpublic get connected(): boolean {\n\t\treturn this.deltaConnection.connected;\n\t}\n\n\t// This is for submitting v2 ops\n\tpublic submit(messageContent: IUnstampedContents, localOpMetadata: unknown): void {\n\t\tassert(messageContent.fluidMigrationStamp === undefined, 0x835 /* Should not be stamping ops twice! */);\n\t\tmessageContent.fluidMigrationStamp = {\n\t\t\t...this.attributes,\n\t\t};\n\t\tthis.deltaConnection.submit(messageContent, localOpMetadata);\n\t}\n\n\t/**\n\t * For the MigrationShim because we only attach once to the actual delta connection, we store state in the\n\t * migrationDeltaHandler to know if we've already attached. We will call attach once on the\n\t * PreMigrationDeltaConnection and once on the StampDeltaConnection.\n\t *\n\t * The SharedTreeShim should not be swapping delta connections and thus the if statement should always be executed.\n\t *\n\t * @param handler - this delta handler can only connect once.\n\t */\n\tpublic attach(handler: IDeltaHandler): void {\n\t\t// Maybe put an assert here to only call attach once?\n\t\tthis.shimDeltaHandler.attachTreeDeltaHandler(handler);\n\t\tif (!this.shimDeltaHandler.attached) {\n\t\t\tthis.deltaConnection.attach(this.shimDeltaHandler);\n\t\t\tthis.shimDeltaHandler.markAttached();\n\t\t}\n\t}\n\n\tpublic dirty(): void {\n\t\tthis.deltaConnection.dirty();\n\t}\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { FluidHandleBase } from '@fluidframework/runtime-utils/internal';
|
|
6
|
-
import {
|
|
6
|
+
import type { IShim } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* ShimHandle is a special class to handle the fact that we are essentially creating a proxy for a DDS.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimHandle.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAyB,MAAM,wCAAwC,CAAC;AAEhG,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"shimHandle.d.ts","sourceRoot":"","sources":["../../src/migration-shim/shimHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAyB,MAAM,wCAAwC,CAAC;AAEhG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,qBAAa,UAAU,CAAC,KAAK,SAAS,KAAK,CAAE,SAAQ,eAAe,CAAC,KAAK,CAAC;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAI/C,IAAW,YAAY,IAAI,MAAM,CAEhC;IACD,IAAW,UAAU,IAAI,OAAO,CAE/B;IACM,WAAW,IAAI,IAAI;IAGb,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;CAGlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shimHandle.js","sourceRoot":"","sources":["../../src/migration-shim/shimHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAgG;AAIhG;;;;;;;GAOG;AACH,MAAa,UAAgC,SAAQ,0BAAsB;IAC1E,YAAoC,IAAW;QAC9C,KAAK,EAAE,CAAC;QAD2B,SAAI,GAAJ,IAAI,CAAO;IAE/C,CAAC;IAED,IAAW,YAAY;QACtB,OAAO,IAAA,gCAAqB,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC;IACzE,CAAC;IACD,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC;IAChD,CAAC;IACM,WAAW;QACjB,OAAO,IAAA,gCAAqB,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1E,CAAC;IACM,KAAK,CAAC,GAAG;QACf,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;CACD;AAjBD,gCAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidHandleBase, toFluidHandleInternal } from '@fluidframework/runtime-utils/internal';\n\nimport {
|
|
1
|
+
{"version":3,"file":"shimHandle.js","sourceRoot":"","sources":["../../src/migration-shim/shimHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAAgG;AAIhG;;;;;;;GAOG;AACH,MAAa,UAAgC,SAAQ,0BAAsB;IAC1E,YAAoC,IAAW;QAC9C,KAAK,EAAE,CAAC;QAD2B,SAAI,GAAJ,IAAI,CAAO;IAE/C,CAAC;IAED,IAAW,YAAY;QACtB,OAAO,IAAA,gCAAqB,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC;IACzE,CAAC;IACD,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC;IAChD,CAAC;IACM,WAAW;QACjB,OAAO,IAAA,gCAAqB,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1E,CAAC;IACM,KAAK,CAAC,GAAG;QACf,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;CACD;AAjBD,gCAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidHandleBase, toFluidHandleInternal } from '@fluidframework/runtime-utils/internal';\n\nimport type { IShim } from './types.js';\n\n/**\n * ShimHandle is a special class to handle the fact that we are essentially creating a proxy for a DDS.\n *\n * ShimHandle is designed for MigrationShim and SharedTreeShim.\n *\n * Local handles such as the FluidObjectHandle and the SharedObjectHandle don't work as they do not properly bind the\n * Shim's underlying DDS.\n */\nexport class ShimHandle<TShim extends IShim> extends FluidHandleBase<TShim> {\n\tpublic constructor(private readonly shim: TShim) {\n\t\tsuper();\n\t}\n\n\tpublic get absolutePath(): string {\n\t\treturn toFluidHandleInternal(this.shim.currentTree.handle).absolutePath;\n\t}\n\tpublic get isAttached(): boolean {\n\t\treturn this.shim.currentTree.handle.isAttached;\n\t}\n\tpublic attachGraph(): void {\n\t\treturn toFluidHandleInternal(this.shim.currentTree.handle).attachGraph();\n\t}\n\tpublic async get(): Promise<TShim> {\n\t\treturn this.shim;\n\t}\n}\n"]}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import type { IChannel, IChannelAttributes, IChannelServices, IDeltaHandler } from '@fluidframework/datastore-definitions/internal';
|
|
6
|
+
import type { ITree } from '@fluidframework/tree';
|
|
7
|
+
import type { SharedTree as LegacySharedTree } from '../SharedTree.js';
|
|
8
|
+
import type { IMigrationOp } from './migrationShim.js';
|
|
9
9
|
/**
|
|
10
10
|
* An interface for a shim delta handler intercepts another delta handler.
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/migration-shim/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/migration-shim/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACvD;;;OAGG;IACH,sBAAsB,CAAC,gBAAgB,EAAE,aAAa,GAAG,IAAI,CAAC;IAE9D;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;IAE/B,QAAQ,EAAE,OAAO,CAAC;IAElB,YAAY,IAAI,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,mBAAmB,EAAE,kBAAkB,CAAC;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,YAAY,CAAC;AAE/E;;;;GAIG;AACH,MAAM,WAAW,KAAM,SAAQ,QAAQ;IACtC,MAAM,IAAI,IAAI,CAAC;IACf,IAAI,CAAC,eAAe,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,WAAW,EAAE,KAAK,GAAG,gBAAgB,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/migration-shim/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/migration-shim/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIChannel,\n\tIChannelAttributes,\n\tIChannelServices,\n\tIDeltaHandler,\n} from '@fluidframework/datastore-definitions/internal';\nimport type { ITree } from '@fluidframework/tree';\n\nimport type { SharedTree as LegacySharedTree } from '../SharedTree.js';\n\nimport type { IMigrationOp } from './migrationShim.js';\n\n/**\n * An interface for a shim delta handler intercepts another delta handler.\n *\n * @internal\n */\nexport interface IShimDeltaHandler extends IDeltaHandler {\n\t/**\n\t * Provide the real tree delta handler (either legacy or new) to the shim that will be used to process the tree ops.\n\t * @param treeDeltaHandler - The appropriate tree delta handler.\n\t */\n\tattachTreeDeltaHandler(treeDeltaHandler: IDeltaHandler): void;\n\n\t/**\n\t * The delta handler needs to be attached to the IShimDeltaHandler before attaching it to the delta connection.\n\t * Otherwise the IShimDeltaHandler will not be able to process ops.\n\t */\n\thasTreeDeltaHandler(): boolean;\n\n\tattached: boolean;\n\n\tmarkAttached(): void;\n}\n\n/**\n * A v1 op or a v2 unstamped op\n */\nexport interface IUnstampedContents {\n\tfluidMigrationStamp?: IChannelAttributes;\n\t[key: string | number]: unknown;\n}\n\n/**\n * A v2 op will have a `fluidMigrationStamp` property. This is a type guard to check if the op is a v2 op.\n */\nexport interface IStampedContents {\n\tfluidMigrationStamp: IChannelAttributes;\n\t[key: string | number]: unknown;\n}\n\n/**\n * A type for interrogating ops to see if they are v2 stamped ops or migrate ops. Otherwise, we try not to care\n * what the contents of the op are. The contents could be of type `any` or `unknown`.\n *\n * If `type` specifically === \"barrier\", then we know we are dealing with a barrier op\n *\n * If `fluidMigrationStamp` is present, then we know we are dealing with a v2 op\n *\n * @internal\n */\nexport type IOpContents = IStampedContents | IUnstampedContents | IMigrationOp;\n\n/**\n * An interface for a shim channel that intercepts a LegacySharedTree or new SharedTree DDS.\n *\n * @internal\n */\nexport interface IShim extends IChannel {\n\tcreate(): void;\n\tload(channelServices: IChannelServices): Promise<void>;\n\tcurrentTree: ITree | LegacySharedTree;\n}\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import type { IChannelAttributes } from '@fluidframework/datastore-definitions/internal';
|
|
6
|
+
import type { IMigrationOp } from './migrationShim.js';
|
|
7
|
+
import type { IOpContents, IStampedContents } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Checks if two channel attributes objects match.
|
|
10
10
|
* @param attributes1 - The first channel attributes object to compare.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/migration-shim/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/migration-shim/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,GAAG,OAAO,CAMzG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,QAAQ,IAAI,YAAY,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,QAAQ,IAAI,gBAAgB,CAE/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/migration-shim/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,WAA+B,EAAE,WAA+B;IAC/F,OAAO,CACN,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;QACrC,WAAW,CAAC,cAAc,KAAK,WAAW,CAAC,cAAc;QACzD,WAAW,CAAC,qBAAqB,KAAK,WAAW,CAAC,qBAAqB,CACvE,CAAC;AACH,CAAC;AAND,0CAMC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,QAAqB;IAChD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;AACpC,CAAC;AAFD,kCAEC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,QAAqB;IAChD,OAAO,qBAAqB,IAAI,QAAQ,CAAC;AAC1C,CAAC;AAFD,kCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/migration-shim/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,WAA+B,EAAE,WAA+B;IAC/F,OAAO,CACN,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;QACrC,WAAW,CAAC,cAAc,KAAK,WAAW,CAAC,cAAc;QACzD,WAAW,CAAC,qBAAqB,KAAK,WAAW,CAAC,qBAAqB,CACvE,CAAC;AACH,CAAC;AAND,0CAMC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,QAAqB;IAChD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;AACpC,CAAC;AAFD,kCAEC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,QAAqB;IAChD,OAAO,qBAAqB,IAAI,QAAQ,CAAC;AAC1C,CAAC;AAFD,kCAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IChannelAttributes } from '@fluidframework/datastore-definitions/internal';\n\nimport type { IMigrationOp } from './migrationShim.js';\nimport type { IOpContents, IStampedContents } from './types.js';\n\n/**\n * Checks if two channel attributes objects match.\n * @param attributes1 - The first channel attributes object to compare.\n * @param attributes2 - The second channel attributes object to compare.\n * @returns True if the two channel attributes objects match, false otherwise.\n */\nexport function attributesMatch(attributes1: IChannelAttributes, attributes2: IChannelAttributes): boolean {\n\treturn (\n\t\tattributes1.type === attributes2.type &&\n\t\tattributes1.packageVersion === attributes2.packageVersion &&\n\t\tattributes1.snapshotFormatVersion === attributes2.snapshotFormatVersion\n\t);\n}\n\n/**\n * Checks if the given op is a barrier op.\n * @param contents - The op to check.\n * @returns True if the op is a barrier op, false otherwise.\n */\nexport function isBarrierOp(contents: IOpContents): contents is IMigrationOp {\n\treturn contents.type === 'barrier';\n}\n\n/**\n * Checks if the given op is a barrier op.\n * @param contents - The op to check.\n * @returns True if the op is a barrier op, false otherwise.\n */\nexport function isStampedOp(contents: IOpContents): contents is IStampedContents {\n\treturn 'fluidMigrationStamp' in contents;\n}\n"]}
|
package/eslint.config.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* To regenerate: pnpm tsx scripts/generate-flat-eslint-configs.ts --typescript
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
5
4
|
*/
|
|
5
|
+
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
7
7
|
import { minimalDeprecated } from '../../../common/build/eslint-config-fluid/flat.mts';
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@ const config: Linter.Config[] = [
|
|
|
10
10
|
...minimalDeprecated,
|
|
11
11
|
{
|
|
12
12
|
rules: {
|
|
13
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
13
14
|
'@typescript-eslint/no-shadow': 'off',
|
|
14
15
|
'no-shadow': 'off',
|
|
15
16
|
'@typescript-eslint/no-unsafe-return': 'off',
|
package/lib/Checkout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,6BAA6B,EAC7B,iBAAiB,GAC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D,MAAM,IAAI,GACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,qDAAqD,CAAC,CAAC;QACzG,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAED;;;;OAIG;IACO,UAAU;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;YAC7C,6GAA6G;YAC7G,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IErrorEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tcreateChildLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { Change } from './ChangeTypes.js';\nimport { RestOrArray, assertWithMessage, fail, unwrapRestOrArray } from './Common.js';\nimport { newEditId } from './EditUtilities.js';\nimport { SharedTreeEvent } from './EventTypes.js';\nimport { EditId } from './Identifiers.js';\nimport { CachingLogViewer } from './LogViewer.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedHandler, SharedTree } from './SharedTree.js';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal.js';\nimport { TreeView } from './TreeView.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @alpha\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @alpha\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @alpha\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = createChildLogger({ logger: this.tree.logger, namespace: 'Checkout' });\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t) {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryBaseProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t *\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t *\n\t * @returns The result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../src/Checkout.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAEN,6BAA6B,EAC7B,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAe,iBAAiB,EAAE,IAAI,EAAE,iBAAiB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AAC,IAAI,IAAI,CAAC,qDAAqD,CAAC,CAAC;QACzG,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAED;;;;OAIG;IACO,UAAU;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;YAC7C,6GAA6G;YAC7G,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAaD;;;OAGG;IACI,OAAO,CAAC,KAAa;QAC3B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable, IErrorEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { assert } from '@fluidframework/core-utils/internal';\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tcreateChildLogger,\n} from '@fluidframework/telemetry-utils/internal';\n\nimport { Change } from './ChangeTypes.js';\nimport { RestOrArray, assertWithMessage, fail, unwrapRestOrArray } from './Common.js';\nimport { newEditId } from './EditUtilities.js';\nimport { SharedTreeEvent } from './EventTypes.js';\nimport { EditId } from './Identifiers.js';\nimport { CachingLogViewer } from './LogViewer.js';\nimport { RevisionView } from './RevisionView.js';\nimport { EditCommittedHandler, SharedTree } from './SharedTree.js';\nimport { EditingResult, GenericTransaction, TransactionInternal, ValidEditingResult } from './TransactionInternal.js';\nimport { TreeView } from './TreeView.js';\nimport { ChangeInternal, Edit, EditStatus } from './persisted-types/index.js';\n\n/**\n * An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.\n * @alpha\n */\nexport enum CheckoutEvent {\n\t/**\n\t * `currentView` has changed.\n\t * Passed a before and after TreeView.\n\t */\n\tViewChange = 'viewChange',\n}\n\n/**\n * Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.\n * @alpha\n */\nexport interface ICheckoutEvents extends IErrorEvent {\n\t(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);\n}\n\n/**\n * The result of validation of an Edit.\n * @alpha\n */\nexport enum EditValidationResult {\n\t/**\n\t * The edit contained one or more malformed changes (e.g. was missing required fields such as `id`),\n\t * or contained a sequence of changes that could not possibly be applied sequentially without error\n\t * (e.g. an edit which tries to insert the same detached node twice).\n\t */\n\tMalformed,\n\t/**\n\t * The edit is well-formed but cannot be applied to the current view, generally because concurrent changes\n\t * caused one or more merge conflicts.\n\t * For example, the edit refers to the `StablePlace` after node `C`, but `C` has since been deleted.\n\t */\n\tInvalid,\n\t/**\n\t * The edit is well-formed and can be applied to the current view.\n\t */\n\tValid,\n}\n\n/**\n * A mutable Checkout of a SharedTree, allowing viewing and interactive transactional editing.\n * Provides {@link https://en.wikipedia.org/wiki/Snapshot_isolation | snapshot-isolation} while editing.\n *\n * A Checkout always shows a consistent sequence of versions of the SharedTree, but it may skip intermediate versions, and may fall behind.\n * In this case consistent means the sequence of versions could occur with fully synchronous shared tree access,\n * though the timing of sequenced edits arriving to the Checkout may be later than they actually arrive in the SharedTree.\n * Specifically no sequenced edits will arrive during an ongoing edit (to implement snapshot isolation):\n * they will be applied asynchronously some time after the ongoing edit is ended.\n *\n * Events emitted by `Checkout` are documented in {@link CheckoutEvent}.\n * Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the\n * `SharedTree` used at construction time.\n * @alpha\n */\nexport abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {\n\t/**\n\t * The view of the latest committed revision.\n\t * Does not include changes from any open edits.\n\t *\n\t * When this changes, emitChange must be called.\n\t */\n\tprotected abstract get latestCommittedView(): RevisionView;\n\n\t/**\n\t * The last view for which invalidation was sent.\n\t * Updated by emitChange.\n\t */\n\tprivate previousView: TreeView;\n\n\t/**\n\t * A handler for 'committedEdit' SharedTreeEvent\n\t */\n\tprivate readonly editCommittedHandler: EditCommittedHandler;\n\n\t/**\n\t * The shared tree this checkout views/edits.\n\t */\n\tpublic readonly tree: SharedTree;\n\n\t/**\n\t * `tree`'s log viewer as a CachingLogViewer if it is one, otherwise undefined.\n\t * Used for optimizations if provided.\n\t */\n\tprivate readonly cachingLogViewer?: CachingLogViewer;\n\n\t/**\n\t * Holds the state required to manage the currently open edit.\n\t * Undefined if there is currently not an open edit.\n\t *\n\t * Since `currentView` exposes the the intermediate state from this edit,\n\t * operations that modify `currentEdit.view` must call `emitChange` to handle invalidation.\n\t */\n\tprivate currentEdit?: GenericTransaction;\n\n\tprivate readonly logger: ITelemetryLoggerExt;\n\n\tpublic disposed: boolean = false;\n\n\tprotected constructor(tree: SharedTree, currentView: RevisionView, onEditCommitted: EditCommittedHandler) {\n\t\tsuper((_event, error: unknown) => {\n\t\t\tthis.tree.emit('error', error);\n\t\t});\n\t\tthis.tree = tree;\n\t\tthis.logger = createChildLogger({ logger: this.tree.logger, namespace: 'Checkout' });\n\t\tif (tree.logViewer instanceof CachingLogViewer) {\n\t\t\tthis.cachingLogViewer = tree.logViewer;\n\t\t}\n\t\tthis.previousView = currentView;\n\t\tthis.editCommittedHandler = onEditCommitted;\n\n\t\t// If there is an ongoing edit, emitChange will no-op, which is fine.\n\t\tthis.tree.on(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n\n\t/**\n\t * @returns the current view of the tree, including the result of changes applied so far during an edit.\n\t * Note that any external edits (from other clients) will not added to view while there is a `currentEdit`.\n\t */\n\tpublic get currentView(): TreeView {\n\t\treturn this.currentEdit?.view ?? this.latestCommittedView;\n\t}\n\n\t/**\n\t * @returns true iff there is an open edit.\n\t */\n\tpublic hasOpenEdit(): boolean {\n\t\treturn this.currentEdit !== undefined;\n\t}\n\n\t/**\n\t * Opens a new edit operation.\n\t * Changes accumulate in the edit via calls to `applyChanges()`.\n\t */\n\tpublic openEdit(): void {\n\t\tassert(this.currentEdit === undefined, 0x600 /* An edit is already open. */);\n\t\tthis.currentEdit = TransactionInternal.factory(this.latestCommittedView);\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation and commits it to the history.\n\t *\n\t * Malformed edits are considered an error, and will assert:\n\t * All named detached sequences must have been used or the Edit is malformed.\n\t *\n\t * @returns the `id` of the committed edit\n\t */\n\tpublic closeEdit(): EditId {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x601 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tassert(\n\t\t\tcurrentEdit.failure === undefined,\n\t\t\t0x66d /* Cannot close a transaction that has already failed. Use abortEdit instead. */\n\t\t);\n\n\t\tconst editingResult = currentEdit.close();\n\t\tthis.validateChangesApplied(editingResult);\n\t\tconst id: EditId = newEditId();\n\t\tthis.handleNewEdit(id, editingResult);\n\t\treturn id;\n\t}\n\n\tprivate validateChangesApplied(result: EditingResult): asserts result is ValidEditingResult;\n\tprivate validateChangesApplied(result: {\n\t\tstatus: EditStatus;\n\t\tfailure: TransactionInternal.Failure | undefined;\n\t}): asserts result is { status: EditStatus.Applied; failure: undefined };\n\tprivate validateChangesApplied(\n\t\tresult: EditingResult | { status: EditStatus; failure: TransactionInternal.Failure | undefined }\n\t): void {\n\t\tif (result.status === EditStatus.Applied) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { failure } = result as { failure: TransactionInternal.Failure };\n\t\tconst additionalProps: ITelemetryBaseProperties = {};\n\t\tswitch (failure.kind) {\n\t\t\tcase TransactionInternal.FailureKind.BadPlace:\n\t\t\t\tadditionalProps.placeFailure = failure.placeFailure;\n\t\t\t\tbreak;\n\t\t\tcase TransactionInternal.FailureKind.BadRange: {\n\t\t\t\tconst { rangeFailure } = failure;\n\t\t\t\tif (typeof rangeFailure === 'string') {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure;\n\t\t\t\t} else {\n\t\t\t\t\tadditionalProps.rangeFailure = rangeFailure.kind;\n\t\t\t\t\tadditionalProps.rangeEndpointFailure = rangeFailure.placeFailure;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.logger.sendErrorEvent({\n\t\t\teventName: 'FailedLocalEdit',\n\t\t\tstatus: result.status === 0 ? 'Malformed' : 'Invalid',\n\t\t\tfailureKind: failure.kind,\n\t\t\t...additionalProps,\n\t\t});\n\t\tfail('Locally constructed edits must be well-formed and valid.');\n\t}\n\n\t/**\n\t * Inform the Checkout that a particular edit is know to have a specific result when applied to a particular TreeView.\n\t * This may be used as a caching hint to avoid recomputation.\n\t */\n\tprotected hintKnownEditingResult(edit: Edit<ChangeInternal>, result: ValidEditingResult): void {\n\t\t// As an optimization, inform logViewer of this editing result so it can reuse it if applied to the same before revision.\n\t\tthis.cachingLogViewer?.setKnownEditingResult(edit, result);\n\t}\n\n\t/**\n\t * Take any needed action between when an edit is completed.\n\t * Usually this will include submitting it to a SharedTree.\n\t *\n\t * Override this to customize.\n\t */\n\tprotected handleNewEdit(id: EditId, result: ValidEditingResult): void {\n\t\tconst edit: Edit<ChangeInternal> = { id, changes: result.changes };\n\n\t\tthis.hintKnownEditingResult(edit, result);\n\n\t\t// Since external edits could have been applied while currentEdit was pending,\n\t\t// do not use the produced view: just go to the newest revision\n\t\t// (which processLocalEdit will do, including invalidation).\n\t\tthis.tree.applyEditInternal(edit);\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tpublic applyChanges(changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: readonly Change[]): void;\n\tpublic applyChanges(...changes: RestOrArray<Change>): void {\n\t\tassert(this.currentEdit !== undefined, 0x602 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tthis.validateChangesApplied({ status, failure: this.currentEdit.failure });\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * Applies the supplied changes to the tree and emits a change event.\n\t * Must be called during an ongoing edit (see `openEdit()`/`closeEdit()`).\n\t * `changes` must be well-formed and valid: it is an error if they do not apply cleanly.\n\t */\n\tprotected tryApplyChangesInternal(changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: readonly ChangeInternal[]): EditStatus;\n\tprotected tryApplyChangesInternal(...changes: RestOrArray<ChangeInternal>): EditStatus {\n\t\tassert(this.currentEdit !== undefined, 0x603 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray);\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t}\n\t\treturn status;\n\t}\n\n\t/**\n\t * Convenience helper for applying an edit containing the given changes.\n\t * Opens an edit, applies the given changes, and closes the edit. See (`openEdit()`/`applyChanges()`/`closeEdit()`).\n\t */\n\tpublic applyEdit(changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: readonly Change[]): EditId;\n\tpublic applyEdit(...changes: RestOrArray<Change>): EditId {\n\t\tthis.openEdit();\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tthis.applyChanges(changeArray);\n\t\treturn this.closeEdit();\n\t}\n\n\t/**\n\t * Apply an edit, if valid, otherwise does nothing (the edit is not added to the history).\n\t * If the edit applied, its changes will be immediately visible on this checkout, though it still may end up invalid once sequenced due to concurrent edits.\n\t * @returns The EditId if the edit was valid and thus applied, and undefined if it was invalid and thus not applied.\n\t */\n\tpublic tryApplyEdit(changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: readonly Change[]): EditId | undefined;\n\tpublic tryApplyEdit(...changes: RestOrArray<Change>): EditId | undefined {\n\t\tthis.openEdit();\n\n\t\tassert(this.currentEdit !== undefined, 0x604 /* Changes must be applied as part of an ongoing edit. */);\n\t\tconst changeArray = unwrapRestOrArray(changes);\n\t\tconst { status } = this.currentEdit.applyChanges(changeArray.map((c) => this.tree.internalizeChange(c)));\n\t\tif (status === EditStatus.Applied) {\n\t\t\tthis.emitChange();\n\t\t\treturn this.closeEdit();\n\t\t}\n\n\t\tthis.abortEdit();\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * Rebases the ongoing edit to the latest revision loaded by this 'Checkout'.\n\t *\n\t * If the rebase succeeds (none of the changes in the ongoing edit became invalid), the ongoing edit will remain open and the current\n\t * view will reflect those changes.\n\t *\n\t * If the rebase fails (changes become invalid), the ongoing edit will be aborted and\n\t * currentView will return to showing the newest committed revision as it always does when there is no ongoing edit.\n\t *\n\t * Must only be called during an open edit.\n\t *\n\t * @returns The result of the rebase.\n\t */\n\tpublic rebaseCurrentEdit(): EditValidationResult.Valid | EditValidationResult.Invalid {\n\t\tassert(this.currentEdit !== undefined, 0x605 /* An edit is not open. */);\n\t\tassert(this.currentEdit.status === EditStatus.Applied, 0x606 /* Local edits should always be valid. */);\n\t\t// When closed, the result might indicate Malformed due to unused detached entities.\n\t\t// This is not an error, as the edit was still open and can still use those entities.\n\t\tconst priorResults = this.currentEdit.close();\n\t\tconst rebasedEdit = TransactionInternal.factory(this.latestCommittedView).applyChanges(priorResults.changes);\n\t\tassert(\n\t\t\trebasedEdit.status !== EditStatus.Malformed,\n\t\t\t0x607 /* Malformed changes should have been caught on original application. */\n\t\t);\n\t\tlet status: EditValidationResult.Valid | EditValidationResult.Invalid;\n\t\tif (rebasedEdit.status === EditStatus.Invalid) {\n\t\t\tstatus = EditValidationResult.Invalid;\n\t\t\tthis.currentEdit = undefined;\n\t\t} else {\n\t\t\tstatus = EditValidationResult.Valid;\n\t\t\tthis.currentEdit = rebasedEdit;\n\t\t}\n\t\tthis.emitChange();\n\t\treturn status;\n\t}\n\n\t/**\n\t * Ends the ongoing edit operation without committing it to the history.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic abortEdit(): void {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x608 /* An edit is not open. */);\n\t\tthis.currentEdit = undefined;\n\t\tthis.emitChange();\n\t}\n\n\t/**\n\t * @returns the {@link EditStatus} of the current edit.\n\t * Has no side effects.\n\t * Can only be called if an edit is open.\n\t */\n\tpublic getEditStatus(): EditStatus {\n\t\tconst { currentEdit } = this;\n\t\tassert(currentEdit !== undefined, 0x609 /* An edit is not open. */);\n\t\t// TODO: could this ever be anything other than 'Applied'\n\t\t// TODO: shouldn't this be an EditValidationResult since 'Applied' does not indicate the edit has been applied?\n\t\treturn currentEdit.status;\n\t}\n\n\t/**\n\t * Reverts a collection of edits.\n\t * @param editIds - the edits to revert\n\t */\n\tpublic revert(editId: EditId): void {\n\t\tassertWithMessage(this.currentEdit !== undefined);\n\t\tconst index = this.tree.edits.getIndexOfId(editId);\n\t\tconst edit =\n\t\t\tthis.tree.edits.tryGetEditAtIndex(index) ?? fail('Edit with the specified ID does not exist in memory');\n\t\tconst before = this.tree.logViewer.getRevisionViewInMemory(index);\n\t\tconst changes = this.tree.revertChanges(edit.changes, before);\n\t\tif (changes !== undefined) {\n\t\t\tthis.tryApplyChangesInternal(changes);\n\t\t}\n\t}\n\n\t/**\n\t * Send invalidation message for all changes since last call to emitChange.\n\t * This must be called every time `currentView` could have changed.\n\t * It is ok to make excessive calls to this: change notifications will be cheaply de-duplicated.\n\t */\n\tprotected emitChange(): void {\n\t\tconst current = this.currentView;\n\t\tconst previous = this.previousView;\n\t\tif (!previous.hasEqualForest(current, true)) {\n\t\t\t// Set previousView before calling emit to make reentrant case work (where the event handler causes an edit).\n\t\t\tthis.previousView = current;\n\t\t\tthis.emit(CheckoutEvent.ViewChange, previous, current);\n\t\t}\n\t}\n\n\t/**\n\t * @returns a Promise which completes after all currently known edits are available in this checkout.\n\t */\n\tpublic abstract waitForPendingUpdates(): Promise<void>;\n\n\t/**\n\t * @returns a Promise which completes after edits that were closed on this checkout (before calling this) have been\n\t * submitted to Fluid. This does NOT wait for the Fluid service to ack them\n\t */\n\tpublic abstract waitForEditsToSubmit(): Promise<void>;\n\n\t/**\n\t * release all unmanaged resources\n\t * e.g. unregister event listeners\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tif (this.disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.disposed = true;\n\n\t\t// remove registered listener\n\t\tthis.tree.off(SharedTreeEvent.EditCommitted, this.editCommittedHandler);\n\t}\n}\n"]}
|
package/lib/Common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAIlD;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE;;GAEG;AACH,MAAM,W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AAM,KAAN,MAAM,QAqFtB;AAsDD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;AAChC,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,SAAS,CACxB,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;AAC/B,CAAC;AASD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAI,KAAmD;IACvF,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,KAAa,CAAC;AAClF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { BTree } from '@tylerbu/sorted-btree-es6';\n\nconst defaultFailMessage = 'Assertion failed';\n\n/**\n * Assertion failures in SharedTree will throw an exception containing this value as an `errorType`. The Fluid runtime propagates this field\n * in its handlings of errors thrown by containers. See\n * https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-utils/src/error.ts\n *\n * Exporting this enables users to safely filter telemetry handling of errors based on their type.\n * @internal\n */\nexport const sharedTreeAssertionErrorType = 'SharedTreeAssertion';\n\n/**\n * Telemetry properties decorated on all SharedTree events.\n */\nexport interface SharedTreeTelemetryProperties extends ITelemetryBaseProperties {\n\treadonly isSharedTreeEvent: true;\n}\n\n/**\n * Returns if the supplied event is a SharedTree telemetry event.\n * @internal\n */\nexport function isSharedTreeEvent(event: ITelemetryBaseEvent): boolean {\n\treturn (event as unknown as SharedTreeTelemetryProperties).isSharedTreeEvent === true;\n}\n\n/**\n * Error object thrown by assertion failures in `SharedTree`.\n */\nclass SharedTreeAssertionError extends Error {\n\tpublic readonly errorType = sharedTreeAssertionErrorType;\n\n\tpublic constructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'Assertion error';\n\t\t// Note: conditional as `captureStackTrace` isn't defined in all browsers (e.g. Safari).\n\t\tError.captureStackTrace?.(this);\n\t}\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * A numeric comparator used for sorting in descending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbersReversed<T extends number>(a: T, b: T): number {\n\treturn b - a;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Asserts against a boolean condition. Throws an Error if the assertion failed. Will run and throw in release builds.\n * Use when violations are logic errors in the program.\n * @param condition - A condition to assert is truthy\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param notLogSafe - boolean flag for whether the message passed in contains data that shouldn't be logged for privacy reasons.\n *\n * @remarks\n * To avoid collisions with assertShortCode tagging in Fluid Framework, this cannot be named \"assert\".\n * When a non constant message is not needed, use `assert` from `@fluidframework/core-utils`;\n */\nexport function assertWithMessage(condition: unknown, message?: string, notLogSafe = false): asserts condition {\n\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\tif (!condition) {\n\t\tfail(message, notLogSafe);\n\t}\n}\n\n/**\n * Fails an assertion. Throws an Error that the assertion failed.\n * Use when violations are logic errors in the program.\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param notLogSafe - boolean flag for whether the message passed in contains data that shouldn't be logged for privacy reasons.\n */\nexport function fail(message: string = defaultFailMessage, notLogSafe = false): never {\n\tif (process.env.NODE_ENV !== 'production') {\n\t\tdebugger;\n\t\tconsole.error(message);\n\t}\n\n\tthrow new SharedTreeAssertionError(notLogSafe ? 'Assertion failed' : message);\n}\n\n/**\n * Asserts a value is not undefined, and returns the value.\n * Use when violations are logic errors in the program.\n *\n * @remarks\n * When practical, prefer the pattern `x ?? fail('message')` over `assertNotUndefined(x, 'message')`.\n * Using `?? fail` allows for message formatting without incurring the cost of formatting the message\n * in the non failing case.\n *\n * Example:\n * ```typescript\n * x ?? fail(`x should exist for ${y}`)\n * ```\n *\n * Additionally the `?? fail` avoids an extra call/stack frame in the non failing case.\n *\n * Another pattern to prefer over `assertNotUndefined(x, 'message')` is `assert(x !== undefined)`.\n * This pattern is preferred because it is more general (same approach works with typeof, instance of,\n * comparison to other values etc.).\n *\n * @param value - Value to assert against is non undefined.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertNotUndefined<T>(value: T | undefined, message = 'value must not be undefined'): T {\n\tassertWithMessage(value !== undefined, message);\n\treturn value;\n}\n\n/**\n * Asserts an array contains a single value and returns the value.\n * @param array - Array to assert contains a single value.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertArrayOfOne<T>(array: readonly T[], message = 'array value must contain exactly one item'): T {\n\tassertWithMessage(array.length === 1, message);\n\treturn array[0];\n}\n\n/**\n * Redefine a property to have the given value. This is simply a type-safe wrapper around\n * `Object.defineProperty`, but it is useful for caching public getters on first read.\n *\n * @example\n *\n * ```typescript\n * // `randomOnce()` will return a random number, but always the same random number.\n * {\n * get randomOnce(): number {\n * return memoizeGetter(this, 'randomOnce', random(100))\n * }\n * }\n * ```\n *\n * @param object - The object containing the property\n * @param propName - The name of the property on the object\n * @param value - The value of the property\n */\nexport function memoizeGetter<T, K extends keyof T>(object: T, propName: K, value: T[K]): T[K] {\n\tObject.defineProperty(object, propName, {\n\t\tvalue,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n\n\treturn value;\n}\n\n/**\n * Map an iterable to another iterable\n */\nexport function* map<T, R>(sequence: Iterable<T>, mapper: (t: T) => R): Iterable<R> {\n\tfor (const t of sequence) {\n\t\tyield mapper(t);\n\t}\n}\n\n/**\n * Filter an iterable into another iterable\n */\nexport function* filter<T>(sequence: Iterable<T>, filter: (t: T) => boolean): Iterable<T> {\n\tfor (const t of sequence) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Reduce an iterable into a single value, or undefined if the iterable has too few elements to reduce\n */\nexport function reduce<T>(\n\tsequence: Iterable<T>,\n\treduce: (previous: T, current: T) => T,\n\tinitialValue?: T\n): T | undefined {\n\tlet previous: T | undefined;\n\tlet current: T | undefined;\n\tfor (const t of sequence) {\n\t\tcurrent = t;\n\t\tif (previous === undefined) {\n\t\t\tif (initialValue !== undefined) {\n\t\t\t\tcurrent = reduce(initialValue, current);\n\t\t\t}\n\t\t} else {\n\t\t\tcurrent = reduce(previous, current);\n\t\t}\n\t\tprevious = current;\n\t}\n\treturn current;\n}\n\n/**\n * Returns the first element of the given sequence that satisfies the given predicate, or undefined if no such element exists\n */\nexport function find<T>(sequence: Iterable<T>, find: (t: T) => boolean): T | undefined {\n\tfor (const t of sequence) {\n\t\tif (find(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Iterate through two iterables and return true if they yield equivalent elements in the same order.\n * @param iterableA - The first iterable to compare\n * @param iterableB - The second iterable to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareIterables<T>(\n\titerableA: Iterable<T>,\n\titerableB: Iterable<T>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\treturn compareIterators<T>(iterableA[Symbol.iterator](), iterableB[Symbol.iterator](), elementComparator);\n}\n\n/**\n * Iterate through two iterators and return true if they yield equivalent elements in the same order.\n * @param iteratorA - The first iterator to compare\n * @param iteratorB - The second iterator to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nfunction compareIterators<T, TReturn extends T = T>(\n\titeratorA: Iterator<T, TReturn>,\n\titeratorB: Iterator<T, TReturn>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\tlet a: IteratorResult<T, TReturn>;\n\tlet b: IteratorResult<T, TReturn>;\n\tfor (\n\t\ta = iteratorA.next(), b = iteratorB.next(); // Given two iterators...\n\t\ta.done !== true && b.done !== true; // ...while both have elements remaining...\n\t\ta = iteratorA.next(), b = iteratorB.next() // ...take one element at a time from each...\n\t) {\n\t\t// ...and ensure that their elements are equivalent\n\t\tif (!elementComparator(a.value, b.value)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// If one iterator is done, but not the other, then they are not equivalent\n\treturn a.done === b.done;\n}\n\n/**\n * Compare two maps and return true if their contents are equivalent.\n * @param mapA - The first array to compare\n * @param mapB - The second array to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareMaps<K, V>(\n\tmapA: ReadonlyMap<K, V>,\n\tmapB: ReadonlyMap<K, V>,\n\telementComparator: (a: V, b: V) => boolean = Object.is\n): boolean {\n\tif (mapA.size !== mapB.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [keyA, valueA] of mapA) {\n\t\tconst valueB = mapB.get(keyA);\n\t\tif (valueB === undefined || !elementComparator(valueA, valueB)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(map: Map<K, V>, key: K, defaultValue: (key: K) => V): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Function which does nothing (no-ops).\n */\nexport function noop(): void {\n\t// noop\n}\n\n/**\n * Function which returns its input\n */\nexport function identity<T>(t: T): T {\n\treturn t;\n}\n\n/**\n * Copies a property in such a way that it is only set on `destination` if it is present on `source`.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function copyPropertyIfDefined<TSrc, TDst>(source: TSrc, destination: TDst, property: keyof TSrc): void {\n\tconst value = source[property];\n\tif (value !== undefined) {\n\t\t(destination as any)[property] = value;\n\t}\n}\n\n/**\n * Sets a property in such a way that it is only set on `destination` if the provided value is not undefined.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function setPropertyIfDefined<TDst, P extends keyof TDst>(\n\tvalue: TDst[P] | undefined,\n\tdestination: TDst,\n\tproperty: P\n): void {\n\tif (value !== undefined) {\n\t\tdestination[property] = value;\n\t}\n}\n\n/**\n * @example\n *\n * ```typescript\n * function (thing: ObjectWithMaybeFoo) {\n * \t const x: MyActualType = {\n * \t bar: 3\n * };\n * \t\tx.foo = 3;\n *\n * \t copyPropertyIfDefined(thing, x, 'foo');\n * }\n * ```\n */\nfunction breakOnDifference(): { break: boolean } {\n\treturn { break: true };\n}\n\n/**\n * Helper that returns whether two b-trees are equal.\n * Accelerated when large portions of the tree are shared between the two.\n */\nexport function compareBtrees<K, V>(treeA: BTree<K, V>, treeB: BTree<K, V>, compare: (valA: V, valB: V) => boolean) {\n\tconst diff = treeA.diffAgainst(treeB, breakOnDifference, breakOnDifference, (_, valA, valB) => {\n\t\tif (!compare(valA, valB)) {\n\t\t\treturn { break: true };\n\t\t}\n\t\treturn undefined;\n\t});\n\n\treturn diff === undefined;\n}\n\nexport function backmap<K, V>(forwardmap: Map<V, K>): Map<K, V> {\n\treturn new Map(map(forwardmap, ([key, value]) => [value, key]));\n}\n\n/**\n * A developer facing (non-localized) error message.\n * TODO: better error system.\n */\nexport type ErrorString = string;\n\n/**\n * Discriminated union instance that wraps either a result of type `TOk` or an error of type `TError`.\n * @internal\n */\nexport type Result<TOk, TError> = Result.Ok<TOk> | Result.Error<TError>;\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Result {\n\t/**\n\t * Factory function for making a successful Result.\n\t * @param result - The result to wrap in the Result.\n\t * @internal\n\t */\n\texport function ok<TOk>(result: TOk): Ok<TOk> {\n\t\treturn { type: ResultType.Ok, result };\n\t}\n\t/**\n\t * Factory function for making a unsuccessful Result.\n\t * @param error - The error to wrap in the Result.\n\t * @internal\n\t */\n\texport function error<TError>(error: TError): Error<TError> {\n\t\treturn { type: ResultType.Error, error };\n\t}\n\t/**\n\t * Type guard for successful Result.\n\t * @returns True if `result` is successful.\n\t * @internal\n\t */\n\texport function isOk<TOk, TError>(result: Result<TOk, TError>): result is Ok<TOk> {\n\t\treturn result.type === ResultType.Ok;\n\t}\n\t/**\n\t * Type guard for unsuccessful Result.\n\t * @returns True if `result` is unsuccessful.\n\t * @internal\n\t */\n\texport function isError<TOk, TError>(result: Result<TOk, TError>): result is Error<TError> {\n\t\treturn result.type === ResultType.Error;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is ok.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new result.\n\t * @returns The given result if it is not ok, the mapped result otherwise.\n\t * @internal\n\t */\n\texport function mapOk<TOkIn, TOkOut, TError>(\n\t\tresult: Result<TOkIn, TError>,\n\t\tmap: (ok: TOkIn) => TOkOut\n\t): Result<TOkOut, TError> {\n\t\treturn isOk(result) ? ok(map(result.result)) : result;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is an error.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new error.\n\t * @returns The given result if it is ok, the mapped result otherwise.\n\t * @internal\n\t */\n\texport function mapError<TOk, TErrorIn, TErrorOut>(\n\t\tresult: Result<TOk, TErrorIn>,\n\t\tmap: (error: TErrorIn) => TErrorOut\n\t): Result<TOk, TErrorOut> {\n\t\treturn isError(result) ? error(map(result.error)) : result;\n\t}\n\t/**\n\t * Tag value use to differentiate the members of the `Result` discriminated union.\n\t * @internal\n\t */\n\texport enum ResultType {\n\t\t/** Signals a successful result. */\n\t\tOk,\n\t\t/** Signals an unsuccessful result. */\n\t\tError,\n\t}\n\t/**\n\t * Wraps a result of type `TOk`.\n\t * @internal\n\t */\n\texport interface Ok<TOk> {\n\t\treadonly type: ResultType.Ok;\n\t\treadonly result: TOk;\n\t}\n\t/**\n\t * Wraps an error of type `TError`.\n\t * @internal\n\t */\n\texport interface Error<TError> {\n\t\treadonly type: ResultType.Error;\n\t\treadonly error: TError;\n\t}\n}\n\n/** Type that removes `readonly` from fields. */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/** Type that recursively removes `readonly` from fields. */\nexport type RecursiveMutable<T> = {\n\t-readonly [K in keyof T]: RecursiveMutable<T[K]>;\n};\n\n/** Type that produces a writeable map from a readonly map. */\nexport type MutableMap<T extends ReadonlyMap<unknown, unknown>> = T extends ReadonlyMap<infer K, infer V>\n\t? Map<K, V>\n\t: never;\n\n/** Type that includes the property K: V on T */\nexport type With<T, K extends keyof never, V> = T & { [key in K]: V };\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, 'delete' | 'clear'> {\n\tget(key: K): V;\n}\n\n/**\n * Change the given property Prop of type T to have a type of TPropNew\n */\nexport type ChangePropType<T, Prop extends keyof T, TPropNew> = Omit<T, Prop> & {\n\t[_ in Prop]: TPropNew;\n};\n\n// eslint-disable-next-line @rushstack/no-new-null\ntype Primitive = string | number | bigint | boolean | null | symbol | undefined;\n\n/**\n * Recursively replace all properties with type assignable to type TReplace in T with properties of type TWith.\n */\nexport type ReplaceRecursive<T, TReplace, TWith> = T extends TReplace\n\t? TWith\n\t: T extends Primitive\n\t\t? T\n\t\t: {\n\t\t\t\t[P in keyof T]: ReplaceRecursive<T[P], TReplace, TWith>;\n\t\t\t};\n\n/** A union type of the first `N` positive integers */\nexport type TakeWholeNumbers<N extends number, A extends never[] = []> = N extends A['length']\n\t? never\n\t: A['length'] | TakeWholeNumbers<N, [never, ...A]>;\n/** Returns a tuple type with exactly `Length` elements of type `T` */\nexport type ArrayOfLength<T, Length extends number, A extends T[] = []> = Length extends A['length']\n\t? A\n\t: ArrayOfLength<T, Length, [T, ...A]>;\n/**\n * Fails if `array` does not have exactly `length` elements\n */\nexport function hasExactlyLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is ArrayOfLength<T, Len> {\n\treturn array.length === length;\n}\n/**\n * Fails if `array` does not have at least `length` elements\n */\nexport function hasLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is [...ArrayOfLength<T, Len>, ...T[]] {\n\treturn array.length >= length;\n}\n\n/**\n * Type for a rest parameter which can accept many values, or a single array.\n * Since a callee cannot modify an array passed as a rest parameter with the spread operator,\n * an array passed directly should be readonly for consistency (caller retains ownership).\n */\nexport type RestOrArray<T> = readonly T[] | [readonly T[]];\n\n/**\n * When value is a one-element array containing another array, unwraps and returns the inner array.\n * Otherwise, returns the provided array.\n * Useful for implementing functions with a `RestOrArray` parameter.\n * T must not be implemented with an array (`Array.isArray(t)` must return false)\n */\nexport function unwrapRestOrArray<T>(value: [any[]] extends [T] ? never : RestOrArray<T>): readonly T[] {\n\treturn value.length === 1 && Array.isArray(value[0]) ? value[0] : (value as T[]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC;AASlE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA0B;IAC3D,OAAQ,KAAkD,CAAC,iBAAiB,KAAK,IAAI,CAAC;AACvF,CAAC;AAED;;GAEG;AAC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,CAAC;IAC5D,CAAC;IALe,eAAQ,WAKvB,CAAA;IACD;;;OAGG;IACH,IAAY,UAKX;IALD,WAAY,UAAU;QACrB,mCAAmC;QACnC,uCAAE,CAAA;QACF,sCAAsC;QACtC,6CAAK,CAAA;IACN,CAAC,EALW,UAAU,GAAV,iBAAU,KAAV,iBAAU,QAKrB;AAiBF,CAAC,EArFgB,MAAM,KAAN,MAAM,QAqFtB;AAsDD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC/B,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC;AAChC,CAAC;AACD;;GAEG;AACH,MAAM,UAAU,SAAS,CACxB,KAAmB,EACnB,MAAW;IAEX,OAAO,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC;AAC/B,CAAC;AASD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAI,KAAmD;IACvF,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,KAAa,CAAC;AAClF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseEvent, ITelemetryBaseProperties } from '@fluidframework/core-interfaces';\nimport { BTree } from '@tylerbu/sorted-btree-es6';\n\nconst defaultFailMessage = 'Assertion failed';\n\n/**\n * Assertion failures in SharedTree will throw an exception containing this value as an `errorType`. The Fluid runtime propagates this field\n * in its handlings of errors thrown by containers. See\n * https://github.com/microsoft/FluidFramework/blob/main/packages/loader/container-utils/src/error.ts\n *\n * Exporting this enables users to safely filter telemetry handling of errors based on their type.\n * @internal\n */\nexport const sharedTreeAssertionErrorType = 'SharedTreeAssertion';\n\n/**\n * Telemetry properties decorated on all SharedTree events.\n */\nexport interface SharedTreeTelemetryProperties extends ITelemetryBaseProperties {\n\treadonly isSharedTreeEvent: true;\n}\n\n/**\n * Returns if the supplied event is a SharedTree telemetry event.\n * @internal\n */\nexport function isSharedTreeEvent(event: ITelemetryBaseEvent): boolean {\n\treturn (event as unknown as SharedTreeTelemetryProperties).isSharedTreeEvent === true;\n}\n\n/**\n * Error object thrown by assertion failures in `SharedTree`.\n */\nclass SharedTreeAssertionError extends Error {\n\tpublic readonly errorType = sharedTreeAssertionErrorType;\n\n\tpublic constructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'Assertion error';\n\t\t// Note: conditional as `captureStackTrace` isn't defined in all browsers (e.g. Safari).\n\t\tError.captureStackTrace?.(this);\n\t}\n}\n\n/**\n * A numeric comparator used for sorting in ascending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbers<T extends number>(a: T, b: T): number {\n\treturn a - b;\n}\n\n/**\n * A numeric comparator used for sorting in descending order.\n *\n * Handles +/-0 like Map: -0 is equal to +0.\n */\nexport function compareFiniteNumbersReversed<T extends number>(a: T, b: T): number {\n\treturn b - a;\n}\n\n/**\n * Compares strings lexically to form a strict partial ordering.\n */\nexport function compareStrings<T extends string>(a: T, b: T): number {\n\treturn a > b ? 1 : a === b ? 0 : -1;\n}\n\n/**\n * Asserts against a boolean condition. Throws an Error if the assertion failed. Will run and throw in release builds.\n * Use when violations are logic errors in the program.\n * @param condition - A condition to assert is truthy\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param notLogSafe - boolean flag for whether the message passed in contains data that shouldn't be logged for privacy reasons.\n *\n * @remarks\n * To avoid collisions with assertShortCode tagging in Fluid Framework, this cannot be named \"assert\".\n * When a non constant message is not needed, use `assert` from `@fluidframework/core-utils`;\n */\nexport function assertWithMessage(condition: unknown, message?: string, notLogSafe = false): asserts condition {\n\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\tif (!condition) {\n\t\tfail(message, notLogSafe);\n\t}\n}\n\n/**\n * Fails an assertion. Throws an Error that the assertion failed.\n * Use when violations are logic errors in the program.\n * @param message - Message to be printed if assertion fails. Will print \"Assertion failed\" by default\n * @param notLogSafe - boolean flag for whether the message passed in contains data that shouldn't be logged for privacy reasons.\n */\nexport function fail(message: string = defaultFailMessage, notLogSafe = false): never {\n\tif (process.env.NODE_ENV !== 'production') {\n\t\tdebugger;\n\t\tconsole.error(message);\n\t}\n\n\tthrow new SharedTreeAssertionError(notLogSafe ? 'Assertion failed' : message);\n}\n\n/**\n * Asserts a value is not undefined, and returns the value.\n * Use when violations are logic errors in the program.\n *\n * @remarks\n * When practical, prefer the pattern `x ?? fail('message')` over `assertNotUndefined(x, 'message')`.\n * Using `?? fail` allows for message formatting without incurring the cost of formatting the message\n * in the non failing case.\n *\n * Example:\n * ```typescript\n * x ?? fail(`x should exist for ${y}`)\n * ```\n *\n * Additionally the `?? fail` avoids an extra call/stack frame in the non failing case.\n *\n * Another pattern to prefer over `assertNotUndefined(x, 'message')` is `assert(x !== undefined)`.\n * This pattern is preferred because it is more general (same approach works with typeof, instance of,\n * comparison to other values etc.).\n *\n * @param value - Value to assert against is non undefined.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertNotUndefined<T>(value: T | undefined, message = 'value must not be undefined'): T {\n\tassertWithMessage(value !== undefined, message);\n\treturn value;\n}\n\n/**\n * Asserts an array contains a single value and returns the value.\n * @param array - Array to assert contains a single value.\n * @param message - Message to be printed if assertion fails.\n */\nexport function assertArrayOfOne<T>(array: readonly T[], message = 'array value must contain exactly one item'): T {\n\tassertWithMessage(array.length === 1, message);\n\treturn array[0];\n}\n\n/**\n * Redefine a property to have the given value. This is simply a type-safe wrapper around\n * `Object.defineProperty`, but it is useful for caching public getters on first read.\n *\n * @example\n *\n * ```typescript\n * // `randomOnce()` will return a random number, but always the same random number.\n * {\n * get randomOnce(): number {\n * return memoizeGetter(this, 'randomOnce', random(100))\n * }\n * }\n * ```\n *\n * @param object - The object containing the property\n * @param propName - The name of the property on the object\n * @param value - The value of the property\n */\nexport function memoizeGetter<T, K extends keyof T>(object: T, propName: K, value: T[K]): T[K] {\n\tObject.defineProperty(object, propName, {\n\t\tvalue,\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t});\n\n\treturn value;\n}\n\n/**\n * Map an iterable to another iterable\n */\nexport function* map<T, R>(sequence: Iterable<T>, mapper: (t: T) => R): Iterable<R> {\n\tfor (const t of sequence) {\n\t\tyield mapper(t);\n\t}\n}\n\n/**\n * Filter an iterable into another iterable\n */\nexport function* filter<T>(sequence: Iterable<T>, filter: (t: T) => boolean): Iterable<T> {\n\tfor (const t of sequence) {\n\t\tif (filter(t)) {\n\t\t\tyield t;\n\t\t}\n\t}\n}\n\n/**\n * Reduce an iterable into a single value, or undefined if the iterable has too few elements to reduce\n */\nexport function reduce<T>(\n\tsequence: Iterable<T>,\n\treduce: (previous: T, current: T) => T,\n\tinitialValue?: T\n): T | undefined {\n\tlet previous: T | undefined;\n\tlet current: T | undefined;\n\tfor (const t of sequence) {\n\t\tcurrent = t;\n\t\tif (previous === undefined) {\n\t\t\tif (initialValue !== undefined) {\n\t\t\t\tcurrent = reduce(initialValue, current);\n\t\t\t}\n\t\t} else {\n\t\t\tcurrent = reduce(previous, current);\n\t\t}\n\t\tprevious = current;\n\t}\n\treturn current;\n}\n\n/**\n * Returns the first element of the given sequence that satisfies the given predicate, or undefined if no such element exists\n */\nexport function find<T>(sequence: Iterable<T>, find: (t: T) => boolean): T | undefined {\n\tfor (const t of sequence) {\n\t\tif (find(t)) {\n\t\t\treturn t;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Iterate through two iterables and return true if they yield equivalent elements in the same order.\n * @param iterableA - The first iterable to compare\n * @param iterableB - The second iterable to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareIterables<T>(\n\titerableA: Iterable<T>,\n\titerableB: Iterable<T>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\treturn compareIterators<T>(iterableA[Symbol.iterator](), iterableB[Symbol.iterator](), elementComparator);\n}\n\n/**\n * Iterate through two iterators and return true if they yield equivalent elements in the same order.\n * @param iteratorA - The first iterator to compare\n * @param iteratorB - The second iterator to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nfunction compareIterators<T, TReturn extends T = T>(\n\titeratorA: Iterator<T, TReturn>,\n\titeratorB: Iterator<T, TReturn>,\n\telementComparator: (a: T, b: T) => boolean = Object.is\n): boolean {\n\tlet a: IteratorResult<T, TReturn>;\n\tlet b: IteratorResult<T, TReturn>;\n\tfor (\n\t\ta = iteratorA.next(), b = iteratorB.next(); // Given two iterators...\n\t\ta.done !== true && b.done !== true; // ...while both have elements remaining...\n\t\ta = iteratorA.next(), b = iteratorB.next() // ...take one element at a time from each...\n\t) {\n\t\t// ...and ensure that their elements are equivalent\n\t\tif (!elementComparator(a.value, b.value)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// If one iterator is done, but not the other, then they are not equivalent\n\treturn a.done === b.done;\n}\n\n/**\n * Compare two maps and return true if their contents are equivalent.\n * @param mapA - The first array to compare\n * @param mapB - The second array to compare\n * @param elementComparator - The function used to check if two `T`s are equivalent.\n * Defaults to `Object.is()` equality (a shallow compare)\n */\nexport function compareMaps<K, V>(\n\tmapA: ReadonlyMap<K, V>,\n\tmapB: ReadonlyMap<K, V>,\n\telementComparator: (a: V, b: V) => boolean = Object.is\n): boolean {\n\tif (mapA.size !== mapB.size) {\n\t\treturn false;\n\t}\n\n\tfor (const [keyA, valueA] of mapA) {\n\t\tconst valueB = mapB.get(keyA);\n\t\tif (valueB === undefined || !elementComparator(valueA, valueB)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Retrieve a value from a map with the given key, or create a new entry if the key is not in the map.\n * @param map - The map to query/update\n * @param key - The key to lookup in the map\n * @param defaultValue - a function which returns a default value. This is called and used to set an initial value for the given key in the map if none exists\n * @returns either the existing value for the given key, or the newly-created value (the result of `defaultValue`)\n */\nexport function getOrCreate<K, V>(map: Map<K, V>, key: K, defaultValue: (key: K) => V): V {\n\tlet value = map.get(key);\n\tif (value === undefined) {\n\t\tvalue = defaultValue(key);\n\t\tmap.set(key, value);\n\t}\n\treturn value;\n}\n\n/**\n * Function which does nothing (no-ops).\n */\nexport function noop(): void {\n\t// noop\n}\n\n/**\n * Function which returns its input\n */\nexport function identity<T>(t: T): T {\n\treturn t;\n}\n\n/**\n * Copies a property in such a way that it is only set on `destination` if it is present on `source`.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function copyPropertyIfDefined<TSrc, TDst>(source: TSrc, destination: TDst, property: keyof TSrc): void {\n\tconst value = source[property];\n\tif (value !== undefined) {\n\t\t(destination as any)[property] = value;\n\t}\n}\n\n/**\n * Sets a property in such a way that it is only set on `destination` if the provided value is not undefined.\n * This avoids having explicit undefined values under properties that would cause `Object.hasOwnProperty` to return true.\n */\nexport function setPropertyIfDefined<TDst, P extends keyof TDst>(\n\tvalue: TDst[P] | undefined,\n\tdestination: TDst,\n\tproperty: P\n): void {\n\tif (value !== undefined) {\n\t\tdestination[property] = value;\n\t}\n}\n\n/**\n * @example\n *\n * ```typescript\n * function (thing: ObjectWithMaybeFoo) {\n * \t const x: MyActualType = {\n * \t bar: 3\n * };\n * \t\tx.foo = 3;\n *\n * \t copyPropertyIfDefined(thing, x, 'foo');\n * }\n * ```\n */\nfunction breakOnDifference(): { break: boolean } {\n\treturn { break: true };\n}\n\n/**\n * Helper that returns whether two b-trees are equal.\n * Accelerated when large portions of the tree are shared between the two.\n */\nexport function compareBtrees<K, V>(\n\ttreeA: BTree<K, V>,\n\ttreeB: BTree<K, V>,\n\tcompare: (valA: V, valB: V) => boolean\n): boolean {\n\tconst diff = treeA.diffAgainst(treeB, breakOnDifference, breakOnDifference, (_, valA, valB) => {\n\t\tif (!compare(valA, valB)) {\n\t\t\treturn { break: true };\n\t\t}\n\t\treturn undefined;\n\t});\n\n\treturn diff === undefined;\n}\n\nexport function backmap<K, V>(forwardmap: Map<V, K>): Map<K, V> {\n\treturn new Map(map(forwardmap, ([key, value]) => [value, key]));\n}\n\n/**\n * A developer facing (non-localized) error message.\n * TODO: better error system.\n */\nexport type ErrorString = string;\n\n/**\n * Discriminated union instance that wraps either a result of type `TOk` or an error of type `TError`.\n * @internal\n */\nexport type Result<TOk, TError> = Result.Ok<TOk> | Result.Error<TError>;\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Result {\n\t/**\n\t * Factory function for making a successful Result.\n\t * @param result - The result to wrap in the Result.\n\t * @internal\n\t */\n\texport function ok<TOk>(result: TOk): Ok<TOk> {\n\t\treturn { type: ResultType.Ok, result };\n\t}\n\t/**\n\t * Factory function for making a unsuccessful Result.\n\t * @param error - The error to wrap in the Result.\n\t * @internal\n\t */\n\texport function error<TError>(error: TError): Error<TError> {\n\t\treturn { type: ResultType.Error, error };\n\t}\n\t/**\n\t * Type guard for successful Result.\n\t * @returns True if `result` is successful.\n\t * @internal\n\t */\n\texport function isOk<TOk, TError>(result: Result<TOk, TError>): result is Ok<TOk> {\n\t\treturn result.type === ResultType.Ok;\n\t}\n\t/**\n\t * Type guard for unsuccessful Result.\n\t * @returns True if `result` is unsuccessful.\n\t * @internal\n\t */\n\texport function isError<TOk, TError>(result: Result<TOk, TError>): result is Error<TError> {\n\t\treturn result.type === ResultType.Error;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is ok.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new result.\n\t * @returns The given result if it is not ok, the mapped result otherwise.\n\t * @internal\n\t */\n\texport function mapOk<TOkIn, TOkOut, TError>(\n\t\tresult: Result<TOkIn, TError>,\n\t\tmap: (ok: TOkIn) => TOkOut\n\t): Result<TOkOut, TError> {\n\t\treturn isOk(result) ? ok(map(result.result)) : result;\n\t}\n\t/**\n\t * Maps the given result with the given function when the result is an error.\n\t * @param result - The result to map.\n\t * @param map - The function to apply to derive the new error.\n\t * @returns The given result if it is ok, the mapped result otherwise.\n\t * @internal\n\t */\n\texport function mapError<TOk, TErrorIn, TErrorOut>(\n\t\tresult: Result<TOk, TErrorIn>,\n\t\tmap: (error: TErrorIn) => TErrorOut\n\t): Result<TOk, TErrorOut> {\n\t\treturn isError(result) ? error(map(result.error)) : result;\n\t}\n\t/**\n\t * Tag value use to differentiate the members of the `Result` discriminated union.\n\t * @internal\n\t */\n\texport enum ResultType {\n\t\t/** Signals a successful result. */\n\t\tOk,\n\t\t/** Signals an unsuccessful result. */\n\t\tError,\n\t}\n\t/**\n\t * Wraps a result of type `TOk`.\n\t * @internal\n\t */\n\texport interface Ok<TOk> {\n\t\treadonly type: ResultType.Ok;\n\t\treadonly result: TOk;\n\t}\n\t/**\n\t * Wraps an error of type `TError`.\n\t * @internal\n\t */\n\texport interface Error<TError> {\n\t\treadonly type: ResultType.Error;\n\t\treadonly error: TError;\n\t}\n}\n\n/** Type that removes `readonly` from fields. */\nexport type Mutable<T> = { -readonly [P in keyof T]: T[P] };\n\n/** Type that recursively removes `readonly` from fields. */\nexport type RecursiveMutable<T> = {\n\t-readonly [K in keyof T]: RecursiveMutable<T[K]>;\n};\n\n/** Type that produces a writeable map from a readonly map. */\nexport type MutableMap<T extends ReadonlyMap<unknown, unknown>> = T extends ReadonlyMap<infer K, infer V>\n\t? Map<K, V>\n\t: never;\n\n/** Type that includes the property K: V on T */\nexport type With<T, K extends keyof never, V> = T & { [key in K]: V };\n\n/**\n * A readonly `Map` which is known to contain a value for every possible key\n */\nexport interface ClosedMap<K, V> extends Omit<Map<K, V>, 'delete' | 'clear'> {\n\tget(key: K): V;\n}\n\n/**\n * Change the given property Prop of type T to have a type of TPropNew\n */\nexport type ChangePropType<T, Prop extends keyof T, TPropNew> = Omit<T, Prop> & {\n\t[_ in Prop]: TPropNew;\n};\n\n// eslint-disable-next-line @rushstack/no-new-null\ntype Primitive = string | number | bigint | boolean | null | symbol | undefined;\n\n/**\n * Recursively replace all properties with type assignable to type TReplace in T with properties of type TWith.\n */\nexport type ReplaceRecursive<T, TReplace, TWith> = T extends TReplace\n\t? TWith\n\t: T extends Primitive\n\t\t? T\n\t\t: {\n\t\t\t\t[P in keyof T]: ReplaceRecursive<T[P], TReplace, TWith>;\n\t\t\t};\n\n/** A union type of the first `N` positive integers */\nexport type TakeWholeNumbers<N extends number, A extends never[] = []> = N extends A['length']\n\t? never\n\t: A['length'] | TakeWholeNumbers<N, [never, ...A]>;\n/** Returns a tuple type with exactly `Length` elements of type `T` */\nexport type ArrayOfLength<T, Length extends number, A extends T[] = []> = Length extends A['length']\n\t? A\n\t: ArrayOfLength<T, Length, [T, ...A]>;\n/**\n * Fails if `array` does not have exactly `length` elements\n */\nexport function hasExactlyLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is ArrayOfLength<T, Len> {\n\treturn array.length === length;\n}\n/**\n * Fails if `array` does not have at least `length` elements\n */\nexport function hasLength<T, Len extends TakeWholeNumbers<16>>(\n\tarray: readonly T[],\n\tlength: Len\n): array is [...ArrayOfLength<T, Len>, ...T[]] {\n\treturn array.length >= length;\n}\n\n/**\n * Type for a rest parameter which can accept many values, or a single array.\n * Since a callee cannot modify an array passed as a rest parameter with the spread operator,\n * an array passed directly should be readonly for consistency (caller retains ownership).\n */\nexport type RestOrArray<T> = readonly T[] | [readonly T[]];\n\n/**\n * When value is a one-element array containing another array, unwraps and returns the inner array.\n * Otherwise, returns the provided array.\n * Useful for implementing functions with a `RestOrArray` parameter.\n * T must not be implemented with an array (`Array.isArray(t)` must return false)\n */\nexport function unwrapRestOrArray<T>(value: [any[]] extends [T] ? never : RestOrArray<T>): readonly T[] {\n\treturn value.length === 1 && Array.isArray(value[0]) ? value[0] : (value as T[]);\n}\n"]}
|
package/lib/MergeHealth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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