@fluidframework/test-utils 2.0.0-dev.7.4.0.215930 → 2.0.0-dev.7.4.0.217212

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 (90) hide show
  1. package/api-extractor-lint.json +13 -0
  2. package/api-extractor.json +0 -4
  3. package/api-report/test-utils.api.md +81 -75
  4. package/dist/DriverWrappers.d.ts +3 -0
  5. package/dist/DriverWrappers.d.ts.map +1 -1
  6. package/dist/DriverWrappers.js +3 -0
  7. package/dist/DriverWrappers.js.map +1 -1
  8. package/dist/TestConfigs.d.ts +4 -1
  9. package/dist/TestConfigs.d.ts.map +1 -1
  10. package/dist/TestConfigs.js +3 -0
  11. package/dist/TestConfigs.js.map +1 -1
  12. package/dist/TestSummaryUtils.d.ts +4 -2
  13. package/dist/TestSummaryUtils.d.ts.map +1 -1
  14. package/dist/TestSummaryUtils.js +3 -0
  15. package/dist/TestSummaryUtils.js.map +1 -1
  16. package/dist/containerUtils.d.ts +11 -0
  17. package/dist/containerUtils.d.ts.map +1 -1
  18. package/dist/containerUtils.js +27 -2
  19. package/dist/containerUtils.js.map +1 -1
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +3 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/interfaces.d.ts +6 -0
  25. package/dist/interfaces.d.ts.map +1 -1
  26. package/dist/interfaces.js.map +1 -1
  27. package/dist/loaderContainerTracker.d.ts +3 -0
  28. package/dist/loaderContainerTracker.d.ts.map +1 -1
  29. package/dist/loaderContainerTracker.js +3 -0
  30. package/dist/loaderContainerTracker.js.map +1 -1
  31. package/dist/localCodeLoader.d.ts +7 -0
  32. package/dist/localCodeLoader.d.ts.map +1 -1
  33. package/dist/localCodeLoader.js +1 -0
  34. package/dist/localCodeLoader.js.map +1 -1
  35. package/dist/localLoader.d.ts +2 -0
  36. package/dist/localLoader.d.ts.map +1 -1
  37. package/dist/localLoader.js +2 -0
  38. package/dist/localLoader.js.map +1 -1
  39. package/dist/packageVersion.d.ts +1 -1
  40. package/dist/packageVersion.js +1 -1
  41. package/dist/packageVersion.js.map +1 -1
  42. package/dist/retry.d.ts +1 -0
  43. package/dist/retry.d.ts.map +1 -1
  44. package/dist/retry.js +1 -0
  45. package/dist/retry.js.map +1 -1
  46. package/dist/test-utils-alpha.d.ts +138 -659
  47. package/dist/test-utils-beta.d.ts +176 -678
  48. package/dist/test-utils-public.d.ts +176 -678
  49. package/dist/test-utils-untrimmed.d.ts +350 -39
  50. package/dist/testContainerRuntimeFactory.d.ts +2 -0
  51. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  52. package/dist/testContainerRuntimeFactory.js +15 -7
  53. package/dist/testContainerRuntimeFactory.js.map +1 -1
  54. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +1 -0
  55. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
  56. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +1 -0
  57. package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
  58. package/dist/testFluidObject.d.ts +5 -0
  59. package/dist/testFluidObject.d.ts.map +1 -1
  60. package/dist/testFluidObject.js +2 -0
  61. package/dist/testFluidObject.js.map +1 -1
  62. package/dist/testObjectProvider.d.ts +287 -37
  63. package/dist/testObjectProvider.d.ts.map +1 -1
  64. package/dist/testObjectProvider.js +310 -25
  65. package/dist/testObjectProvider.js.map +1 -1
  66. package/dist/timeoutUtils.d.ts +11 -0
  67. package/dist/timeoutUtils.d.ts.map +1 -1
  68. package/dist/timeoutUtils.js +5 -0
  69. package/dist/timeoutUtils.js.map +1 -1
  70. package/lib/test-utils-alpha.d.ts +138 -659
  71. package/lib/test-utils-beta.d.ts +176 -678
  72. package/lib/test-utils-public.d.ts +176 -678
  73. package/lib/test-utils-untrimmed.d.ts +350 -39
  74. package/package.json +34 -24
  75. package/src/DriverWrappers.ts +3 -0
  76. package/src/TestConfigs.ts +4 -1
  77. package/src/TestSummaryUtils.ts +9 -2
  78. package/src/containerUtils.ts +27 -1
  79. package/src/index.ts +7 -1
  80. package/src/interfaces.ts +6 -0
  81. package/src/loaderContainerTracker.ts +3 -0
  82. package/src/localCodeLoader.ts +7 -0
  83. package/src/localLoader.ts +2 -0
  84. package/src/packageVersion.ts +1 -1
  85. package/src/retry.ts +1 -0
  86. package/src/testContainerRuntimeFactory.ts +24 -5
  87. package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +1 -0
  88. package/src/testFluidObject.ts +5 -0
  89. package/src/testObjectProvider.ts +524 -47
  90. package/src/timeoutUtils.ts +11 -0
