@fluidframework/aqueduct 2.0.0-dev.7.4.0.217212 → 2.0.0-dev.7.4.0.221926

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 (72) hide show
  1. package/dist/aqueduct-alpha.d.ts +349 -59
  2. package/dist/aqueduct-beta.d.ts +34 -0
  3. package/dist/aqueduct-public.d.ts +34 -0
  4. package/dist/aqueduct-untrimmed.d.ts +9 -9
  5. package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs +1 -1
  6. package/dist/container-runtime-factories/baseContainerRuntimeFactory.cjs.map +1 -1
  7. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +1 -1
  8. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs +1 -1
  9. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.cjs.map +1 -1
  10. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +1 -1
  11. package/dist/data-object-factories/dataObjectFactory.cjs +1 -1
  12. package/dist/data-object-factories/dataObjectFactory.cjs.map +1 -1
  13. package/dist/data-object-factories/dataObjectFactory.d.ts +1 -1
  14. package/dist/data-object-factories/pureDataObjectFactory.cjs +1 -1
  15. package/dist/data-object-factories/pureDataObjectFactory.cjs.map +1 -1
  16. package/dist/data-object-factories/pureDataObjectFactory.d.ts +2 -2
  17. package/dist/data-objects/dataObject.cjs +1 -1
  18. package/dist/data-objects/dataObject.cjs.map +1 -1
  19. package/dist/data-objects/dataObject.d.ts +1 -1
  20. package/dist/data-objects/pureDataObject.cjs +1 -1
  21. package/dist/data-objects/pureDataObject.cjs.map +1 -1
  22. package/dist/data-objects/pureDataObject.d.ts +1 -1
  23. package/dist/data-objects/types.cjs.map +1 -1
  24. package/dist/data-objects/types.d.ts +2 -2
  25. package/lib/aqueduct-alpha.d.ts +349 -59
  26. package/lib/aqueduct-beta.d.ts +34 -0
  27. package/lib/aqueduct-public.d.ts +34 -0
  28. package/lib/aqueduct-untrimmed.d.ts +9 -9
  29. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts +59 -0
  30. package/lib/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -0
  31. package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs +1 -1
  32. package/lib/container-runtime-factories/baseContainerRuntimeFactory.mjs.map +1 -1
  33. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +45 -0
  34. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
  35. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs +1 -1
  36. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.mjs.map +1 -1
  37. package/lib/container-runtime-factories/index.d.ts +7 -0
  38. package/lib/container-runtime-factories/index.d.ts.map +1 -0
  39. package/lib/data-object-factories/dataObjectFactory.d.ts +23 -0
  40. package/lib/data-object-factories/dataObjectFactory.d.ts.map +1 -0
  41. package/lib/data-object-factories/dataObjectFactory.mjs +1 -1
  42. package/lib/data-object-factories/dataObjectFactory.mjs.map +1 -1
  43. package/lib/data-object-factories/index.d.ts +7 -0
  44. package/lib/data-object-factories/index.d.ts.map +1 -0
  45. package/lib/data-object-factories/pureDataObjectFactory.d.ts +100 -0
  46. package/lib/data-object-factories/pureDataObjectFactory.d.ts.map +1 -0
  47. package/lib/data-object-factories/pureDataObjectFactory.mjs +1 -1
  48. package/lib/data-object-factories/pureDataObjectFactory.mjs.map +1 -1
  49. package/lib/data-objects/dataObject.d.ts +38 -0
  50. package/lib/data-objects/dataObject.d.ts.map +1 -0
  51. package/lib/data-objects/dataObject.mjs +1 -1
  52. package/lib/data-objects/dataObject.mjs.map +1 -1
  53. package/lib/data-objects/index.d.ts +8 -0
  54. package/lib/data-objects/index.d.ts.map +1 -0
  55. package/lib/data-objects/pureDataObject.d.ts +98 -0
  56. package/lib/data-objects/pureDataObject.d.ts.map +1 -0
  57. package/lib/data-objects/pureDataObject.mjs +1 -1
  58. package/lib/data-objects/pureDataObject.mjs.map +1 -1
  59. package/lib/data-objects/types.d.ts +36 -0
  60. package/lib/data-objects/types.d.ts.map +1 -0
  61. package/lib/data-objects/types.mjs.map +1 -1
  62. package/lib/index.d.ts +10 -0
  63. package/lib/index.d.ts.map +1 -0
  64. package/lib/request-handlers/index.d.ts +6 -0
  65. package/lib/request-handlers/index.d.ts.map +1 -0
  66. package/lib/request-handlers/requestHandlers.d.ts +46 -0
  67. package/lib/request-handlers/requestHandlers.d.ts.map +1 -0
  68. package/lib/utils/containerInteractions.d.ts +38 -0
  69. package/lib/utils/containerInteractions.d.ts.map +1 -0
  70. package/lib/utils/index.d.ts +6 -0
  71. package/lib/utils/index.d.ts.map +1 -0
  72. package/package.json +19 -29
@@ -13,94 +13,384 @@
13
13
  * @packageDocumentation
14
14
  */
15
15
 
16
+ import { AsyncFluidObjectProvider } from '@fluidframework/synthesize';
17
+ import { ContainerRuntime } from '@fluidframework/container-runtime';
18
+ import { FluidDataStoreRuntime } from '@fluidframework/datastore';
16
19
  import { FluidObject } from '@fluidframework/core-interfaces';
20
+ import { FluidObjectSymbolProvider } from '@fluidframework/synthesize';
21
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
17
22
  import { IContainer } from '@fluidframework/container-definitions';
