@payloadcms/figma 0.0.1-alpha.25 → 0.0.1-alpha.27
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 +18 -0
- package/dist/api/control-plane.d.ts.map +1 -1
- package/dist/api/control-plane.js +27 -0
- 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 +5 -2
- package/dist/api/figma-api.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +41 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/config/oauth.js +2 -1
- package/dist/config/oauth.js.map +1 -1
- package/dist/db-content-api/generated/content-api-types.d.ts +3129 -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 +31 -0
- package/dist/db-content-api/index.d.ts.map +1 -0
- package/dist/db-content-api/index.js +825 -0
- package/dist/db-content-api/index.js.map +1 -0
- package/dist/db-content-api/types.d.ts +31 -0
- package/dist/db-content-api/types.d.ts.map +1 -0
- package/dist/db-content-api/types.js +7 -0
- package/dist/db-content-api/types.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
- package/dist/oauth/strategy/index.d.ts.map +1 -1
- package/dist/oauth/strategy/index.js +4 -0
- package/dist/oauth/strategy/index.js.map +1 -1
- package/dist/plugin/build-config.d.ts.map +1 -1
- package/dist/plugin/build-config.js +35 -17
- package/dist/plugin/build-config.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/package.json +3 -1
- package/dist/db-adapter.d.ts +0 -17
- package/dist/db-adapter.d.ts.map +0 -1
- package/dist/db-adapter.js +0 -760
- package/dist/db-adapter.js.map +0 -1
|
@@ -1,26 +1,65 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import * as log from './log.js';
|
|
4
|
+
// Standard Payload config file names in priority order
|
|
5
|
+
const CONFIG_FILES = [
|
|
6
|
+
'payload.config.ts',
|
|
7
|
+
'payload.config.js',
|
|
8
|
+
'src/payload.config.ts',
|
|
9
|
+
'src/payload.config.js'
|
|
10
|
+
];
|
|
2
11
|
/**
|
|
3
|
-
* Find the Payload config file using Payload's built-in finder
|
|
4
|
-
*
|
|
12
|
+
* Find the Payload config file using Payload's built-in finder when available,
|
|
13
|
+
* with fallback to simple file search for npx environments where payload isn't installed.
|
|
5
14
|
*
|
|
6
15
|
* @param projectPath - Absolute path to project directory
|
|
7
16
|
* @returns Absolute path to config file, or null if not found
|
|
8
17
|
*/ export async function findPayloadConfig(projectPath) {
|
|
18
|
+
// First, try using Payload's official config finder (if payload is installed)
|
|
19
|
+
const configFromPayload = await findConfigWithPayload(projectPath);
|
|
20
|
+
if (configFromPayload) {
|
|
21
|
+
return configFromPayload;
|
|
22
|
+
}
|
|
23
|
+
// Fallback: Simple file search for standard config locations
|
|
24
|
+
// This works when running via npx before payload is installed
|
|
25
|
+
log.debug('Payload not available, using fallback config finder');
|
|
26
|
+
return findConfigFallback(projectPath);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Try to find config using Payload's findConfig function.
|
|
30
|
+
* Returns null if payload is not installed (dynamic import fails).
|
|
31
|
+
*/ async function findConfigWithPayload(projectPath) {
|
|
9
32
|
const originalCwd = process.cwd();
|
|
10
33
|
try {
|
|
34
|
+
// Dynamic import - will fail gracefully if payload is not installed
|
|
35
|
+
const { findConfig } = await import('payload/node');
|
|
11
36
|
// findConfig requires being in the project directory
|
|
12
37
|
process.chdir(projectPath);
|
|
13
|
-
// Use Payload's official config finder
|
|
14
38
|
const configPath = findConfig();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
39
|
+
return configPath || null;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// payload not installed or other error - return null to use fallback
|
|
42
|
+
log.debug(`Could not use Payload findConfig: ${error instanceof Error ? error.message : 'unknown'}`);
|
|
19
43
|
return null;
|
|
20
44
|
} finally{
|
|
21
|
-
// Always restore original working directory
|
|
22
45
|
process.chdir(originalCwd);
|
|
23
46
|
}
|
|
24
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Fallback config finder that checks standard locations.
|
|
50
|
+
* Used when payload is not installed (e.g., running via npx).
|
|
51
|
+
*/ async function findConfigFallback(projectPath) {
|
|
52
|
+
for (const configFile of CONFIG_FILES){
|
|
53
|
+
const fullPath = path.join(projectPath, configFile);
|
|
54
|
+
try {
|
|
55
|
+
await fs.access(fullPath);
|
|
56
|
+
log.debug(`Found config at: ${fullPath}`);
|
|
57
|
+
return fullPath;
|
|
58
|
+
} catch {
|
|
59
|
+
// File doesn't exist, try next
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
25
64
|
|
|
26
65
|
//# sourceMappingURL=payload-config-finder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/payload-config-finder.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/utils/payload-config-finder.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport path from 'path'\n\nimport * as log from './log.js'\n\n// Standard Payload config file names in priority order\nconst CONFIG_FILES = [\n 'payload.config.ts',\n 'payload.config.js',\n 'src/payload.config.ts',\n 'src/payload.config.js',\n]\n\n/**\n * Find the Payload config file using Payload's built-in finder when available,\n * with fallback to simple file search for npx environments where payload isn't installed.\n *\n * @param projectPath - Absolute path to project directory\n * @returns Absolute path to config file, or null if not found\n */\nexport async function findPayloadConfig(projectPath: string): Promise<null | string> {\n // First, try using Payload's official config finder (if payload is installed)\n const configFromPayload = await findConfigWithPayload(projectPath)\n if (configFromPayload) {\n return configFromPayload\n }\n\n // Fallback: Simple file search for standard config locations\n // This works when running via npx before payload is installed\n log.debug('Payload not available, using fallback config finder')\n return findConfigFallback(projectPath)\n}\n\n/**\n * Try to find config using Payload's findConfig function.\n * Returns null if payload is not installed (dynamic import fails).\n */\nasync function findConfigWithPayload(projectPath: string): Promise<null | string> {\n const originalCwd = process.cwd()\n\n try {\n // Dynamic import - will fail gracefully if payload is not installed\n const { findConfig } = await import('payload/node')\n\n // findConfig requires being in the project directory\n process.chdir(projectPath)\n const configPath = findConfig()\n return configPath || null\n } catch (error) {\n // payload not installed or other error - return null to use fallback\n log.debug(\n `Could not use Payload findConfig: ${error instanceof Error ? error.message : 'unknown'}`,\n )\n return null\n } finally {\n process.chdir(originalCwd)\n }\n}\n\n/**\n * Fallback config finder that checks standard locations.\n * Used when payload is not installed (e.g., running via npx).\n */\nasync function findConfigFallback(projectPath: string): Promise<null | string> {\n for (const configFile of CONFIG_FILES) {\n const fullPath = path.join(projectPath, configFile)\n try {\n await fs.access(fullPath)\n log.debug(`Found config at: ${fullPath}`)\n return fullPath\n } catch {\n // File doesn't exist, try next\n }\n }\n\n return null\n}\n"],"names":["fs","path","log","CONFIG_FILES","findPayloadConfig","projectPath","configFromPayload","findConfigWithPayload","debug","findConfigFallback","originalCwd","process","cwd","findConfig","chdir","configPath","error","Error","message","configFile","fullPath","join","access"],"mappings":"AAAA,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB,YAAYC,SAAS,WAAU;AAE/B,uDAAuD;AACvD,MAAMC,eAAe;IACnB;IACA;IACA;IACA;CACD;AAED;;;;;;CAMC,GACD,OAAO,eAAeC,kBAAkBC,WAAmB;IACzD,8EAA8E;IAC9E,MAAMC,oBAAoB,MAAMC,sBAAsBF;IACtD,IAAIC,mBAAmB;QACrB,OAAOA;IACT;IAEA,6DAA6D;IAC7D,8DAA8D;IAC9DJ,IAAIM,KAAK,CAAC;IACV,OAAOC,mBAAmBJ;AAC5B;AAEA;;;CAGC,GACD,eAAeE,sBAAsBF,WAAmB;IACtD,MAAMK,cAAcC,QAAQC,GAAG;IAE/B,IAAI;QACF,oEAAoE;QACpE,MAAM,EAAEC,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC;QAEpC,qDAAqD;QACrDF,QAAQG,KAAK,CAACT;QACd,MAAMU,aAAaF;QACnB,OAAOE,cAAc;IACvB,EAAE,OAAOC,OAAO;QACd,qEAAqE;QACrEd,IAAIM,KAAK,CACP,CAAC,kCAAkC,EAAEQ,iBAAiBC,QAAQD,MAAME,OAAO,GAAG,WAAW;QAE3F,OAAO;IACT,SAAU;QACRP,QAAQG,KAAK,CAACJ;IAChB;AACF;AAEA;;;CAGC,GACD,eAAeD,mBAAmBJ,WAAmB;IACnD,KAAK,MAAMc,cAAchB,aAAc;QACrC,MAAMiB,WAAWnB,KAAKoB,IAAI,CAAChB,aAAac;QACxC,IAAI;YACF,MAAMnB,GAAGsB,MAAM,CAACF;YAChBlB,IAAIM,KAAK,CAAC,CAAC,iBAAiB,EAAEY,UAAU;YACxC,OAAOA;QACT,EAAE,OAAM;QACN,+BAA+B;QACjC;IACF;IAEA,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/figma",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.27",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "22.12.0",
|
|
46
|
+
"openapi-typescript": "^7.10.1",
|
|
46
47
|
"tsx": "4.20.6",
|
|
47
48
|
"typescript": "5.9.3",
|
|
48
49
|
"vitest": "3.2.4"
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"debug:refresh-token": "tsx scripts/refresh-token.ts",
|
|
73
74
|
"debug:tokens": "tsx scripts/debug-tokens.ts",
|
|
74
75
|
"debug:write-token": "tsx scripts/write-token.ts",
|
|
76
|
+
"generate:types": "tsx scripts/generate-types.ts",
|
|
75
77
|
"lint": "eslint .",
|
|
76
78
|
"lint:fix": "eslint . --fix",
|
|
77
79
|
"start": "pnpm build && node ./bin/cli.js",
|
package/dist/db-adapter.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { BaseDatabaseAdapter, DatabaseAdapterObj } from 'payload';
|
|
2
|
-
interface ContentAPIDatabaseAdapterOptions {
|
|
3
|
-
contentApiKey: string;
|
|
4
|
-
contentApiUrl: string;
|
|
5
|
-
contentSystemId: string;
|
|
6
|
-
projectToken: string;
|
|
7
|
-
}
|
|
8
|
-
export type ContentAPIAdapter = {
|
|
9
|
-
contentApiKey: string;
|
|
10
|
-
contentApiUrl: string;
|
|
11
|
-
contentSystemId: string;
|
|
12
|
-
projectToken: string;
|
|
13
|
-
request<T = any>(path: string, body?: any): Promise<T>;
|
|
14
|
-
} & BaseDatabaseAdapter;
|
|
15
|
-
export declare const contentAPIAdapter: (opts: ContentAPIDatabaseAdapterOptions) => DatabaseAdapterObj;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=db-adapter.d.ts.map
|
package/dist/db-adapter.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db-adapter.d.ts","sourceRoot":"","sources":["../src/db-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mBAAmB,EAanB,kBAAkB,EAqBnB,MAAM,SAAS,CAAA;AAchB,UAAU,gCAAgC;IACxC,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CACvD,GAAG,mBAAmB,CAAA;AAqzBvB,eAAO,MAAM,iBAAiB,SAAU,gCAAgC,KAAG,kBA6C1E,CAAA"}
|