lakutata 2.0.80 → 2.0.82
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 +8 -10
- package/com/cacher.d.ts +83 -14
- package/com/cacher.mjs +8 -10
- package/com/database.cjs +11 -11
- package/com/database.mjs +11 -11
- package/com/docker.cjs +17 -19
- package/com/docker.d.ts +3 -141
- package/com/docker.mjs +13 -15
- package/com/entrypoint.cjs +7 -5
- package/com/entrypoint.mjs +7 -5
- package/com/logger.cjs +7 -7
- package/com/logger.mjs +7 -7
- package/com/monitor.cjs +5 -3
- package/com/monitor.mjs +5 -3
- package/decorator/ctrl.cjs +3 -3
- package/decorator/ctrl.mjs +3 -3
- package/decorator/orm.cjs +98 -98
- package/decorator/orm.mjs +142 -56
- package/helper.cjs +9 -11
- package/helper.mjs +5 -7
- package/lakutata.cjs +23 -30
- package/lakutata.mjs +14 -18
- package/orm.cjs +1421 -884
- package/orm.mjs +1474 -724
- package/package.json +1 -1
- package/provider/database.cjs +11 -11
- package/provider/database.mjs +11 -11
- package/provider/passwordHash.cjs +4 -2
- package/provider/passwordHash.mjs +4 -2
- package/src/components/Database.cjs +13 -13
- package/src/components/Database.mjs +17 -17
- package/src/components/Logger.cjs +7 -7
- package/src/components/Logger.mjs +7 -7
- package/src/components/cacher/Cacher.cjs +1186 -272
- package/src/components/cacher/Cacher.mjs +1094 -180
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +478 -2962
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +468 -2946
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.cjs +12 -12
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.mjs +11 -11
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.cjs +16 -16
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.mjs +14 -14
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.cjs +11 -11
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.mjs +11 -11
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.cjs +12 -12
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.mjs +13 -13
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.cjs +10 -10
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.mjs +10 -10
- package/src/components/cacher/lib/IsDriverPackageInstalled.cjs +2 -2
- package/src/components/cacher/lib/IsDriverPackageInstalled.mjs +5 -5
- package/src/components/docker/ConnectionOptionsBuilder.cjs +23 -25
- package/src/components/docker/ConnectionOptionsBuilder.mjs +19 -21
- package/src/components/docker/Docker.cjs +5035 -5096
- package/src/components/docker/Docker.mjs +4955 -5016
- package/src/components/docker/lib/DockerContainer.cjs +23 -25
- package/src/components/docker/lib/DockerContainer.mjs +17 -19
- package/src/components/docker/lib/DockerContainerTTY.cjs +9 -11
- package/src/components/docker/lib/DockerContainerTTY.mjs +9 -11
- package/src/components/docker/lib/DockerImage.cjs +4 -2
- package/src/components/docker/lib/DockerImage.mjs +4 -2
- package/src/components/docker/lib/ParseEnvToRecord.cjs +2 -2
- package/src/components/docker/lib/ParseEnvToRecord.mjs +12 -12
- package/src/components/docker/lib/ParseRepositoryTag.cjs +9 -9
- package/src/components/docker/lib/ParseRepositoryTag.mjs +11 -11
- package/src/components/entrypoint/Entrypoint.cjs +2179 -1687
- package/src/components/entrypoint/Entrypoint.mjs +2182 -1690
- package/src/components/entrypoint/lib/AccessControl.cjs +4 -2
- package/src/components/entrypoint/lib/AccessControl.mjs +4 -2
- package/src/components/entrypoint/lib/AccessControlRule.cjs +4 -2
- package/src/components/entrypoint/lib/AccessControlRule.mjs +4 -2
- package/src/components/entrypoint/lib/Controller.cjs +4 -2
- package/src/components/entrypoint/lib/Controller.mjs +4 -2
- package/src/components/monitor/AliveMonitor.cjs +6 -4
- package/src/components/monitor/AliveMonitor.mjs +6 -4
- package/src/components/monitor/CpuMonitor.cjs +5 -3
- package/src/components/monitor/CpuMonitor.mjs +5 -3
- package/src/components/monitor/EventLoopMonitor.cjs +4 -2
- package/src/components/monitor/EventLoopMonitor.mjs +4 -2
- package/src/components/monitor/HttpRequestMonitor.cjs +5 -3
- package/src/components/monitor/HttpRequestMonitor.mjs +5 -3
- package/src/components/monitor/MemoryMonitor.cjs +8 -6
- package/src/components/monitor/MemoryMonitor.mjs +5 -3
- package/src/decorators/asst/After.cjs +3 -3
- package/src/decorators/asst/After.mjs +2 -2
- package/src/decorators/asst/Before.cjs +2 -2
- package/src/decorators/asst/Before.mjs +4 -4
- package/src/decorators/ctrl/CLIAction.cjs +5 -5
- package/src/decorators/ctrl/CLIAction.mjs +10 -10
- package/src/decorators/ctrl/HTTPAction.cjs +9 -9
- package/src/decorators/ctrl/HTTPAction.mjs +7 -7
- package/src/decorators/ctrl/ServiceAction.cjs +6 -6
- package/src/decorators/ctrl/ServiceAction.mjs +7 -7
- package/src/decorators/ctrl/http/DELETE.cjs +5 -5
- package/src/decorators/ctrl/http/DELETE.mjs +5 -5
- package/src/decorators/ctrl/http/GET.cjs +5 -5
- package/src/decorators/ctrl/http/GET.mjs +5 -5
- package/src/decorators/ctrl/http/HEAD.cjs +5 -5
- package/src/decorators/ctrl/http/HEAD.mjs +5 -5
- package/src/decorators/ctrl/http/OPTIONS.cjs +5 -5
- package/src/decorators/ctrl/http/OPTIONS.mjs +5 -5
- package/src/decorators/ctrl/http/PATCH.cjs +5 -5
- package/src/decorators/ctrl/http/PATCH.mjs +5 -5
- package/src/decorators/ctrl/http/POST.cjs +5 -5
- package/src/decorators/ctrl/http/POST.mjs +5 -5
- package/src/decorators/ctrl/http/PUT.cjs +5 -5
- package/src/decorators/ctrl/http/PUT.mjs +5 -5
- package/src/decorators/di/Autoload.cjs +2 -2
- package/src/decorators/di/Autoload.mjs +2 -2
- package/src/decorators/di/Configurable.cjs +3 -3
- package/src/decorators/di/Configurable.mjs +2 -2
- package/src/decorators/di/Inject.cjs +6 -6
- package/src/decorators/di/Inject.mjs +11 -11
- package/src/decorators/di/Lifetime.cjs +18 -18
- package/src/decorators/di/Lifetime.mjs +13 -13
- package/src/decorators/dto/Accept.cjs +3 -3
- package/src/decorators/dto/Accept.mjs +2 -2
- package/src/decorators/dto/Expect.cjs +2 -2
- package/src/decorators/dto/Expect.mjs +3 -3
- package/src/decorators/dto/IndexSignature.cjs +2 -2
- package/src/decorators/dto/IndexSignature.mjs +3 -3
- package/src/decorators/dto/Return.cjs +3 -3
- package/src/decorators/dto/Return.mjs +2 -2
- package/src/decorators/orm/AfterInsert.cjs +17 -39
- package/src/decorators/orm/AfterInsert.mjs +18 -38
- package/src/decorators/orm/AfterLoad.cjs +17 -39
- package/src/decorators/orm/AfterLoad.mjs +18 -38
- package/src/decorators/orm/AfterRecover.cjs +17 -39
- package/src/decorators/orm/AfterRecover.mjs +18 -38
- package/src/decorators/orm/AfterRemove.cjs +17 -39
- package/src/decorators/orm/AfterRemove.mjs +18 -38
- package/src/decorators/orm/AfterSoftRemove.cjs +17 -39
- package/src/decorators/orm/AfterSoftRemove.mjs +18 -38
- package/src/decorators/orm/AfterUpdate.cjs +17 -39
- package/src/decorators/orm/AfterUpdate.mjs +18 -38
- package/src/decorators/orm/BeforeInsert.cjs +17 -39
- package/src/decorators/orm/BeforeInsert.mjs +18 -38
- package/src/decorators/orm/BeforeRecover.cjs +17 -39
- package/src/decorators/orm/BeforeRecover.mjs +18 -38
- package/src/decorators/orm/BeforeRemove.cjs +17 -39
- package/src/decorators/orm/BeforeRemove.mjs +18 -38
- package/src/decorators/orm/BeforeSoftRemove.cjs +17 -39
- package/src/decorators/orm/BeforeSoftRemove.mjs +18 -38
- package/src/decorators/orm/BeforeUpdate.cjs +17 -39
- package/src/decorators/orm/BeforeUpdate.mjs +18 -38
- package/src/decorators/orm/Check.cjs +17 -42
- package/src/decorators/orm/Check.mjs +18 -41
- package/src/decorators/orm/ChildEntity.cjs +17 -42
- package/src/decorators/orm/ChildEntity.mjs +18 -41
- package/src/decorators/orm/Column.cjs +17 -74
- package/src/decorators/orm/Column.mjs +19 -74
- package/src/decorators/orm/CreateDateColumn.cjs +17 -38
- package/src/decorators/orm/CreateDateColumn.mjs +18 -37
- package/src/decorators/orm/DeleteDateColumn.cjs +17 -38
- package/src/decorators/orm/DeleteDateColumn.mjs +17 -36
- package/src/decorators/orm/Entity.cjs +17 -48
- package/src/decorators/orm/Entity.mjs +17 -46
- package/src/decorators/orm/EventSubscriber.cjs +17 -35
- package/src/decorators/orm/EventSubscriber.mjs +18 -34
- package/src/decorators/orm/Exclusion.cjs +17 -42
- package/src/decorators/orm/Exclusion.mjs +18 -41
- package/src/decorators/orm/Generated.cjs +17 -37
- package/src/decorators/orm/Generated.mjs +18 -36
- package/src/decorators/orm/Index.cjs +17 -54
- package/src/decorators/orm/Index.mjs +19 -54
- package/src/decorators/orm/JoinColumn.cjs +17 -42
- package/src/decorators/orm/JoinColumn.mjs +18 -41
- package/src/decorators/orm/JoinTable.cjs +17 -43
- package/src/decorators/orm/JoinTable.mjs +17 -41
- package/src/decorators/orm/ManyToMany.cjs +17 -55
- package/src/decorators/orm/ManyToMany.mjs +17 -53
- package/src/decorators/orm/ManyToOne.cjs +17 -55
- package/src/decorators/orm/ManyToOne.mjs +17 -53
- package/src/decorators/orm/ObjectIdColumn.cjs +17 -41
- package/src/decorators/orm/ObjectIdColumn.mjs +18 -40
- package/src/decorators/orm/OneToMany.cjs +17 -47
- package/src/decorators/orm/OneToMany.mjs +19 -47
- package/src/decorators/orm/OneToOne.cjs +17 -55
- package/src/decorators/orm/OneToOne.mjs +17 -53
- package/src/decorators/orm/PrimaryColumn.cjs +17 -62
- package/src/decorators/orm/PrimaryColumn.mjs +19 -62
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +17 -67
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +19 -67
- package/src/decorators/orm/RelationId.cjs +17 -39
- package/src/decorators/orm/RelationId.mjs +18 -38
- package/src/decorators/orm/TableInheritance.cjs +17 -39
- package/src/decorators/orm/TableInheritance.mjs +18 -38
- package/src/decorators/orm/Tree.cjs +17 -37
- package/src/decorators/orm/Tree.mjs +18 -36
- package/src/decorators/orm/TreeChildren.cjs +17 -44
- package/src/decorators/orm/TreeChildren.mjs +17 -42
- package/src/decorators/orm/TreeLevelColumn.cjs +17 -38
- package/src/decorators/orm/TreeLevelColumn.mjs +17 -36
- package/src/decorators/orm/TreeParent.cjs +17 -44
- package/src/decorators/orm/TreeParent.mjs +17 -42
- package/src/decorators/orm/Unique.cjs +17 -57
- package/src/decorators/orm/Unique.mjs +19 -57
- package/src/decorators/orm/UpdateDateColumn.cjs +17 -38
- package/src/decorators/orm/UpdateDateColumn.mjs +18 -37
- package/src/decorators/orm/VersionColumn.cjs +17 -38
- package/src/decorators/orm/VersionColumn.mjs +18 -37
- package/src/decorators/orm/ViewColumn.cjs +17 -38
- package/src/decorators/orm/ViewColumn.mjs +18 -37
- package/src/decorators/orm/ViewEntity.cjs +17 -47
- package/src/decorators/orm/ViewEntity.mjs +18 -46
- package/src/decorators/orm/VirtualColumn.cjs +17 -55
- package/src/decorators/orm/VirtualColumn.mjs +17 -53
- package/src/lib/base/BaseObject.cjs +4 -2
- package/src/lib/base/BaseObject.mjs +4 -2
- package/src/lib/base/EventEmitter.cjs +1202 -1195
- package/src/lib/base/EventEmitter.mjs +1202 -1195
- package/src/lib/base/async-constructor/Append.cjs +11 -11
- package/src/lib/base/async-constructor/Append.mjs +7 -7
- package/src/lib/base/internal/ApplicationConfigLoader.cjs +4 -2
- package/src/lib/base/internal/ApplicationConfigLoader.mjs +4 -2
- package/src/lib/base/internal/BasicInfo.cjs +10 -10
- package/src/lib/base/internal/BasicInfo.mjs +9 -9
- package/src/lib/base/internal/CamelCase.cjs +4 -4
- package/src/lib/base/internal/CamelCase.mjs +11 -11
- package/src/lib/base/internal/ConfigurableRecordsInjection.cjs +19 -19
- package/src/lib/base/internal/ConfigurableRecordsInjection.mjs +18 -18
- package/src/lib/base/internal/ConstructorSymbol.cjs +10 -10
- package/src/lib/base/internal/ConstructorSymbol.mjs +8 -8
- package/src/lib/base/internal/ControllerEntrypoint.cjs +67 -67
- package/src/lib/base/internal/ControllerEntrypoint.mjs +38 -38
- package/src/lib/base/internal/DataValidator.cjs +176 -179
- package/src/lib/base/internal/DataValidator.mjs +221 -224
- package/src/lib/base/internal/GetActionDTOAndOptions.cjs +9 -9
- package/src/lib/base/internal/GetActionDTOAndOptions.mjs +10 -10
- package/src/lib/base/internal/IEEE754.cjs +74 -74
- package/src/lib/base/internal/IEEE754.mjs +70 -70
- package/src/lib/base/internal/MethodAssistantFunction.cjs +28 -28
- package/src/lib/base/internal/MethodAssistantFunction.mjs +38 -38
- package/src/lib/base/internal/MethodValidation.cjs +25 -25
- package/src/lib/base/internal/MethodValidation.mjs +20 -20
- package/src/lib/base/internal/ModuleConfigLoader.cjs +4 -3
- package/src/lib/base/internal/ModuleConfigLoader.mjs +4 -3
- package/src/lib/base/internal/ObjectConfiguration.cjs +10 -10
- package/src/lib/base/internal/ObjectConfiguration.mjs +15 -15
- package/src/lib/base/internal/ObjectContainer.cjs +7 -7
- package/src/lib/base/internal/ObjectContainer.mjs +6 -6
- package/src/lib/base/internal/ObjectInjection.cjs +16 -16
- package/src/lib/base/internal/ObjectInjection.mjs +13 -13
- package/src/lib/base/internal/ObjectLifetime.cjs +10 -10
- package/src/lib/base/internal/ObjectLifetime.mjs +9 -9
- package/src/lib/base/internal/ObjectType.cjs +4 -2
- package/src/lib/base/internal/ObjectType.mjs +4 -2
- package/src/lib/base/internal/ObjectWeakRefs.cjs +11 -11
- package/src/lib/base/internal/ObjectWeakRefs.mjs +9 -9
- package/src/lib/base/internal/PatternManager.cjs +744 -739
- package/src/lib/base/internal/PatternManager.mjs +748 -743
- package/src/lib/base/internal/StringifyPattern.cjs +26 -26
- package/src/lib/base/internal/StringifyPattern.mjs +26 -26
- package/src/lib/base/internal/ThrowWarning.cjs +2 -2
- package/src/lib/base/internal/ThrowWarning.mjs +2 -2
- package/src/lib/core/Alias.cjs +5 -5
- package/src/lib/core/Application.cjs +146 -142
- package/src/lib/core/Application.mjs +204 -202
- package/src/lib/core/Component.cjs +4 -2
- package/src/lib/core/Component.mjs +4 -2
- package/src/lib/core/Container.cjs +4 -2
- package/src/lib/core/Container.mjs +4 -2
- package/src/lib/core/Module.cjs +5 -3
- package/src/lib/core/Module.mjs +5 -3
- package/src/lib/core/Provider.cjs +4 -2
- package/src/lib/core/Provider.mjs +4 -2
- package/src/lib/helpers/ArrayToSet.cjs +2 -2
- package/src/lib/helpers/ArrayToSet.mjs +3 -3
- package/src/lib/helpers/As.cjs +2 -2
- package/src/lib/helpers/As.mjs +2 -2
- package/src/lib/helpers/ConvertArrayLikeToIterable.cjs +3 -3
- package/src/lib/helpers/ConvertArrayLikeToIterable.mjs +3 -3
- package/src/lib/helpers/ConvertArrayLikeToStream.cjs +2 -2
- package/src/lib/helpers/ConvertArrayLikeToStream.mjs +2 -2
- package/src/lib/helpers/Delay.cjs +2 -2
- package/src/lib/helpers/Delay.mjs +2 -2
- package/src/lib/helpers/DevNull.cjs +2 -2
- package/src/lib/helpers/DevNull.mjs +2 -2
- package/src/lib/helpers/GetObjectNestingDepth.cjs +12 -12
- package/src/lib/helpers/GetObjectNestingDepth.mjs +11 -11
- package/src/lib/helpers/GetObjectPropertyPaths.cjs +7 -7
- package/src/lib/helpers/GetObjectPropertyPaths.mjs +9 -9
- package/src/lib/helpers/Glob.cjs +1192 -943
- package/src/lib/helpers/Glob.mjs +1256 -1007
- package/src/lib/helpers/GraceExit.cjs +3 -3
- package/src/lib/helpers/GraceExit.mjs +7 -7
- package/src/lib/helpers/HexToIEEE754.cjs +4 -4
- package/src/lib/helpers/HexToIEEE754.mjs +2 -2
- package/src/lib/helpers/HexToSigned.cjs +5 -5
- package/src/lib/helpers/HexToSigned.mjs +4 -4
- package/src/lib/helpers/HexToUnsigned.cjs +2 -2
- package/src/lib/helpers/HexToUnsigned.mjs +2 -2
- package/src/lib/helpers/IEEE754ToHex.cjs +5 -5
- package/src/lib/helpers/IEEE754ToHex.mjs +5 -5
- package/src/lib/helpers/IsAbortError.cjs +2 -2
- package/src/lib/helpers/IsAbortError.mjs +3 -3
- package/src/lib/helpers/IsEmptyObject.cjs +3 -3
- package/src/lib/helpers/IsEmptyObject.mjs +3 -3
- package/src/lib/helpers/IsExists.cjs +5 -5
- package/src/lib/helpers/IsExists.mjs +4 -4
- package/src/lib/helpers/IsHtml.cjs +18 -8
- package/src/lib/helpers/IsHtml.mjs +18 -8
- package/src/lib/helpers/IsNativeFunction.cjs +2 -2
- package/src/lib/helpers/IsNativeFunction.mjs +2 -2
- package/src/lib/helpers/IsPath.cjs +2 -2
- package/src/lib/helpers/IsPath.mjs +5 -5
- package/src/lib/helpers/IsPromise.cjs +2 -2
- package/src/lib/helpers/IsPromise.mjs +2 -2
- package/src/lib/helpers/IsPromiseLike.cjs +5 -5
- package/src/lib/helpers/IsPromiseLike.mjs +6 -6
- package/src/lib/helpers/IsXML.cjs +1525 -1531
- package/src/lib/helpers/IsXML.mjs +1521 -1527
- package/src/lib/helpers/MD5.cjs +3 -3
- package/src/lib/helpers/MD5.mjs +3 -3
- package/src/lib/helpers/MergeArray.cjs +3 -3
- package/src/lib/helpers/MergeArray.mjs +3 -3
- package/src/lib/helpers/MergeMap.cjs +3 -3
- package/src/lib/helpers/MergeMap.mjs +3 -3
- package/src/lib/helpers/MergeSet.cjs +2 -2
- package/src/lib/helpers/MergeSet.mjs +3 -3
- package/src/lib/helpers/NoCase.cjs +27 -27
- package/src/lib/helpers/NoCase.mjs +24 -24
- package/src/lib/helpers/NonceStr.cjs +3 -3
- package/src/lib/helpers/NonceStr.mjs +3 -3
- package/src/lib/helpers/ObjectConstructor.cjs +2 -2
- package/src/lib/helpers/ObjectConstructor.mjs +4 -4
- package/src/lib/helpers/ObjectHash.cjs +385 -378
- package/src/lib/helpers/ObjectHash.mjs +381 -374
- package/src/lib/helpers/ObjectParentConstructor.cjs +2 -2
- package/src/lib/helpers/ObjectParentConstructor.mjs +5 -5
- package/src/lib/helpers/ObjectParentConstructors.cjs +6 -6
- package/src/lib/helpers/ObjectParentConstructors.mjs +2 -2
- package/src/lib/helpers/ObjectPrototype.cjs +2 -2
- package/src/lib/helpers/ObjectPrototype.mjs +2 -2
- package/src/lib/helpers/ObjectToMap.cjs +2 -2
- package/src/lib/helpers/ObjectToMap.mjs +3 -3
- package/src/lib/helpers/Paginator.cjs +2 -2
- package/src/lib/helpers/Paginator.mjs +6 -6
- package/src/lib/helpers/RandomString.cjs +170 -149
- package/src/lib/helpers/RandomString.mjs +167 -146
- package/src/lib/helpers/SHA1.cjs +3 -3
- package/src/lib/helpers/SHA1.mjs +3 -3
- package/src/lib/helpers/SHA256.cjs +3 -3
- package/src/lib/helpers/SHA256.mjs +3 -3
- package/src/lib/helpers/SetToArray.cjs +2 -2
- package/src/lib/helpers/SetToArray.mjs +2 -2
- package/src/lib/helpers/SignedToHex.cjs +4 -4
- package/src/lib/helpers/SignedToHex.mjs +4 -4
- package/src/lib/helpers/SortArray.cjs +17 -17
- package/src/lib/helpers/SortArray.mjs +16 -16
- package/src/lib/helpers/SortKeys.cjs +41 -41
- package/src/lib/helpers/SortKeys.mjs +41 -41
- package/src/lib/helpers/SortObject.cjs +2 -2
- package/src/lib/helpers/SortObject.mjs +2 -2
- package/src/lib/helpers/Statistics.cjs +1 -1
- package/src/lib/helpers/Statistics.mjs +1 -1
- package/src/lib/helpers/Templating.cjs +25 -25
- package/src/lib/helpers/Templating.mjs +25 -25
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +349 -349
- package/src/lib/helpers/UUID.cjs +1 -1
- package/src/lib/helpers/UUID.mjs +1 -1
- package/src/lib/helpers/UniqueArray.cjs +3 -3
- package/src/lib/helpers/UniqueArray.mjs +2 -2
- package/src/lib/helpers/UnsignedToHex.cjs +3 -3
- package/src/lib/helpers/UnsignedToHex.mjs +3 -3
- package/src/lib/ioc/DependencyInjectionContainer.cjs +111 -109
- package/src/lib/ioc/DependencyInjectionContainer.mjs +123 -121
- package/src/lib/ioc/FunctionTokenizer.cjs +115 -115
- package/src/lib/ioc/FunctionTokenizer.mjs +102 -102
- package/src/lib/ioc/Lifetime.cjs +5 -5
- package/src/lib/ioc/Lifetime.mjs +5 -5
- package/src/lib/ioc/ListModules.cjs +5222 -5297
- package/src/lib/ioc/ListModules.mjs +5187 -5262
- package/src/lib/ioc/LoadModules.cjs +56 -56
- package/src/lib/ioc/LoadModules.mjs +69 -69
- package/src/lib/ioc/ParamParser.cjs +30 -30
- package/src/lib/ioc/ParamParser.mjs +41 -41
- package/src/lib/ioc/Resolvers.cjs +87 -87
- package/src/lib/ioc/Resolvers.mjs +109 -109
- package/src/lib/ioc/Utils.cjs +12 -12
- package/src/lib/ioc/Utils.mjs +18 -18
- package/src/lib/validation/VLD.cjs +4198 -4020
- package/src/lib/validation/VLD.mjs +3137 -2959
- package/src/options/ApplicationOptions.cjs +4 -2
- package/src/options/ApplicationOptions.mjs +4 -2
- package/src/options/LoadAnonymousObjectOptions.cjs +4 -2
- package/src/options/LoadAnonymousObjectOptions.mjs +4 -2
- package/src/options/LoadNamedObjectOptions.cjs +4 -2
- package/src/options/LoadNamedObjectOptions.mjs +4 -2
- package/src/options/LoadObjectOptions.cjs +4 -2
- package/src/options/LoadObjectOptions.mjs +4 -2
- package/src/options/ModuleLoadObjectsOptions.cjs +4 -2
- package/src/options/ModuleLoadObjectsOptions.mjs +4 -2
- package/src/options/ModuleOptions.cjs +4 -4
- package/src/options/ModuleOptions.mjs +4 -4
- package/src/options/OverridableNamedObjectOptions.cjs +4 -2
- package/src/options/OverridableNamedObjectOptions.mjs +4 -2
- package/src/options/OverridableObjectOptions.cjs +4 -2
- package/src/options/OverridableObjectOptions.mjs +4 -2
- package/src/providers/Database.cjs +13 -13
- package/src/providers/Database.mjs +18 -18
- package/src/providers/PasswordHash.cjs +334 -332
- package/src/providers/PasswordHash.mjs +389 -387
- package/src/providers/migration/GenerateMigration.cjs +15 -19
- package/src/providers/migration/GenerateMigration.mjs +15 -19
- package/vendor/Package.1.cjs +256 -256
- package/vendor/Package.1.mjs +254 -254
- package/vendor/Package.10.cjs +2 -8
- package/vendor/Package.10.mjs +2 -8
- package/vendor/Package.11.cjs +5 -83
- package/vendor/Package.11.mjs +5 -77
- package/vendor/Package.112.cjs +48900 -0
- package/vendor/Package.112.mjs +48764 -0
- package/vendor/Package.12.cjs +4 -2
- package/vendor/Package.12.mjs +6 -4
- package/vendor/Package.13.cjs +87 -1
- package/vendor/Package.13.mjs +81 -1
- package/vendor/Package.14.cjs +1 -14057
- package/vendor/Package.14.mjs +1 -14031
- package/vendor/Package.15.cjs +1 -1
- package/vendor/Package.15.mjs +1 -1
- package/vendor/Package.16.cjs +18115 -1921
- package/vendor/Package.16.mjs +18115 -1839
- package/vendor/Package.17.cjs +1926 -47922
- package/vendor/Package.17.mjs +1852 -47915
- package/vendor/Package.18.cjs +35 -1
- package/vendor/Package.18.mjs +35 -1
- package/vendor/Package.19.cjs +37 -0
- package/vendor/Package.19.mjs +35 -0
- package/vendor/Package.2.cjs +5856 -5827
- package/vendor/Package.2.mjs +5854 -5825
- package/vendor/Package.20.cjs +37 -0
- package/vendor/Package.20.mjs +35 -0
- package/vendor/Package.21.cjs +37 -0
- package/vendor/Package.21.mjs +35 -0
- package/vendor/Package.22.cjs +37 -0
- package/vendor/Package.22.mjs +35 -0
- package/vendor/Package.23.cjs +37 -0
- package/vendor/Package.23.mjs +35 -0
- package/vendor/Package.24.cjs +37 -0
- package/vendor/Package.24.mjs +35 -0
- package/vendor/Package.25.cjs +37 -0
- package/vendor/Package.25.mjs +35 -0
- package/vendor/Package.26.cjs +37 -0
- package/vendor/Package.26.mjs +35 -0
- package/vendor/Package.27.cjs +37 -0
- package/vendor/Package.27.mjs +35 -0
- package/vendor/Package.28.cjs +37 -0
- package/vendor/Package.28.mjs +35 -0
- package/vendor/Package.29.cjs +40 -0
- package/vendor/Package.29.mjs +38 -0
- package/vendor/Package.3.cjs +60 -60
- package/vendor/Package.3.mjs +85 -85
- package/vendor/Package.30.cjs +41 -0
- package/vendor/Package.30.mjs +39 -0
- package/vendor/Package.31.cjs +72 -0
- package/vendor/Package.31.mjs +70 -0
- package/vendor/Package.32.cjs +37 -0
- package/vendor/Package.32.mjs +35 -0
- package/vendor/Package.33.cjs +37 -0
- package/vendor/Package.33.mjs +35 -0
- package/vendor/Package.34.cjs +46 -0
- package/vendor/Package.34.mjs +44 -0
- package/vendor/Package.35.cjs +34 -0
- package/vendor/Package.35.mjs +32 -0
- package/vendor/Package.36.cjs +40 -0
- package/vendor/Package.36.mjs +38 -0
- package/vendor/Package.37.cjs +36 -0
- package/vendor/Package.37.mjs +34 -0
- package/vendor/Package.38.cjs +52 -0
- package/vendor/Package.38.mjs +50 -0
- package/vendor/Package.39.cjs +41 -0
- package/vendor/Package.39.mjs +39 -0
- package/vendor/Package.4.cjs +884 -874
- package/vendor/Package.4.mjs +887 -877
- package/vendor/Package.40.cjs +42 -0
- package/vendor/Package.40.mjs +40 -0
- package/vendor/Package.41.cjs +53 -0
- package/vendor/Package.41.mjs +51 -0
- package/vendor/Package.42.cjs +53 -0
- package/vendor/Package.42.mjs +51 -0
- package/vendor/Package.43.cjs +40 -0
- package/vendor/Package.43.mjs +38 -0
- package/vendor/Package.44.cjs +46 -0
- package/vendor/Package.44.mjs +44 -0
- package/vendor/Package.45.cjs +53 -0
- package/vendor/Package.45.mjs +51 -0
- package/vendor/Package.46.cjs +59 -0
- package/vendor/Package.46.mjs +57 -0
- package/vendor/Package.47.cjs +65 -0
- package/vendor/Package.47.mjs +63 -0
- package/vendor/Package.48.cjs +38 -0
- package/vendor/Package.48.mjs +36 -0
- package/vendor/Package.49.cjs +38 -0
- package/vendor/Package.49.mjs +36 -0
- package/vendor/Package.5.cjs +19 -15
- package/vendor/Package.5.mjs +14 -10
- package/vendor/Package.50.cjs +36 -0
- package/vendor/Package.50.mjs +34 -0
- package/vendor/Package.51.cjs +43 -0
- package/vendor/Package.51.mjs +41 -0
- package/vendor/Package.52.cjs +37 -0
- package/vendor/Package.52.mjs +35 -0
- package/vendor/Package.53.cjs +43 -0
- package/vendor/Package.53.mjs +41 -0
- package/vendor/Package.54.cjs +55 -0
- package/vendor/Package.54.mjs +53 -0
- package/vendor/Package.55.cjs +37 -0
- package/vendor/Package.55.mjs +35 -0
- package/vendor/Package.56.cjs +37 -0
- package/vendor/Package.56.mjs +35 -0
- package/vendor/Package.57.cjs +37 -0
- package/vendor/Package.57.mjs +35 -0
- package/vendor/Package.58.cjs +45 -0
- package/vendor/Package.58.mjs +43 -0
- package/vendor/Package.59.cjs +53 -0
- package/vendor/Package.59.mjs +51 -0
- package/vendor/Package.6.cjs +2067 -2058
- package/vendor/Package.6.mjs +2073 -2064
- package/vendor/Package.60.cjs +47649 -0
- package/vendor/Package.60.mjs +47606 -0
- package/vendor/Package.610.cjs +19 -19
- package/vendor/Package.610.mjs +11 -11
- package/vendor/Package.611.cjs +40 -30
- package/vendor/Package.611.mjs +30 -20
- package/vendor/Package.612.cjs +48 -42
- package/vendor/Package.612.mjs +39 -33
- package/vendor/Package.613.cjs +64 -63
- package/vendor/Package.613.mjs +34 -33
- package/vendor/Package.62.cjs +300 -297
- package/vendor/Package.62.mjs +283 -280
- package/vendor/Package.63.cjs +511 -168
- package/vendor/Package.63.mjs +490 -165
- package/vendor/Package.64.cjs +139 -511
- package/vendor/Package.64.mjs +139 -491
- package/vendor/Package.65.cjs +4135 -150
- package/vendor/Package.65.mjs +4143 -150
- package/vendor/Package.66.cjs +346 -4150
- package/vendor/Package.66.mjs +346 -4158
- package/vendor/Package.67.cjs +433 -282
- package/vendor/Package.67.mjs +431 -280
- package/vendor/Package.68.cjs +248 -397
- package/vendor/Package.68.mjs +81 -230
- package/vendor/Package.69.cjs +8 -8
- package/vendor/Package.7.cjs +3 -3
- package/vendor/Package.7.mjs +3 -3
- package/vendor/Package.8.cjs +0 -4
- package/vendor/Package.8.mjs +0 -4
- package/vendor/Package.9.cjs +138 -124
- package/vendor/Package.9.mjs +135 -121
- package/vendor/TypeDef.internal.3.d.ts +0 -4
- package/vendor/Package.102.cjs +0 -48773
- package/vendor/Package.102.mjs +0 -48697
- package/vendor/Package.122.cjs +0 -3
- package/vendor/Package.122.mjs +0 -1
package/vendor/Package.67.cjs
CHANGED
|
@@ -1,57 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const t = require("buffer");
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
if (
|
|
5
|
+
var _serialize = (e, s = true) => {
|
|
6
|
+
if (e === void 0 || e === null) {
|
|
7
7
|
return "null";
|
|
8
8
|
}
|
|
9
|
-
if (typeof
|
|
10
|
-
return JSON.stringify(s.startsWith(":") ?
|
|
9
|
+
if (typeof e === "string") {
|
|
10
|
+
return JSON.stringify(s && e.startsWith(":") ? `:${e}` : e);
|
|
11
11
|
}
|
|
12
|
-
if (
|
|
13
|
-
return JSON.stringify(
|
|
12
|
+
if (t.Buffer.isBuffer(e)) {
|
|
13
|
+
return JSON.stringify(`:base64:${e.toString("base64")}`);
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if (e?.toJSON) {
|
|
16
|
+
e = e.toJSON();
|
|
17
17
|
}
|
|
18
|
-
if (typeof
|
|
19
|
-
let
|
|
20
|
-
const i = Array.isArray(
|
|
21
|
-
|
|
18
|
+
if (typeof e === "object") {
|
|
19
|
+
let t = "";
|
|
20
|
+
const i = Array.isArray(e);
|
|
21
|
+
t = i ? "[" : "{";
|
|
22
22
|
let r = true;
|
|
23
|
-
for (const o in
|
|
24
|
-
const a = typeof
|
|
25
|
-
if (!Object.hasOwn(
|
|
23
|
+
for (const o in e) {
|
|
24
|
+
const a = typeof e[o] === "function" || !i && e[o] === void 0;
|
|
25
|
+
if (!Object.hasOwn(e, o) || a) {
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
28
|
if (!r) {
|
|
29
|
-
|
|
29
|
+
t += ",";
|
|
30
30
|
}
|
|
31
31
|
r = false;
|
|
32
32
|
if (i) {
|
|
33
|
-
|
|
34
|
-
} else if (
|
|
35
|
-
|
|
33
|
+
t += _serialize(e[o], s);
|
|
34
|
+
} else if (e[o] !== void 0) {
|
|
35
|
+
t += `${_serialize(o, false)}:${_serialize(e[o], s)}`;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
return
|
|
38
|
+
t += i ? "]" : "}";
|
|
39
|
+
return t;
|
|
40
40
|
}
|
|
41
|
-
return JSON.stringify(
|
|
41
|
+
return JSON.stringify(e);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var defaultSerialize = t => _serialize(t, true);
|
|
45
|
+
|
|
46
|
+
var defaultDeserialize = e => JSON.parse(e, ((e, s) => {
|
|
45
47
|
if (typeof s === "string") {
|
|
46
48
|
if (s.startsWith(":base64:")) {
|
|
47
|
-
return
|
|
49
|
+
return t.Buffer.from(s.slice(8), "base64");
|
|
48
50
|
}
|
|
49
51
|
return s.startsWith(":") ? s.slice(1) : s;
|
|
50
52
|
}
|
|
51
53
|
return s;
|
|
52
54
|
}));
|
|
53
55
|
|
|
54
|
-
var
|
|
56
|
+
var e = class {
|
|
55
57
|
_eventListeners;
|
|
56
58
|
_maxListeners;
|
|
57
59
|
constructor() {
|
|
@@ -61,98 +63,98 @@ var i = class {
|
|
|
61
63
|
maxListeners() {
|
|
62
64
|
return this._maxListeners;
|
|
63
65
|
}
|
|
64
|
-
addListener(
|
|
65
|
-
this.on(
|
|
66
|
+
addListener(t, e) {
|
|
67
|
+
this.on(t, e);
|
|
66
68
|
}
|
|
67
|
-
on(
|
|
68
|
-
if (!this._eventListeners.has(
|
|
69
|
-
this._eventListeners.set(
|
|
69
|
+
on(t, e) {
|
|
70
|
+
if (!this._eventListeners.has(t)) {
|
|
71
|
+
this._eventListeners.set(t, []);
|
|
70
72
|
}
|
|
71
|
-
const s = this._eventListeners.get(
|
|
73
|
+
const s = this._eventListeners.get(t);
|
|
72
74
|
if (s) {
|
|
73
75
|
if (s.length >= this._maxListeners) {
|
|
74
|
-
console.warn(`MaxListenersExceededWarning: Possible event memory leak detected. ${s.length + 1} ${
|
|
76
|
+
console.warn(`MaxListenersExceededWarning: Possible event memory leak detected. ${s.length + 1} ${t} listeners added. Use setMaxListeners() to increase limit.`);
|
|
75
77
|
}
|
|
76
|
-
s.push(
|
|
78
|
+
s.push(e);
|
|
77
79
|
}
|
|
78
80
|
return this;
|
|
79
81
|
}
|
|
80
|
-
removeListener(
|
|
81
|
-
this.off(
|
|
82
|
+
removeListener(t, e) {
|
|
83
|
+
this.off(t, e);
|
|
82
84
|
}
|
|
83
|
-
off(
|
|
84
|
-
const s = this._eventListeners.get(
|
|
85
|
-
const i = s.indexOf(
|
|
85
|
+
off(t, e) {
|
|
86
|
+
const s = this._eventListeners.get(t) ?? [];
|
|
87
|
+
const i = s.indexOf(e);
|
|
86
88
|
if (i !== -1) {
|
|
87
89
|
s.splice(i, 1);
|
|
88
90
|
}
|
|
89
91
|
if (s.length === 0) {
|
|
90
|
-
this._eventListeners.delete(
|
|
92
|
+
this._eventListeners.delete(t);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
|
-
once(
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
this.off(
|
|
95
|
+
once(t, e) {
|
|
96
|
+
const onceListener = (...s) => {
|
|
97
|
+
e(...s);
|
|
98
|
+
this.off(t, onceListener);
|
|
97
99
|
};
|
|
98
|
-
this.on(
|
|
100
|
+
this.on(t, onceListener);
|
|
99
101
|
}
|
|
100
|
-
emit(
|
|
101
|
-
const s = this._eventListeners.get(
|
|
102
|
+
emit(t, ...e) {
|
|
103
|
+
const s = this._eventListeners.get(t);
|
|
102
104
|
if (s && s.length > 0) {
|
|
103
|
-
for (const
|
|
104
|
-
|
|
105
|
+
for (const t of s) {
|
|
106
|
+
t(...e);
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
|
-
listeners(
|
|
109
|
-
return this._eventListeners.get(
|
|
110
|
+
listeners(t) {
|
|
111
|
+
return this._eventListeners.get(t) ?? [];
|
|
110
112
|
}
|
|
111
|
-
removeAllListeners(
|
|
112
|
-
if (
|
|
113
|
-
this._eventListeners.delete(
|
|
113
|
+
removeAllListeners(t) {
|
|
114
|
+
if (t) {
|
|
115
|
+
this._eventListeners.delete(t);
|
|
114
116
|
} else {
|
|
115
117
|
this._eventListeners.clear();
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
|
-
setMaxListeners(
|
|
119
|
-
this._maxListeners =
|
|
120
|
+
setMaxListeners(t) {
|
|
121
|
+
this._maxListeners = t;
|
|
120
122
|
}
|
|
121
123
|
};
|
|
122
124
|
|
|
123
|
-
var
|
|
125
|
+
var s = e;
|
|
124
126
|
|
|
125
|
-
var
|
|
127
|
+
var i = class extends s {
|
|
126
128
|
_hookHandlers;
|
|
127
129
|
constructor() {
|
|
128
130
|
super();
|
|
129
131
|
this._hookHandlers = new Map;
|
|
130
132
|
}
|
|
131
|
-
addHandler(
|
|
132
|
-
const s = this._hookHandlers.get(
|
|
133
|
+
addHandler(t, e) {
|
|
134
|
+
const s = this._hookHandlers.get(t);
|
|
133
135
|
if (s) {
|
|
134
|
-
s.push(
|
|
136
|
+
s.push(e);
|
|
135
137
|
} else {
|
|
136
|
-
this._hookHandlers.set(
|
|
138
|
+
this._hookHandlers.set(t, [ e ]);
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
|
-
removeHandler(
|
|
140
|
-
const s = this._hookHandlers.get(
|
|
141
|
+
removeHandler(t, e) {
|
|
142
|
+
const s = this._hookHandlers.get(t);
|
|
141
143
|
if (s) {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
s.splice(
|
|
144
|
+
const t = s.indexOf(e);
|
|
145
|
+
if (t !== -1) {
|
|
146
|
+
s.splice(t, 1);
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
|
-
trigger(
|
|
149
|
-
const s = this._hookHandlers.get(
|
|
150
|
+
trigger(t, e) {
|
|
151
|
+
const s = this._hookHandlers.get(t);
|
|
150
152
|
if (s) {
|
|
151
153
|
for (const i of s) {
|
|
152
154
|
try {
|
|
153
|
-
i(
|
|
154
|
-
} catch (
|
|
155
|
-
this.emit("error", new Error(`Error in hook handler for event "${
|
|
155
|
+
i(e);
|
|
156
|
+
} catch (e) {
|
|
157
|
+
this.emit("error", new Error(`Error in hook handler for event "${t}": ${e.message}`));
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
}
|
|
@@ -162,19 +164,19 @@ var o = class extends r {
|
|
|
162
164
|
}
|
|
163
165
|
};
|
|
164
166
|
|
|
165
|
-
var
|
|
167
|
+
var r = i;
|
|
166
168
|
|
|
167
|
-
var
|
|
169
|
+
var o = class extends s {
|
|
168
170
|
enabled=true;
|
|
169
171
|
hits=0;
|
|
170
172
|
misses=0;
|
|
171
173
|
sets=0;
|
|
172
174
|
deletes=0;
|
|
173
175
|
errors=0;
|
|
174
|
-
constructor(
|
|
176
|
+
constructor(t) {
|
|
175
177
|
super();
|
|
176
|
-
if (
|
|
177
|
-
this.enabled =
|
|
178
|
+
if (t !== void 0) {
|
|
179
|
+
this.enabled = t;
|
|
178
180
|
}
|
|
179
181
|
this.reset();
|
|
180
182
|
}
|
|
@@ -198,6 +200,15 @@ var n = class extends r {
|
|
|
198
200
|
this.deletes++;
|
|
199
201
|
}
|
|
200
202
|
}
|
|
203
|
+
hitsOrMisses(t) {
|
|
204
|
+
for (const e of t) {
|
|
205
|
+
if (e === void 0) {
|
|
206
|
+
this.miss();
|
|
207
|
+
} else {
|
|
208
|
+
this.hit();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
201
212
|
reset() {
|
|
202
213
|
this.hits = 0;
|
|
203
214
|
this.misses = 0;
|
|
@@ -207,52 +218,57 @@ var n = class extends r {
|
|
|
207
218
|
}
|
|
208
219
|
};
|
|
209
220
|
|
|
210
|
-
var
|
|
221
|
+
var a = o;
|
|
211
222
|
|
|
212
|
-
var
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
+
var n = (t => {
|
|
224
|
+
t["PRE_SET"] = "preSet";
|
|
225
|
+
t["POST_SET"] = "postSet";
|
|
226
|
+
t["PRE_GET"] = "preGet";
|
|
227
|
+
t["POST_GET"] = "postGet";
|
|
228
|
+
t["PRE_GET_MANY"] = "preGetMany";
|
|
229
|
+
t["POST_GET_MANY"] = "postGetMany";
|
|
230
|
+
t["PRE_GET_RAW"] = "preGetRaw";
|
|
231
|
+
t["POST_GET_RAW"] = "postGetRaw";
|
|
232
|
+
t["PRE_GET_MANY_RAW"] = "preGetManyRaw";
|
|
233
|
+
t["POST_GET_MANY_RAW"] = "postGetManyRaw";
|
|
234
|
+
t["PRE_DELETE"] = "preDelete";
|
|
235
|
+
t["POST_DELETE"] = "postDelete";
|
|
236
|
+
return t;
|
|
237
|
+
})(n || {});
|
|
223
238
|
|
|
224
|
-
var
|
|
239
|
+
var h = [ "sqlite", "postgres", "mysql", "mongo", "redis", "valkey", "etcd" ];
|
|
225
240
|
|
|
226
|
-
var
|
|
241
|
+
var l = class extends s {
|
|
227
242
|
opts;
|
|
228
243
|
iterator;
|
|
229
|
-
hooks=new
|
|
230
|
-
stats=new
|
|
244
|
+
hooks=new r;
|
|
245
|
+
stats=new a(false);
|
|
231
246
|
_ttl;
|
|
232
247
|
_namespace;
|
|
233
248
|
_store=new Map;
|
|
234
|
-
_serialize=
|
|
235
|
-
_deserialize=
|
|
249
|
+
_serialize=defaultSerialize;
|
|
250
|
+
_deserialize=defaultDeserialize;
|
|
236
251
|
_compression;
|
|
237
252
|
_useKeyPrefix=true;
|
|
238
|
-
|
|
253
|
+
_throwOnErrors=false;
|
|
254
|
+
constructor(t, e) {
|
|
239
255
|
super();
|
|
240
|
-
i ??= {};
|
|
241
256
|
e ??= {};
|
|
257
|
+
t ??= {};
|
|
242
258
|
this.opts = {
|
|
243
259
|
namespace: "keyv",
|
|
244
|
-
serialize:
|
|
245
|
-
deserialize:
|
|
260
|
+
serialize: defaultSerialize,
|
|
261
|
+
deserialize: defaultDeserialize,
|
|
246
262
|
emitErrors: true,
|
|
247
263
|
store: new Map,
|
|
248
|
-
...
|
|
264
|
+
...e
|
|
249
265
|
};
|
|
250
|
-
if (
|
|
251
|
-
this.opts.store =
|
|
266
|
+
if (t && t.get) {
|
|
267
|
+
this.opts.store = t;
|
|
252
268
|
} else {
|
|
253
269
|
this.opts = {
|
|
254
270
|
...this.opts,
|
|
255
|
-
...
|
|
271
|
+
...t
|
|
256
272
|
};
|
|
257
273
|
}
|
|
258
274
|
this._store = this.opts.store ?? new Map;
|
|
@@ -267,7 +283,7 @@ var f = class extends r {
|
|
|
267
283
|
throw new Error("Invalid storage adapter");
|
|
268
284
|
}
|
|
269
285
|
if (typeof this._store.on === "function") {
|
|
270
|
-
this._store.on("error", (
|
|
286
|
+
this._store.on("error", (t => this.emit("error", t)));
|
|
271
287
|
}
|
|
272
288
|
this._store.namespace = this._namespace;
|
|
273
289
|
if (typeof this._store[Symbol.iterator] === "function" && this._store instanceof Map) {
|
|
@@ -285,24 +301,27 @@ var f = class extends r {
|
|
|
285
301
|
if (this.opts.useKeyPrefix !== void 0) {
|
|
286
302
|
this._useKeyPrefix = this.opts.useKeyPrefix;
|
|
287
303
|
}
|
|
304
|
+
if (this.opts.throwOnErrors !== void 0) {
|
|
305
|
+
this._throwOnErrors = this.opts.throwOnErrors;
|
|
306
|
+
}
|
|
288
307
|
}
|
|
289
308
|
get store() {
|
|
290
309
|
return this._store;
|
|
291
310
|
}
|
|
292
|
-
set store(
|
|
293
|
-
if (this._isValidStorageAdapter(
|
|
294
|
-
this._store =
|
|
295
|
-
this.opts.store =
|
|
296
|
-
if (typeof
|
|
297
|
-
|
|
311
|
+
set store(t) {
|
|
312
|
+
if (this._isValidStorageAdapter(t)) {
|
|
313
|
+
this._store = t;
|
|
314
|
+
this.opts.store = t;
|
|
315
|
+
if (typeof t.on === "function") {
|
|
316
|
+
t.on("error", (t => this.emit("error", t)));
|
|
298
317
|
}
|
|
299
318
|
if (this._namespace) {
|
|
300
319
|
this._store.namespace = this._namespace;
|
|
301
320
|
}
|
|
302
|
-
if (typeof
|
|
303
|
-
this.iterator = this.generateIterator(
|
|
304
|
-
} else if ("iterator" in
|
|
305
|
-
this.iterator = this.generateIterator(
|
|
321
|
+
if (typeof t[Symbol.iterator] === "function" && t instanceof Map) {
|
|
322
|
+
this.iterator = this.generateIterator(t);
|
|
323
|
+
} else if ("iterator" in t && t.opts && this._checkIterableAdapter()) {
|
|
324
|
+
this.iterator = this.generateIterator(t.iterator?.bind(t));
|
|
306
325
|
}
|
|
307
326
|
} else {
|
|
308
327
|
throw new Error("Invalid storage adapter");
|
|
@@ -311,187 +330,298 @@ var f = class extends r {
|
|
|
311
330
|
get compression() {
|
|
312
331
|
return this._compression;
|
|
313
332
|
}
|
|
314
|
-
set compression(
|
|
315
|
-
this._compression =
|
|
333
|
+
set compression(t) {
|
|
334
|
+
this._compression = t;
|
|
316
335
|
}
|
|
317
336
|
get namespace() {
|
|
318
337
|
return this._namespace;
|
|
319
338
|
}
|
|
320
|
-
set namespace(
|
|
321
|
-
this._namespace =
|
|
322
|
-
this.opts.namespace =
|
|
323
|
-
this._store.namespace =
|
|
339
|
+
set namespace(t) {
|
|
340
|
+
this._namespace = t;
|
|
341
|
+
this.opts.namespace = t;
|
|
342
|
+
this._store.namespace = t;
|
|
324
343
|
if (this.opts.store) {
|
|
325
|
-
this.opts.store.namespace =
|
|
344
|
+
this.opts.store.namespace = t;
|
|
326
345
|
}
|
|
327
346
|
}
|
|
328
347
|
get ttl() {
|
|
329
348
|
return this._ttl;
|
|
330
349
|
}
|
|
331
|
-
set ttl(
|
|
332
|
-
this.opts.ttl =
|
|
333
|
-
this._ttl =
|
|
350
|
+
set ttl(t) {
|
|
351
|
+
this.opts.ttl = t;
|
|
352
|
+
this._ttl = t;
|
|
334
353
|
}
|
|
335
354
|
get serialize() {
|
|
336
355
|
return this._serialize;
|
|
337
356
|
}
|
|
338
|
-
set serialize(
|
|
339
|
-
this.opts.serialize =
|
|
340
|
-
this._serialize =
|
|
357
|
+
set serialize(t) {
|
|
358
|
+
this.opts.serialize = t;
|
|
359
|
+
this._serialize = t;
|
|
341
360
|
}
|
|
342
361
|
get deserialize() {
|
|
343
362
|
return this._deserialize;
|
|
344
363
|
}
|
|
345
|
-
set deserialize(
|
|
346
|
-
this.opts.deserialize =
|
|
347
|
-
this._deserialize =
|
|
364
|
+
set deserialize(t) {
|
|
365
|
+
this.opts.deserialize = t;
|
|
366
|
+
this._deserialize = t;
|
|
348
367
|
}
|
|
349
368
|
get useKeyPrefix() {
|
|
350
369
|
return this._useKeyPrefix;
|
|
351
370
|
}
|
|
352
|
-
set useKeyPrefix(
|
|
353
|
-
this._useKeyPrefix =
|
|
354
|
-
this.opts.useKeyPrefix =
|
|
371
|
+
set useKeyPrefix(t) {
|
|
372
|
+
this._useKeyPrefix = t;
|
|
373
|
+
this.opts.useKeyPrefix = t;
|
|
374
|
+
}
|
|
375
|
+
get throwOnErrors() {
|
|
376
|
+
return this._throwOnErrors;
|
|
377
|
+
}
|
|
378
|
+
set throwOnErrors(t) {
|
|
379
|
+
this._throwOnErrors = t;
|
|
380
|
+
this.opts.throwOnErrors = t;
|
|
355
381
|
}
|
|
356
|
-
generateIterator(
|
|
357
|
-
const
|
|
358
|
-
for await (const [
|
|
359
|
-
const
|
|
360
|
-
if (this._useKeyPrefix && this._store.namespace && !
|
|
382
|
+
generateIterator(t) {
|
|
383
|
+
const function_ = async function*() {
|
|
384
|
+
for await (const [e, s] of typeof t === "function" ? t(this._store.namespace) : t) {
|
|
385
|
+
const t = await this.deserializeData(s);
|
|
386
|
+
if (this._useKeyPrefix && this._store.namespace && !e.includes(this._store.namespace)) {
|
|
361
387
|
continue;
|
|
362
388
|
}
|
|
363
|
-
if (typeof
|
|
364
|
-
this.delete(
|
|
389
|
+
if (typeof t.expires === "number" && Date.now() > t.expires) {
|
|
390
|
+
this.delete(e);
|
|
365
391
|
continue;
|
|
366
392
|
}
|
|
367
|
-
yield [ this._getKeyUnprefix(
|
|
393
|
+
yield [ this._getKeyUnprefix(e), t.value ];
|
|
368
394
|
}
|
|
369
395
|
};
|
|
370
|
-
return
|
|
396
|
+
return function_.bind(this);
|
|
371
397
|
}
|
|
372
398
|
_checkIterableAdapter() {
|
|
373
|
-
return
|
|
399
|
+
return h.includes(this._store.opts.dialect) || h.some((t => this._store.opts.url.includes(t)));
|
|
374
400
|
}
|
|
375
|
-
_getKeyPrefix(
|
|
401
|
+
_getKeyPrefix(t) {
|
|
376
402
|
if (!this._useKeyPrefix) {
|
|
377
|
-
return
|
|
403
|
+
return t;
|
|
378
404
|
}
|
|
379
405
|
if (!this._namespace) {
|
|
380
|
-
return
|
|
406
|
+
return t;
|
|
381
407
|
}
|
|
382
|
-
return `${this._namespace}:${
|
|
408
|
+
return `${this._namespace}:${t}`;
|
|
383
409
|
}
|
|
384
|
-
_getKeyPrefixArray(
|
|
410
|
+
_getKeyPrefixArray(t) {
|
|
385
411
|
if (!this._useKeyPrefix) {
|
|
386
|
-
return
|
|
412
|
+
return t;
|
|
387
413
|
}
|
|
388
414
|
if (!this._namespace) {
|
|
389
|
-
return
|
|
415
|
+
return t;
|
|
390
416
|
}
|
|
391
|
-
return
|
|
417
|
+
return t.map((t => `${this._namespace}:${t}`));
|
|
392
418
|
}
|
|
393
|
-
_getKeyUnprefix(
|
|
419
|
+
_getKeyUnprefix(t) {
|
|
394
420
|
if (!this._useKeyPrefix) {
|
|
395
|
-
return
|
|
421
|
+
return t;
|
|
396
422
|
}
|
|
397
|
-
return
|
|
423
|
+
return t.split(":").splice(1).join(":");
|
|
398
424
|
}
|
|
399
|
-
_isValidStorageAdapter(
|
|
400
|
-
return
|
|
425
|
+
_isValidStorageAdapter(t) {
|
|
426
|
+
return t instanceof Map || typeof t.get === "function" && typeof t.set === "function" && typeof t.delete === "function" && typeof t.clear === "function";
|
|
401
427
|
}
|
|
402
|
-
async get(
|
|
428
|
+
async get(t, e) {
|
|
403
429
|
const {store: s} = this.opts;
|
|
404
|
-
const i = Array.isArray(
|
|
405
|
-
const r = i ? this._getKeyPrefixArray(
|
|
406
|
-
const
|
|
430
|
+
const i = Array.isArray(t);
|
|
431
|
+
const r = i ? this._getKeyPrefixArray(t) : this._getKeyPrefix(t);
|
|
432
|
+
const isDataExpired = t => typeof t.expires === "number" && Date.now() > t.expires;
|
|
407
433
|
if (i) {
|
|
408
|
-
if (
|
|
409
|
-
return this.getMany(
|
|
434
|
+
if (e?.raw === true) {
|
|
435
|
+
return this.getMany(t, {
|
|
410
436
|
raw: true
|
|
411
437
|
});
|
|
412
438
|
}
|
|
413
|
-
return this.getMany(
|
|
439
|
+
return this.getMany(t, {
|
|
414
440
|
raw: false
|
|
415
441
|
});
|
|
416
442
|
}
|
|
417
443
|
this.hooks.trigger("preGet", {
|
|
418
444
|
key: r
|
|
419
445
|
});
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
446
|
+
let o;
|
|
447
|
+
try {
|
|
448
|
+
o = await s.get(r);
|
|
449
|
+
} catch (t) {
|
|
450
|
+
if (this.throwOnErrors) {
|
|
451
|
+
throw t;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
const a = typeof o === "string" || this.opts.compression ? await this.deserializeData(o) : o;
|
|
455
|
+
if (a === void 0 || a === null) {
|
|
456
|
+
this.hooks.trigger("postGet", {
|
|
457
|
+
key: r,
|
|
458
|
+
value: void 0
|
|
459
|
+
});
|
|
423
460
|
this.stats.miss();
|
|
424
461
|
return void 0;
|
|
425
462
|
}
|
|
426
|
-
if (
|
|
427
|
-
await this.delete(
|
|
463
|
+
if (isDataExpired(a)) {
|
|
464
|
+
await this.delete(t);
|
|
465
|
+
this.hooks.trigger("postGet", {
|
|
466
|
+
key: r,
|
|
467
|
+
value: void 0
|
|
468
|
+
});
|
|
428
469
|
this.stats.miss();
|
|
429
470
|
return void 0;
|
|
430
471
|
}
|
|
431
472
|
this.hooks.trigger("postGet", {
|
|
432
473
|
key: r,
|
|
433
|
-
value:
|
|
474
|
+
value: a
|
|
434
475
|
});
|
|
435
476
|
this.stats.hit();
|
|
436
|
-
return
|
|
477
|
+
return e?.raw ? a : a.value;
|
|
437
478
|
}
|
|
438
|
-
async getMany(
|
|
479
|
+
async getMany(t, e) {
|
|
439
480
|
const {store: s} = this.opts;
|
|
440
|
-
const i = this._getKeyPrefixArray(
|
|
441
|
-
const
|
|
481
|
+
const i = this._getKeyPrefixArray(t);
|
|
482
|
+
const isDataExpired = t => typeof t.expires === "number" && Date.now() > t.expires;
|
|
442
483
|
this.hooks.trigger("preGetMany", {
|
|
443
484
|
keys: i
|
|
444
485
|
});
|
|
445
486
|
if (s.getMany === void 0) {
|
|
446
|
-
const
|
|
447
|
-
const i = await s.get(
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
487
|
+
const t = i.map((async t => {
|
|
488
|
+
const i = await s.get(t);
|
|
489
|
+
const r = typeof i === "string" || this.opts.compression ? await this.deserializeData(i) : i;
|
|
490
|
+
if (r === void 0 || r === null) {
|
|
450
491
|
return void 0;
|
|
451
492
|
}
|
|
452
|
-
if (r
|
|
453
|
-
await this.delete(
|
|
493
|
+
if (isDataExpired(r)) {
|
|
494
|
+
await this.delete(t);
|
|
454
495
|
return void 0;
|
|
455
496
|
}
|
|
456
|
-
return
|
|
497
|
+
return e?.raw ? r : r.value;
|
|
457
498
|
}));
|
|
458
|
-
const
|
|
459
|
-
const
|
|
460
|
-
this.hooks.trigger("postGetMany",
|
|
461
|
-
if (
|
|
499
|
+
const r = await Promise.allSettled(t);
|
|
500
|
+
const o = r.map((t => t.value));
|
|
501
|
+
this.hooks.trigger("postGetMany", o);
|
|
502
|
+
if (o.length > 0) {
|
|
462
503
|
this.stats.hit();
|
|
463
504
|
}
|
|
464
|
-
return
|
|
505
|
+
return o;
|
|
465
506
|
}
|
|
466
|
-
const
|
|
507
|
+
const r = await s.getMany(i);
|
|
508
|
+
const o = [];
|
|
467
509
|
const a = [];
|
|
468
|
-
for (const s in
|
|
469
|
-
let i =
|
|
510
|
+
for (const s in r) {
|
|
511
|
+
let i = r[s];
|
|
470
512
|
if (typeof i === "string") {
|
|
471
513
|
i = await this.deserializeData(i);
|
|
472
514
|
}
|
|
473
515
|
if (i === void 0 || i === null) {
|
|
474
|
-
|
|
516
|
+
o.push(void 0);
|
|
475
517
|
continue;
|
|
476
518
|
}
|
|
477
|
-
if (
|
|
478
|
-
|
|
479
|
-
|
|
519
|
+
if (isDataExpired(i)) {
|
|
520
|
+
a.push(t[s]);
|
|
521
|
+
o.push(void 0);
|
|
480
522
|
continue;
|
|
481
523
|
}
|
|
482
|
-
const n =
|
|
483
|
-
|
|
524
|
+
const n = e?.raw ? i : i.value;
|
|
525
|
+
o.push(n);
|
|
484
526
|
}
|
|
485
|
-
this.hooks.trigger("postGetMany", a);
|
|
486
527
|
if (a.length > 0) {
|
|
528
|
+
await this.deleteMany(a);
|
|
529
|
+
}
|
|
530
|
+
this.hooks.trigger("postGetMany", o);
|
|
531
|
+
if (o.length > 0) {
|
|
487
532
|
this.stats.hit();
|
|
488
533
|
}
|
|
489
|
-
return
|
|
534
|
+
return o;
|
|
490
535
|
}
|
|
491
|
-
async
|
|
536
|
+
async getRaw(t) {
|
|
537
|
+
const {store: e} = this.opts;
|
|
538
|
+
const s = this._getKeyPrefix(t);
|
|
539
|
+
this.hooks.trigger("preGetRaw", {
|
|
540
|
+
key: s
|
|
541
|
+
});
|
|
542
|
+
const i = await e.get(s);
|
|
543
|
+
if (i === void 0 || i === null) {
|
|
544
|
+
this.hooks.trigger("postGetRaw", {
|
|
545
|
+
key: s,
|
|
546
|
+
value: void 0
|
|
547
|
+
});
|
|
548
|
+
this.stats.miss();
|
|
549
|
+
return void 0;
|
|
550
|
+
}
|
|
551
|
+
const r = typeof i === "string" || this.opts.compression ? await this.deserializeData(i) : i;
|
|
552
|
+
if (r !== void 0 && r.expires !== void 0 && r.expires !== null && r.expires < Date.now()) {
|
|
553
|
+
this.hooks.trigger("postGetRaw", {
|
|
554
|
+
key: s,
|
|
555
|
+
value: void 0
|
|
556
|
+
});
|
|
557
|
+
this.stats.miss();
|
|
558
|
+
await this.delete(t);
|
|
559
|
+
return void 0;
|
|
560
|
+
}
|
|
561
|
+
this.stats.hit();
|
|
562
|
+
this.hooks.trigger("postGetRaw", {
|
|
563
|
+
key: s,
|
|
564
|
+
value: r
|
|
565
|
+
});
|
|
566
|
+
return r;
|
|
567
|
+
}
|
|
568
|
+
async getManyRaw(t) {
|
|
569
|
+
const {store: e} = this.opts;
|
|
570
|
+
const s = this._getKeyPrefixArray(t);
|
|
571
|
+
if (t.length === 0) {
|
|
572
|
+
const e = Array.from({
|
|
573
|
+
length: t.length
|
|
574
|
+
}).fill(void 0);
|
|
575
|
+
this.stats.misses += t.length;
|
|
576
|
+
this.hooks.trigger("postGetManyRaw", {
|
|
577
|
+
keys: s,
|
|
578
|
+
values: e
|
|
579
|
+
});
|
|
580
|
+
return e;
|
|
581
|
+
}
|
|
582
|
+
let i = [];
|
|
583
|
+
if (e.getMany === void 0) {
|
|
584
|
+
const t = s.map((async t => {
|
|
585
|
+
const s = await e.get(t);
|
|
586
|
+
if (s !== void 0 && s !== null) {
|
|
587
|
+
return this.deserializeData(s);
|
|
588
|
+
}
|
|
589
|
+
return void 0;
|
|
590
|
+
}));
|
|
591
|
+
const r = await Promise.allSettled(t);
|
|
592
|
+
i = r.map((t => t.value));
|
|
593
|
+
} else {
|
|
594
|
+
const t = await e.getMany(s);
|
|
595
|
+
for (const e of t) {
|
|
596
|
+
if (e !== void 0 && e !== null) {
|
|
597
|
+
i.push(await this.deserializeData(e));
|
|
598
|
+
} else {
|
|
599
|
+
i.push(void 0);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const r = [];
|
|
604
|
+
const isDataExpired = t => typeof t.expires === "number" && Date.now() > t.expires;
|
|
605
|
+
for (const [t, e] of i.entries()) {
|
|
606
|
+
if (e !== void 0 && isDataExpired(e)) {
|
|
607
|
+
r.push(s[t]);
|
|
608
|
+
i[t] = void 0;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if (r.length > 0) {
|
|
612
|
+
await this.deleteMany(r);
|
|
613
|
+
}
|
|
614
|
+
this.stats.hitsOrMisses(i);
|
|
615
|
+
this.hooks.trigger("postGetManyRaw", {
|
|
616
|
+
keys: s,
|
|
617
|
+
values: i
|
|
618
|
+
});
|
|
619
|
+
return i;
|
|
620
|
+
}
|
|
621
|
+
async set(t, e, s) {
|
|
492
622
|
const i = {
|
|
493
|
-
key:
|
|
494
|
-
value:
|
|
623
|
+
key: t,
|
|
624
|
+
value: e,
|
|
495
625
|
ttl: s
|
|
496
626
|
};
|
|
497
627
|
this.hooks.trigger("preSet", i);
|
|
@@ -513,13 +643,16 @@ var f = class extends r {
|
|
|
513
643
|
const h = await this.serializeData(n);
|
|
514
644
|
let l = true;
|
|
515
645
|
try {
|
|
516
|
-
const
|
|
517
|
-
if (typeof
|
|
518
|
-
l =
|
|
646
|
+
const t = await o.set(r, h, i.ttl);
|
|
647
|
+
if (typeof t === "boolean") {
|
|
648
|
+
l = t;
|
|
519
649
|
}
|
|
520
|
-
} catch (
|
|
650
|
+
} catch (t) {
|
|
521
651
|
l = false;
|
|
522
|
-
this.emit("error",
|
|
652
|
+
this.emit("error", t);
|
|
653
|
+
if (this._throwOnErrors) {
|
|
654
|
+
throw t;
|
|
655
|
+
}
|
|
523
656
|
}
|
|
524
657
|
this.hooks.trigger("postSet", {
|
|
525
658
|
key: r,
|
|
@@ -529,63 +662,71 @@ var f = class extends r {
|
|
|
529
662
|
this.stats.set();
|
|
530
663
|
return l;
|
|
531
664
|
}
|
|
532
|
-
async setMany(
|
|
533
|
-
let
|
|
665
|
+
async setMany(t) {
|
|
666
|
+
let e = [];
|
|
534
667
|
try {
|
|
535
|
-
if (this._store.setMany
|
|
536
|
-
const s =
|
|
668
|
+
if (this._store.setMany === void 0) {
|
|
669
|
+
const s = [];
|
|
670
|
+
for (const e of t) {
|
|
671
|
+
s.push(this.set(e.key, e.value, e.ttl));
|
|
672
|
+
}
|
|
673
|
+
const i = await Promise.all(s);
|
|
674
|
+
e = i;
|
|
675
|
+
} else {
|
|
676
|
+
const s = await Promise.all(t.map((async ({key: t, value: e, ttl: s}) => {
|
|
537
677
|
s ??= this._ttl;
|
|
538
678
|
if (s === 0) {
|
|
539
679
|
s = void 0;
|
|
540
680
|
}
|
|
541
681
|
const i = typeof s === "number" ? Date.now() + s : void 0;
|
|
542
|
-
if (typeof
|
|
682
|
+
if (typeof e === "symbol") {
|
|
543
683
|
this.emit("error", "symbol cannot be serialized");
|
|
544
684
|
throw new Error("symbol cannot be serialized");
|
|
545
685
|
}
|
|
546
686
|
const r = {
|
|
547
|
-
value:
|
|
687
|
+
value: e,
|
|
548
688
|
expires: i
|
|
549
689
|
};
|
|
550
690
|
const o = await this.serializeData(r);
|
|
691
|
+
const a = this._getKeyPrefix(t);
|
|
551
692
|
return {
|
|
552
|
-
key:
|
|
693
|
+
key: a,
|
|
553
694
|
value: o,
|
|
554
695
|
ttl: s
|
|
555
696
|
};
|
|
556
697
|
})));
|
|
557
|
-
|
|
698
|
+
e = await this._store.setMany(s);
|
|
558
699
|
}
|
|
559
|
-
const s = [];
|
|
560
|
-
for (const t of e) {
|
|
561
|
-
s.push(this.set(t.key, t.value, t.ttl));
|
|
562
|
-
}
|
|
563
|
-
const i = await Promise.allSettled(s);
|
|
564
|
-
t = i.map((e => e.value));
|
|
565
700
|
} catch (s) {
|
|
566
701
|
this.emit("error", s);
|
|
567
|
-
|
|
702
|
+
if (this._throwOnErrors) {
|
|
703
|
+
throw s;
|
|
704
|
+
}
|
|
705
|
+
e = t.map((() => false));
|
|
568
706
|
}
|
|
569
|
-
return
|
|
707
|
+
return e;
|
|
570
708
|
}
|
|
571
|
-
async delete(
|
|
572
|
-
const {store:
|
|
573
|
-
if (Array.isArray(
|
|
574
|
-
return this.deleteMany(
|
|
709
|
+
async delete(t) {
|
|
710
|
+
const {store: e} = this.opts;
|
|
711
|
+
if (Array.isArray(t)) {
|
|
712
|
+
return this.deleteMany(t);
|
|
575
713
|
}
|
|
576
|
-
const s = this._getKeyPrefix(
|
|
714
|
+
const s = this._getKeyPrefix(t);
|
|
577
715
|
this.hooks.trigger("preDelete", {
|
|
578
716
|
key: s
|
|
579
717
|
});
|
|
580
718
|
let i = true;
|
|
581
719
|
try {
|
|
582
|
-
const
|
|
583
|
-
if (typeof
|
|
584
|
-
i =
|
|
720
|
+
const t = await e.delete(s);
|
|
721
|
+
if (typeof t === "boolean") {
|
|
722
|
+
i = t;
|
|
585
723
|
}
|
|
586
|
-
} catch (
|
|
724
|
+
} catch (t) {
|
|
587
725
|
i = false;
|
|
588
|
-
this.emit("error",
|
|
726
|
+
this.emit("error", t);
|
|
727
|
+
if (this._throwOnErrors) {
|
|
728
|
+
throw t;
|
|
729
|
+
}
|
|
589
730
|
}
|
|
590
731
|
this.hooks.trigger("postDelete", {
|
|
591
732
|
key: s,
|
|
@@ -594,69 +735,79 @@ var f = class extends r {
|
|
|
594
735
|
this.stats.delete();
|
|
595
736
|
return i;
|
|
596
737
|
}
|
|
597
|
-
async deleteMany(
|
|
738
|
+
async deleteMany(t) {
|
|
598
739
|
try {
|
|
599
|
-
const {store:
|
|
600
|
-
const s = this._getKeyPrefixArray(
|
|
740
|
+
const {store: e} = this.opts;
|
|
741
|
+
const s = this._getKeyPrefixArray(t);
|
|
601
742
|
this.hooks.trigger("preDelete", {
|
|
602
743
|
key: s
|
|
603
744
|
});
|
|
604
|
-
if (
|
|
605
|
-
return await
|
|
745
|
+
if (e.deleteMany !== void 0) {
|
|
746
|
+
return await e.deleteMany(s);
|
|
606
747
|
}
|
|
607
|
-
const i = s.map((async
|
|
608
|
-
const r = await Promise.
|
|
609
|
-
const o = r.every(
|
|
748
|
+
const i = s.map((async t => e.delete(t)));
|
|
749
|
+
const r = await Promise.all(i);
|
|
750
|
+
const o = r.every(Boolean);
|
|
610
751
|
this.hooks.trigger("postDelete", {
|
|
611
752
|
key: s,
|
|
612
753
|
value: o
|
|
613
754
|
});
|
|
614
755
|
return o;
|
|
615
|
-
} catch (
|
|
616
|
-
this.emit("error",
|
|
756
|
+
} catch (t) {
|
|
757
|
+
this.emit("error", t);
|
|
758
|
+
if (this._throwOnErrors) {
|
|
759
|
+
throw t;
|
|
760
|
+
}
|
|
617
761
|
return false;
|
|
618
762
|
}
|
|
619
763
|
}
|
|
620
764
|
async clear() {
|
|
621
765
|
this.emit("clear");
|
|
622
|
-
const {store:
|
|
766
|
+
const {store: t} = this.opts;
|
|
623
767
|
try {
|
|
624
|
-
await
|
|
625
|
-
} catch (
|
|
626
|
-
this.emit("error",
|
|
768
|
+
await t.clear();
|
|
769
|
+
} catch (t) {
|
|
770
|
+
this.emit("error", t);
|
|
771
|
+
if (this._throwOnErrors) {
|
|
772
|
+
throw t;
|
|
773
|
+
}
|
|
627
774
|
}
|
|
628
775
|
}
|
|
629
|
-
async has(
|
|
630
|
-
if (Array.isArray(
|
|
631
|
-
return this.hasMany(
|
|
776
|
+
async has(t) {
|
|
777
|
+
if (Array.isArray(t)) {
|
|
778
|
+
return this.hasMany(t);
|
|
632
779
|
}
|
|
633
|
-
const
|
|
780
|
+
const e = this._getKeyPrefix(t);
|
|
634
781
|
const {store: s} = this.opts;
|
|
635
782
|
if (s.has !== void 0 && !(s instanceof Map)) {
|
|
636
|
-
return s.has(
|
|
783
|
+
return s.has(e);
|
|
637
784
|
}
|
|
638
785
|
let i;
|
|
639
786
|
try {
|
|
640
|
-
i = await s.get(
|
|
641
|
-
} catch (
|
|
642
|
-
this.emit("error",
|
|
787
|
+
i = await s.get(e);
|
|
788
|
+
} catch (t) {
|
|
789
|
+
this.emit("error", t);
|
|
790
|
+
if (this._throwOnErrors) {
|
|
791
|
+
throw t;
|
|
792
|
+
}
|
|
793
|
+
return false;
|
|
643
794
|
}
|
|
644
795
|
if (i) {
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
647
|
-
if (
|
|
796
|
+
const t = await this.deserializeData(i);
|
|
797
|
+
if (t) {
|
|
798
|
+
if (t.expires === void 0 || t.expires === null) {
|
|
648
799
|
return true;
|
|
649
800
|
}
|
|
650
|
-
return
|
|
801
|
+
return t.expires > Date.now();
|
|
651
802
|
}
|
|
652
803
|
}
|
|
653
804
|
return false;
|
|
654
805
|
}
|
|
655
|
-
async hasMany(
|
|
656
|
-
const
|
|
806
|
+
async hasMany(t) {
|
|
807
|
+
const e = this._getKeyPrefixArray(t);
|
|
657
808
|
const {store: s} = this.opts;
|
|
658
809
|
if (s.hasMany !== void 0) {
|
|
659
|
-
return s.hasMany(
|
|
810
|
+
return s.hasMany(e);
|
|
660
811
|
}
|
|
661
812
|
const i = [];
|
|
662
813
|
for (const e of t) {
|
|
@@ -665,52 +816,52 @@ var f = class extends r {
|
|
|
665
816
|
return i;
|
|
666
817
|
}
|
|
667
818
|
async disconnect() {
|
|
668
|
-
const {store:
|
|
819
|
+
const {store: t} = this.opts;
|
|
669
820
|
this.emit("disconnect");
|
|
670
|
-
if (typeof
|
|
671
|
-
return
|
|
821
|
+
if (typeof t.disconnect === "function") {
|
|
822
|
+
return t.disconnect();
|
|
672
823
|
}
|
|
673
824
|
}
|
|
674
|
-
emit(
|
|
675
|
-
if (
|
|
825
|
+
emit(t, ...e) {
|
|
826
|
+
if (t === "error" && !this.opts.emitErrors) {
|
|
676
827
|
return;
|
|
677
828
|
}
|
|
678
|
-
super.emit(
|
|
829
|
+
super.emit(t, ...e);
|
|
679
830
|
}
|
|
680
|
-
async serializeData(
|
|
831
|
+
async serializeData(t) {
|
|
681
832
|
if (!this._serialize) {
|
|
682
|
-
return
|
|
833
|
+
return t;
|
|
683
834
|
}
|
|
684
835
|
if (this._compression?.compress) {
|
|
685
836
|
return this._serialize({
|
|
686
|
-
value: await this._compression.compress(
|
|
687
|
-
expires:
|
|
837
|
+
value: await this._compression.compress(t.value),
|
|
838
|
+
expires: t.expires
|
|
688
839
|
});
|
|
689
840
|
}
|
|
690
|
-
return this._serialize(
|
|
841
|
+
return this._serialize(t);
|
|
691
842
|
}
|
|
692
|
-
async deserializeData(
|
|
843
|
+
async deserializeData(t) {
|
|
693
844
|
if (!this._deserialize) {
|
|
694
|
-
return
|
|
845
|
+
return t;
|
|
695
846
|
}
|
|
696
|
-
if (this._compression?.decompress && typeof
|
|
697
|
-
const
|
|
847
|
+
if (this._compression?.decompress && typeof t === "string") {
|
|
848
|
+
const e = await this._deserialize(t);
|
|
698
849
|
return {
|
|
699
|
-
value: await this._compression.decompress(
|
|
700
|
-
expires:
|
|
850
|
+
value: await this._compression.decompress(e?.value),
|
|
851
|
+
expires: e?.expires
|
|
701
852
|
};
|
|
702
853
|
}
|
|
703
|
-
if (typeof
|
|
704
|
-
return this._deserialize(
|
|
854
|
+
if (typeof t === "string") {
|
|
855
|
+
return this._deserialize(t);
|
|
705
856
|
}
|
|
706
857
|
return void 0;
|
|
707
858
|
}
|
|
708
859
|
};
|
|
709
860
|
|
|
710
|
-
var
|
|
861
|
+
var c = l;
|
|
711
862
|
|
|
712
|
-
exports.Keyv =
|
|
863
|
+
exports.Keyv = l;
|
|
713
864
|
|
|
714
|
-
exports.defaultDeserialize =
|
|
865
|
+
exports.defaultDeserialize = defaultDeserialize;
|
|
715
866
|
|
|
716
|
-
exports.index_default =
|
|
867
|
+
exports.index_default = c;
|