@fluidframework/test-utils 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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 (68) hide show
  1. package/.eslintrc.js +8 -10
  2. package/README.md +41 -11
  3. package/api-extractor.json +2 -2
  4. package/dist/DriverWrappers.d.ts.map +1 -1
  5. package/dist/DriverWrappers.js.map +1 -1
  6. package/dist/TestConfigs.d.ts.map +1 -1
  7. package/dist/TestConfigs.js +3 -4
  8. package/dist/TestConfigs.js.map +1 -1
  9. package/dist/TestSummaryUtils.d.ts +20 -4
  10. package/dist/TestSummaryUtils.d.ts.map +1 -1
  11. package/dist/TestSummaryUtils.js +41 -33
  12. package/dist/TestSummaryUtils.js.map +1 -1
  13. package/dist/containerUtils.d.ts +29 -0
  14. package/dist/containerUtils.d.ts.map +1 -0
  15. package/dist/containerUtils.js +45 -0
  16. package/dist/containerUtils.js.map +1 -0
  17. package/dist/index.d.ts +5 -4
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +3 -4
  20. package/dist/index.js.map +1 -1
  21. package/dist/interfaces.d.ts.map +1 -1
  22. package/dist/interfaces.js.map +1 -1
  23. package/dist/loaderContainerTracker.d.ts +3 -9
  24. package/dist/loaderContainerTracker.d.ts.map +1 -1
  25. package/dist/loaderContainerTracker.js +45 -47
  26. package/dist/loaderContainerTracker.js.map +1 -1
  27. package/dist/localCodeLoader.d.ts.map +1 -1
  28. package/dist/localCodeLoader.js.map +1 -1
  29. package/dist/localLoader.d.ts.map +1 -1
  30. package/dist/localLoader.js.map +1 -1
  31. package/dist/packageVersion.d.ts +1 -1
  32. package/dist/packageVersion.js +1 -1
  33. package/dist/packageVersion.js.map +1 -1
  34. package/dist/retry.d.ts.map +1 -1
  35. package/dist/retry.js.map +1 -1
  36. package/dist/testContainerRuntimeFactory.d.ts +2 -2
  37. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  38. package/dist/testContainerRuntimeFactory.js +3 -3
  39. package/dist/testContainerRuntimeFactory.js.map +1 -1
  40. package/dist/testFluidObject.d.ts.map +1 -1
  41. package/dist/testFluidObject.js +7 -3
  42. package/dist/testFluidObject.js.map +1 -1
  43. package/dist/testObjectProvider.d.ts +6 -1
  44. package/dist/testObjectProvider.d.ts.map +1 -1
  45. package/dist/testObjectProvider.js +49 -16
  46. package/dist/testObjectProvider.js.map +1 -1
  47. package/dist/timeoutUtils.d.ts +11 -2
  48. package/dist/timeoutUtils.d.ts.map +1 -1
  49. package/dist/timeoutUtils.js +122 -18
  50. package/dist/timeoutUtils.js.map +1 -1
  51. package/package.json +65 -58
  52. package/prettier.config.cjs +1 -1
  53. package/src/DriverWrappers.ts +40 -37
  54. package/src/TestConfigs.ts +7 -7
  55. package/src/TestSummaryUtils.ts +123 -124
  56. package/src/containerUtils.ts +48 -0
  57. package/src/index.ts +24 -23
  58. package/src/interfaces.ts +10 -7
  59. package/src/loaderContainerTracker.ts +618 -577
  60. package/src/localCodeLoader.ts +85 -77
  61. package/src/localLoader.ts +24 -24
  62. package/src/packageVersion.ts +1 -1
  63. package/src/retry.ts +31 -25
  64. package/src/testContainerRuntimeFactory.ts +59 -56
  65. package/src/testFluidObject.ts +168 -152
  66. package/src/testObjectProvider.ts +477 -384
  67. package/src/timeoutUtils.ts +191 -41
  68. package/tsconfig.json +9 -12
@@ -1 +1 @@
1
- {"version":3,"file":"localLoader.js","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,uEAA0D;AAI1D,uDAAqE;AAErE;;;;;;GAMG;AACH,SAAgB,YAAY,CACxB,cAA8D,EAC9D,sBAA+C,EAC/C,WAAyB,EACzB,MAA6B,EAC7B,OAAwB;IAExB,MAAM,UAAU,GAAuB,IAAI,iCAAe,CAAC,cAAc,CAAC,CAAC;IAE3E,OAAO,IAAI,yBAAM,CAAC;QACd,WAAW;QACX,sBAAsB;QACtB,UAAU;QACV,MAAM;QACN,OAAO;KACV,CAAC,CAAC;AACP,CAAC;AAhBD,oCAgBC;AAED;;;;;GAKG;AAEI,KAAK,UAAU,wBAAwB,CAC1C,MAAyB,EACzB,MAAmB,EACnB,aAAuB;IAEvB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEtC,OAAO,SAAS,CAAC;AACrB,CAAC;AATD,4DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ICodeDetailsLoader,\n IContainer,\n IHostLoader,\n ILoaderOptions,\n IFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\n\n/**\n * Creates a loader with the given package entries and driver.\n * @param packageEntries - A list of code details to Fluid entry points.\n * @param documentServiceFactory - the driver factory to use\n * @param urlResolver - the url resolver to use\n * @param options - loader options\n */\nexport function createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n documentServiceFactory: IDocumentServiceFactory,\n urlResolver: IUrlResolver,\n logger?: ITelemetryBaseLogger,\n options?: ILoaderOptions,\n): IHostLoader {\n const codeLoader: ICodeDetailsLoader = new LocalCodeLoader(packageEntries);\n\n return new Loader({\n urlResolver,\n documentServiceFactory,\n codeLoader,\n logger,\n options,\n });\n}\n\n/**\n * Creates a detached Container and attaches it.\n * @param source - The code details used to create the Container.\n * @param loader - The loader to use to initialize the container.\n * @param attachRequest - The request to create new from.\n */\n\nexport async function createAndAttachContainer(\n source: IFluidCodeDetails,\n loader: IHostLoader,\n attachRequest: IRequest,\n): Promise<IContainer> {\n const container = await loader.createDetachedContainer(source);\n await container.attach(attachRequest);\n\n return container;\n}\n"]}
1
+ {"version":3,"file":"localLoader.js","sourceRoot":"","sources":["../src/localLoader.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,uEAA0D;AAI1D,uDAAqE;AAErE;;;;;;GAMG;AACH,SAAgB,YAAY,CAC3B,cAA8D,EAC9D,sBAA+C,EAC/C,WAAyB,EACzB,MAA6B,EAC7B,OAAwB;IAExB,MAAM,UAAU,GAAuB,IAAI,iCAAe,CAAC,cAAc,CAAC,CAAC;IAE3E,OAAO,IAAI,yBAAM,CAAC;QACjB,WAAW;QACX,sBAAsB;QACtB,UAAU;QACV,MAAM;QACN,OAAO;KACP,CAAC,CAAC;AACJ,CAAC;AAhBD,oCAgBC;AAED;;;;;GAKG;AAEI,KAAK,UAAU,wBAAwB,CAC7C,MAAyB,EACzB,MAAmB,EACnB,aAAuB;IAEvB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEtC,OAAO,SAAS,CAAC;AAClB,CAAC;AATD,4DASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tICodeDetailsLoader,\n\tIContainer,\n\tIHostLoader,\n\tILoaderOptions,\n\tIFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\n\n/**\n * Creates a loader with the given package entries and driver.\n * @param packageEntries - A list of code details to Fluid entry points.\n * @param documentServiceFactory - the driver factory to use\n * @param urlResolver - the url resolver to use\n * @param options - loader options\n */\nexport function createLoader(\n\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\tdocumentServiceFactory: IDocumentServiceFactory,\n\turlResolver: IUrlResolver,\n\tlogger?: ITelemetryBaseLogger,\n\toptions?: ILoaderOptions,\n): IHostLoader {\n\tconst codeLoader: ICodeDetailsLoader = new LocalCodeLoader(packageEntries);\n\n\treturn new Loader({\n\t\turlResolver,\n\t\tdocumentServiceFactory,\n\t\tcodeLoader,\n\t\tlogger,\n\t\toptions,\n\t});\n}\n\n/**\n * Creates a detached Container and attaches it.\n * @param source - The code details used to create the Container.\n * @param loader - The loader to use to initialize the container.\n * @param attachRequest - The request to create new from.\n */\n\nexport async function createAndAttachContainer(\n\tsource: IFluidCodeDetails,\n\tloader: IHostLoader,\n\tattachRequest: IRequest,\n): Promise<IContainer> {\n\tconst container = await loader.createDetachedContainer(source);\n\tawait container.attach(attachRequest);\n\n\treturn container;\n}\n"]}
@@ -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.0.0-dev.2.3.0.115467";
8
+ export declare const pkgVersion = "2.0.0-dev.4.1.0.148229";
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.0.0-dev.2.3.0.115467";
11
+ exports.pkgVersion = "2.0.0-dev.4.1.0.148229";
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,wBAAwB,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.0.0-dev.2.3.0.115467\";\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,wBAAwB,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.0.0-dev.4.1.0.148229\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,uDAEV,OAAO,uEAWK,CAAC"}
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,uDAEb,OAAO,uEAiB3B,CAAC"}
package/dist/retry.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAqD;AAErD,MAAM,KAAK,GAAG,KAAK,EACf,QAA0B,EAC1B,YAAe,EACf,QAAgB,EAChB,SAAiB,EACP,EAAE;IACZ,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,EAAE,EAAE;QAC3D,IAAI;YACA,MAAM,MAAM,GAAG,MAAM,QAAQ,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC;SACjB;QAAC,OAAO,KAAK,EAAE;YACZ,MAAM,IAAA,oBAAK,EAAC,UAAU,GAAG,SAAS,CAAC,CAAC;SACvC;KACJ;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,sBAAsB,GAAG,KAAK,EACvC,QAA0B,EAC1B,KAA4B,EAC5B,YAAe,EACf,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,EAAE,EACJ,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;IAC9B,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;QACd,OAAO,KAAK,CAAC;KAChB;IAED,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;AAC7B,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAbzB,QAAA,sBAAsB,0BAaG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { delay } from \"@fluidframework/common-utils\";\n\nconst retry = async <T>(\n callback: () => Promise<T>,\n defaultValue: T,\n maxTries: number,\n backOffMs: number,\n): Promise<T> => {\n for (let currentTry = 1; currentTry <= maxTries; currentTry++) {\n try {\n const result = await callback();\n return result;\n } catch (error) {\n await delay(currentTry * backOffMs);\n }\n }\n\n return Promise.resolve(defaultValue);\n};\n\n/**\n * Simple retry mechanism with linear back off to call\n * a function which may eventually return an accepted value.\n *\n * @param callback - the function to execute\n * @param check - the function to check if the value is acceptable\n * @param defaultValue - the default value\n * @param maxTries - maximum number of attempts\n * @param backOffMs - back off between attempts in milliseconds\n * @returns the actual value from the callback when successful or the default value otherwise\n */\nexport const retryWithEventualValue = async <T>(\n callback: () => Promise<T>,\n check: (value: T) => boolean,\n defaultValue: T,\n maxTries = 20,\n backOffMs = 50,\n): Promise<T> => retry(async () => {\n const value = await callback();\n if (check(value)) {\n return value;\n }\n\n throw Error(\"Not ready\");\n}, defaultValue, maxTries, backOffMs);\n"]}
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAqD;AAErD,MAAM,KAAK,GAAG,KAAK,EAClB,QAA0B,EAC1B,YAAe,EACf,QAAgB,EAChB,SAAiB,EACJ,EAAE;IACf,KAAK,IAAI,UAAU,GAAG,CAAC,EAAE,UAAU,IAAI,QAAQ,EAAE,UAAU,EAAE,EAAE;QAC9D,IAAI;YACH,MAAM,MAAM,GAAG,MAAM,QAAQ,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC;SACd;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,IAAA,oBAAK,EAAC,UAAU,GAAG,SAAS,CAAC,CAAC;SACpC;KACD;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,MAAM,sBAAsB,GAAG,KAAK,EAC1C,QAA0B,EAC1B,KAA4B,EAC5B,YAAe,EACf,QAAQ,GAAG,EAAE,EACb,SAAS,GAAG,EAAE,EACD,EAAE,CACf,KAAK,CACJ,KAAK,IAAI,EAAE;IACV,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC;KACb;IAED,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;AAC1B,CAAC,EACD,YAAY,EACZ,QAAQ,EACR,SAAS,CACT,CAAC;AAnBU,QAAA,sBAAsB,0BAmBhC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { delay } from \"@fluidframework/common-utils\";\n\nconst retry = async <T>(\n\tcallback: () => Promise<T>,\n\tdefaultValue: T,\n\tmaxTries: number,\n\tbackOffMs: number,\n): Promise<T> => {\n\tfor (let currentTry = 1; currentTry <= maxTries; currentTry++) {\n\t\ttry {\n\t\t\tconst result = await callback();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tawait delay(currentTry * backOffMs);\n\t\t}\n\t}\n\n\treturn Promise.resolve(defaultValue);\n};\n\n/**\n * Simple retry mechanism with linear back off to call\n * a function which may eventually return an accepted value.\n *\n * @param callback - the function to execute\n * @param check - the function to check if the value is acceptable\n * @param defaultValue - the default value\n * @param maxTries - maximum number of attempts\n * @param backOffMs - back off between attempts in milliseconds\n * @returns the actual value from the callback when successful or the default value otherwise\n */\nexport const retryWithEventualValue = async <T>(\n\tcallback: () => Promise<T>,\n\tcheck: (value: T) => boolean,\n\tdefaultValue: T,\n\tmaxTries = 20,\n\tbackOffMs = 50,\n): Promise<T> =>\n\tretry(\n\t\tasync () => {\n\t\t\tconst value = await callback();\n\t\t\tif (check(value)) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tthrow Error(\"Not ready\");\n\t\t},\n\t\tdefaultValue,\n\t\tmaxTries,\n\t\tbackOffMs,\n\t);\n"]}
@@ -20,7 +20,7 @@ export declare const createTestContainerRuntimeFactory: (containerRuntimeCtor: t
20
20
  instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
21
21
  preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & IContainerRuntime>;
22
22
  readonly IRuntimeFactory: any;
23
- instantiateRuntime(context: IContainerContext, existing?: boolean | undefined): Promise<IRuntime>;
23
+ instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
24
24
  hasInitialized(_runtime: IContainerRuntime): Promise<void>;
25
25
  };
