lakutata 2.0.34 → 2.0.35

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 (210) hide show
  1. package/com/cacher.cjs +211 -0
  2. package/com/cacher.d.ts +514 -0
  3. package/com/cacher.mjs +185 -0
  4. package/com/database.cjs +6 -2
  5. package/com/database.mjs +6 -2
  6. package/com/docker.cjs +23 -17
  7. package/com/docker.mjs +19 -13
  8. package/com/entrypoint.cjs +1 -1
  9. package/com/entrypoint.mjs +1 -1
  10. package/com/logger.cjs +6 -2
  11. package/com/logger.mjs +6 -2
  12. package/decorator/ctrl.cjs +1 -1
  13. package/decorator/ctrl.mjs +1 -1
  14. package/decorator/orm.cjs +22 -18
  15. package/decorator/orm.mjs +6 -2
  16. package/helper.cjs +1 -1
  17. package/helper.mjs +1 -1
  18. package/lakutata.cjs +7 -3
  19. package/lakutata.mjs +7 -3
  20. package/orm.cjs +19 -15
  21. package/orm.mjs +15 -11
  22. package/package.json +6 -1
  23. package/provider/database.cjs +6 -2
  24. package/provider/database.mjs +6 -2
  25. package/src/components/Database.cjs +6 -2
  26. package/src/components/Database.mjs +6 -2
  27. package/src/components/Logger.cjs +6 -2
  28. package/src/components/Logger.mjs +6 -2
  29. package/src/components/cacher/Cacher.cjs +193 -0
  30. package/src/components/cacher/Cacher.mjs +183 -0
  31. package/src/components/cacher/options/CacherOptions.cjs +93 -0
  32. package/src/components/cacher/options/CacherOptions.mjs +87 -0
  33. package/src/components/cacher/options/FileCacheOptions.cjs +77 -0
  34. package/src/components/cacher/options/FileCacheOptions.mjs +71 -0
  35. package/src/components/cacher/options/MemcacheCacheOptions.cjs +79 -0
  36. package/src/components/cacher/options/MemcacheCacheOptions.mjs +73 -0
  37. package/src/components/cacher/options/MongoCacheOptions.cjs +83 -0
  38. package/src/components/cacher/options/MongoCacheOptions.mjs +77 -0
  39. package/src/components/cacher/options/MysqlCacheOptions.cjs +83 -0
  40. package/src/components/cacher/options/MysqlCacheOptions.mjs +77 -0
  41. package/src/components/cacher/options/PostgresCacheOptions.cjs +87 -0
  42. package/src/components/cacher/options/PostgresCacheOptions.mjs +81 -0
  43. package/src/components/cacher/options/RedisCacheOptions.cjs +99 -0
  44. package/src/components/cacher/options/RedisCacheOptions.mjs +93 -0
  45. package/src/components/cacher/options/SqliteCacheOptions.cjs +77 -0
  46. package/src/components/cacher/options/SqliteCacheOptions.mjs +71 -0
  47. package/src/components/cacher/types/CacheStoreOptions.cjs +1 -0
  48. package/src/components/cacher/types/CacheStoreOptions.mjs +1 -0
  49. package/src/components/docker/ConnectionOptionsBuilder.cjs +19 -13
  50. package/src/components/docker/ConnectionOptionsBuilder.mjs +19 -13
  51. package/src/components/docker/Docker.cjs +19 -13
  52. package/src/components/docker/Docker.mjs +19 -13
  53. package/src/components/docker/lib/DockerContainer.cjs +26 -20
  54. package/src/components/docker/lib/DockerContainer.mjs +20 -14
  55. package/src/components/docker/lib/DockerContainerTTY.cjs +15 -9
  56. package/src/components/docker/lib/DockerContainerTTY.mjs +15 -9
  57. package/src/components/entrypoint/Entrypoint.cjs +1 -1
  58. package/src/components/entrypoint/Entrypoint.mjs +1 -1
  59. package/src/decorators/ctrl/CLIAction.cjs +1 -1
  60. package/src/decorators/ctrl/CLIAction.mjs +1 -1
  61. package/src/decorators/ctrl/HTTPAction.cjs +1 -1
  62. package/src/decorators/ctrl/HTTPAction.mjs +1 -1
  63. package/src/decorators/ctrl/ServiceAction.cjs +1 -1
  64. package/src/decorators/ctrl/ServiceAction.mjs +1 -1
  65. package/src/decorators/ctrl/http/DELETE.cjs +1 -1
  66. package/src/decorators/ctrl/http/DELETE.mjs +1 -1
  67. package/src/decorators/ctrl/http/GET.cjs +1 -1
  68. package/src/decorators/ctrl/http/GET.mjs +1 -1
  69. package/src/decorators/ctrl/http/HEAD.cjs +1 -1
  70. package/src/decorators/ctrl/http/HEAD.mjs +1 -1
  71. package/src/decorators/ctrl/http/OPTIONS.cjs +1 -1
  72. package/src/decorators/ctrl/http/OPTIONS.mjs +1 -1
  73. package/src/decorators/ctrl/http/PATCH.cjs +1 -1
  74. package/src/decorators/ctrl/http/PATCH.mjs +1 -1
  75. package/src/decorators/ctrl/http/POST.cjs +1 -1
  76. package/src/decorators/ctrl/http/POST.mjs +1 -1
  77. package/src/decorators/ctrl/http/PUT.cjs +1 -1
  78. package/src/decorators/ctrl/http/PUT.mjs +1 -1
  79. package/src/decorators/orm/AfterInsert.cjs +6 -2
  80. package/src/decorators/orm/AfterInsert.mjs +13 -9
  81. package/src/decorators/orm/AfterLoad.cjs +6 -2
  82. package/src/decorators/orm/AfterLoad.mjs +16 -12
  83. package/src/decorators/orm/AfterRecover.cjs +6 -2
  84. package/src/decorators/orm/AfterRecover.mjs +10 -6
  85. package/src/decorators/orm/AfterRemove.cjs +6 -2
  86. package/src/decorators/orm/AfterRemove.mjs +10 -6
  87. package/src/decorators/orm/AfterSoftRemove.cjs +6 -2
  88. package/src/decorators/orm/AfterSoftRemove.mjs +10 -6
  89. package/src/decorators/orm/AfterUpdate.cjs +6 -2
  90. package/src/decorators/orm/AfterUpdate.mjs +14 -10
  91. package/src/decorators/orm/BeforeInsert.cjs +6 -2
  92. package/src/decorators/orm/BeforeInsert.mjs +10 -6
  93. package/src/decorators/orm/BeforeRecover.cjs +13 -9
  94. package/src/decorators/orm/BeforeRecover.mjs +6 -2
  95. package/src/decorators/orm/BeforeRemove.cjs +13 -9
  96. package/src/decorators/orm/BeforeRemove.mjs +6 -2
  97. package/src/decorators/orm/BeforeSoftRemove.cjs +10 -6
  98. package/src/decorators/orm/BeforeSoftRemove.mjs +6 -2
  99. package/src/decorators/orm/BeforeUpdate.cjs +6 -2
  100. package/src/decorators/orm/BeforeUpdate.mjs +11 -7
  101. package/src/decorators/orm/Check.cjs +6 -2
  102. package/src/decorators/orm/Check.mjs +6 -2
  103. package/src/decorators/orm/ChildEntity.cjs +11 -7
  104. package/src/decorators/orm/ChildEntity.mjs +6 -2
  105. package/src/decorators/orm/Column.cjs +23 -19
  106. package/src/decorators/orm/Column.mjs +6 -2
  107. package/src/decorators/orm/CreateDateColumn.cjs +8 -4
  108. package/src/decorators/orm/CreateDateColumn.mjs +6 -2
  109. package/src/decorators/orm/DeleteDateColumn.cjs +6 -2
  110. package/src/decorators/orm/DeleteDateColumn.mjs +6 -2
  111. package/src/decorators/orm/Entity.cjs +6 -2
  112. package/src/decorators/orm/Entity.mjs +12 -8
  113. package/src/decorators/orm/EventSubscriber.cjs +6 -2
  114. package/src/decorators/orm/EventSubscriber.mjs +6 -2
  115. package/src/decorators/orm/Exclusion.cjs +6 -2
  116. package/src/decorators/orm/Exclusion.mjs +12 -8
  117. package/src/decorators/orm/Generated.cjs +10 -6
  118. package/src/decorators/orm/Generated.mjs +12 -8
  119. package/src/decorators/orm/Index.cjs +14 -10
  120. package/src/decorators/orm/Index.mjs +24 -20
  121. package/src/decorators/orm/JoinColumn.cjs +6 -2
  122. package/src/decorators/orm/JoinColumn.mjs +6 -2
  123. package/src/decorators/orm/JoinTable.cjs +6 -2
  124. package/src/decorators/orm/JoinTable.mjs +8 -4
  125. package/src/decorators/orm/ManyToMany.cjs +13 -9
  126. package/src/decorators/orm/ManyToMany.mjs +17 -13
  127. package/src/decorators/orm/ManyToOne.cjs +6 -2
  128. package/src/decorators/orm/ManyToOne.mjs +6 -2
  129. package/src/decorators/orm/ObjectIdColumn.cjs +6 -2
  130. package/src/decorators/orm/ObjectIdColumn.mjs +12 -8
  131. package/src/decorators/orm/OneToMany.cjs +14 -10
  132. package/src/decorators/orm/OneToMany.mjs +6 -2
  133. package/src/decorators/orm/OneToOne.cjs +15 -11
  134. package/src/decorators/orm/OneToOne.mjs +13 -9
  135. package/src/decorators/orm/PrimaryColumn.cjs +6 -2
  136. package/src/decorators/orm/PrimaryColumn.mjs +26 -22
  137. package/src/decorators/orm/PrimaryGeneratedColumn.cjs +6 -2
  138. package/src/decorators/orm/PrimaryGeneratedColumn.mjs +8 -4
  139. package/src/decorators/orm/RelationId.cjs +11 -7
  140. package/src/decorators/orm/RelationId.mjs +12 -8
  141. package/src/decorators/orm/TableInheritance.cjs +6 -2
  142. package/src/decorators/orm/TableInheritance.mjs +10 -6
  143. package/src/decorators/orm/Tree.cjs +6 -2
  144. package/src/decorators/orm/Tree.mjs +6 -2
  145. package/src/decorators/orm/TreeChildren.cjs +6 -2
  146. package/src/decorators/orm/TreeChildren.mjs +17 -13
  147. package/src/decorators/orm/TreeLevelColumn.cjs +6 -2
  148. package/src/decorators/orm/TreeLevelColumn.mjs +6 -2
  149. package/src/decorators/orm/TreeParent.cjs +12 -8
  150. package/src/decorators/orm/TreeParent.mjs +6 -2
  151. package/src/decorators/orm/Unique.cjs +6 -2
  152. package/src/decorators/orm/Unique.mjs +6 -2
  153. package/src/decorators/orm/UpdateDateColumn.cjs +8 -4
  154. package/src/decorators/orm/UpdateDateColumn.mjs +6 -2
  155. package/src/decorators/orm/VersionColumn.cjs +6 -2
  156. package/src/decorators/orm/VersionColumn.mjs +6 -2
  157. package/src/decorators/orm/ViewColumn.cjs +6 -2
  158. package/src/decorators/orm/ViewColumn.mjs +6 -2
  159. package/src/decorators/orm/ViewEntity.cjs +8 -4
  160. package/src/decorators/orm/ViewEntity.mjs +6 -2
  161. package/src/decorators/orm/VirtualColumn.cjs +6 -2
  162. package/src/decorators/orm/VirtualColumn.mjs +10 -6
  163. package/src/lib/base/internal/ControllerEntrypoint.cjs +1 -1
  164. package/src/lib/base/internal/ControllerEntrypoint.mjs +1 -1
  165. package/src/lib/core/Application.cjs +11 -7
  166. package/src/lib/core/Application.mjs +7 -3
  167. package/src/lib/core/Module.cjs +1 -1
  168. package/src/lib/core/Module.mjs +1 -1
  169. package/src/lib/helpers/NonceStr.cjs +1 -1
  170. package/src/lib/helpers/NonceStr.mjs +1 -1
  171. package/src/lib/helpers/ObjectHash.cjs +1 -1
  172. package/src/lib/helpers/ObjectHash.mjs +1 -1
  173. package/src/lib/helpers/RandomString.cjs +1 -1
  174. package/src/lib/helpers/RandomString.mjs +1 -1
  175. package/src/providers/Database.cjs +6 -2
  176. package/src/providers/Database.mjs +6 -2
  177. package/vendor/Package.112.cjs +5498 -5500
  178. package/vendor/Package.112.mjs +5504 -5506
  179. package/vendor/Package.12.cjs +4 -80
  180. package/vendor/Package.12.mjs +4 -74
  181. package/vendor/Package.122.cjs +87 -0
  182. package/vendor/Package.122.mjs +79 -0
  183. package/vendor/Package.13.cjs +1 -1
  184. package/vendor/Package.13.mjs +1 -1
  185. package/vendor/Package.14.cjs +1 -14055
  186. package/vendor/Package.14.mjs +1 -14029
  187. package/vendor/Package.15.cjs +12449 -46635
  188. package/vendor/Package.15.mjs +12435 -46611
  189. package/vendor/Package.16.cjs +3 -0
  190. package/vendor/Package.16.mjs +1 -0
  191. package/vendor/Package.17.cjs +48245 -0
  192. package/vendor/Package.17.mjs +48202 -0
  193. package/vendor/Package.18.cjs +3 -0
  194. package/vendor/Package.18.mjs +1 -0
  195. package/vendor/Package.19.cjs +4466 -0
  196. package/vendor/Package.19.mjs +4442 -0
  197. package/vendor/Package.610.cjs +196 -0
  198. package/vendor/Package.610.mjs +180 -0
  199. package/vendor/Package.62.cjs +1 -1
  200. package/vendor/Package.62.mjs +1 -1
  201. package/vendor/Package.65.cjs +860 -0
  202. package/vendor/Package.65.mjs +832 -0
  203. package/vendor/Package.66.cjs +321 -0
  204. package/vendor/Package.66.mjs +305 -0
  205. package/vendor/Package.67.cjs +341 -0
  206. package/vendor/Package.67.mjs +327 -0
  207. package/vendor/Package.68.cjs +333 -0
  208. package/vendor/Package.68.mjs +315 -0
  209. package/vendor/Package.69.cjs +353 -0
  210. package/vendor/Package.69.mjs +335 -0
