i18n-keyless-core 1.10.0 → 1.10.2

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/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export type { I18nConfig, Lang, PrimaryLang, Translations, TranslationStore, TranslationStoreState, I18nKeylessRequestBody, I18nKeylessResponse, TranslationOptions, } from "./types";
1
+ export type { I18nConfig, Lang, PrimaryLang, Translations, TranslationStore, TranslationStoreState, MinimalTranslationStore, OmitCurrentLanguageTranslationStore, I18nKeylessRequestBody, I18nKeylessResponse, TranslationOptions, } from "./types";
2
2
  export { getTranslationCore, getAllTranslationsFromLanguage, getAllTranslationsForAllLanguages, validateLanguage, queue, } from "./service";
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-core",
3
3
  "private": false,
4
- "version": "1.10.0",
4
+ "version": "1.10.2",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
package/dist/service.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { I18nConfig, Lang, TranslationStore, TranslationOptions, I18nKeylessResponse } from "./types";
1
+ import type { I18nConfig, Lang, OmitCurrentLanguageTranslationStore, MinimalTranslationStore, TranslationOptions, I18nKeylessResponse } from "./types";
2
2
  import MyPQueue from "./my-pqueue";
3
3
  export declare const queue: MyPQueue;
4
4
  /**
@@ -17,7 +17,7 @@ export declare function validateLanguage(lang: I18nConfig["languages"]["supporte
17
17
  * @returns The translated text or the original key if not found
18
18
  * @throws Error if config is not initialized
19
19
  */
20
- export declare function getTranslationCore(key: string, store: TranslationStore, options?: TranslationOptions): string;
20
+ export declare function getTranslationCore(key: string, store: MinimalTranslationStore, options?: TranslationOptions): string;
21
21
  /**
22
22
  * Queues a key for translation if not already translated
23
23
  * @param key - The text to translate
@@ -25,18 +25,18 @@ export declare function getTranslationCore(key: string, store: TranslationStore,
25
25
  * @param options - Optional parameters for the translation process
26
26
  * @throws Error if config is not initialized
27
27
  */
28
- export declare function translateKey(key: string, store: TranslationStore, options?: TranslationOptions): void;
28
+ export declare function translateKey(key: string, store: MinimalTranslationStore, options?: TranslationOptions): void;
29
29
  /**
30
30
  * Fetches all translations for a target language
31
31
  * @param targetLanguage - The language code to fetch translations for
32
32
  * @param store - The translation store
33
33
  * @returns Promise resolving to the translation response or void if failed
34
34
  */
35
- export declare function getAllTranslationsFromLanguage(targetLanguage: Lang, store: TranslationStore): Promise<I18nKeylessResponse | void>;
35
+ export declare function getAllTranslationsFromLanguage(targetLanguage: Lang, store: MinimalTranslationStore): Promise<I18nKeylessResponse | void>;
36
36
  /**
37
37
  * Fetches all translations for a target language
38
38
  * @param targetLanguage - The language code to fetch translations for
39
39
  * @param store - The translation store
40
40
  * @returns Promise resolving to the translation response or void if failed
41
41
  */
42
- export declare function getAllTranslationsForAllLanguages(store: Omit<TranslationStore, "currentLanguage" | "setLanguage">): Promise<I18nKeylessResponse | void>;
42
+ export declare function getAllTranslationsForAllLanguages(store: OmitCurrentLanguageTranslationStore): Promise<I18nKeylessResponse | void>;
package/dist/types.d.ts CHANGED
@@ -141,6 +141,7 @@ export interface I18nConfig {
141
141
  clear?: never;
142
142
  });
143
143
  }
144
+ export type NodeConfig = Omit<I18nConfig, "storage">;
144
145
  export interface TranslationStoreState {
145
146
  /**
146
147
  * the unique id of the consumer of i18n-keyless API, to help identify the usage API side
@@ -186,6 +187,10 @@ interface TranslationStoreActions {
186
187
  setLanguage: (lang: Lang) => void;
187
188
  }
188
189
  export type TranslationStore = TranslationStoreState & TranslationStoreActions;
190
+ export interface MinimalTranslationStore extends Omit<TranslationStore, "setLanguage" | "storage" | "config"> {
191
+ config: NodeConfig | null;
192
+ }
193
+ export type OmitCurrentLanguageTranslationStore = Omit<MinimalTranslationStore, "currentLanguage">;
189
194
  export interface I18nKeylessRequestBody {
190
195
  key: string;
191
196
  context?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-core",
3
3
  "private": false,
4
- "version": "1.10.0",
4
+ "version": "1.10.2",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",