@fluidframework/core-interfaces 2.1.1 → 2.2.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 +4 -0
- package/README.md +109 -1
- package/dist/erasedType.js +1 -1
- package/dist/erasedType.js.map +1 -1
- package/lib/erasedType.js +1 -1
- package/lib/erasedType.js.map +1 -1
- package/package.json +4 -4
- package/src/erasedType.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Core interfaces describing the contracts the Fluid Loader supports or consumes.
|
|
|
4
4
|
|
|
5
5
|
See also: [The Fluid Loader README](../README.md).
|
|
6
6
|
|
|
7
|
-
<!-- AUTO-GENERATED-CONTENT:START (
|
|
7
|
+
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_README_HEADER) -->
|
|
8
8
|
|
|
9
9
|
<!-- prettier-ignore-start -->
|
|
10
10
|
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
@@ -17,6 +17,114 @@ library consumers should always prefer `^`.
|
|
|
17
17
|
|
|
18
18
|
If using any of Fluid Framework's unstable APIs (for example, its `beta` APIs), we recommend using a more constrained version range, such as `~`.
|
|
19
19
|
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
To get started, install the package by running the following command:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i @fluidframework/core-interfaces
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Importing from this package
|
|
29
|
+
|
|
30
|
+
This package leverages [package.json exports](https://nodejs.org/api/packages.html#exports) to separate its APIs by support level.
|
|
31
|
+
For more information on the related support guarantees, see [API Support Levels](https://fluidframework.com/docs/build/releases-and-apitags/#api-support-levels).
|
|
32
|
+
|
|
33
|
+
To access the `public` ([SemVer](https://semver.org/)) APIs, import via `@fluidframework/core-interfaces` like normal.
|
|
34
|
+
|
|
35
|
+
To access the `legacy` APIs, import via `@fluidframework/core-interfaces/legacy`.
|
|
36
|
+
|
|
37
|
+
## API Documentation
|
|
38
|
+
|
|
39
|
+
API documentation for **@fluidframework/core-interfaces** is available at <https://fluidframework.com/docs/apis/core-interfaces>.
|
|
40
|
+
|
|
41
|
+
<!-- prettier-ignore-end -->
|
|
42
|
+
|
|
43
|
+
<!-- AUTO-GENERATED-CONTENT:END -->
|
|
44
|
+
|
|
45
|
+
<!-- AUTO-GENERATED-CONTENT:START (README_FOOTER) -->
|
|
46
|
+
|
|
47
|
+
<!-- prettier-ignore-start -->
|
|
48
|
+
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
|
|
49
|
+
|
|
50
|
+
## Minimum Client Requirements
|
|
51
|
+
|
|
52
|
+
These are the platform requirements for the current version of Fluid Framework Client Packages.
|
|
53
|
+
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.
|
|
54
|
+
For Long Term Support (LTS) versions this can require supporting these platforms for several years.
|
|
55
|
+
|
|
56
|
+
It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug.
|
|
57
|
+
If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request.
|
|
58
|
+
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.
|
|
59
|
+
|
|
60
|
+
### Supported Runtimes
|
|
61
|
+
|
|
62
|
+
- 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).
|
|
63
|
+
- 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).
|
|
64
|
+
|
|
65
|
+
### Supported Tools
|
|
66
|
+
|
|
67
|
+
- TypeScript 5.4:
|
|
68
|
+
- All [`strict`](https://www.typescriptlang.org/tsconfig) options are supported.
|
|
69
|
+
- [`strictNullChecks`](https://www.typescriptlang.org/tsconfig) is required.
|
|
70
|
+
- [Configuration options deprecated in 5.0](https://github.com/microsoft/TypeScript/issues/51909) are not supported.
|
|
71
|
+
- `exactOptionalPropertyTypes` is currently not fully supported.
|
|
72
|
+
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.
|
|
73
|
+
- [webpack](https://webpack.js.org/) 5
|
|
74
|
+
- We are not intending to be prescriptive about what bundler to use.
|
|
75
|
+
Other bundlers which can handle ES Modules should work, but webpack is the only one we actively test.
|
|
76
|
+
|
|
77
|
+
### Module Resolution
|
|
78
|
+
|
|
79
|
+
[`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).
|
|
80
|
+
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.
|
|
81
|
+
|
|
82
|
+
### Module Formats
|
|
83
|
+
|
|
84
|
+
- ES Modules:
|
|
85
|
+
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.
|
|
86
|
+
- CommonJs:
|
|
87
|
+
Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below.
|
|
88
|
+
This is done to accommodate some workflows without good ES Module support.
|
|
89
|
+
If you have a workflow you would like included in this list, file an issue.
|
|
90
|
+
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.
|
|
91
|
+
|
|
92
|
+
- 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))
|
|
93
|
+
|
|
94
|
+
## Contribution Guidelines
|
|
95
|
+
|
|
96
|
+
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid.
|
|
97
|
+
|
|
98
|
+
- Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions).
|
|
99
|
+
- [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in.
|
|
100
|
+
- Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls).
|
|
101
|
+
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md).
|
|
102
|
+
|
|
103
|
+
Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki).
|
|
104
|
+
|
|
105
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
106
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
107
|
+
|
|
108
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
109
|
+
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks).
|
|
110
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
111
|
+
|
|
112
|
+
## Help
|
|
113
|
+
|
|
114
|
+
Not finding what you're looking for in this README? Check out [fluidframework.com](https://fluidframework.com/docs/).
|
|
115
|
+
|
|
116
|
+
Still not finding what you're looking for? Please [file an issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests).
|
|
117
|
+
|
|
118
|
+
Thank you!
|
|
119
|
+
|
|
120
|
+
## Trademark
|
|
121
|
+
|
|
122
|
+
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
|
|
123
|
+
|
|
124
|
+
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
125
|
+
|
|
126
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
127
|
+
|
|
20
128
|
<!-- prettier-ignore-end -->
|
|
21
129
|
|
|
22
130
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
package/dist/erasedType.js
CHANGED
|
@@ -70,7 +70,7 @@ class ErasedType {
|
|
|
70
70
|
* and in TypeScript 5.3 and newer will produce a compile time error if used.
|
|
71
71
|
*/
|
|
72
72
|
static [Symbol.hasInstance](value) {
|
|
73
|
-
throw new Error("ErasedType is a compile time type brand not a real class that can be used with `
|
|
73
|
+
throw new Error("ErasedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.");
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
exports.ErasedType = ErasedType;
|
package/dist/erasedType.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erasedType.js","sourceRoot":"","sources":["../src/erasedType.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAsB,UAAU;IAU/B;;OAEG;IACH,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAY;QAC9C,MAAM,IAAI,KAAK,CACd,
|
|
1
|
+
{"version":3,"file":"erasedType.js","sourceRoot":"","sources":["../src/erasedType.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAsB,UAAU;IAU/B;;OAEG;IACH,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAY;QAC9C,MAAM,IAAI,KAAK,CACd,yGAAyG,CACzG,CAAC;IACH,CAAC;CACD;AAzBD,gCAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Erased type which can be used to expose a opaque/erased version of a type without referencing the actual type.\n * @remarks\n * This similar to the [type erasure](https://en.wikipedia.org/wiki/Type_erasure) pattern,\n * but for erasing types at the package boundary.\n *\n * This can be used to implement the TypeScript typing for the [handle](https://en.wikipedia.org/wiki/Handle_(computing)) pattern,\n * allowing code outside of a package to have a reference/handle to something in the package in a type safe way without the package having to publicly export the types of the object.\n * This should not be confused with the more specific IFluidHandle which is also named after this design pattern.\n *\n * Recommended usage is to use `interface` instead of `type` so tooling (such as tsc and refactoring tools)\n * uses the type name instead of expanding it.\n *\n * @example\n * ```typescript\n * // public\n * export interface ErasedMyType extends ErasedType<\"myPackage.MyType\"> {}\n * // internal\n * export interface MyType {\n * \texample: number;\n * }\n * // Usage\n * function extract(input: ErasedMyType): MyType {\n * \treturn input as unknown as MyType;\n * }\n * function erase(input: MyType): ErasedMyType {\n * \treturn input as unknown as ErasedMyType;\n * }\n * ```\n *\n * Do not use this class with `instanceof`: this will always be false at runtime,\n * but the compiler may think it's true in some cases.\n * @privateRemarks\n * For this pattern to work well it needs to be difficult for a user of the erased type to\n * implicitly use something other than a instance received from the package as an instance of the erased type in type safe code.\n *\n * This means that this type must not be able to be implicitly converted to from any strong type (not `any` or `never`),\n * and no amount of auto complete or auto-implement refactoring will produce something that can be used as an erased type.\n * This is accomplished by:\n *\n * 1. requiring that values of this type be an instance of this class.\n * Typescript does not enforce this requirement for class: only for classes with protected or private members, so such member is included.\n *\n * 2. making this class impossible to get an instance of.\n * This is done by having a private constructor.\n *\n * 3. ensuring different erased types also using this library can not be implicitly converted between each-other.\n * This is done by using the \"Name\" type parameter.\n * Note that just having the type parameter is not enough since the presence of type parameters has no impact on implicit conversion in TypeScript:\n * only the usages of the type parameter matter.\n *\n * @sealed\n * @public\n */\nexport abstract class ErasedType<out Name = unknown> {\n\t/**\n\t * Compile time only marker to make type checking more strict.\n\t * This method will not exist at runtime and accessing it is invalid.\n\t * @privateRemarks\n\t * `Name` is used as the return type of a method rather than a a simple readonly member as this allows types with two brands to be intersected without getting `never`.\n\t * The method takes in never to help emphasize that its not callable.\n\t */\n\tprotected abstract brand(dummy: never): Name;\n\n\t/**\n\t * This class should never exist at runtime, so make it un-constructable.\n\t */\n\tprivate constructor() {}\n\n\t/**\n\t * Since this class is a compile time only type brand, `instanceof` will never work with it.\n\t * This `Symbol.hasInstance` implementation ensures that `instanceof` will error if used,\n\t * and in TypeScript 5.3 and newer will produce a compile time error if used.\n\t */\n\tpublic static [Symbol.hasInstance](value: never): value is never {\n\t\tthrow new Error(\n\t\t\t\"ErasedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.\",\n\t\t);\n\t}\n}\n"]}
|
package/lib/erasedType.js
CHANGED
|
@@ -67,7 +67,7 @@ export class ErasedType {
|
|
|
67
67
|
* and in TypeScript 5.3 and newer will produce a compile time error if used.
|
|
68
68
|
*/
|
|
69
69
|
static [Symbol.hasInstance](value) {
|
|
70
|
-
throw new Error("ErasedType is a compile time type brand not a real class that can be used with `
|
|
70
|
+
throw new Error("ErasedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.");
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
//# sourceMappingURL=erasedType.js.map
|
package/lib/erasedType.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erasedType.js","sourceRoot":"","sources":["../src/erasedType.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,OAAgB,UAAU;IAU/B;;OAEG;IACH,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAY;QAC9C,MAAM,IAAI,KAAK,CACd,
|
|
1
|
+
{"version":3,"file":"erasedType.js","sourceRoot":"","sources":["../src/erasedType.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,OAAgB,UAAU;IAU/B;;OAEG;IACH,gBAAuB,CAAC;IAExB;;;;OAIG;IACI,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAY;QAC9C,MAAM,IAAI,KAAK,CACd,yGAAyG,CACzG,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Erased type which can be used to expose a opaque/erased version of a type without referencing the actual type.\n * @remarks\n * This similar to the [type erasure](https://en.wikipedia.org/wiki/Type_erasure) pattern,\n * but for erasing types at the package boundary.\n *\n * This can be used to implement the TypeScript typing for the [handle](https://en.wikipedia.org/wiki/Handle_(computing)) pattern,\n * allowing code outside of a package to have a reference/handle to something in the package in a type safe way without the package having to publicly export the types of the object.\n * This should not be confused with the more specific IFluidHandle which is also named after this design pattern.\n *\n * Recommended usage is to use `interface` instead of `type` so tooling (such as tsc and refactoring tools)\n * uses the type name instead of expanding it.\n *\n * @example\n * ```typescript\n * // public\n * export interface ErasedMyType extends ErasedType<\"myPackage.MyType\"> {}\n * // internal\n * export interface MyType {\n * \texample: number;\n * }\n * // Usage\n * function extract(input: ErasedMyType): MyType {\n * \treturn input as unknown as MyType;\n * }\n * function erase(input: MyType): ErasedMyType {\n * \treturn input as unknown as ErasedMyType;\n * }\n * ```\n *\n * Do not use this class with `instanceof`: this will always be false at runtime,\n * but the compiler may think it's true in some cases.\n * @privateRemarks\n * For this pattern to work well it needs to be difficult for a user of the erased type to\n * implicitly use something other than a instance received from the package as an instance of the erased type in type safe code.\n *\n * This means that this type must not be able to be implicitly converted to from any strong type (not `any` or `never`),\n * and no amount of auto complete or auto-implement refactoring will produce something that can be used as an erased type.\n * This is accomplished by:\n *\n * 1. requiring that values of this type be an instance of this class.\n * Typescript does not enforce this requirement for class: only for classes with protected or private members, so such member is included.\n *\n * 2. making this class impossible to get an instance of.\n * This is done by having a private constructor.\n *\n * 3. ensuring different erased types also using this library can not be implicitly converted between each-other.\n * This is done by using the \"Name\" type parameter.\n * Note that just having the type parameter is not enough since the presence of type parameters has no impact on implicit conversion in TypeScript:\n * only the usages of the type parameter matter.\n *\n * @sealed\n * @public\n */\nexport abstract class ErasedType<out Name = unknown> {\n\t/**\n\t * Compile time only marker to make type checking more strict.\n\t * This method will not exist at runtime and accessing it is invalid.\n\t * @privateRemarks\n\t * `Name` is used as the return type of a method rather than a a simple readonly member as this allows types with two brands to be intersected without getting `never`.\n\t * The method takes in never to help emphasize that its not callable.\n\t */\n\tprotected abstract brand(dummy: never): Name;\n\n\t/**\n\t * This class should never exist at runtime, so make it un-constructable.\n\t */\n\tprivate constructor() {}\n\n\t/**\n\t * Since this class is a compile time only type brand, `instanceof` will never work with it.\n\t * This `Symbol.hasInstance` implementation ensures that `instanceof` will error if used,\n\t * and in TypeScript 5.3 and newer will produce a compile time error if used.\n\t */\n\tpublic static [Symbol.hasInstance](value: never): value is never {\n\t\tthrow new Error(\n\t\t\t\"ErasedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.\",\n\t\t);\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/core-interfaces",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
51
51
|
"@biomejs/biome": "~1.8.3",
|
|
52
|
-
"@fluid-tools/build-cli": "^0.
|
|
52
|
+
"@fluid-tools/build-cli": "^0.43.0",
|
|
53
53
|
"@fluidframework/build-common": "^2.0.3",
|
|
54
|
-
"@fluidframework/build-tools": "^0.
|
|
55
|
-
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.
|
|
54
|
+
"@fluidframework/build-tools": "^0.43.0",
|
|
55
|
+
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.2.0",
|
|
56
56
|
"@fluidframework/eslint-config-fluid": "^5.3.0",
|
|
57
57
|
"@microsoft/api-extractor": "^7.45.1",
|
|
58
58
|
"@types/node": "^18.19.0",
|
package/src/erasedType.ts
CHANGED
|
@@ -79,7 +79,7 @@ export abstract class ErasedType<out Name = unknown> {
|
|
|
79
79
|
*/
|
|
80
80
|
public static [Symbol.hasInstance](value: never): value is never {
|
|
81
81
|
throw new Error(
|
|
82
|
-
"ErasedType is a compile time type brand not a real class that can be used with `
|
|
82
|
+
"ErasedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.",
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
}
|