@dropthis/cli 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +171 -0
  2. package/dist/cli.cjs +1489 -0
  3. package/dist/cli.cjs.map +1 -0
  4. package/node_modules/@dropthis/node/README.md +90 -0
  5. package/node_modules/@dropthis/node/dist/index.cjs +1010 -0
  6. package/node_modules/@dropthis/node/dist/index.cjs.map +1 -0
  7. package/node_modules/@dropthis/node/dist/index.d.cts +408 -0
  8. package/node_modules/@dropthis/node/dist/index.d.ts +408 -0
  9. package/node_modules/@dropthis/node/dist/index.mjs +969 -0
  10. package/node_modules/@dropthis/node/dist/index.mjs.map +1 -0
  11. package/node_modules/@dropthis/node/package.json +55 -0
  12. package/node_modules/@nodelib/fs.scandir/LICENSE +21 -0
  13. package/node_modules/@nodelib/fs.scandir/README.md +171 -0
  14. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  15. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +19 -0
  16. package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +4 -0
  17. package/node_modules/@nodelib/fs.scandir/out/constants.js +17 -0
  18. package/node_modules/@nodelib/fs.scandir/out/index.d.ts +12 -0
  19. package/node_modules/@nodelib/fs.scandir/out/index.js +26 -0
  20. package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  21. package/node_modules/@nodelib/fs.scandir/out/providers/async.js +104 -0
  22. package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +1 -0
  23. package/node_modules/@nodelib/fs.scandir/out/providers/common.js +13 -0
  24. package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +5 -0
  25. package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +54 -0
  26. package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  27. package/node_modules/@nodelib/fs.scandir/out/settings.js +24 -0
  28. package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  29. package/node_modules/@nodelib/fs.scandir/out/types/index.js +2 -0
  30. package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +2 -0
  31. package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +19 -0
  32. package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +2 -0
  33. package/node_modules/@nodelib/fs.scandir/out/utils/index.js +5 -0
  34. package/node_modules/@nodelib/fs.scandir/package.json +44 -0
  35. package/node_modules/@nodelib/fs.stat/LICENSE +21 -0
  36. package/node_modules/@nodelib/fs.stat/README.md +126 -0
  37. package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  38. package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +17 -0
  39. package/node_modules/@nodelib/fs.stat/out/index.d.ts +12 -0
  40. package/node_modules/@nodelib/fs.stat/out/index.js +26 -0
  41. package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  42. package/node_modules/@nodelib/fs.stat/out/providers/async.js +36 -0
  43. package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +3 -0
  44. package/node_modules/@nodelib/fs.stat/out/providers/sync.js +23 -0
  45. package/node_modules/@nodelib/fs.stat/out/settings.d.ts +16 -0
  46. package/node_modules/@nodelib/fs.stat/out/settings.js +16 -0
  47. package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  48. package/node_modules/@nodelib/fs.stat/out/types/index.js +2 -0
  49. package/node_modules/@nodelib/fs.stat/package.json +37 -0
  50. package/node_modules/@nodelib/fs.walk/LICENSE +21 -0
  51. package/node_modules/@nodelib/fs.walk/README.md +215 -0
  52. package/node_modules/@nodelib/fs.walk/out/index.d.ts +14 -0
  53. package/node_modules/@nodelib/fs.walk/out/index.js +34 -0
  54. package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  55. package/node_modules/@nodelib/fs.walk/out/providers/async.js +30 -0
  56. package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +4 -0
  57. package/node_modules/@nodelib/fs.walk/out/providers/index.js +9 -0
  58. package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +12 -0
  59. package/node_modules/@nodelib/fs.walk/out/providers/stream.js +34 -0
  60. package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +10 -0
  61. package/node_modules/@nodelib/fs.walk/out/providers/sync.js +14 -0
  62. package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  63. package/node_modules/@nodelib/fs.walk/out/readers/async.js +97 -0
  64. package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +7 -0
  65. package/node_modules/@nodelib/fs.walk/out/readers/common.js +31 -0
  66. package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  67. package/node_modules/@nodelib/fs.walk/out/readers/reader.js +11 -0
  68. package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +15 -0
  69. package/node_modules/@nodelib/fs.walk/out/readers/sync.js +59 -0
  70. package/node_modules/@nodelib/fs.walk/out/settings.d.ts +30 -0
  71. package/node_modules/@nodelib/fs.walk/out/settings.js +26 -0
  72. package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  73. package/node_modules/@nodelib/fs.walk/out/types/index.js +2 -0
  74. package/node_modules/@nodelib/fs.walk/package.json +44 -0
  75. package/node_modules/braces/LICENSE +21 -0
  76. package/node_modules/braces/README.md +586 -0
  77. package/node_modules/braces/index.js +170 -0
  78. package/node_modules/braces/lib/compile.js +60 -0
  79. package/node_modules/braces/lib/constants.js +57 -0
  80. package/node_modules/braces/lib/expand.js +113 -0
  81. package/node_modules/braces/lib/parse.js +331 -0
  82. package/node_modules/braces/lib/stringify.js +32 -0
  83. package/node_modules/braces/lib/utils.js +122 -0
  84. package/node_modules/braces/package.json +77 -0
  85. package/node_modules/fast-glob/LICENSE +21 -0
  86. package/node_modules/fast-glob/README.md +830 -0
  87. package/node_modules/fast-glob/out/index.d.ts +40 -0
  88. package/node_modules/fast-glob/out/index.js +102 -0
  89. package/node_modules/fast-glob/out/managers/tasks.d.ts +22 -0
  90. package/node_modules/fast-glob/out/managers/tasks.js +110 -0
  91. package/node_modules/fast-glob/out/providers/async.d.ts +9 -0
  92. package/node_modules/fast-glob/out/providers/async.js +23 -0
  93. package/node_modules/fast-glob/out/providers/filters/deep.d.ts +16 -0
  94. package/node_modules/fast-glob/out/providers/filters/deep.js +62 -0
  95. package/node_modules/fast-glob/out/providers/filters/entry.d.ts +17 -0
  96. package/node_modules/fast-glob/out/providers/filters/entry.js +85 -0
  97. package/node_modules/fast-glob/out/providers/filters/error.d.ts +8 -0
  98. package/node_modules/fast-glob/out/providers/filters/error.js +15 -0
  99. package/node_modules/fast-glob/out/providers/matchers/matcher.d.ts +33 -0
  100. package/node_modules/fast-glob/out/providers/matchers/matcher.js +45 -0
  101. package/node_modules/fast-glob/out/providers/matchers/partial.d.ts +4 -0
  102. package/node_modules/fast-glob/out/providers/matchers/partial.js +38 -0
  103. package/node_modules/fast-glob/out/providers/provider.d.ts +19 -0
  104. package/node_modules/fast-glob/out/providers/provider.js +48 -0
  105. package/node_modules/fast-glob/out/providers/stream.d.ts +11 -0
  106. package/node_modules/fast-glob/out/providers/stream.js +31 -0
  107. package/node_modules/fast-glob/out/providers/sync.d.ts +9 -0
  108. package/node_modules/fast-glob/out/providers/sync.js +23 -0
  109. package/node_modules/fast-glob/out/providers/transformers/entry.d.ts +8 -0
  110. package/node_modules/fast-glob/out/providers/transformers/entry.js +26 -0
  111. package/node_modules/fast-glob/out/readers/async.d.ts +10 -0
  112. package/node_modules/fast-glob/out/readers/async.js +35 -0
  113. package/node_modules/fast-glob/out/readers/reader.d.ts +15 -0
  114. package/node_modules/fast-glob/out/readers/reader.js +33 -0
  115. package/node_modules/fast-glob/out/readers/stream.d.ts +14 -0
  116. package/node_modules/fast-glob/out/readers/stream.js +55 -0
  117. package/node_modules/fast-glob/out/readers/sync.d.ts +12 -0
  118. package/node_modules/fast-glob/out/readers/sync.js +43 -0
  119. package/node_modules/fast-glob/out/settings.d.ts +164 -0
  120. package/node_modules/fast-glob/out/settings.js +59 -0
  121. package/node_modules/fast-glob/out/types/index.d.ts +31 -0
  122. package/node_modules/fast-glob/out/types/index.js +2 -0
  123. package/node_modules/fast-glob/out/utils/array.d.ts +2 -0
  124. package/node_modules/fast-glob/out/utils/array.js +22 -0
  125. package/node_modules/fast-glob/out/utils/errno.d.ts +2 -0
  126. package/node_modules/fast-glob/out/utils/errno.js +7 -0
  127. package/node_modules/fast-glob/out/utils/fs.d.ts +4 -0
  128. package/node_modules/fast-glob/out/utils/fs.js +19 -0
  129. package/node_modules/fast-glob/out/utils/index.d.ts +8 -0
  130. package/node_modules/fast-glob/out/utils/index.js +17 -0
  131. package/node_modules/fast-glob/out/utils/path.d.ts +13 -0
  132. package/node_modules/fast-glob/out/utils/path.js +68 -0
  133. package/node_modules/fast-glob/out/utils/pattern.d.ts +49 -0
  134. package/node_modules/fast-glob/out/utils/pattern.js +206 -0
  135. package/node_modules/fast-glob/out/utils/stream.d.ts +4 -0
  136. package/node_modules/fast-glob/out/utils/stream.js +17 -0
  137. package/node_modules/fast-glob/out/utils/string.d.ts +2 -0
  138. package/node_modules/fast-glob/out/utils/string.js +11 -0
  139. package/node_modules/fast-glob/package.json +81 -0
  140. package/node_modules/fastq/LICENSE +13 -0
  141. package/node_modules/fastq/README.md +310 -0
  142. package/node_modules/fastq/SECURITY.md +15 -0
  143. package/node_modules/fastq/bench.js +66 -0
  144. package/node_modules/fastq/eslint.config.js +11 -0
  145. package/node_modules/fastq/example.js +14 -0
  146. package/node_modules/fastq/example.mjs +9 -0
  147. package/node_modules/fastq/index.d.ts +59 -0
  148. package/node_modules/fastq/package.json +49 -0
  149. package/node_modules/fastq/queue.js +346 -0
  150. package/node_modules/fastq/test/example.ts +83 -0
  151. package/node_modules/fastq/test/promise.js +325 -0
  152. package/node_modules/fastq/test/test.js +733 -0
  153. package/node_modules/fastq/test/tsconfig.json +11 -0
  154. package/node_modules/fill-range/LICENSE +21 -0
  155. package/node_modules/fill-range/README.md +237 -0
  156. package/node_modules/fill-range/index.js +248 -0
  157. package/node_modules/fill-range/package.json +74 -0
  158. package/node_modules/glob-parent/LICENSE +15 -0
  159. package/node_modules/glob-parent/README.md +137 -0
  160. package/node_modules/glob-parent/index.js +42 -0
  161. package/node_modules/glob-parent/package.json +48 -0
  162. package/node_modules/ignore/LICENSE-MIT +21 -0
  163. package/node_modules/ignore/README.md +452 -0
  164. package/node_modules/ignore/index.d.ts +81 -0
  165. package/node_modules/ignore/index.js +784 -0
  166. package/node_modules/ignore/legacy.js +681 -0
  167. package/node_modules/ignore/package.json +87 -0
  168. package/node_modules/is-extglob/LICENSE +21 -0
  169. package/node_modules/is-extglob/README.md +107 -0
  170. package/node_modules/is-extglob/index.js +20 -0
  171. package/node_modules/is-extglob/package.json +69 -0
  172. package/node_modules/is-glob/LICENSE +21 -0
  173. package/node_modules/is-glob/README.md +206 -0
  174. package/node_modules/is-glob/index.js +150 -0
  175. package/node_modules/is-glob/package.json +81 -0
  176. package/node_modules/is-number/LICENSE +21 -0
  177. package/node_modules/is-number/README.md +187 -0
  178. package/node_modules/is-number/index.js +18 -0
  179. package/node_modules/is-number/package.json +82 -0
  180. package/node_modules/merge2/LICENSE +21 -0
  181. package/node_modules/merge2/README.md +144 -0
  182. package/node_modules/merge2/index.js +144 -0
  183. package/node_modules/merge2/package.json +43 -0
  184. package/node_modules/micromatch/LICENSE +21 -0
  185. package/node_modules/micromatch/README.md +1024 -0
  186. package/node_modules/micromatch/index.js +474 -0
  187. package/node_modules/micromatch/package.json +119 -0
  188. package/node_modules/mime-db/HISTORY.md +541 -0
  189. package/node_modules/mime-db/LICENSE +23 -0
  190. package/node_modules/mime-db/README.md +109 -0
  191. package/node_modules/mime-db/db.json +9342 -0
  192. package/node_modules/mime-db/index.js +12 -0
  193. package/node_modules/mime-db/package.json +56 -0
  194. package/node_modules/mime-types/HISTORY.md +421 -0
  195. package/node_modules/mime-types/LICENSE +23 -0
  196. package/node_modules/mime-types/README.md +126 -0
  197. package/node_modules/mime-types/index.js +211 -0
  198. package/node_modules/mime-types/mimeScore.js +52 -0
  199. package/node_modules/mime-types/package.json +45 -0
  200. package/node_modules/picomatch/LICENSE +21 -0
  201. package/node_modules/picomatch/README.md +716 -0
  202. package/node_modules/picomatch/index.js +3 -0
  203. package/node_modules/picomatch/lib/constants.js +184 -0
  204. package/node_modules/picomatch/lib/parse.js +1392 -0
  205. package/node_modules/picomatch/lib/picomatch.js +342 -0
  206. package/node_modules/picomatch/lib/scan.js +391 -0
  207. package/node_modules/picomatch/lib/utils.js +64 -0
  208. package/node_modules/picomatch/package.json +81 -0
  209. package/node_modules/queue-microtask/LICENSE +20 -0
  210. package/node_modules/queue-microtask/README.md +90 -0
  211. package/node_modules/queue-microtask/index.d.ts +2 -0
  212. package/node_modules/queue-microtask/index.js +9 -0
  213. package/node_modules/queue-microtask/package.json +55 -0
  214. package/node_modules/reusify/.github/dependabot.yml +7 -0
  215. package/node_modules/reusify/.github/workflows/ci.yml +96 -0
  216. package/node_modules/reusify/LICENSE +22 -0
  217. package/node_modules/reusify/README.md +139 -0
  218. package/node_modules/reusify/SECURITY.md +15 -0
  219. package/node_modules/reusify/benchmarks/createNoCodeFunction.js +30 -0
  220. package/node_modules/reusify/benchmarks/fib.js +13 -0
  221. package/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +38 -0
  222. package/node_modules/reusify/eslint.config.js +14 -0
  223. package/node_modules/reusify/package.json +50 -0
  224. package/node_modules/reusify/reusify.d.ts +14 -0
  225. package/node_modules/reusify/reusify.js +33 -0
  226. package/node_modules/reusify/test.js +66 -0
  227. package/node_modules/reusify/tsconfig.json +11 -0
  228. package/node_modules/run-parallel/LICENSE +20 -0
  229. package/node_modules/run-parallel/README.md +85 -0
  230. package/node_modules/run-parallel/index.js +51 -0
  231. package/node_modules/run-parallel/package.json +58 -0
  232. package/node_modules/to-regex-range/LICENSE +21 -0
  233. package/node_modules/to-regex-range/README.md +305 -0
  234. package/node_modules/to-regex-range/index.js +288 -0
  235. package/node_modules/to-regex-range/package.json +88 -0
  236. package/package.json +53 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/publish/prepare.ts","../src/case.ts","../src/publish/checksum.ts","../src/publish/detect.ts","../src/publish/files.ts","../src/publish/upload.ts","../src/errors.ts","../src/resources/account.ts","../src/resources/api-keys.ts","../src/resources/auth.ts","../src/resources/deployments.ts","../src/types.ts","../src/resources/drops.ts","../src/resources/uploads.ts","../src/transport.ts","../src/dropthis.ts"],"sourcesContent":["import { stat } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport { toSnakeCase } from \"../case.js\";\nimport type {\n\tCreateUploadSessionRequest,\n\tExplicitPublishInput,\n\tPublishInput,\n\tPublishOptions,\n\tUploadManifestFile,\n} from \"../types.js\";\nimport { sha256Bytes, sha256File } from \"./checksum.js\";\nimport { detectBytesContentType, detectStringInput } from \"./detect.js\";\nimport { collectPublishFiles, detectPathContentType } from \"./files.js\";\n\nconst SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES = 10 * 1024 * 1024;\n\nexport type PreparedUploadFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string;\n\tsource: { kind: \"path\"; path: string } | { kind: \"bytes\"; bytes: Uint8Array };\n};\n\ntype ExplicitFileInput = Extract<\n\tExplicitPublishInput,\n\t{ files: unknown }\n>[\"files\"][number];\n\nexport type PreparedPublishRequest = {\n\tkind: \"staged\";\n\tmanifest: CreateUploadSessionRequest;\n\tfiles: PreparedUploadFile[];\n\toptions: Record<string, unknown>;\n\tmetadata?: Record<string, unknown>;\n};\n\nexport async function preparePublishRequest(\n\tinput: PublishInput,\n\toptions: PublishOptions = {},\n): Promise<PreparedPublishRequest> {\n\tif (input instanceof URL) {\n\t\tthrow new Error(\n\t\t\t\"URL inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\t}\n\tif (typeof input === \"string\") {\n\t\tconst local = await localKind(input);\n\t\tif (local === \"file\") {\n\t\t\treturn fileStaged(input, options);\n\t\t}\n\t\tif (local === \"directory\") {\n\t\t\treturn folderStaged(input, options);\n\t\t}\n\t\tconst detection = detectStringInput(input);\n\t\tif (detection.mode === \"sourceUrl\")\n\t\t\tthrow new Error(\n\t\t\t\t\"URL inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t\t);\n\t\treturn stringContent(input, options, detection.contentType);\n\t}\n\tif (input instanceof Uint8Array || Buffer.isBuffer(input)) {\n\t\treturn bytesStaged(input, options);\n\t}\n\treturn explicitInput(input, options);\n}\n\nasync function stringContent(\n\tcontent: string,\n\toptions: PublishOptions,\n\tdetectedContentType: string,\n): Promise<PreparedPublishRequest> {\n\tconst contentType = options.contentType ?? detectedContentType;\n\treturn bytesStaged(Buffer.from(content), {\n\t\t...options,\n\t\tpath: options.path ?? entryForContentType(contentType),\n\t\tcontentType,\n\t});\n}\n\nfunction entryForContentType(contentType: string): string {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\tif (normalized === \"text/html\" || normalized === \"application/xhtml+xml\")\n\t\treturn \"index.html\";\n\tif (normalized === \"application/json\") return \"index.json\";\n\tif (normalized === \"text/css\") return \"index.css\";\n\tif (\n\t\tnormalized === \"text/javascript\" ||\n\t\tnormalized === \"application/javascript\"\n\t)\n\t\treturn \"index.js\";\n\tif (normalized.startsWith(\"text/\")) return \"index.txt\";\n\treturn \"index\";\n}\n\nasync function localKind(\n\tinput: string,\n): Promise<\"file\" | \"directory\" | \"none\"> {\n\ttry {\n\t\tconst info = await stat(input);\n\t\tif (info.isFile()) return \"file\";\n\t\tif (info.isDirectory()) return \"directory\";\n\t\treturn \"none\";\n\t} catch {\n\t\treturn \"none\";\n\t}\n}\n\nasync function fileStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst fileStat = await stat(path);\n\tconst manifestPath = options.path ?? basename(path);\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: manifestPath,\n\t\t\t\tcontentType: options.contentType ?? (await detectPathContentType(path)),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t\tsource: { kind: \"path\", path },\n\t\t\t},\n\t\t],\n\t\t{ ...options, entry: options.entry ?? manifestPath },\n\t);\n}\n\nasync function folderStaged(\n\tpath: string,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst files = (await collectPublishFiles(path, options)).map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\tsource: { kind: \"path\", path: file.absolutePath } as const,\n\t}));\n\treturn stagedRequest(files, options);\n}\n\nasync function bytesStaged(\n\tbytes: Uint8Array,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\treturn stagedRequest(\n\t\t[\n\t\t\t{\n\t\t\t\tpath: options.path ?? \"index\",\n\t\t\t\tcontentType: options.contentType ?? detectBytesContentType(bytes),\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes },\n\t\t\t},\n\t\t],\n\t\toptions,\n\t);\n}\n\nasync function stagedRequest(\n\tfiles: PreparedUploadFile[],\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tconst preparedFiles = await Promise.all(\n\t\tfiles.map(async (file) => {\n\t\t\tif (file.sizeBytes <= SINGLE_PUT_CHECKSUM_THRESHOLD_BYTES) return file;\n\t\t\tconst checksumSha256 =\n\t\t\t\tfile.source.kind === \"bytes\"\n\t\t\t\t\t? sha256Bytes(file.source.bytes)\n\t\t\t\t\t: await sha256File(file.source.path);\n\t\t\treturn { ...file, checksumSha256 };\n\t\t}),\n\t);\n\tconst manifestFiles: UploadManifestFile[] = preparedFiles.map((file) => ({\n\t\tpath: file.path,\n\t\tcontentType: file.contentType,\n\t\tsizeBytes: file.sizeBytes,\n\t\t...(file.checksumSha256 ? { checksumSha256: file.checksumSha256 } : {}),\n\t}));\n\tconst prepared: Extract<PreparedPublishRequest, { kind: \"staged\" }> = {\n\t\tkind: \"staged\",\n\t\tmanifest: {\n\t\t\tschemaVersion: 1,\n\t\t\tfiles: manifestFiles,\n\t\t\t...(options.entry ? { entry: options.entry } : {}),\n\t\t},\n\t\tfiles: preparedFiles,\n\t\toptions: optionsBody(options),\n\t};\n\tif (options.metadata) prepared.metadata = options.metadata;\n\treturn prepared;\n}\n\nasync function explicitInput(\n\tinput: ExplicitPublishInput,\n\toptions: PublishOptions,\n): Promise<PreparedPublishRequest> {\n\tif (\"content\" in input)\n\t\treturn stringContent(\n\t\t\tinput.content,\n\t\t\t{ ...options, ...input },\n\t\t\tinput.contentType ?? options.contentType ?? \"text/html\",\n\t\t);\n\tif (\"sourceUrl\" in input)\n\t\tthrow new Error(\n\t\t\t\"sourceUrl inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\tif (\"sourceUrls\" in input)\n\t\tthrow new Error(\n\t\t\t\"sourceUrls inputs are not supported. Fetch the content first, then pass it as a string or file.\",\n\t\t);\n\treturn stagedRequest(\n\t\tinput.files.map((file) => {\n\t\t\tconst bytes = explicitFileBytes(file);\n\t\t\treturn {\n\t\t\t\tpath: file.path,\n\t\t\t\tcontentType: file.contentType,\n\t\t\t\tsizeBytes: bytes.byteLength,\n\t\t\t\tsource: { kind: \"bytes\", bytes } as const,\n\t\t\t};\n\t\t}),\n\t\t{ ...options, ...input },\n\t);\n}\n\nfunction explicitFileBytes(file: ExplicitFileInput): Uint8Array {\n\tif (file.content !== undefined) return Buffer.from(file.content);\n\tif (file.contentBase64 !== undefined)\n\t\treturn Buffer.from(file.contentBase64, \"base64\");\n\tif (file.bytes !== undefined) return file.bytes;\n\tthrow new TypeError(`Explicit file ${file.path} is missing content bytes`);\n}\n\nfunction optionsBody(\n\toptions: PublishOptions & Partial<ExplicitPublishInput>,\n): Record<string, unknown> {\n\treturn toSnakeCase({\n\t\ttitle: options.title,\n\t\tvisibility: options.visibility,\n\t\tpassword: options.password,\n\t\tnoindex: options.noindex,\n\t\texpiresAt:\n\t\t\toptions.expiresAt instanceof Date\n\t\t\t\t? options.expiresAt.toISOString()\n\t\t\t\t: options.expiresAt,\n\t}) as Record<string, unknown>;\n}\n","export function toCamelKey(key: string): string {\n\treturn key.replace(/_([a-z])/g, (_, char: string) => char.toUpperCase());\n}\n\nexport function toSnakeKey(key: string): string {\n\treturn key.replace(/[A-Z]/g, (char) => `_${char.toLowerCase()}`);\n}\n\nexport function toCamelCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toCamelCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value).map(([key, item]) => [\n\t\t\t\ttoCamelKey(key),\n\t\t\t\ttoCamelCase(item),\n\t\t\t]),\n\t\t);\n\t}\n\treturn value;\n}\n\nexport function toSnakeCase(value: unknown): unknown {\n\tif (Array.isArray(value)) return value.map(toSnakeCase);\n\tif (value && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value)\n\t\t\t\t.filter(([, item]) => item !== undefined)\n\t\t\t\t.map(([key, item]) => [toSnakeKey(key), toSnakeCase(item)]),\n\t\t);\n\t}\n\treturn value;\n}\n","import { createHash } from \"node:crypto\";\nimport { createReadStream } from \"node:fs\";\n\nexport function sha256Bytes(bytes: Uint8Array): string {\n\treturn createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nexport async function sha256File(path: string): Promise<string> {\n\tconst hash = createHash(\"sha256\");\n\tfor await (const chunk of createReadStream(path)) {\n\t\thash.update(chunk);\n\t}\n\treturn hash.digest(\"hex\");\n}\n","export type StringInputDetection =\n\t| { mode: \"sourceUrl\" }\n\t| {\n\t\t\tmode: \"content\";\n\t\t\tcontentType: \"text/html\" | \"text/plain; charset=utf-8\";\n\t };\n\nexport function isHttpUrl(value: string): boolean {\n\ttry {\n\t\tconst url = new URL(value);\n\t\treturn url.protocol === \"http:\" || url.protocol === \"https:\";\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function looksLikeHtml(value: string): boolean {\n\tconst trimmed = value.trimStart().toLowerCase();\n\treturn (\n\t\ttrimmed.startsWith(\"<!doctype html\") ||\n\t\ttrimmed.startsWith(\"<html\") ||\n\t\t/^<[a-z][a-z0-9:-]*(\\s|>)/.test(trimmed)\n\t);\n}\n\nexport function detectStringInput(value: string): StringInputDetection {\n\tif (isHttpUrl(value)) return { mode: \"sourceUrl\" as const };\n\treturn {\n\t\tmode: \"content\",\n\t\tcontentType: looksLikeHtml(value)\n\t\t\t? \"text/html\"\n\t\t\t: \"text/plain; charset=utf-8\",\n\t};\n}\n\nexport function isTextLikeContentType(contentType: string): boolean {\n\tconst normalized = contentType.toLowerCase().split(\";\", 1)[0]?.trim() ?? \"\";\n\treturn (\n\t\tnormalized.startsWith(\"text/\") ||\n\t\t[\n\t\t\t\"application/json\",\n\t\t\t\"application/javascript\",\n\t\t\t\"application/xml\",\n\t\t\t\"application/xhtml+xml\",\n\t\t\t\"image/svg+xml\",\n\t\t].includes(normalized)\n\t);\n}\n\nexport function detectBytesContentType(bytes: Uint8Array): string {\n\tconst text = Buffer.from(bytes).toString(\"utf8\");\n\tif (text.includes(\"\\uFFFD\")) return \"application/octet-stream\";\n\treturn looksLikeHtml(text) ? \"text/html\" : \"text/plain; charset=utf-8\";\n}\n","import { readFile, stat } from \"node:fs/promises\";\nimport { basename, sep } from \"node:path\";\nimport fg from \"fast-glob\";\nimport ignore from \"ignore\";\nimport { lookup } from \"mime-types\";\nimport { detectBytesContentType } from \"./detect.js\";\n\nexport type PublishFile = {\n\tabsolutePath: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n};\n\nconst DEFAULT_IGNORES = [\n\t\".git\",\n\t\".git/**\",\n\t\"node_modules\",\n\t\"node_modules/**\",\n\t\".DS_Store\",\n\t\".env\",\n\t\".env.*\",\n\t\".cache\",\n\t\".cache/**\",\n\t\".tmp\",\n\t\".tmp/**\",\n\t\"dist/.cache\",\n\t\"dist/.cache/**\",\n];\n\nexport async function collectPublishFiles(\n\tinputPath: string,\n\toptions: { ignore?: string[]; ignoreDefaults?: boolean } = {},\n): Promise<PublishFile[]> {\n\tconst inputStat = await stat(inputPath);\n\tif (inputStat.isFile()) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tabsolutePath: inputPath,\n\t\t\t\tpath: basename(inputPath),\n\t\t\t\tcontentType: await detectPathContentType(inputPath),\n\t\t\t\tsizeBytes: inputStat.size,\n\t\t\t},\n\t\t];\n\t}\n\tif (!inputStat.isDirectory()) {\n\t\tthrow new Error(`Input is not a file or directory: ${inputPath}`);\n\t}\n\n\tconst matcher = ignore().add([\n\t\t...(options.ignoreDefaults === false ? [] : DEFAULT_IGNORES),\n\t\t...(options.ignore ?? []),\n\t]);\n\tconst entries = await fg(\"**/*\", {\n\t\tcwd: inputPath,\n\t\tonlyFiles: true,\n\t\tfollowSymbolicLinks: false,\n\t\tdot: true,\n\t\tunique: true,\n\t});\n\tconst paths = entries\n\t\t.map((entry) => entry.split(sep).join(\"/\"))\n\t\t.filter((entry) => !matcher.ignores(entry))\n\t\t.sort((a, b) => a.localeCompare(b));\n\treturn Promise.all(\n\t\tpaths.map(async (path) => {\n\t\t\tconst absolutePath = `${inputPath}/${path}`;\n\t\t\tconst fileStat = await stat(absolutePath);\n\t\t\treturn {\n\t\t\t\tabsolutePath,\n\t\t\t\tpath,\n\t\t\t\tcontentType: await detectPathContentType(absolutePath),\n\t\t\t\tsizeBytes: fileStat.size,\n\t\t\t};\n\t\t}),\n\t);\n}\n\nexport async function detectPathContentType(path: string): Promise<string> {\n\tconst detected = lookup(path);\n\tif (detected) return detected;\n\treturn detectBytesContentType(await readFile(path));\n}\n","import { randomUUID } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { toSnakeCase } from \"../case.js\";\nimport { createErrorResult } from \"../errors.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionResponse,\n\tDropResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\nimport type { PreparedPublishRequest, PreparedUploadFile } from \"./prepare.js\";\n\ntype PreparedStagedPublish = Extract<\n\tPreparedPublishRequest,\n\t{ kind: \"staged\" }\n>;\n\ntype StagedPublishOptions = {\n\tidempotencyKey?: string;\n\tifRevision?: number;\n};\n\nconst MAX_PART_TARGETS_PER_REQUEST = 100;\n\nexport async function publishStaged(\n\ttransport: Transport,\n\tprepared: PreparedStagedPublish,\n\tfinalPath: string,\n\toptions: StagedPublishOptions = {},\n): Promise<DropthisResult<DropResponse>> {\n\tconst baseKey = options.idempotencyKey ?? `sdk-${randomUUID()}`;\n\tconst createResult = await transport.request<CreateUploadSessionResponse>(\n\t\t\"POST\",\n\t\t\"/uploads\",\n\t\t{\n\t\t\tbody: toSnakeCase(prepared.manifest),\n\t\t\tidempotencyKey: `${baseKey}:create-upload`,\n\t\t},\n\t);\n\tif (createResult.error) return errorResult(createResult);\n\n\tconst completedFiles: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> }\n\t> = {};\n\tfor (const file of prepared.files) {\n\t\tconst target = createResult.data.files.find(\n\t\t\t(candidate) => candidate.path === file.path,\n\t\t);\n\t\tif (!target) {\n\t\t\treturn createErrorResult(\n\t\t\t\t\"upload_target_missing\",\n\t\t\t\t`Upload target missing for ${file.path}`,\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\t\tif (target.upload.strategy === \"multipart\") {\n\t\t\tconst partsResult = await uploadMultipartFile(\n\t\t\t\ttransport,\n\t\t\t\tcreateResult.data.uploadId,\n\t\t\t\ttarget.fileId,\n\t\t\t\tfile,\n\t\t\t\ttarget.upload.partSize,\n\t\t\t);\n\t\t\tif (partsResult.error) return errorResult(partsResult);\n\t\t\tcompletedFiles[target.fileId] = { parts: partsResult.data };\n\t\t\tcontinue;\n\t\t}\n\t\tconst bytes = await fileBytes(file);\n\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\ttarget.upload.url,\n\t\t\tbytes,\n\t\t\ttarget.upload.headers,\n\t\t);\n\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t}\n\n\tconst completeResult = await transport.request<UploadSessionResponse>(\n\t\t\"POST\",\n\t\t`/uploads/${encodeURIComponent(createResult.data.uploadId)}/complete`,\n\t\t{\n\t\t\tbody: toSnakeCase({ files: completedFiles }),\n\t\t\tidempotencyKey: `${baseKey}:complete-upload`,\n\t\t},\n\t);\n\tif (completeResult.error) return errorResult(completeResult);\n\n\tconst finalOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\tbody: {\n\t\t\tupload_id: createResult.data.uploadId,\n\t\t\toptions: prepared.options,\n\t\t\t...(prepared.metadata ? { metadata: prepared.metadata } : {}),\n\t\t},\n\t\tidempotencyKey: `${baseKey}:publish`,\n\t};\n\tif (options.ifRevision !== undefined)\n\t\tfinalOptions.ifRevision = options.ifRevision;\n\treturn transport.request(\"POST\", finalPath, finalOptions);\n}\n\nasync function uploadMultipartFile(\n\ttransport: Transport,\n\tuploadId: string,\n\tfileId: string,\n\tfile: PreparedUploadFile,\n\tpartSize: number | undefined,\n): Promise<DropthisResult<Array<{ partNumber: number; etag: string }>>> {\n\tif (!partSize || partSize < 1) {\n\t\treturn createErrorResult(\n\t\t\t\"invalid_upload_target\",\n\t\t\t\"Multipart upload target did not include a valid part size.\",\n\t\t\tnull,\n\t\t);\n\t}\n\tconst bytes = await fileBytes(file);\n\tconst partNumbers = Array.from(\n\t\t{ length: Math.ceil(bytes.byteLength / partSize) },\n\t\t(_, index) => index + 1,\n\t);\n\tconst parts: Array<{ partNumber: number; etag: string }> = [];\n\tfor (\n\t\tlet startIndex = 0;\n\t\tstartIndex < partNumbers.length;\n\t\tstartIndex += MAX_PART_TARGETS_PER_REQUEST\n\t) {\n\t\tconst partNumberBatch = partNumbers.slice(\n\t\t\tstartIndex,\n\t\t\tstartIndex + MAX_PART_TARGETS_PER_REQUEST,\n\t\t);\n\t\tconst targetsResult =\n\t\t\tawait transport.request<CreateUploadPartTargetsResponse>(\n\t\t\t\t\"POST\",\n\t\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t\t{ body: toSnakeCase({ fileId, partNumbers: partNumberBatch }) },\n\t\t\t);\n\t\tif (targetsResult.error) return errorResult(targetsResult);\n\t\tfor (const target of targetsResult.data.parts) {\n\t\t\tconst start = (target.partNumber - 1) * partSize;\n\t\t\tconst end = Math.min(start + partSize, bytes.byteLength);\n\t\t\tconst uploadResult = await transport.putSignedUrl(\n\t\t\t\ttarget.url,\n\t\t\t\tbytes.slice(start, end),\n\t\t\t\ttarget.headers,\n\t\t\t);\n\t\t\tif (uploadResult.error) return errorResult(uploadResult);\n\t\t\tif (!uploadResult.data.etag) {\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t\"missing_upload_etag\",\n\t\t\t\t\t\"Signed upload response did not include an ETag.\",\n\t\t\t\t\tnull,\n\t\t\t\t);\n\t\t\t}\n\t\t\tparts.push({\n\t\t\t\tpartNumber: target.partNumber,\n\t\t\t\tetag: uploadResult.data.etag,\n\t\t\t});\n\t\t}\n\t}\n\treturn { data: parts, error: null, headers: {} };\n}\n\nasync function fileBytes(file: PreparedUploadFile): Promise<Uint8Array> {\n\tif (file.source.kind === \"bytes\") return file.source.bytes;\n\treturn readFile(file.source.path);\n}\n\nfunction errorResult<T>(result: DropthisResult<unknown>): DropthisResult<T> {\n\tif (!result.error) throw new Error(\"Expected an error result\");\n\treturn { data: null, error: result.error, headers: result.headers };\n}\n","import type { DropthisResult } from \"./types.js\";\n\nconst API_KEY_RE = /sk_[A-Za-z0-9_-]+/g;\n\nexport function redactSecrets(message: string): string {\n\treturn message.replace(API_KEY_RE, \"sk_[redacted]\");\n}\n\nexport function createErrorResult<T>(\n\tcode: string,\n\tmessage: string,\n\tstatusCode: number | null,\n\textra: {\n\t\ttype?: string;\n\t\tdetail?: unknown;\n\t\tparam?: string | null;\n\t\tcurrentRevision?: number;\n\t\trequestId?: string | null;\n\t\theaders?: Record<string, string>;\n\t} = {},\n): DropthisResult<T> {\n\treturn {\n\t\tdata: null,\n\t\terror: {\n\t\t\tcode,\n\t\t\tmessage: redactSecrets(message),\n\t\t\tstatusCode,\n\t\t\t...(extra.type ? { type: extra.type } : {}),\n\t\t\t...(extra.detail !== undefined ? { detail: extra.detail } : {}),\n\t\t\t...(extra.param !== undefined ? { param: extra.param } : {}),\n\t\t\t...(extra.currentRevision !== undefined\n\t\t\t\t? { currentRevision: extra.currentRevision }\n\t\t\t\t: {}),\n\t\t\t...(extra.requestId !== undefined ? { requestId: extra.requestId } : {}),\n\t\t},\n\t\theaders: extra.headers ?? {},\n\t};\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type { AccountResponse, DropthisResult } from \"../types.js\";\n\nexport class AccountResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tget(): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"GET\", \"/account\");\n\t}\n\n\tupdate(input: {\n\t\tdisplayName: string | null;\n\t}): Promise<DropthisResult<AccountResponse>> {\n\t\treturn this.transport.request(\"PATCH\", \"/account\", {\n\t\t\tbody: toSnakeCase(input),\n\t\t});\n\t}\n\n\tdelete(): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\"DELETE\", \"/account\");\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tApiKeyCreatedResponse,\n\tApiKeyResponse,\n\tDropthisResult,\n} from \"../types.js\";\n\nexport class ApiKeysResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tlist(): Promise<DropthisResult<{ object: \"list\"; data: ApiKeyResponse[] }>> {\n\t\treturn this.transport.request(\"GET\", \"/api-keys\");\n\t}\n\n\tcreate(input: {\n\t\tlabel: string;\n\t}): Promise<DropthisResult<ApiKeyCreatedResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/api-keys\", { body: input });\n\t}\n\n\tdelete(keyId: string): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/api-keys/${encodeURIComponent(keyId)}`,\n\t\t);\n\t}\n}\n","import type { Transport } from \"../transport.js\";\nimport type {\n\tDropthisResult,\n\tEmailOtpResponse,\n\tSessionResponse,\n} from \"../types.js\";\n\nexport class AuthResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\trequestEmailOtp(input: {\n\t\temail: string;\n\t}): Promise<DropthisResult<EmailOtpResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/otp\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tverifyEmailOtp(input: {\n\t\temail: string;\n\t\tcode: string;\n\t}): Promise<DropthisResult<SessionResponse>> {\n\t\treturn this.transport.request(\"POST\", \"/auth/email/verify\", {\n\t\t\tbody: input,\n\t\t\tauthenticated: false,\n\t\t});\n\t}\n\n\tlogout(): Promise<DropthisResult<{ ok: true }>> {\n\t\treturn this.transport.request(\"DELETE\", \"/auth/session\");\n\t}\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tDropDeploymentResponse,\n\tDropResponse,\n\tDropthisResult,\n\tListDeploymentsParams,\n\tListDeploymentsResponse,\n} from \"../types.js\";\n\nexport class DeploymentsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tdropId: string,\n\t\tbody: Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcreateRaw(\n\t\tdropId: string,\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\trequestOptions.ifRevision = options.ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tlist(\n\t\tdropId: string,\n\t\tparams: ListDeploymentsParams = {},\n\t): Promise<DropthisResult<ListDeploymentsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments`,\n\t\t\t{\n\t\t\t\tparams: toSnakeCase(params) as Record<\n\t\t\t\t\tstring,\n\t\t\t\t\tstring | number | boolean\n\t\t\t\t>,\n\t\t\t},\n\t\t);\n\t}\n\n\tget(\n\t\tdropId: string,\n\t\tdeploymentId: string,\n\t): Promise<DropthisResult<DropDeploymentResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}/deployments/${encodeURIComponent(deploymentId)}`,\n\t\t);\n\t}\n}\n","export type DropthisClientOptions = {\n\tapiKey?: string;\n\tbaseUrl?: string;\n\ttimeoutMs?: number;\n\tfetch?: typeof globalThis.fetch;\n};\n\nexport type RequestOptions = {\n\tauthenticated?: boolean;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\ttimeoutMs?: number;\n};\n\nexport type DropthisErrorResponse = {\n\tcode: string;\n\tmessage: string;\n\tstatusCode: number | null;\n\ttype?: string;\n\tdetail?: unknown;\n\tparam?: string | null;\n\tcurrentRevision?: number;\n\trequestId?: string | null;\n};\n\nexport type DropthisResult<T> =\n\t| { data: T; error: null; headers: Record<string, string> }\n\t| {\n\t\t\tdata: null;\n\t\t\terror: DropthisErrorResponse;\n\t\t\theaders: Record<string, string>;\n\t };\n\nexport type DropResponse = {\n\tid: string;\n\tslug: string;\n\turl: string;\n\tcanonicalHost: string;\n\tdeploymentId: string | null;\n\ttitle: string;\n\tcontentType: string;\n\tvisibility: string;\n\tstatus: string;\n\trevision: number;\n\tcontentRevision: number;\n\taccessRevision: number;\n\tsizeBytes: number;\n\trenderMode: string;\n\twarnings: Array<Record<string, unknown>>;\n\tcreatedAt: string;\n\texpiresAt: string | null;\n};\n\nexport type DropDeploymentResponse = {\n\tid: string;\n\tdropId: string;\n\trevision: number;\n\tstatus: string;\n\tstoragePrefix: string;\n\tentry: string | null;\n\tcontentType: string;\n\trenderMode: string;\n\tfiles: Array<Record<string, unknown>>;\n\twarnings: Array<Record<string, unknown>>;\n\tsizeBytes: number;\n\tclassificationVersion: number;\n\tclassificationReason: string;\n\terrorCode: string | null;\n\terrorMessage: string | null;\n\tcreatedAt: string;\n\treadyAt: string | null;\n\tpublishedAt: string | null;\n};\n\nexport type ListDeploymentsParams = { cursor?: string | null; limit?: number };\n\nexport type ListDeploymentsResponse = {\n\tdeployments: DropDeploymentResponse[];\n\tnextCursor: string | null;\n};\n\nexport type ListPage<T> = {\n\tobject: \"list\";\n\tdata: T[];\n\thasMore: boolean;\n\tnextCursor: string | null;\n\tautoPagingToArray(options?: { limit?: number }): Promise<T[]>;\n\t[Symbol.asyncIterator](): AsyncIterableIterator<T>;\n};\n\nexport type EmailOtpResponse = { ok: true; expiresIn: number };\nexport type SessionResponse = {\n\tobject: \"session\";\n\ttoken: string;\n\taccountId: string;\n\tisNewAccount: boolean;\n\texpiresIn: number;\n};\nexport type ApiKeyResponse = {\n\tobject: \"api_key\";\n\tid: string;\n\tkeyLast4: string;\n\tlabel: string;\n\tcreatedAt: string;\n};\nexport type ApiKeyCreatedResponse = ApiKeyResponse & {\n\tkey: string;\n\taccountId?: string | null;\n\tisNewAccount?: boolean;\n};\nexport type AccountResponse = {\n\tid: string;\n\temail: string;\n\tdisplayName: string | null;\n\tplan: string;\n\tstatus: string;\n\tcreatedAt: string;\n};\nexport type ListDropsParams = { cursor?: string | null; limit?: number };\n\nexport type UploadManifestFile = {\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tchecksumSha256?: string | null;\n};\n\nexport type CreateUploadSessionRequest = {\n\tschemaVersion?: 1;\n\tfiles: UploadManifestFile[];\n\tentry?: string | null;\n};\n\nexport type UploadTarget = {\n\tstrategy: \"single_put\" | \"multipart\";\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n\tpartSize?: number;\n\tpartCount?: number;\n};\n\nexport type CreateUploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tobjectKey: string;\n\tupload: UploadTarget;\n};\n\nexport type UploadSessionFileResponse = {\n\tfileId: string;\n\tpath: string;\n\tcontentType: string;\n\tsizeBytes: number;\n\tobjectKey: string;\n\tverified: boolean;\n};\n\nexport type UploadSessionResponse = {\n\tuploadId: string;\n\tstatus: string;\n\texpiresAt: string;\n\tentry?: string | null;\n\tfiles: UploadSessionFileResponse[];\n};\n\nexport type CreateUploadSessionResponse = {\n\tuploadId: string;\n\texpiresAt: string;\n\tfiles: CreateUploadSessionFileResponse[];\n};\n\nexport type CreateUploadPartTargetsRequest = {\n\tfileId: string;\n\tpartNumbers: number[];\n};\n\nexport type UploadPartTarget = {\n\tpartNumber: number;\n\turl: string;\n\theaders: Record<string, string>;\n\texpiresAt: string;\n};\n\nexport type CreateUploadPartTargetsResponse = {\n\tfileId: string;\n\turlExpiresAt?: string | null;\n\tparts: UploadPartTarget[];\n};\n\nexport type CompleteUploadSessionRequest = {\n\tfiles?: Record<\n\t\tstring,\n\t\t{ parts?: Array<{ partNumber: number; etag: string }> | null }\n\t>;\n};\n\nexport class CursorPage<T> implements ListPage<T> {\n\treadonly object = \"list\" as const;\n\treadonly data: T[];\n\treadonly hasMore: boolean;\n\treadonly nextCursor: string | null;\n\tprivate readonly fetchNextPage:\n\t\t| (() => Promise<DropthisResult<CursorPage<T>>>)\n\t\t| undefined;\n\n\tconstructor(input: {\n\t\tdata: T[];\n\t\thasMore: boolean;\n\t\tnextCursor: string | null;\n\t\tfetchNextPage?: (() => Promise<DropthisResult<CursorPage<T>>>) | undefined;\n\t}) {\n\t\tthis.data = input.data;\n\t\tthis.hasMore = input.hasMore;\n\t\tthis.nextCursor = input.nextCursor;\n\t\tthis.fetchNextPage = input.fetchNextPage;\n\t}\n\n\tasync autoPagingToArray(options: { limit?: number } = {}): Promise<T[]> {\n\t\tconst items: T[] = [];\n\t\tfor await (const item of this) {\n\t\t\titems.push(item);\n\t\t\tif (options.limit !== undefined && items.length >= options.limit) break;\n\t\t}\n\t\treturn items;\n\t}\n\n\tasync *[Symbol.asyncIterator](): AsyncIterableIterator<T> {\n\t\tfor (const item of this.data) yield item;\n\t\tlet current: CursorPage<T> = this;\n\t\twhile (current.hasMore && current.fetchNextPage) {\n\t\t\tconst next = await current.fetchNextPage();\n\t\t\tif (next.error) break;\n\t\t\tcurrent = next.data;\n\t\t\tfor (const item of current.data) yield item;\n\t\t}\n\t}\n}\n\nexport type PublishOptions = {\n\tslug?: string;\n\ttitle?: string;\n\tvisibility?: \"public\" | \"unlisted\";\n\tpassword?: string | null;\n\tnoindex?: boolean | null;\n\texpiresAt?: string | Date | null;\n\tentry?: string;\n\tmetadata?: Record<string, unknown>;\n\tidempotencyKey?: string;\n\tifRevision?: number;\n\tignore?: string[];\n\tignoreDefaults?: boolean;\n\tcontentType?: string;\n\tpath?: string;\n};\n\nexport type UpdateOptions = PublishOptions;\nexport type UpdateTarget = string;\n\nexport type ExplicitPublishInput =\n\t| {\n\t\t\tcontent: string;\n\t\t\tcontentType?: string;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t }\n\t| {\n\t\t\tfiles: Array<{\n\t\t\t\tpath: string;\n\t\t\t\tcontent?: string;\n\t\t\t\tcontentBase64?: string;\n\t\t\t\tbytes?: Uint8Array;\n\t\t\t\tcontentType: string;\n\t\t\t}>;\n\t\t\ttitle?: string;\n\t\t\tvisibility?: \"public\" | \"unlisted\";\n\t\t\tmetadata?: Record<string, unknown>;\n\t\t\tentry?: string;\n\t };\n\nexport type PublishInput = string | Uint8Array | ExplicitPublishInput;\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport {\n\tCursorPage,\n\ttype DropResponse,\n\ttype DropthisResult,\n\ttype ListDropsParams,\n\ttype PublishOptions,\n} from \"../types.js\";\n\nexport class DropsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tcreateRaw(\n\t\tbody: unknown,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = { body };\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/drops\", requestOptions);\n\t}\n\n\tasync list(\n\t\tparams: ListDropsParams = {},\n\t): Promise<DropthisResult<CursorPage<DropResponse>>> {\n\t\tconst result = await this.transport.request<{\n\t\t\tdrops: DropResponse[];\n\t\t\tnextCursor: string | null;\n\t\t}>(\"GET\", \"/drops\", {\n\t\t\tparams: toSnakeCase(params) as Record<string, string | number | boolean>,\n\t\t});\n\t\tif (result.error) return result;\n\t\tconst page = new CursorPage<DropResponse>({\n\t\t\tdata: result.data.drops,\n\t\t\tnextCursor: result.data.nextCursor,\n\t\t\thasMore: result.data.nextCursor !== null,\n\t\t\tfetchNextPage: result.data.nextCursor\n\t\t\t\t? () => this.list({ ...params, cursor: result.data.nextCursor })\n\t\t\t\t: undefined,\n\t\t});\n\t\treturn { data: page, error: null, headers: result.headers };\n\t}\n\n\tget(dropId: string): Promise<DropthisResult<DropResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n\n\tupdate(\n\t\tdropId: string,\n\t\tbody: PublishOptions | Record<string, unknown>,\n\t\toptions: { idempotencyKey?: string; ifRevision?: number } = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst bodyRecord = body as Record<string, unknown>;\n\t\tif (hasContent(bodyRecord)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t\"drops.update() only patches drop options; use deployments.create() or update() for content\",\n\t\t\t);\n\t\t}\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: updateBody(body),\n\t\t};\n\t\tconst bodyOptions = body as PublishOptions;\n\t\tconst idempotencyKey = options.idempotencyKey ?? bodyOptions.idempotencyKey;\n\t\tconst ifRevision = options.ifRevision ?? bodyOptions.ifRevision;\n\t\tif (idempotencyKey) requestOptions.idempotencyKey = idempotencyKey;\n\t\tif (ifRevision !== undefined) requestOptions.ifRevision = ifRevision;\n\t\treturn this.transport.request(\n\t\t\t\"PATCH\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tdelete(dropId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/drops/${encodeURIComponent(dropId)}`,\n\t\t);\n\t}\n}\n\nfunction updateBody(body: PublishOptions | Record<string, unknown>): unknown {\n\tconst {\n\t\tmetadata,\n\t\tidempotencyKey: _idempotencyKey,\n\t\tifRevision: _ifRevision,\n\t\tignore: _ignore,\n\t\tignoreDefaults: _ignoreDefaults,\n\t\tcontentType: _contentType,\n\t\tpath: _path,\n\t\tentry: _entry,\n\t\t...dropOptions\n\t} = body as PublishOptions;\n\treturn toSnakeCase({ options: dropOptions, metadata });\n}\n\nfunction hasContent(body: Record<string, unknown>): boolean {\n\treturn [\"content\", \"contentType\", \"content_type\", \"entry\", \"files\"].some(\n\t\t(field) => body[field] !== undefined,\n\t);\n}\n","import { toSnakeCase } from \"../case.js\";\nimport type { Transport } from \"../transport.js\";\nimport type {\n\tCompleteUploadSessionRequest,\n\tCreateUploadPartTargetsRequest,\n\tCreateUploadPartTargetsResponse,\n\tCreateUploadSessionRequest,\n\tCreateUploadSessionResponse,\n\tDropthisResult,\n\tUploadSessionResponse,\n} from \"../types.js\";\n\nexport class UploadsResource {\n\tconstructor(private readonly transport: Transport) {}\n\n\tcreate(\n\t\tbody: CreateUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<CreateUploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\"POST\", \"/uploads\", requestOptions);\n\t}\n\n\tget(uploadId: string): Promise<DropthisResult<UploadSessionResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"GET\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n\n\tcreatePartTargets(\n\t\tuploadId: string,\n\t\tbody: CreateUploadPartTargetsRequest,\n\t): Promise<DropthisResult<CreateUploadPartTargetsResponse>> {\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/parts`,\n\t\t\t{ body: toSnakeCase(body) },\n\t\t);\n\t}\n\n\tcomplete(\n\t\tuploadId: string,\n\t\tbody: CompleteUploadSessionRequest,\n\t\toptions: { idempotencyKey?: string } = {},\n\t): Promise<DropthisResult<UploadSessionResponse>> {\n\t\tconst requestOptions: Parameters<Transport[\"request\"]>[2] = {\n\t\t\tbody: toSnakeCase(body),\n\t\t};\n\t\tif (options.idempotencyKey)\n\t\t\trequestOptions.idempotencyKey = options.idempotencyKey;\n\t\treturn this.transport.request(\n\t\t\t\"POST\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}/complete`,\n\t\t\trequestOptions,\n\t\t);\n\t}\n\n\tcancel(uploadId: string): Promise<DropthisResult<null>> {\n\t\treturn this.transport.request(\n\t\t\t\"DELETE\",\n\t\t\t`/uploads/${encodeURIComponent(uploadId)}`,\n\t\t);\n\t}\n}\n","import { toCamelCase } from \"./case.js\";\nimport { createErrorResult } from \"./errors.js\";\nimport type {\n\tDropthisClientOptions,\n\tDropthisResult,\n\tRequestOptions,\n} from \"./types.js\";\n\nconst DEFAULT_BASE_URL = \"https://api.dropthis.app\";\nconst SDK_VERSION = \"0.1.0\";\n\nexport class Transport {\n\treadonly apiKey: string | undefined;\n\treadonly baseUrl: string;\n\treadonly timeoutMs: number;\n\treadonly fetchImpl: typeof globalThis.fetch;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tconst resolved =\n\t\t\ttypeof options === \"string\" ? { apiKey: options } : options;\n\t\tthis.apiKey = resolved.apiKey ?? process.env.DROPTHIS_API_KEY;\n\t\tthis.baseUrl = (resolved.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\t\tthis.timeoutMs = resolved.timeoutMs ?? 30_000;\n\t\tthis.fetchImpl = resolved.fetch ?? globalThis.fetch;\n\t}\n\n\tmultipart<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\tform: FormData,\n\t\toptions: RequestOptions = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.request<T>(method, path, { ...options, body: form });\n\t}\n\n\tasync putSignedUrl(\n\t\turl: string,\n\t\tbody: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(() => controller.abort(), this.timeoutMs);\n\t\ttry {\n\t\t\tconst request: RequestInit & { duplex?: \"half\" } = {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\theaders,\n\t\t\t\tbody: body as BodyInit,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (body instanceof ReadableStream) request.duplex = \"half\";\n\t\t\tconst response = await this.fetchImpl(url, request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst text = await response.text();\n\t\t\t\treturn createErrorResult(\n\t\t\t\t\t`signed_upload_${response.status}`,\n\t\t\t\t\ttext || response.statusText,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\t{ headers: responseHeaders },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: {\n\t\t\t\t\tetag: response.headers.get(\"ETag\") ?? responseHeaders.etag ?? null,\n\t\t\t\t},\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n\n\tasync request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\tconst authenticated = options.authenticated ?? true;\n\t\tif (authenticated && !this.apiKey) {\n\t\t\treturn createErrorResult<T>(\n\t\t\t\t\"missing_api_key\",\n\t\t\t\t\"No API key provided. Pass apiKey or set DROPTHIS_API_KEY.\",\n\t\t\t\tnull,\n\t\t\t);\n\t\t}\n\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"user-agent\": `dropthis-node/${SDK_VERSION}`,\n\t\t};\n\t\tif (authenticated && this.apiKey)\n\t\t\theaders.authorization = `Bearer ${this.apiKey}`;\n\t\tif (options.idempotencyKey)\n\t\t\theaders[\"idempotency-key\"] = options.idempotencyKey;\n\t\tif (options.ifRevision !== undefined)\n\t\t\theaders[\"If-Revision\"] = String(options.ifRevision);\n\t\tif (options.body !== undefined && !(options.body instanceof FormData))\n\t\t\theaders[\"content-type\"] = \"application/json\";\n\n\t\tconst url = new URL(`${this.baseUrl}${path}`);\n\t\tfor (const [key, value] of Object.entries(options.params ?? {})) {\n\t\t\tif (value !== undefined && value !== null)\n\t\t\t\turl.searchParams.set(key, String(value));\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tconst timeout = setTimeout(\n\t\t\t() => controller.abort(),\n\t\t\toptions.timeoutMs ?? this.timeoutMs,\n\t\t);\n\t\ttry {\n\t\t\tconst request: RequestInit = {\n\t\t\t\tmethod,\n\t\t\t\theaders,\n\t\t\t\tsignal: controller.signal,\n\t\t\t};\n\t\t\tif (options.body instanceof FormData) {\n\t\t\t\trequest.body = options.body;\n\t\t\t} else if (options.body !== undefined) {\n\t\t\t\trequest.body = JSON.stringify(options.body);\n\t\t\t}\n\n\t\t\tconst response = await this.fetchImpl(url.toString(), request);\n\t\t\tconst responseHeaders = headersToObject(response.headers);\n\t\t\tconst text = await response.text();\n\t\t\tconst parsed = parseJson(text);\n\t\t\tif (!response.ok) {\n\t\t\t\tconst body =\n\t\t\t\t\tparsed && typeof parsed === \"object\"\n\t\t\t\t\t\t? (parsed as Record<string, unknown>)\n\t\t\t\t\t\t: {};\n\t\t\t\tconst message =\n\t\t\t\t\tstringValue(body.detail) ??\n\t\t\t\t\tstringValue(body.error) ??\n\t\t\t\t\tstringValue(body.message) ??\n\t\t\t\t\tresponse.statusText;\n\t\t\t\tconst code =\n\t\t\t\t\tstringValue(body.code) ??\n\t\t\t\t\tstringValue(body.error_code) ??\n\t\t\t\t\t`http_${response.status}`;\n\t\t\t\tconst currentRevision = numberValue(body.current_revision);\n\t\t\t\treturn createErrorResult<T>(code, message, response.status, {\n\t\t\t\t\tdetail: body,\n\t\t\t\t\tparam: stringValue(body.param),\n\t\t\t\t\t...(currentRevision !== undefined ? { currentRevision } : {}),\n\t\t\t\t\trequestId: responseHeaders[\"x-request-id\"] ?? null,\n\t\t\t\t\theaders: responseHeaders,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: toCamelCase(parsed) as T,\n\t\t\t\terror: null,\n\t\t\t\theaders: responseHeaders,\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"Request timed out\"\n\t\t\t\t\t: error instanceof Error\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: \"Network error\";\n\t\t\treturn createErrorResult<T>(\n\t\t\t\terror instanceof Error && error.name === \"AbortError\"\n\t\t\t\t\t? \"timeout\"\n\t\t\t\t\t: \"network_error\",\n\t\t\t\tmessage,\n\t\t\t\tnull,\n\t\t\t);\n\t\t} finally {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n}\n\nfunction headersToObject(headers: Headers): Record<string, string> {\n\tconst result: Record<string, string> = {};\n\theaders.forEach((value, key) => {\n\t\tresult[key.toLowerCase()] = value;\n\t});\n\treturn result;\n}\n\nfunction parseJson(text: string): unknown {\n\tif (!text) return null;\n\ttry {\n\t\treturn JSON.parse(text);\n\t} catch {\n\t\treturn text;\n\t}\n}\n\nfunction stringValue(value: unknown): string | null {\n\treturn typeof value === \"string\" ? value : null;\n}\n\nfunction numberValue(value: unknown): number | undefined {\n\treturn typeof value === \"number\" ? value : undefined;\n}\n","import type { PreparedPublishRequest } from \"./publish/prepare.js\";\nimport { preparePublishRequest } from \"./publish/prepare.js\";\nimport { publishStaged } from \"./publish/upload.js\";\nimport { AccountResource } from \"./resources/account.js\";\nimport { ApiKeysResource } from \"./resources/api-keys.js\";\nimport { AuthResource } from \"./resources/auth.js\";\nimport { DeploymentsResource } from \"./resources/deployments.js\";\nimport { DropsResource } from \"./resources/drops.js\";\nimport { UploadsResource } from \"./resources/uploads.js\";\nimport { Transport } from \"./transport.js\";\nimport type {\n\tDropResponse,\n\tDropthisClientOptions,\n\tDropthisResult,\n\tPublishInput,\n\tPublishOptions,\n\tRequestOptions,\n} from \"./types.js\";\n\nexport class Dropthis {\n\tprivate readonly transport: Transport;\n\tprivate authResource?: AuthResource;\n\tprivate apiKeysResource?: ApiKeysResource;\n\tprivate accountResource?: AccountResource;\n\tprivate dropsResource?: DropsResource;\n\tprivate deploymentsResource?: DeploymentsResource;\n\tprivate uploadsResource?: UploadsResource;\n\n\tconstructor(options: DropthisClientOptions | string = {}) {\n\t\tthis.transport = new Transport(options);\n\t}\n\n\tget auth(): AuthResource {\n\t\tif (!this.authResource)\n\t\t\tthis.authResource = new AuthResource(this.transport);\n\t\treturn this.authResource;\n\t}\n\n\tget apiKeys(): ApiKeysResource {\n\t\tif (!this.apiKeysResource)\n\t\t\tthis.apiKeysResource = new ApiKeysResource(this.transport);\n\t\treturn this.apiKeysResource;\n\t}\n\n\tget account(): AccountResource {\n\t\tif (!this.accountResource)\n\t\t\tthis.accountResource = new AccountResource(this.transport);\n\t\treturn this.accountResource;\n\t}\n\n\tget drops(): DropsResource {\n\t\tif (!this.dropsResource)\n\t\t\tthis.dropsResource = new DropsResource(this.transport);\n\t\treturn this.dropsResource;\n\t}\n\n\tget deployments(): DeploymentsResource {\n\t\tif (!this.deploymentsResource)\n\t\t\tthis.deploymentsResource = new DeploymentsResource(this.transport);\n\t\treturn this.deploymentsResource;\n\t}\n\n\tget uploads(): UploadsResource {\n\t\tif (!this.uploadsResource)\n\t\t\tthis.uploadsResource = new UploadsResource(this.transport);\n\t\treturn this.uploadsResource;\n\t}\n\n\tasync prepare(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<PreparedPublishRequest> {\n\t\treturn preparePublishRequest(input, options);\n\t}\n\n\tasync publish(\n\t\tinput: PublishInput,\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tconst prepared = await preparePublishRequest(input, options);\n\t\treturn publishStaged(this.transport, prepared, \"/drops\", options);\n\t}\n\n\tasync update(\n\t\tdropId: string,\n\t\tinputOrOptions: PublishInput | PublishOptions = {},\n\t\toptions: PublishOptions = {},\n\t): Promise<DropthisResult<DropResponse>> {\n\t\tif (looksLikeOptionsOnly(inputOrOptions)) {\n\t\t\treturn this.drops.update(dropId, inputOrOptions, options);\n\t\t}\n\n\t\tconst prepared = await preparePublishRequest(\n\t\t\tinputOrOptions as PublishInput,\n\t\t\toptions,\n\t\t);\n\t\tconst path = `/drops/${encodeURIComponent(dropId)}/deployments`;\n\t\treturn publishStaged(this.transport, prepared, path, options);\n\t}\n\n\trequest<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions & {\n\t\t\tbody?: unknown;\n\t\t\tparams?: Record<string, string | number | boolean | null | undefined>;\n\t\t} = {},\n\t): Promise<DropthisResult<T>> {\n\t\treturn this.transport.request<T>(method, path, options);\n\t}\n\n\trequestSignedUpload(\n\t\turl: string,\n\t\tbytes: Uint8Array | Blob | ReadableStream,\n\t\theaders: Record<string, string>,\n\t): Promise<DropthisResult<{ etag: string | null }>> {\n\t\treturn this.transport.putSignedUrl(url, bytes, headers);\n\t}\n}\n\nfunction looksLikeOptionsOnly(\n\tinput: PublishInput | PublishOptions,\n): input is PublishOptions {\n\tif (input instanceof Uint8Array) return false;\n\tif (typeof input !== \"object\" || input === null) return false;\n\treturn !(\"content\" in input || \"files\" in input);\n}\n"],"mappings":";AAAA,SAAS,QAAAA,aAAY;AACrB,SAAS,YAAAC,iBAAgB;;;ACDlB,SAAS,WAAW,KAAqB;AAC/C,SAAO,IAAI,QAAQ,aAAa,CAAC,GAAG,SAAiB,KAAK,YAAY,CAAC;AACxE;AAEO,SAAS,WAAW,KAAqB;AAC/C,SAAO,IAAI,QAAQ,UAAU,CAAC,SAAS,IAAI,KAAK,YAAY,CAAC,EAAE;AAChE;AAEO,SAAS,YAAY,OAAyB;AACpD,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,WAAW;AACtD,MAAI,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM;AAAA,QAC1C,WAAW,GAAG;AAAA,QACd,YAAY,IAAI;AAAA,MACjB,CAAC;AAAA,IACF;AAAA,EACD;AACA,SAAO;AACR;AAEO,SAAS,YAAY,OAAyB;AACpD,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO,MAAM,IAAI,WAAW;AACtD,MAAI,SAAS,OAAO,UAAU,UAAU;AACvC,WAAO,OAAO;AAAA,MACb,OAAO,QAAQ,KAAK,EAClB,OAAO,CAAC,CAAC,EAAE,IAAI,MAAM,SAAS,MAAS,EACvC,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,WAAW,GAAG,GAAG,YAAY,IAAI,CAAC,CAAC;AAAA,IAC5D;AAAA,EACD;AACA,SAAO;AACR;;;AC/BA,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AAE1B,SAAS,YAAY,OAA2B;AACtD,SAAO,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AACvD;AAEA,eAAsB,WAAW,MAA+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AAW,QAAQ,MAAM,OAAO;AAAA,EACvD;AAAA,EAEA,oBACC,KACA,OACA,SACmD;AACnD,WAAO,KAAK,UAAU,aAAa,KAAK,OAAO,OAAO;AAAA,EACvD;AACD;AAEA,SAAS,qBACR,OAC0B;AAC1B,MAAI,iBAAiB,WAAY,QAAO;AACxC,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,SAAO,EAAE,aAAa,SAAS,WAAW;AAC3C;","names":["stat","basename","stat","basename","readFile","readFile"]}
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@dropthis/node",
3
+ "version": "0.1.0",
4
+ "description": "Official Node.js SDK for Dropthis.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/dropthis-dev/dropthis-node"
9
+ },
10
+ "type": "module",
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.mjs",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.mjs"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.cts",
22
+ "default": "./dist/index.cjs"
23
+ }
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "engines": {
31
+ "node": ">=20"
32
+ },
33
+ "scripts": {
34
+ "build": "tsup",
35
+ "dev": "vitest",
36
+ "format": "biome format --vcs-enabled=true --vcs-client-kind=git --vcs-use-ignore-file=true --write .",
37
+ "lint": "biome check --vcs-enabled=true --vcs-client-kind=git --vcs-use-ignore-file=true .",
38
+ "typecheck": "tsc --noEmit",
39
+ "test": "vitest run",
40
+ "pack:dry": "npm pack --dry-run"
41
+ },
42
+ "dependencies": {
43
+ "fast-glob": "3.3.3",
44
+ "ignore": "7.0.5",
45
+ "mime-types": "3.0.1"
46
+ },
47
+ "devDependencies": {
48
+ "@biomejs/biome": "2.4.11",
49
+ "@types/mime-types": "3.0.1",
50
+ "@types/node": "24.0.0",
51
+ "tsup": "8.5.1",
52
+ "typescript": "5.9.3",
53
+ "vitest": "4.1.7"
54
+ }
55
+ }
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Denis Malinochkin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,171 @@
1
+ # @nodelib/fs.scandir
2
+
3
+ > List files and directories inside the specified directory.
4
+
5
+ ## :bulb: Highlights
6
+
7
+ The package is aimed at obtaining information about entries in the directory.
8
+
9
+ * :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
10
+ * :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode).
11
+ * :link: Can safely work with broken symbolic links.
12
+
13
+ ## Install
14
+
15
+ ```console
16
+ npm install @nodelib/fs.scandir
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ import * as fsScandir from '@nodelib/fs.scandir';
23
+
24
+ fsScandir.scandir('path', (error, stats) => { /* … */ });
25
+ ```
26
+
27
+ ## API
28
+
29
+ ### .scandir(path, [optionsOrSettings], callback)
30
+
31
+ Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style.
32
+
33
+ ```ts
34
+ fsScandir.scandir('path', (error, entries) => { /* … */ });
35
+ fsScandir.scandir('path', {}, (error, entries) => { /* … */ });
36
+ fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ });
37
+ ```
38
+
39
+ ### .scandirSync(path, [optionsOrSettings])
40
+
41
+ Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path.
42
+
43
+ ```ts
44
+ const entries = fsScandir.scandirSync('path');
45
+ const entries = fsScandir.scandirSync('path', {});
46
+ const entries = fsScandir.scandirSync(('path', new fsScandir.Settings());
47
+ ```
48
+
49
+ #### path
50
+
51
+ * Required: `true`
52
+ * Type: `string | Buffer | URL`
53
+
54
+ A path to a file. If a URL is provided, it must use the `file:` protocol.
55
+
56
+ #### optionsOrSettings
57
+
58
+ * Required: `false`
59
+ * Type: `Options | Settings`
60
+ * Default: An instance of `Settings` class
61
+
62
+ An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class.
63
+
64
+ > :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
65
+
66
+ ### Settings([options])
67
+
68
+ A class of full settings of the package.
69
+
70
+ ```ts
71
+ const settings = new fsScandir.Settings({ followSymbolicLinks: false });
72
+
73
+ const entries = fsScandir.scandirSync('path', settings);
74
+ ```
75
+
76
+ ## Entry
77
+
78
+ * `name` — The name of the entry (`unknown.txt`).
79
+ * `path` — The path of the entry relative to call directory (`root/unknown.txt`).
80
+ * `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class.
81
+ * `stats` (optional) — An instance of `fs.Stats` class.
82
+
83
+ For example, the `scandir` call for `tools` directory with one directory inside:
84
+
85
+ ```ts
86
+ {
87
+ dirent: Dirent { name: 'typedoc', /* … */ },
88
+ name: 'typedoc',
89
+ path: 'tools/typedoc'
90
+ }
91
+ ```
92
+
93
+ ## Options
94
+
95
+ ### stats
96
+
97
+ * Type: `boolean`
98
+ * Default: `false`
99
+
100
+ Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
101
+
102
+ > :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO??
103
+
104
+ ### followSymbolicLinks
105
+
106
+ * Type: `boolean`
107
+ * Default: `false`
108
+
109
+ Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
110
+
111
+ ### `throwErrorOnBrokenSymbolicLink`
112
+
113
+ * Type: `boolean`
114
+ * Default: `true`
115
+
116
+ Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`.
117
+
118
+ ### `pathSegmentSeparator`
119
+
120
+ * Type: `string`
121
+ * Default: `path.sep`
122
+
123
+ By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
124
+
125
+ ### `fs`
126
+
127
+ * Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
128
+ * Default: A default FS methods
129
+
130
+ By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
131
+
132
+ ```ts
133
+ interface FileSystemAdapter {
134
+ lstat?: typeof fs.lstat;
135
+ stat?: typeof fs.stat;
136
+ lstatSync?: typeof fs.lstatSync;
137
+ statSync?: typeof fs.statSync;
138
+ readdir?: typeof fs.readdir;
139
+ readdirSync?: typeof fs.readdirSync;
140
+ }
141
+
142
+ const settings = new fsScandir.Settings({
143
+ fs: { lstat: fakeLstat }
144
+ });
145
+ ```
146
+
147
+ ## `old` and `modern` mode
148
+
149
+ This package has two modes that are used depending on the environment and parameters of use.
150
+
151
+ ### old
152
+
153
+ * Node.js below `10.10` or when the `stats` option is enabled
154
+
155
+ When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links).
156
+
157
+ ### modern
158
+
159
+ * Node.js 10.10+ and the `stats` option is disabled
160
+
161
+ In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present.
162
+
163
+ This mode makes fewer calls to the file system. It's faster.
164
+
165
+ ## Changelog
166
+
167
+ See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
168
+
169
+ ## License
170
+
171
+ This software is released under the terms of the MIT license.
@@ -0,0 +1,20 @@
1
+ import type * as fsStat from '@nodelib/fs.stat';
2
+ import type { Dirent, ErrnoException } from '../types';
3
+ export interface ReaddirAsynchronousMethod {
4
+ (filepath: string, options: {
5
+ withFileTypes: true;
6
+ }, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
7
+ (filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
8
+ }
9
+ export interface ReaddirSynchronousMethod {
10
+ (filepath: string, options: {
11
+ withFileTypes: true;
12
+ }): Dirent[];
13
+ (filepath: string): string[];
14
+ }
15
+ export declare type FileSystemAdapter = fsStat.FileSystemAdapter & {
16
+ readdir: ReaddirAsynchronousMethod;
17
+ readdirSync: ReaddirSynchronousMethod;
18
+ };
19
+ export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
20
+ export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
4
+ const fs = require("fs");
5
+ exports.FILE_SYSTEM_ADAPTER = {
6
+ lstat: fs.lstat,
7
+ stat: fs.stat,
8
+ lstatSync: fs.lstatSync,
9
+ statSync: fs.statSync,
10
+ readdir: fs.readdir,
11
+ readdirSync: fs.readdirSync
12
+ };
13
+ function createFileSystemAdapter(fsMethods) {
14
+ if (fsMethods === undefined) {
15
+ return exports.FILE_SYSTEM_ADAPTER;
16
+ }
17
+ return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
18
+ }
19
+ exports.createFileSystemAdapter = createFileSystemAdapter;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * IS `true` for Node.js 10.10 and greater.
3
+ */
4
+ export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
4
+ const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
5
+ if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
6
+ throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
7
+ }
8
+ const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
9
+ const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
10
+ const SUPPORTED_MAJOR_VERSION = 10;
11
+ const SUPPORTED_MINOR_VERSION = 10;
12
+ const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
13
+ const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
14
+ /**
15
+ * IS `true` for Node.js 10.10 and greater.
16
+ */
17
+ exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
@@ -0,0 +1,12 @@
1
+ import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs';
2
+ import * as async from './providers/async';
3
+ import Settings, { Options } from './settings';
4
+ import type { Dirent, Entry } from './types';
5
+ declare type AsyncCallback = async.AsyncCallback;
6
+ declare function scandir(path: string, callback: AsyncCallback): void;
7
+ declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
8
+ declare namespace scandir {
9
+ function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
10
+ }
11
+ declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[];
12
+ export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Settings = exports.scandirSync = exports.scandir = void 0;
4
+ const async = require("./providers/async");
5
+ const sync = require("./providers/sync");
6
+ const settings_1 = require("./settings");
7
+ exports.Settings = settings_1.default;
8
+ function scandir(path, optionsOrSettingsOrCallback, callback) {
9
+ if (typeof optionsOrSettingsOrCallback === 'function') {
10
+ async.read(path, getSettings(), optionsOrSettingsOrCallback);
11
+ return;
12
+ }
13
+ async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
14
+ }
15
+ exports.scandir = scandir;
16
+ function scandirSync(path, optionsOrSettings) {
17
+ const settings = getSettings(optionsOrSettings);
18
+ return sync.read(path, settings);
19
+ }
20
+ exports.scandirSync = scandirSync;
21
+ function getSettings(settingsOrOptions = {}) {
22
+ if (settingsOrOptions instanceof settings_1.default) {
23
+ return settingsOrOptions;
24
+ }
25
+ return new settings_1.default(settingsOrOptions);
26
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+ import type Settings from '../settings';
3
+ import type { Entry } from '../types';
4
+ export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void;
5
+ export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void;
6
+ export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void;
7
+ export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
4
+ const fsStat = require("@nodelib/fs.stat");
5
+ const rpl = require("run-parallel");
6
+ const constants_1 = require("../constants");
7
+ const utils = require("../utils");
8
+ const common = require("./common");
9
+ function read(directory, settings, callback) {
10
+ if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
11
+ readdirWithFileTypes(directory, settings, callback);
12
+ return;
13
+ }
14
+ readdir(directory, settings, callback);
15
+ }
16
+ exports.read = read;
17
+ function readdirWithFileTypes(directory, settings, callback) {
18
+ settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
19
+ if (readdirError !== null) {
20
+ callFailureCallback(callback, readdirError);
21
+ return;
22
+ }
23
+ const entries = dirents.map((dirent) => ({
24
+ dirent,
25
+ name: dirent.name,
26
+ path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
27
+ }));
28
+ if (!settings.followSymbolicLinks) {
29
+ callSuccessCallback(callback, entries);
30
+ return;
31
+ }
32
+ const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
33
+ rpl(tasks, (rplError, rplEntries) => {
34
+ if (rplError !== null) {
35
+ callFailureCallback(callback, rplError);
36
+ return;
37
+ }
38
+ callSuccessCallback(callback, rplEntries);
39
+ });
40
+ });
41
+ }
42
+ exports.readdirWithFileTypes = readdirWithFileTypes;
43
+ function makeRplTaskEntry(entry, settings) {
44
+ return (done) => {
45
+ if (!entry.dirent.isSymbolicLink()) {
46
+ done(null, entry);
47
+ return;
48
+ }
49
+ settings.fs.stat(entry.path, (statError, stats) => {
50
+ if (statError !== null) {
51
+ if (settings.throwErrorOnBrokenSymbolicLink) {
52
+ done(statError);
53
+ return;
54
+ }
55
+ done(null, entry);
56
+ return;
57
+ }
58
+ entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
59
+ done(null, entry);
60
+ });
61
+ };
62
+ }
63
+ function readdir(directory, settings, callback) {
64
+ settings.fs.readdir(directory, (readdirError, names) => {
65
+ if (readdirError !== null) {
66
+ callFailureCallback(callback, readdirError);
67
+ return;
68
+ }
69
+ const tasks = names.map((name) => {
70
+ const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
71
+ return (done) => {
72
+ fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
73
+ if (error !== null) {
74
+ done(error);
75
+ return;
76
+ }
77
+ const entry = {
78
+ name,
79
+ path,
80
+ dirent: utils.fs.createDirentFromStats(name, stats)
81
+ };
82
+ if (settings.stats) {
83
+ entry.stats = stats;
84
+ }
85
+ done(null, entry);
86
+ });
87
+ };
88
+ });
89
+ rpl(tasks, (rplError, entries) => {
90
+ if (rplError !== null) {
91
+ callFailureCallback(callback, rplError);
92
+ return;
93
+ }
94
+ callSuccessCallback(callback, entries);
95
+ });
96
+ });
97
+ }
98
+ exports.readdir = readdir;
99
+ function callFailureCallback(callback, error) {
100
+ callback(error);
101
+ }
102
+ function callSuccessCallback(callback, result) {
103
+ callback(null, result);
104
+ }
@@ -0,0 +1 @@
1
+ export declare function joinPathSegments(a: string, b: string, separator: string): string;