@fluid-experimental/tree 2.0.0-internal.8.0.0 → 2.0.0-rc.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +0 -9
- package/api-report/experimental-tree.api.md +131 -130
- package/dist/ChangeTypes.d.ts +15 -15
- package/dist/ChangeTypes.js +4 -4
- package/dist/ChangeTypes.js.map +1 -1
- package/dist/Checkout.d.ts +4 -4
- package/dist/Checkout.js +3 -3
- package/dist/Checkout.js.map +1 -1
- package/dist/Common.d.ts +1 -1
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/EagerCheckout.d.ts +1 -1
- package/dist/EagerCheckout.js +1 -1
- package/dist/EagerCheckout.js.map +1 -1
- package/dist/EditLog.d.ts +3 -2
- package/dist/EditLog.d.ts.map +1 -1
- package/dist/EditLog.js +3 -5
- package/dist/EditLog.js.map +1 -1
- package/dist/EditUtilities.d.ts +5 -5
- package/dist/EditUtilities.js +2 -2
- package/dist/EditUtilities.js.map +1 -1
- package/dist/EventTypes.d.ts +1 -1
- package/dist/EventTypes.js +1 -1
- package/dist/EventTypes.js.map +1 -1
- package/dist/Forest.d.ts +4 -4
- package/dist/Forest.js +3 -6
- package/dist/Forest.js.map +1 -1
- package/dist/Identifiers.d.ts +14 -14
- package/dist/Identifiers.js.map +1 -1
- package/dist/InitialTree.d.ts +1 -1
- package/dist/InitialTree.js +1 -1
- package/dist/InitialTree.js.map +1 -1
- package/dist/LogViewer.d.ts +2 -2
- package/dist/LogViewer.js +1 -1
- package/dist/LogViewer.js.map +1 -1
- package/dist/NodeIdUtilities.d.ts +3 -3
- package/dist/NodeIdUtilities.js.map +1 -1
- package/dist/PayloadUtilities.d.ts +1 -1
- package/dist/PayloadUtilities.js +1 -1
- package/dist/PayloadUtilities.js.map +1 -1
- package/dist/ReconciliationPath.d.ts +3 -3
- package/dist/ReconciliationPath.js.map +1 -1
- package/dist/RevisionValueCache.d.ts +1 -1
- package/dist/RevisionValueCache.js +2 -2
- package/dist/RevisionValueCache.js.map +1 -1
- package/dist/RevisionView.d.ts +2 -2
- package/dist/RevisionView.js +2 -2
- package/dist/RevisionView.js.map +1 -1
- package/dist/SharedTree.d.ts +14 -14
- package/dist/SharedTree.js +2 -2
- package/dist/SharedTree.js.map +1 -1
- package/dist/Transaction.d.ts +3 -3
- package/dist/Transaction.js +2 -2
- package/dist/Transaction.js.map +1 -1
- package/dist/TransactionInternal.d.ts +17 -17
- package/dist/TransactionInternal.js +3 -3
- package/dist/TransactionInternal.js.map +1 -1
- package/dist/TreeView.d.ts +7 -7
- package/dist/TreeView.js +1 -1
- package/dist/TreeView.js.map +1 -1
- package/dist/id-compressor/IdCompressor.js +2 -5
- package/dist/id-compressor/IdCompressor.js.map +1 -1
- package/dist/migration-shim/migrationShim.d.ts +3 -3
- package/dist/migration-shim/migrationShim.d.ts.map +1 -1
- package/dist/migration-shim/migrationShim.js +9 -5
- package/dist/migration-shim/migrationShim.js.map +1 -1
- package/dist/migration-shim/migrationShimFactory.d.ts +2 -2
- package/dist/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/migrationShimFactory.js.map +1 -1
- package/dist/migration-shim/sharedTreeShim.d.ts +4 -4
- package/dist/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShim.js +1 -1
- package/dist/migration-shim/sharedTreeShim.js.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.d.ts +1 -2
- package/dist/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/dist/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.d.ts +16 -0
- package/dist/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/dist/migration-shim/shimDeltaConnection.js +16 -2
- package/dist/migration-shim/shimDeltaConnection.js.map +1 -1
- package/dist/migration-shim/types.d.ts +1 -1
- package/dist/migration-shim/types.d.ts.map +1 -1
- package/dist/migration-shim/types.js.map +1 -1
- package/dist/persisted-types/0.0.2.d.ts +24 -24
- package/dist/persisted-types/0.0.2.js +5 -5
- package/dist/persisted-types/0.0.2.js.map +1 -1
- package/dist/persisted-types/0.1.1.d.ts +14 -14
- package/dist/persisted-types/0.1.1.js +3 -3
- package/dist/persisted-types/0.1.1.js.map +1 -1
- package/dist/tree-alpha.d.ts +2674 -119
- package/dist/tree-beta.d.ts +1 -50
- package/dist/tree-public.d.ts +1 -52
- package/dist/tree-untrimmed.d.ts +142 -143
- package/lib/ChangeTypes.d.ts +15 -15
- package/lib/ChangeTypes.js +4 -4
- package/lib/ChangeTypes.js.map +1 -1
- package/lib/Checkout.d.ts +4 -4
- package/lib/Checkout.js +3 -3
- package/lib/Checkout.js.map +1 -1
- package/lib/Common.d.ts +1 -1
- package/lib/Common.d.ts.map +1 -1
- package/lib/Common.js.map +1 -1
- package/lib/EagerCheckout.d.ts +1 -1
- package/lib/EagerCheckout.js +1 -1
- package/lib/EagerCheckout.js.map +1 -1
- package/lib/EditLog.d.ts +3 -2
- package/lib/EditLog.d.ts.map +1 -1
- package/lib/EditLog.js +2 -1
- package/lib/EditLog.js.map +1 -1
- package/lib/EditUtilities.d.ts +5 -5
- package/lib/EditUtilities.js +2 -2
- package/lib/EditUtilities.js.map +1 -1
- package/lib/EventTypes.d.ts +1 -1
- package/lib/EventTypes.js +1 -1
- package/lib/EventTypes.js.map +1 -1
- package/lib/Forest.d.ts +4 -4
- package/lib/Forest.js +2 -2
- package/lib/Forest.js.map +1 -1
- package/lib/Identifiers.d.ts +14 -14
- package/lib/Identifiers.js.map +1 -1
- package/lib/InitialTree.d.ts +1 -1
- package/lib/InitialTree.js +1 -1
- package/lib/InitialTree.js.map +1 -1
- package/lib/LogViewer.d.ts +2 -2
- package/lib/LogViewer.js +1 -1
- package/lib/LogViewer.js.map +1 -1
- package/lib/NodeIdUtilities.d.ts +3 -3
- package/lib/NodeIdUtilities.js.map +1 -1
- package/lib/PayloadUtilities.d.ts +1 -1
- package/lib/PayloadUtilities.js +1 -1
- package/lib/PayloadUtilities.js.map +1 -1
- package/lib/ReconciliationPath.d.ts +3 -3
- package/lib/ReconciliationPath.js.map +1 -1
- package/lib/RevisionValueCache.d.ts +1 -1
- package/lib/RevisionValueCache.js +1 -1
- package/lib/RevisionValueCache.js.map +1 -1
- package/lib/RevisionView.d.ts +2 -2
- package/lib/RevisionView.js +2 -2
- package/lib/RevisionView.js.map +1 -1
- package/lib/SharedTree.d.ts +14 -14
- package/lib/SharedTree.js +2 -2
- package/lib/SharedTree.js.map +1 -1
- package/lib/Transaction.d.ts +3 -3
- package/lib/Transaction.js +2 -2
- package/lib/Transaction.js.map +1 -1
- package/lib/TransactionInternal.d.ts +17 -17
- package/lib/TransactionInternal.js +3 -3
- package/lib/TransactionInternal.js.map +1 -1
- package/lib/TreeView.d.ts +7 -7
- package/lib/TreeView.js +1 -1
- package/lib/TreeView.js.map +1 -1
- package/lib/id-compressor/IdCompressor.js +1 -1
- package/lib/id-compressor/IdCompressor.js.map +1 -1
- package/lib/migration-shim/migrationShim.d.ts +3 -3
- package/lib/migration-shim/migrationShim.d.ts.map +1 -1
- package/lib/migration-shim/migrationShim.js +9 -5
- package/lib/migration-shim/migrationShim.js.map +1 -1
- package/lib/migration-shim/migrationShimFactory.d.ts +2 -2
- package/lib/migration-shim/migrationShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/migrationShimFactory.js.map +1 -1
- package/lib/migration-shim/sharedTreeShim.d.ts +4 -4
- package/lib/migration-shim/sharedTreeShim.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShim.js +1 -1
- package/lib/migration-shim/sharedTreeShim.js.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.d.ts +1 -2
- package/lib/migration-shim/sharedTreeShimFactory.d.ts.map +1 -1
- package/lib/migration-shim/sharedTreeShimFactory.js.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.d.ts +16 -0
- package/lib/migration-shim/shimDeltaConnection.d.ts.map +1 -1
- package/lib/migration-shim/shimDeltaConnection.js +16 -2
- package/lib/migration-shim/shimDeltaConnection.js.map +1 -1
- package/lib/migration-shim/types.d.ts +1 -1
- package/lib/migration-shim/types.d.ts.map +1 -1
- package/lib/migration-shim/types.js.map +1 -1
- package/lib/persisted-types/0.0.2.d.ts +24 -24
- package/lib/persisted-types/0.0.2.js +5 -5
- package/lib/persisted-types/0.0.2.js.map +1 -1
- package/lib/persisted-types/0.1.1.d.ts +14 -14
- package/lib/persisted-types/0.1.1.js +3 -3
- package/lib/persisted-types/0.1.1.js.map +1 -1
- package/lib/test/utilities/TestUtilities.d.ts +1 -2
- package/lib/test/utilities/TestUtilities.d.ts.map +1 -1
- package/lib/test/utilities/TestUtilities.js.map +1 -1
- package/package.json +25 -25
- package/src/ChangeTypes.ts +15 -15
- package/src/Checkout.ts +4 -4
- package/src/Common.ts +1 -1
- package/src/EagerCheckout.ts +1 -1
- package/src/EditLog.ts +4 -3
- package/src/EditUtilities.ts +5 -5
- package/src/EventTypes.ts +1 -1
- package/src/Forest.ts +5 -5
- package/src/Identifiers.ts +14 -14
- package/src/InitialTree.ts +1 -1
- package/src/LogViewer.ts +2 -2
- package/src/NodeIdUtilities.ts +3 -3
- package/src/PayloadUtilities.ts +1 -1
- package/src/ReconciliationPath.ts +3 -3
- package/src/RevisionValueCache.ts +2 -2
- package/src/RevisionView.ts +2 -2
- package/src/SharedTree.ts +14 -14
- package/src/Transaction.ts +3 -3
- package/src/TransactionInternal.ts +17 -17
- package/src/TreeView.ts +7 -7
- package/src/id-compressor/IdCompressor.ts +1 -1
- package/src/migration-shim/migrationShim.ts +17 -9
- package/src/migration-shim/migrationShimFactory.ts +2 -2
- package/src/migration-shim/sharedTreeShim.ts +6 -5
- package/src/migration-shim/sharedTreeShimFactory.ts +1 -2
- package/src/migration-shim/shimDeltaConnection.ts +16 -2
- package/src/migration-shim/types.ts +1 -1
- package/src/persisted-types/0.0.2.ts +24 -24
- package/src/persisted-types/0.1.1.ts +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestUtilities.js","sourceRoot":"","sources":["../../../src/test/utilities/TestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAA0B,MAAM,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1G,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,WAAW,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAGN,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,GAExB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAoC,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAWtG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAoB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACN,cAAc,EAId,eAAe,EAGf,WAAW,GACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,SAAS,EA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AC;QACzB,YAAY,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,aAAyB;IAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC;IACvC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAAC,CAAC;IACnF,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAC7F,OAAO,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,QAA6B,EAC7B,SAAiC,EACjC,MAAqB;IAErB,MAAM,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACpC,MAAM,QAAQ,CAAC,sBAAsB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;IAC9B,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,4BAA4B,EAAE,EAAE,CAAC;IAC3E,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACzF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAC5C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { resolve } from 'path';\nimport { assert } from '@fluidframework/core-utils';\nimport { v5 as uuidv5 } from 'uuid';\nimport { expect } from 'chai';\nimport { LocalServerTestDriver } from '@fluid-private/test-drivers';\nimport { SummaryCollection, DefaultSummaryConfiguration } from '@fluidframework/container-runtime';\nimport { IContainerExperimental, Loader, waitContainerToCatchUp } from '@fluidframework/container-loader';\nimport {\n\tMockContainerRuntimeFactory,\n\tMockFluidDataStoreRuntime,\n\tMockStorage,\n} from '@fluidframework/test-runtime-utils';\nimport {\n\tChannelFactoryRegistry,\n\tITestFluidObject,\n\tTestObjectProvider,\n\tTestContainerRuntimeFactory,\n\tTestFluidObjectFactory,\n\tcreateAndAttachContainer,\n\tITestObjectProvider,\n} from '@fluidframework/test-utils';\nimport type { IContainer, IHostLoader } from '@fluidframework/container-definitions';\nimport type { IFluidCodeDetails, IFluidHandle, IRequestHeader } from '@fluidframework/core-interfaces';\nimport { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport { ConfigTypes, IConfigProviderBase, createChildLogger } from '@fluidframework/telemetry-utils';\nimport { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';\nimport {\n\tAttributionId,\n\tDetachedSequenceId,\n\tEditId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tStableNodeId,\n} from '../../Identifiers';\nimport { fail, identity, ReplaceRecursive } from '../../Common';\nimport { IdCompressor } from '../../id-compressor';\nimport { createSessionId } from '../../id-compressor/NumericUuid';\nimport { getChangeNodeFromViewNode } from '../../SerializationUtilities';\nimport { initialTree } from '../../InitialTree';\nimport {\n\tChangeInternal,\n\tEdit,\n\tNodeData,\n\tPayload,\n\treservedIdCount,\n\tSharedTreeOp,\n\tSharedTreeOp_0_0_2,\n\tWriteFormat,\n} from '../../persisted-types';\nimport { TraitLocation, TreeView } from '../../TreeView';\nimport { SharedTreeDiagnosticEvent } from '../../EventTypes';\nimport { getNodeId, getNodeIdContext, NodeIdContext, NodeIdConverter, NodeIdNormalizer } from '../../NodeIdUtilities';\nimport { newEdit, setTrait } from '../../EditUtilities';\nimport { SharedTree, SharedTreeFactory, SharedTreeOptions_0_0_2 } from '../../SharedTree';\nimport { BuildNode, Change, StablePlace } from '../../ChangeTypes';\nimport { convertEditIds } from '../../IdConversion';\nimport { OrderedEditSet } from '../../EditLog';\nimport { buildLeaf, RefreshingTestTree, SimpleTestTree, TestTree } from './TestNode';\n\n/** Objects returned by setUpTestSharedTree */\nexport interface SharedTreeTestingComponents {\n\t/** The MockFluidDataStoreRuntime used to created the SharedTree. */\n\tcomponentRuntime: MockFluidDataStoreRuntime;\n\t/**\n\t * The MockContainerRuntimeFactory created if one was not provided in the options.\n\t * Only connected to the SharedTree if the localMode option was set to false.\n\t * */\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory;\n\t/** The SharedTree created and set up. */\n\ttree: SharedTree;\n}\n\n/** Options used to customize setUpTestSharedTree */\nexport interface SharedTreeTestingOptions {\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same containerRuntimeFactory,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: BuildNode;\n\t/** If false, a MockContainerRuntimeFactory connected to the SharedTree will be returned. */\n\tlocalMode?: boolean;\n\t/**\n\t * MockContainerRuntimeFactory to connect the SharedTree to. A new one will not be created if one is provided.\n\t * If localMode is set to true, it will not be connected to the created SharedTree.\n\t * */\n\tcontainerRuntimeFactory?: MockContainerRuntimeFactory;\n\t/** Iff true, do not `fail` on invalid edits */\n\tallowInvalid?: boolean;\n\t/** Iff true, do not `fail` on malformed edits */\n\tallowMalformed?: boolean;\n\t/** Unless set to true, a SharedTree error causes the test to fail */\n\tnoFailOnError?: boolean;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If not set, summaries will be written in format 0.1.1.\n\t */\n\twriteFormat?: WriteFormat;\n\t/**\n\t * Optional attribution ID to give to the new tree\n\t */\n\tattributionId?: AttributionId;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n\n\t/**\n\t * Telemetry logger injected into the SharedTree.\n\t */\n\tlogger?: ITelemetryBaseLogger;\n}\n\nexport const testTraitLabel = SimpleTestTree.traitLabel;\nexport function testTrait(view: TreeView): TraitLocation {\n\treturn {\n\t\tlabel: testTraitLabel,\n\t\tparent: view.root,\n\t};\n}\n\n/** Sets up and returns an object of components useful for testing SharedTree. */\nexport function setUpTestSharedTree(\n\toptions: SharedTreeTestingOptions = { localMode: true }\n): SharedTreeTestingComponents {\n\tconst {\n\t\tid,\n\t\tinitialTree,\n\t\tlocalMode,\n\t\tcontainerRuntimeFactory,\n\t\tsetupEditId,\n\t\tsummarizeHistory,\n\t\twriteFormat,\n\t\tattributionId,\n\t} = options;\n\tlet componentRuntime: MockFluidDataStoreRuntime;\n\tif (options.logger) {\n\t\tconst proxyHandler: ProxyHandler<MockFluidDataStoreRuntime> = {\n\t\t\tget: (target, prop, receiver) => {\n\t\t\t\tif (prop === 'logger' && options.logger) {\n\t\t\t\t\treturn options.logger;\n\t\t\t\t}\n\t\t\t\treturn target[prop as keyof MockFluidDataStoreRuntime];\n\t\t\t},\n\t\t};\n\t\tcomponentRuntime = new Proxy(new MockFluidDataStoreRuntime(), proxyHandler);\n\t} else {\n\t\tcomponentRuntime = new MockFluidDataStoreRuntime();\n\t}\n\n\t// Enable expensiveValidation\n\tlet factory: SharedTreeFactory;\n\tif (writeFormat === WriteFormat.v0_0_2) {\n\t\tconst options: SharedTreeOptions_0_0_2 = { summarizeHistory: summarizeHistory ?? true };\n\t\tfactory = SharedTree.getFactory(writeFormat, options);\n\t} else {\n\t\tconst options = {\n\t\t\tsummarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: true } : false,\n\t\t\tattributionId,\n\t\t};\n\t\tfactory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);\n\t}\n\tconst tree = factory.create(componentRuntime, id ?? 'testSharedTree');\n\n\tif (options.allowInvalid === undefined || !options.allowInvalid) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedInvalidEdit, () => fail('unexpected invalid edit'));\n\t}\n\n\tif (options.allowMalformed === undefined || !options.allowMalformed) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedMalformedEdit, () => fail('unexpected malformed edit'));\n\t}\n\n\tif (options.noFailOnError === undefined || !options.noFailOnError) {\n\t\t// any errors thrown by a SharedObject event listener will be caught and\n\t\t// reemitted on this event. For testing purposes, rethrow so that it\n\t\t// actually causes the test to fail.\n\t\ttree.on('error', (error) => {\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tconst newContainerRuntimeFactory = containerRuntimeFactory ?? new MockContainerRuntimeFactory();\n\n\tif (localMode === true) {\n\t\tcomponentRuntime.local = true;\n\t} else {\n\t\tconst containerRuntime = newContainerRuntimeFactory.createContainerRuntime(componentRuntime);\n\t\tconst services = {\n\t\t\tdeltaConnection: componentRuntime.createDeltaConnection(),\n\t\t\tobjectStorage: new MockStorage(undefined),\n\t\t};\n\t\ttree.connect(services);\n\t}\n\n\tif (initialTree !== undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn {\n\t\tcomponentRuntime,\n\t\tcontainerRuntimeFactory: newContainerRuntimeFactory,\n\t\ttree,\n\t};\n}\n\nconst TestDataStoreType = '@fluid-example/test-dataStore';\n\n/** Objects returned by setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingComponents {\n\t/** The testObjectProvider created if one was not set in the options. */\n\ttestObjectProvider: TestObjectProvider;\n\t/** The SharedTree created and set up. */\n\ttree: SharedTree;\n\t/** The container created and set up. */\n\tcontainer: IContainer;\n\t/** Handles to any blobs uploaded via `blobs` */\n\tuploadedBlobs: IFluidHandle<ArrayBufferLike>[];\n}\n\n/** Options used to customize setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingOptions {\n\t/** Contents of blobs that should be uploaded to the runtime upon creation. Handles to these blobs will be returned. */\n\tblobs?: ArrayBufferLike[];\n\t/** Headers to include on the container load request. */\n\theaders?: IRequestHeader;\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same testObjectProvider,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: BuildNode;\n\t/** If set, uses the provider to create the container and create the SharedTree. */\n\ttestObjectProvider?: TestObjectProvider;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If not set, summaries will be written in format 0.0.2.\n\t */\n\twriteFormat?: WriteFormat;\n\t/**\n\t * Optional attribution ID to give to the new tree\n\t */\n\tattributionId?: AttributionId;\n\t/**\n\t * If not set, will upload edit chunks when they are full.\n\t */\n\tuploadEditChunks?: boolean;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n\t/**\n\t * If set, will be passed to the container on load\n\t */\n\tpendingLocalState?: string;\n\t/**\n\t * If set, will be added to the configProvider object passed to the loader\n\t * and will take effect for the duration of its lifetime\n\t */\n\tfeatureGates?: Record<string, ConfigTypes>;\n}\n\nconst testObjectProviders: TestObjectProvider[] = [];\nafterEach(() => {\n\tfor (const provider of testObjectProviders) {\n\t\tprovider.reset();\n\t}\n\ttestObjectProviders.length = 0;\n});\n\n/**\n * Sets up and returns an object of components useful for testing SharedTree with a local server.\n * Required for tests that involve the uploadBlob API.\n *\n * Any TestObjectProvider created by this function will be reset after the test completes (via afterEach) hook.\n */\nexport async function setUpLocalServerTestSharedTree(\n\toptions: LocalServerSharedTreeTestingOptions\n): Promise<LocalServerSharedTreeTestingComponents> {\n\tconst {\n\t\tblobs,\n\t\theaders,\n\t\tid,\n\t\tinitialTree,\n\t\ttestObjectProvider,\n\t\tsetupEditId,\n\t\tsummarizeHistory,\n\t\twriteFormat,\n\t\tuploadEditChunks,\n\t\tattributionId,\n\t\tpendingLocalState,\n\t} = options;\n\n\tconst featureGates = options.featureGates ?? {};\n\tfeatureGates['Fluid.Container.enableOfflineLoad'] = true;\n\tfeatureGates['Fluid.ContainerRuntime.DisablePartialFlush'] = true;\n\n\tconst treeId = id ?? 'test';\n\tlet factory: SharedTreeFactory;\n\tif (writeFormat === WriteFormat.v0_0_2) {\n\t\tconst options: SharedTreeOptions_0_0_2 = { summarizeHistory: summarizeHistory ?? true };\n\t\tfactory = SharedTree.getFactory(writeFormat, options);\n\t} else {\n\t\tconst options = {\n\t\t\tsummarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: uploadEditChunks ?? true } : false,\n\t\t\tattributionId,\n\t\t};\n\t\tfactory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);\n\t}\n\tconst registry: ChannelFactoryRegistry = [[treeId, factory]];\n\n\tconst runtimeFactory = () =>\n\t\tnew TestContainerRuntimeFactory(TestDataStoreType, new TestFluidObjectFactory(registry), {\n\t\t\tsummaryOptions: {\n\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t...{\n\t\t\t\t\t\tminIdleTime: 1000, // Manually set idle times so some SharedTree tests don't timeout.\n\t\t\t\t\t\tmaxIdleTime: 1000,\n\t\t\t\t\t\tmaxTime: 1000 * 12,\n\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\tconst defaultCodeDetails: IFluidCodeDetails = {\n\t\tpackage: 'defaultTestPackage',\n\t\tconfig: {},\n\t};\n\n\tfunction makeTestLoader(provider: TestObjectProvider): IHostLoader {\n\t\tconst fluidEntryPoint = runtimeFactory();\n\t\tconst configProvider = (settings: Record<string, ConfigTypes>): IConfigProviderBase => ({\n\t\t\tgetRawConfig: (name: string): ConfigTypes => settings[name],\n\t\t});\n\n\t\treturn provider.createLoader([[defaultCodeDetails, fluidEntryPoint]], {\n\t\t\toptions: { maxClientLeaveWaitTime: 1000 },\n\t\t\tconfigProvider: configProvider(featureGates),\n\t\t});\n\t}\n\n\tlet provider: TestObjectProvider;\n\tlet container: IContainer;\n\n\tif (testObjectProvider !== undefined) {\n\t\tprovider = testObjectProvider;\n\t\tconst driver = new LocalServerTestDriver();\n\t\tconst loader = makeTestLoader(provider);\n\t\t// Once ILoaderOptions is specificable, this should use `provider.loadTestContainer` instead.\n\t\tcontainer = await loader.resolve({ url: await driver.createContainerUrl(treeId), headers }, pendingLocalState);\n\t\tawait waitContainerToCatchUp(container);\n\t} else {\n\t\tconst driver = new LocalServerTestDriver();\n\t\tprovider = new TestObjectProvider(Loader, driver, runtimeFactory);\n\t\ttestObjectProviders.push(provider);\n\t\t// Once ILoaderOptions is specificable, this should use `provider.makeTestContainer` instead.\n\t\tconst loader = makeTestLoader(provider);\n\t\tcontainer = await createAndAttachContainer(defaultCodeDetails, loader, driver.createCreateNewRequest(treeId));\n\t}\n\n\tconst dataObject = (await container.getEntryPoint()) as ITestFluidObject;\n\n\tconst uploadedBlobs =\n\t\tblobs === undefined ? [] : await Promise.all(blobs.map(async (blob) => dataObject.context.uploadBlob(blob)));\n\tconst tree = await dataObject.getSharedObject<SharedTree>(treeId);\n\n\tif (initialTree !== undefined && testObjectProvider === undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn { container, tree, testObjectProvider: provider, uploadedBlobs };\n}\n\n/** Sets testTrait to contain `node`. */\nfunction setTestTree(tree: SharedTree, node: BuildNode, overrideId?: EditId): EditId {\n\tconst trait = testTrait(tree.currentView);\n\tif (overrideId === undefined) {\n\t\treturn tree.applyEdit(...setTrait(trait, node)).id;\n\t} else {\n\t\tconst changes = setTrait(trait, node).map((c) => tree.internalizeChange(c));\n\t\treturn tree.applyEditInternal({ changes, id: overrideId }).id;\n\t}\n}\n\n/**\n * Creates a list of edits with stable IDs that can be processed by a SharedTree.\n * @returns the list of created edits\n */\nexport function createStableEdits(\n\tnumberOfEdits: number,\n\tidContext: NodeIdContext = makeNodeIdContext(),\n\tpayload: (i: number) => Payload = identity\n): Edit<ChangeInternal>[] {\n\tif (numberOfEdits === 0) {\n\t\treturn [];\n\t}\n\n\tconst uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\tconst nodeId = idContext.generateNodeId('ae6b24eb-6fa8-42cc-abd2-48f250b7798f');\n\tconst node = buildLeaf(nodeId);\n\tconst insertEmptyNode = newEdit([\n\t\tChangeInternal.build([node], 0 as DetachedSequenceId),\n\t\tChangeInternal.insert(\n\t\t\t0 as DetachedSequenceId,\n\t\t\tStablePlace.atEndOf({ label: testTraitLabel, parent: idContext.convertToNodeId(initialTree.identifier) })\n\t\t),\n\t]);\n\n\tconst edits: Edit<ChangeInternal>[] = [{ ...insertEmptyNode, id: uuidv5('test', uuidNamespace) as EditId }];\n\n\t// Every subsequent edit is a set payload\n\tfor (let i = 1; i < numberOfEdits; i++) {\n\t\tconst edit = newEdit([ChangeInternal.setPayload(nodeId, payload(i))]);\n\t\tedits.push({ ...edit, id: uuidv5(i.toString(), uuidNamespace) as EditId });\n\t}\n\n\treturn edits;\n}\n\n/** Asserts that changes to SharedTree in editor() function do not cause any observable state change */\nexport function assertNoDelta(tree: SharedTree, editor: () => void) {\n\tconst viewA = tree.currentView;\n\teditor();\n\tconst viewB = tree.currentView;\n\tconst delta = viewA.delta(viewB);\n\texpect(delta).deep.equals({\n\t\tchanged: [],\n\t\tadded: [],\n\t\tremoved: [],\n\t});\n}\n\n/**\n * Used to test error throwing in async functions.\n */\nexport async function asyncFunctionThrowsCorrectly(\n\tasyncFunction: () => Promise<unknown>,\n\texpectedError: string\n): Promise<boolean> {\n\tlet errorMessage: string | undefined;\n\n\ttry {\n\t\tawait asyncFunction();\n\t} catch (error) {\n\t\terrorMessage = (error as Error).message;\n\t}\n\n\treturn errorMessage === expectedError;\n}\n\n/**\n * Returns true if two nodes have equivalent data, otherwise false.\n * Does not compare children or payloads.\n * @param nodes - two or more nodes to compare\n */\nexport function areNodesEquivalent(...nodes: NodeData<unknown>[]): boolean {\n\tif (nodes.length < 2) {\n\t\tfail('Too few nodes to compare');\n\t}\n\n\tfor (let i = 1; i < nodes.length; i++) {\n\t\tif (nodes[i].definition !== nodes[0].definition) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (nodes[i].identifier !== nodes[0].identifier) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n// This accounts for this file being executed after compilation. If many tests want to leverage resources, we should unify\n// resource path logic to a single place.\nexport const testDocumentsPathBase = resolve(__dirname, '../../../src/test/documents/');\n\nexport const versionComparator = (versionA: string, versionB: string): number => {\n\tconst versionASplit = versionA.split('.');\n\tconst versionBSplit = versionB.split('.');\n\n\tassert(\n\t\tversionASplit.length === versionBSplit.length && versionASplit.length === 3,\n\t\t0x668 /* Version numbers should follow semantic versioning. */\n\t);\n\n\tfor (let i = 0; i < 3; ++i) {\n\t\tconst numberA = parseInt(versionASplit[i], 10);\n\t\tconst numberB = parseInt(versionBSplit[i], 10);\n\n\t\tif (numberA > numberB) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (numberA < numberB) {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\treturn 0;\n};\n\n/**\n * Create a {@link SimpleTestTree} from the given {@link SharedTree} or {@link IdCompressor}\n */\nexport function setUpTestTree(idSource?: IdCompressor | SharedTree, expensiveValidation = false): TestTree {\n\tconst source = idSource ?? new IdCompressor(createSessionId(), reservedIdCount);\n\tif (source instanceof SharedTree) {\n\t\tassert(source.edits.length === 0, 0x669 /* tree must be a new SharedTree */);\n\t\tconst getNormalizer = () => getIdNormalizerFromSharedTree(source);\n\t\tconst contextWrapper = {\n\t\t\tnormalizeToOpSpace: (id: NodeId) => getNormalizer().normalizeToOpSpace(id),\n\t\t\tnormalizeToSessionSpace: (id: OpSpaceNodeId, sessionId: SessionId) =>\n\t\t\t\tgetNormalizer().normalizeToSessionSpace(id, sessionId),\n\t\t\tget localSessionId() {\n\t\t\t\treturn getNormalizer().localSessionId;\n\t\t\t},\n\t\t};\n\t\tconst simpleTestTree = new SimpleTestTree(source, contextWrapper, expensiveValidation);\n\t\tsetTestTree(source, simpleTestTree);\n\t\treturn simpleTestTree;\n\t}\n\n\tconst context = makeNodeIdContext(source);\n\treturn new SimpleTestTree(context, context, expensiveValidation);\n}\n\n/**\n * Gets an id normalizer from the provided shared-tree. This is\n */\nexport function getIdNormalizerFromSharedTree(sharedTree: SharedTree): NodeIdNormalizer<OpSpaceNodeId> {\n\treturn (\n\t\t((sharedTree as any).idNormalizer as NodeIdNormalizer<OpSpaceNodeId>) ??\n\t\tfail('Failed to find SharedTree normalizer')\n\t);\n}\n\n/**\n * Create a {@link SimpleTestTree} before each test\n */\nexport function refreshTestTree(\n\tidSourceFactory?: (() => IdCompressor) | (() => SharedTree),\n\tfn?: (testTree: TestTree) => void,\n\texpensiveValidation = false\n): TestTree {\n\tconst factory = idSourceFactory ?? (() => new IdCompressor(createSessionId(), reservedIdCount));\n\treturn new RefreshingTestTree(() => {\n\t\treturn setUpTestTree(factory(), expensiveValidation);\n\t}, fn);\n}\n\nexport function makeNodeIdContext(idCompressor?: IdCompressor): NodeIdContext & NodeIdNormalizer<OpSpaceNodeId> {\n\tconst compressor = idCompressor ?? new IdCompressor(createSessionId(), reservedIdCount);\n\treturn getNodeIdContext(compressor);\n}\n\n/**\n * Applies an arbitrary edit to the given SharedTree which leaves the tree in the same state that it was before the edit.\n * This is useful for test scenarios that want to apply edits but don't care what they do.\n */\nexport function applyNoop(tree: SharedTree): Edit<unknown> {\n\treturn tree.applyEdit(...noopEdit(tree.currentView));\n}\n\n/**\n * Creates an arbitrary edit which leaves a tree in the same state that it was before the edit.\n * This is useful for test scenarios that want to create edits but don't care what they do.\n */\nexport function noopEdit(view: TreeView): Change[] {\n\tconst traitLocation = testTrait(view);\n\tconst trait = view.getTrait(traitLocation);\n\t// Set the test trait to the same thing that it already was\n\treturn setTrait(\n\t\ttraitLocation,\n\t\ttrait.map((id) => getChangeNodeFromViewNode(view, id))\n\t);\n}\n\n/** Translate an ID in one context to an ID in another */\nexport function translateId(id: NodeId | NodeData<NodeId>, from: NodeIdConverter, to: NodeIdConverter): NodeId {\n\treturn to.convertToNodeId(from.convertToStableNodeId(getNodeId(id)));\n}\n\nexport function normalizeId(tree: SharedTree, id: NodeId): OpSpaceNodeId {\n\tconst normalizer = getIdNormalizerFromSharedTree(tree);\n\treturn normalizer.normalizeToOpSpace(id);\n}\n\nexport function normalizeIds(tree: SharedTree, ...ids: NodeId[]): OpSpaceNodeId[] {\n\tconst normalizer = getIdNormalizerFromSharedTree(tree);\n\treturn ids.map((id) => normalizer.normalizeToOpSpace(id));\n}\n\nexport function idsAreEqual(treeA: SharedTree, idsA: NodeId[], treeB: SharedTree, idsB: NodeId[]): boolean {\n\tif (idsA.length !== idsB.length) {\n\t\treturn false;\n\t}\n\tconst contextA = getIdNormalizerFromSharedTree(treeA);\n\tconst contextB = getIdNormalizerFromSharedTree(treeB);\n\tfor (let i = 0; i < idsA.length; i++) {\n\t\tif (contextA.normalizeToOpSpace(idsA[i]) !== contextB.normalizeToOpSpace(idsB[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport function normalizeEdit(\n\ttree: SharedTree,\n\tedit: Edit<ChangeInternal>\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, OpSpaceNodeId>> {\n\tconst context = getIdNormalizerFromSharedTree(tree);\n\treturn convertEditIds(edit, (id) => context.normalizeToOpSpace(id));\n}\n\nexport function stabilizeEdit(\n\ttree: SharedTree,\n\tedit: Edit<ChangeInternal>\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, StableNodeId>> {\n\treturn convertEditIds(edit, (id) => tree.convertToStableNodeId(id));\n}\n\nexport function getEditLogInternal(tree: SharedTree): OrderedEditSet<ChangeInternal> {\n\treturn tree.edits as unknown as OrderedEditSet<ChangeInternal>;\n}\n\n/**\n * Spies on all future ops submitted to `containerRuntimeFactory`. When ops are submitted, they will be `push`ed into the\n * returned array.\n */\nexport function spyOnSubmittedOps<Op extends SharedTreeOp | SharedTreeOp_0_0_2>(\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory\n): Op[] {\n\tconst ops: Op[] = [];\n\tconst originalPush = containerRuntimeFactory.pushMessage.bind(containerRuntimeFactory);\n\tcontainerRuntimeFactory.pushMessage = (message: Partial<ISequencedDocumentMessage>) => {\n\t\tconst { contents } = message;\n\t\tops.push(contents as Op);\n\t\toriginalPush(message);\n\t};\n\treturn ops;\n}\n\n/**\n * Waits for summarization to occur, and returns a version that can be passed into newly loaded containers\n * to ensure they load this summary version. Use the `LoaderHeader.version` header.\n */\nexport async function waitForSummary(mainContainer: IContainer): Promise<string> {\n\tconst { deltaManager } = mainContainer;\n\tconst summaryCollection = new SummaryCollection(deltaManager, createChildLogger());\n\tconst ackedSummary = await summaryCollection.waitSummaryAck(deltaManager.lastSequenceNumber);\n\treturn ackedSummary.summaryAck.contents.handle;\n}\n\n/**\n * Runs an action while the given container has been paused\n */\nexport async function withContainerOffline<TReturn>(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainerExperimental,\n\taction: () => TReturn\n): Promise<{ actionReturn: TReturn; pendingLocalState: string }> {\n\tawait provider.ensureSynchronized();\n\tawait provider.opProcessingController.pauseProcessing(container);\n\tconst actionReturn = action();\n\tconst pendingLocalState = await container.closeAndGetPendingLocalState?.();\n\tassert(pendingLocalState !== undefined, 0x726 /* pendingLocalState should be defined */);\n\treturn { actionReturn, pendingLocalState };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TestUtilities.js","sourceRoot":"","sources":["../../../src/test/utilities/TestUtilities.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAA0B,MAAM,EAAE,sBAAsB,E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,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IACpC,MAAM,QAAQ,CAAC,sBAAsB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACjE,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;IAC9B,MAAM,iBAAiB,GAAG,MAAM,SAAS,CAAC,4BAA4B,EAAE,EAAE,CAAC;IAC3E,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,yCAAyC,CAAC,CAAC;IACzF,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAC5C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { resolve } from 'path';\nimport { assert } from '@fluidframework/core-utils';\nimport { v5 as uuidv5 } from 'uuid';\nimport { expect } from 'chai';\nimport { LocalServerTestDriver } from '@fluid-private/test-drivers';\nimport { SummaryCollection, DefaultSummaryConfiguration } from '@fluidframework/container-runtime';\nimport { IContainerExperimental, Loader, waitContainerToCatchUp } from '@fluidframework/container-loader';\nimport {\n\tMockContainerRuntimeFactory,\n\tMockFluidDataStoreRuntime,\n\tMockStorage,\n} from '@fluidframework/test-runtime-utils';\nimport {\n\tChannelFactoryRegistry,\n\tITestFluidObject,\n\tTestObjectProvider,\n\tTestContainerRuntimeFactory,\n\tTestFluidObjectFactory,\n\tcreateAndAttachContainer,\n\tITestObjectProvider,\n} from '@fluidframework/test-utils';\nimport type { IContainer, IHostLoader } from '@fluidframework/container-definitions';\nimport type {\n\tConfigTypes,\n\tIConfigProviderBase,\n\tIFluidCodeDetails,\n\tIFluidHandle,\n\tIRequestHeader,\n} from '@fluidframework/core-interfaces';\nimport { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';\nimport { createChildLogger } from '@fluidframework/telemetry-utils';\nimport { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';\nimport {\n\tAttributionId,\n\tDetachedSequenceId,\n\tEditId,\n\tNodeId,\n\tOpSpaceNodeId,\n\tSessionId,\n\tStableNodeId,\n} from '../../Identifiers';\nimport { fail, identity, ReplaceRecursive } from '../../Common';\nimport { IdCompressor } from '../../id-compressor';\nimport { createSessionId } from '../../id-compressor/NumericUuid';\nimport { getChangeNodeFromViewNode } from '../../SerializationUtilities';\nimport { initialTree } from '../../InitialTree';\nimport {\n\tChangeInternal,\n\tEdit,\n\tNodeData,\n\tPayload,\n\treservedIdCount,\n\tSharedTreeOp,\n\tSharedTreeOp_0_0_2,\n\tWriteFormat,\n} from '../../persisted-types';\nimport { TraitLocation, TreeView } from '../../TreeView';\nimport { SharedTreeDiagnosticEvent } from '../../EventTypes';\nimport { getNodeId, getNodeIdContext, NodeIdContext, NodeIdConverter, NodeIdNormalizer } from '../../NodeIdUtilities';\nimport { newEdit, setTrait } from '../../EditUtilities';\nimport { SharedTree, SharedTreeFactory, SharedTreeOptions_0_0_2 } from '../../SharedTree';\nimport { BuildNode, Change, StablePlace } from '../../ChangeTypes';\nimport { convertEditIds } from '../../IdConversion';\nimport { OrderedEditSet } from '../../EditLog';\nimport { buildLeaf, RefreshingTestTree, SimpleTestTree, TestTree } from './TestNode';\n\n/** Objects returned by setUpTestSharedTree */\nexport interface SharedTreeTestingComponents {\n\t/** The MockFluidDataStoreRuntime used to created the SharedTree. */\n\tcomponentRuntime: MockFluidDataStoreRuntime;\n\t/**\n\t * The MockContainerRuntimeFactory created if one was not provided in the options.\n\t * Only connected to the SharedTree if the localMode option was set to false.\n\t * */\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory;\n\t/** The SharedTree created and set up. */\n\ttree: SharedTree;\n}\n\n/** Options used to customize setUpTestSharedTree */\nexport interface SharedTreeTestingOptions {\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same containerRuntimeFactory,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: BuildNode;\n\t/** If false, a MockContainerRuntimeFactory connected to the SharedTree will be returned. */\n\tlocalMode?: boolean;\n\t/**\n\t * MockContainerRuntimeFactory to connect the SharedTree to. A new one will not be created if one is provided.\n\t * If localMode is set to true, it will not be connected to the created SharedTree.\n\t * */\n\tcontainerRuntimeFactory?: MockContainerRuntimeFactory;\n\t/** Iff true, do not `fail` on invalid edits */\n\tallowInvalid?: boolean;\n\t/** Iff true, do not `fail` on malformed edits */\n\tallowMalformed?: boolean;\n\t/** Unless set to true, a SharedTree error causes the test to fail */\n\tnoFailOnError?: boolean;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If not set, summaries will be written in format 0.1.1.\n\t */\n\twriteFormat?: WriteFormat;\n\t/**\n\t * Optional attribution ID to give to the new tree\n\t */\n\tattributionId?: AttributionId;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n\n\t/**\n\t * Telemetry logger injected into the SharedTree.\n\t */\n\tlogger?: ITelemetryBaseLogger;\n}\n\nexport const testTraitLabel = SimpleTestTree.traitLabel;\nexport function testTrait(view: TreeView): TraitLocation {\n\treturn {\n\t\tlabel: testTraitLabel,\n\t\tparent: view.root,\n\t};\n}\n\n/** Sets up and returns an object of components useful for testing SharedTree. */\nexport function setUpTestSharedTree(\n\toptions: SharedTreeTestingOptions = { localMode: true }\n): SharedTreeTestingComponents {\n\tconst {\n\t\tid,\n\t\tinitialTree,\n\t\tlocalMode,\n\t\tcontainerRuntimeFactory,\n\t\tsetupEditId,\n\t\tsummarizeHistory,\n\t\twriteFormat,\n\t\tattributionId,\n\t} = options;\n\tlet componentRuntime: MockFluidDataStoreRuntime;\n\tif (options.logger) {\n\t\tconst proxyHandler: ProxyHandler<MockFluidDataStoreRuntime> = {\n\t\t\tget: (target, prop, receiver) => {\n\t\t\t\tif (prop === 'logger' && options.logger) {\n\t\t\t\t\treturn options.logger;\n\t\t\t\t}\n\t\t\t\treturn target[prop as keyof MockFluidDataStoreRuntime];\n\t\t\t},\n\t\t};\n\t\tcomponentRuntime = new Proxy(new MockFluidDataStoreRuntime(), proxyHandler);\n\t} else {\n\t\tcomponentRuntime = new MockFluidDataStoreRuntime();\n\t}\n\n\t// Enable expensiveValidation\n\tlet factory: SharedTreeFactory;\n\tif (writeFormat === WriteFormat.v0_0_2) {\n\t\tconst options: SharedTreeOptions_0_0_2 = { summarizeHistory: summarizeHistory ?? true };\n\t\tfactory = SharedTree.getFactory(writeFormat, options);\n\t} else {\n\t\tconst options = {\n\t\t\tsummarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: true } : false,\n\t\t\tattributionId,\n\t\t};\n\t\tfactory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);\n\t}\n\tconst tree = factory.create(componentRuntime, id ?? 'testSharedTree');\n\n\tif (options.allowInvalid === undefined || !options.allowInvalid) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedInvalidEdit, () => fail('unexpected invalid edit'));\n\t}\n\n\tif (options.allowMalformed === undefined || !options.allowMalformed) {\n\t\ttree.on(SharedTreeDiagnosticEvent.DroppedMalformedEdit, () => fail('unexpected malformed edit'));\n\t}\n\n\tif (options.noFailOnError === undefined || !options.noFailOnError) {\n\t\t// any errors thrown by a SharedObject event listener will be caught and\n\t\t// reemitted on this event. For testing purposes, rethrow so that it\n\t\t// actually causes the test to fail.\n\t\ttree.on('error', (error) => {\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tconst newContainerRuntimeFactory = containerRuntimeFactory ?? new MockContainerRuntimeFactory();\n\n\tif (localMode === true) {\n\t\tcomponentRuntime.local = true;\n\t} else {\n\t\tconst containerRuntime = newContainerRuntimeFactory.createContainerRuntime(componentRuntime);\n\t\tconst services = {\n\t\t\tdeltaConnection: componentRuntime.createDeltaConnection(),\n\t\t\tobjectStorage: new MockStorage(undefined),\n\t\t};\n\t\ttree.connect(services);\n\t}\n\n\tif (initialTree !== undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn {\n\t\tcomponentRuntime,\n\t\tcontainerRuntimeFactory: newContainerRuntimeFactory,\n\t\ttree,\n\t};\n}\n\nconst TestDataStoreType = '@fluid-example/test-dataStore';\n\n/** Objects returned by setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingComponents {\n\t/** The testObjectProvider created if one was not set in the options. */\n\ttestObjectProvider: TestObjectProvider;\n\t/** The SharedTree created and set up. */\n\ttree: SharedTree;\n\t/** The container created and set up. */\n\tcontainer: IContainer;\n\t/** Handles to any blobs uploaded via `blobs` */\n\tuploadedBlobs: IFluidHandle<ArrayBufferLike>[];\n}\n\n/** Options used to customize setUpLocalServerTestSharedTree */\nexport interface LocalServerSharedTreeTestingOptions {\n\t/** Contents of blobs that should be uploaded to the runtime upon creation. Handles to these blobs will be returned. */\n\tblobs?: ArrayBufferLike[];\n\t/** Headers to include on the container load request. */\n\theaders?: IRequestHeader;\n\t/**\n\t * Id for the SharedTree to be created.\n\t * If two SharedTrees have the same id and the same testObjectProvider,\n\t * they will collaborate (send edits to each other)\n\t */\n\tid?: string;\n\t/** Node to initialize the SharedTree with. */\n\tinitialTree?: BuildNode;\n\t/** If set, uses the provider to create the container and create the SharedTree. */\n\ttestObjectProvider?: TestObjectProvider;\n\t/**\n\t * If not set, full history will be preserved.\n\t */\n\tsummarizeHistory?: boolean;\n\t/**\n\t * If not set, summaries will be written in format 0.0.2.\n\t */\n\twriteFormat?: WriteFormat;\n\t/**\n\t * Optional attribution ID to give to the new tree\n\t */\n\tattributionId?: AttributionId;\n\t/**\n\t * If not set, will upload edit chunks when they are full.\n\t */\n\tuploadEditChunks?: boolean;\n\t/**\n\t * If set, uses the given id as the edit id for tree setup. Only has an effect if initialTree is also set.\n\t */\n\tsetupEditId?: EditId;\n\t/**\n\t * If set, will be passed to the container on load\n\t */\n\tpendingLocalState?: string;\n\t/**\n\t * If set, will be added to the configProvider object passed to the loader\n\t * and will take effect for the duration of its lifetime\n\t */\n\tfeatureGates?: Record<string, ConfigTypes>;\n}\n\nconst testObjectProviders: TestObjectProvider[] = [];\nafterEach(() => {\n\tfor (const provider of testObjectProviders) {\n\t\tprovider.reset();\n\t}\n\ttestObjectProviders.length = 0;\n});\n\n/**\n * Sets up and returns an object of components useful for testing SharedTree with a local server.\n * Required for tests that involve the uploadBlob API.\n *\n * Any TestObjectProvider created by this function will be reset after the test completes (via afterEach) hook.\n */\nexport async function setUpLocalServerTestSharedTree(\n\toptions: LocalServerSharedTreeTestingOptions\n): Promise<LocalServerSharedTreeTestingComponents> {\n\tconst {\n\t\tblobs,\n\t\theaders,\n\t\tid,\n\t\tinitialTree,\n\t\ttestObjectProvider,\n\t\tsetupEditId,\n\t\tsummarizeHistory,\n\t\twriteFormat,\n\t\tuploadEditChunks,\n\t\tattributionId,\n\t\tpendingLocalState,\n\t} = options;\n\n\tconst featureGates = options.featureGates ?? {};\n\tfeatureGates['Fluid.Container.enableOfflineLoad'] = true;\n\tfeatureGates['Fluid.ContainerRuntime.DisablePartialFlush'] = true;\n\n\tconst treeId = id ?? 'test';\n\tlet factory: SharedTreeFactory;\n\tif (writeFormat === WriteFormat.v0_0_2) {\n\t\tconst options: SharedTreeOptions_0_0_2 = { summarizeHistory: summarizeHistory ?? true };\n\t\tfactory = SharedTree.getFactory(writeFormat, options);\n\t} else {\n\t\tconst options = {\n\t\t\tsummarizeHistory: summarizeHistory ?? true ? { uploadEditChunks: uploadEditChunks ?? true } : false,\n\t\t\tattributionId,\n\t\t};\n\t\tfactory = SharedTree.getFactory(writeFormat ?? WriteFormat.v0_1_1, options);\n\t}\n\tconst registry: ChannelFactoryRegistry = [[treeId, factory]];\n\n\tconst runtimeFactory = () =>\n\t\tnew TestContainerRuntimeFactory(TestDataStoreType, new TestFluidObjectFactory(registry), {\n\t\t\tsummaryOptions: {\n\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t...{\n\t\t\t\t\t\tminIdleTime: 1000, // Manually set idle times so some SharedTree tests don't timeout.\n\t\t\t\t\t\tmaxIdleTime: 1000,\n\t\t\t\t\t\tmaxTime: 1000 * 12,\n\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\tconst defaultCodeDetails: IFluidCodeDetails = {\n\t\tpackage: 'defaultTestPackage',\n\t\tconfig: {},\n\t};\n\n\tfunction makeTestLoader(provider: TestObjectProvider): IHostLoader {\n\t\tconst fluidEntryPoint = runtimeFactory();\n\t\tconst configProvider = (settings: Record<string, ConfigTypes>): IConfigProviderBase => ({\n\t\t\tgetRawConfig: (name: string): ConfigTypes => settings[name],\n\t\t});\n\n\t\treturn provider.createLoader([[defaultCodeDetails, fluidEntryPoint]], {\n\t\t\toptions: { maxClientLeaveWaitTime: 1000 },\n\t\t\tconfigProvider: configProvider(featureGates),\n\t\t});\n\t}\n\n\tlet provider: TestObjectProvider;\n\tlet container: IContainer;\n\n\tif (testObjectProvider !== undefined) {\n\t\tprovider = testObjectProvider;\n\t\tconst driver = new LocalServerTestDriver();\n\t\tconst loader = makeTestLoader(provider);\n\t\t// Once ILoaderOptions is specificable, this should use `provider.loadTestContainer` instead.\n\t\tcontainer = await loader.resolve({ url: await driver.createContainerUrl(treeId), headers }, pendingLocalState);\n\t\tawait waitContainerToCatchUp(container);\n\t} else {\n\t\tconst driver = new LocalServerTestDriver();\n\t\tprovider = new TestObjectProvider(Loader, driver, runtimeFactory);\n\t\ttestObjectProviders.push(provider);\n\t\t// Once ILoaderOptions is specificable, this should use `provider.makeTestContainer` instead.\n\t\tconst loader = makeTestLoader(provider);\n\t\tcontainer = await createAndAttachContainer(defaultCodeDetails, loader, driver.createCreateNewRequest(treeId));\n\t}\n\n\tconst dataObject = (await container.getEntryPoint()) as ITestFluidObject;\n\n\tconst uploadedBlobs =\n\t\tblobs === undefined ? [] : await Promise.all(blobs.map(async (blob) => dataObject.context.uploadBlob(blob)));\n\tconst tree = await dataObject.getSharedObject<SharedTree>(treeId);\n\n\tif (initialTree !== undefined && testObjectProvider === undefined) {\n\t\tsetTestTree(tree, initialTree, setupEditId);\n\t}\n\n\treturn { container, tree, testObjectProvider: provider, uploadedBlobs };\n}\n\n/** Sets testTrait to contain `node`. */\nfunction setTestTree(tree: SharedTree, node: BuildNode, overrideId?: EditId): EditId {\n\tconst trait = testTrait(tree.currentView);\n\tif (overrideId === undefined) {\n\t\treturn tree.applyEdit(...setTrait(trait, node)).id;\n\t} else {\n\t\tconst changes = setTrait(trait, node).map((c) => tree.internalizeChange(c));\n\t\treturn tree.applyEditInternal({ changes, id: overrideId }).id;\n\t}\n}\n\n/**\n * Creates a list of edits with stable IDs that can be processed by a SharedTree.\n * @returns the list of created edits\n */\nexport function createStableEdits(\n\tnumberOfEdits: number,\n\tidContext: NodeIdContext = makeNodeIdContext(),\n\tpayload: (i: number) => Payload = identity\n): Edit<ChangeInternal>[] {\n\tif (numberOfEdits === 0) {\n\t\treturn [];\n\t}\n\n\tconst uuidNamespace = '44864298-500e-4cf8-9f44-a249e5b3a286';\n\tconst nodeId = idContext.generateNodeId('ae6b24eb-6fa8-42cc-abd2-48f250b7798f');\n\tconst node = buildLeaf(nodeId);\n\tconst insertEmptyNode = newEdit([\n\t\tChangeInternal.build([node], 0 as DetachedSequenceId),\n\t\tChangeInternal.insert(\n\t\t\t0 as DetachedSequenceId,\n\t\t\tStablePlace.atEndOf({ label: testTraitLabel, parent: idContext.convertToNodeId(initialTree.identifier) })\n\t\t),\n\t]);\n\n\tconst edits: Edit<ChangeInternal>[] = [{ ...insertEmptyNode, id: uuidv5('test', uuidNamespace) as EditId }];\n\n\t// Every subsequent edit is a set payload\n\tfor (let i = 1; i < numberOfEdits; i++) {\n\t\tconst edit = newEdit([ChangeInternal.setPayload(nodeId, payload(i))]);\n\t\tedits.push({ ...edit, id: uuidv5(i.toString(), uuidNamespace) as EditId });\n\t}\n\n\treturn edits;\n}\n\n/** Asserts that changes to SharedTree in editor() function do not cause any observable state change */\nexport function assertNoDelta(tree: SharedTree, editor: () => void) {\n\tconst viewA = tree.currentView;\n\teditor();\n\tconst viewB = tree.currentView;\n\tconst delta = viewA.delta(viewB);\n\texpect(delta).deep.equals({\n\t\tchanged: [],\n\t\tadded: [],\n\t\tremoved: [],\n\t});\n}\n\n/**\n * Used to test error throwing in async functions.\n */\nexport async function asyncFunctionThrowsCorrectly(\n\tasyncFunction: () => Promise<unknown>,\n\texpectedError: string\n): Promise<boolean> {\n\tlet errorMessage: string | undefined;\n\n\ttry {\n\t\tawait asyncFunction();\n\t} catch (error) {\n\t\terrorMessage = (error as Error).message;\n\t}\n\n\treturn errorMessage === expectedError;\n}\n\n/**\n * Returns true if two nodes have equivalent data, otherwise false.\n * Does not compare children or payloads.\n * @param nodes - two or more nodes to compare\n */\nexport function areNodesEquivalent(...nodes: NodeData<unknown>[]): boolean {\n\tif (nodes.length < 2) {\n\t\tfail('Too few nodes to compare');\n\t}\n\n\tfor (let i = 1; i < nodes.length; i++) {\n\t\tif (nodes[i].definition !== nodes[0].definition) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (nodes[i].identifier !== nodes[0].identifier) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n// This accounts for this file being executed after compilation. If many tests want to leverage resources, we should unify\n// resource path logic to a single place.\nexport const testDocumentsPathBase = resolve(__dirname, '../../../src/test/documents/');\n\nexport const versionComparator = (versionA: string, versionB: string): number => {\n\tconst versionASplit = versionA.split('.');\n\tconst versionBSplit = versionB.split('.');\n\n\tassert(\n\t\tversionASplit.length === versionBSplit.length && versionASplit.length === 3,\n\t\t0x668 /* Version numbers should follow semantic versioning. */\n\t);\n\n\tfor (let i = 0; i < 3; ++i) {\n\t\tconst numberA = parseInt(versionASplit[i], 10);\n\t\tconst numberB = parseInt(versionBSplit[i], 10);\n\n\t\tif (numberA > numberB) {\n\t\t\treturn 1;\n\t\t}\n\n\t\tif (numberA < numberB) {\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\treturn 0;\n};\n\n/**\n * Create a {@link SimpleTestTree} from the given {@link SharedTree} or {@link IdCompressor}\n */\nexport function setUpTestTree(idSource?: IdCompressor | SharedTree, expensiveValidation = false): TestTree {\n\tconst source = idSource ?? new IdCompressor(createSessionId(), reservedIdCount);\n\tif (source instanceof SharedTree) {\n\t\tassert(source.edits.length === 0, 0x669 /* tree must be a new SharedTree */);\n\t\tconst getNormalizer = () => getIdNormalizerFromSharedTree(source);\n\t\tconst contextWrapper = {\n\t\t\tnormalizeToOpSpace: (id: NodeId) => getNormalizer().normalizeToOpSpace(id),\n\t\t\tnormalizeToSessionSpace: (id: OpSpaceNodeId, sessionId: SessionId) =>\n\t\t\t\tgetNormalizer().normalizeToSessionSpace(id, sessionId),\n\t\t\tget localSessionId() {\n\t\t\t\treturn getNormalizer().localSessionId;\n\t\t\t},\n\t\t};\n\t\tconst simpleTestTree = new SimpleTestTree(source, contextWrapper, expensiveValidation);\n\t\tsetTestTree(source, simpleTestTree);\n\t\treturn simpleTestTree;\n\t}\n\n\tconst context = makeNodeIdContext(source);\n\treturn new SimpleTestTree(context, context, expensiveValidation);\n}\n\n/**\n * Gets an id normalizer from the provided shared-tree. This is\n */\nexport function getIdNormalizerFromSharedTree(sharedTree: SharedTree): NodeIdNormalizer<OpSpaceNodeId> {\n\treturn (\n\t\t((sharedTree as any).idNormalizer as NodeIdNormalizer<OpSpaceNodeId>) ??\n\t\tfail('Failed to find SharedTree normalizer')\n\t);\n}\n\n/**\n * Create a {@link SimpleTestTree} before each test\n */\nexport function refreshTestTree(\n\tidSourceFactory?: (() => IdCompressor) | (() => SharedTree),\n\tfn?: (testTree: TestTree) => void,\n\texpensiveValidation = false\n): TestTree {\n\tconst factory = idSourceFactory ?? (() => new IdCompressor(createSessionId(), reservedIdCount));\n\treturn new RefreshingTestTree(() => {\n\t\treturn setUpTestTree(factory(), expensiveValidation);\n\t}, fn);\n}\n\nexport function makeNodeIdContext(idCompressor?: IdCompressor): NodeIdContext & NodeIdNormalizer<OpSpaceNodeId> {\n\tconst compressor = idCompressor ?? new IdCompressor(createSessionId(), reservedIdCount);\n\treturn getNodeIdContext(compressor);\n}\n\n/**\n * Applies an arbitrary edit to the given SharedTree which leaves the tree in the same state that it was before the edit.\n * This is useful for test scenarios that want to apply edits but don't care what they do.\n */\nexport function applyNoop(tree: SharedTree): Edit<unknown> {\n\treturn tree.applyEdit(...noopEdit(tree.currentView));\n}\n\n/**\n * Creates an arbitrary edit which leaves a tree in the same state that it was before the edit.\n * This is useful for test scenarios that want to create edits but don't care what they do.\n */\nexport function noopEdit(view: TreeView): Change[] {\n\tconst traitLocation = testTrait(view);\n\tconst trait = view.getTrait(traitLocation);\n\t// Set the test trait to the same thing that it already was\n\treturn setTrait(\n\t\ttraitLocation,\n\t\ttrait.map((id) => getChangeNodeFromViewNode(view, id))\n\t);\n}\n\n/** Translate an ID in one context to an ID in another */\nexport function translateId(id: NodeId | NodeData<NodeId>, from: NodeIdConverter, to: NodeIdConverter): NodeId {\n\treturn to.convertToNodeId(from.convertToStableNodeId(getNodeId(id)));\n}\n\nexport function normalizeId(tree: SharedTree, id: NodeId): OpSpaceNodeId {\n\tconst normalizer = getIdNormalizerFromSharedTree(tree);\n\treturn normalizer.normalizeToOpSpace(id);\n}\n\nexport function normalizeIds(tree: SharedTree, ...ids: NodeId[]): OpSpaceNodeId[] {\n\tconst normalizer = getIdNormalizerFromSharedTree(tree);\n\treturn ids.map((id) => normalizer.normalizeToOpSpace(id));\n}\n\nexport function idsAreEqual(treeA: SharedTree, idsA: NodeId[], treeB: SharedTree, idsB: NodeId[]): boolean {\n\tif (idsA.length !== idsB.length) {\n\t\treturn false;\n\t}\n\tconst contextA = getIdNormalizerFromSharedTree(treeA);\n\tconst contextB = getIdNormalizerFromSharedTree(treeB);\n\tfor (let i = 0; i < idsA.length; i++) {\n\t\tif (contextA.normalizeToOpSpace(idsA[i]) !== contextB.normalizeToOpSpace(idsB[i])) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport function normalizeEdit(\n\ttree: SharedTree,\n\tedit: Edit<ChangeInternal>\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, OpSpaceNodeId>> {\n\tconst context = getIdNormalizerFromSharedTree(tree);\n\treturn convertEditIds(edit, (id) => context.normalizeToOpSpace(id));\n}\n\nexport function stabilizeEdit(\n\ttree: SharedTree,\n\tedit: Edit<ChangeInternal>\n): Edit<ReplaceRecursive<ChangeInternal, NodeId, StableNodeId>> {\n\treturn convertEditIds(edit, (id) => tree.convertToStableNodeId(id));\n}\n\nexport function getEditLogInternal(tree: SharedTree): OrderedEditSet<ChangeInternal> {\n\treturn tree.edits as unknown as OrderedEditSet<ChangeInternal>;\n}\n\n/**\n * Spies on all future ops submitted to `containerRuntimeFactory`. When ops are submitted, they will be `push`ed into the\n * returned array.\n */\nexport function spyOnSubmittedOps<Op extends SharedTreeOp | SharedTreeOp_0_0_2>(\n\tcontainerRuntimeFactory: MockContainerRuntimeFactory\n): Op[] {\n\tconst ops: Op[] = [];\n\tconst originalPush = containerRuntimeFactory.pushMessage.bind(containerRuntimeFactory);\n\tcontainerRuntimeFactory.pushMessage = (message: Partial<ISequencedDocumentMessage>) => {\n\t\tconst { contents } = message;\n\t\tops.push(contents as Op);\n\t\toriginalPush(message);\n\t};\n\treturn ops;\n}\n\n/**\n * Waits for summarization to occur, and returns a version that can be passed into newly loaded containers\n * to ensure they load this summary version. Use the `LoaderHeader.version` header.\n */\nexport async function waitForSummary(mainContainer: IContainer): Promise<string> {\n\tconst { deltaManager } = mainContainer;\n\tconst summaryCollection = new SummaryCollection(deltaManager, createChildLogger());\n\tconst ackedSummary = await summaryCollection.waitSummaryAck(deltaManager.lastSequenceNumber);\n\treturn ackedSummary.summaryAck.contents.handle;\n}\n\n/**\n * Runs an action while the given container has been paused\n */\nexport async function withContainerOffline<TReturn>(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainerExperimental,\n\taction: () => TReturn\n): Promise<{ actionReturn: TReturn; pendingLocalState: string }> {\n\tawait provider.ensureSynchronized();\n\tawait provider.opProcessingController.pauseProcessing(container);\n\tconst actionReturn = action();\n\tconst pendingLocalState = await container.closeAndGetPendingLocalState?.();\n\tassert(pendingLocalState !== undefined, 0x726 /* pendingLocalState should be defined */);\n\treturn { actionReturn, pendingLocalState };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/tree",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.1.0.0",
|
|
4
4
|
"description": "Distributed tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -15,43 +15,43 @@
|
|
|
15
15
|
"module": "lib/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fluid-
|
|
19
|
-
"@
|
|
20
|
-
"@fluidframework/
|
|
21
|
-
"@fluidframework/core-
|
|
22
|
-
"@fluidframework/
|
|
23
|
-
"@fluidframework/
|
|
24
|
-
"@fluidframework/
|
|
25
|
-
"@fluidframework/
|
|
26
|
-
"@fluidframework/
|
|
27
|
-
"@fluidframework/
|
|
18
|
+
"@fluid-internal/client-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
19
|
+
"@fluidframework/container-definitions": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
20
|
+
"@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
21
|
+
"@fluidframework/core-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
22
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
23
|
+
"@fluidframework/protocol-definitions": "^3.1.0",
|
|
24
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
25
|
+
"@fluidframework/shared-object-base": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
26
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
27
|
+
"@fluidframework/tree": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
28
|
+
"@tylerbu/sorted-btree-es6": "^1.8.0",
|
|
28
29
|
"buffer": "^6.0.3",
|
|
29
30
|
"denque": "^1.5.1",
|
|
30
31
|
"lru-cache": "^6.0.0",
|
|
31
|
-
"sorted-btree": "^1.8.0",
|
|
32
32
|
"uuid": "^9.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@fluid-private/stochastic-test-utils": ">=2.0.0-
|
|
36
|
-
"@fluid-private/test-drivers": ">=2.0.0-
|
|
35
|
+
"@fluid-private/stochastic-test-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
36
|
+
"@fluid-private/test-drivers": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
37
37
|
"@fluid-tools/benchmark": "^0.48.0",
|
|
38
38
|
"@fluidframework/build-common": "^2.0.3",
|
|
39
|
-
"@fluidframework/build-tools": "^0.
|
|
40
|
-
"@fluidframework/container-loader": ">=2.0.0-
|
|
41
|
-
"@fluidframework/container-runtime": ">=2.0.0-
|
|
42
|
-
"@fluidframework/eslint-config-fluid": "^3.
|
|
43
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-
|
|
44
|
-
"@fluidframework/runtime-utils": ">=2.0.0-
|
|
45
|
-
"@fluidframework/test-driver-definitions": ">=2.0.0-
|
|
46
|
-
"@fluidframework/test-runtime-utils": ">=2.0.0-
|
|
47
|
-
"@fluidframework/test-utils": ">=2.0.0-
|
|
48
|
-
"@fluidframework/undo-redo": ">=2.0.0-
|
|
39
|
+
"@fluidframework/build-tools": "^0.29.0",
|
|
40
|
+
"@fluidframework/container-loader": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
41
|
+
"@fluidframework/container-runtime": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
42
|
+
"@fluidframework/eslint-config-fluid": "^3.2.0",
|
|
43
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
44
|
+
"@fluidframework/runtime-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
45
|
+
"@fluidframework/test-driver-definitions": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
46
|
+
"@fluidframework/test-runtime-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
47
|
+
"@fluidframework/test-utils": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
48
|
+
"@fluidframework/undo-redo": ">=2.0.0-rc.1.0.0 <2.0.0-rc.1.1.0",
|
|
49
49
|
"@microsoft/api-extractor": "^7.38.3",
|
|
50
50
|
"@types/chai": "^4.0.0",
|
|
51
51
|
"@types/lru-cache": "^5.1.0",
|
|
52
52
|
"@types/mocha": "^9.1.1",
|
|
53
53
|
"@types/uuid": "^9.0.2",
|
|
54
|
-
"c8": "^
|
|
54
|
+
"c8": "^8.0.1",
|
|
55
55
|
"chai": "^4.2.0",
|
|
56
56
|
"cross-env": "^7.0.3",
|
|
57
57
|
"easy-table": "^1.1.1",
|
package/src/ChangeTypes.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { getNodeId } from './NodeIdUtilities';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* An object which may have traits with children of the given type underneath it
|
|
15
|
-
* @
|
|
15
|
+
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export interface HasVariadicTraits<TChild> {
|
|
18
18
|
readonly traits?: {
|
|
@@ -22,7 +22,7 @@ export interface HasVariadicTraits<TChild> {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* The type of a Change
|
|
25
|
-
* @
|
|
25
|
+
* @alpha
|
|
26
26
|
*/
|
|
27
27
|
export enum ChangeType {
|
|
28
28
|
Insert,
|
|
@@ -44,14 +44,14 @@ export enum ChangeType {
|
|
|
44
44
|
* ```typescript
|
|
45
45
|
* Change.insert(sourceId, destination)
|
|
46
46
|
* ```
|
|
47
|
-
* @
|
|
47
|
+
* @alpha
|
|
48
48
|
*/
|
|
49
49
|
export type Change = Insert | Detach | Build | SetValue | Constraint;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Node or a detached sequence of nodes (referred to by a detached sequence ID) for use in a Build change.
|
|
53
53
|
* See `BuildTreeNode` for more.
|
|
54
|
-
* @
|
|
54
|
+
* @alpha
|
|
55
55
|
*/
|
|
56
56
|
export type BuildNode = BuildTreeNode | number;
|
|
57
57
|
|
|
@@ -62,7 +62,7 @@ export type BuildNode = BuildTreeNode | number;
|
|
|
62
62
|
* BuildTreeNode can be observed. If `identifier` is not supplied, one will be generated for it in an especially efficient manner
|
|
63
63
|
* that allows for compact storage and transmission and thus this property should be omitted if convenient.
|
|
64
64
|
* See the SharedTree readme for more on the tree format.
|
|
65
|
-
* @
|
|
65
|
+
* @alpha
|
|
66
66
|
*/
|
|
67
67
|
export interface BuildTreeNode extends HasVariadicTraits<BuildNode> {
|
|
68
68
|
definition: string;
|
|
@@ -76,7 +76,7 @@ export interface BuildTreeNode extends HasVariadicTraits<BuildNode> {
|
|
|
76
76
|
*
|
|
77
77
|
* Valid if (transitively) all DetachedSequenceId are used according to their rules (use here counts as a destination),
|
|
78
78
|
* and all Nodes' identifiers are previously unused.
|
|
79
|
-
* @
|
|
79
|
+
* @alpha
|
|
80
80
|
*/
|
|
81
81
|
export interface Build {
|
|
82
82
|
readonly destination: number;
|
|
@@ -87,7 +87,7 @@ export interface Build {
|
|
|
87
87
|
/**
|
|
88
88
|
* Inserts a sequence of nodes at the specified destination.
|
|
89
89
|
* The source can be constructed either by a Build (used to insert new nodes) or a Detach (amounts to a "move" operation).
|
|
90
|
-
* @
|
|
90
|
+
* @alpha
|
|
91
91
|
*/
|
|
92
92
|
export interface Insert {
|
|
93
93
|
readonly destination: StablePlace;
|
|
@@ -100,7 +100,7 @@ export interface Insert {
|
|
|
100
100
|
* If a destination is specified, the detached sequence is associated with that ID and held for possible reuse
|
|
101
101
|
* by later changes in this same Edit (such as by an Insert).
|
|
102
102
|
* A Detach without a destination is a deletion of the specified sequence, as is a Detach with a destination that is not used later.
|
|
103
|
-
* @
|
|
103
|
+
* @alpha
|
|
104
104
|
*/
|
|
105
105
|
export interface Detach {
|
|
106
106
|
readonly destination?: number;
|
|
@@ -110,7 +110,7 @@ export interface Detach {
|
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Modifies the payload of a node.
|
|
113
|
-
* @
|
|
113
|
+
* @alpha
|
|
114
114
|
*/
|
|
115
115
|
export interface SetValue {
|
|
116
116
|
readonly nodeToModify: NodeId;
|
|
@@ -131,7 +131,7 @@ export interface SetValue {
|
|
|
131
131
|
* non-semantic ways. It is processed in order like any other Change in an Edit. It can cause an edit to fail if the
|
|
132
132
|
* various constraints are not met at the time of evaluation (ex: the parentNode has changed due to concurrent editing).
|
|
133
133
|
* Does not modify the document.
|
|
134
|
-
* @
|
|
134
|
+
* @alpha
|
|
135
135
|
*/
|
|
136
136
|
export interface Constraint {
|
|
137
137
|
/**
|
|
@@ -189,7 +189,7 @@ export interface Constraint {
|
|
|
189
189
|
|
|
190
190
|
// Note: Documentation of this constant is merged with documentation of the `Change` interface.
|
|
191
191
|
/**
|
|
192
|
-
* @
|
|
192
|
+
* @alpha
|
|
193
193
|
*/
|
|
194
194
|
export const Change = {
|
|
195
195
|
build: (source: BuildNode | TreeNodeSequence<BuildNode>, destination: number): Build => ({
|
|
@@ -288,7 +288,7 @@ export const Change = {
|
|
|
288
288
|
* StablePlace.before(node)
|
|
289
289
|
* StablePlace.atStartOf(trait)
|
|
290
290
|
* ```
|
|
291
|
-
* @
|
|
291
|
+
* @alpha
|
|
292
292
|
*/
|
|
293
293
|
export interface StablePlace {
|
|
294
294
|
/**
|
|
@@ -326,7 +326,7 @@ export interface StablePlace {
|
|
|
326
326
|
* ```typescript
|
|
327
327
|
* StableRange.from(StablePlace.before(startNode)).to(StablePlace.after(endNode))
|
|
328
328
|
* ```
|
|
329
|
-
* @
|
|
329
|
+
* @alpha
|
|
330
330
|
*/
|
|
331
331
|
export interface StableRange {
|
|
332
332
|
readonly start: StablePlace;
|
|
@@ -343,7 +343,7 @@ export interface StableRange {
|
|
|
343
343
|
|
|
344
344
|
// Note: Documentation of this constant is merged with documentation of the `StablePlace` interface.
|
|
345
345
|
/**
|
|
346
|
-
* @
|
|
346
|
+
* @alpha
|
|
347
347
|
*/
|
|
348
348
|
export const StablePlace = {
|
|
349
349
|
/**
|
|
@@ -369,7 +369,7 @@ export const StablePlace = {
|
|
|
369
369
|
|
|
370
370
|
// Note: Documentation of this constant is merged with documentation of the `StableRange` interface.
|
|
371
371
|
/**
|
|
372
|
-
* @
|
|
372
|
+
* @alpha
|
|
373
373
|
*/
|
|
374
374
|
export const StableRange = {
|
|
375
375
|
/**
|
package/src/Checkout.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { Change } from './ChangeTypes';
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* An event emitted by a `Checkout` to indicate a state change. See {@link ICheckoutEvents} for event argument information.
|
|
23
|
-
* @
|
|
23
|
+
* @alpha
|
|
24
24
|
*/
|
|
25
25
|
export enum CheckoutEvent {
|
|
26
26
|
/**
|
|
@@ -32,7 +32,7 @@ export enum CheckoutEvent {
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Events which may be emitted by `Checkout`. See {@link CheckoutEvent} for documentation of event semantics.
|
|
35
|
-
* @
|
|
35
|
+
* @alpha
|
|
36
36
|
*/
|
|
37
37
|
export interface ICheckoutEvents extends IErrorEvent {
|
|
38
38
|
(event: 'viewChange', listener: (before: TreeView, after: TreeView) => void);
|
|
@@ -40,7 +40,7 @@ export interface ICheckoutEvents extends IErrorEvent {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* The result of validation of an Edit.
|
|
43
|
-
* @
|
|
43
|
+
* @alpha
|
|
44
44
|
*/
|
|
45
45
|
export enum EditValidationResult {
|
|
46
46
|
/**
|
|
@@ -74,7 +74,7 @@ export enum EditValidationResult {
|
|
|
74
74
|
* Events emitted by `Checkout` are documented in {@link CheckoutEvent}.
|
|
75
75
|
* Exceptions thrown during event handling will be emitted as error events, which are automatically surfaced as error events on the
|
|
76
76
|
* `SharedTree` used at construction time.
|
|
77
|
-
* @
|
|
77
|
+
* @alpha
|
|
78
78
|
*/
|
|
79
79
|
export abstract class Checkout extends EventEmitterWithErrorHandling<ICheckoutEvents> implements IDisposable {
|
|
80
80
|
/**
|
package/src/Common.ts
CHANGED
package/src/EagerCheckout.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { EditCommittedEventArguments, SharedTree } from './SharedTree';
|
|
|
11
11
|
* Checkout that always stays up to date with the SharedTree.
|
|
12
12
|
* This means that {@link EagerCheckout.waitForPendingUpdates} is always a no-op since EagerCheckout is always up to date.
|
|
13
13
|
* @sealed
|
|
14
|
-
* @
|
|
14
|
+
* @alpha
|
|
15
15
|
*/
|
|
16
16
|
export class EagerCheckout extends Checkout {
|
|
17
17
|
/**
|
package/src/EditLog.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import BTree from 'sorted-btree';
|
|
6
|
+
import { BTree } from '@tylerbu/sorted-btree-es6';
|
|
7
7
|
import { TypedEventEmitter } from '@fluid-internal/client-utils';
|
|
8
8
|
import { assert, compareArrays } from '@fluidframework/core-utils';
|
|
9
9
|
import type { IEvent } from '@fluidframework/core-interfaces';
|
|
@@ -18,7 +18,7 @@ import type { ChangeCompressor } from './ChangeCompression';
|
|
|
18
18
|
* An ordered set of Edits associated with a SharedTree.
|
|
19
19
|
* Supports fast lookup of edits by ID and enforces idempotence.
|
|
20
20
|
* @sealed
|
|
21
|
-
* @
|
|
21
|
+
* @alpha
|
|
22
22
|
*/
|
|
23
23
|
export interface OrderedEditSet<TChange = unknown> {
|
|
24
24
|
/**
|
|
@@ -200,7 +200,7 @@ export type EditEvictionHandler = (editsToEvict: number) => void;
|
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Events which may be emitted by {@link EditLog}
|
|
203
|
-
* @
|
|
203
|
+
* @alpha
|
|
204
204
|
*/
|
|
205
205
|
export interface IEditLogEvents extends IEvent {
|
|
206
206
|
(event: 'unexpectedHistoryChunk', listener: () => void);
|
|
@@ -212,6 +212,7 @@ export interface IEditLogEvents extends IEvent {
|
|
|
212
212
|
* Ordered first by locality (acked or local), then by time of insertion.
|
|
213
213
|
* May not contain more than one edit with the same ID.
|
|
214
214
|
* @sealed
|
|
215
|
+
* @alpha
|
|
215
216
|
*/
|
|
216
217
|
export class EditLog<TChange = unknown> extends TypedEventEmitter<IEditLogEvents> implements OrderedEditSet<TChange> {
|
|
217
218
|
private localEditSequence = 0;
|
package/src/EditUtilities.ts
CHANGED
|
@@ -403,7 +403,7 @@ export function validateStablePlace(
|
|
|
403
403
|
|
|
404
404
|
/**
|
|
405
405
|
* The result of validating a place.
|
|
406
|
-
* @
|
|
406
|
+
* @alpha
|
|
407
407
|
*/
|
|
408
408
|
export enum PlaceValidationResult {
|
|
409
409
|
Valid = 'Valid',
|
|
@@ -415,7 +415,7 @@ export enum PlaceValidationResult {
|
|
|
415
415
|
|
|
416
416
|
/**
|
|
417
417
|
* The result of validating a bad place.
|
|
418
|
-
* @
|
|
418
|
+
* @alpha
|
|
419
419
|
*/
|
|
420
420
|
export type BadPlaceValidationResult = Exclude<PlaceValidationResult, PlaceValidationResult.Valid>;
|
|
421
421
|
|
|
@@ -471,7 +471,7 @@ export function validateStableRange(
|
|
|
471
471
|
|
|
472
472
|
/**
|
|
473
473
|
* The kinds of result of validating a range.
|
|
474
|
-
* @
|
|
474
|
+
* @alpha
|
|
475
475
|
*/
|
|
476
476
|
export enum RangeValidationResultKind {
|
|
477
477
|
Valid = 'Valid',
|
|
@@ -482,7 +482,7 @@ export enum RangeValidationResultKind {
|
|
|
482
482
|
|
|
483
483
|
/**
|
|
484
484
|
* The result of validating a range.
|
|
485
|
-
* @
|
|
485
|
+
* @alpha
|
|
486
486
|
*/
|
|
487
487
|
export type RangeValidationResult =
|
|
488
488
|
| RangeValidationResultKind.Valid
|
|
@@ -496,7 +496,7 @@ export type RangeValidationResult =
|
|
|
496
496
|
|
|
497
497
|
/**
|
|
498
498
|
* The result of validating a bad range.
|
|
499
|
-
* @
|
|
499
|
+
* @alpha
|
|
500
500
|
*/
|
|
501
501
|
export type BadRangeValidationResult = Exclude<RangeValidationResult, RangeValidationResultKind.Valid>;
|
|
502
502
|
|
package/src/EventTypes.ts
CHANGED
package/src/Forest.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import BTree from 'sorted-btree';
|
|
6
|
+
import { BTree } from '@tylerbu/sorted-btree-es6';
|
|
7
7
|
import { assert } from '@fluidframework/core-utils';
|
|
8
8
|
import { fail, copyPropertyIfDefined, compareBtrees, compareFiniteNumbers } from './Common';
|
|
9
9
|
import { NodeId, TraitLabel } from './Identifiers';
|
|
@@ -12,7 +12,7 @@ import { NodeData, Payload } from './persisted-types';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A node that can be contained within a Forest
|
|
15
|
-
* @
|
|
15
|
+
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export interface ForestNode extends NodeData<NodeId> {
|
|
18
18
|
readonly traits: ReadonlyMap<TraitLabel, readonly NodeId[]>;
|
|
@@ -40,7 +40,7 @@ export function isParentedForestNode(node: ForestNode): node is ParentedForestNo
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Information about a ForestNode's parent
|
|
43
|
-
* @
|
|
43
|
+
* @alpha
|
|
44
44
|
*/
|
|
45
45
|
export interface ParentData {
|
|
46
46
|
readonly parentId: NodeId;
|
|
@@ -49,7 +49,7 @@ export interface ParentData {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Differences from one forest to another.
|
|
52
|
-
* @
|
|
52
|
+
* @alpha
|
|
53
53
|
*/
|
|
54
54
|
export interface Delta<NodeId> {
|
|
55
55
|
/**
|
|
@@ -74,7 +74,7 @@ interface ForestState {
|
|
|
74
74
|
/**
|
|
75
75
|
* An immutable forest of ForestNode.
|
|
76
76
|
* Enforces single parenting, and allows querying the parent.
|
|
77
|
-
* @
|
|
77
|
+
* @alpha
|
|
78
78
|
*/
|
|
79
79
|
export class Forest {
|
|
80
80
|
/**
|