@fluidframework/fluid-runner 2.0.0-dev.4.4.0.162574 → 2.0.0-dev.5.3.2.178189

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 (64) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/codeLoaderBundle.d.ts +1 -2
  3. package/dist/codeLoaderBundle.d.ts.map +1 -1
  4. package/dist/codeLoaderBundle.js.map +1 -1
  5. package/dist/exportFile.d.ts +3 -3
  6. package/dist/exportFile.d.ts.map +1 -1
  7. package/dist/exportFile.js +15 -7
  8. package/dist/exportFile.js.map +1 -1
  9. package/dist/fluidRunner.d.ts.map +1 -1
  10. package/dist/fluidRunner.js +8 -2
  11. package/dist/fluidRunner.js.map +1 -1
  12. package/dist/logger/baseFileLogger.d.ts +1 -1
  13. package/dist/logger/baseFileLogger.d.ts.map +1 -1
  14. package/dist/logger/baseFileLogger.js.map +1 -1
  15. package/dist/logger/csvFileLogger.d.ts +1 -1
  16. package/dist/logger/csvFileLogger.d.ts.map +1 -1
  17. package/dist/logger/csvFileLogger.js.map +1 -1
  18. package/dist/logger/fileLogger.d.ts +1 -1
  19. package/dist/logger/fileLogger.d.ts.map +1 -1
  20. package/dist/logger/fileLogger.js.map +1 -1
  21. package/dist/logger/loggerUtils.d.ts +4 -4
  22. package/dist/logger/loggerUtils.d.ts.map +1 -1
  23. package/dist/logger/loggerUtils.js +2 -2
  24. package/dist/logger/loggerUtils.js.map +1 -1
  25. package/dist/parseBundleAndExportFile.d.ts +1 -1
  26. package/dist/parseBundleAndExportFile.d.ts.map +1 -1
  27. package/dist/parseBundleAndExportFile.js +2 -2
  28. package/dist/parseBundleAndExportFile.js.map +1 -1
  29. package/lib/codeLoaderBundle.d.ts +1 -2
  30. package/lib/codeLoaderBundle.d.ts.map +1 -1
  31. package/lib/codeLoaderBundle.js.map +1 -1
  32. package/lib/exportFile.d.ts +3 -3
  33. package/lib/exportFile.d.ts.map +1 -1
  34. package/lib/exportFile.js +15 -7
  35. package/lib/exportFile.js.map +1 -1
  36. package/lib/fluidRunner.d.ts.map +1 -1
  37. package/lib/fluidRunner.js +8 -2
  38. package/lib/fluidRunner.js.map +1 -1
  39. package/lib/logger/baseFileLogger.d.ts +1 -1
  40. package/lib/logger/baseFileLogger.d.ts.map +1 -1
  41. package/lib/logger/baseFileLogger.js.map +1 -1
  42. package/lib/logger/csvFileLogger.d.ts +1 -1
  43. package/lib/logger/csvFileLogger.d.ts.map +1 -1
  44. package/lib/logger/csvFileLogger.js.map +1 -1
  45. package/lib/logger/fileLogger.d.ts +1 -1
  46. package/lib/logger/fileLogger.d.ts.map +1 -1
  47. package/lib/logger/fileLogger.js.map +1 -1
  48. package/lib/logger/loggerUtils.d.ts +4 -4
  49. package/lib/logger/loggerUtils.d.ts.map +1 -1
  50. package/lib/logger/loggerUtils.js +2 -2
  51. package/lib/logger/loggerUtils.js.map +1 -1
  52. package/lib/parseBundleAndExportFile.d.ts +1 -1
  53. package/lib/parseBundleAndExportFile.d.ts.map +1 -1
  54. package/lib/parseBundleAndExportFile.js +2 -2
  55. package/lib/parseBundleAndExportFile.js.map +1 -1
  56. package/package.json +18 -20
  57. package/src/codeLoaderBundle.ts +1 -2
  58. package/src/exportFile.ts +16 -6
  59. package/src/fluidRunner.ts +8 -0
  60. package/src/logger/baseFileLogger.ts +1 -1
  61. package/src/logger/csvFileLogger.ts +1 -1
  62. package/src/logger/fileLogger.ts +1 -1
  63. package/src/logger/loggerUtils.ts +4 -5
  64. package/src/parseBundleAndExportFile.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @fluidframework/fluid-runner
2
2
 
3
+ ## 2.0.0-internal.5.3.0
4
+
5
+ Dependency updates only.
6
+
7
+ ## 2.0.0-internal.5.2.0
8
+
9
+ Dependency updates only.
10
+
11
+ ## 2.0.0-internal.5.1.0
12
+
13
+ Dependency updates only.
14
+
15
+ ## 2.0.0-internal.5.0.0
16
+
17
+ Dependency updates only.
18
+
19
+ ## 2.0.0-internal.4.4.0
20
+
21
+ Dependency updates only.
22
+
3
23
  ## 2.0.0-internal.4.1.0
4
24
 
5
25
  Dependency updates only.
@@ -2,9 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
6
5
  import { ICodeDetailsLoader, IContainer } from "@fluidframework/container-definitions";
7
- import { FluidObject } from "@fluidframework/core-interfaces";
6
+ import { ITelemetryBaseLogger, FluidObject } from "@fluidframework/core-interfaces";
8
7
  /**
9
8
  * Contract that defines the necessary exports for the bundle provided at runtime
10
9
  * For an example, see "src/test/sampleCodeLoaders/sampleCodeLoader.ts"
@@ -1 +1 @@
1
- {"version":3,"file":"codeLoaderBundle.d.ts","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzE;;;OAGG;IACH,QAAQ,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE9D;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,iBAAiB,CAG3E;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAQzE"}
1
+ {"version":3,"file":"codeLoaderBundle.d.ts","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEpF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzE;;;OAGG;IACH,QAAQ,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE9D;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,iBAAiB,CAG3E;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAQzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyCH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa;QAClB,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU;QACvC,GAAG,CAAC,OAAO;QACX,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CACjC,CAAC;AACH,CAAC;AARD,oDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract that defines the necessary exports for the bundle provided at runtime\n * For an example, see \"src/test/sampleCodeLoaders/sampleCodeLoader.ts\"\n */\nexport interface ICodeLoaderBundle {\n\t/**\n\t * Fluid export of all the required objects and functions\n\t */\n\tfluidExport: Promise<IFluidFileConverter>;\n}\n\n/**\n * Instance that holds all the details for Fluid file conversion\n */\nexport interface IFluidFileConverter {\n\t/**\n\t * Get code loader details to provide at Loader creation\n\t * @param logger - created logger object to pass to code loader\n\t */\n\tgetCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;\n\n\t/**\n\t * Get scope object to provide at Loader creation\n\t * @param logger - created logger object to pass to scope object\n\t */\n\tgetScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;\n\n\t/**\n\t * Executes code on container and returns the result\n\t * @param container - container created by this application\n\t * @param options - additional options\n\t */\n\texecute(container: IContainer, options?: string): Promise<string>;\n}\n\n/**\n * Type cast to ensure necessary methods are present in the provided bundle\n * @param bundle - bundle provided to this application\n */\nexport function isCodeLoaderBundle(bundle: any): bundle is ICodeLoaderBundle {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn bundle?.fluidExport && typeof bundle.fluidExport === \"object\";\n}\n\nexport function isFluidFileConverter(obj: any): obj is IFluidFileConverter {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn (\n\t\tobj?.getCodeLoader &&\n\t\ttypeof obj.getCodeLoader === \"function\" &&\n\t\tobj.execute &&\n\t\ttypeof obj.execute === \"function\"\n\t);\n}\n"]}
1
+ {"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa;QAClB,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU;QACvC,GAAG,CAAC,OAAO;QACX,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CACjC,CAAC;AACH,CAAC;AARD,oDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { ITelemetryBaseLogger, FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract that defines the necessary exports for the bundle provided at runtime\n * For an example, see \"src/test/sampleCodeLoaders/sampleCodeLoader.ts\"\n */\nexport interface ICodeLoaderBundle {\n\t/**\n\t * Fluid export of all the required objects and functions\n\t */\n\tfluidExport: Promise<IFluidFileConverter>;\n}\n\n/**\n * Instance that holds all the details for Fluid file conversion\n */\nexport interface IFluidFileConverter {\n\t/**\n\t * Get code loader details to provide at Loader creation\n\t * @param logger - created logger object to pass to code loader\n\t */\n\tgetCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;\n\n\t/**\n\t * Get scope object to provide at Loader creation\n\t * @param logger - created logger object to pass to scope object\n\t */\n\tgetScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;\n\n\t/**\n\t * Executes code on container and returns the result\n\t * @param container - container created by this application\n\t * @param options - additional options\n\t */\n\texecute(container: IContainer, options?: string): Promise<string>;\n}\n\n/**\n * Type cast to ensure necessary methods are present in the provided bundle\n * @param bundle - bundle provided to this application\n */\nexport function isCodeLoaderBundle(bundle: any): bundle is ICodeLoaderBundle {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn bundle?.fluidExport && typeof bundle.fluidExport === \"object\";\n}\n\nexport function isFluidFileConverter(obj: any): obj is IFluidFileConverter {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn (\n\t\tobj?.getCodeLoader &&\n\t\ttypeof obj.getCodeLoader === \"function\" &&\n\t\tobj.execute &&\n\t\ttypeof obj.execute === \"function\"\n\t);\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
6
  import { IFluidFileConverter } from "./codeLoaderBundle";
7
7
  import { ITelemetryOptions } from "./logger/fileLogger";
8
8
  export declare type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
@@ -18,11 +18,11 @@ interface IExportFileResponseFailure {
18
18
  /**
19
19
  * Execute code on Container based on ODSP snapshot and write result to file
20
20
  */
21
- export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number): Promise<IExportFileResponse>;
21
+ export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
22
22
  /**
23
23
  * Create the container based on an ODSP snapshot and execute code on it
24
24
  * @returns result of execution
25
25
  */
26
- export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLogger, options?: string, timeout?: number): Promise<string>;
26
+ export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLoggerExt, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
27
27
  export {};