18
23
  import { IContainerContext } from '@fluidframework/container-definitions';
24
+ import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
25
+ import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
26
+ import { IContainerRuntimeOptions } from '@fluidframework/container-runtime';
19
27
  import { IEvent } from '@fluidframework/core-interfaces';
28
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
29
+ import { IFluidDataStoreContextDetached } from '@fluidframework/runtime-definitions';
30
+ import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
31
+ import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
32
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
33
+ import { IFluidDependencySynthesizer } from '@fluidframework/synthesize';
34
+ import { IFluidHandle } from '@fluidframework/core-interfaces';
35
+ import { IFluidLoadable } from '@fluidframework/core-interfaces';
36
+ import type { IFluidMountableViewClass } from '@fluidframework/view-interfaces';
20
37
  import { IFluidRouter } from '@fluidframework/core-interfaces';
38
+ import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
39
+ import { IProvideFluidHandle } from '@fluidframework/core-interfaces';
21
40
  import { IRequest } from '@fluidframework/core-interfaces';
22
41
  import { IResponse } from '@fluidframework/core-interfaces';
42
+ import { ISharedDirectory } from '@fluidframework/map';
43
+ import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions';
44
+ import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
45
+ import { RequestParser } from '@fluidframework/runtime-utils';
46
+ import { RuntimeFactoryHelper } from '@fluidframework/runtime-utils';
47
+ import { RuntimeRequestHandler } from '@fluidframework/request-handler';
48
+ import { TypedEventEmitter } from '@fluid-internal/client-utils';
23
49
 
