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.
Files changed (53) hide show
  1. package/README.md +40 -13
  2. package/build/api/errors/bindedMethodErrorHandler.js +52 -51
  3. package/build/api/errors/exceptionConstructor.js +98 -98
  4. package/build/api/errors/index.d.ts +1 -1
  5. package/build/api/errors/index.js +51 -48
  6. package/build/api/errors/throwModificationError.js +96 -95
  7. package/build/api/hooks/flowCheckers.d.ts +1 -1
  8. package/build/api/hooks/flowCheckers.js +11 -10
  9. package/build/api/hooks/index.js +7 -7
  10. package/build/api/hooks/invokeHook.js +46 -45
  11. package/build/api/hooks/registerHook.js +19 -18
  12. package/build/api/index.d.ts +1 -1
  13. package/build/api/index.js +9 -9
  14. package/build/api/types/InstanceCreator.d.ts +2 -4
  15. package/build/api/types/InstanceCreator.js +237 -239
  16. package/build/api/types/InstanceModificator.js +10 -8
  17. package/build/api/types/Mnemosyne.d.ts +3 -2
  18. package/build/api/types/Mnemosyne.js +127 -111
  19. package/build/api/types/TypeProxy.js +132 -132
  20. package/build/api/types/addProps.d.ts +1 -0
  21. package/build/api/types/addProps.js +68 -0
  22. package/build/api/types/compileNewModificatorFunctionBody.d.ts +1 -1
  23. package/build/api/types/compileNewModificatorFunctionBody.js +37 -27
  24. package/build/api/types/createInstanceModificator.js +26 -24
  25. package/build/api/types/createInstanceModificator200XthWay.js +29 -28
  26. package/build/api/types/index.js +161 -159
  27. package/build/api/types/obeyConstructor.d.ts +1 -0
  28. package/build/api/types/obeyConstructor.js +30 -0
  29. package/build/api/utils/index.d.ts +20 -8
  30. package/build/api/utils/index.js +122 -122
  31. package/build/constants/index.d.ts +2 -0
  32. package/build/constants/index.js +62 -57
  33. package/build/descriptors/errors/index.js +7 -7
  34. package/build/descriptors/index.js +5 -5
  35. package/build/descriptors/namespaces/index.js +70 -70
  36. package/build/descriptors/types/index.js +141 -141
  37. package/build/index.d.ts +39 -5
  38. package/build/index.js +63 -31
  39. package/build/types/index.d.ts +16 -17
  40. package/build/types/index.js +1 -1
  41. package/build/utils/collectConstructors.js +52 -51
  42. package/build/utils/defineStackCleaner.js +9 -8
  43. package/build/utils/extract.js +16 -15
  44. package/build/utils/hop.js +3 -2
  45. package/build/utils/index.js +27 -27
  46. package/build/utils/merge.js +15 -14
  47. package/build/utils/parent.js +17 -16
  48. package/build/utils/parse.js +42 -41
  49. package/build/utils/pick.js +21 -20
  50. package/build/utils/toJSON.js +27 -26
  51. package/package.json +92 -92
  52. package/build/api/types/InstanceCreatorProto.d.ts +0 -3
  53. package/build/api/types/InstanceCreatorProto.js +0 -88
@@ -1,170 +1,170 @@
1
1
  'use strict';
2
- Object.defineProperty(exports, '__esModule', { value : true });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.types = void 0;
4
- const hop_1 = require('../../utils/hop');
5
- const constants_1 = require('../../constants');
4
+ const hop_1 = require("../../utils/hop");
5
+ const constants_1 = require("../../constants");
6
6
  const { odp, SymbolConstructorName, SymbolDefaultNamespace, SymbolDefaultTypesCollection, SymbolConfig, MNEMONICA, MNEMOSYNE, } = constants_1.constants;
7
- const errors_1 = require('../../descriptors/errors');
7
+ const errors_1 = require("../../descriptors/errors");
8
8
  const { NAMESPACE_DOES_NOT_EXIST, ASSOCIATION_EXISTS, } = errors_1.ErrorsTypes;
