lakutata 2.0.21 → 2.0.23

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.
@@ -30,9 +30,9 @@ const p = require("../src/lib/helpers/DevNull.cjs");
30
30
 
31
31
  const b = require("../src/lib/helpers/ObjectParentConstructors.cjs");
32
32
 
33
- const O = require("../src/exceptions/di/DependencyInjectionException.cjs");
33
+ const y = require("../src/exceptions/di/DependencyInjectionException.cjs");
34
34
 
35
- const y = require("../src/lib/base/internal/ConstructorSymbol.cjs");
35
+ const O = require("../src/lib/base/internal/ConstructorSymbol.cjs");
36
36
 
37
37
  const f = require("../src/decorators/dto/Expect.cjs");
38
38
 
@@ -119,7 +119,7 @@ class Container {
119
119
  }
120
120
  buildNameAndRegistrationPairFromOptions(e) {
121
121
  const t = {};
122
- const s = e[I] ? e[I] : y.ConstructorSymbol(e.class);
122
+ const s = e[I] ? e[I] : O.ConstructorSymbol(e.class);
123
123
  const r = {
124
124
  ...e,
125
125
  class: void 0
@@ -140,7 +140,7 @@ class Container {
140
140
  if (S.isClass(r) && d.DTO.isValid(r, d.DTO.Class(exports.BaseObject))) {
141
141
  const e = r;
142
142
  const s = {};
143
- s[y.ConstructorSymbol(e)] = m.asClass(e, this.buildResolverOptions(e));
143
+ s[O.ConstructorSymbol(e)] = m.asClass(e, this.buildResolverOptions(e));
144
144
  return t(s);
145
145
  } else {
146
146
  return t({});
@@ -203,7 +203,7 @@ class Container {
203
203
  }
204
204
  }
205
205
  async get(e, t = {}) {
206
- const s = typeof e === "function" ? y.ConstructorSymbol(e) : e;
206
+ const s = typeof e === "function" ? O.ConstructorSymbol(e) : e;
207
207
  if (!this.#e.hasRegistration(s) && typeof e === "function" && c.GetObjectIsAutoload(u.As(e))) {
208
208
  await this.load([ {
209
209
  id: s,
@@ -213,7 +213,7 @@ class Container {
213
213
  return (this.#e.getRegistration(s)?.lifetime === "SINGLETON" || this.#e.getRegistration(s)?.lifetime === "MODULE_SINGLETON") && !this.injectionNames.has(s) && this.parent ? await this.parent.get(s, t) : await this.processResolved(this.#e.resolve(s), s, t);
214
214
  }
215
215
  has(e) {
216
- if (typeof e === "function") return this.#e.hasRegistration(y.ConstructorSymbol(e));
216
+ if (typeof e === "function") return this.#e.hasRegistration(O.ConstructorSymbol(e));
217
217
  return this.#e.hasRegistration(e);
218
218
  }
219
219
  async set(e, t = {}) {
@@ -230,7 +230,7 @@ class Container {
230
230
  } ]);
231
231
  }
232
232
  async build(e, t = {}) {
233
- const s = await this.processResolved(this.#e.build(e, this.buildResolverOptions(e)), y.ConstructorSymbol(e), t);
233
+ const s = await this.processResolved(this.#e.build(e, this.buildResolverOptions(e)), O.ConstructorSymbol(e), t);
234
234
  R.AppendObjectWeakRefs(this.#e, s);
235
235
  return s;
236
236
  }
@@ -348,7 +348,7 @@ exports.BaseObject = M = class BaseObject extends t.AsyncConstructor {
348
348
  Reflect.set(this, s, e);
349
349
  return t();
350
350
  })).catch(i);
351
- })).catch((e => i(new O.DependencyInjectionException("Unable to inject value for property {0} of {1} because: {2}", [ s, this.className, e.message ]))));
351
+ })).catch((e => i(new y.DependencyInjectionException("Unable to inject value for property {0} of {1} because: {2}", [ s, this.className, e.message ]))));
352
352
  })));
353
353
  }));
354
354
  await Promise.all(t);
@@ -452,6 +452,9 @@ exports.BaseObject = M = class BaseObject extends t.AsyncConstructor {
452
452
  return (...e) => p.DevNull(...e);
453
453
  }
454
454
  }
455
+ async dispose() {
456
+ await this.destroy();
457
+ }
455
458
  };
456
459
 
457
460
  exports.BaseObject = M = e.__decorate([ s.Transient(), D(exports.ObjectType.Object), e.__metadata("design:paramtypes", [ Object ]) ], exports.BaseObject);
@@ -22,9 +22,9 @@ import { D as y, I as j } from "./Package.2.mjs";
22
22
 
23
23
  import { ObjectConstructor as g } from "../src/lib/helpers/ObjectConstructor.mjs";
24
24
 
25
- import { As as O } from "../src/lib/helpers/As.mjs";
25
+ import { As as w } from "../src/lib/helpers/As.mjs";
26
26
 
27
- import { DevNull as w } from "../src/lib/helpers/DevNull.mjs";
27
+ import { DevNull as O } from "../src/lib/helpers/DevNull.mjs";
28
28
 
29
29
  import { ObjectParentConstructors as P } from "../src/lib/helpers/ObjectParentConstructors.mjs";
30
30
 
