@intlayer/api 8.1.1 → 8.1.3-canary.0

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 (86) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
  2. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +1 -20
  3. package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
  4. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +1 -22
  5. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
  6. package/dist/cjs/distantDictionary/index.cjs +1 -6
  7. package/dist/cjs/fetcher.cjs +1 -122
  8. package/dist/cjs/fetcher.cjs.map +1 -1
  9. package/dist/cjs/getIntlayerAPI/ai.cjs +2 -166
  10. package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
  11. package/dist/cjs/getIntlayerAPI/audit.cjs +1 -41
  12. package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
  13. package/dist/cjs/getIntlayerAPI/bitbucket.cjs +1 -74
  14. package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
  15. package/dist/cjs/getIntlayerAPI/dictionary.cjs +1 -72
  16. package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAPI/editor.cjs +1 -40
  18. package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
  19. package/dist/cjs/getIntlayerAPI/github.cjs +1 -74
  20. package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
  21. package/dist/cjs/getIntlayerAPI/gitlab.cjs +1 -88
  22. package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
  23. package/dist/cjs/getIntlayerAPI/index.cjs +1 -38
  24. package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
  25. package/dist/cjs/getIntlayerAPI/newsletter.cjs +1 -43
  26. package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
  27. package/dist/cjs/getIntlayerAPI/oAuth.cjs +1 -29
  28. package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
  29. package/dist/cjs/getIntlayerAPI/organization.cjs +1 -96
  30. package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
  31. package/dist/cjs/getIntlayerAPI/project.cjs +1 -144
  32. package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
  33. package/dist/cjs/getIntlayerAPI/search.cjs +1 -25
  34. package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
  35. package/dist/cjs/getIntlayerAPI/stripe.cjs +1 -41
  36. package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
  37. package/dist/cjs/getIntlayerAPI/tag.cjs +1 -50
  38. package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
  39. package/dist/cjs/getIntlayerAPI/user.cjs +1 -82
  40. package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
  41. package/dist/cjs/index.cjs +1 -43
  42. package/dist/cjs/proxy.cjs +1 -101
  43. package/dist/cjs/proxy.cjs.map +1 -1
  44. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +1 -19
  45. package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
  46. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +1 -21
  47. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
  48. package/dist/esm/distantDictionary/index.mjs +1 -4
  49. package/dist/esm/fetcher.mjs +1 -119
  50. package/dist/esm/fetcher.mjs.map +1 -1
  51. package/dist/esm/getIntlayerAPI/ai.mjs +2 -163
  52. package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
  53. package/dist/esm/getIntlayerAPI/audit.mjs +1 -38
  54. package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
  55. package/dist/esm/getIntlayerAPI/bitbucket.mjs +1 -71
  56. package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
  57. package/dist/esm/getIntlayerAPI/dictionary.mjs +1 -69
  58. package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
  59. package/dist/esm/getIntlayerAPI/editor.mjs +1 -37
  60. package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
  61. package/dist/esm/getIntlayerAPI/github.mjs +1 -71
  62. package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
  63. package/dist/esm/getIntlayerAPI/gitlab.mjs +1 -85
  64. package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
  65. package/dist/esm/getIntlayerAPI/index.mjs +1 -37
  66. package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
  67. package/dist/esm/getIntlayerAPI/newsletter.mjs +1 -40
  68. package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
  69. package/dist/esm/getIntlayerAPI/oAuth.mjs +1 -26
  70. package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
  71. package/dist/esm/getIntlayerAPI/organization.mjs +1 -93
  72. package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
  73. package/dist/esm/getIntlayerAPI/project.mjs +1 -141
  74. package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
  75. package/dist/esm/getIntlayerAPI/search.mjs +1 -22
  76. package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
  77. package/dist/esm/getIntlayerAPI/stripe.mjs +1 -38
  78. package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
  79. package/dist/esm/getIntlayerAPI/tag.mjs +1 -47
  80. package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
  81. package/dist/esm/getIntlayerAPI/user.mjs +1 -79
  82. package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
  83. package/dist/esm/index.mjs +1 -22
  84. package/dist/esm/proxy.mjs +1 -100
  85. package/dist/esm/proxy.mjs.map +1 -1
  86. package/package.json +6 -6
