@fluidframework/runtime-utils 2.117.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +36 -2
  2. package/README.md +53 -50
  3. package/{api-extractor.json → api-extractor/api-extractor-model.json} +1 -1
  4. package/dist/compatibilityBase.d.ts +27 -54
  5. package/dist/compatibilityBase.d.ts.map +1 -1
  6. package/dist/compatibilityBase.js +49 -74
  7. package/dist/compatibilityBase.js.map +1 -1
  8. package/dist/dataStoreHandleContextUtils.js +1 -2
  9. package/dist/dataStoreHandleContextUtils.js.map +1 -1
  10. package/dist/dataStoreHelpers.d.ts.map +1 -1
  11. package/dist/dataStoreHelpers.js +6 -6
  12. package/dist/dataStoreHelpers.js.map +1 -1
  13. package/dist/deltaManager.js +2 -3
  14. package/dist/deltaManager.js.map +1 -1
  15. package/dist/handles.d.ts +1 -1
  16. package/dist/handles.d.ts.map +1 -1
  17. package/dist/handles.js +7 -7
  18. package/dist/handles.js.map +1 -1
  19. package/dist/objectstoragepartition.js +2 -0
  20. package/dist/objectstoragepartition.js.map +1 -1
  21. package/dist/objectstorageutils.js +2 -3
  22. package/dist/objectstorageutils.js.map +1 -1
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/packageVersion.d.ts.map +1 -1
  25. package/dist/packageVersion.js +1 -1
  26. package/dist/packageVersion.js.map +1 -1
  27. package/dist/remoteFluidObjectHandle.js +5 -1
  28. package/dist/remoteFluidObjectHandle.js.map +1 -1
  29. package/dist/requestParser.js +4 -0
  30. package/dist/requestParser.js.map +1 -1
  31. package/dist/serviceClientBase.js +14 -6
  32. package/dist/serviceClientBase.js.map +1 -1
  33. package/dist/serviceClientUtils.js +6 -4
  34. package/dist/serviceClientUtils.js.map +1 -1
  35. package/dist/snapshotUtils.js +1 -2
  36. package/dist/snapshotUtils.js.map +1 -1
  37. package/dist/summaryUtils.d.ts.map +1 -1
  38. package/dist/summaryUtils.js +18 -22
  39. package/dist/summaryUtils.js.map +1 -1
  40. package/dist/unpackUsedRoutes.js +1 -2
  41. package/dist/unpackUsedRoutes.js.map +1 -1
  42. package/dist/utils.js +3 -3
  43. package/dist/utils.js.map +1 -1
  44. package/lib/compatibilityBase.d.ts +27 -54
  45. package/lib/compatibilityBase.d.ts.map +1 -1
  46. package/lib/compatibilityBase.js +40 -65
  47. package/lib/compatibilityBase.js.map +1 -1
  48. package/lib/dataStoreHelpers.d.ts.map +1 -1
  49. package/lib/handles.d.ts +1 -1
  50. package/lib/handles.d.ts.map +1 -1
  51. package/lib/legacy.d.ts +1 -1
  52. package/lib/legacyAlpha.d.ts +1 -1
  53. package/lib/objectstoragepartition.js +2 -0
  54. package/lib/objectstoragepartition.js.map +1 -1
  55. package/lib/packageVersion.d.ts +1 -1
  56. package/lib/packageVersion.d.ts.map +1 -1
  57. package/lib/packageVersion.js +1 -1
  58. package/lib/packageVersion.js.map +1 -1
  59. package/lib/public.d.ts +1 -1
  60. package/lib/remoteFluidObjectHandle.js +5 -1
  61. package/lib/remoteFluidObjectHandle.js.map +1 -1
  62. package/lib/requestParser.js +4 -0
  63. package/lib/requestParser.js.map +1 -1
  64. package/lib/serviceClientBase.js +12 -4
  65. package/lib/serviceClientBase.js.map +1 -1
  66. package/lib/serviceClientUtils.js +2 -0
  67. package/lib/serviceClientUtils.js.map +1 -1
  68. package/lib/summaryUtils.d.ts.map +1 -1
  69. package/lib/summaryUtils.js +6 -10
  70. package/lib/summaryUtils.js.map +1 -1
  71. package/package.json +37 -54
  72. package/src/compatibilityBase.ts +62 -82
  73. package/src/packageVersion.ts +1 -1
  74. package/src/summaryUtils.ts +1 -3
  75. package/tsconfig.json +1 -1
  76. package/internal.d.ts +0 -11
  77. package/legacy/alpha.d.ts +0 -11
  78. package/legacy.d.ts +0 -11
  79. /package/api-extractor/{api-extractor.current.json → api-extractor-report.current.json} +0 -0
  80. /package/api-extractor/{api-extractor.legacy.json → api-extractor-report.legacy.json}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AAE,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, fail } from \"@fluidframework/core-utils/internal\";\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { compare, gt, gte, lte, valid, parse } from \"semver-ts\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Our policy is to support major versions N and N-1, where N is most\n * recent public major release of the Fluid Framework Client.\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 OldestSupportedClientVersion;\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 *\n * @privateRemarks\n * Exported for use in tests.\n *\n * @internal\n */\nexport const lowestMinVersionForCollab =\n\t\"1.0.0\" as const satisfies OldestSupportedClientVersion;\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#OldestSupportedClientVersion}, 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 * Converts a record into a configuration map that associates each key with an instance of its value type that is based on a {@link MinimumMinorSemanticVersion}.\n * @remarks\n * For a given input {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion},\n * the corresponding configuration values can be found by using the entry in the inner objects with the highest {@link MinimumMinorSemanticVersion}\n * that does not exceed the given {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}.\n *\n * Use {@link getConfigsForMinVersionForCollab} to retrieve the configuration for a given a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}.\n *\n * See the remarks on {@link MinimumMinorSemanticVersion} for some limitation on how ConfigMaps must handle versioning.\n * @internal\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\treadonly [K in keyof T]-?: ConfigMapEntry<T[K]>;\n};\n\n/**\n * Entry in {@link ConfigMap} associating {@link MinimumMinorSemanticVersion} with configuration values that became supported in that version.\n * @remarks\n * All entries must at least provide an entry for {@link lowestMinVersionForCollab}.\n * @internal\n */\nexport interface ConfigMapEntry<T> {\n\t// This index signature (See https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures) requires all properties on this type to to have keys that are a MinimumMinorSemanticVersion and values of type T.\n\t// Note that the \"version\" part of this syntax is really just documentation and has no impact on the type checking (other than some identifier being required to the syntax here to differentiate it from the computed property syntax).\n\t[version: MinimumMinorSemanticVersion]: T;\n\t// Require an entry for the defaultMinVersionForCollab:\n\t// this ensures that all versions of lowestMinVersionForCollab or later have a specified value in the ConfigMap.\n\t// Note that this is NOT an index signature.\n\t// This is a regular property with a computed name (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names).\n\t[lowestMinVersionForCollab]: T;\n}\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap\n *\n * @internal\n */\nexport type ConfigValidationMap<T extends Record<string, unknown>> = {\n\treadonly [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 * @privateRemarks\n * The extra `Record` type for the `configMap` is just used to allow the body of this function to be more type-safe due to limitations of generic types in TypeScript.\n * It should have no impact on the user of this function.\n * @internal\n */\nexport function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tconfigMap: ConfigMap<T> & Record<keyof T, unknown>,\n): T {\n\tvalidateMinimumVersionForCollab(minVersionForCollab);\n\tconst defaultConfigs: Partial<T> = {};\n\t// Iterate over configMap to get default values for each option.\n\tfor (const [key, config] of Object.entries(configMap)) {\n\t\tdefaultConfigs[key] = getConfigForMinVersionForCollab(\n\t\t\tminVersionForCollab,\n\t\t\tconfig as ConfigMapEntry<unknown>,\n\t\t);\n\t}\n\t// We have populated every key, so casting away the Partial is now safe:\n\treturn defaultConfigs as T;\n}\n\n/**\n * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}.\n *\n * @internal\n */\nexport function getConfigForMinVersionForCollab<T>(\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tconfig: ConfigMapEntry<T>,\n): T {\n\treturn getConfigForMinVersionForCollabIterable(\n\t\tminVersionForCollab,\n\t\tObject.entries(config) as [MinimumMinorSemanticVersion, T][],\n\t);\n}\n\n/**\n * Returns a default configuration given minVersionForCollab and the contents of a {@link ConfigMapEntry} in an Iterable.\n * @remarks\n * See also {@link getConfigForMinVersionForCollab} for consuming a ConfigMapEntry directly.\n *\n * `ConfigMapEntry` is a nice type safe format for developers to directly author this data,\n * but it is messy and less type safe to work with it in this format programmatically.\n * Thus this function exists to help meet the needs of programmatic use cases,\n * like cases which transform a ConfigMapEntry before selecting a value from it.\n * @internal\n */\nexport function getConfigForMinVersionForCollabIterable<T>(\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tentries: Iterable<readonly [MinimumMinorSemanticVersion | OldestSupportedClientVersion, T]>, // [[typeof lowestMinVersionForCollab, T], ...[OldestSupportedClientVersion, T][]],\n): T {\n\t// Validate and strongly type the versions from the configMap.\n\tconst versions: [OldestSupportedClientVersion, T][] = Array.from(\n\t\tentries,\n\t\t([version, value]) => {\n\t\t\tvalidateMinimumVersionForCollab(version);\n\t\t\treturn [version, value];\n\t\t},\n\t);\n\treturn (selectVersionRoundedDown(minVersionForCollab, versions) ??\n\t\tfail(0xcb8 /* No config map entry for version */))[1];\n}\n\n/**\n * Finds the entry for the highest version that is less than or equal to the provided minVersionForCollab.\n * @remarks\n * If none is found, returns undefined.\n *\n * When used with Fluid client versions, use the stricter {@link getConfigForMinVersionForCollabIterable} instead.\n *\n * @internal\n */\nexport function selectVersionRoundedDown<T>(\n\tminVersionForCollab: string,\n\tentries: Iterable<readonly [string, T]>,\n\tcompareVersions: (a: string, b: string) => number = compare,\n): readonly [string, T] | undefined {\n\t// Sort a copy of the iterable in descending order\n\tconst versions: (readonly [string, T])[] = [...entries];\n\tversions.sort((a, b) => compareVersions(b[0], a[0]));\n\n\t// For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.\n\t// If so, we set it as the default value for the option.\n\tfor (const pair of versions) {\n\t\tconst [version, _] = pair;\n\t\tif (compareVersions(minVersionForCollab, version) >= 0) {\n\t\t\treturn pair;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Returns detailed information about the validity of a minVersionForCollab.\n * @param minVersionForCollab - The minVersionForCollab to validate.\n * @returns An object containing the validity information.\n *\n * @internal\n */\nexport function checkValidMinVersionForCollabVerbose(minVersionForCollab: SemanticVersion): {\n\tisValidSemver: boolean;\n\tisGteLowestMinVersion: boolean;\n\tisLtePkgVersion: boolean;\n} {\n\tconst isValidSemver = valid(minVersionForCollab) !== null;\n\treturn {\n\t\tisValidSemver,\n\n\t\t// We have to check if the value is a valid semver before calling gte/lte, otherwise they will throw when parsing the version.\n\t\tisGteLowestMinVersion:\n\t\t\tisValidSemver && gte(minVersionForCollab, lowestMinVersionForCollab),\n\t\tisLtePkgVersion: isValidSemver && lte(minVersionForCollab, cleanedPackageVersion),\n\t};\n}\n\n/**\n * Checks if the minVersionForCollab is valid.\n * A valid minVersionForCollab is a OldestSupportedClientVersion that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.\n *\n * @internal\n */\nexport function isValidMinVersionForCollab(\n\tminVersionForCollab: SemanticVersion,\n): minVersionForCollab is OldestSupportedClientVersion {\n\tconst { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } =\n\t\tcheckValidMinVersionForCollabVerbose(minVersionForCollab);\n\treturn isValidSemver && isGteLowestMinVersion && isLtePkgVersion;\n}\n\nconst parsedPackageVersion = parse(pkgVersion) ?? fail(0xcb9 /* Invalid package version */);\n\n/**\n * `pkgVersion` version without pre-release.\n * @remarks\n * This is the version that the code in the current version of the codebase will have when officially released.\n * Generally, compatibility of prerelease builds is not guaranteed (especially for how they interact with future releases).\n * So while technically a prerelease build is less (older) than the released version which follows it and thus supports less features,\n * it makes sense for them to claim to support the same features as the following release so they can be used to test how the release would actually behave.\n *\n * To accomplish this, the version the next release will have is provided here as `cleanedPackageVersion` while `pkgVersion` may be a prerelease in some cases,\n * like when running tests on CI, or in an actual prerelease published package.\n * This is then used in {@link validateMinimumVersionForCollab} to allow the version shown on main to be usable as a `minVersionForCollab`, even in CI and prerelease packages.\n *\n * This is of particular note in two cases:\n * 1. When landing a new feature, and setting the minVersionForCollab which enables it to be the version that the next release will have.\n * Having that version be valid on main, pass tests locally, then fail on CI and when using published prerelease packages would be confusing, and probably undesired.\n * 2. Setting the minVersionForCollab to the current version for scenarios that do no involve collab with other package versions seems like it should be valid.\n * This is useful for testing new features, and also non collaborative scenarios where the latest features are desired.\n *\n * To accommodate some uses of the second case, it might be useful to package export this in the future.\n *\n * @privateRemarks\n * Since this is used by validateMinimumVersionForCollab, the type case to OldestSupportedClientVersion can not use it directly.\n * Thus this is just `as` cast here, and a test confirms it is valid according to validateMinimumVersionForCollab.\n *\n * @internal\n */\nexport const cleanedPackageVersion =\n\t`${parsedPackageVersion.major}.${parsedPackageVersion.minor}.${parsedPackageVersion.patch}` as OldestSupportedClientVersion;\n\n/**\n * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, throwing a UsageError if it is not valid.\n * @remarks\n * This is more strict than the type constraints imposed by `OldestSupportedClientVersion`.\n * Currently there is no type which is used to separate semantically valid and typescript allowed OldestSupportedClientVersion values:\n * thus users that care about strict validation may want to call this on un-validated `OldestSupportedClientVersion` values.\n * @param semanticVersion - The version to check.\n * @throws UsageError if the version is not a valid OldestSupportedClientVersion.\n *\n * @internal\n */\nexport function validateMinimumVersionForCollab(\n\tsemanticVersion: string,\n): asserts semanticVersion is OldestSupportedClientVersion {\n\tconst minVersionForCollab = semanticVersion as OldestSupportedClientVersion;\n\tconst { isValidSemver, isGteLowestMinVersion, isLtePkgVersion } =\n\t\tcheckValidMinVersionForCollabVerbose(minVersionForCollab);\n\tif (!(isValidSemver && isGteLowestMinVersion && isLtePkgVersion)) {\n\t\tthrow new UsageError(\n\t\t\t`Version ${minVersionForCollab} is not a valid OldestSupportedClientVersion. ` +\n\t\t\t\t`It must be in a valid semver format, at least ${lowestMinVersionForCollab}, ` +\n\t\t\t\t`and less than or equal to the current package version ${cleanedPackageVersion}. ` +\n\t\t\t\t`Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion} }`,\n\t\t);\n\t}\n}\n\n/**\n * Validates the given `overrides`.\n *\n * No-op when minVersionForCollab is set to defaultMinVersionForCollab.\n *\n * Otherwise this checks that for keys which are in both the `validationMap` and the `overrides`,\n * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.\n * @privateRemarks\n * This design seems odd, and might want to be revisited.\n * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),\n * and the handling of defaultMinVersionForCollab and undefined versions seems questionable.\n * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.\n * @internal\n */\nexport function validateConfigMapOverrides<T extends Record<string, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\toverrides: 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\t// TODO: This also skips validation for users which explicitly request defaultMinVersionForCollab which seems like a bug.\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(overrides) as [\n\t\tkeyof T & string,\n\t\tT[keyof T & string],\n\t][]) {\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;;;AAsGH,4EAeC;AAOD,0EAQC;AAaD,0FAcC;AAWD,4DAkBC;AASD,oFAuBC;AAQD,gEAKC;AAgCD,0EAqBC;AAcD,gEAyBC;AAQD,4EAuCC;AAlXD,kEAAmE;AAEnE,uEAAsE;AACtE,0EAA6E;AAC7E,yCAAyD;AAEzD,2DAAiD;AAEjD;;;;GAIG;AACU,QAAA,yBAAyB,GACrC,OAAuD,CAAC;AAEzD;;;;;;;;;GASG;AACU,QAAA,0BAA0B,GAAG,iCAAyB,CAAC;AAkEpE;;;;;;;GAOG;AACH,SAAgB,gCAAgC,CAC/C,mBAAiD,EACjD,SAAkD;IAElD,+BAA+B,CAAC,mBAAmB,CAAC,CAAC;IACrD,MAAM,cAAc,GAAe,EAAE,CAAC;IACtC,gEAAgE;IAChE,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACvD,cAAc,CAAC,GAAG,CAAC,GAAG,+BAA+B,CACpD,mBAAmB,EACnB,MAAiC,CACjC,CAAC;IACH,CAAC;IACD,wEAAwE;IACxE,OAAO,cAAmB,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,SAAgB,+BAA+B,CAC9C,mBAAiD,EACj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AAE,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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, fail } from \"@fluidframework/core-utils/internal\";\nimport type { OldestSupportedClientVersion } from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\nimport { featureVersion } from \"@fluidframework/driver-definitions/internal\";\nimport { compare, gt, gte, lte, parse } from \"semver-ts\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Oldest deployed Fluid Framework client version supported for cross-client compatibility.\n *\n * @internal\n */\nexport const lowestMinVersionForCollab =\n\t\"2.0.0\" as const satisfies OldestSupportedClientVersion;\n\n/**\n * Default oldest supported client for APIs that still permit the setting to be omitted.\n *\n * @remarks\n * This aliases {@link lowestMinVersionForCollab} in Client 3.0. Remove this fallback when\n * customer-facing APIs require `oldestSupportedClient` in Client 3.10.\n * See {@link https://github.com/microsoft/FluidFramework/issues/27180}.\n *\n * @internal\n */\nexport const defaultMinVersionForCollab = lowestMinVersionForCollab;\n\n/**\n * String in a valid semver format specifying the bottom of a minor version.\n *\n * @remarks\n * Configuration maps use major/minor checkpoints. Exact patch and prerelease versions are values\n * supplied to the selection logic, not configuration-map keys.\n *\n * @internal\n */\nexport type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0`;\n\n/**\n * String in a valid semver format of a specific version at least specifying minor.\n * Unlike {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, this type does\n * not encode the active compatibility floor or major-specific patch restrictions.\n *\n * @internal\n */\nexport type SemanticVersion =\n\t| `${bigint}.${bigint}.${bigint}`\n\t| `${bigint}.${bigint}.${bigint}-${string}`;\n\n/**\n * Converts a record into a configuration map that associates each key with an instance of its value type that is based on a {@link MinimumMinorSemanticVersion}.\n * @remarks\n * For a given input {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion},\n * the corresponding configuration values can be found by using the entry in the inner objects with the highest {@link MinimumMinorSemanticVersion}\n * that does not exceed the given {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}.\n *\n * Use {@link getConfigsForMinVersionForCollab} to retrieve the configuration for a given a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}.\n *\n * See the remarks on {@link MinimumMinorSemanticVersion} for some limitation on how ConfigMaps must handle versioning.\n * @internal\n */\nexport type ConfigMap<T extends Record<string, unknown>> = {\n\treadonly [K in keyof T]-?: ConfigMapEntry<T[K]>;\n};\n\n/**\n * Entry in {@link ConfigMap} associating {@link MinimumMinorSemanticVersion} with configuration values that became supported in that version.\n * @remarks\n * All entries must at least provide an entry for {@link lowestMinVersionForCollab}.\n * @internal\n */\nexport interface ConfigMapEntry<T> {\n\t// This index signature (See https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures) requires all properties on this type to to have keys that are a MinimumMinorSemanticVersion and values of type T.\n\t// Note that the \"version\" part of this syntax is really just documentation and has no impact on the type checking (other than some identifier being required to the syntax here to differentiate it from the computed property syntax).\n\t[version: MinimumMinorSemanticVersion]: T;\n\t// Require an entry for lowestMinVersionForCollab:\n\t// this ensures that every supported deployed-client version has a specified value in the ConfigMap.\n\t// Note that this is NOT an index signature.\n\t// This is a regular property with a computed name (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#computed_property_names).\n\t[lowestMinVersionForCollab]: T;\n}\n\n/**\n * Generic type for runtimeOptionsAffectingDocSchemaConfigValidationMap\n *\n * @internal\n */\nexport type ConfigValidationMap<T extends Record<string, unknown>> = {\n\treadonly [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 * @privateRemarks\n * The extra `Record` type for the `configMap` is just used to allow the body of this function to be more type-safe due to limitations of generic types in TypeScript.\n * It should have no impact on the user of this function.\n * @internal\n */\nexport function getConfigsForMinVersionForCollab<T extends Record<SemanticVersion, unknown>>(\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tconfigMap: ConfigMap<T> & Record<keyof T, unknown>,\n): T {\n\tvalidateMinimumVersionForCollab(minVersionForCollab);\n\tconst defaultConfigs: Partial<T> = {};\n\t// Iterate over configMap to get default values for each option.\n\tfor (const [key, config] of Object.entries(configMap)) {\n\t\tdefaultConfigs[key] = getConfigForMinVersionForCollab(\n\t\t\tminVersionForCollab,\n\t\t\tconfig as ConfigMapEntry<unknown>,\n\t\t);\n\t}\n\t// We have populated every key, so casting away the Partial is now safe:\n\treturn defaultConfigs as T;\n}\n\n/**\n * Returns a default configuration given minVersionForCollab and {@link ConfigMapEntry}.\n *\n * @internal\n */\nexport function getConfigForMinVersionForCollab<T>(\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tconfig: ConfigMapEntry<T>,\n): T {\n\treturn getConfigForMinVersionForCollabIterable(\n\t\tminVersionForCollab,\n\t\tObject.entries(config) as [MinimumMinorSemanticVersion, T][],\n\t);\n}\n\n/**\n * Returns a default configuration given minVersionForCollab and the contents of a {@link ConfigMapEntry} in an Iterable.\n * @remarks\n * See also {@link getConfigForMinVersionForCollab} for consuming a ConfigMapEntry directly.\n *\n * `ConfigMapEntry` is a nice type safe format for developers to directly author this data,\n * but it is messy and less type safe to work with it in this format programmatically.\n * Thus this function exists to help meet the needs of programmatic use cases,\n * like cases which transform a ConfigMapEntry before selecting a value from it.\n * @internal\n */\nexport function getConfigForMinVersionForCollabIterable<T>(\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tentries: Iterable<readonly [MinimumMinorSemanticVersion | OldestSupportedClientVersion, T]>, // [[typeof lowestMinVersionForCollab, T], ...[OldestSupportedClientVersion, T][]],\n): T {\n\t// Validate and strongly type the versions from the configMap.\n\tconst versions: [OldestSupportedClientVersion, T][] = Array.from(\n\t\tentries,\n\t\t([version, value]) => {\n\t\t\tvalidateMinimumVersionForCollab(version);\n\t\t\treturn [version, value];\n\t\t},\n\t);\n\treturn (selectVersionRoundedDown(minVersionForCollab, versions) ??\n\t\tfail(0xcb8 /* No config map entry for version */))[1];\n}\n\n/**\n * Finds the entry for the highest version that is less than or equal to the provided minVersionForCollab.\n * @remarks\n * If none is found, returns undefined.\n *\n * When used with Fluid client versions, use the stricter {@link getConfigForMinVersionForCollabIterable} instead.\n *\n * @internal\n */\nexport function selectVersionRoundedDown<T>(\n\tminVersionForCollab: string,\n\tentries: Iterable<readonly [string, T]>,\n\tcompareVersions: (a: string, b: string) => number = compare,\n): readonly [string, T] | undefined {\n\t// Sort a copy of the iterable in descending order\n\tconst versions: (readonly [string, T])[] = [...entries];\n\tversions.sort((a, b) => compareVersions(b[0], a[0]));\n\n\t// For each config, we iterate over the keys and check if minVersionForCollab is greater than or equal to the version.\n\t// If so, we set it as the default value for the option.\n\tfor (const pair of versions) {\n\t\tconst [version, _] = pair;\n\t\tif (compareVersions(minVersionForCollab, version) >= 0) {\n\t\t\treturn pair;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Returns detailed information about the validity of a minVersionForCollab.\n * @param minVersionForCollab - The minVersionForCollab to validate.\n * @returns An object containing the validity information.\n *\n * @internal\n */\nexport function checkValidMinVersionForCollabVerbose(minVersionForCollab: SemanticVersion): {\n\tisValidSemver: boolean;\n\tisGteLowestMinVersion: boolean;\n\tisLtePkgVersion: boolean;\n\tisValidOldestSupportedClientVersion: boolean;\n} {\n\tconst parsed = parse(minVersionForCollab);\n\tconst isValidSemver = parsed !== null && parsed.build.length === 0;\n\tconst isGteLowestMinVersion =\n\t\tisValidSemver && gte(minVersionForCollab, lowestMinVersionForCollab);\n\tconst isLtePkgVersion = isValidSemver && lte(minVersionForCollab, cleanedPackageVersion);\n\tconst isValidOldestSupportedClientVersion =\n\t\tisGteLowestMinVersion &&\n\t\tisLtePkgVersion &&\n\t\tparsed !== null &&\n\t\tparsed.prerelease.length === 0 &&\n\t\t(parsed.major < 3 || parsed.patch === 0);\n\treturn {\n\t\tisValidSemver,\n\t\tisGteLowestMinVersion,\n\t\tisLtePkgVersion,\n\t\tisValidOldestSupportedClientVersion,\n\t};\n}\n\n/**\n * Checks if the minVersionForCollab is valid.\n * A valid minVersionForCollab is a OldestSupportedClientVersion that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.\n *\n * @internal\n */\nexport function isValidMinVersionForCollab(\n\tminVersionForCollab: SemanticVersion,\n): minVersionForCollab is OldestSupportedClientVersion {\n\treturn checkValidMinVersionForCollabVerbose(minVersionForCollab)\n\t\t.isValidOldestSupportedClientVersion;\n}\n\n/**\n * `pkgVersion` version without pre-release and with zeroed patch.\n * @remarks\n * This is the version the current codebase will have when officially released.\n * It allows CI and prerelease builds to test the release's features using that version as their\n * `OldestSupportedClientVersion`.\n *\n * Code that needs to derive this value from a package version should use\n * {@link @fluidframework/driver-definitions#featureVersion}.\n *\n * @privateRemarks\n * This value is validated against {@link validateMinimumVersionForCollab} by a test.\n *\n * @internal\n */\nexport const cleanedPackageVersion = featureVersion(\n\tpkgVersion,\n) satisfies OldestSupportedClientVersion;\n\n/**\n * Narrows the type of the provided {@link SemanticVersion} to a {@link @fluidframework/runtime-definitions#OldestSupportedClientVersion}, throwing a UsageError if it is not valid.\n * @remarks\n * This is more strict than the type constraints imposed by `OldestSupportedClientVersion`.\n * Currently there is no type which is used to separate semantically valid and typescript allowed OldestSupportedClientVersion values:\n * thus users that care about strict validation may want to call this on un-validated `OldestSupportedClientVersion` values.\n * @param semanticVersion - The version to check.\n * @throws UsageError if the version is not a valid OldestSupportedClientVersion.\n *\n * @internal\n */\nexport function validateMinimumVersionForCollab(\n\tsemanticVersion: string,\n): asserts semanticVersion is OldestSupportedClientVersion {\n\tconst minVersionForCollab = semanticVersion as OldestSupportedClientVersion;\n\tconst {\n\t\tisValidSemver,\n\t\tisGteLowestMinVersion,\n\t\tisLtePkgVersion,\n\t\tisValidOldestSupportedClientVersion,\n\t} = checkValidMinVersionForCollabVerbose(minVersionForCollab);\n\n\tif (!isValidOldestSupportedClientVersion) {\n\t\tthrow new UsageError(\n\t\t\t`Version ${minVersionForCollab} is not a valid OldestSupportedClientVersion. ` +\n\t\t\t\t`It must be in a valid semver format, at least ${lowestMinVersionForCollab}, ` +\n\t\t\t\t`less than or equal to the current package version ${cleanedPackageVersion}, ` +\n\t\t\t\t`have no prerelease component, and use patch version 0 for major version 3 and later. ` +\n\t\t\t\t`Use \"featureVersion\" to normalize a package version to the correct format. ` +\n\t\t\t\t`Details: { isValidSemver: ${isValidSemver}, isGteLowestMinVersion: ${isGteLowestMinVersion}, isLtePkgVersion: ${isLtePkgVersion}, isValidOldestSupportedClientVersion: ${isValidOldestSupportedClientVersion} }`,\n\t\t);\n\t}\n}\n\n/**\n * Validates the given `overrides`.\n *\n * Checks that for keys which are in both the `validationMap` and the `overrides`,\n * that the `validationMap` function for that key either returns undefined or a version less than or equal to `minVersionForCollab`.\n * @privateRemarks\n * This design seems odd, and might want to be revisited.\n * Currently it only permits opting out of features, not into them (unless validationMap returns undefined),\n * and the handling of undefined versions seems questionable.\n * Also ignoring of extra keys in overrides might be bad since it seems like overrides is supposed to be validated.\n * @internal\n */\nexport function validateConfigMapOverrides<T extends Record<string, unknown>>(\n\tminVersionForCollab: SemanticVersion,\n\toverrides: Partial<T>,\n\tvalidationMap: ConfigValidationMap<T>,\n): void {\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(overrides) as [\n\t\tkeyof T & string,\n\t\tT[keyof T & string],\n\t][]) {\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"]}
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.generateHandleContextPath = void 0;
7
+ exports.generateHandleContextPath = generateHandleContextPath;
8
8
  /**
9
9
  * Generates the absolute path for a Fluid object given its path and its parent routeContext.
10
10
  * @param path - The path to the Fluid object relative to the route context.
@@ -32,5 +32,4 @@ function generateHandleContextPath(path, routeContext) {
32
32
  : `${routeContext.absolutePath === "/" ? "" : routeContext.absolutePath}/${normalizedPath}`;
33
33
  }
34
34
  }
35
- exports.generateHandleContextPath = generateHandleContextPath;
36
35
  //# sourceMappingURL=dataStoreHandleContextUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHandleContextUtils.js","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACxC,IAAY,EACZ,YAAkC;IAElC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACjB,uBAAuB;QACvB,wDAAwD;QACxD,yFAAyF;QACzF,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;IACpE,CAAC;SAAM,CAAC;QACP,gEAAgE;QAChE,IAAI,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC;QAElB,iEAAiE;QACjE,2FAA2F;QAC3F,OAAO,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,cAAc,EAAE;YACtB,CAAC,CAAC,GACA,YAAY,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YACvD,IAAI,cAAc,EAAE,CAAC;IACxB,CAAC;AACF,CAAC;AAxBD,8DAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * Generates the absolute path for a Fluid object given its path and its parent routeContext.\n * @param path - The path to the Fluid object relative to the route context.\n * @param routeContext - The route context that contains the Fluid object.\n * @returns The absolute path to the Fluid object from the root of the Container.\n * @internal\n */\nexport function generateHandleContextPath(\n\tpath: string,\n\trouteContext?: IFluidHandleContext,\n): string {\n\tif (path === \"\") {\n\t\t// The `path` is empty.\n\t\t// If the routeContext does not exist, this is the root.\n\t\t// If the routeContext exists, the absolute path is the same as that of the routeContext.\n\t\treturn routeContext === undefined ? \"\" : routeContext.absolutePath;\n\t} else {\n\t\t// Remove beginning and trailing slashes, if any, from the path.\n\t\tlet normalizedPath = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tnormalizedPath = normalizedPath.endsWith(\"/\")\n\t\t\t? normalizedPath.slice(0, -1)\n\t\t\t: normalizedPath;\n\n\t\t// If the routeContext does not exist, path is the absolute path.\n\t\t// If the routeContext exists, absolute path is routeContext's absolute path plus the path.\n\t\treturn routeContext === undefined\n\t\t\t? `/${normalizedPath}`\n\t\t\t: `${\n\t\t\t\t\trouteContext.absolutePath === \"/\" ? \"\" : routeContext.absolutePath\n\t\t\t\t}/${normalizedPath}`;\n\t}\n}\n"]}
