@fluidframework/fluid-runner 2.71.0 → 2.72.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/.eslintrc.cjs +1 -1
- package/CHANGELOG.md +4 -3
- package/dist/exportFile.js.map +1 -1
- package/dist/fluidRunner.js +2 -2
- package/dist/fluidRunner.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/parseBundleAndExportFile.js +1 -1
- package/dist/parseBundleAndExportFile.js.map +1 -1
- package/lib/exportFile.js.map +1 -1
- package/lib/fluidRunner.js +2 -2
- package/lib/fluidRunner.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/parseBundleAndExportFile.js +1 -1
- package/lib/parseBundleAndExportFile.js.map +1 -1
- package/package.json +14 -14
- package/src/exportFile.ts +2 -2
- package/src/fluidRunner.ts +2 -2
- package/src/index.ts +2 -2
- package/src/parseBundleAndExportFile.ts +2 -2
package/.eslintrc.cjs
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = {
|
|
|
20
20
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
21
21
|
"@typescript-eslint/no-use-before-define": "off",
|
|
22
22
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
23
|
-
"import/no-nodejs-modules": "off",
|
|
23
|
+
"import-x/no-nodejs-modules": "off",
|
|
24
24
|
"unicorn/filename-case": [
|
|
25
25
|
"error",
|
|
26
26
|
{
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @fluidframework/fluid-runner
|
|
2
2
|
|
|
3
|
+
## 2.72.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
3
7
|
## 2.71.0
|
|
4
8
|
|
|
5
9
|
Dependency updates only.
|
|
@@ -147,7 +151,6 @@ Dependency updates only.
|
|
|
147
151
|
TypeScript types and implementation code.
|
|
148
152
|
|
|
149
153
|
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
150
|
-
|
|
151
154
|
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
152
155
|
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
153
156
|
|
|
@@ -194,7 +197,6 @@ Dependency updates only.
|
|
|
194
197
|
- test-utils: provideEntryPoint is required [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
195
198
|
|
|
196
199
|
The optional `provideEntryPoint` method has become required on a number of constructors. A value will need to be provided to the following classes:
|
|
197
|
-
|
|
198
200
|
- `BaseContainerRuntimeFactory`
|
|
199
201
|
- `RuntimeFactory`
|
|
200
202
|
- `ContainerRuntime` (constructor and `loadRuntime`)
|
|
@@ -227,7 +229,6 @@ Dependency updates only.
|
|
|
227
229
|
|
|
228
230
|
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
229
231
|
imported from the **@fluidframework/core-interfaces** package:
|
|
230
|
-
|
|
231
232
|
- interface IDisposable
|
|
232
233
|
- interface IErrorEvent
|
|
233
234
|
- interface IErrorEvent
|
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;AAEzB,6EAA8E;AAC9E,wEAImD;AACnD,mEAA6F;AAC7F,uEAGkD;AAGlD,6DAAuD;AAGvD,4DAAwF;AACxF,yCAA4F;AAyB5F,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,gDAA+B,EA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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,IAAA,yBAAc,EAAS,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;AArDD,8DAqDC","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 ITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver.js\";\n/* eslint-disable import/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/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: 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 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,uCAAyB;AAEzB,6EAA8E;AAC9E,wEAImD;AACnD,mEAA6F;AAC7F,uEAGkD;AAGlD,6DAAuD;AAGvD,4DAAwF;AACxF,yCAA4F;AAyB5F,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,gDAA+B,EAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAAiB,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,yBAAyB,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;IACvE,CAAC;IACD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,6BAAY,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAE7E,IAAI,CAAC;QACJ,OAAO,MAAM,2BAAgB,CAAC,cAAc,CAC3C,MAAM,EACN,EAAE,SAAS,EAAE,YAAY,EAAE,EAC3B,KAAK,IAAI,EAAE;YACV,MAAM,mBAAmB,GAAG,IAAA,iCAAsB,EAAC,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,OAA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BAAkB,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClD,MAAM;SACN,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,IAAA,gCAAqB,EAAC;YAC7C,GAAG,WAAW;YACd,OAAO,EAAE;gBACR,GAAG,EAAE,WAAW;gBAChB,OAAO,EAAE;oBACR,CAAC,uBAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE;iBACtD;aACD;SACD,CAAC,CAAC;QACH,MAAM,IAAA,iCAAsB,EAAC,SAAS,CAAC,CAAC;QAExC,OAAO,2BAAgB,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,IAAA,yBAAc,EAAS,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;AArDD,8DAqDC","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 ITelemetryLoggerExt,\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: 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 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/dist/fluidRunner.js
CHANGED
|
@@ -9,10 +9,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.fluidRunner = void 0;
|
|
11
11
|
const yargs_1 = __importDefault(require("yargs"));
|
|
12
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
12
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
13
13
|
const helpers_1 = require("yargs/helpers");
|
|
14
14
|
const exportFile_js_1 = require("./exportFile.js");
|
|
15
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
15
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
16
16
|
const loggerUtils_js_1 = require("./logger/loggerUtils.js");
|
|
17
17
|
const parseBundleAndExportFile_js_1 = require("./parseBundleAndExportFile.js");
|
|
18
18
|
const utils_js_1 = require("./utils.js");
|
package/dist/fluidRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAA0B;AAC1B,wDAAwD;AACxD,2CAAwC;AAGxC,mDAA6C;AAC7C,wDAAwD;AACxD,4DAA2E;AAC3E,+EAAyE;AACzE,yCAAqD;AAErD;;;GAGG;AACI,KAAK,UAAU,WAAW,CAAC,kBAAwC;IACzE,MAAM,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAChC,OAAO,CACP,YAAY,EACZ,8CAA8C,EAC9C,CAAC,IAAI,EAAE,EAAE,CACR,IAAI;SACF,MAAM,CAAC,YAAY,EAAE;QACrB,QAAQ,EACP,mIAAmI;QACpI,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,KAAK;KACnB,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACpB,QAAQ,EAAE,6BAA6B;QACvC,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;KAClB,CAAC;SACD,MAAM,CAAC,YAAY,EAAE;QACrB,QAAQ,EACP,oFAAoF;QACrF,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;KAClB,CAAC;SACD,MAAM,CAAC,eAAe,EAAE;QACxB,QAAQ,EACP,2EAA2E;QAC5E,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,IAAI;KAClB,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QAClB,QAAQ,EAAE,qDAAqD;QAC/D,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,KAAK;KACnB,CAAC;SACD,MAAM,CAAC,iBAAiB,EAAE;QAC1B,QAAQ,EAAE,mEAAmE;QAC7E,IAAI,EAAE,QAAQ;QACd,YAAY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SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,sBAAsB,CAAC,gBAAgB,EACvC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,mBAAmB,CACxB;YACF,CAAC,CAAC,IAAA,0BAAU,EACV,kBAAmB,EACnB,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,sBAAsB,CAAC,gBAAgB,EACvC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,mBAAmB,CACxB,CAAC,CAAC;QAEL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CACD;SACA,IAAI,EAAE;SACN,aAAa,CAAC,CAAC,CAAC;SAChB,KAAK,EAAE,CAAC;AACX,CAAC;AAjHD,kCAiHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport yargs from \"yargs\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { hideBin } from \"yargs/helpers\";\n\nimport type { IFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { exportFile } from \"./exportFile.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { validateAndParseTelemetryOptions } from \"./logger/loggerUtils.js\";\nimport { parseBundleAndExportFile } from \"./parseBundleAndExportFile.js\";\nimport { validateCommandLineArgs } from \"./utils.js\";\n\n/**\n * @param fluidFileConverter - needs to be provided if \"codeLoaderBundle\" is not and vice versa\n * @internal\n */\nexport async function fluidRunner(fluidFileConverter?: IFluidFileConverter): Promise<void> {\n\tawait yargs(hideBin(process.argv))\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(argv) =>\n\t\t\t\targv\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: '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\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\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\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(1)\n\t\t.parse();\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -20,5 +20,5 @@ var parseBundleAndExportFile_js_1 = require("./parseBundleAndExportFile.js");
|
|
|
20
20
|
Object.defineProperty(exports, "parseBundleAndExportFile", { enumerable: true, get: function () { return parseBundleAndExportFile_js_1.parseBundleAndExportFile; } });
|
|
21
21
|
var utils_js_1 = require("./utils.js");
|
|
22
22
|
Object.defineProperty(exports, "getSnapshotFileContent", { enumerable: true, get: function () { return utils_js_1.getSnapshotFileContent; } });
|
|
23
|
-
/* eslint-enable import/no-internal-modules */
|
|
23
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iDAMyB;AALxB,0HAAA,yBAAyB,OAAA;AACzB,2GAAA,UAAU,OAAA;AAKX,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,wDAIgC;AAH/B,6GAAA,YAAY,OAAA;AAIb,0DAIiC;AAHhC,8GAAA,YAAY,OAAA;AACZ,iIAAA,+BAA+B,OAAA;AAC/B,kIAAA,gCAAgC,OAAA;AAEjC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,iDAMyB;AALxB,0HAAA,yBAAyB,OAAA;AACzB,2GAAA,UAAU,OAAA;AAKX,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,wDAIgC;AAH/B,6GAAA,YAAY,OAAA;AAIb,0DAIiC;AAHhC,8GAAA,YAAY,OAAA;AACZ,iIAAA,+BAA+B,OAAA;AAC/B,kIAAA,gCAAgC,OAAA;AAEjC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,uCAAoD;AAA3C,kHAAA,sBAAsB,OAAA;AAC/B,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\texportFile,\n\ttype IExportFileResponse,\n\ttype IExportFileResponseSuccess,\n\ttype IExportFileResponseFailure,\n} from \"./exportFile.js\";\nexport { fluidRunner } from \"./fluidRunner.js\";\nexport {\n\tOutputFormat,\n\ttype ITelemetryOptions,\n\ttype IFileLogger,\n} from \"./logger/fileLogger.js\";\nexport {\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"]}
|
|
@@ -34,7 +34,7 @@ const internal_1 = require("@fluidframework/telemetry-utils/internal");
|
|
|
34
34
|
const codeLoaderBundle_js_1 = require("./codeLoaderBundle.js");
|
|
35
35
|
const exportFile_js_1 = require("./exportFile.js");
|
|
36
36
|
const loggerUtils_js_1 = require("./logger/loggerUtils.js");
|
|
37
|
-
/* eslint-enable import/no-internal-modules */
|
|
37
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
38
38
|
const utils_js_1 = require("./utils.js");
|
|
39
39
|
const clientArgsValidationError = "Client_ArgsValidationError";
|
|
40
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA8B;AAC9B,gDAAkC;AAElC,uEAA4E;AAE5E,+DAAiF;AACjF,mDAAsF;AAGtF,4DAAwF;AACxF,
|
|
1
|
+
{"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA8B;AAC9B,gDAAkC;AAElC,uEAA4E;AAE5E,+DAAiF;AACjF,mDAAsF;AAGtF,4DAAwF;AACxF,gDAAgD;AAChD,yCAA4E;AAE5E,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,gDAA+B,EAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAAiB,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,yBAAyB,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E,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;YACpD,CAAC;YAED,MAAM,mBAAmB,GAAG,IAAA,iCAAsB,EAAC,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,IAAA,yCAAyB,EAC9B,IAAA,iCAAsB,EAAC,SAAS,CAAC,EACjC,WAAW,EACX,MAAM,EACN,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;AAzED,4DAyEC","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 } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { isCodeLoaderBundle, isFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { type IExportFileResponse, createContainerAndExecute } from \"./exportFile.js\";\n/* eslint-disable import-x/no-internal-modules */\nimport type { ITelemetryOptions } from \"./logger/fileLogger.js\";\nimport { createLogger, getTelemetryFileValidationError } 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?: 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// 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 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/lib/exportFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;A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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 ITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver.js\";\n/* eslint-disable import/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/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: 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 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;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAEN,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,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AAM,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 ITelemetryLoggerExt,\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: 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 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/fluidRunner.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import yargs from "yargs";
|
|
6
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
6
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
7
7
|
import { hideBin } from "yargs/helpers";
|
|
8
8
|
import { exportFile } from "./exportFile.js";
|
|
9
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
9
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
10
10
|
import { validateAndParseTelemetryOptions } from "./logger/loggerUtils.js";
|
|
11
11
|
import { parseBundleAndExportFile } from "./parseBundleAndExportFile.js";
|
|
12
12
|
import { validateCommandLineArgs } from "./utils.js";
|
package/lib/fluidRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,
|
|
1
|
+
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,wDAAwD;AACxD,OAA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,SAAS,EACd,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,sBAAsB,CAAC,gBAAgB,EACvC,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,mBAAmB,CACxB,CAAC,CAAC;QAEL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CACD;SACA,IAAI,EAAE;SACN,aAAa,CAAC,CAAC,CAAC;SAChB,KAAK,EAAE,CAAC;AACX,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport yargs from \"yargs\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { hideBin } from \"yargs/helpers\";\n\nimport type { IFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { exportFile } from \"./exportFile.js\";\n// eslint-disable-next-line import-x/no-internal-modules\nimport { validateAndParseTelemetryOptions } from \"./logger/loggerUtils.js\";\nimport { parseBundleAndExportFile } from \"./parseBundleAndExportFile.js\";\nimport { validateCommandLineArgs } from \"./utils.js\";\n\n/**\n * @param fluidFileConverter - needs to be provided if \"codeLoaderBundle\" is not and vice versa\n * @internal\n */\nexport async function fluidRunner(fluidFileConverter?: IFluidFileConverter): Promise<void> {\n\tawait yargs(hideBin(process.argv))\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(argv) =>\n\t\t\t\targv\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: '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\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\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\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(1)\n\t\t.parse();\n}\n"]}
|
package/lib/index.js
CHANGED
|
@@ -8,5 +8,5 @@ export { OutputFormat, } from "./logger/fileLogger.js";
|
|
|
8
8
|
export { createLogger, getTelemetryFileValidationError, validateAndParseTelemetryOptions, } from "./logger/loggerUtils.js";
|
|
9
9
|
export { parseBundleAndExportFile } from "./parseBundleAndExportFile.js";
|
|
10
10
|
export { getSnapshotFileContent } from "./utils.js";
|
|
11
|
-
/* eslint-enable import/no-internal-modules */
|
|
11
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
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,GAGZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,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,
|
|
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,GAGZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,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\texportFile,\n\ttype IExportFileResponse,\n\ttype IExportFileResponseSuccess,\n\ttype IExportFileResponseFailure,\n} from \"./exportFile.js\";\nexport { fluidRunner } from \"./fluidRunner.js\";\nexport {\n\tOutputFormat,\n\ttype ITelemetryOptions,\n\ttype IFileLogger,\n} from \"./logger/fileLogger.js\";\nexport {\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"]}
|
|
@@ -8,7 +8,7 @@ import { PerformanceEvent } from "@fluidframework/telemetry-utils/internal";
|
|
|
8
8
|
import { isCodeLoaderBundle, isFluidFileConverter } from "./codeLoaderBundle.js";
|
|
9
9
|
import { createContainerAndExecute } from "./exportFile.js";
|
|
10
10
|
import { createLogger, getTelemetryFileValidationError } from "./logger/loggerUtils.js";
|
|
11
|
-
/* eslint-enable import/no-internal-modules */
|
|
11
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
12
12
|
import { getArgsValidationError, getSnapshotFileContent } from "./utils.js";
|
|
13
13
|
const clientArgsValidationError = "Client_ArgsValidationError";
|
|
14
14
|
/**
|
|
@@ -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;AAE5E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAA4B,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAGtF,OAAO,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AACxF,
|
|
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;AAE5E,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAA4B,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAGtF,OAAO,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AACxF,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,CA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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 } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { isCodeLoaderBundle, isFluidFileConverter } from \"./codeLoaderBundle.js\";\nimport { type IExportFileResponse, createContainerAndExecute } from \"./exportFile.js\";\n/* eslint-disable import-x/no-internal-modules */\nimport type { ITelemetryOptions } from \"./logger/fileLogger.js\";\nimport { createLogger, getTelemetryFileValidationError } 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?: 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// 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 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/fluid-runner",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.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.72.0",
|
|
75
|
+
"@fluidframework/container-definitions": "~2.72.0",
|
|
76
|
+
"@fluidframework/container-loader": "~2.72.0",
|
|
77
|
+
"@fluidframework/core-interfaces": "~2.72.0",
|
|
78
|
+
"@fluidframework/driver-definitions": "~2.72.0",
|
|
79
|
+
"@fluidframework/odsp-driver": "~2.72.0",
|
|
80
|
+
"@fluidframework/odsp-driver-definitions": "~2.72.0",
|
|
81
|
+
"@fluidframework/telemetry-utils": "~2.72.0",
|
|
82
82
|
"@json2csv/plainjs": "^7.0.6",
|
|
83
83
|
"yargs": "17.7.2"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
87
87
|
"@biomejs/biome": "~1.9.3",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
89
|
-
"@fluid-tools/build-cli": "^0.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "~2.72.0",
|
|
89
|
+
"@fluid-tools/build-cli": "^0.60.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
|
-
"@fluidframework/build-tools": "^0.
|
|
92
|
-
"@fluidframework/eslint-config-fluid": "
|
|
93
|
-
"@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.
|
|
91
|
+
"@fluidframework/build-tools": "^0.60.0",
|
|
92
|
+
"@fluidframework/eslint-config-fluid": "~2.72.0",
|
|
93
|
+
"@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.71.0",
|
|
94
94
|
"@microsoft/api-extractor": "7.52.11",
|
|
95
95
|
"@types/mocha": "^10.0.10",
|
|
96
96
|
"@types/node": "^18.19.0",
|
package/src/exportFile.ts
CHANGED
|
@@ -19,11 +19,11 @@ import {
|
|
|
19
19
|
|
|
20
20
|
import type { IFluidFileConverter } from "./codeLoaderBundle.js";
|
|
21
21
|
import { FakeUrlResolver } from "./fakeUrlResolver.js";
|
|
22
|
-
/* eslint-disable import/no-internal-modules */
|
|
22
|
+
/* eslint-disable import-x/no-internal-modules */
|
|
23
23
|
import type { ITelemetryOptions } from "./logger/fileLogger.js";
|
|
24
24
|
import { createLogger, getTelemetryFileValidationError } from "./logger/loggerUtils.js";
|
|
25
25
|
import { getArgsValidationError, getSnapshotFileContent, timeoutPromise } from "./utils.js";
|
|
26
|
-
/* eslint-enable import/no-internal-modules */
|
|
26
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @legacy @beta
|
package/src/fluidRunner.ts
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import yargs from "yargs";
|
|
7
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
7
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
8
8
|
import { hideBin } from "yargs/helpers";
|
|
9
9
|
|
|
10
10
|
import type { IFluidFileConverter } from "./codeLoaderBundle.js";
|
|
11
11
|
import { exportFile } from "./exportFile.js";
|
|
12
|
-
// eslint-disable-next-line import/no-internal-modules
|
|
12
|
+
// eslint-disable-next-line import-x/no-internal-modules
|
|
13
13
|
import { validateAndParseTelemetryOptions } from "./logger/loggerUtils.js";
|
|
14
14
|
import { parseBundleAndExportFile } from "./parseBundleAndExportFile.js";
|
|
15
15
|
import { validateCommandLineArgs } from "./utils.js";
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable import/no-internal-modules */
|
|
6
|
+
/* eslint-disable import-x/no-internal-modules */
|
|
7
7
|
export type { ICodeLoaderBundle, IFluidFileConverter } from "./codeLoaderBundle.js";
|
|
8
8
|
export {
|
|
9
9
|
createContainerAndExecute,
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
} from "./logger/loggerUtils.js";
|
|
26
26
|
export { parseBundleAndExportFile } from "./parseBundleAndExportFile.js";
|
|
27
27
|
export { getSnapshotFileContent } from "./utils.js";
|
|
28
|
-
/* eslint-enable import/no-internal-modules */
|
|
28
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
@@ -10,10 +10,10 @@ import { PerformanceEvent } from "@fluidframework/telemetry-utils/internal";
|
|
|
10
10
|
|
|
11
11
|
import { isCodeLoaderBundle, isFluidFileConverter } from "./codeLoaderBundle.js";
|
|
12
12
|
import { type IExportFileResponse, createContainerAndExecute } from "./exportFile.js";
|
|
13
|
-
/* eslint-disable import/no-internal-modules */
|
|
13
|
+
/* eslint-disable import-x/no-internal-modules */
|
|
14
14
|
import type { ITelemetryOptions } from "./logger/fileLogger.js";
|
|
15
15
|
import { createLogger, getTelemetryFileValidationError } from "./logger/loggerUtils.js";
|
|
16
|
-
/* eslint-enable import/no-internal-modules */
|
|
16
|
+
/* eslint-enable import-x/no-internal-modules */
|
|
17
17
|
import { getArgsValidationError, getSnapshotFileContent } from "./utils.js";
|
|
18
18
|
|
|
19
19
|
const clientArgsValidationError = "Client_ArgsValidationError";
|