28
28
  //# sourceMappingURL=exportFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAKtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,oBAAY,mBAAmB,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAE1F,UAAU,0BAA0B;IACnC,OAAO,EAAE,IAAI,CAAC;CACd;AAED,UAAU,0BAA0B;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ;AAID;;GAEG;AACH,wBAAsB,UAAU,CAC/B,kBAAkB,EAAE,mBAAmB,EACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,iBAAiB,EACp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E,mBAAmB,EAC3B,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,GAAE,OAAe,GAClC,OAAO,CAAC,MAAM,CAAC,CA0CjB"}
@@ -25,10 +25,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createContainerAndExecute = exports.exportFile = void 0;
27
27
  const fs = __importStar(require("fs"));
28
+ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
28
29
  const container_definitions_1 = require("@fluidframework/container-definitions");
29
30
  const container_loader_1 = require("@fluidframework/container-loader");
30
31
  const odsp_driver_1 = require("@fluidframework/odsp-driver");
31
- const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
32
32
  const fakeUrlResolver_1 = require("./fakeUrlResolver");
33
33
  const utils_1 = require("./utils");
34
34
  const loggerUtils_1 = require("./logger/loggerUtils");
@@ -36,7 +36,7 @@ const clientArgsValidationError = "Client_ArgsValidationError";
36
36
  /**
37
37
  * Execute code on Container based on ODSP snapshot and write result to file
38
38
  */
39
- async function exportFile(fluidFileConverter, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout) {
39
+ async function exportFile(fluidFileConverter, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout, disableNetworkFetch) {
40
40
  const telemetryArgError = (0, loggerUtils_1.getTelemetryFileValidationError)(telemetryFile);
41
41
  if (telemetryArgError) {
42
42
  const eventName = clientArgsValidationError;
@@ -51,7 +51,7 @@ async function exportFile(fluidFileConverter, inputFile, outputFile, telemetryFi
51
51
  logger.sendErrorEvent({ eventName, message: argsValidationError });
52
52
  return { success: false, eventName, errorMessage: argsValidationError };
53
53
  }
54
- fs.writeFileSync(outputFile, await createContainerAndExecute((0, utils_1.getSnapshotFileContent)(inputFile), fluidFileConverter, logger, options, timeout));
54
+ fs.writeFileSync(outputFile, await createContainerAndExecute((0, utils_1.getSnapshotFileContent)(inputFile), fluidFileConverter, logger, options, timeout, disableNetworkFetch));
55
55
  return { success: true };
56
56
  });
57
57
  }
@@ -69,9 +69,14 @@ exports.exportFile = exportFile;
69
69
  * Create the container based on an ODSP snapshot and execute code on it
70
70
  * @returns result of execution
71
71
  */
72
- async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options, timeout) {
72
+ async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options, timeout, disableNetworkFetch = false) {
73
73
  const fn = async () => {
74
74
  var _a;
75
+ if (disableNetworkFetch) {
76
+ global.fetch = async () => {
77
+ throw new Error("Network fetch is not allowed");
78
+ };
79
+ }
75
80
  const loader = new container_loader_1.Loader({
76
81
  urlResolver: new fakeUrlResolver_1.FakeUrlResolver(),
77
82
  documentServiceFactory: (0, odsp_driver_1.createLocalOdspDocumentServiceFactory)(localOdspSnapshot),
@@ -86,9 +91,12 @@ async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter,
86
91
  },
87
92
  });
88
93
  return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "ExportFile" }, async () => {
89
- const result = await fluidFileConverter.execute(container, options);
90
- container.close();
91
- return result;
94
+ try {
95
+ return await fluidFileConverter.execute(container, options);
96
+ }
97
+ finally {
98
+ container.dispose();
99
+ }
92
100
  });
93
101
  };
94
102
  // eslint-disable-next-line unicorn/prefer-ternary
