@payloadcms/figma 0.0.1-alpha.8 → 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (470) hide show
  1. package/dist/api/control-plane.d.ts +56 -7
  2. package/dist/api/control-plane.js +188 -74
  3. package/dist/api/error-response.d.ts +36 -0
  4. package/dist/api/error-response.js +66 -0
  5. package/dist/api/figma-api.d.ts +24 -3
  6. package/dist/api/figma-api.js +110 -34
  7. package/dist/auth/browser.d.ts +0 -1
  8. package/dist/auth/browser.js +0 -2
  9. package/dist/auth/callback-server.d.ts +19 -8
  10. package/dist/auth/callback-server.js +72 -32
  11. package/dist/auth/credentials.d.ts +20 -0
  12. package/dist/auth/credentials.js +19 -0
  13. package/dist/auth/crypto-utils.d.ts +28 -1
  14. package/dist/auth/crypto-utils.js +132 -23
  15. package/dist/auth/jwt-validator.d.ts +23 -6
  16. package/dist/auth/jwt-validator.js +35 -9
  17. package/dist/auth/oauth-flow.d.ts +19 -4
  18. package/dist/auth/oauth-flow.js +151 -34
  19. package/dist/auth/paste-code.d.ts +33 -0
  20. package/dist/auth/paste-code.js +87 -0
  21. package/dist/auth/pkce.d.ts +0 -1
  22. package/dist/auth/pkce.js +0 -2
  23. package/dist/auth/project-token.d.ts +32 -17
  24. package/dist/auth/project-token.js +176 -68
  25. package/dist/auth/refresh.d.ts +2 -2
  26. package/dist/auth/refresh.js +25 -14
  27. package/dist/auth/token-store-migration.d.ts +57 -0
  28. package/dist/auth/token-store-migration.js +154 -0
  29. package/dist/auth/token-store.d.ts +63 -98
  30. package/dist/auth/token-store.js +405 -124
  31. package/dist/auth/types.d.ts +40 -6
  32. package/dist/auth/types.js +1 -3
  33. package/dist/cli.d.ts +0 -1
  34. package/dist/cli.js +102 -8
  35. package/dist/commands/bootstrap.d.ts +17 -0
  36. package/dist/commands/bootstrap.js +88 -0
  37. package/dist/commands/build-lambda-zip.d.ts +4 -0
  38. package/dist/commands/build-lambda-zip.js +17 -0
  39. package/dist/commands/debug.d.ts +7 -0
  40. package/dist/commands/debug.js +178 -0
  41. package/dist/commands/deploy.d.ts +11 -1
  42. package/dist/commands/deploy.js +193 -153
  43. package/dist/commands/dump-tokens.d.ts +11 -0
  44. package/dist/commands/dump-tokens.js +67 -0
  45. package/dist/commands/env.d.ts +12 -0
  46. package/dist/commands/env.js +86 -0
  47. package/dist/commands/init.d.ts +9 -6
  48. package/dist/commands/init.js +232 -152
  49. package/dist/commands/list-tokens.d.ts +3 -4
  50. package/dist/commands/list-tokens.js +24 -11
  51. package/dist/commands/login.d.ts +8 -2
  52. package/dist/commands/login.js +34 -18
  53. package/dist/commands/logout.d.ts +5 -5
  54. package/dist/commands/logout.js +77 -17
  55. package/dist/commands/upgrade.d.ts +4 -0
  56. package/dist/commands/upgrade.js +329 -0
  57. package/dist/commands/upload-schema.d.ts +8 -0
  58. package/dist/commands/upload-schema.js +91 -0
  59. package/dist/config/oauth.d.ts +17 -12
  60. package/dist/config/oauth.js +38 -39
  61. package/dist/constants.d.ts +63 -19
  62. package/dist/constants.js +158 -20
  63. package/dist/db-content-api/generated/content-api-types.d.ts +7574 -0
  64. package/dist/db-content-api/generated/content-api-types.js +5 -0
  65. package/dist/db-content-api/index.d.ts +37 -0
  66. package/dist/db-content-api/index.js +938 -0
  67. package/dist/db-content-api/temp-utilities/slug.d.ts +1 -0
  68. package/dist/db-content-api/temp-utilities/slug.js +1 -0
  69. package/dist/db-content-api/temp-utilities/sorting.d.ts +2 -0
  70. package/dist/db-content-api/temp-utilities/sorting.js +37 -0
  71. package/dist/db-content-api/temp-utilities/types.d.ts +21 -0
  72. package/dist/db-content-api/temp-utilities/types.js +13 -0
  73. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +38 -0
  74. package/dist/db-content-api/temp-utilities/unwrapDocument.js +62 -0
  75. package/dist/db-content-api/utilities/auth.d.ts +29 -0
  76. package/dist/db-content-api/utilities/auth.js +82 -0
  77. package/dist/db-content-api/utilities/data/applyDefaults.d.ts +6 -0
  78. package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
  79. package/dist/db-content-api/utilities/data/castFieldValue.d.ts +10 -0
  80. package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
  81. package/dist/db-content-api/utilities/data/index.d.ts +48 -0
  82. package/dist/db-content-api/utilities/data/index.js +299 -0
  83. package/dist/db-content-api/utilities/data/pointShape.d.ts +3 -0
  84. package/dist/db-content-api/utilities/data/pointShape.js +43 -0
  85. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +11 -0
  86. package/dist/db-content-api/utilities/data/removeVirtualFields.js +52 -0
  87. package/dist/db-content-api/utilities/data/richTextShape.d.ts +3 -0
  88. package/dist/db-content-api/utilities/data/richTextShape.js +56 -0
  89. package/dist/db-content-api/utilities/data/stripFields.d.ts +47 -0
  90. package/dist/db-content-api/utilities/data/stripFields.js +170 -0
  91. package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +22 -0
  92. package/dist/db-content-api/utilities/data/transformPublishedLocale.js +40 -0
  93. package/dist/db-content-api/utilities/data/validateRelationships.d.ts +6 -0
  94. package/dist/db-content-api/utilities/data/validateRelationships.js +100 -0
  95. package/dist/db-content-api/utilities/joins.d.ts +52 -0
  96. package/dist/db-content-api/utilities/joins.js +137 -0
  97. package/dist/db-content-api/utilities/locale/index.d.ts +9 -0
  98. package/dist/db-content-api/utilities/locale/index.js +19 -0
  99. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +10 -0
  100. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +71 -0
  101. package/dist/db-content-api/utilities/meta/buildMeta.d.ts +41 -0
  102. package/dist/db-content-api/utilities/meta/buildMeta.js +39 -0
  103. package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +16 -0
  104. package/dist/db-content-api/utilities/meta/buildPathTypes.js +243 -0
  105. package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +12 -0
  106. package/dist/db-content-api/utilities/meta/buildUniquePaths.js +60 -0
  107. package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +9 -0
  108. package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +100 -0
  109. package/dist/db-content-api/utilities/resolveBlocks.d.ts +19 -0
  110. package/dist/db-content-api/utilities/resolveBlocks.js +31 -0
  111. package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +55 -0
  112. package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +182 -0
  113. package/dist/db-content-api/utilities/where.d.ts +19 -0
  114. package/dist/db-content-api/utilities/where.js +106 -0
  115. package/dist/deploy/schedule-extract-plugin.d.ts +10 -0
  116. package/dist/deploy/schedule-extract-plugin.js +32 -0
  117. package/dist/endpoints/health.d.ts +2 -0
  118. package/dist/endpoints/health.js +9 -0
  119. package/dist/endpoints/schema.d.ts +2 -0
  120. package/dist/endpoints/schema.js +27 -0
  121. package/dist/exports/client.d.ts +2 -1
  122. package/dist/exports/client.js +2 -2
  123. package/dist/index.d.ts +2 -2
  124. package/dist/index.js +3 -3
  125. package/dist/lib/download-skill.d.ts +12 -0
  126. package/dist/lib/download-skill.js +77 -0
  127. package/dist/oauth/components/FigmaAvatar/index.d.ts +3 -0
  128. package/dist/oauth/components/FigmaAvatar/index.js +25 -0
  129. package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
  130. package/dist/oauth/components/FigmaAvatarCell/index.d.ts +4 -0
  131. package/dist/oauth/components/FigmaAvatarCell/index.js +23 -0
  132. package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
  133. package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +8 -0
  134. package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +35 -0
  135. package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
  136. package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +81 -0
  137. package/dist/oauth/components/LoginButton/iframeAutoLogin.js +168 -0
  138. package/dist/oauth/components/LoginButton/index.d.ts +0 -1
  139. package/dist/oauth/components/LoginButton/index.js +156 -18
  140. package/dist/oauth/components/LoginButton/index.scss +75 -3
  141. package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
  142. package/dist/oauth/components/LogoutButton/index.js +20 -9
  143. package/dist/oauth/defaults.d.ts +3 -2
  144. package/dist/oauth/defaults.js +79 -12
  145. package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
  146. package/dist/oauth/endpoints/getLoginEndpoint.js +87 -84
  147. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
  148. package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -6
  149. package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
  150. package/dist/oauth/endpoints/getMetaEndpoint.js +18 -5
  151. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
  152. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -4
  153. package/dist/oauth/exports/client.d.ts +0 -1
  154. package/dist/oauth/exports/client.js +0 -2
  155. package/dist/oauth/hooks/afterLogout.d.ts +0 -1
  156. package/dist/oauth/hooks/afterLogout.js +0 -2
  157. package/dist/oauth/hooks/me.d.ts +0 -1
  158. package/dist/oauth/hooks/me.js +0 -2
  159. package/dist/oauth/hooks/refresh.d.ts +0 -1
  160. package/dist/oauth/hooks/refresh.js +2 -3
  161. package/dist/oauth/index.d.ts +0 -1
  162. package/dist/oauth/index.js +27 -7
  163. package/dist/oauth/strategy/index.d.ts +0 -3
  164. package/dist/oauth/strategy/index.js +55 -34
  165. package/dist/oauth/types.d.ts +23 -7
  166. package/dist/oauth/types.js +0 -2
  167. package/dist/oauth/utilities/buildUnauthorizedRedirect.d.ts +14 -0
  168. package/dist/oauth/utilities/buildUnauthorizedRedirect.js +28 -0
  169. package/dist/oauth/utilities/clearCookie.d.ts +0 -1
  170. package/dist/oauth/utilities/clearCookie.js +5 -3
  171. package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
  172. package/dist/oauth/utilities/createCookieOptions.js +9 -4
  173. package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
  174. package/dist/oauth/utilities/createDebugLogger.js +0 -2
  175. package/dist/oauth/utilities/establishSession.d.ts +22 -0
  176. package/dist/oauth/utilities/establishSession.js +80 -0
  177. package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +23 -0
  178. package/dist/oauth/utilities/exchangeCodeForAccessToken.js +26 -0
  179. package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
  180. package/dist/oauth/utilities/extractOrigin.js +0 -2
  181. package/dist/oauth/utilities/figmaHostnames.d.ts +2 -0
  182. package/dist/oauth/utilities/figmaHostnames.js +24 -0
  183. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
  184. package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
  185. package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -2
  186. package/dist/oauth/utilities/getAuthorizeURL.js +57 -4
  187. package/dist/oauth/utilities/getCookieExpiration.d.ts +0 -1
  188. package/dist/oauth/utilities/getCookieExpiration.js +0 -2
  189. package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts +0 -1
  190. package/dist/oauth/utilities/getSecondsFromTokenExp.js +0 -2
  191. package/dist/oauth/utilities/getTokenExp.d.ts +0 -1
  192. package/dist/oauth/utilities/getTokenExp.js +0 -2
  193. package/dist/oauth/utilities/getUsernameField.d.ts +0 -1
  194. package/dist/oauth/utilities/getUsernameField.js +0 -2
  195. package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts +0 -1
  196. package/dist/oauth/utilities/hasUserTokenPropsChanged.js +0 -2
  197. package/dist/oauth/utilities/isAbsoluteURL.d.ts +1 -0
  198. package/dist/oauth/utilities/isAbsoluteURL.js +1 -0
  199. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +6 -0
  200. package/dist/oauth/utilities/isDuplicateKeyError.js +12 -0
  201. package/dist/oauth/utilities/mergeHeaders.d.ts +0 -1
  202. package/dist/oauth/utilities/mergeHeaders.js +0 -2
  203. package/dist/oauth/utilities/refreshTokens.d.ts +0 -1
  204. package/dist/oauth/utilities/refreshTokens.js +21 -13
  205. package/dist/oauth/utilities/withPartitionedCookie.d.ts +19 -0
  206. package/dist/oauth/utilities/withPartitionedCookie.js +26 -0
  207. package/dist/oauth/utils/getSearchParam.d.ts +17 -0
  208. package/dist/oauth/utils/getSearchParam.js +22 -0
  209. package/dist/plugin/adapter.d.ts +0 -1
  210. package/dist/plugin/adapter.js +0 -2
  211. package/dist/plugin/auth-preflight.d.ts +7 -0
  212. package/dist/plugin/auth-preflight.js +18 -0
  213. package/dist/plugin/bootstrap-preflight.d.ts +22 -0
  214. package/dist/plugin/bootstrap-preflight.js +43 -0
  215. package/dist/plugin/build-config.d.ts +27 -15
  216. package/dist/plugin/build-config.js +381 -18
  217. package/dist/plugin/dev-cookie-names.d.ts +13 -0
  218. package/dist/plugin/dev-cookie-names.js +17 -0
  219. package/dist/scss.d.js +2 -0
  220. package/dist/storage-content-api/api-types.d.ts +183 -0
  221. package/dist/storage-content-api/api-types.js +4 -0
  222. package/dist/storage-content-api/client-uploads/generate.d.ts +14 -0
  223. package/dist/storage-content-api/client-uploads/generate.js +69 -0
  224. package/dist/storage-content-api/client.d.ts +5 -0
  225. package/dist/storage-content-api/client.js +37 -0
  226. package/dist/storage-content-api/generateURL.d.ts +6 -0
  227. package/dist/storage-content-api/generateURL.js +6 -0
  228. package/dist/storage-content-api/handleDelete.d.ts +7 -0
  229. package/dist/storage-content-api/handleDelete.js +15 -0
  230. package/dist/storage-content-api/handleUpload.d.ts +10 -0
  231. package/dist/storage-content-api/handleUpload.js +162 -0
  232. package/dist/storage-content-api/index.d.ts +4 -0
  233. package/dist/storage-content-api/index.js +37 -0
  234. package/dist/storage-content-api/staticHandler.d.ts +9 -0
  235. package/dist/storage-content-api/staticHandler.js +61 -0
  236. package/dist/storage-content-api/types.d.ts +9 -0
  237. package/dist/storage-content-api/types.js +1 -0
  238. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +11 -0
  239. package/dist/storage-content-api/utilities/getSafeFilename.js +59 -0
  240. package/dist/storage-content-api/utilities/index.d.ts +2 -0
  241. package/dist/storage-content-api/utilities/index.js +2 -0
  242. package/dist/storage-content-api/utilities/parseUploadReference.d.ts +17 -0
  243. package/dist/storage-content-api/utilities/parseUploadReference.js +27 -0
  244. package/dist/templates/.env.example +5 -0
  245. package/dist/templates/README.md +19 -0
  246. package/dist/types/config.d.ts +2 -2
  247. package/dist/types/config.js +0 -4
  248. package/dist/types.d.ts +10 -2
  249. package/dist/types.js +0 -2
  250. package/dist/utils/adapters/nextjs.d.ts +8 -0
  251. package/dist/utils/adapters/nextjs.js +61 -0
  252. package/dist/utils/adapters/nitro.d.ts +8 -0
  253. package/dist/utils/adapters/nitro.js +172 -0
  254. package/dist/utils/adapters/vite.d.ts +9 -0
  255. package/dist/utils/adapters/vite.js +31 -0
  256. package/dist/utils/asset-collection.d.ts +27 -7
  257. package/dist/utils/asset-collection.js +59 -32
  258. package/dist/utils/build-detection.d.ts +5 -12
  259. package/dist/utils/build-detection.js +74 -13
  260. package/dist/utils/build-lambda-zip.d.ts +25 -0
  261. package/dist/utils/build-lambda-zip.js +90 -0
  262. package/dist/utils/cache-bootstrap.d.ts +7 -0
  263. package/dist/utils/cache-bootstrap.js +16 -0
  264. package/dist/utils/config.d.ts +0 -1
  265. package/dist/utils/config.js +1 -3
  266. package/dist/utils/deploy-adapter.d.ts +45 -0
  267. package/dist/utils/deploy-adapter.js +56 -0
  268. package/dist/utils/download-template.d.ts +9 -2
  269. package/dist/utils/download-template.js +24 -20
  270. package/dist/utils/env-management.d.ts +24 -8
  271. package/dist/utils/env-management.js +119 -66
  272. package/dist/utils/format-env-suffix.d.ts +11 -0
  273. package/dist/utils/format-env-suffix.js +11 -0
  274. package/dist/utils/format.d.ts +0 -1
  275. package/dist/utils/format.js +0 -2
  276. package/dist/utils/formatter.d.ts +0 -1
  277. package/dist/utils/formatter.js +23 -13
  278. package/dist/utils/fs-utils.d.ts +12 -0
  279. package/dist/utils/fs-utils.js +55 -0
  280. package/dist/utils/git.d.ts +0 -1
  281. package/dist/utils/git.js +0 -2
  282. package/dist/utils/handle-upgrade.d.ts +8 -0
  283. package/dist/utils/handle-upgrade.js +39 -0
  284. package/dist/utils/is-debug.d.ts +0 -1
  285. package/dist/utils/is-debug.js +0 -2
  286. package/dist/utils/lambda-config.d.ts +3 -2
  287. package/dist/utils/lambda-config.js +75 -80
  288. package/dist/utils/load-payload-config.d.ts +9 -0
  289. package/dist/utils/load-payload-config.js +27 -0
  290. package/dist/utils/log.d.ts +0 -1
  291. package/dist/utils/log.js +0 -2
  292. package/dist/utils/messages.d.ts +1 -3
  293. package/dist/utils/messages.js +47 -13
  294. package/dist/utils/package-manager.d.ts +24 -1
  295. package/dist/utils/package-manager.js +53 -2
  296. package/dist/utils/parse-template-spec.d.ts +11 -0
  297. package/dist/utils/parse-template-spec.js +60 -0
  298. package/dist/utils/payload-config-ast.d.ts +27 -7
  299. package/dist/utils/payload-config-ast.js +106 -60
  300. package/dist/utils/payload-config-finder.d.ts +2 -3
  301. package/dist/utils/payload-config-finder.js +48 -11
  302. package/dist/utils/payload-config-modifier.d.ts +1 -2
  303. package/dist/utils/payload-config-modifier.js +114 -68
  304. package/dist/utils/payload-package-check.d.ts +28 -3
  305. package/dist/utils/payload-package-check.js +90 -31
  306. package/dist/utils/project.d.ts +8 -4
  307. package/dist/utils/project.js +63 -37
  308. package/dist/utils/resolve-environment.d.ts +13 -0
  309. package/dist/utils/resolve-environment.js +29 -0
  310. package/dist/utils/s3-upload.d.ts +7 -3
  311. package/dist/utils/s3-upload.js +44 -9
  312. package/dist/utils/token-display.d.ts +5 -2
  313. package/dist/utils/token-display.js +49 -24
  314. package/dist/utils/typescript-validator.d.ts +0 -1
  315. package/dist/utils/typescript-validator.js +4 -8
  316. package/dist/utils/version-check.d.ts +2 -0
  317. package/dist/utils/version-check.js +43 -0
  318. package/package.json +47 -16
  319. package/dist/api/control-plane.d.ts.map +0 -1
  320. package/dist/api/control-plane.js.map +0 -1
  321. package/dist/api/figma-api.d.ts.map +0 -1
  322. package/dist/api/figma-api.js.map +0 -1
  323. package/dist/auth/browser.d.ts.map +0 -1
  324. package/dist/auth/browser.js.map +0 -1
  325. package/dist/auth/callback-server.d.ts.map +0 -1
  326. package/dist/auth/callback-server.js.map +0 -1
  327. package/dist/auth/crypto-utils.d.ts.map +0 -1
  328. package/dist/auth/crypto-utils.js.map +0 -1
  329. package/dist/auth/jwt-validator.d.ts.map +0 -1
  330. package/dist/auth/jwt-validator.js.map +0 -1
  331. package/dist/auth/oauth-flow.d.ts.map +0 -1
  332. package/dist/auth/oauth-flow.js.map +0 -1
  333. package/dist/auth/pkce.d.ts.map +0 -1
  334. package/dist/auth/pkce.js.map +0 -1
  335. package/dist/auth/project-token.d.ts.map +0 -1
  336. package/dist/auth/project-token.js.map +0 -1
  337. package/dist/auth/refresh.d.ts.map +0 -1
  338. package/dist/auth/refresh.js.map +0 -1
  339. package/dist/auth/token-store.d.ts.map +0 -1
  340. package/dist/auth/token-store.js.map +0 -1
  341. package/dist/auth/types.d.ts.map +0 -1
  342. package/dist/auth/types.js.map +0 -1
  343. package/dist/cli.d.ts.map +0 -1
  344. package/dist/cli.js.map +0 -1
  345. package/dist/commands/deploy.d.ts.map +0 -1
  346. package/dist/commands/deploy.js.map +0 -1
  347. package/dist/commands/init.d.ts.map +0 -1
  348. package/dist/commands/init.js.map +0 -1
  349. package/dist/commands/list-tokens.d.ts.map +0 -1
  350. package/dist/commands/list-tokens.js.map +0 -1
  351. package/dist/commands/login.d.ts.map +0 -1
  352. package/dist/commands/login.js.map +0 -1
  353. package/dist/commands/logout.d.ts.map +0 -1
  354. package/dist/commands/logout.js.map +0 -1
  355. package/dist/config/oauth.d.ts.map +0 -1
  356. package/dist/config/oauth.js.map +0 -1
  357. package/dist/constants.d.ts.map +0 -1
  358. package/dist/constants.js.map +0 -1
  359. package/dist/exports/client.d.ts.map +0 -1
  360. package/dist/exports/client.js.map +0 -1
  361. package/dist/index.d.ts.map +0 -1
  362. package/dist/index.js.map +0 -1
  363. package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
  364. package/dist/oauth/components/LoginButton/index.js.map +0 -1
  365. package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
  366. package/dist/oauth/components/LogoutButton/index.js.map +0 -1
  367. package/dist/oauth/defaults.d.ts.map +0 -1
  368. package/dist/oauth/defaults.js.map +0 -1
  369. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
  370. package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
  371. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
  372. package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
  373. package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
  374. package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
  375. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
  376. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
  377. package/dist/oauth/exports/client.d.ts.map +0 -1
  378. package/dist/oauth/exports/client.js.map +0 -1
  379. package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
  380. package/dist/oauth/hooks/afterLogout.js.map +0 -1
  381. package/dist/oauth/hooks/me.d.ts.map +0 -1
  382. package/dist/oauth/hooks/me.js.map +0 -1
  383. package/dist/oauth/hooks/refresh.d.ts.map +0 -1
  384. package/dist/oauth/hooks/refresh.js.map +0 -1
  385. package/dist/oauth/index.d.ts.map +0 -1
  386. package/dist/oauth/index.js.map +0 -1
  387. package/dist/oauth/strategy/index.d.ts.map +0 -1
  388. package/dist/oauth/strategy/index.js.map +0 -1
  389. package/dist/oauth/types.d.ts.map +0 -1
  390. package/dist/oauth/types.js.map +0 -1
  391. package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
  392. package/dist/oauth/utilities/clearCookie.js.map +0 -1
  393. package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
  394. package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
  395. package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
  396. package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
  397. package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
  398. package/dist/oauth/utilities/extractOrigin.js.map +0 -1
  399. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
  400. package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
  401. package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
  402. package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
  403. package/dist/oauth/utilities/getAdminPath.js +0 -9
  404. package/dist/oauth/utilities/getAdminPath.js.map +0 -1
  405. package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
  406. package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
  407. package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
  408. package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
  409. package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
  410. package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
  411. package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
  412. package/dist/oauth/utilities/getTokenExp.js.map +0 -1
  413. package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
  414. package/dist/oauth/utilities/getUsernameField.js.map +0 -1
  415. package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
  416. package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
  417. package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
  418. package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
  419. package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
  420. package/dist/oauth/utilities/refreshTokens.js.map +0 -1
  421. package/dist/plugin/adapter.d.ts.map +0 -1
  422. package/dist/plugin/adapter.js.map +0 -1
  423. package/dist/plugin/build-config.d.ts.map +0 -1
  424. package/dist/plugin/build-config.js.map +0 -1
  425. package/dist/types/config.d.ts.map +0 -1
  426. package/dist/types/config.js.map +0 -1
  427. package/dist/types.d.ts.map +0 -1
  428. package/dist/types.js.map +0 -1
  429. package/dist/utils/asset-collection.d.ts.map +0 -1
  430. package/dist/utils/asset-collection.js.map +0 -1
  431. package/dist/utils/build-detection.d.ts.map +0 -1
  432. package/dist/utils/build-detection.js.map +0 -1
  433. package/dist/utils/config.d.ts.map +0 -1
  434. package/dist/utils/config.js.map +0 -1
  435. package/dist/utils/download-template.d.ts.map +0 -1
  436. package/dist/utils/download-template.js.map +0 -1
  437. package/dist/utils/env-management.d.ts.map +0 -1
  438. package/dist/utils/env-management.js.map +0 -1
  439. package/dist/utils/format.d.ts.map +0 -1
  440. package/dist/utils/format.js.map +0 -1
  441. package/dist/utils/formatter.d.ts.map +0 -1
  442. package/dist/utils/formatter.js.map +0 -1
  443. package/dist/utils/git.d.ts.map +0 -1
  444. package/dist/utils/git.js.map +0 -1
  445. package/dist/utils/is-debug.d.ts.map +0 -1
  446. package/dist/utils/is-debug.js.map +0 -1
  447. package/dist/utils/lambda-config.d.ts.map +0 -1
  448. package/dist/utils/lambda-config.js.map +0 -1
  449. package/dist/utils/log.d.ts.map +0 -1
  450. package/dist/utils/log.js.map +0 -1
  451. package/dist/utils/messages.d.ts.map +0 -1
  452. package/dist/utils/messages.js.map +0 -1
  453. package/dist/utils/package-manager.d.ts.map +0 -1
  454. package/dist/utils/package-manager.js.map +0 -1
  455. package/dist/utils/payload-config-ast.d.ts.map +0 -1
  456. package/dist/utils/payload-config-ast.js.map +0 -1
  457. package/dist/utils/payload-config-finder.d.ts.map +0 -1
  458. package/dist/utils/payload-config-finder.js.map +0 -1
  459. package/dist/utils/payload-config-modifier.d.ts.map +0 -1
  460. package/dist/utils/payload-config-modifier.js.map +0 -1
  461. package/dist/utils/payload-package-check.d.ts.map +0 -1
  462. package/dist/utils/payload-package-check.js.map +0 -1
  463. package/dist/utils/project.d.ts.map +0 -1
  464. package/dist/utils/project.js.map +0 -1
  465. package/dist/utils/s3-upload.d.ts.map +0 -1
  466. package/dist/utils/s3-upload.js.map +0 -1
  467. package/dist/utils/token-display.d.ts.map +0 -1
  468. package/dist/utils/token-display.js.map +0 -1
  469. package/dist/utils/typescript-validator.d.ts.map +0 -1
  470. package/dist/utils/typescript-validator.js.map +0 -1
