@payloadcms/figma 0.0.1-alpha.7 → 0.0.1-alpha.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/control-plane.d.ts +56 -6
- package/dist/api/control-plane.js +181 -72
- package/dist/api/figma-api.d.ts +22 -1
- package/dist/api/figma-api.js +78 -25
- package/dist/auth/callback-server.d.ts +19 -7
- package/dist/auth/callback-server.js +72 -30
- package/dist/auth/credentials.d.ts +21 -0
- package/dist/auth/credentials.js +21 -0
- package/dist/auth/crypto-utils.d.ts +28 -0
- package/dist/auth/crypto-utils.js +132 -21
- package/dist/auth/jwt-validator.d.ts +2 -1
- package/dist/auth/jwt-validator.js +2 -2
- package/dist/auth/oauth-flow.d.ts +19 -3
- package/dist/auth/oauth-flow.js +77 -22
- package/dist/auth/project-token.d.ts +32 -16
- package/dist/auth/project-token.js +171 -65
- package/dist/auth/refresh.d.ts +2 -1
- package/dist/auth/refresh.js +25 -12
- package/dist/auth/token-store-migration.d.ts +58 -0
- package/dist/auth/token-store-migration.js +156 -0
- package/dist/auth/token-store.d.ts +63 -97
- package/dist/auth/token-store.js +405 -122
- package/dist/auth/types.d.ts +35 -4
- package/dist/cli.js +93 -6
- package/dist/commands/bootstrap.d.ts +18 -0
- package/dist/commands/bootstrap.js +90 -0
- package/dist/commands/build-lambda-zip.d.ts +5 -0
- package/dist/commands/build-lambda-zip.js +19 -0
- package/dist/commands/debug.d.ts +8 -0
- package/dist/commands/debug.js +180 -0
- package/dist/commands/deploy.d.ts +9 -0
- package/dist/commands/deploy.js +180 -151
- package/dist/commands/dump-tokens.d.ts +12 -0
- package/dist/commands/dump-tokens.js +69 -0
- package/dist/commands/env.d.ts +13 -0
- package/dist/commands/env.js +88 -0
- package/dist/commands/init.d.ts +9 -5
- package/dist/commands/init.js +241 -148
- package/dist/commands/list-tokens.d.ts +3 -3
- package/dist/commands/list-tokens.js +24 -9
- package/dist/commands/login.d.ts +8 -1
- package/dist/commands/login.js +34 -16
- package/dist/commands/logout.d.ts +5 -4
- package/dist/commands/logout.js +77 -15
- package/dist/commands/upgrade.d.ts +5 -0
- package/dist/commands/upgrade.js +331 -0
- package/dist/config/oauth.d.ts +17 -11
- package/dist/config/oauth.js +38 -37
- package/dist/constants.d.ts +63 -18
- package/dist/constants.js +158 -18
- package/dist/db-content-api/generated/content-api-types.d.ts +3978 -0
- package/dist/db-content-api/generated/content-api-types.js +7 -0
- package/dist/db-content-api/index.d.ts +37 -0
- package/dist/db-content-api/index.js +923 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/slug.js +3 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +3 -0
- package/dist/db-content-api/temp-utilities/sorting.js +39 -0
- package/dist/db-content-api/temp-utilities/types.d.ts +22 -0
- package/dist/db-content-api/temp-utilities/types.js +15 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +39 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +64 -0
- package/dist/db-content-api/utilities/auth.d.ts +30 -0
- package/dist/db-content-api/utilities/auth.js +84 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +7 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +11 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +68 -0
- package/dist/db-content-api/utilities/data/index.d.ts +49 -0
- package/dist/db-content-api/utilities/data/index.js +301 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +12 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +54 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +48 -0
- package/dist/db-content-api/utilities/data/stripFields.js +195 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +23 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.js +42 -0
- package/dist/db-content-api/utilities/data/validateRelationships.d.ts +7 -0
- package/dist/db-content-api/utilities/data/validateRelationships.js +102 -0
- package/dist/db-content-api/utilities/joins.d.ts +53 -0
- package/dist/db-content-api/utilities/joins.js +139 -0
- package/dist/db-content-api/utilities/locale/index.d.ts +10 -0
- package/dist/db-content-api/utilities/locale/index.js +21 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +11 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +74 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +42 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js +41 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +17 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +244 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +13 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +62 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +102 -0
- package/dist/db-content-api/utilities/where.d.ts +20 -0
- package/dist/db-content-api/utilities/where.js +108 -0
- package/dist/deploy/schedule-extract-plugin.d.ts +11 -0
- package/dist/deploy/schedule-extract-plugin.js +34 -0
- package/dist/endpoints/health.d.ts +3 -0
- package/dist/endpoints/health.js +11 -0
- package/dist/endpoints/schema.d.ts +3 -0
- package/dist/endpoints/schema.js +29 -0
- package/dist/exports/client.d.ts +3 -0
- package/dist/exports/client.js +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/lib/download-skill.d.ts +13 -0
- package/dist/lib/download-skill.js +79 -0
- package/dist/oauth/components/FigmaAvatar/index.d.ts +4 -0
- package/dist/oauth/components/FigmaAvatar/index.js +27 -0
- package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
- package/dist/oauth/components/FigmaAvatarCell/index.d.ts +5 -0
- package/dist/oauth/components/FigmaAvatarCell/index.js +25 -0
- package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +9 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +37 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +82 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.js +170 -0
- package/dist/oauth/components/LoginButton/index.js +144 -11
- package/dist/oauth/components/LoginButton/index.scss +75 -3
- package/dist/oauth/components/LogoutButton/index.js +19 -6
- package/dist/oauth/defaults.d.ts +3 -1
- package/dist/oauth/defaults.js +68 -10
- package/dist/oauth/endpoints/getLoginEndpoint.js +72 -77
- package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -4
- package/dist/oauth/endpoints/getMetaEndpoint.js +18 -3
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -2
- package/dist/oauth/index.js +27 -5
- package/dist/oauth/strategy/index.d.ts +0 -2
- package/dist/oauth/strategy/index.js +40 -17
- package/dist/oauth/types.d.ts +23 -6
- package/dist/oauth/utilities/establishSession.d.ts +23 -0
- package/dist/oauth/utilities/establishSession.js +82 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +24 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.js +28 -0
- package/dist/oauth/utilities/figmaHostnames.d.ts +3 -0
- package/dist/oauth/utilities/figmaHostnames.js +26 -0
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -1
- package/dist/oauth/utilities/getAuthorizeURL.js +57 -2
- package/dist/oauth/utilities/isAbsoluteURL.d.ts +2 -0
- package/dist/oauth/utilities/isAbsoluteURL.js +3 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +7 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +14 -0
- package/dist/oauth/utilities/refreshTokens.js +6 -3
- package/dist/plugin/auth-preflight.d.ts +8 -0
- package/dist/plugin/auth-preflight.js +20 -0
- package/dist/plugin/bootstrap-preflight.d.ts +23 -0
- package/dist/plugin/bootstrap-preflight.js +45 -0
- package/dist/plugin/build-config.d.ts +27 -15
- package/dist/plugin/build-config.js +327 -17
- package/dist/plugin/dev-cookie-names.d.ts +14 -0
- package/dist/plugin/dev-cookie-names.js +19 -0
- package/dist/storage-content-api/api-types.d.ts +168 -0
- package/dist/storage-content-api/api-types.js +6 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +9 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +43 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +13 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.js +39 -0
- package/dist/storage-content-api/client.d.ts +6 -0
- package/dist/storage-content-api/client.js +39 -0
- package/dist/storage-content-api/generateURL.d.ts +7 -0
- package/dist/storage-content-api/generateURL.js +8 -0
- package/dist/storage-content-api/handleDelete.d.ts +8 -0
- package/dist/storage-content-api/handleDelete.js +17 -0
- package/dist/storage-content-api/handleUpload.d.ts +11 -0
- package/dist/storage-content-api/handleUpload.js +144 -0
- package/dist/storage-content-api/index.d.ts +5 -0
- package/dist/storage-content-api/index.js +31 -0
- package/dist/storage-content-api/staticHandler.d.ts +10 -0
- package/dist/storage-content-api/staticHandler.js +63 -0
- package/dist/storage-content-api/types.d.ts +10 -0
- package/dist/storage-content-api/types.js +3 -0
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +12 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js +61 -0
- package/dist/storage-content-api/utilities/index.d.ts +3 -0
- package/dist/storage-content-api/utilities/index.js +4 -0
- package/dist/storage-content-api/utilities/parseClientUploadContext.d.ts +19 -0
- package/dist/storage-content-api/utilities/parseClientUploadContext.js +30 -0
- package/dist/templates/.env.example +5 -0
- package/dist/templates/README.md +19 -0
- package/dist/types/config.d.ts +2 -1
- package/dist/types/config.js +0 -2
- package/dist/types.d.ts +10 -1
- package/dist/utils/adapters/nextjs.d.ts +9 -0
- package/dist/utils/adapters/nextjs.js +64 -0
- package/dist/utils/adapters/nitro.d.ts +9 -0
- package/dist/utils/adapters/nitro.js +169 -0
- package/dist/utils/adapters/vite.d.ts +10 -0
- package/dist/utils/adapters/vite.js +33 -0
- package/dist/utils/asset-collection.d.ts +27 -6
- package/dist/utils/asset-collection.js +59 -30
- package/dist/utils/build-detection.d.ts +5 -11
- package/dist/utils/build-detection.js +74 -11
- package/dist/utils/build-lambda-zip.d.ts +16 -0
- package/dist/utils/build-lambda-zip.js +78 -0
- package/dist/utils/cache-bootstrap.d.ts +8 -0
- package/dist/utils/cache-bootstrap.js +18 -0
- package/dist/utils/config.js +1 -1
- package/dist/utils/deploy-adapter.d.ts +40 -0
- package/dist/utils/deploy-adapter.js +58 -0
- package/dist/utils/download-template.d.ts +9 -1
- package/dist/utils/download-template.js +24 -18
- package/dist/utils/env-management.d.ts +24 -7
- package/dist/utils/env-management.js +119 -64
- package/dist/utils/format-env-suffix.d.ts +12 -0
- package/dist/utils/format-env-suffix.js +13 -0
- package/dist/utils/formatter.js +23 -11
- package/dist/utils/fs-utils.d.ts +6 -0
- package/dist/utils/fs-utils.js +27 -0
- package/dist/utils/handle-upgrade.d.ts +9 -0
- package/dist/utils/handle-upgrade.js +41 -0
- package/dist/utils/lambda-config.d.ts +3 -1
- package/dist/utils/lambda-config.js +75 -78
- package/dist/utils/messages.d.ts +1 -2
- package/dist/utils/messages.js +39 -11
- package/dist/utils/package-manager.d.ts +24 -0
- package/dist/utils/package-manager.js +53 -0
- package/dist/utils/parse-template-spec.d.ts +12 -0
- package/dist/utils/parse-template-spec.js +62 -0
- package/dist/utils/payload-config-ast.d.ts +27 -6
- package/dist/utils/payload-config-ast.js +106 -58
- package/dist/utils/payload-config-finder.d.ts +2 -2
- package/dist/utils/payload-config-finder.js +48 -9
- package/dist/utils/payload-config-modifier.d.ts +1 -1
- package/dist/utils/payload-config-modifier.js +114 -66
- package/dist/utils/payload-package-check.d.ts +33 -2
- package/dist/utils/payload-package-check.js +129 -28
- package/dist/utils/project.d.ts +7 -2
- package/dist/utils/project.js +60 -32
- package/dist/utils/resolve-environment.d.ts +14 -0
- package/dist/utils/resolve-environment.js +31 -0
- package/dist/utils/s3-upload.d.ts +7 -2
- package/dist/utils/s3-upload.js +39 -6
- package/dist/utils/token-display.d.ts +5 -1
- package/dist/utils/token-display.js +49 -22
- package/dist/utils/typescript-validator.js +4 -6
- package/dist/utils/version-check.d.ts +3 -0
- package/dist/utils/version-check.js +38 -0
- package/package.json +44 -15
- 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/config/oauth.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
authorizationUrl: 'https://staging.figma.com/oauth',
|
|
10
|
-
refreshUrl: 'https://api.staging.figma.com/v1/oauth/refresh',
|
|
11
|
-
tokenUrl: 'https://api.staging.figma.com/v1/oauth/token'
|
|
12
|
-
}
|
|
13
|
-
};
|
|
1
|
+
import { getEnvConfig, getInfraEnvironment } from '../constants.js';
|
|
2
|
+
export const DEFAULT_CALLBACK_PORTS = [
|
|
3
|
+
34462,
|
|
4
|
+
34463,
|
|
5
|
+
34464,
|
|
6
|
+
34465
|
|
7
|
+
];
|
|
8
|
+
export const DEFAULT_CALLBACK_PORT = DEFAULT_CALLBACK_PORTS[0];
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
10
|
+
* Get OAuth configuration for current environment.
|
|
16
11
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
12
|
+
* `apiBaseUrl` (FIGMA_API_BASE_URL) and `authorizationUrl` (FIGMA_WEB_BASE_URL)
|
|
13
|
+
* are resolved by `getEnvConfig`; this function only layers on the OAuth-client
|
|
14
|
+
* specifics it owns:
|
|
15
|
+
* FIGMA_CLIENT_ID → clientId
|
|
16
|
+
* FIGMA_REDIRECT_URI → redirectUri
|
|
20
17
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*/ export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
18
|
+
* When FIGMA_INFRA_ENV=devbox, FIGMA_API_BASE_URL and FIGMA_WEB_BASE_URL are
|
|
19
|
+
* required (the devbox preset has empty URL defaults, to fail closed).
|
|
20
|
+
*/ export function getOAuthConfig() {
|
|
21
|
+
const { apiBaseUrl, authorizationUrl, clientId } = getEnvConfig();
|
|
22
|
+
if (getInfraEnvironment() === 'devbox' && (!apiBaseUrl || !authorizationUrl)) {
|
|
23
|
+
throw new Error('FIGMA_API_BASE_URL and FIGMA_WEB_BASE_URL must be set when FIGMA_INFRA_ENV=devbox');
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
authorizationUrl,
|
|
27
|
+
clientId: process.env.FIGMA_CLIENT_ID || clientId,
|
|
28
|
+
redirectUri: process.env.FIGMA_REDIRECT_URI || `http://localhost:${DEFAULT_CALLBACK_PORT}/callback`,
|
|
29
|
+
refreshUrl: `${apiBaseUrl}/v1/oauth/refresh`,
|
|
30
|
+
scopes: [
|
|
31
|
+
'current_user:read'
|
|
32
|
+
],
|
|
33
|
+
tokenUrl: `${apiBaseUrl}/v1/oauth/token`
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export const TOKEN_EXPIRY_BUFFER_SECONDS = 300;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
* Freshness buffer for project tokens. Figma's `pixie` issues 300-second project
|
|
39
|
+
* tokens, so reusing the 300-second OAuth buffer would treat every fresh token as
|
|
40
|
+
* already-expired and bypass the cache entirely. 30 seconds is well above the
|
|
41
|
+
* round-trip time for the calls these tokens authorize.
|
|
42
|
+
*/ export const PROJECT_TOKEN_EXPIRY_BUFFER_SECONDS = 30;
|
|
42
43
|
|
|
43
44
|
//# sourceMappingURL=oauth.js.map
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,27 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Figma infrastructure environment (production, staging, or devbox).
|
|
3
|
+
* devbox is a local-dev mode that requires FIGMA_API_BASE_URL and
|
|
4
|
+
* FIGMA_WEB_BASE_URL env overrides to point at a Coder devbox.
|
|
5
|
+
*/
|
|
6
|
+
export type Environment = 'devbox' | 'production' | 'staging';
|
|
7
|
+
type EnvironmentConfig = {
|
|
8
|
+
/** Figma API base URL. Override: FIGMA_API_BASE_URL */
|
|
9
|
+
apiBaseUrl: string;
|
|
10
|
+
/** OAuth authorization URL (CLI auth) */
|
|
11
|
+
authorizationUrl: string;
|
|
12
|
+
/** OAuth client ID. Override: FIGMA_CLIENT_ID or FIGMA_OAUTH_CLIENT_ID */
|
|
13
|
+
clientId: string;
|
|
14
|
+
/** Content API base URL. Override: FIGMA_CONTENT_API_URL */
|
|
15
|
+
contentApiUrl: string;
|
|
16
|
+
/** OIDC discovery endpoint */
|
|
17
|
+
identityMetadata: string;
|
|
18
|
+
/** JSON Web Key Set URL for token validation */
|
|
19
|
+
jwksUri: string;
|
|
8
20
|
};
|
|
9
21
|
/**
|
|
10
|
-
*
|
|
22
|
+
* User-facing error message when Content API returns 404 or 410.
|
|
23
|
+
* Used by the db adapter for consistent messaging at runtime.
|
|
11
24
|
*/
|
|
12
|
-
export
|
|
25
|
+
export declare const CONTENT_SYSTEM_NOT_FOUND_MESSAGE = "Content system not found. Verify your Content System ID is correct, or contact your team admin for assistance.";
|
|
13
26
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
* Build a user-facing error message for CLI commands when a project is not found (404/410).
|
|
28
|
+
* Includes infra-env context and actionable suggestions.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getProjectNotFoundMessage(params: {
|
|
31
|
+
environment: Environment;
|
|
32
|
+
projectId: string;
|
|
33
|
+
}): string;
|
|
34
|
+
/**
|
|
35
|
+
* Set infrastructure environment override (used by --infra-env CLI flag)
|
|
36
|
+
* Pass undefined to clear the override
|
|
18
37
|
*/
|
|
19
|
-
export declare function
|
|
38
|
+
export declare function setInfraEnvironment(env: Environment | undefined): void;
|
|
20
39
|
/**
|
|
21
|
-
*
|
|
40
|
+
* Resolve the EnvironmentConfig for an infrastructure environment, applying the
|
|
41
|
+
* `process.env` overrides that the Make-preview sandbox (and devbox/staging)
|
|
42
|
+
* depend on. This is a FUNCTION, not a populated constant, because those env
|
|
43
|
+
* vars may be set after module load — resolving them lazily at call time keeps
|
|
44
|
+
* the values current (the empty `devbox` preset is filled here, not at import).
|
|
45
|
+
*
|
|
46
|
+
* This is the single place these `process.env` overrides are parsed; callers
|
|
47
|
+
* (including `getOAuthConfig`) read the resolved values from here rather than
|
|
48
|
+
* re-parsing the env vars themselves. Three overrides, each keyed off the axis
|
|
49
|
+
* it belongs to:
|
|
50
|
+
*
|
|
51
|
+
* - `apiBaseUrl` ← `FIGMA_API_BASE_URL` (Control Plane / token host).
|
|
52
|
+
*
|
|
53
|
+
* - `authorizationUrl` / `identityMetadata` ← `FIGMA_WEB_BASE_URL`. The
|
|
54
|
+
* authorization code is minted by the SAME Figma host the editor runs on, so
|
|
55
|
+
* the token exchange / OIDC discovery must hit THAT host. Without this the
|
|
56
|
+
* plugin falls back to `www.figma.com`, the devbox-minted code is rejected
|
|
57
|
+
* with `invalid_grant`, and the admin login loops forever.
|
|
58
|
+
*
|
|
59
|
+
* - `jwksUri` ← `FIGMA_CONTENT_API_URL` (the content backend that signs the
|
|
60
|
+
* project token, independent of the OAuth host — see `deriveContentJwksUri`).
|
|
61
|
+
*
|
|
62
|
+
* In production the platform injects `FIGMA_WEB_BASE_URL=https://www.figma.com`
|
|
63
|
+
* and a `figmacontent.com` content URL, so the derived values equal the presets
|
|
64
|
+
* and behavior is unchanged.
|
|
22
65
|
*
|
|
23
|
-
* @param
|
|
24
|
-
*
|
|
66
|
+
* @param environment - the infrastructure environment to resolve; defaults to
|
|
67
|
+
* the one reported by `getInfraEnvironment()`.
|
|
25
68
|
*/
|
|
26
|
-
export declare function
|
|
69
|
+
export declare function getEnvConfig(environment?: Environment): EnvironmentConfig;
|
|
70
|
+
export declare function getInfraEnvironment(): Environment;
|
|
71
|
+
export {};
|
|
27
72
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1,27 +1,167 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
production:
|
|
7
|
-
|
|
1
|
+
import { getEnvVarSync } from './utils/env-management.js';
|
|
2
|
+
/**
|
|
3
|
+
* Environment-specific configuration for Figma integration.
|
|
4
|
+
* Selected via FIGMA_INFRA_ENV ('production' | 'staging'), defaults to 'production'.
|
|
5
|
+
*/ const ENV_CONFIG = {
|
|
6
|
+
production: {
|
|
7
|
+
apiBaseUrl: 'https://api.figma.com',
|
|
8
|
+
authorizationUrl: 'https://www.figma.com/oauth',
|
|
9
|
+
clientId: 'lelKVTAzOekFnirnlAMbuD',
|
|
10
|
+
contentApiUrl: 'https://us-east-1.cms-tenants-001-production.figmacontent.com',
|
|
11
|
+
identityMetadata: 'https://www.figma.com/.well-known/openid-configuration',
|
|
12
|
+
jwksUri: 'https://static.figmacontent.com/.well_known/jwks.json'
|
|
13
|
+
},
|
|
14
|
+
staging: {
|
|
15
|
+
apiBaseUrl: 'https://api.staging.figma.com',
|
|
16
|
+
authorizationUrl: 'https://staging.figma.com/oauth',
|
|
17
|
+
clientId: 'wqAToBAp4UI9AZ5M6wTfT9',
|
|
18
|
+
contentApiUrl: 'https://us-east-1.cms-tenants-001-staging.figmacontentstaging.com',
|
|
19
|
+
identityMetadata: 'https://staging.figma.com/.well-known/openid-configuration',
|
|
20
|
+
jwksUri: 'https://static.figmacontentstaging.com/.well_known/jwks.json'
|
|
21
|
+
},
|
|
22
|
+
// Empty URLs are intentional: devbox mode requires FIGMA_API_BASE_URL and
|
|
23
|
+
// FIGMA_WEB_BASE_URL to be set, validated at getOAuthConfig() time.
|
|
24
|
+
// clientId defaults to the dev seed value in sinatra/db/seeds.rb.
|
|
25
|
+
devbox: {
|
|
26
|
+
apiBaseUrl: '',
|
|
27
|
+
authorizationUrl: '',
|
|
28
|
+
clientId: 'rNZBcf3xBDmI76mQ9603su',
|
|
29
|
+
contentApiUrl: '',
|
|
30
|
+
identityMetadata: '',
|
|
31
|
+
jwksUri: ''
|
|
32
|
+
}
|
|
8
33
|
};
|
|
9
34
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
35
|
+
* User-facing error message when Content API returns 404 or 410.
|
|
36
|
+
* Used by the db adapter for consistent messaging at runtime.
|
|
37
|
+
*/ export const CONTENT_SYSTEM_NOT_FOUND_MESSAGE = 'Content system not found. Verify your Content System ID is correct, or contact your team admin for assistance.';
|
|
38
|
+
/**
|
|
39
|
+
* Build a user-facing error message for CLI commands when a project is not found (404/410).
|
|
40
|
+
* Includes infra-env context and actionable suggestions.
|
|
41
|
+
*/ export function getProjectNotFoundMessage(params) {
|
|
42
|
+
const { environment, projectId } = params;
|
|
43
|
+
return [
|
|
44
|
+
`Project not found on ${environment} (ID: ${projectId}).`,
|
|
45
|
+
'',
|
|
46
|
+
'Suggestions:',
|
|
47
|
+
' • Verify your project ID is correct',
|
|
48
|
+
" • Ensure you're logged into the correct Figma account",
|
|
49
|
+
' • Contact your team admin for assistance'
|
|
50
|
+
].join('\n');
|
|
51
|
+
}
|
|
52
|
+
let envOverride;
|
|
53
|
+
/**
|
|
54
|
+
* Set infrastructure environment override (used by --infra-env CLI flag)
|
|
55
|
+
* Pass undefined to clear the override
|
|
56
|
+
*/ export function setInfraEnvironment(env) {
|
|
57
|
+
envOverride = env;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get current Figma infrastructure environment
|
|
61
|
+
* Priority: 1) setInfraEnvironment override, 2) FIGMA_INFRA_ENV env var, 3) .env file, 4) 'production' default
|
|
62
|
+
*/ /**
|
|
63
|
+
* Derive the project-token JWKS URI from the content/CMS API domain
|
|
64
|
+
* (`FIGMA_CONTENT_API_URL`), or `undefined` when it is unset or malformed.
|
|
12
65
|
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
66
|
+
* The project token is signed by the content backend, whose JWKS host tracks
|
|
67
|
+
* the content env — NOT the OAuth/infra env. A devbox or staging tenant runs
|
|
68
|
+
* on the staging content backend (`*.figmacontentstaging.com`) even when OAuth
|
|
69
|
+
* points at a devbox host, so its tokens are signed by the staging key and must
|
|
70
|
+
* validate against `static.figmacontentstaging.com`. Returning `undefined` lets
|
|
71
|
+
* the caller fall back to the per-env preset.
|
|
72
|
+
*/ function deriveContentJwksUri() {
|
|
73
|
+
const contentApiUrl = process.env.FIGMA_CONTENT_API_URL;
|
|
74
|
+
if (!contentApiUrl) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const host = new URL(contentApiUrl).hostname;
|
|
79
|
+
const match = host.match(/(figmacontentstaging\.com|figmacontent\.com)$/);
|
|
80
|
+
if (match) {
|
|
81
|
+
return `https://static.${match[1]}/.well_known/jwks.json`;
|
|
82
|
+
}
|
|
83
|
+
} catch {
|
|
84
|
+
// Malformed URL — fall through to the per-env preset.
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
16
87
|
}
|
|
17
88
|
/**
|
|
18
|
-
*
|
|
89
|
+
* Resolve the EnvironmentConfig for an infrastructure environment, applying the
|
|
90
|
+
* `process.env` overrides that the Make-preview sandbox (and devbox/staging)
|
|
91
|
+
* depend on. This is a FUNCTION, not a populated constant, because those env
|
|
92
|
+
* vars may be set after module load — resolving them lazily at call time keeps
|
|
93
|
+
* the values current (the empty `devbox` preset is filled here, not at import).
|
|
19
94
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
95
|
+
* This is the single place these `process.env` overrides are parsed; callers
|
|
96
|
+
* (including `getOAuthConfig`) read the resolved values from here rather than
|
|
97
|
+
* re-parsing the env vars themselves. Three overrides, each keyed off the axis
|
|
98
|
+
* it belongs to:
|
|
99
|
+
*
|
|
100
|
+
* - `apiBaseUrl` ← `FIGMA_API_BASE_URL` (Control Plane / token host).
|
|
101
|
+
*
|
|
102
|
+
* - `authorizationUrl` / `identityMetadata` ← `FIGMA_WEB_BASE_URL`. The
|
|
103
|
+
* authorization code is minted by the SAME Figma host the editor runs on, so
|
|
104
|
+
* the token exchange / OIDC discovery must hit THAT host. Without this the
|
|
105
|
+
* plugin falls back to `www.figma.com`, the devbox-minted code is rejected
|
|
106
|
+
* with `invalid_grant`, and the admin login loops forever.
|
|
107
|
+
*
|
|
108
|
+
* - `jwksUri` ← `FIGMA_CONTENT_API_URL` (the content backend that signs the
|
|
109
|
+
* project token, independent of the OAuth host — see `deriveContentJwksUri`).
|
|
110
|
+
*
|
|
111
|
+
* In production the platform injects `FIGMA_WEB_BASE_URL=https://www.figma.com`
|
|
112
|
+
* and a `figmacontent.com` content URL, so the derived values equal the presets
|
|
113
|
+
* and behavior is unchanged.
|
|
114
|
+
*
|
|
115
|
+
* @param environment - the infrastructure environment to resolve; defaults to
|
|
116
|
+
* the one reported by `getInfraEnvironment()`.
|
|
117
|
+
*/ export function getEnvConfig(environment = getInfraEnvironment()) {
|
|
118
|
+
const config = {
|
|
119
|
+
...ENV_CONFIG[environment]
|
|
120
|
+
};
|
|
121
|
+
const apiBaseUrl = process.env.FIGMA_API_BASE_URL?.replace(/\/+$/, '');
|
|
122
|
+
if (apiBaseUrl) {
|
|
123
|
+
config.apiBaseUrl = apiBaseUrl;
|
|
124
|
+
}
|
|
125
|
+
const webBaseUrl = process.env.FIGMA_WEB_BASE_URL?.replace(/\/+$/, '');
|
|
126
|
+
if (webBaseUrl) {
|
|
127
|
+
config.authorizationUrl = `${webBaseUrl}/oauth`;
|
|
128
|
+
config.identityMetadata = `${webBaseUrl}/.well-known/openid-configuration`;
|
|
129
|
+
}
|
|
130
|
+
const jwksUri = deriveContentJwksUri();
|
|
131
|
+
if (jwksUri) {
|
|
132
|
+
config.jwksUri = jwksUri;
|
|
133
|
+
}
|
|
134
|
+
return config;
|
|
135
|
+
}
|
|
136
|
+
export function getInfraEnvironment() {
|
|
137
|
+
if (envOverride) {
|
|
138
|
+
return envOverride;
|
|
139
|
+
}
|
|
140
|
+
// Check process.env first (case-insensitive)
|
|
141
|
+
const processEnv = process.env.FIGMA_INFRA_ENV?.toLowerCase();
|
|
142
|
+
if (processEnv === 'staging') {
|
|
143
|
+
return 'staging';
|
|
144
|
+
}
|
|
145
|
+
if (processEnv === 'devbox') {
|
|
146
|
+
return 'devbox';
|
|
147
|
+
}
|
|
148
|
+
// Fall back to .env file in cwd (check both new and old env var names)
|
|
149
|
+
const envFileValue = getEnvVarSync(process.cwd(), 'FIGMA_INFRA_ENV') ?? getEnvVarSync(process.cwd(), 'FIGMA_ENV');
|
|
150
|
+
if (envFileValue) {
|
|
151
|
+
const env = envFileValue.toLowerCase();
|
|
152
|
+
if (env === 'staging') {
|
|
153
|
+
return 'staging';
|
|
154
|
+
}
|
|
155
|
+
if (env === 'devbox') {
|
|
156
|
+
return 'devbox';
|
|
157
|
+
}
|
|
158
|
+
if (env !== 'production') {
|
|
159
|
+
// eslint-disable-next-line no-console
|
|
160
|
+
console.warn(`Warning: Invalid FIGMA_INFRA_ENV value "${envFileValue}" in .env file. Using production.`);
|
|
161
|
+
}
|
|
162
|
+
return 'production';
|
|
163
|
+
}
|
|
164
|
+
return 'production';
|
|
25
165
|
}
|
|
26
166
|
|
|
27
167
|
//# sourceMappingURL=constants.js.map
|