@fluidframework/runtime-utils 2.61.0-355054 → 2.61.0-355603

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.
@@ -70,6 +70,15 @@ export declare function getConfigsForMinVersionForCollab<T extends Record<Semant
70
70
  * @internal
71
71
  */
72
72
  export declare function isValidMinVersionForCollab(minVersionForCollab: MinimumVersionForCollab): boolean;
73
+ /**
74
+ * Converts a SemanticVersion to a MinimumVersionForCollab.
75
+ * @param semanticVersion - The version to convert.
76
+ * @returns The version as a MinimumVersionForCollab.
77
+ * @throws UsageError if the version is not a valid MinimumVersionForCollab.
78
+ *
79
+ * @internal
80
+ */
81
+ export declare function semanticVersionToMinimumVersionForCollab(semanticVersion: SemanticVersion): MinimumVersionForCollab;
73
82
  /**
74
83
  * Generic function to validate runtime options against the minVersionForCollab.
75
84
  *
@@ -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,MAAM,CAAC,2BAA2B,EAAE,CAAC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Ae,EACpC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,EAC1B,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,GACnC,IAAI,CAyBN;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,CAAC,SAAS,MAAM,GAAG,MAAM,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"}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.configValueToMinVersionForCollab = exports.getValidationForRuntimeOptions = exports.isValidMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.defaultMinVersionForCollab = void 0;
7
+ exports.configValueToMinVersionForCollab = exports.getValidationForRuntimeOptions = exports.semanticVersionToMinimumVersionForCollab = exports.isValidMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.defaultMinVersionForCollab = void 0;
8
8
  const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
10
  const semver_ts_1 = require("semver-ts");
@@ -80,6 +80,22 @@ function isValidMinVersionForCollab(minVersionForCollab) {
80
80
  (0, semver_ts_1.lte)(minVersionForCollab, packageVersion_js_1.pkgVersion));
81
81
  }
82
82
  exports.isValidMinVersionForCollab = isValidMinVersionForCollab;
83
+ /**
84
+ * Converts a SemanticVersion to a MinimumVersionForCollab.
85
+ * @param semanticVersion - The version to convert.
86
+ * @returns The version as a MinimumVersionForCollab.
87
+ * @throws UsageError if the version is not a valid MinimumVersionForCollab.
88
+ *
89
+ * @internal
90
+ */
91
+ function semanticVersionToMinimumVersionForCollab(semanticVersion) {
92
+ const minVersionForCollab = semanticVersion;
93
+ if (!isValidMinVersionForCollab(minVersionForCollab)) {
94
+ throw new internal_2.UsageError(`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab.`);
95
+ }
96
+ return minVersionForCollab;
97
+ }
98
+ exports.semanticVersionToMinimumVersionForCollab = semanticVersionToMinimumVersionForCollab;
83
99
  /**
84
100
  * Generic function to validate runtime options against the minVersionForCollab.
85
101
  *
@@ -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;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,EAAE,OAAO,CAAC,EAAE,CAAC;gBACvC,oEAAoE;gBACpE,cAAc,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,OAAsC,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACP,6GAA6G;gBAC7G,sBAAsB;gBACtB,MAAM;YACP,CAAC;QACF,CAAC;IACF,CA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C,CAAC;IAChE,OAAO,CAAC,WAAc,EAAE,EAAE;QACzB,kGAAkG;QAClG,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,+BAA+B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC;QACD,4GAA4G;QAC5G,0GAA0G;QAC1G,4GAA4G;QAC5G,wGAAwG;QACxG,mHAAmH;QACnH,MAAM,gBAAgB,GAAsB,EAAE,CAAC;QAC/C,KAAK,MAAM,CACV,mBAAmB,EACnB,eAAe,EACf,IAAI,+BAA+B,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,IAAA,iBAAM,EACL,OAAO,mBAAmB,IAAI,QAAQ,EACtC,KAAK,CAAC,6CAA6C,CACnD,CAAC;YACF,gFAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,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]-?: 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"]}
1
+ {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAE7D,uEAAsE;AACtE,yCAAyD;AAEzD,2DAAiD;AAEjD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,CAAC;YACrC,OAAO,+BAA+B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC;QACD,4GAA4G;QAC5G,0GAA0G;QAC1G,4GAA4G;QAC5G,wGAAwG;QACxG,mHAAmH;QACnH,MAAM,gBAAgB,GAAsB,EAAE,CAAC;QAC/C,KAAK,MAAM,CACV,mBAAmB,EACnB,eAAe,EACf,IAAI,+BAA+B,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,IAAA,iBAAM,EACL,OAAO,mBAAmB,IAAI,QAAQ,EACtC,KAAK,CAAC,6CAA6C,CACnD,CAAC;YACF,gFAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,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]-?: 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 * Converts a SemanticVersion to a MinimumVersionForCollab.\n * @param semanticVersion - The version to convert.\n * @returns The version as a MinimumVersionForCollab.\n * @throws UsageError if the version is not a valid MinimumVersionForCollab.\n *\n * @internal\n */\nexport function semanticVersionToMinimumVersionForCollab(\n\tsemanticVersion: SemanticVersion,\n): MinimumVersionForCollab {\n\tconst minVersionForCollab = semanticVersion as MinimumVersionForCollab;\n\tif (!isValidMinVersionForCollab(minVersionForCollab)) {\n\t\tthrow new UsageError(\n\t\t\t`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab.`,\n\t\t);\n\t}\n\n\treturn minVersionForCollab;\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"]}
package/dist/handles.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
5
6
  import type { IFluidHandleErased } from "@fluidframework/core-interfaces";
6
7
  import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
7
8
  import type { IFluidHandleInternal, IFluidHandleInternalPayloadPending, IFluidHandlePayloadPending, ILocalFluidHandle } from "@fluidframework/core-interfaces/internal";
@@ -93,4 +94,22 @@ export declare abstract class FluidHandleBase<T> implements IFluidHandleInternal
93
94
  get IFluidHandle(): IFluidHandleInternal;
94
95
  get [fluidHandleSymbol](): IFluidHandleErased<T>;
95
96
  }
97
+ /**
98
+ * Lookup the blob storage ID for a blob handle.
99
+ * @param containerRuntime - The container runtime instance
100
+ * @param handle - The blob handle to lookup the storage ID for
101
+ * @returns The storage ID if found and the blob is not pending, undefined otherwise
102
+ * @remarks
103
+ * This is a legacy+alpha helper function that provides access to blob storage IDs.
104
+ * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.
105
+ * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)
106
+ * to understand/wait for storage ID availability.
107
+ * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.
108
+ *
109
+ * Warning: the returned blob URL may expire and does not support permalinks.
110
+ * This API is intended for temporary integration scenarios only.
111
+ * @legacy
112
+ * @alpha
113
+ */
114
+ export declare function lookupTemporaryBlobStorageId(containerRuntime: IContainerRuntime, handle: IFluidHandle): string | undefined;
96
115
  //# sourceMappingURL=handles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handles.d.ts","sourceRoot":"","sources":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cACtB,aAAa,CAAC,CAAC,mCAE6C,CAAC;AACtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,CAW5F;AAcD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAmBnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAI7E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAazF;AAED;;;GAGG;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;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC3C,gBAAgB,EAAE,iBAAiB,EACnC,MAAM,EAAE,YAAY,GAClB,MAAM,GAAG,SAAS,CA2BpB"}
package/dist/handles.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.FluidHandleBase = exports.toFluidHandleErased = exports.toFluidHandleInternal = exports.compareFluidHandles = exports.isFluidHandle = exports.encodeHandleForSerialization = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isSerializedHandle = void 0;
7
+ exports.lookupTemporaryBlobStorageId = 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
10
  * Narrow a value to {@link ISerializedHandle} by checking its type property.
@@ -149,4 +149,42 @@ class FluidHandleBase {
149
149
  }
150
150
  }
151
151
  exports.FluidHandleBase = FluidHandleBase;
