@payloadcms/figma 0.0.1-alpha.7 → 0.0.1-alpha.70

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 (390) hide show
  1. package/dist/api/control-plane.d.ts +56 -6
  2. package/dist/api/control-plane.js +181 -72
  3. package/dist/api/figma-api.d.ts +22 -1
  4. package/dist/api/figma-api.js +78 -25
  5. package/dist/auth/callback-server.d.ts +19 -7
  6. package/dist/auth/callback-server.js +72 -30
  7. package/dist/auth/credentials.d.ts +21 -0
  8. package/dist/auth/credentials.js +21 -0
  9. package/dist/auth/crypto-utils.d.ts +28 -0
  10. package/dist/auth/crypto-utils.js +132 -21
  11. package/dist/auth/jwt-validator.d.ts +2 -1
  12. package/dist/auth/jwt-validator.js +2 -2
  13. package/dist/auth/oauth-flow.d.ts +19 -3
  14. package/dist/auth/oauth-flow.js +77 -22
  15. package/dist/auth/project-token.d.ts +32 -16
  16. package/dist/auth/project-token.js +171 -65
  17. package/dist/auth/refresh.d.ts +2 -1
  18. package/dist/auth/refresh.js +25 -12
  19. package/dist/auth/token-store-migration.d.ts +58 -0
  20. package/dist/auth/token-store-migration.js +156 -0
  21. package/dist/auth/token-store.d.ts +63 -97
  22. package/dist/auth/token-store.js +405 -122
  23. package/dist/auth/types.d.ts +35 -4
  24. package/dist/cli.js +93 -6
  25. package/dist/commands/bootstrap.d.ts +18 -0
  26. package/dist/commands/bootstrap.js +90 -0
  27. package/dist/commands/build-lambda-zip.d.ts +5 -0
  28. package/dist/commands/build-lambda-zip.js +19 -0
  29. package/dist/commands/debug.d.ts +8 -0
  30. package/dist/commands/debug.js +180 -0
  31. package/dist/commands/deploy.d.ts +9 -0
  32. package/dist/commands/deploy.js +180 -151
  33. package/dist/commands/dump-tokens.d.ts +12 -0
  34. package/dist/commands/dump-tokens.js +69 -0
  35. package/dist/commands/env.d.ts +13 -0
  36. package/dist/commands/env.js +88 -0
  37. package/dist/commands/init.d.ts +9 -5
  38. package/dist/commands/init.js +241 -148
  39. package/dist/commands/list-tokens.d.ts +3 -3
  40. package/dist/commands/list-tokens.js +24 -9
  41. package/dist/commands/login.d.ts +8 -1
  42. package/dist/commands/login.js +34 -16
  43. package/dist/commands/logout.d.ts +5 -4
  44. package/dist/commands/logout.js +77 -15
  45. package/dist/commands/upgrade.d.ts +5 -0
  46. package/dist/commands/upgrade.js +331 -0
  47. package/dist/config/oauth.d.ts +17 -11
  48. package/dist/config/oauth.js +38 -37
  49. package/dist/constants.d.ts +63 -18
  50. package/dist/constants.js +158 -18
  51. package/dist/db-content-api/generated/content-api-types.d.ts +3978 -0
  52. package/dist/db-content-api/generated/content-api-types.js +7 -0
  53. package/dist/db-content-api/index.d.ts +37 -0
  54. package/dist/db-content-api/index.js +923 -0
  55. package/dist/db-content-api/temp-utilities/slug.d.ts +2 -0
  56. package/dist/db-content-api/temp-utilities/slug.js +3 -0
  57. package/dist/db-content-api/temp-utilities/sorting.d.ts +3 -0
  58. package/dist/db-content-api/temp-utilities/sorting.js +39 -0
  59. package/dist/db-content-api/temp-utilities/types.d.ts +22 -0
  60. package/dist/db-content-api/temp-utilities/types.js +15 -0
  61. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +39 -0
  62. package/dist/db-content-api/temp-utilities/unwrapDocument.js +64 -0
  63. package/dist/db-content-api/utilities/auth.d.ts +30 -0
  64. package/dist/db-content-api/utilities/auth.js +84 -0
  65. package/dist/db-content-api/utilities/data/applyDefaults.d.ts +7 -0
  66. package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
  67. package/dist/db-content-api/utilities/data/castFieldValue.d.ts +11 -0
  68. package/dist/db-content-api/utilities/data/castFieldValue.js +68 -0
  69. package/dist/db-content-api/utilities/data/index.d.ts +49 -0
  70. package/dist/db-content-api/utilities/data/index.js +301 -0
  71. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +12 -0
  72. package/dist/db-content-api/utilities/data/removeVirtualFields.js +54 -0
  73. package/dist/db-content-api/utilities/data/stripFields.d.ts +48 -0
  74. package/dist/db-content-api/utilities/data/stripFields.js +195 -0
  75. package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +23 -0
  76. package/dist/db-content-api/utilities/data/transformPublishedLocale.js +42 -0
  77. package/dist/db-content-api/utilities/data/validateRelationships.d.ts +7 -0
  78. package/dist/db-content-api/utilities/data/validateRelationships.js +102 -0
  79. package/dist/db-content-api/utilities/joins.d.ts +53 -0
  80. package/dist/db-content-api/utilities/joins.js +139 -0
  81. package/dist/db-content-api/utilities/locale/index.d.ts +10 -0
  82. package/dist/db-content-api/utilities/locale/index.js +21 -0
  83. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +11 -0
  84. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +74 -0
  85. package/dist/db-content-api/utilities/meta/buildMeta.d.ts +42 -0
  86. package/dist/db-content-api/utilities/meta/buildMeta.js +41 -0
  87. package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +17 -0
  88. package/dist/db-content-api/utilities/meta/buildPathTypes.js +244 -0
  89. package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +13 -0
  90. package/dist/db-content-api/utilities/meta/buildUniquePaths.js +62 -0
  91. package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +10 -0
  92. package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +102 -0
  93. package/dist/db-content-api/utilities/where.d.ts +20 -0
  94. package/dist/db-content-api/utilities/where.js +108 -0
  95. package/dist/deploy/schedule-extract-plugin.d.ts +11 -0
  96. package/dist/deploy/schedule-extract-plugin.js +34 -0
  97. package/dist/endpoints/health.d.ts +3 -0
  98. package/dist/endpoints/health.js +11 -0
  99. package/dist/endpoints/schema.d.ts +3 -0
  100. package/dist/endpoints/schema.js +29 -0
  101. package/dist/exports/client.d.ts +3 -0
  102. package/dist/exports/client.js +3 -0
  103. package/dist/index.d.ts +2 -1
  104. package/dist/index.js +3 -1
  105. package/dist/lib/download-skill.d.ts +13 -0
  106. package/dist/lib/download-skill.js +79 -0
  107. package/dist/oauth/components/FigmaAvatar/index.d.ts +4 -0
  108. package/dist/oauth/components/FigmaAvatar/index.js +27 -0
  109. package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
  110. package/dist/oauth/components/FigmaAvatarCell/index.d.ts +5 -0
  111. package/dist/oauth/components/FigmaAvatarCell/index.js +25 -0
  112. package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
  113. package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +9 -0
  114. package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +37 -0
  115. package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
  116. package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +82 -0
  117. package/dist/oauth/components/LoginButton/iframeAutoLogin.js +170 -0
  118. package/dist/oauth/components/LoginButton/index.js +144 -11
  119. package/dist/oauth/components/LoginButton/index.scss +75 -3
  120. package/dist/oauth/components/LogoutButton/index.js +19 -6
  121. package/dist/oauth/defaults.d.ts +3 -1
  122. package/dist/oauth/defaults.js +68 -10
  123. package/dist/oauth/endpoints/getLoginEndpoint.js +72 -77
  124. package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -4
  125. package/dist/oauth/endpoints/getMetaEndpoint.js +18 -3
  126. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -2
  127. package/dist/oauth/index.js +27 -5
  128. package/dist/oauth/strategy/index.d.ts +0 -2
  129. package/dist/oauth/strategy/index.js +40 -17
  130. package/dist/oauth/types.d.ts +23 -6
  131. package/dist/oauth/utilities/establishSession.d.ts +23 -0
  132. package/dist/oauth/utilities/establishSession.js +82 -0
  133. package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +24 -0
  134. package/dist/oauth/utilities/exchangeCodeForAccessToken.js +28 -0
  135. package/dist/oauth/utilities/figmaHostnames.d.ts +3 -0
  136. package/dist/oauth/utilities/figmaHostnames.js +26 -0
  137. package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -1
  138. package/dist/oauth/utilities/getAuthorizeURL.js +57 -2
  139. package/dist/oauth/utilities/isAbsoluteURL.d.ts +2 -0
  140. package/dist/oauth/utilities/isAbsoluteURL.js +3 -0
  141. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +7 -0
  142. package/dist/oauth/utilities/isDuplicateKeyError.js +14 -0
  143. package/dist/oauth/utilities/refreshTokens.js +6 -3
  144. package/dist/plugin/auth-preflight.d.ts +8 -0
  145. package/dist/plugin/auth-preflight.js +20 -0
  146. package/dist/plugin/bootstrap-preflight.d.ts +23 -0
  147. package/dist/plugin/bootstrap-preflight.js +45 -0
  148. package/dist/plugin/build-config.d.ts +27 -15
  149. package/dist/plugin/build-config.js +327 -17
  150. package/dist/plugin/dev-cookie-names.d.ts +14 -0
  151. package/dist/plugin/dev-cookie-names.js +19 -0
  152. package/dist/storage-content-api/api-types.d.ts +168 -0
  153. package/dist/storage-content-api/api-types.js +6 -0
  154. package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +9 -0
  155. package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +43 -0
  156. package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +13 -0
  157. package/dist/storage-content-api/client-uploads/generateSignedURL.js +39 -0
  158. package/dist/storage-content-api/client.d.ts +6 -0
  159. package/dist/storage-content-api/client.js +39 -0
  160. package/dist/storage-content-api/generateURL.d.ts +7 -0
  161. package/dist/storage-content-api/generateURL.js +8 -0
  162. package/dist/storage-content-api/handleDelete.d.ts +8 -0
  163. package/dist/storage-content-api/handleDelete.js +17 -0
  164. package/dist/storage-content-api/handleUpload.d.ts +11 -0
  165. package/dist/storage-content-api/handleUpload.js +144 -0
  166. package/dist/storage-content-api/index.d.ts +5 -0
  167. package/dist/storage-content-api/index.js +31 -0
  168. package/dist/storage-content-api/staticHandler.d.ts +10 -0
  169. package/dist/storage-content-api/staticHandler.js +63 -0
  170. package/dist/storage-content-api/types.d.ts +10 -0
  171. package/dist/storage-content-api/types.js +3 -0
  172. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +12 -0
  173. package/dist/storage-content-api/utilities/getSafeFilename.js +61 -0
  174. package/dist/storage-content-api/utilities/index.d.ts +3 -0
  175. package/dist/storage-content-api/utilities/index.js +4 -0
  176. package/dist/storage-content-api/utilities/parseClientUploadContext.d.ts +19 -0
  177. package/dist/storage-content-api/utilities/parseClientUploadContext.js +30 -0
  178. package/dist/templates/.env.example +5 -0
  179. package/dist/templates/README.md +19 -0
  180. package/dist/types/config.d.ts +2 -1
  181. package/dist/types/config.js +0 -2
  182. package/dist/types.d.ts +10 -1
  183. package/dist/utils/adapters/nextjs.d.ts +9 -0
  184. package/dist/utils/adapters/nextjs.js +64 -0
  185. package/dist/utils/adapters/nitro.d.ts +9 -0
  186. package/dist/utils/adapters/nitro.js +169 -0
  187. package/dist/utils/adapters/vite.d.ts +10 -0
  188. package/dist/utils/adapters/vite.js +33 -0
  189. package/dist/utils/asset-collection.d.ts +27 -6
  190. package/dist/utils/asset-collection.js +59 -30
  191. package/dist/utils/build-detection.d.ts +5 -11
  192. package/dist/utils/build-detection.js +74 -11
  193. package/dist/utils/build-lambda-zip.d.ts +16 -0
  194. package/dist/utils/build-lambda-zip.js +78 -0
  195. package/dist/utils/cache-bootstrap.d.ts +8 -0
  196. package/dist/utils/cache-bootstrap.js +18 -0
  197. package/dist/utils/config.js +1 -1
  198. package/dist/utils/deploy-adapter.d.ts +40 -0
  199. package/dist/utils/deploy-adapter.js +58 -0
  200. package/dist/utils/download-template.d.ts +9 -1
  201. package/dist/utils/download-template.js +24 -18
  202. package/dist/utils/env-management.d.ts +24 -7
  203. package/dist/utils/env-management.js +119 -64
  204. package/dist/utils/format-env-suffix.d.ts +12 -0
  205. package/dist/utils/format-env-suffix.js +13 -0
  206. package/dist/utils/formatter.js +23 -11
  207. package/dist/utils/fs-utils.d.ts +6 -0
  208. package/dist/utils/fs-utils.js +27 -0
  209. package/dist/utils/handle-upgrade.d.ts +9 -0
  210. package/dist/utils/handle-upgrade.js +41 -0
  211. package/dist/utils/lambda-config.d.ts +3 -1
  212. package/dist/utils/lambda-config.js +75 -78
  213. package/dist/utils/messages.d.ts +1 -2
  214. package/dist/utils/messages.js +39 -11
  215. package/dist/utils/package-manager.d.ts +24 -0
  216. package/dist/utils/package-manager.js +53 -0
  217. package/dist/utils/parse-template-spec.d.ts +12 -0
  218. package/dist/utils/parse-template-spec.js +62 -0
  219. package/dist/utils/payload-config-ast.d.ts +27 -6
  220. package/dist/utils/payload-config-ast.js +106 -58
  221. package/dist/utils/payload-config-finder.d.ts +2 -2
  222. package/dist/utils/payload-config-finder.js +48 -9
  223. package/dist/utils/payload-config-modifier.d.ts +1 -1
  224. package/dist/utils/payload-config-modifier.js +114 -66
  225. package/dist/utils/payload-package-check.d.ts +33 -2
  226. package/dist/utils/payload-package-check.js +129 -28
  227. package/dist/utils/project.d.ts +7 -2
  228. package/dist/utils/project.js +60 -32
  229. package/dist/utils/resolve-environment.d.ts +14 -0
  230. package/dist/utils/resolve-environment.js +31 -0
  231. package/dist/utils/s3-upload.d.ts +7 -2
  232. package/dist/utils/s3-upload.js +39 -6
  233. package/dist/utils/token-display.d.ts +5 -1
  234. package/dist/utils/token-display.js +49 -22
  235. package/dist/utils/typescript-validator.js +4 -6
  236. package/dist/utils/version-check.d.ts +3 -0
  237. package/dist/utils/version-check.js +38 -0
  238. package/package.json +44 -15
  239. package/dist/api/control-plane.d.ts.map +0 -1
  240. package/dist/api/control-plane.js.map +0 -1
  241. package/dist/api/figma-api.d.ts.map +0 -1
  242. package/dist/api/figma-api.js.map +0 -1
  243. package/dist/auth/browser.d.ts.map +0 -1
  244. package/dist/auth/browser.js.map +0 -1
  245. package/dist/auth/callback-server.d.ts.map +0 -1
  246. package/dist/auth/callback-server.js.map +0 -1
  247. package/dist/auth/crypto-utils.d.ts.map +0 -1
  248. package/dist/auth/crypto-utils.js.map +0 -1
  249. package/dist/auth/jwt-validator.d.ts.map +0 -1
  250. package/dist/auth/jwt-validator.js.map +0 -1
  251. package/dist/auth/oauth-flow.d.ts.map +0 -1
  252. package/dist/auth/oauth-flow.js.map +0 -1
  253. package/dist/auth/pkce.d.ts.map +0 -1
  254. package/dist/auth/pkce.js.map +0 -1
  255. package/dist/auth/project-token.d.ts.map +0 -1
  256. package/dist/auth/project-token.js.map +0 -1
  257. package/dist/auth/refresh.d.ts.map +0 -1
  258. package/dist/auth/refresh.js.map +0 -1
  259. package/dist/auth/token-store.d.ts.map +0 -1
  260. package/dist/auth/token-store.js.map +0 -1
  261. package/dist/auth/types.d.ts.map +0 -1
  262. package/dist/auth/types.js.map +0 -1
  263. package/dist/cli.d.ts.map +0 -1
  264. package/dist/cli.js.map +0 -1
  265. package/dist/commands/deploy.d.ts.map +0 -1
  266. package/dist/commands/deploy.js.map +0 -1
  267. package/dist/commands/init.d.ts.map +0 -1
  268. package/dist/commands/init.js.map +0 -1
  269. package/dist/commands/list-tokens.d.ts.map +0 -1
  270. package/dist/commands/list-tokens.js.map +0 -1
  271. package/dist/commands/login.d.ts.map +0 -1
  272. package/dist/commands/login.js.map +0 -1
  273. package/dist/commands/logout.d.ts.map +0 -1
  274. package/dist/commands/logout.js.map +0 -1
  275. package/dist/config/oauth.d.ts.map +0 -1
  276. package/dist/config/oauth.js.map +0 -1
  277. package/dist/constants.d.ts.map +0 -1
  278. package/dist/constants.js.map +0 -1
  279. package/dist/exports/client.d.ts.map +0 -1
  280. package/dist/exports/client.js.map +0 -1
  281. package/dist/index.d.ts.map +0 -1
  282. package/dist/index.js.map +0 -1
  283. package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
  284. package/dist/oauth/components/LoginButton/index.js.map +0 -1
  285. package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
  286. package/dist/oauth/components/LogoutButton/index.js.map +0 -1
  287. package/dist/oauth/defaults.d.ts.map +0 -1
  288. package/dist/oauth/defaults.js.map +0 -1
  289. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
  290. package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
  291. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
  292. package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
  293. package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
  294. package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
  295. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
  296. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
  297. package/dist/oauth/exports/client.d.ts.map +0 -1
  298. package/dist/oauth/exports/client.js.map +0 -1
  299. package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
  300. package/dist/oauth/hooks/afterLogout.js.map +0 -1
  301. package/dist/oauth/hooks/me.d.ts.map +0 -1
  302. package/dist/oauth/hooks/me.js.map +0 -1
  303. package/dist/oauth/hooks/refresh.d.ts.map +0 -1
  304. package/dist/oauth/hooks/refresh.js.map +0 -1
  305. package/dist/oauth/index.d.ts.map +0 -1
  306. package/dist/oauth/index.js.map +0 -1
  307. package/dist/oauth/strategy/index.d.ts.map +0 -1
  308. package/dist/oauth/strategy/index.js.map +0 -1
  309. package/dist/oauth/types.d.ts.map +0 -1
  310. package/dist/oauth/types.js.map +0 -1
  311. package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
  312. package/dist/oauth/utilities/clearCookie.js.map +0 -1
  313. package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
  314. package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
  315. package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
  316. package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
  317. package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
  318. package/dist/oauth/utilities/extractOrigin.js.map +0 -1
  319. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
  320. package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
  321. package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
  322. package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
  323. package/dist/oauth/utilities/getAdminPath.js +0 -9
  324. package/dist/oauth/utilities/getAdminPath.js.map +0 -1
  325. package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
  326. package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
  327. package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
  328. package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
  329. package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
  330. package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
  331. package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
  332. package/dist/oauth/utilities/getTokenExp.js.map +0 -1
  333. package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
  334. package/dist/oauth/utilities/getUsernameField.js.map +0 -1
  335. package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
  336. package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
  337. package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
  338. package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
  339. package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
  340. package/dist/oauth/utilities/refreshTokens.js.map +0 -1
  341. package/dist/plugin/adapter.d.ts.map +0 -1
  342. package/dist/plugin/adapter.js.map +0 -1
  343. package/dist/plugin/build-config.d.ts.map +0 -1
  344. package/dist/plugin/build-config.js.map +0 -1
  345. package/dist/types/config.d.ts.map +0 -1
  346. package/dist/types/config.js.map +0 -1
  347. package/dist/types.d.ts.map +0 -1
  348. package/dist/types.js.map +0 -1
  349. package/dist/utils/asset-collection.d.ts.map +0 -1
  350. package/dist/utils/asset-collection.js.map +0 -1
  351. package/dist/utils/build-detection.d.ts.map +0 -1
  352. package/dist/utils/build-detection.js.map +0 -1
  353. package/dist/utils/config.d.ts.map +0 -1
  354. package/dist/utils/config.js.map +0 -1
  355. package/dist/utils/download-template.d.ts.map +0 -1
  356. package/dist/utils/download-template.js.map +0 -1
  357. package/dist/utils/env-management.d.ts.map +0 -1
  358. package/dist/utils/env-management.js.map +0 -1
  359. package/dist/utils/format.d.ts.map +0 -1
  360. package/dist/utils/format.js.map +0 -1
  361. package/dist/utils/formatter.d.ts.map +0 -1
  362. package/dist/utils/formatter.js.map +0 -1
  363. package/dist/utils/git.d.ts.map +0 -1
  364. package/dist/utils/git.js.map +0 -1
  365. package/dist/utils/is-debug.d.ts.map +0 -1
  366. package/dist/utils/is-debug.js.map +0 -1
  367. package/dist/utils/lambda-config.d.ts.map +0 -1
  368. package/dist/utils/lambda-config.js.map +0 -1
  369. package/dist/utils/log.d.ts.map +0 -1
  370. package/dist/utils/log.js.map +0 -1
  371. package/dist/utils/messages.d.ts.map +0 -1
  372. package/dist/utils/messages.js.map +0 -1
  373. package/dist/utils/package-manager.d.ts.map +0 -1
  374. package/dist/utils/package-manager.js.map +0 -1
  375. package/dist/utils/payload-config-ast.d.ts.map +0 -1
  376. package/dist/utils/payload-config-ast.js.map +0 -1
  377. package/dist/utils/payload-config-finder.d.ts.map +0 -1
  378. package/dist/utils/payload-config-finder.js.map +0 -1
  379. package/dist/utils/payload-config-modifier.d.ts.map +0 -1
  380. package/dist/utils/payload-config-modifier.js.map +0 -1
  381. package/dist/utils/payload-package-check.d.ts.map +0 -1
  382. package/dist/utils/payload-package-check.js.map +0 -1
  383. package/dist/utils/project.d.ts.map +0 -1
  384. package/dist/utils/project.js.map +0 -1
  385. package/dist/utils/s3-upload.d.ts.map +0 -1
  386. package/dist/utils/s3-upload.js.map +0 -1
  387. package/dist/utils/token-display.d.ts.map +0 -1
  388. package/dist/utils/token-display.js.map +0 -1
  389. package/dist/utils/typescript-validator.d.ts.map +0 -1
  390. package/dist/utils/typescript-validator.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { execSync } from 'child_process';