1
+ {"version":3,"file":"dataStoreHandleContextUtils.js","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAWH,8DAwBC;AA/BD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACxC,IAAY,EACZ,YAAkC;IAElC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACjB,uBAAuB;QACvB,wDAAwD;QACxD,yFAAyF;QACzF,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;IACpE,CAAC;SAAM,CAAC;QACP,gEAAgE;QAChE,IAAI,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC;QAElB,iEAAiE;QACjE,2FAA2F;QAC3F,OAAO,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,cAAc,EAAE;YACtB,CAAC,CAAC,GACA,YAAY,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YACvD,IAAI,cAAc,EAAE,CAAC;IACxB,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\n\n/**\n * Generates the absolute path for a Fluid object given its path and its parent routeContext.\n * @param path - The path to the Fluid object relative to the route context.\n * @param routeContext - The route context that contains the Fluid object.\n * @returns The absolute path to the Fluid object from the root of the Container.\n * @internal\n */\nexport function generateHandleContextPath(\n\tpath: string,\n\trouteContext?: IFluidHandleContext,\n): string {\n\tif (path === \"\") {\n\t\t// The `path` is empty.\n\t\t// If the routeContext does not exist, this is the root.\n\t\t// If the routeContext exists, the absolute path is the same as that of the routeContext.\n\t\treturn routeContext === undefined ? \"\" : routeContext.absolutePath;\n\t} else {\n\t\t// Remove beginning and trailing slashes, if any, from the path.\n\t\tlet normalizedPath = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tnormalizedPath = normalizedPath.endsWith(\"/\")\n\t\t\t? normalizedPath.slice(0, -1)\n\t\t\t: normalizedPath;\n\n\t\t// If the routeContext does not exist, path is the absolute path.\n\t\t// If the routeContext exists, absolute path is routeContext's absolute path plus the path.\n\t\treturn routeContext === undefined\n\t\t\t? `/${normalizedPath}`\n\t\t\t: `${\n\t\t\t\t\trouteContext.absolutePath === \"/\" ? \"\" : routeContext.absolutePath\n\t\t\t\t}/${normalizedPath}`;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE3E,OAAO,KAAK,EACX,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,yBAAyB,EACzB,qBAAqB,EACrB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,0CAA0C,CAAC;AAuBlD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CA4B7D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAkBjF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,YAAa,QAAQ,KAAG,SACP,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,SAAS,CAiBX;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,GAAG,uBAAuB,CAO1B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,yBAAyB,CAAC;AACzF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,sBAAsB,GAAG,2BAA2B,CAAC"}
1
+ {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE3E,OAAO,KAAK,EACX,sBAAsB,EACtB,2BAA2B,EAC3B,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,yBAAyB,EACzB,qBAAqB,EACrB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAGN,KAAK,uBAAuB,EAC5B,MAAM,0CAA0C,CAAC;AAuBlD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CA4B7D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAkBjF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,QAAQ,KAAG,SACP,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,SAAS,CAiBX;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,GAAG,uBAAuB,CAO1B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,yBAAyB,CAAC;AACzF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,sBAAsB,GAAG,2BAA2B,CAAC"}
@@ -4,7 +4,12 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.asLegacyAlpha = exports.dataStoreLoadTelemetryProps = exports.createResponseError = exports.create404Response = exports.responseToException = exports.exceptionToResponse = void 0;
7
+ exports.create404Response = void 0;
8
+ exports.exceptionToResponse = exceptionToResponse;
9
+ exports.responseToException = responseToException;
10
+ exports.createResponseError = createResponseError;
11
+ exports.dataStoreLoadTelemetryProps = dataStoreLoadTelemetryProps;
12
+ exports.asLegacyAlpha = asLegacyAlpha;
8
13
  const internal_1 = require("@fluidframework/core-utils/internal");
9
14
  const internal_2 = require("@fluidframework/telemetry-utils/internal");
10
15
  /**
@@ -47,7 +52,6 @@ function exceptionToResponse(error) {
47
52
  },
48
53
  };
49
54
  }
50
- exports.exceptionToResponse = exceptionToResponse;
51
55
  /**
52
56
  * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.
53
57
  * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.
@@ -73,7 +77,6 @@ function responseToException(response, request) {
73
77
  };
74
78
  return responseErr;
75
79
  }
76
- exports.responseToException = responseToException;
77
80
  /**
78
81
  * Creates a 404 "not found" response for the given request
79
82
  * @param request - The request that resulted in the 404 response
@@ -108,7 +111,6 @@ function createResponseError(status, value, request, headers) {
108
111
  headers,
109
112
  };
110
113
  }
111
- exports.createResponseError = createResponseError;
112
114
  /**
113
115
  * Returns the canonical set of code-artifact-tagged telemetry properties identifying a data store.
114
116
  * Use this anywhere a data store identity needs to appear in telemetry, so all such logs use
@@ -123,7 +125,6 @@ function dataStoreLoadTelemetryProps(props) {
123
125
  dataStoreId: id, // aka fluidDataStoreId, before 2.103.0
124
126
  });
125
127
  }
126
- exports.dataStoreLoadTelemetryProps = dataStoreLoadTelemetryProps;
127
128
  /**
128
129
  * Converts types to their alpha counterparts to expose alpha functionality.
129
130
  * @legacy @alpha
@@ -131,5 +132,4 @@ exports.dataStoreLoadTelemetryProps = dataStoreLoadTelemetryProps;
131
132
  function asLegacyAlpha(runtime) {
132
133
  return runtime;
133
134
  }
134
- exports.asLegacyAlpha = asLegacyAlpha;
135
135
  //# sourceMappingURL=dataStoreHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAS7D,uEAIkD;AAUlD;;;GAGG;AACH,SAAS,mBAAmB,CAAC,GAAY;IACxC,OAAO,CACN,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,6BAA6B,IAAI,GAAG;QACnC,GAAgD,CAAC,2BAA2B,KAAK,IAAI,CACtF,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAAc;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,KAAK,CAAC,IAAI;YAClB,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,IAAI,KAAK;gBACR,OAAO,KAAK,CAAC,KAAK,CAAC;YACpB,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,yBAAyB;SACxC,CAAC;IACH,CAAC;IAED,uLAAuL;IACvL,MAAM,YAAY,GACjB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK;QAC9D,CAAC,CAAE,KAA2B;QAC9B,CAAC,CAAC,IAAA,iCAAsB,GAAE,CAAC;IAE7B,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,GAAG,KAAK,EAAE;QACjB,IAAI,KAAK;YACR,OAAO,YAAY,CAAC,KAAK,CAAC;QAC3B,CAAC;KACD,CAAC;AACH,CAAC;AA5BD,kDA4BC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,QAAmB,EAAE,OAAiB;IACzE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OAAO;KACP,CAAC;AACH,CAAC;AAtBD,kDAsBC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,KAG3C;IACA,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,OAAO,IAAA,2BAAgB,EAAC;QACvB,oBAAoB,EAAE,sCAAsC;QAC5D,WAAW,EAAE,EAAE,EAAE,uCAAuC;KACxD,CAAC,CAAC;AACJ,CAAC;AAVD,kEAUC;AAYD;;;GAGG;AACH,SAAgB,aAAa,CAC5B,OAAuD;IAEvD,OAAO,OAAO,CAAC;AAChB,CAAC;AAJD,sCAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIFluidDataStoreRuntime,\n\tIFluidDataStoreRuntimeAlpha,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tContainerRuntimeBaseAlpha,\n\tIContainerRuntimeBase,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgenerateErrorWithStack,\n\ttagCodeArtifacts,\n\ttype ITelemetryPropertiesExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\ninterface IResponseException extends Error {\n\terrorFromRequestFluidObject: true;\n\tmessage: string;\n\tcode: number;\n\tstack?: string;\n\tunderlyingResponseHeaders?: Record<string, unknown>;\n}\n\n/**\n * Type guard for determining if an error is an {@link IResponseException}.\n * @internal\n */\nfunction isResponseException(err: unknown): err is IResponseException {\n\treturn (\n\t\terr !== null &&\n\t\ttypeof err === \"object\" &&\n\t\t\"errorFromRequestFluidObject\" in err &&\n\t\t(err as { errorFromRequestFluidObject: unknown }).errorFromRequestFluidObject === true\n\t);\n}\n\n/**\n * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.\n * @internal\n */\nexport function exceptionToResponse(error: unknown): IResponse {\n\tconst status = 500;\n\tif (isResponseException(error)) {\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: error.code,\n\t\t\tvalue: error.message,\n\t\t\tget stack() {\n\t\t\t\treturn error.stack;\n\t\t\t},\n\t\t\theaders: error.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Both error generation, and accessing the stack value are expensive operations, so we only create an error if necessary, and then defer accessing the stack value until it is needed.\n\tconst errWithStack =\n\t\ttypeof error === \"object\" && error !== null && \"stack\" in error\n\t\t\t? (error as { stack: string })\n\t\t\t: generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${error}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t};\n}\n\n/**\n * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.\n * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.\n * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.\n * @returns An Error object with additional properties from the response\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\t// As of 2025-08-20 the code seems to assume `response.value` is always a string.\n\t// This type assertion just encodes that assumption as we move to stricter linting rules, but it might need to be revisited.\n\tconst message = response.value as string;\n\t// Both error generation, and accessing the stack value are expensive operations, so we only create an error if necessary, and then defer accessing the stack value until it is needed.\n\tconst errWithStack = \"stack\" in response ? response : generateErrorWithStack();\n\tconst responseErr: Error & IResponseException = {\n\t\terrorFromRequestFluidObject: true,\n\t\tmessage,\n\t\tname: \"Error\",\n\t\tcode: response.status,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\tunderlyingResponseHeaders: response.headers,\n\t};\n\n\treturn responseErr;\n}\n\n/**\n * Creates a 404 \"not found\" response for the given request\n * @param request - The request that resulted in the 404 response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.\n * @legacy\n * @beta\n */\nexport const create404Response = (request: IRequest): IResponse =>\n\tcreateResponseError(404, \"not found\", request);\n\n/**\n * Creates an error response with the specified status code and message\n * @param status - HTTP status code for the error (must not be 200)\n * @param value - Error message or description\n * @param request - The request that resulted in this error\n * @param headers - Optional headers to include in the response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error\n * @internal\n */\nexport function createResponseError(\n\tstatus: number,\n\tvalue: string,\n\trequest: IRequest,\n\theaders?: Record<string, unknown>,\n): IResponse {\n\tassert(status !== 200, 0x19b /* \"Cannot not create response error on 200 status\" */);\n\t// Omit query string which could contain personal data unfit for logging\n\tconst urlNoQuery = request.url?.split(\"?\")[0];\n\n\t// Both error generation, and accessing the stack value are expensive operations, so we only create an error if necessary, and then defer accessing the stack value until it is needed.\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\theaders,\n\t};\n}\n\n/**\n * Returns the canonical set of code-artifact-tagged telemetry properties identifying a data store.\n * Use this anywhere a data store identity needs to appear in telemetry, so all such logs use\n * consistent property names.\n * @internal\n */\nexport function dataStoreLoadTelemetryProps(props: {\n\tid: string;\n\tpackagePath: readonly string[];\n}): ITelemetryPropertiesExt {\n\tconst { id, packagePath } = props;\n\tconst dataStorePackagePath = packagePath.length > 0 ? packagePath.join(\"/\") : undefined;\n\treturn tagCodeArtifacts({\n\t\tdataStorePackagePath, // aka fullPackageName, before 2.103.0\n\t\tdataStoreId: id, // aka fluidDataStoreId, before 2.103.0\n\t});\n}\n\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(runtime: IContainerRuntimeBase): ContainerRuntimeBaseAlpha;\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(runtime: IFluidDataStoreRuntime): IFluidDataStoreRuntimeAlpha;\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(\n\truntime: IFluidDataStoreRuntime | IContainerRuntimeBase,\n): unknown {\n\treturn runtime;\n}\n"]}
1
+ {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2CH,kDA4BC;AASD,kDAkBC;AAqBD,kDAsBC;AAQD,kEAUC;AAgBD,sCAIC;AAhLD,kEAA6D;AAS7D,uEAIkD;AAUlD;;;GAGG;AACH,SAAS,mBAAmB,CAAC,GAAY;IACxC,OAAO,CACN,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,6BAA6B,IAAI,GAAG;QACnC,GAAgD,CAAC,2BAA2B,KAAK,IAAI,CACtF,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,KAAc;IACjD,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,KAAK,CAAC,IAAI;YAClB,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,IAAI,KAAK;gBACR,OAAO,KAAK,CAAC,KAAK,CAAC;YACpB,CAAC;YACD,OAAO,EAAE,KAAK,CAAC,yBAAyB;SACxC,CAAC;IACH,CAAC;IAED,uLAAuL;IACvL,MAAM,YAAY,GACjB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK;QAC9D,CAAC,CAAE,KAA2B;QAC9B,CAAC,CAAC,IAAA,iCAAsB,GAAE,CA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;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,UAAU,EAAE;QACnE,IAAI,KAAK;YACR,OAAO,YAAY,CAAC,KAAK,CAAC;QAC3B,CAAC;QACD,OAAO;KACP,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,KAG3C;IACA,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,OAAO,IAAA,2BAAgB,EAAC;QACvB,oBAAoB,EAAE,sCAAsC;QAC5D,WAAW,EAAE,EAAE,EAAE,uCAAuC;KACxD,CAAC,CAAC;AACJ,CAAC;AAYD;;;GAGG;AACH,SAAgB,aAAa,CAC5B,OAAuD;IAEvD,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIFluidDataStoreRuntime,\n\tIFluidDataStoreRuntimeAlpha,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tContainerRuntimeBaseAlpha,\n\tIContainerRuntimeBase,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tgenerateErrorWithStack,\n\ttagCodeArtifacts,\n\ttype ITelemetryPropertiesExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\ninterface IResponseException extends Error {\n\terrorFromRequestFluidObject: true;\n\tmessage: string;\n\tcode: number;\n\tstack?: string;\n\tunderlyingResponseHeaders?: Record<string, unknown>;\n}\n\n/**\n * Type guard for determining if an error is an {@link IResponseException}.\n * @internal\n */\nfunction isResponseException(err: unknown): err is IResponseException {\n\treturn (\n\t\terr !== null &&\n\t\ttypeof err === \"object\" &&\n\t\t\"errorFromRequestFluidObject\" in err &&\n\t\t(err as { errorFromRequestFluidObject: unknown }).errorFromRequestFluidObject === true\n\t);\n}\n\n/**\n * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.\n * @internal\n */\nexport function exceptionToResponse(error: unknown): IResponse {\n\tconst status = 500;\n\tif (isResponseException(error)) {\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: error.code,\n\t\t\tvalue: error.message,\n\t\t\tget stack() {\n\t\t\t\treturn error.stack;\n\t\t\t},\n\t\t\theaders: error.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Both error generation, and accessing the stack value are expensive operations, so we only create an error if necessary, and then defer accessing the stack value until it is needed.\n\tconst errWithStack =\n\t\ttypeof error === \"object\" && error !== null && \"stack\" in error\n\t\t\t? (error as { stack: string })\n\t\t\t: generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${error}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t};\n}\n\n/**\n * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.\n * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.\n * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.\n * @returns An Error object with additional properties from the response\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\t// As of 2025-08-20 the code seems to assume `response.value` is always a string.\n\t// This type assertion just encodes that assumption as we move to stricter linting rules, but it might need to be revisited.\n\tconst message = response.value as string;\n\t// Both error generation, and accessing the stack value are expensive operations, so we only create an error if necessary, and then defer accessing the stack value until it is needed.\n\tconst errWithStack = \"stack\" in response ? response : generateErrorWithStack();\n\tconst responseErr: Error & IResponseException = {\n\t\terrorFromRequestFluidObject: true,\n\t\tmessage,\n\t\tname: \"Error\",\n\t\tcode: response.status,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\tunderlyingResponseHeaders: response.headers,\n\t};\n\n\treturn responseErr;\n}\n\n/**\n * Creates a 404 \"not found\" response for the given request\n * @param request - The request that resulted in the 404 response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.\n * @legacy\n * @beta\n */\nexport const create404Response = (request: IRequest): IResponse =>\n\tcreateResponseError(404, \"not found\", request);\n\n/**\n * Creates an error response with the specified status code and message\n * @param status - HTTP status code for the error (must not be 200)\n * @param value - Error message or description\n * @param request - The request that resulted in this error\n * @param headers - Optional headers to include in the response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error\n * @internal\n */\nexport function createResponseError(\n\tstatus: number,\n\tvalue: string,\n\trequest: IRequest,\n\theaders?: Record<string, unknown>,\n): IResponse {\n\tassert(status !== 200, 0x19b /* \"Cannot not create response error on 200 status\" */);\n\t// Omit query string which could contain personal data unfit for logging\n\tconst urlNoQuery = request.url?.split(\"?\")[0];\n\n\t// Both error generation, and accessing the stack value are expensive operations, so we only create an error if necessary, and then defer accessing the stack value until it is needed.\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\theaders,\n\t};\n}\n\n/**\n * Returns the canonical set of code-artifact-tagged telemetry properties identifying a data store.\n * Use this anywhere a data store identity needs to appear in telemetry, so all such logs use\n * consistent property names.\n * @internal\n */\nexport function dataStoreLoadTelemetryProps(props: {\n\tid: string;\n\tpackagePath: readonly string[];\n}): ITelemetryPropertiesExt {\n\tconst { id, packagePath } = props;\n\tconst dataStorePackagePath = packagePath.length > 0 ? packagePath.join(\"/\") : undefined;\n\treturn tagCodeArtifacts({\n\t\tdataStorePackagePath, // aka fullPackageName, before 2.103.0\n\t\tdataStoreId: id, // aka fluidDataStoreId, before 2.103.0\n\t});\n}\n\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(runtime: IContainerRuntimeBase): ContainerRuntimeBaseAlpha;\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(runtime: IFluidDataStoreRuntime): IFluidDataStoreRuntimeAlpha;\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n */\nexport function asLegacyAlpha(\n\truntime: IFluidDataStoreRuntime | IContainerRuntimeBase,\n): unknown {\n\treturn runtime;\n}\n"]}
@@ -4,7 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toDeltaManagerErased = exports.toDeltaManagerInternal = void 0;
7
+ exports.toDeltaManagerInternal = toDeltaManagerInternal;
8
+ exports.toDeltaManagerErased = toDeltaManagerErased;
8
9
  /**
9
10
  * Casts the public API for delta manager into the internal one,
10
11
  * exposing access to APIs needed by the implementation of Fluid Framework but not its users.
@@ -14,7 +15,6 @@ function toDeltaManagerInternal(deltaManager) {
14
15
  // Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager
15
16
  return deltaManager;
16
17
  }
17
- exports.toDeltaManagerInternal = toDeltaManagerInternal;
18
18
  /**
19
19
  * Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.
20
20
  * @internal
@@ -23,5 +23,4 @@ function toDeltaManagerErased(deltaManager) {
23
23
  // Type assertion is safe as we're intentionally erasing the type information for public API safety
24
24
  return deltaManager;
25
25
  }
26
- exports.toDeltaManagerErased = toDeltaManagerErased;
27
26
  //# sourceMappingURL=deltaManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,YAAiC;IAEjC,sHAAsH;IACtH,OAAO,YAAqF,CAAC;AAC9F,CAAC;AALD,wDAKC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,YAAwE;IAExE,mGAAmG;IACnG,OAAO,YAA8C,CAAC;AACvD,CAAC;AALD,oDAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type { IDeltaManagerErased } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Casts the public API for delta manager into the internal one,\n * exposing access to APIs needed by the implementation of Fluid Framework but not its users.\n * @legacy @beta\n */\nexport function toDeltaManagerInternal(\n\tdeltaManager: IDeltaManagerErased,\n): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t// Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager\n\treturn deltaManager as unknown as IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n}\n\n/**\n * Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.\n * @internal\n */\nexport function toDeltaManagerErased(\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n): IDeltaManagerErased {\n\t// Type assertion is safe as we're intentionally erasing the type information for public API safety\n\treturn deltaManager as unknown as IDeltaManagerErased;\n}\n"]}
1
+ {"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAcH,wDAKC;AAMD,oDAKC;AArBD;;;;GAIG;AACH,SAAgB,sBAAsB,CACrC,YAAiC;IAEjC,sHAAsH;IACtH,OAAO,YAAqF,CAAC;AAC9F,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CACnC,YAAwE;IAExE,mGAAmG;IACnG,OAAO,YAA8C,CAAC;AACvD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type { IDeltaManagerErased } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Casts the public API for delta manager into the internal one,\n * exposing access to APIs needed by the implementation of Fluid Framework but not its users.\n * @legacy @beta\n */\nexport function toDeltaManagerInternal(\n\tdeltaManager: IDeltaManagerErased,\n): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t// Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager\n\treturn deltaManager as unknown as IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n}\n\n/**\n * Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.\n * @internal\n */\nexport function toDeltaManagerErased(\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n): IDeltaManagerErased {\n\t// Type assertion is safe as we're intentionally erasing the type information for public API safety\n\treturn deltaManager as unknown as IDeltaManagerErased;\n}\n"]}
package/dist/handles.d.ts CHANGED
@@ -33,7 +33,7 @@ export declare const isSerializedHandle: (value: unknown) => value is ISerialize
33
33
  * Checks if a Fluid handle's internal payload is pending.
34
34
  * @internal
35
35
  */
36
- export declare const isFluidHandleInternalPayloadPending: (fluidHandleInternal: IFluidHandleInternal) => fluidHandleInternal is IFluidHandleInternalPayloadPending<unknown>;
36
+ export declare const isFluidHandleInternalPayloadPending: (fluidHandleInternal: IFluidHandleInternal) => fluidHandleInternal is IFluidHandleInternalPayloadPending;
37
37
  /**
38
38
  * Check if the handle is an IFluidHandlePayloadPending.
39
39
  * @privateRemarks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AAC;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,13 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
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;
7
+ exports.FluidHandleBase = exports.isLocalFluidHandle = exports.isFluidHandlePayloadPending = exports.isFluidHandleInternalPayloadPending = exports.isSerializedHandle = void 0;
8
+ exports.encodeHandleForSerialization = encodeHandleForSerialization;
9
+ exports.isFluidHandle = isFluidHandle;
10
+ exports.compareFluidHandles = compareFluidHandles;
11
+ exports.toFluidHandleInternal = toFluidHandleInternal;
12
+ exports.toFluidHandleErased = toFluidHandleErased;
13
+ exports.lookupTemporaryBlobStorageId = lookupTemporaryBlobStorageId;
8
14
  const core_interfaces_1 = require("@fluidframework/core-interfaces");
9
15
  /**
10
16
  * Narrow a value to {@link ISerializedHandle} by checking its type property.
@@ -55,7 +61,6 @@ function encodeHandleForSerialization(handle) {
55
61
  url: handle.absolutePath,
56
62
  };
57
63
  }
58
- exports.encodeHandleForSerialization = encodeHandleForSerialization;
59
64
  /**
60
65
  * Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).
61
66
  *
@@ -93,7 +98,6 @@ function isFluidHandle(value) {
93
98
  }
94
99
  return false;
95
100
  }
96
- exports.isFluidHandle = isFluidHandle;
97
101
  /**
98
102
  * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.
99
103
  * @remarks
@@ -105,7 +109,6 @@ function compareFluidHandles(a, b) {
105
109
  const bInternal = toFluidHandleInternal(b);
106
110
  return aInternal.absolutePath === bInternal.absolutePath;
107
111
  }
108
- exports.compareFluidHandles = compareFluidHandles;
109
112
  /**
110
113
  * Downcast an IFluidHandle to an IFluidHandleInternal.
111
114
  * @legacy @beta
@@ -123,7 +126,6 @@ function toFluidHandleInternal(handle) {
123
126
  // Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal
124
127
  return handle[core_interfaces_1.fluidHandleSymbol];
125
128
  }
126
- exports.toFluidHandleInternal = toFluidHandleInternal;
127
129
  /**
128
130
  * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
129
131
  * @legacy @beta
@@ -132,7 +134,6 @@ function toFluidHandleErased(handle) {
132
134
  // Type assertion is safe as we're intentionally erasing internal type information
133
135
  return handle;
134
136
  }
135
- exports.toFluidHandleErased = toFluidHandleErased;
136
137
  /**
137
138
  * Base class which can be uses to assist implementing IFluidHandleInternal.
138
139
  * @legacy @beta
@@ -186,5 +187,4 @@ function lookupTemporaryBlobStorageId(containerRuntime, handle) {
186
187
  const internalRuntime = containerRuntime;
187
188
  return internalRuntime.lookupTemporaryBlobStorageId(localId);
188
189
  }
189
- exports.lookupTemporaryBlobStorageId = lookupTemporaryBlobStorageId;
190
190
  //# sourceMappingURL=handles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,qEAAkF;AA+BlF;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA8B,EAAE;AAChF,uFAAuF;AACtF,KAAuC,EAAE,IAAI,KAAK,kBAAkB,C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B,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"]}
1
+ {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAmFH,oEAWC;AAoBD,sCAmBC;AAQD,kDAIC;AAMD,sDAaC;AAMD,kDAKC;AAyCD,oEA8BC;AA/OD,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,CAAC;QACjD,CAAC,CAAC;YACA,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,MAAM,CAAC,YAAY;YACxB,cAAc,EAAE,IAAI;SACpB;QACF,CAAC,CAAC;YACA,IAAI,EAAE,kB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AAe,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"]}
@@ -11,6 +11,8 @@ const internal_1 = require("@fluidframework/core-utils/internal");
11
11
  * @internal
12
12
  */
13
13
  class ObjectStoragePartition {
14
+ storage;
15
+ path;
14
16
  constructor(storage, path) {
15
17
  this.storage = storage;
16
18
  this.path = path;
@@ -1 +1 @@
1
- {"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAI7D;;;GAGG;AACH,MAAa,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACxF,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAEM,eAAe;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;IACvC,CAAC;CACD;AAxBD,wDAwBC","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 { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Returns a new IChannelStorageService that resolves the given `path` as root.\n * @internal\n */\nexport class ObjectStoragePartition implements IChannelStorageService {\n\tpublic constructor(\n\t\tprivate readonly storage: IChannelStorageService,\n\t\tprivate readonly path: string,\n\t) {\n\t\t// `path` must not include the trailing separator.\n\t\tassert(!path.endsWith(\"/\"), 0x19c /* \"storage service path has trailing separator\" */);\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(`${this.path}/${path}`);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.storage.contains(`${this.path}/${path}`);\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn this.storage.list(`${this.path}/${path}`);\n\t}\n\n\tpublic getSnapshotTree(): ISnapshotTree | undefined {\n\t\treturn this.storage.getSnapshotTree();\n\t}\n}\n"]}
1
+ {"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAI7D;;;GAGG;AACH,MAAa,sBAAsB;IAEhB;IACA;IAFlB,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,IAAA,iBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACxF,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAEM,eAAe;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;IACvC,CAAC;CACD;AAxBD,wDAwBC","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 { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport type { ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Returns a new IChannelStorageService that resolves the given `path` as root.\n * @internal\n */\nexport class ObjectStoragePartition implements IChannelStorageService {\n\tpublic constructor(\n\t\tprivate readonly storage: IChannelStorageService,\n\t\tprivate readonly path: string,\n\t) {\n\t\t// `path` must not include the trailing separator.\n\t\tassert(!path.endsWith(\"/\"), 0x19c /* \"storage service path has trailing separator\" */);\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(`${this.path}/${path}`);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.storage.contains(`${this.path}/${path}`);\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn this.storage.list(`${this.path}/${path}`);\n\t}\n\n\tpublic getSnapshotTree(): ISnapshotTree | undefined {\n\t\treturn this.storage.getSnapshotTree();\n\t}\n}\n"]}
@@ -4,7 +4,8 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = void 0;
7
+ exports.getNormalizedObjectStoragePathParts = getNormalizedObjectStoragePathParts;
8
+ exports.listBlobsAtTreePath = listBlobsAtTreePath;
8
9
  const internal_1 = require("@fluidframework/driver-definitions/internal");
9
10
  /**
10
11
  * Normalizes a storage path by removing leading and trailing slashes and splitting into parts
@@ -25,7 +26,6 @@ function getNormalizedObjectStoragePathParts(path) {
25
26
  }
26
27
  return [];
27
28
  }
28
- exports.getNormalizedObjectStoragePathParts = getNormalizedObjectStoragePathParts;
29
29
  /**
30
30
  * Lists all blobs at the specified path in the given tree
31
31
  * @param inputTree - The tree to search within
@@ -52,5 +52,4 @@ async function listBlobsAtTreePath(inputTree, path) {
52
52
  }
53
53
  return tree.entries.filter((e) => e.type === internal_1.TreeEntry.Blob).map((e) => e.path);
54
54
  }
55
- exports.listBlobsAtTreePath = listBlobsAtTreePath;
56
55
  //# sourceMappingURL=objectstorageutils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAAwE;AAExE;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAC,IAAY;IAC/D,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,aAAa,GAAG,aAAa,CAAC,KAAK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qB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AArBD,kDAqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITree } from \"@fluidframework/driver-definitions/internal\";\nimport { TreeEntry } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Normalizes a storage path by removing leading and trailing slashes and splitting into parts\n * @param path - The storage path to normalize (e.g. \"/foo/bar/\")\n * @returns Array of path segments (e.g. [\"foo\", \"bar\"])\n * @internal\n */\nexport function getNormalizedObjectStoragePathParts(path: string): string[] {\n\tlet normalizePath = path;\n\tif (normalizePath.startsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.slice(1);\n\t}\n\tif (normalizePath.endsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.slice(0, -1);\n\t}\n\tif (normalizePath.length > 0) {\n\t\treturn normalizePath.split(\"/\");\n\t}\n\treturn [];\n}\n\n/**\n * Lists all blobs at the specified path in the given tree\n * @param inputTree - The tree to search within\n * @param path - The path to search at (e.g. \"foo/bar\")\n * @returns Promise that resolves to an array of blob names at that path\n * @throws Error if the path does not exist in the tree\n * @internal\n */\nexport async function listBlobsAtTreePath(\n\tinputTree: ITree | undefined,\n\tpath: string,\n): Promise<string[]> {\n\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\tlet tree: ITree | undefined = inputTree;\n\twhile (tree?.entries !== undefined && pathParts.length > 0) {\n\t\tconst part = pathParts.shift();\n\t\tconst treeEntry = tree.entries.find((value) => {\n\t\t\treturn value.type === TreeEntry.Tree && value.path === part ? true : false;\n\t\t});\n\n\t\t// this check is largely superfluous due to the same check being done\n\t\t// immediately above. the type system, however, is not aware of this.\n\t\t// so we must redundantly determine that the entry's type is \"Tree\"\n\t\ttree = treeEntry?.type === TreeEntry.Tree ? treeEntry.value : undefined;\n\t}\n\tif (tree?.entries === undefined || pathParts.length > 0) {\n\t\tthrow new Error(\"path does not exist\");\n\t}\n\treturn tree.entries.filter((e) => e.type === TreeEntry.Blob).map((e) => e.path);\n}\n"]}
1
+ {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAWH,kFAYC;AAUD,kDAqBC;AAnDD,0EAAwE;AAExE;;;;;GAKG;AACH,SAAgB,mCAAmC,CAAC,IAAY;IAC/D,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CACxC,SAA4B,EAC5B,IAAY;IAEZ,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,IAAI,GAAsB,SAAS,CAAC;IACxC,OAAO,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,oBAAS,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5E,CAAC,CAAC,CAAC;QAEH,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,IAAI,GAAG,SAAS,EAAE,IAAI,KAAK,oBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACzE,CAAC;IACD,IAAI,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITree } from \"@fluidframework/driver-definitions/internal\";\nimport { TreeEntry } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Normalizes a storage path by removing leading and trailing slashes and splitting into parts\n * @param path - The storage path to normalize (e.g. \"/foo/bar/\")\n * @returns Array of path segments (e.g. [\"foo\", \"bar\"])\n * @internal\n */\nexport function getNormalizedObjectStoragePathParts(path: string): string[] {\n\tlet normalizePath = path;\n\tif (normalizePath.startsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.slice(1);\n\t}\n\tif (normalizePath.endsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.slice(0, -1);\n\t}\n\tif (normalizePath.length > 0) {\n\t\treturn normalizePath.split(\"/\");\n\t}\n\treturn [];\n}\n\n/**\n * Lists all blobs at the specified path in the given tree\n * @param inputTree - The tree to search within\n * @param path - The path to search at (e.g. \"foo/bar\")\n * @returns Promise that resolves to an array of blob names at that path\n * @throws Error if the path does not exist in the tree\n * @internal\n */\nexport async function listBlobsAtTreePath(\n\tinputTree: ITree | undefined,\n\tpath: string,\n): Promise<string[]> {\n\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\tlet tree: ITree | undefined = inputTree;\n\twhile (tree?.entries !== undefined && pathParts.length > 0) {\n\t\tconst part = pathParts.shift();\n\t\tconst treeEntry = tree.entries.find((value) => {\n\t\t\treturn value.type === TreeEntry.Tree && value.path === part ? true : false;\n\t\t});\n\n\t\t// this check is largely superfluous due to the same check being done\n\t\t// immediately above. the type system, however, is not aware of this.\n\t\t// so we must redundantly determine that the entry's type is \"Tree\"\n\t\ttree = treeEntry?.type === TreeEntry.Tree ? treeEntry.value : undefined;\n\t}\n\tif (tree?.entries === undefined || pathParts.length > 0) {\n\t\tthrow new Error(\"path does not exist\");\n\t}\n\treturn tree.entries.filter((e) => e.type === TreeEntry.Blob).map((e) => e.path);\n}\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.117.0";
8
+ export declare const pkgVersion = "3.0.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,YAAY,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,UAAU,CAAC"}
@@ -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.117.0";
11
+ exports.pkgVersion = "3.0.0";
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,SAAS,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.117.0\";\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,OAAO,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 = \"3.0.0\";\n"]}
@@ -19,6 +19,11 @@ const utils_js_1 = require("./utils.js");
19
19
  * @internal
