@dropthis/cli 0.9.3 → 0.10.0

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.
@@ -17,8 +17,14 @@ const dropthis = new Dropthis({ apiKey: "sk_..." });
17
17
  const { data, error } = await dropthis.drops.publish("<h1>Hello</h1>");
18
18
 
19
19
  console.log(data.url); // https://abc123.dropthis.app
20
+ console.log(data.id); // drop_… — keep this; it's how you update or delete later
20
21
  ```
21
22
 
23
+ > **Keep the `drop_…` id.** `publish()` never takes an id — every call creates a NEW drop.
24
+ > To change something already published, pass the id from the publish response to
25
+ > `drops.updateContent()` (the files at the URL) or `drops.updateSettings()` (title,
26
+ > visibility, expiry, …). Lost the id? Recover it from the URL with `drops.resolve()`.
27
+
22
28
  ## Usage
23
29
 
24
30
  ### Publish an HTML string
@@ -45,7 +51,7 @@ const { data } = await dropthis.drops.publish("./dist");
45
51
  const { data } = await dropthis.drops.publish("./dist", {
46
52
  title: "Q4 Report",
47
53
  visibility: "unlisted",
48
- password: "s3cret",
54
+ noindex: true,
49
55
  expiresAt: "2026-12-31T00:00:00Z",
50
56
  });
51
57
  ```