2
+ import fs from 'fs/promises';
3
+ import path from 'path';
4
+ /**
5
+ * Walk up from a directory to find the nearest package.json with name "@payloadcms/figma".
6
+ */ export async function findPackageRoot(startDir) {
7
+ let dir = startDir;
8
+ while(true){
9
+ const pkgPath = path.join(dir, 'package.json');
10
+ try {
11
+ const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'));
12
+ if (pkg.name === '@payloadcms/figma') {
13
+ return dir;
14
+ }
15
+ } catch {
16
+ // No package.json here
17
+ }
18
+ const parent = path.dirname(dir);
19
+ if (parent === dir) {
20
+ return null;
21
+ }
22
+ dir = parent;
23
+ }
24
+ }
25
+ /**
26
+ * Build and pack the local @payloadcms/figma package, returning the tgz path.
27
+ */ export function packLocalPackage(pkgDir) {
28
+ execSync('pnpm build', {
29
+ cwd: pkgDir,
30
+ stdio: 'pipe'
31
+ });
32
+ const tgzOutput = execSync('pnpm pack', {
33
+ cwd: pkgDir,
34
+ stdio: 'pipe'
35
+ }).toString().trim();
36
+ const tgzName = tgzOutput.split('\n').pop();
37
+ const tgzPath = path.join(pkgDir, tgzName);
38
+ return tgzPath;
39
+ }
40
+
41
+ //# sourceMappingURL=handle-upgrade.js.map
@@ -1,7 +1,9 @@
1
+ import type { PackageManager } from './package-manager.js';
1
2
  /**
2
3
  * Apply Lambda-specific modifications to a Payload project
3
4
  *
4
5
  * @param projectPath - Path to project directory
6
+ * @param packageManager - Package manager to use in scripts (defaults to 'npm')
5
7
  */
