@fluidframework/fluid-runner 2.0.0-dev.7.4.0.215930 → 2.0.0-dev.7.4.0.217212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codeLoaderBundle.d.ts +2 -0
- package/dist/codeLoaderBundle.d.ts.map +1 -1
- package/dist/codeLoaderBundle.js.map +1 -1
- package/dist/exportFile.d.ts +5 -0
- package/dist/exportFile.d.ts.map +1 -1
- package/dist/exportFile.js +2 -0
- package/dist/exportFile.js.map +1 -1
- package/dist/fluidRunner.d.ts +1 -0
- package/dist/fluidRunner.d.ts.map +1 -1
- package/dist/fluidRunner.js +1 -0
- package/dist/fluidRunner.js.map +1 -1
- package/dist/logger/fileLogger.d.ts +2 -0
- package/dist/logger/fileLogger.d.ts.map +1 -1
- package/dist/logger/fileLogger.js +1 -0
- package/dist/logger/fileLogger.js.map +1 -1
- package/dist/logger/loggerUtils.d.ts +3 -0
- package/dist/logger/loggerUtils.d.ts.map +1 -1
- package/dist/logger/loggerUtils.js +3 -0
- package/dist/logger/loggerUtils.js.map +1 -1
- package/dist/parseBundleAndExportFile.d.ts +1 -0
- package/dist/parseBundleAndExportFile.d.ts.map +1 -1
- package/dist/parseBundleAndExportFile.js +1 -0
- package/dist/parseBundleAndExportFile.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/dist/utils.js.map +1 -1
- package/package.json +10 -10
- package/src/codeLoaderBundle.ts +2 -0
- package/src/exportFile.ts +5 -0
- package/src/fluidRunner.ts +1 -0
- package/src/logger/fileLogger.ts +2 -0
- package/src/logger/loggerUtils.ts +3 -0
- package/src/parseBundleAndExportFile.ts +1 -0
- package/src/utils.ts +1 -0
|
@@ -7,6 +7,7 @@ import { ITelemetryBaseLogger, FluidObject } from "@fluidframework/core-interfac
|
|
|
7
7
|
/**
|
|
8
8
|
* Contract that defines the necessary exports for the bundle provided at runtime
|
|
9
9
|
* For an example, see "src/test/sampleCodeLoaders/sampleCodeLoader.ts"
|
|
10
|
+
* @internal
|
|
10
11
|
*/
|
|
11
12
|
export interface ICodeLoaderBundle {
|
|
12
13
|
/**
|
|
@@ -16,6 +17,7 @@ export interface ICodeLoaderBundle {
|
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Instance that holds all the details for Fluid file conversion
|
|
20
|
+
* @internal
|
|
19
21
|
*/
|
|
20
22
|
export interface IFluidFileConverter {
|
|
21
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAED;;;GAGG;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;;;
|
|
1
|
+
{"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0CH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,MAAM,EAAE,WAAW,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,GAAG,EAAE,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 * @internal\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 * @internal\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"]}
|
package/dist/exportFile.d.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { IFluidFileConverter } from "./codeLoaderBundle";
|
|
7
7
|
import { ITelemetryOptions } from "./logger/fileLogger";
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
|
|
9
12
|
interface IExportFileResponseSuccess {
|
|
10
13
|
success: true;
|
|
@@ -17,11 +20,13 @@ interface IExportFileResponseFailure {
|
|
|
17
20
|
}
|
|
18
21
|
/**
|
|
19
22
|
* Execute code on Container based on ODSP snapshot and write result to file
|
|
23
|
+
* @internal
|
|
20
24
|
*/
|
|
21
25
|
export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
|
|
22
26
|
/**
|
|
23
27
|
* Create the container based on an ODSP snapshot and execute code on it
|
|
24
28
|
* @returns result of execution
|
|
29
|
+
* @internal
|
|
25
30
|
*/
|
|
26
31
|
export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLoggerExt, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
|
|
27
32
|
export {};
|
package/dist/exportFile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC,CAAC;AAIxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,MAAM,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
|
|
1
|
+
{"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC,CAAC;AAIxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD;;GAEG;AACH,MAAM,MAAM,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;;;GAGG;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,EAChB,mBAAmB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA0C9B;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC9C,iBAAiB,EAAE,MAAM,GAAG,UAAU,EACtC,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,GAAE,OAAe,GAClC,OAAO,CAAC,MAAM,CAAC,CA0CjB"}
|
package/dist/exportFile.js
CHANGED
|
@@ -39,6 +39,7 @@ const loggerUtils_1 = require("./logger/loggerUtils");
|
|
|
39
39
|
const clientArgsValidationError = "Client_ArgsValidationError";
|
|
40
40
|
/**
|
|
41
41
|
* Execute code on Container based on ODSP snapshot and write result to file
|
|
42
|
+
* @internal
|
|
42
43
|
*/
|
|
43
44
|
async function exportFile(fluidFileConverter, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout, disableNetworkFetch) {
|
|
44
45
|
const telemetryArgError = (0, loggerUtils_1.getTelemetryFileValidationError)(telemetryFile);
|
|
@@ -72,6 +73,7 @@ exports.exportFile = exportFile;
|
|
|
72
73
|
/**
|
|
73
74
|
* Create the container based on an ODSP snapshot and execute code on it
|
|
74
75
|
* @returns result of execution
|
|
76
|
+
* @internal
|
|
75
77
|
*/
|
|
76
78
|
async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options, timeout, disableNetworkFetch = false) {
|
|
77
79
|
const fn = async () => {
|
package/dist/exportFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAmBrF,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;GAGG;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,UAA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E,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\n/**\n * @internal\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 * @internal\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 * @internal\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"]}
|
package/dist/fluidRunner.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { IFluidFileConverter } from "./codeLoaderBundle";
|
|
6
6
|
/**
|
|
7
7
|
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
8
|
+
* @internal
|
|
8
9
|
*/
|
|
9
10
|
export declare function fluidRunner(fluidFileConverter?: IFluidFileConverter): void;
|
|
10
11
|
//# sourceMappingURL=fluidRunner.d.ts.map
|
|
@@ -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
|
|
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;;;GAGG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,QAqHnE"}
|
package/dist/fluidRunner.js
CHANGED
|
@@ -36,6 +36,7 @@ const loggerUtils_1 = require("./logger/loggerUtils");
|
|
|
36
36
|
const utils_1 = require("./utils");
|
|
37
37
|
/**
|
|
38
38
|
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
39
|
+
* @internal
|
|
39
40
|
*/
|
|
40
41
|
function fluidRunner(fluidFileConverter) {
|
|
41
42
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
package/dist/fluidRunner.js.map
CHANGED
|
@@ -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
|
|
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;;;GAGG;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,EAAE,CACT,KAAK;SACH,MAAM,CAAC,YAAY,EAAE;QACrB,QAAQ,EACP,mIAAmI;QACpI,IAAI,EAAE,QAAQ;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,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 * @internal\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"]}
|
|
@@ -15,6 +15,7 @@ export interface IFileLogger extends ITelemetryBaseLogger {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Desired output format for the telemetry
|
|
18
|
+
* @internal
|
|
18
19
|
*/
|
|
19
20
|
export declare enum OutputFormat {
|
|
20
21
|
JSON = 0,
|
|
@@ -22,6 +23,7 @@ export declare enum OutputFormat {
|
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* Options to provide upon creation of IFileLogger
|
|
26
|
+
* @internal
|
|
25
27
|
*/
|
|
26
28
|
export interface ITelemetryOptions {
|
|
27
29
|
/** Desired output format used to create a specific IFileLogger implementation */
|
|
@@ -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,iCAAiC,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACxD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED
|
|
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;;;GAGG;AACH,oBAAY,YAAY;IACvB,IAAI,IAAA;IACJ,GAAG,IAAA;CACH;AAGD;;;GAGG;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
|
|
1
|
+
{"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;;GAGG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAoBD,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 * @internal\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 * @internal\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"]}
|
|
@@ -16,6 +16,7 @@ import { IFileLogger, ITelemetryOptions } from "./fileLogger";
|
|
|
16
16
|
* Note: if an output format is not supplied, default is JSON.
|
|
17
17
|
*
|
|
18
18
|
* @returns Both the `IFileLogger` implementation and `ITelemetryLoggerExt` wrapper to be called.
|
|
19
|
+
* @internal
|
|
19
20
|
*/
|
|
20
21
|
export declare function createLogger(filePath: string, options?: ITelemetryOptions): {
|
|
21
22
|
logger: ITelemetryLoggerExt;
|
|
@@ -24,12 +25,14 @@ export declare function createLogger(filePath: string, options?: ITelemetryOptio
|
|
|
24
25
|
/**
|
|
25
26
|
* Validate the telemetryFile command line argument
|
|
26
27
|
* @param telemetryFile - path where telemetry will be written
|
|
28
|
+
* @internal
|
|
27
29
|
*/
|
|
28
30
|
export declare function getTelemetryFileValidationError(telemetryFile: string): string | undefined;
|
|
29
31
|
/**
|
|
30
32
|
* Validate the provided output format and default properties
|
|
31
33
|
* @param format - desired output format of the telemetry
|
|
32
34
|
* @param props - default properties to be added to every telemetry entry
|
|
35
|
+
* @internal
|
|
33
36
|
*/
|
|
34
37
|
export declare function validateAndParseTelemetryOptions(format?: string, props?: (string | number)[], eventsPerFlush?: number): {
|
|
35
38
|
success: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iCAAiC,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAgB,MAAM,cAAc,CAAC;AAG5E
|
|
1
|
+
{"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iCAAiC,CAAC;AAEzF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAgB,MAAM,cAAc,CAAC;AAG5E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,GACzB;IAAE,MAAM,EAAE,mBAAmB,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAe1D;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQzF;AAED;;;;;GAKG;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"}
|
|
@@ -45,6 +45,7 @@ const jsonFileLogger_1 = require("./jsonFileLogger");
|
|
|
45
45
|
* Note: if an output format is not supplied, default is JSON.
|
|
46
46
|
*
|
|
47
47
|
* @returns Both the `IFileLogger` implementation and `ITelemetryLoggerExt` wrapper to be called.
|
|
48
|
+
* @internal
|
|
48
49
|
*/
|
|
49
50
|
function createLogger(filePath, options) {
|
|
50
51
|
const fileLogger = options?.outputFormat === fileLogger_1.OutputFormat.CSV
|
|
@@ -63,6 +64,7 @@ exports.createLogger = createLogger;
|
|
|
63
64
|
/**
|
|
64
65
|
* Validate the telemetryFile command line argument
|
|
65
66
|
* @param telemetryFile - path where telemetry will be written
|
|
67
|
+
* @internal
|
|
66
68
|
*/
|
|
67
69
|
function getTelemetryFileValidationError(telemetryFile) {
|
|
68
70
|
if (!telemetryFile) {
|
|
@@ -78,6 +80,7 @@ exports.getTelemetryFileValidationError = getTelemetryFileValidationError;
|
|
|
78
80
|
* Validate the provided output format and default properties
|
|
79
81
|
* @param format - desired output format of the telemetry
|
|
80
82
|
* @param props - default properties to be added to every telemetry entry
|
|
83
|
+
* @internal
|
|
81
84
|
*/
|
|
82
85
|
function validateAndParseTelemetryOptions(format, props, eventsPerFlush) {
|
|
83
86
|
let outputFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAyF;AACzF,mDAAgD;AAChD,6CAA4E;AAC5E,qDAAkD;AAElD
|
|
1
|
+
{"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAyF;AACzF,mDAAgD;AAChD,6CAA4E;AAC5E,qDAAkD;AAElD;;;;;;;;;;;;;GAaG;AACH,SAAgB,YAAY,CAC3B,QAAgB,EAChB,OAA2B;IAE3B,MAAM,UAAU,GACf,OAAO,EAAE,YAAY,KAAK,yBAAY,CAAC,GAAG;QACzC,CAAC,CAAC,IAAI,6BAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,CAAC;QAC7E,CAAC,CAAC,IAAI,+BAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IAEjF,MAAM,MAAM,GAAG,IAAA,mCAAiB,EAAC;QAChC,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE,wBAAwB;QACnC,UAAU,EAAE;YACX,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;SACrC;KACD,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAlBD,oCAkBC;AAED;;;;GAIG;AACH,SAAgB,+BAA+B,CAAC,aAAqB;IACpE,IAAI,CAAC,aAAa,EAAE;QACnB,OAAO,qCAAqC,CAAC;KAC7C;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,aAA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E,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, createChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { CSVFileLogger } from \"./csvFileLogger\";\nimport { IFileLogger, ITelemetryOptions, OutputFormat } from \"./fileLogger\";\nimport { JSONFileLogger } from \"./jsonFileLogger\";\n\n/**\n * Create an {@link @fluidframework/telemetry-utils#ITelemetryLoggerExt} wrapped around provided {@link IFileLogger}.\n *\n * @remarks\n *\n * It is expected that all events be sent through the returned \"logger\" value.\n *\n * The \"fileLogger\" value should have its \"close()\" method called at the end of execution.\n *\n * Note: if an output format is not supplied, default is JSON.\n *\n * @returns Both the `IFileLogger` implementation and `ITelemetryLoggerExt` wrapper to be called.\n * @internal\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 = createChildLogger({\n\t\tlogger: fileLogger,\n\t\tnamespace: \"LocalSnapshotRunnerApp\",\n\t\tproperties: {\n\t\t\tall: { Event_Time: () => Date.now() },\n\t\t},\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 * @internal\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 * @internal\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"]}
|
|
@@ -7,6 +7,7 @@ import { ITelemetryOptions } from "./logger/fileLogger";
|
|
|
7
7
|
/**
|
|
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
|
+
* @internal
|
|
10
11
|
*/
|
|
11
12
|
export declare function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
|
|
12
13
|
//# 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
|
|
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;;;;GAIG;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"}
|
|
@@ -39,6 +39,7 @@ const clientArgsValidationError = "Client_ArgsValidationError";
|
|
|
39
39
|
/**
|
|
40
40
|
* Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file
|
|
41
41
|
* @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)
|
|
42
|
+
* @internal
|
|
42
43
|
*/
|
|
43
44
|
async function parseBundleAndExportFile(codeLoader, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout, disableNetworkFetch) {
|
|
44
45
|
const telemetryArgError = (0, loggerUtils_1.getTelemetryFileValidationError)(telemetryFile);
|
|
@@ -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
|
|
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;;;;GAIG;AACI,KAAK,UAAU,wBAAwB,CAC7C,UAAkB,EAClB,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,MAAM,EAAE,GAAG,IAAA,0BAAY,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAE7E,IAAI;QACH,OAAO,MAAM,kCAAgB,CAAC,cAAc,CAC3C,MAAM,EACN,EAAE,SAAS,E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,MAAM,EACN,OAAO,EACP,OAAO,EACP,mBAAmB,CACnB,CACD,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC,CACD,CAAC;KACF;IAAC,OAAO,KAAK,EAAE;QACf,MAAM,SAAS,GAAG,wBAAwB,CAAC;QAC3C,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,EAAE,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;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 * @internal\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"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare function isJsonSnapshot(content: Buffer): boolean;
|
|
|
14
14
|
* Get the ODSP snapshot file content
|
|
15
15
|
* Works on both JSON and binary snapshot formats
|
|
16
16
|
* @param filePath - path to the ODSP snapshot file
|
|
17
|
+
* @internal
|
|
17
18
|
*/
|
|
18
19
|
export declare function getSnapshotFileContent(filePath: string): string | Buffer;
|
|
19
20
|
/**
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAIxE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,UAAU,CAAC,EAAE,MAAM,EACnB,kBAAkB,CAAC,EAAE,mBAAmB,GACtC,MAAM,GAAG,SAAS,CAQpB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAoBpB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,IAAI,EAC5C,QAAQ,EAAE,CACT,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,EAC5C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,IAAI,KAC1B,IAAI,EACT,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,CAAC,CAeZ"}
|
package/dist/utils.js
CHANGED
|
@@ -42,6 +42,7 @@ exports.isJsonSnapshot = isJsonSnapshot;
|
|
|
42
42
|
* Get the ODSP snapshot file content
|
|
43
43
|
* Works on both JSON and binary snapshot formats
|
|
44
44
|
* @param filePath - path to the ODSP snapshot file
|
|
45
|
+
* @internal
|
|
45
46
|
*/
|
|
46
47
|
function getSnapshotFileContent(filePath) {
|
|
47
48
|
// TODO: read file stream
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAGzB;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC7C,OAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC;AAClD,CAAC;AAFD,wCAEC;AAED
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;A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AC,CAAC,EAAE;QAC7D,OAAO,iBAAiB,CAAC;KACzB;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAxBD,wDAwBC;AAED;;GAEG;AACI,KAAK,UAAU,cAAc,CACnC,QAGS,EACT,OAAe;IAEf,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACzC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,OAAO,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QAEvF,QAAQ,CACP,CAAC,KAAK,EAAE,EAAE;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,CAAC;QAChB,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AArBD,wCAqBC","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 { IFluidFileConverter } from \"./codeLoaderBundle\";\n\n/**\n * Is the given snapshot in JSON format\n * @param content - snapshot file content\n * @internal\n */\nexport function isJsonSnapshot(content: Buffer): boolean {\n\treturn content.toString(undefined, 0, 1) === \"{\";\n}\n\n/**\n * Get the ODSP snapshot file content\n * Works on both JSON and binary snapshot formats\n * @param filePath - path to the ODSP snapshot file\n * @internal\n */\nexport function getSnapshotFileContent(filePath: string): string | Buffer {\n\t// TODO: read file stream\n\tconst content = fs.readFileSync(filePath);\n\treturn isJsonSnapshot(content) ? content.toString() : content;\n}\n\n/**\n * Validate provided command line arguments\n * @internal\n */\nexport function validateCommandLineArgs(\n\tcodeLoader?: string,\n\tfluidFileConverter?: IFluidFileConverter,\n): string | undefined {\n\tif (codeLoader && fluidFileConverter !== undefined) {\n\t\treturn '\"codeLoader\" and \"fluidFileConverter\" cannot both be provided. See README for details.';\n\t}\n\tif (!codeLoader && fluidFileConverter === undefined) {\n\t\treturn '\"codeLoader\" must be provided if there is no explicit \"fluidFileConverter\". See README for details.';\n\t}\n\treturn undefined;\n}\n\n/**\n * @internal\n */\nexport function getArgsValidationError(\n\tinputFile: string,\n\toutputFile: string,\n\ttimeout?: number,\n): string | undefined {\n\t// Validate input file\n\tif (!inputFile) {\n\t\treturn \"Input file name argument is missing.\";\n\t} else if (!fs.existsSync(inputFile)) {\n\t\treturn \"Input file does not exist.\";\n\t}\n\n\t// Validate output file\n\tif (!outputFile) {\n\t\treturn \"Output file argument is missing.\";\n\t} else if (fs.existsSync(outputFile)) {\n\t\treturn `Output file already exists [${outputFile}].`;\n\t}\n\n\tif (timeout !== undefined && (isNaN(timeout) || timeout < 0)) {\n\t\treturn \"Invalid timeout\";\n\t}\n\n\treturn undefined;\n}\n\n/**\n * @internal\n */\nexport async function timeoutPromise<T = void>(\n\texecutor: (\n\t\tresolve: (value: T | PromiseLike<T>) => void,\n\t\treject: (reason?: any) => void,\n\t) => void,\n\ttimeout: number,\n): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst timer = setTimeout(() => reject(new Error(`Timed out (${timeout}ms)`)), timeout);\n\n\t\texecutor(\n\t\t\t(value) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(reason) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\treject(reason);\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-runner",
|
|
3
|
-
"version": "2.0.0-dev.7.4.0.
|
|
3
|
+
"version": "2.0.0-dev.7.4.0.217212",
|
|
4
4
|
"description": "Utility for running various functionality inside a Fluid Framework environment",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"temp-directory": "nyc/.nyc_output"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fluidframework/aqueduct": "2.0.0-dev.7.4.0.
|
|
40
|
-
"@fluidframework/container-definitions": "2.0.0-dev.7.4.0.
|
|
41
|
-
"@fluidframework/container-loader": "2.0.0-dev.7.4.0.
|
|
42
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.
|
|
43
|
-
"@fluidframework/driver-definitions": "2.0.0-dev.7.4.0.
|
|
44
|
-
"@fluidframework/odsp-driver": "2.0.0-dev.7.4.0.
|
|
45
|
-
"@fluidframework/odsp-driver-definitions": "2.0.0-dev.7.4.0.
|
|
46
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.7.4.0.
|
|
39
|
+
"@fluidframework/aqueduct": "2.0.0-dev.7.4.0.217212",
|
|
40
|
+
"@fluidframework/container-definitions": "2.0.0-dev.7.4.0.217212",
|
|
41
|
+
"@fluidframework/container-loader": "2.0.0-dev.7.4.0.217212",
|
|
42
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.217212",
|
|
43
|
+
"@fluidframework/driver-definitions": "2.0.0-dev.7.4.0.217212",
|
|
44
|
+
"@fluidframework/odsp-driver": "2.0.0-dev.7.4.0.217212",
|
|
45
|
+
"@fluidframework/odsp-driver-definitions": "2.0.0-dev.7.4.0.217212",
|
|
46
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev.7.4.0.217212",
|
|
47
47
|
"json2csv": "^5.0.7",
|
|
48
48
|
"yargs": "13.2.2"
|
|
49
49
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@fluidframework/build-tools": "^0.28.0",
|
|
54
54
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
55
55
|
"@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.0.0-internal.7.2.0",
|
|
56
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.
|
|
56
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.217212",
|
|
57
57
|
"@types/mocha": "^9.1.1",
|
|
58
58
|
"@types/node": "^16.18.38",
|
|
59
59
|
"@types/yargs": "^13",
|
package/src/codeLoaderBundle.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { ITelemetryBaseLogger, FluidObject } from "@fluidframework/core-interfac
|
|
|
9
9
|
/**
|
|
10
10
|
* Contract that defines the necessary exports for the bundle provided at runtime
|
|
11
11
|
* For an example, see "src/test/sampleCodeLoaders/sampleCodeLoader.ts"
|
|
12
|
+
* @internal
|
|
12
13
|
*/
|
|
13
14
|
export interface ICodeLoaderBundle {
|
|
14
15
|
/**
|
|
@@ -19,6 +20,7 @@ export interface ICodeLoaderBundle {
|
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Instance that holds all the details for Fluid file conversion
|
|
23
|
+
* @internal
|
|
22
24
|
*/
|
|
23
25
|
export interface IFluidFileConverter {
|
|
24
26
|
/**
|
package/src/exportFile.ts
CHANGED
|
@@ -16,6 +16,9 @@ import { ITelemetryOptions } from "./logger/fileLogger";
|
|
|
16
16
|
import { createLogger, getTelemetryFileValidationError } from "./logger/loggerUtils";
|
|
17
17
|
/* eslint-enable import/no-internal-modules */
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
19
22
|
export type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
|
|
20
23
|
|
|
21
24
|
interface IExportFileResponseSuccess {
|
|
@@ -33,6 +36,7 @@ const clientArgsValidationError = "Client_ArgsValidationError";
|
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
38
|
* Execute code on Container based on ODSP snapshot and write result to file
|
|
39
|
+
* @internal
|
|
36
40
|
*/
|
|
37
41
|
export async function exportFile(
|
|
38
42
|
fluidFileConverter: IFluidFileConverter,
|
|
@@ -90,6 +94,7 @@ export async function exportFile(
|
|
|
90
94
|
/**
|
|
91
95
|
* Create the container based on an ODSP snapshot and execute code on it
|
|
92
96
|
* @returns result of execution
|
|
97
|
+
* @internal
|
|
93
98
|
*/
|
|
94
99
|
export async function createContainerAndExecute(
|
|
95
100
|
localOdspSnapshot: string | Uint8Array,
|
package/src/fluidRunner.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { validateCommandLineArgs } from "./utils";
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
16
|
+
* @internal
|
|
16
17
|
*/
|
|
17
18
|
export function fluidRunner(fluidFileConverter?: IFluidFileConverter) {
|
|
18
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
package/src/logger/fileLogger.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface IFileLogger extends ITelemetryBaseLogger {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Desired output format for the telemetry
|
|
21
|
+
* @internal
|
|
21
22
|
*/
|
|
22
23
|
export enum OutputFormat {
|
|
23
24
|
JSON,
|
|
@@ -27,6 +28,7 @@ export enum OutputFormat {
|
|
|
27
28
|
/* eslint-disable tsdoc/syntax */
|
|
28
29
|
/**
|
|
29
30
|
* Options to provide upon creation of IFileLogger
|
|
31
|
+
* @internal
|
|
30
32
|
*/
|
|
31
33
|
export interface ITelemetryOptions {
|
|
32
34
|
/** Desired output format used to create a specific IFileLogger implementation */
|
|
@@ -21,6 +21,7 @@ import { JSONFileLogger } from "./jsonFileLogger";
|
|
|
21
21
|
* Note: if an output format is not supplied, default is JSON.
|
|
22
22
|
*
|
|
23
23
|
* @returns Both the `IFileLogger` implementation and `ITelemetryLoggerExt` wrapper to be called.
|
|
24
|
+
* @internal
|
|
24
25
|
*/
|
|
25
26
|
export function createLogger(
|
|
26
27
|
filePath: string,
|
|
@@ -45,6 +46,7 @@ export function createLogger(
|
|
|
45
46
|
/**
|
|
46
47
|
* Validate the telemetryFile command line argument
|
|
47
48
|
* @param telemetryFile - path where telemetry will be written
|
|
49
|
+
* @internal
|
|
48
50
|
*/
|
|
49
51
|
export function getTelemetryFileValidationError(telemetryFile: string): string | undefined {
|
|
50
52
|
if (!telemetryFile) {
|
|
@@ -60,6 +62,7 @@ export function getTelemetryFileValidationError(telemetryFile: string): string |
|
|
|
60
62
|
* Validate the provided output format and default properties
|
|
61
63
|
* @param format - desired output format of the telemetry
|
|
62
64
|
* @param props - default properties to be added to every telemetry entry
|
|
65
|
+
* @internal
|
|
63
66
|
*/
|
|
64
67
|
export function validateAndParseTelemetryOptions(
|
|
65
68
|
format?: string,
|
|
@@ -18,6 +18,7 @@ const clientArgsValidationError = "Client_ArgsValidationError";
|
|
|
18
18
|
/**
|
|
19
19
|
* Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file
|
|
20
20
|
* @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)
|
|
21
|
+
* @internal
|
|
21
22
|
*/
|
|
22
23
|
export async function parseBundleAndExportFile(
|
|
23
24
|
codeLoader: string,
|
package/src/utils.ts
CHANGED
|
@@ -19,6 +19,7 @@ export function isJsonSnapshot(content: Buffer): boolean {
|
|
|
19
19
|
* Get the ODSP snapshot file content
|
|
20
20
|
* Works on both JSON and binary snapshot formats
|
|
21
21
|
* @param filePath - path to the ODSP snapshot file
|
|
22
|
+
* @internal
|
|
22
23
|
*/
|
|
23
24
|
export function getSnapshotFileContent(filePath: string): string | Buffer {
|
|
24
25
|
// TODO: read file stream
|