@@ -1 +1 @@
1
- {"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,iFAAqE;AACrE,uEAA0D;AAC1D,6DAAoF;AACpF,qEAAmE;AAEnE,uDAAoD;AACpD,mCAAyF;AAGzF,sDAAqF;AAgBrF,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;GAEG;AACI,KAAK,UAAU,UAAU,CAC/B,kBAAuC,EACvC,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAAoC,E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AI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;iBAC/B,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,EAAE,OAAO,CAAC,CAAC;KACZ;SAAM;QACN,OAAO,EAAE,EAAE,CAAC;KACZ;AACF,CAAC;AAxCD,8DAwCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver\";\nimport { getSnapshotFileContent, timeoutPromise, getArgsValidationError } from \"./utils\";\n/* eslint-disable import/no-internal-modules */\nimport { ITelemetryOptions } from \"./logger/fileLogger\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils\";\n/* eslint-enable import/no-internal-modules */\n\nexport type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;\n\ninterface IExportFileResponseSuccess {\n\tsuccess: true;\n}\n\ninterface IExportFileResponseFailure {\n\tsuccess: false;\n\teventName: string;\n\terrorMessage: string;\n\terror?: any;\n}\n\nconst clientArgsValidationError = \"Client_ArgsValidationError\";\n\n/**\n * Execute code on Container based on ODSP snapshot and write result to file\n */\nexport async function exportFile(\n\tfluidFileConverter: IFluidFileConverter,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n\ttimeout?: number,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ExportFile\" },\n\t\t\tasync () => {\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);\n\t\t\t\tif (argsValidationError) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: argsValidationError });\n\t\t\t\t\treturn { success: false, eventName, errorMessage: argsValidationError };\n\t\t\t\t}\n\n\t\t\t\tfs.writeFileSync(\n\t\t\t\t\toutputFile,\n\t\t\t\t\tawait createContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidFileConverter,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n\n/**\n * Create the container based on an ODSP snapshot and execute code on it\n * @returns result of execution\n */\nexport async function createContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tlogger: ITelemetryLogger,\n\toptions?: string,\n\ttimeout?: number,\n): Promise<string> {\n\tconst fn = async () => {\n\t\tconst loader = new Loader({\n\t\t\turlResolver: new FakeUrlResolver(),\n\t\t\tdocumentServiceFactory: createLocalOdspDocumentServiceFactory(localOdspSnapshot),\n\t\t\tcodeLoader: await fluidFileConverter.getCodeLoader(logger),\n\t\t\tscope: await fluidFileConverter.getScope?.(logger),\n\t\t\tlogger,\n\t\t});\n\n\t\tconst container = await loader.resolve({\n\t\t\turl: \"/fakeUrl/\",\n\t\t\theaders: {\n\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t\t},\n\t\t});\n\n\t\treturn PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () => {\n\t\t\tconst result = await fluidFileConverter.execute(container, options);\n\t\t\tcontainer.close();\n\t\t\treturn result;\n\t\t});\n\t};\n\n\t// eslint-disable-next-line unicorn/prefer-ternary\n\tif (timeout !== undefined) {\n\t\treturn timeoutPromise<string>((resolve, reject) => {\n\t\t\tfn()\n\t\t\t\t.then((value) => resolve(value))\n\t\t\t\t.catch((error) => reject(error));\n\t\t}, timeout);\n\t} else {\n\t\treturn fn();\n\t}\n}\n"]}
1
+ {"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAwF;AACxF,iFAAqE;AACrE,uEAA0D;AAC1D,6DAAoF;AAEpF,uDAAoD;AACpD,mCAAyF;AAGzF,sDAAqF;AAgBrF,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;GAEG;AACI,KAAK,UAAU,UAAU,CAC/B,kBAAuC,EACvC,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAAoC,EACpC,OAAgB,EAChB,mBAA6B;IAE7B,MAAM,iBAAiB,GAAG,IAAA,6CAA+B,EAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAAiB,EAAE;QACtB,MAAM,SAAS,GAAG,yBAAyB,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;KACtE;IACD,MAAM,EAAE,UAAU,EAAE,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AAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,EAAE,OAAO,CAAC,CAAC;KACZ;SAAM;QACN,OAAO,EAAE,EAAE,CAAC;KACZ;AACF,CAAC;AAjDD,8DAiDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver\";\nimport { getSnapshotFileContent, timeoutPromise, getArgsValidationError } from \"./utils\";\n/* eslint-disable import/no-internal-modules */\nimport { ITelemetryOptions } from \"./logger/fileLogger\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils\";\n/* eslint-enable import/no-internal-modules */\n\nexport type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;\n\ninterface IExportFileResponseSuccess {\n\tsuccess: true;\n}\n\ninterface IExportFileResponseFailure {\n\tsuccess: false;\n\teventName: string;\n\terrorMessage: string;\n\terror?: any;\n}\n\nconst clientArgsValidationError = \"Client_ArgsValidationError\";\n\n/**\n * Execute code on Container based on ODSP snapshot and write result to file\n */\nexport async function exportFile(\n\tfluidFileConverter: IFluidFileConverter,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n\ttimeout?: number,\n\tdisableNetworkFetch?: boolean,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ExportFile\" },\n\t\t\tasync () => {\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);\n\t\t\t\tif (argsValidationError) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: argsValidationError });\n\t\t\t\t\treturn { success: false, eventName, errorMessage: argsValidationError };\n\t\t\t\t}\n\n\t\t\t\tfs.writeFileSync(\n\t\t\t\t\toutputFile,\n\t\t\t\t\tawait createContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidFileConverter,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tdisableNetworkFetch,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n\n/**\n * Create the container based on an ODSP snapshot and execute code on it\n * @returns result of execution\n */\nexport async function createContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tlogger: ITelemetryLoggerExt,\n\toptions?: string,\n\ttimeout?: number,\n\tdisableNetworkFetch: boolean = false,\n): Promise<string> {\n\tconst fn = async () => {\n\t\tif (disableNetworkFetch) {\n\t\t\tglobal.fetch = async () => {\n\t\t\t\tthrow new Error(\"Network fetch is not allowed\");\n\t\t\t};\n\t\t}\n\n\t\tconst loader = new Loader({\n\t\t\turlResolver: new FakeUrlResolver(),\n\t\t\tdocumentServiceFactory: createLocalOdspDocumentServiceFactory(localOdspSnapshot),\n\t\t\tcodeLoader: await fluidFileConverter.getCodeLoader(logger),\n\t\t\tscope: await fluidFileConverter.getScope?.(logger),\n\t\t\tlogger,\n\t\t});\n\n\t\tconst container = await loader.resolve({\n\t\t\turl: \"/fakeUrl/\",\n\t\t\theaders: {\n\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t\t},\n\t\t});\n\n\t\treturn PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () => {\n\t\t\ttry {\n\t\t\t\treturn await fluidFileConverter.execute(container, options);\n\t\t\t} finally {\n\t\t\t\tcontainer.dispose();\n\t\t\t}\n\t\t});\n\t};\n\n\t// eslint-disable-next-line unicorn/prefer-ternary\n\tif (timeout !== undefined) {\n\t\treturn timeoutPromise<string>((resolve, reject) => {\n\t\t\tfn()\n\t\t\t\t.then((value) => resolve(value))\n\t\t\t\t.catch((error) => reject(error));\n\t\t}, timeout);\n\t} else {\n\t\treturn fn();\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fluidRunner.d.ts","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,QA6GnE"}
1
+ {"version":3,"file":"fluidRunner.d.ts","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,QAqHnE"}
@@ -86,6 +86,12 @@ function fluidRunner(fluidFileConverter) {
86
86
  describe: "Allowed timeout in ms before process is automatically cancelled",
87
87
  type: "number",
88
88
  demandOption: false,
89
+ })
90
+ .option("disableNetworkFetch", {
91
+ describe: "Should network fetch calls be explicitly disabled?",
92
+ type: "boolean",
93
+ demandOption: false,
94
+ default: false,
89
95
  }),
