assemblerjs 1.1.13 → 1.1.15
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.
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- package/dist/index27.js +1 -1
- package/dist/index27.mjs +1 -1
- package/dist/index32.js +142 -93
- package/dist/index32.mjs +142 -93
- package/dist/index33.js +45 -23
- package/dist/index33.mjs +45 -23
- package/dist/index34.js +66 -127
- package/dist/index34.mjs +67 -128
- package/dist/index35.js +40 -46
- package/dist/index35.mjs +40 -46
- package/dist/index36.js +28 -76
- package/dist/index36.mjs +28 -76
- package/dist/index37.js +159 -41
- package/dist/index37.mjs +159 -41
- package/dist/index38.js +102 -28
- package/dist/index38.mjs +102 -28
- package/dist/index39.js +22 -156
- package/dist/index39.mjs +22 -156
- package/dist/index4.js +6 -6
- package/dist/index4.mjs +6 -6
- package/dist/index43.js +28 -941
- package/dist/index43.mjs +27 -941
- package/dist/index44.js +194 -2
- package/dist/index44.mjs +194 -2
- package/dist/index45.js +942 -2
- package/dist/index45.mjs +942 -2
- package/dist/index46.js +2 -29
- package/dist/index46.mjs +2 -28
- package/dist/index47.js +2 -194
- package/dist/index47.mjs +2 -194
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.js +5 -1
- package/dist/index50.mjs +5 -1
- package/package.json +1 -1
package/dist/index13.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const core = require('@assemblerjs/core');
|
|
6
|
-
const pointcutMatcher = require('./
|
|
6
|
+
const pointcutMatcher = require('./index39.js');
|
|
7
7
|
const affect = require('./index12.js');
|
|
8
8
|
const schema = require('./index30.js');
|
|
9
9
|
|
package/dist/index13.mjs
CHANGED
package/dist/index27.js
CHANGED
package/dist/index27.mjs
CHANGED
package/dist/index32.js
CHANGED
|
@@ -2,110 +2,159 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const hookManager = require('./index34.js');
|
|
6
|
+
const resolutionStrategies = require('./index43.js');
|
|
7
|
+
const debugLogger = require('./index37.js');
|
|
8
|
+
const core = require('@assemblerjs/core');
|
|
9
|
+
const use = require('./index42.js');
|
|
10
|
+
const inject = require('./index41.js');
|
|
11
|
+
const injectable = require('./index44.js');
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const n = Object.getOwnPropertyDescriptor(a, t);
|
|
16
|
-
if (!n) return false;
|
|
17
|
-
const r = n.value && typeof n.value === 'function';
|
|
18
|
-
const o = n.get && typeof n.get === 'function';
|
|
19
|
-
if (!r && !o) return false;
|
|
20
|
-
const c = affect.getAffectedMethods(a, t);
|
|
21
|
-
return c.length > 0;
|
|
22
|
-
});
|
|
23
|
-
if (s.length === 0 && !f) {
|
|
24
|
-
return n;
|
|
13
|
+
function a(e) {
|
|
14
|
+
if (e === undefined) return 'undefined';
|
|
15
|
+
if (e === null) return 'null';
|
|
16
|
+
if (typeof e === 'function') {
|
|
17
|
+
if (e.name) return e.name;
|
|
18
|
+
if (e.constructor?.name && e.constructor.name !== 'Function') {
|
|
19
|
+
return e.constructor.name;
|
|
25
20
|
}
|
|
26
|
-
return
|
|
27
|
-
get (t, e, n) {
|
|
28
|
-
const r = Reflect.get(t, e, n);
|
|
29
|
-
if (typeof r !== 'function') {
|
|
30
|
-
return r;
|
|
31
|
-
}
|
|
32
|
-
return function(...n) {
|
|
33
|
-
const o = String(e);
|
|
34
|
-
const a = {
|
|
35
|
-
target: t,
|
|
36
|
-
methodName: o,
|
|
37
|
-
args: n
|
|
38
|
-
};
|
|
39
|
-
const f = c.getAdvicesForJoinPoint(a, s, t, e);
|
|
40
|
-
return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
});
|
|
21
|
+
return 'AnonymousFunction';
|
|
44
22
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
23
|
+
if (typeof e === 'string') return e;
|
|
24
|
+
if (typeof e === 'symbol') return e.toString();
|
|
25
|
+
if (typeof e === 'number') return String(e);
|
|
26
|
+
if (typeof e === 'boolean') return String(e);
|
|
27
|
+
if (typeof e === 'object') {
|
|
28
|
+
if (e.name && typeof e.name === 'string') {
|
|
29
|
+
return e.name;
|
|
30
|
+
}
|
|
31
|
+
const t = e.constructor?.name;
|
|
32
|
+
if (t && t !== 'Object') {
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
49
35
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
config: t.config
|
|
54
|
-
};
|
|
55
|
-
t.method.call(t.transversalInstance, e);
|
|
36
|
+
const t = JSON.stringify(e);
|
|
37
|
+
if (t.length > 100) {
|
|
38
|
+
return t.substring(0, 100) + '...';
|
|
56
39
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
return t;
|
|
41
|
+
} catch {
|
|
42
|
+
return '[UnknownObject]';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return String(e);
|
|
46
|
+
}
|
|
47
|
+
function f(e) {
|
|
48
|
+
if (core.isClass(e)) {
|
|
49
|
+
const t = e.prototype && Object.getOwnPropertyNames(e.prototype).length > 1;
|
|
50
|
+
return t ? 'class' : 'class';
|
|
51
|
+
}
|
|
52
|
+
if (typeof e === 'function') return 'function';
|
|
53
|
+
if (typeof e === 'string') return 'string';
|
|
54
|
+
if (typeof e === 'symbol') return 'symbol';
|
|
55
|
+
if (typeof e === 'object' && e !== null) return 'object';
|
|
56
|
+
return 'unknown';
|
|
57
|
+
}
|
|
58
|
+
class InjectableManager {
|
|
59
|
+
setContexts(e, t) {
|
|
60
|
+
this.privateContext = e;
|
|
61
|
+
this.publicContext = t;
|
|
62
|
+
}
|
|
63
|
+
register(i, s = false) {
|
|
64
|
+
const c = debugLogger.DebugLogger.getInstance();
|
|
65
|
+
const a = s === true ? use.resolveInstanceInjectionTuple(i) : inject.resolveInjectionTuple(i);
|
|
66
|
+
if (this.has(a.identifier)) {
|
|
67
|
+
const e = `An assemblage is already registered with identifier '${a.identifier.name}'.`;
|
|
68
|
+
c.log('error', 'Duplicate registration', {
|
|
69
|
+
identifier: a.identifier.name,
|
|
70
|
+
error: e
|
|
71
|
+
});
|
|
72
|
+
throw new Error(e);
|
|
73
|
+
}
|
|
74
|
+
const f = injectable.Injectable.of(a, this.privateContext, this.publicContext);
|
|
75
|
+
c.logRegistration(f);
|
|
76
|
+
this.injectables.set(f.identifier, f);
|
|
77
|
+
if (f.concrete) {
|
|
78
|
+
hookManager.HookManager.callHook(f.concrete, 'onRegister', this.publicContext, f.configuration);
|
|
79
|
+
}
|
|
80
|
+
return f;
|
|
81
|
+
}
|
|
82
|
+
has(e) {
|
|
83
|
+
return this.injectables.has(e);
|
|
84
|
+
}
|
|
85
|
+
require(e, t, n) {
|
|
86
|
+
if (!this.injectables.has(e)) {
|
|
87
|
+
const r = this.resolvingStack.has(e);
|
|
88
|
+
const i = r ? 'Circular dependency detected' : 'Dependency not registered';
|
|
89
|
+
const s = a(e);
|
|
90
|
+
const c = f(e);
|
|
91
|
+
const u = t?.__paramIndex;
|
|
92
|
+
const l = t?.__paramCount;
|
|
93
|
+
const g = t?.__expectedType;
|
|
94
|
+
const d = r ? `Circular dependency detected: '${s}' is already being resolved.` : `Dependency '${s}' has not been registered (Class/Service not found in current assemblages).`;
|
|
95
|
+
const p = {
|
|
96
|
+
identifier: s,
|
|
97
|
+
caller: n ? a(n) : 'unknown',
|
|
98
|
+
type: c,
|
|
99
|
+
error: d
|
|
100
|
+
};
|
|
101
|
+
if (u !== undefined) {
|
|
102
|
+
p.paramIndex = u;
|
|
62
103
|
}
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
for (const e of a){
|
|
66
|
-
const n = {
|
|
67
|
-
...o,
|
|
68
|
-
result: t
|
|
69
|
-
};
|
|
70
|
-
e.method.call(e.transversalInstance, n);
|
|
71
|
-
}
|
|
72
|
-
return t;
|
|
73
|
-
}).catch((t)=>{
|
|
74
|
-
o.error = t;
|
|
75
|
-
throw t;
|
|
76
|
-
});
|
|
104
|
+
if (l !== undefined) {
|
|
105
|
+
p.paramCount = l;
|
|
77
106
|
}
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
result: t,
|
|
82
|
-
config: e.config
|
|
83
|
-
};
|
|
84
|
-
e.method.call(e.transversalInstance, n);
|
|
107
|
+
if (g !== undefined) {
|
|
108
|
+
const e = g?.name || a(g);
|
|
109
|
+
p.expectedType = e;
|
|
85
110
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
o.error = t;
|
|
89
|
-
throw t;
|
|
111
|
+
debugLogger.DebugLogger.getInstance().log('error', i, p);
|
|
112
|
+
throw new Error(d);
|
|
90
113
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const e = t[c++];
|
|
97
|
-
const n = {
|
|
98
|
-
...o,
|
|
99
|
-
proceed: s,
|
|
100
|
-
config: e.config
|
|
101
|
-
};
|
|
102
|
-
return e.method.call(e.transversalInstance, n);
|
|
114
|
+
const r = this.injectables.get(e);
|
|
115
|
+
this.resolvingStack.add(r.identifier);
|
|
116
|
+
try {
|
|
117
|
+
if (r.isSingleton) {
|
|
118
|
+
return this.singletonStrategy.resolve(r, t);
|
|
103
119
|
} else {
|
|
104
|
-
return
|
|
120
|
+
return this.transientStrategy.resolve(r, t);
|
|
121
|
+
}
|
|
122
|
+
} finally{
|
|
123
|
+
this.resolvingStack.delete(r.identifier);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
concrete(e) {
|
|
127
|
+
const t = this.injectables.get(e);
|
|
128
|
+
if (t) return t.concrete;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
tagged(...e) {
|
|
132
|
+
const t = [];
|
|
133
|
+
for (const n of e){
|
|
134
|
+
for (const [e, r] of this.injectables){
|
|
135
|
+
if (r.tags.includes(n)) t.push(r.build());
|
|
105
136
|
}
|
|
106
|
-
}
|
|
107
|
-
return
|
|
137
|
+
}
|
|
138
|
+
return t;
|
|
139
|
+
}
|
|
140
|
+
dispose() {
|
|
141
|
+
for (const [e, t] of this.injectables){
|
|
142
|
+
t.dispose();
|
|
143
|
+
}
|
|
144
|
+
this.resolvingStack.clear();
|
|
145
|
+
}
|
|
146
|
+
get size() {
|
|
147
|
+
return this.injectables.size;
|
|
148
|
+
}
|
|
149
|
+
getRegisteredIdentifiers() {
|
|
150
|
+
return Array.from(this.injectables.keys()).map((e)=>e?.name || String(e));
|
|
151
|
+
}
|
|
152
|
+
constructor(){
|
|
153
|
+
this.injectables = new Map();
|
|
154
|
+
this.resolvingStack = new Set();
|
|
155
|
+
this.singletonStrategy = new resolutionStrategies.SingletonStrategy();
|
|
156
|
+
this.transientStrategy = new resolutionStrategies.TransientStrategy();
|
|
108
157
|
}
|
|
109
158
|
}
|
|
110
159
|
|
|
111
|
-
exports.
|
|
160
|
+
exports.InjectableManager = InjectableManager;
|
package/dist/index32.mjs
CHANGED
|
@@ -1,107 +1,156 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { HookManager } from './index34.mjs';
|
|
2
|
+
import { SingletonStrategy, TransientStrategy } from './index43.mjs';
|
|
3
|
+
import { DebugLogger } from './index37.mjs';
|
|
4
|
+
import { isClass } from '@assemblerjs/core';
|
|
5
|
+
import { resolveInstanceInjectionTuple } from './index42.mjs';
|
|
6
|
+
import { resolveInjectionTuple } from './index41.mjs';
|
|
7
|
+
import { Injectable } from './index44.mjs';
|
|
3
8
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const n = Object.getOwnPropertyDescriptor(a, t);
|
|
12
|
-
if (!n) return false;
|
|
13
|
-
const r = n.value && typeof n.value === 'function';
|
|
14
|
-
const o = n.get && typeof n.get === 'function';
|
|
15
|
-
if (!r && !o) return false;
|
|
16
|
-
const c = getAffectedMethods(a, t);
|
|
17
|
-
return c.length > 0;
|
|
18
|
-
});
|
|
19
|
-
if (s.length === 0 && !f) {
|
|
20
|
-
return n;
|
|
9
|
+
function a(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;
|
|
21
16
|
}
|
|
22
|
-
return
|
|
23
|
-
get (t, e, n) {
|
|
24
|
-
const r = Reflect.get(t, e, n);
|
|
25
|
-
if (typeof r !== 'function') {
|
|
26
|
-
return r;
|
|
27
|
-
}
|
|
28
|
-
return function(...n) {
|
|
29
|
-
const o = String(e);
|
|
30
|
-
const a = {
|
|
31
|
-
target: t,
|
|
32
|
-
methodName: o,
|
|
33
|
-
args: n
|
|
34
|
-
};
|
|
35
|
-
const f = c.getAdvicesForJoinPoint(a, s, t, e);
|
|
36
|
-
return TransversalWeaver.executeAdviceChain(f, r, t, n, a);
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
17
|
+
return 'AnonymousFunction';
|
|
40
18
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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;
|
|
26
|
+
}
|
|
27
|
+
const t = e.constructor?.name;
|
|
28
|
+
if (t && t !== 'Object') {
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
45
31
|
try {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
config: t.config
|
|
50
|
-
};
|
|
51
|
-
t.method.call(t.transversalInstance, e);
|
|
32
|
+
const t = JSON.stringify(e);
|
|
33
|
+
if (t.length > 100) {
|
|
34
|
+
return t.substring(0, 100) + '...';
|
|
52
35
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
36
|
+
return t;
|
|
37
|
+
} catch {
|
|
38
|
+
return '[UnknownObject]';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return String(e);
|
|
42
|
+
}
|
|
43
|
+
function f(e) {
|
|
44
|
+
if (isClass(e)) {
|
|
45
|
+
const t = e.prototype && Object.getOwnPropertyNames(e.prototype).length > 1;
|
|
46
|
+
return t ? 'class' : 'class';
|
|
47
|
+
}
|
|
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, s = false) {
|
|
60
|
+
const c = DebugLogger.getInstance();
|
|
61
|
+
const a = s === true ? resolveInstanceInjectionTuple(i) : resolveInjectionTuple(i);
|
|
62
|
+
if (this.has(a.identifier)) {
|
|
63
|
+
const e = `An assemblage is already registered with identifier '${a.identifier.name}'.`;
|
|
64
|
+
c.log('error', 'Duplicate registration', {
|
|
65
|
+
identifier: a.identifier.name,
|
|
66
|
+
error: e
|
|
67
|
+
});
|
|
68
|
+
throw new Error(e);
|
|
69
|
+
}
|
|
70
|
+
const f = Injectable.of(a, this.privateContext, this.publicContext);
|
|
71
|
+
c.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 s = a(e);
|
|
86
|
+
const c = f(e);
|
|
87
|
+
const u = t?.__paramIndex;
|
|
88
|
+
const l = t?.__paramCount;
|
|
89
|
+
const g = t?.__expectedType;
|
|
90
|
+
const d = r ? `Circular dependency detected: '${s}' is already being resolved.` : `Dependency '${s}' has not been registered (Class/Service not found in current assemblages).`;
|
|
91
|
+
const p = {
|
|
92
|
+
identifier: s,
|
|
93
|
+
caller: n ? a(n) : 'unknown',
|
|
94
|
+
type: c,
|
|
95
|
+
error: d
|
|
96
|
+
};
|
|
97
|
+
if (u !== undefined) {
|
|
98
|
+
p.paramIndex = u;
|
|
58
99
|
}
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
for (const e of a){
|
|
62
|
-
const n = {
|
|
63
|
-
...o,
|
|
64
|
-
result: t
|
|
65
|
-
};
|
|
66
|
-
e.method.call(e.transversalInstance, n);
|
|
67
|
-
}
|
|
68
|
-
return t;
|
|
69
|
-
}).catch((t)=>{
|
|
70
|
-
o.error = t;
|
|
71
|
-
throw t;
|
|
72
|
-
});
|
|
100
|
+
if (l !== undefined) {
|
|
101
|
+
p.paramCount = l;
|
|
73
102
|
}
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
result: t,
|
|
78
|
-
config: e.config
|
|
79
|
-
};
|
|
80
|
-
e.method.call(e.transversalInstance, n);
|
|
103
|
+
if (g !== undefined) {
|
|
104
|
+
const e = g?.name || a(g);
|
|
105
|
+
p.expectedType = e;
|
|
81
106
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
o.error = t;
|
|
85
|
-
throw t;
|
|
107
|
+
DebugLogger.getInstance().log('error', i, p);
|
|
108
|
+
throw new Error(d);
|
|
86
109
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const e = t[c++];
|
|
93
|
-
const n = {
|
|
94
|
-
...o,
|
|
95
|
-
proceed: s,
|
|
96
|
-
config: e.config
|
|
97
|
-
};
|
|
98
|
-
return e.method.call(e.transversalInstance, n);
|
|
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);
|
|
99
115
|
} else {
|
|
100
|
-
return
|
|
116
|
+
return this.transientStrategy.resolve(r, t);
|
|
117
|
+
}
|
|
118
|
+
} finally{
|
|
119
|
+
this.resolvingStack.delete(r.identifier);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
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());
|
|
101
132
|
}
|
|
102
|
-
}
|
|
103
|
-
return
|
|
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
|
+
constructor(){
|
|
149
|
+
this.injectables = new Map();
|
|
150
|
+
this.resolvingStack = new Set();
|
|
151
|
+
this.singletonStrategy = new SingletonStrategy();
|
|
152
|
+
this.transientStrategy = new TransientStrategy();
|
|
104
153
|
}
|
|
105
154
|
}
|
|
106
155
|
|
|
107
|
-
export {
|
|
156
|
+
export { InjectableManager };
|
package/dist/index33.js
CHANGED
|
@@ -2,33 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const debugLogger = require('./index37.js');
|
|
6
|
+
|
|
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
|
+
});
|
|
20
|
+
throw new Error(s);
|
|
10
21
|
}
|
|
11
|
-
|
|
12
|
-
return
|
|
22
|
+
this.objects.set(r, o);
|
|
23
|
+
return o;
|
|
13
24
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
matches(t) {
|
|
17
|
-
const e = t.target.constructor.name;
|
|
18
|
-
const c = t.methodName;
|
|
19
|
-
return this.classRegex.test(e) && this.methodRegex.test(c);
|
|
25
|
+
has(e) {
|
|
26
|
+
return this.objects.has(e);
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
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);
|
|
24
38
|
}
|
|
25
|
-
|
|
26
|
-
return new RegExp(`^${e}$`);
|
|
39
|
+
return this.objects.get(r);
|
|
27
40
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
addGlobal(e, t) {
|
|
42
|
+
if (this.globals.has(e)) {
|
|
43
|
+
throw new Error(`Global value with key '${e}' has already been registered.`);
|
|
44
|
+
}
|
|
45
|
+
this.globals.set(e, t);
|
|
31
46
|
}
|
|
32
|
-
|
|
47
|
+
global(e) {
|
|
48
|
+
return this.globals.get(e);
|
|
49
|
+
}
|
|
50
|
+
constructor(){
|
|
51
|
+
this.objects = new Map();
|
|
52
|
+
this.globals = new Map();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
33
55
|
|
|
34
|
-
exports.
|
|
56
|
+
exports.ObjectManager = ObjectManager;
|