lakutata 2.0.34 → 2.0.36
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/com/cacher.cjs +229 -0
- package/com/cacher.d.ts +514 -0
- package/com/cacher.mjs +203 -0
- package/com/database.cjs +11 -5
- package/com/database.mjs +11 -5
- package/com/docker.cjs +26 -18
- package/com/docker.mjs +22 -14
- package/com/entrypoint.cjs +4 -2
- package/com/entrypoint.mjs +4 -2
- package/com/logger.cjs +9 -3
- package/com/logger.mjs +9 -3
- package/decorator/ctrl.cjs +4 -2
- package/decorator/ctrl.mjs +4 -2
- package/decorator/di.cjs +3 -1
- package/decorator/di.mjs +3 -1
- package/decorator/dto.cjs +3 -1
- package/decorator/dto.mjs +3 -1
- package/decorator/orm.cjs +27 -21
- package/decorator/orm.mjs +11 -5
- package/helper.cjs +17 -15
- package/helper.mjs +4 -2
- package/lakutata.cjs +14 -8
- package/lakutata.mjs +10 -4
- package/orm.cjs +25 -19
- package/orm.mjs +22 -16
- package/package.json +6 -1
- package/provider/database.cjs +11 -5
- package/provider/database.mjs +11 -5
- package/provider/passwordHash.cjs +3 -1
- package/provider/passwordHash.mjs +3 -1
- package/src/components/Database.cjs +11 -5
- package/src/components/Database.mjs +11 -5
- package/src/components/Logger.cjs +9 -3
- package/src/components/Logger.mjs +9 -3
- package/src/components/cacher/Cacher.cjs +734 -0
- package/src/components/cacher/Cacher.mjs +720 -0
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +3094 -0
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +3066 -0
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.cjs +33 -0
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.mjs +35 -0
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.cjs +38 -0
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.mjs +40 -0
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.cjs +31 -0
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.mjs +33 -0
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.cjs +40 -0
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.mjs +42 -0
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.cjs +43 -0
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.mjs +45 -0
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.cjs +35 -0
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.mjs +37 -0
- package/src/components/cacher/options/CacherOptions.cjs +95 -0
- package/src/components/cacher/options/CacherOptions.mjs +89 -0
- package/src/components/cacher/options/FileCacheOptions.cjs +79 -0
- package/src/components/cacher/options/FileCacheOptions.mjs +73 -0
- package/src/components/cacher/options/MemcacheCacheOptions.cjs +81 -0
- package/src/components/cacher/options/MemcacheCacheOptions.mjs +75 -0
- package/src/components/cacher/options/MongoCacheOptions.cjs +85 -0
- package/src/components/cacher/options/MongoCacheOptions.mjs +79 -0
- package/src/components/cacher/options/MysqlCacheOptions.cjs +85 -0
- package/src/components/cacher/options/MysqlCacheOptions.mjs +79 -0
- package/src/components/cacher/options/PostgresCacheOptions.cjs +89 -0
- package/src/components/cacher/options/PostgresCacheOptions.mjs +83 -0
- package/src/components/cacher/options/RedisCacheOptions.cjs +101 -0
- package/src/components/cacher/options/RedisCacheOptions.mjs +95 -0
- package/src/components/cacher/options/SqliteCacheOptions.cjs +79 -0
- package/src/components/cacher/options/SqliteCacheOptions.mjs +73 -0
- package/src/components/cacher/types/CacheStoreOptions.cjs +1 -0
- package/src/components/cacher/types/CacheStoreOptions.mjs +1 -0
- package/src/components/docker/ConnectionOptionsBuilder.cjs +22 -14
- package/src/components/docker/ConnectionOptionsBuilder.mjs +22 -14
- package/src/components/docker/Docker.cjs +22 -14
- package/src/components/docker/Docker.mjs +22 -14
- package/src/components/docker/lib/DockerContainer.cjs +34 -26
- package/src/components/docker/lib/DockerContainer.mjs +26 -18
- package/src/components/docker/lib/DockerContainerTTY.cjs +18 -10
- package/src/components/docker/lib/DockerContainerTTY.mjs +18 -10
- package/src/components/docker/lib/DockerImage.cjs +11 -9
- package/src/components/docker/lib/DockerImage.mjs +3 -1
- package/src/components/docker/options/DockerPruneOptions.cjs +3 -1
- package/src/components/docker/options/DockerPruneOptions.mjs +3 -1
- package/src/components/docker/options/auth/DockerAuthOptions.cjs +3 -1
- package/src/components/docker/options/auth/DockerAuthOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerCommitOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerCommitOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerCreateTTYOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerCreateTTYOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerExecOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerExecOptions.mjs +5 -3
- package/src/components/docker/options/container/ContainerExportDirectoryOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerExportDirectoryOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerKillOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerKillOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerLogsOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerLogsOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerRemoveOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerRemoveOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerSettingOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerSettingOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerStopOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerStopOptions.mjs +3 -1
- package/src/components/docker/options/container/ContainerTTYConsoleSizeOptions.cjs +3 -1
- package/src/components/docker/options/container/ContainerTTYConsoleSizeOptions.mjs +3 -1
- package/src/components/docker/options/image/ImageBuildOptions.cjs +3 -1
- package/src/components/docker/options/image/ImageBuildOptions.mjs +5 -3
- package/src/components/docker/options/image/ImageExportOptions.cjs +3 -1
- package/src/components/docker/options/image/ImageExportOptions.mjs +3 -1
- package/src/components/docker/options/image/ImageImportOptions.cjs +3 -1
- package/src/components/docker/options/image/ImageImportOptions.mjs +3 -1
- package/src/components/docker/options/image/ImagePullOptions.cjs +3 -1
- package/src/components/docker/options/image/ImagePullOptions.mjs +3 -1
- package/src/components/docker/options/image/ImagePushOptions.cjs +3 -1
- package/src/components/docker/options/image/ImagePushOptions.mjs +3 -1
- package/src/components/docker/options/image/ImageRemoveOptions.cjs +3 -1
- package/src/components/docker/options/image/ImageRemoveOptions.mjs +3 -1
- package/src/components/docker/options/image/ImageTagOptions.cjs +3 -1
- package/src/components/docker/options/image/ImageTagOptions.mjs +3 -1
- package/src/components/docker/options/network/NetworkCreateOptions.cjs +3 -1
- package/src/components/docker/options/network/NetworkCreateOptions.mjs +3 -1
- package/src/components/entrypoint/Entrypoint.cjs +4 -2
- package/src/components/entrypoint/Entrypoint.mjs +49 -47
- package/src/components/entrypoint/lib/Controller.cjs +3 -1
- package/src/components/entrypoint/lib/Controller.mjs +3 -1
- package/src/decorators/ctrl/CLIAction.cjs +6 -4
- package/src/decorators/ctrl/CLIAction.mjs +4 -2
- package/src/decorators/ctrl/HTTPAction.cjs +4 -2
- package/src/decorators/ctrl/HTTPAction.mjs +9 -7
- package/src/decorators/ctrl/ServiceAction.cjs +8 -6
- package/src/decorators/ctrl/ServiceAction.mjs +4 -2
- package/src/decorators/ctrl/http/DELETE.cjs +4 -2
- package/src/decorators/ctrl/http/DELETE.mjs +4 -2
- package/src/decorators/ctrl/http/GET.cjs +4 -2
- package/src/decorators/ctrl/http/GET.mjs +4 -2
- package/src/decorators/ctrl/http/HEAD.cjs +4 -2
- package/src/decorators/ctrl/http/HEAD.mjs +4 -2
- package/src/decorators/ctrl/http/OPTIONS.cjs +4 -2
- package/src/decorators/ctrl/http/OPTIONS.mjs +4 -2
- package/src/decorators/ctrl/http/PATCH.cjs +4 -2
- package/src/decorators/ctrl/http/PATCH.mjs +4 -2
- package/src/decorators/ctrl/http/POST.cjs +4 -2
- package/src/decorators/ctrl/http/POST.mjs +4 -2
- package/src/decorators/ctrl/http/PUT.cjs +4 -2
- package/src/decorators/ctrl/http/PUT.mjs +4 -2
- package/src/decorators/di/Configurable.cjs +3 -1
- package/src/decorators/di/Configurable.mjs +3 -1
- package/src/decorators/di/Inject.cjs +11 -9
- package/src/decorators/di/Inject.mjs +10 -8
- package/src/decorators/dto/Accept.cjs +3 -1
- package/src/decorators/dto/Accept.mjs +3 -1
- package/src/decorators/dto/Expect.cjs +3 -1
- package/src/decorators/dto/Expect.mjs +3 -1
- package/src/decorators/dto/IndexSignature.cjs +3 -1
- package/src/decorators/dto/IndexSignature.mjs +3 -1
- package/src/decorators/dto/Return.cjs +3 -1
- package/src/decorators/dto/Return.mjs +3 -1
- package/src/decorators/orm/AfterInsert.cjs +11 -5
- package/src/decorators/orm/AfterInsert.mjs +17 -11
- package/src/decorators/orm/AfterLoad.cjs +15 -9
- package/src/decorators/orm/AfterLoad.mjs +20 -14
- package/src/decorators/orm/AfterRecover.cjs +15 -9
- package/src/decorators/orm/AfterRecover.mjs +16 -10
- package/src/decorators/orm/AfterRemove.cjs +15 -9
- package/src/decorators/orm/AfterRemove.mjs +16 -10
- package/src/decorators/orm/AfterSoftRemove.cjs +11 -5
- package/src/decorators/orm/AfterSoftRemove.mjs +16 -10
- package/src/decorators/orm/AfterUpdate.cjs +11 -5
- package/src/decorators/orm/AfterUpdate.mjs +18 -12
- package/src/decorators/orm/BeforeInsert.cjs +17 -11
- package/src/decorators/orm/BeforeInsert.mjs +15 -9
- package/src/decorators/orm/BeforeRecover.cjs +18 -12
- package/src/decorators/orm/BeforeRecover.mjs +13 -7
- package/src/decorators/orm/BeforeRemove.cjs +18 -12
- package/src/decorators/orm/BeforeRemove.mjs +13 -7
- package/src/decorators/orm/BeforeSoftRemove.cjs +17 -11
- package/src/decorators/orm/BeforeSoftRemove.mjs +13 -7
- package/src/decorators/orm/BeforeUpdate.cjs +15 -9
- package/src/decorators/orm/BeforeUpdate.mjs +16 -10
- package/src/decorators/orm/Check.cjs +11 -5
- package/src/decorators/orm/Check.mjs +11 -5
- package/src/decorators/orm/ChildEntity.cjs +16 -10
- package/src/decorators/orm/ChildEntity.mjs +13 -7
- package/src/decorators/orm/Column.cjs +28 -22
- package/src/decorators/orm/Column.mjs +11 -5
- package/src/decorators/orm/CreateDateColumn.cjs +13 -7
- package/src/decorators/orm/CreateDateColumn.mjs +11 -5
- package/src/decorators/orm/DeleteDateColumn.cjs +13 -7
- package/src/decorators/orm/DeleteDateColumn.mjs +11 -5
- package/src/decorators/orm/Entity.cjs +15 -9
- package/src/decorators/orm/Entity.mjs +17 -11
- package/src/decorators/orm/EventSubscriber.cjs +11 -5
- package/src/decorators/orm/EventSubscriber.mjs +11 -5
- package/src/decorators/orm/Exclusion.cjs +11 -5
- package/src/decorators/orm/Exclusion.mjs +17 -11
- package/src/decorators/orm/Generated.cjs +13 -7
- package/src/decorators/orm/Generated.mjs +17 -11
- package/src/decorators/orm/Index.cjs +19 -13
- package/src/decorators/orm/Index.mjs +29 -23
- package/src/decorators/orm/JoinColumn.cjs +15 -9
- package/src/decorators/orm/JoinColumn.mjs +11 -5
- package/src/decorators/orm/JoinTable.cjs +11 -5
- package/src/decorators/orm/JoinTable.mjs +15 -9
- package/src/decorators/orm/ManyToMany.cjs +18 -12
- package/src/decorators/orm/ManyToMany.mjs +22 -16
- package/src/decorators/orm/ManyToOne.cjs +21 -15
- package/src/decorators/orm/ManyToOne.mjs +22 -16
- package/src/decorators/orm/ObjectIdColumn.cjs +11 -5
- package/src/decorators/orm/ObjectIdColumn.mjs +17 -11
- package/src/decorators/orm/OneToMany.cjs +19 -13
- package/src/decorators/orm/OneToMany.mjs +11 -5
- package/src/decorators/orm/OneToOne.cjs +20 -14
- package/src/decorators/orm/OneToOne.mjs +18 -12
- package/src/decorators/orm/PrimaryColumn.cjs +15 -9
- package/src/decorators/orm/PrimaryColumn.mjs +30 -24
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +11 -5
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +13 -7
- package/src/decorators/orm/RelationId.cjs +16 -10
- package/src/decorators/orm/RelationId.mjs +17 -11
- package/src/decorators/orm/TableInheritance.cjs +13 -7
- package/src/decorators/orm/TableInheritance.mjs +15 -9
- package/src/decorators/orm/Tree.cjs +11 -5
- package/src/decorators/orm/Tree.mjs +11 -5
- package/src/decorators/orm/TreeChildren.cjs +11 -5
- package/src/decorators/orm/TreeChildren.mjs +22 -16
- package/src/decorators/orm/TreeLevelColumn.cjs +11 -5
- package/src/decorators/orm/TreeLevelColumn.mjs +11 -5
- package/src/decorators/orm/TreeParent.cjs +17 -11
- package/src/decorators/orm/TreeParent.mjs +11 -5
- package/src/decorators/orm/Unique.cjs +18 -12
- package/src/decorators/orm/Unique.mjs +11 -5
- package/src/decorators/orm/UpdateDateColumn.cjs +13 -7
- package/src/decorators/orm/UpdateDateColumn.mjs +17 -11
- package/src/decorators/orm/VersionColumn.cjs +11 -5
- package/src/decorators/orm/VersionColumn.mjs +11 -5
- package/src/decorators/orm/ViewColumn.cjs +11 -5
- package/src/decorators/orm/ViewColumn.mjs +11 -5
- package/src/decorators/orm/ViewEntity.cjs +13 -7
- package/src/decorators/orm/ViewEntity.mjs +11 -5
- package/src/decorators/orm/VirtualColumn.cjs +11 -5
- package/src/decorators/orm/VirtualColumn.mjs +15 -9
- package/src/lib/base/BaseObject.cjs +3 -1
- package/src/lib/base/BaseObject.mjs +3 -1
- package/src/lib/base/Context.cjs +3 -1
- package/src/lib/base/Context.mjs +3 -1
- package/src/lib/base/internal/ApplicationConfigLoader.cjs +3 -1
- package/src/lib/base/internal/ApplicationConfigLoader.mjs +3 -1
- package/src/lib/base/internal/ControllerEntrypoint.cjs +1 -1
- package/src/lib/base/internal/ControllerEntrypoint.mjs +1 -1
- package/src/lib/base/internal/DataValidator.cjs +16 -14
- package/src/lib/base/internal/DataValidator.mjs +3 -1
- package/src/lib/base/internal/FlexibleDTO.cjs +3 -1
- package/src/lib/base/internal/FlexibleDTO.mjs +3 -1
- package/src/lib/base/internal/MethodValidation.cjs +18 -16
- package/src/lib/base/internal/MethodValidation.mjs +3 -1
- package/src/lib/base/internal/ModuleConfigLoader.cjs +3 -1
- package/src/lib/base/internal/ModuleConfigLoader.mjs +24 -22
- package/src/lib/base/internal/ObjectConfiguration.cjs +3 -1
- package/src/lib/base/internal/ObjectConfiguration.mjs +3 -1
- package/src/lib/base/internal/ObjectSchemaValidation.cjs +3 -1
- package/src/lib/base/internal/ObjectSchemaValidation.mjs +3 -1
- package/src/lib/base/internal/ObjectType.cjs +3 -1
- package/src/lib/base/internal/ObjectType.mjs +3 -1
- package/src/lib/context/CLIContext.cjs +3 -1
- package/src/lib/context/CLIContext.mjs +3 -1
- package/src/lib/context/HTTPContext.cjs +3 -1
- package/src/lib/context/HTTPContext.mjs +3 -1
- package/src/lib/context/ServiceContext.cjs +3 -1
- package/src/lib/context/ServiceContext.mjs +3 -1
- package/src/lib/core/Application.cjs +19 -13
- package/src/lib/core/Application.mjs +15 -9
- package/src/lib/core/Component.cjs +3 -1
- package/src/lib/core/Component.mjs +3 -1
- package/src/lib/core/Container.cjs +2 -0
- package/src/lib/core/Container.mjs +2 -0
- package/src/lib/core/DTO.cjs +3 -1
- package/src/lib/core/DTO.mjs +3 -1
- package/src/lib/core/Module.cjs +4 -2
- package/src/lib/core/Module.mjs +4 -2
- package/src/lib/core/Provider.cjs +3 -1
- package/src/lib/core/Provider.mjs +3 -1
- package/src/lib/helpers/IsSymbol.cjs +3 -1
- package/src/lib/helpers/IsSymbol.mjs +3 -1
- package/src/lib/helpers/NonceStr.cjs +1 -1
- package/src/lib/helpers/NonceStr.mjs +1 -1
- package/src/lib/helpers/ObjectHash.cjs +1 -1
- package/src/lib/helpers/ObjectHash.mjs +1 -1
- package/src/lib/helpers/RandomString.cjs +1 -1
- package/src/lib/helpers/RandomString.mjs +1 -1
- package/src/lib/ioc/DependencyInjectionContainer.cjs +3 -1
- package/src/lib/ioc/DependencyInjectionContainer.mjs +13 -11
- package/src/lib/ioc/Errors.cjs +3 -1
- package/src/lib/ioc/Errors.mjs +3 -1
- package/src/lib/ioc/ListModules.cjs +104 -102
- package/src/lib/ioc/ListModules.mjs +4 -2
- package/src/lib/ioc/LoadModules.cjs +2 -0
- package/src/lib/ioc/LoadModules.mjs +2 -0
- package/src/lib/ioc/Resolvers.cjs +9 -7
- package/src/lib/ioc/Resolvers.mjs +3 -1
- package/src/lib/ioc/Utils.cjs +3 -1
- package/src/lib/ioc/Utils.mjs +3 -1
- package/src/lib/validation/VLD.cjs +3 -1
- package/src/lib/validation/VLD.mjs +3 -1
- package/src/options/ApplicationOptions.cjs +3 -1
- package/src/options/ApplicationOptions.mjs +3 -1
- package/src/options/LoadAnonymousObjectOptions.cjs +3 -1
- package/src/options/LoadAnonymousObjectOptions.mjs +3 -1
- package/src/options/LoadNamedObjectOptions.cjs +3 -1
- package/src/options/LoadNamedObjectOptions.mjs +3 -1
- package/src/options/LoadObjectOptions.cjs +3 -1
- package/src/options/LoadObjectOptions.mjs +3 -1
- package/src/options/ModuleLoadObjectsOptions.cjs +3 -1
- package/src/options/ModuleLoadObjectsOptions.mjs +3 -1
- package/src/options/ModuleOptions.cjs +3 -1
- package/src/options/ModuleOptions.mjs +3 -1
- package/src/options/OverridableNamedObjectOptions.cjs +3 -1
- package/src/options/OverridableNamedObjectOptions.mjs +3 -1
- package/src/options/OverridableObjectOptions.cjs +3 -1
- package/src/options/OverridableObjectOptions.mjs +3 -1
- package/src/providers/Database.cjs +11 -5
- package/src/providers/Database.mjs +11 -5
- package/src/providers/PasswordHash.cjs +17 -15
- package/src/providers/PasswordHash.mjs +212 -210
- package/vendor/Package.10.cjs +0 -2
- package/vendor/Package.10.mjs +0 -2
- package/vendor/Package.11.cjs +1 -9
- package/vendor/Package.11.mjs +1 -9
- package/vendor/Package.12.cjs +5 -79
- package/vendor/Package.12.mjs +5 -73
- package/vendor/{Package.112.cjs → Package.122.cjs} +5501 -5501
- package/vendor/{Package.112.mjs → Package.122.mjs} +5507 -5507
- package/vendor/Package.13.cjs +7 -1
- package/vendor/Package.13.mjs +7 -1
- package/vendor/Package.132.cjs +87 -0
- package/vendor/Package.132.mjs +79 -0
- package/vendor/Package.14.cjs +1 -14055
- package/vendor/Package.14.mjs +1 -14029
- package/vendor/Package.15.cjs +1 -48245
- package/vendor/Package.15.mjs +1 -48209
- package/vendor/Package.16.cjs +14063 -0
- package/vendor/Package.16.mjs +14035 -0
- package/vendor/Package.17.cjs +3 -0
- package/vendor/Package.17.mjs +1 -0
- package/vendor/Package.18.cjs +48255 -0
- package/vendor/Package.18.mjs +48215 -0
- package/vendor/Package.19.cjs +3 -0
- package/vendor/Package.19.mjs +1 -0
- package/vendor/Package.610.cjs +175 -0
- package/vendor/Package.610.mjs +157 -0
- package/vendor/Package.611.cjs +196 -0
- package/vendor/Package.611.mjs +180 -0
- package/vendor/Package.62.cjs +1 -1
- package/vendor/Package.62.mjs +1 -1
- package/vendor/Package.65.cjs +716 -0
- package/vendor/Package.65.mjs +710 -0
- package/vendor/Package.66.cjs +680 -0
- package/vendor/Package.66.mjs +652 -0
- package/vendor/Package.67.cjs +143 -0
- package/vendor/Package.67.mjs +127 -0
- package/vendor/Package.68.cjs +341 -0
- package/vendor/Package.68.mjs +327 -0
- package/vendor/Package.69.cjs +157 -0
- package/vendor/Package.69.mjs +139 -0
package/com/cacher.d.ts
ADDED
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import '../vendor/TypeDef.2.js';
|
|
2
|
+
import EventEmitter from 'node:events';
|
|
3
|
+
import { D as DTO } from '../vendor/TypeDef.5.js';
|
|
4
|
+
import { C as Component } from '../vendor/TypeDef.3.js';
|
|
5
|
+
|
|
6
|
+
type EventListener = (...arguments_: any[]) => void;
|
|
7
|
+
declare class EventManager {
|
|
8
|
+
_eventListeners: Map<string, EventListener[]>;
|
|
9
|
+
_maxListeners: number;
|
|
10
|
+
constructor();
|
|
11
|
+
maxListeners(): number;
|
|
12
|
+
addListener(event: string, listener: EventListener): void;
|
|
13
|
+
on(event: string, listener: EventListener): this;
|
|
14
|
+
removeListener(event: string, listener: EventListener): void;
|
|
15
|
+
off(event: string, listener: EventListener): void;
|
|
16
|
+
once(event: string, listener: EventListener): void;
|
|
17
|
+
emit(event: string, ...arguments_: any[]): void;
|
|
18
|
+
listeners(event: string): EventListener[];
|
|
19
|
+
removeAllListeners(event?: string): void;
|
|
20
|
+
setMaxListeners(n: number): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type HookHandler = (...arguments_: any[]) => void;
|
|
24
|
+
declare class HooksManager extends EventManager {
|
|
25
|
+
_hookHandlers: Map<string, HookHandler[]>;
|
|
26
|
+
constructor();
|
|
27
|
+
addHandler(event: string, handler: HookHandler): void;
|
|
28
|
+
removeHandler(event: string, handler: HookHandler): void;
|
|
29
|
+
trigger(event: string, data: any): void;
|
|
30
|
+
get handlers(): Map<string, HookHandler[]>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare class StatsManager extends EventManager {
|
|
34
|
+
enabled: boolean;
|
|
35
|
+
hits: number;
|
|
36
|
+
misses: number;
|
|
37
|
+
sets: number;
|
|
38
|
+
deletes: number;
|
|
39
|
+
errors: number;
|
|
40
|
+
constructor(enabled?: boolean);
|
|
41
|
+
hit(): void;
|
|
42
|
+
miss(): void;
|
|
43
|
+
set(): void;
|
|
44
|
+
delete(): void;
|
|
45
|
+
reset(): void;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type DeserializedData<Value> = {
|
|
49
|
+
value?: Value;
|
|
50
|
+
expires?: number | undefined;
|
|
51
|
+
};
|
|
52
|
+
type CompressionAdapter = {
|
|
53
|
+
compress(value: any, options?: any): Promise<any>;
|
|
54
|
+
decompress(value: any, options?: any): Promise<any>;
|
|
55
|
+
serialize<Value>(data: DeserializedData<Value>): Promise<string> | string;
|
|
56
|
+
deserialize<Value>(data: string): Promise<DeserializedData<Value> | undefined> | DeserializedData<Value> | undefined;
|
|
57
|
+
};
|
|
58
|
+
type Serialize = <Value>(data: DeserializedData<Value>) => Promise<string> | string;
|
|
59
|
+
type Deserialize = <Value>(data: string) => Promise<DeserializedData<Value> | undefined> | DeserializedData<Value> | undefined;
|
|
60
|
+
type KeyvEntry = {
|
|
61
|
+
/**
|
|
62
|
+
* Key to set.
|
|
63
|
+
*/
|
|
64
|
+
key: string;
|
|
65
|
+
/**
|
|
66
|
+
* Value to set.
|
|
67
|
+
*/
|
|
68
|
+
value: any;
|
|
69
|
+
/**
|
|
70
|
+
* Time to live in milliseconds.
|
|
71
|
+
*/
|
|
72
|
+
ttl?: number;
|
|
73
|
+
};
|
|
74
|
+
type StoredDataNoRaw<Value> = Value | undefined;
|
|
75
|
+
type StoredDataRaw<Value> = DeserializedData<Value> | undefined;
|
|
76
|
+
type StoredData<Value> = StoredDataNoRaw<Value> | StoredDataRaw<Value>;
|
|
77
|
+
type IEventEmitter = {
|
|
78
|
+
on(event: string, listener: (...arguments_: any[]) => void): IEventEmitter;
|
|
79
|
+
};
|
|
80
|
+
type KeyvStoreAdapter = {
|
|
81
|
+
opts: any;
|
|
82
|
+
namespace?: string;
|
|
83
|
+
get<Value>(key: string): Promise<StoredData<Value> | undefined>;
|
|
84
|
+
set(key: string, value: any, ttl?: number): any;
|
|
85
|
+
setMany?(values: Array<{
|
|
86
|
+
key: string;
|
|
87
|
+
value: any;
|
|
88
|
+
ttl?: number;
|
|
89
|
+
}>): Promise<void>;
|
|
90
|
+
delete(key: string): Promise<boolean>;
|
|
91
|
+
clear(): Promise<void>;
|
|
92
|
+
has?(key: string): Promise<boolean>;
|
|
93
|
+
hasMany?(keys: string[]): Promise<boolean[]>;
|
|
94
|
+
getMany?<Value>(keys: string[]): Promise<Array<StoredData<Value | undefined>>>;
|
|
95
|
+
disconnect?(): Promise<void>;
|
|
96
|
+
deleteMany?(key: string[]): Promise<boolean>;
|
|
97
|
+
iterator?<Value>(namespace?: string): AsyncGenerator<Array<string | Awaited<Value> | undefined>, void>;
|
|
98
|
+
} & IEventEmitter;
|
|
99
|
+
type KeyvOptions = {
|
|
100
|
+
/** Emit errors */
|
|
101
|
+
emitErrors?: boolean;
|
|
102
|
+
/** Namespace for the current instance. */
|
|
103
|
+
namespace?: string;
|
|
104
|
+
/** A custom serialization function. */
|
|
105
|
+
serialize?: Serialize;
|
|
106
|
+
/** A custom deserialization function. */
|
|
107
|
+
deserialize?: Deserialize;
|
|
108
|
+
/** The storage adapter instance to be used by Keyv. */
|
|
109
|
+
store?: KeyvStoreAdapter | Map<any, any> | any;
|
|
110
|
+
/** Default TTL. Can be overridden by specifying a TTL on `.set()`. */
|
|
111
|
+
ttl?: number;
|
|
112
|
+
/** Enable compression option **/
|
|
113
|
+
compression?: CompressionAdapter | any;
|
|
114
|
+
/** Enable or disable statistics (default is false) */
|
|
115
|
+
stats?: boolean;
|
|
116
|
+
/** Enable or disable key prefixing (default is true) */
|
|
117
|
+
useKeyPrefix?: boolean;
|
|
118
|
+
};
|
|
119
|
+
type KeyvOptions_ = Omit<KeyvOptions, 'store'> & {
|
|
120
|
+
store: KeyvStoreAdapter | Map<any, any> & KeyvStoreAdapter;
|
|
121
|
+
};
|
|
122
|
+
type IteratorFunction = (argument: any) => AsyncGenerator<any, void>;
|
|
123
|
+
declare class Keyv<GenericValue = any> extends EventManager {
|
|
124
|
+
opts: KeyvOptions_;
|
|
125
|
+
iterator?: IteratorFunction;
|
|
126
|
+
hooks: HooksManager;
|
|
127
|
+
stats: StatsManager;
|
|
128
|
+
/**
|
|
129
|
+
* Time to live in milliseconds
|
|
130
|
+
*/
|
|
131
|
+
private _ttl?;
|
|
132
|
+
/**
|
|
133
|
+
* Namespace
|
|
134
|
+
*/
|
|
135
|
+
private _namespace?;
|
|
136
|
+
/**
|
|
137
|
+
* Store
|
|
138
|
+
*/
|
|
139
|
+
private _store;
|
|
140
|
+
private _serialize;
|
|
141
|
+
private _deserialize;
|
|
142
|
+
private _compression;
|
|
143
|
+
private _useKeyPrefix;
|
|
144
|
+
/**
|
|
145
|
+
* Keyv Constructor
|
|
146
|
+
* @param {KeyvStoreAdapter | KeyvOptions | Map<any, any>} store to be provided or just the options
|
|
147
|
+
* @param {Omit<KeyvOptions, 'store'>} [options] if you provide the store you can then provide the Keyv Options
|
|
148
|
+
*/
|
|
149
|
+
constructor(store?: KeyvStoreAdapter | KeyvOptions | Map<any, any>, options?: Omit<KeyvOptions, 'store'>);
|
|
150
|
+
/**
|
|
151
|
+
* Keyv Constructor
|
|
152
|
+
* @param {KeyvOptions} options to be provided
|
|
153
|
+
*/
|
|
154
|
+
constructor(options?: KeyvOptions);
|
|
155
|
+
/**
|
|
156
|
+
* Get the current store
|
|
157
|
+
*/
|
|
158
|
+
get store(): KeyvStoreAdapter | Map<any, any> | any;
|
|
159
|
+
/**
|
|
160
|
+
* Set the current store. This will also set the namespace, event error handler, and generate the iterator. If the store is not valid it will throw an error.
|
|
161
|
+
* @param {KeyvStoreAdapter | Map<any, any> | any} store the store to set
|
|
162
|
+
*/
|
|
163
|
+
set store(store: KeyvStoreAdapter | Map<any, any> | any);
|
|
164
|
+
/**
|
|
165
|
+
* Get the current compression function
|
|
166
|
+
* @returns {CompressionAdapter} The current compression function
|
|
167
|
+
*/
|
|
168
|
+
get compression(): CompressionAdapter | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Set the current compression function
|
|
171
|
+
* @param {CompressionAdapter} compress The compression function to set
|
|
172
|
+
*/
|
|
173
|
+
set compression(compress: CompressionAdapter | undefined);
|
|
174
|
+
/**
|
|
175
|
+
* Get the current namespace.
|
|
176
|
+
* @returns {string | undefined} The current namespace.
|
|
177
|
+
*/
|
|
178
|
+
get namespace(): string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Set the current namespace.
|
|
181
|
+
* @param {string | undefined} namespace The namespace to set.
|
|
182
|
+
*/
|
|
183
|
+
set namespace(namespace: string | undefined);
|
|
184
|
+
/**
|
|
185
|
+
* Get the current TTL.
|
|
186
|
+
* @returns {number} The current TTL.
|
|
187
|
+
*/
|
|
188
|
+
get ttl(): number | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Set the current TTL.
|
|
191
|
+
* @param {number} ttl The TTL to set.
|
|
192
|
+
*/
|
|
193
|
+
set ttl(ttl: number | undefined);
|
|
194
|
+
/**
|
|
195
|
+
* Get the current serialize function.
|
|
196
|
+
* @returns {Serialize} The current serialize function.
|
|
197
|
+
*/
|
|
198
|
+
get serialize(): Serialize | undefined;
|
|
199
|
+
/**
|
|
200
|
+
* Set the current serialize function.
|
|
201
|
+
* @param {Serialize} serialize The serialize function to set.
|
|
202
|
+
*/
|
|
203
|
+
set serialize(serialize: Serialize | undefined);
|
|
204
|
+
/**
|
|
205
|
+
* Get the current deserialize function.
|
|
206
|
+
* @returns {Deserialize} The current deserialize function.
|
|
207
|
+
*/
|
|
208
|
+
get deserialize(): Deserialize | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* Set the current deserialize function.
|
|
211
|
+
* @param {Deserialize} deserialize The deserialize function to set.
|
|
212
|
+
*/
|
|
213
|
+
set deserialize(deserialize: Deserialize | undefined);
|
|
214
|
+
/**
|
|
215
|
+
* Get the current useKeyPrefix value. This will enable or disable key prefixing.
|
|
216
|
+
* @returns {boolean} The current useKeyPrefix value.
|
|
217
|
+
* @default true
|
|
218
|
+
*/
|
|
219
|
+
get useKeyPrefix(): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Set the current useKeyPrefix value. This will enable or disable key prefixing.
|
|
222
|
+
* @param {boolean} value The useKeyPrefix value to set.
|
|
223
|
+
*/
|
|
224
|
+
set useKeyPrefix(value: boolean);
|
|
225
|
+
generateIterator(iterator: IteratorFunction): IteratorFunction;
|
|
226
|
+
_checkIterableAdapter(): boolean;
|
|
227
|
+
_getKeyPrefix(key: string): string;
|
|
228
|
+
_getKeyPrefixArray(keys: string[]): string[];
|
|
229
|
+
_getKeyUnprefix(key: string): string;
|
|
230
|
+
_isValidStorageAdapter(store: KeyvStoreAdapter | any): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Get the Value of a Key
|
|
233
|
+
* @param {string | string[]} key passing in a single key or multiple as an array
|
|
234
|
+
* @param {{raw: boolean} | undefined} options can pass in to return the raw value by setting { raw: true }
|
|
235
|
+
*/
|
|
236
|
+
get<Value = GenericValue>(key: string, options?: {
|
|
237
|
+
raw: false;
|
|
238
|
+
}): Promise<StoredDataNoRaw<Value>>;
|
|
239
|
+
get<Value = GenericValue>(key: string, options?: {
|
|
240
|
+
raw: true;
|
|
241
|
+
}): Promise<StoredDataRaw<Value>>;
|
|
242
|
+
get<Value = GenericValue>(key: string[], options?: {
|
|
243
|
+
raw: false;
|
|
244
|
+
}): Promise<Array<StoredDataNoRaw<Value>>>;
|
|
245
|
+
get<Value = GenericValue>(key: string[], options?: {
|
|
246
|
+
raw: true;
|
|
247
|
+
}): Promise<Array<StoredDataRaw<Value>>>;
|
|
248
|
+
/**
|
|
249
|
+
* Get many values of keys
|
|
250
|
+
* @param {string[]} keys passing in a single key or multiple as an array
|
|
251
|
+
* @param {{raw: boolean} | undefined} options can pass in to return the raw value by setting { raw: true }
|
|
252
|
+
*/
|
|
253
|
+
getMany<Value = GenericValue>(keys: string[], options?: {
|
|
254
|
+
raw: false;
|
|
255
|
+
}): Promise<Array<StoredDataNoRaw<Value>>>;
|
|
256
|
+
getMany<Value = GenericValue>(keys: string[], options?: {
|
|
257
|
+
raw: true;
|
|
258
|
+
}): Promise<Array<StoredDataRaw<Value>>>;
|
|
259
|
+
/**
|
|
260
|
+
* Set an item to the store
|
|
261
|
+
* @param {string | Array<KeyvEntry>} key the key to use. If you pass in an array of KeyvEntry it will set many items
|
|
262
|
+
* @param {Value} value the value of the key
|
|
263
|
+
* @param {number} [ttl] time to live in milliseconds
|
|
264
|
+
* @returns {boolean} if it sets then it will return a true. On failure will return false.
|
|
265
|
+
*/
|
|
266
|
+
set<Value = GenericValue>(key: string, value: Value, ttl?: number): Promise<boolean>;
|
|
267
|
+
/**
|
|
268
|
+
* Set many items to the store
|
|
269
|
+
* @param {Array<KeyvEntry>} entries the entries to set
|
|
270
|
+
* @returns {boolean[]} will return an array of booleans if it sets then it will return a true. On failure will return false.
|
|
271
|
+
*/
|
|
272
|
+
setMany<Value = GenericValue>(entries: KeyvEntry[]): Promise<boolean[]>;
|
|
273
|
+
/**
|
|
274
|
+
* Delete an Entry
|
|
275
|
+
* @param {string | string[]} key the key to be deleted. if an array it will delete many items
|
|
276
|
+
* @returns {boolean} will return true if item or items are deleted. false if there is an error
|
|
277
|
+
*/
|
|
278
|
+
delete(key: string | string[]): Promise<boolean>;
|
|
279
|
+
/**
|
|
280
|
+
* Delete many items from the store
|
|
281
|
+
* @param {string[]} keys the keys to be deleted
|
|
282
|
+
* @returns {boolean} will return true if item or items are deleted. false if there is an error
|
|
283
|
+
*/
|
|
284
|
+
deleteMany(keys: string[]): Promise<boolean>;
|
|
285
|
+
/**
|
|
286
|
+
* Clear the store
|
|
287
|
+
* @returns {void}
|
|
288
|
+
*/
|
|
289
|
+
clear(): Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Has a key
|
|
292
|
+
* @param {string} key the key to check
|
|
293
|
+
* @returns {boolean} will return true if the key exists
|
|
294
|
+
*/
|
|
295
|
+
has(key: string[]): Promise<boolean[]>;
|
|
296
|
+
has(key: string): Promise<boolean>;
|
|
297
|
+
/**
|
|
298
|
+
* Check if many keys exist
|
|
299
|
+
* @param {string[]} keys the keys to check
|
|
300
|
+
* @returns {boolean[]} will return an array of booleans if the keys exist
|
|
301
|
+
*/
|
|
302
|
+
hasMany(keys: string[]): Promise<boolean[]>;
|
|
303
|
+
/**
|
|
304
|
+
* Will disconnect the store. This is only available if the store has a disconnect method
|
|
305
|
+
* @returns {Promise<void>}
|
|
306
|
+
*/
|
|
307
|
+
disconnect(): Promise<void>;
|
|
308
|
+
emit(event: string, ...arguments_: any[]): void;
|
|
309
|
+
serializeData<T>(data: DeserializedData<T>): Promise<string | DeserializedData<T>>;
|
|
310
|
+
deserializeData<T>(data: string | DeserializedData<T>): Promise<DeserializedData<T> | undefined>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
type WrapOptions<T> = {
|
|
314
|
+
ttl?: number | ((value: T) => number);
|
|
315
|
+
refreshThreshold?: number | ((value: T) => number);
|
|
316
|
+
};
|
|
317
|
+
type WrapOptionsRaw<T> = WrapOptions<T> & {
|
|
318
|
+
raw: true;
|
|
319
|
+
};
|
|
320
|
+
type Cache = {
|
|
321
|
+
get: <T>(key: string) => Promise<T | undefined>;
|
|
322
|
+
mget: <T>(keys: string[]) => Promise<Array<T | undefined>>;
|
|
323
|
+
ttl: (key: string) => Promise<number | undefined>;
|
|
324
|
+
set: <T>(key: string, value: T, ttl?: number) => Promise<T>;
|
|
325
|
+
mset: <T>(list: Array<{
|
|
326
|
+
key: string;
|
|
327
|
+
value: T;
|
|
328
|
+
ttl?: number;
|
|
329
|
+
}>) => Promise<Array<{
|
|
330
|
+
key: string;
|
|
331
|
+
value: T;
|
|
332
|
+
ttl?: number;
|
|
333
|
+
}>>;
|
|
334
|
+
del: (key: string) => Promise<boolean>;
|
|
335
|
+
mdel: (keys: string[]) => Promise<boolean>;
|
|
336
|
+
clear: () => Promise<boolean>;
|
|
337
|
+
on: <E extends keyof Events>(event: E, listener: Events[E]) => EventEmitter;
|
|
338
|
+
off: <E extends keyof Events>(event: E, listener: Events[E]) => EventEmitter;
|
|
339
|
+
disconnect: () => Promise<undefined>;
|
|
340
|
+
cacheId: () => string;
|
|
341
|
+
stores: Keyv[];
|
|
342
|
+
wrap<T>(key: string, fnc: () => T | Promise<T>, ttl?: number | ((value: T) => number), refreshThreshold?: number | ((value: T) => number)): Promise<T>;
|
|
343
|
+
wrap<T>(key: string, fnc: () => T | Promise<T>, options: WrapOptions<T>): Promise<T>;
|
|
344
|
+
wrap<T>(key: string, fnc: () => T | Promise<T>, options: WrapOptionsRaw<T>): Promise<StoredDataRaw<T>>;
|
|
345
|
+
};
|
|
346
|
+
type Events = {
|
|
347
|
+
get: <T>(data: {
|
|
348
|
+
key: string;
|
|
349
|
+
value?: T;
|
|
350
|
+
error?: unknown;
|
|
351
|
+
}) => void;
|
|
352
|
+
set: <T>(data: {
|
|
353
|
+
key: string;
|
|
354
|
+
value: T;
|
|
355
|
+
error?: unknown;
|
|
356
|
+
}) => void;
|
|
357
|
+
del: (data: {
|
|
358
|
+
key: string;
|
|
359
|
+
error?: unknown;
|
|
360
|
+
}) => void;
|
|
361
|
+
clear: (error?: unknown) => void;
|
|
362
|
+
refresh: <T>(data: {
|
|
363
|
+
key: string;
|
|
364
|
+
value: T;
|
|
365
|
+
error?: unknown;
|
|
366
|
+
}) => void;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
declare class FileCacheOptions extends DTO {
|
|
370
|
+
type: 'file';
|
|
371
|
+
/**
|
|
372
|
+
* the file path to store the data
|
|
373
|
+
*/
|
|
374
|
+
filename: string;
|
|
375
|
+
/**
|
|
376
|
+
* ms, check and remove expired data in each ms
|
|
377
|
+
*/
|
|
378
|
+
expiredCheckDelay?: number;
|
|
379
|
+
/**
|
|
380
|
+
* ms, batch write to disk in a specific duration, enhance write performance.
|
|
381
|
+
*/
|
|
382
|
+
writeDelay?: number;
|
|
383
|
+
/**
|
|
384
|
+
* namespace
|
|
385
|
+
*/
|
|
386
|
+
namespace?: string;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare class RedisCacheOptions extends DTO {
|
|
390
|
+
type: 'redis';
|
|
391
|
+
host: string;
|
|
392
|
+
port?: number;
|
|
393
|
+
database?: number;
|
|
394
|
+
tls?: boolean;
|
|
395
|
+
keepAlive?: number;
|
|
396
|
+
username?: string;
|
|
397
|
+
password?: string;
|
|
398
|
+
reconnect?: boolean;
|
|
399
|
+
namespace?: string;
|
|
400
|
+
keyPrefixSeparator?: string;
|
|
401
|
+
clearBatchSize?: number;
|
|
402
|
+
useUnlink?: boolean;
|
|
403
|
+
noNamespaceAffectsAll?: boolean;
|
|
404
|
+
connectTimeout?: number;
|
|
405
|
+
throwOnConnectError?: boolean;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
declare class SqliteCacheOptions extends DTO {
|
|
409
|
+
type: 'sqlite';
|
|
410
|
+
database: string;
|
|
411
|
+
table: string;
|
|
412
|
+
busyTimeout?: number;
|
|
413
|
+
namespace?: string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
declare class PostgresCacheOptions extends DTO {
|
|
417
|
+
type: 'postgres';
|
|
418
|
+
host: string;
|
|
419
|
+
database: string;
|
|
420
|
+
table: string;
|
|
421
|
+
port?: number;
|
|
422
|
+
schema?: string;
|
|
423
|
+
username: string;
|
|
424
|
+
password: string;
|
|
425
|
+
maxPoolSize?: number;
|
|
426
|
+
namespace?: string;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
declare class MysqlCacheOptions extends DTO {
|
|
430
|
+
type: 'mysql';
|
|
431
|
+
host: string;
|
|
432
|
+
database: string;
|
|
433
|
+
table: string;
|
|
434
|
+
port?: number;
|
|
435
|
+
username: string;
|
|
436
|
+
password: string;
|
|
437
|
+
namespace?: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
declare class MongoCacheOptions extends DTO {
|
|
441
|
+
type: 'mongo';
|
|
442
|
+
host: string;
|
|
443
|
+
database: string;
|
|
444
|
+
collection: string;
|
|
445
|
+
port?: number;
|
|
446
|
+
username: string;
|
|
447
|
+
password: string;
|
|
448
|
+
namespace?: string;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
declare class MemcacheCacheOptions extends DTO {
|
|
452
|
+
type: 'memcache';
|
|
453
|
+
host: string;
|
|
454
|
+
port?: number;
|
|
455
|
+
username?: string;
|
|
456
|
+
password?: string;
|
|
457
|
+
namespace?: string;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
type CacheStoreOptions = FileCacheOptions | RedisCacheOptions | MemcacheCacheOptions | MongoCacheOptions | SqliteCacheOptions | PostgresCacheOptions | MysqlCacheOptions;
|
|
461
|
+
|
|
462
|
+
declare class CacherOptions extends DTO {
|
|
463
|
+
stores?: CacheStoreOptions[] | CacheStoreOptions;
|
|
464
|
+
ttl?: number;
|
|
465
|
+
refreshThreshold?: number;
|
|
466
|
+
refreshAllStores?: boolean;
|
|
467
|
+
nonBlocking?: boolean;
|
|
468
|
+
cacheId?: string;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
declare const BuildCacherOptions: (options?: CacherOptions) => {
|
|
472
|
+
class: typeof Cacher;
|
|
473
|
+
options?: CacherOptions;
|
|
474
|
+
};
|
|
475
|
+
type MultipleSetInput = {
|
|
476
|
+
key: string;
|
|
477
|
+
value: any;
|
|
478
|
+
ttl?: number;
|
|
479
|
+
};
|
|
480
|
+
type OnSetEventData = {
|
|
481
|
+
key: string;
|
|
482
|
+
value: any;
|
|
483
|
+
error?: Error;
|
|
484
|
+
};
|
|
485
|
+
type OnDelEventData = {
|
|
486
|
+
key: string;
|
|
487
|
+
error?: Error;
|
|
488
|
+
};
|
|
489
|
+
type OnRefreshEventData = {
|
|
490
|
+
key: string;
|
|
491
|
+
value: any;
|
|
492
|
+
error?: Error;
|
|
493
|
+
};
|
|
494
|
+
declare class Cacher extends Component {
|
|
495
|
+
protected readonly options?: CacherOptions;
|
|
496
|
+
protected cache: Cache;
|
|
497
|
+
protected init(): Promise<void>;
|
|
498
|
+
protected destroy(): Promise<void>;
|
|
499
|
+
set<T>(key: string, value: T, ttl?: number): Promise<T>;
|
|
500
|
+
multipleSet(options: MultipleSetInput[]): Promise<MultipleSetInput[]>;
|
|
501
|
+
get<T = any>(key: string): Promise<T>;
|
|
502
|
+
multipleGet(keys: string[]): Promise<any[]>;
|
|
503
|
+
ttl(key: string): Promise<number>;
|
|
504
|
+
del(key: string): Promise<boolean>;
|
|
505
|
+
multipleDel(keys: string[]): Promise<boolean>;
|
|
506
|
+
clear(): Promise<boolean>;
|
|
507
|
+
on(event: 'set', listener: (data: OnSetEventData) => void): this;
|
|
508
|
+
on(event: 'del', listener: (data: OnDelEventData) => void): this;
|
|
509
|
+
on(event: 'clear', listener: (error?: Error) => void): this;
|
|
510
|
+
on(event: 'refresh', listener: (data: OnRefreshEventData) => void): this;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export { BuildCacherOptions, Cacher, CacherOptions, FileCacheOptions, MemcacheCacheOptions, MongoCacheOptions, MysqlCacheOptions, PostgresCacheOptions, RedisCacheOptions, SqliteCacheOptions };
|
|
514
|
+
export type { CacheStoreOptions, MultipleSetInput, OnDelEventData, OnRefreshEventData, OnSetEventData };
|