@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.
Files changed (209) hide show
  1. package/dist/api/control-plane.d.ts +22 -1
  2. package/dist/api/control-plane.d.ts.map +1 -1
  3. package/dist/api/control-plane.js +54 -15
  4. package/dist/api/control-plane.js.map +1 -1
  5. package/dist/api/figma-api.d.ts.map +1 -1
  6. package/dist/api/figma-api.js +42 -12
  7. package/dist/api/figma-api.js.map +1 -1
  8. package/dist/auth/callback-server.d.ts.map +1 -1
  9. package/dist/auth/callback-server.js +2 -1
  10. package/dist/auth/callback-server.js.map +1 -1
  11. package/dist/auth/crypto-utils.d.ts.map +1 -1
  12. package/dist/auth/crypto-utils.js +5 -5
  13. package/dist/auth/crypto-utils.js.map +1 -1
  14. package/dist/auth/oauth-flow.d.ts +1 -1
  15. package/dist/auth/oauth-flow.d.ts.map +1 -1
  16. package/dist/auth/oauth-flow.js +5 -5
  17. package/dist/auth/oauth-flow.js.map +1 -1
  18. package/dist/auth/project-token.d.ts.map +1 -1
  19. package/dist/auth/project-token.js +9 -4
  20. package/dist/auth/project-token.js.map +1 -1
  21. package/dist/auth/token-store.d.ts +10 -0
  22. package/dist/auth/token-store.d.ts.map +1 -1
  23. package/dist/auth/token-store.js +20 -0
  24. package/dist/auth/token-store.js.map +1 -1
  25. package/dist/cli.js +3 -0
  26. package/dist/cli.js.map +1 -1
  27. package/dist/commands/deploy.d.ts +4 -0
  28. package/dist/commands/deploy.d.ts.map +1 -1
  29. package/dist/commands/deploy.js +68 -126
  30. package/dist/commands/deploy.js.map +1 -1
  31. package/dist/commands/init.d.ts +1 -5
  32. package/dist/commands/init.d.ts.map +1 -1
  33. package/dist/commands/init.js +90 -85
  34. package/dist/commands/init.js.map +1 -1
  35. package/dist/commands/list-tokens.js +2 -2
  36. package/dist/commands/list-tokens.js.map +1 -1
  37. package/dist/commands/login.d.ts +8 -1
  38. package/dist/commands/login.d.ts.map +1 -1
  39. package/dist/commands/login.js +12 -6
  40. package/dist/commands/login.js.map +1 -1
  41. package/dist/commands/logout.js +2 -2
  42. package/dist/commands/logout.js.map +1 -1
  43. package/dist/config/oauth.d.ts +5 -0
  44. package/dist/config/oauth.d.ts.map +1 -1
  45. package/dist/config/oauth.js +9 -4
  46. package/dist/config/oauth.js.map +1 -1
  47. package/dist/db-content-api/README.md +108 -0
  48. package/dist/db-content-api/generated/content-api-types.d.ts +3702 -0
  49. package/dist/db-content-api/generated/content-api-types.d.ts.map +1 -0
  50. package/dist/db-content-api/generated/content-api-types.js +7 -0
  51. package/dist/db-content-api/generated/content-api-types.js.map +1 -0
  52. package/dist/db-content-api/index.d.ts +18 -0
  53. package/dist/db-content-api/index.d.ts.map +1 -0
  54. package/dist/db-content-api/index.js +551 -0
  55. package/dist/db-content-api/index.js.map +1 -0
  56. package/dist/db-content-api/temp-utilities/pagination.d.ts +13 -0
  57. package/dist/db-content-api/temp-utilities/pagination.d.ts.map +1 -0
  58. package/dist/db-content-api/temp-utilities/pagination.js +45 -0
  59. package/dist/db-content-api/temp-utilities/pagination.js.map +1 -0
  60. package/dist/db-content-api/temp-utilities/slug.d.ts +2 -0
  61. package/dist/db-content-api/temp-utilities/slug.d.ts.map +1 -0
  62. package/dist/db-content-api/temp-utilities/slug.js +3 -0
  63. package/dist/db-content-api/temp-utilities/slug.js.map +1 -0
  64. package/dist/db-content-api/temp-utilities/sorting.d.ts +7 -0
  65. package/dist/db-content-api/temp-utilities/sorting.d.ts.map +1 -0
  66. package/dist/db-content-api/temp-utilities/sorting.js +71 -0
  67. package/dist/db-content-api/temp-utilities/sorting.js.map +1 -0
  68. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +4 -0
  69. package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts.map +1 -0
  70. package/dist/db-content-api/temp-utilities/unwrapDocument.js +45 -0
  71. package/dist/db-content-api/temp-utilities/unwrapDocument.js.map +1 -0
  72. package/dist/db-content-api/utilities/auth.d.ts +30 -0
  73. package/dist/db-content-api/utilities/auth.d.ts.map +1 -0
  74. package/dist/db-content-api/utilities/auth.js +81 -0
  75. package/dist/db-content-api/utilities/auth.js.map +1 -0
  76. package/dist/db-content-api/utilities/data.d.ts +24 -0
  77. package/dist/db-content-api/utilities/data.d.ts.map +1 -0
  78. package/dist/db-content-api/utilities/data.js +118 -0
  79. package/dist/db-content-api/utilities/data.js.map +1 -0
  80. package/dist/db-content-api/utilities/joins.d.ts +55 -0
  81. package/dist/db-content-api/utilities/joins.d.ts.map +1 -0
  82. package/dist/db-content-api/utilities/joins.js +130 -0
  83. package/dist/db-content-api/utilities/joins.js.map +1 -0
  84. package/dist/db-content-api/utilities/where.d.ts +12 -0
  85. package/dist/db-content-api/utilities/where.d.ts.map +1 -0
  86. package/dist/db-content-api/utilities/where.js +63 -0
  87. package/dist/db-content-api/utilities/where.js.map +1 -0
  88. package/dist/endpoints/health.d.ts +3 -0
  89. package/dist/endpoints/health.d.ts.map +1 -0
  90. package/dist/endpoints/health.js +11 -0
  91. package/dist/endpoints/health.js.map +1 -0
  92. package/dist/exports/client.d.ts +3 -0
  93. package/dist/exports/client.d.ts.map +1 -0
  94. package/dist/exports/client.js +4 -0
  95. package/dist/exports/client.js.map +1 -0
  96. package/dist/index.d.ts +2 -1
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +3 -1
  99. package/dist/index.js.map +1 -1
  100. package/dist/oauth/components/LoginButton/index.d.ts.map +1 -1
  101. package/dist/oauth/components/LoginButton/index.js +50 -6
  102. package/dist/oauth/components/LoginButton/index.js.map +1 -1
  103. package/dist/oauth/components/LoginButton/index.scss +50 -3
  104. package/dist/oauth/components/LogoutButton/index.d.ts.map +1 -1
  105. package/dist/oauth/components/LogoutButton/index.js +0 -1
  106. package/dist/oauth/components/LogoutButton/index.js.map +1 -1
  107. package/dist/oauth/defaults.d.ts.map +1 -1
  108. package/dist/oauth/defaults.js +29 -5
  109. package/dist/oauth/defaults.js.map +1 -1
  110. package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +1 -1
  111. package/dist/oauth/endpoints/getLoginEndpoint.js +1 -1
  112. package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
  113. package/dist/oauth/index.d.ts.map +1 -1
  114. package/dist/oauth/index.js +42 -6
  115. package/dist/oauth/index.js.map +1 -1
  116. package/dist/oauth/strategy/index.d.ts.map +1 -1
  117. package/dist/oauth/strategy/index.js +6 -2
  118. package/dist/oauth/strategy/index.js.map +1 -1
  119. package/dist/oauth/types.d.ts +6 -6
  120. package/dist/oauth/types.d.ts.map +1 -1
  121. package/dist/oauth/types.js.map +1 -1
  122. package/dist/oauth/utilities/createCookieOptions.d.ts.map +1 -1
  123. package/dist/oauth/utilities/createCookieOptions.js.map +1 -1
  124. package/dist/oauth/utilities/isDuplicateKeyError.d.ts +7 -0
  125. package/dist/oauth/utilities/isDuplicateKeyError.d.ts.map +1 -0
  126. package/dist/oauth/utilities/isDuplicateKeyError.js +14 -0
  127. package/dist/oauth/utilities/isDuplicateKeyError.js.map +1 -0
  128. package/dist/oauth/utilities/refreshTokens.d.ts.map +1 -1
  129. package/dist/oauth/utilities/refreshTokens.js +1 -1
  130. package/dist/oauth/utilities/refreshTokens.js.map +1 -1
  131. package/dist/plugin/build-config.d.ts +21 -4
  132. package/dist/plugin/build-config.d.ts.map +1 -1
  133. package/dist/plugin/build-config.js +89 -9
  134. package/dist/plugin/build-config.js.map +1 -1
  135. package/dist/storage-content-api/api-types.d.ts +161 -0
  136. package/dist/storage-content-api/api-types.d.ts.map +1 -0
  137. package/dist/storage-content-api/api-types.js +6 -0
  138. package/dist/storage-content-api/api-types.js.map +1 -0
  139. package/dist/storage-content-api/client.d.ts +6 -0
  140. package/dist/storage-content-api/client.d.ts.map +1 -0
  141. package/dist/storage-content-api/client.js +36 -0
  142. package/dist/storage-content-api/client.js.map +1 -0
  143. package/dist/storage-content-api/generateURL.d.ts +7 -0
  144. package/dist/storage-content-api/generateURL.d.ts.map +1 -0
  145. package/dist/storage-content-api/generateURL.js +7 -0
  146. package/dist/storage-content-api/generateURL.js.map +1 -0
  147. package/dist/storage-content-api/handleDelete.d.ts +8 -0
  148. package/dist/storage-content-api/handleDelete.d.ts.map +1 -0
  149. package/dist/storage-content-api/handleDelete.js +15 -0
  150. package/dist/storage-content-api/handleDelete.js.map +1 -0
  151. package/dist/storage-content-api/handleUpload.d.ts +11 -0
  152. package/dist/storage-content-api/handleUpload.d.ts.map +1 -0
  153. package/dist/storage-content-api/handleUpload.js +126 -0
  154. package/dist/storage-content-api/handleUpload.js.map +1 -0
  155. package/dist/storage-content-api/index.d.ts +5 -0
  156. package/dist/storage-content-api/index.d.ts.map +1 -0
  157. package/dist/storage-content-api/index.js +31 -0
  158. package/dist/storage-content-api/index.js.map +1 -0
  159. package/dist/storage-content-api/staticHandler.d.ts +10 -0
  160. package/dist/storage-content-api/staticHandler.d.ts.map +1 -0
  161. package/dist/storage-content-api/staticHandler.js +35 -0
  162. package/dist/storage-content-api/staticHandler.js.map +1 -0
  163. package/dist/storage-content-api/types.d.ts +10 -0
  164. package/dist/storage-content-api/types.d.ts.map +1 -0
  165. package/dist/storage-content-api/types.js +3 -0
  166. package/dist/storage-content-api/types.js.map +1 -0
  167. package/dist/templates/README.md +19 -0
  168. package/dist/utils/env-management.d.ts +9 -8
  169. package/dist/utils/env-management.d.ts.map +1 -1
  170. package/dist/utils/env-management.js +73 -74
  171. package/dist/utils/env-management.js.map +1 -1
  172. package/dist/utils/formatter.d.ts.map +1 -1
  173. package/dist/utils/formatter.js +1 -7
  174. package/dist/utils/formatter.js.map +1 -1
  175. package/dist/utils/lambda-config.d.ts.map +1 -1
  176. package/dist/utils/lambda-config.js +1 -0
  177. package/dist/utils/lambda-config.js.map +1 -1
  178. package/dist/utils/messages.d.ts.map +1 -1
  179. package/dist/utils/messages.js +5 -7
  180. package/dist/utils/messages.js.map +1 -1
  181. package/dist/utils/payload-config-ast.d.ts +22 -3
  182. package/dist/utils/payload-config-ast.d.ts.map +1 -1
  183. package/dist/utils/payload-config-ast.js +89 -31
  184. package/dist/utils/payload-config-ast.js.map +1 -1
  185. package/dist/utils/payload-config-finder.d.ts +2 -2
  186. package/dist/utils/payload-config-finder.d.ts.map +1 -1
  187. package/dist/utils/payload-config-finder.js +48 -9
  188. package/dist/utils/payload-config-finder.js.map +1 -1
  189. package/dist/utils/payload-config-modifier.d.ts.map +1 -1
  190. package/dist/utils/payload-config-modifier.js +33 -4
  191. package/dist/utils/payload-config-modifier.js.map +1 -1
  192. package/dist/utils/payload-package-check.d.ts +5 -0
  193. package/dist/utils/payload-package-check.d.ts.map +1 -1
  194. package/dist/utils/payload-package-check.js +48 -4
  195. package/dist/utils/payload-package-check.js.map +1 -1
  196. package/dist/utils/project.d.ts.map +1 -1
  197. package/dist/utils/project.js +8 -6
  198. package/dist/utils/project.js.map +1 -1
  199. package/dist/utils/s3-upload.d.ts +0 -1
  200. package/dist/utils/s3-upload.d.ts.map +1 -1
  201. package/dist/utils/s3-upload.js +10 -3
  202. package/dist/utils/s3-upload.js.map +1 -1
  203. package/dist/utils/token-display.d.ts.map +1 -1
  204. package/dist/utils/token-display.js +11 -5
  205. package/dist/utils/token-display.js.map +1 -1
  206. package/dist/utils/typescript-validator.d.ts.map +1 -1
  207. package/dist/utils/typescript-validator.js +1 -6
  208. package/dist/utils/typescript-validator.js.map +1 -1
  209. package/package.json +24 -7
