@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
@@ -102,6 +102,10 @@ import { convertPayloadWhereToContentAPI } from './where.js';
102
102
  const effectiveLimit = joinQuery.limit ?? foundJoin.defaultLimit;
103
103
  // Add fallback sort for the joined collection
104
104
  const sortWithFallback = addFallbackSort(joinQuery.sort, payload, foundJoin.collectionSlug, foundJoin.defaultSort);
105
+ // A join's `where` filters the *joined* collection, so id coercion resolves against
106
+ // that collection (the first target for a polymorphic join; `id` is coerced regardless).
107
+ const joinedSlug = Array.isArray(foundJoin.collectionSlug) ? foundJoin.collectionSlug[0] : foundJoin.collectionSlug;
108
+ const whereConverted = convertPayloadWhereToContentAPI(joinQuery.where, payload, joinedSlug, false);
105
109
  const contentAPIJoin = {
106
110
  count: joinQuery.count ?? false,
107
111
  path: joinPath,
@@ -115,7 +119,7 @@ import { convertPayloadWhereToContentAPI } from './where.js';
115
119
  sort: sortWithFallback
116
120
  },
117
121
  ...joinQuery.where && {
118
- where: convertPayloadWhereToContentAPI(joinQuery.where)
122
+ where: whereConverted
119
123
  }
120
124
  };
121
125
  result.push(contentAPIJoin);