90
96
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
91
97
  async (argv) => {
@@ -100,8 +106,8 @@ function fluidRunner(fluidFileConverter) {
100
106
  process.exit(1);
101
107
  }
102
108
  const result = await (argv.codeLoader
103
- ? (0, parseBundleAndExportFile_1.parseBundleAndExportFile)(argv.codeLoader, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions, argv.timeout)
104
- : (0, exportFile_1.exportFile)(fluidFileConverter, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions, argv.timeout));
109
+ ? (0, parseBundleAndExportFile_1.parseBundleAndExportFile)(argv.codeLoader, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions, argv.timeout, argv.disableNetworkFetch)
110
+ : (0, exportFile_1.exportFile)(fluidFileConverter, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions, argv.timeout, argv.disableNetworkFetch));
105
111
  if (!result.success) {
106
112
  console.error(`${result.eventName}: ${result.errorMessage}`);
107
113
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,6CAA0C;AAE1C,yEAAsE;AACtE,sDAAsD;AACtD,sDAAwE;AACxE,mCAAkD;AAElD;;GAEG;AACH,SAAgB,WAAW,CAAC,kBAAwC;IACnE,oEAAoE;IACpE,KAAK;SACH,MAAM,EAAE;SACR,OAAO,CAAC,KAAK,CAAC;SACd,OAAO,CACP,YAAY,EACZ,8CAA8C;IAC9C,wDAAwD;IACxD,CAAC,KAAK,EAAE,EA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copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as yargs from \"yargs\";\nimport { exportFile } from \"./exportFile\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { parseBundleAndExportFile } from \"./parseBundleAndExportFile\";\n// eslint-disable-next-line import/no-internal-modules\nimport { validateAndParseTelemetryOptions } from \"./logger/loggerUtils\";\nimport { validateCommandLineArgs } from \"./utils\";\n\n/**\n * @param fluidFileConverter - needs to be provided if \"codeLoaderBundle\" is not and vice versa\n */\nexport function fluidRunner(fluidFileConverter?: IFluidFileConverter) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\tyargs\n\t\t.strict()\n\t\t.version(false)\n\t\t.command(\n\t\t\t\"exportFile\",\n\t\t\t\"Generate an output for a local ODSP snapshot\",\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\t\t(yargs) =>\n\t\t\t\tyargs\n\t\t\t\t\t.option(\"codeLoader\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Path to code loader bundle. Required if this application is being called without modification.\\nSee \"README.md\" for more details.',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"inputFile\", {\n\t\t\t\t\t\tdescribe: \"Path to local ODSP snapshot\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"outputFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of output file (cannot already exist).\\nExecution result will be written here\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of telemetry file for config and session data (cannot already exist)\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"options\", {\n\t\t\t\t\t\tdescribe: \"Additional options passed to container on execution\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFormat\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Output format for telemetry. Current options are: [\"JSON\", \"CSV\"]',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t\tdefault: \"JSON\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryProp\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Property to add to every telemetry entry. Formatted like \"--telemetryProp prop1 value1 --telemetryProp prop2 \\\\\"value 2\\\\\"\".',\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"eventsPerFlush\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Number of telemetry events per flush to telemetryFile (only applicable for JSON format)\",\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"timeout\", {\n\t\t\t\t\t\tdescribe: \"Allowed timeout in ms before process is automatically cancelled\",\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t}),\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises\n\t\t\tasync (argv) => {\n\t\t\t\tconst argsError = validateCommandLineArgs(argv.codeLoader, fluidFileConverter);\n\t\t\t\tif (argsError) {\n\t\t\t\t\tconsole.error(argsError);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tconst telemetryOptionsResult = validateAndParseTelemetryOptions(\n\t\t\t\t\targv.telemetryFormat,\n\t\t\t\t\targv.telemetryProp,\n\t\t\t\t\targv.eventsPerFlush,\n\t\t\t\t);\n\t\t\t\tif (!telemetryOptionsResult.success) {\n\t\t\t\t\tconsole.error(telemetryOptionsResult.error);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\n\t\t\t\tconst result = await (argv.codeLoader\n\t\t\t\t\t? parseBundleAndExportFile(\n\t\t\t\t\t\t\targv.codeLoader,\n\t\t\t\t\t\t\targv.inputFile,\n\t\t\t\t\t\t\targv.outputFile,\n\t\t\t\t\t\t\targv.telemetryFile,\n\t\t\t\t\t\t\targv.options,\n\t\t\t\t\t\t\ttelemetryOptionsResult.telemetryOptions,\n\t\t\t\t\t\t\targv.timeout,\n\t\t\t\t\t )\n\t\t\t\t\t: exportFile(\n\t\t\t\t\t\t\tfluidFileConverter!,\n\t\t\t\t\t\t\targv.inputFile,\n\t\t\t\t\t\t\targv.outputFile,\n\t\t\t\t\t\t\targv.telemetryFile,\n\t\t\t\t\t\t\targv.options,\n\t\t\t\t\t\t\ttelemetryOptionsResult.telemetryOptions,\n\t\t\t\t\t\t\targv.timeout,\n\t\t\t\t\t ));\n\n\t\t\t\tif (!result.success) {\n\t\t\t\t\tconsole.error(`${result.eventName}: ${result.errorMessage}`);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t)\n\t\t.help()\n\t\t.demandCommand().argv;\n}\n"]}
1
+ {"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,6CAA0C;AAE1C,yEAAsE;AACtE,sDAAsD;AACtD,sDAAwE;AACxE,mCAAkD;AAElD;;GAEG;AACH,SAAgB,WAAW,CAAC,kBAAwC;IACnE,oEAAoE;IACpE,KAAK;SACH,MAAM,EAAE;SACR,OAAO,CAAC,KAAK,CAAC;SACd,OAAO,CACP,YAAY,EACZ,8CAA8C;IAC9C,wD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E,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CACD;SACA,IAAI,EAAE;SACN,aAAa,EAAE,CAAC,IAAI,CAAC;AACxB,CAAC;AArHD,kCAqHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as yargs from \"yargs\";\nimport { exportFile } from \"./exportFile\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { parseBundleAndExportFile } from \"./parseBundleAndExportFile\";\n// eslint-disable-next-line import/no-internal-modules\nimport { validateAndParseTelemetryOptions } from \"./logger/loggerUtils\";\nimport { validateCommandLineArgs } from \"./utils\";\n\n/**\n * @param fluidFileConverter - needs to be provided if \"codeLoaderBundle\" is not and vice versa\n */\nexport function fluidRunner(fluidFileConverter?: IFluidFileConverter) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\tyargs\n\t\t.strict()\n\t\t.version(false)\n\t\t.command(\n\t\t\t\"exportFile\",\n\t\t\t\"Generate an output for a local ODSP snapshot\",\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\t\t(yargs) =>\n\t\t\t\tyargs\n\t\t\t\t\t.option(\"codeLoader\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Path to code loader bundle. Required if this application is being called without modification.\\nSee \"README.md\" for more details.',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"inputFile\", {\n\t\t\t\t\t\tdescribe: \"Path to local ODSP snapshot\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"outputFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of output file (cannot already exist).\\nExecution result will be written here\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of telemetry file for config and session data (cannot already exist)\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"options\", {\n\t\t\t\t\t\tdescribe: \"Additional options passed to container on execution\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFormat\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Output format for telemetry. Current options are: [\"JSON\", \"CSV\"]',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t\tdefault: \"JSON\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryProp\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Property to add to every telemetry entry. Formatted like \"--telemetryProp prop1 value1 --telemetryProp prop2 \\\\\"value 2\\\\\"\".',\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"eventsPerFlush\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Number of telemetry events per flush to telemetryFile (only applicable for JSON format)\",\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"timeout\", {\n\t\t\t\t\t\tdescribe: \"Allowed timeout in ms before process is automatically cancelled\",\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"disableNetworkFetch\", {\n\t\t\t\t\t\tdescribe: \"Should network fetch calls be explicitly disabled?\",\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t}),\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises\n\t\t\tasync (argv) => {\n\t\t\t\tconst argsError = validateCommandLineArgs(argv.codeLoader, fluidFileConverter);\n\t\t\t\tif (argsError) {\n\t\t\t\t\tconsole.error(argsError);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tconst telemetryOptionsResult = validateAndParseTelemetryOptions(\n\t\t\t\t\targv.telemetryFormat,\n\t\t\t\t\targv.telemetryProp,\n\t\t\t\t\targv.eventsPerFlush,\n\t\t\t\t);\n\t\t\t\tif (!telemetryOptionsResult.success) {\n\t\t\t\t\tconsole.error(telemetryOptionsResult.error);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\n\t\t\t\tconst result = await (argv.codeLoader\n\t\t\t\t\t? parseBundleAndExportFile(\n\t\t\t\t\t\t\targv.codeLoader,\n\t\t\t\t\t\t\targv.inputFile,\n\t\t\t\t\t\t\targv.outputFile,\n\t\t\t\t\t\t\targv.telemetryFile,\n\t\t\t\t\t\t\targv.options,\n\t\t\t\t\t\t\ttelemetryOptionsResult.telemetryOptions,\n\t\t\t\t\t\t\targv.timeout,\n\t\t\t\t\t\t\targv.disableNetworkFetch,\n\t\t\t\t\t )\n\t\t\t\t\t: exportFile(\n\t\t\t\t\t\t\tfluidFileConverter!,\n\t\t\t\t\t\t\targv.inputFile,\n\t\t\t\t\t\t\targv.outputFile,\n\t\t\t\t\t\t\targv.telemetryFile,\n\t\t\t\t\t\t\targv.options,\n\t\t\t\t\t\t\ttelemetryOptionsResult.telemetryOptions,\n\t\t\t\t\t\t\targv.timeout,\n\t\t\t\t\t\t\targv.disableNetworkFetch,\n\t\t\t\t\t ));\n\n\t\t\t\tif (!result.success) {\n\t\t\t\t\tconsole.error(`${result.eventName}: ${result.errorMessage}`);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t)\n\t\t.help()\n\t\t.demandCommand().argv;\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseEvent } from "@fluidframework/common-definitions";
5
+ import { ITelemetryBaseEvent } from "@fluidframework/core-interfaces";
6
6
  import { IFileLogger } from "./fileLogger";
7
7
  /**
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"baseFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/baseFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,8BAAsB,cAAe,YAAW,WAAW;IAazD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACnC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IACzC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC;IAd1B,YAAY,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAEvC,0CAA0C;IAC1C,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,CAAM;IAC7B,SAAS,CAAC,gBAAgB,UAAS;IAEnC;;;;OAIG;gBAEiB,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,MAAW,EAC3B,YAAY,CAAC,6CAAiC;IAG3D,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;cAW7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAazB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
1
+ {"version":3,"file":"baseFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/baseFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH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AI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAExB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,EAAE;YAC5E,mEAAmE;YACnE,IAAI,CAAC,KAAK,EAAE,CAAC;SACb;IACF,CAAC;IAES,KAAK,CAAC,KAAK;QACpB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC7E,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBAC1B,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,cAAc,EAAE,CAAC,CAAC;aACvD;iBAAM;gBACN,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;aACjD;YACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;SAC7B;IACF,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACD;AA7CD,wCA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { IFileLogger } from \"./fileLogger\";\n\n/**\n * @internal\n */\nexport abstract class BaseFileLogger implements IFileLogger {\n\tpublic supportsTags?: true | undefined;\n\n\t/** Hold events in memory until flushed */\n\tprotected events: any[] = [];\n\tprotected hasWrittenToFile = false;\n\n\t/**\n\t * @param filePath - file path to write logs to\n\t * @param eventsPerFlush - number of events per flush\n\t * @param defaultProps - default properties to add to every telemetry event\n\t */\n\tpublic constructor(\n\t\tprotected readonly filePath: string,\n\t\tprotected readonly eventsPerFlush: number = 50,\n\t\tprotected readonly defaultProps?: Record<string, string | number>,\n\t) {}\n\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tevent = { ...event, ...this.defaultProps };\n\t\tthis.events.push(event);\n\n\t\tif (this.events.length >= this.eventsPerFlush || event.category === \"error\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tthis.flush();\n\t\t}\n\t}\n\n\tprotected async flush(): Promise<void> {\n\t\tif (this.events.length > 0) {\n\t\t\tconst contentToWrite = this.events.map((it) => JSON.stringify(it)).join(\",\");\n\t\t\tif (this.hasWrittenToFile) {\n\t\t\t\tfs.appendFileSync(this.filePath, `,${contentToWrite}`);\n\t\t\t} else {\n\t\t\t\tfs.appendFileSync(this.filePath, contentToWrite);\n\t\t\t}\n\t\t\tthis.events = [];\n\t\t\tthis.hasWrittenToFile = true;\n\t\t}\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait this.flush();\n\t}\n}\n"]}
1
+ {"version":3,"file":"baseFileLogger.js","sourceRoot":"","sources":["../../src/logger/baseFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAIzB;;GAEG;AACH,MAAsB,cAAc;IAOnC;;;;OAIG;IACH,YACoB,QAAgB,EAChB,iBAAyB,EAAE,EAC3B,YAA8C;QAF9C,aAAQ,GAAR,QAAQ,CAAQ;QAChB,mBAAc,GAAd,cAAc,CAAa;QAC3B,iBAAY,GAAZ,YAAY,CAAkC;QAZlE,0CAA0C;QAChC,WAAM,GAAU,EAAE,CAAC;QACnB,qBAAgB,GAAG,KAAK,CAAC;IAWhC,CAAC;IAEG,IAAI,CAAC,KAA0B;QACrC,6CAA6C;QAC7C,KAAK,mCAAQ,KAAK,GAAK,IAAI,CAAC,YAAY,CAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAExB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,EAAE;YAC5E,mEAAmE;YACnE,IAAI,CAAC,KAAK,EAAE,CAAC;SACb;IACF,CAAC;IAES,KAAK,CAAC,KAAK;QACpB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC7E,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBAC1B,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,cAAc,EAAE,CAAC,CAAC;aACvD;iBAAM;gBACN,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;aACjD;YACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;SAC7B;IACF,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACD;AA7CD,wCA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryBaseEvent } from \"@fluidframework/core-interfaces\";\nimport { IFileLogger } from \"./fileLogger\";\n\n/**\n * @internal\n */\nexport abstract class BaseFileLogger implements IFileLogger {\n\tpublic supportsTags?: true | undefined;\n\n\t/** Hold events in memory until flushed */\n\tprotected events: any[] = [];\n\tprotected hasWrittenToFile = false;\n\n\t/**\n\t * @param filePath - file path to write logs to\n\t * @param eventsPerFlush - number of events per flush\n\t * @param defaultProps - default properties to add to every telemetry event\n\t */\n\tpublic constructor(\n\t\tprotected readonly filePath: string,\n\t\tprotected readonly eventsPerFlush: number = 50,\n\t\tprotected readonly defaultProps?: Record<string, string | number>,\n\t) {}\n\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tevent = { ...event, ...this.defaultProps };\n\t\tthis.events.push(event);\n\n\t\tif (this.events.length >= this.eventsPerFlush || event.category === \"error\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tthis.flush();\n\t\t}\n\t}\n\n\tprotected async flush(): Promise<void> {\n\t\tif (this.events.length > 0) {\n\t\t\tconst contentToWrite = this.events.map((it) => JSON.stringify(it)).join(\",\");\n\t\t\tif (this.hasWrittenToFile) {\n\t\t\t\tfs.appendFileSync(this.filePath, `,${contentToWrite}`);\n\t\t\t} else {\n\t\t\t\tfs.appendFileSync(this.filePath, contentToWrite);\n\t\t\t}\n\t\t\tthis.events = [];\n\t\t\tthis.hasWrittenToFile = true;\n\t\t}\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait this.flush();\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseEvent } from "@fluidframework/common-definitions";
5
+ import { ITelemetryBaseEvent } from "@fluidframework/core-interfaces";
6
6
  import { BaseFileLogger } from "./baseFileLogger";
7
7
  /**
8
8
  * FileLogger that writes events into a defined CSV file
@@ -1 +1 @@
1
- {"version":3,"file":"csvFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,cAAc;IAChD,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;cAErB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAQhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CASnC"}
1
+ {"version":3,"file":"csvFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,cAAc;IAChD,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;cAErB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAQhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CASnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"csvFileLogger.js","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,uCAAiC;AAEjC,qDAAkD;AAElD;;;GAGG;AACH,MAAa,aAAc,SAAQ,+BAAc;IAAjD;;QACC,wDAAwD;QACvC,YAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAuBtC,CAAC;IArBU,KAAK,CAAC,KAAK;QACpB,yFAAyF;IAC1F,CAAC;IAEM,IAAI,CAAC,KAA0B;QACrC,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACvB;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,8DAA8D;QAC9D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAA,gBAAK,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;CACD;AAzBD,sCAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { parse } from \"json2csv\";\nimport { ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { BaseFileLogger } from \"./baseFileLogger\";\n\n/**\n * FileLogger that writes events into a defined CSV file\n * @internal\n */\nexport class CSVFileLogger extends BaseFileLogger {\n\t/** Store the column names to write as the CSV header */\n\tprivate readonly columns = new Set();\n\n\tprotected async flush(): Promise<void> {\n\t\t// No flushing is performed since we need all log entries to determine set of CSV columns\n\t}\n\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const prop in event) {\n\t\t\tthis.columns.add(prop);\n\t\t}\n\t\tsuper.send(event);\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait super.close();\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const field in this.defaultProps) {\n\t\t\tthis.columns.add(field);\n\t\t}\n\n\t\tfs.writeFileSync(this.filePath, parse(this.events, Array.from(this.columns)));\n\t}\n}\n"]}
1
+ {"version":3,"file":"csvFileLogger.js","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,uCAAiC;AAEjC,qDAAkD;AAElD;;;GAGG;AACH,MAAa,aAAc,SAAQ,+BAAc;IAAjD;;QACC,wDAAwD;QACvC,YAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAuBtC,CAAC;IArBU,KAAK,CAAC,KAAK;QACpB,yFAAyF;IAC1F,CAAC;IAEM,IAAI,CAAC,KAA0B;QACrC,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACvB;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,8DAA8D;QAC9D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAA,gBAAK,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;CACD;AAzBD,sCAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { parse } from \"json2csv\";\nimport { ITelemetryBaseEvent } from \"@fluidframework/core-interfaces\";\nimport { BaseFileLogger } from \"./baseFileLogger\";\n\n/**\n * FileLogger that writes events into a defined CSV file\n * @internal\n */\nexport class CSVFileLogger extends BaseFileLogger {\n\t/** Store the column names to write as the CSV header */\n\tprivate readonly columns = new Set();\n\n\tprotected async flush(): Promise<void> {\n\t\t// No flushing is performed since we need all log entries to determine set of CSV columns\n\t}\n\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const prop in event) {\n\t\t\tthis.columns.add(prop);\n\t\t}\n\t\tsuper.send(event);\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait super.close();\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const field in this.defaultProps) {\n\t\t\tthis.columns.add(field);\n\t\t}\n\n\t\tfs.writeFileSync(this.filePath, parse(this.events, Array.from(this.columns)));\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
6
  /**
7
7
  * Contract for logger that writes telemetry to a file
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACxD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,YAAY;IACvB,IAAI,IAAA;IACJ,GAAG,IAAA;CACH;AAGD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,iFAAiF;IACjF,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAE/C,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACxD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,YAAY;IACvB,IAAI,IAAA;IACJ,GAAG,IAAA;CACH;AAGD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,iFAAiF;IACjF,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAE/C,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAmBD,gCAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\n\n/**\n * Contract for logger that writes telemetry to a file\n * @internal\n */\nexport interface IFileLogger extends ITelemetryBaseLogger {\n\t/**\n\t * This method acts as a \"dispose\" and should be explicitly called at the end of execution\n\t */\n\tclose(): Promise<void>;\n}\n\n/**\n * Desired output format for the telemetry\n */\nexport enum OutputFormat {\n\tJSON,\n\tCSV,\n}\n\n/* eslint-disable tsdoc/syntax */\n/**\n * Options to provide upon creation of IFileLogger\n */\nexport interface ITelemetryOptions {\n\t/** Desired output format used to create a specific IFileLogger implementation */\n\toutputFormat?: OutputFormat;\n\n\t/**\n\t * Properties that should be added to every telemetry event\n\t * Example: { \"prop1\": \"value1\", \"prop2\": 10.0 }\n\t */\n\tdefaultProps?: Record<string, string | number>;\n\n\t/** Number of telemetry events per flush to telemetry file */\n\teventsPerFlush?: number;\n}\n/* eslint-enable tsdoc/syntax */\n"]}
1
+ {"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAmBD,gCAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract for logger that writes telemetry to a file\n * @internal\n */\nexport interface IFileLogger extends ITelemetryBaseLogger {\n\t/**\n\t * This method acts as a \"dispose\" and should be explicitly called at the end of execution\n\t */\n\tclose(): Promise<void>;\n}\n\n/**\n * Desired output format for the telemetry\n */\nexport enum OutputFormat {\n\tJSON,\n\tCSV,\n}\n\n/* eslint-disable tsdoc/syntax */\n/**\n * Options to provide upon creation of IFileLogger\n */\nexport interface ITelemetryOptions {\n\t/** Desired output format used to create a specific IFileLogger implementation */\n\toutputFormat?: OutputFormat;\n\n\t/**\n\t * Properties that should be added to every telemetry event\n\t * Example: { \"prop1\": \"value1\", \"prop2\": 10.0 }\n\t */\n\tdefaultProps?: Record<string, string | number>;\n\n\t/** Number of telemetry events per flush to telemetry file */\n\teventsPerFlush?: number;\n}\n/* eslint-enable tsdoc/syntax */\n"]}
@@ -2,17 +2,17 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
6
  import { IFileLogger, ITelemetryOptions } from "./fileLogger";
7
7
  /**
8
- * Create a ITelemetryLogger wrapped around provided IFileLogger
8
+ * Create a ITelemetryLoggerExt wrapped around provided IFileLogger
9
9
  * ! It is expected that all events be sent through the returned "logger" value
10
10
  * ! The "fileLogger" value should have its "close()" method called at the end of execution
11
11
  * Note: if an output format is not supplied, default is JSON
12
- * @returns - both the IFileLogger implementation and ITelemetryLogger wrapper to be called
12
+ * @returns - both the IFileLogger implementation and ITelemetryLoggerExt wrapper to be called
13
13
  */
14
14
  export declare function createLogger(filePath: string, options?: ITelemetryOptions): {
15
- logger: ITelemetryLogger;
15
+ logger: ITelemetryLoggerExt;
16
16
  fileLogger: IFileLogger;
17
17
  };
18
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAgB,MAAM,cAAc,CAAC;AAG5E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,GACzB;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAWvD;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQzF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC/C,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,cAAc,CAAC,EAAE,MAAM,GACrB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,gBAAgB,EAAE,iBAAiB,CAAA;CAAE,CAqC5F"}
1
+ {"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAe,MAAM,iCAAiC,CAAC;AAEnF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAgB,MAAM,cAAc,CAAC;AAG5E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,GACzB;IAAE,MAAM,EAAE,mBAAmB,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAW1D;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQzF;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC/C,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,cAAc,CAAC,EAAE,MAAM,GACrB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,gBAAgB,EAAE,iBAAiB,CAAA;CAAE,CAqC5F"}
@@ -30,11 +30,11 @@ const csvFileLogger_1 = require("./csvFileLogger");
30
30
  const fileLogger_1 = require("./fileLogger");
31
31
  const jsonFileLogger_1 = require("./jsonFileLogger");
32
32
  /**
33
- * Create a ITelemetryLogger wrapped around provided IFileLogger
33
+ * Create a ITelemetryLoggerExt wrapped around provided IFileLogger
34
34
  * ! It is expected that all events be sent through the returned "logger" value
35
35
  * ! The "fileLogger" value should have its "close()" method called at the end of execution
36
36
  * Note: if an output format is not supplied, default is JSON
37
- * @returns - both the IFileLogger implementation and ITelemetryLogger wrapper to be called
37
+ * @returns - both the IFileLogger implementation and ITelemetryLoggerExt wrapper to be called
38
38
  */
39
39
  function createLogger(filePath, options) {
40
40
  const fileLogger = (options === null || options === void 0 ? void 0 : options.outputFormat) === fileLogger_1.OutputFormat.CSV
@@ -1 +1 @@
1
- {"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,qEAA8D;AAC9D,mDAAgD;AAChD,6CAA4E;AAC5E,qDAAkD;AAElD;;;;;;GAMG;AACH,SAAgB,YAAY,CAC3B,QAAgB,EAChB,OAA2B;IAE3B,MAAM,UAAU,GACf,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,MAAK,yBAAY,CAAC,GAAG;QACzC,CAAC,CAAC,IAAI,6BAAa,CAAC,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC;QAC7E,CAAC,CAAC,IAAI,+BAAc,CAAC,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,CAAC;IAEjF,MAAM,MAAM,GAAG,6BAAW,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,EAAE;QACvE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;KACrC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAdD,oCAcC;AAED;;;GAGG;AACH,SAAgB,+BAA+B,CAAC,aAAqB;IACpE,IAAI,CAAC,aAAa,EAAE;QACnB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AE,KAAK;YACd,KAAK,EAAE,wBAAwB;SAC/B,CAAC;KACF;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC;AAC5F,CAAC;AAzCD,4EAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { CSVFileLogger } from \"./csvFileLogger\";\nimport { IFileLogger, ITelemetryOptions, OutputFormat } from \"./fileLogger\";\nimport { JSONFileLogger } from \"./jsonFileLogger\";\n\n/**\n * Create a ITelemetryLogger wrapped around provided IFileLogger\n * ! It is expected that all events be sent through the returned \"logger\" value\n * ! The \"fileLogger\" value should have its \"close()\" method called at the end of execution\n * Note: if an output format is not supplied, default is JSON\n * @returns - both the IFileLogger implementation and ITelemetryLogger wrapper to be called\n */\nexport function createLogger(\n\tfilePath: string,\n\toptions?: ITelemetryOptions,\n): { logger: ITelemetryLogger; fileLogger: IFileLogger } {\n\tconst fileLogger =\n\t\toptions?.outputFormat === OutputFormat.CSV\n\t\t\t? new CSVFileLogger(filePath, options?.eventsPerFlush, options?.defaultProps)\n\t\t\t: new JSONFileLogger(filePath, options?.eventsPerFlush, options?.defaultProps);\n\n\tconst logger = ChildLogger.create(fileLogger, \"LocalSnapshotRunnerApp\", {\n\t\tall: { Event_Time: () => Date.now() },\n\t});\n\n\treturn { logger, fileLogger };\n}\n\n/**\n * Validate the telemetryFile command line argument\n * @param telemetryFile - path where telemetry will be written\n */\nexport function getTelemetryFileValidationError(telemetryFile: string): string | undefined {\n\tif (!telemetryFile) {\n\t\treturn \"Telemetry file argument is missing.\";\n\t} else if (fs.existsSync(telemetryFile)) {\n\t\treturn `Telemetry file already exists [${telemetryFile}].`;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validate the provided output format and default properties\n * @param format - desired output format of the telemetry\n * @param props - default properties to be added to every telemetry entry\n */\nexport function validateAndParseTelemetryOptions(\n\tformat?: string,\n\tprops?: (string | number)[],\n\teventsPerFlush?: number,\n): { success: false; error: string } | { success: true; telemetryOptions: ITelemetryOptions } {\n\tlet outputFormat: OutputFormat | undefined;\n\tconst defaultProps: Record<string, string | number> = {};\n\n\tif (format) {\n\t\toutputFormat = OutputFormat[format];\n\t\tif (outputFormat === undefined) {\n\t\t\treturn { success: false, error: `Invalid telemetry format [${format}]` };\n\t\t}\n\t}\n\n\tif (props && props.length > 0) {\n\t\tif (props.length % 2 !== 0) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: `Invalid number of telemetry properties to add [${props.length}]`,\n\t\t\t};\n\t\t}\n\t\tfor (let i = 0; i < props.length; i += 2) {\n\t\t\tif (typeof props[i] === \"number\") {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: `Property name cannot be number at index [${i}] -> [${props[i]}]`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefaultProps[props[i]] = props[i + 1];\n\t\t}\n\t}\n\n\tif (eventsPerFlush !== undefined && isNaN(eventsPerFlush)) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: \"Invalid eventsPerFlush\",\n\t\t};\n\t}\n\n\treturn { success: true, telemetryOptions: { outputFormat, defaultProps, eventsPerFlush } };\n}\n"]}
1
+ {"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAmF;AACnF,mDAAgD;AAChD,6CAA4E;AAC5E,qDAAkD;AAElD;;;;;;GAMG;AACH,SAAgB,YAAY,CAC3B,QAAgB,EAChB,OAA2B;IAE3B,MAAM,UAAU,GACf,CAAA,OAAO,aAAP,OAAO,uBAAP,O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AK,CAAC,MAAM,GAAG,CAAC,EAAE;QAC9B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,kDAAkD,KAAK,CAAC,MAAM,GAAG;aACxE,CAAC;SACF;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YACzC,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;gBACjC,OAAO;oBACN,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,4CAA4C,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG;iBACxE,CAAC;aACF;YACD,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACtC;KACD;IAED,IAAI,cAAc,KAAK,SAAS,IAAI,KAAK,CAAC,cAAc,CAAC,EAAE;QAC1D,OAAO;YACN,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,wBAAwB;SAC/B,CAAC;KACF;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC;AAC5F,CAAC;AAzCD,4EAyCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryLoggerExt, ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { CSVFileLogger } from \"./csvFileLogger\";\nimport { IFileLogger, ITelemetryOptions, OutputFormat } from \"./fileLogger\";\nimport { JSONFileLogger } from \"./jsonFileLogger\";\n\n/**\n * Create a ITelemetryLoggerExt wrapped around provided IFileLogger\n * ! It is expected that all events be sent through the returned \"logger\" value\n * ! The \"fileLogger\" value should have its \"close()\" method called at the end of execution\n * Note: if an output format is not supplied, default is JSON\n * @returns - both the IFileLogger implementation and ITelemetryLoggerExt wrapper to be called\n */\nexport function createLogger(\n\tfilePath: string,\n\toptions?: ITelemetryOptions,\n): { logger: ITelemetryLoggerExt; fileLogger: IFileLogger } {\n\tconst fileLogger =\n\t\toptions?.outputFormat === OutputFormat.CSV\n\t\t\t? new CSVFileLogger(filePath, options?.eventsPerFlush, options?.defaultProps)\n\t\t\t: new JSONFileLogger(filePath, options?.eventsPerFlush, options?.defaultProps);\n\n\tconst logger = ChildLogger.create(fileLogger, \"LocalSnapshotRunnerApp\", {\n\t\tall: { Event_Time: () => Date.now() },\n\t});\n\n\treturn { logger, fileLogger };\n}\n\n/**\n * Validate the telemetryFile command line argument\n * @param telemetryFile - path where telemetry will be written\n */\nexport function getTelemetryFileValidationError(telemetryFile: string): string | undefined {\n\tif (!telemetryFile) {\n\t\treturn \"Telemetry file argument is missing.\";\n\t} else if (fs.existsSync(telemetryFile)) {\n\t\treturn `Telemetry file already exists [${telemetryFile}].`;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validate the provided output format and default properties\n * @param format - desired output format of the telemetry\n * @param props - default properties to be added to every telemetry entry\n */\nexport function validateAndParseTelemetryOptions(\n\tformat?: string,\n\tprops?: (string | number)[],\n\teventsPerFlush?: number,\n): { success: false; error: string } | { success: true; telemetryOptions: ITelemetryOptions } {\n\tlet outputFormat: OutputFormat | undefined;\n\tconst defaultProps: Record<string, string | number> = {};\n\n\tif (format) {\n\t\toutputFormat = OutputFormat[format];\n\t\tif (outputFormat === undefined) {\n\t\t\treturn { success: false, error: `Invalid telemetry format [${format}]` };\n\t\t}\n\t}\n\n\tif (props && props.length > 0) {\n\t\tif (props.length % 2 !== 0) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: `Invalid number of telemetry properties to add [${props.length}]`,\n\t\t\t};\n\t\t}\n\t\tfor (let i = 0; i < props.length; i += 2) {\n\t\t\tif (typeof props[i] === \"number\") {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: `Property name cannot be number at index [${i}] -> [${props[i]}]`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefaultProps[props[i]] = props[i + 1];\n\t\t}\n\t}\n\n\tif (eventsPerFlush !== undefined && isNaN(eventsPerFlush)) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: \"Invalid eventsPerFlush\",\n\t\t};\n\t}\n\n\treturn { success: true, telemetryOptions: { outputFormat, defaultProps, eventsPerFlush } };\n}\n"]}
@@ -8,5 +8,5 @@ import { ITelemetryOptions } from "./logger/fileLogger";
8
8
  * Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file
9
9
  * @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)
10
10
  */
11
- export declare function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number): Promise<IExportFileResponse>;
11
+ export declare function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
12
12
  //# sourceMappingURL=parseBundleAndExportFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseBundleAndExportFile.d.ts","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAOxD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC7C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CA2D9B"}
1
+ {"version":3,"file":"parseBundleAndExportFile.d.ts","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAOxD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC7C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA4D9B"}
@@ -36,7 +36,7 @@ const clientArgsValidationError = "Client_ArgsValidationError";
36
36
  * Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file
37
37
  * @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)
38
38
  */
39
- async function parseBundleAndExportFile(codeLoader, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout) {
39
+ async function parseBundleAndExportFile(codeLoader, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout, disableNetworkFetch) {
40
40
  const telemetryArgError = (0, loggerUtils_1.getTelemetryFileValidationError)(telemetryFile);
41
41
  if (telemetryArgError) {
42
42
  const eventName = clientArgsValidationError;
@@ -66,7 +66,7 @@ async function parseBundleAndExportFile(codeLoader, inputFile, outputFile, telem
66
66
  logger.sendErrorEvent({ eventName, message: argsValidationError });
67
67
  return { success: false, eventName, errorMessage: argsValidationError };
68
68
  }
69
- fs.writeFileSync(outputFile, await (0, exportFile_1.createContainerAndExecute)((0, utils_1.getSnapshotFileContent)(inputFile), fluidExport, logger, options, timeout));
69
+ fs.writeFileSync(outputFile, await (0, exportFile_1.createContainerAndExecute)((0, utils_1.getSnapshotFileContent)(inputFile), fluidExport, logger, options, timeout, disableNetworkFetch));
70
70
  return { success: true };
71
71
  });
72
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAmE;AACnE,yDAA8E;AAC9E,6CAA8E;AAG9E,sDAAqF;AACrF,8CAA8C;AAC9C,mCAAyE;AAEzE,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC7C,UAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAAoC,EACpC,OAAgB;IAEhB,MAAM,iBAAiB,GAAG,IAAA,6CAA+B,EAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAAiB,EAAE;QACtB,MAAM,SAAS,GAAG,yBAAyB,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;KACtE;IACD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAY,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAE7E,IAAI;QACH,OAAO,MAAM,kCAAgB,CAAC,cAAc,CAC3C,MAAM,EACN,EAAE,SAAS,EAAE,0BAA0B,EAAE,EACzC,KAAK,IAAI,EAAE;YACV,qGAAqG;YACrG,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;YAC7C,IAAI,CAAC,IAAA,qCAAkB,EAAC,gBAAgB,CAAC,EAAE;gBAC1C,MAAM,SAAS,GAAG,yBAAyB,CAAC;gBAC5C,MAAM,YAAY,G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E,KAAK,CAAC,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC;KAC9E;YAAS;QACT,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;KACzB;AACF,CAAC;AAnED,4DAmEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { isCodeLoaderBundle, isFluidFileConverter } from \"./codeLoaderBundle\";\nimport { createContainerAndExecute, IExportFileResponse } from \"./exportFile\";\n/* eslint-disable import/no-internal-modules */\nimport { ITelemetryOptions } from \"./logger/fileLogger\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils\";\n/* eslint-enable import/no-internal-modules */\nimport { getSnapshotFileContent, getArgsValidationError } from \"./utils\";\n\nconst clientArgsValidationError = \"Client_ArgsValidationError\";\n\n/**\n * Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file\n * @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)\n */\nexport async function parseBundleAndExportFile(\n\tcodeLoader: string,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n\ttimeout?: number,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ParseBundleAndExportFile\" },\n\t\t\tasync () => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\n\t\t\t\tconst codeLoaderBundle = require(codeLoader);\n\t\t\t\tif (!isCodeLoaderBundle(codeLoaderBundle)) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tconst errorMessage = \"Code loader bundle is not of type ICodeLoaderBundle\";\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: errorMessage });\n\t\t\t\t\treturn { success: false, eventName, errorMessage };\n\t\t\t\t}\n\n\t\t\t\tconst fluidExport = await codeLoaderBundle.fluidExport;\n\t\t\t\tif (!isFluidFileConverter(fluidExport)) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\"Fluid export from CodeLoaderBundle is not of type IFluidFileConverter\";\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: errorMessage });\n\t\t\t\t\treturn { success: false, eventName, errorMessage };\n\t\t\t\t}\n\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);\n\t\t\t\tif (argsValidationError) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: argsValidationError });\n\t\t\t\t\treturn { success: false, eventName, errorMessage: argsValidationError };\n\t\t\t\t}\n\n\t\t\t\tfs.writeFileSync(\n\t\t\t\t\toutputFile,\n\t\t\t\t\tawait createContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidExport,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n"]}
1
+ {"version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EAAE,CAAC;KACzB;AACF,CAAC;AArED,4DAqEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { isCodeLoaderBundle, isFluidFileConverter } from \"./codeLoaderBundle\";\nimport { createContainerAndExecute, IExportFileResponse } from \"./exportFile\";\n/* eslint-disable import/no-internal-modules */\nimport { ITelemetryOptions } from \"./logger/fileLogger\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils\";\n/* eslint-enable import/no-internal-modules */\nimport { getSnapshotFileContent, getArgsValidationError } from \"./utils\";\n\nconst clientArgsValidationError = \"Client_ArgsValidationError\";\n\n/**\n * Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file\n * @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)\n */\nexport async function parseBundleAndExportFile(\n\tcodeLoader: string,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n\ttimeout?: number,\n\tdisableNetworkFetch?: boolean,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ParseBundleAndExportFile\" },\n\t\t\tasync () => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\n\t\t\t\tconst codeLoaderBundle = require(codeLoader);\n\t\t\t\tif (!isCodeLoaderBundle(codeLoaderBundle)) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tconst errorMessage = \"Code loader bundle is not of type ICodeLoaderBundle\";\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: errorMessage });\n\t\t\t\t\treturn { success: false, eventName, errorMessage };\n\t\t\t\t}\n\n\t\t\t\tconst fluidExport = await codeLoaderBundle.fluidExport;\n\t\t\t\tif (!isFluidFileConverter(fluidExport)) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\"Fluid export from CodeLoaderBundle is not of type IFluidFileConverter\";\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: errorMessage });\n\t\t\t\t\treturn { success: false, eventName, errorMessage };\n\t\t\t\t}\n\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);\n\t\t\t\tif (argsValidationError) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: argsValidationError });\n\t\t\t\t\treturn { success: false, eventName, errorMessage: argsValidationError };\n\t\t\t\t}\n\n\t\t\t\tfs.writeFileSync(\n\t\t\t\t\toutputFile,\n\t\t\t\t\tawait createContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidExport,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tdisableNetworkFetch,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n"]}
@@ -2,9 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
6
5
  import { ICodeDetailsLoader, IContainer } from "@fluidframework/container-definitions";