@@ -1,44 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/newsletter.ts
8
- const getNewsletterAPI = (authAPIOptions = {}, intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
11
- const NEWSLETTER_API_ROUTE = `${backendURL}/api/newsletter`;
12
- /**
13
- * Subscribe a user to newsletter(s)
14
- * @param body - Newsletter subscription parameters.
15
- * @returns Newsletter subscription result.
16
- */
17
- const subscribeToNewsletter = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${NEWSLETTER_API_ROUTE}/subscribe`, authAPIOptions, otherOptions, {
18
- method: "POST",
19
- body
20
- });
21
- /**
22
- * Unsubscribe a user from newsletter(s)
23
- * @param body - Newsletter unsubscription parameters.
24
- * @returns Newsletter unsubscription result.
25
- */
26
- const unsubscribeFromNewsletter = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${NEWSLETTER_API_ROUTE}/unsubscribe`, authAPIOptions, otherOptions, {
27
- method: "POST",
28
- body
29
- });
30
- /**
31
- * Get newsletter subscription status for the authenticated user
32
- * @returns Newsletter subscription status.
33
- */
34
- const getNewsletterStatus = async (otherOptions = {}) => await require_fetcher.fetcher(`${NEWSLETTER_API_ROUTE}/status`, authAPIOptions, otherOptions, { method: "GET" });
35
- return {
36
- subscribeToNewsletter,
37
- unsubscribeFromNewsletter,
38
- getNewsletterStatus
39
- };
40
- };
41
-
42
- //#endregion
43
- exports.getNewsletterAPI = getNewsletterAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e={},r)=>{let i=r?.editor?.backendURL??n.default?.editor?.backendURL;if(!i)throw Error(`Backend URL is not defined in the Intlayer configuration.`);let a=`${i}/api/newsletter`;return{subscribeToNewsletter:async(n,r={})=>await t.fetcher(`${a}/subscribe`,e,r,{method:`POST`,body:n}),unsubscribeFromNewsletter:async(n,r={})=>await t.fetcher(`${a}/unsubscribe`,e,r,{method:`POST`,body:n}),getNewsletterStatus:async(n={})=>await t.fetcher(`${a}/status`,e,n,{method:`GET`})}};exports.getNewsletterAPI=r;
44
2
  //# sourceMappingURL=newsletter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"newsletter.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '../types';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\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":";;;;;;;AASA,MAAa,oBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,gCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,uBAAuB,GAAG,WAAW;;;;;;CAO3C,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,GAAG,qBAAqB,aACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;;CAOH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,qBAAqB,eACxB,gBACA,cACA;EACE,QAAQ;EACF;EACP,CACF;;;;;CAMH,MAAM,sBAAsB,OAAO,eAA+B,EAAE,KAClE,MAAMA,wBACJ,GAAG,qBAAqB,UACxB,gBACA,cACA,EACE,QAAQ,OACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
1
+ {"version":3,"file":"newsletter.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/newsletter.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n} from '../types';\n\nexport const getNewsletterAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\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":"2MASA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAGH,IAAM,EAAuB,GAAG,EAAW,iBAsD3C,MAAO,CACL,sBAhD4B,MAC5B,EACA,EAA+B,EAAE,GAEjC,MAAMC,EAAAA,QACJ,GAAG,EAAqB,YACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAqCD,0BA9BgC,MAChC,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAqB,cACxB,EACA,EACA,CACE,OAAQ,OACF,OACP,CACF,CAmBD,oBAb0B,MAAO,EAA+B,EAAE,GAClE,MAAMA,EAAAA,QACJ,GAAG,EAAqB,SACxB,EACA,EACA,CACE,OAAQ,MACT,CACF,CAMF"}
@@ -1,30 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/oAuth.ts
8
- const getOAuthAPI = (intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- const { clientId, clientSecret } = intlayerConfig?.editor ?? {};
11
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
12
- /**
13
- * Gets an oAuth2 accessToken
14
- * @return The token information
15
- */
16
- const getOAuth2AccessToken = async (otherOptions = {}) => await require_fetcher.fetcher(`${backendURL}/oauth2/token`, {}, otherOptions, {
17
- method: "POST",
18
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
19
- body: {
20
- grant_type: "client_credentials",
21
- client_id: clientId,
22
- client_secret: clientSecret
23
- }
24
- });
25
- return { getOAuth2AccessToken };
26
- };
27
-
28
- //#endregion
29
- exports.getOAuthAPI = getOAuthAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=e=>{let r=e?.editor?.backendURL??n.default?.editor?.backendURL,{clientId:i,clientSecret:a}=e?.editor??{};if(!r)throw Error(`Backend URL is not defined in the Intlayer configuration.`);return{getOAuth2AccessToken:async(e={})=>await t.fetcher(`${r}/oauth2/token`,{},e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:{grant_type:`client_credentials`,client_id:i,client_secret:a}})}};exports.getOAuthAPI=r;
30
2
  //# sourceMappingURL=oAuth.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"oAuth.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type { GetOAuth2TokenBody, GetOAuth2TokenResult } from '../types';\n\nexport const getOAuthAPI = (intlayerConfig?: IntlayerConfig) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\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":";;;;;;;AAKA,MAAa,eAAe,mBAAoC;CAC9D,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,gCAAe,QAAQ;CAC/D,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,EAAE;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;;;;;CAOH,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAMC,wBACJ,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
