@payloadcms/figma 0.0.1-alpha.4 → 0.0.1-alpha.41
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 +22 -1
- package/dist/api/control-plane.d.ts.map +1 -1
- package/dist/api/control-plane.js +55 -22
- package/dist/api/control-plane.js.map +1 -1
- package/dist/api/figma-api.d.ts.map +1 -1
- package/dist/api/figma-api.js +45 -26
- package/dist/api/figma-api.js.map +1 -1
- package/dist/auth/callback-server.d.ts.map +1 -1
- package/dist/auth/callback-server.js +2 -1
- package/dist/auth/callback-server.js.map +1 -1
- package/dist/auth/crypto-utils.d.ts.map +1 -1
- package/dist/auth/crypto-utils.js +5 -5
- package/dist/auth/crypto-utils.js.map +1 -1
- package/dist/auth/jwt-validator.d.ts +2 -1
- package/dist/auth/jwt-validator.d.ts.map +1 -1
- package/dist/auth/jwt-validator.js +2 -2
- package/dist/auth/jwt-validator.js.map +1 -1
- package/dist/auth/oauth-flow.d.ts +1 -1
- package/dist/auth/oauth-flow.d.ts.map +1 -1
- package/dist/auth/oauth-flow.js +9 -8
- package/dist/auth/oauth-flow.js.map +1 -1
- package/dist/auth/project-token.d.ts.map +1 -1
- package/dist/auth/project-token.js +9 -4
- package/dist/auth/project-token.js.map +1 -1
- package/dist/auth/refresh.d.ts.map +1 -1
- package/dist/auth/refresh.js +14 -9
- package/dist/auth/refresh.js.map +1 -1
- package/dist/auth/token-store.d.ts +10 -0
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +20 -0
- package/dist/auth/token-store.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/build-lambda-zip.d.ts +5 -0
- package/dist/commands/build-lambda-zip.d.ts.map +1 -0
- package/dist/commands/build-lambda-zip.js +19 -0
- package/dist/commands/build-lambda-zip.js.map +1 -0
- package/dist/commands/deploy.d.ts +4 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +71 -129
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/init.d.ts +1 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +94 -85
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list-tokens.d.ts.map +1 -1
- package/dist/commands/list-tokens.js +6 -3
- package/dist/commands/list-tokens.js.map +1 -1
- package/dist/commands/login.d.ts +8 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +21 -11
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +2 -2
- package/dist/commands/logout.js.map +1 -1
- package/dist/config/oauth.d.ts +4 -14
- package/dist/config/oauth.d.ts.map +1 -1
- package/dist/config/oauth.js +19 -40
- package/dist/config/oauth.js.map +1 -1
- package/dist/constants.d.ts +26 -18
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +34 -20
- package/dist/constants.js.map +1 -1
- package/dist/db-content-api/README.md +98 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +3854 -0
- package/dist/db-content-api/generated/content-api-types.d.ts.map +1 -0
- package/dist/db-content-api/generated/content-api-types.js +7 -0
- package/dist/db-content-api/generated/content-api-types.js.map +1 -0
- package/dist/db-content-api/index.d.ts +18 -0
- package/dist/db-content-api/index.d.ts.map +1 -0
- package/dist/db-content-api/index.js +578 -0
- package/dist/db-content-api/index.js.map +1 -0
- package/dist/db-content-api/temp-utilities/pagination.d.ts +13 -0
- package/dist/db-content-api/temp-utilities/pagination.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/pagination.js +45 -0
- package/dist/db-content-api/temp-utilities/pagination.js.map +1 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/slug.js +3 -0
- package/dist/db-content-api/temp-utilities/slug.js.map +1 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +3 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/sorting.js +32 -0
- package/dist/db-content-api/temp-utilities/sorting.js.map +1 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +4 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +53 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js.map +1 -0
- package/dist/db-content-api/utilities/auth.d.ts +30 -0
- package/dist/db-content-api/utilities/auth.d.ts.map +1 -0
- package/dist/db-content-api/utilities/auth.js +81 -0
- package/dist/db-content-api/utilities/auth.js.map +1 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +7 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +59 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js.map +1 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +11 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js.map +1 -0
- package/dist/db-content-api/utilities/data/index.d.ts +30 -0
- package/dist/db-content-api/utilities/data/index.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/index.js +182 -0
- package/dist/db-content-api/utilities/data/index.js.map +1 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +12 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +54 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js.map +1 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +48 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/stripFields.js +195 -0
- package/dist/db-content-api/utilities/data/stripFields.js.map +1 -0
- package/dist/db-content-api/utilities/joins.d.ts +55 -0
- package/dist/db-content-api/utilities/joins.d.ts.map +1 -0
- package/dist/db-content-api/utilities/joins.js +136 -0
- package/dist/db-content-api/utilities/joins.js.map +1 -0
- package/dist/db-content-api/utilities/where.d.ts +12 -0
- package/dist/db-content-api/utilities/where.d.ts.map +1 -0
- package/dist/db-content-api/utilities/where.js +107 -0
- package/dist/db-content-api/utilities/where.js.map +1 -0
- package/dist/endpoints/health.d.ts +3 -0
- package/dist/endpoints/health.d.ts.map +1 -0
- package/dist/endpoints/health.js +11 -0
- package/dist/endpoints/health.js.map +1 -0
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +5 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth/components/LoginButton/index.d.ts.map +1 -1
- package/dist/oauth/components/LoginButton/index.js +50 -6
- package/dist/oauth/components/LoginButton/index.js.map +1 -1
- package/dist/oauth/components/LoginButton/index.scss +50 -3
- package/dist/oauth/components/LogoutButton/index.d.ts.map +1 -1
- package/dist/oauth/components/LogoutButton/index.js +0 -1
- package/dist/oauth/components/LogoutButton/index.js.map +1 -1
- package/dist/oauth/defaults.d.ts.map +1 -1
- package/dist/oauth/defaults.js +29 -5
- package/dist/oauth/defaults.js.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +4 -4
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +42 -7
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/strategy/index.d.ts +0 -2
- package/dist/oauth/strategy/index.d.ts.map +1 -1
- package/dist/oauth/strategy/index.js +38 -15
- package/dist/oauth/strategy/index.js.map +1 -1
- package/dist/oauth/types.d.ts +6 -6
- package/dist/oauth/types.d.ts.map +1 -1
- package/dist/oauth/types.js.map +1 -1
- package/dist/oauth/utilities/createCookieOptions.d.ts.map +1 -1
- package/dist/oauth/utilities/createCookieOptions.js.map +1 -1
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +7 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts.map +1 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +14 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js.map +1 -0
- package/dist/oauth/utilities/refreshTokens.d.ts.map +1 -1
- package/dist/oauth/utilities/refreshTokens.js +1 -1
- package/dist/oauth/utilities/refreshTokens.js.map +1 -1
- package/dist/plugin/build-config.d.ts +21 -4
- package/dist/plugin/build-config.d.ts.map +1 -1
- package/dist/plugin/build-config.js +114 -8
- package/dist/plugin/build-config.js.map +1 -1
- package/dist/storage-content-api/api-types.d.ts +161 -0
- package/dist/storage-content-api/api-types.d.ts.map +1 -0
- package/dist/storage-content-api/api-types.js +6 -0
- package/dist/storage-content-api/api-types.js.map +1 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +9 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts.map +1 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +42 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js.map +1 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +13 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts.map +1 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.js +31 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.js.map +1 -0
- package/dist/storage-content-api/client.d.ts +6 -0
- package/dist/storage-content-api/client.d.ts.map +1 -0
- package/dist/storage-content-api/client.js +36 -0
- package/dist/storage-content-api/client.js.map +1 -0
- package/dist/storage-content-api/generateURL.d.ts +7 -0
- package/dist/storage-content-api/generateURL.d.ts.map +1 -0
- package/dist/storage-content-api/generateURL.js +7 -0
- package/dist/storage-content-api/generateURL.js.map +1 -0
- package/dist/storage-content-api/handleDelete.d.ts +8 -0
- package/dist/storage-content-api/handleDelete.d.ts.map +1 -0
- package/dist/storage-content-api/handleDelete.js +15 -0
- package/dist/storage-content-api/handleDelete.js.map +1 -0
- package/dist/storage-content-api/handleUpload.d.ts +11 -0
- package/dist/storage-content-api/handleUpload.d.ts.map +1 -0
- package/dist/storage-content-api/handleUpload.js +136 -0
- package/dist/storage-content-api/handleUpload.js.map +1 -0
- package/dist/storage-content-api/index.d.ts +5 -0
- package/dist/storage-content-api/index.d.ts.map +1 -0
- package/dist/storage-content-api/index.js +31 -0
- package/dist/storage-content-api/index.js.map +1 -0
- package/dist/storage-content-api/staticHandler.d.ts +10 -0
- package/dist/storage-content-api/staticHandler.d.ts.map +1 -0
- package/dist/storage-content-api/staticHandler.js +55 -0
- package/dist/storage-content-api/staticHandler.js.map +1 -0
- package/dist/storage-content-api/types.d.ts +10 -0
- package/dist/storage-content-api/types.d.ts.map +1 -0
- package/dist/storage-content-api/types.js +3 -0
- package/dist/storage-content-api/types.js.map +1 -0
- package/dist/templates/README.md +19 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/asset-collection.d.ts +3 -6
- package/dist/utils/asset-collection.d.ts.map +1 -1
- package/dist/utils/asset-collection.js +10 -34
- package/dist/utils/asset-collection.js.map +1 -1
- package/dist/utils/build-lambda-zip.d.ts +14 -0
- package/dist/utils/build-lambda-zip.d.ts.map +1 -0
- package/dist/utils/build-lambda-zip.js +81 -0
- package/dist/utils/build-lambda-zip.js.map +1 -0
- package/dist/utils/config.js +1 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/env-management.d.ts +9 -8
- package/dist/utils/env-management.d.ts.map +1 -1
- package/dist/utils/env-management.js +73 -74
- package/dist/utils/env-management.js.map +1 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +3 -5
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/lambda-config.d.ts +3 -1
- package/dist/utils/lambda-config.d.ts.map +1 -1
- package/dist/utils/lambda-config.js +13 -21
- package/dist/utils/lambda-config.js.map +1 -1
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +8 -7
- package/dist/utils/messages.js.map +1 -1
- package/dist/utils/payload-config-ast.d.ts +22 -3
- package/dist/utils/payload-config-ast.d.ts.map +1 -1
- package/dist/utils/payload-config-ast.js +89 -31
- package/dist/utils/payload-config-ast.js.map +1 -1
- package/dist/utils/payload-config-finder.d.ts +2 -2
- package/dist/utils/payload-config-finder.d.ts.map +1 -1
- package/dist/utils/payload-config-finder.js +48 -9
- package/dist/utils/payload-config-finder.js.map +1 -1
- package/dist/utils/payload-config-modifier.d.ts.map +1 -1
- package/dist/utils/payload-config-modifier.js +54 -6
- package/dist/utils/payload-config-modifier.js.map +1 -1
- package/dist/utils/payload-package-check.d.ts +12 -1
- package/dist/utils/payload-package-check.d.ts.map +1 -1
- package/dist/utils/payload-package-check.js +63 -5
- package/dist/utils/payload-package-check.js.map +1 -1
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/project.js +8 -5
- package/dist/utils/project.js.map +1 -1
- package/dist/utils/s3-upload.d.ts +0 -1
- package/dist/utils/s3-upload.d.ts.map +1 -1
- package/dist/utils/s3-upload.js +10 -3
- package/dist/utils/s3-upload.js.map +1 -1
- package/dist/utils/token-display.d.ts.map +1 -1
- package/dist/utils/token-display.js +11 -5
- package/dist/utils/token-display.js.map +1 -1
- package/dist/utils/typescript-validator.d.ts.map +1 -1
- package/dist/utils/typescript-validator.js +4 -6
- package/dist/utils/typescript-validator.js.map +1 -1
- package/dist/utils/version-check.d.ts +3 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +38 -0
- package/dist/utils/version-check.js.map +1 -0
- package/package.json +31 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/logout.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport pc from 'picocolors'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/commands/logout.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport pc from 'picocolors'\n\nimport { getTokenStore } from '../auth/token-store.js'\nimport * as log from '../utils/log.js'\n\n/**\n * Options for logout command\n */\nexport interface LogoutCommandOptions {\n /** Enable debug mode */\n debug?: boolean\n}\n\n/**\n * Handle the `@payloadcms/figma logout` command\n *\n * Clears all stored tokens (OAuth and project tokens) after confirmation.\n *\n * @param _options - Command options (unused)\n */\nexport async function logoutCommand(_options: LogoutCommandOptions = {}): Promise<void> {\n const tokenStore = getTokenStore()\n\n const hasTokens = tokenStore.getTokens() !== null\n\n if (!hasTokens) {\n p.log.warn(pc.yellow('No tokens found. Already logged out.'))\n return\n }\n\n // Confirm logout\n const confirmed = await p.confirm({\n initialValue: false,\n message: 'This will clear all OAuth and project tokens. Continue?',\n })\n\n if (p.isCancel(confirmed) || !confirmed) {\n p.log.info('Logout cancelled')\n return\n }\n\n const s = p.spinner()\n s.start('Clearing tokens...')\n\n try {\n // Clear OAuth tokens\n tokenStore.clearTokens()\n // Clear all project tokens\n tokenStore.clearAllProjectTokens()\n s.stop(pc.green('✓ Logged out successfully'))\n p.log.step('All OAuth and project tokens have been cleared')\n } catch (error) {\n s.stop(pc.red('✗ Failed to clear tokens'))\n log.error(error instanceof Error ? error.message : 'Unknown error')\n process.exit(1)\n }\n}\n"],"names":["p","pc","getTokenStore","log","logoutCommand","_options","tokenStore","hasTokens","getTokens","warn","yellow","confirmed","confirm","initialValue","message","isCancel","info","s","spinner","start","clearTokens","clearAllProjectTokens","stop","green","step","error","red","Error","process","exit"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,QAAQ,aAAY;AAE3B,SAASC,aAAa,QAAQ,yBAAwB;AACtD,YAAYC,SAAS,kBAAiB;AAUtC;;;;;;CAMC,GACD,OAAO,eAAeC,cAAcC,WAAiC,CAAC,CAAC;IACrE,MAAMC,aAAaJ;IAEnB,MAAMK,YAAYD,WAAWE,SAAS,OAAO;IAE7C,IAAI,CAACD,WAAW;QACdP,EAAEG,GAAG,CAACM,IAAI,CAACR,GAAGS,MAAM,CAAC;QACrB;IACF;IAEA,iBAAiB;IACjB,MAAMC,YAAY,MAAMX,EAAEY,OAAO,CAAC;QAChCC,cAAc;QACdC,SAAS;IACX;IAEA,IAAId,EAAEe,QAAQ,CAACJ,cAAc,CAACA,WAAW;QACvCX,EAAEG,GAAG,CAACa,IAAI,CAAC;QACX;IACF;IAEA,MAAMC,IAAIjB,EAAEkB,OAAO;IACnBD,EAAEE,KAAK,CAAC;IAER,IAAI;QACF,qBAAqB;QACrBb,WAAWc,WAAW;QACtB,2BAA2B;QAC3Bd,WAAWe,qBAAqB;QAChCJ,EAAEK,IAAI,CAACrB,GAAGsB,KAAK,CAAC;QAChBvB,EAAEG,GAAG,CAACqB,IAAI,CAAC;IACb,EAAE,OAAOC,OAAO;QACdR,EAAEK,IAAI,CAACrB,GAAGyB,GAAG,CAAC;QACdvB,IAAIsB,KAAK,CAACA,iBAAiBE,QAAQF,MAAMX,OAAO,GAAG;QACnDc,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/dist/config/oauth.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import type { OAuthConfig } from '../auth/types.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const DEFAULT_CALLBACK_PORT = 34462;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* This is a PUBLIC OAuth client using PKCE (Proof Key for Code Exchange).
|
|
7
|
-
* No client secret is used because CLIs cannot securely store secrets.
|
|
8
|
-
* PKCE provides security through the code_verifier/code_challenge mechanism.
|
|
9
|
-
*
|
|
10
|
-
* For production use, register a public OAuth app with Figma.
|
|
11
|
-
* To register an OAuth app, visit: https://www.figma.com/developers/api#oauth2
|
|
12
|
-
*/
|
|
13
|
-
export declare const OAUTH_CONFIG: OAuthConfig;
|
|
14
|
-
/**
|
|
15
|
-
* Buffer time (in seconds) before token expiration to consider token as expired
|
|
16
|
-
* This helps avoid using tokens that are about to expire
|
|
4
|
+
* Get OAuth configuration for current environment
|
|
5
|
+
* Uses getEnvironment() to determine staging vs production
|
|
17
6
|
*/
|
|
7
|
+
export declare function getOAuthConfig(): OAuthConfig;
|
|
18
8
|
export declare const TOKEN_EXPIRY_BUFFER_SECONDS = 300;
|
|
19
9
|
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/config/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAInD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../src/config/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAInD,eAAO,MAAM,qBAAqB,QAAQ,CAAA;AAE1C;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAa5C;AAED,eAAO,MAAM,2BAA2B,MAAM,CAAA"}
|
package/dist/config/oauth.js
CHANGED
|
@@ -1,43 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const
|
|
3
|
-
prod: {
|
|
4
|
-
authorizationUrl: 'https://www.figma.com/oauth',
|
|
5
|
-
refreshUrl: 'https://api.figma.com/v1/oauth/refresh',
|
|
6
|
-
tokenUrl: 'https://api.figma.com/v1/oauth/token'
|
|
7
|
-
},
|
|
8
|
-
staging: {
|
|
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 { ENV_CONFIG, getEnvironment } from '../constants.js';
|
|
2
|
+
export const DEFAULT_CALLBACK_PORT = 34462;
|
|
14
3
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'current_user:read'
|
|
33
|
-
],
|
|
34
|
-
// TODO: Dynamically choose between prod and staging based on environment
|
|
35
|
-
...URLS.staging
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Buffer time (in seconds) before token expiration to consider token as expired
|
|
39
|
-
* This helps avoid using tokens that are about to expire
|
|
40
|
-
*/ export const TOKEN_EXPIRY_BUFFER_SECONDS = 300 // 5 minutes
|
|
41
|
-
;
|
|
4
|
+
* Get OAuth configuration for current environment
|
|
5
|
+
* Uses getEnvironment() to determine staging vs production
|
|
6
|
+
*/ export function getOAuthConfig() {
|
|
7
|
+
const env = getEnvironment();
|
|
8
|
+
const { apiBaseUrl, authorizationUrl, clientId } = ENV_CONFIG[env];
|
|
9
|
+
return {
|
|
10
|
+
authorizationUrl,
|
|
11
|
+
clientId: process.env.FIGMA_CLIENT_ID || clientId,
|
|
12
|
+
redirectUri: process.env.FIGMA_REDIRECT_URI || `http://localhost:${DEFAULT_CALLBACK_PORT}/callback`,
|
|
13
|
+
refreshUrl: `${apiBaseUrl}/v1/oauth/refresh`,
|
|
14
|
+
scopes: [
|
|
15
|
+
'current_user:read'
|
|
16
|
+
],
|
|
17
|
+
tokenUrl: `${apiBaseUrl}/v1/oauth/token`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const TOKEN_EXPIRY_BUFFER_SECONDS = 300;
|
|
42
21
|
|
|
43
22
|
//# sourceMappingURL=oauth.js.map
|
package/dist/config/oauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/oauth.ts"],"sourcesContent":["import type { OAuthConfig } from '../auth/types.js'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/config/oauth.ts"],"sourcesContent":["import type { OAuthConfig } from '../auth/types.js'\n\nimport { ENV_CONFIG, getEnvironment } from '../constants.js'\n\nexport const DEFAULT_CALLBACK_PORT = 34462\n\n/**\n * Get OAuth configuration for current environment\n * Uses getEnvironment() to determine staging vs production\n */\nexport function getOAuthConfig(): OAuthConfig {\n const env = getEnvironment()\n const { apiBaseUrl, authorizationUrl, clientId } = ENV_CONFIG[env]\n\n return {\n authorizationUrl,\n clientId: process.env.FIGMA_CLIENT_ID || clientId,\n redirectUri:\n process.env.FIGMA_REDIRECT_URI || `http://localhost:${DEFAULT_CALLBACK_PORT}/callback`,\n refreshUrl: `${apiBaseUrl}/v1/oauth/refresh`,\n scopes: ['current_user:read'],\n tokenUrl: `${apiBaseUrl}/v1/oauth/token`,\n }\n}\n\nexport const TOKEN_EXPIRY_BUFFER_SECONDS = 300\n"],"names":["ENV_CONFIG","getEnvironment","DEFAULT_CALLBACK_PORT","getOAuthConfig","env","apiBaseUrl","authorizationUrl","clientId","process","FIGMA_CLIENT_ID","redirectUri","FIGMA_REDIRECT_URI","refreshUrl","scopes","tokenUrl","TOKEN_EXPIRY_BUFFER_SECONDS"],"mappings":"AAEA,SAASA,UAAU,EAAEC,cAAc,QAAQ,kBAAiB;AAE5D,OAAO,MAAMC,wBAAwB,MAAK;AAE1C;;;CAGC,GACD,OAAO,SAASC;IACd,MAAMC,MAAMH;IACZ,MAAM,EAAEI,UAAU,EAAEC,gBAAgB,EAAEC,QAAQ,EAAE,GAAGP,UAAU,CAACI,IAAI;IAElE,OAAO;QACLE;QACAC,UAAUC,QAAQJ,GAAG,CAACK,eAAe,IAAIF;QACzCG,aACEF,QAAQJ,GAAG,CAACO,kBAAkB,IAAI,CAAC,iBAAiB,EAAET,sBAAsB,SAAS,CAAC;QACxFU,YAAY,GAAGP,WAAW,iBAAiB,CAAC;QAC5CQ,QAAQ;YAAC;SAAoB;QAC7BC,UAAU,GAAGT,WAAW,eAAe,CAAC;IAC1C;AACF;AAEA,OAAO,MAAMU,8BAA8B,IAAG"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
export declare const FIGMA_CLIENT_IDS: {
|
|
2
|
-
production: string;
|
|
3
|
-
staging: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const JWKS_URI: {
|
|
6
|
-
production: string;
|
|
7
|
-
staging: string;
|
|
8
|
-
};
|
|
9
1
|
/**
|
|
10
2
|
* Figma environment (production or staging)
|
|
11
3
|
*/
|
|
12
4
|
export type Environment = 'production' | 'staging';
|
|
5
|
+
type EnvironmentConfig = {
|
|
6
|
+
/** Figma API base URL. Override: FIGMA_API_BASE_URL */
|
|
7
|
+
apiBaseUrl: string;
|
|
8
|
+
/** OAuth authorization URL (CLI auth) */
|
|
9
|
+
authorizationUrl: string;
|
|
10
|
+
/** OAuth client ID. Override: FIGMA_CLIENT_ID or FIGMA_OAUTH_CLIENT_ID */
|
|
11
|
+
clientId: string;
|
|
12
|
+
/** Content API base URL. Override: FIGMA_CONTENT_API_URL */
|
|
13
|
+
contentApiUrl: string;
|
|
14
|
+
/** OIDC discovery endpoint */
|
|
15
|
+
identityMetadata: string;
|
|
16
|
+
/** JSON Web Key Set URL for token validation */
|
|
17
|
+
jwksUri: string;
|
|
18
|
+
};
|
|
13
19
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @returns Current environment
|
|
20
|
+
* Environment-specific configuration for Figma integration.
|
|
21
|
+
* Selected via FIGMA_ENV ('production' | 'staging'), defaults to 'production'.
|
|
18
22
|
*/
|
|
19
|
-
export declare
|
|
23
|
+
export declare const ENV_CONFIG: Record<Environment, EnvironmentConfig>;
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @param env - Environment (defaults to current environment)
|
|
24
|
-
* @returns JWKS URI for the environment
|
|
25
|
+
* Set environment override (used by --env CLI flag)
|
|
26
|
+
* Pass undefined to clear the override
|
|
25
27
|
*/
|
|
26
|
-
export declare function
|
|
28
|
+
export declare function setEnvironment(env: Environment | undefined): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get current Figma environment
|
|
31
|
+
* Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) 'production' default
|
|
32
|
+
*/
|
|
33
|
+
export declare function getEnvironment(): Environment;
|
|
34
|
+
export {};
|
|
27
35
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,CAAA;AAElD,KAAK,iBAAiB,GAAG;IACvB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAA;IAClB,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAA;IACxB,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,aAAa,EAAE,MAAM,CAAA;IACrB,8BAA8B;IAC9B,gBAAgB,EAAE,MAAM,CAAA;IACxB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,iBAAiB,CAiB7D,CAAA;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAEjE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAK5C"}
|
package/dist/constants.js
CHANGED
|
@@ -1,27 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Figma environment (production or staging)
|
|
3
|
+
*/ /**
|
|
4
|
+
* Environment-specific configuration for Figma integration.
|
|
5
|
+
* Selected via FIGMA_ENV ('production' | 'staging'), defaults to 'production'.
|
|
6
|
+
*/ export const ENV_CONFIG = {
|
|
7
|
+
production: {
|
|
8
|
+
apiBaseUrl: 'https://api.figma.com',
|
|
9
|
+
authorizationUrl: 'https://www.figma.com/oauth',
|
|
10
|
+
clientId: 'lelKVTAzOekFnirnlAMbuD',
|
|
11
|
+
contentApiUrl: 'https://us-east-1.cms-tenants-001-production.figmacontent.com',
|
|
12
|
+
identityMetadata: 'https://www.figma.com/.well-known/openid-configuration',
|
|
13
|
+
jwksUri: 'https://static.figmacontent.com/.well_known/jwks.json'
|
|
14
|
+
},
|
|
15
|
+
staging: {
|
|
16
|
+
apiBaseUrl: 'https://api.staging.figma.com',
|
|
17
|
+
authorizationUrl: 'https://staging.figma.com/oauth',
|
|
18
|
+
clientId: 'wqAToBAp4UI9AZ5M6wTfT9',
|
|
19
|
+
contentApiUrl: 'https://us-east-1.cms-tenants-001-staging.figmacontentstaging.com',
|
|
20
|
+
identityMetadata: 'https://staging.figma.com/.well-known/openid-configuration',
|
|
21
|
+
jwksUri: 'https://static.figmacontentstaging.com/.well_known/jwks.json'
|
|
22
|
+
}
|
|
8
23
|
};
|
|
24
|
+
let envOverride;
|
|
9
25
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/ export function getEnvironment() {
|
|
15
|
-
return process.env.FIGMA_ENV === 'production' ? 'production' : 'staging';
|
|
26
|
+
* Set environment override (used by --env CLI flag)
|
|
27
|
+
* Pass undefined to clear the override
|
|
28
|
+
*/ export function setEnvironment(env) {
|
|
29
|
+
envOverride = env;
|
|
16
30
|
}
|
|
17
31
|
/**
|
|
18
|
-
* Get
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
32
|
+
* Get current Figma environment
|
|
33
|
+
* Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) 'production' default
|
|
34
|
+
*/ export function getEnvironment() {
|
|
35
|
+
if (envOverride) {
|
|
36
|
+
return envOverride;
|
|
37
|
+
}
|
|
38
|
+
return process.env.FIGMA_ENV === 'staging' ? 'staging' : 'production';
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/**\n * Figma environment (production or staging)\n */\nexport type Environment = 'production' | 'staging'\n\ntype EnvironmentConfig = {\n /** Figma API base URL. Override: FIGMA_API_BASE_URL */\n apiBaseUrl: string\n /** OAuth authorization URL (CLI auth) */\n authorizationUrl: string\n /** OAuth client ID. Override: FIGMA_CLIENT_ID or FIGMA_OAUTH_CLIENT_ID */\n clientId: string\n /** Content API base URL. Override: FIGMA_CONTENT_API_URL */\n contentApiUrl: string\n /** OIDC discovery endpoint */\n identityMetadata: string\n /** JSON Web Key Set URL for token validation */\n jwksUri: string\n}\n\n/**\n * Environment-specific configuration for Figma integration.\n * Selected via FIGMA_ENV ('production' | 'staging'), defaults to 'production'.\n */\nexport const ENV_CONFIG: Record<Environment, EnvironmentConfig> = {\n production: {\n apiBaseUrl: 'https://api.figma.com',\n authorizationUrl: 'https://www.figma.com/oauth',\n clientId: 'lelKVTAzOekFnirnlAMbuD',\n contentApiUrl: 'https://us-east-1.cms-tenants-001-production.figmacontent.com',\n identityMetadata: 'https://www.figma.com/.well-known/openid-configuration',\n jwksUri: 'https://static.figmacontent.com/.well_known/jwks.json',\n },\n staging: {\n apiBaseUrl: 'https://api.staging.figma.com',\n authorizationUrl: 'https://staging.figma.com/oauth',\n clientId: 'wqAToBAp4UI9AZ5M6wTfT9',\n contentApiUrl: 'https://us-east-1.cms-tenants-001-staging.figmacontentstaging.com',\n identityMetadata: 'https://staging.figma.com/.well-known/openid-configuration',\n jwksUri: 'https://static.figmacontentstaging.com/.well_known/jwks.json',\n },\n}\n\nlet envOverride: Environment | undefined\n\n/**\n * Set environment override (used by --env CLI flag)\n * Pass undefined to clear the override\n */\nexport function setEnvironment(env: Environment | undefined): void {\n envOverride = env\n}\n\n/**\n * Get current Figma environment\n * Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) 'production' default\n */\nexport function getEnvironment(): Environment {\n if (envOverride) {\n return envOverride\n }\n return process.env.FIGMA_ENV === 'staging' ? 'staging' : 'production'\n}\n"],"names":["ENV_CONFIG","production","apiBaseUrl","authorizationUrl","clientId","contentApiUrl","identityMetadata","jwksUri","staging","envOverride","setEnvironment","env","getEnvironment","process","FIGMA_ENV"],"mappings":"AAAA;;CAEC,GAkBD;;;CAGC,GACD,OAAO,MAAMA,aAAqD;IAChEC,YAAY;QACVC,YAAY;QACZC,kBAAkB;QAClBC,UAAU;QACVC,eAAe;QACfC,kBAAkB;QAClBC,SAAS;IACX;IACAC,SAAS;QACPN,YAAY;QACZC,kBAAkB;QAClBC,UAAU;QACVC,eAAe;QACfC,kBAAkB;QAClBC,SAAS;IACX;AACF,EAAC;AAED,IAAIE;AAEJ;;;CAGC,GACD,OAAO,SAASC,eAAeC,GAA4B;IACzDF,cAAcE;AAChB;AAEA;;;CAGC,GACD,OAAO,SAASC;IACd,IAAIH,aAAa;QACf,OAAOA;IACT;IACA,OAAOI,QAAQF,GAAG,CAACG,SAAS,KAAK,YAAY,YAAY;AAC3D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Content API Database Adapter Parity
|
|
2
|
+
|
|
3
|
+
This document explains how the Content API database adapter differs from Payload today and how it will behave once alignment is complete.
|
|
4
|
+
|
|
5
|
+
The Content API is an internal service built exclusively for Payload. Because of that, the adapter should match Payload by default and only diverge when there is a strong technical reason.
|
|
6
|
+
|
|
7
|
+
## Where
|
|
8
|
+
|
|
9
|
+
Now
|
|
10
|
+
`{ path: "slug", operator: "equals", value: "hello", type: "text" }`
|
|
11
|
+
|
|
12
|
+
Future
|
|
13
|
+
`{ path: "slug", operator: "equals", value: "hello", type: "text" }`
|
|
14
|
+
|
|
15
|
+
The format stays different. This allows the Content API to evolve its filter schema, for example to support composite types like Point, which are not lexicographically sortable. Semantics must remain identical to Payload.
|
|
16
|
+
|
|
17
|
+
## Pagination
|
|
18
|
+
|
|
19
|
+
~~Now~~
|
|
20
|
+
~~`{ limit: 10, offset: 20 }`~~
|
|
21
|
+
|
|
22
|
+
✅ Partially Implemented
|
|
23
|
+
`{ limit: 10, page: 3 }`
|
|
24
|
+
|
|
25
|
+
**Status:**
|
|
26
|
+
|
|
27
|
+
- ✅ Content API main endpoints use `page` (matches Payload)
|
|
28
|
+
|
|
29
|
+
- ⚠️ **Issue #1 (Joins):** `JoinClause` still uses `offset` instead of `page`
|
|
30
|
+
- Payload `JoinQuery`: `{ page?: number, limit?: number }`
|
|
31
|
+
- Content API `JoinClause`: `{ offset?: number, limit?: number }`
|
|
32
|
+
- **Inconsistent** with main endpoints which use `page`
|
|
33
|
+
|
|
34
|
+
**Current workaround for joins:** The adapter converts `page` to `offset`:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// Payload join query
|
|
38
|
+
{ page: 2, limit: 5 }
|
|
39
|
+
// Adapter converts to offset for Content API
|
|
40
|
+
{ offset: 5, limit: 5 }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Future:**
|
|
44
|
+
|
|
45
|
+
1. Content API should support `skip` parameter for main endpoints
|
|
46
|
+
2. Content API `JoinClause` should use `page` instead of `offset` (consistent with main endpoints)
|
|
47
|
+
3. Content API pagination response should match Payload's flat structure
|
|
48
|
+
|
|
49
|
+
### Pagination Response Structure
|
|
50
|
+
|
|
51
|
+
**Payload format (flat):**
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
{
|
|
55
|
+
docs: [...],
|
|
56
|
+
hasNextPage: boolean,
|
|
57
|
+
hasPrevPage: boolean,
|
|
58
|
+
limit: number,
|
|
59
|
+
nextPage: number | null,
|
|
60
|
+
page: number,
|
|
61
|
+
pagingCounter: number,
|
|
62
|
+
prevPage: number | null,
|
|
63
|
+
totalDocs: number,
|
|
64
|
+
totalPages: number
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Content API format (nested):**
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
{
|
|
72
|
+
data: [...],
|
|
73
|
+
pagination: {
|
|
74
|
+
total: number,
|
|
75
|
+
current: { limit: number, page: number },
|
|
76
|
+
next?: { limit: number, page: number },
|
|
77
|
+
prev?: { limit: number, page: number }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Current workaround:** The adapter transforms Content API's nested structure to Payload's flat structure using `getPaginationData()` utility.
|
|
83
|
+
|
|
84
|
+
## Slugs
|
|
85
|
+
|
|
86
|
+
Now
|
|
87
|
+
`{ collection: { key: "posts" } }`
|
|
88
|
+
|
|
89
|
+
Future
|
|
90
|
+
`{ collection: { slug: "posts" } }`
|
|
91
|
+
|
|
92
|
+
Collection identifiers will match Payload. Consumers should not be aware of internal collection IDs.
|
|
93
|
+
|
|
94
|
+
## Temporary Conversions
|
|
95
|
+
|
|
96
|
+
Helpers that translate Payload queries into the current Content API format are temporary and placed in the `temp-utilities` folder.
|
|
97
|
+
|
|
98
|
+
They live in the `temp-utilities` folder until the Content API is fully aligned with Payload.
|