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.
Files changed (234) hide show
  1. package/com/docker.cjs +1 -1
  2. package/com/docker.mjs +1 -1
  3. package/decorator/orm.cjs +84 -84
  4. package/decorator/orm.mjs +42 -128
  5. package/orm.cjs +873 -1410
  6. package/orm.mjs +708 -1458
  7. package/package.json +1 -1
  8. package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +230 -239
  9. package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +230 -239
  10. package/src/components/docker/ConnectionOptionsBuilder.cjs +1 -1
  11. package/src/components/docker/ConnectionOptionsBuilder.mjs +1 -1
  12. package/src/components/docker/Docker.cjs +4919 -4808
  13. package/src/components/docker/Docker.mjs +4939 -4828
  14. package/src/components/docker/lib/DockerContainer.cjs +1 -1
  15. package/src/components/docker/lib/DockerContainer.mjs +1 -1
  16. package/src/components/docker/lib/DockerContainerTTY.cjs +1 -1
  17. package/src/components/docker/lib/DockerContainerTTY.mjs +1 -1
  18. package/src/components/entrypoint/Entrypoint.cjs +1669 -2159
  19. package/src/components/entrypoint/Entrypoint.mjs +1629 -2119
  20. package/src/decorators/orm/AfterInsert.cjs +26 -4
  21. package/src/decorators/orm/AfterInsert.mjs +25 -5
  22. package/src/decorators/orm/AfterLoad.cjs +26 -4
  23. package/src/decorators/orm/AfterLoad.mjs +25 -5
  24. package/src/decorators/orm/AfterRecover.cjs +26 -4
  25. package/src/decorators/orm/AfterRecover.mjs +25 -5
  26. package/src/decorators/orm/AfterRemove.cjs +26 -4
  27. package/src/decorators/orm/AfterRemove.mjs +25 -5
  28. package/src/decorators/orm/AfterSoftRemove.cjs +26 -4
  29. package/src/decorators/orm/AfterSoftRemove.mjs +25 -5
  30. package/src/decorators/orm/AfterUpdate.cjs +26 -4
  31. package/src/decorators/orm/AfterUpdate.mjs +25 -5
  32. package/src/decorators/orm/BeforeInsert.cjs +26 -4
  33. package/src/decorators/orm/BeforeInsert.mjs +25 -5
  34. package/src/decorators/orm/BeforeRecover.cjs +26 -4
  35. package/src/decorators/orm/BeforeRecover.mjs +25 -5
  36. package/src/decorators/orm/BeforeRemove.cjs +26 -4
  37. package/src/decorators/orm/BeforeRemove.mjs +25 -5
  38. package/src/decorators/orm/BeforeSoftRemove.cjs +26 -4
  39. package/src/decorators/orm/BeforeSoftRemove.mjs +25 -5
  40. package/src/decorators/orm/BeforeUpdate.cjs +26 -4
  41. package/src/decorators/orm/BeforeUpdate.mjs +25 -5
  42. package/src/decorators/orm/Check.cjs +29 -4
  43. package/src/decorators/orm/Check.mjs +28 -5
  44. package/src/decorators/orm/ChildEntity.cjs +29 -4
  45. package/src/decorators/orm/ChildEntity.mjs +28 -5
  46. package/src/decorators/orm/Column.cjs +61 -4
  47. package/src/decorators/orm/Column.mjs +61 -6
  48. package/src/decorators/orm/CreateDateColumn.cjs +25 -4
  49. package/src/decorators/orm/CreateDateColumn.mjs +24 -5
  50. package/src/decorators/orm/DeleteDateColumn.cjs +25 -4
  51. package/src/decorators/orm/DeleteDateColumn.mjs +23 -4
  52. package/src/decorators/orm/Entity.cjs +35 -4
  53. package/src/decorators/orm/Entity.mjs +33 -4
  54. package/src/decorators/orm/EventSubscriber.cjs +22 -4
  55. package/src/decorators/orm/EventSubscriber.mjs +21 -5
  56. package/src/decorators/orm/Exclusion.cjs +29 -4
  57. package/src/decorators/orm/Exclusion.mjs +28 -5
  58. package/src/decorators/orm/Generated.cjs +24 -4
  59. package/src/decorators/orm/Generated.mjs +23 -5
  60. package/src/decorators/orm/Index.cjs +41 -4
  61. package/src/decorators/orm/Index.mjs +41 -6
  62. package/src/decorators/orm/JoinColumn.cjs +29 -4
  63. package/src/decorators/orm/JoinColumn.mjs +28 -5
  64. package/src/decorators/orm/JoinTable.cjs +30 -4
  65. package/src/decorators/orm/JoinTable.mjs +28 -4
  66. package/src/decorators/orm/ManyToMany.cjs +42 -4
  67. package/src/decorators/orm/ManyToMany.mjs +40 -4
  68. package/src/decorators/orm/ManyToOne.cjs +42 -4
  69. package/src/decorators/orm/ManyToOne.mjs +40 -4
  70. package/src/decorators/orm/ObjectIdColumn.cjs +28 -4
  71. package/src/decorators/orm/ObjectIdColumn.mjs +27 -5
  72. package/src/decorators/orm/OneToMany.cjs +34 -4
  73. package/src/decorators/orm/OneToMany.mjs +34 -6
  74. package/src/decorators/orm/OneToOne.cjs +42 -4
  75. package/src/decorators/orm/OneToOne.mjs +40 -4
  76. package/src/decorators/orm/PrimaryColumn.cjs +49 -4
  77. package/src/decorators/orm/PrimaryColumn.mjs +49 -6
  78. package/src/decorators/orm/PrimaryGeneratedColumn.cjs +54 -4
  79. package/src/decorators/orm/PrimaryGeneratedColumn.mjs +54 -6
  80. package/src/decorators/orm/RelationId.cjs +26 -4
  81. package/src/decorators/orm/RelationId.mjs +25 -5
  82. package/src/decorators/orm/TableInheritance.cjs +26 -4
  83. package/src/decorators/orm/TableInheritance.mjs +25 -5
  84. package/src/decorators/orm/Tree.cjs +24 -4
  85. package/src/decorators/orm/Tree.mjs +23 -5
  86. package/src/decorators/orm/TreeChildren.cjs +31 -4
  87. package/src/decorators/orm/TreeChildren.mjs +29 -4
  88. package/src/decorators/orm/TreeLevelColumn.cjs +25 -4
  89. package/src/decorators/orm/TreeLevelColumn.mjs +23 -4
  90. package/src/decorators/orm/TreeParent.cjs +31 -4
  91. package/src/decorators/orm/TreeParent.mjs +29 -4
  92. package/src/decorators/orm/Unique.cjs +44 -4
  93. package/src/decorators/orm/Unique.mjs +44 -6
  94. package/src/decorators/orm/UpdateDateColumn.cjs +25 -4
  95. package/src/decorators/orm/UpdateDateColumn.mjs +24 -5
  96. package/src/decorators/orm/VersionColumn.cjs +25 -4
  97. package/src/decorators/orm/VersionColumn.mjs +24 -5
  98. package/src/decorators/orm/ViewColumn.cjs +25 -4
  99. package/src/decorators/orm/ViewColumn.mjs +24 -5
  100. package/src/decorators/orm/ViewEntity.cjs +34 -4
  101. package/src/decorators/orm/ViewEntity.mjs +33 -5
  102. package/src/decorators/orm/VirtualColumn.cjs +42 -4
  103. package/src/decorators/orm/VirtualColumn.mjs +40 -4
  104. package/src/lib/base/EventEmitter.cjs +1193 -1200
  105. package/src/lib/base/EventEmitter.mjs +1194 -1201
  106. package/src/lib/base/internal/DataValidator.cjs +185 -174
  107. package/src/lib/base/internal/DataValidator.mjs +186 -175
  108. package/src/lib/base/internal/PatternManager.cjs +735 -740
  109. package/src/lib/base/internal/PatternManager.mjs +740 -745
  110. package/src/lib/core/Application.cjs +99 -112
  111. package/src/lib/core/Application.mjs +127 -140
  112. package/src/lib/helpers/IsHtml.cjs +13 -7
  113. package/src/lib/helpers/IsHtml.mjs +13 -7
  114. package/src/lib/helpers/IsXML.cjs +1016 -1158
  115. package/src/lib/helpers/IsXML.mjs +729 -871
  116. package/src/lib/helpers/ObjectHash.cjs +371 -378
  117. package/src/lib/helpers/ObjectHash.mjs +371 -378
  118. package/src/lib/helpers/RandomString.cjs +146 -167
  119. package/src/lib/helpers/RandomString.mjs +145 -166
  120. package/src/lib/helpers/URLBuilder.cjs +355 -355
  121. package/src/lib/helpers/URLBuilder.mjs +350 -350
  122. package/src/lib/ioc/ListModules.cjs +5237 -5160
  123. package/src/lib/ioc/ListModules.mjs +5252 -5175
  124. package/src/lib/validation/VLD.cjs +3903 -4080
  125. package/src/lib/validation/VLD.mjs +2793 -2970
  126. package/src/providers/migration/GenerateMigration.cjs +2 -2
  127. package/src/providers/migration/GenerateMigration.mjs +2 -2
  128. package/vendor/Package.112.cjs +38321 -38240
  129. package/vendor/Package.112.mjs +37720 -37579
  130. package/vendor/Package.16.cjs +7386 -7268
  131. package/vendor/Package.16.mjs +6706 -6588
  132. package/vendor/Package.18.cjs +48229 -20
  133. package/vendor/Package.18.mjs +48192 -24
  134. package/vendor/Package.2.cjs +5698 -5727
  135. package/vendor/Package.2.mjs +5707 -5736
  136. package/vendor/Package.4.cjs +874 -884
  137. package/vendor/Package.4.mjs +874 -884
  138. package/vendor/Package.5.cjs +11 -15
  139. package/vendor/Package.5.mjs +7 -11
  140. package/vendor/Package.6.cjs +511 -520
  141. package/vendor/Package.6.mjs +534 -543
  142. package/vendor/Package.62.cjs +87 -90
  143. package/vendor/Package.62.mjs +180 -183
  144. package/vendor/Package.65.cjs +1285 -1292
  145. package/vendor/Package.65.mjs +190 -197
  146. package/vendor/Package.68.cjs +111 -252
  147. package/vendor/Package.68.mjs +134 -268
  148. package/vendor/Package.9.cjs +118 -132
  149. package/vendor/Package.9.mjs +124 -138
  150. package/vendor/TypeDef.internal.3.d.ts +0 -14
  151. package/vendor/Package.19.cjs +0 -37
  152. package/vendor/Package.19.mjs +0 -35
  153. package/vendor/Package.20.cjs +0 -37
  154. package/vendor/Package.20.mjs +0 -35
  155. package/vendor/Package.21.cjs +0 -37
  156. package/vendor/Package.21.mjs +0 -35
  157. package/vendor/Package.22.cjs +0 -37
  158. package/vendor/Package.22.mjs +0 -35
  159. package/vendor/Package.23.cjs +0 -37
  160. package/vendor/Package.23.mjs +0 -35
  161. package/vendor/Package.24.cjs +0 -37
  162. package/vendor/Package.24.mjs +0 -35
  163. package/vendor/Package.25.cjs +0 -37
  164. package/vendor/Package.25.mjs +0 -35
  165. package/vendor/Package.26.cjs +0 -37
  166. package/vendor/Package.26.mjs +0 -35
  167. package/vendor/Package.27.cjs +0 -37
  168. package/vendor/Package.27.mjs +0 -35
  169. package/vendor/Package.28.cjs +0 -37
  170. package/vendor/Package.28.mjs +0 -35
  171. package/vendor/Package.29.cjs +0 -40
  172. package/vendor/Package.29.mjs +0 -38
  173. package/vendor/Package.30.cjs +0 -41
  174. package/vendor/Package.30.mjs +0 -39
  175. package/vendor/Package.31.cjs +0 -72
  176. package/vendor/Package.31.mjs +0 -70
  177. package/vendor/Package.32.cjs +0 -37
  178. package/vendor/Package.32.mjs +0 -35
  179. package/vendor/Package.33.cjs +0 -37
  180. package/vendor/Package.33.mjs +0 -35
  181. package/vendor/Package.34.cjs +0 -46
  182. package/vendor/Package.34.mjs +0 -44
  183. package/vendor/Package.35.cjs +0 -34
  184. package/vendor/Package.35.mjs +0 -32
  185. package/vendor/Package.36.cjs +0 -40
  186. package/vendor/Package.36.mjs +0 -38
  187. package/vendor/Package.37.cjs +0 -36
  188. package/vendor/Package.37.mjs +0 -34
  189. package/vendor/Package.38.cjs +0 -52
  190. package/vendor/Package.38.mjs +0 -50
  191. package/vendor/Package.39.cjs +0 -41
  192. package/vendor/Package.39.mjs +0 -39
  193. package/vendor/Package.40.cjs +0 -42
  194. package/vendor/Package.40.mjs +0 -40
  195. package/vendor/Package.41.cjs +0 -53
  196. package/vendor/Package.41.mjs +0 -51
  197. package/vendor/Package.42.cjs +0 -53
  198. package/vendor/Package.42.mjs +0 -51
  199. package/vendor/Package.43.cjs +0 -40
  200. package/vendor/Package.43.mjs +0 -38
  201. package/vendor/Package.44.cjs +0 -46
  202. package/vendor/Package.44.mjs +0 -44
  203. package/vendor/Package.45.cjs +0 -53
  204. package/vendor/Package.45.mjs +0 -51
  205. package/vendor/Package.46.cjs +0 -59
  206. package/vendor/Package.46.mjs +0 -57
  207. package/vendor/Package.47.cjs +0 -65
  208. package/vendor/Package.47.mjs +0 -63
  209. package/vendor/Package.48.cjs +0 -38
  210. package/vendor/Package.48.mjs +0 -36
  211. package/vendor/Package.49.cjs +0 -38
  212. package/vendor/Package.49.mjs +0 -36
  213. package/vendor/Package.50.cjs +0 -36
  214. package/vendor/Package.50.mjs +0 -34
  215. package/vendor/Package.51.cjs +0 -43
  216. package/vendor/Package.51.mjs +0 -41
  217. package/vendor/Package.52.cjs +0 -37
  218. package/vendor/Package.52.mjs +0 -35
  219. package/vendor/Package.53.cjs +0 -43
  220. package/vendor/Package.53.mjs +0 -41
  221. package/vendor/Package.54.cjs +0 -55
  222. package/vendor/Package.54.mjs +0 -53
  223. package/vendor/Package.55.cjs +0 -37
  224. package/vendor/Package.55.mjs +0 -35
  225. package/vendor/Package.56.cjs +0 -37
  226. package/vendor/Package.56.mjs +0 -35
  227. package/vendor/Package.57.cjs +0 -37
  228. package/vendor/Package.57.mjs +0 -35
  229. package/vendor/Package.58.cjs +0 -45
  230. package/vendor/Package.58.mjs +0 -43
  231. package/vendor/Package.59.cjs +0 -53
  232. package/vendor/Package.59.mjs +0 -51
  233. package/vendor/Package.60.cjs +0 -47649
  234. package/vendor/Package.60.mjs +0 -47606
