@payloadcms/figma 0.0.1-alpha.5 → 0.0.1-alpha.51

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 (326) hide show
  1. package/dist/api/control-plane.d.ts +31 -1
  2. package/dist/api/control-plane.js +137 -67
  3. package/dist/api/figma-api.d.ts +20 -0
  4. package/dist/api/figma-api.js +77 -21
  5. package/dist/auth/callback-server.js +2 -1
  6. package/dist/auth/crypto-utils.js +5 -5
  7. package/dist/auth/jwt-validator.d.ts +2 -1
  8. package/dist/auth/jwt-validator.js +2 -2
  9. package/dist/auth/oauth-flow.d.ts +1 -1
  10. package/dist/auth/oauth-flow.js +15 -11
  11. package/dist/auth/project-token.js +11 -6
  12. package/dist/auth/refresh.d.ts +2 -1
  13. package/dist/auth/refresh.js +25 -12
  14. package/dist/auth/token-store.d.ts +40 -1
  15. package/dist/auth/token-store.js +65 -5
  16. package/dist/auth/types.d.ts +17 -4
  17. package/dist/cli.js +54 -6
  18. package/dist/commands/build-lambda-zip.d.ts +5 -0
  19. package/dist/commands/build-lambda-zip.js +19 -0
  20. package/dist/commands/debug.d.ts +8 -0
  21. package/dist/commands/debug.js +161 -0
  22. package/dist/commands/deploy.d.ts +6 -0
  23. package/dist/commands/deploy.js +94 -126
  24. package/dist/commands/env.d.ts +13 -0
  25. package/dist/commands/env.js +88 -0
  26. package/dist/commands/init.d.ts +3 -5
  27. package/dist/commands/init.js +118 -94
  28. package/dist/commands/list-tokens.d.ts +3 -3
  29. package/dist/commands/list-tokens.js +22 -7
  30. package/dist/commands/login.d.ts +8 -1
  31. package/dist/commands/login.js +30 -12
  32. package/dist/commands/logout.d.ts +5 -4
  33. package/dist/commands/logout.js +56 -13
  34. package/dist/config/oauth.d.ts +4 -14
  35. package/dist/config/oauth.js +18 -40
  36. package/dist/constants.d.ts +36 -19
  37. package/dist/constants.js +58 -20
  38. package/dist/db-content-api/README.md +98 -0
  39. package/dist/db-content-api/generated/content-api-types.d.ts +3746 -0
  40. package/dist/db-content-api/generated/content-api-types.js +7 -0
  41. package/dist/db-content-api/index.d.ts +20 -0
  42. package/dist/db-content-api/index.js +702 -0
  43. package/dist/db-content-api/temp-utilities/slug.d.ts +2 -0
  44. package/dist/db-content-api/temp-utilities/slug.js +3 -0
  45. package/dist/db-content-api/temp-utilities/sorting.d.ts +3 -0
  46. package/dist/db-content-api/temp-utilities/sorting.js +32 -0
  47. package/dist/db-content-api/temp-utilities/types.d.ts +22 -0
  48. package/dist/db-content-api/temp-utilities/types.js +15 -0
  49. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +34 -0
  50. package/dist/db-content-api/temp-utilities/unwrapDocument.js +53 -0
  51. package/dist/db-content-api/utilities/auth.d.ts +30 -0
  52. package/dist/db-content-api/utilities/auth.js +81 -0
  53. package/dist/db-content-api/utilities/data/applyDefaults.d.ts +7 -0
  54. package/dist/db-content-api/utilities/data/applyDefaults.js +59 -0
  55. package/dist/db-content-api/utilities/data/castFieldValue.d.ts +11 -0
  56. package/dist/db-content-api/utilities/data/castFieldValue.js +69 -0
  57. package/dist/db-content-api/utilities/data/index.d.ts +42 -0
  58. package/dist/db-content-api/utilities/data/index.js +211 -0
  59. package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +12 -0
  60. package/dist/db-content-api/utilities/data/removeVirtualFields.js +54 -0
  61. package/dist/db-content-api/utilities/data/stripFields.d.ts +48 -0
  62. package/dist/db-content-api/utilities/data/stripFields.js +195 -0
  63. package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +23 -0
  64. package/dist/db-content-api/utilities/data/transformPublishedLocale.js +42 -0
  65. package/dist/db-content-api/utilities/joins.d.ts +55 -0
  66. package/dist/db-content-api/utilities/joins.js +136 -0
  67. package/dist/db-content-api/utilities/locale/index.d.ts +10 -0
  68. package/dist/db-content-api/utilities/locale/index.js +21 -0
  69. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +11 -0
  70. package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +66 -0
  71. package/dist/db-content-api/utilities/meta/buildMeta.d.ts +37 -0
  72. package/dist/db-content-api/utilities/meta/buildMeta.js +33 -0
  73. package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +13 -0
  74. package/dist/db-content-api/utilities/meta/buildPathTypes.js +181 -0
  75. package/dist/db-content-api/utilities/where.d.ts +20 -0
  76. package/dist/db-content-api/utilities/where.js +127 -0
  77. package/dist/endpoints/health.d.ts +3 -0
  78. package/dist/endpoints/health.js +11 -0
  79. package/dist/endpoints/schema.d.ts +3 -0
  80. package/dist/endpoints/schema.js +29 -0
  81. package/dist/exports/client.d.ts +3 -0
  82. package/dist/exports/client.js +3 -0
  83. package/dist/index.d.ts +2 -1
  84. package/dist/index.js +3 -1
  85. package/dist/oauth/components/FigmaAvatar/index.d.ts +4 -0
  86. package/dist/oauth/components/FigmaAvatar/index.js +27 -0
  87. package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
  88. package/dist/oauth/components/FigmaAvatarCell/index.d.ts +5 -0
  89. package/dist/oauth/components/FigmaAvatarCell/index.js +25 -0
  90. package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
  91. package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +9 -0
  92. package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +37 -0
  93. package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
  94. package/dist/oauth/components/LoginButton/index.js +50 -6
  95. package/dist/oauth/components/LoginButton/index.scss +50 -3
  96. package/dist/oauth/components/LogoutButton/index.js +5 -4
  97. package/dist/oauth/defaults.js +67 -10
  98. package/dist/oauth/endpoints/getLoginEndpoint.js +69 -24
  99. package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -4
  100. package/dist/oauth/index.js +40 -5
  101. package/dist/oauth/strategy/index.d.ts +0 -2
  102. package/dist/oauth/strategy/index.js +40 -17
  103. package/dist/oauth/types.d.ts +6 -6
  104. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +7 -0
  105. package/dist/oauth/utilities/isDuplicateKeyError.js +14 -0
  106. package/dist/oauth/utilities/refreshTokens.js +3 -3
  107. package/dist/plugin/build-config.d.ts +21 -14
  108. package/dist/plugin/build-config.js +208 -17
  109. package/dist/storage-content-api/api-types.d.ts +168 -0
  110. package/dist/storage-content-api/api-types.js +6 -0
  111. package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +9 -0
  112. package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +42 -0
  113. package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +13 -0
  114. package/dist/storage-content-api/client-uploads/generateSignedURL.js +39 -0
  115. package/dist/storage-content-api/client.d.ts +6 -0
  116. package/dist/storage-content-api/client.js +36 -0
  117. package/dist/storage-content-api/generateURL.d.ts +7 -0
  118. package/dist/storage-content-api/generateURL.js +8 -0
  119. package/dist/storage-content-api/handleDelete.d.ts +8 -0
  120. package/dist/storage-content-api/handleDelete.js +17 -0
  121. package/dist/storage-content-api/handleUpload.d.ts +11 -0
  122. package/dist/storage-content-api/handleUpload.js +144 -0
  123. package/dist/storage-content-api/index.d.ts +5 -0
  124. package/dist/storage-content-api/index.js +31 -0
  125. package/dist/storage-content-api/staticHandler.d.ts +10 -0
  126. package/dist/storage-content-api/staticHandler.js +56 -0
  127. package/dist/storage-content-api/types.d.ts +10 -0
  128. package/dist/storage-content-api/types.js +3 -0
  129. package/dist/storage-content-api/utilities/getSafeFilename.d.ts +12 -0
  130. package/dist/storage-content-api/utilities/getSafeFilename.js +61 -0
  131. package/dist/storage-content-api/utilities/index.d.ts +2 -0
  132. package/dist/storage-content-api/utilities/index.js +3 -0
  133. package/dist/templates/.env.example +5 -0
  134. package/dist/templates/README.md +19 -0
  135. package/dist/types/config.d.ts +2 -1
  136. package/dist/types/config.js +0 -2
  137. package/dist/types.d.ts +3 -1
  138. package/dist/utils/asset-collection.d.ts +3 -6
  139. package/dist/utils/asset-collection.js +10 -34
  140. package/dist/utils/build-lambda-zip.d.ts +14 -0
  141. package/dist/utils/build-lambda-zip.js +81 -0
  142. package/dist/utils/cache-bootstrap.d.ts +8 -0
  143. package/dist/utils/cache-bootstrap.js +18 -0
  144. package/dist/utils/config.js +1 -1
  145. package/dist/utils/env-management.d.ts +16 -7
  146. package/dist/utils/env-management.js +85 -64
  147. package/dist/utils/format-env-suffix.d.ts +12 -0
  148. package/dist/utils/format-env-suffix.js +13 -0
  149. package/dist/utils/formatter.js +3 -5
  150. package/dist/utils/lambda-config.d.ts +3 -1
  151. package/dist/utils/lambda-config.js +38 -32
  152. package/dist/utils/messages.d.ts +1 -1
  153. package/dist/utils/messages.js +22 -8
  154. package/dist/utils/package-manager.d.ts +24 -0
  155. package/dist/utils/package-manager.js +53 -0
  156. package/dist/utils/payload-config-ast.d.ts +22 -3
  157. package/dist/utils/payload-config-ast.js +96 -31
  158. package/dist/utils/payload-config-finder.d.ts +2 -2
  159. package/dist/utils/payload-config-finder.js +48 -9
  160. package/dist/utils/payload-config-modifier.d.ts +1 -1
  161. package/dist/utils/payload-config-modifier.js +61 -10
  162. package/dist/utils/payload-package-check.d.ts +12 -1
  163. package/dist/utils/payload-package-check.js +63 -5
  164. package/dist/utils/project.d.ts +3 -2
  165. package/dist/utils/project.js +29 -15
  166. package/dist/utils/resolve-environment.d.ts +14 -0
  167. package/dist/utils/resolve-environment.js +28 -0
  168. package/dist/utils/s3-upload.d.ts +0 -1
  169. package/dist/utils/s3-upload.js +10 -3
  170. package/dist/utils/token-display.js +11 -5
  171. package/dist/utils/typescript-validator.js +4 -6
  172. package/dist/utils/version-check.d.ts +3 -0
  173. package/dist/utils/version-check.js +38 -0
  174. package/package.json +29 -10
  175. package/dist/api/control-plane.d.ts.map +0 -1
  176. package/dist/api/control-plane.js.map +0 -1
  177. package/dist/api/figma-api.d.ts.map +0 -1
  178. package/dist/api/figma-api.js.map +0 -1
  179. package/dist/auth/browser.d.ts.map +0 -1
  180. package/dist/auth/browser.js.map +0 -1
  181. package/dist/auth/callback-server.d.ts.map +0 -1
  182. package/dist/auth/callback-server.js.map +0 -1
  183. package/dist/auth/crypto-utils.d.ts.map +0 -1
  184. package/dist/auth/crypto-utils.js.map +0 -1
  185. package/dist/auth/jwt-validator.d.ts.map +0 -1
  186. package/dist/auth/jwt-validator.js.map +0 -1
  187. package/dist/auth/oauth-flow.d.ts.map +0 -1
  188. package/dist/auth/oauth-flow.js.map +0 -1
  189. package/dist/auth/pkce.d.ts.map +0 -1
  190. package/dist/auth/pkce.js.map +0 -1
  191. package/dist/auth/project-token.d.ts.map +0 -1
  192. package/dist/auth/project-token.js.map +0 -1
  193. package/dist/auth/refresh.d.ts.map +0 -1
  194. package/dist/auth/refresh.js.map +0 -1
  195. package/dist/auth/token-store.d.ts.map +0 -1
  196. package/dist/auth/token-store.js.map +0 -1
  197. package/dist/auth/types.d.ts.map +0 -1
  198. package/dist/auth/types.js.map +0 -1
  199. package/dist/cli.d.ts.map +0 -1
  200. package/dist/cli.js.map +0 -1
  201. package/dist/commands/deploy.d.ts.map +0 -1
  202. package/dist/commands/deploy.js.map +0 -1
  203. package/dist/commands/init.d.ts.map +0 -1
  204. package/dist/commands/init.js.map +0 -1
  205. package/dist/commands/list-tokens.d.ts.map +0 -1
  206. package/dist/commands/list-tokens.js.map +0 -1
  207. package/dist/commands/login.d.ts.map +0 -1
  208. package/dist/commands/login.js.map +0 -1
  209. package/dist/commands/logout.d.ts.map +0 -1
  210. package/dist/commands/logout.js.map +0 -1
  211. package/dist/config/oauth.d.ts.map +0 -1
  212. package/dist/config/oauth.js.map +0 -1
  213. package/dist/constants.d.ts.map +0 -1
  214. package/dist/constants.js.map +0 -1
  215. package/dist/exports/client.d.ts.map +0 -1
  216. package/dist/exports/client.js.map +0 -1
  217. package/dist/index.d.ts.map +0 -1
  218. package/dist/index.js.map +0 -1
  219. package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
  220. package/dist/oauth/components/LoginButton/index.js.map +0 -1
  221. package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
  222. package/dist/oauth/components/LogoutButton/index.js.map +0 -1
  223. package/dist/oauth/defaults.d.ts.map +0 -1
  224. package/dist/oauth/defaults.js.map +0 -1
  225. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
  226. package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
  227. package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
  228. package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
  229. package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
  230. package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
  231. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
  232. package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
  233. package/dist/oauth/exports/client.d.ts.map +0 -1
  234. package/dist/oauth/exports/client.js.map +0 -1
  235. package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
  236. package/dist/oauth/hooks/afterLogout.js.map +0 -1
  237. package/dist/oauth/hooks/me.d.ts.map +0 -1
  238. package/dist/oauth/hooks/me.js.map +0 -1
  239. package/dist/oauth/hooks/refresh.d.ts.map +0 -1
  240. package/dist/oauth/hooks/refresh.js.map +0 -1
  241. package/dist/oauth/index.d.ts.map +0 -1
  242. package/dist/oauth/index.js.map +0 -1
  243. package/dist/oauth/strategy/index.d.ts.map +0 -1
  244. package/dist/oauth/strategy/index.js.map +0 -1
  245. package/dist/oauth/types.d.ts.map +0 -1
  246. package/dist/oauth/types.js.map +0 -1
  247. package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
  248. package/dist/oauth/utilities/clearCookie.js.map +0 -1
  249. package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
  250. package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
  251. package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
  252. package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
  253. package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
  254. package/dist/oauth/utilities/extractOrigin.js.map +0 -1
  255. package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
  256. package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
  257. package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
  258. package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
  259. package/dist/oauth/utilities/getAdminPath.js +0 -9
  260. package/dist/oauth/utilities/getAdminPath.js.map +0 -1
  261. package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
  262. package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
  263. package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
  264. package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
  265. package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
  266. package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
  267. package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
  268. package/dist/oauth/utilities/getTokenExp.js.map +0 -1
  269. package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
  270. package/dist/oauth/utilities/getUsernameField.js.map +0 -1
  271. package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
  272. package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
  273. package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
  274. package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
  275. package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
  276. package/dist/oauth/utilities/refreshTokens.js.map +0 -1
  277. package/dist/plugin/adapter.d.ts.map +0 -1
  278. package/dist/plugin/adapter.js.map +0 -1
  279. package/dist/plugin/build-config.d.ts.map +0 -1
  280. package/dist/plugin/build-config.js.map +0 -1
  281. package/dist/types/config.d.ts.map +0 -1
  282. package/dist/types/config.js.map +0 -1
  283. package/dist/types.d.ts.map +0 -1
  284. package/dist/types.js.map +0 -1
  285. package/dist/utils/asset-collection.d.ts.map +0 -1
  286. package/dist/utils/asset-collection.js.map +0 -1
  287. package/dist/utils/build-detection.d.ts.map +0 -1
  288. package/dist/utils/build-detection.js.map +0 -1
  289. package/dist/utils/config.d.ts.map +0 -1
  290. package/dist/utils/config.js.map +0 -1
  291. package/dist/utils/download-template.d.ts.map +0 -1
  292. package/dist/utils/download-template.js.map +0 -1
  293. package/dist/utils/env-management.d.ts.map +0 -1
  294. package/dist/utils/env-management.js.map +0 -1
  295. package/dist/utils/format.d.ts.map +0 -1
  296. package/dist/utils/format.js.map +0 -1
  297. package/dist/utils/formatter.d.ts.map +0 -1
  298. package/dist/utils/formatter.js.map +0 -1
  299. package/dist/utils/git.d.ts.map +0 -1
  300. package/dist/utils/git.js.map +0 -1
  301. package/dist/utils/is-debug.d.ts.map +0 -1
  302. package/dist/utils/is-debug.js.map +0 -1
  303. package/dist/utils/lambda-config.d.ts.map +0 -1
  304. package/dist/utils/lambda-config.js.map +0 -1
  305. package/dist/utils/log.d.ts.map +0 -1
  306. package/dist/utils/log.js.map +0 -1
  307. package/dist/utils/messages.d.ts.map +0 -1
  308. package/dist/utils/messages.js.map +0 -1
  309. package/dist/utils/package-manager.d.ts.map +0 -1
  310. package/dist/utils/package-manager.js.map +0 -1
  311. package/dist/utils/payload-config-ast.d.ts.map +0 -1
  312. package/dist/utils/payload-config-ast.js.map +0 -1
  313. package/dist/utils/payload-config-finder.d.ts.map +0 -1
  314. package/dist/utils/payload-config-finder.js.map +0 -1
  315. package/dist/utils/payload-config-modifier.d.ts.map +0 -1
  316. package/dist/utils/payload-config-modifier.js.map +0 -1
  317. package/dist/utils/payload-package-check.d.ts.map +0 -1
  318. package/dist/utils/payload-package-check.js.map +0 -1
  319. package/dist/utils/project.d.ts.map +0 -1
  320. package/dist/utils/project.js.map +0 -1
  321. package/dist/utils/s3-upload.d.ts.map +0 -1
  322. package/dist/utils/s3-upload.js.map +0 -1
  323. package/dist/utils/token-display.d.ts.map +0 -1
  324. package/dist/utils/token-display.js.map +0 -1
  325. package/dist/utils/typescript-validator.d.ts.map +0 -1
  326. package/dist/utils/typescript-validator.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import * as p from '@clack/prompts';
