@fluidframework/shared-object-base 2.0.2 → 2.1.0-276326

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 (48) hide show
  1. package/api-extractor/api-extractor.legacy.json +4 -0
  2. package/api-report/shared-object-base.beta.api.md +0 -24
  3. package/api-report/{shared-object-base.alpha.api.md → shared-object-base.legacy.alpha.api.md} +0 -24
  4. package/api-report/shared-object-base.public.api.md +0 -24
  5. package/dist/legacy.d.ts +1 -1
  6. package/dist/packageVersion.d.ts +1 -1
  7. package/dist/packageVersion.d.ts.map +1 -1
  8. package/dist/packageVersion.js +1 -1
  9. package/dist/packageVersion.js.map +1 -1
  10. package/dist/serializer.d.ts +1 -0
  11. package/dist/serializer.d.ts.map +1 -1
  12. package/dist/serializer.js.map +1 -1
  13. package/dist/sharedObject.d.ts +3 -0
  14. package/dist/sharedObject.d.ts.map +1 -1
  15. package/dist/sharedObject.js +12 -2
  16. package/dist/sharedObject.js.map +1 -1
  17. package/dist/types.d.ts +2 -0
  18. package/dist/types.d.ts.map +1 -1
  19. package/dist/types.js.map +1 -1
  20. package/dist/utils.d.ts +2 -0
  21. package/dist/utils.d.ts.map +1 -1
  22. package/dist/utils.js +2 -0
  23. package/dist/utils.js.map +1 -1
  24. package/lib/legacy.d.ts +1 -1
  25. package/lib/packageVersion.d.ts +1 -1
  26. package/lib/packageVersion.d.ts.map +1 -1
  27. package/lib/packageVersion.js +1 -1
  28. package/lib/packageVersion.js.map +1 -1
  29. package/lib/serializer.d.ts +1 -0
  30. package/lib/serializer.d.ts.map +1 -1
  31. package/lib/serializer.js.map +1 -1
  32. package/lib/sharedObject.d.ts +3 -0
  33. package/lib/sharedObject.d.ts.map +1 -1
  34. package/lib/sharedObject.js +12 -2
  35. package/lib/sharedObject.js.map +1 -1
  36. package/lib/types.d.ts +2 -0
  37. package/lib/types.d.ts.map +1 -1
  38. package/lib/types.js.map +1 -1
  39. package/lib/utils.d.ts +2 -0
  40. package/lib/utils.d.ts.map +1 -1
  41. package/lib/utils.js +2 -0
  42. package/lib/utils.js.map +1 -1
  43. package/package.json +25 -21
  44. package/src/packageVersion.ts +1 -1
  45. package/src/serializer.ts +1 -0
  46. package/src/sharedObject.ts +35 -8
  47. package/src/types.ts +2 -0
  48. package/src/utils.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/shared-object-base",
3
- "version": "2.0.2",
3
+ "version": "2.1.0-276326",
4
4
  "description": "Fluid base class for shared distributed data structures",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -67,30 +67,30 @@
67
67
  "temp-directory": "nyc/.nyc_output"
68
68
  },