@@ -0,0 +1,353 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, {
4
+ value: "Module"
5
+ });
6
+
7
+ const e = require("events");
8
+
9
+ const r = require("./Package.19.cjs");
10
+
11
+ const s = require("pg");
12
+
13
+ require("./Package.1.cjs");
14
+
15
+ require("buffer");
16
+
17
+ require("./Package.5.cjs");
18
+
19
+ require("./Package.12.cjs");
20
+
21
+ require("./Package.8.cjs");
22
+
23
+ require("os");
24
+
25
+ require("path");
26
+
27
+ require("stream");
28
+
29
+ require("fs");
30
+
31
+ require("./Package.18.cjs");
32
+
33
+ require("constants");
34
+
35
+ require("./Package.10.cjs");
36
+
37
+ require("url");
38
+
39
+ require("util");
40
+
41
+ require("./Package.16.cjs");
42
+
43
+ require("assert");
44
+
45
+ require("./Package.13.cjs");
46
+
47
+ require("../src/components/cacher/options/CacherOptions.cjs");
48
+
49
+ require("./Package.2.cjs");
50
+
51
+ require("../src/lib/base/internal/DataValidator.cjs");
52
+
53
+ require("./Package.4.cjs");
54
+
55
+ require("node:util/types");
56
+
57
+ require("../src/lib/validation/VLD.cjs");
58
+
59
+ require("../src/exceptions/dto/InvalidValueException.cjs");
60
+
61
+ require("../src/lib/base/abstracts/Exception.cjs");
62
+
63
+ require("../src/lib/base/internal/BasicInfo.cjs");
64
+
65
+ require("../src/lib/helpers/As.cjs");
66
+
67
+ require("./Package.6.cjs");
68
+
69
+ require("./Package.7.cjs");
70
+
71
+ require("../src/lib/base/internal/ThrowWarning.cjs");
72
+
73
+ require("../src/lib/helpers/Templating.cjs");
74
+
75
+ require("../src/lib/base/internal/CamelCase.cjs");
76
+
77
+ require("../src/lib/helpers/NoCase.cjs");
78
+
79
+ require("./Package.9.cjs");
80
+
81
+ require("../src/lib/helpers/IsHtml.cjs");
82
+
83
+ require("../src/lib/helpers/IsXML.cjs");
84
+
85
+ require("../src/constants/DTOMetadataKey.cjs");
86
+
87
+ require("../src/lib/helpers/ObjectConstructor.cjs");
88
+
89
+ require("../src/lib/helpers/ObjectParentConstructors.cjs");
90
+
91
+ require("../src/lib/helpers/ObjectParentConstructor.cjs");
92
+
93
+ require("../src/lib/helpers/ObjectPrototype.cjs");
94
+
95
+ require("../src/decorators/dto/Expect.cjs");
96
+
97
+ require("../src/components/cacher/options/FileCacheOptions.cjs");
98
+
99
+ require("../src/components/cacher/options/MemcacheCacheOptions.cjs");
100
+
101
+ require("../src/components/cacher/options/MongoCacheOptions.cjs");
102
+
103
+ require("../src/components/cacher/options/PostgresCacheOptions.cjs");
104
+
105
+ require("../src/components/cacher/options/MysqlCacheOptions.cjs");
106
+
107
+ require("../src/components/cacher/options/SqliteCacheOptions.cjs");
108
+
109
+ require("../src/components/cacher/options/RedisCacheOptions.cjs");
110
+
111
+ require("../src/lib/core/Component.cjs");
112
+
113
+ require("./Package.3.cjs");
114
+
115
+ require("../src/lib/base/async-constructor/AsyncConstructor.cjs");
116
+
117
+ require("../src/lib/base/async-constructor/Append.cjs");
118
+
119
+ require("../src/lib/helpers/IsPromiseLike.cjs");
120
+
121
+ require("../src/lib/helpers/IsPromise.cjs");
122
+
123
+ require("util/types");
124
+
125
+ require("../src/decorators/di/Lifetime.cjs");
126
+
127
+ require("../src/lib/base/internal/ObjectLifetime.cjs");
128
+
129
+ require("../src/constants/DIMetadataKey.cjs");
130
+
131
+ require("../src/exceptions/di/LifetimeLockedException.cjs");
132
+
133
+ require("../src/exceptions/MethodNotFoundException.cjs");
134
+
135
+ require("../src/lib/ioc/DependencyInjectionContainer.cjs");
136
+
137
+ require("../src/lib/ioc/Errors.cjs");
138
+
139
+ require("../src/exceptions/di/DependencyInjectionException.cjs");
140
+
141
+ require("../src/lib/base/internal/ConstructorSymbol.cjs");
142
+
143
+ require("node:crypto");
144
+
145
+ require("../src/lib/ioc/InjectionMode.cjs");
146
+
147
+ require("../src/lib/ioc/Lifetime.cjs");
148
+
149
+ require("../src/lib/ioc/ListModules.cjs");
150
+
151
+ require("../src/lib/ioc/Utils.cjs");
152
+
153
+ require("../src/lib/ioc/FunctionTokenizer.cjs");
154
+
155
+ require("../src/lib/ioc/LoadModules.cjs");
156
+
157
+ require("../src/lib/ioc/Resolvers.cjs");
158
+
159
+ require("../src/lib/ioc/ParamParser.cjs");
160
+
161
+ require("../src/lib/base/internal/ObjectWeakRefs.cjs");
162
+
163
+ require("../src/lib/base/internal/ConfigurableRecordsInjection.cjs");
164
+
165
+ require("../src/lib/base/internal/ObjectConfiguration.cjs");
166
+
167
+ require("../src/lib/base/internal/ObjectInjection.cjs");
168
+
169
+ require("../src/lib/base/internal/ObjectContainer.cjs");
170
+
171
+ require("../src/lib/helpers/DevNull.cjs");
172
+
173
+ require("../src/decorators/dto/IndexSignature.cjs");
174
+
175
+ require("../src/decorators/dto/Accept.cjs");
176
+
177
+ require("../src/lib/base/internal/MethodValidation.cjs");
178
+
179
+ require("../src/exceptions/dto/InvalidMethodAcceptException.cjs");
180
+
181
+ require("../src/exceptions/dto/InvalidMethodReturnException.cjs");
182
+
183
+ require("../src/lib/helpers/IsEmptyObject.cjs");
184
+
185
+ require("../src/lib/base/EventEmitter.cjs");
186
+
187
+ require("../src/lib/core/Provider.cjs");
188
+
189
+ require("../src/decorators/di/Configurable.cjs");
190
+
191
+ require("../src/lib/helpers/URLBuilder.cjs");
192
+
193
+ const t = e => e && e.__esModule ? e : {
194
+ default: e
195
+ };
196
+
197
+ const c = t(e);
198
+
199
+ const i = t(s);
200
+
201
+ var o;
202
+
203
+ var a;
204
+
205
+ var n = (e, r = {}) => {
206
+ if (a !== e) {
207
+ o = void 0;
208
+ a = e;
209
+ }
210
+ o ??= new i.default.Pool({
211
+ connectionString: e,
212
+ ...r
213
+ });
214
+ return o;
215
+ };
216
+
217
+ var u = async () => {
218
+ await o.end();
219
+ a = void 0;
220
+ };
221
+
222
+ var l = class extends c.default {
223
+ ttlSupport;
224
+ opts;
225
+ query;
226
+ namespace;
227
+ constructor(e) {
228
+ super();
229
+ this.ttlSupport = false;
230
+ if (typeof e === "string") {
231
+ const r = e;
232
+ e = {
233
+ dialect: "postgres",
234
+ uri: r
235
+ };
236
+ } else {
237
+ e = {
238
+ dialect: "postgres",
239
+ uri: "postgresql://localhost:5432",
240
+ ...e
241
+ };
242
+ }
243
+ const r = async () => {
244
+ const r = n(e.uri, e);
245
+ return async (e, s) => {
246
+ const t = await r.query(e, s);
247
+ return t.rows;
248
+ };
249
+ };
250
+ this.opts = {
251
+ table: "keyv",
252
+ schema: "public",
253
+ keySize: 255,
254
+ ...e
255
+ };
256
+ let s = `CREATE${this.opts.useUnloggedTable ? " UNLOGGED " : " "}TABLE IF NOT EXISTS ${this.opts.schema}.${this.opts.table}(key VARCHAR(${Number(this.opts.keySize)}) PRIMARY KEY, value TEXT )`;
257
+ if (this.opts.schema !== "public") {
258
+ s = `CREATE SCHEMA IF NOT EXISTS ${this.opts.schema}; ${s}`;
259
+ }
260
+ const t = r().then((async e => {
261
+ try {
262
+ await e(s);
263
+ } catch (r) {
264
+ if (r.code !== "23505") {
265
+ this.emit("error", r);
266
+ }
267
+ return e;
268
+ }
269
+ return e;
270
+ })).catch((e => this.emit("error", e)));
271
+ this.query = async (e, r) => t.then((s => s(e, r)));
272
+ }
273
+ async get(e) {
274
+ const r = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1`;
275
+ const s = await this.query(r, [ e ]);
276
+ const t = s[0];
277
+ return t === void 0 ? void 0 : t.value;
278
+ }
279
+ async getMany(e) {
280
+ const r = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
281
+ const s = await this.query(r, [ e ]);
282
+ const t = [];
283
+ for (const r of e) {
284
+ const e = s?.findIndex((e => e.key === r));
285
+ t.push(e > -1 ? s[e].value : void 0);
286
+ }
287
+ return t;
288
+ }
289
+ async set(e, r) {
290
+ const s = `INSERT INTO ${this.opts.schema}.${this.opts.table} (key, value)\n VALUES($1, $2) \n ON CONFLICT(key) \n DO UPDATE SET value=excluded.value;`;
291
+ await this.query(s, [ e, r ]);
292
+ }
293
+ async delete(e) {
294
+ const r = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1`;
295
+ const s = `DELETE FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1`;
296
+ const t = await this.query(r, [ e ]);
297
+ if (t[0] === void 0) {
298
+ return false;
299
+ }
300
+ await this.query(s, [ e ]);
301
+ return true;
302
+ }
303
+ async deleteMany(e) {
304
+ const r = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
305
+ const s = `DELETE FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
306
+ const t = await this.query(r, [ e ]);
307
+ if (t[0] === void 0) {
308
+ return false;
309
+ }
310
+ await this.query(s, [ e ]);
311
+ return true;
312
+ }
313
+ async clear() {
314
+ const e = `DELETE FROM ${this.opts.schema}.${this.opts.table} WHERE key LIKE $1`;
315
+ await this.query(e, [ this.namespace ? `${this.namespace}:%` : "%" ]);
316
+ }
317
+ async* iterator(e) {
318
+ const r = Number.parseInt(String(this.opts.iterationLimit), 10) || 10;
319
+ async function* s(t, c, i) {
320
+ const o = `SELECT * FROM ${c.schema}.${c.table} WHERE key LIKE $1 LIMIT $2 OFFSET $3`;
321
+ const a = await i(o, [ `${e ? e + ":" : ""}%`, r, t ]);
322
+ if (a.length === 0) {
323
+ return;
324
+ }
325
+ for (const e of a) {
326
+ t += 1;
327
+ yield [ e.key, e.value ];
328
+ }
329
+ yield* s(t, c, i);
330
+ }
331
+ yield* s(0, this.opts, this.query);
332
+ }
333
+ async has(e) {
334
+ const r = `SELECT EXISTS ( SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1 )`;
335
+ const s = await this.query(r, [ e ]);
336
+ return s[0].exists;
337
+ }
338
+ async disconnect() {
339
+ await u();
340
+ }
341
+ };
342
+
343
+ var p = e => new r.index_default({
344
+ store: new l(e)
345
+ });
346
+
347
+ var q = l;
348
+
349
+ exports.KeyvPostgres = l;
350
+
351
+ exports.createKeyv = p;
352
+
353
+ exports.default = q;
@@ -0,0 +1,335 @@
1
+ import t from "events";
2
+
3
+ import { i as s } from "./Package.19.mjs";
4
+
5
+ import e from "pg";
6
+
7
+ import "./Package.1.mjs";
8
+
9
+ import "buffer";
10
+
11
+ import "./Package.5.mjs";
12
+
13
+ import "./Package.12.mjs";
14
+
15
+ import "./Package.8.mjs";
16
+
17
+ import "os";
18
+
19
+ import "path";
20
+
21
+ import "stream";
22
+
23
+ import "fs";
24
+
25
+ import "./Package.18.mjs";
26
+
27
+ import "constants";
28
+
29
+ import "./Package.10.mjs";
30
+
31
+ import "url";
32
+
33
+ import "util";
34
+
35
+ import "./Package.16.mjs";
36
+
37
+ import "assert";
38
+
39
+ import "./Package.13.mjs";
40
+
41
+ import "../src/components/cacher/options/CacherOptions.mjs";
42
+
43
+ import "./Package.2.mjs";
44
+
45
+ import "../src/lib/base/internal/DataValidator.mjs";
46
+
47
+ import "./Package.4.mjs";
48
+
49
+ import "node:util/types";
50
+
51
+ import "../src/lib/validation/VLD.mjs";
52
+
53
+ import "../src/exceptions/dto/InvalidValueException.mjs";
54
+
55
+ import "../src/lib/base/abstracts/Exception.mjs";
56
+
57
+ import "../src/lib/base/internal/BasicInfo.mjs";
58
+
59
+ import "../src/lib/helpers/As.mjs";
60
+
61
+ import "./Package.6.mjs";
62
+
63
+ import "./Package.7.mjs";
64
+
65
+ import "../src/lib/base/internal/ThrowWarning.mjs";
66
+
67
+ import "../src/lib/helpers/Templating.mjs";
68
+
69
+ import "../src/lib/base/internal/CamelCase.mjs";
70
+
71
+ import "../src/lib/helpers/NoCase.mjs";
72
+
73
+ import "./Package.9.mjs";
74
+
75
+ import "../src/lib/helpers/IsHtml.mjs";
76
+
77
+ import "../src/lib/helpers/IsXML.mjs";
78
+
79
+ import "../src/constants/DTOMetadataKey.mjs";
80
+
81
+ import "../src/lib/helpers/ObjectConstructor.mjs";
82
+
83
+ import "../src/lib/helpers/ObjectParentConstructors.mjs";
84
+
85
+ import "../src/lib/helpers/ObjectParentConstructor.mjs";
86
+
87
+ import "../src/lib/helpers/ObjectPrototype.mjs";
88
+
89
+ import "../src/decorators/dto/Expect.mjs";
90
+
91
+ import "../src/components/cacher/options/FileCacheOptions.mjs";
92
+
93
+ import "../src/components/cacher/options/MemcacheCacheOptions.mjs";
94
+
95
+ import "../src/components/cacher/options/MongoCacheOptions.mjs";
96
+
97
+ import "../src/components/cacher/options/PostgresCacheOptions.mjs";
98
+
99
+ import "../src/components/cacher/options/MysqlCacheOptions.mjs";
100
+
101
+ import "../src/components/cacher/options/SqliteCacheOptions.mjs";
102
+
103
+ import "../src/components/cacher/options/RedisCacheOptions.mjs";
104
+
105
+ import "../src/lib/core/Component.mjs";
106
+
107
+ import "./Package.3.mjs";
108
+
109
+ import "../src/lib/base/async-constructor/AsyncConstructor.mjs";
110
+
111
+ import "../src/lib/base/async-constructor/Append.mjs";
112
+
113
+ import "../src/lib/helpers/IsPromiseLike.mjs";
114
+
115
+ import "../src/lib/helpers/IsPromise.mjs";
116
+
117
+ import "util/types";
118
+
119
+ import "../src/decorators/di/Lifetime.mjs";
120
+
121
+ import "../src/lib/base/internal/ObjectLifetime.mjs";
122
+
123
+ import "../src/constants/DIMetadataKey.mjs";
124
+
125
+ import "../src/exceptions/di/LifetimeLockedException.mjs";
126
+
127
+ import "../src/exceptions/MethodNotFoundException.mjs";
128
+
129
+ import "../src/lib/ioc/DependencyInjectionContainer.mjs";
130
+
131
+ import "../src/lib/ioc/Errors.mjs";
132
+
133
+ import "../src/exceptions/di/DependencyInjectionException.mjs";
134
+
135
+ import "../src/lib/base/internal/ConstructorSymbol.mjs";
136
+
137
+ import "node:crypto";
138
+
139
+ import "../src/lib/ioc/InjectionMode.mjs";
140
+
141
+ import "../src/lib/ioc/Lifetime.mjs";
142
+
143
+ import "../src/lib/ioc/ListModules.mjs";
144
+
145
+ import "../src/lib/ioc/Utils.mjs";
146
+
147
+ import "../src/lib/ioc/FunctionTokenizer.mjs";
148
+
149
+ import "../src/lib/ioc/LoadModules.mjs";
150
+
151
+ import "../src/lib/ioc/Resolvers.mjs";
152
+
153
+ import "../src/lib/ioc/ParamParser.mjs";
154
+
155
+ import "../src/lib/base/internal/ObjectWeakRefs.mjs";
156
+
157
+ import "../src/lib/base/internal/ConfigurableRecordsInjection.mjs";
158
+
159
+ import "../src/lib/base/internal/ObjectConfiguration.mjs";
160
+
161
+ import "../src/lib/base/internal/ObjectInjection.mjs";
162
+
163
+ import "../src/lib/base/internal/ObjectContainer.mjs";
164
+
165
+ import "../src/lib/helpers/DevNull.mjs";
166
+
167
+ import "../src/decorators/dto/IndexSignature.mjs";
168
+
169
+ import "../src/decorators/dto/Accept.mjs";
170
+
171
+ import "../src/lib/base/internal/MethodValidation.mjs";
172
+
173
+ import "../src/exceptions/dto/InvalidMethodAcceptException.mjs";
174
+
175
+ import "../src/exceptions/dto/InvalidMethodReturnException.mjs";
176
+
177
+ import "../src/lib/helpers/IsEmptyObject.mjs";
178
+
179
+ import "../src/lib/base/EventEmitter.mjs";
180
+
181
+ import "../src/lib/core/Provider.mjs";
182
+
183
+ import "../src/decorators/di/Configurable.mjs";
184
+
185
+ import "../src/lib/helpers/URLBuilder.mjs";
186
+
187
+ var i;
188
+
189
+ var r;
190
+
191
+ var o = (t, s = {}) => {
192
+ if (r !== t) {
193
+ i = void 0;
194
+ r = t;
195
+ }
196
+ i ??= new e.Pool({
197
+ connectionString: t,
198
+ ...s
199
+ });
200
+ return i;
201
+ };
202
+
203
+ var c = async () => {
204
+ await i.end();
205
+ r = void 0;
206
+ };
207
+
208
+ var a = class extends t {
209
+ ttlSupport;
210
+ opts;
211
+ query;
212
+ namespace;
213
+ constructor(t) {
214
+ super();
215
+ this.ttlSupport = false;
216
+ if (typeof t === "string") {
217
+ const s = t;
218
+ t = {
219
+ dialect: "postgres",
220
+ uri: s
221
+ };
222
+ } else {
223
+ t = {
224
+ dialect: "postgres",
225
+ uri: "postgresql://localhost:5432",
226
+ ...t
227
+ };
228
+ }
229
+ const s = async () => {
230
+ const s = o(t.uri, t);
231
+ return async (t, e) => {
232
+ const i = await s.query(t, e);
233
+ return i.rows;
234
+ };
235
+ };
236
+ this.opts = {
237
+ table: "keyv",
238
+ schema: "public",
239
+ keySize: 255,
240
+ ...t
241
+ };
242
+ let e = `CREATE${this.opts.useUnloggedTable ? " UNLOGGED " : " "}TABLE IF NOT EXISTS ${this.opts.schema}.${this.opts.table}(key VARCHAR(${Number(this.opts.keySize)}) PRIMARY KEY, value TEXT )`;
243
+ if (this.opts.schema !== "public") {
244
+ e = `CREATE SCHEMA IF NOT EXISTS ${this.opts.schema}; ${e}`;
245
+ }
246
+ const i = s().then((async t => {
247
+ try {
248
+ await t(e);
249
+ } catch (s) {
250
+ if (s.code !== "23505") {
251
+ this.emit("error", s);
252
+ }
253
+ return t;
254
+ }
255
+ return t;
256
+ })).catch((t => this.emit("error", t)));
257
+ this.query = async (t, s) => i.then((e => e(t, s)));
258
+ }
259
+ async get(t) {
260
+ const s = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1`;
261
+ const e = await this.query(s, [ t ]);
262
+ const i = e[0];
263
+ return i === void 0 ? void 0 : i.value;
264
+ }
265
+ async getMany(t) {
266
+ const s = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
267
+ const e = await this.query(s, [ t ]);
268
+ const i = [];
269
+ for (const s of t) {
270
+ const t = e?.findIndex((t => t.key === s));
271
+ i.push(t > -1 ? e[t].value : void 0);
272
+ }
273
+ return i;
274
+ }
275
+ async set(t, s) {
276
+ const e = `INSERT INTO ${this.opts.schema}.${this.opts.table} (key, value)\n VALUES($1, $2) \n ON CONFLICT(key) \n DO UPDATE SET value=excluded.value;`;
277
+ await this.query(e, [ t, s ]);
278
+ }
279
+ async delete(t) {
280
+ const s = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1`;
281
+ const e = `DELETE FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1`;
282
+ const i = await this.query(s, [ t ]);
283
+ if (i[0] === void 0) {
284
+ return false;
285
+ }
286
+ await this.query(e, [ t ]);
287
+ return true;
288
+ }
289
+ async deleteMany(t) {
290
+ const s = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
291
+ const e = `DELETE FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
292
+ const i = await this.query(s, [ t ]);
293
+ if (i[0] === void 0) {
294
+ return false;
295
+ }
296
+ await this.query(e, [ t ]);
297
+ return true;
298
+ }
299
+ async clear() {
300
+ const t = `DELETE FROM ${this.opts.schema}.${this.opts.table} WHERE key LIKE $1`;
301
+ await this.query(t, [ this.namespace ? `${this.namespace}:%` : "%" ]);
302
+ }
303
+ async* iterator(t) {
304
+ const s = Number.parseInt(String(this.opts.iterationLimit), 10) || 10;
305
+ async function* e(i, r, o) {
306
+ const c = `SELECT * FROM ${r.schema}.${r.table} WHERE key LIKE $1 LIMIT $2 OFFSET $3`;
307
+ const a = await o(c, [ `${t ? t + ":" : ""}%`, s, i ]);
308
+ if (a.length === 0) {
309
+ return;
310
+ }
311
+ for (const t of a) {
312
+ i += 1;
313
+ yield [ t.key, t.value ];
314
+ }
315
+ yield* e(i, r, o);
316
+ }
317
+ yield* e(0, this.opts, this.query);
318
+ }
319
+ async has(t) {
320
+ const s = `SELECT EXISTS ( SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = $1 )`;
321
+ const e = await this.query(s, [ t ]);
322
+ return e[0].exists;
323
+ }
324
+ async disconnect() {
325
+ await c();
326
+ }
327
+ };
328
+
329
+ var m = t => new s({
330
+ store: new a(t)
331
+ });
332
+
333
+ var n = a;
334
+
335
+ export { a as KeyvPostgres, m as createKeyv, n as default };