@fluidframework/runtime-utils 2.60.0 → 2.61.0-355516

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 (50) hide show
  1. package/.mocharc.cjs +1 -2
  2. package/dist/compatibilityBase.d.ts +9 -0
  3. package/dist/compatibilityBase.d.ts.map +1 -1
  4. package/dist/compatibilityBase.js +17 -1
  5. package/dist/compatibilityBase.js.map +1 -1
  6. package/dist/dataStoreHelpers.d.ts.map +1 -1
  7. package/dist/dataStoreHelpers.js +9 -9
  8. package/dist/dataStoreHelpers.js.map +1 -1
  9. package/dist/handles.d.ts +19 -0
  10. package/dist/handles.d.ts.map +1 -1
  11. package/dist/handles.js +39 -1
  12. package/dist/handles.js.map +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/legacy.d.ts +4 -2
  18. package/dist/packageVersion.d.ts +1 -1
  19. package/dist/packageVersion.d.ts.map +1 -1
  20. package/dist/packageVersion.js +1 -1
  21. package/dist/packageVersion.js.map +1 -1
  22. package/dist/public.d.ts +2 -1
  23. package/lib/compatibilityBase.d.ts +9 -0
  24. package/lib/compatibilityBase.d.ts.map +1 -1
  25. package/lib/compatibilityBase.js +15 -0
  26. package/lib/compatibilityBase.js.map +1 -1
  27. package/lib/dataStoreHelpers.d.ts.map +1 -1
  28. package/lib/dataStoreHelpers.js +9 -9
  29. package/lib/dataStoreHelpers.js.map +1 -1
  30. package/lib/handles.d.ts +19 -0
  31. package/lib/handles.d.ts.map +1 -1
  32. package/lib/handles.js +37 -0
  33. package/lib/handles.js.map +1 -1
  34. package/lib/index.d.ts +2 -2
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/index.js +2 -2
  37. package/lib/index.js.map +1 -1
  38. package/lib/legacy.d.ts +4 -2
  39. package/lib/packageVersion.d.ts +1 -1
  40. package/lib/packageVersion.d.ts.map +1 -1
  41. package/lib/packageVersion.js +1 -1
  42. package/lib/packageVersion.js.map +1 -1
  43. package/lib/public.d.ts +2 -1
  44. package/lib/tsdoc-metadata.json +1 -1
  45. package/package.json +21 -21
  46. package/src/compatibilityBase.ts +21 -0
  47. package/src/dataStoreHelpers.ts +10 -11
  48. package/src/handles.ts +53 -0
  49. package/src/index.ts +2 -0
  50. package/src/packageVersion.ts +1 -1
package/src/handles.ts CHANGED
@@ -3,6 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import type {
7
+ IContainerRuntime,
8
+ IContainerRuntimeInternal,
9
+ } from "@fluidframework/container-runtime-definitions/internal";
6
10
  import type { IFluidHandleErased } from "@fluidframework/core-interfaces";
7
11
  import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
8
12
  import type {
@@ -195,3 +199,52 @@ export abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
195
199
  return toFluidHandleErased(this);
196
200
  }
197
201
  }
202
+
203
+ /**
204
+ * Lookup the blob storage ID for a blob handle.
205
+ * @param containerRuntime - The container runtime instance
206
+ * @param handle - The blob handle to lookup the storage ID for
207
+ * @returns The storage ID if found and the blob is not pending, undefined otherwise
208
+ * @remarks
209
+ * This is a legacy+alpha helper function that provides access to blob storage IDs.
210
+ * For blobs with pending payloads (localId exists but upload hasn't finished), this is expected to return undefined.
211
+ * Consumers should use the observability APIs on the handle (handle.payloadState, payloadShared event)
212
+ * to understand/wait for storage ID availability.
213
+ * Similarly, when the runtime is detached, this will return undefined as no blobs have been uploaded to storage.
214
+ *
215
+ * Warning: the returned blob URL may expire and does not support permalinks.
216
+ * This API is intended for temporary integration scenarios only.
217
+ * @legacy
218
+ * @alpha
219
+ */
220
+ export function lookupTemporaryBlobStorageId(
221
+ containerRuntime: IContainerRuntime,
222
+ handle: IFluidHandle,
223
+ ): string | undefined {
224
+ // Verify that the handle points to a blob by checking its path format
225
+ const absolutePath: string | undefined = toFluidHandleInternal(handle).absolutePath;
226
+
227
+ // Blob handles have paths in the format "/_blobs/{localId}"
228
+ if (!absolutePath?.startsWith("/_blobs/")) {
229
+ throw new Error(
230
+ "Handle does not point to a blob - expected path to start with '/_blobs/'",
231
+ );
232
+ }
233
+
234
+ // Extract the local ID from the path
235
+ const pathParts = absolutePath.split("/");
236
+ if (
237
+ pathParts.length !== 3 ||
238
+ pathParts[1] !== "_blobs" ||
239
+ pathParts[2] === undefined ||
240
+ pathParts[2] === ""
241
+ ) {
242
+ throw new Error("Invalid blob handle path format");
243
+ }
244
+
245
+ const localId = pathParts[2];
246
+
247
+ // Cast the runtime to the internal interface and call the lookup method
248
+ const internalRuntime = containerRuntime as IContainerRuntimeInternal;
249
+ return internalRuntime.lookupTemporaryBlobStorageId(localId);
250
+ }
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export {
19
19
  isFluidHandlePayloadPending,
20
20
  isLocalFluidHandle,
21
21
  isSerializedHandle,
22
+ lookupTemporaryBlobStorageId,
22
23
  toFluidHandleErased,
23
24
  toFluidHandleInternal,
24
25
  } from "./handles.js";
@@ -65,6 +66,7 @@ export {
65
66
  getValidationForRuntimeOptions,
66
67
  getConfigsForMinVersionForCollab,
67
68
  isValidMinVersionForCollab,
69
+ semanticVersionToMinimumVersionForCollab,
68
70
  } from "./compatibilityBase.js";
69
71
  export type {
70
72
  ConfigMap,
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/runtime-utils";
9
- export const pkgVersion = "2.60.0";
9
+ export const pkgVersion = "2.61.0-355516";