assemblerjs 1.1.16 → 1.1.18

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 (80) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index11.js +2 -2
  3. package/dist/index11.mjs +2 -2
  4. package/dist/index13.js +98 -83
  5. package/dist/index13.mjs +98 -83
  6. package/dist/index16.js +1 -1
  7. package/dist/index16.mjs +1 -1
  8. package/dist/index17.js +1 -1
  9. package/dist/index17.mjs +1 -1
  10. package/dist/index18.js +1 -1
  11. package/dist/index18.mjs +1 -1
  12. package/dist/index19.js +1 -1
  13. package/dist/index19.mjs +1 -1
  14. package/dist/index2.js +2 -2
  15. package/dist/index2.mjs +2 -2
  16. package/dist/index20.js +1 -1
  17. package/dist/index20.mjs +1 -1
  18. package/dist/index21.js +1 -1
  19. package/dist/index21.mjs +1 -1
  20. package/dist/index22.js +2 -2
  21. package/dist/index22.mjs +2 -2
  22. package/dist/index23.js +2 -2
  23. package/dist/index23.mjs +2 -2
  24. package/dist/index24.js +2 -2
  25. package/dist/index24.mjs +2 -2
  26. package/dist/index25.js +1 -1
  27. package/dist/index25.mjs +1 -1
  28. package/dist/index26.js +1 -1
  29. package/dist/index26.mjs +1 -1
  30. package/dist/index27.js +1 -1
  31. package/dist/index27.mjs +1 -1
  32. package/dist/index29.js +38 -15
  33. package/dist/index29.mjs +37 -12
  34. package/dist/index3.js +1 -1
  35. package/dist/index3.mjs +1 -1
  36. package/dist/index30.js +151 -100
  37. package/dist/index30.mjs +150 -98
  38. package/dist/index31.js +44 -34
  39. package/dist/index31.mjs +44 -33
  40. package/dist/index32.js +73 -16
  41. package/dist/index32.mjs +73 -16
  42. package/dist/index33.js +48 -98
  43. package/dist/index33.mjs +48 -98
  44. package/dist/index34.js +29 -26
  45. package/dist/index34.mjs +29 -26
  46. package/dist/index35.js +146 -138
  47. package/dist/index35.mjs +146 -137
  48. package/dist/index36.js +56 -43
  49. package/dist/index36.mjs +56 -43
  50. package/dist/index37.js +15 -77
  51. package/dist/index37.mjs +12 -77
  52. package/dist/index38.js +103 -51
  53. package/dist/index38.mjs +101 -51
  54. package/dist/index39.js +19 -28
  55. package/dist/index39.mjs +19 -28
  56. package/dist/index4.js +10 -10
  57. package/dist/index4.mjs +10 -10
  58. package/dist/index40.js +94 -151
  59. package/dist/index40.mjs +94 -151
  60. package/dist/index41.js +24 -59
  61. package/dist/index41.mjs +24 -59
  62. package/dist/index42.js +29 -49
  63. package/dist/index42.mjs +28 -49
  64. package/dist/index44.js +50 -943
  65. package/dist/index44.mjs +48 -941
  66. package/dist/index45.js +194 -2
  67. package/dist/index45.mjs +194 -2
  68. package/dist/index46.js +942 -2
  69. package/dist/index46.mjs +942 -2
  70. package/dist/index47.js +2 -29
  71. package/dist/index47.mjs +2 -28
  72. package/dist/index48.js +2 -194
  73. package/dist/index48.mjs +2 -194
  74. package/dist/index49.js +1 -1
  75. package/dist/index49.mjs +1 -1
  76. package/dist/index50.js +2 -2
  77. package/dist/index50.mjs +2 -2
  78. package/dist/index51.js +16 -13
  79. package/dist/index51.mjs +16 -13
  80. package/package.json +1 -1
package/dist/index30.mjs CHANGED
@@ -1,107 +1,159 @@
1
- import { ReflectValue } from './index28.mjs';
2
- import { getOwnCustomMetadata, defineCustomMetadata } from './index29.mjs';
3
- import { isAssemblage } from './index3.mjs';
1
+ import { HookManager } from './index32.mjs';
2
+ import { SingletonStrategy, TransientStrategy } from './index42.mjs';
3
+ import { DebugLogger } from './index35.mjs';
4
+ import { isClass } from '@assemblerjs/core';
5
+ import { resolveInstanceInjectionTuple } from './index43.mjs';
6
+ import { resolveInjectionTuple } from './index44.mjs';
7
+ import { Injectable } from './index45.mjs';
4
8
 
