@fluidframework/devtools 2.1.0 → 2.3.0-288113
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 +4 -0
- package/README.md +2 -2
- package/api-report/devtools.alpha.api.md +0 -2
- package/api-report/devtools.beta.api.md +0 -2
- package/api-report/devtools.public.api.md +0 -2
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -21
- package/dist/index.js.map +1 -1
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -19
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
- package/src/index.ts +9 -22
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ It is used to power our associated [browser extension][browser-extension].
|
|
|
6
6
|
- Chrome: <https://aka.ms/fluid/devtool/chrome>
|
|
7
7
|
- Edge: <https://aka.ms/fluid/devtool/edge>
|
|
8
8
|
|
|
9
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
9
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER:devDependency=TRUE) -->
|
|
10
10
|
|
|
11
11
|
<!-- prettier-ignore-start -->
|
|
12
12
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
@@ -144,7 +144,7 @@ Next, to build the code, run `npm run build` from the root of the mono-repo, or
|
|
|
144
144
|
To run the tests, first ensure you have followed the [build](#build) steps above.
|
|
145
145
|
Next, run `npm run test` from a terminal within this directory.
|
|
146
146
|
|
|
147
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
147
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) -->
|
|
148
148
|
|
|
149
149
|
<!-- prettier-ignore-start -->
|
|
150
150
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Primary entry-point to the Fluid Devtools.
|
|
7
|
+
*
|
|
8
|
+
* To initialize the Devtools alongside your application's {@link @fluidframework/fluid-static#IFluidContainer}, call
|
|
9
|
+
* {@link initializeDevtools}.
|
|
10
|
+
*
|
|
11
|
+
* The Devtools will automatically dispose of themselves upon Window unload, but if you would like to close them
|
|
12
|
+
* earlier, call {@link IDevtools.dispose}.
|
|
13
|
+
*
|
|
14
|
+
* To enable visualization of Telemetry data, you may create a {@link @fluidframework/devtools-core#DevtoolsLogger} and
|
|
15
|
+
* provide it during Devtools initialization.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
5
19
|
import type { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
20
|
import { type HasContainerKey, type IDevtoolsLogger } from "@fluidframework/devtools-core/internal";
|
|
7
21
|
import type { IFluidContainer } from "@fluidframework/fluid-static";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAEN,KAAK,eAAe,EAEpB,KAAK,eAAe,EAEpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAG7C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC9D;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC;CAG3B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC7C;;;;;;;OAOG;IACH,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAE/D;;OAEG;IACH,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAwCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAUlE;AA2BD,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACpB,MAAM,wCAAwC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.createDevtoolsLogger = exports.initializeDevtools = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/devtools-core/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/fluid-static/internal");
|
|
9
10
|
class Devtools {
|
|
10
11
|
constructor(
|
|
11
12
|
/**
|
|
@@ -19,9 +20,7 @@ class Devtools {
|
|
|
19
20
|
*/
|
|
20
21
|
registerContainerDevtools(props) {
|
|
21
22
|
const mappedProps = mapContainerProps(props);
|
|
22
|
-
|
|
23
|
-
this._devtools.registerContainerDevtools(mappedProps);
|
|
24
|
-
}
|
|
23
|
+
this._devtools.registerContainerDevtools(mappedProps);
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* {@inheritDoc IDevtools.closeContainerDevtools}
|
|
@@ -50,16 +49,7 @@ class Devtools {
|
|
|
50
49
|
*/
|
|
51
50
|
function initializeDevtools(props) {
|
|
52
51
|
const { initialContainers, logger } = props;
|
|
53
|
-
|
|
54
|
-
if (initialContainers !== undefined) {
|
|
55
|
-
mappedInitialContainers = [];
|
|
56
|
-
for (const containerProps of initialContainers) {
|
|
57
|
-
const mappedContainerProps = mapContainerProps(containerProps);
|
|
58
|
-
if (mappedContainerProps !== undefined) {
|
|
59
|
-
mappedInitialContainers.push(mappedContainerProps);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
52
|
+
const mappedInitialContainers = initialContainers?.map((p) => mapContainerProps(p));
|
|
63
53
|
const baseDevtools = (0, internal_1.initializeDevtools)({
|
|
64
54
|
logger,
|
|
65
55
|
initialContainers: mappedInitialContainers,
|
|
@@ -73,14 +63,11 @@ exports.initializeDevtools = initializeDevtools;
|
|
|
73
63
|
*/
|
|
74
64
|
function mapContainerProps(containerProps) {
|
|
75
65
|
const { container, containerKey } = containerProps;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
console.error("Missing Container accessor on FluidContainer.");
|
|
79
|
-
return undefined;
|
|
66
|
+
if (!(0, internal_2.isInternalFluidContainer)(container)) {
|
|
67
|
+
throw new TypeError("IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported.");
|
|
80
68
|
}
|
|
81
|
-
const innerContainer = fluidContainer.INTERNAL_CONTAINER_DO_NOT_USE();
|
|
82
69
|
return {
|
|
83
|
-
container:
|
|
70
|
+
container: container.container,
|
|
84
71
|
containerKey,
|
|
85
72
|
containerData: container.initialObjects,
|
|
86
73
|
};
|
|
@@ -89,6 +76,6 @@ function mapContainerProps(containerProps) {
|
|
|
89
76
|
// so consumers don't need to import from this one *and* devtools-core.
|
|
90
77
|
// DevtoolsLogger is necessary for consumers to set up Devtools.
|
|
91
78
|
// ContainerDevtoolsProps extends HasContainerKey, so it needs ContainerKey.
|
|
92
|
-
var
|
|
93
|
-
Object.defineProperty(exports, "createDevtoolsLogger", { enumerable: true, get: function () { return
|
|
79
|
+
var internal_3 = require("@fluidframework/devtools-core/internal");
|
|
80
|
+
Object.defineProperty(exports, "createDevtoolsLogger", { enumerable: true, get: function () { return internal_3.createDevtoolsLogger; } });
|
|
94
81
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkBH,qEAMgD;AAEhD,oEAAiF;AAyEjF,MAAM,QAAQ;IACb;IACC;;OAEG;IACc,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IACvC,CAAC;IAEJ;;OAEG;IACI,yBAAyB,CAAC,KAA6B;QAC7D,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,EAAU;QACvC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,OAAO;QACb,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACD;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAoB;IACtD,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,uBAAuB,GAAG,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpF,MAAM,YAAY,GAAG,IAAA,6BAAsB,EAAC;QAC3C,MAAM;QACN,iBAAiB,EAAE,uBAAuB;KAC1C,CAAC,CAAC;IACH,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC;AAVD,gDAUC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CACzB,cAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,cAAc,CAAC;IACnD,IAAI,CAAC,IAAA,mCAAwB,EAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,CAClB,qGAAqG,CACrG,CAAC;IACH,CAAC;IAED,OAAO;QACN,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,YAAY;QACZ,aAAa,EAAE,SAAS,CAAC,cAAgD;KACzE,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,uEAAuE;AACvE,gEAAgE;AAChE,4EAA4E;AAC5E,mEAKgD;AAF/C,gHAAA,oBAAoB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Primary entry-point to the Fluid Devtools.\n *\n * To initialize the Devtools alongside your application's {@link @fluidframework/fluid-static#IFluidContainer}, call\n * {@link initializeDevtools}.\n *\n * The Devtools will automatically dispose of themselves upon Window unload, but if you would like to close them\n * earlier, call {@link IDevtools.dispose}.\n *\n * To enable visualization of Telemetry data, you may create a {@link @fluidframework/devtools-core#DevtoolsLogger} and\n * provide it during Devtools initialization.\n *\n * @packageDocumentation\n */\n\nimport type { IDisposable, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport {\n\ttype ContainerDevtoolsProps as ContainerDevtoolsPropsBase,\n\ttype HasContainerKey,\n\ttype IFluidDevtools as IDevtoolsBase,\n\ttype IDevtoolsLogger,\n\tinitializeDevtools as initializeDevtoolsBase,\n} from \"@fluidframework/devtools-core/internal\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { isInternalFluidContainer } from \"@fluidframework/fluid-static/internal\";\n\n/**\n * Properties for configuring {@link IDevtools}.\n * @beta\n */\nexport interface DevtoolsProps {\n\t/**\n\t * (optional) telemetry logger associated with the Fluid runtime.\n\t *\n\t * @remarks\n\t *\n\t * Note: the Devtools do not register this logger with the Fluid runtime; that must be done separately.\n\t *\n\t * This is provided to the Devtools instance strictly to enable communicating supported / desired functionality with\n\t * external listeners.\n\t */\n\tlogger?: IDevtoolsLogger;\n\n\t/**\n\t * (optional) List of Containers to initialize the devtools with.\n\t *\n\t * @remarks Additional Containers can be registered with the Devtools via {@link IDevtools.registerContainerDevtools}.\n\t */\n\tinitialContainers?: ContainerDevtoolsProps[];\n\n\t// TODO: Add ability for customers to specify custom data visualizer overrides\n}\n\n/**\n * Properties for configuring Devtools for an individual {@link @fluidframework/fluid-static#IFluidContainer}.\n * @beta\n */\nexport interface ContainerDevtoolsProps extends HasContainerKey {\n\t/**\n\t * The Container to register with the Devtools.\n\t */\n\tcontainer: IFluidContainer;\n\n\t// TODO: Add ability for customers to specify custom data visualizer overrides\n}\n\n/**\n * Fluid Devtools. A single, global instance is used to generate and communicate stats associated with the general Fluid\n * runtime (i.e., it is not associated with any single Framework entity).\n *\n * @remarks\n *\n * Supports registering {@link @fluidframework/fluid-static#IFluidContainer}s for Container-level stats\n * (via {@link IDevtools.registerContainerDevtools}).\n *\n * The lifetime of the associated singleton is bound by that of the Window (globalThis), and it will be automatically\n * disposed of on Window unload.\n * If you wish to dispose of it earlier, you may call its {@link @fluidframework/core-interfaces#IDisposable.dispose} method.\n * @beta\n */\nexport interface IDevtools extends IDisposable {\n\t/**\n\t * Initializes a {@link IDevtools} from the provided properties and stores it for future reference.\n\t *\n\t * @throws\n\t *\n\t * Will throw if devtools have already been registered for the specified\n\t * {@link @fluidframework/devtools-core#HasContainerKey.containerKey}.\n\t */\n\tregisterContainerDevtools(props: ContainerDevtoolsProps): void;\n\n\t/**\n\t * Closes registered Container-level Devtools associated with the provided ID.\n\t */\n\tcloseContainerDevtools(id: string): void;\n}\n\nclass Devtools implements IDevtools {\n\tpublic constructor(\n\t\t/**\n\t\t * Handle to the underlying Devtools instance (singleton).\n\t\t */\n\t\tprivate readonly _devtools: IDevtoolsBase,\n\t) {}\n\n\t/**\n\t * {@inheritDoc IDevtools.registerContainerDevtools}\n\t */\n\tpublic registerContainerDevtools(props: ContainerDevtoolsProps): void {\n\t\tconst mappedProps = mapContainerProps(props);\n\t\tthis._devtools.registerContainerDevtools(mappedProps);\n\t}\n\n\t/**\n\t * {@inheritDoc IDevtools.closeContainerDevtools}\n\t */\n\tpublic closeContainerDevtools(id: string): void {\n\t\tthis._devtools.closeContainerDevtools(id);\n\t}\n\n\t/**\n\t * {@inheritDoc IDevtools.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this._devtools.disposed;\n\t}\n\n\t/**\n\t * {@inheritDoc IDevtools.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis._devtools.dispose();\n\t}\n}\n\n/**\n * Initializes the Devtools singleton and returns a handle to it.\n *\n * @see {@link @fluidframework/devtools-core#initializeDevtoolsBase}\n * @beta\n */\nexport function initializeDevtools(props: DevtoolsProps): IDevtools {\n\tconst { initialContainers, logger } = props;\n\n\tconst mappedInitialContainers = initialContainers?.map((p) => mapContainerProps(p));\n\n\tconst baseDevtools = initializeDevtoolsBase({\n\t\tlogger,\n\t\tinitialContainers: mappedInitialContainers,\n\t});\n\treturn new Devtools(baseDevtools);\n}\n\n/**\n * Maps the input props to lower-level {@link @fluidframework/devtools-core#ContainerDevtoolsPropsBase},\n * to be forwarded on to the base library.\n */\nfunction mapContainerProps(\n\tcontainerProps: ContainerDevtoolsProps,\n): ContainerDevtoolsPropsBase {\n\tconst { container, containerKey } = containerProps;\n\tif (!isInternalFluidContainer(container)) {\n\t\tthrow new TypeError(\n\t\t\t\"IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported.\",\n\t\t);\n\t}\n\n\treturn {\n\t\tcontainer: container.container,\n\t\tcontainerKey,\n\t\tcontainerData: container.initialObjects as Record<string, IFluidLoadable>,\n\t};\n}\n\n// Convenience re-exports. Need to cover the things we export form this package,\n// so consumers don't need to import from this one *and* devtools-core.\n// DevtoolsLogger is necessary for consumers to set up Devtools.\n// ContainerDevtoolsProps extends HasContainerKey, so it needs ContainerKey.\nexport {\n\ttype ContainerKey,\n\ttype HasContainerKey,\n\tcreateDevtoolsLogger,\n\ttype IDevtoolsLogger,\n} from \"@fluidframework/devtools-core/internal\";\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Primary entry-point to the Fluid Devtools.
|
|
7
|
+
*
|
|
8
|
+
* To initialize the Devtools alongside your application's {@link @fluidframework/fluid-static#IFluidContainer}, call
|
|
9
|
+
* {@link initializeDevtools}.
|
|
10
|
+
*
|
|
11
|
+
* The Devtools will automatically dispose of themselves upon Window unload, but if you would like to close them
|
|
12
|
+
* earlier, call {@link IDevtools.dispose}.
|
|
13
|
+
*
|
|
14
|
+
* To enable visualization of Telemetry data, you may create a {@link @fluidframework/devtools-core#DevtoolsLogger} and
|
|
15
|
+
* provide it during Devtools initialization.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
5
19
|
import type { IDisposable } from "@fluidframework/core-interfaces";
|
|
6
20
|
import { type HasContainerKey, type IDevtoolsLogger } from "@fluidframework/devtools-core/internal";
|
|
7
21
|
import type { IFluidContainer } from "@fluidframework/fluid-static";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAEN,KAAK,eAAe,EAEpB,KAAK,eAAe,EAEpB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAG7C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,eAAe;IAC9D;;OAEG;IACH,SAAS,EAAE,eAAe,CAAC;CAG3B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC7C;;;;;;;OAOG;IACH,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAE/D;;OAEG;IACH,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAwCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAUlE;AA2BD,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACpB,MAAM,wCAAwC,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { initializeDevtools as initializeDevtoolsBase, } from "@fluidframework/devtools-core/internal";
|
|
6
|
+
import { isInternalFluidContainer } from "@fluidframework/fluid-static/internal";
|
|
6
7
|
class Devtools {
|
|
7
8
|
constructor(
|
|
8
9
|
/**
|
|
@@ -16,9 +17,7 @@ class Devtools {
|
|
|
16
17
|
*/
|
|
17
18
|
registerContainerDevtools(props) {
|
|
18
19
|
const mappedProps = mapContainerProps(props);
|
|
19
|
-
|
|
20
|
-
this._devtools.registerContainerDevtools(mappedProps);
|
|
21
|
-
}
|
|
20
|
+
this._devtools.registerContainerDevtools(mappedProps);
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* {@inheritDoc IDevtools.closeContainerDevtools}
|
|
@@ -47,16 +46,7 @@ class Devtools {
|
|
|
47
46
|
*/
|
|
48
47
|
export function initializeDevtools(props) {
|
|
49
48
|
const { initialContainers, logger } = props;
|
|
50
|
-
|
|
51
|
-
if (initialContainers !== undefined) {
|
|
52
|
-
mappedInitialContainers = [];
|
|
53
|
-
for (const containerProps of initialContainers) {
|
|
54
|
-
const mappedContainerProps = mapContainerProps(containerProps);
|
|
55
|
-
if (mappedContainerProps !== undefined) {
|
|
56
|
-
mappedInitialContainers.push(mappedContainerProps);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
49
|
+
const mappedInitialContainers = initialContainers?.map((p) => mapContainerProps(p));
|
|
60
50
|
const baseDevtools = initializeDevtoolsBase({
|
|
61
51
|
logger,
|
|
62
52
|
initialContainers: mappedInitialContainers,
|
|
@@ -69,14 +59,11 @@ export function initializeDevtools(props) {
|
|
|
69
59
|
*/
|
|
70
60
|
function mapContainerProps(containerProps) {
|
|
71
61
|
const { container, containerKey } = containerProps;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
console.error("Missing Container accessor on FluidContainer.");
|
|
75
|
-
return undefined;
|
|
62
|
+
if (!isInternalFluidContainer(container)) {
|
|
63
|
+
throw new TypeError("IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported.");
|
|
76
64
|
}
|
|
77
|
-
const innerContainer = fluidContainer.INTERNAL_CONTAINER_DO_NOT_USE();
|
|
78
65
|
return {
|
|
79
|
-
container:
|
|
66
|
+
container: container.container,
|
|
80
67
|
containerKey,
|
|
81
68
|
containerData: container.initialObjects,
|
|
82
69
|
};
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkBH,OAAO,EAKN,kBAAkB,IAAI,sBAAsB,GAC5C,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAyEjF,MAAM,QAAQ;IACb;IACC;;OAEG;IACc,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;IACvC,CAAC;IAEJ;;OAEG;IACI,yBAAyB,CAAC,KAA6B;QAC7D,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,EAAU;QACvC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,OAAO;QACb,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAoB;IACtD,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE5C,MAAM,uBAAuB,GAAG,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpF,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAC3C,MAAM;QACN,iBAAiB,EAAE,uBAAuB;KAC1C,CAAC,CAAC;IACH,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,SAAS,iBAAiB,CACzB,cAAsC;IAEtC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,cAAc,CAAC;IACnD,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,CAClB,qGAAqG,CACrG,CAAC;IACH,CAAC;IAED,OAAO;QACN,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,YAAY;QACZ,aAAa,EAAE,SAAS,CAAC,cAAgD;KACzE,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,uEAAuE;AACvE,gEAAgE;AAChE,4EAA4E;AAC5E,OAAO,EAGN,oBAAoB,GAEpB,MAAM,wCAAwC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Primary entry-point to the Fluid Devtools.\n *\n * To initialize the Devtools alongside your application's {@link @fluidframework/fluid-static#IFluidContainer}, call\n * {@link initializeDevtools}.\n *\n * The Devtools will automatically dispose of themselves upon Window unload, but if you would like to close them\n * earlier, call {@link IDevtools.dispose}.\n *\n * To enable visualization of Telemetry data, you may create a {@link @fluidframework/devtools-core#DevtoolsLogger} and\n * provide it during Devtools initialization.\n *\n * @packageDocumentation\n */\n\nimport type { IDisposable, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport {\n\ttype ContainerDevtoolsProps as ContainerDevtoolsPropsBase,\n\ttype HasContainerKey,\n\ttype IFluidDevtools as IDevtoolsBase,\n\ttype IDevtoolsLogger,\n\tinitializeDevtools as initializeDevtoolsBase,\n} from \"@fluidframework/devtools-core/internal\";\nimport type { IFluidContainer } from \"@fluidframework/fluid-static\";\nimport { isInternalFluidContainer } from \"@fluidframework/fluid-static/internal\";\n\n/**\n * Properties for configuring {@link IDevtools}.\n * @beta\n */\nexport interface DevtoolsProps {\n\t/**\n\t * (optional) telemetry logger associated with the Fluid runtime.\n\t *\n\t * @remarks\n\t *\n\t * Note: the Devtools do not register this logger with the Fluid runtime; that must be done separately.\n\t *\n\t * This is provided to the Devtools instance strictly to enable communicating supported / desired functionality with\n\t * external listeners.\n\t */\n\tlogger?: IDevtoolsLogger;\n\n\t/**\n\t * (optional) List of Containers to initialize the devtools with.\n\t *\n\t * @remarks Additional Containers can be registered with the Devtools via {@link IDevtools.registerContainerDevtools}.\n\t */\n\tinitialContainers?: ContainerDevtoolsProps[];\n\n\t// TODO: Add ability for customers to specify custom data visualizer overrides\n}\n\n/**\n * Properties for configuring Devtools for an individual {@link @fluidframework/fluid-static#IFluidContainer}.\n * @beta\n */\nexport interface ContainerDevtoolsProps extends HasContainerKey {\n\t/**\n\t * The Container to register with the Devtools.\n\t */\n\tcontainer: IFluidContainer;\n\n\t// TODO: Add ability for customers to specify custom data visualizer overrides\n}\n\n/**\n * Fluid Devtools. A single, global instance is used to generate and communicate stats associated with the general Fluid\n * runtime (i.e., it is not associated with any single Framework entity).\n *\n * @remarks\n *\n * Supports registering {@link @fluidframework/fluid-static#IFluidContainer}s for Container-level stats\n * (via {@link IDevtools.registerContainerDevtools}).\n *\n * The lifetime of the associated singleton is bound by that of the Window (globalThis), and it will be automatically\n * disposed of on Window unload.\n * If you wish to dispose of it earlier, you may call its {@link @fluidframework/core-interfaces#IDisposable.dispose} method.\n * @beta\n */\nexport interface IDevtools extends IDisposable {\n\t/**\n\t * Initializes a {@link IDevtools} from the provided properties and stores it for future reference.\n\t *\n\t * @throws\n\t *\n\t * Will throw if devtools have already been registered for the specified\n\t * {@link @fluidframework/devtools-core#HasContainerKey.containerKey}.\n\t */\n\tregisterContainerDevtools(props: ContainerDevtoolsProps): void;\n\n\t/**\n\t * Closes registered Container-level Devtools associated with the provided ID.\n\t */\n\tcloseContainerDevtools(id: string): void;\n}\n\nclass Devtools implements IDevtools {\n\tpublic constructor(\n\t\t/**\n\t\t * Handle to the underlying Devtools instance (singleton).\n\t\t */\n\t\tprivate readonly _devtools: IDevtoolsBase,\n\t) {}\n\n\t/**\n\t * {@inheritDoc IDevtools.registerContainerDevtools}\n\t */\n\tpublic registerContainerDevtools(props: ContainerDevtoolsProps): void {\n\t\tconst mappedProps = mapContainerProps(props);\n\t\tthis._devtools.registerContainerDevtools(mappedProps);\n\t}\n\n\t/**\n\t * {@inheritDoc IDevtools.closeContainerDevtools}\n\t */\n\tpublic closeContainerDevtools(id: string): void {\n\t\tthis._devtools.closeContainerDevtools(id);\n\t}\n\n\t/**\n\t * {@inheritDoc IDevtools.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this._devtools.disposed;\n\t}\n\n\t/**\n\t * {@inheritDoc IDevtools.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis._devtools.dispose();\n\t}\n}\n\n/**\n * Initializes the Devtools singleton and returns a handle to it.\n *\n * @see {@link @fluidframework/devtools-core#initializeDevtoolsBase}\n * @beta\n */\nexport function initializeDevtools(props: DevtoolsProps): IDevtools {\n\tconst { initialContainers, logger } = props;\n\n\tconst mappedInitialContainers = initialContainers?.map((p) => mapContainerProps(p));\n\n\tconst baseDevtools = initializeDevtoolsBase({\n\t\tlogger,\n\t\tinitialContainers: mappedInitialContainers,\n\t});\n\treturn new Devtools(baseDevtools);\n}\n\n/**\n * Maps the input props to lower-level {@link @fluidframework/devtools-core#ContainerDevtoolsPropsBase},\n * to be forwarded on to the base library.\n */\nfunction mapContainerProps(\n\tcontainerProps: ContainerDevtoolsProps,\n): ContainerDevtoolsPropsBase {\n\tconst { container, containerKey } = containerProps;\n\tif (!isInternalFluidContainer(container)) {\n\t\tthrow new TypeError(\n\t\t\t\"IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported.\",\n\t\t);\n\t}\n\n\treturn {\n\t\tcontainer: container.container,\n\t\tcontainerKey,\n\t\tcontainerData: container.initialObjects as Record<string, IFluidLoadable>,\n\t};\n}\n\n// Convenience re-exports. Need to cover the things we export form this package,\n// so consumers don't need to import from this one *and* devtools-core.\n// DevtoolsLogger is necessary for consumers to set up Devtools.\n// ContainerDevtoolsProps extends HasContainerKey, so it needs ContainerKey.\nexport {\n\ttype ContainerKey,\n\ttype HasContainerKey,\n\tcreateDevtoolsLogger,\n\ttype IDevtoolsLogger,\n} from \"@fluidframework/devtools-core/internal\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/devtools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-288113",
|
|
4
4
|
"description": "Fluid Framework developer tools",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -77,19 +77,19 @@
|
|
|
77
77
|
"temp-directory": "nyc/.nyc_output"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@fluidframework/container-definitions": "
|
|
81
|
-
"@fluidframework/core-interfaces": "
|
|
82
|
-
"@fluidframework/devtools-core": "
|
|
83
|
-
"@fluidframework/fluid-static": "
|
|
80
|
+
"@fluidframework/container-definitions": "2.3.0-288113",
|
|
81
|
+
"@fluidframework/core-interfaces": "2.3.0-288113",
|
|
82
|
+
"@fluidframework/devtools-core": "2.3.0-288113",
|
|
83
|
+
"@fluidframework/fluid-static": "2.3.0-288113"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
87
87
|
"@biomejs/biome": "~1.8.3",
|
|
88
|
-
"@fluid-internal/mocha-test-setup": "
|
|
89
|
-
"@fluid-tools/build-cli": "^0.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "2.3.0-288113",
|
|
89
|
+
"@fluid-tools/build-cli": "^0.43.0",
|
|
90
90
|
"@fluidframework/build-common": "^2.0.3",
|
|
91
|
-
"@fluidframework/build-tools": "^0.
|
|
92
|
-
"@fluidframework/devtools-previous": "npm:@fluidframework/devtools@2.
|
|
91
|
+
"@fluidframework/build-tools": "^0.43.0",
|
|
92
|
+
"@fluidframework/devtools-previous": "npm:@fluidframework/devtools@2.2.0",
|
|
93
93
|
"@fluidframework/eslint-config-fluid": "^5.3.0",
|
|
94
94
|
"@microsoft/api-extractor": "^7.45.1",
|
|
95
95
|
"@types/chai": "^4.0.0",
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import type { IContainer } from "@fluidframework/container-definitions/internal";
|
|
22
21
|
import type { IDisposable, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
23
22
|
import {
|
|
24
23
|
type ContainerDevtoolsProps as ContainerDevtoolsPropsBase,
|
|
@@ -28,6 +27,7 @@ import {
|
|
|
28
27
|
initializeDevtools as initializeDevtoolsBase,
|
|
29
28
|
} from "@fluidframework/devtools-core/internal";
|
|
30
29
|
import type { IFluidContainer } from "@fluidframework/fluid-static";
|
|
30
|
+
import { isInternalFluidContainer } from "@fluidframework/fluid-static/internal";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Properties for configuring {@link IDevtools}.
|
|
@@ -113,9 +113,7 @@ class Devtools implements IDevtools {
|
|
|
113
113
|
*/
|
|
114
114
|
public registerContainerDevtools(props: ContainerDevtoolsProps): void {
|
|
115
115
|
const mappedProps = mapContainerProps(props);
|
|
116
|
-
|
|
117
|
-
this._devtools.registerContainerDevtools(mappedProps);
|
|
118
|
-
}
|
|
116
|
+
this._devtools.registerContainerDevtools(mappedProps);
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
/**
|
|
@@ -149,16 +147,7 @@ class Devtools implements IDevtools {
|
|
|
149
147
|
export function initializeDevtools(props: DevtoolsProps): IDevtools {
|
|
150
148
|
const { initialContainers, logger } = props;
|
|
151
149
|
|
|
152
|
-
|
|
153
|
-
if (initialContainers !== undefined) {
|
|
154
|
-
mappedInitialContainers = [];
|
|
155
|
-
for (const containerProps of initialContainers) {
|
|
156
|
-
const mappedContainerProps = mapContainerProps(containerProps);
|
|
157
|
-
if (mappedContainerProps !== undefined) {
|
|
158
|
-
mappedInitialContainers.push(mappedContainerProps);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
150
|
+
const mappedInitialContainers = initialContainers?.map((p) => mapContainerProps(p));
|
|
162
151
|
|
|
163
152
|
const baseDevtools = initializeDevtoolsBase({
|
|
164
153
|
logger,
|
|
@@ -173,18 +162,16 @@ export function initializeDevtools(props: DevtoolsProps): IDevtools {
|
|
|
173
162
|
*/
|
|
174
163
|
function mapContainerProps(
|
|
175
164
|
containerProps: ContainerDevtoolsProps,
|
|
176
|
-
): ContainerDevtoolsPropsBase
|
|
165
|
+
): ContainerDevtoolsPropsBase {
|
|
177
166
|
const { container, containerKey } = containerProps;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return undefined;
|
|
167
|
+
if (!isInternalFluidContainer(container)) {
|
|
168
|
+
throw new TypeError(
|
|
169
|
+
"IFluidContainer was not recognized. Only Containers generated by the Fluid Framework are supported.",
|
|
170
|
+
);
|
|
183
171
|
}
|
|
184
172
|
|
|
185
|
-
const innerContainer = fluidContainer.INTERNAL_CONTAINER_DO_NOT_USE();
|
|
186
173
|
return {
|
|
187
|
-
container:
|
|
174
|
+
container: container.container,
|
|
188
175
|
containerKey,
|
|
189
176
|
containerData: container.initialObjects as Record<string, IFluidLoadable>,
|
|
190
177
|
};
|