9
- const namespaces_1 = require('../namespaces');
9
+ const namespaces_1 = require("../namespaces");
10
10
  const { [SymbolDefaultNamespace]: defaultNamespace, defaultOptionsKeys } = namespaces_1.namespaces;
11
- const types_1 = require('../../api/types');
12
- const hooksAPI = require('../../api/hooks');
13
- const proto = Object.assign({ define : types_1.define,
14
- lookup : types_1.lookup }, hooksAPI);
11
+ const types_1 = require("../../api/types");
12
+ const hooksAPI = require("../../api/hooks");
13
+ const proto = Object.assign({ define: types_1.define,
14
+ lookup: types_1.lookup }, hooksAPI);
15
15
  const TypesCollection = function (namespace, config) {
16
- const self = this;
17
- const subtypes = new Map();
18
- config = defaultOptionsKeys.reduce((o, key) => {
19
- if (typeof config[key] === 'boolean') {
20
- o[key] = config[key];
21
- }
22
- else {
23
- o[key] = namespace[SymbolConfig][key];
24
- }
25
- return o;
26
- }, {});
27
- odp(this, SymbolConfig, {
28
- get () {
29
- return config;
30
- }
31
- });
32
- odp(this, Symbol.hasInstance, {
33
- get () {
34
- return (instance) => {
35
- return instance[SymbolConstructorName] === namespace.name;
36
- };
37
- }
38
- });
39
- odp(this, 'subtypes', {
40
- get () {
41
- return subtypes;
42
- }
43
- });
44
- odp(subtypes, MNEMOSYNE, {
45
- get () {
46
- return namespace.typesCollections.get(self);
47
- }
48
- });
49
- odp(this, MNEMOSYNE, {
50
- get () {
51
- return namespace.typesCollections.get(self);
52
- }
53
- });
54
- odp(this, 'namespace', {
55
- get () {
56
- return namespace;
57
- }
58
- });
59
- odp(subtypes, 'namespace', {
60
- get () {
61
- return namespace;
62
- }
63
- });
64
- const hooks = Object.create(null);
65
- odp(this, 'hooks', {
66
- get () {
67
- return hooks;
68
- }
69
- });
16
+ const self = this;
17
+ const subtypes = new Map();
18
+ config = defaultOptionsKeys.reduce((o, key) => {
19
+ if (typeof config[key] === 'boolean') {
20
+ o[key] = config[key];
21
+ }
22
+ else {
23
+ o[key] = namespace[SymbolConfig][key];
24
+ }
25
+ return o;
26
+ }, {});
27
+ odp(this, SymbolConfig, {
28
+ get() {
29
+ return config;
30
+ }
31
+ });
32
+ odp(this, Symbol.hasInstance, {
33
+ get() {
34
+ return (instance) => {
35
+ return instance[SymbolConstructorName] === namespace.name;
36
+ };
37
+ }
38
+ });
39
+ odp(this, 'subtypes', {
40
+ get() {
41
+ return subtypes;
42
+ }
43
+ });
44
+ odp(subtypes, MNEMOSYNE, {
45
+ get() {
46
+ return namespace.typesCollections.get(self);
47
+ }
48
+ });
49
+ odp(this, MNEMOSYNE, {
50
+ get() {
51
+ return namespace.typesCollections.get(self);
52
+ }
53
+ });
54
+ odp(this, 'namespace', {
55
+ get() {
56
+ return namespace;
57
+ }
58
+ });
59
+ odp(subtypes, 'namespace', {
60
+ get() {
61
+ return namespace;
62
+ }
63
+ });
64
+ const hooks = Object.create(null);
65
+ odp(this, 'hooks', {
66
+ get() {
67
+ return hooks;
68
+ }
69
+ });
70
70
  };
71
71
  odp(TypesCollection.prototype, MNEMONICA, {
72
- get () {
73
- return this.namespace.typesCollections.get(this);
74
- }
72
+ get() {
73
+ return this.namespace.typesCollections.get(this);
74
+ }
75
75
  });
76
76
  odp(TypesCollection.prototype, 'define', {
77
- get () {
78
- const { subtypes } = this;
79
- return function (...args) {
80
- return proto.define.call(this, subtypes, ...args);
81
- };
82
- },
83
- enumerable : true
77
+ get() {
78
+ const { subtypes } = this;
79
+ return function (...args) {
80
+ return proto.define.call(this, subtypes, ...args);
81
+ };
82
+ },
83
+ enumerable: true
84
84
  });
