@intlayer/api 9.6.0 → 9.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cms/createAuthManager.cjs +2 -3
- package/dist/cjs/cms/createIntlayerCMS.cjs +2 -3
- package/dist/cjs/cms/index.cjs +2 -2
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs +3 -4
- package/dist/cjs/distantDictionary/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +3 -4
- package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +1 -1
- package/dist/cjs/distantDictionary/index.cjs +2 -2
- package/dist/cjs/fetcher.cjs +2 -3
- package/dist/cjs/fetcher.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/ai.cjs +79 -26
- package/dist/cjs/getIntlayerAPI/ai.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/analytics.cjs +47 -14
- package/dist/cjs/getIntlayerAPI/analytics.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/asset.cjs +41 -12
- package/dist/cjs/getIntlayerAPI/asset.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/audit.cjs +73 -20
- package/dist/cjs/getIntlayerAPI/audit.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/bitbucket.cjs +42 -13
- package/dist/cjs/getIntlayerAPI/bitbucket.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/codeberg.cjs +20 -0
- package/dist/cjs/getIntlayerAPI/codeberg.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/dictionary.cjs +62 -17
- package/dist/cjs/getIntlayerAPI/dictionary.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/editor.cjs +3 -4
- package/dist/cjs/getIntlayerAPI/editor.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/environment.cjs +47 -14
- package/dist/cjs/getIntlayerAPI/environment.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/forge.cjs +63 -0
- package/dist/cjs/getIntlayerAPI/forge.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/gitee.cjs +20 -0
- package/dist/cjs/getIntlayerAPI/gitee.cjs.map +1 -0
- package/dist/cjs/getIntlayerAPI/github.cjs +47 -14
- package/dist/cjs/getIntlayerAPI/github.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/gitlab.cjs +42 -13
- package/dist/cjs/getIntlayerAPI/gitlab.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/index.cjs +27 -24
- package/dist/cjs/getIntlayerAPI/index.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/newsletter.cjs +31 -10
- package/dist/cjs/getIntlayerAPI/newsletter.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/oAuth.cjs +33 -8
- package/dist/cjs/getIntlayerAPI/oAuth.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/organization.cjs +75 -24
- package/dist/cjs/getIntlayerAPI/organization.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/project.cjs +115 -33
- package/dist/cjs/getIntlayerAPI/project.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/reviewer.cjs +145 -35
- package/dist/cjs/getIntlayerAPI/reviewer.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/search.cjs +18 -7
- package/dist/cjs/getIntlayerAPI/search.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/showcaseProject.cjs +64 -19
- package/dist/cjs/getIntlayerAPI/showcaseProject.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/status.cjs +19 -7
- package/dist/cjs/getIntlayerAPI/status.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/stripe.cjs +144 -39
- package/dist/cjs/getIntlayerAPI/stripe.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/tag.cjs +36 -11
- package/dist/cjs/getIntlayerAPI/tag.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/translate.cjs +49 -12
- package/dist/cjs/getIntlayerAPI/translate.cjs.map +1 -1
- package/dist/cjs/getIntlayerAPI/user.cjs +61 -18
- package/dist/cjs/getIntlayerAPI/user.cjs.map +1 -1
- package/dist/cjs/index.cjs +38 -30
- package/dist/cjs/proxy.cjs +28 -25
- package/dist/cjs/proxy.cjs.map +1 -1
- package/dist/cjs/public/createPublicClient.cjs +26 -7
- package/dist/cjs/public/createPublicClient.cjs.map +1 -1
- package/dist/cjs/public/index.cjs +1 -1
- package/dist/cjs/resolveInternalBackendUrl.cjs +1 -2
- package/dist/esm/cms/createAuthManager.mjs +1 -2
- package/dist/esm/cms/createIntlayerCMS.mjs +1 -2
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs +1 -2
- package/dist/esm/distantDictionary/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +1 -2
- package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +1 -1
- package/dist/esm/fetcher.mjs +1 -2
- package/dist/esm/fetcher.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/ai.mjs +78 -25
- package/dist/esm/getIntlayerAPI/ai.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/analytics.mjs +46 -13
- package/dist/esm/getIntlayerAPI/analytics.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/asset.mjs +40 -11
- package/dist/esm/getIntlayerAPI/asset.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/audit.mjs +72 -19
- package/dist/esm/getIntlayerAPI/audit.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/bitbucket.mjs +41 -12
- package/dist/esm/getIntlayerAPI/bitbucket.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/codeberg.mjs +18 -0
- package/dist/esm/getIntlayerAPI/codeberg.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/dictionary.mjs +61 -16
- package/dist/esm/getIntlayerAPI/dictionary.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/editor.mjs +2 -3
- package/dist/esm/getIntlayerAPI/editor.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/environment.mjs +46 -13
- package/dist/esm/getIntlayerAPI/environment.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/forge.mjs +62 -0
- package/dist/esm/getIntlayerAPI/forge.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/gitee.mjs +18 -0
- package/dist/esm/getIntlayerAPI/gitee.mjs.map +1 -0
- package/dist/esm/getIntlayerAPI/github.mjs +46 -13
- package/dist/esm/getIntlayerAPI/github.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/gitlab.mjs +41 -12
- package/dist/esm/getIntlayerAPI/gitlab.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/index.mjs +6 -3
- package/dist/esm/getIntlayerAPI/index.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/newsletter.mjs +30 -9
- package/dist/esm/getIntlayerAPI/newsletter.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/oAuth.mjs +32 -7
- package/dist/esm/getIntlayerAPI/oAuth.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/organization.mjs +74 -23
- package/dist/esm/getIntlayerAPI/organization.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/project.mjs +114 -32
- package/dist/esm/getIntlayerAPI/project.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/reviewer.mjs +144 -34
- package/dist/esm/getIntlayerAPI/reviewer.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/search.mjs +17 -6
- package/dist/esm/getIntlayerAPI/search.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/showcaseProject.mjs +63 -18
- package/dist/esm/getIntlayerAPI/showcaseProject.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/status.mjs +18 -6
- package/dist/esm/getIntlayerAPI/status.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/stripe.mjs +143 -38
- package/dist/esm/getIntlayerAPI/stripe.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/tag.mjs +35 -10
- package/dist/esm/getIntlayerAPI/tag.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/translate.mjs +48 -11
- package/dist/esm/getIntlayerAPI/translate.mjs.map +1 -1
- package/dist/esm/getIntlayerAPI/user.mjs +60 -17
- package/dist/esm/getIntlayerAPI/user.mjs.map +1 -1
- package/dist/esm/index.mjs +10 -7
- package/dist/esm/proxy.mjs +6 -3
- package/dist/esm/proxy.mjs.map +1 -1
- package/dist/esm/public/createPublicClient.mjs +26 -7
- package/dist/esm/public/createPublicClient.mjs.map +1 -1
- package/dist/esm/resolveInternalBackendUrl.mjs +1 -2
- package/dist/types/cms/createAuthManager.d.ts +1 -2
- package/dist/types/cms/createAuthManager.d.ts.map +1 -1
- package/dist/types/cms/createIntlayerCMS.d.ts +0 -2
- package/dist/types/cms/createIntlayerCMS.d.ts.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts +1 -3
- package/dist/types/distantDictionary/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +1 -3
- package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +1 -1
- package/dist/types/fetcher.d.ts +1 -3
- package/dist/types/fetcher.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/ai.d.ts +3 -5
- package/dist/types/getIntlayerAPI/ai.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/analytics.d.ts +3 -5
- package/dist/types/getIntlayerAPI/analytics.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/asset.d.ts +3 -4
- package/dist/types/getIntlayerAPI/asset.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/audit.d.ts +49 -7
- package/dist/types/getIntlayerAPI/audit.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/bitbucket.d.ts +2 -4
- package/dist/types/getIntlayerAPI/bitbucket.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/codeberg.d.ts +59 -0
- package/dist/types/getIntlayerAPI/codeberg.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/dictionary.d.ts +3 -5
- package/dist/types/getIntlayerAPI/dictionary.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/editor.d.ts +4 -5
- package/dist/types/getIntlayerAPI/editor.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/environment.d.ts +3 -5
- package/dist/types/getIntlayerAPI/environment.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/forge.d.ts +34 -0
- package/dist/types/getIntlayerAPI/forge.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/gitee.d.ts +59 -0
- package/dist/types/getIntlayerAPI/gitee.d.ts.map +1 -0
- package/dist/types/getIntlayerAPI/github.d.ts +2 -4
- package/dist/types/getIntlayerAPI/github.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/gitlab.d.ts +2 -4
- package/dist/types/getIntlayerAPI/gitlab.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/index.d.ts +6 -3
- package/dist/types/getIntlayerAPI/index.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/newsletter.d.ts +3 -5
- package/dist/types/getIntlayerAPI/newsletter.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/oAuth.d.ts +2 -2
- package/dist/types/getIntlayerAPI/oAuth.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/organization.d.ts +3 -7
- package/dist/types/getIntlayerAPI/organization.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/project.d.ts +4 -5
- package/dist/types/getIntlayerAPI/project.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/reviewer.d.ts +682 -39
- package/dist/types/getIntlayerAPI/reviewer.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/search.d.ts +3 -5
- package/dist/types/getIntlayerAPI/search.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/showcaseProject.d.ts +3 -5
- package/dist/types/getIntlayerAPI/showcaseProject.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/status.d.ts +5 -8
- package/dist/types/getIntlayerAPI/status.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/stripe.d.ts +3 -5
- package/dist/types/getIntlayerAPI/stripe.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/tag.d.ts +3 -5
- package/dist/types/getIntlayerAPI/tag.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/translate.d.ts +3 -5
- package/dist/types/getIntlayerAPI/translate.d.ts.map +1 -1
- package/dist/types/getIntlayerAPI/user.d.ts +6 -8
- package/dist/types/getIntlayerAPI/user.d.ts.map +1 -1
- package/dist/types/index.d.ts +12 -9
- package/dist/types/proxy.d.ts +0 -2
- package/dist/types/proxy.d.ts.map +1 -1
- package/dist/types/public/createPublicClient.d.ts +1 -9
- package/dist/types/public/createPublicClient.d.ts.map +1 -1
- package/dist/types/resolveInternalBackendUrl.d.ts +0 -2
- package/dist/types/resolveInternalBackendUrl.d.ts.map +1 -1
- package/dist/types/types.d.ts +5 -2
- package/package.json +23 -6
|
@@ -1,32 +1,78 @@
|
|
|
1
|
-
import { fetcher } from "../fetcher.mjs";
|
|
2
1
|
import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
|
|
2
|
+
import { fetcher } from "../fetcher.mjs";
|
|
3
3
|
import { editor } from "@intlayer/config/built";
|
|
4
|
+
import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
|
|
5
|
+
import { BACKEND_URL } from "@intlayer/config/defaultValues";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
// src/getIntlayerAPI/dictionary.ts
|
|
8
|
+
/** Prefix of the routes, checked against the backend contract. */
|
|
9
|
+
const dictionaryGroup = { prefix: "/api/dictionary" };
|
|
10
|
+
/**
|
|
11
|
+
* Method and path of every route, checked against the backend contract at
|
|
12
|
+
* compile time (the contract's zod schemas are never loaded).
|
|
13
|
+
*/
|
|
14
|
+
const dictionaryEndpoints = {
|
|
15
|
+
getDictionaries: {
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/"
|
|
18
|
+
},
|
|
19
|
+
getDictionariesKeys: {
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: "/keys"
|
|
22
|
+
},
|
|
23
|
+
getDictionariesUpdateTimestamp: {
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/update"
|
|
26
|
+
},
|
|
27
|
+
getDictionariesByKeys: {
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: "/by-keys"
|
|
30
|
+
},
|
|
31
|
+
getDictionary: {
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/:dictionaryKey"
|
|
34
|
+
},
|
|
35
|
+
addDictionary: {
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: "/"
|
|
38
|
+
},
|
|
39
|
+
pushDictionaries: {
|
|
40
|
+
method: "PATCH",
|
|
41
|
+
path: "/"
|
|
42
|
+
},
|
|
43
|
+
updateDictionary: {
|
|
44
|
+
method: "PUT",
|
|
45
|
+
path: "/:dictionaryId"
|
|
46
|
+
},
|
|
47
|
+
deleteDictionary: {
|
|
48
|
+
method: "DELETE",
|
|
49
|
+
path: "/:dictionaryId"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
6
52
|
const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
7
|
-
const
|
|
53
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
|
|
8
54
|
/**
|
|
9
55
|
* Retrieves a list of dictionaries based on filters and pagination.
|
|
10
56
|
* @param filters - Filters and pagination options.
|
|
11
57
|
*/
|
|
12
|
-
const getDictionaries = async (filters, otherOptions = {}) => await fetcher(
|
|
58
|
+
const getDictionaries = async (filters, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.getDictionaries), authAPIOptions, otherOptions, {
|
|
13
59
|
cache: "no-store",
|
|
14
60
|
params: filters
|
|
15
61
|
});
|
|
16
62
|
/**
|
|
17
63
|
* Retrieves a list of dictionary keys related to the project.
|
|
18
64
|
*/
|
|
19
|
-
const getDictionariesKeys = async (otherOptions = {}) => await fetcher(
|
|
65
|
+
const getDictionariesKeys = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.getDictionariesKeys), authAPIOptions, otherOptions, { cache: "no-store" });
|
|
20
66
|
/**
|
|
21
67
|
* Retrieves a list of dictionary keys related to the project.
|
|
22
68
|
*/
|
|
23
|
-
const getDictionariesUpdateTimestamp = async (otherOptions = {}) => await fetcher(
|
|
69
|
+
const getDictionariesUpdateTimestamp = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.getDictionariesUpdateTimestamp), authAPIOptions, otherOptions, { cache: "no-store" });
|
|
24
70
|
/**
|
|
25
71
|
* Retrieves a dictionary by its key and version.
|
|
26
72
|
* @param dictionaryKey - Dictionary key.
|
|
27
73
|
* @param version - Dictionary version of content.
|
|
28
74
|
*/
|
|
29
|
-
const getDictionary = async (dictionaryKey, version, otherOptions = {}) => await fetcher(
|
|
75
|
+
const getDictionary = async (dictionaryKey, version, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.getDictionary, { dictionaryKey }), authAPIOptions, otherOptions, { params: version ? { version: version.toString() } : void 0 });
|
|
30
76
|
/**
|
|
31
77
|
* Retrieves several dictionaries at once from their keys, in a single
|
|
32
78
|
* request. Keys matching no dictionary are absent from the result, so the
|
|
@@ -35,7 +81,7 @@ const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
35
81
|
* @param dictionaryKeys - Dictionary keys to retrieve.
|
|
36
82
|
* @param version - Dictionary version of content.
|
|
37
83
|
*/
|
|
38
|
-
const getDictionariesByKeys = async (dictionaryKeys, version, otherOptions = {}) => await fetcher(
|
|
84
|
+
const getDictionariesByKeys = async (dictionaryKeys, version, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.getDictionariesByKeys), authAPIOptions, otherOptions, {
|
|
39
85
|
cache: "no-store",
|
|
40
86
|
params: {
|
|
41
87
|
keys: dictionaryKeys.join(","),
|
|
@@ -46,27 +92,27 @@ const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
46
92
|
* Adds a new dictionary to the database.
|
|
47
93
|
* @param dictionary - Dictionary data.
|
|
48
94
|
*/
|
|
49
|
-
const addDictionary = async (body, otherOptions = {}) => await fetcher(
|
|
50
|
-
method:
|
|
95
|
+
const addDictionary = async (body, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.addDictionary), authAPIOptions, otherOptions, {
|
|
96
|
+
method: dictionaryEndpoints.addDictionary.method,
|
|
51
97
|
body
|
|
52
98
|
});
|
|
53
|
-
const pushDictionaries = async (dictionaries, otherOptions = {}) => await fetcher(
|
|
54
|
-
method:
|
|
99
|
+
const pushDictionaries = async (dictionaries, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.pushDictionaries), authAPIOptions, otherOptions, {
|
|
100
|
+
method: dictionaryEndpoints.pushDictionaries.method,
|
|
55
101
|
body: { dictionaries }
|
|
56
102
|
});
|
|
57
103
|
/**
|
|
58
104
|
* Updates an existing dictionary in the database.
|
|
59
105
|
* @param dictionary - Updated dictionary data.
|
|
60
106
|
*/
|
|
61
|
-
const updateDictionary = async (dictionary, otherOptions = {}) => await fetcher(
|
|
62
|
-
method:
|
|
107
|
+
const updateDictionary = async (dictionary, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.updateDictionary, { dictionaryId: String(dictionary.id) }), authAPIOptions, otherOptions, {
|
|
108
|
+
method: dictionaryEndpoints.updateDictionary.method,
|
|
63
109
|
body: dictionary
|
|
64
110
|
});
|
|
65
111
|
/**
|
|
66
112
|
* Deletes a dictionary from the database by its ID.
|
|
67
113
|
* @param id - Dictionary ID.
|
|
68
114
|
*/
|
|
69
|
-
const deleteDictionary = async (id, otherOptions = {}) => await fetcher(
|
|
115
|
+
const deleteDictionary = async (id, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, dictionaryGroup, dictionaryEndpoints.deleteDictionary, { dictionaryId: String(id) }), authAPIOptions, otherOptions, { method: dictionaryEndpoints.deleteDictionary.method });
|
|
70
116
|
return {
|
|
71
117
|
getDictionaries,
|
|
72
118
|
getDictionariesKeys,
|
|
@@ -87,6 +133,5 @@ const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
87
133
|
*/
|
|
88
134
|
const dictionaryEndpoint = createEndpoint(getDictionaryAPI);
|
|
89
135
|
|
|
90
|
-
//#endregion
|
|
91
136
|
export { dictionaryEndpoint, getDictionaryAPI };
|
|
92
137
|
//# sourceMappingURL=dictionary.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/getIntlayerAPI/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesByKeysResult,\n GetDictionariesKeysResult,\n GetDictionariesParams,\n GetDictionariesResult,\n GetDictionariesUpdateTimestampResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL;\n\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 cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\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 cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesUpdateTimestamp = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesUpdateTimestampResult>(\n `${PROJECT_API_ROUTE}/update`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\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 * Retrieves several dictionaries at once from their keys, in a single\n * request. Keys matching no dictionary are absent from the result, so the\n * caller should reconcile the response against the requested keys.\n *\n * @param dictionaryKeys - Dictionary keys to retrieve.\n * @param version - Dictionary version of content.\n */\n const getDictionariesByKeys = async (\n dictionaryKeys: string[],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesByKeysResult>(\n `${PROJECT_API_ROUTE}/by-keys`,\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n params: {\n keys: dictionaryKeys.join(','),\n version: version?.toString(),\n },\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n body: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\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 dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionary.id}`,\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}/${id}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionariesUpdateTimestamp,\n getDictionary,\n getDictionariesByKeys,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\n/**\n * Authenticated `dictionary` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const dictionaryEndpoint = createEndpoint(getDictionaryAPI);\n"],"mappings":";;;;;AAuBA,MAAa,oBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,oBAAoB,GAFP,gBAAgB,QAAQ,cAAc,OAAO,WAExB;;;;;CAMxC,MAAM,kBAAkB,OACtB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,mBACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;CAKF,MAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,MAAM,QACJ,GAAG,kBAAkB,QACrB,gBACA,cACA,EACE,OAAO,WACT,CACF;;;;CAKF,MAAM,iCAAiC,OACrC,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,UACrB,gBACA,cACA,EACE,OAAO,WACT,CACF;;;;;;CAOF,MAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,iBACxB,gBACA,cACA,EACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,SAAS,EAAE,IAAI,OACtD,CACF;;;;;;;;;CAUF,MAAM,wBAAwB,OAC5B,gBACA,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,WACrB,gBACA,cACA;EACE,OAAO;EACP,QAAQ;GACN,MAAM,eAAe,KAAK,GAAG;GAC7B,SAAS,SAAS,SAAS;EAC7B;CACF,CACF;;;;;CAMF,MAAM,gBAAgB,OACpB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;CAEF,MAAM,mBAAmB,OACvB,cACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,qBACH,gBACA,cACA;EACE,QAAQ;EACR,MAAM,EAAE,aAAa;CACvB,CACF;;;;;CAMF,MAAM,mBAAmB,OACvB,YACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,WAAW,MACnC,gBACA,cACA;EACE,QAAQ;EACR,MAAM;CACR,CACF;;;;;CAMF,MAAM,mBAAmB,OACvB,IACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,kBAAkB,GAAG,MACxB,gBACA,cACA,EACE,QAAQ,SACV,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,qBAAqB,eAAe,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../src/getIntlayerAPI/dictionary.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n DictionaryRoutes,\n dictionaryContract,\n GetDictionariesByKeysResult,\n GetDictionariesKeysResult,\n GetDictionariesParams,\n GetDictionariesResult,\n GetDictionariesUpdateTimestampResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n} from '@intlayer/backend-contract/dictionary';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** Prefix of the routes, checked against the backend contract. */\nconst dictionaryGroup = {\n prefix: '/api/dictionary',\n} as const satisfies Pick<typeof dictionaryContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst dictionaryEndpoints = {\n getDictionaries: { method: 'GET', path: '/' },\n getDictionariesKeys: { method: 'GET', path: '/keys' },\n getDictionariesUpdateTimestamp: { method: 'GET', path: '/update' },\n getDictionariesByKeys: { method: 'GET', path: '/by-keys' },\n getDictionary: { method: 'GET', path: '/:dictionaryKey' },\n addDictionary: { method: 'POST', path: '/' },\n pushDictionaries: { method: 'PATCH', path: '/' },\n updateDictionary: { method: 'PUT', path: '/:dictionaryId' },\n deleteDictionary: { method: 'DELETE', path: '/:dictionaryId' },\n} as const satisfies RouteEndpoints<DictionaryRoutes>;\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Retrieves a list of 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 buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.getDictionaries\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n // @ts-ignore Number of parameter will be stringified by the fetcher\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.getDictionariesKeys\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesUpdateTimestamp = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesUpdateTimestampResult>(\n buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.getDictionariesUpdateTimestamp\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n }\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 buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.getDictionary,\n { dictionaryKey }\n ),\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Retrieves several dictionaries at once from their keys, in a single\n * request. Keys matching no dictionary are absent from the result, so the\n * caller should reconcile the response against the requested keys.\n *\n * @param dictionaryKeys - Dictionary keys to retrieve.\n * @param version - Dictionary version of content.\n */\n const getDictionariesByKeys = async (\n dictionaryKeys: string[],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesByKeysResult>(\n buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.getDictionariesByKeys\n ),\n authAPIOptions,\n otherOptions,\n {\n cache: 'no-store',\n params: {\n keys: dictionaryKeys.join(','),\n version: version?.toString(),\n },\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n body: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.addDictionary\n ),\n authAPIOptions,\n otherOptions,\n {\n method: dictionaryEndpoints.addDictionary.method,\n body,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.pushDictionaries\n ),\n authAPIOptions,\n otherOptions,\n {\n method: dictionaryEndpoints.pushDictionaries.method,\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 dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.updateDictionary,\n { dictionaryId: String(dictionary.id) }\n ),\n authAPIOptions,\n otherOptions,\n {\n method: dictionaryEndpoints.updateDictionary.method,\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 buildRouteURL(\n backendURL,\n dictionaryGroup,\n dictionaryEndpoints.deleteDictionary,\n { dictionaryId: String(id) }\n ),\n authAPIOptions,\n otherOptions,\n {\n method: dictionaryEndpoints.deleteDictionary.method,\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionariesUpdateTimestamp,\n getDictionary,\n getDictionariesByKeys,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\n/**\n * Authenticated `dictionary` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const dictionaryEndpoint = createEndpoint(getDictionaryAPI);\n"],"mappings":";;;;;;;;AA6BA,MAAM,kBAAkB,EACtB,QAAQ,kBACV;;;;;AAMA,MAAM,sBAAsB;CAC1B,iBAAiB;EAAE,QAAQ;EAAO,MAAM;CAAI;CAC5C,qBAAqB;EAAE,QAAQ;EAAO,MAAM;CAAQ;CACpD,gCAAgC;EAAE,QAAQ;EAAO,MAAM;CAAU;CACjE,uBAAuB;EAAE,QAAQ;EAAO,MAAM;CAAW;CACzD,eAAe;EAAE,QAAQ;EAAO,MAAM;CAAkB;CACxD,eAAe;EAAE,QAAQ;EAAQ,MAAM;CAAI;CAC3C,kBAAkB;EAAE,QAAQ;EAAS,MAAM;CAAI;CAC/C,kBAAkB;EAAE,QAAQ;EAAO,MAAM;CAAiB;CAC1D,kBAAkB;EAAE,QAAQ;EAAU,MAAM;CAAiB;AAC/D;AAEA,MAAa,oBACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;;;;;CAM7D,MAAM,kBAAkB,OACtB,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,eACtB,GACA,gBACA,cACA;EACE,OAAO;EAEP,QAAQ;CACV,CACF;;;;CAKF,MAAM,sBAAsB,OAAO,eAA+B,CAAC,MACjE,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,mBACtB,GACA,gBACA,cACA,EACE,OAAO,WACT,CACF;;;;CAKF,MAAM,iCAAiC,OACrC,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,8BACtB,GACA,gBACA,cACA,EACE,OAAO,WACT,CACF;;;;;;CAOF,MAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,eACpB,EAAE,cAAc,CAClB,GACA,gBACA,cACA,EACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,SAAS,EAAE,IAAI,OACtD,CACF;;;;;;;;;CAUF,MAAM,wBAAwB,OAC5B,gBACA,SACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,qBACtB,GACA,gBACA,cACA;EACE,OAAO;EACP,QAAQ;GACN,MAAM,eAAe,KAAK,GAAG;GAC7B,SAAS,SAAS,SAAS;EAC7B;CACF,CACF;;;;;CAMF,MAAM,gBAAgB,OACpB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,aACtB,GACA,gBACA,cACA;EACE,QAAQ,oBAAoB,cAAc;EAC1C;CACF,CACF;CAEF,MAAM,mBAAmB,OACvB,cACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,gBACtB,GACA,gBACA,cACA;EACE,QAAQ,oBAAoB,iBAAiB;EAC7C,MAAM,EAAE,aAAa;CACvB,CACF;;;;;CAMF,MAAM,mBAAmB,OACvB,YACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,kBACpB,EAAE,cAAc,OAAO,WAAW,EAAE,EAAE,CACxC,GACA,gBACA,cACA;EACE,QAAQ,oBAAoB,iBAAiB;EAC7C,MAAM;CACR,CACF;;;;;CAMF,MAAM,mBAAmB,OACvB,IACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,iBACA,oBAAoB,kBACpB,EAAE,cAAc,OAAO,EAAE,EAAE,CAC7B,GACA,gBACA,cACA,EACE,QAAQ,oBAAoB,iBAAiB,OAC/C,CACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,qBAAqB,eAAe,gBAAgB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fetcher } from "../fetcher.mjs";
|
|
2
1
|
import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
|
|
2
|
+
import { fetcher } from "../fetcher.mjs";
|
|
3
3
|
import { editor } from "@intlayer/config/built";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/getIntlayerAPI/editor.ts
|
|
6
6
|
const getEditorAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
7
7
|
const EDITOR_API_ROUTE = `${intlayerConfig?.editor?.editorURL ?? editor.editorURL}/api`;
|
|
8
8
|
/**
|
|
@@ -39,6 +39,5 @@ const getEditorAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
39
39
|
*/
|
|
40
40
|
const editorEndpoint = createEndpoint(getEditorAPI);
|
|
41
41
|
|
|
42
|
-
//#endregion
|
|
43
42
|
export { editorEndpoint, getEditorAPI };
|
|
44
43
|
//# sourceMappingURL=editor.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from 'intlayer-editor';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEditorAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const editorURL = intlayerConfig?.editor?.editorURL ?? editor.editorURL;\n\n const EDITOR_API_ROUTE = `${editorURL}/api`;\n\n /**\n * Get the Intlayer configuration\n */\n const getConfiguration = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetConfigurationResult> => {\n const response = await fetcher<GetConfigurationResult>(\n `${EDITOR_API_ROUTE}/config`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetConfigurationResult;\n };\n\n /**\n * Get the Intlayer configuration\n */\n const getDictionaries = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetEditorDictionariesResult> => {\n const response = await fetcher<GetEditorDictionariesResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetEditorDictionariesResult;\n };\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const writeDictionary = async (\n body: WriteContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<WriteContentDeclarationResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getDictionaries,\n getConfiguration,\n writeDictionary,\n };\n};\n\n/**\n * Authenticated `editor` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const editorEndpoint = createEndpoint(getEditorAPI);\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"editor.mjs","names":[],"sources":["../../../src/getIntlayerAPI/editor.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n} from 'intlayer-editor';\n\nexport type {\n GetConfigurationResult,\n GetEditorDictionariesResult,\n WriteContentDeclarationBody,\n WriteContentDeclarationResult,\n};\n\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEditorAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const editorURL = intlayerConfig?.editor?.editorURL ?? editor.editorURL;\n\n const EDITOR_API_ROUTE = `${editorURL}/api`;\n\n /**\n * Get the Intlayer configuration\n */\n const getConfiguration = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetConfigurationResult> => {\n const response = await fetcher<GetConfigurationResult>(\n `${EDITOR_API_ROUTE}/config`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetConfigurationResult;\n };\n\n /**\n * Get the Intlayer configuration\n */\n const getDictionaries = async (\n otherOptions: FetcherOptions = {}\n ): Promise<GetEditorDictionariesResult> => {\n const response = await fetcher<GetEditorDictionariesResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions\n );\n\n return response.data as unknown as GetEditorDictionariesResult;\n };\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const writeDictionary = async (\n body: WriteContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<WriteContentDeclarationResult>(\n `${EDITOR_API_ROUTE}/dictionary`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body,\n }\n );\n\n return {\n getDictionaries,\n getConfiguration,\n writeDictionary,\n };\n};\n\n/**\n * Authenticated `editor` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const editorEndpoint = createEndpoint(getEditorAPI);\n"],"mappings":";;;;;AAmBA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CAGH,MAAM,mBAAmB,GAFP,gBAAgB,QAAQ,aAAa,OAAO,UAExB;;;;CAKtC,MAAM,mBAAmB,OACvB,eAA+B,CAAC,MACI;EAOpC,QAAO,MANgB,QACrB,GAAG,iBAAiB,UACpB,gBACA,YACF,EAEe,CAAC;CAClB;;;;CAKA,MAAM,kBAAkB,OACtB,eAA+B,CAAC,MACS;EAOzC,QAAO,MANgB,QACrB,GAAG,iBAAiB,cACpB,gBACA,YACF,EAEe,CAAC;CAClB;;;;;CAMA,MAAM,kBAAkB,OACtB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,GAAG,iBAAiB,cACpB,gBACA,cACA;EACE,QAAQ;EACR;CACF,CACF;CAEF,OAAO;EACL;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,iBAAiB,eAAe,YAAY"}
|
|
@@ -1,23 +1,57 @@
|
|
|
1
|
-
import { fetcher } from "../fetcher.mjs";
|
|
2
1
|
import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
|
|
2
|
+
import { fetcher } from "../fetcher.mjs";
|
|
3
3
|
import { editor } from "@intlayer/config/built";
|
|
4
|
+
import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
|
|
5
|
+
import { BACKEND_URL } from "@intlayer/config/defaultValues";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// src/getIntlayerAPI/environment.ts
|
|
8
|
+
/** Prefix of the routes, checked against the backend contract. */
|
|
9
|
+
const environmentGroup = { prefix: "/api/project/environment" };
|
|
10
|
+
/**
|
|
11
|
+
* Method and path of every route, checked against the backend contract at
|
|
12
|
+
* compile time (the contract's zod schemas are never loaded).
|
|
13
|
+
*/
|
|
14
|
+
const environmentEndpoints = {
|
|
15
|
+
addEnvironment: {
|
|
9
16
|
method: "POST",
|
|
17
|
+
path: "/"
|
|
18
|
+
},
|
|
19
|
+
updateEnvironment: {
|
|
20
|
+
method: "PUT",
|
|
21
|
+
path: "/:environmentId"
|
|
22
|
+
},
|
|
23
|
+
deleteEnvironment: {
|
|
24
|
+
method: "DELETE",
|
|
25
|
+
path: "/:environmentId"
|
|
26
|
+
},
|
|
27
|
+
resetToProductionEnvironment: {
|
|
28
|
+
method: "PUT",
|
|
29
|
+
path: "/production/select"
|
|
30
|
+
},
|
|
31
|
+
selectEnvironment: {
|
|
32
|
+
method: "PUT",
|
|
33
|
+
path: "/:environmentId/select"
|
|
34
|
+
},
|
|
35
|
+
migrateEnvironment: {
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: "/migrate"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const getEnvironmentAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
41
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
|
|
42
|
+
const addEnvironment = async (body, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, environmentGroup, environmentEndpoints.addEnvironment), authAPIOptions, otherOptions, {
|
|
43
|
+
method: environmentEndpoints.addEnvironment.method,
|
|
10
44
|
body
|
|
11
45
|
});
|
|
12
|
-
const updateEnvironment = async (environmentId, body, otherOptions = {}) => await fetcher(
|
|
13
|
-
method:
|
|
46
|
+
const updateEnvironment = async (environmentId, body, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, environmentGroup, environmentEndpoints.updateEnvironment, { environmentId }), authAPIOptions, otherOptions, {
|
|
47
|
+
method: environmentEndpoints.updateEnvironment.method,
|
|
14
48
|
body
|
|
15
49
|
});
|
|
16
|
-
const deleteEnvironment = async (environmentId, otherOptions = {}) => await fetcher(
|
|
17
|
-
const selectEnvironment = async (environmentId, otherOptions = {}) => await fetcher(
|
|
18
|
-
const resetToProductionEnvironment = async (otherOptions = {}) => await fetcher(
|
|
19
|
-
const migrateEnvironment = async (body, otherOptions = {}) => await fetcher(
|
|
20
|
-
method:
|
|
50
|
+
const deleteEnvironment = async (environmentId, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, environmentGroup, environmentEndpoints.deleteEnvironment, { environmentId }), authAPIOptions, otherOptions, { method: environmentEndpoints.deleteEnvironment.method });
|
|
51
|
+
const selectEnvironment = async (environmentId, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, environmentGroup, environmentEndpoints.selectEnvironment, { environmentId }), authAPIOptions, otherOptions, { method: environmentEndpoints.selectEnvironment.method });
|
|
52
|
+
const resetToProductionEnvironment = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, environmentGroup, environmentEndpoints.resetToProductionEnvironment), authAPIOptions, otherOptions, { method: environmentEndpoints.resetToProductionEnvironment.method });
|
|
53
|
+
const migrateEnvironment = async (body, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, environmentGroup, environmentEndpoints.migrateEnvironment), authAPIOptions, otherOptions, {
|
|
54
|
+
method: environmentEndpoints.migrateEnvironment.method,
|
|
21
55
|
body
|
|
22
56
|
});
|
|
23
57
|
return {
|
|
@@ -37,6 +71,5 @@ const getEnvironmentAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
37
71
|
*/
|
|
38
72
|
const environmentEndpoint = createEndpoint(getEnvironmentAPI);
|
|
39
73
|
|
|
40
|
-
//#endregion
|
|
41
74
|
export { environmentEndpoint, getEnvironmentAPI };
|
|
42
75
|
//# sourceMappingURL=environment.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.mjs","names":[],"sources":["../../../src/getIntlayerAPI/environment.ts"],"sourcesContent":["import type {\n AddEnvironmentBody,\n AddEnvironmentResult,\n DeleteEnvironmentResult,\n MigrateEnvironmentBody,\n MigrateEnvironmentResult,\n ResetToProductionEnvironmentResult,\n SelectEnvironmentResult,\n UpdateEnvironmentBody,\n UpdateEnvironmentResult,\n} from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport const getEnvironmentAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL
|
|
1
|
+
{"version":3,"file":"environment.mjs","names":[],"sources":["../../../src/getIntlayerAPI/environment.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n AddEnvironmentBody,\n AddEnvironmentResult,\n DeleteEnvironmentResult,\n EnvironmentRoutes,\n environmentContract,\n MigrateEnvironmentBody,\n MigrateEnvironmentResult,\n ResetToProductionEnvironmentResult,\n SelectEnvironmentResult,\n UpdateEnvironmentBody,\n UpdateEnvironmentResult,\n} from '@intlayer/backend-contract/environment';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\n/** Prefix of the routes, checked against the backend contract. */\nconst environmentGroup = {\n prefix: '/api/project/environment',\n} as const satisfies Pick<typeof environmentContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst environmentEndpoints = {\n addEnvironment: { method: 'POST', path: '/' },\n updateEnvironment: { method: 'PUT', path: '/:environmentId' },\n deleteEnvironment: { method: 'DELETE', path: '/:environmentId' },\n resetToProductionEnvironment: { method: 'PUT', path: '/production/select' },\n selectEnvironment: { method: 'PUT', path: '/:environmentId/select' },\n migrateEnvironment: { method: 'POST', path: '/migrate' },\n} as const satisfies RouteEndpoints<EnvironmentRoutes>;\n\nexport const getEnvironmentAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n const addEnvironment = async (\n body: AddEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddEnvironmentResult>(\n buildRouteURL(\n backendURL,\n environmentGroup,\n environmentEndpoints.addEnvironment\n ),\n authAPIOptions,\n otherOptions,\n { method: environmentEndpoints.addEnvironment.method, body }\n );\n\n const updateEnvironment = async (\n environmentId: string,\n body: UpdateEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateEnvironmentResult>(\n buildRouteURL(\n backendURL,\n environmentGroup,\n environmentEndpoints.updateEnvironment,\n { environmentId }\n ),\n authAPIOptions,\n otherOptions,\n { method: environmentEndpoints.updateEnvironment.method, body }\n );\n\n const deleteEnvironment = async (\n environmentId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteEnvironmentResult>(\n buildRouteURL(\n backendURL,\n environmentGroup,\n environmentEndpoints.deleteEnvironment,\n { environmentId }\n ),\n authAPIOptions,\n otherOptions,\n { method: environmentEndpoints.deleteEnvironment.method }\n );\n\n const selectEnvironment = async (\n environmentId: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<SelectEnvironmentResult>(\n buildRouteURL(\n backendURL,\n environmentGroup,\n environmentEndpoints.selectEnvironment,\n { environmentId }\n ),\n authAPIOptions,\n otherOptions,\n { method: environmentEndpoints.selectEnvironment.method }\n );\n\n const resetToProductionEnvironment = async (\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ResetToProductionEnvironmentResult>(\n buildRouteURL(\n backendURL,\n environmentGroup,\n environmentEndpoints.resetToProductionEnvironment\n ),\n authAPIOptions,\n otherOptions,\n { method: environmentEndpoints.resetToProductionEnvironment.method }\n );\n\n const migrateEnvironment = async (\n body: MigrateEnvironmentBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<MigrateEnvironmentResult>(\n buildRouteURL(\n backendURL,\n environmentGroup,\n environmentEndpoints.migrateEnvironment\n ),\n authAPIOptions,\n otherOptions,\n { method: environmentEndpoints.migrateEnvironment.method, body }\n );\n\n return {\n addEnvironment,\n updateEnvironment,\n deleteEnvironment,\n selectEnvironment,\n resetToProductionEnvironment,\n migrateEnvironment,\n };\n};\n\n/**\n * Authenticated `environment` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const environmentEndpoint = createEndpoint(getEnvironmentAPI);\n"],"mappings":";;;;;;;;AAsBA,MAAM,mBAAmB,EACvB,QAAQ,2BACV;;;;;AAMA,MAAM,uBAAuB;CAC3B,gBAAgB;EAAE,QAAQ;EAAQ,MAAM;CAAI;CAC5C,mBAAmB;EAAE,QAAQ;EAAO,MAAM;CAAkB;CAC5D,mBAAmB;EAAE,QAAQ;EAAU,MAAM;CAAkB;CAC/D,8BAA8B;EAAE,QAAQ;EAAO,MAAM;CAAqB;CAC1E,mBAAmB;EAAE,QAAQ;EAAO,MAAM;CAAyB;CACnE,oBAAoB;EAAE,QAAQ;EAAQ,MAAM;CAAW;AACzD;AAEA,MAAa,qBACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;CAE7D,MAAM,iBAAiB,OACrB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,kBACA,qBAAqB,cACvB,GACA,gBACA,cACA;EAAE,QAAQ,qBAAqB,eAAe;EAAQ;CAAK,CAC7D;CAEF,MAAM,oBAAoB,OACxB,eACA,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,kBACA,qBAAqB,mBACrB,EAAE,cAAc,CAClB,GACA,gBACA,cACA;EAAE,QAAQ,qBAAqB,kBAAkB;EAAQ;CAAK,CAChE;CAEF,MAAM,oBAAoB,OACxB,eACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,kBACA,qBAAqB,mBACrB,EAAE,cAAc,CAClB,GACA,gBACA,cACA,EAAE,QAAQ,qBAAqB,kBAAkB,OAAO,CAC1D;CAEF,MAAM,oBAAoB,OACxB,eACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,kBACA,qBAAqB,mBACrB,EAAE,cAAc,CAClB,GACA,gBACA,cACA,EAAE,QAAQ,qBAAqB,kBAAkB,OAAO,CAC1D;CAEF,MAAM,+BAA+B,OACnC,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,kBACA,qBAAqB,4BACvB,GACA,gBACA,cACA,EAAE,QAAQ,qBAAqB,6BAA6B,OAAO,CACrE;CAEF,MAAM,qBAAqB,OACzB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cACE,YACA,kBACA,qBAAqB,kBACvB,GACA,gBACA,cACA;EAAE,QAAQ,qBAAqB,mBAAmB;EAAQ;CAAK,CACjE;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,sBAAsB,eAAe,iBAAiB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { fetcher } from "../fetcher.mjs";
|
|
2
|
+
import { editor } from "@intlayer/config/built";
|
|
3
|
+
import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
|
|
4
|
+
import { BACKEND_URL } from "@intlayer/config/defaultValues";
|
|
5
|
+
|
|
6
|
+
// src/getIntlayerAPI/forge.ts
|
|
7
|
+
/**
|
|
8
|
+
* Method and path of every route of a Gitea-compatible forge, checked
|
|
9
|
+
* against the backend contract at compile time.
|
|
10
|
+
*/
|
|
11
|
+
const forgeEndpoints = {
|
|
12
|
+
listRepos: {
|
|
13
|
+
method: "GET",
|
|
14
|
+
path: "/repos"
|
|
15
|
+
},
|
|
16
|
+
checkConfig: {
|
|
17
|
+
method: "POST",
|
|
18
|
+
path: "/check-config"
|
|
19
|
+
},
|
|
20
|
+
getConfigFile: {
|
|
21
|
+
method: "POST",
|
|
22
|
+
path: "/get-config-file"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Client of a Gitea-compatible forge (Codeberg, Gitee). Omitting `token` makes
|
|
27
|
+
* the backend use the account linked to the session.
|
|
28
|
+
*/
|
|
29
|
+
const createForgeAPI = (group) => (authAPIOptions = {}, intlayerConfig) => {
|
|
30
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
|
|
31
|
+
/** Repositories of the linked account. */
|
|
32
|
+
const getRepositories = async (token, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, group, forgeEndpoints.listRepos), authAPIOptions, otherOptions, { params: token ? { token } : void 0 });
|
|
33
|
+
/** Paths of the Intlayer configuration files of a repository branch. */
|
|
34
|
+
const checkIntlayerConfig = async (token, owner, repository, branch = "main", otherOptions = {}) => await fetcher(buildRouteURL(backendURL, group, forgeEndpoints.checkConfig), authAPIOptions, otherOptions, {
|
|
35
|
+
method: forgeEndpoints.checkConfig.method,
|
|
36
|
+
body: {
|
|
37
|
+
token: token ?? void 0,
|
|
38
|
+
owner,
|
|
39
|
+
repository,
|
|
40
|
+
branch
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
/** Content of an Intlayer configuration file of a repository. */
|
|
44
|
+
const getConfigFile = async (token, owner, repository, branch = "main", path = "intlayer.config.ts", otherOptions = {}) => await fetcher(buildRouteURL(backendURL, group, forgeEndpoints.getConfigFile), authAPIOptions, otherOptions, {
|
|
45
|
+
method: forgeEndpoints.getConfigFile.method,
|
|
46
|
+
body: {
|
|
47
|
+
token: token ?? void 0,
|
|
48
|
+
owner,
|
|
49
|
+
repository,
|
|
50
|
+
branch,
|
|
51
|
+
path
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
getRepositories,
|
|
56
|
+
checkIntlayerConfig,
|
|
57
|
+
getConfigFile
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { createForgeAPI };
|
|
62
|
+
//# sourceMappingURL=forge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forge.mjs","names":[],"sources":["../../../src/getIntlayerAPI/forge.ts"],"sourcesContent":["import type {\n RouteEndpoints,\n RouteGroup,\n} from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n ForgeCheckConfigResult,\n ForgeGetConfigFileResult,\n ForgeListReposResult,\n ForgeRoutes,\n} from '@intlayer/backend-contract/gitProviders';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type {\n ForgeCheckConfigResult,\n ForgeGetConfigFileResult,\n ForgeListReposResult,\n ForgeRepository,\n} from '@intlayer/backend-contract/gitProviders';\n\n/**\n * Method and path of every route of a Gitea-compatible forge, checked\n * against the backend contract at compile time.\n */\nconst forgeEndpoints = {\n listRepos: { method: 'GET', path: '/repos' },\n checkConfig: { method: 'POST', path: '/check-config' },\n getConfigFile: { method: 'POST', path: '/get-config-file' },\n} as const satisfies RouteEndpoints<ForgeRoutes>;\n\n/**\n * Client of a Gitea-compatible forge (Codeberg, Gitee). Omitting `token` makes\n * the backend use the account linked to the session.\n */\nexport const createForgeAPI =\n <Prefix extends string>(\n group: Pick<RouteGroup<Prefix, ForgeRoutes>, 'prefix'>\n ) =>\n (authAPIOptions: FetcherOptions = {}, intlayerConfig?: IntlayerConfig) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /** Repositories of the linked account. */\n const getRepositories = async (\n token?: string | null,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ForgeListReposResult>(\n buildRouteURL(backendURL, group, forgeEndpoints.listRepos),\n authAPIOptions,\n otherOptions,\n { params: token ? { token } : undefined }\n );\n\n /** Paths of the Intlayer configuration files of a repository branch. */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ForgeCheckConfigResult>(\n buildRouteURL(backendURL, group, forgeEndpoints.checkConfig),\n authAPIOptions,\n otherOptions,\n {\n method: forgeEndpoints.checkConfig.method,\n body: { token: token ?? undefined, owner, repository, branch },\n }\n );\n\n /** Content of an Intlayer configuration file of a repository. */\n const getConfigFile = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<ForgeGetConfigFileResult>(\n buildRouteURL(backendURL, group, forgeEndpoints.getConfigFile),\n authAPIOptions,\n otherOptions,\n {\n method: forgeEndpoints.getConfigFile.method,\n body: { token: token ?? undefined, owner, repository, branch, path },\n }\n );\n\n return { getRepositories, checkIntlayerConfig, getConfigFile };\n };\n"],"mappings":";;;;;;;;;;AA2BA,MAAM,iBAAiB;CACrB,WAAW;EAAE,QAAQ;EAAO,MAAM;CAAS;CAC3C,aAAa;EAAE,QAAQ;EAAQ,MAAM;CAAgB;CACrD,eAAe;EAAE,QAAQ;EAAQ,MAAM;CAAmB;AAC5D;;;;;AAMA,MAAa,kBAET,WAED,iBAAiC,CAAC,GAAG,mBAAoC;CACxE,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;;CAG7D,MAAM,kBAAkB,OACtB,OACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,OAAO,eAAe,SAAS,GACzD,gBACA,cACA,EAAE,QAAQ,QAAQ,EAAE,MAAM,IAAI,OAAU,CAC1C;;CAGF,MAAM,sBAAsB,OAC1B,OACA,OACA,YACA,SAAiB,QACjB,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,OAAO,eAAe,WAAW,GAC3D,gBACA,cACA;EACE,QAAQ,eAAe,YAAY;EACnC,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;EAAO;CAC/D,CACF;;CAGF,MAAM,gBAAgB,OACpB,OACA,OACA,YACA,SAAiB,QACjB,OAAe,sBACf,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,OAAO,eAAe,aAAa,GAC7D,gBACA,cACA;EACE,QAAQ,eAAe,cAAc;EACrC,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;EAAK;CACrE,CACF;CAEF,OAAO;EAAE;EAAiB;EAAqB;CAAc;AAC/D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
|
|
2
|
+
import { createForgeAPI } from "./forge.mjs";
|
|
3
|
+
|
|
4
|
+
// src/getIntlayerAPI/gitee.ts
|
|
5
|
+
/** Prefix of the routes, checked against the backend contract. */
|
|
6
|
+
const giteeGroup = { prefix: "/api/gitee" };
|
|
7
|
+
/** Gitee repositories of the linked account. */
|
|
8
|
+
const getGiteeAPI = createForgeAPI(giteeGroup);
|
|
9
|
+
/**
|
|
10
|
+
* Authenticated `gitee` endpoint bound to an Intlayer CMS authenticator.
|
|
11
|
+
*
|
|
12
|
+
* Pass an authenticator created with `createIntlayerCMS`, or omit it to use
|
|
13
|
+
* the build-time configuration (`@intlayer/config/built`).
|
|
14
|
+
*/
|
|
15
|
+
const giteeEndpoint = createEndpoint(getGiteeAPI);
|
|
16
|
+
|
|
17
|
+
export { getGiteeAPI, giteeEndpoint };
|
|
18
|
+
//# sourceMappingURL=gitee.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitee.mjs","names":[],"sources":["../../../src/getIntlayerAPI/gitee.ts"],"sourcesContent":["import type { giteeContract } from '@intlayer/backend-contract/gitProviders';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { createForgeAPI } from './forge';\n\n/** Prefix of the routes, checked against the backend contract. */\nconst giteeGroup = {\n prefix: '/api/gitee',\n} as const satisfies Pick<typeof giteeContract, 'prefix'>;\n\n/** Gitee repositories of the linked account. */\nexport const getGiteeAPI = createForgeAPI(giteeGroup);\n\n/**\n * Authenticated `gitee` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const giteeEndpoint = createEndpoint(getGiteeAPI);\n"],"mappings":";;;;;AAKA,MAAM,aAAa,EACjB,QAAQ,aACV;;AAGA,MAAa,cAAc,eAAe,UAAU;;;;;;;AAQpD,MAAa,gBAAgB,eAAe,WAAW"}
|
|
@@ -1,28 +1,62 @@
|
|
|
1
|
-
import { fetcher } from "../fetcher.mjs";
|
|
2
1
|
import { createEndpoint } from "../cms/createIntlayerCMS.mjs";
|
|
2
|
+
import { fetcher } from "../fetcher.mjs";
|
|
3
3
|
import { editor } from "@intlayer/config/built";
|
|
4
|
+
import { buildRouteURL } from "@intlayer/backend-contract/defineRoute";
|
|
5
|
+
import { BACKEND_URL } from "@intlayer/config/defaultValues";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
// src/getIntlayerAPI/github.ts
|
|
8
|
+
/** Prefix of the routes, checked against the backend contract. */
|
|
9
|
+
const githubGroup = { prefix: "/api/github" };
|
|
10
|
+
/**
|
|
11
|
+
* Method and path of every route, checked against the backend contract at
|
|
12
|
+
* compile time (the contract's zod schemas are never loaded).
|
|
13
|
+
*/
|
|
14
|
+
const githubEndpoints = {
|
|
15
|
+
getAuthUrl: {
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: "/auth-url"
|
|
18
|
+
},
|
|
19
|
+
authCallback: {
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: "/auth"
|
|
22
|
+
},
|
|
23
|
+
listRepos: {
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/repos"
|
|
26
|
+
},
|
|
27
|
+
checkConfig: {
|
|
28
|
+
method: "POST",
|
|
29
|
+
path: "/check-config"
|
|
30
|
+
},
|
|
31
|
+
getConfigFile: {
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/get-config-file"
|
|
34
|
+
},
|
|
35
|
+
getToken: {
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: "/token"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
6
40
|
const getGithubAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
7
|
-
const
|
|
41
|
+
const backendURL = intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;
|
|
8
42
|
/**
|
|
9
43
|
* Get GitHub OAuth authorization URL
|
|
10
44
|
* @param redirectUri - Redirect URI after OAuth authorization
|
|
11
45
|
*/
|
|
12
|
-
const getAuthUrl = async (redirectUri, otherOptions = {}) => await fetcher(
|
|
46
|
+
const getAuthUrl = async (redirectUri, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, githubGroup, githubEndpoints.getAuthUrl), authAPIOptions, otherOptions, { params: { redirectUri } });
|
|
13
47
|
/**
|
|
14
48
|
* Exchange GitHub authorization code for access token
|
|
15
49
|
* @param code - GitHub authorization code
|
|
16
50
|
*/
|
|
17
|
-
const authenticate = async (code, otherOptions = {}) => await fetcher(
|
|
18
|
-
method:
|
|
51
|
+
const authenticate = async (code, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, githubGroup, githubEndpoints.authCallback), authAPIOptions, otherOptions, {
|
|
52
|
+
method: githubEndpoints.authCallback.method,
|
|
19
53
|
body: { code }
|
|
20
54
|
});
|
|
21
55
|
/**
|
|
22
56
|
* Get user's GitHub repositories
|
|
23
57
|
* @param token - Optional GitHub access token. If not provided, backend will use session.
|
|
24
58
|
*/
|
|
25
|
-
const getRepositories = async (token, otherOptions = {}) => await fetcher(
|
|
59
|
+
const getRepositories = async (token, otherOptions = {}) => await fetcher(buildRouteURL(backendURL, githubGroup, githubEndpoints.listRepos), authAPIOptions, otherOptions, { params: token ? { token } : void 0 });
|
|
26
60
|
/**
|
|
27
61
|
* Check if intlayer.config.ts exists in a repository
|
|
28
62
|
* @param token - Optional GitHub access token. If not provided, backend will use session.
|
|
@@ -30,8 +64,8 @@ const getGithubAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
30
64
|
* @param repository - Repository name
|
|
31
65
|
* @param branch - Branch name (default: 'main')
|
|
32
66
|
*/
|
|
33
|
-
const checkIntlayerConfig = async (token, owner, repository, branch = "main", otherOptions = {}) => await fetcher(
|
|
34
|
-
method:
|
|
67
|
+
const checkIntlayerConfig = async (token, owner, repository, branch = "main", otherOptions = {}) => await fetcher(buildRouteURL(backendURL, githubGroup, githubEndpoints.checkConfig), authAPIOptions, otherOptions, {
|
|
68
|
+
method: githubEndpoints.checkConfig.method,
|
|
35
69
|
body: {
|
|
36
70
|
token: token ?? void 0,
|
|
37
71
|
owner,
|
|
@@ -47,8 +81,8 @@ const getGithubAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
47
81
|
* @param branch - Branch name (default: 'main')
|
|
48
82
|
* @param path - File path (default: 'intlayer.config.ts')
|
|
49
83
|
*/
|
|
50
|
-
const getConfigFile = async (token, owner, repository, branch = "main", path = "intlayer.config.ts", otherOptions = {}) => await fetcher(
|
|
51
|
-
method:
|
|
84
|
+
const getConfigFile = async (token, owner, repository, branch = "main", path = "intlayer.config.ts", otherOptions = {}) => await fetcher(buildRouteURL(backendURL, githubGroup, githubEndpoints.getConfigFile), authAPIOptions, otherOptions, {
|
|
85
|
+
method: githubEndpoints.getConfigFile.method,
|
|
52
86
|
body: {
|
|
53
87
|
token: token ?? void 0,
|
|
54
88
|
owner,
|
|
@@ -60,7 +94,7 @@ const getGithubAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
60
94
|
/**
|
|
61
95
|
* Get user's GitHub token
|
|
62
96
|
*/
|
|
63
|
-
const getToken = async (otherOptions = {}) => await fetcher(
|
|
97
|
+
const getToken = async (otherOptions = {}) => await fetcher(buildRouteURL(backendURL, githubGroup, githubEndpoints.getToken), authAPIOptions, otherOptions);
|
|
64
98
|
return {
|
|
65
99
|
getAuthUrl,
|
|
66
100
|
authenticate,
|
|
@@ -78,6 +112,5 @@ const getGithubAPI = (authAPIOptions = {}, intlayerConfig) => {
|
|
|
78
112
|
*/
|
|
79
113
|
const githubEndpoint = createEndpoint(getGithubAPI);
|
|
80
114
|
|
|
81
|
-
//#endregion
|
|
82
115
|
export { getGithubAPI, githubEndpoint };
|
|
83
116
|
//# sourceMappingURL=github.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitHubRepository = {\n id: number;\n name: string;\n full_name: string;\n owner: {\n login: string;\n id: number;\n };\n html_url: string;\n default_branch: string;\n private: boolean;\n};\n\nexport type GitHubAuthCallbackBody = {\n code: string;\n};\n\nexport type GitHubAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitHubListReposResult = {\n data: GitHubRepository[];\n};\n\nexport type GitHubCheckConfigBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n};\n\nexport type GitHubCheckConfigResult = {\n data: {\n hasConfig: boolean;\n };\n};\n\nexport type GitHubGetConfigFileBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n path?: string;\n};\n\nexport type GitHubGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitHubGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport type GitHubGetTokenResult = {\n data: {\n token: string;\n };\n};\n\nexport const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL
|
|
1
|
+
{"version":3,"file":"github.mjs","names":[],"sources":["../../../src/getIntlayerAPI/github.ts"],"sourcesContent":["import type { RouteEndpoints } from '@intlayer/backend-contract/defineRoute';\nimport { buildRouteURL } from '@intlayer/backend-contract/defineRoute';\nimport type {\n GitHubRoutes,\n githubContract,\n} from '@intlayer/backend-contract/gitProviders';\nimport { editor } from '@intlayer/config/built';\nimport { BACKEND_URL } from '@intlayer/config/defaultValues';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { createEndpoint } from '../cms/createIntlayerCMS';\nimport { type FetcherOptions, fetcher } from '../fetcher';\n\nexport type GitHubRepository = {\n id: number;\n name: string;\n full_name: string;\n owner: {\n login: string;\n id: number;\n };\n html_url: string;\n default_branch: string;\n private: boolean;\n};\n\nexport type GitHubAuthCallbackBody = {\n code: string;\n};\n\nexport type GitHubAuthCallbackResult = {\n data: {\n token: string;\n };\n};\n\nexport type GitHubListReposResult = {\n data: GitHubRepository[];\n};\n\nexport type GitHubCheckConfigBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n};\n\nexport type GitHubCheckConfigResult = {\n data: {\n hasConfig: boolean;\n };\n};\n\nexport type GitHubGetConfigFileBody = {\n token?: string;\n owner: string;\n repository: string;\n branch?: string;\n path?: string;\n};\n\nexport type GitHubGetConfigFileResult = {\n data: {\n content: string;\n };\n};\n\nexport type GitHubGetAuthUrlResult = {\n data: {\n authUrl: string;\n };\n};\n\nexport type GitHubGetTokenResult = {\n data: {\n token: string;\n };\n};\n\n/** Prefix of the routes, checked against the backend contract. */\nconst githubGroup = {\n prefix: '/api/github',\n} as const satisfies Pick<typeof githubContract, 'prefix'>;\n\n/**\n * Method and path of every route, checked against the backend contract at\n * compile time (the contract's zod schemas are never loaded).\n */\nconst githubEndpoints = {\n getAuthUrl: { method: 'GET', path: '/auth-url' },\n authCallback: { method: 'POST', path: '/auth' },\n listRepos: { method: 'GET', path: '/repos' },\n checkConfig: { method: 'POST', path: '/check-config' },\n getConfigFile: { method: 'POST', path: '/get-config-file' },\n getToken: { method: 'GET', path: '/token' },\n} as const satisfies RouteEndpoints<GitHubRoutes>;\n\nexport const getGithubAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const backendURL =\n intlayerConfig?.editor?.backendURL ?? editor.backendURL ?? BACKEND_URL;\n\n /**\n * Get GitHub OAuth authorization URL\n * @param redirectUri - Redirect URI after OAuth authorization\n */\n const getAuthUrl = async (\n redirectUri: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetAuthUrlResult>(\n buildRouteURL(backendURL, githubGroup, githubEndpoints.getAuthUrl),\n authAPIOptions,\n otherOptions,\n {\n params: { redirectUri },\n }\n );\n\n /**\n * Exchange GitHub authorization code for access token\n * @param code - GitHub authorization code\n */\n const authenticate = async (\n code: string,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubAuthCallbackResult>(\n buildRouteURL(backendURL, githubGroup, githubEndpoints.authCallback),\n authAPIOptions,\n otherOptions,\n {\n method: githubEndpoints.authCallback.method,\n body: { code },\n }\n );\n\n /**\n * Get user's GitHub repositories\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n */\n const getRepositories = async (\n token?: string | null,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubListReposResult>(\n buildRouteURL(backendURL, githubGroup, githubEndpoints.listRepos),\n authAPIOptions,\n otherOptions,\n {\n params: token ? { token } : undefined,\n }\n );\n\n /**\n * Check if intlayer.config.ts exists in a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n */\n const checkIntlayerConfig = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubCheckConfigResult>(\n buildRouteURL(backendURL, githubGroup, githubEndpoints.checkConfig),\n authAPIOptions,\n otherOptions,\n {\n method: githubEndpoints.checkConfig.method,\n body: { token: token ?? undefined, owner, repository, branch },\n }\n );\n\n /**\n * Get intlayer.config.ts file contents from a repository\n * @param token - Optional GitHub access token. If not provided, backend will use session.\n * @param owner - Repository owner\n * @param repository - Repository name\n * @param branch - Branch name (default: 'main')\n * @param path - File path (default: 'intlayer.config.ts')\n */\n const getConfigFile = async (\n token: string | null | undefined,\n owner: string,\n repository: string,\n branch: string = 'main',\n path: string = 'intlayer.config.ts',\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GitHubGetConfigFileResult>(\n buildRouteURL(backendURL, githubGroup, githubEndpoints.getConfigFile),\n authAPIOptions,\n otherOptions,\n {\n method: githubEndpoints.getConfigFile.method,\n body: { token: token ?? undefined, owner, repository, branch, path },\n }\n );\n\n /**\n * Get user's GitHub token\n */\n const getToken = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GitHubGetTokenResult>(\n buildRouteURL(backendURL, githubGroup, githubEndpoints.getToken),\n authAPIOptions,\n otherOptions\n );\n\n return {\n getAuthUrl,\n authenticate,\n getRepositories,\n checkIntlayerConfig,\n getConfigFile,\n getToken,\n };\n};\n\n/**\n * Authenticated `github` endpoint bound to an Intlayer CMS authenticator.\n *\n * Pass an authenticator created with `createIntlayerCMS`, or omit it to use\n * the build-time configuration (`@intlayer/config/built`).\n */\nexport const githubEndpoint = createEndpoint(getGithubAPI);\n"],"mappings":";;;;;;;;AA+EA,MAAM,cAAc,EAClB,QAAQ,cACV;;;;;AAMA,MAAM,kBAAkB;CACtB,YAAY;EAAE,QAAQ;EAAO,MAAM;CAAY;CAC/C,cAAc;EAAE,QAAQ;EAAQ,MAAM;CAAQ;CAC9C,WAAW;EAAE,QAAQ;EAAO,MAAM;CAAS;CAC3C,aAAa;EAAE,QAAQ;EAAQ,MAAM;CAAgB;CACrD,eAAe;EAAE,QAAQ;EAAQ,MAAM;CAAmB;CAC1D,UAAU;EAAE,QAAQ;EAAO,MAAM;CAAS;AAC5C;AAEA,MAAa,gBACX,iBAAiC,CAAC,GAClC,mBACG;CACH,MAAM,aACJ,gBAAgB,QAAQ,cAAc,OAAO,cAAc;;;;;CAM7D,MAAM,aAAa,OACjB,aACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,UAAU,GACjE,gBACA,cACA,EACE,QAAQ,EAAE,YAAY,EACxB,CACF;;;;;CAMF,MAAM,eAAe,OACnB,MACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,YAAY,GACnE,gBACA,cACA;EACE,QAAQ,gBAAgB,aAAa;EACrC,MAAM,EAAE,KAAK;CACf,CACF;;;;;CAMF,MAAM,kBAAkB,OACtB,OACA,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,SAAS,GAChE,gBACA,cACA,EACE,QAAQ,QAAQ,EAAE,MAAM,IAAI,OAC9B,CACF;;;;;;;;CASF,MAAM,sBAAsB,OAC1B,OACA,OACA,YACA,SAAiB,QACjB,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,WAAW,GAClE,gBACA,cACA;EACE,QAAQ,gBAAgB,YAAY;EACpC,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;EAAO;CAC/D,CACF;;;;;;;;;CAUF,MAAM,gBAAgB,OACpB,OACA,OACA,YACA,SAAiB,QACjB,OAAe,sBACf,eAA+B,CAAC,MAEhC,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,aAAa,GACpE,gBACA,cACA;EACE,QAAQ,gBAAgB,cAAc;EACtC,MAAM;GAAE,OAAO,SAAS;GAAW;GAAO;GAAY;GAAQ;EAAK;CACrE,CACF;;;;CAKF,MAAM,WAAW,OAAO,eAA+B,CAAC,MACtD,MAAM,QACJ,cAAc,YAAY,aAAa,gBAAgB,QAAQ,GAC/D,gBACA,YACF;CAEF,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;AAQA,MAAa,iBAAiB,eAAe,YAAY"}
|