@fluidframework/core-interfaces 2.0.0-internal.5.3.2 → 2.0.0-internal.6.0.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 +12 -0
- package/Removing-IFluidRouter.md +113 -0
- package/dist/fluidPackage.js +4 -4
- package/dist/fluidPackage.js.map +1 -1
- package/dist/provider.d.ts +0 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js.map +1 -1
- package/lib/fluidPackage.js +4 -4
- package/lib/fluidPackage.js.map +1 -1
- package/lib/provider.d.ts +0 -1
- package/lib/provider.d.ts.map +1 -1
- package/lib/provider.js.map +1 -1
- package/package.json +4 -4
- package/src/provider.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @fluidframework/core-interfaces
|
|
2
2
|
|
|
3
|
+
## 2.0.0-internal.6.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
8
|
+
|
|
9
|
+
Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
|
|
10
|
+
|
|
11
|
+
## 2.0.0-internal.5.4.0
|
|
12
|
+
|
|
13
|
+
Dependency updates only.
|
|
14
|
+
|
|
3
15
|
## 2.0.0-internal.5.3.0
|
|
4
16
|
|
|
5
17
|
Dependency updates only.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Removing IFluidRouter
|
|
2
|
+
|
|
3
|
+
The interface `IFluidRouter` is being deprecated and removed over the next several internal releases.
|
|
4
|
+
It exposes a `request` function and is implemented across Fluid Framework's layers to light up the "request pattern"
|
|
5
|
+
for accessing objects out of a Fluid Container.
|
|
6
|
+
The request pattern is incompatible with [Garbage Collection](../../runtime/container-runtime/src/gc/garbageCollection.md),
|
|
7
|
+
so any code that previously accessed an object via request should migrate to using handles instead.
|
|
8
|
+
|
|
9
|
+
This document serves as a "how-to" guide for this migration, and will also include the latest status of the work.
|
|
10
|
+
|
|
11
|
+
## Key Concepts
|
|
12
|
+
|
|
13
|
+
### `IFluidRouter` and `absolutePath`
|
|
14
|
+
|
|
15
|
+
Here's what [`IFluidRouter`](src/fluidRouter.ts) looks like:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
export interface IProvideFluidRouter {
|
|
19
|
+
readonly IFluidRouter: IFluidRouter;
|
|
20
|
+
}
|
|
21
|
+
export interface IFluidRouter extends IProvideFluidRouter {
|
|
22
|
+
request(request: IRequest): Promise<IResponse>;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
It uses the Provider pattern so any Fluid Object may be queried for `IFluidRouter` to call `request` on if present.
|
|
27
|
+
|
|
28
|
+
Here's the **deprecated** flow for referencing and accessing an object:
|
|
29
|
+
|
|
30
|
+
1. Store the object's `absolutePath` (a container-relative URL path) in some DDS
|
|
31
|
+
2. Later, load the object via `request({ url: absolutePath })`
|
|
32
|
+
|
|
33
|
+
### `IFluidLoadable` and `IFluidHandle`
|
|
34
|
+
|
|
35
|
+
The new way to reference an object within a Fluid Container is via its `handle`:
|
|
36
|
+
|
|
37
|
+
1. Store the object's `handle` in some DDS
|
|
38
|
+
2. Later, load the object via `handle.get()`
|
|
39
|
+
|
|
40
|
+
### Entry Point
|
|
41
|
+
|
|
42
|
+
`request` has also been used as the way to get at the application-specific Container and DataStore implementations
|
|
43
|
+
starting from native Fluid types like `IContainer` and `IDataStore` - both of which have extended `IFluidRouter`.
|
|
44
|
+
The new way to do this is via the object's "entry point".
|
|
45
|
+
|
|
46
|
+
Here it is on `IContainer`, returning an anonymous `FluidObject` - the application-specified root object:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
getEntryPoint?(): Promise<FluidObject | undefined>;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
And here it is on `IDataStore`, returning an `IFluidHandle` to an anonymous `FluidObject` - the DataStore's root object:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
readonly entryPoint?: IFluidHandle<FluidObject>;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
So how does an application specify what the Container or DataStore's entry point is?
|
|
59
|
+
Via a parameter `initializeEntryPoint` that's found on `ContainerRuntime.loadRuntime` and `FluidDataStoreRuntime`'s constructor.
|
|
60
|
+
|
|
61
|
+
### ILoader request pattern
|
|
62
|
+
|
|
63
|
+
The `request` API (associated with the `IFluidRouter` interface) has been deprecated on `ILoader` and `Loader`.
|
|
64
|
+
|
|
65
|
+
**Note:** The `IContainer.request(...)` method will be deprecated in an upcoming release, so do not rely on this method for a long-term solution (the APIs around `entryPoint` and `getEntryPoint()` will become required and available for usage in its place).
|
|
66
|
+
|
|
67
|
+
After calling `ILoader.resolve(...)`, call the `request(...)` method on the returned `IContainer` with a corresponding request URL. For converting a request URL from `Loader` to `Container`, use the `IUrlResolver` passed into the `Loader`'s constructor.
|
|
68
|
+
The following is an example of what this change may look like:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
// OLD
|
|
72
|
+
const request: IRequest;
|
|
73
|
+
const urlResolver = new YourUrlResolver();
|
|
74
|
+
const loader = new Loader({ urlResolver, ... });
|
|
75
|
+
|
|
76
|
+
await loader.resolve(request);
|
|
77
|
+
const response = loader.request(request);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
// NEW
|
|
82
|
+
const request: IRequest;
|
|
83
|
+
const urlResolver = new YourUrlResolver();
|
|
84
|
+
const loader = new Loader({ urlResolver, ... });
|
|
85
|
+
|
|
86
|
+
const container = await loader.resolve(request);
|
|
87
|
+
const resolvedUrl: IRequest = urlResolver.resolve(request);
|
|
88
|
+
|
|
89
|
+
// Parse the `resolvedUrl.url` property as necessary before passing to `container.request(...)`
|
|
90
|
+
// For an example, see the `Loader.resolveCore(...)` method
|
|
91
|
+
const parsedResolvedUrl = // implement parse logic here
|
|
92
|
+
const response = container.request(parsedResolvedUrl);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Aliased DataStores
|
|
96
|
+
|
|
97
|
+
(Not yet written)
|
|
98
|
+
|
|
99
|
+
## Status
|
|
100
|
+
|
|
101
|
+
<!-- prettier-ignore-start -->
|
|
102
|
+
| API | Deprecated in | Removed in |
|
|
103
|
+
| ------------------------------------------------------------------------------------ | -------------------- | -------------------- |
|
|
104
|
+
| `IContainer.request` (except calling with "/") | 2.0.0-internal.6.0.0 | |
|
|
105
|
+
| `IDataStore.request` (except calling with "/") | 2.0.0-internal.6.0.0 | |
|
|
106
|
+
| `IContainer.IFluidRouter` | 2.0.0-internal.6.0.0 | |
|
|
107
|
+
| `IDataStore.IFluidRouter` | 2.0.0-internal.6.0.0 | |
|
|
108
|
+
| `request` and `IFluidRouter` on `ILoader` and `Loader` | 2.0.0-internal.6.0.0 | |
|
|
109
|
+
| `request` and `IFluidRouter` on `IRuntime` and `ContainerRuntime` | 2.0.0-internal.6.0.0 | |
|
|
110
|
+
| `request` and `IFluidRouter` on `IFluidDataStoreRuntime` and `FluidDataStoreRuntime` | 2.0.0-internal.6.0.0 | |
|
|
111
|
+
| `request` and `IFluidRouter` on `IFluidDataStoreChannel` | 2.0.0-internal.6.0.0 | |
|
|
112
|
+
| `getRootDataStore` on `IContainerRuntime` and `ContainerRuntime` | 2.0.0-internal.6.0.0 | |
|
|
113
|
+
<!-- prettier-ignore-end -->
|
package/dist/fluidPackage.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.IFluidCodeDetailsComparer = exports.isFluidCodeDetails = exports.isFluid
|
|
|
13
13
|
*
|
|
14
14
|
* @param pkg - The package json data to check if it is a Fluid package.
|
|
15
15
|
*/
|
|
16
|
-
const isFluidPackage = (pkg) => typeof pkg === "object" && typeof
|
|
16
|
+
const isFluidPackage = (pkg) => typeof pkg === "object" && typeof pkg?.name === "string" && typeof pkg?.fluid === "object";
|
|
17
17
|
exports.isFluidPackage = isFluidPackage;
|
|
18
18
|
/**
|
|
19
19
|
* @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}
|
|
@@ -22,9 +22,9 @@ exports.isFluidPackage = isFluidPackage;
|
|
|
22
22
|
const isFluidCodeDetails = (details) => {
|
|
23
23
|
const maybeCodeDetails = details;
|
|
24
24
|
return (typeof maybeCodeDetails === "object" &&
|
|
25
|
-
(typeof
|
|
26
|
-
(0, exports.isFluidPackage)(maybeCodeDetails
|
|
27
|
-
(
|
|
25
|
+
(typeof maybeCodeDetails?.package === "string" ||
|
|
26
|
+
(0, exports.isFluidPackage)(maybeCodeDetails?.package)) &&
|
|
27
|
+
(maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object"));
|
|
28
28
|
};
|
|
29
29
|
exports.isFluidCodeDetails = isFluidCodeDetails;
|
|
30
30
|
/**
|
package/dist/fluidPackage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidPackage.js","sourceRoot":"","sources":["../src/fluidPackage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgEH;;;;;;;GAOG;AACI,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAkC,EAAE,CAC1E,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"fluidPackage.js","sourceRoot":"","sources":["../src/fluidPackage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgEH;;;;;;;GAOG;AACI,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAkC,EAAE,CAC1E,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,EAAE,IAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,EAAE,KAAK,KAAK,QAAQ,CAAC;AAD/E,QAAA,cAAc,kBACiE;AA+B5F;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAA0C,EAAE;IAC9F,MAAM,gBAAgB,GAAG,OAAiD,CAAC;IAC3E,OAAO,CACN,OAAO,gBAAgB,KAAK,QAAQ;QACpC,CAAC,OAAO,gBAAgB,EAAE,OAAO,KAAK,QAAQ;YAC7C,IAAA,sBAAc,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC,gBAAgB,EAAE,MAAM,KAAK,SAAS,IAAI,OAAO,gBAAgB,EAAE,MAAM,KAAK,QAAQ,CAAC,CACxF,CAAC;AACH,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF;;;GAGG;AACU,QAAA,yBAAyB,GACrC,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Specifies an environment on Fluid property of an {@link IFluidPackage}.\n *\n * @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackageEnvironment}\n * to have code loading modules in same package.\n */\nexport interface IFluidPackageEnvironment {\n\t/**\n\t * The name of the target. For a browser environment, this could be umd for scripts\n\t * or css for styles.\n\t */\n\t[target: string]:\n\t\t| undefined\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * List of files for the target. These can be relative or absolute.\n\t\t\t\t * The code loader should resolve relative paths, and validate all\n\t\t\t\t * full urls.\n\t\t\t\t */\n\t\t\t\tfiles: string[];\n\n\t\t\t\t/**\n\t\t\t\t * General access for extended fields as specific usages will\n\t\t\t\t * likely have additional infornamation like a definition\n\t\t\t\t * of Library, the entrypoint for umd packages\n\t\t\t\t */\n\t\t\t\t[key: string]: unknown;\n\t\t };\n}\n\n/**\n * Fluid-specific properties expected on a package to be loaded by the code loader.\n * While compatible with the npm package format it is not necessary that that package is an\n * npm package:\n * {@link https://stackoverflow.com/questions/10065564/add-custom-metadata-or-config-to-package-json-is-it-valid}\n *\n * @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackage}\n * to have code loading modules in same package.\n */\nexport interface IFluidPackage {\n\t/**\n\t * The name of the package that this code represnets\n\t */\n\tname: string;\n\t/**\n\t * This object represents the Fluid specific properties of the package\n\t */\n\tfluid: {\n\t\t/**\n\t\t * The name of the of the environment. This should be something like browser, or node\n\t\t * and contain the necessary targets for loading this code in that environment.\n\t\t */\n\t\t[environment: string]: undefined | IFluidPackageEnvironment;\n\t};\n\t/**\n\t * General access for extended fields as specific usages will\n\t * likely have additional infornamation like a definition of\n\t * compatible versions, or deployment information like rings or rollouts.\n\t */\n\t[key: string]: unknown;\n}\n\n/**\n * Check if the package.json defines a Fluid package.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#isFluidPackage}\n * to have code loading modules in same package.\n *\n * @param pkg - The package json data to check if it is a Fluid package.\n */\nexport const isFluidPackage = (pkg: any): pkg is Readonly<IFluidPackage> =>\n\ttypeof pkg === \"object\" && typeof pkg?.name === \"string\" && typeof pkg?.fluid === \"object\";\n\n/**\n * Package manager configuration. Provides a key value mapping of config values.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsConfig}\n * to have code loading modules in same package.\n */\nexport interface IFluidCodeDetailsConfig {\n\treadonly [key: string]: string;\n}\n\n/**\n * Data structure used to describe the code to load on the Fluid document.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetails}\n * to have code loading modules in same package.\n */\nexport interface IFluidCodeDetails {\n\t/**\n\t * The code package to be used on the Fluid document. This is either the package name which will be loaded\n\t * from a package manager. Or the expanded Fluid package.\n\t */\n\treadonly package: string | Readonly<IFluidPackage>;\n\n\t/**\n\t * Configuration details. This includes links to the package manager and base CDNs.\n\t */\n\treadonly config?: IFluidCodeDetailsConfig;\n}\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}\n * to have code loading modules in same package.\n */\nexport const isFluidCodeDetails = (details: unknown): details is Readonly<IFluidCodeDetails> => {\n\tconst maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;\n\treturn (\n\t\ttypeof maybeCodeDetails === \"object\" &&\n\t\t(typeof maybeCodeDetails?.package === \"string\" ||\n\t\t\tisFluidPackage(maybeCodeDetails?.package)) &&\n\t\t(maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === \"object\")\n\t);\n};\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n */\nexport const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer =\n\t\"IFluidCodeDetailsComparer\";\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#IProvideFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n */\nexport interface IProvideFluidCodeDetailsComparer {\n\treadonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer;\n}\n\n/**\n * Provides capability to compare Fluid code details.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n */\nexport interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {\n\t/**\n\t * Determines if the `candidate` code details satisfy the constraints specified in `constraint` code details.\n\t *\n\t * Similar semantics to:\n\t * {@link https://github.com/npm/node-semver#usage}\n\t */\n\tsatisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;\n\n\t/**\n\t * Returns a number representing the ascending sort order of the `a` and `b` code details:\n\t *\n\t * - `< 0` if `a < b`.\n\t *\n\t * - `= 0` if `a === b`.\n\t *\n\t * - `> 0` if `a > b`.\n\t *\n\t * - `undefined` if `a` is not comparable to `b`.\n\t *\n\t * Similar semantics to:\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description | Array.sort}\n\t */\n\tcompare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;\n}\n"]}
|
package/dist/provider.d.ts
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
* This pattern enables discovery, and delegation in a standard way which is central
|
|
22
22
|
* to FluidObject pattern
|
|
23
23
|
*
|
|
24
|
-
* @internal
|
|
25
24
|
*/
|
|
26
25
|
export declare type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp ? never : number extends TProp ? never : TProp extends keyof Required<T>[TProp] ? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] ? TProp : never : never;
|
|
27
26
|
/**
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,oBAAY,uBAAuB,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,MAAM,SAAS,KAAK,GAC3F,KAAK,GACL,MAAM,SAAS,KAAK,GACpB,KAAK,GACL,KAAK,SAAS,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GACtC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAC7D,KAAK,GACL,KAAK,GACN,KAAK,CAAC;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,oBAAY,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI;KACrC,CAAC,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,eAAe,CAAC,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This utility type is meant for internal use by {@link FluidObject}\n * Produces a valid FluidObject key given a type and a property.\n * A valid FluidObject key is a property that exists on the incoming type\n * as well as on the type of the property itself. For example: `IProvideFoo.IFoo.IFoo`\n * This aligns with the FluidObject pattern expected to be used with all FluidObjects.\n *\n * @example\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n * This pattern enables discovery, and delegation in a standard way which is central\n * to FluidObject pattern\n *\n
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This utility type is meant for internal use by {@link FluidObject}\n * Produces a valid FluidObject key given a type and a property.\n * A valid FluidObject key is a property that exists on the incoming type\n * as well as on the type of the property itself. For example: `IProvideFoo.IFoo.IFoo`\n * This aligns with the FluidObject pattern expected to be used with all FluidObjects.\n *\n * @example\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n * This pattern enables discovery, and delegation in a standard way which is central\n * to FluidObject pattern\n *\n */\nexport type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp\n\t? never\n\t: number extends TProp\n\t? never // exclude indexers [key:string |number]: any\n\t: TProp extends keyof Required<T>[TProp] // TProp is a property of T, and T[TProp]\n\t? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] // T[TProp] is the same type as T[TProp][TProp]\n\t\t? TProp\n\t\t: never\n\t: never;\n\n/**\n * This utility type take interface(s) that follow the FluidObject pattern, and produces\n * a new type that can be used for inspection and discovery of those interfaces.\n *\n * It is meant to be used with types that are known to implement the FluidObject pattern.\n * A common way to specify a type implements the FluidObject pattern is to expose it as a\n * FluidObject without a generic argument.\n *\n * @example\n * For example, if we have an interface like below\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n *\n * and a function that returns a FluidObject. You would do the following\n *\n * `const maybeFoo: FluidObject<IFoo> = getFluidObject()`;\n *\n * Either IFoo or IProvideFoo are valid generic arguments. In both case\n * maybeFoo will be of type `{IFoo?: IFoo}`. If IFoo is not undefined,\n * then the FluidObject provides IFoo, and it can be used.\n *\n * You can inspect multiple types via a intersection. For example:\n * `FluidObject<IFoo & IBar>`\n *\n */\nexport type FluidObject<T = unknown> = {\n\t[P in FluidObjectProviderKeys<T>]?: T[P];\n};\n\n/**\n * This utility type creates a type that is the union of all keys on the generic type\n * which implement the FluidObject pattern.\n *\n * See {@link FluidObject}\n *\n * For example `FluidObjectKeys<IFoo & IBar>` would result in `\"IFoo\" | \"IBar\"`\n *\n */\nexport type FluidObjectKeys<T> = keyof FluidObject<T>;\n"]}
|
package/lib/fluidPackage.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @param pkg - The package json data to check if it is a Fluid package.
|
|
12
12
|
*/
|
|
13
|
-
export const isFluidPackage = (pkg) => typeof pkg === "object" && typeof
|
|
13
|
+
export const isFluidPackage = (pkg) => typeof pkg === "object" && typeof pkg?.name === "string" && typeof pkg?.fluid === "object";
|
|
14
14
|
/**
|
|
15
15
|
* @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}
|
|
16
16
|
* to have code loading modules in same package.
|
|
@@ -18,9 +18,9 @@ export const isFluidPackage = (pkg) => typeof pkg === "object" && typeof (pkg ==
|
|
|
18
18
|
export const isFluidCodeDetails = (details) => {
|
|
19
19
|
const maybeCodeDetails = details;
|
|
20
20
|
return (typeof maybeCodeDetails === "object" &&
|
|
21
|
-
(typeof
|
|
22
|
-
isFluidPackage(maybeCodeDetails
|
|
23
|
-
(
|
|
21
|
+
(typeof maybeCodeDetails?.package === "string" ||
|
|
22
|
+
isFluidPackage(maybeCodeDetails?.package)) &&
|
|
23
|
+
(maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object"));
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}
|
package/lib/fluidPackage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidPackage.js","sourceRoot":"","sources":["../src/fluidPackage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAkC,EAAE,CAC1E,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"fluidPackage.js","sourceRoot":"","sources":["../src/fluidPackage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAkC,EAAE,CAC1E,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,EAAE,IAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,EAAE,KAAK,KAAK,QAAQ,CAAC;AA+B5F;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAA0C,EAAE;IAC9F,MAAM,gBAAgB,GAAG,OAAiD,CAAC;IAC3E,OAAO,CACN,OAAO,gBAAgB,KAAK,QAAQ;QACpC,CAAC,OAAO,gBAAgB,EAAE,OAAO,KAAK,QAAQ;YAC7C,cAAc,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QAC3C,CAAC,gBAAgB,EAAE,MAAM,KAAK,SAAS,IAAI,OAAO,gBAAgB,EAAE,MAAM,KAAK,QAAQ,CAAC,CACxF,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACrC,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Specifies an environment on Fluid property of an {@link IFluidPackage}.\n *\n * @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackageEnvironment}\n * to have code loading modules in same package.\n */\nexport interface IFluidPackageEnvironment {\n\t/**\n\t * The name of the target. For a browser environment, this could be umd for scripts\n\t * or css for styles.\n\t */\n\t[target: string]:\n\t\t| undefined\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * List of files for the target. These can be relative or absolute.\n\t\t\t\t * The code loader should resolve relative paths, and validate all\n\t\t\t\t * full urls.\n\t\t\t\t */\n\t\t\t\tfiles: string[];\n\n\t\t\t\t/**\n\t\t\t\t * General access for extended fields as specific usages will\n\t\t\t\t * likely have additional infornamation like a definition\n\t\t\t\t * of Library, the entrypoint for umd packages\n\t\t\t\t */\n\t\t\t\t[key: string]: unknown;\n\t\t };\n}\n\n/**\n * Fluid-specific properties expected on a package to be loaded by the code loader.\n * While compatible with the npm package format it is not necessary that that package is an\n * npm package:\n * {@link https://stackoverflow.com/questions/10065564/add-custom-metadata-or-config-to-package-json-is-it-valid}\n *\n * @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackage}\n * to have code loading modules in same package.\n */\nexport interface IFluidPackage {\n\t/**\n\t * The name of the package that this code represnets\n\t */\n\tname: string;\n\t/**\n\t * This object represents the Fluid specific properties of the package\n\t */\n\tfluid: {\n\t\t/**\n\t\t * The name of the of the environment. This should be something like browser, or node\n\t\t * and contain the necessary targets for loading this code in that environment.\n\t\t */\n\t\t[environment: string]: undefined | IFluidPackageEnvironment;\n\t};\n\t/**\n\t * General access for extended fields as specific usages will\n\t * likely have additional infornamation like a definition of\n\t * compatible versions, or deployment information like rings or rollouts.\n\t */\n\t[key: string]: unknown;\n}\n\n/**\n * Check if the package.json defines a Fluid package.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#isFluidPackage}\n * to have code loading modules in same package.\n *\n * @param pkg - The package json data to check if it is a Fluid package.\n */\nexport const isFluidPackage = (pkg: any): pkg is Readonly<IFluidPackage> =>\n\ttypeof pkg === \"object\" && typeof pkg?.name === \"string\" && typeof pkg?.fluid === \"object\";\n\n/**\n * Package manager configuration. Provides a key value mapping of config values.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsConfig}\n * to have code loading modules in same package.\n */\nexport interface IFluidCodeDetailsConfig {\n\treadonly [key: string]: string;\n}\n\n/**\n * Data structure used to describe the code to load on the Fluid document.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetails}\n * to have code loading modules in same package.\n */\nexport interface IFluidCodeDetails {\n\t/**\n\t * The code package to be used on the Fluid document. This is either the package name which will be loaded\n\t * from a package manager. Or the expanded Fluid package.\n\t */\n\treadonly package: string | Readonly<IFluidPackage>;\n\n\t/**\n\t * Configuration details. This includes links to the package manager and base CDNs.\n\t */\n\treadonly config?: IFluidCodeDetailsConfig;\n}\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}\n * to have code loading modules in same package.\n */\nexport const isFluidCodeDetails = (details: unknown): details is Readonly<IFluidCodeDetails> => {\n\tconst maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;\n\treturn (\n\t\ttypeof maybeCodeDetails === \"object\" &&\n\t\t(typeof maybeCodeDetails?.package === \"string\" ||\n\t\t\tisFluidPackage(maybeCodeDetails?.package)) &&\n\t\t(maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === \"object\")\n\t);\n};\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n */\nexport const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer =\n\t\"IFluidCodeDetailsComparer\";\n\n/**\n * @deprecated in favor of {@link @fluidframework/container-definitions#IProvideFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n */\nexport interface IProvideFluidCodeDetailsComparer {\n\treadonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer;\n}\n\n/**\n * Provides capability to compare Fluid code details.\n *\n * @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}\n * to have code loading modules in same package.\n */\nexport interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {\n\t/**\n\t * Determines if the `candidate` code details satisfy the constraints specified in `constraint` code details.\n\t *\n\t * Similar semantics to:\n\t * {@link https://github.com/npm/node-semver#usage}\n\t */\n\tsatisfies(candidate: IFluidCodeDetails, constraint: IFluidCodeDetails): Promise<boolean>;\n\n\t/**\n\t * Returns a number representing the ascending sort order of the `a` and `b` code details:\n\t *\n\t * - `< 0` if `a < b`.\n\t *\n\t * - `= 0` if `a === b`.\n\t *\n\t * - `> 0` if `a > b`.\n\t *\n\t * - `undefined` if `a` is not comparable to `b`.\n\t *\n\t * Similar semantics to:\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description | Array.sort}\n\t */\n\tcompare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined>;\n}\n"]}
|
package/lib/provider.d.ts
CHANGED
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
* This pattern enables discovery, and delegation in a standard way which is central
|
|
22
22
|
* to FluidObject pattern
|
|
23
23
|
*
|
|
24
|
-
* @internal
|
|
25
24
|
*/
|
|
26
25
|
export declare type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp ? never : number extends TProp ? never : TProp extends keyof Required<T>[TProp] ? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] ? TProp : never : never;
|
|
27
26
|
/**
|
package/lib/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,oBAAY,uBAAuB,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,MAAM,SAAS,KAAK,GAC3F,KAAK,GACL,MAAM,SAAS,KAAK,GACpB,KAAK,GACL,KAAK,SAAS,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GACtC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAC7D,KAAK,GACL,KAAK,GACN,KAAK,CAAC;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,oBAAY,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI;KACrC,CAAC,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,eAAe,CAAC,CAAC,IAAI,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
package/lib/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This utility type is meant for internal use by {@link FluidObject}\n * Produces a valid FluidObject key given a type and a property.\n * A valid FluidObject key is a property that exists on the incoming type\n * as well as on the type of the property itself. For example: `IProvideFoo.IFoo.IFoo`\n * This aligns with the FluidObject pattern expected to be used with all FluidObjects.\n *\n * @example\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n * This pattern enables discovery, and delegation in a standard way which is central\n * to FluidObject pattern\n *\n
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * This utility type is meant for internal use by {@link FluidObject}\n * Produces a valid FluidObject key given a type and a property.\n * A valid FluidObject key is a property that exists on the incoming type\n * as well as on the type of the property itself. For example: `IProvideFoo.IFoo.IFoo`\n * This aligns with the FluidObject pattern expected to be used with all FluidObjects.\n *\n * @example\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n * This pattern enables discovery, and delegation in a standard way which is central\n * to FluidObject pattern\n *\n */\nexport type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp\n\t? never\n\t: number extends TProp\n\t? never // exclude indexers [key:string |number]: any\n\t: TProp extends keyof Required<T>[TProp] // TProp is a property of T, and T[TProp]\n\t? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] // T[TProp] is the same type as T[TProp][TProp]\n\t\t? TProp\n\t\t: never\n\t: never;\n\n/**\n * This utility type take interface(s) that follow the FluidObject pattern, and produces\n * a new type that can be used for inspection and discovery of those interfaces.\n *\n * It is meant to be used with types that are known to implement the FluidObject pattern.\n * A common way to specify a type implements the FluidObject pattern is to expose it as a\n * FluidObject without a generic argument.\n *\n * @example\n * For example, if we have an interface like below\n * ```typescript\n * interface IProvideFoo{\n * IFoo: IFoo\n * }\n * interface IFoo extends IProvideFoo{\n * foobar();\n * }\n * ```\n *\n * and a function that returns a FluidObject. You would do the following\n *\n * `const maybeFoo: FluidObject<IFoo> = getFluidObject()`;\n *\n * Either IFoo or IProvideFoo are valid generic arguments. In both case\n * maybeFoo will be of type `{IFoo?: IFoo}`. If IFoo is not undefined,\n * then the FluidObject provides IFoo, and it can be used.\n *\n * You can inspect multiple types via a intersection. For example:\n * `FluidObject<IFoo & IBar>`\n *\n */\nexport type FluidObject<T = unknown> = {\n\t[P in FluidObjectProviderKeys<T>]?: T[P];\n};\n\n/**\n * This utility type creates a type that is the union of all keys on the generic type\n * which implement the FluidObject pattern.\n *\n * See {@link FluidObject}\n *\n * For example `FluidObjectKeys<IFoo & IBar>` would result in `\"IFoo\" | \"IBar\"`\n *\n */\nexport type FluidObjectKeys<T> = keyof FluidObject<T>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/core-interfaces",
|
|
3
|
-
"version": "2.0.0-internal.
|
|
3
|
+
"version": "2.0.0-internal.6.0.0",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@fluid-tools/build-cli": "^0.21.0",
|
|
19
|
-
"@fluidframework/build-common": "^
|
|
19
|
+
"@fluidframework/build-common": "^2.0.0",
|
|
20
20
|
"@fluidframework/build-tools": "^0.21.0",
|
|
21
21
|
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.0.0-internal.5.2.0",
|
|
22
22
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
23
23
|
"@microsoft/api-extractor": "^7.34.4",
|
|
24
|
-
"@types/node": "^
|
|
24
|
+
"@types/node": "^16.18.38",
|
|
25
25
|
"concurrently": "^7.6.0",
|
|
26
26
|
"copyfiles": "^2.4.1",
|
|
27
27
|
"eslint": "~8.6.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
44
44
|
"ci:test": "echo No test for this package",
|
|
45
45
|
"ci:test:coverage": "echo No test for this package",
|
|
46
|
-
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
46
|
+
"clean": "rimraf --glob \"dist\" \"lib\" \"*.tsbuildinfo\" \"*.build.log\"",
|
|
47
47
|
"eslint": "eslint --format stylish src",
|
|
48
48
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
49
49
|
"format": "npm run prettier:fix",
|
package/src/provider.ts
CHANGED