@fluidframework/fluid-runner 2.103.0 → 2.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/api-report/fluid-runner.legacy.beta.api.md +21 -0
- package/dist/exportFile.d.ts +31 -3
- package/dist/exportFile.d.ts.map +1 -1
- package/dist/exportFile.js +36 -4
- package/dist/exportFile.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +5 -1
- package/dist/logger/fileLogger.d.ts +11 -3
- package/dist/logger/fileLogger.d.ts.map +1 -1
- package/dist/logger/fileLogger.js.map +1 -1
- package/dist/logger/loggerUtils.d.ts +31 -3
- package/dist/logger/loggerUtils.d.ts.map +1 -1
- package/dist/logger/loggerUtils.js +28 -1
- package/dist/logger/loggerUtils.js.map +1 -1
- package/dist/parseBundleAndExportFile.d.ts +2 -2
- package/dist/parseBundleAndExportFile.d.ts.map +1 -1
- package/dist/parseBundleAndExportFile.js +4 -2
- package/dist/parseBundleAndExportFile.js.map +1 -1
- package/lib/exportFile.d.ts +31 -3
- package/lib/exportFile.d.ts.map +1 -1
- package/lib/exportFile.js +36 -5
- package/lib/exportFile.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +5 -1
- package/lib/logger/fileLogger.d.ts +11 -3
- package/lib/logger/fileLogger.d.ts.map +1 -1
- package/lib/logger/fileLogger.js.map +1 -1
- package/lib/logger/loggerUtils.d.ts +31 -3
- package/lib/logger/loggerUtils.d.ts.map +1 -1
- package/lib/logger/loggerUtils.js +27 -1
- package/lib/logger/loggerUtils.js.map +1 -1
- package/lib/parseBundleAndExportFile.d.ts +2 -2
- package/lib/parseBundleAndExportFile.d.ts.map +1 -1
- package/lib/parseBundleAndExportFile.js +7 -5
- package/lib/parseBundleAndExportFile.js.map +1 -1
- package/package.json +12 -12
- package/src/exportFile.ts +61 -7
- package/src/index.ts +4 -1
- package/src/logger/fileLogger.ts +12 -3
- package/src/logger/loggerUtils.ts +40 -3
- package/src/parseBundleAndExportFile.ts +18 -8
package/lib/exportFile.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
5
6
|
import { type TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
6
7
|
import type { IFluidFileConverter } from "./codeLoaderBundle.js";
|
|
7
|
-
import type {
|
|
8
|
+
import type { IFileLoggerTelemetryOptions } from "./logger/fileLogger.js";
|
|
8
9
|
/**
|
|
9
10
|
* @legacy @beta
|
|
10
11
|
*/
|
|
@@ -25,13 +26,40 @@ export interface IExportFileResponseFailure {
|
|
|
25
26
|
error?: any;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* Execute code on
|
|
29
|
+
* Execute code on a Fluid {@link @fluidframework/container-definitions#IContainer} loaded from an ODSP snapshot
|
|
30
|
+
* file and write the resulting string to disk.
|
|
29
31
|
* @internal
|
|
30
32
|
*/
|
|
31
|
-
export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?:
|
|
33
|
+
export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: IFileLoggerTelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Create a Fluid {@link @fluidframework/container-definitions#IContainer} from an ODSP snapshot and run
|
|
36
|
+
* caller-provided code against it.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* The container is loaded with `opsBeforeReturn: "cached"` and {@link @fluidframework/container-loader#waitContainerToCatchUp}
|
|
40
|
+
* is invoked before {@link IFluidFileConverter.execute} runs. The container is disposed once `execute` resolves
|
|
41
|
+
* (or rejects).
|
|
42
|
+
*
|
|
43
|
+
* @param localOdspSnapshot - The ODSP snapshot to load the container from. May be either the JSON snapshot
|
|
44
|
+
* as a string or the binary snapshot as a `Uint8Array`.
|
|
45
|
+
* @param fluidFileConverter - Caller-provided code loader and execution logic. See {@link IFluidFileConverter}.
|
|
46
|
+
* @param baseLogger - Telemetry logger that will receive events emitted during load and execution. Typically
|
|
47
|
+
* obtained from {@link createFluidRunnerLogger}.
|
|
48
|
+
* @param options - Opaque, caller-defined string passed through to {@link IFluidFileConverter.execute}.
|
|
49
|
+
* @param timeout - Optional timeout in milliseconds. If the operation does not complete within this period
|
|
50
|
+
* the returned promise rejects. When omitted, no timeout is applied.
|
|
51
|
+
* @param disableNetworkFetch - When `true`, replaces `global.fetch` with an implementation that throws,
|
|
52
|
+
* ensuring the container load is fully serviced from the provided snapshot. Defaults to `false`.
|
|
53
|
+
* @returns The string result returned by {@link IFluidFileConverter.execute}.
|
|
54
|
+
*
|
|
55
|
+
* @legacy
|
|
56
|
+
* @beta
|
|
57
|
+
*/
|
|
58
|
+
export declare function createFluidRunnerContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, baseLogger: ITelemetryBaseLogger, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
|
|
32
59
|
/**
|
|
33
60
|
* Create the container based on an ODSP snapshot and execute code on it
|
|
34
61
|
* @returns result of execution
|
|
62
|
+
* @deprecated Use {@link createFluidRunnerContainerAndExecute}.
|
|
35
63
|
* @internal
|
|
36
64
|
*/
|
|
37
65
|
export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: TelemetryLoggerExt, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
|
package/lib/exportFile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,OAAO,EACN,KAAK,kBAAkB,EAGvB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAQ1E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,IAAI,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ;AAID;;;;GAIG;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,2BAA2B,EAC9C,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA8C9B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,oCAAoC,CACzD,iBAAiB,EAAE,MAAM,GAAG,UAAU,EACtC,kBAAkB,EAAE,mBAAmB,EACvC,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,MAAM,CAAC,CAUjB;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC9C,iBAAiB,EAAE,MAAM,GAAG,UAAU,EACtC,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,GAAE,OAAe,GAClC,OAAO,CAAC,MAAM,CAAC,CA8CjB"}
|
package/lib/exportFile.js
CHANGED
|
@@ -6,13 +6,14 @@ import * as fs from "fs";
|
|
|
6
6
|
import { LoaderHeader } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { loadExistingContainer, waitContainerToCatchUp, } from "@fluidframework/container-loader/internal";
|
|
8
8
|
import { createLocalOdspDocumentServiceFactory } from "@fluidframework/odsp-driver/internal";
|
|
9
|
-
import { PerformanceEvent, } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
+
import { PerformanceEvent, createChildLogger, } from "@fluidframework/telemetry-utils/internal";
|
|
10
10
|
import { FakeUrlResolver } from "./fakeUrlResolver.js";
|
|
11
|
-
import {
|
|
11
|
+
import { createFluidRunnerLogger, getTelemetryFileValidationError, } from "./logger/loggerUtils.js";
|
|
12
12
|
import { getArgsValidationError, getSnapshotFileContent, timeoutPromise } from "./utils.js";
|
|
13
13
|
const clientArgsValidationError = "Client_ArgsValidationError";
|
|
14
14
|
/**
|
|
15
|
-
* Execute code on
|
|
15
|
+
* Execute code on a Fluid {@link @fluidframework/container-definitions#IContainer} loaded from an ODSP snapshot
|
|
16
|
+
* file and write the resulting string to disk.
|
|
16
17
|
* @internal
|
|
17
18
|
*/
|
|
18
19
|
export async function exportFile(fluidFileConverter, inputFile, outputFile, telemetryFile, options, telemetryOptions, timeout, disableNetworkFetch) {
|
|
@@ -21,7 +22,8 @@ export async function exportFile(fluidFileConverter, inputFile, outputFile, tele
|
|
|
21
22
|
const eventName = clientArgsValidationError;
|
|
22
23
|
return { success: false, eventName, errorMessage: telemetryArgError };
|
|
23
24
|
}
|
|
24
|
-
const { fileLogger, logger } =
|
|
25
|
+
const { fileLogger, logger: baseLogger } = createFluidRunnerLogger(telemetryFile, telemetryOptions);
|
|
26
|
+
const logger = createChildLogger({ logger: baseLogger });
|
|
25
27
|
try {
|
|
26
28
|
return await PerformanceEvent.timedExecAsync(logger, { eventName: "ExportFile" }, async () => {
|
|
27
29
|
const argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);
|
|
@@ -30,7 +32,7 @@ export async function exportFile(fluidFileConverter, inputFile, outputFile, tele
|
|
|
30
32
|
logger.sendErrorEvent({ eventName, message: argsValidationError });
|
|
31
33
|
return { success: false, eventName, errorMessage: argsValidationError };
|
|
32
34
|
}
|
|
33
|
-
fs.writeFileSync(outputFile, await
|
|
35
|
+
fs.writeFileSync(outputFile, await createFluidRunnerContainerAndExecute(getSnapshotFileContent(inputFile), fluidFileConverter, baseLogger, options, timeout, disableNetworkFetch));
|
|
34
36
|
return { success: true };
|
|
35
37
|
});
|
|
36
38
|
}
|
|
@@ -43,9 +45,38 @@ export async function exportFile(fluidFileConverter, inputFile, outputFile, tele
|
|
|
43
45
|
await fileLogger.close();
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a Fluid {@link @fluidframework/container-definitions#IContainer} from an ODSP snapshot and run
|
|
50
|
+
* caller-provided code against it.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* The container is loaded with `opsBeforeReturn: "cached"` and {@link @fluidframework/container-loader#waitContainerToCatchUp}
|
|
54
|
+
* is invoked before {@link IFluidFileConverter.execute} runs. The container is disposed once `execute` resolves
|
|
55
|
+
* (or rejects).
|
|
56
|
+
*
|
|
57
|
+
* @param localOdspSnapshot - The ODSP snapshot to load the container from. May be either the JSON snapshot
|
|
58
|
+
* as a string or the binary snapshot as a `Uint8Array`.
|
|
59
|
+
* @param fluidFileConverter - Caller-provided code loader and execution logic. See {@link IFluidFileConverter}.
|
|
60
|
+
* @param baseLogger - Telemetry logger that will receive events emitted during load and execution. Typically
|
|
61
|
+
* obtained from {@link createFluidRunnerLogger}.
|
|
62
|
+
* @param options - Opaque, caller-defined string passed through to {@link IFluidFileConverter.execute}.
|
|
63
|
+
* @param timeout - Optional timeout in milliseconds. If the operation does not complete within this period
|
|
64
|
+
* the returned promise rejects. When omitted, no timeout is applied.
|
|
65
|
+
* @param disableNetworkFetch - When `true`, replaces `global.fetch` with an implementation that throws,
|
|
66
|
+
* ensuring the container load is fully serviced from the provided snapshot. Defaults to `false`.
|
|
67
|
+
* @returns The string result returned by {@link IFluidFileConverter.execute}.
|
|
68
|
+
*
|
|
69
|
+
* @legacy
|
|
70
|
+
* @beta
|
|
71
|
+
*/
|
|
72
|
+
export async function createFluidRunnerContainerAndExecute(localOdspSnapshot, fluidFileConverter, baseLogger, options, timeout, disableNetworkFetch) {
|
|
73
|
+
const logger = createChildLogger({ logger: baseLogger });
|
|
74
|
+
return createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options, timeout, disableNetworkFetch);
|
|
75
|
+
}
|
|
46
76
|
/**
|
|
47
77
|
* Create the container based on an ODSP snapshot and execute code on it
|
|
48
78
|
* @returns result of execution
|
|
79
|
+
* @deprecated Use {@link createFluidRunnerContainerAndExecute}.
|
|
49
80
|
* @internal
|
|
50
81
|
*/
|
|
51
82
|
export async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options, timeout, disableNetworkFetch = false) {
|
package/lib/exportFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CA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;YAChF,UAAU,EAAE,MAAM,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC;YAC1D,KAAK,EAAE,MAAM,kBAAkB,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClD,MAAM;SACN,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,qBAAqB,CAAC;YAC7C,GAAG,WAAW;YACd,OAAO,EAAE;gBACR,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE;oBACR,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE;iBACtD;aACD;SACD,CAAC,CAAC;QACH,MAAM,sBAAsB,CAAC,SAAS,CAAC,CAAC;QAExC,OAAO,gBAAgB,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,KAAK,IAAI,EAAE;YACtF,IAAI,CAAC;gBACJ,OAAO,MAAM,kBAAkB,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAC7D,CAAC;oBAAS,CAAC;gBACV,SAAS,CAAC,OAAO,EAAE,CAAC;YACrB,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,kDAAkD;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,EAAE,EAAE;iBACF,IAAI,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;IACb,CAAC;SAAM,CAAC;QACP,OAAO,EAAE,EAAE,CAAC;IACb,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\n\nimport { LoaderHeader } from \"@fluidframework/container-definitions/internal\";\nimport {\n\tloadExistingContainer,\n\twaitContainerToCatchUp,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver/internal\";\nimport {\n\ttype TelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver.js\";\n/* eslint-disable import-x/no-internal-modules */\nimport type { ITelemetryOptions } from \"./logger/fileLogger.js\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils.js\";\nimport { getArgsValidationError, getSnapshotFileContent, timeoutPromise } from \"./utils.js\";\n/* eslint-enable import-x/no-internal-modules */\n\n/**\n * @legacy @beta\n */\nexport type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;\n\n/**\n * @legacy @beta\n */\nexport interface IExportFileResponseSuccess {\n\tsuccess: true;\n}\n\n/**\n * @legacy @beta\n */\nexport interface 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: TelemetryLoggerExt,\n\toptions?: string,\n\ttimeout?: number,\n\tdisableNetworkFetch: boolean = false,\n): Promise<string> {\n\tconst fn = async (): Promise<string> => {\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 loaderProps: ILoaderProps = {\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 loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: {\n\t\t\t\turl: \"/fakeUrl/\",\n\t\t\t\theaders: {\n\t\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tawait waitContainerToCatchUp(container);\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
|
+
{"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EACN,qBAAqB,EACrB,sBAAsB,GAEtB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAEN,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EACN,uBAAuB,EACvB,+BAA+B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,c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right (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\n\nimport { LoaderHeader } from \"@fluidframework/container-definitions/internal\";\nimport {\n\tloadExistingContainer,\n\twaitContainerToCatchUp,\n\ttype ILoaderProps,\n} from \"@fluidframework/container-loader/internal\";\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver/internal\";\nimport {\n\ttype TelemetryLoggerExt,\n\tPerformanceEvent,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver.js\";\n/* eslint-disable import-x/no-internal-modules */\nimport type { IFileLoggerTelemetryOptions } from \"./logger/fileLogger.js\";\nimport {\n\tcreateFluidRunnerLogger,\n\tgetTelemetryFileValidationError,\n} from \"./logger/loggerUtils.js\";\nimport { getArgsValidationError, getSnapshotFileContent, timeoutPromise } from \"./utils.js\";\n/* eslint-enable import-x/no-internal-modules */\n\n/**\n * @legacy @beta\n */\nexport type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;\n\n/**\n * @legacy @beta\n */\nexport interface IExportFileResponseSuccess {\n\tsuccess: true;\n}\n\n/**\n * @legacy @beta\n */\nexport interface 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 a Fluid {@link @fluidframework/container-definitions#IContainer} loaded from an ODSP snapshot\n * file and write the resulting string to disk.\n * @internal\n */\nexport async function exportFile(\n\tfluidFileConverter: IFluidFileConverter,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: IFileLoggerTelemetryOptions,\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: baseLogger } = createFluidRunnerLogger(\n\t\ttelemetryFile,\n\t\ttelemetryOptions,\n\t);\n\tconst logger = createChildLogger({ logger: baseLogger });\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 createFluidRunnerContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidFileConverter,\n\t\t\t\t\t\tbaseLogger,\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 a Fluid {@link @fluidframework/container-definitions#IContainer} from an ODSP snapshot and run\n * caller-provided code against it.\n *\n * @remarks\n * The container is loaded with `opsBeforeReturn: \"cached\"` and {@link @fluidframework/container-loader#waitContainerToCatchUp}\n * is invoked before {@link IFluidFileConverter.execute} runs. The container is disposed once `execute` resolves\n * (or rejects).\n *\n * @param localOdspSnapshot - The ODSP snapshot to load the container from. May be either the JSON snapshot\n * as a string or the binary snapshot as a `Uint8Array`.\n * @param fluidFileConverter - Caller-provided code loader and execution logic. See {@link IFluidFileConverter}.\n * @param baseLogger - Telemetry logger that will receive events emitted during load and execution. Typically\n * obtained from {@link createFluidRunnerLogger}.\n * @param options - Opaque, caller-defined string passed through to {@link IFluidFileConverter.execute}.\n * @param timeout - Optional timeout in milliseconds. If the operation does not complete within this period\n * the returned promise rejects. When omitted, no timeout is applied.\n * @param disableNetworkFetch - When `true`, replaces `global.fetch` with an implementation that throws,\n * ensuring the container load is fully serviced from the provided snapshot. Defaults to `false`.\n * @returns The string result returned by {@link IFluidFileConverter.execute}.\n *\n * @legacy\n * @beta\n */\nexport async function createFluidRunnerContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tbaseLogger: ITelemetryBaseLogger,\n\toptions?: string,\n\ttimeout?: number,\n\tdisableNetworkFetch?: boolean,\n): Promise<string> {\n\tconst logger = createChildLogger({ logger: baseLogger });\n\treturn createContainerAndExecute(\n\t\tlocalOdspSnapshot,\n\t\tfluidFileConverter,\n\t\tlogger,\n\t\toptions,\n\t\ttimeout,\n\t\tdisableNetworkFetch,\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 * @deprecated Use {@link createFluidRunnerContainerAndExecute}.\n * @internal\n */\nexport async function createContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tlogger: TelemetryLoggerExt,\n\toptions?: string,\n\ttimeout?: number,\n\tdisableNetworkFetch: boolean = false,\n): Promise<string> {\n\tconst fn = async (): Promise<string> => {\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 loaderProps: ILoaderProps = {\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 loadExistingContainer({\n\t\t\t...loaderProps,\n\t\t\trequest: {\n\t\t\t\turl: \"/fakeUrl/\",\n\t\t\t\theaders: {\n\t\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tawait waitContainerToCatchUp(container);\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/lib/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export type { ICodeLoaderBundle, IFluidFileConverter } from "./codeLoaderBundle.js";
|
|
6
|
-
export { createContainerAndExecute, exportFile, type IExportFileResponse, type IExportFileResponseSuccess, type IExportFileResponseFailure, } from "./exportFile.js";
|
|
6
|
+
export { createContainerAndExecute, createFluidRunnerContainerAndExecute, exportFile, type IExportFileResponse, type IExportFileResponseSuccess, type IExportFileResponseFailure, } from "./exportFile.js";
|
|
7
7
|
export { fluidRunner } from "./fluidRunner.js";
|
|
8
|
-
export { OutputFormat, type
|
|
9
|
-
export { createLogger, getTelemetryFileValidationError, validateAndParseTelemetryOptions, } from "./logger/loggerUtils.js";
|
|
8
|
+
export { OutputFormat, type IFileLoggerTelemetryOptions, type IFileLogger, type ITelemetryOptions, } from "./logger/fileLogger.js";
|
|
9
|
+
export { createFluidRunnerLogger, createLogger, getTelemetryFileValidationError, validateAndParseTelemetryOptions, } from "./logger/loggerUtils.js";
|
|
10
10
|
export { parseBundleAndExportFile } from "./parseBundleAndExportFile.js";
|
|
11
11
|
export { getSnapshotFileContent } from "./utils.js";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACN,yBAAyB,EACzB,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAC/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACN,YAAY,EACZ,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACN,yBAAyB,EACzB,oCAAoC,EACpC,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAC/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACN,YAAY,EACZ,KAAK,2BAA2B,EAChC,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,+BAA+B,EAC/B,gCAAgC,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { createContainerAndExecute, exportFile, } from "./exportFile.js";
|
|
5
|
+
export { createContainerAndExecute, createFluidRunnerContainerAndExecute, exportFile, } from "./exportFile.js";
|
|
6
6
|
export { fluidRunner } from "./fluidRunner.js";
|
|
7
7
|
export { OutputFormat, } from "./logger/fileLogger.js";
|
|
8
|
-
export { createLogger, getTelemetryFileValidationError, validateAndParseTelemetryOptions, } from "./logger/loggerUtils.js";
|
|
8
|
+
export { createFluidRunnerLogger, createLogger, getTelemetryFileValidationError, validateAndParseTelemetryOptions, } from "./logger/loggerUtils.js";
|
|
9
9
|
export { parseBundleAndExportFile } from "./parseBundleAndExportFile.js";
|
|
10
10
|
export { getSnapshotFileContent } from "./utils.js";
|
|
11
11
|
/* eslint-enable import-x/no-internal-modules */
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,yBAAyB,EACzB,UAAU,GAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACN,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,yBAAyB,EACzB,oCAAoC,EACpC,UAAU,GAIV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACN,YAAY,GAIZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,+BAA+B,EAC/B,gCAAgC,GAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,gDAAgD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import-x/no-internal-modules */\nexport type { ICodeLoaderBundle, IFluidFileConverter } from \"./codeLoaderBundle.js\";\nexport {\n\tcreateContainerAndExecute,\n\tcreateFluidRunnerContainerAndExecute,\n\texportFile,\n\ttype IExportFileResponse,\n\ttype IExportFileResponseSuccess,\n\ttype IExportFileResponseFailure,\n} from \"./exportFile.js\";\nexport { fluidRunner } from \"./fluidRunner.js\";\nexport {\n\tOutputFormat,\n\ttype IFileLoggerTelemetryOptions,\n\ttype IFileLogger,\n\ttype ITelemetryOptions,\n} from \"./logger/fileLogger.js\";\nexport {\n\tcreateFluidRunnerLogger,\n\tcreateLogger,\n\tgetTelemetryFileValidationError,\n\tvalidateAndParseTelemetryOptions,\n} from \"./logger/loggerUtils.js\";\nexport { parseBundleAndExportFile } from \"./parseBundleAndExportFile.js\";\nexport { getSnapshotFileContent } from \"./utils.js\";\n/* eslint-enable import-x/no-internal-modules */\n"]}
|
package/lib/legacy.d.ts
CHANGED
|
@@ -13,7 +13,11 @@ export {
|
|
|
13
13
|
IExportFileResponse,
|
|
14
14
|
IExportFileResponseFailure,
|
|
15
15
|
IExportFileResponseSuccess,
|
|
16
|
+
IFileLogger,
|
|
17
|
+
IFileLoggerTelemetryOptions,
|
|
16
18
|
IFluidFileConverter,
|
|
17
|
-
OutputFormat
|
|
19
|
+
OutputFormat,
|
|
20
|
+
createFluidRunnerContainerAndExecute,
|
|
21
|
+
createFluidRunnerLogger
|
|
18
22
|
// #endregion
|
|
19
23
|
} from "./index.js";
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
6
6
|
/**
|
|
7
7
|
* Contract for logger that writes telemetry to a file
|
|
8
|
-
* @
|
|
8
|
+
* @legacy
|
|
9
|
+
* @beta
|
|
9
10
|
*/
|
|
10
11
|
export interface IFileLogger extends ITelemetryBaseLogger {
|
|
11
12
|
/**
|
|
@@ -23,9 +24,10 @@ export declare enum OutputFormat {
|
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Options to provide upon creation of IFileLogger
|
|
26
|
-
* @
|
|
27
|
+
* @legacy
|
|
28
|
+
* @beta
|
|
27
29
|
*/
|
|
28
|
-
export interface
|
|
30
|
+
export interface IFileLoggerTelemetryOptions {
|
|
29
31
|
/** Desired output format used to create a specific IFileLogger implementation */
|
|
30
32
|
outputFormat?: OutputFormat;
|
|
31
33
|
/**
|
|
@@ -41,4 +43,10 @@ export interface ITelemetryOptions {
|
|
|
41
43
|
/** Number of telemetry events per flush to telemetry file */
|
|
42
44
|
eventsPerFlush?: number;
|
|
43
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Options to provide upon creation of IFileLogger
|
|
48
|
+
* @deprecated Use {@link IFileLoggerTelemetryOptions}.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export type ITelemetryOptions = IFileLoggerTelemetryOptions;
|
|
44
52
|
//# sourceMappingURL=fileLogger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;GAIG;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;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C,iFAAiF;IACjF,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAE/C,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;;GAGG;AACH,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract for logger that writes telemetry to a file\n * @legacy\n * @beta\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 * @legacy @beta\n */\nexport enum OutputFormat {\n\tJSON,\n\tCSV,\n}\n\n/**\n * Options to provide upon creation of IFileLogger\n * @legacy\n * @beta\n */\nexport interface IFileLoggerTelemetryOptions {\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 *\n\t * @example\n\t *\n\t * ```JSON\n\t * { \"prop1\": \"value1\", \"prop2\": 10.0 }\n\t * ```\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\n/**\n * Options to provide upon creation of IFileLogger\n * @deprecated Use {@link IFileLoggerTelemetryOptions}.\n * @internal\n */\nexport type ITelemetryOptions = IFileLoggerTelemetryOptions;\n"]}
|
|
@@ -2,8 +2,34 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
5
6
|
import { type TelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
6
|
-
import { type IFileLogger, type
|
|
7
|
+
import { type IFileLogger, type IFileLoggerTelemetryOptions } from "./fileLogger.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a telemetry logger wrapped around an {@link IFileLogger} that writes to the given file path.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* All telemetry events should be sent through the returned `logger`. The returned `fileLogger` is the
|
|
13
|
+
* underlying sink — its `close()` method must be called at the end of execution to flush any buffered
|
|
14
|
+
* events to disk.
|
|
15
|
+
*
|
|
16
|
+
* If `options.outputFormat` is not supplied, telemetry is written as JSON. Use {@link OutputFormat.CSV}
|
|
17
|
+
* to write CSV instead. See {@link IFileLoggerTelemetryOptions} for supported options including default
|
|
18
|
+
* properties applied to every event and flush batching.
|
|
19
|
+
*
|
|
20
|
+
* @param filePath - Path to the file telemetry will be written to. If the file already exists its
|
|
21
|
+
* contents will be overwritten or corrupted — callers should verify the path is unused before calling.
|
|
22
|
+
* @param options - Optional telemetry configuration. See {@link IFileLoggerTelemetryOptions}.
|
|
23
|
+
* @returns The wrapped telemetry logger to send events through, and the underlying `IFileLogger`
|
|
24
|
+
* which must be closed when telemetry collection is finished.
|
|
25
|
+
*
|
|
26
|
+
* @legacy
|
|
27
|
+
* @beta
|
|
28
|
+
*/
|
|
29
|
+
export declare function createFluidRunnerLogger(filePath: string, options?: IFileLoggerTelemetryOptions): {
|
|
30
|
+
logger: ITelemetryBaseLogger;
|
|
31
|
+
fileLogger: IFileLogger;
|
|
32
|
+
};
|
|
7
33
|
/**
|
|
8
34
|
* Create an {@link @fluidframework/telemetry-utils#TelemetryLoggerExt} wrapped around provided {@link IFileLogger}.
|
|
9
35
|
*
|
|
@@ -16,9 +42,11 @@ import { type IFileLogger, type ITelemetryOptions } from "./fileLogger.js";
|
|
|
16
42
|
* Note: if an output format is not supplied, default is JSON.
|
|
17
43
|
*
|
|
18
44
|
* @returns Both the `IFileLogger` implementation and `TelemetryLoggerExt` wrapper to be called.
|
|
45
|
+
*
|
|
46
|
+
* @deprecated Use {@link createFluidRunnerLogger}.
|
|
19
47
|
* @internal
|
|
20
48
|
*/
|
|
21
|
-
export declare function createLogger(filePath: string, options?:
|
|
49
|
+
export declare function createLogger(filePath: string, options?: IFileLoggerTelemetryOptions): {
|
|
22
50
|
logger: TelemetryLoggerExt;
|
|
23
51
|
fileLogger: IFileLogger;
|
|
24
52
|
};
|
|
@@ -39,6 +67,6 @@ export declare function validateAndParseTelemetryOptions(format?: string, props?
|
|
|
39
67
|
error: string;
|
|
40
68
|
} | {
|
|
41
69
|
success: true;
|
|
42
|
-
telemetryOptions:
|
|
70
|
+
telemetryOptions: IFileLoggerTelemetryOptions;
|
|
43
71
|
};
|
|
44
72
|
//# sourceMappingURL=loggerUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,KAAK,kBAAkB,EAEvB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,
|
|
1
|
+
{"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EACN,KAAK,kBAAkB,EAEvB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,2BAA2B,EAEhC,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,2BAA2B,GACnC;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAE3D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,2BAA2B,GACnC;IAAE,MAAM,EAAE,kBAAkB,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAezD;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,GAErB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,gBAAgB,EAAE,2BAA2B,CAAA;CAAE,CAqClE"}
|
|
@@ -5,8 +5,32 @@
|
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
import { createChildLogger, } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
import { CSVFileLogger } from "./csvFileLogger.js";
|
|
8
|
-
import { OutputFormat } from "./fileLogger.js";
|
|
8
|
+
import { OutputFormat, } from "./fileLogger.js";
|
|
9
9
|
import { JSONFileLogger } from "./jsonFileLogger.js";
|
|
10
|
+
/**
|
|
11
|
+
* Create a telemetry logger wrapped around an {@link IFileLogger} that writes to the given file path.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* All telemetry events should be sent through the returned `logger`. The returned `fileLogger` is the
|
|
15
|
+
* underlying sink — its `close()` method must be called at the end of execution to flush any buffered
|
|
16
|
+
* events to disk.
|
|
17
|
+
*
|
|
18
|
+
* If `options.outputFormat` is not supplied, telemetry is written as JSON. Use {@link OutputFormat.CSV}
|
|
19
|
+
* to write CSV instead. See {@link IFileLoggerTelemetryOptions} for supported options including default
|
|
20
|
+
* properties applied to every event and flush batching.
|
|
21
|
+
*
|
|
22
|
+
* @param filePath - Path to the file telemetry will be written to. If the file already exists its
|
|
23
|
+
* contents will be overwritten or corrupted — callers should verify the path is unused before calling.
|
|
24
|
+
* @param options - Optional telemetry configuration. See {@link IFileLoggerTelemetryOptions}.
|
|
25
|
+
* @returns The wrapped telemetry logger to send events through, and the underlying `IFileLogger`
|
|
26
|
+
* which must be closed when telemetry collection is finished.
|
|
27
|
+
*
|
|
28
|
+
* @legacy
|
|
29
|
+
* @beta
|
|
30
|
+
*/
|
|
31
|
+
export function createFluidRunnerLogger(filePath, options) {
|
|
32
|
+
return createLogger(filePath, options);
|
|
33
|
+
}
|
|
10
34
|
/**
|
|
11
35
|
* Create an {@link @fluidframework/telemetry-utils#TelemetryLoggerExt} wrapped around provided {@link IFileLogger}.
|
|
12
36
|
*
|
|
@@ -19,6 +43,8 @@ import { JSONFileLogger } from "./jsonFileLogger.js";
|
|
|
19
43
|
* Note: if an output format is not supplied, default is JSON.
|
|
20
44
|
*
|
|
21
45
|
* @returns Both the `IFileLogger` implementation and `TelemetryLoggerExt` wrapper to be called.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated Use {@link createFluidRunnerLogger}.
|
|
22
48
|
* @internal
|
|
23
49
|
*/
|
|
24
50
|
export function createLogger(filePath, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB,OAAO,EAEN,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAGN,YAAY,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,uBAAuB,CACtC,QAAgB,EAChB,OAAqC;IAErC,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY,CAC3B,QAAgB,EAChB,OAAqC;IAErC,MAAM,UAAU,GACf,OAAO,EAAE,YAAY,KAAK,YAAY,CAAC,GAAG;QACzC,CAAC,CAAC,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,CAAC;QAC7E,CA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MAAM,GAAG;aACxE,CAAC;QACH,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAClC,OAAO;oBACN,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,4CAA4C,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,GAAG;iBACxE,CAAC;YACH,CAAC;YACD,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAED,IAAI,cAAc,KAAK,SAAS,IAAI,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QAC3D,OAAO;YACN,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,wBAAwB;SAC/B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,CAAC;AAC5F,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\ttype TelemetryLoggerExt,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { CSVFileLogger } from \"./csvFileLogger.js\";\nimport {\n\ttype IFileLogger,\n\ttype IFileLoggerTelemetryOptions,\n\tOutputFormat,\n} from \"./fileLogger.js\";\nimport { JSONFileLogger } from \"./jsonFileLogger.js\";\n\n/**\n * Create a telemetry logger wrapped around an {@link IFileLogger} that writes to the given file path.\n *\n * @remarks\n * All telemetry events should be sent through the returned `logger`. The returned `fileLogger` is the\n * underlying sink — its `close()` method must be called at the end of execution to flush any buffered\n * events to disk.\n *\n * If `options.outputFormat` is not supplied, telemetry is written as JSON. Use {@link OutputFormat.CSV}\n * to write CSV instead. See {@link IFileLoggerTelemetryOptions} for supported options including default\n * properties applied to every event and flush batching.\n *\n * @param filePath - Path to the file telemetry will be written to. If the file already exists its\n * contents will be overwritten or corrupted — callers should verify the path is unused before calling.\n * @param options - Optional telemetry configuration. See {@link IFileLoggerTelemetryOptions}.\n * @returns The wrapped telemetry logger to send events through, and the underlying `IFileLogger`\n * which must be closed when telemetry collection is finished.\n *\n * @legacy\n * @beta\n */\nexport function createFluidRunnerLogger(\n\tfilePath: string,\n\toptions?: IFileLoggerTelemetryOptions,\n): { logger: ITelemetryBaseLogger; fileLogger: IFileLogger } {\n\treturn createLogger(filePath, options);\n}\n\n/**\n * Create an {@link @fluidframework/telemetry-utils#TelemetryLoggerExt} 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 `TelemetryLoggerExt` wrapper to be called.\n *\n * @deprecated Use {@link createFluidRunnerLogger}.\n * @internal\n */\nexport function createLogger(\n\tfilePath: string,\n\toptions?: IFileLoggerTelemetryOptions,\n): { logger: TelemetryLoggerExt; 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):\n\t| { success: false; error: string }\n\t| { success: true; telemetryOptions: IFileLoggerTelemetryOptions } {\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"]}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { type IExportFileResponse } from "./exportFile.js";
|
|
6
|
-
import type {
|
|
6
|
+
import type { IFileLoggerTelemetryOptions } from "./logger/fileLogger.js";
|
|
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
10
|
* @internal
|
|
11
11
|
*/
|
|
12
|
-
export declare function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?:
|
|
12
|
+
export declare function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: IFileLoggerTelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
|
|
13
13
|
//# sourceMappingURL=parseBundleAndExportFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBundleAndExportFile.d.ts","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,
|
|
1
|
+
{"version":3,"file":"parseBundleAndExportFile.d.ts","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAU1E;;;;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,2BAA2B,EAC9C,OAAO,CAAC,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAoE9B"}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import { PerformanceEvent } from "@fluidframework/telemetry-utils/internal";
|
|
7
|
+
import { PerformanceEvent, createChildLogger } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
import { isCodeLoaderBundle, isFluidFileConverter } from "./codeLoaderBundle.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { createFluidRunnerContainerAndExecute, } from "./exportFile.js";
|
|
10
|
+
import { createFluidRunnerLogger, getTelemetryFileValidationError, } from "./logger/loggerUtils.js";
|
|
11
11
|
/* eslint-enable import-x/no-internal-modules */
|
|
12
12
|
import { getArgsValidationError, getSnapshotFileContent } from "./utils.js";
|
|
13
13
|
const clientArgsValidationError = "Client_ArgsValidationError";
|
|
@@ -22,7 +22,8 @@ export async function parseBundleAndExportFile(codeLoader, inputFile, outputFile
|
|
|
22
22
|
const eventName = clientArgsValidationError;
|
|
23
23
|
return { success: false, eventName, errorMessage: telemetryArgError };
|
|
24
24
|
}
|
|
25
|
-
const { fileLogger, logger } =
|
|
25
|
+
const { fileLogger, logger: baseLogger } = createFluidRunnerLogger(telemetryFile, telemetryOptions);
|
|
26
|
+
const logger = createChildLogger({ logger: baseLogger });
|
|
26
27
|
try {
|
|
27
28
|
return await PerformanceEvent.timedExecAsync(logger, { eventName: "ParseBundleAndExportFile" }, async () => {
|
|
28
29
|
// codeLoader is expected to be a file path. On Windows this also requires
|
|
@@ -50,7 +51,8 @@ export async function parseBundleAndExportFile(codeLoader, inputFile, outputFile
|
|
|
50
51
|
logger.sendErrorEvent({ eventName, message: argsValidationError });
|
|
51
52
|
return { success: false, eventName, errorMessage: argsValidationError };
|
|
52
53
|
}
|
|
53
|
-
fs.writeFileSync(outputFile, await
|
|
54
|
+
fs.writeFileSync(outputFile, await createFluidRunnerContainerAndExecute(getSnapshotFileContent(inputFile), fluidExport, baseLogger, // Pass baseLogger with ITelemetryBaseLogger type
|
|
55
|
+
options, timeout, disableNetworkFetch));
|
|
54
56
|
return { success: true };
|
|
55
57
|
});
|
|
56
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE/F,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAEN,oCAAoC,GACpC,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACN,uBAAuB,EACvB,+BAA+B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,gDAAgD;AAChD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC7C,UAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAA8C,EAC9C,OAAgB,EAChB,mBAA6B;IAE7B,MAAM,iBAAiB,GAAG,+BAA+B,CAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAAiB,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,yBAAyB,CAAC;Q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OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;gBAC5D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;YACpD,CAAC;YAED,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACnF,IAAI,mBAAmB,EAAE,CAAC;gBACzB,MAAM,SAAS,GAAG,yBAAyB,CAAC;gBAC5C,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;gBACnE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC;YACzE,CAAC;YAED,EAAE,CAAC,aAAa,CACf,UAAU,EACV,MAAM,oCAAoC,CACzC,sBAAsB,CAAC,SAAS,CAAC,EACjC,WAAW,EACX,UAAU,EAAE,iDAAiD;YAC7D,OAAO,EACP,OAAO,EACP,mBAAmB,CACnB,CACD,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC,CACD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,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;IAC/E,CAAC;YAAS,CAAC;QACV,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { PerformanceEvent, createChildLogger } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { isCodeLoaderBundle, isFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport {\n\ttype IExportFileResponse,\n\tcreateFluidRunnerContainerAndExecute,\n} from \"./exportFile.js\";\n/* eslint-disable import-x/no-internal-modules */\nimport type { IFileLoggerTelemetryOptions } from \"./logger/fileLogger.js\";\nimport {\n\tcreateFluidRunnerLogger,\n\tgetTelemetryFileValidationError,\n} from \"./logger/loggerUtils.js\";\n/* eslint-enable import-x/no-internal-modules */\nimport { getArgsValidationError, getSnapshotFileContent } from \"./utils.js\";\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?: IFileLoggerTelemetryOptions,\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: baseLogger } = createFluidRunnerLogger(\n\t\ttelemetryFile,\n\t\ttelemetryOptions,\n\t);\n\tconst logger = createChildLogger({ logger: baseLogger });\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// codeLoader is expected to be a file path. On Windows this also requires\n\t\t\t\t// explicit file: protocol for absolute paths. Otherwise, path starting with\n\t\t\t\t// a driver letter like 'c:\" will have drive interpreted as URL protocol.\n\t\t\t\t// file:// URLs are always absolute so prepend file:// exactly when absolute.\n\t\t\t\tconst codeLoaderSpec = `${path.isAbsolute(codeLoader) ? \"file://\" : \"\"}${codeLoader}`;\n\t\t\t\tconst codeLoaderBundle = await import(codeLoaderSpec);\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 createFluidRunnerContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidExport,\n\t\t\t\t\t\tbaseLogger, // Pass baseLogger with ITelemetryBaseLogger type\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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-runner",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.110.0",
|
|
4
4
|
"description": "Utility for running various functionality inside a Fluid Framework environment",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -71,26 +71,26 @@
|
|
|
71
71
|
"temp-directory": "nyc/.nyc_output"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@fluidframework/aqueduct": "~2.
|
|
75
|
-
"@fluidframework/container-definitions": "~2.
|
|
76
|
-
"@fluidframework/container-loader": "~2.
|
|
77
|
-
"@fluidframework/core-interfaces": "~2.
|
|
78
|
-
"@fluidframework/driver-definitions": "~2.
|
|
79
|
-
"@fluidframework/odsp-driver": "~2.
|
|
80
|
-
"@fluidframework/odsp-driver-definitions": "~2.
|
|
81
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
74
|
+
"@fluidframework/aqueduct": "~2.110.0",
|
|
75
|
+
"@fluidframework/container-definitions": "~2.110.0",
|
|
76
|
+
"@fluidframework/container-loader": "~2.110.0",
|
|
77
|
+
"@fluidframework/core-interfaces": "~2.110.0",
|
|
78
|
+
"@fluidframework/driver-definitions": "~2.110.0",
|
|
79
|
+
"@fluidframework/odsp-driver": "~2.110.0",
|
|
80
|
+
"@fluidframework/odsp-driver-definitions": "~2.110.0",
|
|
81
|
+
"@fluidframework/telemetry-utils": "~2.110.0",
|
|
82
82
|
"@json2csv/plainjs": "^7.0.6",
|
|
83
83
|
"yargs": "17.7.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
87
87
|
"@biomejs/biome": "~2.4.5",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "~2.110.0",
|
|
89
89
|
"@fluid-tools/build-cli": "^0.65.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
91
|
"@fluidframework/build-tools": "^0.65.0",
|
|
92
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
93
|
-
"@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.
|
|
92
|
+
"@fluidframework/eslint-config-fluid": "^13.0.0",
|
|
93
|
+
"@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.103.0",
|
|
94
94
|
"@microsoft/api-extractor": "7.58.1",
|
|
95
95
|
"@types/mocha": "^10.0.10",
|
|
96
96
|
"@types/node": "~22.19.17",
|