mnemonica 0.9.959 → 0.9.971

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 (2) hide show
  1. package/build/index.d.ts +12 -4
  2. package/package.json +1 -1
package/build/index.d.ts CHANGED
@@ -1,6 +1,16 @@
1
1
  import { TypeLookup, IDEF } from './types';
2
2
  export type { IDEF } from './types';
3
3
  export declare const defaultTypes: any;
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
+ };
4
14
  type Proto<P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
5
15
  type SN = Record<string, new () => unknown>;
6
16
  interface IDefinitorInstance<N extends object, S> {
@@ -8,14 +18,12 @@ interface IDefinitorInstance<N extends object, S> {
8
18
  [key in keyof S]: S[key];
9
19
  };
10
20
  define: IDefinitor<N, string>;
21
+ registerHook: (hookType: hooksTypes, cb: hook) => void;
11
22
  }
12
23
  interface IDefinitor<P extends object, SubTypeName extends string> {
13
24
  <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?: object): IDefinitorInstance<M, S>;
14
25
  }
15
- export declare const define: <T, P extends object, N extends Proto<P, T>, SubTypeName extends string, S extends SN & N, R extends {
16
- new (): { [key in keyof S]: S[key]; };
17
- define: IDefinitor<N, SubTypeName>;
18
- }>(this: unknown, TypeName?: string, constructHandler?: IDEF<T> | undefined, proto?: P | undefined, config?: {}) => R;
26
+ 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?: {}) => R;
19
27
  export declare const lookup: TypeLookup;
20
28
  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]; };
21
29
  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]; };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnemonica",
3
- "version": "0.9.959",
3
+ "version": "0.9.971",
4
4
  "description": "abstract technique that aids information retention : instance inheritance system",
5
5
  "type": "commonjs",
6
6
  "main": "./build/index.js",