@payloadcms/figma 0.0.1-alpha.41 → 0.0.1-alpha.43
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/auth/oauth-flow.d.ts.map +1 -1
- package/dist/auth/oauth-flow.js +6 -3
- package/dist/auth/oauth-flow.js.map +1 -1
- package/dist/auth/refresh.d.ts +2 -1
- package/dist/auth/refresh.d.ts.map +1 -1
- package/dist/auth/refresh.js +11 -3
- package/dist/auth/refresh.js.map +1 -1
- package/dist/auth/token-store.d.ts +6 -4
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +17 -14
- package/dist/auth/token-store.js.map +1 -1
- package/dist/auth/types.d.ts +7 -4
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/cli.js +8 -6
- package/dist/cli.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +2 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list-tokens.d.ts +3 -3
- package/dist/commands/list-tokens.d.ts.map +1 -1
- package/dist/commands/list-tokens.js +20 -8
- package/dist/commands/list-tokens.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +12 -4
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +5 -4
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +55 -12
- package/dist/commands/logout.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -4
- package/dist/constants.js.map +1 -1
- package/dist/db-content-api/generated/content-api-types.d.ts +166 -277
- package/dist/db-content-api/generated/content-api-types.d.ts.map +1 -1
- package/dist/db-content-api/generated/content-api-types.js.map +1 -1
- package/dist/db-content-api/index.d.ts.map +1 -1
- package/dist/db-content-api/index.js +116 -64
- package/dist/db-content-api/index.js.map +1 -1
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +31 -1
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts.map +1 -1
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +24 -24
- package/dist/db-content-api/temp-utilities/unwrapDocument.js.map +1 -1
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts.map +1 -1
- package/dist/db-content-api/utilities/data/castFieldValue.js +4 -1
- package/dist/db-content-api/utilities/data/castFieldValue.js.map +1 -1
- package/dist/db-content-api/utilities/data/index.d.ts +2 -0
- package/dist/db-content-api/utilities/data/index.d.ts.map +1 -1
- package/dist/db-content-api/utilities/data/index.js +23 -2
- package/dist/db-content-api/utilities/data/index.js.map +1 -1
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +11 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts.map +1 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +55 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js.map +1 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +22 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts.map +1 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js +30 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js.map +1 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +7 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts.map +1 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +151 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js.map +1 -0
- package/dist/db-content-api/utilities/meta/index.d.ts +5 -0
- package/dist/db-content-api/utilities/meta/index.d.ts.map +1 -0
- package/dist/db-content-api/utilities/meta/index.js +5 -0
- package/dist/db-content-api/utilities/meta/index.js.map +1 -0
- package/dist/db-content-api/utilities/where.d.ts.map +1 -1
- package/dist/db-content-api/utilities/where.js +17 -3
- package/dist/db-content-api/utilities/where.js.map +1 -1
- package/dist/oauth/components/LogoutButton/index.d.ts.map +1 -1
- package/dist/oauth/components/LogoutButton/index.js +5 -3
- package/dist/oauth/components/LogoutButton/index.js.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +17 -7
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +1 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -4
- package/dist/oauth/endpoints/getLogoutEndpoint.js.map +1 -1
- package/dist/plugin/build-config.js +3 -3
- package/dist/plugin/build-config.js.map +1 -1
- package/dist/storage-content-api/api-types.d.ts +8 -1
- package/dist/storage-content-api/api-types.d.ts.map +1 -1
- package/dist/storage-content-api/api-types.js.map +1 -1
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts.map +1 -1
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +3 -3
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js.map +1 -1
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts.map +1 -1
- package/dist/storage-content-api/client-uploads/generateSignedURL.js +9 -1
- package/dist/storage-content-api/client-uploads/generateSignedURL.js.map +1 -1
- package/dist/storage-content-api/generateURL.d.ts.map +1 -1
- package/dist/storage-content-api/generateURL.js +3 -2
- package/dist/storage-content-api/generateURL.js.map +1 -1
- package/dist/storage-content-api/handleDelete.d.ts.map +1 -1
- package/dist/storage-content-api/handleDelete.js +4 -2
- package/dist/storage-content-api/handleDelete.js.map +1 -1
- package/dist/storage-content-api/handleUpload.d.ts +1 -1
- package/dist/storage-content-api/handleUpload.d.ts.map +1 -1
- package/dist/storage-content-api/handleUpload.js +11 -3
- package/dist/storage-content-api/handleUpload.js.map +1 -1
- package/dist/storage-content-api/staticHandler.js +1 -0
- package/dist/storage-content-api/staticHandler.js.map +1 -1
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +12 -0
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts.map +1 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js +61 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js.map +1 -0
- package/dist/storage-content-api/utilities/index.d.ts +2 -0
- package/dist/storage-content-api/utilities/index.d.ts.map +1 -0
- package/dist/storage-content-api/utilities/index.js +3 -0
- package/dist/storage-content-api/utilities/index.js.map +1 -0
- package/dist/templates/.env.example +11 -0
- package/dist/utils/env-management.d.ts +9 -1
- package/dist/utils/env-management.d.ts.map +1 -1
- package/dist/utils/env-management.js +39 -17
- package/dist/utils/env-management.js.map +1 -1
- package/dist/utils/format-env-suffix.d.ts +12 -0
- package/dist/utils/format-env-suffix.d.ts.map +1 -0
- package/dist/utils/format-env-suffix.js +13 -0
- package/dist/utils/format-env-suffix.js.map +1 -0
- package/dist/utils/lambda-config.js +26 -12
- package/dist/utils/lambda-config.js.map +1 -1
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +1 -2
- package/dist/utils/messages.js.map +1 -1
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/project.js +3 -0
- package/dist/utils/project.js.map +1 -1
- package/package.json +2 -2
- package/dist/db-content-api/temp-utilities/pagination.d.ts +0 -13
- package/dist/db-content-api/temp-utilities/pagination.d.ts.map +0 -1
- package/dist/db-content-api/temp-utilities/pagination.js +0 -45
- package/dist/db-content-api/temp-utilities/pagination.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
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["../../src/commands/logout.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport pc from 'picocolors'\n\nimport type { Environment } from '../constants.js'\n\nimport { getTokenStore } from '../auth/token-store.js'\nimport { getEnvironment } from '../constants.js'\nimport { formatEnvSuffix } from '../utils/format-env-suffix.js'\nimport * as log from '../utils/log.js'\n\n/**\n * Options for logout command\n */\nexport interface LogoutCommandOptions {\n /** Logout from all environments */\n all?: boolean\n /** Enable debug mode */\n debug?: boolean\n}\n\nconst ALL_ENVIRONMENTS: Environment[] = ['production', 'staging']\n\n/**\n * Handle the `@payloadcms/figma logout` command\n *\n * Clears stored tokens (OAuth and project tokens) after confirmation.\n * By default clears only current environment. Use --all for all environments.\n */\nexport async function logoutCommand(options: LogoutCommandOptions = {}): Promise<void> {\n const currentEnv = getEnvironment()\n\n if (options.all) {\n await logoutAllEnvironments()\n } else {\n await logoutSingleEnvironment(currentEnv)\n }\n}\n\nasync function logoutSingleEnvironment(env: Environment): Promise<void> {\n const tokenStore = getTokenStore(env)\n const hasTokens = tokenStore.getTokens() !== null\n\n if (!hasTokens) {\n p.log.warn(pc.yellow(`No tokens found${formatEnvSuffix(env, ' for ')}. Already logged out.`))\n return\n }\n\n const confirmed = await p.confirm({\n initialValue: false,\n message: `This will clear all OAuth and project tokens${formatEnvSuffix(env, ' for ')}. 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 tokenStore.clearTokens()\n tokenStore.clearAllProjectTokens()\n s.stop(pc.green(`✓ Logged out${formatEnvSuffix(env, ' from ')}`))\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\nasync function logoutAllEnvironments(): Promise<void> {\n // Check which environments have tokens\n const envsWithTokens = ALL_ENVIRONMENTS.filter((env) => {\n const store = getTokenStore(env)\n return store.getTokens() !== null\n })\n\n if (envsWithTokens.length === 0) {\n p.log.warn(pc.yellow('No tokens found in any environment. Already logged out.'))\n return\n }\n\n const envList = envsWithTokens.join(' and ')\n const confirmed = await p.confirm({\n initialValue: false,\n message: `This will clear all OAuth and project tokens for ${envList}. 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 for (const env of envsWithTokens) {\n const store = getTokenStore(env)\n store.clearTokens()\n store.clearAllProjectTokens()\n }\n s.stop(pc.green('✓ Logged out from all environments'))\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","getEnvironment","formatEnvSuffix","log","ALL_ENVIRONMENTS","logoutCommand","options","currentEnv","all","logoutAllEnvironments","logoutSingleEnvironment","env","tokenStore","hasTokens","getTokens","warn","yellow","confirmed","confirm","initialValue","message","isCancel","info","s","spinner","start","clearTokens","clearAllProjectTokens","stop","green","error","red","Error","process","exit","envsWithTokens","filter","store","length","envList","join"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,QAAQ,aAAY;AAI3B,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,cAAc,QAAQ,kBAAiB;AAChD,SAASC,eAAe,QAAQ,gCAA+B;AAC/D,YAAYC,SAAS,kBAAiB;AAYtC,MAAMC,mBAAkC;IAAC;IAAc;CAAU;AAEjE;;;;;CAKC,GACD,OAAO,eAAeC,cAAcC,UAAgC,CAAC,CAAC;IACpE,MAAMC,aAAaN;IAEnB,IAAIK,QAAQE,GAAG,EAAE;QACf,MAAMC;IACR,OAAO;QACL,MAAMC,wBAAwBH;IAChC;AACF;AAEA,eAAeG,wBAAwBC,GAAgB;IACrD,MAAMC,aAAaZ,cAAcW;IACjC,MAAME,YAAYD,WAAWE,SAAS,OAAO;IAE7C,IAAI,CAACD,WAAW;QACdf,EAAEK,GAAG,CAACY,IAAI,CAAChB,GAAGiB,MAAM,CAAC,CAAC,eAAe,EAAEd,gBAAgBS,KAAK,SAAS,qBAAqB,CAAC;QAC3F;IACF;IAEA,MAAMM,YAAY,MAAMnB,EAAEoB,OAAO,CAAC;QAChCC,cAAc;QACdC,SAAS,CAAC,4CAA4C,EAAElB,gBAAgBS,KAAK,SAAS,WAAW,CAAC;IACpG;IAEA,IAAIb,EAAEuB,QAAQ,CAACJ,cAAc,CAACA,WAAW;QACvCnB,EAAEK,GAAG,CAACmB,IAAI,CAAC;QACX;IACF;IAEA,MAAMC,IAAIzB,EAAE0B,OAAO;IACnBD,EAAEE,KAAK,CAAC;IAER,IAAI;QACFb,WAAWc,WAAW;QACtBd,WAAWe,qBAAqB;QAChCJ,EAAEK,IAAI,CAAC7B,GAAG8B,KAAK,CAAC,CAAC,YAAY,EAAE3B,gBAAgBS,KAAK,WAAW;IACjE,EAAE,OAAOmB,OAAO;QACdP,EAAEK,IAAI,CAAC7B,GAAGgC,GAAG,CAAC;QACd5B,IAAI2B,KAAK,CAACA,iBAAiBE,QAAQF,MAAMV,OAAO,GAAG;QACnDa,QAAQC,IAAI,CAAC;IACf;AACF;AAEA,eAAezB;IACb,uCAAuC;IACvC,MAAM0B,iBAAiB/B,iBAAiBgC,MAAM,CAAC,CAACzB;QAC9C,MAAM0B,QAAQrC,cAAcW;QAC5B,OAAO0B,MAAMvB,SAAS,OAAO;IAC/B;IAEA,IAAIqB,eAAeG,MAAM,KAAK,GAAG;QAC/BxC,EAAEK,GAAG,CAACY,IAAI,CAAChB,GAAGiB,MAAM,CAAC;QACrB;IACF;IAEA,MAAMuB,UAAUJ,eAAeK,IAAI,CAAC;IACpC,MAAMvB,YAAY,MAAMnB,EAAEoB,OAAO,CAAC;QAChCC,cAAc;QACdC,SAAS,CAAC,iDAAiD,EAAEmB,QAAQ,WAAW,CAAC;IACnF;IAEA,IAAIzC,EAAEuB,QAAQ,CAACJ,cAAc,CAACA,WAAW;QACvCnB,EAAEK,GAAG,CAACmB,IAAI,CAAC;QACX;IACF;IAEA,MAAMC,IAAIzB,EAAE0B,OAAO;IACnBD,EAAEE,KAAK,CAAC;IAER,IAAI;QACF,KAAK,MAAMd,OAAOwB,eAAgB;YAChC,MAAME,QAAQrC,cAAcW;YAC5B0B,MAAMX,WAAW;YACjBW,MAAMV,qBAAqB;QAC7B;QACAJ,EAAEK,IAAI,CAAC7B,GAAG8B,KAAK,CAAC;IAClB,EAAE,OAAOC,OAAO;QACdP,EAAEK,IAAI,CAAC7B,GAAGgC,GAAG,CAAC;QACd5B,IAAI2B,KAAK,CAACA,iBAAiBE,QAAQF,MAAMV,OAAO,GAAG;QACnDa,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare const ENV_CONFIG: Record<Environment, EnvironmentConfig>;
|
|
|
28
28
|
export declare function setEnvironment(env: Environment | undefined): void;
|
|
29
29
|
/**
|
|
30
30
|
* Get current Figma environment
|
|
31
|
-
* Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) 'production' default
|
|
31
|
+
* Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) .env file, 4) 'production' default
|
|
32
32
|
*/
|
|
33
33
|
export declare function getEnvironment(): Environment;
|
|
34
34
|
export {};
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;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,CA0B5C"}
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
+
import { getEnvVarSync } from './utils/env-management.js';
|
|
1
2
|
/**
|
|
2
|
-
* Figma environment (production or staging)
|
|
3
|
-
*/ /**
|
|
4
3
|
* Environment-specific configuration for Figma integration.
|
|
5
4
|
* Selected via FIGMA_ENV ('production' | 'staging'), defaults to 'production'.
|
|
6
5
|
*/ export const ENV_CONFIG = {
|
|
@@ -30,12 +29,28 @@ let envOverride;
|
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
31
|
* Get current Figma environment
|
|
33
|
-
* Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) 'production' default
|
|
32
|
+
* Priority: 1) setEnvironment override, 2) FIGMA_ENV env var, 3) .env file, 4) 'production' default
|
|
34
33
|
*/ export function getEnvironment() {
|
|
35
34
|
if (envOverride) {
|
|
36
35
|
return envOverride;
|
|
37
36
|
}
|
|
38
|
-
|
|
37
|
+
// Check process.env first (case-insensitive)
|
|
38
|
+
if (process.env.FIGMA_ENV?.toLowerCase() === 'staging') {
|
|
39
|
+
return 'staging';
|
|
40
|
+
}
|
|
41
|
+
// Fall back to .env file in cwd
|
|
42
|
+
const envFileValue = getEnvVarSync(process.cwd(), 'FIGMA_ENV');
|
|
43
|
+
if (envFileValue) {
|
|
44
|
+
const env = envFileValue.toLowerCase();
|
|
45
|
+
if (env === 'staging') {
|
|
46
|
+
return 'staging';
|
|
47
|
+
}
|
|
48
|
+
if (env !== 'production') {
|
|
49
|
+
console.warn(`Warning: Invalid FIGMA_ENV value "${envFileValue}" in .env file. Using production.`);
|
|
50
|
+
}
|
|
51
|
+
return 'production';
|
|
52
|
+
}
|
|
53
|
+
return 'production';
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import { getEnvVarSync } from './utils/env-management.js'\n\n/**\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) .env file, 4) 'production' default\n */\nexport function getEnvironment(): Environment {\n if (envOverride) {\n return envOverride\n }\n\n // Check process.env first (case-insensitive)\n if (process.env.FIGMA_ENV?.toLowerCase() === 'staging') {\n return 'staging'\n }\n\n // Fall back to .env file in cwd\n const envFileValue = getEnvVarSync(process.cwd(), 'FIGMA_ENV')\n if (envFileValue) {\n const env = envFileValue.toLowerCase()\n if (env === 'staging') {\n return 'staging'\n }\n if (env !== 'production') {\n console.warn(\n `Warning: Invalid FIGMA_ENV value \"${envFileValue}\" in .env file. Using production.`,\n )\n }\n return 'production'\n }\n\n return 'production'\n}\n"],"names":["getEnvVarSync","ENV_CONFIG","production","apiBaseUrl","authorizationUrl","clientId","contentApiUrl","identityMetadata","jwksUri","staging","envOverride","setEnvironment","env","getEnvironment","process","FIGMA_ENV","toLowerCase","envFileValue","cwd","console","warn"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA2B;AAsBzD;;;CAGC,GACD,OAAO,MAAMC,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;IAEA,6CAA6C;IAC7C,IAAII,QAAQF,GAAG,CAACG,SAAS,EAAEC,kBAAkB,WAAW;QACtD,OAAO;IACT;IAEA,gCAAgC;IAChC,MAAMC,eAAejB,cAAcc,QAAQI,GAAG,IAAI;IAClD,IAAID,cAAc;QAChB,MAAML,MAAMK,aAAaD,WAAW;QACpC,IAAIJ,QAAQ,WAAW;YACrB,OAAO;QACT;QACA,IAAIA,QAAQ,cAAc;YACxBO,QAAQC,IAAI,CACV,CAAC,kCAAkC,EAAEH,aAAa,iCAAiC,CAAC;QAExF;QACA,OAAO;IACT;IAEA,OAAO;AACT"}
|