@@ -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: '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'
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 || 'http://localhost:3000/callback',
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'
@@ -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: process.env.FIGMA_REDIRECT_URI || 'http://localhost:3000/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","URLS","prod","authorizationUrl","refreshUrl","tokenUrl","staging","OAUTH_CONFIG","clientId","process","env","FIGMA_CLIENT_ID","redirectUri","FIGMA_REDIRECT_URI","scopes","TOKEN_EXPIRY_BUFFER_SECONDS"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,kBAAiB;AAElD,OAAO,MAAMC,OAGT;IACFC,MAAM;QACJC,kBAAkB;QAClBC,YAAY;QACZC,UAAU;IACZ;IACAC,SAAS;QACPH,kBAAkB;QAClBC,YAAY;QACZC,UAAU;IACZ;AACF,EAAC;AAED;;;;;;;;;CASC,GACD,OAAO,MAAME,eAA4B;IACvC,kCAAkC;IAClC,mEAAmE;IACnEC,UAAUC,QAAQC,GAAG,CAACC,eAAe,IAAIX,iBAAiBM,OAAO;IAEjE,8DAA8D;IAC9D,mEAAmE;IAEnEM,aAAaH,QAAQC,GAAG,CAACG,kBAAkB,IAAI;IAE/C,6DAA6D;IAC7DC,QAAQ;QAAC;KAAoB;IAE7B,yEAAyE;IACzE,GAAGb,KAAKK,OAAO;AACjB,EAAC;AAED;;;CAGC,GACD,OAAO,MAAMS,8BAA8B,IAAI,YAAY;CAAb"}
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.