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.
Files changed (65) hide show
  1. package/dist/index11.js +2 -2
  2. package/dist/index11.mjs +2 -2
  3. package/dist/index13.js +1 -1
  4. package/dist/index13.mjs +1 -1
  5. package/dist/index16.js +1 -1
  6. package/dist/index16.mjs +1 -1
  7. package/dist/index17.js +1 -1
  8. package/dist/index17.mjs +1 -1
  9. package/dist/index18.js +1 -1
  10. package/dist/index18.mjs +1 -1
  11. package/dist/index19.js +1 -1
  12. package/dist/index19.mjs +1 -1
  13. package/dist/index2.js +2 -2
  14. package/dist/index2.mjs +2 -2
  15. package/dist/index20.js +1 -1
  16. package/dist/index20.mjs +1 -1
  17. package/dist/index21.js +1 -1
  18. package/dist/index21.mjs +1 -1
  19. package/dist/index22.js +2 -2
  20. package/dist/index22.mjs +2 -2
  21. package/dist/index23.js +2 -2
  22. package/dist/index23.mjs +2 -2
  23. package/dist/index24.js +2 -2
  24. package/dist/index24.mjs +2 -2
  25. package/dist/index25.js +1 -1
  26. package/dist/index25.mjs +1 -1
  27. package/dist/index26.js +1 -1
  28. package/dist/index26.mjs +1 -1
  29. package/dist/index29.js +17 -63
  30. package/dist/index29.mjs +14 -63
  31. package/dist/index3.js +1 -1
  32. package/dist/index3.mjs +1 -1
  33. package/dist/index30.js +95 -25
  34. package/dist/index30.mjs +93 -25
  35. package/dist/index31.js +16 -59
  36. package/dist/index31.mjs +16 -59
  37. package/dist/index32.js +60 -28
  38. package/dist/index32.mjs +60 -28
  39. package/dist/index33.js +28 -28
  40. package/dist/index33.mjs +28 -28
  41. package/dist/index34.js +63 -15
  42. package/dist/index34.mjs +63 -12
  43. package/dist/index35.js +28 -19
  44. package/dist/index35.mjs +28 -19
  45. package/dist/index36.js +30 -39
  46. package/dist/index36.mjs +30 -38
  47. package/dist/index37.js +33 -94
  48. package/dist/index37.mjs +32 -92
  49. package/dist/index38.js +12 -7
  50. package/dist/index38.mjs +12 -7
  51. package/dist/index4.js +5 -5
  52. package/dist/index4.mjs +5 -5
  53. package/dist/index40.js +49 -29
  54. package/dist/index40.mjs +49 -28
  55. package/dist/index42.js +29 -49
  56. package/dist/index42.mjs +28 -49
  57. package/dist/index43.js +4 -4
  58. package/dist/index43.mjs +4 -4
  59. package/dist/index47.js +1 -1
  60. package/dist/index47.mjs +1 -1
  61. package/dist/index48.js +1 -1
  62. package/dist/index48.mjs +1 -1
  63. package/dist/index49.js +1 -1
  64. package/dist/index49.mjs +1 -1
  65. 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('./index34.js');
6
+ const reflection = require('./index29.js');
7
7
  const decorator = require('./index2.js');
8
- const schema = require('./index37.js');
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 './index34.mjs';
2
+ import { getCustomMetadata, defineCustomMetadata } from './index29.mjs';
3
3
  import { Assemblage } from './index2.mjs';
4
- import { getDefinition } from './index37.mjs';
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('./index37.js');
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 './index37.mjs';
4
+ import { getDefinition } from './index30.mjs';
5
5
 
