@fluidframework/runtime-utils 2.53.1 → 2.60.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.
Files changed (127) hide show
  1. package/.eslintrc.cjs +1 -4
  2. package/CHANGELOG.md +4 -0
  3. package/api-report/{runtime-utils.legacy.alpha.api.md → runtime-utils.legacy.beta.api.md} +12 -12
  4. package/dist/compatibilityBase.d.ts +1 -3
  5. package/dist/compatibilityBase.d.ts.map +1 -1
  6. package/dist/compatibilityBase.js +3 -0
  7. package/dist/compatibilityBase.js.map +1 -1
  8. package/dist/dataStoreHandleContextUtils.d.ts +1 -1
  9. package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
  10. package/dist/dataStoreHandleContextUtils.js.map +1 -1
  11. package/dist/dataStoreHelpers.d.ts +18 -6
  12. package/dist/dataStoreHelpers.d.ts.map +1 -1
  13. package/dist/dataStoreHelpers.js +39 -11
  14. package/dist/dataStoreHelpers.js.map +1 -1
  15. package/dist/deltaManager.d.ts +1 -2
  16. package/dist/deltaManager.d.ts.map +1 -1
  17. package/dist/deltaManager.js +3 -2
  18. package/dist/deltaManager.js.map +1 -1
  19. package/dist/handles.d.ts +8 -12
  20. package/dist/handles.d.ts.map +1 -1
  21. package/dist/handles.js +14 -12
  22. package/dist/handles.js.map +1 -1
  23. package/dist/index.d.ts +6 -3
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/objectstoragepartition.d.ts +1 -1
  27. package/dist/objectstoragepartition.d.ts.map +1 -1
  28. package/dist/objectstoragepartition.js.map +1 -1
  29. package/dist/objectstorageutils.d.ts +9 -1
  30. package/dist/objectstorageutils.d.ts.map +1 -1
  31. package/dist/objectstorageutils.js +15 -6
  32. package/dist/objectstorageutils.js.map +1 -1
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/packageVersion.js +1 -1
  35. package/dist/packageVersion.js.map +1 -1
  36. package/dist/remoteFluidObjectHandle.d.ts +2 -2
  37. package/dist/remoteFluidObjectHandle.d.ts.map +1 -1
  38. package/dist/remoteFluidObjectHandle.js +1 -0
  39. package/dist/remoteFluidObjectHandle.js.map +1 -1
  40. package/dist/requestParser.d.ts +2 -3
  41. package/dist/requestParser.d.ts.map +1 -1
  42. package/dist/requestParser.js +9 -11
  43. package/dist/requestParser.js.map +1 -1
  44. package/dist/runtimeFactoryHelper.d.ts +3 -4
  45. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  46. package/dist/runtimeFactoryHelper.js +1 -2
  47. package/dist/runtimeFactoryHelper.js.map +1 -1
  48. package/dist/summaryUtils.d.ts +29 -20
  49. package/dist/summaryUtils.d.ts.map +1 -1
  50. package/dist/summaryUtils.js +49 -21
  51. package/dist/summaryUtils.js.map +1 -1
  52. package/dist/unpackUsedRoutes.d.ts.map +1 -1
  53. package/dist/unpackUsedRoutes.js +3 -3
  54. package/dist/unpackUsedRoutes.js.map +1 -1
  55. package/dist/utils.d.ts +1 -1
  56. package/dist/utils.d.ts.map +1 -1
  57. package/dist/utils.js.map +1 -1
  58. package/lib/compatibilityBase.d.ts +1 -3
  59. package/lib/compatibilityBase.d.ts.map +1 -1
  60. package/lib/compatibilityBase.js +3 -0
  61. package/lib/compatibilityBase.js.map +1 -1
  62. package/lib/dataStoreHandleContextUtils.d.ts +1 -1
  63. package/lib/dataStoreHandleContextUtils.d.ts.map +1 -1
  64. package/lib/dataStoreHandleContextUtils.js.map +1 -1
  65. package/lib/dataStoreHelpers.d.ts +18 -6
  66. package/lib/dataStoreHelpers.d.ts.map +1 -1
  67. package/lib/dataStoreHelpers.js +39 -11
  68. package/lib/dataStoreHelpers.js.map +1 -1
  69. package/lib/deltaManager.d.ts +1 -2
  70. package/lib/deltaManager.d.ts.map +1 -1
  71. package/lib/deltaManager.js +3 -2
  72. package/lib/deltaManager.js.map +1 -1
  73. package/lib/handles.d.ts +8 -12
  74. package/lib/handles.d.ts.map +1 -1
  75. package/lib/handles.js +14 -12
  76. package/lib/handles.js.map +1 -1
  77. package/lib/index.d.ts +6 -3
  78. package/lib/index.d.ts.map +1 -1
  79. package/lib/index.js.map +1 -1
  80. package/lib/objectstoragepartition.d.ts +1 -1
  81. package/lib/objectstoragepartition.d.ts.map +1 -1
  82. package/lib/objectstoragepartition.js.map +1 -1
  83. package/lib/objectstorageutils.d.ts +9 -1
  84. package/lib/objectstorageutils.d.ts.map +1 -1
  85. package/lib/objectstorageutils.js +15 -6
  86. package/lib/objectstorageutils.js.map +1 -1
  87. package/lib/packageVersion.d.ts +1 -1
  88. package/lib/packageVersion.js +1 -1
  89. package/lib/packageVersion.js.map +1 -1
  90. package/lib/remoteFluidObjectHandle.d.ts +2 -2
  91. package/lib/remoteFluidObjectHandle.d.ts.map +1 -1
  92. package/lib/remoteFluidObjectHandle.js +1 -0
  93. package/lib/remoteFluidObjectHandle.js.map +1 -1
  94. package/lib/requestParser.d.ts +2 -3
  95. package/lib/requestParser.d.ts.map +1 -1
  96. package/lib/requestParser.js +9 -11
  97. package/lib/requestParser.js.map +1 -1
  98. package/lib/runtimeFactoryHelper.d.ts +3 -4
  99. package/lib/runtimeFactoryHelper.d.ts.map +1 -1
  100. package/lib/runtimeFactoryHelper.js +1 -2
  101. package/lib/runtimeFactoryHelper.js.map +1 -1
  102. package/lib/summaryUtils.d.ts +29 -20
  103. package/lib/summaryUtils.d.ts.map +1 -1
  104. package/lib/summaryUtils.js +51 -23
  105. package/lib/summaryUtils.js.map +1 -1
  106. package/lib/unpackUsedRoutes.d.ts.map +1 -1
  107. package/lib/unpackUsedRoutes.js +3 -3
  108. package/lib/unpackUsedRoutes.js.map +1 -1
  109. package/lib/utils.d.ts +1 -1
  110. package/lib/utils.d.ts.map +1 -1
  111. package/lib/utils.js.map +1 -1
  112. package/package.json +13 -13
  113. package/src/compatibilityBase.ts +4 -3
  114. package/src/dataStoreHandleContextUtils.ts +1 -1
  115. package/src/dataStoreHelpers.ts +49 -16
  116. package/src/deltaManager.ts +3 -2
  117. package/src/handles.ts +14 -13
  118. package/src/index.ts +6 -4
  119. package/src/objectstoragepartition.ts +2 -2
  120. package/src/objectstorageutils.ts +17 -8
  121. package/src/packageVersion.ts +1 -1
  122. package/src/remoteFluidObjectHandle.ts +4 -3
  123. package/src/requestParser.ts +15 -15
  124. package/src/runtimeFactoryHelper.ts +4 -5
  125. package/src/summaryUtils.ts +70 -43
  126. package/src/unpackUsedRoutes.ts +7 -5
  127. package/src/utils.ts +2 -2
