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
|
@@ -65,16 +65,6 @@ function detectStringInput(value) {
|
|
|
65
65
|
contentType: looksLikeHtml(value) ? "text/html" : "text/plain; charset=utf-8"
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function isTextLikeContentType(contentType) {
|
|
69
|
-
const normalized = contentType.toLowerCase().split(";", 1)[0]?.trim() ?? "";
|
|
70
|
-
return normalized.startsWith("text/") || [
|
|
71
|
-
"application/json",
|
|
72
|
-
"application/javascript",
|
|
73
|
-
"application/xml",
|
|
74
|
-
"application/xhtml+xml",
|
|
75
|
-
"image/svg+xml"
|
|
76
|
-
].includes(normalized);
|
|
77
|
-
}
|
|
78
68
|
function detectBytesContentType(bytes) {
|
|
79
69
|
const text = Buffer.from(bytes).toString("utf8");
|
|
80
70
|
if (text.includes("\uFFFD")) return "application/octet-stream";
|
|
@@ -149,11 +139,12 @@ async function detectPathContentType(path) {
|
|
|
149
139
|
}
|
|
150
140
|
|
|
151
141
|
// src/publish/prepare.ts
|
|
152
|
-
var MAX_INLINE_CONTENT_BYTES = 1048576;
|
|
153
142
|
var SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES = 10 * 1024 * 1024;
|
|
154
143
|
async function preparePublishRequest(input, options = {}) {
|
|
155
144
|
if (input instanceof URL) {
|
|
156
|
-
|
|
145
|
+
throw new Error(
|
|
146
|
+
"URL inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
147
|
+
);
|
|
157
148
|
}
|
|
158
149
|
if (typeof input === "string") {
|
|
159
150
|
const local = await localKind(input);
|
|
@@ -165,7 +156,9 @@ async function preparePublishRequest(input, options = {}) {
|
|
|
165
156
|
}
|
|
166
157
|
const detection = detectStringInput(input);
|
|
167
158
|
if (detection.mode === "sourceUrl")
|
|
168
|
-
|
|
159
|
+
throw new Error(
|
|
160
|
+
"URL inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
161
|
+
);
|
|
169
162
|
return stringContent(input, options, detection.contentType);
|
|
170
163
|
}
|
|
171
164
|
if (input instanceof Uint8Array || Buffer.isBuffer(input)) {
|
|
@@ -175,20 +168,23 @@ async function preparePublishRequest(input, options = {}) {
|
|
|
175
168
|
}
|
|
176
169
|
async function stringContent(content, options, detectedContentType) {
|
|
177
170
|
const contentType = options.contentType ?? detectedContentType;
|
|
178
|
-
const sizeBytes = Buffer.byteLength(content);
|
|
179
|
-
if (sizeBytes <= MAX_INLINE_CONTENT_BYTES && isTextLikeContentType(contentType)) {
|
|
180
|
-
return jsonBody({
|
|
181
|
-
content,
|
|
182
|
-
content_type: contentType,
|
|
183
|
-
...commonFields(options)
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
171
|
return bytesStaged(Buffer.from(content), {
|
|
187
172
|
...options,
|
|
188
|
-
path: options.path ??
|
|
189
|
-
contentType
|
|
173
|
+
path: options.path ?? entryForContentType(contentType),
|
|
174
|
+
contentType
|
|
190
175
|
});
|
|
191
176
|
}
|
|
177
|
+
function entryForContentType(contentType) {
|
|
178
|
+
const normalized = contentType.toLowerCase().split(";", 1)[0]?.trim() ?? "";
|
|
179
|
+
if (normalized === "text/html" || normalized === "application/xhtml+xml")
|
|
180
|
+
return "index.html";
|
|
181
|
+
if (normalized === "application/json") return "index.json";
|
|
182
|
+
if (normalized === "text/css") return "index.css";
|
|
183
|
+
if (normalized === "text/javascript" || normalized === "application/javascript")
|
|
184
|
+
return "index.js";
|
|
185
|
+
if (normalized.startsWith("text/")) return "index.txt";
|
|
186
|
+
return "index";
|
|
187
|
+
}
|
|
192
188
|
async function localKind(input) {
|
|
193
189
|
try {
|
|
194
190
|
const info = await stat2(input);
|
|
@@ -271,15 +267,13 @@ async function explicitInput(input, options) {
|
|
|
271
267
|
input.contentType ?? options.contentType ?? "text/html"
|
|
272
268
|
);
|
|
273
269
|
if ("sourceUrl" in input)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
270
|
+
throw new Error(
|
|
271
|
+
"sourceUrl inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
272
|
+
);
|
|
278
273
|
if ("sourceUrls" in input)
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
});
|
|
274
|
+
throw new Error(
|
|
275
|
+
"sourceUrls inputs are not supported. Fetch the content first, then pass it as a string or file."
|
|
276
|
+
);
|
|
283
277
|
return stagedRequest(
|
|
284
278
|
input.files.map((file) => {
|
|
285
279
|
const bytes = explicitFileBytes(file);
|
|
@@ -300,13 +294,6 @@ function explicitFileBytes(file) {
|
|
|
300
294
|
if (file.bytes !== void 0) return file.bytes;
|
|
301
295
|
throw new TypeError(`Explicit file ${file.path} is missing content bytes`);
|
|
302
296
|
}
|
|
303
|
-
function commonFields(options) {
|
|
304
|
-
return {
|
|
305
|
-
...options.entry ? { entry: options.entry } : {},
|
|
306
|
-
options: optionsBody(options),
|
|
307
|
-
...options.metadata ? { metadata: options.metadata } : {}
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
297
|
function optionsBody(options) {
|
|
311
298
|
return toSnakeCase({
|
|
312
299
|
title: options.title,
|
|
@@ -316,9 +303,6 @@ function optionsBody(options) {
|
|
|
316
303
|
expiresAt: options.expiresAt instanceof Date ? options.expiresAt.toISOString() : options.expiresAt
|
|
317
304
|
});
|
|
318
305
|
}
|
|
319
|
-
function jsonBody(body) {
|
|
320
|
-
return { kind: "json", body };
|
|
321
|
-
}
|
|
322
306
|
|
|
323
307
|
// src/publish/upload.ts
|
|
324
308
|
import { randomUUID } from "crypto";
|
|
@@ -696,17 +680,9 @@ function updateBody(body) {
|
|
|
696
680
|
return toSnakeCase({ options: dropOptions, metadata });
|
|
697
681
|
}
|
|
698
682
|
function hasContent(body) {
|
|
699
|
-
return [
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
"content_type",
|
|
703
|
-
"entry",
|
|
704
|
-
"files",
|
|
705
|
-
"sourceUrl",
|
|
706
|
-
"sourceUrls",
|
|
707
|
-
"source_url",
|
|
708
|
-
"source_urls"
|
|
709
|
-
].some((field) => body[field] !== void 0);
|
|
683
|
+
return ["content", "contentType", "content_type", "entry", "files"].some(
|
|
684
|
+
(field) => body[field] !== void 0
|
|
685
|
+
);
|
|
710
686
|
}
|
|
711
687
|
|
|
712
688
|
// src/resources/uploads.ts
|
|
@@ -958,14 +934,6 @@ var Dropthis = class {
|
|
|
958
934
|
}
|
|
959
935
|
async publish(input, options = {}) {
|
|
960
936
|
const prepared = await preparePublishRequest(input, options);
|
|
961
|
-
if (prepared.kind === "json") {
|
|
962
|
-
const requestOptions = {
|
|
963
|
-
body: prepared.body
|
|
964
|
-
};
|
|
965
|
-
if (options.idempotencyKey)
|
|
966
|
-
requestOptions.idempotencyKey = options.idempotencyKey;
|
|
967
|
-
return this.transport.request("POST", "/drops", requestOptions);
|
|
968
|
-
}
|
|
969
937
|
return publishStaged(this.transport, prepared, "/drops", options);
|
|
970
938
|
}
|
|
971
939
|
async update(dropId, inputOrOptions = {}, options = {}) {
|
|
@@ -977,16 +945,6 @@ var Dropthis = class {
|
|
|
977
945
|
options
|
|
978
946
|
);
|
|
979
947
|
const path = `/drops/${encodeURIComponent(dropId)}/deployments`;
|
|
980
|
-
if (prepared.kind === "json") {
|
|
981
|
-
const requestOptions = {
|
|
982
|
-
body: prepared.body
|
|
983
|
-
};
|
|
984
|
-
if (options.idempotencyKey)
|
|
985
|
-
requestOptions.idempotencyKey = options.idempotencyKey;
|
|
986
|
-
if (options.ifRevision !== void 0)
|
|
987
|
-
requestOptions.ifRevision = options.ifRevision;
|
|
988
|
-
return this.transport.request("POST", path, requestOptions);
|
|
989
|
-
}
|
|
990
948
|
return publishStaged(this.transport, prepared, path, options);
|
|
991
949
|
}
|
|
992
950
|
request(method, path, options = {}) {
|
|
@@ -997,9 +955,9 @@ var Dropthis = class {
|
|
|
997
955
|
}
|
|
998
956
|
};
|
|
999
957
|
function looksLikeOptionsOnly(input) {
|
|
1000
|
-
if (input instanceof
|
|
958
|
+
if (input instanceof Uint8Array) return false;
|
|
1001
959
|
if (typeof input !== "object" || input === null) return false;
|
|
1002
|
-
return !("content" in input || "files" in input
|
|
960
|
+
return !("content" in input || "files" in input);
|
|
1003
961
|
}
|
|
1004
962
|
export {
|
|
1005
963
|
DeploymentsResource,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../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":["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,SAAS,QAAAA,aAAY;AACrB,SAAS,YAAAC,iBAAgB;;;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,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM;AAAA,QAC1C,WAAW,GAAG;AAAA,QACd,YAAY,IAAI;AAAA,MACjB,CAAC;AAAA,IACF;AAAA,EACD;AACA,SAAO;AACR;AAEO,SAAS,YAAY,OAAyB;AACpD,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,WAAW;AACtD,MAAI,SAAS,OAAO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AI,SAAS,SAAS,QAAQ;AAC7B,YAAM,iBAAsD;AAAA,QAC3D,MAAM,SAAS;AAAA,MAChB;AACA,UAAI,QAAQ;AACX,uBAAe,iBAAiB,QAAQ;AACzC,UAAI,QAAQ,eAAe;AAC1B,uBAAe,aAAa,QAAQ;AACrC,aAAO,KAAK,UAAU,QAAQ,QAAQ,MAAM,cAAc;AAAA,IAC3D;AACA,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,OAAO,iBAAiB,WAAY,QAAO;AAChE,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,SAAO,EACN,aAAa,SACb,WAAW,SACX,eAAe,SACf,gBAAgB;AAElB;","names":["stat","basename","stat","basename","readFile","readFile"]}
|
|
1
|
+
{"version":3,"sources":["../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":["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,SAAS,QAAAA,aAAY;AACrB,SAAS,YAAAC,iBAAgB;;;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,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,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,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":["stat","basename","stat","basename","readFile","readFile"]}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"description": "Official Node.js SDK for Dropthis.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/dropthis-dev/dropthis-node"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"main": "./dist/index.cjs",
|
|
8
12
|
"module": "./dist/index.mjs",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dropthis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Official CLI for Dropthis.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@clack/prompts": "1.4.0",
|
|
35
35
|
"@commander-js/extra-typings": "14.0.0",
|
|
36
|
-
"@dropthis/sdk": "
|
|
36
|
+
"@dropthis/sdk": "^0.1.0",
|
|
37
37
|
"@napi-rs/keyring": "1.3.0",
|
|
38
38
|
"commander": "14.0.3",
|
|
39
39
|
"conf": "15.1.0",
|
|
@@ -46,5 +46,8 @@
|
|
|
46
46
|
"tsx": "4.20.0",
|
|
47
47
|
"typescript": "5.9.3",
|
|
48
48
|
"vitest": "4.1.7"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"bundleDependencies": [
|
|
51
|
+
"@dropthis/sdk"
|
|
52
|
+
]
|
|
50
53
|
}
|