@fluidframework/container-loader 2.73.0 → 2.74.0-365691
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/container.d.ts.map +1 -1
- package/dist/container.js +1 -0
- package/dist/container.js.map +1 -1
- package/dist/loadPaused.d.ts.map +1 -1
- package/dist/loadPaused.js +1 -0
- package/dist/loadPaused.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +1 -0
- package/lib/container.js.map +1 -1
- package/lib/loadPaused.d.ts.map +1 -1
- package/lib/loadPaused.js +1 -0
- package/lib/loadPaused.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +13 -13
- package/src/container.ts +1 -0
- package/src/loadPaused.ts +1 -0
- package/src/packageVersion.ts +1 -1
package/lib/loadPaused.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadPaused.d.ts","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,KAAK,UAAU,EACf,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,iCAAiC,CAAC;AAK5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,mBAAmB,CACxC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,QAAQ,EACjB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"loadPaused.d.ts","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,KAAK,UAAU,EACf,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,iCAAiC,CAAC;AAK5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,mBAAmB,CACxC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,QAAQ,EACjB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,UAAU,CAAC,CAyGrB"}
|
package/lib/loadPaused.js
CHANGED
|
@@ -75,6 +75,7 @@ export async function loadContainerPaused(loaderProps, request, loadToSequenceNu
|
|
|
75
75
|
let onClose;
|
|
76
76
|
const promise = new Promise((resolve, reject) => {
|
|
77
77
|
onAbort = () => reject(new GenericError("Canceled due to cancellation request."));
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
78
79
|
onClose = (error) => reject(error);
|
|
79
80
|
// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).
|
|
80
81
|
opHandler = () => {
|
package/lib/loadPaused.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadPaused.js","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,YAAY,GAEZ,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,C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,EAAE,SAAS,CAAC,CAAC;QAC/B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEJ,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,2CAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tisIDeltaManagerFull,\n\tLoaderHeader,\n\ttype IContainer,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { IRequest, IErrorBase } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { GenericError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { loadExistingContainer } from \"./createAndLoadContainerUtils.js\";\nimport type { ILoaderProps } from \"./loader.js\";\n\n/* eslint-disable jsdoc/check-indentation */\n\n/**\n * Loads container and leaves it in a state where it does not process any ops.\n * Container instance returned by this function is in special mode where some functionality that is available in normal use will not work correctly\n * with instance of container returned by this function. Some examples:\n * 1. calling IContainer.connect() will have very little impact on this container as it will not process ops.\n * 2. functionality like waitContainerToCatchUp() or waiting for ops in any other way would hand infinitely, as this container is not processing ops\n * 3. No changes can be made to this container - they will be lost.\n *\n * If sequence number is provided, loads up to this sequence number and stops there, otherwise stops immediately after loading snapshot.\n * In all cases, container is returned disconnected & paused, or an exception is thrown\n * Notes:\n * 1. Ignores LoaderHeader.loadMode headers. Container is always returned with ops applied upt to provided sequence number,\n * or no ops applied at all (if sequence number is not provided)\n * 2. This call can hang infinitately if disconnected from internet (or hit some other conditions, like 429 storm).\n * Compare to Container.load() experience (with default settings) - it either returns failure right away, or succeeds, with\n * ops fetching / delta connection happening in parallel / after container load flow, and thus providing an object (Container instance) to observe\n * network connectivity issues / ability to cancel (IContainer.disconnect) or close container (IContainer.close)\n * This flow needs to fetch ops (potentially connecting to delta connection), and any retriable errors on this path result in infinite retry.\n * If you need to cancel that process, consider supplying AbortSignal parameter.\n * @param loaderProps - The loader props to use to load the container.\n * @param request - request identifying container instance / load parameters. LoaderHeader.loadMode headers are ignored (see above)\n * @param loadToSequenceNumber - optional sequence number. If provided, ops are processed up to this sequence number.\n * @param signal - optional abort signal that can be used to cancel waiting for the ops.\n * @returns IContainer instance\n *\n * @internal\n */\nexport async function loadContainerPaused(\n\tloaderProps: ILoaderProps,\n\trequest: IRequest,\n\tloadToSequenceNumber?: number,\n\tsignal?: AbortSignal,\n): Promise<IContainer> {\n\tconst container = await loadExistingContainer({\n\t\t...loaderProps,\n\t\trequest: {\n\t\t\turl: request.url,\n\t\t\theaders: {\n\t\t\t\t...request.headers,\n\t\t\t\t// ensure we do not process any ops, such that we can examine container before ops starts to flow.\n\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: undefined, deltaConnection: \"none\" },\n\t\t\t},\n\t\t},\n\t});\n\n\t// Force readonly mode - this will ensure we don't receive an error for the lack of join op\n\tcontainer.forceReadonly?.(true);\n\n\tconst dm = container.deltaManager;\n\tconst lastProcessedSequenceNumber = dm.initialSequenceNumber;\n\n\tconst pauseContainer = (): void => {\n\t\tassert(\n\t\t\tisIDeltaManagerFull(dm),\n\t\t\t0xa7f /* Delta manager does not have inbound/outbound queues. */,\n\t\t);\n\t\t// eslint-disable-next-line no-void\n\t\tvoid dm.inbound.pause();\n\t\t// eslint-disable-next-line no-void\n\t\tvoid dm.outbound.pause();\n\t};\n\n\t// Happy path - we are already there.\n\tif (\n\t\tloadToSequenceNumber === undefined ||\n\t\tlastProcessedSequenceNumber === loadToSequenceNumber\n\t) {\n\t\t// If we have already reached the desired sequence number, call pauseContainer() to pause immediately.\n\t\tpauseContainer();\n\t\treturn container;\n\t}\n\n\t// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.\n\tif (lastProcessedSequenceNumber > loadToSequenceNumber) {\n\t\tconst error = new GenericError(\n\t\t\t\"Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.\",\n\t\t);\n\t\tcontainer.close(error);\n\t\tthrow error;\n\t}\n\n\tlet opHandler: () => void;\n\tlet onAbort: () => void;\n\tlet onClose: (error?: IErrorBase) => void;\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tonAbort = (): void => reject(new GenericError(\"Canceled due to cancellation request.\"));\n\t\tonClose = (error?: IErrorBase): void => reject(error);\n\n\t\t// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).\n\t\topHandler = (): void => {\n\t\t\t// If there is a specified sequence number, keep processing until we reach it.\n\t\t\tif (\n\t\t\t\tloadToSequenceNumber !== undefined &&\n\t\t\t\tdm.lastSequenceNumber >= loadToSequenceNumber\n\t\t\t) {\n\t\t\t\t// Pause op processing once we have processed the desired number of ops.\n\t\t\t\tpauseContainer();\n\t\t\t\tresolve();\n\t\t\t}\n\t\t};\n\n\t\t// If we have not yet reached the desired sequence number, setup a listener to pause once we reach it.\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t\tcontainer.on(\"op\", opHandler);\n\t\tcontainer.on(\"closed\", onClose);\n\t});\n\n\t// There are no guarantees on when ops will land in storage.\n\t// No guarantees that driver implements ops caching (i.e. ops observed in previous session can be served from cache)\n\t// or that browser will provide caching capabilities / keep the data (localStorage).\n\t// Thus, we have to ensure we connect to delta storage in order to make forward progress with ops.\n\t// We also instructed not to fetch / apply any ops from storage above (to be able to install callback above before ops are processed),\n\t// connect() call will fetch ops as needed.\n\tcontainer.connect();\n\n\t// Wait for the ops to be processed.\n\tawait promise\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t.catch((error: any) => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tcontainer.close(error);\n\t\t\tthrow error;\n\t\t})\n\t\t.finally(() => {\n\t\t\t// There is not much value in leaving delta connection on. We are not processing ops, we also can't advance to \"connected\" state because of it.\n\t\t\t// We are not sending ops (due to forceReadonly() call above). We are holding collab window and any consensus-based processes.\n\t\t\t// It's better not to have connection in such case, as there are only nagatives, and no positives.\n\t\t\tcontainer.disconnect();\n\n\t\t\tcontainer.off(\"op\", opHandler);\n\t\t\tcontainer.off(\"closed\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t});\n\n\treturn container;\n}\n\n/* eslint-enable jsdoc/check-indentation */\n"]}
|
|
1
|
+
{"version":3,"file":"loadPaused.js","sourceRoot":"","sources":["../src/loadPaused.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,YAAY,GAEZ,MAAM,gDAAgD,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,WAAyB,EACzB,OAAiB,EACjB,oBAA6B,EAC7B,MAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,qBAAqB,CAAC;QAC7C,GAAG,WAAW;QACd,OAAO,EAAE;YACR,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,OAAO,EAAE;gBACR,GAAG,OAAO,CAAC,OAAO;gBAClB,kGAAkG;gBAClG,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE;aAChF;SACD;KACD,CAAC,CAAC;IAEH,2FAA2F;IAC3F,SAAS,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,CAAC;IAEhC,MAAM,EAAE,GAAG,SAAS,CAAC,YAAY,CAAC;IAClC,MAAM,2BAA2B,GAAG,EAAE,CAAC,qBAAqB,CAAC;IAE7D,MAAM,cAAc,GAAG,GAAS,EAA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gB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9B,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,oHAAoH;IACpH,oFAAoF;IACpF,kGAAkG;IAClG,sIAAsI;IACtI,2CAA2C;IAC3C,SAAS,CAAC,OAAO,EAAE,CAAC;IAEpB,oCAAoC;IACpC,MAAM,OAAO;QACZ,8DAA8D;SAC7D,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;QACrB,iEAAiE;QACjE,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,MAAM,KAAK,CAAC;IACb,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACb,+IAA+I;QAC/I,8HAA8H;QAC9H,kGAAkG;QAClG,SAAS,CAAC,UAAU,EAAE,CAAC;QAEvB,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/B,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACjC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEJ,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,2CAA2C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tisIDeltaManagerFull,\n\tLoaderHeader,\n\ttype IContainer,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { IRequest, IErrorBase } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { GenericError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { loadExistingContainer } from \"./createAndLoadContainerUtils.js\";\nimport type { ILoaderProps } from \"./loader.js\";\n\n/* eslint-disable jsdoc/check-indentation */\n\n/**\n * Loads container and leaves it in a state where it does not process any ops.\n * Container instance returned by this function is in special mode where some functionality that is available in normal use will not work correctly\n * with instance of container returned by this function. Some examples:\n * 1. calling IContainer.connect() will have very little impact on this container as it will not process ops.\n * 2. functionality like waitContainerToCatchUp() or waiting for ops in any other way would hand infinitely, as this container is not processing ops\n * 3. No changes can be made to this container - they will be lost.\n *\n * If sequence number is provided, loads up to this sequence number and stops there, otherwise stops immediately after loading snapshot.\n * In all cases, container is returned disconnected & paused, or an exception is thrown\n * Notes:\n * 1. Ignores LoaderHeader.loadMode headers. Container is always returned with ops applied upt to provided sequence number,\n * or no ops applied at all (if sequence number is not provided)\n * 2. This call can hang infinitately if disconnected from internet (or hit some other conditions, like 429 storm).\n * Compare to Container.load() experience (with default settings) - it either returns failure right away, or succeeds, with\n * ops fetching / delta connection happening in parallel / after container load flow, and thus providing an object (Container instance) to observe\n * network connectivity issues / ability to cancel (IContainer.disconnect) or close container (IContainer.close)\n * This flow needs to fetch ops (potentially connecting to delta connection), and any retriable errors on this path result in infinite retry.\n * If you need to cancel that process, consider supplying AbortSignal parameter.\n * @param loaderProps - The loader props to use to load the container.\n * @param request - request identifying container instance / load parameters. LoaderHeader.loadMode headers are ignored (see above)\n * @param loadToSequenceNumber - optional sequence number. If provided, ops are processed up to this sequence number.\n * @param signal - optional abort signal that can be used to cancel waiting for the ops.\n * @returns IContainer instance\n *\n * @internal\n */\nexport async function loadContainerPaused(\n\tloaderProps: ILoaderProps,\n\trequest: IRequest,\n\tloadToSequenceNumber?: number,\n\tsignal?: AbortSignal,\n): Promise<IContainer> {\n\tconst container = await loadExistingContainer({\n\t\t...loaderProps,\n\t\trequest: {\n\t\t\turl: request.url,\n\t\t\theaders: {\n\t\t\t\t...request.headers,\n\t\t\t\t// ensure we do not process any ops, such that we can examine container before ops starts to flow.\n\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: undefined, deltaConnection: \"none\" },\n\t\t\t},\n\t\t},\n\t});\n\n\t// Force readonly mode - this will ensure we don't receive an error for the lack of join op\n\tcontainer.forceReadonly?.(true);\n\n\tconst dm = container.deltaManager;\n\tconst lastProcessedSequenceNumber = dm.initialSequenceNumber;\n\n\tconst pauseContainer = (): void => {\n\t\tassert(\n\t\t\tisIDeltaManagerFull(dm),\n\t\t\t0xa7f /* Delta manager does not have inbound/outbound queues. */,\n\t\t);\n\t\t// eslint-disable-next-line no-void\n\t\tvoid dm.inbound.pause();\n\t\t// eslint-disable-next-line no-void\n\t\tvoid dm.outbound.pause();\n\t};\n\n\t// Happy path - we are already there.\n\tif (\n\t\tloadToSequenceNumber === undefined ||\n\t\tlastProcessedSequenceNumber === loadToSequenceNumber\n\t) {\n\t\t// If we have already reached the desired sequence number, call pauseContainer() to pause immediately.\n\t\tpauseContainer();\n\t\treturn container;\n\t}\n\n\t// If we are trying to pause at a specific sequence number, ensure the latest snapshot is not newer than the desired sequence number.\n\tif (lastProcessedSequenceNumber > loadToSequenceNumber) {\n\t\tconst error = new GenericError(\n\t\t\t\"Cannot satisfy request to pause the container at the specified sequence number. Most recent snapshot is newer than the specified sequence number.\",\n\t\t);\n\t\tcontainer.close(error);\n\t\tthrow error;\n\t}\n\n\tlet opHandler: () => void;\n\tlet onAbort: () => void;\n\tlet onClose: (error?: IErrorBase) => void;\n\n\tconst promise = new Promise<void>((resolve, reject) => {\n\t\tonAbort = (): void => reject(new GenericError(\"Canceled due to cancellation request.\"));\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\tonClose = (error?: IErrorBase): void => reject(error);\n\n\t\t// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).\n\t\topHandler = (): void => {\n\t\t\t// If there is a specified sequence number, keep processing until we reach it.\n\t\t\tif (\n\t\t\t\tloadToSequenceNumber !== undefined &&\n\t\t\t\tdm.lastSequenceNumber >= loadToSequenceNumber\n\t\t\t) {\n\t\t\t\t// Pause op processing once we have processed the desired number of ops.\n\t\t\t\tpauseContainer();\n\t\t\t\tresolve();\n\t\t\t}\n\t\t};\n\n\t\t// If we have not yet reached the desired sequence number, setup a listener to pause once we reach it.\n\t\tsignal?.addEventListener(\"abort\", onAbort);\n\t\tcontainer.on(\"op\", opHandler);\n\t\tcontainer.on(\"closed\", onClose);\n\t});\n\n\t// There are no guarantees on when ops will land in storage.\n\t// No guarantees that driver implements ops caching (i.e. ops observed in previous session can be served from cache)\n\t// or that browser will provide caching capabilities / keep the data (localStorage).\n\t// Thus, we have to ensure we connect to delta storage in order to make forward progress with ops.\n\t// We also instructed not to fetch / apply any ops from storage above (to be able to install callback above before ops are processed),\n\t// connect() call will fetch ops as needed.\n\tcontainer.connect();\n\n\t// Wait for the ops to be processed.\n\tawait promise\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t.catch((error: any) => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tcontainer.close(error);\n\t\t\tthrow error;\n\t\t})\n\t\t.finally(() => {\n\t\t\t// There is not much value in leaving delta connection on. We are not processing ops, we also can't advance to \"connected\" state because of it.\n\t\t\t// We are not sending ops (due to forceReadonly() call above). We are holding collab window and any consensus-based processes.\n\t\t\t// It's better not to have connection in such case, as there are only nagatives, and no positives.\n\t\t\tcontainer.disconnect();\n\n\t\t\tcontainer.off(\"op\", opHandler);\n\t\t\tcontainer.off(\"closed\", onClose);\n\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t});\n\n\treturn container;\n}\n\n/* eslint-enable jsdoc/check-indentation */\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/container-loader";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.74.0-365691";
|
|
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,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
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,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,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/container-loader\";\nexport const pkgVersion = \"2.74.0-365691\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/container-loader",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.74.0-365691",
|
|
4
4
|
"description": "Fluid container loader",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -129,13 +129,13 @@
|
|
|
129
129
|
"temp-directory": "nyc/.nyc_output"
|
|
130
130
|
},
|
|
131
131
|
"dependencies": {
|
|
132
|
-
"@fluid-internal/client-utils": "
|
|
133
|
-
"@fluidframework/container-definitions": "
|
|
134
|
-
"@fluidframework/core-interfaces": "
|
|
135
|
-
"@fluidframework/core-utils": "
|
|
136
|
-
"@fluidframework/driver-definitions": "
|
|
137
|
-
"@fluidframework/driver-utils": "
|
|
138
|
-
"@fluidframework/telemetry-utils": "
|
|
132
|
+
"@fluid-internal/client-utils": "2.74.0-365691",
|
|
133
|
+
"@fluidframework/container-definitions": "2.74.0-365691",
|
|
134
|
+
"@fluidframework/core-interfaces": "2.74.0-365691",
|
|
135
|
+
"@fluidframework/core-utils": "2.74.0-365691",
|
|
136
|
+
"@fluidframework/driver-definitions": "2.74.0-365691",
|
|
137
|
+
"@fluidframework/driver-utils": "2.74.0-365691",
|
|
138
|
+
"@fluidframework/telemetry-utils": "2.74.0-365691",
|
|
139
139
|
"@types/events_pkg": "npm:@types/events@^3.0.0",
|
|
140
140
|
"@ungap/structured-clone": "^1.2.0",
|
|
141
141
|
"debug": "^4.3.4",
|
|
@@ -146,14 +146,14 @@
|
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
148
148
|
"@biomejs/biome": "~1.9.3",
|
|
149
|
-
"@fluid-internal/client-utils": "
|
|
150
|
-
"@fluid-internal/mocha-test-setup": "
|
|
151
|
-
"@fluid-private/test-loader-utils": "
|
|
149
|
+
"@fluid-internal/client-utils": "2.74.0-365691",
|
|
150
|
+
"@fluid-internal/mocha-test-setup": "2.74.0-365691",
|
|
151
|
+
"@fluid-private/test-loader-utils": "2.74.0-365691",
|
|
152
152
|
"@fluid-tools/build-cli": "^0.60.0",
|
|
153
153
|
"@fluidframework/build-common": "^2.0.3",
|
|
154
154
|
"@fluidframework/build-tools": "^0.60.0",
|
|
155
|
-
"@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.
|
|
156
|
-
"@fluidframework/eslint-config-fluid": "
|
|
155
|
+
"@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@2.73.0",
|
|
156
|
+
"@fluidframework/eslint-config-fluid": "2.74.0-365691",
|
|
157
157
|
"@microsoft/api-extractor": "7.52.11",
|
|
158
158
|
"@types/debug": "^4.1.5",
|
|
159
159
|
"@types/double-ended-queue": "^2.1.0",
|
package/src/container.ts
CHANGED
|
@@ -361,6 +361,7 @@ export class Container
|
|
|
361
361
|
|
|
362
362
|
const onClosed = (err?: ICriticalContainerError): void => {
|
|
363
363
|
// pre-0.58 error message: containerClosedWithoutErrorDuringLoad
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
364
365
|
reject(err ?? new GenericError("Container closed without error during load"));
|
|
365
366
|
};
|
|
366
367
|
container.on("closed", onClosed);
|
package/src/loadPaused.ts
CHANGED
|
@@ -104,6 +104,7 @@ export async function loadContainerPaused(
|
|
|
104
104
|
|
|
105
105
|
const promise = new Promise<void>((resolve, reject) => {
|
|
106
106
|
onAbort = (): void => reject(new GenericError("Canceled due to cancellation request."));
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
107
108
|
onClose = (error?: IErrorBase): void => reject(error);
|
|
108
109
|
|
|
109
110
|
// We need to setup a listener to stop op processing once we reach the desired sequence number (if specified).
|
package/src/packageVersion.ts
CHANGED