@fluidframework/fluid-static 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277

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 (101) hide show
  1. package/.eslintrc.js +8 -10
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +225 -53
  4. package/README.md +38 -0
  5. package/api-extractor-esm.json +4 -0
  6. package/api-extractor-lint.json +4 -0
  7. package/api-extractor.json +2 -2
  8. package/api-report/fluid-static.api.md +141 -0
  9. package/dist/fluid-static-alpha.d.ts +408 -0
  10. package/dist/fluid-static-beta.d.ts +412 -0
  11. package/dist/fluid-static-public.d.ts +412 -0
  12. package/dist/fluid-static-untrimmed.d.ts +452 -0
  13. package/dist/{fluidContainer.js → fluidContainer.cjs} +39 -12
  14. package/dist/fluidContainer.cjs.map +1 -0
  15. package/dist/fluidContainer.d.ts +95 -142
  16. package/dist/fluidContainer.d.ts.map +1 -1
  17. package/dist/index.cjs +19 -0
  18. package/dist/index.cjs.map +1 -0
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/{rootDataObject.js → rootDataObject.cjs} +59 -23
  22. package/dist/rootDataObject.cjs.map +1 -0
  23. package/dist/rootDataObject.d.ts +9 -59
  24. package/dist/rootDataObject.d.ts.map +1 -1
  25. package/dist/{serviceAudience.js → serviceAudience.cjs} +44 -20
  26. package/dist/serviceAudience.cjs.map +1 -0
  27. package/dist/serviceAudience.d.ts +7 -54
  28. package/dist/serviceAudience.d.ts.map +1 -1
  29. package/dist/tsdoc-metadata.json +11 -0
  30. package/dist/{types.js → types.cjs} +1 -1
  31. package/dist/types.cjs.map +1 -0
  32. package/dist/types.d.ts +130 -80
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/{utils.js → utils.cjs} +7 -9
  35. package/dist/utils.cjs.map +1 -0
  36. package/dist/utils.d.ts +10 -2
  37. package/dist/utils.d.ts.map +1 -1
  38. package/lib/fluid-static-alpha.d.mts +402 -0
  39. package/lib/fluid-static-beta.d.mts +406 -0
  40. package/lib/fluid-static-public.d.mts +406 -0
  41. package/lib/fluid-static-untrimmed.d.mts +446 -0
  42. package/lib/fluidContainer.d.mts +188 -0
  43. package/lib/fluidContainer.d.mts.map +1 -0
  44. package/lib/{fluidContainer.js → fluidContainer.mjs} +36 -13
  45. package/lib/fluidContainer.mjs.map +1 -0
  46. package/lib/index.d.mts +9 -0
  47. package/lib/index.d.mts.map +1 -0
  48. package/lib/index.mjs +8 -0
  49. package/lib/index.mjs.map +1 -0
  50. package/lib/rootDataObject.d.mts +20 -0
  51. package/lib/rootDataObject.d.mts.map +1 -0
  52. package/lib/{rootDataObject.js → rootDataObject.mjs} +61 -28
  53. package/lib/rootDataObject.mjs.map +1 -0
  54. package/lib/serviceAudience.d.mts +15 -0
  55. package/lib/serviceAudience.d.mts.map +1 -0
  56. package/lib/{serviceAudience.js → serviceAudience.mjs} +42 -18
  57. package/lib/serviceAudience.mjs.map +1 -0
  58. package/lib/types.d.mts +223 -0
  59. package/lib/types.d.mts.map +1 -0
  60. package/lib/{types.js → types.mjs} +1 -1
  61. package/lib/types.mjs.map +1 -0
  62. package/lib/{utils.d.ts → utils.d.mts} +12 -4
  63. package/lib/utils.d.mts.map +1 -0
  64. package/lib/{utils.js → utils.mjs} +7 -9
  65. package/lib/utils.mjs.map +1 -0
  66. package/package.json +151 -60
  67. package/prettier.config.cjs +8 -0
  68. package/src/fluidContainer.ts +316 -250
  69. package/src/index.ts +25 -4
  70. package/src/rootDataObject.ts +203 -157
  71. package/src/serviceAudience.ts +152 -124
  72. package/src/types.ts +190 -132
  73. package/src/utils.ts +44 -39
  74. package/tsc-multi.test.json +4 -0
  75. package/tsconfig.json +12 -16
  76. package/dist/fluidContainer.js.map +0 -1
  77. package/dist/index.js +0 -26
  78. package/dist/index.js.map +0 -1
  79. package/dist/rootDataObject.js.map +0 -1
  80. package/dist/serviceAudience.js.map +0 -1
  81. package/dist/types.js.map +0 -1
  82. package/dist/utils.js.map +0 -1
  83. package/lib/fluidContainer.d.ts +0 -235
  84. package/lib/fluidContainer.d.ts.map +0 -1
  85. package/lib/fluidContainer.js.map +0 -1
  86. package/lib/index.d.ts +0 -14
  87. package/lib/index.d.ts.map +0 -1
  88. package/lib/index.js +0 -14
  89. package/lib/index.js.map +0 -1
  90. package/lib/rootDataObject.d.ts +0 -70
  91. package/lib/rootDataObject.d.ts.map +0 -1
  92. package/lib/rootDataObject.js.map +0 -1
  93. package/lib/serviceAudience.d.ts +0 -62
  94. package/lib/serviceAudience.d.ts.map +0 -1
  95. package/lib/serviceAudience.js.map +0 -1
  96. package/lib/types.d.ts +0 -173
  97. package/lib/types.d.ts.map +0 -1
  98. package/lib/types.js.map +0 -1
  99. package/lib/utils.d.ts.map +0 -1
  100. package/lib/utils.js.map +0 -1
  101. package/tsconfig.esnext.json +0 -7
