@intlayer/api 8.4.3 → 8.4.5

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 (178) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +20 -1
  3. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
  4. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +22 -1
  5. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
  6. package/dist/cjs/distantDictionary/index.cjs +6 -1
  7. package/dist/cjs/fetcher.cjs +122 -1
  8. package/dist/cjs/fetcher.cjs.map +1 -1
  9. package/dist/cjs/getIntlayerAPI/ai.cjs +161 -2
  10. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  11. package/dist/cjs/getIntlayerAPI/audit.cjs +94 -2
  12. package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
  13. package/dist/cjs/getIntlayerAPI/bitbucket.cjs +69 -1
  14. package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
  15. package/dist/cjs/getIntlayerAPI/dictionary.cjs +67 -1
  16. package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAPI/editor.cjs +37 -1
  18. package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
  19. package/dist/cjs/getIntlayerAPI/github.cjs +69 -1
  20. package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
  21. package/dist/cjs/getIntlayerAPI/gitlab.cjs +83 -1
  22. package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
  23. package/dist/cjs/getIntlayerAPI/index.cjs +48 -1
  24. package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -0
  25. package/dist/cjs/getIntlayerAPI/newsletter.cjs +38 -1
  26. package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
  27. package/dist/cjs/getIntlayerAPI/oAuth.cjs +25 -1
  28. package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
  29. package/dist/cjs/getIntlayerAPI/organization.cjs +91 -1
  30. package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
  31. package/dist/cjs/getIntlayerAPI/project.cjs +139 -1
  32. package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
  33. package/dist/cjs/getIntlayerAPI/search.cjs +20 -1
  34. package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
  35. package/dist/cjs/getIntlayerAPI/showcaseProject.cjs +58 -1
  36. package/dist/cjs/getIntlayerAPI/showcaseProject.cjs.map +1 -1
  37. package/dist/cjs/getIntlayerAPI/stripe.cjs +36 -1
  38. package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
  39. package/dist/cjs/getIntlayerAPI/tag.cjs +45 -1
  40. package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
  41. package/dist/cjs/getIntlayerAPI/user.cjs +77 -1
  42. package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
  43. package/dist/cjs/index.cjs +43 -1
  44. package/dist/cjs/proxy.cjs +100 -1
  45. package/dist/cjs/proxy.cjs.map +1 -1
  46. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +19 -1
  47. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
  48. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +21 -1
  49. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
  50. package/dist/esm/distantDictionary/index.mjs +4 -1
  51. package/dist/esm/fetcher.mjs +119 -1
  52. package/dist/esm/fetcher.mjs.map +1 -1
  53. package/dist/esm/getIntlayerAPI/ai.mjs +160 -2
  54. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  55. package/dist/esm/getIntlayerAPI/audit.mjs +93 -2
  56. package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
  57. package/dist/esm/getIntlayerAPI/bitbucket.mjs +68 -1
  58. package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
  59. package/dist/esm/getIntlayerAPI/dictionary.mjs +66 -1
  60. package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
  61. package/dist/esm/getIntlayerAPI/editor.mjs +36 -1
  62. package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
  63. package/dist/esm/getIntlayerAPI/github.mjs +68 -1
  64. package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
  65. package/dist/esm/getIntlayerAPI/gitlab.mjs +82 -1
  66. package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
  67. package/dist/esm/getIntlayerAPI/index.mjs +44 -1
  68. package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
  69. package/dist/esm/getIntlayerAPI/newsletter.mjs +37 -1
  70. package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
  71. package/dist/esm/getIntlayerAPI/oAuth.mjs +24 -1
  72. package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
  73. package/dist/esm/getIntlayerAPI/organization.mjs +90 -1
  74. package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
  75. package/dist/esm/getIntlayerAPI/project.mjs +138 -1
  76. package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
  77. package/dist/esm/getIntlayerAPI/search.mjs +19 -1
  78. package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
  79. package/dist/esm/getIntlayerAPI/showcaseProject.mjs +57 -1
  80. package/dist/esm/getIntlayerAPI/showcaseProject.mjs.map +1 -1
  81. package/dist/esm/getIntlayerAPI/stripe.mjs +35 -1
  82. package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
  83. package/dist/esm/getIntlayerAPI/tag.mjs +44 -1
  84. package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
  85. package/dist/esm/getIntlayerAPI/user.mjs +76 -1
  86. package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
  87. package/dist/esm/index.mjs +22 -1
  88. package/dist/esm/proxy.mjs +99 -1
  89. package/dist/esm/proxy.mjs.map +1 -1
  90. package/dist/types/@intlayer/unmerged-dictionaries-entry/dist/types/index.d.ts +10 -0
  91. package/dist/types/@intlayer/unmerged-dictionaries-entry/dist/types/index.d.ts.map +1 -0
  92. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +11 -2
  93. package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -0
  94. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +11 -2
  95. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -0
  96. package/dist/types/distantDictionary/index.d.ts +2 -2
  97. package/dist/types/getIntlayerAPI/ai.d.ts +32 -2
  98. package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -0
  99. package/dist/types/getIntlayerAPI/audit.d.ts +44 -2
  100. package/dist/types/getIntlayerAPI/audit.d.ts.map +1 -0
  101. package/dist/types/getIntlayerAPI/bitbucket.d.ts +81 -2
  102. package/dist/types/getIntlayerAPI/bitbucket.d.ts.map +1 -0
  103. package/dist/types/getIntlayerAPI/dictionary.d.ts +18 -2
  104. package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -0
  105. package/dist/types/getIntlayerAPI/editor.d.ts +14 -2
  106. package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -0
  107. package/dist/types/getIntlayerAPI/github.d.ts +65 -2
  108. package/dist/types/getIntlayerAPI/github.d.ts.map +1 -0
  109. package/dist/types/getIntlayerAPI/gitlab.d.ts +70 -2
  110. package/dist/types/getIntlayerAPI/gitlab.d.ts.map +1 -0
  111. package/dist/types/getIntlayerAPI/index.d.ts +16 -16
  112. package/dist/types/getIntlayerAPI/newsletter.d.ts +13 -2
  113. package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -0
  114. package/dist/types/getIntlayerAPI/oAuth.d.ts +10 -2
  115. package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -0
  116. package/dist/types/getIntlayerAPI/organization.d.ts +20 -2
  117. package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -0
  118. package/dist/types/getIntlayerAPI/project.d.ts +25 -2
  119. package/dist/types/getIntlayerAPI/project.d.ts.map +1 -0
  120. package/dist/types/getIntlayerAPI/search.d.ts +11 -2
  121. package/dist/types/getIntlayerAPI/search.d.ts.map +1 -0
  122. package/dist/types/getIntlayerAPI/showcaseProject.d.ts +33 -2
  123. package/dist/types/getIntlayerAPI/showcaseProject.d.ts.map +1 -0
  124. package/dist/types/getIntlayerAPI/stripe.d.ts +13 -2
  125. package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -0
  126. package/dist/types/getIntlayerAPI/tag.d.ts +14 -2
  127. package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -0
  128. package/dist/types/getIntlayerAPI/user.d.ts +22 -2
  129. package/dist/types/getIntlayerAPI/user.d.ts.map +1 -0
  130. package/dist/types/index.d.ts +17 -17
  131. package/dist/types/intlayer-editor/server/dist/controllers/configuration.controller.d.ts +12 -0
  132. package/dist/types/intlayer-editor/server/dist/controllers/configuration.controller.d.ts.map +1 -0
  133. package/dist/types/intlayer-editor/server/dist/controllers/dictionary.controller.d.ts +25 -0
  134. package/dist/types/intlayer-editor/server/dist/controllers/dictionary.controller.d.ts.map +1 -0
  135. package/dist/types/intlayer-editor/server/dist/export.d.ts +2 -0
  136. package/dist/types/{editor-DTBh5ovU.d.ts → intlayer-editor/server/dist/utils/httpStatusCodes.d.ts} +3 -61
  137. package/dist/types/intlayer-editor/server/dist/utils/httpStatusCodes.d.ts.map +1 -0
  138. package/dist/types/intlayer-editor/server/dist/utils/responseData.d.ts +20 -0
  139. package/dist/types/intlayer-editor/server/dist/utils/responseData.d.ts.map +1 -0
  140. package/dist/types/proxy.d.ts.map +1 -1
  141. package/package.json +3 -3
  142. package/dist/cjs/getIntlayerAPI-CUu2tiLP.cjs +0 -2
  143. package/dist/cjs/getIntlayerAPI-CUu2tiLP.cjs.map +0 -1
  144. package/dist/types/ai-FbIMwui1.d.ts +0 -32
  145. package/dist/types/ai-FbIMwui1.d.ts.map +0 -1
  146. package/dist/types/audit-DzTxbapP.d.ts +0 -44
  147. package/dist/types/audit-DzTxbapP.d.ts.map +0 -1
  148. package/dist/types/bitbucket-DeRx5IlR.d.ts +0 -81
  149. package/dist/types/bitbucket-DeRx5IlR.d.ts.map +0 -1
  150. package/dist/types/dictionary-W5LSPsxq.d.ts +0 -18
  151. package/dist/types/dictionary-W5LSPsxq.d.ts.map +0 -1
  152. package/dist/types/editor-DTBh5ovU.d.ts.map +0 -1
  153. package/dist/types/fetchDistantDictionaries-CLQEr6NS.d.ts +0 -11
  154. package/dist/types/fetchDistantDictionaries-CLQEr6NS.d.ts.map +0 -1
  155. package/dist/types/fetchDistantDictionary-C7esreMl.d.ts +0 -11
  156. package/dist/types/fetchDistantDictionary-C7esreMl.d.ts.map +0 -1
  157. package/dist/types/github-D077Il7G.d.ts +0 -65
  158. package/dist/types/github-D077Il7G.d.ts.map +0 -1
  159. package/dist/types/gitlab-BrWydMCh.d.ts +0 -70
  160. package/dist/types/gitlab-BrWydMCh.d.ts.map +0 -1
  161. package/dist/types/newsletter-Dg_6QDY_.d.ts +0 -13
  162. package/dist/types/newsletter-Dg_6QDY_.d.ts.map +0 -1
  163. package/dist/types/oAuth-DfQmGzLO.d.ts +0 -10
  164. package/dist/types/oAuth-DfQmGzLO.d.ts.map +0 -1
  165. package/dist/types/organization-CNkB8dnj.d.ts +0 -20
  166. package/dist/types/organization-CNkB8dnj.d.ts.map +0 -1
  167. package/dist/types/project-DKLgh9Mz.d.ts +0 -25
  168. package/dist/types/project-DKLgh9Mz.d.ts.map +0 -1
  169. package/dist/types/search-CVbo1OMK.d.ts +0 -11
  170. package/dist/types/search-CVbo1OMK.d.ts.map +0 -1
  171. package/dist/types/showcaseProject-1zcpB4aW.d.ts +0 -33
  172. package/dist/types/showcaseProject-1zcpB4aW.d.ts.map +0 -1
  173. package/dist/types/stripe-vRfMjdAc.d.ts +0 -13
  174. package/dist/types/stripe-vRfMjdAc.d.ts.map +0 -1
  175. package/dist/types/tag-0oc2-9J5.d.ts +0 -14
  176. package/dist/types/tag-0oc2-9J5.d.ts.map +0 -1
  177. package/dist/types/user-BVi1Ho0Q.d.ts +0 -22
  178. package/dist/types/user-BVi1Ho0Q.d.ts.map +0 -1