@@ -0,0 +1,10 @@
1
+ import type { Field, Payload } from 'payload';
2
+ export interface ResolveContext {
3
+ readonly fieldCache: Map<string, boolean>;
4
+ readonly fields: Field[];
5
+ readonly isVersions: boolean;
6
+ readonly payload: Payload;
7
+ }
8
+ /** Walks a path's segments against a field list, reporting whether it lands on a
9
+ * relationship/upload field's id-bearing value. */
10
+ export declare function resolvesToRelationshipValue(segments: string[], fields: Field[], ctx: ResolveContext): boolean;
@@ -0,0 +1,95 @@
1
+ import { resolveBlocks } from '../resolveBlocks.js';
2
+ /** Walks a path's segments against a field list, reporting whether it lands on a
3
+ * relationship/upload field's id-bearing value. */ export function resolvesToRelationshipValue(segments, fields, ctx) {
4
+ const [head, ...rest] = segments;
5
+ if (head == null) {
6
+ return false;
7
+ }
8
+ const field = findNamedField(fields, head);
9
+ if (field == null) {
10
+ return false;
11
+ }
12
+ switch(field.type){
13
+ case 'array':
14
+ return 'fields' in field && resolvesToRelationshipValue(skipLocaleSegment(rest, field, ctx), field.fields, ctx);
15
+ case 'blocks':
16
+ {
17
+ if (!('blocks' in field)) {
18
+ return false;
19
+ }
20
+ // Any block whose fields the remaining path resolves through makes it id-bearing:
21
+ // one path can only mean one thing, whichever block supplied the field.
22
+ const childSegments = skipLocaleSegment(rest, field, ctx);
23
+ return resolveBlocks(field.blocks, ctx.payload.config.blocks).some((block)=>resolvesToRelationshipValue(childSegments, block.fields, ctx));
24
+ }
25
+ case 'group':
26
+ return 'fields' in field && resolvesToRelationshipValue(rest, field.fields, ctx);
27
+ case 'relationship':
28
+ case 'upload':
29
+ // A polymorphic field's id sits at `<path>.value`; its `.relationTo` is a slug.
30
+ if (Array.isArray(field.relationTo)) {
31
+ return rest.length === 1 && rest[0] === 'value';
32
+ }
33
+ // A single-target field's id sits at the field's own path.
34
+ if (rest.length === 0) {
35
+ return true;
36
+ }
37
+ // Payload accepts an explicit `<path>.id` for that same value —
38
+ // `getTableColumnFromPath` treats the bare path and `.id` as one column — which the
39
+ // Content API resolves as a traversal into the related collection's, equally text, id.
40
+ return rest.length === 1 && rest[0] === 'id';
41
+ default:
42
+ return false;
43
+ }
44
+ }
45
+ /** Finds the field a path segment names. Unnamed containers (row, collapsible, unnamed tab)
46
+ * are transparent to query paths, so their children are searched too; a named tab nests its
47
+ * fields under its own name, exactly like a group. */ function findNamedField(fields, name) {
48
+ for (const field of fields){
49
+ if ('name' in field && field.name) {
50
+ // A named container's children need its name consumed first, so only match the
51
+ // container itself here.
52
+ if (field.name === name) {
53
+ return field;
54
+ }
55
+ continue;
56
+ }
57
+ if ('fields' in field && Array.isArray(field.fields)) {
58
+ const match = findNamedField(field.fields, name);
59
+ if (match) {
60
+ return match;
61
+ }
62
+ }
63
+ if ('tabs' in field && Array.isArray(field.tabs)) {
64
+ for (const tab of field.tabs){
65
+ if (!tab.fields) {
66
+ continue;
67
+ }
68
+ if (!tab.name) {
69
+ const match = findNamedField(tab.fields, name);
70
+ if (match) {
71
+ return match;
72
+ }
73
+ } else if (tab.name === name) {
74
+ return {
75
+ name: tab.name,
76
+ type: 'group',
77
+ fields: tab.fields
78
+ };
79
+ }
80
+ }
81
+ }
82
+ }
83
+ return undefined;
84
+ }
85
+ // A localized array/blocks field is stored as a locale map, so its children's paths carry a
86
+ // locale key (`items.en.rel`) — see `normalizeLocaleInWhere`, which runs before this.
87
+ // Locale keys are *only* added to `array` and `blocks`.
88
+ function skipLocaleSegment(segments, field, ctx) {
89
+ const localization = ctx.payload.config.localization;
90
+ if (!localization || !('localized' in field) || !field.localized) {
91
+ return segments;
92
+ }
93
+ const [head] = segments;
94
+ return head != null && localization.localeCodes.includes(head) ? segments.slice(1) : segments;
95
+ }
@@ -0,0 +1,9 @@
1
+ import type { Payload, Where } from 'payload';
2
+ /**
3
+ * Stringifies numeric operands on a Where clause's id-bearing paths (`id`, `parent` for
4
+ * versions, and relationship-value paths), so a custom-numeric-id filter matches the
5
+ * Content API's text storage. Returns the clause untouched when there is nothing to
6
+ * convert. `isVersions` treats `parent` (the parent document's id) as id-bearing and looks
7
+ * for the collection's own fields under `version.`.
8
+ */
9
+ export declare function stringifyIdsInWhere(where: undefined | Where, payload: Payload, collectionSlug: string, isVersions: boolean): undefined | Where;
@@ -0,0 +1,112 @@
1
+ import { resolvesToRelationshipValue } from './resolvesToRelationshipValue.js';
2
+ // The Content API stores every document id and every relationship value as text, but
3
+ // Payload keeps a collection's custom numeric id as a `number`. So a filter that carries
4
+ // a numeric id would never match the stored string form. This is the sole place the
5
+ // adapter translates those query-side ids to the wire's string form (the data-side
6
+ // counterpart is `convertRelationshipIds`); `convertPayloadWhereToContentAPI` itself is
7
+ // purely structural.
8
+ //
9
+ // A condition's path is id-bearing when it resolves to:
10
+ // - `id` — the document's own id (always).
11
+ // - `parent` — the parent document's id, on a *versions* query (`isVersions`).
12
+ // - a relationship/upload field's value: the field's own path for a single-target field
13
+ // (`rel: { equals: 999 }`), or `<path>.value` for a polymorphic one
14
+ // (`rel.value: { equals: 999 }`). A polymorphic field's `.relationTo` is a slug, not
15
+ // an id, so it is deliberately left alone.
16
+ //
17
+ // Every stored id is text, so a bare "stringify any numeric operand on this path" is
18
+ // sufficient — no per-target id-type resolution is needed (which also handles a
19
+ // polymorphic `in` array that mixes targets).
20
+ /**
21
+ * Stringifies numeric operands on a Where clause's id-bearing paths (`id`, `parent` for
22
+ * versions, and relationship-value paths), so a custom-numeric-id filter matches the
23
+ * Content API's text storage. Returns the clause untouched when there is nothing to
24
+ * convert. `isVersions` treats `parent` (the parent document's id) as id-bearing and looks
25
+ * for the collection's own fields under `version.`.
26
+ */ export function stringifyIdsInWhere(where, payload, collectionSlug, isVersions) {
27
+ if (!where) {
28
+ return where;
29
+ }
30
+ // An unknown slug names no fields, but `id` (and `parent` on a versions query) is
31
+ // id-bearing regardless of the config, so still walk the clause with an empty field list:
32
+ // discarding it here would turn the query into a match-all.
33
+ const config = payload.config.collections.find((c)=>c.slug === collectionSlug);
34
+ const fields = config?.fields ?? [];
35
+ const fieldCache = new Map();
36
+ return transformWhere(where, {
37
+ fieldCache,
38
+ fields,
39
+ isVersions,
40
+ payload
41
+ });
42
+ }
43
+ /** Recursively transforms a Where clause, stringifying numeric operands on any condition
44
+ * whose path is id-bearing. */ function transformWhere(where, context) {
45
+ const result = {};
46
+ for (const [key, value] of Object.entries(where)){
47
+ const keyLower = key.toLowerCase();
48
+ if (keyLower === 'and' || keyLower === 'or') {
49
+ const targetValue = where[key];
50
+ if (targetValue == null || !Array.isArray(targetValue)) {
51
+ continue;
52
+ }
53
+ result[key] = targetValue.map((clause)=>transformWhere(clause, context));
54
+ } else if (isIdBearingPath(key, context)) {
55
+ result[key] = stringifyNumericOperands(value);
56
+ } else {
57
+ result[key] = value;
58
+ }
59
+ }
60
+ return result;
61
+ }
62
+ /** Whether a condition's path resolves to an id. */ function isIdBearingPath(path, context) {
63
+ const cachedResult = context.fieldCache.get(path);
64
+ if (cachedResult != null) {
65
+ return cachedResult;
66
+ }
67
+ // GraphQL spells a nested path with `__`, since dots are invalid in GraphQL names; the
68
+ // structural conversion normalizes those the same way.
69
+ const segments = path.replace(/__/g, '.').split('.');
70
+ // The document's own id — on a versions query, the version document's own id.
71
+ if (segments.length === 1 && segments[0] === 'id') {
72
+ return true;
73
+ }
74
+ if (context.isVersions) {
75
+ // `parent` is a version-only field that contains an ID.
76
+ if (segments.length === 1) {
77
+ return segments[0] === 'parent';
78
+ }
79
+ // The only other paths that can contain IDs are in the version envelope.
80
+ if (segments[0] !== 'version') {
81
+ return false;
82
+ }
83
+ }
84
+ // Normalize the path segments by removing the `version` envelope for paths
85
+ // in document versions.
86
+ const normalizedSegments = context.isVersions ? segments.slice(1) : segments;
87
+ return resolvesToRelationshipValue(normalizedSegments, context.fields, context);
88
+ }
89
+ function stringifyNumericOperands(condition) {
90
+ // Payload's shorthand — `{ id: 999 }` rather than `{ id: { equals: 999 } }` — carries the
91
+ // operand directly, with no operator keys to walk. The structural conversion reads it as
92
+ // an implicit `equals`, so coerce it in place: walking a primitive as an operator map
93
+ // would drop the condition entirely and turn the query into a match-all.
94
+ if (condition === null || typeof condition !== 'object' || Array.isArray(condition)) {
95
+ return stringifyNumbers(condition);
96
+ }
97
+ const result = {};
98
+ for (const [operator, operand] of Object.entries(condition)){
99
+ result[operator] = stringifyNumbers(operand);
100
+ }
101
+ return result;
102
+ }
103
+ /** A number becomes its string form; a number inside an array does too (e.g. `in`);
104
+ * everything else passes through untouched. */ function stringifyNumbers(value) {
105
+ if (typeof value === 'number') {
106
+ return String(value);
107
+ }
108
+ if (Array.isArray(value)) {
109
+ return value.map((entry)=>typeof entry === 'number' ? String(entry) : entry);
110
+ }
111
+ return value;
112
+ }
@@ -29,11 +29,11 @@ export function buildDocumentSchema(config) {
29
29
  };