package/.eslintrc.cjs CHANGED
@@ -4,10 +4,7 @@
4
4
  */
5
5
 
6
6
  module.exports = {
7
- extends: [
8
- require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"),
9
- "prettier",
10
- ],
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
11
8
  parserOptions: {
12
9
  project: ["./tsconfig.json", "./src/test/tsconfig.json"],
13
10
  },
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/runtime-utils
2
2
 
3
+ ## 2.60.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.53.0
4
8
 
5
9
  Dependency updates only.
@@ -1,4 +1,4 @@
1
- ## Alpha API Report File for "@fluidframework/runtime-utils"
1
+ ## Beta API Report File for "@fluidframework/runtime-utils"
2
2
 
3
3
  > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
4
 
@@ -7,13 +7,13 @@
7
7
  // @public
8
8
  export function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean;
9
9
 
10
- // @alpha @legacy
10
+ // @beta @legacy
11
11
  export function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
12
12
 
13
- // @alpha @legacy (undocumented)
13
+ // @beta @legacy
14
14
  export const create404Response: (request: IRequest) => IResponse;
15
15
 
16
- // @alpha @legacy
16
+ // @beta @legacy
17
17
  export abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
18
18
  // (undocumented)
19
19
  get [fluidHandleSymbol](): IFluidHandleErased<T>;
@@ -31,13 +31,13 @@ export abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
31
31
  // @public
32
32
  export function isFluidHandle(value: unknown): value is IFluidHandle;
33
33
 
34
- // @alpha @legacy
34
+ // @beta @legacy
35
35
  export const isFluidHandlePayloadPending: <T>(handle: IFluidHandle<T>) => handle is IFluidHandlePayloadPending<T>;
36
36
 
37
- // @alpha @legacy
37
+ // @beta @legacy
38
38
  export const isLocalFluidHandle: <T>(handle: IFluidHandle<T>) => handle is ILocalFluidHandle<T>;
39
39
 
40
- // @alpha @legacy
40
+ // @beta @legacy
41
41
  export class RequestParser implements IRequest {
42
42
  protected constructor(request: Readonly<IRequest>);
43
43
  // (undocumented)
@@ -54,7 +54,7 @@ export class RequestParser implements IRequest {
54
54
  get url(): string;
55
55
  }
56
56
 
57
- // @alpha @legacy (undocumented)
57
+ // @beta @legacy (undocumented)
58
58
  export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
59
59
  hasInitialized(_runtime: T): Promise<void>;
60
60
  instantiateFirstTime(_runtime: T): Promise<void>;
@@ -66,7 +66,7 @@ export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRu
66
66
  abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
67
67
  }
68
68
 
69
- // @alpha @legacy
69
+ // @beta @legacy
70
70
  export class SummaryTreeBuilder implements ISummaryTreeWithStats {
71
71
  constructor(params?: {
72
72
  groupId?: string;
@@ -82,13 +82,13 @@ export class SummaryTreeBuilder implements ISummaryTreeWithStats {
82
82
  get summary(): ISummaryTree;
83
83
  }
84
84
 
85
- // @alpha @legacy
85
+ // @beta @legacy
86
86
  export function toDeltaManagerInternal(deltaManager: IDeltaManagerErased): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
87
87
 
88
- // @alpha @legacy
88
+ // @beta @legacy
89
89
  export function toFluidHandleErased<T>(handle: IFluidHandleInternal<T>): IFluidHandleErased<T>;
90
90
 
91
- // @alpha @legacy
91
+ // @beta @legacy
92
92
  export function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T>;
93
93
 
94
94
  // (No @packageDocumentation comment for this package)
@@ -47,9 +47,7 @@ export type SemanticVersion = `${bigint}.${bigint}.${bigint}` | `${bigint}.${big
47
47
  * @internal
48
48
  */
49
49
  export type ConfigMap<T extends Record<string, unknown>> = {
50
- [K in keyof T]-?: {
51
- [version: MinimumMinorSemanticVersion]: T[K];
52
- };
50
+ [K in keyof T]-?: Record<MinimumMinorSemanticVersion, T[K]>;
53
51
  };
54
52
  /**
55
53
  * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityBase.d.ts","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAM5F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,0BAA0B,kBACqB,CAAC;AAU7D;;;;;;;GAOG;AACH,MAAM,MAAM,2BAA2B,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,GAAG,GAAG,MAAM,eAAe,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACxB,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,GAC/B,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACzD,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG;QACjB,CAAC,OAAO,EAAE,2BAA2B,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;CACD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,MA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GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,EACxD,GAAG,SAAS,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,EAAE,EAC1C,cAAc,EAAE,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,eAAe,GAAG,SAAS,CAoCtE"}
@@ -46,6 +46,7 @@ function getConfigsForMinVersionForCollab(minVersionForCollab, configMap) {
46
46
  const defaultConfigs = {};
47
47
  // Iterate over configMap to get default values for each option.
48
48
  for (const key of Object.keys(configMap)) {
49
+ // Type assertion is safe as key comes from Object.keys(configMap)
49
50
  const config = configMap[key];
50
51
  // Sort the versions in ascending order so we can short circuit the loop.
51
52
  const versions = Object.keys(config).sort(semver_ts_1.compare);
@@ -54,6 +55,7 @@ function getConfigsForMinVersionForCollab(minVersionForCollab, configMap) {
54
55
  // value that is compatible with the version specified as the minVersionForCollab.
55
56
  for (const version of versions) {
56
57
  if ((0, semver_ts_1.gte)(minVersionForCollab, version)) {
58
+ // Type assertion is safe as version is a key from the config object
57
59
  defaultConfigs[key] = config[version];
58
60
  }
59
61
  else {
@@ -90,6 +92,7 @@ function getValidationForRuntimeOptions(minVersionForCollab, runtimeOptions, val
90
92
  return;
91
93
  }
92
94
  // Iterate through each runtime option passed in by the user
95
+ // Type assertion is safe as entries come from runtimeOptions object
93
96
  for (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(runtimeOptions)) {
94
97
  // Skip if passedRuntimeOption is not in validation map
95
98
  if (!(passedRuntimeOption in validationMap)) {
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,uEAAsE;AACtE,yCAAyD;AAEzD,2DAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,0BAA0B,GACtC,gBAA2D,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,OAAkD,CAAC;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C,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAChF,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,2DAA2D;YAC3D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAA,mBAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,qFAAqF;QACrF,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;AACH,CAAC;AAvCD,4EAuCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { compare, gt, gte, lte, valid } from \"semver-ts\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Our policy is to support N/N-1 compatibility by default, where N is the most\n * recent public major release of the runtime.\n * Therefore, if the customer does not provide a minVersionForCollab, we will\n * default to use N-1.\n *\n * However, this is not consistent with today's behavior. Some options (i.e.\n * batching, compression) are enabled by default despite not being compatible\n * with 1.x clients. Since the policy was introduced during 2.x's lifespan,\n * N/N-1 compatibility by **default** will be in effect starting with 3.0.\n * Importantly though, N/N-2 compatibility is still guaranteed with the proper\n * configurations set.\n *\n * Further to distinguish unspecified `minVersionForCollab` from a specified\n * version and allow `enableExplicitSchemaControl` to default to `true` for\n * any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which\n * is semantically less than 2.0.0.\n *\n * @internal\n */\nexport const defaultMinVersionForCollab =\n\t\"2.0.0-defaults\" as const satisfies MinimumVersionForCollab;\n\n/**\n * We don't want allow a version before the major public release of the LTS version.\n * Today we use \"1.0.0\", because our policy supports N/N-1 & N/N-2, which includes\n * all minor versions of N. Though LTS starts at 1.4.0, we should stay consistent\n * with our policy and allow all 1.x versions to be compatible with 2.x.\n */\nconst lowestMinVersionForCollab = \"1.0.0\" as const satisfies MinimumVersionForCollab;\n\n/**\n * String in a valid semver format specifying bottom of a minor version\n * or special \"defaults\" prerelease of a major.\n * @remarks Only 2.0.0-defaults is expected, but index signatures cannot be a\n * literal; so, just allow any major -defaults prerelease.\n *\n * @internal\n */\nexport type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0.0-defaults`;\n\n/**\n * String in a valid semver format of a specific version at least specifying minor.\n * Unlike {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, this type allows any bigint for the major version.\n * Used as a more generic type that allows major versions other than 1 or 2.\n *\n * @internal\n */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n *\n * @internal\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: {\n\t\t[version: MinimumMinorSemanticVersion]: T[K];\n\t};\n};\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap\n *\n * @internal\n */\nexport type ConfigValidationMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined;\n};\n\n/**\n * Returns a default configuration given minVersionForCollab and configuration version map.\n *\n * @internal\n */\nexport function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\tconfigMap: ConfigMap<T>,\n): Partial<T> {\n\tconst defaultConfigs: Partial<T> = {};\n\t// Iterate over configMap to get default values for each option.\n\tfor (const key of Object.keys(configMap)) {\n\t\tconst config = configMap[key as keyof T];\n\t\t// Sort the versions in ascending order so we can short circuit the loop.\n\t\tconst versions = Object.keys(config).sort(compare);\n\t\t// For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.\n\t\t// If so, we set it as the default value for the option. At the end of the loop we should have the most recent default\n\t\t// value that is compatible with the version specified as the minVersionForCollab.\n\t\tfor (const version of versions) {\n\t\t\tif (gte(minVersionForCollab, version)) {\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the minVersionForCollab is less than the version, we break out of the loop since we don't need to check\n\t\t\t\t// any later versions.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn defaultConfigs;\n}\n\n/**\n * Checks if the minVersionForCollab is valid.\n * A valid minVersionForCollab is a MinimumVersionForCollab that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.\n *\n * @internal\n */\nexport function isValidMinVersionForCollab(\n\tminVersionForCollab: MinimumVersionForCollab,\n): boolean {\n\treturn (\n\t\tvalid(minVersionForCollab) !== null &&\n\t\tgte(minVersionForCollab, lowestMinVersionForCollab) &&\n\t\tlte(minVersionForCollab, pkgVersion)\n\t);\n}\n\n/**\n * Generic function to validate runtime options against the minVersionForCollab.\n *\n * @internal\n */\nexport function getValidationForRuntimeOptions<T extends Record<string, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\truntimeOptions: Partial<T>,\n\tvalidationMap: ConfigValidationMap<T>,\n): void {\n\tif (minVersionForCollab === defaultMinVersionForCollab) {\n\t\t// If the minVersionForCollab is set to the default value, then we will not validate the runtime options\n\t\t// This is to avoid disruption to users who have not yet set the minVersionForCollab value explicitly.\n\t\treturn;\n\t}\n\t// Iterate through each runtime option passed in by the user\n\tfor (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(\n\t\truntimeOptions,\n\t) as [keyof T & string, T[keyof T & string]][]) {\n\t\t// Skip if passedRuntimeOption is not in validation map\n\t\tif (!(passedRuntimeOption in validationMap)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst requiredVersion = validationMap[passedRuntimeOption](passedRuntimeOptionValue);\n\t\tif (requiredVersion !== undefined && gt(requiredVersion, minVersionForCollab)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Runtime option ${passedRuntimeOption}:${JSON.stringify(passedRuntimeOptionValue)} requires ` +\n\t\t\t\t\t`runtime version ${requiredVersion}. Please update minVersionForCollab ` +\n\t\t\t\t\t`(currently ${minVersionForCollab}) to ${requiredVersion} or later to proceed.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Helper function to map ContainerRuntimeOptionsInternal config values to\n * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.\n *\n * @internal\n */\nexport function configValueToMinVersionForCollab<\n\tT extends string | number | boolean | undefined | object,\n\tArr extends readonly [T, SemanticVersion][],\n>(configToMinVer: Arr): (configValue: T) => SemanticVersion | undefined {\n\tconst configValueToRequiredVersionMap = new Map(configToMinVer);\n\treturn (configValue: T) => {\n\t\t// If the configValue is not an object then we can get the version required directly from the map.\n\t\tif (typeof configValue !== \"object\") {\n\t\t\treturn configValueToRequiredVersionMap.get(configValue);\n\t\t}\n\t\t// When the input `configValue` is an object, this logic determines the minimum runtime version it requires.\n\t\t// It iterates through each entry in `configValueToRequiredVersionMap`. If `possibleConfigValue` shares at\n\t\t// least one key-value pair with the input `configValue`, its associated `versionRequired` is collected into\n\t\t// `matchingVersions`. After checking all entries, the highest among the collected versions is returned.\n\t\t// This represents the overall minimum version required to support the features implied by the input `configValue`.\n\t\tconst matchingVersions: SemanticVersion[] = [];\n\t\tfor (const [\n\t\t\tpossibleConfigValue,\n\t\t\tversionRequired,\n\t\t] of configValueToRequiredVersionMap.entries()) {\n\t\t\tassert(\n\t\t\t\ttypeof possibleConfigValue == \"object\",\n\t\t\t\t0xbb9 /* possibleConfigValue should be an object */,\n\t\t\t);\n\t\t\t// Check if `possibleConfigValue` and the input `configValue` share at least one\n\t\t\t// common key-value pair. If they do, the `versionRequired` for this `possibleConfigValue`\n\t\t\t// is added to `matchingVersions`.\n\t\t\tif (Object.entries(possibleConfigValue).some(([k, v]) => configValue[k] === v)) {\n\t\t\t\tmatchingVersions.push(versionRequired);\n\t\t\t}\n\t\t}\n\t\tif (matchingVersions.length > 0) {\n\t\t\t// Return the latest minVersionForCollab among all matches.\n\t\t\treturn matchingVersions.sort((a, b) => compare(b, a))[0];\n\t\t}\n\t\t// If no matches then we return undefined. This means that the config value passed in\n\t\t// does not require a specific minVersionForCollab to be valid.\n\t\treturn undefined;\n\t};\n}\n"]}
1
+ {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,uEAAsE;AACtE,yCAAyD;AAEzD,2DAAiD;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,0BAA0B,GACtC,gBAA2D,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,OAAkD,CAAC;AAyCrF;;;;GAIG;AACH,SAAgB,gCAAgC,CAC/C,mBAAoC,EACpC,SAAuB;IAEvB,MAAM,cAAc,GAAe,EAAE,CAAC;IACtC,gEAAgE;IAChE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,kEAAkE;QAClE,MAAM,MAAM,GAAG,SAAS,CAAC,GAAc,CAAC,CAAC;QACzC,yEAAyE;QACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,mBAAO,CAAC,CAAC;QACnD,sHAAsH;QACtH,sHAAsH;QACtH,kFAAkF;QAClF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,IAAI,IAAA,eAAG,EAAC,mBAAmB,EA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QACrF,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;AACH,CAAC;AAvCD,4EAuCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { MinimumVersionForCollab } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { compare, gt, gte, lte, valid } from \"semver-ts\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Our policy is to support N/N-1 compatibility by default, where N is the most\n * recent public major release of the runtime.\n * Therefore, if the customer does not provide a minVersionForCollab, we will\n * default to use N-1.\n *\n * However, this is not consistent with today's behavior. Some options (i.e.\n * batching, compression) are enabled by default despite not being compatible\n * with 1.x clients. Since the policy was introduced during 2.x's lifespan,\n * N/N-1 compatibility by **default** will be in effect starting with 3.0.\n * Importantly though, N/N-2 compatibility is still guaranteed with the proper\n * configurations set.\n *\n * Further to distinguish unspecified `minVersionForCollab` from a specified\n * version and allow `enableExplicitSchemaControl` to default to `true` for\n * any 2.0.0+ version, we will use a special value of `2.0.0-defaults`, which\n * is semantically less than 2.0.0.\n *\n * @internal\n */\nexport const defaultMinVersionForCollab =\n\t\"2.0.0-defaults\" as const satisfies MinimumVersionForCollab;\n\n/**\n * We don't want allow a version before the major public release of the LTS version.\n * Today we use \"1.0.0\", because our policy supports N/N-1 & N/N-2, which includes\n * all minor versions of N. Though LTS starts at 1.4.0, we should stay consistent\n * with our policy and allow all 1.x versions to be compatible with 2.x.\n */\nconst lowestMinVersionForCollab = \"1.0.0\" as const satisfies MinimumVersionForCollab;\n\n/**\n * String in a valid semver format specifying bottom of a minor version\n * or special \"defaults\" prerelease of a major.\n * @remarks Only 2.0.0-defaults is expected, but index signatures cannot be a\n * literal; so, just allow any major -defaults prerelease.\n *\n * @internal\n */\nexport type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0.0-defaults`;\n\n/**\n * String in a valid semver format of a specific version at least specifying minor.\n * Unlike {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}, this type allows any bigint for the major version.\n * Used as a more generic type that allows major versions other than 1 or 2.\n *\n * @internal\n */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigMap\n *\n * @internal\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: Record<MinimumMinorSemanticVersion, T[K]>;\n};\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap\n *\n * @internal\n */\nexport type ConfigValidationMap<T extends Record<string, unknown>> = {\n\t[K in keyof T]-?: (configValue: T[K]) => SemanticVersion | undefined;\n};\n\n/**\n * Returns a default configuration given minVersionForCollab and configuration version map.\n *\n * @internal\n */\nexport function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\tconfigMap: ConfigMap<T>,\n): Partial<T> {\n\tconst defaultConfigs: Partial<T> = {};\n\t// Iterate over configMap to get default values for each option.\n\tfor (const key of Object.keys(configMap)) {\n\t\t// Type assertion is safe as key comes from Object.keys(configMap)\n\t\tconst config = configMap[key as keyof T];\n\t\t// Sort the versions in ascending order so we can short circuit the loop.\n\t\tconst versions = Object.keys(config).sort(compare);\n\t\t// For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.\n\t\t// If so, we set it as the default value for the option. At the end of the loop we should have the most recent default\n\t\t// value that is compatible with the version specified as the minVersionForCollab.\n\t\tfor (const version of versions) {\n\t\t\tif (gte(minVersionForCollab, version)) {\n\t\t\t\t// Type assertion is safe as version is a key from the config object\n\t\t\t\tdefaultConfigs[key] = config[version as MinimumMinorSemanticVersion];\n\t\t\t} else {\n\t\t\t\t// If the minVersionForCollab is less than the version, we break out of the loop since we don't need to check\n\t\t\t\t// any later versions.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn defaultConfigs;\n}\n\n/**\n * Checks if the minVersionForCollab is valid.\n * A valid minVersionForCollab is a MinimumVersionForCollab that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.\n *\n * @internal\n */\nexport function isValidMinVersionForCollab(\n\tminVersionForCollab: MinimumVersionForCollab,\n): boolean {\n\treturn (\n\t\tvalid(minVersionForCollab) !== null &&\n\t\tgte(minVersionForCollab, lowestMinVersionForCollab) &&\n\t\tlte(minVersionForCollab, pkgVersion)\n\t);\n}\n\n/**\n * Generic function to validate runtime options against the minVersionForCollab.\n *\n * @internal\n */\nexport function getValidationForRuntimeOptions<T extends Record<string, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\truntimeOptions: Partial<T>,\n\tvalidationMap: ConfigValidationMap<T>,\n): void {\n\tif (minVersionForCollab === defaultMinVersionForCollab) {\n\t\t// If the minVersionForCollab is set to the default value, then we will not validate the runtime options\n\t\t// This is to avoid disruption to users who have not yet set the minVersionForCollab value explicitly.\n\t\treturn;\n\t}\n\t// Iterate through each runtime option passed in by the user\n\t// Type assertion is safe as entries come from runtimeOptions object\n\tfor (const [passedRuntimeOption, passedRuntimeOptionValue] of Object.entries(\n\t\truntimeOptions,\n\t) as [keyof T & string, T[keyof T & string]][]) {\n\t\t// Skip if passedRuntimeOption is not in validation map\n\t\tif (!(passedRuntimeOption in validationMap)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst requiredVersion = validationMap[passedRuntimeOption](passedRuntimeOptionValue);\n\t\tif (requiredVersion !== undefined && gt(requiredVersion, minVersionForCollab)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Runtime option ${passedRuntimeOption}:${JSON.stringify(passedRuntimeOptionValue)} requires ` +\n\t\t\t\t\t`runtime version ${requiredVersion}. Please update minVersionForCollab ` +\n\t\t\t\t\t`(currently ${minVersionForCollab}) to ${requiredVersion} or later to proceed.`,\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * Helper function to map ContainerRuntimeOptionsInternal config values to\n * minVersionForCollab in, e.g., {@link @fluidframework/container-runtime#runtimeOptionsAffectingDocSchemaConfigValidationMap}.\n *\n * @internal\n */\nexport function configValueToMinVersionForCollab<\n\tT extends string | number | boolean | undefined | object,\n\tArr extends readonly [T, SemanticVersion][],\n>(configToMinVer: Arr): (configValue: T) => SemanticVersion | undefined {\n\tconst configValueToRequiredVersionMap = new Map(configToMinVer);\n\treturn (configValue: T) => {\n\t\t// If the configValue is not an object then we can get the version required directly from the map.\n\t\tif (typeof configValue !== \"object\") {\n\t\t\treturn configValueToRequiredVersionMap.get(configValue);\n\t\t}\n\t\t// When the input `configValue` is an object, this logic determines the minimum runtime version it requires.\n\t\t// It iterates through each entry in `configValueToRequiredVersionMap`. If `possibleConfigValue` shares at\n\t\t// least one key-value pair with the input `configValue`, its associated `versionRequired` is collected into\n\t\t// `matchingVersions`. After checking all entries, the highest among the collected versions is returned.\n\t\t// This represents the overall minimum version required to support the features implied by the input `configValue`.\n\t\tconst matchingVersions: SemanticVersion[] = [];\n\t\tfor (const [\n\t\t\tpossibleConfigValue,\n\t\t\tversionRequired,\n\t\t] of configValueToRequiredVersionMap.entries()) {\n\t\t\tassert(\n\t\t\t\ttypeof possibleConfigValue == \"object\",\n\t\t\t\t0xbb9 /* possibleConfigValue should be an object */,\n\t\t\t);\n\t\t\t// Check if `possibleConfigValue` and the input `configValue` share at least one\n\t\t\t// common key-value pair. If they do, the `versionRequired` for this `possibleConfigValue`\n\t\t\t// is added to `matchingVersions`.\n\t\t\tif (Object.entries(possibleConfigValue).some(([k, v]) => configValue[k] === v)) {\n\t\t\t\tmatchingVersions.push(versionRequired);\n\t\t\t}\n\t\t}\n\t\tif (matchingVersions.length > 0) {\n\t\t\t// Return the latest minVersionForCollab among all matches.\n\t\t\treturn matchingVersions.sort((a, b) => compare(b, a))[0];\n\t\t}\n\t\t// If no matches then we return undefined. This means that the config value passed in\n\t\t// does not require a specific minVersionForCollab to be valid.\n\t\treturn undefined;\n\t};\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IFluidHandleContext } from "@fluidframework/core-interfaces/internal";
5
+ import type { IFluidHandleContext } from "@fluidframework/core-interfaces/internal";
6
6
  /**
7
7
  * Generates the absolute path for a Fluid object given its path and its parent routeContext.
8
8
  * @param path - The path to the Fluid object relative to the route context.
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHandleContextUtils.d.ts","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,mBAAmB,GAChC,MAAM,CAqBR"}
1
+ {"version":3,"file":"dataStoreHandleContextUtils.d.ts","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,mBAAmB,GAChC,MAAM,CAqBR"}
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHandleContextUtils.js","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACxC,IAAY,EACZ,YAAkC;IAElC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACjB,uBAAuB;QACvB,wDAAwD;QACxD,yFAAyF;QACzF,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;IACpE,CAAC;SAAM,CAAC;QACP,gEAAgE;QAChE,IAAI,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC;QAElB,iEAAiE;QACjE,2FAA2F;QAC3F,OAAO,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,cAAc,EAAE;YACtB,CAAC,CAAC,GACA,YAAY,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YACvD,IAAI,cAAc,EAAE,CAAC;IACxB,CAAC;AACF,CAAC;AAxBD,8DAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * Generates the absolute path for a Fluid object given its path and its parent routeContext.\n * @param path - The path to the Fluid object relative to the route context.\n * @param routeContext - The route context that contains the Fluid object.\n * @returns The absolute path to the Fluid object from the root of the Container.\n * @internal\n */\nexport function generateHandleContextPath(\n\tpath: string,\n\trouteContext?: IFluidHandleContext,\n): string {\n\tif (path === \"\") {\n\t\t// The `path` is empty.\n\t\t// If the routeContext does not exist, this is the root.\n\t\t// If the routeContext exists, the absolute path is the same as that of the routeContext.\n\t\treturn routeContext === undefined ? \"\" : routeContext.absolutePath;\n\t} else {\n\t\t// Remove beginning and trailing slashes, if any, from the path.\n\t\tlet normalizedPath = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tnormalizedPath = normalizedPath.endsWith(\"/\")\n\t\t\t? normalizedPath.slice(0, -1)\n\t\t\t: normalizedPath;\n\n\t\t// If the routeContext does not exist, path is the absolute path.\n\t\t// If the routeContext exists, absolute path is routeContext's absolute path plus the path.\n\t\treturn routeContext === undefined\n\t\t\t? `/${normalizedPath}`\n\t\t\t: `${\n\t\t\t\t\trouteContext.absolutePath === \"/\" ? \"\" : routeContext.absolutePath\n\t\t\t\t}/${normalizedPath}`;\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStoreHandleContextUtils.js","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACxC,IAAY,EACZ,YAAkC;IAElC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACjB,uBAAuB;QACvB,wDAAwD;QACxD,yFAAyF;QACzF,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;IACpE,CAAC;SAAM,CAAC;QACP,gEAAgE;QAChE,IAAI,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC;QAElB,iEAAiE;QACjE,2FAA2F;QAC3F,OAAO,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,cAAc,EAAE;YACtB,CAAC,CAAC,GACA,YAAY,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YACvD,IAAI,cAAc,EAAE,CAAC;IACxB,CAAC;AACF,CAAC;AAxBD,8DAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * Generates the absolute path for a Fluid object given its path and its parent routeContext.\n * @param path - The path to the Fluid object relative to the route context.\n * @param routeContext - The route context that contains the Fluid object.\n * @returns The absolute path to the Fluid object from the root of the Container.\n * @internal\n */\nexport function generateHandleContextPath(\n\tpath: string,\n\trouteContext?: IFluidHandleContext,\n): string {\n\tif (path === \"\") {\n\t\t// The `path` is empty.\n\t\t// If the routeContext does not exist, this is the root.\n\t\t// If the routeContext exists, the absolute path is the same as that of the routeContext.\n\t\treturn routeContext === undefined ? \"\" : routeContext.absolutePath;\n\t} else {\n\t\t// Remove beginning and trailing slashes, if any, from the path.\n\t\tlet normalizedPath = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tnormalizedPath = normalizedPath.endsWith(\"/\")\n\t\t\t? normalizedPath.slice(0, -1)\n\t\t\t: normalizedPath;\n\n\t\t// If the routeContext does not exist, path is the absolute path.\n\t\t// If the routeContext exists, absolute path is routeContext's absolute path plus the path.\n\t\treturn routeContext === undefined\n\t\t\t? `/${normalizedPath}`\n\t\t\t: `${\n\t\t\t\t\trouteContext.absolutePath === \"/\" ? \"\" : routeContext.absolutePath\n\t\t\t\t}/${normalizedPath}`;\n\t}\n}\n"]}
@@ -2,24 +2,36 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IRequest, IResponse } from "@fluidframework/core-interfaces";
5
+ import type { IRequest, IResponse } from "@fluidframework/core-interfaces";
6
6
  /**
7
+ * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.
7
8
  * @internal
8
9
  */
9
- export declare function exceptionToResponse(err: any): IResponse;
10
+ export declare function exceptionToResponse(error: unknown): IResponse;
10
11
  /**
12
+ * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.
13
+ * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.
14
+ * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.
15
+ * @returns An Error object with additional properties from the response
11
16
  * @internal
12
17
  */
13
18
  export declare function responseToException(response: IResponse, request: IRequest): Error;
14
19
  /**
20
+ * Creates a 404 "not found" response for the given request
21
+ * @param request - The request that resulted in the 404 response
22
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.
15
23
  * @legacy
16
- * @alpha
24
+ * @beta
17
25
  */
18
26
  export declare const create404Response: (request: IRequest) => IResponse;
19
27
  /**
28
+ * Creates an error response with the specified status code and message
29
+ * @param status - HTTP status code for the error (must not be 200)
30
+ * @param value - Error message or description
31
+ * @param request - The request that resulted in this error
32
+ * @param headers - Optional headers to include in the response
33
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error
20
34
  * @internal
21
35
  */
22
- export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
23
- [key: string]: any;
24
- }): IResponse;
36
+ export declare function createResponseError(status: number, value: string, request: IRequest, headers?: Record<string, unknown>): IResponse;
25
37
  //# sourceMappingURL=dataStoreHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAYtE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CA0BvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAejF;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAAa,QAAQ,cACJ,CAAC;AAEhD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC9B,SAAS,CAiBX"}
