@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.
- package/.mocharc.cjs +1 -2
- package/dist/compatibilityBase.d.ts +9 -0
- package/dist/compatibilityBase.d.ts.map +1 -1
- package/dist/compatibilityBase.js +17 -1
- package/dist/compatibilityBase.js.map +1 -1
- package/dist/dataStoreHelpers.d.ts.map +1 -1
- package/dist/dataStoreHelpers.js +9 -9
- package/dist/dataStoreHelpers.js.map +1 -1
- package/dist/handles.d.ts +19 -0
- package/dist/handles.d.ts.map +1 -1
- package/dist/handles.js +39 -1
- package/dist/handles.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +4 -2
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/public.d.ts +2 -1
- package/lib/compatibilityBase.d.ts +9 -0
- package/lib/compatibilityBase.d.ts.map +1 -1
- package/lib/compatibilityBase.js +15 -0
- package/lib/compatibilityBase.js.map +1 -1
- package/lib/dataStoreHelpers.d.ts.map +1 -1
- package/lib/dataStoreHelpers.js +9 -9
- package/lib/dataStoreHelpers.js.map +1 -1
- package/lib/handles.d.ts +19 -0
- package/lib/handles.d.ts.map +1 -1
- package/lib/handles.js +37 -0
- package/lib/handles.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/legacy.d.ts +4 -2
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/public.d.ts +2 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +21 -21
- package/src/compatibilityBase.ts +21 -0
- package/src/dataStoreHelpers.ts +10 -11
- package/src/handles.ts +53 -0
- package/src/index.ts +2 -0
- 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,
|
package/src/packageVersion.ts
CHANGED