@@ -1,15 +1,16 @@
1
- import { ConfigTypes } from '@fluidframework/telemetry-utils';
1
+ import { ConfigTypes } from '@fluidframework/core-interfaces';
2
2
  import { ContainerRuntime } from '@fluidframework/container-runtime';
3
3
  import { ContainerRuntimeFactoryWithDefaultDataStore } from '@fluidframework/aqueduct';
4
4
  import { FluidDataStoreRuntime } from '@fluidframework/datastore';
5
5
  import { FluidObject } from '@fluidframework/core-interfaces';
6
6
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
7
7
  import { ICodeDetailsLoader } from '@fluidframework/container-definitions';
8
- import { IConfigProviderBase } from '@fluidframework/telemetry-utils';
8
+ import { IConfigProviderBase } from '@fluidframework/core-interfaces';
9
9
  import { IContainer } from '@fluidframework/container-definitions';
10
10
  import { IContainerContext } from '@fluidframework/container-definitions';
11
11
  import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
12
12
  import { IContainerRuntimeOptions } from '@fluidframework/container-runtime';
13
+ import { IDataStore } from '@fluidframework/runtime-definitions';
13
14
  import { IDocumentService } from '@fluidframework/driver-definitions';
14
15
  import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
15
16
  import { IDocumentStorageService } from '@fluidframework/driver-definitions';
@@ -48,6 +49,9 @@ import { Loader } from '@fluidframework/container-loader';
48
49
  import { NamedFluidDataStoreRegistryEntries } from '@fluidframework/runtime-definitions';
49
50
  import { RuntimeRequestHandler } from '@fluidframework/request-handler';
50
51
 
52
+ /**
53
+ * @internal
54
+ */
51
55
  export declare type ChannelFactoryRegistry = Iterable<[string | undefined, IChannelFactory]>;
52
56
 
53
57
  /**
@@ -55,11 +59,13 @@ export declare type ChannelFactoryRegistry = Iterable<[string | undefined, IChan
55
59
  * @param source - The code details used to create the Container.
56
60
  * @param loader - The loader to use to initialize the container.
57
61
  * @param attachRequest - The request to create new from.
62
+ * @internal
58
63
  */
59
64
  export declare function createAndAttachContainer(source: IFluidCodeDetails, loader: IHostLoader, attachRequest: IRequest): Promise<IContainer>;
60
65
 
61
66
  /**
62
67
  * ! Note: This function is purely needed for back-compat as the constructor argument structure was changed
68
+ * @internal
63
69
  */
64
70
  export declare const createContainerRuntimeFactoryWithDefaultDataStore: (Base: typeof ContainerRuntimeFactoryWithDefaultDataStore | undefined, ctorArgs: {
65
71
  defaultFactory: IFluidDataStoreFactory;
@@ -70,6 +76,9 @@ export declare const createContainerRuntimeFactoryWithDefaultDataStore: (Base: t
70
76
  provideEntryPoint?: ((runtime: IContainerRuntime) => Promise<FluidObject>) | undefined;
71
77
  }) => ContainerRuntimeFactoryWithDefaultDataStore;
72
78
 
79
+ /**
80
+ * @internal
81
+ */
73
82
  export declare const createDocumentId: () => string;
74
83
 
75
84
  /**
@@ -78,6 +87,7 @@ export declare const createDocumentId: () => string;
78
87
  * @param documentServiceFactory - the driver factory to use
79
88
  * @param urlResolver - the url resolver to use
80
89
  * @param options - loader options
90
+ * @internal
81
91
  */
82
92
  export declare function createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, documentServiceFactory: IDocumentServiceFactory, urlResolver: IUrlResolver, logger?: ITelemetryBaseLogger, options?: ILoaderOptions): IHostLoader;
