@gringow/gringow 0.0.6 → 0.0.7
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/browser.d.mts +6 -0
- package/dist/browser.mjs +28 -0
- package/dist/config.d.mts +44 -0
- package/dist/config.mjs +154 -0
- package/dist/data/check-cache.d.mts +9 -0
- package/dist/data/check-cache.mjs +430 -0
- package/dist/data/clear-cache.d.mts +3 -0
- package/dist/data/clear-cache.mjs +379 -0
- package/dist/data/create-cache-dir.d.mts +3 -0
- package/dist/data/create-cache-dir.mjs +361 -0
- package/{src/data/create-cache-id.ts → dist/data/create-cache-id.d.mts} +3 -7
- package/dist/data/create-cache-id.mjs +10 -0
- package/dist/data/delete-cache-item.d.mts +9 -0
- package/dist/data/delete-cache-item.mjs +411 -0
- package/dist/data/get-cache.d.mts +3 -0
- package/dist/data/get-cache.mjs +374 -0
- package/dist/data/get-or-create-cache.d.mts +9 -0
- package/dist/data/get-or-create-cache.mjs +400 -0
- package/dist/data/save-cache.d.mts +13 -0
- package/dist/data/save-cache.mjs +374 -0
- package/dist/data/write-cache-to-disk.d.mts +9 -0
- package/dist/data/write-cache-to-disk.mjs +408 -0
- package/dist/default-config.d.mts +7 -0
- package/dist/default-config.mjs +25 -0
- package/dist/flat-template-string.d.mts +14 -0
- package/dist/flat-template-string.mjs +16 -0
- package/dist/flat-template-string.test.d.mts +2 -0
- package/dist/flat-template-string.test.mjs +18479 -0
- package/dist/gringow.d.mts +9 -0
- package/dist/gringow.mjs +904 -0
- package/dist/index.d.mts +60 -0
- package/dist/index.mjs +926 -0
- package/dist/io/anthropic/ask.d.mts +5 -0
- package/dist/io/anthropic/ask.mjs +181 -0
- package/dist/io/anthropic/commit-response.d.mts +15 -0
- package/dist/io/anthropic/commit-response.mjs +10 -0
- package/dist/io/anthropic/index.d.mts +14 -0
- package/dist/io/anthropic/index.mjs +199 -0
- package/dist/io/anthropic/parse.d.mts +14 -0
- package/dist/io/anthropic/parse.mjs +10 -0
- package/dist/io/ask-llm.d.mts +13 -0
- package/dist/io/ask-llm.mjs +573 -0
- package/dist/io/gemini/ask.d.mts +5 -0
- package/dist/io/gemini/ask.mjs +206 -0
- package/dist/io/gemini/commit-response.d.mts +5 -0
- package/dist/io/gemini/commit-response.mjs +7 -0
- package/dist/io/gemini/index.d.mts +14 -0
- package/dist/io/gemini/index.mjs +222 -0
- package/dist/io/gemini/parse.d.mts +14 -0
- package/dist/io/gemini/parse.mjs +11 -0
- package/dist/io/huggingface/ask.d.mts +13 -0
- package/dist/io/huggingface/ask.mjs +397 -0
- package/dist/io/huggingface/commit-response.d.mts +27 -0
- package/dist/io/huggingface/commit-response.mjs +14 -0
- package/dist/io/huggingface/index.d.mts +13 -0
- package/dist/io/huggingface/index.mjs +418 -0
- package/dist/io/huggingface/languagesMap.d.mts +186 -0
- package/dist/io/huggingface/languagesMap.mjs +187 -0
- package/dist/io/huggingface/parse.d.mts +14 -0
- package/dist/io/huggingface/parse.mjs +9 -0
- package/dist/logger.d.mts +24 -0
- package/dist/logger.mjs +21 -0
- package/dist/schemas/config.shcema.d.mts +199 -0
- package/dist/schemas/config.shcema.mjs +52 -0
- package/dist/types/index.d.mts +28 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +7 -1
- package/.nvmrc +0 -1
- package/gringow.json +0 -12
- package/src/browser.ts +0 -4
- package/src/config.ts +0 -93
- package/src/data/check-cache.ts +0 -15
- package/src/data/clear-cache.ts +0 -5
- package/src/data/create-cache-dir.ts +0 -7
- package/src/data/delete-cache-item.ts +0 -20
- package/src/data/get-cache.ts +0 -17
- package/src/data/get-or-create-cache.ts +0 -21
- package/src/data/save-cache.ts +0 -17
- package/src/data/write-cache-to-disk.ts +0 -20
- package/src/default-config.ts +0 -27
- package/src/flat-template-string.test.ts +0 -109
- package/src/flat-template-string.ts +0 -27
- package/src/gringow.ts +0 -49
- package/src/index.ts +0 -37
- package/src/io/anthropic/ask.ts +0 -31
- package/src/io/anthropic/commit-response.ts +0 -11
- package/src/io/anthropic/index.ts +0 -3
- package/src/io/anthropic/parse.ts +0 -11
- package/src/io/ask-llm.ts +0 -44
- package/src/io/gemini/ask.ts +0 -65
- package/src/io/gemini/commit-response.ts +0 -6
- package/src/io/gemini/index.ts +0 -3
- package/src/io/gemini/parse.ts +0 -12
- package/src/io/huggingface/ask.ts +0 -82
- package/src/io/huggingface/commit-response.ts +0 -16
- package/src/io/huggingface/index.ts +0 -16
- package/src/io/huggingface/languagesMap.ts +0 -189
- package/src/io/huggingface/parse.ts +0 -10
- package/src/logger.ts +0 -25
- package/src/schemas/config.shcema.ts +0 -58
- package/src/types/index.ts +0 -22
- package/tsconfig.json +0 -29
- package/tsup.config.ts +0 -21
- package/vitest.config.ts +0 -8
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export { awaitedConfig, getConfigSource, isLocalConfigFound } from './config.mjs';
|
|
2
|
+
export { clearCache } from './data/clear-cache.mjs';
|
|
3
|
+
export { createCacheId } from './data/create-cache-id.mjs';
|
|
4
|
+
export { getCache } from './data/get-cache.mjs';
|
|
5
|
+
export { flatTemplateString } from './flat-template-string.mjs';
|
|
6
|
+
export { GringowConfig } from './default-config.mjs';
|
|
7
|
+
import 'zod';
|
|
8
|
+
import './schemas/config.shcema.mjs';
|
|
9
|
+
|
|
10
|
+
declare function checkCache(cacheId: string): Promise<GringowCacheItem | undefined>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Deletes a cache item.
|
|
14
|
+
*
|
|
15
|
+
* @param cacheId - The cache ID.
|
|
16
|
+
* @returns The cache ID.
|
|
17
|
+
*/
|
|
18
|
+
declare function deleteCacheItem(cacheId: string): Promise<GringowCache>;
|
|
19
|
+
|
|
20
|
+
declare function getOrCreateCache(): Promise<GringowCache>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Writes the cache to disk.
|
|
24
|
+
*
|
|
25
|
+
* @param cacheId - The cache ID.
|
|
26
|
+
* @param cached - The cached function.
|
|
27
|
+
* @returns The cache ID.
|
|
28
|
+
*/
|
|
29
|
+
declare function writeCacheToDisk(cacheId: string, cached: GringowCacheItem): Promise<GringowCacheItem>;
|
|
30
|
+
|
|
31
|
+
type GringowTranslation = {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
};
|
|
34
|
+
type GringowCacheItem = {
|
|
35
|
+
original: string;
|
|
36
|
+
translation: GringowTranslation;
|
|
37
|
+
};
|
|
38
|
+
type GringowCache = {
|
|
39
|
+
[key: string]: GringowCacheItem;
|
|
40
|
+
};
|
|
41
|
+
type GringowResponse = {
|
|
42
|
+
cacheId: string;
|
|
43
|
+
translation: GringowCacheItem;
|
|
44
|
+
};
|
|
45
|
+
type GringowError = Error & {
|
|
46
|
+
code?: string;
|
|
47
|
+
cause?: Error;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gringow is a function that translates a string or a template string into a
|
|
52
|
+
* translated string.
|
|
53
|
+
*
|
|
54
|
+
* @param strings - The string or template string to translate.
|
|
55
|
+
* @param values - The values to interpolate into the string.
|
|
56
|
+
* @returns The translated string.
|
|
57
|
+
*/
|
|
58
|
+
declare function Gringow(strings: TemplateStringsArray | string, ...values: Array<unknown>): Promise<GringowResponse>;
|
|
59
|
+
|
|
60
|
+
export { type GringowCache, type GringowCacheItem, type GringowError, type GringowResponse, type GringowTranslation, checkCache, Gringow as default, deleteCacheItem, getOrCreateCache, writeCacheToDisk };
|