152
+ /**
153
+ * Lookup the blob storage ID for a blob handle.
154
+ * @param containerRuntime - The container runtime instance
155
+ * @param handle - The blob handle to lookup the storage ID for
156
+ * @returns The storage ID if found and the blob is not pending, undefined otherwise
157
+ * @remarks
158
+ * This is a legacy+alpha helper function that provides access to blob storage IDs.
159
+ * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.
160
+ * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)
161
+ * to understand/wait for storage ID availability.
162
+ * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.
163
+ *
164
+ * Warning: the returned blob URL may expire and does not support permalinks.
165
+ * This API is intended for temporary integration scenarios only.
166
+ * @legacy
167
+ * @alpha
168
+ */
169
+ function lookupTemporaryBlobStorageId(containerRuntime, handle) {
170
+ // Verify that the handle points to a blob by checking its path format
171
+ const absolutePath = toFluidHandleInternal(handle).absolutePath;
172
+ // Blob handles have paths in the format "/_blobs/{localId}"
173
+ if (!absolutePath?.startsWith("/_blobs/")) {
174
+ throw new Error("Handle does not point to a blob - expected path to start with '/_blobs/'");
175
+ }
176
+ // Extract the local ID from the path
177
+ const pathParts = absolutePath.split("/");
178
+ if (pathParts.length !== 3 ||
179
+ pathParts[1] !== "_blobs" ||
180
+ pathParts[2] === undefined ||
181
+ pathParts[2] === "") {
182
+ throw new Error("Invalid blob handle path format");
183
+ }
184
+ const localId = pathParts[2];
185
+ // Cast the runtime to the internal interface and call the lookup method
186
+ const internalRuntime = containerRuntime;
187
+ return internalRuntime.lookupTemporaryBlobStorageId(localId);
188
+ }
189
+ exports.lookupTemporaryBlobStorageId = lookupTemporaryBlobStorageId;
152
190
  //# sourceMappingURL=handles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAAkF;AA+BlF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA8B,EAAE;AAChF,uFAAuF;AACtF,KAAuC,EAAE,IAAI,KAAK,kBAAkB,CAAC;AAF1D,QAAA,kBAAkB,sBAEwC;AAEvE;;;GAGG;AACI,MAAM,mCAAmC,GAAG,CAClD,mBAAyC,EACmB,EAAE,CAC9D,gBAAgB,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,cAAc,KAAK,IAAI,CAAC;AAH3E,QAAA,mCAAmC,uCAGwC;AAExF;;;;;;GAMG;AACI,MAAM,2BAA2B,GAAG,CAC1C,MAAuB,EACmB,EAAE,CAC5C,cAAc,IAAI,MAAM;IACxB,CAAC,MAAM,CAAC,YAAY,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC;AAJ5D,QAAA,2BAA2B,+BAIiC;AAEzE;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CACjC,MAAuB,EACU,EAAE,CACnC,IAAA,mCAA2B,EAAC,MAAM,CAAC,IAAI,mBAAmB,IAAI,MAAM,CAAC;AAHzD,QAAA,kBAAkB,sBAGuC;AACtE;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,MAA4B;IACxE,OAAO,IAAA,2CAAmC,EAAC,MAAM,CA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,mCAAiB,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,mCAAiB,IAAI,MAAM,CAAC,mCAAiB,CAAC,CAAC,EAAE,CAAC;QACzF,IAAI,4BAA4B,IAAI,8BAAY,IAAI,MAAM,EAAE,CAAC;YAC5D,0EAA0E;YAC1E,OAAO,MAAM,CAAC,8BAAY,CAA4B,CAAC;QACxD,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC;IAED,kGAAkG;IAClG,6FAA6F;IAC7F,+FAA+F;IAC/F,OAAO,MAAM,CAAC,mCAAiB,CAAuC,CAAC;AACxE,CAAC;AAbD,sDAaC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAClC,MAA+B;IAE/B,kFAAkF;IAClF,OAAO,MAA0C,CAAC;AACnD,CAAC;AALD,kDAKC;AAED;;;GAGG;AACH,MAAsB,eAAe;IAMpC;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,CAAC,mCAAiB,CAAC;QAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACD;AAhBD,0CAgBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandleErased } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n} from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * JSON serialized form of an IFluidHandle\n * @internal\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n\n\t/**\n\t * The handle may have a pending payload, as determined by and resolvable by the subsystem that\n\t * the handle relates to. For instance, the BlobManager uses this to distinguish blob handles\n\t * which may not yet have an attached blob yet.\n\t *\n\t * @remarks\n\t * Will only exist if the handle was created with a pending payload, will be omitted entirely from\n\t * the serialized format if the handle was created with an already-shared payload.\n\t */\n\treadonly payloadPending?: true;\n}\n\n/**\n * Narrow a value to {@link ISerializedHandle} by checking its type property.\n * @internal\n */\nexport const isSerializedHandle = (value: unknown): value is ISerializedHandle =>\n\t// Type assertion is safe as we're only checking for the existence of the type property\n\t(value as { type?: string } | undefined)?.type === \"__fluid_handle__\";\n\n/**\n * Checks if a Fluid handle's internal payload is pending.\n * @internal\n */\nexport const isFluidHandleInternalPayloadPending = (\n\tfluidHandleInternal: IFluidHandleInternal,\n): fluidHandleInternal is IFluidHandleInternalPayloadPending =>\n\t\"payloadPending\" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;\n\n/**\n * Check if the handle is an IFluidHandlePayloadPending.\n * @privateRemarks\n * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged\n * to IFluidHandle, this type guard will no longer be necessary.\n * @legacy @beta\n */\nexport const isFluidHandlePayloadPending = <T>(\n\thandle: IFluidHandle<T>,\n): handle is IFluidHandlePayloadPending<T> =>\n\t\"payloadState\" in handle &&\n\t(handle.payloadState === \"shared\" || handle.payloadState === \"pending\");\n\n/**\n * Check if the handle is an ILocalFluidHandle.\n * @legacy @beta\n */\nexport const isLocalFluidHandle = <T>(\n\thandle: IFluidHandle<T>,\n): handle is ILocalFluidHandle<T> =>\n\tisFluidHandlePayloadPending(handle) && \"payloadShareError\" in handle;\n/**\n * Encodes the given IFluidHandle into a JSON-serializable form,\n * @param handle - The IFluidHandle to serialize.\n * @returns The serialized handle.\n *\n * @internal\n */\nexport function encodeHandleForSerialization(handle: IFluidHandleInternal): ISerializedHandle {\n\treturn isFluidHandleInternalPayloadPending(handle)\n\t\t? {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t\tpayloadPending: true,\n\t\t\t}\n\t\t: {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t};\n}\n\n/**\n * Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).\n *\n * Some code which uses this library might dynamically load multiple versions of it,\n * as well as old or duplicated versions of packages which produce or implement handles.\n * To correctly interoperate with this old packages and object produced by them, the old in-memory format for handles, without the symbol, are explicitly supported.\n *\n * This setting mostly exists as a way to easily find any code that only exists to provide this compatibility and clarify how to remove that compatibility.\n * At some point this might be removed or turned into an actual configuration option, but for now its really just documentation.\n */\nconst enableBackwardsCompatibility = true;\n\n/**\n * Check if a value is an {@link @fluidframework/core-interfaces#IFluidHandle}.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @public\n */\nexport function isFluidHandle(value: unknown): value is IFluidHandle {\n\t// `in` gives a type error on non-objects and null, so filter them out\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tif (fluidHandleSymbol in value) {\n\t\treturn true;\n\t}\n\t// If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.\n\tif (enableBackwardsCompatibility && IFluidHandle in value) {\n\t\t// Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]\n\t\t// Type assertion is needed for backward compatibility with old FluidHandle format\n\t\tconst inner = value[IFluidHandle] as IFluidHandle;\n\t\tif (typeof inner !== \"object\" || inner === null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn IFluidHandle in inner;\n\t}\n\treturn false;\n}\n\n/**\n * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.\n * @remarks\n * Returns true iff both handles have the same internal `absolutePath`.\n * @public\n */\nexport function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean {\n\tconst aInternal = toFluidHandleInternal(a);\n\tconst bInternal = toFluidHandleInternal(b);\n\treturn aInternal.absolutePath === bInternal.absolutePath;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @legacy @beta\n */\nexport function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T> {\n\tif (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {\n\t\tif (enableBackwardsCompatibility && IFluidHandle in handle) {\n\t\t\t// Type assertion needed for backward compatibility with old handle format\n\t\t\treturn handle[IFluidHandle] as IFluidHandleInternal<T>;\n\t\t}\n\t\tthrow new TypeError(\"Invalid IFluidHandle\");\n\t}\n\n\t// This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone\n\t// implements their own IFluidHandle in terms of an existing handle, it won't break anything.\n\t// Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal\n\treturn handle[fluidHandleSymbol] as unknown as IFluidHandleInternal<T>;\n}\n\n/**\n * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.\n * @legacy @beta\n */\nexport function toFluidHandleErased<T>(\n\thandle: IFluidHandleInternal<T>,\n): IFluidHandleErased<T> {\n\t// Type assertion is safe as we're intentionally erasing internal type information\n\treturn handle as unknown as IFluidHandleErased<T>;\n}\n\n/**\n * Base class which can be uses to assist implementing IFluidHandleInternal.\n * @legacy @beta\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): void;\n\tpublic abstract readonly isAttached: boolean;\n\tpublic abstract get(): Promise<T>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandleInternal {\n\t\treturn this;\n\t}\n\n\tpublic get [fluidHandleSymbol](): IFluidHandleErased<T> {\n\t\treturn toFluidHandleErased(this);\n\t}\n}\n"]}
