@payloadcms/figma 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (321) 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 +10 -9
  47. package/dist/api/control-plane.js +27 -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 +69 -0
  56. package/dist/auth/oauth-flow.d.ts +2 -0
  57. package/dist/auth/oauth-flow.js +13 -8
  58. package/dist/auth/token-store.d.ts +20 -1
  59. package/dist/auth/token-store.js +47 -0
  60. package/dist/auth/types.d.ts +12 -0
  61. package/dist/cli.d.ts +39 -0
  62. package/dist/cli.js +71 -36
  63. package/dist/commands/bootstrap.js +2 -1
  64. package/dist/commands/build-lambda-zip.js +1 -1
  65. package/dist/commands/deploy.d.ts +12 -0
  66. package/dist/commands/deploy.js +63 -25
  67. package/dist/commands/detect-project-resource-type.d.ts +3 -0
  68. package/dist/commands/detect-project-resource-type.js +28 -0
  69. package/dist/commands/init.d.ts +2 -2
  70. package/dist/commands/init.js +235 -80
  71. package/dist/commands/login.d.ts +11 -1
  72. package/dist/commands/login.js +66 -4
  73. package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
  74. package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
  75. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
  76. package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
  77. package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
  78. package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
  79. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
  80. package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
  81. package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
  82. package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
  83. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
  84. package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
  85. package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
  86. package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
  87. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
  88. package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
  89. package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
  90. package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
  91. package/dist/commands/prompt-to-create-project.d.ts +24 -0
  92. package/dist/commands/prompt-to-create-project.js +69 -0
  93. package/dist/commands/setup-agent.d.ts +12 -0
  94. package/dist/commands/setup-agent.js +123 -0
  95. package/dist/commands/upgrade.js +65 -1
  96. package/dist/commands/write-project-configuration.d.ts +12 -0
  97. package/dist/commands/write-project-configuration.js +16 -0
  98. package/dist/db-content-api/generated/content-api-types.d.ts +6 -2
  99. package/dist/db-content-api/index.d.ts +1 -1
  100. package/dist/db-content-api/index.js +121 -72
  101. package/dist/db-content-api/utilities/data/index.js +8 -2
  102. package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
  103. package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
  104. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
  105. package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
  106. package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
  107. package/dist/db-content-api/utilities/isRecord.js +19 -0
  108. package/dist/db-content-api/utilities/joins.js +5 -1
  109. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
  110. package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
  111. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
  112. package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
  113. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +9 -4
  114. package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
  115. package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
  116. package/dist/db-content-api/utilities/where.d.ts +2 -6
  117. package/dist/db-content-api/utilities/where.js +20 -9
  118. package/dist/exports/client.d.ts +2 -0
  119. package/dist/exports/client.js +2 -0
  120. package/dist/exports/views.d.ts +1 -0
  121. package/dist/exports/views.js +1 -0
  122. package/dist/imageSizeOptions.d.ts +23 -0
  123. package/dist/imageSizeOptions.js +26 -0
  124. package/dist/index.d.ts +2 -0
  125. package/dist/index.js +2 -0
  126. package/dist/lib/write-agent-config.d.ts +12 -0
  127. package/dist/lib/write-agent-config.js +52 -0
  128. package/dist/next/image-loader.d.ts +6 -0
  129. package/dist/next/image-loader.js +14 -0
  130. package/dist/oauth/components/LoginButton/index.js +66 -19
  131. package/dist/oauth/components/LoginButton/index.scss +121 -15
  132. package/dist/oauth/defaults.js +4 -1
  133. package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
  134. package/dist/oauth/index.js +8 -7
  135. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
  136. package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
  137. package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
  138. package/dist/plugin/build-config.d.ts +13 -3
  139. package/dist/plugin/build-config.js +181 -36
  140. package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
  141. package/dist/plugin/cache-revalidation-hooks.js +69 -0
  142. package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +9 -0
  143. package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
  144. package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
  145. package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
  146. package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
  147. package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
  148. package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
  149. package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
  150. package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
  151. package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
  152. package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
  153. package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
  154. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +3 -0
  155. package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
  156. package/dist/plugin/cloud-limits/routes.d.ts +2 -0
  157. package/dist/plugin/cloud-limits/routes.js +4 -0
  158. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
  159. package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
  160. package/dist/plugin/cloud-limits/shared.d.ts +10 -0
  161. package/dist/plugin/cloud-limits/shared.js +52 -0
  162. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
  163. package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
  164. package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
  165. package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
  166. package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
  167. package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
  168. package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
  169. package/dist/plugin/sandbox-upload-fetch.js +53 -0
  170. package/dist/skills/deploy-to-figma/SKILL.md +234 -0
  171. package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
  172. package/dist/storage-content-api/api-types.d.ts +3 -0
  173. package/dist/storage-content-api/buildBaseMediaResponseHeaders.d.ts +1 -0
  174. package/dist/storage-content-api/buildBaseMediaResponseHeaders.js +8 -0
  175. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.d.ts +12 -0
  176. package/dist/storage-content-api/buildClientUploadFetchBackHeaders.js +26 -0
  177. package/dist/storage-content-api/buildMediaRequestHeaders.d.ts +1 -0
  178. package/dist/storage-content-api/buildMediaRequestHeaders.js +14 -0
  179. package/dist/storage-content-api/buildMediaResponseHeaders.d.ts +4 -0
  180. package/dist/storage-content-api/buildMediaResponseHeaders.js +52 -0
  181. package/dist/storage-content-api/client-uploads/generate.js +2 -1
  182. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
  183. package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +33 -0
  184. package/dist/storage-content-api/getMediaType.d.ts +1 -0
  185. package/dist/storage-content-api/getMediaType.js +3 -0
  186. package/dist/storage-content-api/hasSupportedContentEncoding.d.ts +1 -0
  187. package/dist/storage-content-api/hasSupportedContentEncoding.js +6 -0
  188. package/dist/storage-content-api/index.js +1 -0
  189. package/dist/storage-content-api/mediaErrorResponse.d.ts +1 -0
  190. package/dist/storage-content-api/mediaErrorResponse.js +12 -0
  191. package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
  192. package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
  193. package/dist/storage-content-api/shouldAttachMedia.d.ts +1 -0
  194. package/dist/storage-content-api/shouldAttachMedia.js +34 -0
  195. package/dist/storage-content-api/staticHandler.js +93 -25
  196. package/dist/storage-content-api/types.d.ts +4 -1
  197. package/dist/translations/ar.d.ts +12 -0
  198. package/dist/translations/ar.js +12 -0
  199. package/dist/translations/az.d.ts +12 -0
  200. package/dist/translations/az.js +12 -0
  201. package/dist/translations/bg.d.ts +12 -0
  202. package/dist/translations/bg.js +12 -0
  203. package/dist/translations/bnBd.d.ts +12 -0
  204. package/dist/translations/bnBd.js +12 -0
  205. package/dist/translations/bnIn.d.ts +12 -0
  206. package/dist/translations/bnIn.js +12 -0
  207. package/dist/translations/ca.d.ts +12 -0
  208. package/dist/translations/ca.js +12 -0
  209. package/dist/translations/cs.d.ts +12 -0
  210. package/dist/translations/cs.js +12 -0
  211. package/dist/translations/da.d.ts +12 -0
  212. package/dist/translations/da.js +12 -0
  213. package/dist/translations/de.d.ts +12 -0
  214. package/dist/translations/de.js +12 -0
  215. package/dist/translations/en.d.ts +12 -0
  216. package/dist/translations/en.js +12 -0
  217. package/dist/translations/es.d.ts +12 -0
  218. package/dist/translations/es.js +12 -0
  219. package/dist/translations/et.d.ts +12 -0
  220. package/dist/translations/et.js +12 -0
  221. package/dist/translations/fa.d.ts +12 -0
  222. package/dist/translations/fa.js +12 -0
  223. package/dist/translations/fr.d.ts +12 -0
  224. package/dist/translations/fr.js +12 -0
  225. package/dist/translations/he.d.ts +12 -0
  226. package/dist/translations/he.js +12 -0
  227. package/dist/translations/hr.d.ts +12 -0
  228. package/dist/translations/hr.js +12 -0
  229. package/dist/translations/hu.d.ts +12 -0
  230. package/dist/translations/hu.js +12 -0
  231. package/dist/translations/hy.d.ts +12 -0
  232. package/dist/translations/hy.js +12 -0
  233. package/dist/translations/id.d.ts +12 -0
  234. package/dist/translations/id.js +12 -0
  235. package/dist/translations/index.d.ts +533 -0
  236. package/dist/translations/index.js +90 -0
  237. package/dist/translations/is.d.ts +12 -0
  238. package/dist/translations/is.js +12 -0
  239. package/dist/translations/it.d.ts +12 -0
  240. package/dist/translations/it.js +12 -0
  241. package/dist/translations/ja.d.ts +12 -0
  242. package/dist/translations/ja.js +12 -0
  243. package/dist/translations/ko.d.ts +12 -0
  244. package/dist/translations/ko.js +12 -0
  245. package/dist/translations/lt.d.ts +12 -0
  246. package/dist/translations/lt.js +12 -0
  247. package/dist/translations/lv.d.ts +12 -0
  248. package/dist/translations/lv.js +12 -0
  249. package/dist/translations/my.d.ts +12 -0
  250. package/dist/translations/my.js +12 -0
  251. package/dist/translations/nb.d.ts +12 -0
  252. package/dist/translations/nb.js +12 -0
  253. package/dist/translations/nl.d.ts +12 -0
  254. package/dist/translations/nl.js +12 -0
  255. package/dist/translations/pl.d.ts +12 -0
  256. package/dist/translations/pl.js +12 -0
  257. package/dist/translations/pt.d.ts +12 -0
  258. package/dist/translations/pt.js +12 -0
  259. package/dist/translations/ro.d.ts +12 -0
  260. package/dist/translations/ro.js +12 -0
  261. package/dist/translations/rs.d.ts +12 -0
  262. package/dist/translations/rs.js +12 -0
  263. package/dist/translations/rsLatin.d.ts +12 -0
  264. package/dist/translations/rsLatin.js +12 -0
  265. package/dist/translations/ru.d.ts +12 -0
  266. package/dist/translations/ru.js +12 -0
  267. package/dist/translations/sk.d.ts +12 -0
  268. package/dist/translations/sk.js +12 -0
  269. package/dist/translations/sl.d.ts +12 -0
  270. package/dist/translations/sl.js +12 -0
  271. package/dist/translations/sv.d.ts +12 -0
  272. package/dist/translations/sv.js +12 -0
  273. package/dist/translations/ta.d.ts +12 -0
  274. package/dist/translations/ta.js +12 -0
  275. package/dist/translations/th.d.ts +12 -0
  276. package/dist/translations/th.js +12 -0
  277. package/dist/translations/tr.d.ts +12 -0
  278. package/dist/translations/tr.js +12 -0
  279. package/dist/translations/uk.d.ts +12 -0
  280. package/dist/translations/uk.js +12 -0
  281. package/dist/translations/vi.d.ts +12 -0
  282. package/dist/translations/vi.js +12 -0
  283. package/dist/translations/zh.d.ts +12 -0
  284. package/dist/translations/zh.js +12 -0
  285. package/dist/translations/zhTw.d.ts +12 -0
  286. package/dist/translations/zhTw.js +12 -0
  287. package/dist/types.d.ts +11 -0
  288. package/dist/utils/assert-never.d.ts +1 -0
  289. package/dist/utils/assert-never.js +3 -0
  290. package/dist/utils/build-detection.d.ts +6 -1
  291. package/dist/utils/build-detection.js +68 -89
  292. package/dist/utils/deploy-adapter.d.ts +3 -35
  293. package/dist/utils/deploy-adapter.js +25 -14
  294. package/dist/utils/env-management.d.ts +15 -0
  295. package/dist/utils/env-management.js +47 -0
  296. package/dist/utils/lambda-config.js +18 -23
  297. package/dist/utils/messages.js +24 -3
  298. package/dist/utils/next-image-loader-config.d.ts +2 -0
  299. package/dist/utils/next-image-loader-config.js +63 -0
  300. package/dist/utils/next-image-loader-file.d.ts +2 -0
  301. package/dist/utils/next-image-loader-file.js +11 -0
  302. package/dist/utils/payload-config-ast.js +5 -2
  303. package/dist/utils/payload-generate.d.ts +10 -0
  304. package/dist/utils/payload-generate.js +59 -0
  305. package/dist/utils/payload-secret.d.ts +28 -0
  306. package/dist/utils/payload-secret.js +34 -0
  307. package/dist/utils/pnpm-builds.d.ts +14 -0
  308. package/dist/utils/pnpm-builds.js +125 -0
  309. package/dist/utils/s3-upload.js +4 -1
  310. package/package.json +33 -7
  311. package/dist/lib/download-skill.d.ts +0 -12
  312. package/dist/lib/download-skill.js +0 -77
  313. package/dist/utils/adapters/nextjs.d.ts +0 -8
  314. package/dist/utils/adapters/nextjs.js +0 -61
  315. package/dist/utils/adapters/nitro.d.ts +0 -8
  316. package/dist/utils/adapters/nitro.js +0 -172
  317. package/dist/utils/adapters/vite.js +0 -31
  318. package/dist/utils/asset-collection.js +0 -144
  319. package/dist/utils/build-lambda-zip.js +0 -90
  320. package/dist/utils/fs-utils.d.ts +0 -12
  321. package/dist/utils/fs-utils.js +0 -55
