@fluid-experimental/attributor 2.11.0 → 2.12.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 +4 -0
- package/dist/mixinAttributor.d.ts.map +1 -1
- package/dist/mixinAttributor.js +7 -2
- package/dist/mixinAttributor.js.map +1 -1
- package/lib/mixinAttributor.d.ts.map +1 -1
- package/lib/mixinAttributor.js +7 -2
- package/lib/mixinAttributor.js.map +1 -1
- package/package.json +19 -19
- package/src/mixinAttributor.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAS9E,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAGlC;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAMzC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UAErB,uBAAuB,KAE3B,uBA0EqC,CAAC"}
|
package/dist/mixinAttributor.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.mixinAttributor = exports.getRuntimeAttributor = void 0;
|
|
8
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
8
9
|
const internal_1 = require("@fluidframework/container-runtime/internal");
|
|
9
10
|
const internal_2 = require("@fluidframework/core-utils/internal");
|
|
10
11
|
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
@@ -30,9 +31,13 @@ exports.getRuntimeAttributor = getRuntimeAttributor;
|
|
|
30
31
|
* @param Base - base class, inherits from FluidAttributorRuntime
|
|
31
32
|
* @internal
|
|
32
33
|
*/
|
|
33
|
-
const mixinAttributor = (
|
|
34
|
+
const mixinAttributor = (
|
|
35
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
36
|
+
Base = internal_1.ContainerRuntime) => class ContainerRuntimeWithAttributor extends Base {
|
|
34
37
|
static async loadRuntime(params) {
|
|
35
|
-
const { context, registryEntries, existing, requestHandler, provideEntryPoint, runtimeOptions, containerScope,
|
|
38
|
+
const { context, registryEntries, existing, requestHandler, provideEntryPoint, runtimeOptions, containerScope,
|
|
39
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
40
|
+
containerRuntimeCtor = ContainerRuntimeWithAttributor, } = params;
|
|
36
41
|
const mc = (0, internal_3.loggerToMonitoringContext)(context.taggedLogger);
|
|
37
42
|
const factory = new runtimeAttributorDataStoreFactory_js_1.RuntimeAttributorFactory();
|
|
38
43
|
const registryEntriesCopy = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAA8E;AAQ9E,kEAA6D;AAK7D,uEAAqF;AAErF,qEAKkC;AAClC,iGAAkF;AAElF;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CACzC,OAA8B;IAE9B,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,6BAA6B,CAAC,iDAAwB,CAAC,CAAC;IACzF,MAAM,iBAAiB,GAAG,CAAC,MAAM,UAAU,EAAE,GAAG,EAAE,CAEtC,CAAC;IACb,OAAO,iBAAiB,EAAE,kBAAkB,CAA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jF,IAAI,sBAAsB,EAAE,CAAC;YAC5B,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;YAC5B,sEAAsE;YACtE,CAAC,OAAO,CAAC,WAAW,KAAnB,OAAO,CAAC,WAAW,GAAK,EAAE,EAAC,CAAC,KAAK,GAAG,IAAI,CAAC;QAC3C,CAAC;QAED,iEAAiE;QACjE,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC;YACvC,OAAO;YACP,eAAe,EAAE,mBAAmB;YACpC,cAAc;YACd,iBAAiB;YACjB,cAAc;YACd,cAAc;YACd,QAAQ;YACR,oBAAoB;YACpB,8DAA8D;SACvD,CAAC,CAAmC,CAAC;QAE7C,IAAI,iBAAiD,CAAC;QACtD,IAAI,sBAAsB,EAAE,CAAC;YAC5B,IAAI,QAAQ,EAAE,CAAC;gBACd,iBAAiB,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACP,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,+DAAwB,CAAC,IAAI,CAAC,CAAC;gBAC/E,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,iDAAwB,CAAC,CAAC;gBACrE,IAAA,iBAAM,EACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,mDAAmD,CACzD,CAAC;gBACF,iBAAiB,GAAG,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAuB,CAAC;gBAC7E,IAAA,iBAAM,EAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACnF,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CAEqC,CAAC;AA9E5B,QAAA,eAAe,mBA8Ea","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IContainerContext } from \"@fluidframework/container-definitions/internal\";\n// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\nimport { ContainerRuntime } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntimeOptions } from \"@fluidframework/container-runtime/internal\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport {\n\ttype FluidObject,\n\ttype IRequest,\n\ttype IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IContainerRuntimeBase,\n\ttype NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tattributorDataStoreAlias,\n\tenableOnNewFileKey,\n\ttype IProvideRuntimeAttributor,\n\ttype IRuntimeAttributor,\n} from \"./attributorContracts.js\";\nimport { RuntimeAttributorFactory } from \"./runtimeAttributorDataStoreFactory.js\";\n\n/**\n * Utility function to get the runtime attributor from the container runtime.\n * @param runtime - container runtime from which attributor is to be fetched.\n * @returns IRuntimeAttributor if it exists, otherwise undefined.\n * @internal\n */\nexport async function getRuntimeAttributor(\n\truntime: IContainerRuntimeBase,\n): Promise<IRuntimeAttributor | undefined> {\n\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(attributorDataStoreAlias);\n\tconst runtimeAttributor = (await entryPoint?.get()) as\n\t\t| FluidObject<IProvideRuntimeAttributor>\n\t\t| undefined;\n\treturn runtimeAttributor?.IRuntimeAttributor;\n}\n\n/**\n * Mixes in logic to load and store runtime-based attribution functionality.\n *\n * Existing documents without stored attributor will not start storing attribution information. We only create the attributor\n * if its tracking is enabled and we are creating a new document.\n * @param Base - base class, inherits from FluidAttributorRuntime\n * @internal\n */\nexport const mixinAttributor = (\n\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\tBase: typeof ContainerRuntime = ContainerRuntime,\n\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n): typeof ContainerRuntime =>\n\tclass ContainerRuntimeWithAttributor extends Base {\n\t\tpublic static async loadRuntime(params: {\n\t\t\tcontext: IContainerContext;\n\t\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\t\texisting: boolean;\n\t\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\t\tcontainerScope?: FluidObject;\n\t\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t\t/**\n\t\t\t * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t\t\t */\n\t\t\trequestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;\n\t\t\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;\n\t\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\t}): Promise<ContainerRuntime> {\n\t\t\tconst {\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries,\n\t\t\t\texisting,\n\t\t\t\trequestHandler,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\t\t\tcontainerRuntimeCtor = ContainerRuntimeWithAttributor as unknown as typeof ContainerRuntime,\n\t\t\t} = params;\n\n\t\t\tconst mc = loggerToMonitoringContext(context.taggedLogger);\n\t\t\tconst factory = new RuntimeAttributorFactory();\n\t\t\tconst registryEntriesCopy: NamedFluidDataStoreRegistryEntries = [\n\t\t\t\t...registryEntries,\n\t\t\t\t[RuntimeAttributorFactory.type, Promise.resolve(factory)],\n\t\t\t];\n\t\t\tconst shouldTrackAttribution = mc.config.getBoolean(enableOnNewFileKey) ?? false;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tconst { options } = context;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t(options.attribution ??= {}).track = true;\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tconst runtime = (await Base.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries: registryEntriesCopy,\n\t\t\t\trequestHandler,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\texisting,\n\t\t\t\tcontainerRuntimeCtor,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t} as any)) as ContainerRuntimeWithAttributor;\n\n\t\t\tlet runtimeAttributor: IRuntimeAttributor | undefined;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tif (existing) {\n\t\t\t\t\truntimeAttributor = await getRuntimeAttributor(runtime);\n\t\t\t\t} else {\n\t\t\t\t\tconst datastore = await runtime.createDataStore(RuntimeAttributorFactory.type);\n\t\t\t\t\tconst result = await datastore.trySetAlias(attributorDataStoreAlias);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tresult === \"Success\",\n\t\t\t\t\t\t0xa1b /* Failed to set alias for attributor data store */,\n\t\t\t\t\t);\n\t\t\t\t\truntimeAttributor = (await datastore.entryPoint.get()) as IRuntimeAttributor;\n\t\t\t\t\tassert(runtimeAttributor !== undefined, 0xa1c /* Attributor should be defined */);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn runtime;\n\t\t}\n\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t} as unknown as typeof ContainerRuntime;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAS9E,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,0BAA0B,CAAC;AAGlC;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,qBAAqB,GAC5B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAMzC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UAErB,uBAAuB,KAE3B,uBA0EqC,CAAC"}
|
package/lib/mixinAttributor.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
5
6
|
import { ContainerRuntime } from "@fluidframework/container-runtime/internal";
|
|
6
7
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
8
|
import { loggerToMonitoringContext } from "@fluidframework/telemetry-utils/internal";
|
|
@@ -26,9 +27,13 @@ export async function getRuntimeAttributor(runtime) {
|
|
|
26
27
|
* @param Base - base class, inherits from FluidAttributorRuntime
|
|
27
28
|
* @internal
|
|
28
29
|
*/
|
|
29
|
-
export const mixinAttributor = (
|
|
30
|
+
export const mixinAttributor = (
|
|
31
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
32
|
+
Base = ContainerRuntime) => class ContainerRuntimeWithAttributor extends Base {
|
|
30
33
|
static async loadRuntime(params) {
|
|
31
|
-
const { context, registryEntries, existing, requestHandler, provideEntryPoint, runtimeOptions, containerScope,
|
|
34
|
+
const { context, registryEntries, existing, requestHandler, provideEntryPoint, runtimeOptions, containerScope,
|
|
35
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
36
|
+
containerRuntimeCtor = ContainerRuntimeWithAttributor, } = params;
|
|
32
37
|
const mc = loggerToMonitoringContext(context.taggedLogger);
|
|
33
38
|
const factory = new RuntimeAttributorFactory();
|
|
34
39
|
const registryEntriesCopy = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAQ9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,EACN,wBAAwB,EACxB,kBAAkB,GAGlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACzC,OAA8B;IAE9B,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,6BAA6B,CAAC,wBAAwB,CAAC,CAAC;IACzF,MAAM,iBAAiB,GAAG,CAAC,MAAM,UAAU,EAAE,GAAG,EAAE,CAEtC,CAAC;IACb,OAAO,iBAAiB,EAAE,kBAAkB,CAAC;AAC9C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,
|
|
1
|
+
{"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,wGAAwG;AACxG,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAQ9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,EACN,wBAAwB,EACxB,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AC,CAAC,KAAK,GAAG,IAAI,CAAC;QAC3C,CAAC;QAED,iEAAiE;QACjE,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC;YACvC,OAAO;YACP,eAAe,EAAE,mBAAmB;YACpC,cAAc;YACd,iBAAiB;YACjB,cAAc;YACd,cAAc;YACd,QAAQ;YACR,oBAAoB;YACpB,8DAA8D;SACvD,CAAC,CAAmC,CAAC;QAE7C,IAAI,iBAAiD,CAAC;QACtD,IAAI,sBAAsB,EAAE,CAAC;YAC5B,IAAI,QAAQ,EAAE,CAAC;gBACd,iBAAiB,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACP,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;gBAC/E,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;gBACrE,MAAM,CACL,MAAM,KAAK,SAAS,EACpB,KAAK,CAAC,mDAAmD,CACzD,CAAC;gBACF,iBAAiB,GAAG,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAuB,CAAC;gBAC7E,MAAM,CAAC,iBAAiB,KAAK,SAAS,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACnF,CAAC;QACF,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CAEqC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type IContainerContext } from \"@fluidframework/container-definitions/internal\";\n// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\nimport { ContainerRuntime } from \"@fluidframework/container-runtime/internal\";\nimport type { IContainerRuntimeOptions } from \"@fluidframework/container-runtime/internal\";\nimport { type IContainerRuntime } from \"@fluidframework/container-runtime-definitions/internal\";\nimport {\n\ttype FluidObject,\n\ttype IRequest,\n\ttype IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype IContainerRuntimeBase,\n\ttype NamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tattributorDataStoreAlias,\n\tenableOnNewFileKey,\n\ttype IProvideRuntimeAttributor,\n\ttype IRuntimeAttributor,\n} from \"./attributorContracts.js\";\nimport { RuntimeAttributorFactory } from \"./runtimeAttributorDataStoreFactory.js\";\n\n/**\n * Utility function to get the runtime attributor from the container runtime.\n * @param runtime - container runtime from which attributor is to be fetched.\n * @returns IRuntimeAttributor if it exists, otherwise undefined.\n * @internal\n */\nexport async function getRuntimeAttributor(\n\truntime: IContainerRuntimeBase,\n): Promise<IRuntimeAttributor | undefined> {\n\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(attributorDataStoreAlias);\n\tconst runtimeAttributor = (await entryPoint?.get()) as\n\t\t| FluidObject<IProvideRuntimeAttributor>\n\t\t| undefined;\n\treturn runtimeAttributor?.IRuntimeAttributor;\n}\n\n/**\n * Mixes in logic to load and store runtime-based attribution functionality.\n *\n * Existing documents without stored attributor will not start storing attribution information. We only create the attributor\n * if its tracking is enabled and we are creating a new document.\n * @param Base - base class, inherits from FluidAttributorRuntime\n * @internal\n */\nexport const mixinAttributor = (\n\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\tBase: typeof ContainerRuntime = ContainerRuntime,\n\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n): typeof ContainerRuntime =>\n\tclass ContainerRuntimeWithAttributor extends Base {\n\t\tpublic static async loadRuntime(params: {\n\t\t\tcontext: IContainerContext;\n\t\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\t\texisting: boolean;\n\t\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\t\tcontainerScope?: FluidObject;\n\t\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t\t/**\n\t\t\t * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t\t\t */\n\t\t\trequestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;\n\t\t\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;\n\t\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\t}): Promise<ContainerRuntime> {\n\t\t\tconst {\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries,\n\t\t\t\texisting,\n\t\t\t\trequestHandler,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\t\t\tcontainerRuntimeCtor = ContainerRuntimeWithAttributor as unknown as typeof ContainerRuntime,\n\t\t\t} = params;\n\n\t\t\tconst mc = loggerToMonitoringContext(context.taggedLogger);\n\t\t\tconst factory = new RuntimeAttributorFactory();\n\t\t\tconst registryEntriesCopy: NamedFluidDataStoreRegistryEntries = [\n\t\t\t\t...registryEntries,\n\t\t\t\t[RuntimeAttributorFactory.type, Promise.resolve(factory)],\n\t\t\t];\n\t\t\tconst shouldTrackAttribution = mc.config.getBoolean(enableOnNewFileKey) ?? false;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tconst { options } = context;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t(options.attribution ??= {}).track = true;\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tconst runtime = (await Base.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries: registryEntriesCopy,\n\t\t\t\trequestHandler,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\n\t\t\t\texisting,\n\t\t\t\tcontainerRuntimeCtor,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t} as any)) as ContainerRuntimeWithAttributor;\n\n\t\t\tlet runtimeAttributor: IRuntimeAttributor | undefined;\n\t\t\tif (shouldTrackAttribution) {\n\t\t\t\tif (existing) {\n\t\t\t\t\truntimeAttributor = await getRuntimeAttributor(runtime);\n\t\t\t\t} else {\n\t\t\t\t\tconst datastore = await runtime.createDataStore(RuntimeAttributorFactory.type);\n\t\t\t\t\tconst result = await datastore.trySetAlias(attributorDataStoreAlias);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tresult === \"Success\",\n\t\t\t\t\t\t0xa1b /* Failed to set alias for attributor data store */,\n\t\t\t\t\t);\n\t\t\t\t\truntimeAttributor = (await datastore.entryPoint.get()) as IRuntimeAttributor;\n\t\t\t\t\tassert(runtimeAttributor !== undefined, 0xa1c /* Attributor should be defined */);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn runtime;\n\t\t}\n\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t} as unknown as typeof ContainerRuntime;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/attributor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Operation attributor",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -49,32 +49,32 @@
|
|
|
49
49
|
"temp-directory": "nyc/.nyc_output"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@fluid-internal/client-utils": "~2.
|
|
53
|
-
"@fluidframework/container-definitions": "~2.
|
|
54
|
-
"@fluidframework/container-runtime": "~2.
|
|
55
|
-
"@fluidframework/container-runtime-definitions": "~2.
|
|
56
|
-
"@fluidframework/core-interfaces": "~2.
|
|
57
|
-
"@fluidframework/core-utils": "~2.
|
|
58
|
-
"@fluidframework/datastore": "~2.
|
|
59
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
60
|
-
"@fluidframework/driver-definitions": "~2.
|
|
61
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
62
|
-
"@fluidframework/runtime-utils": "~2.
|
|
63
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
52
|
+
"@fluid-internal/client-utils": "~2.12.0",
|
|
53
|
+
"@fluidframework/container-definitions": "~2.12.0",
|
|
54
|
+
"@fluidframework/container-runtime": "~2.12.0",
|
|
55
|
+
"@fluidframework/container-runtime-definitions": "~2.12.0",
|
|
56
|
+
"@fluidframework/core-interfaces": "~2.12.0",
|
|
57
|
+
"@fluidframework/core-utils": "~2.12.0",
|
|
58
|
+
"@fluidframework/datastore": "~2.12.0",
|
|
59
|
+
"@fluidframework/datastore-definitions": "~2.12.0",
|
|
60
|
+
"@fluidframework/driver-definitions": "~2.12.0",
|
|
61
|
+
"@fluidframework/runtime-definitions": "~2.12.0",
|
|
62
|
+
"@fluidframework/runtime-utils": "~2.12.0",
|
|
63
|
+
"@fluidframework/telemetry-utils": "~2.12.0",
|
|
64
64
|
"lz4js": "^0.2.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@arethetypeswrong/cli": "^0.
|
|
67
|
+
"@arethetypeswrong/cli": "^0.17.1",
|
|
68
68
|
"@biomejs/biome": "~1.9.3",
|
|
69
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
70
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
69
|
+
"@fluid-internal/mocha-test-setup": "~2.12.0",
|
|
70
|
+
"@fluid-private/stochastic-test-utils": "~2.12.0",
|
|
71
71
|
"@fluid-tools/build-cli": "^0.51.0",
|
|
72
72
|
"@fluidframework/build-common": "^2.0.3",
|
|
73
73
|
"@fluidframework/build-tools": "^0.51.0",
|
|
74
74
|
"@fluidframework/eslint-config-fluid": "^5.6.0",
|
|
75
|
-
"@fluidframework/merge-tree": "~2.
|
|
76
|
-
"@fluidframework/sequence": "~2.
|
|
77
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
75
|
+
"@fluidframework/merge-tree": "~2.12.0",
|
|
76
|
+
"@fluidframework/sequence": "~2.12.0",
|
|
77
|
+
"@fluidframework/test-runtime-utils": "~2.12.0",
|
|
78
78
|
"@microsoft/api-extractor": "7.47.8",
|
|
79
79
|
"@types/mocha": "^9.1.1",
|
|
80
80
|
"@types/node": "^18.19.0",
|
package/src/mixinAttributor.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { type IContainerContext } from "@fluidframework/container-definitions/internal";
|
|
7
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
7
8
|
import { ContainerRuntime } from "@fluidframework/container-runtime/internal";
|
|
8
9
|
import type { IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
9
10
|
import { type IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
@@ -52,7 +53,9 @@ export async function getRuntimeAttributor(
|
|
|
52
53
|
* @internal
|
|
53
54
|
*/
|
|
54
55
|
export const mixinAttributor = (
|
|
56
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
55
57
|
Base: typeof ContainerRuntime = ContainerRuntime,
|
|
58
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
56
59
|
): typeof ContainerRuntime =>
|
|
57
60
|
class ContainerRuntimeWithAttributor extends Base {
|
|
58
61
|
public static async loadRuntime(params: {
|
|
@@ -61,12 +64,14 @@ export const mixinAttributor = (
|
|
|
61
64
|
existing: boolean;
|
|
62
65
|
runtimeOptions?: IContainerRuntimeOptions;
|
|
63
66
|
containerScope?: FluidObject;
|
|
67
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
64
68
|
containerRuntimeCtor?: typeof ContainerRuntime;
|
|
65
69
|
/**
|
|
66
70
|
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
67
71
|
*/
|
|
68
72
|
requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
|
|
69
73
|
provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;
|
|
74
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
70
75
|
}): Promise<ContainerRuntime> {
|
|
71
76
|
const {
|
|
72
77
|
context,
|
|
@@ -76,6 +81,7 @@ export const mixinAttributor = (
|
|
|
76
81
|
provideEntryPoint,
|
|
77
82
|
runtimeOptions,
|
|
78
83
|
containerScope,
|
|
84
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
79
85
|
containerRuntimeCtor = ContainerRuntimeWithAttributor as unknown as typeof ContainerRuntime,
|
|
80
86
|
} = params;
|
|
81
87
|
|
|
@@ -123,4 +129,5 @@ export const mixinAttributor = (
|
|
|
123
129
|
|
|
124
130
|
return runtime;
|
|
125
131
|
}
|
|
132
|
+
// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
|
|
126
133
|
} as unknown as typeof ContainerRuntime;
|