@intlayer/api 9.6.0 → 9.7.1

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 (206) hide show
  1. package/dist/cjs/cms/createAuthManager.cjs +2 -3
  2. package/dist/cjs/cms/createIntlayerCMS.cjs +2 -3
  3. package/dist/cjs/cms/index.cjs +2 -2
  4. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +3 -4
  5. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
  6. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +3 -4
  7. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
  8. package/dist/cjs/distantDictionary/index.cjs +2 -2
  9. package/dist/cjs/fetcher.cjs +2 -3
  10. package/dist/cjs/fetcher.cjs.map +1 -1
  11. package/dist/cjs/getIntlayerAPI/ai.cjs +79 -26
  12. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  13. package/dist/cjs/getIntlayerAPI/analytics.cjs +47 -14
  14. package/dist/cjs/getIntlayerAPI/analytics.cjs.map +1 -1
  15. package/dist/cjs/getIntlayerAPI/asset.cjs +41 -12
  16. package/dist/cjs/getIntlayerAPI/asset.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAPI/audit.cjs +73 -20
  18. package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
  19. package/dist/cjs/getIntlayerAPI/bitbucket.cjs +42 -13
  20. package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
  21. package/dist/cjs/getIntlayerAPI/codeberg.cjs +20 -0
  22. package/dist/cjs/getIntlayerAPI/codeberg.cjs.map +1 -0
  23. package/dist/cjs/getIntlayerAPI/dictionary.cjs +62 -17
  24. package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
  25. package/dist/cjs/getIntlayerAPI/editor.cjs +3 -4
  26. package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
  27. package/dist/cjs/getIntlayerAPI/environment.cjs +47 -14
  28. package/dist/cjs/getIntlayerAPI/environment.cjs.map +1 -1
  29. package/dist/cjs/getIntlayerAPI/forge.cjs +63 -0
  30. package/dist/cjs/getIntlayerAPI/forge.cjs.map +1 -0
  31. package/dist/cjs/getIntlayerAPI/gitee.cjs +20 -0
  32. package/dist/cjs/getIntlayerAPI/gitee.cjs.map +1 -0
  33. package/dist/cjs/getIntlayerAPI/github.cjs +47 -14
  34. package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
  35. package/dist/cjs/getIntlayerAPI/gitlab.cjs +42 -13
  36. package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
  37. package/dist/cjs/getIntlayerAPI/index.cjs +27 -24
  38. package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
  39. package/dist/cjs/getIntlayerAPI/newsletter.cjs +31 -10
  40. package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
  41. package/dist/cjs/getIntlayerAPI/oAuth.cjs +33 -8
  42. package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
  43. package/dist/cjs/getIntlayerAPI/organization.cjs +75 -24
  44. package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
  45. package/dist/cjs/getIntlayerAPI/project.cjs +115 -33
  46. package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
  47. package/dist/cjs/getIntlayerAPI/reviewer.cjs +145 -35
  48. package/dist/cjs/getIntlayerAPI/reviewer.cjs.map +1 -1
  49. package/dist/cjs/getIntlayerAPI/search.cjs +18 -7
  50. package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
  51. package/dist/cjs/getIntlayerAPI/showcaseProject.cjs +64 -19
  52. package/dist/cjs/getIntlayerAPI/showcaseProject.cjs.map +1 -1
  53. package/dist/cjs/getIntlayerAPI/status.cjs +19 -7
  54. package/dist/cjs/getIntlayerAPI/status.cjs.map +1 -1
  55. package/dist/cjs/getIntlayerAPI/stripe.cjs +144 -39
  56. package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
  57. package/dist/cjs/getIntlayerAPI/tag.cjs +36 -11
  58. package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
  59. package/dist/cjs/getIntlayerAPI/translate.cjs +49 -12
  60. package/dist/cjs/getIntlayerAPI/translate.cjs.map +1 -1
  61. package/dist/cjs/getIntlayerAPI/user.cjs +61 -18
  62. package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
  63. package/dist/cjs/index.cjs +38 -30
  64. package/dist/cjs/proxy.cjs +28 -25
  65. package/dist/cjs/proxy.cjs.map +1 -1
  66. package/dist/cjs/public/createPublicClient.cjs +26 -7
  67. package/dist/cjs/public/createPublicClient.cjs.map +1 -1
  68. package/dist/cjs/public/index.cjs +1 -1
  69. package/dist/cjs/resolveInternalBackendUrl.cjs +1 -2
  70. package/dist/esm/cms/createAuthManager.mjs +1 -2
  71. package/dist/esm/cms/createIntlayerCMS.mjs +1 -2
  72. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +1 -2
  73. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
  74. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +1 -2
  75. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
  76. package/dist/esm/fetcher.mjs +1 -2
  77. package/dist/esm/fetcher.mjs.map +1 -1
  78. package/dist/esm/getIntlayerAPI/ai.mjs +78 -25
  79. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  80. package/dist/esm/getIntlayerAPI/analytics.mjs +46 -13
  81. package/dist/esm/getIntlayerAPI/analytics.mjs.map +1 -1
  82. package/dist/esm/getIntlayerAPI/asset.mjs +40 -11
  83. package/dist/esm/getIntlayerAPI/asset.mjs.map +1 -1
  84. package/dist/esm/getIntlayerAPI/audit.mjs +72 -19
  85. package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
  86. package/dist/esm/getIntlayerAPI/bitbucket.mjs +41 -12
  87. package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
  88. package/dist/esm/getIntlayerAPI/codeberg.mjs +18 -0
  89. package/dist/esm/getIntlayerAPI/codeberg.mjs.map +1 -0
  90. package/dist/esm/getIntlayerAPI/dictionary.mjs +61 -16
  91. package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
  92. package/dist/esm/getIntlayerAPI/editor.mjs +2 -3
  93. package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
  94. package/dist/esm/getIntlayerAPI/environment.mjs +46 -13
  95. package/dist/esm/getIntlayerAPI/environment.mjs.map +1 -1
  96. package/dist/esm/getIntlayerAPI/forge.mjs +62 -0
  97. package/dist/esm/getIntlayerAPI/forge.mjs.map +1 -0
  98. package/dist/esm/getIntlayerAPI/gitee.mjs +18 -0
  99. package/dist/esm/getIntlayerAPI/gitee.mjs.map +1 -0
  100. package/dist/esm/getIntlayerAPI/github.mjs +46 -13
  101. package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
  102. package/dist/esm/getIntlayerAPI/gitlab.mjs +41 -12
  103. package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
  104. package/dist/esm/getIntlayerAPI/index.mjs +6 -3
  105. package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
  106. package/dist/esm/getIntlayerAPI/newsletter.mjs +30 -9
  107. package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
  108. package/dist/esm/getIntlayerAPI/oAuth.mjs +32 -7
  109. package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
  110. package/dist/esm/getIntlayerAPI/organization.mjs +74 -23
  111. package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
  112. package/dist/esm/getIntlayerAPI/project.mjs +114 -32
  113. package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
  114. package/dist/esm/getIntlayerAPI/reviewer.mjs +144 -34
  115. package/dist/esm/getIntlayerAPI/reviewer.mjs.map +1 -1
  116. package/dist/esm/getIntlayerAPI/search.mjs +17 -6
  117. package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
  118. package/dist/esm/getIntlayerAPI/showcaseProject.mjs +63 -18
  119. package/dist/esm/getIntlayerAPI/showcaseProject.mjs.map +1 -1
  120. package/dist/esm/getIntlayerAPI/status.mjs +18 -6
  121. package/dist/esm/getIntlayerAPI/status.mjs.map +1 -1
  122. package/dist/esm/getIntlayerAPI/stripe.mjs +143 -38
  123. package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
  124. package/dist/esm/getIntlayerAPI/tag.mjs +35 -10
  125. package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
  126. package/dist/esm/getIntlayerAPI/translate.mjs +48 -11
  127. package/dist/esm/getIntlayerAPI/translate.mjs.map +1 -1
  128. package/dist/esm/getIntlayerAPI/user.mjs +60 -17
  129. package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
  130. package/dist/esm/index.mjs +10 -7
  131. package/dist/esm/proxy.mjs +6 -3
  132. package/dist/esm/proxy.mjs.map +1 -1
  133. package/dist/esm/public/createPublicClient.mjs +26 -7
  134. package/dist/esm/public/createPublicClient.mjs.map +1 -1
  135. package/dist/esm/resolveInternalBackendUrl.mjs +1 -2
  136. package/dist/types/cms/createAuthManager.d.ts +1 -2
  137. package/dist/types/cms/createAuthManager.d.ts.map +1 -1
  138. package/dist/types/cms/createIntlayerCMS.d.ts +0 -2
  139. package/dist/types/cms/createIntlayerCMS.d.ts.map +1 -1
  140. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +1 -3
  141. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
  142. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +1 -3
  143. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
  144. package/dist/types/fetcher.d.ts +1 -3
  145. package/dist/types/fetcher.d.ts.map +1 -1
  146. package/dist/types/getIntlayerAPI/ai.d.ts +3 -5
  147. package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
  148. package/dist/types/getIntlayerAPI/analytics.d.ts +3 -5
  149. package/dist/types/getIntlayerAPI/analytics.d.ts.map +1 -1
  150. package/dist/types/getIntlayerAPI/asset.d.ts +3 -4
  151. package/dist/types/getIntlayerAPI/asset.d.ts.map +1 -1
  152. package/dist/types/getIntlayerAPI/audit.d.ts +49 -7
  153. package/dist/types/getIntlayerAPI/audit.d.ts.map +1 -1
  154. package/dist/types/getIntlayerAPI/bitbucket.d.ts +2 -4
  155. package/dist/types/getIntlayerAPI/bitbucket.d.ts.map +1 -1
  156. package/dist/types/getIntlayerAPI/codeberg.d.ts +59 -0
  157. package/dist/types/getIntlayerAPI/codeberg.d.ts.map +1 -0
  158. package/dist/types/getIntlayerAPI/dictionary.d.ts +3 -5
  159. package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
  160. package/dist/types/getIntlayerAPI/editor.d.ts +4 -5
  161. package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
  162. package/dist/types/getIntlayerAPI/environment.d.ts +3 -5
  163. package/dist/types/getIntlayerAPI/environment.d.ts.map +1 -1
  164. package/dist/types/getIntlayerAPI/forge.d.ts +34 -0
  165. package/dist/types/getIntlayerAPI/forge.d.ts.map +1 -0
  166. package/dist/types/getIntlayerAPI/gitee.d.ts +59 -0
  167. package/dist/types/getIntlayerAPI/gitee.d.ts.map +1 -0
  168. package/dist/types/getIntlayerAPI/github.d.ts +2 -4
  169. package/dist/types/getIntlayerAPI/github.d.ts.map +1 -1
  170. package/dist/types/getIntlayerAPI/gitlab.d.ts +2 -4
  171. package/dist/types/getIntlayerAPI/gitlab.d.ts.map +1 -1
  172. package/dist/types/getIntlayerAPI/index.d.ts +6 -3
  173. package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
  174. package/dist/types/getIntlayerAPI/newsletter.d.ts +3 -5
  175. package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
  176. package/dist/types/getIntlayerAPI/oAuth.d.ts +2 -2
  177. package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
  178. package/dist/types/getIntlayerAPI/organization.d.ts +3 -7
  179. package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
  180. package/dist/types/getIntlayerAPI/project.d.ts +4 -5
  181. package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
  182. package/dist/types/getIntlayerAPI/reviewer.d.ts +682 -39
  183. package/dist/types/getIntlayerAPI/reviewer.d.ts.map +1 -1
  184. package/dist/types/getIntlayerAPI/search.d.ts +3 -5
  185. package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
  186. package/dist/types/getIntlayerAPI/showcaseProject.d.ts +3 -5
  187. package/dist/types/getIntlayerAPI/showcaseProject.d.ts.map +1 -1
  188. package/dist/types/getIntlayerAPI/status.d.ts +5 -8
  189. package/dist/types/getIntlayerAPI/status.d.ts.map +1 -1
  190. package/dist/types/getIntlayerAPI/stripe.d.ts +3 -5
  191. package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
  192. package/dist/types/getIntlayerAPI/tag.d.ts +3 -5
  193. package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
  194. package/dist/types/getIntlayerAPI/translate.d.ts +3 -5
  195. package/dist/types/getIntlayerAPI/translate.d.ts.map +1 -1
  196. package/dist/types/getIntlayerAPI/user.d.ts +6 -8
  197. package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
  198. package/dist/types/index.d.ts +12 -9
  199. package/dist/types/proxy.d.ts +0 -2
  200. package/dist/types/proxy.d.ts.map +1 -1
  201. package/dist/types/public/createPublicClient.d.ts +1 -9
  202. package/dist/types/public/createPublicClient.d.ts.map +1 -1
  203. package/dist/types/resolveInternalBackendUrl.d.ts +0 -2
  204. package/dist/types/resolveInternalBackendUrl.d.ts.map +1 -1
  205. package/dist/types/types.d.ts +5 -2
  206. package/package.json +23 -6
