@dropthis/cli 0.3.5 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +10 -4
- package/dist/cli.cjs.map +1 -1
- package/node_modules/@dropthis/node/README.md +181 -53
- package/node_modules/@dropthis/node/dist/index.cjs +178 -157
- package/node_modules/@dropthis/node/dist/index.cjs.map +1 -1
- package/node_modules/@dropthis/node/dist/index.d.cts +87 -26
- package/node_modules/@dropthis/node/dist/index.d.ts +87 -26
- package/node_modules/@dropthis/node/dist/index.mjs +177 -157
- package/node_modules/@dropthis/node/dist/index.mjs.map +1 -1
- package/node_modules/@dropthis/node/package.json +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/publish/prepare.ts","../src/case.ts","../src/publish/checksum.ts","../src/publish/detect.ts","../src/publish/files.ts","../src/publish/upload.ts","../src/errors.ts","../src/resources/account.ts","../src/resources/api-keys.ts","../src/resources/auth.ts","../src/resources/deployments.ts","../src/types.ts","../src/resources/drops.ts","../src/resources/uploads.ts","../src/transport.ts","../src/dropthis.ts"],"sourcesContent":["export { Dropthis } from \"./dropthis.js\";\nexport { createErrorResult, redactSecrets } from \"./errors.js\";\nexport type {\n\tPreparedPublishRequest,\n\tPreparedUploadFile,\n} from \"./publish/prepare.js\";\nexport { DeploymentsResource } from \"./resources/deployments.js\";\nexport { UploadsResource } from \"./resources/uploads.js\";\nexport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisErrorResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n\tListPage,\n\tRequestOptions,\n\tUploadManifestFile,\n\tUploadPartTarget,\n\tUploadSessionFileResponse,\n\tUploadSessionResponse,\n\tUploadTarget,\n} from \"./types.js\";\n","import { stat } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport { toSnakeCase } from \"../case.js\";\nimport type {\n\tCreateUploadSessionRequest,\n\tExplicitPublishInput,\n\tPublishInput,\n\tPublishOptions,\n\tUploadManifestFile,\n} from \"../types.js\";\nimport { sha256Bytes, sha256File } from \"./checksum.js\";\nimport { detectBytesContentType, detectStringInput } from \"./detect.js\";\nimport { collectPublishFiles, detectPathContentType } from \"./files.js\";\n\nconst SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES = 10 * 1024 * 1024;\n\nexport type PreparedUploadFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string;\n\tsource: { kind: \"path\"; path: string } | { kind: \"bytes\"; bytes: Uint8Array };\n};\n\ntype ExplicitFileInput = Extract<\n\tExplicitPublishInput,\n\t{ files: unknown }\n>[\"files\"][number];\n\nexport type PreparedPublishRequest = {\n\tkind: \"staged\";\n\tmanifest: CreateUploadSessionRequest;\n\tfiles: PreparedUploadFile[];\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport async function preparePublishRequest(\n\tinput: PublishInput,\n\toptions: PublishOptions = {},\n): Promise<PreparedPublishRequest> {\n\tif (input instanceof URL) {\n\t\tthrow new Error(\n\t\t\t\"URL inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\t}\n\tif (typeof input === \"string\") {\n\t\tconst local = await localKind(input);\n\t\tif (local === \"file\") {\n\t\t\treturn fileStaged(input, options);\n\t\t}\n\t\tif (local === \"directory\") {\n\t\t\treturn folderStaged(input, options);\n\t\t}\n\t\tconst detection = detectStringInput(input);\n\t\tif (detection.mode === \"sourceUrl\")\n\t\t\tthrow new Error(\n\t\t\t\t\"URL inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t\t);\n\t\treturn stringContent(input, options, detection.contentType);\n\t}\n\tif (input instanceof Uint8Array || Buffer.isBuffer(input)) {\n\t\treturn bytesStaged(input, options);\n\t}\n\treturn explicitInput(input, options);\n}\n\nasync function stringContent(\n\tcontent: string,\n\toptions: PublishOptions,\n\tdetectedContentType: string,\n): Promise<PreparedPublishRequest> {\n\tconst contentType = options.contentType ?? detectedContentType;\n\treturn bytesStaged(Buffer.from(content), {\n\t\t...options,\n\t\tpath: options.path ?? entryForContentType(contentType),\n\t\tcontentType,\n\t});\n}\n\nfunction entryForContentType(contentType: string): string {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\tif (normalized === \"text/html\" || normalized === \"application/xhtml+xml\")\n\t\treturn \"index.html\";\n\tif (normalized === \"application/json\") return \"index.json\";\n\tif (normalized === \"text/css\") return \"index.css\";\n\tif (\n\t\tnormalized === \"text/javascript\" ||\n\t\tnormalized === \"application/javascript\"\n\t)\n\t\treturn \"index.js\";\n\tif (normalized.startsWith(\"text/\")) return \"index.txt\";\n\treturn \"index\";\n}\n\nasync function localKind(\n\tinput: string,\n): Promise<\"file\" | \"directory\" | \"none\"> {\n\ttry {\n\t\tconst info = await stat(input);\n\t\tif (info.isFile()) return \"file\";\n\t\tif (info.isDirectory()) return \"directory\";\n\t\treturn \"none\";\n\t} catch {\n\t\treturn \"none\";\n\t}\n}\n\nasync function fileStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst fileStat = await stat(path);\n\tconst manifestPath = options.path ?? basename(path);\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: manifestPath,\n\t\t\t\tcontentType: options.contentType ?? (await detectPathContentType(path)),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t\tsource: { kind: \"path\", path },\n\t\t\t},\n\t\t],\n\t\t{ ...options, entry: options.entry ?? manifestPath },\n\t);\n}\n\nasync function folderStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst files = (await collectPublishFiles(path, options)).map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\tsource: { kind: \"path\", path: file.absolutePath } as const,\n\t}));\n\treturn stagedRequest(files, options);\n}\n\nasync function bytesStaged(\n\tbytes: Uint8Array,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: options.path ?? \"index\",\n\t\t\t\tcontentType: options.contentType ?? detectBytesContentType(bytes),\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes },\n\t\t\t},\n\t\t],\n\t\toptions,\n\t);\n}\n\nasync function stagedRequest(\n\tfiles: PreparedUploadFile[],\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst preparedFiles = await Promise.all(\n\t\tfiles.map(async (file) => {\n\t\t\tif (file.sizeBytes <= SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES) return file;\n\t\t\tconst checksumSha256 =\n\t\t\t\tfile.source.kind === \"bytes\"\n\t\t\t\t\t? sha256Bytes(file.source.bytes)\n\t\t\t\t\t: await sha256File(file.source.path);\n\t\t\treturn { ...file, checksumSha256 };\n\t\t}),\n\t);\n\tconst manifestFiles: UploadManifestFile[] = preparedFiles.map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\t...(file.checksumSha256 ? { checksumSha256: file.checksumSha256 } : {}),\n\t}));\n\tconst prepared: Extract<PreparedPublishRequest, { kind: \"staged\" }> = {\n\t\tkind: \"staged\",\n\t\tmanifest: {\n\t\t\tschemaVersion: 1,\n\t\t\tfiles: manifestFiles,\n\t\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\t},\n\t\tfiles: preparedFiles,\n\t\toptions: optionsBody(options),\n\t};\n\tif (options.metadata) prepared.metadata = options.metadata;\n\treturn prepared;\n}\n\nasync function explicitInput(\n\tinput: ExplicitPublishInput,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tif (\"content\" in input)\n\t\treturn stringContent(\n\t\t\tinput.content,\n\t\t\t{ ...options, ...input },\n\t\t\tinput.contentType ?? options.contentType ?? \"text/html\",\n\t\t);\n\tif (\"sourceUrl\" in input)\n\t\tthrow new Error(\n\t\t\t\"sourceUrl inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\tif (\"sourceUrls\" in input)\n\t\tthrow new Error(\n\t\t\t\"sourceUrls inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\treturn stagedRequest(\n\t\tinput.files.map((file) => {\n\t\t\tconst bytes = explicitFileBytes(file);\n\t\t\treturn {\n\t\t\t\tpath: file.path,\n\t\t\t\tcontentType: file.contentType,\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes } as const,\n\t\t\t};\n\t\t}),\n\t\t{ ...options, ...input },\n\t);\n}\n\nfunction explicitFileBytes(file: ExplicitFileInput): Uint8Array {\n\tif (file.content !== undefined) return Buffer.from(file.content);\n\tif (file.contentBase64 !== undefined)\n\t\treturn Buffer.from(file.contentBase64, \"base64\");\n\tif (file.bytes !== undefined) return file.bytes;\n\tthrow new TypeError(`Explicit file ${file.path} is missing content bytes`);\n}\n\nfunction optionsBody(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): Record<string, unknown> {\n\treturn toSnakeCase({\n\t\ttitle: options.title,\n\t\tvisibility: options.visibility,\n\t\tpassword: options.password,\n\t\tnoindex: options.noindex,\n\t\texpiresAt:\n\t\t\toptions.expiresAt instanceof Date\n\t\t\t\t? options.expiresAt.toISOString()\n\t\t\t\t: options.expiresAt,\n\t}) as Record<string, unknown>;\n}\n","export function toCamelKey(key: string): string {\n\treturn key.replace(/_([a-z])/g, (_, char: string) => char.toUpperCase());\n}\n\nexport function toSnakeKey(key: string): string {\n\treturn key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`);\n}\n\nexport function toCamelCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toCamelCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value).map(([key, item]) => [\n\t\t\t\ttoCamelKey(key),\n\t\t\t\ttoCamelCase(item),\n\t\t\t]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function toSnakeCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toSnakeCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value)\n\t\t\t\t.filter(([, item]) => item !== undefined)\n\t\t\t\t.map(([key, item]) => [toSnakeKey(key), toSnakeCase(item)]),\n\t\t);\n\t}\n\treturn value;\n}\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\n\nexport function sha256Bytes(bytes: Uint8Array): string {\n\treturn createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nexport async function sha256File(path: string): Promise<string> {\n\tconst hash = createHash(\"sha256\");\n\tfor await (const chunk of createReadStream(path)) {\n\t\thash.update(chunk);\n\t}\n\treturn hash.digest(\"hex\");\n}\n","export type StringInputDetection =\n\t| { mode: \"sourceUrl\" }\n\t| {\n\t\t\tmode: \"content\";\n\t\t\tcontentType: \"text/html\" | \"text/plain; charset=utf-8\";\n\t };\n\nexport function isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn url.protocol === \"http:\" || url.protocol === \"https:\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function looksLikeHtml(value: string): boolean {\n\tconst trimmed = value.trimStart().toLowerCase();\n\treturn (\n\t\ttrimmed.startsWith(\"<!doctype html\") ||\n\t\ttrimmed.startsWith(\"<html\") ||\n\t\t/^<[a-z][a-z0-9:-]*(\\s|>)/.test(trimmed)\n\t);\n}\n\nexport function detectStringInput(value: string): StringInputDetection {\n\tif (isHttpUrl(value)) return { mode: \"sourceUrl\" as const };\n\treturn {\n\t\tmode: \"content\",\n\t\tcontentType: looksLikeHtml(value)\n\t\t\t? \"text/html\"\n\t\t\t: \"text/plain; charset=utf-8\",\n\t};\n}\n\nexport function isTextLikeContentType(contentType: string): boolean {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\treturn (\n\t\tnormalized.startsWith(\"text/\") ||\n\t\t[\n\t\t\t\"application/json\",\n\t\t\t\"application/javascript\",\n\t\t\t\"application/xml\",\n\t\t\t\"application/xhtml+xml\",\n\t\t\t\"image/svg+xml\",\n\t\t].includes(normalized)\n\t);\n}\n\nexport function detectBytesContentType(bytes: Uint8Array): string {\n\tconst text = Buffer.from(bytes).toString(\"utf8\");\n\tif (text.includes(\"\\uFFFD\")) return \"application/octet-stream\";\n\treturn looksLikeHtml(text) ? \"text/html\" : \"text/plain; charset=utf-8\";\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport { basename, sep } from \"node:path\";\nimport fg from \"fast-glob\";\nimport ignore from \"ignore\";\nimport { lookup } from \"mime-types\";\nimport { detectBytesContentType } from \"./detect.js\";\n\nexport type PublishFile = {\n\tabsolutePath: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\nconst DEFAULT_IGNORES = [\n\t\".git\",\n\t\".git/**\",\n\t\"node_modules\",\n\t\"node_modules/**\",\n\t\".DS_Store\",\n\t\".env\",\n\t\".env.*\",\n\t\".cache\",\n\t\".cache/**\",\n\t\".tmp\",\n\t\".tmp/**\",\n\t\"dist/.cache\",\n\t\"dist/.cache/**\",\n];\n\nexport async function collectPublishFiles(\n\tinputPath: string,\n\toptions: { ignore?: string[]; ignoreDefaults?: boolean } = {},\n): Promise<PublishFile[]> {\n\tconst inputStat = await stat(inputPath);\n\tif (inputStat.isFile()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tabsolutePath: inputPath,\n\t\t\t\tpath: basename(inputPath),\n\t\t\t\tcontentType: await detectPathContentType(inputPath),\n\t\t\t\tsizeBytes: inputStat.size,\n\t\t\t},\n\t\t];\n\t}\n\tif (!inputStat.isDirectory()) {\n\t\tthrow new Error(`Input is not a file or directory: ${inputPath}`);\n\t}\n\n\tconst matcher = ignore().add([\n\t\t...(options.ignoreDefaults === false ? [] : DEFAULT_IGNORES),\n\t\t...(options.ignore ?? []),\n\t]);\n\tconst entries = await fg(\"**/*\", {\n\t\tcwd: inputPath,\n\t\tonlyFiles: true,\n\t\tfollowSymbolicLinks: false,\n\t\tdot: true,\n\t\tunique: true,\n\t});\n\tconst paths = entries\n\t\t.map((entry) => entry.split(sep).join(\"/\"))\n\t\t.filter((entry) => !matcher.ignores(entry))\n\t\t.sort((a, b) => a.localeCompare(b));\n\treturn Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst absolutePath = `${inputPath}/${path}`;\n\t\t\tconst fileStat = await stat(absolutePath);\n\t\t\treturn {\n\t\t\t\tabsolutePath,\n\t\t\t\tpath,\n\t\t\t\tcontentType: await detectPathContentType(absolutePath),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t};\n\t\t}),\n\t);\n}\n\nexport async function detectPathContentType(path: string): Promise<string> {\n\tconst detected = lookup(path);\n\tif (detected) return detected;\n\treturn detectBytesContentType(await readFile(path));\n}\n","import { randomUUID } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { toSnakeCase } from \"../case.js\";\nimport { createErrorResult } from \"../errors.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionResponse,\n\tDropResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\nimport type { PreparedPublishRequest, PreparedUploadFile } from \"./prepare.js\";\n\ntype PreparedStagedPublish = Extract<\n\tPreparedPublishRequest,\n\t{ kind: \"staged\" }\n>;\n\ntype StagedPublishOptions = {\n\tidempotencyKey?: string;\n\tifRevision?: number;\n};\n\nconst MAX_PART_TARGETS_PER_REQUEST = 100;\n\nexport async function publishStaged(\n\ttransport: Transport,\n\tprepared: PreparedStagedPublish,\n\tfinalPath: string,\n\toptions: StagedPublishOptions = {},\n): Promise<DropthisResult<DropResponse>> {\n\tconst baseKey = options.idempotencyKey ?? `sdk-${randomUUID()}`;\n\tconst createResult = await transport.request<CreateUploadSessionResponse>(\n\t\t\"POST\",\n\t\t\"/uploads\",\n\t\t{\n\t\t\tbody: toSnakeCase(prepared.manifest),\n\t\t\tidempotencyKey: `${baseKey}:create-upload`,\n\t\t},\n\t);\n\tif (createResult.error) return errorResult(createResult);\n\n\tconst completedFiles: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> }\n\t> = {};\n\tfor (const file of prepared.files) {\n\t\tconst target = createResult.data.files.find(\n\t\t\t(candidate) => candidate.path === file.path,\n\t\t);\n\t\tif (!target) {\n\t\t\treturn createErrorResult(\n\t\t\t\t\"upload_target_missing\",\n\t\t\t\t`Upload target missing for ${file.path}`,\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\t\tif (target.upload.strategy === \"multipart\") {\n\t\t\tconst partsResult = await uploadMultipartFile(\n\t\t\t\ttransport,\n\t\t\t\tcreateResult.data.uploadId,\n\t\t\t\ttarget.fileId,\n\t\t\t\tfile,\n\t\t\t\ttarget.upload.partSize,\n\t\t\t);\n\t\t\tif (partsResult.error) return errorResult(partsResult);\n\t\t\tcompletedFiles[target.fileId] = { parts: partsResult.data };\n\t\t\tcontinue;\n\t\t}\n\t\tconst bytes = await fileBytes(file);\n\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\ttarget.upload.url,\n\t\t\tbytes,\n\t\t\ttarget.upload.headers,\n\t\t);\n\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t}\n\n\tconst completeResult = await transport.request<UploadSessionResponse>(\n\t\t\"POST\",\n\t\t`/uploads/${encodeURIComponent(createResult.data.uploadId)}/complete`,\n\t\t{\n\t\t\tbody: toSnakeCase({ files: completedFiles }),\n\t\t\tidempotencyKey: `${baseKey}:complete-upload`,\n\t\t},\n\t);\n\tif (completeResult.error) return errorResult(completeResult);\n\n\tconst finalOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\tbody: {\n\t\t\tupload_id: createResult.data.uploadId,\n\t\t\toptions: prepared.options,\n\t\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\t},\n\t\tidempotencyKey: `${baseKey}:publish`,\n\t};\n\tif (options.ifRevision !== undefined)\n\t\tfinalOptions.ifRevision = options.ifRevision;\n\treturn transport.request(\"POST\", finalPath, finalOptions);\n}\n\nasync function uploadMultipartFile(\n\ttransport: Transport,\n\tuploadId: string,\n\tfileId: string,\n\tfile: PreparedUploadFile,\n\tpartSize: number | undefined,\n): Promise<DropthisResult<Array<{ partNumber: number; etag: string }>>> {\n\tif (!partSize || partSize < 1) {\n\t\treturn createErrorResult(\n\t\t\t\"invalid_upload_target\",\n\t\t\t\"Multipart upload target did not include a valid part size.\",\n\t\t\tnull,\n\t\t);\n\t}\n\tconst bytes = await fileBytes(file);\n\tconst partNumbers = Array.from(\n\t\t{ length: Math.ceil(bytes.byteLength / partSize) },\n\t\t(_, index) => index + 1,\n\t);\n\tconst parts: Array<{ partNumber: number; etag: string }> = [];\n\tfor (\n\t\tlet startIndex = 0;\n\t\tstartIndex < partNumbers.length;\n\t\tstartIndex += MAX_PART_TARGETS_PER_REQUEST\n\t) {\n\t\tconst partNumberBatch = partNumbers.slice(\n\t\t\tstartIndex,\n\t\t\tstartIndex + MAX_PART_TARGETS_PER_REQUEST,\n\t\t);\n\t\tconst targetsResult =\n\t\t\tawait transport.request<CreateUploadPartTargetsResponse>(\n\t\t\t\t\"POST\",\n\t\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t\t{ body: toSnakeCase({ fileId, partNumbers: partNumberBatch }) },\n\t\t\t);\n\t\tif (targetsResult.error) return errorResult(targetsResult);\n\t\tfor (const target of targetsResult.data.parts) {\n\t\t\tconst start = (target.partNumber - 1) * partSize;\n\t\t\tconst end = Math.min(start + partSize, bytes.byteLength);\n\t\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\t\ttarget.url,\n\t\t\t\tbytes.slice(start, end),\n\t\t\t\ttarget.headers,\n\t\t\t);\n\t\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t\t\tif (!uploadResult.data.etag) {\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t\"missing_upload_etag\",\n\t\t\t\t\t\"Signed upload response did not include an ETag.\",\n\t\t\t\t\tnull,\n\t\t\t\t);\n\t\t\t}\n\t\t\tparts.push({\n\t\t\t\tpartNumber: target.partNumber,\n\t\t\t\tetag: uploadResult.data.etag,\n\t\t\t});\n\t\t}\n\t}\n\treturn { data: parts, error: null, headers: {} };\n}\n\nasync function fileBytes(file: PreparedUploadFile): Promise<Uint8Array> {\n\tif (file.source.kind === \"bytes\") return file.source.bytes;\n\treturn readFile(file.source.path);\n}\n\nfunction errorResult<T>(result: DropthisResult<unknown>): DropthisResult<T> {\n\tif (!result.error) throw new Error(\"Expected an error result\");\n\treturn { data: null, error: result.error, headers: result.headers };\n}\n","import type { DropthisResult } from \"./types.js\";\n\nconst API_KEY_RE = /sk_[A-Za-z0-9_-]+/g;\n\nexport function redactSecrets(message: string): string {\n\treturn message.replace(API_KEY_RE, \"sk_[redacted]\");\n}\n\nexport function createErrorResult<T>(\n\tcode: string,\n\tmessage: string,\n\tstatusCode: number | null,\n\textra: {\n\t\ttype?: string;\n\t\tdetail?: unknown;\n\t\tparam?: string | null;\n\t\tcurrentRevision?: number;\n\t\trequestId?: string | null;\n\t\theaders?: Record<string, string>;\n\t} = {},\n): DropthisResult<T> {\n\treturn {\n\t\tdata: null,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage: redactSecrets(message),\n\t\t\tstatusCode,\n\t\t\t...(extra.type ? { type: extra.type } : {}),\n\t\t\t...(extra.detail !== undefined ? { detail: extra.detail } : {}),\n\t\t\t...(extra.param !== undefined ? { param: extra.param } : {}),\n\t\t\t...(extra.currentRevision !== undefined\n\t\t\t\t? { currentRevision: extra.currentRevision }\n\t\t\t\t: {}),\n\t\t\t...(extra.requestId !== undefined ? { requestId: extra.requestId } : {}),\n\t\t},\n\t\theaders: extra.headers ?? {},\n\t};\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type { AccountResponse, DropthisResult } from \"../types.js\";\n\nexport class AccountResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tget(): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"GET\", \"/account\");\n\t}\n\n\tupdate(input: {\n\t\tdisplayName: string | null;\n\t}): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"PATCH\", \"/account\", {\n\t\t\tbody: toSnakeCase(input),\n\t\t});\n\t}\n\n\tdelete(): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\"DELETE\", \"/account\");\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tApiKeyCreatedResponse,\n\tApiKeyResponse,\n\tDropthisResult,\n} from \"../types.js\";\n\nexport class ApiKeysResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tlist(): Promise<DropthisResult<{ object: \"list\"; data: ApiKeyResponse[] }>> {\n\t\treturn this.transport.request(\"GET\", \"/api-keys\");\n\t}\n\n\tcreate(input: {\n\t\tlabel: string;\n\t}): Promise<DropthisResult<ApiKeyCreatedResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/api-keys\", { body: input });\n\t}\n\n\tdelete(keyId: string): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/api-keys/${encodeURIComponent(keyId)}`,\n\t\t);\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tDropthisResult,\n\tEmailOtpResponse,\n\tSessionResponse,\n} from \"../types.js\";\n\nexport class AuthResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\trequestEmailOtp(input: {\n\t\temail: string;\n\t}): Promise<DropthisResult<EmailOtpResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/otp\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tverifyEmailOtp(input: {\n\t\temail: string;\n\t\tcode: string;\n\t}): Promise<DropthisResult<SessionResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/verify\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tlogout(): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\"DELETE\", \"/auth/session\");\n\t}\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n} from \"../types.js\";\n\nexport class DeploymentsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tdropId: string,\n\t\tbody: Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcreateRaw(\n\t\tdropId: string,\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tlist(\n\t\tdropId: string,\n\t\tparams: ListDeploymentsParams = {},\n\t): Promise<DropthisResult<ListDeploymentsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\t{\n\t\t\t\tparams: toSnakeCase(params) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tstring | number | boolean\n\t\t\t\t>,\n\t\t\t},\n\t\t);\n\t}\n\n\tget(\n\t\tdropId: string,\n\t\tdeploymentId: string,\n\t): Promise<DropthisResult<DropDeploymentResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments/${encodeURIComponent(deploymentId)}`,\n\t\t);\n\t}\n}\n","export type DropthisClientOptions = {\n\tapiKey?: string;\n\tbaseUrl?: string;\n\ttimeoutMs?: number;\n\tfetch?: typeof globalThis.fetch;\n};\n\nexport type RequestOptions = {\n\tauthenticated?: boolean;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\ttimeoutMs?: number;\n};\n\nexport type DropthisErrorResponse = {\n\tcode: string;\n\tmessage: string;\n\tstatusCode: number | null;\n\ttype?: string;\n\tdetail?: unknown;\n\tparam?: string | null;\n\tcurrentRevision?: number;\n\trequestId?: string | null;\n};\n\nexport type DropthisResult<T> =\n\t| { data: T; error: null; headers: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: DropthisErrorResponse;\n\t\t\theaders: Record<string, string>;\n\t };\n\nexport type DropResponse = {\n\tid: string;\n\tslug: string;\n\turl: string;\n\tcanonicalHost: string;\n\tdeploymentId: string | null;\n\ttitle: string;\n\tcontentType: string;\n\tvisibility: string;\n\tstatus: string;\n\trevision: number;\n\tcontentRevision: number;\n\taccessRevision: number;\n\tsizeBytes: number;\n\trenderMode: string;\n\twarnings: Array<Record<string, unknown>>;\n\tcreatedAt: string;\n\texpiresAt: string | null;\n};\n\nexport type DropDeploymentResponse = {\n\tid: string;\n\tdropId: string;\n\trevision: number;\n\tstatus: string;\n\tstoragePrefix: string;\n\tentry: string | null;\n\tcontentType: string;\n\trenderMode: string;\n\tfiles: Array<Record<string, unknown>>;\n\twarnings: Array<Record<string, unknown>>;\n\tsizeBytes: number;\n\tclassificationVersion: number;\n\tclassificationReason: string;\n\terrorCode: string | null;\n\terrorMessage: string | null;\n\tcreatedAt: string;\n\treadyAt: string | null;\n\tpublishedAt: string | null;\n};\n\nexport type ListDeploymentsParams = { cursor?: string | null; limit?: number };\n\nexport type ListDeploymentsResponse = {\n\tdeployments: DropDeploymentResponse[];\n\tnextCursor: string | null;\n};\n\nexport type ListPage<T> = {\n\tobject: \"list\";\n\tdata: T[];\n\thasMore: boolean;\n\tnextCursor: string | null;\n\tautoPagingToArray(options?: { limit?: number }): Promise<T[]>;\n\t[Symbol.asyncIterator](): AsyncIterableIterator<T>;\n};\n\nexport type EmailOtpResponse = { ok: true; expiresIn: number };\nexport type SessionResponse = {\n\tobject: \"session\";\n\ttoken: string;\n\taccountId: string;\n\tisNewAccount: boolean;\n\texpiresIn: number;\n};\nexport type ApiKeyResponse = {\n\tobject: \"api_key\";\n\tid: string;\n\tkeyLast4: string;\n\tlabel: string;\n\tcreatedAt: string;\n};\nexport type ApiKeyCreatedResponse = ApiKeyResponse & {\n\tkey: string;\n\taccountId?: string | null;\n\tisNewAccount?: boolean;\n};\nexport type AccountResponse = {\n\tid: string;\n\temail: string;\n\tdisplayName: string | null;\n\tplan: string;\n\tstatus: string;\n\tcreatedAt: string;\n};\nexport type ListDropsParams = { cursor?: string | null; limit?: number };\n\nexport type UploadManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string | null;\n};\n\nexport type CreateUploadSessionRequest = {\n\tschemaVersion?: 1;\n\tfiles: UploadManifestFile[];\n\tentry?: string | null;\n};\n\nexport type UploadTarget = {\n\tstrategy: \"single_put\" | \"multipart\";\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n\tpartSize?: number;\n\tpartCount?: number;\n};\n\nexport type CreateUploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tobjectKey: string;\n\tupload: UploadTarget;\n};\n\nexport type UploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tobjectKey: string;\n\tverified: boolean;\n};\n\nexport type UploadSessionResponse = {\n\tuploadId: string;\n\tstatus: string;\n\texpiresAt: string;\n\tentry?: string | null;\n\tfiles: UploadSessionFileResponse[];\n};\n\nexport type CreateUploadSessionResponse = {\n\tuploadId: string;\n\texpiresAt: string;\n\tfiles: CreateUploadSessionFileResponse[];\n};\n\nexport type CreateUploadPartTargetsRequest = {\n\tfileId: string;\n\tpartNumbers: number[];\n};\n\nexport type UploadPartTarget = {\n\tpartNumber: number;\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n};\n\nexport type CreateUploadPartTargetsResponse = {\n\tfileId: string;\n\turlExpiresAt?: string | null;\n\tparts: UploadPartTarget[];\n};\n\nexport type CompleteUploadSessionRequest = {\n\tfiles?: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> | null }\n\t>;\n};\n\nexport class CursorPage<T> implements ListPage<T> {\n\treadonly object = \"list\" as const;\n\treadonly data: T[];\n\treadonly hasMore: boolean;\n\treadonly nextCursor: string | null;\n\tprivate readonly fetchNextPage:\n\t\t| (() => Promise<DropthisResult<CursorPage<T>>>)\n\t\t| undefined;\n\n\tconstructor(input: {\n\t\tdata: T[];\n\t\thasMore: boolean;\n\t\tnextCursor: string | null;\n\t\tfetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;\n\t}) {\n\t\tthis.data = input.data;\n\t\tthis.hasMore = input.hasMore;\n\t\tthis.nextCursor = input.nextCursor;\n\t\tthis.fetchNextPage = input.fetchNextPage;\n\t}\n\n\tasync autoPagingToArray(options: { limit?: number } = {}): Promise<T[]> {\n\t\tconst items: T[] = [];\n\t\tfor await (const item of this) {\n\t\t\titems.push(item);\n\t\t\tif (options.limit !== undefined && items.length >= options.limit) break;\n\t\t}\n\t\treturn items;\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncIterableIterator<T> {\n\t\tfor (const item of this.data) yield item;\n\t\tlet current: CursorPage<T> = this;\n\t\twhile (current.hasMore && current.fetchNextPage) {\n\t\t\tconst next = await current.fetchNextPage();\n\t\t\tif (next.error) break;\n\t\t\tcurrent = next.data;\n\t\t\tfor (const item of current.data) yield item;\n\t\t}\n\t}\n}\n\nexport type PublishOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean | null;\n\texpiresAt?: string | Date | null;\n\tentry?: string;\n\tmetadata?: Record<string, unknown>;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\tignore?: string[];\n\tignoreDefaults?: boolean;\n\tcontentType?: string;\n\tpath?: string;\n};\n\nexport type UpdateOptions = PublishOptions;\nexport type UpdateTarget = string;\n\nexport type ExplicitPublishInput =\n\t| {\n\t\t\tcontent: string;\n\t\t\tcontentType?: string;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t }\n\t| {\n\t\t\tfiles: Array<{\n\t\t\t\tpath: string;\n\t\t\t\tcontent?: string;\n\t\t\t\tcontentBase64?: string;\n\t\t\t\tbytes?: Uint8Array;\n\t\t\t\tcontentType: string;\n\t\t\t}>;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t };\n\nexport type PublishInput = string | Uint8Array | ExplicitPublishInput;\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport {\n\tCursorPage,\n\ttype DropResponse,\n\ttype DropthisResult,\n\ttype ListDropsParams,\n\ttype PublishOptions,\n} from \"../types.js\";\n\nexport class DropsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tcreateRaw(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tasync list(\n\t\tparams: ListDropsParams = {},\n\t): Promise<DropthisResult<CursorPage<DropResponse>>> {\n\t\tconst result = await this.transport.request<{\n\t\t\tdrops: DropResponse[];\n\t\t\tnextCursor: string | null;\n\t\t}>(\"GET\", \"/drops\", {\n\t\t\tparams: toSnakeCase(params) as Record<string, string | number | boolean>,\n\t\t});\n\t\tif (result.error) return result;\n\t\tconst page = new CursorPage<DropResponse>({\n\t\t\tdata: result.data.drops,\n\t\t\tnextCursor: result.data.nextCursor,\n\t\t\thasMore: result.data.nextCursor !== null,\n\t\t\tfetchNextPage: result.data.nextCursor\n\t\t\t\t? () => this.list({ ...params, cursor: result.data.nextCursor })\n\t\t\t\t: undefined,\n\t\t});\n\t\treturn { data: page, error: null, headers: result.headers };\n\t}\n\n\tget(dropId: string): Promise<DropthisResult<DropResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n\n\tupdate(\n\t\tdropId: string,\n\t\tbody: PublishOptions | Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst bodyRecord = body as Record<string, unknown>;\n\t\tif (hasContent(bodyRecord)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"drops.update() only patches drop options; use deployments.create() or update() for content\",\n\t\t\t);\n\t\t}\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: updateBody(body),\n\t\t};\n\t\tconst bodyOptions = body as PublishOptions;\n\t\tconst idempotencyKey = options.idempotencyKey ?? bodyOptions.idempotencyKey;\n\t\tconst ifRevision = options.ifRevision ?? bodyOptions.ifRevision;\n\t\tif (idempotencyKey) requestOptions.idempotencyKey = idempotencyKey;\n\t\tif (ifRevision !== undefined) requestOptions.ifRevision = ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"PATCH\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tdelete(dropId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n}\n\nfunction updateBody(body: PublishOptions | Record<string, unknown>): unknown {\n\tconst {\n\t\tmetadata,\n\t\tidempotencyKey: _idempotencyKey,\n\t\tifRevision: _ifRevision,\n\t\tignore: _ignore,\n\t\tignoreDefaults: _ignoreDefaults,\n\t\tcontentType: _contentType,\n\t\tpath: _path,\n\t\tentry: _entry,\n\t\t...dropOptions\n\t} = body as PublishOptions;\n\treturn toSnakeCase({ options: dropOptions, metadata });\n}\n\nfunction hasContent(body: Record<string, unknown>): boolean {\n\treturn [\"content\", \"contentType\", \"content_type\", \"entry\", \"files\"].some(\n\t\t(field) => body[field] !== undefined,\n\t);\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\n\nexport class UploadsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: CreateUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<CreateUploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/uploads\", requestOptions);\n\t}\n\n\tget(uploadId: string): Promise<DropthisResult<UploadSessionResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n\n\tcreatePartTargets(\n\t\tuploadId: string,\n\t\tbody: CreateUploadPartTargetsRequest,\n\t): Promise<DropthisResult<CreateUploadPartTargetsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t{ body: toSnakeCase(body) },\n\t\t);\n\t}\n\n\tcomplete(\n\t\tuploadId: string,\n\t\tbody: CompleteUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<UploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/complete`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcancel(uploadId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n}\n","import { toCamelCase } from \"./case.js\";\nimport { createErrorResult } from \"./errors.js\";\nimport type {\n\tDropthisClientOptions,\n\tDropthisResult,\n\tRequestOptions,\n} from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.dropthis.app\";\nconst SDK_VERSION = \"0.1.0\";\n\nexport class Transport {\n\treadonly apiKey: string | undefined;\n\treadonly baseUrl: string;\n\treadonly timeoutMs: number;\n\treadonly fetchImpl: typeof globalThis.fetch;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tconst resolved =\n\t\t\ttypeof options === \"string\" ? { apiKey: options } : options;\n\t\tthis.apiKey = resolved.apiKey ?? process.env.DROPTHIS_API_KEY;\n\t\tthis.baseUrl = (resolved.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\t\tthis.timeoutMs = resolved.timeoutMs ?? 30_000;\n\t\tthis.fetchImpl = resolved.fetch ?? globalThis.fetch;\n\t}\n\n\tmultipart<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\tform: FormData,\n\t\toptions: RequestOptions = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.request<T>(method, path, { ...options, body: form });\n\t}\n\n\tasync putSignedUrl(\n\t\turl: string,\n\t\tbody: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(() => controller.abort(), this.timeoutMs);\n\t\ttry {\n\t\t\tconst request: RequestInit & { duplex?: \"half\" } = {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\theaders,\n\t\t\t\tbody: body as BodyInit,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (body instanceof ReadableStream) request.duplex = \"half\";\n\t\t\tconst response = await this.fetchImpl(url, request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text();\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t`signed_upload_${response.status}`,\n\t\t\t\t\ttext || response.statusText,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\t{ headers: responseHeaders },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: {\n\t\t\t\t\tetag: response.headers.get(\"ETag\") ?? responseHeaders.etag ?? null,\n\t\t\t\t},\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n\n\tasync request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\tconst authenticated = options.authenticated ?? true;\n\t\tif (authenticated && !this.apiKey) {\n\t\t\treturn createErrorResult<T>(\n\t\t\t\t\"missing_api_key\",\n\t\t\t\t\"No API key provided. Pass apiKey or set DROPTHIS_API_KEY.\",\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"user-agent\": `dropthis-node/${SDK_VERSION}`,\n\t\t};\n\t\tif (authenticated && this.apiKey)\n\t\t\theaders.authorization = `Bearer ${this.apiKey}`;\n\t\tif (options.idempotencyKey)\n\t\t\theaders[\"idempotency-key\"] = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\theaders[\"If-Revision\"] = String(options.ifRevision);\n\t\tif (options.body !== undefined && !(options.body instanceof FormData))\n\t\t\theaders[\"content-type\"] = \"application/json\";\n\n\t\tconst url = new URL(`${this.baseUrl}${path}`);\n\t\tfor (const [key, value] of Object.entries(options.params ?? {})) {\n\t\t\tif (value !== undefined && value !== null)\n\t\t\t\turl.searchParams.set(key, String(value));\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(\n\t\t\t() => controller.abort(),\n\t\t\toptions.timeoutMs ?? this.timeoutMs,\n\t\t);\n\t\ttry {\n\t\t\tconst request: RequestInit = {\n\t\t\t\tmethod,\n\t\t\t\theaders,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (options.body instanceof FormData) {\n\t\t\t\trequest.body = options.body;\n\t\t\t} else if (options.body !== undefined) {\n\t\t\t\trequest.body = JSON.stringify(options.body);\n\t\t\t}\n\n\t\t\tconst response = await this.fetchImpl(url.toString(), request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tconst text = await response.text();\n\t\t\tconst parsed = parseJson(text);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst body =\n\t\t\t\t\tparsed && typeof parsed === \"object\"\n\t\t\t\t\t\t? (parsed as Record<string, unknown>)\n\t\t\t\t\t\t: {};\n\t\t\t\tconst message =\n\t\t\t\t\tstringValue(body.detail) ??\n\t\t\t\t\tstringValue(body.error) ??\n\t\t\t\t\tstringValue(body.message) ??\n\t\t\t\t\tresponse.statusText;\n\t\t\t\tconst code =\n\t\t\t\t\tstringValue(body.code) ??\n\t\t\t\t\tstringValue(body.error_code) ??\n\t\t\t\t\t`http_${response.status}`;\n\t\t\t\tconst currentRevision = numberValue(body.current_revision);\n\t\t\t\treturn createErrorResult<T>(code, message, response.status, {\n\t\t\t\t\tdetail: body,\n\t\t\t\t\tparam: stringValue(body.param),\n\t\t\t\t\t...(currentRevision !== undefined ? { currentRevision } : {}),\n\t\t\t\t\trequestId: responseHeaders[\"x-request-id\"] ?? null,\n\t\t\t\t\theaders: responseHeaders,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: toCamelCase(parsed) as T,\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult<T>(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n}\n\nfunction headersToObject(headers: Headers): Record<string, string> {\n\tconst result: Record<string, string> = {};\n\theaders.forEach((value, key) => {\n\t\tresult[key.toLowerCase()] = value;\n\t});\n\treturn result;\n}\n\nfunction parseJson(text: string): unknown {\n\tif (!text) return null;\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn text;\n\t}\n}\n\nfunction stringValue(value: unknown): string | null {\n\treturn typeof value === \"string\" ? value : null;\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\treturn typeof value === \"number\" ? value : undefined;\n}\n","import type { PreparedPublishRequest } from \"./publish/prepare.js\";\nimport { preparePublishRequest } from \"./publish/prepare.js\";\nimport { publishStaged } from \"./publish/upload.js\";\nimport { AccountResource } from \"./resources/account.js\";\nimport { ApiKeysResource } from \"./resources/api-keys.js\";\nimport { AuthResource } from \"./resources/auth.js\";\nimport { DeploymentsResource } from \"./resources/deployments.js\";\nimport { DropsResource } from \"./resources/drops.js\";\nimport { UploadsResource } from \"./resources/uploads.js\";\nimport { Transport } from \"./transport.js\";\nimport type {\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisResult,\n\tPublishInput,\n\tPublishOptions,\n\tRequestOptions,\n} from \"./types.js\";\n\nexport class Dropthis {\n\tprivate readonly transport: Transport;\n\tprivate authResource?: AuthResource;\n\tprivate apiKeysResource?: ApiKeysResource;\n\tprivate accountResource?: AccountResource;\n\tprivate dropsResource?: DropsResource;\n\tprivate deploymentsResource?: DeploymentsResource;\n\tprivate uploadsResource?: UploadsResource;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tthis.transport = new Transport(options);\n\t}\n\n\tget auth(): AuthResource {\n\t\tif (!this.authResource)\n\t\t\tthis.authResource = new AuthResource(this.transport);\n\t\treturn this.authResource;\n\t}\n\n\tget apiKeys(): ApiKeysResource {\n\t\tif (!this.apiKeysResource)\n\t\t\tthis.apiKeysResource = new ApiKeysResource(this.transport);\n\t\treturn this.apiKeysResource;\n\t}\n\n\tget account(): AccountResource {\n\t\tif (!this.accountResource)\n\t\t\tthis.accountResource = new AccountResource(this.transport);\n\t\treturn this.accountResource;\n\t}\n\n\tget drops(): DropsResource {\n\t\tif (!this.dropsResource)\n\t\t\tthis.dropsResource = new DropsResource(this.transport);\n\t\treturn this.dropsResource;\n\t}\n\n\tget deployments(): DeploymentsResource {\n\t\tif (!this.deploymentsResource)\n\t\t\tthis.deploymentsResource = new DeploymentsResource(this.transport);\n\t\treturn this.deploymentsResource;\n\t}\n\n\tget uploads(): UploadsResource {\n\t\tif (!this.uploadsResource)\n\t\t\tthis.uploadsResource = new UploadsResource(this.transport);\n\t\treturn this.uploadsResource;\n\t}\n\n\tasync prepare(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<PreparedPublishRequest> {\n\t\treturn preparePublishRequest(input, options);\n\t}\n\n\tasync publish(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst prepared = await preparePublishRequest(input, options);\n\t\treturn publishStaged(this.transport, prepared, \"/drops\", options);\n\t}\n\n\tasync update(\n\t\tdropId: string,\n\t\tinputOrOptions: PublishInput | PublishOptions = {},\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tif (looksLikeOptionsOnly(inputOrOptions)) {\n\t\t\treturn this.drops.update(dropId, inputOrOptions, options);\n\t\t}\n\n\t\tconst prepared = await preparePublishRequest(\n\t\t\tinputOrOptions as PublishInput,\n\t\t\toptions,\n\t\t);\n\t\tconst path = `/drops/${encodeURIComponent(dropId)}/deployments`;\n\t\treturn publishStaged(this.transport, prepared, path, options);\n\t}\n\n\trequest<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.transport.request<T>(method, path, options);\n\t}\n\n\trequestSignedUpload(\n\t\turl: string,\n\t\tbytes: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\treturn this.transport.putSignedUrl(url, bytes, headers);\n\t}\n}\n\nfunction looksLikeOptionsOnly(\n\tinput: PublishInput | PublishOptions,\n): input is PublishOptions {\n\tif (input instanceof Uint8Array) return false;\n\tif (typeof input !== \"object\" || input === null) return false;\n\treturn !(\"content\" in input || \"files\" in input);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,mBAAqB;AACrB,IAAAC,oBAAyB;;;ACDlB,SAAS,WAAW,KAAqB;AAC/C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ACxD,SAAO,EAAE,aAAa,SAAS,WAAW;AAC3C;","names":["import_promises","import_node_path","ignore","fg","import_node_crypto","import_promises"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/publish/prepare.ts","../src/publish/checksum.ts","../src/publish/detect.ts","../src/publish/files.ts","../src/publish/upload.ts","../src/errors.ts","../src/publish/multipart.ts","../src/resources/account.ts","../src/resources/api-keys.ts","../src/resources/auth.ts","../src/resources/deployments.ts","../src/pagination.ts","../src/resources/drops.ts","../src/resources/uploads.ts","../src/case.ts","../src/transport.ts","../src/dropthis.ts"],"sourcesContent":["export { Dropthis } from \"./dropthis.js\";\nexport { createErrorResult, redactSecrets } from \"./errors.js\";\nexport { CursorPage } from \"./pagination.js\";\nexport type {\n\tPreparedPublishRequest,\n\tPreparedUploadFile,\n} from \"./publish/prepare.js\";\nexport { DeploymentsResource } from \"./resources/deployments.js\";\nexport { UploadsResource } from \"./resources/uploads.js\";\nexport type {\n\tActionResolve,\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropAction,\n\tDropDeploymentResponse,\n\tDropOptions,\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisErrorResponse,\n\tDropthisResult,\n\tLimitations,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n\tListPage,\n\tPrepareOptions,\n\tPublishOptions,\n\tRequestControls,\n\tRequestOptions,\n\tTierInfo,\n\tUploadManifestFile,\n\tUploadPartTarget,\n\tUploadSessionFileResponse,\n\tUploadSessionResponse,\n\tUploadTarget,\n} from \"./types.js\";\n","import { stat } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport 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\nconst VALID_VISIBILITIES = [\"public\", \"unlisted\"] as const;\nconst MAX_TITLE_LENGTH = 500;\n\nexport function validatePublishOptions(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): void {\n\tif (\n\t\toptions.title !== undefined &&\n\t\toptions.title !== null &&\n\t\toptions.title.length > MAX_TITLE_LENGTH\n\t) {\n\t\tthrow new Error(`Title must be ${MAX_TITLE_LENGTH} characters or less.`);\n\t}\n\n\tif (options.visibility !== undefined && options.visibility !== null) {\n\t\tif (\n\t\t\t!(VALID_VISIBILITIES as readonly string[]).includes(options.visibility)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid visibility \"${options.visibility}\". Use \"public\" or \"unlisted\".`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (options.expiresAt !== undefined && options.expiresAt !== null) {\n\t\tif (options.expiresAt instanceof Date) {\n\t\t\tif (Number.isNaN(options.expiresAt.getTime())) {\n\t\t\t\tthrow new Error(\"Invalid expiresAt date.\");\n\t\t\t}\n\t\t} else if (typeof options.expiresAt === \"string\") {\n\t\t\tconst parsed = new Date(options.expiresAt);\n\t\t\tif (Number.isNaN(parsed.getTime())) {\n\t\t\t\tthrow new Error(\"Invalid expiresAt date.\");\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction optionsBody(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): Record<string, unknown> {\n\tvalidatePublishOptions(options);\n\treturn {\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};\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 { createErrorResult } from \"../errors.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCreateUploadSessionResponse,\n\tDropResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\nimport { uploadMultipartFile } from \"./multipart.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\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: 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 bytes = await fileBytes(file);\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\tbytes,\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: { 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\tuploadId: 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 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\tsuggestion?: string | null;\n\t\tretryable?: boolean | null;\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\t...(extra.suggestion !== undefined\n\t\t\t\t? { suggestion: extra.suggestion }\n\t\t\t\t: {}),\n\t\t\t...(extra.retryable !== undefined ? { retryable: extra.retryable } : {}),\n\t\t},\n\t\theaders: extra.headers ?? {},\n\t};\n}\n","import { createErrorResult } from \"../errors.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCreateUploadPartTargetsResponse,\n\tDropthisResult,\n} from \"../types.js\";\n\nconst MAX_PART_TARGETS_PER_REQUEST = 100;\n\nexport async function uploadMultipartFile(\n\ttransport: Transport,\n\tuploadId: string,\n\tfileId: string,\n\tbytes: Uint8Array,\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 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: { 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\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 { 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\", { body: input });\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 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] = { 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\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] = {\n\t\t\tbody,\n\t\t\tbodyCase: \"raw\",\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\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{ params },\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","import type { DropthisResult, ListPage } from \"./types.js\";\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","import { CursorPage } from \"../pagination.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tDropOptions,\n\tDropResponse,\n\tDropthisResult,\n\tListDropsParams,\n\tRequestControls,\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] = { 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\tcreateRaw(\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,\n\t\t\tbodyCase: \"raw\",\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\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: 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\toptions: DropOptions & RequestControls = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: updateBody(options),\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\"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(options: DropOptions & RequestControls): unknown {\n\tconst {\n\t\tmetadata,\n\t\tidempotencyKey: _idempotencyKey,\n\t\tifRevision: _ifRevision,\n\t\tentry: _entry,\n\t\t...dropOptions\n\t} = options;\n\treturn { options: dropOptions, metadata };\n}\n","import 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] = { body };\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 },\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] = { body };\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","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\nconst PASSTHROUGH_KEYS = new Set([\"metadata\"]);\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\tPASSTHROUGH_KEYS.has(key) ? item : toCamelCase(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]) => [\n\t\t\t\t\ttoSnakeKey(key),\n\t\t\t\t\tPASSTHROUGH_KEYS.has(key) ? item : toSnakeCase(item),\n\t\t\t\t]),\n\t\t);\n\t}\n\treturn value;\n}\n","import { toCamelCase, toSnakeCase } 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.3.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\tbodyCase?: \"snake\" | \"raw\";\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\tconst wireParams =\n\t\t\toptions.bodyCase === \"raw\"\n\t\t\t\t? options.params\n\t\t\t\t: (toSnakeCase(options.params ?? {}) as Record<string, unknown>);\n\t\tfor (const [key, value] of Object.entries(wireParams ?? {})) {\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\tconst wireBody =\n\t\t\t\t\toptions.bodyCase === \"raw\" ? options.body : toSnakeCase(options.body);\n\t\t\t\trequest.body = JSON.stringify(wireBody);\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:\n\t\t\t\t\t\tstringValue(body.request_id) ??\n\t\t\t\t\t\tresponseHeaders[\"x-request-id\"] ??\n\t\t\t\t\t\tnull,\n\t\t\t\t\tsuggestion: stringValue(body.suggestion),\n\t\t\t\t\tretryable: booleanValue(body.retryable),\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\nfunction booleanValue(value: unknown): boolean | null {\n\treturn typeof value === \"boolean\" ? value : null;\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\tDropOptions,\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisResult,\n\tPublishInput,\n\tPublishOptions,\n\tRequestControls,\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 deploy(\n\t\tdropId: string,\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst prepared = await preparePublishRequest(input, options);\n\t\tconst path = `/drops/${encodeURIComponent(dropId)}/deployments`;\n\t\treturn publishStaged(this.transport, prepared, path, options);\n\t}\n\n\tasync update(\n\t\tdropId: string,\n\t\toptions: DropOptions & RequestControls = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\treturn this.drops.update(dropId, 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, {\n\t\t\t...options,\n\t\t\tbodyCase: \"raw\",\n\t\t});\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,mBAAqB;AACrB,IAAAC,oBAAyB;;;ACDzB,yBAA2B;AAC3B,qBAAiC;AAE1B,SAAS,YAAY,OAA2B;AACtD,aAAO,+BAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACvD;AAEA,eAAsB,WAAW,MAA+B;AAC/D,QAAM,WAAO,+BAAW,QAAQ;AAChC,mBAAiB,aAAS,iCAAiB,IAAI,GAAG;AACjD,SAAK,OAAO,KAAK;AAAA,EAClB;AACA,SAAO,KAAK,OAAO,KAAK;AACzB;;;ACNO,SAAS,UAAU,OAAwB;AACjD,MAAI;AACH,UAAM,MAAM,IAAI,IAAI,KAAK;AACzB,WAAO,IAAI,aAAa,WAAW,IAAI,aAAa;AAAA,EACrD,QAAQ;AACP,WAAO;AAAA,EACR;AACD;AAEO,SAAS,cAAc,OAAwB;AACrD,QAAM,U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AAK,WAAW,UAAU,MAAM,OAAO;AAAA,EAC7D;AAAA,EAEA,MAAM,OACL,QACA,UAAyC,CAAC,GACF;AACxC,WAAO,KAAK,MAAM,OAAO,QAAQ,OAAO;AAAA,EACzC;AAAA,EAEA,QACC,QACA,MACA,UAGI,CAAC,GACwB;AAC7B,WAAO,KAAK,UAAU,QAAW,QAAQ,MAAM;AAAA,MAC9C,GAAG;AAAA,MACH,UAAU;AAAA,IACX,CAAC;AAAA,EACF;AAAA,EAEA,oBACC,KACA,OACA,SACmD;AACnD,WAAO,KAAK,UAAU,aAAa,KAAK,OAAO,OAAO;AAAA,EACvD;AACD;","names":["import_promises","import_node_path","ignore","fg","import_node_crypto","import_promises","errorResult","bytes"]}
|
|
@@ -19,6 +19,8 @@ type DropthisErrorResponse = {
|
|
|
19
19
|
param?: string | null;
|
|
20
20
|
currentRevision?: number;
|
|
21
21
|
requestId?: string | null;
|
|
22
|
+
suggestion?: string | null;
|
|
23
|
+
retryable?: boolean | null;
|
|
22
24
|
};
|
|
23
25
|
type DropthisResult<T> = {
|
|
24
26
|
data: T;
|
|
@@ -29,6 +31,28 @@ type DropthisResult<T> = {
|
|
|
29
31
|
error: DropthisErrorResponse;
|
|
30
32
|
headers: Record<string, string>;
|
|
31
33
|
};
|
|
34
|
+
type ActionResolve = {
|
|
35
|
+
method: string;
|
|
36
|
+
url?: string | null;
|
|
37
|
+
endpoint?: string | null;
|
|
38
|
+
};
|
|
39
|
+
type DropAction = {
|
|
40
|
+
code: string;
|
|
41
|
+
kind: "api" | "human";
|
|
42
|
+
priority: "required" | "suggested";
|
|
43
|
+
message: string;
|
|
44
|
+
resolve?: ActionResolve | null;
|
|
45
|
+
};
|
|
46
|
+
type TierInfo = {
|
|
47
|
+
name: string;
|
|
48
|
+
maxSizeBytes: number;
|
|
49
|
+
ttlDays: number | null;
|
|
50
|
+
persistent: boolean;
|
|
51
|
+
badge: boolean;
|
|
52
|
+
};
|
|
53
|
+
type Limitations = {
|
|
54
|
+
actions: DropAction[];
|
|
55
|
+
};
|
|
32
56
|
type DropResponse = {
|
|
33
57
|
id: string;
|
|
34
58
|
slug: string;
|
|
@@ -47,6 +71,12 @@ type DropResponse = {
|
|
|
47
71
|
warnings: Array<Record<string, unknown>>;
|
|
48
72
|
createdAt: string;
|
|
49
73
|
expiresAt: string | null;
|
|
74
|
+
object: string;
|
|
75
|
+
accessible: boolean;
|
|
76
|
+
persistent: boolean;
|
|
77
|
+
badgeApplied: boolean;
|
|
78
|
+
tier: TierInfo;
|
|
79
|
+
limitations: Limitations;
|
|
50
80
|
};
|
|
51
81
|
type DropDeploymentResponse = {
|
|
52
82
|
id: string;
|
|
@@ -86,9 +116,17 @@ type ListPage<T> = {
|
|
|
86
116
|
}): Promise<T[]>;
|
|
87
117
|
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
88
118
|
};
|
|
119
|
+
type Action = {
|
|
120
|
+
code: string;
|
|
121
|
+
kind: string;
|
|
122
|
+
method?: string | null;
|
|
123
|
+
endpoint?: string | null;
|
|
124
|
+
message: string;
|
|
125
|
+
};
|
|
89
126
|
type EmailOtpResponse = {
|
|
90
127
|
ok: true;
|
|
91
128
|
expiresIn: number;
|
|
129
|
+
nextAction?: Action | null;
|
|
92
130
|
};
|
|
93
131
|
type SessionResponse = {
|
|
94
132
|
object: "session";
|
|
@@ -160,11 +198,13 @@ type UploadSessionResponse = {
|
|
|
160
198
|
expiresAt: string;
|
|
161
199
|
entry?: string | null;
|
|
162
200
|
files: UploadSessionFileResponse[];
|
|
201
|
+
nextAction?: Action | null;
|
|
163
202
|
};
|
|
164
203
|
type CreateUploadSessionResponse = {
|
|
165
204
|
uploadId: string;
|
|
166
205
|
expiresAt: string;
|
|
167
206
|
files: CreateUploadSessionFileResponse[];
|
|
207
|
+
nextAction?: Action | null;
|
|
168
208
|
};
|
|
169
209
|
type CreateUploadPartTargetsRequest = {
|
|
170
210
|
fileId: string;
|
|
@@ -189,39 +229,41 @@ type CompleteUploadSessionRequest = {
|
|
|
189
229
|
}> | null;
|
|
190
230
|
}>;
|
|
191
231
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
readonly data: T[];
|
|
195
|
-
readonly hasMore: boolean;
|
|
196
|
-
readonly nextCursor: string | null;
|
|
197
|
-
private readonly fetchNextPage;
|
|
198
|
-
constructor(input: {
|
|
199
|
-
data: T[];
|
|
200
|
-
hasMore: boolean;
|
|
201
|
-
nextCursor: string | null;
|
|
202
|
-
fetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;
|
|
203
|
-
});
|
|
204
|
-
autoPagingToArray(options?: {
|
|
205
|
-
limit?: number;
|
|
206
|
-
}): Promise<T[]>;
|
|
207
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
208
|
-
}
|
|
209
|
-
type PublishOptions = {
|
|
232
|
+
type DropOptions = {
|
|
233
|
+
/** Change the vanity slug (update only). */
|
|
210
234
|
slug?: string;
|
|
235
|
+
/** Drop title. */
|
|
211
236
|
title?: string;
|
|
237
|
+
/** public (default) or unlisted. */
|
|
212
238
|
visibility?: "public" | "unlisted";
|
|
239
|
+
/** Require password to view. Pass `null` to remove password protection. */
|
|
213
240
|
password?: string | null;
|
|
241
|
+
/** Prevent search-engine indexing. Pass `null` to allow indexing (default). */
|
|
214
242
|
noindex?: boolean | null;
|
|
243
|
+
/** Auto-delete after this ISO 8601 date. Pass `null` to clear. */
|
|
215
244
|
expiresAt?: string | Date | null;
|
|
245
|
+
/** Entry file for multi-file bundles (default: index.html). */
|
|
216
246
|
entry?: string;
|
|
247
|
+
/** Attach JSON key-value pairs, e.g. `{ source: "ci" }`. */
|
|
217
248
|
metadata?: Record<string, unknown>;
|
|
218
|
-
|
|
219
|
-
|
|
249
|
+
};
|
|
250
|
+
type PrepareOptions = {
|
|
251
|
+
/** Glob patterns to ignore when publishing directories. */
|
|
220
252
|
ignore?: string[];
|
|
253
|
+
/** Disable default ignore patterns. */
|
|
221
254
|
ignoreDefaults?: boolean;
|
|
255
|
+
/** Override MIME type (auto-detected from extension). */
|
|
222
256
|
contentType?: string;
|
|
257
|
+
/** Set filename when publishing from stdin or bytes. */
|
|
223
258
|
path?: string;
|
|
224
259
|
};
|
|
260
|
+
type RequestControls = {
|
|
261
|
+
/** Prevent duplicate publishes on retry (auto-generated by CLI). */
|
|
262
|
+
idempotencyKey?: string;
|
|
263
|
+
/** Fail if current revision doesn't match -- optimistic lock (update only). */
|
|
264
|
+
ifRevision?: number;
|
|
265
|
+
};
|
|
266
|
+
type PublishOptions = DropOptions & PrepareOptions & RequestControls;
|
|
225
267
|
type ExplicitPublishInput = {
|
|
226
268
|
content: string;
|
|
227
269
|
contentType?: string;
|
|
@@ -277,6 +319,7 @@ declare class Transport {
|
|
|
277
319
|
}>>;
|
|
278
320
|
request<T>(method: string, path: string, options?: RequestOptions & {
|
|
279
321
|
body?: unknown;
|
|
322
|
+
bodyCase?: "snake" | "raw";
|
|
280
323
|
params?: Record<string, string | number | boolean | null | undefined>;
|
|
281
324
|
}): Promise<DropthisResult<T>>;
|
|
282
325
|
}
|
|
@@ -336,6 +379,24 @@ declare class DeploymentsResource {
|
|
|
336
379
|
get(dropId: string, deploymentId: string): Promise<DropthisResult<DropDeploymentResponse>>;
|
|
337
380
|
}
|
|
338
381
|
|
|
382
|
+
declare class CursorPage<T> implements ListPage<T> {
|
|
383
|
+
readonly object: "list";
|
|
384
|
+
readonly data: T[];
|
|
385
|
+
readonly hasMore: boolean;
|
|
386
|
+
readonly nextCursor: string | null;
|
|
387
|
+
private readonly fetchNextPage;
|
|
388
|
+
constructor(input: {
|
|
389
|
+
data: T[];
|
|
390
|
+
hasMore: boolean;
|
|
391
|
+
nextCursor: string | null;
|
|
392
|
+
fetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;
|
|
393
|
+
});
|
|
394
|
+
autoPagingToArray(options?: {
|
|
395
|
+
limit?: number;
|
|
396
|
+
}): Promise<T[]>;
|
|
397
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
|
398
|
+
}
|
|
399
|
+
|
|
339
400
|
declare class DropsResource {
|
|
340
401
|
private readonly transport;
|
|
341
402
|
constructor(transport: Transport);
|
|
@@ -347,10 +408,7 @@ declare class DropsResource {
|
|
|
347
408
|
}): Promise<DropthisResult<DropResponse>>;
|
|
348
409
|
list(params?: ListDropsParams): Promise<DropthisResult<CursorPage<DropResponse>>>;
|
|
349
410
|
get(dropId: string): Promise<DropthisResult<DropResponse>>;
|
|
350
|
-
update(dropId: string,
|
|
351
|
-
idempotencyKey?: string;
|
|
352
|
-
ifRevision?: number;
|
|
353
|
-
}): Promise<DropthisResult<DropResponse>>;
|
|
411
|
+
update(dropId: string, options?: DropOptions & RequestControls): Promise<DropthisResult<DropResponse>>;
|
|
354
412
|
delete(dropId: string): Promise<DropthisResult<null>>;
|
|
355
413
|
}
|
|
356
414
|
|
|
@@ -385,7 +443,8 @@ declare class Dropthis {
|
|
|
385
443
|
get uploads(): UploadsResource;
|
|
386
444
|
prepare(input: PublishInput, options?: PublishOptions): Promise<PreparedPublishRequest>;
|
|
387
445
|
publish(input: PublishInput, options?: PublishOptions): Promise<DropthisResult<DropResponse>>;
|
|
388
|
-
|
|
446
|
+
deploy(dropId: string, input: PublishInput, options?: PublishOptions): Promise<DropthisResult<DropResponse>>;
|
|
447
|
+
update(dropId: string, options?: DropOptions & RequestControls): Promise<DropthisResult<DropResponse>>;
|
|
389
448
|
request<T>(method: string, path: string, options?: RequestOptions & {
|
|
390
449
|
body?: unknown;
|
|
391
450
|
params?: Record<string, string | number | boolean | null | undefined>;
|
|
@@ -403,6 +462,8 @@ declare function createErrorResult<T>(code: string, message: string, statusCode:
|
|
|
403
462
|
currentRevision?: number;
|
|
404
463
|
requestId?: string | null;
|
|
405
464
|
headers?: Record<string, string>;
|
|
465
|
+
suggestion?: string | null;
|
|
466
|
+
retryable?: boolean | null;
|
|
406
467
|
}): DropthisResult<T>;
|
|
407
468
|
|
|
408
|
-
export { type CompleteUploadSessionRequest, type CreateUploadPartTargetsRequest, type CreateUploadPartTargetsResponse, type CreateUploadSessionRequest, type CreateUploadSessionResponse, DeploymentsResource, type DropDeploymentResponse, type DropResponse, Dropthis, type DropthisClientOptions, type DropthisErrorResponse, type DropthisResult, type ListDeploymentsParams, type ListDeploymentsResponse, type ListPage, type PreparedPublishRequest, type PreparedUploadFile, type RequestOptions, type UploadManifestFile, type UploadPartTarget, type UploadSessionFileResponse, type UploadSessionResponse, type UploadTarget, UploadsResource, createErrorResult, redactSecrets };
|
|
469
|
+
export { type ActionResolve, type CompleteUploadSessionRequest, type CreateUploadPartTargetsRequest, type CreateUploadPartTargetsResponse, type CreateUploadSessionRequest, type CreateUploadSessionResponse, CursorPage, DeploymentsResource, type DropAction, type DropDeploymentResponse, type DropOptions, type DropResponse, Dropthis, type DropthisClientOptions, type DropthisErrorResponse, type DropthisResult, type Limitations, type ListDeploymentsParams, type ListDeploymentsResponse, type ListPage, type PrepareOptions, type PreparedPublishRequest, type PreparedUploadFile, type PublishOptions, type RequestControls, type RequestOptions, type TierInfo, type UploadManifestFile, type UploadPartTarget, type UploadSessionFileResponse, type UploadSessionResponse, type UploadTarget, UploadsResource, createErrorResult, redactSecrets };
|