@fluidframework/runtime-utils 2.118.1 → 3.0.1

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 +34 -4
  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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gFAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAChF,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,2DAA2D;YAC3D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,qFAAqF;QACrF,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, 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;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACrC,OAAuD,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAkEpE;;;;;;;GAOG;AACH,MAAM,UAAU,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,CA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EAAE,EAAE;QACzB,kGAAkG;QAClG,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,+BAA+B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzD,CAAC;QACD,4GAA4G;QAC5G,0GAA0G;QAC1G,4GAA4G;QAC5G,wGAAwG;QACxG,mHAAmH;QACnH,MAAM,gBAAgB,GAAsB,EAAE,CAAC;QAC/C,KAAK,MAAM,CACV,mBAAmB,EACnB,eAAe,EACf,IAAI,+BAA+B,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,MAAM,CACL,OAAO,mBAAmB,IAAI,QAAQ,EACtC,KAAK,CAAC,6CAA6C,CACnD,CAAC;YACF,gFAAgF;YAChF,0FAA0F;YAC1F,kCAAkC;YAClC,IAAI,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAChF,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,2DAA2D;YAC3D,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,qFAAqF;QACrF,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, 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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"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M,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"}
package/lib/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
@@ -1 +1 @@
1
- {"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,iBAAiB,EAEjB,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,KAAK,EACX,oBAAoB,EACpB,kCAAkC,EAClC,0BAA0B,EAC1B,iBAAiB,EACjB,MAAM,0CAA0C,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEjC,IAAI,EAAE,kBAAkB,CAAC;IAGzB,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAW,OAAO,+BAEqB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,mCAAmC,wBAC1B,oBAAoB,uEAE6C,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,cAC/B,aAAa,CAAC,CAAC,4CAGgD,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,cACtB,aAAa,CAAC,CAAC,mCAE6C,CAAC;AACtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,CAW5F;AAcD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAmBnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB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CAAC,CAAC;IAC1E,SAAgB,YAAY,EAAE,MAAM,CAAC;aACrB,WAAW,IAAI,IAAI;IACnC,kBAAyB,UAAU,EAAE,OAAO,CAAC;aAC7B,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,IAAW,YAAY,IAAI,oBAAoB,CAE9C;IAED,IAAW,CAAC,iBAAiB,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAEtD;CACD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,4BAA4B,CAC3C,gBAAgB,EAAE,iBAAiB,EACnC,MAAM,EAAE,YAAY,GAClB,MAAM,GAAG,SAAS,CA2BpB"}
package/lib/legacy.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outFileLegacyAlpha legacyAlpha --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
8
+ * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outFileLegacyAlpha legacyAlpha --outDir ./lib" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
11
  export {
@@ -5,7 +5,7 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outFileLegacyAlpha legacyAlpha --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
8
+ * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outFileLegacyAlpha legacyAlpha --outDir ./lib" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
11
  export {
@@ -8,6 +8,8 @@ import { assert } from "@fluidframework/core-utils/internal";
8
8
  * @internal
9
9
  */
10
10
  export class ObjectStoragePartition {
11
+ storage;
12
+ path;
11
13
  constructor(storage, path) {
12
14
  this.storage = storage;
13
15
  this.path = path;
@@ -1 +1 @@
1
- {"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,MAAM,CAAC,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","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,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAEhB;IACA;IAFlB,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,MAAM,CAAC,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","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"]}
@@ -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.118.1";
8
+ export declare const pkgVersion = "3.0.1";
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"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/runtime-utils";
8
- export const pkgVersion = "2.118.1";
8
+ export const pkgVersion = "3.0.1";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,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.118.1\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,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.1\";\n"]}
package/lib/public.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  /*
7
7
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
8
- * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outFileLegacyAlpha legacyAlpha --outDir ./lib --node10TypeCompat" in @fluid-tools/build-cli.
8
+ * Generated by "flub generate entrypoints --outFileLegacyBeta legacy --outFileLegacyAlpha legacyAlpha --outDir ./lib" in @fluid-tools/build-cli.
9
9
  */
10
10
 
11
11
  export {
@@ -16,6 +16,11 @@ import { RuntimeHeaders } from "./utils.js";
16
16
  * @internal
17
17
  */
18
18
  export class RemoteFluidObjectHandle extends FluidHandleBase {
19
+ absolutePath;
20
+ routeContext;
21
+ payloadPending;
22
+ isAttached = true;
23
+ objectP;
19
24
  /**
20
25
  * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.
21
26
  * @param absolutePath - The absolute path to the handle from the container runtime.
@@ -27,7 +32,6 @@ export class RemoteFluidObjectHandle extends FluidHandleBase {
27
32
  this.absolutePath = absolutePath;
28
33
  this.routeContext = routeContext;
29
34
  this.payloadPending = payloadPending;
30
- this.isAttached = true;
31
35
  assert(absolutePath.startsWith("/"), 0x19d /* "Handles should always have absolute paths" */);
32
36
  }
33
37
  async get() {
@@ -1 +1 @@
1
- {"version":3,"file":"remoteFluidObjectHandle.js","sourceRoot":"","sources":["../src/remoteFluidObjectHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAA4B;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,MAAM,CACL,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,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI;oBAChC,CAAC,cAAc,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,mBAAmB,CAAC,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","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,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,eAA4B;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,MAAM,CACL,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,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI;oBAChC,CAAC,cAAc,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,mBAAmB,CAAC,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","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"]}
@@ -7,6 +7,7 @@
7
7
  * @legacy @beta
8
8
  */
9
9
  export class RequestParser {
10
+ request;
10
11
  /**
11
12
  * Splits the path of the url and decodes each path part
12
13
  * @param url - the url to get path parts of
@@ -22,6 +23,8 @@ export class RequestParser {
22
23
  }
23
24
  return pathParts;
24
25
  }
26
+ requestPathParts;
27
+ query;
25
28
  static create(request) {
26
29
  // Perf optimizations.
27
30
  if (request instanceof RequestParser) {
@@ -40,6 +43,7 @@ export class RequestParser {
40
43
  get url() {
41
44
  return this.request.url;
42
45
  }
46
+ headers;
43
47
  /**
44
48
  * Returns the decoded path parts of the request's url
45
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"requestParser.js","s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AAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\n\n/**\n * The Request Parser takes an IRequest provides parsing and sub request creation\n * @legacy @beta\n */\nexport class RequestParser implements IRequest {\n\t/**\n\t * Splits the path of the url and decodes each path part\n\t * @param url - the url to get path parts of\n\t */\n\tpublic static getPathParts(url: string): readonly string[] {\n\t\tconst queryStartIndex = url.indexOf(\"?\");\n\t\tconst pathParts: string[] = [];\n\t\tconst urlPath = url.slice(0, queryStartIndex < 0 ? url.length : queryStartIndex);\n\n\t\tfor (const part of urlPath.split(\"/\")) {\n\t\t\tif (part !== undefined && part.length > 0) {\n\t\t\t\tpathParts.push(decodeURIComponent(part));\n\t\t\t}\n\t\t}\n\n\t\treturn pathParts;\n\t}\n\n\tprivate requestPathParts: readonly string[] | undefined;\n\tpublic readonly query: string;\n\n\tpublic static create(request: Readonly<IRequest>): RequestParser {\n\t\t// Perf optimizations.\n\t\tif (request instanceof RequestParser) {\n\t\t\treturn request;\n\t\t}\n\t\treturn new RequestParser(request);\n\t}\n\n\tprotected constructor(private readonly request: Readonly<IRequest>) {\n\t\tconst queryStartIndex = this.request.url.indexOf(\"?\");\n\t\tthis.query = queryStartIndex >= 0 ? this.request.url.slice(queryStartIndex) : \"\";\n\t\tif (request.headers !== undefined) {\n\t\t\tthis.headers = request.headers;\n\t\t}\n\t}\n\n\tpublic get url(): string {\n\t\treturn this.request.url;\n\t}\n\n\tpublic readonly headers?: IRequestHeader;\n\n\t/**\n\t * Returns the decoded path parts of the request's url\n\t */\n\tpublic get pathParts(): readonly string[] {\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\tif (this.requestPathParts === undefined) {\n\t\t\tthis.requestPathParts = RequestParser.getPathParts(this.url);\n\t\t}\n\t\treturn this.requestPathParts;\n\t}\n\n\t/**\n\t * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.\n\t * @param elements - number of elements in path\n\t */\n\tpublic isLeaf(elements: number): boolean {\n\t\treturn this.query === \"\" && this.pathParts.length === elements;\n\t}\n\n\t/**\n\t * Creates a sub request starting at a specific path part of this request's url\n\t * The sub request url always has a leading slash, and always include query params if original url has any\n\t * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams\n\t * createSubRequest(1) is /b/?queryParams\n\t * createSubRequest(2) is /?queryParams\n\t * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception\n\t *\n\t * note: query params are not counted towards path parts.\n\t *\n\t * @param startingPathIndex - The index of the first path part of the sub request\n\t */\n\tpublic createSubRequest(startingPathIndex: number): IRequest {\n\t\tconst pathLen = this.pathParts.length;\n\t\tif (startingPathIndex < 0 || startingPathIndex > pathLen) {\n\t\t\tthrow new Error(\"incorrect sub-request\");\n\t\t}\n\t\tif (startingPathIndex === pathLen && this.url.includes(\"?\")) {\n\t\t\treturn {\n\t\t\t\turl: `/${this.query}`,\n\t\t\t\theaders: this.headers,\n\t\t\t};\n\t\t}\n\t\tconst path = `/${this.pathParts.slice(startingPathIndex).join(\"/\")}`;\n\t\treturn {\n\t\t\turl: this.query === \"\" ? path : `${path}/${this.query}`,\n\t\t\theaders: this.headers,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,OAAO,aAAa;IA8Bc;IA7BvC;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAC,GAAW;QACrC,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,SAAS,GAAa,EAAE,CAAC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,6HAA6H;QAC7H,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACzC,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,KAAK,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,QAAQ,CAAC;IAChE,CAAC;IAED;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAyB;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QACtC,IAAI,iBAAiB,GAAG,CAAC,IAAI,iBAAiB,GAAG,OAAO,EAAE,CAAC;YAC1D,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,iBAAiB,KAAK,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7D,OAAO;gBACN,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC;QACH,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO;YACN,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\n\n/**\n * The Request Parser takes an IRequest provides parsing and sub request creation\n * @legacy @beta\n */\nexport class RequestParser implements IRequest {\n\t/**\n\t * Splits the path of the url and decodes each path part\n\t * @param url - the url to get path parts of\n\t */\n\tpublic static getPathParts(url: string): readonly string[] {\n\t\tconst queryStartIndex = url.indexOf(\"?\");\n\t\tconst pathParts: string[] = [];\n\t\tconst urlPath = url.slice(0, queryStartIndex < 0 ? url.length : queryStartIndex);\n\n\t\tfor (const part of urlPath.split(\"/\")) {\n\t\t\tif (part !== undefined && part.length > 0) {\n\t\t\t\tpathParts.push(decodeURIComponent(part));\n\t\t\t}\n\t\t}\n\n\t\treturn pathParts;\n\t}\n\n\tprivate requestPathParts: readonly string[] | undefined;\n\tpublic readonly query: string;\n\n\tpublic static create(request: Readonly<IRequest>): RequestParser {\n\t\t// Perf optimizations.\n\t\tif (request instanceof RequestParser) {\n\t\t\treturn request;\n\t\t}\n\t\treturn new RequestParser(request);\n\t}\n\n\tprotected constructor(private readonly request: Readonly<IRequest>) {\n\t\tconst queryStartIndex = this.request.url.indexOf(\"?\");\n\t\tthis.query = queryStartIndex >= 0 ? this.request.url.slice(queryStartIndex) : \"\";\n\t\tif (request.headers !== undefined) {\n\t\t\tthis.headers = request.headers;\n\t\t}\n\t}\n\n\tpublic get url(): string {\n\t\treturn this.request.url;\n\t}\n\n\tpublic readonly headers?: IRequestHeader;\n\n\t/**\n\t * Returns the decoded path parts of the request's url\n\t */\n\tpublic get pathParts(): readonly string[] {\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\tif (this.requestPathParts === undefined) {\n\t\t\tthis.requestPathParts = RequestParser.getPathParts(this.url);\n\t\t}\n\t\treturn this.requestPathParts;\n\t}\n\n\t/**\n\t * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.\n\t * @param elements - number of elements in path\n\t */\n\tpublic isLeaf(elements: number): boolean {\n\t\treturn this.query === \"\" && this.pathParts.length === elements;\n\t}\n\n\t/**\n\t * Creates a sub request starting at a specific path part of this request's url\n\t * The sub request url always has a leading slash, and always include query params if original url has any\n\t * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams\n\t * createSubRequest(1) is /b/?queryParams\n\t * createSubRequest(2) is /?queryParams\n\t * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception\n\t *\n\t * note: query params are not counted towards path parts.\n\t *\n\t * @param startingPathIndex - The index of the first path part of the sub request\n\t */\n\tpublic createSubRequest(startingPathIndex: number): IRequest {\n\t\tconst pathLen = this.pathParts.length;\n\t\tif (startingPathIndex < 0 || startingPathIndex > pathLen) {\n\t\t\tthrow new Error(\"incorrect sub-request\");\n\t\t}\n\t\tif (startingPathIndex === pathLen && this.url.includes(\"?\")) {\n\t\t\treturn {\n\t\t\t\turl: `/${this.query}`,\n\t\t\t\theaders: this.headers,\n\t\t\t};\n\t\t}\n\t\tconst path = `/${this.pathParts.slice(startingPathIndex).join(\"/\")}`;\n\t\treturn {\n\t\t\turl: this.query === \"\" ? path : `${path}/${this.query}`,\n\t\t\theaders: this.headers,\n\t\t};\n\t}\n}\n"]}
@@ -15,6 +15,7 @@ import { UsageError } from "@fluidframework/telemetry-utils/internal";
15
15
  * @internal
16
16
  */
17
17
  export class DataStoreKindImplementation extends ErasedTypeImplementation {
18
+ factory;
18
19
  /**
19
20
  * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.
20
21
  */
@@ -29,6 +30,8 @@ export class DataStoreKindImplementation extends ErasedTypeImplementation {
29
30
  throw new Error("Invalid DataStoreKindImplementation");
30
31
  }
31
32
  }
33
+ type;
34
+ createDataStore;
32
35
  constructor(factory) {
33
36
  super();
34
37
  this.factory = factory;
@@ -64,6 +67,15 @@ export class DataStoreKindImplementation extends ErasedTypeImplementation {
64
67
  * @internal
65
68
  */
66
69
  export class ServiceContainerBase extends ErasedTypeImplementation {
70
+ registry;
71
+ options;
72
+ container;
73
+ data;
74
+ id;
75
+ /**
76
+ * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.
77
+ */
78
+ startedAttach = false;
67
79
  constructor(registry, options, container, data, id) {
68
80
  super();
69
81
  this.registry = registry;
@@ -71,10 +83,6 @@ export class ServiceContainerBase extends ErasedTypeImplementation {
71
83
  this.container = container;
72
84
  this.data = data;
73
85
  this.id = id;
74
- /**
75
- * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.
76
- */
77
- this.startedAttach = false;
78
86
  }
79
87
  /**
80
88
  * Extracts the container ID from {@link ServiceContainerBase.container}'s resolved URL after attachment.
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClientBase.js","sourceRoot":"","sources":["../src/serviceClientBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAmB,MAAM,gDAAgD,CAAC;AAE9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAMN,gBAAgB,GAChB,MAAM,6CAA6C,CAAC;AAOrD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;GAEG;AAEH;;;GAGG;AACH,MAAM,OAAO,2BACZ,SAAQ,wBAA0C;IAGlD;;OAEG;IACI,MAAM,CAAC,KAAK,CAClB,KAAQ;QAER,OAAO,KAAK,YAAY,2BAA2B,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,aAAa,CAC1B,KAAQ;QAKR,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAOD,YACkB,OAGhB;QAED,KAAK,EAAE,CAAC;QALS,YAAO,GAAP,OAAO,CAGvB;QAGD,IAAI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AC;IAC1B,CAAC;IAEM,KAAK;QACX,uFAAuF;QACvF,yFAAyF;QACzF,0CAA0C;QAC1C,kFAAkF;QAClF,2FAA2F;QAC3F,yEAAyE;QACzE,8FAA8F;QAC9F,+FAA+F;QAC/F,8FAA8F;QAC9F,+FAA+F;QAC/F,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,eAAe,CAAI,GAAoB;QACnD,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACxD,2BAA2B,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAE3C,+EAA+E;QAC/E,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;QACpD,wEAAwE;QACxE,4EAA4E;QAC5E,OAAO,UAAe,CAAC;IACxB,CAAC;CACD;AAeD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiC;IACrE,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IAudience } from \"@fluidframework/container-definitions\";\nimport { AttachState, type IContainer } from \"@fluidframework/container-definitions/internal\";\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { ErasedTypeImplementation } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype DataStoreKey,\n\ttype DataStoreKind,\n\ttype FluidContainerAttached,\n\ttype FluidContainerWithService,\n\ttype Registry,\n\tlookupInRegistry,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/*\n * This file provides common implementation logic for ServiceClient implementations.\n */\n\n/**\n * Implementation of `DataStoreKind`.\n * @internal\n */\nexport class DataStoreKindImplementation<T>\n\textends ErasedTypeImplementation<DataStoreKind<T>>\n\timplements DataStoreKind<T>, IFluidDataStoreFactory\n{\n\t/**\n\t * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.\n\t */\n\tpublic static guard<T>(\n\t\tvalue: T,\n\t): value is DataStoreKindImplementation<T extends DataStoreKind<infer T2> ? T2 : never> & T {\n\t\treturn value instanceof DataStoreKindImplementation;\n\t}\n\n\t/**\n\t * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.\n\t */\n\tpublic static narrowGeneric<T>(\n\t\tvalue: T,\n\t): asserts value is DataStoreKindImplementation<\n\t\tT extends DataStoreKind<infer T2> ? T2 : never\n\t> &\n\t\tT {\n\t\tif (!DataStoreKindImplementation.guard(value)) {\n\t\t\tthrow new Error(\"Invalid DataStoreKindImplementation\");\n\t\t}\n\t}\n\n\tpublic readonly type: string;\n\tpublic readonly createDataStore?: (context: IFluidDataStoreContext) => {\n\t\treadonly runtime: IFluidDataStoreChannel;\n\t};\n\n\tpublic constructor(\n\t\tprivate readonly factory: Pick<\n\t\t\tDataStoreKindImplementation<T>,\n\t\t\t\"type\" | \"instantiateDataStore\" | \"createDataStore\"\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.type = factory.type;\n\t\tif (factory.createDataStore !== undefined) {\n\t\t\tthis.createDataStore = factory.createDataStore.bind(factory);\n\t\t}\n\t}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\treturn this.factory.instantiateDataStore(context, existing);\n\t}\n\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic async adapt(value: Promise<DataStoreKind>): Promise<DataStoreKind<T>> {\n\t\tconst input = await value;\n\t\tif (input === this) {\n\t\t\treturn this;\n\t\t}\n\t\tif (input.type === this.type) {\n\t\t\tthrow new UsageError(`Conflicting DataStoreKinds with same type: ${this.type}`);\n\t\t}\n\t\tthrow new UsageError(\n\t\t\t`Mismatched DataStoreKind type. Expected: ${this.type}, got: ${input.type}`,\n\t\t);\n\t}\n}\n\n/**\n * Shared base class for all `ServiceClient` container implementations.\n *\n * @remarks\n * Extends `ErasedTypeImplementation` so that\n * {@link getContainerAudience} can narrow via `ServiceContainerBase.narrow()`.\n *\n * @internal\n */\nexport abstract class ServiceContainerBase<TData, TOptions = unknown>\n\textends ErasedTypeImplementation<FluidContainerWithService<TData>>\n\timplements FluidContainerWithService<TData>\n{\n\t/**\n\t * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.\n\t */\n\tprivate startedAttach = false;\n\n\tprotected constructor(\n\t\tpublic readonly registry: Registry<Promise<DataStoreKind<TData>>>,\n\t\tpublic readonly options: TOptions,\n\t\tpublic readonly container: IContainer,\n\t\tpublic readonly data: TData,\n\t\tpublic id: string | undefined,\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Creates the service-specific request used to attach this container.\n\t * @remarks\n\t * Called by {@link ServiceContainerBase.attach} after validating that no attach is already in progress.\n\t */\n\tprotected abstract createAttachRequest(): IRequest;\n\n\t/**\n\t * Extracts the container ID from {@link ServiceContainerBase.container}'s resolved URL after attachment.\n\t * @remarks\n\t * Override when the service's resolved URL stores the id in a non-standard field.\n\t */\n\tprotected getContainerId(): string {\n\t\tif (this.container.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Resolved URL unexpectedly missing!\");\n\t\t}\n\t\treturn this.container.resolvedUrl.id;\n\t}\n\n\tpublic async attach(): Promise<FluidContainerAttached<TData>> {\n\t\tif (this.id !== undefined) {\n\t\t\tthrow new UsageError(\"Container already attached\");\n\t\t}\n\t\tif (this.startedAttach) {\n\t\t\tthrow new UsageError(\"Container attach already in progress\");\n\t\t}\n\n\t\tassert(\n\t\t\tthis.container.attachState === AttachState.Detached,\n\t\t\t0xd15 /* Container not detached */,\n\t\t);\n\t\tthis.startedAttach = true;\n\n\t\t// TODO: support setting where attach can fail, and leave the container in a valid (non-closed) state.\n\t\t// Likely the best way to support this is by adding a `tryAttach(request): Promise<FluidContainerAttached<TData> | undefined>`.\n\n\t\tawait this.container.attach(this.createAttachRequest());\n\t\t// This type cast is needed to work around the fact that TypeScript assumes the \"attach\" methods can't modify \"attachState\".\n\t\tassert(\n\t\t\tthis.container.attachState === (AttachState.Attached as AttachState),\n\t\t\t0xd16 /* Container failed to attach */,\n\t\t);\n\t\tthis.id = this.getContainerId();\n\t\treturn this as typeof this & { id: string };\n\t}\n\n\tpublic get audience(): IAudience {\n\t\treturn this.container.audience;\n\t}\n\n\tpublic getRuntime(): IContainerRuntimeBase {\n\t\t// The runtime is not part of the public IContainer surface, so it is reached via a structural cast.\n\t\t// This relies on an implementation detail of the containers produced by the loader\n\t\t// (createDetachedContainer / loadExistingContainer): they carry a `runtime` property.\n\t\t// The undefined guard below turns an incompatible container implementation into a clear error\n\t\t// instead of a confusing failure later when the missing runtime is used.\n\t\t// This is extra risky since IContainer is not marked sealed.\n\t\t// TODO: Replace this with a supported, type-safe accessor once the loader exposes one.\n\t\tinterface IContainerWithRuntime extends IContainer {\n\t\t\treadonly runtime?: IContainerRuntimeBase;\n\t\t}\n\n\t\tconst container = this.container as IContainerWithRuntime;\n\t\tif (container.runtime === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Container does not expose a runtime: incompatible container implementation.\",\n\t\t\t);\n\t\t}\n\t\treturn container.runtime;\n\t}\n\n\tpublic close(): void {\n\t\t// TODO: `container.close()` cancels the container runtime's GC timers, but a couple of\n\t\t// container-level timers are only bounded `setTimeout`s that survive close (they are not\n\t\t// cancelled here, nor even on `dispose`):\n\t\t// - The container-loader `NoopHeuristic` timer (~2s), which has no disposal hook.\n\t\t// - The container-runtime `SummaryManager` \"delay before creating summarizer\" timer, whose\n\t\t// pending timeout is not cleared when the SummaryManager is torn down.\n\t\t// These self-expire, so they do not cause indefinite hangs, but until they fire they keep the\n\t\t// Node.js event loop alive, delaying a clean process exit after close. That is a common reason\n\t\t// tests resort to Mocha's `--exit` flag. Ideally close() (via the runtime's close path) would\n\t\t// cancel these too so that closing a single container is sufficient to release all its timers.\n\t\tthis.container.close();\n\t}\n\n\tpublic async createDataStore<T>(key: DataStoreKey<T>): Promise<T> {\n\t\tconst kind = await lookupInRegistry(this.registry, key);\n\t\tDataStoreKindImplementation.narrowGeneric(kind);\n\t\tconst containerRuntime = this.getRuntime();\n\n\t\t// TODO: There should probably be a higher level more type safe way to do this.\n\t\tconst context = containerRuntime.createDetachedDataStore([kind.type]);\n\t\tconst channel = await kind.instantiateDataStore(context, false);\n\t\tconst dataStore = await context.attachRuntime(kind, channel);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\t// The data store's entry point type is erased at the registry boundary;\n\t\t// the DataStoreKind<T> used to create it guarantees the entry point is a T.\n\t\treturn entryPoint as T;\n\t}\n}\n\n/**\n * All clients connected to the op stream, both read-only and read/write.\n * @remarks\n * Currently just {@link @fluidframework/container-definitions#IAudience}, but may diverge before stabilizing.\n * @privateRemarks\n * This is currently just an alias for IAudience, but it is defined separately to allow for:\n * 1. Following the no I prefix naming convention.\n * 2. The possibility of diverging from IAudience in the future if desired.\n * 3. Make it easy for the reexport from fluid-framework to be `@alpha` so the name is not locked down prematurely.\n * @sealed @alpha\n */\nexport type Audience = IAudience;\n\n/**\n * Gets the {@link Audience} from a Fluid container\n * created by any {@link @fluidframework/driver-definitions#ServiceClient}.\n * @privateRemarks\n * This is exposed via a free function rather than as a property of FluidContainerAttached\n * for a few minor reasons:\n * 1. This allows stabilizing the FluidContainerAttached API independently committing to how we want to expose the audience.\n * 2. This demonstrates the pattern of how we can have possible less stable APIs to expose service specific features without them being part of the core FluidContainer API.\n * This will be important for both new feature stabilization, and also exposing anything needed for legacy interop.\n * @alpha\n */\nexport function getContainerAudience(container: FluidContainerAttached): Audience {\n\tServiceContainerBase.narrow(container);\n\treturn container.audience;\n}\n"]}
1
+ {"version":3,"file":"serviceClientBase.js","sourceRoot":"","sources":["../src/serviceClientBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAmB,MAAM,gDAAgD,CAAC;AAE9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAMN,gBAAgB,GAChB,MAAM,6CAA6C,CAAC;AAOrD,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE;;GAEG;AAEH;;;GAGG;AACH,MAAM,OAAO,2BACZ,SAAQ,wBAA0C;IAgChC;IA7BlB;;OAEG;IACI,MAAM,CAAC,KAAK,CAClB,KAAQ;QAER,OAAO,KAAK,YAAY,2BAA2B,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,aAAa,CAC1B,KAAQ;QAKR,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAEe,IAAI,CAAS;IACb,eAAe,CAE7B;IAEF,YACkB,OAGhB;QAED,K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IAAI,KAAK,CACd,6EAA6E,CAC7E,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC,OAAO,CAAC;IAC1B,CAAC;IAEM,KAAK;QACX,uFAAuF;QACvF,yFAAyF;QACzF,0CAA0C;QAC1C,kFAAkF;QAClF,2FAA2F;QAC3F,yEAAyE;QACzE,8FAA8F;QAC9F,+FAA+F;QAC/F,8FAA8F;QAC9F,+FAA+F;QAC/F,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,eAAe,CAAI,GAAoB;QACnD,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACxD,2BAA2B,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAE3C,+EAA+E;QAC/E,MAAM,OAAO,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAChE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7D,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC;QACpD,wEAAwE;QACxE,4EAA4E;QAC5E,OAAO,UAAe,CAAC;IACxB,CAAC;CACD;AAeD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAAiC;IACrE,oBAAoB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACvC,OAAO,SAAS,CAAC,QAAQ,CAAC;AAC3B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IAudience } from \"@fluidframework/container-definitions\";\nimport { AttachState, type IContainer } from \"@fluidframework/container-definitions/internal\";\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { ErasedTypeImplementation } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype DataStoreKey,\n\ttype DataStoreKind,\n\ttype FluidContainerAttached,\n\ttype FluidContainerWithService,\n\ttype Registry,\n\tlookupInRegistry,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tIContainerRuntimeBase,\n\tIFluidDataStoreChannel,\n\tIFluidDataStoreContext,\n\tIFluidDataStoreFactory,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/*\n * This file provides common implementation logic for ServiceClient implementations.\n */\n\n/**\n * Implementation of `DataStoreKind`.\n * @internal\n */\nexport class DataStoreKindImplementation<T>\n\textends ErasedTypeImplementation<DataStoreKind<T>>\n\timplements DataStoreKind<T>, IFluidDataStoreFactory\n{\n\t/**\n\t * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.\n\t */\n\tpublic static guard<T>(\n\t\tvalue: T,\n\t): value is DataStoreKindImplementation<T extends DataStoreKind<infer T2> ? T2 : never> & T {\n\t\treturn value instanceof DataStoreKindImplementation;\n\t}\n\n\t/**\n\t * Type guard for narrowing unions which contain DataStoreKind<T> to DataStoreKind<T>.\n\t */\n\tpublic static narrowGeneric<T>(\n\t\tvalue: T,\n\t): asserts value is DataStoreKindImplementation<\n\t\tT extends DataStoreKind<infer T2> ? T2 : never\n\t> &\n\t\tT {\n\t\tif (!DataStoreKindImplementation.guard(value)) {\n\t\t\tthrow new Error(\"Invalid DataStoreKindImplementation\");\n\t\t}\n\t}\n\n\tpublic readonly type: string;\n\tpublic readonly createDataStore?: (context: IFluidDataStoreContext) => {\n\t\treadonly runtime: IFluidDataStoreChannel;\n\t};\n\n\tpublic constructor(\n\t\tprivate readonly factory: Pick<\n\t\t\tDataStoreKindImplementation<T>,\n\t\t\t\"type\" | \"instantiateDataStore\" | \"createDataStore\"\n\t\t>,\n\t) {\n\t\tsuper();\n\t\tthis.type = factory.type;\n\t\tif (factory.createDataStore !== undefined) {\n\t\t\tthis.createDataStore = factory.createDataStore.bind(factory);\n\t\t}\n\t}\n\n\tpublic async instantiateDataStore(\n\t\tcontext: IFluidDataStoreContext,\n\t\texisting: boolean,\n\t): Promise<IFluidDataStoreChannel> {\n\t\treturn this.factory.instantiateDataStore(context, existing);\n\t}\n\n\tpublic get IFluidDataStoreFactory(): IFluidDataStoreFactory {\n\t\treturn this;\n\t}\n\n\tpublic async adapt(value: Promise<DataStoreKind>): Promise<DataStoreKind<T>> {\n\t\tconst input = await value;\n\t\tif (input === this) {\n\t\t\treturn this;\n\t\t}\n\t\tif (input.type === this.type) {\n\t\t\tthrow new UsageError(`Conflicting DataStoreKinds with same type: ${this.type}`);\n\t\t}\n\t\tthrow new UsageError(\n\t\t\t`Mismatched DataStoreKind type. Expected: ${this.type}, got: ${input.type}`,\n\t\t);\n\t}\n}\n\n/**\n * Shared base class for all `ServiceClient` container implementations.\n *\n * @remarks\n * Extends `ErasedTypeImplementation` so that\n * {@link getContainerAudience} can narrow via `ServiceContainerBase.narrow()`.\n *\n * @internal\n */\nexport abstract class ServiceContainerBase<TData, TOptions = unknown>\n\textends ErasedTypeImplementation<FluidContainerWithService<TData>>\n\timplements FluidContainerWithService<TData>\n{\n\t/**\n\t * True if an attempt to attach has been started. This is used to prevent multiple concurrent attach attempts.\n\t */\n\tprivate startedAttach = false;\n\n\tprotected constructor(\n\t\tpublic readonly registry: Registry<Promise<DataStoreKind<TData>>>,\n\t\tpublic readonly options: TOptions,\n\t\tpublic readonly container: IContainer,\n\t\tpublic readonly data: TData,\n\t\tpublic id: string | undefined,\n\t) {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Creates the service-specific request used to attach this container.\n\t * @remarks\n\t * Called by {@link ServiceContainerBase.attach} after validating that no attach is already in progress.\n\t */\n\tprotected abstract createAttachRequest(): IRequest;\n\n\t/**\n\t * Extracts the container ID from {@link ServiceContainerBase.container}'s resolved URL after attachment.\n\t * @remarks\n\t * Override when the service's resolved URL stores the id in a non-standard field.\n\t */\n\tprotected getContainerId(): string {\n\t\tif (this.container.resolvedUrl === undefined) {\n\t\t\tthrow new Error(\"Resolved URL unexpectedly missing!\");\n\t\t}\n\t\treturn this.container.resolvedUrl.id;\n\t}\n\n\tpublic async attach(): Promise<FluidContainerAttached<TData>> {\n\t\tif (this.id !== undefined) {\n\t\t\tthrow new UsageError(\"Container already attached\");\n\t\t}\n\t\tif (this.startedAttach) {\n\t\t\tthrow new UsageError(\"Container attach already in progress\");\n\t\t}\n\n\t\tassert(\n\t\t\tthis.container.attachState === AttachState.Detached,\n\t\t\t0xd15 /* Container not detached */,\n\t\t);\n\t\tthis.startedAttach = true;\n\n\t\t// TODO: support setting where attach can fail, and leave the container in a valid (non-closed) state.\n\t\t// Likely the best way to support this is by adding a `tryAttach(request): Promise<FluidContainerAttached<TData> | undefined>`.\n\n\t\tawait this.container.attach(this.createAttachRequest());\n\t\t// This type cast is needed to work around the fact that TypeScript assumes the \"attach\" methods can't modify \"attachState\".\n\t\tassert(\n\t\t\tthis.container.attachState === (AttachState.Attached as AttachState),\n\t\t\t0xd16 /* Container failed to attach */,\n\t\t);\n\t\tthis.id = this.getContainerId();\n\t\treturn this as typeof this & { id: string };\n\t}\n\n\tpublic get audience(): IAudience {\n\t\treturn this.container.audience;\n\t}\n\n\tpublic getRuntime(): IContainerRuntimeBase {\n\t\t// The runtime is not part of the public IContainer surface, so it is reached via a structural cast.\n\t\t// This relies on an implementation detail of the containers produced by the loader\n\t\t// (createDetachedContainer / loadExistingContainer): they carry a `runtime` property.\n\t\t// The undefined guard below turns an incompatible container implementation into a clear error\n\t\t// instead of a confusing failure later when the missing runtime is used.\n\t\t// This is extra risky since IContainer is not marked sealed.\n\t\t// TODO: Replace this with a supported, type-safe accessor once the loader exposes one.\n\t\tinterface IContainerWithRuntime extends IContainer {\n\t\t\treadonly runtime?: IContainerRuntimeBase;\n\t\t}\n\n\t\tconst container = this.container as IContainerWithRuntime;\n\t\tif (container.runtime === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Container does not expose a runtime: incompatible container implementation.\",\n\t\t\t);\n\t\t}\n\t\treturn container.runtime;\n\t}\n\n\tpublic close(): void {\n\t\t// TODO: `container.close()` cancels the container runtime's GC timers, but a couple of\n\t\t// container-level timers are only bounded `setTimeout`s that survive close (they are not\n\t\t// cancelled here, nor even on `dispose`):\n\t\t// - The container-loader `NoopHeuristic` timer (~2s), which has no disposal hook.\n\t\t// - The container-runtime `SummaryManager` \"delay before creating summarizer\" timer, whose\n\t\t// pending timeout is not cleared when the SummaryManager is torn down.\n\t\t// These self-expire, so they do not cause indefinite hangs, but until they fire they keep the\n\t\t// Node.js event loop alive, delaying a clean process exit after close. That is a common reason\n\t\t// tests resort to Mocha's `--exit` flag. Ideally close() (via the runtime's close path) would\n\t\t// cancel these too so that closing a single container is sufficient to release all its timers.\n\t\tthis.container.close();\n\t}\n\n\tpublic async createDataStore<T>(key: DataStoreKey<T>): Promise<T> {\n\t\tconst kind = await lookupInRegistry(this.registry, key);\n\t\tDataStoreKindImplementation.narrowGeneric(kind);\n\t\tconst containerRuntime = this.getRuntime();\n\n\t\t// TODO: There should probably be a higher level more type safe way to do this.\n\t\tconst context = containerRuntime.createDetachedDataStore([kind.type]);\n\t\tconst channel = await kind.instantiateDataStore(context, false);\n\t\tconst dataStore = await context.attachRuntime(kind, channel);\n\t\tconst entryPoint = await dataStore.entryPoint.get();\n\t\t// The data store's entry point type is erased at the registry boundary;\n\t\t// the DataStoreKind<T> used to create it guarantees the entry point is a T.\n\t\treturn entryPoint as T;\n\t}\n}\n\n/**\n * All clients connected to the op stream, both read-only and read/write.\n * @remarks\n * Currently just {@link @fluidframework/container-definitions#IAudience}, but may diverge before stabilizing.\n * @privateRemarks\n * This is currently just an alias for IAudience, but it is defined separately to allow for:\n * 1. Following the no I prefix naming convention.\n * 2. The possibility of diverging from IAudience in the future if desired.\n * 3. Make it easy for the reexport from fluid-framework to be `@alpha` so the name is not locked down prematurely.\n * @sealed @alpha\n */\nexport type Audience = IAudience;\n\n/**\n * Gets the {@link Audience} from a Fluid container\n * created by any {@link @fluidframework/driver-definitions#ServiceClient}.\n * @privateRemarks\n * This is exposed via a free function rather than as a property of FluidContainerAttached\n * for a few minor reasons:\n * 1. This allows stabilizing the FluidContainerAttached API independently committing to how we want to expose the audience.\n * 2. This demonstrates the pattern of how we can have possible less stable APIs to expose service specific features without them being part of the core FluidContainer API.\n * This will be important for both new feature stabilization, and also exposing anything needed for legacy interop.\n * @alpha\n */\nexport function getContainerAudience(container: FluidContainerAttached): Audience {\n\tServiceContainerBase.narrow(container);\n\treturn container.audience;\n}\n"]}
@@ -100,6 +100,8 @@ export function makeCodeLoader(registry, minVersionForCollab, loadRuntime, root)
100
100
  * @internal
101
101
  */
102
102
  export class ServiceClientImplementation {
103
+ options;
104
+ statics;
103
105
  constructor(options, statics) {
104
106
  this.options = options;
105
107
  this.statics = statics;
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClientUtils.js","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EAOtB,gBAAgB,GAEhB,MAAM,6CAA6C,CAAC;AAQrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAI,QAA8B;IAChE,OAAO;QACN,KAAK,CAAC,GAAG,CAAC,IAAY;YACrB,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,CA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,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,EAAU,EACV,IAA4D;QAE5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACrE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tICodeDetailsLoader,\n\tIContainerContext,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIFluidModuleWithDetails,\n\tIRuntime,\n\tIRuntimeFactory,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tcreateBasicRegistryKey,\n\ttype DataStoreKey,\n\ttype DataStoreKind,\n\ttype DataStoreRegistry,\n\ttype FluidContainerAttached,\n\ttype FluidContainerWithService,\n\ttype Registry,\n\tlookupInRegistry,\n\ttype ServiceClient,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tFluidDataStoreRegistryEntry,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreRegistry,\n\tOldestSupportedClientVersion,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { DataStoreKindImplementation } from \"./serviceClientBase.js\";\n\n/**\n * The constant ID used for the root data store alias in service containers.\n * @internal\n */\nexport const rootDataStoreId = \"root\";\n\n/**\n * Converts a `DataStoreRegistry` to the `IFluidDataStoreRegistry` interface expected by the container runtime.\n * @remarks\n * This does not leverage the ability for `IFluidDataStoreRegistry.get` to return undefined.\n * Note that all use-cases of `IFluidDataStoreRegistry.get` returning undefined currently end up as a fatal error.\n * Therefore it should be fine for the error to instead be thrown by the registry function, which is what this function does.\n * @internal\n */\nexport function convertRegistry<T>(registry: DataStoreRegistry<T>): IFluidDataStoreRegistry {\n\treturn {\n\t\tasync get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\t\tconst dataStoreKind = await lookupInRegistry(registry, createBasicRegistryKey(name));\n\t\t\tDataStoreKindImplementation.narrowGeneric(dataStoreKind);\n\t\t\treturn dataStoreKind;\n\t\t},\n\t\tget IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\t\treturn this;\n\t\t},\n\t};\n}\n\n/**\n * Normalizes a `DataStoreKind` or registry function into a registry function.\n * @internal\n */\nexport function normalizeRegistry<T>(\n\tinput: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,\n): Registry<Promise<DataStoreKind<T>>> {\n\tif (DataStoreKindImplementation.guard(input)) {\n\t\treturn async () => input;\n\t}\n\tassert(typeof input === \"function\", 0xd17 /* Registry must be a function */);\n\treturn input;\n}\n\n/**\n * Parameters passed to a {@link ContainerRuntimeLoader}.\n * @internal\n */\nexport interface ContainerRuntimeLoaderParams {\n\tcontext: IContainerContext;\n\tregistry: IFluidDataStoreRegistry;\n\tprovideEntryPoint: (runtime: IContainerRuntimeBase) => Promise<FluidObject>;\n\texisting: boolean;\n\tminVersionForCollab: OldestSupportedClientVersion;\n\t/**\n\t * The type string of the root data store to create. Only set when `existing` is false.\n\t */\n\tnewContainerRootType: string | undefined;\n}\n\n/**\n * A service-specific callback that creates or loads the container runtime.\n *\n * @remarks\n * Receives the runtime parameters assembled by {@link makeCodeLoader} and is responsible for\n * calling the concrete runtime factory (e.g. `ContainerRuntime.loadRuntime2`) and, when\n * `existing` is `false`, initializing the root data store before returning.\n *\n * @internal\n */\nexport type ContainerRuntimeLoader = (\n\tparameters: ContainerRuntimeLoaderParams,\n) => Promise<IRuntime>;\n\n/**\n * Creates an `ICodeDetailsLoader` that wires up the container runtime via the supplied\n * `loadRuntime` callback.\n *\n * @remarks\n * The `loadRuntime` callback is responsible for invoking the concrete runtime factory and,\n * when `parameters.existing` is `false` and `parameters.newContainerRootType` is set, creating and\n * aliasing the root data store.\n *\n * This loader never does any code loading, and always assumes it is compatible.\n * TODO: We should reevaluate this before promoting ServiceClient APIs to beta.\n *\n * @internal\n */\nexport function makeCodeLoader<T>(\n\tregistry: DataStoreRegistry<T>,\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tloadRuntime: ContainerRuntimeLoader,\n\troot?: DataStoreKind<T>,\n): ICodeDetailsLoader {\n\tconst fluidExport: IRuntimeFactory & IFluidCodeDetailsComparer = {\n\t\tasync instantiateRuntime(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime> {\n\t\t\tconst provideEntryPoint = async (\n\t\t\t\tentryPointRuntime: IContainerRuntimeBase,\n\t\t\t): Promise<T & FluidObject> => {\n\t\t\t\tconst data = await entryPointRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\t\tif (data === undefined) {\n\t\t\t\t\tthrow new Error(\"Root data store missing!\");\n\t\t\t\t}\n\t\t\t\tconst rootDataStore = await data.get();\n\t\t\t\treturn rootDataStore as T & FluidObject;\n\t\t\t};\n\n\t\t\treturn loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistry: convertRegistry(registry),\n\t\t\t\tprovideEntryPoint,\n\t\t\t\texisting,\n\t\t\t\tminVersionForCollab,\n\t\t\t\tnewContainerRootType: root?.type,\n\t\t\t});\n\t\t},\n\n\t\tasync satisfies(\n\t\t\tcandidate: IFluidCodeDetails,\n\t\t\tconstraint: IFluidCodeDetails,\n\t\t): Promise<boolean> {\n\t\t\treturn true;\n\t\t},\n\n\t\tasync compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined> {\n\t\t\treturn 0;\n\t\t},\n\n\t\tget IRuntimeFactory(): IRuntimeFactory {\n\t\t\treturn fluidExport;\n\t\t},\n\n\t\tget IFluidCodeDetailsComparer(): IFluidCodeDetailsComparer {\n\t\t\treturn fluidExport;\n\t\t},\n\t};\n\n\treturn {\n\t\tload: async (details: IFluidCodeDetails): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn { module: { fluidExport }, details };\n\t\t},\n\t};\n}\n\n/**\n * Minimal interface for the static container factory methods used by {@link ServiceClientImplementation}.\n * @internal\n */\nexport interface ServiceContainerStatics<TOptions> {\n\tcreateDetached<T>(\n\t\tregistry: DataStoreRegistry<T>,\n\t\toptions: TOptions,\n\t\troot: DataStoreKind<T>,\n\t): Promise<FluidContainerWithService<T>>;\n\n\tload<T>(\n\t\tregistry: DataStoreRegistry<T>,\n\t\toptions: TOptions,\n\t\tid: string,\n\t): Promise<FluidContainerAttached<T>>;\n}\n\n/**\n * Creates a {@link @fluidframework/driver-definitions#ServiceClient} that delegates container\n * creation and loading to the supplied container class statics.\n * @internal\n */\nexport class ServiceClientImplementation<TOptions> implements ServiceClient {\n\tpublic constructor(\n\t\tprivate readonly options: TOptions,\n\t\tprivate readonly statics: ServiceContainerStatics<TOptions>,\n\t) {}\n\n\t// This implements the ServiceClient interface's safer version of this with overloads.\n\t// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.\n\tpublic async createContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerWithService<T>> {\n\t\tif (registry === undefined) {\n\t\t\tDataStoreKindImplementation.narrowGeneric(root);\n\t\t\treturn this.statics.createDetached(normalizeRegistry(root), this.options, root);\n\t\t} else {\n\t\t\tconst result = await lookupInRegistry(registry, root);\n\t\t\treturn this.statics.createDetached(registry, this.options, result);\n\t\t}\n\t}\n\n\tpublic async createAttachedContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\tconst container = await this.createContainer(root, registry);\n\t\treturn container.attach();\n\t}\n\n\tpublic async loadContainer<T>(\n\t\tid: string,\n\t\troot: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\treturn this.statics.load(normalizeRegistry(root), this.options, id);\n\t}\n}\n"]}
1
+ {"version":3,"file":"serviceClientUtils.js","sourceRoot":"","sources":["../src/serviceClientUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EACN,sBAAsB,EAOtB,gBAAgB,GAEhB,MAAM,6CAA6C,CAAC;AAQrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAI,QAA8B;IAChE,OAAO;QACN,KAAK,CAAC,GAAG,CAAC,IAAY;YACrB,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC;YACrF,2BAA2B,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YACzD,OAAO,aAAa,CAAC;QACtB,CAAC;QACD,IAAI,uBAAuB;YAC1B,OAAO,IAAI,CAAC;QACb,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAChC,KAA6D;IAE7D,IAAI,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC;IAC1B,CAAC;IACD,MAAM,CAAC,OAAO,KAAK,KAAK,UAAU,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC7E,OAAO,KAAK,CAAC;AACd,CAAC;AAgCD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC7B,QAA8B,EAC9B,mBAAiD,EACjD,WAAmC,EACnC,IAAuB;IAEvB,MAAM,WAAW,GAAgD;QAChE,KAAK,CAAC,kBAAkB,CAC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KAAK,CAAC,eAAe,CAC3B,IAAwC,EACxC,QAA8C;QAE9C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,2BAA2B,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACjF,CAAC;aAAM,CAAC;YACP,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACtD,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;IAEM,KAAK,CAAC,uBAAuB,CACnC,IAAwC,EACxC,QAA8C;QAE9C,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC,MAAM,EAAE,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,EAAU,EACV,IAA4D;QAE5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACrE,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tICodeDetailsLoader,\n\tIContainerContext,\n\tIFluidCodeDetails,\n\tIFluidCodeDetailsComparer,\n\tIFluidModuleWithDetails,\n\tIRuntime,\n\tIRuntimeFactory,\n} from \"@fluidframework/container-definitions/internal\";\nimport type { FluidObject } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tcreateBasicRegistryKey,\n\ttype DataStoreKey,\n\ttype DataStoreKind,\n\ttype DataStoreRegistry,\n\ttype FluidContainerAttached,\n\ttype FluidContainerWithService,\n\ttype Registry,\n\tlookupInRegistry,\n\ttype ServiceClient,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tFluidDataStoreRegistryEntry,\n\tIContainerRuntimeBase,\n\tIFluidDataStoreRegistry,\n\tOldestSupportedClientVersion,\n} from \"@fluidframework/runtime-definitions/internal\";\n\nimport { DataStoreKindImplementation } from \"./serviceClientBase.js\";\n\n/**\n * The constant ID used for the root data store alias in service containers.\n * @internal\n */\nexport const rootDataStoreId = \"root\";\n\n/**\n * Converts a `DataStoreRegistry` to the `IFluidDataStoreRegistry` interface expected by the container runtime.\n * @remarks\n * This does not leverage the ability for `IFluidDataStoreRegistry.get` to return undefined.\n * Note that all use-cases of `IFluidDataStoreRegistry.get` returning undefined currently end up as a fatal error.\n * Therefore it should be fine for the error to instead be thrown by the registry function, which is what this function does.\n * @internal\n */\nexport function convertRegistry<T>(registry: DataStoreRegistry<T>): IFluidDataStoreRegistry {\n\treturn {\n\t\tasync get(name: string): Promise<FluidDataStoreRegistryEntry | undefined> {\n\t\t\tconst dataStoreKind = await lookupInRegistry(registry, createBasicRegistryKey(name));\n\t\t\tDataStoreKindImplementation.narrowGeneric(dataStoreKind);\n\t\t\treturn dataStoreKind;\n\t\t},\n\t\tget IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\t\treturn this;\n\t\t},\n\t};\n}\n\n/**\n * Normalizes a `DataStoreKind` or registry function into a registry function.\n * @internal\n */\nexport function normalizeRegistry<T>(\n\tinput: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,\n): Registry<Promise<DataStoreKind<T>>> {\n\tif (DataStoreKindImplementation.guard(input)) {\n\t\treturn async () => input;\n\t}\n\tassert(typeof input === \"function\", 0xd17 /* Registry must be a function */);\n\treturn input;\n}\n\n/**\n * Parameters passed to a {@link ContainerRuntimeLoader}.\n * @internal\n */\nexport interface ContainerRuntimeLoaderParams {\n\tcontext: IContainerContext;\n\tregistry: IFluidDataStoreRegistry;\n\tprovideEntryPoint: (runtime: IContainerRuntimeBase) => Promise<FluidObject>;\n\texisting: boolean;\n\tminVersionForCollab: OldestSupportedClientVersion;\n\t/**\n\t * The type string of the root data store to create. Only set when `existing` is false.\n\t */\n\tnewContainerRootType: string | undefined;\n}\n\n/**\n * A service-specific callback that creates or loads the container runtime.\n *\n * @remarks\n * Receives the runtime parameters assembled by {@link makeCodeLoader} and is responsible for\n * calling the concrete runtime factory (e.g. `ContainerRuntime.loadRuntime2`) and, when\n * `existing` is `false`, initializing the root data store before returning.\n *\n * @internal\n */\nexport type ContainerRuntimeLoader = (\n\tparameters: ContainerRuntimeLoaderParams,\n) => Promise<IRuntime>;\n\n/**\n * Creates an `ICodeDetailsLoader` that wires up the container runtime via the supplied\n * `loadRuntime` callback.\n *\n * @remarks\n * The `loadRuntime` callback is responsible for invoking the concrete runtime factory and,\n * when `parameters.existing` is `false` and `parameters.newContainerRootType` is set, creating and\n * aliasing the root data store.\n *\n * This loader never does any code loading, and always assumes it is compatible.\n * TODO: We should reevaluate this before promoting ServiceClient APIs to beta.\n *\n * @internal\n */\nexport function makeCodeLoader<T>(\n\tregistry: DataStoreRegistry<T>,\n\tminVersionForCollab: OldestSupportedClientVersion,\n\tloadRuntime: ContainerRuntimeLoader,\n\troot?: DataStoreKind<T>,\n): ICodeDetailsLoader {\n\tconst fluidExport: IRuntimeFactory & IFluidCodeDetailsComparer = {\n\t\tasync instantiateRuntime(\n\t\t\tcontext: IContainerContext,\n\t\t\texisting: boolean,\n\t\t): Promise<IRuntime> {\n\t\t\tconst provideEntryPoint = async (\n\t\t\t\tentryPointRuntime: IContainerRuntimeBase,\n\t\t\t): Promise<T & FluidObject> => {\n\t\t\t\tconst data = await entryPointRuntime.getAliasedDataStoreEntryPoint(rootDataStoreId);\n\t\t\t\tif (data === undefined) {\n\t\t\t\t\tthrow new Error(\"Root data store missing!\");\n\t\t\t\t}\n\t\t\t\tconst rootDataStore = await data.get();\n\t\t\t\treturn rootDataStore as T & FluidObject;\n\t\t\t};\n\n\t\t\treturn loadRuntime({\n\t\t\t\tcontext,\n\t\t\t\tregistry: convertRegistry(registry),\n\t\t\t\tprovideEntryPoint,\n\t\t\t\texisting,\n\t\t\t\tminVersionForCollab,\n\t\t\t\tnewContainerRootType: root?.type,\n\t\t\t});\n\t\t},\n\n\t\tasync satisfies(\n\t\t\tcandidate: IFluidCodeDetails,\n\t\t\tconstraint: IFluidCodeDetails,\n\t\t): Promise<boolean> {\n\t\t\treturn true;\n\t\t},\n\n\t\tasync compare(a: IFluidCodeDetails, b: IFluidCodeDetails): Promise<number | undefined> {\n\t\t\treturn 0;\n\t\t},\n\n\t\tget IRuntimeFactory(): IRuntimeFactory {\n\t\t\treturn fluidExport;\n\t\t},\n\n\t\tget IFluidCodeDetailsComparer(): IFluidCodeDetailsComparer {\n\t\t\treturn fluidExport;\n\t\t},\n\t};\n\n\treturn {\n\t\tload: async (details: IFluidCodeDetails): Promise<IFluidModuleWithDetails> => {\n\t\t\treturn { module: { fluidExport }, details };\n\t\t},\n\t};\n}\n\n/**\n * Minimal interface for the static container factory methods used by {@link ServiceClientImplementation}.\n * @internal\n */\nexport interface ServiceContainerStatics<TOptions> {\n\tcreateDetached<T>(\n\t\tregistry: DataStoreRegistry<T>,\n\t\toptions: TOptions,\n\t\troot: DataStoreKind<T>,\n\t): Promise<FluidContainerWithService<T>>;\n\n\tload<T>(\n\t\tregistry: DataStoreRegistry<T>,\n\t\toptions: TOptions,\n\t\tid: string,\n\t): Promise<FluidContainerAttached<T>>;\n}\n\n/**\n * Creates a {@link @fluidframework/driver-definitions#ServiceClient} that delegates container\n * creation and loading to the supplied container class statics.\n * @internal\n */\nexport class ServiceClientImplementation<TOptions> implements ServiceClient {\n\tpublic constructor(\n\t\tprivate readonly options: TOptions,\n\t\tprivate readonly statics: ServiceContainerStatics<TOptions>,\n\t) {}\n\n\t// This implements the ServiceClient interface's safer version of this with overloads.\n\t// For use in the implementation however, this is simpler, and allows createAttachedContainer to forward to it more easily.\n\tpublic async createContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerWithService<T>> {\n\t\tif (registry === undefined) {\n\t\t\tDataStoreKindImplementation.narrowGeneric(root);\n\t\t\treturn this.statics.createDetached(normalizeRegistry(root), this.options, root);\n\t\t} else {\n\t\t\tconst result = await lookupInRegistry(registry, root);\n\t\t\treturn this.statics.createDetached(registry, this.options, result);\n\t\t}\n\t}\n\n\tpublic async createAttachedContainer<T>(\n\t\troot: DataStoreKey<T> | DataStoreKind<T>,\n\t\tregistry?: Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\tconst container = await this.createContainer(root, registry);\n\t\treturn container.attach();\n\t}\n\n\tpublic async loadContainer<T>(\n\t\tid: string,\n\t\troot: DataStoreKind<T> | Registry<Promise<DataStoreKind<T>>>,\n\t): Promise<FluidContainerAttached<T>> {\n\t\treturn this.statics.load(normalizeRegistry(root), this.options, id);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"summaryUtils.d.ts","sourceRoot":"","sources":["../src/summaryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAEpG,OAAO,KAAK,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,6CAA6C,CAAC;AAOrF,OAAO,KAAK,EACX,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,MAAM,8CAA8C,CAAC;AAMtD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,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AE,6BAA6B,GAAG,IAAI;IAIxF;;OAEG;IACI,WAAW,CACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,GACnD,IAAI;IAOP;;;;;OAKG;IACI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,6BAA6B;IAI3E;;;OAGG;IACI,SAAS,IAAI,MAAM;IAQnB,uBAAuB,IAAI,6BAA6B;IAIxD,uBAAuB,CAAC,KAAK,EAAE,6BAA6B,GAAG,IAAI;CAG1E;AAoBD;;;GAGG;AACH,qBAAa,aAAc,YAAW,sBAAsB;IAC3D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmC;IAC9D,IAAW,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAM7C;IAEM,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI;IAI1D;;;;;OAKG;IACI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAe5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAMxD;;OAEG;IACI,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAM/C,SAAS,IAAI,sBAAsB;CAK1C"}
@@ -132,6 +132,8 @@ export function addSummarizeResultToSummary(summary, key, summarizeResult) {
132
132
  * @legacy @beta
133
133
  */
134
134
  export class SummaryTreeBuilder {
135
+ attachmentCounter = 0;
136
+ groupId;
135
137
  get summary() {
136
138
  const summary = {
137
139
  type: SummaryType.Tree,
@@ -146,12 +148,12 @@ export class SummaryTreeBuilder {
146
148
  return { ...this.summaryStats };
147
149
  }
148
150
  constructor(params) {
149
- this.attachmentCounter = 0;
150
- this.summaryTree = {};
151
151
  this.summaryStats = mergeStats();
152
152
  this.summaryStats.treeNodeCount++;
153
153
  this.groupId = params?.groupId;
154
154
  }
155
+ summaryTree = {};
156
+ summaryStats;
155
157
  /**
156
158
  * Add a blob to the summary tree. This blob will be stored at the given key in the summary tree.
157
159
  * @param key - The key to store the blob at in the current summary tree being generated. Should not contain any "/" characters.
@@ -293,8 +295,6 @@ export function convertSnapshotTreeToSummaryTree(snapshot) {
293
295
  // only for blobPath -> blobId mapping and not for blobId -> blob value contents.
294
296
  }
295
297
  else if (snapshot.blobs[id] !== undefined) {
296
- // Non null asserting here because of the undefined check above
297
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
298
298
  decoded = fromBase64ToUtf8(snapshot.blobs[id]);
299
299
  }
300
300
  if (decoded !== undefined) {
@@ -393,9 +393,7 @@ export function processAttachMessageGCData(snapshot, addedGCOutboundRoute) {
393
393
  * @internal
394
394
  */
395
395
  export class TelemetryContext {
396
- constructor() {
397
- this.telemetry = new Map();
398
- }
396
+ telemetry = new Map();
399
397
  /**
400
398
  * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
401
399
  */
@@ -459,9 +457,7 @@ function trimTrailingSlashes(str) {
459
457
  * @internal
460
458
  */
461
459
  export class GCDataBuilder {
462
- constructor() {
463
- this.gcNodesSet = {};
464
- }
460
+ gcNodesSet = {};
465
461
  get gcNodes() {
466
462
  const gcNodes = {};
467
463
  for (const [nodeId, outboundRoutes] of Object.entries(this.gcNodesSet)) {