85
85
  odp(TypesCollection.prototype, 'lookup', {
86
- get () {
87
- return function (...args) {
88
- return proto.lookup.call(this.subtypes, ...args);
89
- }.bind(this);
90
- },
91
- enumerable : true
86
+ get() {
87
+ return function (...args) {
88
+ return proto.lookup.call(this.subtypes, ...args);
89
+ }.bind(this);
90
+ },
91
+ enumerable: true
92
92
  });
93
93
  odp(TypesCollection.prototype, 'registerHook', {
94
- get () {
95
- const proxy = this.namespace.typesCollections.get(this);
96
- return function (hookName, hookCallback) {
97
- return proto.registerHook.call(this, hookName, hookCallback);
98
- }.bind(proxy);
99
- },
100
- enumerable : true
94
+ get() {
95
+ const proxy = this.namespace.typesCollections.get(this);
96
+ return function (hookName, hookCallback) {
97
+ return proto.registerHook.call(this, hookName, hookCallback);
98
+ }.bind(proxy);
99
+ },
100
+ enumerable: true
101
101
  });
102
102
  odp(TypesCollection.prototype, 'invokeHook', {
103
- get () {
104
- const proxy = this.namespace.typesCollections.get(this);
105
- return function (hookName, hookCallback) {
106
- return proto.invokeHook.call(this, hookName, hookCallback);
107
- }.bind(proxy);
108
- }
103
+ get() {
104
+ const proxy = this.namespace.typesCollections.get(this);
105
+ return function (hookName, hookCallback) {
106
+ return proto.invokeHook.call(this, hookName, hookCallback);
107
+ }.bind(proxy);
108
+ }
109
109
  });
110
110
  odp(TypesCollection.prototype, 'registerFlowChecker', {
111
- get () {
112
- const proxy = this.namespace.typesCollections.get(this);
113
- return function (flowCheckerCallback) {
114
- return proto.registerFlowChecker.call(this, flowCheckerCallback);
115
- }.bind(proxy);
116
- }
111
+ get() {
112
+ const proxy = this.namespace.typesCollections.get(this);
113
+ return function (flowCheckerCallback) {
114
+ return proto.registerFlowChecker.call(this, flowCheckerCallback);
115
+ }.bind(proxy);
116
+ }
117
117
  });
118
118
  const typesCollectionProxyHandler = {
119
- get (target, prop) {
120
- if (target.subtypes.has(prop)) {
121
- return target.subtypes.get(prop);
122
- }
123
- return Reflect.get(target, prop);
124
- },
125
- set (target, TypeName, Constructor) {
126
- return target.define(TypeName, Constructor);
127
- },
128
- getOwnPropertyDescriptor (target, prop) {
129
- return target.subtypes.has(prop) ? {
130
- configurable : true,
131
- enumerable : true,
132
- writeable : false,
133
- value : target.subtypes.get(prop)
134
- } : undefined;
135
- }
119
+ get(target, prop) {
120
+ if (target.subtypes.has(prop)) {
121
+ return target.subtypes.get(prop);
122
+ }
123
+ return Reflect.get(target, prop);
124
+ },
125
+ set(target, TypeName, Constructor) {
126
+ return target.define(TypeName, Constructor);
127
+ },
128
+ getOwnPropertyDescriptor(target, prop) {
129
+ return target.subtypes.has(prop) ? {
130
+ configurable: true,
131
+ enumerable: true,
132
+ writable: false,
133
+ value: target.subtypes.get(prop)
134
+ } : undefined;
135
+ }
136
136
  };
