@fluidframework/fluid-runner 2.0.0-dev-rc.1.0.0.224419
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +17 -0
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +120 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +17 -0
- package/api-report/fluid-runner.api.md +89 -0
- package/bin/fluid-runner +2 -0
- package/dist/codeLoaderBundle.d.ts +46 -0
- package/dist/codeLoaderBundle.d.ts.map +1 -0
- package/dist/codeLoaderBundle.js +25 -0
- package/dist/codeLoaderBundle.js.map +1 -0
- package/dist/exportFile.d.ts +33 -0
- package/dist/exportFile.d.ts.map +1 -0
- package/dist/exportFile.js +120 -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/fluid-runner-alpha.d.ts +79 -0
- package/dist/fluid-runner-beta.d.ts +52 -0
- package/dist/fluid-runner-public.d.ts +52 -0
- package/dist/fluid-runner-untrimmed.d.ts +175 -0
- package/dist/fluidRunner.d.ts +11 -0
- package/dist/fluidRunner.d.ts.map +1 -0
- package/dist/fluidRunner.js +126 -0
- package/dist/fluidRunner.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -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 +76 -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 +64 -0
- package/dist/logger/csvFileLogger.js.map +1 -0
- package/dist/logger/fileLogger.d.ts +44 -0
- package/dist/logger/fileLogger.d.ts.map +1 -0
- package/dist/logger/fileLogger.js +18 -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 +48 -0
- package/dist/logger/jsonFileLogger.js.map +1 -0
- package/dist/logger/loggerUtils.d.ts +44 -0
- package/dist/logger/loggerUtils.d.ts.map +1 -0
- package/dist/logger/loggerUtils.js +120 -0
- package/dist/logger/loggerUtils.js.map +1 -0
- package/dist/parseBundleAndExportFile.d.ts +13 -0
- package/dist/parseBundleAndExportFile.d.ts.map +1 -0
- package/dist/parseBundleAndExportFile.js +88 -0
- package/dist/parseBundleAndExportFile.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils.d.ts +33 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +107 -0
- package/dist/utils.js.map +1 -0
- package/package.json +120 -0
- package/prettier.config.cjs +8 -0
- package/src/codeLoaderBundle.ts +63 -0
- package/src/exportFile.ts +148 -0
- package/src/fakeUrlResolver.ts +54 -0
- package/src/fluidRunner.ts +135 -0
- package/src/index.ts +18 -0
- package/src/logger/baseFileLogger.ts +58 -0
- package/src/logger/csvFileLogger.ts +40 -0
- package/src/logger/fileLogger.ts +51 -0
- package/src/logger/jsonFileLogger.ts +27 -0
- package/src/logger/loggerUtils.ts +108 -0
- package/src/parseBundleAndExportFile.ts +92 -0
- package/src/utils.ts +100 -0
- package/tsconfig.json +13 -0
|
@@ -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,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"}
|
|
@@ -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;;;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"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
4
|
+
import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IContainer } from '@fluidframework/container-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: createContainerAndExecute */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: createLogger */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: exportFile */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: fluidRunner */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: getSnapshotFileContent */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: getTelemetryFileValidationError */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: ICodeLoaderBundle */
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export declare type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
|
|
27
|
+
|
|
28
|
+
declare interface IExportFileResponseFailure {
|
|
29
|
+
success: false;
|
|
30
|
+
eventName: string;
|
|
31
|
+
errorMessage: string;
|
|
32
|
+
error?: any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare interface IExportFileResponseSuccess {
|
|
36
|
+
success: true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Excluded from this release type: IFileLogger */
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Instance that holds all the details for Fluid file conversion
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
export declare interface IFluidFileConverter {
|
|
46
|
+
/**
|
|
47
|
+
* Get code loader details to provide at Loader creation
|
|
48
|
+
* @param logger - created logger object to pass to code loader
|
|
49
|
+
*/
|
|
50
|
+
getCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;
|
|
51
|
+
/**
|
|
52
|
+
* Get scope object to provide at Loader creation
|
|
53
|
+
* @param logger - created logger object to pass to scope object
|
|
54
|
+
*/
|
|
55
|
+
getScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;
|
|
56
|
+
/**
|
|
57
|
+
* Executes code on container and returns the result
|
|
58
|
+
* @param container - container created by this application
|
|
59
|
+
* @param options - additional options
|
|
60
|
+
*/
|
|
61
|
+
execute(container: IContainer, options?: string): Promise<string>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Excluded from this release type: ITelemetryOptions */
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Desired output format for the telemetry
|
|
68
|
+
* @alpha
|
|
69
|
+
*/
|
|
70
|
+
export declare enum OutputFormat {
|
|
71
|
+
JSON = 0,
|
|
72
|
+
CSV = 1
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Excluded from this release type: parseBundleAndExportFile */
|
|
76
|
+
|
|
77
|
+
/* Excluded from this release type: validateAndParseTelemetryOptions */
|
|
78
|
+
|
|
79
|
+
export { }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
4
|
+
import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IContainer } from '@fluidframework/container-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: createContainerAndExecute */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: createLogger */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: exportFile */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: fluidRunner */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: getSnapshotFileContent */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: getTelemetryFileValidationError */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: ICodeDetailsLoader */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: ICodeLoaderBundle */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: IContainer */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: IExportFileResponse */
|
|
28
|
+
|
|
29
|
+
declare interface IExportFileResponseFailure {
|
|
30
|
+
success: false;
|
|
31
|
+
eventName: string;
|
|
32
|
+
errorMessage: string;
|
|
33
|
+
error?: any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare interface IExportFileResponseSuccess {
|
|
37
|
+
success: true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Excluded from this release type: IFileLogger */
|
|
41
|
+
|
|
42
|
+
/* Excluded from this release type: IFluidFileConverter */
|
|
43
|
+
|
|
44
|
+
/* Excluded from this release type: ITelemetryOptions */
|
|
45
|
+
|
|
46
|
+
/* Excluded from this release type: OutputFormat */
|
|
47
|
+
|
|
48
|
+
/* Excluded from this release type: parseBundleAndExportFile */
|
|
49
|
+
|
|
50
|
+
/* Excluded from this release type: validateAndParseTelemetryOptions */
|
|
51
|
+
|
|
52
|
+
export { }
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
4
|
+
import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IContainer } from '@fluidframework/container-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
8
|
+
|
|
9
|
+
/* Excluded from this release type: createContainerAndExecute */
|
|
10
|
+
|
|
11
|
+
/* Excluded from this release type: createLogger */
|
|
12
|
+
|
|
13
|
+
/* Excluded from this release type: exportFile */
|
|
14
|
+
|
|
15
|
+
/* Excluded from this release type: fluidRunner */
|
|
16
|
+
|
|
17
|
+
/* Excluded from this release type: getSnapshotFileContent */
|
|
18
|
+
|
|
19
|
+
/* Excluded from this release type: getTelemetryFileValidationError */
|
|
20
|
+
|
|
21
|
+
/* Excluded from this release type: ICodeDetailsLoader */
|
|
22
|
+
|
|
23
|
+
/* Excluded from this release type: ICodeLoaderBundle */
|
|
24
|
+
|
|
25
|
+
/* Excluded from this release type: IContainer */
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: IExportFileResponse */
|
|
28
|
+
|
|
29
|
+
declare interface IExportFileResponseFailure {
|
|
30
|
+
success: false;
|
|
31
|
+
eventName: string;
|
|
32
|
+
errorMessage: string;
|
|
33
|
+
error?: any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare interface IExportFileResponseSuccess {
|
|
37
|
+
success: true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Excluded from this release type: IFileLogger */
|
|
41
|
+
|
|
42
|
+
/* Excluded from this release type: IFluidFileConverter */
|
|
43
|
+
|
|
44
|
+
/* Excluded from this release type: ITelemetryOptions */
|
|
45
|
+
|
|
46
|
+
/* Excluded from this release type: OutputFormat */
|
|
47
|
+
|
|
48
|
+
/* Excluded from this release type: parseBundleAndExportFile */
|
|
49
|
+
|
|
50
|
+
/* Excluded from this release type: validateAndParseTelemetryOptions */
|
|
51
|
+
|
|
52
|
+
export { }
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
|
|
3
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
4
|
+
import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
|
|
5
|
+
import { IContainer } from '@fluidframework/container-definitions';
|
|
6
|
+
import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create the container based on an ODSP snapshot and execute code on it
|
|
11
|
+
* @returns result of execution
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLoggerExt, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create an {@link @fluidframework/telemetry-utils#ITelemetryLoggerExt} wrapped around provided {@link IFileLogger}.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*
|
|
21
|
+
* It is expected that all events be sent through the returned "logger" value.
|
|
22
|
+
*
|
|
23
|
+
* The "fileLogger" value should have its "close()" method called at the end of execution.
|
|
24
|
+
*
|
|
25
|
+
* Note: if an output format is not supplied, default is JSON.
|
|
26
|
+
*
|
|
27
|
+
* @returns Both the `IFileLogger` implementation and `ITelemetryLoggerExt` wrapper to be called.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function createLogger(filePath: string, options?: ITelemetryOptions): {
|
|
31
|
+
logger: ITelemetryLoggerExt;
|
|
32
|
+
fileLogger: IFileLogger;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Execute code on Container based on ODSP snapshot and write result to file
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export declare function fluidRunner(fluidFileConverter?: IFluidFileConverter): void;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the ODSP snapshot file content
|
|
49
|
+
* Works on both JSON and binary snapshot formats
|
|
50
|
+
* @param filePath - path to the ODSP snapshot file
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function getSnapshotFileContent(filePath: string): string | Buffer;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Validate the telemetryFile command line argument
|
|
57
|
+
* @param telemetryFile - path where telemetry will be written
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export declare function getTelemetryFileValidationError(telemetryFile: string): string | undefined;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Contract that defines the necessary exports for the bundle provided at runtime
|
|
64
|
+
* For an example, see "src/test/sampleCodeLoaders/sampleCodeLoader.ts"
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare interface ICodeLoaderBundle {
|
|
68
|
+
/**
|
|
69
|
+
* Fluid export of all the required objects and functions
|
|
70
|
+
*/
|
|
71
|
+
fluidExport: Promise<IFluidFileConverter>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @alpha
|
|
76
|
+
*/
|
|
77
|
+
export declare type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
|
|
78
|
+
|
|
79
|
+
declare interface IExportFileResponseFailure {
|
|
80
|
+
success: false;
|
|
81
|
+
eventName: string;
|
|
82
|
+
errorMessage: string;
|
|
83
|
+
error?: any;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare interface IExportFileResponseSuccess {
|
|
87
|
+
success: true;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Contract for logger that writes telemetry to a file
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
declare interface IFileLogger extends ITelemetryBaseLogger {
|
|
95
|
+
/**
|
|
96
|
+
* This method acts as a "dispose" and should be explicitly called at the end of execution
|
|
97
|
+
*/
|
|
98
|
+
close(): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Instance that holds all the details for Fluid file conversion
|
|
103
|
+
* @alpha
|
|
104
|
+
*/
|
|
105
|
+
export declare interface IFluidFileConverter {
|
|
106
|
+
/**
|
|
107
|
+
* Get code loader details to provide at Loader creation
|
|
108
|
+
* @param logger - created logger object to pass to code loader
|
|
109
|
+
*/
|
|
110
|
+
getCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;
|
|
111
|
+
/**
|
|
112
|
+
* Get scope object to provide at Loader creation
|
|
113
|
+
* @param logger - created logger object to pass to scope object
|
|
114
|
+
*/
|
|
115
|
+
getScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;
|
|
116
|
+
/**
|
|
117
|
+
* Executes code on container and returns the result
|
|
118
|
+
* @param container - container created by this application
|
|
119
|
+
* @param options - additional options
|
|
120
|
+
*/
|
|
121
|
+
execute(container: IContainer, options?: string): Promise<string>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Options to provide upon creation of IFileLogger
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
export declare interface ITelemetryOptions {
|
|
129
|
+
/** Desired output format used to create a specific IFileLogger implementation */
|
|
130
|
+
outputFormat?: OutputFormat;
|
|
131
|
+
/**
|
|
132
|
+
* Properties that should be added to every telemetry event
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
*
|
|
136
|
+
* ```JSON
|
|
137
|
+
* { "prop1": "value1", "prop2": 10.0 }
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
defaultProps?: Record<string, string | number>;
|
|
141
|
+
/** Number of telemetry events per flush to telemetry file */
|
|
142
|
+
eventsPerFlush?: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Desired output format for the telemetry
|
|
147
|
+
* @alpha
|
|
148
|
+
*/
|
|
149
|
+
export declare enum OutputFormat {
|
|
150
|
+
JSON = 0,
|
|
151
|
+
CSV = 1
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Parse a provided JS bundle, execute code on Container based on ODSP snapshot, and write result to file
|
|
156
|
+
* @param codeLoader - path to provided JS bundle that implements ICodeLoaderBundle (see codeLoaderBundle.ts)
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
export declare function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Validate the provided output format and default properties
|
|
163
|
+
* @param format - desired output format of the telemetry
|
|
164
|
+
* @param props - default properties to be added to every telemetry entry
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
export declare function validateAndParseTelemetryOptions(format?: string, props?: (string | number)[], eventsPerFlush?: number): {
|
|
168
|
+
success: false;
|
|
169
|
+
error: string;
|
|
170
|
+
} | {
|
|
171
|
+
success: true;
|
|
172
|
+
telemetryOptions: ITelemetryOptions;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function fluidRunner(fluidFileConverter?: IFluidFileConverter): void;
|
|
11
|
+
//# sourceMappingURL=fluidRunner.d.ts.map
|
|
@@ -0,0 +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;;;GAGG;AACH,wBAAgB,WAAW,CAAC,kBAAkB,CAAC,EAAE,mBAAmB,QAqHnE"}
|
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.fluidRunner = void 0;
|
|
31
|
+
const yargs = __importStar(require("yargs"));
|
|
32
|
+
const exportFile_1 = require("./exportFile");
|
|
33
|
+
const parseBundleAndExportFile_1 = require("./parseBundleAndExportFile");
|
|
34
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
35
|
+
const loggerUtils_1 = require("./logger/loggerUtils");
|
|
36
|
+
const utils_1 = require("./utils");
|
|
37
|
+
/**
|
|
38
|
+
* @param fluidFileConverter - needs to be provided if "codeLoaderBundle" is not and vice versa
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
function fluidRunner(fluidFileConverter) {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
43
|
+
yargs
|
|
44
|
+
.strict()
|
|
45
|
+
.version(false)
|
|
46
|
+
.command("exportFile", "Generate an output for a local ODSP snapshot",
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
48
|
+
(yargs) => yargs
|
|
49
|
+
.option("codeLoader", {
|
|
50
|
+
describe: 'Path to code loader bundle. Required if this application is being called without modification.\nSee "README.md" for more details.',
|
|
51
|
+
type: "string",
|
|
52
|
+
demandOption: false,
|
|
53
|
+
})
|
|
54
|
+
.option("inputFile", {
|
|
55
|
+
describe: "Path to local ODSP snapshot",
|
|
56
|
+
type: "string",
|
|
57
|
+
demandOption: true,
|
|
58
|
+
})
|
|
59
|
+
.option("outputFile", {
|
|
60
|
+
describe: "Path of output file (cannot already exist).\nExecution result will be written here",
|
|
61
|
+
type: "string",
|
|
62
|
+
demandOption: true,
|
|
63
|
+
})
|
|
64
|
+
.option("telemetryFile", {
|
|
65
|
+
describe: "Path of telemetry file for config and session data (cannot already exist)",
|
|
66
|
+
type: "string",
|
|
67
|
+
demandOption: true,
|
|
68
|
+
})
|
|
69
|
+
.option("options", {
|
|
70
|
+
describe: "Additional options passed to container on execution",
|
|
71
|
+
type: "string",
|
|
72
|
+
demandOption: false,
|
|
73
|
+
})
|
|
74
|
+
.option("telemetryFormat", {
|
|
75
|
+
describe: 'Output format for telemetry. Current options are: ["JSON", "CSV"]',
|
|
76
|
+
type: "string",
|
|
77
|
+
demandOption: false,
|
|
78
|
+
default: "JSON",
|
|
79
|
+
})
|
|
80
|
+
.option("telemetryProp", {
|
|
81
|
+
describe: 'Property to add to every telemetry entry. Formatted like "--telemetryProp prop1 value1 --telemetryProp prop2 \\"value 2\\"".',
|
|
82
|
+
type: "array",
|
|
83
|
+
demandOption: false,
|
|
84
|
+
})
|
|
85
|
+
.option("eventsPerFlush", {
|
|
86
|
+
describe: "Number of telemetry events per flush to telemetryFile (only applicable for JSON format)",
|
|
87
|
+
type: "number",
|
|
88
|
+
demandOption: false,
|
|
89
|
+
})
|
|
90
|
+
.option("timeout", {
|
|
91
|
+
describe: "Allowed timeout in ms before process is automatically cancelled",
|
|
92
|
+
type: "number",
|
|
93
|
+
demandOption: false,
|
|
94
|
+
})
|
|
95
|
+
.option("disableNetworkFetch", {
|
|
96
|
+
describe: "Should network fetch calls be explicitly disabled?",
|
|
97
|
+
type: "boolean",
|
|
98
|
+
demandOption: false,
|
|
99
|
+
default: false,
|
|
100
|
+
}),
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
102
|
+
async (argv) => {
|
|
103
|
+
const argsError = (0, utils_1.validateCommandLineArgs)(argv.codeLoader, fluidFileConverter);
|
|
104
|
+
if (argsError) {
|
|
105
|
+
console.error(argsError);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
const telemetryOptionsResult = (0, loggerUtils_1.validateAndParseTelemetryOptions)(argv.telemetryFormat, argv.telemetryProp, argv.eventsPerFlush);
|
|
109
|
+
if (!telemetryOptionsResult.success) {
|
|
110
|
+
console.error(telemetryOptionsResult.error);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
const result = await (argv.codeLoader
|
|
114
|
+
? (0, parseBundleAndExportFile_1.parseBundleAndExportFile)(argv.codeLoader, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions, argv.timeout, argv.disableNetworkFetch)
|
|
115
|
+
: (0, exportFile_1.exportFile)(fluidFileConverter, argv.inputFile, argv.outputFile, argv.telemetryFile, argv.options, telemetryOptionsResult.telemetryOptions, argv.timeout, argv.disableNetworkFetch));
|
|
116
|
+
if (!result.success) {
|
|
117
|
+
console.error(`${result.eventName}: ${result.errorMessage}`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
process.exit(0);
|
|
121
|
+
})
|
|
122
|
+
.help()
|
|
123
|
+
.demandCommand().argv;
|
|
124
|
+
}
|
|
125
|
+
exports.fluidRunner = fluidRunner;
|
|
126
|
+
//# 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\nimport * as yargs from \"yargs\";\nimport { exportFile } from \"./exportFile\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { parseBundleAndExportFile } from \"./parseBundleAndExportFile\";\n// eslint-disable-next-line import/no-internal-modules\nimport { validateAndParseTelemetryOptions } from \"./logger/loggerUtils\";\nimport { validateCommandLineArgs } from \"./utils\";\n\n/**\n * @param fluidFileConverter - needs to be provided if \"codeLoaderBundle\" is not and vice versa\n * @internal\n */\nexport function fluidRunner(fluidFileConverter?: IFluidFileConverter) {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\tyargs\n\t\t.strict()\n\t\t.version(false)\n\t\t.command(\n\t\t\t\"exportFile\",\n\t\t\t\"Generate an output for a local ODSP snapshot\",\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\t\t(yargs) =>\n\t\t\t\tyargs\n\t\t\t\t\t.option(\"codeLoader\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Path to code loader bundle. Required if this application is being called without modification.\\nSee \"README.md\" for more details.',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"inputFile\", {\n\t\t\t\t\t\tdescribe: \"Path to local ODSP snapshot\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"outputFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of output file (cannot already exist).\\nExecution result will be written here\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFile\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Path of telemetry file for config and session data (cannot already exist)\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: true,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"options\", {\n\t\t\t\t\t\tdescribe: \"Additional options passed to container on execution\",\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryFormat\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Output format for telemetry. Current options are: [\"JSON\", \"CSV\"]',\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t\tdefault: \"JSON\",\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"telemetryProp\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t'Property to add to every telemetry entry. Formatted like \"--telemetryProp prop1 value1 --telemetryProp prop2 \\\\\"value 2\\\\\"\".',\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"eventsPerFlush\", {\n\t\t\t\t\t\tdescribe:\n\t\t\t\t\t\t\t\"Number of telemetry events per flush to telemetryFile (only applicable for JSON format)\",\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"timeout\", {\n\t\t\t\t\t\tdescribe: \"Allowed timeout in ms before process is automatically cancelled\",\n\t\t\t\t\t\ttype: \"number\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t})\n\t\t\t\t\t.option(\"disableNetworkFetch\", {\n\t\t\t\t\t\tdescribe: \"Should network fetch calls be explicitly disabled?\",\n\t\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t\t\tdemandOption: false,\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t}),\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-misused-promises\n\t\t\tasync (argv) => {\n\t\t\t\tconst argsError = validateCommandLineArgs(argv.codeLoader, fluidFileConverter);\n\t\t\t\tif (argsError) {\n\t\t\t\t\tconsole.error(argsError);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tconst telemetryOptionsResult = validateAndParseTelemetryOptions(\n\t\t\t\t\targv.telemetryFormat,\n\t\t\t\t\targv.telemetryProp,\n\t\t\t\t\targv.eventsPerFlush,\n\t\t\t\t);\n\t\t\t\tif (!telemetryOptionsResult.success) {\n\t\t\t\t\tconsole.error(telemetryOptionsResult.error);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\n\t\t\t\tconst result = await (argv.codeLoader\n\t\t\t\t\t? parseBundleAndExportFile(\n\t\t\t\t\t\t\targv.codeLoader,\n\t\t\t\t\t\t\targv.inputFile,\n\t\t\t\t\t\t\targv.outputFile,\n\t\t\t\t\t\t\targv.telemetryFile,\n\t\t\t\t\t\t\targv.options,\n\t\t\t\t\t\t\ttelemetryOptionsResult.telemetryOptions,\n\t\t\t\t\t\t\targv.timeout,\n\t\t\t\t\t\t\targv.disableNetworkFetch,\n\t\t\t\t\t )\n\t\t\t\t\t: exportFile(\n\t\t\t\t\t\t\tfluidFileConverter!,\n\t\t\t\t\t\t\targv.inputFile,\n\t\t\t\t\t\t\targv.outputFile,\n\t\t\t\t\t\t\targv.telemetryFile,\n\t\t\t\t\t\t\targv.options,\n\t\t\t\t\t\t\ttelemetryOptionsResult.telemetryOptions,\n\t\t\t\t\t\t\targv.timeout,\n\t\t\t\t\t\t\targv.disableNetworkFetch,\n\t\t\t\t\t ));\n\n\t\t\t\tif (!result.success) {\n\t\t\t\t\tconsole.error(`${result.eventName}: ${result.errorMessage}`);\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\tprocess.exit(0);\n\t\t\t},\n\t\t)\n\t\t.help()\n\t\t.demandCommand().argv;\n}\n"]}
|
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 { createContainerAndExecute, exportFile, IExportFileResponse } from "./exportFile";
|
|
7
|
+
export { fluidRunner } from "./fluidRunner";
|
|
8
|
+
export { OutputFormat, ITelemetryOptions } from "./logger/fileLogger";
|
|
9
|
+
export { createLogger, getTelemetryFileValidationError, validateAndParseTelemetryOptions, } from "./logger/loggerUtils";
|
|
10
|
+
export { parseBundleAndExportFile } from "./parseBundleAndExportFile";
|
|
11
|
+
export { getSnapshotFileContent } from "./utils";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EACN,YAAY,EACZ,+BAA+B,EAC/B,gCAAgC,GAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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.getSnapshotFileContent = exports.parseBundleAndExportFile = exports.validateAndParseTelemetryOptions = exports.getTelemetryFileValidationError = exports.createLogger = exports.OutputFormat = exports.fluidRunner = exports.exportFile = exports.createContainerAndExecute = void 0;
|
|
8
|
+
var exportFile_1 = require("./exportFile");
|
|
9
|
+
Object.defineProperty(exports, "createContainerAndExecute", { enumerable: true, get: function () { return exportFile_1.createContainerAndExecute; } });
|
|
10
|
+
Object.defineProperty(exports, "exportFile", { enumerable: true, get: function () { return exportFile_1.exportFile; } });
|
|
11
|
+
var fluidRunner_1 = require("./fluidRunner");
|
|
12
|
+
Object.defineProperty(exports, "fluidRunner", { enumerable: true, get: function () { return fluidRunner_1.fluidRunner; } });
|
|
13
|
+
var fileLogger_1 = require("./logger/fileLogger");
|
|
14
|
+
Object.defineProperty(exports, "OutputFormat", { enumerable: true, get: function () { return fileLogger_1.OutputFormat; } });
|
|
15
|
+
var loggerUtils_1 = require("./logger/loggerUtils");
|
|
16
|
+
Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return loggerUtils_1.createLogger; } });
|
|
17
|
+
Object.defineProperty(exports, "getTelemetryFileValidationError", { enumerable: true, get: function () { return loggerUtils_1.getTelemetryFileValidationError; } });
|
|
18
|
+
Object.defineProperty(exports, "validateAndParseTelemetryOptions", { enumerable: true, get: function () { return loggerUtils_1.validateAndParseTelemetryOptions; } });
|
|
19
|
+
var parseBundleAndExportFile_1 = require("./parseBundleAndExportFile");
|
|
20
|
+
Object.defineProperty(exports, "parseBundleAndExportFile", { enumerable: true, get: function () { return parseBundleAndExportFile_1.parseBundleAndExportFile; } });
|
|
21
|
+
var utils_1 = require("./utils");
|
|
22
|
+
Object.defineProperty(exports, "getSnapshotFileContent", { enumerable: true, get: function () { return utils_1.getSnapshotFileContent; } });
|
|
23
|
+
/* eslint-enable import/no-internal-modules */
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAA0F;AAAjF,uHAAA,yBAAyB,OAAA;AAAE,wGAAA,UAAU,OAAA;AAC9C,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,kDAAsE;AAA7D,0GAAA,YAAY,OAAA;AACrB,oDAI8B;AAH7B,2GAAA,YAAY,OAAA;AACZ,8HAAA,+BAA+B,OAAA;AAC/B,+HAAA,gCAAgC,OAAA;AAEjC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,iCAAiD;AAAxC,+GAAA,sBAAsB,OAAA;AAC/B,8CAA8C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable import/no-internal-modules */\nexport { ICodeLoaderBundle, IFluidFileConverter } from \"./codeLoaderBundle\";\nexport { createContainerAndExecute, exportFile, IExportFileResponse } from \"./exportFile\";\nexport { fluidRunner } from \"./fluidRunner\";\nexport { OutputFormat, ITelemetryOptions } from \"./logger/fileLogger\";\nexport {\n\tcreateLogger,\n\tgetTelemetryFileValidationError,\n\tvalidateAndParseTelemetryOptions,\n} from \"./logger/loggerUtils\";\nexport { parseBundleAndExportFile } from \"./parseBundleAndExportFile\";\nexport { getSnapshotFileContent } from \"./utils\";\n/* eslint-enable import/no-internal-modules */\n"]}
|