@@ -1,73 +1,27 @@
1
- import { createClient as t, createSentinel as e, createCluster as s } from "@redis/client";
1
+ import { createClient as t, createCluster as e } from "@redis/client";
2
2
 
3
- export { createClient, createCluster, createSentinel } from "@redis/client";
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 n } from "./Package.67.mjs";
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 o = (t => {
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
- })(o || {});
16
+ })(n || {});
17
17
 
18
- var a = t => {
18
+ var o = t => {
19
19
  const e = Math.min(2 ** t * 100, 2e3);
20
- const s = (Math.random() - .5) * 100;
21
- return e + s;
20
+ const i = (Math.random() - .5) * 100;
21
+ return e + i;
22
22
  };
23
23
 
24
- function c(t, e) {
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
- _throwOnErrors=false;
32
+ _throwErrors=false;
79
33
  _connectionTimeout;
80
- constructor(r, i) {
34
+ constructor(i, r) {
81
35
  super();
82
- const n = {
83
- reconnectStrategy: a
36
+ const s = {
37
+ reconnectStrategy: o
84
38
  };
85
- if (r) {
86
- if (typeof r === "string") {
39
+ if (i) {
40
+ if (typeof i === "string") {
87
41
  this._client = t({
88
- url: r,
89
- socket: n
42
+ url: i,
43
+ socket: s
90
44
  });
91
- } else if (r.connect !== void 0) {
92
- if (this.isClientSentinel(r)) {
93
- this._client = r;
94
- } else if (this.isClientCluster(r)) {
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(i);
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
- throwOnErrors: this._throwOnErrors,
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 throwOnErrors() {
185
- return this._throwOnErrors;
126
+ get throwErrors() {
127
+ return this._throwErrors;
186
128
  }
187
- set throwOnErrors(t) {
188
- this._throwOnErrors = t;
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, s) {
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 (s) {
162
+ if (i) {
221
163
  await r.set(t, e, {
222
- PX: s
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._throwOnErrors) {
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
- if (this.isCluster()) {
237
- await this.getClient();
238
- const e = new Map;
239
- for (const s of t) {
240
- const t = this.createKeyPrefix(s.key, this._namespace);
241
- const i = r(t);
242
- const n = e.get(i) ?? [];
243
- n.push(s);
244
- e.set(i, n);
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._throwOnConnectError && t.message === "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.") {
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 s = await e.exists(t);
291
- return s === 1;
202
+ const i = await e.exists(t);
203
+ return i === 1;
292
204
  } catch (t) {
293
205
  this.emit("error", t);
294
- if (this._throwOnErrors) {
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 e = t.map((t => this.createKeyPrefix(t, this._namespace)));
303
- if (this.isCluster()) {
304
- const t = this.getSlotMap(e);
305
- const s = new Map;
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._throwOnConnectError && e.message === "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.") {
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 s = await e.get(t);
345
- if (s === null) {
236
+ const i = await e.get(t);
237
+ if (i === null) {
346
238
  return void 0;
347
239
  }
348
- return s;
240
+ return i;
349
241
  } catch (t) {
350
242
  this.emit("error", t);
351
- if (this._throwOnErrors) {
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._throwOnErrors) {
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 s = 0;
380
- s = await (this._useUnlink ? e.unlink(t) : e.del(t));
381
- return s > 0;
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._throwOnErrors) {
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 s = t.map((t => this.createKeyPrefix(t, this._namespace)));
394
- if (this.isCluster()) {
395
- const t = this.getSlotMap(s);
396
- await Promise.all(Array.from(t.entries(), (async ([t, s]) => {
397
- const r = await this.getSlotMaster(t);
398
- const i = r.multi();
399
- for (const t of s) {
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
- const i = await r.exec();
424
- for (const t of i) {
425
- if (typeof t === "number" && t > 0) {
426
- e = true;
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._throwOnConnectError && t.message === "Redis client is not connected or has failed to connect. This is thrown because throwOnConnectError is set to true.") {
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.destroy() : this._client.close());
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
- const e = t.masters.map((async e => t.nodeClient(e)));
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 s of e) {
338
+ for (const i of e) {
475
339
  const e = t ? `${t}${this._keyPrefixSeparator}*` : "*";
476
340
  let r = "0";
477
341
  do {
478
- const i = await s.scan(r, {
342
+ const s = await i.scan(Number.parseInt(r, 10), {
479
343
  MATCH: e,
480
344
  TYPE: "string"
481
345
  });
482
- r = i.cursor.toString();
483
- let {keys: n} = i;
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 s of n.keys()) {
490
- const r = this.getKeyWithoutPrefix(n[s], t);
491
- const i = e[s];
492
- yield [ r, i ];
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 s = this._clearBatchSize;
371
+ const i = this._clearBatchSize;
508
372
  const r = this._namespace ? `${this._namespace}${this._keyPrefixSeparator}*` : "*";
509
- const i = [];
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: s,
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
- i.push(this.clearWithClusterSupport(o));
388
+ s.push(this.clearWithClusterSupport(o));
525
389
  } while (e !== "0");
526
- await Promise.all(i);
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 = new Map;
534
- if (this.isCluster()) {
535
- const s = this.getSlotMap(t);
536
- await Promise.all(Array.from(s.entries(), (async ([t, s]) => {
537
- const r = await this.getSlotMaster(t);
538
- const i = await r.mGet(s);
539
- for (const [t, r] of i.entries()) {
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 => e.get(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 s = await this.getSlotMaster(t);
557
- return this._useUnlink ? s.unlink(e) : s.del(e);
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 s = e;
565
- const r = s.slots[t].master;
566
- return s.nodeClient(r);
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 s of t) {
574
- const t = r(s);
575
- const i = e.get(t) ?? [];
576
- i.push(s);
577
- e.set(t, i);
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
- return t.slots !== void 0;
586
- }
587
- isClientSentinel(t) {
588
- return t.getSentinelNode !== void 0;
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.throwOnErrors !== void 0) {
613
- this._throwOnErrors = t.throwOnErrors;
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, s) => setTimeout((() => {
632
- s(new Error(`Redis timed out after ${t}ms`));
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
- export { n as Keyv, o as RedisErrorMessages, c as createKeyv, h as createKeyvNonBlocking, l as default, a as defaultReconnectStrategy };
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 };