6
- export declare function applyLambdaModifications(projectPath: string): Promise<void>;
8
+ export declare function applyLambdaModifications(projectPath: string, packageManager?: PackageManager): Promise<void>;
7
9
  //# sourceMappingURL=lambda-config.d.ts.map
@@ -1,36 +1,25 @@
1
- import { parseModule, Syntax } from 'esprima-next';
2
1
  import fs from 'fs/promises';
3
2
  import path from 'path';
3
+ import { IndentationText, Node, Project, SyntaxKind } from 'ts-morph';
4
4
  const RUN_SH_CONTENT = `#!/bin/bash -x
5
5
 
6
6
  [ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache
7
7
 
8
8
  NODE_ENV=production exec node server.js
9
9
  `;
10
- const BUILD_FOR_LAMBDA_SH_CONTENT = `#!/bin/bash
11
-
12
- cp -r .next/static .next/standalone/.next/static
13
- cp run.sh .next/standalone/run.sh
14
- cd .next/standalone
15
- zip -r --symlinks lambda.zip .
16
- mv lambda.zip ../..
17
- `;
18
10
  /**
19
11
  * Apply Lambda-specific modifications to a Payload project
20
12
  *
21
13
  * @param projectPath - Path to project directory
22
- */ export async function applyLambdaModifications(projectPath) {
14
+ * @param packageManager - Package manager to use in scripts (defaults to 'npm')
15
+ */ export async function applyLambdaModifications(projectPath, packageManager = 'npm') {
23
16
  // 1. Create run.sh
24
17
  const runShPath = path.join(projectPath, 'run.sh');
25
18
  await fs.writeFile(runShPath, RUN_SH_CONTENT, 'utf-8');
26
- await fs.chmod(runShPath, 0o755); // rwxr-xr-x
27
- // 2. Create build_for_lambda.sh
28
- const buildShPath = path.join(projectPath, 'build_for_lambda.sh');
29
- await fs.writeFile(buildShPath, BUILD_FOR_LAMBDA_SH_CONTENT, 'utf-8');
30
- await fs.chmod(buildShPath, 0o755);
31
- // 3. Modify next config to add standalone output
32
- await addStandaloneToNextConfig(projectPath);
33
- // 4. Create/update .npmrc
19
+ await fs.chmod(runShPath, 0o755);
20
+ // 2. Modify next config to add standalone output
21
+ await addNextConfigProperties(projectPath);
22
+ // 3. Create/update .npmrc
34
23
  const npmrcPath = path.join(projectPath, '.npmrc');
35
24
  let npmrcContent = '';
36
25
  try {
@@ -43,15 +32,15 @@ mv lambda.zip ../..
43
32
  npmrcContent += 'node-linker=hoisted\n';
44
33
  await fs.writeFile(npmrcPath, npmrcContent, 'utf-8');
45
34
  }
46
- // 5. Add lambda:buildzip script to package.json
47
- await addLambdaBuildScript(projectPath);
35
+ // 4. Add lambda:buildzip script to package.json
36
+ await addLambdaBuildScript(projectPath, packageManager);
48
37
  }
49
38
  /**
50
- * Find the Next.js config file (next.config.js or next.config.mjs)
51
- *
52
- * @todo Support TypeScript config files in future
39
+ * Find the Next.js config file, checking TS extensions first
53
40
  */ async function findNextConfigPath(projectPath) {
54
41
  const configFiles = [
42
+ 'next.config.ts',
43
+ 'next.config.mts',
55
44
  'next.config.js',
56
45
  'next.config.mjs'
57
46
  ];
@@ -64,80 +53,88 @@ mv lambda.zip ../..
64
53
  // File doesn't exist, try next one
65
54
  }
66
55
  }
