@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
@@ -1,7 +1,8 @@
1
1
  import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage';
2
2
  import { lexicalEditor } from '@payloadcms/richtext-lexical';
3
3
  import { buildConfig as payloadBuildConfig } from 'payload';
4
- import { getBootstrapInfo } from '../api/control-plane.js';
4
+ import { deepMergeSimple } from 'payload/shared';
5
+ import { getBootstrapInfo, getEnvironmentVariableByName } from '../api/control-plane.js';
5
6
  import { getValidCredential } from '../auth/oauth-flow.js';
6
7
  import { getTokenStore } from '../auth/token-store.js';
7
8
  import { getEnvConfig } from '../constants.js';
@@ -10,14 +11,19 @@ import { scheduleExtractPlugin } from '../deploy/schedule-extract-plugin.js';
10
11
  import { health } from '../endpoints/health.js';
11
12
  import { schema } from '../endpoints/schema.js';
12
13
  import { oAuth2Plugin } from '../oauth/index.js';
14
+ import { getAdminCollectionSlug } from '../oauth/utilities/getAdminCollectionSlug.js';
13
15
  import { createStorageClient } from '../storage-content-api/client.js';
14
16
  import { contentApiStorageAdapter } from '../storage-content-api/index.js';
17
+ import { translations as figmaTranslations } from '../translations/index.js';
15
18
  import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
16
- import { getEnvVarSync } from '../utils/env-management.js';
19
+ import { getEnvVarSync, getParsedEnvVarSync } from '../utils/env-management.js';
17
20
  import * as log from '../utils/log.js';
18
21
  import { logMissingCliAuth } from './auth-preflight.js';
19
22
  import { logMissingContentSystemId } from './bootstrap-preflight.js';
23
+ import { createCacheRevalidationHooksPlugin } from './cache-revalidation-hooks.js';
24
+ import { LIMIT_REACHED_VIEW_KEY, LIMIT_REACHED_VIEW_PATH } from './cloud-limits/routes.js';
20
25
  import { getDevCookieNames } from './dev-cookie-names.js';
26
+ import { passesMakeViewerWriteGate, withMakeViewerWriteBaseAccessDefaults } from './make-permission-access/make-permission-access.js';
21
27
  import { createSandboxUploadFetchPlugin } from './sandbox-upload-fetch.js';
22
28
  /**
23
29
  * Worker-trusted marker injected by Figma's sites-worker after it validates the
@@ -28,7 +34,7 @@ import { createSandboxUploadFetchPlugin } from './sandbox-upload-fetch.js';
28
34
  * KEEP_IN_SYNC(cloudflare/wrangler/sites-worker/src/auth.ts): FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER
29
35
  */ export const FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER = 'figma-internal-forwarded-has-auth-bypass';
