@fluidframework/runtime-utils 2.114.0 → 2.115.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/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serviceClientUtils.d.ts +2 -2
- package/dist/serviceClientUtils.d.ts.map +1 -1
- package/dist/serviceClientUtils.js +6 -0
- package/dist/serviceClientUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serviceClientUtils.d.ts +2 -2
- package/lib/serviceClientUtils.d.ts.map +1 -1
- package/lib/serviceClientUtils.js +6 -0
- package/lib/serviceClientUtils.js.map +1 -1
- package/package.json +12 -12
- package/src/packageVersion.ts +1 -1
- package/src/serviceClientUtils.ts +10 -7
package/CHANGELOG.md
CHANGED
package/dist/packageVersion.d.ts
CHANGED
|
@@ -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.
|
|
8
|
+
export declare const pkgVersion = "2.115.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/runtime-utils";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.115.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,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.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,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.115.0\";\n"]}
|
|
@@ -83,8 +83,8 @@ export declare class ServiceClientImplementation<TOptions> implements ServiceCli
|
|
|
83
83
|
private readonly options;
|
|
84
84
|
private readonly statics;
|
|
85
85
|
constructor(options: TOptions, statics: ServiceContainerStatics<TOptions>);
|
|
86
|
-
createContainer<T>(root: DataStoreKind<T
|
|
87
|
-
|
|
86
|
+
createContainer<T>(root: DataStoreKey<T> | DataStoreKind<T>, registry?: Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerWithService<T>>;
|
|
87
|
+
createAttachedContainer<T>(root: DataStoreKey<T> | DataStoreKind<T>, registry?: Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerAttached<T>>;
|
|
88
88
|
loadContainer<T>(id: string, root: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerAttached<T>>;
|
|
89
89
|
}
|
|
90
90
|
//# sourceMappingURL=serviceClientUtils.d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,CAAC,CAAC,CAAC;IAKxB,aAAa,CAAC,CAAC,EAC3B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAGrC"}
|
|
@@ -110,6 +110,8 @@ class ServiceClientImplementation {
|
|
|
110
110
|
this.options = options;
|
|
111
111
|
this.statics = statics;
|
|
112
112
|
}
|
|
113
|
+
// This implements the ServiceClient interface's safer version of this with overloads.
|
|
114
|
+
// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.
|
|
113
115
|
async createContainer(root, registry) {
|
|
114
116
|
if (registry === undefined) {
|
|
115
117
|
serviceClientBase_js_1.DataStoreKindImplementation.narrowGeneric(root);
|
|
@@ -120,6 +122,10 @@ class ServiceClientImplementation {
|
|
|
120
122
|
return this.statics.createDetached(registry, this.options, result);
|
|
121
123
|
}
|
|
122
124
|
}
|
|
125
|
+
async createAttachedContainer(root, registry) {
|
|
126
|
+
const container = await this.createContainer(root, registry);
|
|
127
|
+
return container.attach();
|
|
128
|
+
}
|
|
123
129
|
async loadContainer(id, root) {
|
|
124
130
|
return this.statics.load(normalizeRegistry(root), this.options, id);
|
|
125
131
|
}
|
|
@@ -1 +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,iCAAs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AAC,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"]}
|
|
1
|
+
{"version":3,"file":"serviceClientUtils.js","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,kEAA6D;AAC7D,0EAUqD;AAQrD,iEAAqE;AAErE;;;GAGG;AAC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,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,uBAAuB,CACnC,IAAwC,EACxC,QAA8C;QAE9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC;IAC3B,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;AAnCD,kEAmCC","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\t// This implements the ServiceClient interface's safer version of this with overloads.\n\t// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.\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 createAttachedContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\tconst container = await this.createContainer(root, registry);\n\t\treturn container.attach();\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/packageVersion.d.ts
CHANGED
|
@@ -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.
|
|
8
|
+
export declare const pkgVersion = "2.115.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -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,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.
|
|
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.115.0\";\n"]}
|
|
@@ -83,8 +83,8 @@ export declare class ServiceClientImplementation<TOptions> implements ServiceCli
|
|
|
83
83
|
private readonly options;
|
|
84
84
|
private readonly statics;
|
|
85
85
|
constructor(options: TOptions, statics: ServiceContainerStatics<TOptions>);
|
|
86
|
-
createContainer<T>(root: DataStoreKind<T
|
|
87
|
-
|
|
86
|
+
createContainer<T>(root: DataStoreKey<T> | DataStoreKind<T>, registry?: Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerWithService<T>>;
|
|
87
|
+
createAttachedContainer<T>(root: DataStoreKey<T> | DataStoreKind<T>, registry?: Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerAttached<T>>;
|
|
88
88
|
loadContainer<T>(id: string, root: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>): Promise<FluidContainerAttached<T>>;
|
|
89
89
|
}
|
|
90
90
|
//# sourceMappingURL=serviceClientUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceClientUtils.d.ts","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,iBAAiB,EAIjB,QAAQ,EAER,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,QAAQ,EAEb,KAAK,aAAa,EAClB,MAAM,6CAA6C,C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AAC,EAC9B,OAAO,EAAE,QAAQ,EACjB,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,qBAAa,2BAA2B,CAAC,QAAQ,CAAE,YAAW,aAAa;IAEzE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE,uBAAuB,CAAC,QAAQ,CAAC;IAK/C,eAAe,CAAC,CAAC,EAC7B,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EACxC,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAU3B,uBAAuB,CAAC,CAAC,EACrC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EACxC,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAKxB,aAAa,CAAC,CAAC,EAC3B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1D,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAGrC"}
|
|
@@ -104,6 +104,8 @@ export class ServiceClientImplementation {
|
|
|
104
104
|
this.options = options;
|
|
105
105
|
this.statics = statics;
|
|
106
106
|
}
|
|
107
|
+
// This implements the ServiceClient interface's safer version of this with overloads.
|
|
108
|
+
// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.
|
|
107
109
|
async createContainer(root, registry) {
|
|
108
110
|
if (registry === undefined) {
|
|
109
111
|
DataStoreKindImplementation.narrowGeneric(root);
|
|
@@ -114,6 +116,10 @@ export class ServiceClientImplementation {
|
|
|
114
116
|
return this.statics.createDetached(registry, this.options, result);
|
|
115
117
|
}
|
|
116
118
|
}
|
|
119
|
+
async createAttachedContainer(root, registry) {
|
|
120
|
+
const container = await this.createContainer(root, registry);
|
|
121
|
+
return container.attach();
|
|
122
|
+
}
|
|
117
123
|
async loadContainer(id, root) {
|
|
118
124
|
return this.statics.load(normalizeRegistry(root), this.options, id);
|
|
119
125
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceClientUtils.js","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EAOtB,gBAAgB,GAEhB,MAAM,6CAA6C,CAAC;AAQrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAI,QAA8B;IAChE,OAAO;QACN,KAAK,CAAC,GAAG,CAAC,IAAY;YACrB,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;YACrF,2BAA2B,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;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAChC,KAA6D;IAE7D,IAAI,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,KA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OAA0B,EAAoC,EAAE;YAC5E,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC;QAC7C,CAAC;KACD,CAAC;AACH,CAAC;AAoBD;;;;GAIG;AACH,MAAM,OAAO,2BAA2B;IACvC,YACkB,OAAiB,EACjB,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,2BAA2B,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,gBAAgB,CAAC,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","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"]}
|
|
1
|
+
{"version":3,"file":"serviceClientUtils.js","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EAOtB,gBAAgB,GAEhB,MAAM,6CAA6C,CAAC;AAQrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAI,QAA8B;IAChE,OAAO;QACN,KAAK,CAAC,GAAG,CAAC,IAAY;YACrB,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;YACrF,2BAA2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,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC;IAC3B,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","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\t// This implements the ServiceClient interface's safer version of this with overloads.\n\t// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.\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 createAttachedContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\tconst container = await this.createContainer(root, registry);\n\t\treturn container.attach();\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/runtime-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.115.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid Runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -79,22 +79,22 @@
|
|
|
79
79
|
"temp-directory": "nyc/.nyc_output"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@fluid-internal/client-utils": "~2.
|
|
83
|
-
"@fluidframework/container-definitions": "~2.
|
|
84
|
-
"@fluidframework/container-runtime-definitions": "~2.
|
|
85
|
-
"@fluidframework/core-interfaces": "~2.
|
|
86
|
-
"@fluidframework/core-utils": "~2.
|
|
87
|
-
"@fluidframework/datastore-definitions": "~2.
|
|
88
|
-
"@fluidframework/driver-definitions": "~2.
|
|
89
|
-
"@fluidframework/driver-utils": "~2.
|
|
90
|
-
"@fluidframework/runtime-definitions": "~2.
|
|
91
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
82
|
+
"@fluid-internal/client-utils": "~2.115.0",
|
|
83
|
+
"@fluidframework/container-definitions": "~2.115.0",
|
|
84
|
+
"@fluidframework/container-runtime-definitions": "~2.115.0",
|
|
85
|
+
"@fluidframework/core-interfaces": "~2.115.0",
|
|
86
|
+
"@fluidframework/core-utils": "~2.115.0",
|
|
87
|
+
"@fluidframework/datastore-definitions": "~2.115.0",
|
|
88
|
+
"@fluidframework/driver-definitions": "~2.115.0",
|
|
89
|
+
"@fluidframework/driver-utils": "~2.115.0",
|
|
90
|
+
"@fluidframework/runtime-definitions": "~2.115.0",
|
|
91
|
+
"@fluidframework/telemetry-utils": "~2.115.0",
|
|
92
92
|
"semver-ts": "^1.0.3"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
96
96
|
"@biomejs/biome": "~2.4.5",
|
|
97
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
97
|
+
"@fluid-internal/mocha-test-setup": "~2.115.0",
|
|
98
98
|
"@fluid-tools/build-cli": "^0.65.0",
|
|
99
99
|
"@fluidframework/build-common": "^2.0.3",
|
|
100
100
|
"@fluidframework/build-tools": "^0.65.0",
|
package/src/packageVersion.ts
CHANGED
|
@@ -207,13 +207,8 @@ export class ServiceClientImplementation<TOptions> implements ServiceClient {
|
|
|
207
207
|
private readonly statics: ServiceContainerStatics<TOptions>,
|
|
208
208
|
) {}
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
public createContainer<T>(
|
|
213
|
-
root: DataStoreKey<T>,
|
|
214
|
-
registry: Registry<Promise<DataStoreKind>>,
|
|
215
|
-
): Promise<FluidContainerWithService<T>>;
|
|
216
|
-
|
|
210
|
+
// This implements the ServiceClient interface's safer version of this with overloads.
|
|
211
|
+
// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.
|
|
217
212
|
public async createContainer<T>(
|
|
218
213
|
root: DataStoreKey<T> | DataStoreKind<T>,
|
|
219
214
|
registry?: Registry<Promise<DataStoreKind<T>>>,
|
|
@@ -227,6 +222,14 @@ export class ServiceClientImplementation<TOptions> implements ServiceClient {
|
|
|
227
222
|
}
|
|
228
223
|
}
|
|
229
224
|
|
|
225
|
+
public async createAttachedContainer<T>(
|
|
226
|
+
root: DataStoreKey<T> | DataStoreKind<T>,
|
|
227
|
+
registry?: Registry<Promise<DataStoreKind<T>>>,
|
|
228
|
+
): Promise<FluidContainerAttached<T>> {
|
|
229
|
+
const container = await this.createContainer(root, registry);
|
|
230
|
+
return container.attach();
|
|
231
|
+
}
|
|
232
|
+
|
|
230
233
|
public async loadContainer<T>(
|
|
231
234
|
id: string,
|
|
232
235
|
root: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,
|