@fluidframework/test-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +3 -3
  3. package/api-extractor-lint.json +13 -0
  4. package/api-extractor.json +3 -3
  5. package/api-report/test-utils.api.md +84 -77
  6. package/dist/DriverWrappers.d.ts +3 -0
  7. package/dist/DriverWrappers.d.ts.map +1 -1
  8. package/dist/DriverWrappers.js +3 -0
  9. package/dist/DriverWrappers.js.map +1 -1
  10. package/dist/TestConfigs.d.ts +4 -1
  11. package/dist/TestConfigs.d.ts.map +1 -1
  12. package/dist/TestConfigs.js +3 -0
  13. package/dist/TestConfigs.js.map +1 -1
  14. package/dist/TestSummaryUtils.d.ts +4 -2
  15. package/dist/TestSummaryUtils.d.ts.map +1 -1
  16. package/dist/TestSummaryUtils.js +3 -2
  17. package/dist/TestSummaryUtils.js.map +1 -1
  18. package/dist/containerUtils.d.ts +17 -0
  19. package/dist/containerUtils.d.ts.map +1 -1
  20. package/dist/containerUtils.js +41 -1
  21. package/dist/containerUtils.js.map +1 -1
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/interfaces.d.ts +6 -0
  27. package/dist/interfaces.d.ts.map +1 -1
  28. package/dist/interfaces.js.map +1 -1
  29. package/dist/loaderContainerTracker.d.ts +3 -0
  30. package/dist/loaderContainerTracker.d.ts.map +1 -1
  31. package/dist/loaderContainerTracker.js +3 -0
  32. package/dist/loaderContainerTracker.js.map +1 -1
  33. package/dist/localCodeLoader.d.ts +7 -0
  34. package/dist/localCodeLoader.d.ts.map +1 -1
  35. package/dist/localCodeLoader.js +1 -2
  36. package/dist/localCodeLoader.js.map +1 -1
  37. package/dist/localLoader.d.ts +2 -0
  38. package/dist/localLoader.d.ts.map +1 -1
  39. package/dist/localLoader.js +2 -0
  40. package/dist/localLoader.js.map +1 -1
  41. package/dist/packageVersion.d.ts +1 -1
  42. package/dist/packageVersion.js +1 -1
  43. package/dist/packageVersion.js.map +1 -1
  44. package/dist/retry.d.ts +1 -0
  45. package/dist/retry.d.ts.map +1 -1
  46. package/dist/retry.js +1 -0
  47. package/dist/retry.js.map +1 -1
  48. package/dist/test-utils-alpha.d.ts +140 -0
  49. package/dist/test-utils-beta.d.ts +228 -0
  50. package/dist/test-utils-public.d.ts +228 -0
  51. package/dist/test-utils-untrimmed.d.ts +986 -0
  52. package/dist/testContainerRuntimeFactory.d.ts +2 -0
  53. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  54. package/dist/testContainerRuntimeFactory.js +49 -12
  55. package/dist/testContainerRuntimeFactory.js.map +1 -1
  56. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +1 -0
  57. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  58. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +10 -2
  59. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  60. package/dist/testFluidObject.d.ts +5 -7
  61. package/dist/testFluidObject.d.ts.map +1 -1
  62. package/dist/testFluidObject.js +10 -16
  63. package/dist/testFluidObject.js.map +1 -1
  64. package/dist/testObjectProvider.d.ts +287 -37
  65. package/dist/testObjectProvider.d.ts.map +1 -1
  66. package/dist/testObjectProvider.js +310 -25
  67. package/dist/testObjectProvider.js.map +1 -1
  68. package/dist/timeoutUtils.d.ts +11 -0
  69. package/dist/timeoutUtils.d.ts.map +1 -1
  70. package/dist/timeoutUtils.js +5 -0
  71. package/dist/timeoutUtils.js.map +1 -1
  72. package/lib/test-utils-alpha.d.ts +140 -0
  73. package/lib/test-utils-beta.d.ts +228 -0
  74. package/lib/test-utils-public.d.ts +228 -0
  75. package/lib/test-utils-untrimmed.d.ts +986 -0
  76. package/package.json +59 -28
  77. package/src/DriverWrappers.ts +3 -0
  78. package/src/TestConfigs.ts +4 -1
  79. package/src/TestSummaryUtils.ts +9 -6
  80. package/src/containerUtils.ts +42 -0
  81. package/src/index.ts +7 -1
  82. package/src/interfaces.ts +6 -0
  83. package/src/loaderContainerTracker.ts +3 -0
  84. package/src/localCodeLoader.ts +7 -7
  85. package/src/localLoader.ts +2 -0
  86. package/src/packageVersion.ts +1 -1
  87. package/src/retry.ts +1 -0
  88. package/src/testContainerRuntimeFactory.ts +98 -15
  89. package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +11 -0
  90. package/src/testFluidObject.ts +14 -24
  91. package/src/testObjectProvider.ts +524 -47
  92. package/src/timeoutUtils.ts +11 -0
