@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,9 +0,0 @@
1
- /**
2
- * This is the path to the admin panel WITHOUT domain.
3
- *
4
- * This respects the `basePath` property in the Next config.
5
- */ export const getAdminPath = (config)=>{
6
- return `${process.env.NEXT_BASE_PATH ?? ''}${config.routes?.admin || '/admin'}`;
7
- };
8
-
9
- //# sourceMappingURL=getAdminPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/getAdminPath.ts"],"sourcesContent":["import type { ClientConfig, SanitizedConfig } from 'payload'\n\n/**\n * This is the path to the admin panel WITHOUT domain.\n *\n * This respects the `basePath` property in the Next config.\n */\nexport const getAdminPath = (config: ClientConfig | SanitizedConfig) => {\n return `${process.env.NEXT_BASE_PATH ?? ''}${config.routes?.admin || '/admin'}`\n}\n"],"names":["getAdminPath","config","process","env","NEXT_BASE_PATH","routes","admin"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,MAAMA,eAAe,CAACC;IAC3B,OAAO,GAAGC,QAAQC,GAAG,CAACC,cAAc,IAAI,KAAKH,OAAOI,MAAM,EAAEC,SAAS,UAAU;AACjF,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAuthorizeURL.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/getAuthorizeURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAMxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AAI7E,UAAU,IAAI;IACZ,UAAU,EAAE,gBAAgB,CAAA;IAC5B,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,aAAa,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,eAAO,MAAM,eAAe,oIAUzB,IAAI,KAAG,OAAO,CAAC,MAAM,CAoDvB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/getAuthorizeURL.ts"],"sourcesContent":["import type { CollectionConfig, Payload } from 'payload'\n\nimport crypto from 'crypto'\nimport * as QueryString from 'qs-esm'\nimport { v4 as uuid } from 'uuid'\n\nimport type { Strategy } from '../strategy/index.js'\nimport type { CollectionOptions, PluginOptions, StateObj } from '../types.js'\n\nimport { defaultScope } from '../defaults.js'\n\ninterface Args {\n collection: CollectionConfig\n collectionOptions: CollectionOptions\n endpointSlug: string\n failedRedirect?: unknown\n payload: Payload\n pluginOptions: PluginOptions\n redirect?: unknown\n serverURLOverride?: unknown\n strategy: Strategy\n}\n\nexport const getAuthorizeURL = async ({\n collection,\n collectionOptions,\n endpointSlug,\n failedRedirect,\n payload,\n pluginOptions,\n redirect,\n serverURLOverride,\n strategy,\n}: Args): Promise<string> => {\n const { redirectServerURL } = pluginOptions\n\n await strategy.ensureMeta()\n\n // Generate a random code verifier\n const codeVerifier = crypto.randomBytes(32).toString('base64url')\n\n // Create a code challenge by hashing the code verifier\n const code_challenge = crypto.createHash('sha256').update(codeVerifier).digest('base64url')\n\n const state: StateObj = {\n sig: payload.encrypt(strategy.name),\n verifier: payload.encrypt(codeVerifier),\n }\n\n if (typeof serverURLOverride === 'string') {\n state.serverURL = serverURLOverride\n }\n\n if (typeof redirect === 'string') {\n state.redirect = redirect\n }\n\n if (typeof failedRedirect === 'string') {\n state.failedRedirect = failedRedirect\n }\n\n const baseRedirectURL = redirectServerURL || payload.config.serverURL || state.serverURL\n\n const loginRedirectURL = encodeURI(\n `${baseRedirectURL}${payload.config.routes?.api || '/api'}/${collection.slug}/${endpointSlug}/login`,\n )\n\n const params = {\n client_id: collectionOptions.clientID,\n code_challenge,\n code_challenge_method: 'S256',\n nonce: uuid(),\n redirect_uri: loginRedirectURL,\n response_mode: 'form_post',\n response_type: 'id_token%20token%20code',\n scope: (collectionOptions.scope ?? defaultScope).join('+'),\n state: Buffer.from(JSON.stringify(state)).toString('base64'),\n ...(collectionOptions.authorizationURLParams || {}),\n }\n\n const authorizeURL = `${strategy.meta?.authorization_endpoint}?${QueryString.stringify(params, {\n encode: false,\n })}`\n\n return authorizeURL\n}\n"],"names":["crypto","QueryString","v4","uuid","defaultScope","getAuthorizeURL","collection","collectionOptions","endpointSlug","failedRedirect","payload","pluginOptions","redirect","serverURLOverride","strategy","redirectServerURL","ensureMeta","codeVerifier","randomBytes","toString","code_challenge","createHash","update","digest","state","sig","encrypt","name","verifier","serverURL","baseRedirectURL","config","loginRedirectURL","encodeURI","routes","api","slug","params","client_id","clientID","code_challenge_method","nonce","redirect_uri","response_mode","response_type","scope","join","Buffer","from","JSON","stringify","authorizationURLParams","authorizeURL","meta","authorization_endpoint","encode"],"mappings":"AAEA,OAAOA,YAAY,SAAQ;AAC3B,YAAYC,iBAAiB,SAAQ;AACrC,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,YAAY,QAAQ,iBAAgB;AAc7C,OAAO,MAAMC,kBAAkB,OAAO,EACpCC,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,cAAc,EACdC,OAAO,EACPC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,EACjBC,QAAQ,EACH;IACL,MAAM,EAAEC,iBAAiB,EAAE,GAA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AI;IAEJ,OAAOH;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCookieExpiration.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/getCookieExpiration.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAEvD,eAAO,MAAM,mBAAmB,aAAc,aAAa,KAAG,IAS7D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/getCookieExpiration.ts"],"sourcesContent":["type CookieExpires = Date | number | string | undefined\n\nexport const getCookieExpiration = (expires?: CookieExpires): Date => {\n if (expires instanceof Date) {\n return expires\n }\n\n const seconds = typeof expires === 'number' ? expires : 7200\n const currentTime = new Date()\n currentTime.setSeconds(currentTime.getSeconds() + seconds)\n return currentTime\n}\n"],"names":["getCookieExpiration","expires","Date","seconds","currentTime","setSeconds","getSeconds"],"mappings":"AAEA,OAAO,MAAMA,sBAAsB,CAACC;IAClC,IAAIA,mBAAmBC,MAAM;QAC3B,OAAOD;IACT;IAEA,MAAME,UAAU,OAAOF,YAAY,WAAWA,UAAU;IACxD,MAAMG,cAAc,IAAIF;IACxBE,YAAYC,UAAU,CAACD,YAAYE,UAAU,KAAKH;IAClD,OAAOC;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getSecondsFromTokenExp.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/getSecondsFromTokenExp.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAG1E"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/getSecondsFromTokenExp.ts"],"sourcesContent":["export function getSecondsFromTokenExp(futureUnixTimestamp: number): number {\n const now = Math.floor(Date.now() / 1000) // current time in seconds\n return futureUnixTimestamp - now\n}\n"],"names":["getSecondsFromTokenExp","futureUnixTimestamp","now","Math","floor","Date"],"mappings":"AAAA,OAAO,SAASA,uBAAuBC,mBAA2B;IAChE,MAAMC,MAAMC,KAAKC,KAAK,CAACC,KAAKH,GAAG,KAAK,MAAM,0BAA0B;;IACpE,OAAOD,sBAAsBC;AAC/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTokenExp.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/getTokenExp.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,eAAO,MAAM,WAAW,4BAGrB;IACD,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,KAAG,MAAM,GAAG,SAwBZ,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/getTokenExp.ts"],"sourcesContent":["import jwt from 'jsonwebtoken'\n\nimport type { DebugLogger } from '../types.js'\n\nexport const getTokenExp = ({\n debugLogger,\n token,\n}: {\n debugLogger: DebugLogger\n token: string\n}): number | undefined => {\n if (!token) {\n return undefined\n }\n\n try {\n const decoded = jwt.decode(token)\n\n if (\n decoded &&\n typeof decoded === 'object' &&\n 'exp' in decoded &&\n typeof decoded.exp === 'number'\n ) {\n return decoded.exp\n }\n } catch (err: unknown) {\n debugLogger.error({\n err,\n msg: 'Error decoding token in getTokenExp',\n })\n }\n\n return undefined\n}\n"],"names":["jwt","getTokenExp","debugLogger","token","undefined","decoded","decode","exp","err","error","msg"],"mappings":"AAAA,OAAOA,SAAS,eAAc;AAI9B,OAAO,MAAMC,cAAc,CAAC,EAC1BC,WAAW,EACXC,KAAK,EAIN;IACC,IAAI,CAACA,OAAO;QACV,OAAOC;IACT;IAEA,IAAI;QACF,MAAMC,UAAUL,IAAIM,MAAM,CAACH;QAE3B,IACEE,WACA,OAAOA,YAAY,YACnB,SAASA,WACT,OAAOA,QAAQE,GAAG,KAAK,UACvB;YACA,OAAOF,QAAQE,GAAG;QACpB;IACF,EAAE,OAAOC,KAAc;QACrBN,YAAYO,KAAK,CAAC;YAChBD;YACAE,KAAK;QACP;IACF;IAEA,OAAON;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getUsernameField.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/getUsernameField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAItE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,UAAU,IAAI;IACZ,UAAU,EAAE,gBAAgB,CAAA;IAC5B,iBAAiB,EAAE,iBAAiB,CAAA;CACrC;AACD,eAAO,MAAM,gBAAgB,uCAG1B,IAAI,KAAG,UAAU,GAAG,SA0BtB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/getUsernameField.ts"],"sourcesContent":["import type { CollectionConfig, EmailField, TextField } from 'payload'\n\nimport { flattenTopLevelFields } from 'payload'\n\nimport type { CollectionOptions } from '../types.js'\n\nimport { defaultUsernameField } from '../defaults.js'\n\ninterface Args {\n collection: CollectionConfig\n collectionOptions: CollectionOptions\n}\nexport const getUsernameField = ({\n collection,\n collectionOptions,\n}: Args): EmailField | TextField => {\n if (!collectionOptions.usernameField) {\n return defaultUsernameField\n }\n\n if (typeof collectionOptions.usernameField === 'string') {\n const matchedField = flattenTopLevelFields(collection.fields).find(\n (field) => field.name === collectionOptions.usernameField,\n )\n\n if (!matchedField) {\n throw new Error(\n `Username field \"${collectionOptions.usernameField}\" not found in collection \"${collection.slug}\"`,\n )\n }\n\n if (matchedField.type !== 'text' && matchedField.type !== 'email') {\n throw new Error(\n `Username field \"${collectionOptions.usernameField}\" must be of type \"text\" or \"email\"`,\n )\n }\n\n return matchedField\n }\n\n return collectionOptions.usernameField\n}\n"],"names":["flattenTopLevelFields","defaultUsernameField","getUsernameField","collection","collectionOptions","usernameField","matchedField","fields","find","field","name","Error","slug","type"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,UAAS;AAI/C,SAASC,oBAAoB,QAAQ,iBAAgB;AAMrD,OAAO,MAAMC,mBAAmB,CAAC,EAC/BC,UAAU,EACVC,iBAAiB,EACZ;IACL,IAAI,CAACA,kBAAkBC,aAAa,EAAE;QACpC,OAAOJ;IACT;IAEA,IAAI,OAAOG,kBAAkBC,aAAa,KAAK,UAAU;QACvD,MAAMC,eAAeN,sBAAsBG,WAAWI,MAAM,EAAEC,IAAI,CAChE,CAACC,QAAUA,MAAMC,IAAI,KAAKN,kBAAkBC,aAAa;QAG3D,IAAI,CAACC,cAAc;YACjB,MAAM,IAAIK,MACR,CAAC,gBAAgB,EAAEP,kBAAkBC,aAAa,CAAC,2BAA2B,EAAEF,WAAWS,IAAI,CAAC,CAAC,CAAC;QAEtG;QAEA,IAAIN,aAAaO,IAAI,KAAK,UAAUP,aAAaO,IAAI,KAAK,SAAS;YACjE,MAAM,IAAIF,MACR,CAAC,gBAAgB,EAAEP,kBAAkBC,aAAa,CAAC,mCAAmC,CAAC;QAE3F;QAEA,OAAOC;IACT;IAEA,OAAOF,kBAAkBC,aAAa;AACxC,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"hasUserTokenPropsChanged.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/hasUserTokenPropsChanged.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,wBAAwB,SAAU,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAerF,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/hasUserTokenPropsChanged.ts"],"sourcesContent":["type User = Record<string, unknown>\n\n/**\n * Iterate over the user's properties and compare them to the token's properties.\n * If a property has changed, return true.\n */\nexport const hasUserTokenPropsChanged = (user: User, token: Record<string, unknown>): boolean => {\n // For each property in token:\n // - if so, are the values different?\n // - if so, return true\n\n // Iterate over the user's properties\n for (const key in user) {\n if (user[key] && token[key]) {\n if (compareValues(user[key], token[key])) {\n return true\n }\n }\n }\n\n return false\n}\n\nfunction compareValues(userVal: unknown, tokenVal: unknown): boolean {\n if (Array.isArray(userVal) && Array.isArray(tokenVal)) {\n return (\n userVal.some((val) => !tokenVal.includes(val)) ||\n tokenVal.some((val) => !userVal.includes(val))\n )\n }\n return userVal !== tokenVal\n}\n"],"names":["hasUserTokenPropsChanged","user","token","key","compareValues","userVal","tokenVal","Array","isArray","some","val","includes"],"mappings":"AAEA;;;CAGC,GACD,OAAO,MAAMA,2BAA2B,CAACC,MAAYC;IACnD,8BAA8B;IAC9B,qCAAqC;IACrC,uBAAuB;IAEvB,qCAAqC;IACrC,IAAK,MAAMC,OAAOF,KAAM;QACtB,IAAIA,IAAI,CAACE,IAAI,IAAID,KAAK,CAACC,IAAI,EAAE;YAC3B,IAAIC,cAAcH,IAAI,CAACE,IAAI,EAAED,KAAK,CAACC,IAAI,GAAG;gBACxC,OAAO;YACT;QACF;IACF;IAEA,OAAO;AACT,EAAC;AAED,SAASC,cAAcC,OAAgB,EAAEC,QAAiB;IACxD,IAAIC,MAAMC,OAAO,CAACH,YAAYE,MAAMC,OAAO,CAACF,WAAW;QACrD,OACED,QAAQI,IAAI,CAAC,CAACC,MAAQ,CAACJ,SAASK,QAAQ,CAACD,SACzCJ,SAASG,IAAI,CAAC,CAACC,MAAQ,CAACL,QAAQM,QAAQ,CAACD;IAE7C;IACA,OAAOL,YAAYC;AACrB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeHeaders.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/mergeHeaders.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,aAAa,EAAE,OAAO,EAAE,kBAAkB,EAAE,OAAO,GAAG,IAAI,CA8BtF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/mergeHeaders.ts"],"sourcesContent":["const headersToJoin = ['set-cookie', 'warning', 'www-authenticate', 'proxy-authenticate', 'vary']\n\nexport function mergeHeaders(sourceHeaders: Headers, destinationHeaders: Headers): void {\n // Create a map to store combined headers\n const combinedHeaders = new Headers()\n\n // Add existing destination headers to the combined map\n destinationHeaders.forEach((value, key) => {\n combinedHeaders.set(key, value)\n })\n\n // Add source headers to the combined map, joining specific headers\n sourceHeaders.forEach((value, key) => {\n const lowerKey = key.toLowerCase()\n if (headersToJoin.includes(lowerKey)) {\n if (combinedHeaders.has(key)) {\n combinedHeaders.set(key, `${combinedHeaders.get(key)}, ${value}`)\n } else {\n combinedHeaders.set(key, value)\n }\n } else {\n combinedHeaders.set(key, value)\n }\n })\n\n // Clear the destination headers and set the combined headers\n destinationHeaders.forEach((_, key) => {\n destinationHeaders.delete(key)\n })\n combinedHeaders.forEach((value, key) => {\n destinationHeaders.append(key, value)\n })\n}\n"],"names":["headersToJoin","mergeHeaders","sourceHeaders","destinationHeaders","combinedHeaders","Headers","forEach","value","key","set","lowerKey","toLowerCase","includes","has","get","_","delete","append"],"mappings":"AAAA,MAAMA,gBAAgB;IAAC;IAAc;IAAW;IAAoB;IAAsB;CAAO;AAEjG,OAAO,SAASC,aAAaC,aAAsB,EAAEC,kBAA2B;IAC9E,yCAAyC;IACzC,MAAMC,kBAAkB,IAAIC;IAE5B,uDAAuD;IACvDF,mBAAmBG,OAAO,CAAC,CAACC,OAAOC;QACjCJ,gBAAgBK,GAAG,CAACD,KAAKD;IAC3B;IAEA,mEAAmE;IACnEL,cAAcI,OAAO,CAAC,CAACC,OAAOC;QAC5B,MAAME,WAAWF,IAAIG,WAAW;QAChC,IAAIX,cAAcY,QAAQ,CAACF,WAAW;YACpC,IAAIN,gBAAgBS,GAAG,CAACL,MAAM;gBAC5BJ,gBAAgBK,GAAG,CAACD,KAAK,GAAGJ,gBAAgBU,GAAG,CAACN,KAAK,EAAE,EAAED,OAAO;YAClE,OAAO;gBACLH,gBAAgBK,GAAG,CAACD,KAAKD;YAC3B;QACF,OAAO;YACLH,gBAAgBK,GAAG,CAACD,KAAKD;QAC3B;IACF;IAEA,6DAA6D;IAC7DJ,mBAAmBG,OAAO,CAAC,CAACS,GAAGP;QAC7BL,mBAAmBa,MAAM,CAACR;IAC5B;IACAJ,gBAAgBE,OAAO,CAAC,CAACC,OAAOC;QAC9BL,mBAAmBc,MAAM,CAACT,KAAKD;IACjC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"refreshTokens.d.ts","sourceRoot":"","sources":["../../../src/oauth/utilities/refreshTokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAItC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAUpD,UAAU,IAAI;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,KAAK,MAAM,GACP;IACE,iBAAiB,EAAE,GAAG,CAAC,UAAU,CAAA;IACjC,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd,GACD,KAAK,CAAA;AAET,eAAO,MAAM,aAAa,wCAA+C,IAAI,KAAG,OAAO,CAAC,MAAM,CAmE7F,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/oauth/utilities/refreshTokens.ts"],"sourcesContent":["import type jwt from 'jsonwebtoken'\nimport type { Payload } from 'payload'\n\nimport { generateCookie } from 'payload'\n\nimport type { Strategy } from '../strategy/index.js'\n\nimport { getProjectToken } from '../../api/figma-api.js'\nimport { validateProjectToken } from '../../auth/jwt-validator.js'\nimport { getEnvironment } from '../../constants.js'\nimport { createCookieOptions } from './createCookieOptions.js'\nimport { createDebugLogger } from './createDebugLogger.js'\nimport { getCookieExpiration } from './getCookieExpiration.js'\nimport { getTokenExp } from './getTokenExp.js'\n\ninterface Args {\n payload: Payload\n refreshToken: string\n strategy: Strategy\n}\n\ntype Result =\n | {\n decodedOauthToken: jwt.JwtPayload\n headers: Headers\n token: string\n }\n | false\n\nexport const refreshTokens = async ({ payload, refreshToken, strategy }: Args): Promise<Result> => {\n const debugLogger = createDebugLogger(payload, strategy.debug)\n\n debugLogger.info({\n msg: 'Refreshing tokens',\n })\n\n const headers = new Headers()\n\n // At this point, access token is expired\n // but refresh token is still valid\n // so we will refresh both tokens\n\n try {\n // Get another project token\n const { expiresAt, token } = await getProjectToken(refreshToken, 'someproject')\n\n debugLogger.info({\n expiresAt,\n msg: 'Received new tokens from Figma API',\n token,\n })\n\n // On error, no user\n if (!token) {\n debugLogger.error({\n msg: 'Error refreshing tokens',\n })\n return false\n }\n\n if (token) {\n debugLogger.info({\n msg: 'Successfully refreshed project token',\n token,\n })\n\n const expires_in = new Date(expiresAt)\n\n const cookieOptions = createCookieOptions({\n collection: strategy.collection,\n headers,\n pluginOptions: strategy.pluginOptions,\n })\n\n const tokenCookie = generateCookie({\n ...cookieOptions,\n name: strategy.cookieName,\n expires: getCookieExpiration(expires_in),\n returnCookieAsObject: false,\n value: token,\n }) as string\n\n headers.append('Set-Cookie', tokenCookie)\n\n const decodedOauthToken = await validateProjectToken(token, getEnvironment())\n\n return { decodedOauthToken, headers, token }\n }\n } catch (error) {\n debugLogger.error({\n err: error,\n msg: 'Error refreshing tokens',\n })\n }\n\n return false\n}\n"],"names":["generateCookie","getProjectToken","validateProjectToken","getEnvironment","createCookieOptions","createDebugLogger","getCookieExpiration","refreshTokens","payload","refreshToken","strategy","debugLogger","debug","info","msg","headers","Headers","expiresAt","token","error","expires_in","Date","cookieOptions","collection","pluginOptions","tokenCookie","name","cookieName","expires","returnCookieAsObject","value","append","decodedOauthToken","err"],"mappings":"AAGA,SAASA,cAAc,QAAQ,UAAS;AAIxC,SAASC,eAAe,QAAQ,yBAAwB;AACxD,SAASC,oBAAoB,Q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QACP;IACF;IAEA,OAAO;AACT,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/plugin/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAIjD,MAAM,WAAW,yBAAyB;CAEzC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,kBAAkB,CAiJ9F"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/plugin/adapter.ts"],"sourcesContent":["/* eslint-disable */\n\nimport type { DatabaseAdapterObj } from 'payload'\n\nimport { createDatabaseAdapter } from 'payload'\n\nexport interface FigmaContentSystemOptions {\n // Add Figma-specific configuration options here\n}\n\nexport function figmaContentSystem(options: FigmaContentSystemOptions = {}): DatabaseAdapterObj {\n function adapter({ payload }: { payload: any }) {\n return createDatabaseAdapter({\n name: 'figma-content-system',\n defaultIDType: 'text' as const,\n packageName: '@payloadcms/plugin-figma',\n payload,\n\n // Connection lifecycle\n connect: async () => {\n throw new Error('figmaContentSystem.connect() not implemented')\n },\n destroy: async () => {\n throw new Error('figmaContentSystem.destroy() not implemented')\n },\n init: async () => {\n throw new Error('figmaContentSystem.init() not implemented')\n },\n\n // Transactions\n beginTransaction: async () => {\n throw new Error('figmaContentSystem.beginTransaction() not implemented')\n },\n commitTransaction: async () => {\n throw new Error('figmaContentSystem.commitTransaction() not implemented')\n },\n rollbackTransaction: async () => {\n throw new Error('figmaContentSystem.rollbackTransaction() not implemented')\n },\n\n // Collection operations\n count: async () => {\n throw new Error('figmaContentSystem.count() not implemented')\n },\n create: async () => {\n throw new Error('figmaContentSystem.create() not implemented')\n },\n deleteMany: async () => {\n throw new Error('figmaContentSystem.deleteMany() not implemented')\n },\n deleteOne: async () => {\n throw new Error('figmaContentSystem.deleteOne() not implemented')\n },\n find: async () => {\n throw new Error('figmaContentSystem.find() not implemented')\n },\n findDistinct: async () => {\n throw new Error('figmaContentSystem.findDistinct() not implemented')\n },\n findOne: async () => {\n throw new Error('figmaContentSystem.findOne() not implemented')\n },\n updateMany: async () => {\n throw new Error('figmaContentSystem.updateMany() not implemented')\n },\n updateOne: async () => {\n throw new Error('figmaContentSystem.updateOne() not implemented')\n },\n upsert: async () => {\n throw new Error('figmaContentSystem.upsert() not implemented')\n },\n\n // Global operations\n createGlobal: async () => {\n throw new Error('figmaContentSystem.createGlobal() not implemented')\n },\n findGlobal: async () => {\n throw new Error('figmaContentSystem.findGlobal() not implemented')\n },\n updateGlobal: async () => {\n throw new Error('figmaContentSystem.updateGlobal() not implemented')\n },\n\n // Version operations\n countVersions: async () => {\n throw new Error('figmaContentSystem.countVersions() not implemented')\n },\n createVersion: async () => {\n throw new Error('figmaContentSystem.createVersion() not implemented')\n },\n deleteVersions: async () => {\n throw new Error('figmaContentSystem.deleteVersions() not implemented')\n },\n findVersions: async () => {\n throw new Error('figmaContentSystem.findVersions() not implemented')\n },\n updateVersion: async () => {\n throw new Error('figmaContentSystem.updateVersion() not implemented')\n },\n\n // Global version operations\n countGlobalVersions: async () => {\n throw new Error('figmaContentSystem.countGlobalVersions() not implemented')\n },\n createGlobalVersion: async () => {\n throw new Error('figmaContentSystem.createGlobalVersion() not implemented')\n },\n findGlobalVersions: async () => {\n throw new Error('figmaContentSystem.findGlobalVersions() not implemented')\n },\n updateGlobalVersion: async () => {\n throw new Error('figmaContentSystem.updateGlobalVersion() not implemented')\n },\n\n // Draft operations\n queryDrafts: async () => {\n throw new Error('figmaContentSystem.queryDrafts() not implemented')\n },\n\n // Job operations\n updateJobs: async () => {\n throw new Error('figmaContentSystem.updateJobs() not implemented')\n },\n\n // Migration operations\n createMigration: async () => {\n throw new Error('figmaContentSystem.createMigration() not implemented')\n },\n migrate: async () => {\n throw new Error('figmaContentSystem.migrate() not implemented')\n },\n migrateDown: async () => {\n throw new Error('figmaContentSystem.migrateDown() not implemented')\n },\n migrateFresh: async () => {\n throw new Error('figmaContentSystem.migrateFresh() not implemented')\n },\n migrateRefresh: async () => {\n throw new Error('figmaContentSystem.migrateRefresh() not implemented')\n },\n migrateReset: async () => {\n throw new Error('figmaContentSystem.migrateReset() not implemented')\n },\n migrateStatus: async () => {\n throw new Error('figmaContentSystem.migrateStatus() not implemented')\n },\n migrationDir: './migrations',\n })\n }\n\n return {\n name: 'figma-content-system',\n defaultIDType: 'text' as const,\n init: adapter,\n }\n}\n"],"names":["createDatabaseAdapter","figmaContentSystem","options","adapter","payload","name","defaultIDType","packageName","connect","Error","destroy","init","beginTransaction","commitTransaction","rollbackTransaction","count","create","deleteMany","deleteOne","find","findDistinct","findOne","updateMany","updateOne","upsert","createGlobal","findGlobal","updateGlobal","countVersions","createVersion","deleteVersions","findVersions","updateVersion","countGlobalVersions","createGlobalVersion","findGlobalVersions","updateGlobalVersion","queryDrafts","updateJobs","createMigration","migrate","migrateDown","migrateFresh","migrateRefresh","migrateReset","migrateStatus","migrationDir"],"mappings":"AAAA,kBAAkB,GAIlB,SAASA,qBAAqB,QAAQ,UAAS;AAM/C,OAAO,SAASC,mBAAmBC,UAAqC,CAAC,CAAC;IACxE,SAASC,QAAQ,EAAEC,OAAO,EAAoB;QAC5C,OAAOJ,sBAAsB;YAC3BK,MAAM;YACNC,eAAe;YACfC,aAAa;YACbH;YAEA,uBAAuB;YACvBI,SAAS;gBACP,MAAM,IAAIC,MAAM;YAClB;YACAC,SAAS;gBACP,MAAM,IAAID,MAAM;YAClB;YACAE,MAAM;gBACJ,MAAM,IAAIF,MAAM;YAClB;YAEA,eAAe;YACfG,kBAAkB;gBAChB,MAAM,IAAIH,MAAM;YAClB;YACAI,mBAAmB;gBACjB,MAAM,IAAIJ,MAAM;YAClB;YACAK,qBAAqB;gBACnB,MAAM,IAAIL,MAAM;YAClB;YAEA,wBAAwB;YACxBM,OAAO;gBACL,MAAM,IAAIN,MAAM;YAClB;YACAO,QAAQ;gBACN,MAAM,IAAIP,MAAM;YAClB;YACAQ,YAAY;gBACV,MAAM,IAA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Z,MAAM,IAAIjC,MAAM;YAClB;YACAkC,gBAAgB;gBACd,MAAM,IAAIlC,MAAM;YAClB;YACAmC,cAAc;gBACZ,MAAM,IAAInC,MAAM;YAClB;YACAoC,eAAe;gBACb,MAAM,IAAIpC,MAAM;YAClB;YACAqC,cAAc;QAChB;IACF;IAEA,OAAO;QACLzC,MAAM;QACNC,eAAe;QACfK,MAAMR;IACR;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-config.d.ts","sourceRoot":"","sources":["../../src/plugin/build-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAQtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAA;CAC1B,GAAG;IACF,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAC3B,CAAA;CACF,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAC1C,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAE7B;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAoC/E"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/plugin/build-config.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload'\n\nimport { lexicalEditor } from '@payloadcms/richtext-lexical'\nimport { buildConfig as payloadBuildConfig } from 'payload'\n\nimport { oAuth2Plugin } from '../oauth/index.js'\nimport { figmaContentSystem } from './adapter.js'\n\n/**\n * Configuration type for Payload projects on the Figma platform.\n *\n * Differences from standard Payload Config:\n * - `db`: Omitted (auto-injected by Figma platform)\n * - `secret`: Omitted (auto-injected by Figma platform)\n * - `editor`: Optional (defaults to lexicalEditor() if not provided)\n *\n * @example\n * // Minimal config\n * const config: FigmaConfig = {\n * collections: [...]\n * }\n *\n * @example\n * // With custom editor\n * const config: FigmaConfig = {\n * collections: [...],\n * editor: lexicalEditor({ features: [...] })\n * }\n */\nexport type FigmaConfig = {\n editor?: Config['editor']\n} & {\n figma: {\n region: string\n tenantId: string\n useContentSystem?: boolean\n }\n} & Omit<Config, 'db' | 'editor' | 'secret'> &\n Partial<Pick<Config, 'db'>>\n\n/**\n * Figma platform wrapper for Payload's buildConfig.\n * Automatically injects:\n * - Figma database adapter\n * - Secret (platform-provided)\n * - Default lexicalEditor (if no custom editor specified)\n *\n * @param config - Payload configuration (db and secret omitted, editor optional)\n * @returns Promise<SanitizedConfig> - Built Payload configuration\n */\nexport async function buildConfig(config: FigmaConfig): Promise<SanitizedConfig> {\n // Build complete config with Figma platform defaults\n const configWithFigmaDefaults: Config = {\n ...config,\n db: config.figma.useContentSystem ? figmaContentSystem() : config.db!,\n editor: config.editor ?? lexicalEditor(),\n secret: 'MY_SECRET',\n // Add oauth to plugins if not already present\n plugins: [\n ...(config.plugins ?? []),\n oAuth2Plugin({\n collections: [\n {\n slug: 'users',\n // Use adapter because Figma app doesn't support OIDC scopes\n authorizationURLParams: {\n response_mode: 'query',\n response_type: 'code',\n },\n clientID: process.env.FIGMA_OAUTH_CLIENT_ID!,\n clientSecret: process.env.FIGMA_OAUTH_CLIENT_SECRET,\n identityMetadata: 'https://staging.figma.com/.well-known/openid-configuration',\n scope: ['current_user:read'],\n token: 'id_token', // Adapter creates JWT id_token from Figma user info\n usernameField: 'email',\n },\n ],\n debug: !!process.env.DEBUG,\n disabled: false,\n redirectServerURL: 'http://localhost:3000',\n }),\n ],\n }\n\n // Delegate to Payload's buildConfig\n return await payloadBuildConfig(configWithFigmaDefaults)\n}\n"],"names":["lexicalEditor","buildConfig","payloadBuildConfig","oAuth2Plugin","figmaContentSystem","config","configWithFigmaDefaults","db","figma","useContentSystem","editor","secret","plugins","collections","slug","authorizationURLParams","response_mode","response_type","clientID","process","env","FIGMA_OAUTH_CLIENT_ID","clientSecret","FIGMA_OAUTH_CLIENT_SECRET","identityMetadata","scope","token","usernameField","debug","DEBUG","disabled","redirectServerURL"],"mappings":"AAEA,SAASA,aAAa,QAAQ,+BAA8B;AAC5D,SAASC,eAAeC,kBAAkB,QAAQ,UAAS;AAE3D,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,kBAAkB,QAAQ,eAAc;AAkCjD;;;;;;;;;CASC,GACD,OAAO,eAAeH,YAAYI,MAAmB;IACnD,qDAAqD;IACrD,MAAMC,0BAAkC;QACtC,GAAGD,MAAM;QACTE,IAAIF,OAAOG,KAAK,CAACC,gBAAgB,GAAGL,uBAAuBC,OAAOE,EAAE;QACpEG,QAAQL,OAAOK,MAAM,IAAIV;QACzBW,QAAQ;QACR,8CAA8C;QAC9CC,SAAS;eACHP,OAAOO,OAAO,IAAI,EAAE;YACxBT,aAAa;gBACXU,aAAa;oBACX;wBACEC,MAAM;wBACN,4DAA4D;wBAC5DC,wBAAwB;4BACtBC,eAAe;4BACfC,eAAe;wBACjB;wBACAC,UAAUC,QAAQC,GAAG,CAACC,qBAAqB;wBAC3CC,cAAcH,QAAQC,GAAG,CAACG,yBAAyB;wBACnDC,kBAAkB;wBAClBC,OAAO;4BAAC;yBAAoB;wBAC5BC,OAAO;wBACPC,eAAe;oBACjB;iBACD;gBACDC,OAAO,CAAC,CAACT,QAAQC,GAAG,CAACS,KAAK;gBAC1BC,UAAU;gBACVC,mBAAmB;YACrB;SACD;IACH;IAEA,oCAAoC;IACpC,OAAO,MAAM7B,mBAAmBI;AAClC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAA;IACd,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,UAAU,EAAE,KAAK,GAAG,MAAM,GAAG,WAAW,CAAA;IACxC,oBAAoB;IACpB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,cAAc,CAAA;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,UAAU,EAAE,OAAO,CAAA;IACnB,iDAAiD;IACjD,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;IACxC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/types/config.ts"],"sourcesContent":["/**\n * Figma CMS Configuration Types\n */\n\n/**\n * Tenant instance from Control Plane API\n */\nexport interface Tenant {\n /** Creation timestamp */\n createdAt?: string\n /** Domain name (e.g., my-cms.figmacms.com) */\n domain: string\n /** Unique tenant ID */\n id: string\n /** Parent ID */\n parentId: string\n /** Parent type (team, org, workspace) */\n parentType: 'org' | 'team' | 'workspace'\n /** Tenant status */\n status: 'active' | 'inactive' | 'provisioning'\n}\n\n/**\n * Project information from detection\n */\nexport interface ProjectInfo {\n /** Whether Payload is installed */\n hasPayload: boolean\n /** Package manager detected (npm, pnpm, yarn) */\n packageManager?: 'npm' | 'pnpm' | 'yarn'\n /** Project root path */\n path: string\n /** Payload version if installed */\n payloadVersion?: string\n}\n"],"names":[],"mappings":"AAAA;;CAEC,GAED;;CAEC,GAgBD;;CAEC,GACD,WASC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG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AM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,EAAE,OAAO,CAAA;IACjB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,EAAE,IAAI,GAAG,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAAA;AAEjD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,WAAW,GAAG,mBAAmB,CAAA"}
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type arg from 'arg'\n\nexport interface Args extends arg.Spec {\n '--debug': BooleanConstructor\n '--force': BooleanConstructor\n '--help': BooleanConstructor\n '--list': BooleanConstructor\n '--logout': BooleanConstructor\n '--yes': BooleanConstructor\n\n // Aliases\n\n '-f': string\n '-h': string\n '-y': string\n}\n\nexport type CliArgs = arg.Result<Args>\n\nexport type ProjectTemplate = GitTemplate | PluginTemplate\n\nexport type ProjectExample = {\n name: string\n url: string\n}\n\n/**\n * Template that is cloned verbatim from a git repo\n * Performs .env manipulation based upon input\n */\nexport interface GitTemplate extends Template {\n type: 'starter'\n url: string\n}\n\n/**\n * Type specifically for the plugin template\n * No .env manipulation is done\n */\nexport interface PluginTemplate extends Template {\n type: 'plugin'\n url: string\n}\n\ninterface Template {\n description?: string\n name: string\n type: ProjectTemplate['type']\n}\n\nexport type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn'\n\nexport type DbType = 'd1-sqlite' | 'mongodb' | 'postgres' | 'sqlite' | 'vercel-postgres'\n\nexport type DbDetails = {\n dbUri?: string\n type: DbType\n}\n\nexport type EditorType = 'lexical' | 'slate'\n\nexport type NextAppDetails = {\n hasTopLevelLayout: boolean\n isPayloadInstalled?: boolean\n isSrcDir: boolean\n isSupportedNextVersion: boolean\n nextAppDir?: string\n nextConfigPath?: string\n nextConfigType?: NextConfigType\n nextVersion: null | string\n}\n\nexport type NextConfigType = 'cjs' | 'esm' | 'ts'\n\nexport type StorageAdapterType = 'localDisk' | 'r2Storage' | 'vercelBlobStorage'\n"],"names":[],"mappings":"AA0EA,WAAgF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"asset-collection.d.ts","sourceRoot":"","sources":["../../src/utils/asset-collection.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnE;AAgDD;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAchF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBxE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/asset-collection.ts"],"sourcesContent":["import { exec } from 'child_process'\nimport fs from 'fs/promises'\nimport path from 'path'\nimport { promisify } from 'util'\n\nimport * as log from './log.js'\n\nconst execAsync = promisify(exec)\n\n// Maximum file size for static assets (S3 limitation)\nconst MAX_ASSET_SIZE = 50 * 1024 * 1024 // 50MB\n\n/**\n * Get file size in bytes\n *\n * @param filePath - Absolute path to file\n * @returns File size in bytes\n */\nexport async function getFileSize(filePath: string): Promise<number> {\n const stats = await fs.stat(filePath)\n return stats.size\n}\n\n/**\n * Recursively collect files from a directory\n *\n * Excludes files larger than 50MB (S3 limitation).\n * Warns user when files are excluded due to size.\n *\n * @param dir - Directory to scan\n * @param baseDir - Base directory for relative paths\n * @returns Array of relative file paths\n */\nasync function collectFiles(dir: string, baseDir: string): Promise<string[]> {\n const files: string[] = []\n\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n // Recursively collect from subdirectories\n const subFiles = await collectFiles(fullPath, baseDir)\n files.push(...subFiles)\n } else if (entry.isFile()) {\n // Check file size before adding\n const stats = await fs.stat(fullPath)\n if (stats.size <= MAX_ASSET_SIZE) {\n // Add relative path from base directory\n const relativePath = path.relative(baseDir, fullPath)\n files.push(relativePath)\n } else {\n // Warn user about skipped files\n const sizeMB = (stats.size / (1024 * 1024)).toFixed(2)\n const relativePath = path.relative(baseDir, fullPath)\n log.warning(`Skipping large asset: ${relativePath} (${sizeMB}MB exceeds 50MB limit)`)\n }\n }\n }\n } catch {\n // Directory doesn't exist or not accessible\n return []\n }\n\n return files\n}\n\n/**\n * Collect all static asset paths from .next/static\n *\n * Returns paths relative to project root, formatted for S3:\n * - `.next/static/chunks/main.js` → `_next/static/chunks/main.js`\n *\n * @param projectPath - Path to project root\n * @returns Array of static asset paths (using _next prefix)\n */\nexport async function collectStaticAssets(projectPath: string): Promise<string[]> {\n const staticDir = path.join(projectPath, '.next', 'static')\n\n try {\n await fs.stat(staticDir)\n } catch {\n // No static directory\n return []\n }\n\n const files = await collectFiles(staticDir, projectPath)\n\n // Convert .next/static to _next/static (Next.js convention)\n return files.map((file) => file.replace(/^\\.next\\//, '_next/'))\n}\n\n/**\n * Create Lambda deployment zip using build_for_lambda.sh\n *\n * This script:\n * - Copies static files to standalone build\n * - Creates lambda.zip from .next/standalone/\n * - Places zip at project root\n *\n * @param projectPath - Path to project root\n * @throws Error if script missing or execution fails\n */\nexport async function createLambdaZip(projectPath: string): Promise<void> {\n const scriptPath = path.join(projectPath, 'build_for_lambda.sh')\n\n // Check if script exists\n try {\n await fs.stat(scriptPath)\n } catch {\n throw new Error('build_for_lambda.sh not found. Run init command to set up project.')\n }\n\n // Execute script\n try {\n await execAsync('./build_for_lambda.sh', { cwd: projectPath })\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error'\n throw new Error(`Failed to create Lambda zip: ${message}`)\n }\n\n // Verify zip was created\n const zipPath = path.join(projectPath, 'lambda.zip')\n try {\n await fs.stat(zipPath)\n } catch {\n throw new Error('lambda.zip was not created by build_for_lambda.sh')\n }\n}\n"],"names":["exec","fs","path","promisify","log","execAsync","MAX_ASSET_SIZE","getFileSize","filePath","stats","stat","size","collectFiles","dir","baseDir","files","entries","readdir","withFileTypes","entry","fullPath","join","name","isDirectory","subFiles","push","isFile","relativePath","relative","sizeMB","toFixed","warning","collectStaticAssets","projectPath","staticDir","map","file","replace","createLambdaZip","scriptPath","Error","cwd","error","message","zipPath"],"mappings":"AAAA,SAASA,IAAI,QAAQ,gBAAe;AACpC,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AACvB,SAASC,SAAS,QAAQ,OAAM;AAEhC,YAAYC,SAAS,WAAU;AAE/B,MAAMC,YAAYF,UAAUH;AAE5B,sDAAsD;AACtD,MAAMM,iBAAiB,KAAK,OAAO,KAAK,OAAO;;AAE/C;;;;;CAKC,GACD,OAAO,eAAeC,YAAYC,QAAgB;IAChD,MAAMC,QAAQ,MAAMR,GAAGS,IAAI,CAACF;IAC5B,OAAOC,MAAME,IAAI;AACnB;AAEA;;;;;;;;;CASC,GACD,eAAeC,aAAaC,GAAW,EAAEC,OAAe;IACtD,MAAMC,QAAkB,EAAE;IAE1B,IAAI;QACF,MAAMC,UAAU,MAAMf,GAAGgB,OAAO,CAACJ,KAAK;YAAEK,eAAe;QAAK;QAE5D,KAAK,MAAMC,SAASH,QAAS;YAC3B,MAAMI,WAAWlB,KAAKmB,IAAI,CAACR,KAAKM,MAAMG,IAAI;YAE1C,IAAIH,MAAMI,WAAW,IAAI;gBACvB,0CAA0C;gBAC1C,MAAMC,WAAW,MAAMZ,aAAaQ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AAMnC,UAAU,yBAAyB;YAAEoC,KAAKR;QAAY;IAC9D,EAAE,OAAOS,OAAO;QACd,MAAMC,UAAUD,iBAAiBF,QAAQE,MAAMC,OAAO,GAAG;QACzD,MAAM,IAAIH,MAAM,CAAC,6BAA6B,EAAEG,SAAS;IAC3D;IAEA,yBAAyB;IACzB,MAAMC,UAAU1C,KAAKmB,IAAI,CAACY,aAAa;IACvC,IAAI;QACF,MAAMhC,GAAGS,IAAI,CAACkC;IAChB,EAAE,OAAM;QACN,MAAM,IAAIJ,MAAM;IAClB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-detection.d.ts","sourceRoot":"","sources":["../../src/utils/build-detection.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,wCAAwC;IACxC,YAAY,EAAE,OAAO,CAAA;IACrB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,2CAA2C;IAC3C,SAAS,EAAE,IAAI,CAAA;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CA6BhF;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAUjF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/build-detection.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport path from 'path'\n\n/**\n * Information about a detected build\n */\nexport interface BuildInfo {\n /** Build ID from .next/BUILD_ID */\n buildId: string\n /** Whether lambda.zip already exists */\n hasLambdaZip: boolean\n /** Path to .next/standalone */\n path: string\n /** Build timestamp from server.js mtime */\n timestamp: Date\n}\n\n/**\n * Detect if a valid Lambda-ready build exists\n *\n * Checks for:\n * - .next/standalone/server.js (required for Lambda)\n * - .next/BUILD_ID (Next.js build identifier)\n *\n * @param projectPath - Path to project root\n * @returns Build info if valid build found, null otherwise\n */\nexport async function detectBuild(projectPath: string): Promise<BuildInfo | null> {\n try {\n // Check for .next/standalone/server.js\n const serverPath = path.join(projectPath, '.next', 'standalone', 'server.js')\n const serverStat = await fs.stat(serverPath)\n\n // Check for .next/BUILD_ID\n const buildIdPath = path.join(projectPath, '.next', 'BUILD_ID')\n const buildId = (await fs.readFile(buildIdPath, 'utf-8')).trim()\n\n // Check for lambda.zip\n const lambdaZipPath = path.join(projectPath, 'lambda.zip')\n let hasLambdaZip = false\n try {\n await fs.stat(lambdaZipPath)\n hasLambdaZip = true\n } catch {\n hasLambdaZip = false\n }\n\n return {\n buildId,\n hasLambdaZip,\n path: '.next/standalone',\n timestamp: serverStat.mtime,\n }\n } catch {\n return null\n }\n}\n\n/**\n * Get the build command from package.json\n *\n * @param projectPath - Path to project root\n * @returns Build command string if found, null otherwise\n */\nexport async function getBuildCommand(projectPath: string): Promise<null | string> {\n try {\n const packageJsonPath = path.join(projectPath, 'package.json')\n const content = await fs.readFile(packageJsonPath, 'utf-8')\n const packageJson = JSON.parse(content)\n\n return packageJson.scripts?.build || null\n } catch {\n return null\n }\n}\n"],"names":["fs","path","detectBuild","projectPath","serverPath","join","serverStat","stat","buildIdPath","buildId","readFile","trim","lambdaZipPath","hasLambdaZip","timestamp","mtime","getBuildCommand","packageJsonPath","content","packageJson","JSON","parse","scripts","build"],"mappings":"AAAA,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAgBvB;;;;;;;;;CASC,GACD,OAAO,eAAeC,YAAYC,WAAmB;IACnD,IAAI;QACF,uCAAuC;QACvC,MAAMC,aAAaH,KAAKI,IAAI,CAACF,aAAa,SAAS,cAAc;QACjE,MAAMG,aAAa,MAAMN,GAAGO,IAAI,CAACH;QAEjC,2BAA2B;QAC3B,MAAMI,cAAcP,KAAKI,IAAI,CAACF,aAAa,SAAS;QACpD,MAAMM,UAAU,AAAC,CAAA,MAAMT,GAAGU,QAAQ,CAACF,aAAa,QAAO,EAAGG,IAAI;QAE9D,uBAAuB;QACvB,MAAMC,gBAAgBX,KAAKI,IAAI,CAACF,aAAa;QAC7C,IAAIU,eAAe;QACnB,IAAI;YACF,MAAMb,GAAGO,IAAI,CAACK;YACdC,eAAe;QACjB,EAAE,OAAM;YACNA,eAAe;QACjB;QAEA,OAAO;YACLJ;YACAI;YACAZ,MAAM;YACNa,WAAWR,WAAWS,KAAK;QAC7B;IACF,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;;CAKC,GACD,OAAO,eAAeC,gBAAgBb,WAAmB;IACvD,IAAI;QACF,MAAMc,kBAAkBhB,KAAKI,IAAI,CAACF,aAAa;QAC/C,MAAMe,UAAU,MAAMlB,GAAGU,QAAQ,CAACO,iBAAiB;QACnD,MAAME,cAAcC,KAAKC,KAAK,CAACH;QAE/B,OAAOC,YAAYG,OAAO,EAAEC,SAAS;IACvC,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BhG"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["/**\n * Configuration file management utilities\n */\n\nimport fs from 'fs/promises'\nimport path from 'path'\n\nconst GITIGNORE_FILENAME = '.gitignore'\n\n/**\n * Ensure .gitignore exists and optionally add entries\n *\n * @param projectPath - Path to project directory\n * @param entries - Optional entries to add to .gitignore\n */\nexport async function ensureGitignore(projectPath: string, entries: string[] = []): Promise<void> {\n const gitignorePath = path.join(projectPath, GITIGNORE_FILENAME)\n\n let existingContent = ''\n try {\n existingContent = await fs.readFile(gitignorePath, 'utf-8')\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw new Error(`Failed to read ${GITIGNORE_FILENAME}: ${(error as Error).message}`)\n }\n }\n\n // Parse existing entries\n const existingLines = existingContent.split('\\n').filter((line) => line.trim())\n const existingSet = new Set(existingLines)\n\n // Add new entries that don't exist\n const newEntries = entries.filter((entry) => !existingSet.has(entry))\n\n if (newEntries.length > 0) {\n const newContent = existingContent\n ? `${existingContent.trimEnd()}\\n\\n# Figma CMS\\n${newEntries.join('\\n')}\\n`\n : `# Figma CMS\\n${newEntries.join('\\n')}\\n`\n\n await fs.writeFile(gitignorePath, newContent, 'utf-8')\n }\n}\n"],"names":["fs","path","GITIGNORE_FILENAME","ensureGitignore","projectPath","entries","gitignorePath","join","existingContent","readFile","error","code","Error","message","existingLines","split","filter","line","trim","existingSet","Set","newEntries","entry","has","length","newContent","trimEnd","writeFile"],"mappings":"AAAA;;CAEC,GAED,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB,MAAMC,qBAAqB;AAE3B;;;;;CAKC,GACD,OAAO,eAAeC,gBAAgBC,WAAmB,EAAEC,UAAoB,EAAE;IAC/E,MAAMC,gBAAgBL,KAAKM,IAAI,CAACH,aAAaF;IAE7C,IAAIM,kBAAkB;IACtB,IAAI;QACFA,kBAAkB,MAAMR,GAAGS,QAAQ,CAACH,eAAe;IACrD,EAAE,OAAOI,OAAO;QACd,IAAI,AAACA,MAAgCC,IAAI,KAAK,UAAU;YACtD,MAAM,IAAIC,MAAM,CAAC,eAAe,EAAEV,mBAAmB,EAAE,EAAE,AAACQ,MAAgBG,OAAO,EAAE;QACrF;IACF;IAEA,yBAAyB;IACzB,MAAMC,gBAAgBN,gBAAgBO,KAAK,CAAC,MAAMC,MAAM,CAAC,CAACC,OAASA,KAAKC,IAAI;IAC5E,MAAMC,cAAc,IAAIC,IAAIN;IAE5B,mCAAmC;IACnC,MAAMO,aAAahB,QAAQW,MAAM,CAAC,CAACM,QAAU,CAACH,YAAYI,GAAG,CAACD;IAE9D,IAAID,WAAWG,MAAM,GAAG,GAAG;QACzB,MAAMC,aAAajB,kBACf,GAAGA,gBAAgBkB,OAAO,GAAG,iBAAiB,EAAEL,WAAWd,IAAI,CAAC,MAAM,EAAE,CAAC,GACzE,CAAC,aAAa,EAAEc,WAAWd,IAAI,CAAC,MAAM,EAAE,CAAC;QAE7C,MAAMP,GAAG2B,SAAS,CAACrB,eAAemB,YAAY;IAChD;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"download-template.d.ts","sourceRoot":"","sources":["../../src/utils/download-template.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAGrC,KAAK,CAAC,EAAE,KAAK;gBADpB,OAAO,EAAE,MAAM,EACR,KAAK,CAAC,EAAE,KAAK,YAAA;CAKvB;AAOD;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBlF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/download-template.ts"],"sourcesContent":["import fs from 'node:fs/promises'\nimport { Readable } from 'node:stream'\nimport { pipeline } from 'node:stream/promises'\nimport { x } from 'tar'\n\n/**\n * Error thrown when template download fails\n */\nexport class TemplateDownloadError extends Error {\n constructor(\n message: string,\n public cause?: Error,\n ) {\n super(message)\n this.name = 'TemplateDownloadError'\n }\n}\n\nconst BRANCH_OR_TAG = 'main'\nconst TEMPLATE_NAME = 'blank'\nconst MAX_RETRIES = 3\nconst INITIAL_RETRY_DELAY = 1000 // 1 second\n\n/**\n * Download Payload template from GitHub with retry logic\n *\n * @param projectDir - Directory to extract template into\n * @throws TemplateDownloadError if download fails\n */\nexport async function downloadTemplateFromGitHub(projectDir: string): Promise<void> {\n let lastError: Error | undefined\n\n for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {\n try {\n await downloadTemplateAttempt(projectDir)\n return // Success\n } catch (error) {\n lastError = error instanceof Error ? error : new Error('Unknown error')\n\n if (attempt < MAX_RETRIES) {\n // Exponential backoff: 1s, 2s, 4s\n const delay = INITIAL_RETRY_DELAY * Math.pow(2, attempt - 1)\n await new Promise((resolve) => setTimeout(resolve, delay))\n }\n }\n }\n\n // All retries failed\n throw new TemplateDownloadError(\n `Failed to download template after ${MAX_RETRIES} attempts`,\n lastError,\n )\n}\n\n/**\n * Single attempt to download template (extracted for retry logic)\n */\nasync function downloadTemplateAttempt(projectDir: string): Promise<void> {\n const url = `https://codeload.github.com/payloadcms/payload/tar.gz/${BRANCH_OR_TAG}`\n const filter = `payload-${BRANCH_OR_TAG}/templates/${TEMPLATE_NAME}/`\n\n try {\n // Ensure target directory exists\n await fs.mkdir(projectDir, { recursive: true })\n\n await pipeline(\n await downloadTarStream(url),\n x({\n cwd: projectDir,\n filter: (p) => p.includes(filter),\n strip: 2 + TEMPLATE_NAME.split('/').length,\n }),\n )\n } catch (error) {\n throw new TemplateDownloadError(\n 'Failed to download template from GitHub',\n error instanceof Error ? error : undefined,\n )\n }\n}\n\n/**\n * Download tar stream from URL\n */\nasync function downloadTarStream(url: string): Promise<Readable> {\n const res = await fetch(url)\n\n if (!res.ok) {\n throw new Error(`HTTP ${res.status}: ${res.statusText}`)\n }\n\n if (!res.body) {\n throw new Error(`Failed to download: ${url}`)\n }\n\n return Readable.from(res.body as unknown as NodeJS.ReadableStream)\n}\n"],"names":["fs","Readable","pipeline","x","TemplateDownloadError","Error","message","cause","name","BRANCH_OR_TAG","TEMPLATE_NAME","MAX_RETRIES","INITIAL_RETRY_DELAY","downloadTemplateFromGitHub","projectDir","lastError","attempt","downloadTemplateAttempt","error","delay","Math","pow","Promise","resolve","setTimeout","url","filter","mkdir","recursive","downloadTarStream","cwd","p","includes","strip","split","length","undefined","res","fetch","ok","status","statusText","body","from"],"mappings":"AAAA,OAAOA,QAAQ,mBAAkB;AACjC,SAASC,QAAQ,QAAQ,cAAa;AACtC,SAASC,QAAQ,QAAQ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CAAC,KAAKC,MAAM;QAC5C;IAEJ,EAAE,OAAOjB,OAAO;QACd,MAAM,IAAId,sBACR,2CACAc,iBAAiBb,QAAQa,QAAQkB;IAErC;AACF;AAEA;;CAEC,GACD,eAAeP,kBAAkBJ,GAAW;IAC1C,MAAMY,MAAM,MAAMC,MAAMb;IAExB,IAAI,CAACY,IAAIE,EAAE,EAAE;QACX,MAAM,IAAIlC,MAAM,CAAC,KAAK,EAAEgC,IAAIG,MAAM,CAAC,EAAE,EAAEH,IAAII,UAAU,EAAE;IACzD;IAEA,IAAI,CAACJ,IAAIK,IAAI,EAAE;QACb,MAAM,IAAIrC,MAAM,CAAC,oBAAoB,EAAEoB,KAAK;IAC9C;IAEA,OAAOxB,SAAS0C,IAAI,CAACN,IAAIK,IAAI;AAC/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"env-management.d.ts","sourceRoot":"","sources":["../../src/utils/env-management.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAoDD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8CzE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/env-management.ts"],"sourcesContent":["import { randomBytes } from 'crypto'\nimport fs from 'fs/promises'\nimport path from 'path'\n\n/**\n * Generate a cryptographically secure secret for PAYLOAD_SECRET\n *\n * @returns 24-character hexadecimal string\n */\nexport function generateSecret(): string {\n return randomBytes(32).toString('hex').slice(0, 24)\n}\n\n/**\n * Sanitize and process environment file contents\n *\n * @param contents - Raw .env file contents\n * @param payloadSecret - Secret to use for PAYLOAD_SECRET\n * @returns Processed .env contents\n */\nfunction sanitizeEnv(contents: string, payloadSecret: string): string {\n const lines = contents.split('\\n')\n const seenKeys = new Set<string>()\n const processedLines: string[] = []\n\n for (const line of lines) {\n // Skip empty lines and comments\n if (!line.trim() || line.trim().startsWith('#')) {\n processedLines.push(line)\n continue\n }\n\n // Skip lines without =\n if (!line.includes('=')) {\n processedLines.push(line)\n continue\n }\n\n const [key] = line.split('=')\n const trimmedKey = key.trim()\n\n // Skip duplicate keys\n if (seenKeys.has(trimmedKey)) {\n continue\n }\n seenKeys.add(trimmedKey)\n\n // Replace PAYLOAD_SECRET with actual value\n if (trimmedKey === 'PAYLOAD_SECRET' || trimmedKey === 'PAYLOAD_SECRET_KEY') {\n processedLines.push(`PAYLOAD_SECRET=${payloadSecret}`)\n } else {\n processedLines.push(line)\n }\n }\n\n // Add PAYLOAD_SECRET if not present\n if (!seenKeys.has('PAYLOAD_SECRET') && !seenKeys.has('PAYLOAD_SECRET_KEY')) {\n processedLines.push(`PAYLOAD_SECRET=${payloadSecret}`)\n }\n\n return processedLines.join('\\n')\n}\n\n/**\n * Manage environment files for a new project\n *\n * Creates .env from .env.example (if exists) and populates PAYLOAD_SECRET\n *\n * @param projectPath - Path to project directory\n * @returns The generated payload secret\n */\nexport async function manageEnvFiles(projectPath: string): Promise<string> {\n const payloadSecret = generateSecret()\n const envExamplePath = path.join(projectPath, '.env.example')\n const envPath = path.join(projectPath, '.env')\n\n try {\n // Check if .env.example exists\n let envExampleContents = ''\n try {\n envExampleContents = await fs.readFile(envExamplePath, 'utf-8')\n } catch {\n // No .env.example, create minimal .env\n envExampleContents = ''\n }\n\n // Check if .env already exists\n let envExists = false\n try {\n await fs.access(envPath)\n envExists = true\n } catch {\n // .env doesn't exist\n }\n\n if (!envExists) {\n // Create .env from .env.example\n const sanitized = sanitizeEnv(envExampleContents, payloadSecret)\n await fs.writeFile(envPath, sanitized, 'utf-8')\n } else {\n // Update existing .env if it doesn't have PAYLOAD_SECRET\n const existingContents = await fs.readFile(envPath, 'utf-8')\n if (\n !existingContents.includes('PAYLOAD_SECRET=') &&\n !existingContents.includes('PAYLOAD_SECRET_KEY=')\n ) {\n const sanitized = sanitizeEnv(existingContents, payloadSecret)\n await fs.writeFile(envPath, sanitized, 'utf-8')\n }\n }\n\n return payloadSecret\n } catch (error) {\n throw new Error(\n `Failed to manage environment files: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n }\n}\n"],"names":["randomBytes","fs","path","generateSecret","toString","slice","sanitizeEnv","contents","payloadSecret","lines","split","seenKeys","Set","processedLines","line","trim","startsWith","push","includes","key","trimmedKey","has","add","join","manageEnvFiles","projectPath","envExamplePath","envPath","envExampleContents","readFile","envExists","access","sanitized","writeFile","existingContents","error","Error","message"],"mappings":"AAAA,SAASA,WAAW,QAAQ,SAAQ;AACpC,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB;;;;CAIC,GACD,OAAO,SAASC;IACd,OAAOH,YAAY,IAAII,QAAQ,CAAC,OAAOC,KAAK,CAAC,GAAG;AAClD;AAEA;;;;;;CAMC,GACD,SAASC,YAAYC,QAAgB,EAAEC,aAAqB;IAC1D,MAAMC,QAAQF,SAASG,KAAK,CAAC;IAC7B,MAAMC,WAAW,IAAIC;IACrB,MAAMC,iBAA2B,EAAE;IAEnC,KAAK,MAAMC,QAAQL,MAAO;QACxB,gCAAgC;QAChC,IAAI,CAACK,KAAKC,IAAI,MAAMD,KAAKC,IAAI,GAAGC,UAAU,CAAC,MAAM;YAC/CH,eAAeI,IAAI,CAACH;YACpB;QACF;QAEA,uBAAuB;QACvB,IAAI,CAACA,KAAKI,QAAQ,CAAC,MAAM;YACvBL,eAAeI,IAAI,CAACH;YACpB;QACF;QAEA,MAAM,CAACK,IAAI,GAAGL,KAAKJ,KAAK,CAAC;QACzB,MAAMU,aAAaD,IAAIJ,IAAI;QAE3B,sBAAsB;QACtB,IAAIJ,SAASU,GAAG,CAACD,aAAa;YAC5B;QACF;QACAT,SAASW,GAAG,CAACF;QAEb,2CAA2C;QAC3C,IAAIA,eAAe,oBAAoBA,eAAe,sBAAsB;YAC1EP,eAAeI,IAAI,CAAC,CAAC,eAAe,EAAET,eAAe;QACvD,OAAO;YACLK,eAAeI,IAAI,CAACH;QACtB;IAC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d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG7C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA0B5D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/format.ts"],"sourcesContent":["/**\n * Shared formatting utilities for CLI output\n */\n\n/**\n * Format a timestamp (in milliseconds) to a localized string\n * @param ms - Timestamp in milliseconds since epoch\n * @returns Localized date/time string\n */\nexport function formatTime(ms: number): string {\n const date = new Date(ms)\n return date.toLocaleString()\n}\n\n/**\n * Get a human-readable string describing time until expiry\n * @param expiresAt - Expiry timestamp in milliseconds since epoch\n * @returns Human-readable time until/since expiry (e.g., \"in 2 hours\", \"expired 5 minutes ago\")\n */\nexport function getTimeUntilExpiry(expiresAt: number): string {\n const now = Date.now()\n const diff = expiresAt - now\n\n if (diff < 0) {\n const minutes = Math.floor(Math.abs(diff) / 60000)\n const hours = Math.floor(minutes / 60)\n\n if (hours > 0) {\n return `expired ${hours} hour${hours > 1 ? 's' : ''} ago`\n }\n return `expired ${minutes} minute${minutes > 1 ? 's' : ''} ago`\n }\n\n const minutes = Math.floor(diff / 60000)\n const hours = Math.floor(minutes / 60)\n\n if (hours > 0) {\n const remainingMinutes = minutes % 60\n if (remainingMinutes > 0) {\n return `in ${hours} hour${hours > 1 ? 's' : ''} ${remainingMinutes} minute${remainingMinutes > 1 ? 's' : ''}`\n }\n return `in ${hours} hour${hours > 1 ? 's' : ''}`\n }\n\n return `in ${minutes} minute${minutes > 1 ? 's' : ''}`\n}\n\n/**\n * Mask a token for safe display\n * Shows first 4 and last 4 characters, masks the middle\n * @param token - Token string to mask\n * @returns Masked token string (e.g., \"eyJh********************************mFbc\")\n */\nexport function maskToken(token: string): string {\n if (token.length <= 8) {\n return '***'\n }\n return `${token.slice(0, 4)}${'*'.repeat(Math.min(token.length - 8, 32))}${token.slice(-4)}`\n}\n"],"names":["formatTime","ms","date","Date","toLocaleString","getTimeUntilExpiry","expiresAt","now","diff","minutes","Math","floor","abs","hours","remainingMinutes","maskToken","token","length","slice","repeat","min"],"mappings":"AAAA;;CAEC,GAED;;;;CAIC,GACD,OAAO,SAASA,WAAWC,EAAU;IACnC,MAAMC,OAAO,IAAIC,KAAKF;IACtB,OAAOC,KAAKE,cAAc;AAC5B;AAEA;;;;CAIC,GACD,OAAO,SAASC,mBAAmBC,SAAiB;IAClD,MAAMC,MAAMJ,KAAKI,GAAG;IACpB,MAAMC,OAAOF,YAAYC;IAEzB,IAAIC,OAAO,GAAG;QACZ,MAAMC,UAAUC,KAAKC,KAAK,CAACD,KAAKE,GAAG,CAACJ,QAAQ;QAC5C,MAAMK,QAAQH,KAAKC,KAAK,CAACF,UAAU;QAEnC,IAAII,QAAQ,GAAG;YACb,OAAO,CAAC,QAAQ,EAAEA,MAAM,KAAK,EAAEA,QAAQ,IAAI,MAAM,GAAG,IAAI,CAAC;QAC3D;QACA,OAAO,CAAC,QAAQ,EAAEJ,QAAQ,OAAO,EAAEA,UAAU,IAAI,MAAM,GAAG,IAAI,CAAC;IACjE;IAEA,MAAMA,UAAUC,KAAKC,KAAK,CAACH,OAAO;IAClC,MAAMK,QAAQH,KAAKC,KAAK,CAACF,UAAU;IAEnC,IAAII,QAAQ,GAAG;QACb,MAAMC,mBAAmBL,UAAU;QACnC,IAAIK,mBAAmB,GAAG;YACxB,OAAO,CAAC,GAAG,EAAED,MAAM,KAAK,EAAEA,QAAQ,IAAI,MAAM,GAAG,CAAC,EAAEC,iBAAiB,OAAO,EAAEA,mBAAmB,IAAI,MAAM,IAAI;QAC/G;QACA,OAAO,CAAC,GAAG,EAAED,MAAM,KAAK,EAAEA,QAAQ,IAAI,MAAM,IAAI;IAClD;IAEA,OAAO,CAAC,GAAG,EAAEJ,QAAQ,OAAO,EAAEA,UAAU,IAAI,MAAM,IAAI;AACxD;AAEA;;;;;CAKC,GACD,OAAO,SAASM,UAAUC,KAAa;IACrC,IAAIA,MAAMC,MAAM,IAAI,GAAG;QACrB,OAAO;IACT;IACA,OAAO,GAAGD,MAAME,KAAK,CAAC,GAAG,KAAK,IAAIC,MAAM,CAACT,KAAKU,GAAG,CAACJ,MAAMC,MAAM,GAAG,GAAG,OAAOD,MAAME,KAAK,CAAC,CAAC,IAAI;AAC9F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,YAAY,CAAC,CAmCvB"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/formatter.ts"],"sourcesContent":["import { spawn } from 'child_process'\nimport path from 'path'\n\nimport type { PackageManager } from './package-manager.js'\n\nexport type FormatResult = {\n success: boolean\n warning?: string\n}\n\n/**\n * Format file with Prettier\n * Returns warning if formatting fails but does not throw\n */\nexport async function formatFile(\n filePath: string,\n packageManager: PackageManager,\n): Promise<FormatResult> {\n return new Promise((resolve) => {\n try {\n const args = ['exec', 'prettier', '--write', filePath]\n\n const child = spawn(packageManager, args, {\n cwd: path.dirname(filePath),\n shell: true,\n stdio: 'pipe',\n })\n\n child.on('close', (code) => {\n if (code === 0) {\n resolve({ success: true })\n } else {\n resolve({\n success: false,\n warning: 'Could not format file with Prettier',\n })\n }\n })\n\n child.on('error', () => {\n resolve({\n success: false,\n warning: 'Could not format file with Prettier',\n })\n })\n } catch {\n resolve({\n success: false,\n warning: 'Could not format file with Prettier',\n })\n }\n })\n}\n"],"names":["spawn","path","formatFile","filePath","packageManager","Promise","resolve","args","child","cwd","dirname","shell","stdio","on","code","success","warning"],"mappings":"AAAA,SAASA,KAAK,QAAQ,gBAAe;AACrC,OAAOC,UAAU,OAAM;AASvB;;;CAGC,GACD,OAAO,eAAeC,WACpBC,QAAgB,EAChBC,cAA8B;IAE9B,OAAO,IAAIC,QAAQ,CAACC;QAClB,IAAI;YACF,MAAMC,OAAO;gBAAC;gBAAQ;gBAAY;gBAAWJ;aAAS;YAEtD,MAAMK,QAAQR,MAAMI,gBAAgBG,MAAM;gBACxCE,KAAKR,KAAKS,OAAO,CAACP;gBAClBQ,OAAO;gBACPC,OAAO;YACT;YAEAJ,MAAMK,EAAE,CAAC,SAAS,CAACC;gBACjB,IAAIA,SAAS,GAAG;oBACdR,QAAQ;wBAAES,SAAS;oBAAK;gBAC1B,OAAO;oBACLT,QAAQ;wBACNS,SAAS;wBACTC,SAAS;oBACX;gBACF;YACF;YAEAR,MAAMK,EAAE,CAAC,SAAS;gBAChBP,QAAQ;oBACNS,SAAS;oBACTC,SAAS;gBACX;YACF;QACF,EAAE,OAAM;YACNV,QAAQ;gBACNS,SAAS;gBACTC,SAAS;YACX;QACF;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAUtD;AAkBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CA4DjE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/git.ts"],"sourcesContent":["import { execSync } from 'child_process'\n\n/**\n * Check if a directory is already a git repository\n *\n * @param projectPath - Path to check\n * @returns True if directory is a git repo\n */\nexport function isGitRepo(projectPath: string): boolean {\n try {\n execSync('git rev-parse --is-inside-work-tree', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Check if git has a default branch configured\n *\n * @returns True if default branch is configured\n */\nfunction ensureHasDefaultBranch(): boolean {\n try {\n execSync('git config init.defaultBranch', {\n stdio: 'ignore',\n })\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Initialize a git repository and create an initial commit\n *\n * @param projectPath - Path to initialize git in\n * @returns True if successful, false otherwise\n */\nexport function tryInitRepoAndCommit(projectPath: string): boolean {\n try {\n // Check if git is available\n execSync('git -v', {\n stdio: 'ignore',\n })\n } catch {\n // Git not available\n return false\n }\n\n // Skip if already in a git repo\n if (isGitRepo(projectPath)) {\n return false\n }\n\n try {\n // Initialize git repository\n execSync('git init', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n\n // Configure git user in CI environments (required for commits)\n if (process.env.CI) {\n execSync('git config user.email \"ci@payloadcms.com\"', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n execSync('git config user.name \"Payload CI\"', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n }\n\n // Create main branch if no default branch configured\n if (!ensureHasDefaultBranch()) {\n execSync('git checkout -b main', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n }\n\n // Stage all files\n execSync('git add -A', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n\n // Create initial commit\n execSync('git commit -m \"feat: initial commit\"', {\n cwd: projectPath,\n stdio: 'ignore',\n })\n\n return true\n } catch {\n // Git operations failed\n return false\n }\n}\n"],"names":["execSync","isGitRepo","projectPath","cwd","stdio","ensureHasDefaultBranch","tryInitRepoAndCommit","process","env","CI"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe;AAExC;;;;;CAKC,GACD,OAAO,SAASC,UAAUC,WAAmB;IAC3C,IAAI;QACFF,SAAS,uCAAuC;YAC9CG,KAAKD;YACLE,OAAO;QACT;QACA,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;CAIC,GACD,SAASC;IACP,IAAI;QACFL,SAAS,iCAAiC;YACxCI,OAAO;QACT;QACA,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;;;;CAKC,GACD,OAAO,SAASE,qBAAqBJ,WAAmB;IACtD,IAAI;QACF,4BAA4B;QAC5BF,SAAS,UAAU;YACjBI,OAAO;QACT;IACF,EAAE,OAAM;QACN,oBAAoB;QACpB,OAAO;IACT;IAEA,gCAAgC;IAChC,IAAIH,UAAUC,cAAc;QAC1B,OAAO;IACT;IAEA,IAAI;QACF,4BAA4B;QAC5BF,SAAS,YAAY;YACnBG,KAAKD;YACLE,OAAO;QACT;QAEA,+DAA+D;QAC/D,IAAIG,QAAQC,GAAG,CAACC,EAAE,EAAE;YAClBT,SAAS,6CAA6C;gBACpDG,KAAKD;gBACLE,OAAO;YACT;YACAJ,SAAS,qCAAqC;gBAC5CG,KAAKD;gBACLE,OAAO;YACT;QACF;QAEA,qDAAqD;QACrD,IAAI,CAACC,0BAA0B;YAC7BL,SAAS,wBAAwB;gBAC/BG,KAAKD;gBACLE,OAAO;YACT;QACF;QAEA,kBAAkB;QAClBJ,SAAS,cAAc;YACrBG,KAAKD;YACLE,OAAO;QACT;QAEA,wBAAwB;QACxBJ,SAAS,wCAAwC;YAC/CG,KAAKD;YACLE,OAAO;QACT;QAEA,OAAO;IACT,EAAE,OAAM;QACN,wBAAwB;QACxB,OAAO;IACT;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-debug.d.ts","sourceRoot":"","sources":["../../src/utils/is-debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,QAAO,OAE1B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/is-debug.ts"],"sourcesContent":["/**\n * Check if debug mode is enabled via DEBUG environment variable\n * @returns true if DEBUG environment variable is set to 'true'\n */\nexport const isDebug = (): boolean => {\n return process.env.DEBUG === 'true'\n}\n"],"names":["isDebug","process","env","DEBUG"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,UAAU;IACrB,OAAOC,QAAQC,GAAG,CAACC,KAAK,KAAK;AAC/B,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"lambda-config.d.ts","sourceRoot":"","sources":["../../src/utils/lambda-config.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/lambda-config.ts"],"sourcesContent":["import { parseModule, Syntax } from 'esprima-next'\nimport fs from 'fs/promises'\nimport path from 'path'\n\nconst RUN_SH_CONTENT = `#!/bin/bash -x\n\n[ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache\n\nNODE_ENV=production exec node server.js\n`\n\nconst BUILD_FOR_LAMBDA_SH_CONTENT = `#!/bin/bash\n\ncp -r .next/static .next/standalone/.next/static\ncp run.sh .next/standalone/run.sh\ncd .next/standalone\nzip -r --symlinks lambda.zip .\nmv lambda.zip ../..\n`\n\n/**\n * Apply Lambda-specific modifications to a Payload project\n *\n * @param projectPath - Path to project directory\n */\nexport async function applyLambdaModifications(projectPath: string): Promise<void> {\n // 1. Create run.sh\n const runShPath = path.join(projectPath, 'run.sh')\n await fs.writeFile(runShPath, RUN_SH_CONTENT, 'utf-8')\n await fs.chmod(runShPath, 0o755) // rwxr-xr-x\n\n // 2. Create build_for_lambda.sh\n const buildShPath = path.join(projectPath, 'build_for_lambda.sh')\n await fs.writeFile(buildShPath, BUILD_FOR_LAMBDA_SH_CONTENT, 'utf-8')\n await fs.chmod(buildShPath, 0o755)\n\n // 3. Modify next config to add standalone output\n await addStandaloneToNextConfig(projectPath)\n\n // 4. Create/update .npmrc\n const npmrcPath = path.join(projectPath, '.npmrc')\n let npmrcContent = ''\n\n try {\n npmrcContent = await fs.readFile(npmrcPath, 'utf-8')\n } catch {\n // File doesn't exist, start fresh\n }\n\n if (!npmrcContent.includes('node-linker=hoisted')) {\n npmrcContent += npmrcContent && !npmrcContent.endsWith('\\n') ? '\\n' : ''\n npmrcContent += 'node-linker=hoisted\\n'\n await fs.writeFile(npmrcPath, npmrcContent, 'utf-8')\n }\n\n // 5. Add lambda:buildzip script to package.json\n await addLambdaBuildScript(projectPath)\n}\n\n/**\n * Find the Next.js config file (next.config.js or next.config.mjs)\n *\n * @todo Support TypeScript config files in future\n */\nasync function findNextConfigPath(projectPath: string): Promise<string> {\n const configFiles = ['next.config.js', 'next.config.mjs']\n\n for (const configFile of configFiles) {\n const configPath = path.join(projectPath, configFile)\n try {\n await fs.access(configPath)\n return configPath\n } catch {\n // File doesn't exist, try next one\n }\n }\n\n throw new Error('Could not find next.config.js or next.config.mjs')\n}\n\n/**\n * Add standalone output to Next.js config using AST parsing\n */\nasync function addStandaloneToNextConfig(projectPath: string): Promise<void> {\n const nextConfigPath = await findNextConfigPath(projectPath)\n const content = await fs.readFile(nextConfigPath, 'utf-8')\n\n // Check if output already configured (quick check before parsing)\n if (content.includes('output:')) {\n return // Already configured\n }\n\n const ast = parseModule(content, { loc: true })\n\n // Find export default declaration\n const exportDefaultDeclaration = ast.body.find(\n (p) => p.type === Syntax.ExportDefaultDeclaration,\n ) as ExportDefaultDeclaration | undefined\n\n if (!exportDefaultDeclaration?.declaration?.loc) {\n throw new Error(`Could not find export default declaration in ${path.basename(nextConfigPath)}`)\n }\n\n // Find the object expression to modify\n let targetObjectExpression: ObjectExpressionNode | undefined\n\n if (exportDefaultDeclaration.declaration.type === 'ObjectExpression') {\n // Direct export: export default { ... }\n targetObjectExpression = exportDefaultDeclaration.declaration as ObjectExpressionNode\n } else if (exportDefaultDeclaration.declaration.type === 'CallExpression') {\n // Wrapped export: export default withPayload(nextConfig, ...)\n const callExpr = exportDefaultDeclaration.declaration as CallExpressionNode\n const firstArg = callExpr.arguments?.[0]\n\n if (firstArg?.type === 'Identifier') {\n // Find the variable declaration for this identifier\n const configVarName = (firstArg as IdentifierNode).name\n const varDeclaration = ast.body.find((node) => {\n if (node.type === Syntax.VariableDeclaration) {\n const varNode = node as VariableDeclarationNode\n return varNode.declarations?.some(\n (decl) =>\n decl.id?.type === 'Identifier' &&\n (decl.id as IdentifierNode).name === configVarName &&\n decl.init?.type === 'ObjectExpression',\n )\n }\n return false\n }) as undefined | VariableDeclarationNode\n\n if (varDeclaration) {\n const declarator = varDeclaration.declarations?.find(\n (decl) =>\n decl.id?.type === 'Identifier' && (decl.id as IdentifierNode).name === configVarName,\n )\n if (declarator?.init?.type === 'ObjectExpression') {\n targetObjectExpression = declarator.init as ObjectExpressionNode\n }\n }\n }\n }\n\n if (!targetObjectExpression?.loc) {\n throw new Error(\n `Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` +\n `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`,\n )\n }\n\n const { loc } = targetObjectExpression\n const lines = content.split('\\n')\n\n // Insert output: 'standalone' as first property\n const insertLine = loc.start.line - 1\n const insertColumn = loc.start.column + 1 // After opening brace\n\n // Find the content of the line with the opening brace\n const targetLine = lines[insertLine]\n if (!targetLine) {\n throw new Error(`Could not find target line in ${path.basename(nextConfigPath)}`)\n }\n\n lines[insertLine] =\n targetLine.slice(0, insertColumn) + \"\\n output: 'standalone',\" + targetLine.slice(insertColumn)\n\n const modifiedContent = lines.join('\\n')\n await fs.writeFile(nextConfigPath, modifiedContent, 'utf-8')\n}\n\ntype ExportDefaultDeclaration = {\n declaration: {\n arguments?: unknown[]\n loc: {\n end: { column: number; line: number }\n start: { column: number; line: number }\n }\n type: string\n }\n type: string\n}\n\ntype ObjectExpressionNode = {\n loc: {\n end: { column: number; line: number }\n start: { column: number; line: number }\n }\n type: 'ObjectExpression'\n}\n\ntype IdentifierNode = {\n name: string\n type: 'Identifier'\n}\n\ntype CallExpressionNode = {\n arguments?: Array<{ type: string }>\n type: 'CallExpression'\n}\n\ntype VariableDeclarationNode = {\n declarations?: Array<{\n id?: { name?: string; type: string }\n init?: { loc?: ObjectExpressionNode['loc']; type: string }\n }>\n type: 'VariableDeclaration'\n}\n\n/**\n * Add lambda:buildzip script to package.json\n */\nasync function addLambdaBuildScript(projectPath: string): Promise<void> {\n const packageJsonPath = path.join(projectPath, 'package.json')\n const content = await fs.readFile(packageJsonPath, 'utf-8')\n const packageJson = JSON.parse(content)\n\n if (!packageJson.scripts) {\n packageJson.scripts = {}\n }\n\n packageJson.scripts['lambda:buildzip'] = 'npm run build && ./build_for_lambda.sh'\n\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\\n', 'utf-8')\n}\n"],"names":["parseModule","Syntax","fs","path","RUN_SH_CONTENT","BUILD_FOR_LAMBDA_SH_CONTENT","applyLambdaModifications","projectPath","runShPath","join","writeFile","chmod","buildShPath","addStandaloneToNextConfig","npmrcPath","npmrcContent","readFile","includes","endsWith","addLambdaBuildScript","findNextConfigPath","configFiles","configFile","configPath","access","Error","nextConfigPath","content","ast","loc","exportDefaultDeclaration","body","find","p","type","ExportDefaultDeclaration","declaration","basename","targetObjectExpression","callExpr","firstArg","arguments","configVarName","name","varDeclaration","node","VariableDeclaration","varNode","declarations","some","decl","id","init","declarator","lines","split","insertLine","start","line","insertColumn","column","targetLine","slice","modifiedContent","packageJsonPath","packageJson","JSON","parse","scripts","stringify"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,eAAc;AAClD,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB,MAAMC,iBAAiB,CAAC;;;;;AAKxB,CAAC;AAED,MAAMC,8BAA8B,CAAC;;;;;;;AAOrC,CAAC;AAED;;;;CAIC,GACD,OAAO,eAAeC,yBAAyBC,WAAmB;IAChE,mBAAmB;IACnB,MAAMC,YAAYL,KAAKM,IAAI,CAACF,aAAa;IACzC,MAAML,GAAGQ,SAAS,CAACF,W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utils/log.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,YAAa,MAAM,KAAG,IAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAIvC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,MAAM,KAAG,IAErC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/log.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport pc from 'picocolors'\n\nimport { isDebug } from './is-debug.js'\n\nexport const warning = (message: string): void => {\n p.log.warn(pc.yellow('? ') + pc.bold(message))\n}\n\nexport const info = (message: string): void => {\n p.log.step(pc.bold(message))\n}\n\nexport const error = (message: string): void => {\n p.log.error(pc.bold(message))\n}\n\nexport const debug = (message: string): void => {\n if (isDebug()) {\n p.log.step(`${pc.bgMagenta('[DEBUG]')} ${pc.gray(message)}`)\n }\n}\n\nexport const log = (message: string): void => {\n p.log.message(message)\n}\n"],"names":["p","pc","isDebug","warning","message","log","warn","yellow","bold","info","step","error","debug","bgMagenta","gray"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,QAAQ,aAAY;AAE3B,SAASC,OAAO,QAAQ,gBAAe;AAEvC,OAAO,MAAMC,UAAU,CAACC;IACtBJ,EAAEK,GAAG,CAACC,IAAI,CAACL,GAAGM,MAAM,CAAC,QAAQN,GAAGO,IAAI,CAACJ;AACvC,EAAC;AAED,OAAO,MAAMK,OAAO,CAACL;IACnBJ,EAAEK,GAAG,CAACK,IAAI,CAACT,GAAGO,IAAI,CAACJ;AACrB,EAAC;AAED,OAAO,MAAMO,QAAQ,CAACP;IACpBJ,EAAEK,GAAG,CAACM,KAAK,CAACV,GAAGO,IAAI,CAACJ;AACtB,EAAC;AAED,OAAO,MAAMQ,QAAQ,CAACR;IACpB,IAAIF,WAAW;QACbF,EAAEK,GAAG,CAACK,IAAI,CAAC,GAAGT,GAAGY,SAAS,CAAC,WAAW,CAAC,EAAEZ,GAAGa,IAAI,CAACV,UAAU;IAC7D;AACF,EAAC;AAED,OAAO,MAAMC,MAAM,CAACD;IAClBJ,EAAEK,GAAG,CAACD,OAAO,CAACA;AAChB,EAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,wBAAgB,WAAW,IAAI,IAAI,CA2ClC;AASD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport path from 'path'\nimport pc from 'picocolors'\nimport terminalLink from 'terminal-link'\n\nimport type { PackageManager } from '../types.js'\n\nconst header = (message: string): string => pc.bold(message)\n\nexport function helpMessage(): void {\n console.log(`\n ${pc.bold('USAGE')}\n\n ${pc.dim('@payloadcms/figma <command> [options]')}\n\n ${pc.bold('COMMANDS')}\n\n ${pc.cyan('login')} Authenticate with Figma OAuth2\n ${pc.cyan('logout')} Clear all stored tokens\n ${pc.cyan('list-tokens')} Show stored token information\n ${pc.cyan('init')} Initialize a Figma CMS project\n ${pc.cyan('deploy')} Deploy your project to Figma\n\n ${pc.bold('OPTIONS')}\n\n ${pc.dim('-h, --help Show help')}\n ${pc.dim('--debug Enable debug logging')}\n\n ${pc.bold('AUTHENTICATION')}\n\n ${pc.cyan('@payloadcms/figma login')} Authenticate with Figma\n ${pc.cyan('@payloadcms/figma logout')} Clear all tokens (with confirmation)\n ${pc.cyan('@payloadcms/figma list-tokens')} Display stored OAuth and project tokens\n\n ${pc.bold('INIT COMMAND')}\n\n ${pc.cyan('@payloadcms/figma init --id <cms-id>')} Initialize project with CMS ID\n ${pc.cyan('@payloadcms/figma init')} Initialize (prompts for CMS ID)\n ${pc.cyan('@payloadcms/figma init --name my-cms')} Specify project name for new projects\n ${pc.cyan('@payloadcms/figma init --force')} Force reconfiguration of existing project\n ${pc.cyan('@payloadcms/figma init --skip-auth')} Skip authentication (testing only)\n\n ${pc.bold('DEPLOY COMMAND')}\n\n ${pc.cyan('@payloadcms/figma deploy')} Deploy your project to Figma\n ${pc.dim('--yes, -y')} Skip confirmation prompts\n\n ${pc.bold('DOCUMENTATION')}\n\n ${createTerminalLink('Getting Started', 'https://payloadcms.com/docs/getting-started/what-is-payload')}\n ${createTerminalLink('Figma CMS Docs', 'https://www.figma.com/developers/api')}\n`)\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in README.md\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativeAppDir = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${pc.bold('To continue:')}\n\n- Create a new directory in ./${relativeAppDir} such as ./${relativeAppDir}/${pc.bold('(app)')}\n- Move all files from ./${relativeAppDir} into that directory\n\nIt is recommended to do this from your IDE if your app has existing file references.\n\nOnce moved, rerun the @payloadcms/figma command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${pc.bgCyan(pc.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n"],"names":["path","pc","terminalLink","header","message","bold","helpMessage","console","log","dim","cyan","createTerminalLink","text","url","fallback","successMessage","projectDir","packageManager","relativePath","relative","process","cwd","successfulNextInit","moveMessage","args","relativeAppDir","nextAppDir","feedbackOutro","bgCyan","black"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,UAAU,OAAM;AACvB,OAAOC,QAAQ,aAAY;AAC3B,OAAOC,kBAAkB,gBAAe;AAIxC,MAAMC,SAAS,CAACC,UAA4BH,GAAGI,IAAI,CAACD;AAEpD,OAAO,SAASE;IACdC,QAAQC,GAAG,CAAC,CAAC;EACb,EAAEP,GAAGI,IAAI,CAAC,SAAS;;MAEf,EAAEJ,GAAGQ,GAAG,CAAC,yCAAyC;;EAEtD,EAAER,GAAGI,IAAI,CAAC,YAAY;;MAElB,EAAEJ,GAAGS,IAAI,CAAC,SAAS;MACnB,EAAET,GAAGS,IAAI,CAAC,UAAU;MACpB,EAAET,GAAGS,IAAI,CAAC,eAAe;MACzB,EAAET,GAAGS,IAAI,CAAC,QAAQ;MAClB,EAAET,GAAGS,IAAI,CAAC,UAAU;;EAExB,EAAET,GAAGI,IAAI,CAAC,WAAW;;MAEjB,EAAEJ,GAAGQ,GAAG,CAAC,iCAAiC;MAC1C,EAAER,GAAGQ,GAAG,CAAC,4CAA4C;;EAEzD,EAAER,GA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EACF,EAAEA,mBAAmB,iBAAiB,sDAAsD;AAC9F,CAAC;AACD;AAEA,OAAO,SAASY,YAAYC,IAAgD;IAC1E,MAAMC,iBAAiBzB,KAAKmB,QAAQ,CAACC,QAAQC,GAAG,IAAIG,KAAKE,UAAU;IACnE,OAAO,CAAC;AACV,EAAEvB,OAAO,eAAe;;;;AAIxB,EAAEF,GAAGI,IAAI,CAAC,gBAAgB;;8BAEI,EAAEoB,eAAe,WAAW,EAAEA,eAAe,CAAC,EAAExB,GAAGI,IAAI,CAAC,SAAS;wBACvE,EAAEoB,eAAe;;;;;AAKzC,CAAC;AACD;AAEA,OAAO,SAASE;IACd,OAAO,GAAG1B,GAAG2B,MAAM,CAAC3B,GAAG4B,KAAK,CAAC,qBAAqB,aAAa,EAAElB,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AAC3I"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/utils/package-manager.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAEpD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAoBnF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/package-manager.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport path from 'path'\n\n/**\n * Supported package managers\n */\nexport type PackageManager = 'npm' | 'pnpm' | 'yarn'\n\n/**\n * Detect package manager from lockfiles\n *\n * @param projectDir - Project directory to check\n * @returns Detected package manager, defaults to npm\n */\nexport async function getPackageManager(projectDir: string): Promise<PackageManager> {\n try {\n // Check for lockfiles in order of preference\n if (await fileExists(path.join(projectDir, 'pnpm-lock.yaml'))) {\n return 'pnpm'\n }\n\n if (await fileExists(path.join(projectDir, 'yarn.lock'))) {\n return 'yarn'\n }\n\n if (await fileExists(path.join(projectDir, 'package-lock.json'))) {\n return 'npm'\n }\n\n // Default to npm if no lockfile found\n return 'npm'\n } catch {\n return 'npm'\n }\n}\n\n/**\n * Check if file exists\n */\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await fs.stat(filePath)\n return true\n } catch {\n return false\n }\n}\n"],"names":["fs","path","getPackageManager","projectDir","fileExists","join","filePath","stat"],"mappings":"AAAA,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAOvB;;;;;CAKC,GACD,OAAO,eAAeC,kBAAkBC,UAAkB;IACxD,IAAI;QACF,6CAA6C;QAC7C,IAAI,MAAMC,WAAWH,KAAKI,IAAI,CAACF,YAAY,oBAAoB;YAC7D,OAAO;QACT;QAEA,IAAI,MAAMC,WAAWH,KAAKI,IAAI,CAACF,YAAY,eAAe;YACxD,OAAO;QACT;QAEA,IAAI,MAAMC,WAAWH,KAAKI,IAAI,CAACF,YAAY,uBAAuB;YAChE,OAAO;QACT;QAEA,sCAAsC;QACtC,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAEA;;CAEC,GACD,eAAeC,WAAWE,QAAgB;IACxC,IAAI;QACF,MAAMN,GAAGO,IAAI,CAACD;QACd,OAAO;IACT,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"payload-config-ast.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAM1C,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,cAAc,CAAC,EAAE;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,OAAO,CAAA;KACnB,CAAA;IACD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,eAAe,CAiJ7E;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AA0CD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,eAAe,GACzB,qBAAqB,CAyJvB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,mBAAmB,GAC1B,qBAAqB,CA+CvB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,mBAAmB,GAAG,IAAI,CA0ElF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/payload-config-ast.ts"],"sourcesContent":["import type { SourceFile } from 'ts-morph'\n\nimport { Node, SyntaxKind } from 'ts-morph'\n\nimport * as log from './log.js'\n\nexport type DetectionResult = {\n dbProperty?: {\n adapter: string\n importSource: string\n }\n editorProperty?: {\n importSource: string\n isDefault: boolean\n }\n figmaObjectExists: boolean\n hasAlias: boolean\n hasBuildConfig?: boolean\n hasOtherPayloadImports: boolean\n needsImportChange: boolean\n secretProperty?: boolean\n}\n\n/**\n * Detect what changes are needed in the payload config file\n */\nexport function detectRequiredChanges(sourceFile: SourceFile): DetectionResult {\n const result: DetectionResult = {\n figmaObjectExists: false,\n hasAlias: false,\n hasOtherPayloadImports: false,\n needsImportChange: false,\n }\n\n // Find buildConfig import\n const imports = sourceFile.getImportDeclarations()\n const payloadImport = imports.find(\n (imp) =>\n imp.getModuleSpecifierValue() === 'payload' ||\n imp.getModuleSpecifierValue() === '@payloadcms/figma',\n )\n\n if (!payloadImport) {\n log.debug('No payload or @payloadcms/figma import found')\n result.hasBuildConfig = false\n return result\n }\n\n log.debug(`Found import from: ${payloadImport.getModuleSpecifierValue()}`)\n\n const moduleSpecifier = payloadImport.getModuleSpecifierValue()\n const namedImports = payloadImport.getNamedImports()\n\n // Check if buildConfig is imported\n const buildConfigImport = namedImports.find((ni) => ni.getName() === 'buildConfig')\n\n if (!buildConfigImport) {\n result.hasBuildConfig = false\n return result\n }\n\n // Check for alias and get the actual name used in code\n const aliasNode = buildConfigImport.getAliasNode()\n const buildConfigName = aliasNode ? aliasNode.getText() : 'buildConfig'\n if (aliasNode) {\n result.hasAlias = true\n }\n\n // Check if import needs change\n if (moduleSpecifier === 'payload') {\n result.needsImportChange = true\n\n // Check if there are other imports from payload\n if (namedImports.length > 1) {\n result.hasOtherPayloadImports = true\n }\n }\n\n // Find buildConfig call in export default\n // First try to find export default with the buildConfig call\n const exportAssignment = sourceFile.getFirstDescendantByKind(SyntaxKind.ExportAssignment)\n let buildConfigCall = null\n\n if (exportAssignment) {\n // Look for buildConfig call in the export default\n const callExpressions = exportAssignment.getDescendantsOfKind(SyntaxKind.CallExpression)\n buildConfigCall = callExpressions.find((ce) => {\n const expr = ce.getExpression()\n return expr.getText() === buildConfigName\n })\n }\n\n // If not found in export default, search all call expressions\n if (!buildConfigCall) {\n const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)\n buildConfigCall = callExpressions.find((ce) => {\n const expr = ce.getExpression()\n return expr.getText() === buildConfigName\n })\n }\n\n if (!buildConfigCall) {\n result.hasBuildConfig = false\n return result\n }\n\n // Get config object\n const configArg = buildConfigCall.getArguments()[0]\n if (!configArg || !Node.isObjectLiteralExpression(configArg)) {\n return result\n }\n\n // Check for db property\n const dbProperty = configArg.getProperty('db')\n if (dbProperty) {\n const dbValue = dbProperty.getChildrenOfKind(SyntaxKind.CallExpression)[0]\n if (dbValue) {\n const adapterName = dbValue.getExpression().getText()\n\n // Find the import source for this adapter\n const adapterImport = imports.find((imp) =>\n imp.getNamedImports().some((ni) => ni.getName() === adapterName),\n )\n\n if (adapterImport) {\n result.dbProperty = {\n adapter: adapterName,\n importSource: adapterImport.getModuleSpecifierValue(),\n }\n }\n }\n }\n\n // Check for secret property\n const secretProperty = configArg.getProperty('secret')\n if (secretProperty) {\n result.secretProperty = true\n }\n\n // Check for editor property\n const editorProperty = configArg.getProperty('editor')\n if (editorProperty) {\n const editorValue = editorProperty.getChildrenOfKind(SyntaxKind.CallExpression)[0]\n if (editorValue) {\n const editorName = editorValue.getExpression().getText()\n\n // Find the import source\n const editorImport = imports.find((imp) =>\n imp.getNamedImports().some((ni) => ni.getName() === editorName),\n )\n\n if (editorImport && editorName === 'lexicalEditor') {\n // Check if it has arguments\n const args = editorValue.getArguments()\n const isDefault = args.length === 0\n\n result.editorProperty = {\n importSource: editorImport.getModuleSpecifierValue(),\n isDefault,\n }\n }\n }\n }\n\n // Check for figma property\n const figmaProperty = configArg.getProperty('figma')\n if (figmaProperty) {\n result.figmaObjectExists = true\n }\n\n return result\n}\n\nexport type ASTModificationResult = {\n changes: string[]\n modified: boolean\n}\n\n/**\n * Remove all comments\n * @returns true if any comments were removed\n */\nfunction removeAllComments(sourceFile: SourceFile): boolean {\n const ranges: Array<[number, number]> = []\n\n // Recursively collect comments from node and ALL children (including tokens)\n const collectComments = (node: Node) => {\n node.getLeadingCommentRanges().forEach((range) => {\n ranges.push([range.getPos(), range.getEnd()])\n })\n node.getTrailingCommentRanges().forEach((range) => {\n ranges.push([range.getPos(), range.getEnd()])\n })\n\n // Process ALL children including token nodes (commas, braces, etc.)\n node.getChildren().forEach(collectComments)\n }\n\n collectComments(sourceFile)\n\n if (ranges.length === 0) {\n return false\n }\n\n // Remove duplicates and sort in reverse order to avoid position shifts\n const uniqueRanges = Array.from(new Set(ranges.map((r) => JSON.stringify(r)))).map(\n (r) => JSON.parse(r) as [number, number],\n )\n uniqueRanges.sort((a, b) => b[0] - a[0])\n\n // Remove each comment range\n for (const [pos, end] of uniqueRanges) {\n sourceFile.removeText(pos, end)\n }\n\n return true\n}\n\n/**\n * Apply modifications to the source file based on detection result\n * Modifies the AST in memory - caller must call sourceFile.save()\n */\nexport function applyModifications(\n sourceFile: SourceFile,\n detection: DetectionResult,\n): ASTModificationResult {\n const changes: string[] = []\n let modified = false\n\n if (detection.hasBuildConfig === false || detection.hasAlias) {\n log.debug(\n `Skipping modifications: hasBuildConfig=${detection.hasBuildConfig}, hasAlias=${detection.hasAlias}`,\n )\n return { changes: [], modified: false }\n }\n\n // 1. Remove all comments FIRST (before AST modifications that might shift positions)\n const hadComments = removeAllComments(sourceFile)\n if (hadComments) {\n changes.push('Removed comments')\n modified = true\n }\n\n // Find the import declarations\n const imports = sourceFile.getImportDeclarations()\n const payloadImport = imports.find((imp) => imp.getModuleSpecifierValue() === 'payload')\n\n // Get the buildConfig name (could be aliased)\n let buildConfigName = 'buildConfig'\n if (payloadImport) {\n const buildConfigImport = payloadImport\n .getNamedImports()\n .find((ni) => ni.getName() === 'buildConfig')\n if (buildConfigImport) {\n const aliasNode = buildConfigImport.getAliasNode()\n buildConfigName = aliasNode ? aliasNode.getText() : 'buildConfig'\n }\n }\n\n // Find buildConfig call in export default (prefer export default)\n const exportAssignment = sourceFile.getFirstDescendantByKind(SyntaxKind.ExportAssignment)\n let buildConfigCall = null\n\n if (exportAssignment) {\n const callExpressions = exportAssignment.getDescendantsOfKind(SyntaxKind.CallExpression)\n buildConfigCall = callExpressions.find((ce) => {\n const expr = ce.getExpression()\n return expr.getText() === buildConfigName\n })\n }\n\n // If not found in export default, search all call expressions\n if (!buildConfigCall) {\n const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)\n buildConfigCall = callExpressions.find((ce) => {\n const expr = ce.getExpression()\n return expr.getText() === buildConfigName\n })\n }\n\n if (!buildConfigCall) {\n return { changes: [], modified: false }\n }\n\n const configArg = buildConfigCall.getArguments()[0]\n if (!configArg || !Node.isObjectLiteralExpression(configArg)) {\n return { changes: [], modified: false }\n }\n\n // 1. Remove db property\n if (detection.dbProperty) {\n const dbProperty = configArg.getProperty('db')\n if (dbProperty) {\n dbProperty.remove()\n changes.push('Removed db property')\n modified = true\n }\n }\n\n // 2. Remove secret property\n if (detection.secretProperty) {\n const secretProperty = configArg.getProperty('secret')\n if (secretProperty) {\n secretProperty.remove()\n changes.push('Removed secret property')\n modified = true\n }\n }\n\n // 3. Remove editor if default\n if (detection.editorProperty?.isDefault) {\n const editorProperty = configArg.getProperty('editor')\n if (editorProperty) {\n editorProperty.remove()\n changes.push('Removed default editor property')\n modified = true\n }\n }\n\n // 4. Update buildConfig import\n if (detection.needsImportChange) {\n if (payloadImport) {\n if (detection.hasOtherPayloadImports) {\n // Remove buildConfig from payload import, add new figma import\n const namedImports = payloadImport.getNamedImports()\n const buildConfigImport = namedImports.find((ni) => ni.getName() === 'buildConfig')\n if (buildConfigImport) {\n buildConfigImport.remove()\n\n // If payload import is now empty, remove it\n if (payloadImport.getNamedImports().length === 0) {\n payloadImport.remove()\n }\n }\n\n // Add new import at the top\n sourceFile.addImportDeclaration({\n moduleSpecifier: '@payloadcms/figma',\n namedImports: ['buildConfig'],\n })\n\n changes.push('Split buildConfig import to @payloadcms/figma')\n } else {\n // Replace entire import\n payloadImport.setModuleSpecifier('@payloadcms/figma')\n changes.push('Changed buildConfig import to @payloadcms/figma')\n }\n modified = true\n }\n }\n\n // 5. Remove orphaned imports\n // Re-fetch imports after each removal to avoid stale references\n if (detection.dbProperty) {\n const currentImports = sourceFile.getImportDeclarations()\n const dbImport = currentImports.find(\n (imp) => imp.getModuleSpecifierValue() === detection.dbProperty?.importSource,\n )\n if (dbImport) {\n dbImport.remove()\n changes.push(`Removed ${detection.dbProperty.adapter} import`)\n modified = true\n }\n }\n\n if (detection.editorProperty?.isDefault) {\n const currentImports = sourceFile.getImportDeclarations()\n const editorImport = currentImports.find(\n (imp) => imp.getModuleSpecifierValue() === detection.editorProperty?.importSource,\n )\n if (editorImport) {\n editorImport.remove()\n changes.push('Removed lexicalEditor import')\n modified = true\n }\n }\n\n return { changes, modified }\n}\n\nexport type FigmaPropertyConfig = {\n region: string\n tenantId: string\n useContentSystem: boolean\n}\n\n/**\n * Add figma property to buildConfig if it doesn't exist\n * Modifies the AST in memory - caller must call sourceFile.save()\n */\nexport function addFigmaProperty(\n sourceFile: SourceFile,\n config: FigmaPropertyConfig,\n): ASTModificationResult {\n const changes: string[] = []\n let modified = false\n\n // Find buildConfig call\n const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)\n const buildConfigCall = callExpressions.find((ce) => {\n const expr = ce.getExpression()\n const text = expr.getText()\n return text === 'buildConfig' || text.endsWith('.buildConfig')\n })\n\n if (!buildConfigCall) {\n log.debug('No buildConfig call found')\n return { changes: [], modified: false }\n }\n\n // Get config object argument\n const configArg = buildConfigCall.getArguments()[0]\n if (!configArg || !Node.isObjectLiteralExpression(configArg)) {\n log.debug('buildConfig argument is not an object literal')\n return { changes: [], modified: false }\n }\n\n // Check if figma property already exists\n const existingFigmaProperty = configArg.getProperty('figma')\n if (existingFigmaProperty) {\n log.debug('figma property already exists, skipping')\n return { changes: ['Skipped: figma property already exists'], modified: false }\n }\n\n // Add figma property\n configArg.addPropertyAssignment({\n name: 'figma',\n initializer: `{\n region: '${config.region}',\n tenantId: '${config.tenantId}',\n useContentSystem: ${config.useContentSystem},\n }`,\n })\n\n changes.push(\n `Added figma property (region: ${config.region}, tenantId: ${config.tenantId}, useContentSystem: ${config.useContentSystem})`,\n )\n modified = true\n\n return { changes, modified }\n}\n\n/**\n * Read figma configuration from payload.config.ts\n * Returns the figma object if it exists, null otherwise\n */\nexport function readFigmaConfig(sourceFile: SourceFile): FigmaPropertyConfig | null {\n // Find buildConfig call\n const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression)\n const buildConfigCall = callExpressions.find((ce) => {\n const expr = ce.getExpression()\n const text = expr.getText()\n return text === 'buildConfig' || text.endsWith('.buildConfig')\n })\n\n if (!buildConfigCall) {\n log.debug('No buildConfig call found')\n return null\n }\n\n // Get config object argument\n const configArg = buildConfigCall.getArguments()[0]\n if (!configArg || !Node.isObjectLiteralExpression(configArg)) {\n log.debug('buildConfig argument is not an object literal')\n return null\n }\n\n // Find figma property\n const figmaProperty = configArg.getProperty('figma')\n if (!figmaProperty || !Node.isPropertyAssignment(figmaProperty)) {\n log.debug('No figma property found in buildConfig')\n return null\n }\n\n // Get initializer (the object value)\n const initializer = figmaProperty.getInitializer()\n if (!initializer || !Node.isObjectLiteralExpression(initializer)) {\n log.debug('figma property is not an object literal')\n return null\n }\n\n // Extract values\n const regionProp = initializer.getProperty('region')\n const tenantIdProp = initializer.getProperty('tenantId')\n const useContentSystemProp = initializer.getProperty('useContentSystem')\n\n if (!regionProp || !tenantIdProp) {\n log.debug('Missing required figma properties (region or tenantId)')\n return null\n }\n\n // Extract string values (remove quotes)\n const region = Node.isPropertyAssignment(regionProp)\n ? regionProp\n .getInitializer()\n ?.getText()\n .replace(/['\"]/g, '')\n : undefined\n\n const tenantId = Node.isPropertyAssignment(tenantIdProp)\n ? tenantIdProp\n .getInitializer()\n ?.getText()\n .replace(/['\"]/g, '')\n : undefined\n\n const useContentSystem = Node.isPropertyAssignment(useContentSystemProp)\n ? useContentSystemProp.getInitializer()?.getText() === 'true'\n : true // Default to true if not specified\n\n if (!region || !tenantId) {\n log.debug('Could not extract region or tenantId values')\n return null\n }\n\n return {\n region,\n tenantId,\n useContentSystem,\n }\n}\n"],"names":["Node","SyntaxKind","log","detectRequiredChanges","sourceFile","result","figmaObjectExists","hasAlias","hasOtherPayloadImports","needsImportChange","imports","getImportDeclarations","payloadImport","find","imp","getModuleSpecifierValue","debug","hasBuildConfig","moduleSpecifier","namedImports","getNamedImports","buildConfigImport","ni","getName","aliasNode","getAliasNode","buildConfigName","getText","length","exportAssignment","getFirstDescendantByKind","ExportAssignment","buildConfigCall","callExpressions","getDescendantsOfKind","CallExpression","ce","expr","getExpression","configArg","getArguments","isObjectLiteralExpression","dbProperty","getProperty","dbValue","getChildrenOfKind","adapterName","adapterImport","some","adapter","importSource","secretProperty","editorProperty","editorValue","editorName","editorImport","args","isDefault","figmaProperty","removeAllComments","ranges","collectComments","node","getLeadingCommentRanges","forEach","range","push","getPos","getEnd","getTrailingCommentRanges","getChildren","uniqueRanges","Array","from","Set","map","r","JSON","stringify","parse","sort","a","b","pos","end","removeText","applyModifications","detection","changes","modified","hadComments","remove","addImportDeclaration","setModuleSpecifier","currentImports","dbImport","addFigmaProperty","config","text","endsWith","existingFigmaProperty","addPropertyAssignment","name","initializer","region","tenantId","useContentSystem","readFigmaConfig","isPropertyAssignment","getInitializer","regionProp","tenantIdProp","useContentSystemProp","replace","undefined"],"mappings":"AAEA,SAASA,IAAI,EAAEC,UAAU,QAAQ,WAAU;AAE3C,YAAYC,SAAS,WAAU;AAmB/B;;CAEC,GACD,OAAO,SAASC,sBAAsBC,UAAsB;IAC1D,MAAMC,SAA0B;QAC9BC,mBAAmB;QACnBC,UAAU;QACVC,wBAAwB;QACxBC,mBAAmB;IACrB;IAEA,0BAA0B;IAC1B,MAAMC,UAAUN,WAAWO,qBAAqB;IAChD,MAAMC,gBAAgBF,QAAQG,IAAI,CAChC,CAACC,MACCA,IAAIC,uBAAuB,OAAO,aAClCD,IAAIC,uBAAuB,OAAO;IAGtC,IAAI,CAACH,eAAe;QAClBV,IAAIc,KAAK,CAAC;QACVX,OAAOY,cAAc,GAAG;QACxB,OAAOZ;IACT;IAEAH,IAAIc,KAAK,CAAC,CAAC,mBAAmB,EAAEJ,cAAcG,uBAAuB,IAAI;IAEzE,MAAMG,kBAAkBN,cAAcG,uBAAuB;IAC7D,MAAMI,eAAeP,cAAcQ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LwF;QACAC;QACAC;IACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"payload-config-finder.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-finder.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAmBnF"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/payload-config-finder.ts"],"sourcesContent":["import { findConfig } from 'payload/node'\n\n/**\n * Find the Payload config file using Payload's built-in finder\n * Changes to project directory temporarily and restores afterward\n *\n * @param projectPath - Absolute path to project directory\n * @returns Absolute path to config file, or null if not found\n */\nexport async function findPayloadConfig(projectPath: string): Promise<null | string> {\n const originalCwd = process.cwd()\n\n try {\n // findConfig requires being in the project directory\n process.chdir(projectPath)\n\n // Use Payload's official config finder\n const configPath = findConfig()\n\n // Wrap in Promise.resolve to satisfy async requirement\n return await Promise.resolve(configPath || null)\n } catch {\n // Config not found or error occurred\n return null\n } finally {\n // Always restore original working directory\n process.chdir(originalCwd)\n }\n}\n"],"names":["findConfig","findPayloadConfig","projectPath","originalCwd","process","cwd","chdir","configPath","Promise","resolve"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAc;AAEzC;;;;;;CAMC,GACD,OAAO,eAAeC,kBAAkBC,WAAmB;IACzD,MAAMC,cAAcC,QAAQC,GAAG;IAE/B,IAAI;QACF,qDAAqD;QACrDD,QAAQE,KAAK,CAACJ;QAEd,uCAAuC;QACvC,MAAMK,aAAaP;QAEnB,uDAAuD;QACvD,OAAO,MAAMQ,QAAQC,OAAO,CAACF,cAAc;IAC7C,EAAE,OAAM;QACN,qCAAqC;QACrC,OAAO;IACT,SAAU;QACR,4CAA4C;QAC5CH,QAAQE,KAAK,CAACH;IAChB;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"payload-config-modifier.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-modifier.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAI1D,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAA;AAKhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,EAC9B,WAAW,CAAC,EAAE,mBAAmB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAqL7B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAwC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/payload-config-modifier.ts"],"sourcesContent":["import pc from 'picocolors'\nimport { Project } from 'ts-morph'\n\nimport type { PackageManager } from './package-manager.js'\n\nimport { formatFile } from './formatter.js'\nimport * as log from './log.js'\nimport {\n addFigmaProperty,\n applyModifications,\n detectRequiredChanges,\n type FigmaPropertyConfig,\n} from './payload-config-ast.js'\nimport { findPayloadConfig } from './payload-config-finder.js'\nimport { checkPackageInstalled, installPackage, uninstallPackage } from './payload-package-check.js'\nimport { runTypeScriptCheck } from './typescript-validator.js'\n\nexport type ModificationResult = {\n changes: string[]\n error?: string\n modified: boolean\n success: boolean\n warnings?: string[]\n}\n\n/**\n * Main orchestrator for payload config modification\n * Checks package, detects needed changes, applies modifications\n */\nexport async function ensurePayloadFigmaConfig(\n projectPath: string,\n packageManager: PackageManager,\n figmaConfig?: FigmaPropertyConfig,\n): Promise<ModificationResult> {\n const changes: string[] = []\n const warnings: string[] = []\n let modified = false\n\n try {\n log.debug(`Starting payload config modification for: ${projectPath}`)\n\n // 1. Find config file\n const configPath = await findPayloadConfig(projectPath)\n if (!configPath) {\n log.debug(`Config file not found in: ${projectPath}`)\n return {\n changes: [],\n error: 'payload.config.ts not found in project',\n modified: false,\n success: false,\n }\n }\n\n log.debug(`Found config file: ${configPath}`)\n\n // 2. Check/install @payloadcms/figma package\n const isInstalled = await checkPackageInstalled(projectPath, '@payloadcms/figma')\n if (!isInstalled) {\n log.debug('@payloadcms/figma not installed, attempting installation...')\n try {\n await installPackage(projectPath, '@payloadcms/figma', packageManager)\n changes.push('Installed @payloadcms/figma')\n modified = true\n log.debug('@payloadcms/figma installed successfully')\n } catch (error) {\n log.debug(\n `Failed to install @payloadcms/figma: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n return {\n changes: [],\n error: 'Failed to install @payloadcms/figma',\n modified: false,\n success: false,\n }\n }\n } else {\n log.debug('@payloadcms/figma already installed')\n }\n\n // 3. Parse config with ts-morph\n log.debug('Parsing config file with ts-morph...')\n const project = new Project({\n skipAddingFilesFromTsConfig: true,\n })\n const sourceFile = project.addSourceFileAtPath(configPath)\n\n // 4. Detect required changes\n log.debug('Detecting required changes...')\n const detection = detectRequiredChanges(sourceFile)\n\n log.debug(\n `Detection results: needsImportChange=${detection.needsImportChange}, hasAlias=${detection.hasAlias}, hasBuildConfig=${detection.hasBuildConfig}`,\n )\n\n // Handle failure modes\n if (detection.hasAlias) {\n log.debug('Config uses import alias (e.g., buildConfig as X)')\n return {\n changes,\n error: 'Config uses import alias - manual modification required',\n modified,\n success: false,\n }\n }\n\n if (detection.hasBuildConfig === false) {\n log.debug('No buildConfig call found in config file')\n return {\n changes,\n error: 'Config structure not recognized (no buildConfig call found)',\n modified,\n success: false,\n }\n }\n\n // 5. Apply modifications\n log.debug('Applying modifications...')\n const modResult = applyModifications(sourceFile, detection)\n if (modResult.modified) {\n changes.push(...modResult.changes)\n modified = true\n\n log.debug(`Applied ${modResult.changes.length} modifications`)\n }\n\n // 6. Add figma property if config provided and doesn't exist\n if (figmaConfig && !detection.figmaObjectExists) {\n log.debug('Adding figma property to buildConfig...')\n const figmaResult = addFigmaProperty(sourceFile, figmaConfig)\n if (figmaResult.modified) {\n changes.push(...figmaResult.changes)\n modified = true\n log.debug(`Added figma property`)\n } else {\n log.debug('Figma property not added (may already exist)')\n }\n } else if (detection.figmaObjectExists) {\n log.debug('Figma property already exists, skipping')\n }\n\n // Save file if any modifications were made\n if (modified) {\n await sourceFile.save()\n log.debug('Config file saved')\n\n // 7. Uninstall orphaned packages\n const packagesToUninstall: string[] = []\n\n if (detection.dbProperty) {\n packagesToUninstall.push(detection.dbProperty.importSource)\n }\n\n if (detection.editorProperty?.isDefault) {\n packagesToUninstall.push(detection.editorProperty.importSource)\n }\n\n if (packagesToUninstall.length > 0) {\n log.debug(`Uninstalling ${packagesToUninstall.length} orphaned packages...`)\n }\n\n for (const pkg of packagesToUninstall) {\n try {\n await uninstallPackage(projectPath, pkg, packageManager)\n changes.push(`Uninstalled ${pkg}`)\n log.debug(`Uninstalled ${pkg}`)\n } catch (error) {\n log.debug(\n `Failed to uninstall ${pkg}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n // Don't fail on uninstall errors - orphaned package is better than broken config\n }\n }\n\n // 8. Format file\n log.debug('Formatting config file...')\n const formatResult = await formatFile(configPath, packageManager)\n if (!formatResult.success && formatResult.warning) {\n warnings.push(formatResult.warning)\n log.debug(`Formatting warning: ${formatResult.warning}`)\n }\n\n // 9. Run TypeScript validation\n log.debug('Running TypeScript validation...')\n const tsResult = await runTypeScriptCheck(projectPath, packageManager)\n if (!tsResult.success && tsResult.errors.length > 0) {\n warnings.push(\"TypeScript validation found issues - run 'pnpm build' for details\")\n log.debug(`TypeScript validation found ${tsResult.errors.length} issues`)\n }\n } else {\n log.debug('No modifications needed - config already correct')\n }\n\n log.debug('Payload config modification completed successfully')\n\n return {\n changes,\n modified,\n success: true,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n } catch (error) {\n log.debug(\n `Unexpected error in ensurePayloadFigmaConfig: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n if (error instanceof Error && error.stack) {\n log.debug(`Stack trace: ${error.stack}`)\n }\n return {\n changes,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n modified,\n success: false,\n }\n }\n}\n\n/**\n * Display manual configuration instructions\n */\nexport function displayManualInstructions(reason: string): void {\n const leftLineWrap = (message: string): string => {\n // Add '┌ ' prefix to first line, '│ ' to subsequent lines, and '└ ' to last line\n return message\n .split('\\n')\n .map((line, index, arr) => {\n if (index === 0) {\n return `${pc.dim('┌ ')}${line}`\n } else if (index === arr.length - 1) {\n return `${pc.dim('└ ')}${line}`\n } else {\n return `${pc.dim('│ ')}${line}`\n }\n })\n .join('\\n')\n }\n\n const message = leftLineWrap(`${pc.cyan(pc.bold('Manual Configuration Required'))}\n\nUnable to automatically modify payload.config.ts\nReason: ${pc.yellow(reason)}\n\n${pc.bold('Required changes:')}\n\n1. Replace buildConfig import:\n ${pc.dim('- FROM: ')}${pc.cyan(\"import { buildConfig } from 'payload'\")}\n ${pc.dim('- TO: ')}${pc.cyan(\"import { buildConfig } from '@payloadcms/figma'\")}\n\n2. Remove these properties from buildConfig():\n • db\n • secret\n • editor (if using default lexicalEditor())\n\n3. Install package:\n ${pc.cyan('pnpm add @payloadcms/figma')}\n\nThen run: ${pc.cyan('npx @payloadcms/figma init')}`)\n\n // eslint-disable-next-line no-console\n console.log(message)\n}\n"],"names":["pc","Project","formatFile","log","addFigmaProperty","applyModifications","detectRequiredChanges","findPayloadConfig","checkPackageInstalled","installPackage","uninstallPackage","runTypeScriptCheck","ensurePayloadFigmaConfig","projectPath","packageManager","figmaConfig","changes","warnings","modified","debug","configPath","error","success","isInstalled","push","Error","message","project","skipAddingFilesFromTsConfig","sourceFile","addSourceFileAtPath","detection","needsImportChange","hasAlias","hasBuildConfig","modResult","length","figmaObjectExists","figmaResult","save","packagesToUninstall","dbProperty","importSource","editorProperty","isDefault","pkg","formatResult","warning","tsResult","errors","undefined","stack","displayManualInstructions","reason","leftLineWrap","split","map","line","index","arr","dim","join","cyan","bold","yellow","console"],"mappings":"AAAA,OAAOA,QAAQ,aAAY;AAC3B,SAASC,OAAO,QAAQ,WAAU;AAIlC,SAASC,UAAU,QAAQ,iBAAgB;AAC3C,YAAYC,SAAS,WAAU;AAC/B,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,qBAAqB,QAEhB,0BAAyB;AAChC,SAASC,iBAAiB,QAAQ,6BAA4B;AAC9D,SAASC,qBAAqB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,6BAA4B;AACpG,SAASC,kBAAkB,QAAQ,4BAA2B;AAU9D;;;CAGC,GACD,OAAO,eAAeC,yBACpBC,WAAmB,EACnBC,cAA8B,EAC9BC,WAAiC;IAEjC,MAAMC,UAAoB,EAAE;IAC5B,MAAMC,WAAqB,EAAE;IAC7B,IAAIC,WAAW;IAEf,IAAI;QACFf,IAAIgB,KAAK,CAAC,CAAC,0CAA0C,EAAEN,aAAa;QAEpE,sBAAsB;QACtB,MAAMO,aAAa,MAAMb,kBAAkBM;QAC3C,IAAI,CAACO,YAAY;YACfjB,IAAIgB,KAAK,CAAC,CAAC,0BAA0B,EAAEN,aAAa;YACpD,OAAO;gBACLG,SAAS,EAAE;gBACXK,OAAO;gBACPH,UAAU;gBACVI,SAAS;YACX;QACF;QAEAnB,IAAIgB,KAAK,CAAC,CAAC,mBAAmB,EAAEC,YAAY;QAE5C,6CAA6C;QAC7C,MAAMG,cAAc,MAAMf,sBAAsBK,aAAa;QAC7D,IAAI,CAACU,aAAa;YAChBpB,IAAIgB,KAAK,CAAC;YACV,IAAI;gBACF,MAAMV,eAAeI,aAAa,qBAAqBC;gBACvDE,QAAQQ,IAAI,CAAC;gBACbN,WAAW;gBACXf,IAAIgB,KAAK,CAAC;YACZ,EAAE,OAAOE,OAAO;gBACdlB,IAAIgB,KAAK,CACP,CAAC,qCAAqC,EAAEE,iBAAiBI,QAAQ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D,GAAG,CAAC,SAASH,MAAM;YAClC,OAAO;gBACL,OAAO,GAAGzD,GAAG4D,GAAG,CAAC,SAASH,MAAM;YAClC;QACF,GACCI,IAAI,CAAC;IACV;IAEA,MAAMnC,UAAU4B,aAAa,GAAGtD,GAAG8D,IAAI,CAAC9D,GAAG+D,IAAI,CAAC,kCAAkC;;;QAG5E,EAAE/D,GAAGgE,MAAM,CAACX,QAAQ;;AAE5B,EAAErD,GAAG+D,IAAI,CAAC,qBAAqB;;;GAG5B,EAAE/D,GAAG4D,GAAG,CAAC,cAAc5D,GAAG8D,IAAI,CAAC,yCAAyC;GACxE,EAAE9D,GAAG4D,GAAG,CAAC,cAAc5D,GAAG8D,IAAI,CAAC,mDAAmD;;;;;;;;GAQlF,EAAE9D,GAAG8D,IAAI,CAAC,8BAA8B;;UAEjC,EAAE9D,GAAG8D,IAAI,CAAC,+BAA+B;IAEjD,sCAAsC;IACtCG,QAAQ9D,GAAG,CAACuB;AACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"payload-package-check.d.ts","sourceRoot":"","sources":["../../src/utils/payload-package-check.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAI1D;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,OAAO,CAAC,CAelB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,IAAI,CAAC,CA4Bf"}