24
- /* Excluded from this release type: AsyncFluidObjectProvider */
25
-
26
- /* Excluded from this release type: BaseContainerRuntimeFactory */
27
-
28
- /* Excluded from this release type: ContainerRuntime */
50
+ /**
51
+ * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,
52
+ * request handlers, runtimeOptions, and entryPoint initialization function.
53
+ * It can be subclassed to implement a first-time initialization procedure for the containers it creates.
54
+ * @alpha
55
+ */
56
+ export declare class BaseContainerRuntimeFactory extends RuntimeFactoryHelper implements IProvideFluidDataStoreRegistry {
57
+ get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
58
+ private readonly registry;
59
+ private readonly registryEntries;
60
+ private readonly dependencyContainer?;
61
+ private readonly runtimeOptions?;
62
+ private readonly requestHandlers;
63
+ private readonly provideEntryPoint;
64
+ /**
65
+ * @param registryEntries - The data store registry for containers produced
66
+ * @param dependencyContainer - deprecated, will be removed in a future release
67
+ * @param requestHandlers - Request handlers for containers produced
68
+ * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it
69
+ * @param provideEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances
70
+ * created with this factory
71
+ */
72
+ constructor(props: {
73
+ registryEntries: NamedFluidDataStoreRegistryEntries;
74
+ dependencyContainer?: IFluidDependencySynthesizer;
75
+ /** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
76
+ requestHandlers?: RuntimeRequestHandler[];
77
+ runtimeOptions?: IContainerRuntimeOptions;
78
+ provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
79
+ });
80
+ instantiateFirstTime(runtime: ContainerRuntime): Promise<void>;
81
+ instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
82
+ preInitialize(context: IContainerContext, existing: boolean): Promise<ContainerRuntime>;
83
+ /**
84
+ * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container
85
+ * is created. This likely includes creating any initial data stores that are expected to be there at the outset.
86
+ * @param runtime - The container runtime for the container being initialized
87
+ */
88
+ protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
89
+ /**
90
+ * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.
91
+ * This likely includes loading any data stores that are expected to be there at the outset.
92
+ * @param runtime - The container runtime for the container being initialized
93
+ */
94
+ protected containerHasInitialized(runtime: IContainerRuntime): Promise<void>;
95
+ }
29
96
 
30
- /* Excluded from this release type: ContainerRuntimeFactoryWithDefaultDataStore */
97
+ /**
98
+ * A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from
99
+ * the container with an empty URL.
100
+ *
101
+ * This factory should be exposed as fluidExport off the entry point to your module.
102
+ * @alpha
103
+ */
104
+ export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {
105
+ static readonly defaultDataStoreId = "default";
106
+ protected readonly defaultFactory: IFluidDataStoreFactory;
107
+ /**
108
+ * Constructor
109
+ * @param defaultFactory -
110
+ * @param registryEntries -
111
+ * @param dependencyContainer - deprecated, will be removed in a future release
112
+ * @param requestHandlers -
113
+ * @param runtimeOptions -
114
+ * @param provideEntryPoint -
115
+ */
116
+ constructor(props: {
117
+ defaultFactory: IFluidDataStoreFactory;
118
+ registryEntries: NamedFluidDataStoreRegistryEntries;
119
+ dependencyContainer?: IFluidDependencySynthesizer;
120
+ /** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
121
+ requestHandlers?: RuntimeRequestHandler[];
122
+ runtimeOptions?: IContainerRuntimeOptions;
123
+ provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;
124
+ });
125
+ /**
126
+ * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}
127
+ */
128
+ protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
129
+ }
31
130
 
32
- /* Excluded from this release type: DataObject */
131
+ /**
132
+ * DataObject is a base data store that is primed with a root directory. It
133
+ * ensures that it is created and ready before you can access it.
134
+ *
135
+ * Having a single root directory allows for easier development. Instead of creating
136
+ * and registering channels with the runtime any new DDS that is set on the root
137
+ * will automatically be registered.
138
+ *
139
+ * @typeParam I - The optional input types used to strongly type the data object
140
+ * @alpha
141
+ */
142
+ export declare abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I> {
143
+ private internalRoot;
144
+ private readonly rootDirectoryId;
145
+ /**
146
+ * The root directory will either be ready or will return an error. If an error is thrown
147
+ * the root has not been correctly created/set.
148
+ */
149
+ protected get root(): ISharedDirectory;
150
+ /**
151
+ * Initializes internal objects and calls initialization overrides.
152
+ * Caller is responsible for ensuring this is only invoked once.
153
+ */
154
+ initializeInternal(existing: boolean): Promise<void>;
155
+ /**
156
+ * Generates an error string indicating an item is uninitialized.
157
+ * @param item - The name of the item that was uninitialized.
158
+ */
159
+ protected getUninitializedErrorString(item: string): string;
160
+ }
33
161
 
34
- /* Excluded from this release type: DataObjectFactory */
162
+ /**
163
+ * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
164
+ * It facilitates DataObject's features (such as its shared directory) by
165
+ * ensuring relevant shared objects etc are available to the factory.
166
+ *
167
+ * @typeParam TObj - DataObject (concrete type)
168
+ * @typeParam I - The input types for the DataObject
169
+ * @alpha
170
+ */
171
+ export declare class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
172
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[] | undefined, optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
173
+ }
35
174
 
36
- /* Excluded from this release type: DataObjectTypes */
175
+ /**
176
+ * This type is used as the base generic input to DataObject and PureDataObject.
177
+ * @alpha
178
+ */
179
+ export declare interface DataObjectTypes {
180
+ /**
181
+ * represents a type that will define optional providers that will be injected
182
+ */
183
+ OptionalProviders?: FluidObject;
184
+ /**
185
+ * the initial state type that the produced data object may take during creation
186
+ */
187
+ InitialState?: any;
188
+ /**
189
+ * represents events that will be available in the EventForwarder
190
+ */
191
+ Events?: IEvent;
192
+ }
37
193
 
38
194
  /* Excluded from this release type: defaultFluidObjectRequestHandler */
39
195
 
40
196
  /* Excluded from this release type: defaultRouteRequestHandler */
41
197
 
42
- /* Excluded from this release type: FluidDataStoreRuntime */
43
-
44
- /* Excluded from this release type: FluidObjectSymbolProvider */
45
-
46
198
  /* Excluded from this release type: getDefaultObjectFromContainer */
47
199
 
48
200
  /* Excluded from this release type: getObjectFromContainer */
49
201
 
50
202
  /* Excluded from this release type: getObjectWithIdFromContainer */
51
203
 
52
- /* Excluded from this release type: IChannelFactory */
53
-
54
- /* Excluded from this release type: IContainerRuntime */
55
-
56
- /* Excluded from this release type: IContainerRuntimeBase */
57
-
58
- /* Excluded from this release type: IContainerRuntimeOptions */
59
-
60
- /* Excluded from this release type: IDataObjectProps */
61
-
62
- /* Excluded from this release type: IFluidDataStoreContext */
63
-
64
- /* Excluded from this release type: IFluidDataStoreContextDetached */
65
-
66
- /* Excluded from this release type: IFluidDataStoreFactory */
67
-
68
- /* Excluded from this release type: IFluidDataStoreRegistry */
69
-
70
- /* Excluded from this release type: IFluidDataStoreRuntime */
71
-
72
- /* Excluded from this release type: IFluidDependencySynthesizer */
73
-
74
- /* Excluded from this release type: IFluidHandle */
75
-
76
- /* Excluded from this release type: IFluidLoadable */
204
+ /**
205
+ * @alpha
206
+ */
207
+ export declare interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
208
+ readonly runtime: IFluidDataStoreRuntime;
209
+ readonly context: IFluidDataStoreContext;
210
+ readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
211
+ readonly initProps?: I["InitialState"];
212
+ }
77
213
 
78
214
  /* Excluded from this release type: IFluidMountableViewClass */
79
215
 
80
- /* Excluded from this release type: IProvideFluidDataStoreRegistry */
81
-
82
- /* Excluded from this release type: IProvideFluidHandle */
83
-
84
- /* Excluded from this release type: IRootDataObjectFactory */
85
-
86
- /* Excluded from this release type: ISharedDirectory */
216
+ /**
217
+ * Useful interface in places where it's useful to do type erasure for PureDataObject generic
218
+ * @deprecated Will be removed in future major release. Please remove all usage of it.
219
+ * @alpha
220
+ */
221
+ export declare interface IRootDataObjectFactory extends IFluidDataStoreFactory {
222
+ createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime): Promise<IFluidRouter>;
223
+ }
87
224
 
88
225
  /* Excluded from this release type: mountableViewRequestHandler */
89
226
 
90
- /* Excluded from this release type: NamedFluidDataStoreRegistryEntries */
91
-
92
- /* Excluded from this release type: NamedFluidDataStoreRegistryEntry */
93
-
94
- /* Excluded from this release type: PureDataObject */
95
-
96
- /* Excluded from this release type: PureDataObjectFactory */
97
-
98
- /* Excluded from this release type: RequestParser */
99
-
100
- /* Excluded from this release type: RuntimeFactoryHelper */
101
-
102
- /* Excluded from this release type: RuntimeRequestHandler */
227
+ /**
228
+ * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
229
+ * You probably don't want to inherit from this data store directly unless
230
+ * you are creating another base data store class
231
+ *
232
+ * @typeParam I - The optional input types used to strongly type the data object
233
+ * @alpha
234
+ */
235
+ export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends TypedEventEmitter<I["Events"] & IEvent> implements IFluidLoadable, IFluidRouter, IProvideFluidHandle {
236
+ /**
237
+ * This is your FluidDataStoreRuntime object
238
+ */
239
+ protected readonly runtime: IFluidDataStoreRuntime;
240
+ /**
241
+ * This context is used to talk up to the ContainerRuntime
242
+ */
243
+ protected readonly context: IFluidDataStoreContext;
244
+ /**
245
+ * Providers are FluidObject keyed objects that provide back
246
+ * a promise to the corresponding FluidObject or undefined.
247
+ * Providers injected/provided by the Container and/or HostingApplication
248
+ *
249
+ * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store
250
+ */
251
+ protected readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
252
+ protected initProps?: I["InitialState"];
253
+ protected initializeP: Promise<void> | undefined;
254
+ get id(): string;
255
+ /**
256
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
257
+ */
258
+ get IFluidRouter(): this;
259
+ get IFluidLoadable(): this;
260
+ get IFluidHandle(): IFluidHandle<this>;
261
+ /**
262
+ * Handle to a data store
263
+ */
264
+ get handle(): IFluidHandle<this>;
265
+ static getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject<DataObjectTypes>>;
266
+ constructor(props: IDataObjectProps<I>);
267
+ /**
268
+ * Return this object if someone requests it directly
269
+ * We will return this object in two scenarios:
270
+ *
271
+ * 1. the request url is a "/"
272
+ *
273
+ * 2. the request url is empty
274
+ */
275
+ request(req: IRequest): Promise<IResponse>;
276
+ /**
277
+ * Call this API to ensure PureDataObject is fully initialized.
278
+ * Initialization happens on demand, only on as-needed bases.
279
+ * In most cases you should allow factory/object to decide when to finish initialization.
280
+ * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods
281
+ * and need a fully initialized object, then you can call this API to ensure object is fully initialized.
282
+ */
283
+ finishInitialization(existing: boolean): Promise<void>;
284
+ /**
285
+ * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should
286
+ * generally not be done.
287
+ *
288
+ * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is
289
+ * responsible for ensuring this is only invoked once.
290
+ */
291
+ initializeInternal(existing: boolean): Promise<void>;
292
+ /**
293
+ * Called every time the data store is initialized, before initializingFirstTime or
294
+ * initializingFromExisting is called.
295
+ */
296
+ protected preInitialize(): Promise<void>;
297
+ /**
298
+ * Called the first time the data store is initialized (new creations with a new
299
+ * data store runtime)
300
+ *
301
+ * @param props - Optional props to be passed in on create
302
+ */
303
+ protected initializingFirstTime(props?: I["InitialState"]): Promise<void>;
304
+ /**
305
+ * Called every time but the first time the data store is initialized (creations
306
+ * with an existing data store runtime)
307
+ */
308
+ protected initializingFromExisting(): Promise<void>;
309
+ /**
310
+ * Called every time the data store is initialized after create or existing.
311
+ */
312
+ protected hasInitialized(): Promise<void>;
313
+ }
103
314
 
104
- /* Excluded from this release type: TypedEventEmitter */
315
+ /**
316
+ * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
317
+ * Consumers should typically use DataObjectFactory instead unless creating
318
+ * another base data store factory.
319
+ *
320
+ * @typeParam TObj - DataObject (concrete type)
321
+ * @typeParam I - The input types for the DataObject
322
+ * @alpha
323
+ */
324
+ export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory {
325
+ readonly type: string;
326
+ private readonly ctor;
327
+ private readonly optionalProviders;
328
+ private readonly runtimeClass;
329
+ private readonly sharedObjectRegistry;
330
+ private readonly registry;
331
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[], optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
332
+ get IFluidDataStoreFactory(): this;
333
+ get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined;
334
+ /**
335
+ * Convenience helper to get the data store's/factory's data store registry entry.
336
+ * The return type hides the factory's generics, easing grouping of registry
337
+ * entries that differ only in this way into the same array.
338
+ * @returns The NamedFluidDataStoreRegistryEntry
339
+ */
340
+ get registryEntry(): NamedFluidDataStoreRegistryEntry;
341
+ /**
342
+ * This is where we do data store setup.
343
+ *
344
+ * @param context - data store context used to load a data store runtime
345
+ */
346
+ instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
347
+ /**
348
+ * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.
349
+ * In other words, registry of context passed in has to contain this factory, with the name that matches
350
+ * this factory's type.
351
+ * It is intended to be used by data store objects that create sub-objects.
352
+ * @param context - The context being used to create the runtime
353
+ * (the created object will have its own new context created as well)
354
+ * @param initialState - The initial state to provide to the created data store.
355
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
356
+ * They get attached only when a handle to one of them is attached to already attached objects.
357
+ */
358
+ createChildInstance(parentContext: IFluidDataStoreContext, initialState?: I["InitialState"]): Promise<TObj>;
359
+ /**
360
+ * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.
361
+ * In other words, registry of context passed in has to have this factory.
362
+ * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.
363
+ * @param context - The component context being used to create the object
364
+ * (the created object will have its own new context created as well)
365
+ * @param initialState - The initial state to provide to the created component.
366
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
367
+ * They get attached only when a handle to one of them is attached to already attached objects.
368
+ */
369
+ createPeerInstance(peerContext: IFluidDataStoreContext, initialState?: I["InitialState"]): Promise<TObj>;
370
+ /**
371
+ * Creates a new instance of the object. Uses container's registry to find this factory.
372
+ * It's expected that only container owners would use this functionality, as only such developers
373
+ * have knowledge of entries in container registry.
374
+ * The name in this registry for such record should match type of this factory.
375
+ * @param runtime - container runtime. It's registry is used to create an object.
376
+ * @param initialState - The initial state to provide to the created component.
377
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
378
+ * They get attached only when a handle to one of them is attached to already attached objects.
379
+ */
380
+ createInstance(runtime: IContainerRuntimeBase, initialState?: I["InitialState"]): Promise<TObj>;
381
+ /**
382
+ * Creates a new root instance of the object. Uses container's registry to find this factory.
383
+ * It's expected that only container owners would use this functionality, as only such developers
384
+ * have knowledge of entries in container registry.
385
+ * The name in this registry for such record should match type of this factory.
386
+ * @param runtime - container runtime. It's registry is used to create an object.
387
+ * @param initialState - The initial state to provide to the created component.
388
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
389
+ * They get attached only when a handle to one of them is attached to already attached objects.
390
+ */
391
+ createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime, initialState?: I["InitialState"]): Promise<TObj>;
392
+ protected createNonRootInstanceCore(containerRuntime: IContainerRuntimeBase, packagePath: Readonly<string[]>, initialState?: I["InitialState"]): Promise<TObj>;
393
+ protected createInstanceCore(context: IFluidDataStoreContextDetached, initialState?: I["InitialState"]): Promise<TObj>;
394
+ }
105
395
 