@@ -1,16 +1,46 @@
1
- import { fetcher } from "../fetcher.mjs";
2
1
  import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
2
+ import { fetcher } from "../fetcher.mjs";
3
3
  import { editor } from "@intlayer/config/built";
4
+ import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
5
+ import { BACKEND_URL } from "@intlayer/config/defaultValues";
4
6
 
5
- //#region src/getIntlayerAPI/gitlab.ts
7
+ // src/getIntlayerAPI/gitlab.ts
8
+ /** Prefix of the routes, checked against the backend contract. */
9
+ const gitlabGroup = { prefix: "/api/gitlab" };
10
+ /**
11
+ * Method and path of every route, checked against the backend contract at
12
+ * compile time (the contract's zod schemas are never loaded).
13
+ */
14
+ const gitlabEndpoints = {
15
+ getAuthUrl: {
16
+ method: "GET",
17
+ path: "/auth-url"
18
+ },
19
+ authCallback: {
20
+ method: "POST",
21
+ path: "/auth"
22
+ },
23
+ listProjects: {
24
+ method: "GET",
25
+ path: "/projects"
26
+ },
27
+ checkConfig: {
28
+ method: "POST",
29
+ path: "/check-config"
30
+ },
31
+ getConfigFile: {
32
+ method: "POST",
33
+ path: "/get-config-file"
34
+ }
35
+ };
6
36
  const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
7
- const GITLAB_API_ROUTE = `${intlayerConfig?.editor?.backendURL ?? editor.backendURL}/api/gitlab`;
37
+ const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
8
38
  /**
9
39
  * Get GitLab OAuth authorization URL
10
40
  * @param redirectUri - Redirect URI after OAuth authorization
11
41
  * @param instanceUrl - Custom GitLab instance URL (optional, for self-hosted)
12
42
  */
