@intlayer/design-system 4.1.6 → 4.1.8
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/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +6 -2
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +6 -2
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +10 -4
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +10 -4
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.cjs +2 -2
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +2 -2
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/package.json +22 -19
- package/dist/CodeBlockShiki-BlmZyrr7.cjs +0 -29
- package/dist/CodeBlockShiki-BlmZyrr7.cjs.map +0 -1
- package/dist/CodeBlockShiki-CcpV9SVi.js +0 -29
- package/dist/CodeBlockShiki-CcpV9SVi.js.map +0 -1
- package/dist/CopyButton-Cxu3goRg.cjs +0 -59
- package/dist/CopyButton-Cxu3goRg.cjs.map +0 -1
- package/dist/CopyButton-DlcDlf6U.js +0 -60
- package/dist/CopyButton-DlcDlf6U.js.map +0 -1
- package/dist/Form-0D7KBafQ.cjs +0 -311
- package/dist/Form-0D7KBafQ.cjs.map +0 -1
- package/dist/Form-7BqwvjVI.cjs +0 -320
- package/dist/Form-7BqwvjVI.cjs.map +0 -1
- package/dist/Form-B2UufQRJ.cjs +0 -319
- package/dist/Form-B2UufQRJ.cjs.map +0 -1
- package/dist/Form-BB0kpER9.cjs +0 -301
- package/dist/Form-BB0kpER9.cjs.map +0 -1
- package/dist/Form-BDcoNTLV.cjs +0 -300
- package/dist/Form-BDcoNTLV.cjs.map +0 -1
- package/dist/Form-BTogr-fp.js +0 -312
- package/dist/Form-BTogr-fp.js.map +0 -1
- package/dist/Form-BVkkvSKP.js +0 -312
- package/dist/Form-BVkkvSKP.js.map +0 -1
- package/dist/Form-Be6Uhb5-.js +0 -312
- package/dist/Form-Be6Uhb5-.js.map +0 -1
- package/dist/Form-BmQQnl-6.js +0 -312
- package/dist/Form-BmQQnl-6.js.map +0 -1
- package/dist/Form-BoWOdiwq.js +0 -321
- package/dist/Form-BoWOdiwq.js.map +0 -1
- package/dist/Form-Bp_ubH9I.cjs +0 -311
- package/dist/Form-Bp_ubH9I.cjs.map +0 -1
- package/dist/Form-BtqRbgLu.cjs +0 -311
- package/dist/Form-BtqRbgLu.cjs.map +0 -1
- package/dist/Form-COVZyto7.cjs +0 -311
- package/dist/Form-COVZyto7.cjs.map +0 -1
- package/dist/Form-CVD_3nCD.js +0 -312
- package/dist/Form-CVD_3nCD.js.map +0 -1
- package/dist/Form-Cfklj1_H.js +0 -320
- package/dist/Form-Cfklj1_H.js.map +0 -1
- package/dist/Form-ClAAiVNm.cjs +0 -311
- package/dist/Form-ClAAiVNm.cjs.map +0 -1
- package/dist/Form-DGLgTAdY.js +0 -302
- package/dist/Form-DGLgTAdY.js.map +0 -1
- package/dist/Form-DhsgC7kB.js +0 -301
- package/dist/Form-DhsgC7kB.js.map +0 -1
- package/dist/Form-Dv0uHqbL.cjs +0 -320
- package/dist/Form-Dv0uHqbL.cjs.map +0 -1
- package/dist/Form-OK9zfg6E.js +0 -321
- package/dist/Form-OK9zfg6E.js.map +0 -1
- package/dist/components/ContentEditor/ContentEditorCode.cjs +0 -78
- package/dist/components/ContentEditor/ContentEditorCode.cjs.map +0 -1
- package/dist/components/ContentEditor/ContentEditorCode.d.ts +0 -11
- package/dist/components/ContentEditor/ContentEditorCode.d.ts.map +0 -1
- package/dist/components/ContentEditor/ContentEditorCode.mjs +0 -78
- package/dist/components/ContentEditor/ContentEditorCode.mjs.map +0 -1
- package/dist/components/DictionaryEditor/useEditedContentStore.cjs +0 -490
- package/dist/components/DictionaryEditor/useEditedContentStore.cjs.map +0 -1
- package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +0 -28
- package/dist/components/DictionaryEditor/useEditedContentStore.d.ts.map +0 -1
- package/dist/components/DictionaryEditor/useEditedContentStore.mjs +0 -490
- package/dist/components/DictionaryEditor/useEditedContentStore.mjs.map +0 -1
- package/dist/components/DictionaryEditor/useEditionPanelStore.cjs +0 -15
- package/dist/components/DictionaryEditor/useEditionPanelStore.cjs.map +0 -1
- package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts +0 -15
- package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts.map +0 -1
- package/dist/components/DictionaryEditor/useEditionPanelStore.mjs +0 -15
- package/dist/components/DictionaryEditor/useEditionPanelStore.mjs.map +0 -1
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelector.d.ts +0 -8
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelector.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelectorContext.d.ts +0 -13
- package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelectorContext.d.ts.map +0 -1
- package/dist/components/DictionaryFieldEditor/LocaleSelector/localeSelector.content.d.ts +0 -9
- package/dist/components/DictionaryFieldEditor/LocaleSelector/localeSelector.content.d.ts.map +0 -1
- package/dist/components/DropDown/types.cjs +0 -2
- package/dist/components/DropDown/types.cjs.map +0 -1
- package/dist/components/DropDown/types.d.ts +0 -19
- package/dist/components/DropDown/types.d.ts.map +0 -1
- package/dist/components/DropDown/types.mjs +0 -2
- package/dist/components/DropDown/types.mjs.map +0 -1
- package/dist/components/IDE/CodeBlock.cjs +0 -54
- package/dist/components/IDE/CodeBlock.cjs.map +0 -1
- package/dist/components/IDE/CodeBlock.d.ts +0 -12
- package/dist/components/IDE/CodeBlock.d.ts.map +0 -1
- package/dist/components/IDE/CodeBlock.mjs +0 -54
- package/dist/components/IDE/CodeBlock.mjs.map +0 -1
- package/dist/components/IDE/CodeBlockLoader.cjs +0 -28
- package/dist/components/IDE/CodeBlockLoader.cjs.map +0 -1
- package/dist/components/IDE/CodeBlockLoader.d.ts +0 -4
- package/dist/components/IDE/CodeBlockLoader.d.ts.map +0 -1
- package/dist/components/IDE/CodeBlockLoader.mjs +0 -28
- package/dist/components/IDE/CodeBlockLoader.mjs.map +0 -1
- package/dist/components/IDE/CodeBlockShiki.d.ts +0 -3
- package/dist/components/IDE/CodeBlockShiki.d.ts.map +0 -1
- package/dist/components/IDE/CodeRender copy.cjs +0 -141
- package/dist/components/IDE/CodeRender copy.cjs.map +0 -1
- package/dist/components/IDE/CodeRender copy.d.ts +0 -14
- package/dist/components/IDE/CodeRender copy.d.ts.map +0 -1
- package/dist/components/IDE/CodeRender copy.mjs +0 -141
- package/dist/components/IDE/CodeRender copy.mjs.map +0 -1
- package/dist/components/IDE/CodeRender.cjs +0 -49
- package/dist/components/IDE/CodeRender.cjs.map +0 -1
- package/dist/components/IDE/CodeRender.d.ts +0 -9
- package/dist/components/IDE/CodeRender.d.ts.map +0 -1
- package/dist/components/IDE/CodeRender.mjs +0 -49
- package/dist/components/IDE/CodeRender.mjs.map +0 -1
- package/dist/components/IDE/CodeRenderer.cjs +0 -27
- package/dist/components/IDE/CodeRenderer.cjs.map +0 -1
- package/dist/components/IDE/CodeRenderer.d.ts +0 -5
- package/dist/components/IDE/CodeRenderer.d.ts.map +0 -1
- package/dist/components/IDE/CodeRenderer.mjs +0 -27
- package/dist/components/IDE/CodeRenderer.mjs.map +0 -1
- package/dist/components/IDE/EditableCodeBlock.d.ts +0 -9
- package/dist/components/IDE/EditableCodeBlock.d.ts.map +0 -1
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSelectorContext.d.ts +0 -13
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSelectorContext.d.ts.map +0 -1
- package/dist/design-system.css +0 -235
- package/dist/index-Ai6eeqZH.js +0 -702
- package/dist/index-Ai6eeqZH.js.map +0 -1
- package/dist/index-B-VAyQ9R.js +0 -673
- package/dist/index-B-VAyQ9R.js.map +0 -1
- package/dist/index-B1nU1-65.cjs +0 -690
- package/dist/index-B1nU1-65.cjs.map +0 -1
- package/dist/index-B2UElBcQ.cjs +0 -200
- package/dist/index-B2UElBcQ.cjs.map +0 -1
- package/dist/index-BIV0x_z2.js +0 -206
- package/dist/index-BIV0x_z2.js.map +0 -1
- package/dist/index-BIyA5LAs.js +0 -691
- package/dist/index-BIyA5LAs.js.map +0 -1
- package/dist/index-BMzh1_UJ.js +0 -201
- package/dist/index-BMzh1_UJ.js.map +0 -1
- package/dist/index-BNH9wXVj.cjs +0 -205
- package/dist/index-BNH9wXVj.cjs.map +0 -1
- package/dist/index-BbqOa6BU.cjs +0 -701
- package/dist/index-BbqOa6BU.cjs.map +0 -1
- package/dist/index-BdTa-9zc.js +0 -201
- package/dist/index-BdTa-9zc.js.map +0 -1
- package/dist/index-BqZwP4Lr.js +0 -691
- package/dist/index-BqZwP4Lr.js.map +0 -1
- package/dist/index-BtZWYJhL.cjs +0 -200
- package/dist/index-BtZWYJhL.cjs.map +0 -1
- package/dist/index-Buecpjbh.cjs +0 -690
- package/dist/index-Buecpjbh.cjs.map +0 -1
- package/dist/index-CDEJjmId.js +0 -694
- package/dist/index-CDEJjmId.js.map +0 -1
- package/dist/index-CTAyk6RY.cjs +0 -693
- package/dist/index-CTAyk6RY.cjs.map +0 -1
- package/dist/index-CVC2sfEj.js +0 -693
- package/dist/index-CVC2sfEj.js.map +0 -1
- package/dist/index-CVz0RdK6.js +0 -691
- package/dist/index-CVz0RdK6.js.map +0 -1
- package/dist/index-CjF2ksU7.cjs +0 -693
- package/dist/index-CjF2ksU7.cjs.map +0 -1
- package/dist/index-CuQs5759.cjs +0 -692
- package/dist/index-CuQs5759.cjs.map +0 -1
- package/dist/index-D69JRZcQ.js +0 -206
- package/dist/index-D69JRZcQ.js.map +0 -1
- package/dist/index-D9oaKvKC.js +0 -201
- package/dist/index-D9oaKvKC.js.map +0 -1
- package/dist/index-DFc7og1d.cjs +0 -671
- package/dist/index-DFc7og1d.cjs.map +0 -1
- package/dist/index-DTCehvKe.cjs +0 -200
- package/dist/index-DTCehvKe.cjs.map +0 -1
- package/dist/index-D_MDocy7.cjs +0 -690
- package/dist/index-D_MDocy7.cjs.map +0 -1
- package/dist/index-DcWYZrJW.js +0 -672
- package/dist/index-DcWYZrJW.js.map +0 -1
- package/dist/index-Djo2Jnua.cjs +0 -693
- package/dist/index-Djo2Jnua.cjs.map +0 -1
- package/dist/index-LFTthFne.js +0 -694
- package/dist/index-LFTthFne.js.map +0 -1
- package/dist/index-SOIahRpS.cjs +0 -205
- package/dist/index-SOIahRpS.cjs.map +0 -1
- package/dist/index-T-TjVQoD.js +0 -671
- package/dist/index-T-TjVQoD.js.map +0 -1
- package/dist/index-f8_VC6c8.cjs +0 -672
- package/dist/index-f8_VC6c8.cjs.map +0 -1
- package/dist/index-llGIfxqV.cjs +0 -670
- package/dist/index-llGIfxqV.cjs.map +0 -1
- package/dist/index-xZoGTokf.js +0 -694
- package/dist/index-xZoGTokf.js.map +0 -1
- package/dist/jsx-runtime-CL03FswV.cjs +0 -506
- package/dist/jsx-runtime-CL03FswV.cjs.map +0 -1
- package/dist/jsx-runtime-DaNGiM0W.js +0 -945
- package/dist/jsx-runtime-DaNGiM0W.js.map +0 -1
- package/dist/jsx-runtime-XHKiWCTo.cjs +0 -944
- package/dist/jsx-runtime-XHKiWCTo.cjs.map +0 -1
- package/dist/jsx-runtime-kmx34TxC.js +0 -507
- package/dist/jsx-runtime-kmx34TxC.js.map +0 -1
- package/dist/libs/index.cjs +0 -6
- package/dist/libs/index.cjs.map +0 -1
- package/dist/libs/index.d.ts +0 -2
- package/dist/libs/index.d.ts.map +0 -1
- package/dist/libs/index.mjs +0 -6
- package/dist/libs/index.mjs.map +0 -1
- package/dist/libs/intlayer-api/ai.cjs +0 -64
- package/dist/libs/intlayer-api/ai.cjs.map +0 -1
- package/dist/libs/intlayer-api/ai.d.ts +0 -18
- package/dist/libs/intlayer-api/ai.d.ts.map +0 -1
- package/dist/libs/intlayer-api/ai.mjs +0 -64
- package/dist/libs/intlayer-api/ai.mjs.map +0 -1
- package/dist/libs/intlayer-api/auth.cjs +0 -141
- package/dist/libs/intlayer-api/auth.cjs.map +0 -1
- package/dist/libs/intlayer-api/auth.d.ts +0 -38
- package/dist/libs/intlayer-api/auth.d.ts.map +0 -1
- package/dist/libs/intlayer-api/auth.mjs +0 -141
- package/dist/libs/intlayer-api/auth.mjs.map +0 -1
- package/dist/libs/intlayer-api/dictionary.cjs +0 -78
- package/dist/libs/intlayer-api/dictionary.cjs.map +0 -1
- package/dist/libs/intlayer-api/dictionary.d.ts +0 -22
- package/dist/libs/intlayer-api/dictionary.d.ts.map +0 -1
- package/dist/libs/intlayer-api/dictionary.mjs +0 -78
- package/dist/libs/intlayer-api/dictionary.mjs.map +0 -1
- package/dist/libs/intlayer-api/fetcher.cjs +0 -73
- package/dist/libs/intlayer-api/fetcher.cjs.map +0 -1
- package/dist/libs/intlayer-api/fetcher.d.ts +0 -70
- package/dist/libs/intlayer-api/fetcher.d.ts.map +0 -1
- package/dist/libs/intlayer-api/fetcher.mjs +0 -73
- package/dist/libs/intlayer-api/fetcher.mjs.map +0 -1
- package/dist/libs/intlayer-api/index.cjs +0 -24
- package/dist/libs/intlayer-api/index.cjs.map +0 -1
- package/dist/libs/intlayer-api/index.d.ts +0 -157
- package/dist/libs/intlayer-api/index.d.ts.map +0 -1
- package/dist/libs/intlayer-api/index.mjs +0 -24
- package/dist/libs/intlayer-api/index.mjs.map +0 -1
- package/dist/libs/intlayer-api/organization.cjs +0 -96
- package/dist/libs/intlayer-api/organization.cjs.map +0 -1
- package/dist/libs/intlayer-api/organization.d.ts +0 -26
- package/dist/libs/intlayer-api/organization.d.ts.map +0 -1
- package/dist/libs/intlayer-api/organization.mjs +0 -96
- package/dist/libs/intlayer-api/organization.mjs.map +0 -1
- package/dist/libs/intlayer-api/project.cjs +0 -110
- package/dist/libs/intlayer-api/project.cjs.map +0 -1
- package/dist/libs/intlayer-api/project.d.ts +0 -28
- package/dist/libs/intlayer-api/project.d.ts.map +0 -1
- package/dist/libs/intlayer-api/project.mjs +0 -110
- package/dist/libs/intlayer-api/project.mjs.map +0 -1
- package/dist/libs/intlayer-api/stripe.cjs +0 -31
- package/dist/libs/intlayer-api/stripe.cjs.map +0 -1
- package/dist/libs/intlayer-api/stripe.d.ts +0 -8
- package/dist/libs/intlayer-api/stripe.d.ts.map +0 -1
- package/dist/libs/intlayer-api/stripe.mjs +0 -31
- package/dist/libs/intlayer-api/stripe.mjs.map +0 -1
- package/dist/libs/intlayer-api/tag.cjs +0 -52
- package/dist/libs/intlayer-api/tag.cjs.map +0 -1
- package/dist/libs/intlayer-api/tag.d.ts +0 -16
- package/dist/libs/intlayer-api/tag.d.ts.map +0 -1
- package/dist/libs/intlayer-api/tag.mjs +0 -52
- package/dist/libs/intlayer-api/tag.mjs.map +0 -1
- package/dist/libs/intlayer-api/user.cjs +0 -70
- package/dist/libs/intlayer-api/user.cjs.map +0 -1
- package/dist/libs/intlayer-api/user.d.ts +0 -22
- package/dist/libs/intlayer-api/user.d.ts.map +0 -1
- package/dist/libs/intlayer-api/user.mjs +0 -70
- package/dist/libs/intlayer-api/user.mjs.map +0 -1
- package/dist/navigation-CE0LMHcY.cjs +0 -8538
- package/dist/navigation-CE0LMHcY.cjs.map +0 -1
- package/dist/navigation-DFabQmdZ.js +0 -914
- package/dist/navigation-DFabQmdZ.js.map +0 -1
- package/dist/navigation-DRtAVQJF.js +0 -8521
- package/dist/navigation-DRtAVQJF.js.map +0 -1
- package/dist/navigation-a7EfWhxz.cjs +0 -913
- package/dist/navigation-a7EfWhxz.cjs.map +0 -1
- package/dist/shallow-lhDIFtEp.cjs +0 -48
- package/dist/shallow-lhDIFtEp.cjs.map +0 -1
- package/dist/shallow-m9BpCkKh.js +0 -49
- package/dist/shallow-m9BpCkKh.js.map +0 -1
- package/dist/useGetAllDictionaries-B1sqs2IB.cjs +0 -34
- package/dist/useGetAllDictionaries-B1sqs2IB.cjs.map +0 -1
- package/dist/useGetAllDictionaries-BbH8vTkY.js +0 -35
- package/dist/useGetAllDictionaries-BbH8vTkY.js.map +0 -1
- package/dist/useGetAllDictionaries-Bgkytpa2.cjs +0 -34
- package/dist/useGetAllDictionaries-Bgkytpa2.cjs.map +0 -1
- package/dist/useGetAllDictionaries-D8ma3h41.cjs +0 -33
- package/dist/useGetAllDictionaries-D8ma3h41.cjs.map +0 -1
- package/dist/useGetAllDictionaries-DHgHEbD5.js +0 -34
- package/dist/useGetAllDictionaries-DHgHEbD5.js.map +0 -1
- package/dist/useGetAllDictionaries-DUzm0rIa.js +0 -35
- package/dist/useGetAllDictionaries-DUzm0rIa.js.map +0 -1
- package/dist/utils/dictionary.cjs +0 -158
- package/dist/utils/dictionary.cjs.map +0 -1
- package/dist/utils/dictionary.d.ts +0 -7
- package/dist/utils/dictionary.d.ts.map +0 -1
- package/dist/utils/dictionary.mjs +0 -158
- package/dist/utils/dictionary.mjs.map +0 -1
- /package/dist/components/IDE/{CodeBlockclient.d.ts → CodeBlockClient.d.ts} +0 -0
- /package/dist/components/IDE/{CodeBlockclient.d.ts.map → CodeBlockClient.d.ts.map} +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const client = require("@intlayer/config/client");
|
|
4
|
-
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
-
const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
-
const AI_API_ROUTE = `${backendURL}/api/ai`;
|
|
8
|
-
const auditContentDeclaration = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
|
-
`${AI_API_ROUTE}/audit/content-declaration`,
|
|
10
|
-
authAPIOptions,
|
|
11
|
-
otherOptions,
|
|
12
|
-
{
|
|
13
|
-
method: "POST",
|
|
14
|
-
body
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
const auditContentDeclarationField = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
18
|
-
`${AI_API_ROUTE}/audit/content-declaration/field`,
|
|
19
|
-
authAPIOptions,
|
|
20
|
-
otherOptions,
|
|
21
|
-
{
|
|
22
|
-
method: "POST",
|
|
23
|
-
body
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
const auditContentDeclarationMetadata = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
27
|
-
`${AI_API_ROUTE}/audit/content-declaration/metadata`,
|
|
28
|
-
authAPIOptions,
|
|
29
|
-
otherOptions,
|
|
30
|
-
{
|
|
31
|
-
method: "POST",
|
|
32
|
-
body
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
const auditTag = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
36
|
-
`${AI_API_ROUTE}/audit/tag`,
|
|
37
|
-
authAPIOptions,
|
|
38
|
-
otherOptions,
|
|
39
|
-
{
|
|
40
|
-
method: "POST",
|
|
41
|
-
body
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
const askDocQuestion = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
45
|
-
`${AI_API_ROUTE}/ask`,
|
|
46
|
-
authAPIOptions,
|
|
47
|
-
otherOptions,
|
|
48
|
-
{
|
|
49
|
-
method: "POST",
|
|
50
|
-
body
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
return {
|
|
54
|
-
auditContentDeclaration,
|
|
55
|
-
auditContentDeclarationField,
|
|
56
|
-
auditContentDeclarationMetadata,
|
|
57
|
-
auditTag,
|
|
58
|
-
askDocQuestion
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
const userAPI = getAiAPI();
|
|
62
|
-
exports.getAiAPI = getAiAPI;
|
|
63
|
-
exports.userAPI = userAPI;
|
|
64
|
-
//# sourceMappingURL=ai.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai.cjs","sources":["../../../src/libs/intlayer-api/ai.ts"],"sourcesContent":["import type {\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AskDocQuestionBody,\n AskDocQuestionResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const AI_API_ROUTE = `${backendURL}/api/ai`;\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/content-declaration`,\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/content-declaration/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/content-declaration/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\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AskDocQuestionResult>(\n `${AI_API_ROUTE}/ask`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n };\n};\n\nexport const userAPI = getAiAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAeO,MAAM,WAAW,CACtB,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkBA,OAAAA,iBAAoB,GAAA;AACxD,QAAA,eAAe,GAAG,UAAU;AAOlC,QAAM,0BAA0B,OAC9B,MACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,+BAA+B,OACnC,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,kCAAkC,OACtC,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,WAAW,OACf,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAKF,QAAM,iBAAiB,OACrB,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,UAAU,SAAS;;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult, AskDocQuestionBody, AskDocQuestionResult } from '@intlayer/backend';
|
|
2
|
-
import { IntlayerConfig } from '@intlayer/config/client';
|
|
3
|
-
import { FetcherOptions } from './fetcher';
|
|
4
|
-
export declare const getAiAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
5
|
-
auditContentDeclaration: (body?: AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationResult>;
|
|
6
|
-
auditContentDeclarationField: (body?: AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationFieldResult>;
|
|
7
|
-
auditContentDeclarationMetadata: (body?: AuditContentDeclarationMetadataBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationMetadataResult>;
|
|
8
|
-
auditTag: (body?: AuditTagBody, otherOptions?: FetcherOptions) => Promise<AuditTagResult>;
|
|
9
|
-
askDocQuestion: (body?: AskDocQuestionBody, otherOptions?: FetcherOptions) => Promise<AskDocQuestionResult>;
|
|
10
|
-
};
|
|
11
|
-
export declare const userAPI: {
|
|
12
|
-
auditContentDeclaration: (body?: AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationResult>;
|
|
13
|
-
auditContentDeclarationField: (body?: AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationFieldResult>;
|
|
14
|
-
auditContentDeclarationMetadata: (body?: AuditContentDeclarationMetadataBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationMetadataResult>;
|
|
15
|
-
auditTag: (body?: AuditTagBody, otherOptions?: FetcherOptions) => Promise<AuditTagResult>;
|
|
16
|
-
askDocQuestion: (body?: AskDocQuestionBody, otherOptions?: FetcherOptions) => Promise<AskDocQuestionResult>;
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=ai.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,QAAQ,oBACH,cAAc,mBACb,cAAc;qCAWtB,2BAA2B,iBACpB,cAAc;0CAkBrB,gCAAgC,iBACzB,cAAc;6CAkBrB,mCAAmC,iBAC5B,cAAc;sBAkBrB,YAAY,iBACL,cAAc;4BAgBrB,kBAAkB,iBACX,cAAc;CAmB/B,CAAC;AAEF,eAAO,MAAM,OAAO;qCAhGT,2BAA2B,iBACpB,cAAc;0CAkBrB,gCAAgC,iBACzB,cAAc;6CAkBrB,mCAAmC,iBAC5B,cAAc;sBAkBrB,YAAY,iBACL,cAAc;4BAgBrB,kBAAkB,iBACX,cAAc;CAqBC,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { fetcher } from "./fetcher.mjs";
|
|
3
|
-
const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
-
const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;
|
|
5
|
-
const AI_API_ROUTE = `${backendURL}/api/ai`;
|
|
6
|
-
const auditContentDeclaration = async (body, otherOptions = {}) => await fetcher(
|
|
7
|
-
`${AI_API_ROUTE}/audit/content-declaration`,
|
|
8
|
-
authAPIOptions,
|
|
9
|
-
otherOptions,
|
|
10
|
-
{
|
|
11
|
-
method: "POST",
|
|
12
|
-
body
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
const auditContentDeclarationField = async (body, otherOptions = {}) => await fetcher(
|
|
16
|
-
`${AI_API_ROUTE}/audit/content-declaration/field`,
|
|
17
|
-
authAPIOptions,
|
|
18
|
-
otherOptions,
|
|
19
|
-
{
|
|
20
|
-
method: "POST",
|
|
21
|
-
body
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
const auditContentDeclarationMetadata = async (body, otherOptions = {}) => await fetcher(
|
|
25
|
-
`${AI_API_ROUTE}/audit/content-declaration/metadata`,
|
|
26
|
-
authAPIOptions,
|
|
27
|
-
otherOptions,
|
|
28
|
-
{
|
|
29
|
-
method: "POST",
|
|
30
|
-
body
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
const auditTag = async (body, otherOptions = {}) => await fetcher(
|
|
34
|
-
`${AI_API_ROUTE}/audit/tag`,
|
|
35
|
-
authAPIOptions,
|
|
36
|
-
otherOptions,
|
|
37
|
-
{
|
|
38
|
-
method: "POST",
|
|
39
|
-
body
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
const askDocQuestion = async (body, otherOptions = {}) => await fetcher(
|
|
43
|
-
`${AI_API_ROUTE}/ask`,
|
|
44
|
-
authAPIOptions,
|
|
45
|
-
otherOptions,
|
|
46
|
-
{
|
|
47
|
-
method: "POST",
|
|
48
|
-
body
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
return {
|
|
52
|
-
auditContentDeclaration,
|
|
53
|
-
auditContentDeclarationField,
|
|
54
|
-
auditContentDeclarationMetadata,
|
|
55
|
-
auditTag,
|
|
56
|
-
askDocQuestion
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const userAPI = getAiAPI();
|
|
60
|
-
export {
|
|
61
|
-
getAiAPI,
|
|
62
|
-
userAPI
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=ai.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai.mjs","sources":["../../../src/libs/intlayer-api/ai.ts"],"sourcesContent":["import type {\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n AskDocQuestionBody,\n AskDocQuestionResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const AI_API_ROUTE = `${backendURL}/api/ai`;\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/content-declaration`,\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/content-declaration/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/content-declaration/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\n */\n const askDocQuestion = async (\n body?: AskDocQuestionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AskDocQuestionResult>(\n `${AI_API_ROUTE}/ask`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n askDocQuestion,\n };\n};\n\nexport const userAPI = getAiAPI();\n"],"names":[],"mappings":";;AAeO,MAAM,WAAW,CACtB,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkB,iBAAoB,GAAA;AACxD,QAAA,eAAe,GAAG,UAAU;AAOlC,QAAM,0BAA0B,OAC9B,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,+BAA+B,OACnC,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,kCAAkC,OACtC,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,WAAW,OACf,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAKF,QAAM,iBAAiB,OACrB,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,UAAU,SAAS;"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const client = require("@intlayer/config/client");
|
|
4
|
-
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const getAuthAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
-
const { backendURL, clientId, clientSecret } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
-
const AUTH_API_ROUTE = `${backendURL}/api/auth`;
|
|
8
|
-
const login = async (user, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
|
-
`${AUTH_API_ROUTE}/login`,
|
|
10
|
-
authAPIOptions,
|
|
11
|
-
otherOptions,
|
|
12
|
-
{
|
|
13
|
-
method: "POST",
|
|
14
|
-
body: user
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
const getLoginWithGitHubURL = (params) => {
|
|
18
|
-
const searchParams = new URLSearchParams(params);
|
|
19
|
-
return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;
|
|
20
|
-
};
|
|
21
|
-
const getLoginWithGoogleURL = (params) => {
|
|
22
|
-
const searchParams = new URLSearchParams(params);
|
|
23
|
-
return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;
|
|
24
|
-
};
|
|
25
|
-
const register = async (user, query = {}, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
26
|
-
`${AUTH_API_ROUTE}/register`,
|
|
27
|
-
authAPIOptions,
|
|
28
|
-
otherOptions,
|
|
29
|
-
{
|
|
30
|
-
method: "POST",
|
|
31
|
-
body: user,
|
|
32
|
-
params: query
|
|
33
|
-
}
|
|
34
|
-
);
|
|
35
|
-
const logout = async (otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
36
|
-
`${AUTH_API_ROUTE}/logout`,
|
|
37
|
-
authAPIOptions,
|
|
38
|
-
otherOptions,
|
|
39
|
-
{
|
|
40
|
-
method: "POST"
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
const askResetPassword = async (email, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
44
|
-
`${AUTH_API_ROUTE}/password/reset`,
|
|
45
|
-
authAPIOptions,
|
|
46
|
-
otherOptions,
|
|
47
|
-
{
|
|
48
|
-
method: "POST",
|
|
49
|
-
body: { email }
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
const resetPassword = async (params, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
53
|
-
`${AUTH_API_ROUTE}/password/reset`,
|
|
54
|
-
authAPIOptions,
|
|
55
|
-
otherOptions,
|
|
56
|
-
{ params, method: "POST" }
|
|
57
|
-
);
|
|
58
|
-
const changePassword = async (data, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
59
|
-
`${AUTH_API_ROUTE}/password`,
|
|
60
|
-
authAPIOptions,
|
|
61
|
-
otherOptions,
|
|
62
|
-
{
|
|
63
|
-
method: "PUT",
|
|
64
|
-
body: data
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
const checkIfUserHasPassword = async (otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
68
|
-
`${AUTH_API_ROUTE}/password/has`,
|
|
69
|
-
authAPIOptions,
|
|
70
|
-
otherOptions,
|
|
71
|
-
{
|
|
72
|
-
method: "GET"
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
const verifyEmail = async ({ userId, secret }, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
76
|
-
`${AUTH_API_ROUTE}/active/${userId}/${secret}`,
|
|
77
|
-
authAPIOptions,
|
|
78
|
-
otherOptions,
|
|
79
|
-
{
|
|
80
|
-
method: "PUT"
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
const getVerifyEmailStatusURL = (userId) => `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;
|
|
84
|
-
const createSession = async (data, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
85
|
-
`${AUTH_API_ROUTE}/session`,
|
|
86
|
-
authAPIOptions,
|
|
87
|
-
otherOptions,
|
|
88
|
-
{
|
|
89
|
-
method: "POST",
|
|
90
|
-
body: data
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
const getSession = async (sessionToken, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
94
|
-
`${backendURL}/session`,
|
|
95
|
-
authAPIOptions,
|
|
96
|
-
otherOptions,
|
|
97
|
-
{ params: { session_token: sessionToken } }
|
|
98
|
-
);
|
|
99
|
-
const getCSRFToken = async (otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
100
|
-
`${backendURL}/csrf-token`,
|
|
101
|
-
authAPIOptions,
|
|
102
|
-
otherOptions
|
|
103
|
-
);
|
|
104
|
-
const getOAuth2AccessToken = async (otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
105
|
-
`${backendURL}/oauth2/token`,
|
|
106
|
-
authAPIOptions,
|
|
107
|
-
otherOptions,
|
|
108
|
-
{
|
|
109
|
-
method: "POST",
|
|
110
|
-
headers: {
|
|
111
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
112
|
-
},
|
|
113
|
-
body: {
|
|
114
|
-
grant_type: "client_credentials",
|
|
115
|
-
client_id: clientId,
|
|
116
|
-
client_secret: clientSecret
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
return {
|
|
121
|
-
login,
|
|
122
|
-
getLoginWithGitHubURL,
|
|
123
|
-
getLoginWithGoogleURL,
|
|
124
|
-
register,
|
|
125
|
-
logout,
|
|
126
|
-
resetPassword,
|
|
127
|
-
askResetPassword,
|
|
128
|
-
checkIfUserHasPassword,
|
|
129
|
-
verifyEmail,
|
|
130
|
-
getVerifyEmailStatusURL,
|
|
131
|
-
changePassword,
|
|
132
|
-
createSession,
|
|
133
|
-
getSession,
|
|
134
|
-
getCSRFToken,
|
|
135
|
-
getOAuth2AccessToken
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
const authAPI = getAuthAPI();
|
|
139
|
-
exports.authAPI = authAPI;
|
|
140
|
-
exports.getAuthAPI = getAuthAPI;
|
|
141
|
-
//# sourceMappingURL=auth.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.cjs","sources":["../../../src/libs/intlayer-api/auth.ts"],"sourcesContent":["import type {\n AskResetPasswordBody,\n AskResetPasswordResult,\n CreateSessionBody,\n CreateSessionResult,\n GetSessionInformationQuery,\n GithubLoginQueryParams,\n GoogleLoginQueryParams,\n GetSessionInformationResult,\n LoginBody,\n LoginResult,\n RegisterBody,\n RegisterQuery,\n RegisterResult,\n ResetPasswordParams,\n ResetPasswordResult,\n UpdatePasswordBody,\n UpdatePasswordResult,\n ValidEmailParams,\n ValidEmailResult,\n SetCSRFTokenResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n UserAPI,\n CheckIfUserHasPasswordResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL, clientId, clientSecret } = (\n intlayerConfig ?? getConfiguration()\n ).editor;\n const AUTH_API_ROUTE = `${backendURL}/api/auth`;\n\n /**\n * Logs in a user with the provided credentials.\n * @param user - User credentials.\n */\n const login = async (user: LoginBody, otherOptions: FetcherOptions = {}) =>\n await fetcher<LoginResult>(\n `${AUTH_API_ROUTE}/login`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n }\n );\n\n /**\n * Gets the login with GitHub URL.\n * @param params - The parameters for the login with GitHub URL.\n * @returns The login with GitHub URL.\n */\n const getLoginWithGitHubURL = (params: GithubLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;\n };\n\n /**\n * Gets the login with Google URL.\n * @param params - The parameters for the login with Google URL.\n * @returns The login with Google URL.\n */\n const getLoginWithGoogleURL = (params: GoogleLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;\n };\n\n /**\n * Registers a new user with the provided credentials.\n * @param user - User credentials.\n * @returns User object.\n */\n const register = async (\n user: RegisterBody,\n query: RegisterQuery = {},\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RegisterResult>(\n `${AUTH_API_ROUTE}/register`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n params: query,\n }\n );\n\n /**\n * Signs out the user.\n * @returns User object.\n */\n const logout = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<void>(\n `${AUTH_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Ask to resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const askResetPassword = async (\n email: AskResetPasswordBody['email'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AskResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { email },\n }\n );\n\n /**\n * Resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const resetPassword = async (\n params: ResetPasswordParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n { params, method: 'POST' }\n );\n\n /**\n * Changes the password of a user with the provided data.\n * @param data - New password and confirmation.\n * @returns User object.\n */\n const changePassword = async (\n data: UpdatePasswordBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdatePasswordResult>(\n `${AUTH_API_ROUTE}/password`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: data,\n }\n );\n\n /**\n * Checks if a user has a password.\n * @param params - User ID.\n * @returns User object.\n */\n const checkIfUserHasPassword = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CheckIfUserHasPasswordResult>(\n `${AUTH_API_ROUTE}/password/has`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Verifies the email address of a user with the provided token.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const verifyEmail = async (\n { userId, secret }: ValidEmailParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ValidEmailResult>(\n `${AUTH_API_ROUTE}/active/${userId}/${secret}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Gets the verify email status URL to use in the SSE.\n * @param userId - User ID.\n * @returns The verify email status URL.\n */\n const getVerifyEmailStatusURL = (userId: string | UserAPI['_id']) =>\n `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;\n\n /**\n * Creates a session for a user.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const createSession = async (\n data: CreateSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateSessionResult>(\n `${AUTH_API_ROUTE}/session`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: data,\n }\n );\n\n /**\n * Gets a session and user.\n * @param sessionToken - Session token.\n * @param otherOptions - Fetcher options.\n * @returns Session and user information.\n */\n const getSession = async (\n sessionToken?: GetSessionInformationQuery['session_token'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetSessionInformationResult>(\n `${backendURL}/session`,\n authAPIOptions,\n otherOptions,\n { params: { session_token: sessionToken } }\n );\n\n /**\n * Gets the CSRF token.\n * @param otherOptions - Fetcher options.\n * @returns The CSRF token.\n */\n const getCSRFToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<SetCSRFTokenResult>(\n `${backendURL}/csrf-token`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Gets an oAuth2 accessToken\n * @return The token information\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n `${backendURL}/oauth2/token`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n return {\n login,\n getLoginWithGitHubURL,\n getLoginWithGoogleURL,\n register,\n logout,\n resetPassword,\n askResetPassword,\n checkIfUserHasPassword,\n verifyEmail,\n getVerifyEmailStatusURL,\n changePassword,\n createSession,\n getSession,\n getCSRFToken,\n getOAuth2AccessToken,\n };\n};\n\nexport const authAPI = getAuthAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":"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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AskResetPasswordBody, AskResetPasswordResult, CreateSessionBody, CreateSessionResult, GetSessionInformationQuery, GithubLoginQueryParams, GoogleLoginQueryParams, GetSessionInformationResult, LoginBody, LoginResult, RegisterBody, RegisterQuery, RegisterResult, ResetPasswordParams, ResetPasswordResult, UpdatePasswordBody, UpdatePasswordResult, ValidEmailParams, ValidEmailResult, SetCSRFTokenResult, GetOAuth2TokenResult, UserAPI, CheckIfUserHasPasswordResult } from '@intlayer/backend';
|
|
2
|
-
import { IntlayerConfig } from '@intlayer/config/client';
|
|
3
|
-
import { FetcherOptions } from './fetcher';
|
|
4
|
-
export declare const getAuthAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
|
|
5
|
-
login: (user: LoginBody, otherOptions?: FetcherOptions) => Promise<LoginResult>;
|
|
6
|
-
getLoginWithGitHubURL: (params: GithubLoginQueryParams) => string;
|
|
7
|
-
getLoginWithGoogleURL: (params: GoogleLoginQueryParams) => string;
|
|
8
|
-
register: (user: RegisterBody, query?: RegisterQuery, otherOptions?: FetcherOptions) => Promise<RegisterResult>;
|
|
9
|
-
logout: (otherOptions?: FetcherOptions) => Promise<void>;
|
|
10
|
-
resetPassword: (params: ResetPasswordParams, otherOptions?: FetcherOptions) => Promise<ResetPasswordResult>;
|
|
11
|
-
askResetPassword: (email: AskResetPasswordBody["email"], otherOptions?: FetcherOptions) => Promise<AskResetPasswordResult>;
|
|
12
|
-
checkIfUserHasPassword: (otherOptions?: FetcherOptions) => Promise<CheckIfUserHasPasswordResult>;
|
|
13
|
-
verifyEmail: ({ userId, secret }: ValidEmailParams, otherOptions?: FetcherOptions) => Promise<ValidEmailResult>;
|
|
14
|
-
getVerifyEmailStatusURL: (userId: string | UserAPI["_id"]) => string;
|
|
15
|
-
changePassword: (data: UpdatePasswordBody, otherOptions?: FetcherOptions) => Promise<UpdatePasswordResult>;
|
|
16
|
-
createSession: (data: CreateSessionBody, otherOptions?: FetcherOptions) => Promise<CreateSessionResult>;
|
|
17
|
-
getSession: (sessionToken?: GetSessionInformationQuery["session_token"], otherOptions?: FetcherOptions) => Promise<GetSessionInformationResult>;
|
|
18
|
-
getCSRFToken: (otherOptions?: FetcherOptions) => Promise<SetCSRFTokenResult>;
|
|
19
|
-
getOAuth2AccessToken: (otherOptions?: FetcherOptions) => Promise<GetOAuth2TokenResult>;
|
|
20
|
-
};
|
|
21
|
-
export declare const authAPI: {
|
|
22
|
-
login: (user: LoginBody, otherOptions?: FetcherOptions) => Promise<LoginResult>;
|
|
23
|
-
getLoginWithGitHubURL: (params: GithubLoginQueryParams) => string;
|
|
24
|
-
getLoginWithGoogleURL: (params: GoogleLoginQueryParams) => string;
|
|
25
|
-
register: (user: RegisterBody, query?: RegisterQuery, otherOptions?: FetcherOptions) => Promise<RegisterResult>;
|
|
26
|
-
logout: (otherOptions?: FetcherOptions) => Promise<void>;
|
|
27
|
-
resetPassword: (params: ResetPasswordParams, otherOptions?: FetcherOptions) => Promise<ResetPasswordResult>;
|
|
28
|
-
askResetPassword: (email: AskResetPasswordBody["email"], otherOptions?: FetcherOptions) => Promise<AskResetPasswordResult>;
|
|
29
|
-
checkIfUserHasPassword: (otherOptions?: FetcherOptions) => Promise<CheckIfUserHasPasswordResult>;
|
|
30
|
-
verifyEmail: ({ userId, secret }: ValidEmailParams, otherOptions?: FetcherOptions) => Promise<ValidEmailResult>;
|
|
31
|
-
getVerifyEmailStatusURL: (userId: string | UserAPI["_id"]) => string;
|
|
32
|
-
changePassword: (data: UpdatePasswordBody, otherOptions?: FetcherOptions) => Promise<UpdatePasswordResult>;
|
|
33
|
-
createSession: (data: CreateSessionBody, otherOptions?: FetcherOptions) => Promise<CreateSessionResult>;
|
|
34
|
-
getSession: (sessionToken?: GetSessionInformationQuery["session_token"], otherOptions?: FetcherOptions) => Promise<GetSessionInformationResult>;
|
|
35
|
-
getCSRFToken: (otherOptions?: FetcherOptions) => Promise<SetCSRFTokenResult>;
|
|
36
|
-
getOAuth2AccessToken: (otherOptions?: FetcherOptions) => Promise<GetOAuth2TokenResult>;
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAElB,oBAAoB,EACpB,OAAO,EACP,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,UAAU,oBACL,cAAc,mBACb,cAAc;kBAWJ,SAAS,iBAAgB,cAAc;oCAgB3B,sBAAsB,KAAG,MAAM;oCAW/B,sBAAsB,KAAG,MAAM;qBAY9D,YAAY,UACX,aAAa,iBACN,cAAc;4BAiBM,cAAc;4BAmCxC,mBAAmB,iBACb,cAAc;8BApBrB,oBAAoB,CAAC,OAAO,CAAC,iBACtB,cAAc;4CAoDsB,cAAc;sCAgB5C,gBAAgB,iBACtB,cAAc;sCAgBW,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;2BAnDxD,kBAAkB,iBACV,cAAc;0BA2DtB,iBAAiB,iBACT,cAAc;gCAmBb,0BAA0B,CAAC,eAAe,CAAC,iBAC5C,cAAc;kCAcY,cAAc;0CAWN,cAAc;CAmCjE,CAAC;AAEF,eAAO,MAAM,OAAO;kBA5PS,SAAS,iBAAgB,cAAc;oCAgB3B,sBAAsB,KAAG,MAAM;oCAW/B,sBAAsB,KAAG,MAAM;qBAY9D,YAAY,UACX,aAAa,iBACN,cAAc;4BAiBM,cAAc;4BAmCxC,mBAAmB,iBACb,cAAc;8BApBrB,oBAAoB,CAAC,OAAO,CAAC,iBACtB,cAAc;4CAoDsB,cAAc;sCAgB5C,gBAAgB,iBACtB,cAAc;sCAgBW,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;2BAnDxD,kBAAkB,iBACV,cAAc;0BA2DtB,iBAAiB,iBACT,cAAc;gCAmBb,0BAA0B,CAAC,eAAe,CAAC,iBAC5C,cAAc;kCAcY,cAAc;0CAWN,cAAc;CAqC/B,CAAC"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { fetcher } from "./fetcher.mjs";
|
|
3
|
-
const getAuthAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
4
|
-
const { backendURL, clientId, clientSecret } = (intlayerConfig ?? getConfiguration()).editor;
|
|
5
|
-
const AUTH_API_ROUTE = `${backendURL}/api/auth`;
|
|
6
|
-
const login = async (user, otherOptions = {}) => await fetcher(
|
|
7
|
-
`${AUTH_API_ROUTE}/login`,
|
|
8
|
-
authAPIOptions,
|
|
9
|
-
otherOptions,
|
|
10
|
-
{
|
|
11
|
-
method: "POST",
|
|
12
|
-
body: user
|
|
13
|
-
}
|
|
14
|
-
);
|
|
15
|
-
const getLoginWithGitHubURL = (params) => {
|
|
16
|
-
const searchParams = new URLSearchParams(params);
|
|
17
|
-
return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;
|
|
18
|
-
};
|
|
19
|
-
const getLoginWithGoogleURL = (params) => {
|
|
20
|
-
const searchParams = new URLSearchParams(params);
|
|
21
|
-
return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;
|
|
22
|
-
};
|
|
23
|
-
const register = async (user, query = {}, otherOptions = {}) => await fetcher(
|
|
24
|
-
`${AUTH_API_ROUTE}/register`,
|
|
25
|
-
authAPIOptions,
|
|
26
|
-
otherOptions,
|
|
27
|
-
{
|
|
28
|
-
method: "POST",
|
|
29
|
-
body: user,
|
|
30
|
-
params: query
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
const logout = async (otherOptions = {}) => await fetcher(
|
|
34
|
-
`${AUTH_API_ROUTE}/logout`,
|
|
35
|
-
authAPIOptions,
|
|
36
|
-
otherOptions,
|
|
37
|
-
{
|
|
38
|
-
method: "POST"
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
const askResetPassword = async (email, otherOptions = {}) => await fetcher(
|
|
42
|
-
`${AUTH_API_ROUTE}/password/reset`,
|
|
43
|
-
authAPIOptions,
|
|
44
|
-
otherOptions,
|
|
45
|
-
{
|
|
46
|
-
method: "POST",
|
|
47
|
-
body: { email }
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
const resetPassword = async (params, otherOptions = {}) => await fetcher(
|
|
51
|
-
`${AUTH_API_ROUTE}/password/reset`,
|
|
52
|
-
authAPIOptions,
|
|
53
|
-
otherOptions,
|
|
54
|
-
{ params, method: "POST" }
|
|
55
|
-
);
|
|
56
|
-
const changePassword = async (data, otherOptions = {}) => await fetcher(
|
|
57
|
-
`${AUTH_API_ROUTE}/password`,
|
|
58
|
-
authAPIOptions,
|
|
59
|
-
otherOptions,
|
|
60
|
-
{
|
|
61
|
-
method: "PUT",
|
|
62
|
-
body: data
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
const checkIfUserHasPassword = async (otherOptions = {}) => await fetcher(
|
|
66
|
-
`${AUTH_API_ROUTE}/password/has`,
|
|
67
|
-
authAPIOptions,
|
|
68
|
-
otherOptions,
|
|
69
|
-
{
|
|
70
|
-
method: "GET"
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
const verifyEmail = async ({ userId, secret }, otherOptions = {}) => await fetcher(
|
|
74
|
-
`${AUTH_API_ROUTE}/active/${userId}/${secret}`,
|
|
75
|
-
authAPIOptions,
|
|
76
|
-
otherOptions,
|
|
77
|
-
{
|
|
78
|
-
method: "PUT"
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
const getVerifyEmailStatusURL = (userId) => `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;
|
|
82
|
-
const createSession = async (data, otherOptions = {}) => await fetcher(
|
|
83
|
-
`${AUTH_API_ROUTE}/session`,
|
|
84
|
-
authAPIOptions,
|
|
85
|
-
otherOptions,
|
|
86
|
-
{
|
|
87
|
-
method: "POST",
|
|
88
|
-
body: data
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
const getSession = async (sessionToken, otherOptions = {}) => await fetcher(
|
|
92
|
-
`${backendURL}/session`,
|
|
93
|
-
authAPIOptions,
|
|
94
|
-
otherOptions,
|
|
95
|
-
{ params: { session_token: sessionToken } }
|
|
96
|
-
);
|
|
97
|
-
const getCSRFToken = async (otherOptions = {}) => await fetcher(
|
|
98
|
-
`${backendURL}/csrf-token`,
|
|
99
|
-
authAPIOptions,
|
|
100
|
-
otherOptions
|
|
101
|
-
);
|
|
102
|
-
const getOAuth2AccessToken = async (otherOptions = {}) => await fetcher(
|
|
103
|
-
`${backendURL}/oauth2/token`,
|
|
104
|
-
authAPIOptions,
|
|
105
|
-
otherOptions,
|
|
106
|
-
{
|
|
107
|
-
method: "POST",
|
|
108
|
-
headers: {
|
|
109
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
110
|
-
},
|
|
111
|
-
body: {
|
|
112
|
-
grant_type: "client_credentials",
|
|
113
|
-
client_id: clientId,
|
|
114
|
-
client_secret: clientSecret
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
return {
|
|
119
|
-
login,
|
|
120
|
-
getLoginWithGitHubURL,
|
|
121
|
-
getLoginWithGoogleURL,
|
|
122
|
-
register,
|
|
123
|
-
logout,
|
|
124
|
-
resetPassword,
|
|
125
|
-
askResetPassword,
|
|
126
|
-
checkIfUserHasPassword,
|
|
127
|
-
verifyEmail,
|
|
128
|
-
getVerifyEmailStatusURL,
|
|
129
|
-
changePassword,
|
|
130
|
-
createSession,
|
|
131
|
-
getSession,
|
|
132
|
-
getCSRFToken,
|
|
133
|
-
getOAuth2AccessToken
|
|
134
|
-
};
|
|
135
|
-
};
|
|
136
|
-
const authAPI = getAuthAPI();
|
|
137
|
-
export {
|
|
138
|
-
authAPI,
|
|
139
|
-
getAuthAPI
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=auth.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.mjs","sources":["../../../src/libs/intlayer-api/auth.ts"],"sourcesContent":["import type {\n AskResetPasswordBody,\n AskResetPasswordResult,\n CreateSessionBody,\n CreateSessionResult,\n GetSessionInformationQuery,\n GithubLoginQueryParams,\n GoogleLoginQueryParams,\n GetSessionInformationResult,\n LoginBody,\n LoginResult,\n RegisterBody,\n RegisterQuery,\n RegisterResult,\n ResetPasswordParams,\n ResetPasswordResult,\n UpdatePasswordBody,\n UpdatePasswordResult,\n ValidEmailParams,\n ValidEmailResult,\n SetCSRFTokenResult,\n GetOAuth2TokenBody,\n GetOAuth2TokenResult,\n UserAPI,\n CheckIfUserHasPasswordResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAuthAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL, clientId, clientSecret } = (\n intlayerConfig ?? getConfiguration()\n ).editor;\n const AUTH_API_ROUTE = `${backendURL}/api/auth`;\n\n /**\n * Logs in a user with the provided credentials.\n * @param user - User credentials.\n */\n const login = async (user: LoginBody, otherOptions: FetcherOptions = {}) =>\n await fetcher<LoginResult>(\n `${AUTH_API_ROUTE}/login`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n }\n );\n\n /**\n * Gets the login with GitHub URL.\n * @param params - The parameters for the login with GitHub URL.\n * @returns The login with GitHub URL.\n */\n const getLoginWithGitHubURL = (params: GithubLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/github?${searchParams.toString()}`;\n };\n\n /**\n * Gets the login with Google URL.\n * @param params - The parameters for the login with Google URL.\n * @returns The login with Google URL.\n */\n const getLoginWithGoogleURL = (params: GoogleLoginQueryParams): string => {\n const searchParams = new URLSearchParams(params);\n\n return `${AUTH_API_ROUTE}/login/google?${searchParams.toString()}`;\n };\n\n /**\n * Registers a new user with the provided credentials.\n * @param user - User credentials.\n * @returns User object.\n */\n const register = async (\n user: RegisterBody,\n query: RegisterQuery = {},\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<RegisterResult>(\n `${AUTH_API_ROUTE}/register`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: user,\n params: query,\n }\n );\n\n /**\n * Signs out the user.\n * @returns User object.\n */\n const logout = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<void>(\n `${AUTH_API_ROUTE}/logout`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n }\n );\n\n /**\n * Ask to resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const askResetPassword = async (\n email: AskResetPasswordBody['email'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AskResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: { email },\n }\n );\n\n /**\n * Resets the password of a user with the provided email address.\n * @param email - Email address of the user.\n * @returns User object.\n */\n const resetPassword = async (\n params: ResetPasswordParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetPasswordResult>(\n `${AUTH_API_ROUTE}/password/reset`,\n authAPIOptions,\n otherOptions,\n { params, method: 'POST' }\n );\n\n /**\n * Changes the password of a user with the provided data.\n * @param data - New password and confirmation.\n * @returns User object.\n */\n const changePassword = async (\n data: UpdatePasswordBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdatePasswordResult>(\n `${AUTH_API_ROUTE}/password`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: data,\n }\n );\n\n /**\n * Checks if a user has a password.\n * @param params - User ID.\n * @returns User object.\n */\n const checkIfUserHasPassword = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<CheckIfUserHasPasswordResult>(\n `${AUTH_API_ROUTE}/password/has`,\n authAPIOptions,\n otherOptions,\n {\n method: 'GET',\n }\n );\n\n /**\n * Verifies the email address of a user with the provided token.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const verifyEmail = async (\n { userId, secret }: ValidEmailParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ValidEmailResult>(\n `${AUTH_API_ROUTE}/active/${userId}/${secret}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n }\n );\n\n /**\n * Gets the verify email status URL to use in the SSE.\n * @param userId - User ID.\n * @returns The verify email status URL.\n */\n const getVerifyEmailStatusURL = (userId: string | UserAPI['_id']) =>\n `${AUTH_API_ROUTE}/verify-email-status/${String(userId)}`;\n\n /**\n * Creates a session for a user.\n * @param params - User ID and secret key.\n * @returns User object.\n */\n const createSession = async (\n data: CreateSessionBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<CreateSessionResult>(\n `${AUTH_API_ROUTE}/session`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: data,\n }\n );\n\n /**\n * Gets a session and user.\n * @param sessionToken - Session token.\n * @param otherOptions - Fetcher options.\n * @returns Session and user information.\n */\n const getSession = async (\n sessionToken?: GetSessionInformationQuery['session_token'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetSessionInformationResult>(\n `${backendURL}/session`,\n authAPIOptions,\n otherOptions,\n { params: { session_token: sessionToken } }\n );\n\n /**\n * Gets the CSRF token.\n * @param otherOptions - Fetcher options.\n * @returns The CSRF token.\n */\n const getCSRFToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<SetCSRFTokenResult>(\n `${backendURL}/csrf-token`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Gets an oAuth2 accessToken\n * @return The token information\n */\n const getOAuth2AccessToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetOAuth2TokenResult>(\n `${backendURL}/oauth2/token`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n body: {\n grant_type: 'client_credentials',\n client_id: clientId!,\n client_secret: clientSecret!,\n } satisfies GetOAuth2TokenBody,\n }\n );\n\n return {\n login,\n getLoginWithGitHubURL,\n getLoginWithGoogleURL,\n register,\n logout,\n resetPassword,\n askResetPassword,\n checkIfUserHasPassword,\n verifyEmail,\n getVerifyEmailStatusURL,\n changePassword,\n createSession,\n getSession,\n getCSRFToken,\n getOAuth2AccessToken,\n };\n};\n\nexport const authAPI = getAuthAPI();\n"],"names":[],"mappings":"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"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const client = require("@intlayer/config/client");
|
|
4
|
-
const libs_intlayerApi_fetcher = require("./fetcher.cjs");
|
|
5
|
-
const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
6
|
-
const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
|
|
7
|
-
const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;
|
|
8
|
-
const getDictionaries = async (filters, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
9
|
-
PROJECT_API_ROUTE,
|
|
10
|
-
authAPIOptions,
|
|
11
|
-
otherOptions,
|
|
12
|
-
{
|
|
13
|
-
params: filters
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
const getDictionariesKeys = async (otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
17
|
-
`${PROJECT_API_ROUTE}/keys`,
|
|
18
|
-
authAPIOptions,
|
|
19
|
-
otherOptions
|
|
20
|
-
);
|
|
21
|
-
const getDictionary = async (dictionaryKey, version, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
22
|
-
`${PROJECT_API_ROUTE}/${dictionaryKey}`,
|
|
23
|
-
authAPIOptions,
|
|
24
|
-
otherOptions,
|
|
25
|
-
{
|
|
26
|
-
params: version ? { version: version.toString() } : void 0
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
const addDictionary = async (dictionary, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
30
|
-
`${PROJECT_API_ROUTE}`,
|
|
31
|
-
authAPIOptions,
|
|
32
|
-
otherOptions,
|
|
33
|
-
{
|
|
34
|
-
method: "POST",
|
|
35
|
-
body: dictionary
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
const pushDictionaries = async (dictionaries, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
39
|
-
`${PROJECT_API_ROUTE}`,
|
|
40
|
-
authAPIOptions,
|
|
41
|
-
otherOptions,
|
|
42
|
-
{
|
|
43
|
-
method: "PATCH",
|
|
44
|
-
body: { dictionaries }
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
const updateDictionary = async (dictionaryId, dictionary, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
48
|
-
`${PROJECT_API_ROUTE}/${dictionaryId}`,
|
|
49
|
-
authAPIOptions,
|
|
50
|
-
otherOptions,
|
|
51
|
-
{
|
|
52
|
-
method: "PUT",
|
|
53
|
-
body: dictionary
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
const deleteDictionary = async (id, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
|
|
57
|
-
`${PROJECT_API_ROUTE}`,
|
|
58
|
-
authAPIOptions,
|
|
59
|
-
otherOptions,
|
|
60
|
-
{
|
|
61
|
-
method: "DELETE",
|
|
62
|
-
body: { id }
|
|
63
|
-
}
|
|
64
|
-
);
|
|
65
|
-
return {
|
|
66
|
-
getDictionaries,
|
|
67
|
-
getDictionariesKeys,
|
|
68
|
-
getDictionary,
|
|
69
|
-
pushDictionaries,
|
|
70
|
-
addDictionary,
|
|
71
|
-
updateDictionary,
|
|
72
|
-
deleteDictionary
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
const dictionaryAPI = getDictionaryAPI();
|
|
76
|
-
exports.dictionaryAPI = dictionaryAPI;
|
|
77
|
-
exports.getDictionaryAPI = getDictionaryAPI;
|
|
78
|
-
//# sourceMappingURL=dictionary.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.cjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryParam,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionaryId: UpdateDictionaryParam['dictionaryId'],\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAoBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkBA,OAAAA,iBAAoB,GAAA;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAKF,QAAM,sBAAsB,OAAO,eAA+B,CAAA,MAChE,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AAOF,QAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,OAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB,IAAI,aAAa;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,eAAe;AAAA,IAAA;AAAA,EAExD;AAMF,QAAM,gBAAgB,OACpB,YACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAEF,QAAM,mBAAmB,OACvB,cACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,aAAa;AAAA,IAAA;AAAA,EAEzB;AAMF,QAAM,mBAAmB,OACvB,cACA,YACA,eAA+B,OAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB,IAAI,YAAY;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAMF,QAAM,mBAAmB,OACvB,IACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,GAAG;AAAA,IAAA;AAAA,EAEf;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,gBAAgB,iBAAiB;;;"}
|