@fluidframework/core-interfaces 0.40.0 → 0.42.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/.eslintrc.js +1 -1
- package/api-report/core-interfaces.api.md +47 -20
- package/dist/fluidLoadable.d.ts +15 -0
- package/dist/fluidLoadable.d.ts.map +1 -1
- package/dist/fluidLoadable.js +3 -0
- package/dist/fluidLoadable.js.map +1 -1
- package/dist/fluidObject.d.ts +36 -5
- package/dist/fluidObject.d.ts.map +1 -1
- package/dist/fluidObject.js +0 -1
- package/dist/fluidObject.js.map +1 -1
- package/dist/fluidPackage.d.ts +25 -0
- package/dist/fluidPackage.d.ts.map +1 -1
- package/dist/fluidPackage.js +10 -0
- package/dist/fluidPackage.js.map +1 -1
- package/dist/handles.d.ts +2 -1
- package/dist/handles.d.ts.map +1 -1
- package/dist/handles.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +64 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +7 -0
- package/dist/provider.js.map +1 -0
- package/dist/serializer.d.ts +10 -0
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +3 -0
- package/dist/serializer.js.map +1 -1
- package/lib/fluidLoadable.d.ts +15 -0
- package/lib/fluidLoadable.d.ts.map +1 -1
- package/lib/fluidLoadable.js +3 -0
- package/lib/fluidLoadable.js.map +1 -1
- package/lib/fluidObject.d.ts +36 -5
- package/lib/fluidObject.d.ts.map +1 -1
- package/lib/fluidObject.js +0 -1
- package/lib/fluidObject.js.map +1 -1
- package/lib/fluidPackage.d.ts +25 -0
- package/lib/fluidPackage.d.ts.map +1 -1
- package/lib/fluidPackage.js +10 -0
- package/lib/fluidPackage.js.map +1 -1
- package/lib/handles.d.ts +2 -1
- package/lib/handles.d.ts.map +1 -1
- package/lib/handles.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/provider.d.ts +64 -0
- package/lib/provider.d.ts.map +1 -0
- package/lib/provider.js +6 -0
- package/lib/provider.js.map +1 -0
- package/lib/serializer.d.ts +10 -0
- package/lib/serializer.d.ts.map +1 -1
- package/lib/serializer.js +3 -0
- package/lib/serializer.js.map +1 -1
- package/lib/test/types/fluidObjectTypes.d.ts +2 -0
- package/lib/test/types/fluidObjectTypes.d.ts.map +1 -0
- package/lib/test/types/fluidObjectTypes.js +80 -0
- package/lib/test/types/fluidObjectTypes.js.map +1 -0
- package/lib/test/types/validate0.40.0.d.ts +2 -0
- package/lib/test/types/validate0.40.0.d.ts.map +1 -0
- package/lib/test/types/validate0.40.0.js +72 -0
- package/lib/test/types/validate0.40.0.js.map +1 -0
- package/lib/test/types/validate0.41.0.d.ts +2 -0
- package/lib/test/types/validate0.41.0.d.ts.map +1 -0
- package/lib/test/types/validate0.41.0.js +78 -0
- package/lib/test/types/validate0.41.0.js.map +1 -0
- package/package.json +19 -17
- package/src/fluidLoadable.ts +15 -0
- package/src/fluidObject.ts +39 -17
- package/src/fluidPackage.ts +25 -0
- package/src/handles.ts +3 -2
- package/src/index.ts +1 -0
- package/src/provider.ts +70 -0
- package/src/serializer.ts +10 -0
- package/tsconfig.json +3 -2
package/src/fluidPackage.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#IFluidPackageEnvironment}
|
|
8
|
+
* to have code loading modules in same package.
|
|
7
9
|
* Specifies an environment on Fluid property of a IFluidPackage
|
|
8
10
|
*/
|
|
9
11
|
export interface IFluidPackageEnvironment {
|
|
@@ -30,6 +32,8 @@ export interface IFluidPackageEnvironment {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
/**
|
|
35
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#IFluidPackage}
|
|
36
|
+
* to have code loading modules in same package.
|
|
33
37
|
* Fluid-specific properties expected on a package to be loaded by the code loader.
|
|
34
38
|
* While compatible with the npm package format it is not necessary that that package is an
|
|
35
39
|
* npm package:
|
|
@@ -59,6 +63,8 @@ export interface IFluidPackage {
|
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
/**
|
|
66
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#isFluidPackage}
|
|
67
|
+
* to have code loading modules in same package.
|
|
62
68
|
* Check if the package.json defines a Fluid package
|
|
63
69
|
* @param pkg - the package json data to check if it is a Fluid package.
|
|
64
70
|
*/
|
|
@@ -68,6 +74,8 @@ export const isFluidPackage = (pkg: any): pkg is Readonly<IFluidPackage> =>
|
|
|
68
74
|
&& typeof pkg?.fluid === "object";
|
|
69
75
|
|
|
70
76
|
/**
|
|
77
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#IFluidCodeDetailsConfig}
|
|
78
|
+
* to have code loading modules in same package.
|
|
71
79
|
* Package manager configuration. Provides a key value mapping of config values
|
|
72
80
|
*/
|
|
73
81
|
export interface IFluidCodeDetailsConfig {
|
|
@@ -75,6 +83,8 @@ export interface IFluidCodeDetailsConfig {
|
|
|
75
83
|
}
|
|
76
84
|
|
|
77
85
|
/**
|
|
86
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#IFluidCodeDetails}
|
|
87
|
+
* to have code loading modules in same package.
|
|
78
88
|
* Data structure used to describe the code to load on the Fluid document
|
|
79
89
|
*/
|
|
80
90
|
export interface IFluidCodeDetails {
|
|
@@ -90,6 +100,10 @@ export interface IFluidCodeDetails {
|
|
|
90
100
|
readonly config?: IFluidCodeDetailsConfig;
|
|
91
101
|
}
|
|
92
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#isFluidCodeDetails}
|
|
105
|
+
* to have code loading modules in same package
|
|
106
|
+
*/
|
|
93
107
|
export const isFluidCodeDetails = (details: unknown): details is Readonly<IFluidCodeDetails> =>{
|
|
94
108
|
const maybeCodeDetails = details as Partial<IFluidCodeDetails> | undefined;
|
|
95
109
|
return typeof maybeCodeDetails === "object"
|
|
@@ -97,13 +111,24 @@ export const isFluidCodeDetails = (details: unknown): details is Readonly<IFluid
|
|
|
97
111
|
&& (maybeCodeDetails?.config === undefined || typeof maybeCodeDetails?.config === "object");
|
|
98
112
|
};
|
|
99
113
|
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#IFluidCodeDetailsComparer}
|
|
116
|
+
* to have code loading modules in same package.
|
|
117
|
+
*/
|
|
100
118
|
export const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer = "IFluidCodeDetailsComparer";
|
|
101
119
|
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated in favor of
|
|
122
|
+
* {@link @fluidframework/container-definitions/fluidPackage.ts#IProvideFluidCodeDetailsComparer}
|
|
123
|
+
* to have code loading modules in same package.
|
|
124
|
+
*/
|
|
102
125
|
export interface IProvideFluidCodeDetailsComparer {
|
|
103
126
|
readonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer ;
|
|
104
127
|
}
|
|
105
128
|
|
|
106
129
|
/**
|
|
130
|
+
* @deprecated in favor of {@link @fluidframework/container-definitions/fluidPackage.ts#IFluidCodeDetailsComparer}
|
|
131
|
+
* to have code loading modules in same package.
|
|
107
132
|
* Provides capability to compare Fluid code details.
|
|
108
133
|
*/
|
|
109
134
|
export interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {
|
package/src/handles.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { IRequest, IResponse } from "./fluidRouter";
|
|
7
7
|
import { IFluidObject } from "./fluidObject";
|
|
8
8
|
import { IFluidLoadable } from "./fluidLoadable";
|
|
9
|
+
import { FluidObject } from "./provider";
|
|
9
10
|
|
|
10
11
|
export const IFluidHandleContext: keyof IProvideFluidHandleContext = "IFluidHandleContext";
|
|
11
12
|
|
|
@@ -51,8 +52,8 @@ export interface IProvideFluidHandle {
|
|
|
51
52
|
* Handle to a shared FluidObject
|
|
52
53
|
*/
|
|
53
54
|
export interface IFluidHandle<
|
|
54
|
-
// REVIEW: Constrain `T` to
|
|
55
|
-
T = IFluidObject & IFluidLoadable
|
|
55
|
+
// REVIEW: Constrain `T` to something? How do we support dds and datastores safely?
|
|
56
|
+
T = IFluidObject & FluidObject & IFluidLoadable
|
|
56
57
|
> extends IProvideFluidHandle {
|
|
57
58
|
|
|
58
59
|
/**
|
package/src/index.ts
CHANGED
package/src/provider.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* This utility type is meant for internal use by @see FluidObject
|
|
9
|
+
* Produces a valid FluidObject key given a type and a property.
|
|
10
|
+
* A valid FluidObject key is a property that exists on the incoming type
|
|
11
|
+
* as well as on the type of the property itself. For example, IProvideFoo.IFoo.IFoo
|
|
12
|
+
* This aligns with the FluidObject pattern expected to be used with all FluidObjects.
|
|
13
|
+
* For example:
|
|
14
|
+
* ```
|
|
15
|
+
* interface IProvideFoo{
|
|
16
|
+
* IFoo: IFoo
|
|
17
|
+
* }
|
|
18
|
+
* interface IFoo extends IProvideFoo{
|
|
19
|
+
* foobar();
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
* This pattern enables discovery, and delegation in a standard way which is central
|
|
23
|
+
* to FluidObject pattern
|
|
24
|
+
*/
|
|
25
|
+
export type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> =
|
|
26
|
+
string extends TProp ? never : number extends TProp? never : // exclude indexers [key:string |number]: any
|
|
27
|
+
TProp extends keyof Exclude<T[TProp], undefined> // TProp is a property of T, and T[TProp]
|
|
28
|
+
? TProp
|
|
29
|
+
:never;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* This utility type take interface(s) that follow the FluidObject pattern, and produces
|
|
33
|
+
* a new type that can be used for inspection and discovery of those interfaces.
|
|
34
|
+
*
|
|
35
|
+
* It is meant to be used with types that are known to implement the FluidObject pattern.
|
|
36
|
+
* A common way to specify a type implements the FluidObject pattern is to expose it as a
|
|
37
|
+
* FluidObject without a generic argument.
|
|
38
|
+
*
|
|
39
|
+
* For example, if we have an interface like below
|
|
40
|
+
* ```
|
|
41
|
+
* interface IProvideFoo{
|
|
42
|
+
* IFoo: IFoo
|
|
43
|
+
* }
|
|
44
|
+
* interface IFoo extends IProvideFoo{
|
|
45
|
+
* foobar();
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* and a function that returns a FluidObject. You would do the following
|
|
50
|
+
*
|
|
51
|
+
* `const maybeFoo: FluidObject<IFoo> = getFluidObject()`;
|
|
52
|
+
*
|
|
53
|
+
* Either IFoo or IProvideFoo are valid generic arguments. In both case
|
|
54
|
+
* maybeFoo will be of type `{IFoo?: IFoo}`. If IFoo is not undefined,
|
|
55
|
+
* then the FluidObject provides IFoo, and it can be used.
|
|
56
|
+
*
|
|
57
|
+
* You can inspect multiple types via a intersection. For example:
|
|
58
|
+
* `FluidObject<IFoo & IBar>`
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
export type FluidObject<T = unknown> = Partial<Pick<T, FluidObjectProviderKeys<T>>>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This utility type creates a type that is the union of all keys on the generic type
|
|
65
|
+
* which implement the FluidObject pattern. @see FluidObject
|
|
66
|
+
*
|
|
67
|
+
* For example `FluidObjectKeys<IFoo & IBar>` would result in `"IFoo" | "IBar"`
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
export type FluidObjectKeys<T> = keyof FluidObject<T>;
|
package/src/serializer.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { IFluidHandle } from "./handles";
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* JSON serialized form of an IFluidHandle
|
|
9
|
+
* @deprecated - Moved to fluidframework/shared-object-base package
|
|
9
10
|
*/
|
|
10
11
|
export interface ISerializedHandle {
|
|
11
12
|
// Marker to indicate to JSON.parse that the object is a Fluid handle
|
|
@@ -15,12 +16,21 @@ export interface ISerializedHandle {
|
|
|
15
16
|
url: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated - Moved to fluidframework/shared-object-base package
|
|
21
|
+
*/
|
|
18
22
|
export const IFluidSerializer: keyof IProvideFluidSerializer = "IFluidSerializer";
|
|
19
23
|
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated - Moved to fluidframework/shared-object-base package
|
|
26
|
+
*/
|
|
20
27
|
export interface IProvideFluidSerializer {
|
|
21
28
|
readonly IFluidSerializer: IFluidSerializer;
|
|
22
29
|
}
|
|
23
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated - Moved to fluidframework/shared-object-base package
|
|
33
|
+
*/
|
|
24
34
|
export interface IFluidSerializer extends IProvideFluidSerializer {
|
|
25
35
|
/**
|
|
26
36
|
* Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object
|
package/tsconfig.json
CHANGED