69
69
  "dependencies": {
70
- "@fluid-internal/client-utils": "~2.0.2",
71
- "@fluidframework/container-definitions": "~2.0.2",
72
- "@fluidframework/container-runtime": "~2.0.2",
73
- "@fluidframework/core-interfaces": "~2.0.2",
74
- "@fluidframework/core-utils": "~2.0.2",
75
- "@fluidframework/datastore": "~2.0.2",
76
- "@fluidframework/datastore-definitions": "~2.0.2",
77
- "@fluidframework/driver-definitions": "~2.0.2",
78
- "@fluidframework/runtime-definitions": "~2.0.2",
79
- "@fluidframework/runtime-utils": "~2.0.2",
80
- "@fluidframework/telemetry-utils": "~2.0.2",
70
+ "@fluid-internal/client-utils": "2.1.0-276326",
71
+ "@fluidframework/container-definitions": "2.1.0-276326",
72
+ "@fluidframework/container-runtime": "2.1.0-276326",
73
+ "@fluidframework/core-interfaces": "2.1.0-276326",
74
+ "@fluidframework/core-utils": "2.1.0-276326",
75
+ "@fluidframework/datastore": "2.1.0-276326",
76
+ "@fluidframework/datastore-definitions": "2.1.0-276326",
77
+ "@fluidframework/driver-definitions": "2.1.0-276326",
78
+ "@fluidframework/runtime-definitions": "2.1.0-276326",
79
+ "@fluidframework/runtime-utils": "2.1.0-276326",
80
+ "@fluidframework/telemetry-utils": "2.1.0-276326",
81
81
  "uuid": "^9.0.0"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@arethetypeswrong/cli": "^0.15.2",
85
85
  "@biomejs/biome": "^1.7.3",
86
- "@fluid-internal/mocha-test-setup": "~2.0.2",
87
- "@fluid-private/test-pairwise-generator": "~2.0.2",
86
+ "@fluid-internal/mocha-test-setup": "2.1.0-276326",
87
+ "@fluid-private/test-pairwise-generator": "2.1.0-276326",
88
88
  "@fluid-tools/build-cli": "^0.39.0",
89
89
  "@fluidframework/build-common": "^2.0.3",
90
90
  "@fluidframework/build-tools": "^0.39.0",
91
91
  "@fluidframework/eslint-config-fluid": "^5.3.0",
92
- "@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@2.0.0-rc.4.0.0",
93
- "@fluidframework/test-runtime-utils": "~2.0.2",
92
+ "@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@2.0.0-rc.5.0.0",
93
+ "@fluidframework/test-runtime-utils": "2.1.0-276326",
94
94
  "@microsoft/api-extractor": "^7.45.1",
95
95
  "@types/benchmark": "^2.1.0",
96
96
  "@types/mocha": "^9.1.1",
@@ -117,13 +117,15 @@
117
117
  },
118
118
  "scripts": {
119
119
  "api": "fluid-build . --task api",
120
- "api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
121
- "api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
120
+ "api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
121
+ "api-extractor:esnext": "flub generate entrypoints --outDir ./lib --node10TypeCompat",
122
122
  "bench": "ts-node bench/src/index.ts",
123
123
  "build": "fluid-build . --task build",
124
124
  "build:commonjs": "fluid-build . --task commonjs",
125
125
  "build:compile": "fluid-build . --task compile",
126
- "build:docs": "api-extractor run --local",
126
+ "build:docs": "concurrently \"npm:build:docs:*\"",
127
+ "build:docs:current": "api-extractor run --local",
128
+ "build:docs:legacy": "api-extractor run --local --config api-extractor/api-extractor.legacy.json",
127
129
  "build:esnext": "tsc --project ./tsconfig.json",
128
130
  "build:genver": "gen-version",
129
131
  "build:test": "npm run build:test:esm && npm run build:test:cjs",
@@ -139,7 +141,9 @@
139
141
  "check:exports:esm:public": "api-extractor run --config api-extractor/api-extractor-lint-public.esm.json",
140
142
  "check:format": "npm run check:biome",
141
143
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
142
- "ci:build:docs": "api-extractor run",
144
+ "ci:build:docs": "concurrently \"npm:ci:build:docs:*\"",
145
+ "ci:build:docs:current": "api-extractor run",
146
+ "ci:build:docs:legacy": "api-extractor run --config api-extractor/api-extractor.legacy.json",
143
147
  "clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
144
148
  "eslint": "eslint --format stylish src",
145
149
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
@@ -155,7 +159,7 @@
155
159
  "test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
156
160
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
157
161
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
158
- "typetests:gen": "flub generate typetests --dir . -v --publicFallback",
162
+ "typetests:gen": "flub generate typetests --dir . -v",
159
163
  "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
160
164
  }