5
- const n = {
6
- singleton: {
7
- test: (r)=>typeof r === 'boolean' || typeof r === 'undefined',
8
- throw: ()=>{
9
- throw new Error(`'singleton' property must be of type 'boolean' or 'undefined'.`);
10
- },
11
- transform: (r)=>{
12
- return typeof r === 'undefined' ? true : r ? true : false;
9
+ function formatIdentifier(e) {
10
+ if (e === undefined) return 'undefined';
11
+ if (e === null) return 'null';
12
+ if (typeof e === 'function') {
13
+ if (e.name) return e.name;
14
+ if (e.constructor?.name && e.constructor.name !== 'Function') {
15
+ return e.constructor.name;
13
16
  }
14
- },
15
- events: {
16
- test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
17
- throw: ()=>{
18
- throw new Error(`'events' property must be an array of strings or 'undefined'.`);
19
- },
20
- transform: (r)=>r
21
- },
22
- inject: {
23
- test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
24
- throw: ()=>{
25
- throw new Error(`'inject' property must be an array of tuples of length 1, 2 or 3.`);
26
- },
27
- transform: (r)=>r
28
- },
29
- use: {
30
- test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>{
31
- if (!Array.isArray(r) || r.length !== 2) {
32
- return false;
33
- }
34
- const e = r[1];
35
- return typeof e !== 'undefined';
36
- }),
37
- throw: ()=>{
38
- throw new Error(`'use' property must be an array of tuples of length 2 with [identifier, instance | factory].`);
39
- },
40
- transform: (r)=>r
41
- },
42
- engage: {
43
- test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
44
- throw: ()=>{
45
- throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
46
- },
47
- transform: (r)=>r
48
- },
49
- tags: {
50
- test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
51
- throw: ()=>{
52
- throw new Error(`'tags' property must be a string or an array of strings.`);
53
- },
54
- transform: (r)=>typeof r === 'string' ? [
55
- r
56
- ] : r
57
- },
58
- metadata: {
59
- test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
60
- throw: ()=>{
61
- throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
62
- },
63
- transform: (r)=>r
64
- },
65
- global: {
66
- test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
67
- throw: ()=>{
68
- throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
69
- },
70
- transform: (r)=>r
17
+ return 'AnonymousFunction';
71
18
  }
72
- };
73
- const validateDefinition = (r)=>{
74
- const e = {
75
- ...r
76
- };
77
- for(const r in e){
78
- if (!Object.keys(n).includes(r)) {
79
- throw new Error(`Property '${r}' is not a valid assemblage definition property.`);
19
+ if (typeof e === 'string') return e;
20
+ if (typeof e === 'symbol') return e.toString();
21
+ if (typeof e === 'number') return String(e);
22
+ if (typeof e === 'boolean') return String(e);
23
+ if (typeof e === 'object') {
24
+ if (e.name && typeof e.name === 'string') {
25
+ return e.name;
80
26
  }
27
+ const t = e.constructor?.name;
28
+ if (t && t !== 'Object') {
29
+ return t;
30
+ }
31
+ try {
32
+ const t = JSON.stringify(e);
33
+ if (t.length > 100) {
34
+ return t.substring(0, 100) + '...';
35
+ }
36
+ return t;
37
+ } catch {
38
+ return '[UnknownObject]';
39
+ }
40
+ }
41
+ return String(e);
42
+ }
43
+ function c(e) {
44
+ if (isClass(e)) {
45
+ const t = e.prototype && Object.getOwnPropertyNames(e.prototype).length > 1;
46
+ return t ? 'class' : 'class';
81
47
  }
82
- for(const r in n){
83
- const t = n[r].test;
84
- const o = n[r].throw;
85
- const s = n[r].transform;
86
- if (!t(e[r])) {
87
- o();
48
+ if (typeof e === 'function') return 'function';
49
+ if (typeof e === 'string') return 'string';
50
+ if (typeof e === 'symbol') return 'symbol';
51
+ if (typeof e === 'object' && e !== null) return 'object';
52
+ return 'unknown';
53
+ }
54
+ class InjectableManager {
55
+ setContexts(e, t) {
56
+ this.privateContext = e;
57
+ this.publicContext = t;
58
+ }
59
+ register(i, o = false) {
60
+ const a = DebugLogger.getInstance();
61
+ const c = o === true ? resolveInstanceInjectionTuple(i) : resolveInjectionTuple(i);
62
+ if (this.has(c.identifier)) {
63
+ const e = `An assemblage is already registered with identifier '${c.identifier.name}'.`;
64
+ a.log('error', 'Duplicate registration', {
65
+ identifier: c.identifier.name,
66
+ error: e
67
+ });
68
+ throw new Error(e);
69
+ }
70
+ const f = Injectable.of(c, this.privateContext, this.publicContext);
71
+ a.logRegistration(f);
72
+ this.injectables.set(f.identifier, f);
73
+ if (f.concrete) {
74
+ HookManager.callHook(f.concrete, 'onRegister', this.publicContext, f.configuration);
75
+ }
76
+ return f;
77
+ }
78
+ has(e) {
79
+ return this.injectables.has(e);
80
+ }
81
+ require(e, t, n) {
82
+ if (!this.injectables.has(e)) {
83
+ const r = this.resolvingStack.has(e);
84
+ const i = r ? 'Circular dependency detected' : 'Dependency not registered';
85
+ const o = formatIdentifier(e);
86
+ const a = c(e);
87
+ const f = t?.__paramIndex;
88
+ const u = t?.__paramCount;
89
+ const l = t?.__expectedType;
90
+ const g = r ? `Circular dependency detected: '${o}' is already being resolved.` : `Dependency '${o}' has not been registered (Class/Service not found in current assemblages).`;
91
+ const d = {
92
+ identifier: o,
93
+ caller: n ? formatIdentifier(n) : 'unknown',
94
+ type: a,
95
+ error: g
96
+ };
97
+ if (f !== undefined) {
98
+ d.paramIndex = f;
99
+ }
100
+ if (u !== undefined) {
101
+ d.paramCount = u;
102
+ }
103
+ if (l !== undefined) {
104
+ const e = l?.name || formatIdentifier(l);
105
+ d.expectedType = e;
106
+ }
107
+ DebugLogger.getInstance().log('error', i, d);
108
+ throw new Error(g);
109
+ }
110
+ const r = this.injectables.get(e);
111
+ this.resolvingStack.add(r.identifier);
112
+ try {
113
+ if (r.isSingleton) {
114
+ return this.singletonStrategy.resolve(r, t);
115
+ } else {
116
+ return this.transientStrategy.resolve(r, t);
117
+ }
118
+ } finally{
119
+ this.resolvingStack.delete(r.identifier);
88
120
  }
89
- e[r] = s(e[r]);
90
121
  }
91
- return e;
92
- };
93
- const getDefinition = (e)=>{
94
- if (!isAssemblage(e)) {
95
- throw new Error(`Class '${e.name}' is not an assemblage or transversal.`);
122
+ concrete(e) {
123
+ const t = this.injectables.get(e);
124
+ if (t) return t.concrete;
125
+ return;
126
+ }
127
+ tagged(...e) {
128
+ const t = [];
129
+ for (const n of e){
130
+ for (const [e, r] of this.injectables){
131
+ if (r.tags.includes(n)) t.push(r.build());
132
+ }
133
+ }
134
+ return t;
135
+ }
136
+ dispose() {
137
+ for (const [e, t] of this.injectables){
138
+ t.dispose();
139
+ }
140
+ this.resolvingStack.clear();
141
+ }
142
+ get size() {
143
+ return this.injectables.size;
144
+ }
145
+ getRegisteredIdentifiers() {
146
+ return Array.from(this.injectables.keys()).map((e)=>e?.name || String(e));
147
+ }
148
+ getInjectables() {
149
+ return this.injectables;
150
+ }
151
+ constructor(){
152
+ this.injectables = new Map();
153
+ this.resolvingStack = new Set();
154
+ this.singletonStrategy = new SingletonStrategy();
155
+ this.transientStrategy = new TransientStrategy();
96
156
  }
97
- return getOwnCustomMetadata(ReflectValue.AssemblageDefinition, e);
98
- };
99
- const setDefinitionValue = (t, o, n)=>{
100
- const s = getDefinition(n);
101
- s[t] = o;
102
- const a = validateDefinition(s);
103
- defineCustomMetadata(ReflectValue.AssemblageDefinition, a, n);
104
- return a;
105
- };
157
+ }
106
158
 
107
- export { getDefinition, setDefinitionValue, validateDefinition };
159
+ export { InjectableManager, formatIdentifier };
package/dist/index31.js CHANGED
@@ -2,45 +2,55 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const eventManager = require('./index6.js');
5
+ const debugLogger = require('./index35.js');
6
6
 
7
- const registerEvents = (t, n)=>{
8
- const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
9
- if (o) {
10
- const e = n;
11
- const o = e.channels;
12
- for (const n of t.events){
13
- if (!o.has(n)) e.addChannels(n);
14
- if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
15
- }
16
- for (const e of t.events){
17
- n.on(e, (...n)=>{
18
- t.privateContext.emit(e, ...n);
7
+ function t(e) {
8
+ return typeof e === 'symbol' ? 'symbol' : 'string';
9
+ }
10
+ class ObjectManager {
11
+ use(r, o) {
12
+ if (this.has(r)) {
13
+ const o = typeof r === 'symbol' ? r.toString() : String(r);
14
+ const s = `Object/value '${o}' is already registered (cannot register twice).`;
15
+ debugLogger.DebugLogger.getInstance().log('error', 'Duplicate object/value registration', {
16
+ identifier: o,
17
+ type: t(r),
18
+ error: s
19
19
  });
20
+ throw new Error(s);
20
21
  }
21
- } else {
22
- for (const e of t.events){
23
- if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
24
- }
22
+ this.objects.set(r, o);
23
+ return o;
25
24
  }
26
- };
27
- const unregisterEvents = (t, n)=>{
28
- const o = t.concrete !== undefined && t.concrete.prototype instanceof eventManager.EventManager;
29
- if (o) {
30
- const e = n;
31
- for (const n of t.events){
32
- e.off(n);
25
+ has(e) {
26
+ return this.objects.has(e);
27
+ }
28
+ require(r) {
29
+ if (!this.objects.has(r)) {
30
+ const o = typeof r === 'symbol' ? r.toString() : String(r);
31
+ const s = `Object/value '${o}' has not been registered in the object store.`;
32
+ debugLogger.DebugLogger.getInstance().log('error', 'Object/value not found', {
33
+ identifier: o,
34
+ type: t(r),
35
+ error: s
36
+ });
37
+ throw new Error(s);
33
38
  }
34
- e.removeChannels(...t.events);
35
- t.privateContext.removeChannels(...t.events);
36
- } else {
37
- for (const e of t.events){
38
- if (t.privateContext.events.has(e)) {
39
- t.privateContext.removeChannels(e);
40
- }
39
+ return this.objects.get(r);
40
+ }
41
+ addGlobal(e, t) {
42
+ if (this.globals.has(e)) {
43
+ throw new Error(`Global value with key '${e}' has already been registered.`);
41
44
  }
45
+ this.globals.set(e, t);
46
+ }
47
+ global(e) {
48
+ return this.globals.get(e);
49
+ }
50
+ constructor(){
51
+ this.objects = new Map();
52
+ this.globals = new Map();
42
53
  }
43
- };
54
+ }
44
55
 
45
- exports.registerEvents = registerEvents;
46
- exports.unregisterEvents = unregisterEvents;
56
+ exports.ObjectManager = ObjectManager;
package/dist/index31.mjs CHANGED
@@ -1,41 +1,52 @@
1
- import { EventManager } from './index6.mjs';
1
+ import { DebugLogger } from './index35.mjs';
2
2
 
3
- const registerEvents = (t, n)=>{
4
- const o = t.concrete !== undefined && t.concrete.prototype instanceof EventManager;
5
- if (o) {
6
- const e = n;
7
- const o = e.channels;
8
- for (const n of t.events){
9
- if (!o.has(n)) e.addChannels(n);
10
- if (!t.privateContext.events.has(n)) t.privateContext.addChannels(n);
11
- }
12
- for (const e of t.events){
13
- n.on(e, (...n)=>{
14
- t.privateContext.emit(e, ...n);
3
+ function t(e) {
4
+ return typeof e === 'symbol' ? 'symbol' : 'string';
5
+ }
6
+ class ObjectManager {
7
+ use(r, o) {
8
+ if (this.has(r)) {
9
+ const o = typeof r === 'symbol' ? r.toString() : String(r);
10
+ const s = `Object/value '${o}' is already registered (cannot register twice).`;
11
+ DebugLogger.getInstance().log('error', 'Duplicate object/value registration', {
12
+ identifier: o,
13
+ type: t(r),
14
+ error: s
15
15
  });
16
+ throw new Error(s);
16
17
  }
17
- } else {
18
- for (const e of t.events){
19
- if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
20
- }
18
+ this.objects.set(r, o);
19
+ return o;
21
20
  }
22
- };
23
- const unregisterEvents = (t, n)=>{
24
- const o = t.concrete !== undefined && t.concrete.prototype instanceof EventManager;
25
- if (o) {
26
- const e = n;
27
- for (const n of t.events){
28
- e.off(n);
21
+ has(e) {
22
+ return this.objects.has(e);
23
+ }
24
+ require(r) {
25
+ if (!this.objects.has(r)) {
26
+ const o = typeof r === 'symbol' ? r.toString() : String(r);
27
+ const s = `Object/value '${o}' has not been registered in the object store.`;
28
+ DebugLogger.getInstance().log('error', 'Object/value not found', {
29
+ identifier: o,
30
+ type: t(r),
31
+ error: s
32
+ });
33
+ throw new Error(s);
29
34
  }
30
- e.removeChannels(...t.events);
31
- t.privateContext.removeChannels(...t.events);
32
- } else {
33
- for (const e of t.events){
34
- if (t.privateContext.events.has(e)) {
35
- t.privateContext.removeChannels(e);
36
- }
35
+ return this.objects.get(r);
36
+ }
37
+ addGlobal(e, t) {
38
+ if (this.globals.has(e)) {
39
+ throw new Error(`Global value with key '${e}' has already been registered.`);
37
40
  }
41
+ this.globals.set(e, t);
42
+ }
43
+ global(e) {
44
+ return this.globals.get(e);
45
+ }
46
+ constructor(){
47
+ this.objects = new Map();
48
+ this.globals = new Map();
38
49
  }
39
- };
50
+ }
40
51
 
41
- export { registerEvents, unregisterEvents };
52
+ export { ObjectManager };
package/dist/index32.js CHANGED
@@ -2,27 +2,84 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- class ResolverStore {
6
- static register(e, r) {
7
- this.resolvers.set(e, r);
5
+ const core = require('@assemblerjs/core');
6
+ const debugLogger = require('./index35.js');
7
+
8
+ class HookManager {
9
+ prepareInitHook(o, t) {
10
+ this.initCache.push({
11
+ instance: o,
12
+ configuration: t
13
+ });
14
+ return this.initCache;
15
+ }
16
+ callInitHooks(o) {
17
+ for (const t of this.initCache){
18
+ HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
19
+ }
8
20
  }
9
- static getResolver(e) {
10
- const r = this.resolvers.get(e);
11
- if (!r) {
12
- throw new Error(`No resolver found for decorator type: ${e}`);
21
+ callInitedHooks(o) {
22
+ for (const t of [
23
+ ...this.initCache
24
+ ].reverse()){
25
+ HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
13
26
  }
14
- return new r();
15
27
  }
16
- static hasResolver(e) {
17
- return this.resolvers.has(e);
28
+ clearCache() {
29
+ this.initCache.length = 0;
18
30
  }
19
- static getRegisteredTypes() {
20
- return Array.from(this.resolvers.keys());
31
+ getCache() {
32
+ return this.initCache;
21
33
  }
22
- static clear() {
23
- this.resolvers.clear();
34
+ constructor(){
35
+ this.initCache = [];
24
36
  }
25
37
  }
26
- ResolverStore.resolvers = new Map();
38
+ HookManager.callHook = (e, i, n, a)=>{
39
+ const c = debugLogger.DebugLogger.getInstance();
40
+ const r = c.logHook(i, e, a);
41
+ return new Promise((t, c)=>{
42
+ const s = e[i];
43
+ if (s) {
44
+ if (core.isAsync(s)) {
45
+ s.bind(e)(n, a).then(()=>{
46
+ if (r) r();
47
+ t();
48
+ }).catch((o)=>{
49
+ if (r) r();
50
+ c(o);
51
+ });
52
+ return;
53
+ }
54
+ try {
55
+ s.bind(e)(n, a);
56
+ if (r) r();
57
+ t();
58
+ } catch (o) {
59
+ if (r) r();
60
+ c(o);
61
+ }
62
+ } else {
63
+ if (r) r();
64
+ t();
65
+ }
66
+ });
67
+ };
68
+ HookManager.callHookImmediate = (e, i, n, a)=>{
69
+ const c = debugLogger.DebugLogger.getInstance();
70
+ const r = c.logHook(i, e, a);
71
+ const s = e[i];
72
+ if (s) {
73
+ if (core.isAsync(s)) {
74
+ s.bind(e)(n, a).catch(()=>{});
75
+ if (r) r();
76
+ return;
77
+ }
78
+ s.bind(e)(n, a);
79
+ if (r) r();
80
+ } else {
81
+ if (r) r();
82
+ }
83
+ };
27
84
 
28
- exports.ResolverStore = ResolverStore;
85
+ exports.HookManager = HookManager;
package/dist/index32.mjs CHANGED
@@ -1,24 +1,81 @@
1
- class ResolverStore {
2
- static register(e, r) {
3
- this.resolvers.set(e, r);
1
+ import { isAsync } from '@assemblerjs/core';
2
+ import { DebugLogger } from './index35.mjs';
3
+
4
+ class HookManager {
5
+ prepareInitHook(o, t) {
6
+ this.initCache.push({
7
+ instance: o,
8
+ configuration: t
9
+ });
10
+ return this.initCache;
11
+ }
12
+ callInitHooks(o) {
13
+ for (const t of this.initCache){
14
+ HookManager.callHookImmediate(t.instance, 'onInit', o, t.configuration);
15
+ }
4
16
  }
5
- static getResolver(e) {
6
- const r = this.resolvers.get(e);
7
- if (!r) {
8
- throw new Error(`No resolver found for decorator type: ${e}`);
17
+ callInitedHooks(o) {
18
+ for (const t of [
19
+ ...this.initCache
20
+ ].reverse()){
21
+ HookManager.callHookImmediate(t.instance, 'onInited', o, t.configuration);
9
22
  }
10
- return new r();
11
23
  }
12
- static hasResolver(e) {
13
- return this.resolvers.has(e);
24
+ clearCache() {
25
+ this.initCache.length = 0;
14
26
  }
15
- static getRegisteredTypes() {
16
- return Array.from(this.resolvers.keys());
27
+ getCache() {
28
+ return this.initCache;
17
29
  }
18
- static clear() {
19
- this.resolvers.clear();
30
+ constructor(){
31
+ this.initCache = [];
20
32
  }
21
33
  }
22
- ResolverStore.resolvers = new Map();
34
+ HookManager.callHook = (e, i, n, a)=>{
35
+ const c = DebugLogger.getInstance();
36
+ const r = c.logHook(i, e, a);
37
+ return new Promise((t, c)=>{
38
+ const s = e[i];
39
+ if (s) {
40
+ if (isAsync(s)) {
41
+ s.bind(e)(n, a).then(()=>{
42
+ if (r) r();
43
+ t();
44
+ }).catch((o)=>{
45
+ if (r) r();
46
+ c(o);
47
+ });
48
+ return;
49
+ }
50
+ try {
51
+ s.bind(e)(n, a);
52
+ if (r) r();
53
+ t();
54
+ } catch (o) {
55
+ if (r) r();
56
+ c(o);
57
+ }
58
+ } else {
59
+ if (r) r();
60
+ t();
61
+ }
62
+ });
63
+ };
64
+ HookManager.callHookImmediate = (e, i, n, a)=>{
65
+ const c = DebugLogger.getInstance();
66
+ const r = c.logHook(i, e, a);
67
+ const s = e[i];
68
+ if (s) {
69
+ if (isAsync(s)) {
70
+ s.bind(e)(n, a).catch(()=>{});
71
+ if (r) r();
72
+ return;
73
+ }
74
+ s.bind(e)(n, a);
75
+ if (r) r();
76
+ } else {
77
+ if (r) r();
78
+ }
79
+ };
23
80
 
24
- export { ResolverStore };
81
+ export { HookManager };