137
137
  const createTypesCollection = (namespace = defaultNamespace, association, config = {}) => {
138
- if (!(namespace instanceof Object) ||
139
- !hop_1.hop(namespace, 'name') ||
138
+ if (!(namespace instanceof Object) ||
139
+ !(0, hop_1.hop)(namespace, 'name') ||
140
140
  !namespaces_1.namespaces.namespaces.has(namespace.name)) {
141
- throw new NAMESPACE_DOES_NOT_EXIST;
142
- }
143
- if (namespace.typesCollections.has(association)) {
144
- throw new ASSOCIATION_EXISTS;
145
- }
146
- const typesCollection = new TypesCollection(namespace, config);
147
- const typesCollectionProxy = new Proxy(typesCollection, typesCollectionProxyHandler);
148
- namespace.typesCollections.set(typesCollection, typesCollectionProxy);
149
- namespace.typesCollections.set(typesCollectionProxy, typesCollection);
150
- if (association) {
151
- namespace.typesCollections.set(association, typesCollectionProxy);
152
- }
153
- return typesCollectionProxy;
141
+ throw new NAMESPACE_DOES_NOT_EXIST;
142
+ }
143
+ if (namespace.typesCollections.has(association)) {
144
+ throw new ASSOCIATION_EXISTS;
145
+ }
146
+ const typesCollection = new TypesCollection(namespace, config);
147
+ const typesCollectionProxy = new Proxy(typesCollection, typesCollectionProxyHandler);
148
+ namespace.typesCollections.set(typesCollection, typesCollectionProxy);
149
+ namespace.typesCollections.set(typesCollectionProxy, typesCollection);
150
+ if (association) {
151
+ namespace.typesCollections.set(association, typesCollectionProxy);
152
+ }
153
+ return typesCollectionProxy;
154
154
  };
155
155
  const DEFAULT_TYPES = createTypesCollection(defaultNamespace, SymbolDefaultTypesCollection);
156
156
  odp(DEFAULT_TYPES, SymbolDefaultTypesCollection, {
157
- get () {
158
- return true;
159
- }
157
+ get() {
158
+ return true;
159
+ }
160
160
  });
161
161
  exports.types = {
162
- get createTypesCollection () {
163
- return function (namespace, association, config = {}) {
164
- return createTypesCollection(namespace, association, config);
165
- };
166
- },
167
- get defaultTypes () {
168
- return DEFAULT_TYPES;
169
- }
162
+ get createTypesCollection() {
163
+ return function (namespace, association, config = {}) {
164
+ return createTypesCollection(namespace, association, config);
165
+ };
166
+ },
167
+ get defaultTypes() {
168
+ return DEFAULT_TYPES;
169
+ }
170
170
  };
package/build/index.d.ts CHANGED
@@ -1,13 +1,47 @@
1
- import { TypeAbsorber, ITypeClass, TypeLookup, IDEF } from './types';
1
+ import { TypeLookup, IDEF } from './types';
2
2
  export type { IDEF } from './types';
3
3
  export declare const defaultTypes: any;
4
- export declare const define: TypeAbsorber;
5
- export declare const tsdefine: <T>(this: any, TypeName: string, constructHandler: IDEF<T>, proto?: object | undefined, config?: object | undefined) => ITypeClass<T>;
4
+ type hooksTypes = 'preCreation' | 'postCreation' | 'creationError';
5
+ type hooksOpts = {
6
+ TypeName: string;
7
+ args: unknown[];
8
+ existentInstance: object;
9
+ inheritedInstance: object;
10
+ };
11
+ type hook = {
12
+ (opts: hooksOpts): void;
13
+ };
14
+ type constructorOptions = {
15
+ useOldStyle?: boolean;
16
+ strictChain?: boolean;
17
+ blockErrors?: boolean;
18
+ submitStack?: boolean;
19
+ awaitReturn?: boolean;
20
+ bindedProto?: boolean;
21
+ };
22
+ type Proto<P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
23
+ type SN = Record<string, new () => unknown>;
24
+ interface IDefinitorInstance<N extends object, S> {
25
+ new (...arg: unknown[]): {
26
+ [key in keyof S]: S[key];
27
+ };
28
+ define: IDefinitor<N, string>;
29
+ registerHook: (hookType: hooksTypes, cb: hook) => void;
30
+ }
31
+ interface IDefinitor<P extends object, SubTypeName extends string> {
32
+ <PP extends object, T, M extends Proto<P, Proto<PP, T>>, S extends SN & M>(this: unknown, TypeName: SubTypeName, constructHandler: IDEF<T>, proto?: PP, config?: constructorOptions): IDefinitorInstance<M, S>;
33
+ }
34
+ export declare const define: <T, P extends object, N extends Proto<P, T>, S extends SN & N, R extends IDefinitorInstance<N, S>>(this: unknown, TypeName?: string, constructHandler?: IDEF<T> | undefined, proto?: P | undefined, config?: constructorOptions) => R;
6
35
  export declare const lookup: TypeLookup;