1
+ {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings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E,CAAC;AAbD,sDAaC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAClC,MAA+B;IAE/B,kFAAkF;IAClF,OAAO,MAA0C,CAAC;AACnD,CAAC;AALD,kDAKC;AAED;;;GAGG;AACH,MAAsB,eAAe;IAMpC;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,CAAC,mCAAiB,CAAC;QAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACD;AAhBD,0CAgBC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,4BAA4B,CAC3C,gBAAmC,EACnC,MAAoB;IAEpB,sEAAsE;IACtE,MAAM,YAAY,GAAuB,qBAAqB,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC;IAEpF,4DAA4D;IAC5D,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CACd,0EAA0E,CAC1E,CAAC;IACH,CAAC;IAED,qCAAqC;IACrC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,IACC,SAAS,CAAC,MAAM,KAAK,CAAC;QACtB,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ;QACzB,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS;QAC1B,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,EAClB,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAE7B,wEAAwE;IACxE,MAAM,eAAe,GAAG,gBAA6C,CAAC;IACtE,OAAO,eAAe,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC9D,CAAC;AA9BD,oEA8BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainerRuntime,\n\tIContainerRuntimeInternal,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IFluidHandleErased } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n} from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * JSON serialized form of an IFluidHandle\n * @internal\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n\n\t/**\n\t * The handle may have a pending payload, as determined by and resolvable by the subsystem that\n\t * the handle relates to. For instance, the BlobManager uses this to distinguish blob handles\n\t * which may not yet have an attached blob yet.\n\t *\n\t * @remarks\n\t * Will only exist if the handle was created with a pending payload, will be omitted entirely from\n\t * the serialized format if the handle was created with an already-shared payload.\n\t */\n\treadonly payloadPending?: true;\n}\n\n/**\n * Narrow a value to {@link ISerializedHandle} by checking its type property.\n * @internal\n */\nexport const isSerializedHandle = (value: unknown): value is ISerializedHandle =>\n\t// Type assertion is safe as we're only checking for the existence of the type property\n\t(value as { type?: string } | undefined)?.type === \"__fluid_handle__\";\n\n/**\n * Checks if a Fluid handle's internal payload is pending.\n * @internal\n */\nexport const isFluidHandleInternalPayloadPending = (\n\tfluidHandleInternal: IFluidHandleInternal,\n): fluidHandleInternal is IFluidHandleInternalPayloadPending =>\n\t\"payloadPending\" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;\n\n/**\n * Check if the handle is an IFluidHandlePayloadPending.\n * @privateRemarks\n * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged\n * to IFluidHandle, this type guard will no longer be necessary.\n * @legacy @beta\n */\nexport const isFluidHandlePayloadPending = <T>(\n\thandle: IFluidHandle<T>,\n): handle is IFluidHandlePayloadPending<T> =>\n\t\"payloadState\" in handle &&\n\t(handle.payloadState === \"shared\" || handle.payloadState === \"pending\");\n\n/**\n * Check if the handle is an ILocalFluidHandle.\n * @legacy @beta\n */\nexport const isLocalFluidHandle = <T>(\n\thandle: IFluidHandle<T>,\n): handle is ILocalFluidHandle<T> =>\n\tisFluidHandlePayloadPending(handle) && \"payloadShareError\" in handle;\n/**\n * Encodes the given IFluidHandle into a JSON-serializable form,\n * @param handle - The IFluidHandle to serialize.\n * @returns The serialized handle.\n *\n * @internal\n */\nexport function encodeHandleForSerialization(handle: IFluidHandleInternal): ISerializedHandle {\n\treturn isFluidHandleInternalPayloadPending(handle)\n\t\t? {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t\tpayloadPending: true,\n\t\t\t}\n\t\t: {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t};\n}\n\n/**\n * Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).\n *\n * Some code which uses this library might dynamically load multiple versions of it,\n * as well as old or duplicated versions of packages which produce or implement handles.\n * To correctly interoperate with this old packages and object produced by them, the old in-memory format for handles, without the symbol, are explicitly supported.\n *\n * This setting mostly exists as a way to easily find any code that only exists to provide this compatibility and clarify how to remove that compatibility.\n * At some point this might be removed or turned into an actual configuration option, but for now its really just documentation.\n */\nconst enableBackwardsCompatibility = true;\n\n/**\n * Check if a value is an {@link @fluidframework/core-interfaces#IFluidHandle}.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @public\n */\nexport function isFluidHandle(value: unknown): value is IFluidHandle {\n\t// `in` gives a type error on non-objects and null, so filter them out\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tif (fluidHandleSymbol in value) {\n\t\treturn true;\n\t}\n\t// If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.\n\tif (enableBackwardsCompatibility && IFluidHandle in value) {\n\t\t// Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]\n\t\t// Type assertion is needed for backward compatibility with old FluidHandle format\n\t\tconst inner = value[IFluidHandle] as IFluidHandle;\n\t\tif (typeof inner !== \"object\" || inner === null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn IFluidHandle in inner;\n\t}\n\treturn false;\n}\n\n/**\n * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.\n * @remarks\n * Returns true iff both handles have the same internal `absolutePath`.\n * @public\n */\nexport function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean {\n\tconst aInternal = toFluidHandleInternal(a);\n\tconst bInternal = toFluidHandleInternal(b);\n\treturn aInternal.absolutePath === bInternal.absolutePath;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @legacy @beta\n */\nexport function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T> {\n\tif (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {\n\t\tif (enableBackwardsCompatibility && IFluidHandle in handle) {\n\t\t\t// Type assertion needed for backward compatibility with old handle format\n\t\t\treturn handle[IFluidHandle] as IFluidHandleInternal<T>;\n\t\t}\n\t\tthrow new TypeError(\"Invalid IFluidHandle\");\n\t}\n\n\t// This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone\n\t// implements their own IFluidHandle in terms of an existing handle, it won't break anything.\n\t// Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal\n\treturn handle[fluidHandleSymbol] as unknown as IFluidHandleInternal<T>;\n}\n\n/**\n * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.\n * @legacy @beta\n */\nexport function toFluidHandleErased<T>(\n\thandle: IFluidHandleInternal<T>,\n): IFluidHandleErased<T> {\n\t// Type assertion is safe as we're intentionally erasing internal type information\n\treturn handle as unknown as IFluidHandleErased<T>;\n}\n\n/**\n * Base class which can be uses to assist implementing IFluidHandleInternal.\n * @legacy @beta\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): void;\n\tpublic abstract readonly isAttached: boolean;\n\tpublic abstract get(): Promise<T>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandleInternal {\n\t\treturn this;\n\t}\n\n\tpublic get [fluidHandleSymbol](): IFluidHandleErased<T> {\n\t\treturn toFluidHandleErased(this);\n\t}\n}\n\n/**\n * Lookup the blob storage ID for a blob handle.\n * @param containerRuntime - The container runtime instance\n * @param handle - The blob handle to lookup the storage ID for\n * @returns The storage ID if found and the blob is not pending, undefined otherwise\n * @remarks\n * This is a legacy+alpha helper function that provides access to blob storage IDs.\n * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.\n * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)\n * to understand/wait for storage ID availability.\n * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.\n *\n * Warning: the returned blob URL may expire and does not support permalinks.\n * This API is intended for temporary integration scenarios only.\n * @legacy\n * @alpha\n */\nexport function lookupTemporaryBlobStorageId(\n\tcontainerRuntime: IContainerRuntime,\n\thandle: IFluidHandle,\n): string | undefined {\n\t// Verify that the handle points to a blob by checking its path format\n\tconst absolutePath: string | undefined = toFluidHandleInternal(handle).absolutePath;\n\n\t// Blob handles have paths in the format \"/_blobs/{localId}\"\n\tif (!absolutePath?.startsWith(\"/_blobs/\")) {\n\t\tthrow new Error(\n\t\t\t\"Handle does not point to a blob - expected path to start with '/_blobs/'\",\n\t\t);\n\t}\n\n\t// Extract the local ID from the path\n\tconst pathParts = absolutePath.split(\"/\");\n\tif (\n\t\tpathParts.length !== 3 ||\n\t\tpathParts[1] !== \"_blobs\" ||\n\t\tpathParts[2] === undefined ||\n\t\tpathParts[2] === \"\"\n\t) {\n\t\tthrow new Error(\"Invalid blob handle path format\");\n\t}\n\n\tconst localId = pathParts[2];\n\n\t// Cast the runtime to the internal interface and call the lookup method\n\tconst internalRuntime = containerRuntime as IContainerRuntimeInternal;\n\treturn internalRuntime.lookupTemporaryBlobStorageId(localId);\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export { generateHandleContextPath } from "./dataStoreHandleContextUtils.js";
6
6
  export { create404Response, createResponseError, exceptionToResponse, responseToException, } from "./dataStoreHelpers.js";
