@fluid-experimental/attributor 2.115.0 → 2.116.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/README.md +5 -3
- package/dist/mixinAttributor.d.ts.map +1 -1
- package/dist/mixinAttributor.js +14 -6
- package/dist/mixinAttributor.js.map +1 -1
- package/lib/mixinAttributor.d.ts.map +1 -1
- package/lib/mixinAttributor.js +14 -6
- package/lib/mixinAttributor.js.map +1 -1
- package/package.json +22 -22
- package/src/mixinAttributor.ts +15 -7
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -198,7 +198,7 @@ There are many ways to [contribute](https://github.com/microsoft/FluidFramework/
|
|
|
198
198
|
- Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
|
|
199
199
|
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
|
|
200
200
|
|
|
201
|
-
Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/
|
|
201
|
+
Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Home.md).
|
|
202
202
|
|
|
203
203
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
204
204
|
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
@@ -209,9 +209,11 @@ Use of Microsoft trademarks or logos in modified versions of this project must n
|
|
|
209
209
|
|
|
210
210
|
## Help
|
|
211
211
|
|
|
212
|
-
Not finding what you're looking for in this README?
|
|
212
|
+
Not finding what you're looking for in this README?
|
|
213
|
+
Check out [fluidframework.com](https://fluidframework.com/docs/).
|
|
213
214
|
|
|
214
|
-
Still not finding what you're looking for?
|
|
215
|
+
Still not finding what you're looking for?
|
|
216
|
+
Please [file an issue](https://github.com/microsoft/FluidFramework/blob/main/docs/content/Contributing/Submitting-Bugs-and-Feature-Requests.md).
|
|
215
217
|
|
|
216
218
|
Thank you!
|
|
217
219
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,KAAK,EACX,qBAAqB,EAErB,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,UACrB,uBAAuB,KAC3B,
|
|
1
|
+
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,KAAK,EACX,qBAAqB,EAErB,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,UACrB,uBAAuB,KAC3B,uBAgEqC,CAAC"}
|
package/dist/mixinAttributor.js
CHANGED
|
@@ -32,13 +32,21 @@ exports.getRuntimeAttributor = getRuntimeAttributor;
|
|
|
32
32
|
*/
|
|
33
33
|
const mixinAttributor = (Base = internal_1.ContainerRuntime) => class ContainerRuntimeWithAttributor extends Base {
|
|
34
34
|
static async loadRuntime(params) {
|
|
35
|
-
const { context,
|
|
35
|
+
const { context, registry, existing, provideEntryPoint, runtimeOptions, containerScope, containerRuntimeCtor = ContainerRuntimeWithAttributor, } = params;
|
|
36
36
|
const mc = (0, internal_3.loggerToMonitoringContext)(context.taggedLogger);
|
|
37
37
|
const factory = new runtimeAttributorDataStoreFactory_js_1.RuntimeAttributorFactory();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// Wrap the registry to also include the attributor factory
|
|
39
|
+
const registryWithAttributor = {
|
|
40
|
+
get IFluidDataStoreRegistry() {
|
|
41
|
+
return registryWithAttributor;
|
|
42
|
+
},
|
|
43
|
+
get: async (name) => {
|
|
44
|
+
if (name === runtimeAttributorDataStoreFactory_js_1.RuntimeAttributorFactory.type) {
|
|
45
|
+
return factory;
|
|
46
|
+
}
|
|
47
|
+
return registry.get(name);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
42
50
|
const shouldTrackAttribution = mc.config.getBoolean(attributorContracts_js_1.enableOnNewFileKey) ?? false;
|
|
43
51
|
if (shouldTrackAttribution) {
|
|
44
52
|
const { options } = context;
|
|
@@ -47,7 +55,7 @@ const mixinAttributor = (Base = internal_1.ContainerRuntime) => class ContainerR
|
|
|
47
55
|
}
|
|
48
56
|
const runtime = await Base.loadRuntime({
|
|
49
57
|
context,
|
|
50
|
-
|
|
58
|
+
registry: registryWithAttributor,
|
|
51
59
|
provideEntryPoint,
|
|
52
60
|
runtimeOptions,
|
|
53
61
|
containerScope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yEAA8E;AAE9E,kEAA6D;AAK7D,uEAAqF;AAErF,qEAKkC;AAClC,iGAAkF;AAElF;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CACzC,OAA8B;IAE9B,MAAM,UAAU,GAAG,MAAM,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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;CACqC,CAAC;AAlE5B,QAAA,eAAe,mBAkEa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerRuntime } from \"@fluidframework/container-runtime/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIFluidDataStoreRegistry,\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\tBase: typeof ContainerRuntime = ContainerRuntime,\n): typeof ContainerRuntime =>\n\tclass ContainerRuntimeWithAttributor extends Base {\n\t\tpublic static override async loadRuntime(\n\t\t\tparams: Parameters<typeof Base.loadRuntime>[0],\n\t\t): Promise<ContainerRuntime> {\n\t\t\tconst {\n\t\t\t\tcontext,\n\t\t\t\tregistry,\n\t\t\t\texisting,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\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\t// Wrap the registry to also include the attributor factory\n\t\t\tconst registryWithAttributor: IFluidDataStoreRegistry = {\n\t\t\t\tget IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\t\t\t\treturn registryWithAttributor;\n\t\t\t\t},\n\t\t\t\tget: async (name: string) => {\n\t\t\t\t\tif (name === RuntimeAttributorFactory.type) {\n\t\t\t\t\t\treturn factory;\n\t\t\t\t\t}\n\t\t\t\t\treturn registry.get(name);\n\t\t\t\t},\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\tconst runtime = await Base.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistry: registryWithAttributor,\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});\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} as unknown as typeof ContainerRuntime;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,KAAK,EACX,qBAAqB,EAErB,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,UACrB,uBAAuB,KAC3B,
|
|
1
|
+
{"version":3,"file":"mixinAttributor.d.ts","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,KAAK,EACX,qBAAqB,EAErB,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,UACrB,uBAAuB,KAC3B,uBAgEqC,CAAC"}
|
package/lib/mixinAttributor.js
CHANGED
|
@@ -28,13 +28,21 @@ export async function getRuntimeAttributor(runtime) {
|
|
|
28
28
|
*/
|
|
29
29
|
export const mixinAttributor = (Base = ContainerRuntime) => class ContainerRuntimeWithAttributor extends Base {
|
|
30
30
|
static async loadRuntime(params) {
|
|
31
|
-
const { context,
|
|
31
|
+
const { context, registry, existing, provideEntryPoint, runtimeOptions, containerScope, containerRuntimeCtor = ContainerRuntimeWithAttributor, } = params;
|
|
32
32
|
const mc = loggerToMonitoringContext(context.taggedLogger);
|
|
33
33
|
const factory = new RuntimeAttributorFactory();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// Wrap the registry to also include the attributor factory
|
|
35
|
+
const registryWithAttributor = {
|
|
36
|
+
get IFluidDataStoreRegistry() {
|
|
37
|
+
return registryWithAttributor;
|
|
38
|
+
},
|
|
39
|
+
get: async (name) => {
|
|
40
|
+
if (name === RuntimeAttributorFactory.type) {
|
|
41
|
+
return factory;
|
|
42
|
+
}
|
|
43
|
+
return registry.get(name);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
38
46
|
const shouldTrackAttribution = mc.config.getBoolean(enableOnNewFileKey) ?? false;
|
|
39
47
|
if (shouldTrackAttribution) {
|
|
40
48
|
const { options } = context;
|
|
@@ -43,7 +51,7 @@ export const mixinAttributor = (Base = ContainerRuntime) => class ContainerRunti
|
|
|
43
51
|
}
|
|
44
52
|
const runtime = await Base.loadRuntime({
|
|
45
53
|
context,
|
|
46
|
-
|
|
54
|
+
registry: registryWithAttributor,
|
|
47
55
|
provideEntryPoint,
|
|
48
56
|
runtimeOptions,
|
|
49
57
|
containerScope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,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,CAC9B,OAAgC,gBAAgB,EACtB,EAAE,CAC5B,MAAM,8BAA+B,SAAQ,IAAI;IACzC,MAAM,CAAU,KAAK,CAAC,WAAW,CACvC,MAA8C;QAE9C,MAAM,EACL,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"mixinAttributor.js","sourceRoot":"","sources":["../src/mixinAttributor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,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,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E,GAAG,OAAO,CAAC;YAC5B,sEAAsE;YACtE,CAAC,OAAO,CAAC,WAAW,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC;QAC3C,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC;YACtC,OAAO;YACP,QAAQ,EAAE,sBAAsB;YAChC,iBAAiB;YACjB,cAAc;YACd,cAAc;YACd,QAAQ;YACR,oBAAoB;SACpB,CAAC,CAAC;QAEH,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;CACqC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerRuntime } from \"@fluidframework/container-runtime/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIFluidDataStoreRegistry,\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\tBase: typeof ContainerRuntime = ContainerRuntime,\n): typeof ContainerRuntime =>\n\tclass ContainerRuntimeWithAttributor extends Base {\n\t\tpublic static override async loadRuntime(\n\t\t\tparams: Parameters<typeof Base.loadRuntime>[0],\n\t\t): Promise<ContainerRuntime> {\n\t\t\tconst {\n\t\t\t\tcontext,\n\t\t\t\tregistry,\n\t\t\t\texisting,\n\t\t\t\tprovideEntryPoint,\n\t\t\t\truntimeOptions,\n\t\t\t\tcontainerScope,\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\t// Wrap the registry to also include the attributor factory\n\t\t\tconst registryWithAttributor: IFluidDataStoreRegistry = {\n\t\t\t\tget IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\t\t\t\treturn registryWithAttributor;\n\t\t\t\t},\n\t\t\t\tget: async (name: string) => {\n\t\t\t\t\tif (name === RuntimeAttributorFactory.type) {\n\t\t\t\t\t\treturn factory;\n\t\t\t\t\t}\n\t\t\t\t\treturn registry.get(name);\n\t\t\t\t},\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\tconst runtime = await Base.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistry: registryWithAttributor,\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});\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} 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.116.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.116.0",
|
|
53
|
+
"@fluidframework/container-definitions": "~2.116.0",
|
|
54
|
+
"@fluidframework/container-runtime": "~2.116.0",
|
|
55
|
+
"@fluidframework/container-runtime-definitions": "~2.116.0",
|
|
56
|
+
"@fluidframework/core-interfaces": "~2.116.0",
|
|
57
|
+
"@fluidframework/core-utils": "~2.116.0",
|
|
58
|
+
"@fluidframework/datastore": "~2.116.0",
|
|
59
|
+
"@fluidframework/datastore-definitions": "~2.116.0",
|
|
60
|
+
"@fluidframework/driver-definitions": "~2.116.0",
|
|
61
|
+
"@fluidframework/runtime-definitions": "~2.116.0",
|
|
62
|
+
"@fluidframework/runtime-utils": "~2.116.0",
|
|
63
|
+
"@fluidframework/telemetry-utils": "~2.116.0",
|
|
64
64
|
"lz4js": "^0.2.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
67
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
68
68
|
"@biomejs/biome": "~2.4.5",
|
|
69
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
70
|
-
"@fluid-private/stochastic-test-utils": "~2.
|
|
71
|
-
"@fluid-tools/build-cli": "^0.
|
|
69
|
+
"@fluid-internal/mocha-test-setup": "~2.116.0",
|
|
70
|
+
"@fluid-private/stochastic-test-utils": "~2.116.0",
|
|
71
|
+
"@fluid-tools/build-cli": "^0.67.0",
|
|
72
72
|
"@fluidframework/build-common": "^2.0.3",
|
|
73
|
-
"@fluidframework/build-tools": "^0.
|
|
74
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
75
|
-
"@fluidframework/merge-tree": "~2.
|
|
76
|
-
"@fluidframework/sequence": "~2.
|
|
77
|
-
"@fluidframework/test-runtime-utils": "~2.
|
|
73
|
+
"@fluidframework/build-tools": "^0.67.0",
|
|
74
|
+
"@fluidframework/eslint-config-fluid": "^14.0.0",
|
|
75
|
+
"@fluidframework/merge-tree": "~2.116.0",
|
|
76
|
+
"@fluidframework/sequence": "~2.116.0",
|
|
77
|
+
"@fluidframework/test-runtime-utils": "~2.116.0",
|
|
78
78
|
"@microsoft/api-extractor": "7.58.1",
|
|
79
79
|
"@types/mocha": "^10.0.10",
|
|
80
80
|
"@types/node": "~22.19.17",
|
package/src/mixinAttributor.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { FluidObject } from "@fluidframework/core-interfaces";
|
|
|
8
8
|
import { assert } from "@fluidframework/core-utils/internal";
|
|
9
9
|
import type {
|
|
10
10
|
IContainerRuntimeBase,
|
|
11
|
-
|
|
11
|
+
IFluidDataStoreRegistry,
|
|
12
12
|
} from "@fluidframework/runtime-definitions/internal";
|
|
13
13
|
import { loggerToMonitoringContext } from "@fluidframework/telemetry-utils/internal";
|
|
14
14
|
|
|
@@ -53,7 +53,7 @@ export const mixinAttributor = (
|
|
|
53
53
|
): Promise<ContainerRuntime> {
|
|
54
54
|
const {
|
|
55
55
|
context,
|
|
56
|
-
|
|
56
|
+
registry,
|
|
57
57
|
existing,
|
|
58
58
|
provideEntryPoint,
|
|
59
59
|
runtimeOptions,
|
|
@@ -63,10 +63,18 @@ export const mixinAttributor = (
|
|
|
63
63
|
|
|
64
64
|
const mc = loggerToMonitoringContext(context.taggedLogger);
|
|
65
65
|
const factory = new RuntimeAttributorFactory();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
// Wrap the registry to also include the attributor factory
|
|
67
|
+
const registryWithAttributor: IFluidDataStoreRegistry = {
|
|
68
|
+
get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {
|
|
69
|
+
return registryWithAttributor;
|
|
70
|
+
},
|
|
71
|
+
get: async (name: string) => {
|
|
72
|
+
if (name === RuntimeAttributorFactory.type) {
|
|
73
|
+
return factory;
|
|
74
|
+
}
|
|
75
|
+
return registry.get(name);
|
|
76
|
+
},
|
|
77
|
+
};
|
|
70
78
|
const shouldTrackAttribution = mc.config.getBoolean(enableOnNewFileKey) ?? false;
|
|
71
79
|
if (shouldTrackAttribution) {
|
|
72
80
|
const { options } = context;
|
|
@@ -76,7 +84,7 @@ export const mixinAttributor = (
|
|
|
76
84
|
|
|
77
85
|
const runtime = await Base.loadRuntime({
|
|
78
86
|
context,
|
|
79
|
-
|
|
87
|
+
registry: registryWithAttributor,
|
|
80
88
|
provideEntryPoint,
|
|
81
89
|
runtimeOptions,
|
|
82
90
|
containerScope,
|