13
- const getAuthUrl = async (redirectUri, instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/auth-url`, authAPIOptions, otherOptions, { params: {
43
+ const getAuthUrl = async (redirectUri, instanceUrl, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.getAuthUrl), authAPIOptions, otherOptions, { params: {
14
44
  redirectUri,
15
45
  ...instanceUrl && { instanceUrl }
16
46
  } });
@@ -20,8 +50,8 @@ const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
20
50
  * @param redirectUri - Redirect URI used in the authorization request
21
51
  * @param instanceUrl - Custom GitLab instance URL (optional)
22
52
  */
23
- const authenticate = async (code, redirectUri, instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/auth`, authAPIOptions, otherOptions, {
24
- method: "POST",
53
+ const authenticate = async (code, redirectUri, instanceUrl, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.authCallback), authAPIOptions, otherOptions, {
54
+ method: gitlabEndpoints.authCallback.method,
25
55
  body: {
26
56
  code,
27
57
  redirectUri,
@@ -33,7 +63,7 @@ const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
33
63
  * @param token - Optional GitLab access token. If not provided, backend will use session.
34
64
  * @param instanceUrl - Custom GitLab instance URL (optional)
35
65
  */
36
- const getProjects = async (token, instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/projects`, authAPIOptions, otherOptions, { params: {
66
+ const getProjects = async (token, instanceUrl, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.listProjects), authAPIOptions, otherOptions, { params: {
37
67
  ...token && { token },
38
68
  ...instanceUrl && { instanceUrl }
39
69
  } });
@@ -44,8 +74,8 @@ const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
44
74
  * @param branch - Branch name (default: 'main')
45
75
  * @param instanceUrl - Custom GitLab instance URL (optional)
46
76
  */
47
- const checkIntlayerConfig = async (token, projectId, branch = "main", instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/check-config`, authAPIOptions, otherOptions, {
48
- method: "POST",
77
+ const checkIntlayerConfig = async (token, projectId, branch = "main", instanceUrl, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.checkConfig), authAPIOptions, otherOptions, {
78
+ method: gitlabEndpoints.checkConfig.method,
49
79
  body: {
50
80
  token: token ?? void 0,
51
81
  projectId,
@@ -61,8 +91,8 @@ const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
61
91
  * @param path - File path (default: 'intlayer.config.ts')
62
92
  * @param instanceUrl - Custom GitLab instance URL (optional)
63
93
  */
64
- const getConfigFile = async (token, projectId, branch = "main", path = "intlayer.config.ts", instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/get-config-file`, authAPIOptions, otherOptions, {
65
- method: "POST",
94
+ const getConfigFile = async (token, projectId, branch = "main", path = "intlayer.config.ts", instanceUrl, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.getConfigFile), authAPIOptions, otherOptions, {
95
+ method: gitlabEndpoints.getConfigFile.method,
66
96
  body: {
67
97
  token: token ?? void 0,
68
98
  projectId,
@@ -87,6 +117,5 @@ const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
87
117
  */
88
118
  const gitlabEndpoint = createEndpoint(getGitlabAPI);
89
119
 
90
- //#endregion
91
120
  export { getGitlabAPI, gitlabEndpoint };
92
121
  //# sourceMappingURL=gitlab.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitLabProject = {\n id: number;\n name: string;\n path_with_namespace: string;\n web_url: string;\n default_branch: string;\n visibility: string;\n last_activity_at: string;\n namespace: {\n id: number;\n name: string;\n path: string;\n };\n};\n\nexport type GitLabAuthCallbackBody = {\n code: string;\n redirectUri: string;\n instanceUrl?: string;\n};\n\nexport type GitLabAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitLabListProjectsResult = {\n data: GitLabProject[];\n};\n\nexport type GitLabCheckConfigBody = {\n token?: string;\n projectId: number;\n branch?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabCheckConfigResult = {\n data: {\n hasConfig: boolean;\n configPaths: string[];\n };\n};\n\nexport type GitLabGetConfigFileBody = {\n token?: string;\n projectId: number;\n branch?: string;\n path?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitLabGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport const getGitlabAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const GITLAB_API_ROUTE = `${backendURL}/api/gitlab`;\n\n /**\n * Get GitLab OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n * @param instanceUrl - Custom GitLab instance URL (optional, for self-hosted)\n */\n const getAuthUrl = async (\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetAuthUrlResult>(\n `${GITLAB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri, ...(instanceUrl && { instanceUrl }) },\n }\n );\n\n /**\n * Exchange GitLab authorization code for access token\n * @param code - GitLab authorization code\n * @param redirectUri - Redirect URI used in the authorization request\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const authenticate = async (\n code: string,\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabAuthCallbackResult>(\n `${GITLAB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code, redirectUri, instanceUrl },\n }\n );\n\n /**\n * Get user's GitLab projects\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getProjects = async (\n token?: string | null,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabListProjectsResult>(\n `${GITLAB_API_ROUTE}/projects`,\n authAPIOptions,\n otherOptions,\n {\n params: {\n ...(token && { token }),\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabCheckConfigResult>(\n `${GITLAB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getConfigFile = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetConfigFileResult>(\n `${GITLAB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n path,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getProjects,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n\n/**\n * Authenticated `gitlab` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const gitlabEndpoint = createEndpoint(getGitlabAPI);\n"],"mappings":";;;;;AAsEA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,mBAAmB,GAFN,gBAAgB,QAAQ,cAAc,OAAO,WAEzB;;;;;;CAOvC,MAAM,aAAa,OACjB,aACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EAAE;EAAa,GAAI,eAAe,EAAE,YAAY;CAAG,EAC7D,CACF;;;;;;;CAQF,MAAM,eAAe,OACnB,MACA,aACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE;GAAM;GAAa;EAAY;CACzC,CACF;;;;;;CAOF,MAAM,cAAc,OAClB,OACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EACN,GAAI,SAAS,EAAE,MAAM;EACrB,GAAI,eAAe,EAAE,YAAY;CACnC,EACF,CACF;;;;;;;;CASF,MAAM,sBAAsB,OAC1B,OACA,WACA,SAAiB,QACjB,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA,GAAI,eAAe,EAAE,YAAY;EACnC;CACF,CACF;;;;;;;;;CAUF,MAAM,gBAAgB,OACpB,OACA,WACA,SAAiB,QACjB,OAAe,sBACf,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA;GACA,GAAI,eAAe,EAAE,YAAY;EACnC;CACF,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,iBAAiB,eAAe,YAAY"}
1
+ {"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n GitLabRoutes,\n gitlabContract,\n} from '@intlayer/backend-contract/gitProviders';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitLabProject = {\n id: number;\n name: string;\n path_with_namespace: string;\n web_url: string;\n default_branch: string;\n visibility: string;\n last_activity_at: string;\n namespace: {\n id: number;\n name: string;\n path: string;\n };\n};\n\nexport type GitLabAuthCallbackBody = {\n code: string;\n redirectUri: string;\n instanceUrl?: string;\n};\n\nexport type GitLabAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitLabListProjectsResult = {\n data: GitLabProject[];\n};\n\nexport type GitLabCheckConfigBody = {\n token?: string;\n projectId: number;\n branch?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabCheckConfigResult = {\n data: {\n hasConfig: boolean;\n configPaths: string[];\n };\n};\n\nexport type GitLabGetConfigFileBody = {\n token?: string;\n projectId: number;\n branch?: string;\n path?: string;\n instanceUrl?: string;\n};\n\nexport type GitLabGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitLabGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\n/** Prefix of the routes, checked against the backend contract. */\nconst gitlabGroup = {\n prefix: '/api/gitlab',\n} as const satisfies Pick<typeof gitlabContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst gitlabEndpoints = {\n getAuthUrl: { method: 'GET', path: '/auth-url' },\n authCallback: { method: 'POST', path: '/auth' },\n listProjects: { method: 'GET', path: '/projects' },\n checkConfig: { method: 'POST', path: '/check-config' },\n getConfigFile: { method: 'POST', path: '/get-config-file' },\n} as const satisfies RouteEndpoints<GitLabRoutes>;\n\nexport const getGitlabAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Get GitLab OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n * @param instanceUrl - Custom GitLab instance URL (optional, for self-hosted)\n */\n const getAuthUrl = async (\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetAuthUrlResult>(\n buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.getAuthUrl),\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri, ...(instanceUrl && { instanceUrl }) },\n }\n );\n\n /**\n * Exchange GitLab authorization code for access token\n * @param code - GitLab authorization code\n * @param redirectUri - Redirect URI used in the authorization request\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const authenticate = async (\n code: string,\n redirectUri: string,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabAuthCallbackResult>(\n buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.authCallback),\n authAPIOptions,\n otherOptions,\n {\n method: gitlabEndpoints.authCallback.method,\n body: { code, redirectUri, instanceUrl },\n }\n );\n\n /**\n * Get user's GitLab projects\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getProjects = async (\n token?: string | null,\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabListProjectsResult>(\n buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.listProjects),\n authAPIOptions,\n otherOptions,\n {\n params: {\n ...(token && { token }),\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabCheckConfigResult>(\n buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.checkConfig),\n authAPIOptions,\n otherOptions,\n {\n method: gitlabEndpoints.checkConfig.method,\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a GitLab repository\n * @param token - Optional GitLab access token. If not provided, backend will use session.\n * @param projectId - GitLab project ID\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n * @param instanceUrl - Custom GitLab instance URL (optional)\n */\n const getConfigFile = async (\n token: string | null | undefined,\n projectId: number,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n instanceUrl?: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitLabGetConfigFileResult>(\n buildRouteURL(backendURL, gitlabGroup, gitlabEndpoints.getConfigFile),\n authAPIOptions,\n otherOptions,\n {\n method: gitlabEndpoints.getConfigFile.method,\n body: {\n token: token ?? undefined,\n projectId,\n branch,\n path,\n ...(instanceUrl && { instanceUrl }),\n },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getProjects,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n\n/**\n * Authenticated `gitlab` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const gitlabEndpoint = createEndpoint(getGitlabAPI);\n"],"mappings":";;;;;;;;AA8EA,MAAM,cAAc,EAClB,QAAQ,cACV;;;;;AAMA,MAAM,kBAAkB;CACtB,YAAY;EAAE,QAAQ;EAAO,MAAM;CAAY;CAC/C,cAAc;EAAE,QAAQ;EAAQ,MAAM;CAAQ;CAC9C,cAAc;EAAE,QAAQ;EAAO,MAAM;CAAY;CACjD,aAAa;EAAE,QAAQ;EAAQ,MAAM;CAAgB;CACrD,eAAe;EAAE,QAAQ;EAAQ,MAAM;CAAmB;AAC5D;AAEA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;;;;;;CAO7D,MAAM,aAAa,OACjB,aACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,UAAU,GACjE,gBACA,cACA,EACE,QAAQ;EAAE;EAAa,GAAI,eAAe,EAAE,YAAY;CAAG,EAC7D,CACF;;;;;;;CAQF,MAAM,eAAe,OACnB,MACA,aACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,YAAY,GACnE,gBACA,cACA;EACE,QAAQ,gBAAgB,aAAa;EACrC,MAAM;GAAE;GAAM;GAAa;EAAY;CACzC,CACF;;;;;;CAOF,MAAM,cAAc,OAClB,OACA,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,YAAY,GACnE,gBACA,cACA,EACE,QAAQ;EACN,GAAI,SAAS,EAAE,MAAM;EACrB,GAAI,eAAe,EAAE,YAAY;CACnC,EACF,CACF;;;;;;;;CASF,MAAM,sBAAsB,OAC1B,OACA,WACA,SAAiB,QACjB,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,WAAW,GAClE,gBACA,cACA;EACE,QAAQ,gBAAgB,YAAY;EACpC,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA,GAAI,eAAe,EAAE,YAAY;EACnC;CACF,CACF;;;;;;;;;CAUF,MAAM,gBAAgB,OACpB,OACA,WACA,SAAiB,QACjB,OAAe,sBACf,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,aAAa,GACpE,gBACA,cACA;EACE,QAAQ,gBAAgB,cAAc;EACtC,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA;GACA,GAAI,eAAe,EAAE,YAAY;EACnC;CACF,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,iBAAiB,eAAe,YAAY"}
@@ -1,15 +1,17 @@
1
- import { getOAuthAPI } from "./oAuth.mjs";
2
1
  import { getAiAPI } from "./ai.mjs";
3
2
  import { getAnalyticsAPI } from "./analytics.mjs";
4
3
  import { getAssetAPI } from "./asset.mjs";
5
4
  import { getAuditAPI } from "./audit.mjs";
6
5
  import { getBitbucketAPI } from "./bitbucket.mjs";
6
+ import { getCodebergAPI } from "./codeberg.mjs";
7
7
  import { getDictionaryAPI } from "./dictionary.mjs";
8
8
  import { getEditorAPI } from "./editor.mjs";
9
9
  import { getEnvironmentAPI } from "./environment.mjs";
10
+ import { getGiteeAPI } from "./gitee.mjs";
10
11
  import { getGithubAPI } from "./github.mjs";
11
12
  import { getGitlabAPI } from "./gitlab.mjs";
12
13
  import { getNewsletterAPI } from "./newsletter.mjs";
14
+ import { getOAuthAPI } from "./oAuth.mjs";
13
15
  import { getOrganizationAPI } from "./organization.mjs";
14
16
  import { getProjectAPI } from "./project.mjs";
15
17
  import { getReviewerAPI } from "./reviewer.mjs";
@@ -23,7 +25,7 @@ import { getUserAPI } from "./user.mjs";
23
25
  import { editor } from "@intlayer/config/built";
24
26
  import { defu } from "defu";
25
27
 
26
- //#region src/getIntlayerAPI/index.ts
28
+ // src/getIntlayerAPI/index.ts
27
29
  const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
28
30
  const resolvedConfig = defu(intlayerConfig ?? {}, { editor });
29
31
  return {
@@ -45,6 +47,8 @@ const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
45
47
  github: getGithubAPI(authAPIOptions, resolvedConfig),
46
48
  gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),
47
49
  bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),
50
+ codeberg: getCodebergAPI(authAPIOptions, resolvedConfig),
51
+ gitee: getGiteeAPI(authAPIOptions, resolvedConfig),
48
52
  showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),
49
53
  translate: getTranslateAPI(authAPIOptions, resolvedConfig),
50
54
  reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),
@@ -52,6 +56,5 @@ const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
52
56
  };
53
57
  };
54
58
 
55
- //#endregion
56
59
  export { getIntlayerAPI };
57
60
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAnalyticsAPI } from './analytics';\nimport { getAssetAPI } from './asset';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStatusAPI } from './status';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n asset: ReturnType<typeof getAssetAPI>;\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n analytics: ReturnType<typeof getAnalyticsAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n status: ReturnType<typeof getStatusAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n asset: getAssetAPI(authAPIOptions, resolvedConfig),\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n analytics: getAnalyticsAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n status: getStatusAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAa,kBACX,iBAAiC,CAAC,GAClC,mBACsB;CACtB,MAAM,iBAAiB,KAAK,kBAAkB,CAAC,GAAG,EAChD,OACF,CAAC;CAED,OAAO;EACL,OAAO,YAAY,gBAAgB,cAAc;EACjD,cAAc,mBAAmB,gBAAgB,cAAc;EAC/D,SAAS,cAAc,gBAAgB,cAAc;EACrD,aAAa,kBAAkB,gBAAgB,cAAc;EAC7D,MAAM,WAAW,gBAAgB,cAAc;EAC/C,OAAO,YAAY,gBAAgB,cAAc;EACjD,YAAY,iBAAiB,gBAAgB,cAAc;EAC3D,QAAQ,aAAa,gBAAgB,cAAc;EACnD,IAAI,SAAS,gBAAgB,cAAc;EAC3C,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,OAAO,YAAY,gBAAgB,cAAc;EACjD,KAAK,UAAU,gBAAgB,cAAc;EAC7C,QAAQ,aAAa,gBAAgB,cAAc;EACnD,QAAQ,aAAa,gBAAgB,cAAc;EACnD,YAAY,iBAAiB,gBAAgB,cAAc;EAC3D,QAAQ,aAAa,gBAAgB,cAAc;EACnD,QAAQ,aAAa,gBAAgB,cAAc;EACnD,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,iBAAiB,sBAAsB,gBAAgB,cAAc;EACrE,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,UAAU,eAAe,gBAAgB,cAAc;EACvD,QAAQ,aAAa,gBAAgB,cAAc;CACrD;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { defu } from 'defu';\nimport type { FetcherOptions } from '../fetcher';\nimport { getAiAPI } from './ai';\nimport { getAnalyticsAPI } from './analytics';\nimport { getAssetAPI } from './asset';\nimport { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getCodebergAPI } from './codeberg';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\nimport { getEnvironmentAPI } from './environment';\nimport { getGiteeAPI } from './gitee';\nimport { getGithubAPI } from './github';\nimport { getGitlabAPI } from './gitlab';\nimport { getNewsletterAPI } from './newsletter';\nimport { getOAuthAPI } from './oAuth';\nimport { getOrganizationAPI } from './organization';\nimport { getProjectAPI } from './project';\nimport { getReviewerAPI } from './reviewer';\nimport { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStatusAPI } from './status';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getTranslateAPI } from './translate';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n asset: ReturnType<typeof getAssetAPI>;\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\n environment: ReturnType<typeof getEnvironmentAPI>;\n user: ReturnType<typeof getUserAPI>;\n oAuth: ReturnType<typeof getOAuthAPI>;\n dictionary: ReturnType<typeof getDictionaryAPI>;\n stripe: ReturnType<typeof getStripeAPI>;\n ai: ReturnType<typeof getAiAPI>;\n analytics: ReturnType<typeof getAnalyticsAPI>;\n audit: ReturnType<typeof getAuditAPI>;\n tag: ReturnType<typeof getTagAPI>;\n search: ReturnType<typeof getSearchAPI>;\n editor: ReturnType<typeof getEditorAPI>;\n newsletter: ReturnType<typeof getNewsletterAPI>;\n github: ReturnType<typeof getGithubAPI>;\n gitlab: ReturnType<typeof getGitlabAPI>;\n bitbucket: ReturnType<typeof getBitbucketAPI>;\n codeberg: ReturnType<typeof getCodebergAPI>;\n gitee: ReturnType<typeof getGiteeAPI>;\n showcaseProject: ReturnType<typeof getShowcaseProjectAPI>;\n translate: ReturnType<typeof getTranslateAPI>;\n reviewer: ReturnType<typeof getReviewerAPI>;\n status: ReturnType<typeof getStatusAPI>;\n}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(intlayerConfig ?? {}, {\n editor,\n }) as IntlayerConfig;\n\n return {\n asset: getAssetAPI(authAPIOptions, resolvedConfig),\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n environment: getEnvironmentAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(authAPIOptions, resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(authAPIOptions, resolvedConfig),\n analytics: getAnalyticsAPI(authAPIOptions, resolvedConfig),\n audit: getAuditAPI(authAPIOptions, resolvedConfig),\n tag: getTagAPI(authAPIOptions, resolvedConfig),\n search: getSearchAPI(authAPIOptions, resolvedConfig),\n editor: getEditorAPI(authAPIOptions, resolvedConfig),\n newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),\n github: getGithubAPI(authAPIOptions, resolvedConfig),\n gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),\n bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),\n codeberg: getCodebergAPI(authAPIOptions, resolvedConfig),\n gitee: getGiteeAPI(authAPIOptions, resolvedConfig),\n showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig),\n translate: getTranslateAPI(authAPIOptions, resolvedConfig),\n reviewer: getReviewerAPI(authAPIOptions, resolvedConfig),\n status: getStatusAPI(authAPIOptions, resolvedConfig),\n };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAa,kBACX,iBAAiC,CAAC,GAClC,mBACsB;CACtB,MAAM,iBAAiB,KAAK,kBAAkB,CAAC,GAAG,EAChD,OACF,CAAC;CAED,OAAO;EACL,OAAO,YAAY,gBAAgB,cAAc;EACjD,cAAc,mBAAmB,gBAAgB,cAAc;EAC/D,SAAS,cAAc,gBAAgB,cAAc;EACrD,aAAa,kBAAkB,gBAAgB,cAAc;EAC7D,MAAM,WAAW,gBAAgB,cAAc;EAC/C,OAAO,YAAY,gBAAgB,cAAc;EACjD,YAAY,iBAAiB,gBAAgB,cAAc;EAC3D,QAAQ,aAAa,gBAAgB,cAAc;EACnD,IAAI,SAAS,gBAAgB,cAAc;EAC3C,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,OAAO,YAAY,gBAAgB,cAAc;EACjD,KAAK,UAAU,gBAAgB,cAAc;EAC7C,QAAQ,aAAa,gBAAgB,cAAc;EACnD,QAAQ,aAAa,gBAAgB,cAAc;EACnD,YAAY,iBAAiB,gBAAgB,cAAc;EAC3D,QAAQ,aAAa,gBAAgB,cAAc;EACnD,QAAQ,aAAa,gBAAgB,cAAc;EACnD,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,UAAU,eAAe,gBAAgB,cAAc;EACvD,OAAO,YAAY,gBAAgB,cAAc;EACjD,iBAAiB,sBAAsB,gBAAgB,cAAc;EACrE,WAAW,gBAAgB,gBAAgB,cAAc;EACzD,UAAU,eAAe,gBAAgB,cAAc;EACvD,QAAQ,aAAa,gBAAgB,cAAc;CACrD;AACF"}
@@ -1,17 +1,39 @@
1
- import { fetcher } from "../fetcher.mjs";
2
1
  import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
2
+ import { fetcher } from "../fetcher.mjs";
3
3
  import { editor } from "@intlayer/config/built";
4
+ import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
5
+ import { BACKEND_URL } from "@intlayer/config/defaultValues";
4
6
 
5
- //#region src/getIntlayerAPI/newsletter.ts
7
+ // src/getIntlayerAPI/newsletter.ts
8
+ /** Prefix of the routes, checked against the backend contract. */
9
+ const newsletterGroup = { prefix: "/api/newsletter" };
10
+ /**
11
+ * Method and path of every route, checked against the backend contract at
12
+ * compile time (the contract's zod schemas are never loaded).
13
+ */
14
+ const newsletterEndpoints = {
15
+ subscribeToNewsletter: {
16
+ method: "POST",
17
+ path: "/subscribe"
18
+ },
19
+ unsubscribeFromNewsletter: {
20
+ method: "POST",
21
+ path: "/unsubscribe"
22
+ },
23
+ getNewsletterStatus: {
24
+ method: "GET",
25
+ path: "/status"
26
+ }
27
+ };
6
28
  const getNewsletterAPI = (authAPIOptions = {}, intlayerConfig) => {
7
- const NEWSLETTER_API_ROUTE = `${intlayerConfig?.editor?.backendURL ?? editor.backendURL}/api/newsletter`;
29
+ const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
8
30
  /**
9
31
  * Subscribe a user to newsletter(s)
10
32
  * @param body - Newsletter subscription parameters.
11
33
  * @returns Newsletter subscription result.
12
34
  */
13
- const subscribeToNewsletter = async (body, otherOptions = {}) => await fetcher(`${NEWSLETTER_API_ROUTE}/subscribe`, authAPIOptions, otherOptions, {
14
- method: "POST",
35
+ const subscribeToNewsletter = async (body, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, newsletterGroup, newsletterEndpoints.subscribeToNewsletter), authAPIOptions, otherOptions, {
36
+ method: newsletterEndpoints.subscribeToNewsletter.method,
15
37
  body
16
38
  });
17
39
  /**
@@ -19,15 +41,15 @@ const getNewsletterAPI = (authAPIOptions = {}, intlayerConfig) => {
19
41
  * @param body - Newsletter unsubscription parameters.
20
42
  * @returns Newsletter unsubscription result.
21
43
  */
22
- const unsubscribeFromNewsletter = async (body, otherOptions = {}) => await fetcher(`${NEWSLETTER_API_ROUTE}/unsubscribe`, authAPIOptions, otherOptions, {
23
- method: "POST",
44
+ const unsubscribeFromNewsletter = async (body, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, newsletterGroup, newsletterEndpoints.unsubscribeFromNewsletter), authAPIOptions, otherOptions, {
45
+ method: newsletterEndpoints.unsubscribeFromNewsletter.method,
24
46
  body
25
47
  });
26
48
  /**
27
49
  * Get newsletter subscription status for the authenticated user
28
50
  * @returns Newsletter subscription status.
29
51
  */
30
- const getNewsletterStatus = async (otherOptions = {}) => await fetcher(`${NEWSLETTER_API_ROUTE}/status`, authAPIOptions, otherOptions, { method: "GET" });
52
+ const getNewsletterStatus = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, newsletterGroup, newsletterEndpoints.getNewsletterStatus), authAPIOptions, otherOptions, { method: newsletterEndpoints.getNewsletterStatus.method });
31
53
  return {
32
54
  subscribeToNewsletter,
33
55
  unsubscribeFromNewsletter,
@@ -42,6 +64,5 @@ const getNewsletterAPI = (authAPIOptions = {}, intlayerConfig) => {
42
64
  */
43
65
  const newsletterEndpoint = createEndpoint(getNewsletterAPI);
44
66
 
45
- //#endregion
46
67
  export { getNewsletterAPI, newsletterEndpoint };
47
68
  //# sourceMappingURL=newsletter.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"newsletter.mjs","names":[],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;\n\n /**\n * Subscribe a user to newsletter(s)\n * @param body - Newsletter subscription parameters.\n * @returns Newsletter subscription result.\n */\n const subscribeToNewsletter = async (\n body: NewsletterSubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/subscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Unsubscribe a user from newsletter(s)\n * @param body - Newsletter unsubscription parameters.\n * @returns Newsletter unsubscription result.\n */\n const unsubscribeFromNewsletter = async (\n body: NewsletterUnsubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/unsubscribe`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Get newsletter subscription status for the authenticated user\n * @returns Newsletter subscription status.\n */\n const getNewsletterStatus = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<NewsletterSubscriptionResult>(\n `${NEWSLETTER_API_ROUTE}/status`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n return {\n subscribeToNewsletter,\n unsubscribeFromNewsletter,\n getNewsletterStatus,\n };\n};\n\n/**\n * Authenticated `newsletter` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const newsletterEndpoint = createEndpoint(getNewsletterAPI);\n"],"mappings":";;;;;AAUA,MAAa,oBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,uBAAuB,GAFV,gBAAgB,QAAQ,cAAc,OAAO,WAErB;;;;;;CAO3C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBAAqB,aACxB,gBACA,cACA;EACE,QAAQ;EACF;CACR,CACF;;;;;;CAOF,MAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBAAqB,eACxB,gBACA,cACA;EACE,QAAQ;EACF;CACR,CACF;;;;;CAMF,MAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,MAAM,QACJ,GAAG,qBAAqB,UACxB,gBACA,cACA,EACE,QAAQ,MACV,CACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,qBAAqB,eAAe,gBAAgB"}
1
+ {"version":3,"file":"newsletter.mjs","names":[],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n NewsletterRoutes,\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n newsletterContract,\n} from '@intlayer/backend-contract/newsletter';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** Prefix of the routes, checked against the backend contract. */\nconst newsletterGroup = {\n prefix: '/api/newsletter',\n} as const satisfies Pick<typeof newsletterContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst newsletterEndpoints = {\n subscribeToNewsletter: { method: 'POST', path: '/subscribe' },\n unsubscribeFromNewsletter: { method: 'POST', path: '/unsubscribe' },\n getNewsletterStatus: { method: 'GET', path: '/status' },\n} as const satisfies RouteEndpoints<NewsletterRoutes>;\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Subscribe a user to newsletter(s)\n * @param body - Newsletter subscription parameters.\n * @returns Newsletter subscription result.\n */\n const subscribeToNewsletter = async (\n body: NewsletterSubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n buildRouteURL(\n backendURL,\n newsletterGroup,\n newsletterEndpoints.subscribeToNewsletter\n ),\n authAPIOptions,\n otherOptions,\n {\n method: newsletterEndpoints.subscribeToNewsletter.method,\n body: body,\n }\n );\n\n /**\n * Unsubscribe a user from newsletter(s)\n * @param body - Newsletter unsubscription parameters.\n * @returns Newsletter unsubscription result.\n */\n const unsubscribeFromNewsletter = async (\n body: NewsletterUnsubscriptionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<NewsletterSubscriptionResult>(\n buildRouteURL(\n backendURL,\n newsletterGroup,\n newsletterEndpoints.unsubscribeFromNewsletter\n ),\n authAPIOptions,\n otherOptions,\n {\n method: newsletterEndpoints.unsubscribeFromNewsletter.method,\n body: body,\n }\n );\n\n /**\n * Get newsletter subscription status for the authenticated user\n * @returns Newsletter subscription status.\n */\n const getNewsletterStatus = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<NewsletterSubscriptionResult>(\n buildRouteURL(\n backendURL,\n newsletterGroup,\n newsletterEndpoints.getNewsletterStatus\n ),\n authAPIOptions,\n otherOptions,\n {\n method: newsletterEndpoints.getNewsletterStatus.method,\n }\n );\n\n return {\n subscribeToNewsletter,\n unsubscribeFromNewsletter,\n getNewsletterStatus,\n };\n};\n\n/**\n * Authenticated `newsletter` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const newsletterEndpoint = createEndpoint(getNewsletterAPI);\n"],"mappings":";;;;;;;;AAgBA,MAAM,kBAAkB,EACtB,QAAQ,kBACV;;;;;AAMA,MAAM,sBAAsB;CAC1B,uBAAuB;EAAE,QAAQ;EAAQ,MAAM;CAAa;CAC5D,2BAA2B;EAAE,QAAQ;EAAQ,MAAM;CAAe;CAClE,qBAAqB;EAAE,QAAQ;EAAO,MAAM;CAAU;AACxD;AAEA,MAAa,oBACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;;;;;;CAO7D,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,qBACtB,GACA,gBACA,cACA;EACE,QAAQ,oBAAoB,sBAAsB;EAC5C;CACR,CACF;;;;;;CAOF,MAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,yBACtB,GACA,gBACA,cACA;EACE,QAAQ,oBAAoB,0BAA0B;EAChD;CACR,CACF;;;;;CAMF,MAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,mBACtB,GACA,gBACA,cACA,EACE,QAAQ,oBAAoB,oBAAoB,OAClD,CACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,qBAAqB,eAAe,gBAAgB"}
@@ -1,15 +1,41 @@
1
1
  import { fetcher } from "../fetcher.mjs";
2
2
  import { editor } from "@intlayer/config/built";
3
+ import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
4
+ import { BACKEND_URL } from "@intlayer/config/defaultValues";
3
5
 
4
- //#region src/getIntlayerAPI/oAuth.ts
6
+ // src/getIntlayerAPI/oAuth.ts
7
+ /** OAuth2 routes, checked against the backend contract. */
8
+ const oAuth2Group = { prefix: "/oauth2" };
9
+ const oAuth2Endpoints = {
10
+ getOAuth2AccessToken: {
11
+ method: "POST",
12
+ path: "/token"
13
+ },
14
+ extendOAuth2Token: {
15
+ method: "POST",
16
+ path: "/token/extend"
17
+ }
18
+ };
19
+ /** CLI session routes, checked against the backend contract. */
20
+ const cliSessionGroup = { prefix: "/api/cli-session" };
21
+ const cliSessionEndpoints = {
22
+ createCliSessionToken: {
23
+ method: "POST",
24
+ path: "/"
25
+ },
26
+ getCliSessionMe: {
27
+ method: "GET",
28
+ path: "/me"
29
+ }
30
+ };
5
31
  const getOAuthAPI = (authAPIOptions = {}, intlayerConfig) => {
6
- const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;
32
+ const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
7
33
  const { clientId, clientSecret } = intlayerConfig?.editor ?? {};
8
34
  /**
9
35
  * Gets an oAuth2 accessToken via client_credentials grant
10
36
  */
11
- const getOAuth2AccessToken = async (otherOptions = {}) => await fetcher(`${backendURL}/oauth2/token`, {}, otherOptions, {
12
- method: "POST",
37
+ const getOAuth2AccessToken = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, oAuth2Group, oAuth2Endpoints.getOAuth2AccessToken), {}, otherOptions, {
38
+ method: oAuth2Endpoints.getOAuth2AccessToken.method,
13
39
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
14
40
  body: {
15
41
  grant_type: "client_credentials",
@@ -21,12 +47,12 @@ const getOAuthAPI = (authAPIOptions = {}, intlayerConfig) => {
21
47
  * Creates a short-lived (2h) CLI session token for the authenticated user.
22
48
  * Requires a valid browser session cookie.
23
49
  */
24
- const createCliSessionToken = async (otherOptions = {}) => await fetcher(`${backendURL}/api/cli-session`, authAPIOptions, otherOptions, { method: "POST" });
50
+ const createCliSessionToken = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, cliSessionGroup, cliSessionEndpoints.createCliSessionToken), authAPIOptions, otherOptions, { method: cliSessionEndpoints.createCliSessionToken.method });
25
51
  /**
26
52
  * Verifies a CLI session token and returns the associated project context.
27
53
  * Useful for checking config consistency in the CLI.
28
54
  */
29
- const getCliSessionMe = async (otherOptions = {}) => await fetcher(`${backendURL}/api/cli-session/me`, authAPIOptions, otherOptions);
55
+ const getCliSessionMe = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, cliSessionGroup, cliSessionEndpoints.getCliSessionMe), authAPIOptions, otherOptions, { method: cliSessionEndpoints.getCliSessionMe.method });
30
56
  return {
31
57
  getOAuth2AccessToken,
32
58
  createCliSessionToken,
@@ -34,6 +60,5 @@ const getOAuthAPI = (authAPIOptions = {}, intlayerConfig) => {
34
60
  };
35
61
  };
36
62
 
37
- //#endregion
38
63
  export { getOAuthAPI };
39
64
  //# sourceMappingURL=oAuth.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n CreateCliSessionTokenResult,\n GetCliSessionMeResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n /**\n * Gets an oAuth2 accessToken via client_credentials grant\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n `${backendURL}/oauth2/token`,\n {},\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n /**\n * Creates a short-lived (2h) CLI session token for the authenticated user.\n * Requires a valid browser session cookie.\n */\n const createCliSessionToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreateCliSessionTokenResult>(\n `${backendURL}/api/cli-session`,\n authAPIOptions,\n otherOptions,\n { method: 'POST' }\n );\n\n /**\n * Verifies a CLI session token and returns the associated project context.\n * Useful for checking config consistency in the CLI.\n */\n const getCliSessionMe = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCliSessionMeResult>(\n `${backendURL}/api/cli-session/me`,\n authAPIOptions,\n otherOptions\n );\n\n return {\n getOAuth2AccessToken,\n createCliSessionToken,\n getCliSessionMe,\n };\n};\n"],"mappings":";;;;AAUA,MAAa,eACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aAAa,gBAAgB,QAAQ,cAAc,OAAO;CAChE,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,CAAC;;;;CAK9D,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM,QACJ,GAAG,WAAW,gBACd,CAAC,GACD,cACA;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,oCAClB;EACA,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;EACjB;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAAO,eAA+B,CAAC,MACnE,MAAM,QACJ,GAAG,WAAW,mBACd,gBACA,cACA,EAAE,QAAQ,OAAO,CACnB;;;;;CAMF,MAAM,kBAAkB,OAAO,eAA+B,CAAC,MAC7D,MAAM,QACJ,GAAG,WAAW,sBACd,gBACA,YACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n CliSessionTokenRoutes,\n CreateCliSessionTokenResult,\n cliSessionTokenContract,\n GetCliSessionMeResult,\n} from '@intlayer/backend-contract/cliSessionToken';\nimport type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n OAuth2Routes,\n oAuth2Contract,\n} from '@intlayer/backend-contract/oAuth2';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** OAuth2 routes, checked against the backend contract. */\nconst oAuth2Group = {\n prefix: '/oauth2',\n} as const satisfies Pick<typeof oAuth2Contract, 'prefix'>;\nconst oAuth2Endpoints = {\n getOAuth2AccessToken: { method: 'POST', path: '/token' },\n extendOAuth2Token: { method: 'POST', path: '/token/extend' },\n} as const satisfies RouteEndpoints<OAuth2Routes>;\n\n/** CLI session routes, checked against the backend contract. */\nconst cliSessionGroup = {\n prefix: '/api/cli-session',\n} as const satisfies Pick<typeof cliSessionTokenContract, 'prefix'>;\nconst cliSessionEndpoints = {\n createCliSessionToken: { method: 'POST', path: '/' },\n getCliSessionMe: { method: 'GET', path: '/me' },\n} as const satisfies RouteEndpoints<CliSessionTokenRoutes>;\n\nexport const getOAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n /**\n * Gets an oAuth2 accessToken via client_credentials grant\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n buildRouteURL(\n backendURL,\n oAuth2Group,\n oAuth2Endpoints.getOAuth2AccessToken\n ),\n {},\n otherOptions,\n {\n method: oAuth2Endpoints.getOAuth2AccessToken.method,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n /**\n * Creates a short-lived (2h) CLI session token for the authenticated user.\n * Requires a valid browser session cookie.\n */\n const createCliSessionToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreateCliSessionTokenResult>(\n buildRouteURL(\n backendURL,\n cliSessionGroup,\n cliSessionEndpoints.createCliSessionToken\n ),\n authAPIOptions,\n otherOptions,\n { method: cliSessionEndpoints.createCliSessionToken.method }\n );\n\n /**\n * Verifies a CLI session token and returns the associated project context.\n * Useful for checking config consistency in the CLI.\n */\n const getCliSessionMe = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCliSessionMeResult>(\n buildRouteURL(\n backendURL,\n cliSessionGroup,\n cliSessionEndpoints.getCliSessionMe\n ),\n authAPIOptions,\n otherOptions,\n { method: cliSessionEndpoints.getCliSessionMe.method }\n );\n\n return {\n getOAuth2AccessToken,\n createCliSessionToken,\n getCliSessionMe,\n };\n};\n"],"mappings":";;;;;;;AAoBA,MAAM,cAAc,EAClB,QAAQ,UACV;AACA,MAAM,kBAAkB;CACtB,sBAAsB;EAAE,QAAQ;EAAQ,MAAM;CAAS;CACvD,mBAAmB;EAAE,QAAQ;EAAQ,MAAM;CAAgB;AAC7D;;AAGA,MAAM,kBAAkB,EACtB,QAAQ,mBACV;AACA,MAAM,sBAAsB;CAC1B,uBAAuB;EAAE,QAAQ;EAAQ,MAAM;CAAI;CACnD,iBAAiB;EAAE,QAAQ;EAAO,MAAM;CAAM;AAChD;AAEA,MAAa,eACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;CAC7D,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,CAAC;;;;CAK9D,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM,QACJ,cACE,YACA,aACA,gBAAgB,oBAClB,GACA,CAAC,GACD,cACA;EACE,QAAQ,gBAAgB,qBAAqB;EAC7C,SAAS,EACP,gBAAgB,oCAClB;EACA,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;EACjB;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAAO,eAA+B,CAAC,MACnE,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,qBACtB,GACA,gBACA,cACA,EAAE,QAAQ,oBAAoB,sBAAsB,OAAO,CAC7D;;;;;CAMF,MAAM,kBAAkB,OAAO,eAA+B,CAAC,MAC7D,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,eACtB,GACA,gBACA,cACA,EAAE,QAAQ,oBAAoB,gBAAgB,OAAO,CACvD;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF"}
@@ -1,15 +1,69 @@
1
- import { fetcher } from "../fetcher.mjs";
2
1
  import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
2
+ import { fetcher } from "../fetcher.mjs";
3
3
  import { editor } from "@intlayer/config/built";
4
+ import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
5
+ import { BACKEND_URL } from "@intlayer/config/defaultValues";
4
6
 
5
- //#region src/getIntlayerAPI/organization.ts
7
+ // src/getIntlayerAPI/organization.ts
8
+ /** Prefix of the routes, checked against the backend contract. */
9
+ const organizationGroup = { prefix: "/api/organization" };
10
+ /**
11
+ * Method and path of every route, checked against the backend contract at
12
+ * compile time (the contract's zod schemas are never loaded).
13
+ */
14
+ const organizationEndpoints = {
15
+ getOrganizations: {
16
+ method: "GET",
17
+ path: "/"
18
+ },
19
+ addOrganization: {
20
+ method: "POST",
21
+ path: "/"
22
+ },
23
+ updateOrganization: {
24
+ method: "PUT",
25
+ path: "/"
26
+ },
27
+ updateOrganizationMailerConfig: {
28
+ method: "PUT",
29
+ path: "/mailer-config"
30
+ },
31
+ updateOrganizationMembers: {
32
+ method: "PUT",
33
+ path: "/members"
34
+ },
35
+ updateOrganizationMembersById: {
36
+ method: "PUT",
37
+ path: "/:organizationId/members"
38
+ },
39
+ addOrganizationMember: {
40
+ method: "POST",
41
+ path: "/member"
42
+ },
43
+ deleteOrganization: {
44
+ method: "DELETE",
45
+ path: "/"
46
+ },
47
+ selectOrganization: {
48
+ method: "PUT",
49
+ path: "/:organizationId"
50
+ },
51
+ unselectOrganization: {
52
+ method: "POST",
53
+ path: "/logout"
54
+ },
55
+ deleteOrganizationByIdAdmin: {
56
+ method: "DELETE",
57
+ path: "/:organizationId/admin"
58
+ }
59
+ };
6
60
  const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
7
- const ORGANIZATION_API_ROUTE = `${intlayerConfig?.editor?.backendURL ?? editor.backendURL}/api/organization`;
61
+ const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
8
62
  /**
9
63
  * Retrieves a list of organizations based on filters and pagination.
10
64
  * @param filters - Filters and pagination options.
11
65
  */
12
- const getOrganizations = async (filters, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
66
+ const getOrganizations = async (filters, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.getOrganizations), authAPIOptions, otherOptions, {
13
67
  cache: "no-store",
14
68
  params: filters
15
69
  });
@@ -17,21 +71,20 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
17
71
  * Retrieves an organization by its ID.
18
72
  * @param organizationId - Organization ID.
19
73
  */
20
- const getOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions);
21
74
  /**
22
75
  * Adds a new organization to the database.
23
76
  * @param organization - Organization data.
24
77
  */
25
- const addOrganization = async (organization, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
26
- method: "POST",
78
+ const addOrganization = async (organization, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.addOrganization), authAPIOptions, otherOptions, {
79
+ method: organizationEndpoints.addOrganization.method,
27
80
  body: organization
28
81
  });
29
82
  /**
30
83
  * Updates an existing organization in the database.
31
84
  * @param organization - Updated organization data.
32
85
  */
33
- const updateOrganization = async (organization, otherOptions = {}) => fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
34
- method: "PUT",
86
+ const updateOrganization = async (organization, otherOptions = {}) => fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.updateOrganization), authAPIOptions, otherOptions, {
87
+ method: organizationEndpoints.updateOrganization.method,
35
88
  body: organization
36
89
  });
37
90
  /**
@@ -39,16 +92,16 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
39
92
  * @param body - Mailer configuration. Secrets are optional; omit to keep the
40
93
  * value already stored.
41
94
  */
42
- const updateOrganizationMailerConfig = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/mailer-config`, authAPIOptions, otherOptions, {
43
- method: "PUT",
95
+ const updateOrganizationMailerConfig = async (body, otherOptions = {}) => fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.updateOrganizationMailerConfig), authAPIOptions, otherOptions, {
96
+ method: organizationEndpoints.updateOrganizationMailerConfig.method,
44
97
  body
45
98
  });
46
99
  /**
47
100
  * Update members to the organization in the database.
48
101
  * @param body - Updated organization members data.
49
102
  */
50
- const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/members`, authAPIOptions, otherOptions, {
51
- method: "PUT",
103
+ const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.updateOrganizationMembers), authAPIOptions, otherOptions, {
104
+ method: organizationEndpoints.updateOrganizationMembers.method,
52
105
  body
53
106
  });
54
107
  /**
@@ -56,41 +109,40 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
56
109
  * @param organizationId - Organization ID
57
110
  * @param body - Updated organization members data.
58
111
  */
59
- const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/${organizationId}/members`, authAPIOptions, otherOptions, {
60
- method: "PUT",
112
+ const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.updateOrganizationMembersById, { organizationId: String(organizationId) }), authAPIOptions, otherOptions, {
113
+ method: organizationEndpoints.updateOrganizationMembersById.method,
61
114
  body
62
115
  });
63
116
  /**
64
117
  * Add member to the organization in the database.
65
118
  * @param body - Updated organization members data.
66
119
  */
67
- const addOrganizationMember = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/member`, authAPIOptions, otherOptions, {
68
- method: "POST",
120
+ const addOrganizationMember = async (body, otherOptions = {}) => fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.addOrganizationMember), authAPIOptions, otherOptions, {
121
+ method: organizationEndpoints.addOrganizationMember.method,
69
122
  body
70
123
  });
71
124
  /**
72
125
  * Deletes an organization from the database by its ID.
73
126
  * @param organizationId - Organization ID.
74
127
  */
75
- const deleteOrganization = async (otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, { method: "DELETE" });
128
+ const deleteOrganization = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.deleteOrganization), authAPIOptions, otherOptions, { method: organizationEndpoints.deleteOrganization.method });
76
129
  /**
77
130
  * Admin-only: Deletes any organization from the database by its ID.
78
131
  * @param organizationId - Organization ID.
79
132
  */
80
- const deleteOrganizationByIdAdmin = async (organizationId, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/${organizationId}/admin`, authAPIOptions, otherOptions, { method: "DELETE" });
133
+ const deleteOrganizationByIdAdmin = async (organizationId, otherOptions = {}) => fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.deleteOrganizationByIdAdmin, { organizationId: String(organizationId) }), authAPIOptions, otherOptions, { method: organizationEndpoints.deleteOrganizationByIdAdmin.method });
81
134
  /**
82
135
  * Select an organization from the database by its ID.
83
136
  * @param organizationId - Organization ID.
84
137
  */
85
- const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions, { method: "PUT" });
138
+ const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.selectOrganization, { organizationId: String(organizationId) }), authAPIOptions, otherOptions, { method: organizationEndpoints.selectOrganization.method });
86
139
  /**
87
140
  * Unselect an organization from the database by its ID.
88
141
  * @param organizationId - Organization ID.
89
142
  */
90
- const unselectOrganization = async (otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
143
+ const unselectOrganization = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, organizationGroup, organizationEndpoints.unselectOrganization), authAPIOptions, otherOptions, { method: organizationEndpoints.unselectOrganization.method });
91
144
  return {
92
145
  getOrganizations,
93
- getOrganization,
94
146
  addOrganization,
95
147
  addOrganizationMember,
96
148
  updateOrganization,
@@ -111,6 +163,5 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
111
163
  */
112
164
  const organizationEndpoint = createEndpoint(getOrganizationAPI);
113
165
 
114
- //#endregion
115
166
  export { getOrganizationAPI, organizationEndpoint };
116
167
  //# sourceMappingURL=organization.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization.mjs","names":[],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMailerConfigBody,\n UpdateOrganizationMailerConfigResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Updates the per-organization transactional mailer configuration.\n * @param body - Mailer configuration. Secrets are optional; omit to keep the\n * value already stored.\n */\n const updateOrganizationMailerConfig = async (\n body: UpdateOrganizationMailerConfigBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMailerConfigResult>(\n `${ORGANIZATION_API_ROUTE}/mailer-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Admin-only: Deletes any organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganizationByIdAdmin = async (\n organizationId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMailerConfig,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n deleteOrganizationByIdAdmin,\n selectOrganization,\n unselectOrganization,\n };\n};\n\n/**\n * Authenticated `organization` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const organizationEndpoint = createEndpoint(getOrganizationAPI);\n"],"mappings":";;;;;AAyBA,MAAa,sBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,yBAAyB,GAFZ,gBAAgB,QAAQ,cAAc,OAAO,WAEnB;;;;;CAM7C,MAAM,mBAAmB,OACvB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;;CAMF,MAAM,kBAAkB,OACtB,gBACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,cAAc,KAClD,gBACA,YACF;;;;;CAMF,MAAM,kBAAkB,OACtB,cACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,qBAAqB,OACzB,cACA,eAA+B,CAAC,MAEhC,QACE,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;;CAOF,MAAM,iCAAiC,OACrC,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,iBAC1B,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;CAMF,MAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,WAC1B,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;;CAOF,MAAM,gCAAgC,OACpC,gBACA,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,GAAG,eAAe,WAC5C,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,UAC1B,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;;;;;CAMF,MAAM,qBAAqB,OAAO,eAA+B,CAAC,MAChE,MAAM,QACJ,wBACA,gBACA,cACA,EACE,QAAQ,SACV,CACF;;;;;CAMF,MAAM,8BAA8B,OAClC,gBACA,eAA+B,CAAC,MAEhC,QACE,GAAG,uBAAuB,GAAG,eAAe,SAC5C,gBACA,cACA,EAAE,QAAQ,SAAS,CACrB;;;;;CAMF,MAAM,qBAAqB,OACzB,gBACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,cAAc,KAClD,gBACA,cACA,EACE,QAAQ,MACV,CACF;;;;;CAMF,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM,QACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,OACV,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,uBAAuB,eAAe,kBAAkB"}
1
+ {"version":3,"file":"organization.mjs","names":[],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n OrganizationRoutes,\n organizationContract,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMailerConfigBody,\n UpdateOrganizationMailerConfigResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend-contract/organization';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** Prefix of the routes, checked against the backend contract. */\nconst organizationGroup = {\n prefix: '/api/organization',\n} as const satisfies Pick<typeof organizationContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst organizationEndpoints = {\n getOrganizations: { method: 'GET', path: '/' },\n addOrganization: { method: 'POST', path: '/' },\n updateOrganization: { method: 'PUT', path: '/' },\n updateOrganizationMailerConfig: { method: 'PUT', path: '/mailer-config' },\n updateOrganizationMembers: { method: 'PUT', path: '/members' },\n updateOrganizationMembersById: {\n method: 'PUT',\n path: '/:organizationId/members',\n },\n addOrganizationMember: { method: 'POST', path: '/member' },\n deleteOrganization: { method: 'DELETE', path: '/' },\n selectOrganization: { method: 'PUT', path: '/:organizationId' },\n unselectOrganization: { method: 'POST', path: '/logout' },\n deleteOrganizationByIdAdmin: {\n method: 'DELETE',\n path: '/:organizationId/admin',\n },\n} as const satisfies RouteEndpoints<OrganizationRoutes>;\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.getOrganizations\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.addOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.addOrganization.method,\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganization.method,\n body: organization,\n }\n );\n\n /**\n * Updates the per-organization transactional mailer configuration.\n * @param body - Mailer configuration. Secrets are optional; omit to keep the\n * value already stored.\n */\n const updateOrganizationMailerConfig = async (\n body: UpdateOrganizationMailerConfigBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMailerConfigResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganizationMailerConfig\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganizationMailerConfig.method,\n body,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganizationMembers\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganizationMembers.method,\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganizationMembersById,\n { organizationId: String(organizationId) }\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganizationMembersById.method,\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.addOrganizationMember\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.addOrganizationMember.method,\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.deleteOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.deleteOrganization.method,\n }\n );\n\n /**\n * Admin-only: Deletes any organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganizationByIdAdmin = async (\n organizationId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.deleteOrganizationByIdAdmin,\n { organizationId: String(organizationId) }\n ),\n authAPIOptions,\n otherOptions,\n { method: organizationEndpoints.deleteOrganizationByIdAdmin.method }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.selectOrganization,\n { organizationId: String(organizationId) }\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.selectOrganization.method,\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.unselectOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.unselectOrganization.method,\n }\n );\n\n return {\n getOrganizations,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMailerConfig,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n deleteOrganizationByIdAdmin,\n selectOrganization,\n unselectOrganization,\n };\n};\n\n/**\n * Authenticated `organization` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const organizationEndpoint = createEndpoint(getOrganizationAPI);\n"],"mappings":";;;;;;;;AA6BA,MAAM,oBAAoB,EACxB,QAAQ,oBACV;;;;;AAMA,MAAM,wBAAwB;CAC5B,kBAAkB;EAAE,QAAQ;EAAO,MAAM;CAAI;CAC7C,iBAAiB;EAAE,QAAQ;EAAQ,MAAM;CAAI;CAC7C,oBAAoB;EAAE,QAAQ;EAAO,MAAM;CAAI;CAC/C,gCAAgC;EAAE,QAAQ;EAAO,MAAM;CAAiB;CACxE,2BAA2B;EAAE,QAAQ;EAAO,MAAM;CAAW;CAC7D,+BAA+B;EAC7B,QAAQ;EACR,MAAM;CACR;CACA,uBAAuB;EAAE,QAAQ;EAAQ,MAAM;CAAU;CACzD,oBAAoB;EAAE,QAAQ;EAAU,MAAM;CAAI;CAClD,oBAAoB;EAAE,QAAQ;EAAO,MAAM;CAAmB;CAC9D,sBAAsB;EAAE,QAAQ;EAAQ,MAAM;CAAU;CACxD,6BAA6B;EAC3B,QAAQ;EACR,MAAM;CACR;AACF;AAEA,MAAa,sBACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;;;;;CAM7D,MAAM,mBAAmB,OACvB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,mBACA,sBAAsB,gBACxB,GACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;;;;;;CAUF,MAAM,kBAAkB,OACtB,cACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,mBACA,sBAAsB,eACxB,GACA,gBACA,cACA;EACE,QAAQ,sBAAsB,gBAAgB;EAC9C,MAAM;CACR,CACF;;;;;CAMF,MAAM,qBAAqB,OACzB,cACA,eAA+B,CAAC,MAEhC,QACE,cACE,YACA,mBACA,sBAAsB,kBACxB,GACA,gBACA,cACA;EACE,QAAQ,sBAAsB,mBAAmB;EACjD,MAAM;CACR,CACF;;;;;;CAOF,MAAM,iCAAiC,OACrC,MACA,eAA+B,CAAC,MAEhC,QACE,cACE,YACA,mBACA,sBAAsB,8BACxB,GACA,gBACA,cACA;EACE,QAAQ,sBAAsB,+BAA+B;EAC7D;CACF,CACF;;;;;CAMF,MAAM,4BAA4B,OAChC,MACA,eAA+B,CAAC,MAEhC,QACE,cACE,YACA,mBACA,sBAAsB,yBACxB,GACA,gBACA,cACA;EACE,QAAQ,sBAAsB,0BAA0B;EACxD;CACF,CACF;;;;;;CAOF,MAAM,gCAAgC,OACpC,gBACA,MACA,eAA+B,CAAC,MAEhC,QACE,cACE,YACA,mBACA,sBAAsB,+BACtB,EAAE,gBAAgB,OAAO,cAAc,EAAE,CAC3C,GACA,gBACA,cACA;EACE,QAAQ,sBAAsB,8BAA8B;EAC5D;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAC5B,MACA,eAA+B,CAAC,MAEhC,QACE,cACE,YACA,mBACA,sBAAsB,qBACxB,GACA,gBACA,cACA;EACE,QAAQ,sBAAsB,sBAAsB;EACpD;CACF,CACF;;;;;CAMF,MAAM,qBAAqB,OAAO,eAA+B,CAAC,MAChE,MAAM,QACJ,cACE,YACA,mBACA,sBAAsB,kBACxB,GACA,gBACA,cACA,EACE,QAAQ,sBAAsB,mBAAmB,OACnD,CACF;;;;;CAMF,MAAM,8BAA8B,OAClC,gBACA,eAA+B,CAAC,MAEhC,QACE,cACE,YACA,mBACA,sBAAsB,6BACtB,EAAE,gBAAgB,OAAO,cAAc,EAAE,CAC3C,GACA,gBACA,cACA,EAAE,QAAQ,sBAAsB,4BAA4B,OAAO,CACrE;;;;;CAMF,MAAM,qBAAqB,OACzB,gBACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,mBACA,sBAAsB,oBACtB,EAAE,gBAAgB,OAAO,cAAc,EAAE,CAC3C,GACA,gBACA,cACA,EACE,QAAQ,sBAAsB,mBAAmB,OACnD,CACF;;;;;CAMF,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAM,QACJ,cACE,YACA,mBACA,sBAAsB,oBACxB,GACA,gBACA,cACA,EACE,QAAQ,sBAAsB,qBAAqB,OACrD,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,uBAAuB,eAAe,kBAAkB"}