7
- export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
7
+ export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, lookupTemporaryBlobStorageId, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
8
8
  export type { ISerializedHandle } from "./handles.js";
9
9
  export { ObjectStoragePartition } from "./objectstoragepartition.js";
10
10
  export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath, } from "./objectstorageutils.js";
@@ -17,6 +17,6 @@ export { RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.j
17
17
  export type { ReadAndParseBlob } from "./utils.js";
18
18
  export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
19
19
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
20
- export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, } from "./compatibilityBase.js";
20
+ export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, semanticVersionToMinimumVersionForCollab, } from "./compatibilityBase.js";
21
21
  export type { ConfigMap, ConfigValidationMap, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,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yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,0BAA0B,EAC1B,wCAAwC,GACxC,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACX,SAAS,EACT,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,GACf,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.isValidMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.getValidationForRuntimeOptions = exports.defaultMinVersionForCollab = exports.configValueToMinVersionForCollab = exports.toDeltaManagerInternal = exports.toDeltaManagerErased = exports.isSnapshotFetchRequiredForLoadingGroupId = exports.encodeCompactIdToString = exports.seqFromTree = exports.RuntimeHeaders = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.processAttachMessageGCData = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.RemoteFluidObjectHandle = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.toFluidHandleInternal = exports.toFluidHandleErased = exports.isSerializedHandle = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isFluidHandle = exports.FluidHandleBase = exports.encodeHandleForSerialization = exports.compareFluidHandles = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.create404Response = exports.generateHandleContextPath = void 0;
7
+ exports.semanticVersionToMinimumVersionForCollab = exports.isValidMinVersionForCollab = exports.getConfigsForMinVersionForCollab = exports.getValidationForRuntimeOptions = exports.defaultMinVersionForCollab = exports.configValueToMinVersionForCollab = exports.toDeltaManagerInternal = exports.toDeltaManagerErased = exports.isSnapshotFetchRequiredForLoadingGroupId = exports.encodeCompactIdToString = exports.seqFromTree = exports.RuntimeHeaders = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.processAttachMessageGCData = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.RemoteFluidObjectHandle = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.toFluidHandleInternal = exports.toFluidHandleErased = exports.lookupTemporaryBlobStorageId = exports.isSerializedHandle = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isFluidHandle = exports.FluidHandleBase = exports.encodeHandleForSerialization = exports.compareFluidHandles = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.create404Response = exports.generateHandleContextPath = void 0;
8
8
  var dataStoreHandleContextUtils_js_1 = require("./dataStoreHandleContextUtils.js");
9
9
  Object.defineProperty(exports, "generateHandleContextPath", { enumerable: true, get: function () { return dataStoreHandleContextUtils_js_1.generateHandleContextPath; } });
10
10
  var dataStoreHelpers_js_1 = require("./dataStoreHelpers.js");
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "isFluidHandleInternalPayloadPending", { enumerab
21
21
  Object.defineProperty(exports, "isFluidHandlePayloadPending", { enumerable: true, get: function () { return handles_js_1.isFluidHandlePayloadPending; } });
22
22
  Object.defineProperty(exports, "isLocalFluidHandle", { enumerable: true, get: function () { return handles_js_1.isLocalFluidHandle; } });
23
23
  Object.defineProperty(exports, "isSerializedHandle", { enumerable: true, get: function () { return handles_js_1.isSerializedHandle; } });
24
+ Object.defineProperty(exports, "lookupTemporaryBlobStorageId", { enumerable: true, get: function () { return handles_js_1.lookupTemporaryBlobStorageId; } });
24
25
  Object.defineProperty(exports, "toFluidHandleErased", { enumerable: true, get: function () { return handles_js_1.toFluidHandleErased; } });
25
26
  Object.defineProperty(exports, "toFluidHandleInternal", { enumerable: true, get: function () { return handles_js_1.toFluidHandleInternal; } });
26
27
  var objectstoragepartition_js_1 = require("./objectstoragepartition.js");
@@ -66,4 +67,5 @@ Object.defineProperty(exports, "defaultMinVersionForCollab", { enumerable: true,
66
67
  Object.defineProperty(exports, "getValidationForRuntimeOptions", { enumerable: true, get: function () { return compatibilityBase_js_1.getValidationForRuntimeOptions; } });
67
68
  Object.defineProperty(exports, "getConfigsForMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.getConfigsForMinVersionForCollab; } });
68
69
  Object.defineProperty(exports, "isValidMinVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.isValidMinVersionForCollab; } });
70
+ Object.defineProperty(exports, "semanticVersionToMinimumVersionForCollab", { enumerable: true, get: function () { return compatibilityBase_js_1.semanticVersionToMinimumVersionForCollab; } });
69
71
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 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;AAHnB,0GAAA,cAAc,OAAA;AACd,uGAAA,WAAW,OAAA;AACX,mHAAA,uBAAuB,OAAA;AAGxB,uDAA8E;AAArE,4IAAA,wCAAwC,OAAA;AACjD,qDAG2B;AAF1B,uHAAA,oBAAoB,OAAA;AACpB,yHAAA,sBAAsB,OAAA;AAEvB,+DAMgC;AAL/B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,sIAAA,8BAA8B,OAAA;AAC9B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mFAA6E;AAApE,2IAAA,yBAAyB,OAAA;AAClC,6DAK+B;AAJ9B,wHAAA,iBAAiB,OAAA;AACjB,0HAAA,mBAAmB,OAAA;AACnB,0HAAA,mBAAmB,OAAA;AACnB,0HAAA,mBAAmB,OAAA;AAEpB,2CAYsB;AAXrB,iHAAA,mBAAmB,OAAA;AACnB,0HAAA,4BAA4B,OAAA;AAC5B,6GAAA,eAAe,OAAA;AACf,2GAAA,aAAa,OAAA;AACb,iIAAA,mCAAmC,OAAA;AACnC,yHAAA,2BAA2B,OAAA;AAC3B,gHAAA,kBAAkB,OAAA;AAClB,gHAAA,kBAAkB,OAAA;AAClB,0HAAA,4BAA4B,OAAA;AAC5B,iHAAA,mBAAmB,OAAA;AACnB,mHAAA,qBAAqB,OAAA;AAGtB,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,iEAGiC;AAFhC,4IAAA,mCAAmC,OAAA;AACnC,4HAAA,mBAAmB,OAAA;AAEpB,2EAAuE;AAA9D,qIAAA,uBAAuB,OAAA;AAChC,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,qEAAiE;AAAxD,+HAAA,oBAAoB,OAAA;AAC7B,qDAe2B;AAd1B,mHAAA,gBAAgB,OAAA;AAChB,8HAAA,2BAA2B,OAAA;AAC3B,iHAAA,cAAc,OAAA;AACd,mIAAA,gCAAgC,OAAA;AAChC,4HAAA,yBAAyB,OAAA;AACzB,uHAAA,oBAAoB,OAAA;AACpB,gIAAA,6BAA6B,OAAA;AAC7B,gHAAA,aAAa,OAAA;AACb,8GAAA,WAAW,OAAA;AACX,6GAAA,UAAU,OAAA;AACV,6HAAA,0BAA0B,OAAA;AAC1B,qHAAA,kBAAkB,OAAA;AAClB,mHAAA,gBAAgB,OAAA;AAChB,iHAAA,cAAc,OAAA;AAEf,6DAAmE;AAA1D,iIAAA,0BAA0B,OAAA;AACnC,uCAIoB;AAHnB,0GAAA,cAAc,OAAA;AACd,uGAAA,WAAW,OAAA;AACX,mHAAA,uBAAuB,OAAA;AAGxB,uDAA8E;AAArE,4IAAA,wCAAwC,OAAA;AACjD,qDAG2B;AAF1B,uHAAA,oBAAoB,OAAA;AACpB,yHAAA,sBAAsB,OAAA;AAEvB,+DAOgC;AAN/B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,sIAAA,8BAA8B,OAAA;AAC9B,wIAAA,gCAAgC,OAAA;AAChC,kIAAA,0BAA0B,OAAA;AAC1B,gJAAA,wCAAwC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\tlookupTemporaryBlobStorageId,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tsemanticVersionToMinimumVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/runtime-utils";
8
- export declare const pkgVersion = "2.61.0-355054";
8
+ export declare const pkgVersion = "2.61.0-355603";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/runtime-utils";
11
- exports.pkgVersion = "2.61.0-355054";
11
+ exports.pkgVersion = "2.61.0-355603";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.61.0-355054\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.61.0-355603\";\n"]}
package/internal.d.ts CHANGED
@@ -8,4 +8,4 @@
8
8
  * Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
- export * from "lib/index.js";
11
+ export * from "./lib/index.js";
package/legacy.d.ts CHANGED
@@ -8,4 +8,4 @@
8
8
  * Generated by "flub generate entrypoints" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
- export * from "lib/legacy.js";
11
+ export * from "./lib/legacy.js";
@@ -70,6 +70,15 @@ export declare function getConfigsForMinVersionForCollab<T extends Record<Semant
70
70
  * @internal
71
71
  */
72
72
  export declare function isValidMinVersionForCollab(minVersionForCollab: MinimumVersionForCollab): boolean;
73
+ /**
74
+ * Converts a SemanticVersion to a MinimumVersionForCollab.
75
+ * @param semanticVersion - The version to convert.
76
+ * @returns The version as a MinimumVersionForCollab.
77
+ * @throws UsageError if the version is not a valid MinimumVersionForCollab.
78
+ *
79
+ * @internal
80
+ */
81
+ export declare function semanticVersionToMinimumVersionForCollab(semanticVersion: SemanticVersion): MinimumVersionForCollab;
73
82
  /**
74
83
  * Generic function to validate runtime options against the minVersionForCollab.
75
84
  *
@@ -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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B,CASzB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/E,mBAAmB,EAAE,eAAe,EACpC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,EAC1B,aAAa,EAAE,mBAAmB,CAAC,CAAC,CAAC,GACnC,IAAI,CAyBN;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC/C,CAAC,SAAS,MAAM,GAAG,MAAM,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"}
@@ -75,6 +75,21 @@ export function isValidMinVersionForCollab(minVersionForCollab) {
75
75
  gte(minVersionForCollab, lowestMinVersionForCollab) &&
76
76
  lte(minVersionForCollab, pkgVersion));
77
77
  }
78
+ /**
79
+ * Converts a SemanticVersion to a MinimumVersionForCollab.
80
+ * @param semanticVersion - The version to convert.
81
+ * @returns The version as a MinimumVersionForCollab.
82
+ * @throws UsageError if the version is not a valid MinimumVersionForCollab.
83
+ *
84
+ * @internal
85
+ */
86
+ export function semanticVersionToMinimumVersionForCollab(semanticVersion) {
87
+ const minVersionForCollab = semanticVersion;
88
+ if (!isValidMinVersionForCollab(minVersionForCollab)) {
89
+ throw new UsageError(`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab.`);
90
+ }
91
+ return minVersionForCollab;
92
+ }
78
93
  /**
79
94
  * Generic function to validate runtime options against the minVersionForCollab.
80
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA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BAAgB,GAAsB,EAAE,CAAC;QAC/C,KAAK,MAAM,CACV,mBAAmB,EACnB,eAAe,EACf,IAAI,+BAA+B,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,MAAM,CACL,OAAO,mBAAmB,IAAI,QAAQ,EACtC,KAAK,CAAC,6CAA6C,CACnD,CAAC;YACF,gFAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,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,OAAO,CAAC,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","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"]}
1
+ {"version":3,"file":"compatibilityBase.js","sourceRoot":"","sources":["../src/compatibilityBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACtC,gBAA2D,CAAC;AAE7D;;;;;GAKG;AACH,MA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BAAgB,GAAsB,EAAE,CAAC;QAC/C,KAAK,MAAM,CACV,mBAAmB,EACnB,eAAe,EACf,IAAI,+BAA+B,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,MAAM,CACL,OAAO,mBAAmB,IAAI,QAAQ,EACtC,KAAK,CAAC,6CAA6C,CACnD,CAAC;YACF,gFAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,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,OAAO,CAAC,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","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 * Converts a SemanticVersion to a MinimumVersionForCollab.\n * @param semanticVersion - The version to convert.\n * @returns The version as a MinimumVersionForCollab.\n * @throws UsageError if the version is not a valid MinimumVersionForCollab.\n *\n * @internal\n */\nexport function semanticVersionToMinimumVersionForCollab(\n\tsemanticVersion: SemanticVersion,\n): MinimumVersionForCollab {\n\tconst minVersionForCollab = semanticVersion as MinimumVersionForCollab;\n\tif (!isValidMinVersionForCollab(minVersionForCollab)) {\n\t\tthrow new UsageError(\n\t\t\t`Version ${minVersionForCollab} is not a valid MinimumVersionForCollab.`,\n\t\t);\n\t}\n\n\treturn minVersionForCollab;\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"]}
package/lib/handles.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import type { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
5
6
  import type { IFluidHandleErased } from "@fluidframework/core-interfaces";
6
7
  import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
7
8
  import type { IFluidHandleInternal, IFluidHandleInternalPayloadPending, IFluidHandlePayloadPending, ILocalFluidHandle } from "@fluidframework/core-interfaces/internal";
@@ -93,4 +94,22 @@ export declare abstract class FluidHandleBase<T> implements IFluidHandleInternal
93
94
  get IFluidHandle(): IFluidHandleInternal;
94
95
  get [fluidHandleSymbol](): IFluidHandleErased<T>;
95
96
  }
97
+ /**
98
+ * Lookup the blob storage ID for a blob handle.
99
+ * @param containerRuntime - The container runtime instance
100
+ * @param handle - The blob handle to lookup the storage ID for
101
+ * @returns The storage ID if found and the blob is not pending, undefined otherwise
102
+ * @remarks
103
+ * This is a legacy+alpha helper function that provides access to blob storage IDs.
104
+ * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.
105
+ * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)
106
+ * to understand/wait for storage ID availability.
107
+ * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.
108
+ *
109
+ * Warning: the returned blob URL may expire and does not support permalinks.
110
+ * This API is intended for temporary integration scenarios only.
111
+ * @legacy
112
+ * @alpha
113
+ */
114
+ export declare function lookupTemporaryBlobStorageId(containerRuntime: IContainerRuntime, handle: IFluidHandle): string | undefined;
96
115
  //# sourceMappingURL=handles.d.ts.map
@@ -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,oBAA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AAK,IAAI,YAAY,CAmBnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAI7E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAazF;AAED;;;GAGG;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;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC3C,gBAAgB,EAAE,iBAAiB,EACnC,MAAM,EAAE,YAAY,GAClB,MAAM,GAAG,SAAS,CA2BpB"}
package/lib/handles.js CHANGED
@@ -136,4 +136,41 @@ export class FluidHandleBase {
136
136
  return toFluidHandleErased(this);
137
137
  }
138
138
  }
139
+ /**
140
+ * Lookup the blob storage ID for a blob handle.
141
+ * @param containerRuntime - The container runtime instance
142
+ * @param handle - The blob handle to lookup the storage ID for
143
+ * @returns The storage ID if found and the blob is not pending, undefined otherwise
144
+ * @remarks
145
+ * This is a legacy+alpha helper function that provides access to blob storage IDs.
146
+ * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.
147
+ * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)
148
+ * to understand/wait for storage ID availability.
149
+ * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.
150
+ *
151
+ * Warning: the returned blob URL may expire and does not support permalinks.
152
+ * This API is intended for temporary integration scenarios only.
153
+ * @legacy
154
+ * @alpha
155
+ */
156
+ export function lookupTemporaryBlobStorageId(containerRuntime, handle) {
157
+ // Verify that the handle points to a blob by checking its path format
158
+ const absolutePath = toFluidHandleInternal(handle).absolutePath;
159
+ // Blob handles have paths in the format "/_blobs/{localId}"
160
+ if (!absolutePath?.startsWith("/_blobs/")) {
161
+ throw new Error("Handle does not point to a blob - expected path to start with '/_blobs/'");
162
+ }
163
+ // Extract the local ID from the path
164
+ const pathParts = absolutePath.split("/");
165
+ if (pathParts.length !== 3 ||
166
+ pathParts[1] !== "_blobs" ||
167
+ pathParts[2] === undefined ||
168
+ pathParts[2] === "") {
169
+ throw new Error("Invalid blob handle path format");
170
+ }
171
+ const localId = pathParts[2];
172
+ // Cast the runtime to the internal interface and call the lookup method
173
+ const internalRuntime = containerRuntime;
174
+ return internalRuntime.lookupTemporaryBlobStorageId(localId);
175
+ }
139
176
  //# sourceMappingURL=handles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA+BlF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA8B,EAAE;AAChF,uFAAuF;AACtF,KAAuC,EAAE,IAAI,KAAK,kBAAkB,CAAC;AAEvE;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAClD,mBAAyC,EACmB,EAAE,CAC9D,gBAAgB,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,cAAc,KAAK,IAAI,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,CAAC,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C;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAe,EAAE,CAAe;IACnE,MAAM,SAAS,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,SAAS,CAAC,YAAY,KAAK,SAAS,CAAC,YAAY,CAAC;AAC1D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAI,MAAuB;IAC/D,IAAI,CAAC,CAAC,iBAAiB,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC;QACzF,IAAI,4BAA4B,IAAI,YAAY,IAAI,MAAM,EAAE,CAAC;YAC5D,0EAA0E;YAC1E,OAAO,MAAM,CAAC,YAAY,CAA4B,CAAC;QACxD,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC;IAED,kGAAkG;IAClG,6FAA6F;IAC7F,+FAA+F;IAC/F,OAAO,MAAM,CAAC,iBAAiB,CAAuC,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA+B;IAE/B,kFAAkF;IAClF,OAAO,MAA0C,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAgB,eAAe;IAMpC;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,CAAC,iBAAiB,CAAC;QAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandleErased } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n} from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * JSON serialized form of an IFluidHandle\n * @internal\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n\n\t/**\n\t * The handle may have a pending payload, as determined by and resolvable by the subsystem that\n\t * the handle relates to. For instance, the BlobManager uses this to distinguish blob handles\n\t * which may not yet have an attached blob yet.\n\t *\n\t * @remarks\n\t * Will only exist if the handle was created with a pending payload, will be omitted entirely from\n\t * the serialized format if the handle was created with an already-shared payload.\n\t */\n\treadonly payloadPending?: true;\n}\n\n/**\n * Narrow a value to {@link ISerializedHandle} by checking its type property.\n * @internal\n */\nexport const isSerializedHandle = (value: unknown): value is ISerializedHandle =>\n\t// Type assertion is safe as we're only checking for the existence of the type property\n\t(value as { type?: string } | undefined)?.type === \"__fluid_handle__\";\n\n/**\n * Checks if a Fluid handle's internal payload is pending.\n * @internal\n */\nexport const isFluidHandleInternalPayloadPending = (\n\tfluidHandleInternal: IFluidHandleInternal,\n): fluidHandleInternal is IFluidHandleInternalPayloadPending =>\n\t\"payloadPending\" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;\n\n/**\n * Check if the handle is an IFluidHandlePayloadPending.\n * @privateRemarks\n * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged\n * to IFluidHandle, this type guard will no longer be necessary.\n * @legacy @beta\n */\nexport const isFluidHandlePayloadPending = <T>(\n\thandle: IFluidHandle<T>,\n): handle is IFluidHandlePayloadPending<T> =>\n\t\"payloadState\" in handle &&\n\t(handle.payloadState === \"shared\" || handle.payloadState === \"pending\");\n\n/**\n * Check if the handle is an ILocalFluidHandle.\n * @legacy @beta\n */\nexport const isLocalFluidHandle = <T>(\n\thandle: IFluidHandle<T>,\n): handle is ILocalFluidHandle<T> =>\n\tisFluidHandlePayloadPending(handle) && \"payloadShareError\" in handle;\n/**\n * Encodes the given IFluidHandle into a JSON-serializable form,\n * @param handle - The IFluidHandle to serialize.\n * @returns The serialized handle.\n *\n * @internal\n */\nexport function encodeHandleForSerialization(handle: IFluidHandleInternal): ISerializedHandle {\n\treturn isFluidHandleInternalPayloadPending(handle)\n\t\t? {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t\tpayloadPending: true,\n\t\t\t}\n\t\t: {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t};\n}\n\n/**\n * Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).\n *\n * Some code which uses this library might dynamically load multiple versions of it,\n * as well as old or duplicated versions of packages which produce or implement handles.\n * To correctly interoperate with this old packages and object produced by them, the old in-memory format for handles, without the symbol, are explicitly supported.\n *\n * This setting mostly exists as a way to easily find any code that only exists to provide this compatibility and clarify how to remove that compatibility.\n * At some point this might be removed or turned into an actual configuration option, but for now its really just documentation.\n */\nconst enableBackwardsCompatibility = true;\n\n/**\n * Check if a value is an {@link @fluidframework/core-interfaces#IFluidHandle}.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @public\n */\nexport function isFluidHandle(value: unknown): value is IFluidHandle {\n\t// `in` gives a type error on non-objects and null, so filter them out\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tif (fluidHandleSymbol in value) {\n\t\treturn true;\n\t}\n\t// If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.\n\tif (enableBackwardsCompatibility && IFluidHandle in value) {\n\t\t// Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]\n\t\t// Type assertion is needed for backward compatibility with old FluidHandle format\n\t\tconst inner = value[IFluidHandle] as IFluidHandle;\n\t\tif (typeof inner !== \"object\" || inner === null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn IFluidHandle in inner;\n\t}\n\treturn false;\n}\n\n/**\n * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.\n * @remarks\n * Returns true iff both handles have the same internal `absolutePath`.\n * @public\n */\nexport function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean {\n\tconst aInternal = toFluidHandleInternal(a);\n\tconst bInternal = toFluidHandleInternal(b);\n\treturn aInternal.absolutePath === bInternal.absolutePath;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @legacy @beta\n */\nexport function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T> {\n\tif (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {\n\t\tif (enableBackwardsCompatibility && IFluidHandle in handle) {\n\t\t\t// Type assertion needed for backward compatibility with old handle format\n\t\t\treturn handle[IFluidHandle] as IFluidHandleInternal<T>;\n\t\t}\n\t\tthrow new TypeError(\"Invalid IFluidHandle\");\n\t}\n\n\t// This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone\n\t// implements their own IFluidHandle in terms of an existing handle, it won't break anything.\n\t// Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal\n\treturn handle[fluidHandleSymbol] as unknown as IFluidHandleInternal<T>;\n}\n\n/**\n * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.\n * @legacy @beta\n */\nexport function toFluidHandleErased<T>(\n\thandle: IFluidHandleInternal<T>,\n): IFluidHandleErased<T> {\n\t// Type assertion is safe as we're intentionally erasing internal type information\n\treturn handle as unknown as IFluidHandleErased<T>;\n}\n\n/**\n * Base class which can be uses to assist implementing IFluidHandleInternal.\n * @legacy @beta\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): void;\n\tpublic abstract readonly isAttached: boolean;\n\tpublic abstract get(): Promise<T>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandleInternal {\n\t\treturn this;\n\t}\n\n\tpublic get [fluidHandleSymbol](): IFluidHandleErased<T> {\n\t\treturn toFluidHandleErased(this);\n\t}\n}\n"]}
1
+ {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA+BlF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA8B,EAAE;AAChF,uFAAuF;AACtF,KAAuC,EAAE,IAAI,KAAK,kBAAkB,CAAC;AAEvE;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAClD,mBAAyC,EACmB,EAAE,CAC9D,gBAAgB,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,cAAc,KAAK,IAAI,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,MAAuB,EACmB,EAAE,CAC5C,cAAc,IAAI,MAAM;IACxB,CAAC,MAAM,CAAC,YAAY,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,MAAuB,EACU,EAAE,CACnC,2BAA2B,CAAC,MAAM,CAAC,IAAI,mBAAmB,IAAI,MAAM,CAAC;AACtE;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAA4B;IACxE,OAAO,mCAAmC,CAAC,MAAM,CAAC;QACjD,CAAC,CAAC;YACA,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,MAAM,CAAC,YAAY;YACxB,cA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,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAE7B,wEAAwE;IACxE,MAAM,eAAe,GAAG,gBAA6C,CAAC;IACtE,OAAO,eAAe,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainerRuntime,\n\tIContainerRuntimeInternal,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type { IFluidHandleErased } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n} from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * JSON serialized form of an IFluidHandle\n * @internal\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n\n\t/**\n\t * The handle may have a pending payload, as determined by and resolvable by the subsystem that\n\t * the handle relates to. For instance, the BlobManager uses this to distinguish blob handles\n\t * which may not yet have an attached blob yet.\n\t *\n\t * @remarks\n\t * Will only exist if the handle was created with a pending payload, will be omitted entirely from\n\t * the serialized format if the handle was created with an already-shared payload.\n\t */\n\treadonly payloadPending?: true;\n}\n\n/**\n * Narrow a value to {@link ISerializedHandle} by checking its type property.\n * @internal\n */\nexport const isSerializedHandle = (value: unknown): value is ISerializedHandle =>\n\t// Type assertion is safe as we're only checking for the existence of the type property\n\t(value as { type?: string } | undefined)?.type === \"__fluid_handle__\";\n\n/**\n * Checks if a Fluid handle's internal payload is pending.\n * @internal\n */\nexport const isFluidHandleInternalPayloadPending = (\n\tfluidHandleInternal: IFluidHandleInternal,\n): fluidHandleInternal is IFluidHandleInternalPayloadPending =>\n\t\"payloadPending\" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;\n\n/**\n * Check if the handle is an IFluidHandlePayloadPending.\n * @privateRemarks\n * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged\n * to IFluidHandle, this type guard will no longer be necessary.\n * @legacy @beta\n */\nexport const isFluidHandlePayloadPending = <T>(\n\thandle: IFluidHandle<T>,\n): handle is IFluidHandlePayloadPending<T> =>\n\t\"payloadState\" in handle &&\n\t(handle.payloadState === \"shared\" || handle.payloadState === \"pending\");\n\n/**\n * Check if the handle is an ILocalFluidHandle.\n * @legacy @beta\n */\nexport const isLocalFluidHandle = <T>(\n\thandle: IFluidHandle<T>,\n): handle is ILocalFluidHandle<T> =>\n\tisFluidHandlePayloadPending(handle) && \"payloadShareError\" in handle;\n/**\n * Encodes the given IFluidHandle into a JSON-serializable form,\n * @param handle - The IFluidHandle to serialize.\n * @returns The serialized handle.\n *\n * @internal\n */\nexport function encodeHandleForSerialization(handle: IFluidHandleInternal): ISerializedHandle {\n\treturn isFluidHandleInternalPayloadPending(handle)\n\t\t? {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t\tpayloadPending: true,\n\t\t\t}\n\t\t: {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t};\n}\n\n/**\n * Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).\n *\n * Some code which uses this library might dynamically load multiple versions of it,\n * as well as old or duplicated versions of packages which produce or implement handles.\n * To correctly interoperate with this old packages and object produced by them, the old in-memory format for handles, without the symbol, are explicitly supported.\n *\n * This setting mostly exists as a way to easily find any code that only exists to provide this compatibility and clarify how to remove that compatibility.\n * At some point this might be removed or turned into an actual configuration option, but for now its really just documentation.\n */\nconst enableBackwardsCompatibility = true;\n\n/**\n * Check if a value is an {@link @fluidframework/core-interfaces#IFluidHandle}.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @public\n */\nexport function isFluidHandle(value: unknown): value is IFluidHandle {\n\t// `in` gives a type error on non-objects and null, so filter them out\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tif (fluidHandleSymbol in value) {\n\t\treturn true;\n\t}\n\t// If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.\n\tif (enableBackwardsCompatibility && IFluidHandle in value) {\n\t\t// Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]\n\t\t// Type assertion is needed for backward compatibility with old FluidHandle format\n\t\tconst inner = value[IFluidHandle] as IFluidHandle;\n\t\tif (typeof inner !== \"object\" || inner === null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn IFluidHandle in inner;\n\t}\n\treturn false;\n}\n\n/**\n * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.\n * @remarks\n * Returns true iff both handles have the same internal `absolutePath`.\n * @public\n */\nexport function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean {\n\tconst aInternal = toFluidHandleInternal(a);\n\tconst bInternal = toFluidHandleInternal(b);\n\treturn aInternal.absolutePath === bInternal.absolutePath;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @legacy @beta\n */\nexport function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T> {\n\tif (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {\n\t\tif (enableBackwardsCompatibility && IFluidHandle in handle) {\n\t\t\t// Type assertion needed for backward compatibility with old handle format\n\t\t\treturn handle[IFluidHandle] as IFluidHandleInternal<T>;\n\t\t}\n\t\tthrow new TypeError(\"Invalid IFluidHandle\");\n\t}\n\n\t// This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone\n\t// implements their own IFluidHandle in terms of an existing handle, it won't break anything.\n\t// Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal\n\treturn handle[fluidHandleSymbol] as unknown as IFluidHandleInternal<T>;\n}\n\n/**\n * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.\n * @legacy @beta\n */\nexport function toFluidHandleErased<T>(\n\thandle: IFluidHandleInternal<T>,\n): IFluidHandleErased<T> {\n\t// Type assertion is safe as we're intentionally erasing internal type information\n\treturn handle as unknown as IFluidHandleErased<T>;\n}\n\n/**\n * Base class which can be uses to assist implementing IFluidHandleInternal.\n * @legacy @beta\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): void;\n\tpublic abstract readonly isAttached: boolean;\n\tpublic abstract get(): Promise<T>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandleInternal {\n\t\treturn this;\n\t}\n\n\tpublic get [fluidHandleSymbol](): IFluidHandleErased<T> {\n\t\treturn toFluidHandleErased(this);\n\t}\n}\n\n/**\n * Lookup the blob storage ID for a blob handle.\n * @param containerRuntime - The container runtime instance\n * @param handle - The blob handle to lookup the storage ID for\n * @returns The storage ID if found and the blob is not pending, undefined otherwise\n * @remarks\n * This is a legacy+alpha helper function that provides access to blob storage IDs.\n * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.\n * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)\n * to understand/wait for storage ID availability.\n * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.\n *\n * Warning: the returned blob URL may expire and does not support permalinks.\n * This API is intended for temporary integration scenarios only.\n * @legacy\n * @alpha\n */\nexport function lookupTemporaryBlobStorageId(\n\tcontainerRuntime: IContainerRuntime,\n\thandle: IFluidHandle,\n): string | undefined {\n\t// Verify that the handle points to a blob by checking its path format\n\tconst absolutePath: string | undefined = toFluidHandleInternal(handle).absolutePath;\n\n\t// Blob handles have paths in the format \"/_blobs/{localId}\"\n\tif (!absolutePath?.startsWith(\"/_blobs/\")) {\n\t\tthrow new Error(\n\t\t\t\"Handle does not point to a blob - expected path to start with '/_blobs/'\",\n\t\t);\n\t}\n\n\t// Extract the local ID from the path\n\tconst pathParts = absolutePath.split(\"/\");\n\tif (\n\t\tpathParts.length !== 3 ||\n\t\tpathParts[1] !== \"_blobs\" ||\n\t\tpathParts[2] === undefined ||\n\t\tpathParts[2] === \"\"\n\t) {\n\t\tthrow new Error(\"Invalid blob handle path format\");\n\t}\n\n\tconst localId = pathParts[2];\n\n\t// Cast the runtime to the internal interface and call the lookup method\n\tconst internalRuntime = containerRuntime as IContainerRuntimeInternal;\n\treturn internalRuntime.lookupTemporaryBlobStorageId(localId);\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export { generateHandleContextPath } from "./dataStoreHandleContextUtils.js";
6
6
  export { create404Response, createResponseError, exceptionToResponse, responseToException, } from "./dataStoreHelpers.js";
7
- export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
7
+ export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, lookupTemporaryBlobStorageId, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
8
8
  export type { ISerializedHandle } from "./handles.js";
9
9
  export { ObjectStoragePartition } from "./objectstoragepartition.js";
10
10
  export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath, } from "./objectstorageutils.js";
@@ -17,6 +17,6 @@ export { RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.j
17
17
  export type { ReadAndParseBlob } from "./utils.js";
18
18
  export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
19
19
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
20
- export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, } from "./compatibilityBase.js";
20
+ export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, semanticVersionToMinimumVersionForCollab, } from "./compatibilityBase.js";
21
21
  export type { ConfigMap, ConfigValidationMap, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,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jC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,0BAA0B,EAC1B,wCAAwC,GACxC,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACX,SAAS,EACT,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,GACf,MAAM,wBAAwB,CAAC"}
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export { generateHandleContextPath } from "./dataStoreHandleContextUtils.js";
6
6
  export { create404Response, createResponseError, exceptionToResponse, responseToException, } from "./dataStoreHelpers.js";
7
- export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
7
+ export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, lookupTemporaryBlobStorageId, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
8
8
  export { ObjectStoragePartition } from "./objectstoragepartition.js";
9
9
  export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath, } from "./objectstorageutils.js";
10
10
  export { RemoteFluidObjectHandle } from "./remoteFluidObjectHandle.js";
@@ -15,5 +15,5 @@ export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes.js";
15
15
  export { RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.js";
16
16
  export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
17
17
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
18
- export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, } from "./compatibilityBase.js";
18
+ export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, semanticVersionToMinimumVersionForCollab, } from "./compatibilityBase.js";
19
19
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,0BAA0B,GAC1B,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,4BAA4B,EAC5B,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,0BAA0B,EAC1B,wCAAwC,GACxC,MAAM,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\tlookupTemporaryBlobStorageId,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tsemanticVersionToMinimumVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/runtime-utils";
8
- export declare const pkgVersion = "2.61.0-355054";
8
+ export declare const pkgVersion = "2.61.0-355603";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/runtime-utils";
8
- export const pkgVersion = "2.61.0-355054";
8
+ export const pkgVersion = "2.61.0-355603";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.61.0-355054\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/runtime-utils\";\nexport const pkgVersion = \"2.61.0-355603\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/runtime-utils",
3
- "version": "2.61.0-355054",
3
+ "version": "2.61.0-355603",
4
4
  "description": "Collection of utility functions for Fluid Runtime",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,25 +69,25 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "2.61.0-355054",
