@intlayer/core 8.3.4 → 8.4.0-canary.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { NodeType } from '@intlayer/types/nodeType';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[],\n fallbackLocale?: Locale\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n // Auto-resolve translation nodes when fallbackLocale is provided\n if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];\n }\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":"0JAKA,MAAa,GACX,EACA,EACA,IACgB,CAChB,IAAI,EAAoB,gBAAgB,EAAkB,CAE1D,IAAK,IAAM,KAAU,EAEf,GAAkB,GAAc,WAAaA,EAAAA,SAAS,cACxD,EAAe,IAAeA,EAAAA,SAAS,eAAe,KAGpD,EAAO,OAASA,EAAAA,SAAS,QAAU,EAAO,OAASA,EAAAA,SAAS,SAC9D,EAAe,IAAe,EAAO,OAIrC,EAAO,OAASA,EAAAA,SAAS,aACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,eAEzB,EAAe,IAAe,EAAO,QAAQ,EAAO,OAIpD,EAAO,OAASA,EAAAA,SAAS,UACzB,EAAO,OAASA,EAAAA,SAAS,MACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,QAEzB,EAAe,IAAe,EAAO,OAIzC,OAAO"}
1
+ {"version":3,"file":"getContentNodeByKeyPath.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[],\n fallbackLocale?: LocalesValues\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n // Auto-resolve translation nodes when fallbackLocale is provided\n if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];\n }\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":"0JAKA,MAAa,GACX,EACA,EACA,IACgB,CAChB,IAAI,EAAoB,gBAAgB,EAAkB,CAE1D,IAAK,IAAM,KAAU,EAEf,GAAkB,GAAc,WAAaA,EAAAA,SAAS,cACxD,EAAe,IAAeA,EAAAA,SAAS,eAAe,KAGpD,EAAO,OAASA,EAAAA,SAAS,QAAU,EAAO,OAASA,EAAAA,SAAS,SAC9D,EAAe,IAAe,EAAO,OAIrC,EAAO,OAASA,EAAAA,SAAS,aACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,eAEzB,EAAe,IAAe,EAAO,QAAQ,EAAO,OAIpD,EAAO,OAASA,EAAAA,SAAS,UACzB,EAAO,OAASA,EAAAA,SAAS,MACzB,EAAO,OAASA,EAAAA,SAAS,WACzB,EAAO,OAASA,EAAAA,SAAS,QAEzB,EAAe,IAAe,EAAO,OAIzC,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"getContentNodeByKeyPath.mjs","names":[],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport { NodeType } from '@intlayer/types/nodeType';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[],\n fallbackLocale?: Locale\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n // Auto-resolve translation nodes when fallbackLocale is provided\n if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];\n }\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":"oDAKA,MAAa,GACX,EACA,EACA,IACgB,CAChB,IAAI,EAAoB,gBAAgB,EAAkB,CAE1D,IAAK,IAAM,KAAU,EAEf,GAAkB,GAAc,WAAa,EAAS,cACxD,EAAe,IAAe,EAAS,eAAe,KAGpD,EAAO,OAAS,EAAS,QAAU,EAAO,OAAS,EAAS,SAC9D,EAAe,IAAe,EAAO,OAIrC,EAAO,OAAS,EAAS,aACzB,EAAO,OAAS,EAAS,WACzB,EAAO,OAAS,EAAS,eAEzB,EAAe,IAAe,EAAO,QAAQ,EAAO,OAIpD,EAAO,OAAS,EAAS,UACzB,EAAO,OAAS,EAAS,MACzB,EAAO,OAAS,EAAS,WACzB,EAAO,OAAS,EAAS,QAEzB,EAAe,IAAe,EAAO,OAIzC,OAAO"}
1
+ {"version":3,"file":"getContentNodeByKeyPath.mjs","names":[],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"sourcesContent":["import type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { NodeType } from '@intlayer/types/nodeType';\n\nexport const getContentNodeByKeyPath = (\n dictionaryContent: ContentNode,\n keyPath: KeyPath[],\n fallbackLocale?: LocalesValues\n): ContentNode => {\n let currentValue: any = structuredClone(dictionaryContent);\n\n for (const keyObj of keyPath) {\n // Auto-resolve translation nodes when fallbackLocale is provided\n if (fallbackLocale && currentValue?.nodeType === NodeType.Translation) {\n currentValue = currentValue?.[NodeType.Translation]?.[fallbackLocale];\n }\n\n if (keyObj.type === NodeType.Object || keyObj.type === NodeType.Array) {\n currentValue = currentValue?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Translation ||\n keyObj.type === NodeType.Condition ||\n keyObj.type === NodeType.Enumeration\n ) {\n currentValue = currentValue?.[keyObj.type]?.[keyObj.key];\n }\n\n if (\n keyObj.type === NodeType.Markdown ||\n keyObj.type === NodeType.HTML ||\n keyObj.type === NodeType.Insertion ||\n keyObj.type === NodeType.File\n ) {\n currentValue = currentValue?.[keyObj.type];\n }\n }\n\n return currentValue as ContentNode;\n};\n"],"mappings":"oDAKA,MAAa,GACX,EACA,EACA,IACgB,CAChB,IAAI,EAAoB,gBAAgB,EAAkB,CAE1D,IAAK,IAAM,KAAU,EAEf,GAAkB,GAAc,WAAa,EAAS,cACxD,EAAe,IAAe,EAAS,eAAe,KAGpD,EAAO,OAAS,EAAS,QAAU,EAAO,OAAS,EAAS,SAC9D,EAAe,IAAe,EAAO,OAIrC,EAAO,OAAS,EAAS,aACzB,EAAO,OAAS,EAAS,WACzB,EAAO,OAAS,EAAS,eAEzB,EAAe,IAAe,EAAO,QAAQ,EAAO,OAIpD,EAAO,OAAS,EAAS,UACzB,EAAO,OAAS,EAAS,MACzB,EAAO,OAAS,EAAS,WACzB,EAAO,OAAS,EAAS,QAEzB,EAAe,IAAe,EAAO,OAIzC,OAAO"}
@@ -1,9 +1,9 @@
1
1
  import { ContentNode } from "@intlayer/types/dictionary";