@@ -112,7 +112,7 @@ import { transformToLocalizeStatus } from './transformPublishedLocale.js';
112
112
  'id'
113
113
  ]
114
114
  });
115
- removeVirtualFields(transformed, collectionConfig.fields);
115
+ removeVirtualFields(transformed, collectionConfig.fields, payload.config);
116
116
  // Convert numeric ID to string for Content API
117
117
  const customIDType = payload.collections?.[collectionSlug]?.customIDType;
118
118
  if (customIDType === 'number') {
@@ -208,6 +208,12 @@ export function dataFromContentAPI(payload, collectionSlug, data, locale) {
208
208
  };
209
209
  return;
210
210
  }
211
+ // Document reads may omit an empty has-many select, while version writes store it as [].
212
+ // Return the same shape to Payload from both paths.
213
+ if (field.type === 'select' && field.hasMany && !isLocalized && value == null) {
214
+ current[fieldName] = [];
215
+ return;
216
+ }
211
217
  // Content API may omit fields; Payload expects null for optional fields.
212
218
  // In all-locales mode, localized fields use {} so afterRead can safely iterate locale keys.
213
219
  if (value === undefined) {
@@ -295,7 +301,7 @@ export function dataFromContentAPI(payload, collectionSlug, data, locale) {
295
301
  ]
296
302
  });
