mnemonica 0.9.950 → 0.9.952

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.
@@ -67,7 +67,7 @@ const constructError = (name, message) => {
67
67
  };
68
68
  return ${name};
69
69
  `;
70
- const ErrorConstructor = (new Function('base', body))(BASE_MNEMONICA_ERROR);
71
- return ErrorConstructor;
70
+ const NamedErrorConstructor = (new Function('base', body))(BASE_MNEMONICA_ERROR);
71
+ return NamedErrorConstructor;
72
72
  };
73
73
  exports.constructError = constructError;
@@ -1,2 +1,2 @@
1
1
  export declare const flowCheckers: WeakMap<object, any>;
2
- export declare const registerFlowChecker: (this: any, cb: Function) => void;
2
+ export declare const registerFlowChecker: (this: any, cb: () => unknown) => void;
@@ -4,7 +4,7 @@ export declare const hooks: {
4
4
  [index: string]: any;
5
5
  }) => Set<unknown>;
6
6
  registerHook: (this: any, hookType: string, cb: CallableFunction) => void;
7
- registerFlowChecker: (this: any, cb: Function) => void;
7
+ registerFlowChecker: (this: any, cb: () => unknown) => void;
8
8
  };
9
9
  export declare const types: {
10
10
  define: any;
@@ -1,6 +1,6 @@
1
1
  import { ConstructorFunction } from '../../types';
2
2
  declare const _default: {
3
- Gaia: ConstructorFunction<{}>;
3
+ Gaia: ConstructorFunction<object>;
4
4
  Mnemosyne: ConstructorFunction<{
5
5
  [x: symbol]: (() => (this: any, uranus: any) => void) | (() => string);
6
6
  extract(): (this: any) => {
@@ -67,16 +67,16 @@ const MnemonicaProtoProps = {
67
67
  return MNEMONICA;
68
68
  },
69
69
  exception() {
70
- const me = this;
70
+ const self = this;
71
71
  return function (error, ...args) {
72
72
  const target = new.target;
73
- return exceptionConstructor_1.default.call(me, target, error, ...args);
73
+ return exceptionConstructor_1.default.call(self, target, error, ...args);
74
74
  };
75
75
  },
76
76
  sibling() {
77
- const me = this;
77
+ const self = this;
78
78
  const siblings = (SiblingTypeName) => {
79
- const { __collection__: collection, } = me;
79
+ const { __collection__: collection, } = self;
80
80
  const sibling = collection[SiblingTypeName];
81
81
  return sibling;
82
82
  };
@@ -27,4 +27,3 @@ function default_1() {
27
27
  return CreateInstanceModificator;
28
28
  }
29
29
  exports.default = default_1;
30
- ;
@@ -30,4 +30,3 @@ function default_1() {
30
30
  return CreateInstanceModificatorAncient200XthWay;
31
31
  }
32
32
  exports.default = default_1;
33
- ;
@@ -11,7 +11,7 @@ declare const TypesUtils: {
11
11
  getExistentAsyncStack: (existentInstance: any) => any[];
12
12
  checkTypeName: (name: string) => void;
13
13
  findParentSubType: any;
14
- makeFakeModificatorType: (TypeName: string, fakeModificator?: TypeModificator<{}>) => any;
14
+ makeFakeModificatorType: (TypeName: string, fakeModificator?: TypeModificator<object>) => any;
15
15
  reflectPrimitiveWrappers: (_thisArg: any) => any;
16
16
  };
17
17
  export default TypesUtils;
package/build/index.d.ts CHANGED
@@ -1,8 +1,20 @@
1
- import { TypeAbsorber, ITypeClass, TypeLookup, IDEF } from './types';
1
+ import { ITypeClass, 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, config?: object) => ITypeClass<T>;
4
+ type Proto<P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
5
+ interface IDefinitor<P, IN extends string> {
6
+ <T, M extends Proto<P, T>, S extends Record<IN, new () => unknown> & M>(this: unknown, TypeName: IN, constructHandler: IDEF<T>, proto?: P, config?: object): {
7
+ new (): {
8
+ [key in keyof S]: S[key];
9
+ };
10
+ define: IDefinitor<M, IN>;
11
+ };
12
+ }
13
+ export declare const define: <T, P extends object, N extends Proto<P, T>, ID extends string, S extends Record<ID, new () => unknown> & N>(this: unknown, TypeName: string, constructHandler: IDEF<T>, proto?: P | undefined, config?: {}) => {
14
+ new (): { [key in keyof S]: S[key]; };
15
+ define: IDefinitor<N, ID>;
16
+ };
17
+ export declare const tsdefine: <T>(this: unknown, TypeName: string, constructHandler: IDEF<T>, proto?: object, config?: object) => ITypeClass<T>;
6
18
  export declare const lookup: TypeLookup;
7
19
  export declare const mnemonica: {
8
20
  [index: string]: unknown;
package/build/index.js CHANGED
@@ -7,14 +7,13 @@ const errorsApi = require("./api/errors");
7
7
  const descriptors_1 = require("./descriptors");
8
8
  exports.defaultTypes = descriptors_1.descriptors.defaultTypes;
9
9
  function checkThis(pointer) {
10
- return pointer === exports.mnemonica ||
11
- pointer === exports;
10
+ return pointer === exports.mnemonica || pointer === exports;
12
11
  }
13
- ;
14
- exports.define = function (TypeName, constructHandler, proto, config) {
12
+ const define = function (TypeName, constructHandler, proto, config = {}) {
15
13
  const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
16
14
  return types.define(TypeName, constructHandler, proto, config);
17
15
  };
16
+ exports.define = define;
18
17
  const tsdefine = function (TypeName, constructHandler, proto, config) {
19
18
  return exports.defaultTypes.define(TypeName, constructHandler, proto, config);
20
19
  };
@@ -1,27 +1,27 @@
1
1
  export interface ConstructorFunction<ConstructorInstance extends object> {
2
- new (...args: any[]): ConstructorInstance;
3
- (this: ConstructorInstance, ...args: any[]): ConstructorInstance;
2
+ new (...args: unknown[]): ConstructorInstance;
3
+ (this: ConstructorInstance, ...args: unknown[]): ConstructorInstance;
4
4
  prototype: ConstructorInstance;
5
5
  }
6
- export type TypeModificator<T extends object> = (...args: any[]) => ConstructorFunction<T>;
7
- export type TypeLookup = (this: Map<string, any>, TypeNestedPath: string) => TypeClass;
6
+ export type TypeModificator<T extends object> = (...args: unknown[]) => ConstructorFunction<T>;
7
+ export type TypeLookup = (this: Map<string, unknown>, TypeNestedPath: string) => TypeClass;
8
8
  export type TypeClass = {
9
- new (...args: any[]): any;
9
+ new (...args: unknown[]): unknown;
10
10
  define: TypeAbsorber;
11
11
  lookup: TypeLookup;
12
- registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => any;
12
+ registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => unknown;
13
13
  };
14
- export type TypeAbsorber = (this: any, TypeName: string, constructHandler: CallableFunction, proto?: object, config?: object) => TypeClass;
14
+ export type TypeAbsorber = (this: unknown, TypeName: string, constructHandler: CallableFunction, proto?: object, config?: object) => TypeClass;
15
15
  export type IDEF<T> = {
16
- new (...args: any[]): T;
17
- (this: T, ...args: any[]): T;
18
- prototype?: ThisType<T>;
16
+ new (): T;
17
+ } | {
18
+ (this: T): void;
19
19
  };
20
- export type ITypeAbsorber<T> = (this: any, TypeName: string, constructHandler: IDEF<T>, proto?: object, config?: object) => ITypeClass<T>;
20
+ export type ITypeAbsorber<T> = (this: unknown, TypeName: string, constructHandler: IDEF<T>, proto?: object, config?: object) => ITypeClass<T>;
21
21
  export interface ITypeClass<T> {
22
- new (...args: any[]): T;
23
- (this: T, ...args: any[]): T;
22
+ new (...args: unknown[]): T;
23
+ (this: T, ...args: unknown[]): T;
24
24
  define: ITypeAbsorber<T>;
25
25
  lookup: TypeLookup;
26
- registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => any;
26
+ registerHook: (type: 'preCreation' | 'postCreation' | 'creationError', hook: CallableFunction) => unknown;
27
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnemonica",
3
- "version": "0.9.950",
3
+ "version": "0.9.952",
4
4
  "description": "abstract technique that aids information retention : instance inheritance system",
5
5
  "type": "commonjs",
6
6
  "main": "./build/index.js",
@@ -65,15 +65,13 @@
65
65
  "devDependencies": {
66
66
  "@types/jest": "^29.5.0",
67
67
  "@types/node": "^18.15.5",
68
- "@typescript-eslint/eslint-plugin": "^5.56.0",
69
- "@typescript-eslint/parser": "^5.56.0",
68
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
69
+ "@typescript-eslint/parser": "^5.59.5",
70
70
  "chai": "^4.3.7",
71
- "eslint": "^8.36.0",
72
- "eslint-config-prettier": "^8.8.0",
71
+ "eslint": "^8.40.0",
73
72
  "eslint-plugin-import": "^2.27.5",
74
73
  "eslint-plugin-mocha": "^10.1.0",
75
74
  "eslint-plugin-no-arrow-this": "^1.2.0",
76
- "eslint-plugin-prettier": "^4.2.1",
77
75
  "husky": "^8.0.3",
78
76
  "jest": "^29.5.0",
79
77
  "json5": "^2.2.3",
@@ -81,9 +79,9 @@
81
79
  "mocha": "^10.2.0",
82
80
  "mocha-lcov-reporter": "^1.3.0",
83
81
  "nyc": "^15.1.0",
84
- "prettier": "^2.8.6",
85
82
  "ts-jest": "^29.0.5",
86
- "typescript": "^5.0.2"
83
+ "typescript": "^5.0.2",
84
+ "yaml": "^2.2.2"
87
85
  },
88
86
  "engines": {
89
87
  "node": ">=14"