@fluidframework/container-runtime 2.93.0 → 2.100.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.
@@ -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 { type IDataStore, type IFluidDataStoreChannel } from "@fluidframework/runtime-definitions/internal";
5
+ import type { IDataStore, IFluidDataStoreChannel } from "@fluidframework/runtime-definitions/internal";
6
6
  import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
7
7
  import type { ChannelCollection } from "./channelCollection.js";
8
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,sBAAsB,EAE3B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACP,OAAO,yDAOnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACP,sBAAsB,cACjC,MAAM,qBACC,iBAAiB,UAC5B,mBAAmB,KACzB,UAAyF,CAAC"}
1
+ {"version":3,"file":"dataStore.d.ts","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAEX,UAAU,EACV,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACN,KAAK,mBAAmB,EAGxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,+BACP,OAAO,yDAOnC,CAAC;AAEF,eAAO,MAAM,kBAAkB,0BACP,sBAAsB,cACjC,MAAM,qBACC,iBAAiB,UAC5B,mBAAmB,KACzB,UAAyF,CAAC"}
package/lib/dataStore.js CHANGED
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import { AttachState } from "@fluidframework/container-definitions";
6
6
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
7
- import { asLegacyAlpha, } from "@fluidframework/runtime-definitions/internal";
8
7
  import { TelemetryDataTag, UsageError, } from "@fluidframework/telemetry-utils/internal";
9
8
  import { ContainerMessageType } from "./messageTypes.js";