297
303
  // Remove virtual fields - must happen AFTER stripFields
298
- removeVirtualFields(transformed, collectionConfig.fields);
304
+ removeVirtualFields(transformed, collectionConfig.fields, payload.config);
299
305
  // Handle auth-specific fields that aren't in the field schema
300
306
  // When these fields are null in DB, Content API omits them from response (undefined)
301
307
  // But Payload expects them to be null, not undefined
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Payload expects globals to carry a `globalType` (their slug) alongside the stored data.
3
+ * Globals are stored as `_global-<slug>` collections that have no such column, so the adapter
4
+ * attaches it to every global document it returns.
5
+ */
6
+ export declare function injectGlobalType<T>(doc: T, slug: string): T;
@@ -0,0 +1,11 @@
1
+ import { isRecord } from '../isRecord.js';
2
+ /**
3
+ * Payload expects globals to carry a `globalType` (their slug) alongside the stored data.
4
+ * Globals are stored as `_global-<slug>` collections that have no such column, so the adapter
5
+ * attaches it to every global document it returns.
6
+ */ export function injectGlobalType(doc, slug) {
7
+ return isRecord(doc) ? {
8
+ ...doc,
9
+ globalType: slug
10
+ } : doc;
11
+ }
@@ -1,11 +1,3 @@
1
- import type { CollectionConfig } from 'payload';
2
- /**
3
- * Removes virtual fields (fields with virtual: true) from data recursively.
4
- * Virtual fields should never be persisted in the database.
5
- *
6
- * @todo It might be a good idea to combine `stripFields` with `stripFields`
7
- * in a new utility that receives a callback with conditions. I didn't do
8
- * it now because `stripFields` was copied from db-mongo and I'd like to
9
- * find a way to unify everything.
10
- */
11
- export declare function removeVirtualFields(data: Record<string, unknown>, fieldConfigs: CollectionConfig['fields']): void;
1
+ import type { Field, SanitizedConfig } from 'payload';
2
+ /** Remove pure virtual fields from document data at every schema depth. */
3
+ export declare function removeVirtualFields(data: Record<string, unknown>, fields: Field[], config: SanitizedConfig): void;
@@ -1,52 +1,14 @@
1
- /**
2
- * Removes virtual fields (fields with virtual: true) from data recursively.
3
- * Virtual fields should never be persisted in the database.
4
- *
5
- * @todo It might be a good idea to combine `stripFields` with `stripFields`
6
- * in a new utility that receives a callback with conditions. I didn't do
7
- * it now because `stripFields` was copied from db-mongo and I'd like to
8
- * find a way to unify everything.
9
- */ export function removeVirtualFields(data, fieldConfigs) {
10
- for (const field of fieldConfigs){
11
- // Handle UI fields (row, collapsible, tabs) - they don't have names
12
- // but contain other fields that might be virtual
13
- if (field.type === 'row' || field.type === 'collapsible') {
14
- if ('fields' in field) {
15
- removeVirtualFields(data, field.fields);
1
+ import { traverseFields } from 'payload';
2
+ /** Remove pure virtual fields from document data at every schema depth. */ export function removeVirtualFields(data, fields, config) {
3
+ traverseFields({
4
+ callback: ({ field, ref })=>{
5
+ if ('name' in field && field.name && 'virtual' in field && field.virtual === true) {
6
+ delete ref[field.name];
16
7
  }
17
- continue;
18
- }
19
- if (field.type === 'tabs' && 'tabs' in field) {
20
- for (const tab of field.tabs){
21
- if ('fields' in tab) {
22
- removeVirtualFields(data, tab.fields);
23
- }
24
- }
25
- continue;
26
- }
27
- // Skip fields without names
28
- if (!('name' in field) || !field.name) {
29
- continue;
30
- }
31
- // Remove field if it has virtual: true
32
- if ('virtual' in field && field.virtual === true) {
33
- delete data[field.name];
34
- continue;
35
- }
36
- // Recursively handle nested structures (groups, arrays with items, etc.)
37
- if ('fields' in field && field.name in data) {
38
- const value = data[field.name];
39
- if (field.type === 'array' && Array.isArray(value)) {
40
- // Process each array item
41
- for (const item of value){
42
- if (item && typeof item === 'object') {
43
- removeVirtualFields(item, field.fields);
44
- }
45
- }
46
- } else if (field.type === 'group' && value && typeof value === 'object') {
47
- // Process group
48
- removeVirtualFields(value, field.fields);
49
- }
50
- }
51
- }
8
+ },
9
+ config,
10
+ fields,
11
+ fillEmpty: false,
12
+ ref: data
13
+ });
52
14
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A plain, string-keyed object — the shape that can safely be spread and have
3
+ * properties read off it without tripping over arrays, `null`, or exotic objects.
4
+ *
5
+ * Objects carrying symbol-keyed own properties are rejected: symbol keys are how
6
+ * libraries tag a value as something more than data, and a spread copies only the
7
+ * string keys, so treating such a value as a record silently strips the tag.
8
+ */
9
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A plain, string-keyed object — the shape that can safely be spread and have
3
+ * properties read off it without tripping over arrays, `null`, or exotic objects.
4
+ *
5
+ * Objects carrying symbol-keyed own properties are rejected: symbol keys are how
6
+ * libraries tag a value as something more than data, and a spread copies only the
7
+ * string keys, so treating such a value as a record silently strips the tag.
8
+ */ export function isRecord(value) {
9
+ if (value == null) {
10
+ return false;
11
+ }
12
+ if (typeof value !== 'object') {
13
+ return false;
14
+ }
15
+ if (Array.isArray(value)) {
16
+ return false;
17
+ }
18
+ return Object.getOwnPropertySymbols(value).length === 0;
19
+ }
@@ -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';