6
6
  class TransversalManager {
7
7
  static getInstance(e) {
package/dist/index16.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const reflection = require('./index34.js');
5
+ const reflection = require('./index29.js');
6
6
 
7
7
  const t = (t)=>()=>{
8
8
  return (e, c, n)=>{
package/dist/index16.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getOwnCustomMetadata, defineCustomMetadata } from './index34.mjs';
1
+ import { getOwnCustomMetadata, defineCustomMetadata } from './index29.mjs';
2
2
 
3
3
  const t = (t)=>()=>{
4
4
  return (e, c, n)=>{
package/dist/index17.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const reflection = require('./index34.js');
5
+ const reflection = require('./index29.js');
6
6
 
7
7
  class ParameterDecoratorFactory {
8
8
  static create(e) {
package/dist/index17.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getOwnCustomMetadata, defineCustomMetadata } from './index34.mjs';
1
+ import { getOwnCustomMetadata, defineCustomMetadata } from './index29.mjs';
2
2
 
3
3
  class ParameterDecoratorFactory {
4
4
  static create(e) {
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('./index35.js');
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
@@ -1,5 +1,5 @@
1
1
  import { ParameterDecoratorFactory } from './index17.mjs';
2
- import { ResolverStore } from './index35.mjs';
2
+ import { ResolverStore } from './index31.mjs';
3
3
 
4
4
  let ContextResolver = class ContextResolver {
5
5
  resolve(e, r, t) {
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('./index35.js');
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
@@ -1,5 +1,5 @@
1
1
  import { ParameterDecoratorFactory } from './index17.mjs';
2
- import { ResolverStore } from './index35.mjs';
2
+ import { ResolverStore } from './index31.mjs';
3
3
 
4
4
  let ConfigurationResolver = class ConfigurationResolver {
5
5
  resolve(r, o, e, n) {
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('./index34.js');
7
- const schema = require('./index37.js');
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 './index34.mjs';
3
- import { validateDefinition } from './index37.mjs';
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('./index35.js');
6
+ const resolverStore = require('./index31.js');
7
7
 
8
8
  let DefinitionResolver = class DefinitionResolver {
9
9
  resolve(e, r) {
package/dist/index20.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ParameterDecoratorFactory } from './index17.mjs';
2
- import { ResolverStore } from './index35.mjs';
2
+ import { ResolverStore } from './index31.mjs';
3
3
 
4
4
  let DefinitionResolver = class DefinitionResolver {
5
5
  resolve(e, r) {
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('./index35.js');
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
@@ -1,5 +1,5 @@
1
1
  import { ParameterDecoratorFactory } from './index17.mjs';
2
- import { ResolverStore } from './index35.mjs';
2
+ import { ResolverStore } from './index31.mjs';
3
3
 
4
4
  let DisposeResolver = class DisposeResolver {
5
5
  resolve(e, r, s) {
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('./index34.js');
5
+ const reflection = require('./index29.js');
6
6
  const parameterDecoratorFactory = require('./index17.js');
7
7
  const helpers = require('./index25.js');
8
- const resolverStore = require('./index35.js');
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 './index34.mjs';
1
+ import { getOwnCustomMetadata } from './index29.mjs';
2
2
  import { ParameterDecoratorFactory } from './index17.mjs';
3
3
  import { getParamValueKey } from './index25.mjs';
4
- import { ResolverStore } from './index35.mjs';
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('./index34.js');
5
+ const reflection = require('./index29.js');
6
6
  const parameterDecoratorFactory = require('./index17.js');
7
7
  const helpers = require('./index25.js');
8
- const resolverStore = require('./index35.js');
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 './index34.mjs';
1
+ import { getOwnCustomMetadata } from './index29.mjs';
2
2
  import { ParameterDecoratorFactory } from './index17.mjs';
3
3
  import { getParamValueKey } from './index25.mjs';
4
- import { ResolverStore } from './index35.mjs';
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('./index34.js');
5
+ const reflection = require('./index29.js');
6
6
  const parameterDecoratorFactory = require('./index17.js');
7
7
  const helpers = require('./index25.js');
8
- const resolverStore = require('./index35.js');
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 './index34.mjs';
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 './index35.mjs';
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const reflection = require('./index34.js');
5
+ const reflection = require('./index29.js');
6
6
  const parameterDecoratorFactory = require('./index17.js');
7
7
 
8
8
  const getParamIndexKey = (e)=>{
package/dist/index25.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getOwnCustomMetadata } from './index34.mjs';
1
+ import { getOwnCustomMetadata } from './index29.mjs';
2
2
  import { ParameterDecoratorFactory } from './index17.mjs';
3
3
 
4
4
  const getParamIndexKey = (e)=>{
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('./index34.js');
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 './index34.mjs';
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 hookManager = require('./index31.js');
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
- class InjectableManager {
12
- setContexts(e, t) {
13
- this.privateContext = e;
14
- this.publicContext = t;
15
- }
16
- register(r, n = false) {
17
- const o = n === true ? use.resolveInstanceInjectionTuple(r) : inject.resolveInjectionTuple(r);
18
- if (this.has(o.identifier)) {
19
- throw new Error(`An assemblage is already registered with identifier '${o.identifier.name}'.`);
20
- }
21
- const a = injectable.Injectable.of(o, this.privateContext, this.publicContext);
22
- this.injectables.set(a.identifier, a);
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.InjectableManager = InjectableManager;
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 { HookManager } from './index31.mjs';
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
- class InjectableManager {
8
- setContexts(e, t) {
9
- this.privateContext = e;
10
- this.publicContext = t;
11
- }
12
- register(r, n = false) {
13
- const o = n === true ? resolveInstanceInjectionTuple(r) : resolveInjectionTuple(r);
14
- if (this.has(o.identifier)) {
15
- throw new Error(`An assemblage is already registered with identifier '${o.identifier.name}'.`);
16
- }
17
- const a = Injectable.of(o, this.privateContext, this.publicContext);
18
- this.injectables.set(a.identifier, a);
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 { InjectableManager };
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('./index34.js');
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 './index34.mjs';
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
- class ObjectManager {
6
- use(e, t) {
7
- if (this.has(e)) {
8
- throw new Error(`A value is already registered with identifier '${String(e)}'.`);
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
- this.objects.set(e, t);
11
- return t;
12
- }
13
- has(e) {
14
- return this.objects.has(e);
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
- require(e) {
17
- if (!this.objects.has(e)) {
18
- throw new Error(`Injected object with identifier '${String(e)}' has not been registered.`);
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
- addGlobal(e, t) {
23
- if (this.globals.has(e)) {
24
- throw new Error(`Global value with key '${e}' has already been registered.`);
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
- this.globals.set(e, t);
27
- }
28
- global(e) {
29
- return this.globals.get(e);
87
+ e[r] = s(e[r]);
30
88
  }
31
- constructor(){
32
- this.objects = new Map();
33
- this.globals = new Map();
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.ObjectManager = ObjectManager;
105
+ exports.getDefinition = getDefinition;
106
+ exports.setDefinitionValue = setDefinitionValue;
107
+ exports.validateDefinition = validateDefinition;