@@ -66,6 +72,71 @@ const updated = await dropthis.drops.updateContent(created.data.id, "./dist-v2",
66
72
  await dropthis.drops.updateSettings("drop_abc123", { title: "New title" });
67
73
  ```
68
74
 
75
+ ### Resolve a URL back to its drop
76
+
77
+ Lost the `drop_…` id? Resolve the drop's URL (or bare slug) back to the drop. The slug is
78
+ parsed client-side from the first hostname label of a dropthis hostname
79
+ (`<slug>.dropthis.app`, or `<slug>.` + your configured `baseUrl` host), then matched against
80
+ your own drops via `GET /drops?slug=`. Custom-domain URLs are not resolvable yet — they are
81
+ rejected client-side with an `invalid_drop_url` error, without hitting the API.
82
+
83
+ ```typescript
84
+ const { data } = await dropthis.drops.resolve("https://my-report.dropthis.app/");
85
+
86
+ if (data) {
87
+ console.log(data.id); // drop_… — use this for updateContent/updateSettings/delete
88
+ } else {
89
+ // none of your drops has that slug
90
+ }
91
+ ```
92
+
93
+ ### Read back what a drop is serving
94
+
95
+ `drops.getContent()` is the owner-side read-back (it works regardless of any viewer
96
+ password). By default it returns a JSON manifest of the current deployment's files;
97
+ pass `path` to download one file's exact stored bytes.
98
+
99
+ ```typescript
100
+ // Manifest of the current deployment
101
+ const manifest = await dropthis.drops.getContent("drop_abc123");
102
+ console.log(manifest.data.files); // [{ path, contentType, sizeBytes }, …]
103
+
104
+ // One file's bytes (and a text() helper)
105
+ const file = await dropthis.drops.getContent("drop_abc123", { path: "index.html" });
106
+ console.log(file.data.contentType); // "text/html"
107
+ console.log(file.data.text()); // "<h1>…"
108
+
109
+ // A historical (even superseded) deployment — this is also the rollback path:
110
+ // download the old version's files and republish them with updateContent().
111
+ const old = await dropthis.drops.getContent("drop_abc123", {
112
+ deploymentId: "dep_xyz789",
113
+ path: "index.html",
114
+ });
115
+ ```
116
+
117
+ ### Safe concurrent edits with ifRevision
118
+
119
+ Every drop response carries a `revision`. Pass it back as `ifRevision` on
120
+ `updateContent()` / `updateSettings()` to make the update conditional: if someone else
121
+ changed the drop in between, the API answers 409 instead of clobbering, and the error
122
+ exposes the server's `currentRevision` so you can re-read and retry.
123
+
124
+ ```typescript
125
+ // 1. Read
126
+ const drop = await dropthis.drops.get("drop_abc123");
127
+
128
+ // 2. Edit locally (e.g. via getContent read-back), then
129
+ // 3. Update conditionally
130
+ const result = await dropthis.drops.updateContent(drop.data.id, "./dist-v2", {
131
+ ifRevision: drop.data.revision,
132
+ });
133
+
134
+ if (result.error?.statusCode === 409) {
135
+ console.log("Drop changed underneath us; server is at revision", result.error.currentRevision);
136
+ // re-read with drops.get(), merge, retry with the fresh revision
137
+ }
138
+ ```
139
+
69
140
  ## Supported inputs
70
141
 
71
142
  The `drops.publish()` and `drops.updateContent()` methods accept:
@@ -82,7 +153,7 @@ The `drops.publish()` and `drops.updateContent()` methods accept:
82
153
 
83
154
  Drop **settings** (title, visibility, password, noindex, expiresAt, metadata) go in the second `options` argument, not in the input object.
84
155
 
85
- All inputs are uploaded through staged presigned URLs. The SDK handles this transparently.
156
+ All inputs are uploaded through staged presigned URLs — one signed PUT per file, up to 5 files in parallel. The SDK handles this transparently.
86
157
 
87
158
  ### Explicit input examples
88
159
 
@@ -174,6 +245,9 @@ const dropthis = new Dropthis("sk_...");
174
245
  ```typescript
175
246
  await dropthis.drops.list({ limit: 20 });
176
247
  await dropthis.drops.get("drop_abc123");
248
+ await dropthis.drops.resolve("https://my-report.dropthis.app/"); // URL/slug → drop (or null)
249
+ await dropthis.drops.getContent("drop_abc123"); // manifest of served files
250
+ await dropthis.drops.getContent("drop_abc123", { path: "index.html" }); // one file's bytes
177
251
  await dropthis.drops.updateSettings("drop_abc123", { title: "Updated" });
178
252
  await dropthis.drops.delete("drop_abc123");
179
253
  ```
@@ -209,7 +283,7 @@ await dropthis.uploads.create({
209
283
  files: [{ path: "index.html", contentType: "text/html", sizeBytes: 1024 }],
210
284
  });
211
285
  await dropthis.uploads.get("upl_abc123");
212
- await dropthis.uploads.complete("upl_abc123", { files: {} });
286
+ await dropthis.uploads.complete("upl_abc123"); // no body — server verifies against the manifest
213
287
  await dropthis.uploads.cancel("upl_abc123");
214
288
  ```
215
289
 
@@ -218,7 +292,7 @@ await dropthis.uploads.cancel("upl_abc123");
218
292
  ```typescript
219
293
  await dropthis.auth.requestEmailOtp({ email: "you@example.com" });
220
294
  await dropthis.auth.verifyEmailOtp({ email: "you@example.com", code: "123456" });
221
- await dropthis.auth.logout();
295
+ await dropthis.auth.logout(); // 204 No Content — data is null
222
296
  ```
223
297
 
224
298
  ### apiKeys
@@ -226,17 +300,29 @@ await dropthis.auth.logout();
226
300
  ```typescript
227
301
  await dropthis.apiKeys.create({ label: "CI" });
228
302
  await dropthis.apiKeys.list();
229
- await dropthis.apiKeys.delete("key_abc123");
303
+ await dropthis.apiKeys.delete("key_abc123"); // 204 No Content — data is null
230
304
  ```
231
305
 
232
306
  ### account
233
307
 
234
308
  ```typescript
235
- await dropthis.account.get();
309
+ const { data } = await dropthis.account.get();
310
+ // data.limits carries your plan's limits — use them to size a publish first:
311
+ // { name, maxSizeBytes, defaultTtlSeconds, maxStorageBytes }
312
+
236
313
  await dropthis.account.update({ displayName: "Jane Doe" });
237
314
  await dropthis.account.delete();
238
315
  ```
239
316
 
317
+ ## Pricing tiers
318
+
319
+ - **Free ($0)** — drops expire after 7 days, 5 MB per drop, dropthis badge.
320
+ - **Personal ($5/mo)** — drops stay live while subscribed (no expiry), no badge, 100 MB per drop, 2 GB account storage.
321
+ - **Pro ($19/mo)** — everything in Personal plus password protection, custom domains, and analytics.
322
+
323
+ `account.get().data.limits` reflects your active tier. Note: password protection ships
324
+ with Pro and is not enabled on any tier yet — the API rejects the `password` option until then.
325
+
240
326
  ## Cloudflare Workers (edge)
241
327
 
242
328
  Use the fs-free entry point for Cloudflare Workers and other edge runtimes. It does not import `node:fs`, `node:path`, or `node:crypto`.
@@ -250,7 +336,7 @@ const { data, error } = await dropthis.drops.publish("<h1>Hello from the edge</h
250
336
 
251
337
  `DropthisEdge` accepts the in-memory subset of `PublishInput`: inline strings, `Uint8Array`, `URL`, and the explicit `{ kind: "content" }`, `{ kind: "source_url" }`, and `{ kind: "files" }` forms. Local file paths and `string[]` path arrays are not supported (no filesystem on the edge).
252
338
 
253
- `DropthisEdge` exposes the drop lifecycle through `drops.publish(input, options?)`, `drops.updateContent(dropId, input, options?)`, `drops.updateSettings`, `drops.get`, `drops.list`, and `drops.delete`, plus the `deployments`, `account`, and `apiKeys` resource accessors — the same surface as the Node client.
339
+ `DropthisEdge` exposes the drop lifecycle through `drops.publish(input, options?)`, `drops.updateContent(dropId, input, options?)`, `drops.updateSettings`, `drops.get`, `drops.list`, `drops.resolve`, `drops.getContent`, and `drops.delete`, plus the `deployments`, `account`, and `apiKeys` resource accessors — the same surface as the Node client.
254
340
 
255
341
  ## Types
256
342
 
@@ -258,12 +344,18 @@ Key types exported from the package:
258
344
 
259
345
  ```typescript
260
346
  import type {
347
+ AccountLimits,
348
+ AccountResponse,
261
349
  DropthisClientOptions,
262
350
  DropthisResult,
263
351
  DropthisErrorResponse,
264
352
  DropResponse,
265
353
  DropDeploymentResponse,
266
354
  DropOptions,
355
+ DeploymentContentManifest,
356
+ DeploymentContentFile,
357
+ DropContentFile,
358
+ GetContentOptions,
267
359
  PrepareOptions,
268
360
  RequestControls,
269
361
  PublishOptions,
@@ -153,6 +153,17 @@ type ApiKeyCreatedResponse = ApiKeyResponse & {
153
153
  accountId?: string | null;
154
154
  isNewAccount?: boolean;
155
155
  };
156
+ /** Active plan tier limits — use these to size a publish before uploading. */
157
+ type AccountLimits = {
158
+ /** Plan tier the limits apply to. */
159
+ name: string;
160
+ /** Maximum size of a single drop in bytes. */
161
+ maxSizeBytes: number;
162
+ /** Drop lifetime in seconds before expiry; null means drops are permanent. */
163
+ defaultTtlSeconds: number | null;
164
+ /** Total account storage cap in bytes; null means no account-level cap. */
165
+ maxStorageBytes: number | null;
166
+ };
156
167
  type AccountResponse = {
157
168
  id: string;
158
169
  email: string;
@@ -160,6 +171,7 @@ type AccountResponse = {
160
171
  plan: string;
161
172
  status: string;
162
173
  createdAt: string;
174
+ limits: AccountLimits;
163
175
  };
164
176
  type ListDropsParams = {
165
177
  cursor?: string | null;
@@ -177,7 +189,8 @@ type CreateUploadSessionRequest = {
177
189
  entry?: string | null;
178
190
  };
179
191
  type UploadTarget = {
180
- strategy: "single_put" | "multipart";
192
+ /** Always `single_put` one signed PUT per file is the upload contract. */
193
+ strategy: "single_put";
181
194
  url: string;
182
195
  headers: Record<string, string>;
183
196
  expiresAt: string;
@@ -210,14 +223,6 @@ type CreateUploadSessionResponse = {
210
223
  files: CreateUploadSessionFileResponse[];
211
224
  nextAction?: Action | null;
212
225
  };
213
- type CompleteUploadSessionRequest = {
214
- files?: Record<string, {
215
- parts?: Array<{
216
- partNumber: number;
217
- etag: string;
218
- }> | null;
219
- }>;
220
- };
221
226
  type DropOptions = {
222
227
  /** Drop title. */
223
228
  title?: string;
@@ -281,6 +286,53 @@ type PublishInput = string | string[] | URL | Uint8Array | {
281
286
  files: PublishFileInput[];
282
287
  entry?: string;
283
288
  };
289
+ /** One readable file in a deployment's content manifest. */
290
+ type DeploymentContentFile = {
291
+ /** File path within the deployment, relative to its root. */
292
+ path: string;
293
+ /** Stored MIME type the file is served with. */
294
+ contentType: string;
295
+ /** Stored file size in bytes. */
296
+ sizeBytes: number;
297
+ };
298
+ /**
299
+ * Manifest of one deployment's readable files (content read-back).
300
+ * Fetch a single file's bytes with `drops.getContent(dropId, { path })`.
301
+ */
302
+ type DeploymentContentManifest = {
303
+ /** Parent drop identifier. */
304
+ dropId: string;
305
+ /** Deployment identifier. */
306
+ deploymentId: string;
307
+ /** Content revision of this deployment. */
308
+ revision: number;
309
+ /** Deployment lifecycle status. */
310
+ status: string;
311
+ /** Total deployment size in bytes. */
312
+ sizeBytes: number;
313
+ /** Entry path served at the drop root. */
314
+ entry?: string | null;
315
+ /** Readable files in this deployment; pass files[].path as `path` to download one. */
316
+ files: DeploymentContentFile[];
317
+ };
318
+ /** Options for `drops.getContent()`. */
319
+ type GetContentOptions = {
320
+ /** Read a historical deployment instead of the current one. */
321
+ deploymentId?: string;
322
+ /** Download this single file's raw stored bytes instead of the JSON manifest. */
323
+ path?: string;
324
+ };
325
+ /** A single file downloaded via `drops.getContent(dropId, { path })`. */
326
+ type DropContentFile = {
327
+ /** The requested file path. */
328
+ path: string;
329
+ /** Stored MIME type the file is served with (from the response Content-Type). */
330
+ contentType: string | null;
331
+ /** Exact stored bytes. */
332
+ bytes: Uint8Array;
333
+ /** Decode the bytes as UTF-8 text. */
334
+ text(): string;
335
+ };
284
336
 
285
337
  declare class Transport {
286
338
  readonly apiKey: string | undefined;
@@ -292,6 +344,17 @@ declare class Transport {
292
344
  putSignedUrl(url: string, body: Uint8Array | Blob | ReadableStream, headers: Record<string, string>): Promise<DropthisResult<{
293
345
  etag: string | null;
294
346
  }>>;
347
+ /**
348
+ * Authenticated GET that returns the raw response bytes untouched (no JSON parsing,
349
+ * no case conversion). Error responses are still parsed as problem+json. Used for
350
+ * content read-back (`drops.getContent` with a file path).
351
+ */
352
+ requestBytes(path: string, options?: RequestOptions & {
353
+ params?: Record<string, string | number | boolean | null | undefined>;
354
+ }): Promise<DropthisResult<{
355
+ bytes: Uint8Array;
356
+ contentType: string | null;
357
+ }>>;
295
358
  request<T>(method: string, path: string, options?: RequestOptions & {
296
359
  body?: unknown;
297
360
  bodyCase?: "snake" | "raw";
@@ -372,9 +435,8 @@ declare class ApiKeysResource {
372
435
  create(input: {
373
436
  label: string;
374
437
  }): Promise<DropthisResult<ApiKeyCreatedResponse>>;
375
- delete(keyId: string): Promise<DropthisResult<{
376
- ok: true;
377
- }>>;
438
+ /** Revoke an API key. 204 No Content — data is null on success. */
439
+ delete(keyId: string): Promise<DropthisResult<null>>;
378
440
  }
379
441
 
380
442
  declare class DeploymentsResource {
@@ -410,8 +472,15 @@ declare class CursorPage<T> implements ListPage<T> {
410
472
  */
411
473
  declare class DropsResource<TInput = PublishInput> {
412
474
  private readonly transport;
413
- private readonly resolve;
414
- constructor(transport: Transport, resolve: PublishInputResolver<TInput>);
475
+ private readonly resolveInput;
476
+ private parentHosts?;
477
+ constructor(transport: Transport, resolveInput: PublishInputResolver<TInput>);
478
+ /**
479
+ * Hostnames the SDK can attribute to dropthis for slug parsing: the canonical
480
+ * viewer domain plus the configured baseUrl's host (covers staging/self-hosted
481
+ * setups where drops are served under the API's own domain).
482
+ */
483
+ private allowedParentHosts;
415
484
  /**
416
485
  * Publish content to a NEW permanent public URL; returns the created drop (with its `drop_…` id).
417
486
  * Use to publish / share / post / put online / make public a report, dashboard, site, or file.
@@ -432,6 +501,28 @@ declare class DropsResource<TInput = PublishInput> {
432
501
  list(params?: ListDropsParams): Promise<DropthisResult<CursorPage<DropResponse>>>;
433
502
  /** Fetch one drop by its `drop_…` id (not the slug/URL). GET /drops/{id}. */
434
503
  get(dropId: string): Promise<DropthisResult<DropResponse>>;
504
+ /**
505
+ * Resolve a drop URL (or bare slug) back to the drop — the way to recover a lost
506
+ * `drop_…` id. The slug is parsed client-side from the first hostname label of a
507
+ * dropthis-attributable hostname (`https://<slug>.dropthis.app/…`, or `<slug>.` +
508
+ * the configured baseUrl's host), then matched owner-scoped via GET /drops?slug=.
509
+ * Returns the drop, or `data: null` when no drop of yours has that slug.
510
+ * Custom-domain URLs are rejected client-side with `invalid_drop_url` — they are
511
+ * not resolvable yet.
512
+ */
513
+ resolve(urlOrSlug: string): Promise<DropthisResult<DropResponse | null>>;
514
+ /**
515
+ * Read back what a drop is serving (owner-only; works regardless of any viewer
516
+ * password). By default returns the JSON manifest of the CURRENT deployment's files;
517
+ * pass `deploymentId` to read a historical (even superseded) deployment — downloading
518
+ * an old version's files and republishing them via {@link updateContent} is the
519
+ * rollback path. Pass `path` (one of the manifest's `files[].path` values) to download
520
+ * that file's exact stored bytes instead. GET /drops/{id}/content.
521
+ */
522
+ getContent(dropId: string, options: GetContentOptions & {
523
+ path: string;
524
+ }): Promise<DropthisResult<DropContentFile>>;
525
+ getContent(dropId: string, options?: Omit<GetContentOptions, "path">): Promise<DropthisResult<DeploymentContentManifest>>;
435
526
  /**
436
527
  * Change an EXISTING drop's settings — title, visibility, password, noindex, expiry,
437
528
  * metadata — by its `drop_…` id. Does not touch content; replace that with {@link updateContent}.
@@ -442,4 +533,4 @@ declare class DropsResource<TInput = PublishInput> {
442
533
  delete(dropId: string): Promise<DropthisResult<null>>;
443
534
  }
444
535
 
445
- export { AccountResource as A, type UploadTarget as B, type CompleteUploadSessionRequest as C, DeploymentsResource as D, type EmailOtpResponse as E, type InMemoryPublishInput as I, type Limitations as L, type PrepareOptions as P, type RequestControls as R, type SessionResponse as S, type TierInfo as T, type UpdateContentOptions as U, type ActionResolve as a, ApiKeysResource as b, type CreateUploadSessionRequest as c, type CreateUploadSessionResponse as d, CursorPage as e, type DropAction as f, type DropDeploymentResponse as g, type DropOptions as h, type DropResponse as i, DropsResource as j, type DropthisClientOptions as k, type DropthisErrorResponse as l, type DropthisResult as m, type ListDeploymentsParams as n, type ListDeploymentsResponse as o, type ListPage as p, type PreparedPublishRequest as q, type PreparedUploadFile as r, type PublishFileInput as s, type PublishInput as t, type PublishOptions as u, type RequestOptions as v, Transport as w, type UploadManifestFile as x, type UploadSessionFileResponse as y, type UploadSessionResponse as z };
536
+ export { type AccountLimits as A, Transport as B, type CreateUploadSessionRequest as C, type DeploymentContentFile as D, type EmailOtpResponse as E, type UploadManifestFile as F, type GetContentOptions as G, type UploadSessionFileResponse as H, type InMemoryPublishInput as I, type UploadSessionResponse as J, type UploadTarget as K, type Limitations as L, type PrepareOptions as P, type RequestControls as R, type SessionResponse as S, type TierInfo as T, type UpdateContentOptions as U, AccountResource as a, type AccountResponse as b, type ActionResolve as c, ApiKeysResource as d, type CreateUploadSessionResponse as e, CursorPage as f, type DeploymentContentManifest as g, DeploymentsResource as h, type DropAction as i, type DropContentFile as j, type DropDeploymentResponse as k, type DropOptions as l, type DropResponse as m, DropsResource as n, type DropthisClientOptions as o, type DropthisErrorResponse as p, type DropthisResult as q, type ListDeploymentsParams as r, type ListDeploymentsResponse as s, type ListPage as t, type PreparedPublishRequest as u, type PreparedUploadFile as v, type PublishFileInput as w, type PublishInput as x, type PublishOptions as y, type RequestOptions as z };
@@ -153,6 +153,17 @@ type ApiKeyCreatedResponse = ApiKeyResponse & {
153
153
  accountId?: string | null;
154
154
  isNewAccount?: boolean;
155
155
  };
156
+ /** Active plan tier limits — use these to size a publish before uploading. */
157
+ type AccountLimits = {
158
+ /** Plan tier the limits apply to. */
159
+ name: string;
160
+ /** Maximum size of a single drop in bytes. */
161
+ maxSizeBytes: number;
162
+ /** Drop lifetime in seconds before expiry; null means drops are permanent. */
163
+ defaultTtlSeconds: number | null;
164
+ /** Total account storage cap in bytes; null means no account-level cap. */
165
+ maxStorageBytes: number | null;
166
+ };
156
167
  type AccountResponse = {
157
168
  id: string;
158
169
  email: string;
@@ -160,6 +171,7 @@ type AccountResponse = {
160
171
  plan: string;
161
172
  status: string;
162
173
  createdAt: string;
174
+ limits: AccountLimits;
163
175
  };
164
176
  type ListDropsParams = {
165
177
  cursor?: string | null;
@@ -177,7 +189,8 @@ type CreateUploadSessionRequest = {
177
189
  entry?: string | null;
178
190
  };
179
191
  type UploadTarget = {
180
- strategy: "single_put" | "multipart";
192
+ /** Always `single_put` one signed PUT per file is the upload contract. */
193
+ strategy: "single_put";
181
194
  url: string;
182
195
  headers: Record<string, string>;
183
196
  expiresAt: string;
@@ -210,14 +223,6 @@ type CreateUploadSessionResponse = {
210
223
  files: CreateUploadSessionFileResponse[];
211
224
  nextAction?: Action | null;
212
225
  };
213
- type CompleteUploadSessionRequest = {
214
- files?: Record<string, {
215
- parts?: Array<{
216
- partNumber: number;
217
- etag: string;
218
- }> | null;
219
- }>;
220
- };
221
226
  type DropOptions = {
222
227
  /** Drop title. */
223
228
  title?: string;
@@ -281,6 +286,53 @@ type PublishInput = string | string[] | URL | Uint8Array | {
281
286
  files: PublishFileInput[];
282
287
  entry?: string;
283
288
  };
289
+ /** One readable file in a deployment's content manifest. */
290
+ type DeploymentContentFile = {
291
+ /** File path within the deployment, relative to its root. */
292
+ path: string;
293
+ /** Stored MIME type the file is served with. */
294
+ contentType: string;
295
+ /** Stored file size in bytes. */
296
+ sizeBytes: number;
297
+ };
298
+ /**
299
+ * Manifest of one deployment's readable files (content read-back).
300
+ * Fetch a single file's bytes with `drops.getContent(dropId, { path })`.
301
+ */
302
+ type DeploymentContentManifest = {
303
+ /** Parent drop identifier. */
304
+ dropId: string;
305
+ /** Deployment identifier. */
306
+ deploymentId: string;
307
+ /** Content revision of this deployment. */
308
+ revision: number;
309
+ /** Deployment lifecycle status. */
310
+ status: string;
311
+ /** Total deployment size in bytes. */
312
+ sizeBytes: number;
313
+ /** Entry path served at the drop root. */
314
+ entry?: string | null;
315
+ /** Readable files in this deployment; pass files[].path as `path` to download one. */
316
+ files: DeploymentContentFile[];
317
+ };
318
+ /** Options for `drops.getContent()`. */
319
+ type GetContentOptions = {
320
+ /** Read a historical deployment instead of the current one. */
321
+ deploymentId?: string;
322
+ /** Download this single file's raw stored bytes instead of the JSON manifest. */
323
+ path?: string;
324
+ };
325
+ /** A single file downloaded via `drops.getContent(dropId, { path })`. */
326
+ type DropContentFile = {
327
+ /** The requested file path. */
328
+ path: string;
329
+ /** Stored MIME type the file is served with (from the response Content-Type). */
330
+ contentType: string | null;
331
+ /** Exact stored bytes. */
332
+ bytes: Uint8Array;
333
+ /** Decode the bytes as UTF-8 text. */
334
+ text(): string;
335
+ };
284
336
 
285
337
  declare class Transport {
286
338
  readonly apiKey: string | undefined;
@@ -292,6 +344,17 @@ declare class Transport {
292
344
  putSignedUrl(url: string, body: Uint8Array | Blob | ReadableStream, headers: Record<string, string>): Promise<DropthisResult<{
293
345
  etag: string | null;
294
346
  }>>;
347
+ /**
348
+ * Authenticated GET that returns the raw response bytes untouched (no JSON parsing,
349
+ * no case conversion). Error responses are still parsed as problem+json. Used for
350
+ * content read-back (`drops.getContent` with a file path).
351
+ */
352
+ requestBytes(path: string, options?: RequestOptions & {
353
+ params?: Record<string, string | number | boolean | null | undefined>;
354
+ }): Promise<DropthisResult<{
355
+ bytes: Uint8Array;
356
+ contentType: string | null;
357
+ }>>;
295
358
  request<T>(method: string, path: string, options?: RequestOptions & {
296
359
  body?: unknown;
297
360
  bodyCase?: "snake" | "raw";
@@ -372,9 +435,8 @@ declare class ApiKeysResource {
372
435
  create(input: {
373
436
  label: string;
374
437
  }): Promise<DropthisResult<ApiKeyCreatedResponse>>;
375
- delete(keyId: string): Promise<DropthisResult<{
376
- ok: true;
377
- }>>;
438
+ /** Revoke an API key. 204 No Content — data is null on success. */
439
+ delete(keyId: string): Promise<DropthisResult<null>>;
378
440
  }
379
441
 
380
442
  declare class DeploymentsResource {
@@ -410,8 +472,15 @@ declare class CursorPage<T> implements ListPage<T> {
410
472
  */
411
473
  declare class DropsResource<TInput = PublishInput> {
412
474
  private readonly transport;
413
- private readonly resolve;
414
- constructor(transport: Transport, resolve: PublishInputResolver<TInput>);
475
+ private readonly resolveInput;
476
+ private parentHosts?;
477
+ constructor(transport: Transport, resolveInput: PublishInputResolver<TInput>);
478
+ /**
479
+ * Hostnames the SDK can attribute to dropthis for slug parsing: the canonical
480
+ * viewer domain plus the configured baseUrl's host (covers staging/self-hosted
481
+ * setups where drops are served under the API's own domain).
482
+ */
483
+ private allowedParentHosts;
415
484
  /**
416
485
  * Publish content to a NEW permanent public URL; returns the created drop (with its `drop_…` id).
417
486
  * Use to publish / share / post / put online / make public a report, dashboard, site, or file.
@@ -432,6 +501,28 @@ declare class DropsResource<TInput = PublishInput> {
432
501
  list(params?: ListDropsParams): Promise<DropthisResult<CursorPage<DropResponse>>>;
433
502
  /** Fetch one drop by its `drop_…` id (not the slug/URL). GET /drops/{id}. */
434
503
  get(dropId: string): Promise<DropthisResult<DropResponse>>;
504
+ /**
505
+ * Resolve a drop URL (or bare slug) back to the drop — the way to recover a lost
506
+ * `drop_…` id. The slug is parsed client-side from the first hostname label of a
507
+ * dropthis-attributable hostname (`https://<slug>.dropthis.app/…`, or `<slug>.` +
508
+ * the configured baseUrl's host), then matched owner-scoped via GET /drops?slug=.
509
+ * Returns the drop, or `data: null` when no drop of yours has that slug.
510
+ * Custom-domain URLs are rejected client-side with `invalid_drop_url` — they are
511
+ * not resolvable yet.
512
+ */
513
+ resolve(urlOrSlug: string): Promise<DropthisResult<DropResponse | null>>;
514
+ /**
515
+ * Read back what a drop is serving (owner-only; works regardless of any viewer
516
+ * password). By default returns the JSON manifest of the CURRENT deployment's files;
517
+ * pass `deploymentId` to read a historical (even superseded) deployment — downloading
518
+ * an old version's files and republishing them via {@link updateContent} is the
519
+ * rollback path. Pass `path` (one of the manifest's `files[].path` values) to download
520
+ * that file's exact stored bytes instead. GET /drops/{id}/content.
521
+ */
522
+ getContent(dropId: string, options: GetContentOptions & {
523
+ path: string;
524
+ }): Promise<DropthisResult<DropContentFile>>;
525
+ getContent(dropId: string, options?: Omit<GetContentOptions, "path">): Promise<DropthisResult<DeploymentContentManifest>>;
435
526
  /**
436
527
  * Change an EXISTING drop's settings — title, visibility, password, noindex, expiry,
437
528
  * metadata — by its `drop_…` id. Does not touch content; replace that with {@link updateContent}.
@@ -442,4 +533,4 @@ declare class DropsResource<TInput = PublishInput> {
442
533
  delete(dropId: string): Promise<DropthisResult<null>>;
443
534
  }
444
535
 
445
- export { AccountResource as A, type UploadTarget as B, type CompleteUploadSessionRequest as C, DeploymentsResource as D, type EmailOtpResponse as E, type InMemoryPublishInput as I, type Limitations as L, type PrepareOptions as P, type RequestControls as R, type SessionResponse as S, type TierInfo as T, type UpdateContentOptions as U, type ActionResolve as a, ApiKeysResource as b, type CreateUploadSessionRequest as c, type CreateUploadSessionResponse as d, CursorPage as e, type DropAction as f, type DropDeploymentResponse as g, type DropOptions as h, type DropResponse as i, DropsResource as j, type DropthisClientOptions as k, type DropthisErrorResponse as l, type DropthisResult as m, type ListDeploymentsParams as n, type ListDeploymentsResponse as o, type ListPage as p, type PreparedPublishRequest as q, type PreparedUploadFile as r, type PublishFileInput as s, type PublishInput as t, type PublishOptions as u, type RequestOptions as v, Transport as w, type UploadManifestFile as x, type UploadSessionFileResponse as y, type UploadSessionResponse as z };
536
+ export { type AccountLimits as A, Transport as B, type CreateUploadSessionRequest as C, type DeploymentContentFile as D, type EmailOtpResponse as E, type UploadManifestFile as F, type GetContentOptions as G, type UploadSessionFileResponse as H, type InMemoryPublishInput as I, type UploadSessionResponse as J, type UploadTarget as K, type Limitations as L, type PrepareOptions as P, type RequestControls as R, type SessionResponse as S, type TierInfo as T, type UpdateContentOptions as U, AccountResource as a, type AccountResponse as b, type ActionResolve as c, ApiKeysResource as d, type CreateUploadSessionResponse as e, CursorPage as f, type DeploymentContentManifest as g, DeploymentsResource as h, type DropAction as i, type DropContentFile as j, type DropDeploymentResponse as k, type DropOptions as l, type DropResponse as m, DropsResource as n, type DropthisClientOptions as o, type DropthisErrorResponse as p, type DropthisResult as q, type ListDeploymentsParams as r, type ListDeploymentsResponse as s, type ListPage as t, type PreparedPublishRequest as u, type PreparedUploadFile as v, type PublishFileInput as w, type PublishInput as x, type PublishOptions as y, type RequestOptions as z };