@@ -1,26 +1,374 @@
1
+ import { cloudStoragePlugin } from '@payloadcms/plugin-cloud-storage';
1
2
  import { lexicalEditor } from '@payloadcms/richtext-lexical';
2
3
  import { buildConfig as payloadBuildConfig } from 'payload';
4
+ import { getBootstrapInfo } from '../api/control-plane.js';
5
+ import { getValidCredential } from '../auth/oauth-flow.js';
6
+ import { getTokenStore } from '../auth/token-store.js';
7
+ import { getEnvConfig } from '../constants.js';
8
+ import { contentAPIAdapter } from '../db-content-api/index.js';
9
+ import { scheduleExtractPlugin } from '../deploy/schedule-extract-plugin.js';
10
+ import { health } from '../endpoints/health.js';
11
+ import { schema } from '../endpoints/schema.js';
3
12
  import { oAuth2Plugin } from '../oauth/index.js';
4
- import { figmaContentSystem } from './adapter.js';
13
+ import { createStorageClient } from '../storage-content-api/client.js';
14
+ import { contentApiStorageAdapter } from '../storage-content-api/index.js';
15
+ import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
16
+ import { getEnvVarSync } from '../utils/env-management.js';
17
+ import * as log from '../utils/log.js';
18
+ import { logMissingCliAuth } from './auth-preflight.js';
19
+ import { logMissingContentSystemId } from './bootstrap-preflight.js';
20
+ import { getDevCookieNames } from './dev-cookie-names.js';
5
21
  /**
6
- * Figma platform wrapper for Payload's buildConfig.
7
- * Automatically injects:
8
- * - Figma database adapter
9
- * - Secret (platform-provided)
10
- * - Default lexicalEditor (if no custom editor specified)
22
+ * Worker-trusted marker injected by Figma's sites-worker after it validates the
23
+ * X-Figma-Job-Queues-Auth-Bypass secret on a Payload jobs endpoint. The default
24
+ * `jobs.access.run` below honors this marker so Sinatra (async-job-workflow)
25
+ * can drive job runs without the bypass secret ever reaching tenant code.
11
26
  *
12
- * @param config - Payload configuration (db and secret omitted, editor optional)
13
- * @returns Promise<SanitizedConfig> - Built Payload configuration
14
- */ export async function buildConfig(config) {
27
+ * KEEP_IN_SYNC(cloudflare/wrangler/sites-worker/src/auth.ts): FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER
28
+ */ export const FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER = 'figma-internal-forwarded-has-auth-bypass';
29
+ /**
30
+ * Fields added to users collection for Figma profile info
31
+ */ const figmaUserFields = [
32
+ {
33
+ name: 'figmaHandle',
34
+ type: 'text',
35
+ admin: {
36
+ readOnly: true
37
+ },
38
+ label: 'Name'
39
+ },
40
+ {
41
+ name: 'figmaImageUrl',
42
+ type: 'text',
43
+ admin: {
44
+ components: {
45
+ Cell: '@payloadcms/figma/client#FigmaAvatarCell'
46
+ },
47
+ disabled: {
48
+ bulkEdit: true
49
+ },
50
+ hidden: true,
51
+ readOnly: true
52
+ },
53
+ label: 'Profile Picture'
54
+ },
55
+ // Virtual (never persisted): populated per-request from the session JWT. The
56
+ // afterRead hook surfaces the claim on the requester's OWN user record only —
57
+ // a JWT describes its bearer, so these are meaningful for req.user, not for
58
+ // reads of other users. See defaults.ts (defaultVerify) which attaches the
59
+ // live claim to req.user.
60
+ {
61
+ name: 'userGroups',
62
+ type: 'text',
63
+ access: {
64
+ read: ({ id, req })=>req.user?.id === id
65
+ },
66
+ admin: {
67
+ readOnly: true
68
+ },
69
+ hasMany: true,
70
+ hooks: {
71
+ afterRead: [
72
+ ({ data, req })=>data?.id !== undefined && req.user?.id === data.id ? req.user.userGroups : undefined
73
+ ]
74
+ },
75
+ label: 'User Groups',
76
+ virtual: true
77
+ },
78
+ // KEEP_IN_SYNC(sinatra/controllers/api/api_payload_control_plane.rb) — resolve_make_permission
79
+ {
80
+ name: 'makePermission',
81
+ type: 'select',
82
+ access: {
83
+ read: ({ id, req })=>req.user?.id === id
84
+ },
85
+ admin: {
86
+ readOnly: true
87
+ },
88
+ hooks: {
89
+ afterRead: [
90
+ ({ data, req })=>data?.id !== undefined && req.user?.id === data.id ? req.user.makePermission : undefined
91
+ ]
92
+ },
93
+ label: 'Make Permission',
94
+ options: [
95
+ {
96
+ label: 'View',
97
+ value: 'view'
98
+ },
99
+ {
100
+ label: 'Edit',
101
+ value: 'edit'
102
+ }
103
+ ],
104
+ virtual: true
105
+ }
106
+ ];
107
+ function missingOAuthCredential(name) {
108
+ log.warning(`${name} could not be resolved. OAuth login will not work until this is configured. ` + 'Run `npx @payloadcms/figma init` to set up your project.');
109
+ return '';
110
+ }
111
+ /**
112
+ * Fetch bootstrap data from the API and cache all environments locally.
113
+ * Returns the requested environment's data, or a typed failure reason.
114
+ */ async function resolveAndCacheBootstrap(store, projectId, environmentName) {
115
+ let credential;
116
+ try {
117
+ credential = await getValidCredential(store);
118
+ } catch (error) {
119
+ return {
120
+ ok: false,
121
+ reason: {
122
+ kind: 'network',
123
+ message: messageOf(error)
124
+ }
125
+ };
126
+ }
127
+ if (!credential) {
128
+ return {
129
+ ok: false,
130
+ reason: {
131
+ kind: 'unauthenticated'
132
+ }
133
+ };
134
+ }
135
+ try {
136
+ const bootstrapInfo = await getBootstrapInfo(credential, projectId);
137
+ cacheAllEnvironments(store, projectId, bootstrapInfo);
138
+ } catch (error) {
139
+ return {
140
+ ok: false,
141
+ reason: {
142
+ kind: 'network',
143
+ message: messageOf(error)
144
+ }
145
+ };
146
+ }
147
+ const data = store.getBootstrapData(projectId, environmentName);
148
+ if (!data) {
149
+ return {
150
+ ok: false,
151
+ reason: {
152
+ environmentName,
153
+ kind: 'environment-not-found',
154
+ projectId
155
+ }
156
+ };
157
+ }
158
+ return {
159
+ data,
160
+ ok: true
161
+ };
162
+ }
163
+ function messageOf(error) {
164
+ return error instanceof Error ? error.message : 'Unknown error';
165
+ }
166
+ /**
167
+ * Creates storage configuration for upload collections
168
+ */ function createStorageConfig(url, contentSystemId) {
169
+ const storageConfig = process.env.FIGMA_CONTENT_API_ACCESS_KEY ? {
170
+ baseUrl: url,
171
+ contentApiKey: process.env.FIGMA_CONTENT_API_ACCESS_KEY
172
+ } : process.env.FIGMA_DEV_JWT === 'true' ? {
173
+ auth: {
174
+ mode: 'devJwt'
175
+ },
176
+ baseUrl: url,
177
+ contentSystemId
178
+ } : {
179
+ auth: {
180
+ mode: 'tokenStore',
181
+ tokenStore: getTokenStore()
182
+ },
183
+ baseUrl: url,
184
+ contentSystemId
185
+ };
186
+ const adapter = contentApiStorageAdapter(storageConfig);
187
+ const storageClient = createStorageClient(storageConfig);
188
+ return {
189
+ adapter,
190
+ storageClient
191
+ };
192
+ }
193
+ /**
194
+ * Plugin that applies cloud storage configuration to all upload-enabled collections.
195
+ * Runs at the end of the plugin chain so it sees collections added by user plugins too.
196
+ */ function createStoragePlugin(url, contentSystemId) {
197
+ return (incomingConfig)=>{
198
+ const uploadCollections = (incomingConfig.collections || []).filter((c)=>c.upload);
199
+ if (uploadCollections.length === 0) {
200
+ return incomingConfig;
201
+ }
202
+ const { adapter } = createStorageConfig(url, contentSystemId);
203
+ const collectionsMap = uploadCollections.reduce((acc, c)=>{
204
+ acc[c.slug] = {
205
+ adapter,
206
+ disableLocalStorage: true
207
+ };
208
+ return acc;
209
+ }, {});
210
+ const storagePlugin = cloudStoragePlugin({
211
+ collections: collectionsMap
212
+ });
213
+ return storagePlugin(incomingConfig);
214
+ };
215
+ }
216
+ export async function buildFigmaConfig(config) {
217
+ const envConfig = getEnvConfig();
218
+ // Resolve contentSystemId: config first, env var, then local store fallback (dev)
219
+ let { contentSystemId } = config.figma;
220
+ let environmentId = config.figma.environmentId ?? process.env.FIGMA_EID;
221
+ contentSystemId ??= process.env.FIGMA_CONTENT_API_CONTENT_SYSTEM_ID;
222
+ let bootstrapData = null;
223
+ let bootstrapReason = null;
224
+ // Local dev: resolve from project ID + bootstrap cache
225
+ // Use getEnvVarSync fallback because Next.js evaluates config before dotenv populates process.env
226
+ if (!contentSystemId) {
227
+ const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
228
+ const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
229
+ if (!projectId || !environmentName) {
230
+ bootstrapReason = {
231
+ kind: 'no-config'
232
+ };
233
+ } else {
234
+ const store = getTokenStore();
235
+ bootstrapData = store.getBootstrapData(projectId, environmentName);
236
+ // Runtime fallback: fetch from API if not cached (e.g. environment switch without re-init)
237
+ if (!bootstrapData) {
238
+ const resolution = await resolveAndCacheBootstrap(store, projectId, environmentName);
239
+ if (resolution.ok) {
240
+ bootstrapData = resolution.data;
241
+ } else {
242
+ bootstrapReason = resolution.reason;
243
+ }
244
+ }
245
+ if (bootstrapData) {
246
+ contentSystemId = bootstrapData.contentSystemId;
247
+ environmentId ??= bootstrapData.tenantInstanceId;
248
+ }
249
+ }
250
+ }
251
+ if (!environmentId) {
252
+ const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID');
253
+ const environmentName = process.env.FIGMA_ENVIRONMENT_NAME ?? getEnvVarSync(process.cwd(), 'FIGMA_ENVIRONMENT_NAME');
254
+ if (projectId && environmentName) {
255
+ bootstrapData ??= getTokenStore().getBootstrapData(projectId, environmentName);
256
+ environmentId = bootstrapData?.tenantInstanceId;
257
+ }
258
+ }
259
+ if (!environmentId) {
260
+ throw new Error('Environment ID could not be resolved. Set FIGMA_EID or initialize the project.');
261
+ }
262
+ if (!contentSystemId) {
263
+ logMissingContentSystemId(bootstrapReason ?? {
264
+ kind: 'no-config'
265
+ });
266
+ throw new Error('Content System ID could not be resolved. ' + 'Run `npx @payloadcms/figma init` to set up your project.');
267
+ }
268
+ const url = process.env.FIGMA_CONTENT_API_URL || envConfig.contentApiUrl;
269
+ const isProduction = process.env.NODE_ENV === 'production';
270
+ // The deployed Lambda runs all queued jobs; locally there is no runner, so the db adapter logs
271
+ // a heads-up whenever a job is queued. Deployed environments set DISABLE_LOCAL_JOB_QUEUE_NOTIFICATIONS=true
272
+ // (injected by the control plane); end-users can also set it locally to silence the notice.
273
+ const notifyLocalJobQueue = process.env.DISABLE_LOCAL_JOB_QUEUE_NOTIFICATIONS !== 'true';
274
+ const usesTokenStoreAuth = !process.env.FIGMA_CONTENT_API_ACCESS_KEY && process.env.FIGMA_DEV_JWT !== 'true';
275
+ if (usesTokenStoreAuth) {
276
+ logMissingCliAuth(getTokenStore());
277
+ }
278
+ // Determine database adapter based on environment
279
+ let db;
280
+ if (config.figma.useContentSystem === false) {
281
+ db = config.db;
282
+ } else if (process.env.FIGMA_CONTENT_API_ACCESS_KEY) {
283
+ db = contentAPIAdapter({
284
+ auth: {
285
+ apiKey: process.env.FIGMA_CONTENT_API_ACCESS_KEY,
286
+ mode: 'apiKey'
287
+ },
288
+ contentSystemId,
289
+ environmentName: process.env.FIGMA_ENVIRONMENT_NAME,
290
+ notifyLocalJobQueue,
291
+ url
292
+ });
293
+ } else if (process.env.FIGMA_DEV_JWT === 'true') {
294
+ db = contentAPIAdapter({
295
+ auth: {
296
+ mode: 'devJwt'
297
+ },
298
+ contentSystemId,
299
+ environmentName: process.env.FIGMA_ENVIRONMENT_NAME,
300
+ notifyLocalJobQueue,
301
+ url
302
+ });
303
+ } else {
304
+ db = contentAPIAdapter({
305
+ auth: {
306
+ mode: 'tokenStore',
307
+ tokenStore: getTokenStore()
308
+ },
309
+ contentSystemId,
310
+ environmentName: process.env.FIGMA_ENVIRONMENT_NAME,
311
+ notifyLocalJobQueue,
312
+ url
313
+ });
314
+ }
315
+ const userJobsAccessRun = config.jobs?.access?.run;
15
316
  // Build complete config with Figma platform defaults
16
317
  const configWithFigmaDefaults = {
17
318
  ...config,
18
- db: config.figma.useContentSystem ? figmaContentSystem() : config.db,
319
+ admin: {
320
+ // Auto-refresh tokens before expiry to prevent unexpected logouts.
321
+ autoRefresh: true,
322
+ avatar: {
323
+ Component: '@payloadcms/figma/client#FigmaAvatar'
324
+ },
325
+ ...config.admin
326
+ },
327
+ custom: {
328
+ figma: {
329
+ ...config.figma,
330
+ contentSystemId,
331
+ environmentId
332
+ }
333
+ },
334
+ db,
19
335
  editor: config.editor ?? lexicalEditor(),
336
+ endpoints: [
337
+ ...config.endpoints ?? [],
338
+ health,
339
+ schema
340
+ ],
341
+ // Gate /api/payload-jobs/run and /api/payload-jobs/handle-schedules. Honor the
342
+ // sites-worker trust marker so Figma infra job runs never break, defer to the
343
+ // tenant's jobs.access.run if they set one, otherwise fall back to Payload's
344
+ // "logged-in user" default so the admin "Run jobs" UI keeps working.
345
+ jobs: {
346
+ ...config.jobs ?? {},
347
+ access: {
348
+ ...config.jobs?.access ?? {},
349
+ run: (args)=>{
350
+ if (args.req.headers.get(FIGMA_INTERNAL_FORWARDED_HAS_AUTH_BYPASS_HEADER) === '1') {
351
+ return true;
352
+ }
353
+ if (userJobsAccessRun) {
354
+ return userJobsAccessRun(args);
355
+ }
356
+ return !!args.req.user;
357
+ }
358
+ }
359
+ },
360
+ ...isProduction && !config.logger ? {
361
+ logger: {
362
+ options: {}
363
+ }
364
+ } : {},
20
365
  secret: 'MY_SECRET',
21
366
  // Add oauth to plugins if not already present
22
367
  plugins: [
23
368
  ...config.plugins ?? [],
369
+ ...config.figma.storage !== false ? [
370
+ createStoragePlugin(url, contentSystemId)
371
+ ] : [],
24
372
  oAuth2Plugin({
25
373
  collections: [
26
374
  {
@@ -30,9 +378,9 @@ import { figmaContentSystem } from './adapter.js';
30
378
  response_mode: 'query',
31
379
  response_type: 'code'
32
380
  },
33
- clientID: process.env.FIGMA_OAUTH_CLIENT_ID,
34
- clientSecret: process.env.FIGMA_OAUTH_CLIENT_SECRET,
35
- identityMetadata: 'https://staging.figma.com/.well-known/openid-configuration',
381
+ clientID: process.env.FIGMA_OAUTH_CLIENT_ID ?? bootstrapData?.oauthClientId ?? missingOAuthCredential('FIGMA_OAUTH_CLIENT_ID'),
382
+ clientSecret: process.env.FIGMA_OAUTH_CLIENT_SECRET ?? bootstrapData?.oauthClientSecret,
383
+ identityMetadata: envConfig.identityMetadata,
36
384
  scope: [
37
385
  'current_user:read'
38
386
  ],
@@ -40,14 +388,29 @@ import { figmaContentSystem } from './adapter.js';
40
388
  usernameField: 'email'
41
389
  }
42
390
  ],
391
+ ...isProduction ? {} : getDevCookieNames(contentSystemId),
43
392
  debug: !!process.env.DEBUG,
44
- disabled: false,
45
- redirectServerURL: 'http://localhost:3000'
46
- })
393
+ disabled: false
394
+ }),
395
+ scheduleExtractPlugin()
47
396
  ]