2
2
  import crypto from 'crypto';
3
- import { OAUTH_CONFIG } from '../config/oauth.js';
3
+ import { DEFAULT_CALLBACK_PORT, getOAuthConfig } from '../config/oauth.js';
4
4
  import * as log from '../utils/log.js';
5
5
  import { buildAuthorizationUrl, openBrowser } from './browser.js';
6
6
  import { CallbackServer } from './callback-server.js';
7
7
  import { generatePKCEPair } from './pkce.js';
8
- import { exchangeCodeForTokens, refreshAccessToken } from './refresh.js';
8
+ import { exchangeCodeForTokens, refreshAccessToken, TokenRefreshError } from './refresh.js';
9
9
  /**
10
10
  * Error during OAuth flow
11
11
  */ export class OAuthFlowError extends Error {
@@ -32,16 +32,17 @@ import { exchangeCodeForTokens, refreshAccessToken } from './refresh.js';
32
32
  * @throws OAuthFlowError if any step fails
33
33
  */ export async function executeOAuthFlow(tokenStore, options = {}) {
34
34
  // Check if OAuth flow should be mocked
35
- // Default to true for OAuth (allow testing without real authentication by default)
36
- const shouldMock = process.env.FIGMA_MOCK_OAUTH !== 'false';
35
+ // Default to false for OAuth
36
+ const shouldMock = process.env.FIGMA_MOCK_OAUTH === 'true';
37
+ const oauthConfig = getOAuthConfig();
37
38
  if (shouldMock) {
38
39
  // MOCK IMPLEMENTATION: Return mock tokens for testing
39
- log.debug('Using mock OAuth flow (FIGMA_MOCK_OAUTH != "false")');
40
+ log.debug('Using mock OAuth flow (FIGMA_MOCK_OAUTH = true)');
40
41
  const mockTokens = {
41
42
  accessToken: 'figt_mock_access_token_' + crypto.randomBytes(16).toString('hex'),
42
43
  expiresAt: Date.now() + 2 * 60 * 60 * 1000,
43
44
  refreshToken: 'figt_mock_refresh_token_' + crypto.randomBytes(16).toString('hex'),
44
- scopes: options.scopes || OAUTH_CONFIG.scopes,
45
+ scopes: options.scopes || oauthConfig.scopes,
45
46
  tokenType: 'Bearer'
46
47
  };
47
48
  // Store mock tokens
@@ -52,7 +53,7 @@ import { exchangeCodeForTokens, refreshAccessToken } from './refresh.js';
52
53
  };
53
54
  }
54
55
  // REAL OAUTH IMPLEMENTATION
55
- const { clientId = OAUTH_CONFIG.clientId, port = 3000, redirectUri = OAUTH_CONFIG.redirectUri, scopes = OAUTH_CONFIG.scopes, timeoutMs = 120000 } = options;
56
+ const { clientId = oauthConfig.clientId, port = DEFAULT_CALLBACK_PORT, redirectUri = oauthConfig.redirectUri, scopes = oauthConfig.scopes, timeoutMs = 120000 } = options;
56
57
  // Generate PKCE pair for enhanced security
57
58
  const { codeChallenge, codeChallengeMethod, codeVerifier } = generatePKCEPair();
58
59
  // Generate random state for CSRF protection
@@ -73,7 +74,7 @@ import { exchangeCodeForTokens, refreshAccessToken } from './refresh.js';
73
74
  const actualRedirectUri = redirectUri.replace(/:\d+/, `:${actualPort}`);
74
75
  // Build authorization URL
75
76
  const authUrl = buildAuthorizationUrl({
76
- authorizationUrl: OAUTH_CONFIG.authorizationUrl,
77
+ authorizationUrl: oauthConfig.authorizationUrl,
77
78
  clientId,
78
79
  codeChallenge,
79
80
  codeChallengeMethod,
@@ -84,7 +85,7 @@ import { exchangeCodeForTokens, refreshAccessToken } from './refresh.js';
84
85
  // Prompt user to open browser
85
86
  const shouldOpenBrowser = await p.confirm({
86
87
  initialValue: true,
87
- message: 'Log in or create Figma account in your browser?'
88
+ message: 'Authenticate with Figma in your browser?'
88
89
  });
89
90
  if (p.isCancel(shouldOpenBrowser)) {
90
91
  throw new OAuthFlowError('Authentication cancelled by user');
@@ -160,8 +161,11 @@ import { exchangeCodeForTokens, refreshAccessToken } from './refresh.js';
160
161
  tokenStore.setTokens(tokens);
161
162
  return tokens.accessToken;
162
163
  } catch (error) {
163
- // Refresh failed - clear invalid tokens
164
- tokenStore.clearTokens();
164
+ // Only clear tokens for actual auth failures, not transient errors
165
+ const isAuthFailure = error instanceof TokenRefreshError && (error.statusCode === 401 || error.statusCode === 403 || error.statusCode === 400 && error.errorCode === 'invalid_grant');
166
+ if (isAuthFailure) {
167
+ tokenStore.clearTokens();
168
+ }
165
169
  throw new OAuthFlowError('Failed to refresh access token', error instanceof Error ? error : undefined);
166
170
  }
167
171
  }
@@ -5,7 +5,7 @@
5
5
  * to the Content API. Project tokens are scoped to a specific tenant/CMS
6
6
  * and have a shorter lifespan (15-30 minutes) than OAuth tokens.
7
7
  */ import { getProjectToken as fetchProjectToken } from '../api/figma-api.js';
8
- import { getEnvironment } from '../constants.js';
8
+ import { getInfraEnvironment } from '../constants.js';
9
9
  import * as log from '../utils/log.js';
10
10
  import { JWTValidationError, validateProjectToken } from './jwt-validator.js';
11
11
  import { getValidAccessToken } from './oauth-flow.js';
@@ -60,13 +60,17 @@ import { getValidAccessToken } from './oauth-flow.js';
60
60
  * @returns Promise resolving to JWT token string or null if failed
61
61
  * @throws {ProjectTokenError} If token generation fails
62
62
  */ export async function getValidProjectToken(tokenStore, tenantId) {
63
- // Check if we have a valid project token already
63
+ if (process.env.FIGMA_CONTENT_API_ACCESS_KEY) {
64
+ log.debug('FIGMA_CONTENT_API_ACCESS_KEY is set; skipping project token retrieval from API');
65
+ return null;
66
+ }
67
+ // Check for existing valid project token
64
68
  if (tokenStore.hasValidProjectToken(tenantId)) {
65
69
  const projectToken = tokenStore.getProjectToken(tenantId);
66
70
  return projectToken?.token || null;
67
71
  }
68
72
  // We need to refresh the project token
69
- // First, get a valid user access token (will auto-refresh if needed)
73
+ // An oauth access token is required for the call
70
74
  let accessToken;
71
75
  try {
72
76
  accessToken = await getValidAccessToken(tokenStore);
@@ -80,16 +84,17 @@ import { getValidAccessToken } from './oauth-flow.js';
80
84
  // Fetch a new project token from the Figma API
81
85
  const projectToken = await fetchProjectToken(accessToken, tenantId);
82
86
  // Validate the JWT signature and claims (skip for mocks)
87
+ const hasEnvToken = !!process.env.FIGMA_MOCK_PROJECT_TOKEN_VALUE;
83
88
  const shouldMock = process.env.FIGMA_MOCK_PROJECT_TOKEN !== 'false';
84
89
  let validatedClaims;
85
- if (shouldMock) {
90
+ if (hasEnvToken || shouldMock) {
86
91
  // MOCK: Skip JWT validation and parse claims directly
87
- log.debug('Skipping JWT validation for mock project token');
92
+ log.debug('Skipping JWT validation for mock/env project token');
88
93
  validatedClaims = parseJWTClaims(projectToken.token);
89
94
  } else {
90
95
  // REAL: Validate JWT signature against JWKS
91
96
  try {
92
- validatedClaims = await validateProjectToken(projectToken.token, getEnvironment());
97
+ validatedClaims = await validateProjectToken(projectToken.token, getInfraEnvironment());
93
98
  } catch (validationError) {
94
99
  // Handle validation errors
95
100
  if (validationError instanceof JWTValidationError) {
@@ -4,7 +4,8 @@ import type { FigmaTokens } from './types.js';
4
4
  */
5
5
  export declare class TokenRefreshError extends Error {
6
6
  statusCode?: number | undefined;
7
- constructor(message: string, statusCode?: number | undefined);
7
+ errorCode?: string | undefined;
8
+ constructor(message: string, statusCode?: number | undefined, errorCode?: string | undefined);
8
9
  }
9
10
  /**
10
11
  * Refresh an expired OAuth2 access token using a refresh token
@@ -1,11 +1,12 @@
1
- /* eslint-disable perfectionist/sort-objects */ import { OAUTH_CONFIG } from '../config/oauth.js';
1
+ /* eslint-disable perfectionist/sort-objects */ import { getOAuthConfig } from '../config/oauth.js';
2
2
  import * as log from '../utils/log.js';
3
3
  /**
4
4
  * Error thrown when token refresh fails
5
5
  */ export class TokenRefreshError extends Error {
6
6
  statusCode;
7
- constructor(message, statusCode){
8
- super(message), this.statusCode = statusCode;
7
+ errorCode;
8
+ constructor(message, statusCode, errorCode){
9
+ super(message), this.statusCode = statusCode, this.errorCode = errorCode;
9
10
  this.name = 'TokenRefreshError';
10
11
  }
11
12
  }
@@ -19,15 +20,17 @@ import * as log from '../utils/log.js';
19
20
  * @param clientId - OAuth2 client ID (defaults to config)
20
21
  * @returns Promise resolving to new tokens
21
22
  * @throws TokenRefreshError if refresh fails
22
- */ export async function refreshAccessToken(refreshToken, clientId = OAUTH_CONFIG.clientId) {
23
+ */ export async function refreshAccessToken(refreshToken, clientId) {
24
+ const oauthConfig = getOAuthConfig();
25
+ const resolvedClientId = clientId ?? oauthConfig.clientId;
23
26
  // Prepare form data for token refresh request (public client)
24
27
  const params = new URLSearchParams({
25
- client_id: clientId,
28
+ client_id: resolvedClientId,
26
29
  grant_type: 'refresh_token',
27
30
  refresh_token: refreshToken
28
31
  });
29
32
  try {
30
- const response = await fetch(OAUTH_CONFIG.refreshUrl, {
33
+ const response = await fetch(oauthConfig.refreshUrl, {
31
34
  method: 'POST',
32
35
  headers: {
33
36
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -36,7 +39,14 @@ import * as log from '../utils/log.js';
36
39
  });
37
40
  if (!response.ok) {
38
41
  const errorText = await response.text();
39
- throw new TokenRefreshError(`Token refresh failed: ${response.statusText}. ${errorText}`, response.status);
42
+ let errorCode;
43
+ try {
44
+ const parsed = JSON.parse(errorText);
45
+ errorCode = parsed.error;
46
+ } catch {
47
+ // Not JSON, leave errorCode undefined
48
+ }
49
+ throw new TokenRefreshError(`Token refresh failed: ${response.statusText}. ${errorText}`, response.status, errorCode);
40
50
  }
41
51
  const data = await response.json();
42
52
  // Validate response contains required fields
@@ -71,14 +81,17 @@ import * as log from '../utils/log.js';
71
81
  * @param clientId - OAuth2 client ID (defaults to config)
72
82
  * @returns Promise resolving to tokens
73
83
  * @throws TokenRefreshError if exchange fails
74
- */ export async function exchangeCodeForTokens(code, codeVerifier, redirectUri = OAUTH_CONFIG.redirectUri, clientId = OAUTH_CONFIG.clientId) {
84
+ */ export async function exchangeCodeForTokens(code, codeVerifier, redirectUri, clientId) {
85
+ const oauthConfig = getOAuthConfig();
86
+ const resolvedRedirectUri = redirectUri ?? oauthConfig.redirectUri;
87
+ const resolvedClientId = clientId ?? oauthConfig.clientId;
75
88
  // Prepare form data for token exchange (public client with PKCE)
76
89
  const params = new URLSearchParams({
77
- client_id: clientId,
90
+ client_id: resolvedClientId,
78
91
  code,
79
92
  code_verifier: codeVerifier,
80
93
  grant_type: 'authorization_code',
81
- redirect_uri: redirectUri
94
+ redirect_uri: resolvedRedirectUri
82
95
  });
83
96
  try {
84
97
  // Public client - no client secret or Basic Auth header needed
@@ -88,11 +101,11 @@ import * as log from '../utils/log.js';
88
101
  };
89
102
  // Debug logging
90
103
  log.debug(`Token exchange request: ${JSON.stringify({
91
- url: OAUTH_CONFIG.tokenUrl,
104
+ url: oauthConfig.tokenUrl,
92
105
  headers,
93
106
  body: params.toString()
94
107
  })}`);
95
- const response = await fetch(OAUTH_CONFIG.tokenUrl, {
108
+ const response = await fetch(oauthConfig.tokenUrl, {
96
109
  method: 'POST',
97
110
  headers,
98
111
  body: params.toString()
@@ -1,4 +1,13 @@
1
- import type { FigmaTokens, JWTPayload, ProjectToken, TokenStoreConfig } from './types.js';
1
+ import type { Environment } from '../constants.js';
2
+ import type { BootstrapData, FigmaTokens, JWTPayload, ProjectToken, TokenStoreConfig } from './types.js';
3
+ /**
4
+ * Get the singleton TokenStore instance for an environment
5
+ * Use this for all production code to ensure a single shared instance per environment
6
+ *
7
+ * @param environment - The environment to get the token store for
8
+ * @returns The singleton TokenStore instance for that environment
9
+ */
10
+ export declare function getTokenStore(environment?: Environment): TokenStore;
2
11
  /**
3
12
  * Secure storage manager for Figma OAuth2 tokens
4
13
  *
@@ -9,6 +18,9 @@ import type { FigmaTokens, JWTPayload, ProjectToken, TokenStoreConfig } from './
9
18
  *
10
19
  * Tokens are encrypted at rest with a machine-specific key and file permissions
11
20
  * are set to 0600 (owner read/write only)
21
+ *
22
+ * For production code, use getTokenStore() to get the singleton instance.
23
+ * The constructor is still exported for test isolation.
12
24
  */
13
25
  export declare class TokenStore {
14
26
  private config;
@@ -106,5 +118,32 @@ export declare class TokenStore {
106
118
  * @returns Array of tenant IDs
107
119
  */
108
120
  getAllProjectTokenTenantIds(): string[];
121
+ /**
122
+ * Build the composite key for bootstrap data storage
123
+ * @param projectId - The CMS resource/project ID
124
+ * @param environmentName - The environment name (e.g. 'production', 'staging')
125
+ * @returns Composite key string
126
+ */
127
+ private bootstrapKey;
128
+ /**
129
+ * Retrieve bootstrap data for a project + environment
130
+ * @param projectId - The CMS resource/project ID
131
+ * @param environmentName - The environment name
132
+ * @returns BootstrapData if stored, null otherwise
133
+ */
134
+ getBootstrapData(projectId: string, environmentName: string): BootstrapData | null;
135
+ /**
136
+ * Store bootstrap data for a project + environment
137
+ * @param projectId - The CMS resource/project ID
138
+ * @param environmentName - The environment name
139
+ * @param data - The bootstrap data to store
140
+ */
141
+ setBootstrapData(projectId: string, environmentName: string, data: BootstrapData): void;
142
+ /**
143
+ * Clear bootstrap data for a project + environment
144
+ * @param projectId - The CMS resource/project ID
145
+ * @param environmentName - The environment name
146
+ */
147
+ clearBootstrapData(projectId: string, environmentName: string): void;
109
148
  }
110
149
  //# sourceMappingURL=token-store.d.ts.map
@@ -1,6 +1,24 @@
1
1
  /* eslint-disable perfectionist/sort-classes */ import Conf from 'conf';
2
2
  import { TOKEN_EXPIRY_BUFFER_SECONDS } from '../config/oauth.js';
3
+ import { getInfraEnvironment } from '../constants.js';
3
4
  import { deriveEncryptionKey } from './crypto-utils.js';
5
+ /**
6
+ * Environment-keyed instances for singleton pattern
7
+ */ const instances = {};
8
+ /**
9
+ * Get the singleton TokenStore instance for an environment
10
+ * Use this for all production code to ensure a single shared instance per environment
11
+ *
12
+ * @param environment - The environment to get the token store for
13
+ * @returns The singleton TokenStore instance for that environment
14
+ */ export function getTokenStore(environment = getInfraEnvironment()) {
15
+ if (!instances[environment]) {
16
+ instances[environment] = new TokenStore({
17
+ environment
18
+ });
19
+ }
20
+ return instances[environment];
21
+ }
4
22
  /**
5
23
  * Secure storage manager for Figma OAuth2 tokens
6
24
  *
@@ -11,16 +29,22 @@ import { deriveEncryptionKey } from './crypto-utils.js';
11
29
  *
12
30
  * Tokens are encrypted at rest with a machine-specific key and file permissions
13
31
  * are set to 0600 (owner read/write only)
32
+ *
33
+ * For production code, use getTokenStore() to get the singleton instance.
34
+ * The constructor is still exported for test isolation.
14
35
  */ export class TokenStore {
15
36
  config;
16
37
  constructor(options){
38
+ if (process.env.AWS_EXECUTION_ENV) {
39
+ throw new Error('TokenStore cannot be used in AWS Lambda environments');
40
+ }
41
+ const environment = options?.environment ?? 'production';
42
+ const projectName = environment === 'production' ? 'payloadcms-figma' : `payloadcms-figma-${environment}`;
17
43
  this.config = new Conf({
18
- configName: options?.configName || 'payloadcms-figma',
19
- projectName: 'payloadcms-figma',
20
- // Enable encryption with machine-specific key for better security
44
+ clearInvalidConfig: true,
45
+ configName: options?.configName || projectName,
21
46
  encryptionKey: options?.encryptionKey || deriveEncryptionKey(),
22
- // Clear schema to avoid validation issues
23
- clearInvalidConfig: true
47
+ projectName
24
48
  });
25
49
  }
26
50
  /**
@@ -183,6 +207,42 @@ import { deriveEncryptionKey } from './crypto-utils.js';
183
207
  const projectTokens = this.config.get('projectTokens') || {};
184
208
  return Object.keys(projectTokens);
185
209
  }
210
+ /**
211
+ * Build the composite key for bootstrap data storage
212
+ * @param projectId - The CMS resource/project ID
213
+ * @param environmentName - The environment name (e.g. 'production', 'staging')
214
+ * @returns Composite key string
215
+ */ bootstrapKey(projectId, environmentName) {
216
+ return `${projectId}:${environmentName}`;
217
+ }
218
+ /**
219
+ * Retrieve bootstrap data for a project + environment
220
+ * @param projectId - The CMS resource/project ID
221
+ * @param environmentName - The environment name
222
+ * @returns BootstrapData if stored, null otherwise
223
+ */ getBootstrapData(projectId, environmentName) {
224
+ const allData = this.config.get('bootstrapData') || {};
225
+ return allData[this.bootstrapKey(projectId, environmentName)] || null;
226
+ }
227
+ /**
228
+ * Store bootstrap data for a project + environment
229
+ * @param projectId - The CMS resource/project ID
230
+ * @param environmentName - The environment name
231
+ * @param data - The bootstrap data to store
232
+ */ setBootstrapData(projectId, environmentName, data) {
233
+ const allData = this.config.get('bootstrapData') || {};
234
+ allData[this.bootstrapKey(projectId, environmentName)] = data;
235
+ this.config.set('bootstrapData', allData);
236
+ }
237
+ /**
238
+ * Clear bootstrap data for a project + environment
239
+ * @param projectId - The CMS resource/project ID
240
+ * @param environmentName - The environment name
241
+ */ clearBootstrapData(projectId, environmentName) {
242
+ const allData = this.config.get('bootstrapData') || {};
243
+ delete allData[this.bootstrapKey(projectId, environmentName)];
244
+ this.config.set('bootstrapData', allData);
245
+ }
186
246
  }
187
247
 
188
248
  //# sourceMappingURL=token-store.js.map
@@ -1,5 +1,6 @@
1
1
  import type { ErrorResponsePayloadWithErrMessage, ErrorResponsePayloadWithErrorBoolean, User } from '@figma/rest-api-spec';
2
2
  import type { JWTPayload as JoseJWTPayload } from 'jose';
3
+ import type { Environment } from '../constants.js';
3
4
  /**
4
5
  * Standard OAuth2 scopes for user-level permissions
5
6
  * @see https://www.figma.com/developers/api#oauth2
@@ -105,12 +106,14 @@ export interface OAuthTokenRefreshParams {
105
106
  /**
106
107
  * Configuration for token storage
107
108
  */
108
- export interface TokenStoreConfig {
109
- /** Custom config name (defaults to 'payloadcms-figma') */
109
+ export type TokenStoreConfig = {
110
+ /** Config file name (for testing) */
110
111
  configName?: string;
111
- /** Enable encryption (defaults to true) */
112
+ /** Encryption key (for testing) */
112
113
  encryptionKey?: string;
113
- }
114
+ /** Environment for config file naming */
115
+ environment?: Environment;
116
+ };
114
117
  /**
115
118
  * PKCE (Proof Key for Code Exchange) pair for OAuth2 public clients
116
119
  * @see https://datatracker.ietf.org/doc/html/rfc7636
@@ -158,6 +161,16 @@ export type FigmaErrorResponse = ErrorResponsePayloadWithErrMessage | ErrorRespo
158
161
  * Re-exported from @figma/rest-api-spec
159
162
  */
160
163
  export type FigmaUser = User;
164
+ /**
165
+ * Bootstrap data cached in the local encrypted store
166
+ * Keyed by projectId:environmentName
167
+ */
168
+ export type BootstrapData = {
169
+ contentSystemId: string;
170
+ oauthClientId: string;
171
+ oauthClientSecret: string;
172
+ tenantInstanceId: string;
173
+ };
161
174
  /**
162
175
  * JWT payload structure from Figma project tokens
163
176
  * Extends jose's standard JWTPayload with Figma-specific claims
package/dist/cli.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import * as p from '@clack/prompts';
2
2
  import arg from 'arg';
3
3
  import pc from 'picocolors';
4
+ import { buildLambdaZipCommand } from './commands/build-lambda-zip.js';
5
+ import { debugCommand } from './commands/debug.js';
4
6
  import { deployCommand } from './commands/deploy.js';
7
+ import { envCommand } from './commands/env.js';
5
8
  import { initCommand } from './commands/init.js';
6
9
  import { listTokensCommand } from './commands/list-tokens.js';
7
10
  import { loginCommand } from './commands/login.js';
8
11
  import { logoutCommand } from './commands/logout.js';
9
- import { feedbackOutro, helpMessage } from './utils/messages.js';
12
+ import { setInfraEnvironment } from './constants.js';
13
+ import { helpMessage } from './utils/messages.js';
10
14
  /**
11
15
  * Entrypoint for bin/cli.js
12
16
  */ export async function main() {
@@ -24,16 +28,22 @@ class Main {
24
28
  constructor(){
25
29
  // @ts-expect-error bad typings
26
30
  this.args = arg({
31
+ '--all': Boolean,
27
32
  '--debug': Boolean,
33
+ '--env': String,
28
34
  '--force': Boolean,
29
35
  '--help': Boolean,
30
36
  '--id': String,
37
+ '--infra-env': String,
31
38
  '--name': String,
32
39
  '--skip-auth': Boolean,
40
+ '--skip-build': Boolean,
41
+ '--version': Boolean,
33
42
  '--yes': Boolean,
34
43
  // Aliases
35
44
  '-f': '--force',
36
45
  '-h': '--help',
46
+ '-v': '--version',
37
47
  '-y': '--yes'
38
48
  }, {
39
49
  permissive: true
@@ -42,6 +52,19 @@ class Main {
42
52
  if (this.args['--debug']) {
43
53
  process.env.DEBUG = 'true';
44
54
  }
55
+ // Handle --infra-env flag for infrastructure environment switching
56
+ if (this.args['--infra-env']) {
57
+ const infraEnvArg = this.args['--infra-env'].toLowerCase();
58
+ if (infraEnvArg === 'prod' || infraEnvArg === 'production') {
59
+ setInfraEnvironment('production');
60
+ } else if (infraEnvArg === 'staging') {
61
+ setInfraEnvironment('staging');
62
+ } else {
63
+ // eslint-disable-next-line no-console
64
+ console.error(`Invalid --infra-env value: ${this.args['--infra-env']}. Use 'production' or 'staging'.`);
65
+ process.exit(1);
66
+ }
67
+ }
45
68
  }
46
69
  async init() {
47
70
  try {
@@ -49,30 +72,59 @@ class Main {
49
72
  helpMessage();
50
73
  process.exit(0);
51
74
  }
75
+ if (this.args['--version']) {
76
+ const { getOwnVersion } = await import('./utils/version-check.js');
77
+ const version = await getOwnVersion();
78
+ // eslint-disable-next-line no-console
79
+ console.log(version);
80
+ process.exit(0);
81
+ }
52
82
  // Get the subcommand (first non-flag argument)
53
83
  const subcommand = this.args._[0];
84
+ if (!subcommand) {
85
+ helpMessage();
86
+ process.exit(0);
87
+ }
88
+ // Debug command outputs plain text for copy-paste — skip styled intro
89
+ if (subcommand === 'debug') {
90
+ await debugCommand();
91
+ process.exit(0);
92
+ }
54
93
  // eslint-disable-next-line no-console
55
94
  console.log('\n');
56
95
  p.intro(pc.bgCyan(pc.black(' @payloadcms/figma ')));
57
96
  // Route to appropriate command handler
58
97
  switch(subcommand){
98
+ case 'build-lambda-zip':
99
+ await buildLambdaZipCommand();
100
+ break;
59
101
  case 'deploy':
60
102
  await deployCommand({
103
+ id: this.args['--id'],
61
104
  debug: this.args['--debug'],
105
+ env: this.args['--env'],
106
+ skipBuild: this.args['--skip-build'],
62
107
  yes: this.args['--yes']
63
108
  });
64
109
  break;
110
+ case 'env':
111
+ await envCommand({
112
+ name: this.args._[1]
113
+ });
114
+ break;
65
115
  case 'init':
66
116
  await initCommand({
67
117
  id: this.args['--id'],
68
118
  name: this.args['--name'],
69
119
  debug: this.args['--debug'],
120
+ env: this.args['--env'],
70
121
  force: this.args['--force'],
71
122
  skipAuth: this.args['--skip-auth']
72
123
  });
73
124
  break;
74
125
  case 'list-tokens':
75
126
  listTokensCommand({
127
+ all: this.args['--all'],
76
128
  debug: this.args['--debug']
77
129
  });
78
130
  break;
@@ -81,14 +133,10 @@ class Main {
81
133
  break;
82
134
  case 'logout':
83
135
  await logoutCommand({
136
+ all: this.args['--all'],
84
137
  debug: this.args['--debug']
85
138
  });
86
139
  break;
87
- case undefined:
88
- // No subcommand - show default message
89
- p.note("Let's create a new CMS!");
90
- p.outro(feedbackOutro());
91
- break;
92
140
  default:
93
141
  p.log.error(pc.red(`Unknown command: ${subcommand}`));
94
142
  p.note('Use --help to see available commands', 'Tip');
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Build Lambda deployment zip from current directory
3
+ */
4
+ export declare function buildLambdaZipCommand(): Promise<void>;
5
+ //# sourceMappingURL=build-lambda-zip.d.ts.map
@@ -0,0 +1,19 @@
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
+ }
18
+
19
+ //# sourceMappingURL=build-lambda-zip.js.map
@@ -0,0 +1,8 @@
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>;
8
+ //# sourceMappingURL=debug.d.ts.map