assemblerjs 1.1.12 → 1.1.13
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/index18.js +1 -1
- package/dist/index18.mjs +1 -1
- package/dist/index19.js +1 -1
- package/dist/index19.mjs +1 -1
- 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 +1 -1
- package/dist/index22.mjs +1 -1
- package/dist/index23.js +1 -1
- package/dist/index23.mjs +1 -1
- package/dist/index24.js +1 -1
- package/dist/index24.mjs +1 -1
- package/dist/index27.js +1 -1
- package/dist/index27.mjs +1 -1
- package/dist/index31.js +16 -134
- package/dist/index31.mjs +16 -134
- package/dist/index32.js +99 -44
- package/dist/index32.mjs +99 -44
- package/dist/index33.js +23 -74
- package/dist/index33.mjs +23 -74
- package/dist/index34.js +138 -42
- package/dist/index34.mjs +138 -42
- package/dist/index35.js +47 -28
- package/dist/index35.mjs +47 -28
- package/dist/index36.js +66 -149
- package/dist/index36.mjs +66 -149
- package/dist/index37.js +41 -19
- package/dist/index37.mjs +41 -19
- package/dist/index38.js +30 -39
- package/dist/index38.mjs +30 -38
- package/dist/index39.js +151 -94
- package/dist/index39.mjs +151 -94
- package/dist/index4.js +6 -6
- package/dist/index4.mjs +6 -6
- package/dist/index40.js +36 -24
- package/dist/index40.mjs +35 -24
- package/dist/index43.js +941 -28
- package/dist/index43.mjs +941 -27
- package/dist/index44.js +2 -194
- package/dist/index44.mjs +2 -194
- package/dist/index45.js +2 -942
- package/dist/index45.mjs +2 -942
- package/dist/index46.js +29 -2
- package/dist/index46.mjs +28 -2
- package/dist/index47.js +194 -2
- package/dist/index47.mjs +194 -2
- package/dist/index48.js +1 -1
- package/dist/index48.mjs +1 -1
- package/dist/index49.js +2 -2
- package/dist/index49.mjs +2 -2
- 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('./index33.js');
|
|
7
7
|
const affect = require('./index12.js');
|
|
8
8
|
const schema = require('./index30.js');
|
|
9
9
|
|
package/dist/index13.mjs
CHANGED
package/dist/index18.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('./index31.js');
|
|
7
7
|
|
|
8
8
|
let ContextResolver = class ContextResolver {
|
|
9
9
|
resolve(e, r, t) {
|
package/dist/index18.mjs
CHANGED
package/dist/index19.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('./index31.js');
|
|
7
7
|
|
|
8
8
|
let ConfigurationResolver = class ConfigurationResolver {
|
|
9
9
|
resolve(r, o, e, n) {
|
package/dist/index19.mjs
CHANGED
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('./index31.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('./index31.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
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reflection = require('./index29.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index31.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
1
|
import { getOwnCustomMetadata } from './index29.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index31.mjs';
|
|
5
5
|
|
|
6
6
|
let UseResolver = class UseResolver {
|
|
7
7
|
resolve(r, o, t) {
|
package/dist/index23.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reflection = require('./index29.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index31.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
1
|
import { getOwnCustomMetadata } from './index29.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index31.mjs';
|
|
5
5
|
|
|
6
6
|
let GlobalResolver = class GlobalResolver {
|
|
7
7
|
resolve(e, r, a) {
|
package/dist/index24.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reflection = require('./index29.js');
|
|
6
6
|
const parameterDecoratorFactory = require('./index17.js');
|
|
7
7
|
const helpers = require('./index25.js');
|
|
8
|
-
const resolverStore = require('./
|
|
8
|
+
const resolverStore = require('./index31.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
1
|
import { getParamTypes, getOwnCustomMetadata } from './index29.mjs';
|
|
2
2
|
import { ParameterDecoratorFactory } from './index17.mjs';
|
|
3
3
|
import { getParamValueKey } from './index25.mjs';
|
|
4
|
-
import { ResolverStore } from './
|
|
4
|
+
import { ResolverStore } from './index31.mjs';
|
|
5
5
|
|
|
6
6
|
let OptionalResolver = class OptionalResolver {
|
|
7
7
|
resolve(o, t, n) {
|
package/dist/index27.js
CHANGED
package/dist/index27.mjs
CHANGED
package/dist/index31.js
CHANGED
|
@@ -2,145 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const core = require('@assemblerjs/core');
|
|
9
|
-
const use = require('./index42.js');
|
|
10
|
-
const inject = require('./index41.js');
|
|
11
|
-
const injectable = require('./index44.js');
|
|
12
|
-
|
|
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;
|
|
20
|
-
}
|
|
21
|
-
return 'AnonymousFunction';
|
|
22
|
-
}
|
|
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
|
-
}
|
|
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 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 t = this.resolvingStack.has(e);
|
|
88
|
-
const r = t ? 'Circular dependency detected' : 'Dependency not registered';
|
|
89
|
-
const i = a(e);
|
|
90
|
-
const s = f(e);
|
|
91
|
-
const c = t ? `Circular dependency detected: '${i}' is already being resolved.` : `Dependency '${i}' has not been registered (Class/Service not found in current assemblies).`;
|
|
92
|
-
debugLogger.DebugLogger.getInstance().log('error', r, {
|
|
93
|
-
identifier: i,
|
|
94
|
-
caller: n ? a(n) : 'unknown',
|
|
95
|
-
type: s,
|
|
96
|
-
error: c
|
|
97
|
-
});
|
|
98
|
-
throw new Error(c);
|
|
99
|
-
}
|
|
100
|
-
const r = this.injectables.get(e);
|
|
101
|
-
this.resolvingStack.add(r.identifier);
|
|
102
|
-
try {
|
|
103
|
-
if (r.isSingleton) {
|
|
104
|
-
return this.singletonStrategy.resolve(r, t);
|
|
105
|
-
} else {
|
|
106
|
-
return this.transientStrategy.resolve(r, t);
|
|
107
|
-
}
|
|
108
|
-
} finally{
|
|
109
|
-
this.resolvingStack.delete(r.identifier);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
concrete(e) {
|
|
113
|
-
const t = this.injectables.get(e);
|
|
114
|
-
if (t) return t.concrete;
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
tagged(...e) {
|
|
118
|
-
const t = [];
|
|
119
|
-
for (const n of e){
|
|
120
|
-
for (const [e, r] of this.injectables){
|
|
121
|
-
if (r.tags.includes(n)) t.push(r.build());
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return t;
|
|
5
|
+
class ResolverStore {
|
|
6
|
+
static register(e, r) {
|
|
7
|
+
this.resolvers.set(e, r);
|
|
125
8
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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}`);
|
|
129
13
|
}
|
|
130
|
-
|
|
14
|
+
return new r();
|
|
131
15
|
}
|
|
132
|
-
|
|
133
|
-
return this.
|
|
16
|
+
static hasResolver(e) {
|
|
17
|
+
return this.resolvers.has(e);
|
|
134
18
|
}
|
|
135
|
-
|
|
136
|
-
return Array.from(this.
|
|
19
|
+
static getRegisteredTypes() {
|
|
20
|
+
return Array.from(this.resolvers.keys());
|
|
137
21
|
}
|
|
138
|
-
|
|
139
|
-
this.
|
|
140
|
-
this.resolvingStack = new Set();
|
|
141
|
-
this.singletonStrategy = new resolutionStrategies.SingletonStrategy();
|
|
142
|
-
this.transientStrategy = new resolutionStrategies.TransientStrategy();
|
|
22
|
+
static clear() {
|
|
23
|
+
this.resolvers.clear();
|
|
143
24
|
}
|
|
144
25
|
}
|
|
26
|
+
ResolverStore.resolvers = new Map();
|
|
145
27
|
|
|
146
|
-
exports.
|
|
28
|
+
exports.ResolverStore = ResolverStore;
|
package/dist/index31.mjs
CHANGED
|
@@ -1,142 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { isClass } from '@assemblerjs/core';
|
|
5
|
-
import { resolveInstanceInjectionTuple } from './index42.mjs';
|
|
6
|
-
import { resolveInjectionTuple } from './index41.mjs';
|
|
7
|
-
import { Injectable } from './index44.mjs';
|
|
8
|
-
|
|
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;
|
|
16
|
-
}
|
|
17
|
-
return 'AnonymousFunction';
|
|
18
|
-
}
|
|
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
|
-
}
|
|
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 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 t = this.resolvingStack.has(e);
|
|
84
|
-
const r = t ? 'Circular dependency detected' : 'Dependency not registered';
|
|
85
|
-
const i = a(e);
|
|
86
|
-
const s = f(e);
|
|
87
|
-
const c = t ? `Circular dependency detected: '${i}' is already being resolved.` : `Dependency '${i}' has not been registered (Class/Service not found in current assemblies).`;
|
|
88
|
-
DebugLogger.getInstance().log('error', r, {
|
|
89
|
-
identifier: i,
|
|
90
|
-
caller: n ? a(n) : 'unknown',
|
|
91
|
-
type: s,
|
|
92
|
-
error: c
|
|
93
|
-
});
|
|
94
|
-
throw new Error(c);
|
|
95
|
-
}
|
|
96
|
-
const r = this.injectables.get(e);
|
|
97
|
-
this.resolvingStack.add(r.identifier);
|
|
98
|
-
try {
|
|
99
|
-
if (r.isSingleton) {
|
|
100
|
-
return this.singletonStrategy.resolve(r, t);
|
|
101
|
-
} else {
|
|
102
|
-
return this.transientStrategy.resolve(r, t);
|
|
103
|
-
}
|
|
104
|
-
} finally{
|
|
105
|
-
this.resolvingStack.delete(r.identifier);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
concrete(e) {
|
|
109
|
-
const t = this.injectables.get(e);
|
|
110
|
-
if (t) return t.concrete;
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
tagged(...e) {
|
|
114
|
-
const t = [];
|
|
115
|
-
for (const n of e){
|
|
116
|
-
for (const [e, r] of this.injectables){
|
|
117
|
-
if (r.tags.includes(n)) t.push(r.build());
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return t;
|
|
1
|
+
class ResolverStore {
|
|
2
|
+
static register(e, r) {
|
|
3
|
+
this.resolvers.set(e, r);
|
|
121
4
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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}`);
|
|
125
9
|
}
|
|
126
|
-
|
|
10
|
+
return new r();
|
|
127
11
|
}
|
|
128
|
-
|
|
129
|
-
return this.
|
|
12
|
+
static hasResolver(e) {
|
|
13
|
+
return this.resolvers.has(e);
|
|
130
14
|
}
|
|
131
|
-
|
|
132
|
-
return Array.from(this.
|
|
15
|
+
static getRegisteredTypes() {
|
|
16
|
+
return Array.from(this.resolvers.keys());
|
|
133
17
|
}
|
|
134
|
-
|
|
135
|
-
this.
|
|
136
|
-
this.resolvingStack = new Set();
|
|
137
|
-
this.singletonStrategy = new SingletonStrategy();
|
|
138
|
-
this.transientStrategy = new TransientStrategy();
|
|
18
|
+
static clear() {
|
|
19
|
+
this.resolvers.clear();
|
|
139
20
|
}
|
|
140
21
|
}
|
|
22
|
+
ResolverStore.resolvers = new Map();
|
|
141
23
|
|
|
142
|
-
export {
|
|
24
|
+
export { ResolverStore };
|
package/dist/index32.js
CHANGED
|
@@ -2,55 +2,110 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const transversalManager = require('./index13.js');
|
|
6
|
+
const affect = require('./index12.js');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
class TransversalWeaver {
|
|
9
|
+
static weave(n, r, o) {
|
|
10
|
+
const c = transversalManager.TransversalManager.getInstance(o);
|
|
11
|
+
const s = c.getAspectsForTarget(r);
|
|
12
|
+
const a = Object.getPrototypeOf(n);
|
|
13
|
+
const f = Object.getOwnPropertyNames(a).some((t)=>{
|
|
14
|
+
if (t === 'constructor') return false;
|
|
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;
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
return new Proxy(n, {
|
|
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
|
+
});
|
|
27
44
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
static executeAdviceChain(t, e, n, r, o) {
|
|
46
|
+
const c = t.filter((t)=>t.type === 'before');
|
|
47
|
+
const s = t.filter((t)=>t.type === 'around');
|
|
48
|
+
const a = t.filter((t)=>t.type === 'after');
|
|
49
|
+
try {
|
|
50
|
+
for (const t of c){
|
|
51
|
+
const e = {
|
|
52
|
+
...o,
|
|
53
|
+
config: t.config
|
|
54
|
+
};
|
|
55
|
+
t.method.call(t.transversalInstance, e);
|
|
56
|
+
}
|
|
57
|
+
let t;
|
|
58
|
+
if (s.length > 0) {
|
|
59
|
+
t = this.buildAroundChain(s, e, n, r, o);
|
|
60
|
+
} else {
|
|
61
|
+
t = e.apply(n, r);
|
|
62
|
+
}
|
|
63
|
+
if (t instanceof Promise) {
|
|
64
|
+
return t.then((t)=>{
|
|
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
|
+
});
|
|
77
|
+
}
|
|
78
|
+
for (const e of a){
|
|
79
|
+
const n = {
|
|
80
|
+
...o,
|
|
81
|
+
result: t,
|
|
82
|
+
config: e.config
|
|
83
|
+
};
|
|
84
|
+
e.method.call(e.transversalInstance, n);
|
|
85
|
+
}
|
|
86
|
+
return t;
|
|
87
|
+
} catch (t) {
|
|
88
|
+
o.error = t;
|
|
89
|
+
throw t;
|
|
38
90
|
}
|
|
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.`);
|
|
44
|
-
}
|
|
45
|
-
this.globals.set(e, t);
|
|
46
|
-
}
|
|
47
|
-
global(e) {
|
|
48
|
-
return this.globals.get(e);
|
|
49
91
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
92
|
+
static buildAroundChain(t, e, n, r, o) {
|
|
93
|
+
let c = 0;
|
|
94
|
+
const s = ()=>{
|
|
95
|
+
if (c < t.length) {
|
|
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);
|
|
103
|
+
} else {
|
|
104
|
+
return e.apply(n, r);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return s();
|
|
53
108
|
}
|
|
54
109
|
}
|
|
55
110
|
|
|
56
|
-
exports.
|
|
111
|
+
exports.TransversalWeaver = TransversalWeaver;
|