@fluidframework/aqueduct 2.0.0-internal.6.4.0 → 2.0.0-internal.7.1.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 (41) hide show
  1. package/dist/aqueduct-alpha.d.ts +439 -0
  2. package/dist/aqueduct-beta.d.ts +439 -0
  3. package/dist/aqueduct-public.d.ts +439 -0
  4. package/dist/aqueduct.d.ts +438 -0
  5. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts +13 -6
  6. package/dist/container-runtime-factories/baseContainerRuntimeFactory.d.ts.map +1 -1
  7. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js +14 -12
  8. package/dist/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  9. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts +11 -3
  10. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  11. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +19 -4
  12. package/dist/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  13. package/dist/data-object-factories/pureDataObjectFactory.d.ts.map +1 -1
  14. package/dist/data-object-factories/pureDataObjectFactory.js +5 -5
  15. package/dist/data-object-factories/pureDataObjectFactory.js.map +1 -1
  16. package/dist/data-objects/pureDataObject.d.ts +5 -29
  17. package/dist/data-objects/pureDataObject.d.ts.map +1 -1
  18. package/dist/data-objects/pureDataObject.js +19 -57
  19. package/dist/data-objects/pureDataObject.js.map +1 -1
  20. package/dist/request-handlers/requestHandlers.d.ts +3 -0
  21. package/dist/request-handlers/requestHandlers.d.ts.map +1 -1
  22. package/dist/request-handlers/requestHandlers.js +5 -0
  23. package/dist/request-handlers/requestHandlers.js.map +1 -1
  24. package/dist/tsdoc-metadata.json +1 -1
  25. package/dist/utils/containerInteractions.d.ts +3 -0
  26. package/dist/utils/containerInteractions.d.ts.map +1 -1
  27. package/dist/utils/containerInteractions.js +3 -0
  28. package/dist/utils/containerInteractions.js.map +1 -1
  29. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js +14 -12
  30. package/lib/container-runtime-factories/baseContainerRuntimeFactory.js.map +1 -1
  31. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js +19 -4
  32. package/lib/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  33. package/lib/data-object-factories/pureDataObjectFactory.js +5 -5
  34. package/lib/data-object-factories/pureDataObjectFactory.js.map +1 -1
  35. package/lib/data-objects/pureDataObject.js +20 -58
  36. package/lib/data-objects/pureDataObject.js.map +1 -1
  37. package/lib/request-handlers/requestHandlers.js +5 -0
  38. package/lib/request-handlers/requestHandlers.js.map +1 -1
  39. package/lib/utils/containerInteractions.js +3 -0
  40. package/lib/utils/containerInteractions.js.map +1 -1
  41. package/package.json +27 -27