30
36
  /**
31
- * Fields added to users collection for Figma profile info
37
+ * Fields added to the configured Payload Admin collection for Figma profile info
32
38
  */ const figmaUserFields = [
33
39
  {
34
40
  name: 'figmaHandle',
@@ -161,28 +167,132 @@ function missingOAuthCredential(name) {
161
167
  ok: true
162
168
  };
163
169
  }
170
+ /**
171
+ * Project + environment named in process.env or .env. Uses getEnvVarSync because Next.js
172
+ * evaluates config before dotenv populates process.env.
173
+ */ function readProjectScope() {
174
+ const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
175
+ const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
176
+ if (!projectId || !environmentName) {
177
+ return null;
178
+ }
179
+ return {
180
+ environmentName,
181
+ projectId
182
+ };
183
+ }
184
+ function readCachedBootstrapData() {
185
+ const scope = readProjectScope();
186
+ return scope ? getTokenStore().getBootstrapData(scope.projectId, scope.environmentName) : null;
187
+ }
188
+ /**
189
+ * Resolve the Content API base URL: FIGMA_CONTENT_API_URL (injected in deployed environments),
190
+ * then the environment's regional URL from the bootstrap cache. A cached entry without a URL
191
+ * (written before bootstrap returned one) is refreshed from the API, unless this build already
192
+ * fetched bootstrap. Throws when no URL can be resolved.
193
+ */ async function requireContentApiUrl(args) {
194
+ if (process.env.FIGMA_CONTENT_API_URL) {
195
+ return process.env.FIGMA_CONTENT_API_URL;
196
+ }
197
+ const cached = args.bootstrapData ?? readCachedBootstrapData();
198
+ if (cached?.contentApiUrl) {
199
+ return cached.contentApiUrl;
200
+ }
201
+ const scope = readProjectScope();
202
+ if (!scope) {
203
+ throw new Error('Could not resolve the Content API URL.');
204
+ }
205
+ const message = `Could not resolve the Content API URL for environment "${scope.environmentName}" of project ${scope.projectId}.`;
206
+ if (args.bootstrapFetched) {
207
+ throw new Error(message);
208
+ }
209
+ const resolution = await resolveAndCacheBootstrap(getTokenStore(), scope.projectId, scope.environmentName);
210
+ if (!resolution.ok) {
211
+ throw new Error(`${message} ${describeBootstrapFailure(resolution.reason)}`);
212
+ }
213
+ if (!resolution.data.contentApiUrl) {
214
+ throw new Error(message);
215
+ }
216
+ return resolution.data.contentApiUrl;
217
+ }
218
+ function describeBootstrapFailure(reason) {
219
+ switch(reason.kind){
220
+ case 'environment-not-found':
221
+ return 'Fetching bootstrap data failed: environment not found.';
222
+ case 'network':
223
+ return `Fetching bootstrap data failed: ${reason.message}`;
224
+ case 'unauthenticated':
225
+ return 'Fetching bootstrap data failed: not logged in.';
226
+ }
227
+ }
164
228
  function messageOf(error) {
165
229
  return error instanceof Error ? error.message : 'Unknown error';
166
230
  }
231
+ /**
232
+ * Local-dev fallback: if the tenant config didn't supply a secret (usually
233
+ * because process.env.PAYLOAD_SECRET is unset), try the TokenStore cache,
234
+ * then fetch from the Control Plane. Skipped in Lambda — the platform
235
+ * injects PAYLOAD_SECRET as an env var there, and TokenStore throws in AWS.
236
+ * Returns undefined if we can't resolve one; the caller lets payload.init()
237
+ * throw its own error.
238
+ */ async function resolvePayloadSecretForRuntime(store, projectId, environmentName, tenantInstanceId) {
239
+ const cached = store.getPayloadSecret({
240
+ projectInfo: {
241
+ environmentName,
242
+ projectId
243
+ }
244
+ });
245
+ if (cached) {
246
+ return cached;
247
+ }
248
+ let credential;
249
+ try {
250
+ credential = await getValidCredential(store);
251
+ } catch (error) {
252
+ log.debug(`PAYLOAD_SECRET fetch skipped: ${messageOf(error)}`);
253
+ return undefined;
254
+ }
255
+ if (!credential) {
256
+ log.debug('PAYLOAD_SECRET fetch skipped: no cached CLI credential');
257
+ return undefined;
258
+ }
259
+ try {
260
+ const secret = await getEnvironmentVariableByName(credential, tenantInstanceId, 'PAYLOAD_SECRET');
261
+ store.setPayloadSecret({
262
+ projectInfo: {
263
+ environmentName,
264
+ projectId
265
+ },
266
+ secret
267
+ });
268
+ return secret;
269
+ } catch (error) {
270
+ log.debug(`PAYLOAD_SECRET fetch failed: ${messageOf(error)}`);
271
+ return undefined;
272
+ }
273
+ }
167
274
  /**
168
275
  * Creates storage configuration for upload collections
169
- */ function createStorageConfig(url, contentSystemId) {
170
- const storageConfig = process.env.FIGMA_CONTENT_API_ACCESS_KEY ? {
171
- baseUrl: url,
172
- contentApiKey: process.env.FIGMA_CONTENT_API_ACCESS_KEY
173
- } : process.env.FIGMA_DEV_JWT === 'true' ? {
174
- auth: {
175
- mode: 'devJwt'
176
- },
177
- baseUrl: url,
178
- contentSystemId
179
- } : {
180
- auth: {
181
- mode: 'tokenStore',
182
- tokenStore: getTokenStore()
276
+ */ function createStorageConfig(url, contentSystemId, uploadInstructionsAccess) {
277
+ const storageConfig = {
278
+ ...process.env.FIGMA_CONTENT_API_ACCESS_KEY ? {
279
+ baseUrl: url,
280
+ contentApiKey: process.env.FIGMA_CONTENT_API_ACCESS_KEY
281
+ } : process.env.FIGMA_DEV_JWT === 'true' ? {
282
+ auth: {
283
+ mode: 'devJwt'
284
+ },
285
+ baseUrl: url,
286
+ contentSystemId
287
+ } : {
288
+ auth: {
289
+ mode: 'tokenStore',
290
+ tokenStore: getTokenStore()
291
+ },
292
+ baseUrl: url,
293
+ contentSystemId
183
294
  },
184
- baseUrl: url,
185
- contentSystemId
295
+ uploadInstructionsAccess
186
296
  };
187
297
  const adapter = contentApiStorageAdapter(storageConfig);
188
298
  const storageClient = createStorageClient(storageConfig);
@@ -194,13 +304,13 @@ function messageOf(error) {
194
304
  /**
195
305
  * Plugin that applies cloud storage configuration to all upload-enabled collections.
196
306
  * Runs at the end of the plugin chain so it sees collections added by user plugins too.
197
- */ function createStoragePlugin(url, contentSystemId) {
307
+ */ function createStoragePlugin(url, contentSystemId, uploadInstructionsAccess) {
198
308
  return (incomingConfig)=>{
199
309
  const uploadCollections = (incomingConfig.collections || []).filter((c)=>c.upload);
200
310
  if (uploadCollections.length === 0) {
201
311
  return incomingConfig;
202
312
  }
203
- const { adapter } = createStorageConfig(url, contentSystemId);
313
+ const { adapter } = createStorageConfig(url, contentSystemId, uploadInstructionsAccess);
204
314
  const collectionsMap = uploadCollections.reduce((acc, c)=>{
205
315
  acc[c.slug] = {
206
316
  adapter,
@@ -221,21 +331,22 @@ export async function buildFigmaConfig(config) {
221
331
  let environmentId = config.figma.environmentId ?? process.env.FIGMA_EID;
222
332
  contentSystemId ??= process.env.FIGMA_CONTENT_API_CONTENT_SYSTEM_ID;
223
333
  let bootstrapData = null;
334
+ let bootstrapFetched = false;
224
335
  let bootstrapReason = null;
225
336
  // Local dev: resolve from project ID + bootstrap cache
226
- // Use getEnvVarSync fallback because Next.js evaluates config before dotenv populates process.env
227
337
  if (!contentSystemId) {
228
- const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
229
- const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
230
- if (!projectId || !environmentName) {
338
+ const scope = readProjectScope();
339
+ if (!scope) {
231
340
  bootstrapReason = {
232
341
  kind: 'no-config'
233
342
  };
234
343
  } else {
344
+ const { environmentName, projectId } = scope;
235
345
  const store = getTokenStore();
236
346
  bootstrapData = store.getBootstrapData(projectId, environmentName);
237
347
  // Runtime fallback: fetch from API if not cached (e.g. environment switch without re-init)
238
348
  if (!bootstrapData) {
349
+ bootstrapFetched = true;
239
350
  const resolution = await resolveAndCacheBootstrap(store, projectId, environmentName);
240
351
  if (resolution.ok) {
241
352
  bootstrapData = resolution.data;
@@ -250,12 +361,8 @@ export async function buildFigmaConfig(config) {
250
361
  }
251
362
  }
252
363
  if (!environmentId) {
253
- const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
254
- const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
255
- if (projectId && environmentName) {
256
- bootstrapData ??= getTokenStore().getBootstrapData(projectId, environmentName);
257
- environmentId = bootstrapData?.tenantInstanceId;
258
- }
364
+ bootstrapData ??= readCachedBootstrapData();
365
+ environmentId = bootstrapData?.tenantInstanceId;
259
366
  }
260
367
  if (!environmentId) {
261
368
  throw new Error('Environment ID could not be resolved. Set FIGMA_EID or initialize the project.');
@@ -266,7 +373,13 @@ export async function buildFigmaConfig(config) {
266
373
  });
267
374
  throw new Error('Content System ID could not be resolved. ' + 'Run `npx @payloadcms/figma init` to set up your project.');
268
375
  }
269
- const url = process.env.FIGMA_CONTENT_API_URL || envConfig.contentApiUrl;
376
+ // Only the content-system db adapter and cloud storage call the Content API, so a project on a
377
+ // custom db with storage disabled needs no URL; `url` stays '' and is unused in that case.
378
+ const usesContentSystem = config.figma.useContentSystem !== false;
379
+ const url = usesContentSystem || config.figma.storage !== false ? await requireContentApiUrl({
380
+ bootstrapData,
381
+ bootstrapFetched
382
+ }) : '';
270
383
  const isProduction = process.env.NODE_ENV === 'production';
271
384
  // The deployed Lambda runs all queued jobs; locally there is no runner, so the db adapter logs
272
385
  // a heads-up whenever a job is queued. Deployed environments set DISABLE_LOCAL_JOB_QUEUE_NOTIFICATIONS=true
@@ -278,7 +391,7 @@ export async function buildFigmaConfig(config) {
278
391
  }
279
392
  // Determine database adapter based on environment
280
393
  let db;
281
- if (config.figma.useContentSystem === false) {
394
+ if (!usesContentSystem) {
282
395
  db = config.db;
283
396
  } else if (process.env.FIGMA_CONTENT_API_ACCESS_KEY) {
284
397
  db = contentAPIAdapter({
@@ -314,7 +427,31 @@ export async function buildFigmaConfig(config) {
314
427
  });
315
428
  }
316
429
  const userJobsAccessRun = config.jobs?.access?.run;
317
- // Build complete config with Figma platform defaults
430
+ const adminCollectionSlug = getAdminCollectionSlug(config);
431
+ // Hosted runtimes inject the Content API key and PAYLOAD_SECRET together, so
432
+ // the process env is authoritative. Ordinary local dev still checks the
433
+ // TokenStore first so a leftover .env value cannot shadow the platform secret.
434
+ let resolvedSecret;
435
+ if (process.env.AWS_EXECUTION_ENV || process.env.FIGMA_CONTENT_API_ACCESS_KEY) {
436
+ resolvedSecret = process.env.PAYLOAD_SECRET;
437
+ } else {
438
+ const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
439
+ const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
440
+ if (projectId && environmentName && environmentId) {
441
+ resolvedSecret = await resolvePayloadSecretForRuntime(getTokenStore(), projectId, environmentName, environmentId);
442
+ }
443
+ if (!resolvedSecret) {
444
+ // Config may be evaluated before the framework loads dotenv. Parse the
445
+ // file without mutating process.env, preserving quotes/comments correctly.
446
+ resolvedSecret = process.env.PAYLOAD_SECRET || getParsedEnvVarSync(process.cwd(), 'PAYLOAD_SECRET') || undefined;
447
+ if (resolvedSecret) {
448
+ log.warning('Using a local PAYLOAD_SECRET fallback because the platform secret could not be resolved. ' + 'It may differ from the deployed secret. Run `npx @payloadcms/figma init --id <project-id> --force` to refresh it.');
449
+ }
450
+ }
451
+ }
452
+ // Build complete config with Figma platform defaults.
453
+ // `secret` may be undefined here; payload.init() enforces its presence at
454
+ // runtime, so we relax the intermediate type instead of forging a default.
318
455
  const configWithFigmaDefaults = {
319
456
  ...config,
320
457
  admin: {
@@ -323,11 +460,24 @@ export async function buildFigmaConfig(config) {
323
460
  avatar: {
324
461
  Component: '@payloadcms/figma/client#FigmaAvatar'
325
462
  },
326
- ...config.admin
463
+ ...config.admin,
464
+ components: {
465
+ ...config.admin?.components,
466
+ providers: [
467
+ ...config.admin?.components?.providers ?? [],
468
+ '@payloadcms/figma/client#FigmaCloudLimitProvider'
469
+ ]
470
+ }
327
471
  },
472
+ // Payload applies this policy during sanitization, after user plugins and
473
+ // generated resources have registered their collections and globals.
474
+ baseAccess: withMakeViewerWriteBaseAccessDefaults(config.baseAccess),
328
475
  custom: {
329
476
  figma: {
330
477
  ...config.figma,
478
+ ...typeof config.figma.storage === 'object' ? {
479
+ storage: true
480
+ } : {},
331
481
  contentSystemId,
332
482
  environmentId
333
483
  }
@@ -339,10 +489,15 @@ export async function buildFigmaConfig(config) {
339
489
  health,
340
490
  schema
341
491
  ],
492
+ i18n: {
493
+ ...config.i18n,
494
+ translations: deepMergeSimple(figmaTranslations, config.i18n?.translations ?? {})
495
+ },
496
+ secret: resolvedSecret,
342
497
  // Gate /api/payload-jobs/run and /api/payload-jobs/handle-schedules. Honor the
343
498
  // sites-worker trust marker so Figma infra job runs never break, defer to the
344
- // tenant's jobs.access.run if they set one, otherwise fall back to Payload's
345
- // "logged-in user" default so the admin "Run jobs" UI keeps working.
499
+ // tenant's jobs.access.run if they set one, otherwise require an authenticated
500
+ // user who is not a known Make viewer.
346
501
  jobs: {
347
502
  ...config.jobs ?? {},
348
503
  access: {
@@ -354,26 +509,42 @@ export async function buildFigmaConfig(config) {
354
509
  if (userJobsAccessRun) {
355
510
  return userJobsAccessRun(args);
356
511
  }
357
- return !!args.req.user;
512
+ // Allow undefined Make permissions during rollout, but fail closed for empty,
513
+ // explicit view, and other unrecognized values.
514
+ return Boolean(args.req.user) && passesMakeViewerWriteGate(args.req.user);
358
515
  }
359
- }
516
+ },
517
+ // Remove Payload's default read/write denials so the jobs collection uses
518
+ // the standard access defaults and baseAccess Make-permission write gate.
519
+ // Preserve tenant-supplied overrides; jobs.access.run separately controls
520
+ // the job execution endpoints.
521
+ jobsCollectionOverrides: config.jobs?.jobsCollectionOverrides ?? (({ defaultJobsCollection })=>{
522
+ const { access: _access, ...rest } = defaultJobsCollection;
523
+ return rest;
524
+ })
360
525
  },
361
526
  ...isProduction && !config.logger ? {
362
527
  logger: {
363
528
  options: {}
364
529
  }
365
530
  } : {},
366
- secret: 'MY_SECRET',
531
+ // The platform owns rotation of PAYLOAD_SECRET; this compat entry lets
532
+ // data encrypted under the old shared hosted secret keep decrypting.
533
+ // Appended last so any tenant-supplied previousSecrets are honored first.
534
+ previousSecrets: [
535
+ ...config.previousSecrets ?? [],
536
+ Buffer.from('TVlfU0VDUkVU', 'base64').toString('utf8')
537
+ ],
367
538
  // Add oauth to plugins if not already present
368
539
  plugins: [
369
540
  ...config.plugins ?? [],
370
541
  ...config.figma.storage !== false ? [
371
- createStoragePlugin(url, contentSystemId)
542
+ createStoragePlugin(url, contentSystemId, typeof config.figma.storage === 'object' ? config.figma.storage.uploadInstructionsAccess : undefined)
372
543
  ] : [],
373
544
  oAuth2Plugin({
374
545
  collections: [
375
546
  {
376
- slug: 'users',
547
+ slug: adminCollectionSlug,
377
548
  // Use adapter because Figma app doesn't support OIDC scopes
378
549
  authorizationURLParams: {
379
550
  response_mode: 'query',
@@ -394,23 +565,53 @@ export async function buildFigmaConfig(config) {
394
565
  disabled: false
395
566
  }),
396
567
  scheduleExtractPlugin(),
397
- // Not folded into createStoragePlugin: that one is skipped when
398
- // figma.storage is false, which would break remote uploads for those apps.
399
- createSandboxUploadFetchPlugin()
568
+ // Not folded into createStoragePlugin, which is skipped when
569
+ // figma.storage is false and would break remote uploads for those apps.
570
+ createSandboxUploadFetchPlugin({
571
+ userCollections: config.collections
572
+ }),
573
+ // Keep last so hooks added by app plugins also get the missing Next cache
574
+ // context guard used by Payload CLI operations in the Make sandbox.
575
+ createCacheRevalidationHooksPlugin()
400
576
  ]
401
577
  };
402
- // Inject figma fields into users collection
578
+ // Inject Figma-managed identity fields only into the Payload Admin collection.
403
579
  const collections = configWithFigmaDefaults.collections?.map((col)=>{
404
- if (col.slug === 'users') {
580
+ const views = col.admin?.components?.views;
581
+ const withLimitView = usesContentSystem ? {
582
+ ...col,
583
+ admin: {
584
+ ...col.admin,
585
+ components: {
586
+ ...col.admin?.components,
587
+ edit: {
588
+ ...col.admin?.components?.edit,
589
+ beforeDocumentControls: [
590
+ '@payloadcms/figma/client#FigmaCloudLimitSlugTracker',
591
+ ...col.admin?.components?.edit?.beforeDocumentControls ?? []
592
+ ]
593
+ },
594
+ views: {
595
+ ...views,
596
+ [LIMIT_REACHED_VIEW_KEY]: {
597
+ Component: '@payloadcms/figma/views#LimitReachedView',
598
+ exact: true,
599
+ path: LIMIT_REACHED_VIEW_PATH
600
+ }
601
+ }
602
+ }
603
+ }
604
+ } : col;
605
+ if (col.slug === adminCollectionSlug) {
405
606
  return {
406
- ...col,
607
+ ...withLimitView,
407
608
  fields: [
408
609
  ...col.fields || [],
409
610
  ...figmaUserFields
410
611
  ]
411
612
  };
412
613
  }
413
- return col;
614
+ return withLimitView;
414
615
  });
415
616
  if (collections) {
416
617
  configWithFigmaDefaults.collections = collections;
@@ -0,0 +1,6 @@
1
+ import type { Plugin } from 'payload';
2
+ /**
3
+ * Prevent Next cache invalidation from turning a successful Payload mutation
4
+ * into an apparent failure when the mutation runs outside a Next request.
5
+ */
6
+ export declare function createCacheRevalidationHooksPlugin(): Plugin;
@@ -0,0 +1,69 @@
1
+ const missingNextCacheContext = /^Invariant: static generation store missing in (?:revalidateTag|revalidatePath|updateTag)\b/;
2
+ const unsupportedUpdateTagContext = /^updateTag can only be called from within a Server Action\./;
3
+ /**
4
+ * Next cache invalidation requires request-scoped state. Payload's Local API has
5
+ * no Next request when it runs from the CLI in a Make sandbox, so Next throws
6
+ * after the database write has already committed. Treat only that missing-
7
+ * context error as a no-op; cache invalidation still runs normally in a Next
8
+ * request, and all other hook failures retain their existing behavior.
9
+ */ function isUnsupportedNextCacheContextError(error) {
10
+ if (!(error instanceof Error)) {
11
+ return false;
12
+ }
13
+ const errorCode = error.__NEXT_ERROR_CODE;
14
+ if (missingNextCacheContext.test(error.message)) {
15
+ return errorCode === undefined || errorCode === 'E263';
16
+ }
17
+ if (unsupportedUpdateTagContext.test(error.message)) {
18
+ return errorCode === undefined || errorCode === 'E872';
19
+ }
20
+ return false;
21
+ }
22
+ function reportIgnoredRevalidation(args, hookName) {
23
+ const hookArgs = args[0];
24
+ hookArgs?.req?.payload?.logger?.warn({
25
+ hook: hookName,
26
+ msg: 'Ignored Next cache invalidation outside a supported request context'
27
+ });
28
+ }
29
+ function wrapHook(hook, hookName) {
30
+ return async (...args)=>{
31
+ try {
32
+ return await hook(...args);
33
+ } catch (error) {
34
+ if (isUnsupportedNextCacheContextError(error)) {
35
+ reportIgnoredRevalidation(args, hookName);
36
+ return undefined;
37
+ }
38
+ throw error;
39
+ }
40
+ };
41
+ }
42
+ function wrapHooks(hooks) {
43
+ if (!hooks) {
44
+ return hooks;
45
+ }
46
+ return Object.fromEntries(Object.entries(hooks).map(([name, value])=>[
47
+ name,
48
+ Array.isArray(value) ? value.map((hook)=>typeof hook === 'function' ? wrapHook(hook, name) : hook) : value
49
+ ]));
50
+ }
51
+ /**
52
+ * Prevent Next cache invalidation from turning a successful Payload mutation
53
+ * into an apparent failure when the mutation runs outside a Next request.
54
+ */ export function createCacheRevalidationHooksPlugin() {
55
+ const plugin = (config)=>({
56
+ ...config,
57
+ collections: config.collections?.map((collection)=>({
58
+ ...collection,
59
+ hooks: wrapHooks(collection.hooks)
60
+ })),
61
+ globals: config.globals?.map((global)=>({
62
+ ...global,
63
+ hooks: wrapHooks(global.hooks)
64
+ }))
65
+ });
66
+ // Run after tenant plugins so hooks they add receive the same guard.
67
+ plugin.order = Number.POSITIVE_INFINITY;
68
+ return plugin;
69
+ }
@@ -0,0 +1,9 @@
1
+ import type { ReactElement } from 'react';
2
+ import './index.scss';
3
+ type Props = {
4
+ collectionLabel?: string;
5
+ collectionListURL?: string;
6
+ onRetry: () => void;
7
+ };
8
+ export declare function FigmaCloudLimitDocumentCountModal({ collectionLabel, collectionListURL, onRetry, }: Props): ReactElement;
9
+ export {};
@@ -0,0 +1,66 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button, DialogBody, DialogCancel, DialogFooter, DialogHeader, DialogModal, useModal, useTranslation } from '@payloadcms/ui';
4
+ import { ExternalLinkIcon } from '../icons/ExternalLinkIcon.js';
5
+ import { cloudLimitDocumentCountModalSlug } from '../shared.js';
6
+ import './index.scss';
7
+ const baseClass = 'figma-cloud-limit-modal';
8
+ export function FigmaCloudLimitDocumentCountModal({ collectionLabel, collectionListURL, onRetry }) {
9
+ const { t } = useTranslation();
10
+ const { closeModal } = useModal();
11
+ return /*#__PURE__*/ _jsxs(DialogModal, {
12
+ size: "small",
13
+ slug: cloudLimitDocumentCountModalSlug,
14
+ children: [
15
+ /*#__PURE__*/ _jsx(DialogHeader, {
16
+ showClose: true,
17
+ title: t('figma:cloudLimitModalHeading')
18
+ }),
19
+ /*#__PURE__*/ _jsx(DialogBody, {
20
+ children: /*#__PURE__*/ _jsx("p", {
21
+ className: `${baseClass}__body`,
22
+ children: t('figma:cloudLimitModalBody')
23
+ })
24
+ }),
25
+ /*#__PURE__*/ _jsx(DialogFooter, {
26
+ children: /*#__PURE__*/ _jsxs("div", {
27
+ className: `${baseClass}__footer`,
28
+ children: [
29
+ collectionLabel && collectionListURL ? /*#__PURE__*/ _jsxs("a", {
30
+ className: `${baseClass}__review-btn`,
31
+ href: collectionListURL,
32
+ onClick: ()=>closeModal(cloudLimitDocumentCountModalSlug),
33
+ children: [
34
+ /*#__PURE__*/ _jsx("span", {
35
+ className: `${baseClass}__review-btn-label`,
36
+ children: t('figma:cloudLimitModalReviewCollection', {
37
+ collection: collectionLabel
38
+ })
39
+ }),
40
+ /*#__PURE__*/ _jsx(ExternalLinkIcon, {})
41
+ ]
42
+ }) : null,
43
+ /*#__PURE__*/ _jsxs("div", {
44
+ className: `${baseClass}__actions`,
45
+ children: [
46
+ /*#__PURE__*/ _jsx(DialogCancel, {
47
+ label: t('figma:cloudLimitModalConfirm')
48
+ }),
49
+ /*#__PURE__*/ _jsx(Button, {
50
+ buttonStyle: "primary",
51
+ margin: false,
52
+ onClick: ()=>{
53
+ closeModal(cloudLimitDocumentCountModalSlug);
54
+ onRetry();
55
+ },
56
+ size: "medium",
57
+ children: t('figma:cloudLimitModalRetry')
58
+ })
59
+ ]
60
+ })
61
+ ]
62
+ })
63
+ })
64
+ ]
65
+ });
66
+ }
@@ -0,0 +1,56 @@
1
+ .figma-cloud-limit-modal {
2
+ &__body {
3
+ margin: 0;
4
+ }
5
+
6
+ &__footer {
7
+ align-items: center;
8
+ display: flex;
9
+ gap: var(--spacer-4);
10
+ width: 100%;
11
+ }
12
+
13
+ &__review-btn {
14
+ align-items: center;
15
+ background: none;
16
+ border: none;
17
+ color: var(--color-text-brand);
18
+ cursor: pointer;
19
+ display: inline-flex;
20
+ flex-shrink: 1;
21
+ font-size: var(--text-body-medium-font-size);
22
+ gap: var(--spacer-1);
23
+ min-width: 0;
24
+ padding: 0;
25
+
26
+ .btn__content,
27
+ .btn__label {
28
+ min-width: 0;
29
+ }
30
+
31
+ &:hover {
32
+ color: var(--ramp-blue-700);
33
+ }
34
+
35
+ &:active {
36
+ color: var(--ramp-blue-800);
37
+ }
38
+ }
39
+
40
+ &__review-btn-label {
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ white-space: nowrap;
44
+ }
45
+
46
+ // Prevents the icon from shrinking when the label ellipses.
47
+ &__review-btn svg {
48
+ flex-shrink: 0;
49
+ }
50
+
51
+ &__actions {
52
+ display: flex;
53
+ gap: var(--spacer-2);
54
+ margin-inline-start: auto;
55
+ }
56
+ }
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function FigmaCloudLimitProvider({ children }: {
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;