@fluidframework/fluid-static 2.0.0-dev-rc.2.0.0.246488 → 2.0.0-dev-rc.3.0.0.253463
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/api-report/fluid-static.api.md +13 -21
- package/dist/fluid-static-alpha.d.ts +14 -35
- package/dist/fluid-static-beta.d.ts +14 -35
- package/dist/fluid-static-public.d.ts +14 -35
- package/dist/fluid-static-untrimmed.d.ts +14 -35
- package/dist/fluidContainer.d.ts +3 -2
- package/dist/fluidContainer.d.ts.map +1 -1
- package/dist/fluidContainer.js +1 -0
- package/dist/fluidContainer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/rootDataObject.d.ts +1 -1
- package/dist/rootDataObject.d.ts.map +1 -1
- package/dist/rootDataObject.js +11 -9
- package/dist/rootDataObject.js.map +1 -1
- package/dist/serviceAudience.d.ts +2 -2
- package/dist/serviceAudience.d.ts.map +1 -1
- package/dist/serviceAudience.js.map +1 -1
- package/dist/types.d.ts +12 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +6 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +16 -9
- package/dist/utils.js.map +1 -1
- package/lib/fluid-static-alpha.d.ts +14 -35
- package/lib/fluid-static-beta.d.ts +14 -35
- package/lib/fluid-static-public.d.ts +14 -35
- package/lib/fluid-static-untrimmed.d.ts +14 -35
- package/lib/fluidContainer.d.ts +3 -2
- package/lib/fluidContainer.d.ts.map +1 -1
- package/lib/fluidContainer.js +1 -0
- package/lib/fluidContainer.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/rootDataObject.d.ts +1 -1
- package/lib/rootDataObject.d.ts.map +1 -1
- package/lib/rootDataObject.js +7 -5
- package/lib/rootDataObject.js.map +1 -1
- package/lib/serviceAudience.d.ts +2 -2
- package/lib/serviceAudience.d.ts.map +1 -1
- package/lib/serviceAudience.js.map +1 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +12 -31
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +6 -5
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +14 -7
- package/lib/utils.js.map +1 -1
- package/package.json +32 -31
- package/src/fluidContainer.ts +9 -7
- package/src/index.ts +0 -2
- package/src/rootDataObject.ts +15 -13
- package/src/serviceAudience.ts +4 -2
- package/src/types.ts +13 -34
- package/src/utils.ts +32 -19
- package/lib/test/fluidContainer.spec.js +0 -21
- package/lib/test/fluidContainer.spec.js.map +0 -1
- package/lib/test/types/validateFluidStaticPrevious.generated.js +0 -46
- package/lib/test/types/validateFluidStaticPrevious.generated.js.map +0 -1
- package/lib/test/utils.spec.js +0 -86
- package/lib/test/utils.spec.js.map +0 -1
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
8
|
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
9
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
10
9
|
import { IClient } from '@fluidframework/protocol-definitions';
|
|
11
|
-
import { IContainer } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
12
11
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
13
12
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
14
13
|
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
15
14
|
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
16
|
-
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions/internal';
|
|
16
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Represents properties that can be attached to a container.
|
|
@@ -76,11 +76,11 @@ export declare interface ContainerSchema {
|
|
|
76
76
|
* @typeParam T - The class of the `DataObject`.
|
|
77
77
|
* @public
|
|
78
78
|
*/
|
|
79
|
-
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
79
|
+
export declare type DataObjectClass<T extends IFluidLoadable = IFluidLoadable> = {
|
|
80
80
|
readonly factory: {
|
|
81
|
-
IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
81
|
+
readonly IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
82
82
|
};
|
|
83
|
-
} &
|
|
83
|
+
} & (new (...args: any[]) => T);
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Base interface for information for each connection made to the Fluid session.
|
|
@@ -92,11 +92,11 @@ export declare interface IConnection {
|
|
|
92
92
|
/**
|
|
93
93
|
* A unique ID for the connection. A single user may have multiple connections, each with a different ID.
|
|
94
94
|
*/
|
|
95
|
-
id: string;
|
|
95
|
+
readonly id: string;
|
|
96
96
|
/**
|
|
97
97
|
* Whether the connection is in read or read/write mode.
|
|
98
98
|
*/
|
|
99
|
-
mode: "write" | "read";
|
|
99
|
+
readonly mode: "write" | "read";
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
@@ -282,11 +282,11 @@ export declare interface IMember {
|
|
|
282
282
|
/**
|
|
283
283
|
* An ID for the user, unique among each individual user connecting to the session.
|
|
284
284
|
*/
|
|
285
|
-
userId: string;
|
|
285
|
+
readonly userId: string;
|
|
286
286
|
/**
|
|
287
287
|
* The set of connections the user has made, e.g. from multiple tabs or devices.
|
|
288
288
|
*/
|
|
289
|
-
connections: IConnection[];
|
|
289
|
+
readonly connections: IConnection[];
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
@@ -318,7 +318,7 @@ export declare interface IServiceAudience<M extends IMember> extends IEventProvi
|
|
|
318
318
|
* member object. The implementation may choose to exclude certain connections from the returned map.
|
|
319
319
|
* E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
|
|
320
320
|
*/
|
|
321
|
-
getMembers():
|
|
321
|
+
getMembers(): ReadonlyMap<string, M>;
|
|
322
322
|
/**
|
|
323
323
|
* Returns the current active user on this client once they are connected. Otherwise, returns undefined.
|
|
324
324
|
*/
|
|
@@ -367,10 +367,10 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
|
|
|
367
367
|
* There are some edge cases in TypeScript where the order of the members in a union matter.
|
|
368
368
|
* Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
|
|
369
369
|
* In this case, its better to have the desired match and/or the simpler type first.
|
|
370
|
-
* In this case placing
|
|
370
|
+
* In this case placing ISharedObjectKind fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
|
|
371
371
|
* This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
|
|
372
372
|
*/
|
|
373
|
-
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =
|
|
373
|
+
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = ISharedObjectKind<T> | DataObjectClass<T>;
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
376
|
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
@@ -379,14 +379,6 @@ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadabl
|
|
|
379
379
|
*/
|
|
380
380
|
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
|
|
381
381
|
|
|
382
|
-
/**
|
|
383
|
-
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
384
|
-
*
|
|
385
|
-
* @typeParam T - The class of the loadable object.
|
|
386
|
-
* @public
|
|
387
|
-
*/
|
|
388
|
-
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
389
|
-
|
|
390
382
|
/* Excluded from this release type: LoadableObjectRecord */
|
|
391
383
|
|
|
392
384
|
/**
|
|
@@ -405,20 +397,7 @@ export declare type MemberChangedListener<M extends IMember> = (clientId: string
|
|
|
405
397
|
* @public
|
|
406
398
|
*/
|
|
407
399
|
export declare type Myself<M extends IMember = IMember> = M & {
|
|
408
|
-
currentConnection: string;
|
|
400
|
+
readonly currentConnection: string;
|
|
409
401
|
};
|
|
410
402
|
|
|
411
|
-
/**
|
|
412
|
-
* A factory that produces a factory that can create a DDSes (`SharedObject`s).
|
|
413
|
-
*
|
|
414
|
-
* @typeParam T - The class of the `SharedObject`.
|
|
415
|
-
* @public
|
|
416
|
-
*/
|
|
417
|
-
export declare interface SharedObjectClass<T extends IFluidLoadable> {
|
|
418
|
-
/**
|
|
419
|
-
* Gets the factory this factory is a wrapper for.
|
|
420
|
-
*/
|
|
421
|
-
readonly getFactory: () => IChannelFactory<T>;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
403
|
export { }
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
8
|
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
9
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
10
9
|
import { IClient } from '@fluidframework/protocol-definitions';
|
|
11
|
-
import { IContainer } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
12
11
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
13
12
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
14
13
|
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
15
14
|
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
16
|
-
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions/internal';
|
|
16
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Represents properties that can be attached to a container.
|
|
@@ -76,11 +76,11 @@ export declare interface ContainerSchema {
|
|
|
76
76
|
* @typeParam T - The class of the `DataObject`.
|
|
77
77
|
* @public
|
|
78
78
|
*/
|
|
79
|
-
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
79
|
+
export declare type DataObjectClass<T extends IFluidLoadable = IFluidLoadable> = {
|
|
80
80
|
readonly factory: {
|
|
81
|
-
IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
81
|
+
readonly IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
82
82
|
};
|
|
83
|
-
} &
|
|
83
|
+
} & (new (...args: any[]) => T);
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Base interface for information for each connection made to the Fluid session.
|
|
@@ -92,11 +92,11 @@ export declare interface IConnection {
|
|
|
92
92
|
/**
|
|
93
93
|
* A unique ID for the connection. A single user may have multiple connections, each with a different ID.
|
|
94
94
|
*/
|
|
95
|
-
id: string;
|
|
95
|
+
readonly id: string;
|
|
96
96
|
/**
|
|
97
97
|
* Whether the connection is in read or read/write mode.
|
|
98
98
|
*/
|
|
99
|
-
mode: "write" | "read";
|
|
99
|
+
readonly mode: "write" | "read";
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/* Excluded from this release type: IContainer */
|
|
@@ -284,11 +284,11 @@ export declare interface IMember {
|
|
|
284
284
|
/**
|
|
285
285
|
* An ID for the user, unique among each individual user connecting to the session.
|
|
286
286
|
*/
|
|
287
|
-
userId: string;
|
|
287
|
+
readonly userId: string;
|
|
288
288
|
/**
|
|
289
289
|
* The set of connections the user has made, e.g. from multiple tabs or devices.
|
|
290
290
|
*/
|
|
291
|
-
connections: IConnection[];
|
|
291
|
+
readonly connections: IConnection[];
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
/**
|
|
@@ -322,7 +322,7 @@ export declare interface IServiceAudience<M extends IMember> extends IEventProvi
|
|
|
322
322
|
* member object. The implementation may choose to exclude certain connections from the returned map.
|
|
323
323
|
* E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
|
|
324
324
|
*/
|
|
325
|
-
getMembers():
|
|
325
|
+
getMembers(): ReadonlyMap<string, M>;
|
|
326
326
|
/**
|
|
327
327
|
* Returns the current active user on this client once they are connected. Otherwise, returns undefined.
|
|
328
328
|
*/
|
|
@@ -371,10 +371,10 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
|
|
|
371
371
|
* There are some edge cases in TypeScript where the order of the members in a union matter.
|
|
372
372
|
* Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
|
|
373
373
|
* In this case, its better to have the desired match and/or the simpler type first.
|
|
374
|
-
* In this case placing
|
|
374
|
+
* In this case placing ISharedObjectKind fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
|
|
375
375
|
* This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
|
|
376
376
|
*/
|
|
377
|
-
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =
|
|
377
|
+
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = ISharedObjectKind<T> | DataObjectClass<T>;
|
|
378
378
|
|
|
379
379
|
/**
|
|
380
380
|
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
@@ -383,14 +383,6 @@ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadabl
|
|
|
383
383
|
*/
|
|
384
384
|
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
|
|
385
385
|
|
|
386
|
-
/**
|
|
387
|
-
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
388
|
-
*
|
|
389
|
-
* @typeParam T - The class of the loadable object.
|
|
390
|
-
* @public
|
|
391
|
-
*/
|
|
392
|
-
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
393
|
-
|
|
394
386
|
/* Excluded from this release type: LoadableObjectRecord */
|
|
395
387
|
|
|
396
388
|
/**
|
|
@@ -409,20 +401,7 @@ export declare type MemberChangedListener<M extends IMember> = (clientId: string
|
|
|
409
401
|
* @public
|
|
410
402
|
*/
|
|
411
403
|
export declare type Myself<M extends IMember = IMember> = M & {
|
|
412
|
-
currentConnection: string;
|
|
404
|
+
readonly currentConnection: string;
|
|
413
405
|
};
|
|
414
406
|
|
|
415
|
-
/**
|
|
416
|
-
* A factory that produces a factory that can create a DDSes (`SharedObject`s).
|
|
417
|
-
*
|
|
418
|
-
* @typeParam T - The class of the `SharedObject`.
|
|
419
|
-
* @public
|
|
420
|
-
*/
|
|
421
|
-
export declare interface SharedObjectClass<T extends IFluidLoadable> {
|
|
422
|
-
/**
|
|
423
|
-
* Gets the factory this factory is a wrapper for.
|
|
424
|
-
*/
|
|
425
|
-
readonly getFactory: () => IChannelFactory<T>;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
407
|
export { }
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
8
|
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
9
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
10
9
|
import { IClient } from '@fluidframework/protocol-definitions';
|
|
11
|
-
import { IContainer } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
12
11
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
13
12
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
14
13
|
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
15
14
|
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
16
|
-
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions/internal';
|
|
16
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Represents properties that can be attached to a container.
|
|
@@ -76,11 +76,11 @@ export declare interface ContainerSchema {
|
|
|
76
76
|
* @typeParam T - The class of the `DataObject`.
|
|
77
77
|
* @public
|
|
78
78
|
*/
|
|
79
|
-
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
79
|
+
export declare type DataObjectClass<T extends IFluidLoadable = IFluidLoadable> = {
|
|
80
80
|
readonly factory: {
|
|
81
|
-
IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
81
|
+
readonly IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
82
82
|
};
|
|
83
|
-
} &
|
|
83
|
+
} & (new (...args: any[]) => T);
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Base interface for information for each connection made to the Fluid session.
|
|
@@ -92,11 +92,11 @@ export declare interface IConnection {
|
|
|
92
92
|
/**
|
|
93
93
|
* A unique ID for the connection. A single user may have multiple connections, each with a different ID.
|
|
94
94
|
*/
|
|
95
|
-
id: string;
|
|
95
|
+
readonly id: string;
|
|
96
96
|
/**
|
|
97
97
|
* Whether the connection is in read or read/write mode.
|
|
98
98
|
*/
|
|
99
|
-
mode: "write" | "read";
|
|
99
|
+
readonly mode: "write" | "read";
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/* Excluded from this release type: IContainer */
|
|
@@ -284,11 +284,11 @@ export declare interface IMember {
|
|
|
284
284
|
/**
|
|
285
285
|
* An ID for the user, unique among each individual user connecting to the session.
|
|
286
286
|
*/
|
|
287
|
-
userId: string;
|
|
287
|
+
readonly userId: string;
|
|
288
288
|
/**
|
|
289
289
|
* The set of connections the user has made, e.g. from multiple tabs or devices.
|
|
290
290
|
*/
|
|
291
|
-
connections: IConnection[];
|
|
291
|
+
readonly connections: IConnection[];
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
/**
|
|
@@ -322,7 +322,7 @@ export declare interface IServiceAudience<M extends IMember> extends IEventProvi
|
|
|
322
322
|
* member object. The implementation may choose to exclude certain connections from the returned map.
|
|
323
323
|
* E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
|
|
324
324
|
*/
|
|
325
|
-
getMembers():
|
|
325
|
+
getMembers(): ReadonlyMap<string, M>;
|
|
326
326
|
/**
|
|
327
327
|
* Returns the current active user on this client once they are connected. Otherwise, returns undefined.
|
|
328
328
|
*/
|
|
@@ -371,10 +371,10 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
|
|
|
371
371
|
* There are some edge cases in TypeScript where the order of the members in a union matter.
|
|
372
372
|
* Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
|
|
373
373
|
* In this case, its better to have the desired match and/or the simpler type first.
|
|
374
|
-
* In this case placing
|
|
374
|
+
* In this case placing ISharedObjectKind fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
|
|
375
375
|
* This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
|
|
376
376
|
*/
|
|
377
|
-
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =
|
|
377
|
+
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = ISharedObjectKind<T> | DataObjectClass<T>;
|
|
378
378
|
|
|
379
379
|
/**
|
|
380
380
|
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
@@ -383,14 +383,6 @@ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadabl
|
|
|
383
383
|
*/
|
|
384
384
|
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
|
|
385
385
|
|
|
386
|
-
/**
|
|
387
|
-
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
388
|
-
*
|
|
389
|
-
* @typeParam T - The class of the loadable object.
|
|
390
|
-
* @public
|
|
391
|
-
*/
|
|
392
|
-
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
393
|
-
|
|
394
386
|
/* Excluded from this release type: LoadableObjectRecord */
|
|
395
387
|
|
|
396
388
|
/**
|
|
@@ -409,20 +401,7 @@ export declare type MemberChangedListener<M extends IMember> = (clientId: string
|
|
|
409
401
|
* @public
|
|
410
402
|
*/
|
|
411
403
|
export declare type Myself<M extends IMember = IMember> = M & {
|
|
412
|
-
currentConnection: string;
|
|
404
|
+
readonly currentConnection: string;
|
|
413
405
|
};
|
|
414
406
|
|
|
415
|
-
/**
|
|
416
|
-
* A factory that produces a factory that can create a DDSes (`SharedObject`s).
|
|
417
|
-
*
|
|
418
|
-
* @typeParam T - The class of the `SharedObject`.
|
|
419
|
-
* @public
|
|
420
|
-
*/
|
|
421
|
-
export declare interface SharedObjectClass<T extends IFluidLoadable> {
|
|
422
|
-
/**
|
|
423
|
-
* Gets the factory this factory is a wrapper for.
|
|
424
|
-
*/
|
|
425
|
-
readonly getFactory: () => IChannelFactory<T>;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
407
|
export { }
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { AttachState } from '@fluidframework/container-definitions';
|
|
8
8
|
import { ConnectionState } from '@fluidframework/container-definitions';
|
|
9
|
-
import { IChannelFactory } from '@fluidframework/datastore-definitions';
|
|
10
9
|
import { IClient } from '@fluidframework/protocol-definitions';
|
|
11
|
-
import { IContainer } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IContainer } from '@fluidframework/container-definitions/internal';
|
|
12
11
|
import { ICriticalContainerError } from '@fluidframework/container-definitions';
|
|
13
12
|
import { IEvent } from '@fluidframework/core-interfaces';
|
|
14
13
|
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
15
14
|
import { IFluidLoadable } from '@fluidframework/core-interfaces';
|
|
16
|
-
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions/internal';
|
|
16
|
+
import { ISharedObjectKind } from '@fluidframework/shared-object-base';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Represents properties that can be attached to a container.
|
|
@@ -105,11 +105,11 @@ export declare function createServiceAudience<TMember extends IMember = IMember>
|
|
|
105
105
|
* @typeParam T - The class of the `DataObject`.
|
|
106
106
|
* @public
|
|
107
107
|
*/
|
|
108
|
-
export declare type DataObjectClass<T extends IFluidLoadable> = {
|
|
108
|
+
export declare type DataObjectClass<T extends IFluidLoadable = IFluidLoadable> = {
|
|
109
109
|
readonly factory: {
|
|
110
|
-
IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
110
|
+
readonly IFluidDataStoreFactory: DataObjectClass<T>["factory"];
|
|
111
111
|
};
|
|
112
|
-
} &
|
|
112
|
+
} & (new (...args: any[]) => T);
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Base interface for information for each connection made to the Fluid session.
|
|
@@ -121,11 +121,11 @@ export declare interface IConnection {
|
|
|
121
121
|
/**
|
|
122
122
|
* A unique ID for the connection. A single user may have multiple connections, each with a different ID.
|
|
123
123
|
*/
|
|
124
|
-
id: string;
|
|
124
|
+
readonly id: string;
|
|
125
125
|
/**
|
|
126
126
|
* Whether the connection is in read or read/write mode.
|
|
127
127
|
*/
|
|
128
|
-
mode: "write" | "read";
|
|
128
|
+
readonly mode: "write" | "read";
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
@@ -311,11 +311,11 @@ export declare interface IMember {
|
|
|
311
311
|
/**
|
|
312
312
|
* An ID for the user, unique among each individual user connecting to the session.
|
|
313
313
|
*/
|
|
314
|
-
userId: string;
|
|
314
|
+
readonly userId: string;
|
|
315
315
|
/**
|
|
316
316
|
* The set of connections the user has made, e.g. from multiple tabs or devices.
|
|
317
317
|
*/
|
|
318
|
-
connections: IConnection[];
|
|
318
|
+
readonly connections: IConnection[];
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
/**
|
|
@@ -370,7 +370,7 @@ export declare interface IServiceAudience<M extends IMember> extends IEventProvi
|
|
|
370
370
|
* member object. The implementation may choose to exclude certain connections from the returned map.
|
|
371
371
|
* E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
|
|
372
372
|
*/
|
|
373
|
-
getMembers():
|
|
373
|
+
getMembers(): ReadonlyMap<string, M>;
|
|
374
374
|
/**
|
|
375
375
|
* Returns the current active user on this client once they are connected. Otherwise, returns undefined.
|
|
376
376
|
*/
|
|
@@ -419,10 +419,10 @@ export declare interface IServiceAudienceEvents<M extends IMember> extends IEven
|
|
|
419
419
|
* There are some edge cases in TypeScript where the order of the members in a union matter.
|
|
420
420
|
* Once such edge case is when multiple members of a generic union partially match, and the type parameter is being inferred.
|
|
421
421
|
* In this case, its better to have the desired match and/or the simpler type first.
|
|
422
|
-
* In this case placing
|
|
422
|
+
* In this case placing ISharedObjectKind fixed one usage and didn't break anything, and generally seems more likely to work than the reverse, so this is the order being used.
|
|
423
423
|
* This is likely (a bug in TypeScript)[https://github.com/microsoft/TypeScript/issues/45809].
|
|
424
424
|
*/
|
|
425
|
-
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> =
|
|
425
|
+
export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadable> = ISharedObjectKind<T> | DataObjectClass<T>;
|
|
426
426
|
|
|
427
427
|
/**
|
|
428
428
|
* A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`
|
|
@@ -431,14 +431,6 @@ export declare type LoadableObjectClass<T extends IFluidLoadable = IFluidLoadabl
|
|
|
431
431
|
*/
|
|
432
432
|
export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass>;
|
|
433
433
|
|
|
434
|
-
/**
|
|
435
|
-
* An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.
|
|
436
|
-
*
|
|
437
|
-
* @typeParam T - The class of the loadable object.
|
|
438
|
-
* @public
|
|
439
|
-
*/
|
|
440
|
-
export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
|
|
441
|
-
|
|
442
434
|
/**
|
|
443
435
|
* A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
|
|
444
436
|
* @internal
|
|
@@ -461,20 +453,7 @@ export declare type MemberChangedListener<M extends IMember> = (clientId: string
|
|
|
461
453
|
* @public
|
|
462
454
|
*/
|
|
463
455
|
export declare type Myself<M extends IMember = IMember> = M & {
|
|
464
|
-
currentConnection: string;
|
|
456
|
+
readonly currentConnection: string;
|
|
465
457
|
};
|
|
466
458
|
|
|
467
|
-
/**
|
|
468
|
-
* A factory that produces a factory that can create a DDSes (`SharedObject`s).
|
|
469
|
-
*
|
|
470
|
-
* @typeParam T - The class of the `SharedObject`.
|
|
471
|
-
* @public
|
|
472
|
-
*/
|
|
473
|
-
export declare interface SharedObjectClass<T extends IFluidLoadable> {
|
|
474
|
-
/**
|
|
475
|
-
* Gets the factory this factory is a wrapper for.
|
|
476
|
-
*/
|
|
477
|
-
readonly getFactory: () => IChannelFactory<T>;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
459
|
export { }
|
package/lib/fluidContainer.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { AttachState, type ConnectionState, type ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
6
|
+
import { type IContainer } from "@fluidframework/container-definitions/internal";
|
|
5
7
|
import { type IEvent, type IEventProvider, type IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
|
-
import {
|
|
7
|
-
import type { ContainerSchema, ContainerAttachProps, IRootDataObject, LoadableObjectClass } from "./types.js";
|
|
8
|
+
import type { ContainerAttachProps, ContainerSchema, IRootDataObject, LoadableObjectClass } from "./types.js";
|
|
8
9
|
/**
|
|
9
10
|
* Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.
|
|
10
11
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidContainer.d.ts","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,KAAK,
|
|
1
|
+
{"version":3,"file":"fluidContainer.d.ts","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EACN,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EACX,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,IAAI;KAMtD,CAAC,IAAI,MAAM,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,mBAAmB,CACnF,MAAM,QAAQ,CACd,GACE,QAAQ,GACR,KAAK;CACR,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,qBAAsB,SAAQ,MAAM;IACpD;;;;;;;;;;OAUG;IACH,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEjD;;;;;;;;;;OAUG;IACH,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAEpD;;;;;;OAMG;IACH,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAE7C;;;;;;OAMG;IACH,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAE7C;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,KAAK,IAAI,OAAE;CACzE;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe,CAAC,gBAAgB,SAAS,eAAe,GAAG,eAAe,CAC1F,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAE1C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAE1D;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAElC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtD;;;;;;;;;;;OAWG;IACH,OAAO,IAAI,IAAI,CAAC;IAEhB;;;;;;;;;OASG;IACH,UAAU,IAAI,IAAI,CAAC;IAEnB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAElF;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,gBAAgB,SAAS,eAAe,GAAG,eAAe,EACzD,KAAK,EAAE;IACR,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,eAAe,CAAC;CAChC,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAEpC"}
|
package/lib/fluidContainer.js
CHANGED
|
@@ -93,6 +93,7 @@ class FluidContainer extends TypedEventEmitter {
|
|
|
93
93
|
* but internally this separation is not there.
|
|
94
94
|
*/
|
|
95
95
|
async attach(props) {
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- AB#7608
|
|
96
97
|
if (this.container.attachState !== AttachState.Detached) {
|
|
97
98
|
throw new Error("Cannot attach container. Container is not in detached state.");
|
|
98
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\ttype IEvent,\n\ttype IEventProvider,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tAttachState,\n\ttype IContainer,\n\ttype ICriticalContainerError,\n\ttype ConnectionState,\n} from \"@fluidframework/container-definitions\";\nimport type {\n\tContainerSchema,\n\tContainerAttachProps,\n\tIRootDataObject,\n\tLoadableObjectClass,\n} from \"./types.js\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @public\n */\nexport type InitialObjects<T extends ContainerSchema> = {\n\t// Construct a LoadableObjectRecord type by enumerating the keys of\n\t// 'ContainerSchema.initialObjects' and inferring the value type of each key.\n\t//\n\t// The '? TChannel : never' is required because infer can only be used in\n\t// a conditional 'extends' expression.\n\t[K in keyof T[\"initialObjects\"]]: T[\"initialObjects\"][K] extends LoadableObjectClass<\n\t\tinfer TChannel\n\t>\n\t\t? TChannel\n\t\t: never;\n};\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks Note: external implementations of this interface are not supported.\n * @sealed\n * @public\n */\nexport interface IFluidContainerEvents extends IEvent {\n\t/**\n\t * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.connect}\n\t */\n\t(event: \"connected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.disconnect}\n\t */\n\t(event: \"disconnected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when all local changes/edits have been acknowledged by the service.\n\t *\n\t * @remarks \"dirty\" event will be emitted when the next local change has been made.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"saved\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the first local change has been made, following a \"saved\" event.\n\t *\n\t * @remarks \"saved\" event will be emitted once all local changes have been acknowledged by the service.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"dirty\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} is closed, which permanently disables it.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `error`: If the container was closed due to error (as opposed to an explicit call to\n\t * {@link IFluidContainer.dispose}), this will contain details about the error that caused it.\n\t */\n\t(event: \"disposed\", listener: (error?: ICriticalContainerError) => void);\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n *\n * @remarks Note: external implementations of this interface are not supported.\n *\n * @sealed\n * @public\n */\nexport interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends IEventProvider<IFluidContainerEvents> {\n\t/**\n\t * Provides the current connected state of the container\n\t */\n\treadonly connectionState: ConnectionState;\n\n\t/**\n\t * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n\t *\n\t * @remarks\n\t *\n\t * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n\t * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n\t * acknowledged by the service.\n\t *\n\t * A container is considered dirty in the following cases:\n\t *\n\t * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n\t * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n\t * attached, host may never know if the file was created or not.\n\t *\n\t * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n\t * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n\t * service. In some cases this can be due to lack of network connection. If the network connection is down,\n\t * it needs to be restored for the pending changes to be acknowledged.\n\t */\n\treadonly isDirty: boolean;\n\n\t/**\n\t * Whether or not the container is disposed, which permanently disables it.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n\t *\n\t * @remarks These data objects and DDSes exist for the lifetime of the container.\n\t */\n\treadonly initialObjects: InitialObjects<TContainerSchema>;\n\n\t/**\n\t * The current attachment state of the container.\n\t *\n\t * @remarks\n\t *\n\t * Once a container has been attached, it remains attached.\n\t * When loading an existing container, it will already be attached.\n\t */\n\treadonly attachState: AttachState;\n\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.attachState}.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(props?: ContainerAttachProps): Promise<string>;\n\n\t/**\n\t * Attempts to connect the container to the delta stream and process operations.\n\t *\n\t * @throws Will throw an error if connection is unsuccessful.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tconnect(): void;\n\n\t/**\n\t * Disconnects the container from the delta stream and stops processing operations.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tdisconnect(): void;\n\n\t/**\n\t * Create a new data object or Distributed Data Store (DDS) of the specified type.\n\t *\n\t * @remarks\n\t *\n\t * In order to share the data object or DDS with other\n\t * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n\t * initialObjects.\n\t *\n\t * @param objectClass - The class of the `DataObject` or `SharedObject` to create.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n\t/**\n\t * Dispose of the container instance, permanently disabling it.\n\t */\n\tdispose(): void;\n}\n\n/**\n * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.\n *\n * @internal\n */\nexport function createFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n>(props: {\n\tcontainer: IContainer;\n\trootDataObject: IRootDataObject;\n}): IFluidContainer<TContainerSchema> {\n\treturn new FluidContainer<TContainerSchema>(props.container, props.rootDataObject);\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n * @remarks\n *\n * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead\n * @internal\n */\nclass FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends TypedEventEmitter<IFluidContainerEvents>\n\timplements IFluidContainer<TContainerSchema>\n{\n\tprivate readonly connectedHandler = (): boolean => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = (): boolean => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError): boolean =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = (): boolean => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = (): boolean => this.emit(\"dirty\");\n\n\tpublic constructor(\n\t\tprivate readonly container: IContainer,\n\t\tprivate readonly rootDataObject: IRootDataObject,\n\t) {\n\t\tsuper();\n\t\tcontainer.on(\"connected\", this.connectedHandler);\n\t\tcontainer.on(\"closed\", this.disposedHandler);\n\t\tcontainer.on(\"disconnected\", this.disconnectedHandler);\n\t\tcontainer.on(\"saved\", this.savedHandler);\n\t\tcontainer.on(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.isDirty}\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this.container.isDirty;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.attachState}\n\t */\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this.container.closed;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connectionState}\n\t */\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.container.connectionState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.initialObjects}\n\t */\n\tpublic get initialObjects(): InitialObjects<TContainerSchema> {\n\t\treturn this.rootDataObject.initialObjects as InitialObjects<TContainerSchema>;\n\t}\n\n\t/**\n\t * Incomplete base implementation of {@link IFluidContainer.attach}.\n\t *\n\t * @remarks\n\t *\n\t * Note: this implementation will unconditionally throw.\n\t * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n\t * that provides an implementation of this method.\n\t *\n\t * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n\t * but internally this separation is not there.\n\t */\n\tpublic async attach(props?: ContainerAttachProps): Promise<string> {\n\t\tif (this.container.attachState !== AttachState.Detached) {\n\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state.\");\n\t\t}\n\t\tthrow new Error(\"Cannot attach container. Attach method not provided.\");\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async connect(): Promise<void> {\n\t\tthis.container.connect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async disconnect(): Promise<void> {\n\t\tthis.container.disconnect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\treturn this.rootDataObject.create(objectClass);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis.container.close();\n\t\tthis.container.off(\"connected\", this.connectedHandler);\n\t\tthis.container.off(\"closed\", this.disposedHandler);\n\t\tthis.container.off(\"disconnected\", this.disconnectedHandler);\n\t\tthis.container.off(\"saved\", this.savedHandler);\n\t\tthis.container.off(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * FOR INTERNAL USE ONLY. NOT FOR EXTERNAL USE.\n\t * We make no stability guarantees here whatsoever.\n\t *\n\t * Gets the underlying {@link @fluidframework/container-definitions#IContainer}.\n\t *\n\t * @remarks Used to power debug tooling.\n\t */\n\tpublic readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer = () => {\n\t\treturn this.container;\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"fluidContainer.js","sourceRoot":"","sources":["../src/fluidContainer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACN,WAAW,GAGX,MAAM,uCAAuC,CAAC;AA2N/C;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAElC,KAGD;IACA,OAAO,IAAI,cAAc,CAAmB,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;AACpF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,cACL,SAAQ,iBAAwC;IAUhD,YACkB,SAAqB,EACrB,cAA+B;QAEhD,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,mBAAc,GAAd,cAAc,CAAiB;QAThC,qBAAgB,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzD,wBAAmB,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/D,oBAAe,GAAG,CAAC,KAA+B,EAAW,EAAE,CAC/E,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACb,iBAAY,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,iBAAY,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAsGlE;;;;;;;WAOG;QACa,kCAA6B,GAAsB,GAAG,EAAE;YACvE,OAAO,IAAI,CAAC,SAAS,CAAC;QACvB,CAAC,CAAC;QAzGD,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACjD,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAC7C,SAAS,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACvD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACxB,OAAO,IAAI,CAAC,cAAc,CAAC,cAAkD,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,MAAM,CAAC,KAA4B;QAC/C,mFAAmF;QACnF,IAAI,IAAI,CAAC,SAAS,CAAC,WAAW,KAAK,WAAW,CAAC,QAAQ,EAAE;YACxD,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;SAChF;QACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM,CAA2B,WAAmC;QAChF,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,OAAO;QACb,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC7D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;CAaD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tAttachState,\n\ttype ConnectionState,\n\ttype ICriticalContainerError,\n} from \"@fluidframework/container-definitions\";\nimport { type IContainer } from \"@fluidframework/container-definitions/internal\";\nimport {\n\ttype IEvent,\n\ttype IEventProvider,\n\ttype IFluidLoadable,\n} from \"@fluidframework/core-interfaces\";\n\nimport type {\n\tContainerAttachProps,\n\tContainerSchema,\n\tIRootDataObject,\n\tLoadableObjectClass,\n} from \"./types.js\";\n\n/**\n * Extract the type of 'initialObjects' from the given {@link ContainerSchema} type.\n * @public\n */\nexport type InitialObjects<T extends ContainerSchema> = {\n\t// Construct a LoadableObjectRecord type by enumerating the keys of\n\t// 'ContainerSchema.initialObjects' and inferring the value type of each key.\n\t//\n\t// The '? TChannel : never' is required because infer can only be used in\n\t// a conditional 'extends' expression.\n\t[K in keyof T[\"initialObjects\"]]: T[\"initialObjects\"][K] extends LoadableObjectClass<\n\t\tinfer TChannel\n\t>\n\t\t? TChannel\n\t\t: never;\n};\n\n/**\n * Events emitted from {@link IFluidContainer}.\n *\n * @remarks Note: external implementations of this interface are not supported.\n * @sealed\n * @public\n */\nexport interface IFluidContainerEvents extends IEvent {\n\t/**\n\t * Emitted when the {@link IFluidContainer} completes connecting to the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.connect}\n\t */\n\t(event: \"connected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} becomes disconnected from the Fluid service.\n\t *\n\t * @remarks Reflects connection state changes against the (delta) service acknowledging ops/edits.\n\t *\n\t * @see\n\t *\n\t * - {@link IFluidContainer.connectionState}\n\t *\n\t * - {@link IFluidContainer.disconnect}\n\t */\n\t(event: \"disconnected\", listener: () => void): void;\n\n\t/**\n\t * Emitted when all local changes/edits have been acknowledged by the service.\n\t *\n\t * @remarks \"dirty\" event will be emitted when the next local change has been made.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"saved\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the first local change has been made, following a \"saved\" event.\n\t *\n\t * @remarks \"saved\" event will be emitted once all local changes have been acknowledged by the service.\n\t *\n\t * @see {@link IFluidContainer.isDirty}\n\t */\n\t(event: \"dirty\", listener: () => void): void;\n\n\t/**\n\t * Emitted when the {@link IFluidContainer} is closed, which permanently disables it.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `error`: If the container was closed due to error (as opposed to an explicit call to\n\t * {@link IFluidContainer.dispose}), this will contain details about the error that caused it.\n\t */\n\t(event: \"disposed\", listener: (error?: ICriticalContainerError) => void);\n}\n\n/**\n * Provides an entrypoint into the client side of collaborative Fluid data.\n * Provides access to the data as well as status on the collaboration session.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n *\n * @remarks Note: external implementations of this interface are not supported.\n *\n * @sealed\n * @public\n */\nexport interface IFluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends IEventProvider<IFluidContainerEvents> {\n\t/**\n\t * Provides the current connected state of the container\n\t */\n\treadonly connectionState: ConnectionState;\n\n\t/**\n\t * A container is considered **dirty** if it has local changes that have not yet been acknowledged by the service.\n\t *\n\t * @remarks\n\t *\n\t * You should always check the `isDirty` flag before closing the container or navigating away from the page.\n\t * Closing the container while `isDirty === true` may result in the loss of operations that have not yet been\n\t * acknowledged by the service.\n\t *\n\t * A container is considered dirty in the following cases:\n\t *\n\t * 1. The container has been created in the detached state, and either it has not been attached yet or it is\n\t * in the process of being attached (container is in `attaching` state). If container is closed prior to being\n\t * attached, host may never know if the file was created or not.\n\t *\n\t * 2. The container was attached, but it has local changes that have not yet been saved to service endpoint.\n\t * This occurs as part of normal op flow where pending operation (changes) are awaiting acknowledgement from the\n\t * service. In some cases this can be due to lack of network connection. If the network connection is down,\n\t * it needs to be restored for the pending changes to be acknowledged.\n\t */\n\treadonly isDirty: boolean;\n\n\t/**\n\t * Whether or not the container is disposed, which permanently disables it.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * The collection of data objects and Distributed Data Stores (DDSes) that were specified by the schema.\n\t *\n\t * @remarks These data objects and DDSes exist for the lifetime of the container.\n\t */\n\treadonly initialObjects: InitialObjects<TContainerSchema>;\n\n\t/**\n\t * The current attachment state of the container.\n\t *\n\t * @remarks\n\t *\n\t * Once a container has been attached, it remains attached.\n\t * When loading an existing container, it will already be attached.\n\t */\n\treadonly attachState: AttachState;\n\n\t/**\n\t * A newly created container starts detached from the collaborative service.\n\t * Calling `attach()` uploads the new container to the service and connects to the collaborative service.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#AttachState.Detatched} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.attachState}.\n\t *\n\t * @returns A promise which resolves when the attach is complete, with the string identifier of the container.\n\t */\n\tattach(props?: ContainerAttachProps): Promise<string>;\n\n\t/**\n\t * Attempts to connect the container to the delta stream and process operations.\n\t *\n\t * @throws Will throw an error if connection is unsuccessful.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Disconnected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tconnect(): void;\n\n\t/**\n\t * Disconnects the container from the delta stream and stops processing operations.\n\t *\n\t * @remarks\n\t *\n\t * This should only be called when the container is in the\n\t * {@link @fluidframework/container-definitions#(ConnectionState:namespace).Connected} state.\n\t *\n\t * This can be determined by observing {@link IFluidContainer.connectionState}.\n\t */\n\tdisconnect(): void;\n\n\t/**\n\t * Create a new data object or Distributed Data Store (DDS) of the specified type.\n\t *\n\t * @remarks\n\t *\n\t * In order to share the data object or DDS with other\n\t * collaborators and retrieve it later, store its handle in a collection like a SharedDirectory from your\n\t * initialObjects.\n\t *\n\t * @param objectClass - The class of the `DataObject` or `SharedObject` to create.\n\t *\n\t * @typeParam T - The class of the `DataObject` or `SharedObject`.\n\t */\n\tcreate<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T>;\n\n\t/**\n\t * Dispose of the container instance, permanently disabling it.\n\t */\n\tdispose(): void;\n}\n\n/**\n * Creates an {@link IFluidContainer} from the provided `container` and `rootDataObject`.\n *\n * @internal\n */\nexport function createFluidContainer<\n\tTContainerSchema extends ContainerSchema = ContainerSchema,\n>(props: {\n\tcontainer: IContainer;\n\trootDataObject: IRootDataObject;\n}): IFluidContainer<TContainerSchema> {\n\treturn new FluidContainer<TContainerSchema>(props.container, props.rootDataObject);\n}\n\n/**\n * Base {@link IFluidContainer} implementation.\n *\n * @typeparam TContainerSchema - Used to determine the type of 'initialObjects'.\n * @remarks\n *\n * Note: this implementation is not complete. Consumers who rely on {@link IFluidContainer.attach}\n * will need to utilize or provide a service-specific implementation of this type that implements that method.\n * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead\n * @internal\n */\nclass FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>\n\textends TypedEventEmitter<IFluidContainerEvents>\n\timplements IFluidContainer<TContainerSchema>\n{\n\tprivate readonly connectedHandler = (): boolean => this.emit(\"connected\");\n\tprivate readonly disconnectedHandler = (): boolean => this.emit(\"disconnected\");\n\tprivate readonly disposedHandler = (error?: ICriticalContainerError): boolean =>\n\t\tthis.emit(\"disposed\", error);\n\tprivate readonly savedHandler = (): boolean => this.emit(\"saved\");\n\tprivate readonly dirtyHandler = (): boolean => this.emit(\"dirty\");\n\n\tpublic constructor(\n\t\tprivate readonly container: IContainer,\n\t\tprivate readonly rootDataObject: IRootDataObject,\n\t) {\n\t\tsuper();\n\t\tcontainer.on(\"connected\", this.connectedHandler);\n\t\tcontainer.on(\"closed\", this.disposedHandler);\n\t\tcontainer.on(\"disconnected\", this.disconnectedHandler);\n\t\tcontainer.on(\"saved\", this.savedHandler);\n\t\tcontainer.on(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.isDirty}\n\t */\n\tpublic get isDirty(): boolean {\n\t\treturn this.container.isDirty;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.attachState}\n\t */\n\tpublic get attachState(): AttachState {\n\t\treturn this.container.attachState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.disposed}\n\t */\n\tpublic get disposed(): boolean {\n\t\treturn this.container.closed;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connectionState}\n\t */\n\tpublic get connectionState(): ConnectionState {\n\t\treturn this.container.connectionState;\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.initialObjects}\n\t */\n\tpublic get initialObjects(): InitialObjects<TContainerSchema> {\n\t\treturn this.rootDataObject.initialObjects as InitialObjects<TContainerSchema>;\n\t}\n\n\t/**\n\t * Incomplete base implementation of {@link IFluidContainer.attach}.\n\t *\n\t * @remarks\n\t *\n\t * Note: this implementation will unconditionally throw.\n\t * Consumers who rely on this will need to utilize or provide a service specific implementation of this base type\n\t * that provides an implementation of this method.\n\t *\n\t * The reason is because externally we are presenting a separation between the service and the `FluidContainer`,\n\t * but internally this separation is not there.\n\t */\n\tpublic async attach(props?: ContainerAttachProps): Promise<string> {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- AB#7608\n\t\tif (this.container.attachState !== AttachState.Detached) {\n\t\t\tthrow new Error(\"Cannot attach container. Container is not in detached state.\");\n\t\t}\n\t\tthrow new Error(\"Cannot attach container. Attach method not provided.\");\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async connect(): Promise<void> {\n\t\tthis.container.connect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.connect}\n\t */\n\tpublic async disconnect(): Promise<void> {\n\t\tthis.container.disconnect?.();\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\treturn this.rootDataObject.create(objectClass);\n\t}\n\n\t/**\n\t * {@inheritDoc IFluidContainer.dispose}\n\t */\n\tpublic dispose(): void {\n\t\tthis.container.close();\n\t\tthis.container.off(\"connected\", this.connectedHandler);\n\t\tthis.container.off(\"closed\", this.disposedHandler);\n\t\tthis.container.off(\"disconnected\", this.disconnectedHandler);\n\t\tthis.container.off(\"saved\", this.savedHandler);\n\t\tthis.container.off(\"dirty\", this.dirtyHandler);\n\t}\n\n\t/**\n\t * FOR INTERNAL USE ONLY. NOT FOR EXTERNAL USE.\n\t * We make no stability guarantees here whatsoever.\n\t *\n\t * Gets the underlying {@link @fluidframework/container-definitions#IContainer}.\n\t *\n\t * @remarks Used to power debug tooling.\n\t */\n\tpublic readonly INTERNAL_CONTAINER_DO_NOT_USE?: () => IContainer = () => {\n\t\treturn this.container;\n\t};\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
export { createFluidContainer, type IFluidContainer, type IFluidContainerEvents, type InitialObjects, } from "./fluidContainer.js";
|
|
11
11
|
export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.js";
|
|
12
12
|
export { createServiceAudience } from "./serviceAudience.js";
|
|
13
|
-
export { type ContainerSchema, type ContainerAttachProps, type DataObjectClass, type IConnection, type IMember, type IRootDataObject, type IServiceAudience, type IServiceAudienceEvents, type LoadableObjectClass, type LoadableObjectClassRecord, type
|
|
13
|
+
export { type ContainerSchema, type ContainerAttachProps, type DataObjectClass, type IConnection, type IMember, type IRootDataObject, type IServiceAudience, type IServiceAudienceEvents, type LoadableObjectClass, type LoadableObjectClassRecord, type LoadableObjectRecord, type MemberChangedListener, type Myself, type IProvideRootDataObject, } from "./types.js";
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
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;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,sBAAsB,GAC3B,MAAM,YAAY,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,GAIpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Provides a simple and powerful way to consume collaborative Fluid data.\n *\n * @packageDocumentation\n */\n\nexport {\n\tcreateFluidContainer,\n\ttype IFluidContainer,\n\ttype IFluidContainerEvents,\n\ttype InitialObjects,\n} from \"./fluidContainer.js\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject.js\";\nexport { createServiceAudience } from \"./serviceAudience.js\";\nexport {\n\ttype ContainerSchema,\n\ttype ContainerAttachProps,\n\ttype DataObjectClass,\n\ttype IConnection,\n\ttype IMember,\n\ttype IRootDataObject,\n\ttype IServiceAudience,\n\ttype IServiceAudienceEvents,\n\ttype LoadableObjectClass,\n\ttype LoadableObjectClassRecord,\n\ttype
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EACN,oBAAoB,GAIpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uCAAuC,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Provides a simple and powerful way to consume collaborative Fluid data.\n *\n * @packageDocumentation\n */\n\nexport {\n\tcreateFluidContainer,\n\ttype IFluidContainer,\n\ttype IFluidContainerEvents,\n\ttype InitialObjects,\n} from \"./fluidContainer.js\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject.js\";\nexport { createServiceAudience } from \"./serviceAudience.js\";\nexport {\n\ttype ContainerSchema,\n\ttype ContainerAttachProps,\n\ttype DataObjectClass,\n\ttype IConnection,\n\ttype IMember,\n\ttype IRootDataObject,\n\ttype IServiceAudience,\n\ttype IServiceAudienceEvents,\n\ttype LoadableObjectClass,\n\ttype LoadableObjectClassRecord,\n\ttype LoadableObjectRecord,\n\ttype MemberChangedListener,\n\ttype Myself,\n\ttype IProvideRootDataObject,\n} from \"./types.js\";\n"]}
|
package/lib/rootDataObject.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { type IRuntimeFactory } from "@fluidframework/container-definitions";
|
|
5
|
+
import { type IRuntimeFactory } from "@fluidframework/container-definitions/internal";
|
|
6
6
|
import { type ContainerSchema, type LoadableObjectClassRecord } from "./types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Input props for {@link RootDataObject.initializingFirstTime}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gDAAgD,CAAC;AActF,OAAO,EACN,KAAK,eAAe,EAGpB,KAAK,yBAAyB,EAE9B,MAAM,YAAY,CAAC;AAQpB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,cAAc,EAAE,yBAAyB,CAAC;CAC1C;AA+GD;;;;;GAKG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CAElB"}
|