7
- import { FluidObject } from "@fluidframework/core-interfaces";
6
+ import { ITelemetryBaseLogger, FluidObject } from "@fluidframework/core-interfaces";
8
7
  /**
9
8
  * Contract that defines the necessary exports for the bundle provided at runtime
10
9
  * For an example, see "src/test/sampleCodeLoaders/sampleCodeLoader.ts"
@@ -1 +1 @@
1
- {"version":3,"file":"codeLoaderBundle.d.ts","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzE;;;OAGG;IACH,QAAQ,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE9D;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,iBAAiB,CAG3E;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAQzE"}
1
+ {"version":3,"file":"codeLoaderBundle.d.ts","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[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aAAa,KAAK,UAAU;QACvC,GAAG,CAAC,OAAO;QACX,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CACjC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract that defines the necessary exports for the bundle provided at runtime\n * For an example, see \"src/test/sampleCodeLoaders/sampleCodeLoader.ts\"\n */\nexport interface ICodeLoaderBundle {\n\t/**\n\t * Fluid export of all the required objects and functions\n\t */\n\tfluidExport: Promise<IFluidFileConverter>;\n}\n\n/**\n * Instance that holds all the details for Fluid file conversion\n */\nexport interface IFluidFileConverter {\n\t/**\n\t * Get code loader details to provide at Loader creation\n\t * @param logger - created logger object to pass to code loader\n\t */\n\tgetCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;\n\n\t/**\n\t * Get scope object to provide at Loader creation\n\t * @param logger - created logger object to pass to scope object\n\t */\n\tgetScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;\n\n\t/**\n\t * Executes code on container and returns the result\n\t * @param container - container created by this application\n\t * @param options - additional options\n\t */\n\texecute(container: IContainer, options?: string): Promise<string>;\n}\n\n/**\n * Type cast to ensure necessary methods are present in the provided bundle\n * @param bundle - bundle provided to this application\n */\nexport function isCodeLoaderBundle(bundle: any): bundle is ICodeLoaderBundle {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn bundle?.fluidExport && typeof bundle.fluidExport === \"object\";\n}\n\nexport function isFluidFileConverter(obj: any): obj is IFluidFileConverter {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn (\n\t\tobj?.getCodeLoader &&\n\t\ttypeof obj.getCodeLoader === \"function\" &&\n\t\tobj.execute &&\n\t\ttypeof obj.execute === \"function\"\n\t);\n}\n"]}
1
+ {"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwCH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa;QAClB,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU;QACvC,GAAG,CAAC,OAAO;QACX,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CACjC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { ITelemetryBaseLogger, FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract that defines the necessary exports for the bundle provided at runtime\n * For an example, see \"src/test/sampleCodeLoaders/sampleCodeLoader.ts\"\n */\nexport interface ICodeLoaderBundle {\n\t/**\n\t * Fluid export of all the required objects and functions\n\t */\n\tfluidExport: Promise<IFluidFileConverter>;\n}\n\n/**\n * Instance that holds all the details for Fluid file conversion\n */\nexport interface IFluidFileConverter {\n\t/**\n\t * Get code loader details to provide at Loader creation\n\t * @param logger - created logger object to pass to code loader\n\t */\n\tgetCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;\n\n\t/**\n\t * Get scope object to provide at Loader creation\n\t * @param logger - created logger object to pass to scope object\n\t */\n\tgetScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;\n\n\t/**\n\t * Executes code on container and returns the result\n\t * @param container - container created by this application\n\t * @param options - additional options\n\t */\n\texecute(container: IContainer, options?: string): Promise<string>;\n}\n\n/**\n * Type cast to ensure necessary methods are present in the provided bundle\n * @param bundle - bundle provided to this application\n */\nexport function isCodeLoaderBundle(bundle: any): bundle is ICodeLoaderBundle {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn bundle?.fluidExport && typeof bundle.fluidExport === \"object\";\n}\n\nexport function isFluidFileConverter(obj: any): obj is IFluidFileConverter {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn (\n\t\tobj?.getCodeLoader &&\n\t\ttypeof obj.getCodeLoader === \"function\" &&\n\t\tobj.execute &&\n\t\ttypeof obj.execute === \"function\"\n\t);\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
6
  import { IFluidFileConverter } from "./codeLoaderBundle";
7
7
  import { ITelemetryOptions } from "./logger/fileLogger";
8
8
  export declare type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
@@ -18,11 +18,11 @@ interface IExportFileResponseFailure {
18
18
  /**
19
19
  * Execute code on Container based on ODSP snapshot and write result to file
20
20
  */
21
- export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number): Promise<IExportFileResponse>;
21
+ export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
22
22
  /**
23
23
  * Create the container based on an ODSP snapshot and execute code on it
24
24
  * @returns result of execution
25
25
  */
26
- export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLogger, options?: string, timeout?: number): Promise<string>;
26
+ export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLoggerExt, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
27
27
  export {};
28
28
  //# sourceMappingURL=exportFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAKtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,oBAAY,mBAAmB,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAE1F,UAAU,0BAA0B;IACnC,OAAO,EAAE,IAAI,CAAC;CACd;AAED,UAAU,0BAA0B;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ;AAID;;GAEG;AACH,wBAAsB,UAAU,CAC/B,kBAAkB,EAAE,mBAAmB,EACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,mBAAmB,CAAC,CAyC9B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC9C,iBAAiB,EAAE,MAAM,GAAG,UAAU,EACtC,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC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