@payloadcms/figma 0.1.0-internal.e071575 → 0.1.0-internal.fbdc0d3

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 +33 -8
  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
@@ -0,0 +1,27 @@
1
+ import * as p from '@clack/prompts';
2
+ export async function resolveProjectRegion({ nonInteractive, resourceType, value }) {
3
+ if (value !== undefined) {
4
+ const region = value.trim();
5
+ if (!region) {
6
+ throw new Error('Region is required');
7
+ }
8
+ return region;
9
+ }
10
+ if (resourceType === 'vite' || nonInteractive) {
11
+ return 'us-east-1';
12
+ }
13
+ const selectedRegion = await p.select({
14
+ message: 'Select a region:',
15
+ options: [
16
+ {
17
+ label: 'US East (us-east-1)',
18
+ value: 'us-east-1'
19
+ }
20
+ ]
21
+ });
22
+ if (p.isCancel(selectedRegion)) {
23
+ p.cancel('Operation cancelled');
24
+ process.exit(0);
25
+ }
26
+ return selectedRegion;
27
+ }
@@ -0,0 +1,9 @@
1
+ import type { AuthCredential } from '../../auth/credentials.js';
2
+ interface ResolveProjectSubdomainArgs {
3
+ credential: AuthCredential;
4
+ initialValue: string;
5
+ nonInteractive?: boolean;
6
+ value?: string;
7
+ }
8
+ export declare function resolveProjectSubdomain({ credential, initialValue, nonInteractive, value, }: ResolveProjectSubdomainArgs): Promise<string>;
9
+ export {};
@@ -0,0 +1,54 @@
1
+ import * as p from '@clack/prompts';
2
+ import pc from 'picocolors';
3
+ import { checkProjectSubdomainAvailability } from '../../api/check-project-subdomain-availability.js';
4
+ import { formatUnavailableSubdomainReason } from './format-unavailable-subdomain-reason.js';
5
+ import { promptForAvailableSubdomain } from './prompt-for-available-subdomain.js';
6
+ import { validateSubdomain } from './validate-subdomain.js';
7
+ const GENERATED_SUBDOMAIN_ATTEMPT_COUNT = 5;
8
+ export async function resolveProjectSubdomain({ credential, initialValue, nonInteractive, value }) {
9
+ const providedSubdomain = value === undefined ? undefined : validateProvidedSubdomain(value);
10
+ if (!nonInteractive) {
11
+ if (providedSubdomain) {
12
+ const availability = await checkProjectSubdomainAvailability({
13
+ credential,
14
+ subdomain: providedSubdomain
15
+ });
16
+ if (availability.available) {
17
+ return providedSubdomain;
18
+ }
19
+ p.log.error(pc.red(formatUnavailableSubdomainReason(availability.reason)));
20
+ }
21
+ return promptForAvailableSubdomain({
22
+ credential,
23
+ initialValue: providedSubdomain ?? initialValue
24
+ });
25
+ }
26
+ const baseSubdomain = providedSubdomain ?? initialValue;
27
+ for(let attempt = 0; attempt < GENERATED_SUBDOMAIN_ATTEMPT_COUNT; attempt++){
28
+ const subdomain = attempt === 0 ? baseSubdomain : addRandomSuffix(baseSubdomain);
29
+ const availability = await checkProjectSubdomainAvailability({
30
+ credential,
31
+ subdomain
32
+ });
33
+ if (availability.available) {
34
+ return subdomain;
35
+ }
36
+ if (providedSubdomain) {
37
+ throw new Error(`${formatUnavailableSubdomainReason(availability.reason)} Pass a different --subdomain.`);
38
+ }
39
+ }
40
+ throw new Error(`Could not generate an available subdomain after ${GENERATED_SUBDOMAIN_ATTEMPT_COUNT} attempts. Pass --subdomain.`);
41
+ }
42
+ function validateProvidedSubdomain(value) {
43
+ const validationError = validateSubdomain(value);
44
+ if (validationError) {
45
+ throw new Error(validationError);
46
+ }
47
+ return value.trim();
48
+ }
49
+ function addRandomSuffix(value) {
50
+ // Append a hyphen and six random lowercase alphanumeric characters, e.g. `-a1b2c3`.
51
+ const suffix = Math.random().toString(36).slice(2, 8).padEnd(6, '0');
52
+ const prefix = value.slice(0, 53).replace(/-+$/g, '');
53
+ return `${prefix}-${suffix}`;
54
+ }
@@ -0,0 +1,9 @@
1
+ interface ResolveTextInputArgs {
2
+ fieldName: string;
3
+ initialValue: string;
4
+ message: string;
5
+ nonInteractive?: boolean;
6
+ value?: string;
7
+ }
8
+ export declare function resolveTextInput({ fieldName, initialValue, message, nonInteractive, value, }: ResolveTextInputArgs): Promise<string>;
9
+ export {};
@@ -0,0 +1,23 @@
1
+ import * as p from '@clack/prompts';
2
+ export async function resolveTextInput({ fieldName, initialValue, message, nonInteractive, value }) {
3
+ if (value !== undefined) {
4
+ const trimmedValue = value.trim();
5
+ if (!trimmedValue) {
6
+ throw new Error(`${fieldName} is required`);
7
+ }
8
+ return trimmedValue;
9
+ }
10
+ if (nonInteractive) {
11
+ return initialValue;
12
+ }
13
+ const promptedValue = await p.text({
14
+ initialValue,
15
+ message,
16
+ validate: (candidate)=>candidate?.trim() ? undefined : `${fieldName} is required`
17
+ });
18
+ if (p.isCancel(promptedValue)) {
19
+ p.cancel('Operation cancelled');
20
+ process.exit(0);
21
+ }
22
+ return promptedValue.trim();
23
+ }
@@ -0,0 +1,12 @@
1
+ interface ProjectWorkspace {
2
+ isDefault: boolean;
3
+ name: string;
4
+ planKey: string;
5
+ }
6
+ interface ResolveWorkspacePlanKeyArgs {
7
+ nonInteractive?: boolean;
8
+ value?: string;
9
+ workspaces: ProjectWorkspace[];
10
+ }
11
+ export declare function resolveWorkspacePlanKey({ nonInteractive, value, workspaces, }: ResolveWorkspacePlanKeyArgs): Promise<string>;
12
+ export {};
@@ -0,0 +1,36 @@
1
+ import * as p from '@clack/prompts';
2
+ export async function resolveWorkspacePlanKey({ nonInteractive, value, workspaces }) {
3
+ if (value !== undefined) {
4
+ const planKey = value.trim();
5
+ const workspace = workspaces.find((candidate)=>candidate.planKey === planKey);
6
+ if (!workspace) {
7
+ throw new Error(`Workspace plan key "${planKey}" is not eligible. Available: ${formatWorkspaces(workspaces)}`);
8
+ }
9
+ return workspace.planKey;
10
+ }
11
+ if (workspaces.length === 1) {
12
+ return workspaces[0].planKey;
13
+ }
14
+ if (nonInteractive) {
15
+ const defaultWorkspace = workspaces.find((workspace)=>workspace.isDefault);
16
+ if (defaultWorkspace) {
17
+ return defaultWorkspace.planKey;
18
+ }
19
+ throw new Error(`Multiple eligible Figma workspaces. Pass --workspace <plan-key>. Available: ${formatWorkspaces(workspaces)}`);
20
+ }
21
+ const selectedWorkspacePlanKey = await p.select({
22
+ message: 'Select a Figma workspace:',
23
+ options: workspaces.map((workspace)=>({
24
+ label: workspace.name,
25
+ value: workspace.planKey
26
+ }))
27
+ });
28
+ if (p.isCancel(selectedWorkspacePlanKey)) {
29
+ p.cancel('Operation cancelled');
30
+ process.exit(0);
31
+ }
32
+ return selectedWorkspacePlanKey;
33
+ }
34
+ function formatWorkspaces(workspaces) {
35
+ return workspaces.map((workspace)=>`${workspace.name} (${workspace.planKey})`).join(', ');
36
+ }
@@ -0,0 +1 @@
1
+ export declare function validateSubdomain(value: string | undefined): "Subdomain is required" | "Use 1–60 lowercase letters, numbers, or hyphens" | undefined;
@@ -0,0 +1,9 @@
1
+ export function validateSubdomain(value) {
2
+ if (!value?.trim()) {
3
+ return 'Subdomain is required';
4
+ }
5
+ if (!/^[a-z0-9](?:[a-z0-9-]{0,58}[a-z0-9])?$/.test(value.trim())) {
6
+ return 'Use 1–60 lowercase letters, numbers, or hyphens';
7
+ }
8
+ return undefined;
9
+ }
@@ -0,0 +1,24 @@
1
+ import type { ProjectResourceType } from '../api/project-resource-type.js';
2
+ import type { AuthCredential } from '../auth/credentials.js';
3
+ interface ProjectCreationInputs {
4
+ description?: string;
5
+ name?: string;
6
+ region?: string;
7
+ subdomain?: string;
8
+ workspacePlanKey?: string;
9
+ }
10
+ interface PromptToCreateProjectArgs {
11
+ credential: AuthCredential;
12
+ inputs?: ProjectCreationInputs;
13
+ nonInteractive?: boolean;
14
+ projectPath: string;
15
+ resourceType: ProjectResourceType;
16
+ }
17
+ interface PromptToCreateProjectResponse {
18
+ domainName: string;
19
+ id: string;
20
+ name: string;
21
+ }
22
+ /** Prompt for required project fields and create a blank Figma CMS project. */
23
+ export declare function promptToCreateProject({ credential, inputs, nonInteractive, projectPath, resourceType, }: PromptToCreateProjectArgs): Promise<PromptToCreateProjectResponse>;
24
+ export {};
@@ -0,0 +1,69 @@
1
+ import * as p from '@clack/prompts';
2
+ import pc from 'picocolors';
3
+ import { createProject } from '../api/create-project.js';
4
+ import { listProjectWorkspaces } from '../api/list-project-workspaces.js';
5
+ import { formatProjectSubdomain } from './prompt-to-create-project/format-project-subdomain.js';
6
+ import { getDefaultProjectName } from './prompt-to-create-project/get-default-project-name.js';
7
+ import { resolveProjectRegion } from './prompt-to-create-project/resolve-project-region.js';
8
+ import { resolveProjectSubdomain } from './prompt-to-create-project/resolve-project-subdomain.js';
9
+ import { resolveTextInput } from './prompt-to-create-project/resolve-text-input.js';
10
+ import { resolveWorkspacePlanKey } from './prompt-to-create-project/resolve-workspace-plan-key.js';
11
+ /** Prompt for required project fields and create a blank Figma CMS project. */ export async function promptToCreateProject({ credential, inputs, nonInteractive, projectPath, resourceType }) {
12
+ const workspaces = await listProjectWorkspaces(credential);
13
+ if (workspaces.length === 0) {
14
+ if (nonInteractive) {
15
+ throw new Error('No eligible Figma workspaces found.');
16
+ }
17
+ p.log.error(pc.red('No eligible Figma workspaces found.'));
18
+ process.exit(1);
19
+ }
20
+ const defaultProjectName = await getDefaultProjectName(projectPath);
21
+ const projectName = await resolveTextInput({
22
+ fieldName: 'Project name',
23
+ initialValue: defaultProjectName,
24
+ message: 'Project name:',
25
+ nonInteractive,
26
+ value: inputs?.name
27
+ });
28
+ const projectDescription = await resolveTextInput({
29
+ fieldName: 'Description',
30
+ initialValue: `${projectName} project`,
31
+ message: 'Project description:',
32
+ nonInteractive,
33
+ value: inputs?.description
34
+ });
35
+ const projectSubdomain = await resolveProjectSubdomain({
36
+ credential,
37
+ initialValue: formatProjectSubdomain(projectName),
38
+ nonInteractive,
39
+ value: inputs?.subdomain
40
+ });
41
+ const parentPlanKey = await resolveWorkspacePlanKey({
42
+ nonInteractive,
43
+ value: inputs?.workspacePlanKey,
44
+ workspaces
45
+ });
46
+ const region = await resolveProjectRegion({
47
+ nonInteractive,
48
+ resourceType,
49
+ value: inputs?.region
50
+ });
51
+ const spinner = p.spinner();
52
+ spinner.start('Creating Figma project...');
53
+ try {
54
+ const project = await createProject({
55
+ name: projectName,
56
+ credential,
57
+ description: projectDescription,
58
+ parentPlanKey,
59
+ region,
60
+ resourceType,
61
+ subdomain: projectSubdomain
62
+ });
63
+ spinner.stop(pc.green(`✓ Project created: ${project.domainName}`));
64
+ return project;
65
+ } catch (error) {
66
+ spinner.stop(pc.red('✗ Failed to create project'));
67
+ throw error;
68
+ }
69
+ }
@@ -0,0 +1,12 @@
1
+ export interface SetupAgentOptions {
2
+ global?: boolean;
3
+ project?: boolean;
4
+ yes?: boolean;
5
+ }
6
+ /** Install or update the bundled deploy skill through the standard skills CLI. */
7
+ export declare function setupAgentCommand(options: SetupAgentOptions, dependencies?: {
8
+ homeDir?: string;
9
+ isTTY?: boolean;
10
+ projectDir?: string;
11
+ skillDir?: string;
12
+ }): Promise<void>;
@@ -0,0 +1,123 @@
1
+ import * as p from '@clack/prompts';
2
+ import spawn from 'cross-spawn';
3
+ import crypto from 'node:crypto';
4
+ import fs from 'node:fs/promises';
5
+ import { createRequire } from 'node:module';
6
+ import os from 'node:os';
7
+ import path from 'node:path';
8
+ const SKILL_NAME = 'deploy-to-figma';
9
+ const require = createRequire(import.meta.url);
10
+ const SKILLS_CLI_PATH = require.resolve('skills/bin/cli.mjs');
11
+ /** Install or update the bundled deploy skill through the standard skills CLI. */ export async function setupAgentCommand(options, dependencies = {}) {
12
+ if (options.global && options.project) {
13
+ throw new Error('Use either --global or --project, not both.');
14
+ }
15
+ const isTTY = dependencies.isTTY ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
16
+ const scope = await resolveScope(options, isTTY);
17
+ const projectDir = dependencies.projectDir ?? process.cwd();
18
+ const homeDir = dependencies.homeDir ?? os.homedir();
19
+ const skillDir = dependencies.skillDir ?? resolveBundledSkillDir();
20
+ const installedDir = path.join(scope === 'global' ? homeDir : projectDir, '.agents', 'skills', SKILL_NAME);
21
+ const [bundledHash, installedHash] = await Promise.all([
22
+ hashDirectory(skillDir),
23
+ hashDirectory(installedDir)
24
+ ]);
25
+ if (!bundledHash) {
26
+ throw new Error(`Bundled ${SKILL_NAME} skill was not found at ${skillDir}.`);
27
+ }
28
+ if (bundledHash === installedHash) {
29
+ p.log.success(`✓ ${SKILL_NAME} skill is already up to date (${scope})`);
30
+ return;
31
+ }
32
+ p.log.step(`${installedHash ? 'Updating' : 'Installing'} ${SKILL_NAME} skill (${scope})...`);
33
+ const args = [
34
+ 'add',
35
+ skillDir,
36
+ '--skill',
37
+ SKILL_NAME,
38
+ '--copy',
39
+ ...scope === 'global' ? [
40
+ '--global'
41
+ ] : [],
42
+ ...options.yes || !isTTY ? [
43
+ '--yes'
44
+ ] : []
45
+ ];
46
+ const exitCode = await run(process.execPath, [
47
+ SKILLS_CLI_PATH,
48
+ ...args
49
+ ], projectDir);
50
+ if (exitCode !== 0) {
51
+ throw new Error(`Skill installation failed with exit code ${exitCode}.`);
52
+ }
53
+ p.log.success(`✓ ${SKILL_NAME} skill ${installedHash ? 'updated' : 'installed'} (${scope})`);
54
+ }
55
+ async function resolveScope(options, isTTY) {
56
+ if (options.global) {
57
+ return 'global';
58
+ }
59
+ if (options.project) {
60
+ return 'project';
61
+ }
62
+ if (!isTTY) {
63
+ throw new Error('Non-interactive setup requires either --global or --project.');
64
+ }
65
+ const selected = await p.select({
66
+ initialValue: 'global',
67
+ message: 'Where should the Figma deploy skill be installed?',
68
+ options: [
69
+ {
70
+ label: 'Globally (recommended)',
71
+ value: 'global'
72
+ },
73
+ {
74
+ label: 'Current project only',
75
+ value: 'project'
76
+ }
77
+ ]
78
+ });
79
+ if (p.isCancel(selected)) {
80
+ throw new Error('Skill installation cancelled.');
81
+ }
82
+ return selected;
83
+ }
84
+ function resolveBundledSkillDir() {
85
+ return path.resolve(import.meta.dirname, '..', 'skills', SKILL_NAME);
86
+ }
87
+ async function hashDirectory(directory) {
88
+ if (!await pathExists(directory)) {
89
+ return null;
90
+ }
91
+ const hash = crypto.createHash('sha256');
92
+ async function visit(currentDir, relativeDir = '') {
93
+ const entries = await fs.readdir(currentDir, {
94
+ withFileTypes: true
95
+ });
96
+ entries.sort((left, right)=>left.name.localeCompare(right.name));
97
+ for (const entry of entries){
98
+ const relativePath = path.join(relativeDir, entry.name);
99
+ const absolutePath = path.join(currentDir, entry.name);
100
+ if (entry.isDirectory()) {
101
+ await visit(absolutePath, relativePath);
102
+ } else if (entry.isFile()) {
103
+ hash.update(relativePath);
104
+ hash.update(await fs.readFile(absolutePath));
105
+ }
106
+ }
107
+ }
108
+ await visit(directory);
109
+ return hash.digest('hex');
110
+ }
111
+ function run(command, args, cwd) {
112
+ return new Promise((resolve, reject)=>{
113
+ const child = spawn(command, args, {
114
+ cwd,
115
+ stdio: 'inherit'
116
+ });
117
+ child.once('error', reject);
118
+ child.once('close', (code)=>resolve(code ?? 1));
119
+ });
120
+ }
121
+ async function pathExists(filePath) {
122
+ return fs.access(filePath).then(()=>true).catch(()=>false);
123
+ }
@@ -8,12 +8,13 @@ import { getBootstrapInfo, getCmsResourceId } from '../api/control-plane.js';
8
8
  import { getValidCredential } from '../auth/oauth-flow.js';
