@fluidframework/test-utils 2.13.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/TestSummaryUtils.d.ts.map +1 -1
  3. package/dist/TestSummaryUtils.js +4 -1
  4. package/dist/TestSummaryUtils.js.map +1 -1
  5. package/dist/index.d.ts +1 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -6
  8. package/dist/index.js.map +1 -1
  9. package/dist/package.json +2 -1
  10. package/dist/packageVersion.d.ts +1 -1
  11. package/dist/packageVersion.js +1 -1
  12. package/dist/packageVersion.js.map +1 -1
  13. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  14. package/dist/testContainerRuntimeFactory.js +1 -6
  15. package/dist/testContainerRuntimeFactory.js.map +1 -1
  16. package/dist/testFluidObject.d.ts +1 -1
  17. package/dist/testFluidObject.d.ts.map +1 -1
  18. package/dist/testFluidObject.js +2 -4
  19. package/dist/testFluidObject.js.map +1 -1
  20. package/dist/timeoutUtils.d.ts +0 -4
  21. package/dist/timeoutUtils.d.ts.map +1 -1
  22. package/dist/timeoutUtils.js +1 -6
  23. package/dist/timeoutUtils.js.map +1 -1
  24. package/lib/TestSummaryUtils.d.ts.map +1 -1
  25. package/lib/TestSummaryUtils.js +4 -1
  26. package/lib/TestSummaryUtils.js.map +1 -1
  27. package/lib/index.d.ts +1 -2
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +1 -2
  30. package/lib/index.js.map +1 -1
  31. package/lib/packageVersion.d.ts +1 -1
  32. package/lib/packageVersion.js +1 -1
  33. package/lib/packageVersion.js.map +1 -1
  34. package/lib/testContainerRuntimeFactory.d.ts.map +1 -1
  35. package/lib/testContainerRuntimeFactory.js +2 -9
  36. package/lib/testContainerRuntimeFactory.js.map +1 -1
  37. package/lib/testFluidObject.d.ts +1 -1
  38. package/lib/testFluidObject.d.ts.map +1 -1
  39. package/lib/testFluidObject.js +2 -4
  40. package/lib/testFluidObject.js.map +1 -1
  41. package/lib/timeoutUtils.d.ts +0 -4
  42. package/lib/timeoutUtils.d.ts.map +1 -1
  43. package/lib/timeoutUtils.js +0 -5
  44. package/lib/timeoutUtils.js.map +1 -1
  45. package/package.json +25 -25
  46. package/src/TestSummaryUtils.ts +3 -0
  47. package/src/index.ts +0 -6
  48. package/src/packageVersion.ts +1 -1
  49. package/src/testContainerRuntimeFactory.ts +0 -7
  50. package/src/testFluidObject.ts +3 -6
  51. package/src/timeoutUtils.ts +0 -6
  52. package/dist/DriverWrappers.d.ts +0 -35
  53. package/dist/DriverWrappers.d.ts.map +0 -1
  54. package/dist/DriverWrappers.js +0 -60
  55. package/dist/DriverWrappers.js.map +0 -1
  56. package/lib/DriverWrappers.d.ts +0 -35
  57. package/lib/DriverWrappers.d.ts.map +0 -1
  58. package/lib/DriverWrappers.js +0 -54
  59. package/lib/DriverWrappers.js.map +0 -1
  60. package/src/DriverWrappers.ts +0 -90
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @fluidframework/test-utils
2
2
 