48
397
  };
398
+ // Inject figma fields into users collection
399
+ const collections = configWithFigmaDefaults.collections?.map((col)=>{
400
+ if (col.slug === 'users') {
401
+ return {
402
+ ...col,
403
+ fields: [
404
+ ...col.fields || [],
405
+ ...figmaUserFields
406
+ ]
407
+ };
408
+ }
409
+ return col;
410
+ });
411
+ if (collections) {
412
+ configWithFigmaDefaults.collections = collections;
413
+ }
49
414
  // Delegate to Payload's buildConfig
50
415
  return await payloadBuildConfig(configWithFigmaDefaults);
51
416
  }
52
-
53
- //# sourceMappingURL=build-config.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Namespace OAuth cookies per-app in local dev so multiple Payload apps
3
+ * running on localhost (shared cookie jar across ports) don't clobber each
4
+ * other's sessions on logout. Uses projectId so the cookie stays stable when
5
+ * switching environments in the same checkout; falls back to contentSystemId
6
+ * when projectId isn't in `.env`.
7
+ *
8
+ * In production, cookies are isolated by unique hostnames and this is unused.
9
+ */
10
+ export declare function getDevCookieNames(contentSystemId: string): {
11
+ cookieName: string;
12
+ userInfoCookieName: string;
13
+ };
@@ -0,0 +1,17 @@
1
+ import { getEnvVarSync } from '../utils/env-management.js';
2
+ /**
3
+ * Namespace OAuth cookies per-app in local dev so multiple Payload apps
4
+ * running on localhost (shared cookie jar across ports) don't clobber each
5
+ * other's sessions on logout. Uses projectId so the cookie stays stable when
6
+ * switching environments in the same checkout; falls back to contentSystemId
7
+ * when projectId isn't in `.env`.
8
+ *
9
+ * In production, cookies are isolated by unique hostnames and this is unused.
10
+ */ export function getDevCookieNames(contentSystemId) {
11
+ const projectId = process.env.FIGMA_PROJECT_ID ?? getEnvVarSync(process.cwd(), 'FIGMA_PROJECT_ID') ?? contentSystemId;
12
+ const suffix = projectId.slice(0, 8);
13
+ return {
14
+ cookieName: `figma-${suffix}-oauth-token`,
15
+ userInfoCookieName: `figma-${suffix}-user-info`
16
+ };
17
+ }
package/dist/scss.d.js ADDED
@@ -0,0 +1,2 @@
1
+ // Side-effect SCSS imports in admin components carry styling only; declaring the
2
+ // module lets the type checker accept them while SWC/copyfiles handle the assets.
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Upload API types extracted from Content API OpenAPI spec.
3
+ * These are kept separate to avoid breaking changes when the main spec is regenerated.
4
+ */
5
+ type UploadErrorResponse = {
6
+ content: {
7
+ 'application/json': {
8
+ code?: string;
9
+ message: string;
10
+ };
11
+ };
12
+ };
13
+ type UploadErrorResponses = {
14
+ 400: UploadErrorResponse;
15
+ 401: UploadErrorResponse;
16
+ 403: UploadErrorResponse;
17
+ 404: UploadErrorResponse;
18
+ 503: UploadErrorResponse;
19
+ };
20
+ export type UploadPaths = {
21
+ '/api/v0/uploads/{collectionId}/{filename}': {
22
+ delete: {
23
+ parameters: {
24
+ path: {
25
+ collectionId: string;
26
+ filename: string;
27
+ };
28
+ };
29
+ responses: {
30
+ 200: {
31
+ content: {
32
+ 'application/json': {
33
+ success: true;
34
+ };
35
+ };
36
+ };
37
+ };
38
+ };
39
+ };
40
+ '/api/v0/uploads/download/sign': {
41
+ post: {
42
+ requestBody: {
43
+ content: {
44
+ 'application/json': {
45
+ collectionId: string;
46
+ expiresIn: number;
47
+ filename: string;
48
+ };
49
+ };
50
+ };
51
+ responses: {
52
+ 200: {
53
+ content: {
54
+ 'application/json': {
55
+ url: string;
56
+ };
57
+ };
58
+ };
59
+ };
60
+ };
61
+ };
62
+ '/api/v0/uploads/multipart/abort': {
63
+ post: {
64
+ requestBody: {
65
+ content: {
66
+ 'application/json': {
67
+ collectionId: string;
68
+ filename: string;
69
+ uploadId: string;
70
+ };
71
+ };
72
+ };
73
+ responses: {
74
+ 200: {
75
+ content: {
76
+ 'application/json': {
77
+ success: true;
78
+ };
79
+ };
80
+ };
81
+ } & UploadErrorResponses;
82
+ };
83
+ };
84
+ '/api/v0/uploads/multipart/complete': {
85
+ post: {
86
+ requestBody: {
87
+ content: {
88
+ 'application/json': {
89
+ collectionId: string;
90
+ filename: string;
91
+ parts: Array<{
92
+ ETag: string;
93
+ PartNumber: number;
94
+ }>;
95
+ uploadId: string;
96
+ };
97
+ };
98
+ };
99
+ responses: {
100
+ 200: {
101
+ content: {
102
+ 'application/json': {
103
+ success: true;
104
+ };
105
+ };
106
+ };
107
+ } & UploadErrorResponses;
108
+ };
109
+ };
110
+ '/api/v0/uploads/multipart/initiate': {
111
+ post: {
112
+ requestBody: {
113
+ content: {
114
+ 'application/json': {
115
+ collectionId: string;
116
+ contentType: string;
117
+ filename: string;
118
+ };
119
+ };
120
+ };
121
+ responses: {
122
+ 200: {
123
+ content: {
124
+ 'application/json': {
125
+ uploadId: string;
126
+ };
127
+ };
128
+ };
129
+ } & UploadErrorResponses;
130
+ };
131
+ };
132
+ '/api/v0/uploads/multipart/parts': {
133
+ post: {
134
+ requestBody: {
135
+ content: {
136
+ 'application/json': {
137
+ collectionId: string;
138
+ expiresIn: number;
139
+ filename: string;
140
+ partNumbers: number[];
141
+ uploadId: string;
142
+ };
143
+ };
144
+ };
145
+ responses: {
146
+ 200: {
147
+ content: {
148
+ 'application/json': {
149
+ parts: Array<{
150
+ partNumber: number;
151
+ url: string;
152
+ }>;
153
+ };
154
+ };
155
+ };
156
+ } & UploadErrorResponses;
157
+ };
158
+ };
159
+ '/api/v0/uploads/sign': {
160
+ post: {
161
+ requestBody: {
162
+ content: {
163
+ 'application/json': {
164
+ collectionId: string;
165
+ contentType?: string;
166
+ expiresIn: number;
167
+ filename: string;
168
+ };
169
+ };
170
+ };
171
+ responses: {
172
+ 200: {
173
+ content: {
174
+ 'application/json': {
175
+ url: string;
176
+ };
177
+ };
178
+ };
179
+ } & UploadErrorResponses;
180
+ };
181
+ };
182
+ };
183
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Upload API types extracted from Content API OpenAPI spec.
3
+ * These are kept separate to avoid breaking changes when the main spec is regenerated.
4
+ */ export { };
@@ -0,0 +1,14 @@
1
+ import type { GenerateUploadInstructions, UploadInstructionsAccess } from 'payload';
2
+ import type { StorageClient } from '../client.js';
3
+ type Args = {
4
+ access?: UploadInstructionsAccess;
5
+ client: StorageClient;
6
+ };
7
+ /**
8
+ * v4 client-upload entry point. Payload core calls this from
9
+ * `POST /api/upload-instructions`; we sign a Content API upload URL and hand the
10
+ * browser an `http` PUT instruction plus an `uploadReference` that
11
+ * `handleUpload`/`staticHandler` use to recognize the already-uploaded file.
12
+ */
13
+ export declare const getGenerateUploadInstructions: ({ access, client, }: Args) => GenerateUploadInstructions;
14
+ export {};