+ {"version":3,"file":"oAuth.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type { GetOAuth2TokenBody, GetOAuth2TokenResult } from '../types';\n\nexport const getOAuthAPI = (intlayerConfig?: IntlayerConfig) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\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":"2MAKA,MAAa,EAAe,GAAoC,CAC9D,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WACzD,CAAE,WAAU,gBAAiB,GAAgB,QAAU,EAAE,CAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAyBH,MAAO,CACL,qBAnB2B,MAAO,EAA+B,EAAE,GACnE,MAAMC,EAAAA,QACJ,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,97 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/organization.ts
8
- const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration--.");
11
- const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
12
- /**
13
- * Retrieves a list of organizations based on filters and pagination.
14
- * @param filters - Filters and pagination options.
15
- */
16
- const getOrganizations = async (filters, otherOptions = {}) => await require_fetcher.fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
17
- cache: "no-store",
18
- params: filters
19
- });
20
- /**
21
- * Retrieves an organization by its ID.
22
- * @param organizationId - Organization ID.
23
- */
24
- const getOrganization = async (organizationId, otherOptions = {}) => await require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions);
25
- /**
26
- * Adds a new organization to the database.
27
- * @param organization - Organization data.
28
- */
29
- const addOrganization = async (organization, otherOptions = {}) => await require_fetcher.fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
30
- method: "POST",
31
- body: organization
32
- });
33
- /**
34
- * Updates an existing organization in the database.
35
- * @param organization - Updated organization data.
36
- */
37
- const updateOrganization = async (organization, otherOptions = {}) => require_fetcher.fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
38
- method: "PUT",
39
- body: organization
40
- });
41
- /**
42
- * Update members to the organization in the database.
43
- * @param body - Updated organization members data.
44
- */
45
- const updateOrganizationMembers = async (body, otherOptions = {}) => require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/members`, authAPIOptions, otherOptions, {
46
- method: "PUT",
47
- body
48
- });
49
- /**
50
- * Admin-only: Update members of any organization by ID
51
- * @param organizationId - Organization ID
52
- * @param body - Updated organization members data.
53
- */
54
- const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/${organizationId}/members`, authAPIOptions, otherOptions, {
55
- method: "PUT",
56
- body
57
- });
58
- /**
59
- * Add member to the organization in the database.
60
- * @param body - Updated organization members data.
61
- */
62
- const addOrganizationMember = async (body, otherOptions = {}) => require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/member`, authAPIOptions, otherOptions, {
63
- method: "POST",
64
- body
65
- });
66
- /**
67
- * Deletes an organization from the database by its ID.
68
- * @param organizationId - Organization ID.
69
- */
70
- const deleteOrganization = async (otherOptions = {}) => await require_fetcher.fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, { method: "DELETE" });
71
- /**
72
- * Select an organization from the database by its ID.
73
- * @param organizationId - Organization ID.
74
- */
75
- const selectOrganization = async (organizationId, otherOptions = {}) => await require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions, { method: "PUT" });
76
- /**
77
- * Unselect an organization from the database by its ID.
78
- * @param organizationId - Organization ID.
79
- */
80
- const unselectOrganization = async (otherOptions = {}) => await require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
81
- return {
82
- getOrganizations,
83
- getOrganization,
84
- addOrganization,
85
- addOrganizationMember,
86
- updateOrganization,
87
- updateOrganizationMembers,
88
- updateOrganizationMembersById,
89
- deleteOrganization,
90
- selectOrganization,
91
- unselectOrganization
92
- };
93
- };
94
-
95
- //#endregion
96
- exports.getOrganizationAPI = getOrganizationAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e={},r)=>{let i=r?.editor?.backendURL??n.default?.editor?.backendURL;if(!i)throw Error(`Backend URL is not defined in the Intlayer configuration--.`);let a=`${i}/api/organization`;return{getOrganizations:async(n,r={})=>await t.fetcher(a,e,r,{cache:`no-store`,params:n}),getOrganization:async(n,r={})=>await t.fetcher(`${a}/${String(n)}`,e,r),addOrganization:async(n,r={})=>await t.fetcher(a,e,r,{method:`POST`,body:n}),addOrganizationMember:async(n,r={})=>t.fetcher(`${a}/member`,e,r,{method:`POST`,body:n}),updateOrganization:async(n,r={})=>t.fetcher(a,e,r,{method:`PUT`,body:n}),updateOrganizationMembers:async(n,r={})=>t.fetcher(`${a}/members`,e,r,{method:`PUT`,body:n}),updateOrganizationMembersById:async(n,r,i={})=>t.fetcher(`${a}/${n}/members`,e,i,{method:`PUT`,body:r}),deleteOrganization:async(n={})=>await t.fetcher(a,e,n,{method:`DELETE`}),selectOrganization:async(n,r={})=>await t.fetcher(`${a}/${String(n)}`,e,r,{method:`PUT`}),unselectOrganization:async(n={})=>await t.fetcher(`${a}/logout`,e,n,{method:`POST`})}};exports.getOrganizationAPI=r;
97
2
  //# sourceMappingURL=organization.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"organization.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport 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 '../types';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration--.'\n );\n }\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":";;;;;;;AAsBA,MAAa,sBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,gCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,8DACD;CAGH,MAAM,yBAAyB,GAAG,WAAW;;;;;CAM7C,MAAM,mBAAmB,OACvB,SACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,wBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,gBACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,aACD;;;;;CAMH,MAAM,kBAAkB,OACtB,cACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,qBAAqB,OACzB,cACA,eAA+B,EAAE,KAEjCA,wBACE,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjCA,wBACE,GAAG,uBAAuB,WAC1B,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;;CAOH,MAAM,gCAAgC,OACpC,gBACA,MACA,eAA+B,EAAE,KAEjCA,wBACE,GAAG,uBAAuB,GAAG,eAAe,WAC5C,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjCA,wBACE,GAAG,uBAAuB,UAC1B,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,qBAAqB,OAAO,eAA+B,EAAE,KACjE,MAAMA,wBACJ,wBACA,gBACA,cACA,EACE,QAAQ,UACT,CACF;;;;;CAMH,MAAM,qBAAqB,OACzB,gBACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;CAMH,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAMA,wBACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"organization.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport 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 '../types';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration--.'\n );\n }\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":"2MAsBA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,8DACD,CAGH,IAAM,EAAyB,GAAG,EAAW,mBA4K7C,MAAO,CACL,iBAvKuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMC,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CA2JD,gBArJsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAuB,GAAG,OAAO,EAAe,GACnD,EACA,EACD,CA8ID,gBAxIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CA6HD,sBA/D4B,MAC5B,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,GAAG,EAAuB,SAC1B,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAoDD,mBAxHyB,MACzB,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,EACA,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CA6GD,0BAvGgC,MAChC,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,GAAG,EAAuB,UAC1B,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CA4FD,8BArFoC,MACpC,EACA,EACA,EAA+B,EAAE,GAEjCA,EAAAA,QACE,GAAG,EAAuB,GAAG,EAAe,UAC5C,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CAyED,mBAjDyB,MAAO,EAA+B,EAAE,GACjE,MAAMA,EAAAA,QACJ,EACA,EACA,EACA,CACE,OAAQ,SACT,CACF,CA0CD,mBApCyB,MACzB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAuB,GAAG,OAAO,EAAe,GACnD,EACA,EACA,CACE,OAAQ,MACT,CACF,CA0BD,qBApB2B,MAAO,EAA+B,EAAE,GACnE,MAAMA,EAAAA,QACJ,GAAG,EAAuB,SAC1B,EACA,EACA,CACE,OAAQ,OACT,CACF,CAaF"}
@@ -1,145 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/project.ts
8
- const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
11
- const PROJECT_API_ROUTE = `${backendURL}/api/project`;
12
- /**
13
- * Retrieves a list of projects based on filters and pagination.
14
- * @param filters - Filters and pagination options.
15
- */
16
- const getProjects = async (filters, otherOptions = {}) => await require_fetcher.fetcher(PROJECT_API_ROUTE, authAPIOptions, otherOptions, {
17
- cache: "no-store",
18
- params: filters
19
- });
20
- /**
21
- * Adds a new project to the database.
22
- * @param project - Project data.
23
- */
24
- const addProject = async (project, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
25
- method: "POST",
26
- body: project
27
- });
28
- /**
29
- * Updates an existing project in the database.
30
- * @param project - Updated project data.
31
- */
32
- const updateProject = async (project, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
33
- method: "PUT",
34
- body: project
35
- });
36
- /**
37
- * Updates project members in the database.
38
- * @param project - Updated project data.
39
- */
40
- const updateProjectMembers = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/members`, authAPIOptions, otherOptions, {
41
- method: "PUT",
42
- body
43
- });
44
- /** Pushes a project configuration to the database.
45
- * @param projectConfiguration - Project configuration data.
46
- */
47
- const pushProjectConfiguration = async (projectConfiguration, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/configuration`, authAPIOptions, otherOptions, {
48
- method: "PUT",
49
- body: projectConfiguration
50
- });
51
- /**
52
- * Deletes a project from the database by its ID.
53
- * @param id - Project ID.
54
- */
55
- const deleteProject = async (otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, { method: "DELETE" });
56
- /**
57
- * Select a project from the database by its ID.
58
- * @param projectId - Organization ID.
59
- */
60
- const selectProject = async (projectId, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/${String(projectId)}`, authAPIOptions, otherOptions, { method: "PUT" });
61
- /**
62
- * Unselect a project from the database by its ID.
63
- * @param projectId - Project ID.
64
- */
65
- const unselectProject = async (otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
66
- /**
67
- * Add a new access key to a project.
68
- * @param accessKey - Access key data.
69
- * @param otherOptions - Fetcher options.
70
- * @returns The new access key.
71
- */
72
- const addNewAccessKey = async (accessKey, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
73
- method: "POST",
74
- body: accessKey
75
- });
76
- /**
77
- * Delete a project access key.
78
- * @param clientId - Access key client ID.
79
- * @param otherOptions - Fetcher options.
80
- * @returns The deleted project.
81
- */
82
- const deleteAccessKey = async (clientId, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
83
- method: "DELETE",
84
- body: { clientId }
85
- });
86
- /**
87
- * Refreshes an access key from a project.
88
- * @param clientId - The ID of the client to refresh.
89
- * @param projectId - The ID of the project to refresh the access key from.
90
- * @returns The new access key.
91
- */
92
- const refreshAccessKey = async (clientId, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
93
- method: "PATCH",
94
- body: { clientId }
95
- });
96
- /**
97
- * Triggers CI builds for a project (Git provider pipelines and webhooks).
98
- * @param otherOptions - Fetcher options.
99
- * @returns The trigger results.
100
- */
101
- const triggerBuild = async (otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/build`, authAPIOptions, otherOptions, { method: "POST" });
102
- /**
103
- * Triggers a single webhook by index.
104
- * @param webhookIndex - The index of the webhook to trigger.
105
- * @param otherOptions - Fetcher options.
106
- * @returns The trigger result.
107
- */
108
- const triggerWebhook = async (webhookIndex, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/webhook`, authAPIOptions, otherOptions, {
109
- method: "POST",
110
- body: { webhookIndex }
111
- });
112
- /**
113
- * Get CI configuration status for the current project.
114
- * @param otherOptions - Fetcher options.
115
- * @returns The CI configuration status.
116
- */
117
- const getCIConfig = async (otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/ci`, authAPIOptions, otherOptions, { method: "GET" });
118
- /**
119
- * Push CI configuration file to the repository.
120
- * @param otherOptions - Fetcher options.
121
- * @returns Success status.
122
- */
123
- const pushCIConfig = async (otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/ci`, authAPIOptions, otherOptions, { method: "POST" });
124
- return {
125
- getProjects,
126
- addProject,
127
- updateProject,
128
- updateProjectMembers,
129
- pushProjectConfiguration,
130
- deleteProject,
131
- selectProject,
132
- unselectProject,
133
- addNewAccessKey,
134
- deleteAccessKey,
135
- refreshAccessKey,
136
- triggerBuild,
137
- triggerWebhook,
138
- getCIConfig,
139
- pushCIConfig
140
- };
141
- };
142
-
143
- //#endregion
144
- exports.getProjectAPI = getProjectAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e={},r)=>{let i=r?.editor?.backendURL??n.default?.editor?.backendURL;if(!i)throw Error(`Backend URL is not defined in the Intlayer configuration.`);let a=`${i}/api/project`;return{getProjects:async(n,r={})=>await t.fetcher(a,e,r,{cache:`no-store`,params:n}),addProject:async(n,r={})=>await t.fetcher(`${a}`,e,r,{method:`POST`,body:n}),updateProject:async(n,r={})=>await t.fetcher(`${a}`,e,r,{method:`PUT`,body:n}),updateProjectMembers:async(n,r={})=>await t.fetcher(`${a}/members`,e,r,{method:`PUT`,body:n}),pushProjectConfiguration:async(n,r={})=>await t.fetcher(`${a}/configuration`,e,r,{method:`PUT`,body:n}),deleteProject:async(n={})=>await t.fetcher(`${a}`,e,n,{method:`DELETE`}),selectProject:async(n,r={})=>await t.fetcher(`${a}/${String(n)}`,e,r,{method:`PUT`}),unselectProject:async(n={})=>await t.fetcher(`${a}/logout`,e,n,{method:`POST`}),addNewAccessKey:async(n,r={})=>await t.fetcher(`${a}/access_key`,e,r,{method:`POST`,body:n}),deleteAccessKey:async(n,r={})=>await t.fetcher(`${a}/access_key`,e,r,{method:`DELETE`,body:{clientId:n}}),refreshAccessKey:async(n,r={})=>await t.fetcher(`${a}/access_key`,e,r,{method:`PATCH`,body:{clientId:n}}),triggerBuild:async(n={})=>await t.fetcher(`${a}/build`,e,n,{method:`POST`}),triggerWebhook:async(n,r={})=>await t.fetcher(`${a}/webhook`,e,r,{method:`POST`,body:{webhookIndex:n}}),getCIConfig:async(n={})=>await t.fetcher(`${a}/ci`,e,n,{method:`GET`}),pushCIConfig:async(n={})=>await t.fetcher(`${a}/ci`,e,n,{method:`POST`})}};exports.getProjectAPI=r;
145
2
  //# sourceMappingURL=project.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetCIConfigResult,\n GetProjectsParams,\n GetProjectsResult,\n PushCIConfigResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '../types';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_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 * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n /**\n * Triggers CI builds for a project (Git provider pipelines and webhooks).\n * @param otherOptions - Fetcher options.\n * @returns The trigger results.\n */\n const triggerBuild = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<TriggerBuildResult>(\n `${PROJECT_API_ROUTE}/build`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Triggers a single webhook by index.\n * @param webhookIndex - The index of the webhook to trigger.\n * @param otherOptions - Fetcher options.\n * @returns The trigger result.\n */\n const triggerWebhook = async (\n webhookIndex: TriggerWebhookBody['webhookIndex'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TriggerWebhookResult>(\n `${PROJECT_API_ROUTE}/webhook`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { webhookIndex },\n }\n );\n\n /**\n * Get CI configuration status for the current project.\n * @param otherOptions - Fetcher options.\n * @returns The CI configuration status.\n */\n const getCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCIConfigResult>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Push CI configuration file to the repository.\n * @param otherOptions - Fetcher options.\n * @returns Success status.\n */\n const pushCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<PushCIConfigResult>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n };\n};\n"],"mappings":";;;;;;;AA+BA,MAAa,iBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,gCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,oBAAoB,GAAG,WAAW;;;;;CAMxC,MAAM,cAAc,OAClB,SACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;;CAMH,MAAM,aAAa,OACjB,SACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,gBAAgB,OACpB,SACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,uBAAuB,OAC3B,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;CAKH,MAAM,2BAA2B,OAC/B,sBACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,iBACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,gBAAgB,OAAO,eAA+B,EAAE,KAC5D,MAAMA,wBACJ,GAAG,qBACH,gBACA,cACA,EACE,QAAQ,UACT,CACF;;;;;CAMH,MAAM,gBAAgB,OACpB,WACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,GAAG,OAAO,UAAU,IACzC,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;CAMH,MAAM,kBAAkB,OAAO,eAA+B,EAAE,KAC9D,MAAMA,wBACJ,GAAG,kBAAkB,UACrB,gBACA,cACA,EACE,QAAQ,QACT,CACF;;;;;;;CAQH,MAAM,kBAAkB,OACtB,WACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;;;CAQH,MAAM,kBAAkB,OACtB,UACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;;;;;;;CAQH,MAAM,mBAAmB,OACvB,UACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;;;;;;CAOH,MAAM,eAAe,OAAO,eAA+B,EAAE,KAC3D,MAAMA,wBACJ,GAAG,kBAAkB,SACrB,gBACA,cACA,EACE,QAAQ,QACT,CACF;;;;;;;CAQH,MAAM,iBAAiB,OACrB,cACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,cAAc;EACvB,CACF;;;;;;CAOH,MAAM,cAAc,OAAO,eAA+B,EAAE,KAC1D,MAAMA,wBACJ,GAAG,kBAAkB,MACrB,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;;CAOH,MAAM,eAAe,OAAO,eAA+B,EAAE,KAC3D,MAAMA,wBACJ,GAAG,kBAAkB,MACrB,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"project.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetCIConfigResult,\n GetProjectsParams,\n GetProjectsResult,\n PushCIConfigResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '../types';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const PROJECT_API_ROUTE = `${backendURL}/api/project`;\n\n /**\n * Retrieves a list of projects based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getProjects = async (\n filters?: GetProjectsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetProjectsResult>(\n PROJECT_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 * Adds a new project to the database.\n * @param project - Project data.\n */\n const addProject = async (\n project: AddProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: project,\n }\n );\n\n /**\n * Updates an existing project in the database.\n * @param project - Updated project data.\n */\n const updateProject = async (\n project: UpdateProjectBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: project,\n }\n );\n\n /**\n * Updates project members in the database.\n * @param project - Updated project data.\n */\n const updateProjectMembers = async (\n body: UpdateProjectMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateProjectMembersResult>(\n `${PROJECT_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /** Pushes a project configuration to the database.\n * @param projectConfiguration - Project configuration data.\n */\n const pushProjectConfiguration = async (\n projectConfiguration: PushProjectConfigurationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushProjectConfigurationResult>(\n `${PROJECT_API_ROUTE}/configuration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: projectConfiguration,\n }\n );\n\n /**\n * Deletes a project from the database by its ID.\n * @param id - Project ID.\n */\n const deleteProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Select a project from the database by its ID.\n * @param projectId - Organization ID.\n */\n const selectProject = async (\n projectId: SelectProjectParam['projectId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectProjectResult>(\n `${PROJECT_API_ROUTE}/${String(projectId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect a project from the database by its ID.\n * @param projectId - Project ID.\n */\n const unselectProject = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectProjectResult>(\n `${PROJECT_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Add a new access key to a project.\n * @param accessKey - Access key data.\n * @param otherOptions - Fetcher options.\n * @returns The new access key.\n */\n const addNewAccessKey = async (\n accessKey: AddNewAccessKeyBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddNewAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: accessKey,\n }\n );\n\n /**\n * Delete a project access key.\n * @param clientId - Access key client ID.\n * @param otherOptions - Fetcher options.\n * @returns The deleted project.\n */\n const deleteAccessKey = async (\n clientId: DeleteAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { clientId },\n }\n );\n\n /**\n * Refreshes an access key from a project.\n * @param clientId - The ID of the client to refresh.\n * @param projectId - The ID of the project to refresh the access key from.\n * @returns The new access key.\n */\n const refreshAccessKey = async (\n clientId: RefreshAccessKeyBody['clientId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RefreshAccessKeyResponse>(\n `${PROJECT_API_ROUTE}/access_key`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { clientId },\n }\n );\n\n /**\n * Triggers CI builds for a project (Git provider pipelines and webhooks).\n * @param otherOptions - Fetcher options.\n * @returns The trigger results.\n */\n const triggerBuild = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<TriggerBuildResult>(\n `${PROJECT_API_ROUTE}/build`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Triggers a single webhook by index.\n * @param webhookIndex - The index of the webhook to trigger.\n * @param otherOptions - Fetcher options.\n * @returns The trigger result.\n */\n const triggerWebhook = async (\n webhookIndex: TriggerWebhookBody['webhookIndex'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TriggerWebhookResult>(\n `${PROJECT_API_ROUTE}/webhook`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { webhookIndex },\n }\n );\n\n /**\n * Get CI configuration status for the current project.\n * @param otherOptions - Fetcher options.\n * @returns The CI configuration status.\n */\n const getCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCIConfigResult>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Push CI configuration file to the repository.\n * @param otherOptions - Fetcher options.\n * @returns Success status.\n */\n const pushCIConfig = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<PushCIConfigResult>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n };\n};\n"],"mappings":"2MA+BA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAGH,IAAM,EAAoB,GAAG,EAAW,cAsQxC,MAAO,CACL,YAjQkB,MAClB,EACA,EAA+B,EAAE,GAEjC,MAAMC,EAAAA,QACJ,EACA,EACA,EACA,CACE,MAAO,WAEP,OAAQ,EACT,CACF,CAqPD,WA/OiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAoOD,cA9NoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAmND,qBA7M2B,MAC3B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,UACrB,EACA,EACA,CACE,OAAQ,MACR,OACD,CACF,CAkMD,yBA7L+B,MAC/B,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,gBACrB,EACA,EACA,CACE,OAAQ,MACR,KAAM,EACP,CACF,CAkLD,cA5KoB,MAAO,EAA+B,EAAE,GAC5D,MAAMA,EAAAA,QACJ,GAAG,IACH,EACA,EACA,CACE,OAAQ,SACT,CACF,CAqKD,cA/JoB,MACpB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,GAAG,OAAO,EAAU,GACzC,EACA,EACA,CACE,OAAQ,MACT,CACF,CAqJD,gBA/IsB,MAAO,EAA+B,EAAE,GAC9D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,SACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAwID,gBAhIsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,OACR,KAAM,EACP,CACF,CAqHD,gBA7GsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,SACR,KAAM,CAAE,WAAU,CACnB,CACF,CAkGD,iBA1FuB,MACvB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,aACrB,EACA,EACA,CACE,OAAQ,QACR,KAAM,CAAE,WAAU,CACnB,CACF,CA+ED,aAxEmB,MAAO,EAA+B,EAAE,GAC3D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,QACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAiED,eAzDqB,MACrB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAkB,UACrB,EACA,EACA,CACE,OAAQ,OACR,KAAM,CAAE,eAAc,CACvB,CACF,CA8CD,YAvCkB,MAAO,EAA+B,EAAE,GAC1D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,KACrB,EACA,EACA,CACE,OAAQ,MACT,CACF,CAgCD,aAzBmB,MAAO,EAA+B,EAAE,GAC3D,MAAMA,EAAAA,QACJ,GAAG,EAAkB,KACrB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAkBF"}
