@intlayer/api 6.1.6 → 7.0.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +18 -55
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +20 -58
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
- package/dist/cjs/distantDictionary/index.cjs +5 -25
- package/dist/cjs/fetcher.cjs +113 -89
- package/dist/cjs/fetcher.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/ai.cjs +163 -188
- package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/dictionary.cjs +69 -117
- package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/editor.cjs +37 -74
- package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/index.cjs +27 -49
- package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/newsletter.cjs +40 -77
- package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/oAuth.cjs +26 -65
- package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/organization.cjs +93 -130
- package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/project.cjs +109 -154
- package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/search.cjs +22 -58
- package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/stripe.cjs +38 -77
- package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/tag.cjs +47 -86
- package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/user.cjs +79 -106
- package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
- package/dist/cjs/index.cjs +30 -49
- package/dist/cjs/proxy.cjs +90 -115
- package/dist/cjs/proxy.cjs.map +1 -1
- package/dist/cjs/types.cjs +0 -17
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +17 -20
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +19 -23
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
- package/dist/esm/distantDictionary/index.mjs +4 -3
- package/dist/esm/fetcher.mjs +111 -64
- package/dist/esm/fetcher.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/ai.mjs +160 -153
- package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/dictionary.mjs +66 -82
- package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/editor.mjs +34 -39
- package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/index.mjs +16 -14
- package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/newsletter.mjs +37 -42
- package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/oAuth.mjs +23 -30
- package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/organization.mjs +90 -95
- package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/project.mjs +106 -119
- package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/search.mjs +19 -23
- package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/stripe.mjs +35 -42
- package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/tag.mjs +44 -51
- package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/user.mjs +76 -71
- package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
- package/dist/esm/index.mjs +16 -15
- package/dist/esm/proxy.mjs +89 -90
- package/dist/esm/proxy.mjs.map +1 -1
- package/dist/esm/types.mjs +0 -1
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +8 -3
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +8 -3
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
- package/dist/types/distantDictionary/index.d.ts +3 -3
- package/dist/types/fetcher.d.ts +14 -11
- package/dist/types/fetcher.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/ai.d.ts +22 -18
- package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/dictionary.d.ts +16 -12
- package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/editor.d.ts +11 -7
- package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/index.d.ts +30 -27
- package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/newsletter.d.ts +11 -7
- package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/oAuth.d.ts +8 -5
- package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/organization.d.ts +18 -13
- package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/project.d.ts +19 -15
- package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/search.d.ts +9 -5
- package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/stripe.d.ts +11 -7
- package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/tag.d.ts +12 -8
- package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/user.d.ts +16 -12
- package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
- package/dist/types/index.d.ts +16 -15
- package/dist/types/proxy.d.ts +10 -5
- package/dist/types/proxy.d.ts.map +1 -1
- package/dist/types/types.d.ts +13 -12
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +29 -38
- package/LICENSE +0 -202
- package/dist/cjs/distantDictionary/index.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/types.cjs.map +0 -1
- package/dist/esm/distantDictionary/index.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/types/distantDictionary/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
|
@@ -1,99 +1,94 @@
|
|
|
1
|
-
import configuration from "@intlayer/config/built";
|
|
2
1
|
import { fetcher } from "../fetcher.mjs";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
3
|
+
|
|
4
|
+
//#region src/getIntlayerAPI/organization.ts
|
|
3
5
|
const getOrganizationAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
addOrganizationMember,
|
|
89
|
-
updateOrganization,
|
|
90
|
-
updateOrganizationMembers,
|
|
91
|
-
deleteOrganization,
|
|
92
|
-
selectOrganization,
|
|
93
|
-
unselectOrganization
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
export {
|
|
97
|
-
getOrganizationAPI
|
|
6
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;
|
|
7
|
+
if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration--.");
|
|
8
|
+
const ORGANIZATION_API_ROUTE = `${backendURL}/api/organization`;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a list of organizations based on filters and pagination.
|
|
11
|
+
* @param filters - Filters and pagination options.
|
|
12
|
+
*/
|
|
13
|
+
const getOrganizations = async (filters, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
|
|
14
|
+
cache: "no-store",
|
|
15
|
+
params: filters
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves an organization by its ID.
|
|
19
|
+
* @param organizationId - Organization ID.
|
|
20
|
+
*/
|
|
21
|
+
const getOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions);
|
|
22
|
+
/**
|
|
23
|
+
* Adds a new organization to the database.
|
|
24
|
+
* @param organization - Organization data.
|
|
25
|
+
*/
|
|
26
|
+
const addOrganization = async (organization, otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
body: organization
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Updates an existing organization in the database.
|
|
32
|
+
* @param organization - Updated organization data.
|
|
33
|
+
*/
|
|
34
|
+
const updateOrganization = async (organization, otherOptions = {}) => fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, {
|
|
35
|
+
method: "PUT",
|
|
36
|
+
body: organization
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Update members to the organization in the database.
|
|
40
|
+
* @param body - Updated organization members data.
|
|
41
|
+
*/
|
|
42
|
+
const updateOrganizationMembers = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/members`, authAPIOptions, otherOptions, {
|
|
43
|
+
method: "PUT",
|
|
44
|
+
body
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Admin-only: Update members of any organization by ID
|
|
48
|
+
* @param organizationId - Organization ID
|
|
49
|
+
* @param body - Updated organization members data.
|
|
50
|
+
*/
|
|
51
|
+
const updateOrganizationMembersById = async (organizationId, body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/${organizationId}/members`, authAPIOptions, otherOptions, {
|
|
52
|
+
method: "PUT",
|
|
53
|
+
body
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Add member to the organization in the database.
|
|
57
|
+
* @param body - Updated organization members data.
|
|
58
|
+
*/
|
|
59
|
+
const addOrganizationMember = async (body, otherOptions = {}) => fetcher(`${ORGANIZATION_API_ROUTE}/member`, authAPIOptions, otherOptions, {
|
|
60
|
+
method: "POST",
|
|
61
|
+
body
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* Deletes an organization from the database by its ID.
|
|
65
|
+
* @param organizationId - Organization ID.
|
|
66
|
+
*/
|
|
67
|
+
const deleteOrganization = async (otherOptions = {}) => await fetcher(ORGANIZATION_API_ROUTE, authAPIOptions, otherOptions, { method: "DELETE" });
|
|
68
|
+
/**
|
|
69
|
+
* Select an organization from the database by its ID.
|
|
70
|
+
* @param organizationId - Organization ID.
|
|
71
|
+
*/
|
|
72
|
+
const selectOrganization = async (organizationId, otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/${String(organizationId)}`, authAPIOptions, otherOptions, { method: "PUT" });
|
|
73
|
+
/**
|
|
74
|
+
* Unselect an organization from the database by its ID.
|
|
75
|
+
* @param organizationId - Organization ID.
|
|
76
|
+
*/
|
|
77
|
+
const unselectOrganization = async (otherOptions = {}) => await fetcher(`${ORGANIZATION_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
|
|
78
|
+
return {
|
|
79
|
+
getOrganizations,
|
|
80
|
+
getOrganization,
|
|
81
|
+
addOrganization,
|
|
82
|
+
addOrganizationMember,
|
|
83
|
+
updateOrganization,
|
|
84
|
+
updateOrganizationMembers,
|
|
85
|
+
updateOrganizationMembersById,
|
|
86
|
+
deleteOrganization,
|
|
87
|
+
selectOrganization,
|
|
88
|
+
unselectOrganization
|
|
89
|
+
};
|
|
98
90
|
};
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { getOrganizationAPI };
|
|
99
94
|
//# sourceMappingURL=organization.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/getIntlayerAPI/organization.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"organization.mjs","names":[],"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,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,8DACD;CAGH,MAAM,yBAAyB,GAAG,WAAW;;;;;CAM7C,MAAM,mBAAmB,OACvB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;;CAMH,MAAM,kBAAkB,OACtB,gBACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,aACD;;;;;CAMH,MAAM,kBAAkB,OACtB,cACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,qBAAqB,OACzB,cACA,eAA+B,EAAE,KAEjC,QACE,wBACA,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,4BAA4B,OAChC,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,uBAAuB,WAC1B,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;;CAOH,MAAM,gCAAgC,OACpC,gBACA,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,uBAAuB,GAAG,eAAe,WAC5C,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,wBAAwB,OAC5B,MACA,eAA+B,EAAE,KAEjC,QACE,GAAG,uBAAuB,UAC1B,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;;CAMH,MAAM,qBAAqB,OAAO,eAA+B,EAAE,KACjE,MAAM,QACJ,wBACA,gBACA,cACA,EACE,QAAQ,UACT,CACF;;;;;CAMH,MAAM,qBAAqB,OACzB,gBACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,uBAAuB,GAAG,OAAO,eAAe,IACnD,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;CAMH,MAAM,uBAAuB,OAAO,eAA+B,EAAE,KACnE,MAAM,QACJ,GAAG,uBAAuB,UAC1B,gBACA,cACA,EACE,QAAQ,QACT,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -1,123 +1,110 @@
|
|
|
1
|
-
import configuration from "@intlayer/config/built";
|
|
2
1
|
import { fetcher } from "../fetcher.mjs";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
3
|
+
|
|
4
|
+
//#region src/getIntlayerAPI/project.ts
|
|
3
5
|
const getProjectAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
return {
|
|
107
|
-
getProjects,
|
|
108
|
-
addProject,
|
|
109
|
-
updateProject,
|
|
110
|
-
updateProjectMembers,
|
|
111
|
-
pushProjectConfiguration,
|
|
112
|
-
deleteProject,
|
|
113
|
-
selectProject,
|
|
114
|
-
unselectProject,
|
|
115
|
-
addNewAccessKey,
|
|
116
|
-
deleteAccessKey,
|
|
117
|
-
refreshAccessKey
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
export {
|
|
121
|
-
getProjectAPI
|
|
6
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;
|
|
7
|
+
if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
|
|
8
|
+
const PROJECT_API_ROUTE = `${backendURL}/api/project`;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a list of projects based on filters and pagination.
|
|
11
|
+
* @param filters - Filters and pagination options.
|
|
12
|
+
*/
|
|
13
|
+
const getProjects = async (filters, otherOptions = {}) => await fetcher(PROJECT_API_ROUTE, authAPIOptions, otherOptions, {
|
|
14
|
+
cache: "no-store",
|
|
15
|
+
params: filters
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Adds a new project to the database.
|
|
19
|
+
* @param project - Project data.
|
|
20
|
+
*/
|
|
21
|
+
const addProject = async (project, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
body: project
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Updates an existing project in the database.
|
|
27
|
+
* @param project - Updated project data.
|
|
28
|
+
*/
|
|
29
|
+
const updateProject = async (project, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, {
|
|
30
|
+
method: "PUT",
|
|
31
|
+
body: project
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Updates project members in the database.
|
|
35
|
+
* @param project - Updated project data.
|
|
36
|
+
*/
|
|
37
|
+
const updateProjectMembers = async (body, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/members`, authAPIOptions, otherOptions, {
|
|
38
|
+
method: "PUT",
|
|
39
|
+
body
|
|
40
|
+
});
|
|
41
|
+
/** Pushes a project configuration to the database.
|
|
42
|
+
* @param projectConfiguration - Project configuration data.
|
|
43
|
+
*/
|
|
44
|
+
const pushProjectConfiguration = async (projectConfiguration, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/configuration`, authAPIOptions, otherOptions, {
|
|
45
|
+
method: "PUT",
|
|
46
|
+
body: projectConfiguration
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Deletes a project from the database by its ID.
|
|
50
|
+
* @param id - Project ID.
|
|
51
|
+
*/
|
|
52
|
+
const deleteProject = async (otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}`, authAPIOptions, otherOptions, { method: "DELETE" });
|
|
53
|
+
/**
|
|
54
|
+
* Select a project from the database by its ID.
|
|
55
|
+
* @param projectId - Organization ID.
|
|
56
|
+
*/
|
|
57
|
+
const selectProject = async (projectId, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/${String(projectId)}`, authAPIOptions, otherOptions, { method: "PUT" });
|
|
58
|
+
/**
|
|
59
|
+
* Unselect a project from the database by its ID.
|
|
60
|
+
* @param projectId - Project ID.
|
|
61
|
+
*/
|
|
62
|
+
const unselectProject = async (otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/logout`, authAPIOptions, otherOptions, { method: "POST" });
|
|
63
|
+
/**
|
|
64
|
+
* Add a new access key to a project.
|
|
65
|
+
* @param accessKey - Access key data.
|
|
66
|
+
* @param otherOptions - Fetcher options.
|
|
67
|
+
* @returns The new access key.
|
|
68
|
+
*/
|
|
69
|
+
const addNewAccessKey = async (accessKey, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
|
|
70
|
+
method: "POST",
|
|
71
|
+
body: accessKey
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Delete a project access key.
|
|
75
|
+
* @param clientId - Access key client ID.
|
|
76
|
+
* @param otherOptions - Fetcher options.
|
|
77
|
+
* @returns The deleted project.
|
|
78
|
+
*/
|
|
79
|
+
const deleteAccessKey = async (clientId, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
|
|
80
|
+
method: "DELETE",
|
|
81
|
+
body: { clientId }
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Refreshes an access key from a project.
|
|
85
|
+
* @param clientId - The ID of the client to refresh.
|
|
86
|
+
* @param projectId - The ID of the project to refresh the access key from.
|
|
87
|
+
* @returns The new access key.
|
|
88
|
+
*/
|
|
89
|
+
const refreshAccessKey = async (clientId, otherOptions = {}) => await fetcher(`${PROJECT_API_ROUTE}/access_key`, authAPIOptions, otherOptions, {
|
|
90
|
+
method: "PATCH",
|
|
91
|
+
body: { clientId }
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
getProjects,
|
|
95
|
+
addProject,
|
|
96
|
+
updateProject,
|
|
97
|
+
updateProjectMembers,
|
|
98
|
+
pushProjectConfiguration,
|
|
99
|
+
deleteProject,
|
|
100
|
+
selectProject,
|
|
101
|
+
unselectProject,
|
|
102
|
+
addNewAccessKey,
|
|
103
|
+
deleteAccessKey,
|
|
104
|
+
refreshAccessKey
|
|
105
|
+
};
|
|
122
106
|
};
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
export { getProjectAPI };
|
|
123
110
|
//# sourceMappingURL=project.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/getIntlayerAPI/project.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"project.mjs","names":[],"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 GetProjectsParams,\n GetProjectsResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n SelectProjectParam,\n SelectProjectResult,\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 return {\n getProjects,\n addProject,\n updateProject,\n updateProjectMembers,\n pushProjectConfiguration,\n deleteProject,\n selectProject,\n unselectProject,\n addNewAccessKey,\n deleteAccessKey,\n refreshAccessKey,\n };\n};\n"],"mappings":";;;;AA0BA,MAAa,iBACX,iBAAiC,EAAE,EACnC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,oBAAoB,GAAG,WAAW;;;;;CAMxC,MAAM,cAAc,OAClB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;EACT,CACF;;;;;CAMH,MAAM,aAAa,OACjB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,gBAAgB,OACpB,SACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,uBAAuB,OAC3B,MACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,QAAQ;EACR;EACD,CACF;;;;CAKH,MAAM,2BAA2B,OAC/B,sBACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,iBACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;CAMH,MAAM,gBAAgB,OAAO,eAA+B,EAAE,KAC5D,MAAM,QACJ,GAAG,qBACH,gBACA,cACA,EACE,QAAQ,UACT,CACF;;;;;CAMH,MAAM,gBAAgB,OACpB,WACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,GAAG,OAAO,UAAU,IACzC,gBACA,cACA,EACE,QAAQ,OACT,CACF;;;;;CAMH,MAAM,kBAAkB,OAAO,eAA+B,EAAE,KAC9D,MAAM,QACJ,GAAG,kBAAkB,UACrB,gBACA,cACA,EACE,QAAQ,QACT,CACF;;;;;;;CAQH,MAAM,kBAAkB,OACtB,WACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM;EACP,CACF;;;;;;;CAQH,MAAM,kBAAkB,OACtB,UACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;;;;;;;CAQH,MAAM,mBAAmB,OACvB,UACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,kBAAkB,cACrB,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,UAAU;EACnB,CACF;AAEH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import configuration from "@intlayer/config/built";
|
|
2
1
|
import { fetcher } from "../fetcher.mjs";
|
|
2
|
+
import configuration from "@intlayer/config/built";
|
|
3
|
+
|
|
4
|
+
//#region src/getIntlayerAPI/search.ts
|
|
3
5
|
const getSearchAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
params
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
return {
|
|
21
|
-
searchDoc
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
getSearchAPI
|
|
6
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? configuration?.editor?.backendURL;
|
|
7
|
+
if (!backendURL) throw new Error("Backend URL is not defined in the Intlayer configuration.");
|
|
8
|
+
const AI_API_ROUTE = `${backendURL}/api/search`;
|
|
9
|
+
/**
|
|
10
|
+
* Search documentation
|
|
11
|
+
* @param params - Search parameters containing the input query.
|
|
12
|
+
* @returns Search results with GitHub URLs.
|
|
13
|
+
*/
|
|
14
|
+
const searchDoc = async (params, otherOptions = {}) => await fetcher(`${AI_API_ROUTE}/doc`, authAPIOptions, otherOptions, {
|
|
15
|
+
method: "GET",
|
|
16
|
+
params
|
|
17
|
+
});
|
|
18
|
+
return { searchDoc };
|
|
26
19
|
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getSearchAPI };
|
|
27
23
|
//# sourceMappingURL=search.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/getIntlayerAPI/search.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"search.mjs","names":[],"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,cAAc,eAAe,QAAQ;AAE/D,KAAI,CAAC,WACH,OAAM,IAAI,MACR,4DACD;CAGH,MAAM,eAAe,GAAG,WAAW;;;;;;CAOnC,MAAM,YAAY,OAChB,QACA,eAA+B,EAAE,KAEjC,MAAM,QACJ,GAAG,aAAa,OAChB,gBACA,cACA;EACE,QAAQ;EACA;EACT,CACF;AAEH,QAAO,EACL,WACD"}
|