@intlayer/api 5.5.9 → 5.5.11
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/README.md +42 -9
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +5 -1
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +5 -1
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/ai.cjs +10 -0
- package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/types.cjs.map +1 -1
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +5 -1
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +5 -1
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/ai.mjs +10 -0
- package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/ai.d.ts +2 -1
- package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/index.d.ts +1 -0
- package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -5,15 +5,48 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<a href="https://www.npmjs.com/package/intlayer"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
<a href="https://www.npmjs.com/package/intlayer" target="blank"><img
|
|
9
|
+
align="center"
|
|
10
|
+
alt="npm"
|
|
11
|
+
src="https://img.shields.io/npm/v/intlayer.svg?labelColor=49516F&color=8994BC&style=for-the-badge"
|
|
12
|
+
height="30" /></a>
|
|
13
|
+
<a href="https://npmjs.org/package/intlayer" target="blank"><img
|
|
14
|
+
align="center"
|
|
15
|
+
src="https://img.shields.io/npm/dm/intlayer?labelColor=49516F&color=8994BC&style=for-the-badge"
|
|
16
|
+
alt="monthly downloads"
|
|
17
|
+
height="30"
|
|
18
|
+
/></a>
|
|
19
|
+
<a href="https://npmjs.org/package/intlayer" target="blank"><img
|
|
20
|
+
align="center"
|
|
21
|
+
src="https://img.shields.io/npm/types/intlayer?label=types%20included&labelColor=49516F&color=8994BC&style=for-the-badge"
|
|
22
|
+
alt="types included"
|
|
23
|
+
height="30"
|
|
24
|
+
/></a>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div>
|
|
28
|
+
<br/>
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="https://www.linkedin.com/company/intlayerorg" target="blank"><img align="center"
|
|
31
|
+
src="https://img.shields.io/badge/linkedin-%231DA1F2.svg?style=for-the-badge&logo=linkedin&logoColor=white"
|
|
32
|
+
alt="Intlayer LinkedIn" height="30"/></a>
|
|
33
|
+
<a href="https://www.facebook.com/intlayer" target="blank"><img align="center"
|
|
34
|
+
src="https://img.shields.io/badge/facebook-4267B2.svg?style=for-the-badge&logo=facebook&logoColor=white"
|
|
35
|
+
alt="Intlayer Facebook" height="30"/></a>
|
|
36
|
+
<a href="https://www.instagram.com/intlayer_org/" target="blank"><img align="center"
|
|
37
|
+
src="https://img.shields.io/badge/instagram-%23E4405F.svg?style=for-the-badge&logo=Instagram&logoColor=white"
|
|
38
|
+
alt="Intlayer Instagram" height="30"/></a>
|
|
39
|
+
<a href="https://x.com/Intlayer183096" target="blank"><img align="center"
|
|
40
|
+
src="https://img.shields.io/badge/x-1DA1F2.svg?style=for-the-badge&logo=x&logoColor=white"
|
|
41
|
+
alt="Intlayer X" height="30"/></a>
|
|
42
|
+
<a href="https://www.youtube.com/@intlayer" target="blank"><img align="center"
|
|
43
|
+
src="https://img.shields.io/badge/youtube-FF0000.svg?style=for-the-badge&logo=youtube&logoColor=white"
|
|
44
|
+
alt="Intlayer YouTube" height="30"/></a>
|
|
45
|
+
<a href="https://www.tiktok.com/@intlayer" target="blank"><img align="center"
|
|
46
|
+
src="https://img.shields.io/badge/tiktok-000000.svg?style=for-the-badge&logo=tiktok&logoColor=white"
|
|
47
|
+
alt="Intlayer TikTok" height="30"/></a>
|
|
48
|
+
<br>
|
|
49
|
+
</p>
|
|
17
50
|
</div>
|
|
18
51
|
|
|
19
52
|
# @intlayer/api: interact with Intlayer API
|
|
@@ -47,7 +47,11 @@ const fetchDistantDictionaries = async (intlayerConfig = import_built.default) =
|
|
|
47
47
|
const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();
|
|
48
48
|
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
49
49
|
const getDictionaryResult = await dictionaryAPI.getDictionaries(void 0, {
|
|
50
|
-
|
|
50
|
+
...oAuth2AccessToken && {
|
|
51
|
+
headers: {
|
|
52
|
+
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
53
|
+
}
|
|
54
|
+
}
|
|
51
55
|
});
|
|
52
56
|
const distantDictionaries = getDictionaryResult.data;
|
|
53
57
|
return distantDictionaries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionaries = async (\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI[] | null | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionaries(undefined, {\n headers: {
|
|
1
|
+
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionaries = async (\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI[] | null | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionaries(undefined, {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n const distantDictionaries = getDictionaryResult.data;\n\n return distantDictionaries;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAE1B,kBAA2B;AAC3B,wBAAiC;AAK1B,MAAM,2BAA2B,OACtC,iBAAiC,aAAAA,YACe;AAChD,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,gBAAgB;AAEnD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAgB,oCAAiB,QAAW,cAAc;AAChE,UAAM,cAAU,wBAAW,QAAW,cAAc;AAEpD,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,cAAc,gBAAgB,QAAW;AAAA,MACzE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,iBAAiB;AAAA,QAC5C;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,sBAAsB,oBAAoB;AAEhD,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":["configuration"]}
|
|
@@ -50,7 +50,11 @@ const fetchDistantDictionary = async (dictionaryKey, intlayerConfig = import_bui
|
|
|
50
50
|
dictionaryKey,
|
|
51
51
|
void 0,
|
|
52
52
|
{
|
|
53
|
-
|
|
53
|
+
...oAuth2AccessToken && {
|
|
54
|
+
headers: {
|
|
55
|
+
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
56
|
+
}
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
);
|
|
56
60
|
const distantDictionary = getDictionaryResult.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string,\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: {
|
|
1
|
+
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string,\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n return distantDictionary;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA0B;AAE1B,kBAA2B;AAC3B,wBAAiC;AAK1B,MAAM,yBAAyB,OACpC,eACA,iBAAiC,aAAAA,YACM;AACvC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,gBAAgB;AAEnD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAgB,oCAAiB,QAAW,cAAc;AAChE,UAAM,cAAU,wBAAW,QAAW,cAAc;AAEpD,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,cAAc;AAAA,MAC9C;AAAA,MACA;AAAA,MACA;AAAA,QACE,GAAI,qBAAqB;AAAA,UACvB,SAAS;AAAA,YACP,eAAe,UAAU,iBAAiB;AAAA,UAC5C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,oBAAoB;AAE9C,QAAI,CAAC,mBAAmB;AACtB,YAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,IACnE;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":["configuration"]}
|
|
@@ -41,6 +41,15 @@ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
const AI_API_ROUTE = `${backendURL}/api/ai`;
|
|
44
|
+
const customQuery = async (body, otherOptions = {}) => await (0, import_fetcher.fetcher)(
|
|
45
|
+
AI_API_ROUTE,
|
|
46
|
+
authAPIOptions,
|
|
47
|
+
otherOptions,
|
|
48
|
+
{
|
|
49
|
+
method: "POST",
|
|
50
|
+
body
|
|
51
|
+
}
|
|
52
|
+
);
|
|
44
53
|
const translateJSON = async (body, otherOptions = {}) => await (0, import_fetcher.fetcher)(
|
|
45
54
|
`${AI_API_ROUTE}/translate/json`,
|
|
46
55
|
authAPIOptions,
|
|
@@ -148,6 +157,7 @@ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
148
157
|
}
|
|
149
158
|
);
|
|
150
159
|
return {
|
|
160
|
+
customQuery,
|
|
151
161
|
translateJSON,
|
|
152
162
|
auditContentDeclaration,
|
|
153
163
|
auditContentDeclarationField,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\n\nimport { fetcher, type FetcherOptions } from '../fetcher';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discutionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\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/ai`;\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify(rest),\n signal: abortController.signal,\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({}));\n\n throw new Error(errorData.message || 'Failed to fetch response');\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\n\nimport { fetcher, type FetcherOptions } from '../fetcher';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discutionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\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/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify(rest),\n signal: abortController.signal,\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({}));\n\n throw new Error(errorData.message || 'Failed to fetch response');\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n };\n};\n"],"mappings":"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","names":["configuration"]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __reExport(index_exports, require('./getIntlayerAPI/stripe.cjs'), module.exports
|
|
|
28
28
|
__reExport(index_exports, require('./getIntlayerAPI/tag.cjs'), module.exports);
|
|
29
29
|
__reExport(index_exports, require('./getIntlayerAPI/user.cjs'), module.exports);
|
|
30
30
|
__reExport(index_exports, require('./IntlayerEventListener.cjs'), module.exports);
|
|
31
|
+
__reExport(index_exports, require('./types.cjs'), module.exports);
|
|
31
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
33
|
0 && (module.exports = {
|
|
33
34
|
...require('./distantDictionary/index.cjs'),
|
|
@@ -42,6 +43,7 @@ __reExport(index_exports, require('./IntlayerEventListener.cjs'), module.exports
|
|
|
42
43
|
...require('./getIntlayerAPI/stripe.cjs'),
|
|
43
44
|
...require('./getIntlayerAPI/tag.cjs'),
|
|
44
45
|
...require('./getIntlayerAPI/user.cjs'),
|
|
45
|
-
...require('./IntlayerEventListener.cjs')
|
|
46
|
+
...require('./IntlayerEventListener.cjs'),
|
|
47
|
+
...require('./types.cjs')
|
|
46
48
|
});
|
|
47
49
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './distantDictionary/index';\nexport * from './fetcher';\nexport * from './getIntlayerAPI';\nexport * from './getIntlayerAPI/ai';\nexport * from './getIntlayerAPI/auth';\nexport * from './getIntlayerAPI/dictionary';\nexport * from './getIntlayerAPI/editor';\nexport * from './getIntlayerAPI/organization';\nexport * from './getIntlayerAPI/project';\nexport * from './getIntlayerAPI/stripe';\nexport * from './getIntlayerAPI/tag';\nexport * from './getIntlayerAPI/user';\nexport * from './IntlayerEventListener';\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './distantDictionary/index';\nexport * from './fetcher';\nexport * from './getIntlayerAPI';\nexport * from './getIntlayerAPI/ai';\nexport * from './getIntlayerAPI/auth';\nexport * from './getIntlayerAPI/dictionary';\nexport * from './getIntlayerAPI/editor';\nexport * from './getIntlayerAPI/organization';\nexport * from './getIntlayerAPI/project';\nexport * from './getIntlayerAPI/stripe';\nexport * from './getIntlayerAPI/tag';\nexport * from './getIntlayerAPI/user';\nexport * from './IntlayerEventListener';\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,sCAAd;AACA,0BAAc,sBADd;AAEA,0BAAc,6BAFd;AAGA,0BAAc,gCAHd;AAIA,0BAAc,kCAJd;AAKA,0BAAc,wCALd;AAMA,0BAAc,oCANd;AAOA,0BAAc,0CAPd;AAQA,0BAAc,qCARd;AASA,0BAAc,oCATd;AAUA,0BAAc,iCAVd;AAWA,0BAAc,kCAXd;AAYA,0BAAc,oCAZd;AAaA,0BAAc,oBAbd;","names":[]}
|
package/dist/cjs/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * This file re-exports all types to allow non-blocking build because\n * the backend and intlayer-editor are not built yet.\n */\nexport type {\n AddDictionaryBody,\n AddDictionaryResult,\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n AddProjectBody,\n AddProjectResult,\n AddTagBody,\n AddTagResult,\n AskDocQuestionResult,\n AskResetPasswordBody,\n AskResetPasswordResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CheckIfUserHasPasswordResult,\n CreateSessionBody,\n CreateSessionResult,\n CreateUserBody,\n CreateUserResult,\n DefinePasswordBody,\n DefinePasswordResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n DeleteOrganizationResult,\n DeleteProjectResult,\n DeleteTagParams,\n DeleteTagResult,\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetDictionariesKeysResult,\n GetDictionariesParams,\n GetDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n GetPricingBody,\n GetPricingResult,\n GetProjectsParams,\n GetProjectsResult,\n GetSessionInformationQuery,\n GetSessionInformationResult,\n GetTagsParams,\n GetTagsResult,\n GetUserByAccountParams,\n GetUserByAccountResult,\n GetUserByEmailParams,\n GetUserByEmailResult,\n GetUserByIdParams,\n GetUserByIdResult,\n GetUsersParams,\n GetUsersResult,\n GithubLoginQueryParams,\n GoogleLoginQueryParams,\n LoginBody,\n LoginResult,\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n PushDictionariesBody,\n PushDictionariesResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n RegisterBody,\n RegisterQuery,\n RegisterResult,\n SearchDocUtilParams,\n SearchDocUtilResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n SelectProjectParam,\n SelectProjectResult,\n SetCSRFTokenResult,\n TranslateJSONBody,\n TranslateJSONResult,\n UnselectOrganizationResult,\n UnselectProjectResult,\n UpdateDictionaryBody,\n UpdateDictionaryParam,\n UpdateDictionaryResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n UpdatePasswordBody,\n UpdatePasswordResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n UpdateTagBody,\n UpdateTagParams,\n UpdateTagResult,\n UpdateUserBody,\n UpdateUserResult,\n UserAPI,\n ValidEmailParams,\n ValidEmailResult,\n} from '@intlayer/backend';\nexport type {\n GetConfigurationResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from 'intlayer-editor';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * This file re-exports all types to allow non-blocking build because\n * the backend and intlayer-editor are not built yet.\n */\nexport type {\n AIOptions,\n AIProvider,\n AddDictionaryBody,\n AddDictionaryResult,\n AddNewAccessKeyBody,\n AddNewAccessKeyResponse,\n AddOrganizationBody,\n AddOrganizationMemberBody,\n AddOrganizationMemberResult,\n AddOrganizationResult,\n AddProjectBody,\n AddProjectResult,\n AddTagBody,\n AddTagResult,\n AskDocQuestionResult,\n AskResetPasswordBody,\n AskResetPasswordResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CheckIfUserHasPasswordResult,\n CreateSessionBody,\n CreateSessionResult,\n CreateUserBody,\n CreateUserResult,\n CustomQueryBody,\n CustomQueryResult,\n DefinePasswordBody,\n DefinePasswordResult,\n DeleteAccessKeyBody,\n DeleteAccessKeyResponse,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n DeleteOrganizationResult,\n DeleteProjectResult,\n DeleteTagParams,\n DeleteTagResult,\n GetCheckoutSessionBody,\n GetCheckoutSessionResult,\n GetDictionariesKeysResult,\n GetDictionariesParams,\n GetDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n GetOrganizationParam,\n GetOrganizationResult,\n GetOrganizationsParams,\n GetOrganizationsResult,\n GetPricingBody,\n GetPricingResult,\n GetProjectsParams,\n GetProjectsResult,\n GetSessionInformationQuery,\n GetSessionInformationResult,\n GetTagsParams,\n GetTagsResult,\n GetUserByAccountParams,\n GetUserByAccountResult,\n GetUserByEmailParams,\n GetUserByEmailResult,\n GetUserByIdParams,\n GetUserByIdResult,\n GetUsersParams,\n GetUsersResult,\n GithubLoginQueryParams,\n GoogleLoginQueryParams,\n LoginBody,\n LoginResult,\n Messages,\n NewsletterSubscriptionBody,\n NewsletterSubscriptionResult,\n NewsletterUnsubscriptionBody,\n PushDictionariesBody,\n PushDictionariesResult,\n PushProjectConfigurationBody,\n PushProjectConfigurationResult,\n RefreshAccessKeyBody,\n RefreshAccessKeyResponse,\n RegisterBody,\n RegisterQuery,\n RegisterResult,\n SearchDocUtilParams,\n SearchDocUtilResult,\n SelectOrganizationParam,\n SelectOrganizationResult,\n SelectProjectParam,\n SelectProjectResult,\n SetCSRFTokenResult,\n TranslateJSONBody,\n TranslateJSONResult,\n UnselectOrganizationResult,\n UnselectProjectResult,\n UpdateDictionaryBody,\n UpdateDictionaryParam,\n UpdateDictionaryResult,\n UpdateOrganizationBody,\n UpdateOrganizationMembersBody,\n UpdateOrganizationMembersResult,\n UpdateOrganizationResult,\n UpdatePasswordBody,\n UpdatePasswordResult,\n UpdateProjectBody,\n UpdateProjectMembersBody,\n UpdateProjectMembersResult,\n UpdateProjectResult,\n UpdateTagBody,\n UpdateTagParams,\n UpdateTagResult,\n UpdateUserBody,\n UpdateUserResult,\n UserAPI,\n ValidEmailParams,\n ValidEmailResult,\n} from '@intlayer/backend';\nexport type {\n GetConfigurationResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from 'intlayer-editor';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -14,7 +14,11 @@ const fetchDistantDictionaries = async (intlayerConfig = configuration) => {
|
|
|
14
14
|
const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();
|
|
15
15
|
const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
16
16
|
const getDictionaryResult = await dictionaryAPI.getDictionaries(void 0, {
|
|
17
|
-
|
|
17
|
+
...oAuth2AccessToken && {
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
20
|
+
}
|
|
21
|
+
}
|
|
18
22
|
});
|
|
19
23
|
const distantDictionaries = getDictionaryResult.data;
|
|
20
24
|
return distantDictionaries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionaries = async (\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI[] | null | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionaries(undefined, {\n headers: {
|
|
1
|
+
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionaries = async (\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI[] | null | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionaries(undefined, {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n const distantDictionaries = getDictionaryResult.data;\n\n return distantDictionaries;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":"AAEA,OAAO,mBAAmB;AAE1B,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AAK1B,MAAM,2BAA2B,OACtC,iBAAiC,kBACe;AAChD,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,gBAAgB;AAEnD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,gBAAgB,iBAAiB,QAAW,cAAc;AAChE,UAAM,UAAU,WAAW,QAAW,cAAc;AAEpD,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,cAAc,gBAAgB,QAAW;AAAA,MACzE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,iBAAiB;AAAA,QAC5C;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,sBAAsB,oBAAoB;AAEhD,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -17,7 +17,11 @@ const fetchDistantDictionary = async (dictionaryKey, intlayerConfig = configurat
|
|
|
17
17
|
dictionaryKey,
|
|
18
18
|
void 0,
|
|
19
19
|
{
|
|
20
|
-
|
|
20
|
+
...oAuth2AccessToken && {
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
23
|
+
}
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
26
|
);
|
|
23
27
|
const distantDictionary = getDictionaryResult.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string,\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: {
|
|
1
|
+
{"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { getAuthAPI } from '../getIntlayerAPI/auth';\nimport { getDictionaryAPI } from '../getIntlayerAPI/dictionary';\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string,\n intlayerConfig: IntlayerConfig = configuration\n): Promise<DictionaryAPI | undefined> => {\n try {\n const { clientId, clientSecret } = intlayerConfig?.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const dictionaryAPI = getDictionaryAPI(undefined, intlayerConfig);\n const authAPI = getAuthAPI(undefined, intlayerConfig);\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n return distantDictionary;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":"AAEA,OAAO,mBAAmB;AAE1B,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AAK1B,MAAM,yBAAyB,OACpC,eACA,iBAAiC,kBACM;AACvC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,gBAAgB;AAEnD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,gBAAgB,iBAAiB,QAAW,cAAc;AAChE,UAAM,UAAU,WAAW,QAAW,cAAc;AAEpD,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,cAAc;AAAA,MAC9C;AAAA,MACA;AAAA,MACA;AAAA,QACE,GAAI,qBAAqB;AAAA,UACvB,SAAS;AAAA,YACP,eAAe,UAAU,iBAAiB;AAAA,UAC5C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,oBAAoB;AAE9C,QAAI,CAAC,mBAAmB;AACtB,YAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,IACnE;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -8,6 +8,15 @@ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
const AI_API_ROUTE = `${backendURL}/api/ai`;
|
|
11
|
+
const customQuery = async (body, otherOptions = {}) => await fetcher(
|
|
12
|
+
AI_API_ROUTE,
|
|
13
|
+
authAPIOptions,
|
|
14
|
+
otherOptions,
|
|
15
|
+
{
|
|
16
|
+
method: "POST",
|
|
17
|
+
body
|
|
18
|
+
}
|
|
19
|
+
);
|
|
11
20
|
const translateJSON = async (body, otherOptions = {}) => await fetcher(
|
|
12
21
|
`${AI_API_ROUTE}/translate/json`,
|
|
13
22
|
authAPIOptions,
|
|
@@ -115,6 +124,7 @@ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
115
124
|
}
|
|
116
125
|
);
|
|
117
126
|
return {
|
|
127
|
+
customQuery,
|
|
118
128
|
translateJSON,
|
|
119
129
|
auditContentDeclaration,
|
|
120
130
|
auditContentDeclarationField,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\n\nimport { fetcher, type FetcherOptions } from '../fetcher';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discutionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\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/ai`;\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify(rest),\n signal: abortController.signal,\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({}));\n\n throw new Error(errorData.message || 'Failed to fetch response');\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/getIntlayerAPI/ai.ts"],"sourcesContent":["import type {\n AskDocQuestionResult,\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AutocompleteBody,\n AutocompleteResponse,\n ChatCompletionRequestMessage,\n CustomQueryBody,\n CustomQueryResult,\n TranslateJSONBody,\n TranslateJSONResult,\n} from '../types';\n\nimport configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\n\nimport { fetcher, type FetcherOptions } from '../fetcher';\n\nexport type AskDocQuestionBody = {\n messages: ChatCompletionRequestMessage[];\n discutionId: string;\n onMessage?: (chunk: string) => void;\n onDone?: (response: AskDocQuestionResult) => void;\n};\n\nexport type { AskDocQuestionResult };\n\nexport const getAiAPI = (\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/ai`;\n\n /**\n * Custom query\n * @param body - Custom query parameters.\n * @returns Custom query result.\n */\n const customQuery = async (\n body?: CustomQueryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CustomQueryResult>(\n AI_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Translate a JSON\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const translateJSON = async (\n body?: TranslateJSONBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<TranslateJSONResult>(\n `${AI_API_ROUTE}/translate/json`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/dictionary/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/dictionary/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Asks a question to the AI related to the documentation **and streams the\n * answer as Server‑Sent Events (SSE)**.\n *\n * The function **returns immediately** with a handle exposing:\n * - `promise` → resolves when the stream completes (or rejects on error)\n * - `abort()` → allows canceling the request on demand\n *\n * Usage example:\n * ```ts\n * const { promise, abort } = ai.askDocQuestion({\n * ...body,\n * onMessage: console.log,\n * onDone: (full) => console.log(\"✔\", full),\n * });\n * // later → abort();\n * await promise; // waits for completion if desired\n * ```\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) => {\n if (!body) return;\n\n const { onMessage, onDone, ...rest } = body;\n const abortController = new AbortController();\n\n try {\n const response = await fetch(`${AI_API_ROUTE}/ask`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...authAPIOptions.headers,\n ...otherOptions.headers,\n },\n body: JSON.stringify(rest),\n signal: abortController.signal,\n });\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => ({}));\n\n throw new Error(errorData.message || 'Failed to fetch response');\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error('No reader available');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n if (line.startsWith('data: ')) {\n try {\n const data = JSON.parse(line.slice(6));\n if (data.chunk) {\n onMessage?.(data.chunk);\n }\n if (data.done && data.response) {\n onDone?.(data.response);\n }\n } catch (e) {\n console.error('Failed to parse SSE data:', e);\n }\n }\n }\n }\n } catch (error) {\n console.error('Error in askDocQuestion:', error);\n throw error;\n }\n };\n\n const autocomplete = async (\n body?: AutocompleteBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AutocompleteResponse>(\n `${AI_API_ROUTE}/autocomplete`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n customQuery,\n translateJSON,\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n autocomplete,\n };\n};\n"],"mappings":"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","names":[]}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './distantDictionary/index';\nexport * from './fetcher';\nexport * from './getIntlayerAPI';\nexport * from './getIntlayerAPI/ai';\nexport * from './getIntlayerAPI/auth';\nexport * from './getIntlayerAPI/dictionary';\nexport * from './getIntlayerAPI/editor';\nexport * from './getIntlayerAPI/organization';\nexport * from './getIntlayerAPI/project';\nexport * from './getIntlayerAPI/stripe';\nexport * from './getIntlayerAPI/tag';\nexport * from './getIntlayerAPI/user';\nexport * from './IntlayerEventListener';\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './distantDictionary/index';\nexport * from './fetcher';\nexport * from './getIntlayerAPI';\nexport * from './getIntlayerAPI/ai';\nexport * from './getIntlayerAPI/auth';\nexport * from './getIntlayerAPI/dictionary';\nexport * from './getIntlayerAPI/editor';\nexport * from './getIntlayerAPI/organization';\nexport * from './getIntlayerAPI/project';\nexport * from './getIntlayerAPI/stripe';\nexport * from './getIntlayerAPI/tag';\nexport * from './getIntlayerAPI/user';\nexport * from './IntlayerEventListener';\nexport * from './types';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,CAiC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionary.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,eAAe,MAAM,EACrB,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionary.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,eAAe,MAAM,EACrB,iBAAgB,cAA8B,KAC7C,OAAO,CAAC,aAAa,GAAG,SAAS,CAyCnC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, TranslateJSONBody, TranslateJSONResult } from '../types';
|
|
1
|
+
import type { AskDocQuestionResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CustomQueryBody, CustomQueryResult, TranslateJSONBody, TranslateJSONResult } from '../types';
|
|
2
2
|
import type { IntlayerConfig } from '@intlayer/config/client';
|
|
3
3
|
import { type FetcherOptions } from '../fetcher';
|
|
4
4
|
export type AskDocQuestionBody = {
|
|
@@ -9,6 +9,7 @@ export type AskDocQuestionBody = {
|
|
|
9
9
|
};
|
|
10
10
|
export type { AskDocQuestionResult };
|
|
11
11
|
export declare const getAiAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
12
|
+
customQuery: (body?: CustomQueryBody, otherOptions?: FetcherOptions) => Promise<CustomQueryResult>;
|
|
12
13
|
translateJSON: (body?: TranslateJSONBody, otherOptions?: FetcherOptions) => Promise<TranslateJSONResult>;
|
|
13
14
|
auditContentDeclaration: (body?: AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationResult>;
|
|
14
15
|
auditContentDeclarationField: (body?: AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationFieldResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC,eAAO,MAAM,QAAQ,GACnB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC,eAAO,MAAM,QAAQ,GACnB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;yBAmBtB,eAAe,iBACR,cAAc;2BAkBrB,iBAAiB,iBACV,cAAc;qCAkBrB,2BAA2B,iBACpB,cAAc;0CAkBrB,gCAAgC,iBACzB,cAAc;6CAkBrB,mCAAmC,iBAC5B,cAAc;sBAkBrB,YAAY,iBACL,cAAc;4BAgCrB,kBAAkB,iBACX,cAAc;0BAgErB,gBAAgB,iBACT,cAAc;CAsB/B,CAAC"}
|
|
@@ -66,6 +66,7 @@ export declare const getIntlayerAPI: (authAPIOptions?: FetcherOptions, intlayerC
|
|
|
66
66
|
cancelSubscription: (otherOptions?: FetcherOptions) => Promise<import("@intlayer/backend").GetCheckoutSessionResult>;
|
|
67
67
|
};
|
|
68
68
|
ai: {
|
|
69
|
+
customQuery: (body?: import("@intlayer/backend").CustomQueryBody, otherOptions?: FetcherOptions) => Promise<import("@intlayer/backend").CustomQueryResult>;
|
|
69
70
|
translateJSON: (body?: import("@intlayer/backend").TranslateJSONBody, otherOptions?: FetcherOptions) => Promise<import("@intlayer/backend").TranslateJSONResult>;
|
|
70
71
|
auditContentDeclaration: (body?: import("@intlayer/backend").AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<import("@intlayer/backend").AuditContentDeclarationResult>;
|
|
71
72
|
auditContentDeclarationField: (body?: import("@intlayer/backend").AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<import("@intlayer/backend").AuditContentDeclarationFieldResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAajD,eAAO,MAAM,cAAc,GACzB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/getIntlayerAPI/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAajD,eAAO,MAAM,cAAc,GACzB,iBAAgB,cAAmB,EACnC,iBAAiB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa/B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export * from './getIntlayerAPI/stripe';
|
|
|
11
11
|
export * from './getIntlayerAPI/tag';
|
|
12
12
|
export * from './getIntlayerAPI/user';
|
|
13
13
|
export * from './IntlayerEventListener';
|
|
14
|
-
export
|
|
14
|
+
export * from './types';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* This file re-exports all types to allow non-blocking build because
|
|
3
3
|
* the backend and intlayer-editor are not built yet.
|
|
4
4
|
*/
|
|
5
|
-
export type { AddDictionaryBody, AddDictionaryResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, AddProjectBody, AddProjectResult, AddTagBody, AddTagResult, AskDocQuestionResult, AskResetPasswordBody, AskResetPasswordResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CheckIfUserHasPasswordResult, CreateSessionBody, CreateSessionResult, CreateUserBody, CreateUserResult, DefinePasswordBody, DefinePasswordResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteDictionaryParam, DeleteDictionaryResult, DeleteOrganizationResult, DeleteProjectResult, DeleteTagParams, DeleteTagResult, GetCheckoutSessionBody, GetCheckoutSessionResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetOAuth2TokenBody, GetOAuth2TokenResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, GetPricingBody, GetPricingResult, GetProjectsParams, GetProjectsResult, GetSessionInformationQuery, GetSessionInformationResult, GetTagsParams, GetTagsResult, GetUserByAccountParams, GetUserByAccountResult, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, GithubLoginQueryParams, GoogleLoginQueryParams, LoginBody, LoginResult, NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody, PushDictionariesBody, PushDictionariesResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, RegisterBody, RegisterQuery, RegisterResult, SearchDocUtilParams, SearchDocUtilResult, SelectOrganizationParam, SelectOrganizationResult, SelectProjectParam, SelectProjectResult, SetCSRFTokenResult, TranslateJSONBody, TranslateJSONResult, UnselectOrganizationResult, UnselectProjectResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult, UpdatePasswordBody, UpdatePasswordResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult, UpdateTagBody, UpdateTagParams, UpdateTagResult, UpdateUserBody, UpdateUserResult, UserAPI, ValidEmailParams, ValidEmailResult, } from '@intlayer/backend';
|
|
5
|
+
export type { AIOptions, AIProvider, AddDictionaryBody, AddDictionaryResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, AddOrganizationBody, AddOrganizationMemberBody, AddOrganizationMemberResult, AddOrganizationResult, AddProjectBody, AddProjectResult, AddTagBody, AddTagResult, AskDocQuestionResult, AskResetPasswordBody, AskResetPasswordResult, AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AutocompleteBody, AutocompleteResponse, ChatCompletionRequestMessage, CheckIfUserHasPasswordResult, CreateSessionBody, CreateSessionResult, CreateUserBody, CreateUserResult, CustomQueryBody, CustomQueryResult, DefinePasswordBody, DefinePasswordResult, DeleteAccessKeyBody, DeleteAccessKeyResponse, DeleteDictionaryParam, DeleteDictionaryResult, DeleteOrganizationResult, DeleteProjectResult, DeleteTagParams, DeleteTagResult, GetCheckoutSessionBody, GetCheckoutSessionResult, GetDictionariesKeysResult, GetDictionariesParams, GetDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetOAuth2TokenBody, GetOAuth2TokenResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, GetPricingBody, GetPricingResult, GetProjectsParams, GetProjectsResult, GetSessionInformationQuery, GetSessionInformationResult, GetTagsParams, GetTagsResult, GetUserByAccountParams, GetUserByAccountResult, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, GithubLoginQueryParams, GoogleLoginQueryParams, LoginBody, LoginResult, Messages, NewsletterSubscriptionBody, NewsletterSubscriptionResult, NewsletterUnsubscriptionBody, PushDictionariesBody, PushDictionariesResult, PushProjectConfigurationBody, PushProjectConfigurationResult, RefreshAccessKeyBody, RefreshAccessKeyResponse, RegisterBody, RegisterQuery, RegisterResult, SearchDocUtilParams, SearchDocUtilResult, SelectOrganizationParam, SelectOrganizationResult, SelectProjectParam, SelectProjectResult, SetCSRFTokenResult, TranslateJSONBody, TranslateJSONResult, UnselectOrganizationResult, UnselectProjectResult, UpdateDictionaryBody, UpdateDictionaryParam, UpdateDictionaryResult, UpdateOrganizationBody, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, UpdateOrganizationResult, UpdatePasswordBody, UpdatePasswordResult, UpdateProjectBody, UpdateProjectMembersBody, UpdateProjectMembersResult, UpdateProjectResult, UpdateTagBody, UpdateTagParams, UpdateTagResult, UpdateUserBody, UpdateUserResult, UserAPI, ValidEmailParams, ValidEmailResult, } from '@intlayer/backend';
|
|
6
6
|
export type { GetConfigurationResult, WriteContentDeclarationBody, WriteContentDeclarationResult, } from 'intlayer-editor';
|
|
7
7
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,SAAS,EACT,WAAW,EACX,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,+BAA+B,EAC/B,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,YAAY,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,2BAA2B,EAC3B,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,SAAS,EACT,WAAW,EACX,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EACtB,4BAA4B,EAC5B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,+BAA+B,EAC/B,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/api",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SDK for interacting with the Intlayer API, enabling content auditing, and managing organizations, projects, and users.",
|
|
6
6
|
"keywords": [
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"./package.json"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@intlayer/config": "5.5.
|
|
61
|
+
"@intlayer/config": "5.5.11"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@changesets/changelog-github": "0.5.1",
|
|
@@ -72,15 +72,16 @@
|
|
|
72
72
|
"tsc-alias": "^1.8.16",
|
|
73
73
|
"tsup": "^8.5.0",
|
|
74
74
|
"typescript": "^5.8.3",
|
|
75
|
-
"
|
|
75
|
+
"vitest": "^3.2.2",
|
|
76
76
|
"@utils/eslint-config": "1.0.4",
|
|
77
|
+
"@intlayer/backend": "5.5.11",
|
|
77
78
|
"@utils/ts-config": "1.0.4",
|
|
78
|
-
"@utils/ts-config-types": "1.0.4",
|
|
79
79
|
"@utils/tsup-config": "1.0.4",
|
|
80
|
-
"intlayer-editor": "5.5.
|
|
80
|
+
"intlayer-editor": "5.5.11",
|
|
81
|
+
"@utils/ts-config-types": "1.0.4"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
83
|
-
"@intlayer/config": "5.5.
|
|
84
|
+
"@intlayer/config": "5.5.11"
|
|
84
85
|
},
|
|
85
86
|
"engines": {
|
|
86
87
|
"node": ">=14.18"
|
|
@@ -99,7 +100,8 @@
|
|
|
99
100
|
"prettier": "prettier . --check",
|
|
100
101
|
"prettier:fix": "prettier . --write",
|
|
101
102
|
"reset": "pnpm clean & pnpm build",
|
|
102
|
-
"test": "",
|
|
103
|
+
"test": "vitest run",
|
|
104
|
+
"test:watch": "vitest",
|
|
103
105
|
"typecheck": "tsup --project ./tsconfig.json --noEmit"
|
|
104
106
|
}
|
|
105
107
|
}
|