@fluidframework/test-utils 2.5.0 → 2.10.0-305357

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/test-utils",
3
- "version": "2.5.0",
3
+ "version": "2.10.0-305357",
4
4
  "description": "Utilities for Fluid tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -67,26 +67,26 @@
67
67
  "temp-directory": "nyc/.nyc_output"
68
68
  },
69
69
  "dependencies": {
70
- "@fluid-internal/test-driver-definitions": "~2.5.0",
71
- "@fluidframework/aqueduct": "~2.5.0",
72
- "@fluidframework/container-definitions": "~2.5.0",
73
- "@fluidframework/container-loader": "~2.5.0",
74
- "@fluidframework/container-runtime": "~2.5.0",
75
- "@fluidframework/container-runtime-definitions": "~2.5.0",
76
- "@fluidframework/core-interfaces": "~2.5.0",
77
- "@fluidframework/core-utils": "~2.5.0",
78
- "@fluidframework/datastore": "~2.5.0",
79
- "@fluidframework/datastore-definitions": "~2.5.0",
80
- "@fluidframework/driver-definitions": "~2.5.0",
81
- "@fluidframework/driver-utils": "~2.5.0",
82
- "@fluidframework/local-driver": "~2.5.0",
83
- "@fluidframework/map": "~2.5.0",
84
- "@fluidframework/odsp-driver": "~2.5.0",
85
- "@fluidframework/request-handler": "~2.5.0",
86
- "@fluidframework/routerlicious-driver": "~2.5.0",
87
- "@fluidframework/runtime-definitions": "~2.5.0",
88
- "@fluidframework/runtime-utils": "~2.5.0",
89
- "@fluidframework/telemetry-utils": "~2.5.0",
70
+ "@fluid-internal/test-driver-definitions": "2.10.0-305357",
71
+ "@fluidframework/aqueduct": "2.10.0-305357",
72
+ "@fluidframework/container-definitions": "2.10.0-305357",
73
+ "@fluidframework/container-loader": "2.10.0-305357",
74
+ "@fluidframework/container-runtime": "2.10.0-305357",
75
+ "@fluidframework/container-runtime-definitions": "2.10.0-305357",
76
+ "@fluidframework/core-interfaces": "2.10.0-305357",
77
+ "@fluidframework/core-utils": "2.10.0-305357",
78
+ "@fluidframework/datastore": "2.10.0-305357",
79
+ "@fluidframework/datastore-definitions": "2.10.0-305357",
80
+ "@fluidframework/driver-definitions": "2.10.0-305357",
81
+ "@fluidframework/driver-utils": "2.10.0-305357",
82
+ "@fluidframework/local-driver": "2.10.0-305357",
83
+ "@fluidframework/map": "2.10.0-305357",
84
+ "@fluidframework/odsp-driver": "2.10.0-305357",
85
+ "@fluidframework/request-handler": "2.10.0-305357",
86
+ "@fluidframework/routerlicious-driver": "2.10.0-305357",
87
+ "@fluidframework/runtime-definitions": "2.10.0-305357",
88
+ "@fluidframework/runtime-utils": "2.10.0-305357",
89
+ "@fluidframework/telemetry-utils": "2.10.0-305357",
90
90
  "best-random": "^1.0.0",
91
91
  "debug": "^4.3.4",
92
92
  "mocha": "^10.2.0",
@@ -95,12 +95,12 @@
95
95
  "devDependencies": {
96
96
  "@arethetypeswrong/cli": "^0.16.4",
97
97
  "@biomejs/biome": "~1.9.3",
98
- "@fluid-internal/mocha-test-setup": "~2.5.0",
99
- "@fluid-tools/build-cli": "^0.49.0",
98
+ "@fluid-internal/mocha-test-setup": "2.10.0-305357",
99
+ "@fluid-tools/build-cli": "^0.50.0",
100
100
  "@fluidframework/build-common": "^2.0.3",
101
- "@fluidframework/build-tools": "^0.49.0",
101
+ "@fluidframework/build-tools": "^0.50.0",
102
102
  "@fluidframework/eslint-config-fluid": "^5.4.0",
103
- "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@~2.4.0",
103
+ "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.5.0",
104
104
  "@microsoft/api-extractor": "7.47.8",
105
105
  "@types/debug": "^4.1.5",
106
106
  "@types/diff": "^3.5.1",
@@ -120,7 +120,20 @@
120
120
  "typescript": "~5.4.5"
121
121
  },
122
122
  "typeValidation": {
123
- "broken": {},
123
+ "broken": {
124
+ "Class_TestFluidObject": {
125
+ "backCompat": false
126
+ },
127
+ "ClassStatics_TestFluidObject": {
128
+ "backCompat": false
129
+ },
130
+ "Interface_ITestFluidObject": {
131
+ "backCompat": false
132
+ },
133
+ "Interface_IProvideTestFluidObject": {
134
+ "backCompat": false
135
+ }
136
+ },
124
137
  "entrypoint": "legacy"
125
138
  },
126
139
  "scripts": {
@@ -3,10 +3,19 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IContainer } from "@fluidframework/container-definitions/internal";
6
+ import {
7
+ IContainer,
8
+ IDeltaManager,
9
+ type IDeltaManagerFull,
10
+ } from "@fluidframework/container-definitions/internal";
7
11
  import { ConnectionState } from "@fluidframework/container-loader";
8
12
  import { IResponse } from "@fluidframework/core-interfaces";
9
13
  import { assert } from "@fluidframework/core-utils/internal";
14
+ import type { IDeltaManagerErased } from "@fluidframework/datastore-definitions/internal";
15
+ import type {
16
+ IDocumentMessage,
17
+ ISequencedDocumentMessage,
18
+ } from "@fluidframework/driver-definitions/internal";
10
19
  import { IDataStore } from "@fluidframework/runtime-definitions/internal";
11
20
 
12
21
  import { PromiseExecutor, TimeoutWithError, timeoutPromise } from "./timeoutUtils.js";
@@ -89,3 +98,20 @@ export async function getDataStoreEntryPointBackCompat<T>(dataStore: IDataStore)
89
98
  assert(response.status === 200, "empty request should return data object");
90
99
  return response.value as T;
91
100
  }
