mnemonica 0.9.938 → 0.9.943

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.
@@ -83,7 +83,7 @@ const exceptionConsctructHandler = function (opts) {
83
83
  });
84
84
  stack.push('\n<-- of constructor definitions stack -->');
85
85
  stack.push(...typeStack);
86
- exception.stack = errors_2.cleanupStack(stack).join('\n');
86
+ exception.stack = (0, errors_2.cleanupStack)(stack).join('\n');
87
87
  return exception;
88
88
  };
89
89
  const prepareException = function (target, error, ...args) {
@@ -104,7 +104,7 @@ const prepareException = function (target, error, ...args) {
104
104
  error
105
105
  });
106
106
  });
107
- ExceptionCreator.InstanceModificator = InstanceModificator_1.makeInstanceModificator(ExceptionCreator);
107
+ ExceptionCreator.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(ExceptionCreator);
108
108
  return new ExceptionCreator.InstanceModificator();
109
109
  };
110
110
  exports.default = prepareException;
@@ -25,7 +25,7 @@ const getStack = function (title, stackAddition, tillFunction) {
25
25
  this.stack = (new Error()).stack;
26
26
  }
27
27
  this.stack = this.stack.split('\n').slice(1);
28
- this.stack = exports.cleanupStack(this.stack);
28
+ this.stack = (0, exports.cleanupStack)(this.stack);
29
29
  this.stack.unshift(title);
30
30
  if (Array.isArray(stackAddition) && stackAddition.length) {
31
31
  this.stack.push(...stackAddition);
@@ -43,7 +43,7 @@ class BASE_MNEMONICA_ERROR extends Error {
43
43
  return BaseStack;
44
44
  }
45
45
  });
46
- const stack = exports.cleanupStack(BaseStack.split('\n'));
46
+ const stack = (0, exports.cleanupStack)(BaseStack.split('\n'));
47
47
  if (additionalStack) {
48
48
  stack.unshift(...additionalStack);
49
49
  }
@@ -41,7 +41,7 @@ const throwModificationError = function (error) {
41
41
  enumerable : true
42
42
  });
43
43
  self.ModificatorType = makeFakeModificatorType(TypeName);
44
- self.InstanceModificator = InstanceModificator_1.makeInstanceModificator(self);
44
+ self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
45
45
  const erroredInstance = new self.InstanceModificator();
46
46
  erroredInstance[SymbolReplaceGaia](error);
47
47
  const stack = [];
@@ -62,7 +62,7 @@ const throwModificationError = function (error) {
62
62
  stack.push('\n<-- of constructor definitions stack -->');
63
63
  stack.push(...typeStack);
64
64
  }
65
- erroredInstance.stack = _1.cleanupStack(stack).join('\n');
65
+ erroredInstance.stack = (0, _1.cleanupStack)(stack).join('\n');
66
66
  self.inheritedInstance = erroredInstance;
67
67
  const results = self.invokePostHooks();
68
68
  const { type, collection, namespace } = results;
@@ -9,7 +9,7 @@ const invokeHook = function (hookType, opts) {
9
9
  const { type, existentInstance, inheritedInstance, args, creator } = opts;
10
10
  const invocationResults = new Set();
11
11
  const self = this;
12
- if (hop_1.hop(self.hooks, hookType)) {
12
+ if ((0, hop_1.hop)(self.hooks, hookType)) {
13
13
  const { TypeName, } = type;
14
14
  const hookArgs = {
15
15
  type,
@@ -76,7 +76,7 @@ const bindMethod = function (instance, methodName, MethodItself) {
76
76
  value : error,
77
77
  enumerable : true
78
78
  });
79
- throw bindedMethodErrorHandler_1.bindedMethodErrorHandler(exceptionReason);
79
+ throw (0, bindedMethodErrorHandler_1.bindedMethodErrorHandler)(exceptionReason);
80
80
  });
81
81
  }
82
82
  return answer;
@@ -86,7 +86,7 @@ const bindMethod = function (instance, methodName, MethodItself) {
86
86
  value : error,
87
87
  enumerable : true
88
88
  });
89
- throw bindedMethodErrorHandler_1.bindedMethodErrorHandler(exceptionReason);
89
+ throw (0, bindedMethodErrorHandler_1.bindedMethodErrorHandler)(exceptionReason);
90
90
  }
91
91
  };
92
92
  },
@@ -231,11 +231,11 @@ exports.InstanceCreator = function (type, existentInstance, args, chained) {
231
231
  }
