@sequenceholdings/storage 0.1.1 → 0.1.2

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Atlas storage client
2
2
 
3
3
  Typed Workspaces V2 metadata and direct-to-GCS sequential resumable transfers.
4
- Initial release is pending publication and public-contract review.
4
+ Preview. See the public Workspaces V2 developer documentation.
5
5
 
6
6
  ```ts
7
7
  import { createStorageClient } from '@sequenceholdings/storage'
package/dist/transfer.js CHANGED
@@ -13,11 +13,20 @@ class StorageTransferError extends Error {
13
13
  }
14
14
  }
15
15
  exports.StorageTransferError = StorageTransferError;
16
+ /** One dotless bucket label: Google's certificate covers `*.storage.googleapis.com` only. */
17
+ const BUCKET_HOST = /^[a-z0-9][a-z0-9_-]{1,61}[a-z0-9]\.storage\.googleapis\.com$/;
18
+ /**
19
+ * A session URI is a bearer credential, so bytes go only to GCS's resumable
20
+ * endpoints: the JSON API on the shared host, or an XML session on a bucket's
21
+ * own host (Atlas issues those to agent sandboxes, whose egress allows only
22
+ * their deployment's bucket host). The resumable protocol is the same on both.
23
+ */
16
24
  function checkedUploadUrl(value) {
17
25
  const url = new URL(value);
26
+ const jsonSession = url.hostname === 'storage.googleapis.com' && url.pathname.startsWith('/upload/');
27
+ const bucketHostSession = BUCKET_HOST.test(url.hostname) && url.pathname !== '/';
18
28
  if (url.protocol !== 'https:' ||
19
- url.hostname !== 'storage.googleapis.com' ||
20
- !url.pathname.startsWith('/upload/') ||
29
+ !(jsonSession || bucketHostSession) ||
21
30
  !url.searchParams.has('upload_id') ||
22
31
  url.port ||
23
32
  url.username ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/storage",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Atlas workspace storage contracts and streaming client",
5
5
  "license": "UNLICENSED",
6
6
  "type": "commonjs",