mnemonica 0.9.93 → 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 +52 -51
- package/build/api/errors/exceptionConstructor.js +98 -98
- package/build/api/errors/index.d.ts +1 -1
- package/build/api/errors/index.js +51 -48
- package/build/api/errors/throwModificationError.js +96 -95
- package/build/api/hooks/flowCheckers.d.ts +1 -1
- package/build/api/hooks/flowCheckers.js +11 -10
- package/build/api/hooks/index.js +7 -7
- package/build/api/hooks/invokeHook.js +46 -45
- package/build/api/hooks/registerHook.js +19 -18
- package/build/api/index.d.ts +1 -1
- package/build/api/index.js +9 -9
- package/build/api/types/InstanceCreator.d.ts +2 -4
- package/build/api/types/InstanceCreator.js +237 -239
- package/build/api/types/InstanceModificator.js +10 -8
- package/build/api/types/Mnemosyne.d.ts +3 -2
- package/build/api/types/Mnemosyne.js +127 -111
- package/build/api/types/TypeProxy.js +132 -132
- package/build/api/types/addProps.d.ts +1 -0
- package/build/api/types/addProps.js +68 -0
- package/build/api/types/compileNewModificatorFunctionBody.d.ts +1 -1
- package/build/api/types/compileNewModificatorFunctionBody.js +37 -27
- package/build/api/types/createInstanceModificator.js +26 -24
- package/build/api/types/createInstanceModificator200XthWay.js +29 -28
- package/build/api/types/index.js +161 -159
- package/build/api/types/obeyConstructor.d.ts +1 -0
- package/build/api/types/obeyConstructor.js +30 -0
- package/build/api/utils/index.d.ts +20 -8
- package/build/api/utils/index.js +122 -122
- package/build/constants/index.d.ts +2 -0
- package/build/constants/index.js +62 -57
- 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 -31
- package/build/types/index.d.ts +16 -17
- package/build/types/index.js +1 -1
- package/build/utils/collectConstructors.js +52 -51
- package/build/utils/defineStackCleaner.js +9 -8
- package/build/utils/extract.js +16 -15
- package/build/utils/hop.js +3 -2
- package/build/utils/index.js +27 -27
- package/build/utils/merge.js +15 -14
- package/build/utils/parent.js +17 -16
- package/build/utils/parse.js +42 -41
- package/build/utils/pick.js +21 -20
- package/build/utils/toJSON.js +27 -26
- package/package.json +92 -92
- package/build/api/types/InstanceCreatorProto.d.ts +0 -3
- package/build/api/types/InstanceCreatorProto.js +0 -88
|
@@ -1,122 +1,138 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const constants_1 = require(
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../../constants");
|
|
4
4
|
const { odp, SymbolConstructorName, SymbolGaia, SymbolReplaceGaia, MNEMONICA, GAIA, URANUS } = constants_1.constants;
|
|
5
|
-
const utils_1 = require(
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
6
|
const { getTypeChecker, reflectPrimitiveWrappers } = utils_1.default;
|
|
7
|
-
const extract_1 = require(
|
|
8
|
-
const parent_1 = require(
|
|
9
|
-
const pick_1 = require(
|
|
10
|
-
const exceptionConstructor_1 = require(
|
|
11
|
-
const InstanceCreator_1 = require(
|
|
7
|
+
const extract_1 = require("../../utils/extract");
|
|
8
|
+
const parent_1 = require("../../utils/parent");
|
|
9
|
+
const pick_1 = require("../../utils/pick");
|
|
10
|
+
const exceptionConstructor_1 = require("../errors/exceptionConstructor");
|
|
11
|
+
const InstanceCreator_1 = require("./InstanceCreator");
|
|
12
12
|
const Gaia = function (Uranus) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const gaiaProto = Uranus ? Uranus : this;
|
|
14
|
+
const GaiaConstructor = function () { };
|
|
15
|
+
GaiaConstructor.prototype = Object.create(gaiaProto);
|
|
16
|
+
const gaia = new GaiaConstructor;
|
|
17
|
+
odp(gaia, MNEMONICA, {
|
|
18
|
+
get() {
|
|
19
|
+
return !Uranus ? GAIA : URANUS;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return gaia;
|
|
23
23
|
};
|
|
24
24
|
const MnemonicaProtoProps = {
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
25
|
+
extract() {
|
|
26
|
+
return function () {
|
|
27
|
+
return (0, extract_1.extract)(this);
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
pick() {
|
|
31
|
+
return function (...args) {
|
|
32
|
+
return (0, pick_1.pick)(this, ...args);
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
parent() {
|
|
36
|
+
return function (constructorLookupPath) {
|
|
37
|
+
return (0, parent_1.parent)(this, constructorLookupPath);
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
clone() {
|
|
41
|
+
return this.fork();
|
|
42
|
+
},
|
|
43
|
+
fork() {
|
|
44
|
+
const { __type__: type, __collection__: collection, __parent__: existentInstance, __args__, __self__ } = this;
|
|
45
|
+
const { isSubType, TypeName } = type;
|
|
46
|
+
return function (...forkArgs) {
|
|
47
|
+
let forked;
|
|
48
|
+
const Constructor = isSubType ?
|
|
49
|
+
existentInstance :
|
|
50
|
+
collection;
|
|
51
|
+
const args = forkArgs.length ? forkArgs : __args__;
|
|
52
|
+
if (this === __self__) {
|
|
53
|
+
forked = new (Constructor[TypeName])(...args);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
forked = new InstanceCreator_1.InstanceCreator(type, reflectPrimitiveWrappers(this), args);
|
|
57
|
+
}
|
|
58
|
+
return forked;
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
[SymbolReplaceGaia]() {
|
|
62
|
+
return function (uranus) {
|
|
63
|
+
Reflect.setPrototypeOf(Reflect.getPrototypeOf(this[SymbolGaia]), uranus);
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
[SymbolConstructorName]() {
|
|
67
|
+
return MNEMONICA;
|
|
68
|
+
},
|
|
69
|
+
exception() {
|
|
70
|
+
const self = this;
|
|
71
|
+
return function (error, ...args) {
|
|
72
|
+
const target = new.target;
|
|
73
|
+
return exceptionConstructor_1.default.call(self, target, error, ...args);
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
sibling() {
|
|
77
|
+
const self = this;
|
|
78
|
+
const siblings = (SiblingTypeName) => {
|
|
79
|
+
const { __collection__: collection, } = self;
|
|
80
|
+
const sibling = collection[SiblingTypeName];
|
|
81
|
+
return sibling;
|
|
82
|
+
};
|
|
83
|
+
return new Proxy(siblings, {
|
|
84
|
+
get(_, prop) {
|
|
85
|
+
return siblings(prop);
|
|
86
|
+
},
|
|
87
|
+
apply(_, __, args) {
|
|
88
|
+
return siblings(args[0]);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
76
92
|
};
|
|
77
93
|
const Mnemosyne = function (namespace, gaia) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
const Mnemonica = function () {
|
|
95
|
+
odp(this, SymbolConstructorName, {
|
|
96
|
+
get() {
|
|
97
|
+
return namespace.name;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
const mnemonica = Reflect.getPrototypeOf(gaia);
|
|
102
|
+
Reflect.setPrototypeOf(Mnemonica.prototype, mnemonica);
|
|
103
|
+
Mnemonica.prototype.constructor = Mnemonica;
|
|
104
|
+
Object.entries(MnemonicaProtoProps).forEach(([name, method]) => {
|
|
105
|
+
odp(Mnemonica.prototype, name, {
|
|
106
|
+
get() {
|
|
107
|
+
return method.call(this);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
Object.getOwnPropertySymbols(MnemonicaProtoProps).forEach((symbol) => {
|
|
112
|
+
odp(Mnemonica.prototype, symbol, {
|
|
113
|
+
get() {
|
|
114
|
+
const symbolMethod = Reflect.get(MnemonicaProtoProps, symbol);
|
|
115
|
+
return symbolMethod.call(this);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
odp(Mnemonica.prototype, Symbol.hasInstance, {
|
|
120
|
+
get() {
|
|
121
|
+
return getTypeChecker(this.constructor.name);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
odp(Mnemonica.prototype, SymbolGaia, {
|
|
125
|
+
get() {
|
|
126
|
+
return gaia;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const proto = new Mnemonica();
|
|
130
|
+
Reflect.setPrototypeOf(this, proto);
|
|
115
131
|
};
|
|
116
132
|
exports.default = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
Gaia,
|
|
134
|
+
Mnemosyne,
|
|
135
|
+
get MnemosynePrototypeKeys() {
|
|
136
|
+
return Object.keys(MnemonicaProtoProps);
|
|
137
|
+
}
|
|
122
138
|
};
|
|
@@ -1,156 +1,156 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TypeProxy = void 0;
|
|
4
|
-
const constants_1 = require(
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
5
|
const { SymbolGaia, } = constants_1.constants;
|
|
6
|
-
const hop_1 = require(
|
|
7
|
-
const errors_1 = require(
|
|
6
|
+
const hop_1 = require("../../utils/hop");
|
|
7
|
+
const errors_1 = require("../../descriptors/errors");
|
|
8
8
|
const { WRONG_TYPE_DEFINITION, } = errors_1.ErrorsTypes;
|
|
9
|
-
const utils_1 = require(
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
10
|
const { checkProto, getTypeChecker, findParentSubType, reflectPrimitiveWrappers, } = utils_1.default;
|
|
11
|
-
const Mnemosyne_1 = require(
|
|
11
|
+
const Mnemosyne_1 = require("./Mnemosyne");
|
|
12
12
|
const { Gaia, Mnemosyne, MnemosynePrototypeKeys } = Mnemosyne_1.default;
|
|
13
|
-
const InstanceCreator_1 = require(
|
|
13
|
+
const InstanceCreator_1 = require("./InstanceCreator");
|
|
14
14
|
exports.TypeProxy = function (__type__, Uranus) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
Object.assign(this, {
|
|
16
|
+
__type__,
|
|
17
|
+
Uranus
|
|
18
|
+
});
|
|
19
|
+
const typeProxy = new Proxy(InstanceCreator_1.InstanceCreator, this);
|
|
20
|
+
return typeProxy;
|
|
21
21
|
};
|
|
22
22
|
exports.TypeProxy.prototype.get = function (target, prop) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
const { __type__: type } = this;
|
|
24
|
+
if (prop === 'prototype') {
|
|
25
|
+
return type.proto;
|
|
26
|
+
}
|
|
27
|
+
const propDeclaration = type[prop];
|
|
28
|
+
if (propDeclaration) {
|
|
29
|
+
return propDeclaration;
|
|
30
|
+
}
|
|
31
|
+
if ((0, hop_1.hop)(type, prop)) {
|
|
32
|
+
return propDeclaration;
|
|
33
|
+
}
|
|
34
|
+
if (type.subtypes.has(prop)) {
|
|
35
|
+
return type.subtypes.get(prop);
|
|
36
|
+
}
|
|
37
|
+
return Reflect.get(target, prop);
|
|
38
38
|
};
|
|
39
39
|
exports.TypeProxy.prototype.set = function (__, name, value) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
const { __type__: type } = this;
|
|
41
|
+
if (name === 'prototype') {
|
|
42
|
+
checkProto(value);
|
|
43
|
+
type.proto = value;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (typeof name !== 'string' || !name.length) {
|
|
47
|
+
throw new WRONG_TYPE_DEFINITION('should use non empty string as TypeName');
|
|
48
|
+
}
|
|
49
|
+
if (typeof value !== 'function') {
|
|
50
|
+
throw new WRONG_TYPE_DEFINITION('should use function for type definition');
|
|
51
|
+
}
|
|
52
|
+
const TypeName = name;
|
|
53
|
+
const Constructor = value;
|
|
54
|
+
type.define(TypeName, Constructor);
|
|
55
|
+
return true;
|
|
56
56
|
};
|
|
57
57
|
exports.TypeProxy.prototype.apply = function (__, Uranus, args) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
const type = this.__type__;
|
|
59
|
+
let instance = null;
|
|
60
|
+
if (Uranus) {
|
|
61
|
+
const InstanceCreatorProxy = new exports.TypeProxy(type, Uranus);
|
|
62
|
+
instance = new InstanceCreatorProxy(...args);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
instance = this.construct(null, args);
|
|
66
|
+
}
|
|
67
|
+
return instance;
|
|
68
68
|
};
|
|
69
69
|
const makeSubTypeProxy = function (subtype, inheritedInstance) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
const subtypeProxy = new Proxy(InstanceCreator_1.InstanceCreator, {
|
|
71
|
+
get(Target, _prop) {
|
|
72
|
+
if (_prop === Symbol.hasInstance) {
|
|
73
|
+
return getTypeChecker(subtype.TypeName);
|
|
74
|
+
}
|
|
75
|
+
return Reflect.get(Target, _prop);
|
|
76
|
+
},
|
|
77
|
+
construct(Target, _args) {
|
|
78
|
+
return new Target(subtype, inheritedInstance, _args);
|
|
79
|
+
},
|
|
80
|
+
apply(Target, thisArg = inheritedInstance, _args) {
|
|
81
|
+
let existentInstance = reflectPrimitiveWrappers(thisArg);
|
|
82
|
+
if (!existentInstance[SymbolGaia]) {
|
|
83
|
+
const gaia = new Mnemosyne(subtype.namespace, new Gaia(existentInstance));
|
|
84
|
+
existentInstance = new Proxy(gaia, {
|
|
85
|
+
get: gaiaProxyHandlerGet
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const entity = new Target(subtype, existentInstance, _args);
|
|
89
|
+
return entity;
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
return subtypeProxy;
|
|
93
93
|
};
|
|
94
94
|
const MnemonicaInstanceProps = [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
'__proto_proto__',
|
|
96
|
+
'__type__',
|
|
97
|
+
'__self__',
|
|
98
|
+
'__args__',
|
|
99
|
+
'__parent__',
|
|
100
|
+
'__subtypes__',
|
|
101
|
+
'__stack__',
|
|
102
|
+
'__collection__',
|
|
103
|
+
'__namespace__',
|
|
104
|
+
'__timestamp__',
|
|
105
|
+
'__creator__'
|
|
106
106
|
].concat(MnemosynePrototypeKeys);
|
|
107
107
|
const staticProps = [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
'constructor',
|
|
109
|
+
'prototype',
|
|
110
|
+
'then',
|
|
111
|
+
'stack',
|
|
112
|
+
'message',
|
|
113
|
+
'domain',
|
|
114
|
+
'on',
|
|
115
|
+
'once',
|
|
116
|
+
'off',
|
|
117
|
+
'inspect',
|
|
118
|
+
'showDiff',
|
|
119
119
|
]
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
.concat(MnemonicaInstanceProps)
|
|
121
|
+
.concat(Object.getOwnPropertyNames(Object.prototype))
|
|
122
|
+
.concat(Object.getOwnPropertyNames(Function.prototype))
|
|
123
|
+
.reduce((obj, key) => {
|
|
124
|
+
obj[key] = true;
|
|
125
|
+
return obj;
|
|
126
|
+
}, Object.create(null));
|
|
127
127
|
const gaiaProxyHandlerGet = (target, prop, receiver) => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
128
|
+
const result = Reflect.get(target, prop, receiver);
|
|
129
|
+
if (result !== undefined) {
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
if (typeof prop === 'symbol') {
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
if (staticProps[prop]) {
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
const instance = Reflect.getPrototypeOf(receiver);
|
|
139
|
+
const { __type__: { config: { strictChain }, subtypes }, } = instance;
|
|
140
|
+
const subtype = subtypes.has(prop) ?
|
|
141
|
+
subtypes.get(prop) :
|
|
142
|
+
strictChain ?
|
|
143
|
+
undefined :
|
|
144
|
+
findParentSubType(instance, prop);
|
|
145
|
+
return subtype ? makeSubTypeProxy(subtype, receiver) : result;
|
|
146
146
|
};
|
|
147
147
|
exports.TypeProxy.prototype.construct = function (__, args) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
const { __type__: type, Uranus } = this;
|
|
149
|
+
const uranus = reflectPrimitiveWrappers(Uranus);
|
|
150
|
+
const gaia = new Mnemosyne(type.namespace, new Gaia(uranus));
|
|
151
|
+
const gaiaProxy = new Proxy(gaia, {
|
|
152
|
+
get: gaiaProxyHandlerGet
|
|
153
|
+
});
|
|
154
|
+
const instance = new InstanceCreator_1.InstanceCreator(type, gaiaProxy, args);
|
|
155
|
+
return instance;
|
|
156
156
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addProps: (this: any) => any;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProps = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const { odp, } = constants_1.constants;
|
|
6
|
+
const addProps = function () {
|
|
7
|
+
const self = this;
|
|
8
|
+
const { type, existentInstance, args, config: { submitStack }, __proto_proto__: proto } = self;
|
|
9
|
+
const { namespace, collection, subtypes, } = type;
|
|
10
|
+
odp(proto, '__proto_proto__', {
|
|
11
|
+
get() {
|
|
12
|
+
return proto;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
odp(proto, '__args__', {
|
|
16
|
+
get() {
|
|
17
|
+
return args;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
odp(proto, '__collection__', {
|
|
21
|
+
get() {
|
|
22
|
+
return collection;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
odp(proto, '__namespace__', {
|
|
26
|
+
get() {
|
|
27
|
+
return namespace;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
odp(proto, '__subtypes__', {
|
|
31
|
+
get() {
|
|
32
|
+
return subtypes;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
odp(proto, '__type__', {
|
|
36
|
+
get() {
|
|
37
|
+
return type;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
odp(proto, '__parent__', {
|
|
41
|
+
get() {
|
|
42
|
+
return existentInstance;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (submitStack) {
|
|
46
|
+
const { stack } = this;
|
|
47
|
+
odp(proto, '__stack__', {
|
|
48
|
+
get() {
|
|
49
|
+
return stack.join('\n');
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
odp(proto, '__creator__', {
|
|
54
|
+
get() {
|
|
55
|
+
return self;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const timestamp = Date.now();
|
|
59
|
+
odp(proto, '__timestamp__', {
|
|
60
|
+
get() {
|
|
61
|
+
return timestamp;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
exports.addProps = addProps;
|
|
66
|
+
module.exports = {
|
|
67
|
+
addProps: exports.addProps
|
|
68
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const compileNewModificatorFunctionBody: (FunctionName: string, asClass?: boolean) =>
|
|
1
|
+
declare const compileNewModificatorFunctionBody: (FunctionName: string, asClass?: boolean) => (ConstructHandler: any, CreationHandler: any, SymbolConstructorName: symbol) => any;
|
|
2
2
|
export default compileNewModificatorFunctionBody;
|