@fluidframework/fluid-runner 2.0.0-internal.8.0.1 → 2.0.0-rc.1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/fluid-runner
2
2
 
3
+ ## 2.0.0-rc.1.0.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.8.0.0
4
8
 
5
9
  Dependency updates only.
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.json",
4
+ "messages": {
5
+ "extractorMessageReporting": {
6
+ // TODO: remove once base config has this enabled as an error
7
+ "ae-incompatible-release-tags": {
8
+ "logLevel": "error",
9
+ "addToApiReportFile": false
10
+ }
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-base.json",
4
+ "messages": {
5
+ "extractorMessageReporting": {
6
+ // TODO: fix violations and remove overrides
7
+ "ae-forgotten-export": {
8
+ "logLevel": "warning",
9
+ "addToApiReportFile": true
10
+ },
11
+ "ae-unresolved-link": {
12
+ "logLevel": "warning",
13
+ "addToApiReportFile": true
14
+ }
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,89 @@
1
+ ## API Report File for "@fluidframework/fluid-runner"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="node" />
8
+
9
+ import { FluidObject } from '@fluidframework/core-interfaces';
10
+ import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
11
+ import { IContainer } from '@fluidframework/container-definitions';
12
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
13
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
14
+
15
+ // @internal
16
+ export function createContainerAndExecute(localOdspSnapshot: string | Uint8Array, fluidFileConverter: IFluidFileConverter, logger: ITelemetryLoggerExt, options?: string, timeout?: number, disableNetworkFetch?: boolean): Promise<string>;
17
+
18
+ // Warning: (ae-unresolved-link) The @link reference could not be resolved: The package "@fluidframework/fluid-runner" does not have an export "IFileLogger"
19
+ //
20
+ // @internal
21
+ export function createLogger(filePath: string, options?: ITelemetryOptions): {
22
+ logger: ITelemetryLoggerExt;
23
+ fileLogger: IFileLogger;
24
+ };
25
+
26
+ // @internal
27
+ export function exportFile(fluidFileConverter: IFluidFileConverter, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
28
+
29
+ // @internal (undocumented)
30
+ export function fluidRunner(fluidFileConverter?: IFluidFileConverter): void;
31
+
32
+ // @internal
33
+ export function getSnapshotFileContent(filePath: string): string | Buffer;
34
+
35
+ // @internal
36
+ export function getTelemetryFileValidationError(telemetryFile: string): string | undefined;
37
+
38
+ // @internal
39
+ export interface ICodeLoaderBundle {
40
+ fluidExport: Promise<IFluidFileConverter>;
41
+ }
42
+
43
+ // Warning: (ae-forgotten-export) The symbol "IExportFileResponseSuccess" needs to be exported by the entry point index.d.ts
44
+ // Warning: (ae-forgotten-export) The symbol "IExportFileResponseFailure" needs to be exported by the entry point index.d.ts
45
+ //
46
+ // @alpha (undocumented)
47
+ export type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
48
+
49
+ // @alpha
50
+ export interface IFluidFileConverter {
51
+ execute(container: IContainer, options?: string): Promise<string>;
52
+ getCodeLoader(logger: ITelemetryBaseLogger): Promise<ICodeDetailsLoader>;
53
+ getScope?(logger: ITelemetryBaseLogger): Promise<FluidObject>;
54
+ }
55
+
56
+ // @internal
57
+ export interface ITelemetryOptions {
58
+ defaultProps?: Record<string, string | number>;
59
+ eventsPerFlush?: number;
60
+ outputFormat?: OutputFormat;
61
+ }
62
+
63
+ // @alpha
64
+ export enum OutputFormat {
65
+ // (undocumented)
66
+ CSV = 1,
67
+ // (undocumented)
68
+ JSON = 0
69
+ }
70
+
71
+ // @internal
72
+ export function parseBundleAndExportFile(codeLoader: string, inputFile: string, outputFile: string, telemetryFile: string, options?: string, telemetryOptions?: ITelemetryOptions, timeout?: number, disableNetworkFetch?: boolean): Promise<IExportFileResponse>;
73
+
74
+ // @internal
75
+ export function validateAndParseTelemetryOptions(format?: string, props?: (string | number)[], eventsPerFlush?: number): {
76
+ success: false;
77
+ error: string;
78
+ } | {
79
+ success: true;
80
+ telemetryOptions: ITelemetryOptions;
81
+ };
82
+
83
+ // Warnings were encountered during analysis:
84
+ //
85
+ // src/logger/loggerUtils.ts:29:35 - (ae-forgotten-export) The symbol "IFileLogger" needs to be exported by the entry point index.d.ts
86
+
87
+ // (No @packageDocumentation comment for this package)
88
+
89
+ ```
@@ -17,7 +17,7 @@ export interface ICodeLoaderBundle {
17
17
  }
18
18
  /**
19
19
  * Instance that holds all the details for Fluid file conversion
20
- * @internal
20
+ * @alpha
21
21
  */
22
22
  export interface IFluidFileConverter {
23
23
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0CH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,MAAM,EAAE,WAAW,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,GAAG,EAAE,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 { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { ITelemetryBaseLogger, 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 * @internal\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 * @internal\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"]}
1
+ {"version":3,"file":"codeLoaderBundle.js","sourceRoot":"","sources":["../src/codeLoaderBundle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA0CH;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,MAAW;IAC7C,+DAA+D;IAC/D,OAAO,MAAM,EAAE,WAAW,IAAI,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC;AACtE,CAAC;AAHD,gDAGC;AAED,SAAgB,oBAAoB,CAAC,GAAQ;IAC5C,+DAA+D;IAC/D,OAAO,CACN,GAAG,EAAE,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 { ICodeDetailsLoader, IContainer } from \"@fluidframework/container-definitions\";\nimport { ITelemetryBaseLogger, 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 * @internal\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 * @alpha\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"]}
@@ -6,7 +6,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
6
  import { IFluidFileConverter } from "./codeLoaderBundle";
7
7
  import { ITelemetryOptions } from "./logger/fileLogger";
8
8
  /**
9
- * @internal
9
+ * @alpha
10
10
  */
11
11
  export type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
12
12
  interface IExportFileResponseSuccess {
@@ -1 +1 @@
1
- {"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAwF;AACxF,iFAAqE;AACrE,uEAA0D;AAC1D,6DAAoF;AAEpF,uDAAoD;AACpD,mCAAyF;AAGzF,sDAAqF;AAmBrF,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,UAAU,CAC/B,kBAAuC,EACvC,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAAoC,EACpC,OAAgB,EAChB,mBAA6B;IAE7B,MAAM,iBAAiB,GAAG,IAAA,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,i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AC,CAAC;iBAC/B,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,EAAE,OAAO,CAAC,CAAC;KACZ;SAAM;QACN,OAAO,EAAE,EAAE,CAAC;KACZ;AACF,CAAC;AAjDD,8DAiDC","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 { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver\";\nimport { getSnapshotFileContent, timeoutPromise, getArgsValidationError } 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\n/**\n * @internal\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 * @internal\n */\nexport async function exportFile(\n\tfluidFileConverter: IFluidFileConverter,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n\ttimeout?: number,\n\tdisableNetworkFetch?: boolean,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ExportFile\" },\n\t\t\tasync () => {\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);\n\t\t\t\tif (argsValidationError) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: argsValidationError });\n\t\t\t\t\treturn { success: false, eventName, errorMessage: argsValidationError };\n\t\t\t\t}\n\n\t\t\t\tfs.writeFileSync(\n\t\t\t\t\toutputFile,\n\t\t\t\t\tawait createContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidFileConverter,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tdisableNetworkFetch,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n\n/**\n * Create the container based on an ODSP snapshot and execute code on it\n * @returns result of execution\n * @internal\n */\nexport async function createContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tlogger: ITelemetryLoggerExt,\n\toptions?: string,\n\ttimeout?: number,\n\tdisableNetworkFetch: boolean = false,\n): Promise<string> {\n\tconst fn = async () => {\n\t\tif (disableNetworkFetch) {\n\t\t\tglobal.fetch = async () => {\n\t\t\t\tthrow new Error(\"Network fetch is not allowed\");\n\t\t\t};\n\t\t}\n\n\t\tconst loader = new Loader({\n\t\t\turlResolver: new FakeUrlResolver(),\n\t\t\tdocumentServiceFactory: createLocalOdspDocumentServiceFactory(localOdspSnapshot),\n\t\t\tcodeLoader: await fluidFileConverter.getCodeLoader(logger),\n\t\t\tscope: await fluidFileConverter.getScope?.(logger),\n\t\t\tlogger,\n\t\t});\n\n\t\tconst container = await loader.resolve({\n\t\t\turl: \"/fakeUrl/\",\n\t\t\theaders: {\n\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t\t},\n\t\t});\n\n\t\treturn PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () => {\n\t\t\ttry {\n\t\t\t\treturn await fluidFileConverter.execute(container, options);\n\t\t\t} finally {\n\t\t\t\tcontainer.dispose();\n\t\t\t}\n\t\t});\n\t};\n\n\t// eslint-disable-next-line unicorn/prefer-ternary\n\tif (timeout !== undefined) {\n\t\treturn timeoutPromise<string>((resolve, reject) => {\n\t\t\tfn()\n\t\t\t\t.then((value) => resolve(value))\n\t\t\t\t.catch((error) => reject(error));\n\t\t}, timeout);\n\t} else {\n\t\treturn fn();\n\t}\n}\n"]}
1
+ {"version":3,"file":"exportFile.js","sourceRoot":"","sources":["../src/exportFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,qEAAwF;AACxF,iFAAqE;AACrE,uEAA0D;AAC1D,6DAAoF;AAEpF,uDAAoD;AACpD,mCAAyF;AAGzF,sDAAqF;AAmBrF,MAAM,yBAAyB,GAAG,4BAA4B,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,UAAU,CAC/B,kBAAuC,EACvC,SAAiB,EACjB,UAAkB,EAClB,aAAqB,EACrB,OAAgB,EAChB,gBAAoC,EACpC,OAAgB,EAChB,mBAA6B;IAE7B,MAAM,iBAAiB,GAAG,IAAA,6CAA+B,EAAC,aAAa,CAAC,CAAC;IACzE,IAAI,iBAA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OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,EAAE,EAAE;iBACF,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;iBAC/B,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC,EAAE,OAAO,CAAC,CAAC;KACZ;SAAM;QACN,OAAO,EAAE,EAAE,CAAC;KACZ;AACF,CAAC;AAjDD,8DAiDC","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 { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions\";\nimport { Loader } from \"@fluidframework/container-loader\";\nimport { createLocalOdspDocumentServiceFactory } from \"@fluidframework/odsp-driver\";\nimport { IFluidFileConverter } from \"./codeLoaderBundle\";\nimport { FakeUrlResolver } from \"./fakeUrlResolver\";\nimport { getSnapshotFileContent, timeoutPromise, getArgsValidationError } 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\n/**\n * @alpha\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 * @internal\n */\nexport async function exportFile(\n\tfluidFileConverter: IFluidFileConverter,\n\tinputFile: string,\n\toutputFile: string,\n\ttelemetryFile: string,\n\toptions?: string,\n\ttelemetryOptions?: ITelemetryOptions,\n\ttimeout?: number,\n\tdisableNetworkFetch?: boolean,\n): Promise<IExportFileResponse> {\n\tconst telemetryArgError = getTelemetryFileValidationError(telemetryFile);\n\tif (telemetryArgError) {\n\t\tconst eventName = clientArgsValidationError;\n\t\treturn { success: false, eventName, errorMessage: telemetryArgError };\n\t}\n\tconst { fileLogger, logger } = createLogger(telemetryFile, telemetryOptions);\n\n\ttry {\n\t\treturn await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"ExportFile\" },\n\t\t\tasync () => {\n\t\t\t\tconst argsValidationError = getArgsValidationError(inputFile, outputFile, timeout);\n\t\t\t\tif (argsValidationError) {\n\t\t\t\t\tconst eventName = clientArgsValidationError;\n\t\t\t\t\tlogger.sendErrorEvent({ eventName, message: argsValidationError });\n\t\t\t\t\treturn { success: false, eventName, errorMessage: argsValidationError };\n\t\t\t\t}\n\n\t\t\t\tfs.writeFileSync(\n\t\t\t\t\toutputFile,\n\t\t\t\t\tawait createContainerAndExecute(\n\t\t\t\t\t\tgetSnapshotFileContent(inputFile),\n\t\t\t\t\t\tfluidFileConverter,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\tdisableNetworkFetch,\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\treturn { success: true };\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tconst eventName = \"Client_UnexpectedError\";\n\t\tlogger.sendErrorEvent({ eventName }, error);\n\t\treturn { success: false, eventName, errorMessage: \"Unexpected error\", error };\n\t} finally {\n\t\tawait fileLogger.close();\n\t}\n}\n\n/**\n * Create the container based on an ODSP snapshot and execute code on it\n * @returns result of execution\n * @internal\n */\nexport async function createContainerAndExecute(\n\tlocalOdspSnapshot: string | Uint8Array,\n\tfluidFileConverter: IFluidFileConverter,\n\tlogger: ITelemetryLoggerExt,\n\toptions?: string,\n\ttimeout?: number,\n\tdisableNetworkFetch: boolean = false,\n): Promise<string> {\n\tconst fn = async () => {\n\t\tif (disableNetworkFetch) {\n\t\t\tglobal.fetch = async () => {\n\t\t\t\tthrow new Error(\"Network fetch is not allowed\");\n\t\t\t};\n\t\t}\n\n\t\tconst loader = new Loader({\n\t\t\turlResolver: new FakeUrlResolver(),\n\t\t\tdocumentServiceFactory: createLocalOdspDocumentServiceFactory(localOdspSnapshot),\n\t\t\tcodeLoader: await fluidFileConverter.getCodeLoader(logger),\n\t\t\tscope: await fluidFileConverter.getScope?.(logger),\n\t\t\tlogger,\n\t\t});\n\n\t\tconst container = await loader.resolve({\n\t\t\turl: \"/fakeUrl/\",\n\t\t\theaders: {\n\t\t\t\t[LoaderHeader.loadMode]: { opsBeforeReturn: \"cached\" },\n\t\t\t},\n\t\t});\n\n\t\treturn PerformanceEvent.timedExecAsync(logger, { eventName: \"ExportFile\" }, async () => {\n\t\t\ttry {\n\t\t\t\treturn await fluidFileConverter.execute(container, options);\n\t\t\t} finally {\n\t\t\t\tcontainer.dispose();\n\t\t\t}\n\t\t});\n\t};\n\n\t// eslint-disable-next-line unicorn/prefer-ternary\n\tif (timeout !== undefined) {\n\t\treturn timeoutPromise<string>((resolve, reject) => {\n\t\t\tfn()\n\t\t\t\t.then((value) => resolve(value))\n\t\t\t\t.catch((error) => reject(error));\n\t\t}, timeout);\n\t} else {\n\t\treturn fn();\n\t}\n}\n"]}
@@ -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 { }
@@ -15,7 +15,7 @@ export interface IFileLogger extends ITelemetryBaseLogger {
15
15
  }
16
16
  /**
17
17
  * Desired output format for the telemetry
18
- * @internal
18
+ * @alpha
19
19
  */
20
20
  export declare enum OutputFormat {
21
21
  JSON = 0,
@@ -30,7 +30,12 @@ export interface ITelemetryOptions {
30
30
  outputFormat?: OutputFormat;
31
31
  /**
32
32
  * Properties that should be added to every telemetry event
33
- * Example: { "prop1": "value1", "prop2": 10.0 }
33
+ *
34
+ * @example
35
+ *
36
+ * ```JSON
37
+ * { "prop1": "value1", "prop2": 10.0 }
38
+ * ```
34
39
  */
35
40
  defaultProps?: Record<string, string | number>;
36
41
  /** Number of telemetry events per flush to telemetry file */
@@ -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,iCAAiC,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACxD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;GAGG;AACH,oBAAY,YAAY;IACvB,IAAI,IAAA;IACJ,GAAG,IAAA;CACH;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
+ {"version":3,"file":"fileLogger.d.ts","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,oBAAoB;IACxD;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED;;;GAGG;AACH,oBAAY,YAAY;IACvB,IAAI,IAAA;IACJ,GAAG,IAAA;CACH;AAGD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,iFAAiF;IACjF,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAE/C,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.OutputFormat = void 0;
8
8
  /**
9
9
  * Desired output format for the telemetry
10
- * @internal
10
+ * @alpha
11
11
  */
12
12
  var OutputFormat;
13
13
  (function (OutputFormat) {
@@ -1 +1 @@
1
- {"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;;GAGG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,4BAAZ,YAAY,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/core-interfaces\";\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 * @internal\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
+ {"version":3,"file":"fileLogger.js","sourceRoot":"","sources":["../../src/logger/fileLogger.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;;GAGG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,+CAAI,CAAA;IACJ,6CAAG,CAAA;AACJ,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAyBD,gCAAgC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\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 * @alpha\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 *\n\t * @example\n\t *\n\t * ```JSON\n\t * { \"prop1\": \"value1\", \"prop2\": 10.0 }\n\t * ```\n\t */\n\tdefaultProps?: Record<string, string | number>;\n\n\t/** Number of telemetry events per flush to telemetry file */\n\teventsPerFlush?: number;\n}\n/* eslint-enable tsdoc/syntax */\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.38.3"
9
+ }
10
+ ]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/fluid-runner",
3
- "version": "2.0.0-internal.8.0.1",
3
+ "version": "2.0.0-rc.1.0.1",
4
4
  "description": "Utility for running various functionality inside a Fluid Framework environment",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -10,6 +10,29 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
+ "type": "commonjs",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./alpha": {
20
+ "types": "./dist/fluid-runner-alpha.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./beta": {
24
+ "types": "./dist/fluid-runner-beta.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./internal": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./public": {
32
+ "types": "./dist/fluid-runner-public.d.ts",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
13
36
  "main": "dist/index.js",
14
37
  "types": "dist/index.d.ts",
15
38
  "bin": {
@@ -19,13 +42,13 @@
19
42
  "all": true,
20
43
  "cache-dir": "nyc/.cache",
21
44
  "exclude": [
22
- "src/test/**/*.ts",
23
- "dist/test/**/*.js"
45
+ "src/test/**/*.*ts",
46
+ "dist/test/**/*.*js"
24
47
  ],
25
48
  "exclude-after-remap": false,
26
49
  "include": [
27
- "src/**/*.ts",
28
- "dist/**/*.js"
50
+ "src/**/*.*ts",
51
+ "dist/**/*.*js"
29
52
  ],
30
53
  "report-dir": "nyc/report",
31
54
  "reporter": [
@@ -36,29 +59,30 @@
36
59
  "temp-directory": "nyc/.nyc_output"
37
60
  },
38
61
  "dependencies": {
39
- "@fluidframework/aqueduct": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
40
- "@fluidframework/container-definitions": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
41
- "@fluidframework/container-loader": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
42
- "@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
43
- "@fluidframework/driver-definitions": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
44
- "@fluidframework/odsp-driver": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
45
- "@fluidframework/odsp-driver-definitions": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
46
- "@fluidframework/telemetry-utils": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
62
+ "@fluidframework/aqueduct": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
63
+ "@fluidframework/container-definitions": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
64
+ "@fluidframework/container-loader": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
65
+ "@fluidframework/core-interfaces": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
66
+ "@fluidframework/driver-definitions": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
67
+ "@fluidframework/odsp-driver": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
68
+ "@fluidframework/odsp-driver-definitions": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
69
+ "@fluidframework/telemetry-utils": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
70
+ "@microsoft/api-extractor": "^7.38.3",
47
71
  "json2csv": "^5.0.7",
48
72
  "yargs": "13.2.2"
49
73
  },
50
74
  "devDependencies": {
51
75
  "@arethetypeswrong/cli": "^0.13.3",
52
- "@fluid-tools/build-cli": "^0.28.0",
76
+ "@fluid-tools/build-cli": "^0.29.0",
53
77
  "@fluidframework/build-common": "^2.0.3",
54
- "@fluidframework/build-tools": "^0.28.0",
55
- "@fluidframework/eslint-config-fluid": "^3.1.0",
56
- "@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.0.0-internal.7.2.0",
57
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.8.0.1 <2.0.0-internal.8.1.0",
78
+ "@fluidframework/build-tools": "^0.29.0",
79
+ "@fluidframework/eslint-config-fluid": "^3.2.0",
80
+ "@fluidframework/fluid-runner-previous": "npm:@fluidframework/fluid-runner@2.0.0-internal.8.0.0",
81
+ "@fluidframework/mocha-test-setup": ">=2.0.0-rc.1.0.1 <2.0.0-rc.1.1.0",
58
82
  "@types/mocha": "^9.1.1",
59
83
  "@types/node": "^18.19.0",
60
84
  "@types/yargs": "^13",
61
- "c8": "^7.7.1",
85
+ "c8": "^8.0.1",
62
86
  "cross-env": "^7.0.3",
63
87
  "eslint": "~8.50.0",
64
88
  "mocha": "^10.2.0",
@@ -69,16 +93,31 @@
69
93
  "rimraf": "^4.4.0",
70
94
  "typescript": "~5.1.6"
71
95
  },
96
+ "fluidBuild": {
97
+ "tasks": {
98
+ "build:docs": {
99
+ "dependsOn": [
100
+ "...",
101
+ "api-extractor:commonjs"
102
+ ],
103
+ "script": false
104
+ }
105
+ }
106
+ },
72
107
  "typeValidation": {
73
108
  "broken": {}
74
109
  },
75
110
  "scripts": {
111
+ "api": "fluid-build . --task api",
112
+ "api-extractor:commonjs": "api-extractor run --local",
76
113
  "build": "fluid-build . --task build",
77
114
  "build:commonjs": "fluid-build . --task commonjs",
78
115
  "build:compile": "fluid-build . --task compile",
116
+ "build:docs": "fluid-build . --task api",
79
117
  "build:test": "tsc --project ./src/test/tsconfig.json",
80
- "check:are-the-types-wrong": "attw --pack",
81
- "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc",
118
+ "check:are-the-types-wrong": "attw --pack . --entrypoints .",
119
+ "ci:build:docs": "api-extractor run",
120
+ "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc _api-extractor-temp",
82
121
  "eslint": "eslint --format stylish src",
83
122
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
84
123
  "format": "npm run prettier:fix",
@@ -20,7 +20,7 @@ export interface ICodeLoaderBundle {
20
20
 
21
21
  /**
22
22
  * Instance that holds all the details for Fluid file conversion
23
- * @internal
23
+ * @alpha
24
24
  */
25
25
  export interface IFluidFileConverter {
26
26
  /**
package/src/exportFile.ts CHANGED
@@ -17,7 +17,7 @@ import { createLogger, getTelemetryFileValidationError } from "./logger/loggerUt
17
17
  /* eslint-enable import/no-internal-modules */
18
18
 
19
19
  /**
20
- * @internal
20
+ * @alpha
21
21
  */
22
22
  export type IExportFileResponse = IExportFileResponseSuccess | IExportFileResponseFailure;
23
23
 
@@ -18,7 +18,7 @@ export interface IFileLogger extends ITelemetryBaseLogger {
18
18
 
19
19
  /**
20
20
  * Desired output format for the telemetry
21
- * @internal
21
+ * @alpha
22
22
  */
23
23
  export enum OutputFormat {
24
24
  JSON,
@@ -36,7 +36,12 @@ export interface ITelemetryOptions {
36
36
 
37
37
  /**
38
38
  * Properties that should be added to every telemetry event
39
- * Example: { "prop1": "value1", "prop2": 10.0 }
39
+ *
40
+ * @example
41
+ *
42
+ * ```JSON
43
+ * { "prop1": "value1", "prop2": 10.0 }
44
+ * ```
40
45
  */
41
46
  defaultProps?: Record<string, string | number>;
42
47
 
package/tsconfig.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
2
+ "extends": [
3
+ "../../../common/build/build-common/tsconfig.base.json",
4
+ "../../../common/build/build-common/tsconfig.cjs.json",
5
+ ],
6
+ "include": ["src/**/*"],
3
7
  "exclude": ["src/test/**/*"],
4
8
  "compilerOptions": {
5
9
  "rootDir": "./src",
6
10
  "outDir": "./dist",
7
11
  "types": ["node"],
8
- "composite": true,
9
12
  },
10
- "include": ["src/**/*"],
11
13
  }
File without changes