mnemonica 0.9.94 → 0.9.98
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/README.md +40 -13
- package/build/api/errors/bindedMethodErrorHandler.js +50 -50
- package/build/api/errors/exceptionConstructor.js +98 -98
- package/build/api/errors/index.d.ts +1 -1
- package/build/api/errors/index.js +45 -45
- package/build/api/errors/throwModificationError.js +94 -94
- package/build/api/hooks/flowCheckers.d.ts +1 -1
- package/build/api/hooks/flowCheckers.js +9 -9
- package/build/api/hooks/index.js +7 -7
- package/build/api/hooks/invokeHook.js +44 -44
- package/build/api/hooks/registerHook.js +17 -17
- package/build/api/index.d.ts +1 -1
- package/build/api/index.js +9 -9
- package/build/api/types/InstanceCreator.d.ts +1 -1
- package/build/api/types/InstanceCreator.js +237 -237
- package/build/api/types/InstanceModificator.js +8 -8
- package/build/api/types/Mnemosyne.d.ts +2 -2
- package/build/api/types/Mnemosyne.js +127 -127
- package/build/api/types/TypeProxy.js +132 -132
- package/build/api/types/addProps.js +60 -60
- package/build/api/types/compileNewModificatorFunctionBody.d.ts +1 -1
- package/build/api/types/compileNewModificatorFunctionBody.js +37 -27
- package/build/api/types/createInstanceModificator.js +26 -27
- package/build/api/types/createInstanceModificator200XthWay.js +29 -30
- package/build/api/types/index.js +157 -157
- package/build/api/types/obeyConstructor.js +23 -23
- package/build/api/utils/index.d.ts +20 -8
- package/build/api/utils/index.js +122 -122
- package/build/constants/index.js +61 -61
- package/build/descriptors/errors/index.js +7 -7
- package/build/descriptors/index.js +5 -5
- package/build/descriptors/namespaces/index.js +70 -70
- package/build/descriptors/types/index.js +141 -141
- package/build/index.d.ts +39 -5
- package/build/index.js +63 -32
- package/build/types/index.d.ts +16 -17
- package/build/types/index.js +1 -1
- package/build/utils/collectConstructors.js +50 -50
- package/build/utils/defineStackCleaner.js +7 -7
- package/build/utils/extract.js +14 -14
- package/build/utils/hop.js +1 -1
- package/build/utils/index.js +27 -27
- package/build/utils/merge.js +13 -13
- package/build/utils/parent.js +15 -15
- package/build/utils/parse.js +40 -40
- package/build/utils/pick.js +19 -19
- package/build/utils/toJSON.js +25 -25
- package/package.json +92 -92
package/build/api/utils/index.js
CHANGED
|
@@ -1,154 +1,154 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const constants_1 = require(
|
|
4
|
-
const errors_1 = require(
|
|
5
|
-
const utils_1 = require(
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../../constants");
|
|
4
|
+
const errors_1 = require("../../descriptors/errors");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
6
|
const { odp, SymbolConstructorName, MNEMONICA, MNEMOSYNE, GAIA, URANUS } = constants_1.constants;
|
|
7
7
|
const { WRONG_TYPE_DEFINITION, } = errors_1.ErrorsTypes;
|
|
8
8
|
const { collectConstructors } = utils_1.utils;
|
|
9
9
|
const CreationHandler = function (constructionAnswer) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
if (constructionAnswer instanceof Object) {
|
|
11
|
+
return constructionAnswer;
|
|
12
|
+
}
|
|
13
|
+
return this;
|
|
14
14
|
};
|
|
15
|
-
const compileNewModificatorFunctionBody_1 = require(
|
|
16
|
-
const createInstanceModificator200XthWay_1 = require(
|
|
17
|
-
const createInstanceModificator_1 = require(
|
|
15
|
+
const compileNewModificatorFunctionBody_1 = require("../types/compileNewModificatorFunctionBody");
|
|
16
|
+
const createInstanceModificator200XthWay_1 = require("../types/createInstanceModificator200XthWay");
|
|
17
|
+
const createInstanceModificator_1 = require("../types/createInstanceModificator");
|
|
18
18
|
const getModificationConstructor = (useOldStyle) => {
|
|
19
|
-
|
|
19
|
+
return (useOldStyle ? createInstanceModificator200XthWay_1.default : createInstanceModificator_1.default)();
|
|
20
20
|
};
|
|
21
21
|
const checkProto = (proto) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
if (!(proto instanceof Object)) {
|
|
23
|
+
throw new WRONG_TYPE_DEFINITION('expect prototype to be an object');
|
|
24
|
+
}
|
|
25
25
|
};
|
|
26
26
|
const getTypeChecker = (TypeName) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
const seeker = (instance) => {
|
|
28
|
+
if (typeof instance !== 'object') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (!instance.constructor) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (Reflect.getPrototypeOf(instance).constructor.name === 'Promise') {
|
|
35
|
+
return instance[SymbolConstructorName] === TypeName;
|
|
36
|
+
}
|
|
37
|
+
const constructors = collectConstructors(instance);
|
|
38
|
+
return constructors[TypeName] || false;
|
|
39
|
+
};
|
|
40
|
+
return seeker;
|
|
41
41
|
};
|
|
42
42
|
const getTypeSplitPath = (path) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const split = path
|
|
44
|
+
.replace(/\n|\t| /g, '')
|
|
45
|
+
.replace(/\[(\w+)\]/g, '.$1')
|
|
46
|
+
.replace(/^\./, '')
|
|
47
|
+
.split(/\.|\/|:/);
|
|
48
|
+
return split;
|
|
49
49
|
};
|
|
50
50
|
const getExistentAsyncStack = (existentInstance) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
51
|
+
const stack = [];
|
|
52
|
+
let proto = existentInstance;
|
|
53
|
+
while (proto) {
|
|
54
|
+
if (!proto.__stack__) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
const pstack = proto
|
|
58
|
+
.__stack__
|
|
59
|
+
.split('\n')
|
|
60
|
+
.reduce((arr, line) => {
|
|
61
|
+
if (line.length) {
|
|
62
|
+
arr.push(line);
|
|
63
|
+
}
|
|
64
|
+
return arr;
|
|
65
|
+
}, []);
|
|
66
|
+
proto = proto.parent();
|
|
67
|
+
if (proto && proto.__type__) {
|
|
68
|
+
if (proto.__type__.isSubType) {
|
|
69
|
+
stack.push(...pstack.slice(0, 1));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
stack.push(...pstack);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
stack.push(...pstack);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return stack;
|
|
81
81
|
};
|
|
82
82
|
const forbiddenNames = [MNEMONICA, MNEMOSYNE, GAIA, URANUS];
|
|
83
83
|
const checkTypeName = (name) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
if (!name.length) {
|
|
85
|
+
throw new WRONG_TYPE_DEFINITION('TypeName must not be empty');
|
|
86
|
+
}
|
|
87
|
+
if (name[0] !== name[0].toUpperCase()) {
|
|
88
|
+
throw new WRONG_TYPE_DEFINITION('TypeName should start with Uppercase Letter');
|
|
89
|
+
}
|
|
90
|
+
if (forbiddenNames.includes(name)) {
|
|
91
|
+
throw new WRONG_TYPE_DEFINITION('TypeName of reserved keyword');
|
|
92
|
+
}
|
|
93
93
|
};
|
|
94
94
|
const findParentSubType = (instance, prop) => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
let subtype = null;
|
|
96
|
+
if (instance.__type__.subtypes.has(prop)) {
|
|
97
|
+
subtype = instance.__type__.subtypes.get(prop);
|
|
98
|
+
return subtype;
|
|
99
|
+
}
|
|
100
|
+
return findParentSubType(instance.__parent__, prop);
|
|
101
101
|
};
|
|
102
102
|
const isClass = (fn) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
if (typeof fn.prototype !== 'object') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (fn.prototype.constructor !== fn) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
return Reflect.getOwnPropertyDescriptor(fn, 'prototype').writable === false;
|
|
110
110
|
};
|
|
111
111
|
const makeFakeModificatorType = (TypeName, fakeModificator = function () { }) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
const modificatorBody = (0, compileNewModificatorFunctionBody_1.default)(TypeName);
|
|
113
|
+
const modificatorType = modificatorBody(fakeModificator, CreationHandler, SymbolConstructorName);
|
|
114
|
+
return modificatorType();
|
|
115
115
|
};
|
|
116
116
|
const reflectPrimitiveWrappers = (_thisArg) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
let thisArg = _thisArg;
|
|
118
|
+
if (_thisArg === null) {
|
|
119
|
+
thisArg = Object.create(null);
|
|
120
|
+
odp(thisArg, Symbol.toPrimitive, {
|
|
121
|
+
get() {
|
|
122
|
+
return () => {
|
|
123
|
+
return _thisArg;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (_thisArg instanceof Number ||
|
|
129
129
|
_thisArg instanceof Boolean ||
|
|
130
130
|
_thisArg instanceof String) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
odp(thisArg, Symbol.toPrimitive, {
|
|
132
|
+
get() {
|
|
133
|
+
return () => {
|
|
134
|
+
return _thisArg.valueOf();
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return thisArg;
|
|
140
140
|
};
|
|
141
141
|
const TypesUtils = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
142
|
+
isClass,
|
|
143
|
+
CreationHandler,
|
|
144
|
+
getModificationConstructor,
|
|
145
|
+
checkProto,
|
|
146
|
+
getTypeChecker,
|
|
147
|
+
getTypeSplitPath,
|
|
148
|
+
getExistentAsyncStack,
|
|
149
|
+
checkTypeName,
|
|
150
|
+
findParentSubType,
|
|
151
|
+
makeFakeModificatorType,
|
|
152
|
+
reflectPrimitiveWrappers
|
|
153
153
|
};
|
|
154
154
|
exports.default = TypesUtils;
|
package/build/constants/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.constants = void 0;
|
|
4
4
|
const MNEMONICA = 'Mnemonica';
|
|
5
5
|
const MNEMOSYNE = 'Mnemosyne';
|
|
@@ -15,66 +15,66 @@ const SymbolConfig = Symbol('Mnemonica Config Data');
|
|
|
15
15
|
const SymbolUsed = Symbol('.prototype used twice');
|
|
16
16
|
const TYPE_TITLE_PREFIX = 'modificator of : ';
|
|
17
17
|
const ErrorMessages = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
BASE_ERROR_MESSAGE: 'UNPREDICTABLE BEHAVIOUR',
|
|
19
|
+
TYPENAME_MUST_BE_A_STRING: 'typename must be a string',
|
|
20
|
+
HANDLER_MUST_BE_A_FUNCTION: 'handler must be a function',
|
|
21
|
+
WRONG_TYPE_DEFINITION: 'wrong type definition',
|
|
22
|
+
WRONG_INSTANCE_INVOCATION: 'wrong instance invocation',
|
|
23
|
+
WRONG_MODIFICATION_PATTERN: 'wrong modification pattern',
|
|
24
|
+
ALREADY_DECLARED: 'this type has already been declared',
|
|
25
|
+
WRONG_ARGUMENTS_USED: 'wrong arguments : should use proper invocation',
|
|
26
|
+
WRONG_HOOK_TYPE: 'this hook type does not exist',
|
|
27
|
+
MISSING_HOOK_CALLBACK: 'hook definition requires callback',
|
|
28
|
+
MISSING_CALLBACK_ARGUMENT: 'callback is required argument',
|
|
29
|
+
FLOW_CHECKER_REDEFINITION: 'attempt to re-define flow checker callback',
|
|
30
|
+
NAMESPACE_DOES_NOT_EXIST: 'namespace does not exits',
|
|
31
|
+
ASSOCIATION_EXISTS: 'association is already made',
|
|
32
|
+
OPTIONS_ERROR: 'options must be an object or a string',
|
|
33
|
+
WRONG_STACK_CLEANER: 'wrong stack cleaner instanceof',
|
|
34
|
+
PROTOTYPE_USED_TWICE: '.prototype used twice',
|
|
35
35
|
};
|
|
36
36
|
exports.constants = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
37
|
+
get 'SymbolSubtypeCollection'() {
|
|
38
|
+
return SymbolSubtypeCollection;
|
|
39
|
+
},
|
|
40
|
+
get 'SymbolConstructorName'() {
|
|
41
|
+
return SymbolConstructorName;
|
|
42
|
+
},
|
|
43
|
+
get 'SymbolGaia'() {
|
|
44
|
+
return SymbolGaia;
|
|
45
|
+
},
|
|
46
|
+
get 'SymbolReplaceGaia'() {
|
|
47
|
+
return SymbolReplaceGaia;
|
|
48
|
+
},
|
|
49
|
+
get 'SymbolDefaultNamespace'() {
|
|
50
|
+
return SymbolDefaultNamespace;
|
|
51
|
+
},
|
|
52
|
+
get 'SymbolDefaultTypesCollection'() {
|
|
53
|
+
return SymbolDefaultTypesCollection;
|
|
54
|
+
},
|
|
55
|
+
get 'SymbolConfig'() {
|
|
56
|
+
return SymbolConfig;
|
|
57
|
+
},
|
|
58
|
+
get 'SymbolUsed'() {
|
|
59
|
+
return SymbolUsed;
|
|
60
|
+
},
|
|
61
|
+
get 'MNEMONICA'() {
|
|
62
|
+
return MNEMONICA;
|
|
63
|
+
},
|
|
64
|
+
get 'MNEMOSYNE'() {
|
|
65
|
+
return MNEMOSYNE;
|
|
66
|
+
},
|
|
67
|
+
get 'GAIA'() {
|
|
68
|
+
return GAIA;
|
|
69
|
+
},
|
|
70
|
+
get 'URANUS'() {
|
|
71
|
+
return URANUS;
|
|
72
|
+
},
|
|
73
|
+
get 'odp'() {
|
|
74
|
+
return (o, p, attributes) => {
|
|
75
|
+
return Object.defineProperty(o, p, attributes);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
TYPE_TITLE_PREFIX,
|
|
79
|
+
ErrorMessages,
|
|
80
80
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ErrorsTypes = void 0;
|
|
4
|
-
const constants_1 = require(
|
|
5
|
-
const errors_1 = require(
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const errors_1 = require("../../api/errors");
|
|
6
6
|
const { ErrorMessages, } = constants_1.constants;
|
|
7
7
|
exports.ErrorsTypes = {
|
|
8
|
-
|
|
8
|
+
BASE_MNEMONICA_ERROR: errors_1.BASE_MNEMONICA_ERROR
|
|
9
9
|
};
|
|
10
10
|
Object.entries(ErrorMessages).forEach(entry => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const [ErrorConstructorName, message] = entry;
|
|
12
|
+
const ErrorConstructor = (0, errors_1.constructError)(ErrorConstructorName, message);
|
|
13
|
+
exports.ErrorsTypes[ErrorConstructorName] = ErrorConstructor;
|
|
14
14
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.descriptors = void 0;
|
|
4
|
-
const errors_1 = require(
|
|
5
|
-
const namespaces_1 = require(
|
|
6
|
-
const types_1 = require(
|
|
7
|
-
exports.descriptors = Object.assign(Object.assign(Object.assign({}, namespaces_1.namespaces), types_1.types), { ErrorsTypes
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
const namespaces_1 = require("./namespaces");
|
|
6
|
+
const types_1 = require("./types");
|
|
7
|
+
exports.descriptors = Object.assign(Object.assign(Object.assign({}, namespaces_1.namespaces), types_1.types), { ErrorsTypes: errors_1.ErrorsTypes });
|
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.namespaces = void 0;
|
|
4
|
-
const constants_1 = require(
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
5
|
const { odp, MNEMONICA, SymbolDefaultNamespace, SymbolConfig, } = constants_1.constants;
|
|
6
|
-
const errors_1 = require(
|
|
6
|
+
const errors_1 = require("../../descriptors/errors");
|
|
7
7
|
const { OPTIONS_ERROR, } = errors_1.ErrorsTypes;
|
|
8
|
-
const hooksAPI = require(
|
|
9
|
-
const __1 = require(
|
|
8
|
+
const hooksAPI = require("../../api/hooks");
|
|
9
|
+
const __1 = require("../");
|
|
10
10
|
const defaultOptions = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
useOldStyle: false,
|
|
12
|
+
strictChain: true,
|
|
13
|
+
blockErrors: true,
|
|
14
|
+
submitStack: false,
|
|
15
|
+
awaitReturn: true,
|
|
16
|
+
bindedProto: true,
|
|
17
17
|
};
|
|
18
18
|
const namespaceStorage = new Map();
|
|
19
19
|
const Namespace = function (name, config) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
if (typeof config === 'string') {
|
|
21
|
+
config = {
|
|
22
|
+
description: config
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (!(config instanceof Object)) {
|
|
26
|
+
throw new OPTIONS_ERROR;
|
|
27
|
+
}
|
|
28
|
+
const typesCollections = new Map();
|
|
29
|
+
config = Object.assign({}, defaultOptions, config);
|
|
30
|
+
odp(this, SymbolConfig, {
|
|
31
|
+
get() {
|
|
32
|
+
return config;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
odp(this, 'name', {
|
|
36
|
+
get() {
|
|
37
|
+
return name;
|
|
38
|
+
},
|
|
39
|
+
enumerable: true
|
|
40
|
+
});
|
|
41
|
+
odp(this, 'typesCollections', {
|
|
42
|
+
get() {
|
|
43
|
+
return typesCollections;
|
|
44
|
+
},
|
|
45
|
+
enumerable: true
|
|
46
|
+
});
|
|
47
|
+
const hooks = Object.create(null);
|
|
48
|
+
odp(this, 'hooks', {
|
|
49
|
+
get() {
|
|
50
|
+
return hooks;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
namespaceStorage.set(name, this);
|
|
54
54
|
};
|
|
55
|
-
Namespace.prototype = Object.assign({ createTypesCollection
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} }, hooksAPI);
|
|
55
|
+
Namespace.prototype = Object.assign({ createTypesCollection(association, config) {
|
|
56
|
+
const { createTypesCollection } = __1.descriptors;
|
|
57
|
+
return createTypesCollection(this, association, config);
|
|
58
|
+
} }, hooksAPI);
|
|
59
59
|
const DEFAULT_NAMESPACE = new Namespace(SymbolDefaultNamespace, {
|
|
60
|
-
|
|
60
|
+
description: `default ${MNEMONICA} namespace`
|
|
61
61
|
});
|
|
62
62
|
exports.namespaces = Object.create(null);
|
|
63
63
|
odp(exports.namespaces, 'createNamespace', {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
get() {
|
|
65
|
+
return (name, config = {}) => {
|
|
66
|
+
return new Namespace(name, config);
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
enumerable: true
|
|
70
70
|
});
|
|
71
71
|
odp(exports.namespaces, 'namespaces', {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
get() {
|
|
73
|
+
return namespaceStorage;
|
|
74
|
+
},
|
|
75
|
+
enumerable: true
|
|
76
76
|
});
|
|
77
77
|
odp(exports.namespaces, 'defaultNamespace', {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
get() {
|
|
79
|
+
return DEFAULT_NAMESPACE;
|
|
80
|
+
},
|
|
81
|
+
enumerable: true
|
|
82
82
|
});
|
|
83
83
|
odp(exports.namespaces, SymbolDefaultNamespace, {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
get() {
|
|
85
|
+
return DEFAULT_NAMESPACE;
|
|
86
|
+
}
|
|
87
87
|
});
|
|
88
88
|
odp(exports.namespaces, 'defaultOptionsKeys', {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
get() {
|
|
90
|
+
return Object.keys(defaultOptions);
|
|
91
|
+
}
|
|
92
92
|
});
|