106
396
  export { }
@@ -13,6 +13,40 @@
13
13
  * @packageDocumentation
14
14
  */
15
15
 
16
+ import { AsyncFluidObjectProvider } from '@fluidframework/synthesize';
17
+ import { ContainerRuntime } from '@fluidframework/container-runtime';
18
+ import { FluidDataStoreRuntime } from '@fluidframework/datastore';
19
+ import { FluidObject } from '@fluidframework/core-interfaces';
20
+ import { FluidObjectSymbolProvider } from '@fluidframework/synthesize';
21
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
22
+ import { IContainer } from '@fluidframework/container-definitions';
23
+ import { IContainerContext } from '@fluidframework/container-definitions';
24
+ import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
25
+ import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
26
+ import { IContainerRuntimeOptions } from '@fluidframework/container-runtime';
27
+ import { IEvent } from '@fluidframework/core-interfaces';
28
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
29
+ import { IFluidDataStoreContextDetached } from '@fluidframework/runtime-definitions';
30
+ import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
31
+ import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
32
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
33
+ import { IFluidDependencySynthesizer } from '@fluidframework/synthesize';
34
+ import { IFluidHandle } from '@fluidframework/core-interfaces';
35
+ import { IFluidLoadable } from '@fluidframework/core-interfaces';
36
+ import type { IFluidMountableViewClass } from '@fluidframework/view-interfaces';
37
+ import { IFluidRouter } from '@fluidframework/core-interfaces';
38
+ import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
39
+ import { IProvideFluidHandle } from '@fluidframework/core-interfaces';
40
+ import { IRequest } from '@fluidframework/core-interfaces';
41
+ import { IResponse } from '@fluidframework/core-interfaces';
42
+ import { ISharedDirectory } from '@fluidframework/map';
43
+ import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions';
44
+ import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
45
+ import { RequestParser } from '@fluidframework/runtime-utils';
46
+ import { RuntimeFactoryHelper } from '@fluidframework/runtime-utils';
47
+ import { RuntimeRequestHandler } from '@fluidframework/request-handler';
48
+ import { TypedEventEmitter } from '@fluid-internal/client-utils';
49
+
16
50
  /* Excluded from this release type: AsyncFluidObjectProvider */