73
- "@fluidframework/container-definitions": "2.61.0-355054",
74
- "@fluidframework/container-runtime-definitions": "2.61.0-355054",
75
- "@fluidframework/core-interfaces": "2.61.0-355054",
76
- "@fluidframework/core-utils": "2.61.0-355054",
77
- "@fluidframework/datastore-definitions": "2.61.0-355054",
78
- "@fluidframework/driver-definitions": "2.61.0-355054",
79
- "@fluidframework/driver-utils": "2.61.0-355054",
80
- "@fluidframework/runtime-definitions": "2.61.0-355054",
81
- "@fluidframework/telemetry-utils": "2.61.0-355054",
72
+ "@fluid-internal/client-utils": "2.61.0-355603",
73
+ "@fluidframework/container-definitions": "2.61.0-355603",
74
+ "@fluidframework/container-runtime-definitions": "2.61.0-355603",
75
+ "@fluidframework/core-interfaces": "2.61.0-355603",
76
+ "@fluidframework/core-utils": "2.61.0-355603",
77
+ "@fluidframework/datastore-definitions": "2.61.0-355603",
78
+ "@fluidframework/driver-definitions": "2.61.0-355603",
79
+ "@fluidframework/driver-utils": "2.61.0-355603",
80
+ "@fluidframework/runtime-definitions": "2.61.0-355603",
81
+ "@fluidframework/telemetry-utils": "2.61.0-355603",
82
82
  "semver-ts": "^1.0.3"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@arethetypeswrong/cli": "^0.17.1",
