@webiny/stdlib 0.0.1
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/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +60 -0
- package/dist/browser/features/LocalStorageCache/LocalStorageCache.d.ts +26 -0
- package/dist/browser/features/LocalStorageCache/LocalStorageCache.d.ts.map +1 -0
- package/dist/browser/features/LocalStorageCache/LocalStorageCache.js +159 -0
- package/dist/browser/features/LocalStorageCache/LocalStorageCache.js.map +1 -0
- package/dist/browser/features/LocalStorageCache/errors.d.ts +26 -0
- package/dist/browser/features/LocalStorageCache/errors.d.ts.map +1 -0
- package/dist/browser/features/LocalStorageCache/errors.js +23 -0
- package/dist/browser/features/LocalStorageCache/errors.js.map +1 -0
- package/dist/browser/features/LocalStorageCache/feature.d.ts +6 -0
- package/dist/browser/features/LocalStorageCache/feature.d.ts.map +1 -0
- package/dist/browser/features/LocalStorageCache/feature.js +10 -0
- package/dist/browser/features/LocalStorageCache/feature.js.map +1 -0
- package/dist/browser/features/LocalStorageCache/index.d.ts +4 -0
- package/dist/browser/features/LocalStorageCache/index.d.ts.map +1 -0
- package/dist/browser/features/LocalStorageCache/index.js +4 -0
- package/dist/browser/features/LocalStorageCache/index.js.map +1 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/common/core/BaseError.d.ts +13 -0
- package/dist/common/core/BaseError.d.ts.map +1 -0
- package/dist/common/core/BaseError.js +8 -0
- package/dist/common/core/BaseError.js.map +1 -0
- package/dist/common/core/Result.d.ts +103 -0
- package/dist/common/core/Result.d.ts.map +1 -0
- package/dist/common/core/Result.js +127 -0
- package/dist/common/core/Result.js.map +1 -0
- package/dist/common/core/ResultAsync.d.ts +17 -0
- package/dist/common/core/ResultAsync.d.ts.map +1 -0
- package/dist/common/core/ResultAsync.js +62 -0
- package/dist/common/core/ResultAsync.js.map +1 -0
- package/dist/common/core/createAbstraction.d.ts +4 -0
- package/dist/common/core/createAbstraction.d.ts.map +1 -0
- package/dist/common/core/createAbstraction.js +5 -0
- package/dist/common/core/createAbstraction.js.map +1 -0
- package/dist/common/core/createFeature.d.ts +10 -0
- package/dist/common/core/createFeature.d.ts.map +1 -0
- package/dist/common/core/createFeature.js +9 -0
- package/dist/common/core/createFeature.js.map +1 -0
- package/dist/common/core/index.d.ts +7 -0
- package/dist/common/core/index.d.ts.map +1 -0
- package/dist/common/core/index.js +6 -0
- package/dist/common/core/index.js.map +1 -0
- package/dist/common/features/Cache/AsyncMemoryCache.d.ts +23 -0
- package/dist/common/features/Cache/AsyncMemoryCache.d.ts.map +1 -0
- package/dist/common/features/Cache/AsyncMemoryCache.js +90 -0
- package/dist/common/features/Cache/AsyncMemoryCache.js.map +1 -0
- package/dist/common/features/Cache/AsyncMemoryCacheFeature.d.ts +6 -0
- package/dist/common/features/Cache/AsyncMemoryCacheFeature.d.ts.map +1 -0
- package/dist/common/features/Cache/AsyncMemoryCacheFeature.js +10 -0
- package/dist/common/features/Cache/AsyncMemoryCacheFeature.js.map +1 -0
- package/dist/common/features/Cache/MemoryCache.d.ts +23 -0
- package/dist/common/features/Cache/MemoryCache.d.ts.map +1 -0
- package/dist/common/features/Cache/MemoryCache.js +75 -0
- package/dist/common/features/Cache/MemoryCache.js.map +1 -0
- package/dist/common/features/Cache/MemoryCacheFeature.d.ts +6 -0
- package/dist/common/features/Cache/MemoryCacheFeature.d.ts.map +1 -0
- package/dist/common/features/Cache/MemoryCacheFeature.js +10 -0
- package/dist/common/features/Cache/MemoryCacheFeature.js.map +1 -0
- package/dist/common/features/Cache/abstractions/AsyncCache.d.ts +39 -0
- package/dist/common/features/Cache/abstractions/AsyncCache.d.ts.map +1 -0
- package/dist/common/features/Cache/abstractions/AsyncCache.js +3 -0
- package/dist/common/features/Cache/abstractions/AsyncCache.js.map +1 -0
- package/dist/common/features/Cache/abstractions/Cache.d.ts +39 -0
- package/dist/common/features/Cache/abstractions/Cache.d.ts.map +1 -0
- package/dist/common/features/Cache/abstractions/Cache.js +3 -0
- package/dist/common/features/Cache/abstractions/Cache.js.map +1 -0
- package/dist/common/features/Cache/abstractions/CacheError.d.ts +5 -0
- package/dist/common/features/Cache/abstractions/CacheError.d.ts.map +1 -0
- package/dist/common/features/Cache/abstractions/CacheError.js +5 -0
- package/dist/common/features/Cache/abstractions/CacheError.js.map +1 -0
- package/dist/common/features/Cache/abstractions/index.d.ts +4 -0
- package/dist/common/features/Cache/abstractions/index.d.ts.map +1 -0
- package/dist/common/features/Cache/abstractions/index.js +4 -0
- package/dist/common/features/Cache/abstractions/index.js.map +1 -0
- package/dist/common/features/Cache/index.d.ts +8 -0
- package/dist/common/features/Cache/index.d.ts.map +1 -0
- package/dist/common/features/Cache/index.js +6 -0
- package/dist/common/features/Cache/index.js.map +1 -0
- package/dist/common/features/Logger/ConsoleLogger.d.ts +28 -0
- package/dist/common/features/Logger/ConsoleLogger.d.ts.map +1 -0
- package/dist/common/features/Logger/ConsoleLogger.js +84 -0
- package/dist/common/features/Logger/ConsoleLogger.js.map +1 -0
- package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.d.ts +27 -0
- package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.d.ts.map +1 -0
- package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.js +3 -0
- package/dist/common/features/Logger/abstractions/ConsoleLoggerConfig.js.map +1 -0
- package/dist/common/features/Logger/abstractions/Logger.d.ts +20 -0
- package/dist/common/features/Logger/abstractions/Logger.d.ts.map +1 -0
- package/dist/common/features/Logger/abstractions/Logger.js +3 -0
- package/dist/common/features/Logger/abstractions/Logger.js.map +1 -0
- package/dist/common/features/Logger/abstractions/index.d.ts +3 -0
- package/dist/common/features/Logger/abstractions/index.d.ts.map +1 -0
- package/dist/common/features/Logger/abstractions/index.js +3 -0
- package/dist/common/features/Logger/abstractions/index.js.map +1 -0
- package/dist/common/features/Logger/feature.d.ts +9 -0
- package/dist/common/features/Logger/feature.d.ts.map +1 -0
- package/dist/common/features/Logger/feature.js +13 -0
- package/dist/common/features/Logger/feature.js.map +1 -0
- package/dist/common/features/Logger/index.d.ts +5 -0
- package/dist/common/features/Logger/index.d.ts.map +1 -0
- package/dist/common/features/Logger/index.js +5 -0
- package/dist/common/features/Logger/index.js.map +1 -0
- package/dist/common/index.d.ts +11 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +9 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/utils/boolean.d.ts +7 -0
- package/dist/common/utils/boolean.d.ts.map +1 -0
- package/dist/common/utils/boolean.js +22 -0
- package/dist/common/utils/boolean.js.map +1 -0
- package/dist/common/utils/dotProp.d.ts +23 -0
- package/dist/common/utils/dotProp.d.ts.map +1 -0
- package/dist/common/utils/dotProp.js +45 -0
- package/dist/common/utils/dotProp.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/node/features/DirectoryTool/DirectoryTool.d.ts +24 -0
- package/dist/node/features/DirectoryTool/DirectoryTool.d.ts.map +1 -0
- package/dist/node/features/DirectoryTool/DirectoryTool.js +83 -0
- package/dist/node/features/DirectoryTool/DirectoryTool.js.map +1 -0
- package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.d.ts +32 -0
- package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.d.ts.map +1 -0
- package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.js +3 -0
- package/dist/node/features/DirectoryTool/abstractions/DirectoryTool.js.map +1 -0
- package/dist/node/features/DirectoryTool/abstractions/index.d.ts +2 -0
- package/dist/node/features/DirectoryTool/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/DirectoryTool/abstractions/index.js +2 -0
- package/dist/node/features/DirectoryTool/abstractions/index.js.map +1 -0
- package/dist/node/features/DirectoryTool/feature.d.ts +5 -0
- package/dist/node/features/DirectoryTool/feature.d.ts.map +1 -0
- package/dist/node/features/DirectoryTool/feature.js +9 -0
- package/dist/node/features/DirectoryTool/feature.js.map +1 -0
- package/dist/node/features/DirectoryTool/index.d.ts +4 -0
- package/dist/node/features/DirectoryTool/index.d.ts.map +1 -0
- package/dist/node/features/DirectoryTool/index.js +4 -0
- package/dist/node/features/DirectoryTool/index.js.map +1 -0
- package/dist/node/features/FileTool/FileTool.d.ts +26 -0
- package/dist/node/features/FileTool/FileTool.d.ts.map +1 -0
- package/dist/node/features/FileTool/FileTool.js +71 -0
- package/dist/node/features/FileTool/FileTool.js.map +1 -0
- package/dist/node/features/FileTool/abstractions/FileTool.d.ts +15 -0
- package/dist/node/features/FileTool/abstractions/FileTool.d.ts.map +1 -0
- package/dist/node/features/FileTool/abstractions/FileTool.js +3 -0
- package/dist/node/features/FileTool/abstractions/FileTool.js.map +1 -0
- package/dist/node/features/FileTool/abstractions/index.d.ts +2 -0
- package/dist/node/features/FileTool/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/FileTool/abstractions/index.js +2 -0
- package/dist/node/features/FileTool/abstractions/index.js.map +1 -0
- package/dist/node/features/FileTool/feature.d.ts +5 -0
- package/dist/node/features/FileTool/feature.d.ts.map +1 -0
- package/dist/node/features/FileTool/feature.js +9 -0
- package/dist/node/features/FileTool/feature.js.map +1 -0
- package/dist/node/features/FileTool/index.d.ts +4 -0
- package/dist/node/features/FileTool/index.d.ts.map +1 -0
- package/dist/node/features/FileTool/index.js +4 -0
- package/dist/node/features/FileTool/index.js.map +1 -0
- package/dist/node/features/JsonFileTool/JsonFileTool.d.ts +19 -0
- package/dist/node/features/JsonFileTool/JsonFileTool.d.ts.map +1 -0
- package/dist/node/features/JsonFileTool/JsonFileTool.js +43 -0
- package/dist/node/features/JsonFileTool/JsonFileTool.js.map +1 -0
- package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.d.ts +17 -0
- package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.d.ts.map +1 -0
- package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.js +3 -0
- package/dist/node/features/JsonFileTool/abstractions/JsonFileTool.js.map +1 -0
- package/dist/node/features/JsonFileTool/abstractions/index.d.ts +2 -0
- package/dist/node/features/JsonFileTool/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/JsonFileTool/abstractions/index.js +2 -0
- package/dist/node/features/JsonFileTool/abstractions/index.js.map +1 -0
- package/dist/node/features/JsonFileTool/feature.d.ts +5 -0
- package/dist/node/features/JsonFileTool/feature.d.ts.map +1 -0
- package/dist/node/features/JsonFileTool/feature.js +9 -0
- package/dist/node/features/JsonFileTool/feature.js.map +1 -0
- package/dist/node/features/JsonFileTool/index.d.ts +4 -0
- package/dist/node/features/JsonFileTool/index.d.ts.map +1 -0
- package/dist/node/features/JsonFileTool/index.js +4 -0
- package/dist/node/features/JsonFileTool/index.js.map +1 -0
- package/dist/node/features/NdJsonReaderTool/LineAccumulator.d.ts +13 -0
- package/dist/node/features/NdJsonReaderTool/LineAccumulator.d.ts.map +1 -0
- package/dist/node/features/NdJsonReaderTool/LineAccumulator.js +68 -0
- package/dist/node/features/NdJsonReaderTool/LineAccumulator.js.map +1 -0
- package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.d.ts +22 -0
- package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.d.ts.map +1 -0
- package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.js +73 -0
- package/dist/node/features/NdJsonReaderTool/NdJsonReaderTool.js.map +1 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.d.ts +41 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.d.ts.map +1 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.js +3 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/NdJsonReaderTool.js.map +1 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/index.d.ts +2 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/index.js +2 -0
- package/dist/node/features/NdJsonReaderTool/abstractions/index.js.map +1 -0
- package/dist/node/features/NdJsonReaderTool/feature.d.ts +5 -0
- package/dist/node/features/NdJsonReaderTool/feature.d.ts.map +1 -0
- package/dist/node/features/NdJsonReaderTool/feature.js +9 -0
- package/dist/node/features/NdJsonReaderTool/feature.js.map +1 -0
- package/dist/node/features/NdJsonReaderTool/index.d.ts +4 -0
- package/dist/node/features/NdJsonReaderTool/index.d.ts.map +1 -0
- package/dist/node/features/NdJsonReaderTool/index.js +4 -0
- package/dist/node/features/NdJsonReaderTool/index.js.map +1 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFile.d.ts +67 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFile.d.ts.map +1 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFile.js +91 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFile.js.map +1 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.d.ts +23 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.d.ts.map +1 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.js +75 -0
- package/dist/node/features/PackageJsonFileTool/PackageJsonFileTool.js.map +1 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.d.ts +40 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.d.ts.map +1 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.js +3 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/PackageJsonFileTool.js.map +1 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/index.d.ts +2 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/index.js +2 -0
- package/dist/node/features/PackageJsonFileTool/abstractions/index.js.map +1 -0
- package/dist/node/features/PackageJsonFileTool/feature.d.ts +5 -0
- package/dist/node/features/PackageJsonFileTool/feature.d.ts.map +1 -0
- package/dist/node/features/PackageJsonFileTool/feature.js +9 -0
- package/dist/node/features/PackageJsonFileTool/feature.js.map +1 -0
- package/dist/node/features/PackageJsonFileTool/index.d.ts +5 -0
- package/dist/node/features/PackageJsonFileTool/index.d.ts.map +1 -0
- package/dist/node/features/PackageJsonFileTool/index.js +5 -0
- package/dist/node/features/PackageJsonFileTool/index.js.map +1 -0
- package/dist/node/features/PathTool/PathTool.d.ts +14 -0
- package/dist/node/features/PathTool/PathTool.d.ts.map +1 -0
- package/dist/node/features/PathTool/PathTool.js +38 -0
- package/dist/node/features/PathTool/PathTool.js.map +1 -0
- package/dist/node/features/PathTool/abstractions/PathTool.d.ts +23 -0
- package/dist/node/features/PathTool/abstractions/PathTool.d.ts.map +1 -0
- package/dist/node/features/PathTool/abstractions/PathTool.js +3 -0
- package/dist/node/features/PathTool/abstractions/PathTool.js.map +1 -0
- package/dist/node/features/PathTool/abstractions/index.d.ts +2 -0
- package/dist/node/features/PathTool/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/PathTool/abstractions/index.js +2 -0
- package/dist/node/features/PathTool/abstractions/index.js.map +1 -0
- package/dist/node/features/PathTool/errors.d.ts +12 -0
- package/dist/node/features/PathTool/errors.d.ts.map +1 -0
- package/dist/node/features/PathTool/errors.js +9 -0
- package/dist/node/features/PathTool/errors.js.map +1 -0
- package/dist/node/features/PathTool/feature.d.ts +5 -0
- package/dist/node/features/PathTool/feature.d.ts.map +1 -0
- package/dist/node/features/PathTool/feature.js +9 -0
- package/dist/node/features/PathTool/feature.js.map +1 -0
- package/dist/node/features/PathTool/index.d.ts +5 -0
- package/dist/node/features/PathTool/index.d.ts.map +1 -0
- package/dist/node/features/PathTool/index.js +5 -0
- package/dist/node/features/PathTool/index.js.map +1 -0
- package/dist/node/features/PinoLogger/PinoLogger.d.ts +27 -0
- package/dist/node/features/PinoLogger/PinoLogger.d.ts.map +1 -0
- package/dist/node/features/PinoLogger/PinoLogger.js +152 -0
- package/dist/node/features/PinoLogger/PinoLogger.js.map +1 -0
- package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.d.ts +24 -0
- package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.d.ts.map +1 -0
- package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.js +3 -0
- package/dist/node/features/PinoLogger/abstractions/PinoLoggerConfig.js.map +1 -0
- package/dist/node/features/PinoLogger/abstractions/index.d.ts +2 -0
- package/dist/node/features/PinoLogger/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/PinoLogger/abstractions/index.js +2 -0
- package/dist/node/features/PinoLogger/abstractions/index.js.map +1 -0
- package/dist/node/features/PinoLogger/feature.d.ts +9 -0
- package/dist/node/features/PinoLogger/feature.d.ts.map +1 -0
- package/dist/node/features/PinoLogger/feature.js +13 -0
- package/dist/node/features/PinoLogger/feature.js.map +1 -0
- package/dist/node/features/PinoLogger/index.d.ts +4 -0
- package/dist/node/features/PinoLogger/index.d.ts.map +1 -0
- package/dist/node/features/PinoLogger/index.js +4 -0
- package/dist/node/features/PinoLogger/index.js.map +1 -0
- package/dist/node/features/ReadStreamFactory/ReadStreamFactory.d.ts +11 -0
- package/dist/node/features/ReadStreamFactory/ReadStreamFactory.d.ts.map +1 -0
- package/dist/node/features/ReadStreamFactory/ReadStreamFactory.js +27 -0
- package/dist/node/features/ReadStreamFactory/ReadStreamFactory.js.map +1 -0
- package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.d.ts +21 -0
- package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.d.ts.map +1 -0
- package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.js +3 -0
- package/dist/node/features/ReadStreamFactory/abstractions/ReadStreamFactory.js.map +1 -0
- package/dist/node/features/ReadStreamFactory/abstractions/index.d.ts +2 -0
- package/dist/node/features/ReadStreamFactory/abstractions/index.d.ts.map +1 -0
- package/dist/node/features/ReadStreamFactory/abstractions/index.js +2 -0
- package/dist/node/features/ReadStreamFactory/abstractions/index.js.map +1 -0
- package/dist/node/features/ReadStreamFactory/feature.d.ts +5 -0
- package/dist/node/features/ReadStreamFactory/feature.d.ts.map +1 -0
- package/dist/node/features/ReadStreamFactory/feature.js +9 -0
- package/dist/node/features/ReadStreamFactory/feature.js.map +1 -0
- package/dist/node/features/ReadStreamFactory/index.d.ts +4 -0
- package/dist/node/features/ReadStreamFactory/index.d.ts.map +1 -0
- package/dist/node/features/ReadStreamFactory/index.js +4 -0
- package/dist/node/features/ReadStreamFactory/index.js.map +1 -0
- package/dist/node/index.d.ts +9 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +9 -0
- package/dist/node/index.js.map +1 -0
- package/dist/package.json +58 -0
- package/package.json +61 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ResultAsync } from "../../../core/index.js";
|
|
2
|
+
import type { CacheError } from "./CacheError.js";
|
|
3
|
+
export interface IAsyncCache {
|
|
4
|
+
/** Returns the parsed value, or null if the key does not exist. */
|
|
5
|
+
get<T>(key: string): ResultAsync<T | null, CacheError<any>>;
|
|
6
|
+
/** Serialises value to JSON and stores it under key. */
|
|
7
|
+
set<T>(key: string, value: T): ResultAsync<void, CacheError<any>>;
|
|
8
|
+
/** Removes the entry. No-op if key does not exist. */
|
|
9
|
+
remove(key: string): ResultAsync<void, CacheError<any>>;
|
|
10
|
+
/** Returns true if the key exists, false otherwise. */
|
|
11
|
+
has(key: string): ResultAsync<boolean, CacheError<any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Removes all entries. On a prefixed instance only removes
|
|
14
|
+
* entries whose key starts with this prefix.
|
|
15
|
+
*/
|
|
16
|
+
clear(): ResultAsync<void, CacheError<any>>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns all stored keys. On a prefixed instance returns only
|
|
19
|
+
* keys within the prefix, with the prefix stripped.
|
|
20
|
+
*/
|
|
21
|
+
keys(): ResultAsync<string[], CacheError<any>>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the cached value for key if present; otherwise calls
|
|
24
|
+
* factory (sync or async), stores the result, and returns it.
|
|
25
|
+
* Factory errors propagate — they are NOT captured in the ResultAsync.
|
|
26
|
+
*/
|
|
27
|
+
getOrSet<T>(key: string, factory: () => T | Promise<T>): ResultAsync<T, CacheError<any>>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a scoped view of this cache. Keys in the child are
|
|
30
|
+
* stored as `<prefix>.<key>`. Nesting is supported:
|
|
31
|
+
* `byPrefix("a").byPrefix("b")` stores keys as `a.b.<key>`.
|
|
32
|
+
*/
|
|
33
|
+
byPrefix(prefix: string): IAsyncCache;
|
|
34
|
+
}
|
|
35
|
+
export declare const AsyncCache: import("@webiny/di").Abstraction<IAsyncCache>;
|
|
36
|
+
export declare namespace AsyncCache {
|
|
37
|
+
type Interface = IAsyncCache;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=AsyncCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncCache.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/AsyncCache.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,WAAW;IACxB,mEAAmE;IACnE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,wDAAwD;IACxD,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,sDAAsD;IACtD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,uDAAuD;IACvD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD;;;OAGG;IACH,KAAK,IAAI,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C;;;OAGG;IACH,IAAI,IAAI,WAAW,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACzF;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;CACzC;AAED,eAAO,MAAM,UAAU,+CAAoD,CAAC;AAE5E,yBAAiB,UAAU,CAAC;IACxB,KAAY,SAAS,GAAG,WAAW,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncCache.js","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/AsyncCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAqC3D,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAc,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Result } from "../../../core/index.js";
|
|
2
|
+
import type { CacheError } from "./CacheError.js";
|
|
3
|
+
export interface ICache {
|
|
4
|
+
/** Returns the parsed value, or null if the key does not exist. */
|
|
5
|
+
get<T>(key: string): Result<T | null, CacheError<any>>;
|
|
6
|
+
/** Serialises value to JSON and stores it under key. */
|
|
7
|
+
set<T>(key: string, value: T): Result<void, CacheError<any>>;
|
|
8
|
+
/** Removes the entry. No-op if key does not exist. */
|
|
9
|
+
remove(key: string): Result<void, CacheError<any>>;
|
|
10
|
+
/** Returns true if the key exists, false otherwise. */
|
|
11
|
+
has(key: string): Result<boolean, CacheError<any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Removes all entries. On a prefixed instance only removes
|
|
14
|
+
* entries whose key starts with this prefix.
|
|
15
|
+
*/
|
|
16
|
+
clear(): Result<void, CacheError<any>>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns all stored keys. On a prefixed instance returns only
|
|
19
|
+
* keys within the prefix, with the prefix stripped.
|
|
20
|
+
*/
|
|
21
|
+
keys(): Result<string[], CacheError<any>>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the cached value for key if present; otherwise calls
|
|
24
|
+
* factory, stores the result, and returns it. Factory errors
|
|
25
|
+
* propagate — they are NOT captured in the Result.
|
|
26
|
+
*/
|
|
27
|
+
getOrSet<T>(key: string, factory: () => T): Result<T, CacheError<any>>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a scoped view of this cache. Keys in the child are
|
|
30
|
+
* stored as `<prefix>.<key>`. Nesting is supported:
|
|
31
|
+
* `byPrefix("a").byPrefix("b")` stores keys as `a.b.<key>`.
|
|
32
|
+
*/
|
|
33
|
+
byPrefix(prefix: string): ICache;
|
|
34
|
+
}
|
|
35
|
+
export declare const Cache: import("@webiny/di").Abstraction<ICache>;
|
|
36
|
+
export declare namespace Cache {
|
|
37
|
+
type Interface = ICache;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/Cache.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,C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/Cache/abstractions/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAqC3D,MAAM,CAAC,MAAM,KAAK,GAAG,iBAAiB,CAAS,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheError.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/CacheError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,+DAA+D;AAC/D,8BAAsB,UAAU,CAAC,KAAK,GAAG,IAAI,CAAE,SAAQ,SAAS,CAAC,KAAK,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheError.js","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/CacheError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,+DAA+D;AAC/D,MAAM,OAAgB,UAAyB,SAAQ,SAAgB;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/common/features/Cache/abstractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Cache } from "./abstractions/Cache.js";
|
|
2
|
+
export type { ICache } from "./abstractions/Cache.js";
|
|
3
|
+
export { AsyncCache } from "./abstractions/AsyncCache.js";
|
|
4
|
+
export type { IAsyncCache } from "./abstractions/AsyncCache.js";
|
|
5
|
+
export { CacheError } from "./abstractions/CacheError.js";
|
|
6
|
+
export { MemoryCacheFeature } from "./MemoryCacheFeature.js";
|
|
7
|
+
export { AsyncMemoryCacheFeature } from "./AsyncMemoryCacheFeature.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/features/Cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,YAAY,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Cache } from "./abstractions/Cache.js";
|
|
2
|
+
export { AsyncCache } from "./abstractions/AsyncCache.js";
|
|
3
|
+
export { CacheError } from "./abstractions/CacheError.js";
|
|
4
|
+
export { MemoryCacheFeature } from "./MemoryCacheFeature.js";
|
|
5
|
+
export { AsyncMemoryCacheFeature } from "./AsyncMemoryCacheFeature.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/features/Cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Logger } from "./abstractions/Logger.js";
|
|
2
|
+
import { ConsoleLoggerConfig } from "./abstractions/ConsoleLoggerConfig.js";
|
|
3
|
+
/** Console-based logger. Registered under the Logger abstraction by ConsoleLoggerFeature. */
|
|
4
|
+
declare class ConsoleLoggerImpl implements Logger.Interface {
|
|
5
|
+
private readonly minLevel;
|
|
6
|
+
private readonly prefix;
|
|
7
|
+
private readonly timestamp;
|
|
8
|
+
private readonly formatTimestamp;
|
|
9
|
+
constructor(configProvider?: ConsoleLoggerConfig.Interface);
|
|
10
|
+
private shouldLog;
|
|
11
|
+
private format;
|
|
12
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
13
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
14
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
15
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
16
|
+
fatal(message: string, data?: Record<string, unknown>): void;
|
|
17
|
+
child(prefix: string): Logger.Interface;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Console-based Logger implementation.
|
|
21
|
+
* Register via ConsoleLoggerFeature. Optionally pair with ConsoleLoggerConfig
|
|
22
|
+
* to configure log level, prefix, and timestamps.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ConsoleLogger: typeof ConsoleLoggerImpl & {
|
|
25
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/Logger.js").ILogger>;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=ConsoleL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;CACJ;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa;;CAGxB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Logger } from "./abstractions/Logger.js";
|
|
2
|
+
import { ConsoleLoggerConfig } from "./abstractions/ConsoleLoggerConfig.js";
|
|
3
|
+
const LOG_LEVEL_PRIORITY = {
|
|
4
|
+
debug: 0,
|
|
5
|
+
info: 1,
|
|
6
|
+
warn: 2,
|
|
7
|
+
error: 3,
|
|
8
|
+
fatal: 4
|
|
9
|
+
};
|
|
10
|
+
/** Console-based logger. Registered under the Logger abstraction by ConsoleLoggerFeature. */
|
|
11
|
+
class ConsoleLoggerImpl {
|
|
12
|
+
minLevel;
|
|
13
|
+
prefix;
|
|
14
|
+
timestamp;
|
|
15
|
+
formatTimestamp;
|
|
16
|
+
constructor(configProvider) {
|
|
17
|
+
const config = configProvider?.getConfig();
|
|
18
|
+
this.minLevel = LOG_LEVEL_PRIORITY[config?.logLevel ?? "debug"];
|
|
19
|
+
this.prefix = config?.prefix ?? "";
|
|
20
|
+
this.timestamp = config?.timestamp ?? false;
|
|
21
|
+
this.formatTimestamp = config?.formatTimestamp ?? (d => d.toISOString());
|
|
22
|
+
}
|
|
23
|
+
shouldLog(level) {
|
|
24
|
+
return (LOG_LEVEL_PRIORITY[level] ?? 0) >= this.minLevel;
|
|
25
|
+
}
|
|
26
|
+
format(message) {
|
|
27
|
+
const parts = [];
|
|
28
|
+
if (this.timestamp) {
|
|
29
|
+
parts.push(`[${this.formatTimestamp(new Date())}]`);
|
|
30
|
+
}
|
|
31
|
+
if (this.prefix) {
|
|
32
|
+
parts.push(`[${this.prefix}]`);
|
|
33
|
+
}
|
|
34
|
+
parts.push(message);
|
|
35
|
+
return parts.join(" ");
|
|
36
|
+
}
|
|
37
|
+
debug(message, data) {
|
|
38
|
+
if (this.shouldLog("debug")) {
|
|
39
|
+
console.debug(this.format(message), ...(data ? [data] : []));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
info(message, data) {
|
|
43
|
+
if (this.shouldLog("info")) {
|
|
44
|
+
console.info(this.format(message), ...(data ? [data] : []));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
warn(message, data) {
|
|
48
|
+
if (this.shouldLog("warn")) {
|
|
49
|
+
console.warn(this.format(message), ...(data ? [data] : []));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
error(message, data) {
|
|
53
|
+
if (this.shouldLog("error")) {
|
|
54
|
+
console.error(this.format(message), ...(data ? [data] : []));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
fatal(message, data) {
|
|
58
|
+
if (this.shouldLog("fatal")) {
|
|
59
|
+
console.error(this.format(message), ...(data ? [data] : []));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
child(prefix) {
|
|
63
|
+
const combined = this.prefix ? `${this.prefix}:${prefix}` : prefix;
|
|
64
|
+
const configOverride = {
|
|
65
|
+
getConfig: () => ({
|
|
66
|
+
logLevel: Object.keys(LOG_LEVEL_PRIORITY).find(k => LOG_LEVEL_PRIORITY[k] === this.minLevel) ?? "debug",
|
|
67
|
+
prefix: combined,
|
|
68
|
+
timestamp: this.timestamp,
|
|
69
|
+
formatTimestamp: this.formatTimestamp
|
|
70
|
+
})
|
|
71
|
+
};
|
|
72
|
+
return new ConsoleLoggerImpl(configOverride);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Console-based Logger implementation.
|
|
77
|
+
* Register via ConsoleLoggerFeature. Optionally pair with ConsoleLoggerConfig
|
|
78
|
+
* to configure log level, prefix, and timestamps.
|
|
79
|
+
*/
|
|
80
|
+
export const ConsoleLogger = Logger.createImplementation({
|
|
81
|
+
implementation: ConsoleLoggerImpl,
|
|
82
|
+
dependencies: [[ConsoleLoggerConfig, { optional: true }]]
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=ConsoleLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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C,CAAC;CAC5D,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration shape returned by ConsoleLoggerConfig implementations.
|
|
3
|
+
* All fields are optional — ConsoleLogger uses sensible defaults for any omitted field.
|
|
4
|
+
*/
|
|
5
|
+
export interface ConsoleLoggerConfigData {
|
|
6
|
+
/** Minimum log level to output. Default: "debug" (logs everything). */
|
|
7
|
+
logLevel?: "debug" | "info" | "warn" | "error" | "fatal";
|
|
8
|
+
/** String prepended to every message, e.g. "MyApp". Default: none. */
|
|
9
|
+
prefix?: string;
|
|
10
|
+
/** Whether to include a timestamp in each message. Default: false. */
|
|
11
|
+
timestamp?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Custom timestamp formatter. Only called when `timestamp` is true.
|
|
14
|
+
* Default: `(d) => d.toISOString()`.
|
|
15
|
+
*/
|
|
16
|
+
formatTimestamp?: (date: Date) => string;
|
|
17
|
+
}
|
|
18
|
+
interface IConsoleLoggerConfig {
|
|
19
|
+
getConfig(): ConsoleLoggerConfigData;
|
|
20
|
+
}
|
|
21
|
+
export declare const ConsoleLoggerConfig: import("@webiny/di").Abstraction<IConsoleLoggerConfig>;
|
|
22
|
+
export declare namespace ConsoleLoggerConfig {
|
|
23
|
+
type Interface = IConsoleLoggerConfig;
|
|
24
|
+
type Config = ConsoleLoggerConfigData;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=ConsoleLoggerConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleLoggerConfig.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Logger/abstractions/ConsoleLoggerConfig.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACzD,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;CAC5C;AAED,UAAU,oBAAoB;IAC1B,SAAS,IAAI,uBAAuB,CAAC;CACxC;AAED,eAAO,MAAM,mBAAmB,wDAE/B,CAAC;AAEF,yBAAiB,mBAAmB,CAAC;IACjC,KAAY,SAAS,GAAG,oBAAoB,CAAC;IAC7C,KAAY,MAAM,GAAG,uBAAuB,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsoleLoggerConfig.js","sourceRoot":"","sources":["../../../../../src/common/features/Logger/abstractions/ConsoleLoggerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAwB3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAChD,0BAA0B,CAC7B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger abstraction — the DI token and interface for all logger implementations.
|
|
3
|
+
*
|
|
4
|
+
* Register a concrete implementation (ConsoleLoggerFeature or PinoLoggerFeature)
|
|
5
|
+
* before resolving this abstraction from the container.
|
|
6
|
+
*/
|
|
7
|
+
export interface ILogger {
|
|
8
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
9
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
10
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
11
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
12
|
+
fatal(message: string, data?: Record<string, unknown>): void;
|
|
13
|
+
/** Creates a child logger that prepends `prefix` to every message. */
|
|
14
|
+
child(prefix: string): ILogger;
|
|
15
|
+
}
|
|
16
|
+
export declare const Logger: import("@webiny/di").Abstraction<ILogger>;
|
|
17
|
+
export declare namespace Logger {
|
|
18
|
+
type Interface = ILogger;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Logger/abstractions/Logger.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,MAAM,WAAW,OAAO;IACpB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,sEAAsE;IACtE,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,MAAM,2CAA4C,CAAC;AAEhE,yBAAiB,MAAM,CAAC;IACpB,KAAY,SAAS,GAAG,OAAO,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../../../src/common/features/Logger/abstractions/Logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAmB3D,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAU,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/features/Logger/abstractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/common/features/Logger/abstractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers ConsoleLogger as the Logger implementation.
|
|
3
|
+
* Optionally pair with ConsoleLoggerConfig to override defaults.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ConsoleLoggerFeature: {
|
|
6
|
+
name: string;
|
|
7
|
+
register(container: import("@webiny/di").Container): void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/common/features/Logger/feature.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;CAK/B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFeature } from "../../core/index.js";
|
|
2
|
+
import { ConsoleLogger } from "./ConsoleLogger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Registers ConsoleLogger as the Logger implementation.
|
|
5
|
+
* Optionally pair with ConsoleLoggerConfig to override defaults.
|
|
6
|
+
*/
|
|
7
|
+
export const ConsoleLoggerFeature = createFeature({
|
|
8
|
+
name: "Core/ConsoleLoggerFeature",
|
|
9
|
+
register(container) {
|
|
10
|
+
container.register(ConsoleLogger).inSingletonScope();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../../../../src/common/features/Logger/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC;IAC9C,IAAI,EAAE,2BAA2B;IACjC,QAAQ,CAAC,SAAS;QACd,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACzD,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Logger } from "./abstractions/Logger.js";
|
|
2
|
+
export { ConsoleLoggerConfig } from "./abstractions/ConsoleLoggerConfig.js";
|
|
3
|
+
export { ConsoleLoggerFeature } from "./feature.js";
|
|
4
|
+
export { ConsoleLogger } from "./ConsoleLogger.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/features/Logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Logger } from "./abstractions/Logger.js";
|
|
2
|
+
export { ConsoleLoggerConfig } from "./abstractions/ConsoleLoggerConfig.js";
|
|
3
|
+
export { ConsoleLoggerFeature } from "./feature.js";
|
|
4
|
+
export { ConsoleLogger } from "./ConsoleLogger.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/features/Logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Result, ResultAsync, BaseError, createAbstraction, createFeature } from "./core/index.js";
|
|
2
|
+
export type { ErrorInput } from "./core/index.js";
|
|
3
|
+
export { Logger, type ILogger } from "./features/Logger/abstractions/Logger.js";
|
|
4
|
+
export { ConsoleLoggerConfig } from "./features/Logger/abstractions/ConsoleLoggerConfig.js";
|
|
5
|
+
export { ConsoleLoggerFeature } from "./features/Logger/feature.js";
|
|
6
|
+
export { ConsoleLogger } from "./features/Logger/ConsoleLogger.js";
|
|
7
|
+
export { Cache, AsyncCache, CacheError, MemoryCacheFeature, AsyncMemoryCacheFeature } from "./features/Cache/index.js";
|
|
8
|
+
export type { ICache, IAsyncCache } from "./features/Cache/index.js";
|
|
9
|
+
export { toBoolean, isTruthy, isFalsy } from "./utils/boolean.js";
|
|
10
|
+
export { immutableDelete, immutableGet, mutableDelete, mutableSet, immutableSet } from "./utils/dotProp.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnG,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACH,KAAK,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACH,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACf,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Result, ResultAsync, BaseError, createAbstraction, createFeature } from "./core/index.js";
|
|
2
|
+
export { Logger } from "./features/Logger/abstractions/Logger.js";
|
|
3
|
+
export { ConsoleLoggerConfig } from "./features/Logger/abstractions/ConsoleLoggerConfig.js";
|
|
4
|
+
export { ConsoleLoggerFeature } from "./features/Logger/feature.js";
|
|
5
|
+
export { ConsoleLogger } from "./features/Logger/ConsoleLogger.js";
|
|
6
|
+
export { Cache, AsyncCache, CacheError, MemoryCacheFeature, AsyncMemoryCacheFeature } from "./features/Cache/index.js";
|
|
7
|
+
export { toBoolean, isTruthy, isFalsy } from "./utils/boolean.js";
|
|
8
|
+
export { immutableDelete, immutableGet, mutableDelete, mutableSet, immutableSet } from "./utils/dotProp.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEnG,OAAO,EAAE,MAAM,EAAgB,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACH,KAAK,EACL,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EACH,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACf,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Exact semantic parity with the `boolean` npm package. */
|
|
2
|
+
export declare function toBoolean(value: unknown): boolean;
|
|
3
|
+
/** Returns `toBoolean(value)`. Readable alias for use in predicates. */
|
|
4
|
+
export declare function isTruthy(value: unknown): boolean;
|
|
5
|
+
/** Returns `!toBoolean(value)`. Readable inverse of `isTruthy`. */
|
|
6
|
+
export declare function isFalsy(value: unknown): boolean;
|
|
7
|
+
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../src/common/utils/boolean.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAajD;AAED,wEAAwE;AACxE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEhD;AAED,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Exact semantic parity with the `boolean` npm package. */
|
|
2
|
+
export function toBoolean(value) {
|
|
3
|
+
switch (Object.prototype.toString.call(value)) {
|
|
4
|
+
case "[object String]":
|
|
5
|
+
return ["true", "t", "yes", "y", "on", "1"].includes(value.trim().toLowerCase());
|
|
6
|
+
case "[object Number]":
|
|
7
|
+
return value.valueOf() === 1;
|
|
8
|
+
case "[object Boolean]":
|
|
9
|
+
return value.valueOf();
|
|
10
|
+
default:
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Returns `toBoolean(value)`. Readable alias for use in predicates. */
|
|
15
|
+
export function isTruthy(value) {
|
|
16
|
+
return toBoolean(value);
|
|
17
|
+
}
|
|
18
|
+
/** Returns `!toBoolean(value)`. Readable inverse of `isTruthy`. */
|
|
19
|
+
export function isFalsy(value) {
|
|
20
|
+
return !toBoolean(value);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=boolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src/common/utils/boolean.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,UAAU,SAAS,CAAC,KAAc;IACpC,QAAQ,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,KAAK,iBAAiB;YAClB,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,QAAQ,CAC/C,KAAgB,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CACzC,CAAC;QACN,KAAK,iBAAiB;YAClB,OAAQ,KAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7C,KAAK,kBAAkB;YACnB,OAAQ,KAAiB,CAAC,OAAO,EAAE,CAAC;QACxC;YACI,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,QAAQ,CAAC,KAAc;IACnC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,OAAO,CAAC,KAAc;IAClC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get a nested property value by dot-notation path.
|
|
3
|
+
*/
|
|
4
|
+
declare function immutableGet<T = unknown>(target: Record<string, any> | null | undefined, path: string, defaultValue?: T): T;
|
|
5
|
+
/**
|
|
6
|
+
* Returns a deep clone with the value set at the given path.
|
|
7
|
+
* If value is a function, it receives the current value and should return the new value.
|
|
8
|
+
*/
|
|
9
|
+
declare function immutableSet<T extends Record<string, any>>(target: T, path: string, value: unknown | ((current: any) => unknown)): T;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a deep clone with the property at the given path removed.
|
|
12
|
+
*/
|
|
13
|
+
declare function immutableDelete<T extends Record<string, any>>(target: T, path: string): T;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the value at the given path on the original target.
|
|
16
|
+
*/
|
|
17
|
+
declare function mutableSet<T extends Record<string, any>>(target: T, path: string, value: unknown): T;
|
|
18
|
+
/**
|
|
19
|
+
* Removes the property at the given path from the original target.
|
|
20
|
+
*/
|
|
21
|
+
declare function mutableDelete<T extends Record<string, any>>(target: T, path: string): boolean;
|
|
22
|
+
export { immutableGet, immutableSet, immutableDelete, mutableSet, mutableDelete };
|
|
23
|
+
//# sourceMappingURL=dotProp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotProp.d.ts","sourceRoot":"","sources":["../../../src/common/utils/dotProp.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,iBAAS,YAAY,CAAC,CAAC,GAAG,OAAO,EAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,EAC9C,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,CAAC,GACjB,CAAC,CAOH;AAED;;;GAGG;AACH,iBAAS,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/C,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAC7C,CAAC,CAKH;AAED;;GAEG;AACH,iBAAS,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAIlF;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAE7F;AAED;;GAEG;AACH,iBAAS,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtF;AAED,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getProperty, setProperty, deleteProperty } from "dot-prop";
|
|
2
|
+
/**
|
|
3
|
+
* Get a nested property value by dot-notation path.
|
|
4
|
+
*/
|
|
5
|
+
function immutableGet(target, path, defaultValue) {
|
|
6
|
+
if (!target && !defaultValue) {
|
|
7
|
+
return defaultValue;
|
|
8
|
+
}
|
|
9
|
+
else if (!target) {
|
|
10
|
+
return structuredClone(defaultValue);
|
|
11
|
+
}
|
|
12
|
+
return getProperty(structuredClone(target), path, defaultValue);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns a deep clone with the value set at the given path.
|
|
16
|
+
* If value is a function, it receives the current value and should return the new value.
|
|
17
|
+
*/
|
|
18
|
+
function immutableSet(target, path, value) {
|
|
19
|
+
const clone = structuredClone(target);
|
|
20
|
+
const finalValue = typeof value === "function" ? value(getProperty(clone, path)) : value;
|
|
21
|
+
setProperty(clone, path, finalValue);
|
|
22
|
+
return clone;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Returns a deep clone with the property at the given path removed.
|
|
26
|
+
*/
|
|
27
|
+
function immutableDelete(target, path) {
|
|
28
|
+
const clone = structuredClone(target);
|
|
29
|
+
deleteProperty(clone, path);
|
|
30
|
+
return clone;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sets the value at the given path on the original target.
|
|
34
|
+
*/
|
|
35
|
+
function mutableSet(target, path, value) {
|
|
36
|
+
return setProperty(target, path, value);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Removes the property at the given path from the original target.
|
|
40
|
+
*/
|
|
41
|
+
function mutableDelete(target, path) {
|
|
42
|
+
return deleteProperty(target, path);
|
|
43
|
+
}
|
|
44
|
+
export { immutableGet, immutableSet, immutableDelete, mutableSet, mutableDelete };
|
|
45
|
+
//# sourceMappingURL=dotProp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dotProp.js","sourceRoot":"","sources":["../../../src/common/utils/dotProp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEpE;;GAEG;AACH,SAAS,YAAY,CACjB,MAA8C,EAC9C,IAAY,EACZ,YAAgB;IAEhB,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC3B,OAAO,YAA4B,CAAC;IACxC,CAAC;SAAM,IAAI,CAAC,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