17
51
 
18
52
  /* Excluded from this release type: BaseContainerRuntimeFactory */
@@ -13,6 +13,40 @@
13
13
  * @packageDocumentation
14
14
  */
15
15
 
16
+ import { AsyncFluidObjectProvider } from '@fluidframework/synthesize';
17
+ import { ContainerRuntime } from '@fluidframework/container-runtime';
18
+ import { FluidDataStoreRuntime } from '@fluidframework/datastore';
19
+ import { FluidObject } from '@fluidframework/core-interfaces';
20
+ import { FluidObjectSymbolProvider } from '@fluidframework/synthesize';
21
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
22
+ import { IContainer } from '@fluidframework/container-definitions';
23
+ import { IContainerContext } from '@fluidframework/container-definitions';
24
+ import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
25
+ import { IContainerRuntimeBase } from '@fluidframework/runtime-definitions';
26
+ import { IContainerRuntimeOptions } from '@fluidframework/container-runtime';
27
+ import { IEvent } from '@fluidframework/core-interfaces';
28
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
29
+ import { IFluidDataStoreContextDetached } from '@fluidframework/runtime-definitions';
30
+ import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
31
+ import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
32
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
33
+ import { IFluidDependencySynthesizer } from '@fluidframework/synthesize';
34
+ import { IFluidHandle } from '@fluidframework/core-interfaces';
35
+ import { IFluidLoadable } from '@fluidframework/core-interfaces';
36
+ import type { IFluidMountableViewClass } from '@fluidframework/view-interfaces';
37
+ import { IFluidRouter } from '@fluidframework/core-interfaces';
38
+ import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
39
+ import { IProvideFluidHandle } from '@fluidframework/core-interfaces';
40
+ import { IRequest } from '@fluidframework/core-interfaces';
41
+ import { IResponse } from '@fluidframework/core-interfaces';
42
+ import { ISharedDirectory } from '@fluidframework/map';
43
+ import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions';
44
+ import { NamedFluidDataStoreRegistryEntry } from '@fluidframework/runtime-definitions';
45
+ import { RequestParser } from '@fluidframework/runtime-utils';
46
+ import { RuntimeFactoryHelper } from '@fluidframework/runtime-utils';
47
+ import { RuntimeRequestHandler } from '@fluidframework/request-handler';
48
+ import { TypedEventEmitter } from '@fluid-internal/client-utils';
49
+
16
50
  /* Excluded from this release type: AsyncFluidObjectProvider */