@@ -1,2 +1,69 @@
1
- import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/github`;return{getAuthUrl:async(n,i={})=>await e(`${r}/auth-url`,t,i,{params:{redirectUri:n}}),authenticate:async(n,i={})=>await e(`${r}/auth`,t,i,{method:`POST`,body:{code:n}}),getRepositories:async(n,i={})=>await e(`${r}/repos`,t,i,{params:n?{token:n}:void 0}),checkIntlayerConfig:async(n,i,a,o=`main`,s={})=>await e(`${r}/check-config`,t,s,{method:`POST`,body:{token:n??void 0,owner:i,repository:a,branch:o}}),getConfigFile:async(n,i,a,o=`main`,s=`intlayer.config.ts`,c={})=>await e(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,owner:i,repository:a,branch:o,path:s}})}};export{t as getGithubAPI};
1
+ import { fetcher } from "../fetcher.mjs";
2
+
3
+ //#region src/getIntlayerAPI/github.ts
4
+ const getGithubAPI = (authAPIOptions = {}, intlayerConfig) => {
5
+ const GITHUB_API_ROUTE = `${intlayerConfig.editor.backendURL}/api/github`;
6
+ /**
7
+ * Get GitHub OAuth authorization URL
8
+ * @param redirectUri - Redirect URI after OAuth authorization
9
+ */
10
+ const getAuthUrl = async (redirectUri, otherOptions = {}) => await fetcher(`${GITHUB_API_ROUTE}/auth-url`, authAPIOptions, otherOptions, { params: { redirectUri } });
11
+ /**
12
+ * Exchange GitHub authorization code for access token
13
+ * @param code - GitHub authorization code
14
+ */
15
+ const authenticate = async (code, otherOptions = {}) => await fetcher(`${GITHUB_API_ROUTE}/auth`, authAPIOptions, otherOptions, {
16
+ method: "POST",
17
+ body: { code }
18
+ });
19
+ /**
20
+ * Get user's GitHub repositories
21
+ * @param token - Optional GitHub access token. If not provided, backend will use session.
22
+ */
23
+ const getRepositories = async (token, otherOptions = {}) => await fetcher(`${GITHUB_API_ROUTE}/repos`, authAPIOptions, otherOptions, { params: token ? { token } : void 0 });
24
+ /**
25
+ * Check if intlayer.config.ts exists in a repository
26
+ * @param token - Optional GitHub access token. If not provided, backend will use session.
27
+ * @param owner - Repository owner
28
+ * @param repository - Repository name
29
+ * @param branch - Branch name (default: 'main')
30
+ */
31
+ const checkIntlayerConfig = async (token, owner, repository, branch = "main", otherOptions = {}) => await fetcher(`${GITHUB_API_ROUTE}/check-config`, authAPIOptions, otherOptions, {
32
+ method: "POST",
33
+ body: {
34
+ token: token ?? void 0,
35
+ owner,
36
+ repository,
37
+ branch
38
+ }
39
+ });
40
+ /**
41
+ * Get intlayer.config.ts file contents from a repository
42
+ * @param token - Optional GitHub access token. If not provided, backend will use session.
43
+ * @param owner - Repository owner
44
+ * @param repository - Repository name
45
+ * @param branch - Branch name (default: 'main')
46
+ * @param path - File path (default: 'intlayer.config.ts')
47
+ */
48
+ const getConfigFile = async (token, owner, repository, branch = "main", path = "intlayer.config.ts", otherOptions = {}) => await fetcher(`${GITHUB_API_ROUTE}/get-config-file`, authAPIOptions, otherOptions, {
49
+ method: "POST",
50
+ body: {
51
+ token: token ?? void 0,
52
+ owner,
53
+ repository,
54
+ branch,
55
+ path
56
+ }
57
+ });
58
+ return {
59
+ getAuthUrl,
60
+ authenticate,
61
+ getRepositories,
62
+ checkIntlayerConfig,
63
+ getConfigFile
64
+ };
65
+ };
66
+
67
+ //#endregion
68
+ export { getGithubAPI };
2
69
  //# sourceMappingURL=github.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitHubRepository = {\n id: number;\n name: string;\n full_name: string;\n owner: {\n login: string;\n id: number;\n };\n html_url: string;\n default_branch: string;\n private: boolean;\n};\n\nexport type GitHubAuthCallbackBody = {\n code: string;\n};\n\nexport type GitHubAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitHubListReposResult = {\n data: GitHubRepository[];\n};\n\nexport type GitHubCheckConfigBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n};\n\nexport type GitHubCheckConfigResult = {\n data: {\n hasConfig: boolean;\n };\n};\n\nexport type GitHubGetConfigFileBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n path?: string;\n};\n\nexport type GitHubGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitHubGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const GITHUB_API_ROUTE = `${backendURL}/api/github`;\n\n /**\n * Get GitHub OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n */\n const getAuthUrl = async (\n redirectUri: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetAuthUrlResult>(\n `${GITHUB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri },\n }\n );\n\n /**\n * Exchange GitHub authorization code for access token\n * @param code - GitHub authorization code\n */\n const authenticate = async (\n code: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubAuthCallbackResult>(\n `${GITHUB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code },\n }\n );\n\n /**\n * Get user's GitHub repositories\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n */\n const getRepositories = async (\n token?: string | null,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubListReposResult>(\n `${GITHUB_API_ROUTE}/repos`,\n authAPIOptions,\n otherOptions,\n {\n params: token ? { token } : undefined,\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubCheckConfigResult>(\n `${GITHUB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n */\n const getConfigFile = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetConfigFileResult>(\n `${GITHUB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch, path },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n"],"mappings":"yCA+DA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aAwGvC,MAAO,CACL,WAnGiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,CACxB,CACF,CAyFD,aAnFmB,MACnB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,OACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,CACf,CACF,CAwED,gBAlEsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,QACpB,EACA,EACA,CACE,OAAQ,EAAQ,CAAE,QAAO,CAAG,IAAA,GAC7B,CACF,CAwDD,oBA/C0B,MAC1B,EACA,EACA,EACA,EAAiB,OACjB,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,eACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,MAAO,GAAS,IAAA,GAAW,QAAO,aAAY,SAAQ,CAC/D,CACF,CAiCD,cAvBoB,MACpB,EACA,EACA,EACA,EAAiB,OACjB,EAAe,qBACf,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,kBACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,MAAO,GAAS,IAAA,GAAW,QAAO,aAAY,SAAQ,OAAM,CACrE,CACF,CAQF"}
1
+ {"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitHubRepository = {\n id: number;\n name: string;\n full_name: string;\n owner: {\n login: string;\n id: number;\n };\n html_url: string;\n default_branch: string;\n private: boolean;\n};\n\nexport type GitHubAuthCallbackBody = {\n code: string;\n};\n\nexport type GitHubAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitHubListReposResult = {\n data: GitHubRepository[];\n};\n\nexport type GitHubCheckConfigBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n};\n\nexport type GitHubCheckConfigResult = {\n data: {\n hasConfig: boolean;\n };\n};\n\nexport type GitHubGetConfigFileBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n path?: string;\n};\n\nexport type GitHubGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitHubGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.editor.backendURL;\n\n const GITHUB_API_ROUTE = `${backendURL}/api/github`;\n\n /**\n * Get GitHub OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n */\n const getAuthUrl = async (\n redirectUri: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetAuthUrlResult>(\n `${GITHUB_API_ROUTE}/auth-url`,\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri },\n }\n );\n\n /**\n * Exchange GitHub authorization code for access token\n * @param code - GitHub authorization code\n */\n const authenticate = async (\n code: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubAuthCallbackResult>(\n `${GITHUB_API_ROUTE}/auth`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { code },\n }\n );\n\n /**\n * Get user's GitHub repositories\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n */\n const getRepositories = async (\n token?: string | null,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubListReposResult>(\n `${GITHUB_API_ROUTE}/repos`,\n authAPIOptions,\n otherOptions,\n {\n params: token ? { token } : undefined,\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubCheckConfigResult>(\n `${GITHUB_API_ROUTE}/check-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n */\n const getConfigFile = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetConfigFileResult>(\n `${GITHUB_API_ROUTE}/get-config-file`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { token: token ?? undefined, owner, repository, branch, path },\n }\n );\n\n return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n };\n};\n"],"mappings":";;;AA+DA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,mBAAmB,GAFN,eAAe,OAAO,WAEF;;;;;CAMvC,MAAM,aAAa,OACjB,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ,EAAE,aAAa,EACxB,CACF;;;;;CAMH,MAAM,eAAe,OACnB,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,MAAM;EACf,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,OACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,SACpB,gBACA,cACA,EACE,QAAQ,QAAQ,EAAE,OAAO,GAAG,QAC7B,CACF;;;;;;;;CASH,MAAM,sBAAsB,OAC1B,OACA,OACA,YACA,SAAiB,QACjB,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;EAC/D,CACF;;;;;;;;;CAUH,MAAM,gBAAgB,OACpB,OACA,OACA,YACA,SAAiB,QACjB,OAAe,sBACf,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;GAAM;EACrE,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
@@ -1,2 +1,83 @@
1
- import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/gitlab`;return{getAuthUrl:async(n,i,a={})=>await e(`${r}/auth-url`,t,a,{params:{redirectUri:n,...i&&{instanceUrl:i}}}),authenticate:async(n,i,a,o={})=>await e(`${r}/auth`,t,o,{method:`POST`,body:{code:n,redirectUri:i,instanceUrl:a}}),getProjects:async(n,i,a={})=>await e(`${r}/projects`,t,a,{params:{...n&&{token:n},...i&&{instanceUrl:i}}}),checkIntlayerConfig:async(n,i,a=`main`,o,s={})=>await e(`${r}/check-config`,t,s,{method:`POST`,body:{token:n??void 0,projectId:i,branch:a,...o&&{instanceUrl:o}}}),getConfigFile:async(n,i,a=`main`,o=`intlayer.config.ts`,s,c={})=>await e(`${r}/get-config-file`,t,c,{method:`POST`,body:{token:n??void 0,projectId:i,branch:a,path:o,...s&&{instanceUrl:s}}})}};export{t as getGitlabAPI};
1
+ import { fetcher } from "../fetcher.mjs";
2
+
3
+ //#region src/getIntlayerAPI/gitlab.ts
4
+ const getGitlabAPI = (authAPIOptions = {}, intlayerConfig) => {
5
+ const GITLAB_API_ROUTE = `${intlayerConfig.editor.backendURL}/api/gitlab`;
6
+ /**
7
+ * Get GitLab OAuth authorization URL
8
+ * @param redirectUri - Redirect URI after OAuth authorization
9
+ * @param instanceUrl - Custom GitLab instance URL (optional, for self-hosted)
10
+ */
11
+ const getAuthUrl = async (redirectUri, instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/auth-url`, authAPIOptions, otherOptions, { params: {
12
+ redirectUri,
13
+ ...instanceUrl && { instanceUrl }
14
+ } });
15
+ /**
16
+ * Exchange GitLab authorization code for access token
17
+ * @param code - GitLab authorization code
18
+ * @param redirectUri - Redirect URI used in the authorization request
19
+ * @param instanceUrl - Custom GitLab instance URL (optional)
20
+ */
21
+ const authenticate = async (code, redirectUri, instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/auth`, authAPIOptions, otherOptions, {
22
+ method: "POST",
23
+ body: {
24
+ code,
25
+ redirectUri,
26
+ instanceUrl
27
+ }
28
+ });
29
+ /**
30
+ * Get user's GitLab projects
31
+ * @param token - Optional GitLab access token. If not provided, backend will use session.
32
+ * @param instanceUrl - Custom GitLab instance URL (optional)
33
+ */
34
+ const getProjects = async (token, instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/projects`, authAPIOptions, otherOptions, { params: {
35
+ ...token && { token },
36
+ ...instanceUrl && { instanceUrl }
37
+ } });
38
+ /**
39
+ * Check if intlayer.config.ts exists in a GitLab repository
40
+ * @param token - Optional GitLab access token. If not provided, backend will use session.
41
+ * @param projectId - GitLab project ID
42
+ * @param branch - Branch name (default: 'main')
43
+ * @param instanceUrl - Custom GitLab instance URL (optional)
44
+ */
45
+ const checkIntlayerConfig = async (token, projectId, branch = "main", instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/check-config`, authAPIOptions, otherOptions, {
46
+ method: "POST",
47
+ body: {
48
+ token: token ?? void 0,
49
+ projectId,
50
+ branch,
51
+ ...instanceUrl && { instanceUrl }
52
+ }
53
+ });
54
+ /**
55
+ * Get intlayer.config.ts file contents from a GitLab repository
56
+ * @param token - Optional GitLab access token. If not provided, backend will use session.
57
+ * @param projectId - GitLab project ID
58
+ * @param branch - Branch name (default: 'main')
59
+ * @param path - File path (default: 'intlayer.config.ts')
60
+ * @param instanceUrl - Custom GitLab instance URL (optional)
61
+ */
62
+ const getConfigFile = async (token, projectId, branch = "main", path = "intlayer.config.ts", instanceUrl, otherOptions = {}) => await fetcher(`${GITLAB_API_ROUTE}/get-config-file`, authAPIOptions, otherOptions, {
63
+ method: "POST",
64
+ body: {
65
+ token: token ?? void 0,
66
+ projectId,
67
+ branch,
68
+ path,
69
+ ...instanceUrl && { instanceUrl }
70
+ }
71
+ });
72
+ return {
73
+ getAuthUrl,
74
+ authenticate,
75
+ getProjects,
76
+ checkIntlayerConfig,
77
+ getConfigFile
78
+ };
79
+ };
80
+
81
+ //#endregion
82
+ export { getGitlabAPI };
2
83
  //# sourceMappingURL=gitlab.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\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;\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"],"mappings":"yCAoEA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAmB,GAFN,EAAe,OAAO,WAEF,aA8HvC,MAAO,CACL,WAxHiB,MACjB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CAAE,cAAa,GAAI,GAAe,CAAE,cAAa,CAAG,CAC7D,CACF,CA6GD,aArGmB,MACnB,EACA,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,OACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,OAAM,cAAa,cAAa,CACzC,CACF,CAwFD,YAjFkB,MAClB,EACA,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,WACpB,EACA,EACA,CACE,OAAQ,CACN,GAAI,GAAS,CAAE,QAAO,CACtB,GAAI,GAAe,CAAE,cAAa,CACnC,CACF,CACF,CAmED,oBA1D0B,MAC1B,EACA,EACA,EAAiB,OACjB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,eACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CACJ,MAAO,GAAS,IAAA,GAChB,YACA,SACA,GAAI,GAAe,CAAE,cAAa,CACnC,CACF,CACF,CAuCD,cA7BoB,MACpB,EACA,EACA,EAAiB,OACjB,EAAe,qBACf,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAiB,kBACpB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CACJ,MAAO,GAAS,IAAA,GAChB,YACA,SACA,OACA,GAAI,GAAe,CAAE,cAAa,CACnC,CACF,CACF,CAQF"}
1
+ {"version":3,"file":"gitlab.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitlab.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\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;\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"],"mappings":";;;AAoEA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,mBAAmB,GAFN,eAAe,OAAO,WAEF;;;;;;CAOvC,MAAM,aAAa,OACjB,aACA,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EAAE;EAAa,GAAI,eAAe,EAAE,aAAa;EAAG,EAC7D,CACF;;;;;;;CAQH,MAAM,eAAe,OACnB,MACA,aACA,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,QACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GAAE;GAAM;GAAa;GAAa;EACzC,CACF;;;;;;CAOH,MAAM,cAAc,OAClB,OACA,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,YACpB,gBACA,cACA,EACE,QAAQ;EACN,GAAI,SAAS,EAAE,OAAO;EACtB,GAAI,eAAe,EAAE,aAAa;EACnC,EACF,CACF;;;;;;;;CASH,MAAM,sBAAsB,OAC1B,OACA,WACA,SAAiB,QACjB,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,gBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA,GAAI,eAAe,EAAE,aAAa;GACnC;EACF,CACF;;;;;;;;;CAUH,MAAM,gBAAgB,OACpB,OACA,WACA,SAAiB,QACjB,OAAe,sBACf,aACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,iBAAiB,mBACpB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;GACJ,OAAO,SAAS;GAChB;GACA;GACA;GACA,GAAI,eAAe,EAAE,aAAa;GACnC;EACF,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACD"}
@@ -1,2 +1,45 @@
1
- import{getAiAPI as e}from"./ai.mjs";import{getAuditAPI as t}from"./audit.mjs";import{getBitbucketAPI as n}from"./bitbucket.mjs";import{getDictionaryAPI as r}from"./dictionary.mjs";import{getEditorAPI as i}from"./editor.mjs";import{getGithubAPI as a}from"./github.mjs";import{getGitlabAPI as o}from"./gitlab.mjs";import{getNewsletterAPI as s}from"./newsletter.mjs";import{getOAuthAPI as c}from"./oAuth.mjs";import{getOrganizationAPI as l}from"./organization.mjs";import{getProjectAPI as u}from"./project.mjs";import{getSearchAPI as d}from"./search.mjs";import{getShowcaseProjectAPI as f}from"./showcaseProject.mjs";import{getStripeAPI as p}from"./stripe.mjs";import{getTagAPI as m}from"./tag.mjs";import{getUserAPI as h}from"./user.mjs";import g from"@intlayer/config/built";import{defu as _}from"defu";const v=(v={},y)=>{let b=_(y??{},g);return{organization:l(v,b),project:u(v,b),user:h(v,b),oAuth:c(b),dictionary:r(v,b),stripe:p(v,b),ai:e(v,b),audit:t(v,b),tag:m(v,b),search:d(v,b),editor:i(v,b),newsletter:s(v,b),github:a(v,b),gitlab:o(v,b),bitbucket:n(v,b),showcaseProject:f(v,b)}};export{v as getIntlayerAPI};
1
+ import { getAiAPI } from "./ai.mjs";
2
+ import { getAuditAPI } from "./audit.mjs";
3
+ import { getBitbucketAPI } from "./bitbucket.mjs";
4
+ import { getDictionaryAPI } from "./dictionary.mjs";
5
+ import { getEditorAPI } from "./editor.mjs";
6
+ import { getGithubAPI } from "./github.mjs";
7
+ import { getGitlabAPI } from "./gitlab.mjs";
8
+ import { getNewsletterAPI } from "./newsletter.mjs";
9
+ import { getOAuthAPI } from "./oAuth.mjs";
10
+ import { getOrganizationAPI } from "./organization.mjs";
11
+ import { getProjectAPI } from "./project.mjs";
12
+ import { getSearchAPI } from "./search.mjs";
13
+ import { getShowcaseProjectAPI } from "./showcaseProject.mjs";
14
+ import { getStripeAPI } from "./stripe.mjs";
15
+ import { getTagAPI } from "./tag.mjs";
16
+ import { getUserAPI } from "./user.mjs";
17
+ import builtConfiguration from "@intlayer/config/built";
18
+ import { defu } from "defu";
19
+
20
+ //#region src/getIntlayerAPI/index.ts
21
+ const getIntlayerAPI = (authAPIOptions = {}, intlayerConfig) => {
22
+ const resolvedConfig = defu(intlayerConfig ?? {}, builtConfiguration);
23
+ return {
24
+ organization: getOrganizationAPI(authAPIOptions, resolvedConfig),
25
+ project: getProjectAPI(authAPIOptions, resolvedConfig),
26
+ user: getUserAPI(authAPIOptions, resolvedConfig),
27
+ oAuth: getOAuthAPI(resolvedConfig),
28
+ dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),
29
+ stripe: getStripeAPI(authAPIOptions, resolvedConfig),
30
+ ai: getAiAPI(authAPIOptions, resolvedConfig),
31
+ audit: getAuditAPI(authAPIOptions, resolvedConfig),
32
+ tag: getTagAPI(authAPIOptions, resolvedConfig),
33
+ search: getSearchAPI(authAPIOptions, resolvedConfig),
34
+ editor: getEditorAPI(authAPIOptions, resolvedConfig),
35
+ newsletter: getNewsletterAPI(authAPIOptions, resolvedConfig),
36
+ github: getGithubAPI(authAPIOptions, resolvedConfig),
37
+ gitlab: getGitlabAPI(authAPIOptions, resolvedConfig),
38
+ bitbucket: getBitbucketAPI(authAPIOptions, resolvedConfig),
39
+ showcaseProject: getShowcaseProjectAPI(authAPIOptions, resolvedConfig)
40
+ };
41
+ };
42
+
43
+ //#endregion
44
+ export { getIntlayerAPI };
2
45
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import builtConfiguration 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 { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\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 { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\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 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}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(\n intlayerConfig ?? {},\n builtConfiguration\n ) as IntlayerConfig;\n\n return {\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(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 };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":"kyBAwCA,MAAa,GACX,EAAiC,EAAE,CACnC,IACsB,CACtB,IAAM,EAAiB,EACrB,GAAkB,EAAE,CACpB,EACD,CAED,MAAO,CACL,aAAc,EAAmB,EAAgB,EAAe,CAChE,QAAS,EAAc,EAAgB,EAAe,CACtD,KAAM,EAAW,EAAgB,EAAe,CAChD,MAAO,EAAY,EAAe,CAClC,WAAY,EAAiB,EAAgB,EAAe,CAC5D,OAAQ,EAAa,EAAgB,EAAe,CACpD,GAAI,EAAS,EAAgB,EAAe,CAC5C,MAAO,EAAY,EAAgB,EAAe,CAClD,IAAK,EAAU,EAAgB,EAAe,CAC9C,OAAQ,EAAa,EAAgB,EAAe,CACpD,OAAQ,EAAa,EAAgB,EAAe,CACpD,WAAY,EAAiB,EAAgB,EAAe,CAC5D,OAAQ,EAAa,EAAgB,EAAe,CACpD,OAAQ,EAAa,EAAgB,EAAe,CACpD,UAAW,EAAgB,EAAgB,EAAe,CAC1D,gBAAiB,EAAsB,EAAgB,EAAe,CACvE"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/getIntlayerAPI/index.ts"],"sourcesContent":["import builtConfiguration 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 { getAuditAPI } from './audit';\nimport { getBitbucketAPI } from './bitbucket';\nimport { getDictionaryAPI } from './dictionary';\nimport { getEditorAPI } from './editor';\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 { getSearchAPI } from './search';\nimport { getShowcaseProjectAPI } from './showcaseProject';\nimport { getStripeAPI } from './stripe';\nimport { getTagAPI } from './tag';\nimport { getUserAPI } from './user';\n\ninterface IntlayerAPIReturn {\n organization: ReturnType<typeof getOrganizationAPI>;\n project: ReturnType<typeof getProjectAPI>;\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 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}\n\nexport const getIntlayerAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n): IntlayerAPIReturn => {\n const resolvedConfig = defu(\n intlayerConfig ?? {},\n builtConfiguration\n ) as IntlayerConfig;\n\n return {\n organization: getOrganizationAPI(authAPIOptions, resolvedConfig),\n project: getProjectAPI(authAPIOptions, resolvedConfig),\n user: getUserAPI(authAPIOptions, resolvedConfig),\n oAuth: getOAuthAPI(resolvedConfig),\n dictionary: getDictionaryAPI(authAPIOptions, resolvedConfig),\n stripe: getStripeAPI(authAPIOptions, resolvedConfig),\n ai: getAiAPI(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 };\n};\n\nexport type IntlayerAPI = ReturnType<typeof getIntlayerAPI>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,kBACX,iBAAiC,EAAE,EACnC,mBACsB;CACtB,MAAM,iBAAiB,KACrB,kBAAkB,EAAE,EACpB,mBACD;AAED,QAAO;EACL,cAAc,mBAAmB,gBAAgB,eAAe;EAChE,SAAS,cAAc,gBAAgB,eAAe;EACtD,MAAM,WAAW,gBAAgB,eAAe;EAChD,OAAO,YAAY,eAAe;EAClC,YAAY,iBAAiB,gBAAgB,eAAe;EAC5D,QAAQ,aAAa,gBAAgB,eAAe;EACpD,IAAI,SAAS,gBAAgB,eAAe;EAC5C,OAAO,YAAY,gBAAgB,eAAe;EAClD,KAAK,UAAU,gBAAgB,eAAe;EAC9C,QAAQ,aAAa,gBAAgB,eAAe;EACpD,QAAQ,aAAa,gBAAgB,eAAe;EACpD,YAAY,iBAAiB,gBAAgB,eAAe;EAC5D,QAAQ,aAAa,gBAAgB,eAAe;EACpD,QAAQ,aAAa,gBAAgB,eAAe;EACpD,WAAW,gBAAgB,gBAAgB,eAAe;EAC1D,iBAAiB,sBAAsB,gBAAgB,eAAe;EACvE"}
@@ -1,2 +1,38 @@
1
- import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/newsletter`;return{subscribeToNewsletter:async(n,i={})=>await e(`${r}/subscribe`,t,i,{method:`POST`,body:n}),unsubscribeFromNewsletter:async(n,i={})=>await e(`${r}/unsubscribe`,t,i,{method:`POST`,body:n}),getNewsletterStatus:async(n={})=>await e(`${r}/status`,t,n,{method:`GET`})}};export{t as getNewsletterAPI};
1
+ import { fetcher } from "../fetcher.mjs";
2
+
3
+ //#region src/getIntlayerAPI/newsletter.ts
4
+ const getNewsletterAPI = (authAPIOptions = {}, intlayerConfig) => {
5
+ const NEWSLETTER_API_ROUTE = `${intlayerConfig.editor.backendURL}/api/newsletter`;
6
+ /**
7
+ * Subscribe a user to newsletter(s)
8
+ * @param body - Newsletter subscription parameters.
9
+ * @returns Newsletter subscription result.
10
+ */
11
+ const subscribeToNewsletter = async (body, otherOptions = {}) => await fetcher(`${NEWSLETTER_API_ROUTE}/subscribe`, authAPIOptions, otherOptions, {
12
+ method: "POST",
13
+ body
14
+ });
15
+ /**
16
+ * Unsubscribe a user from newsletter(s)
17
+ * @param body - Newsletter unsubscription parameters.
18
+ * @returns Newsletter unsubscription result.
19
+ */
20
+ const unsubscribeFromNewsletter = async (body, otherOptions = {}) => await fetcher(`${NEWSLETTER_API_ROUTE}/unsubscribe`, authAPIOptions, otherOptions, {
21
+ method: "POST",
22
+ body
23
+ });
24
+ /**
25
+ * Get newsletter subscription status for the authenticated user
26
+ * @returns Newsletter subscription status.
27
+ */
28
+ const getNewsletterStatus = async (otherOptions = {}) => await fetcher(`${NEWSLETTER_API_ROUTE}/status`, authAPIOptions, otherOptions, { method: "GET" });
29
+ return {
30
+ subscribeToNewsletter,
31
+ unsubscribeFromNewsletter,
32
+ getNewsletterStatus
33
+ };
34
+ };
35
+
36
+ //#endregion
37
+ export { getNewsletterAPI };
2
38
  //# 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 type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.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"],"mappings":"yCAQA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAuB,GAFV,EAAe,OAAO,WAEE,iBAsD3C,MAAO,CACL,sBAhD4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAqB,YACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAqCD,0BA9BgC,MAChC,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAqB,cACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAmBD,oBAb0B,MAAO,EAA+B,EAAE,GAClE,MAAM,EACJ,GAAG,EAAqB,SACxB,EACA,EACA,CACE,OAAQ,MACT,CACF,CAMF"}
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 type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.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"],"mappings":";;;AAQA,MAAa,oBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,uBAAuB,GAFV,eAAe,OAAO,WAEE;;;;;;CAO3C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBAAqB,aACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBAAqB,eACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;CAMH,MAAM,sBAAsB,OAAO,eAA+B,EAAE,KAClE,MAAM,QACJ,GAAG,qBAAqB,UACxB,gBACA,cACA,EACE,QAAQ,OACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
@@ -1,2 +1,25 @@
1
- import{fetcher as e}from"../fetcher.mjs";const t=t=>{let n=t.editor.backendURL,{clientId:r,clientSecret:i}=t.editor;return{getOAuth2AccessToken:async(t={})=>await e(`${n}/oauth2/token`,{},t,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:{grant_type:`client_credentials`,client_id:r,client_secret:i}})}};export{t as getOAuthAPI};
1
+ import { fetcher } from "../fetcher.mjs";
2
+
3
+ //#region src/getIntlayerAPI/oAuth.ts
4
+ const getOAuthAPI = (intlayerConfig) => {
5
+ const backendURL = intlayerConfig.editor.backendURL;
6
+ const { clientId, clientSecret } = intlayerConfig.editor;
7
+ /**
8
+ * Gets an oAuth2 accessToken
9
+ * @return The token information
10
+ */
11
+ const getOAuth2AccessToken = async (otherOptions = {}) => await fetcher(`${backendURL}/oauth2/token`, {}, otherOptions, {
12
+ method: "POST",
13
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
14
+ body: {
15
+ grant_type: "client_credentials",
16
+ client_id: clientId,
17
+ client_secret: clientSecret
18
+ }
19
+ });
20
+ return { getOAuth2AccessToken };
21
+ };
22
+
23
+ //#endregion
24
+ export { getOAuthAPI };
2
25
  //# sourceMappingURL=oAuth.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (intlayerConfig: IntlayerConfig) => {\n const backendURL = intlayerConfig.editor.backendURL;\n const { clientId, clientSecret } = intlayerConfig.editor;\n\n /**\n * Gets an oAuth2 accessToken\n * @return The token information\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 return {\n getOAuth2AccessToken,\n };\n};\n"],"mappings":"yCAOA,MAAa,EAAe,GAAmC,CAC7D,IAAM,EAAa,EAAe,OAAO,WACnC,CAAE,WAAU,gBAAiB,EAAe,OAwBlD,MAAO,CACL,qBAnB2B,MAAO,EAA+B,EAAE,GACnE,MAAM,EACJ,GAAG,EAAW,eACd,EAAE,CACF,EACA,CACE,OAAQ,OACR,QAAS,CACP,eAAgB,oCACjB,CACD,KAAM,CACJ,WAAY,qBACZ,UAAW,EACX,cAAe,EAChB,CACF,CACF,CAIF"}