@@ -0,0 +1,986 @@
1
+ import { ConfigTypes } from '@fluidframework/core-interfaces';
2
+ import { ContainerRuntime } from '@fluidframework/container-runtime';
3
+ import { ContainerRuntimeFactoryWithDefaultDataStore } from '@fluidframework/aqueduct';
4
+ import { FluidDataStoreRuntime } from '@fluidframework/datastore';
5
+ import { FluidObject } from '@fluidframework/core-interfaces';
6
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
7
+ import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
8
+ import { IConfigProviderBase } from '@fluidframework/core-interfaces';
9
+ import { IContainer } from '@fluidframework/container-definitions';
10
+ import { IContainerContext } from '@fluidframework/container-definitions';
11
+ import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
12
+ import { IContainerRuntimeOptions } from '@fluidframework/container-runtime';
13
+ import { IDataStore } from '@fluidframework/runtime-definitions';
14
+ import { IDocumentService } from '@fluidframework/driver-definitions';
15
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
16
+ import { IDocumentStorageService } from '@fluidframework/driver-definitions';
17
+ import { IFluidCodeDetails } from '@fluidframework/container-definitions';
18
+ import { IFluidDataStoreChannel } from '@fluidframework/runtime-definitions';
19
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
20
+ import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
21
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
22
+ import { IFluidHandle } from '@fluidframework/core-interfaces';
23
+ import { IFluidLoadable } from '@fluidframework/core-interfaces';
24
+ import { IFluidModule } from '@fluidframework/container-definitions';
25
+ import { IFluidModuleWithDetails } from '@fluidframework/container-definitions';
26
+ import { IHostLoader } from '@fluidframework/container-definitions';
27
+ import { ILoaderOptions } from '@fluidframework/container-definitions';
28
+ import { ILoaderProps } from '@fluidframework/container-loader';
29
+ import { IOnDemandSummarizeOptions } from '@fluidframework/container-runtime';
30
+ import { IProvideFluidCodeDetailsComparer } from '@fluidframework/container-definitions';
31
+ import { IProvideFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
32
+ import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
33
+ import { IProvideRuntimeFactory } from '@fluidframework/container-definitions';
34
+ import { IRequest } from '@fluidframework/core-interfaces';
35
+ import { IRequestHeader } from '@fluidframework/core-interfaces';
36
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
37
+ import { IResponse } from '@fluidframework/core-interfaces';
38
+ import { IRuntime } from '@fluidframework/container-definitions';
39
+ import { ISharedMap } from '@fluidframework/map';
40
+ import { ISummarizer } from '@fluidframework/container-runtime';
41
+ import { ISummaryContext } from '@fluidframework/driver-definitions';
42
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
43
+ import { ITelemetryBaseEvent } from '@fluidframework/core-interfaces';
44
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
45
+ import { ITelemetryGenericEvent } from '@fluidframework/core-interfaces';
46
+ import { ITestDriver } from '@fluidframework/test-driver-definitions';
47
+ import { IUrlResolver } from '@fluidframework/driver-definitions';
48
+ import { Loader } from '@fluidframework/container-loader';
49
+ import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions';
50
+ import { RuntimeRequestHandler } from '@fluidframework/request-handler';
51
+
52
+ /**
53
+ * @internal
54
+ */
55
+ export declare type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;
56
+
57
+ /**
58
+ * Creates a detached Container and attaches it.
59
+ * @param source - The code details used to create the Container.
60
+ * @param loader - The loader to use to initialize the container.
61
+ * @param attachRequest - The request to create new from.
62
+ * @internal
63
+ */
64
+ export declare function createAndAttachContainer(source: IFluidCodeDetails, loader: IHostLoader, attachRequest: IRequest): Promise<IContainer>;
65
+
66
+ /**
67
+ * ! Note: This function is purely needed for back-compat as the constructor argument structure was changed
68
+ * @internal
69
+ */
70
+ export declare const createContainerRuntimeFactoryWithDefaultDataStore: (Base: typeof ContainerRuntimeFactoryWithDefaultDataStore | undefined, ctorArgs: {
71
+ defaultFactory: IFluidDataStoreFactory;
72
+ registryEntries: NamedFluidDataStoreRegistryEntries;
73
+ dependencyContainer?: any;
74
+ requestHandlers?: RuntimeRequestHandler[] | undefined;
75
+ runtimeOptions?: IContainerRuntimeOptions | undefined;
76
+ provideEntryPoint?: ((runtime: IContainerRuntime) => Promise<FluidObject>) | undefined;
77
+ }) => ContainerRuntimeFactoryWithDefaultDataStore;
78
+
79
+ /**
80
+ * @internal
81
+ */
82
+ export declare const createDocumentId: () => string;
83
+
84
+ /**
85
+ * Creates a loader with the given package entries and driver.
86
+ * @param packageEntries - A list of code details to Fluid entry points.
87
+ * @param documentServiceFactory - the driver factory to use
88
+ * @param urlResolver - the url resolver to use
89
+ * @param options - loader options
90
+ * @internal
91
+ */
92
+ export declare function createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, documentServiceFactory: IDocumentServiceFactory, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger, options?: ILoaderOptions): IHostLoader;
93
+
94
+ /**
95
+ * Creates a summarizer client from the given container and returns the summarizer client's IContainer and ISummarizer.
96
+ * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
97
+ *
98
+ * Can pass in a test config provider to enable/disable features.
99
+ * @internal
100
+ */
101
+ export declare function createSummarizer(provider: ITestObjectProvider, container: IContainer, config?: ITestContainerConfig, summaryVersion?: string, logger?: ITelemetryBaseLogger): Promise<{
102
+ container: IContainer;
103
+ summarizer: ISummarizer;
104
+ }>;
105
+
106
+ /**
107
+ * Creates a summarizer client from the given container and data store factory, and returns the summarizer client's
108
+ * IContainer and ISummarizer.
109
+ * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
110
+ * @internal
111
+ */
112
+ export declare function createSummarizerFromFactory(provider: ITestObjectProvider, container: IContainer, dataStoreFactory: IFluidDataStoreFactory, summaryVersion?: string, containerRuntimeFactoryType?: typeof ContainerRuntimeFactoryWithDefaultDataStore, registryEntries?: NamedFluidDataStoreRegistryEntries, logger?: ITelemetryBaseLogger, configProvider?: IConfigProviderBase): Promise<{
113
+ container: IContainer;
114
+ summarizer: ISummarizer;
115
+ }>;
116
+
117
+ /**
118
+ * Create a container runtime factory class that allows you to set runtime options
119
+ * @internal
120
+ */
121
+ export declare const createTestContainerRuntimeFactory: (containerRuntimeCtor: typeof ContainerRuntime) => {
122
+ new (type: string, dataStoreFactory: IFluidDataStoreFactory, runtimeOptions?: IContainerRuntimeOptions, requestHandlers?: RuntimeRequestHandler[]): {
123
+ type: string;
124
+ dataStoreFactory: IFluidDataStoreFactory;
125
+ runtimeOptions: IContainerRuntimeOptions;
126
+ requestHandlers: RuntimeRequestHandler[];
127
+ instantiateFirstTime(runtime: ContainerRuntime): Promise<void>;
128
+ instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
129
+ preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & IContainerRuntime>;
130
+ readonly IRuntimeFactory: any;
131
+ instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
132
+ hasInitialized(_runtime: IContainerRuntime): Promise<void>;
133
+ };
134
+ };
135
+
136
+ /**
137
+ * @internal
138
+ */
139
+ export declare enum DataObjectFactoryType {
140
+ Primed = 0,
141
+ Test = 1
142
+ }
143
+
144
+ /**
145
+ * @internal
146
+ */
147
+ export declare const defaultTimeoutDurationMs = 250;
148
+
149
+ /**
150
+ * This class tracks events. It allows specifying expected events, which will be looked for in order.
151
+ * It also tracks all unexpected errors.
152
+ * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
153
+ * any expected events that have not occurred.
154
+ * @internal
155
+ */
156
+ export declare class EventAndErrorTrackingLogger implements ITelemetryBaseLogger {
157
+ private readonly baseLogger;
158
+ /**
159
+ * Even if these error events are logged, tests should still be allowed to pass
160
+ * Additionally, if downgrade is true, then log as generic (e.g. to avoid polluting the e2e test logs)
161
+ */
162
+ private readonly allowedErrors;
163
+ constructor(baseLogger: ITelemetryBaseLogger);
164
+ private readonly expectedEvents;
165
+ private readonly unexpectedErrors;
166
+ registerExpectedEvent(...orderedExpectedEvents: ITelemetryGenericEvent[]): void;
167
+ send(event: ITelemetryBaseEvent): void;
168
+ reportAndClearTrackedEvents(): {
169
+ expectedNotFound: ({
170
+ index: number;
171
+ event: ITelemetryGenericEvent | undefined;
172
+ } | undefined)[];
173
+ unexpectedErrors: ITelemetryBaseEvent[];
174
+ };
175
+ }
176
+
177
+ /**
178
+ * @internal
179
+ */
180
+ export declare type fluidEntryPoint = SupportedExportInterfaces | IFluidModule;
181
+
182
+ /**
183
+ * This function should ONLY be used for back compat purposes
184
+ * LTS versions of the Loader/Container will not have the "getEntryPoint" method, so we need to fallback to "request"
185
+ * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0
186
+ * @internal
187
+ */
188
+ export declare function getContainerEntryPointBackCompat<T>(container: IContainer): Promise<T>;
189
+
190
+ /**
191
+ * This function should ONLY be used for back compat purposes
192
+ * Older supported versions of IDataStore do not have the "entryPoint" property, so we need to fallback to "request"
193
+ * This function can be removed once back-compat support for IDataStore moves to 2.0.0-internal.7.0.0
194
+ *
195
+ * @internal
196
+ */
197
+ export declare function getDataStoreEntryPointBackCompat<T>(dataStore: IDataStore): Promise<T>;
198
+
199
+ /**
200
+ * @internal
201
+ */
202
+ export declare function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string): Error | undefined;
203
+
204
+ /**
205
+ * Used to retrieve, update, and reset document id based on the type of driver being used.
206
+ *
207
+ * @internal
208
+ */
209
+ export declare interface IDocumentIdStrategy {
210
+ /**
211
+ * Get document id
212
+ */
213
+ get(): string;
214
+ /**
215
+ * Update the document ID from the resolved container's URL and reset the ID property
216
+ */
217
+ update(resolvedUrl?: IResolvedUrl): void;
218
+ /**
219
+ * Reset document id to a new document id
220
+ */
221
+ reset(): void;
222
+ }
223
+
224
+ /**
225
+ * @internal
226
+ */
227
+ export declare interface IOpProcessingController {
228
+ processIncoming(...containers: IContainer[]): Promise<void>;
229
+ processOutgoing(...containers: IContainer[]): Promise<void>;
230
+ pauseProcessing(...containers: IContainer[]): Promise<void>;
231
+ resumeProcessing(...containers: IContainer[]): void;
232
+ }
233
+
234
+ /**
235
+ * @internal
236
+ */
237
+ export declare interface IProvideTestFluidObject {
238
+ readonly ITestFluidObject: ITestFluidObject;
239
+ }
240
+
241
+ /**
242
+ * @internal
243
+ */
244
+ export declare interface ITestContainerConfig {
245
+ /** TestFluidDataObject instead of PrimedDataStore */
246
+ fluidDataObjectType?: DataObjectFactoryType;
247
+ /** An array of channel name and DDS factory pair to create on container creation time */
248
+ registry?: ChannelFactoryRegistry;
249
+ /** Container runtime options for the container instance */
250
+ runtimeOptions?: IContainerRuntimeOptions;
251
+ /** Whether this runtime should be instantiated using a mixed-in attributor class */
252
+ enableAttribution?: boolean;
253
+ /** Loader options for the loader used to create containers */
254
+ loaderProps?: Partial<ILoaderProps>;
255
+ }
256
+
257
+ /**
258
+ * @internal
259
+ */
260
+ export declare interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {
261
+ root: ISharedMap;
262
+ readonly runtime: IFluidDataStoreRuntime;
263
+ readonly channel: IFluidDataStoreChannel;
264
+ readonly context: IFluidDataStoreContext;
265
+ getSharedObject<T = any>(id: string): Promise<T>;
266
+ }
267
+
268
+ /**
269
+ * @internal
270
+ */
271
+ export declare interface ITestObjectProvider {
272
+ /**
273
+ * Indicates which type of test object provider is being used.
274
+ */
275
+ type: "TestObjectProvider" | "TestObjectProviderWithVersionedLoad";
276
+ /**
277
+ * The document id to retrieve or create containers
278
+ */
279
+ documentId: string;
280
+ /**
281
+ * Creates the document service after extracting different endpoints URLs from a resolved URL.
282
+ */
283
+ documentServiceFactory: IDocumentServiceFactory;
284
+ /**
285
+ * Test driver used to create the IDocumentServiceFactory. Varies depending on the test type.
286
+ */
287
+ driver: ITestDriver;
288
+ /**
289
+ * Logger used to track expected and unexpected events.
290
+ */
291
+ logger: EventAndErrorTrackingLogger | undefined;
292
+ /**
293
+ * Used to create a url for the created container with any data store path given in the relative url.
294
+ */
295
+ urlResolver: IUrlResolver;
296
+ /**
297
+ * Default IFluidCodeDetails used to create containers.
298
+ */
299
+ defaultCodeDetails: IFluidCodeDetails;
300
+ /**
301
+ * Contains functions to pause/resume op processing.
302
+ */
303
+ opProcessingController: IOpProcessingController;
304
+ /**
305
+ * Represents the entry point for a Fluid container.
306
+ */
307
+ createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;
308
+ /**
309
+ * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.
310
+ *
311
+ * Only the version of the loader will vary based on compat config. The version of
312
+ * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.
313
+ *
314
+ * @param packageEntries - list of code details and fluidEntryPoint pairs.
315
+ */
316
+ createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, loaderProps?: Partial<ILoaderProps>): IHostLoader;
317
+ /**
318
+ * Create a container using a default document id and code details.
319
+ * Container created is automatically added to the OpProcessingController to manage op flow
320
+ *
321
+ * Only the version of the loader will vary based on compat config. The version of
322
+ * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.
323
+ *
324
+ * @param packageEntries - list of code details and fluidEntryPoint pairs.
325
+ */
326
+ createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;
327
+ /**
328
+ * Loads a container using the default document id
329
+ */
330
+ loadContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>, requestHeader?: IRequestHeader): Promise<IContainer>;
331
+ /**
332
+ * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.
333
+ * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run
334
+ * @param testContainerConfig - optional configuring the test Container
335
+ */
336
+ makeTestLoader(testContainerConfig?: ITestContainerConfig): IHostLoader;
337
+ /**
338
+ * Make a container using a default document id and code details
339
+ * Container loaded is automatically added to the OpProcessingController to manage op flow
340
+ * @param testContainerConfig - optional configuring the test Container
341
+ */
342
+ makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;
343
+ /**
344
+ * Load a container using a default document id and code details.
345
+ * IContainer loaded is automatically added to the OpProcessingController to manage op flow
346
+ * @param testContainerConfig - optional configuring the test Container
347
+ * @param requestHeader - optional headers to be supplied to the loader
348
+ */
349
+ loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
350
+ /**
351
+ * Update the document ID from the resolved container's URL and reset the ID property
352
+ */
353
+ updateDocumentId(url: IResolvedUrl | undefined): void;
354
+ /**
355
+ * Make sure all the tracked containers are synchronized.
356
+ */
357
+ ensureSynchronized(timeoutDuration?: number): Promise<void>;
358
+ /**
359
+ * Reset the tracker, closing all containers and stop tracking them.
360
+ */
361
+ resetLoaderContainerTracker(syncSummarizerClients?: boolean): any;
362
+ /**
363
+ * Resets and closes all tracked containers and class states.
364
+ */
365
+ reset(): void;
366
+ }
367
+
368
+ /**
369
+ * @internal
370
+ */
371
+ export declare class LoaderContainerTracker implements IOpProcessingController {
372
+ private readonly syncSummarizerClients;
373
+ private readonly containers;
374
+ private lastProposalSeqNum;
375
+ constructor(syncSummarizerClients?: boolean);
376
+ /**
377
+ * Add a loader to start to track any container created from them
378
+ * @param loader - loader to start tracking any container created.
379
+ */
380
+ add<LoaderType extends IHostLoader>(loader: LoaderType): void;
381
+ /**
382
+ * Utility function to add container to be tracked.
383
+ *
384
+ * @param container - container to add
385
+ */
386
+ private addContainer;
387
+ /**
388
+ * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.
389
+ * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.
390
+ *
391
+ * @param container - the container to track
392
+ * @param record - the record to update the trailing op information
393
+ */
394
+ private trackTrailingNoOps;
395
+ private trackLastProposal;
396
+ /**
397
+ * Reset the tracker, closing all containers and stop tracking them.
398
+ */
399
+ reset(): void;
400
+ /**
401
+ * Make sure all the tracked containers are synchronized.
402
+ *
403
+ * No isDirty (non-readonly) containers
404
+ * No extra clientId in quorum of any container that is not tracked and still opened.
405
+ * - i.e. no pending Join/Leave message.
406
+ * No unresolved proposal (minSeqNum \>= lastProposalSeqNum)
407
+ * lastSequenceNumber of all container is the same
408
+ * clientSequenceNumberObserved is the same as clientSequenceNumber sent
409
+ * - this overlaps with !isDirty, but include task scheduler ops.
410
+ * - Trailing NoOp is tracked and don't count as pending ops.
411
+ *
412
+ * Containers that are already pause will resume process and paused again once
413
+ * everything is synchronized. Containers that aren't paused will remain unpaused when this
414
+ * function returns.
415
+ */
416
+ ensureSynchronized(...containers: IContainer[]): Promise<void>;
417
+ /**
418
+ * Utility to calculate the set of clientId per container in quorum that is NOT associated with
419
+ * any container we tracked, indicating there is a pending join or leave op that we need to wait.
420
+ *
421
+ * @param containersToApply - the set of containers to check
422
+ */
423
+ private getPendingClients;
424
+ /**
425
+ * Utility to check synchronization based on sequence number
426
+ * See ensureSynchronized for more detail
427
+ *
428
+ * @param containersToApply - the set of containers to check
429
+ */
430
+ private needSequenceNumberSynchronize;
431
+ private containerIndexStrings;
432
+ /**
433
+ * Utility to wait for any clientId in quorum that is NOT associated with any container we
434
+ * tracked, indicating there is a pending join or leave op that we need to wait.
435
+ *
436
+ * Note that this function doesn't account for container that got added after we started waiting
437
+ *
438
+ * @param containersToApply - the set of containers to wait for any inbound ops for
439
+ */
440
+ private waitForPendingClients;
441
+ /**
442
+ * Utility to wait for any inbound ops from a set of containers
443
+ * @param containersToApply - the set of containers to wait for any inbound ops for
444
+ */
445
+ private waitForAnyInboundOps;
446
+ /**
447
+ * Resume all queue activities on all paused tracked containers and return them
448
+ */
449
+ resumeProcessing(...containers: IContainer[]): IContainer[];
450
+ /**
451
+ * Pause all queue activities on the containers given, or all tracked containers
452
+ * Any containers given that is not tracked will be ignored.
453
+ *
454
+ * When a container is paused, it is assumed that we want fine grain control over op
455
+ * sequencing. This function will prepare the container and force it into write mode to
456
+ * avoid missing join messages or change the sequence of event when switching from read to
457
+ * write mode.
458
+ */
459
+ pauseProcessing(...containers: IContainer[]): Promise<void>;
460
+ /**
461
+ * When a container is paused, it is assumed that we want fine grain control over op
462
+ * sequencing. This function will prepare the container and force it into write mode to
463
+ * avoid missing join messages or change the sequence of event when switching from read to
464
+ * write mode.
465
+ *
466
+ * @param container - the container to pause
467
+ * @param record - the record for the container
468
+ */
469
+ private pauseContainer;
470
+ /**
471
+ * Pause all queue activities on all tracked containers, and resume only
472
+ * inbound to process ops until it is idle. All queues are left in the paused state
473
+ * after the function.
474
+ *
475
+ * Pausing will switch the container to write mode. See `pauseProcessing`
476
+ */
477
+ processIncoming(...containers: IContainer[]): Promise<void>;
478
+ /**
479
+ * Pause all queue activities on all tracked containers, and resume only
480
+ * outbound to process ops until it is idle. All queues are left in the paused state
481
+ * after the function.
482
+ *
483
+ * Pausing will switch the container to write mode. See `pauseProcessing`
484
+ */
485
+ processOutgoing(...containers: IContainer[]): Promise<void>;
486
+ /**
487
+ * Implementation of processIncoming and processOutgoing
488
+ */
489
+ private processQueue;
490
+ /**
491
+ * Utility to set up listener to track the outbound ops until it round trip back
492
+ * Returns a function to remove the handler after it is done.
493
+ *
494
+ * @param container - the container to setup
495
+ * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back
496
+ */
497
+ private setupInOutTracker;
498
+ /**
499
+ * Setup debug traces for connection and ops
500
+ */
501
+ private setupTrace;
502
+ /**
503
+ * Filter out the opened containers based on param.
504
+ * @param containers - The container to filter to. If the array is empty, it means don't filter and return
505
+ * all open containers.
506
+ */
507
+ private getContainers;
508
+ }
509
+
510
+ /**
511
+ * A simple code loader that caches a mapping of package name to a Fluid entry point.
512
+ * On load, it retrieves the entry point matching the package name in the given code details.
513
+ * @internal
514
+ */
515
+ export declare class LocalCodeLoader implements ICodeDetailsLoader {
516
+ private readonly fluidPackageCache;
517
+ constructor(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, runtimeOptions?: IContainerRuntimeOptions);
518
+ /**
519
+ * It finds the entry point for the package name in the given source and return it
520
+ * as a Fluid module.
521
+ * @param source - Details of where to find chaincode
522
+ */
523
+ load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
524
+ }
525
+
526
+ /**
527
+ * @internal
528
+ */
529
+ export declare const mockConfigProvider: (settings?: Record<string, ConfigTypes>) => IConfigProviderBase;
530
+
531
+ /**
532
+ * Simple retry mechanism with linear back off to call
533
+ * a function which may eventually return an accepted value.
534
+ *
535
+ * @param callback - the function to execute
536
+ * @param check - the function to check if the value is acceptable
537
+ * @param defaultValue - the default value
538
+ * @param maxTries - maximum number of attempts
539
+ * @param backOffMs - back off between attempts in milliseconds
540
+ * @returns the actual value from the callback when successful or the default value otherwise
541
+ * @internal
542
+ */
543
+ export declare const retryWithEventualValue: <T>(callback: () => Promise<T>, check: (value: T) => boolean, defaultValue: T, maxTries?: number, backOffMs?: number) => Promise<T>;
544
+
545
+ /**
546
+ * Summarizes on demand and returns the summary tree, the version number and the reference sequence number of the
547
+ * submitted summary.
548
+ *
549
+ * @param summarizer - The ISummarizer to use to summarize on demand
550
+ * @param inputs - Either the reason string or the full IOnDemandSummarizeOptions.
551
+ * Defaults to the reason "end-to-end test".
552
+ * @internal
553
+ */
554
+ export declare function summarizeNow(summarizer: ISummarizer, inputs?: string | IOnDemandSummarizeOptions): Promise<{
555
+ summaryTree: ISummaryTree;
556
+ summaryVersion: string;
557
+ summaryRefSeq: number;
558
+ }>;
559
+
560
+ /**
561
+ * @internal
562
+ */
563
+ export declare type SupportedExportInterfaces = Partial<IProvideRuntimeFactory & IProvideFluidDataStoreFactory & IProvideFluidDataStoreRegistry & IProvideFluidCodeDetailsComparer>;
564
+
565
+ /**
566
+ * A container runtime factory that allows you to set runtime options
567
+ * @internal
568
+ */
569
+ export declare const TestContainerRuntimeFactory: {
570
+ new (type: string, dataStoreFactory: IFluidDataStoreFactory, runtimeOptions?: IContainerRuntimeOptions, requestHandlers?: RuntimeRequestHandler[]): {
571
+ type: string;
572
+ dataStoreFactory: IFluidDataStoreFactory;
573
+ runtimeOptions: IContainerRuntimeOptions;
574
+ requestHandlers: RuntimeRequestHandler[];
575
+ instantiateFirstTime(runtime: ContainerRuntime): Promise<void>;
576
+ instantiateFromExisting(runtime: ContainerRuntime): Promise<void>;
577
+ preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & IContainerRuntime>;
578
+ readonly IRuntimeFactory: any;
579
+ instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
580
+ hasInitialized(_runtime: IContainerRuntime): Promise<void>;
581
+ };
582
+ };
583
+
584
+ /**
585
+ * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.
586
+ * The shared objects can be retrieved by passing the key of the entry to getSharedObject.
587
+ * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
588
+ * @internal
589
+ */
590
+ export declare class TestFluidObject implements ITestFluidObject {
591
+ readonly runtime: IFluidDataStoreRuntime;
592
+ readonly channel: IFluidDataStoreChannel;
593
+ readonly context: IFluidDataStoreContext;
594
+ private readonly factoryEntriesMap;
595
+ get ITestFluidObject(): this;
596
+ get IFluidLoadable(): this;
597
+ get handle(): IFluidHandle<this>;
598
+ root: ISharedMap;
599
+ private readonly innerHandle;
600
+ private initializeP;
601
+ /**
602
+ * Creates a new TestFluidObject.
603
+ * @param runtime - The data store runtime.
604
+ * @param context - The data store context.
605
+ * @param factoryEntries - A list of id to IChannelFactory mapping. For each item in the list,
606
+ * a shared object is created which can be retrieved by calling getSharedObject() with the id;
607
+ */
608
+ constructor(runtime: IFluidDataStoreRuntime, channel: IFluidDataStoreChannel, context: IFluidDataStoreContext, factoryEntriesMap: Map<string, IChannelFactory>);
609
+ /**
610
+ * Retrieves a shared object with the given id.
611
+ * @param id - The id of the shared object to retrieve.
612
+ */
613
+ getSharedObject<T = any>(id: string): Promise<T>;
614
+ request(request: IRequest): Promise<IResponse>;
615
+ initialize(existing: boolean): Promise<void>;
616
+ }
617
+
618
+ /**
619
+ * Creates a factory for a TestFluidObject with the given object factory entries. It creates a data store runtime
620
+ * with the object factories in the entry list. All the entries with an id other than undefined are passed to the
621
+ * Fluid object so that it can create a shared object for each.
622
+ *
623
+ * @example
624
+ *
625
+ * The following will create a Fluid object that creates and loads a SharedString and SharedDirectory.
626
+ * It will add SparseMatrix to the data store's factory so that it can be created later.
627
+ *
628
+ * ```typescript
629
+ * new TestFluidObjectFactory([
630
+ * [ "sharedString", SharedString.getFactory() ],
631
+ * [ "sharedDirectory", SharedDirectory.getFactory() ],
632
+ * [ undefined, SparseMatrix.getFactory() ],
633
+ * ]);
634
+ * ```
635
+ *
636
+ * The SharedString and SharedDirectory can be retrieved via getSharedObject() on the TestFluidObject as follows:
637
+ *
638
+ * ```typescript
639
+ * sharedString = testFluidObject.getSharedObject<SharedString>("sharedString");
640
+ * sharedDir = testFluidObject.getSharedObject<SharedDirectory>("sharedDirectory");
641
+ * ```
642
+ *
643
+ * @privateRemarks Beware that using this class generally forfeits some compatibility coverage
644
+ * `describeCompat` aims to provide:
645
+ * `SharedMap`s always reference the current version of SharedMap.
646
+ * AB#4670 tracks improving this situation.
647
+ * @internal
648
+ */
649
+ export declare class TestFluidObjectFactory implements IFluidDataStoreFactory {
650
+ private readonly factoryEntries;
651
+ readonly type: string;
652
+ get IFluidDataStoreFactory(): this;
653
+ /**
654
+ * Creates a new TestFluidObjectFactory.
655
+ * @param factoryEntries - A list of id to IChannelFactory mapping. It creates a data store runtime with each
656
+ * IChannelFactory. Entries with string ids are passed to the Fluid object so that it can create a shared object
657
+ * for it.
658
+ */
659
+ constructor(factoryEntries: ChannelFactoryRegistry, type?: string);
660
+ instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
661
+ }
662
+
663
+ /**
664
+ * Shared base class for test object provider. Contain code for loader and container creation and loading
665
+ * @internal
666
+ */
667
+ export declare class TestObjectProvider implements ITestObjectProvider {
668
+ private readonly LoaderConstructor;
669
+ /**
670
+ * {@inheritDoc ITestObjectProvider.driver}
671
+ */
672
+ readonly driver: ITestDriver;
673
+ /**
674
+ * {@inheritDoc ITestObjectProvider.createFluidEntryPoint}
675
+ */
676
+ readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;
677
+ /**
678
+ * {@inheritDoc ITestObjectProvider."type"}
679
+ */
680
+ readonly type = "TestObjectProvider";
681
+ private _loaderContainerTracker;
682
+ private _documentServiceFactory;
683
+ private _urlResolver;
684
+ private _logger;
685
+ private readonly _documentIdStrategy;
686
+ private _documentCreated;
687
+ /**
688
+ * Manage objects for loading and creating container, including the driver, loader, and OpProcessingController
689
+ * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name
690
+ * and factory for TestFluidObject
691
+ */
692
+ constructor(LoaderConstructor: typeof Loader,
693
+ /**
694
+ * {@inheritDoc ITestObjectProvider.driver}
695
+ */
696
+ driver: ITestDriver,
697
+ /**
698
+ * {@inheritDoc ITestObjectProvider.createFluidEntryPoint}
699
+ */
700
+ createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
701
+ /**
702
+ * {@inheritDoc ITestObjectProvider.logger}
703
+ */
704
+ get logger(): EventAndErrorTrackingLogger;
705
+ private set logger(value);
706
+ /**
707
+ * {@inheritDoc ITestObjectProvider.documentServiceFactory}
708
+ */
709
+ get documentServiceFactory(): IDocumentServiceFactory;
710
+ /**
711
+ * {@inheritDoc ITestObjectProvider.urlResolver}
712
+ */
713
+ get urlResolver(): IUrlResolver;
714
+ /**
715
+ * {@inheritDoc ITestObjectProvider.documentId}
716
+ */
717
+ get documentId(): string;
718
+ /**
719
+ * {@inheritDoc ITestObjectProvider.defaultCodeDetails}
720
+ */
721
+ get defaultCodeDetails(): IFluidCodeDetails;
722
+ /**
723
+ * {@inheritDoc ITestObjectProvider.opProcessingController}
724
+ */
725
+ get opProcessingController(): IOpProcessingController;
726
+ /**
727
+ * {@inheritDoc ITestObjectProvider.createLoader}
728
+ */
729
+ createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, loaderProps?: Partial<ILoaderProps>): Loader;
730
+ /**
731
+ * {@inheritDoc ITestObjectProvider.createContainer}
732
+ */
733
+ createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;
734
+ /**
735
+ * {@inheritDoc ITestObjectProvider.loadContainer}
736
+ */
737
+ loadContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>, requestHeader?: IRequestHeader): Promise<IContainer>;
738
+ private resolveContainer;
739
+ /**
740
+ * {@inheritDoc ITestObjectProvider.makeTestLoader}
741
+ */
742
+ makeTestLoader(testContainerConfig?: ITestContainerConfig): Loader;
743
+ /**
744
+ * {@inheritDoc ITestObjectProvider.makeTestContainer}
745
+ */
746
+ makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;
747
+ /**
748
+ * {@inheritDoc ITestObjectProvider.loadTestContainer}
749
+ */
750
+ loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
751
+ /**
752
+ * {@inheritDoc ITestObjectProvider.reset}
753
+ */
754
+ reset(): void;
755
+ /**
756
+ * {@inheritDoc ITestObjectProvider.ensureSynchronized}
757
+ */
758
+ ensureSynchronized(): Promise<void>;
759
+ private waitContainerToCatchUp;
760
+ /**
761
+ * {@inheritDoc ITestObjectProvider.updateDocumentId}
762
+ */
763
+ updateDocumentId(resolvedUrl: IResolvedUrl | undefined): void;
764
+ /**
765
+ * {@inheritDoc ITestObjectProvider.resetLoaderContainerTracker}
766
+ */
767
+ resetLoaderContainerTracker(syncSummarizerClients?: boolean): void;
768
+ }
769
+
770
+ /**
771
+ * Implements {@link ITestObjectProvider}, but uses different versions to create and load containers.
772
+ *
773
+ * @internal
774
+ */
775
+ export declare class TestObjectProviderWithVersionedLoad implements ITestObjectProvider {
776
+ private readonly LoaderConstructorForCreating;
777
+ private readonly LoaderConstructorForLoading;
778
+ private readonly driverForCreating;
779
+ private readonly driverForLoading;
780
+ private readonly createFluidEntryPointForCreating;
781
+ private readonly createFluidEntryPointForLoading;
782
+ /**
783
+ * {@inheritDoc ITestObjectProvider."type"}
784
+ */
785
+ readonly type = "TestObjectProviderWithVersionedLoad";
786
+ private _loaderContainerTracker;
787
+ private _logger;
788
+ private readonly _documentIdStrategy;
789
+ private _documentServiceFactory;
790
+ private _urlResolver;
791
+ private _documentCreated;
792
+ /**
793
+ * `_loadCount` is used to alternate which version we load the next container with.
794
+ * loadCount is even then we will load with the "create" version, and if odd we load with the "load" version.
795
+ * After each test we will reset loadCount to 0 to ensure we always create the first container with the create version.
796
+ *
797
+ * Note: This will only affect tests that load a container more than two times.
798
+ */
799
+ private _loadCount;
800
+ constructor(LoaderConstructorForCreating: typeof Loader, LoaderConstructorForLoading: typeof Loader, driverForCreating: ITestDriver, driverForLoading: ITestDriver, createFluidEntryPointForCreating: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint, createFluidEntryPointForLoading: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
801
+ /**
802
+ * {@inheritDoc ITestObjectProvider.logger}
803
+ */
804
+ get logger(): EventAndErrorTrackingLogger;
805
+ /**
806
+ * {@inheritDoc ITestObjectProvider.documentServiceFactory}
807
+ */
808
+ get documentServiceFactory(): IDocumentServiceFactory;
809
+ /**
810
+ * {@inheritDoc ITestObjectProvider.urlResolver}
811
+ */
812
+ get urlResolver(): IUrlResolver;
813
+ /**
814
+ * {@inheritDoc ITestObjectProvider.documentId}
815
+ */
816
+ get documentId(): string;
817
+ /**
818
+ * {@inheritDoc ITestObjectProvider.defaultCodeDetails}
819
+ */
820
+ get defaultCodeDetails(): IFluidCodeDetails;
821
+ /**
822
+ * {@inheritDoc ITestObjectProvider.opProcessingController}
823
+ */
824
+ get opProcessingController(): IOpProcessingController;
825
+ /**
826
+ * {@inheritDoc ITestObjectProvider.driver}
827
+ */
828
+ get driver(): ITestDriver;
829
+ /**
830
+ * {@inheritDoc ITestObjectProvider.createFluidEntryPoint}
831
+ */
832
+ get createFluidEntryPoint(): (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;
833
+ private createLoaderForCreating;
834
+ private createLoaderForLoading;
835
+ /**
836
+ * {@inheritDoc ITestObjectProvider.createLoader}
837
+ */
838
+ createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, loaderProps?: Partial<ILoaderProps>): Loader;
839
+ /**
840
+ * {@inheritDoc ITestObjectProvider.createContainer}
841
+ */
842
+ createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;
843
+ /**
844
+ * {@inheritDoc ITestObjectProvider.loadContainer}
845
+ */
846
+ loadContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>, requestHeader?: IRequestHeader): Promise<IContainer>;
847
+ private resolveContainer;
848
+ /**
849
+ * {@inheritDoc ITestObjectProvider.makeTestLoader}
850
+ */
851
+ makeTestLoader(testContainerConfig?: ITestContainerConfig): Loader;
852
+ /**
853
+ * {@inheritDoc ITestObjectProvider.makeTestContainer}
854
+ */
855
+ makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;
856
+ /**
857
+ * {@inheritDoc ITestObjectProvider.loadTestContainer}
858
+ */
859
+ loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
860
+ /**
861
+ * {@inheritDoc ITestObjectProvider.reset}
862
+ */
863
+ reset(): void;
864
+ /**
865
+ * {@inheritDoc ITestObjectProvider.ensureSynchronized}
866
+ */
867
+ ensureSynchronized(): Promise<void>;
868
+ private waitContainerToCatchUp;
869
+ /**
870
+ * {@inheritDoc ITestObjectProvider.updateDocumentId}
871
+ */
872
+ updateDocumentId(resolvedUrl: IResolvedUrl | undefined): void;
873
+ /**
874
+ * {@inheritDoc ITestObjectProvider.resetLoaderContainerTracker}
875
+ */
876
+ resetLoaderContainerTracker(syncSummarizerClients?: boolean): void;
877
+ private nextLoaderShouldCreate;
878
+ }
879
+
880
+ /**
881
+ * Wraps the given promise around with promise that will complete after a specific timeout if the original promise does
882
+ * not resolve by then. By default, it uses the mocha test timeout and complete the promise just before that so that
883
+ * tests don't time out because of unpredictable awaits.
884
+ * The timeout can be overridden via timeoutOptions but it's recommended to use the default value.
885
+ * @param promise - The promise to be awaited.
886
+ * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior
887
+ * when the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a
888
+ * specific value.
889
+ * @returns A new promise that will complete when the given promise resolves or the timeout expires.
890
+ * @internal
891
+ */
892
+ export declare function timeoutAwait<T = void>(promise: PromiseLike<T>, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
893
+
894
+ /**
895
+ * Creates a promise from the given executor that will complete after a specific timeout. By default, it uses the mocha
896
+ * test timeout and complete the promise just before that so that tests don't time out because of unpredictable awaits.
897
+ * The timeout can be overridden via timeoutOptions but it's recommended to use the default value.
898
+ * @param executor - The executor for the promise.
899
+ * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when
900
+ * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.
901
+ * @returns A new promise that will complete when the given executor resolves or the timeout expires.
902
+ * @internal
903
+ */
904
+ export declare function timeoutPromise<T = void>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
905
+
906
+ /**
907
+ * @internal
908
+ */
909
+ export declare interface TimeoutWithError {
910
+ /**
911
+ * Timeout duration in milliseconds, if it is great than 0 and not Infinity
912
+ * If it is undefined, then it will use test timeout if we are in side the test function
913
+ * Otherwise, there is no timeout
914
+ */
915
+ durationMs?: number;
916
+ reject?: true;
917
+ errorMsg?: string;
918
+ }
919
+
920
+ /**
921
+ * @internal
922
+ */
923
+ export declare interface TimeoutWithValue<T = void> {
924
+ /**
925
+ * Timeout duration in milliseconds, if it is great than 0 and not Infinity
926
+ * If it is undefined, then it will use test timeout if we are in side the test function
927
+ * Otherwise, there is no timeout
928
+ */
929
+ durationMs?: number;
930
+ reject: false;
931
+ value: T;
932
+ }
933
+
934
+ /**
935
+ * Utility function to wait for the specified Container to be in Connected state.
936
+ * If the Container is already connected, the Promise returns immediately; otherwise it resolves when the Container emits
937
+ * its 'connected' event.
938
+ * If failOnContainerClose === true, the returned Promise will be rejected if the container emits a 'closed' event
939
+ * before a 'connected' event.
940
+ * @param container - The container to wait for.
941
+ * @param failOnContainerClose - If true, the returned Promise will be rejected if the container emits a 'closed' event
942
+ * before a 'connected' event.
943
+ * Defaults to true.
944
+ * @param timeoutOptions - Options related to the behavior of the timeout.
945
+ * If provided, the returned Promise will reject if the container hasn't emitted relevant events in timeoutOptions.durationMs.
946
+ * If not provided, the Promise will wait indefinitely for the Container to emit its 'connected' (or 'closed', if
947
+ * failOnContainerClose === true) event.
948
+ *
949
+ * @returns A Promise that either:
950
+ * - Resolves when the specified container emits a 'connected' event (or immediately if the Container is already connected).
951
+ * - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.
952
+ * - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant
953
+ * events, within that timeframe.
954
+ * @internal
955
+ */
956
+ export declare function waitForContainerConnection(container: IContainer, failOnContainerClose?: boolean, timeoutOptions?: TimeoutWithError): Promise<void>;
957
+
958
+ /**
959
+ * Wraps the given IDocumentService to override the `connectToStorage` method. The intent is to plumb the
960
+ * `uploadSummaryCb` to the IDocumentStorageService so that it is called whenever a summary is uploaded by
961
+ * the client.
962
+ * The document storage service that is created in `connectToStorage` is wrapped by calling `wrapDocumentStorageService`
963
+ * to pass in the `uploadSummaryCb`.
964
+ * @internal
965
+ */
966
+ export declare function wrapDocumentService(innerDocService: IDocumentService, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentService;
967
+
968
+ /**
969
+ * Wraps the given IDocumentServiceFactory to override the `createDocumentService` method. The intent is to plumb
970
+ * the `uploadSummaryCb` all the way to the IDocumentStorageService so that it is called whenever a summary is
971
+ * uploaded by the client.
972
+ * The document service that is created in `createDocumentService` is wrapped by calling `wrapDocumentService` to
973
+ * pass in the `uploadSummaryCb`.
974
+ * @internal
975
+ */
976
+ export declare function wrapDocumentServiceFactory(innerDocServiceFactory: IDocumentServiceFactory, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentServiceFactory;
977
+
978
+ /**
979
+ * Wraps the given IDocumentStorageService to override the `uploadSummaryWithContext` method. It calls the
980
+ * `uploadSummaryCb` whenever a summary is uploaded by the client. The summary context can be updated in the
981
+ * callback before it is uploaded to the server.
982
+ * @internal
983
+ */
984
+ export declare function wrapDocumentStorageService(innerDocStorageService: IDocumentStorageService, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentStorageService;
985
+
986
+ export { }