@payloadcms/figma 0.1.0-internal.e071575 → 1.0.0-beta.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.
Files changed (350) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/{utils → adapters}/asset-collection.d.ts +17 -3
  3. package/dist/adapters/asset-collection.js +242 -0
  4. package/dist/{utils → adapters}/build-lambda-zip.d.ts +8 -7
  5. package/dist/adapters/build-lambda-zip.js +111 -0
  6. package/dist/adapters/configureNextjsCache.d.ts +8 -0
  7. package/dist/adapters/configureNextjsCache.js +55 -0
  8. package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
  9. package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
  10. package/dist/adapters/deploy-output/inspectNextjsOutput.d.ts +12 -0
  11. package/dist/adapters/deploy-output/inspectNextjsOutput.js +28 -0
  12. package/dist/adapters/deploy-output/inspectNitroOutput.d.ts +9 -0
  13. package/dist/adapters/deploy-output/inspectNitroOutput.js +13 -0
  14. package/dist/adapters/deploy-output/isFile.d.ts +1 -0
  15. package/dist/adapters/deploy-output/isFile.js +4 -0
  16. package/dist/adapters/deploy-output/readJson.d.ts +1 -0
  17. package/dist/adapters/deploy-output/readJson.js +9 -0
  18. package/dist/adapters/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
  19. package/dist/adapters/deploy-output/resolveNitroOutputLayout.js +16 -0
  20. package/dist/adapters/deploy-output/resolveOutputPath.d.ts +2 -0
  21. package/dist/adapters/deploy-output/resolveOutputPath.js +9 -0
  22. package/dist/adapters/deploy-output/resolveWithin.d.ts +1 -0
  23. package/dist/adapters/deploy-output/resolveWithin.js +12 -0
  24. package/dist/adapters/fs-utils.d.ts +39 -0
  25. package/dist/adapters/fs-utils.js +135 -0
  26. package/dist/adapters/index.d.ts +4 -0
  27. package/dist/adapters/index.js +3 -0
  28. package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
  29. package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
  30. package/dist/adapters/nextjs.d.ts +12 -0
  31. package/dist/adapters/nextjs.js +67 -0
  32. package/dist/adapters/nitro.d.ts +8 -0
  33. package/dist/adapters/nitro.js +193 -0
  34. package/dist/adapters/secret-files.d.ts +25 -0
  35. package/dist/adapters/secret-files.js +50 -0
  36. package/dist/adapters/types.d.ts +42 -0
  37. package/dist/adapters/types.js +1 -0
  38. package/dist/{utils/adapters → adapters}/vite.d.ts +2 -2
  39. package/dist/adapters/vite.js +33 -0
  40. package/dist/api/check-project-subdomain-availability.d.ts +12 -0
  41. package/dist/api/check-project-subdomain-availability.js +32 -0
  42. package/dist/api/control-plane-error.d.ts +6 -0
  43. package/dist/api/control-plane-error.js +8 -0
  44. package/dist/api/control-plane-fetch.d.ts +7 -0
  45. package/dist/api/control-plane-fetch.js +37 -0
  46. package/dist/api/control-plane.d.ts +12 -9
  47. package/dist/api/control-plane.js +28 -48
  48. package/dist/api/create-project.d.ts +18 -0
  49. package/dist/api/create-project.js +37 -0
  50. package/dist/api/list-project-workspaces.d.ts +8 -0
  51. package/dist/api/list-project-workspaces.js +28 -0
  52. package/dist/api/project-resource-type.d.ts +1 -0
  53. package/dist/api/project-resource-type.js +1 -0
  54. package/dist/auth/headless-oauth-flow.d.ts +23 -0
  55. package/dist/auth/headless-oauth-flow.js +73 -0
  56. package/dist/auth/oauth-flow.d.ts +2 -0
  57. package/dist/auth/oauth-flow.js +30 -8
  58. package/dist/auth/refresh.js +12 -12
  59. package/dist/auth/requested-scopes.d.ts +1 -0
  60. package/dist/auth/requested-scopes.js +3 -0
  61. package/dist/auth/token-store.d.ts +20 -1
  62. package/dist/auth/token-store.js +47 -0
  63. package/dist/auth/types.d.ts +17 -3
  64. package/dist/cli.d.ts +39 -0
  65. package/dist/cli.js +71 -36
  66. package/dist/commands/bootstrap.js +5 -1
  67. package/dist/commands/build-lambda-zip.js +1 -1
  68. package/dist/commands/deploy.d.ts +12 -0
  69. package/dist/commands/deploy.js +63 -25
  70. package/dist/commands/detect-project-resource-type.d.ts +3 -0
  71. package/dist/commands/detect-project-resource-type.js +28 -0
  72. package/dist/commands/init.d.ts +2 -2
  73. package/dist/commands/init.js +235 -80
  74. package/dist/commands/login.d.ts +11 -1
  75. package/dist/commands/login.js +66 -4
  76. package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
  77. package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
  78. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
  79. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
  80. package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
  81. package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
  82. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
  83. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
  84. package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
  85. package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
  86. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
  87. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
  88. package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
  89. package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
  90. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
  91. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
  92. package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
  93. package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
  94. package/dist/commands/prompt-to-create-project.d.ts +24 -0
  95. package/dist/commands/prompt-to-create-project.js +69 -0
  96. package/dist/commands/setup-agent.d.ts +12 -0
  97. package/dist/commands/setup-agent.js +123 -0
  98. package/dist/commands/upgrade.js +65 -1
  99. package/dist/commands/upload-schema.js +3 -4
  100. package/dist/commands/write-project-configuration.d.ts +12 -0
  101. package/dist/commands/write-project-configuration.js +16 -0
  102. package/dist/config/oauth.js +6 -1
  103. package/dist/constants.d.ts +0 -2
  104. package/dist/constants.js +0 -3
  105. package/dist/db-content-api/generated/content-api-types.d.ts +6 -2
  106. package/dist/db-content-api/index.d.ts +1 -1
  107. package/dist/db-content-api/index.js +121 -72
  108. package/dist/db-content-api/utilities/data/index.js +8 -2
  109. package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
  110. package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
  111. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
  112. package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
  113. package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
  114. package/dist/db-content-api/utilities/isRecord.js +19 -0
  115. package/dist/db-content-api/utilities/joins.js +5 -1
  116. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
  117. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
  118. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
  119. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
  120. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +9 -4
  121. package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
  122. package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
  123. package/dist/db-content-api/utilities/where.d.ts +2 -6
  124. package/dist/db-content-api/utilities/where.js +20 -9
  125. package/dist/exports/client.d.ts +2 -0
  126. package/dist/exports/client.js +2 -0
  127. package/dist/exports/views.d.ts +1 -0
  128. package/dist/exports/views.js +1 -0
  129. package/dist/imageSizeOptions.d.ts +23 -0
  130. package/dist/imageSizeOptions.js +26 -0
  131. package/dist/index.d.ts +2 -0
  132. package/dist/index.js +2 -0
  133. package/dist/lib/write-agent-config.d.ts +12 -0
  134. package/dist/lib/write-agent-config.js +52 -0
  135. package/dist/next/image-loader.d.ts +6 -0
  136. package/dist/next/image-loader.js +14 -0
  137. package/dist/oauth/components/LoginButton/index.js +66 -19
  138. package/dist/oauth/components/LoginButton/index.scss +121 -15
  139. package/dist/oauth/defaults.js +4 -1
  140. package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
  141. package/dist/oauth/index.js +8 -7
  142. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
  143. package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
  144. package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
  145. package/dist/plugin/build-config.d.ts +13 -3
  146. package/dist/plugin/build-config.js +250 -49
  147. package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
  148. package/dist/plugin/cache-revalidation-hooks.js +69 -0
  149. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +9 -0
  150. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
  151. package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
  152. package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
  153. package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
  154. package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
  155. package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
  156. package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
  157. package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
  158. package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
  159. package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
  160. package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
  161. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +3 -0
  162. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
  163. package/dist/plugin/cloud-limits/routes.d.ts +2 -0
  164. package/dist/plugin/cloud-limits/routes.js +4 -0
  165. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
  166. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
  167. package/dist/plugin/cloud-limits/shared.d.ts +10 -0
  168. package/dist/plugin/cloud-limits/shared.js +52 -0
  169. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
  170. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
  171. package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
  172. package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
  173. package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
  174. package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
  175. package/dist/plugin/sandbox-upload-fetch.d.ts +22 -20
  176. package/dist/plugin/sandbox-upload-fetch.js +15 -21
  177. package/dist/skills/deploy-to-figma/SKILL.md +234 -0
  178. package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
  179. package/dist/storage-content-api/api-types.d.ts +5 -2
  180. package/dist/storage-content-api/buildBaseMediaResponseHeaders.d.ts +1 -0
  181. package/dist/storage-content-api/buildBaseMediaResponseHeaders.js +8 -0
  182. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.d.ts +12 -0
  183. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.js +26 -0
  184. package/dist/storage-content-api/buildMediaRequestHeaders.d.ts +1 -0
  185. package/dist/storage-content-api/buildMediaRequestHeaders.js +14 -0
  186. package/dist/storage-content-api/buildMediaResponseHeaders.d.ts +4 -0
  187. package/dist/storage-content-api/buildMediaResponseHeaders.js +52 -0
  188. package/dist/storage-content-api/client-uploads/generate.d.ts +7 -3
  189. package/dist/storage-content-api/client-uploads/generate.js +22 -21
  190. package/dist/storage-content-api/copyFile.d.ts +16 -0
  191. package/dist/storage-content-api/copyFile.js +90 -0
  192. package/dist/storage-content-api/deleteFile.d.ts +8 -0
  193. package/dist/storage-content-api/deleteFile.js +18 -0
  194. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
  195. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +33 -0
  196. package/dist/storage-content-api/getMediaType.d.ts +1 -0
  197. package/dist/storage-content-api/getMediaType.js +3 -0
  198. package/dist/storage-content-api/handleUpload.d.ts +1 -2
  199. package/dist/storage-content-api/handleUpload.js +13 -157
  200. package/dist/storage-content-api/hasSupportedContentEncoding.d.ts +1 -0
  201. package/dist/storage-content-api/hasSupportedContentEncoding.js +6 -0
  202. package/dist/storage-content-api/index.js +17 -8
  203. package/dist/storage-content-api/mediaErrorResponse.d.ts +1 -0
  204. package/dist/storage-content-api/mediaErrorResponse.js +12 -0
  205. package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
  206. package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
  207. package/dist/storage-content-api/shouldAttachMedia.d.ts +1 -0
  208. package/dist/storage-content-api/shouldAttachMedia.js +34 -0
  209. package/dist/storage-content-api/staticHandler.d.ts +2 -1
  210. package/dist/storage-content-api/staticHandler.js +87 -32
  211. package/dist/storage-content-api/types.d.ts +4 -1
  212. package/dist/storage-content-api/uploadFileData.d.ts +10 -0
  213. package/dist/storage-content-api/uploadFileData.js +145 -0
  214. package/dist/translations/ar.d.ts +12 -0
  215. package/dist/translations/ar.js +12 -0
  216. package/dist/translations/az.d.ts +12 -0
  217. package/dist/translations/az.js +12 -0
  218. package/dist/translations/bg.d.ts +12 -0
  219. package/dist/translations/bg.js +12 -0
  220. package/dist/translations/bnBd.d.ts +12 -0
  221. package/dist/translations/bnBd.js +12 -0
  222. package/dist/translations/bnIn.d.ts +12 -0
  223. package/dist/translations/bnIn.js +12 -0
  224. package/dist/translations/ca.d.ts +12 -0
  225. package/dist/translations/ca.js +12 -0
  226. package/dist/translations/cs.d.ts +12 -0
  227. package/dist/translations/cs.js +12 -0
  228. package/dist/translations/da.d.ts +12 -0
  229. package/dist/translations/da.js +12 -0
  230. package/dist/translations/de.d.ts +12 -0
  231. package/dist/translations/de.js +12 -0
  232. package/dist/translations/en.d.ts +12 -0
  233. package/dist/translations/en.js +12 -0
  234. package/dist/translations/es.d.ts +12 -0
  235. package/dist/translations/es.js +12 -0
  236. package/dist/translations/et.d.ts +12 -0
  237. package/dist/translations/et.js +12 -0
  238. package/dist/translations/fa.d.ts +12 -0
  239. package/dist/translations/fa.js +12 -0
  240. package/dist/translations/fr.d.ts +12 -0
  241. package/dist/translations/fr.js +12 -0
  242. package/dist/translations/he.d.ts +12 -0
  243. package/dist/translations/he.js +12 -0
  244. package/dist/translations/hr.d.ts +12 -0
  245. package/dist/translations/hr.js +12 -0
  246. package/dist/translations/hu.d.ts +12 -0
  247. package/dist/translations/hu.js +12 -0
  248. package/dist/translations/hy.d.ts +12 -0
  249. package/dist/translations/hy.js +12 -0
  250. package/dist/translations/id.d.ts +12 -0
  251. package/dist/translations/id.js +12 -0
  252. package/dist/translations/index.d.ts +533 -0
  253. package/dist/translations/index.js +90 -0
  254. package/dist/translations/is.d.ts +12 -0
  255. package/dist/translations/is.js +12 -0
  256. package/dist/translations/it.d.ts +12 -0
  257. package/dist/translations/it.js +12 -0
  258. package/dist/translations/ja.d.ts +12 -0
  259. package/dist/translations/ja.js +12 -0
  260. package/dist/translations/ko.d.ts +12 -0
  261. package/dist/translations/ko.js +12 -0
  262. package/dist/translations/lt.d.ts +12 -0
  263. package/dist/translations/lt.js +12 -0
  264. package/dist/translations/lv.d.ts +12 -0
  265. package/dist/translations/lv.js +12 -0
  266. package/dist/translations/my.d.ts +12 -0
  267. package/dist/translations/my.js +12 -0
  268. package/dist/translations/nb.d.ts +12 -0
  269. package/dist/translations/nb.js +12 -0
  270. package/dist/translations/nl.d.ts +12 -0
  271. package/dist/translations/nl.js +12 -0
  272. package/dist/translations/pl.d.ts +12 -0
  273. package/dist/translations/pl.js +12 -0
  274. package/dist/translations/pt.d.ts +12 -0
  275. package/dist/translations/pt.js +12 -0
  276. package/dist/translations/ro.d.ts +12 -0
  277. package/dist/translations/ro.js +12 -0
  278. package/dist/translations/rs.d.ts +12 -0
  279. package/dist/translations/rs.js +12 -0
  280. package/dist/translations/rsLatin.d.ts +12 -0
  281. package/dist/translations/rsLatin.js +12 -0
  282. package/dist/translations/ru.d.ts +12 -0
  283. package/dist/translations/ru.js +12 -0
  284. package/dist/translations/sk.d.ts +12 -0
  285. package/dist/translations/sk.js +12 -0
  286. package/dist/translations/sl.d.ts +12 -0
  287. package/dist/translations/sl.js +12 -0
  288. package/dist/translations/sv.d.ts +12 -0
  289. package/dist/translations/sv.js +12 -0
  290. package/dist/translations/ta.d.ts +12 -0
  291. package/dist/translations/ta.js +12 -0
  292. package/dist/translations/th.d.ts +12 -0
  293. package/dist/translations/th.js +12 -0
  294. package/dist/translations/tr.d.ts +12 -0
  295. package/dist/translations/tr.js +12 -0
  296. package/dist/translations/uk.d.ts +12 -0
  297. package/dist/translations/uk.js +12 -0
  298. package/dist/translations/vi.d.ts +12 -0
  299. package/dist/translations/vi.js +12 -0
  300. package/dist/translations/zh.d.ts +12 -0
  301. package/dist/translations/zh.js +12 -0
  302. package/dist/translations/zhTw.d.ts +12 -0
  303. package/dist/translations/zhTw.js +12 -0
  304. package/dist/types.d.ts +11 -0
  305. package/dist/utils/assert-never.d.ts +1 -0
  306. package/dist/utils/assert-never.js +3 -0
  307. package/dist/utils/build-detection.d.ts +6 -1
  308. package/dist/utils/build-detection.js +68 -89
  309. package/dist/utils/cache-bootstrap.js +1 -0
  310. package/dist/utils/deploy-adapter.d.ts +3 -35
  311. package/dist/utils/deploy-adapter.js +25 -14
  312. package/dist/utils/env-management.d.ts +15 -0
  313. package/dist/utils/env-management.js +47 -0
  314. package/dist/utils/lambda-config.js +18 -23
  315. package/dist/utils/load-payload-config.js +1 -6
  316. package/dist/utils/messages.js +24 -3
  317. package/dist/utils/next-image-loader-config.d.ts +2 -0
  318. package/dist/utils/next-image-loader-config.js +63 -0
  319. package/dist/utils/next-image-loader-file.d.ts +2 -0
  320. package/dist/utils/next-image-loader-file.js +11 -0
  321. package/dist/utils/payload-config-ast.d.ts +5 -0
  322. package/dist/utils/payload-config-ast.js +73 -4
  323. package/dist/utils/payload-config-modifier.js +3 -0
  324. package/dist/utils/payload-generate.d.ts +10 -0
  325. package/dist/utils/payload-generate.js +59 -0
  326. package/dist/utils/payload-secret.d.ts +28 -0
  327. package/dist/utils/payload-secret.js +34 -0
  328. package/dist/utils/pnpm-builds.d.ts +14 -0
  329. package/dist/utils/pnpm-builds.js +125 -0
  330. package/dist/utils/s3-upload.js +4 -1
  331. package/package.json +32 -7
  332. package/dist/lib/download-skill.d.ts +0 -12
  333. package/dist/lib/download-skill.js +0 -77
  334. package/dist/storage-content-api/handleDelete.d.ts +0 -7
  335. package/dist/storage-content-api/handleDelete.js +0 -15
  336. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +0 -11
  337. package/dist/storage-content-api/utilities/getSafeFilename.js +0 -59
  338. package/dist/storage-content-api/utilities/index.d.ts +0 -2
  339. package/dist/storage-content-api/utilities/index.js +0 -2
  340. package/dist/storage-content-api/utilities/parseUploadReference.d.ts +0 -17
  341. package/dist/storage-content-api/utilities/parseUploadReference.js +0 -27
  342. package/dist/utils/adapters/nextjs.d.ts +0 -8
  343. package/dist/utils/adapters/nextjs.js +0 -61
  344. package/dist/utils/adapters/nitro.d.ts +0 -8
  345. package/dist/utils/adapters/nitro.js +0 -172
  346. package/dist/utils/adapters/vite.js +0 -31
  347. package/dist/utils/asset-collection.js +0 -144
  348. package/dist/utils/build-lambda-zip.js +0 -90
  349. package/dist/utils/fs-utils.d.ts +0 -12
  350. package/dist/utils/fs-utils.js +0 -55