67
- throw new Error('Could not find next.config.js or next.config.mjs');
56
+ throw new Error('Could not find next.config.ts, next.config.mts, next.config.js, or next.config.mjs');
68
57
  }
69
58
  /**
70
- * Add standalone output to Next.js config using AST parsing
71
- */ async function addStandaloneToNextConfig(projectPath) {
59
+ * Add required Next.js config properties using ts-morph AST parsing
60
+ * - output: 'standalone' (for Lambda deployment)
61
+ */ async function addNextConfigProperties(projectPath) {
72
62
  const nextConfigPath = await findNextConfigPath(projectPath);
73
- const content = await fs.readFile(nextConfigPath, 'utf-8');
74
- // Check if output already configured (quick check before parsing)
75
- if (content.includes('output:')) {
76
- return; // Already configured
63
+ const project = new Project({
64
+ compilerOptions: {
65
+ allowJs: true
66
+ },
67
+ manipulationSettings: {
68
+ indentationText: IndentationText.TwoSpaces
69
+ },
70
+ skipAddingFilesFromTsConfig: true
71
+ });
72
+ const sourceFile = project.addSourceFileAtPath(nextConfigPath);
73
+ // Find the config object to modify
74
+ const configObject = findConfigObject(sourceFile);
75
+ if (!configObject) {
76
+ throw new Error(`Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` + `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`);
77
+ }
78
+ const hasOutput = configObject.getProperty('output') !== undefined;
79
+ if (hasOutput) {
80
+ return;
77
81
  }
78
- const ast = parseModule(content, {
79
- loc: true
82
+ configObject.addPropertyAssignment({
83
+ name: 'output',
84
+ initializer: "'standalone'"
80
85
  });
81
- // Find export default declaration
82
- const exportDefaultDeclaration = ast.body.find((p)=>p.type === Syntax.ExportDefaultDeclaration);
83
- if (!exportDefaultDeclaration?.declaration?.loc) {
84
- throw new Error(`Could not find export default declaration in ${path.basename(nextConfigPath)}`);
86
+ await sourceFile.save();
87
+ }
88
+ /**
89
+ * Find the config object literal from either:
90
+ * - Direct export: `export default { ... }`
91
+ * - Wrapped export: `export default withPayload(configVar, ...)`
92
+ * where configVar is a variable declaration with an object literal
93
+ */ function findConfigObject(sourceFile) {
94
+ const exportDefault = sourceFile.getFirstDescendantByKind(SyntaxKind.ExportAssignment);
95
+ if (!exportDefault) {
96
+ return undefined;
85
97
  }
86
- // Find the object expression to modify
87
- let targetObjectExpression;
88
- if (exportDefaultDeclaration.declaration.type === 'ObjectExpression') {
89
- // Direct export: export default { ... }
90
- targetObjectExpression = exportDefaultDeclaration.declaration;
91
- } else if (exportDefaultDeclaration.declaration.type === 'CallExpression') {
92
- // Wrapped export: export default withPayload(nextConfig, ...)
93
- const callExpr = exportDefaultDeclaration.declaration;
94
- const firstArg = callExpr.arguments?.[0];
95
- if (firstArg?.type === 'Identifier') {
96
- // Find the variable declaration for this identifier
97
- const configVarName = firstArg.name;
98
- const varDeclaration = ast.body.find((node)=>{
99
- if (node.type === Syntax.VariableDeclaration) {
100
- const varNode = node;
101
- return varNode.declarations?.some((decl)=>decl.id?.type === 'Identifier' && decl.id.name === configVarName && decl.init?.type === 'ObjectExpression');
102
- }
103
- return false;
104
- });
105
- if (varDeclaration) {
106
- const declarator = varDeclaration.declarations?.find((decl)=>decl.id?.type === 'Identifier' && decl.id.name === configVarName);
107
- if (declarator?.init?.type === 'ObjectExpression') {
108
- targetObjectExpression = declarator.init;
98
+ const expression = exportDefault.getExpression();
99
+ // Direct export: export default { ... }
100
+ if (Node.isObjectLiteralExpression(expression)) {
101
+ return expression;
102
+ }
103
+ // Wrapped export: export default withPayload(configVar, ...)
104
+ if (Node.isCallExpression(expression)) {
105
+ const firstArg = expression.getArguments()[0];
106
+ // Variable reference: export default withPayload(configVar)
107
+ if (firstArg && Node.isIdentifier(firstArg)) {
108
+ const configVarName = firstArg.getText();
109
+ // Find the variable declaration
110
+ const varStatements = sourceFile.getVariableStatements();
111
+ for (const statement of varStatements){
112
+ for (const decl of statement.getDeclarations()){
113
+ if (decl.getName() === configVarName) {
114
+ const initializer = decl.getInitializer();
115
+ if (initializer && Node.isObjectLiteralExpression(initializer)) {
116
+ return initializer;
117
+ }
118
+ }
109
119
  }
110
120
  }
111
121
  }
112
122
  }
113
- if (!targetObjectExpression?.loc) {
114
- throw new Error(`Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` + `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`);
115
- }
116
- const { loc } = targetObjectExpression;
117
- const lines = content.split('\n');
118
- // Insert output: 'standalone' as first property
119
- const insertLine = loc.start.line - 1;
120
- const insertColumn = loc.start.column + 1 // After opening brace
121
- ;
122
- // Find the content of the line with the opening brace
123
- const targetLine = lines[insertLine];
124
- if (!targetLine) {
125
- throw new Error(`Could not find target line in ${path.basename(nextConfigPath)}`);
126
- }
127
- lines[insertLine] = targetLine.slice(0, insertColumn) + "\n output: 'standalone'," + targetLine.slice(insertColumn);
128
- const modifiedContent = lines.join('\n');
129
- await fs.writeFile(nextConfigPath, modifiedContent, 'utf-8');
123
+ return undefined;
130
124
  }
131
125
  /**
132
126
  * Add lambda:buildzip script to package.json
133
- */ async function addLambdaBuildScript(projectPath) {
127
+ */ async function addLambdaBuildScript(projectPath, packageManager) {
134
128
  const packageJsonPath = path.join(projectPath, 'package.json');
135
129
  const content = await fs.readFile(packageJsonPath, 'utf-8');
136
130
  const packageJson = JSON.parse(content);
137
131
  if (!packageJson.scripts) {
138
132
  packageJson.scripts = {};
139
133
  }
140
- packageJson.scripts['lambda:buildzip'] = 'npm run build && ./build_for_lambda.sh';
134
+ // Use package manager's run and exec commands
135
+ const runCmd = packageManager === 'npm' ? 'npm run' : packageManager;
136
+ const execCmd = packageManager === 'npm' ? 'npx' : `${packageManager} exec`;
137
+ packageJson.scripts['lambda:buildzip'] = `${runCmd} build && ${execCmd} payloadcms-figma build-lambda-zip`;
141
138
  await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
142
139
  }
143
140
 
@@ -1,4 +1,4 @@
1
- import type { PackageManager } from '../types.js';
1
+ import type { PackageManager } from './package-manager.js';
2
2
  export declare function helpMessage(): void;
3
3
  export declare function successMessage(projectDir: string, packageManager: PackageManager): string;
4
4
  export declare function successfulNextInit(): string;
@@ -6,5 +6,4 @@ export declare function moveMessage(args: {
6
6
  nextAppDir: string;
7
7
  projectDir: string;
8
8
  }): string;
9
- export declare function feedbackOutro(): string;
10
9
  //# sourceMappingURL=messages.d.ts.map
@@ -14,31 +14,62 @@ export function helpMessage() {
14
14
  ${pc.cyan('logout')} Clear all stored tokens
15
15
  ${pc.cyan('list-tokens')} Show stored token information
16
16
  ${pc.cyan('init')} Initialize a Figma CMS project
17
+ ${pc.cyan('bootstrap')} Print bootstrap info (tenant IDs, OAuth creds) for a project
18
+ ${pc.cyan('debug')} Show debug info for troubleshooting
19
+ ${pc.cyan('env')} Switch active environment
17
20
  ${pc.cyan('deploy')} Deploy your project to Figma
21
+ ${pc.cyan('upgrade')} Run upgrade migrations
22
+ ${pc.cyan('build-lambda-zip')} Build Lambda deployment zip
18
23
 
19
24
  ${pc.bold('OPTIONS')}
20
25
 
21
26
  ${pc.dim('-h, --help Show help')}
27
+ ${pc.dim('-v, --version Show CLI version')}
22
28
  ${pc.dim('--debug Enable debug logging')}
23
29
 
24
30
  ${pc.bold('AUTHENTICATION')}
25
31
 
26
32
  ${pc.cyan('@payloadcms/figma login')} Authenticate with Figma
27
- ${pc.cyan('@payloadcms/figma logout')} Clear all tokens (with confirmation)
33
+ ${pc.cyan('@payloadcms/figma logout')} Clear tokens for current environment
28
34
  ${pc.cyan('@payloadcms/figma list-tokens')} Display stored OAuth and project tokens
29
35
 
30
36
  ${pc.bold('INIT COMMAND')}
31
37
 
32
- ${pc.cyan('@payloadcms/figma init --id <cms-id>')} Initialize project with CMS ID
33
- ${pc.cyan('@payloadcms/figma init')} Initialize (prompts for CMS ID)
34
- ${pc.cyan('@payloadcms/figma init --name my-cms')} Specify project name for new projects
35
- ${pc.cyan('@payloadcms/figma init --force')} Force reconfiguration of existing project
36
- ${pc.cyan('@payloadcms/figma init --skip-auth')} Skip authentication (testing only)
38
+ ${pc.cyan('@payloadcms/figma init --id <cms-resource-id>')} Initialize project
39
+ ${pc.cyan('@payloadcms/figma init --id <id> --env staging')} Initialize for specific environment
40
+ ${pc.dim('--name, -n <name>')} Set project directory name (skips prompt)
41
+ ${pc.dim('--force')} Force reconfiguration of existing project
42
+ ${pc.dim('--no-skill')} Skip installing the Payload skill into .claude/skills/payload/
43
+ ${pc.dim('--template, -t <spec>')} Override scaffold template (e.g. v3.80.0:website, owner/repo#ref:path)
44
+ ${pc.dim('--payload-version <tag|version>')} Core Payload npm dist-tag or version (default latest; e.g. canary, 3.40.0)
45
+
46
+ ${pc.bold('BOOTSTRAP COMMAND')}
47
+
48
+ ${pc.cyan('@payloadcms/figma bootstrap --id <cms-resource-id>')} Print bootstrap info
49
+ ${pc.dim('--env <environment>')} Filter to a single environment
50
+ ${pc.dim('--json')} Output JSON instead of styled note
51
+
52
+ ${pc.bold('ENV COMMAND')}
53
+
54
+ ${pc.cyan('@payloadcms/figma env')} List and switch environments
55
+ ${pc.cyan('@payloadcms/figma env production')} Switch to a named environment
37
56
 
38
57
  ${pc.bold('DEPLOY COMMAND')}
39
58
 
40
- ${pc.cyan('@payloadcms/figma deploy')} Deploy your project to Figma
41
- ${pc.dim('--yes, -y')} Skip confirmation prompts
59
+ ${pc.cyan('@payloadcms/figma deploy')} Deploy your project to Figma
60
+ ${pc.dim('--id <project-id>')} Override FIGMA_PROJECT_ID
61
+ ${pc.dim('--env <environment>')} Override FIGMA_ENVIRONMENT_NAME
62
+ ${pc.dim('--yes, -y')} Skip confirmation prompts
63
+ ${pc.dim('--skip-build')} Skip building and use existing build
64
+
65
+ ${pc.bold('UPGRADE COMMAND')}
66
+
67
+ ${pc.cyan('@payloadcms/figma upgrade')} Run all upgrade migrations
68
+ ${pc.dim('--dry-run')} Preview changes without applying
69
+
70
+ ${pc.bold('GLOBAL OPTIONS')}
71
+
72
+ ${pc.dim('--infra-env <env>')} Target infrastructure (production, staging, or devbox)
42
73
 
43
74
  ${pc.bold('DOCUMENTATION')}
44
75
 
@@ -89,8 +120,5 @@ It is recommended to do this from your IDE if your app has existing file referen
89
120
  Once moved, rerun the @payloadcms/figma command again.
90
121
  `;
91
122
  }
92
- export function feedbackOutro() {
93
- return `${pc.bgCyan(pc.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`;
94
- }
95
123
 
96
124
  //# sourceMappingURL=messages.js.map
@@ -9,4 +9,28 @@ export type PackageManager = 'npm' | 'pnpm' | 'yarn';
9
9
  * @returns Detected package manager, defaults to npm
10
10
  */
11
11
  export declare function getPackageManager(projectDir: string): Promise<PackageManager>;
12
+ /**
13
+ * Resolve package manager for a project directory.
14
+ * Checks lockfiles first, falls back to environment detection.
15
+ *
16
+ * @param projectDir - Project directory to check
17
+ * @returns Resolved package manager
18
+ */
19
+ export declare function resolvePackageManager(projectDir: string): Promise<PackageManager>;
20
+ /**
21
+ * Detect package manager from npm_config_user_agent environment variable.
22
+ * Set automatically by npm/pnpm/yarn when running via npx/pnpm dlx/yarn dlx.
23
+ *
24
+ * @returns Detected package manager, defaults to npm
25
+ */
26
+ export declare function detectPackageManagerFromEnvironment(): PackageManager;
27
+ /**
28
+ * Get the run command prefix for a package manager.
29
+ * npm needs "npm run", pnpm/yarn can run scripts directly.
30
+ */
31
+ export declare function getRunCommand(packageManager: PackageManager): string;
32
+ /**
33
+ * Get the add/install command for a package manager.
34
+ */
35
+ export declare function getAddCommand(packageManager: PackageManager): string;
12
36
  //# sourceMappingURL=package-manager.d.ts.map
@@ -23,6 +23,59 @@ import path from 'path';
23
23
  return 'npm';
24
24
  }
25
25
  }
26
+ /**
27
+ * Resolve package manager for a project directory.
28
+ * Checks lockfiles first, falls back to environment detection.
29
+ *
30
+ * @param projectDir - Project directory to check
31
+ * @returns Resolved package manager
32
+ */ export async function resolvePackageManager(projectDir) {
33
+ const fromLockfile = await getPackageManager(projectDir);
34
+ if (fromLockfile !== 'npm') {
35
+ return fromLockfile;
36
+ }
37
+ // Check if there's actually a package-lock.json (explicit npm choice)
38
+ if (await fileExists(path.join(projectDir, 'package-lock.json'))) {
39
+ return 'npm';
40
+ }
41
+ // No lockfile found — check environment
42
+ return detectPackageManagerFromEnvironment();
43
+ }
44
+ /**
45
+ * Detect package manager from npm_config_user_agent environment variable.
46
+ * Set automatically by npm/pnpm/yarn when running via npx/pnpm dlx/yarn dlx.
47
+ *
48
+ * @returns Detected package manager, defaults to npm
49
+ */ export function detectPackageManagerFromEnvironment() {
50
+ const userAgent = process.env.npm_config_user_agent;
51
+ if (!userAgent) {
52
+ return 'npm';
53
+ }
54
+ if (userAgent.startsWith('pnpm/')) {
55
+ return 'pnpm';
56
+ }
57
+ if (userAgent.startsWith('yarn/')) {
58
+ return 'yarn';
59
+ }
60
+ return 'npm';
61
+ }
62
+ /**
63
+ * Get the run command prefix for a package manager.
64
+ * npm needs "npm run", pnpm/yarn can run scripts directly.
65
+ */ export function getRunCommand(packageManager) {
66
+ return packageManager === 'npm' ? 'npm run' : packageManager;
67
+ }
68
+ /**
69
+ * Get the add/install command for a package manager.
70
+ */ export function getAddCommand(packageManager) {
71
+ if (packageManager === 'npm') {
72
+ return 'npm install';
73
+ }
74
+ if (packageManager === 'pnpm') {
75
+ return 'pnpm add';
76
+ }
77
+ return 'yarn add';
78
+ }
26
79
  /**
27
80
  * Check if file exists
28
81
  */ async function fileExists(filePath) {
@@ -0,0 +1,12 @@
1
+ import type { TemplateSource } from './download-template.js';
2
+ export declare class TemplateSpecParseError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /**
6
+ * Parse a --template spec string into a partial TemplateSource override.
7
+ *
8
+ * Format: [<owner>/<repo>#]<ref>:<template-path>
9
+ * Shorthand: a bare token with no `#` and no `:` is treated as the template path.
10
+ */
11
+ export declare function parseTemplateSpec(spec: string): Partial<TemplateSource>;
12
+ //# sourceMappingURL=parse-template-spec.d.ts.map
@@ -0,0 +1,62 @@
1
+ export class TemplateSpecParseError extends Error {
2
+ constructor(message){
3
+ super(message);
4
+ this.name = 'TemplateSpecParseError';
5
+ }
6
+ }
7
+ /**
8
+ * Parse a --template spec string into a partial TemplateSource override.
9
+ *
10
+ * Format: [<owner>/<repo>#]<ref>:<template-path>
11
+ * Shorthand: a bare token with no `#` and no `:` is treated as the template path.
12
+ */ export function parseTemplateSpec(spec) {
13
+ const trimmed = spec.trim();
14
+ if (!trimmed) {
15
+ throw new TemplateSpecParseError('Template spec is empty');
16
+ }
17
+ let rest = trimmed;
18
+ const result = {};
19
+ const hashIndex = rest.indexOf('#');
20
+ if (hashIndex !== -1) {
21
+ const repoPart = rest.slice(0, hashIndex);
22
+ rest = rest.slice(hashIndex + 1);
23
+ const slashCount = (repoPart.match(/\//g) ?? []).length;
24
+ if (slashCount !== 1) {
25
+ throw new TemplateSpecParseError(`Expected "<owner>/<repo>" before "#", got "${repoPart}"`);
26
+ }
27
+ const [owner, repo] = repoPart.split('/');
28
+ if (!owner || !repo) {
29
+ throw new TemplateSpecParseError(`Invalid owner/repo: "${repoPart}"`);
30
+ }
31
+ result.owner = owner;
32
+ result.repo = repo;
33
+ } else {
34
+ // Check for slash only in the portion before the first colon (the ref part).
35
+ // Slashes after the colon are valid multi-segment template paths.
36
+ const beforeColon = rest.includes(':') ? rest.slice(0, rest.indexOf(':')) : rest;
37
+ if (beforeColon.includes('/')) {
38
+ throw new TemplateSpecParseError(`"<owner>/<repo>" must be followed by "#<ref>" (got "${trimmed}")`);
39
+ }
40
+ }
41
+ const colonIndex = rest.indexOf(':');
42
+ if (colonIndex !== -1) {
43
+ const ref = rest.slice(0, colonIndex);
44
+ const templatePath = rest.slice(colonIndex + 1);
45
+ if (!ref) {
46
+ throw new TemplateSpecParseError('Ref before ":" is empty');
47
+ }
48
+ if (!templatePath) {
49
+ throw new TemplateSpecParseError('Template path after ":" is empty');
50
+ }
51
+ result.ref = ref;
52
+ result.templatePath = templatePath;
53
+ return result;
54
+ }
55
+ if (hashIndex !== -1) {
56
+ throw new TemplateSpecParseError('Spec with "<owner>/<repo>#<ref>" must include ":<template-path>"');
57
+ }
58
+ result.templatePath = rest;
59
+ return result;
60
+ }
61
+
62
+ //# sourceMappingURL=parse-template-spec.js.map
@@ -1,19 +1,39 @@
1
1
  import type { SourceFile } from 'ts-morph';
2
+ /**
3
+ * Result of detecting what changes are needed in a payload config file
4
+ */
2
5
  export type DetectionResult = {
6
+ /** Database adapter configuration if present */
3
7
  dbProperty?: {
8
+ /** Name of the adapter function (e.g., 'mongooseAdapter', 'postgresAdapter') */
4
9
  adapter: string;
10
+ /** NPM package the adapter is imported from (e.g., '@payloadcms/db-mongodb') */
5
11
  importSource: string;
6
12
  };
13
+ /** Editor configuration if present */
7
14
  editorProperty?: {
15
+ /** NPM package the editor is imported from (e.g., '@payloadcms/richtext-lexical') */
8
16
  importSource: string;
17
+ /** Whether this is a default editor with no custom configuration */
9
18
  isDefault: boolean;
10
19
  };
20
+ /** Whether the config already has a `figma` property */
11
21
  figmaObjectExists: boolean;
22
+ /** Whether buildConfig/buildFigmaConfig uses an import alias (e.g., 'buildConfig as createConfig') */
12
23
  hasAlias: boolean;
24
+ /** Whether a buildConfig or buildFigmaConfig call was found (undefined if not checked) */
13
25
  hasBuildConfig?: boolean;
26
+ /** Whether there are other imports from 'payload' besides buildConfig (e.g., types) */
14
27
  hasOtherPayloadImports: boolean;
28
+ /** Whether the import needs to be changed from 'payload' to '@payloadcms/figma' */
15
29
  needsImportChange: boolean;
30
+ /** Whether a `secret` property exists in the config */
16
31
  secretProperty?: boolean;
32
+ /** Sharp configuration if present */
33
+ sharpProperty?: {
34
+ /** NPM package sharp is imported from (always 'sharp') */
35
+ importSource: string;
36
+ };
17
37
  };
18
38
  /**
19
39
  * Detect what changes are needed in the payload config file
@@ -29,9 +49,8 @@ export type ASTModificationResult = {
29
49
  */
30
50
  export declare function applyModifications(sourceFile: SourceFile, detection: DetectionResult): ASTModificationResult;
31
51
  export type FigmaPropertyConfig = {
32
- region: string;
33
- tenantId: string;
34
- useContentSystem: boolean;
52
+ contentSystemId: string;
53
+ useContentSystem?: boolean;
35
54
  };
36
55
  /**
37
56
  * Add figma property to buildConfig if it doesn't exist
@@ -39,8 +58,10 @@ export type FigmaPropertyConfig = {
39
58
  */
40
59
  export declare function addFigmaProperty(sourceFile: SourceFile, config: FigmaPropertyConfig): ASTModificationResult;
41
60
  /**
42
- * Read figma configuration from payload.config.ts
43
- * Returns the figma object if it exists, null otherwise
61
+ * Remove the contentSystemId property from figma config object.
62
+ * Used during upgrade migration contentSystemId is now resolved from bootstrap data.
63
+ *
64
+ * @returns true if the property was found and removed
44
65
  */
45
- export declare function readFigmaConfig(sourceFile: SourceFile): FigmaPropertyConfig | null;
66
+ export declare function removeFigmaContentSystemId(sourceFile: SourceFile): boolean;
46
67
  //# sourceMappingURL=payload-config-ast.d.ts.map