@fluidframework/devtools 2.1.0-281041 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +69 -23
- 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,11 +6,19 @@ 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. -->
|
|
13
13
|
|
|
14
|
+
## Using Fluid Framework libraries
|
|
15
|
+
|
|
16
|
+
When taking a dependency on a Fluid Framework library's public APIs, we recommend using a `^` (caret) version range, such as `^1.3.4`.
|
|
17
|
+
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
18
|
+
library consumers should always prefer `^`.
|
|
19
|
+
|
|
20
|
+
If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
|
|
21
|
+
|
|
14
22
|
## Installation
|
|
15
23
|
|
|
16
24
|
To get started, install the package by running the following command:
|
|
@@ -19,6 +27,21 @@ To get started, install the package by running the following command:
|
|
|
19
27
|
npm i @fluidframework/devtools -D
|
|
20
28
|
```
|
|
21
29
|
|
|
30
|
+
## Importing from this package
|
|
31
|
+
|
|
32
|
+
This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
|
|
33
|
+
For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
|
|
34
|
+
|
|
35
|
+
To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/devtools` like normal.
|
|
36
|
+
|
|
37
|
+
To access the `beta` APIs, import via `@fluidframework/devtools/beta`.
|
|
38
|
+
|
|
39
|
+
To access the `alpha` APIs, import via `@fluidframework/devtools/alpha`.
|
|
40
|
+
|
|
41
|
+
## API Documentation
|
|
42
|
+
|
|
43
|
+
API documentation for **@fluidframework/devtools** is available at <https://fluidframework.com/docs/apis/devtools>.
|
|
44
|
+
|
|
22
45
|
<!-- prettier-ignore-end -->
|
|
23
46
|
|
|
24
47
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
@@ -121,14 +144,55 @@ Next, to build the code, run `npm run build` from the root of the mono-repo, or
|
|
|
121
144
|
To run the tests, first ensure you have followed the [build](#build) steps above.
|
|
122
145
|
Next, run `npm run test` from a terminal within this directory.
|
|
123
146
|
|
|
124
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
125
|
-
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
126
|
-
|
|
127
|
-
<!-- AUTO-GENERATED-CONTENT:START (README_CONTRIBUTION_GUIDELINES_SECTION:includeHeading=TRUE) -->
|
|
147
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) -->
|
|
128
148
|
|
|
129
149
|
<!-- prettier-ignore-start -->
|
|
130
150
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
131
151
|
|
|
152
|
+
## Minimum Client Requirements
|
|
153
|
+
|
|
154
|
+
These are the platform requirements for the current version of Fluid Framework Client Packages.
|
|
155
|
+
These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter.
|
|
156
|
+
For Long Term Support (LTS) versions this can require supporting these platforms for several years.
|
|
157
|
+
|
|
158
|
+
It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
|
|
159
|
+
If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
|
|
160
|
+
When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
|
|
161
|
+
|
|
162
|
+
### Supported Runtimes
|
|
163
|
+
|
|
164
|
+
- NodeJs ^20.10.0 except that we will drop support for it [when NodeJs 20 loses its upstream support on 2026-04-30](https://github.com/nodejs/release#release-schedule), and will support a newer LTS version of NodeJS (22) at least 1 year before 20 is end-of-life. This same policy applies to NodeJS 22 when it is end of life (2027-04-30).
|
|
165
|
+
- Modern browsers supporting the es2022 standard library: in response to asks we can add explicit support for using babel to polyfill to target specific standards or runtimes (meaning we can avoid/remove use of things that don't polyfill robustly, but otherwise target modern standards).
|
|
166
|
+
|
|
167
|
+
### Supported Tools
|
|
168
|
+
|
|
169
|
+
- TypeScript 5.4:
|
|
170
|
+
- All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
|
|
171
|
+
- [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
|
|
172
|
+
- [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
|
|
173
|
+
- `exactOptionalPropertyTypes` is currently not fully supported.
|
|
174
|
+
If used, narrowing members of Fluid Framework types types using `in`, `Reflect.has`, `Object.hasOwn` or `Object.prototype.hasOwnProperty` should be avoided as they may incorrectly exclude `undefined` from the possible values in some cases.
|
|
175
|
+
- [webpack](https://webpack.js.org/) 5
|
|
176
|
+
- We are not intending to be prescriptive about what bundler to use.
|
|
177
|
+
Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
|
|
178
|
+
|
|
179
|
+
### Module Resolution
|
|
180
|
+
|
|
181
|
+
[`Node16`, `NodeNext`, or `Bundler`](https://www.typescriptlang.org/tsconfig#moduleResolution) resolution should be used with TypeScript compilerOptions to follow the [Node.js v12+ ESM Resolution and Loading algorithm](https://nodejs.github.io/nodejs.dev/en/api/v20/esm/#resolution-and-loading-algorithm).
|
|
182
|
+
Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
|
|
183
|
+
|
|
184
|
+
### Module Formats
|
|
185
|
+
|
|
186
|
+
- ES Modules:
|
|
187
|
+
ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
|
|
188
|
+
- CommonJs:
|
|
189
|
+
Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
|
|
190
|
+
This is done to accommodate some workflows without good ES Module support.
|
|
191
|
+
If you have a workflow you would like included in this list, file an issue.
|
|
192
|
+
Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
|
|
193
|
+
|
|
194
|
+
- Testing with Jest (which lacks [stable ESM support](https://jestjs.io/docs/ecmascript-modules) due to [unstable APIs in NodeJs](https://github.com/nodejs/node/issues/37648))
|
|
195
|
+
|
|
132
196
|
## Contribution Guidelines
|
|
133
197
|
|
|
134
198
|
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
|
|
@@ -147,15 +211,6 @@ This project may contain Microsoft trademarks or logos for Microsoft projects, p
|
|
|
147
211
|
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
|
|
148
212
|
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
149
213
|
|
|
150
|
-
<!-- prettier-ignore-end -->
|
|
151
|
-
|
|
152
|
-
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
153
|
-
|
|
154
|
-
<!-- AUTO-GENERATED-CONTENT:START (README_HELP_SECTION:includeHeading=TRUE) -->
|
|
155
|
-
|
|
156
|
-
<!-- prettier-ignore-start -->
|
|
157
|
-
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
158
|
-
|
|
159
214
|
## Help
|
|
160
215
|
|
|
161
216
|
Not finding what you're looking for in this README? Check out [fluidframework.com](https://fluidframework.com/docs/).
|
|
@@ -164,15 +219,6 @@ Still not finding what you're looking for? Please [file an issue](https://github
|
|
|
164
219
|
|
|
165
220
|
Thank you!
|
|
166
221
|
|
|
167
|
-
<!-- prettier-ignore-end -->
|
|
168
|
-
|
|
169
|
-
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
170
|
-
|
|
171
|
-
<!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
|
|
172
|
-
|
|
173
|
-
<!-- prettier-ignore-start -->
|
|
174
|
-
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
175
|
-
|
|
176
222
|
## Trademark
|
|
177
223
|
|
|
178
224
|
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
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.2.0",
|
|
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": "2.
|
|
81
|
-
"@fluidframework/core-interfaces": "2.
|
|
82
|
-
"@fluidframework/devtools-core": "2.
|
|
83
|
-
"@fluidframework/fluid-static": "2.
|
|
80
|
+
"@fluidframework/container-definitions": "~2.2.0",
|
|
81
|
+
"@fluidframework/core-interfaces": "~2.2.0",
|
|
82
|
+
"@fluidframework/devtools-core": "~2.2.0",
|
|
83
|
+
"@fluidframework/fluid-static": "~2.2.0"
|
|
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": "2.
|
|
89
|
-
"@fluid-tools/build-cli": "^0.
|
|
88
|
+
"@fluid-internal/mocha-test-setup": "~2.2.0",
|
|
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.1.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
|
};
|