lakutata 2.0.80 → 2.0.81
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 +1423 -886
- 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 +11 -11
- package/src/components/Database.mjs +11 -11
- package/src/components/Logger.cjs +7 -7
- package/src/components/Logger.mjs +7 -7
- package/src/components/cacher/Cacher.cjs +1178 -264
- package/src/components/cacher/Cacher.mjs +1087 -173
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +479 -2963
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +469 -2947
- package/src/components/docker/ConnectionOptionsBuilder.cjs +15 -17
- package/src/components/docker/ConnectionOptionsBuilder.mjs +13 -15
- package/src/components/docker/Docker.cjs +4884 -4945
- package/src/components/docker/Docker.mjs +4902 -4963
- 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/entrypoint/Entrypoint.cjs +2170 -1678
- package/src/components/entrypoint/Entrypoint.mjs +2126 -1634
- 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 +4 -2
- package/src/components/monitor/AliveMonitor.mjs +4 -2
- 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 +5 -3
- package/src/components/monitor/MemoryMonitor.mjs +5 -3
- package/src/decorators/ctrl/CLIAction.cjs +3 -3
- package/src/decorators/ctrl/CLIAction.mjs +3 -3
- package/src/decorators/ctrl/HTTPAction.cjs +3 -3
- package/src/decorators/ctrl/HTTPAction.mjs +3 -3
- package/src/decorators/ctrl/ServiceAction.cjs +3 -3
- package/src/decorators/ctrl/ServiceAction.mjs +3 -3
- package/src/decorators/ctrl/http/DELETE.cjs +3 -3
- package/src/decorators/ctrl/http/DELETE.mjs +3 -3
- package/src/decorators/ctrl/http/GET.cjs +3 -3
- package/src/decorators/ctrl/http/GET.mjs +3 -3
- package/src/decorators/ctrl/http/HEAD.cjs +3 -3
- package/src/decorators/ctrl/http/HEAD.mjs +3 -3
- package/src/decorators/ctrl/http/OPTIONS.cjs +3 -3
- package/src/decorators/ctrl/http/OPTIONS.mjs +3 -3
- package/src/decorators/ctrl/http/PATCH.cjs +3 -3
- package/src/decorators/ctrl/http/PATCH.mjs +3 -3
- package/src/decorators/ctrl/http/POST.cjs +3 -3
- package/src/decorators/ctrl/http/POST.mjs +3 -3
- package/src/decorators/ctrl/http/PUT.cjs +3 -3
- package/src/decorators/ctrl/http/PUT.mjs +3 -3
- 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 +1200 -1193
- package/src/lib/base/EventEmitter.mjs +1201 -1194
- package/src/lib/base/internal/ApplicationConfigLoader.cjs +4 -2
- package/src/lib/base/internal/ApplicationConfigLoader.mjs +4 -2
- package/src/lib/base/internal/ControllerEntrypoint.cjs +3 -3
- package/src/lib/base/internal/ControllerEntrypoint.mjs +3 -3
- package/src/lib/base/internal/DataValidator.cjs +176 -179
- package/src/lib/base/internal/DataValidator.mjs +177 -180
- package/src/lib/base/internal/ModuleConfigLoader.cjs +4 -3
- package/src/lib/base/internal/ModuleConfigLoader.mjs +4 -3
- package/src/lib/base/internal/ObjectType.cjs +4 -2
- package/src/lib/base/internal/ObjectType.mjs +4 -2
- package/src/lib/base/internal/PatternManager.cjs +740 -735
- package/src/lib/base/internal/PatternManager.mjs +745 -740
- package/src/lib/base/internal/StringifyPattern.cjs +1 -1
- package/src/lib/base/internal/StringifyPattern.mjs +1 -1
- package/src/lib/core/Application.cjs +151 -147
- package/src/lib/core/Application.mjs +199 -197
- 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/Glob.cjs +970 -721
- package/src/lib/helpers/Glob.mjs +1036 -787
- package/src/lib/helpers/IsHtml.cjs +7 -13
- package/src/lib/helpers/IsHtml.mjs +7 -13
- package/src/lib/helpers/IsXML.cjs +1158 -1016
- package/src/lib/helpers/IsXML.mjs +871 -729
- package/src/lib/helpers/MD5.cjs +1 -1
- package/src/lib/helpers/MD5.mjs +1 -1
- package/src/lib/helpers/NonceStr.cjs +1 -1
- package/src/lib/helpers/NonceStr.mjs +1 -1
- package/src/lib/helpers/ObjectHash.cjs +379 -372
- package/src/lib/helpers/ObjectHash.mjs +379 -372
- package/src/lib/helpers/RandomString.cjs +168 -147
- package/src/lib/helpers/RandomString.mjs +167 -146
- package/src/lib/helpers/SHA1.cjs +1 -1
- package/src/lib/helpers/SHA1.mjs +1 -1
- package/src/lib/helpers/SHA256.cjs +1 -1
- package/src/lib/helpers/SHA256.mjs +1 -1
- package/src/lib/helpers/SortArray.cjs +1 -1
- package/src/lib/helpers/SortArray.mjs +1 -1
- package/src/lib/helpers/Statistics.cjs +1 -1
- package/src/lib/helpers/Statistics.mjs +1 -1
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +350 -350
- package/src/lib/helpers/UUID.cjs +1 -1
- package/src/lib/helpers/UUID.mjs +1 -1
- package/src/lib/ioc/DependencyInjectionContainer.cjs +32 -30
- package/src/lib/ioc/DependencyInjectionContainer.mjs +12 -10
- package/src/lib/ioc/ListModules.cjs +5174 -5249
- package/src/lib/ioc/ListModules.mjs +5177 -5252
- package/src/lib/validation/VLD.cjs +4080 -3902
- package/src/lib/validation/VLD.mjs +2970 -2792
- 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 +11 -11
- package/src/providers/Database.mjs +11 -11
- package/src/providers/PasswordHash.cjs +5 -3
- package/src/providers/PasswordHash.mjs +190 -188
- package/src/providers/migration/GenerateMigration.cjs +15 -19
- package/src/providers/migration/GenerateMigration.mjs +15 -19
- 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 +18129 -1935
- package/vendor/Package.16.mjs +18115 -1839
- package/vendor/Package.17.cjs +1922 -47918
- package/vendor/Package.17.mjs +1874 -47937
- 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 +5739 -5710
- package/vendor/Package.2.mjs +5733 -5704
- 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.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 +884 -874
- 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 +15 -11
- package/vendor/Package.5.mjs +11 -7
- 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 +520 -511
- package/vendor/Package.6.mjs +543 -534
- package/vendor/Package.60.cjs +47649 -0
- package/vendor/Package.60.mjs +47606 -0
- package/vendor/Package.610.cjs +11 -11
- package/vendor/Package.610.mjs +11 -11
- package/vendor/Package.611.cjs +33 -23
- package/vendor/Package.611.mjs +19 -9
- package/vendor/Package.612.cjs +42 -36
- package/vendor/Package.612.mjs +35 -29
- package/vendor/Package.613.cjs +5 -4
- package/vendor/Package.613.mjs +5 -4
- package/vendor/Package.62.cjs +92 -89
- package/vendor/Package.62.mjs +185 -182
- package/vendor/Package.63.cjs +509 -166
- 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 +412 -261
- package/vendor/Package.67.mjs +410 -259
- package/vendor/Package.68.cjs +397 -405
- package/vendor/Package.68.mjs +227 -242
- package/vendor/Package.8.cjs +0 -4
- package/vendor/Package.8.mjs +0 -4
- package/vendor/Package.9.cjs +132 -118
- package/vendor/Package.9.mjs +138 -124
- 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.68.cjs
CHANGED
|
@@ -4,207 +4,116 @@ Object.defineProperty(exports, Symbol.toStringTag, {
|
|
|
4
4
|
value: "Module"
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const t = require("@redis/client");
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const e = require("cluster-key-slot");
|
|
10
10
|
|
|
11
|
-
const r = require("
|
|
11
|
+
const r = require("./Package.66.cjs");
|
|
12
|
+
|
|
13
|
+
const s = require("./Package.67.cjs");
|
|
12
14
|
|
|
13
15
|
require("buffer");
|
|
14
16
|
|
|
15
|
-
const
|
|
16
|
-
default:
|
|
17
|
+
const i = t => t && t.__esModule ? t : {
|
|
18
|
+
default: t
|
|
17
19
|
};
|
|
18
20
|
|
|
19
|
-
const
|
|
21
|
+
const n = i(e);
|
|
20
22
|
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.off(e, r), t(...s);
|
|
31
|
-
};
|
|
32
|
-
return this.on(e, r), this;
|
|
33
|
-
}
|
|
34
|
-
listenerCount(e) {
|
|
35
|
-
if (!e) return this.getAllListeners().length;
|
|
36
|
-
let t = this._eventListeners.get(e);
|
|
37
|
-
return t ? t.length : 0;
|
|
38
|
-
}
|
|
39
|
-
eventNames() {
|
|
40
|
-
return [ ...this._eventListeners.keys() ];
|
|
41
|
-
}
|
|
42
|
-
rawListeners(e) {
|
|
43
|
-
return e ? this._eventListeners.get(e) ?? [] : this.getAllListeners();
|
|
44
|
-
}
|
|
45
|
-
prependListener(e, t) {
|
|
46
|
-
let r = this._eventListeners.get(e) ?? [];
|
|
47
|
-
return r.unshift(t), this._eventListeners.set(e, r), this;
|
|
48
|
-
}
|
|
49
|
-
prependOnceListener(e, t) {
|
|
50
|
-
let r = (...s) => {
|
|
51
|
-
this.off(e, r), t(...s);
|
|
52
|
-
};
|
|
53
|
-
return this.prependListener(e, r), this;
|
|
54
|
-
}
|
|
55
|
-
maxListeners() {
|
|
56
|
-
return this._maxListeners;
|
|
57
|
-
}
|
|
58
|
-
addListener(e, t) {
|
|
59
|
-
return this.on(e, t), this;
|
|
60
|
-
}
|
|
61
|
-
on(e, t) {
|
|
62
|
-
this._eventListeners.has(e) || this._eventListeners.set(e, []);
|
|
63
|
-
let r = this._eventListeners.get(e);
|
|
64
|
-
return r && (r.length >= this._maxListeners && console.warn(`MaxListenersExceededWarning: Possible event memory leak detected. ${r.length + 1} ${e} listeners added. Use setMaxListeners() to increase limit.`),
|
|
65
|
-
r.push(t)), this;
|
|
66
|
-
}
|
|
67
|
-
removeListener(e, t) {
|
|
68
|
-
return this.off(e, t), this;
|
|
69
|
-
}
|
|
70
|
-
off(e, t) {
|
|
71
|
-
let r = this._eventListeners.get(e) ?? [], s = r.indexOf(t);
|
|
72
|
-
return s !== -1 && r.splice(s, 1), r.length === 0 && this._eventListeners.delete(e),
|
|
73
|
-
this;
|
|
74
|
-
}
|
|
75
|
-
emit(e, ...t) {
|
|
76
|
-
let r = !1, s = this._eventListeners.get(e);
|
|
77
|
-
if (s && s.length > 0) for (let e of s) e(...t), r = !0;
|
|
78
|
-
return r;
|
|
79
|
-
}
|
|
80
|
-
listeners(e) {
|
|
81
|
-
return this._eventListeners.get(e) ?? [];
|
|
82
|
-
}
|
|
83
|
-
removeAllListeners(e) {
|
|
84
|
-
return e ? this._eventListeners.delete(e) : this._eventListeners.clear(), this;
|
|
85
|
-
}
|
|
86
|
-
setMaxListeners(e) {
|
|
87
|
-
this._maxListeners = e;
|
|
88
|
-
for (let t of this._eventListeners.values()) t.length > e && t.splice(e);
|
|
89
|
-
}
|
|
90
|
-
getAllListeners() {
|
|
91
|
-
let e = new Array;
|
|
92
|
-
for (let t of this._eventListeners.values()) e = [ ...e, ...t ];
|
|
93
|
-
return e;
|
|
94
|
-
}
|
|
23
|
+
var o = (t => {
|
|
24
|
+
t["RedisClientNotConnectedThrown"] = "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.";
|
|
25
|
+
return t;
|
|
26
|
+
})(o || {});
|
|
27
|
+
|
|
28
|
+
var c = t => {
|
|
29
|
+
const e = Math.min(2 ** t * 100, 2e3);
|
|
30
|
+
const r = (Math.random() - .5) * 100;
|
|
31
|
+
return e + r;
|
|
95
32
|
};
|
|
96
33
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
set throwHookErrors(e) {
|
|
112
|
-
this._throwHookErrors = e;
|
|
113
|
-
}
|
|
114
|
-
get logger() {
|
|
115
|
-
return this._logger;
|
|
116
|
-
}
|
|
117
|
-
set logger(e) {
|
|
118
|
-
this._logger = e;
|
|
119
|
-
}
|
|
120
|
-
onHook(e, t) {
|
|
121
|
-
let r = this._hooks.get(e);
|
|
122
|
-
r ? r.push(t) : this._hooks.set(e, [ t ]);
|
|
123
|
-
}
|
|
124
|
-
addHook(e, t) {
|
|
125
|
-
this.onHook(e, t);
|
|
126
|
-
}
|
|
127
|
-
onHooks(e) {
|
|
128
|
-
for (let t of e) this.onHook(t.event, t.handler);
|
|
129
|
-
}
|
|
130
|
-
prependHook(e, t) {
|
|
131
|
-
let r = this._hooks.get(e);
|
|
132
|
-
r ? r.unshift(t) : this._hooks.set(e, [ t ]);
|
|
133
|
-
}
|
|
134
|
-
prependOnceHook(e, t) {
|
|
135
|
-
let r = async (...s) => (this.removeHook(e, r), t(...s));
|
|
136
|
-
this.prependHook(e, r);
|
|
137
|
-
}
|
|
138
|
-
onceHook(e, t) {
|
|
139
|
-
let r = async (...s) => (this.removeHook(e, r), t(...s));
|
|
140
|
-
this.onHook(e, r);
|
|
141
|
-
}
|
|
142
|
-
removeHook(e, t) {
|
|
143
|
-
let r = this._hooks.get(e);
|
|
144
|
-
if (r) {
|
|
145
|
-
let e = r.indexOf(t);
|
|
146
|
-
e !== -1 && r.splice(e, 1);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
removeHooks(e) {
|
|
150
|
-
for (let t of e) this.removeHook(t.event, t.handler);
|
|
151
|
-
}
|
|
152
|
-
async hook(e, ...t) {
|
|
153
|
-
let r = this._hooks.get(e);
|
|
154
|
-
if (r) for (let s of r) try {
|
|
155
|
-
await s(...t);
|
|
156
|
-
} catch (t) {
|
|
157
|
-
let r = `${e}: ${t.message}`;
|
|
158
|
-
if (this.emit("error", new Error(r)), this._logger && this._logger.error(r), this._throwHookErrors) throw new Error(r);
|
|
34
|
+
function a(t, e) {
|
|
35
|
+
t ??= "redis://localhost:6379";
|
|
36
|
+
const r = new l(t, e);
|
|
37
|
+
if (e?.namespace) {
|
|
38
|
+
r.namespace = e.namespace;
|
|
39
|
+
const t = new s.Keyv(r, {
|
|
40
|
+
namespace: e?.namespace,
|
|
41
|
+
useKeyPrefix: false
|
|
42
|
+
});
|
|
43
|
+
if (e?.throwOnConnectError) {
|
|
44
|
+
t.throwOnErrors = true;
|
|
45
|
+
}
|
|
46
|
+
if (e?.throwOnErrors) {
|
|
47
|
+
t.throwOnErrors = true;
|
|
159
48
|
}
|
|
49
|
+
return t;
|
|
160
50
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
51
|
+
const i = new s.Keyv(r, {
|
|
52
|
+
useKeyPrefix: false
|
|
53
|
+
});
|
|
54
|
+
if (e?.throwOnConnectError) {
|
|
55
|
+
i.throwOnErrors = true;
|
|
166
56
|
}
|
|
167
|
-
|
|
168
|
-
|
|
57
|
+
if (e?.throwOnErrors) {
|
|
58
|
+
i.throwOnErrors = true;
|
|
169
59
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
e["RedisClientNotConnectedThrown"] = "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.";
|
|
174
|
-
return e;
|
|
175
|
-
})(a || {});
|
|
60
|
+
i.namespace = void 0;
|
|
61
|
+
return i;
|
|
62
|
+
}
|
|
176
63
|
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
64
|
+
function h(t, e) {
|
|
65
|
+
const r = a(t, e);
|
|
66
|
+
const s = r.store;
|
|
67
|
+
s.throwOnConnectError = false;
|
|
68
|
+
s.throwOnErrors = false;
|
|
69
|
+
const i = s.client;
|
|
70
|
+
if (i.options) {
|
|
71
|
+
i.options.disableOfflineQueue = true;
|
|
72
|
+
if (i.options.socket) {
|
|
73
|
+
i.options.socket.reconnectStrategy = false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
r.throwOnErrors = false;
|
|
77
|
+
return r;
|
|
78
|
+
}
|
|
182
79
|
|
|
183
|
-
var
|
|
184
|
-
_client=
|
|
80
|
+
var l = class extends r.Hookified {
|
|
81
|
+
_client=t.createClient();
|
|
185
82
|
_namespace;
|
|
186
83
|
_keyPrefixSeparator="::";
|
|
187
84
|
_clearBatchSize=1e3;
|
|
188
85
|
_useUnlink=true;
|
|
189
86
|
_noNamespaceAffectsAll=false;
|
|
190
87
|
_throwOnConnectError=true;
|
|
191
|
-
|
|
88
|
+
_throwOnErrors=false;
|
|
192
89
|
_connectionTimeout;
|
|
193
|
-
constructor(
|
|
90
|
+
constructor(e, r) {
|
|
194
91
|
super();
|
|
195
92
|
const s = {
|
|
196
93
|
reconnectStrategy: c
|
|
197
94
|
};
|
|
198
|
-
if (
|
|
199
|
-
if (typeof
|
|
200
|
-
this._client =
|
|
201
|
-
url:
|
|
95
|
+
if (e) {
|
|
96
|
+
if (typeof e === "string") {
|
|
97
|
+
this._client = t.createClient({
|
|
98
|
+
url: e,
|
|
202
99
|
socket: s
|
|
203
100
|
});
|
|
204
|
-
} else if (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
101
|
+
} else if (e.connect !== void 0) {
|
|
102
|
+
if (this.isClientSentinel(e)) {
|
|
103
|
+
this._client = e;
|
|
104
|
+
} else if (this.isClientCluster(e)) {
|
|
105
|
+
this._client = e;
|
|
106
|
+
} else {
|
|
107
|
+
this._client = e;
|
|
108
|
+
}
|
|
109
|
+
} else if (e instanceof Object) {
|
|
110
|
+
if (e.sentinelRootNodes !== void 0) {
|
|
111
|
+
this._client = t.createSentinel(e);
|
|
112
|
+
} else if (e.rootNodes === void 0) {
|
|
113
|
+
this._client = t.createClient(e);
|
|
114
|
+
} else {
|
|
115
|
+
this._client = t.createCluster(e);
|
|
116
|
+
}
|
|
208
117
|
}
|
|
209
118
|
}
|
|
210
119
|
this.setOptions(r);
|
|
@@ -213,53 +122,53 @@ var h = class extends o {
|
|
|
213
122
|
get client() {
|
|
214
123
|
return this._client;
|
|
215
124
|
}
|
|
216
|
-
set client(
|
|
217
|
-
this._client =
|
|
125
|
+
set client(t) {
|
|
126
|
+
this._client = t;
|
|
218
127
|
this.initClient();
|
|
219
128
|
}
|
|
220
129
|
get opts() {
|
|
221
|
-
let
|
|
130
|
+
let t = "redis://localhost:6379";
|
|
222
131
|
if (this._client.options) {
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
|
|
132
|
+
const e = this._client.options?.url;
|
|
133
|
+
if (e) {
|
|
134
|
+
t = e;
|
|
226
135
|
}
|
|
227
136
|
}
|
|
228
|
-
const
|
|
137
|
+
const e = {
|
|
229
138
|
namespace: this._namespace,
|
|
230
139
|
keyPrefixSeparator: this._keyPrefixSeparator,
|
|
231
140
|
clearBatchSize: this._clearBatchSize,
|
|
232
141
|
noNamespaceAffectsAll: this._noNamespaceAffectsAll,
|
|
233
142
|
useUnlink: this._useUnlink,
|
|
234
143
|
throwOnConnectError: this._throwOnConnectError,
|
|
235
|
-
|
|
144
|
+
throwOnErrors: this._throwOnErrors,
|
|
236
145
|
connectionTimeout: this._connectionTimeout,
|
|
237
146
|
dialect: "redis",
|
|
238
|
-
url:
|
|
147
|
+
url: t
|
|
239
148
|
};
|
|
240
|
-
return
|
|
149
|
+
return e;
|
|
241
150
|
}
|
|
242
|
-
set opts(
|
|
243
|
-
this.setOptions(
|
|
151
|
+
set opts(t) {
|
|
152
|
+
this.setOptions(t);
|
|
244
153
|
}
|
|
245
154
|
get namespace() {
|
|
246
155
|
return this._namespace;
|
|
247
156
|
}
|
|
248
|
-
set namespace(
|
|
249
|
-
this._namespace =
|
|
157
|
+
set namespace(t) {
|
|
158
|
+
this._namespace = t;
|
|
250
159
|
}
|
|
251
160
|
get keyPrefixSeparator() {
|
|
252
161
|
return this._keyPrefixSeparator;
|
|
253
162
|
}
|
|
254
|
-
set keyPrefixSeparator(
|
|
255
|
-
this._keyPrefixSeparator =
|
|
163
|
+
set keyPrefixSeparator(t) {
|
|
164
|
+
this._keyPrefixSeparator = t;
|
|
256
165
|
}
|
|
257
166
|
get clearBatchSize() {
|
|
258
167
|
return this._clearBatchSize;
|
|
259
168
|
}
|
|
260
|
-
set clearBatchSize(
|
|
261
|
-
if (
|
|
262
|
-
this._clearBatchSize =
|
|
169
|
+
set clearBatchSize(t) {
|
|
170
|
+
if (t > 0) {
|
|
171
|
+
this._clearBatchSize = t;
|
|
263
172
|
} else {
|
|
264
173
|
this.emit("error", "clearBatchSize must be greater than 0");
|
|
265
174
|
}
|
|
@@ -267,32 +176,32 @@ var h = class extends o {
|
|
|
267
176
|
get useUnlink() {
|
|
268
177
|
return this._useUnlink;
|
|
269
178
|
}
|
|
270
|
-
set useUnlink(
|
|
271
|
-
this._useUnlink =
|
|
179
|
+
set useUnlink(t) {
|
|
180
|
+
this._useUnlink = t;
|
|
272
181
|
}
|
|
273
182
|
get noNamespaceAffectsAll() {
|
|
274
183
|
return this._noNamespaceAffectsAll;
|
|
275
184
|
}
|
|
276
|
-
set noNamespaceAffectsAll(
|
|
277
|
-
this._noNamespaceAffectsAll =
|
|
185
|
+
set noNamespaceAffectsAll(t) {
|
|
186
|
+
this._noNamespaceAffectsAll = t;
|
|
278
187
|
}
|
|
279
188
|
get throwOnConnectError() {
|
|
280
189
|
return this._throwOnConnectError;
|
|
281
190
|
}
|
|
282
|
-
set throwOnConnectError(
|
|
283
|
-
this._throwOnConnectError =
|
|
191
|
+
set throwOnConnectError(t) {
|
|
192
|
+
this._throwOnConnectError = t;
|
|
284
193
|
}
|
|
285
|
-
get
|
|
286
|
-
return this.
|
|
194
|
+
get throwOnErrors() {
|
|
195
|
+
return this._throwOnErrors;
|
|
287
196
|
}
|
|
288
|
-
set
|
|
289
|
-
this.
|
|
197
|
+
set throwOnErrors(t) {
|
|
198
|
+
this._throwOnErrors = t;
|
|
290
199
|
}
|
|
291
200
|
get connectionTimeout() {
|
|
292
201
|
return this._connectionTimeout;
|
|
293
202
|
}
|
|
294
|
-
set connectionTimeout(
|
|
295
|
-
this._connectionTimeout =
|
|
203
|
+
set connectionTimeout(t) {
|
|
204
|
+
this._connectionTimeout = t;
|
|
296
205
|
}
|
|
297
206
|
async getClient() {
|
|
298
207
|
if (this._client.isOpen) {
|
|
@@ -304,214 +213,292 @@ var h = class extends o {
|
|
|
304
213
|
} else {
|
|
305
214
|
await Promise.race([ this._client.connect(), this.createTimeoutPromise(this._connectionTimeout) ]);
|
|
306
215
|
}
|
|
307
|
-
} catch (
|
|
308
|
-
this.emit("error",
|
|
216
|
+
} catch (t) {
|
|
217
|
+
this.emit("error", t);
|
|
218
|
+
await this.disconnect(true);
|
|
309
219
|
if (this._throwOnConnectError) {
|
|
310
220
|
throw new Error("Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.");
|
|
311
221
|
}
|
|
312
|
-
await this.disconnect(true);
|
|
313
222
|
}
|
|
314
223
|
this.initClient();
|
|
315
224
|
return this._client;
|
|
316
225
|
}
|
|
317
|
-
async set(
|
|
226
|
+
async set(t, e, r) {
|
|
318
227
|
const s = await this.getClient();
|
|
319
228
|
try {
|
|
320
|
-
|
|
229
|
+
t = this.createKeyPrefix(t, this._namespace);
|
|
321
230
|
if (r) {
|
|
322
|
-
await s.set(
|
|
231
|
+
await s.set(t, e, {
|
|
323
232
|
PX: r
|
|
324
233
|
});
|
|
325
234
|
} else {
|
|
326
|
-
await s.set(
|
|
235
|
+
await s.set(t, e);
|
|
327
236
|
}
|
|
328
|
-
} catch (
|
|
329
|
-
this.emit("error",
|
|
330
|
-
if (this.
|
|
331
|
-
throw
|
|
237
|
+
} catch (t) {
|
|
238
|
+
this.emit("error", t);
|
|
239
|
+
if (this._throwOnErrors) {
|
|
240
|
+
throw t;
|
|
332
241
|
}
|
|
333
242
|
}
|
|
334
243
|
}
|
|
335
|
-
async setMany(
|
|
336
|
-
const t = await this.getClient();
|
|
244
|
+
async setMany(t) {
|
|
337
245
|
try {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
const e =
|
|
341
|
-
|
|
342
|
-
r.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
246
|
+
if (this.isCluster()) {
|
|
247
|
+
await this.getClient();
|
|
248
|
+
const e = new Map;
|
|
249
|
+
for (const r of t) {
|
|
250
|
+
const t = this.createKeyPrefix(r.key, this._namespace);
|
|
251
|
+
const s = n.default(t);
|
|
252
|
+
const i = e.get(s) ?? [];
|
|
253
|
+
i.push(r);
|
|
254
|
+
e.set(s, i);
|
|
255
|
+
}
|
|
256
|
+
await Promise.all(Array.from(e.entries(), (async ([t, e]) => {
|
|
257
|
+
const r = await this.getSlotMaster(t);
|
|
258
|
+
const s = r.multi();
|
|
259
|
+
for (const {key: t, value: r, ttl: i} of e) {
|
|
260
|
+
const e = this.createKeyPrefix(t, this._namespace);
|
|
261
|
+
if (i) {
|
|
262
|
+
s.set(e, r, {
|
|
263
|
+
PX: i
|
|
264
|
+
});
|
|
265
|
+
} else {
|
|
266
|
+
s.set(e, r);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
await s.exec();
|
|
270
|
+
})));
|
|
271
|
+
} else {
|
|
272
|
+
const e = await this.getClient();
|
|
273
|
+
const r = e.multi();
|
|
274
|
+
for (const {key: e, value: s, ttl: i} of t) {
|
|
275
|
+
const t = this.createKeyPrefix(e, this._namespace);
|
|
276
|
+
if (i) {
|
|
277
|
+
r.set(t, s, {
|
|
278
|
+
PX: i
|
|
279
|
+
});
|
|
280
|
+
} else {
|
|
281
|
+
r.set(t, s);
|
|
282
|
+
}
|
|
347
283
|
}
|
|
284
|
+
await r.exec();
|
|
348
285
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
this.
|
|
352
|
-
|
|
353
|
-
|
|
286
|
+
} catch (t) {
|
|
287
|
+
this.emit("error", t);
|
|
288
|
+
if (this._throwOnConnectError && t.message === "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.") {
|
|
289
|
+
throw t;
|
|
290
|
+
}
|
|
291
|
+
if (this._throwOnErrors) {
|
|
292
|
+
throw t;
|
|
354
293
|
}
|
|
355
294
|
}
|
|
356
295
|
}
|
|
357
|
-
async has(
|
|
358
|
-
const
|
|
296
|
+
async has(t) {
|
|
297
|
+
const e = await this.getClient();
|
|
359
298
|
try {
|
|
360
|
-
|
|
361
|
-
const r = await
|
|
299
|
+
t = this.createKeyPrefix(t, this._namespace);
|
|
300
|
+
const r = await e.exists(t);
|
|
362
301
|
return r === 1;
|
|
363
|
-
} catch (
|
|
364
|
-
this.emit("error",
|
|
365
|
-
if (this.
|
|
366
|
-
throw
|
|
302
|
+
} catch (t) {
|
|
303
|
+
this.emit("error", t);
|
|
304
|
+
if (this._throwOnErrors) {
|
|
305
|
+
throw t;
|
|
367
306
|
}
|
|
368
307
|
return false;
|
|
369
308
|
}
|
|
370
309
|
}
|
|
371
|
-
async hasMany(
|
|
372
|
-
const t = await this.getClient();
|
|
310
|
+
async hasMany(t) {
|
|
373
311
|
try {
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
r
|
|
312
|
+
const e = t.map((t => this.createKeyPrefix(t, this._namespace)));
|
|
313
|
+
if (this.isCluster()) {
|
|
314
|
+
const t = this.getSlotMap(e);
|
|
315
|
+
const r = new Map;
|
|
316
|
+
await Promise.all(Array.from(t.entries(), (async ([t, e]) => {
|
|
317
|
+
const s = await this.getSlotMaster(t);
|
|
318
|
+
const i = s.multi();
|
|
319
|
+
for (const t of e) {
|
|
320
|
+
i.exists(t);
|
|
321
|
+
}
|
|
322
|
+
const n = await i.exec();
|
|
323
|
+
for (const [t, s] of n.entries()) {
|
|
324
|
+
r.set(e[t], typeof s === "number" && s === 1);
|
|
325
|
+
}
|
|
326
|
+
})));
|
|
327
|
+
return e.map((t => r.get(t) ?? false));
|
|
328
|
+
} else {
|
|
329
|
+
const t = await this.getClient();
|
|
330
|
+
const r = t.multi();
|
|
331
|
+
for (const t of e) {
|
|
332
|
+
r.exists(t);
|
|
333
|
+
}
|
|
334
|
+
const s = await r.exec();
|
|
335
|
+
return s.map((t => typeof t === "number" && t === 1));
|
|
378
336
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
337
|
+
} catch (e) {
|
|
338
|
+
this.emit("error", e);
|
|
339
|
+
if (this._throwOnConnectError && e.message === "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.") {
|
|
340
|
+
throw e;
|
|
341
|
+
}
|
|
342
|
+
if (this._throwOnErrors) {
|
|
343
|
+
throw e;
|
|
385
344
|
}
|
|
386
345
|
return Array.from({
|
|
387
|
-
length:
|
|
346
|
+
length: t.length
|
|
388
347
|
}).fill(false);
|
|
389
348
|
}
|
|
390
349
|
}
|
|
391
|
-
async get(
|
|
392
|
-
const
|
|
350
|
+
async get(t) {
|
|
351
|
+
const e = await this.getClient();
|
|
393
352
|
try {
|
|
394
|
-
|
|
395
|
-
const r = await
|
|
353
|
+
t = this.createKeyPrefix(t, this._namespace);
|
|
354
|
+
const r = await e.get(t);
|
|
396
355
|
if (r === null) {
|
|
397
356
|
return void 0;
|
|
398
357
|
}
|
|
399
358
|
return r;
|
|
400
|
-
} catch (
|
|
401
|
-
this.emit("error",
|
|
402
|
-
if (this.
|
|
403
|
-
throw
|
|
359
|
+
} catch (t) {
|
|
360
|
+
this.emit("error", t);
|
|
361
|
+
if (this._throwOnErrors) {
|
|
362
|
+
throw t;
|
|
404
363
|
}
|
|
405
364
|
return void 0;
|
|
406
365
|
}
|
|
407
366
|
}
|
|
408
|
-
async getMany(
|
|
409
|
-
if (
|
|
367
|
+
async getMany(t) {
|
|
368
|
+
if (t.length === 0) {
|
|
410
369
|
return [];
|
|
411
370
|
}
|
|
412
|
-
|
|
371
|
+
t = t.map((t => this.createKeyPrefix(t, this._namespace)));
|
|
413
372
|
try {
|
|
414
|
-
const
|
|
415
|
-
return
|
|
416
|
-
} catch (
|
|
417
|
-
this.emit("error",
|
|
418
|
-
if (this.
|
|
419
|
-
throw
|
|
373
|
+
const e = await this.mget(t);
|
|
374
|
+
return e;
|
|
375
|
+
} catch (e) {
|
|
376
|
+
this.emit("error", e);
|
|
377
|
+
if (this._throwOnErrors) {
|
|
378
|
+
throw e;
|
|
420
379
|
}
|
|
421
380
|
return Array.from({
|
|
422
|
-
length:
|
|
381
|
+
length: t.length
|
|
423
382
|
}).fill(void 0);
|
|
424
383
|
}
|
|
425
384
|
}
|
|
426
|
-
async delete(
|
|
427
|
-
const
|
|
385
|
+
async delete(t) {
|
|
386
|
+
const e = await this.getClient();
|
|
428
387
|
try {
|
|
429
|
-
|
|
388
|
+
t = this.createKeyPrefix(t, this._namespace);
|
|
430
389
|
let r = 0;
|
|
431
|
-
r = await (this._useUnlink ?
|
|
390
|
+
r = await (this._useUnlink ? e.unlink(t) : e.del(t));
|
|
432
391
|
return r > 0;
|
|
433
|
-
} catch (
|
|
434
|
-
this.emit("error",
|
|
435
|
-
if (this.
|
|
436
|
-
throw
|
|
392
|
+
} catch (t) {
|
|
393
|
+
this.emit("error", t);
|
|
394
|
+
if (this._throwOnErrors) {
|
|
395
|
+
throw t;
|
|
437
396
|
}
|
|
438
397
|
return false;
|
|
439
398
|
}
|
|
440
399
|
}
|
|
441
|
-
async deleteMany(
|
|
442
|
-
let
|
|
443
|
-
const r = await this.getClient();
|
|
400
|
+
async deleteMany(t) {
|
|
401
|
+
let e = false;
|
|
444
402
|
try {
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
s.
|
|
450
|
-
|
|
451
|
-
|
|
403
|
+
const r = t.map((t => this.createKeyPrefix(t, this._namespace)));
|
|
404
|
+
if (this.isCluster()) {
|
|
405
|
+
const t = this.getSlotMap(r);
|
|
406
|
+
await Promise.all(Array.from(t.entries(), (async ([t, r]) => {
|
|
407
|
+
const s = await this.getSlotMaster(t);
|
|
408
|
+
const i = s.multi();
|
|
409
|
+
for (const t of r) {
|
|
410
|
+
if (this._useUnlink) {
|
|
411
|
+
i.unlink(t);
|
|
412
|
+
} else {
|
|
413
|
+
i.del(t);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
const n = await i.exec();
|
|
417
|
+
for (const t of n) {
|
|
418
|
+
if (typeof t === "number" && t > 0) {
|
|
419
|
+
e = true;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
})));
|
|
423
|
+
} else {
|
|
424
|
+
const t = await this.getClient();
|
|
425
|
+
const s = t.multi();
|
|
426
|
+
for (const t of r) {
|
|
427
|
+
if (this._useUnlink) {
|
|
428
|
+
s.unlink(t);
|
|
429
|
+
} else {
|
|
430
|
+
s.del(t);
|
|
431
|
+
}
|
|
452
432
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
433
|
+
const i = await s.exec();
|
|
434
|
+
for (const t of i) {
|
|
435
|
+
if (typeof t === "number" && t > 0) {
|
|
436
|
+
e = true;
|
|
437
|
+
}
|
|
458
438
|
}
|
|
459
439
|
}
|
|
460
|
-
} catch (
|
|
461
|
-
this.emit("error",
|
|
462
|
-
if (this.
|
|
463
|
-
throw
|
|
440
|
+
} catch (t) {
|
|
441
|
+
this.emit("error", t);
|
|
442
|
+
if (this._throwOnConnectError && t.message === "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.") {
|
|
443
|
+
throw t;
|
|
444
|
+
}
|
|
445
|
+
if (this._throwOnErrors) {
|
|
446
|
+
throw t;
|
|
464
447
|
}
|
|
465
448
|
}
|
|
466
|
-
return
|
|
449
|
+
return e;
|
|
467
450
|
}
|
|
468
|
-
async disconnect(
|
|
451
|
+
async disconnect(t) {
|
|
469
452
|
if (this._client.isOpen) {
|
|
470
|
-
await (
|
|
453
|
+
await (t ? this._client.destroy() : this._client.close());
|
|
471
454
|
}
|
|
472
455
|
}
|
|
473
|
-
createKeyPrefix(
|
|
474
|
-
if (
|
|
475
|
-
return `${
|
|
456
|
+
createKeyPrefix(t, e) {
|
|
457
|
+
if (e) {
|
|
458
|
+
return `${e}${this._keyPrefixSeparator}${t}`;
|
|
476
459
|
}
|
|
477
|
-
return
|
|
460
|
+
return t;
|
|
478
461
|
}
|
|
479
|
-
getKeyWithoutPrefix(
|
|
480
|
-
if (
|
|
481
|
-
return
|
|
462
|
+
getKeyWithoutPrefix(t, e) {
|
|
463
|
+
if (e) {
|
|
464
|
+
return t.replace(`${e}${this._keyPrefixSeparator}`, "");
|
|
482
465
|
}
|
|
483
|
-
return
|
|
466
|
+
return t;
|
|
484
467
|
}
|
|
485
468
|
isCluster() {
|
|
486
469
|
return this.isClientCluster(this._client);
|
|
487
470
|
}
|
|
471
|
+
isSentinel() {
|
|
472
|
+
return this.isClientSentinel(this._client);
|
|
473
|
+
}
|
|
488
474
|
async getMasterNodes() {
|
|
489
475
|
if (this.isCluster()) {
|
|
490
|
-
const
|
|
491
|
-
|
|
476
|
+
const t = await this.getClient();
|
|
477
|
+
const e = t.masters.map((async e => t.nodeClient(e)));
|
|
478
|
+
return Promise.all(e);
|
|
492
479
|
}
|
|
493
480
|
return [ await this.getClient() ];
|
|
494
481
|
}
|
|
495
|
-
async* iterator(
|
|
496
|
-
const
|
|
497
|
-
for (const r of
|
|
498
|
-
const
|
|
482
|
+
async* iterator(t) {
|
|
483
|
+
const e = await this.getMasterNodes();
|
|
484
|
+
for (const r of e) {
|
|
485
|
+
const e = t ? `${t}${this._keyPrefixSeparator}*` : "*";
|
|
499
486
|
let s = "0";
|
|
500
487
|
do {
|
|
501
|
-
const i = await r.scan(
|
|
502
|
-
MATCH:
|
|
488
|
+
const i = await r.scan(s, {
|
|
489
|
+
MATCH: e,
|
|
503
490
|
TYPE: "string"
|
|
504
491
|
});
|
|
505
492
|
s = i.cursor.toString();
|
|
506
493
|
let {keys: n} = i;
|
|
507
|
-
if (!
|
|
508
|
-
n = n.filter((
|
|
494
|
+
if (!t && !this._noNamespaceAffectsAll) {
|
|
495
|
+
n = n.filter((t => !t.includes(this._keyPrefixSeparator)));
|
|
509
496
|
}
|
|
510
497
|
if (n.length > 0) {
|
|
511
|
-
const
|
|
498
|
+
const e = await this.mget(n);
|
|
512
499
|
for (const r of n.keys()) {
|
|
513
|
-
const s = this.getKeyWithoutPrefix(n[r],
|
|
514
|
-
const i =
|
|
500
|
+
const s = this.getKeyWithoutPrefix(n[r], t);
|
|
501
|
+
const i = e[r];
|
|
515
502
|
yield [ s, i ];
|
|
516
503
|
}
|
|
517
504
|
}
|
|
@@ -520,115 +507,123 @@ var h = class extends o {
|
|
|
520
507
|
}
|
|
521
508
|
async clear() {
|
|
522
509
|
try {
|
|
523
|
-
const
|
|
524
|
-
await Promise.all(
|
|
510
|
+
const t = await this.getMasterNodes();
|
|
511
|
+
await Promise.all(t.map((async t => {
|
|
525
512
|
if (!this._namespace && this._noNamespaceAffectsAll) {
|
|
526
|
-
await
|
|
513
|
+
await t.flushDb();
|
|
527
514
|
return;
|
|
528
515
|
}
|
|
529
|
-
let
|
|
516
|
+
let e = "0";
|
|
530
517
|
const r = this._clearBatchSize;
|
|
531
518
|
const s = this._namespace ? `${this._namespace}${this._keyPrefixSeparator}*` : "*";
|
|
532
519
|
const i = [];
|
|
533
520
|
do {
|
|
534
|
-
const n = await
|
|
521
|
+
const n = await t.scan(e, {
|
|
535
522
|
MATCH: s,
|
|
536
523
|
COUNT: r,
|
|
537
524
|
TYPE: "string"
|
|
538
525
|
});
|
|
539
|
-
|
|
526
|
+
e = n.cursor.toString();
|
|
540
527
|
let {keys: o} = n;
|
|
541
528
|
if (o.length === 0) {
|
|
542
529
|
continue;
|
|
543
530
|
}
|
|
544
531
|
if (!this._namespace) {
|
|
545
|
-
o = o.filter((
|
|
532
|
+
o = o.filter((t => !t.includes(this._keyPrefixSeparator)));
|
|
546
533
|
}
|
|
547
534
|
i.push(this.clearWithClusterSupport(o));
|
|
548
|
-
} while (
|
|
535
|
+
} while (e !== "0");
|
|
549
536
|
await Promise.all(i);
|
|
550
537
|
})));
|
|
551
|
-
} catch (
|
|
552
|
-
this.emit("error",
|
|
538
|
+
} catch (t) {
|
|
539
|
+
this.emit("error", t);
|
|
553
540
|
}
|
|
554
541
|
}
|
|
555
|
-
async mget(
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
542
|
+
async mget(t) {
|
|
543
|
+
const e = new Map;
|
|
544
|
+
if (this.isCluster()) {
|
|
545
|
+
const r = this.getSlotMap(t);
|
|
546
|
+
await Promise.all(Array.from(r.entries(), (async ([t, r]) => {
|
|
547
|
+
const s = await this.getSlotMaster(t);
|
|
548
|
+
const i = await s.mGet(r);
|
|
549
|
+
for (const [t, s] of i.entries()) {
|
|
550
|
+
e.set(r[t], s ?? void 0);
|
|
551
|
+
}
|
|
552
|
+
})));
|
|
553
|
+
} else {
|
|
554
|
+
const r = await this.getClient();
|
|
555
|
+
const s = await r.mGet(t);
|
|
556
|
+
for (const [r, i] of s.entries()) {
|
|
557
|
+
e.set(t[r], i ?? void 0);
|
|
563
558
|
}
|
|
564
|
-
}
|
|
565
|
-
return
|
|
566
|
-
}
|
|
567
|
-
async clearWithClusterSupport(
|
|
568
|
-
if (
|
|
569
|
-
const
|
|
570
|
-
await Promise.all(Array.from(
|
|
571
|
-
const r = await this.getSlotMaster(
|
|
572
|
-
return this._useUnlink ? r.unlink(
|
|
559
|
+
}
|
|
560
|
+
return t.map((t => e.get(t)));
|
|
561
|
+
}
|
|
562
|
+
async clearWithClusterSupport(t) {
|
|
563
|
+
if (t.length > 0) {
|
|
564
|
+
const e = this.getSlotMap(t);
|
|
565
|
+
await Promise.all(Array.from(e.entries(), (async ([t, e]) => {
|
|
566
|
+
const r = await this.getSlotMaster(t);
|
|
567
|
+
return this._useUnlink ? r.unlink(e) : r.del(e);
|
|
573
568
|
})));
|
|
574
569
|
}
|
|
575
570
|
}
|
|
576
|
-
async getSlotMaster(
|
|
577
|
-
const
|
|
571
|
+
async getSlotMaster(t) {
|
|
572
|
+
const e = await this.getClient();
|
|
578
573
|
if (this.isCluster()) {
|
|
579
|
-
const r =
|
|
580
|
-
const s = r.slots[
|
|
574
|
+
const r = e;
|
|
575
|
+
const s = r.slots[t].master;
|
|
581
576
|
return r.nodeClient(s);
|
|
582
577
|
}
|
|
583
|
-
return
|
|
578
|
+
return e;
|
|
584
579
|
}
|
|
585
|
-
getSlotMap(
|
|
586
|
-
const
|
|
580
|
+
getSlotMap(t) {
|
|
581
|
+
const e = new Map;
|
|
587
582
|
if (this.isCluster()) {
|
|
588
|
-
for (const r of
|
|
589
|
-
const
|
|
590
|
-
const s =
|
|
583
|
+
for (const r of t) {
|
|
584
|
+
const t = n.default(r);
|
|
585
|
+
const s = e.get(t) ?? [];
|
|
591
586
|
s.push(r);
|
|
592
|
-
|
|
587
|
+
e.set(t, s);
|
|
593
588
|
}
|
|
594
589
|
} else {
|
|
595
|
-
|
|
590
|
+
e.set(0, t);
|
|
596
591
|
}
|
|
597
|
-
return
|
|
592
|
+
return e;
|
|
598
593
|
}
|
|
599
|
-
isClientCluster(
|
|
600
|
-
|
|
601
|
-
return true;
|
|
602
|
-
}
|
|
603
|
-
return false;
|
|
594
|
+
isClientCluster(t) {
|
|
595
|
+
return t.slots !== void 0;
|
|
604
596
|
}
|
|
605
|
-
|
|
606
|
-
|
|
597
|
+
isClientSentinel(t) {
|
|
598
|
+
return t.getSentinelNode !== void 0;
|
|
599
|
+
}
|
|
600
|
+
setOptions(t) {
|
|
601
|
+
if (!t) {
|
|
607
602
|
return;
|
|
608
603
|
}
|
|
609
|
-
if (
|
|
610
|
-
this._namespace =
|
|
604
|
+
if (t.namespace) {
|
|
605
|
+
this._namespace = t.namespace;
|
|
611
606
|
}
|
|
612
|
-
if (
|
|
613
|
-
this._keyPrefixSeparator =
|
|
607
|
+
if (t.keyPrefixSeparator !== void 0) {
|
|
608
|
+
this._keyPrefixSeparator = t.keyPrefixSeparator;
|
|
614
609
|
}
|
|
615
|
-
if (
|
|
616
|
-
this._clearBatchSize =
|
|
610
|
+
if (t.clearBatchSize !== void 0 && t.clearBatchSize > 0) {
|
|
611
|
+
this._clearBatchSize = t.clearBatchSize;
|
|
617
612
|
}
|
|
618
|
-
if (
|
|
619
|
-
this._useUnlink =
|
|
613
|
+
if (t.useUnlink !== void 0) {
|
|
614
|
+
this._useUnlink = t.useUnlink;
|
|
620
615
|
}
|
|
621
|
-
if (
|
|
622
|
-
this._noNamespaceAffectsAll =
|
|
616
|
+
if (t.noNamespaceAffectsAll !== void 0) {
|
|
617
|
+
this._noNamespaceAffectsAll = t.noNamespaceAffectsAll;
|
|
623
618
|
}
|
|
624
|
-
if (
|
|
625
|
-
this._throwOnConnectError =
|
|
619
|
+
if (t.throwOnConnectError !== void 0) {
|
|
620
|
+
this._throwOnConnectError = t.throwOnConnectError;
|
|
626
621
|
}
|
|
627
|
-
if (
|
|
628
|
-
this.
|
|
622
|
+
if (t.throwOnErrors !== void 0) {
|
|
623
|
+
this._throwOnErrors = t.throwOnErrors;
|
|
629
624
|
}
|
|
630
|
-
if (
|
|
631
|
-
this._connectionTimeout =
|
|
625
|
+
if (t.connectionTimeout !== void 0) {
|
|
626
|
+
this._connectionTimeout = t.connectionTimeout;
|
|
632
627
|
}
|
|
633
628
|
}
|
|
634
629
|
initClient() {
|
|
@@ -638,43 +633,40 @@ var h = class extends o {
|
|
|
638
633
|
this._client.on("disconnect", (() => {
|
|
639
634
|
this.emit("disconnect", this._client);
|
|
640
635
|
}));
|
|
641
|
-
this._client.on("reconnecting", (
|
|
642
|
-
this.emit("reconnecting",
|
|
636
|
+
this._client.on("reconnecting", (t => {
|
|
637
|
+
this.emit("reconnecting", t);
|
|
643
638
|
}));
|
|
644
639
|
}
|
|
645
|
-
async createTimeoutPromise(
|
|
646
|
-
return new Promise(((
|
|
647
|
-
r(new Error(`Redis timed out after ${
|
|
648
|
-
}),
|
|
640
|
+
async createTimeoutPromise(t) {
|
|
641
|
+
return new Promise(((e, r) => setTimeout((() => {
|
|
642
|
+
r(new Error(`Redis timed out after ${t}ms`));
|
|
643
|
+
}), t)));
|
|
649
644
|
}
|
|
650
645
|
};
|
|
651
646
|
|
|
652
|
-
function l(e, r) {
|
|
653
|
-
e ??= "redis://localhost:6379";
|
|
654
|
-
const s = new h(e, r);
|
|
655
|
-
const i = new t.Keyv(s, {
|
|
656
|
-
namespace: r?.namespace,
|
|
657
|
-
useKeyPrefix: false
|
|
658
|
-
});
|
|
659
|
-
return i;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
647
|
Object.defineProperty(exports, "createClient", {
|
|
663
648
|
enumerable: true,
|
|
664
|
-
get: () =>
|
|
649
|
+
get: () => t.createClient
|
|
665
650
|
});
|
|
666
651
|
|
|
667
652
|
Object.defineProperty(exports, "createCluster", {
|
|
668
653
|
enumerable: true,
|
|
669
|
-
get: () =>
|
|
654
|
+
get: () => t.createCluster
|
|
670
655
|
});
|
|
671
656
|
|
|
672
|
-
exports
|
|
657
|
+
Object.defineProperty(exports, "createSentinel", {
|
|
658
|
+
enumerable: true,
|
|
659
|
+
get: () => t.createSentinel
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
exports.Keyv = s.Keyv;
|
|
663
|
+
|
|
664
|
+
exports.RedisErrorMessages = o;
|
|
673
665
|
|
|
674
|
-
exports.
|
|
666
|
+
exports.createKeyv = a;
|
|
675
667
|
|
|
676
|
-
exports.
|
|
668
|
+
exports.createKeyvNonBlocking = h;
|
|
677
669
|
|
|
678
|
-
exports.default =
|
|
670
|
+
exports.default = l;
|
|
679
671
|
|
|
680
672
|
exports.defaultReconnectStrategy = c;
|