assemblerjs 1.1.0 → 1.1.1
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/index11.js +2 -2
- package/dist/index11.mjs +2 -2
- package/dist/index13.js +1 -1
- package/dist/index13.mjs +1 -1
- 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/index29.js +17 -63
- package/dist/index29.mjs +14 -63
- package/dist/index3.js +1 -1
- package/dist/index3.mjs +1 -1
- package/dist/index30.js +95 -25
- package/dist/index30.mjs +93 -25
- package/dist/index31.js +16 -59
- package/dist/index31.mjs +16 -59
- package/dist/index32.js +60 -28
- package/dist/index32.mjs +60 -28
- package/dist/index33.js +28 -28
- package/dist/index33.mjs +28 -28
- package/dist/index34.js +63 -15
- package/dist/index34.mjs +63 -12
- package/dist/index35.js +28 -19
- package/dist/index35.mjs +28 -19
- package/dist/index36.js +30 -39
- package/dist/index36.mjs +30 -38
- package/dist/index37.js +33 -94
- package/dist/index37.mjs +32 -92
- package/dist/index38.js +12 -7
- package/dist/index38.mjs +12 -7
- package/dist/index4.js +5 -5
- package/dist/index4.mjs +5 -5
- package/dist/index40.js +49 -29
- package/dist/index40.mjs +49 -28
- package/dist/index42.js +29 -49
- package/dist/index42.mjs +28 -49
- package/dist/index43.js +4 -4
- package/dist/index43.mjs +4 -4
- package/dist/index47.js +1 -1
- package/dist/index47.mjs +1 -1
- package/dist/index48.js +1 -1
- package/dist/index48.mjs +1 -1
- package/dist/index49.js +1 -1
- package/dist/index49.mjs +1 -1
- package/package.json +1 -5
package/dist/index11.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
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('./index29.js');
|
|
7
7
|
const decorator = require('./index2.js');
|
|
8
|
-
const schema = require('./
|
|
8
|
+
const schema = require('./index30.js');
|
|
9
9
|
|
|
10
10
|
function isTransversal(e) {
|
|
11
11
|
try {
|
package/dist/index11.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReflectValue } from './index28.mjs';
|
|
2
|
-
import { getCustomMetadata, defineCustomMetadata } from './
|
|
2
|
+
import { getCustomMetadata, defineCustomMetadata } from './index29.mjs';
|
|
3
3
|
import { Assemblage } from './index2.mjs';
|
|
4
|
-
import { getDefinition } from './
|
|
4
|
+
import { getDefinition } from './index30.mjs';
|
|
5
5
|
|
|
6
6
|
function isTransversal(e) {
|
|
7
7
|
try {
|
package/dist/index13.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const core = require('@assemblerjs/core');
|
|
6
6
|
const pointcutMatcher = require('./index39.js');
|
|
7
7
|
const affect = require('./index12.js');
|
|
8
|
-
const schema = require('./
|
|
8
|
+
const schema = require('./index30.js');
|
|
9
9
|
|
|
10
10
|
class TransversalManager {
|
|
11
11
|
static getInstance(e) {
|
package/dist/index13.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isClass } from '@assemblerjs/core';
|
|
2
2
|
import { PointcutMatcher } from './index39.mjs';
|
|
3
3
|
import { getAffectedMethods } from './index12.mjs';
|
|
4
|
-
import { getDefinition } from './
|
|
4
|
+
import { getDefinition } from './index30.mjs';
|
|
5
5
|
|
|
6
6
|
class TransversalManager {
|
|
7
7
|
static getInstance(e) {
|
package/dist/index16.js
CHANGED
package/dist/index16.mjs
CHANGED
package/dist/index17.js
CHANGED
package/dist/index17.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/index2.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const constants = require('./index28.js');
|
|
6
|
-
const reflection = require('./
|
|
7
|
-
const schema = require('./
|
|
6
|
+
const reflection = require('./index29.js');
|
|
7
|
+
const schema = require('./index30.js');
|
|
8
8
|
|
|
9
9
|
const Assemblage = (e)=>{
|
|
10
10
|
return (r)=>{
|
package/dist/index2.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReflectFlags, ReflectValue } from './index28.mjs';
|
|
2
|
-
import { defineCustomMetadata } from './
|
|
3
|
-
import { validateDefinition } from './
|
|
2
|
+
import { defineCustomMetadata } from './index29.mjs';
|
|
3
|
+
import { validateDefinition } from './index30.mjs';
|
|
4
4
|
|
|
5
5
|
const Assemblage = (e)=>{
|
|
6
6
|
return (r)=>{
|
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
|
@@ -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('./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
|
-
import { getOwnCustomMetadata } from './
|
|
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
|
@@ -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('./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
|
-
import { getOwnCustomMetadata } from './
|
|
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
|
@@ -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('./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
|
-
import { getParamTypes, getOwnCustomMetadata } from './
|
|
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/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('./index29.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 './index29.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/index29.js
CHANGED
|
@@ -2,68 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const resolutionStrategies = require('./index40.js');
|
|
7
|
-
const use = require('./index41.js');
|
|
8
|
-
const inject = require('./index42.js');
|
|
9
|
-
const injectable = require('./index43.js');
|
|
5
|
+
const constants = require('./index28.js');
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
hookManager.HookManager.callHook(a.concrete, 'onRegister', this.publicContext, a.configuration);
|
|
24
|
-
return a;
|
|
25
|
-
}
|
|
26
|
-
has(e) {
|
|
27
|
-
return this.injectables.has(e);
|
|
28
|
-
}
|
|
29
|
-
require(e, t) {
|
|
30
|
-
if (!this.injectables.has(e)) {
|
|
31
|
-
throw new Error(`Class with identifier '${e.name}' has not been registered or is a circular dependency.`);
|
|
32
|
-
}
|
|
33
|
-
const i = this.injectables.get(e);
|
|
34
|
-
if (i.isSingleton) {
|
|
35
|
-
return this.singletonStrategy.resolve(i, t);
|
|
36
|
-
} else {
|
|
37
|
-
return this.transientStrategy.resolve(i, t);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
concrete(e) {
|
|
41
|
-
const t = this.injectables.get(e);
|
|
42
|
-
if (t) return t.concrete;
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
tagged(...e) {
|
|
46
|
-
const t = [];
|
|
47
|
-
for (const i of e){
|
|
48
|
-
for (const [e, s] of this.injectables){
|
|
49
|
-
if (s.tags.includes(i)) t.push(s.build());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return t;
|
|
53
|
-
}
|
|
54
|
-
dispose() {
|
|
55
|
-
for (const [e, t] of this.injectables){
|
|
56
|
-
t.dispose();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
get size() {
|
|
60
|
-
return this.injectables.size;
|
|
61
|
-
}
|
|
62
|
-
constructor(){
|
|
63
|
-
this.injectables = new Map();
|
|
64
|
-
this.singletonStrategy = new resolutionStrategies.SingletonStrategy();
|
|
65
|
-
this.transientStrategy = new resolutionStrategies.TransientStrategy();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
7
|
+
const defineCustomMetadata = (t, o, n)=>{
|
|
8
|
+
Reflect.defineMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o, n);
|
|
9
|
+
};
|
|
10
|
+
const getCustomMetadata = (t, o)=>{
|
|
11
|
+
return Reflect.getMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
|
|
12
|
+
};
|
|
13
|
+
const getOwnCustomMetadata = (t, o)=>{
|
|
14
|
+
return Reflect.getOwnMetadata(`${constants.ReflectPrefix}${t}${constants.ReflectSuffix}`, o);
|
|
15
|
+
};
|
|
16
|
+
const getParamTypes = (e)=>{
|
|
17
|
+
return Reflect.getMetadata(constants.ReflectParamTypes, e) || [];
|
|
18
|
+
};
|
|
68
19
|
|
|
69
|
-
exports.
|
|
20
|
+
exports.defineCustomMetadata = defineCustomMetadata;
|
|
21
|
+
exports.getCustomMetadata = getCustomMetadata;
|
|
22
|
+
exports.getOwnCustomMetadata = getOwnCustomMetadata;
|
|
23
|
+
exports.getParamTypes = getParamTypes;
|
package/dist/index29.mjs
CHANGED
|
@@ -1,65 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SingletonStrategy, TransientStrategy } from './index40.mjs';
|
|
3
|
-
import { resolveInstanceInjectionTuple } from './index41.mjs';
|
|
4
|
-
import { resolveInjectionTuple } from './index42.mjs';
|
|
5
|
-
import { Injectable } from './index43.mjs';
|
|
1
|
+
import { ReflectPrefix, ReflectSuffix, ReflectParamTypes } from './index28.mjs';
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
HookManager.callHook(a.concrete, 'onRegister', this.publicContext, a.configuration);
|
|
20
|
-
return a;
|
|
21
|
-
}
|
|
22
|
-
has(e) {
|
|
23
|
-
return this.injectables.has(e);
|
|
24
|
-
}
|
|
25
|
-
require(e, t) {
|
|
26
|
-
if (!this.injectables.has(e)) {
|
|
27
|
-
throw new Error(`Class with identifier '${e.name}' has not been registered or is a circular dependency.`);
|
|
28
|
-
}
|
|
29
|
-
const i = this.injectables.get(e);
|
|
30
|
-
if (i.isSingleton) {
|
|
31
|
-
return this.singletonStrategy.resolve(i, t);
|
|
32
|
-
} else {
|
|
33
|
-
return this.transientStrategy.resolve(i, t);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
concrete(e) {
|
|
37
|
-
const t = this.injectables.get(e);
|
|
38
|
-
if (t) return t.concrete;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
tagged(...e) {
|
|
42
|
-
const t = [];
|
|
43
|
-
for (const i of e){
|
|
44
|
-
for (const [e, s] of this.injectables){
|
|
45
|
-
if (s.tags.includes(i)) t.push(s.build());
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return t;
|
|
49
|
-
}
|
|
50
|
-
dispose() {
|
|
51
|
-
for (const [e, t] of this.injectables){
|
|
52
|
-
t.dispose();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
get size() {
|
|
56
|
-
return this.injectables.size;
|
|
57
|
-
}
|
|
58
|
-
constructor(){
|
|
59
|
-
this.injectables = new Map();
|
|
60
|
-
this.singletonStrategy = new SingletonStrategy();
|
|
61
|
-
this.transientStrategy = new TransientStrategy();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
3
|
+
const defineCustomMetadata = (t, o, n)=>{
|
|
4
|
+
Reflect.defineMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o, n);
|
|
5
|
+
};
|
|
6
|
+
const getCustomMetadata = (t, o)=>{
|
|
7
|
+
return Reflect.getMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
|
|
8
|
+
};
|
|
9
|
+
const getOwnCustomMetadata = (t, o)=>{
|
|
10
|
+
return Reflect.getOwnMetadata(`${ReflectPrefix}${t}${ReflectSuffix}`, o);
|
|
11
|
+
};
|
|
12
|
+
const getParamTypes = (e)=>{
|
|
13
|
+
return Reflect.getMetadata(ReflectParamTypes, e) || [];
|
|
14
|
+
};
|
|
64
15
|
|
|
65
|
-
export {
|
|
16
|
+
export { defineCustomMetadata, getCustomMetadata, getOwnCustomMetadata, getParamTypes };
|
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('./index29.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 './index29.mjs';
|
|
3
3
|
|
|
4
4
|
const isAssemblage = (s)=>{
|
|
5
5
|
return getOwnCustomMetadata(ReflectFlags.IsAssemblage, s) || false;
|
package/dist/index30.js
CHANGED
|
@@ -2,36 +2,106 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const constants = require('./index28.js');
|
|
6
|
+
const reflection = require('./index29.js');
|
|
7
|
+
const helpers = require('./index3.js');
|
|
8
|
+
|
|
9
|
+
const n = {
|
|
10
|
+
singleton: {
|
|
11
|
+
test: (r)=>typeof r === 'boolean' || typeof r === 'undefined',
|
|
12
|
+
throw: ()=>{
|
|
13
|
+
throw new Error(`'singleton' property must be of type 'boolean' or 'undefined'.`);
|
|
14
|
+
},
|
|
15
|
+
transform: (r)=>{
|
|
16
|
+
return typeof r === 'undefined' ? true : r ? true : false;
|
|
9
17
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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)=>Array.isArray(r) && r.length == 2),
|
|
35
|
+
throw: ()=>{
|
|
36
|
+
throw new Error(`'use' property must be an array of tuples of length 2.`);
|
|
37
|
+
},
|
|
38
|
+
transform: (r)=>r
|
|
39
|
+
},
|
|
40
|
+
engage: {
|
|
41
|
+
test: (r)=>typeof r === 'undefined' || Array.isArray(r) && r.every((r)=>Array.isArray(r) && r.length >= 1 && r.length <= 3),
|
|
42
|
+
throw: ()=>{
|
|
43
|
+
throw new Error(`'engage' property must be an array of tuples of length 1, 2 or 3.`);
|
|
44
|
+
},
|
|
45
|
+
transform: (r)=>r
|
|
46
|
+
},
|
|
47
|
+
tags: {
|
|
48
|
+
test: (r)=>typeof r === 'undefined' || typeof r === 'string' || Array.isArray(r) && r.every((r)=>typeof r === 'string'),
|
|
49
|
+
throw: ()=>{
|
|
50
|
+
throw new Error(`'tags' property must be a string or an array of strings.`);
|
|
51
|
+
},
|
|
52
|
+
transform: (r)=>typeof r === 'string' ? [
|
|
53
|
+
r
|
|
54
|
+
] : r
|
|
55
|
+
},
|
|
56
|
+
metadata: {
|
|
57
|
+
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
58
|
+
throw: ()=>{
|
|
59
|
+
throw new Error(`'metadata' property must be of type 'object' or 'undefined'.`);
|
|
60
|
+
},
|
|
61
|
+
transform: (r)=>r
|
|
62
|
+
},
|
|
63
|
+
global: {
|
|
64
|
+
test: (r)=>(typeof r === 'object' || typeof r === 'undefined') && !Array.isArray(r),
|
|
65
|
+
throw: ()=>{
|
|
66
|
+
throw new Error(`'global' property must be of type 'object' or 'undefined'.`);
|
|
67
|
+
},
|
|
68
|
+
transform: (r)=>r
|
|
15
69
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
70
|
+
};
|
|
71
|
+
const validateDefinition = (r)=>{
|
|
72
|
+
const e = {
|
|
73
|
+
...r
|
|
74
|
+
};
|
|
75
|
+
for(const r in e){
|
|
76
|
+
if (!Object.keys(n).includes(r)) {
|
|
77
|
+
throw new Error(`Property '${r}' is not a valid assemblage definition property.`);
|
|
19
78
|
}
|
|
20
|
-
return this.objects.get(e);
|
|
21
79
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
80
|
+
for(const r in n){
|
|
81
|
+
const t = n[r].test;
|
|
82
|
+
const o = n[r].throw;
|
|
83
|
+
const s = n[r].transform;
|
|
84
|
+
if (!t(e[r])) {
|
|
85
|
+
o();
|
|
25
86
|
}
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
global(e) {
|
|
29
|
-
return this.globals.get(e);
|
|
87
|
+
e[r] = s(e[r]);
|
|
30
88
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
89
|
+
return e;
|
|
90
|
+
};
|
|
91
|
+
const getDefinition = (e)=>{
|
|
92
|
+
if (!helpers.isAssemblage(e)) {
|
|
93
|
+
throw new Error(`Class '${e.name}' is not an assemblage or transversal.`);
|
|
34
94
|
}
|
|
35
|
-
|
|
95
|
+
return reflection.getOwnCustomMetadata(constants.ReflectValue.AssemblageDefinition, e);
|
|
96
|
+
};
|
|
97
|
+
const setDefinitionValue = (t, o, n)=>{
|
|
98
|
+
const s = getDefinition(n);
|
|
99
|
+
s[t] = o;
|
|
100
|
+
const a = validateDefinition(s);
|
|
101
|
+
reflection.defineCustomMetadata(constants.ReflectValue.AssemblageDefinition, a, n);
|
|
102
|
+
return a;
|
|
103
|
+
};
|
|
36
104
|
|
|
37
|
-
exports.
|
|
105
|
+
exports.getDefinition = getDefinition;
|
|
106
|
+
exports.setDefinitionValue = setDefinitionValue;
|
|
107
|
+
exports.validateDefinition = validateDefinition;
|