@fluidframework/shared-object-base 2.70.0-361248 → 2.70.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/shared-object-base",
3
- "version": "2.70.0-361248",
3
+ "version": "2.70.0",
4
4
  "description": "Fluid base class for shared distributed data structures",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,30 +69,30 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "2.70.0-361248",
73
- "@fluidframework/container-definitions": "2.70.0-361248",
74
- "@fluidframework/core-interfaces": "2.70.0-361248",
75
- "@fluidframework/core-utils": "2.70.0-361248",
76
- "@fluidframework/datastore": "2.70.0-361248",
77
- "@fluidframework/datastore-definitions": "2.70.0-361248",
78
- "@fluidframework/driver-definitions": "2.70.0-361248",
79
- "@fluidframework/id-compressor": "2.70.0-361248",
80
- "@fluidframework/runtime-definitions": "2.70.0-361248",
81
- "@fluidframework/runtime-utils": "2.70.0-361248",
82
- "@fluidframework/telemetry-utils": "2.70.0-361248",
72
+ "@fluid-internal/client-utils": "~2.70.0",
73
+ "@fluidframework/container-definitions": "~2.70.0",
74
+ "@fluidframework/core-interfaces": "~2.70.0",
75
+ "@fluidframework/core-utils": "~2.70.0",
76
+ "@fluidframework/datastore": "~2.70.0",
77
+ "@fluidframework/datastore-definitions": "~2.70.0",
78
+ "@fluidframework/driver-definitions": "~2.70.0",
79
+ "@fluidframework/id-compressor": "~2.70.0",
80
+ "@fluidframework/runtime-definitions": "~2.70.0",
81
+ "@fluidframework/runtime-utils": "~2.70.0",
82
+ "@fluidframework/telemetry-utils": "~2.70.0",
83
83
  "uuid": "^11.1.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@arethetypeswrong/cli": "^0.17.1",
87
87
  "@biomejs/biome": "~1.9.3",
88
- "@fluid-internal/mocha-test-setup": "2.70.0-361248",
89
- "@fluid-private/test-pairwise-generator": "2.70.0-361248",
88
+ "@fluid-internal/mocha-test-setup": "~2.70.0",
89
+ "@fluid-private/test-pairwise-generator": "~2.70.0",
90
90
  "@fluid-tools/build-cli": "^0.58.3",
91
91
  "@fluidframework/build-common": "^2.0.3",
92
92
  "@fluidframework/build-tools": "^0.58.3",
93
93
  "@fluidframework/eslint-config-fluid": "^6.1.0",
94
94
  "@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@2.63.0",
95
- "@fluidframework/test-runtime-utils": "2.70.0-361248",
95
+ "@fluidframework/test-runtime-utils": "~2.70.0",
96
96
  "@microsoft/api-extractor": "7.52.11",
97
97
  "@types/benchmark": "^2.1.0",
98
98
  "@types/mocha": "^10.0.10",
package/src/handle.ts CHANGED
@@ -5,9 +5,8 @@
5
5
 
6
6
  import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
7
7
  import { FluidObjectHandle } from "@fluidframework/datastore/internal";