2
- import { Locale } from "@intlayer/types/allLocales";
2
+ import { LocalesValues } from "@intlayer/types/module_augmentation";
3
3
  import { KeyPath } from "@intlayer/types/keyPath";
4
4
 
5
5
  //#region src/dictionaryManipulator/getContentNodeByKeyPath.d.ts
6
- declare const getContentNodeByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], fallbackLocale?: Locale) => ContentNode;
6
+ declare const getContentNodeByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], fallbackLocale?: LocalesValues) => ContentNode;
7
7
  //#endregion
8
8
  export { getContentNodeByKeyPath };
9
9
  //# sourceMappingURL=getContentNodeByKeyPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getContentNodeByKeyPath.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"mappings":";;;;;cAKa,uBAAA,GACX,iBAAA,EAAmB,WAAA,EACnB,OAAA,EAAS,OAAA,IACT,cAAA,GAAiB,MAAA,KAChB,WAAA"}
1
+ {"version":3,"file":"getContentNodeByKeyPath.d.ts","names":[],"sources":["../../../src/dictionaryManipulator/getContentNodeByKeyPath.ts"],"mappings":";;;;;cAKa,uBAAA,GACX,iBAAA,EAAmB,WAAA,EACnB,OAAA,EAAS,OAAA,IACT,cAAA,GAAiB,aAAA,KAChB,WAAA"}
@@ -24,7 +24,7 @@ type TranslationContent<Content = unknown, RecordContent extends StrictModeLocal
24
24
  * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
25
25
  */
26
26
  declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TypedNodeModel<NodeType.Translation, ContentRecord, {
27
- nodeType: NodeType.Translation | "translation";
27
+ nodeType: "translation" | NodeType.Translation;
28
28
  } & {
29
29
  translation: ContentRecord;
30
30
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "8.3.4",
3
+ "version": "8.4.0-canary.0",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -168,11 +168,11 @@
168
168
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
169
169
  },
170
170
  "dependencies": {
171
- "@intlayer/api": "8.3.4",
172
- "@intlayer/config": "8.3.4",
173
- "@intlayer/dictionaries-entry": "8.3.4",
174
- "@intlayer/types": "8.3.4",
175
- "@intlayer/unmerged-dictionaries-entry": "8.3.4",
171
+ "@intlayer/api": "8.4.0-canary.0",
172
+ "@intlayer/config": "8.4.0-canary.0",
173
+ "@intlayer/dictionaries-entry": "8.4.0-canary.0",
174
+ "@intlayer/types": "8.4.0-canary.0",
175
+ "@intlayer/unmerged-dictionaries-entry": "8.4.0-canary.0",
176
176
  "defu": "6.1.4"
177
177
  },
178
178
  "devDependencies": {