@payloadcms/figma 0.0.1-alpha.73 → 0.0.1-alpha.75
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 +0 -1
- package/dist/api/control-plane.js +0 -2
- package/dist/api/error-response.d.ts +0 -1
- package/dist/api/error-response.js +0 -2
- package/dist/api/figma-api.d.ts +2 -2
- package/dist/api/figma-api.js +33 -5
- package/dist/auth/browser.d.ts +0 -1
- package/dist/auth/browser.js +0 -2
- package/dist/auth/callback-server.d.ts +0 -1
- package/dist/auth/callback-server.js +0 -2
- package/dist/auth/credentials.d.ts +0 -1
- package/dist/auth/credentials.js +0 -2
- package/dist/auth/crypto-utils.d.ts +0 -1
- package/dist/auth/crypto-utils.js +0 -2
- package/dist/auth/jwt-validator.d.ts +22 -6
- package/dist/auth/jwt-validator.js +33 -7
- package/dist/auth/oauth-flow.d.ts +0 -1
- package/dist/auth/oauth-flow.js +0 -2
- package/dist/auth/paste-code.d.ts +0 -1
- package/dist/auth/paste-code.js +0 -2
- package/dist/auth/pkce.d.ts +0 -1
- package/dist/auth/pkce.js +0 -2
- package/dist/auth/project-token.d.ts +0 -1
- package/dist/auth/project-token.js +6 -4
- package/dist/auth/refresh.d.ts +0 -1
- package/dist/auth/refresh.js +0 -2
- package/dist/auth/token-store-migration.d.ts +0 -1
- package/dist/auth/token-store-migration.js +0 -2
- package/dist/auth/token-store.d.ts +0 -1
- package/dist/auth/token-store.js +0 -2
- package/dist/auth/types.d.ts +5 -2
- package/dist/auth/types.js +1 -3
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +7 -2
- package/dist/commands/bootstrap.d.ts +0 -1
- package/dist/commands/bootstrap.js +0 -2
- package/dist/commands/build-lambda-zip.d.ts +0 -1
- package/dist/commands/build-lambda-zip.js +0 -2
- package/dist/commands/debug.d.ts +0 -1
- package/dist/commands/debug.js +0 -2
- package/dist/commands/deploy.d.ts +0 -1
- package/dist/commands/deploy.js +0 -2
- package/dist/commands/dump-tokens.d.ts +0 -1
- package/dist/commands/dump-tokens.js +0 -2
- package/dist/commands/env.d.ts +0 -1
- package/dist/commands/env.js +0 -2
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +0 -2
- package/dist/commands/list-tokens.d.ts +0 -1
- package/dist/commands/list-tokens.js +0 -2
- package/dist/commands/login.d.ts +0 -1
- package/dist/commands/login.js +0 -2
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -2
- package/dist/commands/upgrade.d.ts +0 -1
- package/dist/commands/upgrade.js +0 -2
- package/dist/commands/upload-schema.d.ts +8 -0
- package/dist/commands/upload-schema.js +91 -0
- package/dist/config/oauth.d.ts +0 -1
- package/dist/config/oauth.js +0 -2
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -2
- package/dist/db-content-api/generated/content-api-types.d.ts +4188 -592
- package/dist/db-content-api/generated/content-api-types.js +0 -2
- package/dist/db-content-api/index.d.ts +0 -1
- package/dist/db-content-api/index.js +0 -2
- package/dist/db-content-api/temp-utilities/slug.d.ts +0 -1
- package/dist/db-content-api/temp-utilities/slug.js +0 -2
- package/dist/db-content-api/temp-utilities/sorting.d.ts +0 -1
- package/dist/db-content-api/temp-utilities/sorting.js +0 -2
- package/dist/db-content-api/temp-utilities/types.d.ts +0 -1
- package/dist/db-content-api/temp-utilities/types.js +0 -2
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +0 -1
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +0 -2
- package/dist/db-content-api/utilities/auth.d.ts +0 -1
- package/dist/db-content-api/utilities/auth.js +0 -2
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +0 -1
- package/dist/db-content-api/utilities/data/applyDefaults.js +0 -2
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +0 -1
- package/dist/db-content-api/utilities/data/castFieldValue.js +0 -2
- package/dist/db-content-api/utilities/data/index.d.ts +0 -1
- package/dist/db-content-api/utilities/data/index.js +0 -2
- 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 +0 -1
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +0 -2
- 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 +0 -1
- package/dist/db-content-api/utilities/data/stripFields.js +0 -2
- package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +0 -1
- package/dist/db-content-api/utilities/data/transformPublishedLocale.js +0 -2
- package/dist/db-content-api/utilities/data/validateRelationships.d.ts +0 -1
- package/dist/db-content-api/utilities/data/validateRelationships.js +0 -2
- package/dist/db-content-api/utilities/joins.d.ts +0 -1
- package/dist/db-content-api/utilities/joins.js +0 -2
- package/dist/db-content-api/utilities/locale/index.d.ts +0 -1
- package/dist/db-content-api/utilities/locale/index.js +0 -2
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +0 -1
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +0 -2
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +0 -1
- package/dist/db-content-api/utilities/meta/buildMeta.js +0 -2
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +0 -1
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +0 -2
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +0 -1
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +0 -2
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +0 -1
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +0 -2
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +56 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +183 -0
- package/dist/db-content-api/utilities/where.d.ts +0 -1
- package/dist/db-content-api/utilities/where.js +0 -2
- package/dist/deploy/schedule-extract-plugin.d.ts +0 -1
- package/dist/deploy/schedule-extract-plugin.js +0 -2
- package/dist/endpoints/health.d.ts +0 -1
- package/dist/endpoints/health.js +0 -2
- package/dist/endpoints/schema.d.ts +0 -1
- package/dist/endpoints/schema.js +0 -2
- package/dist/exports/client.d.ts +0 -1
- package/dist/exports/client.js +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/lib/download-skill.d.ts +0 -1
- package/dist/lib/download-skill.js +0 -2
- package/dist/oauth/components/FigmaAvatar/index.d.ts +0 -1
- package/dist/oauth/components/FigmaAvatar/index.js +0 -2
- package/dist/oauth/components/FigmaAvatarCell/index.d.ts +0 -1
- package/dist/oauth/components/FigmaAvatarCell/index.js +0 -2
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +0 -1
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +0 -2
- package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +0 -1
- package/dist/oauth/components/LoginButton/iframeAutoLogin.js +0 -2
- package/dist/oauth/components/LoginButton/index.d.ts +0 -1
- package/dist/oauth/components/LoginButton/index.js +3 -5
- package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
- package/dist/oauth/components/LogoutButton/index.js +0 -2
- package/dist/oauth/defaults.d.ts +0 -1
- package/dist/oauth/defaults.js +8 -2
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +4 -8
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js +0 -2
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js +0 -2
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +0 -2
- 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 +0 -2
- package/dist/oauth/index.d.ts +0 -1
- package/dist/oauth/index.js +0 -2
- package/dist/oauth/strategy/index.d.ts +0 -1
- package/dist/oauth/strategy/index.js +17 -19
- package/dist/oauth/types.d.ts +0 -1
- package/dist/oauth/types.js +0 -2
- package/dist/oauth/utilities/clearCookie.d.ts +0 -1
- package/dist/oauth/utilities/clearCookie.js +0 -2
- package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
- package/dist/oauth/utilities/createCookieOptions.js +0 -2
- package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
- package/dist/oauth/utilities/createDebugLogger.js +0 -2
- package/dist/oauth/utilities/establishSession.d.ts +4 -5
- package/dist/oauth/utilities/establishSession.js +9 -12
- package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +0 -1
- package/dist/oauth/utilities/exchangeCodeForAccessToken.js +0 -2
- package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
- package/dist/oauth/utilities/extractOrigin.js +0 -2
- package/dist/oauth/utilities/figmaHostnames.d.ts +0 -1
- package/dist/oauth/utilities/figmaHostnames.js +0 -2
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.js +0 -2
- 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 +0 -1
- package/dist/oauth/utilities/isAbsoluteURL.js +0 -2
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +0 -1
- package/dist/oauth/utilities/isDuplicateKeyError.js +0 -2
- 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 +16 -12
- package/dist/oauth/utilities/withPartitionedCookie.d.ts +0 -1
- package/dist/oauth/utilities/withPartitionedCookie.js +0 -2
- package/dist/oauth/utils/getSearchParam.d.ts +27 -0
- package/dist/oauth/utils/getSearchParam.js +45 -0
- package/dist/plugin/adapter.d.ts +0 -1
- package/dist/plugin/adapter.js +0 -2
- package/dist/plugin/auth-preflight.d.ts +0 -1
- package/dist/plugin/auth-preflight.js +0 -2
- package/dist/plugin/bootstrap-preflight.d.ts +0 -1
- package/dist/plugin/bootstrap-preflight.js +0 -2
- package/dist/plugin/build-config.d.ts +1 -1
- package/dist/plugin/build-config.js +66 -3
- package/dist/plugin/dev-cookie-names.d.ts +0 -1
- package/dist/plugin/dev-cookie-names.js +0 -2
- package/dist/storage-content-api/api-types.d.ts +0 -1
- package/dist/storage-content-api/api-types.js +0 -2
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +0 -1
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +0 -2
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +0 -1
- package/dist/storage-content-api/client-uploads/generateSignedURL.js +0 -2
- package/dist/storage-content-api/client.d.ts +0 -1
- package/dist/storage-content-api/client.js +0 -2
- package/dist/storage-content-api/generateURL.d.ts +0 -1
- package/dist/storage-content-api/generateURL.js +0 -2
- package/dist/storage-content-api/handleDelete.d.ts +0 -1
- package/dist/storage-content-api/handleDelete.js +0 -2
- package/dist/storage-content-api/handleUpload.d.ts +0 -1
- package/dist/storage-content-api/handleUpload.js +0 -2
- package/dist/storage-content-api/index.d.ts +0 -1
- package/dist/storage-content-api/index.js +0 -2
- package/dist/storage-content-api/staticHandler.d.ts +0 -1
- package/dist/storage-content-api/staticHandler.js +0 -2
- package/dist/storage-content-api/types.d.ts +0 -1
- package/dist/storage-content-api/types.js +0 -2
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +0 -1
- package/dist/storage-content-api/utilities/getSafeFilename.js +0 -2
- package/dist/storage-content-api/utilities/index.d.ts +0 -1
- package/dist/storage-content-api/utilities/index.js +0 -2
- package/dist/storage-content-api/utilities/parseClientUploadContext.d.ts +0 -1
- package/dist/storage-content-api/utilities/parseClientUploadContext.js +0 -2
- package/dist/types/config.d.ts +0 -1
- package/dist/types/config.js +0 -2
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
- package/dist/utils/adapters/nextjs.d.ts +0 -1
- package/dist/utils/adapters/nextjs.js +0 -2
- package/dist/utils/adapters/nitro.d.ts +0 -1
- package/dist/utils/adapters/nitro.js +0 -2
- package/dist/utils/adapters/vite.d.ts +0 -1
- package/dist/utils/adapters/vite.js +0 -2
- package/dist/utils/asset-collection.d.ts +0 -1
- package/dist/utils/asset-collection.js +0 -2
- package/dist/utils/build-detection.d.ts +0 -1
- package/dist/utils/build-detection.js +0 -2
- package/dist/utils/build-lambda-zip.d.ts +0 -1
- package/dist/utils/build-lambda-zip.js +0 -2
- package/dist/utils/cache-bootstrap.d.ts +0 -1
- package/dist/utils/cache-bootstrap.js +0 -2
- package/dist/utils/config.d.ts +0 -1
- package/dist/utils/config.js +0 -2
- package/dist/utils/deploy-adapter.d.ts +0 -1
- package/dist/utils/deploy-adapter.js +0 -2
- package/dist/utils/download-template.d.ts +0 -1
- package/dist/utils/download-template.js +0 -2
- package/dist/utils/env-management.d.ts +0 -1
- package/dist/utils/env-management.js +0 -2
- package/dist/utils/format-env-suffix.d.ts +0 -1
- package/dist/utils/format-env-suffix.js +0 -2
- 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 +0 -2
- package/dist/utils/fs-utils.d.ts +0 -1
- package/dist/utils/fs-utils.js +0 -2
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -2
- package/dist/utils/handle-upgrade.d.ts +0 -1
- package/dist/utils/handle-upgrade.js +0 -2
- package/dist/utils/is-debug.d.ts +0 -1
- package/dist/utils/is-debug.js +0 -2
- package/dist/utils/lambda-config.d.ts +0 -1
- package/dist/utils/lambda-config.js +0 -2
- 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 +0 -1
- package/dist/utils/messages.js +7 -2
- package/dist/utils/package-manager.d.ts +0 -1
- package/dist/utils/package-manager.js +0 -2
- package/dist/utils/parse-template-spec.d.ts +0 -1
- package/dist/utils/parse-template-spec.js +0 -2
- package/dist/utils/payload-config-ast.d.ts +0 -1
- package/dist/utils/payload-config-ast.js +0 -2
- package/dist/utils/payload-config-finder.d.ts +0 -1
- package/dist/utils/payload-config-finder.js +0 -2
- package/dist/utils/payload-config-modifier.d.ts +0 -1
- package/dist/utils/payload-config-modifier.js +0 -2
- package/dist/utils/payload-package-check.d.ts +0 -1
- package/dist/utils/payload-package-check.js +0 -2
- package/dist/utils/project.d.ts +0 -1
- package/dist/utils/project.js +0 -2
- package/dist/utils/resolve-environment.d.ts +0 -1
- package/dist/utils/resolve-environment.js +0 -2
- package/dist/utils/s3-upload.d.ts +0 -1
- package/dist/utils/s3-upload.js +0 -2
- package/dist/utils/token-display.d.ts +0 -1
- package/dist/utils/token-display.js +0 -2
- package/dist/utils/typescript-validator.d.ts +0 -1
- package/dist/utils/typescript-validator.js +0 -2
- package/dist/utils/version-check.d.ts +0 -1
- package/dist/utils/version-check.js +0 -2
- package/package.json +1 -1
|
@@ -171,4 +171,3 @@ export declare function getBootstrapInfo(credential: AuthCredential, cmsResource
|
|
|
171
171
|
* into the new FIGMA_PROJECT_ID (CMS Resource ID).
|
|
172
172
|
*/
|
|
173
173
|
export declare function getCmsResourceId(credential: AuthCredential, datasetId: string): Promise<string>;
|
|
174
|
-
//# sourceMappingURL=control-plane.d.ts.map
|
package/dist/api/figma-api.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare class FigmaApiError extends Error {
|
|
|
30
30
|
* requests to the Content API. The token contains the CMS ID and
|
|
31
31
|
* user identifying information in its claims.
|
|
32
32
|
*
|
|
33
|
-
* Endpoint:
|
|
33
|
+
* Endpoint: POST https://api.figma.com/v1/cms/content-systems/:id/token/
|
|
34
34
|
*
|
|
35
35
|
* @param accessToken - OAuth access token for authentication
|
|
36
36
|
* @param tenantId - The tenant/CMS ID
|
|
@@ -38,6 +38,7 @@ export declare class FigmaApiError extends Error {
|
|
|
38
38
|
* @throws {FigmaApiError} If the API call fails
|
|
39
39
|
*/
|
|
40
40
|
export declare function getProjectToken(credential: AuthCredential, tenantId: string): Promise<ProjectToken>;
|
|
41
|
+
export declare function getPayloadAdminToken(credential: AuthCredential, environmentId: string): Promise<ProjectToken>;
|
|
41
42
|
/**
|
|
42
43
|
* Get user info from Figma API
|
|
43
44
|
*
|
|
@@ -49,4 +50,3 @@ export declare function getProjectToken(credential: AuthCredential, tenantId: st
|
|
|
49
50
|
* @throws {FigmaApiError} If the API call fails
|
|
50
51
|
*/
|
|
51
52
|
export declare function getUserInfo(credential: AuthCredential): Promise<FigmaUserInfo>;
|
|
52
|
-
//# sourceMappingURL=figma-api.d.ts.map
|
package/dist/api/figma-api.js
CHANGED
|
@@ -24,7 +24,7 @@ import { parseControlPlaneApiError } from './error-response.js';
|
|
|
24
24
|
* requests to the Content API. The token contains the CMS ID and
|
|
25
25
|
* user identifying information in its claims.
|
|
26
26
|
*
|
|
27
|
-
* Endpoint:
|
|
27
|
+
* Endpoint: POST https://api.figma.com/v1/cms/content-systems/:id/token/
|
|
28
28
|
*
|
|
29
29
|
* @param accessToken - OAuth access token for authentication
|
|
30
30
|
* @param tenantId - The tenant/CMS ID
|
|
@@ -66,7 +66,7 @@ import { parseControlPlaneApiError } from './error-response.js';
|
|
|
66
66
|
if (shouldMock) {
|
|
67
67
|
// MOCK IMPLEMENTATION: Generate a mock JWT token for testing
|
|
68
68
|
log.debug('Using mock project token API for getProjectToken (FIGMA_MOCK_PROJECT_TOKEN = "true")');
|
|
69
|
-
const mockToken = createMockJWT(tenantId
|
|
69
|
+
const mockToken = createMockJWT(`csid_${tenantId}`, 25) // 25 minutes expiry
|
|
70
70
|
;
|
|
71
71
|
// Mock response data
|
|
72
72
|
const data = {
|
|
@@ -87,7 +87,7 @@ import { parseControlPlaneApiError } from './error-response.js';
|
|
|
87
87
|
}
|
|
88
88
|
// REAL API IMPLEMENTATION
|
|
89
89
|
const baseUrl = getEnvConfig().apiBaseUrl;
|
|
90
|
-
const url = `${baseUrl}/v1/cms/${tenantId}/token/`;
|
|
90
|
+
const url = `${baseUrl}/v1/cms/content-systems/${tenantId}/token/`;
|
|
91
91
|
const response = await fetch(url, {
|
|
92
92
|
headers: getAuthHeaders(credential),
|
|
93
93
|
method: 'POST'
|
|
@@ -122,6 +122,36 @@ import { parseControlPlaneApiError } from './error-response.js';
|
|
|
122
122
|
throw new FigmaApiError(`Failed to get project token: ${error instanceof Error ? error.message : 'Unknown error'}`, undefined, error instanceof Error ? error : undefined);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
export async function getPayloadAdminToken(credential, environmentId) {
|
|
126
|
+
if (process.env.FIGMA_MOCK_PROJECT_TOKEN === 'true') {
|
|
127
|
+
const token = createMockJWT(`eid_${environmentId}`, 25);
|
|
128
|
+
return {
|
|
129
|
+
expiresAt: parseJwtExpiry(token),
|
|
130
|
+
tenantId: environmentId,
|
|
131
|
+
token
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const baseUrl = getEnvConfig().apiBaseUrl;
|
|
135
|
+
const response = await fetch(`${baseUrl}/v1/cms/environments/${environmentId}/admin-token`, {
|
|
136
|
+
headers: getAuthHeaders(credential),
|
|
137
|
+
method: 'POST'
|
|
138
|
+
});
|
|
139
|
+
if (!response.ok) {
|
|
140
|
+
throw new FigmaApiError(await parseControlPlaneApiError({
|
|
141
|
+
context: 'get Payload Admin token',
|
|
142
|
+
response
|
|
143
|
+
}), response.status);
|
|
144
|
+
}
|
|
145
|
+
const data = await response.json();
|
|
146
|
+
if (!data.meta?.token) {
|
|
147
|
+
throw new FigmaApiError('Invalid response: missing token in meta');
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
expiresAt: parseJwtExpiry(data.meta.token),
|
|
151
|
+
tenantId: environmentId,
|
|
152
|
+
token: data.meta.token
|
|
153
|
+
};
|
|
154
|
+
}
|
|
125
155
|
/**
|
|
126
156
|
* Create a mock JWT token for testing
|
|
127
157
|
* TODO: Remove this when real API is available
|
|
@@ -213,5 +243,3 @@ import { parseControlPlaneApiError } from './error-response.js';
|
|
|
213
243
|
throw new FigmaApiError(`Failed to get user info: ${error instanceof Error ? error.message : 'Unknown error'}`, undefined, error instanceof Error ? error : undefined);
|
|
214
244
|
}
|
|
215
245
|
}
|
|
216
|
-
|
|
217
|
-
//# sourceMappingURL=figma-api.js.map
|
package/dist/auth/browser.d.ts
CHANGED
package/dist/auth/browser.js
CHANGED
package/dist/auth/credentials.js
CHANGED
|
@@ -4,9 +4,9 @@ import type { JWTPayload } from './types.js';
|
|
|
4
4
|
* JWT validation error with specific error codes
|
|
5
5
|
*/
|
|
6
6
|
export declare class JWTValidationError extends Error {
|
|
7
|
-
code: 'EXPIRED' | 'JWKS_FETCH_FAILED' | 'MISSING_KID' | 'SIGNATURE_INVALID';
|
|
7
|
+
code: 'AUDIENCE_INVALID' | 'EXPIRED' | 'JWKS_FETCH_FAILED' | 'MISSING_KID' | 'SIGNATURE_INVALID' | 'TOKEN_CLAIMS_INVALID';
|
|
8
8
|
cause?: Error | undefined;
|
|
9
|
-
constructor(message: string, code: 'EXPIRED' | 'JWKS_FETCH_FAILED' | 'MISSING_KID' | 'SIGNATURE_INVALID', cause?: Error | undefined);
|
|
9
|
+
constructor(message: string, code: 'AUDIENCE_INVALID' | 'EXPIRED' | 'JWKS_FETCH_FAILED' | 'MISSING_KID' | 'SIGNATURE_INVALID' | 'TOKEN_CLAIMS_INVALID', cause?: Error | undefined);
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Validate a project token JWT
|
|
@@ -23,12 +23,29 @@ export declare class JWTValidationError extends Error {
|
|
|
23
23
|
* - Validates standard claims (exp, iat, nbf)
|
|
24
24
|
* - Handles clock skew tolerance
|
|
25
25
|
*
|
|
26
|
-
* @param token - JWT token string
|
|
27
|
-
* @param environment - Figma environment ('production' or 'staging')
|
|
26
|
+
* @param params.token - JWT token string
|
|
27
|
+
* @param params.environment - Figma environment ('production' or 'staging')
|
|
28
|
+
* @param params.audience - Expected `aud` claim (the tenant's contentSystemId);
|
|
29
|
+
* when provided, jose rejects tokens whose `aud` does not match
|
|
28
30
|
* @returns Promise resolving to validated JWT payload
|
|
29
31
|
* @throws {JWTValidationError} If validation fails
|
|
30
32
|
*/
|
|
31
|
-
export declare function validateProjectToken(
|
|
33
|
+
export declare function validateProjectToken(params: {
|
|
34
|
+
/** Expected `aud` claim — the tenant's contentSystemId. Enforced when provided. */
|
|
35
|
+
audience?: string;
|
|
36
|
+
environment: Environment;
|
|
37
|
+
token: string;
|
|
38
|
+
}): Promise<JWTPayload>;
|
|
39
|
+
export declare function validatePayloadAdminToken(params: {
|
|
40
|
+
audience: string;
|
|
41
|
+
environment: Environment;
|
|
42
|
+
token: string;
|
|
43
|
+
}): Promise<JWTPayload>;
|
|
44
|
+
export declare function validateContentApiToken(params: {
|
|
45
|
+
audience: string;
|
|
46
|
+
environment: Environment;
|
|
47
|
+
token: string;
|
|
48
|
+
}): Promise<JWTPayload>;
|
|
32
49
|
/**
|
|
33
50
|
* Clear JWKS cache (useful for testing or forcing refresh)
|
|
34
51
|
*
|
|
@@ -39,4 +56,3 @@ export declare function validateProjectToken(token: string, environment: Environ
|
|
|
39
56
|
* - Clearing state between test runs
|
|
40
57
|
*/
|
|
41
58
|
export declare function clearJWKSCache(): void;
|
|
42
|
-
//# sourceMappingURL=jwt-validator.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRemoteJWKSet, jwtVerify } from 'jose';
|
|
2
|
-
import { JWKSMultipleMatchingKeys, JWKSNoMatchingKey, JWSInvalid, JWSSignatureVerificationFailed, JWTExpired } from 'jose/errors';
|
|
2
|
+
import { JWKSMultipleMatchingKeys, JWKSNoMatchingKey, JWSInvalid, JWSSignatureVerificationFailed, JWTClaimValidationFailed, JWTExpired } from 'jose/errors';
|
|
3
3
|
import { getEnvConfig } from '../constants.js';
|
|
4
4
|
/**
|
|
5
5
|
* JWT validation error with specific error codes
|
|
@@ -52,15 +52,21 @@ import { getEnvConfig } from '../constants.js';
|
|
|
52
52
|
* - Validates standard claims (exp, iat, nbf)
|
|
53
53
|
* - Handles clock skew tolerance
|
|
54
54
|
*
|
|
55
|
-
* @param token - JWT token string
|
|
56
|
-
* @param environment - Figma environment ('production' or 'staging')
|
|
55
|
+
* @param params.token - JWT token string
|
|
56
|
+
* @param params.environment - Figma environment ('production' or 'staging')
|
|
57
|
+
* @param params.audience - Expected `aud` claim (the tenant's contentSystemId);
|
|
58
|
+
* when provided, jose rejects tokens whose `aud` does not match
|
|
57
59
|
* @returns Promise resolving to validated JWT payload
|
|
58
60
|
* @throws {JWTValidationError} If validation fails
|
|
59
|
-
*/ export async function validateProjectToken(
|
|
61
|
+
*/ export async function validateProjectToken(params) {
|
|
62
|
+
const { audience, environment, token } = params;
|
|
60
63
|
try {
|
|
61
64
|
const JWKS = getJWKSResolver(environment);
|
|
62
65
|
const { payload } = await jwtVerify(token, JWKS, {
|
|
63
|
-
clockTolerance:
|
|
66
|
+
clockTolerance: 30,
|
|
67
|
+
...audience ? {
|
|
68
|
+
audience
|
|
69
|
+
} : {}
|
|
64
70
|
});
|
|
65
71
|
return payload;
|
|
66
72
|
} catch (error) {
|
|
@@ -86,6 +92,10 @@ import { getEnvConfig } from '../constants.js';
|
|
|
86
92
|
if (error instanceof JWSInvalid) {
|
|
87
93
|
throw new JWTValidationError('Invalid JWT structure - missing required header fields (kid or alg)', 'MISSING_KID', error);
|
|
88
94
|
}
|
|
95
|
+
// Audience mismatch (or missing `aud` when an audience is required)
|
|
96
|
+
if (error instanceof JWTClaimValidationFailed && error.claim === 'aud') {
|
|
97
|
+
throw new JWTValidationError('Token audience does not match this tenant', 'AUDIENCE_INVALID', error);
|
|
98
|
+
}
|
|
89
99
|
// Network or fetch errors (not jose errors, generic Error instances)
|
|
90
100
|
if (error instanceof Error) {
|
|
91
101
|
const message = error.message;
|
|
@@ -98,6 +108,24 @@ import { getEnvConfig } from '../constants.js';
|
|
|
98
108
|
throw new JWTValidationError(`JWT validation failed: ${message}`, 'SIGNATURE_INVALID', error instanceof Error ? error : undefined);
|
|
99
109
|
}
|
|
100
110
|
}
|
|
111
|
+
export async function validatePayloadAdminToken(params) {
|
|
112
|
+
const payload = await validateProjectToken({
|
|
113
|
+
...params,
|
|
114
|
+
audience: `eid_${params.audience}`
|
|
115
|
+
});
|
|
116
|
+
if (typeof payload.sub !== 'string' || typeof payload.email !== 'string') {
|
|
117
|
+
throw new JWTValidationError('Payload Admin token claims are invalid', 'TOKEN_CLAIMS_INVALID');
|
|
118
|
+
}
|
|
119
|
+
return payload;
|
|
120
|
+
}
|
|
121
|
+
export async function validateContentApiToken(params) {
|
|
122
|
+
// Content API tokens are issued by the content-system-scoped endpoint, which
|
|
123
|
+
// prefixes the `aud` with `csid_` (mirrors the `eid_` admin-token scoping).
|
|
124
|
+
return validateProjectToken({
|
|
125
|
+
...params,
|
|
126
|
+
audience: `csid_${params.audience}`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
101
129
|
/**
|
|
102
130
|
* Clear JWKS cache (useful for testing or forcing refresh)
|
|
103
131
|
*
|
|
@@ -109,5 +137,3 @@ import { getEnvConfig } from '../constants.js';
|
|
|
109
137
|
*/ export function clearJWKSCache() {
|
|
110
138
|
jwksResolvers.clear();
|
|
111
139
|
}
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=jwt-validator.js.map
|
|
@@ -75,4 +75,3 @@ export declare function getValidCredential(tokenStore: TokenStore): Promise<Auth
|
|
|
75
75
|
* Use in commands that want to fall through to a login prompt on failure.
|
|
76
76
|
*/
|
|
77
77
|
export declare function tryGetCredential(tokenStore: TokenStore): Promise<AuthCredential | null>;
|
|
78
|
-
//# sourceMappingURL=oauth-flow.d.ts.map
|
package/dist/auth/oauth-flow.js
CHANGED
|
@@ -31,4 +31,3 @@ export declare function parsePastedCode(input: string, expectedState: string): s
|
|
|
31
31
|
* @returns Error message string, or undefined if structurally valid
|
|
32
32
|
*/
|
|
33
33
|
export declare function validatePastedCode(input: string): string | undefined;
|
|
34
|
-
//# sourceMappingURL=paste-code.d.ts.map
|
package/dist/auth/paste-code.js
CHANGED
package/dist/auth/pkce.d.ts
CHANGED
package/dist/auth/pkce.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { PROJECT_TOKEN_EXPIRY_BUFFER_SECONDS } from '../config/oauth.js';
|
|
9
9
|
import { getInfraEnvironment } from '../constants.js';
|
|
10
10
|
import * as log from '../utils/log.js';
|
|
11
|
-
import { JWTValidationError,
|
|
11
|
+
import { JWTValidationError, validateContentApiToken } from './jwt-validator.js';
|
|
12
12
|
import { getValidCredential } from './oauth-flow.js';
|
|
13
13
|
/**
|
|
14
14
|
* Error during project token operations
|
|
@@ -153,7 +153,11 @@ function isCachedTokenValid(entry) {
|
|
|
153
153
|
validatedClaims = parseJWTClaims(fetchedToken.token);
|
|
154
154
|
} else {
|
|
155
155
|
try {
|
|
156
|
-
validatedClaims = await
|
|
156
|
+
validatedClaims = await validateContentApiToken({
|
|
157
|
+
audience: resolvedTenantId,
|
|
158
|
+
environment: getInfraEnvironment(),
|
|
159
|
+
token: fetchedToken.token
|
|
160
|
+
});
|
|
157
161
|
} catch (validationError) {
|
|
158
162
|
if (validationError instanceof JWTValidationError) {
|
|
159
163
|
throw new ProjectTokenError(`Project token validation failed: ${validationError.message}`, validationError);
|
|
@@ -233,5 +237,3 @@ function isCachedTokenValid(entry) {
|
|
|
233
237
|
});
|
|
234
238
|
return getValidProjectToken(params);
|
|
235
239
|
}
|
|
236
|
-
|
|
237
|
-
//# sourceMappingURL=project-token.js.map
|
package/dist/auth/refresh.d.ts
CHANGED
|
@@ -33,4 +33,3 @@ export declare function refreshAccessToken(refreshToken: string, clientId?: stri
|
|
|
33
33
|
* @throws TokenRefreshError if exchange fails
|
|
34
34
|
*/
|
|
35
35
|
export declare function exchangeCodeForTokens(code: string, codeVerifier: string, redirectUri?: string, clientId?: string): Promise<FigmaTokens>;
|
|
36
|
-
//# sourceMappingURL=refresh.d.ts.map
|
package/dist/auth/refresh.js
CHANGED
package/dist/auth/token-store.js
CHANGED
package/dist/auth/types.d.ts
CHANGED
|
@@ -197,8 +197,12 @@ export interface JWTPayload extends JoseJWTPayload {
|
|
|
197
197
|
[key: string]: unknown;
|
|
198
198
|
/** User email address */
|
|
199
199
|
email?: string;
|
|
200
|
+
/** Make permission tier the authed user holds on this CMS */
|
|
201
|
+
make_permission?: 'edit' | 'view';
|
|
200
202
|
/** Tenant/CMS ID this token is scoped to */
|
|
201
203
|
tenant_id?: string;
|
|
204
|
+
/** File user groups the authed user is a member of (scoped to the linked Make file) */
|
|
205
|
+
user_groups?: string[];
|
|
202
206
|
}
|
|
203
207
|
/**
|
|
204
208
|
* Project token (JWT) for authenticating to Content API
|
|
@@ -216,7 +220,7 @@ export interface ProjectToken {
|
|
|
216
220
|
}
|
|
217
221
|
/**
|
|
218
222
|
* Raw project token response from Figma API
|
|
219
|
-
* Response from
|
|
223
|
+
* Response from POST https://api.figma.com/v1/cms/content-systems/:id/token/
|
|
220
224
|
*/
|
|
221
225
|
export interface ProjectTokenResponse {
|
|
222
226
|
/** Response metadata containing the JWT token */
|
|
@@ -225,4 +229,3 @@ export interface ProjectTokenResponse {
|
|
|
225
229
|
token: string;
|
|
226
230
|
};
|
|
227
231
|
}
|
|
228
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/auth/types.js
CHANGED
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import { listTokensCommand } from './commands/list-tokens.js';
|
|
|
12
12
|
import { loginCommand } from './commands/login.js';
|
|
13
13
|
import { logoutCommand } from './commands/logout.js';
|
|
14
14
|
import { upgradeCommand } from './commands/upgrade.js';
|
|
15
|
+
import { uploadSchemaCommand } from './commands/upload-schema.js';
|
|
15
16
|
import { setInfraEnvironment } from './constants.js';
|
|
16
17
|
import { helpMessage } from './utils/messages.js';
|
|
17
18
|
/**
|
|
@@ -178,6 +179,12 @@ class Main {
|
|
|
178
179
|
isDryRun: this.args['--dry-run']
|
|
179
180
|
});
|
|
180
181
|
break;
|
|
182
|
+
case 'upload-schema':
|
|
183
|
+
await uploadSchemaCommand({
|
|
184
|
+
id: this.args['--id'],
|
|
185
|
+
env: this.args['--env']
|
|
186
|
+
});
|
|
187
|
+
break;
|
|
181
188
|
default:
|
|
182
189
|
p.log.error(pc.red(`Unknown command: ${subcommand}`));
|
|
183
190
|
p.note('Use --help to see available commands', 'Tip');
|
|
@@ -191,5 +198,3 @@ class Main {
|
|
|
191
198
|
}
|
|
192
199
|
}
|
|
193
200
|
}
|
|
194
|
-
|
|
195
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/commands/debug.d.ts
CHANGED
package/dist/commands/debug.js
CHANGED
package/dist/commands/deploy.js
CHANGED
package/dist/commands/env.d.ts
CHANGED
package/dist/commands/env.js
CHANGED
package/dist/commands/init.d.ts
CHANGED
package/dist/commands/init.js
CHANGED
package/dist/commands/login.d.ts
CHANGED
package/dist/commands/login.js
CHANGED
package/dist/commands/logout.js
CHANGED
package/dist/commands/upgrade.js
CHANGED
|
@@ -327,5 +327,3 @@ async function migrateLocalPackageVersion({ changes, cliDir, cwd, isDryRun }) {
|
|
|
327
327
|
p.log.message(`${pc.green('●')} Package: Installed @payloadcms/figma from local build`);
|
|
328
328
|
changes.push('Installed @payloadcms/figma from local build');
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
//# sourceMappingURL=upgrade.js.map
|