17
51
 
18
52
  /* Excluded from this release type: BaseContainerRuntimeFactory */
@@ -51,7 +51,7 @@ import { TypedEventEmitter } from '@fluid-internal/client-utils';
51
51
  * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,
52
52
  * request handlers, runtimeOptions, and entryPoint initialization function.
53
53
  * It can be subclassed to implement a first-time initialization procedure for the containers it creates.
54
- * @internal
54
+ * @alpha
55
55
  */
56
56
  export declare class BaseContainerRuntimeFactory extends RuntimeFactoryHelper implements IProvideFluidDataStoreRegistry {
57
57
  get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
@@ -99,7 +99,7 @@ export declare class BaseContainerRuntimeFactory extends RuntimeFactoryHelper im
99
99
  * the container with an empty URL.
100
100
  *
101
101
  * This factory should be exposed as fluidExport off the entry point to your module.
102
- * @internal
102
+ * @alpha
103
103
  */
104
104
  export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {
105
105
  static readonly defaultDataStoreId = "default";
@@ -137,7 +137,7 @@ export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseCon
137
137
  * will automatically be registered.
138
138
  *
139
139
  * @typeParam I - The optional input types used to strongly type the data object
140
- * @internal
140
+ * @alpha
141
141
  */
142
142
  export declare abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I> {
143
143
  private internalRoot;
@@ -166,7 +166,7 @@ export declare abstract class DataObject<I extends DataObjectTypes = DataObjectT
166
166
  *
167
167
  * @typeParam TObj - DataObject (concrete type)
168
168
  * @typeParam I - The input types for the DataObject
169
- * @internal
169
+ * @alpha
170
170
  */
171
171
  export declare class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
172
172
  constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[] | undefined, optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
@@ -174,7 +174,7 @@ export declare class DataObjectFactory<TObj extends DataObject<I>, I extends Dat
174
174
 
175
175
  /**
176
176
  * This type is used as the base generic input to DataObject and PureDataObject.
177
- * @internal
177
+ * @alpha
178
178
  */
179
179
  export declare interface DataObjectTypes {
180
180
  /**
@@ -254,7 +254,7 @@ export declare function getObjectFromContainer<T = FluidObject>(path: string, co
254
254
  export declare function getObjectWithIdFromContainer<T = FluidObject>(id: string, container: IContainer): Promise<T>;
255
255
 
256
256
  /**
257
- * @internal
257
+ * @alpha
258
258
  */
259
259
  export declare interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
260
260
  readonly runtime: IFluidDataStoreRuntime;
@@ -265,8 +265,8 @@ export declare interface IDataObjectProps<I extends DataObjectTypes = DataObject
265
265
 
266
266
  /**
267
267
  * Useful interface in places where it's useful to do type erasure for PureDataObject generic
268
- * @internal
269
268
  * @deprecated Will be removed in future major release. Please remove all usage of it.
269
+ * @alpha
270
270
  */
271
271
  export declare interface IRootDataObjectFactory extends IFluidDataStoreFactory {
272
272
  createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime): Promise<IFluidRouter>;
@@ -293,7 +293,7 @@ export declare const mountableViewRequestHandler: (MountableViewClass: IFluidMou
293
293
  * you are creating another base data store class
294
294
  *
295
295
  * @typeParam I - The optional input types used to strongly type the data object
296
- * @internal
296
+ * @alpha
297
297
  */
298
298
  export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends TypedEventEmitter<I["Events"] & IEvent> implements IFluidLoadable, IFluidRouter, IProvideFluidHandle {
299
299
  /**
@@ -382,7 +382,7 @@ export declare abstract class PureDataObject<I extends DataObjectTypes = DataObj
382
382
  *
383
383
  * @typeParam TObj - DataObject (concrete type)
384
384
  * @typeParam I - The input types for the DataObject
385
- * @internal
385
+ * @alpha
386
386
  */
387
387
  export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory {
388
388
  readonly type: string;
@@ -14,7 +14,7 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
14
14
  * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,
15
15
  * request handlers, runtimeOptions, and entryPoint initialization function.
16
16
  * It can be subclassed to implement a first-time initialization procedure for the containers it creates.
17
- * @internal
17
+ * @alpha
18
18
  */
19
19
  class BaseContainerRuntimeFactory extends runtime_utils_1.RuntimeFactoryHelper {
20
20
  get IFluidDataStoreRegistry() {
@@ -1 +1 @@
1
- {"version":3,"file":"baseContainerRuntimeFactory.cjs","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAI2C;AAE3C,gDAAgD;AAChD,qEAAoG;AAMpG,2DAIoC;AACpC,iEAAqE;AAGrE;;;;;GAKG;AACH,MAAa,2BACZ,SAAQ,oCAAoB;IAG5B,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IASD;;;;;;;OAOG;IACH,YAAY,KAOX;QACA,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAC7C,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,0CAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;QAC1D,MAAM,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;QAC7D,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA0B,EAC1B,QAAiB;QAEjB,MAAM,KAAK,GAAgD,OAAO,CAAC,KAAK,CAAC;QACzE,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC7B,MAAM,EAAE,GAAG,IAAI,gCAAmB,CACjC,IAAI,CAAC,mBAAmB,EACxB,KAAK,CAAC,2BAA2B,CACjC,CAAC;YACF,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC;SACvC;QAED,OAAO,oCAAgB,CAAC,WAAW,CAAC;YACnC,OAAO;YACP,QAAQ;YACR,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,cAAc,EAAE,KAAK;YACrB,gDAAgD;YAChD,cAAc,EAAE,IAAA,4CAA0B,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC;YACnE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SACzC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B,IAAG,CAAC;IAE7E;;;;OAIG;IACO,KAAK,CAAC,uBAAuB,CAAC,OAA0B,IAAG,CAAC;CACtE;AAxFD,kEAwFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerContext } from \"@fluidframework/container-definitions\";\nimport {\n\tIContainerRuntimeOptions,\n\tFluidDataStoreRegistry,\n\tContainerRuntime,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\n// eslint-disable-next-line import/no-deprecated\nimport { RuntimeRequestHandler, buildRuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport {\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tDependencyContainer,\n\tIFluidDependencySynthesizer,\n\tIProvideFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,\n * request handlers, runtimeOptions, and entryPoint initialization function.\n * It can be subclassed to implement a first-time initialization procedure for the containers it creates.\n * @internal\n */\nexport class BaseContainerRuntimeFactory\n\textends RuntimeFactoryHelper\n\timplements IProvideFluidDataStoreRegistry\n{\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this.registry;\n\t}\n\tprivate readonly registry: IFluidDataStoreRegistry;\n\n\tprivate readonly registryEntries: NamedFluidDataStoreRegistryEntries;\n\tprivate readonly dependencyContainer?: IFluidDependencySynthesizer;\n\tprivate readonly runtimeOptions?: IContainerRuntimeOptions;\n\tprivate readonly requestHandlers: RuntimeRequestHandler[];\n\tprivate readonly provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\n\t/**\n\t * @param registryEntries - The data store registry for containers produced\n\t * @param dependencyContainer - deprecated, will be removed in a future release\n\t * @param requestHandlers - Request handlers for containers produced\n\t * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it\n\t * @param provideEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances\n\t * created with this factory\n\t */\n\tconstructor(props: {\n\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\tdependencyContainer?: IFluidDependencySynthesizer;\n\t\t/** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md */\n\t\trequestHandlers?: RuntimeRequestHandler[];\n\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\tprovideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\t}) {\n\t\tsuper();\n\n\t\tthis.registryEntries = props.registryEntries;\n\t\tthis.dependencyContainer = props.dependencyContainer;\n\t\tthis.runtimeOptions = props.runtimeOptions;\n\t\tthis.provideEntryPoint = props.provideEntryPoint;\n\t\tthis.requestHandlers = props.requestHandlers ?? [];\n\t\tthis.registry = new FluidDataStoreRegistry(this.registryEntries);\n\t}\n\n\tpublic async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n\t\tawait this.containerInitializingFirstTime(runtime);\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\tpublic async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\tpublic async preInitialize(\n\t\tcontext: IContainerContext,\n\t\texisting: boolean,\n\t): Promise<ContainerRuntime> {\n\t\tconst scope: Partial<IProvideFluidDependencySynthesizer> = context.scope;\n\t\tif (this.dependencyContainer) {\n\t\t\tconst dc = new DependencyContainer<FluidObject>(\n\t\t\t\tthis.dependencyContainer,\n\t\t\t\tscope.IFluidDependencySynthesizer,\n\t\t\t);\n\t\t\tscope.IFluidDependencySynthesizer = dc;\n\t\t}\n\n\t\treturn ContainerRuntime.loadRuntime({\n\t\t\tcontext,\n\t\t\texisting,\n\t\t\truntimeOptions: this.runtimeOptions,\n\t\t\tregistryEntries: this.registryEntries,\n\t\t\tcontainerScope: scope,\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\trequestHandler: buildRuntimeRequestHandler(...this.requestHandlers),\n\t\t\tprovideEntryPoint: this.provideEntryPoint,\n\t\t});\n\t}\n\n\t/**\n\t * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container\n\t * is created. This likely includes creating any initial data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime) {}\n\n\t/**\n\t * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.\n\t * This likely includes loading any data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerHasInitialized(runtime: IContainerRuntime) {}\n}\n"]}
1
+ {"version":3,"file":"baseContainerRuntimeFactory.cjs","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAI2C;AAE3C,gDAAgD;AAChD,qEAAoG;AAMpG,2DAIoC;AACpC,iEAAqE;AAGrE;;;;;GAKG;AACH,MAAa,2BACZ,SAAQ,oCAAoB;IAG5B,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IASD;;;;;;;OAOG;IACH,YAAY,KAOX;QACA,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAC7C,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QACrD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;QACjD,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,0CAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,OAAyB;QAC1D,MAAM,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,OAAyB;QAC7D,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA0B,EAC1B,QAAiB;QAEjB,MAAM,KAAK,GAAgD,OAAO,CAAC,KAAK,CAAC;QACzE,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC7B,MAAM,EAAE,GAAG,IAAI,gCAAmB,CACjC,IAAI,CAAC,mBAAmB,EACxB,KAAK,CAAC,2BAA2B,CACjC,CAAC;YACF,KAAK,CAAC,2BAA2B,GAAG,EAAE,CAAC;SACvC;QAED,OAAO,oCAAgB,CAAC,WAAW,CAAC;YACnC,OAAO;YACP,QAAQ;YACR,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,cAAc,EAAE,KAAK;YACrB,gDAAgD;YAChD,cAAc,EAAE,IAAA,4CAA0B,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC;YACnE,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SACzC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,8BAA8B,CAAC,OAA0B,IAAG,CAAC;IAE7E;;;;OAIG;IACO,KAAK,CAAC,uBAAuB,CAAC,OAA0B,IAAG,CAAC;CACtE;AAxFD,kEAwFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IContainerContext } from \"@fluidframework/container-definitions\";\nimport {\n\tIContainerRuntimeOptions,\n\tFluidDataStoreRegistry,\n\tContainerRuntime,\n} from \"@fluidframework/container-runtime\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\n// eslint-disable-next-line import/no-deprecated\nimport { RuntimeRequestHandler, buildRuntimeRequestHandler } from \"@fluidframework/request-handler\";\nimport {\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n\tNamedFluidDataStoreRegistryEntries,\n} from \"@fluidframework/runtime-definitions\";\nimport {\n\tDependencyContainer,\n\tIFluidDependencySynthesizer,\n\tIProvideFluidDependencySynthesizer,\n} from \"@fluidframework/synthesize\";\nimport { RuntimeFactoryHelper } from \"@fluidframework/runtime-utils\";\nimport { FluidObject } from \"@fluidframework/core-interfaces\";\n\n/**\n * BaseContainerRuntimeFactory produces container runtimes with the specified data store and service registries,\n * request handlers, runtimeOptions, and entryPoint initialization function.\n * It can be subclassed to implement a first-time initialization procedure for the containers it creates.\n * @alpha\n */\nexport class BaseContainerRuntimeFactory\n\textends RuntimeFactoryHelper\n\timplements IProvideFluidDataStoreRegistry\n{\n\tpublic get IFluidDataStoreRegistry() {\n\t\treturn this.registry;\n\t}\n\tprivate readonly registry: IFluidDataStoreRegistry;\n\n\tprivate readonly registryEntries: NamedFluidDataStoreRegistryEntries;\n\tprivate readonly dependencyContainer?: IFluidDependencySynthesizer;\n\tprivate readonly runtimeOptions?: IContainerRuntimeOptions;\n\tprivate readonly requestHandlers: RuntimeRequestHandler[];\n\tprivate readonly provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\n\t/**\n\t * @param registryEntries - The data store registry for containers produced\n\t * @param dependencyContainer - deprecated, will be removed in a future release\n\t * @param requestHandlers - Request handlers for containers produced\n\t * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it\n\t * @param provideEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances\n\t * created with this factory\n\t */\n\tconstructor(props: {\n\t\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t\tdependencyContainer?: IFluidDependencySynthesizer;\n\t\t/** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md */\n\t\trequestHandlers?: RuntimeRequestHandler[];\n\t\truntimeOptions?: IContainerRuntimeOptions;\n\t\tprovideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;\n\t}) {\n\t\tsuper();\n\n\t\tthis.registryEntries = props.registryEntries;\n\t\tthis.dependencyContainer = props.dependencyContainer;\n\t\tthis.runtimeOptions = props.runtimeOptions;\n\t\tthis.provideEntryPoint = props.provideEntryPoint;\n\t\tthis.requestHandlers = props.requestHandlers ?? [];\n\t\tthis.registry = new FluidDataStoreRegistry(this.registryEntries);\n\t}\n\n\tpublic async instantiateFirstTime(runtime: ContainerRuntime): Promise<void> {\n\t\tawait this.containerInitializingFirstTime(runtime);\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\tpublic async instantiateFromExisting(runtime: ContainerRuntime): Promise<void> {\n\t\tawait this.containerHasInitialized(runtime);\n\t}\n\n\tpublic async preInitialize(\n\t\tcontext: IContainerContext,\n\t\texisting: boolean,\n\t): Promise<ContainerRuntime> {\n\t\tconst scope: Partial<IProvideFluidDependencySynthesizer> = context.scope;\n\t\tif (this.dependencyContainer) {\n\t\t\tconst dc = new DependencyContainer<FluidObject>(\n\t\t\t\tthis.dependencyContainer,\n\t\t\t\tscope.IFluidDependencySynthesizer,\n\t\t\t);\n\t\t\tscope.IFluidDependencySynthesizer = dc;\n\t\t}\n\n\t\treturn ContainerRuntime.loadRuntime({\n\t\t\tcontext,\n\t\t\texisting,\n\t\t\truntimeOptions: this.runtimeOptions,\n\t\t\tregistryEntries: this.registryEntries,\n\t\t\tcontainerScope: scope,\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\trequestHandler: buildRuntimeRequestHandler(...this.requestHandlers),\n\t\t\tprovideEntryPoint: this.provideEntryPoint,\n\t\t});\n\t}\n\n\t/**\n\t * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container\n\t * is created. This likely includes creating any initial data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerInitializingFirstTime(runtime: IContainerRuntime) {}\n\n\t/**\n\t * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.\n\t * This likely includes loading any data stores that are expected to be there at the outset.\n\t * @param runtime - The container runtime for the container being initialized\n\t */\n\tprotected async containerHasInitialized(runtime: IContainerRuntime) {}\n}\n"]}