Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# thatopen-services

## 0.3.6

### Patch Changes

- Add `getHiddenFileSignedUrl(hiddenId, expiresIn?)` to the client — returns a short-lived signed URL so large hidden files (e.g. a point cloud's `octree.bin`) can be fetched directly with native HTTP `Range` requests instead of downloading the whole object.

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"access": "public"
},
"private": false,
"version": "0.3.5",
"version": "0.3.6",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
Expand Down
25 changes: 25 additions & 0 deletions src/core/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,31 @@ export class EngineServicesClient {
);
}

/**
* Mints a short-lived presigned URL for a hidden file so the browser can
* stream it directly from storage with native HTTP `Range` requests (e.g. a
* point-cloud `octree.bin`), instead of proxying the whole object through the
* API. Re-call to re-mint when the URL nears/passes `expiresAt`; coalesce
* concurrent re-mints into a single in-flight call.
*
* The storage bucket's CORS must allow the `Range` request header and expose
* `Content-Range`, `Accept-Ranges` and `Content-Length` for the ranged fetch
* to succeed cross-origin.
*
* @param hiddenId - The hidden file's unique identifier.
* @param expiresIn - Desired URL lifetime in seconds (60–3600). Defaults to
* 900 (15 min) server-side; values are clamped to that range.
* @returns `{ url, expiresAt }` — `url` is the presigned GET URL, `expiresAt`
* an ISO timestamp when it stops working.
*/
async getHiddenFileSignedUrl(hiddenId: string, expiresIn?: number) {
return await this.#requestApi<{ url: string; expiresAt: string }>(
'GET',
`${ITEM_PATH}/${HIDDEN_PATH}/${hiddenId}/signed-url`,
{ ...(expiresIn != null && { query: { expiresIn } }) },
);
}

/**
* Lists all hidden files attached to a parent item.
* @param parentFileId - The parent item's unique identifier.
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3026,10 +3026,10 @@ three-mesh-bvh@0.9.9:
resolved "https://registry.yarnpkg.com/three-mesh-bvh/-/three-mesh-bvh-0.9.9.tgz#273be4a3d4a4a287e6be2d947237e47657f84183"
integrity sha512-FJKitcjvbALmeQRK+Sc+nLGorCpkrZBrbgJZFzhdyWboak37DZikn46hvQkNqSbJPm227ahYmS6k3N/GXaAyXw==

three@^0.182.0:
version "0.182.0"
resolved "https://registry.npmjs.org/three/-/three-0.182.0.tgz"
integrity sha512-GbHabT+Irv+ihI1/f5kIIsZ+Ef9Sl5A1Y7imvS5RQjWgtTPfPnZ43JmlYI7NtCRDK9zir20lQpfg8/9Yd02OvQ==
three@>=0.182.0:
version "0.185.0"
resolved "https://registry.yarnpkg.com/three/-/three-0.185.0.tgz#1b60dc42a042712a79961b2a654617fd6bb2503b"
integrity sha512-+yRrcRO2iZa8uzvNNl0d7cL4huhgKgBvVJ0njcTe8xFqZ6DMAFZdCKDP91SEAuj25bNAj7k1QQdf+srZywVK6w==

tinybench@^2.9.0:
version "2.9.0"
Expand Down
Loading