1
+ {"version":3,"file":"oAuth.mjs","names":[],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (intlayerConfig: IntlayerConfig) => {\n const backendURL = intlayerConfig.editor.backendURL;\n const { clientId, clientSecret } = intlayerConfig.editor;\n\n /**\n * Gets an oAuth2 accessToken\n * @return The token information\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 return {\n getOAuth2AccessToken,\n };\n};\n"],"mappings":";;;AAOA,MAAa,eAAe,mBAAmC;CAC7D,MAAM,aAAa,eAAe,OAAO;CACzC,MAAM,EAAE,UAAU,iBAAiB,eAAe;;;;;CAMlD,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAM,QACJ,GAAG,WAAW,gBACd,EAAE,EACF,cACA;EACE,QAAQ;EACR,SAAS,EACP,gBAAgB,qCACjB;EACD,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;GAChB;EACF,CACF;AAEH,QAAO,EACL,sBACD"}
@@ -1,2 +1,91 @@
1
- import{fetcher as e}from"../fetcher.mjs";const t=(t={},n)=>{let r=`${n.editor.backendURL}/api/organization`;return{getOrganizations:async(n,i={})=>await e(r,t,i,{cache:`no-store`,params:n}),getOrganization:async(n,i={})=>await e(`${r}/${String(n)}`,t,i),addOrganization:async(n,i={})=>await e(r,t,i,{method:`POST`,body:n}),addOrganizationMember:async(n,i={})=>e(`${r}/member`,t,i,{method:`POST`,body:n}),updateOrganization:async(n,i={})=>e(r,t,i,{method:`PUT`,body:n}),updateOrganizationMembers:async(n,i={})=>e(`${r}/members`,t,i,{method:`PUT`,body:n}),updateOrganizationMembersById:async(n,i,a={})=>e(`${r}/${n}/members`,t,a,{method:`PUT`,body:i}),deleteOrganization:async(n={})=>await e(r,t,n,{method:`DELETE`}),selectOrganization:async(n,i={})=>await e(`${r}/${String(n)}`,t,i,{method:`PUT`}),unselectOrganization:async(n={})=>await e(`${r}/logout`,t,n,{method:`POST`})}};export{t as getOrganizationAPI};
1
+ import { fetcher } from "../fetcher.mjs";
2
+
3
+ //#region src/getIntlayerAPI/organization.ts
4
+ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
5
+ const ORGANIZATION_API_ROUTE = `${intlayerConfig.editor.backendURL}/api/organization`;
6
+ /**
7
+ * Retrieves a list of organizations based on filters and pagination.
8
+ * @param filters - Filters and pagination options.
9
+ */
10
+ const getOrganizations = async (filters, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
11
+ cache: "no-store",
12
+ params: filters
13
+ });
14
+ /**
15
+ * Retrieves an organization by its ID.
16
+ * @param organizationId - Organization ID.
17
+ */
18
+ const getOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions);
19
+ /**
20
+ * Adds a new organization to the database.
21
+ * @param organization - Organization data.
22
+ */
23
+ const addOrganization = async (organization, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
24
+ method: "POST",
25
+ body: organization
26
+ });
27
+ /**
28
+ * Updates an existing organization in the database.
29
+ * @param organization - Updated organization data.
30
+ */
31
+ const updateOrganization = async (organization, otherOptions = {}) => fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
32
+ method: "PUT",
33
+ body: organization
34
+ });
35
+ /**
36
+ * Update members to the organization in the database.
37
+ * @param body - Updated organization members data.
38
+ */
39
+ const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/members`, authAPIOptions, otherOptions, {
40
+ method: "PUT",
41
+ body
42
+ });
43
+ /**
44
+ * Admin-only: Update members of any organization by ID
45
+ * @param organizationId - Organization ID
46
+ * @param body - Updated organization members data.
47
+ */
48
+ const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/${organizationId}/members`, authAPIOptions, otherOptions, {
49
+ method: "PUT",
50
+ body
51
+ });
52
+ /**
53
+ * Add member to the organization in the database.
54
+ * @param body - Updated organization members data.
55
+ */
56
+ const addOrganizationMember = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/member`, authAPIOptions, otherOptions, {
57
+ method: "POST",
58
+ body
59
+ });
60
+ /**
61
+ * Deletes an organization from the database by its ID.
62
+ * @param organizationId - Organization ID.
63
+ */
64
+ const deleteOrganization = async (otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, { method: "DELETE" });
65
+ /**
66
+ * Select an organization from the database by its ID.
67
+ * @param organizationId - Organization ID.
68
+ */
69
+ const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions, { method: "PUT" });
70
+ /**
71
+ * Unselect an organization from the database by its ID.
72
+ * @param organizationId - Organization ID.
73
+ */
74
+ const unselectOrganization = async (otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
75
+ return {
76
+ getOrganizations,
77
+ getOrganization,
78
+ addOrganization,
79
+ addOrganizationMember,
80
+ updateOrganization,
81
+ updateOrganizationMembers,
82
+ updateOrganizationMembersById,
83
+ deleteOrganization,
84
+ selectOrganization,
85
+ unselectOrganization
86
+ };
87
+ };
88
+
89
+ //#endregion
90
+ export { getOrganizationAPI };
2
91
  //# 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 UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.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 * 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 * 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 updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":"yCAqBA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CAGH,IAAM,EAAyB,GAFZ,EAAe,OAAO,WAEI,mBA4K7C,MAAO,CACL,iBAvKuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CA2JD,gBArJsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAuB,GAAG,OAAO,EAAe,GACnD,EACA,EACD,CA8ID,gBAxIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,EACA,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CA6HD,sBA/D4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,EACE,GAAG,EAAuB,SAC1B,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAoDD,mBAxHyB,MACzB,EACA,EAA+B,EAAE,GAEjC,EACE,EACA,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CA6GD,0BAvGgC,MAChC,EACA,EAA+B,EAAE,GAEjC,EACE,GAAG,EAAuB,UAC1B,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CA4FD,8BArFoC,MACpC,EACA,EACA,EAA+B,EAAE,GAEjC,EACE,GAAG,EAAuB,GAAG,EAAe,UAC5C,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CAyED,mBAjDyB,MAAO,EAA+B,EAAE,GACjE,MAAM,EACJ,EACA,EACA,EACA,CACE,OAAQ,SACT,CACF,CA0CD,mBApCyB,MACzB,EACA,EAA+B,EAAE,GAEjC,MAAM,EACJ,GAAG,EAAuB,GAAG,OAAO,EAAe,GACnD,EACA,EACA,CACE,OAAQ,MACT,CACF,CA0BD,qBApB2B,MAAO,EAA+B,EAAE,GACnE,MAAM,EACJ,GAAG,EAAuB,SAC1B,EACA,EACA,CACE,OAAQ,OACT,CACF,CAaF"}
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 UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig: IntlayerConfig\n) => {\n const backendURL = intlayerConfig.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 * 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 * 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 updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n selectOrganization,\n unselectOrganization,\n };\n};\n"],"mappings":";;;AAqBA,MAAa,sBACX,iBAAiC,EAAE,EACnC,mBACG;CAGH,MAAM,yBAAyB,GAFZ,eAAe,OAAO,WAEI;;;;;CAM7C,MAAM,mBAAmB,OACvB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,gBACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,aACD;;;;;CAMH,MAAM,kBAAkB,OACtB,cACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,qBAAqB,OACzB,cACA,eAA+B,EAAE,KAEjC,QACE,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,uBAAuB,WAC1B,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;;CAOH,MAAM,gCAAgC,OACpC,gBACA,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,uBAAuB,GAAG,eAAe,WAC5C,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,uBAAuB,UAC1B,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,qBAAqB,OAAO,eAA+B,EAAE,KACjE,MAAM,QACJ,wBACA,gBACA,cACA,EACE,QAAQ,UACT,CACF;;;;;CAMH,MAAM,qBAAqB,OACzB,gBACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;CAMH,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAM,QACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}