@intlayer/api 9.6.0 → 9.7.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.
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
- package/dist/cjs/fetcher.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/ai.cjs +76 -22
- package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/analytics.cjs +44 -10
- package/dist/cjs/getIntlayerAPI/analytics.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/asset.cjs +38 -8
- package/dist/cjs/getIntlayerAPI/asset.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/audit.cjs +70 -16
- package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/bitbucket.cjs +39 -9
- package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/codeberg.cjs +21 -0
- package/dist/cjs/getIntlayerAPI/codeberg.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/dictionary.cjs +59 -13
- package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/environment.cjs +44 -10
- package/dist/cjs/getIntlayerAPI/environment.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/forge.cjs +64 -0
- package/dist/cjs/getIntlayerAPI/forge.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/gitee.cjs +21 -0
- package/dist/cjs/getIntlayerAPI/gitee.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/github.cjs +44 -10
- package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/gitlab.cjs +39 -9
- package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/index.cjs +4 -0
- package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/newsletter.cjs +28 -6
- package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/oAuth.cjs +31 -5
- package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/organization.cjs +72 -20
- package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/project.cjs +112 -29
- package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/reviewer.cjs +142 -31
- package/dist/cjs/getIntlayerAPI/reviewer.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/search.cjs +15 -3
- package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/showcaseProject.cjs +61 -15
- package/dist/cjs/getIntlayerAPI/showcaseProject.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/status.cjs +16 -3
- package/dist/cjs/getIntlayerAPI/status.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/stripe.cjs +141 -35
- package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/tag.cjs +33 -7
- package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/translate.cjs +46 -8
- package/dist/cjs/getIntlayerAPI/translate.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/user.cjs +58 -14
- package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
- package/dist/cjs/index.cjs +8 -0
- package/dist/cjs/proxy.cjs +4 -0
- package/dist/cjs/proxy.cjs.map +1 -1
- package/dist/cjs/public/createPublicClient.cjs +25 -5
- package/dist/cjs/public/createPublicClient.cjs.map +1 -1
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
- package/dist/esm/fetcher.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/ai.mjs +76 -22
- package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/analytics.mjs +44 -10
- package/dist/esm/getIntlayerAPI/analytics.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/asset.mjs +38 -8
- package/dist/esm/getIntlayerAPI/asset.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/audit.mjs +70 -16
- package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/bitbucket.mjs +39 -9
- package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/codeberg.mjs +19 -0
- package/dist/esm/getIntlayerAPI/codeberg.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/dictionary.mjs +59 -13
- package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/environment.mjs +44 -10
- package/dist/esm/getIntlayerAPI/environment.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/forge.mjs +63 -0
- package/dist/esm/getIntlayerAPI/forge.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/gitee.mjs +19 -0
- package/dist/esm/getIntlayerAPI/gitee.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/github.mjs +44 -10
- package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/gitlab.mjs +39 -9
- package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/index.mjs +4 -0
- package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/newsletter.mjs +28 -6
- package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/oAuth.mjs +31 -5
- package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/organization.mjs +72 -20
- package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/project.mjs +112 -29
- package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/reviewer.mjs +142 -31
- package/dist/esm/getIntlayerAPI/reviewer.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/search.mjs +15 -3
- package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/showcaseProject.mjs +61 -15
- package/dist/esm/getIntlayerAPI/showcaseProject.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/status.mjs +16 -3
- package/dist/esm/getIntlayerAPI/status.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/stripe.mjs +141 -35
- package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/tag.mjs +33 -7
- package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/translate.mjs +46 -8
- package/dist/esm/getIntlayerAPI/translate.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/user.mjs +58 -14
- package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
- package/dist/esm/index.mjs +4 -1
- package/dist/esm/proxy.mjs +4 -0
- package/dist/esm/proxy.mjs.map +1 -1
- package/dist/esm/public/createPublicClient.mjs +25 -5
- package/dist/esm/public/createPublicClient.mjs.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +1 -1
- package/dist/types/fetcher.d.ts +1 -1
- package/dist/types/fetcher.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/ai.d.ts +1 -1
- package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/analytics.d.ts +1 -1
- package/dist/types/getIntlayerAPI/analytics.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/asset.d.ts +1 -0
- package/dist/types/getIntlayerAPI/asset.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/audit.d.ts +47 -3
- package/dist/types/getIntlayerAPI/audit.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/bitbucket.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/codeberg.d.ts +23 -0
- package/dist/types/getIntlayerAPI/codeberg.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/dictionary.d.ts +1 -1
- package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/editor.d.ts +2 -1
- package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/environment.d.ts +1 -1
- package/dist/types/getIntlayerAPI/environment.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/forge.d.ts +17 -0
- package/dist/types/getIntlayerAPI/forge.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/gitee.d.ts +23 -0
- package/dist/types/getIntlayerAPI/gitee.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/github.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/gitlab.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/index.d.ts +4 -0
- package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/newsletter.d.ts +1 -1
- package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/oAuth.d.ts +2 -0
- package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/organization.d.ts +1 -3
- package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/project.d.ts +2 -1
- package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/reviewer.d.ts +680 -35
- package/dist/types/getIntlayerAPI/reviewer.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/search.d.ts +1 -1
- package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/showcaseProject.d.ts +1 -1
- package/dist/types/getIntlayerAPI/showcaseProject.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/status.d.ts +3 -4
- package/dist/types/getIntlayerAPI/status.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/stripe.d.ts +1 -1
- package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/tag.d.ts +1 -1
- package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/translate.d.ts +1 -1
- package/dist/types/getIntlayerAPI/translate.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/user.d.ts +4 -4
- package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -4
- package/dist/types/proxy.d.ts.map +1 -1
- package/dist/types/public/createPublicClient.d.ts +1 -7
- package/dist/types/public/createPublicClient.d.ts.map +1 -1
- package/dist/types/types.d.ts +5 -2
- package/package.json +20 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oAuth.cjs","names":["editor","fetcher"],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n CreateCliSessionTokenResult,\n GetCliSessionMeResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n) => {\n const backendURL
|
|
1
|
+
{"version":3,"file":"oAuth.cjs","names":["editor","BACKEND_URL","fetcher","buildRouteURL"],"sources":["../../../src/getIntlayerAPI/oAuth.ts"],"sourcesContent":["import type {\n CliSessionTokenRoutes,\n CreateCliSessionTokenResult,\n cliSessionTokenContract,\n GetCliSessionMeResult,\n} from '@intlayer/backend-contract/cliSessionToken';\nimport type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n OAuth2Routes,\n oAuth2Contract,\n} from '@intlayer/backend-contract/oAuth2';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** OAuth2 routes, checked against the backend contract. */\nconst oAuth2Group = {\n prefix: '/oauth2',\n} as const satisfies Pick<typeof oAuth2Contract, 'prefix'>;\nconst oAuth2Endpoints = {\n getOAuth2AccessToken: { method: 'POST', path: '/token' },\n extendOAuth2Token: { method: 'POST', path: '/token/extend' },\n} as const satisfies RouteEndpoints<OAuth2Routes>;\n\n/** CLI session routes, checked against the backend contract. */\nconst cliSessionGroup = {\n prefix: '/api/cli-session',\n} as const satisfies Pick<typeof cliSessionTokenContract, 'prefix'>;\nconst cliSessionEndpoints = {\n createCliSessionToken: { method: 'POST', path: '/' },\n getCliSessionMe: { method: 'GET', path: '/me' },\n} as const satisfies RouteEndpoints<CliSessionTokenRoutes>;\n\nexport const getOAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: Pick<IntlayerConfig, 'editor'>\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n const { clientId, clientSecret } = intlayerConfig?.editor ?? {};\n\n /**\n * Gets an oAuth2 accessToken via client_credentials grant\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n buildRouteURL(\n backendURL,\n oAuth2Group,\n oAuth2Endpoints.getOAuth2AccessToken\n ),\n {},\n otherOptions,\n {\n method: oAuth2Endpoints.getOAuth2AccessToken.method,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n /**\n * Creates a short-lived (2h) CLI session token for the authenticated user.\n * Requires a valid browser session cookie.\n */\n const createCliSessionToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CreateCliSessionTokenResult>(\n buildRouteURL(\n backendURL,\n cliSessionGroup,\n cliSessionEndpoints.createCliSessionToken\n ),\n authAPIOptions,\n otherOptions,\n { method: cliSessionEndpoints.createCliSessionToken.method }\n );\n\n /**\n * Verifies a CLI session token and returns the associated project context.\n * Useful for checking config consistency in the CLI.\n */\n const getCliSessionMe = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetCliSessionMeResult>(\n buildRouteURL(\n backendURL,\n cliSessionGroup,\n cliSessionEndpoints.getCliSessionMe\n ),\n authAPIOptions,\n otherOptions,\n { method: cliSessionEndpoints.getCliSessionMe.method }\n );\n\n return {\n getOAuth2AccessToken,\n createCliSessionToken,\n getCliSessionMe,\n };\n};\n"],"mappings":";;;;;;;;AAoBA,MAAM,cAAc,EAClB,QAAQ,UACV;AACA,MAAM,kBAAkB;CACtB,sBAAsB;EAAE,QAAQ;EAAQ,MAAM;CAAS;CACvD,mBAAmB;EAAE,QAAQ;EAAQ,MAAM;CAAgB;AAC7D;;AAGA,MAAM,kBAAkB,EACtB,QAAQ,mBACV;AACA,MAAM,sBAAsB;CAC1B,uBAAuB;EAAE,QAAQ;EAAQ,MAAM;CAAI;CACnD,iBAAiB;EAAE,QAAQ;EAAO,MAAM;CAAM;AAChD;AAEA,MAAa,eACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAcA,8BAAO,cAAcC;CAC7D,MAAM,EAAE,UAAU,iBAAiB,gBAAgB,UAAU,CAAC;;;;CAK9D,MAAM,uBAAuB,OAAO,eAA+B,CAAC,MAClE,MAAMC,4BACJC,sDACE,YACA,aACA,gBAAgB,oBAClB,GACA,CAAC,GACD,cACA;EACE,QAAQ,gBAAgB,qBAAqB;EAC7C,SAAS,EACP,gBAAgB,oCAClB;EACA,MAAM;GACJ,YAAY;GACZ,WAAW;GACX,eAAe;EACjB;CACF,CACF;;;;;CAMF,MAAM,wBAAwB,OAAO,eAA+B,CAAC,MACnE,MAAMD,4BACJC,sDACE,YACA,iBACA,oBAAoB,qBACtB,GACA,gBACA,cACA,EAAE,QAAQ,oBAAoB,sBAAsB,OAAO,CAC7D;;;;;CAMF,MAAM,kBAAkB,OAAO,eAA+B,CAAC,MAC7D,MAAMD,4BACJC,sDACE,YACA,iBACA,oBAAoB,eACtB,GACA,gBACA,cACA,EAAE,QAAQ,oBAAoB,gBAAgB,OAAO,CACvD;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF"}
|
|
@@ -2,15 +2,69 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_fetcher = require('../fetcher.cjs');
|
|
3
3
|
const require_cms_createIntlayerCMS = require('../cms/createIntlayerCMS.cjs');
|
|
4
4
|
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
+
let _intlayer_backend_contract_defineRoute = require("@intlayer/backend-contract/defineRoute");
|
|
6
|
+
let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
|
|
5
7
|
|
|
6
8
|
//#region src/getIntlayerAPI/organization.ts
|
|
9
|
+
/** Prefix of the routes, checked against the backend contract. */
|
|
10
|
+
const organizationGroup = { prefix: "/api/organization" };
|
|
11
|
+
/**
|
|
12
|
+
* Method and path of every route, checked against the backend contract at
|
|
13
|
+
* compile time (the contract's zod schemas are never loaded).
|
|
14
|
+
*/
|
|
15
|
+
const organizationEndpoints = {
|
|
16
|
+
getOrganizations: {
|
|
17
|
+
method: "GET",
|
|
18
|
+
path: "/"
|
|
19
|
+
},
|
|
20
|
+
addOrganization: {
|
|
21
|
+
method: "POST",
|
|
22
|
+
path: "/"
|
|
23
|
+
},
|
|
24
|
+
updateOrganization: {
|
|
25
|
+
method: "PUT",
|
|
26
|
+
path: "/"
|
|
27
|
+
},
|
|
28
|
+
updateOrganizationMailerConfig: {
|
|
29
|
+
method: "PUT",
|
|
30
|
+
path: "/mailer-config"
|
|
31
|
+
},
|
|
32
|
+
updateOrganizationMembers: {
|
|
33
|
+
method: "PUT",
|
|
34
|
+
path: "/members"
|
|
35
|
+
},
|
|
36
|
+
updateOrganizationMembersById: {
|
|
37
|
+
method: "PUT",
|
|
38
|
+
path: "/:organizationId/members"
|
|
39
|
+
},
|
|
40
|
+
addOrganizationMember: {
|
|
41
|
+
method: "POST",
|
|
42
|
+
path: "/member"
|
|
43
|
+
},
|
|
44
|
+
deleteOrganization: {
|
|
45
|
+
method: "DELETE",
|
|
46
|
+
path: "/"
|
|
47
|
+
},
|
|
48
|
+
selectOrganization: {
|
|
49
|
+
method: "PUT",
|
|
50
|
+
path: "/:organizationId"
|
|
51
|
+
},
|
|
52
|
+
unselectOrganization: {
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/logout"
|
|
55
|
+
},
|
|
56
|
+
deleteOrganizationByIdAdmin: {
|
|
57
|
+
method: "DELETE",
|
|
58
|
+
path: "/:organizationId/admin"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
7
61
|
const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
8
|
-
const
|
|
62
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.editor.backendURL ?? _intlayer_config_defaultValues.BACKEND_URL;
|
|
9
63
|
/**
|
|
10
64
|
* Retrieves a list of organizations based on filters and pagination.
|
|
11
65
|
* @param filters - Filters and pagination options.
|
|
12
66
|
*/
|
|
13
|
-
const getOrganizations = async (filters, otherOptions = {}) => await require_fetcher.fetcher(
|
|
67
|
+
const getOrganizations = async (filters, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.getOrganizations), authAPIOptions, otherOptions, {
|
|
14
68
|
cache: "no-store",
|
|
15
69
|
params: filters
|
|
16
70
|
});
|
|
@@ -18,21 +72,20 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
18
72
|
* Retrieves an organization by its ID.
|
|
19
73
|
* @param organizationId - Organization ID.
|
|
20
74
|
*/
|
|
21
|
-
const getOrganization = async (organizationId, otherOptions = {}) => await require_fetcher.fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions);
|
|
22
75
|
/**
|
|
23
76
|
* Adds a new organization to the database.
|
|
24
77
|
* @param organization - Organization data.
|
|
25
78
|
*/
|
|
26
|
-
const addOrganization = async (organization, otherOptions = {}) => await require_fetcher.fetcher(
|
|
27
|
-
method:
|
|
79
|
+
const addOrganization = async (organization, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.addOrganization), authAPIOptions, otherOptions, {
|
|
80
|
+
method: organizationEndpoints.addOrganization.method,
|
|
28
81
|
body: organization
|
|
29
82
|
});
|
|
30
83
|
/**
|
|
31
84
|
* Updates an existing organization in the database.
|
|
32
85
|
* @param organization - Updated organization data.
|
|
33
86
|
*/
|
|
34
|
-
const updateOrganization = async (organization, otherOptions = {}) => require_fetcher.fetcher(
|
|
35
|
-
method:
|
|
87
|
+
const updateOrganization = async (organization, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.updateOrganization), authAPIOptions, otherOptions, {
|
|
88
|
+
method: organizationEndpoints.updateOrganization.method,
|
|
36
89
|
body: organization
|
|
37
90
|
});
|
|
38
91
|
/**
|
|
@@ -40,16 +93,16 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
40
93
|
* @param body - Mailer configuration. Secrets are optional; omit to keep the
|
|
41
94
|
* value already stored.
|
|
42
95
|
*/
|
|
43
|
-
const updateOrganizationMailerConfig = async (body, otherOptions = {}) => require_fetcher.fetcher(
|
|
44
|
-
method:
|
|
96
|
+
const updateOrganizationMailerConfig = async (body, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.updateOrganizationMailerConfig), authAPIOptions, otherOptions, {
|
|
97
|
+
method: organizationEndpoints.updateOrganizationMailerConfig.method,
|
|
45
98
|
body
|
|
46
99
|
});
|
|
47
100
|
/**
|
|
48
101
|
* Update members to the organization in the database.
|
|
49
102
|
* @param body - Updated organization members data.
|
|
50
103
|
*/
|
|
51
|
-
const updateOrganizationMembers = async (body, otherOptions = {}) => require_fetcher.fetcher(
|
|
52
|
-
method:
|
|
104
|
+
const updateOrganizationMembers = async (body, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.updateOrganizationMembers), authAPIOptions, otherOptions, {
|
|
105
|
+
method: organizationEndpoints.updateOrganizationMembers.method,
|
|
53
106
|
body
|
|
54
107
|
});
|
|
55
108
|
/**
|
|
@@ -57,41 +110,40 @@ const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
57
110
|
* @param organizationId - Organization ID
|
|
58
111
|
* @param body - Updated organization members data.
|
|
59
112
|
*/
|
|
60
|
-
const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => require_fetcher.fetcher(
|
|
61
|
-
method:
|
|
113
|
+
const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.updateOrganizationMembersById, { organizationId: String(organizationId) }), authAPIOptions, otherOptions, {
|
|
114
|
+
method: organizationEndpoints.updateOrganizationMembersById.method,
|
|
62
115
|
body
|
|
63
116
|
});
|
|
64
117
|
/**
|
|
65
118
|
* Add member to the organization in the database.
|
|
66
119
|
* @param body - Updated organization members data.
|
|
67
120
|
*/
|
|
68
|
-
const addOrganizationMember = async (body, otherOptions = {}) => require_fetcher.fetcher(
|
|
69
|
-
method:
|
|
121
|
+
const addOrganizationMember = async (body, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.addOrganizationMember), authAPIOptions, otherOptions, {
|
|
122
|
+
method: organizationEndpoints.addOrganizationMember.method,
|
|
70
123
|
body
|
|
71
124
|
});
|
|
72
125
|
/**
|
|
73
126
|
* Deletes an organization from the database by its ID.
|
|
74
127
|
* @param organizationId - Organization ID.
|
|
75
128
|
*/
|
|
76
|
-
const deleteOrganization = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
129
|
+
const deleteOrganization = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.deleteOrganization), authAPIOptions, otherOptions, { method: organizationEndpoints.deleteOrganization.method });
|
|
77
130
|
/**
|
|
78
131
|
* Admin-only: Deletes any organization from the database by its ID.
|
|
79
132
|
* @param organizationId - Organization ID.
|
|
80
133
|
*/
|
|
81
|
-
const deleteOrganizationByIdAdmin = async (organizationId, otherOptions = {}) => require_fetcher.fetcher(
|
|
134
|
+
const deleteOrganizationByIdAdmin = async (organizationId, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.deleteOrganizationByIdAdmin, { organizationId: String(organizationId) }), authAPIOptions, otherOptions, { method: organizationEndpoints.deleteOrganizationByIdAdmin.method });
|
|
82
135
|
/**
|
|
83
136
|
* Select an organization from the database by its ID.
|
|
84
137
|
* @param organizationId - Organization ID.
|
|
85
138
|
*/
|
|
86
|
-
const selectOrganization = async (organizationId, otherOptions = {}) => await require_fetcher.fetcher(
|
|
139
|
+
const selectOrganization = async (organizationId, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.selectOrganization, { organizationId: String(organizationId) }), authAPIOptions, otherOptions, { method: organizationEndpoints.selectOrganization.method });
|
|
87
140
|
/**
|
|
88
141
|
* Unselect an organization from the database by its ID.
|
|
89
142
|
* @param organizationId - Organization ID.
|
|
90
143
|
*/
|
|
91
|
-
const unselectOrganization = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
144
|
+
const unselectOrganization = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, organizationGroup, organizationEndpoints.unselectOrganization), authAPIOptions, otherOptions, { method: organizationEndpoints.unselectOrganization.method });
|
|
92
145
|
return {
|
|
93
146
|
getOrganizations,
|
|
94
|
-
getOrganization,
|
|
95
147
|
addOrganization,
|
|
96
148
|
addOrganizationMember,
|
|
97
149
|
updateOrganization,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.cjs","names":["editor","fetcher","createEndpoint"],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMailerConfigBody,\n UpdateOrganizationMailerConfigResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\n const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n const getOrganization = async (\n organizationId: GetOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: organization,\n }\n );\n\n /**\n * Updates the per-organization transactional mailer configuration.\n * @param body - Mailer configuration. Secrets are optional; omit to keep the\n * value already stored.\n */\n const updateOrganizationMailerConfig = async (\n body: UpdateOrganizationMailerConfigBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMailerConfigResult>(\n `${ORGANIZATION_API_ROUTE}/mailer-config`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/members`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n `${ORGANIZATION_API_ROUTE}/member`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n ORGANIZATION_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n /**\n * Admin-only: Deletes any organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganizationByIdAdmin = async (\n organizationId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${organizationId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/${String(organizationId)}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n `${ORGANIZATION_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n return {\n getOrganizations,\n getOrganization,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMailerConfig,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n deleteOrganizationByIdAdmin,\n selectOrganization,\n unselectOrganization,\n };\n};\n\n/**\n * Authenticated `organization` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const organizationEndpoint = createEndpoint(getOrganizationAPI);\n"],"mappings":";;;;;;AAyBA,MAAa,sBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,yBAAyB,GAFZ,gBAAgB,QAAQ,cAAcA,8BAAO,WAEnB;;;;;CAM7C,MAAM,mBAAmB,OACvB,SACA,eAA+B,CAAC,MAEhC,MAAMC,wBACJ,wBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;;CAMF,MAAM,kBAAkB,OACtB,gBACA,eAA+B,CAAC,MAEhC,MAAMA,wBACJ,GAAG,uBAAuB,GAAG,OAAO,cAAc,KAClD,gBACA,YACF;;;;;CAMF,MAAM,kBAAkB,OACtB,cACA,eAA+B,CAAC,MAEhC,MAAMA,wBACJ,wBACA,gBACA,cACA;EACE,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F;;;;;;;AAQA,MAAa,uBAAuBC,6CAAe,kBAAkB"}
|
|
1
|
+
{"version":3,"file":"organization.cjs","names":["editor","BACKEND_URL","fetcher","buildRouteURL","createEndpoint"],"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n DeleteOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n OrganizationRoutes,\n organizationContract,\n SelectOrganizationParam,\n SelectOrganizationResult,\n UnselectOrganizationResult,\n UpdateOrganizationBody,\n UpdateOrganizationMailerConfigBody,\n UpdateOrganizationMailerConfigResult,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n} from '@intlayer/backend-contract/organization';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** Prefix of the routes, checked against the backend contract. */\nconst organizationGroup = {\n prefix: '/api/organization',\n} as const satisfies Pick<typeof organizationContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst organizationEndpoints = {\n getOrganizations: { method: 'GET', path: '/' },\n addOrganization: { method: 'POST', path: '/' },\n updateOrganization: { method: 'PUT', path: '/' },\n updateOrganizationMailerConfig: { method: 'PUT', path: '/mailer-config' },\n updateOrganizationMembers: { method: 'PUT', path: '/members' },\n updateOrganizationMembersById: {\n method: 'PUT',\n path: '/:organizationId/members',\n },\n addOrganizationMember: { method: 'POST', path: '/member' },\n deleteOrganization: { method: 'DELETE', path: '/' },\n selectOrganization: { method: 'PUT', path: '/:organizationId' },\n unselectOrganization: { method: 'POST', path: '/logout' },\n deleteOrganizationByIdAdmin: {\n method: 'DELETE',\n path: '/:organizationId/admin',\n },\n} as const satisfies RouteEndpoints<OrganizationRoutes>;\n\nexport const getOrganizationAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Retrieves a list of organizations based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getOrganizations = async (\n filters?: GetOrganizationsParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetOrganizationsResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.getOrganizations\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves an organization by its ID.\n * @param organizationId - Organization ID.\n */\n /**\n * Adds a new organization to the database.\n * @param organization - Organization data.\n */\n const addOrganization = async (\n organization: AddOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.addOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.addOrganization.method,\n body: organization,\n }\n );\n\n /**\n * Updates an existing organization in the database.\n * @param organization - Updated organization data.\n */\n const updateOrganization = async (\n organization: UpdateOrganizationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganization.method,\n body: organization,\n }\n );\n\n /**\n * Updates the per-organization transactional mailer configuration.\n * @param body - Mailer configuration. Secrets are optional; omit to keep the\n * value already stored.\n */\n const updateOrganizationMailerConfig = async (\n body: UpdateOrganizationMailerConfigBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMailerConfigResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganizationMailerConfig\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganizationMailerConfig.method,\n body,\n }\n );\n\n /**\n * Update members to the organization in the database.\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembers = async (\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganizationMembers\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganizationMembers.method,\n body,\n }\n );\n\n /**\n * Admin-only: Update members of any organization by ID\n * @param organizationId - Organization ID\n * @param body - Updated organization members data.\n */\n const updateOrganizationMembersById = async (\n organizationId: string,\n body: UpdateOrganizationMembersBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<UpdateOrganizationMembersResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.updateOrganizationMembersById,\n { organizationId: String(organizationId) }\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.updateOrganizationMembersById.method,\n body,\n }\n );\n\n /**\n * Add member to the organization in the database.\n * @param body - Updated organization members data.\n */\n const addOrganizationMember = async (\n body: AddOrganizationMemberBody,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<AddOrganizationMemberResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.addOrganizationMember\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.addOrganizationMember.method,\n body,\n }\n );\n\n /**\n * Deletes an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<DeleteOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.deleteOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.deleteOrganization.method,\n }\n );\n\n /**\n * Admin-only: Deletes any organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const deleteOrganizationByIdAdmin = async (\n organizationId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.deleteOrganizationByIdAdmin,\n { organizationId: String(organizationId) }\n ),\n authAPIOptions,\n otherOptions,\n { method: organizationEndpoints.deleteOrganizationByIdAdmin.method }\n );\n\n /**\n * Select an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const selectOrganization = async (\n organizationId: SelectOrganizationParam['organizationId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.selectOrganization,\n { organizationId: String(organizationId) }\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.selectOrganization.method,\n }\n );\n\n /**\n * Unselect an organization from the database by its ID.\n * @param organizationId - Organization ID.\n */\n const unselectOrganization = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<UnselectOrganizationResult>(\n buildRouteURL(\n backendURL,\n organizationGroup,\n organizationEndpoints.unselectOrganization\n ),\n authAPIOptions,\n otherOptions,\n {\n method: organizationEndpoints.unselectOrganization.method,\n }\n );\n\n return {\n getOrganizations,\n addOrganization,\n addOrganizationMember,\n updateOrganization,\n updateOrganizationMailerConfig,\n updateOrganizationMembers,\n updateOrganizationMembersById,\n deleteOrganization,\n deleteOrganizationByIdAdmin,\n selectOrganization,\n unselectOrganization,\n };\n};\n\n/**\n * Authenticated `organization` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const organizationEndpoint = createEndpoint(getOrganizationAPI);\n"],"mappings":";;;;;;;;;AA6BA,M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ACE,YACA,mBACA,sBAAsB,oBACxB,GACA,gBACA,cACA,EACE,QAAQ,sBAAsB,qBAAqB,OACrD,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,uBAAuBC,6CAAe,kBAAkB"}
|
|
@@ -2,16 +2,99 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_fetcher = require('../fetcher.cjs');
|
|
3
3
|
const require_cms_createIntlayerCMS = require('../cms/createIntlayerCMS.cjs');
|
|
4
4
|
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
|
+
let _intlayer_backend_contract_defineRoute = require("@intlayer/backend-contract/defineRoute");
|
|
6
|
+
let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
|
|
5
7
|
|
|
6
8
|
//#region src/getIntlayerAPI/project.ts
|
|
9
|
+
/** Prefix of the project routes, checked against the backend contract. */
|
|
10
|
+
const projectGroup = { prefix: "/api/project" };
|
|
11
|
+
/**
|
|
12
|
+
* Method and path of every project route, checked against the backend
|
|
13
|
+
* contract at compile time (the contract's zod schemas are never loaded).
|
|
14
|
+
*/
|
|
15
|
+
const projectEndpoints = {
|
|
16
|
+
getProjects: {
|
|
17
|
+
method: "GET",
|
|
18
|
+
path: "/"
|
|
19
|
+
},
|
|
20
|
+
getProjectInsights: {
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: "/insights"
|
|
23
|
+
},
|
|
24
|
+
addProject: {
|
|
25
|
+
method: "POST",
|
|
26
|
+
path: "/"
|
|
27
|
+
},
|
|
28
|
+
updateProject: {
|
|
29
|
+
method: "PUT",
|
|
30
|
+
path: "/"
|
|
31
|
+
},
|
|
32
|
+
updateProjectMembers: {
|
|
33
|
+
method: "PUT",
|
|
34
|
+
path: "/members"
|
|
35
|
+
},
|
|
36
|
+
pushProjectConfiguration: {
|
|
37
|
+
method: "PUT",
|
|
38
|
+
path: "/configuration"
|
|
39
|
+
},
|
|
40
|
+
deleteProject: {
|
|
41
|
+
method: "DELETE",
|
|
42
|
+
path: "/"
|
|
43
|
+
},
|
|
44
|
+
selectProject: {
|
|
45
|
+
method: "PUT",
|
|
46
|
+
path: "/:projectId"
|
|
47
|
+
},
|
|
48
|
+
unselectProject: {
|
|
49
|
+
method: "POST",
|
|
50
|
+
path: "/logout"
|
|
51
|
+
},
|
|
52
|
+
addNewAccessKey: {
|
|
53
|
+
method: "POST",
|
|
54
|
+
path: "/access_key"
|
|
55
|
+
},
|
|
56
|
+
refreshAccessKey: {
|
|
57
|
+
method: "PATCH",
|
|
58
|
+
path: "/access_key"
|
|
59
|
+
},
|
|
60
|
+
deleteAccessKey: {
|
|
61
|
+
method: "DELETE",
|
|
62
|
+
path: "/access_key"
|
|
63
|
+
},
|
|
64
|
+
triggerBuild: {
|
|
65
|
+
method: "POST",
|
|
66
|
+
path: "/build"
|
|
67
|
+
},
|
|
68
|
+
triggerWebhook: {
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: "/webhook"
|
|
71
|
+
},
|
|
72
|
+
getCIConfiguration: {
|
|
73
|
+
method: "GET",
|
|
74
|
+
path: "/ci"
|
|
75
|
+
},
|
|
76
|
+
pushCIConfiguration: {
|
|
77
|
+
method: "POST",
|
|
78
|
+
path: "/ci"
|
|
79
|
+
},
|
|
80
|
+
deleteProjectByIdAdmin: {
|
|
81
|
+
method: "DELETE",
|
|
82
|
+
path: "/:projectId/admin"
|
|
83
|
+
},
|
|
84
|
+
updateMemberAccess: {
|
|
85
|
+
method: "PUT",
|
|
86
|
+
path: "/member/:userId/access"
|
|
87
|
+
}
|
|
88
|
+
};
|
|
7
89
|
const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
8
|
-
const
|
|
90
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? _intlayer_config_built.editor.backendURL ?? _intlayer_config_defaultValues.BACKEND_URL;
|
|
9
91
|
/**
|
|
10
92
|
* Retrieves a list of projects based on filters and pagination.
|
|
11
93
|
* @param filters - Filters and pagination options.
|
|
12
94
|
*/
|
|
13
|
-
const getProjects = async (filters, otherOptions = {}) => await require_fetcher.fetcher(
|
|
95
|
+
const getProjects = async (filters, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.getProjects), authAPIOptions, otherOptions, {
|
|
14
96
|
cache: "no-store",
|
|
97
|
+
method: projectEndpoints.getProjects.method,
|
|
15
98
|
params: filters
|
|
16
99
|
});
|
|
17
100
|
/**
|
|
@@ -19,69 +102,69 @@ const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
19
102
|
* project (locale/key counts, per-locale completion, missing translations,
|
|
20
103
|
* recent activity, team/config status).
|
|
21
104
|
*/
|
|
22
|
-
const getProjectInsights = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
105
|
+
const getProjectInsights = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.getProjectInsights), authAPIOptions, otherOptions, {
|
|
23
106
|
cache: "no-store",
|
|
24
|
-
method:
|
|
107
|
+
method: projectEndpoints.getProjectInsights.method
|
|
25
108
|
});
|
|
26
109
|
/**
|
|
27
110
|
* Adds a new project to the database.
|
|
28
111
|
* @param project - Project data.
|
|
29
112
|
*/
|
|
30
|
-
const addProject = async (project, otherOptions = {}) => await require_fetcher.fetcher(
|
|
31
|
-
method:
|
|
113
|
+
const addProject = async (project, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.addProject), authAPIOptions, otherOptions, {
|
|
114
|
+
method: projectEndpoints.addProject.method,
|
|
32
115
|
body: project
|
|
33
116
|
});
|
|
34
117
|
/**
|
|
35
118
|
* Updates an existing project in the database.
|
|
36
119
|
* @param project - Updated project data.
|
|
37
120
|
*/
|
|
38
|
-
const updateProject = async (project, otherOptions = {}) => await require_fetcher.fetcher(
|
|
39
|
-
method:
|
|
121
|
+
const updateProject = async (project, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.updateProject), authAPIOptions, otherOptions, {
|
|
122
|
+
method: projectEndpoints.updateProject.method,
|
|
40
123
|
body: project
|
|
41
124
|
});
|
|
42
125
|
/**
|
|
43
126
|
* Updates project members in the database.
|
|
44
127
|
* @param project - Updated project data.
|
|
45
128
|
*/
|
|
46
|
-
const updateProjectMembers = async (body, otherOptions = {}) => await require_fetcher.fetcher(
|
|
47
|
-
method:
|
|
129
|
+
const updateProjectMembers = async (body, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.updateProjectMembers), authAPIOptions, otherOptions, {
|
|
130
|
+
method: projectEndpoints.updateProjectMembers.method,
|
|
48
131
|
body
|
|
49
132
|
});
|
|
50
133
|
/** Pushes a project configuration to the database.
|
|
51
134
|
* @param projectConfiguration - Project configuration data.
|
|
52
135
|
*/
|
|
53
|
-
const pushProjectConfiguration = async (projectConfiguration, otherOptions = {}) => await require_fetcher.fetcher(
|
|
54
|
-
method:
|
|
136
|
+
const pushProjectConfiguration = async (projectConfiguration, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.pushProjectConfiguration), authAPIOptions, otherOptions, {
|
|
137
|
+
method: projectEndpoints.pushProjectConfiguration.method,
|
|
55
138
|
body: projectConfiguration
|
|
56
139
|
});
|
|
57
140
|
/**
|
|
58
141
|
* Deletes a project from the database by its ID.
|
|
59
142
|
* @param id - Project ID.
|
|
60
143
|
*/
|
|
61
|
-
const deleteProject = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
144
|
+
const deleteProject = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.deleteProject), authAPIOptions, otherOptions, { method: projectEndpoints.deleteProject.method });
|
|
62
145
|
/**
|
|
63
146
|
* Admin-only: Deletes any project from the database by its ID.
|
|
64
147
|
* @param projectId - Project ID.
|
|
65
148
|
*/
|
|
66
|
-
const deleteProjectByIdAdmin = async (projectId, otherOptions = {}) => require_fetcher.fetcher(
|
|
149
|
+
const deleteProjectByIdAdmin = async (projectId, otherOptions = {}) => require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.deleteProjectByIdAdmin, { projectId }), authAPIOptions, otherOptions, { method: projectEndpoints.deleteProjectByIdAdmin.method });
|
|
67
150
|
/**
|
|
68
151
|
* Select a project from the database by its ID.
|
|
69
152
|
* @param projectId - Organization ID.
|
|
70
153
|
*/
|
|
71
|
-
const selectProject = async (projectId, otherOptions = {}) => await require_fetcher.fetcher(
|
|
154
|
+
const selectProject = async (projectId, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.selectProject, { projectId: String(projectId) }), authAPIOptions, otherOptions, { method: projectEndpoints.selectProject.method });
|
|
72
155
|
/**
|
|
73
156
|
* Unselect a project from the database by its ID.
|
|
74
157
|
* @param projectId - Project ID.
|
|
75
158
|
*/
|
|
76
|
-
const unselectProject = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
159
|
+
const unselectProject = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.unselectProject), authAPIOptions, otherOptions, { method: projectEndpoints.unselectProject.method });
|
|
77
160
|
/**
|
|
78
161
|
* Add a new access key to a project.
|
|
79
162
|
* @param accessKey - Access key data.
|
|
80
163
|
* @param otherOptions - Fetcher options.
|
|
81
164
|
* @returns The new access key.
|
|
82
165
|
*/
|
|
83
|
-
const addNewAccessKey = async (accessKey, otherOptions = {}) => await require_fetcher.fetcher(
|
|
84
|
-
method:
|
|
166
|
+
const addNewAccessKey = async (accessKey, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.addNewAccessKey), authAPIOptions, otherOptions, {
|
|
167
|
+
method: projectEndpoints.addNewAccessKey.method,
|
|
85
168
|
body: accessKey
|
|
86
169
|
});
|
|
87
170
|
/**
|
|
@@ -90,8 +173,8 @@ const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
90
173
|
* @param otherOptions - Fetcher options.
|
|
91
174
|
* @returns The deleted project.
|
|
92
175
|
*/
|
|
93
|
-
const deleteAccessKey = async (clientId, otherOptions = {}) => await require_fetcher.fetcher(
|
|
94
|
-
method:
|
|
176
|
+
const deleteAccessKey = async (clientId, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.deleteAccessKey), authAPIOptions, otherOptions, {
|
|
177
|
+
method: projectEndpoints.deleteAccessKey.method,
|
|
95
178
|
body: { clientId }
|
|
96
179
|
});
|
|
97
180
|
/**
|
|
@@ -100,8 +183,8 @@ const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
100
183
|
* @param projectId - The ID of the project to refresh the access key from.
|
|
101
184
|
* @returns The new access key.
|
|
102
185
|
*/
|
|
103
|
-
const refreshAccessKey = async (clientId, otherOptions = {}) => await require_fetcher.fetcher(
|
|
104
|
-
method:
|
|
186
|
+
const refreshAccessKey = async (clientId, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.refreshAccessKey), authAPIOptions, otherOptions, {
|
|
187
|
+
method: projectEndpoints.refreshAccessKey.method,
|
|
105
188
|
body: { clientId }
|
|
106
189
|
});
|
|
107
190
|
/**
|
|
@@ -109,15 +192,15 @@ const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
109
192
|
* @param otherOptions - Fetcher options.
|
|
110
193
|
* @returns The trigger results.
|
|
111
194
|
*/
|
|
112
|
-
const triggerBuild = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
195
|
+
const triggerBuild = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.triggerBuild), authAPIOptions, otherOptions, { method: projectEndpoints.triggerBuild.method });
|
|
113
196
|
/**
|
|
114
197
|
* Triggers a single webhook by index.
|
|
115
198
|
* @param webhookIndex - The index of the webhook to trigger.
|
|
116
199
|
* @param otherOptions - Fetcher options.
|
|
117
200
|
* @returns The trigger result.
|
|
118
201
|
*/
|
|
119
|
-
const triggerWebhook = async (webhookIndex, otherOptions = {}) => await require_fetcher.fetcher(
|
|
120
|
-
method:
|
|
202
|
+
const triggerWebhook = async (webhookIndex, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.triggerWebhook), authAPIOptions, otherOptions, {
|
|
203
|
+
method: projectEndpoints.triggerWebhook.method,
|
|
121
204
|
body: { webhookIndex }
|
|
122
205
|
});
|
|
123
206
|
/**
|
|
@@ -125,20 +208,20 @@ const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
125
208
|
* @param otherOptions - Fetcher options.
|
|
126
209
|
* @returns The CI configuration status.
|
|
127
210
|
*/
|
|
128
|
-
const getCIConfig = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
211
|
+
const getCIConfig = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.getCIConfiguration), authAPIOptions, otherOptions, { method: projectEndpoints.getCIConfiguration.method });
|
|
129
212
|
/**
|
|
130
213
|
* Push CI configuration file to the repository.
|
|
131
214
|
* @param otherOptions - Fetcher options.
|
|
132
215
|
* @returns Success status.
|
|
133
216
|
*/
|
|
134
|
-
const pushCIConfig = async (otherOptions = {}) => await require_fetcher.fetcher(
|
|
217
|
+
const pushCIConfig = async (otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.pushCIConfiguration), authAPIOptions, otherOptions, { method: projectEndpoints.pushCIConfiguration.method });
|
|
135
218
|
/**
|
|
136
219
|
* Updates granular access constraints for a project member.
|
|
137
220
|
* @param userId - The user ID to update access for.
|
|
138
221
|
* @param body - The new access constraints.
|
|
139
222
|
*/
|
|
140
|
-
const updateMemberAccess = async (userId, body, otherOptions = {}) => await require_fetcher.fetcher(
|
|
141
|
-
method:
|
|
223
|
+
const updateMemberAccess = async (userId, body, otherOptions = {}) => await require_fetcher.fetcher((0, _intlayer_backend_contract_defineRoute.buildRouteURL)(backendURL, projectGroup, projectEndpoints.updateMemberAccess, { userId }), authAPIOptions, otherOptions, {
|
|
224
|
+
method: projectEndpoints.updateMemberAccess.method,
|
|
142
225
|
body
|
|
143
226
|
});
|
|
144
227
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.cjs","names":["editor","fetcher","createEndpoint"],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectInsightsResult,\n GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n ResponseData,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateMemberAccessBody,\n UpdateMemberAccessResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\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 * Retrieves aggregated localization insights for the currently selected\n * project (locale/key counts, per-locale completion, missing translations,\n * recent activity, team/config status).\n */\n const getProjectInsights = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetProjectInsightsResult>(\n `${PROJECT_API_ROUTE}/insights`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n method: 'GET',\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 * Admin-only: Deletes any project from the database by its ID.\n * @param projectId - Project ID.\n */\n const deleteProjectByIdAdmin = async (\n projectId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteProjectResult>(\n `${PROJECT_API_ROUTE}/${projectId}/admin`,\n authAPIOptions,\n otherOptions,\n { method: 'DELETE' }\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<ResponseData<any>>(\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<ResponseData<any>>(\n `${PROJECT_API_ROUTE}/ci`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Updates granular access constraints for a project member.\n * @param userId - The user ID to update access for.\n * @param body - The new access constraints.\n */\n const updateMemberAccess = async (\n userId: string,\n body: UpdateMemberAccessBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateMemberAccessResult>(\n `${PROJECT_API_ROUTE}/member/${userId}/access`,\n authAPIOptions,\n otherOptions,\n { method: 'PUT', body }\n );\n\n return {\n getProjects,\n getProjectInsights,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n deleteProjectByIdAdmin,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n updateMemberAccess,\n };\n};\n\n/**\n * Authenticated `project` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const projectEndpoint = createEndpoint(getProjectAPI);\n"],"mappings":";;;;;;AAkCA,MAAa,iBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAcA,8BAAO,WAExB;;;;;CAMxC,MAAM,cAAc,OAClB,SACA,eAA+B,CAAC,MAEhC,MAAMC,wBACJ,mBACA,gBACA,cACA;EACE,O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MAEhC,MAAMA,wBACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;;;CAQF,MAAM,kBAAkB,OACtB,UACA,eAA+B,CAAC,MAEhC,MAAMA,wBACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,SAAS;CACnB,CACF;;;;;;;CAQF,MAAM,mBAAmB,OACvB,UACA,eAA+B,CAAC,MAEhC,MAAMA,wBACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,SAAS;CACnB,CACF;;;;;;CAOF,MAAM,eAAe,OAAO,eAA+B,CAAC,MAC1D,MAAMA,wBACJ,GAAG,kBAAkB,SACrB,gBACA,cACA,EACE,QAAQ,OACV,CACF;;;;;;;CAQF,MAAM,iBAAiB,OACrB,cACA,eAA+B,CAAC,MAEhC,MAAMA,wBACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,aAAa;CACvB,CACF;;;;;;CAOF,MAAM,cAAc,OAAO,eAA+B,CAAC,MACzD,MAAMA,wBACJ,GAAG,kBAAkB,MACrB,gBACA,cACA,EACE,QAAQ,MACV,CACF;;;;;;CAOF,MAAM,eAAe,OAAO,eAA+B,CAAC,MAC1D,MAAMA,wBACJ,GAAG,kBAAkB,MACrB,gBACA,cACA,EACE,QAAQ,OACV,CACF;;;;;;CAOF,MAAM,qBAAqB,OACzB,QACA,MACA,eAA+B,CAAC,MAEhC,MAAMA,wBACJ,GAAG,kBAAkB,UAAU,OAAO,UACtC,gBACA,cACA;EAAE,QAAQ;EAAO;CAAK,CACxB;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,kBAAkBC,6CAAe,aAAa"}
|
|
1
|
+
{"version":3,"file":"project.cjs","names":["editor","BACKEND_URL","fetcher","buildRouteURL","createEndpoint"],"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddProjectBody,\n AddProjectResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteProjectResult,\n GetProjectInsightsResult,\n GetProjectsParams,\n GetProjectsResult,\n ProjectRoutes,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n projectContract,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n SelectProjectParam,\n SelectProjectResult,\n TriggerBuildResult,\n TriggerWebhookBody,\n TriggerWebhookResult,\n UnselectProjectResult,\n UpdateMemberAccessBody,\n UpdateMemberAccessResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n} from '@intlayer/backend-contract/project';\nimport type { ResponseData } from '@intlayer/backend-contract/responseData';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** Prefix of the project routes, checked against the backend contract. */\nconst projectGroup = {\n prefix: '/api/project',\n} as const satisfies Pick<typeof projectContract, 'prefix'>;\n\n/**\n * Method and path of every project route, checked against the backend\n * contract at compile time (the contract's zod schemas are never loaded).\n */\nconst projectEndpoints = {\n getProjects: { method: 'GET', path: '/' },\n getProjectInsights: { method: 'GET', path: '/insights' },\n addProject: { method: 'POST', path: '/' },\n updateProject: { method: 'PUT', path: '/' },\n updateProjectMembers: { method: 'PUT', path: '/members' },\n pushProjectConfiguration: { method: 'PUT', path: '/configuration' },\n deleteProject: { method: 'DELETE', path: '/' },\n selectProject: { method: 'PUT', path: '/:projectId' },\n unselectProject: { method: 'POST', path: '/logout' },\n addNewAccessKey: { method: 'POST', path: '/access_key' },\n refreshAccessKey: { method: 'PATCH', path: '/access_key' },\n deleteAccessKey: { method: 'DELETE', path: '/access_key' },\n triggerBuild: { method: 'POST', path: '/build' },\n triggerWebhook: { method: 'POST', path: '/webhook' },\n getCIConfiguration: { method: 'GET', path: '/ci' },\n pushCIConfiguration: { method: 'POST', path: '/ci' },\n deleteProjectByIdAdmin: { method: 'DELETE', path: '/:projectId/admin' },\n updateMemberAccess: { method: 'PUT', path: '/member/:userId/access' },\n} as const satisfies RouteEndpoints<ProjectRoutes>;\n\nexport const getProjectAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Retrieves a list of 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 buildRouteURL(backendURL, projectGroup, projectEndpoints.getProjects),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n method: projectEndpoints.getProjects.method,\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves aggregated localization insights for the currently selected\n * project (locale/key counts, per-locale completion, missing translations,\n * recent activity, team/config status).\n */\n const getProjectInsights = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetProjectInsightsResult>(\n buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.getProjectInsights\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n method: projectEndpoints.getProjectInsights.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.addProject),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.addProject.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.updateProject),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.updateProject.method,\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 buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.updateProjectMembers\n ),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.updateProjectMembers.method,\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 buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.pushProjectConfiguration\n ),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.pushProjectConfiguration.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.deleteProject),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.deleteProject.method,\n }\n );\n\n /**\n * Admin-only: Deletes any project from the database by its ID.\n * @param projectId - Project ID.\n */\n const deleteProjectByIdAdmin = async (\n projectId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n fetcher<DeleteProjectResult>(\n buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.deleteProjectByIdAdmin,\n { projectId }\n ),\n authAPIOptions,\n otherOptions,\n { method: projectEndpoints.deleteProjectByIdAdmin.method }\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.selectProject, {\n projectId: String(projectId),\n }),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.selectProject.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.unselectProject),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.unselectProject.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.addNewAccessKey),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.addNewAccessKey.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.deleteAccessKey),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.deleteAccessKey.method,\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 buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.refreshAccessKey\n ),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.refreshAccessKey.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.triggerBuild),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.triggerBuild.method,\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 buildRouteURL(backendURL, projectGroup, projectEndpoints.triggerWebhook),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.triggerWebhook.method,\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<ResponseData<any>>(\n buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.getCIConfiguration\n ),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.getCIConfiguration.method,\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<ResponseData<any>>(\n buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.pushCIConfiguration\n ),\n authAPIOptions,\n otherOptions,\n {\n method: projectEndpoints.pushCIConfiguration.method,\n }\n );\n\n /**\n * Updates granular access constraints for a project member.\n * @param userId - The user ID to update access for.\n * @param body - The new access constraints.\n */\n const updateMemberAccess = async (\n userId: string,\n body: UpdateMemberAccessBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateMemberAccessResult>(\n buildRouteURL(\n backendURL,\n projectGroup,\n projectEndpoints.updateMemberAccess,\n { userId }\n ),\n authAPIOptions,\n otherOptions,\n { method: projectEndpoints.updateMemberAccess.method, body }\n );\n\n return {\n getProjects,\n getProjectInsights,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n deleteProjectByIdAdmin,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n triggerBuild,\n triggerWebhook,\n getCIConfig,\n pushCIConfig,\n updateMemberAccess,\n };\n};\n\n/**\n * Authenticated `project` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const projectEndpoint = createEndpoint(getProjectAPI);\n"],"mappings":";;;;;;;;;AAwCA,MAAM,eAAe,EACnB,QAAQ,eACV;;;;;AAMA,MAAM,mBAAmB;CACvB,aAAa;EAAE,QAAQ;EAAO,MAAM;CAAI;CACxC,oBAAoB;EAAE,QAAQ;EAAO,MAAM;CAAY;CACvD,YAAY;EAAE,QAAQ;EAAQ,MAAM;CAAI;CACxC,eAAe;EAAE,QAAQ;EAAO,MAAM;CAAI;CAC1C,sBAAsB;EAAE,QAAQ;EAAO,MAAM;CAAW;CACxD,0BAA0B;EAAE,QAAQ;EAAO,MAAM;CAAiB;CAClE,eAAe;EAAE,QAAQ;EAAU,MAAM;CAAI;CAC7C,eAAe;EAAE,QAAQ;EAAO,MAAM;CAAc;CACpD,iBAAiB;EAAE,QAAQ;EAAQ,MAAM;CAAU;CACnD,iBAAiB;EAAE,QAAQ;EAAQ,MAAM;CAAc;CACvD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