@payloadcms/figma 0.0.1-alpha.9 → 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 +380 -16
  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,6 +1,4 @@
1
1
  /**
2
2
  * Raw project token response from Figma API
3
- * Response from GET https://api.figma.com/v1/cms/:id/token/
3
+ * Response from POST https://api.figma.com/v1/cms/content-systems/:id/token/
4
4
  */ export { };
5
-
6
- //# sourceMappingURL=types.js.map
package/dist/cli.d.ts CHANGED
@@ -2,4 +2,3 @@
2
2
  * Entrypoint for bin/cli.js
3
3
  */
4
4
  export declare function main(): Promise<void>;
5
- //# sourceMappingURL=cli.d.ts.map
package/dist/cli.js CHANGED
@@ -1,12 +1,20 @@
1
1
  import * as p from '@clack/prompts';
2
2
  import arg from 'arg';
3
3
  import pc from 'picocolors';
4
+ import { bootstrapCommand } from './commands/bootstrap.js';
5
+ import { buildLambdaZipCommand } from './commands/build-lambda-zip.js';
6
+ import { debugCommand } from './commands/debug.js';
4
7
  import { deployCommand } from './commands/deploy.js';
8
+ import { dumpTokensCommand } from './commands/dump-tokens.js';
9
+ import { envCommand } from './commands/env.js';
5
10
  import { initCommand } from './commands/init.js';
6
11
  import { listTokensCommand } from './commands/list-tokens.js';
7
12
  import { loginCommand } from './commands/login.js';
8
13
  import { logoutCommand } from './commands/logout.js';
