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,514 @@
1
+ import '../vendor/TypeDef.2.js';
2
+ import EventEmitter from 'node:events';
3
+ import { D as DTO } from '../vendor/TypeDef.5.js';
4
+ import { C as Component } from '../vendor/TypeDef.3.js';
5
+
6
+ type EventListener = (...arguments_: any[]) => void;
7
+ declare class EventManager {
8
+ _eventListeners: Map<string, EventListener[]>;
9
+ _maxListeners: number;
10
+ constructor();
11
+ maxListeners(): number;
12
+ addListener(event: string, listener: EventListener): void;
13
+ on(event: string, listener: EventListener): this;
14
+ removeListener(event: string, listener: EventListener): void;
15
+ off(event: string, listener: EventListener): void;
16
+ once(event: string, listener: EventListener): void;
17
+ emit(event: string, ...arguments_: any[]): void;
18
+ listeners(event: string): EventListener[];
19
+ removeAllListeners(event?: string): void;
20
+ setMaxListeners(n: number): void;
21
+ }
22
+
23
+ type HookHandler = (...arguments_: any[]) => void;
24
+ declare class HooksManager extends EventManager {
25
+ _hookHandlers: Map<string, HookHandler[]>;
26
+ constructor();
27
+ addHandler(event: string, handler: HookHandler): void;
28
+ removeHandler(event: string, handler: HookHandler): void;
29
+ trigger(event: string, data: any): void;
30
+ get handlers(): Map<string, HookHandler[]>;
31
+ }
32
+
33
+ declare class StatsManager extends EventManager {
34
+ enabled: boolean;
35
+ hits: number;
36
+ misses: number;
37
+ sets: number;
38
+ deletes: number;
39
+ errors: number;
40
+ constructor(enabled?: boolean);
41
+ hit(): void;
42
+ miss(): void;
43
+ set(): void;
44
+ delete(): void;
45
+ reset(): void;
46
+ }
47
+
48
+ type DeserializedData<Value> = {
49
+ value?: Value;
50
+ expires?: number | undefined;
51
+ };
52
+ type CompressionAdapter = {
53
+ compress(value: any, options?: any): Promise<any>;
54
+ decompress(value: any, options?: any): Promise<any>;
55
+ serialize<Value>(data: DeserializedData<Value>): Promise<string> | string;
56
+ deserialize<Value>(data: string): Promise<DeserializedData<Value> | undefined> | DeserializedData<Value> | undefined;
57
+ };
58
+ type Serialize = <Value>(data: DeserializedData<Value>) => Promise<string> | string;
59
+ type Deserialize = <Value>(data: string) => Promise<DeserializedData<Value> | undefined> | DeserializedData<Value> | undefined;
60
+ type KeyvEntry = {
61
+ /**
62
+ * Key to set.
63
+ */
64
+ key: string;
65
+ /**
66
+ * Value to set.
67
+ */
68
+ value: any;
69
+ /**
70
+ * Time to live in milliseconds.
71
+ */
72
+ ttl?: number;
73
+ };
74
+ type StoredDataNoRaw<Value> = Value | undefined;
75
+ type StoredDataRaw<Value> = DeserializedData<Value> | undefined;
76
+ type StoredData<Value> = StoredDataNoRaw<Value> | StoredDataRaw<Value>;
77
+ type IEventEmitter = {
78
+ on(event: string, listener: (...arguments_: any[]) => void): IEventEmitter;
79
+ };
80
+ type KeyvStoreAdapter = {
81
+ opts: any;
82
+ namespace?: string;
83
+ get<Value>(key: string): Promise<StoredData<Value> | undefined>;
84
+ set(key: string, value: any, ttl?: number): any;
85
+ setMany?(values: Array<{
86
+ key: string;
87
+ value: any;
88
+ ttl?: number;
89
+ }>): Promise<void>;
90
+ delete(key: string): Promise<boolean>;
91
+ clear(): Promise<void>;
92
+ has?(key: string): Promise<boolean>;
93
+ hasMany?(keys: string[]): Promise<boolean[]>;
94
+ getMany?<Value>(keys: string[]): Promise<Array<StoredData<Value | undefined>>>;
95
+ disconnect?(): Promise<void>;
96
+ deleteMany?(key: string[]): Promise<boolean>;
97
+ iterator?<Value>(namespace?: string): AsyncGenerator<Array<string | Awaited<Value> | undefined>, void>;
98
+ } & IEventEmitter;
99
+ type KeyvOptions = {
100
+ /** Emit errors */
101
+ emitErrors?: boolean;
102
+ /** Namespace for the current instance. */
103
+ namespace?: string;
104
+ /** A custom serialization function. */
105
+ serialize?: Serialize;
106
+ /** A custom deserialization function. */
107
+ deserialize?: Deserialize;
108
+ /** The storage adapter instance to be used by Keyv. */
109
+ store?: KeyvStoreAdapter | Map<any, any> | any;
110
+ /** Default TTL. Can be overridden by specifying a TTL on `.set()`. */
111
+ ttl?: number;
112
+ /** Enable compression option **/
113
+ compression?: CompressionAdapter | any;
114
+ /** Enable or disable statistics (default is false) */
115
+ stats?: boolean;
116
+ /** Enable or disable key prefixing (default is true) */
117
+ useKeyPrefix?: boolean;
118
+ };
119
+ type KeyvOptions_ = Omit<KeyvOptions, 'store'> & {
120
+ store: KeyvStoreAdapter | Map<any, any> & KeyvStoreAdapter;
121
+ };
122
+ type IteratorFunction = (argument: any) => AsyncGenerator<any, void>;
123
+ declare class Keyv<GenericValue = any> extends EventManager {
124
+ opts: KeyvOptions_;
125
+ iterator?: IteratorFunction;
126
+ hooks: HooksManager;
127
+ stats: StatsManager;
128
+ /**
129
+ * Time to live in milliseconds
130
+ */
131
+ private _ttl?;
132
+ /**
133
+ * Namespace
134
+ */
135
+ private _namespace?;
136
+ /**
137
+ * Store
138
+ */
139
+ private _store;
140
+ private _serialize;
141
+ private _deserialize;
142
+ private _compression;
143
+ private _useKeyPrefix;
144
+ /**
145
+ * Keyv Constructor
146
+ * @param {KeyvStoreAdapter | KeyvOptions | Map<any, any>} store to be provided or just the options
147
+ * @param {Omit<KeyvOptions, 'store'>} [options] if you provide the store you can then provide the Keyv Options
148
+ */
149
+ constructor(store?: KeyvStoreAdapter | KeyvOptions | Map<any, any>, options?: Omit<KeyvOptions, 'store'>);
150
+ /**
151
+ * Keyv Constructor
152
+ * @param {KeyvOptions} options to be provided
153
+ */
154
+ constructor(options?: KeyvOptions);
155
+ /**
156
+ * Get the current store
157
+ */
158
+ get store(): KeyvStoreAdapter | Map<any, any> | any;
159
+ /**
160
+ * Set the current store. This will also set the namespace, event error handler, and generate the iterator. If the store is not valid it will throw an error.
161
+ * @param {KeyvStoreAdapter | Map<any, any> | any} store the store to set
162
+ */
163
+ set store(store: KeyvStoreAdapter | Map<any, any> | any);
164
+ /**
165
+ * Get the current compression function
166
+ * @returns {CompressionAdapter} The current compression function
167
+ */
168
+ get compression(): CompressionAdapter | undefined;
169
+ /**
170
+ * Set the current compression function
171
+ * @param {CompressionAdapter} compress The compression function to set
172
+ */
173
+ set compression(compress: CompressionAdapter | undefined);
174
+ /**
175
+ * Get the current namespace.
176
+ * @returns {string | undefined} The current namespace.
177
+ */
178
+ get namespace(): string | undefined;
179
+ /**
180
+ * Set the current namespace.
181
+ * @param {string | undefined} namespace The namespace to set.
182
+ */
183
+ set namespace(namespace: string | undefined);
184
+ /**
185
+ * Get the current TTL.
186
+ * @returns {number} The current TTL.
187
+ */
188
+ get ttl(): number | undefined;
189
+ /**
190
+ * Set the current TTL.
191
+ * @param {number} ttl The TTL to set.
192
+ */
193
+ set ttl(ttl: number | undefined);
194
+ /**
195
+ * Get the current serialize function.
196
+ * @returns {Serialize} The current serialize function.
197
+ */
198
+ get serialize(): Serialize | undefined;
199
+ /**
200
+ * Set the current serialize function.
201
+ * @param {Serialize} serialize The serialize function to set.
202
+ */
203
+ set serialize(serialize: Serialize | undefined);
204
+ /**
205
+ * Get the current deserialize function.
206
+ * @returns {Deserialize} The current deserialize function.
207
+ */
208
+ get deserialize(): Deserialize | undefined;
209
+ /**
210
+ * Set the current deserialize function.
211
+ * @param {Deserialize} deserialize The deserialize function to set.
212
+ */
213
+ set deserialize(deserialize: Deserialize | undefined);
214
+ /**
215
+ * Get the current useKeyPrefix value. This will enable or disable key prefixing.
216
+ * @returns {boolean} The current useKeyPrefix value.
217
+ * @default true
218
+ */
219
+ get useKeyPrefix(): boolean;
220
+ /**
221
+ * Set the current useKeyPrefix value. This will enable or disable key prefixing.
222
+ * @param {boolean} value The useKeyPrefix value to set.
223
+ */
224
+ set useKeyPrefix(value: boolean);
225
+ generateIterator(iterator: IteratorFunction): IteratorFunction;
226
+ _checkIterableAdapter(): boolean;
227
+ _getKeyPrefix(key: string): string;
228
+ _getKeyPrefixArray(keys: string[]): string[];
229
+ _getKeyUnprefix(key: string): string;
230
+ _isValidStorageAdapter(store: KeyvStoreAdapter | any): boolean;
231
+ /**
232
+ * Get the Value of a Key
233
+ * @param {string | string[]} key passing in a single key or multiple as an array
234
+ * @param {{raw: boolean} | undefined} options can pass in to return the raw value by setting { raw: true }
235
+ */
236
+ get<Value = GenericValue>(key: string, options?: {
237
+ raw: false;
238
+ }): Promise<StoredDataNoRaw<Value>>;
239
+ get<Value = GenericValue>(key: string, options?: {
240
+ raw: true;
241
+ }): Promise<StoredDataRaw<Value>>;
242
+ get<Value = GenericValue>(key: string[], options?: {
243
+ raw: false;
244
+ }): Promise<Array<StoredDataNoRaw<Value>>>;
245
+ get<Value = GenericValue>(key: string[], options?: {
246
+ raw: true;
247
+ }): Promise<Array<StoredDataRaw<Value>>>;
248
+ /**
249
+ * Get many values of keys
250
+ * @param {string[]} keys passing in a single key or multiple as an array
251
+ * @param {{raw: boolean} | undefined} options can pass in to return the raw value by setting { raw: true }
252
+ */
253
+ getMany<Value = GenericValue>(keys: string[], options?: {
254
+ raw: false;
255
+ }): Promise<Array<StoredDataNoRaw<Value>>>;
256
+ getMany<Value = GenericValue>(keys: string[], options?: {
257
+ raw: true;
258
+ }): Promise<Array<StoredDataRaw<Value>>>;
259
+ /**
260
+ * Set an item to the store
261
+ * @param {string | Array<KeyvEntry>} key the key to use. If you pass in an array of KeyvEntry it will set many items
262
+ * @param {Value} value the value of the key
263
+ * @param {number} [ttl] time to live in milliseconds
264
+ * @returns {boolean} if it sets then it will return a true. On failure will return false.
265
+ */
266
+ set<Value = GenericValue>(key: string, value: Value, ttl?: number): Promise<boolean>;
267
+ /**
268
+ * Set many items to the store
269
+ * @param {Array<KeyvEntry>} entries the entries to set
270
+ * @returns {boolean[]} will return an array of booleans if it sets then it will return a true. On failure will return false.
271
+ */
272
+ setMany<Value = GenericValue>(entries: KeyvEntry[]): Promise<boolean[]>;
273
+ /**
274
+ * Delete an Entry
275
+ * @param {string | string[]} key the key to be deleted. if an array it will delete many items
276
+ * @returns {boolean} will return true if item or items are deleted. false if there is an error
277
+ */
278
+ delete(key: string | string[]): Promise<boolean>;
279
+ /**
280
+ * Delete many items from the store
281
+ * @param {string[]} keys the keys to be deleted
282
+ * @returns {boolean} will return true if item or items are deleted. false if there is an error
283
+ */
284
+ deleteMany(keys: string[]): Promise<boolean>;
285
+ /**
286
+ * Clear the store
287
+ * @returns {void}
288
+ */
289
+ clear(): Promise<void>;
290
+ /**
291
+ * Has a key
292
+ * @param {string} key the key to check
293
+ * @returns {boolean} will return true if the key exists
294
+ */
295
+ has(key: string[]): Promise<boolean[]>;
296
+ has(key: string): Promise<boolean>;
297
+ /**
298
+ * Check if many keys exist
299
+ * @param {string[]} keys the keys to check
300
+ * @returns {boolean[]} will return an array of booleans if the keys exist
301
+ */
302
+ hasMany(keys: string[]): Promise<boolean[]>;
303
+ /**
304
+ * Will disconnect the store. This is only available if the store has a disconnect method
305
+ * @returns {Promise<void>}
306
+ */
307
+ disconnect(): Promise<void>;
308
+ emit(event: string, ...arguments_: any[]): void;
309
+ serializeData<T>(data: DeserializedData<T>): Promise<string | DeserializedData<T>>;
310
+ deserializeData<T>(data: string | DeserializedData<T>): Promise<DeserializedData<T> | undefined>;
311
+ }
312
+
313
+ type WrapOptions<T> = {
314
+ ttl?: number | ((value: T) => number);
315
+ refreshThreshold?: number | ((value: T) => number);
316
+ };
317
+ type WrapOptionsRaw<T> = WrapOptions<T> & {
318
+ raw: true;
319
+ };
320
+ type Cache = {
321
+ get: <T>(key: string) => Promise<T | undefined>;
322
+ mget: <T>(keys: string[]) => Promise<Array<T | undefined>>;
323
+ ttl: (key: string) => Promise<number | undefined>;
324
+ set: <T>(key: string, value: T, ttl?: number) => Promise<T>;
325
+ mset: <T>(list: Array<{
326
+ key: string;
327
+ value: T;
328
+ ttl?: number;
329
+ }>) => Promise<Array<{
330
+ key: string;
331
+ value: T;
332
+ ttl?: number;
333
+ }>>;
334
+ del: (key: string) => Promise<boolean>;
335
+ mdel: (keys: string[]) => Promise<boolean>;
336
+ clear: () => Promise<boolean>;
337
+ on: <E extends keyof Events>(event: E, listener: Events[E]) => EventEmitter;
338
+ off: <E extends keyof Events>(event: E, listener: Events[E]) => EventEmitter;
339
+ disconnect: () => Promise<undefined>;
340
+ cacheId: () => string;
341
+ stores: Keyv[];
342
+ wrap<T>(key: string, fnc: () => T | Promise<T>, ttl?: number | ((value: T) => number), refreshThreshold?: number | ((value: T) => number)): Promise<T>;
343
+ wrap<T>(key: string, fnc: () => T | Promise<T>, options: WrapOptions<T>): Promise<T>;
344
+ wrap<T>(key: string, fnc: () => T | Promise<T>, options: WrapOptionsRaw<T>): Promise<StoredDataRaw<T>>;
345
+ };
346
+ type Events = {
347
+ get: <T>(data: {
348
+ key: string;
349
+ value?: T;
350
+ error?: unknown;
351
+ }) => void;
352
+ set: <T>(data: {
353
+ key: string;
354
+ value: T;
355
+ error?: unknown;
356
+ }) => void;
357
+ del: (data: {
358
+ key: string;
359
+ error?: unknown;
360
+ }) => void;
361
+ clear: (error?: unknown) => void;
362
+ refresh: <T>(data: {
363
+ key: string;
364
+ value: T;
365
+ error?: unknown;
366
+ }) => void;
367
+ };
368
+
369
+ declare class FileCacheOptions extends DTO {
370
+ type: 'file';
371
+ /**
372
+ * the file path to store the data
373
+ */
374
+ filename: string;
375
+ /**
376
+ * ms, check and remove expired data in each ms
377
+ */
378
+ expiredCheckDelay?: number;
379
+ /**
380
+ * ms, batch write to disk in a specific duration, enhance write performance.
381
+ */
382
+ writeDelay?: number;
383
+ /**
384
+ * namespace
385
+ */
386
+ namespace?: string;
387
+ }
388
+
389
+ declare class RedisCacheOptions extends DTO {
390
+ type: 'redis';
391
+ host: string;
392
+ port?: number;
393
+ database?: number;
394
+ tls?: boolean;
395
+ keepAlive?: number;
396
+ username?: string;
397
+ password?: string;
398
+ reconnect?: boolean;
399
+ namespace?: string;
400
+ keyPrefixSeparator?: string;
401
+ clearBatchSize?: number;
402
+ useUnlink?: boolean;
403
+ noNamespaceAffectsAll?: boolean;
404
+ connectTimeout?: number;
405
+ throwOnConnectError?: boolean;
406
+ }
407
+
408
+ declare class SqliteCacheOptions extends DTO {
409
+ type: 'sqlite';
410
+ database: string;
411
+ table: string;
412
+ busyTimeout?: number;
413
+ namespace?: string;
414
+ }
415
+
416
+ declare class PostgresCacheOptions extends DTO {
417
+ type: 'postgres';
418
+ host: string;
419
+ database: string;
420
+ table: string;
421
+ port?: number;
422
+ schema?: string;
423
+ username: string;
424
+ password: string;
425
+ maxPoolSize?: number;
426
+ namespace?: string;
427
+ }
428
+
429
+ declare class MysqlCacheOptions extends DTO {
430
+ type: 'mysql';
431
+ host: string;
432
+ database: string;
433
+ table: string;
434
+ port?: number;
435
+ username: string;
436
+ password: string;
437
+ namespace?: string;
438
+ }
439
+
440
+ declare class MongoCacheOptions extends DTO {
441
+ type: 'mongo';
442
+ host: string;
443
+ database: string;
444
+ collection: string;
445
+ port?: number;
446
+ username: string;
447
+ password: string;
448
+ namespace?: string;
449
+ }
450
+
451
+ declare class MemcacheCacheOptions extends DTO {
452
+ type: 'memcache';
453
+ host: string;
454
+ port?: number;
455
+ username?: string;
456
+ password?: string;
457
+ namespace?: string;
458
+ }
459
+
460
+ type CacheStoreOptions = FileCacheOptions | RedisCacheOptions | MemcacheCacheOptions | MongoCacheOptions | SqliteCacheOptions | PostgresCacheOptions | MysqlCacheOptions;
461
+
462
+ declare class CacherOptions extends DTO {
463
+ stores?: CacheStoreOptions[] | CacheStoreOptions;
464
+ ttl?: number;
465
+ refreshThreshold?: number;
466
+ refreshAllStores?: boolean;
467
+ nonBlocking?: boolean;
468
+ cacheId?: string;
469
+ }
470
+
471
+ declare const BuildCacherOptions: (options?: CacherOptions) => {
472
+ class: typeof Cacher;
473
+ options?: CacherOptions;
474
+ };
475
+ type MultipleSetInput = {
476
+ key: string;
477
+ value: any;
478
+ ttl?: number;
479
+ };
480
+ type OnSetEventData = {
481
+ key: string;
482
+ value: any;
483
+ error?: Error;
484
+ };
485
+ type OnDelEventData = {
486
+ key: string;
487
+ error?: Error;
488
+ };
489
+ type OnRefreshEventData = {
490
+ key: string;
491
+ value: any;
492
+ error?: Error;
493
+ };
494
+ declare class Cacher extends Component {
495
+ protected readonly options?: CacherOptions;
496
+ protected cache: Cache;
497
+ protected init(): Promise<void>;
498
+ protected destroy(): Promise<void>;
499
+ set<T>(key: string, value: T, ttl?: number): Promise<T>;
500
+ multipleSet(options: MultipleSetInput[]): Promise<MultipleSetInput[]>;
501
+ get<T = any>(key: string): Promise<T>;
502
+ multipleGet(keys: string[]): Promise<any[]>;
503
+ ttl(key: string): Promise<number>;
504
+ del(key: string): Promise<boolean>;
505
+ multipleDel(keys: string[]): Promise<boolean>;
506
+ clear(): Promise<boolean>;
507
+ on(event: 'set', listener: (data: OnSetEventData) => void): this;
508
+ on(event: 'del', listener: (data: OnDelEventData) => void): this;
509
+ on(event: 'clear', listener: (error?: Error) => void): this;
510
+ on(event: 'refresh', listener: (data: OnRefreshEventData) => void): this;
511
+ }
512
+
513
+ export { BuildCacherOptions, Cacher, CacherOptions, FileCacheOptions, MemcacheCacheOptions, MongoCacheOptions, MysqlCacheOptions, PostgresCacheOptions, RedisCacheOptions, SqliteCacheOptions };
514
+ export type { CacheStoreOptions, MultipleSetInput, OnDelEventData, OnRefreshEventData, OnSetEventData };
package/com/cacher.mjs ADDED
@@ -0,0 +1,185 @@
1
+ import "../vendor/Package.4.mjs";
2
+
3
+ export { B as BuildCacherOptions, C as Cacher } from "../vendor/Package.19.mjs";
4
+
5
+ export { CacherOptions } from "../src/components/cacher/options/CacherOptions.mjs";
6
+
7
+ export { FileCacheOptions } from "../src/components/cacher/options/FileCacheOptions.mjs";
8
+
9
+ export { MemcacheCacheOptions } from "../src/components/cacher/options/MemcacheCacheOptions.mjs";
10
+
11
+ export { MongoCacheOptions } from "../src/components/cacher/options/MongoCacheOptions.mjs";
12
+
13
+ export { MysqlCacheOptions } from "../src/components/cacher/options/MysqlCacheOptions.mjs";
14
+
15
+ export { PostgresCacheOptions } from "../src/components/cacher/options/PostgresCacheOptions.mjs";
16
+
17
+ export { RedisCacheOptions } from "../src/components/cacher/options/RedisCacheOptions.mjs";
18
+
19
+ export { SqliteCacheOptions } from "../src/components/cacher/options/SqliteCacheOptions.mjs";
20
+
21
+ import "../src/components/cacher/types/CacheStoreOptions.mjs";
22
+
23
+ import "../vendor/Package.5.mjs";
24
+
25
+ import "../vendor/Package.1.mjs";
26
+
27
+ import "events";
28
+
29
+ import "buffer";
30
+
31
+ import "../vendor/Package.12.mjs";
32
+
33
+ import "../vendor/Package.8.mjs";
34
+
35
+ import "os";
36
+
37
+ import "path";
38
+
39
+ import "stream";
40
+
41
+ import "fs";
42
+
43
+ import "../vendor/Package.18.mjs";
44
+
45
+ import "constants";
46
+
47
+ import "../vendor/Package.10.mjs";
48
+
49
+ import "url";
50
+
51
+ import "util";
52
+
53
+ import "../vendor/Package.16.mjs";
54
+
55
+ import "assert";
56
+
57
+ import "../vendor/Package.13.mjs";
58
+
59
+ import "../src/lib/core/Component.mjs";
60
+
61
+ import "../vendor/Package.3.mjs";
62
+
63
+ import "../src/lib/base/async-constructor/AsyncConstructor.mjs";
64
+
65
+ import "../src/lib/base/async-constructor/Append.mjs";
66
+
67
+ import "../src/lib/helpers/IsPromiseLike.mjs";
68
+
69
+ import "../src/lib/helpers/IsPromise.mjs";
70
+
71
+ import "util/types";
72
+
73
+ import "../src/decorators/di/Lifetime.mjs";
74
+
75
+ import "../src/lib/base/internal/ObjectLifetime.mjs";
76
+
77
+ import "../src/constants/DIMetadataKey.mjs";
78
+
79
+ import "../src/exceptions/di/LifetimeLockedException.mjs";
80
+
81
+ import "../src/lib/base/abstracts/Exception.mjs";
82
+
83
+ import "../src/lib/base/internal/BasicInfo.mjs";
84
+
85
+ import "../src/lib/helpers/As.mjs";
86
+
87
+ import "../vendor/Package.6.mjs";
88
+
89
+ import "../vendor/Package.7.mjs";
90
+
91
+ import "../src/lib/base/internal/ThrowWarning.mjs";
92
+
93
+ import "../src/lib/helpers/Templating.mjs";
94
+
95
+ import "../src/lib/base/internal/CamelCase.mjs";
96
+
97
+ import "../src/lib/helpers/NoCase.mjs";
98
+
99
+ import "../src/exceptions/MethodNotFoundException.mjs";
100
+
101
+ import "../src/lib/ioc/DependencyInjectionContainer.mjs";
102
+
103
+ import "../src/lib/ioc/Errors.mjs";
104
+
105
+ import "../src/exceptions/di/DependencyInjectionException.mjs";
106
+
107
+ import "../src/lib/base/internal/ConstructorSymbol.mjs";
108
+
109
+ import "node:crypto";
110
+
111
+ import "../vendor/Package.2.mjs";
112
+
113
+ import "../src/lib/base/internal/DataValidator.mjs";
114
+
115
+ import "node:util/types";
116
+
117
+ import "../src/lib/validation/VLD.mjs";
118
+
119
+ import "../src/exceptions/dto/InvalidValueException.mjs";
120
+
121
+ import "../vendor/Package.9.mjs";
122
+
123
+ import "../src/lib/helpers/IsHtml.mjs";
124
+
125
+ import "../src/lib/helpers/IsXML.mjs";
126
+
127
+ import "../src/constants/DTOMetadataKey.mjs";
128
+
129
+ import "../src/lib/helpers/ObjectConstructor.mjs";
130
+
131
+ import "../src/lib/helpers/ObjectParentConstructors.mjs";
132
+
133
+ import "../src/lib/helpers/ObjectParentConstructor.mjs";
134
+
135
+ import "../src/lib/helpers/ObjectPrototype.mjs";
136
+
137
+ import "../src/lib/ioc/InjectionMode.mjs";
138
+
139
+ import "../src/lib/ioc/Lifetime.mjs";
140
+
141
+ import "../src/lib/ioc/ListModules.mjs";
142
+
143
+ import "../src/lib/ioc/Utils.mjs";
144
+
145
+ import "../src/lib/ioc/FunctionTokenizer.mjs";
146
+
147
+ import "../src/lib/ioc/LoadModules.mjs";
148
+
149
+ import "../src/lib/ioc/Resolvers.mjs";
150
+
151
+ import "../src/lib/ioc/ParamParser.mjs";
152
+
153
+ import "../src/lib/base/internal/ObjectWeakRefs.mjs";
154
+
155
+ import "../src/lib/base/internal/ConfigurableRecordsInjection.mjs";
156
+
157
+ import "../src/lib/base/internal/ObjectConfiguration.mjs";
158
+
159
+ import "../src/lib/base/internal/ObjectInjection.mjs";
160
+
161
+ import "../src/lib/base/internal/ObjectContainer.mjs";
162
+
163
+ import "../src/lib/helpers/DevNull.mjs";
164
+
165
+ import "../src/decorators/dto/Expect.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";