26
26
  };
@@ -37,7 +37,7 @@ export declare const TestContainerRuntimeFactory: {
37
37
  instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
38
38
  preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & IContainerRuntime>;
39
39
  readonly IRuntimeFactory: any;
40
- instantiateRuntime(context: IContainerContext, existing?: boolean | undefined): Promise<IRuntime>;
40
+ instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
41
41
  hasInitialized(_runtime: IContainerRuntime): Promise<void>;
42
42
  };
43
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"testContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EACH,gBAAgB,EAChB,wBAAwB,EAE3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAEH,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAG7E;;GAEG;AACH,eAAO,MAAM,iCAAiC,yBAA0B,uBAAuB;eAGtE,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKR,gBAAgB,GAAG,QAAQ,IAAI,CAAC;yCAM7B,gBAAgB,GAAG,QAAQ,IAAI,CAAC;+BAOjE,iBAAiB,YAChB,OAAO,GAClB,QAAQ,QAAQ,GAAG,iBAAiB,CAAC;;;;;CAmB/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B;eAxDf,MAAM,oBACM,sBAAsB,mBACxB,wBAAwB,oBAUvB,qBAAqB,EAAE;cAZlC,MAAM;0BACM,sBAAsB;wBACxB,wBAAwB;yBAUvB,qBAAqB,EAAE;sCAKR,gBAAgB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iB,CAAC;;;;;CAwBoD,CAAC"}
@@ -29,7 +29,8 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
29
29
  }
30
30
  async instantiateFirstTime(runtime) {
31
31
  const rootContext = runtime.createDetachedRootDataStore([this.type], "default");
32
- const rootRuntime = await this.dataStoreFactory.instantiateDataStore(rootContext, /* existing */ false);
32
+ const rootRuntime = await this.dataStoreFactory.instantiateDataStore(rootContext,
33
+ /* existing */ false);
33
34
  await rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);
34
35
  }
35
36
  async instantiateFromExisting(runtime) {
@@ -41,8 +42,7 @@ const createTestContainerRuntimeFactory = (containerRuntimeCtor) => {
41
42
  const runtime = await containerRuntimeCtor.load(context, [
42
43
  ["default", Promise.resolve(this.dataStoreFactory)],
43
44
  [this.type, Promise.resolve(this.dataStoreFactory)],
44
- ], (0, request_handler_1.buildRuntimeRequestHandler)((0, aqueduct_1.defaultRouteRequestHandler)("default"), ...this.requestHandlers), this.runtimeOptions, undefined, // containerScope
45
- existing);
45
+ ], (0, request_handler_1.buildRuntimeRequestHandler)((0, aqueduct_1.defaultRouteRequestHandler)("default"), ...this.requestHandlers), this.runtimeOptions, context.scope, existing);
46
46
  return runtime;
47
47
  }
