@lionrapid/core 0.1.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.
- package/README.md +106 -0
- package/dist/base/event-emitter.d.ts +91 -0
- package/dist/base/event-emitter.d.ts.map +1 -0
- package/dist/base/event-emitter.js +330 -0
- package/dist/base/event-emitter.js.map +1 -0
- package/dist/base/index.d.ts +5 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +5 -0
- package/dist/base/index.js.map +1 -0
- package/dist/browser/auto-init.d.ts +57 -0
- package/dist/browser/auto-init.d.ts.map +1 -0
- package/dist/browser/auto-init.js +304 -0
- package/dist/browser/auto-init.js.map +1 -0
- package/dist/browser/auto-translator.d.ts +98 -0
- package/dist/browser/auto-translator.d.ts.map +1 -0
- package/dist/browser/auto-translator.js +218 -0
- package/dist/browser/auto-translator.js.map +1 -0
- package/dist/browser/block-extractor.d.ts +26 -0
- package/dist/browser/block-extractor.d.ts.map +1 -0
- package/dist/browser/block-extractor.js +143 -0
- package/dist/browser/block-extractor.js.map +1 -0
- package/dist/browser/dom-observer.d.ts +42 -0
- package/dist/browser/dom-observer.d.ts.map +1 -0
- package/dist/browser/dom-observer.js +109 -0
- package/dist/browser/dom-observer.js.map +1 -0
- package/dist/browser/editor/editor-api.d.ts +67 -0
- package/dist/browser/editor/editor-api.d.ts.map +1 -0
- package/dist/browser/editor/editor-api.js +233 -0
- package/dist/browser/editor/editor-api.js.map +1 -0
- package/dist/browser/editor/editor-init.d.ts +11 -0
- package/dist/browser/editor/editor-init.d.ts.map +1 -0
- package/dist/browser/editor/editor-init.js +181 -0
- package/dist/browser/editor/editor-init.js.map +1 -0
- package/dist/browser/editor/editor-styles.d.ts +6 -0
- package/dist/browser/editor/editor-styles.d.ts.map +1 -0
- package/dist/browser/editor/editor-styles.js +419 -0
- package/dist/browser/editor/editor-styles.js.map +1 -0
- package/dist/browser/editor/inspector.d.ts +22 -0
- package/dist/browser/editor/inspector.d.ts.map +1 -0
- package/dist/browser/editor/inspector.js +125 -0
- package/dist/browser/editor/inspector.js.map +1 -0
- package/dist/browser/editor/key-resolver.d.ts +19 -0
- package/dist/browser/editor/key-resolver.d.ts.map +1 -0
- package/dist/browser/editor/key-resolver.js +49 -0
- package/dist/browser/editor/key-resolver.js.map +1 -0
- package/dist/browser/editor/live-preview.d.ts +10 -0
- package/dist/browser/editor/live-preview.d.ts.map +1 -0
- package/dist/browser/editor/live-preview.js +57 -0
- package/dist/browser/editor/live-preview.js.map +1 -0
- package/dist/browser/editor/sidebar.d.ts +50 -0
- package/dist/browser/editor/sidebar.d.ts.map +1 -0
- package/dist/browser/editor/sidebar.js +353 -0
- package/dist/browser/editor/sidebar.js.map +1 -0
- package/dist/browser/editor/toolbar.d.ts +29 -0
- package/dist/browser/editor/toolbar.d.ts.map +1 -0
- package/dist/browser/editor/toolbar.js +131 -0
- package/dist/browser/editor/toolbar.js.map +1 -0
- package/dist/browser/exclude-filter.d.ts +21 -0
- package/dist/browser/exclude-filter.d.ts.map +1 -0
- package/dist/browser/exclude-filter.js +51 -0
- package/dist/browser/exclude-filter.js.map +1 -0
- package/dist/browser/index.d.ts +32 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +28 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/language-switcher.d.ts +70 -0
- package/dist/browser/language-switcher.d.ts.map +1 -0
- package/dist/browser/language-switcher.js +339 -0
- package/dist/browser/language-switcher.js.map +1 -0
- package/dist/browser/lionrapid.auto.dev.js +5757 -0
- package/dist/browser/lionrapid.auto.dev.js.map +7 -0
- package/dist/browser/lionrapid.auto.js +5757 -0
- package/dist/browser/lionrapid.auto.js.map +7 -0
- package/dist/browser/lionrapid.auto.min.js +80 -0
- package/dist/browser/lionrapid.auto.min.js.map +7 -0
- package/dist/browser/lionrapid.editor.js +1869 -0
- package/dist/browser/lionrapid.editor.js.map +7 -0
- package/dist/browser/lionrapid.editor.min.js +415 -0
- package/dist/browser/lionrapid.editor.min.js.map +7 -0
- package/dist/browser/lionrapid.esm.js +4786 -0
- package/dist/browser/lionrapid.esm.js.map +7 -0
- package/dist/browser/lionrapid.esm.min.js +3 -0
- package/dist/browser/lionrapid.esm.min.js.map +7 -0
- package/dist/browser/lionrapid.iife.dev.js +4809 -0
- package/dist/browser/lionrapid.iife.dev.js.map +7 -0
- package/dist/browser/lionrapid.iife.js +4809 -0
- package/dist/browser/lionrapid.iife.js.map +7 -0
- package/dist/browser/lionrapid.iife.min.js +3 -0
- package/dist/browser/lionrapid.iife.min.js.map +7 -0
- package/dist/browser/lionrapid.umd.js +4822 -0
- package/dist/browser/lionrapid.umd.js.map +7 -0
- package/dist/browser/lionrapid.umd.min.js +18 -0
- package/dist/browser/lionrapid.umd.min.js.map +7 -0
- package/dist/browser/markup-parser.d.ts +13 -0
- package/dist/browser/markup-parser.d.ts.map +1 -0
- package/dist/browser/markup-parser.js +56 -0
- package/dist/browser/markup-parser.js.map +1 -0
- package/dist/browser/md5.d.ts +16 -0
- package/dist/browser/md5.d.ts.map +1 -0
- package/dist/browser/md5.js +145 -0
- package/dist/browser/md5.js.map +1 -0
- package/dist/browser/storage/cache-storage-repository.d.ts +44 -0
- package/dist/browser/storage/cache-storage-repository.d.ts.map +1 -0
- package/dist/browser/storage/cache-storage-repository.js +186 -0
- package/dist/browser/storage/cache-storage-repository.js.map +1 -0
- package/dist/browser/storage/localstorage-repository.d.ts +51 -0
- package/dist/browser/storage/localstorage-repository.d.ts.map +1 -0
- package/dist/browser/storage/localstorage-repository.js +270 -0
- package/dist/browser/storage/localstorage-repository.js.map +1 -0
- package/dist/builder.d.ts +24 -0
- package/dist/builder.d.ts.map +1 -0
- package/dist/builder.js +169 -0
- package/dist/builder.js.map +1 -0
- package/dist/cache/CacheManager.d.ts +132 -0
- package/dist/cache/CacheManager.d.ts.map +1 -0
- package/dist/cache/CacheManager.js +277 -0
- package/dist/cache/CacheManager.js.map +1 -0
- package/dist/cache/index.d.ts +6 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +5 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/lionrapid.config.d.ts +12 -0
- package/dist/config/lionrapid.config.d.ts.map +1 -0
- package/dist/config/lionrapid.config.js +2 -0
- package/dist/config/lionrapid.config.js.map +1 -0
- package/dist/config/logger.config.d.ts +19 -0
- package/dist/config/logger.config.d.ts.map +1 -0
- package/dist/config/logger.config.js +9 -0
- package/dist/config/logger.config.js.map +1 -0
- package/dist/config/repository.config.d.ts +87 -0
- package/dist/config/repository.config.d.ts.map +1 -0
- package/dist/config/repository.config.js +5 -0
- package/dist/config/repository.config.js.map +1 -0
- package/dist/content/index.d.ts +20 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +13 -0
- package/dist/content/index.js.map +1 -0
- package/dist/content/parser/IParser.d.ts +33 -0
- package/dist/content/parser/IParser.d.ts.map +1 -0
- package/dist/content/parser/IParser.js +6 -0
- package/dist/content/parser/IParser.js.map +1 -0
- package/dist/content/parser/MarkupParser.d.ts +67 -0
- package/dist/content/parser/MarkupParser.d.ts.map +1 -0
- package/dist/content/parser/MarkupParser.js +231 -0
- package/dist/content/parser/MarkupParser.js.map +1 -0
- package/dist/content/serializer/HTMLSerializer.d.ts +61 -0
- package/dist/content/serializer/HTMLSerializer.d.ts.map +1 -0
- package/dist/content/serializer/HTMLSerializer.js +100 -0
- package/dist/content/serializer/HTMLSerializer.js.map +1 -0
- package/dist/content/serializer/ISerializer.d.ts +33 -0
- package/dist/content/serializer/ISerializer.d.ts.map +1 -0
- package/dist/content/serializer/ISerializer.js +6 -0
- package/dist/content/serializer/ISerializer.js.map +1 -0
- package/dist/content/style-mapper/DefaultStyleMapper.d.ts +59 -0
- package/dist/content/style-mapper/DefaultStyleMapper.d.ts.map +1 -0
- package/dist/content/style-mapper/DefaultStyleMapper.js +128 -0
- package/dist/content/style-mapper/DefaultStyleMapper.js.map +1 -0
- package/dist/content/style-mapper/IStyleMapper.d.ts +50 -0
- package/dist/content/style-mapper/IStyleMapper.d.ts.map +1 -0
- package/dist/content/style-mapper/IStyleMapper.js +6 -0
- package/dist/content/style-mapper/IStyleMapper.js.map +1 -0
- package/dist/content/types.d.ts +39 -0
- package/dist/content/types.d.ts.map +1 -0
- package/dist/content/types.js +6 -0
- package/dist/content/types.js.map +1 -0
- package/dist/content/validator/ContentValidator.d.ts +57 -0
- package/dist/content/validator/ContentValidator.d.ts.map +1 -0
- package/dist/content/validator/ContentValidator.js +215 -0
- package/dist/content/validator/ContentValidator.js.map +1 -0
- package/dist/content/validator/IValidator.d.ts +82 -0
- package/dist/content/validator/IValidator.d.ts.map +1 -0
- package/dist/content/validator/IValidator.js +6 -0
- package/dist/content/validator/IValidator.js.map +1 -0
- package/dist/errors/translation-errors.d.ts +55 -0
- package/dist/errors/translation-errors.d.ts.map +1 -0
- package/dist/errors/translation-errors.js +85 -0
- package/dist/errors/translation-errors.js.map +1 -0
- package/dist/handlers/async-storage-handler.d.ts +77 -0
- package/dist/handlers/async-storage-handler.d.ts.map +1 -0
- package/dist/handlers/async-storage-handler.js +239 -0
- package/dist/handlers/async-storage-handler.js.map +1 -0
- package/dist/handlers/handler-chain.d.ts +79 -0
- package/dist/handlers/handler-chain.d.ts.map +1 -0
- package/dist/handlers/handler-chain.js +366 -0
- package/dist/handlers/handler-chain.js.map +1 -0
- package/dist/handlers/index.d.ts +7 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +7 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/network-handler.d.ts +90 -0
- package/dist/handlers/network-handler.d.ts.map +1 -0
- package/dist/handlers/network-handler.js +283 -0
- package/dist/handlers/network-handler.js.map +1 -0
- package/dist/handlers/sync-storage-handler.d.ts +88 -0
- package/dist/handlers/sync-storage-handler.d.ts.map +1 -0
- package/dist/handlers/sync-storage-handler.js +270 -0
- package/dist/handlers/sync-storage-handler.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/emitter.interface.d.ts +33 -0
- package/dist/interfaces/emitter.interface.d.ts.map +1 -0
- package/dist/interfaces/emitter.interface.js +2 -0
- package/dist/interfaces/emitter.interface.js.map +1 -0
- package/dist/interfaces/handler.interface.d.ts +50 -0
- package/dist/interfaces/handler.interface.d.ts.map +1 -0
- package/dist/interfaces/handler.interface.js +5 -0
- package/dist/interfaces/handler.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +8 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +8 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/plugin.interface.d.ts +49 -0
- package/dist/interfaces/plugin.interface.d.ts.map +1 -0
- package/dist/interfaces/plugin.interface.js +6 -0
- package/dist/interfaces/plugin.interface.js.map +1 -0
- package/dist/interfaces/repository.interface.d.ts +56 -0
- package/dist/interfaces/repository.interface.d.ts.map +1 -0
- package/dist/interfaces/repository.interface.js +2 -0
- package/dist/interfaces/repository.interface.js.map +1 -0
- package/dist/lionRapid.d.ts +225 -0
- package/dist/lionRapid.d.ts.map +1 -0
- package/dist/lionRapid.js +596 -0
- package/dist/lionRapid.js.map +1 -0
- package/dist/repositories/index.d.ts +3 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +3 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/memory-repository.d.ts +30 -0
- package/dist/repositories/memory-repository.d.ts.map +1 -0
- package/dist/repositories/memory-repository.js +100 -0
- package/dist/repositories/memory-repository.js.map +1 -0
- package/dist/repositories/network-repository.d.ts +138 -0
- package/dist/repositories/network-repository.d.ts.map +1 -0
- package/dist/repositories/network-repository.js +516 -0
- package/dist/repositories/network-repository.js.map +1 -0
- package/dist/sync/missing-translation-queue.d.ts +64 -0
- package/dist/sync/missing-translation-queue.d.ts.map +1 -0
- package/dist/sync/missing-translation-queue.js +184 -0
- package/dist/sync/missing-translation-queue.js.map +1 -0
- package/dist/types/cache.types.d.ts +62 -0
- package/dist/types/cache.types.d.ts.map +1 -0
- package/dist/types/cache.types.js +6 -0
- package/dist/types/cache.types.js.map +1 -0
- package/dist/types/event-payloads.types.d.ts +46 -0
- package/dist/types/event-payloads.types.d.ts.map +1 -0
- package/dist/types/event-payloads.types.js +6 -0
- package/dist/types/event-payloads.types.js.map +1 -0
- package/dist/types/generated.types.d.ts +31 -0
- package/dist/types/generated.types.d.ts.map +1 -0
- package/dist/types/generated.types.js +6 -0
- package/dist/types/generated.types.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/lionRapid.types.d.ts +169 -0
- package/dist/types/lionRapid.types.d.ts.map +1 -0
- package/dist/types/lionRapid.types.js +8 -0
- package/dist/types/lionRapid.types.js.map +1 -0
- package/dist/types/parameters.types.d.ts +36 -0
- package/dist/types/parameters.types.d.ts.map +1 -0
- package/dist/types/parameters.types.js +6 -0
- package/dist/types/parameters.types.js.map +1 -0
- package/dist/types/translation-data.types.d.ts +54 -0
- package/dist/types/translation-data.types.d.ts.map +1 -0
- package/dist/types/translation-data.types.js +6 -0
- package/dist/types/translation-data.types.js.map +1 -0
- package/dist/types/translation.types.d.ts +94 -0
- package/dist/types/translation.types.d.ts.map +1 -0
- package/dist/types/translation.types.js +5 -0
- package/dist/types/translation.types.js.map +1 -0
- package/dist/utils/context-utils.d.ts +23 -0
- package/dist/utils/context-utils.d.ts.map +1 -0
- package/dist/utils/context-utils.js +36 -0
- package/dist/utils/context-utils.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +229 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +345 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/namespace-utils.d.ts +30 -0
- package/dist/utils/namespace-utils.d.ts.map +1 -0
- package/dist/utils/namespace-utils.js +56 -0
- package/dist/utils/namespace-utils.js.map +1 -0
- package/dist/utils/translation-flow.d.ts +18 -0
- package/dist/utils/translation-flow.d.ts.map +1 -0
- package/dist/utils/translation-flow.js +74 -0
- package/dist/utils/translation-flow.js.map +1 -0
- package/dist/utils/translation-value-utils.d.ts +57 -0
- package/dist/utils/translation-value-utils.d.ts.map +1 -0
- package/dist/utils/translation-value-utils.js +194 -0
- package/dist/utils/translation-value-utils.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for translation operations
|
|
3
|
+
* Used for type-safe exception handling in repositories and handlers
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base error class for all translation-related errors
|
|
7
|
+
*/
|
|
8
|
+
export declare class TranslationError extends Error {
|
|
9
|
+
readonly key: string;
|
|
10
|
+
readonly status: number;
|
|
11
|
+
constructor(key: string, status: number, message: string);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Translation not found in backend (HTTP 404)
|
|
15
|
+
* Should be synced to backend for translators to fill in
|
|
16
|
+
*/
|
|
17
|
+
export declare class TranslationNotFoundError extends TranslationError {
|
|
18
|
+
constructor(key: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Translation exists but is locked/not ready (HTTP 423)
|
|
22
|
+
* Should NOT be synced to backend - will retry on next app start
|
|
23
|
+
*/
|
|
24
|
+
export declare class TranslationLockedError extends TranslationError {
|
|
25
|
+
readonly retryAfter?: number | undefined;
|
|
26
|
+
constructor(key: string, retryAfter?: number | undefined);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Server error (HTTP 5xx)
|
|
30
|
+
* Should trigger retry logic with exponential backoff
|
|
31
|
+
*/
|
|
32
|
+
export declare class ServerError extends TranslationError {
|
|
33
|
+
constructor(key: string, status: number);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Network error (timeout, DNS failure, CORS, etc.)
|
|
37
|
+
* Not an HTTP error - network layer failed
|
|
38
|
+
*/
|
|
39
|
+
export declare class NetworkError extends Error {
|
|
40
|
+
readonly cause?: unknown;
|
|
41
|
+
constructor(message: string, cause?: unknown);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Type guard to check if error is a TranslationError
|
|
45
|
+
*/
|
|
46
|
+
export declare function isTranslationError(error: unknown): error is TranslationError;
|
|
47
|
+
/**
|
|
48
|
+
* Type guard to check if error is retryable (5xx or network)
|
|
49
|
+
*/
|
|
50
|
+
export declare function isRetryableError(error: unknown): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Type guard to check if error is client error (4xx - not retryable)
|
|
53
|
+
*/
|
|
54
|
+
export declare function isClientError(error: unknown): boolean;
|
|
55
|
+
//# sourceMappingURL=translation-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-errors.d.ts","sourceRoot":"","sources":["../../src/errors/translation-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;aAEvB,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,MAAM;gBADd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM;CASlB;AAED;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,gBAAgB;gBAChD,GAAG,EAAE,MAAM;CAGxB;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,gBAAgB;aAGxC,UAAU,CAAC,EAAE,MAAM;gBADnC,GAAG,EAAE,MAAM,EACK,UAAU,CAAC,EAAE,MAAM,YAAA;CAItC;AAED;;;GAGG;AACH,qBAAa,WAAY,SAAQ,gBAAgB;gBACnC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAGxC;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK;aACQ,KAAK,CAAC,EAAE,OAAO;gBAAhD,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,OAAO;CAO7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAE5E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKrD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for translation operations
|
|
3
|
+
* Used for type-safe exception handling in repositories and handlers
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base error class for all translation-related errors
|
|
7
|
+
*/
|
|
8
|
+
export class TranslationError extends Error {
|
|
9
|
+
key;
|
|
10
|
+
status;
|
|
11
|
+
constructor(key, status, message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.key = key;
|
|
14
|
+
this.status = status;
|
|
15
|
+
this.name = this.constructor.name;
|
|
16
|
+
// Maintains proper stack trace for where our error was thrown
|
|
17
|
+
if (Error.captureStackTrace) {
|
|
18
|
+
Error.captureStackTrace(this, this.constructor);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Translation not found in backend (HTTP 404)
|
|
24
|
+
* Should be synced to backend for translators to fill in
|
|
25
|
+
*/
|
|
26
|
+
export class TranslationNotFoundError extends TranslationError {
|
|
27
|
+
constructor(key) {
|
|
28
|
+
super(key, 404, `Translation not found: ${key}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Translation exists but is locked/not ready (HTTP 423)
|
|
33
|
+
* Should NOT be synced to backend - will retry on next app start
|
|
34
|
+
*/
|
|
35
|
+
export class TranslationLockedError extends TranslationError {
|
|
36
|
+
retryAfter;
|
|
37
|
+
constructor(key, retryAfter) {
|
|
38
|
+
super(key, 423, `Translation locked: ${key}`);
|
|
39
|
+
this.retryAfter = retryAfter;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Server error (HTTP 5xx)
|
|
44
|
+
* Should trigger retry logic with exponential backoff
|
|
45
|
+
*/
|
|
46
|
+
export class ServerError extends TranslationError {
|
|
47
|
+
constructor(key, status) {
|
|
48
|
+
super(key, status, `Server error ${status}: ${key}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Network error (timeout, DNS failure, CORS, etc.)
|
|
53
|
+
* Not an HTTP error - network layer failed
|
|
54
|
+
*/
|
|
55
|
+
export class NetworkError extends Error {
|
|
56
|
+
cause;
|
|
57
|
+
constructor(message, cause) {
|
|
58
|
+
super(message);
|
|
59
|
+
this.cause = cause;
|
|
60
|
+
this.name = 'NetworkError';
|
|
61
|
+
if (Error.captureStackTrace) {
|
|
62
|
+
Error.captureStackTrace(this, this.constructor);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Type guard to check if error is a TranslationError
|
|
68
|
+
*/
|
|
69
|
+
export function isTranslationError(error) {
|
|
70
|
+
return error instanceof TranslationError;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Type guard to check if error is retryable (5xx or network)
|
|
74
|
+
*/
|
|
75
|
+
export function isRetryableError(error) {
|
|
76
|
+
return error instanceof ServerError || error instanceof NetworkError;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Type guard to check if error is client error (4xx - not retryable)
|
|
80
|
+
*/
|
|
81
|
+
export function isClientError(error) {
|
|
82
|
+
return (error instanceof TranslationNotFoundError ||
|
|
83
|
+
error instanceof TranslationLockedError);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=translation-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation-errors.js","sourceRoot":"","sources":["../../src/errors/translation-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEvB;IACA;IAFlB,YACkB,GAAW,EACX,MAAc,EAC9B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAQ;QAI9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,8DAA8D;QAC9D,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,wBAAyB,SAAQ,gBAAgB;IAC5D,YAAY,GAAW;QACrB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,0BAA0B,GAAG,EAAE,CAAC,CAAC;IACnD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,gBAAgB;IAGxC;IAFlB,YACE,GAAW,EACK,UAAmB;QAEnC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,uBAAuB,GAAG,EAAE,CAAC,CAAC;QAF9B,eAAU,GAAV,UAAU,CAAS;IAGrC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,gBAAgB;IAC/C,YAAY,GAAW,EAAE,MAAc;QACrC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,gBAAgB,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACQ;IAA7C,YAAY,OAAe,EAAkB,KAAe;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,UAAK,GAAL,KAAK,CAAU;QAE1D,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,KAAK,YAAY,gBAAgB,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,WAAW,IAAI,KAAK,YAAY,YAAY,CAAC;AACvE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,CACL,KAAK,YAAY,wBAAwB;QACzC,KAAK,YAAY,sBAAsB,CACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplified memory cache handler
|
|
3
|
+
*/
|
|
4
|
+
import { EventEmitter } from '../base/event-emitter.js';
|
|
5
|
+
import { IAsyncHandler } from '../interfaces/handler.interface.js';
|
|
6
|
+
import { IAsyncRepository, IStatsProvider } from '../interfaces/repository.interface.js';
|
|
7
|
+
import type { TranslationData } from '../types/translation-data.types.js';
|
|
8
|
+
import type { TranslationContext, TranslationRequest, TranslationResult } from '../types/translation.types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Async storage cache handler (IndexedDB, localStorage, etc.)
|
|
11
|
+
*/
|
|
12
|
+
export declare class AsyncHandler implements IAsyncHandler {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly version = "1.0.0";
|
|
15
|
+
readonly priority: number;
|
|
16
|
+
readonly type: "storage";
|
|
17
|
+
readonly enabled: boolean;
|
|
18
|
+
private ttlMap;
|
|
19
|
+
private ttl;
|
|
20
|
+
private repository;
|
|
21
|
+
private bus;
|
|
22
|
+
constructor(eventEmitter: EventEmitter, repository: IAsyncRepository & IStatsProvider);
|
|
23
|
+
getSourceType(): 'memory' | 'storage' | 'network' | 'fallback';
|
|
24
|
+
/**
|
|
25
|
+
* Simple lookup implementation
|
|
26
|
+
* Returns ContentUnit with both text and styles
|
|
27
|
+
*/
|
|
28
|
+
lookup(request: TranslationRequest): Promise<TranslationResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Simple save implementation
|
|
31
|
+
* Stores ContentUnit (text + styles) as JSON
|
|
32
|
+
*/
|
|
33
|
+
save(request: TranslationRequest, result: TranslationResult): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Namespace saving implementation
|
|
36
|
+
*/
|
|
37
|
+
saveNamespace(translations: TranslationData, context: TranslationContext): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* ✅ Strategy 1: Direct cache lookup using unified pattern
|
|
40
|
+
* Returns parsed ContentUnit (text + styles) or null
|
|
41
|
+
*/
|
|
42
|
+
private tryDirectLookup;
|
|
43
|
+
/**
|
|
44
|
+
* ✅ Strategy 2: Namespace lookup using unified pattern
|
|
45
|
+
* Returns parsed ContentUnit (text + styles) or null
|
|
46
|
+
*/
|
|
47
|
+
private tryNamespaceLookup;
|
|
48
|
+
/**
|
|
49
|
+
* Helper to create consistent TranslationResult objects
|
|
50
|
+
* Now includes styles from ContentUnit
|
|
51
|
+
*/
|
|
52
|
+
private createResult;
|
|
53
|
+
/**
|
|
54
|
+
* Check TTL and expire if needed (async version)
|
|
55
|
+
* Returns true if expired, false if still valid
|
|
56
|
+
*/
|
|
57
|
+
private checkAndExpireTTL;
|
|
58
|
+
/**
|
|
59
|
+
* Set value in repository and update TTL (async version)
|
|
60
|
+
*/
|
|
61
|
+
private setWithTTL;
|
|
62
|
+
/**
|
|
63
|
+
* Refresh TTL on access
|
|
64
|
+
*/
|
|
65
|
+
private refreshTTL;
|
|
66
|
+
/**
|
|
67
|
+
* Get TTL information for debugging
|
|
68
|
+
*/
|
|
69
|
+
getTTLInfo(): Record<string, {
|
|
70
|
+
timestamp: number;
|
|
71
|
+
age: number;
|
|
72
|
+
remaining: number;
|
|
73
|
+
}>;
|
|
74
|
+
destroy(): Promise<void>;
|
|
75
|
+
getEntries(): Record<string, string> | undefined;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=async-storage-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-storage-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/async-storage-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,cAAc,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAgBvC;;GAEG;AACH,qBAAa,YAAa,YAAW,aAAa;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,YAAsB;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,GAAG,CAAe;gBAGxB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,gBAAgB,GAAG,cAAc;IAW/C,aAAa,IAAI,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU;IAI9D;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAwCrE;;;OAGG;IACG,IAAI,CACR,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAAC,IAAI,CAAC;IAehB;;OAEG;IACG,aAAa,CACjB,YAAY,EAAE,eAAe,EAC7B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAoChB;;;OAGG;YACW,eAAe;IA8B7B;;;OAGG;YACW,kBAAkB;IAyDhC;;;OAGG;IACH,OAAO,CAAC,YAAY;IAiBpB;;;OAGG;YACW,iBAAiB;IAW/B;;OAEG;YACW,UAAU;IAKxB;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,UAAU,IAAI,MAAM,CAClB,MAAM,EACN;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CACtD;IAgBK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;CAKjD"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simplified memory cache handler
|
|
3
|
+
*/
|
|
4
|
+
import { logger } from '../utils/index.js';
|
|
5
|
+
import { createNamespaceCacheKey, flattenTranslations, resolveNestedKey, } from '../utils/translation-value-utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Async storage cache handler (IndexedDB, localStorage, etc.)
|
|
8
|
+
*/
|
|
9
|
+
export class AsyncHandler {
|
|
10
|
+
name;
|
|
11
|
+
version = '1.0.0';
|
|
12
|
+
priority;
|
|
13
|
+
type = 'storage';
|
|
14
|
+
enabled;
|
|
15
|
+
ttlMap = new Map();
|
|
16
|
+
ttl;
|
|
17
|
+
repository;
|
|
18
|
+
bus;
|
|
19
|
+
constructor(eventEmitter, repository) {
|
|
20
|
+
this.bus = eventEmitter;
|
|
21
|
+
this.repository = repository;
|
|
22
|
+
this.name = repository.name;
|
|
23
|
+
const config = repository.getConfig();
|
|
24
|
+
this.enabled = config.enabled ?? true;
|
|
25
|
+
this.priority = config.priority ?? 0;
|
|
26
|
+
this.ttl = config.options?.ttl ?? 30 * 60 * 1000; // Default 30 minutes
|
|
27
|
+
}
|
|
28
|
+
getSourceType() {
|
|
29
|
+
return 'memory';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Simple lookup implementation
|
|
33
|
+
* Returns ContentUnit with both text and styles
|
|
34
|
+
*/
|
|
35
|
+
async lookup(request) {
|
|
36
|
+
const startTime = Date.now();
|
|
37
|
+
logger.debug(`Async lookup: ${request.cleanKey}`);
|
|
38
|
+
const repoBus = this.bus.repo(request, this.name);
|
|
39
|
+
const directResult = await this.tryDirectLookup(request);
|
|
40
|
+
if (directResult !== null) {
|
|
41
|
+
logger.debug(`Cache hit: ${request.cleanKey}`);
|
|
42
|
+
repoBus.getSuccess(directResult.text);
|
|
43
|
+
return this.createResult(directResult, 'storage', 200, startTime, true);
|
|
44
|
+
}
|
|
45
|
+
// Try namespace lookup for nested keys
|
|
46
|
+
if (request.cleanKey.includes('.') && request.namespace) {
|
|
47
|
+
const namespaceResult = await this.tryNamespaceLookup(request);
|
|
48
|
+
if (namespaceResult !== null) {
|
|
49
|
+
logger.debug(`Namespace hit: ${request.cleanKey}`);
|
|
50
|
+
repoBus.getSuccess(namespaceResult.text);
|
|
51
|
+
return this.createResult(namespaceResult, 'storage', 200, startTime, true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
logger.debug(`Cache miss: ${request.cleanKey}`);
|
|
55
|
+
repoBus.getMiss();
|
|
56
|
+
// Return fallback result (no styles for fallback)
|
|
57
|
+
return this.createResult({ text: request.parsedDefaultValue || request.cleanKey, styles: {} }, 'fallback', 404, startTime);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Simple save implementation
|
|
61
|
+
* Stores ContentUnit (text + styles) as JSON
|
|
62
|
+
*/
|
|
63
|
+
async save(request, result) {
|
|
64
|
+
if (!result.value)
|
|
65
|
+
return;
|
|
66
|
+
const repoBus = this.bus.repo(request, this.name);
|
|
67
|
+
// Store as ContentUnit JSON (text + styles together)
|
|
68
|
+
const contentUnit = {
|
|
69
|
+
text: result.value,
|
|
70
|
+
styles: result.styles || {},
|
|
71
|
+
};
|
|
72
|
+
await this.setWithTTL(request.individualCacheKey, JSON.stringify(contentUnit));
|
|
73
|
+
logger.debug(`Saved to cache: ${request.cleanKey}`);
|
|
74
|
+
repoBus.setSuccess(result.value);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Namespace saving implementation
|
|
78
|
+
*/
|
|
79
|
+
async saveNamespace(translations, context) {
|
|
80
|
+
if (!context.namespace)
|
|
81
|
+
return;
|
|
82
|
+
const repoBus = this.bus.repo(context.locale + ':' + context.namespace, this.name);
|
|
83
|
+
const keyCount = Object.keys(translations).length;
|
|
84
|
+
logger.debug(`Saving namespace: ${context.locale}:${context.namespace} (${keyCount} keys)`);
|
|
85
|
+
// Store full namespace: @locale:namespace
|
|
86
|
+
const namespaceCacheKey = createNamespaceCacheKey(context.locale, context.namespace);
|
|
87
|
+
await this.setWithTTL(namespaceCacheKey, JSON.stringify(translations));
|
|
88
|
+
// Store flattened individual keys: locale:namespace:key
|
|
89
|
+
const flattened = flattenTranslations(translations, '', context.locale, context.namespace);
|
|
90
|
+
let savedCount = 0;
|
|
91
|
+
for (const [flatKey, flatValue] of Object.entries(flattened)) {
|
|
92
|
+
await this.setWithTTL(flatKey, flatValue);
|
|
93
|
+
savedCount++;
|
|
94
|
+
}
|
|
95
|
+
logger.debug(`Saved: ${savedCount} keys + namespace blob`);
|
|
96
|
+
repoBus.setSuccess(JSON.stringify(translations));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* ✅ Strategy 1: Direct cache lookup using unified pattern
|
|
100
|
+
* Returns parsed ContentUnit (text + styles) or null
|
|
101
|
+
*/
|
|
102
|
+
async tryDirectLookup(request) {
|
|
103
|
+
// Check TTL and expire if needed
|
|
104
|
+
if (await this.checkAndExpireTTL(request.individualCacheKey)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const cachedValue = await this.repository.get(request.individualCacheKey);
|
|
108
|
+
if (!cachedValue)
|
|
109
|
+
return null;
|
|
110
|
+
this.refreshTTL(request.individualCacheKey); // Refresh TTL on access
|
|
111
|
+
// Parse cached ContentUnit JSON
|
|
112
|
+
try {
|
|
113
|
+
const parsed = JSON.parse(cachedValue);
|
|
114
|
+
if (typeof parsed === 'object' && 'text' in parsed) {
|
|
115
|
+
return {
|
|
116
|
+
text: String(parsed.text),
|
|
117
|
+
styles: parsed.styles || {},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// Legacy format: plain string
|
|
121
|
+
return { text: cachedValue, styles: {} };
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// If parse fails, treat as legacy plain string
|
|
125
|
+
return { text: cachedValue, styles: {} };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* ✅ Strategy 2: Namespace lookup using unified pattern
|
|
130
|
+
* Returns parsed ContentUnit (text + styles) or null
|
|
131
|
+
*/
|
|
132
|
+
async tryNamespaceLookup(request) {
|
|
133
|
+
if (!request.namespace)
|
|
134
|
+
return null;
|
|
135
|
+
const namespaceCacheKey = createNamespaceCacheKey(request.locale, request.namespace);
|
|
136
|
+
// Check TTL for namespace
|
|
137
|
+
if (await this.checkAndExpireTTL(namespaceCacheKey)) {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const namespaceData = await this.repository.get(namespaceCacheKey);
|
|
141
|
+
if (!namespaceData)
|
|
142
|
+
return null;
|
|
143
|
+
this.refreshTTL(namespaceCacheKey); // Refresh TTL on access
|
|
144
|
+
try {
|
|
145
|
+
const translations = JSON.parse(namespaceData);
|
|
146
|
+
const value = resolveNestedKey(translations, request.cleanKey);
|
|
147
|
+
if (value !== null && value !== undefined) {
|
|
148
|
+
// Extract ContentUnit from namespace data
|
|
149
|
+
let contentUnit;
|
|
150
|
+
if (typeof value === 'object' && value !== null && 'text' in value) {
|
|
151
|
+
// Server ContentUnit format: { text, styles }
|
|
152
|
+
contentUnit = {
|
|
153
|
+
text: String(value.text),
|
|
154
|
+
styles: value.styles || {},
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
// Plain string fallback
|
|
159
|
+
contentUnit = { text: String(value), styles: {} };
|
|
160
|
+
}
|
|
161
|
+
// Cache the individual key for faster future access (as JSON)
|
|
162
|
+
await this.setWithTTL(request.individualCacheKey, JSON.stringify(contentUnit));
|
|
163
|
+
logger.debug(`Cached from namespace: ${request.cleanKey}`);
|
|
164
|
+
return contentUnit;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
// Invalid JSON in namespace cache
|
|
169
|
+
logger.debug(`Invalid JSON in namespace cache: ${namespaceCacheKey}`, error);
|
|
170
|
+
await this.repository.remove(namespaceCacheKey);
|
|
171
|
+
this.ttlMap.delete(namespaceCacheKey);
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Helper to create consistent TranslationResult objects
|
|
177
|
+
* Now includes styles from ContentUnit
|
|
178
|
+
*/
|
|
179
|
+
createResult(contentUnit, source, status, startTime, cached) {
|
|
180
|
+
return {
|
|
181
|
+
value: contentUnit.text,
|
|
182
|
+
styles: contentUnit.styles,
|
|
183
|
+
source,
|
|
184
|
+
status,
|
|
185
|
+
duration: Date.now() - startTime,
|
|
186
|
+
...(cached !== undefined && { cached }),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Check TTL and expire if needed (async version)
|
|
191
|
+
* Returns true if expired, false if still valid
|
|
192
|
+
*/
|
|
193
|
+
async checkAndExpireTTL(cacheKey) {
|
|
194
|
+
const timestamp = this.ttlMap.get(cacheKey);
|
|
195
|
+
if (timestamp && Date.now() - timestamp > this.ttl) {
|
|
196
|
+
await this.repository.remove(cacheKey);
|
|
197
|
+
this.ttlMap.delete(cacheKey);
|
|
198
|
+
logger.debug(`TTL expired: ${cacheKey}`);
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Set value in repository and update TTL (async version)
|
|
205
|
+
*/
|
|
206
|
+
async setWithTTL(cacheKey, value) {
|
|
207
|
+
await this.repository.set(cacheKey, value);
|
|
208
|
+
this.ttlMap.set(cacheKey, Date.now());
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Refresh TTL on access
|
|
212
|
+
*/
|
|
213
|
+
refreshTTL(cacheKey) {
|
|
214
|
+
this.ttlMap.set(cacheKey, Date.now());
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Get TTL information for debugging
|
|
218
|
+
*/
|
|
219
|
+
getTTLInfo() {
|
|
220
|
+
const ttlInfo = {};
|
|
221
|
+
const now = Date.now();
|
|
222
|
+
for (const [key, timestamp] of this.ttlMap.entries()) {
|
|
223
|
+
const age = now - timestamp;
|
|
224
|
+
const remaining = Math.max(0, this.ttl - age);
|
|
225
|
+
ttlInfo[key] = { timestamp, age, remaining };
|
|
226
|
+
}
|
|
227
|
+
return ttlInfo;
|
|
228
|
+
}
|
|
229
|
+
async destroy() {
|
|
230
|
+
await this.repository.clear();
|
|
231
|
+
this.ttlMap.clear();
|
|
232
|
+
}
|
|
233
|
+
getEntries() {
|
|
234
|
+
if (this.repository.getEntries !== undefined) {
|
|
235
|
+
return this.repository.getEntries();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=async-storage-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-storage-handler.js","sourceRoot":"","sources":["../../src/handlers/async-storage-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAU7C;;GAEG;AACH,MAAM,OAAO,YAAY;IACd,IAAI,CAAS;IACb,OAAO,GAAG,OAAO,CAAC;IAClB,QAAQ,CAAS;IACjB,IAAI,GAAG,SAAkB,CAAC;IAC1B,OAAO,CAAU;IAClB,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnC,GAAG,CAAS;IACZ,UAAU,CAAoC;IAC9C,GAAG,CAAe;IAE1B,YACE,YAA0B,EAC1B,UAA6C;QAE7C,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAA6B,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,qBAAqB;IACzE,CAAC;IAED,aAAa;QACX,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,OAA2B;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,iBAAiB,OAAO,CAAC,QAAQ,EAAE,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AO,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;QAC/C,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,UAAU;QACR,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QACtC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Array-based handler chain implementation
|
|
3
|
+
* Much simpler than linked list approach
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from '../base/event-emitter.js';
|
|
6
|
+
import type { IAsyncHandler, ISyncHandler } from '../interfaces/handler.interface.js';
|
|
7
|
+
import type { TranslationData } from '../types/translation-data.types.js';
|
|
8
|
+
import type { TranslationContext, TranslationRequest, TranslationResult } from '../types/translation.types.js';
|
|
9
|
+
export declare class HandlerChain {
|
|
10
|
+
private asyncHandlers;
|
|
11
|
+
private syncHandlers;
|
|
12
|
+
private bus;
|
|
13
|
+
constructor(eventEmitter: EventEmitter);
|
|
14
|
+
addSyncHandler(handler: ISyncHandler): void;
|
|
15
|
+
handleSync(request: TranslationRequest): TranslationResult | null;
|
|
16
|
+
private saveToMemoryHandlers;
|
|
17
|
+
private saveNamespaceToMemoryHandlers;
|
|
18
|
+
addAsyncHandler(handler: IAsyncHandler): void;
|
|
19
|
+
handleAsync(request: TranslationRequest): Promise<TranslationResult | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Save translation to all storage handlers that come before the source handler
|
|
22
|
+
*/
|
|
23
|
+
private saveToStorageHandlers;
|
|
24
|
+
private saveNamespaceToStorageHandlers;
|
|
25
|
+
saveNamespaceToHandlers(translations: TranslationData, context: TranslationContext): Promise<void>;
|
|
26
|
+
getSyncHandlers(): ISyncHandler[];
|
|
27
|
+
getAsyncHandlers(): IAsyncHandler[];
|
|
28
|
+
/**
|
|
29
|
+
* Get chain info for debugging
|
|
30
|
+
*/
|
|
31
|
+
getChainInfo(): {
|
|
32
|
+
length: number;
|
|
33
|
+
handlers: Array<{
|
|
34
|
+
name: string;
|
|
35
|
+
priority: number;
|
|
36
|
+
type: 'memory' | 'storage' | 'network' | 'fallback';
|
|
37
|
+
enabled: boolean | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Check if any handler has cached data
|
|
42
|
+
*/
|
|
43
|
+
isCached(request: TranslationRequest): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Get combined cache entries
|
|
46
|
+
*/
|
|
47
|
+
getEntries(): Record<string, any>;
|
|
48
|
+
/**
|
|
49
|
+
* Destroy all handlers
|
|
50
|
+
*/
|
|
51
|
+
destroy(): Promise<void>;
|
|
52
|
+
private sortHandlersIfNeeded;
|
|
53
|
+
loadNamespace(locale: string, namespace: string): Promise<TranslationData | null>;
|
|
54
|
+
clearCache(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Clear cache entries for a specific namespace
|
|
57
|
+
*/
|
|
58
|
+
clearNamespace(locale: string, namespace: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Set a value directly in the cache (for optimistic updates)
|
|
61
|
+
* Bypasses the normal handler flow to directly set values in memory handlers
|
|
62
|
+
* Stores as ContentUnit (text + styles) for consistency
|
|
63
|
+
*
|
|
64
|
+
* @param key - Full cache key (e.g., 'en:app:welcome')
|
|
65
|
+
* @param value - Translation value
|
|
66
|
+
* @param styles - Optional styles for indexed tags
|
|
67
|
+
*/
|
|
68
|
+
setCache(key: string, value: string, styles?: Record<string, string[]>): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get namespace data from cache for ContentUnit style lookup
|
|
71
|
+
*
|
|
72
|
+
* Used by t() to retrieve styles for indexed tags at render time.
|
|
73
|
+
*
|
|
74
|
+
* @param namespaceCacheKey - Cache key in format @locale:namespace
|
|
75
|
+
* @returns Parsed namespace data or null if not found
|
|
76
|
+
*/
|
|
77
|
+
getNamespaceData(namespaceCacheKey: string): TranslationData | null;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=handler-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler-chain.d.ts","sourceRoot":"","sources":["../../src/handlers/handler-chain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAGvC,qBAAa,YAAY;IACvB,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,GAAG,CAAe;gBAEd,YAAY,EAAE,YAAY;IAItC,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAO3C,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,GAAG,IAAI;IAkBjE,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,6BAA6B;IAoCrC,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAQvC,WAAW,CACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IA6CpC;;OAEG;YACW,qBAAqB;YA+BrB,8BAA8B;IAsCtC,uBAAuB,CAC3B,YAAY,EAAE,eAAe,EAC7B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;IAK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