9
- import { feedbackOutro, helpMessage } from './utils/messages.js';
14
+ import { upgradeCommand } from './commands/upgrade.js';
15
+ import { uploadSchemaCommand } from './commands/upload-schema.js';
16
+ import { setInfraEnvironment } from './constants.js';
17
+ import { helpMessage } from './utils/messages.js';
10
18
  /**
11
19
  * Entrypoint for bin/cli.js
12
20
  */ export async function main() {
@@ -24,16 +32,36 @@ class Main {
24
32
  constructor(){
25
33
  // @ts-expect-error bad typings
26
34
  this.args = arg({
35
+ // Hidden flag — intentionally not displayed in help output yet.
36
+ // Auto-detection covers most cases; this is an escape hatch for testing.
37
+ // May expose in help text once multi-framework support is public.
38
+ '--adapter': String,
39
+ '--all': Boolean,
27
40
  '--debug': Boolean,
41
+ '--dry-run': Boolean,
42
+ '--env': String,
28
43
  '--force': Boolean,
29
44
  '--help': Boolean,
30
45
  '--id': String,
46
+ '--infra-env': String,
47
+ '--json': Boolean,
31
48
  '--name': String,
49
+ '--no-skill': Boolean,
50
+ '--payload-version': String,
32
51
  '--skip-auth': Boolean,
52
+ '--skip-build': Boolean,
53
+ '--skip-size-check': Boolean,
54
+ '--template': String,
55
+ '--version': Boolean,
33
56
  '--yes': Boolean,
34
57
  // Aliases
58
+ '--environment': '--env',
59
+ '-e': '--env',
35
60
  '-f': '--force',
36
61
  '-h': '--help',
62
+ '-n': '--name',
63
+ '-t': '--template',
64
+ '-v': '--version',
37
65
  '-y': '--yes'
38
66
  }, {
39
67
  permissive: true
@@ -42,6 +70,21 @@ class Main {
42
70
  if (this.args['--debug']) {
43
71
  process.env.DEBUG = 'true';
44
72
  }
73
+ // Handle --infra-env flag for infrastructure environment switching
74
+ if (this.args['--infra-env']) {
75
+ const infraEnvArg = this.args['--infra-env'].toLowerCase();
76
+ if (infraEnvArg === 'prod' || infraEnvArg === 'production') {
77
+ setInfraEnvironment('production');
78
+ } else if (infraEnvArg === 'staging') {
79
+ setInfraEnvironment('staging');
80
+ } else if (infraEnvArg === 'devbox') {
81
+ setInfraEnvironment('devbox');
82
+ } else {
83
+ // eslint-disable-next-line no-console
84
+ console.error(`Invalid --infra-env value: ${this.args['--infra-env']}. Use 'production', 'staging', or 'devbox'.`);
85
+ process.exit(1);
86
+ }
87
+ }
45
88
  }
46
89
  async init() {
47
90
  try {
@@ -49,30 +92,76 @@ class Main {
49
92
  helpMessage();
50
93
  process.exit(0);
51
94
  }
95
+ if (this.args['--version']) {
96
+ const { getOwnVersion } = await import('./utils/version-check.js');
97
+ const version = await getOwnVersion();
98
+ // eslint-disable-next-line no-console
99
+ console.log(version);
100
+ process.exit(0);
101
+ }
52
102
  // Get the subcommand (first non-flag argument)
53
103
  const subcommand = this.args._[0];
104
+ if (!subcommand) {
105
+ helpMessage();
106
+ process.exit(0);
107
+ }
108
+ // Debug command outputs plain text for copy-paste — skip styled intro
109
+ if (subcommand === 'debug') {
110
+ await debugCommand();
111
+ process.exit(0);
112
+ }
113
+ // dump-tokens outputs plain text
114
+ if (subcommand === 'dump-tokens') {
115
+ await dumpTokensCommand();
116
+ process.exit(0);
117
+ }
54
118
  // eslint-disable-next-line no-console
55
119
  console.log('\n');
56
120
  p.intro(pc.bgCyan(pc.black(' @payloadcms/figma ')));
57
121
  // Route to appropriate command handler
58
122
  switch(subcommand){
123
+ case 'bootstrap':
124
+ await bootstrapCommand({
125
+ id: this.args['--id'],
126
+ env: this.args['--env'],
127
+ json: this.args['--json']
128
+ });
129
+ break;
130
+ case 'build-lambda-zip':
131
+ await buildLambdaZipCommand();
132
+ break;
59
133
  case 'deploy':
60
134
  await deployCommand({
135
+ id: this.args['--id'],
136
+ adapter: this.args['--adapter'],
61
137
  debug: this.args['--debug'],
138
+ env: this.args['--env'],
139
+ skipBuild: this.args['--skip-build'],
140
+ skipSizeCheck: this.args['--skip-size-check'],
62
141
  yes: this.args['--yes']
63
142
  });
64
143
  break;
144
+ case 'env':
145
+ await envCommand({
146
+ name: this.args._[1]
147
+ });
148
+ break;
65
149
  case 'init':
66
150
  await initCommand({
67
151
  id: this.args['--id'],
68
152
  name: this.args['--name'],
69
153
  debug: this.args['--debug'],
154
+ env: this.args['--env'],
70
155
  force: this.args['--force'],
71
- skipAuth: this.args['--skip-auth']
156
+ noSkill: this.args['--no-skill'],
157
+ payloadVersion: this.args['--payload-version'],
158
+ skipAuth: this.args['--skip-auth'],
159
+ template: this.args['--template']
72
160
  });
73
161
  break;
74
162
  case 'list-tokens':
75
163
  listTokensCommand({
164
+ all: this.args['--all'],
76
165
  debug: this.args['--debug']
77
166
  });
78
167
  break;
@@ -81,13 +170,20 @@ class Main {
81
170
  break;
82
171
  case 'logout':
83
172
  await logoutCommand({
173
+ all: this.args['--all'],
84
174
  debug: this.args['--debug']
85
175
  });
86
176
  break;
87
- case undefined:
88
- // No subcommand - show default message
89
- p.note("Let's create a new CMS!");
90
- p.outro(feedbackOutro());
177
+ case 'upgrade':
178
+ await upgradeCommand({
179
+ isDryRun: this.args['--dry-run']
180
+ });
181
+ break;
182
+ case 'upload-schema':
183
+ await uploadSchemaCommand({
184
+ id: this.args['--id'],
185
+ env: this.args['--env']
186
+ });
91
187
  break;
92
188
  default:
93
189
  p.log.error(pc.red(`Unknown command: ${subcommand}`));
@@ -102,5 +198,3 @@ class Main {
102
198
  }
103
199
  }
104
200
  }
105
-
106
- //# sourceMappingURL=cli.js.map
@@ -0,0 +1,17 @@
1
+ export type BootstrapCommandOptions = {
2
+ /** Filter to a single environment (e.g. "production", "staging"). */
3
+ env?: string;
4
+ /** CMS Resource ID (FIGMA_PROJECT_ID, e.g. cms_…). */
5
+ id?: string;
6
+ /** Emit plain JSON instead of a styled note (handy for piping into jq). */
7
+ json?: boolean;
8
+ };
9
+ /**
10
+ * Fetch and display bootstrap info for a CMS resource.
11
+ *
12
+ * Calls the Control Plane bootstrap endpoint with the current OAuth credential
13
+ * and prints the resulting environments (`contentSystemId`, `tenantInstanceId`)
14
+ * plus OAuth client credentials. Useful for grabbing a tenant ID without having
15
+ * to `init` a project.
16
+ */
17
+ export declare function bootstrapCommand(options?: BootstrapCommandOptions): Promise<void>;
@@ -0,0 +1,88 @@
1
+ import * as p from '@clack/prompts';
2
+ import pc from 'picocolors';
3
+ import { ControlPlaneError, getBootstrapInfo } from '../api/control-plane.js';
4
+ import { getValidCredential } from '../auth/oauth-flow.js';
5
+ import { getTokenStore } from '../auth/token-store.js';
6
+ import { getInfraEnvironment } from '../constants.js';
7
+ import { isDebug } from '../utils/is-debug.js';
8
+ import { maskToken } from '../utils/token-display.js';
9
+ /**
10
+ * Fetch and display bootstrap info for a CMS resource.
11
+ *
12
+ * Calls the Control Plane bootstrap endpoint with the current OAuth credential
13
+ * and prints the resulting environments (`contentSystemId`, `tenantInstanceId`)
14
+ * plus OAuth client credentials. Useful for grabbing a tenant ID without having
15
+ * to `init` a project.
16
+ */ export async function bootstrapCommand(options = {}) {
17
+ if (!options.id) {
18
+ p.log.error(pc.red('--id <project-id> is required'));
19
+ p.note('The CMS Resource ID (FIGMA_PROJECT_ID), e.g. cms_abc123', 'Tip');
20
+ process.exit(1);
21
+ }
22
+ const tokenStore = getTokenStore(getInfraEnvironment());
23
+ let credential;
24
+ try {
25
+ credential = await getValidCredential(tokenStore);
26
+ } catch (error) {
27
+ p.log.error(pc.red(`Failed to read stored credentials: ${error instanceof Error ? error.message : 'Unknown error'}`));
28
+ p.note(`Run ${pc.cyan(`@payloadcms/figma logout --infra-env ${getInfraEnvironment()} -y`)} ` + `then ${pc.cyan(`@payloadcms/figma login --infra-env ${getInfraEnvironment()}`)} and retry.`, 'Re-authenticate');
29
+ if (isDebug() && error instanceof Error) {
30
+ // eslint-disable-next-line no-console
31
+ console.error(error);
32
+ }
33
+ process.exit(1);
34
+ }
35
+ if (!credential) {
36
+ p.log.error(pc.red('Not authenticated.'));
37
+ p.note(`Run ${pc.cyan('@payloadcms/figma login')} first`, 'Tip');
38
+ process.exit(1);
39
+ }
40
+ let info;
41
+ try {
42
+ info = await getBootstrapInfo(credential, options.id, options.env);
43
+ } catch (error) {
44
+ if (error instanceof ControlPlaneError) {
45
+ p.log.error(pc.red(`Bootstrap fetch failed: ${error.statusCode} ${error.message}`));
46
+ if (error.statusCode === 401) {
47
+ p.note(`Stored credentials for infra env ${pc.bold(getInfraEnvironment())} were rejected.\n` + `Run ${pc.cyan(`@payloadcms/figma logout --infra-env ${getInfraEnvironment()} -y`)} ` + `then ${pc.cyan(`@payloadcms/figma login --infra-env ${getInfraEnvironment()}`)} and retry.`, 'Re-authenticate');
48
+ } else if (error.statusCode === 404) {
49
+ p.note(`Resource ${pc.bold(options.id)} was not found in infra env ${pc.bold(getInfraEnvironment())}.\n` + `Try ${pc.cyan('--infra-env staging')} (or production) to target a different infra.`, 'Wrong infra environment?');
50
+ }
51
+ } else if (error instanceof Error) {
52
+ const causeMessage = error.cause instanceof Error ? `: ${error.cause.message}` : '';
53
+ p.log.error(pc.red(`${error.name}: ${error.message}${causeMessage}`));
54
+ if (isDebug()) {
55
+ // eslint-disable-next-line no-console
56
+ console.error(error);
57
+ }
58
+ } else {
59
+ p.log.error(pc.red('Unknown error'));
60
+ }
61
+ process.exit(1);
62
+ }
63
+ if (options.json) {
64
+ const showSecretsInJson = isDebug();
65
+ const payload = showSecretsInJson ? info : {
66
+ ...info,
67
+ oauthCredentials: {
68
+ ...info.oauthCredentials,
69
+ oauthClientSecret: maskToken(info.oauthCredentials.oauthClientSecret)
70
+ }
71
+ };
72
+ // eslint-disable-next-line no-console
73
+ console.log(JSON.stringify(payload, null, 2));
74
+ return;
75
+ }
76
+ const showSecret = isDebug();
77
+ const lines = [
78
+ `Project ID: ${options.id}`,
79
+ `OAuth Client ID: ${info.oauthCredentials.oauthClientId}`,
80
+ `OAuth Client Secret: ${showSecret ? info.oauthCredentials.oauthClientSecret : maskToken(info.oauthCredentials.oauthClientSecret)}`,
81
+ '',
82
+ 'Environments:'
83
+ ];
84
+ for (const env of info.environments){
85
+ lines.push(` ${pc.bold(env.name)}`, ` Tenant ID (contentSystemId): ${env.contentSystemId}`, ` Tenant Instance ID: ${env.tenantInstanceId}`);
86
+ }
87
+ p.note(lines.join('\n'), 'Bootstrap Info');
88
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Build Lambda deployment zip from current directory
3
+ */
4
+ export declare function buildLambdaZipCommand(): Promise<void>;
@@ -0,0 +1,17 @@
1
+ import * as p from '@clack/prompts';
2
+ import pc from 'picocolors';
3
+ import { buildLambdaZip } from '../utils/build-lambda-zip.js';
4
+ /**
5
+ * Build Lambda deployment zip from current directory
6
+ */ export async function buildLambdaZipCommand() {
7
+ const projectPath = process.cwd();
8
+ const s = p.spinner();
9
+ s.start('Creating lambda.zip');
10
+ try {
11
+ await buildLambdaZip(projectPath);
12
+ s.stop(pc.green('✓ Created lambda.zip'));
13
+ } catch (error) {
14
+ s.stop(pc.red('✗ Failed to create lambda.zip'));
15
+ throw error;
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Handle the `@payloadcms/figma debug` command
3
+ *
4
+ * Outputs environment, auth, project, and package info for debugging.
5
+ * All data is local — no network calls are made.
6
+ */
7
+ export declare function debugCommand(): Promise<void>;
@@ -0,0 +1,178 @@
1
+ import fsSync from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { getEncryptionKeyHash } from '../auth/crypto-utils.js';
6
+ import { getTokenStore } from '../auth/token-store.js';
7
+ import { getInfraEnvironment } from '../constants.js';
8
+ import { getEnvVarSync } from '../utils/env-management.js';
9
+ import { maskToken } from '../utils/token-display.js';
10
+ import { getOwnVersion } from '../utils/version-check.js';
11
+ /**
12
+ * Handle the `@payloadcms/figma debug` command
13
+ *
14
+ * Outputs environment, auth, project, and package info for debugging.
15
+ * All data is local — no network calls are made.
16
+ */ export async function debugCommand() {
17
+ const env = getInfraEnvironment();
18
+ const tokenStore = getTokenStore(env);
19
+ const cwd = process.cwd();
20
+ const lines = [
21
+ 'Debug Info:',
22
+ ''
23
+ ];
24
+ appendSystemSection(lines, env);
25
+ appendAuthSection(lines, tokenStore, cwd);
26
+ appendTokenStoreDiagnostics(lines, tokenStore);
27
+ appendProjectSection(lines, tokenStore, cwd);
28
+ await appendPackagesSection(lines);
29
+ // eslint-disable-next-line no-console
30
+ console.log(lines.join('\n'));
31
+ }
32
+ function appendSystemSection(lines, env) {
33
+ lines.push(`Infra Environment: ${env}`);
34
+ lines.push(`Node: ${process.version}`);
35
+ lines.push(`OS: ${os.platform()} ${os.arch()}`);
36
+ lines.push('');
37
+ }
38
+ function appendAuthSection(lines, tokenStore, cwd) {
39
+ const tokens = tokenStore.getOauthInfo();
40
+ lines.push('Auth:');
41
+ if (!tokens) {
42
+ lines.push(' Status: Not authenticated');
43
+ lines.push('');
44
+ return;
45
+ }
46
+ const isValid = tokenStore.hasValidOauthToken();
47
+ lines.push(` Status: ${isValid ? 'Authenticated' : 'Token expired'}`);
48
+ const email = getEmailFromClaims(tokenStore, cwd);
49
+ if (email) {
50
+ lines.push(` Email: ${email}`);
51
+ } else if (tokens.userId) {
52
+ lines.push(` User ID: ${tokens.userId}`);
53
+ }
54
+ lines.push(` Token Expires: ${formatExpiryTime(tokens.expiresAt)}`);
55
+ lines.push('');
56
+ }
57
+ function appendTokenStoreDiagnostics(lines, tokenStore) {
58
+ lines.push('Token Store:');
59
+ const filePath = tokenStore.getStoragePath();
60
+ const fileExists = fsSync.existsSync(filePath);
61
+ const fileSize = fileExists ? fsSync.statSync(filePath).size : 0;
62
+ lines.push(` File: ${filePath}`);
63
+ lines.push(` File Exists: ${fileExists}`);
64
+ lines.push(` File Size: ${fileSize}B`);
65
+ const canRead = tokenStore.getOauthInfo() !== null || tokenStore.getCurrentRefreshToken() !== null;
66
+ lines.push(` Decryption: ${fileExists ? canRead || fileSize === 0 ? 'OK' : 'FAILED' : 'N/A'}`);
67
+ lines.push(` Key Hash: ${getEncryptionKeyHash()}`);
68
+ lines.push('');
69
+ }
70
+ function appendProjectSection(lines, tokenStore, cwd) {
71
+ const projectId = getEnvVarSync(cwd, 'FIGMA_PROJECT_ID');
72
+ const environmentName = getEnvVarSync(cwd, 'FIGMA_ENVIRONMENT_NAME');
73
+ lines.push('Project:');
74
+ if (!projectId) {
75
+ lines.push(" Not initialized (run 'init' first)");
76
+ lines.push('');
77
+ return;
78
+ }
79
+ lines.push(` Project ID: ${projectId}`);
80
+ lines.push(` Environment: ${environmentName ?? '(not set)'}`);
81
+ // Show bootstrap data from local store
82
+ if (projectId && environmentName) {
83
+ const bootstrapData = tokenStore.getBootstrapData(projectId, environmentName);
84
+ if (bootstrapData) {
85
+ lines.push(` Content System ID: ${bootstrapData.contentSystemId}`);
86
+ lines.push(` Tenant Instance ID: ${bootstrapData.tenantInstanceId}`);
87
+ lines.push(` OAuth Client ID: ${maskToken(bootstrapData.oauthClientId)}`);
88
+ const projectToken = tokenStore.getProjectToken({
89
+ projectInfo: {
90
+ environmentName,
91
+ projectId
92
+ }
93
+ });
94
+ if (projectToken) {
95
+ lines.push(` Project Token: ${formatExpiryTime(projectToken.expiresAt)}`);
96
+ }
97
+ } else {
98
+ lines.push(' Bootstrap Data: (not cached)');
99
+ }
100
+ }
101
+ lines.push('');
102
+ }
103
+ async function appendPackagesSection(lines) {
104
+ lines.push('Packages:');
105
+ const cliVersion = await getOwnVersion();
106
+ lines.push(` @payloadcms/figma: ${cliVersion}`);
107
+ const payloadVersion = getPayloadVersion();
108
+ lines.push(` payload: ${payloadVersion}`);
109
+ }
110
+ /**
111
+ * Resolve email from the current project + environment scoped token when available.
112
+ */ function getEmailFromClaims(tokenStore, cwd) {
113
+ const projectId = getEnvVarSync(cwd, 'FIGMA_PROJECT_ID');
114
+ const environmentName = getEnvVarSync(cwd, 'FIGMA_ENVIRONMENT_NAME');
115
+ if (projectId && environmentName) {
116
+ const bootstrapData = tokenStore.getBootstrapData(projectId, environmentName);
117
+ if (bootstrapData) {
118
+ const email = tokenStore.getProjectToken({
119
+ projectInfo: {
120
+ environmentName,
121
+ projectId
122
+ }
123
+ })?.claims?.email;
124
+ if (email) {
125
+ return email;
126
+ }
127
+ }
128
+ }
129
+ return null;
130
+ }
131
+ function getPayloadVersion() {
132
+ try {
133
+ const require = createRequire(path.join(process.cwd(), 'noop.js'));
134
+ const resolved = require.resolve('payload');
135
+ const packageJsonPath = findPackageJson(path.dirname(resolved));
136
+ if (!packageJsonPath) {
137
+ return 'not found';
138
+ }
139
+ const content = fsSync.readFileSync(packageJsonPath, 'utf-8');
140
+ return JSON.parse(content).version;
141
+ } catch {
142
+ return 'not found';
143
+ }
144
+ }
145
+ function findPackageJson(dir) {
146
+ const { root } = path.parse(dir);
147
+ while(dir !== root){
148
+ const candidate = path.join(dir, 'package.json');
149
+ if (fsSync.existsSync(candidate)) {
150
+ return candidate;
151
+ }
152
+ dir = path.dirname(dir);
153
+ }
154
+ return null;
155
+ }
156
+ /**
157
+ * Format expiry timestamp as ISO string with relative time
158
+ * e.g. "2026-02-11T10:30:00.000Z (in 23h 15m)" or "2026-02-10T08:00:00.000Z (expired 2h ago)"
159
+ */ function formatExpiryTime(expiresAt) {
160
+ const iso = new Date(expiresAt).toISOString();
161
+ const diff = expiresAt - Date.now();
162
+ if (diff < 0) {
163
+ return `${iso} (expired ${formatDuration(Math.abs(diff))} ago)`;
164
+ }
165
+ return `${iso} (in ${formatDuration(diff)})`;
166
+ }
167
+ function formatDuration(ms) {
168
+ const minutes = Math.floor(ms / 60000);
169
+ const hours = Math.floor(minutes / 60);
170
+ const days = Math.floor(hours / 24);
171
+ if (days > 0) {
172
+ return `${days}d ${hours % 24}h`;
173
+ }
174
+ if (hours > 0) {
175
+ return `${hours}h ${minutes % 60}m`;
176
+ }
177
+ return `${minutes}m`;
178
+ }
@@ -1,9 +1,20 @@
1
+ import type { AdapterName } from '../utils/deploy-adapter.js';
1
2
  /**
2
3
  * Options for deploy command
3
4
  */
4
5
  export interface DeployCommandOptions {
6
+ /** Framework adapter (nextjs, nitro, vite). Auto-detected if omitted. */
7
+ adapter?: AdapterName;
5
8
  /** Enable debug mode */
6
9
  debug?: boolean;
10
+ /** Figma environment name (e.g. 'production', 'staging') */
11
+ env?: string;
12
+ /** CMS Resource ID (overrides FIGMA_PROJECT_ID) */
13
+ id?: string;
14
+ /** Skip the build step (use existing build) */
15
+ skipBuild?: boolean;
16
+ /** Skip the client-side unzipped bundle size pre-flight check */
17
+ skipSizeCheck?: boolean;
7
18
  /** Skip confirmation prompts */
8
19
  yes?: boolean;
9
20
  }
@@ -13,4 +24,3 @@ export interface DeployCommandOptions {
13
24
  * @param options - Command options
14
25
  */
15
26
  export declare function deployCommand(options: DeployCommandOptions): Promise<void>;
16
- //# sourceMappingURL=deploy.d.ts.map