48
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,qEAEmE;AAEnE,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAAC,oBAA6C,EAAE,EAAE;IAC/F,OAAO,KAAM,SAAQ,oCAAoB;QACrC,YACW,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YAC9C,cAAc,EAAE;gBACZ,sBAAsB,kCACf,+CAA2B,GAC3B;oBACC,wBAAwB,EAAE,CAAC;iBAC9B,CACJ;aACJ;SACJ,EACM,kBAA2C,EAAE;YA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GAEG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport {\n ContainerRuntime,\n IContainerRuntimeOptions,\n DefaultSummaryConfiguration,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport {\n buildRuntimeRequestHandler,\n RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\n */\nexport const createTestContainerRuntimeFactory = (containerRuntimeCtor: typeof ContainerRuntime) => {\n return class extends RuntimeFactoryHelper {\n constructor(\n public type: string,\n public dataStoreFactory: IFluidDataStoreFactory,\n public runtimeOptions: IContainerRuntimeOptions = {\n summaryOptions: {\n summaryConfigOverrides: {\n ...DefaultSummaryConfiguration,\n ...{\n initialSummarizerDelayMs: 0,\n },\n },\n },\n },\n public requestHandlers: RuntimeRequestHandler[] = [],\n ) {\n super();\n }\n\n public async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n const rootContext = runtime.createDetachedRootDataStore([this.type], \"default\");\n const rootRuntime = await this.dataStoreFactory.instantiateDataStore(rootContext, /* existing */ false);\n await rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\n }\n\n public async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n // Validate we can load root data stores.\n // We should be able to load any data store that was created in initializeFirstTime!\n await runtime.getRootDataStore(\"default\");\n }\n\n async preInitialize(\n context: IContainerContext,\n existing: boolean,\n ): Promise<IRuntime & IContainerRuntime> {\n const runtime: ContainerRuntime = await containerRuntimeCtor.load(\n context,\n [\n [\"default\", Promise.resolve(this.dataStoreFactory)],\n [this.type, Promise.resolve(this.dataStoreFactory)],\n ],\n buildRuntimeRequestHandler(\n defaultRouteRequestHandler(\"default\"),\n ...this.requestHandlers,\n ),\n this.runtimeOptions,\n undefined, // containerScope\n existing,\n );\n\n return runtime;\n }\n };\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
1
+ {"version":3,"file":"testContainerRuntimeFactory.js","sourceRoot":"","sources":["../src/testContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAsE;AAEtE,yEAI2C;AAE3C,qEAAoG;AAEpG,iEAAqE;AAErE;;GAEG;AACI,MAAM,iCAAiC,GAAG,CAChD,oBAA6C,EAC5C,EAAE;IACH,OAAO,KAAM,SAAQ,oCAAoB;QACxC,YACQ,IAAY,EACZ,gBAAwC,EACxC,iBAA2C;YACjD,cAAc,EAAE;gBACf,sBAAsB,kCAClB,+CAA2B,GAC3B;oBACF,wBAAwB,EAAE,CAAC;iBAC3B,CACD;aACD;SACD,EACM,kBAA2C,EAAE;YAEpD,KAAK,EAAE,CAAC;YAdD,SAAI,GAAJ,IAAI,CAAQ;YACZ,qBAAgB,GAAhB,gBAAgB,CAAwB;YACxC,mBAAc,GAAd,cAAc,CASpB;YACM,oBAAe,GAAf,eAAe,CAA8B;QAGrD,CAAC;QAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;YAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;YAChF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,CACnE,WAAW;YACX,cAAc,CAAC,KAAK,CACpB,CAAC;YACF,MAAM,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;QACrE,CAAC;QAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;YAC7D,yCAAyC;YACzC,oFAAoF;YACpF,MAAM,OAAO,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,CAAC,aAAa,CAClB,OAA0B,EAC1B,QAAiB;YAEjB,MAAM,OAAO,GAAqB,MAAM,oBAAoB,CAAC,IAAI,CAChE,OAAO,EACP;gBACC,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACnD,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACnD,EACD,IAAA,4CAA0B,EACzB,IAAA,qCAA0B,EAAC,SAAS,CAAC,EACrC,GAAG,IAAI,CAAC,eAAe,CACvB,EACD,IAAI,CAAC,cAAc,EACnB,OAAO,CAAC,KAAK,EACb,QAAQ,CACR,CAAC;YAEF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AA3DW,QAAA,iCAAiC,qCA2D5C;AAEF;;GAEG;AACU,QAAA,2BAA2B,GAAG,IAAA,yCAAiC,EAAC,oCAAgB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultRouteRequestHandler } from \"@fluidframework/aqueduct\";\nimport { IContainerContext, IRuntime } from \"@fluidframework/container-definitions\";\nimport {\n\tContainerRuntime,\n\tIContainerRuntimeOptions,\n\tDefaultSummaryConfiguration,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { buildRuntimeRequestHandler, RuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\n\n/**\n * Create a container runtime factory class that allows you to set runtime options\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: IContainerRuntimeOptions = {\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\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\tconst rootContext = runtime.createDetachedRootDataStore([this.type], \"default\");\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\tawait rootContext.attachRuntime(this.dataStoreFactory, rootRuntime);\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\tawait runtime.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\tconst runtime: ContainerRuntime = await containerRuntimeCtor.load(\n\t\t\t\tcontext,\n\t\t\t\t[\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\tbuildRuntimeRequestHandler(\n\t\t\t\t\tdefaultRouteRequestHandler(\"default\"),\n\t\t\t\t\t...this.requestHandlers,\n\t\t\t\t),\n\t\t\t\tthis.runtimeOptions,\n\t\t\t\tcontext.scope,\n\t\t\t\texisting,\n\t\t\t);\n\n\t\t\treturn runtime;\n\t\t}\n\t};\n};\n\n/**\n * A container runtime factory that allows you to set runtime options\n */\nexport const TestContainerRuntimeFactory = createTestContainerRuntimeFactory(ContainerRuntime);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.d.ts","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EAGf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAqB,qBAAqB,EAAuB,MAAM,2BAA2B,CAAC;AAC1G,OAAO,EAAa,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,gBAAgB,EAAE,YAAY;aAuC9C,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;aAC/B,OAAO,EAAE,sBAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;WAzClB,IAAI,CACpB,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,sBAAsB,EAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC5C,QAAQ,EAAE,OAAO;IAQrB,IAAW,gBAAgB,SAE1B;IAED,IAAW,cAAc,SAExB;IAED,IAAW,YAAY,SAEtB;IAED,IAAW,MAAM,IAAI,YA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AAO,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"}
@@ -43,7 +43,9 @@ class TestFluidObject {
43
43
  get IFluidRouter() {
44
44
  return this;
45
45
  }
46
- get handle() { return this.innerHandle; }
46
+ get handle() {
47
+ return this.innerHandle;
48
+ }
47
49
  /**
48
50
  * Retrieves a shared object with the given id.
49
51
  * @param id - The id of the shared object to retrieve.
@@ -72,7 +74,7 @@ class TestFluidObject {
72
74
  });
73
75
  this.root.bindToContext();
74
76
  }
75
- this.root = await this.runtime.getChannel("root");
77
+ this.root = (await this.runtime.getChannel("root"));
76
78
  }
77
79
  }
78
80
  exports.TestFluidObject = TestFluidObject;
@@ -111,7 +113,9 @@ class TestFluidObjectFactory {
111
113
  this.factoryEntries = factoryEntries;
112
114
  this.type = type;
113
115
  }
114
- get IFluidDataStoreFactory() { return this; }
116
+ get IFluidDataStoreFactory() {
117
+ return this;
118
+ }
115
119
  async instantiateDataStore(context, existing) {
116
120
  const dataTypes = new Map();
117
121
  // Add SharedMap's factory which will be used to create the root map.
@@ -1 +1 @@
1
- {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAA4E;AAS5E,yDAA0G;AAC1G,6CAA4D;AAO5D,+DAAsD;AAGtD;;;;GAIG;AACH,MAAa,eAAe;IA+BxB;;;;;;OAMG;IACH,YACoB,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,sBAAi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AAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE;YACrC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACzB,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACxC;QAED,uGAAuG;QACvG,8BAA8B;QAC9B,MAAM,0BAA0B,GAAG,IAAI,GAAG,EAA2B,CAAC;QACtE,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE;YACrC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,EAAE,KAAK,SAAS,EAAE;gBAClB,0BAA0B,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAChD;SACJ;QAED,MAAM,YAAY,GAAG,IAAA,+BAAmB,EACpC,KAAK,EAAE,OAAiB,EAAE,EAAyB,EAAE,EAAE;;YACnD,MAAM,WAAW,GACX,MAAM,CAAA,MAAA,EAAE,CAAC,UAAU,0CAAE,GAAG,EAAE,CAAA,CAAC;YACjC,IAAA,qBAAM,EAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY,MAAK,SAAS,EAAE,gDAAgD,CAAC,CAAC;YAClG,OAAO,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEP,OAAO,IAAI,YAAY,CACnB,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAK,EAAE,gBAAwC,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CACpE,gBAAgB;QAChB,oGAAoG;QACpG,iGAAiG;QACjG,gBAAyC,EACzC,OAAO,EACP,0BAA0B,EAC1B,QAAQ,CACX,CAAC,CAAC;IACX,CAAC;CACJ;AA5DD,wDA4DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport {\n IRequest,\n IResponse,\n IFluidHandle,\n IFluidRouter,\n FluidObject,\n IProvideFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle, FluidDataStoreRuntime, mixinRequestHandler } from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n IFluidDataStoreContext,\n IFluidDataStoreFactory,\n IFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ITestFluidObject } from \"./interfaces\";\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 */\nexport class TestFluidObject implements ITestFluidObject, IFluidRouter {\n public static async load(\n runtime: IFluidDataStoreRuntime,\n channel: IFluidDataStoreChannel,\n context: IFluidDataStoreContext,\n factoryEntries: Map<string, IChannelFactory>,\n existing: boolean,\n ) {\n const fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);\n await fluidObject.initialize(existing);\n\n return fluidObject;\n }\n\n public get ITestFluidObject() {\n return this;\n }\n\n public get IFluidLoadable() {\n return this;\n }\n\n public get IFluidRouter() {\n return this;\n }\n\n public get handle(): IFluidHandle<this> { return this.innerHandle; }\n\n public root!: ISharedMap;\n private readonly innerHandle: IFluidHandle<this>;\n\n /**\n * Creates a new TestFluidObject.\n * @param runtime - The data store runtime.\n * @param context - The data store context.\n * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,\n * a shared object is created which can be retrieved by calling getSharedObject() with the id;\n */\n constructor(\n public readonly runtime: IFluidDataStoreRuntime,\n public readonly channel: IFluidDataStoreChannel,\n public readonly context: IFluidDataStoreContext,\n private readonly factoryEntriesMap: Map<string, IChannelFactory>,\n ) {\n this.innerHandle = new FluidObjectHandle(this, \"\", runtime.objectsRoutingContext);\n }\n\n /**\n * Retrieves a shared object with the given id.\n * @param id - The id of the shared object to retrieve.\n */\n public async getSharedObject<T = any>(id: string): Promise<T> {\n if (this.factoryEntriesMap === undefined) {\n throw new Error(\"Shared objects were not provided during creation.\");\n }\n\n for (const key of this.factoryEntriesMap.keys()) {\n if (key === id) {\n const handle = this.root.get<IFluidHandle>(id);\n return handle?.get() as unknown as T;\n }\n }\n\n throw new Error(`Shared object with id ${id} not found.`);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n return defaultFluidObjectRequestHandler(this, request);\n }\n\n private async initialize(existing: boolean) {\n if (!existing) {\n this.root = SharedMap.create(this.runtime, \"root\");\n\n this.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n const sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n this.root.set(key, sharedObject.handle);\n });\n\n this.root.bindToContext();\n }\n\n this.root = await this.runtime.getChannel(\"root\") as ISharedMap;\n }\n}\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 * 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 */\nexport class TestFluidObjectFactory implements IFluidDataStoreFactory {\n public get IFluidDataStoreFactory() { return this; }\n\n /**\n * Creates a new TestFluidObjectFactory.\n * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each\n * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object\n * for it.\n */\n constructor(private readonly factoryEntries: ChannelFactoryRegistry,\n public readonly type = \"TestFluidObjectFactory\") { }\n\n public async instantiateDataStore(\n context: IFluidDataStoreContext,\n existing: boolean,\n ): Promise<FluidDataStoreRuntime> {\n const dataTypes = new Map<string, IChannelFactory>();\n\n // Add SharedMap's factory which will be used to create the root map.\n const sharedMapFactory = SharedMap.getFactory();\n dataTypes.set(sharedMapFactory.type, sharedMapFactory);\n\n // Add the object factories to the list to be sent to data store runtime.\n for (const entry of this.factoryEntries) {\n const factory = entry[1];\n dataTypes.set(factory.type, factory);\n }\n\n // Create a map from the factory entries with entries that don't have the id as undefined. This will be\n // passed to the Fluid object.\n const factoryEntriesMapForObject = new Map<string, IChannelFactory>();\n for (const entry of this.factoryEntries) {\n const id = entry[0];\n if (id !== undefined) {\n factoryEntriesMapForObject.set(id, entry[1]);\n }\n }\n\n const runtimeClass = mixinRequestHandler(\n async (request: IRequest, rt: FluidDataStoreRuntime) => {\n const maybeRouter: FluidObject<IProvideFluidRouter> | undefined\n = await rt.entryPoint?.get();\n assert(maybeRouter?.IFluidRouter !== undefined, \"entryPoint should have been initialized by now\");\n return maybeRouter.IFluidRouter.request(request);\n });\n\n return new runtimeClass(\n context,\n dataTypes,\n existing,\n async (dataStoreRuntime: IFluidDataStoreRuntime) => TestFluidObject.load(\n dataStoreRuntime,\n // This works because 'runtime' is an instance of runtimeClass (which is a FluidDataStoreRuntime and\n // thus implements IFluidDataStoreChannel) which passes itself as the parameter to this function.\n dataStoreRuntime as FluidDataStoreRuntime,\n context,\n factoryEntriesMapForObject,\n existing,\n ));\n }\n}\n"]}
1
+ {"version":3,"file":"testFluidObject.js","sourceRoot":"","sources":["../src/testFluidObject.ts"],"names":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AAS,EACT,QAAQ,EACR,KAAK,EAAE,gBAAwC,EAAE,EAAE,CAClD,eAAe,CAAC,IAAI,CACnB,gBAAgB;QAChB,oGAAoG;QACpG,iGAAiG;QACjG,gBAAyC,EACzC,OAAO,EACP,0BAA0B,EAC1B,QAAQ,CACR,CACF,CAAC;IACH,CAAC;CACD;AAtED,wDAsEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { defaultFluidObjectRequestHandler } from \"@fluidframework/aqueduct\";\nimport {\n\tIRequest,\n\tIResponse,\n\tIFluidHandle,\n\tIFluidRouter,\n\tFluidObject,\n\tIProvideFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidObjectHandle,\n\tFluidDataStoreRuntime,\n\tmixinRequestHandler,\n} from \"@fluidframework/datastore\";\nimport { SharedMap, ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidDataStoreRuntime, IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ITestFluidObject } from \"./interfaces\";\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 */\nexport class TestFluidObject implements ITestFluidObject, IFluidRouter {\n\tpublic static async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tchannel: IFluidDataStoreChannel,\n\t\tcontext: IFluidDataStoreContext,\n\t\tfactoryEntries: Map<string, IChannelFactory>,\n\t\texisting: boolean,\n\t) {\n\t\tconst fluidObject = new TestFluidObject(runtime, channel, context, factoryEntries);\n\t\tawait fluidObject.initialize(existing);\n\n\t\treturn fluidObject;\n\t}\n\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 IFluidRouter() {\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\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 unknown as 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 defaultFluidObjectRequestHandler(this, request);\n\t}\n\n\tprivate async initialize(existing: boolean) {\n\t\tif (!existing) {\n\t\t\tthis.root = SharedMap.create(this.runtime, \"root\");\n\n\t\t\tthis.factoryEntriesMap.forEach((sharedObjectFactory: IChannelFactory, key: string) => {\n\t\t\t\tconst sharedObject = this.runtime.createChannel(key, sharedObjectFactory.type);\n\t\t\t\tthis.root.set(key, sharedObject.handle);\n\t\t\t});\n\n\t\t\tthis.root.bindToContext();\n\t\t}\n\n\t\tthis.root = (await this.runtime.getChannel(\"root\")) as ISharedMap;\n\t}\n}\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 * 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 */\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 entry of this.factoryEntries) {\n\t\t\tconst factory = entry[1];\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 entry of this.factoryEntries) {\n\t\t\tconst id = entry[0];\n\t\t\tif (id !== undefined) {\n\t\t\t\tfactoryEntriesMapForObject.set(id, entry[1]);\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\tconst maybeRouter: FluidObject<IProvideFluidRouter> | undefined =\n\t\t\t\t\tawait rt.entryPoint?.get();\n\t\t\t\tassert(\n\t\t\t\t\tmaybeRouter?.IFluidRouter !== undefined,\n\t\t\t\t\t\"entryPoint should have been initialized by now\",\n\t\t\t\t);\n\t\t\t\treturn maybeRouter.IFluidRouter.request(request);\n\t\t\t},\n\t\t);\n\n\t\treturn new runtimeClass(\n\t\t\tcontext,\n\t\t\tdataTypes,\n\t\t\texisting,\n\t\t\tasync (dataStoreRuntime: IFluidDataStoreRuntime) =>\n\t\t\t\tTestFluidObject.load(\n\t\t\t\t\tdataStoreRuntime,\n\t\t\t\t\t// This works because 'runtime' is an instance of runtimeClass (which is a FluidDataStoreRuntime and\n\t\t\t\t\t// thus implements IFluidDataStoreChannel) which passes itself as the parameter to this function.\n\t\t\t\t\tdataStoreRuntime as FluidDataStoreRuntime,\n\t\t\t\t\tcontext,\n\t\t\t\t\tfactoryEntriesMapForObject,\n\t\t\t\t\texisting,\n\t\t\t\t),\n\t\t);\n\t}\n}\n"]}
@@ -56,6 +56,8 @@ export interface ITestContainerConfig {
56
56
  registry?: ChannelFactoryRegistry;
57
57
  /** Container runtime options for the container instance */
58
58
  runtimeOptions?: IContainerRuntimeOptions;
59
+ /** Whether this runtime should be instantiated using a mixed-in attributor class */
60
+ enableAttribution?: boolean;
59
61
  /** Loader options for the loader used to create containers */
60
62
  loaderProps?: Partial<ILoaderProps>;
61
63
  }
@@ -68,7 +70,10 @@ export declare const createDocumentId: () => string;
68
70
  */
69
71
  export declare class EventAndErrorTrackingLogger extends TelemetryLogger {
70
72
  private readonly baseLogger;
71
- /** Even if these error events are logged, tests should still be allowed to pass */
73
+ /**
74
+ * Even if these error events are logged, tests should still be allowed to pass
75
+ * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
76
+ */
72
77
  private readonly allowedErrors;
73
78
  constructor(baseLogger: ITelemetryBaseLogger);
74
79
  private readonly expectedEvents;
@@ -1 +1 @@
1
- {"version":3,"file":"testObjectProvider.d.ts","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACvH,OAAO,EACH,YAAY,EACZ,MAAM,EAET,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEzG,OAAO,EAAE,WAAW,EAAmB,MAAM,yCAAyC,CAAC;AAEvF,OAAO,EAAgC,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAO3D,MAAM,WAAW,uBAAuB;IACpC,eAAe,CAAC,GAAG,UAAU,EAAE,UAAU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Aa,CAAC,EAAE,cAAc,GAC5B,OAAO,CAAC,UAAU,CAAC;IAWf,KAAK;IAaC,kBAAkB,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,sBAAsB,CAAC,SAAS,EAAE,UAAU;IAYzD,gBAAgB,CAAC,WAAW,EAAE,YAAY,GAAG,SAAS;IAI/C,2BAA2B,CAAC,qBAAqB,GAAE,OAAe;CAIzE;AAED,wBAAgB,8BAA8B,CAC7C,MAAM,EAAE,2BAA2B,GAAG,SAAS,EAC/C,MAAM,CAAC,EAAE,MAAM,qBAwBf"}
@@ -5,6 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.getUnexpectedLogErrorException = exports.TestObjectProvider = exports.EventAndErrorTrackingLogger = exports.createDocumentId = exports.DataObjectFactoryType = void 0;
8
+ const container_definitions_1 = require("@fluidframework/container-definitions");
8
9
  const container_loader_1 = require("@fluidframework/container-loader");
9
10
  const driver_utils_1 = require("@fluidframework/driver-utils");
10
11
  const uuid_1 = require("uuid");
@@ -34,7 +35,9 @@ function getDocumentIdStrategy(type) {
34
35
  return {
35
36
  get: () => documentId,
36
37
  update: () => { },
37
- reset: () => { documentId = (0, exports.createDocumentId)(); },
38
+ reset: () => {
39
+ documentId = (0, exports.createDocumentId)();
40
+ },
38
41
  };
39
42
  default:
40
43
  return {
@@ -45,7 +48,9 @@ function getDocumentIdStrategy(type) {
45
48
  (0, driver_utils_1.ensureFluidResolvedUrl)(resolvedUrl);
46
49
  documentId = (_a = resolvedUrl.id) !== null && _a !== void 0 ? _a : documentId;
47
50
  },
48
- reset: () => { documentId = (0, exports.createDocumentId)(); },
51
+ reset: () => {
52
+ documentId = (0, exports.createDocumentId)();
53
+ },
49
54
  };
50
55
  }
51
56
  }
@@ -59,10 +64,18 @@ class EventAndErrorTrackingLogger extends telemetry_utils_1.TelemetryLogger {
59
64
  constructor(baseLogger) {
60
65
  super();
61
66
  this.baseLogger = baseLogger;
62
- /** Even if these error events are logged, tests should still be allowed to pass */
67
+ /**
68
+ * Even if these error events are logged, tests should still be allowed to pass
69
+ * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
70
+ */
63
71
  this.allowedErrors = [
64
72
  // This log was removed in current version as unnecessary, but it's still present in previous versions
65
- "fluid:telemetry:Container:NoRealStorageInDetachedContainer",
73
+ {
74
+ eventName: "fluid:telemetry:Container:NoRealStorageInDetachedContainer",
75
+ downgrade: true,
76
+ },
77
+ // This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.
78
+ { eventName: "fluid:telemetry:OpPerf:OpRoundtripTime" },
66
79
  ];
67
80
  this.expectedEvents = [];
68
81
  this.unexpectedErrors = [];
@@ -71,8 +84,8 @@ class EventAndErrorTrackingLogger extends telemetry_utils_1.TelemetryLogger {
71
84
  if (this.expectedEvents.length !== 0) {
72
85
  // we don't have to error here. just no reason not to. given the events must be
73
86
  // ordered it could be tricky to figure out problems around multiple registrations.
74
- throw new Error("Expected events already registered.\n"
75
- + "Call reportAndClearTrackedEvents to clear them before registering more");
87
+ throw new Error("Expected events already registered.\n" +
88
+ "Call reportAndClearTrackedEvents to clear them before registering more");
76
89
  }
77
90
  this.expectedEvents.push(...orderedExpectedEvents.map((event, index) => ({ index, event })));
78
91
  }
@@ -100,12 +113,14 @@ class EventAndErrorTrackingLogger extends telemetry_utils_1.TelemetryLogger {
100
113
  }
101
114
  }
102
115
  if (event.category === "error") {
103
- if (this.allowedErrors.includes(event.eventName)) {
104
- event.category = "generic";
105
- }
106
- else {
116
+ // Check to see if this error is allowed and if its category should be downgraded
117
+ const allowedError = this.allowedErrors.find(({ eventName }) => eventName === event.eventName);
118
+ if (allowedError === undefined) {
107
119
  this.unexpectedErrors.push(event);
108
120
  }
121
+ else if (allowedError.downgrade) {
122
+ event.category = "generic";
123
+ }
109
124
  }
110
125
  this.baseLogger.send(event);
111
126
  }
@@ -216,7 +231,29 @@ class TestObjectProvider {
216
231
  }
217
232
  async loadContainer(entryPoint, loaderProps, requestHeader) {
218
233
  const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);
219
- return loader.resolve({ url: await this.driver.createContainerUrl(this.documentId), headers: requestHeader });
234
+ // Once ADO#3889 is done to switch default connection mode to "read" on load, we don't need
235
+ // to load "delayed" across the board. Remove the following code.
236
+ const delayConnection = requestHeader === undefined || requestHeader[container_definitions_1.LoaderHeader.reconnect] !== false;
237
+ const headers = delayConnection
238
+ ? Object.assign({ [container_definitions_1.LoaderHeader.loadMode]: { deltaConnection: "delayed" } }, requestHeader) : requestHeader;
239
+ const container = await loader.resolve({
240
+ url: await this.driver.createContainerUrl(this.documentId),
241
+ headers,
242
+ });
243
+ // Once ADO#3889 is done to switch default connection mode to "read" on load, we don't need
244
+ // to load "delayed" across the board. Remove the following code.
245
+ if (delayConnection) {
246
+ // Older version may not have connect, use resume instead.
247
+ const maybeContainer = container;
248
+ if (maybeContainer.connect !== undefined) {
249
+ container.connect();
250
+ }
251
+ else {
252
+ // back compat
253
+ container.resume();
254
+ }
255
+ }
256
+ return container;
220
257
  }
221
258
  /**
222
259
  * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.
@@ -271,11 +308,7 @@ class TestObjectProvider {
271
308
  this._documentCreated = false;
272
309
  }
273
310
  async ensureSynchronized(timeoutDuration) {
274
- var _a, _b;
275
- // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
276
- return !timeoutDuration
277
- ? this._loaderContainerTracker.ensureSynchronized()
278
- : (_b = (_a = this._loaderContainerTracker).ensureSynchronizedWithTimeout) === null || _b === void 0 ? void 0 : _b.call(_a, timeoutDuration);
311
+ return this._loaderContainerTracker.ensureSynchronized();
279
312
  }
280
313
  async waitContainerToCatchUp(container) {
281
314
  // The original waitContainerToCatchUp() from container loader uses either Container.resume()
@@ -1 +1 @@
1
- {"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],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B,CAAC,MAAM,CAAC;SAC1D;QAED,OAAO,IAAA,yCAA+B,EAAC,SAAS,CAAC,CAAC;IACtD,CAAC;IAED,gBAAgB,CAAC,WAAqC;QAClD,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAEM,2BAA2B,CAAC,wBAAiC,KAAK;QACrE,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,CAAC,uBAAuB,GAAG,IAAI,+CAAsB,CAAC,qBAAqB,CAAC,CAAC;IACrF,CAAC;CACJ;AAnOD,gDAmOC;AAED,SAAgB,8BAA8B,CAAC,MAA+C,EAAE,MAAe;IAC3G,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO;KACV;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,2BAA2B,EAAE,CAAC;IACrD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,IAAI,KAAK,CACZ,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/G;AACL,CAAC;AAbD,wEAaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainer, IHostLoader, IFluidCodeDetails } from \"@fluidframework/container-definitions\";\nimport { ITelemetryGenericEvent, ITelemetryBaseLogger, ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport {\n ILoaderProps,\n Loader,\n waitContainerToCatchUp as waitContainerToCatchUp_original,\n} from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport { IDocumentServiceFactory, IResolvedUrl, IUrlResolver } from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { ChildLogger, MultiSinkLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\nimport { createAndAttachContainer } from \"./localLoader\";\nimport { ChannelFactoryRegistry } from \"./testFluidObject\";\n\nconst defaultCodeDetails: IFluidCodeDetails = {\n package: \"defaultTestPackage\",\n config: {},\n};\n\nexport interface IOpProcessingController {\n processIncoming(...containers: IContainer[]): Promise<void>;\n processOutgoing(...containers: IContainer[]): Promise<void>;\n pauseProcessing(...containers: IContainer[]): Promise<void>;\n resumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ): IHostLoader;\n createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;\n loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer>;\n\n /**\n * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n */\n makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;\n /**\n *\n * @param url - Resolved container URL\n */\n updateDocumentId(url: IResolvedUrl | undefined): void;\n\n logger: ITelemetryBaseLogger;\n documentServiceFactory: IDocumentServiceFactory;\n urlResolver: IUrlResolver;\n defaultCodeDetails: IFluidCodeDetails;\n opProcessingController: IOpProcessingController;\n\n ensureSynchronized(timeoutDuration?: number): Promise<void>;\n reset(): void;\n\n documentId: string;\n driver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n Primed, // default\n Test,\n}\n\nexport interface ITestContainerConfig {\n /** TestFluidDataObject instead of PrimedDataStore */\n fluidDataObjectType?: DataObjectFactoryType;\n\n /** An array of channel name and DDS factory pair to create on container creation time */\n registry?: ChannelFactoryRegistry;\n\n /** Container runtime options for the container instance */\n runtimeOptions?: IContainerRuntimeOptions;\n\n /** Loader options for the loader used to create containers */\n loaderProps?: Partial<ILoaderProps>;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n get(): string;\n update(resolvedUrl?: IResolvedUrl): void;\n reset(): void;\n}\n\n/**\n * Document ID is treated differently by test drivers. The key difference is in generating\n * a new container ID and accessing the container in multi-instance test cases.\n */\nfunction getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {\n let documentId = createDocumentId();\n switch (type) {\n case \"odsp\":\n return {\n get: () => documentId,\n update: () => { }, // do not update the document ID in odsp test cases\n reset: () => { documentId = createDocumentId(); },\n };\n default:\n return {\n get: () => documentId,\n update: (resolvedUrl?: IResolvedUrl) => {\n // Extract the document ID from the resolved container's URL and reset the ID property\n ensureFluidResolvedUrl(resolvedUrl);\n documentId = resolvedUrl.id ?? documentId;\n },\n reset: () => { documentId = createDocumentId(); },\n };\n }\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n */\nexport class EventAndErrorTrackingLogger extends TelemetryLogger {\n /** Even if these error events are logged, tests should still be allowed to pass */\n private readonly allowedErrors: string[] = [\n // This log was removed in current version as unnecessary, but it's still present in previous versions\n \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n ];\n\n constructor(private readonly baseLogger: ITelemetryBaseLogger) {\n super();\n }\n\n private readonly expectedEvents: ({ index: number; event: ITelemetryGenericEvent | undefined; } | undefined)[] = [];\n private readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n public registerExpectedEvent(... orderedExpectedEvents: ITelemetryGenericEvent[]) {\n if (this.expectedEvents.length !== 0) {\n // we don't have to error here. just no reason not to. given the events must be\n // ordered it could be tricky to figure out problems around multiple registrations.\n throw new Error(\n \"Expected events already registered.\\n\"\n + \"Call reportAndClearTrackedEvents to clear them before registering more\");\n }\n this.expectedEvents.push(... orderedExpectedEvents.map((event, index) => ({ index, event })));\n }\n\n send(event: ITelemetryBaseEvent): void {\n const ee = this.expectedEvents[0]?.event;\n if (ee?.eventName === event.eventName) {\n let matches = true;\n for (const key of Object.keys(ee)) {\n if (ee[key] !== event[key]) {\n matches = false;\n break;\n }\n }\n if (matches) {\n // we found an expected event\n // so remove it from the list of expected events\n // and if it is an error, change it to generic\n // this helps keep our telemetry clear of\n // expected errors.\n this.expectedEvents.shift();\n if (event.category === \"error\") {\n event.category = \"generic\";\n }\n }\n }\n if (event.category === \"error\") {\n if (this.allowedErrors.includes(event.eventName)) {\n event.category = \"generic\";\n } else {\n this.unexpectedErrors.push(event);\n }\n }\n\n this.baseLogger.send(event);\n }\n\n public reportAndClearTrackedEvents() {\n const expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n const unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n return {\n expectedNotFound,\n unexpectedErrors,\n };\n }\n}\n\n/**\n * Shared base class for test object provider. Contain code for loader and container creation and loading\n */\nexport class TestObjectProvider implements ITestObjectProvider {\n private _loaderContainerTracker = new LoaderContainerTracker();\n private _documentServiceFactory: IDocumentServiceFactory | undefined;\n private _urlResolver: IUrlResolver | undefined;\n private _logger: EventAndErrorTrackingLogger | undefined;\n private readonly _documentIdStrategy: IDocumentIdStrategy;\n // Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n private _documentCreated = false;\n\n /**\n * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n * and factory for TestFluidObject\n */\n constructor(\n public readonly LoaderConstructor: typeof Loader,\n public readonly driver: ITestDriver,\n public readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint,\n ) {\n this._documentIdStrategy = getDocumentIdStrategy(driver.type);\n }\n\n get logger(): EventAndErrorTrackingLogger {\n if (this._logger === undefined) {\n this._logger = new EventAndErrorTrackingLogger(\n ChildLogger.create(getTestLogger?.(), undefined,\n {\n all: {\n driverType: this.driver.type,\n driverEndpointName: this.driver.endpointName,\n driverTenantName: this.driver.tenantName,\n driverUserIndex: this.driver.userIndex,\n },\n }));\n }\n return this._logger;\n }\n\n set logger(logger: EventAndErrorTrackingLogger) {\n this._logger = logger;\n }\n\n get documentServiceFactory() {\n if (!this._documentServiceFactory) {\n this._documentServiceFactory = this.driver.createDocumentServiceFactory();\n }\n return this._documentServiceFactory;\n }\n\n get urlResolver() {\n if (!this._urlResolver) {\n this._urlResolver = this.driver.createUrlResolver();\n }\n return this._urlResolver;\n }\n\n get documentId() {\n return this._documentIdStrategy.get();\n }\n\n get defaultCodeDetails() {\n return defaultCodeDetails;\n }\n\n get opProcessingController(): IOpProcessingController {\n return this._loaderContainerTracker;\n }\n\n /**\n * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public createLoader(\n packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n loaderProps?: Partial<ILoaderProps>,\n ) {\n const multiSinkLogger = new MultiSinkLogger();\n multiSinkLogger.addLogger(this.logger);\n if (loaderProps?.logger !== undefined) {\n multiSinkLogger.addLogger(loaderProps.logger);\n }\n\n const loader = new this.LoaderConstructor({\n ... loaderProps,\n logger: multiSinkLogger,\n codeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n urlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n documentServiceFactory: loaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n });\n this._loaderContainerTracker.add(loader);\n return loader;\n }\n\n /**\n * Create a container using a default document id and code details.\n * Container created is automatically added to the OpProcessingController to manage op flow\n *\n * Only the version of the loader will vary based on compat config. The version of\n * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n *\n * @param packageEntries - list of code details and fluidEntryPoint pairs.\n */\n public async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadContainer\");\n }\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n const container = await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId),\n );\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n public async loadContainer(\n entryPoint: fluidEntryPoint,\n loaderProps?: Partial<ILoaderProps>,\n requestHeader?: IRequestHeader): Promise<IContainer> {\n const loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n return loader.resolve({ url: await this.driver.createContainerUrl(this.documentId), headers: requestHeader });\n }\n\n /**\n * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n * @param testContainerConfig - optional configuring the test Container\n */\n public makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n return this.createLoader(\n [[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n testContainerConfig?.loaderProps,\n );\n }\n\n /**\n * Make a container using a default document id and code details\n * Container loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n */\n public async makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer> {\n if (this._documentCreated) {\n throw new Error(\n \"Only one container/document can be created. To load the container/document use loadTestContainer\");\n }\n const loader = this.makeTestLoader(testContainerConfig);\n const container =\n await createAndAttachContainer(\n defaultCodeDetails,\n loader,\n this.driver.createCreateNewRequest(this.documentId));\n this._documentCreated = true;\n // r11s driver will generate a new ID for the new container.\n // update the document ID with the actual ID of the attached container.\n this._documentIdStrategy.update(container.resolvedUrl);\n return container;\n }\n\n /**\n * Load a container using a default document id and code details.\n * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n * @param testContainerConfig - optional configuring the test Container\n * @param requestHeader - optional headers to be supplied to the loader\n */\n public async loadTestContainer(\n testContainerConfig?: ITestContainerConfig,\n requestHeader?: IRequestHeader,\n ): Promise<IContainer> {\n const loader = this.makeTestLoader(testContainerConfig);\n const container = await loader.resolve({\n url: await this.driver.createContainerUrl(this.documentId),\n headers: requestHeader,\n });\n await this.waitContainerToCatchUp(container);\n\n return container;\n }\n\n public reset() {\n this._loaderContainerTracker.reset();\n this._documentServiceFactory = undefined;\n this._urlResolver = undefined;\n this._documentIdStrategy.reset();\n const logError = getUnexpectedLogErrorException(this._logger);\n if (logError) {\n throw logError;\n }\n this._logger = undefined;\n this._documentCreated = false;\n }\n\n public async ensureSynchronized(timeoutDuration?: number): Promise<void> {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !timeoutDuration\n ? this._loaderContainerTracker.ensureSynchronized()\n : this._loaderContainerTracker.ensureSynchronizedWithTimeout?.(timeoutDuration);\n }\n\n public async waitContainerToCatchUp(container: IContainer) {\n // The original waitContainerToCatchUp() from container loader uses either Container.resume()\n // or Container.connect() as part of its implementation. However, resume() was deprecated\n // and eventually replaced with connect(). To avoid issues during LTS compatibility testing\n // with older container versions issues, we use resume() when connect() is unavailable.\n if ((container as any).connect === undefined) {\n (container as any).connect = (container as any).resume;\n }\n\n return waitContainerToCatchUp_original(container);\n }\n\n updateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n this._documentIdStrategy.update(resolvedUrl);\n }\n\n public resetLoaderContainerTracker(syncSummarizerClients: boolean = false) {\n this._loaderContainerTracker.reset();\n this._loaderContainerTracker = new LoaderContainerTracker(syncSummarizerClients);\n }\n}\n\nexport function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string) {\n if (logger === undefined) {\n return;\n }\n const results = logger.reportAndClearTrackedEvents();\n if (results.unexpectedErrors.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(results.unexpectedErrors, undefined, 2)}`);\n }\n if (results.expectedNotFound.length > 0) {\n return new Error(\n `${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(results.expectedNotFound, undefined, 2)}`);\n }\n}\n"]}
1
+ {"version":3,"file":"testObjectProvider.js","sourceRoot":"","sources":["../src/testObjectProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAK+C;AAM/C,uEAI0C;AAQ1C,+DAAsE;AAEtE,+BAAkC;AAClC,qEAAgG;AAChG,qEAAkE;AAClE,uDAAqE;AACrE,+CAAyD;AAGzD,MAAM,kBAAkB,GAAsB;IAC7C,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,EAAE;CACV,CAAC;AAsDF,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAChC,qEAAM,CAAA;IACN,iEAAI,CAAA;AACL,CAAC,EAHW,qBAAqB,GAArB,6BAAqB,KAArB,6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G,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAC3D,OAAO,CAAC,gBAAgB,EACxB,SAAS,EACT,CAAC,CACD,EAAE,CACH,CAAC;KACF;AACF,CAAC;AA1BD,wEA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIHostLoader,\n\tIFluidCodeDetails,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tITelemetryGenericEvent,\n\tITelemetryBaseLogger,\n\tITelemetryBaseEvent,\n} from \"@fluidframework/common-definitions\";\nimport {\n\tILoaderProps,\n\tLoader,\n\twaitContainerToCatchUp as waitContainerToCatchUp_original,\n} from \"@fluidframework/container-loader\";\nimport { IContainerRuntimeOptions } from \"@fluidframework/container-runtime\";\nimport { IRequestHeader } from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ensureFluidResolvedUrl } from \"@fluidframework/driver-utils\";\nimport { ITestDriver, TestDriverTypes } from \"@fluidframework/test-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { ChildLogger, MultiSinkLogger, TelemetryLogger } from \"@fluidframework/telemetry-utils\";\nimport { LoaderContainerTracker } from \"./loaderContainerTracker\";\nimport { fluidEntryPoint, LocalCodeLoader } from \"./localCodeLoader\";\nimport { createAndAttachContainer } from \"./localLoader\";\nimport { ChannelFactoryRegistry } from \"./testFluidObject\";\n\nconst defaultCodeDetails: IFluidCodeDetails = {\n\tpackage: \"defaultTestPackage\",\n\tconfig: {},\n};\n\nexport interface IOpProcessingController {\n\tprocessIncoming(...containers: IContainer[]): Promise<void>;\n\tprocessOutgoing(...containers: IContainer[]): Promise<void>;\n\tpauseProcessing(...containers: IContainer[]): Promise<void>;\n\tresumeProcessing(...containers: IContainer[]): void;\n}\n\nexport interface ITestObjectProvider {\n\tcreateFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;\n\tcreateLoader(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t): IHostLoader;\n\tcreateContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t): Promise<IContainer>;\n\tloadContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer>;\n\n\t/**\n\t * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.\n\t * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.\n\t */\n\tmakeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;\n\tmakeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;\n\tloadTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer>;\n\t/**\n\t *\n\t * @param url - Resolved container URL\n\t */\n\tupdateDocumentId(url: IResolvedUrl | undefined): void;\n\n\tlogger: ITelemetryBaseLogger;\n\tdocumentServiceFactory: IDocumentServiceFactory;\n\turlResolver: IUrlResolver;\n\tdefaultCodeDetails: IFluidCodeDetails;\n\topProcessingController: IOpProcessingController;\n\n\tensureSynchronized(timeoutDuration?: number): Promise<void>;\n\treset(): void;\n\n\tdocumentId: string;\n\tdriver: ITestDriver;\n}\n\nexport enum DataObjectFactoryType {\n\tPrimed, // default\n\tTest,\n}\n\nexport interface ITestContainerConfig {\n\t/** TestFluidDataObject instead of PrimedDataStore */\n\tfluidDataObjectType?: DataObjectFactoryType;\n\n\t/** An array of channel name and DDS factory pair to create on container creation time */\n\tregistry?: ChannelFactoryRegistry;\n\n\t/** Container runtime options for the container instance */\n\truntimeOptions?: IContainerRuntimeOptions;\n\n\t/** Whether this runtime should be instantiated using a mixed-in attributor class */\n\tenableAttribution?: boolean;\n\n\t/** Loader options for the loader used to create containers */\n\tloaderProps?: Partial<ILoaderProps>;\n}\n\nexport const createDocumentId = (): string => uuid();\n\ninterface IDocumentIdStrategy {\n\tget(): string;\n\tupdate(resolvedUrl?: IResolvedUrl): void;\n\treset(): void;\n}\n\n/**\n * Document ID is treated differently by test drivers. The key difference is in generating\n * a new container ID and accessing the container in multi-instance test cases.\n */\nfunction getDocumentIdStrategy(type?: TestDriverTypes): IDocumentIdStrategy {\n\tlet documentId = createDocumentId();\n\tswitch (type) {\n\t\tcase \"odsp\":\n\t\t\treturn {\n\t\t\t\tget: () => documentId,\n\t\t\t\tupdate: () => {}, // do not update the document ID in odsp test cases\n\t\t\t\treset: () => {\n\t\t\t\t\tdocumentId = createDocumentId();\n\t\t\t\t},\n\t\t\t};\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tget: () => documentId,\n\t\t\t\tupdate: (resolvedUrl?: IResolvedUrl) => {\n\t\t\t\t\t// Extract the document ID from the resolved container's URL and reset the ID property\n\t\t\t\t\tensureFluidResolvedUrl(resolvedUrl);\n\t\t\t\t\tdocumentId = resolvedUrl.id ?? documentId;\n\t\t\t\t},\n\t\t\t\treset: () => {\n\t\t\t\t\tdocumentId = createDocumentId();\n\t\t\t\t},\n\t\t\t};\n\t}\n}\n\n/**\n * This class tracks events. It allows specifying expected events, which will be looked for in order.\n * It also tracks all unexpected errors.\n * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and\n * any expected events that have not occurred.\n */\nexport class EventAndErrorTrackingLogger extends TelemetryLogger {\n\t/**\n\t * Even if these error events are logged, tests should still be allowed to pass\n\t * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)\n\t */\n\tprivate readonly allowedErrors: { eventName: string; downgrade?: true }[] = [\n\t\t// This log was removed in current version as unnecessary, but it's still present in previous versions\n\t\t{\n\t\t\teventName: \"fluid:telemetry:Container:NoRealStorageInDetachedContainer\",\n\t\t\tdowngrade: true,\n\t\t},\n\t\t// This log's category changes depending on the op latency. test results shouldn't be affected but if we see lots we'd like an alert from the logs.\n\t\t{ eventName: \"fluid:telemetry:OpPerf:OpRoundtripTime\" },\n\t];\n\n\tconstructor(private readonly baseLogger: ITelemetryBaseLogger) {\n\t\tsuper();\n\t}\n\n\tprivate readonly expectedEvents: (\n\t\t| { index: number; event: ITelemetryGenericEvent | undefined }\n\t\t| undefined\n\t)[] = [];\n\tprivate readonly unexpectedErrors: ITelemetryBaseEvent[] = [];\n\n\tpublic registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEvent[]) {\n\t\tif (this.expectedEvents.length !== 0) {\n\t\t\t// we don't have to error here. just no reason not to. given the events must be\n\t\t\t// ordered it could be tricky to figure out problems around multiple registrations.\n\t\t\tthrow new Error(\n\t\t\t\t\"Expected events already registered.\\n\" +\n\t\t\t\t\t\"Call reportAndClearTrackedEvents to clear them before registering more\",\n\t\t\t);\n\t\t}\n\t\tthis.expectedEvents.push(\n\t\t\t...orderedExpectedEvents.map((event, index) => ({ index, event })),\n\t\t);\n\t}\n\n\tsend(event: ITelemetryBaseEvent): void {\n\t\tconst ee = this.expectedEvents[0]?.event;\n\t\tif (ee?.eventName === event.eventName) {\n\t\t\tlet matches = true;\n\t\t\tfor (const key of Object.keys(ee)) {\n\t\t\t\tif (ee[key] !== event[key]) {\n\t\t\t\t\tmatches = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (matches) {\n\t\t\t\t// we found an expected event\n\t\t\t\t// so remove it from the list of expected events\n\t\t\t\t// and if it is an error, change it to generic\n\t\t\t\t// this helps keep our telemetry clear of\n\t\t\t\t// expected errors.\n\t\t\t\tthis.expectedEvents.shift();\n\t\t\t\tif (event.category === \"error\") {\n\t\t\t\t\tevent.category = \"generic\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (event.category === \"error\") {\n\t\t\t// Check to see if this error is allowed and if its category should be downgraded\n\t\t\tconst allowedError = this.allowedErrors.find(\n\t\t\t\t({ eventName }) => eventName === event.eventName,\n\t\t\t);\n\n\t\t\tif (allowedError === undefined) {\n\t\t\t\tthis.unexpectedErrors.push(event);\n\t\t\t} else if (allowedError.downgrade) {\n\t\t\t\tevent.category = \"generic\";\n\t\t\t}\n\t\t}\n\n\t\tthis.baseLogger.send(event);\n\t}\n\n\tpublic reportAndClearTrackedEvents() {\n\t\tconst expectedNotFound = this.expectedEvents.splice(0, this.expectedEvents.length);\n\t\tconst unexpectedErrors = this.unexpectedErrors.splice(0, this.unexpectedErrors.length);\n\t\treturn {\n\t\t\texpectedNotFound,\n\t\t\tunexpectedErrors,\n\t\t};\n\t}\n}\n\n/**\n * Shared base class for test object provider. Contain code for loader and container creation and loading\n */\nexport class TestObjectProvider implements ITestObjectProvider {\n\tprivate _loaderContainerTracker = new LoaderContainerTracker();\n\tprivate _documentServiceFactory: IDocumentServiceFactory | undefined;\n\tprivate _urlResolver: IUrlResolver | undefined;\n\tprivate _logger: EventAndErrorTrackingLogger | undefined;\n\tprivate readonly _documentIdStrategy: IDocumentIdStrategy;\n\t// Since documentId doesn't change we can only create/make one container. Call the load functions instead.\n\tprivate _documentCreated = false;\n\n\t/**\n\t * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController\n\t * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name\n\t * and factory for TestFluidObject\n\t */\n\tconstructor(\n\t\tpublic readonly LoaderConstructor: typeof Loader,\n\t\tpublic readonly driver: ITestDriver,\n\t\tpublic readonly createFluidEntryPoint: (\n\t\t\ttestContainerConfig?: ITestContainerConfig,\n\t\t) => fluidEntryPoint,\n\t) {\n\t\tthis._documentIdStrategy = getDocumentIdStrategy(driver.type);\n\t}\n\n\tget logger(): EventAndErrorTrackingLogger {\n\t\tif (this._logger === undefined) {\n\t\t\tthis._logger = new EventAndErrorTrackingLogger(\n\t\t\t\tChildLogger.create(getTestLogger?.(), undefined, {\n\t\t\t\t\tall: {\n\t\t\t\t\t\tdriverType: this.driver.type,\n\t\t\t\t\t\tdriverEndpointName: this.driver.endpointName,\n\t\t\t\t\t\tdriverTenantName: this.driver.tenantName,\n\t\t\t\t\t\tdriverUserIndex: this.driver.userIndex,\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn this._logger;\n\t}\n\n\tset logger(logger: EventAndErrorTrackingLogger) {\n\t\tthis._logger = logger;\n\t}\n\n\tget documentServiceFactory() {\n\t\tif (!this._documentServiceFactory) {\n\t\t\tthis._documentServiceFactory = this.driver.createDocumentServiceFactory();\n\t\t}\n\t\treturn this._documentServiceFactory;\n\t}\n\n\tget urlResolver() {\n\t\tif (!this._urlResolver) {\n\t\t\tthis._urlResolver = this.driver.createUrlResolver();\n\t\t}\n\t\treturn this._urlResolver;\n\t}\n\n\tget documentId() {\n\t\treturn this._documentIdStrategy.get();\n\t}\n\n\tget defaultCodeDetails() {\n\t\treturn defaultCodeDetails;\n\t}\n\n\tget opProcessingController(): IOpProcessingController {\n\t\treturn this._loaderContainerTracker;\n\t}\n\n\t/**\n\t * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n\t *\n\t * Only the version of the loader will vary based on compat config. The version of\n\t * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n\t *\n\t * @param packageEntries - list of code details and fluidEntryPoint pairs.\n\t */\n\tpublic createLoader(\n\t\tpackageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t) {\n\t\tconst multiSinkLogger = new MultiSinkLogger();\n\t\tmultiSinkLogger.addLogger(this.logger);\n\t\tif (loaderProps?.logger !== undefined) {\n\t\t\tmultiSinkLogger.addLogger(loaderProps.logger);\n\t\t}\n\n\t\tconst loader = new this.LoaderConstructor({\n\t\t\t...loaderProps,\n\t\t\tlogger: multiSinkLogger,\n\t\t\tcodeLoader: loaderProps?.codeLoader ?? new LocalCodeLoader(packageEntries),\n\t\t\turlResolver: loaderProps?.urlResolver ?? this.urlResolver,\n\t\t\tdocumentServiceFactory:\n\t\t\t\tloaderProps?.documentServiceFactory ?? this.documentServiceFactory,\n\t\t});\n\t\tthis._loaderContainerTracker.add(loader);\n\t\treturn loader;\n\t}\n\n\t/**\n\t * Create a container using a default document id and code details.\n\t * Container created is automatically added to the OpProcessingController to manage op flow\n\t *\n\t * Only the version of the loader will vary based on compat config. The version of\n\t * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.\n\t *\n\t * @param packageEntries - list of code details and fluidEntryPoint pairs.\n\t */\n\tpublic async createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>) {\n\t\tif (this._documentCreated) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Only one container/document can be created. To load the container/document use loadContainer\",\n\t\t\t);\n\t\t}\n\t\tconst loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n\t\tconst container = await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tthis.driver.createCreateNewRequest(this.documentId),\n\t\t);\n\t\tthis._documentCreated = true;\n\t\t// r11s driver will generate a new ID for the new container.\n\t\t// update the document ID with the actual ID of the attached container.\n\t\tthis._documentIdStrategy.update(container.resolvedUrl);\n\t\treturn container;\n\t}\n\n\tpublic async loadContainer(\n\t\tentryPoint: fluidEntryPoint,\n\t\tloaderProps?: Partial<ILoaderProps>,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer> {\n\t\tconst loader = this.createLoader([[defaultCodeDetails, entryPoint]], loaderProps);\n\n\t\t// Once ADO#3889 is done to switch default connection mode to \"read\" on load, we don't need\n\t\t// to load \"delayed\" across the board. Remove the following code.\n\t\tconst delayConnection =\n\t\t\trequestHeader === undefined || requestHeader[LoaderHeader.reconnect] !== false;\n\t\tconst headers: IRequestHeader = delayConnection\n\t\t\t? {\n\t\t\t\t\t[LoaderHeader.loadMode]: { deltaConnection: \"delayed\" },\n\t\t\t\t\t...requestHeader,\n\t\t\t }\n\t\t\t: requestHeader;\n\n\t\tconst container = await loader.resolve({\n\t\t\turl: await this.driver.createContainerUrl(this.documentId),\n\t\t\theaders,\n\t\t});\n\n\t\t// Once ADO#3889 is done to switch default connection mode to \"read\" on load, we don't need\n\t\t// to load \"delayed\" across the board. Remove the following code.\n\t\tif (delayConnection) {\n\t\t\t// Older version may not have connect, use resume instead.\n\t\t\tconst maybeContainer = container as Partial<IContainer>;\n\t\t\tif (maybeContainer.connect !== undefined) {\n\t\t\t\tcontainer.connect();\n\t\t\t} else {\n\t\t\t\t// back compat\n\t\t\t\t(container as any).resume();\n\t\t\t}\n\t\t}\n\n\t\treturn container;\n\t}\n\n\t/**\n\t * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.\n\t * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run\n\t * @param testContainerConfig - optional configuring the test Container\n\t */\n\tpublic makeTestLoader(testContainerConfig?: ITestContainerConfig) {\n\t\treturn this.createLoader(\n\t\t\t[[defaultCodeDetails, this.createFluidEntryPoint(testContainerConfig)]],\n\t\t\ttestContainerConfig?.loaderProps,\n\t\t);\n\t}\n\n\t/**\n\t * Make a container using a default document id and code details\n\t * Container loaded is automatically added to the OpProcessingController to manage op flow\n\t * @param testContainerConfig - optional configuring the test Container\n\t */\n\tpublic async makeTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t): Promise<IContainer> {\n\t\tif (this._documentCreated) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Only one container/document can be created. To load the container/document use loadTestContainer\",\n\t\t\t);\n\t\t}\n\t\tconst loader = this.makeTestLoader(testContainerConfig);\n\t\tconst container = await createAndAttachContainer(\n\t\t\tdefaultCodeDetails,\n\t\t\tloader,\n\t\t\tthis.driver.createCreateNewRequest(this.documentId),\n\t\t);\n\t\tthis._documentCreated = true;\n\t\t// r11s driver will generate a new ID for the new container.\n\t\t// update the document ID with the actual ID of the attached container.\n\t\tthis._documentIdStrategy.update(container.resolvedUrl);\n\t\treturn container;\n\t}\n\n\t/**\n\t * Load a container using a default document id and code details.\n\t * IContainer loaded is automatically added to the OpProcessingController to manage op flow\n\t * @param testContainerConfig - optional configuring the test Container\n\t * @param requestHeader - optional headers to be supplied to the loader\n\t */\n\tpublic async loadTestContainer(\n\t\ttestContainerConfig?: ITestContainerConfig,\n\t\trequestHeader?: IRequestHeader,\n\t): Promise<IContainer> {\n\t\tconst loader = this.makeTestLoader(testContainerConfig);\n\t\tconst container = await loader.resolve({\n\t\t\turl: await this.driver.createContainerUrl(this.documentId),\n\t\t\theaders: requestHeader,\n\t\t});\n\t\tawait this.waitContainerToCatchUp(container);\n\n\t\treturn container;\n\t}\n\n\tpublic reset() {\n\t\tthis._loaderContainerTracker.reset();\n\t\tthis._documentServiceFactory = undefined;\n\t\tthis._urlResolver = undefined;\n\t\tthis._documentIdStrategy.reset();\n\t\tconst logError = getUnexpectedLogErrorException(this._logger);\n\t\tif (logError) {\n\t\t\tthrow logError;\n\t\t}\n\t\tthis._logger = undefined;\n\t\tthis._documentCreated = false;\n\t}\n\n\tpublic async ensureSynchronized(timeoutDuration?: number): Promise<void> {\n\t\treturn this._loaderContainerTracker.ensureSynchronized();\n\t}\n\n\tpublic async waitContainerToCatchUp(container: IContainer) {\n\t\t// The original waitContainerToCatchUp() from container loader uses either Container.resume()\n\t\t// or Container.connect() as part of its implementation. However, resume() was deprecated\n\t\t// and eventually replaced with connect(). To avoid issues during LTS compatibility testing\n\t\t// with older container versions issues, we use resume() when connect() is unavailable.\n\t\tif ((container as any).connect === undefined) {\n\t\t\t(container as any).connect = (container as any).resume;\n\t\t}\n\n\t\treturn waitContainerToCatchUp_original(container);\n\t}\n\n\tupdateDocumentId(resolvedUrl: IResolvedUrl | undefined) {\n\t\tthis._documentIdStrategy.update(resolvedUrl);\n\t}\n\n\tpublic resetLoaderContainerTracker(syncSummarizerClients: boolean = false) {\n\t\tthis._loaderContainerTracker.reset();\n\t\tthis._loaderContainerTracker = new LoaderContainerTracker(syncSummarizerClients);\n\t}\n}\n\nexport function getUnexpectedLogErrorException(\n\tlogger: EventAndErrorTrackingLogger | undefined,\n\tprefix?: string,\n) {\n\tif (logger === undefined) {\n\t\treturn;\n\t}\n\tconst results = logger.reportAndClearTrackedEvents();\n\tif (results.unexpectedErrors.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Unexpected Errors in Logs:\\n${JSON.stringify(\n\t\t\t\tresults.unexpectedErrors,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n\tif (results.expectedNotFound.length > 0) {\n\t\treturn new Error(\n\t\t\t`${prefix ?? \"\"}Expected Events not found:\\n${JSON.stringify(\n\t\t\t\tresults.expectedNotFound,\n\t\t\t\tundefined,\n\t\t\t\t2,\n\t\t\t)}`,\n\t\t);\n\t}\n}\n"]}
@@ -2,19 +2,28 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { Container } from "@fluidframework/container-loader";
6
5
  export declare const defaultTimeoutDurationMs = 250;
7
6
  export interface TimeoutWithError {
7
+ /**
8
+ * Timeout duration in milliseconds, if it is great than 0 and not Infinity
9
+ * If it is undefined, then it will use test timeout if we are in side the test function
10
+ * Otherwise, there is no timeout
11
+ */
8
12
  durationMs?: number;
9
13
  reject?: true;
10
14
  errorMsg?: string;
11
15
  }
12
16
  export interface TimeoutWithValue<T = void> {
17
+ /**
18
+ * Timeout duration in milliseconds, if it is great than 0 and not Infinity
19
+ * If it is undefined, then it will use test timeout if we are in side the test function
20
+ * Otherwise, there is no timeout
21
+ */
13
22
  durationMs?: number;
14
23
  reject: false;
15
24
  value: T;
16
25
  }
26
+ export declare type PromiseExecutor<T = void> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void;
17
27
  export declare function timeoutAwait<T = void>(promise: PromiseLike<T>, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
18
- export declare function ensureContainerConnected(container: Container): Promise<void>;
19
28
  export declare function timeoutPromise<T = void>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
20
29
  //# sourceMappingURL=timeoutUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutUtils.d.ts","sourceRoot":"","sources":["../src/timeoutUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,IAAI;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,CAAC,CAAC;CACZ;AAED,wBAAsB,YAAY,CAAC,CAAC,GAAG,IAAI,EACvC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,CAAM,cAG9D;AAED,wBAAsB,wBAAwB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAIlF;AAED,wBAAsB,cAAc,CAAC,CAAC,GAAG,IAAI,EACzC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAAK,IAAI,EAChG,cAAc,GAAE,gBAAgB,GAAG,gBAAgB,C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