@fluidframework/runtime-utils 2.113.0-411909 → 2.114.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/api-report/runtime-utils.legacy.alpha.api.md +6 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +11 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/legacyAlpha.d.ts +5 -0
  8. package/dist/packageVersion.d.ts +1 -1
  9. package/dist/packageVersion.d.ts.map +1 -1
  10. package/dist/packageVersion.js +1 -1
  11. package/dist/packageVersion.js.map +1 -1
  12. package/dist/serviceClientBase.d.ts +96 -0
  13. package/dist/serviceClientBase.d.ts.map +1 -0
  14. package/dist/serviceClientBase.js +165 -0
  15. package/dist/serviceClientBase.js.map +1 -0
  16. package/dist/serviceClientUtils.d.ts +90 -0
  17. package/dist/serviceClientUtils.d.ts.map +1 -0
  18. package/dist/serviceClientUtils.js +128 -0
  19. package/dist/serviceClientUtils.js.map +1 -0
  20. package/lib/index.d.ts +4 -0
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +2 -0
  23. package/lib/index.js.map +1 -1
  24. package/lib/legacyAlpha.d.ts +5 -0
  25. package/lib/packageVersion.d.ts +1 -1
  26. package/lib/packageVersion.d.ts.map +1 -1
  27. package/lib/packageVersion.js +1 -1
  28. package/lib/packageVersion.js.map +1 -1
  29. package/lib/serviceClientBase.d.ts +96 -0
  30. package/lib/serviceClientBase.d.ts.map +1 -0
  31. package/lib/serviceClientBase.js +159 -0
  32. package/lib/serviceClientBase.js.map +1 -0
  33. package/lib/serviceClientUtils.d.ts +90 -0
  34. package/lib/serviceClientUtils.d.ts.map +1 -0
  35. package/lib/serviceClientUtils.js +121 -0
  36. package/lib/serviceClientUtils.js.map +1 -0
  37. package/package.json +17 -17
  38. package/src/index.ts +18 -0
  39. package/src/packageVersion.ts +1 -1
  40. package/src/serviceClientBase.ts +261 -0
  41. package/src/serviceClientUtils.ts +236 -0
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ /*!
3
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
+ * Licensed under the MIT License.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ServiceClientImplementation = exports.makeCodeLoader = exports.normalizeRegistry = exports.convertRegistry = exports.rootDataStoreId = void 0;
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
+ const internal_2 = require("@fluidframework/driver-definitions/internal");
10
+ const serviceClientBase_js_1 = require("./serviceClientBase.js");
11
+ /**
12
+ * The constant ID used for the root data store alias in service containers.
13
+ * @internal
14
+ */
15
+ exports.rootDataStoreId = "root";
16
+ /**
17
+ * Converts a `DataStoreRegistry` to the `IFluidDataStoreRegistry` interface expected by the container runtime.
18
+ * @remarks
19
+ * This does not leverage the ability for `IFluidDataStoreRegistry.get` to return undefined.
20
+ * Note that all use-cases of `IFluidDataStoreRegistry.get` returning undefined currently end up as a fatal error.
21
+ * Therefore it should be fine for the error to instead be thrown by the registry function, which is what this function does.
22
+ * @internal
23
+ */
24
+ function convertRegistry(registry) {
25
+ return {
26
+ async get(name) {
27
+ const dataStoreKind = await (0, internal_2.lookupInRegistry)(registry, (0, internal_2.createBasicRegistryKey)(name));
28
+ serviceClientBase_js_1.DataStoreKindImplementation.narrowGeneric(dataStoreKind);
29
+ return dataStoreKind;
30
+ },
31
+ get IFluidDataStoreRegistry() {
32
+ return this;
33
+ },
34
+ };
35
+ }
36
+ exports.convertRegistry = convertRegistry;
37
+ /**
38
+ * Normalizes a `DataStoreKind` or registry function into a registry function.
39
+ * @internal
40
+ */
41
+ function normalizeRegistry(input) {
42
+ if (serviceClientBase_js_1.DataStoreKindImplementation.guard(input)) {
43
+ return async () => input;
44
+ }
45
+ (0, internal_1.assert)(typeof input === "function", 0xd17 /* Registry must be a function */);
46
+ return input;
47
+ }
48
+ exports.normalizeRegistry = normalizeRegistry;
49
+ /**
50
+ * Creates an `ICodeDetailsLoader` that wires up the container runtime via the supplied
51
+ * `loadRuntime` callback.
52
+ *
53
+ * @remarks
54
+ * The `loadRuntime` callback is responsible for invoking the concrete runtime factory and,
55
+ * when `parameters.existing` is `false` and `parameters.newContainerRootType` is set, creating and
56
+ * aliasing the root data store.
57
+ *
58
+ * This loader never does any code loading, and always assumes it is compatible.
59
+ * TODO: We should reevaluate this before promoting ServiceClient APIs to beta.
60
+ *
61
+ * @internal
62
+ */
63
+ function makeCodeLoader(registry, minVersionForCollab, loadRuntime, root) {
64
+ const fluidExport = {
65
+ async instantiateRuntime(context, existing) {
66
+ const provideEntryPoint = async (entryPointRuntime) => {
67
+ const data = await entryPointRuntime.getAliasedDataStoreEntryPoint(exports.rootDataStoreId);
68
+ if (data === undefined) {
69
+ throw new Error("Root data store missing!");
70
+ }
71
+ const rootDataStore = await data.get();
72
+ return rootDataStore;
73
+ };
74
+ return loadRuntime({
75
+ context,
76
+ registry: convertRegistry(registry),
77
+ provideEntryPoint,
78
+ existing,
79
+ minVersionForCollab,
80
+ newContainerRootType: root?.type,
81
+ });
82
+ },
83
+ async satisfies(candidate, constraint) {
84
+ return true;
85
+ },
86
+ async compare(a, b) {
87
+ return 0;
88
+ },
89
+ get IRuntimeFactory() {
90
+ return fluidExport;
91
+ },
92
+ get IFluidCodeDetailsComparer() {
93
+ return fluidExport;
94
+ },
95
+ };
96
+ return {
97
+ load: async (details) => {
98
+ return { module: { fluidExport }, details };
99
+ },
100
+ };
101
+ }
102
+ exports.makeCodeLoader = makeCodeLoader;
103
+ /**
104
+ * Creates a {@link @fluidframework/driver-definitions#ServiceClient} that delegates container
105
+ * creation and loading to the supplied container class statics.
106
+ * @internal
107
+ */
108
+ class ServiceClientImplementation {
109
+ constructor(options, statics) {
110
+ this.options = options;
111
+ this.statics = statics;
112
+ }
113
+ async createContainer(root, registry) {
114
+ if (registry === undefined) {
115
+ serviceClientBase_js_1.DataStoreKindImplementation.narrowGeneric(root);
116
+ return this.statics.createDetached(normalizeRegistry(root), this.options, root);
117
+ }
118
+ else {
119
+ const result = await (0, internal_2.lookupInRegistry)(registry, root);
120
+ return this.statics.createDetached(registry, this.options, result);
121
+ }
122
+ }
123
+ async loadContainer(id, root) {
124
+ return this.statics.load(normalizeRegistry(root), this.options, id);
125
+ }
126
+ }
127
+ exports.ServiceClientImplementation = ServiceClientImplementation;
128
+ //# sourceMappingURL=serviceClientUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceClientUtils.js","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,kEAA6D;AAC7D,0EAUqD;AAQrD,iEAAqE;AAErE;;;GAGG;AACU,QAAA,eAAe,GAAG,MAAM,CAAC;AAEtC;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAI,QAA8B;IAChE,OAAO;QACN,KAAK,CAAC,GAAG,CAAC,IAAY;YACrB,MAAM,aAAa,GAAG,MAAM,IAAA,2BAAgB,EAAC,QAAQ,EAAE,IAAA,iCAAsB,EAAC,IAAI,CAAC,CAAC,CAAC;YACrF,kDAA2B,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YACzD,OAAO,aAAa,CAAC;QACtB,CAAC;QACD,IAAI,uBAAuB;YAC1B,OAAO,IAAI,CAAC;QACb,CAAC;KACD,CAAC;AACH,CAAC;AAXD,0CAWC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAChC,KAA6D;IAE7D,IAAI,kDAA2B,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC;IAC1B,CAAC;IACD,IAAA,iBAAM,EAAC,OAAO,KAAK,KAAK,UAAU,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC;AACd,CAAC;AARD,8CAQC;AAgCD;;;;;;;;;;;;;GAaG;AACH,SAAg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B,OAA0C;QAD1C,YAAO,GAAP,OAAO,CAAU;QACjB,YAAO,GAAP,OAAO,CAAmC;IACzD,CAAC;IASG,KAAK,CAAC,eAAe,CAC3B,IAAwC,EACxC,QAA8C;QAE9C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,kDAA2B,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjF,CAAC;aAAM,CAAC;YACP,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAgB,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,EAAU,EACV,IAA4D;QAE5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACrE,CAAC;CACD;AAhCD,kEAgCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tICodeDetailsLoader,\n\tIContainerContext,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIFluidModuleWithDetails,\n\tIRuntime,\n\tIRuntimeFactory,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tcreateBasicRegistryKey,\n\ttype DataStoreKey,\n\ttype DataStoreKind,\n\ttype DataStoreRegistry,\n\ttype FluidContainerAttached,\n\ttype FluidContainerWithService,\n\ttype Registry,\n\tlookupInRegistry,\n\ttype ServiceClient,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tFluidDataStoreRegistryEntry,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreRegistry,\n\tMinimumVersionForCollab,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { DataStoreKindImplementation } from \"./serviceClientBase.js\";\n\n/**\n * The constant ID used for the root data store alias in service containers.\n * @internal\n */\nexport const rootDataStoreId = \"root\";\n\n/**\n * Converts a `DataStoreRegistry` to the `IFluidDataStoreRegistry` interface expected by the container runtime.\n * @remarks\n * This does not leverage the ability for `IFluidDataStoreRegistry.get` to return undefined.\n * Note that all use-cases of `IFluidDataStoreRegistry.get` returning undefined currently end up as a fatal error.\n * Therefore it should be fine for the error to instead be thrown by the registry function, which is what this function does.\n * @internal\n */\nexport function convertRegistry<T>(registry: DataStoreRegistry<T>): IFluidDataStoreRegistry {\n\treturn {\n\t\tasync get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\t\tconst dataStoreKind = await lookupInRegistry(registry, createBasicRegistryKey(name));\n\t\t\tDataStoreKindImplementation.narrowGeneric(dataStoreKind);\n\t\t\treturn dataStoreKind;\n\t\t},\n\t\tget IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\t\treturn this;\n\t\t},\n\t};\n}\n\n/**\n * Normalizes a `DataStoreKind` or registry function into a registry function.\n * @internal\n */\nexport function normalizeRegistry<T>(\n\tinput: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,\n): Registry<Promise<DataStoreKind<T>>> {\n\tif (DataStoreKindImplementation.guard(input)) {\n\t\treturn async () => input;\n\t}\n\tassert(typeof input === \"function\", 0xd17 /* Registry must be a function */);\n\treturn input;\n}\n\n/**\n * Parameters passed to a {@link ContainerRuntimeLoader}.\n * @internal\n */\nexport interface ContainerRuntimeLoaderParams {\n\tcontext: IContainerContext;\n\tregistry: IFluidDataStoreRegistry;\n\tprovideEntryPoint: (runtime: IContainerRuntimeBase) => Promise<FluidObject>;\n\texisting: boolean;\n\tminVersionForCollab: MinimumVersionForCollab;\n\t/**\n\t * The type string of the root data store to create. Only set when `existing` is false.\n\t */\n\tnewContainerRootType: string | undefined;\n}\n\n/**\n * A service-specific callback that creates or loads the container runtime.\n *\n * @remarks\n * Receives the runtime parameters assembled by {@link makeCodeLoader} and is responsible for\n * calling the concrete runtime factory (e.g. `ContainerRuntime.loadRuntime2`) and, when\n * `existing` is `false`, initializing the root data store before returning.\n *\n * @internal\n */\nexport type ContainerRuntimeLoader = (\n\tparameters: ContainerRuntimeLoaderParams,\n) => Promise<IRuntime>;\n\n/**\n * Creates an `ICodeDetailsLoader` that wires up the container runtime via the supplied\n * `loadRuntime` callback.\n *\n * @remarks\n * The `loadRuntime` callback is responsible for invoking the concrete runtime factory and,\n * when `parameters.existing` is `false` and `parameters.newContainerRootType` is set, creating and\n * aliasing the root data store.\n *\n * This loader never does any code loading, and always assumes it is compatible.\n * TODO: We should reevaluate this before promoting ServiceClient APIs to beta.\n *\n * @internal\n */\nexport function makeCodeLoader<T>(\n\tregistry: DataStoreRegistry<T>,\n\tminVersionForCollab: MinimumVersionForCollab,\n\tloadRuntime: ContainerRuntimeLoader,\n\troot?: DataStoreKind<T>,\n): ICodeDetailsLoader {\n\tconst fluidExport: IRuntimeFactory & IFluidCodeDetailsComparer = {\n\t\tasync instantiateRuntime(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime> {\n\t\t\tconst provideEntryPoint = async (\n\t\t\t\tentryPointRuntime: IContainerRuntimeBase,\n\t\t\t): Promise<T & FluidObject> => {\n\t\t\t\tconst data = await entryPointRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\t\tif (data === undefined) {\n\t\t\t\t\tthrow new Error(\"Root data store missing!\");\n\t\t\t\t}\n\t\t\t\tconst rootDataStore = await data.get();\n\t\t\t\treturn rootDataStore as T & FluidObject;\n\t\t\t};\n\n\t\t\treturn loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistry: convertRegistry(registry),\n\t\t\t\tprovideEntryPoint,\n\t\t\t\texisting,\n\t\t\t\tminVersionForCollab,\n\t\t\t\tnewContainerRootType: root?.type,\n\t\t\t});\n\t\t},\n\n\t\tasync satisfies(\n\t\t\tcandidate: IFluidCodeDetails,\n\t\t\tconstraint: IFluidCodeDetails,\n\t\t): Promise<boolean> {\n\t\t\treturn true;\n\t\t},\n\n\t\tasync compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined> {\n\t\t\treturn 0;\n\t\t},\n\n\t\tget IRuntimeFactory(): IRuntimeFactory {\n\t\t\treturn fluidExport;\n\t\t},\n\n\t\tget IFluidCodeDetailsComparer(): IFluidCodeDetailsComparer {\n\t\t\treturn fluidExport;\n\t\t},\n\t};\n\n\treturn {\n\t\tload: async (details: IFluidCodeDetails): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn { module: { fluidExport }, details };\n\t\t},\n\t};\n}\n\n/**\n * Minimal interface for the static container factory methods used by {@link ServiceClientImplementation}.\n * @internal\n */\nexport interface ServiceContainerStatics<TOptions> {\n\tcreateDetached<T>(\n\t\tregistry: DataStoreRegistry<T>,\n\t\toptions: TOptions,\n\t\troot: DataStoreKind<T>,\n\t): Promise<FluidContainerWithService<T>>;\n\n\tload<T>(\n\t\tregistry: DataStoreRegistry<T>,\n\t\toptions: TOptions,\n\t\tid: string,\n\t): Promise<FluidContainerAttached<T>>;\n}\n\n/**\n * Creates a {@link @fluidframework/driver-definitions#ServiceClient} that delegates container\n * creation and loading to the supplied container class statics.\n * @internal\n */\nexport class ServiceClientImplementation<TOptions> implements ServiceClient {\n\tpublic constructor(\n\t\tprivate readonly options: TOptions,\n\t\tprivate readonly statics: ServiceContainerStatics<TOptions>,\n\t) {}\n\n\tpublic createContainer<T>(root: DataStoreKind<T>): Promise<FluidContainerWithService<T>>;\n\n\tpublic createContainer<T>(\n\t\troot: DataStoreKey<T>,\n\t\tregistry: Registry<Promise<DataStoreKind>>,\n\t): Promise<FluidContainerWithService<T>>;\n\n\tpublic async createContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerWithService<T>> {\n\t\tif (registry === undefined) {\n\t\t\tDataStoreKindImplementation.narrowGeneric(root);\n\t\t\treturn this.statics.createDetached(normalizeRegistry(root), this.options, root);\n\t\t} else {\n\t\t\tconst result = await lookupInRegistry(registry, root);\n\t\t\treturn this.statics.createDetached(registry, this.options, result);\n\t\t}\n\t}\n\n\tpublic async loadContainer<T>(\n\t\tid: string,\n\t\troot: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\treturn this.statics.load(normalizeRegistry(root), this.options, id);\n\t}\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -19,4 +19,8 @@ export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
19
19
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
20
20
  export { configValueToMinVersionForCollab, defaultMinVersionForCollab, validateConfigMapOverrides, getConfigForMinVersionForCollab, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, validateMinimumVersionForCollab, lowestMinVersionForCollab, getConfigForMinVersionForCollabIterable, cleanedPackageVersion, selectVersionRoundedDown, } from "./compatibilityBase.js";