10
9
  /**
@@ -33,7 +32,7 @@ class DataStore {
33
32
  if (alias.includes("/")) {
34
33
  throw new UsageError(`The alias cannot contain slashes: '${alias}'`);
35
34
  }
36
- if (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {
35
+ if (this.parentContext.containerRuntime.inStagingMode === true) {
37
36
  throw new UsageError("Cannot set aliases while in staging mode");
38
37
  }
39
38
  switch (this.aliasState) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAIN,aAAa,GACb,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEN,gBAAgB,EAChB,UAAU,G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ensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype AliasResult,\n\ttype IDataStore,\n\ttype IFluidDataStoreChannel,\n\tasLegacyAlpha,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n * @internal\n * @privateRemarks exported per ContainerRuntime export for testing purposes\n */\nexport interface IDataStoreAliasMessage {\n\t/**\n\t * The internal id of the datastore\n\t */\n\treadonly internalId: string;\n\t/**\n\t * The alias name to be assigned to the datastore\n\t */\n\treadonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: unknown,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.internalId ===\n\t\t\t\"string\" &&\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\t\tif (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {\n\t\t\tthrow new UsageError(\"Cannot set aliases while in staging mode\");\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased: {\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t\t}\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(\n\t\t\t\t{ type: ContainerMessageType.Alias, contents: message },\n\t\t\t\tresolve,\n\t\t\t);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: unknown) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStore.js","sourceRoot":"","sources":["../src/dataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,E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.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleInternal } from \"@fluidframework/core-interfaces/internal\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tAliasResult,\n\tIDataStore,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tTelemetryDataTag,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ChannelCollection } from \"./channelCollection.js\";\nimport { ContainerMessageType } from \"./messageTypes.js\";\n\n/**\n * Interface for an op to be used for assigning an\n * alias to a datastore\n * @internal\n * @privateRemarks exported per ContainerRuntime export for testing purposes\n */\nexport interface IDataStoreAliasMessage {\n\t/**\n\t * The internal id of the datastore\n\t */\n\treadonly internalId: string;\n\t/**\n\t * The alias name to be assigned to the datastore\n\t */\n\treadonly alias: string;\n}\n\n/**\n * Type guard that returns true if the given alias message is actually an instance of\n * a class which implements {@link IDataStoreAliasMessage}\n * @param maybeDataStoreAliasMessage - message object to be validated\n * @returns True if the {@link IDataStoreAliasMessage} is fully implemented, false otherwise\n */\nexport const isDataStoreAliasMessage = (\n\tmaybeDataStoreAliasMessage: unknown,\n): maybeDataStoreAliasMessage is IDataStoreAliasMessage => {\n\treturn (\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.internalId ===\n\t\t\t\"string\" &&\n\t\ttypeof (maybeDataStoreAliasMessage as Partial<IDataStoreAliasMessage>)?.alias === \"string\"\n\t);\n};\n\nexport const channelToDataStore = (\n\tfluidDataStoreChannel: IFluidDataStoreChannel,\n\tinternalId: string,\n\tchannelCollection: ChannelCollection,\n\tlogger: ITelemetryLoggerExt,\n): IDataStore => new DataStore(fluidDataStoreChannel, internalId, channelCollection, logger);\n\nenum AliasState {\n\tAliased = \"Aliased\",\n\tAliasing = \"Aliasing\",\n\tNone = \"None\",\n}\n\nclass DataStore implements IDataStore {\n\tprivate aliasState: AliasState = AliasState.None;\n\tprivate alias: string | undefined;\n\tprivate readonly pendingAliases: Map<string, Promise<AliasResult>>;\n\tprivate aliasResult: Promise<AliasResult> | undefined;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.trySetAlias}\n\t */\n\tasync trySetAlias(alias: string): Promise<AliasResult> {\n\t\tif (alias.includes(\"/\")) {\n\t\t\tthrow new UsageError(`The alias cannot contain slashes: '${alias}'`);\n\t\t}\n\t\tif (this.parentContext.containerRuntime.inStagingMode === true) {\n\t\t\tthrow new UsageError(\"Cannot set aliases while in staging mode\");\n\t\t}\n\n\t\tswitch (this.aliasState) {\n\t\t\t// If we're already aliasing, check if it's for the same value and return\n\t\t\t// the stored promise, otherwise return 'AlreadyAliased'\n\t\t\tcase AliasState.Aliasing: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.aliasResult !== undefined,\n\t\t\t\t\t0x316 /* There should be a cached promise of in-progress aliasing */,\n\t\t\t\t);\n\t\t\t\tawait this.aliasResult;\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\t// If this datastore is already aliased, return true only if this\n\t\t\t// is a repeated call for the same alias\n\t\t\tcase AliasState.Aliased: {\n\t\t\t\treturn this.alias === alias ? \"Success\" : \"AlreadyAliased\";\n\t\t\t}\n\n\t\t\tcase AliasState.None: {\n\t\t\t\tconst existingAlias = this.pendingAliases.get(alias);\n\t\t\t\tif (existingAlias !== undefined) {\n\t\t\t\t\t// There is already another datastore which will be aliased\n\t\t\t\t\t// to the same name\n\t\t\t\t\treturn \"Conflict\";\n\t\t\t\t}\n\n\t\t\t\t// There is no current or past alias operation for this datastore,\n\t\t\t\t// or for this alias, so it is safe to continue execution\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(this.aliasState);\n\t\t\t}\n\t\t}\n\n\t\tthis.aliasState = AliasState.Aliasing;\n\t\tthis.aliasResult = this.trySetAliasInternal(alias);\n\t\tthis.pendingAliases.set(alias, this.aliasResult);\n\t\treturn this.aliasResult;\n\t}\n\n\tasync trySetAliasInternal(alias: string): Promise<AliasResult> {\n\t\tconst message: IDataStoreAliasMessage = {\n\t\t\tinternalId: this.internalId,\n\t\t\talias,\n\t\t};\n\t\tthis.fluidDataStoreChannel.makeVisibleAndAttachGraph();\n\n\t\tif (this.parentContext.attachState === AttachState.Detached) {\n\t\t\tconst localResult = this.channelCollection.processAliasMessageCore(\n\t\t\t\tthis.internalId,\n\t\t\t\talias,\n\t\t\t);\n\t\t\t// Explicitly lock-out future attempts of aliasing,\n\t\t\t// regardless of result\n\t\t\tthis.aliasState = AliasState.Aliased;\n\t\t\treturn localResult ? \"Success\" : \"Conflict\";\n\t\t}\n\n\t\tconst aliased = await this.ackBasedPromise<boolean>((resolve) => {\n\t\t\tthis.parentContext.submitMessage(\n\t\t\t\t{ type: ContainerMessageType.Alias, contents: message },\n\t\t\t\tresolve,\n\t\t\t);\n\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"AliasingException\",\n\t\t\t\t\t\talias: {\n\t\t\t\t\t\t\tvalue: alias,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinternalId: {\n\t\t\t\t\t\t\tvalue: this.internalId,\n\t\t\t\t\t\t\ttag: TelemetryDataTag.CodeArtifact,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn false;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.pendingAliases.delete(alias);\n\t\t\t});\n\n\t\tif (!aliased) {\n\t\t\tthis.aliasState = AliasState.None;\n\t\t\tthis.aliasResult = undefined;\n\t\t\treturn \"Conflict\";\n\t\t}\n\n\t\tthis.alias = alias;\n\t\tthis.aliasState = AliasState.Aliased;\n\t\treturn \"Success\";\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IDataStore.entryPoint}\n\t */\n\tget entryPoint(): IFluidHandleInternal<FluidObject> {\n\t\treturn this.fluidDataStoreChannel.entryPoint;\n\t}\n\n\tconstructor(\n\t\tprivate readonly fluidDataStoreChannel: IFluidDataStoreChannel,\n\t\tprivate readonly internalId: string,\n\t\tprivate readonly channelCollection: ChannelCollection,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly parentContext = channelCollection.parentContext,\n\t) {\n\t\tthis.pendingAliases = channelCollection.pendingAliases;\n\t}\n\n\tprivate async ackBasedPromise<T>(\n\t\texecutor: (\n\t\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\t\treject: (reason?: unknown) => void,\n\t\t) => void,\n\t): Promise<T> {\n\t\tlet rejectBecauseDispose: () => void;\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\trejectBecauseDispose = () =>\n\t\t\t\treject(\n\t\t\t\t\tnew Error(\"ContainerRuntime disposed while this ack-based Promise was pending\"),\n\t\t\t\t);\n\n\t\t\tif (this.parentContext.containerRuntime.disposed) {\n\t\t\t\trejectBecauseDispose();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.parentContext.containerRuntime.on(\"dispose\", rejectBecauseDispose);\n\t\t\texecutor(resolve, reject);\n\t\t}).finally(() => {\n\t\t\tthis.parentContext.containerRuntime.off(\"dispose\", rejectBecauseDispose);\n\t\t});\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/container-runtime";
8
- export declare const pkgVersion = "2.93.0";
8
+ export declare const pkgVersion = "2.100.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,WAAW,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,YAAY,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/container-runtime";
8
- export const pkgVersion = "2.93.0";
8
+ export const pkgVersion = "2.100.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.93.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-runtime\";\nexport const pkgVersion = \"2.100.0\";\n"]}
@@ -17,7 +17,7 @@ export declare const runtimeCoreCompatDetails: {
17
17
  /**
18
18
  * The package version of the Runtime layer.
19
19
  */
20
- readonly pkgVersion: "2.93.0";
20
+ readonly pkgVersion: "2.100.0";
21
21
  /**
22
22
  * The current generation of the Runtime layer.
23
23
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-runtime",
3
- "version": "2.93.0",
3
+ "version": "2.100.0",
4
4
  "description": "Fluid container runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -119,18 +119,18 @@
119
119
  "temp-directory": "nyc/.nyc_output"
120
120
  },
121
121
  "dependencies": {
122
- "@fluid-internal/client-utils": "~2.93.0",
123
- "@fluidframework/container-definitions": "~2.93.0",
124
- "@fluidframework/container-runtime-definitions": "~2.93.0",
125
- "@fluidframework/core-interfaces": "~2.93.0",
126
- "@fluidframework/core-utils": "~2.93.0",
127
- "@fluidframework/datastore": "~2.93.0",
128
- "@fluidframework/driver-definitions": "~2.93.0",
129
- "@fluidframework/driver-utils": "~2.93.0",
130
- "@fluidframework/id-compressor": "~2.93.0",
131
- "@fluidframework/runtime-definitions": "~2.93.0",
132
- "@fluidframework/runtime-utils": "~2.93.0",
133
- "@fluidframework/telemetry-utils": "~2.93.0",
122
+ "@fluid-internal/client-utils": "~2.100.0",
123
+ "@fluidframework/container-definitions": "~2.100.0",
124
+ "@fluidframework/container-runtime-definitions": "~2.100.0",
125
+ "@fluidframework/core-interfaces": "~2.100.0",
126
+ "@fluidframework/core-utils": "~2.100.0",
127
+ "@fluidframework/datastore": "~2.100.0",
128
+ "@fluidframework/driver-definitions": "~2.100.0",
129
+ "@fluidframework/driver-utils": "~2.100.0",
130
+ "@fluidframework/id-compressor": "~2.100.0",
131
+ "@fluidframework/runtime-definitions": "~2.100.0",
132
+ "@fluidframework/runtime-utils": "~2.100.0",
133
+ "@fluidframework/telemetry-utils": "~2.100.0",
134
134
  "@tylerbu/sorted-btree-es6": "^2.1.1",
135
135
  "double-ended-queue": "^2.1.0-0",
136
136
  "lz4js": "^0.2.0",
@@ -140,16 +140,16 @@
140
140
  "devDependencies": {
141
141
  "@arethetypeswrong/cli": "^0.18.2",
142
142
  "@biomejs/biome": "~2.4.5",
143
- "@fluid-internal/mocha-test-setup": "~2.93.0",
144
- "@fluid-private/stochastic-test-utils": "~2.93.0",
145
- "@fluid-private/test-pairwise-generator": "~2.93.0",
146
- "@fluid-tools/benchmark": "^0.55.0",
147
- "@fluid-tools/build-cli": "^0.64.0",
143
+ "@fluid-internal/mocha-test-setup": "~2.100.0",
144
+ "@fluid-private/stochastic-test-utils": "~2.100.0",
145
+ "@fluid-private/test-pairwise-generator": "~2.100.0",
146
+ "@fluid-tools/benchmark": "^0.58.0",
147
+ "@fluid-tools/build-cli": "^0.65.0",
148
148
  "@fluidframework/build-common": "^2.0.3",
149
- "@fluidframework/build-tools": "^0.64.0",
149
+ "@fluidframework/build-tools": "^0.65.0",
150
150
  "@fluidframework/container-runtime-previous": "npm:@fluidframework/container-runtime@2.92.0",
151
151
  "@fluidframework/eslint-config-fluid": "^9.0.0",
152
- "@fluidframework/test-runtime-utils": "~2.93.0",
152
+ "@fluidframework/test-runtime-utils": "~2.100.0",
153
153
  "@microsoft/api-extractor": "7.58.1",
154
154
  "@types/double-ended-queue": "^2.1.0",
155
155
  "@types/lz4js": "^0.2.0",
@@ -95,7 +95,6 @@ import { FetchSource, MessageType } from "@fluidframework/driver-definitions/int
95
95
  import { readAndParse } from "@fluidframework/driver-utils/internal";
96
96
  import type { IIdCompressor } from "@fluidframework/id-compressor";
97
97
  import type {
98
- // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API
99
98
  IIdCompressorCore,
100
99
  IdCreationRange,
101
100
  SerializedIdCompressorWithNoSession,
@@ -105,6 +104,7 @@ import {
105
104
  createIdCompressor,
106
105
  createSessionId,
107
106
  deserializeIdCompressor,
107
+ toIdCompressorWithCore,
108
108
  } from "@fluidframework/id-compressor/internal";
109
109
  import {
110
110
  FlushMode,
@@ -131,7 +131,6 @@ import type {
131
131
  IContainerRuntimeBaseInternal,
132
132
  MinimumVersionForCollab,
133
133
  ContainerExtensionExpectations,
134
- ContainerRuntimeBaseAlpha,
135
134
  } from "@fluidframework/runtime-definitions/internal";
136
135
  import {
137
136
  addBlobToSummary,
@@ -173,6 +172,7 @@ import {
173
172
  wrapError,
174
173
  tagCodeArtifacts,
175
174
  normalizeError,
175
+ toITelemetryLoggerExt,
176
176
  } from "@fluidframework/telemetry-utils/internal";
177
177
  import { gt } from "semver-ts";
178
178
  import { v4 as uuid } from "uuid";
@@ -675,18 +675,11 @@ export function getDeviceSpec(): {
675
675
  deviceMemory?: number | undefined;
676
676
  hardwareConcurrency?: number | undefined;
677
677
  } {
678
- try {
679
- if (typeof navigator === "object" && navigator !== null) {
680
- return {
681
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
682
- deviceMemory: (navigator as any).deviceMemory,
683
- hardwareConcurrency: navigator.hardwareConcurrency,
684
- };
685
- }
686
- } catch {
687
- // Eat the error
688
- }
689
- return {};
678
+ return {
679
+ // deviceMemory is only available in browsers and is not part of the Navigator type definition. In Node 22 it is undefined.
680
+ deviceMemory: (navigator as Navigator & { deviceMemory?: number }).deviceMemory,
681
+ hardwareConcurrency: navigator.hardwareConcurrency,
682
+ };
690
683
  }
691
684
 
692
685
  /**
@@ -846,7 +839,7 @@ export async function loadContainerRuntime(
846
839
  * @legacy @alpha
847
840
  */
848
841
  export async function loadContainerRuntimeAlpha(params: LoadContainerRuntimeParams): Promise<{
849
- runtime: IContainerRuntime & ContainerRuntimeBaseAlpha & IRuntime;
842
+ runtime: IContainerRuntime & IRuntime;
850
843
  }> {
851
844
  return ContainerRuntime.loadRuntime2({
852
845
  ...params,
@@ -1185,7 +1178,6 @@ export class ContainerRuntime
1185
1178
  idCompressorMode = desiredIdCompressorMode;
1186
1179
  }
1187
1180
 
1188
- // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API
1189
1181
  const createIdCompressorFn = (): IIdCompressor & IIdCompressorCore => {
1190
1182
  /**
1191
1183
  * Because the IdCompressor emits so much telemetry, this function is used to sample
@@ -1204,17 +1196,21 @@ export class ContainerRuntime
1204
1196
  const pendingLocalState = context.pendingLocalState as IPendingRuntimeState;
1205
1197
 
1206
1198
  if (pendingLocalState?.pendingIdCompressorState !== undefined) {
1207
- return deserializeIdCompressor(
1208
- pendingLocalState.pendingIdCompressorState,
1209
- compressorLogger,
1199
+ return toIdCompressorWithCore(
1200
+ deserializeIdCompressor(
1201
+ pendingLocalState.pendingIdCompressorState,
1202
+ toITelemetryLoggerExt(compressorLogger),
1203
+ ),
1210
1204
  );
1211
1205
  } else if (serializedIdCompressor === undefined) {
1212
- return createIdCompressor(compressorLogger);
1206
+ return toIdCompressorWithCore(createIdCompressor(compressorLogger));
1213
1207
  } else {
1214
- return deserializeIdCompressor(
1215
- serializedIdCompressor,
1216
- createSessionId(),
1217
- compressorLogger,
1208
+ return toIdCompressorWithCore(
1209
+ deserializeIdCompressor(
1210
+ serializedIdCompressor,
1211
+ createSessionId(),
1212
+ toITelemetryLoggerExt(compressorLogger),
1213
+ ),
1218
1214
  );
1219
1215
  }
1220
1216
  };
@@ -1378,7 +1374,6 @@ export class ContainerRuntime
1378
1374
  return this.documentsSchemaController.sessionSchema.runtime;
1379
1375
  }
1380
1376
 
1381
- // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API
1382
1377
  private _idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;
1383
1378
 
1384
1379
  // We accumulate Id compressor Ops while Id compressor is not loaded yet (only for "delayed" mode)
@@ -1394,7 +1389,6 @@ export class ContainerRuntime
1394
1389
  /**
1395
1390
  * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.idCompressor}
1396
1391
  */
1397
- // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API
1398
1392
  public get idCompressor(): (IIdCompressor & IIdCompressorCore) | undefined {
1399
1393
  // Expose ID Compressor only if it's On from the start.
1400
1394
  // If container uses delayed mode, then we can only expose generateDocumentUniqueId() and nothing else.
@@ -1615,7 +1609,6 @@ export class ContainerRuntime
1615
1609
 
1616
1610
  blobManagerLoadInfo: IBlobManagerLoadInfo,
1617
1611
  private readonly _storage: IContainerStorageService,
1618
- // eslint-disable-next-line import-x/no-deprecated -- Will be undeprecated in 2.100.0 when it becomes an internal API
1619
1612
  private readonly createIdCompressorFn: () => IIdCompressor & IIdCompressorCore,
1620
1613
 
1621
1614
  private readonly documentsSchemaController: DocumentsSchemaController,
@@ -3598,7 +3591,18 @@ export class ContainerRuntime
3598
3591
  let stageControls: StageControlsInternal | undefined;
3599
3592
  if (this.mc.config.getBoolean("Fluid.ContainerRuntime.EnableRollback") === true) {
3600
3593
  if (!this.batchRunner.running && !this.inStagingMode) {
3601
- stageControls = this.enterStagingMode();
3594
+ // Use silent=true to suppress stagingModeChanged events for orderSequentially.
3595
+ // orderSequentially uses staging mode as a rollback mechanism.
3596
+ // Emitting stagingModeChanged here would:
3597
+ // - Cause UI flicker — consumers rendering staging mode event would see
3598
+ // unexpected enter/exit flashes on every orderSequentially call.
3599
+ // - consumers cannot distinguish this internal usage
3600
+ // from a user explicitly entering staging mode, as there is no source field
3601
+ // on the event to filter by.
3602
+ // - if orderSequentially is
3603
+ // later reimplemented without staging mode, consumers calibrated
3604
+ // to these events would break silently.
3605
+ stageControls = this.enterStagingModeCore(true);
3602
3606
  }
3603
3607
  // Note: we are not touching any batches other than mainBatch here, for two reasons:
3604
3608
  // 1. It would not help, as other batches are flushed independently from main batch.
@@ -3674,9 +3678,22 @@ export class ContainerRuntime
3674
3678
  * Enter Staging Mode, such that ops submitted to the ContainerRuntime will not be sent to the ordering service.
3675
3679
  * To exit Staging Mode, call either discardChanges or commitChanges on the Stage Controls returned from this method.
3676
3680
  *
3681
+ * @remarks
3682
+ * The `stagingModeChanged` event is emitted when staging mode is entered or exited via this method.
3683
+ * It is NOT emitted when staging mode is used internally (e.g. by `orderSequentially` for rollback support).
3684
+ *
3677
3685
  * @returns Controls for exiting Staging Mode.
3678
3686
  */
3679
- public enterStagingMode = (): StageControlsInternal => {
3687
+ public enterStagingMode = (): StageControlsInternal => this.enterStagingModeCore(false);
3688
+
3689
+ /**
3690
+ * Internal implementation of enterStagingMode.
3691
+ * @param silent - When true, suppresses `stagingModeChanged` event emission.
3692
+ * Pass `true` when staging mode is used as an internal implementation detail (e.g. by
3693
+ * `orderSequentially` for rollback support) so that external listeners only observe
3694
+ * user-initiated staging mode transitions. Pass `false` for all public entry points.
3695
+ */
3696
+ private readonly enterStagingModeCore = (silent: boolean): StageControlsInternal => {
3680
3697
  if (this.stageControls !== undefined) {
3681
3698
  throw new UsageError("Already in staging mode");
3682
3699
  }
@@ -3688,10 +3705,15 @@ export class ContainerRuntime
3688
3705
  // since we mark whole batches as "staged" or not to indicate whether to submit them.
3689
3706
  this.flush();
3690
3707
 
3708
+ // Note: `silent` is captured from the enclosing `enterStagingModeCore` call.
3709
+ // When `true`, both enter and exit events are suppressed (see orderSequentially).
3691
3710
  const exitStagingMode = (
3692
3711
  discardOrCommit: () => IPendingMessage["batchInfo"][],
3693
3712
  exitMethod: "commit" | "discard",
3694
3713
  ): void => {
3714
+ if (this.stageControls !== stageControls) {
3715
+ throw new UsageError("Not in staging mode");
3716
+ }
3695
3717
  try {
3696
3718
  PerformanceEvent.timedExec(
3697
3719
  this.mc.logger,
@@ -3723,6 +3745,12 @@ export class ContainerRuntime
3723
3745
  this.closeFn(normalizedError);
3724
3746
  throw normalizedError;
3725
3747
  }
3748
+ if (!silent) {
3749
+ this.emit("stagingModeChanged", {
3750
+ inStagingMode: false,
3751
+ commit: exitMethod === "commit",
3752
+ });
3753
+ }
3726
3754
  };
3727
3755
 
3728
3756
  const stageControls: StageControlsInternal = {
@@ -3752,8 +3780,16 @@ export class ContainerRuntime
3752
3780
 
3753
3781
  this.stageControls = stageControls;
3754
3782
  this.channelCollection.notifyStagingMode(true);
3783
+ if (!silent) {
3784
+ try {
3785
+ this.emit("stagingModeChanged", { inStagingMode: true });
3786
+ } catch (error) {
3787
+ // Don't let a listener error prevent the caller from receiving stage controls.
3788
+ this.mc.logger.sendErrorEvent({ eventName: "StagingModeChangedError" }, error);
3789
+ }
3790
+ }
3755
3791
 
3756
- return this.stageControls;
3792
+ return stageControls;
3757
3793
  };
3758
3794
 
3759
3795
  /**
package/src/dataStore.ts CHANGED
@@ -7,11 +7,10 @@ import { AttachState } from "@fluidframework/container-definitions";
7
7
  import type { FluidObject } from "@fluidframework/core-interfaces";
8
8
  import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
9
9
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
10
- import {
11
- type AliasResult,
12
- type IDataStore,
13
- type IFluidDataStoreChannel,
14
- asLegacyAlpha,
10
+ import type {
11
+ AliasResult,
12
+ IDataStore,
13
+ IFluidDataStoreChannel,
15
14
  } from "@fluidframework/runtime-definitions/internal";
16
15
  import {
17
16
  type ITelemetryLoggerExt,
@@ -81,7 +80,7 @@ class DataStore implements IDataStore {
81
80
  if (alias.includes("/")) {
82
81
  throw new UsageError(`The alias cannot contain slashes: '${alias}'`);
83
82
  }
84
- if (asLegacyAlpha(this.parentContext.containerRuntime).inStagingMode === true) {
83
+ if (this.parentContext.containerRuntime.inStagingMode === true) {
85
84
  throw new UsageError("Cannot set aliases while in staging mode");
86
85
  }
87
86
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.93.0";
9
+ export const pkgVersion = "2.100.0";