dropthis 0.1.3 → 0.1.5
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/dist/cli.cjs +86 -23
- package/dist/cli.cjs.map +1 -1
- package/node_modules/@dropthis/sdk/dist/index.cjs +30 -72
- package/node_modules/@dropthis/sdk/dist/index.cjs.map +1 -1
- package/node_modules/@dropthis/sdk/dist/index.d.cts +1 -20
- package/node_modules/@dropthis/sdk/dist/index.d.ts +1 -20
- package/node_modules/@dropthis/sdk/dist/index.mjs +30 -72
- package/node_modules/@dropthis/sdk/dist/index.mjs.map +1 -1
- package/node_modules/@dropthis/sdk/package.json +4 -0
- package/package.json +6 -3
|
@@ -105,16 +105,6 @@ function detectStringInput(value) {
|
|
|
105
105
|
contentType: looksLikeHtml(value) ? "text/html" : "text/plain; charset=utf-8"
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function isTextLikeContentType(contentType) {
|
|
109
|
-
const normalized = contentType.toLowerCase().split(";", 1)[0]?.trim() ?? "";
|
|
110
|
-
return normalized.startsWith("text/") || [
|
|
111
|
-
"application/json",
|
|
112
|
-
"application/javascript",
|
|
113
|
-
"application/xml",
|
|
114
|
-
"application/xhtml+xml",
|
|
115
|
-
"image/svg+xml"
|
|
116
|
-
].includes(normalized);
|
|
117
|
-
}
|
|
118
108
|
function detectBytesContentType(bytes) {
|
|
119
109
|
const text = Buffer.from(bytes).toString("utf8");
|
|
120
110
|
if (text.includes("\uFFFD")) return "application/octet-stream";
|
|
@@ -189,11 +179,12 @@ async function detectPathContentType(path) {
|
|
|
189
179
|
}
|
|
190
180
|
|
|
191
181
|
// src/publish/prepare.ts
|
|
192
|
-
var MAX_INLINE_CONTENT_BYTES = 1048576;
|
|
193
182
|
var SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES = 10 * 1024 * 1024;
|
|
194
183
|
async function preparePublishRequest(input, options = {}) {
|
|
195
184
|
if (input instanceof URL) {
|
|
196
|
-
|
|
185
|
+
throw new Error(
|
|
186
|
+
"URL inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
187
|
+
);
|
|
197
188
|
}
|
|
198
189
|
if (typeof input === "string") {
|
|
199
190
|
const local = await localKind(input);
|
|
@@ -205,7 +196,9 @@ async function preparePublishRequest(input, options = {}) {
|
|
|
205
196
|
}
|
|
206
197
|
const detection = detectStringInput(input);
|
|
207
198
|
if (detection.mode === "sourceUrl")
|
|
208
|
-
|
|
199
|
+
throw new Error(
|
|
200
|
+
"URL inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
201
|
+
);
|
|
209
202
|
return stringContent(input, options, detection.contentType);
|
|
210
203
|
}
|
|
211
204
|
if (input instanceof Uint8Array || Buffer.isBuffer(input)) {
|
|
@@ -215,20 +208,23 @@ async function preparePublishRequest(input, options = {}) {
|
|
|
215
208
|
}
|
|
216
209
|
async function stringContent(content, options, detectedContentType) {
|
|
217
210
|
const contentType = options.contentType ?? detectedContentType;
|
|
218
|
-
const sizeBytes = Buffer.byteLength(content);
|
|
219
|
-
if (sizeBytes <= MAX_INLINE_CONTENT_BYTES && isTextLikeContentType(contentType)) {
|
|
220
|
-
return jsonBody({
|
|
221
|
-
content,
|
|
222
|
-
content_type: contentType,
|
|
223
|
-
...commonFields(options)
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
211
|
return bytesStaged(Buffer.from(content), {
|
|
227
212
|
...options,
|
|
228
|
-
path: options.path ??
|
|
229
|
-
contentType
|
|
213
|
+
path: options.path ?? entryForContentType(contentType),
|
|
214
|
+
contentType
|
|
230
215
|
});
|
|
231
216
|
}
|
|
217
|
+
function entryForContentType(contentType) {
|
|
218
|
+
const normalized = contentType.toLowerCase().split(";", 1)[0]?.trim() ?? "";
|
|
219
|
+
if (normalized === "text/html" || normalized === "application/xhtml+xml")
|
|
220
|
+
return "index.html";
|
|
221
|
+
if (normalized === "application/json") return "index.json";
|
|
222
|
+
if (normalized === "text/css") return "index.css";
|
|
223
|
+
if (normalized === "text/javascript" || normalized === "application/javascript")
|
|
224
|
+
return "index.js";
|
|
225
|
+
if (normalized.startsWith("text/")) return "index.txt";
|
|
226
|
+
return "index";
|
|
227
|
+
}
|
|
232
228
|
async function localKind(input) {
|
|
233
229
|
try {
|
|
234
230
|
const info = await (0, import_promises2.stat)(input);
|
|
@@ -311,15 +307,13 @@ async function explicitInput(input, options) {
|
|
|
311
307
|
input.contentType ?? options.contentType ?? "text/html"
|
|
312
308
|
);
|
|
313
309
|
if ("sourceUrl" in input)
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
});
|
|
310
|
+
throw new Error(
|
|
311
|
+
"sourceUrl inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
312
|
+
);
|
|
318
313
|
if ("sourceUrls" in input)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
});
|
|
314
|
+
throw new Error(
|
|
315
|
+
"sourceUrls inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
316
|
+
);
|
|
323
317
|
return stagedRequest(
|
|
324
318
|
input.files.map((file) => {
|
|
325
319
|
const bytes = explicitFileBytes(file);
|
|
@@ -340,13 +334,6 @@ function explicitFileBytes(file) {
|
|
|
340
334
|
if (file.bytes !== void 0) return file.bytes;
|
|
341
335
|
throw new TypeError(`Explicit file ${file.path} is missing content bytes`);
|
|
342
336
|
}
|
|
343
|
-
function commonFields(options) {
|
|
344
|
-
return {
|
|
345
|
-
...options.entry ? { entry: options.entry } : {},
|
|
346
|
-
options: optionsBody(options),
|
|
347
|
-
...options.metadata ? { metadata: options.metadata } : {}
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
337
|
function optionsBody(options) {
|
|
351
338
|
return toSnakeCase({
|
|
352
339
|
title: options.title,
|
|
@@ -356,9 +343,6 @@ function optionsBody(options) {
|
|
|
356
343
|
expiresAt: options.expiresAt instanceof Date ? options.expiresAt.toISOString() : options.expiresAt
|
|
357
344
|
});
|
|
358
345
|
}
|
|
359
|
-
function jsonBody(body) {
|
|
360
|
-
return { kind: "json", body };
|
|
361
|
-
}
|
|
362
346
|
|
|
363
347
|
// src/publish/upload.ts
|
|
364
348
|
var import_node_crypto2 = require("crypto");
|
|
@@ -736,17 +720,9 @@ function updateBody(body) {
|
|
|
736
720
|
return toSnakeCase({ options: dropOptions, metadata });
|
|
737
721
|
}
|
|
738
722
|
function hasContent(body) {
|
|
739
|
-
return [
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
"content_type",
|
|
743
|
-
"entry",
|
|
744
|
-
"files",
|
|
745
|
-
"sourceUrl",
|
|
746
|
-
"sourceUrls",
|
|
747
|
-
"source_url",
|
|
748
|
-
"source_urls"
|
|
749
|
-
].some((field) => body[field] !== void 0);
|
|
723
|
+
return ["content", "contentType", "content_type", "entry", "files"].some(
|
|
724
|
+
(field) => body[field] !== void 0
|
|
725
|
+
);
|
|
750
726
|
}
|
|
751
727
|
|
|
752
728
|
// src/resources/uploads.ts
|
|
@@ -998,14 +974,6 @@ var Dropthis = class {
|
|
|
998
974
|
}
|
|
999
975
|
async publish(input, options = {}) {
|
|
1000
976
|
const prepared = await preparePublishRequest(input, options);
|
|
1001
|
-
if (prepared.kind === "json") {
|
|
1002
|
-
const requestOptions = {
|
|
1003
|
-
body: prepared.body
|
|
1004
|
-
};
|
|
1005
|
-
if (options.idempotencyKey)
|
|
1006
|
-
requestOptions.idempotencyKey = options.idempotencyKey;
|
|
1007
|
-
return this.transport.request("POST", "/drops", requestOptions);
|
|
1008
|
-
}
|
|
1009
977
|
return publishStaged(this.transport, prepared, "/drops", options);
|
|
1010
978
|
}
|
|
1011
979
|
async update(dropId, inputOrOptions = {}, options = {}) {
|
|
@@ -1017,16 +985,6 @@ var Dropthis = class {
|
|
|
1017
985
|
options
|
|
1018
986
|
);
|
|
1019
987
|
const path = `/drops/${encodeURIComponent(dropId)}/deployments`;
|
|
1020
|
-
if (prepared.kind === "json") {
|
|
1021
|
-
const requestOptions = {
|
|
1022
|
-
body: prepared.body
|
|
1023
|
-
};
|
|
1024
|
-
if (options.idempotencyKey)
|
|
1025
|
-
requestOptions.idempotencyKey = options.idempotencyKey;
|
|
1026
|
-
if (options.ifRevision !== void 0)
|
|
1027
|
-
requestOptions.ifRevision = options.ifRevision;
|
|
1028
|
-
return this.transport.request("POST", path, requestOptions);
|
|
1029
|
-
}
|
|
1030
988
|
return publishStaged(this.transport, prepared, path, options);
|
|
1031
989
|
}
|
|
1032
990
|
request(method, path, options = {}) {
|
|
@@ -1037,9 +995,9 @@ var Dropthis = class {
|
|
|
1037
995
|
}
|
|
1038
996
|
};
|
|
1039
997
|
function looksLikeOptionsOnly(input) {
|
|
1040
|
-
if (input instanceof
|
|
998
|
+
if (input instanceof Uint8Array) return false;
|
|
1041
999
|
if (typeof input !== "object" || input === null) return false;
|
|
1042
|
-
return !("content" in input || "files" in input
|
|
1000
|
+
return !("content" in input || "files" in input);
|
|
1043
1001
|
}
|
|
1044
1002
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1045
1003
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/publish/prepare.ts","../src/case.ts","../src/publish/checksum.ts","../src/publish/detect.ts","../src/publish/files.ts","../src/publish/upload.ts","../src/errors.ts","../src/resources/account.ts","../src/resources/api-keys.ts","../src/resources/auth.ts","../src/resources/deployments.ts","../src/types.ts","../src/resources/drops.ts","../src/resources/uploads.ts","../src/transport.ts","../src/dropthis.ts"],"sourcesContent":["export { Dropthis } from \"./dropthis.js\";\nexport { createErrorResult, redactSecrets } from \"./errors.js\";\nexport type {\n\tPreparedPublishRequest,\n\tPreparedUploadFile,\n} from \"./publish/prepare.js\";\nexport { DeploymentsResource } from \"./resources/deployments.js\";\nexport { UploadsResource } from \"./resources/uploads.js\";\nexport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisErrorResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n\tListPage,\n\tRequestOptions,\n\tUploadManifestFile,\n\tUploadPartTarget,\n\tUploadSessionFileResponse,\n\tUploadSessionResponse,\n\tUploadTarget,\n} from \"./types.js\";\n","import { stat } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport { toSnakeCase } from \"../case.js\";\nimport type {\n\tCreateUploadSessionRequest,\n\tExplicitPublishInput,\n\tPublishInput,\n\tPublishOptions,\n\tUploadManifestFile,\n} from \"../types.js\";\nimport { sha256Bytes, sha256File } from \"./checksum.js\";\nimport {\n\tdetectBytesContentType,\n\tdetectStringInput,\n\tisTextLikeContentType,\n} from \"./detect.js\";\nimport { collectPublishFiles, detectPathContentType } from \"./files.js\";\n\nconst MAX_INLINE_CONTENT_BYTES = 1_048_576;\nconst SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES = 10 * 1024 * 1024;\n\nexport type PreparedUploadFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string;\n\tsource: { kind: \"path\"; path: string } | { kind: \"bytes\"; bytes: Uint8Array };\n};\n\ntype ExplicitFileInput = Extract<\n\tExplicitPublishInput,\n\t{ files: unknown }\n>[\"files\"][number];\n\nexport type PreparedPublishRequest =\n\t| { kind: \"json\"; body: Record<string, unknown> }\n\t| {\n\t\t\tkind: \"staged\";\n\t\t\tmanifest: CreateUploadSessionRequest;\n\t\t\tfiles: PreparedUploadFile[];\n\t\t\toptions: Record<string, unknown>;\n\t\t\tmetadata?: Record<string, unknown>;\n\t };\n\nexport async function preparePublishRequest(\n\tinput: PublishInput,\n\toptions: PublishOptions = {},\n): Promise<PreparedPublishRequest> {\n\tif (input instanceof URL) {\n\t\treturn jsonBody({ source_url: input.toString(), ...commonFields(options) });\n\t}\n\tif (typeof input === \"string\") {\n\t\tconst local = await localKind(input);\n\t\tif (local === \"file\") {\n\t\t\treturn fileStaged(input, options);\n\t\t}\n\t\tif (local === \"directory\") {\n\t\t\treturn folderStaged(input, options);\n\t\t}\n\t\tconst detection = detectStringInput(input);\n\t\tif (detection.mode === \"sourceUrl\")\n\t\t\treturn jsonBody({ source_url: input, ...commonFields(options) });\n\t\treturn stringContent(input, options, detection.contentType);\n\t}\n\tif (input instanceof Uint8Array || Buffer.isBuffer(input)) {\n\t\treturn bytesStaged(input, options);\n\t}\n\treturn explicitInput(input, options);\n}\n\nasync function stringContent(\n\tcontent: string,\n\toptions: PublishOptions,\n\tdetectedContentType: string,\n): Promise<PreparedPublishRequest> {\n\tconst contentType = options.contentType ?? detectedContentType;\n\tconst sizeBytes = Buffer.byteLength(content);\n\tif (\n\t\tsizeBytes <= MAX_INLINE_CONTENT_BYTES &&\n\t\tisTextLikeContentType(contentType)\n\t) {\n\t\treturn jsonBody({\n\t\t\tcontent,\n\t\t\tcontent_type: contentType,\n\t\t\t...commonFields(options),\n\t\t});\n\t}\n\treturn bytesStaged(Buffer.from(content), {\n\t\t...options,\n\t\tpath: options.path ?? \"index.html\",\n\t\tcontentType: options.contentType ?? \"text/html\",\n\t});\n}\n\nasync function localKind(\n\tinput: string,\n): Promise<\"file\" | \"directory\" | \"none\"> {\n\ttry {\n\t\tconst info = await stat(input);\n\t\tif (info.isFile()) return \"file\";\n\t\tif (info.isDirectory()) return \"directory\";\n\t\treturn \"none\";\n\t} catch {\n\t\treturn \"none\";\n\t}\n}\n\nasync function fileStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst fileStat = await stat(path);\n\tconst manifestPath = options.path ?? basename(path);\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: manifestPath,\n\t\t\t\tcontentType: options.contentType ?? (await detectPathContentType(path)),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t\tsource: { kind: \"path\", path },\n\t\t\t},\n\t\t],\n\t\t{ ...options, entry: options.entry ?? manifestPath },\n\t);\n}\n\nasync function folderStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst files = (await collectPublishFiles(path, options)).map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\tsource: { kind: \"path\", path: file.absolutePath } as const,\n\t}));\n\treturn stagedRequest(files, options);\n}\n\nasync function bytesStaged(\n\tbytes: Uint8Array,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: options.path ?? \"index\",\n\t\t\t\tcontentType: options.contentType ?? detectBytesContentType(bytes),\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes },\n\t\t\t},\n\t\t],\n\t\toptions,\n\t);\n}\n\nasync function stagedRequest(\n\tfiles: PreparedUploadFile[],\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst preparedFiles = await Promise.all(\n\t\tfiles.map(async (file) => {\n\t\t\tif (file.sizeBytes <= SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES) return file;\n\t\t\tconst checksumSha256 =\n\t\t\t\tfile.source.kind === \"bytes\"\n\t\t\t\t\t? sha256Bytes(file.source.bytes)\n\t\t\t\t\t: await sha256File(file.source.path);\n\t\t\treturn { ...file, checksumSha256 };\n\t\t}),\n\t);\n\tconst manifestFiles: UploadManifestFile[] = preparedFiles.map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\t...(file.checksumSha256 ? { checksumSha256: file.checksumSha256 } : {}),\n\t}));\n\tconst prepared: Extract<PreparedPublishRequest, { kind: \"staged\" }> = {\n\t\tkind: \"staged\",\n\t\tmanifest: {\n\t\t\tschemaVersion: 1,\n\t\t\tfiles: manifestFiles,\n\t\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\t},\n\t\tfiles: preparedFiles,\n\t\toptions: optionsBody(options),\n\t};\n\tif (options.metadata) prepared.metadata = options.metadata;\n\treturn prepared;\n}\n\nasync function explicitInput(\n\tinput: ExplicitPublishInput,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tif (\"content\" in input)\n\t\treturn stringContent(\n\t\t\tinput.content,\n\t\t\t{ ...options, ...input },\n\t\t\tinput.contentType ?? options.contentType ?? \"text/html\",\n\t\t);\n\tif (\"sourceUrl\" in input)\n\t\treturn jsonBody({\n\t\t\tsource_url: input.sourceUrl,\n\t\t\t...commonFields({ ...options, ...input }),\n\t\t});\n\tif (\"sourceUrls\" in input)\n\t\treturn jsonBody({\n\t\t\tsource_urls: input.sourceUrls.map((item) => toSnakeCase(item)),\n\t\t\t...commonFields({ ...options, ...input }),\n\t\t});\n\treturn stagedRequest(\n\t\tinput.files.map((file) => {\n\t\t\tconst bytes = explicitFileBytes(file);\n\t\t\treturn {\n\t\t\t\tpath: file.path,\n\t\t\t\tcontentType: file.contentType,\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes } as const,\n\t\t\t};\n\t\t}),\n\t\t{ ...options, ...input },\n\t);\n}\n\nfunction explicitFileBytes(file: ExplicitFileInput): Uint8Array {\n\tif (file.content !== undefined) return Buffer.from(file.content);\n\tif (file.contentBase64 !== undefined)\n\t\treturn Buffer.from(file.contentBase64, \"base64\");\n\tif (file.bytes !== undefined) return file.bytes;\n\tthrow new TypeError(`Explicit file ${file.path} is missing content bytes`);\n}\n\nfunction commonFields(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): Record<string, unknown> {\n\treturn {\n\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\toptions: optionsBody(options),\n\t\t...(options.metadata ? { metadata: options.metadata } : {}),\n\t};\n}\n\nfunction optionsBody(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): Record<string, unknown> {\n\treturn toSnakeCase({\n\t\ttitle: options.title,\n\t\tvisibility: options.visibility,\n\t\tpassword: options.password,\n\t\tnoindex: options.noindex,\n\t\texpiresAt:\n\t\t\toptions.expiresAt instanceof Date\n\t\t\t\t? options.expiresAt.toISOString()\n\t\t\t\t: options.expiresAt,\n\t}) as Record<string, unknown>;\n}\n\nfunction jsonBody(body: Record<string, unknown>): PreparedPublishRequest {\n\treturn { kind: \"json\", body };\n}\n","export function toCamelKey(key: string): string {\n\treturn key.replace(/_([a-z])/g, (_, char: string) => char.toUpperCase());\n}\n\nexport function toSnakeKey(key: string): string {\n\treturn key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`);\n}\n\nexport function toCamelCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toCamelCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value).map(([key, item]) => [\n\t\t\t\ttoCamelKey(key),\n\t\t\t\ttoCamelCase(item),\n\t\t\t]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function toSnakeCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toSnakeCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value)\n\t\t\t\t.filter(([, item]) => item !== undefined)\n\t\t\t\t.map(([key, item]) => [toSnakeKey(key), toSnakeCase(item)]),\n\t\t);\n\t}\n\treturn value;\n}\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\n\nexport function sha256Bytes(bytes: Uint8Array): string {\n\treturn createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nexport async function sha256File(path: string): Promise<string> {\n\tconst hash = createHash(\"sha256\");\n\tfor await (const chunk of createReadStream(path)) {\n\t\thash.update(chunk);\n\t}\n\treturn hash.digest(\"hex\");\n}\n","export type StringInputDetection =\n\t| { mode: \"sourceUrl\" }\n\t| {\n\t\t\tmode: \"content\";\n\t\t\tcontentType: \"text/html\" | \"text/plain; charset=utf-8\";\n\t };\n\nexport function isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn url.protocol === \"http:\" || url.protocol === \"https:\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function looksLikeHtml(value: string): boolean {\n\tconst trimmed = value.trimStart().toLowerCase();\n\treturn (\n\t\ttrimmed.startsWith(\"<!doctype html\") ||\n\t\ttrimmed.startsWith(\"<html\") ||\n\t\t/^<[a-z][a-z0-9:-]*(\\s|>)/.test(trimmed)\n\t);\n}\n\nexport function detectStringInput(value: string): StringInputDetection {\n\tif (isHttpUrl(value)) return { mode: \"sourceUrl\" };\n\treturn {\n\t\tmode: \"content\",\n\t\tcontentType: looksLikeHtml(value)\n\t\t\t? \"text/html\"\n\t\t\t: \"text/plain; charset=utf-8\",\n\t};\n}\n\nexport function isTextLikeContentType(contentType: string): boolean {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\treturn (\n\t\tnormalized.startsWith(\"text/\") ||\n\t\t[\n\t\t\t\"application/json\",\n\t\t\t\"application/javascript\",\n\t\t\t\"application/xml\",\n\t\t\t\"application/xhtml+xml\",\n\t\t\t\"image/svg+xml\",\n\t\t].includes(normalized)\n\t);\n}\n\nexport function detectBytesContentType(bytes: Uint8Array): string {\n\tconst text = Buffer.from(bytes).toString(\"utf8\");\n\tif (text.includes(\"\\uFFFD\")) return \"application/octet-stream\";\n\treturn looksLikeHtml(text) ? \"text/html\" : \"text/plain; charset=utf-8\";\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport { basename, sep } from \"node:path\";\nimport fg from \"fast-glob\";\nimport ignore from \"ignore\";\nimport { lookup } from \"mime-types\";\nimport { detectBytesContentType } from \"./detect.js\";\n\nexport type PublishFile = {\n\tabsolutePath: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\nconst DEFAULT_IGNORES = [\n\t\".git\",\n\t\".git/**\",\n\t\"node_modules\",\n\t\"node_modules/**\",\n\t\".DS_Store\",\n\t\".env\",\n\t\".env.*\",\n\t\".cache\",\n\t\".cache/**\",\n\t\".tmp\",\n\t\".tmp/**\",\n\t\"dist/.cache\",\n\t\"dist/.cache/**\",\n];\n\nexport async function collectPublishFiles(\n\tinputPath: string,\n\toptions: { ignore?: string[]; ignoreDefaults?: boolean } = {},\n): Promise<PublishFile[]> {\n\tconst inputStat = await stat(inputPath);\n\tif (inputStat.isFile()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tabsolutePath: inputPath,\n\t\t\t\tpath: basename(inputPath),\n\t\t\t\tcontentType: await detectPathContentType(inputPath),\n\t\t\t\tsizeBytes: inputStat.size,\n\t\t\t},\n\t\t];\n\t}\n\tif (!inputStat.isDirectory()) {\n\t\tthrow new Error(`Input is not a file or directory: ${inputPath}`);\n\t}\n\n\tconst matcher = ignore().add([\n\t\t...(options.ignoreDefaults === false ? [] : DEFAULT_IGNORES),\n\t\t...(options.ignore ?? []),\n\t]);\n\tconst entries = await fg(\"**/*\", {\n\t\tcwd: inputPath,\n\t\tonlyFiles: true,\n\t\tfollowSymbolicLinks: false,\n\t\tdot: true,\n\t\tunique: true,\n\t});\n\tconst paths = entries\n\t\t.map((entry) => entry.split(sep).join(\"/\"))\n\t\t.filter((entry) => !matcher.ignores(entry))\n\t\t.sort((a, b) => a.localeCompare(b));\n\treturn Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst absolutePath = `${inputPath}/${path}`;\n\t\t\tconst fileStat = await stat(absolutePath);\n\t\t\treturn {\n\t\t\t\tabsolutePath,\n\t\t\t\tpath,\n\t\t\t\tcontentType: await detectPathContentType(absolutePath),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t};\n\t\t}),\n\t);\n}\n\nexport async function detectPathContentType(path: string): Promise<string> {\n\tconst detected = lookup(path);\n\tif (detected) return detected;\n\treturn detectBytesContentType(await readFile(path));\n}\n","import { randomUUID } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { toSnakeCase } from \"../case.js\";\nimport { createErrorResult } from \"../errors.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionResponse,\n\tDropResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\nimport type { PreparedPublishRequest, PreparedUploadFile } from \"./prepare.js\";\n\ntype PreparedStagedPublish = Extract<\n\tPreparedPublishRequest,\n\t{ kind: \"staged\" }\n>;\n\ntype StagedPublishOptions = {\n\tidempotencyKey?: string;\n\tifRevision?: number;\n};\n\nconst MAX_PART_TARGETS_PER_REQUEST = 100;\n\nexport async function publishStaged(\n\ttransport: Transport,\n\tprepared: PreparedStagedPublish,\n\tfinalPath: string,\n\toptions: StagedPublishOptions = {},\n): Promise<DropthisResult<DropResponse>> {\n\tconst baseKey = options.idempotencyKey ?? `sdk-${randomUUID()}`;\n\tconst createResult = await transport.request<CreateUploadSessionResponse>(\n\t\t\"POST\",\n\t\t\"/uploads\",\n\t\t{\n\t\t\tbody: toSnakeCase(prepared.manifest),\n\t\t\tidempotencyKey: `${baseKey}:create-upload`,\n\t\t},\n\t);\n\tif (createResult.error) return errorResult(createResult);\n\n\tconst completedFiles: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> }\n\t> = {};\n\tfor (const file of prepared.files) {\n\t\tconst target = createResult.data.files.find(\n\t\t\t(candidate) => candidate.path === file.path,\n\t\t);\n\t\tif (!target) {\n\t\t\treturn createErrorResult(\n\t\t\t\t\"upload_target_missing\",\n\t\t\t\t`Upload target missing for ${file.path}`,\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\t\tif (target.upload.strategy === \"multipart\") {\n\t\t\tconst partsResult = await uploadMultipartFile(\n\t\t\t\ttransport,\n\t\t\t\tcreateResult.data.uploadId,\n\t\t\t\ttarget.fileId,\n\t\t\t\tfile,\n\t\t\t\ttarget.upload.partSize,\n\t\t\t);\n\t\t\tif (partsResult.error) return errorResult(partsResult);\n\t\t\tcompletedFiles[target.fileId] = { parts: partsResult.data };\n\t\t\tcontinue;\n\t\t}\n\t\tconst bytes = await fileBytes(file);\n\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\ttarget.upload.url,\n\t\t\tbytes,\n\t\t\ttarget.upload.headers,\n\t\t);\n\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t}\n\n\tconst completeResult = await transport.request<UploadSessionResponse>(\n\t\t\"POST\",\n\t\t`/uploads/${encodeURIComponent(createResult.data.uploadId)}/complete`,\n\t\t{\n\t\t\tbody: toSnakeCase({ files: completedFiles }),\n\t\t\tidempotencyKey: `${baseKey}:complete-upload`,\n\t\t},\n\t);\n\tif (completeResult.error) return errorResult(completeResult);\n\n\tconst finalOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\tbody: {\n\t\t\tupload_id: createResult.data.uploadId,\n\t\t\toptions: prepared.options,\n\t\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\t},\n\t\tidempotencyKey: `${baseKey}:publish`,\n\t};\n\tif (options.ifRevision !== undefined)\n\t\tfinalOptions.ifRevision = options.ifRevision;\n\treturn transport.request(\"POST\", finalPath, finalOptions);\n}\n\nasync function uploadMultipartFile(\n\ttransport: Transport,\n\tuploadId: string,\n\tfileId: string,\n\tfile: PreparedUploadFile,\n\tpartSize: number | undefined,\n): Promise<DropthisResult<Array<{ partNumber: number; etag: string }>>> {\n\tif (!partSize || partSize < 1) {\n\t\treturn createErrorResult(\n\t\t\t\"invalid_upload_target\",\n\t\t\t\"Multipart upload target did not include a valid part size.\",\n\t\t\tnull,\n\t\t);\n\t}\n\tconst bytes = await fileBytes(file);\n\tconst partNumbers = Array.from(\n\t\t{ length: Math.ceil(bytes.byteLength / partSize) },\n\t\t(_, index) => index + 1,\n\t);\n\tconst parts: Array<{ partNumber: number; etag: string }> = [];\n\tfor (\n\t\tlet startIndex = 0;\n\t\tstartIndex < partNumbers.length;\n\t\tstartIndex += MAX_PART_TARGETS_PER_REQUEST\n\t) {\n\t\tconst partNumberBatch = partNumbers.slice(\n\t\t\tstartIndex,\n\t\t\tstartIndex + MAX_PART_TARGETS_PER_REQUEST,\n\t\t);\n\t\tconst targetsResult =\n\t\t\tawait transport.request<CreateUploadPartTargetsResponse>(\n\t\t\t\t\"POST\",\n\t\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t\t{ body: toSnakeCase({ fileId, partNumbers: partNumberBatch }) },\n\t\t\t);\n\t\tif (targetsResult.error) return errorResult(targetsResult);\n\t\tfor (const target of targetsResult.data.parts) {\n\t\t\tconst start = (target.partNumber - 1) * partSize;\n\t\t\tconst end = Math.min(start + partSize, bytes.byteLength);\n\t\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\t\ttarget.url,\n\t\t\t\tbytes.slice(start, end),\n\t\t\t\ttarget.headers,\n\t\t\t);\n\t\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t\t\tif (!uploadResult.data.etag) {\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t\"missing_upload_etag\",\n\t\t\t\t\t\"Signed upload response did not include an ETag.\",\n\t\t\t\t\tnull,\n\t\t\t\t);\n\t\t\t}\n\t\t\tparts.push({\n\t\t\t\tpartNumber: target.partNumber,\n\t\t\t\tetag: uploadResult.data.etag,\n\t\t\t});\n\t\t}\n\t}\n\treturn { data: parts, error: null, headers: {} };\n}\n\nasync function fileBytes(file: PreparedUploadFile): Promise<Uint8Array> {\n\tif (file.source.kind === \"bytes\") return file.source.bytes;\n\treturn readFile(file.source.path);\n}\n\nfunction errorResult<T>(result: DropthisResult<unknown>): DropthisResult<T> {\n\tif (!result.error) throw new Error(\"Expected an error result\");\n\treturn { data: null, error: result.error, headers: result.headers };\n}\n","import type { DropthisResult } from \"./types.js\";\n\nconst API_KEY_RE = /sk_[A-Za-z0-9_-]+/g;\n\nexport function redactSecrets(message: string): string {\n\treturn message.replace(API_KEY_RE, \"sk_[redacted]\");\n}\n\nexport function createErrorResult<T>(\n\tcode: string,\n\tmessage: string,\n\tstatusCode: number | null,\n\textra: {\n\t\ttype?: string;\n\t\tdetail?: unknown;\n\t\tparam?: string | null;\n\t\tcurrentRevision?: number;\n\t\trequestId?: string | null;\n\t\theaders?: Record<string, string>;\n\t} = {},\n): DropthisResult<T> {\n\treturn {\n\t\tdata: null,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage: redactSecrets(message),\n\t\t\tstatusCode,\n\t\t\t...(extra.type ? { type: extra.type } : {}),\n\t\t\t...(extra.detail !== undefined ? { detail: extra.detail } : {}),\n\t\t\t...(extra.param !== undefined ? { param: extra.param } : {}),\n\t\t\t...(extra.currentRevision !== undefined\n\t\t\t\t? { currentRevision: extra.currentRevision }\n\t\t\t\t: {}),\n\t\t\t...(extra.requestId !== undefined ? { requestId: extra.requestId } : {}),\n\t\t},\n\t\theaders: extra.headers ?? {},\n\t};\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type { AccountResponse, DropthisResult } from \"../types.js\";\n\nexport class AccountResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tget(): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"GET\", \"/account\");\n\t}\n\n\tupdate(input: {\n\t\tdisplayName: string | null;\n\t}): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"PATCH\", \"/account\", {\n\t\t\tbody: toSnakeCase(input),\n\t\t});\n\t}\n\n\tdelete(): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\"DELETE\", \"/account\");\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tApiKeyCreatedResponse,\n\tApiKeyResponse,\n\tDropthisResult,\n} from \"../types.js\";\n\nexport class ApiKeysResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tlist(): Promise<DropthisResult<{ object: \"list\"; data: ApiKeyResponse[] }>> {\n\t\treturn this.transport.request(\"GET\", \"/api-keys\");\n\t}\n\n\tcreate(input: {\n\t\tlabel: string;\n\t}): Promise<DropthisResult<ApiKeyCreatedResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/api-keys\", { body: input });\n\t}\n\n\tdelete(keyId: string): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/api-keys/${encodeURIComponent(keyId)}`,\n\t\t);\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tDropthisResult,\n\tEmailOtpResponse,\n\tSessionResponse,\n} from \"../types.js\";\n\nexport class AuthResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\trequestEmailOtp(input: {\n\t\temail: string;\n\t}): Promise<DropthisResult<EmailOtpResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/otp\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tverifyEmailOtp(input: {\n\t\temail: string;\n\t\tcode: string;\n\t}): Promise<DropthisResult<SessionResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/verify\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tlogout(): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\"DELETE\", \"/auth/session\");\n\t}\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n} from \"../types.js\";\n\nexport class DeploymentsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tdropId: string,\n\t\tbody: Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcreateRaw(\n\t\tdropId: string,\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tlist(\n\t\tdropId: string,\n\t\tparams: ListDeploymentsParams = {},\n\t): Promise<DropthisResult<ListDeploymentsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\t{\n\t\t\t\tparams: toSnakeCase(params) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tstring | number | boolean\n\t\t\t\t>,\n\t\t\t},\n\t\t);\n\t}\n\n\tget(\n\t\tdropId: string,\n\t\tdeploymentId: string,\n\t): Promise<DropthisResult<DropDeploymentResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments/${encodeURIComponent(deploymentId)}`,\n\t\t);\n\t}\n}\n","export type DropthisClientOptions = {\n\tapiKey?: string;\n\tbaseUrl?: string;\n\ttimeoutMs?: number;\n\tfetch?: typeof globalThis.fetch;\n};\n\nexport type RequestOptions = {\n\tauthenticated?: boolean;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\ttimeoutMs?: number;\n};\n\nexport type DropthisErrorResponse = {\n\tcode: string;\n\tmessage: string;\n\tstatusCode: number | null;\n\ttype?: string;\n\tdetail?: unknown;\n\tparam?: string | null;\n\tcurrentRevision?: number;\n\trequestId?: string | null;\n};\n\nexport type DropthisResult<T> =\n\t| { data: T; error: null; headers: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: DropthisErrorResponse;\n\t\t\theaders: Record<string, string>;\n\t };\n\nexport type DropResponse = {\n\tid: string;\n\tslug: string;\n\turl: string;\n\tcanonicalHost: string;\n\tdeploymentId: string | null;\n\ttitle: string;\n\tcontentType: string;\n\tvisibility: string;\n\tstatus: string;\n\trevision: number;\n\tcontentRevision: number;\n\taccessRevision: number;\n\tsizeBytes: number;\n\trenderMode: string;\n\twarnings: Array<Record<string, unknown>>;\n\tcreatedAt: string;\n\texpiresAt: string | null;\n};\n\nexport type DropDeploymentResponse = {\n\tid: string;\n\tdropId: string;\n\trevision: number;\n\tstatus: string;\n\tstoragePrefix: string;\n\tentry: string | null;\n\tcontentType: string;\n\trenderMode: string;\n\tfiles: Array<Record<string, unknown>>;\n\twarnings: Array<Record<string, unknown>>;\n\tsizeBytes: number;\n\tclassificationVersion: number;\n\tclassificationReason: string;\n\terrorCode: string | null;\n\terrorMessage: string | null;\n\tcreatedAt: string;\n\treadyAt: string | null;\n\tpublishedAt: string | null;\n};\n\nexport type ListDeploymentsParams = { cursor?: string | null; limit?: number };\n\nexport type ListDeploymentsResponse = {\n\tdeployments: DropDeploymentResponse[];\n\tnextCursor: string | null;\n};\n\nexport type ListPage<T> = {\n\tobject: \"list\";\n\tdata: T[];\n\thasMore: boolean;\n\tnextCursor: string | null;\n\tautoPagingToArray(options?: { limit?: number }): Promise<T[]>;\n\t[Symbol.asyncIterator](): AsyncIterableIterator<T>;\n};\n\nexport type EmailOtpResponse = { ok: true; expiresIn: number };\nexport type SessionResponse = {\n\tobject: \"session\";\n\ttoken: string;\n\taccountId: string;\n\tisNewAccount: boolean;\n\texpiresIn: number;\n};\nexport type ApiKeyResponse = {\n\tobject: \"api_key\";\n\tid: string;\n\tkeyLast4: string;\n\tlabel: string;\n\tcreatedAt: string;\n};\nexport type ApiKeyCreatedResponse = ApiKeyResponse & {\n\tkey: string;\n\taccountId?: string | null;\n\tisNewAccount?: boolean;\n};\nexport type AccountResponse = {\n\tid: string;\n\temail: string;\n\tdisplayName: string | null;\n\tplan: string;\n\tstatus: string;\n\tcreatedAt: string;\n};\nexport type ListDropsParams = { cursor?: string | null; limit?: number };\n\nexport type UploadManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string | null;\n};\n\nexport type CreateUploadSessionRequest = {\n\tschemaVersion?: 1;\n\tfiles: UploadManifestFile[];\n\tentry?: string | null;\n};\n\nexport type UploadTarget = {\n\tstrategy: \"single_put\" | \"multipart\";\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n\tpartSize?: number;\n\tpartCount?: number;\n};\n\nexport type CreateUploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tobjectKey: string;\n\tupload: UploadTarget;\n};\n\nexport type UploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tobjectKey: string;\n\tverified: boolean;\n};\n\nexport type UploadSessionResponse = {\n\tuploadId: string;\n\tstatus: string;\n\texpiresAt: string;\n\tentry?: string | null;\n\tfiles: UploadSessionFileResponse[];\n};\n\nexport type CreateUploadSessionResponse = {\n\tuploadId: string;\n\texpiresAt: string;\n\tfiles: CreateUploadSessionFileResponse[];\n};\n\nexport type CreateUploadPartTargetsRequest = {\n\tfileId: string;\n\tpartNumbers: number[];\n};\n\nexport type UploadPartTarget = {\n\tpartNumber: number;\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n};\n\nexport type CreateUploadPartTargetsResponse = {\n\tfileId: string;\n\turlExpiresAt?: string | null;\n\tparts: UploadPartTarget[];\n};\n\nexport type CompleteUploadSessionRequest = {\n\tfiles?: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> | null }\n\t>;\n};\n\nexport class CursorPage<T> implements ListPage<T> {\n\treadonly object = \"list\" as const;\n\treadonly data: T[];\n\treadonly hasMore: boolean;\n\treadonly nextCursor: string | null;\n\tprivate readonly fetchNextPage:\n\t\t| (() => Promise<DropthisResult<CursorPage<T>>>)\n\t\t| undefined;\n\n\tconstructor(input: {\n\t\tdata: T[];\n\t\thasMore: boolean;\n\t\tnextCursor: string | null;\n\t\tfetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;\n\t}) {\n\t\tthis.data = input.data;\n\t\tthis.hasMore = input.hasMore;\n\t\tthis.nextCursor = input.nextCursor;\n\t\tthis.fetchNextPage = input.fetchNextPage;\n\t}\n\n\tasync autoPagingToArray(options: { limit?: number } = {}): Promise<T[]> {\n\t\tconst items: T[] = [];\n\t\tfor await (const item of this) {\n\t\t\titems.push(item);\n\t\t\tif (options.limit !== undefined && items.length >= options.limit) break;\n\t\t}\n\t\treturn items;\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncIterableIterator<T> {\n\t\tfor (const item of this.data) yield item;\n\t\tlet current: CursorPage<T> = this;\n\t\twhile (current.hasMore && current.fetchNextPage) {\n\t\t\tconst next = await current.fetchNextPage();\n\t\t\tif (next.error) break;\n\t\t\tcurrent = next.data;\n\t\t\tfor (const item of current.data) yield item;\n\t\t}\n\t}\n}\n\nexport type PublishOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean | null;\n\texpiresAt?: string | Date | null;\n\tentry?: string;\n\tmetadata?: Record<string, unknown>;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\tignore?: string[];\n\tignoreDefaults?: boolean;\n\tcontentType?: string;\n\tpath?: string;\n};\n\nexport type UpdateOptions = PublishOptions;\nexport type UpdateTarget = string;\n\nexport type ExplicitPublishInput =\n\t| {\n\t\t\tcontent: string;\n\t\t\tcontentType?: string;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t }\n\t| {\n\t\t\tsourceUrl: string;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t }\n\t| {\n\t\t\tsourceUrls: Array<{ url: string; path: string; contentType?: string }>;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t }\n\t| {\n\t\t\tfiles: Array<{\n\t\t\t\tpath: string;\n\t\t\t\tcontent?: string;\n\t\t\t\tcontentBase64?: string;\n\t\t\t\tbytes?: Uint8Array;\n\t\t\t\tcontentType: string;\n\t\t\t}>;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t };\n\nexport type PublishInput = string | URL | Uint8Array | ExplicitPublishInput;\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport {\n\tCursorPage,\n\ttype DropResponse,\n\ttype DropthisResult,\n\ttype ListDropsParams,\n\ttype PublishOptions,\n} from \"../types.js\";\n\nexport class DropsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tcreateRaw(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tasync list(\n\t\tparams: ListDropsParams = {},\n\t): Promise<DropthisResult<CursorPage<DropResponse>>> {\n\t\tconst result = await this.transport.request<{\n\t\t\tdrops: DropResponse[];\n\t\t\tnextCursor: string | null;\n\t\t}>(\"GET\", \"/drops\", {\n\t\t\tparams: toSnakeCase(params) as Record<string, string | number | boolean>,\n\t\t});\n\t\tif (result.error) return result;\n\t\tconst page = new CursorPage<DropResponse>({\n\t\t\tdata: result.data.drops,\n\t\t\tnextCursor: result.data.nextCursor,\n\t\t\thasMore: result.data.nextCursor !== null,\n\t\t\tfetchNextPage: result.data.nextCursor\n\t\t\t\t? () => this.list({ ...params, cursor: result.data.nextCursor })\n\t\t\t\t: undefined,\n\t\t});\n\t\treturn { data: page, error: null, headers: result.headers };\n\t}\n\n\tget(dropId: string): Promise<DropthisResult<DropResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n\n\tupdate(\n\t\tdropId: string,\n\t\tbody: PublishOptions | Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst bodyRecord = body as Record<string, unknown>;\n\t\tif (hasContent(bodyRecord)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"drops.update() only patches drop options; use deployments.create() or update() for content\",\n\t\t\t);\n\t\t}\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: updateBody(body),\n\t\t};\n\t\tconst bodyOptions = body as PublishOptions;\n\t\tconst idempotencyKey = options.idempotencyKey ?? bodyOptions.idempotencyKey;\n\t\tconst ifRevision = options.ifRevision ?? bodyOptions.ifRevision;\n\t\tif (idempotencyKey) requestOptions.idempotencyKey = idempotencyKey;\n\t\tif (ifRevision !== undefined) requestOptions.ifRevision = ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"PATCH\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tdelete(dropId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n}\n\nfunction updateBody(body: PublishOptions | Record<string, unknown>): unknown {\n\tconst {\n\t\tmetadata,\n\t\tidempotencyKey: _idempotencyKey,\n\t\tifRevision: _ifRevision,\n\t\tignore: _ignore,\n\t\tignoreDefaults: _ignoreDefaults,\n\t\tcontentType: _contentType,\n\t\tpath: _path,\n\t\tentry: _entry,\n\t\t...dropOptions\n\t} = body as PublishOptions;\n\treturn toSnakeCase({ options: dropOptions, metadata });\n}\n\nfunction hasContent(body: Record<string, unknown>): boolean {\n\treturn [\n\t\t\"content\",\n\t\t\"contentType\",\n\t\t\"content_type\",\n\t\t\"entry\",\n\t\t\"files\",\n\t\t\"sourceUrl\",\n\t\t\"sourceUrls\",\n\t\t\"source_url\",\n\t\t\"source_urls\",\n\t].some((field) => body[field] !== undefined);\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\n\nexport class UploadsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: CreateUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<CreateUploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/uploads\", requestOptions);\n\t}\n\n\tget(uploadId: string): Promise<DropthisResult<UploadSessionResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n\n\tcreatePartTargets(\n\t\tuploadId: string,\n\t\tbody: CreateUploadPartTargetsRequest,\n\t): Promise<DropthisResult<CreateUploadPartTargetsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t{ body: toSnakeCase(body) },\n\t\t);\n\t}\n\n\tcomplete(\n\t\tuploadId: string,\n\t\tbody: CompleteUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<UploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/complete`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcancel(uploadId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n}\n","import { toCamelCase } from \"./case.js\";\nimport { createErrorResult } from \"./errors.js\";\nimport type {\n\tDropthisClientOptions,\n\tDropthisResult,\n\tRequestOptions,\n} from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.dropthis.app\";\nconst SDK_VERSION = \"0.1.0\";\n\nexport class Transport {\n\treadonly apiKey: string | undefined;\n\treadonly baseUrl: string;\n\treadonly timeoutMs: number;\n\treadonly fetchImpl: typeof globalThis.fetch;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tconst resolved =\n\t\t\ttypeof options === \"string\" ? { apiKey: options } : options;\n\t\tthis.apiKey = resolved.apiKey ?? process.env.DROPTHIS_API_KEY;\n\t\tthis.baseUrl = (resolved.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\t\tthis.timeoutMs = resolved.timeoutMs ?? 30_000;\n\t\tthis.fetchImpl = resolved.fetch ?? globalThis.fetch;\n\t}\n\n\tmultipart<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\tform: FormData,\n\t\toptions: RequestOptions = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.request<T>(method, path, { ...options, body: form });\n\t}\n\n\tasync putSignedUrl(\n\t\turl: string,\n\t\tbody: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(() => controller.abort(), this.timeoutMs);\n\t\ttry {\n\t\t\tconst request: RequestInit & { duplex?: \"half\" } = {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\theaders,\n\t\t\t\tbody: body as BodyInit,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (body instanceof ReadableStream) request.duplex = \"half\";\n\t\t\tconst response = await this.fetchImpl(url, request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text();\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t`signed_upload_${response.status}`,\n\t\t\t\t\ttext || response.statusText,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\t{ headers: responseHeaders },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: {\n\t\t\t\t\tetag: response.headers.get(\"ETag\") ?? responseHeaders.etag ?? null,\n\t\t\t\t},\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n\n\tasync request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\tconst authenticated = options.authenticated ?? true;\n\t\tif (authenticated && !this.apiKey) {\n\t\t\treturn createErrorResult<T>(\n\t\t\t\t\"missing_api_key\",\n\t\t\t\t\"No API key provided. Pass apiKey or set DROPTHIS_API_KEY.\",\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"user-agent\": `dropthis-node/${SDK_VERSION}`,\n\t\t};\n\t\tif (authenticated && this.apiKey)\n\t\t\theaders.authorization = `Bearer ${this.apiKey}`;\n\t\tif (options.idempotencyKey)\n\t\t\theaders[\"idempotency-key\"] = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\theaders[\"If-Revision\"] = String(options.ifRevision);\n\t\tif (options.body !== undefined && !(options.body instanceof FormData))\n\t\t\theaders[\"content-type\"] = \"application/json\";\n\n\t\tconst url = new URL(`${this.baseUrl}${path}`);\n\t\tfor (const [key, value] of Object.entries(options.params ?? {})) {\n\t\t\tif (value !== undefined && value !== null)\n\t\t\t\turl.searchParams.set(key, String(value));\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(\n\t\t\t() => controller.abort(),\n\t\t\toptions.timeoutMs ?? this.timeoutMs,\n\t\t);\n\t\ttry {\n\t\t\tconst request: RequestInit = {\n\t\t\t\tmethod,\n\t\t\t\theaders,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (options.body instanceof FormData) {\n\t\t\t\trequest.body = options.body;\n\t\t\t} else if (options.body !== undefined) {\n\t\t\t\trequest.body = JSON.stringify(options.body);\n\t\t\t}\n\n\t\t\tconst response = await this.fetchImpl(url.toString(), request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tconst text = await response.text();\n\t\t\tconst parsed = parseJson(text);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst body =\n\t\t\t\t\tparsed && typeof parsed === \"object\"\n\t\t\t\t\t\t? (parsed as Record<string, unknown>)\n\t\t\t\t\t\t: {};\n\t\t\t\tconst message =\n\t\t\t\t\tstringValue(body.detail) ??\n\t\t\t\t\tstringValue(body.error) ??\n\t\t\t\t\tstringValue(body.message) ??\n\t\t\t\t\tresponse.statusText;\n\t\t\t\tconst code =\n\t\t\t\t\tstringValue(body.code) ??\n\t\t\t\t\tstringValue(body.error_code) ??\n\t\t\t\t\t`http_${response.status}`;\n\t\t\t\tconst currentRevision = numberValue(body.current_revision);\n\t\t\t\treturn createErrorResult<T>(code, message, response.status, {\n\t\t\t\t\tdetail: body,\n\t\t\t\t\tparam: stringValue(body.param),\n\t\t\t\t\t...(currentRevision !== undefined ? { currentRevision } : {}),\n\t\t\t\t\trequestId: responseHeaders[\"x-request-id\"] ?? null,\n\t\t\t\t\theaders: responseHeaders,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: toCamelCase(parsed) as T,\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult<T>(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n}\n\nfunction headersToObject(headers: Headers): Record<string, string> {\n\tconst result: Record<string, string> = {};\n\theaders.forEach((value, key) => {\n\t\tresult[key.toLowerCase()] = value;\n\t});\n\treturn result;\n}\n\nfunction parseJson(text: string): unknown {\n\tif (!text) return null;\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn text;\n\t}\n}\n\nfunction stringValue(value: unknown): string | null {\n\treturn typeof value === \"string\" ? value : null;\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\treturn typeof value === \"number\" ? value : undefined;\n}\n","import type { PreparedPublishRequest } from \"./publish/prepare.js\";\nimport { preparePublishRequest } from \"./publish/prepare.js\";\nimport { publishStaged } from \"./publish/upload.js\";\nimport { AccountResource } from \"./resources/account.js\";\nimport { ApiKeysResource } from \"./resources/api-keys.js\";\nimport { AuthResource } from \"./resources/auth.js\";\nimport { DeploymentsResource } from \"./resources/deployments.js\";\nimport { DropsResource } from \"./resources/drops.js\";\nimport { UploadsResource } from \"./resources/uploads.js\";\nimport { Transport } from \"./transport.js\";\nimport type {\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisResult,\n\tPublishInput,\n\tPublishOptions,\n\tRequestOptions,\n} from \"./types.js\";\n\nexport class Dropthis {\n\tprivate readonly transport: Transport;\n\tprivate authResource?: AuthResource;\n\tprivate apiKeysResource?: ApiKeysResource;\n\tprivate accountResource?: AccountResource;\n\tprivate dropsResource?: DropsResource;\n\tprivate deploymentsResource?: DeploymentsResource;\n\tprivate uploadsResource?: UploadsResource;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tthis.transport = new Transport(options);\n\t}\n\n\tget auth(): AuthResource {\n\t\tif (!this.authResource)\n\t\t\tthis.authResource = new AuthResource(this.transport);\n\t\treturn this.authResource;\n\t}\n\n\tget apiKeys(): ApiKeysResource {\n\t\tif (!this.apiKeysResource)\n\t\t\tthis.apiKeysResource = new ApiKeysResource(this.transport);\n\t\treturn this.apiKeysResource;\n\t}\n\n\tget account(): AccountResource {\n\t\tif (!this.accountResource)\n\t\t\tthis.accountResource = new AccountResource(this.transport);\n\t\treturn this.accountResource;\n\t}\n\n\tget drops(): DropsResource {\n\t\tif (!this.dropsResource)\n\t\t\tthis.dropsResource = new DropsResource(this.transport);\n\t\treturn this.dropsResource;\n\t}\n\n\tget deployments(): DeploymentsResource {\n\t\tif (!this.deploymentsResource)\n\t\t\tthis.deploymentsResource = new DeploymentsResource(this.transport);\n\t\treturn this.deploymentsResource;\n\t}\n\n\tget uploads(): UploadsResource {\n\t\tif (!this.uploadsResource)\n\t\t\tthis.uploadsResource = new UploadsResource(this.transport);\n\t\treturn this.uploadsResource;\n\t}\n\n\tasync prepare(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<PreparedPublishRequest> {\n\t\treturn preparePublishRequest(input, options);\n\t}\n\n\tasync publish(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst prepared = await preparePublishRequest(input, options);\n\t\tif (prepared.kind === \"json\") {\n\t\t\tconst requestOptions: RequestOptions & { body?: unknown } = {\n\t\t\t\tbody: prepared.body,\n\t\t\t};\n\t\t\tif (options.idempotencyKey)\n\t\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t\t}\n\t\treturn publishStaged(this.transport, prepared, \"/drops\", options);\n\t}\n\n\tasync update(\n\t\tdropId: string,\n\t\tinputOrOptions: PublishInput | PublishOptions = {},\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tif (looksLikeOptionsOnly(inputOrOptions)) {\n\t\t\treturn this.drops.update(dropId, inputOrOptions, options);\n\t\t}\n\n\t\tconst prepared = await preparePublishRequest(\n\t\t\tinputOrOptions as PublishInput,\n\t\t\toptions,\n\t\t);\n\t\tconst path = `/drops/${encodeURIComponent(dropId)}/deployments`;\n\t\tif (prepared.kind === \"json\") {\n\t\t\tconst requestOptions: RequestOptions & { body?: unknown } = {\n\t\t\t\tbody: prepared.body,\n\t\t\t};\n\t\t\tif (options.idempotencyKey)\n\t\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\t\tif (options.ifRevision !== undefined)\n\t\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\t\treturn this.transport.request(\"POST\", path, requestOptions);\n\t\t}\n\t\treturn publishStaged(this.transport, prepared, path, options);\n\t}\n\n\trequest<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.transport.request<T>(method, path, options);\n\t}\n\n\trequestSignedUpload(\n\t\turl: string,\n\t\tbytes: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\treturn this.transport.putSignedUrl(url, bytes, headers);\n\t}\n}\n\nfunction looksLikeOptionsOnly(\n\tinput: PublishInput | PublishOptions,\n): input is PublishOptions {\n\tif (input instanceof URL || input instanceof Uint8Array) return false;\n\tif (typeof input !== \"object\" || input === null) return false;\n\treturn !(\n\t\t\"content\" in input ||\n\t\t\"files\" in input ||\n\t\t\"sourceUrl\" in input ||\n\t\t\"sourceUrls\" in input\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA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B,MAAI,iBAAiB,OAAO,iBAAiB,WAAY,QAAO;AAChE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,SAAO,EACN,aAAa,SACb,WAAW,SACX,eAAe,SACf,gBAAgB;AAElB;","names":["import_promises","import_node_path","ignore","fg","import_node_crypto","import_promises"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/publish/prepare.ts","../src/case.ts","../src/publish/checksum.ts","../src/publish/detect.ts","../src/publish/files.ts","../src/publish/upload.ts","../src/errors.ts","../src/resources/account.ts","../src/resources/api-keys.ts","../src/resources/auth.ts","../src/resources/deployments.ts","../src/types.ts","../src/resources/drops.ts","../src/resources/uploads.ts","../src/transport.ts","../src/dropthis.ts"],"sourcesContent":["export { Dropthis } from \"./dropthis.js\";\nexport { createErrorResult, redactSecrets } from \"./errors.js\";\nexport type {\n\tPreparedPublishRequest,\n\tPreparedUploadFile,\n} from \"./publish/prepare.js\";\nexport { DeploymentsResource } from \"./resources/deployments.js\";\nexport { UploadsResource } from \"./resources/uploads.js\";\nexport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisErrorResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n\tListPage,\n\tRequestOptions,\n\tUploadManifestFile,\n\tUploadPartTarget,\n\tUploadSessionFileResponse,\n\tUploadSessionResponse,\n\tUploadTarget,\n} from \"./types.js\";\n","import { stat } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport { toSnakeCase } from \"../case.js\";\nimport type {\n\tCreateUploadSessionRequest,\n\tExplicitPublishInput,\n\tPublishInput,\n\tPublishOptions,\n\tUploadManifestFile,\n} from \"../types.js\";\nimport { sha256Bytes, sha256File } from \"./checksum.js\";\nimport { detectBytesContentType, detectStringInput } from \"./detect.js\";\nimport { collectPublishFiles, detectPathContentType } from \"./files.js\";\n\nconst SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES = 10 * 1024 * 1024;\n\nexport type PreparedUploadFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string;\n\tsource: { kind: \"path\"; path: string } | { kind: \"bytes\"; bytes: Uint8Array };\n};\n\ntype ExplicitFileInput = Extract<\n\tExplicitPublishInput,\n\t{ files: unknown }\n>[\"files\"][number];\n\nexport type PreparedPublishRequest = {\n\tkind: \"staged\";\n\tmanifest: CreateUploadSessionRequest;\n\tfiles: PreparedUploadFile[];\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport async function preparePublishRequest(\n\tinput: PublishInput,\n\toptions: PublishOptions = {},\n): Promise<PreparedPublishRequest> {\n\tif (input instanceof URL) {\n\t\tthrow new Error(\n\t\t\t\"URL inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\t}\n\tif (typeof input === \"string\") {\n\t\tconst local = await localKind(input);\n\t\tif (local === \"file\") {\n\t\t\treturn fileStaged(input, options);\n\t\t}\n\t\tif (local === \"directory\") {\n\t\t\treturn folderStaged(input, options);\n\t\t}\n\t\tconst detection = detectStringInput(input);\n\t\tif (detection.mode === \"sourceUrl\")\n\t\t\tthrow new Error(\n\t\t\t\t\"URL inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t\t);\n\t\treturn stringContent(input, options, detection.contentType);\n\t}\n\tif (input instanceof Uint8Array || Buffer.isBuffer(input)) {\n\t\treturn bytesStaged(input, options);\n\t}\n\treturn explicitInput(input, options);\n}\n\nasync function stringContent(\n\tcontent: string,\n\toptions: PublishOptions,\n\tdetectedContentType: string,\n): Promise<PreparedPublishRequest> {\n\tconst contentType = options.contentType ?? detectedContentType;\n\treturn bytesStaged(Buffer.from(content), {\n\t\t...options,\n\t\tpath: options.path ?? entryForContentType(contentType),\n\t\tcontentType,\n\t});\n}\n\nfunction entryForContentType(contentType: string): string {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\tif (normalized === \"text/html\" || normalized === \"application/xhtml+xml\")\n\t\treturn \"index.html\";\n\tif (normalized === \"application/json\") return \"index.json\";\n\tif (normalized === \"text/css\") return \"index.css\";\n\tif (\n\t\tnormalized === \"text/javascript\" ||\n\t\tnormalized === \"application/javascript\"\n\t)\n\t\treturn \"index.js\";\n\tif (normalized.startsWith(\"text/\")) return \"index.txt\";\n\treturn \"index\";\n}\n\nasync function localKind(\n\tinput: string,\n): Promise<\"file\" | \"directory\" | \"none\"> {\n\ttry {\n\t\tconst info = await stat(input);\n\t\tif (info.isFile()) return \"file\";\n\t\tif (info.isDirectory()) return \"directory\";\n\t\treturn \"none\";\n\t} catch {\n\t\treturn \"none\";\n\t}\n}\n\nasync function fileStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst fileStat = await stat(path);\n\tconst manifestPath = options.path ?? basename(path);\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: manifestPath,\n\t\t\t\tcontentType: options.contentType ?? (await detectPathContentType(path)),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t\tsource: { kind: \"path\", path },\n\t\t\t},\n\t\t],\n\t\t{ ...options, entry: options.entry ?? manifestPath },\n\t);\n}\n\nasync function folderStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst files = (await collectPublishFiles(path, options)).map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\tsource: { kind: \"path\", path: file.absolutePath } as const,\n\t}));\n\treturn stagedRequest(files, options);\n}\n\nasync function bytesStaged(\n\tbytes: Uint8Array,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: options.path ?? \"index\",\n\t\t\t\tcontentType: options.contentType ?? detectBytesContentType(bytes),\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes },\n\t\t\t},\n\t\t],\n\t\toptions,\n\t);\n}\n\nasync function stagedRequest(\n\tfiles: PreparedUploadFile[],\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst preparedFiles = await Promise.all(\n\t\tfiles.map(async (file) => {\n\t\t\tif (file.sizeBytes <= SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES) return file;\n\t\t\tconst checksumSha256 =\n\t\t\t\tfile.source.kind === \"bytes\"\n\t\t\t\t\t? sha256Bytes(file.source.bytes)\n\t\t\t\t\t: await sha256File(file.source.path);\n\t\t\treturn { ...file, checksumSha256 };\n\t\t}),\n\t);\n\tconst manifestFiles: UploadManifestFile[] = preparedFiles.map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\t...(file.checksumSha256 ? { checksumSha256: file.checksumSha256 } : {}),\n\t}));\n\tconst prepared: Extract<PreparedPublishRequest, { kind: \"staged\" }> = {\n\t\tkind: \"staged\",\n\t\tmanifest: {\n\t\t\tschemaVersion: 1,\n\t\t\tfiles: manifestFiles,\n\t\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\t},\n\t\tfiles: preparedFiles,\n\t\toptions: optionsBody(options),\n\t};\n\tif (options.metadata) prepared.metadata = options.metadata;\n\treturn prepared;\n}\n\nasync function explicitInput(\n\tinput: ExplicitPublishInput,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tif (\"content\" in input)\n\t\treturn stringContent(\n\t\t\tinput.content,\n\t\t\t{ ...options, ...input },\n\t\t\tinput.contentType ?? options.contentType ?? \"text/html\",\n\t\t);\n\tif (\"sourceUrl\" in input)\n\t\tthrow new Error(\n\t\t\t\"sourceUrl inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\tif (\"sourceUrls\" in input)\n\t\tthrow new Error(\n\t\t\t\"sourceUrls inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\treturn stagedRequest(\n\t\tinput.files.map((file) => {\n\t\t\tconst bytes = explicitFileBytes(file);\n\t\t\treturn {\n\t\t\t\tpath: file.path,\n\t\t\t\tcontentType: file.contentType,\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes } as const,\n\t\t\t};\n\t\t}),\n\t\t{ ...options, ...input },\n\t);\n}\n\nfunction explicitFileBytes(file: ExplicitFileInput): Uint8Array {\n\tif (file.content !== undefined) return Buffer.from(file.content);\n\tif (file.contentBase64 !== undefined)\n\t\treturn Buffer.from(file.contentBase64, \"base64\");\n\tif (file.bytes !== undefined) return file.bytes;\n\tthrow new TypeError(`Explicit file ${file.path} is missing content bytes`);\n}\n\nfunction optionsBody(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): Record<string, unknown> {\n\treturn toSnakeCase({\n\t\ttitle: options.title,\n\t\tvisibility: options.visibility,\n\t\tpassword: options.password,\n\t\tnoindex: options.noindex,\n\t\texpiresAt:\n\t\t\toptions.expiresAt instanceof Date\n\t\t\t\t? options.expiresAt.toISOString()\n\t\t\t\t: options.expiresAt,\n\t}) as Record<string, unknown>;\n}\n","export function toCamelKey(key: string): string {\n\treturn key.replace(/_([a-z])/g, (_, char: string) => char.toUpperCase());\n}\n\nexport function toSnakeKey(key: string): string {\n\treturn key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`);\n}\n\nexport function toCamelCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toCamelCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value).map(([key, item]) => [\n\t\t\t\ttoCamelKey(key),\n\t\t\t\ttoCamelCase(item),\n\t\t\t]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function toSnakeCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toSnakeCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value)\n\t\t\t\t.filter(([, item]) => item !== undefined)\n\t\t\t\t.map(([key, item]) => [toSnakeKey(key), toSnakeCase(item)]),\n\t\t);\n\t}\n\treturn value;\n}\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\n\nexport function sha256Bytes(bytes: Uint8Array): string {\n\treturn createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nexport async function sha256File(path: string): Promise<string> {\n\tconst hash = createHash(\"sha256\");\n\tfor await (const chunk of createReadStream(path)) {\n\t\thash.update(chunk);\n\t}\n\treturn hash.digest(\"hex\");\n}\n","export type StringInputDetection =\n\t| { mode: \"sourceUrl\" }\n\t| {\n\t\t\tmode: \"content\";\n\t\t\tcontentType: \"text/html\" | \"text/plain; charset=utf-8\";\n\t };\n\nexport function isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn url.protocol === \"http:\" || url.protocol === \"https:\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function looksLikeHtml(value: string): boolean {\n\tconst trimmed = value.trimStart().toLowerCase();\n\treturn (\n\t\ttrimmed.startsWith(\"<!doctype html\") ||\n\t\ttrimmed.startsWith(\"<html\") ||\n\t\t/^<[a-z][a-z0-9:-]*(\\s|>)/.test(trimmed)\n\t);\n}\n\nexport function detectStringInput(value: string): StringInputDetection {\n\tif (isHttpUrl(value)) return { mode: \"sourceUrl\" as const };\n\treturn {\n\t\tmode: \"content\",\n\t\tcontentType: looksLikeHtml(value)\n\t\t\t? \"text/html\"\n\t\t\t: \"text/plain; charset=utf-8\",\n\t};\n}\n\nexport function isTextLikeContentType(contentType: string): boolean {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\treturn (\n\t\tnormalized.startsWith(\"text/\") ||\n\t\t[\n\t\t\t\"application/json\",\n\t\t\t\"application/javascript\",\n\t\t\t\"application/xml\",\n\t\t\t\"application/xhtml+xml\",\n\t\t\t\"image/svg+xml\",\n\t\t].includes(normalized)\n\t);\n}\n\nexport function detectBytesContentType(bytes: Uint8Array): string {\n\tconst text = Buffer.from(bytes).toString(\"utf8\");\n\tif (text.includes(\"\\uFFFD\")) return \"application/octet-stream\";\n\treturn looksLikeHtml(text) ? \"text/html\" : \"text/plain; charset=utf-8\";\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport { basename, sep } from \"node:path\";\nimport fg from \"fast-glob\";\nimport ignore from \"ignore\";\nimport { lookup } from \"mime-types\";\nimport { detectBytesContentType } from \"./detect.js\";\n\nexport type PublishFile = {\n\tabsolutePath: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\nconst DEFAULT_IGNORES = [\n\t\".git\",\n\t\".git/**\",\n\t\"node_modules\",\n\t\"node_modules/**\",\n\t\".DS_Store\",\n\t\".env\",\n\t\".env.*\",\n\t\".cache\",\n\t\".cache/**\",\n\t\".tmp\",\n\t\".tmp/**\",\n\t\"dist/.cache\",\n\t\"dist/.cache/**\",\n];\n\nexport async function collectPublishFiles(\n\tinputPath: string,\n\toptions: { ignore?: string[]; ignoreDefaults?: boolean } = {},\n): Promise<PublishFile[]> {\n\tconst inputStat = await stat(inputPath);\n\tif (inputStat.isFile()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tabsolutePath: inputPath,\n\t\t\t\tpath: basename(inputPath),\n\t\t\t\tcontentType: await detectPathContentType(inputPath),\n\t\t\t\tsizeBytes: inputStat.size,\n\t\t\t},\n\t\t];\n\t}\n\tif (!inputStat.isDirectory()) {\n\t\tthrow new Error(`Input is not a file or directory: ${inputPath}`);\n\t}\n\n\tconst matcher = ignore().add([\n\t\t...(options.ignoreDefaults === false ? [] : DEFAULT_IGNORES),\n\t\t...(options.ignore ?? []),\n\t]);\n\tconst entries = await fg(\"**/*\", {\n\t\tcwd: inputPath,\n\t\tonlyFiles: true,\n\t\tfollowSymbolicLinks: false,\n\t\tdot: true,\n\t\tunique: true,\n\t});\n\tconst paths = entries\n\t\t.map((entry) => entry.split(sep).join(\"/\"))\n\t\t.filter((entry) => !matcher.ignores(entry))\n\t\t.sort((a, b) => a.localeCompare(b));\n\treturn Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst absolutePath = `${inputPath}/${path}`;\n\t\t\tconst fileStat = await stat(absolutePath);\n\t\t\treturn {\n\t\t\t\tabsolutePath,\n\t\t\t\tpath,\n\t\t\t\tcontentType: await detectPathContentType(absolutePath),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t};\n\t\t}),\n\t);\n}\n\nexport async function detectPathContentType(path: string): Promise<string> {\n\tconst detected = lookup(path);\n\tif (detected) return detected;\n\treturn detectBytesContentType(await readFile(path));\n}\n","import { randomUUID } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { toSnakeCase } from \"../case.js\";\nimport { createErrorResult } from \"../errors.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionResponse,\n\tDropResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\nimport type { PreparedPublishRequest, PreparedUploadFile } from \"./prepare.js\";\n\ntype PreparedStagedPublish = Extract<\n\tPreparedPublishRequest,\n\t{ kind: \"staged\" }\n>;\n\ntype StagedPublishOptions = {\n\tidempotencyKey?: string;\n\tifRevision?: number;\n};\n\nconst MAX_PART_TARGETS_PER_REQUEST = 100;\n\nexport async function publishStaged(\n\ttransport: Transport,\n\tprepared: PreparedStagedPublish,\n\tfinalPath: string,\n\toptions: StagedPublishOptions = {},\n): Promise<DropthisResult<DropResponse>> {\n\tconst baseKey = options.idempotencyKey ?? `sdk-${randomUUID()}`;\n\tconst createResult = await transport.request<CreateUploadSessionResponse>(\n\t\t\"POST\",\n\t\t\"/uploads\",\n\t\t{\n\t\t\tbody: toSnakeCase(prepared.manifest),\n\t\t\tidempotencyKey: `${baseKey}:create-upload`,\n\t\t},\n\t);\n\tif (createResult.error) return errorResult(createResult);\n\n\tconst completedFiles: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> }\n\t> = {};\n\tfor (const file of prepared.files) {\n\t\tconst target = createResult.data.files.find(\n\t\t\t(candidate) => candidate.path === file.path,\n\t\t);\n\t\tif (!target) {\n\t\t\treturn createErrorResult(\n\t\t\t\t\"upload_target_missing\",\n\t\t\t\t`Upload target missing for ${file.path}`,\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\t\tif (target.upload.strategy === \"multipart\") {\n\t\t\tconst partsResult = await uploadMultipartFile(\n\t\t\t\ttransport,\n\t\t\t\tcreateResult.data.uploadId,\n\t\t\t\ttarget.fileId,\n\t\t\t\tfile,\n\t\t\t\ttarget.upload.partSize,\n\t\t\t);\n\t\t\tif (partsResult.error) return errorResult(partsResult);\n\t\t\tcompletedFiles[target.fileId] = { parts: partsResult.data };\n\t\t\tcontinue;\n\t\t}\n\t\tconst bytes = await fileBytes(file);\n\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\ttarget.upload.url,\n\t\t\tbytes,\n\t\t\ttarget.upload.headers,\n\t\t);\n\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t}\n\n\tconst completeResult = await transport.request<UploadSessionResponse>(\n\t\t\"POST\",\n\t\t`/uploads/${encodeURIComponent(createResult.data.uploadId)}/complete`,\n\t\t{\n\t\t\tbody: toSnakeCase({ files: completedFiles }),\n\t\t\tidempotencyKey: `${baseKey}:complete-upload`,\n\t\t},\n\t);\n\tif (completeResult.error) return errorResult(completeResult);\n\n\tconst finalOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\tbody: {\n\t\t\tupload_id: createResult.data.uploadId,\n\t\t\toptions: prepared.options,\n\t\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\t},\n\t\tidempotencyKey: `${baseKey}:publish`,\n\t};\n\tif (options.ifRevision !== undefined)\n\t\tfinalOptions.ifRevision = options.ifRevision;\n\treturn transport.request(\"POST\", finalPath, finalOptions);\n}\n\nasync function uploadMultipartFile(\n\ttransport: Transport,\n\tuploadId: string,\n\tfileId: string,\n\tfile: PreparedUploadFile,\n\tpartSize: number | undefined,\n): Promise<DropthisResult<Array<{ partNumber: number; etag: string }>>> {\n\tif (!partSize || partSize < 1) {\n\t\treturn createErrorResult(\n\t\t\t\"invalid_upload_target\",\n\t\t\t\"Multipart upload target did not include a valid part size.\",\n\t\t\tnull,\n\t\t);\n\t}\n\tconst bytes = await fileBytes(file);\n\tconst partNumbers = Array.from(\n\t\t{ length: Math.ceil(bytes.byteLength / partSize) },\n\t\t(_, index) => index + 1,\n\t);\n\tconst parts: Array<{ partNumber: number; etag: string }> = [];\n\tfor (\n\t\tlet startIndex = 0;\n\t\tstartIndex < partNumbers.length;\n\t\tstartIndex += MAX_PART_TARGETS_PER_REQUEST\n\t) {\n\t\tconst partNumberBatch = partNumbers.slice(\n\t\t\tstartIndex,\n\t\t\tstartIndex + MAX_PART_TARGETS_PER_REQUEST,\n\t\t);\n\t\tconst targetsResult =\n\t\t\tawait transport.request<CreateUploadPartTargetsResponse>(\n\t\t\t\t\"POST\",\n\t\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t\t{ body: toSnakeCase({ fileId, partNumbers: partNumberBatch }) },\n\t\t\t);\n\t\tif (targetsResult.error) return errorResult(targetsResult);\n\t\tfor (const target of targetsResult.data.parts) {\n\t\t\tconst start = (target.partNumber - 1) * partSize;\n\t\t\tconst end = Math.min(start + partSize, bytes.byteLength);\n\t\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\t\ttarget.url,\n\t\t\t\tbytes.slice(start, end),\n\t\t\t\ttarget.headers,\n\t\t\t);\n\t\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t\t\tif (!uploadResult.data.etag) {\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t\"missing_upload_etag\",\n\t\t\t\t\t\"Signed upload response did not include an ETag.\",\n\t\t\t\t\tnull,\n\t\t\t\t);\n\t\t\t}\n\t\t\tparts.push({\n\t\t\t\tpartNumber: target.partNumber,\n\t\t\t\tetag: uploadResult.data.etag,\n\t\t\t});\n\t\t}\n\t}\n\treturn { data: parts, error: null, headers: {} };\n}\n\nasync function fileBytes(file: PreparedUploadFile): Promise<Uint8Array> {\n\tif (file.source.kind === \"bytes\") return file.source.bytes;\n\treturn readFile(file.source.path);\n}\n\nfunction errorResult<T>(result: DropthisResult<unknown>): DropthisResult<T> {\n\tif (!result.error) throw new Error(\"Expected an error result\");\n\treturn { data: null, error: result.error, headers: result.headers };\n}\n","import type { DropthisResult } from \"./types.js\";\n\nconst API_KEY_RE = /sk_[A-Za-z0-9_-]+/g;\n\nexport function redactSecrets(message: string): string {\n\treturn message.replace(API_KEY_RE, \"sk_[redacted]\");\n}\n\nexport function createErrorResult<T>(\n\tcode: string,\n\tmessage: string,\n\tstatusCode: number | null,\n\textra: {\n\t\ttype?: string;\n\t\tdetail?: unknown;\n\t\tparam?: string | null;\n\t\tcurrentRevision?: number;\n\t\trequestId?: string | null;\n\t\theaders?: Record<string, string>;\n\t} = {},\n): DropthisResult<T> {\n\treturn {\n\t\tdata: null,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage: redactSecrets(message),\n\t\t\tstatusCode,\n\t\t\t...(extra.type ? { type: extra.type } : {}),\n\t\t\t...(extra.detail !== undefined ? { detail: extra.detail } : {}),\n\t\t\t...(extra.param !== undefined ? { param: extra.param } : {}),\n\t\t\t...(extra.currentRevision !== undefined\n\t\t\t\t? { currentRevision: extra.currentRevision }\n\t\t\t\t: {}),\n\t\t\t...(extra.requestId !== undefined ? { requestId: extra.requestId } : {}),\n\t\t},\n\t\theaders: extra.headers ?? {},\n\t};\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type { AccountResponse, DropthisResult } from \"../types.js\";\n\nexport class AccountResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tget(): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"GET\", \"/account\");\n\t}\n\n\tupdate(input: {\n\t\tdisplayName: string | null;\n\t}): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"PATCH\", \"/account\", {\n\t\t\tbody: toSnakeCase(input),\n\t\t});\n\t}\n\n\tdelete(): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\"DELETE\", \"/account\");\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tApiKeyCreatedResponse,\n\tApiKeyResponse,\n\tDropthisResult,\n} from \"../types.js\";\n\nexport class ApiKeysResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tlist(): Promise<DropthisResult<{ object: \"list\"; data: ApiKeyResponse[] }>> {\n\t\treturn this.transport.request(\"GET\", \"/api-keys\");\n\t}\n\n\tcreate(input: {\n\t\tlabel: string;\n\t}): Promise<DropthisResult<ApiKeyCreatedResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/api-keys\", { body: input });\n\t}\n\n\tdelete(keyId: string): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/api-keys/${encodeURIComponent(keyId)}`,\n\t\t);\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tDropthisResult,\n\tEmailOtpResponse,\n\tSessionResponse,\n} from \"../types.js\";\n\nexport class AuthResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\trequestEmailOtp(input: {\n\t\temail: string;\n\t}): Promise<DropthisResult<EmailOtpResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/otp\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tverifyEmailOtp(input: {\n\t\temail: string;\n\t\tcode: string;\n\t}): Promise<DropthisResult<SessionResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/verify\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tlogout(): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\"DELETE\", \"/auth/session\");\n\t}\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n} from \"../types.js\";\n\nexport class DeploymentsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tdropId: string,\n\t\tbody: Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcreateRaw(\n\t\tdropId: string,\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tlist(\n\t\tdropId: string,\n\t\tparams: ListDeploymentsParams = {},\n\t): Promise<DropthisResult<ListDeploymentsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\t{\n\t\t\t\tparams: toSnakeCase(params) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tstring | number | boolean\n\t\t\t\t>,\n\t\t\t},\n\t\t);\n\t}\n\n\tget(\n\t\tdropId: string,\n\t\tdeploymentId: string,\n\t): Promise<DropthisResult<DropDeploymentResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments/${encodeURIComponent(deploymentId)}`,\n\t\t);\n\t}\n}\n","export type DropthisClientOptions = {\n\tapiKey?: string;\n\tbaseUrl?: string;\n\ttimeoutMs?: number;\n\tfetch?: typeof globalThis.fetch;\n};\n\nexport type RequestOptions = {\n\tauthenticated?: boolean;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\ttimeoutMs?: number;\n};\n\nexport type DropthisErrorResponse = {\n\tcode: string;\n\tmessage: string;\n\tstatusCode: number | null;\n\ttype?: string;\n\tdetail?: unknown;\n\tparam?: string | null;\n\tcurrentRevision?: number;\n\trequestId?: string | null;\n};\n\nexport type DropthisResult<T> =\n\t| { data: T; error: null; headers: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: DropthisErrorResponse;\n\t\t\theaders: Record<string, string>;\n\t };\n\nexport type DropResponse = {\n\tid: string;\n\tslug: string;\n\turl: string;\n\tcanonicalHost: string;\n\tdeploymentId: string | null;\n\ttitle: string;\n\tcontentType: string;\n\tvisibility: string;\n\tstatus: string;\n\trevision: number;\n\tcontentRevision: number;\n\taccessRevision: number;\n\tsizeBytes: number;\n\trenderMode: string;\n\twarnings: Array<Record<string, unknown>>;\n\tcreatedAt: string;\n\texpiresAt: string | null;\n};\n\nexport type DropDeploymentResponse = {\n\tid: string;\n\tdropId: string;\n\trevision: number;\n\tstatus: string;\n\tstoragePrefix: string;\n\tentry: string | null;\n\tcontentType: string;\n\trenderMode: string;\n\tfiles: Array<Record<string, unknown>>;\n\twarnings: Array<Record<string, unknown>>;\n\tsizeBytes: number;\n\tclassificationVersion: number;\n\tclassificationReason: string;\n\terrorCode: string | null;\n\terrorMessage: string | null;\n\tcreatedAt: string;\n\treadyAt: string | null;\n\tpublishedAt: string | null;\n};\n\nexport type ListDeploymentsParams = { cursor?: string | null; limit?: number };\n\nexport type ListDeploymentsResponse = {\n\tdeployments: DropDeploymentResponse[];\n\tnextCursor: string | null;\n};\n\nexport type ListPage<T> = {\n\tobject: \"list\";\n\tdata: T[];\n\thasMore: boolean;\n\tnextCursor: string | null;\n\tautoPagingToArray(options?: { limit?: number }): Promise<T[]>;\n\t[Symbol.asyncIterator](): AsyncIterableIterator<T>;\n};\n\nexport type EmailOtpResponse = { ok: true; expiresIn: number };\nexport type SessionResponse = {\n\tobject: \"session\";\n\ttoken: string;\n\taccountId: string;\n\tisNewAccount: boolean;\n\texpiresIn: number;\n};\nexport type ApiKeyResponse = {\n\tobject: \"api_key\";\n\tid: string;\n\tkeyLast4: string;\n\tlabel: string;\n\tcreatedAt: string;\n};\nexport type ApiKeyCreatedResponse = ApiKeyResponse & {\n\tkey: string;\n\taccountId?: string | null;\n\tisNewAccount?: boolean;\n};\nexport type AccountResponse = {\n\tid: string;\n\temail: string;\n\tdisplayName: string | null;\n\tplan: string;\n\tstatus: string;\n\tcreatedAt: string;\n};\nexport type ListDropsParams = { cursor?: string | null; limit?: number };\n\nexport type UploadManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string | null;\n};\n\nexport type CreateUploadSessionRequest = {\n\tschemaVersion?: 1;\n\tfiles: UploadManifestFile[];\n\tentry?: string | null;\n};\n\nexport type UploadTarget = {\n\tstrategy: \"single_put\" | \"multipart\";\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n\tpartSize?: number;\n\tpartCount?: number;\n};\n\nexport type CreateUploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tobjectKey: string;\n\tupload: UploadTarget;\n};\n\nexport type UploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tobjectKey: string;\n\tverified: boolean;\n};\n\nexport type UploadSessionResponse = {\n\tuploadId: string;\n\tstatus: string;\n\texpiresAt: string;\n\tentry?: string | null;\n\tfiles: UploadSessionFileResponse[];\n};\n\nexport type CreateUploadSessionResponse = {\n\tuploadId: string;\n\texpiresAt: string;\n\tfiles: CreateUploadSessionFileResponse[];\n};\n\nexport type CreateUploadPartTargetsRequest = {\n\tfileId: string;\n\tpartNumbers: number[];\n};\n\nexport type UploadPartTarget = {\n\tpartNumber: number;\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n};\n\nexport type CreateUploadPartTargetsResponse = {\n\tfileId: string;\n\turlExpiresAt?: string | null;\n\tparts: UploadPartTarget[];\n};\n\nexport type CompleteUploadSessionRequest = {\n\tfiles?: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> | null }\n\t>;\n};\n\nexport class CursorPage<T> implements ListPage<T> {\n\treadonly object = \"list\" as const;\n\treadonly data: T[];\n\treadonly hasMore: boolean;\n\treadonly nextCursor: string | null;\n\tprivate readonly fetchNextPage:\n\t\t| (() => Promise<DropthisResult<CursorPage<T>>>)\n\t\t| undefined;\n\n\tconstructor(input: {\n\t\tdata: T[];\n\t\thasMore: boolean;\n\t\tnextCursor: string | null;\n\t\tfetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;\n\t}) {\n\t\tthis.data = input.data;\n\t\tthis.hasMore = input.hasMore;\n\t\tthis.nextCursor = input.nextCursor;\n\t\tthis.fetchNextPage = input.fetchNextPage;\n\t}\n\n\tasync autoPagingToArray(options: { limit?: number } = {}): Promise<T[]> {\n\t\tconst items: T[] = [];\n\t\tfor await (const item of this) {\n\t\t\titems.push(item);\n\t\t\tif (options.limit !== undefined && items.length >= options.limit) break;\n\t\t}\n\t\treturn items;\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncIterableIterator<T> {\n\t\tfor (const item of this.data) yield item;\n\t\tlet current: CursorPage<T> = this;\n\t\twhile (current.hasMore && current.fetchNextPage) {\n\t\t\tconst next = await current.fetchNextPage();\n\t\t\tif (next.error) break;\n\t\t\tcurrent = next.data;\n\t\t\tfor (const item of current.data) yield item;\n\t\t}\n\t}\n}\n\nexport type PublishOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean | null;\n\texpiresAt?: string | Date | null;\n\tentry?: string;\n\tmetadata?: Record<string, unknown>;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\tignore?: string[];\n\tignoreDefaults?: boolean;\n\tcontentType?: string;\n\tpath?: string;\n};\n\nexport type UpdateOptions = PublishOptions;\nexport type UpdateTarget = string;\n\nexport type ExplicitPublishInput =\n\t| {\n\t\t\tcontent: string;\n\t\t\tcontentType?: string;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t }\n\t| {\n\t\t\tfiles: Array<{\n\t\t\t\tpath: string;\n\t\t\t\tcontent?: string;\n\t\t\t\tcontentBase64?: string;\n\t\t\t\tbytes?: Uint8Array;\n\t\t\t\tcontentType: string;\n\t\t\t}>;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t };\n\nexport type PublishInput = string | Uint8Array | ExplicitPublishInput;\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport {\n\tCursorPage,\n\ttype DropResponse,\n\ttype DropthisResult,\n\ttype ListDropsParams,\n\ttype PublishOptions,\n} from \"../types.js\";\n\nexport class DropsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tcreateRaw(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tasync list(\n\t\tparams: ListDropsParams = {},\n\t): Promise<DropthisResult<CursorPage<DropResponse>>> {\n\t\tconst result = await this.transport.request<{\n\t\t\tdrops: DropResponse[];\n\t\t\tnextCursor: string | null;\n\t\t}>(\"GET\", \"/drops\", {\n\t\t\tparams: toSnakeCase(params) as Record<string, string | number | boolean>,\n\t\t});\n\t\tif (result.error) return result;\n\t\tconst page = new CursorPage<DropResponse>({\n\t\t\tdata: result.data.drops,\n\t\t\tnextCursor: result.data.nextCursor,\n\t\t\thasMore: result.data.nextCursor !== null,\n\t\t\tfetchNextPage: result.data.nextCursor\n\t\t\t\t? () => this.list({ ...params, cursor: result.data.nextCursor })\n\t\t\t\t: undefined,\n\t\t});\n\t\treturn { data: page, error: null, headers: result.headers };\n\t}\n\n\tget(dropId: string): Promise<DropthisResult<DropResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n\n\tupdate(\n\t\tdropId: string,\n\t\tbody: PublishOptions | Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst bodyRecord = body as Record<string, unknown>;\n\t\tif (hasContent(bodyRecord)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"drops.update() only patches drop options; use deployments.create() or update() for content\",\n\t\t\t);\n\t\t}\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: updateBody(body),\n\t\t};\n\t\tconst bodyOptions = body as PublishOptions;\n\t\tconst idempotencyKey = options.idempotencyKey ?? bodyOptions.idempotencyKey;\n\t\tconst ifRevision = options.ifRevision ?? bodyOptions.ifRevision;\n\t\tif (idempotencyKey) requestOptions.idempotencyKey = idempotencyKey;\n\t\tif (ifRevision !== undefined) requestOptions.ifRevision = ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"PATCH\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tdelete(dropId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n}\n\nfunction updateBody(body: PublishOptions | Record<string, unknown>): unknown {\n\tconst {\n\t\tmetadata,\n\t\tidempotencyKey: _idempotencyKey,\n\t\tifRevision: _ifRevision,\n\t\tignore: _ignore,\n\t\tignoreDefaults: _ignoreDefaults,\n\t\tcontentType: _contentType,\n\t\tpath: _path,\n\t\tentry: _entry,\n\t\t...dropOptions\n\t} = body as PublishOptions;\n\treturn toSnakeCase({ options: dropOptions, metadata });\n}\n\nfunction hasContent(body: Record<string, unknown>): boolean {\n\treturn [\"content\", \"contentType\", \"content_type\", \"entry\", \"files\"].some(\n\t\t(field) => body[field] !== undefined,\n\t);\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\n\nexport class UploadsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: CreateUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<CreateUploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/uploads\", requestOptions);\n\t}\n\n\tget(uploadId: string): Promise<DropthisResult<UploadSessionResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n\n\tcreatePartTargets(\n\t\tuploadId: string,\n\t\tbody: CreateUploadPartTargetsRequest,\n\t): Promise<DropthisResult<CreateUploadPartTargetsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t{ body: toSnakeCase(body) },\n\t\t);\n\t}\n\n\tcomplete(\n\t\tuploadId: string,\n\t\tbody: CompleteUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<UploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/complete`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcancel(uploadId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n}\n","import { toCamelCase } from \"./case.js\";\nimport { createErrorResult } from \"./errors.js\";\nimport type {\n\tDropthisClientOptions,\n\tDropthisResult,\n\tRequestOptions,\n} from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.dropthis.app\";\nconst SDK_VERSION = \"0.1.0\";\n\nexport class Transport {\n\treadonly apiKey: string | undefined;\n\treadonly baseUrl: string;\n\treadonly timeoutMs: number;\n\treadonly fetchImpl: typeof globalThis.fetch;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tconst resolved =\n\t\t\ttypeof options === \"string\" ? { apiKey: options } : options;\n\t\tthis.apiKey = resolved.apiKey ?? process.env.DROPTHIS_API_KEY;\n\t\tthis.baseUrl = (resolved.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\t\tthis.timeoutMs = resolved.timeoutMs ?? 30_000;\n\t\tthis.fetchImpl = resolved.fetch ?? globalThis.fetch;\n\t}\n\n\tmultipart<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\tform: FormData,\n\t\toptions: RequestOptions = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.request<T>(method, path, { ...options, body: form });\n\t}\n\n\tasync putSignedUrl(\n\t\turl: string,\n\t\tbody: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(() => controller.abort(), this.timeoutMs);\n\t\ttry {\n\t\t\tconst request: RequestInit & { duplex?: \"half\" } = {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\theaders,\n\t\t\t\tbody: body as BodyInit,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (body instanceof ReadableStream) request.duplex = \"half\";\n\t\t\tconst response = await this.fetchImpl(url, request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text();\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t`signed_upload_${response.status}`,\n\t\t\t\t\ttext || response.statusText,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\t{ headers: responseHeaders },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: {\n\t\t\t\t\tetag: response.headers.get(\"ETag\") ?? responseHeaders.etag ?? null,\n\t\t\t\t},\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n\n\tasync request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\tconst authenticated = options.authenticated ?? true;\n\t\tif (authenticated && !this.apiKey) {\n\t\t\treturn createErrorResult<T>(\n\t\t\t\t\"missing_api_key\",\n\t\t\t\t\"No API key provided. Pass apiKey or set DROPTHIS_API_KEY.\",\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"user-agent\": `dropthis-node/${SDK_VERSION}`,\n\t\t};\n\t\tif (authenticated && this.apiKey)\n\t\t\theaders.authorization = `Bearer ${this.apiKey}`;\n\t\tif (options.idempotencyKey)\n\t\t\theaders[\"idempotency-key\"] = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\theaders[\"If-Revision\"] = String(options.ifRevision);\n\t\tif (options.body !== undefined && !(options.body instanceof FormData))\n\t\t\theaders[\"content-type\"] = \"application/json\";\n\n\t\tconst url = new URL(`${this.baseUrl}${path}`);\n\t\tfor (const [key, value] of Object.entries(options.params ?? {})) {\n\t\t\tif (value !== undefined && value !== null)\n\t\t\t\turl.searchParams.set(key, String(value));\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(\n\t\t\t() => controller.abort(),\n\t\t\toptions.timeoutMs ?? this.timeoutMs,\n\t\t);\n\t\ttry {\n\t\t\tconst request: RequestInit = {\n\t\t\t\tmethod,\n\t\t\t\theaders,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (options.body instanceof FormData) {\n\t\t\t\trequest.body = options.body;\n\t\t\t} else if (options.body !== undefined) {\n\t\t\t\trequest.body = JSON.stringify(options.body);\n\t\t\t}\n\n\t\t\tconst response = await this.fetchImpl(url.toString(), request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tconst text = await response.text();\n\t\t\tconst parsed = parseJson(text);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst body =\n\t\t\t\t\tparsed && typeof parsed === \"object\"\n\t\t\t\t\t\t? (parsed as Record<string, unknown>)\n\t\t\t\t\t\t: {};\n\t\t\t\tconst message =\n\t\t\t\t\tstringValue(body.detail) ??\n\t\t\t\t\tstringValue(body.error) ??\n\t\t\t\t\tstringValue(body.message) ??\n\t\t\t\t\tresponse.statusText;\n\t\t\t\tconst code =\n\t\t\t\t\tstringValue(body.code) ??\n\t\t\t\t\tstringValue(body.error_code) ??\n\t\t\t\t\t`http_${response.status}`;\n\t\t\t\tconst currentRevision = numberValue(body.current_revision);\n\t\t\t\treturn createErrorResult<T>(code, message, response.status, {\n\t\t\t\t\tdetail: body,\n\t\t\t\t\tparam: stringValue(body.param),\n\t\t\t\t\t...(currentRevision !== undefined ? { currentRevision } : {}),\n\t\t\t\t\trequestId: responseHeaders[\"x-request-id\"] ?? null,\n\t\t\t\t\theaders: responseHeaders,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: toCamelCase(parsed) as T,\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult<T>(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n}\n\nfunction headersToObject(headers: Headers): Record<string, string> {\n\tconst result: Record<string, string> = {};\n\theaders.forEach((value, key) => {\n\t\tresult[key.toLowerCase()] = value;\n\t});\n\treturn result;\n}\n\nfunction parseJson(text: string): unknown {\n\tif (!text) return null;\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn text;\n\t}\n}\n\nfunction stringValue(value: unknown): string | null {\n\treturn typeof value === \"string\" ? value : null;\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\treturn typeof value === \"number\" ? value : undefined;\n}\n","import type { PreparedPublishRequest } from \"./publish/prepare.js\";\nimport { preparePublishRequest } from \"./publish/prepare.js\";\nimport { publishStaged } from \"./publish/upload.js\";\nimport { AccountResource } from \"./resources/account.js\";\nimport { ApiKeysResource } from \"./resources/api-keys.js\";\nimport { AuthResource } from \"./resources/auth.js\";\nimport { DeploymentsResource } from \"./resources/deployments.js\";\nimport { DropsResource } from \"./resources/drops.js\";\nimport { UploadsResource } from \"./resources/uploads.js\";\nimport { Transport } from \"./transport.js\";\nimport type {\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisResult,\n\tPublishInput,\n\tPublishOptions,\n\tRequestOptions,\n} from \"./types.js\";\n\nexport class Dropthis {\n\tprivate readonly transport: Transport;\n\tprivate authResource?: AuthResource;\n\tprivate apiKeysResource?: ApiKeysResource;\n\tprivate accountResource?: AccountResource;\n\tprivate dropsResource?: DropsResource;\n\tprivate deploymentsResource?: DeploymentsResource;\n\tprivate uploadsResource?: UploadsResource;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tthis.transport = new Transport(options);\n\t}\n\n\tget auth(): AuthResource {\n\t\tif (!this.authResource)\n\t\t\tthis.authResource = new AuthResource(this.transport);\n\t\treturn this.authResource;\n\t}\n\n\tget apiKeys(): ApiKeysResource {\n\t\tif (!this.apiKeysResource)\n\t\t\tthis.apiKeysResource = new ApiKeysResource(this.transport);\n\t\treturn this.apiKeysResource;\n\t}\n\n\tget account(): AccountResource {\n\t\tif (!this.accountResource)\n\t\t\tthis.accountResource = new AccountResource(this.transport);\n\t\treturn this.accountResource;\n\t}\n\n\tget drops(): DropsResource {\n\t\tif (!this.dropsResource)\n\t\t\tthis.dropsResource = new DropsResource(this.transport);\n\t\treturn this.dropsResource;\n\t}\n\n\tget deployments(): DeploymentsResource {\n\t\tif (!this.deploymentsResource)\n\t\t\tthis.deploymentsResource = new DeploymentsResource(this.transport);\n\t\treturn this.deploymentsResource;\n\t}\n\n\tget uploads(): UploadsResource {\n\t\tif (!this.uploadsResource)\n\t\t\tthis.uploadsResource = new UploadsResource(this.transport);\n\t\treturn this.uploadsResource;\n\t}\n\n\tasync prepare(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<PreparedPublishRequest> {\n\t\treturn preparePublishRequest(input, options);\n\t}\n\n\tasync publish(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst prepared = await preparePublishRequest(input, options);\n\t\treturn publishStaged(this.transport, prepared, \"/drops\", options);\n\t}\n\n\tasync update(\n\t\tdropId: string,\n\t\tinputOrOptions: PublishInput | PublishOptions = {},\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tif (looksLikeOptionsOnly(inputOrOptions)) {\n\t\t\treturn this.drops.update(dropId, inputOrOptions, options);\n\t\t}\n\n\t\tconst prepared = await preparePublishRequest(\n\t\t\tinputOrOptions as PublishInput,\n\t\t\toptions,\n\t\t);\n\t\tconst path = `/drops/${encodeURIComponent(dropId)}/deployments`;\n\t\treturn publishStaged(this.transport, prepared, path, options);\n\t}\n\n\trequest<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.transport.request<T>(method, path, options);\n\t}\n\n\trequestSignedUpload(\n\t\turl: string,\n\t\tbytes: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\treturn this.transport.putSignedUrl(url, bytes, headers);\n\t}\n}\n\nfunction looksLikeOptionsOnly(\n\tinput: PublishInput | PublishOptions,\n): input is PublishOptions {\n\tif (input instanceof Uint8Array) return false;\n\tif (typeof input !== \"object\" || input === null) return false;\n\treturn !(\"content\" in input || \"files\" in input);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,mBAAqB;AACrB,IAAAC,oBAAyB;;;ACDlB,SAAS,WAAW,KAAqB;AAC/C,SAAO,IAAI,QAAQ,aAAa,CAAC,GAAG,SAAiB,KAAK,YAAY,CAAC;AACxE;AAEO,SAAS,WAAW,KAAqB;AAC/C,SAAO,IAAI,QAAQ,UAAU,CAAC,SAAS,IAAI,KAAK,YAAY,CAAC,EAAE;AAChE;AAEO,SAAS,YAAY,OAAyB;AACpD,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,WAAW;AACtD,MAAI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;AACT,WAAK,kBAAkB,IAAI,gBAAgB,KAAK,SAAS;AAC1D,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,MAAM,QACL,OACA,UAA0B,CAAC,GACO;AAClC,WAAO,sBAAsB,OAAO,OAAO;AAAA,EAC5C;AAAA,EAEA,MAAM,QACL,OACA,UAA0B,CAAC,GACa;AACxC,UAAM,WAAW,MAAM,sBAAsB,OAAO,OAAO;AAC3D,WAAO,cAAc,KAAK,WAAW,UAAU,UAAU,OAAO;AAAA,EACjE;AAAA,EAEA,MAAM,OACL,QACA,iBAAgD,CAAC,GACjD,UAA0B,CAAC,GACa;AACxC,QAAI,qBAAqB,cAAc,GAAG;AACzC,aAAO,KAAK,MAAM,OAAO,QAAQ,gBAAgB,OAAO;AAAA,IACzD;AAEA,UAAM,WAAW,MAAM;AAAA,MACtB;AAAA,MACA;AAAA,IACD;AACA,UAAM,OAAO,UAAU,mBAAmB,MAAM,CAAC;AACjD,WAAO,cAAc,KAAK,WAAW,UAAU,MAAM,OAAO;AAAA,EAC7D;AAAA,EAEA,QACC,QACA,MACA,UAGI,CAAC,GACwB;AAC7B,WAAO,KAAK,UAAU,QAAW,QAAQ,MAAM,OAAO;AAAA,EACvD;AAAA,EAEA,oBACC,KACA,OACA,SACmD;AACnD,WAAO,KAAK,UAAU,aAAa,KAAK,OAAO,OAAO;AAAA,EACvD;AACD;AAEA,SAAS,qBACR,OAC0B;AAC1B,MAAI,iBAAiB,WAAY,QAAO;AACxC,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,SAAO,EAAE,aAAa,SAAS,WAAW;AAC3C;","names":["import_promises","import_node_path","ignore","fg","import_node_crypto","import_promises"]}
|
|
@@ -229,22 +229,6 @@ type ExplicitPublishInput = {
|
|
|
229
229
|
visibility?: "public" | "unlisted";
|
|
230
230
|
metadata?: Record<string, unknown>;
|
|
231
231
|
entry?: string;
|
|
232
|
-
} | {
|
|
233
|
-
sourceUrl: string;
|
|
234
|
-
title?: string;
|
|
235
|
-
visibility?: "public" | "unlisted";
|
|
236
|
-
metadata?: Record<string, unknown>;
|
|
237
|
-
entry?: string;
|
|
238
|
-
} | {
|
|
239
|
-
sourceUrls: Array<{
|
|
240
|
-
url: string;
|
|
241
|
-
path: string;
|
|
242
|
-
contentType?: string;
|
|
243
|
-
}>;
|
|
244
|
-
title?: string;
|
|
245
|
-
visibility?: "public" | "unlisted";
|
|
246
|
-
metadata?: Record<string, unknown>;
|
|
247
|
-
entry?: string;
|
|
248
232
|
} | {
|
|
249
233
|
files: Array<{
|
|
250
234
|
path: string;
|
|
@@ -258,7 +242,7 @@ type ExplicitPublishInput = {
|
|
|
258
242
|
metadata?: Record<string, unknown>;
|
|
259
243
|
entry?: string;
|
|
260
244
|
};
|
|
261
|
-
type PublishInput = string |
|
|
245
|
+
type PublishInput = string | Uint8Array | ExplicitPublishInput;
|
|
262
246
|
|
|
263
247
|
type PreparedUploadFile = {
|
|
264
248
|
path: string;
|
|
@@ -274,9 +258,6 @@ type PreparedUploadFile = {
|
|
|
274
258
|
};
|
|
275
259
|
};
|
|
276
260
|
type PreparedPublishRequest = {
|
|
277
|
-
kind: "json";
|
|
278
|
-
body: Record<string, unknown>;
|
|
279
|
-
} | {
|
|
280
261
|
kind: "staged";
|
|
281
262
|
manifest: CreateUploadSessionRequest;
|
|
282
263
|
files: PreparedUploadFile[];
|
|
@@ -229,22 +229,6 @@ type ExplicitPublishInput = {
|
|
|
229
229
|
visibility?: "public" | "unlisted";
|
|
230
230
|
metadata?: Record<string, unknown>;
|
|
231
231
|
entry?: string;
|
|
232
|
-
} | {
|
|
233
|
-
sourceUrl: string;
|
|
234
|
-
title?: string;
|
|
235
|
-
visibility?: "public" | "unlisted";
|
|
236
|
-
metadata?: Record<string, unknown>;
|
|
237
|
-
entry?: string;
|
|
238
|
-
} | {
|
|
239
|
-
sourceUrls: Array<{
|
|
240
|
-
url: string;
|
|
241
|
-
path: string;
|
|
242
|
-
contentType?: string;
|
|
243
|
-
}>;
|
|
244
|
-
title?: string;
|
|
245
|
-
visibility?: "public" | "unlisted";
|
|
246
|
-
metadata?: Record<string, unknown>;
|
|
247
|
-
entry?: string;
|
|
248
232
|
} | {
|
|
249
233
|
files: Array<{
|
|
250
234
|
path: string;
|
|
@@ -258,7 +242,7 @@ type ExplicitPublishInput = {
|
|
|
258
242
|
metadata?: Record<string, unknown>;
|
|
259
243
|
entry?: string;
|
|
260
244
|
};
|
|
261
|
-
type PublishInput = string |
|
|
245
|
+
type PublishInput = string | Uint8Array | ExplicitPublishInput;
|
|
262
246
|
|
|
263
247
|
type PreparedUploadFile = {
|
|
264
248
|
path: string;
|
|
@@ -274,9 +258,6 @@ type PreparedUploadFile = {
|
|
|
274
258
|
};
|
|
275
259
|
};
|
|
276
260
|
type PreparedPublishRequest = {
|
|
277
|
-
kind: "json";
|
|
278
|
-
body: Record<string, unknown>;
|
|
279
|
-
} | {
|
|
280
261
|
kind: "staged";
|
|
281
262
|
manifest: CreateUploadSessionRequest;
|
|
282
263
|
files: PreparedUploadFile[];
|