36
+ export declare const apply: <E extends object, T extends object, S extends Proto<E, T>>(entity: E, Constructor: IDEF<T>, args?: unknown[]) => { [key in keyof S]: S[key]; };
37
+ export declare const call: <E extends object, T extends object, S extends Proto<E, T>>(entity: E, Constructor: IDEF<T>, ...args: unknown[]) => { [key in keyof S]: S[key]; };
38
+ export declare const bind: <E extends object, T extends object, S extends Proto<E, T>>(entity: E, Constructor: IDEF<T>) => (...args: unknown[]) => { [key in keyof S]: S[key]; };
39
+ export declare const decorate: (parentClass?: unknown, proto?: object, config?: constructorOptions) => <T extends new () => unknown>(cstr: T, s: ClassDecoratorContext<T>) => T;
40
+ export declare const registerHook: <T extends object>(Constructor: IDEF<T>, hookType: hooksTypes, cb: hook) => void;
7
41
  export declare const mnemonica: {
8
- [index: string]: any;
42
+ [index: string]: unknown;
9
43
  };
10
- export declare const SymbolSubtypeCollection: any, SymbolConstructorName: any, SymbolGaia: any, SymbolReplaceGaia: any, SymbolDefaultNamespace: any, SymbolDefaultTypesCollection: any, SymbolConfig: any, MNEMONICA: any, MNEMOSYNE: any, GAIA: any, URANUS: any, TYPE_TITLE_PREFIX: any, ErrorMessages: any, createNamespace: any, namespaces: any, defaultNamespace: any, createTypesCollection: any;
44
+ export declare const SymbolSubtypeCollection: unknown, SymbolConstructorName: unknown, SymbolGaia: unknown, SymbolReplaceGaia: unknown, SymbolDefaultNamespace: unknown, SymbolDefaultTypesCollection: unknown, SymbolConfig: unknown, MNEMONICA: unknown, MNEMOSYNE: unknown, GAIA: unknown, URANUS: unknown, TYPE_TITLE_PREFIX: unknown, ErrorMessages: unknown, createNamespace: unknown, namespaces: unknown, defaultNamespace: unknown, createTypesCollection: unknown;
11
45
  export declare const defaultCollection: any;
12
46
  export declare const errors: any;
13
47
  export { utils } from './utils';
package/build/index.js CHANGED
@@ -1,42 +1,74 @@
1
1
  'use strict';
2
- Object.defineProperty(exports, '__esModule', { value : true });
3
- exports.defineStackCleaner = exports.utils = exports.errors = exports.defaultCollection = exports.createTypesCollection = exports.defaultNamespace = exports.namespaces = exports.createNamespace = exports.ErrorMessages = exports.TYPE_TITLE_PREFIX = exports.URANUS = exports.GAIA = exports.MNEMOSYNE = exports.MNEMONICA = exports.SymbolConfig = exports.SymbolDefaultTypesCollection = exports.SymbolDefaultNamespace = exports.SymbolReplaceGaia = exports.SymbolGaia = exports.SymbolConstructorName = exports.SymbolSubtypeCollection = exports.mnemonica = exports.lookup = exports.tsdefine = exports.define = exports.defaultTypes = void 0;
4
- const constants_1 = require('./constants');
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defineStackCleaner = exports.utils = exports.errors = exports.defaultCollection = exports.createTypesCollection = exports.defaultNamespace = exports.namespaces = exports.createNamespace = exports.ErrorMessages = exports.TYPE_TITLE_PREFIX = exports.URANUS = exports.GAIA = exports.MNEMOSYNE = exports.MNEMONICA = exports.SymbolConfig = exports.SymbolDefaultTypesCollection = exports.SymbolDefaultNamespace = exports.SymbolReplaceGaia = exports.SymbolGaia = exports.SymbolConstructorName = exports.SymbolSubtypeCollection = exports.mnemonica = exports.registerHook = exports.decorate = exports.bind = exports.call = exports.apply = exports.lookup = exports.define = exports.defaultTypes = void 0;
4
+ const constants_1 = require("./constants");
5
5
  const { odp } = constants_1.constants;