@@ -1,26 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/search.ts
8
- const getSearchAPI = (authAPIOptions = {}, intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
11
- const AI_API_ROUTE = `${backendURL}/api/search`;
12
- /**
13
- * Search documentation
14
- * @param params - Search parameters containing the input query.
15
- * @returns Search results with GitHub URLs.
16
- */
17
- const searchDoc = async (params, otherOptions = {}) => await require_fetcher.fetcher(`${AI_API_ROUTE}/doc`, authAPIOptions, otherOptions, {
18
- method: "GET",
19
- params
20
- });
21
- return { searchDoc };
22
- };
23
-
24
- //#endregion
25
- exports.getSearchAPI = getSearchAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e={},r)=>{let i=r?.editor?.backendURL??n.default?.editor?.backendURL;if(!i)throw Error(`Backend URL is not defined in the Intlayer configuration.`);let a=`${i}/api/search`;return{searchDoc:async(n,r={})=>await t.fetcher(`${a}/doc`,e,r,{method:`GET`,params:n})}};exports.getSearchAPI=r;
26
2
  //# sourceMappingURL=search.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type { SearchDocUtilParams, SearchDocUtilResult } from '../types';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":";;;;;;;AAKA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,gCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,eAAe,GAAG,WAAW;;;;;;CAOnC,MAAM,YAAY,OAChB,QACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,GAAG,aAAa,OAChB,gBACA,cACA;EACE,QAAQ;EACA;EACT,CACF;AAEH,QAAO,EACL,WACD"}
