@fluidframework/fluid-runner 2.0.0-dev.1.3.0.96595
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 +18 -0
- package/.mocharc.js +12 -0
- package/LICENSE +21 -0
- package/README.md +68 -0
- package/bin/fluid-runner +2 -0
- package/dist/codeLoaderBundle.d.ts +44 -0
- package/dist/codeLoaderBundle.d.ts.map +1 -0
- package/dist/codeLoaderBundle.js +23 -0
- package/dist/codeLoaderBundle.js.map +1 -0
- package/dist/exportFile.d.ts +28 -0
- package/dist/exportFile.d.ts.map +1 -0
- package/dist/exportFile.js +87 -0
- package/dist/exportFile.js.map +1 -0
- package/dist/fakeUrlResolver.d.ts +15 -0
- package/dist/fakeUrlResolver.d.ts.map +1 -0
- package/dist/fakeUrlResolver.js +43 -0
- package/dist/fakeUrlResolver.js.map +1 -0
- package/dist/fluidRunner.d.ts +10 -0
- package/dist/fluidRunner.d.ts.map +1 -0
- package/dist/fluidRunner.js +106 -0
- package/dist/fluidRunner.js.map +1 -0
- package/dist/getArgsValidationError.d.ts +6 -0
- package/dist/getArgsValidationError.d.ts.map +1 -0
- package/dist/getArgsValidationError.js +46 -0
- package/dist/getArgsValidationError.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/baseFileLogger.d.ts +28 -0
- package/dist/logger/baseFileLogger.d.ts.map +1 -0
- package/dist/logger/baseFileLogger.js +72 -0
- package/dist/logger/baseFileLogger.js.map +1 -0
- package/dist/logger/csvFileLogger.d.ts +18 -0
- package/dist/logger/csvFileLogger.d.ts.map +1 -0
- package/dist/logger/csvFileLogger.js +60 -0
- package/dist/logger/csvFileLogger.js.map +1 -0
- package/dist/logger/fileLogger.d.ts +38 -0
- package/dist/logger/fileLogger.d.ts.map +1 -0
- package/dist/logger/fileLogger.js +17 -0
- package/dist/logger/fileLogger.js.map +1 -0
- package/dist/logger/jsonFileLogger.d.ts +14 -0
- package/dist/logger/jsonFileLogger.d.ts.map +1 -0
- package/dist/logger/jsonFileLogger.js +44 -0
- package/dist/logger/jsonFileLogger.js.map +1 -0
- package/dist/logger/loggerUtils.d.ts +36 -0
- package/dist/logger/loggerUtils.d.ts.map +1 -0
- package/dist/logger/loggerUtils.js +90 -0
- package/dist/logger/loggerUtils.js.map +1 -0
- package/dist/packageVersion.d.ts +9 -0
- package/dist/packageVersion.d.ts.map +1 -0
- package/dist/packageVersion.js +12 -0
- package/dist/packageVersion.js.map +1 -0
- package/dist/parseBundleAndExportFile.d.ts +12 -0
- package/dist/parseBundleAndExportFile.d.ts.map +1 -0
- package/dist/parseBundleAndExportFile.js +84 -0
- package/dist/parseBundleAndExportFile.js.map +1 -0
- package/dist/utils.d.ts +24 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +63 -0
- package/dist/utils.js.map +1 -0
- package/lib/codeLoaderBundle.d.ts +44 -0
- package/lib/codeLoaderBundle.d.ts.map +1 -0
- package/lib/codeLoaderBundle.js +18 -0
- package/lib/codeLoaderBundle.js.map +1 -0
- package/lib/exportFile.d.ts +28 -0
- package/lib/exportFile.d.ts.map +1 -0
- package/lib/exportFile.js +63 -0
- package/lib/exportFile.js.map +1 -0
- package/lib/fakeUrlResolver.d.ts +15 -0
- package/lib/fakeUrlResolver.d.ts.map +1 -0
- package/lib/fakeUrlResolver.js +39 -0
- package/lib/fakeUrlResolver.js.map +1 -0
- package/lib/fluidRunner.d.ts +10 -0
- package/lib/fluidRunner.d.ts.map +1 -0
- package/lib/fluidRunner.js +83 -0
- package/lib/fluidRunner.js.map +1 -0
- package/lib/getArgsValidationError.d.ts +6 -0
- package/lib/getArgsValidationError.d.ts.map +1 -0
- package/lib/getArgsValidationError.js +23 -0
- package/lib/getArgsValidationError.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib/logger/baseFileLogger.d.ts +28 -0
- package/lib/logger/baseFileLogger.d.ts.map +1 -0
- package/lib/logger/baseFileLogger.js +49 -0
- package/lib/logger/baseFileLogger.js.map +1 -0
- package/lib/logger/csvFileLogger.d.ts +18 -0
- package/lib/logger/csvFileLogger.d.ts.map +1 -0
- package/lib/logger/csvFileLogger.js +37 -0
- package/lib/logger/csvFileLogger.js.map +1 -0
- package/lib/logger/fileLogger.d.ts +38 -0
- package/lib/logger/fileLogger.d.ts.map +1 -0
- package/lib/logger/fileLogger.js +14 -0
- package/lib/logger/fileLogger.js.map +1 -0
- package/lib/logger/jsonFileLogger.d.ts +14 -0
- package/lib/logger/jsonFileLogger.d.ts.map +1 -0
- package/lib/logger/jsonFileLogger.js +21 -0
- package/lib/logger/jsonFileLogger.js.map +1 -0
- package/lib/logger/loggerUtils.d.ts +36 -0
- package/lib/logger/loggerUtils.d.ts.map +1 -0
- package/lib/logger/loggerUtils.js +65 -0
- package/lib/logger/loggerUtils.js.map +1 -0
- package/lib/packageVersion.d.ts +9 -0
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/packageVersion.js +9 -0
- package/lib/packageVersion.js.map +1 -0
- package/lib/parseBundleAndExportFile.d.ts +12 -0
- package/lib/parseBundleAndExportFile.d.ts.map +1 -0
- package/lib/parseBundleAndExportFile.js +61 -0
- package/lib/parseBundleAndExportFile.js.map +1 -0
- package/lib/utils.d.ts +24 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +38 -0
- package/lib/utils.js.map +1 -0
- package/package.json +87 -0
- package/src/codeLoaderBundle.ts +57 -0
- package/src/exportFile.ts +104 -0
- package/src/fakeUrlResolver.ts +50 -0
- package/src/fluidRunner.ts +106 -0
- package/src/getArgsValidationError.ts +27 -0
- package/src/index.ts +14 -0
- package/src/logger/baseFileLogger.ts +58 -0
- package/src/logger/csvFileLogger.ts +40 -0
- package/src/logger/fileLogger.ts +45 -0
- package/src/logger/jsonFileLogger.ts +27 -0
- package/src/logger/loggerUtils.ts +81 -0
- package/src/packageVersion.ts +9 -0
- package/src/parseBundleAndExportFile.ts +80 -0
- package/src/utils.ts +45 -0
- package/tsconfig.esnext.json +7 -0
- package/tsconfig.json +14 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
"extends": [
|
|
8
|
+
require.resolve("@fluidframework/eslint-config-fluid")
|
|
9
|
+
],
|
|
10
|
+
"parserOptions": {
|
|
11
|
+
"project": ["./tsconfig.json", "./src/test/tsconfig.json"]
|
|
12
|
+
},
|
|
13
|
+
"rules": {
|
|
14
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
15
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
16
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
17
|
+
}
|
|
18
|
+
}
|
package/.mocharc.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const getFluidTestMochaConfig = require('@fluidframework/mocha-test-setup/mocharc-common');
|
|
9
|
+
|
|
10
|
+
const packageDir = __dirname;
|
|
11
|
+
const config = getFluidTestMochaConfig(packageDir);
|
|
12
|
+
module.exports = config;
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @fluidframework/fluid-runner
|
|
2
|
+
This package contains utility for running various functionality inside a Fluid Framework environment.
|
|
3
|
+
|
|
4
|
+
## Export File
|
|
5
|
+
Allows some execution to be made on a container given a provided ODSP snapshot.
|
|
6
|
+
|
|
7
|
+
### Sample command
|
|
8
|
+
If package is installed globally:
|
|
9
|
+
`node fluid-runner exportFile --codeLoader=compiledBundle.js --inputFile=inputFileName.fluid --outputFile=result.txt --telemetryFile=telemetryFile.txt`
|
|
10
|
+
|
|
11
|
+
If working directly on this package:
|
|
12
|
+
```node bin/fluid-runner exportFile --codeLoader=compiledBundle.js --inputFile=inputFileName.fluid --outputFile=result.txt --telemetryFile=telemetryFile.txt```
|
|
13
|
+
|
|
14
|
+
### Code Loader bundle format
|
|
15
|
+
The Code Loader bundle should provide defined exports required for this functionality.
|
|
16
|
+
For more details on what exports are needed, see [codeLoaderBundle.ts](./src/codeLoaderBundle.ts).
|
|
17
|
+
|
|
18
|
+
#### "codeLoader" vs "IFluidFileConverter" argument
|
|
19
|
+
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
|
+
and provide a [`IFluidFileConverter`](./src/codeLoaderBundle.ts) implementation to the [`fluidRunner(...)`](./src/fluidRunner.ts) method.
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
import { fluidRunner } from "@fluidframework/fluid-runner";
|
|
24
|
+
|
|
25
|
+
fluidRunner({ /* IFluidFileConverter implementation here */ });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> **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
|
+
|
|
30
|
+
### Input file format
|
|
31
|
+
The input file is expected to be an ODSP snapshot.
|
|
32
|
+
For some examples, see the files in the [localOdspSnapshots folder](./src/test/localOdspSnapshots).
|
|
33
|
+
|
|
34
|
+
### Telemetry format
|
|
35
|
+
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
|
+
The default format is currently `JSON`
|
|
37
|
+
|
|
38
|
+
### Additional telemetry properties
|
|
39
|
+
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
|
+
- every key must be a string
|
|
41
|
+
- values may be either a string or a number
|
|
42
|
+
- a value may not be empty
|
|
43
|
+
|
|
44
|
+
Example of valid usages:
|
|
45
|
+
```
|
|
46
|
+
--telemetryProp prop1 value1 --telemetryProp prop2 10.5
|
|
47
|
+
--telemetryProp " prop1 " " value1 " prop2 value2
|
|
48
|
+
--telemetryProp=prop1 value1 --telemetryProp prop2 value2
|
|
49
|
+
--telemetryProp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Example of invalid usages:
|
|
53
|
+
```
|
|
54
|
+
--telemetryProp "10" value1
|
|
55
|
+
--telemetryProp prop1
|
|
56
|
+
--telemetryProp= // this will be treated as ['']
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Consumption
|
|
60
|
+
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:
|
|
61
|
+
- [`createLogger(...)`](./src/logger/fileLogger.ts)
|
|
62
|
+
- Creates and wraps an `IFileLogger` and adds some useful telemetry data to every entry
|
|
63
|
+
- [`createContainerAndExecute(...)`](./src/exportFile.ts)
|
|
64
|
+
- This is the core logic for running some action based on a local ODSP snapshot
|
|
65
|
+
- [`getSnapshotFileContent(...)`](./src/utils.ts)
|
|
66
|
+
- Reads a local ODSP snapshot from both JSON and binary formats for usage in `createContainerAndExecute(...)`
|
|
67
|
+
|
|
68
|
+
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
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ITelemetryBaseLogger } from "@fluidframework/common-definitions";
|
|
6
|
+
import { ICodeDetailsLoader, IContainer } from "@fluidframework/container-definitions";
|
|
7
|
+
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
8
|
+
/**
|
|
9
|
+
* Contract that defines the necessary exports for the bundle provided at runtime
|
|
10
|
+
* For an example, see "src/test/sampleCodeLoaders/sampleCodeLoader.ts"
|
|
11
|
+
*/
|
|
12
|
+
export interface ICodeLoaderBundle {
|
|
13
|
+
/**
|
|
14
|
+
* Fluid export of all the required objects and functions
|
|
15
|
+
*/
|
|
16
|
+
fluidExport: Promise<IFluidFileConverter>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Instance that holds all the details for Fluid file conversion
|
|
20
|
+
*/
|
|
21
|
+
export interface IFluidFileConverter {
|
|
22
|
+
/**
|
|
23
|
+
* Get code loader details to provide at Loader creation
|
|
24
|
+
* @param logger - created logger object to pass to code loader
|
|
25
|
+
*/
|
|
26
|
+
getCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;
|
|
27
|
+
/**
|
|
28
|
+
* Scope object to provide at Loader creation
|
|
29
|
+
*/
|
|
30
|
+
scope?: FluidObject;
|
|
31
|
+
/**
|
|
32
|
+
* Executes code on container and returns the result
|
|
33
|
+
* @param container - container created by this application
|
|
34
|
+
* @param options - additional options
|
|
35
|
+
*/
|
|
36
|
+
execute(container: IContainer, options?: string): Promise<string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Type cast to ensure necessary methods are present in the provided bundle
|
|
40
|
+
* @param bundle - bundle provided to this application
|
|
41
|
+
*/
|
|
42
|
+
export declare function isCodeLoaderBundle(bundle: any): bundle is ICodeLoaderBundle;
|
|
43
|
+
export declare function isFluidFileConverter(obj: any): obj is IFluidFileConverter;
|
|
44
|
+
//# sourceMappingURL=codeLoaderBundle.d.ts.map
|
|
@@ -0,0 +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;IAC9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzE;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACrE;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,CAIzE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.isFluidFileConverter = exports.isCodeLoaderBundle = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Type cast to ensure necessary methods are present in the provided bundle
|
|
10
|
+
* @param bundle - bundle provided to this application
|
|
11
|
+
*/
|
|
12
|
+
function isCodeLoaderBundle(bundle) {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
14
|
+
return (bundle === null || bundle === void 0 ? void 0 : bundle.fluidExport) && typeof bundle.fluidExport === "object";
|
|
15
|
+
}
|
|
16
|
+
exports.isCodeLoaderBundle = isCodeLoaderBundle;
|
|
17
|
+
function isFluidFileConverter(obj) {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
19
|
+
return (obj === null || obj === void 0 ? void 0 : obj.getCodeLoader) && typeof obj.getCodeLoader === "function"
|
|
20
|
+
&& obj.execute && typeof obj.execute === "function";
|
|
21
|
+
}
|
|
22
|
+
exports.isFluidFileConverter = isFluidFileConverter;
|
|
23
|
+
//# sourceMappingURL=codeLoaderBundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwCH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC1C,+DAA+D;IAC/D,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACzE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IACzC,+DAA+D;IAC/D,OAAO,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa,KAAI,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU;WAC7D,GAAG,CAAC,OAAO,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,UAAU,CAAC;AAC5D,CAAC;AAJD,oDAIC","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 /**\n * Fluid export of all the required objects and functions\n */\n fluidExport: Promise<IFluidFileConverter>;\n}\n\n/**\n * Instance that holds all the details for Fluid file conversion\n */\nexport interface IFluidFileConverter {\n /**\n * Get code loader details to provide at Loader creation\n * @param logger - created logger object to pass to code loader\n */\n getCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;\n\n /**\n * Scope object to provide at Loader creation\n */\n scope?: FluidObject;\n\n /**\n * Executes code on container and returns the result\n * @param container - container created by this application\n * @param options - additional options\n */\n execute(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 // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return bundle?.fluidExport && typeof bundle.fluidExport === \"object\";\n}\n\nexport function isFluidFileConverter(obj: any): obj is IFluidFileConverter {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return obj?.getCodeLoader && typeof obj.getCodeLoader === \"function\"\n && obj.execute && typeof obj.execute === \"function\";\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
|
+
import { IFluidFileConverter } from "./codeLoaderBundle";
|
|
7
|
+
import { ITelemetryOptions } from "./logger/fileLogger";
|
|
8
|
+
export declare type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
|
|
9
|
+
interface IExportFileResponseSuccess {
|
|
10
|
+
success: true;
|
|
11
|
+
}
|
|
12
|
+
interface IExportFileResponseFailure {
|
|
13
|
+
success: false;
|
|
14
|
+
eventName: string;
|
|
15
|
+
errorMessage: string;
|
|
16
|
+
error?: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Execute code on Container based on ODSP snapshot and write result to file
|
|
20
|
+
*/
|
|
21
|
+
export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions): Promise<IExportFileResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Create the container based on an ODSP snapshot and execute code on it
|
|
24
|
+
* @returns result of execution
|
|
25
|
+
*/
|
|
26
|
+
export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLogger, options?: string): Promise<string>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=exportFile.d.ts.map
|
|
@@ -0,0 +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;IAChC,OAAO,EAAE,IAAI,CAAC;CACjB;AAED,UAAU,0BAA0B;IAChC,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;CACf;AAID;;GAEG;AACH,wBAAsB,UAAU,CAC5B,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,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAiC9B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC3C,iBAAiB,EAAE,MAAM,GAAG,UAAU,EACtC,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createContainerAndExecute = exports.exportFile = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const container_definitions_1 = require("@fluidframework/container-definitions");
|
|
29
|
+
const container_loader_1 = require("@fluidframework/container-loader");
|
|
30
|
+
const odsp_driver_1 = require("@fluidframework/odsp-driver");
|
|
31
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
32
|
+
const getArgsValidationError_1 = require("./getArgsValidationError");
|
|
33
|
+
const fakeUrlResolver_1 = require("./fakeUrlResolver");
|
|
34
|
+
const utils_1 = require("./utils");
|
|
35
|
+
const loggerUtils_1 = require("./logger/loggerUtils");
|
|
36
|
+
const clientArgsValidationError = "Client_ArgsValidationError";
|
|
37
|
+
/**
|
|
38
|
+
* Execute code on Container based on ODSP snapshot and write result to file
|
|
39
|
+
*/
|
|
40
|
+
async function exportFile(fluidFileConverter, inputFile, outputFile, telemetryFile, options, telemetryOptions) {
|
|
41
|
+
const telemetryArgError = (0, loggerUtils_1.getTelemetryFileValidationError)(telemetryFile);
|
|
42
|
+
if (telemetryArgError) {
|
|
43
|
+
const eventName = clientArgsValidationError;
|
|
44
|
+
return { success: false, eventName, errorMessage: telemetryArgError };
|
|
45
|
+
}
|
|
46
|
+
const { fileLogger, logger } = (0, loggerUtils_1.createLogger)(telemetryFile, telemetryOptions);
|
|
47
|
+
try {
|
|
48
|
+
return await telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "ExportFile" }, async () => {
|
|
49
|
+
const argsValidationError = (0, getArgsValidationError_1.getArgsValidationError)(inputFile, outputFile);
|
|
50
|
+
if (argsValidationError) {
|
|
51
|
+
const eventName = clientArgsValidationError;
|
|
52
|
+
logger.sendErrorEvent({ eventName, message: argsValidationError });
|
|
53
|
+
return { success: false, eventName, errorMessage: argsValidationError };
|
|
54
|
+
}
|
|
55
|
+
fs.writeFileSync(outputFile, await createContainerAndExecute((0, utils_1.getSnapshotFileContent)(inputFile), fluidFileConverter, logger, options));
|
|
56
|
+
return { success: true };
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const eventName = "Client_UnexpectedError";
|
|
61
|
+
logger.sendErrorEvent({ eventName }, error);
|
|
62
|
+
return { success: false, eventName, errorMessage: "Unexpected error", error };
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
await fileLogger.close();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.exportFile = exportFile;
|
|
69
|
+
/**
|
|
70
|
+
* Create the container based on an ODSP snapshot and execute code on it
|
|
71
|
+
* @returns result of execution
|
|
72
|
+
*/
|
|
73
|
+
async function createContainerAndExecute(localOdspSnapshot, fluidFileConverter, logger, options) {
|
|
74
|
+
const loader = new container_loader_1.Loader({
|
|
75
|
+
urlResolver: new fakeUrlResolver_1.FakeUrlResolver(),
|
|
76
|
+
documentServiceFactory: (0, odsp_driver_1.createLocalOdspDocumentServiceFactory)(localOdspSnapshot),
|
|
77
|
+
codeLoader: await fluidFileConverter.getCodeLoader(logger),
|
|
78
|
+
scope: fluidFileConverter.scope,
|
|
79
|
+
logger,
|
|
80
|
+
});
|
|
81
|
+
const container = await loader.resolve({ url: "/fakeUrl/", headers: {
|
|
82
|
+
[container_definitions_1.LoaderHeader.loadMode]: { opsBeforeReturn: "cached" }
|
|
83
|
+
} });
|
|
84
|
+
return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "ExportFile" }, async () => fluidFileConverter.execute(container, options));
|
|
85
|
+
}
|
|
86
|
+
exports.createContainerAndExecute = createContainerAndExecute;
|
|
87
|
+
//# sourceMappingURL=exportFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":"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","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 success: true;\n}\n\ninterface IExportFileResponseFailure {\n success: false;\n eventName: string;\n errorMessage: string;\n error?: 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 fluidFileConverter: IFluidFileConverter,\n inputFile: string,\n outputFile: string,\n telemetryFile: string,\n options?: string,\n telemetryOptions?: ITelemetryOptions,\n): Promise<IExportFileResponse> {\n const telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n if (telemetryArgError) {\n const eventName = clientArgsValidationError;\n return { success: false, eventName, errorMessage: telemetryArgError };\n }\n const { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n try {\n return await PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () => {\n const argsValidationError = getArgsValidationError(inputFile, outputFile);\n if (argsValidationError) {\n const eventName = clientArgsValidationError;\n logger.sendErrorEvent({ eventName, message: argsValidationError });\n return { success: false, eventName, errorMessage: argsValidationError };\n }\n\n fs.writeFileSync(outputFile, await createContainerAndExecute(\n getSnapshotFileContent(inputFile),\n fluidFileConverter,\n logger,\n options,\n ));\n\n return { success: true };\n });\n } catch (error) {\n const eventName = \"Client_UnexpectedError\";\n logger.sendErrorEvent({ eventName }, error);\n return { success: false, eventName, errorMessage: \"Unexpected error\", error };\n } finally {\n await fileLogger.close();\n }\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 localOdspSnapshot: string | Uint8Array,\n fluidFileConverter: IFluidFileConverter,\n logger: ITelemetryLogger,\n options?: string,\n): Promise<string> {\n const loader = new Loader({\n urlResolver: new FakeUrlResolver(),\n documentServiceFactory: createLocalOdspDocumentServiceFactory(localOdspSnapshot),\n codeLoader: await fluidFileConverter.getCodeLoader(logger),\n scope: fluidFileConverter.scope,\n logger,\n });\n\n const container = await loader.resolve({ url: \"/fakeUrl/\", headers: {\n [LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" } } });\n\n return PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () =>\n fluidFileConverter.execute(container, options));\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { IContainerPackageInfo, IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
7
|
+
/**
|
|
8
|
+
* Fake URL resolver that returns hard coded values on every request
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class FakeUrlResolver implements IUrlResolver {
|
|
12
|
+
resolve(_request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
13
|
+
getAbsoluteUrl(_resolvedUrl: IResolvedUrl, _relativeUrl: string, _packageInfoSource?: IContainerPackageInfo): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=fakeUrlResolver.d.ts.map
|
|
@@ -0,0 +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,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMvG;;;GAGG;AACH,qBAAa,eAAgB,YAAW,YAAY;IACnC,OAAO,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IAyB9D,cAAc,CACvB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,MAAM,EACpB,kBAAkB,CAAC,EAAE,qBAAqB,GAC3C,OAAO,CAAC,MAAM,CAAC;CAGrB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FakeUrlResolver = void 0;
|
|
8
|
+
const fakeId = "FakeUrlResolver";
|
|
9
|
+
const fakeUrl = "/FakeUrlResolver/";
|
|
10
|
+
/**
|
|
11
|
+
* Fake URL resolver that returns hard coded values on every request
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
class FakeUrlResolver {
|
|
15
|
+
async resolve(_request) {
|
|
16
|
+
const fakeOdspResolvedUrl = {
|
|
17
|
+
type: "fluid",
|
|
18
|
+
odspResolvedUrl: true,
|
|
19
|
+
id: fakeId,
|
|
20
|
+
siteUrl: fakeUrl,
|
|
21
|
+
driveId: fakeId,
|
|
22
|
+
itemId: fakeId,
|
|
23
|
+
url: fakeUrl,
|
|
24
|
+
hashedDocumentId: fakeId,
|
|
25
|
+
endpoints: {
|
|
26
|
+
snapshotStorageUrl: fakeUrl,
|
|
27
|
+
attachmentPOSTStorageUrl: fakeUrl,
|
|
28
|
+
attachmentGETStorageUrl: fakeUrl,
|
|
29
|
+
deltaStorageUrl: fakeUrl,
|
|
30
|
+
},
|
|
31
|
+
tokens: {},
|
|
32
|
+
fileName: fakeId,
|
|
33
|
+
summarizer: false,
|
|
34
|
+
fileVersion: fakeId,
|
|
35
|
+
};
|
|
36
|
+
return fakeOdspResolvedUrl;
|
|
37
|
+
}
|
|
38
|
+
async getAbsoluteUrl(_resolvedUrl, _relativeUrl, _packageInfoSource) {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.FakeUrlResolver = FakeUrlResolver;
|
|
43
|
+
//# sourceMappingURL=fakeUrlResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fakeUrlResolver.js","sourceRoot":"","sources":["../src/fakeUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACjC,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC;;;GAGG;AACH,MAAa,eAAe;IACjB,KAAK,CAAC,OAAO,CAAC,QAAkB;QACnC,MAAM,mBAAmB,GAAqB;YAC1C,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;gBACP,kBAAkB,EAAE,OAAO;gBAC3B,wBAAwB,EAAE,OAAO;gBACjC,uBAAuB,EAAE,OAAO;gBAChC,eAAe,EAAE,OAAO;aAC3B;YACD,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,KAAK;YACjB,WAAW,EAAE,MAAM;SACtB,CAAC;QAEF,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAC,cAAc,CACvB,YAA0B,EAC1B,YAAoB,EACpB,kBAA0C;QAE1C,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;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 { IContainerPackageInfo, IResolvedUrl, IUrlResolver } 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 public async resolve(_request: IRequest): Promise<IResolvedUrl | undefined> {\n const fakeOdspResolvedUrl: IOdspResolvedUrl = {\n type: \"fluid\",\n odspResolvedUrl: true,\n id: fakeId,\n siteUrl: fakeUrl,\n driveId: fakeId,\n itemId: fakeId,\n url: fakeUrl,\n hashedDocumentId: fakeId,\n endpoints: {\n snapshotStorageUrl: fakeUrl,\n attachmentPOSTStorageUrl: fakeUrl,\n attachmentGETStorageUrl: fakeUrl,\n deltaStorageUrl: fakeUrl,\n },\n tokens: {},\n fileName: fakeId,\n summarizer: false,\n fileVersion: fakeId,\n };\n\n return fakeOdspResolvedUrl;\n }\n\n public async getAbsoluteUrl(\n _resolvedUrl: IResolvedUrl,\n _relativeUrl: string,\n _packageInfoSource?: IContainerPackageInfo,\n ): Promise<string> {\n return \"\";\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { IFluidFileConverter } from "./codeLoaderBundle";
|
|
6
|
+
/**
|
|
7
|
+
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
8
|
+
*/
|
|
9
|
+
export declare function fluidRunner(fluidFileConverter?: IFluidFileConverter): void;
|
|
10
|
+
//# sourceMappingURL=fluidRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluidRunner.d.ts","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,QAqFnE"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.fluidRunner = void 0;
|
|
27
|
+
/* eslint-disable max-len */
|
|
28
|
+
const yargs = __importStar(require("yargs"));
|
|
29
|
+
const exportFile_1 = require("./exportFile");
|
|
30
|
+
const parseBundleAndExportFile_1 = require("./parseBundleAndExportFile");
|
|
31
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
32
|
+
const loggerUtils_1 = require("./logger/loggerUtils");
|
|
33
|
+
const utils_1 = require("./utils");
|
|
34
|
+
/**
|
|
35
|
+
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
36
|
+
*/
|
|
37
|
+
function fluidRunner(fluidFileConverter) {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
39
|
+
yargs
|
|
40
|
+
.strict()
|
|
41
|
+
.version(false)
|
|
42
|
+
.command("exportFile", "Generate an output for a local ODSP snapshot",
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
44
|
+
(yargs) => yargs
|
|
45
|
+
.option("codeLoader", {
|
|
46
|
+
describe: "Path to code loader bundle. Required if this application is being called without modification.\nSee \"README.md\" for more details.",
|
|
47
|
+
type: "string",
|
|
48
|
+
demandOption: false,
|
|
49
|
+
})
|
|
50
|
+
.option("inputFile", {
|
|
51
|
+
describe: "Path to local ODSP snapshot",
|
|
52
|
+
type: "string",
|
|
53
|
+
demandOption: true,
|
|
54
|
+
})
|
|
55
|
+
.option("outputFile", {
|
|
56
|
+
describe: "Path of output file (cannot already exist).\nExecution result will be written here",
|
|
57
|
+
type: "string",
|
|
58
|
+
demandOption: true,
|
|
59
|
+
})
|
|
60
|
+
.option("telemetryFile", {
|
|
61
|
+
describe: "Path of telemetry file for config and session data (cannot already exist)",
|
|
62
|
+
type: "string",
|
|
63
|
+
demandOption: true,
|
|
64
|
+
})
|
|
65
|
+
.option("options", {
|
|
66
|
+
describe: "Additional options passed to container on execution",
|
|
67
|
+
type: "string",
|
|
68
|
+
demandOption: false,
|
|
69
|
+
})
|
|
70
|
+
.option("telemetryFormat", {
|
|
71
|
+
describe: "Output format for telemetry. Current options are: [\"JSON\", \"CSV\"]",
|
|
72
|
+
type: "string",
|
|
73
|
+
demandOption: false,
|
|
74
|
+
default: "JSON",
|
|
75
|
+
})
|
|
76
|
+
.option("telemetryProp", {
|
|
77
|
+
describe: "Property to add to every telemetry entry. Formatted like \"--telemetryProp prop1 value1 --telemetryProp prop2 \\\"value 2\\\"\".",
|
|
78
|
+
type: "array",
|
|
79
|
+
demandOption: false,
|
|
80
|
+
}),
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
82
|
+
async (argv) => {
|
|
83
|
+
const argsError = (0, utils_1.validateCommandLineArgs)(argv.codeLoader, fluidFileConverter);
|
|
84
|
+
if (argsError) {
|
|
85
|
+
console.error(argsError);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
const telemetryOptionsResult = (0, loggerUtils_1.validateAndParseTelemetryOptions)(argv.telemetryFormat, argv.telemetryProp);
|
|
89
|
+
if (!telemetryOptionsResult.success) {
|
|
90
|
+
console.error(telemetryOptionsResult.error);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
const result = await (argv.codeLoader
|
|
94
|
+
? (0, parseBundleAndExportFile_1.parseBundleAndExportFile)(argv.codeLoader, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions) : (0, exportFile_1.exportFile)(fluidFileConverter, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions));
|
|
95
|
+
if (!result.success) {
|
|
96
|
+
console.error(`${result.eventName}: ${result.errorMessage}`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
.help()
|
|
101
|
+
.demandCommand().argv;
|
|
102
|
+
}
|
|
103
|
+
exports.fluidRunner = fluidRunner;
|
|
104
|
+
fluidRunner();
|
|
105
|
+
/* eslint-enable max-len */
|
|
106
|
+
//# sourceMappingURL=fluidRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluidRunner.js","sourceRoot":"","sources":["../src/fluidRunner.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable max-len */\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 // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n yargs\n .strict()\n .version(false)\n .command(\n \"exportFile\",\n \"Generate an output for a local ODSP snapshot\",\n // eslint-disable-next-line @typescript-eslint/no-shadow\n (yargs) =>\n yargs\n .option(\"codeLoader\", {\n describe: \"Path to code loader bundle. Required if this application is being called without modification.\\nSee \\\"README.md\\\" for more details.\",\n type: \"string\",\n demandOption: false,\n })\n .option(\"inputFile\", {\n describe: \"Path to local ODSP snapshot\",\n type: \"string\",\n demandOption: true,\n })\n .option(\"outputFile\", {\n describe: \"Path of output file (cannot already exist).\\nExecution result will be written here\",\n type: \"string\",\n demandOption: true,\n })\n .option(\"telemetryFile\", {\n describe: \"Path of telemetry file for config and session data (cannot already exist)\",\n type: \"string\",\n demandOption: true,\n })\n .option(\"options\", {\n describe: \"Additional options passed to container on execution\",\n type: \"string\",\n demandOption: false,\n })\n .option(\"telemetryFormat\", {\n describe: \"Output format for telemetry. Current options are: [\\\"JSON\\\", \\\"CSV\\\"]\",\n type: \"string\",\n demandOption: false,\n default: \"JSON\",\n })\n .option(\"telemetryProp\", {\n describe: \"Property to add to every telemetry entry. Formatted like \\\"--telemetryProp prop1 value1 --telemetryProp prop2 \\\\\\\"value 2\\\\\\\"\\\".\",\n type: \"array\",\n demandOption: false,\n }),\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (argv) => {\n const argsError = validateCommandLineArgs(argv.codeLoader, fluidFileConverter);\n if (argsError) {\n console.error(argsError);\n process.exit(1);\n }\n const telemetryOptionsResult = validateAndParseTelemetryOptions(argv.telemetryFormat, argv.telemetryProp);\n if (!telemetryOptionsResult.success) {\n console.error(telemetryOptionsResult.error);\n process.exit(1);\n }\n\n const result = await (argv.codeLoader\n ? parseBundleAndExportFile(\n argv.codeLoader,\n argv.inputFile,\n argv.outputFile,\n argv.telemetryFile,\n argv.options,\n telemetryOptionsResult.telemetryOptions,\n ) : exportFile(\n fluidFileConverter!,\n argv.inputFile,\n argv.outputFile,\n argv.telemetryFile,\n argv.options,\n telemetryOptionsResult.telemetryOptions,\n ));\n\n if (!result.success) {\n console.error(`${result.eventName}: ${result.errorMessage}`);\n process.exit(1);\n }\n },\n )\n .help()\n .demandCommand().argv;\n}\n\nfluidRunner();\n/* eslint-enable max-len */\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getArgsValidationError(inputFile: string, outputFile: string): string | undefined;
|
|
6
|
+
//# sourceMappingURL=getArgsValidationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArgsValidationError.d.ts","sourceRoot":"","sources":["../src/getArgsValidationError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACnB,MAAM,GAAG,SAAS,CAgBpB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getArgsValidationError = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
function getArgsValidationError(inputFile, outputFile) {
|
|
29
|
+
// Validate input file
|
|
30
|
+
if (!inputFile) {
|
|
31
|
+
return "Input file name argument is missing.";
|
|
32
|
+
}
|
|
33
|
+
else if (!fs.existsSync(inputFile)) {
|
|
34
|
+
return "Input file does not exist.";
|
|
35
|
+
}
|
|
36
|
+
// Validate output file
|
|
37
|
+
if (!outputFile) {
|
|
38
|
+
return "Output file argument is missing.";
|
|
39
|
+
}
|
|
40
|
+
else if (fs.existsSync(outputFile)) {
|
|
41
|
+
return `Output file already exists [${outputFile}].`;
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
exports.getArgsValidationError = getArgsValidationError;
|
|
46
|
+
//# sourceMappingURL=getArgsValidationError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getArgsValidationError.js","sourceRoot":"","sources":["../src/getArgsValidationError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AAEzB,SAAgB,sBAAsB,CAClC,SAAiB,EACjB,UAAkB;IAElB,sBAAsB;IACtB,IAAI,CAAC,SAAS,EAAE;QACZ,OAAO,sCAAsC,CAAC;KACjD;SAAM,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAClC,OAAO,4BAA4B,CAAC;KACvC;IAED,uBAAuB;IACvB,IAAI,CAAC,UAAU,EAAE;QACb,OAAO,kCAAkC,CAAC;KAC7C;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAClC,OAAO,+BAA+B,UAAU,IAAI,CAAC;KACxD;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAnBD,wDAmBC","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(\n inputFile: string,\n outputFile: string,\n): string | undefined {\n // Validate input file\n if (!inputFile) {\n return \"Input file name argument is missing.\";\n } else if (!fs.existsSync(inputFile)) {\n return \"Input file does not exist.\";\n }\n\n // Validate output file\n if (!outputFile) {\n return \"Output file argument is missing.\";\n } else if (fs.existsSync(outputFile)) {\n return `Output file already exists [${outputFile}].`;\n }\n\n return undefined;\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { ICodeLoaderBundle, IFluidFileConverter } from "./codeLoaderBundle";
|
|
6
|
+
export * from "./exportFile";
|
|
7
|
+
export { fluidRunner } from "./fluidRunner";
|
|
8
|
+
export { OutputFormat } from "./logger/fileLogger";
|
|
9
|
+
export { createLogger, getTelemetryFileValidationError } from "./logger/loggerUtils";
|
|
10
|
+
export * from "./parseBundleAndExportFile";
|
|
11
|
+
export { getSnapshotFileContent } from "./utils";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|