@intlayer/core 4.0.3 → 4.0.5
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/index.cjs +0 -11
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/getLocaleName.mjs +13 -13
- package/dist/esm/getLocalizedUrl.mjs +1 -1
- package/dist/esm/getMultilingualUrls.mjs +2 -2
- package/dist/esm/getPathWithoutLocale.mjs +1 -1
- package/dist/esm/index.mjs +11 -23
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/index.mjs +3 -3
- package/dist/esm/transpiler/content_transformers/index.mjs +2 -2
- package/dist/esm/transpiler/content_transformers/translation/index.mjs +3 -3
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs +1 -1
- package/dist/esm/transpiler/index.mjs +1 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/cjs/dictionaryUtils.cjs +0 -186
- package/dist/cjs/dictionaryUtils.cjs.map +0 -1
- package/dist/esm/dictionaryUtils.mjs +0 -158
- package/dist/esm/dictionaryUtils.mjs.map +0 -1
- package/dist/types/dictionaryUtils.d.ts +0 -7
- package/dist/types/dictionaryUtils.d.ts.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -19,10 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var index_exports = {};
|
|
20
20
|
__export(index_exports, {
|
|
21
21
|
NodeType: () => import_types.NodeType,
|
|
22
|
-
editDictionaryByKeyPath: () => import_dictionaryUtils.editDictionaryByKeyPath,
|
|
23
22
|
enu: () => import_content_transformers.enu,
|
|
24
23
|
findMatchingCondition: () => import_content_transformers.findMatchingCondition,
|
|
25
|
-
getDictionaryValueByKeyPath: () => import_dictionaryUtils.getDictionaryValueByKeyPath,
|
|
26
24
|
getEnumerationContent: () => import_content_transformers.getEnumerationContent,
|
|
27
25
|
getHTMLTextDir: () => import_getHTMLTextDir.getHTMLTextDir,
|
|
28
26
|
getLocaleLang: () => import_getLocaleLang.getLocaleLang,
|
|
@@ -30,13 +28,10 @@ __export(index_exports, {
|
|
|
30
28
|
getLocalizedUrl: () => import_getLocalizedUrl.getLocalizedUrl,
|
|
31
29
|
getMultilingualUrls: () => import_getMultilingualUrls.getMultilingualUrls,
|
|
32
30
|
getPathWithoutLocale: () => import_getPathWithoutLocale.getPathWithoutLocale,
|
|
33
|
-
getSectionType: () => import_dictionaryUtils.getSectionType,
|
|
34
31
|
getTranslationContent: () => import_content_transformers.getTranslationContent,
|
|
35
32
|
isSameKeyPath: () => import_isSameKeyPath.isSameKeyPath,
|
|
36
33
|
localeDetector: () => import_localeDetector.localeDetector,
|
|
37
34
|
localeList: () => import_localeList.localeList,
|
|
38
|
-
removeDictionaryValueByKeyPath: () => import_dictionaryUtils.removeDictionaryValueByKeyPath,
|
|
39
|
-
renameDictionaryValueByKeyPath: () => import_dictionaryUtils.renameDictionaryValueByKeyPath,
|
|
40
35
|
t: () => import_content_transformers.t
|
|
41
36
|
});
|
|
42
37
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -51,14 +46,11 @@ var import_localeDetector = require('./localeDetector.cjs');
|
|
|
51
46
|
var import_getPathWithoutLocale = require('./getPathWithoutLocale.cjs');
|
|
52
47
|
var import_getMultilingualUrls = require('./getMultilingualUrls.cjs');
|
|
53
48
|
var import_getLocalizedUrl = require('./getLocalizedUrl.cjs');
|
|
54
|
-
var import_dictionaryUtils = require('./dictionaryUtils.cjs');
|
|
55
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
50
|
0 && (module.exports = {
|
|
57
51
|
NodeType,
|
|
58
|
-
editDictionaryByKeyPath,
|
|
59
52
|
enu,
|
|
60
53
|
findMatchingCondition,
|
|
61
|
-
getDictionaryValueByKeyPath,
|
|
62
54
|
getEnumerationContent,
|
|
63
55
|
getHTMLTextDir,
|
|
64
56
|
getLocaleLang,
|
|
@@ -66,13 +58,10 @@ var import_dictionaryUtils = require('./dictionaryUtils.cjs');
|
|
|
66
58
|
getLocalizedUrl,
|
|
67
59
|
getMultilingualUrls,
|
|
68
60
|
getPathWithoutLocale,
|
|
69
|
-
getSectionType,
|
|
70
61
|
getTranslationContent,
|
|
71
62
|
isSameKeyPath,
|
|
72
63
|
localeDetector,
|
|
73
64
|
localeList,
|
|
74
|
-
removeDictionaryValueByKeyPath,
|
|
75
|
-
renameDictionaryValueByKeyPath,
|
|
76
65
|
t
|
|
77
66
|
});
|
|
78
67
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getLocaleLang } from './getLocaleLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\nexport { getPathWithoutLocale } from './getPathWithoutLocale';\nexport { getMultilingualUrls } from './getMultilingualUrls';\nexport { getLocalizedUrl } from './getLocalizedUrl';\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getLocaleLang } from './getLocaleLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\nexport { getPathWithoutLocale } from './getPathWithoutLocale';\nexport { getMultilingualUrls } from './getMultilingualUrls';\nexport { getLocalizedUrl } from './getLocalizedUrl';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,kCAMO;AAiBP,mBAAyB;AACzB,2BAA8B;AAC9B,4BAA+B;AAC/B,2BAA8B;AAC9B,wBAA2B;AAC3B,2BAA8B;AAC9B,4BAA+B;AAC/B,kCAAqC;AACrC,iCAAoC;AACpC,6BAAgC;","names":[]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Locales } from "@intlayer/config/client";
|
|
2
|
-
import { arabicLocales } from
|
|
3
|
-
import { germanLocales } from
|
|
4
|
-
import { englishLocales } from
|
|
5
|
-
import { spanishLocales } from
|
|
6
|
-
import { frenchLocales } from
|
|
7
|
-
import { hindiLocales } from
|
|
8
|
-
import { italianLocales } from
|
|
9
|
-
import { japaneseLocales } from
|
|
10
|
-
import { koreanLocales } from
|
|
11
|
-
import { ownLocalesName } from
|
|
12
|
-
import { portugueseLocales } from
|
|
13
|
-
import { russianLocales } from
|
|
14
|
-
import { chineseLocales } from
|
|
2
|
+
import { arabicLocales } from "./localeNames/ar.mjs";
|
|
3
|
+
import { germanLocales } from "./localeNames/du.mjs";
|
|
4
|
+
import { englishLocales } from "./localeNames/en.mjs";
|
|
5
|
+
import { spanishLocales } from "./localeNames/es.mjs";
|
|
6
|
+
import { frenchLocales } from "./localeNames/fr.mjs";
|
|
7
|
+
import { hindiLocales } from "./localeNames/hi.mjs";
|
|
8
|
+
import { italianLocales } from "./localeNames/it.mjs";
|
|
9
|
+
import { japaneseLocales } from "./localeNames/ja.mjs";
|
|
10
|
+
import { koreanLocales } from "./localeNames/ko.mjs";
|
|
11
|
+
import { ownLocalesName } from "./localeNames/ownLocalesName.mjs";
|
|
12
|
+
import { portugueseLocales } from "./localeNames/pt.mjs";
|
|
13
|
+
import { russianLocales } from "./localeNames/ru.mjs";
|
|
14
|
+
import { chineseLocales } from "./localeNames/zh.mjs";
|
|
15
15
|
const localeNameTranslations = {
|
|
16
16
|
[Locales.ENGLISH]: englishLocales,
|
|
17
17
|
[Locales.ENGLISH_AUSTRALIA]: englishLocales,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { getMultilingualUrls } from
|
|
2
|
+
import { getMultilingualUrls } from "./getMultilingualUrls.mjs";
|
|
3
3
|
const { internationalization, middleware } = getConfiguration();
|
|
4
4
|
const { locales: localesDefault, defaultLocale: defaultLocaleDefault } = internationalization;
|
|
5
5
|
const { prefixDefault: prefixDefaultDefault } = middleware;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { checkIsURLAbsolute } from
|
|
3
|
-
import { getPathWithoutLocale } from
|
|
2
|
+
import { checkIsURLAbsolute } from "./checkIsURLAbsolute.mjs";
|
|
3
|
+
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
4
4
|
const { internationalization, middleware } = getConfiguration();
|
|
5
5
|
const { locales: localesDefault, defaultLocale: defaultLocaleDefault } = internationalization;
|
|
6
6
|
const { prefixDefault: prefixDefaultDefault } = middleware;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { checkIsURLAbsolute } from
|
|
2
|
+
import { checkIsURLAbsolute } from "./checkIsURLAbsolute.mjs";
|
|
3
3
|
const { internationalization } = getConfiguration();
|
|
4
4
|
const { locales: localesDefault } = internationalization;
|
|
5
5
|
const getPathWithoutLocale = (inputUrl, locales = localesDefault) => {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4,30 +4,21 @@ import {
|
|
|
4
4
|
getTranslationContent,
|
|
5
5
|
findMatchingCondition,
|
|
6
6
|
getEnumerationContent
|
|
7
|
-
} from
|
|
8
|
-
import { NodeType } from
|
|
9
|
-
import { getLocaleName } from
|
|
10
|
-
import { getHTMLTextDir } from
|
|
11
|
-
import { getLocaleLang } from
|
|
12
|
-
import { localeList } from
|
|
13
|
-
import { isSameKeyPath } from
|
|
14
|
-
import { localeDetector } from
|
|
15
|
-
import { getPathWithoutLocale } from
|
|
16
|
-
import { getMultilingualUrls } from
|
|
17
|
-
import { getLocalizedUrl } from
|
|
18
|
-
import {
|
|
19
|
-
getDictionaryValueByKeyPath,
|
|
20
|
-
editDictionaryByKeyPath,
|
|
21
|
-
removeDictionaryValueByKeyPath,
|
|
22
|
-
renameDictionaryValueByKeyPath,
|
|
23
|
-
getSectionType
|
|
24
|
-
} from './dictionaryUtils.mjs';
|
|
7
|
+
} from "./transpiler/content_transformers/index.mjs";
|
|
8
|
+
import { NodeType } from "./types/index.mjs";
|
|
9
|
+
import { getLocaleName } from "./getLocaleName.mjs";
|
|
10
|
+
import { getHTMLTextDir } from "./getHTMLTextDir.mjs";
|
|
11
|
+
import { getLocaleLang } from "./getLocaleLang.mjs";
|
|
12
|
+
import { localeList } from "./localeList.mjs";
|
|
13
|
+
import { isSameKeyPath } from "./utils/isSameKeyPath.mjs";
|
|
14
|
+
import { localeDetector } from "./localeDetector.mjs";
|
|
15
|
+
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
16
|
+
import { getMultilingualUrls } from "./getMultilingualUrls.mjs";
|
|
17
|
+
import { getLocalizedUrl } from "./getLocalizedUrl.mjs";
|
|
25
18
|
export {
|
|
26
19
|
NodeType,
|
|
27
|
-
editDictionaryByKeyPath,
|
|
28
20
|
enu,
|
|
29
21
|
findMatchingCondition,
|
|
30
|
-
getDictionaryValueByKeyPath,
|
|
31
22
|
getEnumerationContent,
|
|
32
23
|
getHTMLTextDir,
|
|
33
24
|
getLocaleLang,
|
|
@@ -35,13 +26,10 @@ export {
|
|
|
35
26
|
getLocalizedUrl,
|
|
36
27
|
getMultilingualUrls,
|
|
37
28
|
getPathWithoutLocale,
|
|
38
|
-
getSectionType,
|
|
39
29
|
getTranslationContent,
|
|
40
30
|
isSameKeyPath,
|
|
41
31
|
localeDetector,
|
|
42
32
|
localeList,
|
|
43
|
-
removeDictionaryValueByKeyPath,
|
|
44
|
-
renameDictionaryValueByKeyPath,
|
|
45
33
|
t
|
|
46
34
|
};
|
|
47
35
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getLocaleLang } from './getLocaleLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\nexport { getPathWithoutLocale } from './getPathWithoutLocale';\nexport { getMultilingualUrls } from './getMultilingualUrls';\nexport { getLocalizedUrl } from './getLocalizedUrl';\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n findMatchingCondition,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n DeclarationContent,\n KeyPath,\n ObjectNode,\n ArrayNode,\n RecursiveDictionaryValue,\n TranslationNode,\n EnumerationNode,\n DictionaryValue,\n Dictionary,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { getHTMLTextDir } from './getHTMLTextDir';\nexport { getLocaleLang } from './getLocaleLang';\nexport { localeList } from './localeList';\nexport { isSameKeyPath } from './utils/isSameKeyPath';\nexport { localeDetector } from './localeDetector';\nexport { getPathWithoutLocale } from './getPathWithoutLocale';\nexport { getMultilingualUrls } from './getMultilingualUrls';\nexport { getLocalizedUrl } from './getLocalizedUrl';\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiBP,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findMatchingCondition } from
|
|
1
|
+
import { findMatchingCondition } from "../../index.mjs";
|
|
2
2
|
const getEnumerationContent = (enumerationContent, quantity) => {
|
|
3
3
|
const key = findMatchingCondition(enumerationContent, quantity);
|
|
4
4
|
return enumerationContent[key];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./enumeration.mjs";
|
|
2
|
+
export * from "./getEnumerationContent.mjs";
|
|
3
|
+
export * from "./findMatchingCondition.mjs";
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./translation/index.mjs";
|
|
2
|
+
export * from "./enumeration/index.mjs";
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./translation.mjs";
|
|
2
|
+
export * from "./getTranslationContent.mjs";
|
|
3
|
+
export * from "./types.mjs";
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./content_transformers/index.mjs";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/types/index.mjs
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -11,5 +11,4 @@ export { localeDetector } from './localeDetector';
|
|
|
11
11
|
export { getPathWithoutLocale } from './getPathWithoutLocale';
|
|
12
12
|
export { getMultilingualUrls } from './getMultilingualUrls';
|
|
13
13
|
export { getLocalizedUrl } from './getLocalizedUrl';
|
|
14
|
-
export { getDictionaryValueByKeyPath, editDictionaryByKeyPath, removeDictionaryValueByKeyPath, renameDictionaryValueByKeyPath, getSectionType, } from './dictionaryUtils';
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,aAAa,IAAI,OAAO,GACzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,CAAC,EACD,GAAG,EACH,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,aAAa,IAAI,OAAO,GACzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,CAAC,EACD,GAAG,EACH,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,yCAAyC,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@formatjs/intl-localematcher": "^0.5.10",
|
|
62
62
|
"negotiator": "^1.0.0",
|
|
63
|
-
"@intlayer/config": "4.0.
|
|
63
|
+
"@intlayer/config": "4.0.5"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/negotiator": "^0.6.3",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
"tsup": "^8.3.5",
|
|
76
76
|
"typescript": "^5.7.3",
|
|
77
77
|
"@utils/eslint-config": "1.0.4",
|
|
78
|
+
"@utils/ts-config-types": "1.0.4",
|
|
78
79
|
"@utils/tsup-config": "1.0.4",
|
|
79
|
-
"@utils/ts-config": "1.0.4"
|
|
80
|
-
"@utils/ts-config-types": "1.0.4"
|
|
80
|
+
"@utils/ts-config": "1.0.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": ">=16.0.0",
|
|
84
|
-
"@intlayer/config": "4.0.
|
|
84
|
+
"@intlayer/config": "4.0.5"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">=14.18"
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var dictionaryUtils_exports = {};
|
|
20
|
-
__export(dictionaryUtils_exports, {
|
|
21
|
-
editDictionaryByKeyPath: () => editDictionaryByKeyPath,
|
|
22
|
-
getDictionaryValueByKeyPath: () => getDictionaryValueByKeyPath,
|
|
23
|
-
getSectionType: () => getSectionType,
|
|
24
|
-
removeDictionaryValueByKeyPath: () => removeDictionaryValueByKeyPath,
|
|
25
|
-
renameDictionaryValueByKeyPath: () => renameDictionaryValueByKeyPath
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(dictionaryUtils_exports);
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_types = require('./types/index.cjs');
|
|
30
|
-
const getDictionaryValueByKeyPath = (dictionaryContent, keyPath) => {
|
|
31
|
-
let currentValue = JSON.parse(JSON.stringify(dictionaryContent ?? {}));
|
|
32
|
-
for (const keyObj of keyPath) {
|
|
33
|
-
if (keyObj.type === import_types.NodeType.Object || keyObj.type === import_types.NodeType.Array) {
|
|
34
|
-
currentValue = currentValue?.[keyObj.key];
|
|
35
|
-
} else if (keyObj.type === import_types.NodeType.Translation) {
|
|
36
|
-
currentValue = currentValue?.[import_types.NodeType.Translation][keyObj.key];
|
|
37
|
-
} else if (keyObj.type === import_types.NodeType.Enumeration) {
|
|
38
|
-
currentValue = currentValue?.[import_types.NodeType.Enumeration][keyObj.key];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return currentValue;
|
|
42
|
-
};
|
|
43
|
-
const editDictionaryByKeyPath = (dictionaryContent, keyPath, newValue) => {
|
|
44
|
-
let currentValue = dictionaryContent;
|
|
45
|
-
let parentValue = null;
|
|
46
|
-
let lastKeys = [];
|
|
47
|
-
for (const keyObj of keyPath) {
|
|
48
|
-
parentValue = currentValue;
|
|
49
|
-
if (keyObj.type === import_types.NodeType.Object) {
|
|
50
|
-
lastKeys = [keyObj.key];
|
|
51
|
-
if (!currentValue[keyObj.key]) {
|
|
52
|
-
currentValue = {
|
|
53
|
-
...currentValue,
|
|
54
|
-
[keyObj.key]: {}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
currentValue = currentValue[keyObj.key];
|
|
58
|
-
} else if (keyObj.type === import_types.NodeType.Array) {
|
|
59
|
-
lastKeys = [keyObj.key];
|
|
60
|
-
if (!currentValue[keyObj.key]) {
|
|
61
|
-
currentValue[keyObj.key] = {};
|
|
62
|
-
}
|
|
63
|
-
currentValue = currentValue[keyObj.key];
|
|
64
|
-
} else if (keyObj.type === import_types.NodeType.Translation) {
|
|
65
|
-
lastKeys = [import_types.NodeType.Translation, keyObj.key];
|
|
66
|
-
if (!currentValue[import_types.NodeType.Translation]) {
|
|
67
|
-
currentValue[import_types.NodeType.Translation] = {
|
|
68
|
-
...currentValue[import_types.NodeType.Translation],
|
|
69
|
-
[keyObj.key]: newValue
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
currentValue = currentValue[import_types.NodeType.Translation][keyObj.key];
|
|
73
|
-
} else if (keyObj.type === import_types.NodeType.Enumeration) {
|
|
74
|
-
lastKeys = [import_types.NodeType.Enumeration, keyObj.key];
|
|
75
|
-
if (!currentValue[import_types.NodeType.Enumeration]) {
|
|
76
|
-
currentValue[import_types.NodeType.Enumeration] = {
|
|
77
|
-
...currentValue[import_types.NodeType.Enumeration],
|
|
78
|
-
[keyObj.key]: newValue
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
currentValue = currentValue[import_types.NodeType.Enumeration][keyObj.key];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (parentValue && lastKeys.length > 0) {
|
|
85
|
-
for (const key of lastKeys.slice(0, -1)) {
|
|
86
|
-
parentValue = parentValue[key];
|
|
87
|
-
}
|
|
88
|
-
if (
|
|
89
|
-
// Remove the field if the new value is undefined
|
|
90
|
-
typeof newValue === "undefined"
|
|
91
|
-
) {
|
|
92
|
-
delete parentValue[lastKeys[lastKeys.length - 1]];
|
|
93
|
-
} else {
|
|
94
|
-
parentValue[lastKeys[lastKeys.length - 1]] = newValue;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return dictionaryContent;
|
|
98
|
-
};
|
|
99
|
-
const removeDictionaryValueByKeyPath = (dictionaryContent, keyPath) => {
|
|
100
|
-
let currentValue = dictionaryContent;
|
|
101
|
-
let parentValue = null;
|
|
102
|
-
let lastKey = null;
|
|
103
|
-
for (const keyObj of keyPath) {
|
|
104
|
-
parentValue = currentValue;
|
|
105
|
-
if (keyObj.type === import_types.NodeType.Object || keyObj.type === import_types.NodeType.Array) {
|
|
106
|
-
lastKey = keyObj.key;
|
|
107
|
-
currentValue = currentValue[keyObj.key];
|
|
108
|
-
} else if (keyObj.type === import_types.NodeType.Translation) {
|
|
109
|
-
lastKey = import_types.NodeType.Translation;
|
|
110
|
-
currentValue = currentValue[import_types.NodeType.Translation][keyObj.key];
|
|
111
|
-
} else if (keyObj.type === import_types.NodeType.Enumeration) {
|
|
112
|
-
lastKey = import_types.NodeType.Enumeration;
|
|
113
|
-
currentValue = currentValue[import_types.NodeType.Enumeration][keyObj.key];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (parentValue && lastKey !== null) {
|
|
117
|
-
if (Array.isArray(parentValue)) {
|
|
118
|
-
parentValue.splice(lastKey, 1);
|
|
119
|
-
} else {
|
|
120
|
-
delete parentValue[lastKey];
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return dictionaryContent;
|
|
124
|
-
};
|
|
125
|
-
const renameDictionaryValueByKeyPath = (dictionaryContent, newKey, keyPath) => {
|
|
126
|
-
let currentValue = dictionaryContent;
|
|
127
|
-
let parentValue = null;
|
|
128
|
-
let lastKey = null;
|
|
129
|
-
for (const keyObj of keyPath) {
|
|
130
|
-
parentValue = currentValue;
|
|
131
|
-
if (keyObj.type === import_types.NodeType.Object || keyObj.type === import_types.NodeType.Array) {
|
|
132
|
-
lastKey = keyObj.key;
|
|
133
|
-
currentValue = currentValue[keyObj.key];
|
|
134
|
-
} else if (keyObj.type === import_types.NodeType.Translation) {
|
|
135
|
-
lastKey = import_types.NodeType.Translation;
|
|
136
|
-
currentValue = currentValue[import_types.NodeType.Translation][keyObj.key];
|
|
137
|
-
} else if (keyObj.type === import_types.NodeType.Enumeration) {
|
|
138
|
-
lastKey = import_types.NodeType.Enumeration;
|
|
139
|
-
currentValue = currentValue[import_types.NodeType.Enumeration][keyObj.key];
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (parentValue && lastKey !== null) {
|
|
143
|
-
if (Array.isArray(parentValue)) {
|
|
144
|
-
parentValue[lastKey] = currentValue;
|
|
145
|
-
} else {
|
|
146
|
-
const newParentValue = {};
|
|
147
|
-
for (const key of Object.keys(parentValue)) {
|
|
148
|
-
if (key === lastKey) {
|
|
149
|
-
newParentValue[newKey] = currentValue;
|
|
150
|
-
} else {
|
|
151
|
-
newParentValue[key] = parentValue[key];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
Object.keys(parentValue).forEach((key) => delete parentValue[key]);
|
|
155
|
-
Object.assign(parentValue, newParentValue);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return dictionaryContent;
|
|
159
|
-
};
|
|
160
|
-
const getSectionType = (section) => {
|
|
161
|
-
if (typeof section === "string") {
|
|
162
|
-
return import_types.NodeType.Text;
|
|
163
|
-
}
|
|
164
|
-
if (section?.nodeType === import_types.NodeType.Translation) {
|
|
165
|
-
return import_types.NodeType.Translation;
|
|
166
|
-
}
|
|
167
|
-
if (section?.nodeType === import_types.NodeType.Enumeration) {
|
|
168
|
-
return import_types.NodeType.Enumeration;
|
|
169
|
-
}
|
|
170
|
-
if (Array.isArray(section)) {
|
|
171
|
-
return import_types.NodeType.Array;
|
|
172
|
-
}
|
|
173
|
-
if ((0, import_react.isValidElement)(section)) {
|
|
174
|
-
return import_types.NodeType.ReactNode;
|
|
175
|
-
}
|
|
176
|
-
return import_types.NodeType.Object;
|
|
177
|
-
};
|
|
178
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
-
0 && (module.exports = {
|
|
180
|
-
editDictionaryByKeyPath,
|
|
181
|
-
getDictionaryValueByKeyPath,
|
|
182
|
-
getSectionType,
|
|
183
|
-
removeDictionaryValueByKeyPath,
|
|
184
|
-
renameDictionaryValueByKeyPath
|
|
185
|
-
});
|
|
186
|
-
//# sourceMappingURL=dictionaryUtils.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/dictionaryUtils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isValidElement } from 'react';\nimport { type TranslationContent, type EnumerationContent } from './transpiler';\nimport { type DictionaryValue, type KeyPath, NodeType } from './types/index';\n\nexport const getDictionaryValueByKeyPath = (\n dictionaryContent: DictionaryValue,\n keyPath: KeyPath[]\n): DictionaryValue => {\n let currentValue: any = JSON.parse(JSON.stringify(dictionaryContent ?? {}));\n\n for (const keyObj of keyPath) {\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n currentValue = currentValue?.[NodeType.Enumeration][keyObj.key];\n }\n }\n\n return currentValue as DictionaryValue;\n};\n\ntype LastKeyType = string | number;\n\nexport const editDictionaryByKeyPath = (\n dictionaryContent: DictionaryValue,\n keyPath: KeyPath[],\n newValue: DictionaryValue\n): DictionaryValue => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKeys: LastKeyType[] = [];\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object) {\n lastKeys = [keyObj.key];\n\n if (!currentValue[keyObj.key]) {\n currentValue = {\n ...currentValue,\n [keyObj.key]: {},\n };\n }\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Array) {\n lastKeys = [keyObj.key];\n\n if (!currentValue[keyObj.key]) {\n currentValue[keyObj.key] = {};\n }\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n lastKeys = [NodeType.Translation, keyObj.key];\n\n if (!currentValue[NodeType.Translation]) {\n currentValue[NodeType.Translation] = {\n ...currentValue[NodeType.Translation],\n [keyObj.key]: newValue,\n };\n }\n currentValue = currentValue[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n lastKeys = [NodeType.Enumeration, keyObj.key];\n\n if (!currentValue[NodeType.Enumeration]) {\n currentValue[NodeType.Enumeration] = {\n ...currentValue[NodeType.Enumeration],\n [keyObj.key]: newValue,\n };\n }\n currentValue = currentValue[NodeType.Enumeration][keyObj.key];\n }\n }\n\n // Assign the new value to the last key of the parent\n if (parentValue && lastKeys.length > 0) {\n for (const key of lastKeys.slice(0, -1)) {\n parentValue = parentValue[key];\n }\n if (\n // Remove the field if the new value is undefined\n typeof newValue === 'undefined'\n ) {\n delete parentValue[lastKeys[lastKeys.length - 1]];\n } else {\n parentValue[lastKeys[lastKeys.length - 1]] = newValue;\n }\n }\n\n return dictionaryContent;\n};\n\nexport const removeDictionaryValueByKeyPath = (\n dictionaryContent: DictionaryValue,\n keyPath: KeyPath[]\n): DictionaryValue => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n lastKey = NodeType.Translation;\n currentValue = currentValue[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n lastKey = NodeType.Enumeration;\n currentValue = currentValue[NodeType.Enumeration][keyObj.key];\n }\n }\n\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue.splice(lastKey as unknown as number, 1);\n } else {\n delete parentValue[lastKey];\n }\n }\n\n return dictionaryContent;\n};\n\nexport const renameDictionaryValueByKeyPath = (\n dictionaryContent: DictionaryValue,\n newKey: string | number,\n keyPath: KeyPath[]\n): DictionaryValue => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n lastKey = NodeType.Translation;\n currentValue = currentValue[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n lastKey = NodeType.Enumeration;\n currentValue = currentValue[NodeType.Enumeration][keyObj.key];\n }\n }\n\n // Assign the new value to the last key of the parent while preserving the order\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue[lastKey as number] = currentValue;\n } else {\n const newParentValue: any = {};\n for (const key of Object.keys(parentValue)) {\n if (key === lastKey) {\n newParentValue[newKey] = currentValue;\n } else {\n newParentValue[key] = parentValue[key];\n }\n }\n // Replace the contents of parentValue with newParentValue\n Object.keys(parentValue).forEach((key) => delete parentValue[key]);\n Object.assign(parentValue, newParentValue);\n }\n }\n\n return dictionaryContent;\n};\n\nexport const getSectionType = (section: DictionaryValue): NodeType => {\n if (typeof section === 'string') {\n return NodeType.Text;\n }\n\n if (\n (section as TranslationContent<unknown>)?.nodeType === NodeType.Translation\n ) {\n return NodeType.Translation;\n }\n\n if (\n (section as EnumerationContent<unknown>)?.nodeType === NodeType.Enumeration\n ) {\n return NodeType.Enumeration;\n }\n\n if (Array.isArray(section)) {\n return NodeType.Array;\n }\n\n if (isValidElement(section)) {\n return NodeType.ReactNode;\n }\n\n return NodeType.Object;\n};\n"],"mappings":";;;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AAG,CAAC;AACjE,aAAO,OAAO,aAAa,cAAc;AAAA,IAC3C;AAAA,EACF;AAEA,SAAO;AACT;AAEO,MAAM,iBAAiB,CAAC,YAAuC;AACpE,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO,sBAAS;AAAA,EAClB;AAEA,MACG,SAAyC,aAAa,sBAAS,aAChE;AACA,WAAO,sBAAS;AAAA,EAClB;AAEA,MACG,SAAyC,aAAa,sBAAS,aAChE;AACA,WAAO,sBAAS;AAAA,EAClB;AAEA,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAO,sBAAS;AAAA,EAClB;AAEA,UAAI,6BAAe,OAAO,GAAG;AAC3B,WAAO,sBAAS;AAAA,EAClB;AAEA,SAAO,sBAAS;AAClB;","names":[]}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { isValidElement } from "react";
|
|
2
|
-
import { NodeType } from './types/index.mjs';
|
|
3
|
-
const getDictionaryValueByKeyPath = (dictionaryContent, keyPath) => {
|
|
4
|
-
let currentValue = JSON.parse(JSON.stringify(dictionaryContent ?? {}));
|
|
5
|
-
for (const keyObj of keyPath) {
|
|
6
|
-
if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {
|
|
7
|
-
currentValue = currentValue?.[keyObj.key];
|
|
8
|
-
} else if (keyObj.type === NodeType.Translation) {
|
|
9
|
-
currentValue = currentValue?.[NodeType.Translation][keyObj.key];
|
|
10
|
-
} else if (keyObj.type === NodeType.Enumeration) {
|
|
11
|
-
currentValue = currentValue?.[NodeType.Enumeration][keyObj.key];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return currentValue;
|
|
15
|
-
};
|
|
16
|
-
const editDictionaryByKeyPath = (dictionaryContent, keyPath, newValue) => {
|
|
17
|
-
let currentValue = dictionaryContent;
|
|
18
|
-
let parentValue = null;
|
|
19
|
-
let lastKeys = [];
|
|
20
|
-
for (const keyObj of keyPath) {
|
|
21
|
-
parentValue = currentValue;
|
|
22
|
-
if (keyObj.type === NodeType.Object) {
|
|
23
|
-
lastKeys = [keyObj.key];
|
|
24
|
-
if (!currentValue[keyObj.key]) {
|
|
25
|
-
currentValue = {
|
|
26
|
-
...currentValue,
|
|
27
|
-
[keyObj.key]: {}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
currentValue = currentValue[keyObj.key];
|
|
31
|
-
} else if (keyObj.type === NodeType.Array) {
|
|
32
|
-
lastKeys = [keyObj.key];
|
|
33
|
-
if (!currentValue[keyObj.key]) {
|
|
34
|
-
currentValue[keyObj.key] = {};
|
|
35
|
-
}
|
|
36
|
-
currentValue = currentValue[keyObj.key];
|
|
37
|
-
} else if (keyObj.type === NodeType.Translation) {
|
|
38
|
-
lastKeys = [NodeType.Translation, keyObj.key];
|
|
39
|
-
if (!currentValue[NodeType.Translation]) {
|
|
40
|
-
currentValue[NodeType.Translation] = {
|
|
41
|
-
...currentValue[NodeType.Translation],
|
|
42
|
-
[keyObj.key]: newValue
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
currentValue = currentValue[NodeType.Translation][keyObj.key];
|
|
46
|
-
} else if (keyObj.type === NodeType.Enumeration) {
|
|
47
|
-
lastKeys = [NodeType.Enumeration, keyObj.key];
|
|
48
|
-
if (!currentValue[NodeType.Enumeration]) {
|
|
49
|
-
currentValue[NodeType.Enumeration] = {
|
|
50
|
-
...currentValue[NodeType.Enumeration],
|
|
51
|
-
[keyObj.key]: newValue
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
currentValue = currentValue[NodeType.Enumeration][keyObj.key];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (parentValue && lastKeys.length > 0) {
|
|
58
|
-
for (const key of lastKeys.slice(0, -1)) {
|
|
59
|
-
parentValue = parentValue[key];
|
|
60
|
-
}
|
|
61
|
-
if (
|
|
62
|
-
// Remove the field if the new value is undefined
|
|
63
|
-
typeof newValue === "undefined"
|
|
64
|
-
) {
|
|
65
|
-
delete parentValue[lastKeys[lastKeys.length - 1]];
|
|
66
|
-
} else {
|
|
67
|
-
parentValue[lastKeys[lastKeys.length - 1]] = newValue;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return dictionaryContent;
|
|
71
|
-
};
|
|
72
|
-
const removeDictionaryValueByKeyPath = (dictionaryContent, keyPath) => {
|
|
73
|
-
let currentValue = dictionaryContent;
|
|
74
|
-
let parentValue = null;
|
|
75
|
-
let lastKey = null;
|
|
76
|
-
for (const keyObj of keyPath) {
|
|
77
|
-
parentValue = currentValue;
|
|
78
|
-
if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {
|
|
79
|
-
lastKey = keyObj.key;
|
|
80
|
-
currentValue = currentValue[keyObj.key];
|
|
81
|
-
} else if (keyObj.type === NodeType.Translation) {
|
|
82
|
-
lastKey = NodeType.Translation;
|
|
83
|
-
currentValue = currentValue[NodeType.Translation][keyObj.key];
|
|
84
|
-
} else if (keyObj.type === NodeType.Enumeration) {
|
|
85
|
-
lastKey = NodeType.Enumeration;
|
|
86
|
-
currentValue = currentValue[NodeType.Enumeration][keyObj.key];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (parentValue && lastKey !== null) {
|
|
90
|
-
if (Array.isArray(parentValue)) {
|
|
91
|
-
parentValue.splice(lastKey, 1);
|
|
92
|
-
} else {
|
|
93
|
-
delete parentValue[lastKey];
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return dictionaryContent;
|
|
97
|
-
};
|
|
98
|
-
const renameDictionaryValueByKeyPath = (dictionaryContent, newKey, keyPath) => {
|
|
99
|
-
let currentValue = dictionaryContent;
|
|
100
|
-
let parentValue = null;
|
|
101
|
-
let lastKey = null;
|
|
102
|
-
for (const keyObj of keyPath) {
|
|
103
|
-
parentValue = currentValue;
|
|
104
|
-
if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {
|
|
105
|
-
lastKey = keyObj.key;
|
|
106
|
-
currentValue = currentValue[keyObj.key];
|
|
107
|
-
} else if (keyObj.type === NodeType.Translation) {
|
|
108
|
-
lastKey = NodeType.Translation;
|
|
109
|
-
currentValue = currentValue[NodeType.Translation][keyObj.key];
|
|
110
|
-
} else if (keyObj.type === NodeType.Enumeration) {
|
|
111
|
-
lastKey = NodeType.Enumeration;
|
|
112
|
-
currentValue = currentValue[NodeType.Enumeration][keyObj.key];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
if (parentValue && lastKey !== null) {
|
|
116
|
-
if (Array.isArray(parentValue)) {
|
|
117
|
-
parentValue[lastKey] = currentValue;
|
|
118
|
-
} else {
|
|
119
|
-
const newParentValue = {};
|
|
120
|
-
for (const key of Object.keys(parentValue)) {
|
|
121
|
-
if (key === lastKey) {
|
|
122
|
-
newParentValue[newKey] = currentValue;
|
|
123
|
-
} else {
|
|
124
|
-
newParentValue[key] = parentValue[key];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
Object.keys(parentValue).forEach((key) => delete parentValue[key]);
|
|
128
|
-
Object.assign(parentValue, newParentValue);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return dictionaryContent;
|
|
132
|
-
};
|
|
133
|
-
const getSectionType = (section) => {
|
|
134
|
-
if (typeof section === "string") {
|
|
135
|
-
return NodeType.Text;
|
|
136
|
-
}
|
|
137
|
-
if (section?.nodeType === NodeType.Translation) {
|
|
138
|
-
return NodeType.Translation;
|
|
139
|
-
}
|
|
140
|
-
if (section?.nodeType === NodeType.Enumeration) {
|
|
141
|
-
return NodeType.Enumeration;
|
|
142
|
-
}
|
|
143
|
-
if (Array.isArray(section)) {
|
|
144
|
-
return NodeType.Array;
|
|
145
|
-
}
|
|
146
|
-
if (isValidElement(section)) {
|
|
147
|
-
return NodeType.ReactNode;
|
|
148
|
-
}
|
|
149
|
-
return NodeType.Object;
|
|
150
|
-
};
|
|
151
|
-
export {
|
|
152
|
-
editDictionaryByKeyPath,
|
|
153
|
-
getDictionaryValueByKeyPath,
|
|
154
|
-
getSectionType,
|
|
155
|
-
removeDictionaryValueByKeyPath,
|
|
156
|
-
renameDictionaryValueByKeyPath
|
|
157
|
-
};
|
|
158
|
-
//# sourceMappingURL=dictionaryUtils.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/dictionaryUtils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { isValidElement } from 'react';\nimport { type TranslationContent, type EnumerationContent } from './transpiler';\nimport { type DictionaryValue, type KeyPath, NodeType } from './types/index';\n\nexport const getDictionaryValueByKeyPath = (\n dictionaryContent: DictionaryValue,\n keyPath: KeyPath[]\n): DictionaryValue => {\n let currentValue: any = JSON.parse(JSON.stringify(dictionaryContent ?? {}));\n\n for (const keyObj of keyPath) {\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n currentValue = currentValue?.[NodeType.Enumeration][keyObj.key];\n }\n }\n\n return currentValue as DictionaryValue;\n};\n\ntype LastKeyType = string | number;\n\nexport const editDictionaryByKeyPath = (\n dictionaryContent: DictionaryValue,\n keyPath: KeyPath[],\n newValue: DictionaryValue\n): DictionaryValue => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKeys: LastKeyType[] = [];\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object) {\n lastKeys = [keyObj.key];\n\n if (!currentValue[keyObj.key]) {\n currentValue = {\n ...currentValue,\n [keyObj.key]: {},\n };\n }\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Array) {\n lastKeys = [keyObj.key];\n\n if (!currentValue[keyObj.key]) {\n currentValue[keyObj.key] = {};\n }\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n lastKeys = [NodeType.Translation, keyObj.key];\n\n if (!currentValue[NodeType.Translation]) {\n currentValue[NodeType.Translation] = {\n ...currentValue[NodeType.Translation],\n [keyObj.key]: newValue,\n };\n }\n currentValue = currentValue[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n lastKeys = [NodeType.Enumeration, keyObj.key];\n\n if (!currentValue[NodeType.Enumeration]) {\n currentValue[NodeType.Enumeration] = {\n ...currentValue[NodeType.Enumeration],\n [keyObj.key]: newValue,\n };\n }\n currentValue = currentValue[NodeType.Enumeration][keyObj.key];\n }\n }\n\n // Assign the new value to the last key of the parent\n if (parentValue && lastKeys.length > 0) {\n for (const key of lastKeys.slice(0, -1)) {\n parentValue = parentValue[key];\n }\n if (\n // Remove the field if the new value is undefined\n typeof newValue === 'undefined'\n ) {\n delete parentValue[lastKeys[lastKeys.length - 1]];\n } else {\n parentValue[lastKeys[lastKeys.length - 1]] = newValue;\n }\n }\n\n return dictionaryContent;\n};\n\nexport const removeDictionaryValueByKeyPath = (\n dictionaryContent: DictionaryValue,\n keyPath: KeyPath[]\n): DictionaryValue => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n lastKey = NodeType.Translation;\n currentValue = currentValue[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n lastKey = NodeType.Enumeration;\n currentValue = currentValue[NodeType.Enumeration][keyObj.key];\n }\n }\n\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue.splice(lastKey as unknown as number, 1);\n } else {\n delete parentValue[lastKey];\n }\n }\n\n return dictionaryContent;\n};\n\nexport const renameDictionaryValueByKeyPath = (\n dictionaryContent: DictionaryValue,\n newKey: string | number,\n keyPath: KeyPath[]\n): DictionaryValue => {\n let currentValue: any = dictionaryContent;\n let parentValue: any = null;\n let lastKey: string | number | null = null;\n\n for (const keyObj of keyPath) {\n parentValue = currentValue;\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n lastKey = keyObj.key;\n currentValue = currentValue[keyObj.key];\n } else if (keyObj.type === NodeType.Translation) {\n lastKey = NodeType.Translation;\n currentValue = currentValue[NodeType.Translation][keyObj.key];\n } else if (keyObj.type === NodeType.Enumeration) {\n lastKey = NodeType.Enumeration;\n currentValue = currentValue[NodeType.Enumeration][keyObj.key];\n }\n }\n\n // Assign the new value to the last key of the parent while preserving the order\n if (parentValue && lastKey !== null) {\n if (Array.isArray(parentValue)) {\n parentValue[lastKey as number] = currentValue;\n } else {\n const newParentValue: any = {};\n for (const key of Object.keys(parentValue)) {\n if (key === lastKey) {\n newParentValue[newKey] = currentValue;\n } else {\n newParentValue[key] = parentValue[key];\n }\n }\n // Replace the contents of parentValue with newParentValue\n Object.keys(parentValue).forEach((key) => delete parentValue[key]);\n Object.assign(parentValue, newParentValue);\n }\n }\n\n return dictionaryContent;\n};\n\nexport const getSectionType = (section: DictionaryValue): NodeType => {\n if (typeof section === 'string') {\n return NodeType.Text;\n }\n\n if (\n (section as TranslationContent<unknown>)?.nodeType === NodeType.Translation\n ) {\n return NodeType.Translation;\n }\n\n if (\n (section as EnumerationContent<unknown>)?.nodeType === NodeType.Enumeration\n ) {\n return NodeType.Enumeration;\n }\n\n if (Array.isArray(section)) {\n return NodeType.Array;\n }\n\n if (isValidElement(section)) {\n return NodeType.ReactNode;\n }\n\n return NodeType.Object;\n};\n"],"mappings":"AACA,SAAS,sBAAsB;AAE/B,SAA6C,gBAAgB;AAEtD,MAAM,8BAA8B,CACzC,mBACA,YACoB;AACpB,MAAI,eAAoB,KAAK,MAAM,KAAK,UAAU,qBAAqB,CAAC,CAAC,CAAC;AAE1E,aAAW,UAAU,SAAS;AAC5B,QAAI,OAAO,SAAS,SAAS,UAAU,OAAO,SAAS,SAAS,O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O,GAAG;AAC1B,WAAO,SAAS;AAAA,EAClB;AAEA,MAAI,eAAe,OAAO,GAAG;AAC3B,WAAO,SAAS;AAAA,EAClB;AAEA,SAAO,SAAS;AAClB;","names":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type DictionaryValue, type KeyPath, NodeType } from './types/index';
|
|
2
|
-
export declare const getDictionaryValueByKeyPath: (dictionaryContent: DictionaryValue, keyPath: KeyPath[]) => DictionaryValue;
|
|
3
|
-
export declare const editDictionaryByKeyPath: (dictionaryContent: DictionaryValue, keyPath: KeyPath[], newValue: DictionaryValue) => DictionaryValue;
|
|
4
|
-
export declare const removeDictionaryValueByKeyPath: (dictionaryContent: DictionaryValue, keyPath: KeyPath[]) => DictionaryValue;
|
|
5
|
-
export declare const renameDictionaryValueByKeyPath: (dictionaryContent: DictionaryValue, newKey: string | number, keyPath: KeyPath[]) => DictionaryValue;
|
|
6
|
-
export declare const getSectionType: (section: DictionaryValue) => NodeType;
|
|
7
|
-
//# sourceMappingURL=dictionaryUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dictionaryUtils.d.ts","sourceRoot":"","sources":["../../src/dictionaryUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE7E,eAAO,MAAM,2BAA2B,sBACnB,eAAe,WACzB,OAAO,EAAE,KACjB,eAcF,CAAC;AAIF,eAAO,MAAM,uBAAuB,sBACf,eAAe,WACzB,OAAO,EAAE,YACR,eAAe,KACxB,eAgEF,CAAC;AAEF,eAAO,MAAM,8BAA8B,sBACtB,eAAe,WACzB,OAAO,EAAE,KACjB,eA6BF,CAAC;AAEF,eAAO,MAAM,8BAA8B,sBACtB,eAAe,UAC1B,MAAM,GAAG,MAAM,WACd,OAAO,EAAE,KACjB,eAwCF,CAAC;AAEF,eAAO,MAAM,cAAc,YAAa,eAAe,KAAG,QA0BzD,CAAC"}
|