1
+ {"version":3,"file":"search.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type { SearchDocUtilParams, SearchDocUtilResult } from '../types';\n\nexport const getSearchAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const AI_API_ROUTE = `${backendURL}/api/search`;\n\n /**\n * Search documentation\n * @param params - Search parameters containing the input query.\n * @returns Search results with GitHub URLs.\n */\n const searchDoc = async (\n params?: SearchDocUtilParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SearchDocUtilResult>(\n `${AI_API_ROUTE}/doc`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n params: params,\n }\n );\n\n return {\n searchDoc,\n };\n};\n"],"mappings":"2MAKA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAGH,IAAM,EAAe,GAAG,EAAW,aAqBnC,MAAO,CACL,UAfgB,MAChB,EACA,EAA+B,EAAE,GAEjC,MAAMC,EAAAA,QACJ,GAAG,EAAa,MAChB,EACA,EACA,CACE,OAAQ,MACA,SACT,CACF,CAIF"}
@@ -1,42 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/stripe.ts
8
- const getStripeAPI = (authAPIOptions = {}, intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
11
- const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;
12
- /**
13
- * Get a pricing plan calculated for a given promotion code.
14
- * @param body - Pricing plan body.
15
- */
16
- const getPricing = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${STRIPE_API_ROUTE}/pricing`, authAPIOptions, otherOptions, {
17
- method: "POST",
18
- body
19
- });
20
- /**
21
- * Retrieves a checkout session.
22
- * @param body - Checkout session body.
23
- */
24
- const getSubscription = async (body, otherOptions = {}) => await require_fetcher.fetcher(`${STRIPE_API_ROUTE}/create-subscription`, authAPIOptions, otherOptions, {
25
- method: "POST",
26
- body
27
- });
28
- /**
29
- * Cancels a subscription.
30
- * @param body - Checkout session body.
31
- */
32
- const cancelSubscription = async (otherOptions = {}) => await require_fetcher.fetcher(`${STRIPE_API_ROUTE}/cancel-subscription`, authAPIOptions, otherOptions, { method: "POST" });
33
- return {
34
- getPricing,
35
- getSubscription,
36
- cancelSubscription
37
- };
38
- };
39
-
40
- //#endregion
41
- exports.getStripeAPI = getStripeAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e={},r)=>{let i=r?.editor?.backendURL??n.default?.editor?.backendURL;if(!i)throw Error(`Backend URL is not defined in the Intlayer configuration.`);let a=`${i}/api/stripe`;return{getPricing:async(n,r={})=>await t.fetcher(`${a}/pricing`,e,r,{method:`POST`,body:n}),getSubscription:async(n,r={})=>await t.fetcher(`${a}/create-subscription`,e,r,{method:`POST`,body:n}),cancelSubscription:async(n={})=>await t.fetcher(`${a}/cancel-subscription`,e,n,{method:`POST`})}};exports.getStripeAPI=r;
42
2
  //# sourceMappingURL=stripe.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/stripe.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetPricingBody,\n GetPricingResult,\n} from '../types';\n\nexport const getStripeAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\n /**\n * Get a pricing plan calculated for a given promotion code.\n * @param body - Pricing plan body.\n */\n const getPricing = async (\n body?: GetPricingBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetPricingResult>(\n `${STRIPE_API_ROUTE}/pricing`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Cancels a subscription.\n * @param body - Checkout session body.\n */\n const cancelSubscription = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/cancel-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getPricing,\n getSubscription,\n cancelSubscription,\n };\n};\n"],"mappings":";;;;;;;AAUA,MAAa,gBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,gCAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,mBAAmB,GAAG,WAAW;;;;;CAMvC,MAAM,aAAa,OACjB,MACA,eAA+B,EAAE,KAEjC,MAAMC,wBACJ,GAAG,iBAAiB,WACpB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,MACA,eAA+B,EAAE,KAEjC,MAAMA,wBACJ,GAAG,iBAAiB,uBACpB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,qBAAqB,OAAO,eAA+B,EAAE,KACjE,MAAMA,wBACJ,GAAG,iBAAiB,uBACpB,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACD"}
1
+ {"version":3,"file":"stripe.cjs","names":["configuration","fetcher"],"sources":["../../../src/getIntlayerAPI/stripe.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { type FetcherOptions, fetcher } from '../fetcher';\nimport type {\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetPricingBody,\n GetPricingResult,\n} from '../types';\n\nexport const getStripeAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;\n\n if (!backendURL) {\n throw new Error(\n 'Backend URL is not defined in the Intlayer configuration.'\n );\n }\n\n const STRIPE_API_ROUTE = `${backendURL}/api/stripe`;\n\n /**\n * Get a pricing plan calculated for a given promotion code.\n * @param body - Pricing plan body.\n */\n const getPricing = async (\n body?: GetPricingBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetPricingResult>(\n `${STRIPE_API_ROUTE}/pricing`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Retrieves a checkout session.\n * @param body - Checkout session body.\n */\n const getSubscription = async (\n body?: GetCheckoutSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/create-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Cancels a subscription.\n * @param body - Checkout session body.\n */\n const cancelSubscription = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCheckoutSessionResult>(\n `${STRIPE_API_ROUTE}/cancel-subscription`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getPricing,\n getSubscription,\n cancelSubscription,\n };\n};\n"],"mappings":"2MAUA,MAAa,GACX,EAAiC,EAAE,CACnC,IACG,CACH,IAAM,EACJ,GAAgB,QAAQ,YAAcA,EAAAA,SAAe,QAAQ,WAE/D,GAAI,CAAC,EACH,MAAU,MACR,4DACD,CAGH,IAAM,EAAmB,GAAG,EAAW,aAoDvC,MAAO,CACL,WA/CiB,MACjB,EACA,EAA+B,EAAE,GAEjC,MAAMC,EAAAA,QACJ,GAAG,EAAiB,UACpB,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAoCD,gBA9BsB,MACtB,EACA,EAA+B,EAAE,GAEjC,MAAMA,EAAAA,QACJ,GAAG,EAAiB,sBACpB,EACA,EACA,CACE,OAAQ,OACR,OACD,CACF,CAmBD,mBAbyB,MAAO,EAA+B,EAAE,GACjE,MAAMA,EAAAA,QACJ,GAAG,EAAiB,sBACpB,EACA,EACA,CACE,OAAQ,OACT,CACF,CAMF"}
@@ -1,51 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_fetcher = require('../fetcher.cjs');
4
- let _intlayer_config_built = require("@intlayer/config/built");
5
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
6
-
7
- //#region src/getIntlayerAPI/tag.ts
8
- const getTagAPI = (authAPIOptions = {}, intlayerConfig) => {
9
- const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.default?.editor?.backendURL;
10
- if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
11
- const PROJECT_API_ROUTE = `${backendURL}/api/tag`;
12
- /**
13
- * Retrieves a list of tags based on filters and pagination.
14
- * @param filters - Filters and pagination options.
15
- */
16
- const getTags = async (filters, otherOptions = {}) => await require_fetcher.fetcher(PROJECT_API_ROUTE, authAPIOptions, otherOptions, {
17
- cache: "no-store",
18
- params: filters
19
- });
20
- /**
21
- * Adds a new tag to the database.
22
- * @param tag - Tag data.
23
- */
24
- const addTag = async (tag, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
25
- method: "POST",
26
- body: tag
27
- });
28
- /**
29
- * Updates an existing tag in the database.
30
- * @param tag - Updated tag data.
31
- */
32
- const updateTag = async (tagId, tag, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/${tagId}`, authAPIOptions, otherOptions, {
33
- method: "PUT",
34
- body: tag
35
- });
36
- /**
37
- * Deletes a tag from the database by its ID.
38
- * @param tagId - Tag ID.
39
- */
40
- const deleteTag = async (tagId, otherOptions = {}) => await require_fetcher.fetcher(`${PROJECT_API_ROUTE}/${tagId}`, authAPIOptions, otherOptions, { method: "DELETE" });
41
- return {
42
- getTags,
43
- addTag,
44
- updateTag,
45
- deleteTag
46
- };
47
- };
48
-
49
- //#endregion
50
- exports.getTagAPI = getTagAPI;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../fetcher.cjs`);let n=require(`@intlayer/config/built`);n=e.__toESM(n);const r=(e={},r)=>{let i=r?.editor?.backendURL??n.default?.editor?.backendURL;if(!i)throw Error(`Backend URL is not defined in the Intlayer configuration.`);let a=`${i}/api/tag`;return{getTags:async(n,r={})=>await t.fetcher(a,e,r,{cache:`no-store`,params:n}),addTag:async(n,r={})=>await t.fetcher(`${a}`,e,r,{method:`POST`,body:n}),updateTag:async(n,r,i={})=>await t.fetcher(`${a}/${n}`,e,i,{method:`PUT`,body:r}),deleteTag:async(n,r={})=>await t.fetcher(`${a}/${n}`,e,r,{method:`DELETE`})}};exports.getTagAPI=r;
51
2
  //# sourceMappingURL=tag.cjs.map