@fluidframework/fluid-static 2.0.0-internal.7.4.0 → 2.0.0-internal.8.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/api-report/fluid-static.api.md +4 -43
  3. package/dist/fluid-static-alpha.d.ts +3 -12
  4. package/dist/fluid-static-beta.d.ts +0 -21
  5. package/dist/fluid-static-public.d.ts +0 -21
  6. package/dist/fluid-static-untrimmed.d.ts +4 -175
  7. package/dist/fluidContainer.cjs +1 -2
  8. package/dist/fluidContainer.cjs.map +1 -1
  9. package/dist/fluidContainer.d.ts +0 -84
  10. package/dist/fluidContainer.d.ts.map +1 -1
  11. package/dist/index.cjs +1 -4
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/rootDataObject.cjs +23 -12
  16. package/dist/rootDataObject.cjs.map +1 -1
  17. package/dist/rootDataObject.d.ts +0 -25
  18. package/dist/rootDataObject.d.ts.map +1 -1
  19. package/dist/serviceAudience.cjs +4 -11
  20. package/dist/serviceAudience.cjs.map +1 -1
  21. package/dist/serviceAudience.d.ts +2 -70
  22. package/dist/serviceAudience.d.ts.map +1 -1
  23. package/dist/types.cjs.map +1 -1
  24. package/dist/types.d.ts +4 -3
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/utils.cjs +3 -1
  27. package/dist/utils.cjs.map +1 -1
  28. package/dist/utils.d.ts +10 -2
  29. package/dist/utils.d.ts.map +1 -1
  30. package/lib/fluid-static-alpha.d.ts +3 -12
  31. package/lib/fluid-static-beta.d.ts +0 -21
  32. package/lib/fluid-static-public.d.ts +0 -21
  33. package/lib/fluid-static-untrimmed.d.ts +4 -175
  34. package/lib/fluidContainer.d.ts +0 -80
  35. package/lib/fluidContainer.d.ts.map +1 -1
  36. package/lib/fluidContainer.mjs +1 -1
  37. package/lib/fluidContainer.mjs.map +1 -1
  38. package/lib/index.d.ts +3 -3
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/index.mjs +3 -3
  41. package/lib/index.mjs.map +1 -1
  42. package/lib/rootDataObject.d.ts +0 -21
  43. package/lib/rootDataObject.d.ts.map +1 -1
  44. package/lib/rootDataObject.mjs +25 -15
  45. package/lib/rootDataObject.mjs.map +1 -1
  46. package/lib/serviceAudience.d.ts +2 -70
  47. package/lib/serviceAudience.d.ts.map +1 -1
  48. package/lib/serviceAudience.mjs +4 -10
  49. package/lib/serviceAudience.mjs.map +1 -1
  50. package/lib/types.d.ts +4 -3
  51. package/lib/types.d.ts.map +1 -1
  52. package/lib/types.mjs.map +1 -1
  53. package/lib/utils.d.ts +10 -2
  54. package/lib/utils.d.ts.map +1 -1
  55. package/lib/utils.mjs +3 -1
  56. package/lib/utils.mjs.map +1 -1
  57. package/package.json +32 -15
  58. package/src/fluidContainer.ts +1 -1
  59. package/src/index.ts +2 -6
  60. package/src/rootDataObject.ts +33 -18
  61. package/src/serviceAudience.ts +7 -20
  62. package/src/types.ts +2 -3
  63. package/src/utils.ts +20 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EACN,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,cAAc,GACd;OACM,EACN,iCAAiC,EACjC,uCAAuC,GACvC;OACM,EAAE,eAAe,EAAE,qBAAqB,EAAE;OAC1C,EACN,eAAe,EACf,eAAe,EACf,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,sBAAsB,GACtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EACN,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,cAAc,GACd;OACM,EAAE,uCAAuC,EAAE;OAC3C,EAAE,qBAAqB,EAAE;OACzB,EACN,eAAe,EACf,eAAe,EACf,WAAW,EACX,OAAO,EACP,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,EACN,iBAAiB,EACjB,sBAAsB,GACtB"}
package/lib/index.mjs 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
- export { FluidContainer, createFluidContainer, } from "./fluidContainer.mjs";
6
- export { DOProviderContainerRuntimeFactory, createDOProviderContainerRuntimeFactory, } from "./rootDataObject.mjs";
7
- export { ServiceAudience, createServiceAudience } from "./serviceAudience.mjs";
5
+ export { createFluidContainer, } from "./fluidContainer.mjs";
6
+ export { createDOProviderContainerRuntimeFactory } from "./rootDataObject.mjs";
7
+ export { createServiceAudience } from "./serviceAudience.mjs";
8
8
  //# sourceMappingURL=index.mjs.map
package/lib/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EACN,cAAc,EACd,oBAAoB,GAIpB;OACM,EACN,iCAAiC,EACjC,uCAAuC,GACvC;OACM,EAAE,eAAe,EAAE,qBAAqB,EAAE","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\tFluidContainer,\n\tcreateFluidContainer,\n\tIFluidContainer,\n\tIFluidContainerEvents,\n\tInitialObjects,\n} from \"./fluidContainer\";\nexport {\n\tDOProviderContainerRuntimeFactory,\n\tcreateDOProviderContainerRuntimeFactory,\n} from \"./rootDataObject\";\nexport { ServiceAudience, createServiceAudience } from \"./serviceAudience\";\nexport {\n\tContainerSchema,\n\tDataObjectClass,\n\tIConnection,\n\tIMember,\n\tIRootDataObject,\n\tIServiceAudience,\n\tIServiceAudienceEvents,\n\tLoadableObjectClass,\n\tLoadableObjectClassRecord,\n\tLoadableObjectCtor,\n\tLoadableObjectRecord,\n\tMemberChangedListener,\n\tMyself,\n\tSharedObjectClass,\n\tIProvideRootDataObject,\n} from \"./types\";\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EACN,oBAAoB,GAIpB;OACM,EAAE,uCAAuC,EAAE;OAC3C,EAAE,qBAAqB,EAAE","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\tIFluidContainer,\n\tIFluidContainerEvents,\n\tInitialObjects,\n} from \"./fluidContainer\";\nexport { createDOProviderContainerRuntimeFactory } from \"./rootDataObject\";\nexport { createServiceAudience } from \"./serviceAudience\";\nexport {\n\tContainerSchema,\n\tDataObjectClass,\n\tIConnection,\n\tIMember,\n\tIRootDataObject,\n\tIServiceAudience,\n\tIServiceAudienceEvents,\n\tLoadableObjectClass,\n\tLoadableObjectClassRecord,\n\tLoadableObjectCtor,\n\tLoadableObjectRecord,\n\tMemberChangedListener,\n\tMyself,\n\tSharedObjectClass,\n\tIProvideRootDataObject,\n} from \"./types\";\n"]}
@@ -1,5 +1,3 @@
1
- import { BaseContainerRuntimeFactory } from "@fluidframework/aqueduct";
2
- import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
3
1
  import { IRuntimeFactory } from "@fluidframework/container-definitions";
4
2
  import { ContainerSchema, LoadableObjectClassRecord } from "./types.mjs";
5
3
  /**
@@ -19,23 +17,4 @@ export interface RootDataObjectProps {
19
17
  export declare function createDOProviderContainerRuntimeFactory(props: {
20
18
  schema: ContainerSchema;
21
19
  }): IRuntimeFactory;
22
- /**
23
- * Container code that provides a single {@link IRootDataObject}.
24
- *
25
- * @remarks
26
- *
27
- * This data object is dynamically customized (registry and initial objects) based on the schema provided.
28
- * to the container runtime factory.
29
- * @deprecated use {@link createDOProviderContainerRuntimeFactory} instead
30
- * @internal
31
- */
32
- export declare class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
33
- private readonly rootDataObjectFactory;
34
- private readonly initialObjects;
35
- constructor(schema: ContainerSchema);
36
- /**
37
- * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}
38
- */
39
- protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
40
- }
41
20
  //# sourceMappingURL=rootDataObject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"OAIO,EACN,2BAA2B,EAK3B,MAAM,0BAA0B;OAC1B,EAAE,iBAAiB,EAAE,MAAM,+CAA+C;OAG1E,EAAE,eAAe,EAAE,MAAM,uCAAuC;OAChE,EACN,eAAe,EAIf,yBAAyB,EAGzB;AAGD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,cAAc,EAAE,yBAAyB,CAAC;CAC1C;AA6GD;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CAElB;AAED;;;;;;;;;GASG;AACH,qBAAa,iCAAkC,SAAQ,2BAA2B;IACjF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAKpC;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;gBAE/C,MAAM,EAAE,eAAe;IA6BnC;;OAEG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB;CAMzE"}