6
- const errorsApi = require('./api/errors');
7
- const descriptors_1 = require('./descriptors');
6
+ const errorsApi = require("./api/errors");
7
+ const descriptors_1 = require("./descriptors");
8
8
  exports.defaultTypes = descriptors_1.descriptors.defaultTypes;
9
- function checkThis (pointer) {
10
- return pointer === exports.mnemonica ||
11
- pointer === exports;
9
+ function checkThis(pointer) {
10
+ return pointer === exports.mnemonica || pointer === exports;
12
11
  }
13
-
14
- exports.define = function (TypeName, constructHandler, proto, config) {
15
- const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
16
- return types.define(TypeName, constructHandler, proto, config);
17
- };
18
- exports.tsdefine = function (TypeName, constructHandler, proto, config) {
19
- return exports.defaultTypes.define(TypeName, constructHandler, proto, config);
12
+ const define = function (TypeName, constructHandler, proto, config) {
13
+ const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
14
+ return types.define(TypeName, constructHandler, proto, config);
20
15
  };
16
+ exports.define = define;
21
17
  exports.lookup = function (TypeNestedPath) {
22
- const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
23
- return types.lookup(TypeNestedPath);
18
+ const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
19
+ return types.lookup(TypeNestedPath);
20
+ };
21
+ const apply = function (entity, Constructor, args = []) {
22
+ const result = new entity[Constructor.TypeName](...args);
23
+ return result;
24
+ };
25
+ exports.apply = apply;
26
+ const call = function (entity, Constructor, ...args) {
27
+ const result = new entity[Constructor.TypeName](...args);
28
+ return result;
29
+ };
30
+ exports.call = call;
31
+ const bind = function (entity, Constructor) {
32
+ return (...args) => {
33
+ const result = new entity[Constructor.TypeName](...args);
34
+ return result;
35
+ };
36
+ };
37
+ exports.bind = bind;
38
+ const decorate = function (parentClass = undefined, proto, config) {
39
+ const decorator = function (cstr, s) {
40
+ if (parentClass === undefined) {
41
+ return (0, exports.define)(s.name, cstr, proto, config);
42
+ }
43
+ return parentClass.define(s.name, cstr, proto, config);
44
+ };
45
+ return decorator;
46
+ };
47
+ exports.decorate = decorate;
48
+ const registerHook = function (Constructor, hookType, cb) {
49
+ Constructor.registerHook(hookType, cb);
24
50
  };
25
- exports.mnemonica = Object.entries(Object.assign(Object.assign(Object.assign({ define : exports.define,
26
- lookup : exports.lookup }, descriptors_1.descriptors), errorsApi), constants_1.constants)).reduce((acc, entry) => {
27
- const [name, code] = entry;
28
- odp(acc, name, {
29
- get () {
30
- return code;
31
- },
32
- enumerable : true
33
- });
34
- return acc;
51
+ exports.registerHook = registerHook;
52
+ exports.mnemonica = Object.entries(Object.assign(Object.assign(Object.assign({ define: exports.define,
53
+ lookup: exports.lookup,
54
+ apply: exports.apply,
55
+ call: exports.call,
56
+ bind: exports.bind,
57
+ decorate: exports.decorate,
58
+ registerHook: exports.registerHook }, descriptors_1.descriptors), errorsApi), constants_1.constants)).reduce((acc, entry) => {
59
+ const [name, code] = entry;
60
+ odp(acc, name, {
61
+ get() {
62
+ return code;
63
+ },
64
+ enumerable: true
65
+ });
66
+ return acc;
35
67
  }, {});
36
68
  exports.SymbolSubtypeCollection = exports.mnemonica.SymbolSubtypeCollection, exports.SymbolConstructorName = exports.mnemonica.SymbolConstructorName, exports.SymbolGaia = exports.mnemonica.SymbolGaia, exports.SymbolReplaceGaia = exports.mnemonica.SymbolReplaceGaia, exports.SymbolDefaultNamespace = exports.mnemonica.SymbolDefaultNamespace, exports.SymbolDefaultTypesCollection = exports.mnemonica.SymbolDefaultTypesCollection, exports.SymbolConfig = exports.mnemonica.SymbolConfig, exports.MNEMONICA = exports.mnemonica.MNEMONICA, exports.MNEMOSYNE = exports.mnemonica.MNEMOSYNE, exports.GAIA = exports.mnemonica.GAIA, exports.URANUS = exports.mnemonica.URANUS, exports.TYPE_TITLE_PREFIX = exports.mnemonica.TYPE_TITLE_PREFIX, exports.ErrorMessages = exports.mnemonica.ErrorMessages, exports.createNamespace = exports.mnemonica.createNamespace, exports.namespaces = exports.mnemonica.namespaces, exports.defaultNamespace = exports.mnemonica.defaultNamespace, exports.createTypesCollection = exports.mnemonica.createTypesCollection;
37
69
  exports.defaultCollection = exports.defaultTypes.subtypes;
38
70
  exports.errors = descriptors_1.descriptors.ErrorsTypes;
39
- var utils_1 = require('./utils');
40
- Object.defineProperty(exports, 'utils', { enumerable : true, get : function () { return utils_1.utils; } });
41
- var utils_2 = require('./utils');
42
- Object.defineProperty(exports, 'defineStackCleaner', { enumerable : true, get : function () { return utils_2.defineStackCleaner; } });
71
+ var utils_1 = require("./utils");
72
+ Object.defineProperty(exports, "utils", { enumerable: true, get: function () { return utils_1.utils; } });
73
+ var utils_2 = require("./utils");
74
+ Object.defineProperty(exports, "defineStackCleaner", { enumerable: true, get: function () { return utils_2.defineStackCleaner; } });
@@ -1,27 +1,26 @@
1
+ export type IDEF<T> = {
2
+ new (): T;
3
+ } | {
4
+ (this: T, ...args: any[]): void;
5
+ };
1
6
  export interface ConstructorFunction<ConstructorInstance extends object> {
2
- new (...args: any[]): ConstructorInstance;
3
- (this: ConstructorInstance, ...args: any[]): ConstructorInstance;
7
+ new (...args: unknown[]): ConstructorInstance;
8
+ (this: ConstructorInstance, ...args: unknown[]): ConstructorInstance;
4
9
  prototype: ConstructorInstance;
5
10
  }
6
- export declare type TypeModificator<T extends object> = (...args: any[]) => ConstructorFunction<T>;
7
- export declare type TypeLookup = (this: Map<string, any>, TypeNestedPath: string) => TypeClass;
8
- export declare type TypeClass = {
9
- new (...args: any[]): any;
11
+ export type TypeLookup = (this: Map<string, unknown>, TypeNestedPath: string) => TypeClass;
12
+ export type TypeClass = {
13
+ new (...args: unknown[]): unknown;
10
14
  define: TypeAbsorber;
11
15
  lookup: TypeLookup;
12
- registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => any;
13
- };
14
- export declare type TypeAbsorber = (this: any, TypeName: string, constructHandler: CallableFunction, proto?: object, config?: object) => TypeClass;
15
- export declare type IDEF<T> = {
16
- new (...args: any[]): T;
17
- (this: T, ...args: any[]): T;
18
- prototype?: ThisType<T>;
16
+ registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => unknown;
19
17
  };
20
- export declare type ITypeAbsorber<T> = (this: any, TypeName: string, constructHandler: IDEF<T>, proto?: object, config?: object) => ITypeClass<T>;
18
+ export type TypeAbsorber = (this: unknown, TypeName: string, constructHandler: CallableFunction, proto?: object, config?: object) => TypeClass;
19
+ export type ITypeAbsorber<T> = (this: unknown, TypeName: string, constructHandler: IDEF<T>, proto?: object, config?: object) => ITypeClass<T>;
21
20
  export interface ITypeClass<T> {
22
- new (...args: any[]): T;
23
- (this: T, ...args: any[]): T;
21
+ new (...args: unknown[]): T;
22
+ (this: T, ...args: unknown[]): T;
24
23
  define: ITypeAbsorber<T>;
25
24
  lookup: TypeLookup;
26
- registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => any;
25
+ registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => unknown;
27
26
  }
@@ -1,2 +1,2 @@
1
1
  'use strict';
2
- Object.defineProperty(exports, '__esModule', { value : true });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,59 +1,60 @@
1
1
  'use strict';
2
- Object.defineProperty(exports, '__esModule', { value : true });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collectConstructors = void 0;
4
- const constants_1 = require('../constants');
4
+ const constants_1 = require("../constants");
5
5
  const { MNEMOSYNE, MNEMONICA, GAIA, } = constants_1.constants;
6
6
  const getAdditor = (constructors) => {
7
- return Array.isArray(constructors) ?
8
- (name) => {
9
- constructors.push(name);
10
- } : (name) => {
11
- constructors[name] = true;
12
- };
7
+ return Array.isArray(constructors) ?
8
+ (name) => {
9
+ constructors.push(name);
10
+ } : (name) => {
11
+ constructors[name] = true;
12
+ };
13
13
  };
14
14
  const getAccumulator = (asSequence) => {
15
- return asSequence ? [] : {};
15
+ return asSequence ? [] : {};
16
16
  };
17
- exports.collectConstructors = (self, asSequence = false) => {
18
- const constructors = getAccumulator(asSequence);
19
- const addToSequence = getAdditor(constructors);
20
- if (typeof self === 'object') {
21
- if (self === null) {
22
- return constructors;
23
- }
24
- }
25
- else {
26
- return constructors;
27
- }
28
- let proto = Reflect.getPrototypeOf(self);
29
- let mnemonicaReached = false;
30
- while (proto) {
31
- if (!proto.constructor) {
32
- addToSequence(proto);
33
- break;
34
- }
35
- const constructorName = proto.constructor.name;
36
- if (constructorName === GAIA) {
37
- self = proto;
38
- proto = Reflect.getPrototypeOf(self);
39
- continue;
40
- }
41
- if (constructorName === MNEMONICA) {
42
- if (!mnemonicaReached) {
43
- addToSequence(constructorName);
44
- addToSequence(MNEMOSYNE);
45
- mnemonicaReached = true;
46
- }
47
- }
48
- else if (constructorName === 'Object') {
49
- addToSequence(constructorName);
50
- break;
51
- }
52
- else {
53
- addToSequence(constructorName);
54
- }
55
- self = proto;
56
- proto = Reflect.getPrototypeOf(self);
57
- }
58
- return constructors;
17
+ const collectConstructors = (self, asSequence = false) => {
18
+ const constructors = getAccumulator(asSequence);
19
+ const addToSequence = getAdditor(constructors);
20
+ if (typeof self === 'object') {
21
+ if (self === null) {
22
+ return constructors;
23
+ }
24
+ }
25
+ else {
26
+ return constructors;
27
+ }
28
+ let proto = Reflect.getPrototypeOf(self);
29
+ let mnemonicaReached = false;
30
+ while (proto) {
31
+ if (!proto.constructor) {
32
+ addToSequence(proto);
33
+ break;
34
+ }
35
+ const constructorName = proto.constructor.name;
36
+ if (constructorName === GAIA) {
37
+ self = proto;
38
+ proto = Reflect.getPrototypeOf(self);
39
+ continue;
40
+ }
41
+ if (constructorName === MNEMONICA) {
42
+ if (!mnemonicaReached) {
43
+ addToSequence(constructorName);
44
+ addToSequence(MNEMOSYNE);
45
+ mnemonicaReached = true;
46
+ }
47
+ }
48
+ else if (constructorName === 'Object') {
49
+ addToSequence(constructorName);
50
+ break;
51
+ }
52
+ else {
53
+ addToSequence(constructorName);
54
+ }
55
+ self = proto;
56
+ proto = Reflect.getPrototypeOf(self);
57
+ }
58
+ return constructors;
59
59
  };
60
+ exports.collectConstructors = collectConstructors;