@@ -0,0 +1,438 @@
1
+ /**
2
+ * The `aqueduct` package is a library for building Fluid objects and Fluid
3
+ * containers within the Fluid Framework. Its goal is to provide a thin base
4
+ * layer over the existing Fluid Framework interfaces that allows developers to
5
+ * get started quickly.
6
+ *
7
+ * @remarks
8
+ * About the library name: An "aqueduct" is a way to transport water from a source
9
+ * to another location. The library name was chosen because its purpose is to
10
+ * facilitate using lower level constructs and therefore handle 'fluid' items
11
+ * same as an aqueduct.
12
+ *
13
+ * @packageDocumentation
14
+ */
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
+
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
+ */
55
+ export declare class BaseContainerRuntimeFactory extends RuntimeFactoryHelper implements IProvideFluidDataStoreRegistry {
56
+ get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
57
+ private readonly registry;
58
+ private readonly registryEntries;
59
+ private readonly dependencyContainer?;
60
+ private readonly runtimeOptions?;
61
+ private readonly requestHandlers;
62
+ private readonly provideEntryPoint;
63
+ /**
64
+ * @param registryEntries - The data store registry for containers produced
65
+ * @param dependencyContainer - deprecated, will be removed in a future release
66
+ * @param requestHandlers - Request handlers for containers produced
67
+ * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it
68
+ * @param provideEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances
69
+ * created with this factory
70
+ */
71
+ constructor(props: {
72
+ registryEntries: NamedFluidDataStoreRegistryEntries;
73
+ dependencyContainer?: IFluidDependencySynthesizer;
74
+ /** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
75
+ requestHandlers?: RuntimeRequestHandler[];
76
+ runtimeOptions?: IContainerRuntimeOptions;
77
+ provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
78
+ });
79
+ instantiateFirstTime(runtime: ContainerRuntime): Promise<void>;
80
+ instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
81
+ preInitialize(context: IContainerContext, existing: boolean): Promise<ContainerRuntime>;
82
+ /**
83
+ * Subclasses may override containerInitializingFirstTime to perform any setup steps at the time the container
84
+ * is created. This likely includes creating any initial data stores that are expected to be there at the outset.
85
+ * @param runtime - The container runtime for the container being initialized
86
+ */
87
+ protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
88
+ /**
89
+ * Subclasses may override containerHasInitialized to perform any steps after the container has initialized.
90
+ * This likely includes loading any data stores that are expected to be there at the outset.
91
+ * @param runtime - The container runtime for the container being initialized
92
+ */
93
+ protected containerHasInitialized(runtime: IContainerRuntime): Promise<void>;
94
+ }
95
+
96
+ /**
97
+ * A ContainerRuntimeFactory that initializes Containers with a single default data store, which can be requested from
98
+ * the container with an empty URL.
99
+ *
100
+ * This factory should be exposed as fluidExport off the entry point to your module.
101
+ */
102
+ export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {
103
+ static readonly defaultDataStoreId = "default";
104
+ protected readonly defaultFactory: IFluidDataStoreFactory;
105
+ /**
106
+ * Constructor
107
+ * @param defaultFactory -
108
+ * @param registryEntries -
109
+ * @param dependencyContainer - deprecated, will be removed in a future release
110
+ * @param requestHandlers -
111
+ * @param runtimeOptions -
112
+ * @param provideEntryPoint -
113
+ */
114
+ constructor(props: {
115
+ defaultFactory: IFluidDataStoreFactory;
116
+ registryEntries: NamedFluidDataStoreRegistryEntries;
117
+ dependencyContainer?: IFluidDependencySynthesizer;
118
+ /** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
119
+ requestHandlers?: RuntimeRequestHandler[];
120
+ runtimeOptions?: IContainerRuntimeOptions;
121
+ provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;
122
+ });
123
+ /**
124
+ * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}
125
+ */
126
+ protected containerInitializingFirstTime(runtime: IContainerRuntime): Promise<void>;
127
+ }
128
+
129
+ /**
130
+ * DataObject is a base data store that is primed with a root directory. It
131
+ * ensures that it is created and ready before you can access it.
132
+ *
133
+ * Having a single root directory allows for easier development. Instead of creating
134
+ * and registering channels with the runtime any new DDS that is set on the root
135
+ * will automatically be registered.
136
+ *
137
+ * @typeParam I - The optional input types used to strongly type the data object
138
+ */
139
+ export declare abstract class DataObject<I extends DataObjectTypes = DataObjectTypes> extends PureDataObject<I> {
140
+ private internalRoot;
141
+ private readonly rootDirectoryId;
142
+ /**
143
+ * The root directory will either be ready or will return an error. If an error is thrown
144
+ * the root has not been correctly created/set.
145
+ */
146
+ protected get root(): ISharedDirectory;
147
+ /**
148
+ * Initializes internal objects and calls initialization overrides.
149
+ * Caller is responsible for ensuring this is only invoked once.
150
+ */
151
+ initializeInternal(existing: boolean): Promise<void>;
152
+ /**
153
+ * Generates an error string indicating an item is uninitialized.
154
+ * @param item - The name of the item that was uninitialized.
155
+ */
156
+ protected getUninitializedErrorString(item: string): string;
157
+ }
158
+
159
+ /**
160
+ * DataObjectFactory is the IFluidDataStoreFactory for use with DataObjects.
161
+ * It facilitates DataObject's features (such as its shared directory) by
162
+ * ensuring relevant shared objects etc are available to the factory.
163
+ *
164
+ * @typeParam TObj - DataObject (concrete type)
165
+ * @typeParam I - The input types for the DataObject
166
+ */
167
+ export declare class DataObjectFactory<TObj extends DataObject<I>, I extends DataObjectTypes = DataObjectTypes> extends PureDataObjectFactory<TObj, I> {
168
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[] | undefined, optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeFactory?: typeof FluidDataStoreRuntime);
169
+ }
170
+
171
+ /**
172
+ * This type is used as the base generic input to DataObject and PureDataObject.
173
+ */
174
+ export declare interface DataObjectTypes {
175
+ /**
176
+ * represents a type that will define optional providers that will be injected
177
+ */
178
+ OptionalProviders?: FluidObject;
179
+ /**
180
+ * the initial state type that the produced data object may take during creation
181
+ */
182
+ InitialState?: any;
183
+ /**
184
+ * represents events that will be available in the EventForwarder
185
+ */
186
+ Events?: IEvent;
187
+ }
188
+
189
+ /**
190
+ * Default request handler for a Fluid object that returns the object itself if:
191
+ *
192
+ * 1. the request url is empty
193
+ *
194
+ * 2. the request url is "/"
195
+ *
196
+ * 3. the request url starts with "/" and is followed by a query param, such as /?key=value
197
+ *
198
+ * Returns a 404 error for any other url.
199
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
200
+ */
201
+ export declare function defaultFluidObjectRequestHandler(fluidObject: FluidObject, request: IRequest): IResponse;
202
+
203
+ /**
204
+ * Pipe through container request into internal request.
205
+ * If request is empty and default url is provided, redirect request to such default url.
206
+ * @param defaultRootId - optional default root data store ID to pass request in case request is empty.
207
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
208
+ */
209
+ export declare const defaultRouteRequestHandler: (defaultRootId: string) => (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse | undefined>;
210
+
211
+ /**
212
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
213
+ * Helper function for getting the default Fluid Object from a Container. This function only works for
214
+ * Containers that support "/" request.
215
+ *
216
+ * @typeParam T - Defines the type you expect to be returned.
217
+ *
218
+ * @param container - Container you're attempting to get the object from
219
+ */
220
+ export declare function getDefaultObjectFromContainer<T = FluidObject>(container: IContainer): Promise<T>;
221
+
222
+ /**
223
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
224
+ * Helper function for getting a Fluid Object from a Container given a path/url. This function only works for
225
+ * Containers that support getting FluidObjects via request.
226
+ *
227
+ * @typeParam T - Defines the type you expect to be returned.
228
+ *
229
+ * @param path - Unique path/url of the FluidObject
230
+ * @param container - Container you're attempting to get the object from
231
+ */
232
+ export declare function getObjectFromContainer<T = FluidObject>(path: string, container: IContainer): Promise<T>;
233
+
234
+ /**
235
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
236
+ * Helper function for getting as Fluid Object from a Container given a Unique Id. This function only works for
237
+ * Containers that support getting FluidObjects via request.
238
+ *
239
+ * @typeParam T - Defines the type you expect to be returned.
240
+ *
241
+ * @param id - Unique id of the FluidObject
242
+ * @param container - Container you're attempting to get the object from
243
+ */
244
+ export declare function getObjectWithIdFromContainer<T = FluidObject>(id: string, container: IContainer): Promise<T>;
245
+
246
+ export declare interface IDataObjectProps<I extends DataObjectTypes = DataObjectTypes> {
247
+ readonly runtime: IFluidDataStoreRuntime;
248
+ readonly context: IFluidDataStoreContext;
249
+ readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
250
+ readonly initProps?: I["InitialState"];
251
+ }
252
+
253
+ export declare interface IRootDataObjectFactory extends IFluidDataStoreFactory {
254
+ createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime): Promise<IFluidRouter>;
255
+ }
256
+
257
+ /**
258
+ * A mountable view is only required if the view needs to be mounted across a bundle boundary. Mounting across
259
+ * bundle boundaries breaks some frameworks, so the mountable view is used to ensure the mounting is done within
260
+ * the same bundle as the view. For example, React hooks don't work if mounted across bundles since there will
261
+ * be two React instances, breaking the Rules of Hooks. When cross-bundle mounting isn't required, the mountable
262
+ * view isn't necessary.
263
+ *
264
+ * When a request is received with a mountableView: true header, this request handler will reissue the request
265
+ * without the header, and respond with a mountable view of the given class using the response.
266
+ * @param MountableViewClass - The type of mountable view to use when responding
267
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
268
+ */
269
+ export declare const mountableViewRequestHandler: (MountableViewClass: IFluidMountableViewClass, handlers: RuntimeRequestHandler[]) => (request: RequestParser, runtime: IContainerRuntime) => Promise<IResponse>;
270
+
271
+ /**
272
+ * This is a bare-bones base class that does basic setup and enables for factory on an initialize call.
273
+ * You probably don't want to inherit from this data store directly unless
274
+ * you are creating another base data store class
275
+ *
276
+ * @typeParam I - The optional input types used to strongly type the data object
277
+ */
278
+ export declare abstract class PureDataObject<I extends DataObjectTypes = DataObjectTypes> extends TypedEventEmitter<I["Events"] & IEvent> implements IFluidLoadable, IFluidRouter, IProvideFluidHandle {
279
+ /**
280
+ * This is your FluidDataStoreRuntime object
281
+ */
282
+ protected readonly runtime: IFluidDataStoreRuntime;
283
+ /**
284
+ * This context is used to talk up to the ContainerRuntime
285
+ */
286
+ protected readonly context: IFluidDataStoreContext;
287
+ /**
288
+ * Providers are FluidObject keyed objects that provide back
289
+ * a promise to the corresponding FluidObject or undefined.
290
+ * Providers injected/provided by the Container and/or HostingApplication
291
+ *
292
+ * To define providers set FluidObject interfaces in the OptionalProviders generic type for your data store
293
+ */
294
+ protected readonly providers: AsyncFluidObjectProvider<I["OptionalProviders"]>;
295
+ protected initProps?: I["InitialState"];
296
+ protected initializeP: Promise<void> | undefined;
297
+ get id(): string;
298
+ /**
299
+ * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
300
+ */
301
+ get IFluidRouter(): this;
302
+ get IFluidLoadable(): this;
303
+ get IFluidHandle(): IFluidHandle<this>;
304
+ /**
305
+ * Handle to a data store
306
+ */
307
+ get handle(): IFluidHandle<this>;
308
+ static getDataObject(runtime: IFluidDataStoreRuntime): Promise<PureDataObject<DataObjectTypes>>;
309
+ constructor(props: IDataObjectProps<I>);
310
+ /**
311
+ * Return this object if someone requests it directly
312
+ * We will return this object in two scenarios:
313
+ *
314
+ * 1. the request url is a "/"
315
+ *
316
+ * 2. the request url is empty
317
+ */
318
+ request(req: IRequest): Promise<IResponse>;
319
+ /**
320
+ * Call this API to ensure PureDataObject is fully initialized.
321
+ * Initialization happens on demand, only on as-needed bases.
322
+ * In most cases you should allow factory/object to decide when to finish initialization.
323
+ * But if you are supplying your own implementation of DataStoreRuntime factory and overriding some methods
324
+ * and need a fully initialized object, then you can call this API to ensure object is fully initialized.
325
+ */
326
+ finishInitialization(existing: boolean): Promise<void>;
327
+ /**
328
+ * Internal initialize implementation. Overwriting this will change the flow of the PureDataObject and should
329
+ * generally not be done.
330
+ *
331
+ * Calls initializingFirstTime, initializingFromExisting, and hasInitialized. Caller is
332
+ * responsible for ensuring this is only invoked once.
333
+ */
334
+ initializeInternal(existing: boolean): Promise<void>;
335
+ /**
336
+ * Called every time the data store is initialized, before initializingFirstTime or
337
+ * initializingFromExisting is called.
338
+ */
339
+ protected preInitialize(): Promise<void>;
340
+ /**
341
+ * Called the first time the data store is initialized (new creations with a new
342
+ * data store runtime)
343
+ *
344
+ * @param props - Optional props to be passed in on create
345
+ */
346
+ protected initializingFirstTime(props?: I["InitialState"]): Promise<void>;
347
+ /**
348
+ * Called every time but the first time the data store is initialized (creations
349
+ * with an existing data store runtime)
350
+ */
351
+ protected initializingFromExisting(): Promise<void>;
352
+ /**
353
+ * Called every time the data store is initialized after create or existing.
354
+ */
355
+ protected hasInitialized(): Promise<void>;
356
+ }
357
+
358
+ /**
359
+ * PureDataObjectFactory is a barebones IFluidDataStoreFactory for use with PureDataObject.
360
+ * Consumers should typically use DataObjectFactory instead unless creating
361
+ * another base data store factory.
362
+ *
363
+ * @typeParam TObj - DataObject (concrete type)
364
+ * @typeParam I - The input types for the DataObject
365
+ */
366
+ export declare class PureDataObjectFactory<TObj extends PureDataObject<I>, I extends DataObjectTypes = DataObjectTypes> implements IFluidDataStoreFactory, Partial<IProvideFluidDataStoreRegistry>, IRootDataObjectFactory {
367
+ readonly type: string;
368
+ private readonly ctor;
369
+ private readonly optionalProviders;
370
+ private readonly runtimeClass;
371
+ private readonly sharedObjectRegistry;
372
+ private readonly registry;
373
+ constructor(type: string, ctor: new (props: IDataObjectProps<I>) => TObj, sharedObjects: readonly IChannelFactory[], optionalProviders: FluidObjectSymbolProvider<I["OptionalProviders"]>, registryEntries?: NamedFluidDataStoreRegistryEntries, runtimeClass?: typeof FluidDataStoreRuntime);
374
+ get IFluidDataStoreFactory(): this;
375
+ get IFluidDataStoreRegistry(): IFluidDataStoreRegistry | undefined;
376
+ /**
377
+ * Convenience helper to get the data store's/factory's data store registry entry.
378
+ * The return type hides the factory's generics, easing grouping of registry
379
+ * entries that differ only in this way into the same array.
380
+ * @returns The NamedFluidDataStoreRegistryEntry
381
+ */
382
+ get registryEntry(): NamedFluidDataStoreRegistryEntry;
383
+ /**
384
+ * This is where we do data store setup.
385
+ *
386
+ * @param context - data store context used to load a data store runtime
387
+ */
388
+ instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
389
+ /**
390
+ * Creates a new instance of the object. Uses parent context's registry to build package path to this factory.
391
+ * In other words, registry of context passed in has to contain this factory, with the name that matches
392
+ * this factory's type.
393
+ * It is intended to be used by data store objects that create sub-objects.
394
+ * @param context - The context being used to create the runtime
395
+ * (the created object will have its own new context created as well)
396
+ * @param initialState - The initial state to provide to the created data store.
397
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
398
+ * They get attached only when a handle to one of them is attached to already attached objects.
399
+ */
400
+ createChildInstance(parentContext: IFluidDataStoreContext, initialState?: I["InitialState"]): Promise<TObj>;
401
+ /**
402
+ * Creates a new instance of the object. Uses peer context's registry and its package path to identify this factory.
403
+ * In other words, registry of context passed in has to have this factory.
404
+ * Intended to be used by data store objects that need to create peers (similar) instances of existing objects.
405
+ * @param context - The component context being used to create the object
406
+ * (the created object will have its own new context created as well)
407
+ * @param initialState - The initial state to provide to the created component.
408
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
409
+ * They get attached only when a handle to one of them is attached to already attached objects.
410
+ */
411
+ createPeerInstance(peerContext: IFluidDataStoreContext, initialState?: I["InitialState"]): Promise<TObj>;
412
+ /**
413
+ * Creates a new instance of the object. Uses container's registry to find this factory.
414
+ * It's expected that only container owners would use this functionality, as only such developers
415
+ * have knowledge of entries in container registry.
416
+ * The name in this registry for such record should match type of this factory.
417
+ * @param runtime - container runtime. It's registry is used to create an object.
418
+ * @param initialState - The initial state to provide to the created component.
419
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
420
+ * They get attached only when a handle to one of them is attached to already attached objects.
421
+ */
422
+ createInstance(runtime: IContainerRuntimeBase, initialState?: I["InitialState"]): Promise<TObj>;
423
+ /**
424
+ * Creates a new root instance of the object. Uses container's registry to find this factory.
425
+ * It's expected that only container owners would use this functionality, as only such developers
426
+ * have knowledge of entries in container registry.
427
+ * The name in this registry for such record should match type of this factory.
428
+ * @param runtime - container runtime. It's registry is used to create an object.
429
+ * @param initialState - The initial state to provide to the created component.
430
+ * @returns an object created by this factory. Data store and objects created are not attached to container.
431
+ * They get attached only when a handle to one of them is attached to already attached objects.
432
+ */
433
+ createRootInstance(rootDataStoreId: string, runtime: IContainerRuntime, initialState?: I["InitialState"]): Promise<TObj>;
434
+ protected createNonRootInstanceCore(containerRuntime: IContainerRuntimeBase, packagePath: Readonly<string[]>, initialState?: I["InitialState"]): Promise<TObj>;
435
+ protected createInstanceCore(context: IFluidDataStoreContextDetached, initialState?: I["InitialState"]): Promise<TObj>;
436
+ }
437
+
438
+ export { }
@@ -16,22 +16,29 @@ import { FluidObject } from "@fluidframework/core-interfaces";
16
16
  * It can be subclassed to implement a first-time initialization procedure for the containers it creates.
17
17
  */
18
18
  export declare class BaseContainerRuntimeFactory extends RuntimeFactoryHelper implements IProvideFluidDataStoreRegistry {
19
+ get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
20
+ private readonly registry;
19
21
  private readonly registryEntries;
20
22
  private readonly dependencyContainer?;
21
- private readonly requestHandlers;
22
23
  private readonly runtimeOptions?;
23
- private readonly initializeEntryPoint?;
24
- get IFluidDataStoreRegistry(): IFluidDataStoreRegistry;
25
- private readonly registry;
24
+ private readonly requestHandlers;
25
+ private readonly provideEntryPoint;
26
26
  /**
27
27
  * @param registryEntries - The data store registry for containers produced
28
28
  * @param dependencyContainer - deprecated, will be removed in a future release
29
29
  * @param requestHandlers - Request handlers for containers produced
30
30
  * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it
31
- * @param initializeEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances
31
+ * @param provideEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances
32
32
  * created with this factory
33
33
  */
34
- constructor(registryEntries: NamedFluidDataStoreRegistryEntries, dependencyContainer?: IFluidDependencySynthesizer | undefined, requestHandlers?: RuntimeRequestHandler[], runtimeOptions?: IContainerRuntimeOptions | undefined, initializeEntryPoint?: ((runtime: IContainerRuntime) => Promise<FluidObject>) | undefined);
34
+ constructor(props: {
35
+ registryEntries: NamedFluidDataStoreRegistryEntries;
36
+ dependencyContainer?: IFluidDependencySynthesizer;
37
+ /** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
38
+ requestHandlers?: RuntimeRequestHandler[];
39
+ runtimeOptions?: IContainerRuntimeOptions;
40
+ provideEntryPoint: (runtime: IContainerRuntime) => Promise<FluidObject>;
41
+ });
35
42
  instantiateFirstTime(runtime: ContainerRuntime): Promise<void>;
36
43
  instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
37
44
  preInitialize(context: IContainerContext, existing: boolean): Promise<ContainerRuntime>;
@@ -1 +1 @@
1
- {"version":3,"file":"baseContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EACN,wBAAwB,EAExB,gBAAgB,EAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EACN,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEN,2BAA2B,EAE3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;;GAIG;AACH,qBAAa,2BACZ,SAAQ,oBACR,YAAW,8BAA8B;IAgBxC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACrC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IAlBvC,IAAW,uBAAuB,4BAEjC;IACD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IAEnD;;;;;;;OAOG;gBAEe,eAAe,EAAE,kCAAkC,EACnD,mBAAmB,CAAC,yCAA6B,EACjD,eAAe,GAAE,qBAAqB,EAAO,EAC7C,cAAc,CAAC,sCAA0B,EACzC,oBAAoB,CAAC,aAC5B,iBAAiB,KACtB,QAAQ,WAAW,CAAC,aAAA;IAMb,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE,aAAa,CACzB,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,gBAAgB,CAAC;IAqB5B;;;;OAIG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB;IAEzE;;;;OAIG;cACa,uBAAuB,CAAC,OAAO,EAAE,iBAAiB;CAClE"}
1
+ {"version":3,"file":"baseContainerRuntimeFactory.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EACN,wBAAwB,EAExB,gBAAgB,EAChB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,qBAAqB,EAA8B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EACN,uBAAuB,EACvB,8BAA8B,EAC9B,kCAAkC,EAClC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEN,2BAA2B,EAE3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;;GAIG;AACH,qBAAa,2BACZ,SAAQ,oBACR,YAAW,8BAA8B;IAEzC,IAAW,uBAAuB,4BAEjC;IACD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IAEnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqC;IACrE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAA8B;IACnE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAA2B;IAC3D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0B;IAC1D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuD;IAEzF;;;;;;;OAOG;gBACS,KAAK,EAAE;QAClB,eAAe,EAAE,kCAAkC,CAAC;QACpD,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;QAClD,4JAA4J;QAC5J,eAAe,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC1C,cAAc,CAAC,EAAE,wBAAwB,CAAC;QAC1C,iBAAiB,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;KACxE;IAWY,oBAAoB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE,aAAa,CACzB,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,gBAAgB,CAAC;IAsB5B;;;;OAIG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB;IAEzE;;;;OAIG;cACa,uBAAuB,CAAC,OAAO,EAAE,iBAAiB;CAClE"}
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.BaseContainerRuntimeFactory = void 0;
8
8
  const container_runtime_1 = require("@fluidframework/container-runtime");
9
+ // eslint-disable-next-line import/no-deprecated
9
10
  const request_handler_1 = require("@fluidframework/request-handler");
10
11
  const synthesize_1 = require("@fluidframework/synthesize");
11
12
  const runtime_utils_1 = require("@fluidframework/runtime-utils");
@@ -15,25 +16,25 @@ const runtime_utils_1 = require("@fluidframework/runtime-utils");
15
16
  * It can be subclassed to implement a first-time initialization procedure for the containers it creates.
16
17
  */
17
18
  class BaseContainerRuntimeFactory extends runtime_utils_1.RuntimeFactoryHelper {
19
+ get IFluidDataStoreRegistry() {
20
+ return this.registry;
21
+ }
18
22
  /**
19
23
  * @param registryEntries - The data store registry for containers produced
20
24
  * @param dependencyContainer - deprecated, will be removed in a future release
21
25
  * @param requestHandlers - Request handlers for containers produced
22
26
  * @param runtimeOptions - The runtime options passed to the ContainerRuntime when instantiating it
23
- * @param initializeEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances
27
+ * @param provideEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances
24
28
  * created with this factory
25
29
  */
26
- constructor(registryEntries, dependencyContainer, requestHandlers = [], runtimeOptions, initializeEntryPoint) {
30
+ constructor(props) {
27
31
  super();
28
- this.registryEntries = registryEntries;
29
- this.dependencyContainer = dependencyContainer;
30
- this.requestHandlers = requestHandlers;
31
- this.runtimeOptions = runtimeOptions;
32
- this.initializeEntryPoint = initializeEntryPoint;
33
- this.registry = new container_runtime_1.FluidDataStoreRegistry(registryEntries);
34
- }
35
- get IFluidDataStoreRegistry() {
36
- return this.registry;
32
+ this.registryEntries = props.registryEntries;
33
+ this.dependencyContainer = props.dependencyContainer;
34
+ this.runtimeOptions = props.runtimeOptions;
35
+ this.provideEntryPoint = props.provideEntryPoint;
36
+ this.requestHandlers = props.requestHandlers ?? [];
37
+ this.registry = new container_runtime_1.FluidDataStoreRegistry(this.registryEntries);
37
38
  }
38
39
  async instantiateFirstTime(runtime) {
39
40
  await this.containerInitializingFirstTime(runtime);
@@ -54,8 +55,9 @@ class BaseContainerRuntimeFactory extends runtime_utils_1.RuntimeFactoryHelper {
54
55
  runtimeOptions: this.runtimeOptions,
55
56
  registryEntries: this.registryEntries,
56
57
  containerScope: scope,
58
+ // eslint-disable-next-line import/no-deprecated
57
59
  requestHandler: (0, request_handler_1.buildRuntimeRequestHandler)(...this.requestHandlers),
58
- initializeEntryPoint: this.initializeEntryPoint,
60
+ provideEntryPoint: this.provideEntryPoint,
59
61
  });
60
62
  }
61
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"baseContainerRuntimeFactory.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAI2C;AAE3C,qEAAoG;AAMpG,2DAIoC;AACpC,iEAAqE;AAGrE;;;;GAIG;AACH,MAAa,2BACZ,SAAQ,oCAAoB;IAQ5B;;;;;;;OAOG;IACH,YACkB,eAAmD,EACnD,mBAAiD,EACjD,kBAA2C,EAAE,EAC7C,cAAyC,EACzC,oBAEQ;QAEzB,KAAK,EAAE,CAAC;QARS,oBAAe,GAAf,eAAe,CAAoC;QACnD,wBAAmB,GAAnB,mBAAmB,CAA8B;QACjD,oBAAe,GAAf,eAAe,CAA8B;QAC7C,mBAAc,GAAd,cAAc,CAA2B;QACzC,yBAAoB,GAApB,oBAAoB,CAEZ;QAGzB,IAAI,CAAC,QAAQ,GAAG,IAAI,0CAAsB,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC;IAxBD,IAAW,uBAAuB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAwBM,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,cAAc,EAAE,IAAA,4CAA0B,EAAC,GAAG,IAAI,CAAC,eAAe,CAAC;YACnE,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;SAC/C,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;AA5ED,kEA4EC","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\";\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 */\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\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 initializeEntryPoint - Function that will initialize the entryPoint of the ContainerRuntime instances\n\t * created with this factory\n\t */\n\tconstructor(\n\t\tprivate readonly registryEntries: NamedFluidDataStoreRegistryEntries,\n\t\tprivate readonly dependencyContainer?: IFluidDependencySynthesizer,\n\t\tprivate readonly requestHandlers: RuntimeRequestHandler[] = [],\n\t\tprivate readonly runtimeOptions?: IContainerRuntimeOptions,\n\t\tprivate readonly initializeEntryPoint?: (\n\t\t\truntime: IContainerRuntime,\n\t\t) => Promise<FluidObject>,\n\t) {\n\t\tsuper();\n\t\tthis.registry = new FluidDataStoreRegistry(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\trequestHandler: buildRuntimeRequestHandler(...this.requestHandlers),\n\t\t\tinitializeEntryPoint: this.initializeEntryPoint,\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.js","sourceRoot":"","sources":["../../src/container-runtime-factories/baseContainerRuntimeFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yEAI2C;AAE3C,gDAAgD;AAChD,qEAAoG;AAMpG,2DAIoC;AACpC,iEAAqE;AAGrE;;;;GAIG;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 */\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"]}
@@ -16,8 +16,8 @@ import { BaseContainerRuntimeFactory } from "./baseContainerRuntimeFactory";
16
16
  * This factory should be exposed as fluidExport off the entry point to your module.
17
17
  */
18
18
  export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseContainerRuntimeFactory {
19
- protected readonly defaultFactory: IFluidDataStoreFactory;
20
19
  static readonly defaultDataStoreId = "default";
20
+ protected readonly defaultFactory: IFluidDataStoreFactory;
21
21
  /**
22
22
  * Constructor
23
23
  * @param defaultFactory -
@@ -25,9 +25,17 @@ export declare class ContainerRuntimeFactoryWithDefaultDataStore extends BaseCon
25
25
  * @param dependencyContainer - deprecated, will be removed in a future release
26
26
  * @param requestHandlers -
27
27
  * @param runtimeOptions -
28
- * @param initializeEntryPoint -
28
+ * @param provideEntryPoint -
29
29
  */
30
- constructor(defaultFactory: IFluidDataStoreFactory, registryEntries: NamedFluidDataStoreRegistryEntries, dependencyContainer?: IFluidDependencySynthesizer, requestHandlers?: RuntimeRequestHandler[], runtimeOptions?: IContainerRuntimeOptions, initializeEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>);
30
+ constructor(props: {
31
+ defaultFactory: IFluidDataStoreFactory;
32
+ registryEntries: NamedFluidDataStoreRegistryEntries;
33
+ dependencyContainer?: IFluidDependencySynthesizer;
34
+ /** @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
35
+ requestHandlers?: RuntimeRequestHandler[];
36
+ runtimeOptions?: IContainerRuntimeOptions;
37
+ provideEntryPoint?: (runtime: IContainerRuntime) => Promise<FluidObject>;
38
+ });
31
39
  /**
32
40
  * {@inheritDoc BaseContainerRuntimeFactory.containerInitializingFirstTime}
33
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"containerRuntimeFactoryWithDefaultDataStore.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACN,sBAAsB,EACtB,kCAAkC,EAClC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAI5E;;;;;GAKG;AACH,qBAAa,2CAA4C,SAAQ,2BAA2B;IAa1F,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,sBAAsB;IAZ1D,gBAAuB,kBAAkB,aAAsB;IAE/D;;;;;;;;OAQG;gBAEiB,cAAc,EAAE,sBAAsB,EACzD,eAAe,EAAE,kCAAkC,EACnD,mBAAmB,CAAC,EAAE,2BAA2B,EACjD,eAAe,GAAE,qBAAqB,EAAO,EAC7C,cAAc,CAAC,EAAE,wBAAwB,EACzC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,WAAW,CAAC;IAW5E;;OAEG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB;CAIzE"}
1
+ {"version":3,"file":"containerRuntimeFactoryWithDefaultDataStore.d.ts","sourceRoot":"","sources":["../../src/container-runtime-factories/containerRuntimeFactoryWithDefaultDataStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EACN,sBAAsB,EACtB,kCAAkC,EAClC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAY5E;;;;;GAKG;AACH,qBAAa,2CAA4C,SAAQ,2BAA2B;IAC3F,gBAAuB,kBAAkB,aAAsB;IAE/D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,sBAAsB,CAAC;IAE1D;;;;;;;;OAQG;gBACS,KAAK,EAAE;QAClB,cAAc,EAAE,sBAAsB,CAAC;QACvC,eAAe,EAAE,kCAAkC,CAAC;QACpD,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;QAClD,4JAA4J;QAC5J,eAAe,CAAC,EAAE,qBAAqB,EAAE,CAAC;QAC1C,cAAc,CAAC,EAAE,wBAAwB,CAAC;QAC1C,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;KACzE;IAcD;;OAEG;cACa,8BAA8B,CAAC,OAAO,EAAE,iBAAiB;CAIzE"}