1
+ {"version":3,"file":"rootDataObject.d.ts","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"OAYO,EAAE,eAAe,EAAE,MAAM,uCAAuC;OAGhE,EACN,eAAe,EAGf,yBAAyB,EAGzB;AAQD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,cAAc,EAAE,yBAAyB,CAAC;CAC1C;AA6GD;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,KAAK,EAAE;IAC9D,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CAElB"}
@@ -1,8 +1,7 @@
1
- import { BaseContainerRuntimeFactory, DataObject, DataObjectFactory,
2
- // eslint-disable-next-line import/no-deprecated
3
- defaultRouteRequestHandler, } from "@fluidframework/aqueduct";
1
+ import { BaseContainerRuntimeFactory, DataObject, DataObjectFactory, } from "@fluidframework/aqueduct";
4
2
  import { FlushMode } from "@fluidframework/runtime-definitions";
5
- import { isDataObjectClass, isSharedObjectClass, parseDataObjectsFromSharedObjects } from "./utils.mjs";
3
+ import { RequestParser } from "@fluidframework/runtime-utils";
4
+ import { isDataObjectClass, isSharedObjectClass, parseDataObjectsFromSharedObjects, } from "./utils.mjs";
6
5
  /**
7
6
  * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.
8
7
  * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.
@@ -108,27 +107,38 @@ export function createDOProviderContainerRuntimeFactory(props) {
108
107
  *
109
108
  * This data object is dynamically customized (registry and initial objects) based on the schema provided.
110
109
  * to the container runtime factory.
111
- * @deprecated use {@link createDOProviderContainerRuntimeFactory} instead
110
+ *
112
111
  * @internal
113
112
  */
114
- export class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
113
+ class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {
115
114
  constructor(schema) {
116
115
  const [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);
117
116
  const rootDataObjectFactory = new DataObjectFactory("rootDO", RootDataObject, sharedObjects, {}, registryEntries);
117
+ const provideEntryPoint = async (containerRuntime) => {
118
+ const entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);
119
+ if (entryPoint === undefined) {
120
+ throw new Error(`default dataStore [${rootDataStoreId}] must exist`);
121
+ }
122
+ return entryPoint.get();
123
+ };
124
+ const getDefaultObject = async (request, runtime) => {
125
+ const parser = RequestParser.create(request);
126
+ if (parser.pathParts.length === 0) {
127
+ // This cast is safe as ContainerRuntime.loadRuntime is called in the base class
128
+ return runtime.resolveHandle({
129
+ url: `/${rootDataStoreId}${parser.query}`,
130
+ headers: request.headers,
131
+ });
132
+ }
133
+ return undefined; // continue search
134
+ };
118
135
  super({
119
136
  registryEntries: [rootDataObjectFactory.registryEntry],
120
- // eslint-disable-next-line import/no-deprecated
121
- requestHandlers: [defaultRouteRequestHandler(rootDataStoreId)],
137
+ requestHandlers: [getDefaultObject],
122
138
  // temporary workaround to disable message batching until the message batch size issue is resolved
123
139
  // resolution progress is tracked by the Feature 465 work item in AzDO
124
140
  runtimeOptions: { flushMode: FlushMode.Immediate },
125
- provideEntryPoint: async (containerRuntime) => {
126
- const entryPoint = await containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);
127
- if (entryPoint === undefined) {
128
- throw new Error(`default dataStore [${rootDataStoreId}] must exist`);
129
- }
130
- return entryPoint.get();
131
- },
141
+ provideEntryPoint,
132
142
  });
133
143
  this.rootDataObjectFactory = rootDataObjectFactory;
134
144
  this.initialObjects = schema.initialObjects;
@@ -1 +1 @@
1
- {"version":3,"file":"rootDataObject.mjs","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"OAIO,EACN,2BAA2B,EAC3B,UAAU,EACV,iBAAiB;AACjB,gDAAgD;AAChD,0BAA0B,GAC1B,MAAM,0BAA0B;OAG1B,EAAE,SAAS,EAAE,MAAM,qCAAqC;OAWxD,EAAE,iBAAiB,EAAE,mBAAmB,EA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AI,UAAU,KAAK,SAAS,EAAE;oBAC7B,MAAM,IAAI,KAAK,CAAC,sBAAsB,eAAe,cAAc,CAAC,CAAC;iBACrE;gBACD,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC;YACzB,CAAC;SACD,CAAC,CAAC;QACH,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B;QACxE,sEAAsE;QACtE,MAAM,IAAI,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,EAAE;YAC7E,cAAc,EAAE,IAAI,CAAC,cAAc;SACnC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\tDataObjectFactory,\n\t// eslint-disable-next-line import/no-deprecated\n\tdefaultRouteRequestHandler,\n} from \"@fluidframework/aqueduct\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { FlushMode } from \"@fluidframework/runtime-definitions\";\nimport { IRuntimeFactory } from \"@fluidframework/container-definitions\";\nimport {\n\tContainerSchema,\n\tDataObjectClass,\n\tIRootDataObject,\n\tLoadableObjectClass,\n\tLoadableObjectClassRecord,\n\tLoadableObjectRecord,\n\tSharedObjectClass,\n} from \"./types\";\nimport { isDataObjectClass, isSharedObjectClass, parseDataObjectsFromSharedObjects } from \"./utils\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\tinitialObjects: LoadableObjectClassRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\tpublic get IRootDataObject() {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir() {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps) {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tObject.entries(props.initialObjects).forEach(([id, objectClass]) => {\n\t\t\tconst createObject = async () => {\n\t\t\t\tconst obj = await this.create(objectClass);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t});\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized() {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of Array.from(this.initialObjectsDir.entries())) {\n\t\t\tconst loadDir = async () => {\n\t\t\t\tconst obj = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\tif (isDataObjectClass(objectClass)) {\n\t\t\treturn this.createDataObject<T>(objectClass);\n\t\t} else if (isSharedObjectClass(objectClass)) {\n\t\t\treturn this.createSharedObject<T>(objectClass);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: DataObjectClass<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as unknown as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: SharedObjectClass<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n * @deprecated use {@link createDOProviderContainerRuntimeFactory} instead\n * @internal\n */\nexport class DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectClassRecord;\n\n\tconstructor(schema: ContainerSchema) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\trequestHandlers: [defaultRouteRequestHandler(rootDataStoreId)],\n\t\t\t// temporary workaround to disable message batching until the message batch size issue is resolved\n\t\t\t// resolution progress is tracked by the Feature 465 work item in AzDO\n\t\t\truntimeOptions: { flushMode: FlushMode.Immediate },\n\t\t\tprovideEntryPoint: async (containerRuntime: IContainerRuntime) => {\n\t\t\t\tconst entryPoint =\n\t\t\t\t\tawait containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\t\tif (entryPoint === undefined) {\n\t\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t\t}\n\t\t\t\treturn entryPoint.get();\n\t\t\t},\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime) {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"rootDataObject.mjs","sourceRoot":"","sources":["../src/rootDataObject.ts"],"names":[],"mappings":"OAIO,EACN,2BAA2B,EAC3B,UAAU,EACV,iBAAiB,GACjB,MAAM,0BAA0B;OAG1B,EAAE,SAAS,EAAE,MAAM,qCAAqC;OAExD,EAAE,aAAa,EAAE,MAAM,+BAA+B;OAUtD,EAEN,iBAAiB,EACjB,mBAAmB,EACnB,iCAAiC,GACjC;AAcD;;;GAGG;AACH,MAAM,cACL,SAAQ,UAAiD;IAD1D;;QAIkB,yBAAoB,GAAG,qBAAqB,CAAC;QAC7C,oBAAe,GAAyB,EAAE,CAAC;IA8F7D,CAAC;IA7FA,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAY,iBAAiB;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACjE,IAAI,GAAG,KAAK,SAAS,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACpE;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,qBAAqB,CAAC,KAA0B;QAC/D,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAExD,mDAAmD;QACnD,MAAM,eAAe,GAAoB,EAAE,CAAC;QAC5C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE;YAClE,MAAM,YAAY,GAAG,KAAK,IAAI,EAAE;gBAC/B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBAC3C,IAAI,CAAC,iBAAiB,CAAC,GAAG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cesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tBaseContainerRuntimeFactory,\n\tDataObject,\n\tDataObjectFactory,\n} from \"@fluidframework/aqueduct\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\nimport { IFluidLoadable, IRequest } from \"@fluidframework/core-interfaces\";\nimport { FlushMode } from \"@fluidframework/runtime-definitions\";\nimport { IRuntimeFactory } from \"@fluidframework/container-definitions\";\nimport { RequestParser } from \"@fluidframework/runtime-utils\";\nimport { ContainerRuntime } from \"@fluidframework/container-runtime\";\nimport {\n\tContainerSchema,\n\tIRootDataObject,\n\tLoadableObjectClass,\n\tLoadableObjectClassRecord,\n\tLoadableObjectRecord,\n\tSharedObjectClass,\n} from \"./types\";\nimport {\n\tInternalDataObjectClass,\n\tisDataObjectClass,\n\tisSharedObjectClass,\n\tparseDataObjectsFromSharedObjects,\n} from \"./utils\";\n\n/**\n * Input props for {@link RootDataObject.initializingFirstTime}.\n */\nexport interface RootDataObjectProps {\n\t/**\n\t * Initial object structure with which the {@link RootDataObject} will be first-time initialized.\n\t *\n\t * @see {@link RootDataObject.initializingFirstTime}\n\t */\n\tinitialObjects: LoadableObjectClassRecord;\n}\n\n/**\n * The entry-point/root collaborative object of the {@link IFluidContainer | Fluid Container}.\n * Abstracts the dynamic code required to build a Fluid Container into a static representation for end customers.\n */\nclass RootDataObject\n\textends DataObject<{ InitialState: RootDataObjectProps }>\n\timplements IRootDataObject\n{\n\tprivate readonly initialObjectsDirKey = \"initial-objects-key\";\n\tprivate readonly _initialObjects: LoadableObjectRecord = {};\n\tpublic get IRootDataObject() {\n\t\treturn this;\n\t}\n\n\tprivate get initialObjectsDir() {\n\t\tconst dir = this.root.getSubDirectory(this.initialObjectsDirKey);\n\t\tif (dir === undefined) {\n\t\t\tthrow new Error(\"InitialObjects sub-directory was not initialized\");\n\t\t}\n\t\treturn dir;\n\t}\n\n\t/**\n\t * The first time this object is initialized, creates each object identified in\n\t * {@link RootDataObjectProps.initialObjects} and stores them as unique values in the root directory.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.initializingFirstTime}\n\t */\n\tprotected async initializingFirstTime(props: RootDataObjectProps) {\n\t\tthis.root.createSubDirectory(this.initialObjectsDirKey);\n\n\t\t// Create initial objects provided by the developer\n\t\tconst initialObjectsP: Promise<void>[] = [];\n\t\tObject.entries(props.initialObjects).forEach(([id, objectClass]) => {\n\t\t\tconst createObject = async () => {\n\t\t\t\tconst obj = await this.create(objectClass);\n\t\t\t\tthis.initialObjectsDir.set(id, obj.handle);\n\t\t\t};\n\t\t\tinitialObjectsP.push(createObject());\n\t\t});\n\n\t\tawait Promise.all(initialObjectsP);\n\t}\n\n\t/**\n\t * Every time an instance is initialized, loads all of the initial objects in the root directory so they can be\n\t * accessed immediately.\n\t *\n\t * @see {@link @fluidframework/aqueduct#PureDataObject.hasInitialized}\n\t */\n\tprotected async hasInitialized() {\n\t\t// We will always load the initial objects so they are available to the developer\n\t\tconst loadInitialObjectsP: Promise<void>[] = [];\n\t\tfor (const [key, value] of Array.from(this.initialObjectsDir.entries())) {\n\t\t\tconst loadDir = async () => {\n\t\t\t\tconst obj = await value.get();\n\t\t\t\tObject.assign(this._initialObjects, { [key]: obj });\n\t\t\t};\n\t\t\tloadInitialObjectsP.push(loadDir());\n\t\t}\n\n\t\tawait Promise.all(loadInitialObjectsP);\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.initialObjects}\n\t */\n\tpublic get initialObjects(): LoadableObjectRecord {\n\t\tif (Object.keys(this._initialObjects).length === 0) {\n\t\t\tthrow new Error(\"Initial Objects were not correctly initialized\");\n\t\t}\n\t\treturn this._initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc IRootDataObject.create}\n\t */\n\tpublic async create<T extends IFluidLoadable>(objectClass: LoadableObjectClass<T>): Promise<T> {\n\t\tif (isDataObjectClass(objectClass)) {\n\t\t\treturn this.createDataObject<T>(objectClass);\n\t\t} else if (isSharedObjectClass(objectClass)) {\n\t\t\treturn this.createSharedObject<T>(objectClass);\n\t\t}\n\t\tthrow new Error(\"Could not create new Fluid object because an unknown object was passed\");\n\t}\n\n\tprivate async createDataObject<T extends IFluidLoadable>(\n\t\tdataObjectClass: InternalDataObjectClass<T>,\n\t): Promise<T> {\n\t\tconst factory = dataObjectClass.factory;\n\t\tconst packagePath = [...this.context.packagePath, factory.type];\n\t\tconst dataStore = await this.context.containerRuntime.createDataStore(packagePath);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\treturn entryPoint as unknown as T;\n\t}\n\n\tprivate createSharedObject<T extends IFluidLoadable>(\n\t\tsharedObjectClass: SharedObjectClass<T>,\n\t): T {\n\t\tconst factory = sharedObjectClass.getFactory();\n\t\tconst obj = this.runtime.createChannel(undefined, factory.type);\n\t\treturn obj as unknown as T;\n\t}\n}\n\nconst rootDataStoreId = \"rootDOId\";\n\n/**\n * @internal\n */\nexport function createDOProviderContainerRuntimeFactory(props: {\n\tschema: ContainerSchema;\n}): IRuntimeFactory {\n\treturn new DOProviderContainerRuntimeFactory(props.schema);\n}\n\n/**\n * Container code that provides a single {@link IRootDataObject}.\n *\n * @remarks\n *\n * This data object is dynamically customized (registry and initial objects) based on the schema provided.\n * to the container runtime factory.\n *\n * @internal\n */\nclass DOProviderContainerRuntimeFactory extends BaseContainerRuntimeFactory {\n\tprivate readonly rootDataObjectFactory: DataObjectFactory<\n\t\tRootDataObject,\n\t\t{\n\t\t\tInitialState: RootDataObjectProps;\n\t\t}\n\t>;\n\n\tprivate readonly initialObjects: LoadableObjectClassRecord;\n\n\tconstructor(schema: ContainerSchema) {\n\t\tconst [registryEntries, sharedObjects] = parseDataObjectsFromSharedObjects(schema);\n\t\tconst rootDataObjectFactory = new DataObjectFactory(\n\t\t\t\"rootDO\",\n\t\t\tRootDataObject,\n\t\t\tsharedObjects,\n\t\t\t{},\n\t\t\tregistryEntries,\n\t\t);\n\t\tconst provideEntryPoint = async (containerRuntime: IContainerRuntime) => {\n\t\t\tconst entryPoint =\n\t\t\t\tawait containerRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\tif (entryPoint === undefined) {\n\t\t\t\tthrow new Error(`default dataStore [${rootDataStoreId}] must exist`);\n\t\t\t}\n\t\t\treturn entryPoint.get();\n\t\t};\n\t\tconst getDefaultObject = async (request: IRequest, runtime: IContainerRuntime) => {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tif (parser.pathParts.length === 0) {\n\t\t\t\t// This cast is safe as ContainerRuntime.loadRuntime is called in the base class\n\t\t\t\treturn (runtime as ContainerRuntime).resolveHandle({\n\t\t\t\t\turl: `/${rootDataStoreId}${parser.query}`,\n\t\t\t\t\theaders: request.headers,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn undefined; // continue search\n\t\t};\n\t\tsuper({\n\t\t\tregistryEntries: [rootDataObjectFactory.registryEntry],\n\t\t\trequestHandlers: [getDefaultObject],\n\t\t\t// temporary workaround to disable message batching until the message batch size issue is resolved\n\t\t\t// resolution progress is tracked by the Feature 465 work item in AzDO\n\t\t\truntimeOptions: { flushMode: FlushMode.Immediate },\n\t\t\tprovideEntryPoint,\n\t\t});\n\t\tthis.rootDataObjectFactory = rootDataObjectFactory;\n\t\tthis.initialObjects = schema.initialObjects;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/aqueduct#BaseContainerRuntimeFactory.containerInitializingFirstTime}\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime) {\n\t\t// The first time we create the container we create the RootDataObject\n\t\tawait this.rootDataObjectFactory.createRootInstance(rootDataStoreId, runtime, {\n\t\t\tinitialObjects: this.initialObjects,\n\t\t});\n\t}\n}\n"]}
@@ -2,10 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
6
- import { IAudience, IContainer } from "@fluidframework/container-definitions";
5
+ import { IContainer } from "@fluidframework/container-definitions";
7
6
  import { IClient } from "@fluidframework/protocol-definitions";
8
- import { IServiceAudience, IServiceAudienceEvents, IMember, Myself } from "./types.mjs";
7
+ import { IServiceAudience, IMember } from "./types.mjs";
9
8
  /**
10
9
  * @internal
11
10
  */
@@ -13,71 +12,4 @@ export declare function createServiceAudience<M extends IMember = IMember>(props
13
12
  container: IContainer;
14
13
  createServiceMember: (audienceMember: IClient) => M;
15
14
  }): IServiceAudience<M>;
16
- /**
17
- * Base class for providing audience information for sessions interacting with {@link IFluidContainer}
18
- *
19
- * @remarks
20
- *
21
- * This can be extended by different service-specific client packages to additional parameters to
22
- * the user and client details returned in {@link IMember}.
23
- *
24
- * @typeParam M - A service-specific {@link IMember} implementation.
25
- * @deprecated use {@link createServiceAudience} and {@link IServiceAudience} instead
26
- * @internal
27
- */
28
- export declare abstract class ServiceAudience<M extends IMember = IMember> extends TypedEventEmitter<IServiceAudienceEvents<M>> implements IServiceAudience<M> {
29
- /**
30
- * Fluid Container to read the audience from.
31
- */
32
- protected readonly container: IContainer;
33
- /**
34
- * Audience object which includes all the existing members of the {@link IFluidContainer | container}.
35
- */
36
- protected readonly audience: IAudience;
37
- /**
38
- * Retain the most recent member list.
39
- *
40
- * @remarks
41
- *
42
- * This is so we have more information about a member leaving the audience in the `removeMember` event.
43
- *
44
- * It allows us to match the behavior of the `addMember` event where it only fires on a change to the members this
45
- * class exposes (and would actually produce a change in what `getMembers` returns).
46
- *
47
- * It also allows us to provide the client details in the event which makes it easier to find that client connection
48
- * in a map keyed on the `userId` and not `clientId`.
49
- *
50
- * This map will always be up-to-date in a `removeMember` event because it is set once at construction and in
51
- * every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}
52
- * events provide.
53
- */
54
- protected lastMembers: Map<string, M>;
55
- constructor(
56
- /**
57
- * Fluid Container to read the audience from.
58
- */
59
- container: IContainer);
60
- /**
61
- * Provides ability for inheriting class to modify/extend the audience object.
62
- *
63
- * @param audienceMember - Record of a specific audience member.
64
- */
65
- protected abstract createServiceMember(audienceMember: IClient): M;
66
- /**
67
- * {@inheritDoc IServiceAudience.getMembers}
68
- */
69
- getMembers(): Map<string, M>;
70
- /**
71
- * {@inheritDoc IServiceAudience.getMyself}
72
- */
73
- getMyself(): Myself<M> | undefined;
74
- private getMember;
75
- /**
76
- * Provides ability for the inheriting class to include/omit specific members.
77
- * An example use case is omitting the summarizer client.
78
- *
79
- * @param member - Member to be included/omitted.
80
- */
81
- protected shouldIncludeAsMember(member: IClient): boolean;
82
- }
83
15
  //# sourceMappingURL=serviceAudience.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serviceAudience.d.ts","sourceRoot":"","sources":["../src/serviceAudience.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,uCAAuC;OACtE,EAAE,OAAO,EAAE,MAAM,sCAAsC;OACvD,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,EAAE;AAEpE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,KAAK,EAAE;IACzE,SAAS,EAAE,UAAU,CAAC;IACtB,mBAAmB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,CAAC,CAAC;CACpD,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAQtB;AAED;;;;;;;;;;;GAWG;AACH,8BAAsB,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,CAChE,SAAQ,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CACnD,YAAW,gBAAgB,CAAC,CAAC,CAAC;IA2B7B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,UAAU;IA5BzC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAEvC;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,WAAW,iBAAwB;;IAG5C;;OAEG;IACgB,SAAS,EAAE,UAAU;IA2BzC;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,OAAO,GAAG,CAAC;IAElE;;OAEG;IACI,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAuBnC;;OAEG;IACI,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS;IAgBzC,OAAO,CAAC,SAAS;IAiBjB;;;;;OAKG;IACH,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;CAIzD"}
1
+ {"version":3,"file":"serviceAudience.d.ts","sourceRoot":"","sources":["../src/serviceAudience.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAa,UAAU,EAAE,MAAM,uCAAuC;OACtE,EAAE,OAAO,EAAE,MAAM,sCAAsC;OACvD,EAAE,gBAAgB,EAA0B,OAAO,EAAU;AAEpE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAAE,KAAK,EAAE;IACzE,SAAS,EAAE,UAAU,CAAC;IACtB,mBAAmB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,CAAC,CAAC;CACpD,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAEtB"}
@@ -7,13 +7,7 @@ import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
7
  * @internal
8
8
  */
9
9
  export function createServiceAudience(props) {
10
- // todo: once ServiceAudience isn't exported, we can remove abstract from it, and just use that here
11
- const c = class NewServiceAudience extends ServiceAudience {
12
- createServiceMember(audienceMember) {
13
- return props.createServiceMember(audienceMember);
14
- }
15
- };
16
- return new c(props.container);
10
+ return new ServiceAudience(props.container, props.createServiceMember);
17
11
  }
18
12
  /**
19
13
  * Base class for providing audience information for sessions interacting with {@link IFluidContainer}
@@ -24,17 +18,17 @@ export function createServiceAudience(props) {
24
18
  * the user and client details returned in {@link IMember}.
25
19
  *
26
20
  * @typeParam M - A service-specific {@link IMember} implementation.
27
- * @deprecated use {@link createServiceAudience} and {@link IServiceAudience} instead
28
21
  * @internal
29
22
  */
30
- export class ServiceAudience extends TypedEventEmitter {
23
+ class ServiceAudience extends TypedEventEmitter {
31
24
  constructor(
32
25
  /**
33
26
  * Fluid Container to read the audience from.
34
27
  */
35
- container) {
28
+ container, createServiceMember) {
36
29
  super();
37
30
  this.container = container;
31
+ this.createServiceMember = createServiceMember;
38
32
  /**
39
33
  * Retain the most recent member list.
40
34
  *
@@ -1 +1 @@
1
- {"version":3,"file":"serviceAudience.mjs","sourceRoot":"","sources":["../src/serviceAudience.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;AAKhE;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAA8B,KAGlE;IACA,oGAAoG;IACpG,MAAM,CAAC,GAAG,MAAM,kBAAmB,SAAQ,eAAkB;QAClD,mBAAmB,CAAC,cAAuB;YACpD,OAAO,KAAK,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAClD,CAAC;KACD,CAAC;IACF,OAAO,IAAI,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,eACrB,SAAQ,iBAA4C;IA2BpD;IACC;;OAEG;IACgB,SAAqB;QAExC,KAAK,EAAE,CAAC;QAFW,cAAS,GAAT,SAAS,CAAY;QAvBzC;;;;;;;;;;;;;;;;WAgBG;QACO,gBAAW,GAAG,IAAI,GAAG,EAAa,CAAC;QAS5C,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QAEnC,iFAAiF;QACjF,+EAA+E;QAC/E,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,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,CAAC,CAAC;QAC/D,IAAI,MAAM,KAAK,SAAS,EAAE;YACzB,MAAM,KAAK,CACV,6BAA6B,QAAQ,8CAA8C,CACnF,CAAC;SACF;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACO,qBAAqB,CAAC,MAAe;QAC9C,6BAA6B;QAC7B,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC;IAChD,CAAC;CACD","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 { IAudience, IContainer } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { IServiceAudience, IServiceAudienceEvents, IMember, Myself } from \"./types\";\n\n/**\n * @internal\n */\nexport function createServiceAudience<M extends IMember = IMember>(props: {\n\tcontainer: IContainer;\n\tcreateServiceMember: (audienceMember: IClient) => M;\n}): IServiceAudience<M> {\n\t// todo: once ServiceAudience isn't exported, we can remove abstract from it, and just use that here\n\tconst c = class NewServiceAudience extends ServiceAudience<M> {\n\t\tprotected createServiceMember(audienceMember: IClient) {\n\t\t\treturn props.createServiceMember(audienceMember);\n\t\t}\n\t};\n\treturn new c(props.container);\n}\n\n/**\n * Base class for providing audience information for sessions interacting with {@link IFluidContainer}\n *\n * @remarks\n *\n * This can be extended by different service-specific client packages to additional parameters to\n * the user and client details returned in {@link IMember}.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @deprecated use {@link createServiceAudience} and {@link IServiceAudience} instead\n * @internal\n */\nexport abstract class ServiceAudience<M extends IMember = IMember>\n\textends TypedEventEmitter<IServiceAudienceEvents<M>>\n\timplements IServiceAudience<M>\n{\n\t/**\n\t * Audience object which includes all the existing members of the {@link IFluidContainer | container}.\n\t */\n\tprotected readonly audience: IAudience;\n\n\t/**\n\t * Retain the most recent member list.\n\t *\n\t * @remarks\n\t *\n\t * This is so we have more information about a member leaving the audience in the `removeMember` event.\n\t *\n\t * It allows us to match the behavior of the `addMember` event where it only fires on a change to the members this\n\t * class exposes (and would actually produce a change in what `getMembers` returns).\n\t *\n\t * It also allows us to provide the client details in the event which makes it easier to find that client connection\n\t * in a map keyed on the `userId` and not `clientId`.\n\t *\n\t * This map will always be up-to-date in a `removeMember` event because it is set once at construction and in\n\t * every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}\n\t * events provide.\n\t */\n\tprotected lastMembers = new Map<string, M>();\n\n\tconstructor(\n\t\t/**\n\t\t * Fluid Container to read the audience from.\n\t\t */\n\t\tprotected readonly container: IContainer,\n\t) {\n\t\tsuper();\n\t\tthis.audience = container.audience;\n\n\t\t// getMembers will assign lastMembers so the removeMember event has what it needs\n\t\t// in case it would fire before getMembers otherwise gets called the first time\n\t\tthis.getMembers();\n\n\t\tthis.audience.on(\"addMember\", (clientId: string, details: IClient) => {\n\t\t\tif (this.shouldIncludeAsMember(details)) {\n\t\t\t\tconst member = this.getMember(clientId);\n\t\t\t\tthis.emit(\"memberAdded\", clientId, member);\n\t\t\t\tthis.emit(\"membersChanged\");\n\t\t\t}\n\t\t});\n\n\t\tthis.audience.on(\"removeMember\", (clientId: string) => {\n\t\t\tif (this.lastMembers.has(clientId)) {\n\t\t\t\tthis.emit(\"memberRemoved\", clientId, this.lastMembers.get(clientId));\n\t\t\t\tthis.emit(\"membersChanged\");\n\t\t\t}\n\t\t});\n\n\t\tthis.container.on(\"connected\", () => this.emit(\"membersChanged\"));\n\t}\n\n\t/**\n\t * Provides ability for inheriting class to modify/extend the audience object.\n\t *\n\t * @param audienceMember - Record of a specific audience member.\n\t */\n\tprotected abstract createServiceMember(audienceMember: IClient): M;\n\n\t/**\n\t * {@inheritDoc IServiceAudience.getMembers}\n\t */\n\tpublic getMembers(): Map<string, M> {\n\t\tconst users = new Map<string, M>();\n\t\tconst clientMemberMap = new Map<string, M>();\n\t\t// Iterate through the members and get the user specifics.\n\t\tthis.audience.getMembers().forEach((member: IClient, clientId: string) => {\n\t\t\tif (this.shouldIncludeAsMember(member)) {\n\t\t\t\tconst userId = member.user.id;\n\t\t\t\t// Ensure we're tracking the user\n\t\t\t\tlet user = users.get(userId);\n\t\t\t\tif (user === undefined) {\n\t\t\t\t\tuser = this.createServiceMember(member);\n\t\t\t\t\tusers.set(userId, user);\n\t\t\t\t}\n\n\t\t\t\t// Add this connection to their collection\n\t\t\t\tuser.connections.push({ id: clientId, mode: member.mode });\n\t\t\t\tclientMemberMap.set(clientId, user);\n\t\t\t}\n\t\t});\n\t\tthis.lastMembers = clientMemberMap;\n\t\treturn users;\n\t}\n\n\t/**\n\t * {@inheritDoc IServiceAudience.getMyself}\n\t */\n\tpublic getMyself(): Myself<M> | undefined {\n\t\tconst clientId = this.container.clientId;\n\t\tif (clientId === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst member = this.getMember(clientId);\n\t\tif (member === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst myself: Myself<M> = { ...member, currentConnection: clientId };\n\n\t\treturn myself;\n\t}\n\n\tprivate getMember(clientId: string): M | undefined {\n\t\t// Fetch the user ID assoicated with this client ID from the runtime\n\t\tconst internalAudienceMember = this.audience.getMember(clientId);\n\t\tif (internalAudienceMember === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// Return the member object with any other clients associated for this user\n\t\tconst allMembers = this.getMembers();\n\t\tconst member = allMembers.get(internalAudienceMember?.user.id);\n\t\tif (member === undefined) {\n\t\t\tthrow Error(\n\t\t\t\t`Attempted to fetch client ${clientId} that is not part of the current member list`,\n\t\t\t);\n\t\t}\n\t\treturn member;\n\t}\n\n\t/**\n\t * Provides ability for the inheriting class to include/omit specific members.\n\t * An example use case is omitting the summarizer client.\n\t *\n\t * @param member - Member to be included/omitted.\n\t */\n\tprotected shouldIncludeAsMember(member: IClient): boolean {\n\t\t// Include only human members\n\t\treturn member.details.capabilities.interactive;\n\t}\n}\n"]}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ACI,SAAS;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QACzC,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,OAAO,SAAS,CAAC;SACjB;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,SAAS,EAAE;YACzB,OAAO,SAAS,CAAC;SACjB;QAED,MAAM,MAAM,GAAc,EAAE,GAAG,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;QAErE,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,SAAS,CAAC,QAAgB;QACjC,oEAAoE;QACpE,MAAM,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,sBAAsB,KAAK,SAAS,EAAE;YACzC,OAAO,SAAS,CAAC;SACjB;QACD,2EAA2E;QAC3E,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,IAAI,MAAM,KAAK,SAAS,EAAE;YACzB,MAAM,KAAK,CACV,6BAA6B,QAAQ,8CAA8C,CACnF,CAAC;SACF;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACK,qBAAqB,CAAC,MAAe;QAC5C,6BAA6B;QAC7B,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC;IAChD,CAAC;CACD","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 { IAudience, IContainer } from \"@fluidframework/container-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { IServiceAudience, IServiceAudienceEvents, IMember, Myself } from \"./types\";\n\n/**\n * @internal\n */\nexport function createServiceAudience<M extends IMember = IMember>(props: {\n\tcontainer: IContainer;\n\tcreateServiceMember: (audienceMember: IClient) => M;\n}): IServiceAudience<M> {\n\treturn new ServiceAudience(props.container, props.createServiceMember);\n}\n\n/**\n * Base class for providing audience information for sessions interacting with {@link IFluidContainer}\n *\n * @remarks\n *\n * This can be extended by different service-specific client packages to additional parameters to\n * the user and client details returned in {@link IMember}.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @internal\n */\nclass ServiceAudience<M extends IMember = IMember>\n\textends TypedEventEmitter<IServiceAudienceEvents<M>>\n\timplements IServiceAudience<M>\n{\n\t/**\n\t * Audience object which includes all the existing members of the {@link IFluidContainer | container}.\n\t */\n\tprivate readonly audience: IAudience;\n\n\t/**\n\t * Retain the most recent member list.\n\t *\n\t * @remarks\n\t *\n\t * This is so we have more information about a member leaving the audience in the `removeMember` event.\n\t *\n\t * It allows us to match the behavior of the `addMember` event where it only fires on a change to the members this\n\t * class exposes (and would actually produce a change in what `getMembers` returns).\n\t *\n\t * It also allows us to provide the client details in the event which makes it easier to find that client connection\n\t * in a map keyed on the `userId` and not `clientId`.\n\t *\n\t * This map will always be up-to-date in a `removeMember` event because it is set once at construction and in\n\t * every `addMember` event. It is mapped `clientId` to `M` to be better work with what the {@link IServiceAudience}\n\t * events provide.\n\t */\n\tprivate lastMembers = new Map<string, M>();\n\n\tconstructor(\n\t\t/**\n\t\t * Fluid Container to read the audience from.\n\t\t */\n\t\tprivate readonly container: IContainer,\n\t\tprivate readonly createServiceMember: (audienceMember: IClient) => M,\n\t) {\n\t\tsuper();\n\t\tthis.audience = container.audience;\n\n\t\t// getMembers will assign lastMembers so the removeMember event has what it needs\n\t\t// in case it would fire before getMembers otherwise gets called the first time\n\t\tthis.getMembers();\n\n\t\tthis.audience.on(\"addMember\", (clientId: string, details: IClient) => {\n\t\t\tif (this.shouldIncludeAsMember(details)) {\n\t\t\t\tconst member = this.getMember(clientId);\n\t\t\t\tthis.emit(\"memberAdded\", clientId, member);\n\t\t\t\tthis.emit(\"membersChanged\");\n\t\t\t}\n\t\t});\n\n\t\tthis.audience.on(\"removeMember\", (clientId: string) => {\n\t\t\tif (this.lastMembers.has(clientId)) {\n\t\t\t\tthis.emit(\"memberRemoved\", clientId, this.lastMembers.get(clientId));\n\t\t\t\tthis.emit(\"membersChanged\");\n\t\t\t}\n\t\t});\n\n\t\tthis.container.on(\"connected\", () => this.emit(\"membersChanged\"));\n\t}\n\n\t/**\n\t * {@inheritDoc IServiceAudience.getMembers}\n\t */\n\tpublic getMembers(): Map<string, M> {\n\t\tconst users = new Map<string, M>();\n\t\tconst clientMemberMap = new Map<string, M>();\n\t\t// Iterate through the members and get the user specifics.\n\t\tthis.audience.getMembers().forEach((member: IClient, clientId: string) => {\n\t\t\tif (this.shouldIncludeAsMember(member)) {\n\t\t\t\tconst userId = member.user.id;\n\t\t\t\t// Ensure we're tracking the user\n\t\t\t\tlet user = users.get(userId);\n\t\t\t\tif (user === undefined) {\n\t\t\t\t\tuser = this.createServiceMember(member);\n\t\t\t\t\tusers.set(userId, user);\n\t\t\t\t}\n\n\t\t\t\t// Add this connection to their collection\n\t\t\t\tuser.connections.push({ id: clientId, mode: member.mode });\n\t\t\t\tclientMemberMap.set(clientId, user);\n\t\t\t}\n\t\t});\n\t\tthis.lastMembers = clientMemberMap;\n\t\treturn users;\n\t}\n\n\t/**\n\t * {@inheritDoc IServiceAudience.getMyself}\n\t */\n\tpublic getMyself(): Myself<M> | undefined {\n\t\tconst clientId = this.container.clientId;\n\t\tif (clientId === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst member = this.getMember(clientId);\n\t\tif (member === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst myself: Myself<M> = { ...member, currentConnection: clientId };\n\n\t\treturn myself;\n\t}\n\n\tprivate getMember(clientId: string): M | undefined {\n\t\t// Fetch the user ID assoicated with this client ID from the runtime\n\t\tconst internalAudienceMember = this.audience.getMember(clientId);\n\t\tif (internalAudienceMember === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\t// Return the member object with any other clients associated for this user\n\t\tconst allMembers = this.getMembers();\n\t\tconst member = allMembers.get(internalAudienceMember?.user.id);\n\t\tif (member === undefined) {\n\t\t\tthrow Error(\n\t\t\t\t`Attempted to fetch client ${clientId} that is not part of the current member list`,\n\t\t\t);\n\t\t}\n\t\treturn member;\n\t}\n\n\t/**\n\t * Provides ability for the inheriting class to include/omit specific members.\n\t * An example use case is omitting the summarizer client.\n\t *\n\t * @param member - Member to be included/omitted.\n\t */\n\tprivate shouldIncludeAsMember(member: IClient): boolean {\n\t\t// Include only human members\n\t\treturn member.details.capabilities.interactive;\n\t}\n}\n"]}
package/lib/types.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  */
5
5
  import { IEvent, IEventProvider, IFluidLoadable } from "@fluidframework/core-interfaces";
6
6
  import { IChannelFactory } from "@fluidframework/datastore-definitions";
7
- import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
8
7
  /**
9
8
  * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.
10
9
  * @alpha
@@ -31,7 +30,9 @@ export type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> |
31
30
  * @alpha
32
31
  */
33
32
  export type DataObjectClass<T extends IFluidLoadable> = {
34
- readonly factory: IFluidDataStoreFactory;
33
+ readonly factory: {
34
+ IFluidDataStoreFactory: DataObjectClass<T>["factory"];
35
+ };
35
36
  } & LoadableObjectCtor<T>;
36
37
  /**
37
38
  * A class that has a factory that can create a DDSes (`SharedObject`s) and a
@@ -95,7 +96,7 @@ export interface ContainerSchema {
95
96
  * @internal
96
97
  */
97
98
  export interface IProvideRootDataObject {
98
- readonly IRootDataObject?: IRootDataObject;
99
+ readonly IRootDataObject: IRootDataObject;
99
100
  }
100
101
  /**
101
102
  * Holds the collection of objects that the container was initially created with, as well as provides the ability
@@ -1 +1 @@
1
- {"version":3,"file":"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C;CACnE;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,OAAO,CAClD,SAAQ,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IACjD;;;;OAIG;IACH,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACvB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,WAAW,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG;IAAE,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC"}
package/lib/types.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { IFluidDataStoreFactory } from \"@fluidframework/runtime-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n * @alpha\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject` in a {@link LoadableObjectRecord}.\n * @alpha\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A class object of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The class of the `DataObject` or `SharedObject`.\n * @alpha\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> =\n\t| DataObjectClass<T>\n\t| SharedObjectClass<T>;\n\n/**\n * A class that has a factory that can create a `DataObject` and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `DataObject`.\n * @alpha\n */\nexport type DataObjectClass<T extends IFluidLoadable> = {\n\treadonly factory: IFluidDataStoreFactory;\n} & LoadableObjectCtor<T>;\n\n/**\n * A class that has a factory that can create a DDSes (`SharedObject`s) and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `SharedObject`.\n * @alpha\n */\nexport type SharedObjectClass<T extends IFluidLoadable> = {\n\treadonly getFactory: () => IChannelFactory;\n} & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.\n *\n * @typeParam T - The class of the loadable object.\n * @alpha\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n * @alpha\n */\nexport interface ContainerSchema {\n\t/**\n\t * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n\t *\n\t * @remarks It uses the key as the id and the value as the loadable object to create.\n\t *\n\t * @example\n\t *\n\t * In the example below two objects will be created when the `Container` is first\n\t * created. One with id \"map1\" that will return a `SharedMap` and the other with\n\t * id \"pair1\" that will return a `KeyValueDataObject`.\n\t *\n\t * ```typescript\n\t * {\n\t * map1: SharedMap,\n\t * pair1: KeyValueDataObject,\n\t * }\n\t * ```\n\t */\n\tinitialObjects: LoadableObjectClassRecord;\n\n\t/**\n\t * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n\t *\n\t * @remarks\n\t *\n\t * Types defined in `initialObjects` will always be available and are not required to be provided here.\n\t *\n\t * For best practice it's recommended to define all the dynamic types you create even if they are\n\t * included via initialObjects.\n\t */\n\tdynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * @internal\n */\nexport interface IProvideRootDataObject {\n\treadonly IRootDataObject?: IRootDataObject;\n}\n\n/**\n * Holds the collection of objects that the container was initially created with, as well as provides the ability\n * to dynamically create further objects during usage.\n * @internal\n */\nexport interface IRootDataObject extends IProvideRootDataObject {\n\t/**\n\t * Provides a record of the initial objects defined on creation.\n\t */\n\treadonly initialObjects: LoadableObjectRecord;\n\n\t/**\n\t * Dynamically creates a new detached collaborative object (DDS/DataObject).\n\t *\n\t * @param objectClass - Type of the collaborative object to be created.\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\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n * @alpha\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @alpha\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n\t/**\n\t * Emitted when a {@link IMember | member}(s) are either added or removed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"membersChanged\", listener: () => void): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} joins the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} leaves the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n * @alpha\n */\nexport interface IServiceAudience<M extends IMember>\n\textends IEventProvider<IServiceAudienceEvents<M>> {\n\t/**\n\t * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n\t * member object. The implementation may choose to exclude certain connections from the returned map.\n\t * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n\t */\n\tgetMembers(): Map<string, M>;\n\n\t/**\n\t * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n\t */\n\tgetMyself(): Myself<M> | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n * @alpha\n */\nexport interface IConnection {\n\t/**\n\t * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n\t */\n\tid: string;\n\n\t/**\n\t * Whether the connection is in read or read/write mode.\n\t */\n\tmode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n * @alpha\n */\nexport interface IMember {\n\t/**\n\t * An ID for the user, unique among each individual user connecting to the session.\n\t */\n\tuserId: string;\n\n\t/**\n\t * The set of connections the user has made, e.g. from multiple tabs or devices.\n\t */\n\tconnections: IConnection[];\n}\n\n/**\n * An extended member object that includes currentConnection\n * @alpha\n */\nexport type Myself<M extends IMember = IMember> = M & { currentConnection: string };\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IEvent, IEventProvider, IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\n\n/**\n * A mapping of string identifiers to instantiated `DataObject`s or `SharedObject`s.\n * @alpha\n */\nexport type LoadableObjectRecord = Record<string, IFluidLoadable>;\n\n/**\n * A mapping of string identifiers to classes that will later be used to instantiate a corresponding `DataObject`\n * or `SharedObject` in a {@link LoadableObjectRecord}.\n * @alpha\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A class object of `DataObject` or `SharedObject`.\n *\n * @typeParam T - The class of the `DataObject` or `SharedObject`.\n * @alpha\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> =\n\t| DataObjectClass<T>\n\t| SharedObjectClass<T>;\n\n/**\n * A class that has a factory that can create a `DataObject` and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `DataObject`.\n * @alpha\n */\nexport type DataObjectClass<T extends IFluidLoadable> = {\n\treadonly factory: { IFluidDataStoreFactory: DataObjectClass<T>[\"factory\"] };\n} & LoadableObjectCtor<T>;\n\n/**\n * A class that has a factory that can create a DDSes (`SharedObject`s) and a\n * constructor that will return the type of the `DataObject`.\n *\n * @typeParam T - The class of the `SharedObject`.\n * @alpha\n */\nexport type SharedObjectClass<T extends IFluidLoadable> = {\n\treadonly getFactory: () => IChannelFactory;\n} & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an {@link @fluidframework/core-interfaces#IFluidLoadable}.\n *\n * @typeParam T - The class of the loadable object.\n * @alpha\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;\n\n/**\n * Declares the Fluid objects that will be available in the {@link IFluidContainer | Container}.\n *\n * @remarks\n *\n * It includes both the instances of objects that are initially available upon `Container` creation, as well\n * as the types of objects that may be dynamically created throughout the lifetime of the `Container`.\n * @alpha\n */\nexport interface ContainerSchema {\n\t/**\n\t * Defines loadable objects that will be created when the {@link IFluidContainer | Container} is first created.\n\t *\n\t * @remarks It uses the key as the id and the value as the loadable object to create.\n\t *\n\t * @example\n\t *\n\t * In the example below two objects will be created when the `Container` is first\n\t * created. One with id \"map1\" that will return a `SharedMap` and the other with\n\t * id \"pair1\" that will return a `KeyValueDataObject`.\n\t *\n\t * ```typescript\n\t * {\n\t * map1: SharedMap,\n\t * pair1: KeyValueDataObject,\n\t * }\n\t * ```\n\t */\n\tinitialObjects: LoadableObjectClassRecord;\n\n\t/**\n\t * Loadable objects that can be created after the initial {@link IFluidContainer | Container} creation.\n\t *\n\t * @remarks\n\t *\n\t * Types defined in `initialObjects` will always be available and are not required to be provided here.\n\t *\n\t * For best practice it's recommended to define all the dynamic types you create even if they are\n\t * included via initialObjects.\n\t */\n\tdynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * @internal\n */\nexport interface IProvideRootDataObject {\n\treadonly IRootDataObject: IRootDataObject;\n}\n\n/**\n * Holds the collection of objects that the container was initially created with, as well as provides the ability\n * to dynamically create further objects during usage.\n * @internal\n */\nexport interface IRootDataObject extends IProvideRootDataObject {\n\t/**\n\t * Provides a record of the initial objects defined on creation.\n\t */\n\treadonly initialObjects: LoadableObjectRecord;\n\n\t/**\n\t * Dynamically creates a new detached collaborative object (DDS/DataObject).\n\t *\n\t * @param objectClass - Type of the collaborative object to be created.\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\n/**\n * Signature for {@link IMember} change events.\n *\n * @param clientId - A unique identifier for the client.\n * @param member - The service-specific member object for the client.\n *\n * @see See {@link IServiceAudienceEvents} for usage details.\n * @alpha\n */\nexport type MemberChangedListener<M extends IMember> = (clientId: string, member: M) => void;\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\n *\n * @remarks\n *\n * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s\n * {@link IServiceAudience.getMembers} method will emit events.\n *\n * @typeParam M - A service-specific {@link IMember} implementation.\n * @alpha\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n\t/**\n\t * Emitted when a {@link IMember | member}(s) are either added or removed.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"membersChanged\", listener: () => void): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} joins the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberAdded\", listener: MemberChangedListener<M>): void;\n\n\t/**\n\t * Emitted when a {@link IMember | member} leaves the audience.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"memberRemoved\", listener: MemberChangedListener<M>): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience.\n *\n * @remarks\n *\n * The type parameter `M` allows consumers to further extend the client object with service-specific\n * details about the connecting client, such as device information, environment, or a username.\n *\n * @typeParam M - A service-specific {@link IMember} type.\n * @alpha\n */\nexport interface IServiceAudience<M extends IMember>\n\textends IEventProvider<IServiceAudienceEvents<M>> {\n\t/**\n\t * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n\t * member object. The implementation may choose to exclude certain connections from the returned map.\n\t * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n\t */\n\tgetMembers(): Map<string, M>;\n\n\t/**\n\t * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n\t */\n\tgetMyself(): Myself<M> | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session.\n *\n * @remarks This interface can be extended to provide additional information specific to each service.\n * @alpha\n */\nexport interface IConnection {\n\t/**\n\t * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n\t */\n\tid: string;\n\n\t/**\n\t * Whether the connection is in read or read/write mode.\n\t */\n\tmode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member.\n *\n * @remarks This interface can be extended by each service to provide additional service-specific user metadata.\n * @alpha\n */\nexport interface IMember {\n\t/**\n\t * An ID for the user, unique among each individual user connecting to the session.\n\t */\n\tuserId: string;\n\n\t/**\n\t * The set of connections the user has made, e.g. from multiple tabs or devices.\n\t */\n\tconnections: IConnection[];\n}\n\n/**\n * An extended member object that includes currentConnection\n * @alpha\n */\nexport type Myself<M extends IMember = IMember> = M & { currentConnection: string };\n"]}
package/lib/utils.d.ts CHANGED
@@ -3,12 +3,20 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IChannelFactory } from "@fluidframework/datastore-definitions";
6
- import { NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions";
6
+ import { IFluidDataStoreFactory, NamedFluidDataStoreRegistryEntry } from "@fluidframework/runtime-definitions";
7
+ import { IFluidLoadable } from "@fluidframework/core-interfaces";
7
8
  import { ContainerSchema, DataObjectClass, SharedObjectClass } from "./types.mjs";
9
+ /**
10
+ * An internal type used by the internal type guard isDataObjectClass to cast a
11
+ * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.
12
+ * Unlike the external and exported type DataObjectClass which is
13
+ * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.
14
+ */
15
+ export type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> & Record<"factory", IFluidDataStoreFactory>;
8
16
  /**
9
17
  * Runtime check to determine if a class is a DataObject type
10
18
  */
11
- export declare const isDataObjectClass: (obj: any) => obj is DataObjectClass<any>;
19
+ export declare const isDataObjectClass: (obj: any) => obj is InternalDataObjectClass<IFluidLoadable>;
12
20
  /**
13
21
  * Runtime check to determine if a class is a SharedObject type
14
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,eAAe,EAAE,MAAM,uCAAuC;OAChE,EAAE,gCAAgC,EAAE,MAAM,qCAAqC;OAC/E,EAAE,eAAe,EAAE,eAAe,EAAuB,iBAAiB,EAAE;AAEnF;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,gCAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAS,GAAG,kCAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,WACrC,eAAe,KACrB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA0BxD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,eAAe,EAAE,MAAM,uCAAuC;OAChE,EACN,sBAAsB,EACtB,gCAAgC,EAChC,MAAM,qCAAqC;OACrC,EAAE,cAAc,EAAE,MAAM,iCAAiC;OACzD,EAAE,eAAe,EAAE,eAAe,EAAuB,iBAAiB,EAAE;AAEnF;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,cAAc,IAAI,eAAe,CAAC,CAAC,CAAC,GACjF,MAAM,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,mDAMzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAS,GAAG,kCAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,WACrC,eAAe,KACrB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA0BxD,CAAC"}
package/lib/utils.mjs CHANGED
@@ -6,7 +6,9 @@
6
6
  * Runtime check to determine if a class is a DataObject type
7
7
  */
8
8
  export const isDataObjectClass = (obj) => {
9
- return obj?.factory !== undefined;
9
+ const maybe = obj;
10
+ return (maybe?.factory?.IFluidDataStoreFactory !== undefined &&
11
+ maybe?.factory?.IFluidDataStoreFactory === maybe?.factory);
10
12
  };
11
13
  /**
12
14
  * Runtime check to determine if a class is a SharedObject type
package/lib/utils.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,CAAC,MAAM,i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C,CAAC;KACzE;IAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport { NamedFluidDataStoreRegistryEntry } from \"@fluidframework/runtime-definitions\";\nimport { ContainerSchema, DataObjectClass, LoadableObjectClass, SharedObjectClass } from \"./types\";\n\n/**\n * Runtime check to determine if a class is a DataObject type\n */\nexport const isDataObjectClass = (obj: any): obj is DataObjectClass<any> => {\n\treturn obj?.factory !== undefined;\n};\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport const isSharedObjectClass = (obj: any): obj is SharedObjectClass<any> => {\n\treturn obj?.getFactory !== undefined;\n};\n\n/**\n * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be\n * of both SharedObject or DataObject. This function seperates the two and returns a registery\n * of DataObject types and an array of SharedObjects.\n */\nexport const parseDataObjectsFromSharedObjects = (\n\tschema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n\tconst registryEntries = new Set<NamedFluidDataStoreRegistryEntry>();\n\tconst sharedObjects = new Set<IChannelFactory>();\n\n\tconst tryAddObject = (obj: LoadableObjectClass<any>) => {\n\t\tif (isSharedObjectClass(obj)) {\n\t\t\tsharedObjects.add(obj.getFactory());\n\t\t} else if (isDataObjectClass(obj)) {\n\t\t\tregistryEntries.add([obj.factory.type, Promise.resolve(obj.factory)]);\n\t\t} else {\n\t\t\tthrow new Error(`Entry is neither a DataObject or a SharedObject`);\n\t\t}\n\t};\n\n\t// Add the object types that will be initialized\n\tconst dedupedObjects = new Set([\n\t\t...Object.values(schema.initialObjects),\n\t\t...(schema.dynamicObjectTypes ?? []),\n\t]);\n\tdedupedObjects.forEach(tryAddObject);\n\n\tif (registryEntries.size === 0 && sharedObjects.size === 0) {\n\t\tthrow new Error(\"Container cannot be initialized without any DataTypes\");\n\t}\n\n\treturn [Array.from(registryEntries), Array.from(sharedObjects)];\n};\n"]}
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAQ,EAAkD,EAAE;IAC7F,MAAM,KAAK,GAAiE,GAAG,CAAC;IAChF,OAAO,CACN,KAAK,EAAE,OAAO,EAAE,sBAAsB,KAAK,SAAS;QACpD,KAAK,EAAE,OAAO,EAAE,sBAAsB,KAAK,KAAK,EAAE,OAAO,CACzD,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAQ,EAAiC,EAAE;IAC9E,OAAO,GAAG,EAAE,UAAU,KAAK,SAAS,CAAC;AACtC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAChD,MAAuB,EACmC,EAAE;IAC5D,MAAM,eAAe,GAAG,IAAI,GAAG,EAAoC,CAAC;IACpE,MAAM,aAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEjD,MAAM,YAAY,GAAG,CAAC,GAA6B,EAAE,EAAE;QACtD,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE;YAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;SACpC;aAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAAE;YAClC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACtE;aAAM;YACN,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;SACnE;IACF,CAAC,CAAC;IAEF,gDAAgD;IAChD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;QAC9B,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;QACvC,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC;KACpC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE;QAC3D,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;KACzE;IAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IChannelFactory } from \"@fluidframework/datastore-definitions\";\nimport {\n\tIFluidDataStoreFactory,\n\tNamedFluidDataStoreRegistryEntry,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { ContainerSchema, DataObjectClass, LoadableObjectClass, SharedObjectClass } from \"./types\";\n\n/**\n * An internal type used by the internal type guard isDataObjectClass to cast a\n * DataObjectClass to a type that is strongly coupled to IFluidDataStoreFactory.\n * Unlike the external and exported type DataObjectClass which is\n * weakly coupled to the IFluidDataStoreFactory to prevent leaking internals.\n */\nexport type InternalDataObjectClass<T extends IFluidLoadable> = DataObjectClass<T> &\n\tRecord<\"factory\", IFluidDataStoreFactory>;\n\n/**\n * Runtime check to determine if a class is a DataObject type\n */\nexport const isDataObjectClass = (obj: any): obj is InternalDataObjectClass<IFluidLoadable> => {\n\tconst maybe: Partial<InternalDataObjectClass<IFluidLoadable>> | undefined = obj;\n\treturn (\n\t\tmaybe?.factory?.IFluidDataStoreFactory !== undefined &&\n\t\tmaybe?.factory?.IFluidDataStoreFactory === maybe?.factory\n\t);\n};\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport const isSharedObjectClass = (obj: any): obj is SharedObjectClass<any> => {\n\treturn obj?.getFactory !== undefined;\n};\n\n/**\n * The ContainerSchema consists of initialObjects and dynamicObjectTypes. These types can be\n * of both SharedObject or DataObject. This function seperates the two and returns a registery\n * of DataObject types and an array of SharedObjects.\n */\nexport const parseDataObjectsFromSharedObjects = (\n\tschema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n\tconst registryEntries = new Set<NamedFluidDataStoreRegistryEntry>();\n\tconst sharedObjects = new Set<IChannelFactory>();\n\n\tconst tryAddObject = (obj: LoadableObjectClass<any>) => {\n\t\tif (isSharedObjectClass(obj)) {\n\t\t\tsharedObjects.add(obj.getFactory());\n\t\t} else if (isDataObjectClass(obj)) {\n\t\t\tregistryEntries.add([obj.factory.type, Promise.resolve(obj.factory)]);\n\t\t} else {\n\t\t\tthrow new Error(`Entry is neither a DataObject or a SharedObject`);\n\t\t}\n\t};\n\n\t// Add the object types that will be initialized\n\tconst dedupedObjects = new Set([\n\t\t...Object.values(schema.initialObjects),\n\t\t...(schema.dynamicObjectTypes ?? []),\n\t]);\n\tdedupedObjects.forEach(tryAddObject);\n\n\tif (registryEntries.size === 0 && sharedObjects.size === 0) {\n\t\tthrow new Error(\"Container cannot be initialized without any DataTypes\");\n\t}\n\n\treturn [Array.from(registryEntries), Array.from(sharedObjects)];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/fluid-static",
3
- "version": "2.0.0-internal.7.4.0",
3
+ "version": "2.0.0-internal.8.0.0",
4
4
  "description": "A tool to enable consumption of Fluid Data Objects without requiring custom container code.",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -35,17 +35,18 @@
35
35
  "temp-directory": "nyc/.nyc_output"
36
36
  },
37
37
  "dependencies": {
38
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
39
- "@fluidframework/aqueduct": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
40
- "@fluidframework/container-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
41
- "@fluidframework/container-loader": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
42
- "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
43
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
44
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
38
+ "@fluid-internal/client-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
39
+ "@fluidframework/aqueduct": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
40
+ "@fluidframework/container-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
41
+ "@fluidframework/container-loader": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
42
+ "@fluidframework/container-runtime": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
43
+ "@fluidframework/container-runtime-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
44
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
45
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
45
46
  "@fluidframework/protocol-definitions": "^3.0.0",
46
- "@fluidframework/request-handler": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
47
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
48
- "@fluidframework/runtime-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0"
47
+ "@fluidframework/request-handler": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
48
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
49
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@arethetypeswrong/cli": "^0.13.3",
@@ -54,9 +55,9 @@
54
55
  "@fluidframework/build-tools": "^0.28.0",
55
56
  "@fluidframework/eslint-config-fluid": "^3.1.0",
56
57
  "@fluidframework/fluid-static-previous": "npm:@fluidframework/fluid-static@2.0.0-internal.7.2.0",
57
- "@fluidframework/map": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
58
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
59
- "@fluidframework/sequence": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
58
+ "@fluidframework/map": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
59
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
60
+ "@fluidframework/sequence": ">=2.0.0-internal.8.0.0 <2.0.0-internal.8.1.0",
60
61
  "@microsoft/api-extractor": "^7.38.3",
61
62
  "@types/mocha": "^9.1.1",
62
63
  "@types/node": "^18.19.0",
@@ -86,7 +87,23 @@
86
87
  }
87
88
  },
88
89
  "typeValidation": {
89
- "broken": {}
90
+ "broken": {
91
+ "RemovedClassDeclaration_DOProviderContainerRuntimeFactory": {
92
+ "forwardCompat": false,
93
+ "backCompat": false
94
+ },
95
+ "RemovedClassDeclaration_FluidContainer": {
96
+ "forwardCompat": false,
97
+ "backCompat": false
98
+ },
99
+ "RemovedClassDeclaration_ServiceAudience": {
100
+ "forwardCompat": false,
101
+ "backCompat": false
102
+ },
103
+ "InterfaceDeclaration_IRootDataObject": {
104
+ "forwardCompat": false
105
+ }
106
+ }
90
107
  },
91
108
  "scripts": {
92
109
  "api": "fluid-build . --task api",
@@ -234,7 +234,7 @@ export function createFluidContainer<
234
234
  * @deprecated use {@link createFluidContainer} and {@link IFluidContainer} instead
235
235
  * @internal
236
236
  */
237
- export class FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>
237
+ class FluidContainer<TContainerSchema extends ContainerSchema = ContainerSchema>
238
238
  extends TypedEventEmitter<IFluidContainerEvents>
239
239
  implements IFluidContainer<TContainerSchema>
240
240
  {