@fluidframework/runtime-utils 2.74.0-370705 → 2.80.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/CHANGELOG.md +8 -0
- package/dist/compatibilityBase.d.ts +13 -0
- package/dist/compatibilityBase.d.ts.map +1 -1
- package/dist/compatibilityBase.js +19 -4
- package/dist/compatibilityBase.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/summaryUtils.d.ts +8 -2
- package/dist/summaryUtils.d.ts.map +1 -1
- package/dist/summaryUtils.js +12 -2
- package/dist/summaryUtils.js.map +1 -1
- package/eslint.config.mts +18 -0
- package/lib/compatibilityBase.d.ts +13 -0
- package/lib/compatibilityBase.d.ts.map +1 -1
- package/lib/compatibilityBase.js +16 -2
- package/lib/compatibilityBase.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/summaryUtils.d.ts +8 -2
- package/lib/summaryUtils.d.ts.map +1 -1
- package/lib/summaryUtils.js +13 -3
- package/lib/summaryUtils.js.map +1 -1
- package/package.json +23 -22
- package/src/compatibilityBase.ts +29 -5
- package/src/index.ts +2 -0
- package/src/packageVersion.ts +1 -1
- package/src/summaryUtils.ts +19 -3
package/src/compatibilityBase.ts
CHANGED
|
@@ -143,12 +143,35 @@ export function getConfigForMinVersionForCollab<T>(
|
|
|
143
143
|
minVersionForCollab: MinimumVersionForCollab,
|
|
144
144
|
config: ConfigMapEntry<T>,
|
|
145
145
|
): T {
|
|
146
|
-
|
|
146
|
+
return getConfigForMinVersionForCollabIterable(
|
|
147
|
+
minVersionForCollab,
|
|
148
|
+
Object.entries(config) as [MinimumMinorSemanticVersion, T][],
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Returns a default configuration given minVersionForCollab and the contents of a {@link ConfigMapEntry} in an Iterable.
|
|
154
|
+
* @remarks
|
|
155
|
+
* See also {@link getConfigForMinVersionForCollab} for consuming a ConfigMapEntry directly.
|
|
156
|
+
*
|
|
157
|
+
* `ConfigMapEntry` is a nice type safe format for developers to directly author this data,
|
|
158
|
+
* but it is messy and less type safe to work with it in this format programmatically.
|
|
159
|
+
* Thus this function exists to help meet the needs of programmatic use cases,
|
|
160
|
+
* like cases which transform a ConfigMapEntry before selecting a value from it.
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
export function getConfigForMinVersionForCollabIterable<T>(
|
|
164
|
+
minVersionForCollab: MinimumVersionForCollab,
|
|
165
|
+
entries: Iterable<readonly [MinimumMinorSemanticVersion | MinimumVersionForCollab, T]>, // [[typeof lowestMinVersionForCollab, T], ...[MinimumVersionForCollab, T][]],
|
|
166
|
+
): T {
|
|
147
167
|
// Validate and strongly type the versions from the configMap.
|
|
148
|
-
const versions: [MinimumVersionForCollab, unknown][] =
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
const versions: [MinimumVersionForCollab, unknown][] = Array.from(
|
|
169
|
+
entries,
|
|
170
|
+
([version, value]) => {
|
|
171
|
+
validateMinimumVersionForCollab(version);
|
|
172
|
+
return [version, value];
|
|
173
|
+
},
|
|
174
|
+
);
|
|
152
175
|
// Sort the versions in descending order to find the largest compatible entry.
|
|
153
176
|
// TODO: Enforcing a sorted order might be a good idea. For now tolerates any order.
|
|
154
177
|
versions.sort((a, b) => compare(b[0], a[0]));
|
|
@@ -225,6 +248,7 @@ const parsedPackageVersion = parse(pkgVersion) ?? fail("Invalid package version"
|
|
|
225
248
|
* Since this is used by validateMinimumVersionForCollab, the type case to MinimumVersionForCollab can not use it directly.
|
|
226
249
|
* Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.
|
|
227
250
|
*
|
|
251
|
+
* @internal
|
|
228
252
|
*/
|
|
229
253
|
export const cleanedPackageVersion =
|
|
230
254
|
`${parsedPackageVersion.major}.${parsedPackageVersion.minor}.${parsedPackageVersion.patch}` as MinimumVersionForCollab;
|
package/src/index.ts
CHANGED
package/src/packageVersion.ts
CHANGED
package/src/summaryUtils.ts
CHANGED
|
@@ -32,7 +32,11 @@ import type {
|
|
|
32
32
|
ISummarizeResult,
|
|
33
33
|
ITelemetryContextExt,
|
|
34
34
|
} from "@fluidframework/runtime-definitions/internal";
|
|
35
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
currentSummarizeStepPrefix,
|
|
37
|
+
currentSummarizeStepPropertyName,
|
|
38
|
+
gcDataBlobKey,
|
|
39
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
36
40
|
import type { TelemetryEventPropertyTypeExt } from "@fluidframework/telemetry-utils/internal";
|
|
37
41
|
|
|
38
42
|
/**
|
|
@@ -520,14 +524,18 @@ export class TelemetryContext implements ITelemetryContext, ITelemetryContextExt
|
|
|
520
524
|
}
|
|
521
525
|
|
|
522
526
|
/**
|
|
523
|
-
*
|
|
527
|
+
* Get the telemetry data being tracked
|
|
528
|
+
* @param prefix - unique prefix to tag this data with (ex: "fluid:map:")
|
|
529
|
+
* @param property - property name of the telemetry data being tracked (ex: "DirectoryCount")
|
|
530
|
+
* @returns undefined if item not found
|
|
524
531
|
*/
|
|
525
532
|
public get(prefix: string, property: string): TelemetryEventPropertyTypeExt {
|
|
526
533
|
return this.telemetry.get(`${prefix}${property}`);
|
|
527
534
|
}
|
|
528
535
|
|
|
529
536
|
/**
|
|
530
|
-
*
|
|
537
|
+
* Returns a serialized version of all the telemetry data.
|
|
538
|
+
* Should be used when logging in telemetry events.
|
|
531
539
|
*/
|
|
532
540
|
public serialize(): string {
|
|
533
541
|
const jsonObject = {};
|
|
@@ -536,6 +544,14 @@ export class TelemetryContext implements ITelemetryContext, ITelemetryContextExt
|
|
|
536
544
|
}
|
|
537
545
|
return JSON.stringify(jsonObject);
|
|
538
546
|
}
|
|
547
|
+
|
|
548
|
+
public getCurrentSummarizeStep(): TelemetryEventPropertyTypeExt {
|
|
549
|
+
return this.get(currentSummarizeStepPrefix, currentSummarizeStepPropertyName);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
public setCurrentSummarizeStep(value: TelemetryEventPropertyTypeExt): void {
|
|
553
|
+
this.set(currentSummarizeStepPrefix, currentSummarizeStepPropertyName, value);
|
|
554
|
+
}
|
|
539
555
|
}
|
|
540
556
|
|
|
541
557
|
/**
|