@fluidframework/fluid-runner 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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.js +11 -13
- package/.mocharc.js +2 -2
- package/README.md +23 -10
- package/bin/fluid-runner +0 -0
- package/dist/codeLoaderBundle.d.ts +3 -2
- package/dist/codeLoaderBundle.d.ts.map +1 -1
- package/dist/codeLoaderBundle.js +4 -2
- package/dist/codeLoaderBundle.js.map +1 -1
- package/dist/exportFile.d.ts.map +1 -1
- package/dist/exportFile.js +8 -4
- package/dist/exportFile.js.map +1 -1
- package/dist/fakeUrlResolver.d.ts.map +1 -1
- package/dist/fakeUrlResolver.js.map +1 -1
- package/dist/fluidRunner.d.ts.map +1 -1
- package/dist/fluidRunner.js +5 -4
- package/dist/fluidRunner.js.map +1 -1
- package/dist/getArgsValidationError.d.ts.map +1 -1
- package/dist/getArgsValidationError.js.map +1 -1
- package/dist/logger/baseFileLogger.d.ts.map +1 -1
- package/dist/logger/baseFileLogger.js.map +1 -1
- package/dist/logger/csvFileLogger.d.ts.map +1 -1
- package/dist/logger/csvFileLogger.js.map +1 -1
- package/dist/logger/fileLogger.d.ts.map +1 -1
- package/dist/logger/fileLogger.js.map +1 -1
- package/dist/logger/jsonFileLogger.d.ts.map +1 -1
- package/dist/logger/jsonFileLogger.js.map +1 -1
- package/dist/logger/loggerUtils.d.ts.map +1 -1
- package/dist/logger/loggerUtils.js +11 -3
- package/dist/logger/loggerUtils.js.map +1 -1
- package/dist/parseBundleAndExportFile.d.ts.map +1 -1
- package/dist/parseBundleAndExportFile.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/lib/codeLoaderBundle.d.ts +3 -2
- package/lib/codeLoaderBundle.d.ts.map +1 -1
- package/lib/codeLoaderBundle.js +4 -2
- package/lib/codeLoaderBundle.js.map +1 -1
- package/lib/exportFile.d.ts.map +1 -1
- package/lib/exportFile.js +8 -4
- package/lib/exportFile.js.map +1 -1
- package/lib/fakeUrlResolver.d.ts.map +1 -1
- package/lib/fakeUrlResolver.js.map +1 -1
- package/lib/fluidRunner.d.ts.map +1 -1
- package/lib/fluidRunner.js +5 -4
- package/lib/fluidRunner.js.map +1 -1
- package/lib/getArgsValidationError.d.ts.map +1 -1
- package/lib/getArgsValidationError.js.map +1 -1
- package/lib/logger/baseFileLogger.d.ts.map +1 -1
- package/lib/logger/baseFileLogger.js.map +1 -1
- package/lib/logger/csvFileLogger.d.ts.map +1 -1
- package/lib/logger/csvFileLogger.js.map +1 -1
- package/lib/logger/fileLogger.d.ts.map +1 -1
- package/lib/logger/fileLogger.js.map +1 -1
- package/lib/logger/jsonFileLogger.d.ts.map +1 -1
- package/lib/logger/jsonFileLogger.js.map +1 -1
- package/lib/logger/loggerUtils.d.ts.map +1 -1
- package/lib/logger/loggerUtils.js +11 -3
- package/lib/logger/loggerUtils.js.map +1 -1
- package/lib/parseBundleAndExportFile.d.ts.map +1 -1
- package/lib/parseBundleAndExportFile.js.map +1 -1
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +2 -2
- package/lib/utils.js.map +1 -1
- package/package.json +39 -38
- package/prettier.config.cjs +1 -1
- package/src/codeLoaderBundle.ts +29 -24
- package/src/exportFile.ts +69 -58
- package/src/fakeUrlResolver.ts +35 -31
- package/src/fluidRunner.ts +92 -83
- package/src/getArgsValidationError.ts +14 -17
- package/src/logger/baseFileLogger.ts +44 -44
- package/src/logger/csvFileLogger.ts +20 -20
- package/src/logger/fileLogger.ts +15 -15
- package/src/logger/jsonFileLogger.ts +12 -12
- package/src/logger/loggerUtils.ts +47 -39
- package/src/parseBundleAndExportFile.ts +58 -50
- package/src/utils.ts +14 -14
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
package/.eslintrc.js
CHANGED
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
7
|
+
extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
13
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
14
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
15
|
+
"import/no-nodejs-modules": "off",
|
|
16
|
+
},
|
|
17
|
+
};
|
package/.mocharc.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
"use strict";
|
|
7
7
|
|
|
8
|
-
const getFluidTestMochaConfig = require(
|
|
8
|
+
const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common");
|
|
9
9
|
|
|
10
10
|
const packageDir = __dirname;
|
|
11
11
|
const config = getFluidTestMochaConfig(packageDir);
|
package/README.md
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
# @fluidframework/fluid-runner
|
|
2
|
+
|
|
2
3
|
This package contains utility for running various functionality inside a Fluid Framework environment.
|
|
3
4
|
|
|
4
5
|
## Export File
|
|
6
|
+
|
|
5
7
|
Allows some execution to be made on a container given a provided ODSP snapshot.
|
|
6
8
|
|
|
7
9
|
### Sample command
|
|
10
|
+
|
|
8
11
|
If package is installed globally:
|
|
9
12
|
`node fluid-runner exportFile --codeLoader=compiledBundle.js --inputFile=inputFileName.fluid --outputFile=result.txt --telemetryFile=telemetryFile.txt`
|
|
10
13
|
|
|
11
14
|
If working directly on this package:
|
|
12
|
-
|
|
15
|
+
`node bin/fluid-runner exportFile --codeLoader=compiledBundle.js --inputFile=inputFileName.fluid --outputFile=result.txt --telemetryFile=telemetryFile.txt`
|
|
13
16
|
|
|
14
17
|
### Code Loader bundle format
|
|
18
|
+
|
|
15
19
|
The Code Loader bundle should provide defined exports required for this functionality.
|
|
16
20
|
For more details on what exports are needed, see [codeLoaderBundle.ts](./src/codeLoaderBundle.ts).
|
|
17
21
|
|
|
18
22
|
#### "codeLoader" vs "IFluidFileConverter" argument
|
|
23
|
+
|
|
19
24
|
You may notice the command line argument `codeLoader` is optional. If you choose not to provide a value for `codeLoader`, you must extend this library
|
|
20
25
|
and provide a [`IFluidFileConverter`](./src/codeLoaderBundle.ts) implementation to the [`fluidRunner(...)`](./src/fluidRunner.ts) method.
|
|
21
26
|
|
|
@@ -28,20 +33,25 @@ fluidRunner({ /* IFluidFileConverter implementation here */ });
|
|
|
28
33
|
> **Note**: Only one of `codeLoader` or `fluidRunner(...)` argument is allowed. If both or none are provided, an error will be thrown at the start of execution.
|
|
29
34
|
|
|
30
35
|
### Input file format
|
|
36
|
+
|
|
31
37
|
The input file is expected to be an ODSP snapshot.
|
|
32
38
|
For some examples, see the files in the [localOdspSnapshots folder](./src/test/localOdspSnapshots).
|
|
33
39
|
|
|
34
40
|
### Telemetry format
|
|
41
|
+
|
|
35
42
|
There is an optional command line option `telemetryFormat` that allows you to specify the telemetry output format. The naming provided to this option is strict and must match an option in [OutputFormat](./src/logger/fileLogger.ts).
|
|
36
43
|
The default format is currently `JSON`
|
|
37
44
|
|
|
38
45
|
### Additional telemetry properties
|
|
46
|
+
|
|
39
47
|
There is an optional command line option `telemetryProp` that allows you to specify additional properties that will be added to every telemetry entry. The format follows these rules:
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
48
|
+
|
|
49
|
+
- every key must be a string
|
|
50
|
+
- values may be either a string or a number
|
|
51
|
+
- keys and values cannot be empty
|
|
43
52
|
|
|
44
53
|
Example of valid usages:
|
|
54
|
+
|
|
45
55
|
```
|
|
46
56
|
--telemetryProp prop1 value1 --telemetryProp prop2 10.5
|
|
47
57
|
--telemetryProp " prop1 " " value1 " prop2 value2
|
|
@@ -51,6 +61,7 @@ Example of valid usages:
|
|
|
51
61
|
> No trimming of white-space inside quotes
|
|
52
62
|
|
|
53
63
|
Example of invalid usages:
|
|
64
|
+
|
|
54
65
|
```
|
|
55
66
|
--telemetryProp "10" value1
|
|
56
67
|
--telemetryProp prop1
|
|
@@ -58,12 +69,14 @@ Example of invalid usages:
|
|
|
58
69
|
```
|
|
59
70
|
|
|
60
71
|
### Consumption
|
|
72
|
+
|
|
61
73
|
The code around `exportFile` can be consumed in multiple different layers. It is not necessary to run all this code fully as is, and the following are some interesting code bits involved in this workflow:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
|
|
74
|
+
|
|
75
|
+
- [`createLogger(...)`](./src/logger/fileLogger.ts)
|
|
76
|
+
- Creates and wraps an `IFileLogger` and adds some useful telemetry data to every entry
|
|
77
|
+
- [`createContainerAndExecute(...)`](./src/exportFile.ts)
|
|
78
|
+
- This is the core logic for running some action based on a local ODSP snapshot
|
|
79
|
+
- [`getSnapshotFileContent(...)`](./src/utils.ts)
|
|
80
|
+
- Reads a local ODSP snapshot from both JSON and binary formats for usage in `createContainerAndExecute(...)`
|
|
68
81
|
|
|
69
82
|
For an example of a consumption path that differs slightly to [`exportFile(...)`](./src/exportFile.ts), see [`parseBundleAndExportFile(...)`](./src/parseBundleAndExportFile.ts). In addition to running the same logic as [`exportFile`](./src/exportFile.ts) method, it implements the logic around parsing a dynamically provided bundle path into an `IFluidFileConverter` object.
|
package/bin/fluid-runner
CHANGED
|
File without changes
|
|
@@ -25,9 +25,10 @@ export interface IFluidFileConverter {
|
|
|
25
25
|
*/
|
|
26
26
|
getCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Get scope object to provide at Loader creation
|
|
29
|
+
* @param logger - created logger object to pass to scope object
|
|
29
30
|
*/
|
|
30
|
-
|
|
31
|
+
getScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;
|
|
31
32
|
/**
|
|
32
33
|
* Executes code on container and returns the result
|
|
33
34
|
* @param container - container created by this application
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeLoaderBundle.d.ts","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"codeLoaderBundle.d.ts","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzE;;;OAGG;IACH,QAAQ,CAAC,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE9D;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,iBAAiB,CAG3E;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,mBAAmB,CAQzE"}
|
package/dist/codeLoaderBundle.js
CHANGED
|
@@ -16,8 +16,10 @@ function isCodeLoaderBundle(bundle) {
|
|
|
16
16
|
exports.isCodeLoaderBundle = isCodeLoaderBundle;
|
|
17
17
|
function isFluidFileConverter(obj) {
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
19
|
-
return (obj === null || obj === void 0 ? void 0 : obj.getCodeLoader) &&
|
|
20
|
-
|
|
19
|
+
return ((obj === null || obj === void 0 ? void 0 : obj.getCodeLoader) &&
|
|
20
|
+
typeof obj.getCodeLoader === "function" &&
|
|
21
|
+
obj.execute &&
|
|
22
|
+
typeof obj.execute === "function");
|
|
21
23
|
}
|
|
22
24
|
exports.isFluidFileConverter = isFluidFileConverter;
|
|
23
25
|
//# sourceMappingURL=codeLoaderBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyCH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa;QAClB,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU;QACvC,GAAG,CAAC,OAAO;QACX,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CACjC,CAAC;AACH,CAAC;AARD,oDAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * Contract that defines the necessary exports for the bundle provided at runtime\n * For an example, see \"src/test/sampleCodeLoaders/sampleCodeLoader.ts\"\n */\nexport interface ICodeLoaderBundle {\n\t/**\n\t * Fluid export of all the required objects and functions\n\t */\n\tfluidExport: Promise<IFluidFileConverter>;\n}\n\n/**\n * Instance that holds all the details for Fluid file conversion\n */\nexport interface IFluidFileConverter {\n\t/**\n\t * Get code loader details to provide at Loader creation\n\t * @param logger - created logger object to pass to code loader\n\t */\n\tgetCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;\n\n\t/**\n\t * Get scope object to provide at Loader creation\n\t * @param logger - created logger object to pass to scope object\n\t */\n\tgetScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;\n\n\t/**\n\t * Executes code on container and returns the result\n\t * @param container - container created by this application\n\t * @param options - additional options\n\t */\n\texecute(container: IContainer, options?: string): Promise<string>;\n}\n\n/**\n * Type cast to ensure necessary methods are present in the provided bundle\n * @param bundle - bundle provided to this application\n */\nexport function isCodeLoaderBundle(bundle: any): bundle is ICodeLoaderBundle {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn bundle?.fluidExport && typeof bundle.fluidExport === \"object\";\n}\n\nexport function isFluidFileConverter(obj: any): obj is IFluidFileConverter {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn (\n\t\tobj?.getCodeLoader &&\n\t\ttypeof obj.getCodeLoader === \"function\" &&\n\t\tobj.execute &&\n\t\ttypeof obj.execute === \"function\"\n\t);\n}\n"]}
|
package/dist/exportFile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAMtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,oBAAY,mBAAmB,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAE1F,UAAU,0BAA0B;
|
|
1
|
+
{"version":3,"file":"exportFile.d.ts","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAMtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,oBAAY,mBAAmB,GAAG,0BAA0B,GAAG,0BAA0B,CAAC;AAE1F,UAAU,0BAA0B;IACnC,OAAO,EAAE,IAAI,CAAC;CACd;AAED,UAAU,0BAA0B;IACnC,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ;AAID;;GAEG;AACH,wBAAsB,UAAU,CAC/B,kBAAkB,EAAE,mBAAmB,EACvC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,mBAAmB,CAAC,CAwC9B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC9C,iBAAiB,EAAE,MAAM,GAAG,UAAU,EACtC,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
package/dist/exportFile.js
CHANGED
|
@@ -71,16 +71,20 @@ exports.exportFile = exportFile;
|
|
|
71
71
|
* @returns result of execution
|
|
72
72
|
*/
|
|
73
73
|
async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options) {
|
|
74
|
+
var _a;
|
|
74
75
|
const loader = new container_loader_1.Loader({
|
|
75
76
|
urlResolver: new fakeUrlResolver_1.FakeUrlResolver(),
|
|
76
77
|
documentServiceFactory: (0, odsp_driver_1.createLocalOdspDocumentServiceFactory)(localOdspSnapshot),
|
|
77
78
|
codeLoader: await fluidFileConverter.getCodeLoader(logger),
|
|
78
|
-
scope: fluidFileConverter.
|
|
79
|
+
scope: await ((_a = fluidFileConverter.getScope) === null || _a === void 0 ? void 0 : _a.call(fluidFileConverter, logger)),
|
|
79
80
|
logger,
|
|
80
81
|
});
|
|
81
|
-
const container = await loader.resolve({
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
const container = await loader.resolve({
|
|
83
|
+
url: "/fakeUrl/",
|
|
84
|
+
headers: {
|
|
85
|
+
[container_definitions_1.LoaderHeader.loadMode]: { opsBeforeReturn: "cached" },
|
|
86
|
+
},
|
|
87
|
+
});
|
|
84
88
|
return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "ExportFile" }, async () => {
|
|
85
89
|
const result = await fluidFileConverter.execute(container, options);
|
|
86
90
|
container.close();
|
package/dist/exportFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"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OAAO,CAAC;QACtC,GAAG,EAAE,WAAW;QAChB,OAAO,EAAE;YACR,CAAC,oCAAY,CAAC,QAAQ,CAAC,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE;SACtD;KACD,CAAC,CAAC;IAEH,OAAO,kCAAgB,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,KAAK,IAAI,EAAE;QACtF,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpE,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IACf,CAAC,CAAC,CAAC;AACJ,CAAC;AA1BD,8DA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { getArgsValidationError } from \"./getArgsValidationError\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver\";\nimport { getSnapshotFileContent } from \"./utils\";\n/* eslint-disable import/no-internal-modules */\nimport { ITelemetryOptions } from \"./logger/fileLogger\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils\";\n/* eslint-enable import/no-internal-modules */\n\nexport type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;\n\ninterface IExportFileResponseSuccess {\n\tsuccess: true;\n}\n\ninterface IExportFileResponseFailure {\n\tsuccess: false;\n\teventName: string;\n\terrorMessage: string;\n\terror?: any;\n}\n\nconst clientArgsValidationError = \"Client_ArgsValidationError\";\n\n/**\n * Execute code on Container based on ODSP snapshot and write result to file\n */\nexport async function exportFile(\n\tfluidFileConverter: IFluidFileConverter,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n): 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);\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),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n\n/**\n * Create the container based on an ODSP snapshot and execute code on it\n * @returns result of execution\n */\nexport async function createContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tlogger: ITelemetryLogger,\n\toptions?: string,\n): Promise<string> {\n\tconst loader = new Loader({\n\t\turlResolver: new FakeUrlResolver(),\n\t\tdocumentServiceFactory: createLocalOdspDocumentServiceFactory(localOdspSnapshot),\n\t\tcodeLoader: await fluidFileConverter.getCodeLoader(logger),\n\t\tscope: await fluidFileConverter.getScope?.(logger),\n\t\tlogger,\n\t});\n\n\tconst container = await loader.resolve({\n\t\turl: \"/fakeUrl/\",\n\t\theaders: {\n\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t},\n\t});\n\n\treturn PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () => {\n\t\tconst result = await fluidFileConverter.execute(container, options);\n\t\tcontainer.close();\n\t\treturn result;\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeUrlResolver.d.ts","sourceRoot":"","sources":["../src/fakeUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"fakeUrlResolver.d.ts","sourceRoot":"","sources":["../src/fakeUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACN,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAM5C;;;GAGG;AACH,qBAAa,eAAgB,YAAW,YAAY;IACtC,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAyB9D,cAAc,CAC1B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,MAAM,EACpB,kBAAkB,CAAC,EAAE,qBAAqB,GACxC,OAAO,CAAC,MAAM,CAAC;CAGlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fakeUrlResolver.js","sourceRoot":"","sources":["../src/fakeUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"fakeUrlResolver.js","sourceRoot":"","sources":["../src/fakeUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACjC,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC;;;GAGG;AACH,MAAa,eAAe;IACpB,KAAK,CAAC,OAAO,CAAC,QAAkB;QACtC,MAAM,mBAAmB,GAAqB;YAC7C,IAAI,EAAE,OAAO;YACb,eAAe,EAAE,IAAI;YACrB,EAAE,EAAE,MAAM;YACV,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,OAAO;YACZ,gBAAgB,EAAE,MAAM;YACxB,SAAS,EAAE;gBACV,kBAAkB,EAAE,OAAO;gBAC3B,wBAAwB,EAAE,OAAO;gBACjC,uBAAuB,EAAE,OAAO;gBAChC,eAAe,EAAE,OAAO;aACxB;YACD,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,KAAK;YACjB,WAAW,EAAE,MAAM;SACnB,CAAC;QAEF,OAAO,mBAAmB,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,cAAc,CAC1B,YAA0B,EAC1B,YAAoB,EACpB,kBAA0C;QAE1C,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AAjCD,0CAiCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions\";\n\nconst fakeId = \"FakeUrlResolver\";\nconst fakeUrl = \"/FakeUrlResolver/\";\n\n/**\n * Fake URL resolver that returns hard coded values on every request\n * @internal\n */\nexport class FakeUrlResolver implements IUrlResolver {\n\tpublic async resolve(_request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\tconst fakeOdspResolvedUrl: IOdspResolvedUrl = {\n\t\t\ttype: \"fluid\",\n\t\t\todspResolvedUrl: true,\n\t\t\tid: fakeId,\n\t\t\tsiteUrl: fakeUrl,\n\t\t\tdriveId: fakeId,\n\t\t\titemId: fakeId,\n\t\t\turl: fakeUrl,\n\t\t\thashedDocumentId: fakeId,\n\t\t\tendpoints: {\n\t\t\t\tsnapshotStorageUrl: fakeUrl,\n\t\t\t\tattachmentPOSTStorageUrl: fakeUrl,\n\t\t\t\tattachmentGETStorageUrl: fakeUrl,\n\t\t\t\tdeltaStorageUrl: fakeUrl,\n\t\t\t},\n\t\t\ttokens: {},\n\t\t\tfileName: fakeId,\n\t\t\tsummarizer: false,\n\t\t\tfileVersion: fakeId,\n\t\t};\n\n\t\treturn fakeOdspResolvedUrl;\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\t_resolvedUrl: IResolvedUrl,\n\t\t_relativeUrl: string,\n\t\t_packageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\treturn \"\";\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidRunner.d.ts","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"fluidRunner.d.ts","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,QA+FnE"}
|
package/dist/fluidRunner.js
CHANGED
|
@@ -42,7 +42,7 @@ function fluidRunner(fluidFileConverter) {
|
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
43
43
|
(yargs) => yargs
|
|
44
44
|
.option("codeLoader", {
|
|
45
|
-
describe:
|
|
45
|
+
describe: 'Path to code loader bundle. Required if this application is being called without modification.\nSee "README.md" for more details.',
|
|
46
46
|
type: "string",
|
|
47
47
|
demandOption: false,
|
|
48
48
|
})
|
|
@@ -67,13 +67,13 @@ function fluidRunner(fluidFileConverter) {
|
|
|
67
67
|
demandOption: false,
|
|
68
68
|
})
|
|
69
69
|
.option("telemetryFormat", {
|
|
70
|
-
describe:
|
|
70
|
+
describe: 'Output format for telemetry. Current options are: ["JSON", "CSV"]',
|
|
71
71
|
type: "string",
|
|
72
72
|
demandOption: false,
|
|
73
73
|
default: "JSON",
|
|
74
74
|
})
|
|
75
75
|
.option("telemetryProp", {
|
|
76
|
-
describe:
|
|
76
|
+
describe: 'Property to add to every telemetry entry. Formatted like "--telemetryProp prop1 value1 --telemetryProp prop2 \\"value 2\\"".',
|
|
77
77
|
type: "array",
|
|
78
78
|
demandOption: false,
|
|
79
79
|
}),
|
|
@@ -90,7 +90,8 @@ function fluidRunner(fluidFileConverter) {
|
|
|
90
90
|
process.exit(1);
|
|
91
91
|
}
|
|
92
92
|
const result = await (argv.codeLoader
|
|
93
|
-
? (0, parseBundleAndExportFile_1.parseBundleAndExportFile)(argv.codeLoader, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions)
|
|
93
|
+
? (0, parseBundleAndExportFile_1.parseBundleAndExportFile)(argv.codeLoader, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions)
|
|
94
|
+
: (0, exportFile_1.exportFile)(fluidFileConverter, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions));
|
|
94
95
|
if (!result.success) {
|
|
95
96
|
console.error(`${result.eventName}: ${result.errorMessage}`);
|
|
96
97
|
process.exit(1);
|
package/dist/fluidRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,6CAA0C;AAE1C,yEAAsE;AACtE,sDAAsD;AACtD,sDAAwE;AACxE,mCAAkD;AAElD;;GAEG;AACH,SAAgB,WAAW,CAAC,kBAAwC;
|
|
1
|
+
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,6CAA0C;AAE1C,yEAAsE;AACtE,sDAAsD;AACtD,sDAAwE;AACxE,mCAAkD;AAElD;;GAEG;AACH,SAAgB,WAAW,CAAC,kBAAwC;IACnE,oEAAoE;IACpE,KAAK;SACH,MAAM,EAAE;SACR,OAAO,CAAC,KAAK,CAAC;SACd,OAAO,CACP,YAAY,EACZ,8CAA8C;IAC9C,wDAAwD;IACxD,CAAC,KAAK,EAAE,EAAE,CACT,KAAK;SACH,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;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AC,UAAU,EACf,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,OAAO,EACZ,sBAAsB,CAAC,gBAAgB,CACtC,CAAC,CAAC;QAEN,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAChB;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CACD;SACA,IAAI,EAAE;SACN,aAAa,EAAE,CAAC,IAAI,CAAC;AACxB,CAAC;AA/FD,kCA+FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as yargs from \"yargs\";\nimport { exportFile } from \"./exportFile\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { parseBundleAndExportFile } from \"./parseBundleAndExportFile\";\n// eslint-disable-next-line import/no-internal-modules\nimport { validateAndParseTelemetryOptions } from \"./logger/loggerUtils\";\nimport { validateCommandLineArgs } from \"./utils\";\n\n/**\n * @param fluidFileConverter - needs to be provided if \"codeLoaderBundle\" is not and vice versa\n */\nexport function fluidRunner(fluidFileConverter?: IFluidFileConverter) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\tyargs\n\t\t.strict()\n\t\t.version(false)\n\t\t.command(\n\t\t\t\"exportFile\",\n\t\t\t\"Generate an output for a local ODSP snapshot\",\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\t\t(yargs) =>\n\t\t\t\tyargs\n\t\t\t\t\t.option(\"codeLoader\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Path to code loader bundle. Required if this application is being called without modification.\\nSee \"README.md\" for more details.',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"inputFile\", {\n\t\t\t\t\t\tdescribe: \"Path to local ODSP snapshot\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"outputFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of output file (cannot already exist).\\nExecution result will be written here\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of telemetry file for config and session data (cannot already exist)\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"options\", {\n\t\t\t\t\t\tdescribe: \"Additional options passed to container on execution\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFormat\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Output format for telemetry. Current options are: [\"JSON\", \"CSV\"]',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t\tdefault: \"JSON\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryProp\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Property to add to every telemetry entry. Formatted like \"--telemetryProp prop1 value1 --telemetryProp prop2 \\\\\"value 2\\\\\"\".',\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t}),\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises\n\t\t\tasync (argv) => {\n\t\t\t\tconst argsError = validateCommandLineArgs(argv.codeLoader, fluidFileConverter);\n\t\t\t\tif (argsError) {\n\t\t\t\t\tconsole.error(argsError);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tconst telemetryOptionsResult = validateAndParseTelemetryOptions(\n\t\t\t\t\targv.telemetryFormat,\n\t\t\t\t\targv.telemetryProp,\n\t\t\t\t);\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 )\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 ));\n\n\t\t\t\tif (!result.success) {\n\t\t\t\t\tconsole.error(`${result.eventName}: ${result.errorMessage}`);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t)\n\t\t.help()\n\t\t.demandCommand().argv;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getArgsValidationError.d.ts","sourceRoot":"","sources":["../src/getArgsValidationError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,wBAAgB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"getArgsValidationError.d.ts","sourceRoot":"","sources":["../src/getArgsValidationError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBhG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getArgsValidationError.js","sourceRoot":"","sources":["../src/getArgsValidationError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,SAAgB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"getArgsValidationError.js","sourceRoot":"","sources":["../src/getArgsValidationError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,SAAgB,sBAAsB,CAAC,SAAiB,EAAE,UAAkB;IAC3E,sBAAsB;IACtB,IAAI,CAAC,SAAS,EAAE;QACf,OAAO,sCAAsC,CAAC;KAC9C;SAAM,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QACrC,OAAO,4BAA4B,CAAC;KACpC;IAED,uBAAuB;IACvB,IAAI,CAAC,UAAU,EAAE;QAChB,OAAO,kCAAkC,CAAC;KAC1C;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QACrC,OAAO,+BAA+B,UAAU,IAAI,CAAC;KACrD;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAhBD,wDAgBC","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\nexport function getArgsValidationError(inputFile: string, outputFile: string): string | undefined {\n\t// Validate input file\n\tif (!inputFile) {\n\t\treturn \"Input file name argument is missing.\";\n\t} else if (!fs.existsSync(inputFile)) {\n\t\treturn \"Input file does not exist.\";\n\t}\n\n\t// Validate output file\n\tif (!outputFile) {\n\t\treturn \"Output file argument is missing.\";\n\t} else if (fs.existsSync(outputFile)) {\n\t\treturn `Output file already exists [${outputFile}].`;\n\t}\n\n\treturn undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/baseFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,8BAAsB,cAAe,YAAW,WAAW;
|
|
1
|
+
{"version":3,"file":"baseFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/baseFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,8BAAsB,cAAe,YAAW,WAAW;IAazD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACnC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM;IACzC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC;IAd1B,YAAY,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAEvC,0CAA0C;IAC1C,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,CAAM;IAC7B,SAAS,CAAC,gBAAgB,UAAS;IAEnC;;;;OAIG;gBAEiB,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,MAAW,EAC3B,YAAY,CAAC,6CAAiC;IAG3D,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;cAW7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAazB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseFileLogger.js","sourceRoot":"","sources":["../../src/logger/baseFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAIzB;;GAEG;AACH,MAAsB,cAAc;
|
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AAC,CAAC;aACjD;YACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;SAC7B;IACF,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;CACD;AA7CD,wCA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { IFileLogger } from \"./fileLogger\";\n\n/**\n * @internal\n */\nexport abstract class BaseFileLogger implements IFileLogger {\n\tpublic supportsTags?: true | undefined;\n\n\t/** Hold events in memory until flushed */\n\tprotected events: any[] = [];\n\tprotected hasWrittenToFile = false;\n\n\t/**\n\t * @param filePath - file path to write logs to\n\t * @param eventsPerFlush - number of events per flush\n\t * @param defaultProps - default properties to add to every telemetry event\n\t */\n\tpublic constructor(\n\t\tprotected readonly filePath: string,\n\t\tprotected readonly eventsPerFlush: number = 50,\n\t\tprotected readonly defaultProps?: Record<string, string | number>,\n\t) {}\n\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\t// eslint-disable-next-line no-param-reassign\n\t\tevent = { ...event, ...this.defaultProps };\n\t\tthis.events.push(event);\n\n\t\tif (this.events.length >= this.eventsPerFlush || event.category === \"error\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\tthis.flush();\n\t\t}\n\t}\n\n\tprotected async flush(): Promise<void> {\n\t\tif (this.events.length > 0) {\n\t\t\tconst contentToWrite = this.events.map((it) => JSON.stringify(it)).join(\",\");\n\t\t\tif (this.hasWrittenToFile) {\n\t\t\t\tfs.appendFileSync(this.filePath, `,${contentToWrite}`);\n\t\t\t} else {\n\t\t\t\tfs.appendFileSync(this.filePath, contentToWrite);\n\t\t\t}\n\t\t\tthis.events = [];\n\t\t\tthis.hasWrittenToFile = true;\n\t\t}\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait this.flush();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csvFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"csvFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,qBAAa,aAAc,SAAQ,cAAc;IAChD,wDAAwD;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;cAErB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAQhC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CASnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csvFileLogger.js","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,uCAAiC;AAEjC,qDAAkD;AAElD;;;GAGG;AACH,MAAa,aAAc,SAAQ,+BAAc;IAAjD;;
|
|
1
|
+
{"version":3,"file":"csvFileLogger.js","sourceRoot":"","sources":["../../src/logger/csvFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,uCAAiC;AAEjC,qDAAkD;AAElD;;;GAGG;AACH,MAAa,aAAc,SAAQ,+BAAc;IAAjD;;QACC,wDAAwD;QACvC,YAAO,GAAG,IAAI,GAAG,EAAE,CAAC;IAuBtC,CAAC;IArBU,KAAK,CAAC,KAAK;QACpB,yFAAyF;IAC1F,CAAC;IAEM,IAAI,CAAC,KAA0B;QACrC,8DAA8D;QAC9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACvB;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,8DAA8D;QAC9D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAA,gBAAK,EAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;CACD;AAzBD,sCAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { parse } from \"json2csv\";\nimport { ITelemetryBaseEvent } from \"@fluidframework/common-definitions\";\nimport { BaseFileLogger } from \"./baseFileLogger\";\n\n/**\n * FileLogger that writes events into a defined CSV file\n * @internal\n */\nexport class CSVFileLogger extends BaseFileLogger {\n\t/** Store the column names to write as the CSV header */\n\tprivate readonly columns = new Set();\n\n\tprotected async flush(): Promise<void> {\n\t\t// No flushing is performed since we need all log entries to determine set of CSV columns\n\t}\n\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const prop in event) {\n\t\t\tthis.columns.add(prop);\n\t\t}\n\t\tsuper.send(event);\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait super.close();\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const field in this.defaultProps) {\n\t\t\tthis.columns.add(field);\n\t\t}\n\n\t\tfs.writeFileSync(this.filePath, parse(this.events, Array.from(this.columns)));\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;
|
|
1
|
+
{"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACxD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,YAAY;IACvB,IAAI,IAAA;IACJ,GAAG,IAAA;CACH;AAGD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,iFAAiF;IACjF,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAE/C,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;
|
|
1
|
+
{"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAoBD,gCAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\n\n/**\n * Contract for logger that writes telemetry to a file\n * @internal\n */\nexport interface IFileLogger extends ITelemetryBaseLogger {\n\t/**\n\t * This method acts as a \"dispose\" and should be explicitly called at the end of execution\n\t */\n\tclose(): Promise<void>;\n}\n\n/**\n * Desired output format for the telemetry\n */\nexport enum OutputFormat {\n\tJSON,\n\tCSV,\n}\n\n/* eslint-disable tsdoc/syntax */\n/**\n * Options to provide upon creation of IFileLogger\n * @internal\n */\nexport interface ITelemetryOptions {\n\t/** Desired output format used to create a specific IFileLogger implementation */\n\toutputFormat?: OutputFormat;\n\n\t/**\n\t * Properties that should be added to every telemetry event\n\t * Example: { \"prop1\": \"value1\", \"prop2\": 10.0 }\n\t */\n\tdefaultProps?: Record<string, string | number>;\n\n\t/** Number of telemetry events per flush to telemetry file */\n\teventsPerFlush?: number;\n}\n/* eslint-enable tsdoc/syntax */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/jsonFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,qBAAa,cAAe,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"jsonFileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/jsonFileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,qBAAa,cAAe,SAAQ,cAAc;gBAEhD,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,MAAW,EAC3B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAMlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAInC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonFileLogger.js","sourceRoot":"","sources":["../../src/logger/jsonFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qDAAkD;AAElD;;;GAGG;AACH,MAAa,cAAe,SAAQ,+BAAc;
|
|
1
|
+
{"version":3,"file":"jsonFileLogger.js","sourceRoot":"","sources":["../../src/logger/jsonFileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qDAAkD;AAElD;;;GAGG;AACH,MAAa,cAAe,SAAQ,+BAAc;IACjD,YACC,QAAgB,EAChB,iBAAyB,EAAE,EAC3B,YAA8C;QAE9C,KAAK,CAAC,QAAQ,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;QAC9C,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAEM,KAAK,CAAC,KAAK;QACjB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;CACD;AAdD,wCAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { BaseFileLogger } from \"./baseFileLogger\";\n\n/**\n * FileLogger that writes events into a defined CSV file\n * @internal\n */\nexport class JSONFileLogger extends BaseFileLogger {\n\tconstructor(\n\t\tfilePath: string,\n\t\teventsPerFlush: number = 50,\n\t\tdefaultProps?: Record<string, string | number>,\n\t) {\n\t\tsuper(filePath, eventsPerFlush, defaultProps);\n\t\tfs.appendFileSync(this.filePath, \"[\");\n\t}\n\n\tpublic async close(): Promise<void> {\n\t\tawait super.close();\n\t\tfs.appendFileSync(this.filePath, \"]\");\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAgB,MAAM,cAAc,CAAC;AAG5E;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"loggerUtils.d.ts","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAgB,MAAM,cAAc,CAAC;AAG5E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,GACzB;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,UAAU,EAAE,WAAW,CAAA;CAAE,CAWvD;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQzF;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,MAAM,CAAC,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GACzB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,gBAAgB,EAAE,iBAAiB,CAAA;CAAE,CA8B5F"}
|
|
@@ -40,7 +40,9 @@ function createLogger(filePath, options) {
|
|
|
40
40
|
const fileLogger = (options === null || options === void 0 ? void 0 : options.outputFormat) === fileLogger_1.OutputFormat.CSV
|
|
41
41
|
? new csvFileLogger_1.CSVFileLogger(filePath, options === null || options === void 0 ? void 0 : options.eventsPerFlush, options === null || options === void 0 ? void 0 : options.defaultProps)
|
|
42
42
|
: new jsonFileLogger_1.JSONFileLogger(filePath, options === null || options === void 0 ? void 0 : options.eventsPerFlush, options === null || options === void 0 ? void 0 : options.defaultProps);
|
|
43
|
-
const logger = telemetry_utils_1.ChildLogger.create(fileLogger, "LocalSnapshotRunnerApp", {
|
|
43
|
+
const logger = telemetry_utils_1.ChildLogger.create(fileLogger, "LocalSnapshotRunnerApp", {
|
|
44
|
+
all: { Event_Time: () => Date.now() },
|
|
45
|
+
});
|
|
44
46
|
return { logger, fileLogger };
|
|
45
47
|
}
|
|
46
48
|
exports.createLogger = createLogger;
|
|
@@ -75,11 +77,17 @@ function validateAndParseTelemetryOptions(format, props) {
|
|
|
75
77
|
}
|
|
76
78
|
if (props && props.length > 0) {
|
|
77
79
|
if (props.length % 2 !== 0) {
|
|
78
|
-
return {
|
|
80
|
+
return {
|
|
81
|
+
success: false,
|
|
82
|
+
error: `Invalid number of telemetry properties to add [${props.length}]`,
|
|
83
|
+
};
|
|
79
84
|
}
|
|
80
85
|
for (let i = 0; i < props.length; i += 2) {
|
|
81
86
|
if (typeof props[i] === "number") {
|
|
82
|
-
return {
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
error: `Property name cannot be number at index [${i}] -> [${props[i]}]`,
|
|
90
|
+
};
|
|
83
91
|
}
|
|
84
92
|
defaultProps[props[i]] = props[i + 1];
|
|
85
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,qEAA8D;AAC9D,mDAAgD;AAChD,6CAA4E;AAC5E,qDAAkD;AAElD;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"loggerUtils.js","sourceRoot":"","sources":["../../src/logger/loggerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,qEAA8D;AAC9D,mDAAgD;AAChD,6CAA4E;AAC5E,qDAAkD;AAElD;;;;;;GAMG;AACH,SAAgB,YAAY,CAC3B,QAAgB,EAChB,OAA2B;IAE3B,MAAM,UAAU,GACf,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,MAAK,yBAAY,CAAC,GAAG;QACzC,CAAC,CAAC,IAAI,6BAAa,CAAC,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC;QAC7E,CAAC,CAAC,IAAI,+BAAc,CAAC,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAC,CAAC;IAEjF,MAAM,MAAM,GAAG,6BAAW,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,EAAE;QACvE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE;KACrC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAdD,oCAcC;AAED;;;GAGG;AACH,SAAgB,+BAA+B,CAAC,aAAqB;IACpE,IAAI,CAAC,aAAa,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AC;AAC5E,CAAC;AAjCD,4EAiCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { ChildLogger } from \"@fluidframework/telemetry-utils\";\nimport { CSVFileLogger } from \"./csvFileLogger\";\nimport { IFileLogger, ITelemetryOptions, OutputFormat } from \"./fileLogger\";\nimport { JSONFileLogger } from \"./jsonFileLogger\";\n\n/**\n * Create a ITelemetryLogger wrapped around provided IFileLogger\n * ! It is expected that all events be sent through the returned \"logger\" value\n * ! The \"fileLogger\" value should have its \"close()\" method called at the end of execution\n * Note: if an output format is not supplied, default is JSON\n * @returns - both the IFileLogger implementation and ITelemetryLogger wrapper to be called\n */\nexport function createLogger(\n\tfilePath: string,\n\toptions?: ITelemetryOptions,\n): { logger: ITelemetryLogger; fileLogger: IFileLogger } {\n\tconst fileLogger =\n\t\toptions?.outputFormat === OutputFormat.CSV\n\t\t\t? new CSVFileLogger(filePath, options?.eventsPerFlush, options?.defaultProps)\n\t\t\t: new JSONFileLogger(filePath, options?.eventsPerFlush, options?.defaultProps);\n\n\tconst logger = ChildLogger.create(fileLogger, \"LocalSnapshotRunnerApp\", {\n\t\tall: { Event_Time: () => Date.now() },\n\t});\n\n\treturn { logger, fileLogger };\n}\n\n/**\n * Validate the telemetryFile command line argument\n * @param telemetryFile - path where telemetry will be written\n */\nexport function getTelemetryFileValidationError(telemetryFile: string): string | undefined {\n\tif (!telemetryFile) {\n\t\treturn \"Telemetry file argument is missing.\";\n\t} else if (fs.existsSync(telemetryFile)) {\n\t\treturn `Telemetry file already exists [${telemetryFile}].`;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Validate the provided output format and default properties\n * @param format - desired output format of the telemetry\n * @param props - default properties to be added to every telemetry entry\n * @internal\n */\nexport function validateAndParseTelemetryOptions(\n\tformat?: string,\n\tprops?: (string | number)[],\n): { success: false; error: string } | { success: true; telemetryOptions: ITelemetryOptions } {\n\tlet outputFormat: OutputFormat | undefined;\n\tconst defaultProps: Record<string, string | number> = {};\n\n\tif (format) {\n\t\toutputFormat = OutputFormat[format];\n\t\tif (outputFormat === undefined) {\n\t\t\treturn { success: false, error: `Invalid telemetry format [${format}]` };\n\t\t}\n\t}\n\n\tif (props && props.length > 0) {\n\t\tif (props.length % 2 !== 0) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: `Invalid number of telemetry properties to add [${props.length}]`,\n\t\t\t};\n\t\t}\n\t\tfor (let i = 0; i < props.length; i += 2) {\n\t\t\tif (typeof props[i] === \"number\") {\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: `Property name cannot be number at index [${i}] -> [${props[i]}]`,\n\t\t\t\t};\n\t\t\t}\n\t\t\tdefaultProps[props[i]] = props[i + 1];\n\t\t}\n\t}\n\n\treturn { success: true, telemetryOptions: { outputFormat, defaultProps } };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBundleAndExportFile.d.ts","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAG9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAOxD;;;GAGG;AACH,wBAAsB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"parseBundleAndExportFile.d.ts","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAG9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAOxD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC7C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,mBAAmB,CAAC,CA0D9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAmE;AACnE,yDAA8E;AAC9E,6CAA8E;AAC9E,qEAAkE;AAGlE,sDAAqF;AACrF,8CAA8C;AAC9C,mCAAiD;AAEjD,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,wBAAwB,
|
|
1
|
+
{"version":3,"file":"parseBundleAndExportFile.js","sourceRoot":"","sources":["../src/parseBundleAndExportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAmE;AACnE,yDAA8E;AAC9E,6CAA8E;AAC9E,qEAAkE;AAGlE,sDAAqF;AACrF,8CAA8C;AAC9C,mCAAiD;AAEjD,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,wBAAwB,CAC7C,UAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAAoC;IAEpC,MAAM,iBAAiB,GAAG,IAAA,6CAA+B,EAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAAiB,EAAE;QACtB,MAAM,SAAS,GAAG,yBAAyB,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;KACtE;IACD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAA,0BAAY,EAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAE7E,I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CAAyB,EAC9B,IAAA,8BAAsB,EAAC,SAAS,CAAC,EACjC,WAAW,EACX,MAAM,EACN,OAAO,CACP,CACD,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1B,CAAC,CACD,CAAC;KACF;IAAC,OAAO,KAAK,EAAE;QACf,MAAM,SAAS,GAAG,wBAAwB,CAAC;QAC3C,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC;KAC9E;YAAS;QACT,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;KACzB;AACF,CAAC;AAjED,4DAiEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as fs from \"fs\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { isCodeLoaderBundle, isFluidFileConverter } from \"./codeLoaderBundle\";\nimport { createContainerAndExecute, IExportFileResponse } from \"./exportFile\";\nimport { getArgsValidationError } from \"./getArgsValidationError\";\n/* eslint-disable import/no-internal-modules */\nimport { ITelemetryOptions } from \"./logger/fileLogger\";\nimport { createLogger, getTelemetryFileValidationError } from \"./logger/loggerUtils\";\n/* eslint-enable import/no-internal-modules */\nimport { getSnapshotFileContent } from \"./utils\";\n\nconst clientArgsValidationError = \"Client_ArgsValidationError\";\n\n/**\n * Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file\n * @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)\n */\nexport async function parseBundleAndExportFile(\n\tcodeLoader: string,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ParseBundleAndExportFile\" },\n\t\t\tasync () => {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\n\t\t\t\tconst codeLoaderBundle = require(codeLoader);\n\t\t\t\tif (!isCodeLoaderBundle(codeLoaderBundle)) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tconst errorMessage = \"Code loader bundle is not of type ICodeLoaderBundle\";\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: errorMessage });\n\t\t\t\t\treturn { success: false, eventName, errorMessage };\n\t\t\t\t}\n\n\t\t\t\tconst fluidExport = await codeLoaderBundle.fluidExport;\n\t\t\t\tif (!isFluidFileConverter(fluidExport)) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\"Fluid export from CodeLoaderBundle is not of type IFluidFileConverter\";\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: errorMessage });\n\t\t\t\t\treturn { success: false, eventName, errorMessage };\n\t\t\t\t}\n\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile);\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),\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"]}
|