package/lib/types.d.ts DELETED
@@ -1,173 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { IEvent, IEventProvider } from "@fluidframework/common-definitions";
6
- import { IFluidLoadable } from "@fluidframework/core-interfaces";
7
- import { IChannelFactory } from "@fluidframework/datastore-definitions";
8
- import { IFluidDataStoreFactory } from "@fluidframework/runtime-definitions";
9
- /**
10
- * A mapping of string identifiers to instantiated DataObjects or SharedObjects.
11
- */
12
- export declare type LoadableObjectRecord = Record<string, IFluidLoadable>;
13
- /**
14
- * A mapping of string identifiers to classes that will later be used to instantiate a corresponding DataObject
15
- * or SharedObject in a LoadableObjectRecord.
16
- */
17
- export declare type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;
18
- /**
19
- * A LoadableObjectClass is an class object of DataObject or SharedObject
20
- * @typeParam T - The class of the DataObject or SharedObject
21
- */
22
- export declare type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;
23
- /**
24
- * A DataObjectClass is a class that has a factory that can create a DataObject and a
25
- * constructor that will return the type of the DataObject.
26
- * @typeParam T - The class of the DataObject
27
- */
28
- export declare type DataObjectClass<T extends IFluidLoadable> = {
29
- readonly factory: IFluidDataStoreFactory;
30
- } & LoadableObjectCtor<T>;
31
- /**
32
- * A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a
33
- * constructor that will return the type of the DataObject.
34
- * @typeParam T - The class of the SharedObject
35
- */
36
- export declare type SharedObjectClass<T extends IFluidLoadable> = {
37
- readonly getFactory: () => IChannelFactory;
38
- } & LoadableObjectCtor<T>;
39
- /**
40
- * An object with a constructor that will return an `IFluidLoadable`.
41
- * @typeParam T - The class of the loadable object
42
- */
43
- export declare type LoadableObjectCtor<T extends IFluidLoadable> = new (...args: any[]) => T;
44
- /**
45
- * The ContainerSchema declares the Fluid objects that will be available in the container. It includes both the
46
- * instances of objects that are initially available upon container creation, as well as the types of objects that may
47
- * be dynamically created throughout the lifetime of the container.
48
- */
49
- export interface ContainerSchema {
50
- /**
51
- * Defines loadable objects that will be created when the `Container` is first created.
52
- * It uses the key as the id and the value as the loadable object to create.
53
- *
54
- * @example
55
- * In the example below two objects will be created when the Container is first
56
- * created. One with id "map1" that will return a `SharedMap` and the other with
57
- * id "pair1" that will return a `KeyValueDataObject`.
58
- *
59
- * ```
60
- * {
61
- * map1: SharedMap,
62
- * pair1: KeyValueDataObject,
63
- * }
64
- * ```
65
- */
66
- initialObjects: LoadableObjectClassRecord;
67
- /**
68
- * Dynamic objects are Loadable objects that can be created after the initial Container creation.
69
- *
70
- * Types defined in `initialObjects` will always be available and are not required to be provided here.
71
- *
72
- * For best practice it's recommended to define all the dynamic types you create even if they are
73
- * included via initialObjects.
74
- */
75
- dynamicObjectTypes?: LoadableObjectClass<any>[];
76
- }
77
- /**
78
- * Events that trigger when the roster of members in the Fluid session change.
79
- * Only changes that would be reflected in the returned map of {@link IServiceAudience}'s
80
- * {@link IServiceAudience.getMembers} method will emit events.
81
- *
82
- * @remarks
83
- *
84
- * The following is the list of events emitted.
85
- *
86
- * ### "membersChanged"
87
- *
88
- * The "membersChanged" event is emitted when a member is either added or removed.
89
- *
90
- * #### Listener signature
91
- *
92
- * ```typescript
93
- * () => void;
94
- * ```
95
- *
96
- * ### "memberAdded"
97
- *
98
- * The "memberAdded" event is emitted when a member joins the audience.
99
- *
100
- * #### Listener signature
101
- *
102
- * ```typescript
103
- * (clientId: string, member: M) => void;
104
- * ```
105
- * - `clientId` - A unique identifier for the client
106
- *
107
- * - `member` - The service-specific member object for the client
108
- *
109
- * ### "memberRemoved"
110
- *
111
- * The "memberRemoved" event is emitted when a member leaves the audience.
112
- *
113
- * #### Listener signature
114
- *
115
- * ```typescript
116
- * (clientId: string, member: M) => void;
117
- * ```
118
- * - `clientId` - A unique identifier for the client
119
- *
120
- * - `member` - The service-specific member object for the client
121
- * @typeParam M - A service-specific member type.
122
- */
123
- export interface IServiceAudienceEvents<M extends IMember> extends IEvent {
124
- (event: "membersChanged", listener: () => void): void;
125
- (event: "memberAdded" | "memberRemoved", listener: (clientId: string, member: M) => void): void;
126
- }
127
- /**
128
- * Base interface to be implemented to fetch each service's audience. The generic M allows consumers to further
129
- * extend the client object with service-specific details about the connecting client, such as device information,
130
- * environment, or a username.
131
- * @typeParam M - A service-specific member type.
132
- */
133
- export interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {
134
- /**
135
- * Returns an map of all users currently in the Fluid session where key is the userId and the value is the
136
- * member object. The implementation may choose to exclude certain connections from the returned map.
137
- * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.
138
- */
139
- getMembers(): Map<string, M>;
140
- /**
141
- * Returns the current active user on this client once they are connected. Otherwise, returns undefined.
142
- */
143
- getMyself(): M | undefined;
144
- }
145
- /**
146
- * Base interface for information for each connection made to the Fluid session. This interface can be extended
147
- * to provide additional information specific to each service.
148
- */
149
- export interface IConnection {
150
- /**
151
- * A unique ID for the connection. A single user may have multiple connections, each with a different ID.
152
- */
153
- id: string;
154
- /**
155
- * Whether the connection is in read or read/write mode.
156
- */
157
- mode: "write" | "read";
158
- }
159
- /**
160
- * Base interface to be implemented to fetch each service's member. This interface can be extended by each service
161
- * to provide additional service-specific user metadata.
162
- */
163
- export interface IMember {
164
- /**
165
- * An ID for the user, unique among each individual user connecting to the session.
166
- */
167
- userId: string;
168
- /**
169
- * The set of connections the user has made, e.g. from multiple tabs or devices.
170
- */
171
- connections: IConnection[];
172
- }
173
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;GAEG;AACH,oBAAY,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAElE;;;GAGG;AACH,oBAAY,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;AAEjF;;;GAGG;AACH,oBAAY,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEtG;;;;GAIG;AACH,oBAAY,eAAe,CAAC,CAAC,SAAS,cAAc,IAC9C;IAAE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;CAAE,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAE5E;;;;GAIG;AACH,oBAAY,iBAAiB,CAAC,CAAC,SAAS,cAAc,IAChD;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,eAAe,CAAC;CAAE,GAAG,kBAAkB,CAAC,C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types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","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 } from \"@fluidframework/common-definitions\";\nimport { 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 DataObjects or SharedObjects.\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 LoadableObjectRecord.\n */\nexport type LoadableObjectClassRecord = Record<string, LoadableObjectClass<any>>;\n\n/**\n * A LoadableObjectClass is an class object of DataObject or SharedObject\n * @typeParam T - The class of the DataObject or SharedObject\n */\nexport type LoadableObjectClass<T extends IFluidLoadable> = DataObjectClass<T> | SharedObjectClass<T>;\n\n/**\n * A DataObjectClass is a class that has a factory that can create a DataObject and a\n * constructor that will return the type of the DataObject.\n * @typeParam T - The class of the DataObject\n */\nexport type DataObjectClass<T extends IFluidLoadable>\n = { readonly factory: IFluidDataStoreFactory; } & LoadableObjectCtor<T>;\n\n/**\n * A SharedObjectClass is a class that has a factory that can create a DDS (SharedObject) and a\n * constructor that will return the type of the DataObject.\n * @typeParam T - The class of the SharedObject\n */\nexport type SharedObjectClass<T extends IFluidLoadable>\n = { readonly getFactory: () => IChannelFactory; } & LoadableObjectCtor<T>;\n\n/**\n * An object with a constructor that will return an `IFluidLoadable`.\n * @typeParam T - The class of the loadable object\n */\nexport type LoadableObjectCtor<T extends IFluidLoadable> = new(...args: any[]) => T;\n\n/**\n * The ContainerSchema declares the Fluid objects that will be available in the container. It includes both the\n * instances of objects that are initially available upon container creation, as well as the types of objects that may\n * be dynamically created throughout the lifetime of the container.\n */\nexport interface ContainerSchema {\n /**\n * Defines loadable objects that will be created when the `Container` is first created.\n * It uses the key as the id and the value as the loadable object to create.\n *\n * @example\n * In the example below two objects will be created when the Container is first\n * created. One with id \"map1\" that will return a `SharedMap` and the other with\n * id \"pair1\" that will return a `KeyValueDataObject`.\n *\n * ```\n * {\n * map1: SharedMap,\n * pair1: KeyValueDataObject,\n * }\n * ```\n */\n initialObjects: LoadableObjectClassRecord;\n\n /**\n * Dynamic objects are Loadable objects that can be created after the initial Container creation.\n *\n * Types defined in `initialObjects` will always be available and are not required to be provided here.\n *\n * For best practice it's recommended to define all the dynamic types you create even if they are\n * included via initialObjects.\n */\n dynamicObjectTypes?: LoadableObjectClass<any>[];\n}\n\n/**\n * Events that trigger when the roster of members in the Fluid session change.\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 * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"membersChanged\"\n *\n * The \"membersChanged\" event is emitted when a member is either added or removed.\n *\n * #### Listener signature\n *\n * ```typescript\n * () => void;\n * ```\n *\n * ### \"memberAdded\"\n *\n * The \"memberAdded\" event is emitted when a member joins the audience.\n *\n * #### Listener signature\n *\n * ```typescript\n * (clientId: string, member: M) => void;\n * ```\n * - `clientId` - A unique identifier for the client\n *\n * - `member` - The service-specific member object for the client\n *\n * ### \"memberRemoved\"\n *\n * The \"memberRemoved\" event is emitted when a member leaves the audience.\n *\n * #### Listener signature\n *\n * ```typescript\n * (clientId: string, member: M) => void;\n * ```\n * - `clientId` - A unique identifier for the client\n *\n * - `member` - The service-specific member object for the client\n * @typeParam M - A service-specific member type.\n */\nexport interface IServiceAudienceEvents<M extends IMember> extends IEvent {\n (event: \"membersChanged\", listener: () => void): void;\n (event: \"memberAdded\" | \"memberRemoved\", listener: (clientId: string, member: M) => void): void;\n}\n\n/**\n * Base interface to be implemented to fetch each service's audience. The generic M allows consumers to further\n * extend the client object with service-specific details about the connecting client, such as device information,\n * environment, or a username.\n * @typeParam M - A service-specific member type.\n */\nexport interface IServiceAudience<M extends IMember> extends IEventProvider<IServiceAudienceEvents<M>> {\n /**\n * Returns an map of all users currently in the Fluid session where key is the userId and the value is the\n * member object. The implementation may choose to exclude certain connections from the returned map.\n * E.g. ServiceAudience excludes non-interactive connections to represent only the roster of live users.\n */\n getMembers(): Map<string, M>;\n\n /**\n * Returns the current active user on this client once they are connected. Otherwise, returns undefined.\n */\n getMyself(): M | undefined;\n}\n\n/**\n * Base interface for information for each connection made to the Fluid session. This interface can be extended\n * to provide additional information specific to each service.\n */\nexport interface IConnection {\n /**\n * A unique ID for the connection. A single user may have multiple connections, each with a different ID.\n */\n id: string;\n\n /**\n * Whether the connection is in read or read/write mode.\n */\n mode: \"write\" | \"read\";\n}\n\n/**\n * Base interface to be implemented to fetch each service's member. This interface can be extended by each service\n * to provide additional service-specific user metadata.\n */\nexport interface IMember {\n /**\n * An ID for the user, unique among each individual user connecting to the session.\n */\n userId: string;\n\n /**\n * The set of connections the user has made, e.g. from multiple tabs or devices.\n */\n connections: IConnection[];\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,EACH,eAAe,EACf,eAAe,EAEf,iBAAiB,EACpB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAS,GAAG,gCAEzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QACvB,GAAG,kCAGX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,WAClC,eAAe,KACxB,CAAC,gCAAgC,EAAE,EAAE,eAAe,EAAE,CA+BxD,CAAC"}
package/lib/utils.js.map DELETED
@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AAE,CAAC;KACvC,CAAC,CAAC;IACH,cAAc,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAErC,IAAI,eAAe,CAAC,IAAI,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE;QACxD,MAAM,IAAI,KAAK,CACX,uDAAuD,CAC1D,CAAC;KACL;IAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;AACpE,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 {\n ContainerSchema,\n DataObjectClass,\n LoadableObjectClass,\n SharedObjectClass,\n} 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 return obj?.factory !== undefined;\n};\n\n/**\n * Runtime check to determine if a class is a SharedObject type\n */\nexport const isSharedObjectClass = (\n obj: any,\n): obj is SharedObjectClass<any> => {\n return 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 schema: ContainerSchema,\n): [NamedFluidDataStoreRegistryEntry[], IChannelFactory[]] => {\n const registryEntries: Set<NamedFluidDataStoreRegistryEntry> = new Set();\n const sharedObjects: Set<IChannelFactory> = new Set();\n\n const tryAddObject = (obj: LoadableObjectClass<any>) => {\n if (isSharedObjectClass(obj)) {\n sharedObjects.add(obj.getFactory());\n } else if (isDataObjectClass(obj)) {\n registryEntries.add([\n obj.factory.type,\n Promise.resolve(obj.factory),\n ]);\n } else {\n throw new Error(`Entry is neither a DataObject or a SharedObject`);\n }\n };\n\n // Add the object types that will be initialized\n const dedupedObjects = new Set([\n ...Object.values(schema.initialObjects),\n ...(schema.dynamicObjectTypes ?? []),\n ]);\n dedupedObjects.forEach(tryAddObject);\n\n if (registryEntries.size === 0 && sharedObjects.size === 0) {\n throw new Error(\n \"Container cannot be initialized without any DataTypes\",\n );\n }\n\n return [Array.from(registryEntries), Array.from(sharedObjects)];\n};\n"]}
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext"
6
- },
7
- }