@@ -93,7 +93,7 @@ class Container {
93
93
  try {
94
94
  await t.getMethod(H, false)();
95
95
  } catch (t) {
96
- w(t);
96
+ O(t);
97
97
  }
98
98
  }
99
99
  buildResolverOptions(t) {
@@ -104,11 +104,11 @@ class Container {
104
104
  };
105
105
  }
106
106
  async processResolved(t, e, s = {}) {
107
- const i = a(O(t.constructor), e);
107
+ const i = a(w(t.constructor), e);
108
108
  const r = y.isValid(t.constructor, y.Class(tt));
109
109
  if (r) {
110
- c(O(t), e);
111
- l(O(t), {
110
+ c(w(t), e);
111
+ l(w(t), {
112
112
  ...i,
113
113
  ...s
114
114
  });
@@ -169,16 +169,16 @@ class Container {
169
169
  t.forEach((t => {
170
170
  if (typeof t === "string") {
171
171
  s.push(new Promise(((e, s) => this.buildNameAndRegistrationPairFromGlob(t).then(e).catch(s))));
172
- } else if (L(O(t))) {
172
+ } else if (L(w(t))) {
173
173
  const s = {
174
- class: O(t)
174
+ class: w(t)
175
175
  };
176
176
  e = {
177
177
  ...e,
178
178
  ...this.buildNameAndRegistrationPairFromOptions(s)
179
179
  };
180
180
  } else {
181
- const s = O(t);
181
+ const s = w(t);
182
182
  e = {
183
183
  ...e,
184
184
  ...this.buildNameAndRegistrationPairFromOptions(s)
@@ -202,10 +202,10 @@ class Container {
202
202
  }
203
203
  async get(t, e = {}) {
204
204
  const s = typeof t === "function" ? R(t) : t;
205
- if (!this.#t.hasRegistration(s) && typeof t === "function" && u(O(t))) {
205
+ if (!this.#t.hasRegistration(s) && typeof t === "function" && u(w(t))) {
206
206
  await this.load([ {
207
207
  id: s,
208
- class: O(t)
208
+ class: w(t)
209
209
  } ]);
210
210
  }
211
211
  return (this.#t.getRegistration(s)?.lifetime === "SINGLETON" || this.#t.getRegistration(s)?.lifetime === "MODULE_SINGLETON") && !this.injectionNames.has(s) && this.parent ? await this.parent.get(s, e) : await this.processResolved(this.#t.resolve(s), s, e);
@@ -251,7 +251,7 @@ class Container {
251
251
  e.push(new Promise((t => s ? Promise.resolve(s[H]()).then((() => {
252
252
  s = undefined;
253
253
  return t();
254
- })).catch(w) : t())));
254
+ })).catch(O) : t())));
255
255
  }
256
256
  }));
257
257
  await Promise.all(e);
@@ -325,7 +325,7 @@ let tt = K = class BaseObject extends s {
325
325
  p(this).forEach(((s, i) => {
326
326
  if (j(i)) return;
327
327
  e.push(new Promise(((e, r) => {
328
- y.validateAsync(t[O(i)], s.schema, {
328
+ y.validateAsync(t[w(i)], s.schema, {
329
329
  targetName: i
330
330
  }).then((t => Promise.resolve(s.fn.bind(this)(t)).then((t => {
331
331
  this[i] = t;
@@ -401,10 +401,10 @@ let tt = K = class BaseObject extends s {
401
401
  }
402
402
  getModule() {
403
403
  let t = this.getParent();
404
- while (t && V(O(g(t))) !== q.Module) {
404
+ while (t && V(w(g(t))) !== q.Module) {
405
405
  t = this.getParent();
406
406
  }
407
- return O(t);
407
+ return w(t);
408
408
  }
409
409
  get $uuid() {
410
410
  return this.#o;
@@ -421,8 +421,8 @@ let tt = K = class BaseObject extends s {
421
421
  this[t] = e;
422
422
  }
423
423
  getProperty(t, e) {
424
- if (this.hasProperty(t)) return O(this[t]);
425
- return O(e);
424
+ if (this.hasProperty(t)) return w(this[t]);
425
+ return w(e);
426
426
  }
427
427
  hasProperty(t) {
428
428
  return typeof t === "string" ? this.propertyNames().includes(t) : this.propertySymbols().includes(t);
@@ -447,9 +447,12 @@ let tt = K = class BaseObject extends s {
447
447
  className: this.constructor.name
448
448
  });
449
449
  } else {
450
- return (...t) => w(...t);
450
+ return (...t) => O(...t);
451
451
  }
452
452
  }
453
+ async dispose() {
454
+ await this.destroy();
455
+ }
453
456
  };
454
457
 
455
458
  tt = K = t([ i(), z(q.Object), e("design:paramtypes", [ Object ]) ], tt);
@@ -812,6 +812,11 @@ declare class BaseObject extends AsyncConstructor {
812
812
  * @param throwExceptionIfNotFound
813
813
  */
814
814
  getMethod(name: string | symbol, throwExceptionIfNotFound?: boolean): (...args: any[]) => any | Promise<any>;
815
+ /**
816
+ * Dispose current object
817
+ * @description Call this function will invoke internal destroy method
818
+ */
819
+ dispose(): Promise<void>;
815
820
  }
816
821
 
817
822
  declare class Container {