@fluidframework/aqueduct 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.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/dist/aqueduct-alpha.d.ts +365 -0
- package/dist/aqueduct-beta.d.ts +120 -0
- package/dist/aqueduct-public.d.ts +120 -0
- package/dist/aqueduct-untrimmed.d.ts +365 -0
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs +1 -1
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs.map +1 -1
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +2 -2
- package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs +14 -5
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs.map +1 -1
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +2 -2
- package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/dist/data-object-factories/dataObjectFactory.cjs +1 -1
- package/dist/data-object-factories/dataObjectFactory.cjs.map +1 -1
- package/dist/data-object-factories/dataObjectFactory.d.ts +1 -1
- package/dist/data-object-factories/index.cjs.map +1 -1
- package/dist/data-object-factories/index.d.ts +1 -1
- package/dist/data-object-factories/index.d.ts.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.cjs +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.cjs.map +1 -1
- package/dist/data-object-factories/pureDataObjectFactory.d.ts +2 -10
- package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
- package/dist/data-objects/dataObject.cjs +1 -1
- package/dist/data-objects/dataObject.cjs.map +1 -1
- package/dist/data-objects/dataObject.d.ts +1 -1
- package/dist/data-objects/pureDataObject.cjs +1 -8
- package/dist/data-objects/pureDataObject.cjs.map +1 -1
- package/dist/data-objects/pureDataObject.d.ts +3 -7
- package/dist/data-objects/pureDataObject.d.ts.map +1 -1
- package/dist/data-objects/types.cjs.map +1 -1
- package/dist/data-objects/types.d.ts +2 -2
- package/dist/index.cjs +1 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/lib/aqueduct-alpha.d.ts +365 -0
- package/lib/aqueduct-beta.d.ts +120 -0
- package/lib/aqueduct-public.d.ts +120 -0
- package/lib/aqueduct-untrimmed.d.ts +365 -0
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +59 -0
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -0
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs +1 -1
- package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs.map +1 -1
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +45 -0
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs +14 -4
- package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs.map +1 -1
- package/lib/container-runtime-factories/index.d.ts +7 -0
- package/lib/container-runtime-factories/index.d.ts.map +1 -0
- package/lib/data-object-factories/dataObjectFactory.d.ts +23 -0
- package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -0
- package/lib/data-object-factories/dataObjectFactory.mjs +1 -1
- package/lib/data-object-factories/dataObjectFactory.mjs.map +1 -1
- package/lib/data-object-factories/index.d.ts +7 -0
- package/lib/data-object-factories/index.d.ts.map +1 -0
- package/lib/data-object-factories/index.mjs.map +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.d.ts +91 -0
- package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -0
- package/lib/data-object-factories/pureDataObjectFactory.mjs +1 -1
- package/lib/data-object-factories/pureDataObjectFactory.mjs.map +1 -1
- package/lib/data-objects/dataObject.d.ts +38 -0
- package/lib/data-objects/dataObject.d.ts.map +1 -0
- package/lib/data-objects/dataObject.mjs +1 -1
- package/lib/data-objects/dataObject.mjs.map +1 -1
- package/lib/data-objects/index.d.ts +8 -0
- package/lib/data-objects/index.d.ts.map +1 -0
- package/lib/data-objects/pureDataObject.d.ts +94 -0
- package/lib/data-objects/pureDataObject.d.ts.map +1 -0
- package/lib/data-objects/pureDataObject.mjs +1 -8
- package/lib/data-objects/pureDataObject.mjs.map +1 -1
- package/lib/data-objects/types.d.ts +36 -0
- package/lib/data-objects/types.d.ts.map +1 -0
- package/lib/data-objects/types.mjs.map +1 -1
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.mjs +1 -3
- package/lib/index.mjs.map +1 -1
- package/package.json +79 -34
- package/dist/request-handlers/index.cjs +0 -12
- package/dist/request-handlers/index.cjs.map +0 -1
- package/dist/request-handlers/index.d.ts +0 -6
- package/dist/request-handlers/index.d.ts.map +0 -1
- package/dist/request-handlers/requestHandlers.cjs +0 -93
- package/dist/request-handlers/requestHandlers.cjs.map +0 -1
- package/dist/request-handlers/requestHandlers.d.ts +0 -46
- package/dist/request-handlers/requestHandlers.d.ts.map +0 -1
- package/dist/utils/containerInteractions.cjs +0 -76
- package/dist/utils/containerInteractions.cjs.map +0 -1
- package/dist/utils/containerInteractions.d.ts +0 -42
- package/dist/utils/containerInteractions.d.ts.map +0 -1
- package/dist/utils/index.cjs +0 -12
- package/dist/utils/index.cjs.map +0 -1
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/index.d.ts.map +0 -1
- package/lib/request-handlers/index.mjs +0 -6
- package/lib/request-handlers/index.mjs.map +0 -1
- package/lib/request-handlers/requestHandlers.mjs +0 -86
- package/lib/request-handlers/requestHandlers.mjs.map +0 -1
- package/lib/utils/containerInteractions.mjs +0 -70
- package/lib/utils/containerInteractions.mjs.map +0 -1
- package/lib/utils/index.mjs +0 -6
- package/lib/utils/index.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlers.mjs","sourceRoot":"","sources":["../../src/request-handlers/requestHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAMI,EAAyB,0BAA0B,EAAE,MAAM,iCAAiC;OAC5F,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,kBAA4C,EAC5C,QAAiC,EAChC,EAAE;IACH,gDAAgD;IAChD,MAAM,aAAa,GAAG,0BAA0B,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC9D,OAAO,KAAK,EAAE,OAAsB,EAAE,OAA0B,EAAE,EAAE;QACnE,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;QAC9D,IAAI,UAAU,GAAa,OAAO,CAAC;QACnC,IAAI,aAAa,EAAE;YAClB,wDAAwD;YACxD,mDAAmD;YACnD,MAAM,OAAO,GAAmB,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YACvD,OAAQ,OAAe,CAAC,aAAa,CAAC;YACtC,UAAU,GAAG;gBACZ,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,OAAO;aACP,CAAC;SACF;QACD,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE1D,IACC,aAAa;YACb,QAAQ,CAAC,MAAM,KAAK,GAAG;YACvB,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC1C;YACD,OAAO;gBACN,MAAM,EAAE,GAAG;gBACX,QAAQ,EAAE,cAAc;gBACxB,KAAK,EAAE,IAAI,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;aAC7C,CAAC;SACF;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,aAAqB,EAAE,EAAE;IACnE,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;QAC9D,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,OAAO,CAAC,mBAAmB,CAAC,aAAa,CAAC;gBAChD,GAAG,EAAE,IAAI,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE;gBACvC,OAAO,EAAE,OAAO,CAAC,OAAO;aACxB,CAAC,CAAC;SACH;QACD,OAAO,SAAS,CAAC,CAAC,kBAAkB;IACrC,CAAC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gCAAgC,CAC/C,WAAwB,EACxB,OAAiB;IAEjB,OAAO,OAAO,CAAC,GAAG,KAAK,EAAE,IAAI,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC;QAC/E,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAC/D,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { FluidObject, IRequest, IRequestHeader, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport type { IFluidMountableViewClass } from \"@fluidframework/view-interfaces\";\n// eslint-disable-next-line import/no-deprecated\nimport { RuntimeRequestHandler, buildRuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { RequestParser, create404Response } from \"@fluidframework/runtime-utils\";\n\n/**\n * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across\n * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within\n * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will\n * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable\n * view isn't necessary.\n *\n * When a request is received with a mountableView: true header, this request handler will reissue the request\n * without the header, and respond with a mountable view of the given class using the response.\n * @param MountableViewClass - The type of mountable view to use when responding\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @public\n */\nexport const mountableViewRequestHandler = (\n\tMountableViewClass: IFluidMountableViewClass,\n\thandlers: RuntimeRequestHandler[],\n) => {\n\t// eslint-disable-next-line import/no-deprecated\n\tconst nestedHandler = buildRuntimeRequestHandler(...handlers);\n\treturn async (request: RequestParser, runtime: IContainerRuntime) => {\n\t\tconst mountableView = request.headers?.mountableView === true;\n\t\tlet newRequest: IRequest = request;\n\t\tif (mountableView) {\n\t\t\t// Reissue the request without the mountableView header.\n\t\t\t// We'll repack whatever the response is if we can.\n\t\t\tconst headers: IRequestHeader = { ...request.headers };\n\t\t\tdelete (headers as any).mountableView;\n\t\t\tnewRequest = {\n\t\t\t\turl: request.url,\n\t\t\t\theaders,\n\t\t\t};\n\t\t}\n\t\tconst response = await nestedHandler(newRequest, runtime);\n\n\t\tif (\n\t\t\tmountableView &&\n\t\t\tresponse.status === 200 &&\n\t\t\tMountableViewClass.canMount(response.value)\n\t\t) {\n\t\t\treturn {\n\t\t\t\tstatus: 200,\n\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\tvalue: new MountableViewClass(response.value),\n\t\t\t};\n\t\t}\n\t\treturn response;\n\t};\n};\n\n/**\n * Pipe through container request into internal request.\n * If request is empty and default url is provided, redirect request to such default url.\n * @param defaultRootId - optional default root data store ID to pass request in case request is empty.\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @public\n */\nexport const defaultRouteRequestHandler = (defaultRootId: string) => {\n\treturn async (request: IRequest, runtime: IContainerRuntime) => {\n\t\tconst parser = RequestParser.create(request);\n\t\tif (parser.pathParts.length === 0) {\n\t\t\treturn runtime.IFluidHandleContext.resolveHandle({\n\t\t\t\turl: `/${defaultRootId}${parser.query}`,\n\t\t\t\theaders: request.headers,\n\t\t\t});\n\t\t}\n\t\treturn undefined; // continue search\n\t};\n};\n\n/**\n * Default request handler for a Fluid object that returns the object itself if:\n *\n * 1. the request url is empty\n *\n * 2. the request url is \"/\"\n *\n * 3. the request url starts with \"/\" and is followed by a query param, such as /?key=value\n *\n * Returns a 404 error for any other url.\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * @public\n */\nexport function defaultFluidObjectRequestHandler(\n\tfluidObject: FluidObject,\n\trequest: IRequest,\n): IResponse {\n\treturn request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t? { mimeType: \"fluid/object\", status: 200, value: fluidObject }\n\t\t: create404Response(request);\n}\n"]}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
3
|
-
* Helper function for getting the default Fluid Object from a Container. This function only works for
|
|
4
|
-
* Containers that support "/" request.
|
|
5
|
-
*
|
|
6
|
-
* @typeParam T - Defines the type you expect to be returned.
|
|
7
|
-
*
|
|
8
|
-
* @param container - Container you're attempting to get the object from
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export async function getDefaultObjectFromContainer(container) {
|
|
12
|
-
const url = "/";
|
|
13
|
-
const response = await container.request({ url });
|
|
14
|
-
// Verify the response
|
|
15
|
-
if (response.status !== 200 || response.mimeType !== "fluid/object") {
|
|
16
|
-
throw new Error(`Unable to retrieve Fluid object at URL: "${url}"`);
|
|
17
|
-
}
|
|
18
|
-
else if (response.value === undefined) {
|
|
19
|
-
throw new Error(`Empty response from URL: "${url}"`);
|
|
20
|
-
}
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
22
|
-
return response.value;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
26
|
-
* Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for
|
|
27
|
-
* Containers that support getting FluidObjects via request.
|
|
28
|
-
*
|
|
29
|
-
* @typeParam T - Defines the type you expect to be returned.
|
|
30
|
-
*
|
|
31
|
-
* @param id - Unique id of the FluidObject
|
|
32
|
-
* @param container - Container you're attempting to get the object from
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export async function getObjectWithIdFromContainer(id, container) {
|
|
36
|
-
const url = `/${id}`;
|
|
37
|
-
const response = await container.request({ url });
|
|
38
|
-
// Verify the response
|
|
39
|
-
if (response.status !== 200 || response.mimeType !== "fluid/object") {
|
|
40
|
-
throw new Error(`Unable to retrieve Fluid object with ID: "${id}" from URL: "${url}"`);
|
|
41
|
-
}
|
|
42
|
-
else if (response.value === undefined) {
|
|
43
|
-
throw new Error(`Empty response for ID: "${id}" from URL: "${url}"`);
|
|
44
|
-
}
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
46
|
-
return response.value;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
50
|
-
* Helper function for getting a Fluid Object from a Container given a path/url. This function only works for
|
|
51
|
-
* Containers that support getting FluidObjects via request.
|
|
52
|
-
*
|
|
53
|
-
* @typeParam T - Defines the type you expect to be returned.
|
|
54
|
-
*
|
|
55
|
-
* @param path - Unique path/url of the FluidObject
|
|
56
|
-
* @param container - Container you're attempting to get the object from
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
export async function getObjectFromContainer(path, container) {
|
|
60
|
-
const response = await container.request({ url: path });
|
|
61
|
-
if (response.status !== 200 || response.mimeType !== "fluid/object") {
|
|
62
|
-
throw new Error(`Unable to retrieve Fluid object with from URL: "${path}"`);
|
|
63
|
-
}
|
|
64
|
-
else if (response.value === undefined) {
|
|
65
|
-
throw new Error(`Empty response for from URL: "${path}"`);
|
|
66
|
-
}
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
68
|
-
return response.value;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=containerInteractions.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"containerInteractions.mjs","sourceRoot":"","sources":["../../src/utils/containerInteractions.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAClD,SAAqB;IAErB,MAAM,GAAG,GAAG,GAAG,CAAC;IAChB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAElD,sBAAsB;IACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,GAAG,CAAC,CAAC;KACpE;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,GAAG,CAAC,CAAC;KACrD;IAED,+DAA+D;IAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;AACvB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CACjD,EAAU,EACV,SAAqB;IAErB,MAAM,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAElD,sBAAsB;IACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,6CAA6C,EAAE,gBAAgB,GAAG,GAAG,CAAC,CAAC;KACvF;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,2BAA2B,EAAE,gBAAgB,GAAG,GAAG,CAAC,CAAC;KACrE;IAED,+DAA+D;IAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;AACvB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,IAAY,EACZ,SAAqB;IAErB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;QACpE,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,GAAG,CAAC,CAAC;KAC5E;SAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;KAC1D;IAED,+DAA+D;IAC/D,OAAO,QAAQ,CAAC,KAAK,CAAC;AACvB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { IContainer } from \"@fluidframework/container-definitions\";\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting the default Fluid Object from a Container. This function only works for\n * Containers that support \"/\" request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param container - Container you're attempting to get the object from\n * @public\n */\nexport async function getDefaultObjectFromContainer<T = FluidObject>(\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst url = \"/\";\n\tconst response = await container.request({ url });\n\n\t// Verify the response\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object at URL: \"${url}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response from URL: \"${url}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for\n * Containers that support getting FluidObjects via request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param id - Unique id of the FluidObject\n * @param container - Container you're attempting to get the object from\n * @public\n */\nexport async function getObjectWithIdFromContainer<T = FluidObject>(\n\tid: string,\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst url = `/${id}`;\n\tconst response = await container.request({ url });\n\n\t// Verify the response\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object with ID: \"${id}\" from URL: \"${url}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response for ID: \"${id}\" from URL: \"${url}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n\n/**\n * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n * Helper function for getting a Fluid Object from a Container given a path/url. This function only works for\n * Containers that support getting FluidObjects via request.\n *\n * @typeParam T - Defines the type you expect to be returned.\n *\n * @param path - Unique path/url of the FluidObject\n * @param container - Container you're attempting to get the object from\n * @public\n */\nexport async function getObjectFromContainer<T = FluidObject>(\n\tpath: string,\n\tcontainer: IContainer,\n): Promise<T> {\n\tconst response = await container.request({ url: path });\n\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow new Error(`Unable to retrieve Fluid object with from URL: \"${path}\"`);\n\t} else if (response.value === undefined) {\n\t\tthrow new Error(`Empty response for from URL: \"${path}\"`);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn response.value;\n}\n"]}
|
package/lib/utils/index.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { getDefaultObjectFromContainer, getObjectFromContainer, getObjectWithIdFromContainer, } from "./containerInteractions.mjs";
|
|
6
|
-
//# sourceMappingURL=index.mjs.map
|
package/lib/utils/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,GAC5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tgetDefaultObjectFromContainer,\n\tgetObjectFromContainer,\n\tgetObjectWithIdFromContainer,\n} from \"./containerInteractions\";\n"]}
|