lakutata 2.0.81 → 2.0.83
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/docker.cjs +1 -1
- package/com/docker.mjs +1 -1
- package/decorator/orm.cjs +84 -84
- package/decorator/orm.mjs +42 -128
- package/orm.cjs +873 -1410
- package/orm.mjs +708 -1458
- package/package.json +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +230 -239
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +230 -239
- package/src/components/docker/ConnectionOptionsBuilder.cjs +1 -1
- package/src/components/docker/ConnectionOptionsBuilder.mjs +1 -1
- package/src/components/docker/Docker.cjs +4919 -4808
- package/src/components/docker/Docker.mjs +4939 -4828
- package/src/components/docker/lib/DockerContainer.cjs +1 -1
- package/src/components/docker/lib/DockerContainer.mjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.cjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.mjs +1 -1
- package/src/components/entrypoint/Entrypoint.cjs +1669 -2159
- package/src/components/entrypoint/Entrypoint.mjs +1629 -2119
- package/src/decorators/orm/AfterInsert.cjs +26 -4
- package/src/decorators/orm/AfterInsert.mjs +25 -5
- package/src/decorators/orm/AfterLoad.cjs +26 -4
- package/src/decorators/orm/AfterLoad.mjs +25 -5
- package/src/decorators/orm/AfterRecover.cjs +26 -4
- package/src/decorators/orm/AfterRecover.mjs +25 -5
- package/src/decorators/orm/AfterRemove.cjs +26 -4
- package/src/decorators/orm/AfterRemove.mjs +25 -5
- package/src/decorators/orm/AfterSoftRemove.cjs +26 -4
- package/src/decorators/orm/AfterSoftRemove.mjs +25 -5
- package/src/decorators/orm/AfterUpdate.cjs +26 -4
- package/src/decorators/orm/AfterUpdate.mjs +25 -5
- package/src/decorators/orm/BeforeInsert.cjs +26 -4
- package/src/decorators/orm/BeforeInsert.mjs +25 -5
- package/src/decorators/orm/BeforeRecover.cjs +26 -4
- package/src/decorators/orm/BeforeRecover.mjs +25 -5
- package/src/decorators/orm/BeforeRemove.cjs +26 -4
- package/src/decorators/orm/BeforeRemove.mjs +25 -5
- package/src/decorators/orm/BeforeSoftRemove.cjs +26 -4
- package/src/decorators/orm/BeforeSoftRemove.mjs +25 -5
- package/src/decorators/orm/BeforeUpdate.cjs +26 -4
- package/src/decorators/orm/BeforeUpdate.mjs +25 -5
- package/src/decorators/orm/Check.cjs +29 -4
- package/src/decorators/orm/Check.mjs +28 -5
- package/src/decorators/orm/ChildEntity.cjs +29 -4
- package/src/decorators/orm/ChildEntity.mjs +28 -5
- package/src/decorators/orm/Column.cjs +61 -4
- package/src/decorators/orm/Column.mjs +61 -6
- package/src/decorators/orm/CreateDateColumn.cjs +25 -4
- package/src/decorators/orm/CreateDateColumn.mjs +24 -5
- package/src/decorators/orm/DeleteDateColumn.cjs +25 -4
- package/src/decorators/orm/DeleteDateColumn.mjs +23 -4
- package/src/decorators/orm/Entity.cjs +35 -4
- package/src/decorators/orm/Entity.mjs +33 -4
- package/src/decorators/orm/EventSubscriber.cjs +22 -4
- package/src/decorators/orm/EventSubscriber.mjs +21 -5
- package/src/decorators/orm/Exclusion.cjs +29 -4
- package/src/decorators/orm/Exclusion.mjs +28 -5
- package/src/decorators/orm/Generated.cjs +24 -4
- package/src/decorators/orm/Generated.mjs +23 -5
- package/src/decorators/orm/Index.cjs +41 -4
- package/src/decorators/orm/Index.mjs +41 -6
- package/src/decorators/orm/JoinColumn.cjs +29 -4
- package/src/decorators/orm/JoinColumn.mjs +28 -5
- package/src/decorators/orm/JoinTable.cjs +30 -4
- package/src/decorators/orm/JoinTable.mjs +28 -4
- package/src/decorators/orm/ManyToMany.cjs +42 -4
- package/src/decorators/orm/ManyToMany.mjs +40 -4
- package/src/decorators/orm/ManyToOne.cjs +42 -4
- package/src/decorators/orm/ManyToOne.mjs +40 -4
- package/src/decorators/orm/ObjectIdColumn.cjs +28 -4
- package/src/decorators/orm/ObjectIdColumn.mjs +27 -5
- package/src/decorators/orm/OneToMany.cjs +34 -4
- package/src/decorators/orm/OneToMany.mjs +34 -6
- package/src/decorators/orm/OneToOne.cjs +42 -4
- package/src/decorators/orm/OneToOne.mjs +40 -4
- package/src/decorators/orm/PrimaryColumn.cjs +49 -4
- package/src/decorators/orm/PrimaryColumn.mjs +49 -6
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +54 -4
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +54 -6
- package/src/decorators/orm/RelationId.cjs +26 -4
- package/src/decorators/orm/RelationId.mjs +25 -5
- package/src/decorators/orm/TableInheritance.cjs +26 -4
- package/src/decorators/orm/TableInheritance.mjs +25 -5
- package/src/decorators/orm/Tree.cjs +24 -4
- package/src/decorators/orm/Tree.mjs +23 -5
- package/src/decorators/orm/TreeChildren.cjs +31 -4
- package/src/decorators/orm/TreeChildren.mjs +29 -4
- package/src/decorators/orm/TreeLevelColumn.cjs +25 -4
- package/src/decorators/orm/TreeLevelColumn.mjs +23 -4
- package/src/decorators/orm/TreeParent.cjs +31 -4
- package/src/decorators/orm/TreeParent.mjs +29 -4
- package/src/decorators/orm/Unique.cjs +44 -4
- package/src/decorators/orm/Unique.mjs +44 -6
- package/src/decorators/orm/UpdateDateColumn.cjs +25 -4
- package/src/decorators/orm/UpdateDateColumn.mjs +24 -5
- package/src/decorators/orm/VersionColumn.cjs +25 -4
- package/src/decorators/orm/VersionColumn.mjs +24 -5
- package/src/decorators/orm/ViewColumn.cjs +25 -4
- package/src/decorators/orm/ViewColumn.mjs +24 -5
- package/src/decorators/orm/ViewEntity.cjs +34 -4
- package/src/decorators/orm/ViewEntity.mjs +33 -5
- package/src/decorators/orm/VirtualColumn.cjs +42 -4
- package/src/decorators/orm/VirtualColumn.mjs +40 -4
- package/src/lib/base/EventEmitter.cjs +1193 -1200
- package/src/lib/base/EventEmitter.mjs +1194 -1201
- package/src/lib/base/internal/DataValidator.cjs +185 -174
- package/src/lib/base/internal/DataValidator.mjs +186 -175
- package/src/lib/base/internal/PatternManager.cjs +735 -740
- package/src/lib/base/internal/PatternManager.mjs +740 -745
- package/src/lib/core/Application.cjs +99 -112
- package/src/lib/core/Application.mjs +127 -140
- package/src/lib/helpers/IsHtml.cjs +13 -7
- package/src/lib/helpers/IsHtml.mjs +13 -7
- package/src/lib/helpers/IsXML.cjs +1016 -1158
- package/src/lib/helpers/IsXML.mjs +729 -871
- package/src/lib/helpers/ObjectHash.cjs +371 -378
- package/src/lib/helpers/ObjectHash.mjs +371 -378
- package/src/lib/helpers/RandomString.cjs +146 -167
- package/src/lib/helpers/RandomString.mjs +145 -166
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +350 -350
- package/src/lib/ioc/ListModules.cjs +5237 -5160
- package/src/lib/ioc/ListModules.mjs +5252 -5175
- package/src/lib/validation/VLD.cjs +3903 -4080
- package/src/lib/validation/VLD.mjs +2793 -2970
- package/src/providers/migration/GenerateMigration.cjs +2 -2
- package/src/providers/migration/GenerateMigration.mjs +2 -2
- package/vendor/Package.112.cjs +38321 -38240
- package/vendor/Package.112.mjs +37720 -37579
- package/vendor/Package.16.cjs +7386 -7268
- package/vendor/Package.16.mjs +6706 -6588
- package/vendor/Package.18.cjs +48229 -20
- package/vendor/Package.18.mjs +48192 -24
- package/vendor/Package.2.cjs +5698 -5727
- package/vendor/Package.2.mjs +5707 -5736
- package/vendor/Package.4.cjs +874 -884
- package/vendor/Package.4.mjs +874 -884
- package/vendor/Package.5.cjs +11 -15
- package/vendor/Package.5.mjs +7 -11
- package/vendor/Package.6.cjs +511 -520
- package/vendor/Package.6.mjs +534 -543
- package/vendor/Package.62.cjs +87 -90
- package/vendor/Package.62.mjs +180 -183
- package/vendor/Package.65.cjs +1285 -1292
- package/vendor/Package.65.mjs +190 -197
- package/vendor/Package.68.cjs +111 -252
- package/vendor/Package.68.mjs +134 -268
- package/vendor/Package.9.cjs +118 -132
- package/vendor/Package.9.mjs +124 -138
- package/vendor/TypeDef.internal.3.d.ts +0 -14
- package/vendor/Package.19.cjs +0 -37
- package/vendor/Package.19.mjs +0 -35
- package/vendor/Package.20.cjs +0 -37
- package/vendor/Package.20.mjs +0 -35
- package/vendor/Package.21.cjs +0 -37
- package/vendor/Package.21.mjs +0 -35
- package/vendor/Package.22.cjs +0 -37
- package/vendor/Package.22.mjs +0 -35
- package/vendor/Package.23.cjs +0 -37
- package/vendor/Package.23.mjs +0 -35
- package/vendor/Package.24.cjs +0 -37
- package/vendor/Package.24.mjs +0 -35
- package/vendor/Package.25.cjs +0 -37
- package/vendor/Package.25.mjs +0 -35
- package/vendor/Package.26.cjs +0 -37
- package/vendor/Package.26.mjs +0 -35
- package/vendor/Package.27.cjs +0 -37
- package/vendor/Package.27.mjs +0 -35
- package/vendor/Package.28.cjs +0 -37
- package/vendor/Package.28.mjs +0 -35
- package/vendor/Package.29.cjs +0 -40
- package/vendor/Package.29.mjs +0 -38
- package/vendor/Package.30.cjs +0 -41
- package/vendor/Package.30.mjs +0 -39
- package/vendor/Package.31.cjs +0 -72
- package/vendor/Package.31.mjs +0 -70
- package/vendor/Package.32.cjs +0 -37
- package/vendor/Package.32.mjs +0 -35
- package/vendor/Package.33.cjs +0 -37
- package/vendor/Package.33.mjs +0 -35
- package/vendor/Package.34.cjs +0 -46
- package/vendor/Package.34.mjs +0 -44
- package/vendor/Package.35.cjs +0 -34
- package/vendor/Package.35.mjs +0 -32
- package/vendor/Package.36.cjs +0 -40
- package/vendor/Package.36.mjs +0 -38
- package/vendor/Package.37.cjs +0 -36
- package/vendor/Package.37.mjs +0 -34
- package/vendor/Package.38.cjs +0 -52
- package/vendor/Package.38.mjs +0 -50
- package/vendor/Package.39.cjs +0 -41
- package/vendor/Package.39.mjs +0 -39
- package/vendor/Package.40.cjs +0 -42
- package/vendor/Package.40.mjs +0 -40
- package/vendor/Package.41.cjs +0 -53
- package/vendor/Package.41.mjs +0 -51
- package/vendor/Package.42.cjs +0 -53
- package/vendor/Package.42.mjs +0 -51
- package/vendor/Package.43.cjs +0 -40
- package/vendor/Package.43.mjs +0 -38
- package/vendor/Package.44.cjs +0 -46
- package/vendor/Package.44.mjs +0 -44
- package/vendor/Package.45.cjs +0 -53
- package/vendor/Package.45.mjs +0 -51
- package/vendor/Package.46.cjs +0 -59
- package/vendor/Package.46.mjs +0 -57
- package/vendor/Package.47.cjs +0 -65
- package/vendor/Package.47.mjs +0 -63
- package/vendor/Package.48.cjs +0 -38
- package/vendor/Package.48.mjs +0 -36
- package/vendor/Package.49.cjs +0 -38
- package/vendor/Package.49.mjs +0 -36
- package/vendor/Package.50.cjs +0 -36
- package/vendor/Package.50.mjs +0 -34
- package/vendor/Package.51.cjs +0 -43
- package/vendor/Package.51.mjs +0 -41
- package/vendor/Package.52.cjs +0 -37
- package/vendor/Package.52.mjs +0 -35
- package/vendor/Package.53.cjs +0 -43
- package/vendor/Package.53.mjs +0 -41
- package/vendor/Package.54.cjs +0 -55
- package/vendor/Package.54.mjs +0 -53
- package/vendor/Package.55.cjs +0 -37
- package/vendor/Package.55.mjs +0 -35
- package/vendor/Package.56.cjs +0 -37
- package/vendor/Package.56.mjs +0 -35
- package/vendor/Package.57.cjs +0 -37
- package/vendor/Package.57.mjs +0 -35
- package/vendor/Package.58.cjs +0 -45
- package/vendor/Package.58.mjs +0 -43
- package/vendor/Package.59.cjs +0 -53
- package/vendor/Package.59.mjs +0 -51
- package/vendor/Package.60.cjs +0 -47649
- package/vendor/Package.60.mjs +0 -47606
package/vendor/Package.68.mjs
CHANGED
|
@@ -1,73 +1,27 @@
|
|
|
1
|
-
import { createClient as t,
|
|
1
|
+
import { createClient as t, createCluster as e } from "@redis/client";
|
|
2
2
|
|
|
3
|
-
export { createClient, createCluster
|
|
4
|
-
|
|
5
|
-
import r from "cluster-key-slot";
|
|
3
|
+
export { createClient, createCluster } from "@redis/client";
|
|
6
4
|
|
|
7
5
|
import { H as i } from "./Package.66.mjs";
|
|
8
6
|
|
|
9
|
-
import { K as
|
|
7
|
+
import { K as r } from "./Package.67.mjs";
|
|
8
|
+
|
|
9
|
+
import s from "cluster-key-slot";
|
|
10
10
|
|
|
11
11
|
import "buffer";
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var n = (t => {
|
|
14
14
|
t["RedisClientNotConnectedThrown"] = "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.";
|
|
15
15
|
return t;
|
|
16
|
-
})(
|
|
16
|
+
})(n || {});
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var o = t => {
|
|
19
19
|
const e = Math.min(2 ** t * 100, 2e3);
|
|
20
|
-
const
|
|
21
|
-
return e +
|
|
20
|
+
const i = (Math.random() - .5) * 100;
|
|
21
|
+
return e + i;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
t ??= "redis://localhost:6379";
|
|
26
|
-
const s = new l(t, e);
|
|
27
|
-
if (e?.namespace) {
|
|
28
|
-
s.namespace = e.namespace;
|
|
29
|
-
const t = new n(s, {
|
|
30
|
-
namespace: e?.namespace,
|
|
31
|
-
useKeyPrefix: false
|
|
32
|
-
});
|
|
33
|
-
if (e?.throwOnConnectError) {
|
|
34
|
-
t.throwOnErrors = true;
|
|
35
|
-
}
|
|
36
|
-
if (e?.throwOnErrors) {
|
|
37
|
-
t.throwOnErrors = true;
|
|
38
|
-
}
|
|
39
|
-
return t;
|
|
40
|
-
}
|
|
41
|
-
const r = new n(s, {
|
|
42
|
-
useKeyPrefix: false
|
|
43
|
-
});
|
|
44
|
-
if (e?.throwOnConnectError) {
|
|
45
|
-
r.throwOnErrors = true;
|
|
46
|
-
}
|
|
47
|
-
if (e?.throwOnErrors) {
|
|
48
|
-
r.throwOnErrors = true;
|
|
49
|
-
}
|
|
50
|
-
r.namespace = void 0;
|
|
51
|
-
return r;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function h(t, e) {
|
|
55
|
-
const s = c(t, e);
|
|
56
|
-
const r = s.store;
|
|
57
|
-
r.throwOnConnectError = false;
|
|
58
|
-
r.throwOnErrors = false;
|
|
59
|
-
const i = r.client;
|
|
60
|
-
if (i.options) {
|
|
61
|
-
i.options.disableOfflineQueue = true;
|
|
62
|
-
if (i.options.socket) {
|
|
63
|
-
i.options.socket.reconnectStrategy = false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
s.throwOnErrors = false;
|
|
67
|
-
return s;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
var l = class extends i {
|
|
24
|
+
var a = class extends i {
|
|
71
25
|
_client=t();
|
|
72
26
|
_namespace;
|
|
73
27
|
_keyPrefixSeparator="::";
|
|
@@ -75,38 +29,26 @@ var l = class extends i {
|
|
|
75
29
|
_useUnlink=true;
|
|
76
30
|
_noNamespaceAffectsAll=false;
|
|
77
31
|
_throwOnConnectError=true;
|
|
78
|
-
|
|
32
|
+
_throwErrors=false;
|
|
79
33
|
_connectionTimeout;
|
|
80
|
-
constructor(
|
|
34
|
+
constructor(i, r) {
|
|
81
35
|
super();
|
|
82
|
-
const
|
|
83
|
-
reconnectStrategy:
|
|
36
|
+
const s = {
|
|
37
|
+
reconnectStrategy: o
|
|
84
38
|
};
|
|
85
|
-
if (
|
|
86
|
-
if (typeof
|
|
39
|
+
if (i) {
|
|
40
|
+
if (typeof i === "string") {
|
|
87
41
|
this._client = t({
|
|
88
|
-
url:
|
|
89
|
-
socket:
|
|
42
|
+
url: i,
|
|
43
|
+
socket: s
|
|
90
44
|
});
|
|
91
|
-
} else if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this._client = r;
|
|
96
|
-
} else {
|
|
97
|
-
this._client = r;
|
|
98
|
-
}
|
|
99
|
-
} else if (r instanceof Object) {
|
|
100
|
-
if (r.sentinelRootNodes !== void 0) {
|
|
101
|
-
this._client = e(r);
|
|
102
|
-
} else if (r.rootNodes === void 0) {
|
|
103
|
-
this._client = t(r);
|
|
104
|
-
} else {
|
|
105
|
-
this._client = s(r);
|
|
106
|
-
}
|
|
45
|
+
} else if (i.connect !== void 0) {
|
|
46
|
+
this._client = this.isClientCluster(i) ? i : i;
|
|
47
|
+
} else if (i instanceof Object) {
|
|
48
|
+
this._client = i.rootNodes === void 0 ? t(i) : e(i);
|
|
107
49
|
}
|
|
108
50
|
}
|
|
109
|
-
this.setOptions(
|
|
51
|
+
this.setOptions(r);
|
|
110
52
|
this.initClient();
|
|
111
53
|
}
|
|
112
54
|
get client() {
|
|
@@ -131,7 +73,7 @@ var l = class extends i {
|
|
|
131
73
|
noNamespaceAffectsAll: this._noNamespaceAffectsAll,
|
|
132
74
|
useUnlink: this._useUnlink,
|
|
133
75
|
throwOnConnectError: this._throwOnConnectError,
|
|
134
|
-
|
|
76
|
+
throwErrors: this._throwErrors,
|
|
135
77
|
connectionTimeout: this._connectionTimeout,
|
|
136
78
|
dialect: "redis",
|
|
137
79
|
url: t
|
|
@@ -181,11 +123,11 @@ var l = class extends i {
|
|
|
181
123
|
set throwOnConnectError(t) {
|
|
182
124
|
this._throwOnConnectError = t;
|
|
183
125
|
}
|
|
184
|
-
get
|
|
185
|
-
return this.
|
|
126
|
+
get throwErrors() {
|
|
127
|
+
return this._throwErrors;
|
|
186
128
|
}
|
|
187
|
-
set
|
|
188
|
-
this.
|
|
129
|
+
set throwErrors(t) {
|
|
130
|
+
this._throwErrors = t;
|
|
189
131
|
}
|
|
190
132
|
get connectionTimeout() {
|
|
191
133
|
return this._connectionTimeout;
|
|
@@ -205,80 +147,50 @@ var l = class extends i {
|
|
|
205
147
|
}
|
|
206
148
|
} catch (t) {
|
|
207
149
|
this.emit("error", t);
|
|
208
|
-
await this.disconnect(true);
|
|
209
150
|
if (this._throwOnConnectError) {
|
|
210
151
|
throw new Error("Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.");
|
|
211
152
|
}
|
|
153
|
+
await this.disconnect(true);
|
|
212
154
|
}
|
|
213
155
|
this.initClient();
|
|
214
156
|
return this._client;
|
|
215
157
|
}
|
|
216
|
-
async set(t, e,
|
|
158
|
+
async set(t, e, i) {
|
|
217
159
|
const r = await this.getClient();
|
|
218
160
|
try {
|
|
219
161
|
t = this.createKeyPrefix(t, this._namespace);
|
|
220
|
-
if (
|
|
162
|
+
if (i) {
|
|
221
163
|
await r.set(t, e, {
|
|
222
|
-
PX:
|
|
164
|
+
PX: i
|
|
223
165
|
});
|
|
224
166
|
} else {
|
|
225
167
|
await r.set(t, e);
|
|
226
168
|
}
|
|
227
169
|
} catch (t) {
|
|
228
170
|
this.emit("error", t);
|
|
229
|
-
if (this.
|
|
171
|
+
if (this._throwErrors) {
|
|
230
172
|
throw t;
|
|
231
173
|
}
|
|
232
174
|
}
|
|
233
175
|
}
|
|
234
176
|
async setMany(t) {
|
|
177
|
+
const e = await this.getClient();
|
|
235
178
|
try {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
await Promise.all(Array.from(e.entries(), (async ([t, e]) => {
|
|
247
|
-
const s = await this.getSlotMaster(t);
|
|
248
|
-
const r = s.multi();
|
|
249
|
-
for (const {key: t, value: s, ttl: i} of e) {
|
|
250
|
-
const e = this.createKeyPrefix(t, this._namespace);
|
|
251
|
-
if (i) {
|
|
252
|
-
r.set(e, s, {
|
|
253
|
-
PX: i
|
|
254
|
-
});
|
|
255
|
-
} else {
|
|
256
|
-
r.set(e, s);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
await r.exec();
|
|
260
|
-
})));
|
|
261
|
-
} else {
|
|
262
|
-
const e = await this.getClient();
|
|
263
|
-
const s = e.multi();
|
|
264
|
-
for (const {key: e, value: r, ttl: i} of t) {
|
|
265
|
-
const t = this.createKeyPrefix(e, this._namespace);
|
|
266
|
-
if (i) {
|
|
267
|
-
s.set(t, r, {
|
|
268
|
-
PX: i
|
|
269
|
-
});
|
|
270
|
-
} else {
|
|
271
|
-
s.set(t, r);
|
|
272
|
-
}
|
|
179
|
+
const i = e.multi();
|
|
180
|
+
for (const {key: e, value: r, ttl: s} of t) {
|
|
181
|
+
const t = this.createKeyPrefix(e, this._namespace);
|
|
182
|
+
if (s) {
|
|
183
|
+
i.set(t, r, {
|
|
184
|
+
PX: s
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
i.set(t, r);
|
|
273
188
|
}
|
|
274
|
-
await s.exec();
|
|
275
189
|
}
|
|
190
|
+
await i.exec();
|
|
276
191
|
} catch (t) {
|
|
277
192
|
this.emit("error", t);
|
|
278
|
-
if (this.
|
|
279
|
-
throw t;
|
|
280
|
-
}
|
|
281
|
-
if (this._throwOnErrors) {
|
|
193
|
+
if (this._throwErrors) {
|
|
282
194
|
throw t;
|
|
283
195
|
}
|
|
284
196
|
}
|
|
@@ -287,49 +199,29 @@ var l = class extends i {
|
|
|
287
199
|
const e = await this.getClient();
|
|
288
200
|
try {
|
|
289
201
|
t = this.createKeyPrefix(t, this._namespace);
|
|
290
|
-
const
|
|
291
|
-
return
|
|
202
|
+
const i = await e.exists(t);
|
|
203
|
+
return i === 1;
|
|
292
204
|
} catch (t) {
|
|
293
205
|
this.emit("error", t);
|
|
294
|
-
if (this.
|
|
206
|
+
if (this._throwErrors) {
|
|
295
207
|
throw t;
|
|
296
208
|
}
|
|
297
209
|
return false;
|
|
298
210
|
}
|
|
299
211
|
}
|
|
300
212
|
async hasMany(t) {
|
|
213
|
+
const e = await this.getClient();
|
|
301
214
|
try {
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
const t = this.
|
|
305
|
-
|
|
306
|
-
await Promise.all(Array.from(t.entries(), (async ([t, e]) => {
|
|
307
|
-
const r = await this.getSlotMaster(t);
|
|
308
|
-
const i = r.multi();
|
|
309
|
-
for (const t of e) {
|
|
310
|
-
i.exists(t);
|
|
311
|
-
}
|
|
312
|
-
const n = await i.exec();
|
|
313
|
-
for (const [t, r] of n.entries()) {
|
|
314
|
-
s.set(e[t], typeof r === "number" && r === 1);
|
|
315
|
-
}
|
|
316
|
-
})));
|
|
317
|
-
return e.map((t => s.get(t) ?? false));
|
|
318
|
-
} else {
|
|
319
|
-
const t = await this.getClient();
|
|
320
|
-
const s = t.multi();
|
|
321
|
-
for (const t of e) {
|
|
322
|
-
s.exists(t);
|
|
323
|
-
}
|
|
324
|
-
const r = await s.exec();
|
|
325
|
-
return r.map((t => typeof t === "number" && t === 1));
|
|
215
|
+
const i = e.multi();
|
|
216
|
+
for (const e of t) {
|
|
217
|
+
const t = this.createKeyPrefix(e, this._namespace);
|
|
218
|
+
i.exists(t);
|
|
326
219
|
}
|
|
220
|
+
const r = await i.exec();
|
|
221
|
+
return r.map((t => t === 1));
|
|
327
222
|
} catch (e) {
|
|
328
223
|
this.emit("error", e);
|
|
329
|
-
if (this.
|
|
330
|
-
throw e;
|
|
331
|
-
}
|
|
332
|
-
if (this._throwOnErrors) {
|
|
224
|
+
if (this._throwErrors) {
|
|
333
225
|
throw e;
|
|
334
226
|
}
|
|
335
227
|
return Array.from({
|
|
@@ -341,14 +233,14 @@ var l = class extends i {
|
|
|
341
233
|
const e = await this.getClient();
|
|
342
234
|
try {
|
|
343
235
|
t = this.createKeyPrefix(t, this._namespace);
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
236
|
+
const i = await e.get(t);
|
|
237
|
+
if (i === null) {
|
|
346
238
|
return void 0;
|
|
347
239
|
}
|
|
348
|
-
return
|
|
240
|
+
return i;
|
|
349
241
|
} catch (t) {
|
|
350
242
|
this.emit("error", t);
|
|
351
|
-
if (this.
|
|
243
|
+
if (this._throwErrors) {
|
|
352
244
|
throw t;
|
|
353
245
|
}
|
|
354
246
|
return void 0;
|
|
@@ -364,7 +256,7 @@ var l = class extends i {
|
|
|
364
256
|
return e;
|
|
365
257
|
} catch (e) {
|
|
366
258
|
this.emit("error", e);
|
|
367
|
-
if (this.
|
|
259
|
+
if (this._throwErrors) {
|
|
368
260
|
throw e;
|
|
369
261
|
}
|
|
370
262
|
return Array.from({
|
|
@@ -376,12 +268,12 @@ var l = class extends i {
|
|
|
376
268
|
const e = await this.getClient();
|
|
377
269
|
try {
|
|
378
270
|
t = this.createKeyPrefix(t, this._namespace);
|
|
379
|
-
let
|
|
380
|
-
|
|
381
|
-
return
|
|
271
|
+
let i = 0;
|
|
272
|
+
i = await (this._useUnlink ? e.unlink(t) : e.del(t));
|
|
273
|
+
return i > 0;
|
|
382
274
|
} catch (t) {
|
|
383
275
|
this.emit("error", t);
|
|
384
|
-
if (this.
|
|
276
|
+
if (this._throwErrors) {
|
|
385
277
|
throw t;
|
|
386
278
|
}
|
|
387
279
|
return false;
|
|
@@ -389,50 +281,26 @@ var l = class extends i {
|
|
|
389
281
|
}
|
|
390
282
|
async deleteMany(t) {
|
|
391
283
|
let e = false;
|
|
284
|
+
const i = await this.getClient();
|
|
392
285
|
try {
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
const t = this.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (this._useUnlink) {
|
|
401
|
-
i.unlink(t);
|
|
402
|
-
} else {
|
|
403
|
-
i.del(t);
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
const n = await i.exec();
|
|
407
|
-
for (const t of n) {
|
|
408
|
-
if (typeof t === "number" && t > 0) {
|
|
409
|
-
e = true;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
})));
|
|
413
|
-
} else {
|
|
414
|
-
const t = await this.getClient();
|
|
415
|
-
const r = t.multi();
|
|
416
|
-
for (const t of s) {
|
|
417
|
-
if (this._useUnlink) {
|
|
418
|
-
r.unlink(t);
|
|
419
|
-
} else {
|
|
420
|
-
r.del(t);
|
|
421
|
-
}
|
|
286
|
+
const r = i.multi();
|
|
287
|
+
for (const e of t) {
|
|
288
|
+
const t = this.createKeyPrefix(e, this._namespace);
|
|
289
|
+
if (this._useUnlink) {
|
|
290
|
+
r.unlink(t);
|
|
291
|
+
} else {
|
|
292
|
+
r.del(t);
|
|
422
293
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
294
|
+
}
|
|
295
|
+
const s = await r.exec();
|
|
296
|
+
for (const t of s) {
|
|
297
|
+
if (typeof t === "number" && t > 0) {
|
|
298
|
+
e = true;
|
|
428
299
|
}
|
|
429
300
|
}
|
|
430
301
|
} catch (t) {
|
|
431
302
|
this.emit("error", t);
|
|
432
|
-
if (this.
|
|
433
|
-
throw t;
|
|
434
|
-
}
|
|
435
|
-
if (this._throwOnErrors) {
|
|
303
|
+
if (this._throwErrors) {
|
|
436
304
|
throw t;
|
|
437
305
|
}
|
|
438
306
|
}
|
|
@@ -440,7 +308,7 @@ var l = class extends i {
|
|
|
440
308
|
}
|
|
441
309
|
async disconnect(t) {
|
|
442
310
|
if (this._client.isOpen) {
|
|
443
|
-
await (t ? this._client.
|
|
311
|
+
await (t ? this._client.disconnect() : this._client.quit());
|
|
444
312
|
}
|
|
445
313
|
}
|
|
446
314
|
createKeyPrefix(t, e) {
|
|
@@ -458,38 +326,34 @@ var l = class extends i {
|
|
|
458
326
|
isCluster() {
|
|
459
327
|
return this.isClientCluster(this._client);
|
|
460
328
|
}
|
|
461
|
-
isSentinel() {
|
|
462
|
-
return this.isClientSentinel(this._client);
|
|
463
|
-
}
|
|
464
329
|
async getMasterNodes() {
|
|
465
330
|
if (this.isCluster()) {
|
|
466
331
|
const t = await this.getClient();
|
|
467
|
-
|
|
468
|
-
return Promise.all(e);
|
|
332
|
+
return Promise.all(t.masters.map((async e => t.nodeClient(e))));
|
|
469
333
|
}
|
|
470
334
|
return [ await this.getClient() ];
|
|
471
335
|
}
|
|
472
336
|
async* iterator(t) {
|
|
473
337
|
const e = await this.getMasterNodes();
|
|
474
|
-
for (const
|
|
338
|
+
for (const i of e) {
|
|
475
339
|
const e = t ? `${t}${this._keyPrefixSeparator}*` : "*";
|
|
476
340
|
let r = "0";
|
|
477
341
|
do {
|
|
478
|
-
const
|
|
342
|
+
const s = await i.scan(Number.parseInt(r, 10), {
|
|
479
343
|
MATCH: e,
|
|
480
344
|
TYPE: "string"
|
|
481
345
|
});
|
|
482
|
-
r =
|
|
483
|
-
let {keys: n} =
|
|
346
|
+
r = s.cursor.toString();
|
|
347
|
+
let {keys: n} = s;
|
|
484
348
|
if (!t && !this._noNamespaceAffectsAll) {
|
|
485
349
|
n = n.filter((t => !t.includes(this._keyPrefixSeparator)));
|
|
486
350
|
}
|
|
487
351
|
if (n.length > 0) {
|
|
488
352
|
const e = await this.mget(n);
|
|
489
|
-
for (const
|
|
490
|
-
const r = this.getKeyWithoutPrefix(n[
|
|
491
|
-
const
|
|
492
|
-
yield [ r,
|
|
353
|
+
for (const i of n.keys()) {
|
|
354
|
+
const r = this.getKeyWithoutPrefix(n[i], t);
|
|
355
|
+
const s = e[i];
|
|
356
|
+
yield [ r, s ];
|
|
493
357
|
}
|
|
494
358
|
}
|
|
495
359
|
} while (r !== "0");
|
|
@@ -504,13 +368,13 @@ var l = class extends i {
|
|
|
504
368
|
return;
|
|
505
369
|
}
|
|
506
370
|
let e = "0";
|
|
507
|
-
const
|
|
371
|
+
const i = this._clearBatchSize;
|
|
508
372
|
const r = this._namespace ? `${this._namespace}${this._keyPrefixSeparator}*` : "*";
|
|
509
|
-
const
|
|
373
|
+
const s = [];
|
|
510
374
|
do {
|
|
511
|
-
const n = await t.scan(e, {
|
|
375
|
+
const n = await t.scan(Number.parseInt(e, 10), {
|
|
512
376
|
MATCH: r,
|
|
513
|
-
COUNT:
|
|
377
|
+
COUNT: i,
|
|
514
378
|
TYPE: "string"
|
|
515
379
|
});
|
|
516
380
|
e = n.cursor.toString();
|
|
@@ -521,60 +385,52 @@ var l = class extends i {
|
|
|
521
385
|
if (!this._namespace) {
|
|
522
386
|
o = o.filter((t => !t.includes(this._keyPrefixSeparator)));
|
|
523
387
|
}
|
|
524
|
-
|
|
388
|
+
s.push(this.clearWithClusterSupport(o));
|
|
525
389
|
} while (e !== "0");
|
|
526
|
-
await Promise.all(
|
|
390
|
+
await Promise.all(s);
|
|
527
391
|
})));
|
|
528
392
|
} catch (t) {
|
|
529
393
|
this.emit("error", t);
|
|
530
394
|
}
|
|
531
395
|
}
|
|
532
396
|
async mget(t) {
|
|
533
|
-
const e =
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
await
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
e.set(s[t], r ?? void 0);
|
|
541
|
-
}
|
|
542
|
-
})));
|
|
543
|
-
} else {
|
|
544
|
-
const s = await this.getClient();
|
|
545
|
-
const r = await s.mGet(t);
|
|
546
|
-
for (const [s, i] of r.entries()) {
|
|
547
|
-
e.set(t[s], i ?? void 0);
|
|
397
|
+
const e = this.getSlotMap(t);
|
|
398
|
+
const i = new Map;
|
|
399
|
+
await Promise.all(Array.from(e.entries(), (async ([t, e]) => {
|
|
400
|
+
const r = await this.getSlotMaster(t);
|
|
401
|
+
const s = await r.mGet(e);
|
|
402
|
+
for (const [t, r] of s.entries()) {
|
|
403
|
+
i.set(e[t], r ?? void 0);
|
|
548
404
|
}
|
|
549
|
-
}
|
|
550
|
-
return t.map((t =>
|
|
405
|
+
})));
|
|
406
|
+
return t.map((t => i.get(t)));
|
|
551
407
|
}
|
|
552
408
|
async clearWithClusterSupport(t) {
|
|
553
409
|
if (t.length > 0) {
|
|
554
410
|
const e = this.getSlotMap(t);
|
|
555
411
|
await Promise.all(Array.from(e.entries(), (async ([t, e]) => {
|
|
556
|
-
const
|
|
557
|
-
return this._useUnlink ?
|
|
412
|
+
const i = await this.getSlotMaster(t);
|
|
413
|
+
return this._useUnlink ? i.unlink(e) : i.del(e);
|
|
558
414
|
})));
|
|
559
415
|
}
|
|
560
416
|
}
|
|
561
417
|
async getSlotMaster(t) {
|
|
562
418
|
const e = await this.getClient();
|
|
563
419
|
if (this.isCluster()) {
|
|
564
|
-
const
|
|
565
|
-
const r =
|
|
566
|
-
return
|
|
420
|
+
const i = e;
|
|
421
|
+
const r = i.slots[t].master;
|
|
422
|
+
return i.nodeClient(r);
|
|
567
423
|
}
|
|
568
424
|
return e;
|
|
569
425
|
}
|
|
570
426
|
getSlotMap(t) {
|
|
571
427
|
const e = new Map;
|
|
572
428
|
if (this.isCluster()) {
|
|
573
|
-
for (const
|
|
574
|
-
const t =
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
e.set(t,
|
|
429
|
+
for (const i of t) {
|
|
430
|
+
const t = s(i);
|
|
431
|
+
const r = e.get(t) ?? [];
|
|
432
|
+
r.push(i);
|
|
433
|
+
e.set(t, r);
|
|
578
434
|
}
|
|
579
435
|
} else {
|
|
580
436
|
e.set(0, t);
|
|
@@ -582,10 +438,10 @@ var l = class extends i {
|
|
|
582
438
|
return e;
|
|
583
439
|
}
|
|
584
440
|
isClientCluster(t) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
return
|
|
441
|
+
if (t.options === void 0 && t.scan === void 0) {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
return false;
|
|
589
445
|
}
|
|
590
446
|
setOptions(t) {
|
|
591
447
|
if (!t) {
|
|
@@ -609,8 +465,8 @@ var l = class extends i {
|
|
|
609
465
|
if (t.throwOnConnectError !== void 0) {
|
|
610
466
|
this._throwOnConnectError = t.throwOnConnectError;
|
|
611
467
|
}
|
|
612
|
-
if (t.
|
|
613
|
-
this.
|
|
468
|
+
if (t.throwErrors !== void 0) {
|
|
469
|
+
this._throwErrors = t.throwErrors;
|
|
614
470
|
}
|
|
615
471
|
if (t.connectionTimeout !== void 0) {
|
|
616
472
|
this._connectionTimeout = t.connectionTimeout;
|
|
@@ -628,10 +484,20 @@ var l = class extends i {
|
|
|
628
484
|
}));
|
|
629
485
|
}
|
|
630
486
|
async createTimeoutPromise(t) {
|
|
631
|
-
return new Promise(((e,
|
|
632
|
-
|
|
487
|
+
return new Promise(((e, i) => setTimeout((() => {
|
|
488
|
+
i(new Error(`Redis timed out after ${t}ms`));
|
|
633
489
|
}), t)));
|
|
634
490
|
}
|
|
635
491
|
};
|
|
636
492
|
|
|
637
|
-
|
|
493
|
+
function c(t, e) {
|
|
494
|
+
t ??= "redis://localhost:6379";
|
|
495
|
+
const i = new a(t, e);
|
|
496
|
+
const s = new r(i, {
|
|
497
|
+
namespace: e?.namespace,
|
|
498
|
+
useKeyPrefix: false
|
|
499
|
+
});
|
|
500
|
+
return s;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export { r as Keyv, n as RedisErrorMessages, c as createKeyv, a as default, o as defaultReconnectStrategy };
|