@payloadcms/figma 0.0.1-alpha.3 → 0.0.1-alpha.30
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 +54 -15
- 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 +42 -12
- 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/oauth-flow.d.ts +1 -1
- package/dist/auth/oauth-flow.d.ts.map +1 -1
- package/dist/auth/oauth-flow.js +5 -5
- 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/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.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/deploy.d.ts +4 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +68 -126
- 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 +90 -85
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list-tokens.js +2 -2
- 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 +12 -6
- 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 +5 -0
- package/dist/config/oauth.d.ts.map +1 -1
- package/dist/config/oauth.js +9 -4
- package/dist/config/oauth.js.map +1 -1
- package/dist/db-content-api/README.md +108 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +3702 -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 +551 -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 +7 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/sorting.js +71 -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 +45 -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.d.ts +24 -0
- package/dist/db-content-api/utilities/data.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data.js +118 -0
- package/dist/db-content-api/utilities/data.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 +130 -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 +63 -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 +3 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +4 -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 +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +42 -6
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/strategy/index.d.ts.map +1 -1
- package/dist/oauth/strategy/index.js +6 -2
- 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 +89 -9
- 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.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 +126 -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 +35 -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/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 +1 -7
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/lambda-config.d.ts.map +1 -1
- package/dist/utils/lambda-config.js +1 -0
- package/dist/utils/lambda-config.js.map +1 -1
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +5 -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 +33 -4
- package/dist/utils/payload-config-modifier.js.map +1 -1
- package/dist/utils/payload-package-check.d.ts +5 -0
- package/dist/utils/payload-package-check.d.ts.map +1 -1
- package/dist/utils/payload-package-check.js +48 -4
- 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 -6
- 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 +1 -6
- package/dist/utils/typescript-validator.js.map +1 -1
- package/package.json +24 -7
package/dist/config/oauth.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { FIGMA_CLIENT_IDS } from '../constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default port for OAuth callback server
|
|
4
|
+
* Using a high port (34462) to avoid conflicts with common dev servers (3000, 8080, etc.)
|
|
5
|
+
*/ export const DEFAULT_CALLBACK_PORT = 34462;
|
|
2
6
|
export const URLS = {
|
|
3
7
|
prod: {
|
|
4
8
|
authorizationUrl: 'https://www.figma.com/oauth',
|
|
@@ -6,9 +10,10 @@ export const URLS = {
|
|
|
6
10
|
tokenUrl: 'https://api.figma.com/v1/oauth/token'
|
|
7
11
|
},
|
|
8
12
|
staging: {
|
|
9
|
-
authorizationUrl:
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
authorizationUrl: process.env.FIGMA_AUTH_URL ? `${process.env.FIGMA_AUTH_URL}/oauth` // TODO: Might need to add /cms here based on recent changes
|
|
14
|
+
: 'https://staging.figma.com/oauth',
|
|
15
|
+
refreshUrl: process.env.FIGMA_API_URL ? `${process.env.FIGMA_API_URL}/v1/oauth/refresh` : 'https://api.staging.figma.com/v1/oauth/refresh',
|
|
16
|
+
tokenUrl: process.env.FIGMA_API_URL ? `${process.env.FIGMA_API_URL}/v1/oauth/token` : 'https://api.staging.figma.com/v1/oauth/token'
|
|
12
17
|
}
|
|
13
18
|
};
|
|
14
19
|
/**
|
|
@@ -26,7 +31,7 @@ export const URLS = {
|
|
|
26
31
|
clientId: process.env.FIGMA_CLIENT_ID || FIGMA_CLIENT_IDS.staging,
|
|
27
32
|
// No client secret - this is a public OAuth client using PKCE
|
|
28
33
|
// Public clients cannot securely store secrets in CLI environments
|
|
29
|
-
redirectUri: process.env.FIGMA_REDIRECT_URI ||
|
|
34
|
+
redirectUri: process.env.FIGMA_REDIRECT_URI || `http://localhost:${DEFAULT_CALLBACK_PORT}/callback`,
|
|
30
35
|
// Only current_user:read scope is needed for basic user info
|
|
31
36
|
scopes: [
|
|
32
37
|
'current_user:read'
|
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 { FIGMA_CLIENT_IDS } from '../constants.js'\n\nexport const URLS: Record<\n 'prod' | 'staging',\n Pick<OAuthConfig, 'authorizationUrl' | 'refreshUrl' | 'tokenUrl'>\n> = {\n prod: {\n authorizationUrl: 'https://www.figma.com/oauth',\n refreshUrl: 'https://api.figma.com/v1/oauth/refresh',\n tokenUrl: 'https://api.figma.com/v1/oauth/token',\n },\n staging: {\n authorizationUrl: 'https://staging.figma.com/oauth',\n refreshUrl: 'https://api.staging.figma.com/v1/oauth/refresh',\n tokenUrl: 'https://api.staging.figma.com/v1/oauth/token',\n },\n}\n\n/**\n * Figma OAuth2 configuration for public CLI client\n *\n * This is a PUBLIC OAuth client using PKCE (Proof Key for Code Exchange).\n * No client secret is used because CLIs cannot securely store secrets.\n * PKCE provides security through the code_verifier/code_challenge mechanism.\n *\n * For production use, register a public OAuth app with Figma.\n * To register an OAuth app, visit: https://www.figma.com/developers/api#oauth2\n */\nexport const OAUTH_CONFIG: OAuthConfig = {\n // OAuth client ID (public client)\n // Uses staging client ID by default since we use staging endpoints\n clientId: process.env.FIGMA_CLIENT_ID || FIGMA_CLIENT_IDS.staging,\n\n // No client secret - this is a public OAuth client using PKCE\n // Public clients cannot securely store secrets in CLI environments\n\n redirectUri
|
|
1
|
+
{"version":3,"sources":["../../src/config/oauth.ts"],"sourcesContent":["import type { OAuthConfig } from '../auth/types.js'\n\nimport { FIGMA_CLIENT_IDS } from '../constants.js'\n\n/**\n * Default port for OAuth callback server\n * Using a high port (34462) to avoid conflicts with common dev servers (3000, 8080, etc.)\n */\nexport const DEFAULT_CALLBACK_PORT = 34462\n\nexport const URLS: Record<\n 'prod' | 'staging',\n Pick<OAuthConfig, 'authorizationUrl' | 'refreshUrl' | 'tokenUrl'>\n> = {\n prod: {\n authorizationUrl: 'https://www.figma.com/oauth',\n refreshUrl: 'https://api.figma.com/v1/oauth/refresh',\n tokenUrl: 'https://api.figma.com/v1/oauth/token',\n },\n staging: {\n authorizationUrl: process.env.FIGMA_AUTH_URL\n ? `${process.env.FIGMA_AUTH_URL}/oauth` // TODO: Might need to add /cms here based on recent changes\n : 'https://staging.figma.com/oauth',\n refreshUrl: process.env.FIGMA_API_URL\n ? `${process.env.FIGMA_API_URL}/v1/oauth/refresh`\n : 'https://api.staging.figma.com/v1/oauth/refresh',\n tokenUrl: process.env.FIGMA_API_URL\n ? `${process.env.FIGMA_API_URL}/v1/oauth/token`\n : 'https://api.staging.figma.com/v1/oauth/token',\n },\n}\n\n/**\n * Figma OAuth2 configuration for public CLI client\n *\n * This is a PUBLIC OAuth client using PKCE (Proof Key for Code Exchange).\n * No client secret is used because CLIs cannot securely store secrets.\n * PKCE provides security through the code_verifier/code_challenge mechanism.\n *\n * For production use, register a public OAuth app with Figma.\n * To register an OAuth app, visit: https://www.figma.com/developers/api#oauth2\n */\nexport const OAUTH_CONFIG: OAuthConfig = {\n // OAuth client ID (public client)\n // Uses staging client ID by default since we use staging endpoints\n clientId: process.env.FIGMA_CLIENT_ID || FIGMA_CLIENT_IDS.staging,\n\n // No client secret - this is a public OAuth client using PKCE\n // Public clients cannot securely store secrets in CLI environments\n\n redirectUri:\n process.env.FIGMA_REDIRECT_URI || `http://localhost:${DEFAULT_CALLBACK_PORT}/callback`,\n\n // Only current_user:read scope is needed for basic user info\n scopes: ['current_user:read'],\n\n // TODO: Dynamically choose between prod and staging based on environment\n ...URLS.staging,\n}\n\n/**\n * Buffer time (in seconds) before token expiration to consider token as expired\n * This helps avoid using tokens that are about to expire\n */\nexport const TOKEN_EXPIRY_BUFFER_SECONDS = 300 // 5 minutes\n"],"names":["FIGMA_CLIENT_IDS","DEFAULT_CALLBACK_PORT","URLS","prod","authorizationUrl","refreshUrl","tokenUrl","staging","process","env","FIGMA_AUTH_URL","FIGMA_API_URL","OAUTH_CONFIG","clientId","FIGMA_CLIENT_ID","redirectUri","FIGMA_REDIRECT_URI","scopes","TOKEN_EXPIRY_BUFFER_SECONDS"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,kBAAiB;AAElD;;;CAGC,GACD,OAAO,MAAMC,wBAAwB,MAAK;AAE1C,OAAO,MAAMC,OAGT;IACFC,MAAM;QACJC,kBAAkB;QAClBC,YAAY;QACZC,UAAU;IACZ;IACAC,SAAS;QACPH,kBAAkBI,QAAQC,GAAG,CAACC,cAAc,GACxC,GAAGF,QAAQC,GAAG,CAACC,cAAc,CAAC,MAAM,CAAC,CAAC,4DAA4D;WAClG;QACJL,YAAYG,QAAQC,GAAG,CAACE,aAAa,GACjC,GAAGH,QAAQC,GAAG,CAACE,aAAa,CAAC,iBAAiB,CAAC,GAC/C;QACJL,UAAUE,QAAQC,GAAG,CAACE,aAAa,GAC/B,GAAGH,QAAQC,GAAG,CAACE,aAAa,CAAC,eAAe,CAAC,GAC7C;IACN;AACF,EAAC;AAED;;;;;;;;;CASC,GACD,OAAO,MAAMC,eAA4B;IACvC,kCAAkC;IAClC,mEAAmE;IACnEC,UAAUL,QAAQC,GAAG,CAACK,eAAe,IAAId,iBAAiBO,OAAO;IAEjE,8DAA8D;IAC9D,mEAAmE;IAEnEQ,aACEP,QAAQC,GAAG,CAACO,kBAAkB,IAAI,CAAC,iBAAiB,EAAEf,sBAAsB,SAAS,CAAC;IAExF,6DAA6D;IAC7DgB,QAAQ;QAAC;KAAoB;IAE7B,yEAAyE;IACzE,GAAGf,KAAKK,OAAO;AACjB,EAAC;AAED;;;CAGC,GACD,OAAO,MAAMW,8BAA8B,IAAI,YAAY;CAAb"}
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
## Sorting
|
|
18
|
+
|
|
19
|
+
Now
|
|
20
|
+
`[{ path: "createdAt", direction: "desc" }]`
|
|
21
|
+
|
|
22
|
+
Future
|
|
23
|
+
`"-createdAt"` or `"createdAt"` or `["-createdAt", "title"]`
|
|
24
|
+
|
|
25
|
+
Sorting will match Payload. It can be a single string or an array of strings using Payload path syntax.
|
|
26
|
+
|
|
27
|
+
## Pagination
|
|
28
|
+
|
|
29
|
+
~~Now~~
|
|
30
|
+
~~`{ limit: 10, offset: 20 }`~~
|
|
31
|
+
|
|
32
|
+
✅ Partially Implemented
|
|
33
|
+
`{ limit: 10, page: 3 }`
|
|
34
|
+
|
|
35
|
+
**Status:**
|
|
36
|
+
|
|
37
|
+
- ✅ Content API main endpoints use `page` (matches Payload)
|
|
38
|
+
|
|
39
|
+
- ⚠️ **Issue #1 (Joins):** `JoinClause` still uses `offset` instead of `page`
|
|
40
|
+
- Payload `JoinQuery`: `{ page?: number, limit?: number }`
|
|
41
|
+
- Content API `JoinClause`: `{ offset?: number, limit?: number }`
|
|
42
|
+
- **Inconsistent** with main endpoints which use `page`
|
|
43
|
+
|
|
44
|
+
**Current workaround for joins:** The adapter converts `page` to `offset`:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// Payload join query
|
|
48
|
+
{ page: 2, limit: 5 }
|
|
49
|
+
// Adapter converts to offset for Content API
|
|
50
|
+
{ offset: 5, limit: 5 }
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Future:**
|
|
54
|
+
|
|
55
|
+
1. Content API should support `skip` parameter for main endpoints
|
|
56
|
+
2. Content API `JoinClause` should use `page` instead of `offset` (consistent with main endpoints)
|
|
57
|
+
3. Content API pagination response should match Payload's flat structure
|
|
58
|
+
|
|
59
|
+
### Pagination Response Structure
|
|
60
|
+
|
|
61
|
+
**Payload format (flat):**
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
{
|
|
65
|
+
docs: [...],
|
|
66
|
+
hasNextPage: boolean,
|
|
67
|
+
hasPrevPage: boolean,
|
|
68
|
+
limit: number,
|
|
69
|
+
nextPage: number | null,
|
|
70
|
+
page: number,
|
|
71
|
+
pagingCounter: number,
|
|
72
|
+
prevPage: number | null,
|
|
73
|
+
totalDocs: number,
|
|
74
|
+
totalPages: number
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Content API format (nested):**
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
{
|
|
82
|
+
data: [...],
|
|
83
|
+
pagination: {
|
|
84
|
+
total: number,
|
|
85
|
+
current: { limit: number, page: number },
|
|
86
|
+
next?: { limit: number, page: number },
|
|
87
|
+
prev?: { limit: number, page: number }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Current workaround:** The adapter transforms Content API's nested structure to Payload's flat structure using `getPaginationData()` utility.
|
|
93
|
+
|
|
94
|
+
## Slugs
|
|
95
|
+
|
|
96
|
+
Now
|
|
97
|
+
`{ collection: { key: "posts" } }`
|
|
98
|
+
|
|
99
|
+
Future
|
|
100
|
+
`{ collection: { slug: "posts" } }`
|
|
101
|
+
|
|
102
|
+
Collection identifiers will match Payload. Consumers should not be aware of internal collection IDs.
|
|
103
|
+
|
|
104
|
+
## Temporary Conversions
|
|
105
|
+
|
|
106
|
+
Helpers that translate Payload queries into the current Content API format are temporary and placed in the `temp-utilities` folder.
|
|
107
|
+
|
|
108
|
+
They live in the `temp-utilities` folder until the Content API is fully aligned with Payload.
|