21
21
  export type { ConfigMap, ConfigMapEntry, ConfigValidationMap, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
22
+ export type { Audience } from "./serviceClientBase.js";
23
+ export { DataStoreKindImplementation, ServiceContainerBase, getContainerAudience, } from "./serviceClientBase.js";
24
+ export { convertRegistry, makeCodeLoader, normalizeRegistry, rootDataStoreId, ServiceClientImplementation, } from "./serviceClientUtils.js";
25
+ export type { ContainerRuntimeLoader, ContainerRuntimeLoaderParams, ServiceContainerStatics, } from "./serviceClientUtils.js";
22
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 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oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,0BAA0B,EAC1B,+BAA+B,EAC/B,yBAAyB,EACzB,uCAAuC,EACvC,qBAAqB,EACrB,wBAAwB,GACxB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,GACf,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACN,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,uBAAuB,GACvB,MAAM,yBAAyB,CAAC"}
package/lib/index.js CHANGED
@@ -16,4 +16,6 @@ export { RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.j
16
16
  export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
17
17
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
18
18
  export { configValueToMinVersionForCollab, defaultMinVersionForCollab, validateConfigMapOverrides, getConfigForMinVersionForCollab, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, validateMinimumVersionForCollab, lowestMinVersionForCollab, getConfigForMinVersionForCollabIterable, cleanedPackageVersion, selectVersionRoundedDown, } from "./compatibilityBase.js";
19
+ export { DataStoreKindImplementation, ServiceContainerBase, getContainerAudience, } from "./serviceClientBase.js";
20
+ export { convertRegistry, makeCodeLoader, normalizeRegistry, rootDataStoreId, ServiceClientImplementation, } from "./serviceClientUtils.js";
19
21
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,2BAA2B,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,0BAA0B,EAC1B,+BAA+B,EAC/B,yBAAyB,EACzB,uCAAuC,EACvC,qBAAqB,EACrB,wBAAwB,GACxB,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n\tasLegacyAlpha,\n\tdataStoreLoadTelemetryProps,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\tlookupTemporaryBlobStorageId,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tvalidateConfigMapOverrides,\n\tgetConfigForMinVersionForCollab,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tvalidateMinimumVersionForCollab,\n\tlowestMinVersionForCollab,\n\tgetConfigForMinVersionForCollabIterable,\n\tcleanedPackageVersion,\n\tselectVersionRoundedDown,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigMapEntry,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,E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AAoB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,2BAA2B,GAC3B,MAAM,yBAAyB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n\tasLegacyAlpha,\n\tdataStoreLoadTelemetryProps,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\tlookupTemporaryBlobStorageId,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tvalidateConfigMapOverrides,\n\tgetConfigForMinVersionForCollab,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tvalidateMinimumVersionForCollab,\n\tlowestMinVersionForCollab,\n\tgetConfigForMinVersionForCollabIterable,\n\tcleanedPackageVersion,\n\tselectVersionRoundedDown,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigMapEntry,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\nexport type { Audience } from \"./serviceClientBase.js\";\nexport {\n\tDataStoreKindImplementation,\n\tServiceContainerBase,\n\tgetContainerAudience,\n} from \"./serviceClientBase.js\";\nexport {\n\tconvertRegistry,\n\tmakeCodeLoader,\n\tnormalizeRegistry,\n\trootDataStoreId,\n\tServiceClientImplementation,\n} from \"./serviceClientUtils.js\";\nexport type {\n\tContainerRuntimeLoader,\n\tContainerRuntimeLoaderParams,\n\tServiceContainerStatics,\n} from \"./serviceClientUtils.js\";\n"]}
@@ -28,6 +28,11 @@ export {
28
28
  toFluidHandleInternal,
29
29
  // #endregion
30
30
 
31
+ // #region @alpha APIs
32
+ Audience,
33
+ getContainerAudience,
34
+ // #endregion
35
+
31
36
  // #region @legacyAlpha APIs
32
37
  asLegacyAlpha,
33
38
  lookupTemporaryBlobStorageId
@@ -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/runtime-utils";
8
- export declare const pkgVersion = "2.113.0-411909";
8
+ export declare const pkgVersion = "2.114.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,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,mBAAmB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,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/runtime-utils";
8
- export const pkgVersion = "2.113.0-411909";
8
+ export const pkgVersion = "2.114.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,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,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/runtime-utils\";\nexport const pkgVersion = \"2.113.0-411909\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,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/runtime-utils\";\nexport const pkgVersion = \"2.114.0\";\n"]}
@@ -0,0 +1,96 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IAudience } from "@fluidframework/container-definitions";
6
+ import { type IContainer } from "@fluidframework/container-definitions/internal";
7
+ import type { IRequest } from "@fluidframework/core-interfaces";
8
+ import { ErasedTypeImplementation } from "@fluidframework/core-interfaces/internal";
9
+ import { type DataStoreKey, type DataStoreKind, type FluidContainerAttached, type FluidContainerWithService, type Registry } from "@fluidframework/driver-definitions/internal";
10
+ import type { IContainerRuntimeBase, IFluidDataStoreChannel, IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
11
+ /**
12
+ * Implementation of `DataStoreKind`.
13
+ * @internal
14
+ */
15
+ export declare class DataStoreKindImplementation<T> extends ErasedTypeImplementation<DataStoreKind<T>> implements DataStoreKind<T>, IFluidDataStoreFactory {
16
+ private readonly factory;
17
+ /**
18
+ * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.
19
+ */
20
+ static guard<T>(value: T): value is DataStoreKindImplementation<T extends DataStoreKind<infer T2> ? T2 : never> & T;
21
+ /**
22
+ * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.
23
+ */
24
+ static narrowGeneric<T>(value: T): asserts value is DataStoreKindImplementation<T extends DataStoreKind<infer T2> ? T2 : never> & T;
25
+ readonly type: string;
26
+ readonly createDataStore?: (context: IFluidDataStoreContext) => {
27
+ readonly runtime: IFluidDataStoreChannel;
28
+ };
29
+ constructor(factory: Pick<DataStoreKindImplementation<T>, "type" | "instantiateDataStore" | "createDataStore">);
30
+ instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<IFluidDataStoreChannel>;
31
+ get IFluidDataStoreFactory(): IFluidDataStoreFactory;
32
+ adapt(value: Promise<DataStoreKind>): Promise<DataStoreKind<T>>;
33
+ }
34
+ /**
35
+ * Shared base class for all `ServiceClient` container implementations.
36
+ *
37
+ * @remarks
38
+ * Extends `ErasedTypeImplementation` so that
39
+ * {@link getContainerAudience} can narrow via `ServiceContainerBase.narrow()`.
40
+ *
41
+ * @internal
42
+ */
43
+ export declare abstract class ServiceContainerBase<TData, TOptions = unknown> extends ErasedTypeImplementation<FluidContainerWithService<TData>> implements FluidContainerWithService<TData> {
44
+ readonly registry: Registry<Promise<DataStoreKind<TData>>>;
45
+ readonly options: TOptions;
46
+ readonly container: IContainer;
47
+ readonly data: TData;
48
+ id: string | undefined;
49
+ /**
50
+ * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.
51
+ */
52
+ private startedAttach;
53
+ protected constructor(registry: Registry<Promise<DataStoreKind<TData>>>, options: TOptions, container: IContainer, data: TData, id: string | undefined);
54
+ /**
55
+ * Creates the service-specific request used to attach this container.
56
+ * @remarks
57
+ * Called by {@link ServiceContainerBase.attach} after validating that no attach is already in progress.
58
+ */
59
+ protected abstract createAttachRequest(): IRequest;
60
+ /**
61
+ * Extracts the container ID from {@link ServiceContainerBase.container}'s resolved URL after attachment.
62
+ * @remarks
63
+ * Override when the service's resolved URL stores the id in a non-standard field.
64
+ */
65
+ protected getContainerId(): string;
66
+ attach(): Promise<FluidContainerAttached<TData>>;
67
+ get audience(): IAudience;
68
+ getRuntime(): IContainerRuntimeBase;
69
+ close(): void;
70
+ createDataStore<T>(key: DataStoreKey<T>): Promise<T>;
71
+ }
72
+ /**
73
+ * All clients connected to the op stream, both read-only and read/write.
74
+ * @remarks
75
+ * Currently just {@link @fluidframework/container-definitions#IAudience}, but may diverge before stabilizing.
76
+ * @privateRemarks
77
+ * This is currently just an alias for IAudience, but it is defined separately to allow for:
78
+ * 1. Following the no I prefix naming convention.
79
+ * 2. The possibility of diverging from IAudience in the future if desired.
80
+ * 3. Make it easy for the reexport from fluid-framework to be `@alpha` so the name is not locked down prematurely.
81
+ * @sealed @alpha
82
+ */
83
+ export type Audience = IAudience;
84
+ /**
85
+ * Gets the {@link Audience} from a Fluid container
86
+ * created by any {@link @fluidframework/driver-definitions#ServiceClient}.
87
+ * @privateRemarks
88
+ * This is exposed via a free function rather than as a property of FluidContainerAttached
89
+ * for a few minor reasons:
90
+ * 1. This allows stabilizing the FluidContainerAttached API independently committing to how we want to expose the audience.
91
+ * 2. This demonstrates the pattern of how we can have possible less stable APIs to expose service specific features without them being part of the core FluidContainer API.
92
+ * This will be important for both new feature stabilization, and also exposing anything needed for legacy interop.
93
+ * @alpha
94
+ */
95
+ export declare function getContainerAudience(container: FluidContainerAttached): Audience;
96
+ //# sourceMappingURL=serviceClientBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceClientBase.d.ts","sourceRoot":"","sources":["../src/serviceClientBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EAEb,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EACX,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAOtD;;;GAGG;AACH,qBAAa,2BAA2B,CAAC,CAAC,CACzC,SAAQ,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC,CACjD,YAAW,aAAa,CAAC,CAAC,CAAC,EAAE,s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UAAU;aACrB,IAAI,EAAE,KAAK;IACpB,EAAE,EAAE,MAAM,GAAG,SAAS;IAV9B;;OAEG;IACH,OAAO,CAAC,aAAa,CAAS;IAE9B,SAAS,aACQ,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EACjD,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,KAAK,EACpB,EAAE,EAAE,MAAM,GAAG,SAAS;IAK9B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAAI,QAAQ;IAElD;;;;OAIG;IACH,SAAS,CAAC,cAAc,IAAI,MAAM;IAOrB,MAAM,IAAI,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IA2B7D,IAAW,QAAQ,IAAI,SAAS,CAE/B;IAEM,UAAU,IAAI,qBAAqB;IAqBnC,KAAK,IAAI,IAAI;IAcP,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAcjE;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEjC;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,sBAAsB,GAAG,QAAQ,CAGhF"}
@@ -0,0 +1,159 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { AttachState } from "@fluidframework/container-definitions/internal";
6
+ import { ErasedTypeImplementation } from "@fluidframework/core-interfaces/internal";
7
+ import { assert } from "@fluidframework/core-utils/internal";
8
+ import { lookupInRegistry, } from "@fluidframework/driver-definitions/internal";
9
+ import { UsageError } from "@fluidframework/telemetry-utils/internal";
10
+ /*
11
+ * This file provides common implementation logic for ServiceClient implementations.
12
+ */
13
+ /**
14
+ * Implementation of `DataStoreKind`.
15
+ * @internal
16
+ */
17
+ export class DataStoreKindImplementation extends ErasedTypeImplementation {
18
+ /**
19
+ * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.
20
+ */
21
+ static guard(value) {
22
+ return value instanceof DataStoreKindImplementation;
23
+ }
24
+ /**
25
+ * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.
26
+ */
27
+ static narrowGeneric(value) {
28
+ if (!DataStoreKindImplementation.guard(value)) {
29
+ throw new Error("Invalid DataStoreKindImplementation");
30
+ }
31
+ }
32
+ constructor(factory) {
33
+ super();
34
+ this.factory = factory;
35
+ this.type = factory.type;
36
+ if (factory.createDataStore !== undefined) {
37
+ this.createDataStore = factory.createDataStore.bind(factory);
38
+ }
39
+ }
40
+ async instantiateDataStore(context, existing) {
41
+ return this.factory.instantiateDataStore(context, existing);
42
+ }
43
+ get IFluidDataStoreFactory() {
44
+ return this;
45
+ }
46
+ async adapt(value) {
47
+ const input = await value;
48
+ if (input === this) {
49
+ return this;
50
+ }
51
+ if (input.type === this.type) {
52
+ throw new UsageError(`Conflicting DataStoreKinds with same type: ${this.type}`);
53
+ }
54
+ throw new UsageError(`Mismatched DataStoreKind type. Expected: ${this.type}, got: ${input.type}`);
55
+ }
56
+ }
57
+ /**
58
+ * Shared base class for all `ServiceClient` container implementations.
59
+ *
60
+ * @remarks
61
+ * Extends `ErasedTypeImplementation` so that
62
+ * {@link getContainerAudience} can narrow via `ServiceContainerBase.narrow()`.
63
+ *
64
+ * @internal
65
+ */
66
+ export class ServiceContainerBase extends ErasedTypeImplementation {
67
+ constructor(registry, options, container, data, id) {
68
+ super();
69
+ this.registry = registry;
70
+ this.options = options;
71
+ this.container = container;
72
+ this.data = data;
73
+ this.id = id;
74
+ /**
75
+ * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.
76
+ */
77
+ this.startedAttach = false;
78
+ }
79
+ /**
80
+ * Extracts the container ID from {@link ServiceContainerBase.container}'s resolved URL after attachment.
81
+ * @remarks
82
+ * Override when the service's resolved URL stores the id in a non-standard field.
83
+ */
84
+ getContainerId() {
85
+ if (this.container.resolvedUrl === undefined) {
86
+ throw new Error("Resolved URL unexpectedly missing!");
87
+ }
88
+ return this.container.resolvedUrl.id;
89
+ }
90
+ async attach() {
91
+ if (this.id !== undefined) {
92
+ throw new UsageError("Container already attached");
93
+ }
94
+ if (this.startedAttach) {
95
+ throw new UsageError("Container attach already in progress");
96
+ }
97
+ assert(this.container.attachState === AttachState.Detached, 0xd15 /* Container not detached */);
98
+ this.startedAttach = true;
99
+ // TODO: support setting where attach can fail, and leave the container in a valid (non-closed) state.
100
+ // Likely the best way to support this is by adding a `tryAttach(request): Promise<FluidContainerAttached<TData> | undefined>`.
101
+ await this.container.attach(this.createAttachRequest());
102
+ // This type cast is needed to work around the fact that TypeScript assumes the "attach" methods can't modify "attachState".
103
+ assert(this.container.attachState === AttachState.Attached, 0xd16 /* Container failed to attach */);
104
+ this.id = this.getContainerId();
105
+ return this;
106
+ }
107
+ get audience() {
108
+ return this.container.audience;
109
+ }
110
+ getRuntime() {
111
+ const container = this.container;
112
+ if (container.runtime === undefined) {
113
+ throw new Error("Container does not expose a runtime: incompatible container implementation.");
114
+ }
115
+ return container.runtime;
116
+ }
117
+ close() {
118
+ // TODO: `container.close()` cancels the container runtime's GC timers, but a couple of
119
+ // container-level timers are only bounded `setTimeout`s that survive close (they are not
120
+ // cancelled here, nor even on `dispose`):
121
+ // - The container-loader `NoopHeuristic` timer (~2s), which has no disposal hook.
122
+ // - The container-runtime `SummaryManager` "delay before creating summarizer" timer, whose
123
+ // pending timeout is not cleared when the SummaryManager is torn down.
124
+ // These self-expire, so they do not cause indefinite hangs, but until they fire they keep the
125
+ // Node.js event loop alive, delaying a clean process exit after close. That is a common reason
126
+ // tests resort to Mocha's `--exit` flag. Ideally close() (via the runtime's close path) would
127
+ // cancel these too so that closing a single container is sufficient to release all its timers.
128
+ this.container.close();
129
+ }
130
+ async createDataStore(key) {
131
+ const kind = await lookupInRegistry(this.registry, key);
132
+ DataStoreKindImplementation.narrowGeneric(kind);
133
+ const containerRuntime = this.getRuntime();
134
+ // TODO: There should probably be a higher level more type safe way to do this.
135
+ const context = containerRuntime.createDetachedDataStore([kind.type]);
136
+ const channel = await kind.instantiateDataStore(context, false);
137
+ const dataStore = await context.attachRuntime(kind, channel);
138
+ const entryPoint = await dataStore.entryPoint.get();
139
+ // The data store's entry point type is erased at the registry boundary;
140
+ // the DataStoreKind<T> used to create it guarantees the entry point is a T.
141
+ return entryPoint;
142
+ }
143
+ }
144
+ /**
145
+ * Gets the {@link Audience} from a Fluid container
146
+ * created by any {@link @fluidframework/driver-definitions#ServiceClient}.
147
+ * @privateRemarks
148
+ * This is exposed via a free function rather than as a property of FluidContainerAttached
149
+ * for a few minor reasons:
150
+ * 1. This allows stabilizing the FluidContainerAttached API independently committing to how we want to expose the audience.
151
+ * 2. This demonstrates the pattern of how we can have possible less stable APIs to expose service specific features without them being part of the core FluidContainer API.
152
+ * This will be important for both new feature stabilization, and also exposing anything needed for legacy interop.
153
+ * @alpha
154
+ */
155
+ export function getContainerAudience(container) {
156
+ ServiceContainerBase.narrow(container);
157
+ return container.audience;
158
+ }
159
+ //# sourceMappingURL=serviceClientBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceClientBase.js","sourceRoot":"","sources":["../src/serviceClientBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAmB,MAAM,gDAAgD,CAAC;AAE9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAMN,gBAAgB,GAChB,MAAM,6CAA6C,CAAC;AAOrD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;GAEG;AAEH;;;GAGG;AACH,MAAM,OAAO,2BACZ,SAAQ,wBAA0C;IAGlD;;OAEG;IACI,MAAM,C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ACxB,CAAC;CACD;AAeD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiC;IACrE,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IAudience } from \"@fluidframework/container-definitions\";\nimport { AttachState, type IContainer } from \"@fluidframework/container-definitions/internal\";\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { ErasedTypeImplementation } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype DataStoreKey,\n\ttype DataStoreKind,\n\ttype FluidContainerAttached,\n\ttype FluidContainerWithService,\n\ttype Registry,\n\tlookupInRegistry,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/*\n * This file provides common implementation logic for ServiceClient implementations.\n */\n\n/**\n * Implementation of `DataStoreKind`.\n * @internal\n */\nexport class DataStoreKindImplementation<T>\n\textends ErasedTypeImplementation<DataStoreKind<T>>\n\timplements DataStoreKind<T>, IFluidDataStoreFactory\n{\n\t/**\n\t * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.\n\t */\n\tpublic static guard<T>(\n\t\tvalue: T,\n\t): value is DataStoreKindImplementation<T extends DataStoreKind<infer T2> ? T2 : never> & T {\n\t\treturn value instanceof DataStoreKindImplementation;\n\t}\n\n\t/**\n\t * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.\n\t */\n\tpublic static narrowGeneric<T>(\n\t\tvalue: T,\n\t): asserts value is DataStoreKindImplementation<\n\t\tT extends DataStoreKind<infer T2> ? T2 : never\n\t> &\n\t\tT {\n\t\tif (!DataStoreKindImplementation.guard(value)) {\n\t\t\tthrow new Error(\"Invalid DataStoreKindImplementation\");\n\t\t}\n\t}\n\n\tpublic readonly type: string;\n\tpublic readonly createDataStore?: (context: IFluidDataStoreContext) => {\n\t\treadonly runtime: IFluidDataStoreChannel;\n\t};\n\n\tpublic constructor(\n\t\tprivate readonly factory: Pick<\n\t\t\tDataStoreKindImplementation<T>,\n\t\t\t\"type\" | \"instantiateDataStore\" | \"createDataStore\"\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.type = factory.type;\n\t\tif (factory.createDataStore !== undefined) {\n\t\t\tthis.createDataStore = factory.createDataStore.bind(factory);\n\t\t}\n\t}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\treturn this.factory.instantiateDataStore(context, existing);\n\t}\n\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic async adapt(value: Promise<DataStoreKind>): Promise<DataStoreKind<T>> {\n\t\tconst input = await value;\n\t\tif (input === this) {\n\t\t\treturn this;\n\t\t}\n\t\tif (input.type === this.type) {\n\t\t\tthrow new UsageError(`Conflicting DataStoreKinds with same type: ${this.type}`);\n\t\t}\n\t\tthrow new UsageError(\n\t\t\t`Mismatched DataStoreKind type. Expected: ${this.type}, got: ${input.type}`,\n\t\t);\n\t}\n}\n\n/**\n * Shared base class for all `ServiceClient` container implementations.\n *\n * @remarks\n * Extends `ErasedTypeImplementation` so that\n * {@link getContainerAudience} can narrow via `ServiceContainerBase.narrow()`.\n *\n * @internal\n */\nexport abstract class ServiceContainerBase<TData, TOptions = unknown>\n\textends ErasedTypeImplementation<FluidContainerWithService<TData>>\n\timplements FluidContainerWithService<TData>\n{\n\t/**\n\t * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.\n\t */\n\tprivate startedAttach = false;\n\n\tprotected constructor(\n\t\tpublic readonly registry: Registry<Promise<DataStoreKind<TData>>>,\n\t\tpublic readonly options: TOptions,\n\t\tpublic readonly container: IContainer,\n\t\tpublic readonly data: TData,\n\t\tpublic id: string | undefined,\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Creates the service-specific request used to attach this container.\n\t * @remarks\n\t * Called by {@link ServiceContainerBase.attach} after validating that no attach is already in progress.\n\t */\n\tprotected abstract createAttachRequest(): IRequest;\n\n\t/**\n\t * Extracts the container ID from {@link ServiceContainerBase.container}'s resolved URL after attachment.\n\t * @remarks\n\t * Override when the service's resolved URL stores the id in a non-standard field.\n\t */\n\tprotected getContainerId(): string {\n\t\tif (this.container.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Resolved URL unexpectedly missing!\");\n\t\t}\n\t\treturn this.container.resolvedUrl.id;\n\t}\n\n\tpublic async attach(): Promise<FluidContainerAttached<TData>> {\n\t\tif (this.id !== undefined) {\n\t\t\tthrow new UsageError(\"Container already attached\");\n\t\t}\n\t\tif (this.startedAttach) {\n\t\t\tthrow new UsageError(\"Container attach already in progress\");\n\t\t}\n\n\t\tassert(\n\t\t\tthis.container.attachState === AttachState.Detached,\n\t\t\t0xd15 /* Container not detached */,\n\t\t);\n\t\tthis.startedAttach = true;\n\n\t\t// TODO: support setting where attach can fail, and leave the container in a valid (non-closed) state.\n\t\t// Likely the best way to support this is by adding a `tryAttach(request): Promise<FluidContainerAttached<TData> | undefined>`.\n\n\t\tawait this.container.attach(this.createAttachRequest());\n\t\t// This type cast is needed to work around the fact that TypeScript assumes the \"attach\" methods can't modify \"attachState\".\n\t\tassert(\n\t\t\tthis.container.attachState === (AttachState.Attached as AttachState),\n\t\t\t0xd16 /* Container failed to attach */,\n\t\t);\n\t\tthis.id = this.getContainerId();\n\t\treturn this as typeof this & { id: string };\n\t}\n\n\tpublic get audience(): IAudience {\n\t\treturn this.container.audience;\n\t}\n\n\tpublic getRuntime(): IContainerRuntimeBase {\n\t\t// The runtime is not part of the public IContainer surface, so it is reached via a structural cast.\n\t\t// This relies on an implementation detail of the containers produced by the loader\n\t\t// (createDetachedContainer / loadExistingContainer): they carry a `runtime` property.\n\t\t// The undefined guard below turns an incompatible container implementation into a clear error\n\t\t// instead of a confusing failure later when the missing runtime is used.\n\t\t// This is extra risky since IContainer is not marked sealed.\n\t\t// TODO: Replace this with a supported, type-safe accessor once the loader exposes one.\n\t\tinterface IContainerWithRuntime extends IContainer {\n\t\t\treadonly runtime?: IContainerRuntimeBase;\n\t\t}\n\n\t\tconst container = this.container as IContainerWithRuntime;\n\t\tif (container.runtime === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Container does not expose a runtime: incompatible container implementation.\",\n\t\t\t);\n\t\t}\n\t\treturn container.runtime;\n\t}\n\n\tpublic close(): void {\n\t\t// TODO: `container.close()` cancels the container runtime's GC timers, but a couple of\n\t\t// container-level timers are only bounded `setTimeout`s that survive close (they are not\n\t\t// cancelled here, nor even on `dispose`):\n\t\t// - The container-loader `NoopHeuristic` timer (~2s), which has no disposal hook.\n\t\t// - The container-runtime `SummaryManager` \"delay before creating summarizer\" timer, whose\n\t\t// pending timeout is not cleared when the SummaryManager is torn down.\n\t\t// These self-expire, so they do not cause indefinite hangs, but until they fire they keep the\n\t\t// Node.js event loop alive, delaying a clean process exit after close. That is a common reason\n\t\t// tests resort to Mocha's `--exit` flag. Ideally close() (via the runtime's close path) would\n\t\t// cancel these too so that closing a single container is sufficient to release all its timers.\n\t\tthis.container.close();\n\t}\n\n\tpublic async createDataStore<T>(key: DataStoreKey<T>): Promise<T> {\n\t\tconst kind = await lookupInRegistry(this.registry, key);\n\t\tDataStoreKindImplementation.narrowGeneric(kind);\n\t\tconst containerRuntime = this.getRuntime();\n\n\t\t// TODO: There should probably be a higher level more type safe way to do this.\n\t\tconst context = containerRuntime.createDetachedDataStore([kind.type]);\n\t\tconst channel = await kind.instantiateDataStore(context, false);\n\t\tconst dataStore = await context.attachRuntime(kind, channel);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\t// The data store's entry point type is erased at the registry boundary;\n\t\t// the DataStoreKind<T> used to create it guarantees the entry point is a T.\n\t\treturn entryPoint as T;\n\t}\n}\n\n/**\n * All clients connected to the op stream, both read-only and read/write.\n * @remarks\n * Currently just {@link @fluidframework/container-definitions#IAudience}, but may diverge before stabilizing.\n * @privateRemarks\n * This is currently just an alias for IAudience, but it is defined separately to allow for:\n * 1. Following the no I prefix naming convention.\n * 2. The possibility of diverging from IAudience in the future if desired.\n * 3. Make it easy for the reexport from fluid-framework to be `@alpha` so the name is not locked down prematurely.\n * @sealed @alpha\n */\nexport type Audience = IAudience;\n\n/**\n * Gets the {@link Audience} from a Fluid container\n * created by any {@link @fluidframework/driver-definitions#ServiceClient}.\n * @privateRemarks\n * This is exposed via a free function rather than as a property of FluidContainerAttached\n * for a few minor reasons:\n * 1. This allows stabilizing the FluidContainerAttached API independently committing to how we want to expose the audience.\n * 2. This demonstrates the pattern of how we can have possible less stable APIs to expose service specific features without them being part of the core FluidContainer API.\n * This will be important for both new feature stabilization, and also exposing anything needed for legacy interop.\n * @alpha\n */\nexport function getContainerAudience(container: FluidContainerAttached): Audience {\n\tServiceContainerBase.narrow(container);\n\treturn container.audience;\n}\n"]}
@@ -0,0 +1,90 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { ICodeDetailsLoader, IContainerContext, IRuntime } from "@fluidframework/container-definitions/internal";
6
+ import type { FluidObject } from "@fluidframework/core-interfaces";
7
+ import { type DataStoreKey, type DataStoreKind, type DataStoreRegistry, type FluidContainerAttached, type FluidContainerWithService, type Registry, type ServiceClient } from "@fluidframework/driver-definitions/internal";
8
+ import type { IContainerRuntimeBase, IFluidDataStoreRegistry, MinimumVersionForCollab } from "@fluidframework/runtime-definitions/internal";
9
+ /**
10
+ * The constant ID used for the root data store alias in service containers.
11
+ * @internal
12
+ */
13
+ export declare const rootDataStoreId = "root";
14
+ /**
15
+ * Converts a `DataStoreRegistry` to the `IFluidDataStoreRegistry` interface expected by the container runtime.
16
+ * @remarks
17
+ * This does not leverage the ability for `IFluidDataStoreRegistry.get` to return undefined.
18
+ * Note that all use-cases of `IFluidDataStoreRegistry.get` returning undefined currently end up as a fatal error.
19
+ * Therefore it should be fine for the error to instead be thrown by the registry function, which is what this function does.
20
+ * @internal
21
+ */
22
+ export declare function convertRegistry<T>(registry: DataStoreRegistry<T>): IFluidDataStoreRegistry;
23
+ /**
24
+ * Normalizes a `DataStoreKind` or registry function into a registry function.
25
+ * @internal
26
+ */
27
+ export declare function normalizeRegistry<T>(input: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>): Registry<Promise<DataStoreKind<T>>>;
28
+ /**
29
+ * Parameters passed to a {@link ContainerRuntimeLoader}.
30
+ * @internal
31
+ */
32
+ export interface ContainerRuntimeLoaderParams {
33
+ context: IContainerContext;
34
+ registry: IFluidDataStoreRegistry;
35
+ provideEntryPoint: (runtime: IContainerRuntimeBase) => Promise<FluidObject>;
36
+ existing: boolean;
37
+ minVersionForCollab: MinimumVersionForCollab;
38
+ /**
39
+ * The type string of the root data store to create. Only set when `existing` is false.
40
+ */
41
+ newContainerRootType: string | undefined;
42
+ }
43
+ /**
44
+ * A service-specific callback that creates or loads the container runtime.
45
+ *
46
+ * @remarks
47
+ * Receives the runtime parameters assembled by {@link makeCodeLoader} and is responsible for
48
+ * calling the concrete runtime factory (e.g. `ContainerRuntime.loadRuntime2`) and, when
49
+ * `existing` is `false`, initializing the root data store before returning.
50
+ *
51
+ * @internal
52
+ */
53
+ export type ContainerRuntimeLoader = (parameters: ContainerRuntimeLoaderParams) => Promise<IRuntime>;
54
+ /**
55
+ * Creates an `ICodeDetailsLoader` that wires up the container runtime via the supplied
56
+ * `loadRuntime` callback.
57
+ *
58
+ * @remarks
59
+ * The `loadRuntime` callback is responsible for invoking the concrete runtime factory and,
60
+ * when `parameters.existing` is `false` and `parameters.newContainerRootType` is set, creating and
61
+ * aliasing the root data store.
62
+ *
63
+ * This loader never does any code loading, and always assumes it is compatible.
64
+ * TODO: We should reevaluate this before promoting ServiceClient APIs to beta.
65
+ *
66
+ * @internal
67
+ */
68
+ export declare function makeCodeLoader<T>(registry: DataStoreRegistry<T>, minVersionForCollab: MinimumVersionForCollab, loadRuntime: ContainerRuntimeLoader, root?: DataStoreKind<T>): ICodeDetailsLoader;
69
+ /**
70
+ * Minimal interface for the static container factory methods used by {@link ServiceClientImplementation}.
71
+ * @internal
72
+ */
73
+ export interface ServiceContainerStatics<TOptions> {
74
+ createDetached<T>(registry: DataStoreRegistry<T>, options: TOptions, root: DataStoreKind<T>): Promise<FluidContainerWithService<T>>;
75
+ load<T>(registry: DataStoreRegistry<T>, options: TOptions, id: string): Promise<FluidContainerAttached<T>>;
76
+ }
77
+ /**
78
+ * Creates a {@link @fluidframework/driver-definitions#ServiceClient} that delegates container
79
+ * creation and loading to the supplied container class statics.
80
+ * @internal
81
+ */
82
+ export declare class ServiceClientImplementation<TOptions> implements ServiceClient {
83
+ private readonly options;
84
+ private readonly statics;
85
+ constructor(options: TOptions, statics: ServiceContainerStatics<TOptions>);
86
+ createContainer<T>(root: DataStoreKind<T>): Promise<FluidContainerWithService<T>>;
87
+ createContainer<T>(root: DataStoreKey<T>, registry: Registry<Promise<DataStoreKind>>): Promise<FluidContainerWithService<T>>;
88
+ loadContainer<T>(id: string, root: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerAttached<T>>;
89
+ }
90
+ //# sourceMappingURL=serviceClientUtils.d.ts.map