86
86
  "@biomejs/biome": "~1.9.3",
87
- "@fluid-internal/mocha-test-setup": "2.61.0-355054",
88
- "@fluid-tools/build-cli": "^0.58.2",
87
+ "@fluid-internal/mocha-test-setup": "2.61.0-355603",
88
+ "@fluid-tools/build-cli": "^0.58.1",
89
89
  "@fluidframework/build-common": "^2.0.3",
90
- "@fluidframework/build-tools": "^0.58.2",
90
+ "@fluidframework/build-tools": "^0.58.1",
91
91
  "@fluidframework/eslint-config-fluid": "^6.0.0",
92
92
  "@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.60.0",
93
93
  "@microsoft/api-extractor": "7.52.11",
@@ -129,6 +129,27 @@ export function isValidMinVersionForCollab(
129
129
  );
130
130
  }
131
131
 
132
+ /**
133
+ * Converts a SemanticVersion to a MinimumVersionForCollab.
134
+ * @param semanticVersion - The version to convert.
135
+ * @returns The version as a MinimumVersionForCollab.
136
+ * @throws UsageError if the version is not a valid MinimumVersionForCollab.
137
+ *
138
+ * @internal
139
+ */
140
+ export function semanticVersionToMinimumVersionForCollab(
141
+ semanticVersion: SemanticVersion,
142
+ ): MinimumVersionForCollab {
143
+ const minVersionForCollab = semanticVersion as MinimumVersionForCollab;
144
+ if (!isValidMinVersionForCollab(minVersionForCollab)) {
145
+ throw new UsageError(
146
+ `Version ${minVersionForCollab} is not a valid MinimumVersionForCollab.`,
147
+ );
148
+ }
149
+
150
+ return minVersionForCollab;
151
+ }
152
+
132
153
  /**
133
154
  * Generic function to validate runtime options against the minVersionForCollab.
134
155
  *
package/src/handles.ts CHANGED
@@ -3,6 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import type {
7
+ IContainerRuntime,
8
+ IContainerRuntimeInternal,
9
+ } from "@fluidframework/container-runtime-definitions/internal";
6
10
  import type { IFluidHandleErased } from "@fluidframework/core-interfaces";
7
11
  import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
8
12
  import type {
@@ -195,3 +199,52 @@ export abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
195
199
  return toFluidHandleErased(this);
196
200
  }
197
201
  }
202
+
203
+ /**
204
+ * Lookup the blob storage ID for a blob handle.
205
+ * @param containerRuntime - The container runtime instance
206
+ * @param handle - The blob handle to lookup the storage ID for
207
+ * @returns The storage ID if found and the blob is not pending, undefined otherwise
208
+ * @remarks
209
+ * This is a legacy+alpha helper function that provides access to blob storage IDs.
210
+ * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.
211
+ * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)
212
+ * to understand/wait for storage ID availability.
213
+ * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.
214
+ *
215
+ * Warning: the returned blob URL may expire and does not support permalinks.
216
+ * This API is intended for temporary integration scenarios only.
217
+ * @legacy
218
+ * @alpha
219
+ */
220
+ export function lookupTemporaryBlobStorageId(
221
+ containerRuntime: IContainerRuntime,
222
+ handle: IFluidHandle,
223
+ ): string | undefined {
224
+ // Verify that the handle points to a blob by checking its path format
225
+ const absolutePath: string | undefined = toFluidHandleInternal(handle).absolutePath;
226
+
227
+ // Blob handles have paths in the format "/_blobs/{localId}"
228
+ if (!absolutePath?.startsWith("/_blobs/")) {
229
+ throw new Error(
230
+ "Handle does not point to a blob - expected path to start with '/_blobs/'",
231
+ );
232
+ }
233
+
234
+ // Extract the local ID from the path
235
+ const pathParts = absolutePath.split("/");
236
+ if (
237
+ pathParts.length !== 3 ||
238
+ pathParts[1] !== "_blobs" ||
239
+ pathParts[2] === undefined ||
240
+ pathParts[2] === ""
241
+ ) {
242
+ throw new Error("Invalid blob handle path format");
243
+ }
244
+
245
+ const localId = pathParts[2];
246
+
247
+ // Cast the runtime to the internal interface and call the lookup method
248
+ const internalRuntime = containerRuntime as IContainerRuntimeInternal;
249
+ return internalRuntime.lookupTemporaryBlobStorageId(localId);
250
+ }
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export {
19
19
  isFluidHandlePayloadPending,
20
20
  isLocalFluidHandle,
21
21
  isSerializedHandle,
22
+ lookupTemporaryBlobStorageId,
22
23
  toFluidHandleErased,
23
24
  toFluidHandleInternal,
24
25
  } from "./handles.js";
@@ -65,6 +66,7 @@ export {
65
66
  getValidationForRuntimeOptions,
66
67
  getConfigsForMinVersionForCollab,
67
68
  isValidMinVersionForCollab,
69
+ semanticVersionToMinimumVersionForCollab,
68
70
  } from "./compatibilityBase.js";
69
71
  export type {
70
72
  ConfigMap,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/runtime-utils";
9
- export const pkgVersion = "2.61.0-355054";
9
+ export const pkgVersion = "2.61.0-355603";