101
+
102
+ /**
103
+ * @internal
104
+ */
105
+ export function toIDeltaManagerFull(
106
+ deltaManager:
107
+ | IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>
108
+ | IDeltaManagerErased,
109
+ ): IDeltaManagerFull {
110
+ assert(
111
+ "inbound" in deltaManager && "outbound" in deltaManager,
112
+ "Delta manager does not have inbound/outbound queues.",
113
+ );
114
+ return deltaManager as unknown as
115
+ | IDeltaManagerErased
116
+ | IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> as IDeltaManagerFull;
117
+ }
package/src/index.ts CHANGED
@@ -56,6 +56,7 @@ export {
56
56
  type TimeoutWithValue,
57
57
  } from "./timeoutUtils.js";
58
58
  export {
59
+ toIDeltaManagerFull,
59
60
  waitForContainerConnection,
60
61
  getContainerEntryPointBackCompat,
61
62
  getDataStoreEntryPointBackCompat,
@@ -22,7 +22,7 @@ import {
22
22
  } from "@fluidframework/driver-definitions/internal";
23
23
  import { canBeCoalescedByService } from "@fluidframework/driver-utils/internal";
24
24
 
25
- import { waitForContainerConnection } from "./containerUtils.js";
25
+ import { toIDeltaManagerFull, waitForContainerConnection } from "./containerUtils.js";
26
26
  import { debug } from "./debug.js";
27
27
  import { IOpProcessingController } from "./testObjectProvider.js";
28
28
  import { timeoutAwait, timeoutPromise } from "./timeoutUtils.js";
@@ -145,7 +145,8 @@ export class LoaderContainerTracker implements IOpProcessingController {
145
145
  * @param record - the record to update the trailing op information
146
146
  */
147
147
  private trackTrailingNoOps(container: IContainer, record: ContainerRecord) {
148
- container.deltaManager.outbound.on("op", (messages) => {
148
+ const deltaManagerFull = toIDeltaManagerFull(container.deltaManager);
149
+ deltaManagerFull.outbound.on("op", (messages) => {
149
150
  for (const msg of messages) {
150
151
  if (canBeCoalescedByService(msg)) {
151
152
  // Track the NoOp that was sent.
@@ -161,7 +162,7 @@ export class LoaderContainerTracker implements IOpProcessingController {
161
162
  }
162
163
  });
163
164
 
164
- container.deltaManager.inbound.on("push", (message) => {
165
+ deltaManagerFull.inbound.on("push", (message) => {
165
166
  // Received the no op back, update the record if we are tracking
166
167
  if (
167
168
  canBeCoalescedByService(message) &&
@@ -458,12 +459,12 @@ export class LoaderContainerTracker implements IOpProcessingController {
458
459
  return new Promise<void>((resolve) => {
459
460
  const handler = () => {
460
461
  containersToApply.map((c) => {
461
- c.deltaManager.inbound.off("push", handler);
462
+ toIDeltaManagerFull(c.deltaManager).inbound.off("push", handler);
462
463
  });
463
464
  resolve();
464
465
  };
465
466
  containersToApply.map((c) => {
466
- c.deltaManager.inbound.on("push", handler);
467
+ toIDeltaManagerFull(c.deltaManager).inbound.on("push", handler);
467
468
  });
468
469
  });
469
470
  }
@@ -482,8 +483,9 @@ export class LoaderContainerTracker implements IOpProcessingController {
482
483
  );
483
484
  if (record?.paused === true) {
484
485
  debugWait(`${record.index}: container resumed`);
485
- container.deltaManager.inbound.resume();
486
- container.deltaManager.outbound.resume();
486
+ const deltaManagerFull = toIDeltaManagerFull(container.deltaManager);
487
+ deltaManagerFull.inbound.resume();
488
+ deltaManagerFull.outbound.resume();
487
489
  resumed.push(container);
488
490
  record.paused = false;
489
491
  }
@@ -526,12 +528,13 @@ export class LoaderContainerTracker implements IOpProcessingController {
526
528
  */
527
529
  private async pauseContainer(container: IContainer, record: ContainerRecord) {
528
530
  debugWait(`${record.index}: pausing container`);
529
- assert(!container.deltaManager.outbound.paused, "Container should not be paused yet");
530
- assert(!container.deltaManager.inbound.paused, "Container should not be paused yet");
531
+ const deltaManagerFull = toIDeltaManagerFull(container.deltaManager);
532
+ assert(!deltaManagerFull.outbound.paused, "Container should not be paused yet");
533
+ assert(!deltaManagerFull.inbound.paused, "Container should not be paused yet");
531
534
 
532
535
  // Pause outbound
533
536
  debugWait(`${record.index}: pausing container outbound queues`);
534
- await container.deltaManager.outbound.pause();
537
+ await deltaManagerFull.outbound.pause();
535
538
 
536
539
  // Ensure the container is connected first.
537
540
  if (container.connectionState !== ConnectionState.Connected) {
@@ -542,7 +545,7 @@ export class LoaderContainerTracker implements IOpProcessingController {
542
545
  // Check if the container is in write mode
543
546
  if (!container.deltaManager.active) {
544
547
  let proposalP: Promise<boolean> | undefined;
545
- if (container.deltaManager.outbound.idle) {
548
+ if (deltaManagerFull.outbound.idle) {
546
549
  // Need to generate an op to force write mode
547
550
  debugWait(`${record.index}: container force write connection`);
548
551
  const maybeContainer = container as Partial<IContainer>;
@@ -556,11 +559,11 @@ export class LoaderContainerTracker implements IOpProcessingController {
556
559
 
557
560
  // Wait for nack
558
561
  debugWait(`${record.index}: Wait for container disconnect`);
559
- container.deltaManager.outbound.resume();
562
+ deltaManagerFull.outbound.resume();
560
563
  await new Promise<void>((resolve) => container.once("disconnected", resolve));
561
564
  const accepted = proposalP ? await proposalP : false;
562
565
  assert(!accepted, "A proposal in read mode should be rejected");
563
- await container.deltaManager.outbound.pause();
566
+ await deltaManagerFull.outbound.pause();
564
567
 
565
568
  // Ensure the container is reconnect.
566
569
  if (container.connectionState !== ConnectionState.Connected) {
@@ -572,7 +575,7 @@ export class LoaderContainerTracker implements IOpProcessingController {
572
575
  debugWait(`${record.index}: pausing container inbound queues`);
573
576
 
574
577
  // Pause inbound
575
- await container.deltaManager.inbound.pause();
578
+ await deltaManagerFull.inbound.pause();
576
579
 
577
580
  debugWait(`${record.index}: container paused`);
578
581
 
@@ -588,7 +591,10 @@ export class LoaderContainerTracker implements IOpProcessingController {
588
591
  * Pausing will switch the container to write mode. See `pauseProcessing`
589
592
  */
590
593
  public async processIncoming(...containers: IContainer[]) {
591
- return this.processQueue(containers, (container) => container.deltaManager.inbound);
594
+ return this.processQueue(
595
+ containers,
596
+ (container) => toIDeltaManagerFull(container.deltaManager).inbound,
597
+ );
592
598
  }
593
599
 
594
600
  /**
@@ -599,7 +605,10 @@ export class LoaderContainerTracker implements IOpProcessingController {
599
605
  * Pausing will switch the container to write mode. See `pauseProcessing`
600
606
  */
601
607
  public async processOutgoing(...containers: IContainer[]) {
602
- return this.processQueue(containers, (container) => container.deltaManager.outbound);
608
+ return this.processQueue(
609
+ containers,
610
+ (container) => toIDeltaManagerFull(container.deltaManager).outbound,
611
+ );
603
612
  }
604
613
 
605
614
  /**
@@ -678,12 +687,13 @@ export class LoaderContainerTracker implements IOpProcessingController {
678
687
  }
679
688
  };
680
689
 
681
- container.deltaManager.outbound.on("op", outHandler);
682
- container.deltaManager.inbound.on("push", inHandler);
690
+ const deltaManagerFull = toIDeltaManagerFull(container.deltaManager);
691
+ deltaManagerFull.outbound.on("op", outHandler);
692
+ deltaManagerFull.inbound.on("push", inHandler);
683
693
 
684
694
  return () => {
685
- container.deltaManager.outbound.off("op", outHandler);
686
- container.deltaManager.inbound.off("push", inHandler);
695
+ deltaManagerFull.outbound.off("op", outHandler);
696
+ deltaManagerFull.inbound.off("push", inHandler);
687
697
  };
688
698
  }
689
699
 
@@ -726,7 +736,8 @@ export class LoaderContainerTracker implements IOpProcessingController {
726
736
  }
727
737
  };
728
738
  debugOp(`${index}: ADD: clientId: ${container.clientId}`);
729
- container.deltaManager.outbound.on("op", (messages) => {
739
+ const deltaManagerFull = toIDeltaManagerFull(container.deltaManager);
740
+ deltaManagerFull.outbound.on("op", (messages) => {
730
741
  for (const msg of messages) {
731
742
  debugOp(
732
743
  `${index}: OUT: ` +
@@ -749,8 +760,8 @@ export class LoaderContainerTracker implements IOpProcessingController {
749
760
  );
750
761
  };
751
762
  };
752
- container.deltaManager.inbound.on("push", getInboundHandler("IN "));
753
- container.deltaManager.inbound.on("op", getInboundHandler("OP "));
763
+ deltaManagerFull.inbound.on("push", getInboundHandler("IN "));
764
+ deltaManagerFull.inbound.on("op", getInboundHandler("OP "));
754
765
  container.deltaManager.on("connect", (details) => {
755
766
  debugOp(`${index}: CON: clientId: ${details.clientId}`);
756
767
  });
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/test-utils";
9
- export const pkgVersion = "2.5.0";
9
+ export const pkgVersion = "2.10.0-305357";