161
165
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/shared-object-base";
9
- export const pkgVersion = "2.0.2";
9
+ export const pkgVersion = "2.1.0-276326";
package/src/serializer.ts CHANGED
@@ -21,6 +21,7 @@ import {
21
21
  import { RemoteFluidObjectHandle } from "./remoteObjectHandle.js";
22
22
 
23
23
  /**
24
+ * @legacy
24
25
  * @alpha
25
26
  */
26
27
  export interface IFluidSerializer {
@@ -43,6 +43,7 @@ import {
43
43
  createChildLogger,
44
44
  loggerToMonitoringContext,
45
45
  tagCodeArtifacts,
46
+ type ICustomData,
46
47
  } from "@fluidframework/telemetry-utils/internal";
47
48
  import { v4 as uuid } from "uuid";
48
49
 
@@ -52,8 +53,18 @@ import { SummarySerializer } from "./summarySerializer.js";
52
53
  import { ISharedObject, ISharedObjectEvents } from "./types.js";
53
54
  import { makeHandlesSerializable, parseHandles } from "./utils.js";
54
55
 
56
+ /**
57
+ * Custom telemetry properties used in {@link SharedObjectCore} to instantiate {@link TelemetryEventBatcher} class.
58
+ * This interface is used to define the properties that will be passed to the {@link TelemetryEventBatcher.measure} function
59
+ * which is called in the {@link SharedObjectCore.process} method.
60
+ */
61
+ interface ProcessTelemetryProperties {
62
+ sequenceDifference: number;
63
+ }
64
+
55
65
  /**
56
66
  * Base class from which all shared objects derive.
67
+ * @legacy
57
68
  * @alpha
58
69
  */
59
70
  export abstract class SharedObjectCore<
@@ -66,8 +77,11 @@ export abstract class SharedObjectCore<
66
77
  return this;
67
78
  }
68
79
 
69
- private readonly opProcessingHelper: SampledTelemetryHelper;
70
- private readonly callbacksHelper: SampledTelemetryHelper;
80
+ private readonly opProcessingHelper: SampledTelemetryHelper<
81
+ void,
82
+ ProcessTelemetryProperties
83
+ >;
84
+ private readonly callbacksHelper: SampledTelemetryHelper<boolean>;
71
85
 
72
86
  /**
73
87
  * The handle referring to this SharedObject
@@ -137,7 +151,9 @@ export abstract class SharedObjectCore<
137
151
  });
138
152
  this.mc = loggerToMonitoringContext(this.logger);
139
153
 
140
- [this.opProcessingHelper, this.callbacksHelper] = this.setUpSampledTelemetryHelpers();
154
+ const { opProcessingHelper, callbacksHelper } = this.setUpSampledTelemetryHelpers();
155
+ this.opProcessingHelper = opProcessingHelper;
156
+ this.callbacksHelper = callbacksHelper;
141
157
  }
142
158
 
143
159
  /**
@@ -153,12 +169,15 @@ export abstract class SharedObjectCore<
153
169
  * @returns The telemetry sampling helpers, so the constructor can be the one to assign them
154
170
  * to variables to avoid complaints from TypeScript.
155
171
  */
156
- private setUpSampledTelemetryHelpers(): SampledTelemetryHelper[] {
172
+ private setUpSampledTelemetryHelpers(): {
173
+ opProcessingHelper: SampledTelemetryHelper<void, ProcessTelemetryProperties>;
174
+ callbacksHelper: SampledTelemetryHelper<boolean>;
175
+ } {
157
176
  assert(
158
177
  this.mc !== undefined && this.logger !== undefined,
159
178
  0x349 /* this.mc and/or this.logger has not been set */,
160
179
  );
161
- const opProcessingHelper = new SampledTelemetryHelper(
180
+ const opProcessingHelper = new SampledTelemetryHelper<void, ProcessTelemetryProperties>(
162
181
  {
163
182
  eventName: "ddsOpProcessing",
164
183
  category: "performance",
@@ -171,7 +190,7 @@ export abstract class SharedObjectCore<
171
190
  ["remote", { localOp: false }],
172
191
  ]),
173
192
  );
174
- const callbacksHelper = new SampledTelemetryHelper(
193
+ const callbacksHelper = new SampledTelemetryHelper<boolean>(
175
194
  {
176
195
  eventName: "ddsEventCallbacks",
177
196
  category: "performance",
@@ -186,7 +205,7 @@ export abstract class SharedObjectCore<
186
205
  this.opProcessingHelper.dispose();
187
206
  });
188
207
 
189
- return [opProcessingHelper, callbacksHelper];
208
+ return { opProcessingHelper, callbacksHelper };
190
209
  }
191
210
 
192
211
  /**
@@ -536,8 +555,14 @@ export abstract class SharedObjectCore<
536
555
  this.emitInternal("pre-op", message, local, this);
537
556
 
538
557
  this.opProcessingHelper.measure(
539
- () => {
558
+ (): ICustomData<ProcessTelemetryProperties> => {
540
559
  this.processCore(message, local, localOpMetadata);
560
+ const telemetryProperties: ProcessTelemetryProperties = {
561
+ sequenceDifference: message.sequenceNumber - message.referenceSequenceNumber,
562
+ };
563
+ return {
564
+ customData: telemetryProperties,
565
+ };
541
566
  },
542
567
  local ? "local" : "remote",
543
568
  );
@@ -612,6 +637,7 @@ export abstract class SharedObjectCore<
612
637
  /**
613
638
  * SharedObject with simplified, synchronous summarization and GC.
614
639
  * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.
640
+ * @legacy
615
641
  * @alpha
616
642
  */
617
643
  export abstract class SharedObject<
@@ -791,6 +817,7 @@ export abstract class SharedObject<
791
817
  * This does not extend {@link SharedObjectKind} since doing so would prevent implementing this interface in type safe code.
792
818
  * Any implementation of this can safely be used as a {@link SharedObjectKind} with an explicit type conversion,
793
819
  * but doing so is typically not needed as {@link createSharedObjectKind} is used to produce values that are both types simultaneously.
820
+ * @legacy
794
821
  * @alpha
795
822
  */
796
823
  export interface ISharedObjectKind<TSharedObject> {
package/src/types.ts CHANGED
@@ -14,6 +14,7 @@ import { IGarbageCollectionData } from "@fluidframework/runtime-definitions/inte
14
14
 
15
15
  /**
16
16
  * Events emitted by {@link ISharedObject}.
17
+ * @legacy
17
18
  * @alpha
18
19
  */
19
20
  export interface ISharedObjectEvents extends IErrorEvent {
@@ -54,6 +55,7 @@ export interface ISharedObjectEvents extends IErrorEvent {
54
55
 
55
56
  /**
56
57
  * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject
58
+ * @legacy
57
59
  * @alpha
58
60
  */
59
61
  export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>
package/src/utils.ts CHANGED
@@ -39,6 +39,7 @@ export function serializeHandles(
39
39
  * @param context - The handle context for the container
40
40
  * @param bind - Bind any other handles we find in the object against this given handle.
41
41
  * @returns The fully-plain object
42
+ * @legacy
42
43
  * @alpha
43
44
  */
44
45
  export function makeHandlesSerializable(
@@ -58,6 +59,7 @@ export function makeHandlesSerializable(
58
59
  * @param serializer - The serializer that knows how to convert serializable-form handles into handle objects
59
60
  * @param context - The handle context for the container
60
61
  * @returns The mostly-plain object with handle objects within
62
+ * @legacy
61
63
  * @alpha
62
64
  */
63
65
  export function parseHandles(value: any, serializer: IFluidSerializer) {