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.
- package/dist/index.d.ts +2 -1
- package/dist/index11.js +2 -2
- package/dist/index11.mjs +2 -2
- package/dist/index13.js +98 -83
- package/dist/index13.mjs +98 -83
- package/dist/index16.js +1 -1
- package/dist/index16.mjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index17.mjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index18.mjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index19.mjs +1 -1
- package/dist/index2.js +2 -2
- package/dist/index2.mjs +2 -2
- package/dist/index20.js +1 -1
- package/dist/index20.mjs +1 -1
- package/dist/index21.js +1 -1
- package/dist/index21.mjs +1 -1
- package/dist/index22.js +2 -2
- package/dist/index22.mjs +2 -2
- package/dist/index23.js +2 -2
- package/dist/index23.mjs +2 -2
- package/dist/index24.js +2 -2
- package/dist/index24.mjs +2 -2
- package/dist/index25.js +1 -1
- package/dist/index25.mjs +1 -1
- package/dist/index26.js +1 -1
- package/dist/index26.mjs +1 -1
- package/dist/index27.js +1 -1
- package/dist/index27.mjs +1 -1
- package/dist/index29.js +38 -15
- package/dist/index29.mjs +37 -12
- package/dist/index3.js +1 -1
- package/dist/index3.mjs +1 -1
- package/dist/index30.js +151 -100
- package/dist/index30.mjs +150 -98
- package/dist/index31.js +44 -34
- package/dist/index31.mjs +44 -33
- package/dist/index32.js +73 -16
- package/dist/index32.mjs +73 -16
- package/dist/index33.js +48 -98
- package/dist/index33.mjs +48 -98
- package/dist/index34.js +29 -26
- package/dist/index34.mjs +29 -26
- package/dist/index35.js +146 -138
- package/dist/index35.mjs +146 -137
- package/dist/index36.js +56 -43
- package/dist/index36.mjs +56 -43
- package/dist/index37.js +15 -77
- package/dist/index37.mjs +12 -77
- package/dist/index38.js +103 -51
- package/dist/index38.mjs +101 -51
- package/dist/index39.js +19 -28
- package/dist/index39.mjs +19 -28
- package/dist/index4.js +10 -10
- package/dist/index4.mjs +10 -10
- package/dist/index40.js +94 -151
- package/dist/index40.mjs +94 -151
- package/dist/index41.js +24 -59
- package/dist/index41.mjs +24 -59
- package/dist/index42.js +29 -49
- package/dist/index42.mjs +28 -49
- package/dist/index44.js +50 -943
- package/dist/index44.mjs +48 -941
- package/dist/index45.js +194 -2
- package/dist/index45.mjs +194 -2
- package/dist/index46.js +942 -2
- package/dist/index46.mjs +942 -2
- package/dist/index47.js +2 -29
- package/dist/index47.mjs +2 -28
- package/dist/index48.js +2 -194
- package/dist/index48.mjs +2 -194
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.js +2 -2
- package/dist/index50.mjs +2 -2
- package/dist/index51.js +16 -13
- package/dist/index51.mjs +16 -13
- package/package.json +1 -1
package/dist/index20.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const parameterDecoratorFactory = require('./index17.js');
|
|
6
|
-
const resolverStore = require('./
|
|
6
|
+
const resolverStore = require('./index39.js');
|
|
7
7
|
|
|
8
8
|
let DefinitionResolver = class DefinitionResolver {
|
|
9
9
|
resolve(e, r) {
|
package/dist/index20.mjs
CHANGED
package/dist/index21.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const parameterDecoratorFactory = require('./index17.js');
|
|
6
|
-
const resolverStore = require('./
|
|
6
|
+
const resolverStore = require('./index39.js');
|
|
7
7
|
|
|
8
8
|
let DisposeResolver = class DisposeResolver {
|
|
9
9
|
resolve(e, r, s) {
|
package/dist/index21.mjs
CHANGED
package/dist/index22.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const reflection = require('./
|
|
5
|
+
const reflection = require('./index37.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index39.js');
|
|
9
9
|
|
|
10
10
|
let UseResolver = class UseResolver {
|
|
11
11
|
resolve(r, o, t) {
|
package/dist/index22.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getOwnCustomMetadata } from './
|
|
1
|
+
import { getOwnCustomMetadata } from './index37.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index39.mjs';
|
|
5
5
|
|
|
6
6
|
let UseResolver = class UseResolver {
|
|
7
7
|
resolve(r, o, t) {
|
package/dist/index23.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const reflection = require('./
|
|
5
|
+
const reflection = require('./index37.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index39.js');
|
|
9
9
|
|
|
10
10
|
let GlobalResolver = class GlobalResolver {
|
|
11
11
|
resolve(e, r, a) {
|
package/dist/index23.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getOwnCustomMetadata } from './
|
|
1
|
+
import { getOwnCustomMetadata } from './index37.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index39.mjs';
|
|
5
5
|
|
|
6
6
|
let GlobalResolver = class GlobalResolver {
|
|
7
7
|
resolve(e, r, a) {
|
package/dist/index24.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const reflection = require('./
|
|
5
|
+
const reflection = require('./index37.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index39.js');
|
|
9
9
|
|
|
10
10
|
let OptionalResolver = class OptionalResolver {
|
|
11
11
|
resolve(o, t, n) {
|
package/dist/index24.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getParamTypes, getOwnCustomMetadata } from './
|
|
1
|
+
import { getParamTypes, getOwnCustomMetadata } from './index37.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index39.mjs';
|
|
5
5
|
|
|
6
6
|
let OptionalResolver = class OptionalResolver {
|
|
7
7
|
resolve(o, t, n) {
|
package/dist/index25.js
CHANGED
package/dist/index25.mjs
CHANGED
package/dist/index26.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const constants = require('./index28.js');
|
|
6
|
-
const reflection = require('./
|
|
6
|
+
const reflection = require('./index37.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
8
|
const parameterDecoratorFactory = require('./index17.js');
|
|
9
9
|
const decorator = require('./index2.js');
|
package/dist/index26.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReflectParamTypes, ReflectValue } from './index28.mjs';
|
|
2
|
-
import { getOwnCustomMetadata, defineCustomMetadata } from './
|
|
2
|
+
import { getOwnCustomMetadata, defineCustomMetadata } from './index37.mjs';
|
|
3
3
|
import { getDecoratedParametersIndexes, getParamValueKey, getParamIndexKey } from './index25.mjs';
|
|
4
4
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
5
5
|
import { decorateAssemblage } from './index2.mjs';
|
package/dist/index27.js
CHANGED
package/dist/index27.mjs
CHANGED
package/dist/index29.js
CHANGED
|
@@ -2,22 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const eventManager = require('./index6.js');
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
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);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
for (const e of t.events){
|
|
23
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
9
26
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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);
|
|
33
|
+
}
|
|
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
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
18
43
|
};
|
|
19
44
|
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.getOwnCustomMetadata = getOwnCustomMetadata;
|
|
23
|
-
exports.getParamTypes = getParamTypes;
|
|
45
|
+
exports.registerEvents = registerEvents;
|
|
46
|
+
exports.unregisterEvents = unregisterEvents;
|
package/dist/index29.mjs
CHANGED
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EventManager } from './index6.mjs';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
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);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
for (const e of t.events){
|
|
19
|
+
if (!t.privateContext.events.has(e)) t.privateContext.addChannels(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
5
22
|
};
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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);
|
|
29
|
+
}
|
|
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
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
14
39
|
};
|
|
15
40
|
|
|
16
|
-
export {
|
|
41
|
+
export { registerEvents, unregisterEvents };
|
package/dist/index3.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const constants = require('./index28.js');
|
|
6
|
-
const reflection = require('./
|
|
6
|
+
const reflection = require('./index37.js');
|
|
7
7
|
|
|
8
8
|
const isAssemblage = (s)=>{
|
|
9
9
|
return reflection.getOwnCustomMetadata(constants.ReflectFlags.IsAssemblage, s) || false;
|
package/dist/index3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReflectFlags, ReflectValue } from './index28.mjs';
|
|
2
|
-
import { getOwnCustomMetadata } from './
|
|
2
|
+
import { getOwnCustomMetadata } from './index37.mjs';
|
|
3
3
|
|
|
4
4
|
const isAssemblage = (s)=>{
|
|
5
5
|
return getOwnCustomMetadata(ReflectFlags.IsAssemblage, s) || false;
|
package/dist/index30.js
CHANGED
|
@@ -2,112 +2,163 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const hookManager = require('./index32.js');
|
|
6
|
+
const resolutionStrategies = require('./index42.js');
|
|
7
|
+
const debugLogger = require('./index35.js');
|
|
8
|
+
const core = require('@assemblerjs/core');
|
|
9
|
+
const use = require('./index43.js');
|
|
10
|
+
const inject = require('./index44.js');
|
|
11
|
+
const injectable = require('./index45.js');
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return typeof r === 'undefined' ? true : r ? true : false;
|
|
13
|
+
function formatIdentifier(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;
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
events: {
|
|
20
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
21
|
-
throw: ()=>{
|
|
22
|
-
throw new Error(`'events' property must be an array of strings or 'undefined'.`);
|
|
23
|
-
},
|
|
24
|
-
transform: (r)=>r
|
|
25
|
-
},
|
|
26
|
-
inject: {
|
|
27
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
28
|
-
throw: ()=>{
|
|
29
|
-
throw new Error(`'inject' property must be an array of tuples of length 1, 2 or 3.`);
|
|
30
|
-
},
|
|
31
|
-
transform: (r)=>r
|
|
32
|
-
},
|
|
33
|
-
use: {
|
|
34
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>{
|
|
35
|
-
if (!Array.isArray(r) || r.length !== 2) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
const e = r[1];
|
|
39
|
-
return typeof e !== 'undefined';
|
|
40
|
-
}),
|
|
41
|
-
throw: ()=>{
|
|
42
|
-
throw new Error(`'use' property must be an array of tuples of length 2 with [identifier, instance | factory].`);
|
|
43
|
-
},
|
|
44
|
-
transform: (r)=>r
|
|
45
|
-
},
|
|
46
|
-
engage: {
|
|
47
|
-
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
48
|
-
throw: ()=>{
|
|
49
|
-
throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
|
|
50
|
-
},
|
|
51
|
-
transform: (r)=>r
|
|
52
|
-
},
|
|
53
|
-
tags: {
|
|
54
|
-
test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
55
|
-
throw: ()=>{
|
|
56
|
-
throw new Error(`'tags' property must be a string or an array of strings.`);
|
|
57
|
-
},
|
|
58
|
-
transform: (r)=>typeof r === 'string' ? [
|
|
59
|
-
r
|
|
60
|
-
] : r
|
|
61
|
-
},
|
|
62
|
-
metadata: {
|
|
63
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
64
|
-
throw: ()=>{
|
|
65
|
-
throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
|
|
66
|
-
},
|
|
67
|
-
transform: (r)=>r
|
|
68
|
-
},
|
|
69
|
-
global: {
|
|
70
|
-
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
71
|
-
throw: ()=>{
|
|
72
|
-
throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
|
|
73
|
-
},
|
|
74
|
-
transform: (r)=>r
|
|
21
|
+
return 'AnonymousFunction';
|
|
75
22
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
throw new Error(`Property '${r}' is not a valid assemblage definition property.`);
|
|
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;
|
|
84
30
|
}
|
|
31
|
+
const t = e.constructor?.name;
|
|
32
|
+
if (t && t !== 'Object') {
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const t = JSON.stringify(e);
|
|
37
|
+
if (t.length > 100) {
|
|
38
|
+
return t.substring(0, 100) + '...';
|
|
39
|
+
}
|
|
40
|
+
return t;
|
|
41
|
+
} catch {
|
|
42
|
+
return '[UnknownObject]';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return String(e);
|
|
46
|
+
}
|
|
47
|
+
function c(e) {
|
|
48
|
+
if (core.isClass(e)) {
|
|
49
|
+
const t = e.prototype && Object.getOwnPropertyNames(e.prototype).length > 1;
|
|
50
|
+
return t ? 'class' : 'class';
|
|
85
51
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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, o = false) {
|
|
64
|
+
const a = debugLogger.DebugLogger.getInstance();
|
|
65
|
+
const c = o === true ? use.resolveInstanceInjectionTuple(i) : inject.resolveInjectionTuple(i);
|
|
66
|
+
if (this.has(c.identifier)) {
|
|
67
|
+
const e = `An assemblage is already registered with identifier '${c.identifier.name}'.`;
|
|
68
|
+
a.log('error', 'Duplicate registration', {
|
|
69
|
+
identifier: c.identifier.name,
|
|
70
|
+
error: e
|
|
71
|
+
});
|
|
72
|
+
throw new Error(e);
|
|
73
|
+
}
|
|
74
|
+
const f = injectable.Injectable.of(c, this.privateContext, this.publicContext);
|
|
75
|
+
a.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 o = formatIdentifier(e);
|
|
90
|
+
const a = c(e);
|
|
91
|
+
const f = t?.__paramIndex;
|
|
92
|
+
const u = t?.__paramCount;
|
|
93
|
+
const l = t?.__expectedType;
|
|
94
|
+
const g = r ? `Circular dependency detected: '${o}' is already being resolved.` : `Dependency '${o}' has not been registered (Class/Service not found in current assemblages).`;
|
|
95
|
+
const d = {
|
|
96
|
+
identifier: o,
|
|
97
|
+
caller: n ? formatIdentifier(n) : 'unknown',
|
|
98
|
+
type: a,
|
|
99
|
+
error: g
|
|
100
|
+
};
|
|
101
|
+
if (f !== undefined) {
|
|
102
|
+
d.paramIndex = f;
|
|
103
|
+
}
|
|
104
|
+
if (u !== undefined) {
|
|
105
|
+
d.paramCount = u;
|
|
106
|
+
}
|
|
107
|
+
if (l !== undefined) {
|
|
108
|
+
const e = l?.name || formatIdentifier(l);
|
|
109
|
+
d.expectedType = e;
|
|
110
|
+
}
|
|
111
|
+
debugLogger.DebugLogger.getInstance().log('error', i, d);
|
|
112
|
+
throw new Error(g);
|
|
113
|
+
}
|
|
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);
|
|
119
|
+
} else {
|
|
120
|
+
return this.transientStrategy.resolve(r, t);
|
|
121
|
+
}
|
|
122
|
+
} finally{
|
|
123
|
+
this.resolvingStack.delete(r.identifier);
|
|
92
124
|
}
|
|
93
|
-
e[r] = s(e[r]);
|
|
94
125
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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());
|
|
136
|
+
}
|
|
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
|
+
getInjectables() {
|
|
153
|
+
return this.injectables;
|
|
154
|
+
}
|
|
155
|
+
constructor(){
|
|
156
|
+
this.injectables = new Map();
|
|
157
|
+
this.resolvingStack = new Set();
|
|
158
|
+
this.singletonStrategy = new resolutionStrategies.SingletonStrategy();
|
|
159
|
+
this.transientStrategy = new resolutionStrategies.TransientStrategy();
|
|
100
160
|
}
|
|
101
|
-
|
|
102
|
-
};
|
|
103
|
-
const setDefinitionValue = (t, o, n)=>{
|
|
104
|
-
const s = getDefinition(n);
|
|
105
|
-
s[t] = o;
|
|
106
|
-
const a = validateDefinition(s);
|
|
107
|
-
reflection.defineCustomMetadata(constants.ReflectValue.AssemblageDefinition, a, n);
|
|
108
|
-
return a;
|
|
109
|
-
};
|
|
161
|
+
}
|
|
110
162
|
|
|
111
|
-
exports.
|
|
112
|
-
exports.
|
|
113
|
-
exports.validateDefinition = validateDefinition;
|
|
163
|
+
exports.InjectableManager = InjectableManager;
|
|
164
|
+
exports.formatIdentifier = formatIdentifier;
|