1
+ {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAyB3E;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CA8B7D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAiBjF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,YAAa,QAAQ,KAAG,SACP,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,SAAS,CAiBX"}
@@ -8,38 +8,57 @@ exports.createResponseError = exports.create404Response = exports.responseToExce
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  /**
11
+ * Type guard for determining if an error is an {@link IResponseException}.
11
12
  * @internal
12
13
  */
13
- function exceptionToResponse(err) {
14
+ function isResponseException(err) {
15
+ return (err !== null &&
16
+ typeof err === "object" &&
17
+ "errorFromRequestFluidObject" in err &&
18
+ err.errorFromRequestFluidObject === true);
19
+ }
20
+ /**
21
+ * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.
22
+ * @internal
23
+ */
24
+ function exceptionToResponse(error) {
14
25
  const status = 500;
15
- if (err !== null && typeof err === "object" && err.errorFromRequestFluidObject === true) {
16
- const responseErr = err;
26
+ if (isResponseException(error)) {
17
27
  return {
18
28
  mimeType: "text/plain",
19
- status: responseErr.code,
20
- value: responseErr.message,
29
+ status: error.code,
30
+ value: error.message,
21
31
  get stack() {
22
- return responseErr.stack;
32
+ return error.stack;
23
33
  },
24
- headers: responseErr.underlyingResponseHeaders,
34
+ headers: error.underlyingResponseHeaders,
25
35
  };
26
36
  }
27
- // Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
37
+ // Capture error objects, not stack itself, as stack retrieval is very expensive operation
28
38
  const errWithStack = (0, internal_2.generateErrorWithStack)();
29
39
  return {
30
40
  mimeType: "text/plain",
31
41
  status,
32
- value: `${err}`,
42
+ value: `${error}`,
33
43
  get stack() {
34
- return err?.stack ?? errWithStack.stack;
44
+ // Use type assertion after checking if error is an object with stack
45
+ return ((typeof error === "object" && error !== null && "stack" in error
46
+ ? error.stack
47
+ : undefined) ?? errWithStack.stack);
35
48
  },
36
49
  };
37
50
  }
38
51
  exports.exceptionToResponse = exceptionToResponse;
39
52
  /**
53
+ * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.
54
+ * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.
55
+ * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.
56
+ * @returns An Error object with additional properties from the response
40
57
  * @internal
41
58
  */
42
59
  function responseToException(response, request) {
60
+ // As of 2025-08-20 the code seems to assume `response.value` is always a string.
61
+ // This type assertion just encodes that assumption as we move to stricter linting rules, but it might need to be revisited.
43
62
  const message = response.value;
44
63
  const errWithStack = (0, internal_2.generateErrorWithStack)();
45
64
  const responseErr = {
@@ -56,12 +75,21 @@ function responseToException(response, request) {
56
75
  }
57
76
  exports.responseToException = responseToException;
58
77
  /**
78
+ * Creates a 404 "not found" response for the given request
79
+ * @param request - The request that resulted in the 404 response
80
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.
59
81
  * @legacy
60
- * @alpha
82
+ * @beta
61
83
  */
62
84
  const create404Response = (request) => createResponseError(404, "not found", request);
63
85
  exports.create404Response = create404Response;
64
86
  /**
87
+ * Creates an error response with the specified status code and message
88
+ * @param status - HTTP status code for the error (must not be 200)
89
+ * @param value - Error message or description
90
+ * @param request - The request that resulted in this error
91
+ * @param headers - Optional headers to include in the response
92
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error
65
93
  * @internal
66
94
  */
67
95
  function createResponseError(status, value, request, headers) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,uEAAkF;AAUlF;;GAEG;AACH,SAAgB,mBAAmB,CAAC,GAAQ;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,2BAA2B,KAAK,IAAI,EAAE,CAAC;QACzF,MAAM,WAAW,GAAuB,GAAG,CAAC;QAC5C,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,WAAW,CAAC,IAAI;YACxB,KAAK,EAAE,WAAW,CAAC,OAAO;YAC1B,IAAI,KAAK;gBACR,OAAO,WAAW,CAAC,KAAK,CAAC;YAC1B,CAAC;YACD,OAAO,EAAE,WAAW,CAAC,yBAAyB;SAC9C,CAAC;IACH,CAAC;IAED,0GAA0G;IAC1G,MAAM,YAAY,GAAG,IAAA,iCAAsB,GAAE,CAAC;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,GAAG,GAAG,EAAE;QACf,IAAI,KAAK;YACR,OAAQ,GAAG,EAAE,KAA4B,IAAI,YAAY,CAAC,KAAK,CAAC;QACjE,CAAC;KACD,CAAC;AACH,CAAC;AA1BD,kDA0BC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAmB,EAAE,OA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ors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { generateErrorWithStack } from \"@fluidframework/telemetry-utils/internal\";\n\ninterface IResponseException extends Error {\n\terrorFromRequestFluidObject: true;\n\tmessage: string;\n\tcode: number;\n\tstack?: string;\n\tunderlyingResponseHeaders?: { [key: string]: any };\n}\n\n/**\n * @internal\n */\nexport function exceptionToResponse(err: any): IResponse {\n\tconst status = 500;\n\tif (err !== null && typeof err === \"object\" && err.errorFromRequestFluidObject === true) {\n\t\tconst responseErr: IResponseException = err;\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: responseErr.code,\n\t\t\tvalue: responseErr.message,\n\t\t\tget stack() {\n\t\t\t\treturn responseErr.stack;\n\t\t\t},\n\t\t\theaders: responseErr.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${err}`,\n\t\tget stack() {\n\t\t\treturn (err?.stack as string | undefined) ?? errWithStack.stack;\n\t\t},\n\t};\n}\n\n/**\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\tconst message = response.value;\n\tconst errWithStack = generateErrorWithStack();\n\tconst responseErr: Error & IResponseException = {\n\t\terrorFromRequestFluidObject: true,\n\t\tmessage,\n\t\tname: \"Error\",\n\t\tcode: response.status,\n\t\tget stack() {\n\t\t\treturn response.stack ?? errWithStack.stack;\n\t\t},\n\t\tunderlyingResponseHeaders: response.headers,\n\t};\n\n\treturn responseErr;\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport const create404Response = (request: IRequest) =>\n\tcreateResponseError(404, \"not found\", request);\n\n/**\n * @internal\n */\nexport function createResponseError(\n\tstatus: number,\n\tvalue: string,\n\trequest: IRequest,\n\theaders?: { [key: string]: any },\n): IResponse {\n\tassert(status !== 200, 0x19b /* \"Cannot not create response error on 200 status\" */);\n\t// Omit query string which could contain personal data unfit for logging\n\tconst urlNoQuery = request.url?.split(\"?\")[0];\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\theaders,\n\t};\n}\n"]}
1
+ {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,uEAAkF;AAUlF;;;GAGG;AACH,SAAS,mBAAmB,CAAC,GAAY;IACxC,OAAO,CACN,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,6BAA6B,IAAI,GAAG;QACnC,GAAgD,CAAC,2BAA2B,KAAK,IAAI,CACtF,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAAc;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,KAAK,CAAC,IAAI;YAClB,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,IAAI,KAAK;gBACR,OAAO,KAAK,CAAC,KAAK,CAAC;YACpB,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,yBAAyB;SACxC,CAAC;IACH,CAAC;IAED,0FAA0F;IAC1F,MAAM,YAAY,GAAG,IAAA,iCAAsB,GAAE,CAAC;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,GAAG,KAAK,EAAE;QACj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C;IAE9C,0GAA0G;IAC1G,MAAM,YAAY,GAAG,IAAA,iCAAsB,GAAE,CAAC;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,UAAU,EAAE;QACnE,IAAI,KAAK;YACR,OAAO,YAAY,CAAC,KAAK,CAAC;QAC3B,CAAC;QACD,OAAO;KACP,CAAC;AACH,CAAC;AAtBD,kDAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { generateErrorWithStack } from \"@fluidframework/telemetry-utils/internal\";\n\ninterface IResponseException extends Error {\n\terrorFromRequestFluidObject: true;\n\tmessage: string;\n\tcode: number;\n\tstack?: string;\n\tunderlyingResponseHeaders?: Record<string, unknown>;\n}\n\n/**\n * Type guard for determining if an error is an {@link IResponseException}.\n * @internal\n */\nfunction isResponseException(err: unknown): err is IResponseException {\n\treturn (\n\t\terr !== null &&\n\t\ttypeof err === \"object\" &&\n\t\t\"errorFromRequestFluidObject\" in err &&\n\t\t(err as { errorFromRequestFluidObject: unknown }).errorFromRequestFluidObject === true\n\t);\n}\n\n/**\n * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.\n * @internal\n */\nexport function exceptionToResponse(error: unknown): IResponse {\n\tconst status = 500;\n\tif (isResponseException(error)) {\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: error.code,\n\t\t\tvalue: error.message,\n\t\t\tget stack() {\n\t\t\t\treturn error.stack;\n\t\t\t},\n\t\t\theaders: error.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${error}`,\n\t\tget stack() {\n\t\t\t// Use type assertion after checking if error is an object with stack\n\t\t\treturn (\n\t\t\t\t(typeof error === \"object\" && error !== null && \"stack\" in error\n\t\t\t\t\t? (error.stack as string | undefined)\n\t\t\t\t\t: undefined) ?? errWithStack.stack\n\t\t\t);\n\t\t},\n\t};\n}\n\n/**\n * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.\n * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.\n * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.\n * @returns An Error object with additional properties from the response\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\t// As of 2025-08-20 the code seems to assume `response.value` is always a string.\n\t// This type assertion just encodes that assumption as we move to stricter linting rules, but it might need to be revisited.\n\tconst message = response.value as string;\n\tconst errWithStack = generateErrorWithStack();\n\tconst responseErr: Error & IResponseException = {\n\t\terrorFromRequestFluidObject: true,\n\t\tmessage,\n\t\tname: \"Error\",\n\t\tcode: response.status,\n\t\tget stack() {\n\t\t\treturn response.stack ?? errWithStack.stack;\n\t\t},\n\t\tunderlyingResponseHeaders: response.headers,\n\t};\n\n\treturn responseErr;\n}\n\n/**\n * Creates a 404 \"not found\" response for the given request\n * @param request - The request that resulted in the 404 response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.\n * @legacy\n * @beta\n */\nexport const create404Response = (request: IRequest): IResponse =>\n\tcreateResponseError(404, \"not found\", request);\n\n/**\n * Creates an error response with the specified status code and message\n * @param status - HTTP status code for the error (must not be 200)\n * @param value - Error message or description\n * @param request - The request that resulted in this error\n * @param headers - Optional headers to include in the response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error\n * @internal\n */\nexport function createResponseError(\n\tstatus: number,\n\tvalue: string,\n\trequest: IRequest,\n\theaders?: Record<string, unknown>,\n): IResponse {\n\tassert(status !== 200, 0x19b /* \"Cannot not create response error on 200 status\" */);\n\t// Omit query string which could contain personal data unfit for logging\n\tconst urlNoQuery = request.url?.split(\"?\")[0];\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\theaders,\n\t};\n}\n"]}
@@ -8,8 +8,7 @@ import type { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframewor
8
8
  /**
9
9
  * Casts the public API for delta manager into the internal one,
10
10
  * exposing access to APIs needed by the implementation of Fluid Framework but not its users.
11
- * @legacy
12
- * @alpha
11
+ * @legacy @beta
13
12
  */
14
13
  export declare function toDeltaManagerInternal(deltaManager: IDeltaManagerErased): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
15
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EACX,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,mBAAmB,GAC/B,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAE5D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,GACtE,mBAAmB,CAErB"}
1
+ {"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EACX,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,mBAAmB,GAC/B,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAG5D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,GACtE,mBAAmB,CAGrB"}
@@ -8,10 +8,10 @@ exports.toDeltaManagerErased = exports.toDeltaManagerInternal = void 0;
8
8
  /**
9
9
  * Casts the public API for delta manager into the internal one,
10
10
  * exposing access to APIs needed by the implementation of Fluid Framework but not its users.
11
- * @legacy
12
- * @alpha
11
+ * @legacy @beta
13
12
  */
14
13
  function toDeltaManagerInternal(deltaManager) {
14
+ // Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager
15
15
  return deltaManager;
16
16
  }
17
17
  exports.toDeltaManagerInternal = toDeltaManagerInternal;
@@ -20,6 +20,7 @@ exports.toDeltaManagerInternal = toDeltaManagerInternal;
20
20
  * @internal
21
21
  */
22
22
  function toDeltaManagerErased(deltaManager) {
23
+ // Type assertion is safe as we're intentionally erasing the type information for public API safety
23
24
  return deltaManager;
24
25
  }
25
26
  exports.toDeltaManagerErased = toDeltaManagerErased;
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;;;;GAKG;AACH,SAAgB,sBAAsB,CACrC,YAAiC;IAEjC,OAAO,YAAqF,CAAC;AAC9F,CAAC;AAJD,wDAIC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,YAAwE;IAExE,OAAO,YAA8C,CAAC;AACvD,CAAC;AAJD,oDAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type { IDeltaManagerErased } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Casts the public API for delta manager into the internal one,\n * exposing access to APIs needed by the implementation of Fluid Framework but not its users.\n * @legacy\n * @alpha\n */\nexport function toDeltaManagerInternal(\n\tdeltaManager: IDeltaManagerErased,\n): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\treturn deltaManager as unknown as IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n}\n\n/**\n * Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.\n * @internal\n */\nexport function toDeltaManagerErased(\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n): IDeltaManagerErased {\n\treturn deltaManager as unknown as IDeltaManagerErased;\n}\n"]}
1
+ {"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,YAAiC;IAEjC,sHAAsH;IACtH,OAAO,YAAqF,CAAC;AAC9F,CAAC;AALD,wDAKC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,YAAwE;IAExE,mGAAmG;IACnG,OAAO,YAA8C,CAAC;AACvD,CAAC;AALD,oDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type { IDeltaManagerErased } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Casts the public API for delta manager into the internal one,\n * exposing access to APIs needed by the implementation of Fluid Framework but not its users.\n * @legacy @beta\n */\nexport function toDeltaManagerInternal(\n\tdeltaManager: IDeltaManagerErased,\n): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t// Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager\n\treturn deltaManager as unknown as IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n}\n\n/**\n * Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.\n * @internal\n */\nexport function toDeltaManagerErased(\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n): IDeltaManagerErased {\n\t// Type assertion is safe as we're intentionally erasing the type information for public API safety\n\treturn deltaManager as unknown as IDeltaManagerErased;\n}\n"]}
package/dist/handles.d.ts CHANGED
@@ -24,11 +24,12 @@ export interface ISerializedHandle {
24
24
  readonly payloadPending?: true;
25
25
  }
26
26
  /**
27
- * Is the input object a @see ISerializedHandle?
27
+ * Narrow a value to {@link ISerializedHandle} by checking its type property.
28
28
  * @internal
29
29
  */
30
- export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
30
+ export declare const isSerializedHandle: (value: unknown) => value is ISerializedHandle;
31
31
  /**
32
+ * Checks if a Fluid handle's internal payload is pending.
32
33
  * @internal
33
34
  */
34
35
  export declare const isFluidHandleInternalPayloadPending: (fluidHandleInternal: IFluidHandleInternal) => fluidHandleInternal is IFluidHandleInternalPayloadPending<unknown>;
@@ -37,14 +38,12 @@ export declare const isFluidHandleInternalPayloadPending: (fluidHandleInternal:
37
38
  * @privateRemarks
38
39
  * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged
39
40
  * to IFluidHandle, this type guard will no longer be necessary.
40
- * @legacy
41
- * @alpha
41
+ * @legacy @beta
42
42
  */
43
43
  export declare const isFluidHandlePayloadPending: <T>(handle: IFluidHandle<T>) => handle is IFluidHandlePayloadPending<T>;
44
44
  /**
45
45
  * Check if the handle is an ILocalFluidHandle.
46
- * @legacy
47
- * @alpha
46
+ * @legacy @beta
48
47
  */
49
48
  export declare const isLocalFluidHandle: <T>(handle: IFluidHandle<T>) => handle is ILocalFluidHandle<T>;
50
49
  /**
@@ -71,20 +70,17 @@ export declare function isFluidHandle(value: unknown): value is IFluidHandle;
71
70
  export declare function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean;
72
71
  /**
73
72
  * Downcast an IFluidHandle to an IFluidHandleInternal.
74
- * @legacy
75
- * @alpha
73
+ * @legacy @beta
76
74
  */
77
75
  export declare function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T>;
78
76
  /**
79
77
  * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
80
- * @legacy
81
- * @alpha
78
+ * @legacy @beta
82
79
  */
83
80
  export declare function toFluidHandleErased<T>(handle: IFluidHandleInternal<T>): IFluidHandleErased<T>;
84
81
  /**
85
82
  * Base class which can be uses to assist implementing IFluidHandleInternal.
86
- * @legacy
87
- * @alpha
83
+ * @legacy @beta
88
84
  */
89
85
  export declare abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
90
86
  abstract absolutePath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EACX,oBAAoB,EACpB,kCAAkC,EAClC,0BAA0B,EAC1B,iBAAiB,EACjB,MAAM,0CAA0C,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEjC,IAAI,EAAE,kBAAkB,CAAC;IAGzB,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;;;OAQG;IACH,QAAQ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GG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACpC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC7B,kBAAkB,CAAC,CAAC,CAAC,CAGvB;AAED;;;GAGG;AACH,8BAAsB,eAAe,CAAC,CAAC,CAAE,YAAW,oBAAoB,CAAC,CAAC,CAAC;IAC1E,SAAgB,YAAY,EAAE,MAAM,CAAC;aACrB,WAAW,IAAI,IAAI;IACnC,kBAAyB,UAAU,EAAE,OAAO,CAAC;aAC7B,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,IAAW,YAAY,IAAI,oBAAoB,CAE9C;IAED,IAAW,CAAC,iBAAiB,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAEtD;CACD"}
package/dist/handles.js CHANGED
@@ -7,12 +7,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.FluidHandleBase = exports.toFluidHandleErased = exports.toFluidHandleInternal = exports.compareFluidHandles = exports.isFluidHandle = exports.encodeHandleForSerialization = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isSerializedHandle = void 0;
8
8
  const core_interfaces_1 = require("@fluidframework/core-interfaces");
9
9
  /**
10
- * Is the input object a @see ISerializedHandle?
10
+ * Narrow a value to {@link ISerializedHandle} by checking its type property.
11
11
  * @internal
12
12
  */
13
- const isSerializedHandle = (value) => value?.type === "__fluid_handle__";
13
+ const isSerializedHandle = (value) =>
14
+ // Type assertion is safe as we're only checking for the existence of the type property
15
+ value?.type === "__fluid_handle__";
14
16
  exports.isSerializedHandle = isSerializedHandle;
15
17
  /**
18
+ * Checks if a Fluid handle's internal payload is pending.
16
19
  * @internal
17
20
  */
18
21
  const isFluidHandleInternalPayloadPending = (fluidHandleInternal) => "payloadPending" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;
@@ -22,16 +25,14 @@ exports.isFluidHandleInternalPayloadPending = isFluidHandleInternalPayloadPendin
22
25
  * @privateRemarks
23
26
  * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged
24
27
  * to IFluidHandle, this type guard will no longer be necessary.
25
- * @legacy
26
- * @alpha
28
+ * @legacy @beta
27
29
  */
28
30
  const isFluidHandlePayloadPending = (handle) => "payloadState" in handle &&
29
31
  (handle.payloadState === "shared" || handle.payloadState === "pending");
30
32
  exports.isFluidHandlePayloadPending = isFluidHandlePayloadPending;
31
33
  /**
32
34
  * Check if the handle is an ILocalFluidHandle.
33
- * @legacy
34
- * @alpha
35
+ * @legacy @beta
35
36
  */
36
37
  const isLocalFluidHandle = (handle) => (0, exports.isFluidHandlePayloadPending)(handle) && "payloadShareError" in handle;
37
38
  exports.isLocalFluidHandle = isLocalFluidHandle;
@@ -83,6 +84,7 @@ function isFluidHandle(value) {
83
84
  // If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.
84
85
  if (enableBackwardsCompatibility && core_interfaces_1.IFluidHandle in value) {
85
86
  // Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]
87
+ // Type assertion is needed for backward compatibility with old FluidHandle format
86
88
  const inner = value[core_interfaces_1.IFluidHandle];
87
89
  if (typeof inner !== "object" || inner === null) {
88
90
  return false;
@@ -106,34 +108,34 @@ function compareFluidHandles(a, b) {
106
108
  exports.compareFluidHandles = compareFluidHandles;
107
109
  /**
108
110
  * Downcast an IFluidHandle to an IFluidHandleInternal.
109
- * @legacy
110
- * @alpha
111
+ * @legacy @beta
111
112
  */
112
113
  function toFluidHandleInternal(handle) {
113
114
  if (!(core_interfaces_1.fluidHandleSymbol in handle) || !(core_interfaces_1.fluidHandleSymbol in handle[core_interfaces_1.fluidHandleSymbol])) {
114
115
  if (enableBackwardsCompatibility && core_interfaces_1.IFluidHandle in handle) {
116
+ // Type assertion needed for backward compatibility with old handle format
115
117
  return handle[core_interfaces_1.IFluidHandle];
116
118
  }
117
119
  throw new TypeError("Invalid IFluidHandle");
118
120
  }
119
121
  // This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone
120
122
  // implements their own IFluidHandle in terms of an existing handle, it won't break anything.
123
+ // Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal
121
124
  return handle[core_interfaces_1.fluidHandleSymbol];
122
125
  }
123
126
  exports.toFluidHandleInternal = toFluidHandleInternal;
124
127
  /**
125
128
  * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
126
- * @legacy
127
- * @alpha
129
+ * @legacy @beta
128
130
  */
129
131
  function toFluidHandleErased(handle) {
132
+ // Type assertion is safe as we're intentionally erasing internal type information
130
133
  return handle;
131
134
  }
132
135
  exports.toFluidHandleErased = toFluidHandleErased;
133
136
  /**
134
137
  * Base class which can be uses to assist implementing IFluidHandleInternal.
135
- * @legacy
136
- * @alpha
138
+ * @legacy @beta
137
139
  */
138
140
  class FluidHandleBase {
139
141
  /**