8
- // eslint-disable-next-line import/no-deprecated
9
- import type { IFluidDataStoreRuntimeExperimental } from "@fluidframework/datastore-definitions/internal";
10
- import { isFluidHandle } from "@fluidframework/runtime-utils";
8
+ import type { IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions/internal";
9
+ import { isFluidHandle, asLegacyAlpha } from "@fluidframework/runtime-utils/internal";
11
10
 
12
11
  import type { ISharedObject } from "./types.js";
13
12
 
@@ -92,8 +91,7 @@ export class SharedObjectHandle
92
91
  constructor(
93
92
  protected readonly value: ISharedObject,
94
93
  path: string,
95
- // eslint-disable-next-line import/no-deprecated
96
- private readonly runtime: IFluidDataStoreRuntimeExperimental,
94
+ private readonly runtime: IFluidDataStoreRuntime,
97
95
  ) {
98
96
  super(value, path, runtime.IFluidHandleContext);
99
97
  }
@@ -125,7 +123,7 @@ export class SharedObjectHandle
125
123
  // We don't bind handles in staging mode to defer the attachment of any new objects
126
124
  // until we've exited staging mode. This way if we discard changes or a new handle is not present in the final
127
125
  // committed state, we will never end up attaching the discarded object.
128
- if (this.runtime.inStagingMode === true) {
126
+ if (asLegacyAlpha(this.runtime).inStagingMode === true) {
129
127
  return;
130
128
  }
131
129
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/shared-object-base";
9
- export const pkgVersion = "2.70.0-361248";
9
+ export const pkgVersion = "2.70.0";
@@ -178,20 +178,6 @@ export abstract class SharedObjectCore<
178
178
  const { opProcessingHelper, callbacksHelper } = this.setUpSampledTelemetryHelpers();
179
179
  this.opProcessingHelper = opProcessingHelper;
180
180
  this.callbacksHelper = callbacksHelper;
181
-
182
- const processMessagesCore = this.processMessagesCore?.bind(this);
183
- this.processMessagesHelper =
184
- processMessagesCore === undefined
185
- ? (messagesCollection: IRuntimeMessageCollection) =>
186
- processHelper(messagesCollection, this.process.bind(this))
187
- : (messagesCollection: IRuntimeMessageCollection) => {
188
- processMessagesCoreHelper(
189
- messagesCollection,
190
- this.opProcessingHelper,
191
- this.emitInternal.bind(this),
192
- processMessagesCore,
193
- );
194
- };
195
181
  }
196
182
 
197
183
  /**
@@ -409,25 +395,9 @@ export abstract class SharedObjectCore<
409
395
  return;
410
396
  }
411
397
 
412
- /**
413
- * Derived classes must override this to do custom processing on a remote message.
414
- * @param message - The message to process
415
- * @param local - True if the shared object is local
416
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
417
- * For messages from a remote client, this will be undefined.
418
- *
419
- * @deprecated Replaced by {@link SharedObjectCore.processMessagesCore}.
420
- */
421
- protected abstract processCore(
422
- message: ISequencedDocumentMessage,
423
- local: boolean,
424
- localOpMetadata: unknown,
425
- ): void;
426
-
427
398
  /* eslint-disable jsdoc/check-indentation */
428
399
  /**
429
- * Process a 'bunch' of messages for this shared object.
430
- *
400
+ * Derived classes must override this to do custom processing on a 'bunch' of remote messages.
431
401
  * @remarks
432
402
  * A 'bunch' is a group of messages that have the following properties:
433
403
  * - They are all part of the same grouped batch, which entails:
@@ -441,16 +411,7 @@ export abstract class SharedObjectCore<
441
411
  *
442
412
  */
443
413
  /* eslint-enable jsdoc/check-indentation */
444
- protected processMessagesCore?(messagesCollection: IRuntimeMessageCollection): void;
445
-
446
- /**
447
- * Calls {@link SharedObjectCore.processCore} or {@link SharedObjectCore.processMessagesCore} depending on whether
448
- * processMessagesCore is defined. This helper is used to keep the code cleaner while we have to support both these
449
- * function.
450
- */
451
- private readonly processMessagesHelper: (
452
- messagesCollection: IRuntimeMessageCollection,
453
- ) => void;
414
+ protected abstract processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
454
415
 
455
416
  /**
456
417
  * Called when the object has disconnected from the delta stream.
@@ -628,39 +589,6 @@ export abstract class SharedObjectCore<
628
589
  }
629
590
  }
630
591
 
631
- /**
632
- * Handles a message being received from the remote delta server.
633
- * @param message - The message to process
634
- * @param local - Whether the message originated from the local client
635
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
636
- * For messages from a remote client, this will be undefined.
637
- *
638
- * @deprecated Replaced by {@link SharedObjectCore.processMessages}.
639
- */
640
- private process(
641
- message: ISequencedDocumentMessage,
642
- local: boolean,
643
- localOpMetadata: unknown,
644
- ): void {
645
- this.verifyNotClosed(); // This will result in container closure.
646
- this.emitInternal("pre-op", message, local, this);
647
-
648
- this.opProcessingHelper.measure(
649
- (): ICustomData<ProcessTelemetryProperties> => {
650
- this.processCore(message, local, localOpMetadata);
651
- const telemetryProperties: ProcessTelemetryProperties = {
652
- sequenceDifference: message.sequenceNumber - message.referenceSequenceNumber,
653
- };
654
- return {
655
- customData: telemetryProperties,
656
- };
657
- },
658
- local ? "local" : "remote",
659
- );
660
-
661
- this.emitInternal("op", message, local, this);
662
- }
663
-
664
592
  /* eslint-disable jsdoc/check-indentation */
665
593
  /**
666
594
  * Process a bunch of messages for this shared object. A bunch is group of messages that have the following properties:
@@ -677,13 +605,11 @@ export abstract class SharedObjectCore<
677
605
  private processMessages(messagesCollection: IRuntimeMessageCollection): void {
678
606
  this.verifyNotClosed(); // This will result in container closure.
679
607
 
608
+ const { envelope, local, messagesContent } = messagesCollection;
609
+
680
610
  // Decode any handles in the contents before processing the messages.
681
611
  const decodedMessagesContent: IRuntimeMessagesContent[] = [];
682
- for (const {
683
- contents,
684
- localOpMetadata,
685
- clientSequenceNumber,
686
- } of messagesCollection.messagesContent) {
612
+ for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
687
613
  const decodedMessageContent: IRuntimeMessagesContent = {
688
614
  contents: parseHandles(contents, this.serializer),
689
615
  localOpMetadata,
@@ -692,11 +618,36 @@ export abstract class SharedObjectCore<
692
618
  decodedMessagesContent.push(decodedMessageContent);
693
619
  }
694
620
 
695
- const decodedMessagesCollection: IRuntimeMessageCollection = {
696
- ...messagesCollection,
697
- messagesContent: decodedMessagesContent,
621
+ const emitEvents = (event: "pre-op" | "op"): void => {
622
+ for (const { contents, clientSequenceNumber } of decodedMessagesContent) {
623
+ const message: ISequencedDocumentMessage = {
624
+ ...envelope,
625
+ contents,
626
+ clientSequenceNumber,
627
+ };
628
+ this.emitInternal(event, message, local);
629
+ }
698
630
  };
699
- this.processMessagesHelper(decodedMessagesCollection);
631
+
632
+ emitEvents("pre-op");
633
+ this.opProcessingHelper.measure(
634
+ (): ICustomData<ProcessTelemetryProperties> => {
635
+ const decodedMessagesCollection: IRuntimeMessageCollection = {
636
+ envelope,
637
+ local,
638
+ messagesContent: decodedMessagesContent,
639
+ };
640
+ this.processMessagesCore(decodedMessagesCollection);
641
+ const telemetryProperties: ProcessTelemetryProperties = {
642
+ sequenceDifference: envelope.sequenceNumber - envelope.referenceSequenceNumber,
643
+ };
644
+ return {
645
+ customData: telemetryProperties,
646
+ };
647
+ },
648
+ local ? "local" : "remote",
649
+ );
650
+ emitEvents("op");
700
651
  }
701
652
 
702
653
  /**
@@ -1070,75 +1021,3 @@ function isChannel(loadable: IFluidLoadable): loadable is IChannel {
1070
1021
  // This assumes no other IFluidLoadable has an `attributes` field, and thus may not be fully robust.
1071
1022
  return (loadable as IChannel).attributes !== undefined;
1072
1023
  }
1073
-
1074
- /**
1075
- * Utility that processes the given messages in the message collection together by calling `processMessagesCore`.
1076
- * This will be called when {@link SharedObjectCore.processMessagesCore} is defined.
1077
- */
1078
- function processMessagesCoreHelper(
1079
- messagesCollection: IRuntimeMessageCollection,
1080
- opProcessingHelper: SampledTelemetryHelper<void, ProcessTelemetryProperties>,
1081
- emitInternal: (
1082
- event: "pre-op" | "op",
1083
- op: ISequencedDocumentMessage,
1084
- local: boolean,
1085
- ) => void,
1086
- processMessagesCore: (messagesCollection: IRuntimeMessageCollection) => void,
1087
- ): void {
1088
- const { envelope, local, messagesContent } = messagesCollection;
1089
-
1090
- const emitEvents = (
1091
- event: "pre-op" | "op",
1092
- messagesContentForEvent: readonly IRuntimeMessagesContent[],
1093
- ): void => {
1094
- for (const { contents, clientSequenceNumber } of messagesContentForEvent) {
1095
- const message: ISequencedDocumentMessage = {
1096
- ...envelope,
1097
- contents,
1098
- clientSequenceNumber,
1099
- };
1100
- emitInternal(event, message, local);
1101
- }
1102
- };
1103
-
1104
- emitEvents("pre-op", messagesContent);
1105
- opProcessingHelper.measure(
1106
- (): ICustomData<ProcessTelemetryProperties> => {
1107
- processMessagesCore(messagesCollection);
1108
- const telemetryProperties: ProcessTelemetryProperties = {
1109
- sequenceDifference: envelope.sequenceNumber - envelope.referenceSequenceNumber,
1110
- };
1111
- return {
1112
- customData: telemetryProperties,
1113
- };
1114
- },
1115
- local ? "local" : "remote",
1116
- );
1117
- emitEvents("op", messagesContent);
1118
- }
1119
-
1120
- /**
1121
- * Utility that processes the given messages in the message collection one by one by calling `process`. This will
1122
- * be called when {@link SharedObjectCore.processMessagesCore} is not defined.
1123
- */
1124
- function processHelper(
1125
- messagesCollection: IRuntimeMessageCollection,
1126
- process: (
1127
- message: ISequencedDocumentMessage,
1128
- local: boolean,
1129
- localOpMetadata: unknown,
1130
- ) => void,
1131
- ): void {
1132
- const { envelope, local, messagesContent } = messagesCollection;
1133
- for (const { contents, localOpMetadata, clientSequenceNumber } of messagesContent) {
1134
- process(
1135
- {
1136
- ...envelope,
1137
- contents,
1138
- clientSequenceNumber,
1139
- },
1140
- local,
1141
- localOpMetadata,
1142
- );
1143
- }
1144
- }
@@ -203,10 +203,6 @@ class SharedObjectFromKernel<
203
203
  this.#kernel.applyStashedOp(content);
204
204
  }
205
205
 
206
- protected override processCore(): void {
207
- fail("processCore should not be called");
208
- }
209
-
210
206
  protected override processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
211
207
  this.#kernel.processMessagesCore(messagesCollection);
212
208
  }