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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ const result = await client.sites.deploy("site-id", [
]);
```

The deploy method handles the full upload flow: requesting presigned URLs, uploading file parts to S3 (with concurrency), and finalizing the deployment.
The deploy method handles the full upload flow: requesting per-part upload URLs, PUTting each part (with concurrency), capturing ETags, and finalizing the deployment.

Files larger than 5 MB are automatically split into multipart uploads.

By default the public API returns **partition-host upload URLs** (on the same hostname as the rest of the API, e.g. `https://us.api.hostsmith.net/v1/uploads/...`) - so the SDK only needs network access to your partition's API host. If you prefer direct-to-S3 presigned URLs (e.g. for CI runners in the same AWS region), pass `mode: "presigned"` when starting the upload via the lower-level `client.sites.startUpload(...)` API. `deploy()` follows the server default and works with either URL shape transparently.

## Configuration

### Partitions
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/sites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ describe("SitesResource.deploy", () => {
partUploadUrls: [
{
part: 1,
url: "https://us.api.hostsmith.net/v1/uploads/uploads/orgA/s1/v1/file0.html?ut=eyJhbGciOiJIUzI1NiJ9.payload.sig",
url: "https://us.api.hostsmith.net/v1/uploads/orgA/s1/v1/file0.html?ut=eyJhbGciOiJIUzI1NiJ9.payload.sig",
},
],
},
Expand All @@ -431,7 +431,7 @@ describe("SitesResource.deploy", () => {
expect(fetcher).toHaveBeenCalledTimes(1);
const [calledUrl, init] = fetcher.mock.calls[0];
expect(calledUrl).toBe(
"https://us.api.hostsmith.net/v1/uploads/uploads/orgA/s1/v1/file0.html?ut=eyJhbGciOiJIUzI1NiJ9.payload.sig",
"https://us.api.hostsmith.net/v1/uploads/orgA/s1/v1/file0.html?ut=eyJhbGciOiJIUzI1NiJ9.payload.sig",
);
expect(init).toEqual(expect.objectContaining({ method: "PUT" }));
// SDK did not rewrite or strip the ut query parameter.
Expand All @@ -448,11 +448,11 @@ describe("SitesResource.deploy", () => {
partUploadUrls: [
{
part: 1,
url: "https://us.api.hostsmith.net/v1/uploads/uploads/orgA/s1/v1/big.bin?partNumber=1&uploadId=upl-xyz&ut=tok1",
url: "https://us.api.hostsmith.net/v1/uploads/orgA/s1/v1/big.bin?partNumber=1&uploadId=upl-xyz&ut=tok1",
},
{
part: 2,
url: "https://us.api.hostsmith.net/v1/uploads/uploads/orgA/s1/v1/big.bin?partNumber=2&uploadId=upl-xyz&ut=tok2",
url: "https://us.api.hostsmith.net/v1/uploads/orgA/s1/v1/big.bin?partNumber=2&uploadId=upl-xyz&ut=tok2",
},
],
},
Expand Down
Loading