9
9
  import { getTokenStore } from '../auth/token-store.js';
10
10
  import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
11
- import { addOrUpdateEnvVar, getEnvVar, removeEnvVar } from '../utils/env-management.js';
11
+ import { addOrUpdateEnvVar, commentOutEnvVar, getEnvVar, removeEnvVar } from '../utils/env-management.js';
12
12
  import { formatFile } from '../utils/formatter.js';
13
13
  import { getPackageManager } from '../utils/package-manager.js';
14
14
  import { removeFigmaContentSystemId } from '../utils/payload-config-ast.js';
15
15
  import { findPayloadConfig } from '../utils/payload-config-finder.js';
16
16
  import { checkPackageInstalled, installPackage } from '../utils/payload-package-check.js';
17
+ import { ensurePayloadSecret } from '../utils/payload-secret.js';
17
18
  import { getOwnVersion } from '../utils/version-check.js';
18
19
  export async function upgradeCommand(options = {}) {
19
20
  const cwd = process.cwd();
@@ -45,6 +46,11 @@ export async function upgradeCommand(options = {}) {
45
46
  isDryRun,
46
47
  warnings
47
48
  });
49
+ await migrateCommentOutPayloadSecret({
50
+ changes,
51
+ cwd,
52
+ isDryRun
53
+ });
48
54
  await migrateConfigAst({
49
55
  changes,
50
56
  cwd,
@@ -221,6 +227,64 @@ async function migrateRemoveDeprecatedEnvVars({ changes, cwd, isDryRun, warnings
221
227
  p.log.warning(`Deprecated env var removal failed: ${msg}`);
222
228
  }
223
229
  }
230
+ async function migrateCommentOutPayloadSecret({ changes, cwd, isDryRun }) {
231
+ try {
232
+ // Only touch active (uncommented) assignments — commentOutEnvVar already
233
+ // no-ops on commented lines, but checking here avoids the dry-run message
234
+ // when there's nothing left to do.
235
+ const existing = await getEnvVar(cwd, 'PAYLOAD_SECRET');
236
+ if (existing === null) {
237
+ return;
238
+ }
239
+ if (isDryRun) {
240
+ p.log.message(`${pc.dim('○')} Would comment out PAYLOAD_SECRET in .env after caching the platform secret`);
241
+ changes.push('Comment out PAYLOAD_SECRET in .env');
242
+ return;
243
+ }
244
+ const projectId = await getEnvVar(cwd, 'FIGMA_PROJECT_ID');
245
+ const environmentName = await getEnvVar(cwd, 'FIGMA_ENVIRONMENT_NAME');
246
+ if (!projectId || !environmentName) {
247
+ p.log.warning('Keeping PAYLOAD_SECRET in .env: initialize the project before migrating its secret.');
248
+ return;
249
+ }
250
+ const store = getTokenStore();
251
+ const credential = await getValidCredential(store);
252
+ if (!credential) {
253
+ p.log.warning('Keeping PAYLOAD_SECRET in .env: run `npx @payloadcms/figma login` and retry upgrade.');
254
+ return;
255
+ }
256
+ let bootstrapData = store.getBootstrapData(projectId, environmentName);
257
+ if (!bootstrapData) {
258
+ const bootstrapInfo = await getBootstrapInfo(credential, projectId);
259
+ cacheAllEnvironments(store, projectId, bootstrapInfo);
260
+ bootstrapData = store.getBootstrapData(projectId, environmentName);
261
+ }
262
+ if (!bootstrapData?.tenantInstanceId) {
263
+ p.log.warning('Keeping PAYLOAD_SECRET in .env: the project environment could not be resolved.');
264
+ return;
265
+ }
266
+ await ensurePayloadSecret({
267
+ credential,
268
+ projectInfo: {
269
+ environmentName,
270
+ projectId
271
+ },
272
+ refresh: true,
273
+ tenantInstanceId: bootstrapData.tenantInstanceId,
274
+ tokenStore: store
275
+ });
276
+ const changed = await commentOutEnvVar(cwd, 'PAYLOAD_SECRET', 'disabled by @payloadcms/figma: platform owns PAYLOAD_SECRET');
277
+ if (!changed) {
278
+ p.log.warning('Could not comment out PAYLOAD_SECRET in .env; the platform secret is cached. Retry upgrade.');
279
+ return;
280
+ }
281
+ p.log.message(`${pc.green('●')} Env: Commented out PAYLOAD_SECRET (Figma platform owns this value; ` + `a local copy would silently diverge from the deployed secret)`);
282
+ changes.push('Commented out PAYLOAD_SECRET in .env');
283
+ } catch (error) {
284
+ const msg = error instanceof Error ? error.message : 'Unknown error';
285
+ p.log.warning(`PAYLOAD_SECRET migration failed; keeping the existing .env value: ${msg}`);
286
+ }
287
+ }
224
288
  async function migrateConfigAst({ changes, cwd, isDryRun }) {
225
289
  try {
226
290
  const configPath = await findPayloadConfig(cwd);
@@ -4,7 +4,6 @@ import { getBootstrapInfo } from '../api/control-plane.js';
4
4
  import { tryGetCredential } from '../auth/oauth-flow.js';
5
5
  import { getValidProjectToken } from '../auth/project-token.js';
6
6
  import { getTokenStore } from '../auth/token-store.js';
7
- import { getEnvConfig } from '../constants.js';
8
7
  import { buildDocumentSchema } from '../db-content-api/utilities/schema/buildDocumentSchema.js';
9
8
  import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
10
9
  import { getEnvVar } from '../utils/env-management.js';
@@ -58,10 +57,10 @@ import { loginCommand } from './login.js';
58
57
  if (!apiKey && !projectToken) {
59
58
  throw new Error('Could not get a project token. Run `@payloadcms/figma login` and retry.');
60
59
  }
61
- // --infra-env is applied by the CLI before this fallback selects the Content API URL.
62
- const contentApiUrl = process.env.FIGMA_CONTENT_API_URL || getEnvConfig().contentApiUrl;
60
+ // The bootstrap environment carries its regional Content API URL.
61
+ const contentApiUrl = process.env.FIGMA_CONTENT_API_URL || environment.contentApiUrl;
63
62
  if (!contentApiUrl) {
64
- throw new Error('FIGMA_CONTENT_API_URL is required for this infrastructure environment.');
63
+ throw new Error(`No Content API URL returned for environment "${environment.name}".`);
65
64
  }
66
65
  const response = await fetch(`${contentApiUrl}/api/v0/content_systems/${encodeURIComponent(environment.contentSystemId)}/jsonb_to_index_migration_schema`, {
67
66
  body: JSON.stringify({
@@ -0,0 +1,12 @@
1
+ import type { BootstrapInfo } from '../api/control-plane.js';
2
+ import type { TokenStore } from '../auth/token-store.js';
3
+ interface WriteProjectConfigurationArgs {
4
+ bootstrapInfo: BootstrapInfo | null;
5
+ environmentName: string;
6
+ projectDir: string;
7
+ projectId: string;
8
+ shouldWriteEnvironmentVariables?: boolean;
9
+ tokenStore: TokenStore;
10
+ }
11
+ export declare function writeProjectConfiguration({ bootstrapInfo, environmentName, projectDir, projectId, shouldWriteEnvironmentVariables, tokenStore, }: WriteProjectConfigurationArgs): Promise<void>;
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import { getInfraEnvironment } from '../constants.js';
2
+ import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
3
+ import { addOrUpdateEnvVar } from '../utils/env-management.js';
4
+ export async function writeProjectConfiguration({ bootstrapInfo, environmentName, projectDir, projectId, shouldWriteEnvironmentVariables = true, tokenStore }) {
5
+ if (shouldWriteEnvironmentVariables) {
6
+ await addOrUpdateEnvVar(projectDir, 'FIGMA_PROJECT_ID', projectId);
7
+ await addOrUpdateEnvVar(projectDir, 'FIGMA_ENVIRONMENT_NAME', environmentName);
8
+ const infraEnvironment = getInfraEnvironment();
9
+ if (infraEnvironment !== 'production') {
10
+ await addOrUpdateEnvVar(projectDir, 'FIGMA_INFRA_ENV', infraEnvironment);
11
+ }
12
+ }
13
+ if (bootstrapInfo) {
14
+ cacheAllEnvironments(tokenStore, projectId, bootstrapInfo);
15
+ }
16
+ }
@@ -28,7 +28,12 @@ export const DEFAULT_CALLBACK_PORT = DEFAULT_CALLBACK_PORTS[0];
28
28
  redirectUri: process.env.FIGMA_REDIRECT_URI || `http://localhost:${DEFAULT_CALLBACK_PORT}/callback`,
29
29
  refreshUrl: `${apiBaseUrl}/v1/oauth/refresh`,
30
30
  scopes: [
31
- 'current_user:read'
31
+ 'current_user:read',
32
+ 'cloud:read',
33
+ 'cloud:create',
34
+ 'cloud:secrets:read',
35
+ 'cloud:content:read_write',
36
+ 'cloud:deploy'
32
37
  ],
33
38
  tokenUrl: `${apiBaseUrl}/v1/oauth/token`
34
39
  };
@@ -11,8 +11,6 @@ type EnvironmentConfig = {
11
11
  authorizationUrl: string;
12
12
  /** OAuth client ID. Override: FIGMA_CLIENT_ID or FIGMA_OAUTH_CLIENT_ID */
13
13
  clientId: string;
14
- /** Content API base URL. Override: FIGMA_CONTENT_API_URL */
15
- contentApiUrl: string;
16
14
  /** OIDC discovery endpoint */
17
15
  identityMetadata: string;
18
16
  /** JSON Web Key Set URL for token validation */
package/dist/constants.js CHANGED
@@ -7,7 +7,6 @@ import { getEnvVarSync } from './utils/env-management.js';
7
7
  apiBaseUrl: 'https://api.figma.com',
8
8
  authorizationUrl: 'https://www.figma.com/oauth',
9
9
  clientId: 'lelKVTAzOekFnirnlAMbuD',
10
- contentApiUrl: 'https://us-east-1.cms-tenants-001-production.figmacontent.com',
11
10
  identityMetadata: 'https://www.figma.com/.well-known/openid-configuration',
12
11
  jwksUri: 'https://static.figmacontent.com/.well_known/jwks.json'
13
12
  },
@@ -15,7 +14,6 @@ import { getEnvVarSync } from './utils/env-management.js';
15
14
  apiBaseUrl: 'https://api.staging.figma.com',
16
15
  authorizationUrl: 'https://staging.figma.com/oauth',
17
16
  clientId: 'wqAToBAp4UI9AZ5M6wTfT9',
18
- contentApiUrl: 'https://us-east-1.cms-tenants-001-staging.figmacontentstaging.com',
19
17
  identityMetadata: 'https://staging.figma.com/.well-known/openid-configuration',
20
18
  jwksUri: 'https://static.figmacontentstaging.com/.well_known/jwks.json'
21
19
  },
@@ -26,7 +24,6 @@ import { getEnvVarSync } from './utils/env-management.js';
26
24
  apiBaseUrl: '',
27
25
  authorizationUrl: '',
28
26
  clientId: 'rNZBcf3xBDmI76mQ9603su',
29
- contentApiUrl: '',
30
27
  identityMetadata: '',
31
28
  jwksUri: ''
32
29
  }
@@ -8062,12 +8062,16 @@ export type components = {
8062
8062
  /** @example document.pdf */
8063
8063
  filename: string;
8064
8064
  /**
8065
- * @default 3600
8066
- * @example 3600
8065
+ * @default 300
8066
+ * @example 300
8067
8067
  */
8068
8068
  expiresIn: number;
8069
8069
  /** @example media */
8070
8070
  collectionId: string;
8071
+ responseHeaders?: {
8072
+ /** @example public, max-age=3600 */
8073
+ cacheControl: string;
8074
+ };
8071
8075
  };
8072
8076
  InitiateMultipartUploadResponse: {
8073
8077
  /** @example abc123xyz789 */
@@ -29,7 +29,7 @@ export type ContentAPIAdapter = {
29
29
  client: ReturnType<typeof createClient<paths>>;
30
30
  clientVersionHeaders: Record<string, string>;
31
31
  contentSystemId: string;
32
- documentSchema: DocumentSchemaWire;
32
+ documentSchema: () => DocumentSchemaWire;
33
33
  environmentName?: string;
34
34
  idType: 'uuid';
35
35
  notifyLocalJobQueue: boolean;