@payloadcms/figma 0.0.1-alpha.8 → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/control-plane.d.ts +56 -7
- package/dist/api/control-plane.js +188 -74
- package/dist/api/error-response.d.ts +36 -0
- package/dist/api/error-response.js +66 -0
- package/dist/api/figma-api.d.ts +24 -3
- package/dist/api/figma-api.js +110 -34
- package/dist/auth/browser.d.ts +0 -1
- package/dist/auth/browser.js +0 -2
- package/dist/auth/callback-server.d.ts +19 -8
- package/dist/auth/callback-server.js +72 -32
- package/dist/auth/credentials.d.ts +20 -0
- package/dist/auth/credentials.js +19 -0
- package/dist/auth/crypto-utils.d.ts +28 -1
- package/dist/auth/crypto-utils.js +132 -23
- package/dist/auth/jwt-validator.d.ts +23 -6
- package/dist/auth/jwt-validator.js +35 -9
- package/dist/auth/oauth-flow.d.ts +19 -4
- package/dist/auth/oauth-flow.js +151 -34
- package/dist/auth/paste-code.d.ts +33 -0
- package/dist/auth/paste-code.js +87 -0
- package/dist/auth/pkce.d.ts +0 -1
- package/dist/auth/pkce.js +0 -2
- package/dist/auth/project-token.d.ts +32 -17
- package/dist/auth/project-token.js +176 -68
- package/dist/auth/refresh.d.ts +2 -2
- package/dist/auth/refresh.js +25 -14
- package/dist/auth/token-store-migration.d.ts +57 -0
- package/dist/auth/token-store-migration.js +154 -0
- package/dist/auth/token-store.d.ts +63 -98
- package/dist/auth/token-store.js +405 -124
- package/dist/auth/types.d.ts +40 -6
- package/dist/auth/types.js +1 -3
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +102 -8
- package/dist/commands/bootstrap.d.ts +17 -0
- package/dist/commands/bootstrap.js +88 -0
- package/dist/commands/build-lambda-zip.d.ts +4 -0
- package/dist/commands/build-lambda-zip.js +17 -0
- package/dist/commands/debug.d.ts +7 -0
- package/dist/commands/debug.js +178 -0
- package/dist/commands/deploy.d.ts +11 -1
- package/dist/commands/deploy.js +193 -153
- package/dist/commands/dump-tokens.d.ts +11 -0
- package/dist/commands/dump-tokens.js +67 -0
- package/dist/commands/env.d.ts +12 -0
- package/dist/commands/env.js +86 -0
- package/dist/commands/init.d.ts +9 -6
- package/dist/commands/init.js +232 -152
- package/dist/commands/list-tokens.d.ts +3 -4
- package/dist/commands/list-tokens.js +24 -11
- package/dist/commands/login.d.ts +8 -2
- package/dist/commands/login.js +34 -18
- package/dist/commands/logout.d.ts +5 -5
- package/dist/commands/logout.js +77 -17
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.js +329 -0
- package/dist/commands/upload-schema.d.ts +8 -0
- package/dist/commands/upload-schema.js +91 -0
- package/dist/config/oauth.d.ts +17 -12
- package/dist/config/oauth.js +38 -39
- package/dist/constants.d.ts +63 -19
- package/dist/constants.js +158 -20
- package/dist/db-content-api/generated/content-api-types.d.ts +7574 -0
- package/dist/db-content-api/generated/content-api-types.js +5 -0
- package/dist/db-content-api/index.d.ts +37 -0
- package/dist/db-content-api/index.js +938 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +1 -0
- package/dist/db-content-api/temp-utilities/slug.js +1 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/sorting.js +37 -0
- package/dist/db-content-api/temp-utilities/types.d.ts +21 -0
- package/dist/db-content-api/temp-utilities/types.js +13 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +38 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +62 -0
- package/dist/db-content-api/utilities/auth.d.ts +29 -0
- package/dist/db-content-api/utilities/auth.js +82 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +6 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +10 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
- package/dist/db-content-api/utilities/data/index.d.ts +48 -0
- package/dist/db-content-api/utilities/data/index.js +299 -0
- package/dist/db-content-api/utilities/data/pointShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/pointShape.js +43 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +11 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +52 -0
- package/dist/db-content-api/utilities/data/richTextShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/richTextShape.js +56 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +47 -0
- package/dist/db-content-api/utilities/data/stripFields.js +170 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +22 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.js +40 -0
- package/dist/db-content-api/utilities/data/validateRelationships.d.ts +6 -0
- package/dist/db-content-api/utilities/data/validateRelationships.js +100 -0
- package/dist/db-content-api/utilities/joins.d.ts +52 -0
- package/dist/db-content-api/utilities/joins.js +137 -0
- package/dist/db-content-api/utilities/locale/index.d.ts +9 -0
- package/dist/db-content-api/utilities/locale/index.js +19 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +71 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +41 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js +39 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +16 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +243 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +12 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +60 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +100 -0
- package/dist/db-content-api/utilities/resolveBlocks.d.ts +19 -0
- package/dist/db-content-api/utilities/resolveBlocks.js +31 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +55 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +182 -0
- package/dist/db-content-api/utilities/where.d.ts +19 -0
- package/dist/db-content-api/utilities/where.js +106 -0
- package/dist/deploy/schedule-extract-plugin.d.ts +10 -0
- package/dist/deploy/schedule-extract-plugin.js +32 -0
- package/dist/endpoints/health.d.ts +2 -0
- package/dist/endpoints/health.js +9 -0
- package/dist/endpoints/schema.d.ts +2 -0
- package/dist/endpoints/schema.js +27 -0
- package/dist/exports/client.d.ts +2 -1
- package/dist/exports/client.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/lib/download-skill.d.ts +12 -0
- package/dist/lib/download-skill.js +77 -0
- package/dist/oauth/components/FigmaAvatar/index.d.ts +3 -0
- package/dist/oauth/components/FigmaAvatar/index.js +25 -0
- package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
- package/dist/oauth/components/FigmaAvatarCell/index.d.ts +4 -0
- package/dist/oauth/components/FigmaAvatarCell/index.js +23 -0
- package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +8 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +35 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +81 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.js +168 -0
- package/dist/oauth/components/LoginButton/index.d.ts +0 -1
- package/dist/oauth/components/LoginButton/index.js +156 -18
- package/dist/oauth/components/LoginButton/index.scss +75 -3
- package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
- package/dist/oauth/components/LogoutButton/index.js +20 -9
- package/dist/oauth/defaults.d.ts +3 -2
- package/dist/oauth/defaults.js +79 -12
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +87 -84
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -6
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js +18 -5
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -4
- package/dist/oauth/exports/client.d.ts +0 -1
- package/dist/oauth/exports/client.js +0 -2
- package/dist/oauth/hooks/afterLogout.d.ts +0 -1
- package/dist/oauth/hooks/afterLogout.js +0 -2
- package/dist/oauth/hooks/me.d.ts +0 -1
- package/dist/oauth/hooks/me.js +0 -2
- package/dist/oauth/hooks/refresh.d.ts +0 -1
- package/dist/oauth/hooks/refresh.js +2 -3
- package/dist/oauth/index.d.ts +0 -1
- package/dist/oauth/index.js +27 -7
- package/dist/oauth/strategy/index.d.ts +0 -3
- package/dist/oauth/strategy/index.js +55 -34
- package/dist/oauth/types.d.ts +23 -7
- package/dist/oauth/types.js +0 -2
- package/dist/oauth/utilities/buildUnauthorizedRedirect.d.ts +14 -0
- package/dist/oauth/utilities/buildUnauthorizedRedirect.js +28 -0
- package/dist/oauth/utilities/clearCookie.d.ts +0 -1
- package/dist/oauth/utilities/clearCookie.js +5 -3
- package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
- package/dist/oauth/utilities/createCookieOptions.js +9 -4
- package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
- package/dist/oauth/utilities/createDebugLogger.js +0 -2
- package/dist/oauth/utilities/establishSession.d.ts +22 -0
- package/dist/oauth/utilities/establishSession.js +80 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +23 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.js +26 -0
- package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
- package/dist/oauth/utilities/extractOrigin.js +0 -2
- package/dist/oauth/utilities/figmaHostnames.d.ts +2 -0
- package/dist/oauth/utilities/figmaHostnames.js +24 -0
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -2
- package/dist/oauth/utilities/getAuthorizeURL.js +57 -4
- package/dist/oauth/utilities/getCookieExpiration.d.ts +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js +0 -2
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js +0 -2
- package/dist/oauth/utilities/getTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getTokenExp.js +0 -2
- package/dist/oauth/utilities/getUsernameField.d.ts +0 -1
- package/dist/oauth/utilities/getUsernameField.js +0 -2
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js +0 -2
- package/dist/oauth/utilities/isAbsoluteURL.d.ts +1 -0
- package/dist/oauth/utilities/isAbsoluteURL.js +1 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +6 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +12 -0
- package/dist/oauth/utilities/mergeHeaders.d.ts +0 -1
- package/dist/oauth/utilities/mergeHeaders.js +0 -2
- package/dist/oauth/utilities/refreshTokens.d.ts +0 -1
- package/dist/oauth/utilities/refreshTokens.js +21 -13
- package/dist/oauth/utilities/withPartitionedCookie.d.ts +19 -0
- package/dist/oauth/utilities/withPartitionedCookie.js +26 -0
- package/dist/oauth/utils/getSearchParam.d.ts +17 -0
- package/dist/oauth/utils/getSearchParam.js +22 -0
- package/dist/plugin/adapter.d.ts +0 -1
- package/dist/plugin/adapter.js +0 -2
- package/dist/plugin/auth-preflight.d.ts +7 -0
- package/dist/plugin/auth-preflight.js +18 -0
- package/dist/plugin/bootstrap-preflight.d.ts +22 -0
- package/dist/plugin/bootstrap-preflight.js +43 -0
- package/dist/plugin/build-config.d.ts +27 -15
- package/dist/plugin/build-config.js +381 -18
- package/dist/plugin/dev-cookie-names.d.ts +13 -0
- package/dist/plugin/dev-cookie-names.js +17 -0
- package/dist/scss.d.js +2 -0
- package/dist/storage-content-api/api-types.d.ts +183 -0
- package/dist/storage-content-api/api-types.js +4 -0
- package/dist/storage-content-api/client-uploads/generate.d.ts +14 -0
- package/dist/storage-content-api/client-uploads/generate.js +69 -0
- package/dist/storage-content-api/client.d.ts +5 -0
- package/dist/storage-content-api/client.js +37 -0
- package/dist/storage-content-api/generateURL.d.ts +6 -0
- package/dist/storage-content-api/generateURL.js +6 -0
- package/dist/storage-content-api/handleDelete.d.ts +7 -0
- package/dist/storage-content-api/handleDelete.js +15 -0
- package/dist/storage-content-api/handleUpload.d.ts +10 -0
- package/dist/storage-content-api/handleUpload.js +162 -0
- package/dist/storage-content-api/index.d.ts +4 -0
- package/dist/storage-content-api/index.js +37 -0
- package/dist/storage-content-api/staticHandler.d.ts +9 -0
- package/dist/storage-content-api/staticHandler.js +61 -0
- package/dist/storage-content-api/types.d.ts +9 -0
- package/dist/storage-content-api/types.js +1 -0
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +11 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js +59 -0
- package/dist/storage-content-api/utilities/index.d.ts +2 -0
- package/dist/storage-content-api/utilities/index.js +2 -0
- package/dist/storage-content-api/utilities/parseUploadReference.d.ts +17 -0
- package/dist/storage-content-api/utilities/parseUploadReference.js +27 -0
- package/dist/templates/.env.example +5 -0
- package/dist/templates/README.md +19 -0
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.js +0 -4
- package/dist/types.d.ts +10 -2
- package/dist/types.js +0 -2
- package/dist/utils/adapters/nextjs.d.ts +8 -0
- package/dist/utils/adapters/nextjs.js +61 -0
- package/dist/utils/adapters/nitro.d.ts +8 -0
- package/dist/utils/adapters/nitro.js +172 -0
- package/dist/utils/adapters/vite.d.ts +9 -0
- package/dist/utils/adapters/vite.js +31 -0
- package/dist/utils/asset-collection.d.ts +27 -7
- package/dist/utils/asset-collection.js +59 -32
- package/dist/utils/build-detection.d.ts +5 -12
- package/dist/utils/build-detection.js +74 -13
- package/dist/utils/build-lambda-zip.d.ts +25 -0
- package/dist/utils/build-lambda-zip.js +90 -0
- package/dist/utils/cache-bootstrap.d.ts +7 -0
- package/dist/utils/cache-bootstrap.js +16 -0
- package/dist/utils/config.d.ts +0 -1
- package/dist/utils/config.js +1 -3
- package/dist/utils/deploy-adapter.d.ts +45 -0
- package/dist/utils/deploy-adapter.js +56 -0
- package/dist/utils/download-template.d.ts +9 -2
- package/dist/utils/download-template.js +24 -20
- package/dist/utils/env-management.d.ts +24 -8
- package/dist/utils/env-management.js +119 -66
- package/dist/utils/format-env-suffix.d.ts +11 -0
- package/dist/utils/format-env-suffix.js +11 -0
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.js +0 -2
- package/dist/utils/formatter.d.ts +0 -1
- package/dist/utils/formatter.js +23 -13
- package/dist/utils/fs-utils.d.ts +12 -0
- package/dist/utils/fs-utils.js +55 -0
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -2
- package/dist/utils/handle-upgrade.d.ts +8 -0
- package/dist/utils/handle-upgrade.js +39 -0
- package/dist/utils/is-debug.d.ts +0 -1
- package/dist/utils/is-debug.js +0 -2
- package/dist/utils/lambda-config.d.ts +3 -2
- package/dist/utils/lambda-config.js +75 -80
- package/dist/utils/load-payload-config.d.ts +9 -0
- package/dist/utils/load-payload-config.js +27 -0
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.js +0 -2
- package/dist/utils/messages.d.ts +1 -3
- package/dist/utils/messages.js +47 -13
- package/dist/utils/package-manager.d.ts +24 -1
- package/dist/utils/package-manager.js +53 -2
- package/dist/utils/parse-template-spec.d.ts +11 -0
- package/dist/utils/parse-template-spec.js +60 -0
- package/dist/utils/payload-config-ast.d.ts +27 -7
- package/dist/utils/payload-config-ast.js +106 -60
- package/dist/utils/payload-config-finder.d.ts +2 -3
- package/dist/utils/payload-config-finder.js +48 -11
- package/dist/utils/payload-config-modifier.d.ts +1 -2
- package/dist/utils/payload-config-modifier.js +114 -68
- package/dist/utils/payload-package-check.d.ts +28 -3
- package/dist/utils/payload-package-check.js +90 -31
- package/dist/utils/project.d.ts +8 -4
- package/dist/utils/project.js +63 -37
- package/dist/utils/resolve-environment.d.ts +13 -0
- package/dist/utils/resolve-environment.js +29 -0
- package/dist/utils/s3-upload.d.ts +7 -3
- package/dist/utils/s3-upload.js +44 -9
- package/dist/utils/token-display.d.ts +5 -2
- package/dist/utils/token-display.js +49 -24
- package/dist/utils/typescript-validator.d.ts +0 -1
- package/dist/utils/typescript-validator.js +4 -8
- package/dist/utils/version-check.d.ts +2 -0
- package/dist/utils/version-check.js +43 -0
- package/package.json +47 -16
- package/dist/api/control-plane.d.ts.map +0 -1
- package/dist/api/control-plane.js.map +0 -1
- package/dist/api/figma-api.d.ts.map +0 -1
- package/dist/api/figma-api.js.map +0 -1
- package/dist/auth/browser.d.ts.map +0 -1
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/callback-server.d.ts.map +0 -1
- package/dist/auth/callback-server.js.map +0 -1
- package/dist/auth/crypto-utils.d.ts.map +0 -1
- package/dist/auth/crypto-utils.js.map +0 -1
- package/dist/auth/jwt-validator.d.ts.map +0 -1
- package/dist/auth/jwt-validator.js.map +0 -1
- package/dist/auth/oauth-flow.d.ts.map +0 -1
- package/dist/auth/oauth-flow.js.map +0 -1
- package/dist/auth/pkce.d.ts.map +0 -1
- package/dist/auth/pkce.js.map +0 -1
- package/dist/auth/project-token.d.ts.map +0 -1
- package/dist/auth/project-token.js.map +0 -1
- package/dist/auth/refresh.d.ts.map +0 -1
- package/dist/auth/refresh.js.map +0 -1
- package/dist/auth/token-store.d.ts.map +0 -1
- package/dist/auth/token-store.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list-tokens.d.ts.map +0 -1
- package/dist/commands/list-tokens.js.map +0 -1
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js.map +0 -1
- package/dist/config/oauth.d.ts.map +0 -1
- package/dist/config/oauth.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LoginButton/index.js.map +0 -1
- package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LogoutButton/index.js.map +0 -1
- package/dist/oauth/defaults.d.ts.map +0 -1
- package/dist/oauth/defaults.js.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
- package/dist/oauth/exports/client.d.ts.map +0 -1
- package/dist/oauth/exports/client.js.map +0 -1
- package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
- package/dist/oauth/hooks/afterLogout.js.map +0 -1
- package/dist/oauth/hooks/me.d.ts.map +0 -1
- package/dist/oauth/hooks/me.js.map +0 -1
- package/dist/oauth/hooks/refresh.d.ts.map +0 -1
- package/dist/oauth/hooks/refresh.js.map +0 -1
- package/dist/oauth/index.d.ts.map +0 -1
- package/dist/oauth/index.js.map +0 -1
- package/dist/oauth/strategy/index.d.ts.map +0 -1
- package/dist/oauth/strategy/index.js.map +0 -1
- package/dist/oauth/types.d.ts.map +0 -1
- package/dist/oauth/types.js.map +0 -1
- package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
- package/dist/oauth/utilities/clearCookie.js.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
- package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
- package/dist/oauth/utilities/extractOrigin.js.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
- package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
- package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminPath.js +0 -9
- package/dist/oauth/utilities/getAdminPath.js.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
- package/dist/oauth/utilities/getUsernameField.js.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
- package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
- package/dist/oauth/utilities/refreshTokens.js.map +0 -1
- package/dist/plugin/adapter.d.ts.map +0 -1
- package/dist/plugin/adapter.js.map +0 -1
- package/dist/plugin/build-config.d.ts.map +0 -1
- package/dist/plugin/build-config.js.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/asset-collection.d.ts.map +0 -1
- package/dist/utils/asset-collection.js.map +0 -1
- package/dist/utils/build-detection.d.ts.map +0 -1
- package/dist/utils/build-detection.js.map +0 -1
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/download-template.d.ts.map +0 -1
- package/dist/utils/download-template.js.map +0 -1
- package/dist/utils/env-management.d.ts.map +0 -1
- package/dist/utils/env-management.js.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/formatter.d.ts.map +0 -1
- package/dist/utils/formatter.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/is-debug.d.ts.map +0 -1
- package/dist/utils/is-debug.js.map +0 -1
- package/dist/utils/lambda-config.d.ts.map +0 -1
- package/dist/utils/lambda-config.js.map +0 -1
- package/dist/utils/log.d.ts.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/payload-config-ast.d.ts.map +0 -1
- package/dist/utils/payload-config-ast.js.map +0 -1
- package/dist/utils/payload-config-finder.d.ts.map +0 -1
- package/dist/utils/payload-config-finder.js.map +0 -1
- package/dist/utils/payload-config-modifier.d.ts.map +0 -1
- package/dist/utils/payload-config-modifier.js.map +0 -1
- package/dist/utils/payload-package-check.d.ts.map +0 -1
- package/dist/utils/payload-package-check.js.map +0 -1
- package/dist/utils/project.d.ts.map +0 -1
- package/dist/utils/project.js.map +0 -1
- package/dist/utils/s3-upload.d.ts.map +0 -1
- package/dist/utils/s3-upload.js.map +0 -1
- package/dist/utils/token-display.d.ts.map +0 -1
- package/dist/utils/token-display.js.map +0 -1
- package/dist/utils/typescript-validator.d.ts.map +0 -1
- package/dist/utils/typescript-validator.js.map +0 -1
package/dist/auth/types.js
CHANGED
package/dist/cli.d.ts
CHANGED
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 {
|
|
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
|
-
|
|
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
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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,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,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
|