30
30
  const collections = {};
31
31
  for (const collection of config.collections ?? []){
32
- collections[collection.slug] = buildCollectionSchema(collection.slug, collection.fields, blockRegistry);
32
+ collections[collection.slug] = buildCollectionSchema(collection.slug, collection.fields, blockRegistry, collection.indexes ?? []);
33
33
  }
34
34
  for (const global of config.globals ?? []){
35
35
  const slug = `_global-${global.slug}`;
36
- collections[slug] = buildCollectionSchema(slug, global.fields, blockRegistry);
36
+ collections[slug] = buildCollectionSchema(slug, global.fields, blockRegistry, []);
37
37
  }
38
38
  return {
39
39
  blocks: blockRegistry.blocksById,
@@ -41,7 +41,7 @@ export function buildDocumentSchema(config) {
41
41
  version: 1
42
42
  };
43
43
  }
44
- function buildCollectionSchema(name, fields, blockRegistry) {
44
+ function buildCollectionSchema(name, fields, blockRegistry, indexes) {
45
45
  const paths = {};
46
46
  collectPaths(fields, paths, {
47
47
  blockRegistry,
@@ -59,9 +59,14 @@ function buildCollectionSchema(name, fields, blockRegistry) {
59
59
  localized: false
60
60
  };
61
61
  }
62
+ // Field-level unique flags cannot express Payload's compound collection indexes.
63
+ const hints = indexes.filter((index)=>index.unique).map((index)=>({
64
+ type: 'unique',
65
+ paths: index.fields
66
+ }));
62
67
  return {
63
68
  name,
64
- hints: [],
69
+ hints,
65
70
  paths
66
71
  };
67
72
  }
@@ -0,0 +1,3 @@
1
+ import type { Config, SanitizedConfig } from 'payload';
2
+ import type { DocumentSchemaWire } from './buildDocumentSchema.js';
3
+ export declare function getDocumentSchema(config: Config | SanitizedConfig): DocumentSchemaWire;
@@ -0,0 +1,24 @@
1
+ import { buildDocumentSchema } from './buildDocumentSchema.js';
2
+ // The schema built by `getDocumentSchema`, keyed by the config it was built from.
3
+ // Weakly held so a config discarded by HMR takes its schema with it.
4
+ let schemaByConfig = new WeakMap();
5
+ // Retrieves a document schema for the given config, building it if necessary.
6
+ // The last output is memoized, so if this config matches the last config we just return
7
+ // the previous output instead of rebuilding it.
8
+ export function getDocumentSchema(config) {
9
+ const existing = schemaByConfig.get(config);
10
+ if (existing != null) {
11
+ return existing;
12
+ }
13
+ const schema = buildDocumentSchema(config);
14
+ // Clear the cache of any previous config, so only the most recent one is held.
15
+ // This ensures that we never accidentally leak memory by holding on to more
16
+ // and more schemas if the configs are never garbage collected.
17
+ schemaByConfig = new WeakMap([
18
+ [
19
+ config,
20
+ schema
21
+ ]
22
+ ]);
23
+ return schema;
24
+ }
@@ -1,9 +1,5 @@
1
- import type { Where } from 'payload';
1
+ import type { Payload, Where } from 'payload';
2
2
  import type { components } from '../generated/content-api-types.js';
3
3
  type WhereClauseV1 = components['schemas']['WhereClauseV1'];
4
- type ConvertOptions = {
5
- /** Internal flag to track if we're inside a logical operator (and/or) */
6
- insideLogicalOperator?: boolean;
7
- };
8
- export declare function convertPayloadWhereToContentAPI(where: undefined | Where, options?: ConvertOptions): WhereClauseV1;
4
+ export declare function convertPayloadWhereToContentAPI(where: undefined | Where, payload: Payload, collectionSlug: string, isVersions: boolean): WhereClauseV1;
9
5
  export {};
@@ -1,4 +1,21 @@
1
- export function convertPayloadWhereToContentAPI(where, options = {}) {
1
+ import { stringifyIdsInWhere } from './meta/stringifyIdsInWhere.js';
2
+ // Payload's format: { fieldName: { operator: value }, and: [...], or: [...] }
3
+ // Content API expects: { and: [{ path, operator, value }], or: [{ path, operator, value }] }
4
+ //
5
+ // The format stays different. This allows the Content API to evolve its filter schema,
6
+ // for example to support composite types like Point, which are not lexicographically sortable.
7
+ // Semantics must remain identical to Payload.
8
+ export function convertPayloadWhereToContentAPI(where, payload, collectionSlug, isVersions) {
9
+ // Normalize id-bearing operands to the wire's string form (custom numeric ids), then
10
+ // convert Payload's where shape to the Content API's. The two steps are inseparable —
11
+ // every id filter must be coerced — so they live behind this single entry point.
12
+ return convertStructure(stringifyIdsInWhere(where, payload, collectionSlug, isVersions), {
13
+ insideLogicalOperator: false
14
+ });
15
+ }
16
+ // The structural Payload → Content API conversion. Assumes id operands have already been
17
+ // coerced to the wire's string form (see `convertPayloadWhereToContentAPI`).
18
+ function convertStructure(where, options) {
2
19
  // Empty where {} should be { and: [] } not undefined
3
20
  // Content API requires a where clause structure even for "no filter"
4
21
  if (!where || Object.keys(where).length === 0) {
@@ -10,7 +27,7 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
10
27
  for (const [key, value] of Object.entries(where)){
11
28
  const keyLower = key.toLowerCase();
12
29
  if (keyLower === 'and' || keyLower === 'or') {
13
- const nestedConditions = value.map((item)=>convertPayloadWhereToContentAPI(item, {
30
+ const nestedConditions = value.map((item)=>convertStructure(item, {
14
31
  ...options,
15
32
  insideLogicalOperator: true
16
33
  })).filter((condition)=>{
@@ -42,7 +59,7 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
42
59
  conditions.push({
43
60
  operator: 'equals',
44
61
  path: fieldPath,
45
- value: fieldPath === 'id' && typeof value === 'number' ? String(value) : value
62
+ value
46
63
  });
47
64
  continue;
48
65
  }
@@ -67,12 +84,6 @@ export function convertPayloadWhereToContentAPI(where, options = {}) {
67
84
  if (finalValue === 'null') {
68
85
  finalValue = null;
69
86
  }
70
- // Content API stores all document IDs as strings.
71
- // Payload sends numeric values for collections with custom numeric ID fields,
72
- // so we must stringify to match.
73
- if (fieldPath === 'id' && typeof finalValue === 'number') {
74
- finalValue = String(finalValue);
75
- }
76
87
  conditions.push({
77
88
  operator: op,
78
89
  path: fieldPath,
@@ -2,3 +2,5 @@ export { FigmaAvatar } from '../oauth/components/FigmaAvatar/index.js';
2
2
  export { FigmaAvatarCell } from '../oauth/components/FigmaAvatarCell/index.js';
3
3
  export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
4
4
  export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
5
+ export { FigmaCloudLimitProvider } from '../plugin/cloud-limits/CloudLimitProvider/index.js';
6
+ export { FigmaCloudLimitSlugTracker } from '../plugin/cloud-limits/SlugTracker/index.js';
@@ -2,3 +2,5 @@ export { FigmaAvatar } from '../oauth/components/FigmaAvatar/index.js';
2
2
  export { FigmaAvatarCell } from '../oauth/components/FigmaAvatarCell/index.js';
3
3
  export { DefaultLoginButton } from '../oauth/components/LoginButton/index.js';
4
4
  export { LogoutButton } from '../oauth/components/LogoutButton/index.js';
5
+ export { FigmaCloudLimitProvider } from '../plugin/cloud-limits/CloudLimitProvider/index.js';
6
+ export { FigmaCloudLimitSlugTracker } from '../plugin/cloud-limits/SlugTracker/index.js';
@@ -0,0 +1 @@
1
+ export { LimitReachedView } from '../plugin/cloud-limits/LimitReachedView/index.js';
@@ -0,0 +1 @@
1
+ export { LimitReachedView } from '../plugin/cloud-limits/LimitReachedView/index.js';
@@ -0,0 +1,23 @@
1
+ import type { RequestInitCfPropertiesImage } from '@cloudflare/workers-types';
2
+ type CloudflareWorkerImageOptions = RequestInitCfPropertiesImage;
3
+ export declare const supportedCloudflareImageOptionKeys: readonly ["anim", "background", "blur", "border", "brightness", "compression", "contrast", "dpr", "fit", "flip", "format", "gamma", "gravity", "height", "metadata", "quality", "rotate", "saturation", "segment", "sharpen", "trim", "upscale", "width", "zoom"];
4
+ type SupportedCloudflareImageOptionKey = (typeof supportedCloudflareImageOptionKeys)[number];
5
+ type SupportedCloudflareImageOptions = Pick<CloudflareWorkerImageOptions, SupportedCloudflareImageOptionKey>;
6
+ type CloudflareImageSizeFormat = Exclude<NonNullable<SupportedCloudflareImageOptions['format']>, 'json' | 'svg'>;
7
+ type CloudflareImageSizeOptionsExceptFormat = Omit<SupportedCloudflareImageOptions, 'format'>;
8
+ /**
9
+ * Options accepted for a reusable Payload image-size preset.
10
+ *
11
+ * Presets can control the generated image, but cannot use remote overlays or
12
+ * forward authentication to an image origin. Formats that do not produce a
13
+ * supported stored image are also excluded.
14
+ */
15
+ export type CloudflareImageSizeOptions = {
16
+ format?: CloudflareImageSizeFormat;
17
+ } & CloudflareImageSizeOptionsExceptFormat;
18
+ declare module 'payload' {
19
+ interface RegisteredImageSizeOptions {
20
+ figma: CloudflareImageSizeOptions;
21
+ }
22
+ }
23
+ export {};
@@ -0,0 +1,26 @@
1
+ export const supportedCloudflareImageOptionKeys = [
2
+ 'anim',
3
+ 'background',
4
+ 'blur',
5
+ 'border',
6
+ 'brightness',
7
+ 'compression',
8
+ 'contrast',
9
+ 'dpr',
10
+ 'fit',
11
+ 'flip',
12
+ 'format',
13
+ 'gamma',
14
+ 'gravity',
15
+ 'height',
16
+ 'metadata',
17
+ 'quality',
18
+ 'rotate',
19
+ 'saturation',
20
+ 'segment',
21
+ 'sharpen',
22
+ 'trim',
23
+ 'upscale',
24
+ 'width',
25
+ 'zoom'
26
+ ];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { contentAPIAdapter } from './db-content-api/index.js';
2
+ export type { CloudflareImageSizeOptions } from './imageSizeOptions.js';
2
3
  export { figmaContentSystem } from './plugin/adapter.js';
3
4
  export type { FigmaContentSystemOptions } from './plugin/adapter.js';
4
5
  export { buildFigmaConfig } from './plugin/build-config.js';
5
6
  export type { FigmaConfig } from './plugin/build-config.js';
7
+ export { passesMakeViewerWriteGate } from './plugin/make-permission-access/make-permission-access.js';
package/dist/index.js CHANGED
@@ -4,3 +4,5 @@ export { contentAPIAdapter } from './db-content-api/index.js';
4
4
  export { figmaContentSystem } from './plugin/adapter.js';
5
5
  // Export buildConfig wrapper and its config type
6
6
  export { buildFigmaConfig } from './plugin/build-config.js';
7
+ // Export the Make permission predicate for slug-specific baseAccess overrides.
8
+ export { passesMakeViewerWriteGate } from './plugin/make-permission-access/make-permission-access.js';
@@ -0,0 +1,12 @@
1
+ export type WriteAgentConfigResult = {
2
+ agentsMd: 'appended' | 'created' | 'unchanged';
3
+ claudeMd: 'appended' | 'created' | 'unchanged';
4
+ };
5
+ /**
6
+ * Write the root AI-agent pointer files so assistants can find the Payload
7
+ * skill bundled in node_modules. Idempotent: creates when absent, appends the
8
+ * pointer when a file exists without it, and no-ops when already present.
9
+ */
10
+ export declare function writeAgentConfigFiles(args: {
11
+ projectDir: string;
12
+ }): Promise<WriteAgentConfigResult>;
@@ -0,0 +1,52 @@
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ const SKILL_POINTER_PATH = 'node_modules/payload/skills/payload/SKILL.md';
4
+ const AGENTS_BLOCK = `# AI Agent
5
+
6
+ For any Payload-related work, reference the skill at
7
+ \`${SKILL_POINTER_PATH}\`.
8
+ `;
9
+ const CLAUDE_IMPORT = '@AGENTS.md';
10
+ /**
11
+ * Write the root AI-agent pointer files so assistants can find the Payload
12
+ * skill bundled in node_modules. Idempotent: creates when absent, appends the
13
+ * pointer when a file exists without it, and no-ops when already present.
14
+ */ export async function writeAgentConfigFiles(args) {
15
+ const agentsMd = await ensureFileContains({
16
+ content: AGENTS_BLOCK,
17
+ filePath: path.join(args.projectDir, 'AGENTS.md'),
18
+ marker: SKILL_POINTER_PATH
19
+ });
20
+ const claudeMd = await ensureFileContains({
21
+ content: `${CLAUDE_IMPORT}\n`,
22
+ filePath: path.join(args.projectDir, 'CLAUDE.md'),
23
+ marker: CLAUDE_IMPORT
24
+ });
25
+ return {
26
+ agentsMd,
27
+ claudeMd
28
+ };
29
+ }
30
+ async function ensureFileContains(args) {
31
+ const existing = await readFileOrNull(args.filePath);
32
+ if (existing === null) {
33
+ await fs.writeFile(args.filePath, args.content, 'utf8');
34
+ return 'created';
35
+ }
36
+ if (existing.includes(args.marker)) {
37
+ return 'unchanged';
38
+ }
39
+ const separator = existing.endsWith('\n') ? '\n' : '\n\n';
40
+ await fs.writeFile(args.filePath, `${existing}${separator}${args.content}`, 'utf8');
41
+ return 'appended';
42
+ }
43
+ async function readFileOrNull(filePath) {
44
+ try {
45
+ return await fs.readFile(filePath, 'utf8');
46
+ } catch (err) {
47
+ if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
48
+ return null;
49
+ }
50
+ throw err;
51
+ }
52
+ }
@@ -0,0 +1,6 @@
1
+ export type FigmaNextImageLoaderProps = {
2
+ quality?: number;
3
+ src: string;
4
+ width: number;
5
+ };
6
+ export declare function figmaNextImageLoader({ quality, src, width }: FigmaNextImageLoaderProps): string;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ const PAYLOAD_FILE_PATH_PATTERN = /^\/(?!\/)(?:.+\/)?api\/[^/]+\/file\/.+$/;
3
+ export function figmaNextImageLoader({ quality, src, width }) {
4
+ const [pathname, search = ''] = src.split('?');
5
+ if (!PAYLOAD_FILE_PATH_PATTERN.test(pathname)) {
6
+ return src;
7
+ }
8
+ const searchParams = new URLSearchParams(search);
9
+ searchParams.set('w', String(width));
10
+ if (quality !== undefined) {
11
+ searchParams.set('q', String(quality));
12
+ }
13
+ return `${pathname}?${searchParams}`;
14
+ }