20
20
  */
21
21
  class RemoteFluidObjectHandle extends handles_js_1.FluidHandleBase {
22
+ absolutePath;
23
+ routeContext;
24
+ payloadPending;
25
+ isAttached = true;
26
+ objectP;
22
27
  /**
23
28
  * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.
24
29
  * @param absolutePath - The absolute path to the handle from the container runtime.
@@ -30,7 +35,6 @@ class RemoteFluidObjectHandle extends handles_js_1.FluidHandleBase {
30
35
  this.absolutePath = absolutePath;
31
36
  this.routeContext = routeContext;
32
37
  this.payloadPending = payloadPending;
33
- this.isAttached = true;
34
38
  (0, internal_1.assert)(absolutePath.startsWith("/"), 0x19d /* "Handles should always have absolute paths" */);
35
39
  }
36
40
  async get() {
@@ -1 +1 @@
1
- {"version":3,"file":"remoteFluidObjectHandle.js","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,kEAA6D;AAE7D,+DAA4D;AAC5D,6CAA+C;AAC/C,yCAA4C;AAE5C;;;;;;;;GAQG;AACH,MAAa,uBAAwB,SAAQ,4BAA4B;IAIxE;;;;;OAKG;IACH,YACiB,YAAoB,EACpB,YAAiC,EACjC,cAAuB;QAEvC,KAAK,EAAE,CAAC;QAJQ,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QACjC,mBAAc,GAAd,cAAc,CAAS;QAZxB,eAAU,GAAG,IAAI,CAAC;QAejC,IAAA,iBAAM,EACL,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAC5B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,GAAG;QACf,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAChC,6EAA6E;YAC7E,MAAM,OAAO,GAAa;gBACzB,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,OAAO,EAAE;oBACR,CAAC,yBAAc,CAAC,SAAS,CAAC,EAAE,IAAI;oBAChC,CAAC,yBAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,cAAc;iBACpD;aACD,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAc,CAAC,QAAQ,EAAE,EAAE;gBACtF,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE,CAAC;oBAC1C,uIAAuI;oBACvI,MAAM,WAAW,GAAgB,QAAQ,CAAC,KAAoB,CAAC;oBAC/D,OAAO,WAAW,CAAC;gBACpB,CAAC;gBACD,MAAM,IAAA,yCAAmB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;CACD;AA/CD,0DA+CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { responseToException } from \"./dataStoreHelpers.js\";\nimport { FluidHandleBase } from \"./handles.js\";\nimport { RuntimeHeaders } from \"./utils.js\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n *\n * @internal\n */\nexport class RemoteFluidObjectHandle extends FluidHandleBase<FluidObject> {\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t * @param payloadPending - Whether the handle may have a pending payload that is not yet available.\n\t */\n\tpublic constructor(\n\t\tpublic readonly absolutePath: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic readonly payloadPending: boolean,\n\t) {\n\t\tsuper();\n\t\tassert(\n\t\t\tabsolutePath.startsWith(\"/\"),\n\t\t\t0x19d /* \"Handles should always have absolute paths\" */,\n\t\t);\n\t}\n\n\tpublic async get(): Promise<FluidObject> {\n\t\tif (this.objectP === undefined) {\n\t\t\t// Add `viaHandle` header to distinguish from requests from non-handle paths.\n\t\t\tconst request: IRequest = {\n\t\t\t\turl: this.absolutePath,\n\t\t\t\theaders: {\n\t\t\t\t\t[RuntimeHeaders.viaHandle]: true,\n\t\t\t\t\t[RuntimeHeaders.payloadPending]: this.payloadPending,\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.objectP = this.routeContext.resolveHandle(request).then<FluidObject>((response) => {\n\t\t\t\tif (response.mimeType === \"fluid/object\") {\n\t\t\t\t\t// Responses with mimeType == \"fluid/object\" are produced by Fluid, and thus they can reasonably be expected to always be a FluidObject\n\t\t\t\t\tconst fluidObject: FluidObject = response.value as FluidObject;\n\t\t\t\t\treturn fluidObject;\n\t\t\t\t}\n\t\t\t\tthrow responseToException(response, request);\n\t\t\t});\n\t\t}\n\t\treturn this.objectP;\n\t}\n\n\tpublic attachGraph(): void {\n\t\treturn;\n\t}\n}\n"]}
1
+ {"version":3,"file":"remoteFluidObjectHandle.js","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,kEAA6D;AAE7D,+DAA4D;AAC5D,6CAA+C;AAC/C,yCAA4C;AAE5C;;;;;;;;GAQG;AACH,MAAa,uBAAwB,SAAQ,4BAA4B;IAWvD;IACA;IACA;IAZD,UAAU,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAmC;IAElD;;;;;OAKG;IACH,YACiB,YAAoB,EACpB,YAAiC,EACjC,cAAuB;QAEvC,KAAK,EAAE,CAAC;QAJQ,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QACjC,mBAAc,GAAd,cAAc,CAAS;QAGvC,IAAA,iBAAM,EACL,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAC5B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,GAAG;QACf,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAChC,6EAA6E;YAC7E,MAAM,OAAO,GAAa;gBACzB,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,OAAO,EAAE;oBACR,CAAC,yBAAc,CAAC,SAAS,CAAC,EAAE,IAAI;oBAChC,CAAC,yBAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,cAAc;iBACpD;aACD,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,CAAc,CAAC,QAAQ,EAAE,EAAE;gBACtF,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE,CAAC;oBAC1C,uIAAuI;oBACvI,MAAM,WAAW,GAAgB,QAAQ,CAAC,KAAoB,CAAC;oBAC/D,OAAO,WAAW,CAAC;gBACpB,CAAC;gBACD,MAAM,IAAA,yCAAmB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;CACD;AA/CD,0DA+CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { FluidObject, IRequest } from \"@fluidframework/core-interfaces\";\nimport type { IFluidHandleContext } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\n\nimport { responseToException } from \"./dataStoreHelpers.js\";\nimport { FluidHandleBase } from \"./handles.js\";\nimport { RuntimeHeaders } from \"./utils.js\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n *\n * @internal\n */\nexport class RemoteFluidObjectHandle extends FluidHandleBase<FluidObject> {\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t * @param payloadPending - Whether the handle may have a pending payload that is not yet available.\n\t */\n\tpublic constructor(\n\t\tpublic readonly absolutePath: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t\tpublic readonly payloadPending: boolean,\n\t) {\n\t\tsuper();\n\t\tassert(\n\t\t\tabsolutePath.startsWith(\"/\"),\n\t\t\t0x19d /* \"Handles should always have absolute paths\" */,\n\t\t);\n\t}\n\n\tpublic async get(): Promise<FluidObject> {\n\t\tif (this.objectP === undefined) {\n\t\t\t// Add `viaHandle` header to distinguish from requests from non-handle paths.\n\t\t\tconst request: IRequest = {\n\t\t\t\turl: this.absolutePath,\n\t\t\t\theaders: {\n\t\t\t\t\t[RuntimeHeaders.viaHandle]: true,\n\t\t\t\t\t[RuntimeHeaders.payloadPending]: this.payloadPending,\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.objectP = this.routeContext.resolveHandle(request).then<FluidObject>((response) => {\n\t\t\t\tif (response.mimeType === \"fluid/object\") {\n\t\t\t\t\t// Responses with mimeType == \"fluid/object\" are produced by Fluid, and thus they can reasonably be expected to always be a FluidObject\n\t\t\t\t\tconst fluidObject: FluidObject = response.value as FluidObject;\n\t\t\t\t\treturn fluidObject;\n\t\t\t\t}\n\t\t\t\tthrow responseToException(response, request);\n\t\t\t});\n\t\t}\n\t\treturn this.objectP;\n\t}\n\n\tpublic attachGraph(): void {\n\t\treturn;\n\t}\n}\n"]}
@@ -10,6 +10,7 @@ exports.RequestParser = void 0;
10
10
  * @legacy @beta
11
11
  */
12
12
  class RequestParser {
13
+ request;
13
14
  /**
14
15
  * Splits the path of the url and decodes each path part
15
16
  * @param url - the url to get path parts of
@@ -25,6 +26,8 @@ class RequestParser {
25
26
  }
26
27
  return pathParts;
27
28
  }
29
+ requestPathParts;
30
+ query;
28
31
  static create(request) {
29
32
  // Perf optimizations.
30
33
  if (request instanceof RequestParser) {
@@ -43,6 +46,7 @@ class RequestParser {
43
46
  get url() {
44
47
  return this.request.url;
45
48
  }
49
+ headers;
46
50
  /**
47
51
  * Returns the decoded path parts of the request's url
48
52
  */