232
232
  if (blockErrors && existentInstance instanceof Error) {
233
233
  self.ModificatorType = makeFakeModificatorType(TypeName);
234
- self.InstanceModificator = InstanceModificator_1.makeInstanceModificator(self);
234
+ self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
235
235
  throw new self.InstanceModificator(...args);
236
236
  }
237
237
  self.invokePreHooks();
238
- self.InstanceModificator = InstanceModificator_1.makeInstanceModificator(self);
238
+ self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
239
239
  if (blockErrors) {
240
240
  try {
241
241
  self.inheritedInstance = new self.InstanceModificator(...args);
@@ -2,7 +2,7 @@ import { ConstructorFunction } from '../../types';
2
2
  declare const _default: {
3
3
  Gaia: ConstructorFunction<{}>;
4
4
  Mnemosyne: ConstructorFunction<{
5
- [x: string]: (this: any) => any;
5
+ [x: symbol]: (() => (this: any, uranus: any) => void) | (() => string);
6
6
  extract(): (this: any) => {
7
7
  [index: string]: any;
8
8
  };
@@ -24,17 +24,17 @@ const Gaia = function (Uranus) {
24
24
  const MnemonicaProtoProps = {
25
25
  extract () {
26
26
  return function () {
27
- return extract_1.extract(this);
27
+ return (0, extract_1.extract)(this);
28
28
  };
29
29
  },
30
30
  pick () {
31
31
  return function (...args) {
32
- return pick_1.pick(this, ...args);
32
+ return (0, pick_1.pick)(this, ...args);
33
33
  };
34
34
  },
35
35
  parent () {
36
36
  return function (constructorLookupPath) {
37
- return parent_1.parent(this, constructorLookupPath);
37
+ return (0, parent_1.parent)(this, constructorLookupPath);
38
38
  };
39
39
  },
40
40
  clone () {
@@ -28,7 +28,7 @@ exports.TypeProxy.prototype.get = function (target, prop) {
28
28
  if (propDeclaration) {
29
29
  return propDeclaration;
30
30
  }
31
- if (hop_1.hop(type, prop)) {
31
+ if ((0, hop_1.hop)(type, prop)) {
32
32
  return propDeclaration;
33
33
  }
34
34
  if (type.subtypes.has(prop)) {
@@ -1,19 +1,20 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, '__esModule', { value : true });
3
3
  const compileNewModificatorFunctionBody = function (FunctionName, asClass = false) {
4
+ const dt = `${Date.now()}_${`${Math.random()}`.split('.')[1]}`;
4
5
  const modString = asClass ?
5
- `class ${FunctionName} extends ConstructHandler {
6
+ `class ${FunctionName} extends ConstructHandler_${dt} {
6
7
  constructor(...args) {
7
8
  const answer = super(...args);
8
- return CreationHandler.call(this, answer);
9
+ return CreationHandler_${dt}.call(this, answer);
9
10
  }
10
11
  }`
11
12
  :
12
13
  `const ${FunctionName} = function (...args) {
13
- const answer = ConstructHandler.call(this, ...args);
14
- return CreationHandler.call(this, answer);
14
+ const answer = ConstructHandler_${dt}.call(this, ...args);
15
+ return CreationHandler_${dt}.call(this, answer);
15
16
  };`;
16
- return new Function('ConstructHandler', 'CreationHandler', 'SymbolConstructorName', `return function () {
17
+ return new Function(`ConstructHandler_${dt}`, `CreationHandler_${dt}`, 'SymbolConstructorName', `return function () {
17
18
 
18
19
  ${modString}
19
20
 
@@ -21,7 +21,7 @@ function default_1 () {
21
21
  });
22
22
  ModificatorType.prototype.constructor = ModificatorType;
23
23
  Reflect.setPrototypeOf(ModificatorType.prototype, Mnemosyne);
24
- obeyConstructor_1.obey(existentInstance, ModificatorType);
24
+ (0, obeyConstructor_1.obey)(existentInstance, ModificatorType);
25
25
  return ModificatorType;
26
26
  };
27
27
  return CreateInstanceModificator;
@@ -17,7 +17,7 @@ function default_1 () {
17
17
  },
18
18
  enumerable : false
19
19
  });
20
- obeyConstructor_1.obey(existentInstance, ModificatorType);
20
+ (0, obeyConstructor_1.obey)(existentInstance, ModificatorType);
21
21
  return ModificatorType;
22
22
  };
23
23
  Inherico.prototype = Mnemosyne;
@@ -112,10 +112,10 @@ const defineFromFunction = function (subtypes, TypeName, constructHandler = func
112
112
  throw new HANDLER_MUST_BE_A_FUNCTION;
113
113
  }
114
114
  const asClass = isClass(constructHandler);
115
- const modificatorBody = compileNewModificatorFunctionBody_1.default(TypeName, asClass);
115
+ const modificatorBody = (0, compileNewModificatorFunctionBody_1.default)(TypeName, asClass);
116
116
  const makeConstructHandler = modificatorBody(constructHandler, CreationHandler, SymbolConstructorName);
117
117
  if (!proto) {
118
- if (hop_1.hop(constructHandler, 'prototype')) {
118
+ if ((0, hop_1.hop)(constructHandler, 'prototype')) {
119
119
  proto = Object.assign({}, constructHandler.prototype);
120
120
  }
121
121
  else {
@@ -109,7 +109,7 @@ const isClass = (fn) => {
109
109
  return Reflect.getOwnPropertyDescriptor(fn, 'prototype').writable === false;
110
110
  };
111
111
  const makeFakeModificatorType = (TypeName, fakeModificator = function () { }) => {
112
- const modificatorBody = compileNewModificatorFunctionBody_1.default(TypeName);
112
+ const modificatorBody = (0, compileNewModificatorFunctionBody_1.default)(TypeName);
113
113
  const modificatorType = modificatorBody(fakeModificator, CreationHandler, SymbolConstructorName);
114
114
  return modificatorType();
115
115
  };
@@ -9,6 +9,6 @@ exports.ErrorsTypes = {
9
9
  };
10
10
  Object.entries(ErrorMessages).forEach(entry => {
11
11
  const [ErrorConstructorName, message] = entry;
12
- const ErrorConstructor = errors_1.constructError(ErrorConstructorName, message);
12
+ const ErrorConstructor = (0, errors_1.constructError)(ErrorConstructorName, message);
13
13
  exports.ErrorsTypes[ErrorConstructorName] = ErrorConstructor;
14
14
  });
@@ -136,7 +136,7 @@ const typesCollectionProxyHandler = {
136
136
  };
137
137
  const createTypesCollection = (namespace = defaultNamespace, association, config = {}) => {
138
138
  if (!(namespace instanceof Object) ||
139
- !hop_1.hop(namespace, 'name') ||
139
+ !(0, hop_1.hop)(namespace, 'name') ||
140
140
  !namespaces_1.namespaces.namespaces.has(namespace.name)) {
141
141
  throw new NAMESPACE_DOES_NOT_EXIST;
142
142
  }
package/build/index.d.ts CHANGED
@@ -5,9 +5,9 @@ export declare const define: TypeAbsorber;
5
5
  export declare const tsdefine: <T>(this: any, TypeName: string, constructHandler: IDEF<T>, proto?: object | undefined, config?: object | undefined) => ITypeClass<T>;
6
6
  export declare const lookup: TypeLookup;
7
7
  export declare const mnemonica: {
8
- [index: string]: any;
8
+ [index: string]: unknown;
9
9
  };
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;
10
+ 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
11
  export declare const defaultCollection: any;
12
12
  export declare const errors: any;
13
13
  export { utils } from './utils';
@@ -10,7 +10,7 @@ const extract = (instance) => {
10
10
  }
11
11
  const extracted = {};
12
12
  for (const name in instance) {
13
- if (name === 'constructor' && !hop_1.hop(instance, name)) {
13
+ if (name === 'constructor' && !(0, hop_1.hop)(instance, name)) {
14
14
  continue;
15
15
  }
16
16
  extracted[name] = instance[name];
@@ -16,6 +16,6 @@ const parent = (instance, path) => {
16
16
  }
17
17
  const { constructor: { name } } = p;
18
18
  return name === path ?
19
- p : exports.parent(p, path);
19
+ p : (0, exports.parent)(p, path);
20
20
  };
21
21
  exports.parent = parent;
@@ -20,18 +20,18 @@ const parse = (self) => {
20
20
  throw new WRONG_ARGUMENTS_USED(`have to use "instance" itself: '${proto.constructor.name}' vs '${protoProto.constructor.name}'`);
21
21
  }
22
22
  const { name } = proto.constructor;
23
- const props = extract_1.extract(Object.assign({}, self));
23
+ const props = (0, extract_1.extract)(Object.assign({}, self));
24
24
  delete props.constructor;
25
- const joint = extract_1.extract(Object.assign({}, proto));
25
+ const joint = (0, extract_1.extract)(Object.assign({}, proto));
26
26
  delete joint.constructor;
27
27
  let parent;
28
28
  let gaia;
29
- if (hop_1.hop(protoProto, SymbolGaia)) {
29
+ if ((0, hop_1.hop)(protoProto, SymbolGaia)) {
30
30
  parent = protoProto;
31
31
  gaia = self[SymbolGaia];
32
32
  }
33
33
  else {
34
- parent = exports.parse(Reflect.getPrototypeOf(protoProto));
34
+ parent = (0, exports.parse)(Reflect.getPrototypeOf(protoProto));
35
35
  gaia = parent.gaia;
36
36
  }
37
37
  return {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, '__esModule', { value : true });
3
3
  exports.toJSON = void 0;
4
4
  const extract_1 = require('./extract');
5
5
  const toJSON = (instance) => {
6
- const extracted = extract_1.extract(instance);
6
+ const extracted = (0, extract_1.extract)(instance);
7
7
  return Object.entries(extracted).reduce((o, entry) => {
8
8
  const [name, _value] = entry;
9
9
  if ([null, undefined].includes(_value)) {
package/package.json CHANGED
@@ -1,94 +1,97 @@
1
1
  {
2
- "name": "mnemonica",
3
- "version": "0.9.938",
4
- "description": "abstract technique that aids information retention : instance inheritance system",
5
- "type": "commonjs",
6
- "main": "./build/index.js",
7
- "exports": {
8
- ".": "./build/index.js",
9
- "./module": {
10
- "import": "./module/index.js",
11
- "browser": "./module/index.js",
12
- "require": "./build/index.js",
13
- "default": "./build/index.js"
14
- }
15
- },
16
- "files": [
17
- "README.md",
18
- "LICENSE",
19
- "module",
20
- "build"
21
- ],
22
- "directories": {
23
- "build": "build/",
24
- "module": "module/"
25
- },
26
- "contributors": [
27
- "laplandin <laplandin.denis@gmail.com>",
28
- "petrgrishin <iam@petrgrishin.com>",
29
- "Goodluckhf <Goodluckhf@yandex.ru>"
30
- ],
31
- "scripts": {
32
- "build": "rm -rf ./build && npx tsc --pretty && npm run lint && npm run lint:test",
33
- "watch": "npx tsc --pretty -w",
34
- "test": "npm run build && mocha --allow-uncaught test/index.js",
35
- "test:cov:dev": "npm run build && nyc --reporter=text mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
36
- "test:cov": "npm run build && nyc --reporter=lcov mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
37
- "test:mjs": "npm run build && node --experimental-modules ./test/test.mjs",
38
- "debug": "npx tsc --pretty --sourceMap && npx mocha --allow-uncaught --reporter spec --inspect-brk test/index",
39
- "report-coverage": "cat coverage/lcov.info | coveralls",
40
- "example": "npm run build && node ./test/example.js",
41
- "lint": "npx eslint --fix --ignore-path .gitignore ./build",
42
- "lint:test": "npx eslint --fix --ignore-path .gitignore ./test",
43
- "ts:example": "npx tsc ./test-ts/*.ts && npx eslint --fix ./test-ts/*.js && node ./test-ts/test-no-types.js && node ./test-ts/test-with-types.js",
44
- "ts:lint": "npx tslint --fix --ignore-path .gitignore ./src"
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "git+https://github.com/wentout/mnemonica.git"
49
- },
50
- "keywords": [
51
- "ETL",
52
- "DFD",
53
- "inheritance",
54
- "mnemonica"
55
- ],
56
- "author": "went.out@gmail.com",
57
- "license": "MIT",
58
- "bugs": {
59
- "url": "https://github.com/wentout/mnemonica/issues"
60
- },
61
- "lint-staged": {
62
- "*.js": "eslint --fix --ignore-path .gitignore"
63
- },
64
- "homepage": "https://github.com/wentout/mnemonica#readme",
65
- "devDependencies": {
66
- "@types/node": "^13.13.48",
67
- "@typescript-eslint/eslint-plugin": "^2.33.0",
68
- "@typescript-eslint/parser": "^2.33.0",
69
- "chai": "^4.3.4",
70
- "coveralls": "^3.1.0",
71
- "eslint": "^6.8.0",
72
- "eslint-config-prettier": "^6.12.0",
73
- "eslint-plugin-import": "^2.22.1",
74
- "eslint-plugin-mocha": "^5.2.0",
75
- "eslint-plugin-no-arrow-this": "^1.2.0",
76
- "eslint-plugin-prettier": "^3.3.1",
77
- "husky": "^3.0.5",
78
- "lint-staged": "^9.2.5",
79
- "mocha": "^7.2.0",
80
- "mocha-lcov-reporter": "^1.3.0",
81
- "nyc": "^14.1.1",
82
- "tslint": "^6.1.3",
83
- "typescript": "^4.2.3"
84
- },
85
- "engines": {
86
- "node": ">=8.7"
87
- },
88
- "husky": {
89
- "hooks": {
90
- "pre-commit": "lint-staged"
91
- }
92
- },
93
- "dependencies": {}
2
+ "name": "mnemonica",
3
+ "version": "0.9.943",
4
+ "description": "abstract technique that aids information retention : instance inheritance system",
5
+ "type": "commonjs",
6
+ "main": "./build/index.js",
7
+ "exports": {
8
+ ".": "./build/index.js",
9
+ "./module": {
10
+ "import": "./module/index.js",
11
+ "browser": "./module/index.js",
12
+ "require": "./build/index.js",
13
+ "default": "./build/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "README.md",
18
+ "LICENSE",
19
+ "module",
20
+ "build"
21
+ ],
22
+ "directories": {
23
+ "build": "build/",
24
+ "module": "module/"
25
+ },
26
+ "contributors": [
27
+ "laplandin <laplandin.denis@gmail.com>",
28
+ "petrgrishin <iam@petrgrishin.com>",
29
+ "Goodluckhf <Goodluckhf@yandex.ru>"
30
+ ],
31
+ "scripts": {
32
+ "build": "rm -rf ./build && npx tsc --pretty && npm run lint && npm run lint:test",
33
+ "watch": "npx tsc --pretty -w",
34
+ "test": "npm run build && mocha --allow-uncaught test/index.js",
35
+ "test:cov": "npm run build && nyc --reporter=lcov mocha --allow-uncaught --ui bdd --reporter spec ./test/index.js",
36
+ "test:mjs": "npm run build && node --experimental-modules ./test/test.mjs",
37
+ "debug": "npx tsc --pretty --sourceMap && npx mocha --allow-uncaught --reporter spec --inspect-brk test/index",
38
+ "report-coverage": "cat coverage/lcov.info | coveralls",
39
+ "example": "npm run build && node ./test/example.js",
40
+ "lint": "npx eslint --fix --ignore-path .gitignore ./build",
41
+ "lint:test": "npx eslint --fix --ignore-path .gitignore ./test",
42
+ "ts:example": "npx tsc ./test-ts/*.ts && npx eslint --fix ./test-ts/*.js && node ./test-ts/test-no-types.js && node ./test-ts/test-with-types.js",
43
+ "testjest": "npx jest",
44
+ "testjest:cov": "npx jest --collectCoverage",
45
+ "testjest:debug": "npx --node-arg=--inspect-brk jest"
46
+ },
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/wentout/mnemonica.git"
50
+ },
51
+ "keywords": [
52
+ "ETL",
53
+ "DFD",
54
+ "inheritance",
55
+ "mnemonica"
56
+ ],
57
+ "author": "went.out@gmail.com",
58
+ "license": "MIT",
59
+ "bugs": {
60
+ "url": "https://github.com/wentout/mnemonica/issues"
61
+ },
62
+ "lint-staged": {
63
+ "*.js": "eslint --fix --ignore-path .gitignore"
64
+ },
65
+ "homepage": "https://github.com/wentout/mnemonica#readme",
66
+ "devDependencies": {
67
+ "@types/jest": "^27.0.1",
68
+ "@types/node": "^13.13.51",
69
+ "@typescript-eslint/eslint-plugin": "^2.33.0",
70
+ "@typescript-eslint/parser": "^2.33.0",
71
+ "chai": "^4.3.4",
72
+ "coveralls": "^3.1.0",
73
+ "eslint": "^6.8.0",
74
+ "eslint-config-prettier": "^6.12.0",
75
+ "eslint-plugin-import": "^2.22.1",
76
+ "eslint-plugin-mocha": "^5.2.0",
77
+ "eslint-plugin-no-arrow-this": "^1.2.0",
78
+ "eslint-plugin-prettier": "^3.4.0",
79
+ "husky": "^3.0.5",
80
+ "jest": "^27.0.6",
81
+ "lint-staged": "^9.2.5",
82
+ "mocha": "^7.2.0",
83
+ "mocha-lcov-reporter": "^1.3.0",
84
+ "nyc": "^14.1.1",
85
+ "ts-jest": "^27.0.5",
86
+ "tslint": "^6.1.3",
87
+ "typescript": "^4.2.4"
88
+ },
89
+ "engines": {
90
+ "node": ">=8.7"
91
+ },
92
+ "husky": {
93
+ "hooks": {
94
+ "pre-commit": "lint-staged"
95
+ }
96
+ }
94
97
  }