83
93
 
@@ -86,6 +96,7 @@ export declare function createLoader(packageEntries: Iterable<[IFluidCodeDetails
86
96
  * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
87
97
  *
88
98
  * Can pass in a test config provider to enable/disable features.
99
+ * @internal
89
100
  */
90
101
  export declare function createSummarizer(provider: ITestObjectProvider, container: IContainer, config?: ITestContainerConfig, summaryVersion?: string, logger?: ITelemetryBaseLogger): Promise<{
91
102
  container: IContainer;
@@ -96,6 +107,7 @@ export declare function createSummarizer(provider: ITestObjectProvider, containe
96
107
  * Creates a summarizer client from the given container and data store factory, and returns the summarizer client's
97
108
  * IContainer and ISummarizer.
98
109
  * The ISummarizer can be used to generate on-demand summaries. The IContainer can be used to fetch data stores, etc.
110
+ * @internal
99
111
  */
100
112
  export declare function createSummarizerFromFactory(provider: ITestObjectProvider, container: IContainer, dataStoreFactory: IFluidDataStoreFactory, summaryVersion?: string, containerRuntimeFactoryType?: typeof ContainerRuntimeFactoryWithDefaultDataStore, registryEntries?: NamedFluidDataStoreRegistryEntries, logger?: ITelemetryBaseLogger, configProvider?: IConfigProviderBase): Promise<{
101
113
  container: IContainer;
@@ -104,6 +116,7 @@ export declare function createSummarizerFromFactory(provider: ITestObjectProvide
104
116
 
105
117
  /**
106
118
  * Create a container runtime factory class that allows you to set runtime options
119
+ * @internal
107
120
  */
108
121
  export declare const createTestContainerRuntimeFactory: (containerRuntimeCtor: typeof ContainerRuntime) => {
109
122
  new (type: string, dataStoreFactory: IFluidDataStoreFactory, runtimeOptions?: IContainerRuntimeOptions, requestHandlers?: RuntimeRequestHandler[]): {
@@ -120,11 +133,17 @@ export declare const createTestContainerRuntimeFactory: (containerRuntimeCtor: t
120
133
  };
121
134
  };
122
135
 
136
+ /**
137
+ * @internal
138
+ */
123
139
  export declare enum DataObjectFactoryType {
124
140
  Primed = 0,
125
141
  Test = 1
126
142
  }
127
143
 
144
+ /**
145
+ * @internal
146
+ */
128
147
  export declare const defaultTimeoutDurationMs = 250;
129
148
 
130
149
  /**
@@ -132,6 +151,7 @@ export declare const defaultTimeoutDurationMs = 250;
132
151
  * It also tracks all unexpected errors.
133
152
  * At any point you call reportAndClearTrackedEvents which will provide all unexpected errors, and
134
153
  * any expected events that have not occurred.
154
+ * @internal
135
155
  */
136
156
  export declare class EventAndErrorTrackingLogger implements ITelemetryBaseLogger {
137
157
  private readonly baseLogger;
@@ -154,17 +174,56 @@ export declare class EventAndErrorTrackingLogger implements ITelemetryBaseLogger
154
174
  };
155
175
  }
156
176
 
177
+ /**
178
+ * @internal
179
+ */
157
180
  export declare type fluidEntryPoint = SupportedExportInterfaces | IFluidModule;
158
181
 
159
182
  /**
160
183
  * This function should ONLY be used for back compat purposes
161
184
  * LTS versions of the Loader/Container will not have the "getEntryPoint" method, so we need to fallback to "request"
162
185
  * This function can be removed once LTS version of Loader moves to 2.0.0-internal.7.0.0
186
+ * @internal
163
187
  */
164
188
  export declare function getContainerEntryPointBackCompat<T>(container: IContainer): Promise<T>;
165
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
+ */
166
202
  export declare function getUnexpectedLogErrorException(logger: EventAndErrorTrackingLogger | undefined, prefix?: string): Error | undefined;
167
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
+ */
168
227
  export declare interface IOpProcessingController {
169
228
  processIncoming(...containers: IContainer[]): Promise<void>;
170
229
  processOutgoing(...containers: IContainer[]): Promise<void>;
@@ -172,10 +231,16 @@ export declare interface IOpProcessingController {
172
231
  resumeProcessing(...containers: IContainer[]): void;
173
232
  }
174
233
 
234
+ /**
235
+ * @internal
236
+ */
175
237
  export declare interface IProvideTestFluidObject {
176
238
  readonly ITestFluidObject: ITestFluidObject;
177
239
  }
178
240
 
241
+ /**
242
+ * @internal
243
+ */
179
244
  export declare interface ITestContainerConfig {
180
245
  /** TestFluidDataObject instead of PrimedDataStore */
181
246
  fluidDataObjectType?: DataObjectFactoryType;
@@ -189,6 +254,9 @@ export declare interface ITestContainerConfig {
189
254
  loaderProps?: Partial<ILoaderProps>;
190
255
  }
191
256
 
257
+ /**
258
+ * @internal
259
+ */
192
260
  export declare interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {
193
261
  root: ISharedMap;
194
262
  readonly runtime: IFluidDataStoreRuntime;
@@ -197,34 +265,109 @@ export declare interface ITestFluidObject extends IProvideTestFluidObject, IFlui
197
265
  getSharedObject<T = any>(id: string): Promise<T>;
198
266
  }
199
267
 
268
+ /**
269
+ * @internal
270
+ */
200
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
+ */
201
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
+ */
202
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
+ */
203
326
  createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;
327
+ /**
328
+ * Loads a container using the default document id
329
+ */
204
330
  loadContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>, requestHeader?: IRequestHeader): Promise<IContainer>;
205
331
  /**
206
- * Used to create a test Container. The Loader/ContainerRuntime/DataRuntime might be different versioned.
207
- * In generateLocalCompatTest(), this Container and its runtime will be arbitrarily-versioned.
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
208
335
  */
209
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
+ */
210
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
+ */
211
349
  loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
212
350
  /**
213
- *
214
- * @param url - Resolved container URL
351
+ * Update the document ID from the resolved container's URL and reset the ID property
215
352
  */
216
353
  updateDocumentId(url: IResolvedUrl | undefined): void;
217
- logger: ITelemetryBaseLogger;
218
- documentServiceFactory: IDocumentServiceFactory;
219
- urlResolver: IUrlResolver;
220
- defaultCodeDetails: IFluidCodeDetails;
221
- opProcessingController: IOpProcessingController;
354
+ /**
355
+ * Make sure all the tracked containers are synchronized.
356
+ */
222
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
+ */
223
365
  reset(): void;
224
- documentId: string;
225
- driver: ITestDriver;
226
366
  }
227
367
 
368
+ /**
369
+ * @internal
370
+ */
228
371
  export declare class LoaderContainerTracker implements IOpProcessingController {
229
372
  private readonly syncSummarizerClients;
230
373
  private readonly containers;
@@ -367,6 +510,7 @@ export declare class LoaderContainerTracker implements IOpProcessingController {
367
510
  /**
368
511
  * A simple code loader that caches a mapping of package name to a Fluid entry point.
369
512
  * On load, it retrieves the entry point matching the package name in the given code details.
513
+ * @internal
370
514
  */
371
515
  export declare class LocalCodeLoader implements ICodeDetailsLoader {
372
516
  private readonly fluidPackageCache;
@@ -379,6 +523,9 @@ export declare class LocalCodeLoader implements ICodeDetailsLoader {
379
523
  load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;
380
524
  }
381
525
 
526
+ /**
527
+ * @internal
528
+ */
382
529
  export declare const mockConfigProvider: (settings?: Record<string, ConfigTypes>) => IConfigProviderBase;
383
530
 
384
531
  /**
@@ -391,6 +538,7 @@ export declare const mockConfigProvider: (settings?: Record<string, ConfigTypes>
391
538
  * @param maxTries - maximum number of attempts
392
539
  * @param backOffMs - back off between attempts in milliseconds
393
540
  * @returns the actual value from the callback when successful or the default value otherwise
541
+ * @internal
394
542
  */
395
543
  export declare const retryWithEventualValue: <T>(callback: () => Promise<T>, check: (value: T) => boolean, defaultValue: T, maxTries?: number, backOffMs?: number) => Promise<T>;
396
544
 
@@ -401,6 +549,7 @@ export declare const retryWithEventualValue: <T>(callback: () => Promise<T>, che
401
549
  * @param summarizer - The ISummarizer to use to summarize on demand
402
550
  * @param inputs - Either the reason string or the full IOnDemandSummarizeOptions.
403
551
  * Defaults to the reason "end-to-end test".
552
+ * @internal
404
553
  */
405
554
  export declare function summarizeNow(summarizer: ISummarizer, inputs?: string | IOnDemandSummarizeOptions): Promise<{
406
555
  summaryTree: ISummaryTree;
@@ -408,10 +557,14 @@ export declare function summarizeNow(summarizer: ISummarizer, inputs?: string |
408
557
  summaryRefSeq: number;
409
558
  }>;
410
559
 
560
+ /**
561
+ * @internal
562
+ */
411
563
  export declare type SupportedExportInterfaces = Partial<IProvideRuntimeFactory & IProvideFluidDataStoreFactory & IProvideFluidDataStoreRegistry & IProvideFluidCodeDetailsComparer>;
412
564
 
413
565
  /**
414
566
  * A container runtime factory that allows you to set runtime options
567
+ * @internal
415
568
  */
416
569
  export declare const TestContainerRuntimeFactory: {
417
570
  new (type: string, dataStoreFactory: IFluidDataStoreFactory, runtimeOptions?: IContainerRuntimeOptions, requestHandlers?: RuntimeRequestHandler[]): {
@@ -432,6 +585,7 @@ export declare const TestContainerRuntimeFactory: {
432
585
  * A test Fluid object that will create a shared object for each key-value pair in the factoryEntries passed to load.
433
586
  * The shared objects can be retrieved by passing the key of the entry to getSharedObject.
434
587
  * It exposes the IFluidDataStoreContext and IFluidDataStoreRuntime.
588
+ * @internal
435
589
  */
436
590
  export declare class TestFluidObject implements ITestFluidObject {
437
591
  readonly runtime: IFluidDataStoreRuntime;
@@ -497,6 +651,7 @@ export declare class TestFluidObject implements ITestFluidObject {
497
651
  * `describeCompat` aims to provide:
498
652
  * `SharedMap`s always reference the current version of SharedMap.
499
653
  * AB#4670 tracks improving this situation.
654
+ * @internal
500
655
  */
501
656
  export declare class TestFluidObjectFactory implements IFluidDataStoreFactory {
502
657
  private readonly factoryEntries;
@@ -514,11 +669,22 @@ export declare class TestFluidObjectFactory implements IFluidDataStoreFactory {
514
669
 
515
670
  /**
516
671
  * Shared base class for test object provider. Contain code for loader and container creation and loading
672
+ * @internal
517
673
  */
518
674
  export declare class TestObjectProvider implements ITestObjectProvider {
519
- readonly LoaderConstructor: typeof Loader;
675
+ private readonly LoaderConstructor;
676
+ /**
677
+ * {@inheritDoc ITestObjectProvider.driver}
678
+ */
520
679
  readonly driver: ITestDriver;
680
+ /**
681
+ * {@inheritDoc ITestObjectProvider.createFluidEntryPoint}
682
+ */
521
683
  readonly createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;
684
+ /**
685
+ * {@inheritDoc ITestObjectProvider."type"}
686
+ */
687
+ readonly type = "TestObjectProvider";
522
688
  private _loaderContainerTracker;
523
689
  private _documentServiceFactory;
524
690
  private _urlResolver;
@@ -530,59 +696,192 @@ export declare class TestObjectProvider implements ITestObjectProvider {
530
696
  * @param createFluidEntryPoint - callback to create a fluidEntryPoint, with an optional set of channel name
531
697
  * and factory for TestFluidObject
532
698
  */
533
- constructor(LoaderConstructor: typeof Loader, driver: ITestDriver, createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
699
+ constructor(LoaderConstructor: typeof Loader,
700
+ /**
701
+ * {@inheritDoc ITestObjectProvider.driver}
702
+ */
703
+ driver: ITestDriver,
704
+ /**
705
+ * {@inheritDoc ITestObjectProvider.createFluidEntryPoint}
706
+ */
707
+ createFluidEntryPoint: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
708
+ /**
709
+ * {@inheritDoc ITestObjectProvider.logger}
710
+ */
534
711
  get logger(): EventAndErrorTrackingLogger;
535
- set logger(logger: EventAndErrorTrackingLogger);
712
+ private set logger(value);
713
+ /**
714
+ * {@inheritDoc ITestObjectProvider.documentServiceFactory}
715
+ */
536
716
  get documentServiceFactory(): IDocumentServiceFactory;
717
+ /**
718
+ * {@inheritDoc ITestObjectProvider.urlResolver}
719
+ */
537
720
  get urlResolver(): IUrlResolver;
721
+ /**
722
+ * {@inheritDoc ITestObjectProvider.documentId}
723
+ */
538
724
  get documentId(): string;
725
+ /**
726
+ * {@inheritDoc ITestObjectProvider.defaultCodeDetails}
727
+ */
539
728
  get defaultCodeDetails(): IFluidCodeDetails;
729
+ /**
730
+ * {@inheritDoc ITestObjectProvider.opProcessingController}
731
+ */
540
732
  get opProcessingController(): IOpProcessingController;
541
733
  /**
542
- * Create a loader. Containers created/loaded through this loader will be added to the OpProcessingController.
543
- *
544
- * Only the version of the loader will vary based on compat config. The version of
545
- * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.
546
- *
547
- * @param packageEntries - list of code details and fluidEntryPoint pairs.
734
+ * {@inheritDoc ITestObjectProvider.createLoader}
548
735
  */
549
736
  createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, loaderProps?: Partial<ILoaderProps>): Loader;
550
737
  /**
551
- * Create a container using a default document id and code details.
552
- * Container created is automatically added to the OpProcessingController to manage op flow
553
- *
554
- * Only the version of the loader will vary based on compat config. The version of
555
- * containerRuntime/dataRuntime used in fluidEntryPoint will be used as is from what is passed in.
738
+ * {@inheritDoc ITestObjectProvider.createContainer}
739
+ */
740
+ createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;
741
+ /**
742
+ * {@inheritDoc ITestObjectProvider.loadContainer}
743
+ */
744
+ loadContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>, requestHeader?: IRequestHeader): Promise<IContainer>;
745
+ private resolveContainer;
746
+ /**
747
+ * {@inheritDoc ITestObjectProvider.makeTestLoader}
748
+ */
749
+ makeTestLoader(testContainerConfig?: ITestContainerConfig): Loader;
750
+ /**
751
+ * {@inheritDoc ITestObjectProvider.makeTestContainer}
752
+ */
753
+ makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;
754
+ /**
755
+ * {@inheritDoc ITestObjectProvider.loadTestContainer}
756
+ */
757
+ loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
758
+ /**
759
+ * {@inheritDoc ITestObjectProvider.reset}
760
+ */
761
+ reset(): void;
762
+ /**
763
+ * {@inheritDoc ITestObjectProvider.ensureSynchronized}
764
+ */
765
+ ensureSynchronized(): Promise<void>;
766
+ private waitContainerToCatchUp;
767
+ /**
768
+ * {@inheritDoc ITestObjectProvider.updateDocumentId}
769
+ */
770
+ updateDocumentId(resolvedUrl: IResolvedUrl | undefined): void;
771
+ /**
772
+ * {@inheritDoc ITestObjectProvider.resetLoaderContainerTracker}
773
+ */
774
+ resetLoaderContainerTracker(syncSummarizerClients?: boolean): void;
775
+ }
776
+
777
+ /**
778
+ * Implements {@link ITestObjectProvider}, but uses different versions to create and load containers.
779
+ *
780
+ * @internal
781
+ */
782
+ export declare class TestObjectProviderWithVersionedLoad implements ITestObjectProvider {
783
+ private readonly LoaderConstructorForCreating;
784
+ private readonly LoaderConstructorForLoading;
785
+ private readonly driverForCreating;
786
+ private readonly driverForLoading;
787
+ private readonly createFluidEntryPointForCreating;
788
+ private readonly createFluidEntryPointForLoading;
789
+ /**
790
+ * {@inheritDoc ITestObjectProvider."type"}
791
+ */
792
+ readonly type = "TestObjectProviderWithVersionedLoad";
793
+ private _loaderContainerTracker;
794
+ private _logger;
795
+ private readonly _documentIdStrategy;
796
+ private _documentServiceFactory;
797
+ private _urlResolver;
798
+ private _documentCreated;
799
+ /**
800
+ * `_loadCount` is used to alternate which version we load the next container with.
801
+ * loadCount is even then we will load with the "create" version, and if odd we load with the "load" version.
802
+ * After each test we will reset loadCount to 0 to ensure we always create the first container with the create version.
556
803
  *
557
- * @param packageEntries - list of code details and fluidEntryPoint pairs.
804
+ * Note: This will only affect tests that load a container more than two times.
805
+ */
806
+ private _loadCount;
807
+ constructor(LoaderConstructorForCreating: typeof Loader, LoaderConstructorForLoading: typeof Loader, driverForCreating: ITestDriver, driverForLoading: ITestDriver, createFluidEntryPointForCreating: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint, createFluidEntryPointForLoading: (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint);
808
+ /**
809
+ * {@inheritDoc ITestObjectProvider.logger}
810
+ */
811
+ get logger(): EventAndErrorTrackingLogger;
812
+ /**
813
+ * {@inheritDoc ITestObjectProvider.documentServiceFactory}
814
+ */
815
+ get documentServiceFactory(): IDocumentServiceFactory;
816
+ /**
817
+ * {@inheritDoc ITestObjectProvider.urlResolver}
818
+ */
819
+ get urlResolver(): IUrlResolver;
820
+ /**
821
+ * {@inheritDoc ITestObjectProvider.documentId}
822
+ */
823
+ get documentId(): string;
824
+ /**
825
+ * {@inheritDoc ITestObjectProvider.defaultCodeDetails}
826
+ */
827
+ get defaultCodeDetails(): IFluidCodeDetails;
828
+ /**
829
+ * {@inheritDoc ITestObjectProvider.opProcessingController}
830
+ */
831
+ get opProcessingController(): IOpProcessingController;
832
+ /**
833
+ * {@inheritDoc ITestObjectProvider.driver}
834
+ */
835
+ get driver(): ITestDriver;
836
+ /**
837
+ * {@inheritDoc ITestObjectProvider.createFluidEntryPoint}
838
+ */
839
+ get createFluidEntryPoint(): (testContainerConfig?: ITestContainerConfig) => fluidEntryPoint;
840
+ private createLoaderForCreating;
841
+ private createLoaderForLoading;
842
+ /**
843
+ * {@inheritDoc ITestObjectProvider.createLoader}
844
+ */
845
+ createLoader(packageEntries: Iterable<[IFluidCodeDetails, fluidEntryPoint]>, loaderProps?: Partial<ILoaderProps>): Loader;
846
+ /**
847
+ * {@inheritDoc ITestObjectProvider.createContainer}
558
848
  */
559
849
  createContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>): Promise<IContainer>;
850
+ /**
851
+ * {@inheritDoc ITestObjectProvider.loadContainer}
852
+ */
560
853
  loadContainer(entryPoint: fluidEntryPoint, loaderProps?: Partial<ILoaderProps>, requestHeader?: IRequestHeader): Promise<IContainer>;
561
854
  private resolveContainer;
562
855
  /**
563
- * Make a test loader. Containers created/loaded through this loader will be added to the OpProcessingController.
564
- * The version of the loader/containerRuntime/dataRuntime may vary based on compat config of the current run
565
- * @param testContainerConfig - optional configuring the test Container
856
+ * {@inheritDoc ITestObjectProvider.makeTestLoader}
566
857
  */
567
858
  makeTestLoader(testContainerConfig?: ITestContainerConfig): Loader;
568
859
  /**
569
- * Make a container using a default document id and code details
570
- * Container loaded is automatically added to the OpProcessingController to manage op flow
571
- * @param testContainerConfig - optional configuring the test Container
860
+ * {@inheritDoc ITestObjectProvider.makeTestContainer}
572
861
  */
573
862
  makeTestContainer(testContainerConfig?: ITestContainerConfig): Promise<IContainer>;
574
863
  /**
575
- * Load a container using a default document id and code details.
576
- * IContainer loaded is automatically added to the OpProcessingController to manage op flow
577
- * @param testContainerConfig - optional configuring the test Container
578
- * @param requestHeader - optional headers to be supplied to the loader
864
+ * {@inheritDoc ITestObjectProvider.loadTestContainer}
579
865
  */
580
866
  loadTestContainer(testContainerConfig?: ITestContainerConfig, requestHeader?: IRequestHeader): Promise<IContainer>;
867
+ /**
868
+ * {@inheritDoc ITestObjectProvider.reset}
869
+ */
581
870
  reset(): void;
871
+ /**
872
+ * {@inheritDoc ITestObjectProvider.ensureSynchronized}
873
+ */
582
874
  ensureSynchronized(): Promise<void>;
583
- waitContainerToCatchUp(container: IContainer): Promise<boolean>;
875
+ private waitContainerToCatchUp;
876
+ /**
877
+ * {@inheritDoc ITestObjectProvider.updateDocumentId}
878
+ */
584
879
  updateDocumentId(resolvedUrl: IResolvedUrl | undefined): void;
880
+ /**
881
+ * {@inheritDoc ITestObjectProvider.resetLoaderContainerTracker}
882
+ */
585
883
  resetLoaderContainerTracker(syncSummarizerClients?: boolean): void;
884
+ private nextLoaderShouldCreate;
586
885
  }
587
886
 
588
887
  /**
@@ -595,6 +894,7 @@ export declare class TestObjectProvider implements ITestObjectProvider {
595
894
  * when the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a
596
895
  * specific value.
597
896
  * @returns A new promise that will complete when the given promise resolves or the timeout expires.
897
+ * @internal
598
898
  */
599
899
  export declare function timeoutAwait<T = void>(promise: PromiseLike<T>, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
600
900
 
@@ -606,9 +906,13 @@ export declare function timeoutAwait<T = void>(promise: PromiseLike<T>, timeoutO
606
906
  * @param timeoutOptions - Options that can be used to override the timeout and / or define the behavior when
607
907
  * the promise is not fulfilled. For example, instead of rejecting the promise, resolve with a specific value.
608
908
  * @returns A new promise that will complete when the given executor resolves or the timeout expires.
909
+ * @internal
609
910
  */
610
911
  export declare function timeoutPromise<T = void>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void, timeoutOptions?: TimeoutWithError | TimeoutWithValue<T>): Promise<T>;
611
912
 
913
+ /**
914
+ * @internal
915
+ */
612
916
  export declare interface TimeoutWithError {
613
917
  /**
614
918
  * Timeout duration in milliseconds, if it is great than 0 and not Infinity
@@ -620,6 +924,9 @@ export declare interface TimeoutWithError {
620
924
  errorMsg?: string;
621
925
  }
622
926
 
927
+ /**
928
+ * @internal
929
+ */
623
930
  export declare interface TimeoutWithValue<T = void> {
624
931
  /**
625
932
  * Timeout duration in milliseconds, if it is great than 0 and not Infinity
@@ -651,6 +958,7 @@ export declare interface TimeoutWithValue<T = void> {
651
958
  * - Rejects if failOnContainerClose === true and the container emits a 'closed' event before a 'connected' event.
652
959
  * - Rejects after timeoutOptions.durationMs if timeoutOptions !== undefined and the container does not emit relevant
653
960
  * events, within that timeframe.
961
+ * @internal
654
962
  */
655
963
  export declare function waitForContainerConnection(container: IContainer, failOnContainerClose?: boolean, timeoutOptions?: TimeoutWithError): Promise<void>;
656
964
 
@@ -660,6 +968,7 @@ export declare function waitForContainerConnection(container: IContainer, failOn
660
968
  * the client.
661
969
  * The document storage service that is created in `connectToStorage` is wrapped by calling `wrapDocumentStorageService`
662
970
  * to pass in the `uploadSummaryCb`.
971
+ * @internal
663
972
  */
664
973
  export declare function wrapDocumentService(innerDocService: IDocumentService, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentService;
665
974
 
@@ -669,6 +978,7 @@ export declare function wrapDocumentService(innerDocService: IDocumentService, u
669
978
  * uploaded by the client.
670
979
  * The document service that is created in `createDocumentService` is wrapped by calling `wrapDocumentService` to
671
980
  * pass in the `uploadSummaryCb`.
981
+ * @internal
672
982
  */
673
983
  export declare function wrapDocumentServiceFactory(innerDocServiceFactory: IDocumentServiceFactory, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentServiceFactory;
674
984
 
@@ -676,6 +986,7 @@ export declare function wrapDocumentServiceFactory(innerDocServiceFactory: IDocu
676
986
  * Wraps the given IDocumentStorageService to override the `uploadSummaryWithContext` method. It calls the
677
987
  * `uploadSummaryCb` whenever a summary is uploaded by the client. The summary context can be updated in the
678
988
  * callback before it is uploaded to the server.
989
+ * @internal
679
990
  */
680
991
  export declare function wrapDocumentStorageService(innerDocStorageService: IDocumentStorageService, uploadSummaryCb: (summaryTree: ISummaryTree, context: ISummaryContext) => ISummaryContext): IDocumentStorageService;
681
992