3
+ ## 2.21.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.20.0
8
+
9
+ ### Minor Changes
10
+
11
+ - The ContainerRuntime class has been removed ([#23341](https://github.com/microsoft/FluidFramework/pull/23341)) [61ba06aa98](https://github.com/microsoft/FluidFramework/commit/61ba06aa9881c30ffeeedcaaede9c5a1a0c81abd)
12
+
13
+ The `ContainerRuntime` class was [deprecated in version 2.12.0](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.12.0#user-content-the-containerruntime-class-is-now-deprecated-23331) and has been removed.
14
+ Use `IContainerRuntime` to replace type usages and use the free function `loadContainerRuntime` to replace usages of the static method `ContainerRuntime.loadRuntime`.
15
+
16
+ See the [deprecation
17
+ announcement](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.12.0#user-content-the-containerruntime-class-is-now-deprecated-23331)
18
+ for more details about how to update existing code.
19
+
3
20
  ## 2.13.0
4
21
 
5
22
  Dependency updates only.
@@ -1 +1 @@
1
- {"version":3,"file":"TestSummaryUtils.d.ts","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,2CAA2C,EAAE,MAAM,mCAAmC,CAAC;AAChG,OAAO,EACN,UAAU,EACV,WAAW,EAEX,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,yBAAyB,EACzB,WAAW,EAEX,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACN,mBAAmB,EAGnB,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EACN,sBAAsB,EACtB,kCAAkC,EAClC,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AA2BpF,gBAAgB;AAChB,wBAAsB,oBAAoB,CACzC,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,WAAW,EACnB,cAAc,CAAC,EAAE,MAAM;;;GAiCvB;AAWD;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAChD,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,sBAAsB,EACxC,cAAc,CAAC,EAAE,MAAM,EACvB,2BAA2B,qDAA8C,EACzE,eAAe,CAAC,EAAE,kCAAkC,EACpD,MAAM,CAAC,EAAE,oBAAoB,EAC7B,cAAc,GAAE,mBAAgD,GAC9D,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAAC,CAiB7D;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,c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,EAAE,sBAAsB,EACxC,cAAc,CAAC,EAAE,MAAM,EACvB,2BAA2B,qDAA8C,EACzE,eAAe,CAAC,EAAE,kCAAkC,EACpD,MAAM,CAAC,EAAE,oBAAoB,EAC7B,cAAc,GAAE,mBAAgD,GAC9D,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAAC,CAiB7D;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,cAAc,CAAC,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAAC,CAe7D;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,WAAW,EAEvB,MAAM,GAAE,MAAM,GAAG,yBAA6C,GAC5D,OAAO,CAAC,WAAW,CAAC,CAuCtB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,WAAW,EAAE,YAAY,CAAC;IAC1B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACtB"}
@@ -129,7 +129,10 @@ exports.createSummarizer = createSummarizer;
129
129
  * Defaults to the reason "end-to-end test".
130
130
  * @internal
131
131
  */
132
- async function summarizeNow(summarizer, inputs = "end-to-end test") {
132
+ async function summarizeNow(summarizer,
133
+ // eslint-disable-next-line import/no-deprecated
134
+ inputs = "end-to-end test") {
135
+ // eslint-disable-next-line import/no-deprecated
133
136
  const options = typeof inputs === "string" ? { reason: inputs } : inputs;
134
137
  const result = summarizer.summarizeOnDemand(options);
135
138
  const submitResult = await (0, timeoutUtils_js_1.timeoutAwait)(result.summarySubmitted, {
@@ -1 +1 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M,CAAC,gBAAgB,EAAE;QAChE,QAAQ,EAAE,qCAAqC;KAC/C,CAAC,CAAC;IACH,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC3B,MAAM,YAAY,CAAC,KAAK,CAAC;IAC1B,CAAC;IACD,IAAA,iBAAM,EACL,YAAY,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,EACpC,yDAAyD,CACzD,CAAC;IACF,IAAA,iBAAM,EAAC,YAAY,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAEjF,MAAM,eAAe,GAAG,MAAM,IAAA,8BAAY,EAAC,MAAM,CAAC,oBAAoB,EAAE;QACvE,QAAQ,EAAE,yCAAyC;KACnD,CAAC,CAAC;IACH,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,eAAe,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,IAAA,8BAAY,EAAC,MAAM,CAAC,wBAAwB,EAAE;QACzE,QAAQ,EAAE,6CAA6C;KACvD,CAAC,CAAC;IACH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAM,aAAa,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAE1D,OAAO;QACN,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,WAAW;QAC1C,cAAc,EAAE,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM;QAC/D,aAAa,EAAE,YAAY,CAAC,IAAI,CAAC,uBAAuB;KACxD,CAAC;AACH,CAAC;AAzCD,oCAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct/internal\";\nimport {\n\tIContainer,\n\tIHostLoader,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tIOnDemandSummarizeOptions,\n\tISummarizer,\n\tISummaryRuntimeOptions,\n} from \"@fluidframework/container-runtime/internal\";\nimport {\n\tIConfigProviderBase,\n\tIRequest,\n\tIResponse,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { createTestConfigProvider } from \"./TestConfigs.js\";\nimport { waitForContainerConnection } from \"./containerUtils.js\";\nimport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\nimport { ITestContainerConfig, ITestObjectProvider } from \"./testObjectProvider.js\";\nimport { timeoutAwait } from \"./timeoutUtils.js\";\n\nconst summarizerClientType = \"summarizer\";\n\n/**\n * This function should ONLY be used for back compat purposes\n * LTS versions of the Loader/Container will not have the \"getEntryPoint\" method, so we need to fallback to \"request\"\n * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0\n * @internal\n */\nasync function getSummarizerBackCompat(container: IContainer): Promise<ISummarizer> {\n\tif (container.getEntryPoint !== undefined) {\n\t\tconst entryPoint = await container.getEntryPoint();\n\t\t// Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running\n\t\t// cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the\n\t\t// function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined\n\t\t// since the container's runtime will be on version 1.X, which does not have an entry point defined.\n\t\tif (entryPoint !== undefined) {\n\t\t\treturn entryPoint as ISummarizer;\n\t\t}\n\t}\n\tconst response: IResponse = await (container as any).request({ url: \"_summarizer\" });\n\tassert(response.status === 200, \"requesting '/' should return default data object\");\n\treturn response.value as ISummarizer;\n}\n\n/** @internal */\nexport async function createSummarizerCore(\n\tcontainer: IContainer,\n\tloader: IHostLoader,\n\tsummaryVersion?: string,\n) {\n\tconst absoluteUrl = await container.getAbsoluteUrl(\"\");\n\tif (absoluteUrl === undefined) {\n\t\tthrow new Error(\"URL could not be resolved\");\n\t}\n\n\tconst request: IRequest = {\n\t\theaders: {\n\t\t\t[LoaderHeader.cache]: false,\n\t\t\t[LoaderHeader.clientDetails]: {\n\t\t\t\tcapabilities: { interactive: false },\n\t\t\t\ttype: summarizerClientType,\n\t\t\t},\n\t\t\t[DriverHeader.summarizingClient]: true,\n\t\t\t[LoaderHeader.version]: summaryVersion,\n\t\t},\n\t\turl: absoluteUrl,\n\t};\n\tconst summarizerContainer = await loader.resolve(request);\n\tawait waitForContainerConnection(summarizerContainer);\n\n\t// Old loaders will not have getEntryPoint API on the container. So, use getSummarizerBackCompat which\n\t// will use request pattern to get the summarizer in these old loaders.\n\tconst fluidObject = await getSummarizerBackCompat(summarizerContainer);\n\tif (fluidObject.ISummarizer === undefined) {\n\t\tthrow new Error(\"Fluid object does not implement ISummarizer\");\n\t}\n\n\treturn {\n\t\tcontainer: summarizerContainer,\n\t\tsummarizer: fluidObject.ISummarizer,\n\t};\n}\n\nconst defaultSummaryOptions: ISummaryRuntimeOptions = {\n\tsummaryConfigOverrides: {\n\t\tstate: \"disableHeuristics\",\n\t\tmaxAckWaitTime: 20000, // Some of the AFR tests take a long time to ack.\n\t\tmaxOpsSinceLastSummary: 7000,\n\t\tinitialSummarizerDelayMs: 0,\n\t},\n};\n\n/**\n * Creates a summarizer client from the given container and data store factory, and returns the summarizer client's\n * IContainer and ISummarizer.\n * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.\n * @internal\n */\nexport async function createSummarizerFromFactory(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainer,\n\tdataStoreFactory: IFluidDataStoreFactory,\n\tsummaryVersion?: string,\n\tcontainerRuntimeFactoryType = ContainerRuntimeFactoryWithDefaultDataStore,\n\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\tlogger?: ITelemetryBaseLogger,\n\tconfigProvider: IConfigProviderBase = createTestConfigProvider(),\n): Promise<{ container: IContainer; summarizer: ISummarizer }> {\n\tconst runtimeFactory = createContainerRuntimeFactoryWithDefaultDataStore(\n\t\tcontainerRuntimeFactoryType,\n\t\t{\n\t\t\tdefaultFactory: dataStoreFactory,\n\t\t\tregistryEntries: registryEntries ?? [\n\t\t\t\t[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],\n\t\t\t],\n\t\t\truntimeOptions: { summaryOptions: defaultSummaryOptions },\n\t\t},\n\t);\n\n\tconst loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], {\n\t\tconfigProvider,\n\t\tlogger,\n\t});\n\treturn createSummarizerCore(container, loader, summaryVersion);\n}\n\n/**\n * Creates a summarizer client from the given container and returns the summarizer client's IContainer and ISummarizer.\n * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.\n *\n * Can pass in a test config provider to enable/disable features.\n * @internal\n */\nexport async function createSummarizer(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainer,\n\tconfig?: ITestContainerConfig,\n\tsummaryVersion?: string,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<{ container: IContainer; summarizer: ISummarizer }> {\n\tconst testContainerConfig: ITestContainerConfig = {\n\t\t...config,\n\t\truntimeOptions: {\n\t\t\t...config?.runtimeOptions,\n\t\t\tsummaryOptions: config?.runtimeOptions?.summaryOptions ?? defaultSummaryOptions,\n\t\t},\n\t\tloaderProps: {\n\t\t\t...config?.loaderProps,\n\t\t\tconfigProvider: config?.loaderProps?.configProvider ?? createTestConfigProvider(),\n\t\t\tlogger,\n\t\t},\n\t};\n\tconst loader = provider.makeTestLoader(testContainerConfig);\n\treturn createSummarizerCore(container, loader, summaryVersion);\n}\n\n/**\n * Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the\n * submitted summary.\n *\n * @param summarizer - The ISummarizer to use to summarize on demand\n * @param inputs - Either the reason string or the full IOnDemandSummarizeOptions.\n * Defaults to the reason \"end-to-end test\".\n * @internal\n */\nexport async function summarizeNow(\n\tsummarizer: ISummarizer,\n\tinputs: string | IOnDemandSummarizeOptions = \"end-to-end test\",\n): Promise<SummaryInfo> {\n\tconst options: IOnDemandSummarizeOptions =\n\t\ttypeof inputs === \"string\" ? { reason: inputs } : inputs;\n\tconst result = summarizer.summarizeOnDemand(options);\n\n\tconst submitResult = await timeoutAwait(result.summarySubmitted, {\n\t\terrorMsg: \"Promise timed out: summarySubmitted\",\n\t});\n\tif (!submitResult.success) {\n\t\tthrow submitResult.error;\n\t}\n\tassert(\n\t\tsubmitResult.data.stage === \"submit\",\n\t\t\"on-demand summary submitted data stage should be submit\",\n\t);\n\tassert(submitResult.data.summaryTree !== undefined, \"summary tree should exist\");\n\n\tconst broadcastResult = await timeoutAwait(result.summaryOpBroadcasted, {\n\t\terrorMsg: \"Promise timed out: summaryOpBroadcasted\",\n\t});\n\tif (!broadcastResult.success) {\n\t\tthrow broadcastResult.error;\n\t}\n\n\tconst ackNackResult = await timeoutAwait(result.receivedSummaryAckOrNack, {\n\t\terrorMsg: \"Promise timed out: receivedSummaryAckOrNack\",\n\t});\n\tif (!ackNackResult.success) {\n\t\tthrow ackNackResult.error;\n\t}\n\n\tawait new Promise((resolve) => process.nextTick(resolve));\n\n\treturn {\n\t\tsummaryTree: submitResult.data.summaryTree,\n\t\tsummaryVersion: ackNackResult.data.summaryAckOp.contents.handle,\n\t\tsummaryRefSeq: submitResult.data.referenceSequenceNumber,\n\t};\n}\n\n/**\n * Summary information containing the summary tree, summary version, and summary sequence number.\n * @internal\n */\nexport interface SummaryInfo {\n\t/**\n\t * The summary tree generated\n\t */\n\tsummaryTree: ISummaryTree;\n\t/**\n\t * Handle of the completed summary\n\t */\n\tsummaryVersion: string;\n\t/**\n\t * Reference sequence number of the current summary generation\n\t */\n\tsummaryRefSeq: number;\n}\n"]}
1
+ {"version":3,"file":"TestSummaryUtils.js","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,gEAAgG;AAChG,6EAIwD;AAaxD,kEAA6D;AAE7D,0EAA2E;AAM3E,qDAA4D;AAC5D,2DAAiE;AACjE,6HAAyH;AAEzH,uDAAiD;AAEjD,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C;;;;;GAKG;AACH,KAAK,UAAU,uBAAuB,CAAC,SAAqB;IAC3D,IAAI,SAAS,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QAC3C,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC;QACnD,0GAA0G;QAC1G,qGAAqG;QACrG,gHAAgH;QAChH,oGAAoG;QACpG,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,UAAyB,CAAC;QAClC,CAAC;IACF,CAAC;IACD,MAAM,QAAQ,GAAc,MAAO,SAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC;IACrF,IAAA,iBAAM,EAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,kDAAkD,CAAC,CAAC;IACpF,OAAO,QAAQ,CAAC,KAAoB,CAAC;AACtC,CAAC;AAED,gBAAgB;AACT,KAAK,UAAU,oBAAoB,CACzC,SAAqB,EACrB,MAAmB,EACnB,cAAuB;IAEvB,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACvD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,OAAO,GAAa;QACzB,OAAO,EAAE;YACR,CAAC,uBAAY,CAAC,KAAK,CAAC,EAAE,KAAK;YAC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n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ContainerRuntimeFactoryWithDefaultDataStore } from \"@fluidframework/aqueduct/internal\";\nimport {\n\tIContainer,\n\tIHostLoader,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tIOnDemandSummarizeOptions,\n\tISummarizer,\n\tISummaryRuntimeOptions,\n} from \"@fluidframework/container-runtime/internal\";\nimport {\n\tIConfigProviderBase,\n\tIRequest,\n\tIResponse,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { createTestConfigProvider } from \"./TestConfigs.js\";\nimport { waitForContainerConnection } from \"./containerUtils.js\";\nimport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\nimport { ITestContainerConfig, ITestObjectProvider } from \"./testObjectProvider.js\";\nimport { timeoutAwait } from \"./timeoutUtils.js\";\n\nconst summarizerClientType = \"summarizer\";\n\n/**\n * This function should ONLY be used for back compat purposes\n * LTS versions of the Loader/Container will not have the \"getEntryPoint\" method, so we need to fallback to \"request\"\n * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0\n * @internal\n */\nasync function getSummarizerBackCompat(container: IContainer): Promise<ISummarizer> {\n\tif (container.getEntryPoint !== undefined) {\n\t\tconst entryPoint = await container.getEntryPoint();\n\t\t// Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running\n\t\t// cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the\n\t\t// function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined\n\t\t// since the container's runtime will be on version 1.X, which does not have an entry point defined.\n\t\tif (entryPoint !== undefined) {\n\t\t\treturn entryPoint as ISummarizer;\n\t\t}\n\t}\n\tconst response: IResponse = await (container as any).request({ url: \"_summarizer\" });\n\tassert(response.status === 200, \"requesting '/' should return default data object\");\n\treturn response.value as ISummarizer;\n}\n\n/** @internal */\nexport async function createSummarizerCore(\n\tcontainer: IContainer,\n\tloader: IHostLoader,\n\tsummaryVersion?: string,\n) {\n\tconst absoluteUrl = await container.getAbsoluteUrl(\"\");\n\tif (absoluteUrl === undefined) {\n\t\tthrow new Error(\"URL could not be resolved\");\n\t}\n\n\tconst request: IRequest = {\n\t\theaders: {\n\t\t\t[LoaderHeader.cache]: false,\n\t\t\t[LoaderHeader.clientDetails]: {\n\t\t\t\tcapabilities: { interactive: false },\n\t\t\t\ttype: summarizerClientType,\n\t\t\t},\n\t\t\t[DriverHeader.summarizingClient]: true,\n\t\t\t[LoaderHeader.version]: summaryVersion,\n\t\t},\n\t\turl: absoluteUrl,\n\t};\n\tconst summarizerContainer = await loader.resolve(request);\n\tawait waitForContainerConnection(summarizerContainer);\n\n\t// Old loaders will not have getEntryPoint API on the container. So, use getSummarizerBackCompat which\n\t// will use request pattern to get the summarizer in these old loaders.\n\tconst fluidObject = await getSummarizerBackCompat(summarizerContainer);\n\tif (fluidObject.ISummarizer === undefined) {\n\t\tthrow new Error(\"Fluid object does not implement ISummarizer\");\n\t}\n\n\treturn {\n\t\tcontainer: summarizerContainer,\n\t\tsummarizer: fluidObject.ISummarizer,\n\t};\n}\n\nconst defaultSummaryOptions: ISummaryRuntimeOptions = {\n\tsummaryConfigOverrides: {\n\t\tstate: \"disableHeuristics\",\n\t\tmaxAckWaitTime: 20000, // Some of the AFR tests take a long time to ack.\n\t\tmaxOpsSinceLastSummary: 7000,\n\t\tinitialSummarizerDelayMs: 0,\n\t},\n};\n\n/**\n * Creates a summarizer client from the given container and data store factory, and returns the summarizer client's\n * IContainer and ISummarizer.\n * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.\n * @internal\n */\nexport async function createSummarizerFromFactory(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainer,\n\tdataStoreFactory: IFluidDataStoreFactory,\n\tsummaryVersion?: string,\n\tcontainerRuntimeFactoryType = ContainerRuntimeFactoryWithDefaultDataStore,\n\tregistryEntries?: NamedFluidDataStoreRegistryEntries,\n\tlogger?: ITelemetryBaseLogger,\n\tconfigProvider: IConfigProviderBase = createTestConfigProvider(),\n): Promise<{ container: IContainer; summarizer: ISummarizer }> {\n\tconst runtimeFactory = createContainerRuntimeFactoryWithDefaultDataStore(\n\t\tcontainerRuntimeFactoryType,\n\t\t{\n\t\t\tdefaultFactory: dataStoreFactory,\n\t\t\tregistryEntries: registryEntries ?? [\n\t\t\t\t[dataStoreFactory.type, Promise.resolve(dataStoreFactory)],\n\t\t\t],\n\t\t\truntimeOptions: { summaryOptions: defaultSummaryOptions },\n\t\t},\n\t);\n\n\tconst loader = provider.createLoader([[provider.defaultCodeDetails, runtimeFactory]], {\n\t\tconfigProvider,\n\t\tlogger,\n\t});\n\treturn createSummarizerCore(container, loader, summaryVersion);\n}\n\n/**\n * Creates a summarizer client from the given container and returns the summarizer client's IContainer and ISummarizer.\n * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.\n *\n * Can pass in a test config provider to enable/disable features.\n * @internal\n */\nexport async function createSummarizer(\n\tprovider: ITestObjectProvider,\n\tcontainer: IContainer,\n\tconfig?: ITestContainerConfig,\n\tsummaryVersion?: string,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<{ container: IContainer; summarizer: ISummarizer }> {\n\tconst testContainerConfig: ITestContainerConfig = {\n\t\t...config,\n\t\truntimeOptions: {\n\t\t\t...config?.runtimeOptions,\n\t\t\tsummaryOptions: config?.runtimeOptions?.summaryOptions ?? defaultSummaryOptions,\n\t\t},\n\t\tloaderProps: {\n\t\t\t...config?.loaderProps,\n\t\t\tconfigProvider: config?.loaderProps?.configProvider ?? createTestConfigProvider(),\n\t\t\tlogger,\n\t\t},\n\t};\n\tconst loader = provider.makeTestLoader(testContainerConfig);\n\treturn createSummarizerCore(container, loader, summaryVersion);\n}\n\n/**\n * Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the\n * submitted summary.\n *\n * @param summarizer - The ISummarizer to use to summarize on demand\n * @param inputs - Either the reason string or the full IOnDemandSummarizeOptions.\n * Defaults to the reason \"end-to-end test\".\n * @internal\n */\nexport async function summarizeNow(\n\tsummarizer: ISummarizer,\n\t// eslint-disable-next-line import/no-deprecated\n\tinputs: string | IOnDemandSummarizeOptions = \"end-to-end test\",\n): Promise<SummaryInfo> {\n\t// eslint-disable-next-line import/no-deprecated\n\tconst options: IOnDemandSummarizeOptions =\n\t\ttypeof inputs === \"string\" ? { reason: inputs } : inputs;\n\tconst result = summarizer.summarizeOnDemand(options);\n\n\tconst submitResult = await timeoutAwait(result.summarySubmitted, {\n\t\terrorMsg: \"Promise timed out: summarySubmitted\",\n\t});\n\tif (!submitResult.success) {\n\t\tthrow submitResult.error;\n\t}\n\tassert(\n\t\tsubmitResult.data.stage === \"submit\",\n\t\t\"on-demand summary submitted data stage should be submit\",\n\t);\n\tassert(submitResult.data.summaryTree !== undefined, \"summary tree should exist\");\n\n\tconst broadcastResult = await timeoutAwait(result.summaryOpBroadcasted, {\n\t\terrorMsg: \"Promise timed out: summaryOpBroadcasted\",\n\t});\n\tif (!broadcastResult.success) {\n\t\tthrow broadcastResult.error;\n\t}\n\n\tconst ackNackResult = await timeoutAwait(result.receivedSummaryAckOrNack, {\n\t\terrorMsg: \"Promise timed out: receivedSummaryAckOrNack\",\n\t});\n\tif (!ackNackResult.success) {\n\t\tthrow ackNackResult.error;\n\t}\n\n\tawait new Promise((resolve) => process.nextTick(resolve));\n\n\treturn {\n\t\tsummaryTree: submitResult.data.summaryTree,\n\t\tsummaryVersion: ackNackResult.data.summaryAckOp.contents.handle,\n\t\tsummaryRefSeq: submitResult.data.referenceSequenceNumber,\n\t};\n}\n\n/**\n * Summary information containing the summary tree, summary version, and summary sequence number.\n * @internal\n */\nexport interface SummaryInfo {\n\t/**\n\t * The summary tree generated\n\t */\n\tsummaryTree: ISummaryTree;\n\t/**\n\t * Handle of the completed summary\n\t */\n\tsummaryVersion: string;\n\t/**\n\t * Reference sequence number of the current summary generation\n\t */\n\tsummaryRefSeq: number;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { wrapDocumentService, wrapDocumentServiceFactory, wrapDocumentStorageService, } from "./DriverWrappers.js";
6
5
  export { IProvideTestFluidObject, ITestFluidObject } from "./interfaces.js";
7
6
  export { LoaderContainerTracker } from "./loaderContainerTracker.js";
8
7
  export { fluidEntryPoint, LocalCodeLoader, SupportedExportInterfaces, } from "./localCodeLoader.js";
@@ -13,7 +12,7 @@ export { createTestContainerRuntimeFactory, TestContainerRuntimeFactory, } from
13
12
  export { ChannelFactoryRegistry, TestFluidObject, TestFluidObjectFactory, } from "./testFluidObject.js";
14
13
  export { createDocumentId, DataObjectFactoryType, EventAndErrorTrackingLogger, type IEventAndErrorTrackingLogger, getUnexpectedLogErrorException, IDocumentIdStrategy, IOpProcessingController, ITestContainerConfig, ITestObjectProvider, TestObjectProvider, TestObjectProviderWithVersionedLoad, } from "./testObjectProvider.js";
15
14
  export { createSummarizer, createSummarizerCore, createSummarizerFromFactory, summarizeNow, SummaryInfo, } from "./TestSummaryUtils.js";
16
- export { defaultTimeoutDurationMs, timeoutAwait, timeoutPromise, type TimeoutDurationOption, type TimeoutWithError, type TimeoutWithValue, } from "./timeoutUtils.js";
15
+ export { timeoutAwait, timeoutPromise, type TimeoutDurationOption, type TimeoutWithError, type TimeoutWithValue, } from "./timeoutUtils.js";
17
16
  export { toIDeltaManagerFull, waitForContainerConnection, getContainerEntryPointBackCompat, getDataStoreEntryPointBackCompat, } from "./containerUtils.js";
18
17
  export { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
19
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,eAAe,EACf,eAAe,EACf,yBAAyB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACN,iCAAiC,EACjC,2BAA2B,GAC3B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,sBAAsB,EACtB,eAAe,EACf,sBAAsB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,KAAK,4BAA4B,EACjC,8BAA8B,EAC9B,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mCAAmC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,EAC3B,YAAY,EACZ,WAAW,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAA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EACrB,KAAK,gBAAgB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,mBAAmB,EACnB,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,GAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iDAAiD,EAAE,MAAM,sDAAsD,CAAC"}
package/dist/index.js CHANGED
@@ -4,11 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.toIDeltaManagerFull = exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.createTestConfigProvider = exports.retryWithEventualValue = exports.createAndAttachContainerUsingProps = exports.createLoaderProps = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = exports.wrapDocumentStorageService = exports.wrapDocumentServiceFactory = exports.wrapDocumentService = void 0;
8
- var DriverWrappers_js_1 = require("./DriverWrappers.js");
9
- Object.defineProperty(exports, "wrapDocumentService", { enumerable: true, get: function () { return DriverWrappers_js_1.wrapDocumentService; } });
10
- Object.defineProperty(exports, "wrapDocumentServiceFactory", { enumerable: true, get: function () { return DriverWrappers_js_1.wrapDocumentServiceFactory; } });
11
- Object.defineProperty(exports, "wrapDocumentStorageService", { enumerable: true, get: function () { return DriverWrappers_js_1.wrapDocumentStorageService; } });
7
+ exports.createContainerRuntimeFactoryWithDefaultDataStore = exports.getDataStoreEntryPointBackCompat = exports.getContainerEntryPointBackCompat = exports.waitForContainerConnection = exports.toIDeltaManagerFull = exports.timeoutPromise = exports.timeoutAwait = exports.summarizeNow = exports.createSummarizerFromFactory = exports.createSummarizerCore = exports.createSummarizer = exports.TestObjectProviderWithVersionedLoad = exports.TestObjectProvider = exports.getUnexpectedLogErrorException = exports.EventAndErrorTrackingLogger = exports.DataObjectFactoryType = exports.createDocumentId = exports.TestFluidObjectFactory = exports.TestFluidObject = exports.TestContainerRuntimeFactory = exports.createTestContainerRuntimeFactory = exports.createTestConfigProvider = exports.retryWithEventualValue = exports.createAndAttachContainerUsingProps = exports.createLoaderProps = exports.createLoader = exports.createAndAttachContainer = exports.LocalCodeLoader = exports.LoaderContainerTracker = void 0;
12
8
  var loaderContainerTracker_js_1 = require("./loaderContainerTracker.js");
13
9
  Object.defineProperty(exports, "LoaderContainerTracker", { enumerable: true, get: function () { return loaderContainerTracker_js_1.LoaderContainerTracker; } });
14
10
  var localCodeLoader_js_1 = require("./localCodeLoader.js");
@@ -41,7 +37,6 @@ Object.defineProperty(exports, "createSummarizerCore", { enumerable: true, get:
41
37
  Object.defineProperty(exports, "createSummarizerFromFactory", { enumerable: true, get: function () { return TestSummaryUtils_js_1.createSummarizerFromFactory; } });
42
38
  Object.defineProperty(exports, "summarizeNow", { enumerable: true, get: function () { return TestSummaryUtils_js_1.summarizeNow; } });
43
39
  var timeoutUtils_js_1 = require("./timeoutUtils.js");
44
- Object.defineProperty(exports, "defaultTimeoutDurationMs", { enumerable: true, get: function () { return timeoutUtils_js_1.defaultTimeoutDurationMs; } });
45
40
  Object.defineProperty(exports, "timeoutAwait", { enumerable: true, get: function () { return timeoutUtils_js_1.timeoutAwait; } });
46
41
  Object.defineProperty(exports, "timeoutPromise", { enumerable: true, get: function () { return timeoutUtils_js_1.timeoutPromise; } });
47
42
  var containerUtils_js_1 = require("./containerUtils.js");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAI6B;AAH5B,wHAAA,mBAAmB,OAAA;AACnB,+HAAA,0BAA0B,OAAA;AAC1B,+HAAA,0BAA0B,OAAA;AAG3B,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AAGhB,mDAK0B;AAJzB,0HAAA,wBAAwB,OAAA;AACxB,8GAAA,YAAY,OAAA;AACZ,mHAAA,iBAAiB,OAAA;AACjB,oIAAA,kCAAkC,OAAA;AAEnC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,mDAAiF;AAAxE,0HAAA,wBAAwB,OAAA;AACjC,mFAG0C;AAFzC,mJAAA,iCAAiC,OAAA;AACjC,6IAAA,2BAA2B,OAAA;AAE5B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AACf,4HAAA,sBAAsB,OAAA;AAEvB,iEAYiC;AAXhC,yHAAA,gBAAgB,OAAA;AAChB,8HAAA,qBAAqB,OAAA;AACrB,oIAAA,2BAA2B,OAAA;AAE3B,uIAAA,8BAA8B,OAAA;AAK9B,2HAAA,kBAAkB,OAAA;AAClB,4IAAA,mCAAmC,OAAA;AAEpC,6DAM+B;AAL9B,uHAAA,gBAAgB,OAAA;AAChB,2HAAA,oBAAoB,OAAA;AACpB,kIAAA,2BAA2B,OAAA;AAC3B,mHAAA,YAAY,OAAA;AAGb,qDAO2B;AAN1B,2HAAA,wBAAwB,OAAA;AACxB,+GAAA,YAAY,OAAA;AACZ,iHAAA,cAAc,OAAA;AAKf,yDAK6B;AAJ5B,wHAAA,mBAAmB,OAAA;AACnB,+HAAA,0BAA0B,OAAA;AAC1B,qIAAA,gCAAgC,OAAA;AAChC,qIAAA,gCAAgC,OAAA;AAEjC,2HAAyH;AAAhH,uLAAA,iDAAiD,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\twrapDocumentService,\n\twrapDocumentServiceFactory,\n\twrapDocumentStorageService,\n} from \"./DriverWrappers.js\";\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces.js\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker.js\";\nexport {\n\tfluidEntryPoint,\n\tLocalCodeLoader,\n\tSupportedExportInterfaces,\n} from \"./localCodeLoader.js\";\nexport {\n\tcreateAndAttachContainer,\n\tcreateLoader,\n\tcreateLoaderProps,\n\tcreateAndAttachContainerUsingProps,\n} from \"./localLoader.js\";\nexport { retryWithEventualValue } from \"./retry.js\";\nexport { createTestConfigProvider, ITestConfigProvider } from \"./TestConfigs.js\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory.js\";\nexport {\n\tChannelFactoryRegistry,\n\tTestFluidObject,\n\tTestFluidObjectFactory,\n} from \"./testFluidObject.js\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\ttype IEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider.js\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerCore,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils.js\";\nexport {\n\tdefaultTimeoutDurationMs,\n\ttimeoutAwait,\n\ttimeoutPromise,\n\ttype TimeoutDurationOption,\n\ttype TimeoutWithError,\n\ttype TimeoutWithValue,\n} from \"./timeoutUtils.js\";\nexport {\n\ttoIDeltaManagerFull,\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils.js\";\nexport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AAGhB,mDAK0B;AAJzB,0HAAA,wBAAwB,OAAA;AACxB,8GAAA,YAAY,OAAA;AACZ,mHAAA,iBAAiB,OAAA;AACjB,oIAAA,kCAAkC,OAAA;AAEnC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,mDAAiF;AAAxE,0HAAA,wBAAwB,OAAA;AACjC,mFAG0C;AAFzC,mJAAA,iCAAiC,OAAA;AACjC,6IAAA,2BAA2B,OAAA;AAE5B,2DAI8B;AAF7B,qHAAA,eAAe,OAAA;AACf,4HAAA,sBAAsB,OAAA;AAEvB,iEAYiC;AAXhC,yHAAA,gBAAgB,OAAA;AAChB,8HAAA,qBAAqB,OAAA;AACrB,oIAAA,2BAA2B,OAAA;AAE3B,uIAAA,8BAA8B,OAAA;AAK9B,2HAAA,kBAAkB,OAAA;AAClB,4IAAA,mCAAmC,OAAA;AAEpC,6DAM+B;AAL9B,uHAAA,gBAAgB,OAAA;AAChB,2HAAA,oBAAoB,OAAA;AACpB,kIAAA,2BAA2B,OAAA;AAC3B,mHAAA,YAAY,OAAA;AAGb,qDAM2B;AAL1B,+GAAA,YAAY,OAAA;AACZ,iHAAA,cAAc,OAAA;AAKf,yDAK6B;AAJ5B,wHAAA,mBAAmB,OAAA;AACnB,+HAAA,0BAA0B,OAAA;AAC1B,qIAAA,gCAAgC,OAAA;AAChC,qIAAA,gCAAgC,OAAA;AAEjC,2HAAyH;AAAhH,uLAAA,iDAAiD,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { IProvideTestFluidObject, ITestFluidObject } from \"./interfaces.js\";\nexport { LoaderContainerTracker } from \"./loaderContainerTracker.js\";\nexport {\n\tfluidEntryPoint,\n\tLocalCodeLoader,\n\tSupportedExportInterfaces,\n} from \"./localCodeLoader.js\";\nexport {\n\tcreateAndAttachContainer,\n\tcreateLoader,\n\tcreateLoaderProps,\n\tcreateAndAttachContainerUsingProps,\n} from \"./localLoader.js\";\nexport { retryWithEventualValue } from \"./retry.js\";\nexport { createTestConfigProvider, ITestConfigProvider } from \"./TestConfigs.js\";\nexport {\n\tcreateTestContainerRuntimeFactory,\n\tTestContainerRuntimeFactory,\n} from \"./testContainerRuntimeFactory.js\";\nexport {\n\tChannelFactoryRegistry,\n\tTestFluidObject,\n\tTestFluidObjectFactory,\n} from \"./testFluidObject.js\";\nexport {\n\tcreateDocumentId,\n\tDataObjectFactoryType,\n\tEventAndErrorTrackingLogger,\n\ttype IEventAndErrorTrackingLogger,\n\tgetUnexpectedLogErrorException,\n\tIDocumentIdStrategy,\n\tIOpProcessingController,\n\tITestContainerConfig,\n\tITestObjectProvider,\n\tTestObjectProvider,\n\tTestObjectProviderWithVersionedLoad,\n} from \"./testObjectProvider.js\";\nexport {\n\tcreateSummarizer,\n\tcreateSummarizerCore,\n\tcreateSummarizerFromFactory,\n\tsummarizeNow,\n\tSummaryInfo,\n} from \"./TestSummaryUtils.js\";\nexport {\n\ttimeoutAwait,\n\ttimeoutPromise,\n\ttype TimeoutDurationOption,\n\ttype TimeoutWithError,\n\ttype TimeoutWithValue,\n} from \"./timeoutUtils.js\";\nexport {\n\ttoIDeltaManagerFull,\n\twaitForContainerConnection,\n\tgetContainerEntryPointBackCompat,\n\tgetDataStoreEntryPointBackCompat,\n} from \"./containerUtils.js\";\nexport { createContainerRuntimeFactoryWithDefaultDataStore } from \"./testContainerRuntimeFactoryWithDefaultDataStore.js\";\n"]}
package/dist/package.json CHANGED
@@ -1,3 +1,4 @@
1
1
  {
2
- "type": "commonjs"
2
+ "type": "commonjs",
3
+ "sideEffects": false
3
4
  }
@@ -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/test-utils";
8
- export declare const pkgVersion = "2.13.0";
8
+ export declare const pkgVersion = "2.21.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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/test-utils";
11
- exports.pkgVersion = "2.13.0";
11
+ exports.pkgVersion = "2.21.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,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,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/test-utils\";\nexport const pkgVersion = \"2.13.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,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/test-utils\";\nexport const pkgVersion = \"2.21.0\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"testContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":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AAK,gCAAgC,EACrC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACN,iBAAiB,EAGjB,MAAM,wDAAwD,CAAC;AAIhE,OAAO,EAEN,qBAAqB,EAGrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACN,sBAAsB,EAEtB,MAAM,8CAA8C,CAAC;AAmCtD;;;GAGG;AACH,eAAO,MAAM,iCAAiC,yBACvB,uBAAuB;eAI9B,MAAM,oBACM,sBAAsB,mBACxB,gCAAgC,oBAW/B,qBAAqB,EAAE;cAblC,MAAM;0BACM,sBAAsB;wBACxB,gCAAgC;yBAW/B,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAkB7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAcpE,iBAAiB,YAChB,OAAO,GACf,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CAwDzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B;eAlHxB,MAAM,oBACM,sBAAsB,mBACxB,gCAAgC,oBAW/B,qBAAqB,EAAE;cAblC,MAAM;0BACM,sBAAsB;wBACxB,gCAAgC;yBAW/B,qBAAqB,EAAE;sCAKL,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAkB7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAcpE,iBAAiB,YAChB,OAAO,GACf,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CA8DoD,CAAC"}
@@ -25,9 +25,7 @@ const backCompat_DefaultRouteRequestHandler = (defaultRootId) => {
25
25
  * Create a container runtime factory class that allows you to set runtime options
26
26
  * @internal
27
27
  */
28
- const createTestContainerRuntimeFactory = (
29
- // eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
30
- containerRuntimeCtor) => {
28
+ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
31
29
  return class extends internal_4.RuntimeFactoryHelper {
32
30
  constructor(type, dataStoreFactory, runtimeOptions = {
33
31
  summaryOptions: {
@@ -47,7 +45,6 @@ containerRuntimeCtor) => {
47
45
  this.runtimeOptions = runtimeOptions;
48
46
  this.requestHandlers = requestHandlers;
49
47
  }
50
- // eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
51
48
  async instantiateFirstTime(runtime) {
52
49
  // Back-compat - old code does not return IDataStore for rootContext.attachRuntime() call!
53
50
  // Thus need to leverage old API createDetachedRootDataStore() that is gone in latest releases.
@@ -60,7 +57,6 @@ containerRuntimeCtor) => {
60
57
  const result = await dataStore?.trySetAlias("default");
61
58
  (0, internal_2.assert)(result === "Success" || result === undefined, "success");
62
59
  }
63
- // eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
64
60
  async instantiateFromExisting(runtime) {
65
61
  // Validate we can load root data stores.
66
62
  // We should be able to load any data store that was created in initializeFirstTime!
@@ -122,6 +118,5 @@ exports.createTestContainerRuntimeFactory = createTestContainerRuntimeFactory;
122
118
  * A container runtime factory that allows you to set runtime options
123
119
  * @internal
124
120
  */
125
- // eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope
126
121
  exports.TestContainerRuntimeFactory = (0, exports.createTestContainerRuntimeFactory)(internal_1.ContainerRuntime);
127
122
  //# sourceMappingURL=testContainerRuntimeFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAKoD;AAQpD,kEAA6D;AAC7D,uEAKkD;AAKlD,qEAA6F;AAO7F,MAAM,qCAAqC,GAAG,CAAC,aAAqB,EAAE,EAAE;IACvE,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;QAC9D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC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":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\tContainerRuntime,\n\tDefaultSummaryConfiguration,\n\ttype IContainerRuntimeOptionsInternal,\n} from \"@fluidframework/container-runtime/internal\";\nimport {\n\tIContainerRuntime,\n\t// eslint-disable-next-line import/no-deprecated\n\tIContainerRuntimeWithResolveHandle_Deprecated,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { FluidObject, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tRuntimeRequestHandler,\n\t// eslint-disable-next-line import/no-deprecated\n\tbuildRuntimeRequestHandler,\n} from \"@fluidframework/request-handler/internal\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { RequestParser, RuntimeFactoryHelper } from \"@fluidframework/runtime-utils/internal\";\n\ninterface backCompat_IFluidRouter {\n\tIFluidRouter?: backCompat_IFluidRouter;\n\trequest(request: IRequest): Promise<IResponse>;\n}\n\nconst backCompat_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 (\n\t\t\t\truntime as any as Required<FluidObject<IFluidHandleContext>>\n\t\t\t).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\ninterface backCompat_ContainerRuntime {\n\tload(\n\t\tcontext: IContainerContext,\n\t\tregistryEntries: NamedFluidDataStoreRegistryEntries,\n\t\trequestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>,\n\t\truntimeOptions?: IContainerRuntimeOptionsInternal,\n\t\tcontainerScope?: FluidObject,\n\t\texisting?: boolean,\n\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\tcontainerRuntimeCtor?: typeof ContainerRuntime,\n\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t): Promise<ContainerRuntime>;\n}\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n * @internal\n */\nexport const createTestContainerRuntimeFactory = (\n\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\tcontainerRuntimeCtor: typeof ContainerRuntime,\n) => {\n\treturn class extends RuntimeFactoryHelper {\n\t\tconstructor(\n\t\t\tpublic type: string,\n\t\t\tpublic dataStoreFactory: IFluidDataStoreFactory,\n\t\t\tpublic runtimeOptions: IContainerRuntimeOptionsInternal = {\n\t\t\t\tsummaryOptions: {\n\t\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t\t...{\n\t\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tpublic requestHandlers: RuntimeRequestHandler[] = [],\n\t\t) {\n\t\t\tsuper();\n\t\t}\n\n\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\tpublic async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n\t\t\t// Back-compat - old code does not return IDataStore for rootContext.attachRuntime() call!\n\t\t\t// Thus need to leverage old API createDetachedRootDataStore() that is gone in latest releases.\n\t\t\tconst rootContext =\n\t\t\t\t\"createDetachedRootDataStore\" in runtime\n\t\t\t\t\t? (runtime as any).createDetachedRootDataStore([this.type], \"default\")\n\t\t\t\t\t: runtime.createDetachedDataStore([this.type]);\n\n\t\t\tconst rootRuntime = await this.dataStoreFactory.instantiateDataStore(\n\t\t\t\trootContext,\n\t\t\t\t/* existing */ false,\n\t\t\t);\n\t\t\tconst dataStore = await rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\n\n\t\t\tconst result = await dataStore?.trySetAlias(\"default\");\n\t\t\tassert(result === \"Success\" || result === undefined, \"success\");\n\t\t}\n\n\t\t// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\n\t\tpublic async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n\t\t\t// Validate we can load root data stores.\n\t\t\t// We should be able to load any data store that was created in initializeFirstTime!\n\t\t\t// Note: We use the deprecated `getRootDataStore` from v1.X here to allow for cross-major version compat\n\t\t\t// testing. Can be removed when we no longer support v1.X.\n\t\t\tawait (runtime.getAliasedDataStoreEntryPoint?.(\"default\") ??\n\t\t\t\t(\n\t\t\t\t\truntime as any as {\n\t\t\t\t\t\tgetRootDataStore(id: string, wait?: boolean): Promise<backCompat_IFluidRouter>;\n\t\t\t\t\t}\n\t\t\t\t).getRootDataStore(\"default\"));\n\t\t}\n\n\t\tasync preInitialize(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime & IContainerRuntime> {\n\t\t\tif (containerRuntimeCtor.loadRuntime === undefined) {\n\t\t\t\t// Note: We use the deprecated `load` from v1.X here to allow for cross-major version compat testing.\n\t\t\t\t// Can be removed when we no longer support v1.X.\n\t\t\t\treturn (containerRuntimeCtor as any as backCompat_ContainerRuntime).load(\n\t\t\t\t\tcontext,\n\t\t\t\t\t[\n\t\t\t\t\t\t[\"default\", Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t\t[this.type, Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t],\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\tbuildRuntimeRequestHandler(\n\t\t\t\t\t\tbackCompat_DefaultRouteRequestHandler(\"default\"),\n\t\t\t\t\t\t...this.requestHandlers,\n\t\t\t\t\t),\n\t\t\t\t\tthis.runtimeOptions,\n\t\t\t\t\tcontext.scope,\n\t\t\t\t\texisting,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst provideEntryPoint = async (runtime: IContainerRuntime) => {\n\t\t\t\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(\"default\");\n\t\t\t\tif (entryPoint === undefined) {\n\t\t\t\t\tthrow new Error(\"default dataStore must exist\");\n\t\t\t\t}\n\t\t\t\treturn entryPoint.get();\n\t\t\t};\n\t\t\tconst getDefaultObject = async (request: IRequest, runtime: IContainerRuntime) => {\n\t\t\t\tconst parser = RequestParser.create(request);\n\t\t\t\tif (parser.pathParts.length === 0) {\n\t\t\t\t\t// This cast is safe as loadContainerRuntime is called below\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\treturn (runtime as IContainerRuntimeWithResolveHandle_Deprecated).resolveHandle({\n\t\t\t\t\t\turl: `/default${parser.query}`,\n\t\t\t\t\t\theaders: request.headers,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn undefined; // continue search\n\t\t\t};\n\t\t\treturn containerRuntimeCtor.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries: [\n\t\t\t\t\t[\"default\", Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t[this.type, Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t],\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\trequestHandler: buildRuntimeRequestHandler(getDefaultObject, ...this.requestHandlers),\n\t\t\t\tprovideEntryPoint,\n\t\t\t\t// ! This prop is needed for back-compat. Can be removed in 2.0.0-internal.8.0.0\n\t\t\t\tinitializeEntryPoint: provideEntryPoint,\n\t\t\t\truntimeOptions: this.runtimeOptions,\n\t\t\t\tcontainerScope: context.scope,\n\t\t\t\texisting,\n\t\t\t} as any);\n\t\t}\n\t};\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated -- ContainerRuntime class to be moved to internal scope\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
1
+ {"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAIoD;AAQpD,kEAA6D;AAC7D,uEAKkD;AAKlD,qEAA6F;AAO7F,MAAM,qCAAqC,GAAG,CAAC,aAAqB,EAAE,EAAE;IACvE,OAAO,KAAK,EAAE,OAAiB,EAAE,OAA0B,EAAE,EAAE;QAC9D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,OACC,OACA,CAAC,mBAAmB,CAAC,aAAa,CAAC;gBACnC,GAAG,EAAE,IAAI,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE;gBACvC,OAAO,EAAE,OAAO,CAAC,OAAO;aACxB,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC,CAAC,kBAAkB;IACrC,CAAC,CAAC;AACH,CAAC,CAAC;AAcF;;;GAGG;AACI,MAAM,iCAAiC,GAAG,CAChD,oBAA6C,EAC5C,EAAE;IACH,OAAO,KAAM,SAAQ,+BAAoB;QACxC,YACQ,IAAY,EACZ,gBAAwC,EACxC,iBAAmD;YACzD,cAAc,EAAE;gBACf,sBAAsB,EAAE;oBACvB,GAAG,sCAA2B;oBAC9B,GAAG;wBACF,wBAAwB,EAAE,CAAC;qBAC3B;iBACD;aACD;SACD;QACD,gDAAgD;QACzC,kBAA2C,EAAE;YAEpD,KAAK,EAAE,CAAC;YAfD,SAAI,GAAJ,IAAI,CAAQ;YACZ,qBAAgB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CAAC,gBAAgB,CAAC,CAAC;oBACnD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;iBACnD;gBACD,gDAAgD;gBAChD,cAAc,EAAE,IAAA,qCAA0B,EAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC;gBACrF,iBAAiB;gBACjB,gFAAgF;gBAChF,oBAAoB,EAAE,iBAAiB;gBACvC,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,cAAc,EAAE,OAAO,CAAC,KAAK;gBAC7B,QAAQ;aACD,CAAC,CAAC;QACX,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AAjHW,QAAA,iCAAiC,qCAiH5C;AAEF;;;GAGG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,2BAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions/internal\";\nimport {\n\tContainerRuntime,\n\tDefaultSummaryConfiguration,\n\ttype IContainerRuntimeOptionsInternal,\n} from \"@fluidframework/container-runtime/internal\";\nimport {\n\tIContainerRuntime,\n\t// eslint-disable-next-line import/no-deprecated\n\tIContainerRuntimeWithResolveHandle_Deprecated,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport { FluidObject, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tRuntimeRequestHandler,\n\t// eslint-disable-next-line import/no-deprecated\n\tbuildRuntimeRequestHandler,\n} from \"@fluidframework/request-handler/internal\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { RequestParser, RuntimeFactoryHelper } from \"@fluidframework/runtime-utils/internal\";\n\ninterface backCompat_IFluidRouter {\n\tIFluidRouter?: backCompat_IFluidRouter;\n\trequest(request: IRequest): Promise<IResponse>;\n}\n\nconst backCompat_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 (\n\t\t\t\truntime as any as Required<FluidObject<IFluidHandleContext>>\n\t\t\t).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\ninterface backCompat_ContainerRuntime {\n\tload(\n\t\tcontext: IContainerContext,\n\t\tregistryEntries: NamedFluidDataStoreRegistryEntries,\n\t\trequestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>,\n\t\truntimeOptions?: IContainerRuntimeOptionsInternal,\n\t\tcontainerScope?: FluidObject,\n\t\texisting?: boolean,\n\t\tcontainerRuntimeCtor?: typeof ContainerRuntime,\n\t): Promise<ContainerRuntime>;\n}\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n * @internal\n */\nexport const createTestContainerRuntimeFactory = (\n\tcontainerRuntimeCtor: typeof ContainerRuntime,\n) => {\n\treturn class extends RuntimeFactoryHelper {\n\t\tconstructor(\n\t\t\tpublic type: string,\n\t\t\tpublic dataStoreFactory: IFluidDataStoreFactory,\n\t\t\tpublic runtimeOptions: IContainerRuntimeOptionsInternal = {\n\t\t\t\tsummaryOptions: {\n\t\t\t\t\tsummaryConfigOverrides: {\n\t\t\t\t\t\t...DefaultSummaryConfiguration,\n\t\t\t\t\t\t...{\n\t\t\t\t\t\t\tinitialSummarizerDelayMs: 0,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tpublic requestHandlers: RuntimeRequestHandler[] = [],\n\t\t) {\n\t\t\tsuper();\n\t\t}\n\n\t\tpublic async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n\t\t\t// Back-compat - old code does not return IDataStore for rootContext.attachRuntime() call!\n\t\t\t// Thus need to leverage old API createDetachedRootDataStore() that is gone in latest releases.\n\t\t\tconst rootContext =\n\t\t\t\t\"createDetachedRootDataStore\" in runtime\n\t\t\t\t\t? (runtime as any).createDetachedRootDataStore([this.type], \"default\")\n\t\t\t\t\t: runtime.createDetachedDataStore([this.type]);\n\n\t\t\tconst rootRuntime = await this.dataStoreFactory.instantiateDataStore(\n\t\t\t\trootContext,\n\t\t\t\t/* existing */ false,\n\t\t\t);\n\t\t\tconst dataStore = await rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\n\n\t\t\tconst result = await dataStore?.trySetAlias(\"default\");\n\t\t\tassert(result === \"Success\" || result === undefined, \"success\");\n\t\t}\n\n\t\tpublic async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n\t\t\t// Validate we can load root data stores.\n\t\t\t// We should be able to load any data store that was created in initializeFirstTime!\n\t\t\t// Note: We use the deprecated `getRootDataStore` from v1.X here to allow for cross-major version compat\n\t\t\t// testing. Can be removed when we no longer support v1.X.\n\t\t\tawait (runtime.getAliasedDataStoreEntryPoint?.(\"default\") ??\n\t\t\t\t(\n\t\t\t\t\truntime as any as {\n\t\t\t\t\t\tgetRootDataStore(id: string, wait?: boolean): Promise<backCompat_IFluidRouter>;\n\t\t\t\t\t}\n\t\t\t\t).getRootDataStore(\"default\"));\n\t\t}\n\n\t\tasync preInitialize(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime & IContainerRuntime> {\n\t\t\tif (containerRuntimeCtor.loadRuntime === undefined) {\n\t\t\t\t// Note: We use the deprecated `load` from v1.X here to allow for cross-major version compat testing.\n\t\t\t\t// Can be removed when we no longer support v1.X.\n\t\t\t\treturn (containerRuntimeCtor as any as backCompat_ContainerRuntime).load(\n\t\t\t\t\tcontext,\n\t\t\t\t\t[\n\t\t\t\t\t\t[\"default\", Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t\t[this.type, Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t],\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\tbuildRuntimeRequestHandler(\n\t\t\t\t\t\tbackCompat_DefaultRouteRequestHandler(\"default\"),\n\t\t\t\t\t\t...this.requestHandlers,\n\t\t\t\t\t),\n\t\t\t\t\tthis.runtimeOptions,\n\t\t\t\t\tcontext.scope,\n\t\t\t\t\texisting,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst provideEntryPoint = async (runtime: IContainerRuntime) => {\n\t\t\t\tconst entryPoint = await runtime.getAliasedDataStoreEntryPoint(\"default\");\n\t\t\t\tif (entryPoint === undefined) {\n\t\t\t\t\tthrow new Error(\"default dataStore must exist\");\n\t\t\t\t}\n\t\t\t\treturn entryPoint.get();\n\t\t\t};\n\t\t\tconst getDefaultObject = async (request: IRequest, runtime: IContainerRuntime) => {\n\t\t\t\tconst parser = RequestParser.create(request);\n\t\t\t\tif (parser.pathParts.length === 0) {\n\t\t\t\t\t// This cast is safe as loadContainerRuntime is called below\n\t\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\t\treturn (runtime as IContainerRuntimeWithResolveHandle_Deprecated).resolveHandle({\n\t\t\t\t\t\turl: `/default${parser.query}`,\n\t\t\t\t\t\theaders: request.headers,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn undefined; // continue search\n\t\t\t};\n\t\t\treturn containerRuntimeCtor.loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistryEntries: [\n\t\t\t\t\t[\"default\", Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t\t[this.type, Promise.resolve(this.dataStoreFactory)],\n\t\t\t\t],\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\trequestHandler: buildRuntimeRequestHandler(getDefaultObject, ...this.requestHandlers),\n\t\t\t\tprovideEntryPoint,\n\t\t\t\t// ! This prop is needed for back-compat. Can be removed in 2.0.0-internal.8.0.0\n\t\t\t\tinitializeEntryPoint: provideEntryPoint,\n\t\t\t\truntimeOptions: this.runtimeOptions,\n\t\t\t\tcontainerScope: context.scope,\n\t\t\t\texisting,\n\t\t\t} as any);\n\t\t}\n\t};\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n * @internal\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
@@ -24,7 +24,7 @@ export declare class TestFluidObject implements ITestFluidObject {
24
24
  get handle(): IFluidHandle<this>;
25
25
  root: ISharedMap;
26
26
  private readonly innerHandle;
27
- private initializeP;
27
+ private initializationPromise;
28
28
  /**
29
29
  * Creates a new TestFluidObject.
30
30
  * @param runtime - The data store runtime.
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEpF,OAAO,EACN,qBAAqB,EAGrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAa,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;;;GAKG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;aAyBtC,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,iBAAi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W,sBAAsB;IAYnE,OAAO,CAAC,QAAQ,CAAC,cAAc;aACf,IAAI;IAZrB,IAAW,sBAAsB,SAEhC;IAED;;;;;OAKG;gBAEe,cAAc,EAAE,sBAAsB,EACvC,IAAI,SAA2B;IAGnC,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAmDjC"}
@@ -72,10 +72,8 @@ class TestFluidObject {
72
72
  }
73
73
  this.root = (await this.runtime.getChannel("root"));
74
74
  };
75
- if (this.initializeP === undefined) {
76
- this.initializeP = doInitialization();
77
- }
78
- return this.initializeP;
75
+ this.initializationPromise ?? (this.initializationPromise = doInitialization());
76
+ return this.initializationPromise;
79
77
  }
80
78
  }
81
79
  exports.TestFluidObject = TestFluidObject;
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,iEAI4C;AAK5C,2DAAqE;AAMrE,qEAA2E;AAI3E;;;;;GAKG;AACH,MAAa,eAAe;IAC3B,IAAW,gBAAgB;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAMD;;;;;;OAMG;IACH,YACiB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,iBAA+C;QAHhD,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAEhE,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnF,CAAC;IAED;;;OAGG;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AAG,IAAI,GAAG,EAA2B,CAAC;QACtE,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACjD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;gBACtB,0BAA0B,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;QACF,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,8BAAmB,EACvC,KAAK,EAAE,OAAiB,EAAE,EAAyB,EAAE,EAAE;YACtD,uEAAuE;YACvE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YAC7C,IAAA,iBAAM,EACL,UAAU,YAAY,eAAe,EACrC,gDAAgD,CAChD,CAAC;YACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CACD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAoB,IAAI,eAAe,CACpD,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAtED,wDAsEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\tFluidObjectHandle,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISharedMap, SharedMap } from \"@fluidframework/map/internal\";\nimport {\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\n\nimport { ITestFluidObject } from \"./interfaces.js\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n * @internal\n */\nexport class TestFluidObject implements ITestFluidObject {\n\tpublic get ITestFluidObject() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tpublic get handle(): IFluidHandle<this> {\n\t\treturn this.innerHandle;\n\t}\n\n\tpublic root!: ISharedMap;\n\tprivate readonly innerHandle: IFluidHandle<this>;\n\tprivate initializeP: Promise<void> | undefined;\n\n\t/**\n\t * Creates a new TestFluidObject.\n\t * @param runtime - The data store runtime.\n\t * @param context - The data store context.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n\t * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n\t */\n\tconstructor(\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly channel: IFluidDataStoreChannel,\n\t\tpublic readonly context: IFluidDataStoreContext,\n\t\tprivate readonly factoryEntriesMap: Map<string, IChannelFactory>,\n\t) {\n\t\tthis.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getSharedObject<T = any>(id: string): Promise<T> {\n\t\tif (this.factoryEntriesMap === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tfor (const key of this.factoryEntriesMap.keys()) {\n\t\t\tif (key === id) {\n\t\t\t\tconst handle = this.root.get<IFluidHandle>(id);\n\t\t\t\treturn handle?.get() as Promise<T>;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Shared object with id ${id} not found.`);\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(request);\n\t}\n\n\tpublic async initialize(existing: boolean) {\n\t\tconst doInitialization = async () => {\n\t\t\tif (!existing) {\n\t\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\t\tthis.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\tconst sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n\t\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t\t});\n\n\t\t\t\tthis.root.bindToContext();\n\t\t\t}\n\n\t\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t\t};\n\n\t\tif (this.initializeP === undefined) {\n\t\t\tthis.initializeP = doInitialization();\n\t\t}\n\n\t\treturn this.initializeP;\n\t}\n}\n\n/**\n * @internal\n */\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n *\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n *\n * @privateRemarks Beware that using this class generally forfeits some compatibility coverage\n * `describeCompat` aims to provide:\n * `SharedMap`s always reference the current version of SharedMap.\n * AB#4670 tracks improving this situation.\n * @internal\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a new TestFluidObjectFactory.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n\t * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n\t * for it.\n\t */\n\tconstructor(\n\t\tprivate readonly factoryEntries: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\tconst dataTypes = new Map<string, IChannelFactory>();\n\n\t\t// Add SharedMap's factory which will be used to create the root map.\n\t\tconst sharedMapFactory = SharedMap.getFactory();\n\t\tdataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n\t\t// Add the object factories to the list to be sent to data store runtime.\n\t\tfor (const [, factory] of this.factoryEntries) {\n\t\t\tdataTypes.set(factory.type, factory);\n\t\t}\n\n\t\t// Create a map from the factory entries with entries that don't have the id as undefined. This will be\n\t\t// passed to the Fluid object.\n\t\tconst factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n\t\tfor (const [id, factory] of this.factoryEntries) {\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, factory);\n\t\t\t}\n\t\t}\n\n\t\tconst runtimeClass = mixinRequestHandler(\n\t\t\tasync (request: IRequest, rt: FluidDataStoreRuntime) => {\n\t\t\t\t// The provideEntryPoint callback below always returns TestFluidObject.\n\t\t\t\tconst dataObject = await rt.entryPoint.get();\n\t\t\t\tassert(\n\t\t\t\t\tdataObject instanceof TestFluidObject,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn dataObject.request(request);\n\t\t\t},\n\t\t);\n\n\t\tconst runtime = new runtimeClass(context, dataTypes, existing, async () => {\n\t\t\tawait instance.initialize(true);\n\t\t\treturn instance;\n\t\t});\n\n\t\tconst instance: TestFluidObject = new TestFluidObject(\n\t\t\truntime, // runtime\n\t\t\truntime, // channel\n\t\t\tcontext,\n\t\t\tfactoryEntriesMapForObject,\n\t\t);\n\n\t\tif (!existing) {\n\t\t\tawait instance.initialize(false);\n\t\t}\n\n\t\treturn runtime;\n\t}\n}\n"]}
1
+ {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,iEAI4C;AAK5C,2DAAqE;AAMrE,qEAA2E;AAI3E;;;;;GAKG;AACH,MAAa,eAAe;IAC3B,IAAW,gBAAgB;QAC1B,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,MAAM;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAMD;;;;;;OAMG;IACH,YACiB,OAA+B,EAC/B,OAA+B,EAC/B,OAA+B,EAC9B,iBAA+C;QAHhD,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC/B,YAAO,GAAP,OAAO,CAAwB;QAC9B,sBAAiB,GAAjB,iBAAiB,CAA8B;QAEhE,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAiB,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,qBAAq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AA0B,GAAG,IAAI,GAAG,EAA2B,CAAC;QACtE,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACjD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;gBACtB,0BAA0B,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;QACF,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,8BAAmB,EACvC,KAAK,EAAE,OAAiB,EAAE,EAAyB,EAAE,EAAE;YACtD,uEAAuE;YACvE,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;YAC7C,IAAA,iBAAM,EACL,UAAU,YAAY,eAAe,EACrC,gDAAgD,CAChD,CAAC;YACF,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,CACD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE;YACzE,MAAM,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAoB,IAAI,eAAe,CACpD,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU;QACnB,OAAO,EACP,0BAA0B,CAC1B,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAtED,wDAsEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle, IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFluidDataStoreRuntime,\n\tFluidObjectHandle,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore/internal\";\nimport {\n\tIChannelFactory,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { ISharedMap, SharedMap } from \"@fluidframework/map/internal\";\nimport {\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { create404Response } from \"@fluidframework/runtime-utils/internal\";\n\nimport { ITestFluidObject } from \"./interfaces.js\";\n\n/**\n * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.\n * The shared objects can be retrieved by passing the key of the entry to getSharedObject.\n * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.\n * @internal\n */\nexport class TestFluidObject implements ITestFluidObject {\n\tpublic get ITestFluidObject() {\n\t\treturn this;\n\t}\n\n\tpublic get IFluidLoadable() {\n\t\treturn this;\n\t}\n\n\tpublic get handle(): IFluidHandle<this> {\n\t\treturn this.innerHandle;\n\t}\n\n\tpublic root!: ISharedMap;\n\tprivate readonly innerHandle: IFluidHandle<this>;\n\tprivate initializationPromise: Promise<void> | undefined;\n\n\t/**\n\t * Creates a new TestFluidObject.\n\t * @param runtime - The data store runtime.\n\t * @param context - The data store context.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n\t * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n\t */\n\tconstructor(\n\t\tpublic readonly runtime: IFluidDataStoreRuntime,\n\t\tpublic readonly channel: IFluidDataStoreChannel,\n\t\tpublic readonly context: IFluidDataStoreContext,\n\t\tprivate readonly factoryEntriesMap: Map<string, IChannelFactory>,\n\t) {\n\t\tthis.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n\t}\n\n\t/**\n\t * Retrieves a shared object with the given id.\n\t * @param id - The id of the shared object to retrieve.\n\t */\n\tpublic async getSharedObject<T = any>(id: string): Promise<T> {\n\t\tif (this.factoryEntriesMap === undefined) {\n\t\t\tthrow new Error(\"Shared objects were not provided during creation.\");\n\t\t}\n\n\t\tfor (const key of this.factoryEntriesMap.keys()) {\n\t\t\tif (key === id) {\n\t\t\t\tconst handle = this.root.get<IFluidHandle>(id);\n\t\t\t\treturn handle?.get() as Promise<T>;\n\t\t\t}\n\t\t}\n\n\t\tthrow new Error(`Shared object with id ${id} not found.`);\n\t}\n\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\treturn request.url === \"\" || request.url === \"/\" || request.url.startsWith(\"/?\")\n\t\t\t? { mimeType: \"fluid/object\", status: 200, value: this }\n\t\t\t: create404Response(request);\n\t}\n\n\tpublic async initialize(existing: boolean) {\n\t\tconst doInitialization = async () => {\n\t\t\tif (!existing) {\n\t\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\t\tthis.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\t\tconst sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n\t\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t\t});\n\n\t\t\t\tthis.root.bindToContext();\n\t\t\t}\n\n\t\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t\t};\n\n\t\tthis.initializationPromise ??= doInitialization();\n\t\treturn this.initializationPromise;\n\t}\n}\n\n/**\n * @internal\n */\nexport type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;\n\n/**\n * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime\n * with the object factories in the entry list. All the entries with an id other than undefined are passed to the\n * Fluid object so that it can create a shared object for each.\n *\n * @example\n *\n * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.\n * It will add SparseMatrix to the data store's factory so that it can be created later.\n *\n * ```typescript\n * new TestFluidObjectFactory([\n * [ \"sharedString\", SharedString.getFactory() ],\n * [ \"sharedDirectory\", SharedDirectory.getFactory() ],\n * [ undefined, SparseMatrix.getFactory() ],\n * ]);\n * ```\n *\n * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:\n *\n * ```typescript\n * sharedString = testFluidObject.getSharedObject<SharedString>(\"sharedString\");\n * sharedDir = testFluidObject.getSharedObject<SharedDirectory>(\"sharedDirectory\");\n * ```\n *\n * @privateRemarks Beware that using this class generally forfeits some compatibility coverage\n * `describeCompat` aims to provide:\n * `SharedMap`s always reference the current version of SharedMap.\n * AB#4670 tracks improving this situation.\n * @internal\n */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n\tpublic get IFluidDataStoreFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Creates a new TestFluidObjectFactory.\n\t * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n\t * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n\t * for it.\n\t */\n\tconstructor(\n\t\tprivate readonly factoryEntries: ChannelFactoryRegistry,\n\t\tpublic readonly type = \"TestFluidObjectFactory\",\n\t) {}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<FluidDataStoreRuntime> {\n\t\tconst dataTypes = new Map<string, IChannelFactory>();\n\n\t\t// Add SharedMap's factory which will be used to create the root map.\n\t\tconst sharedMapFactory = SharedMap.getFactory();\n\t\tdataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n\t\t// Add the object factories to the list to be sent to data store runtime.\n\t\tfor (const [, factory] of this.factoryEntries) {\n\t\t\tdataTypes.set(factory.type, factory);\n\t\t}\n\n\t\t// Create a map from the factory entries with entries that don't have the id as undefined. This will be\n\t\t// passed to the Fluid object.\n\t\tconst factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n\t\tfor (const [id, factory] of this.factoryEntries) {\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, factory);\n\t\t\t}\n\t\t}\n\n\t\tconst runtimeClass = mixinRequestHandler(\n\t\t\tasync (request: IRequest, rt: FluidDataStoreRuntime) => {\n\t\t\t\t// The provideEntryPoint callback below always returns TestFluidObject.\n\t\t\t\tconst dataObject = await rt.entryPoint.get();\n\t\t\t\tassert(\n\t\t\t\t\tdataObject instanceof TestFluidObject,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn dataObject.request(request);\n\t\t\t},\n\t\t);\n\n\t\tconst runtime = new runtimeClass(context, dataTypes, existing, async () => {\n\t\t\tawait instance.initialize(true);\n\t\t\treturn instance;\n\t\t});\n\n\t\tconst instance: TestFluidObject = new TestFluidObject(\n\t\t\truntime, // runtime\n\t\t\truntime, // channel\n\t\t\tcontext,\n\t\t\tfactoryEntriesMapForObject,\n\t\t);\n\n\t\tif (!existing) {\n\t\t\tawait instance.initialize(false);\n\t\t}\n\n\t\treturn runtime;\n\t}\n}\n"]}
@@ -2,10 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- /**
6
- * @internal
7
- */
8
- export declare const defaultTimeoutDurationMs = 250;
9
5
  /**
10
6
  * @internal
11
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutUtils.d.ts","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAgG5C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB;IAC9D,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,KAAK,CAAC,EAAE,KAAK,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,qBAAqB;IACxE,MAAM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C,GAAG,IAAI,CAAE,SAAQ,qBAAqB;IACxE,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACT;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,IAAI,IAAI,CACvC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC1B,IAAI,CAAC;AAEV;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,IAAI,EAC1C,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,GACzD,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,IAAI,EAC5C,QAAQ,EAAE,CACT,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC1B,IAAI,EACT,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,GACzD,OAAO,CAAC,CAAC,CAAC,CA6BZ"}
@@ -4,13 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.timeoutPromise = exports.timeoutAwait = exports.defaultTimeoutDurationMs = void 0;
7
+ exports.timeoutPromise = exports.timeoutAwait = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
- // @deprecated this value is no longer used
10
- /**
11
- * @internal
12
- */
13
- exports.defaultTimeoutDurationMs = 250;
14
9
  const timeBuffer = 15; // leave 15 ms leeway for finish processing
15
10
  // TestTimeout class that manages tracking of test timeout. It creates a timer when timeout is in effect,
16
11
  // and provides a promise that will be rejected some time (as defined by `timeBuffer`) before the test timeout happens.
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAuE;AAGvE,2CAA2C;AAC3C;;GAEG;AACU,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C,MAAM,UAAU,GAAG,EAAE,CAAC,CAAC,2CAA2C;AAElE,yGAAyG;AACzG,uHAAuH;AACvH,sGAAsG;AACtG,uBAAuB;AACvB,0EAA0E;AAC1E,MAAM,WAAW;IAOT,MAAM,CAAC,KAAK,CAAC,QAAwB;QAC3C,WAAW,CAAC,KAAK,EAAE,CAAC;QACpB,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,KAAK;QAClB,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACnC,WAAW,CAAC,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QAC1C,CAAC;aAAM,CAAC;YACP,WAAW,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;IACF,CAAC;IAEM,MAAM,CAAC,WAAW;QACxB,OAAO,WAAW,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,UAAU;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC9B,CAAC;IAEM,UAAU;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED;QA/BQ,YAAO,GAAW,CAAC,CAAC;QAGpB,aAAQ,GAAG,KAAK,CAAC;QA6BxB,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAQ,EAAE,CAAC;QAC/B,oEAAoE;QACpE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CA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CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,EACtF,OAAO,CACP,CAAC;QAEF,QAAQ,CACP,CAAC,KAAK,EAAE,EAAE;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QAChB,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport type * as Mocha from \"mocha\";\n\n// @deprecated this value is no longer used\n/**\n * @internal\n */\nexport const defaultTimeoutDurationMs = 250;\n\nconst timeBuffer = 15; // leave 15 ms leeway for finish processing\n\n// TestTimeout class that manages tracking of test timeout. It creates a timer when timeout is in effect,\n// and provides a promise that will be rejected some time (as defined by `timeBuffer`) before the test timeout happens.\n// This will ensure that async awaits in tests do not end up timing out the tests but resolve / reject\n// before that happens.\n// Once rejected, a new TestTimeout object will be create for the timeout.\nclass TestTimeout {\n\tprivate timeout: number = 0;\n\tprivate timer: NodeJS.Timeout | undefined;\n\tprivate readonly deferred: Deferred<void>;\n\tprivate rejected = false;\n\n\tprivate static instance: TestTimeout = new TestTimeout();\n\tpublic static reset(runnable: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\tTestTimeout.instance.resetTimer(runnable);\n\t}\n\n\tpublic static clear() {\n\t\tif (TestTimeout.instance.rejected) {\n\t\t\tTestTimeout.instance = new TestTimeout();\n\t\t} else {\n\t\t\tTestTimeout.instance.clearTimer();\n\t\t}\n\t}\n\n\tpublic static getInstance() {\n\t\treturn TestTimeout.instance;\n\t}\n\n\tpublic async getPromise() {\n\t\treturn this.deferred.promise;\n\t}\n\n\tpublic getTimeout() {\n\t\treturn this.timeout;\n\t}\n\n\tprivate constructor() {\n\t\tthis.deferred = new Deferred();\n\t\t// Ignore rejection for timeout promise if no one is waiting for it.\n\t\tthis.deferred.promise.catch(() => {});\n\t}\n\n\tprivate resetTimer(runnable: Mocha.Runnable) {\n\t\tassert(!this.timer, \"clearTimer should have been called before reset\");\n\t\tassert(!this.deferred.isCompleted, \"can't reset a completed TestTimeout\");\n\n\t\t// Check the test timeout setting\n\t\tconst timeoutFromMochaTest = runnable.timeout();\n\t\tif (!(Number.isFinite(timeoutFromMochaTest) && timeoutFromMochaTest > 0)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// subtract a buffer\n\t\tthis.timeout = Math.max(timeoutFromMochaTest - timeBuffer, 1);\n\n\t\t// Set up timer to reject near the test timeout.\n\t\tthis.timer = setTimeout(() => {\n\t\t\tthis.deferred.reject(this);\n\t\t\tthis.rejected = true;\n\t\t}, this.timeout);\n\t}\n\tprivate clearTimer() {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t}\n}\n\n// Only register if we are running with mocha-test-setup loaded (that package is what sets globalThis.getMochaModule).\nif (globalThis.getMochaModule !== undefined) {\n\t// Patch the private methods resetTimeout and clearTimeout on Mocha's runnable objects so we can do the appropriate\n\t// calls in TestTimeout above when the Mocha methods are called.\n\t// These are not part of the public API so if Mocha changes how it works, this could break.\n\t// See https://github.com/mochajs/mocha/blob/8d0ca3ed77ba8a704b2aa8b58267a084a475a51b/lib/runnable.js#L234.\n\tconst mochaModule = globalThis.getMochaModule() as typeof Mocha;\n\tconst runnablePrototype = mochaModule.Runnable.prototype;\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldResetTimeoutFunc = runnablePrototype.resetTimeout;\n\trunnablePrototype.resetTimeout = function (this: Mocha.Runnable) {\n\t\toldResetTimeoutFunc.call(this);\n\t\tTestTimeout.reset(this);\n\t};\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldClearTimeoutFunc = runnablePrototype.clearTimeout;\n\trunnablePrototype.clearTimeout = function (this: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\toldClearTimeoutFunc.call(this);\n\t};\n}\n\n/**\n * @internal\n */\nexport interface TimeoutDurationOption {\n\t/**\n\t * Timeout duration in milliseconds, if it is great than 0 and not Infinity\n\t * If it is undefined, then it will use test timeout if we are in side the test function\n\t * Otherwise, there is no timeout\n\t */\n\tdurationMs?: number;\n}\n\n/**\n * @internal\n */\nexport interface TimeoutWithError extends TimeoutDurationOption {\n\treject?: true;\n\terrorMsg?: string;\n\t// Since there are no required properties, this type explicitly\n\t// rejects `value` to avoid confusion with TimeoutWithValue.\n\tvalue?: never;\n}\n\n/**\n * @internal\n */\nexport interface TimeoutWithValue<T = void> extends TimeoutDurationOption {\n\treject: false;\n\tvalue: T;\n}\n\nexport type PromiseExecutor<T = void> = (\n\tresolve: (value: T | PromiseLike<T>) => void,\n\treject: (reason?: any) => void,\n) => void;\n\n/**\n * Wraps the given promise with another one that will complete after a specific timeout if the original promise does\n * not resolve by then.\n *\n * @remarks\n * If used inside a mocha test, it uses the test timeout by default and completes the returned promise just before\n * the test timeout hits, so that tests don't time out because of unpredictable awaits.\n * In that scenario the timeout can still be overridden via `timeoutOptions` but it's recommended to use the default value.\n *\n * @param promise - The promise to be wrapped.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when\n * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.\n * @returns A new promise that will complete when the given promise resolves or the timeout expires.\n * @internal\n */\nexport async function timeoutAwait<T = void>(\n\tpromise: PromiseLike<T>,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\treturn Promise.race([promise, timeoutPromise<T>(() => {}, timeoutOptions)]);\n}\n\n/**\n * Creates a promise from the given executor that will complete after a specific timeout.\n *\n * @remarks\n * If used inside a mocha test, it uses the test timeout by default and completes the returned promise just before\n * the test timeout hits, so that tests don't time out because of unpredictable awaits.\n * In that scenario the timeout can still be overridden via `timeoutOptions` but it's recommended to use the default value.\n *\n * @param executor - The executor for the promise.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when\n * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.\n * @returns A new promise that will complete when the given executor resolves or the timeout expires.\n * @internal\n */\nexport async function timeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\t// create the timeout error outside the async task, so its callstack includes\n\t// the original call site, this makes it easier to debug\n\tconst err =\n\t\ttimeoutOptions.reject === false\n\t\t\t? undefined\n\t\t\t: new Error(timeoutOptions.errorMsg ?? \"Timed out\");\n\tconst executorPromise = getTimeoutPromise(executor, timeoutOptions, err);\n\n\tconst currentTestTimeout = TestTimeout.getInstance();\n\tif (currentTestTimeout === undefined) {\n\t\treturn executorPromise;\n\t}\n\n\treturn Promise.race([executorPromise, currentTestTimeout.getPromise()]).catch((e) => {\n\t\tif (e === currentTestTimeout) {\n\t\t\tif (timeoutOptions.reject !== false) {\n\t\t\t\t// If the rejection is because of the timeout then\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst errorObject = err!;\n\t\t\t\terrorObject.message = `${\n\t\t\t\t\ttimeoutOptions.errorMsg ?? \"Forcing timeout before test does\"\n\t\t\t\t} (${currentTestTimeout.getTimeout()}ms)`;\n\t\t\t\tthrow errorObject;\n\t\t\t}\n\t\t\treturn timeoutOptions.value;\n\t\t}\n\t\tthrow e;\n\t}) as Promise<T>;\n}\n\n// Create a promise based on the timeout options\nasync function getTimeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T>,\n\terr: Error | undefined,\n) {\n\tconst timeout = timeoutOptions.durationMs ?? 0;\n\tif (timeout <= 0 || !Number.isFinite(timeout)) {\n\t\treturn new Promise(executor);\n\t}\n\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst timeoutRejections = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst errorObject = err!;\n\t\t\terrorObject.message = `${errorObject.message} (${timeout}ms)`;\n\t\t\treject(err);\n\t\t};\n\t\tconst timer = setTimeout(\n\t\t\t() =>\n\t\t\t\ttimeoutOptions.reject === false ? resolve(timeoutOptions.value) : timeoutRejections(),\n\t\t\ttimeout,\n\t\t);\n\n\t\texecutor(\n\t\t\t(value) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(reason) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\treject(reason);\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
1
+ {"version":3,"file":"timeoutUtils.js","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAAuE;AAGvE,MAAM,UAAU,GAAG,EAAE,CAAC,CAAC,2CAA2C;AAElE,yGAAyG;AACzG,uHAAuH;AACvH,sGAAsG;AACtG,uBAAuB;AACvB,0EAA0E;AAC1E,MAAM,WAAW;IAOT,MAAM,CAAC,KAAK,CAAC,QAAwB;QAC3C,WAAW,CAAC,KAAK,EAAE,CAAC;QACpB,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM,CAAC,KAAK;QAClB,IAAI,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACnC,WAAW,CAAC,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QAC1C,CAAC;aAAM,CAAC;YACP,WAAW,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;IACF,CAAC;IAEM,MAAM,CAA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;IAC9B,CAAC;IAED,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,MAAM,iBAAiB,GAAG,GAAG,EAAE;YAC9B,oEAAoE;YACpE,MAAM,WAAW,GAAG,GAAI,CAAC;YACzB,WAAW,CAAC,OAAO,GAAG,GAAG,WAAW,CAAC,OAAO,KAAK,OAAO,KAAK,CAAC;YAC9D,MAAM,CAAC,GAAG,CAAC,CAAC;QACb,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CACvB,GAAG,EAAE,CACJ,cAAc,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,EACtF,OAAO,CACP,CAAC;QAEF,QAAQ,CACP,CAAC,KAAK,EAAE,EAAE;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QAChB,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport type * as Mocha from \"mocha\";\n\nconst timeBuffer = 15; // leave 15 ms leeway for finish processing\n\n// TestTimeout class that manages tracking of test timeout. It creates a timer when timeout is in effect,\n// and provides a promise that will be rejected some time (as defined by `timeBuffer`) before the test timeout happens.\n// This will ensure that async awaits in tests do not end up timing out the tests but resolve / reject\n// before that happens.\n// Once rejected, a new TestTimeout object will be create for the timeout.\nclass TestTimeout {\n\tprivate timeout: number = 0;\n\tprivate timer: NodeJS.Timeout | undefined;\n\tprivate readonly deferred: Deferred<void>;\n\tprivate rejected = false;\n\n\tprivate static instance: TestTimeout = new TestTimeout();\n\tpublic static reset(runnable: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\tTestTimeout.instance.resetTimer(runnable);\n\t}\n\n\tpublic static clear() {\n\t\tif (TestTimeout.instance.rejected) {\n\t\t\tTestTimeout.instance = new TestTimeout();\n\t\t} else {\n\t\t\tTestTimeout.instance.clearTimer();\n\t\t}\n\t}\n\n\tpublic static getInstance() {\n\t\treturn TestTimeout.instance;\n\t}\n\n\tpublic async getPromise() {\n\t\treturn this.deferred.promise;\n\t}\n\n\tpublic getTimeout() {\n\t\treturn this.timeout;\n\t}\n\n\tprivate constructor() {\n\t\tthis.deferred = new Deferred();\n\t\t// Ignore rejection for timeout promise if no one is waiting for it.\n\t\tthis.deferred.promise.catch(() => {});\n\t}\n\n\tprivate resetTimer(runnable: Mocha.Runnable) {\n\t\tassert(!this.timer, \"clearTimer should have been called before reset\");\n\t\tassert(!this.deferred.isCompleted, \"can't reset a completed TestTimeout\");\n\n\t\t// Check the test timeout setting\n\t\tconst timeoutFromMochaTest = runnable.timeout();\n\t\tif (!(Number.isFinite(timeoutFromMochaTest) && timeoutFromMochaTest > 0)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// subtract a buffer\n\t\tthis.timeout = Math.max(timeoutFromMochaTest - timeBuffer, 1);\n\n\t\t// Set up timer to reject near the test timeout.\n\t\tthis.timer = setTimeout(() => {\n\t\t\tthis.deferred.reject(this);\n\t\t\tthis.rejected = true;\n\t\t}, this.timeout);\n\t}\n\tprivate clearTimer() {\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t}\n}\n\n// Only register if we are running with mocha-test-setup loaded (that package is what sets globalThis.getMochaModule).\nif (globalThis.getMochaModule !== undefined) {\n\t// Patch the private methods resetTimeout and clearTimeout on Mocha's runnable objects so we can do the appropriate\n\t// calls in TestTimeout above when the Mocha methods are called.\n\t// These are not part of the public API so if Mocha changes how it works, this could break.\n\t// See https://github.com/mochajs/mocha/blob/8d0ca3ed77ba8a704b2aa8b58267a084a475a51b/lib/runnable.js#L234.\n\tconst mochaModule = globalThis.getMochaModule() as typeof Mocha;\n\tconst runnablePrototype = mochaModule.Runnable.prototype;\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldResetTimeoutFunc = runnablePrototype.resetTimeout;\n\trunnablePrototype.resetTimeout = function (this: Mocha.Runnable) {\n\t\toldResetTimeoutFunc.call(this);\n\t\tTestTimeout.reset(this);\n\t};\n\t// eslint-disable-next-line @typescript-eslint/unbound-method\n\tconst oldClearTimeoutFunc = runnablePrototype.clearTimeout;\n\trunnablePrototype.clearTimeout = function (this: Mocha.Runnable) {\n\t\tTestTimeout.clear();\n\t\toldClearTimeoutFunc.call(this);\n\t};\n}\n\n/**\n * @internal\n */\nexport interface TimeoutDurationOption {\n\t/**\n\t * Timeout duration in milliseconds, if it is great than 0 and not Infinity\n\t * If it is undefined, then it will use test timeout if we are in side the test function\n\t * Otherwise, there is no timeout\n\t */\n\tdurationMs?: number;\n}\n\n/**\n * @internal\n */\nexport interface TimeoutWithError extends TimeoutDurationOption {\n\treject?: true;\n\terrorMsg?: string;\n\t// Since there are no required properties, this type explicitly\n\t// rejects `value` to avoid confusion with TimeoutWithValue.\n\tvalue?: never;\n}\n\n/**\n * @internal\n */\nexport interface TimeoutWithValue<T = void> extends TimeoutDurationOption {\n\treject: false;\n\tvalue: T;\n}\n\nexport type PromiseExecutor<T = void> = (\n\tresolve: (value: T | PromiseLike<T>) => void,\n\treject: (reason?: any) => void,\n) => void;\n\n/**\n * Wraps the given promise with another one that will complete after a specific timeout if the original promise does\n * not resolve by then.\n *\n * @remarks\n * If used inside a mocha test, it uses the test timeout by default and completes the returned promise just before\n * the test timeout hits, so that tests don't time out because of unpredictable awaits.\n * In that scenario the timeout can still be overridden via `timeoutOptions` but it's recommended to use the default value.\n *\n * @param promise - The promise to be wrapped.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when\n * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.\n * @returns A new promise that will complete when the given promise resolves or the timeout expires.\n * @internal\n */\nexport async function timeoutAwait<T = void>(\n\tpromise: PromiseLike<T>,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\treturn Promise.race([promise, timeoutPromise<T>(() => {}, timeoutOptions)]);\n}\n\n/**\n * Creates a promise from the given executor that will complete after a specific timeout.\n *\n * @remarks\n * If used inside a mocha test, it uses the test timeout by default and completes the returned promise just before\n * the test timeout hits, so that tests don't time out because of unpredictable awaits.\n * In that scenario the timeout can still be overridden via `timeoutOptions` but it's recommended to use the default value.\n *\n * @param executor - The executor for the promise.\n * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when\n * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.\n * @returns A new promise that will complete when the given executor resolves or the timeout expires.\n * @internal\n */\nexport async function timeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T> = {},\n): Promise<T> {\n\t// create the timeout error outside the async task, so its callstack includes\n\t// the original call site, this makes it easier to debug\n\tconst err =\n\t\ttimeoutOptions.reject === false\n\t\t\t? undefined\n\t\t\t: new Error(timeoutOptions.errorMsg ?? \"Timed out\");\n\tconst executorPromise = getTimeoutPromise(executor, timeoutOptions, err);\n\n\tconst currentTestTimeout = TestTimeout.getInstance();\n\tif (currentTestTimeout === undefined) {\n\t\treturn executorPromise;\n\t}\n\n\treturn Promise.race([executorPromise, currentTestTimeout.getPromise()]).catch((e) => {\n\t\tif (e === currentTestTimeout) {\n\t\t\tif (timeoutOptions.reject !== false) {\n\t\t\t\t// If the rejection is because of the timeout then\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst errorObject = err!;\n\t\t\t\terrorObject.message = `${\n\t\t\t\t\ttimeoutOptions.errorMsg ?? \"Forcing timeout before test does\"\n\t\t\t\t} (${currentTestTimeout.getTimeout()}ms)`;\n\t\t\t\tthrow errorObject;\n\t\t\t}\n\t\t\treturn timeoutOptions.value;\n\t\t}\n\t\tthrow e;\n\t}) as Promise<T>;\n}\n\n// Create a promise based on the timeout options\nasync function getTimeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeoutOptions: TimeoutWithError | TimeoutWithValue<T>,\n\terr: Error | undefined,\n) {\n\tconst timeout = timeoutOptions.durationMs ?? 0;\n\tif (timeout <= 0 || !Number.isFinite(timeout)) {\n\t\treturn new Promise(executor);\n\t}\n\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst timeoutRejections = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst errorObject = err!;\n\t\t\terrorObject.message = `${errorObject.message} (${timeout}ms)`;\n\t\t\treject(err);\n\t\t};\n\t\tconst timer = setTimeout(\n\t\t\t() =>\n\t\t\t\ttimeoutOptions.reject === false ? resolve(timeoutOptions.value) : timeoutRejections(),\n\t\t\ttimeout,\n\t\t);\n\n\t\texecutor(\n\t\t\t(value) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(reason) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\treject(reason);\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TestSummaryUtils.d.ts","sourceRoot":"","sources":["../src/TestSummaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,2CAA2C,EAAE,MAAM,mCAAmC,CAAC;AAChG,OAAO,EACN,UAAU,EACV,WAAW,EAEX,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,yBAAyB,EACzB,WAAW,EAEX,MAAM,4CA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EAAE,UAAU,EACrB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,cAAc,CAAC,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAAC,CAe7D;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,WAAW,EAEvB,MAAM,GAAE,MAAM,GAAG,yBAA6C,GAC5D,OAAO,CAAC,WAAW,CAAC,CAuCtB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,WAAW,EAAE,YAAY,CAAC;IAC1B;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;CACtB"}
@@ -123,7 +123,10 @@ export async function createSummarizer(provider, container, config, summaryVersi
123
123
  * Defaults to the reason "end-to-end test".
124
124
  * @internal
125
125
  */
126
- export async function summarizeNow(summarizer, inputs = "end-to-end test") {
126
+ export async function summarizeNow(summarizer,
127
+ // eslint-disable-next-line import/no-deprecated
128
+ inputs = "end-to-end test") {
129
+ // eslint-disable-next-line import/no-deprecated
127
130
  const options = typeof inputs === "string" ? { reason: inputs } : inputs;
128
131
  const result = summarizer.summarizeOnDemand(options);
129
132
  const submitResult = await timeoutAwait(result.summarySubmitted, {