@@ -1,77 +0,0 @@
1
- import fs from 'fs/promises';
2
- import { Readable } from 'node:stream';
3
- import { pipeline } from 'node:stream/promises';
4
- import path from 'path';
5
- import { x } from 'tar';
6
- export async function downloadSkill(args) {
7
- const { branch = 'main', debug, projectDir } = args;
8
- const destDir = path.join(projectDir, '.claude', 'skills', 'payload');
9
- if (await pathExists(path.join(destDir, 'SKILL.md'))) {
10
- return {
11
- ok: false,
12
- reason: 'already-installed'
13
- };
14
- }
15
- const url = `https://codeload.github.com/payloadcms/payload/tar.gz/${branch}`;
16
- const filter = `payload-${branch.replace(/^v/, '').replaceAll('/', '-')}/tools/claude-plugin/skills/payload/`;
17
- if (debug) {
18
- // eslint-disable-next-line no-console
19
- console.log(`[download-skill] url=${url} dest=${destDir}`);
20
- }
21
- try {
22
- const res = await fetch(url);
23
- if (!res.ok) {
24
- return {
25
- detail: `${res.status} ${res.statusText}`,
26
- ok: false,
27
- reason: 'fetch-failed'
28
- };
29
- }
30
- if (!res.body) {
31
- return {
32
- detail: 'empty response body',
33
- ok: false,
34
- reason: 'fetch-failed'
35
- };
36
- }
37
- await fs.mkdir(destDir, {
38
- recursive: true
39
- });
40
- await pipeline(Readable.from(res.body), x({
41
- cwd: destDir,
42
- filter: (p)=>p.includes(filter),
43
- strip: filter.split('/').length - 1
44
- }));
45
- if (!await pathExists(path.join(destDir, 'SKILL.md'))) {
46
- await fs.rm(destDir, {
47
- force: true,
48
- recursive: true
49
- });
50
- return {
51
- ok: false,
52
- reason: 'empty-extract'
53
- };
54
- }
55
- return {
56
- ok: true
57
- };
58
- } catch (err) {
59
- await fs.rm(destDir, {
60
- force: true,
61
- recursive: true
62
- }).catch(()=>{});
63
- return {
64
- detail: err instanceof Error ? err.message : String(err),
65
- ok: false,
66
- reason: 'error'
67
- };
68
- }
69
- }
70
- async function pathExists(p) {
71
- try {
72
- await fs.access(p);
73
- return true;
74
- } catch {
75
- return false;
76
- }
77
- }
@@ -1,7 +0,0 @@
1
- import type { HandleDelete } from '@payloadcms/plugin-cloud-storage/types';
2
- import type { StorageClient } from './client.js';
3
- type Args = {
4
- client: StorageClient;
5
- };
6
- export declare const getHandleDelete: ({ client }: Args) => HandleDelete;
7
- export {};
@@ -1,15 +0,0 @@
1
- import path from 'path';
2
- export const getHandleDelete = ({ client })=>{
3
- return async ({ collection, doc: { prefix = '' }, filename })=>{
4
- const collectionId = collection.slug;
5
- const fileKey = path.posix.join(prefix, filename);
6
- await client.DELETE('/api/v0/uploads/{collectionId}/{filename}', {
7
- params: {
8
- path: {
9
- collectionId,
10
- filename: fileKey
11
- }
12
- }
13
- });
14
- };
15
- };
@@ -1,11 +0,0 @@
1
- import type { PayloadRequest } from 'payload';
2
- /**
3
- * Get a safe filename that doesn't collide with existing documents
4
- * Similar to Payload's getSafeFileName
5
- */
6
- export declare function getSafeFilename({ collectionSlug, desiredFilename, prefix, req, }: {
7
- collectionSlug: string;
8
- desiredFilename: string;
9
- prefix?: string;
10
- req: PayloadRequest;
11
- }): Promise<string>;
@@ -1,59 +0,0 @@
1
- import sanitize from 'sanitize-filename';
2
- /**
3
- * Check if a document with the given filename already exists in the database
4
- * Matches Payload's docWithFilenameExists
5
- */ async function docWithFilenameExists({ collectionSlug, filename, prefix, req }) {
6
- const where = {
7
- filename: {
8
- equals: filename
9
- }
10
- };
11
- if (prefix) {
12
- where.prefix = {
13
- equals: prefix
14
- };
15
- }
16
- const doc = await req.payload.db.findOne({
17
- collection: collectionSlug,
18
- req,
19
- where
20
- });
21
- return !!doc;
22
- }
23
- /**
24
- * Increment filename by adding -1, -2, etc. suffix
25
- * photo.jpg → photo-1.jpg
26
- * photo-1.jpg → photo-2.jpg
27
- * Matches Payload's incrementName
28
- */ function incrementFilename(name) {
29
- const extension = name.split('.').pop();
30
- const baseFilename = sanitize(name.substring(0, name.lastIndexOf('.')) || name);
31
- let incrementedName = baseFilename;
32
- const regex = /(.*)-(\d+)$/;
33
- const found = baseFilename.match(regex);
34
- if (found === null) {
35
- incrementedName += '-1';
36
- } else {
37
- const matchedName = found[1];
38
- const matchedNumber = found[2];
39
- const incremented = Number(matchedNumber) + 1;
40
- incrementedName = `${matchedName}-${incremented}`;
41
- }
42
- return `${incrementedName}.${extension}`;
43
- }
44
- /**
45
- * Get a safe filename that doesn't collide with existing documents
46
- * Similar to Payload's getSafeFileName
47
- */ export async function getSafeFilename({ collectionSlug, desiredFilename, prefix, req }) {
48
- let modifiedFilename = desiredFilename;
49
- // Keep incrementing until we find a filename that doesn't exist
50
- while(await docWithFilenameExists({
51
- collectionSlug,
52
- filename: modifiedFilename,
53
- prefix,
54
- req
55
- })){
56
- modifiedFilename = incrementFilename(modifiedFilename);
57
- }
58
- return modifiedFilename;
59
- }
@@ -1,2 +0,0 @@
1
- export { getSafeFilename } from './getSafeFilename.js';
2
- export { type ContentApiUploadReference, parseUploadReference } from './parseUploadReference.js';
@@ -1,2 +0,0 @@
1
- export { getSafeFilename } from './getSafeFilename.js';
2
- export { parseUploadReference } from './parseUploadReference.js';
@@ -1,17 +0,0 @@
1
- /**
2
- * Shape of the `uploadReference` this adapter attaches to client-uploaded files
3
- * (via the `generate` upload-instructions handler). Payload exposes it as
4
- * `unknown`, so it must be narrowed at runtime before use.
5
- */
6
- export type ContentApiUploadReference = {
7
- clientUploaded?: boolean;
8
- filename?: string;
9
- mimeType?: string;
10
- prefix?: string;
11
- };
12
- /**
13
- * Safely narrows an `unknown` uploadReference into the adapter's known shape,
14
- * keeping only properties present with the expected type. Returns an empty
15
- * object for any non-object input.
16
- */
17
- export declare const parseUploadReference: (reference: unknown) => ContentApiUploadReference;
@@ -1,27 +0,0 @@
1
- /**
2
- * Shape of the `uploadReference` this adapter attaches to client-uploaded files
3
- * (via the `generate` upload-instructions handler). Payload exposes it as
4
- * `unknown`, so it must be narrowed at runtime before use.
5
- */ /**
6
- * Safely narrows an `unknown` uploadReference into the adapter's known shape,
7
- * keeping only properties present with the expected type. Returns an empty
8
- * object for any non-object input.
9
- */ export const parseUploadReference = (reference)=>{
10
- if (!reference || typeof reference !== 'object') {
11
- return {};
12
- }
13
- const result = {};
14
- if ('clientUploaded' in reference && typeof reference.clientUploaded === 'boolean') {
15
- result.clientUploaded = reference.clientUploaded;
16
- }
17
- if ('filename' in reference && typeof reference.filename === 'string') {
18
- result.filename = reference.filename;
19
- }
20
- if ('mimeType' in reference && typeof reference.mimeType === 'string') {
21
- result.mimeType = reference.mimeType;
22
- }
23
- if ('prefix' in reference && typeof reference.prefix === 'string') {
24
- result.prefix = reference.prefix;
25
- }
26
- return result;
27
- };
@@ -1,8 +0,0 @@
1
- import type { AssetCollection, DeployAdapter, LambdaBundle, PageCollection } from '../deploy-adapter.js';
2
- export declare class NextjsAdapter implements DeployAdapter {
3
- name: "nextjs";
4
- collectAssets(projectPath: string): Promise<AssetCollection>;
5
- collectPages(projectPath: string): Promise<PageCollection>;
6
- prepareLambdaBundle(projectPath: string): Promise<LambdaBundle>;
7
- }
8
- export declare const nextjsAdapter: NextjsAdapter;
@@ -1,61 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { collectSSGAssets, collectStaticAssets } from '../asset-collection.js';
4
- import { buildLambdaZip } from '../build-lambda-zip.js';
5
- import { collectFilesRecursive } from '../fs-utils.js';
6
- export class NextjsAdapter {
7
- name = 'nextjs';
8
- async collectAssets(projectPath) {
9
- // Bundle assets: .next/static/ → _next/static/
10
- const staticAssets = await collectStaticAssets(projectPath);
11
- // Public assets: public/ directory
12
- const publicDir = path.join(projectPath, 'public');
13
- let publicAssets = [];
14
- try {
15
- await fs.stat(publicDir);
16
- publicAssets = await collectFilesRecursive(publicDir, publicDir);
17
- } catch {
18
- // No public directory
19
- }
20
- const allKeys = [
21
- ...staticAssets,
22
- ...publicAssets
23
- ];
24
- const pathMap = {};
25
- for (const key of staticAssets){
26
- pathMap[key] = key.replace(/^_next\//, '.next/');
27
- }
28
- for (const key of publicAssets){
29
- pathMap[key] = path.join('public', key);
30
- }
31
- return {
32
- pathMap,
33
- routes: allKeys.map((k)=>`/${k}`),
34
- uploadKeys: allKeys
35
- };
36
- }
37
- async collectPages(projectPath) {
38
- const ssg = await collectSSGAssets(projectPath);
39
- // Build route → asset keys mapping and extract unique routes
40
- const routeAssetMap = {};
41
- for (const key of ssg.keys){
42
- // Strip extension to get the base, then derive the route
43
- const base = key.replace(/\.(?:html|rsc|meta)$/, '');
44
- const route = base === 'index' ? '/' : `/${base}`;
45
- if (!routeAssetMap[route]) {
46
- routeAssetMap[route] = [];
47
- }
48
- routeAssetMap[route].push(key);
49
- }
50
- return {
51
- pathMap: ssg.pathMap,
52
- routeAssetMap,
53
- routes: Object.keys(routeAssetMap),
54
- uploadKeys: ssg.keys
55
- };
56
- }
57
- async prepareLambdaBundle(projectPath) {
58
- return buildLambdaZip(projectPath);
59
- }
60
- }
61
- export const nextjsAdapter = new NextjsAdapter();
@@ -1,8 +0,0 @@
1
- import type { AssetCollection, DeployAdapter, LambdaBundle, PageCollection } from '../deploy-adapter.js';
2
- export declare class NitroAdapter implements DeployAdapter {
3
- name: "nitro";
4
- collectAssets(projectPath: string): Promise<AssetCollection>;
5
- collectPages(projectPath: string): Promise<PageCollection>;
6
- prepareLambdaBundle(projectPath: string): Promise<LambdaBundle>;
7
- }
8
- export declare const nitroAdapter: NitroAdapter;
@@ -1,172 +0,0 @@
1
- import archiver from 'archiver';
2
- import { createWriteStream, statSync } from 'fs';
3
- import fs from 'fs/promises';
4
- import path from 'path';
5
- import { collectFilesRecursive, getDirectorySize } from '../fs-utils.js';
6
- const RUN_SCRIPT = `#!/bin/bash -x
7
- [ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache
8
- NODE_ENV=production exec node server/index.mjs
9
- `;
10
- /** Directories in .output/public/ that are NOT pre-rendered pages */ const NON_PAGE_DIRS = new Set([
11
- '_next',
12
- 'assets'
13
- ]);
14
- export class NitroAdapter {
15
- name = 'nitro';
16
- async collectAssets(projectPath) {
17
- const publicDir = path.join(projectPath, '.output', 'public');
18
- const assets = [];
19
- const pathMap = {};
20
- // Collect flat files in .output/public/ (public dir assets)
21
- try {
22
- const entries = await fs.readdir(publicDir, {
23
- withFileTypes: true
24
- });
25
- for (const entry of entries){
26
- if (entry.isFile()) {
27
- assets.push(entry.name);
28
- pathMap[entry.name] = path.join('.output', 'public', entry.name);
29
- }
30
- }
31
- } catch {
32
- // No public directory
33
- }
34
- // Collect bundle assets from .output/public/_next/static/
35
- const bundleDir = path.join(publicDir, '_next', 'static');
36
- try {
37
- const bundleFiles = await collectFilesRecursive(bundleDir, bundleDir);
38
- for (const file of bundleFiles){
39
- const key = `_next/static/${file}`;
40
- assets.push(key);
41
- pathMap[key] = path.join('.output', 'public', '_next', 'static', file);
42
- }
43
- } catch {
44
- // No bundle directory
45
- }
46
- return {
47
- pathMap,
48
- routes: assets.map((k)=>`/${k}`),
49
- uploadKeys: assets
50
- };
51
- }
52
- async collectPages(projectPath) {
53
- const publicDir = path.join(projectPath, '.output', 'public');
54
- const pages = await scanForPages(publicDir, publicDir);
55
- const routes = pages.map((p)=>p === 'index' ? '/' : `/${p}`);
56
- const uploadKeys = pages.map((p)=>p === 'index' ? 'index.html' : `${p}/index.html`);
57
- const pathMap = {};
58
- const routeAssetMap = {};
59
- for(let i = 0; i < uploadKeys.length; i++){
60
- pathMap[uploadKeys[i]] = path.join('.output', 'public', uploadKeys[i]);
61
- routeAssetMap[routes[i]] = [
62
- uploadKeys[i]
63
- ];
64
- }
65
- return {
66
- pathMap,
67
- routeAssetMap,
68
- routes,
69
- uploadKeys
70
- };
71
- }
72
- async prepareLambdaBundle(projectPath) {
73
- const zipPath = path.join(projectPath, 'lambda.zip');
74
- const serverDir = path.join(projectPath, '.output', 'server');
75
- const publicDir = path.join(projectPath, '.output', 'public');
76
- // Verify server directory exists
77
- try {
78
- await fs.stat(serverDir);
79
- } catch {
80
- throw new Error('Nitro server build not found at .output/server. Run build first.');
81
- }
82
- // Write run.sh to a temp location
83
- const runShPath = path.join(projectPath, '.output', 'run.sh');
84
- await fs.writeFile(runShPath, RUN_SCRIPT, {
85
- mode: 0o755
86
- });
87
- // Create zip: server/ + public/ + run.sh
88
- await createZip(zipPath, [
89
- {
90
- prefix: 'server/',
91
- source: serverDir
92
- },
93
- {
94
- prefix: 'public/',
95
- source: publicDir
96
- },
97
- {
98
- prefix: '',
99
- source: runShPath
100
- }
101
- ]);
102
- const runShStat = await fs.stat(runShPath);
103
- const unzippedBytes = await getDirectorySize(serverDir) + await getDirectorySize(publicDir) + runShStat.size;
104
- // Clean up temp run.sh
105
- await fs.rm(runShPath, {
106
- force: true
107
- });
108
- return {
109
- unzippedBytes,
110
- zipPath
111
- };
112
- }
113
- }
114
- export const nitroAdapter = new NitroAdapter();
115
- /**
116
- * Recursively scan for pre-rendered pages (directories containing index.html).
117
- * Skips known non-page directories (_next/, assets/).
118
- */ async function scanForPages(dir, baseDir) {
119
- const pages = [];
120
- // Check if this directory has an index.html (it's a page)
121
- const indexPath = path.join(dir, 'index.html');
122
- try {
123
- await fs.stat(indexPath);
124
- const relative = path.relative(baseDir, dir);
125
- pages.push(relative || 'index'); // root dir -> 'index'
126
- } catch {
127
- // Not a page directory
128
- }
129
- // Recurse into subdirectories
130
- try {
131
- const entries = await fs.readdir(dir, {
132
- withFileTypes: true
133
- });
134
- for (const entry of entries){
135
- if (entry.isDirectory() && !NON_PAGE_DIRS.has(entry.name)) {
136
- const subPages = await scanForPages(path.join(dir, entry.name), baseDir);
137
- pages.push(...subPages);
138
- }
139
- }
140
- } catch {
141
- // Directory not readable
142
- }
143
- return pages;
144
- }
145
- async function createZip(zipPath, entries) {
146
- return new Promise((resolve, reject)=>{
147
- const output = createWriteStream(zipPath);
148
- const archive = archiver('zip', {
149
- zlib: {
150
- level: 9
151
- }
152
- });
153
- output.on('close', ()=>resolve());
154
- archive.on('error', (err)=>reject(err));
155
- archive.pipe(output);
156
- for (const entry of entries){
157
- try {
158
- const stat = statSync(entry.source);
159
- if (stat.isDirectory()) {
160
- archive.directory(entry.source, entry.prefix.replace(/\/$/, '') || false);
161
- } else {
162
- archive.file(entry.source, {
163
- name: entry.prefix + path.basename(entry.source)
164
- });
165
- }
166
- } catch {
167
- // Skip missing entries
168
- }
169
- }
170
- void archive.finalize();
171
- });
172
- }
@@ -1,31 +0,0 @@
1
- import path from 'path';
2
- import { collectFilesRecursive } from '../fs-utils.js';
3
- export class ViteAdapter {
4
- fallback = '/index.html';
5
- name = 'vite';
6
- async collectAssets(projectPath) {
7
- const distDir = path.join(projectPath, 'dist');
8
- const files = await collectFilesRecursive(distDir, distDir);
9
- const pathMap = {};
10
- for (const file of files){
11
- pathMap[file] = path.join('dist', file);
12
- }
13
- return {
14
- pathMap,
15
- routes: files.map((k)=>`/${k}`),
16
- uploadKeys: files
17
- };
18
- }
19
- collectPages() {
20
- return Promise.resolve({
21
- pathMap: {},
22
- routeAssetMap: {},
23
- routes: [],
24
- uploadKeys: []
25
- });
26
- }
27
- prepareLambdaBundle() {
28
- return Promise.resolve(null);
29
- }
30
- }
31
- export const viteAdapter = new ViteAdapter();
@@ -1,144 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { buildLambdaZip } from './build-lambda-zip.js';
4
- import * as log from './log.js';
5
- // Maximum file size for static assets (S3 limitation)
6
- const MAX_ASSET_SIZE = 50 * 1024 * 1024 // 50MB
7
- ;
8
- /**
9
- * Get file size in bytes
10
- *
11
- * @param filePath - Absolute path to file
12
- * @returns File size in bytes
13
- */ export async function getFileSize(filePath) {
14
- const stats = await fs.stat(filePath);
15
- return stats.size;
16
- }
17
- /**
18
- * Recursively collect files from a directory
19
- *
20
- * Excludes files larger than 50MB (S3 limitation).
21
- * Warns user when files are excluded due to size.
22
- *
23
- * @param dir - Directory to scan
24
- * @param baseDir - Base directory for relative paths
25
- * @returns Array of relative file paths
26
- */ async function collectFiles(dir, baseDir) {
27
- const files = [];
28
- try {
29
- const entries = await fs.readdir(dir, {
30
- withFileTypes: true
31
- });
32
- for (const entry of entries){
33
- const fullPath = path.join(dir, entry.name);
34
- if (entry.isDirectory()) {
35
- // Recursively collect from subdirectories
36
- const subFiles = await collectFiles(fullPath, baseDir);
37
- files.push(...subFiles);
38
- } else if (entry.isFile()) {
39
- // Check file size before adding
40
- const stats = await fs.stat(fullPath);
41
- if (stats.size <= MAX_ASSET_SIZE) {
42
- // Add relative path from base directory
43
- const relativePath = path.relative(baseDir, fullPath);
44
- files.push(relativePath);
45
- } else {
46
- // Warn user about skipped files
47
- const sizeMB = (stats.size / (1024 * 1024)).toFixed(2);
48
- const relativePath = path.relative(baseDir, fullPath);
49
- log.warning(`Skipping large asset: ${relativePath} (${sizeMB}MB exceeds 50MB limit)`);
50
- }
51
- }
52
- }
53
- } catch {
54
- // Directory doesn't exist or not accessible
55
- return [];
56
- }
57
- return files;
58
- }
59
- /**
60
- * Collect all static asset paths from .next/static
61
- *
62
- * Returns paths relative to project root, formatted for S3:
63
- * - `.next/static/chunks/main.js` → `_next/static/chunks/main.js`
64
- *
65
- * @param projectPath - Path to project root
66
- * @returns Array of static asset paths (using _next prefix)
67
- */ export async function collectStaticAssets(projectPath) {
68
- const staticDir = path.join(projectPath, '.next', 'static');
69
- try {
70
- await fs.stat(staticDir);
71
- } catch {
72
- // No static directory
73
- return [];
74
- }
75
- const files = await collectFiles(staticDir, projectPath);
76
- // Normalize paths to forward slashes (cross-platform) and convert prefix
77
- return files.map((file)=>{
78
- const normalized = file.split(path.sep).join('/');
79
- return normalized.replace(/^\.next\//, '_next/');
80
- });
81
- }
82
- /**
83
- * Collect SSG asset paths by parsing .next/prerender-manifest.json
84
- *
85
- * For each route in the manifest's `routes` object, collects three files:
86
- * - {route}.html (full HTML)
87
- * - {route}.rsc (React Server Components payload)
88
- * - {route}.meta (response headers JSON)
89
- *
90
- * S3 keys use the route path without leading slash.
91
- * Filesystem paths point to .next/server/app/{route}.{ext}
92
- *
93
- * @param projectPath - Path to project root
94
- * @returns SSG asset keys and a pathMap for filesystem resolution
95
- */ export async function collectSSGAssets(projectPath) {
96
- const manifestPath = path.join(projectPath, '.next', 'prerender-manifest.json');
97
- let manifest;
98
- try {
99
- const raw = await fs.readFile(manifestPath, 'utf-8');
100
- manifest = JSON.parse(raw);
101
- } catch {
102
- return {
103
- keys: [],
104
- pathMap: {}
105
- };
106
- }
107
- if (!manifest.routes || typeof manifest.routes !== 'object') {
108
- return {
109
- keys: [],
110
- pathMap: {}
111
- };
112
- }
113
- const keys = [];
114
- const pathMap = {};
115
- const extensions = [
116
- '.html',
117
- '.rsc',
118
- '.meta'
119
- ];
120
- for (const routeKey of Object.keys(manifest.routes)){
121
- // Strip leading slash for S3 key; handle root "/" → "index"
122
- const stripped = routeKey === '/' ? 'index' : routeKey.replace(/^\//, '');
123
- for (const ext of extensions){
124
- const s3Key = `${stripped}${ext}`;
125
- const fsPath = path.join('.next', 'server', 'app', `${stripped}${ext}`);
126
- keys.push(s3Key);
127
- pathMap[s3Key] = fsPath;
128
- }
129
- }
130
- return {
131
- keys,
132
- pathMap
133
- };
134
- }
135
- /**
136
- * Create Lambda deployment zip
137
- *
138
- * Uses cross-platform Node.js implementation instead of shell script.
139
- *
140
- * @param projectPath - Path to project root
141
- * @throws Error if build missing or zip creation fails
142
- */ export async function createLambdaZip(projectPath) {
143
- await buildLambdaZip(projectPath);
144
- }