@fluidframework/test-utils 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488

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 (146) hide show
  1. package/.eslintrc.cjs +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +34 -0
  4. package/README.md +1 -1
  5. package/api-extractor-cjs.json +8 -0
  6. package/api-extractor-lint.json +1 -1
  7. package/api-extractor.json +1 -1
  8. package/api-report/test-utils.api.md +18 -6
  9. package/dist/DriverWrappers.d.ts +3 -0
  10. package/dist/DriverWrappers.d.ts.map +1 -1
  11. package/dist/DriverWrappers.js +3 -0
  12. package/dist/DriverWrappers.js.map +1 -1
  13. package/dist/TestSummaryUtils.d.ts +7 -2
  14. package/dist/TestSummaryUtils.d.ts.map +1 -1
  15. package/dist/TestSummaryUtils.js +14 -12
  16. package/dist/TestSummaryUtils.js.map +1 -1
  17. package/dist/containerUtils.d.ts +1 -1
  18. package/dist/containerUtils.d.ts.map +1 -1
  19. package/dist/containerUtils.js +2 -2
  20. package/dist/containerUtils.js.map +1 -1
  21. package/dist/debug.js +2 -2
  22. package/dist/debug.js.map +1 -1
  23. package/dist/index.d.ts +14 -14
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +44 -43
  26. package/dist/index.js.map +1 -1
  27. package/dist/loaderContainerTracker.d.ts +5 -1
  28. package/dist/loaderContainerTracker.d.ts.map +1 -1
  29. package/dist/loaderContainerTracker.js +13 -13
  30. package/dist/loaderContainerTracker.js.map +1 -1
  31. package/dist/localLoader.d.ts +1 -1
  32. package/dist/localLoader.d.ts.map +1 -1
  33. package/dist/localLoader.js +2 -2
  34. package/dist/localLoader.js.map +1 -1
  35. package/dist/package.json +3 -0
  36. package/dist/packageVersion.d.ts +1 -1
  37. package/dist/packageVersion.js +1 -1
  38. package/dist/packageVersion.js.map +1 -1
  39. package/dist/test-utils-alpha.d.ts +3 -1
  40. package/dist/test-utils-beta.d.ts +5 -1
  41. package/dist/test-utils-public.d.ts +5 -1
  42. package/dist/test-utils-untrimmed.d.ts +40 -9
  43. package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
  44. package/dist/testContainerRuntimeFactory.js +9 -2
  45. package/dist/testContainerRuntimeFactory.js.map +1 -1
  46. package/dist/testFluidObject.d.ts +1 -1
  47. package/dist/testFluidObject.d.ts.map +1 -1
  48. package/dist/testFluidObject.js.map +1 -1
  49. package/dist/testObjectProvider.d.ts +34 -11
  50. package/dist/testObjectProvider.d.ts.map +1 -1
  51. package/dist/testObjectProvider.js +71 -38
  52. package/dist/testObjectProvider.js.map +1 -1
  53. package/dist/timeoutUtils.d.ts.map +1 -1
  54. package/dist/timeoutUtils.js.map +1 -1
  55. package/dist/tsdoc-metadata.json +1 -1
  56. package/lib/DriverWrappers.d.ts +35 -0
  57. package/lib/DriverWrappers.d.ts.map +1 -0
  58. package/lib/DriverWrappers.js +54 -0
  59. package/lib/DriverWrappers.js.map +1 -0
  60. package/lib/TestConfigs.d.ts +23 -0
  61. package/lib/TestConfigs.d.ts.map +1 -0
  62. package/lib/TestConfigs.js +24 -0
  63. package/lib/TestConfigs.js.map +1 -0
  64. package/lib/TestSummaryUtils.d.ts +66 -0
  65. package/lib/TestSummaryUtils.d.ts.map +1 -0
  66. package/lib/TestSummaryUtils.js +153 -0
  67. package/lib/TestSummaryUtils.js.map +1 -0
  68. package/lib/containerUtils.d.ts +46 -0
  69. package/lib/containerUtils.d.ts.map +1 -0
  70. package/lib/containerUtils.js +79 -0
  71. package/lib/containerUtils.js.map +1 -0
  72. package/lib/debug.d.ts +7 -0
  73. package/lib/debug.d.ts.map +1 -0
  74. package/lib/debug.js +9 -0
  75. package/lib/debug.js.map +1 -0
  76. package/lib/index.d.ts +19 -0
  77. package/lib/index.d.ts.map +1 -0
  78. package/lib/index.js +18 -0
  79. package/lib/index.js.map +1 -0
  80. package/lib/interfaces.d.ts +25 -0
  81. package/lib/interfaces.d.ts.map +1 -0
  82. package/lib/interfaces.js +6 -0
  83. package/lib/interfaces.js.map +1 -0
  84. package/lib/loaderContainerTracker.d.ts +148 -0
  85. package/lib/loaderContainerTracker.d.ts.map +1 -0
  86. package/lib/loaderContainerTracker.js +631 -0
  87. package/lib/loaderContainerTracker.js.map +1 -0
  88. package/lib/localCodeLoader.d.ts +31 -0
  89. package/lib/localCodeLoader.d.ts.map +1 -0
  90. package/lib/localCodeLoader.js +73 -0
  91. package/lib/localCodeLoader.js.map +1 -0
  92. package/lib/localLoader.d.ts +26 -0
  93. package/lib/localLoader.d.ts.map +1 -0
  94. package/lib/localLoader.js +37 -0
  95. package/lib/localLoader.js.map +1 -0
  96. package/lib/packageVersion.d.ts +9 -0
  97. package/lib/packageVersion.d.ts.map +1 -0
  98. package/lib/packageVersion.js +9 -0
  99. package/lib/packageVersion.js.map +1 -0
  100. package/lib/retry.d.ts +18 -0
  101. package/lib/retry.d.ts.map +1 -0
  102. package/lib/retry.js +37 -0
  103. package/lib/retry.js.map +1 -0
  104. package/lib/test/timeoutUtils.spec.js +165 -0
  105. package/lib/test/timeoutUtils.spec.js.map +1 -0
  106. package/lib/test/types/validateTestUtilsPrevious.generated.js +90 -0
  107. package/lib/test/types/validateTestUtilsPrevious.generated.js.map +1 -0
  108. package/lib/test-utils-alpha.d.ts +309 -0
  109. package/lib/test-utils-beta.d.ts +208 -0
  110. package/lib/test-utils-public.d.ts +208 -0
  111. package/lib/test-utils-untrimmed.d.ts +1046 -0
  112. package/lib/testContainerRuntimeFactory.d.ts +46 -0
  113. package/lib/testContainerRuntimeFactory.d.ts.map +1 -0
  114. package/lib/testContainerRuntimeFactory.js +113 -0
  115. package/lib/testContainerRuntimeFactory.js.map +1 -0
  116. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +23 -0
  117. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -0
  118. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js +28 -0
  119. package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -0
  120. package/lib/testFluidObject.d.ts +92 -0
  121. package/lib/testFluidObject.d.ts.map +1 -0
  122. package/lib/testFluidObject.js +159 -0
  123. package/lib/testFluidObject.js.map +1 -0
  124. package/lib/testObjectProvider.d.ts +435 -0
  125. package/lib/testObjectProvider.d.ts.map +1 -0
  126. package/lib/testObjectProvider.js +636 -0
  127. package/lib/testObjectProvider.js.map +1 -0
  128. package/lib/timeoutUtils.d.ts +60 -0
  129. package/lib/timeoutUtils.d.ts.map +1 -0
  130. package/lib/timeoutUtils.js +164 -0
  131. package/lib/timeoutUtils.js.map +1 -0
  132. package/package.json +99 -37
  133. package/src/DriverWrappers.ts +3 -0
  134. package/src/TestSummaryUtils.ts +7 -6
  135. package/src/containerUtils.ts +1 -1
  136. package/src/debug.ts +1 -1
  137. package/src/index.ts +19 -14
  138. package/src/loaderContainerTracker.ts +6 -5
  139. package/src/localLoader.ts +1 -1
  140. package/src/packageVersion.ts +1 -1
  141. package/src/testContainerRuntimeFactory.ts +12 -2
  142. package/src/testFluidObject.ts +1 -1
  143. package/src/testObjectProvider.ts +99 -34
  144. package/src/timeoutUtils.ts +1 -0
  145. package/tsconfig.cjs.json +7 -0
  146. package/tsconfig.json +3 -4
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
6
+ import { ISharedMap } from "@fluidframework/map";
7
+ import { IFluidDataStoreContext, IFluidDataStoreChannel } from "@fluidframework/runtime-definitions";
8
+ import { IFluidLoadable } from "@fluidframework/core-interfaces";
9
+ /**
10
+ * @alpha
11
+ */
12
+ export interface IProvideTestFluidObject {
13
+ readonly ITestFluidObject: ITestFluidObject;
14
+ }
15
+ /**
16
+ * @alpha
17
+ */
18
+ export interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {
19
+ root: ISharedMap;
20
+ readonly runtime: IFluidDataStoreRuntime;
21
+ readonly channel: IFluidDataStoreChannel;
22
+ readonly context: IFluidDataStoreContext;
23
+ getSharedObject<T = any>(id: string): Promise<T>;
24
+ }
25
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,uBAAuB,EAAE,cAAc;IAChF,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACjD"}
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidDataStoreRuntime } from \"@fluidframework/datastore-definitions\";\nimport { ISharedMap } from \"@fluidframework/map\";\nimport {\n\tIFluidDataStoreContext,\n\tIFluidDataStoreChannel,\n} from \"@fluidframework/runtime-definitions\";\nimport { IFluidLoadable } from \"@fluidframework/core-interfaces\";\n\n/**\n * @alpha\n */\nexport interface IProvideTestFluidObject {\n\treadonly ITestFluidObject: ITestFluidObject;\n}\n\n/**\n * @alpha\n */\nexport interface ITestFluidObject extends IProvideTestFluidObject, IFluidLoadable {\n\troot: ISharedMap;\n\treadonly runtime: IFluidDataStoreRuntime;\n\treadonly channel: IFluidDataStoreChannel;\n\treadonly context: IFluidDataStoreContext;\n\tgetSharedObject<T = any>(id: string): Promise<T>;\n}\n"]}
@@ -0,0 +1,148 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IContainer, IHostLoader } from "@fluidframework/container-definitions";
6
+ import { IOpProcessingController } from "./testObjectProvider.js";
7
+ /**
8
+ * @alpha
9
+ */
10
+ export declare class LoaderContainerTracker implements IOpProcessingController {
11
+ private readonly syncSummarizerClients;
12
+ private readonly containers;
13
+ private lastProposalSeqNum;
14
+ constructor(syncSummarizerClients?: boolean);
15
+ /**
16
+ * Add a loader to start to track any container created from them
17
+ * @param loader - loader to start tracking any container created.
18
+ */
19
+ add<LoaderType extends IHostLoader>(loader: LoaderType): void;
20
+ /**
21
+ * Utility function to add container to be tracked.
22
+ *
23
+ * @param container - container to add
24
+ */
25
+ private addContainer;
26
+ /**
27
+ * Keep track of the trailing NoOp that was sent so we can discount them in the clientSequenceNumber tracking.
28
+ * The server might coalesce them with other ops, or a single NoOp, or delay it if it don't think it is necessary.
29
+ *
30
+ * @param container - the container to track
31
+ * @param record - the record to update the trailing op information
32
+ */
33
+ private trackTrailingNoOps;
34
+ private trackLastProposal;
35
+ /**
36
+ * Reset the tracker, closing all containers and stop tracking them.
37
+ */
38
+ reset(): void;
39
+ /**
40
+ * Make sure all the tracked containers are synchronized.
41
+ *
42
+ * No isDirty (non-readonly) containers
43
+ * No extra clientId in quorum of any container that is not tracked and still opened.
44
+ * - i.e. no pending Join/Leave message.
45
+ * No unresolved proposal (minSeqNum \>= lastProposalSeqNum)
46
+ * lastSequenceNumber of all container is the same
47
+ * clientSequenceNumberObserved is the same as clientSequenceNumber sent
48
+ * - this overlaps with !isDirty, but include task scheduler ops.
49
+ * - Trailing NoOp is tracked and don't count as pending ops.
50
+ *
51
+ * Containers that are already pause will resume process and paused again once
52
+ * everything is synchronized. Containers that aren't paused will remain unpaused when this
53
+ * function returns.
54
+ */
55
+ ensureSynchronized(...containers: IContainer[]): Promise<void>;
56
+ /**
57
+ * Utility to calculate the set of clientId per container in quorum that is NOT associated with
58
+ * any container we tracked, indicating there is a pending join or leave op that we need to wait.
59
+ *
60
+ * @param containersToApply - the set of containers to check
61
+ */
62
+ private getPendingClients;
63
+ /**
64
+ * Utility to check synchronization based on sequence number
65
+ * See ensureSynchronized for more detail
66
+ *
67
+ * @param containersToApply - the set of containers to check
68
+ */
69
+ private needSequenceNumberSynchronize;
70
+ private containerIndexStrings;
71
+ /**
72
+ * Utility to wait for any clientId in quorum that is NOT associated with any container we
73
+ * tracked, indicating there is a pending join or leave op that we need to wait.
74
+ *
75
+ * Note that this function doesn't account for container that got added after we started waiting
76
+ *
77
+ * @param containersToApply - the set of containers to wait for any inbound ops for
78
+ */
79
+ private waitForPendingClients;
80
+ /**
81
+ * Utility to wait for any inbound ops from a set of containers
82
+ * @param containersToApply - the set of containers to wait for any inbound ops for
83
+ */
84
+ private waitForAnyInboundOps;
85
+ /**
86
+ * Resume all queue activities on all paused tracked containers and return them
87
+ */
88
+ resumeProcessing(...containers: IContainer[]): IContainer[];
89
+ /**
90
+ * Pause all queue activities on the containers given, or all tracked containers
91
+ * Any containers given that is not tracked will be ignored.
92
+ *
93
+ * When a container is paused, it is assumed that we want fine grain control over op
94
+ * sequencing. This function will prepare the container and force it into write mode to
95
+ * avoid missing join messages or change the sequence of event when switching from read to
96
+ * write mode.
97
+ */
98
+ pauseProcessing(...containers: IContainer[]): Promise<void>;
99
+ /**
100
+ * When a container is paused, it is assumed that we want fine grain control over op
101
+ * sequencing. This function will prepare the container and force it into write mode to
102
+ * avoid missing join messages or change the sequence of event when switching from read to
103
+ * write mode.
104
+ *
105
+ * @param container - the container to pause
106
+ * @param record - the record for the container
107
+ */
108
+ private pauseContainer;
109
+ /**
110
+ * Pause all queue activities on all tracked containers, and resume only
111
+ * inbound to process ops until it is idle. All queues are left in the paused state
112
+ * after the function.
113
+ *
114
+ * Pausing will switch the container to write mode. See `pauseProcessing`
115
+ */
116
+ processIncoming(...containers: IContainer[]): Promise<void>;
117
+ /**
118
+ * Pause all queue activities on all tracked containers, and resume only
119
+ * outbound to process ops until it is idle. All queues are left in the paused state
120
+ * after the function.
121
+ *
122
+ * Pausing will switch the container to write mode. See `pauseProcessing`
123
+ */
124
+ processOutgoing(...containers: IContainer[]): Promise<void>;
125
+ /**
126
+ * Implementation of processIncoming and processOutgoing
127
+ */
128
+ private processQueue;
129
+ /**
130
+ * Utility to set up listener to track the outbound ops until it round trip back
131
+ * Returns a function to remove the handler after it is done.
132
+ *
133
+ * @param container - the container to setup
134
+ * @param inflightTracker - a map to track the clientSequenceNumber per container it expect to get ops back
135
+ */
136
+ private setupInOutTracker;
137
+ /**
138
+ * Setup debug traces for connection and ops
139
+ */
140
+ private setupTrace;
141
+ /**
142
+ * Filter out the opened containers based on param.
143
+ * @param containers - The container to filter to. If the array is empty, it means don't filter and return
144
+ * all open containers.
145
+ */
146
+ private getContainers;
147
+ }
148
+ //# sourceMappingURL=loaderContainerTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaderContainerTracker.d.ts","sourceRoot":"","sources":["../src/loaderContainerTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAe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