mnemonica 1.4.8 → 1.5.0

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 (41) hide show
  1. package/FOR_HUMANS.md +95 -31
  2. package/README.md +10 -9
  3. package/SKILL.md +4 -4
  4. package/build/api/hooks/hookTypes.d.ts +2 -0
  5. package/build/api/hooks/hookTypes.js +25 -0
  6. package/build/api/hooks/index.d.ts +2 -1
  7. package/build/api/hooks/index.js +6 -2
  8. package/build/api/hooks/registerHook.d.ts +1 -1
  9. package/build/api/hooks/registerHook.js +4 -15
  10. package/build/api/hooks/unregisterHook.d.ts +2 -0
  11. package/build/api/hooks/unregisterHook.js +18 -0
  12. package/build/api/index.d.ts +4 -3
  13. package/build/api/index.js +2 -1
  14. package/build/api/types/compileNewModificatorFunctionBody.d.ts +4 -2
  15. package/build/api/types/compileNewModificatorFunctionBody.js +16 -7
  16. package/build/api/types/index.d.ts +2 -2
  17. package/build/api/types/index.js +21 -18
  18. package/build/api/utils/index.d.ts +1 -2
  19. package/build/api/utils/index.js +37 -13
  20. package/build/descriptors/types/index.js +19 -12
  21. package/build/index.d.ts +25 -17
  22. package/build/index.js +35 -50
  23. package/build/types/index.d.ts +242 -225
  24. package/build/types/index.js +1 -1
  25. package/docs/UTILS.md +4 -5
  26. package/docs/async-constructors.md +32 -13
  27. package/docs/hott-correspondence.md +1 -1
  28. package/docs/typed-lookup.md +31 -37
  29. package/module/index.js +2 -0
  30. package/package.json +2 -2
  31. package/src/api/hooks/hookTypes.ts +37 -0
  32. package/src/api/hooks/index.ts +8 -1
  33. package/src/api/hooks/registerHook.ts +6 -19
  34. package/src/api/hooks/unregisterHook.ts +36 -0
  35. package/src/api/index.ts +2 -0
  36. package/src/api/types/compileNewModificatorFunctionBody.ts +79 -18
  37. package/src/api/types/index.ts +64 -54
  38. package/src/api/utils/index.ts +5 -51
  39. package/src/descriptors/types/index.ts +31 -22
  40. package/src/index.ts +271 -161
  41. package/src/types/index.ts +812 -590
@@ -1,12 +1,16 @@
1
1
  import type { TypeRegistry } from '../index';
2
2
  import type { constants } from '../constants';
3
- export type PropsType = Record<string, unknown>;
4
3
  export type IDEF<T, Args extends unknown[] = unknown[]> = {
5
4
  new (...args: Args): T;
6
5
  } | {
7
6
  (this: T, ...args: Args): void;
8
7
  };
9
- export type CtorParameter<T, Args extends unknown[] = never[]> = IDEF<T, Args> | {
8
+ export type AsyncIDEF<T, Args extends unknown[] = unknown[]> = {
9
+ (this: T, ...args: Args): PromiseLike<unknown>;
10
+ } | {
11
+ new (...args: Args): PromiseLike<T>;
12
+ };
13
+ export type CtorParameter<T, Args extends unknown[] = never[]> = {
10
14
  new (...args: Args): T;
11
15
  };
12
16
  export type LazyDef<T, Args extends unknown[] = unknown[]> = () => IDEF<T, Args>;
@@ -19,34 +23,12 @@ export interface DefineNewable extends NewableFunction {
19
23
  export type DefineNewableOrCallable = DefineNewable | DefineCallable;
20
24
  export interface InstanceConstructor extends NewableFunction {
21
25
  }
22
- export interface AnyHookCallback extends CallableFunction {
23
- (...args: never[]): unknown;
24
- }
25
- export interface UtilFunction extends CallableFunction {
26
- (...args: never[]): unknown;
27
- }
28
- export interface LookupSource {
29
- lookup(path: string): TypeClass | undefined;
30
- }
31
- export interface ThrowModificationError extends CallableFunction {
32
- (error: Error): void;
33
- }
34
- export interface ForkInvoker<T extends object> extends CallableFunction {
35
- (this: object | void, ...forkArgs: unknown[]): T;
36
- }
37
26
  export type ErrorMessageKey = 'BASE_ERROR_MESSAGE' | 'HANDLER_MUST_BE_A_FUNCTION' | 'WRONG_TYPE_DEFINITION' | 'WRONG_INSTANCE_INVOCATION' | 'WRONG_MODIFICATION_PATTERN' | 'ALREADY_DECLARED' | 'WRONG_ARGUMENTS_USED' | 'WRONG_HOOK_TYPE' | 'MISSING_HOOK_CALLBACK' | 'MISSING_CALLBACK_ARGUMENT' | 'OPTIONS_ERROR' | 'WRONG_STACK_CLEANER' | 'TYPENAME_MUST_BE_A_STRING';
38
27
  export type ErrorMessages = Record<ErrorMessageKey, string>;
39
- export interface hook extends CallableFunction {
40
- (opts: deliveredHookOpts): unknown;
41
- }
42
- export interface FlowChecker extends CallableFunction {
43
- (opts: object): unknown;
44
- }
45
28
  export interface MnemonicaErrorConstructor extends NewableFunction {
46
29
  new (addition?: string, stack?: string[]): MnemonicaError;
47
30
  readonly prototype: MnemonicaError;
48
31
  }
49
- export type ErrorsTypesMap = Record<string, MnemonicaErrorConstructor>;
50
32
  export type MnemonicaError = Error;
51
33
  export interface ErrorProps {
52
34
  args?: unknown[];
@@ -70,20 +52,24 @@ export interface TypeConstructorBase {
70
52
  new (...args: unknown[]): object;
71
53
  }
72
54
  export type AnyConstructor = new (...args: never[]) => unknown;
73
- export type InstanceOfTypeRegistry<K extends keyof TypeRegistry> = TypeRegistry[K] extends new (...args: never[]) => infer R ? R : never;
74
- export type LiteralKeysOf<T> = keyof T extends infer K ? K extends string ? string extends K ? never : K : never : never;
75
- export type ParentPath<K extends string> = K extends `${infer P}.${string}` ? P : never;
76
- export type AllParentPrefixes<K extends string> = K extends `${infer P}.${string}` ? P | AllParentPrefixes<P> : never;
77
- export type ChildKeysOf<P extends string> = {
78
- [K in keyof TypeRegistry]: K extends `${P}.${string}` ? K : never;
79
- }[keyof TypeRegistry];
80
- export type PathOfInstance<T extends object> = {
81
- [K in LiteralKeysOf<TypeRegistry>]: TypeRegistry[K] extends new (...args: never[]) => infer R ? T extends R ? K : never : never;
82
- }[LiteralKeysOf<TypeRegistry>];
83
- export type ParentPathOfInstance<T extends object> = {
84
- [K in LiteralKeysOf<TypeRegistry>]: TypeRegistry[K] extends new (...args: never[]) => infer R ? T extends R ? AllParentPrefixes<K> : never : never;
85
- }[LiteralKeysOf<TypeRegistry>];
55
+ export type Constructor<T = object> = new (...args: never[]) => T;
56
+ export type ConstructorName<T extends Constructor<object>> = T extends {
57
+ name: infer N;
58
+ } ? N extends string ? N : string : string;
59
+ export interface AnyHookCallback extends CallableFunction {
60
+ (...args: never[]): unknown;
61
+ }
62
+ export interface ThrowModificationError extends CallableFunction {
63
+ (error: Error): void;
64
+ }
65
+ export interface hook extends CallableFunction {
66
+ (opts: deliveredHookOpts): unknown;
67
+ }
68
+ export interface FlowChecker extends CallableFunction {
69
+ (opts: object): unknown;
70
+ }
86
71
  export type hooksTypes = 'preCreation' | 'postCreation' | 'creationError';
72
+ export type hookName = hooksTypes | 'pre' | 'post' | 'error';
87
73
  export type hooksOpts<P = object, T = P> = {
88
74
  TypeName: string;
89
75
  type: TypeDef;
@@ -102,7 +88,7 @@ export type deliveredHookOpts<P = object, T = P> = {
102
88
  inheritedInstance?: T;
103
89
  throwModificationError?: ThrowModificationError;
104
90
  };
105
- export type typedHookOpts<HT extends hooksTypes, P extends object, T extends object> = HT extends 'preCreation' ? {
91
+ export type typedHookOpts<HT extends hookName, P extends object, T extends object> = HT extends 'preCreation' | 'pre' ? {
106
92
  TypeName: string;
107
93
  type: TypeDef;
108
94
  args: unknown[];
@@ -115,12 +101,23 @@ export type typedHookOpts<HT extends hooksTypes, P extends object, T extends obj
115
101
  inheritedInstance: T;
116
102
  throwModificationError: ThrowModificationError;
117
103
  };
118
- export interface typedHook<HT extends hooksTypes, P extends object = object, T extends object = object> extends CallableFunction {
104
+ export interface typedHook<HT extends hookName, P extends object = object, T extends object = object> extends CallableFunction {
119
105
  (opts: typedHookOpts<HT, P, T>): unknown;
120
106
  }
121
- export type HookableConstructor<T extends object> = Constructor<T> & {
122
- registerHook(hookType: hooksTypes, cb: AnyHookCallback): void;
107
+ export interface HookMethods<P extends object = object, T extends object = object> {
108
+ registerHook<HT extends hookName>(hookType: HT, cb: typedHook<HT, P, T>): void;
109
+ unregisterHook(hookType: hookName, cb: AnyHookCallback): boolean;
110
+ on<HT extends hookName>(hookType: HT, cb: typedHook<HT, P, T>): void;
111
+ off(hookType: hookName, cb: AnyHookCallback): boolean;
112
+ }
113
+ export type HookableConstructor<T extends object> = Constructor<T | PromiseLike<T>> & {
114
+ registerHook(hookType: hookName, cb: AnyHookCallback): void;
123
115
  };
116
+ export interface Hookable extends HookMethods {
117
+ hooks: Record<string, Set<hook>>;
118
+ invokeHook(hookType: hooksTypes, opts: hooksOpts): Set<unknown>;
119
+ registerFlowChecker(cb: FlowChecker): void;
120
+ }
124
121
  export interface AddPropsCallback extends CallableFunction {
125
122
  (proto: object): void;
126
123
  }
@@ -143,7 +140,11 @@ export type constructorOptions = {
143
140
  blockErrors?: boolean;
144
141
  submitStack?: boolean;
145
142
  unchain?: boolean;
146
- asClass?: boolean;
143
+ };
144
+ export type DefineConfig = constructorOptions | boolean | ModificationConstructorFactory;
145
+ export type NoHandlerConfig = constructorOptions | boolean;
146
+ export type TypeConfig = constructorOptions & {
147
+ asClass: boolean;
147
148
  };
148
149
  export type SubtypesMap = Map<string, TypeClass>;
149
150
  export type TypeDef = {
@@ -152,7 +153,7 @@ export type TypeDef = {
152
153
  isSubType: boolean;
153
154
  subtypes: SubtypesMap;
154
155
  collection: CollectionDef;
155
- config: constructorOptions;
156
+ config: TypeConfig;
156
157
  parentType?: TypeDef;
157
158
  constructHandler: MnemonicaConstructorFactory;
158
159
  title: string;
@@ -177,6 +178,84 @@ export type CollectionDef = Hookable & {
177
178
  } & {
178
179
  [K in typeof constants.SymbolConfig]: CollectionConfig;
179
180
  };
181
+ export interface ThenSpec {
182
+ subtype: object;
183
+ args: unknown[];
184
+ name?: string;
185
+ }
186
+ export interface InstanceCreatorContext {
187
+ type: TypeDef;
188
+ TypeName: string;
189
+ existentInstance: object;
190
+ args: unknown[];
191
+ ModificationConstructor: ModificationConstructor;
192
+ ModificatorType: MnemonicaConstructor;
193
+ InstanceModificator: MnemonicaConstructor;
194
+ inheritedInstance: object | Promise<object>;
195
+ config: TypeConfig;
196
+ proto: object;
197
+ __proto_proto__?: object;
198
+ stack?: string[];
199
+ lazyFailed?: boolean;
200
+ lazyError?: unknown;
201
+ postHooksFired?: boolean;
202
+ getExistentAsyncStack(existentInstance: object): unknown;
203
+ postProcessing(continuationOf?: TypeDef): void;
204
+ makeAwaiter(type: TypeDef, then?: ThenSpec): Promise<object>;
205
+ addThen(then: ThenSpec): void;
206
+ invokePreHooks(): void;
207
+ invokePostHooks(): {
208
+ type: Set<unknown>;
209
+ collection: Set<unknown>;
210
+ };
211
+ throwModificationError(error: MnemonicaError): void;
212
+ }
213
+ export type InstanceInternalProps = {
214
+ __proto_proto__: object;
215
+ __args__: unknown[];
216
+ __collection__: CollectionDef;
217
+ __subtypes__: Map<string, object>;
218
+ __type__: TypeDef;
219
+ __parent__: object;
220
+ __stack__?: string;
221
+ __creator__: InstanceCreatorContext;
222
+ __timestamp__: number;
223
+ };
224
+ export type Props = InstanceInternalProps & {
225
+ __self__: InstanceInternalProps;
226
+ [key: string]: unknown;
227
+ };
228
+ export interface MnemonicaConstructor extends NewableFunction {
229
+ new (...args: unknown[]): object;
230
+ [key: symbol]: unknown;
231
+ }
232
+ export interface TypeDescriptorDefine extends CallableFunction {
233
+ (TypeOrTypeName: string | DefineNewableOrCallable, constructHandlerOrConfig?: DefineNewableOrCallable | object | boolean, config?: object | boolean): TypeClass;
234
+ }
235
+ export interface TypeDescriptorLazy extends CallableFunction {
236
+ (TypeName: string, getter: LazyDef<object>, config?: object | boolean): TypeClass;
237
+ }
238
+ export interface TypeDescriptorLookup extends CallableFunction {
239
+ (TypeNestedPath: string): TypeClass | undefined;
240
+ }
241
+ export type TypeDescriptorInstance = {
242
+ define: TypeDescriptorDefine;
243
+ lazy: TypeDescriptorLazy;
244
+ decorate: (config?: DefineConfig) => <U extends Constructor<object>>(cstr: U) => DecoratedClass<U>;
245
+ lookup: TypeDescriptorLookup;
246
+ subtypes: Map<string, object>;
247
+ TypeName: string;
248
+ collection: CollectionDef;
249
+ };
250
+ export interface LookupSource {
251
+ lookup(path: string): TypeClass | undefined;
252
+ }
253
+ export type InstanceOfTypeRegistry<K extends keyof TypeRegistry> = TypeRegistry[K] extends new (...args: never[]) => infer R ? R : never;
254
+ export type LiteralKeysOf<T> = keyof T extends infer K ? K extends string ? string extends K ? never : K : never : never;
255
+ export type AllParentPrefixes<K extends string> = K extends `${infer P}.${string}` ? P | AllParentPrefixes<P> : never;
256
+ export type ParentPathOfInstance<T extends object> = {
257
+ [K in LiteralKeysOf<TypeRegistry>]: TypeRegistry[K] extends new (...args: never[]) => infer R ? T extends R ? AllParentPrefixes<K> : never : never;
258
+ }[LiteralKeysOf<TypeRegistry>];
180
259
  export type GlobalRegistry = TypeRegistry & Record<string, TypeConstructorBase>;
181
260
  export type ExtractConstructorInstance<C> = C extends {
182
261
  new (...args: never[]): infer I;
@@ -194,13 +273,14 @@ export type ReplaceConstructorInstance<C, NewInstance extends object, CallConstr
194
273
  readonly prototype: NewInstance & {
195
274
  readonly constructor: ReplaceConstructorInstance<C, NewInstance, CallConstructs>;
196
275
  };
197
- } & (C extends {
198
- (...args: infer A2): unknown;
276
+ } & ReplacedCallSignature<C, NewInstance, CallConstructs> & Omit<C, 'prototype' | 'lookup'> : never;
277
+ export type ReplacedCallSignature<C, NewInstance extends object, CallConstructs extends boolean> = C extends {
278
+ (...args: infer A): unknown;
199
279
  } ? CallConstructs extends true ? {
200
- (...args: A2): ConstructResult<C, NewInstance>;
280
+ (...args: A): ConstructResult<C, NewInstance>;
201
281
  } : {
202
- (this: NewInstance, ...args: A2): ConstructResult<C, NewInstance>;
203
- } : unknown) & Omit<C, 'prototype' | 'lookup'> : never;
282
+ (this: NewInstance, ...args: A): ConstructResult<C, NewInstance>;
283
+ } : unknown;
204
284
  export type WithSubTypes<Instance extends object, Registry extends object, Path extends string> = Instance & SubTypeConstructors<Registry, Path>;
205
285
  export type AugmentedConstructor<Registry extends object, Path extends keyof Registry & string, CallConstructs extends boolean = false> = ReplaceConstructorInstance<Registry[Path], LookedUpInstance<Registry, Path>, CallConstructs>;
206
286
  export type LookedUpInstance<Registry extends object, Path extends string> = WithSubTypes<ExtractConstructorInstance<Registry[Path & keyof Registry]>, Registry, Path>;
@@ -215,13 +295,9 @@ export type WithHookRegister<C> = C extends {
215
295
  registerHook: AnyHookCallback;
216
296
  } ? C : C extends {
217
297
  new (...args: never[]): infer R;
218
- } ? R extends object ? C & {
219
- registerHook<HT extends hooksTypes>(hookType: HT, cb: typedHook<HT, object, R>): void;
220
- } : C : C extends {
298
+ } ? Awaited<R> extends infer A extends object ? C & HookMethods<object, A> : C : C extends {
221
299
  (...args: never[]): infer R;
222
- } ? R extends object ? C & {
223
- registerHook<HT extends hooksTypes>(hookType: HT, cb: typedHook<HT, object, R>): void;
224
- } : C : C;
300
+ } ? R extends object ? C & HookMethods<object, R> : C : C;
225
301
  export type FreeLookupResult<K extends keyof TypeRegistry> = TypeRegistry[K] extends {
226
302
  define: unknown;
227
303
  } ? LookedUpConstructor<TypeRegistry, K & string> : WithHookRegister<TypeRegistry[K]>;
@@ -230,9 +306,8 @@ export interface TypeLookup<T extends object = GlobalRegistry> extends CallableF
230
306
  <const K extends keyof T & string>(this: unknown, TypeNestedPath: K): LookedUpConstructor<T, K>;
231
307
  (this: unknown, TypeNestedPath: string): TypeClass | undefined;
232
308
  }
233
- export type RegistryOf<T> = T extends IDefinitorInstance<object, InstanceResult<object>, infer Registry, string, object, never[]> ? Registry : T extends TypesCollection<infer Registry, object, string> ? Registry : T extends MnemonicaModule<infer Registry> ? Registry : never;
309
+ export type RegistryOf<T> = T extends IDefinitorInstance<object, InstanceResult<object>, infer Registry, string, object, never[], object> ? Registry : T extends TypesCollection<infer Registry, object, string> ? Registry : T extends MnemonicaModule<infer Registry> ? Registry : never;
234
310
  export type RelativeKeys<Registry extends object, Path extends string> = Path extends '' ? keyof Registry & string : (keyof Registry extends infer K ? K extends `${Path}.${infer Child}` ? Child : never : never);
235
- export type FullKey<Registry extends object, Path extends string, K extends string> = Path extends '' ? K : Extract<keyof Registry & string, `${Path}.${K}`>;
236
311
  export type NestedTypeLookup<Registry extends object, Path extends string = ''> = (Path extends '' ? {
237
312
  <const K extends keyof Registry & string>(this: unknown, TypeNestedPath: K): LookedUpConstructor<Registry, K>;
238
313
  } : {
@@ -240,37 +315,74 @@ export type NestedTypeLookup<Registry extends object, Path extends string = ''>
240
315
  }) & {
241
316
  (this: unknown, TypeNestedPath: string): TypeClass | undefined;
242
317
  };
243
- export interface ThenSpec {
244
- subtype: object;
245
- args: unknown[];
246
- name?: string;
318
+ export interface RegistryEntry<F extends object, Path extends string = '', Parent extends object = object, Args extends unknown[] = unknown[]> extends _Internal_TC_<F, Args>, RegistryHolderBase<{}, F, Path>, HookMethods<Parent, F> {
247
319
  }
248
- export interface InstanceCreatorContext {
249
- type: TypeDef;
250
- TypeName: string;
251
- existentInstance: object;
252
- args: unknown[];
253
- ModificationConstructor: ModificationConstructor;
254
- ModificatorType: MnemonicaConstructor;
255
- InstanceModificator: MnemonicaConstructor;
256
- inheritedInstance: object | Promise<object>;
257
- config: constructorOptions;
258
- proto: object;
259
- __proto_proto__?: object;
260
- stack?: string[];
261
- lazyFailed?: boolean;
262
- lazyError?: unknown;
263
- postHooksFired?: boolean;
264
- getExistentAsyncStack(existentInstance: object): unknown;
265
- postProcessing(continuationOf?: TypeDef): void;
266
- makeAwaiter(type: TypeDef, then?: ThenSpec): Promise<object>;
267
- addThen(then: ThenSpec): void;
268
- invokePreHooks(): void;
269
- invokePostHooks(): {
270
- type: Set<unknown>;
271
- collection: Set<unknown>;
320
+ export interface AsyncRegistryEntry<F extends object, Path extends string = '', Parent extends object = object, Args extends unknown[] = unknown[]> extends RegistryHolderBase<{}, F, Path>, HookMethods<Parent, F> {
321
+ new (...args: Args): Promise<F>;
322
+ (this: F, ...args: Args): Promise<F>;
323
+ readonly prototype: F & {
324
+ readonly constructor: AsyncRegistryEntry<F, Path, Parent, Args>;
272
325
  };
273
- throwModificationError(error: MnemonicaError): void;
326
+ }
327
+ export type ChildPathOf<Path extends string, Name extends string> = Path extends '' ? Name : `${Path}.${Name}`;
328
+ export interface RegistryHolderBase<T extends object = {}, Parent extends object = object, Path extends string = ''> {
329
+ define<N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>>(this: RegistryHolderBase<T, Parent, Path>, constructHandler: (this: N, ...args: Args) => never, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T, never, Parent, Args>;
330
+ define<N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>>(this: RegistryHolderBase<T, Parent, Path>, constructHandler: AsyncIDEF<N, Args>, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T, never, Parent, Args, Promise<InstanceResult<F>>>;
331
+ define<N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>>(this: RegistryHolderBase<T, Parent, Path>, constructHandler: IDEF<N, Args>, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T, never, Parent, Args>;
332
+ define<N extends object, F extends Proto<Parent, N> = Proto<Parent, N>>(this: RegistryHolderBase<T, Parent, Path>, constructHandler: DefineNewableOrCallable, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T, never, Parent>;
333
+ define<const Name extends string, N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, constructHandler: (this: N, ...args: Args) => never, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
334
+ define<const Name extends string, N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, constructHandler: AsyncIDEF<N, Args>, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, AsyncRegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args, Promise<InstanceResult<F>>>;
335
+ define<const Name extends string, N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, constructHandler: IDEF<N, Args> | undefined, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
336
+ define<const Name extends string, N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, config?: NoHandlerConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
337
+ lazy<const Name extends string, N extends object, Args extends unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, getter: () => (this: N, ...args: Args) => never, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
338
+ lazy<const Name extends string, N extends object, Args extends unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, getter: () => AsyncIDEF<N, Args>, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, AsyncRegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args, Promise<InstanceResult<F>>>;
339
+ lazy<const Name extends string, N extends object, Args extends unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = ChildPathOf<Path, Name>>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, getter: LazyDef<N, Args>, config?: DefineConfig): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
340
+ }
341
+ export interface RegistryHolder<T extends object = {}, Parent extends object = object, Path extends string = ''> extends RegistryHolderBase<T, Parent, Path> {
342
+ lookup: NestedTypeLookup<T, Path>;
343
+ }
344
+ export interface IDefinitorInstance<N extends object, R extends InstanceResult<N> = InstanceResult<N>, Registry extends object = GlobalRegistry, Path extends string = '', Parent extends object = object, Args extends unknown[] = unknown[], New extends object = R> extends RegistryHolderBase<Registry, N, Path>, HookMethods<Parent, N> {
345
+ TypeName: string;
346
+ prototype: N;
347
+ new (...args: Args): New;
348
+ (...args: unknown[]): IDefinitorInstance<R>;
349
+ lookup: TypeLookup<Registry>;
350
+ decorate: (config?: DefineConfig) => <U extends Constructor<object>>(cstr: U) => DecoratedClass<U, Registry>;
351
+ subtypes: SubtypesMap;
352
+ __type__?: TypeDef;
353
+ collection?: CollectionDef;
354
+ }
355
+ export interface TypeAbsorber extends CallableFunction {
356
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeName: string, constructHandler: (this: T, ...args: Args) => never, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
357
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeName: string, constructHandler: AsyncIDEF<T, Args>, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args, Promise<InstanceResult<T>>>;
358
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeName: string, constructHandler: IDEF<T, Args> | undefined, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
359
+ <T extends object>(this: unknown, TypeName: string, constructHandler: DefineNewableOrCallable, config?: DefineConfig): IDefinitorInstance<T>;
360
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeName: string, config?: NoHandlerConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
361
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, constructHandler: (this: T, ...args: Args) => never, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
362
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, constructHandler: AsyncIDEF<T, Args>, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args, Promise<InstanceResult<T>>>;
363
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, constructHandler: IDEF<T, Args>, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
364
+ <T extends object>(this: unknown, constructHandler: DefineNewableOrCallable, config?: DefineConfig): IDefinitorInstance<T>;
365
+ }
366
+ export interface LazyAbsorber extends CallableFunction {
367
+ <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeName: string, getter: LazyDef<T, Args>, config?: DefineConfig): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
368
+ }
369
+ export interface TypesCollection<T extends object = {}, Parent extends object = object, Path extends string = ''> extends RegistryHolder<T, Parent, Path>, Hookable {
370
+ subtypes: SubtypesMap;
371
+ decorate(config?: DefineConfig): <U extends Constructor<object>>(cstr: U) => DecoratedClass<U, T & Record<ConstructorName<U>, RegistryEntry<InstanceType<U>, ConstructorName<U>>>>;
372
+ [key: string]: unknown;
373
+ }
374
+ export type CreateTypesCollectionFunction = <T extends object = {}, Parent extends object = object>(config?: constructorOptions) => TypesCollection<T, Parent>;
375
+ export type TypeClass = IDefinitorInstance<object>;
376
+ export type DecoratedClass<T extends Constructor<object>, Registry extends object = TypeRegistry> = T & Omit<IDefinitorInstance<InstanceType<T>, InstanceType<T>, Registry, ConstructorName<T>>, 'define' | 'lookup'> & (<U extends Constructor<object>>(target: U) => DecoratedClass<U, Registry>) & {
377
+ define: TypeAbsorber;
378
+ lookup: TypeLookup<Registry>;
379
+ };
380
+ export type PropsType = Record<string, unknown>;
381
+ export interface UtilFunction extends CallableFunction {
382
+ (...args: never[]): unknown;
383
+ }
384
+ export interface ForkInvoker<T extends object> extends CallableFunction {
385
+ (this: object | void, ...forkArgs: unknown[]): T;
274
386
  }
275
387
  export type Proto<P extends object, T extends object> = [
276
388
  Exclude<keyof P, keyof T>
@@ -281,9 +393,6 @@ export type ProtoFlat<P extends object, T extends object, L extends Exclude<keyo
281
393
  [key in L]: P[key];
282
394
  };
283
395
  export type MnemonicaInstanceMethodKeys = 'extract' | 'pick' | 'parent' | 'clone' | 'fork' | 'exception' | 'sibling';
284
- export type Flatten<F> = {
285
- [key in keyof F]: F[key];
286
- };
287
396
  export type Extracted<T extends object> = {
288
397
  [K in keyof T as K extends string ? (K extends MnemonicaInstanceMethodKeys ? never : K) : never]: T[K];
289
398
  } & {};
@@ -303,40 +412,6 @@ export interface EmptyParsed {
303
412
  joint: {};
304
413
  parent: undefined;
305
414
  }
306
- export type LineageValue = null | boolean | string | number | LineageValue[] | {
307
- $ref: string;
308
- } | {
309
- '$mnemonica': 'unsupported';
310
- kind: string;
311
- } | {
312
- [key: string]: LineageValue;
313
- };
314
- export interface LineageTypeRef {
315
- collection: string;
316
- path: string;
317
- }
318
- export interface LineageNode {
319
- type: LineageTypeRef;
320
- own: {
321
- [key: string]: LineageValue;
322
- };
323
- parent: string | null;
324
- args?: LineageValue;
325
- props?: {
326
- [key: string]: LineageValue;
327
- };
328
- }
329
- export interface LineageGraph {
330
- version: '1';
331
- heads: string[];
332
- nodes: {
333
- [id: string]: LineageNode;
334
- };
335
- }
336
- export interface LineageOptions {
337
- args?: boolean;
338
- props?: string[];
339
- }
340
415
  export interface SiblingAccessor {
341
416
  (SiblingTypeName: string): TypeClass | undefined;
342
417
  [key: string]: TypeClass | undefined;
@@ -355,119 +430,23 @@ export interface MnemonicaInstance<T extends object = object> {
355
430
  exception(error: Error, ...args: unknown[]): Error;
356
431
  readonly sibling: SiblingAccessor;
357
432
  }
358
- export type InstanceInternalProps = {
359
- __proto_proto__: object;
360
- __args__: unknown[];
361
- __collection__: CollectionDef;
362
- __subtypes__: Map<string, object>;
363
- __type__: TypeDef;
364
- __parent__: object;
365
- __stack__?: string;
366
- __creator__: InstanceCreatorContext;
367
- __timestamp__: number;
368
- };
369
- export type Props = InstanceInternalProps & {
370
- __self__: InstanceInternalProps;
371
- [key: string]: unknown;
372
- };
373
433
  export type InstanceResult<N extends object> = {
374
434
  [K in keyof N]: N[K];
375
435
  };
376
- export interface RegistryEntry<F extends object, Path extends string = '', Parent extends object = object, Args extends unknown[] = unknown[]> extends _Internal_TC_<F, Args>, RegistryHolderBase<{}, F, Path> {
377
- registerHook<HT extends hooksTypes>(hookType: HT, cb: typedHook<HT, Parent, F>): void;
378
- }
379
- export interface AsyncRegistryEntry<F extends object, Path extends string = '', Parent extends object = object, Args extends unknown[] = unknown[]> extends RegistryHolderBase<{}, F, Path> {
380
- new (...args: Args): Promise<F>;
381
- (this: F, ...args: Args): Promise<F>;
382
- readonly prototype: F & {
383
- readonly constructor: AsyncRegistryEntry<F, Path, Parent, Args>;
384
- };
385
- registerHook<HT extends hooksTypes>(hookType: HT, cb: typedHook<HT, Parent, F>): void;
386
- }
387
- export interface RegistryHolderBase<T extends object = {}, Parent extends object = object, Path extends string = ''> {
388
- define<SubType extends object>(this: RegistryHolderBase<T, Parent, Path>, TypeOrTypeName: DefineNewableOrCallable, constructHandlerOrConfig?: IDEF<SubType> | object | boolean | DefineNewableOrCallable, configOrUndefined?: constructorOptions | DefineNewableOrCallable | boolean): IDefinitorInstance<SubType>;
389
- define<const Name extends string, N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = Path extends '' ? Name : `${Path}.${Name}`>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, constructHandler: (this: N, ...args: Args) => PromiseLike<unknown>, config?: constructorOptions): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, AsyncRegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
390
- define<const Name extends string, N extends object, Args extends unknown[] = unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = Path extends '' ? Name : `${Path}.${Name}`>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, constructHandler?: IDEF<N, Args>, config?: constructorOptions): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
391
- lazy<const Name extends string, N extends object, Args extends unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = Path extends '' ? Name : `${Path}.${Name}`>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, getter: () => (this: N, ...args: Args) => PromiseLike<unknown>, config?: constructorOptions): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, AsyncRegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
392
- lazy<const Name extends string, N extends object, Args extends unknown[], F extends Proto<Parent, N> = Proto<Parent, N>, ChildPath extends string = Path extends '' ? Name : `${Path}.${Name}`>(this: RegistryHolderBase<T, Parent, Path>, TypeName: Name, getter: LazyDef<N, Args>, config?: constructorOptions): IDefinitorInstance<F, InstanceResult<F>, T & Record<ChildPath, RegistryEntry<F, ChildPath, Parent, Args>>, ChildPath, Parent, Args>;
393
- }
394
- export interface RegistryHolder<T extends object = {}, Parent extends object = object, Path extends string = ''> extends RegistryHolderBase<T, Parent, Path> {
395
- lookup: NestedTypeLookup<T, Path>;
396
- }
397
- export interface IDefinitorInstance<N extends object, R extends InstanceResult<N> = InstanceResult<N>, Registry extends object = GlobalRegistry, Path extends string = '', Parent extends object = object, Args extends unknown[] = unknown[]> extends RegistryHolderBase<Registry, N, Path> {
398
- TypeName: string;
399
- prototype: N;
400
- new (...args: Args): R;
401
- (...args: unknown[]): IDefinitorInstance<R>;
402
- lookup: TypeLookup<Registry>;
403
- decorate: (config?: constructorOptions) => <U extends Constructor<object>>(cstr: U) => DecoratedClass<U, Registry>;
404
- registerHook<HT extends hooksTypes>(hookType: HT, cb: typedHook<HT, Parent, N>): void;
405
- subtypes: SubtypesMap;
406
- __type__?: TypeDef;
407
- collection?: CollectionDef;
408
- }
409
- export interface TypeAbsorber extends CallableFunction {
410
- <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeOrTypeName: string | DefineNewableOrCallable, constructHandlerOrConfig?: IDEF<T, Args> | object | boolean | DefineNewableOrCallable, configOrUndefined?: constructorOptions | DefineNewableOrCallable | boolean): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
411
- }
412
- export interface LazyAbsorber extends CallableFunction {
413
- <T extends object, Args extends unknown[] = unknown[]>(this: unknown, TypeName: string, getter: LazyDef<T, Args>, config?: constructorOptions): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
414
- <T extends object, Args extends unknown[] = unknown[]>(this: unknown, source: RegistryHolderBase<object, object, string>, TypeName: string, getter: LazyDef<T, Args>, config?: constructorOptions): IDefinitorInstance<T, InstanceResult<T>, GlobalRegistry, '', object, Args>;
415
- }
416
- export interface TypesCollection<T extends object = {}, Parent extends object = object, Path extends string = ''> extends RegistryHolder<T, Parent, Path>, Hookable {
417
- subtypes: SubtypesMap;
418
- decorate(config?: constructorOptions): <U extends Constructor<object>>(cstr: U) => DecoratedClass<U, T & Record<ConstructorName<U>, RegistryEntry<InstanceType<U>, ConstructorName<U>>>>;
419
- [key: string]: unknown;
420
- }
421
- export interface Hookable {
422
- hooks: Record<string, Set<hook>>;
423
- invokeHook(hookType: hooksTypes, opts: hooksOpts): Set<unknown>;
424
- registerHook<HT extends hooksTypes>(hookType: HT, cb: typedHook<HT>): void;
425
- registerFlowChecker(cb: FlowChecker): void;
426
- }
427
- export type CreateTypesCollectionFunction = <T extends object = {}, Parent extends object = object>(config?: constructorOptions) => TypesCollection<T, Parent>;
428
- export type TypeClass = IDefinitorInstance<object>;
429
- export type TypeRegistryMap = Record<string, TypeConstructorBase>;
430
- export interface MnemonicaConstructor extends NewableFunction {
431
- new (...args: unknown[]): object;
432
- (this: object, ...args: unknown[]): unknown;
433
- [key: symbol]: unknown;
434
- }
435
- export interface TypeDescriptorDefine extends CallableFunction {
436
- (TypeOrTypeName: string | DefineNewableOrCallable, constructHandlerOrConfig?: DefineNewableOrCallable | object, config?: object): TypeClass;
437
- }
438
- export interface TypeDescriptorLazy extends CallableFunction {
439
- (TypeName: string, getter: LazyDef<object>, config?: object): TypeClass;
440
- }
441
- export interface TypeDescriptorLookup extends CallableFunction {
442
- (TypeNestedPath: string): TypeClass | undefined;
443
- }
444
- export type TypeDescriptorInstance = {
445
- define: TypeDescriptorDefine;
446
- lazy: TypeDescriptorLazy;
447
- decorate: (config?: constructorOptions) => <U extends Constructor<object>>(cstr: U) => DecoratedClass<U>;
448
- lookup: TypeDescriptorLookup;
449
- subtypes: Map<string, object>;
450
- TypeName: string;
451
- collection: CollectionDef;
452
- };
453
- export type Constructor<T = object> = new (...args: never[]) => T;
454
- export type ConstructorName<T extends Constructor<object>> = T extends {
455
- name: infer N;
456
- } ? N extends string ? N : string : string;
457
- export type DecoratedClass<T extends Constructor<object>, Registry extends object = TypeRegistry> = T & Omit<IDefinitorInstance<InstanceType<T>, InstanceType<T>, Registry, ConstructorName<T>>, 'define' | 'lookup'> & (<U extends Constructor<object>>(target: U) => DecoratedClass<U, Registry>) & {
458
- define: TypeAbsorber;
459
- lookup: TypeLookup<Registry>;
460
- };
461
436
  export type Merge<E extends object, T extends object> = {
462
437
  [K in keyof T | keyof E as K extends MnemonicaInstanceMethodKeys ? never : K]: K extends keyof T ? T[K] : E[K & keyof E];
463
438
  };
439
+ export type NotAny<C> = 0 extends (1 & C) ? never : unknown;
464
440
  export interface ApplyFunction extends CallableFunction {
441
+ <E extends object, C extends Constructor<PromiseLike<object>>>(entity: E, Constructor: C & NotAny<C>, ...[args]: [] extends ConstructorParameters<C> ? [args?: ConstructorParameters<C>] : [args: ConstructorParameters<C>]): Promise<InstanceResult<Merge<E, Awaited<InstanceType<C>>>>>;
465
442
  <E extends object, T extends object, Args extends unknown[]>(entity: E, Constructor: CtorParameter<T, Args>, ...[args]: [] extends Args ? [args?: NoInfer<Args>] : [args: NoInfer<Args>]): InstanceResult<Merge<E, T>>;
466
443
  }
467
444
  export interface CallFunction extends CallableFunction {
445
+ <E extends object, C extends Constructor<PromiseLike<object>>>(entity: E, Constructor: C & NotAny<C>, ...args: ConstructorParameters<C>): Promise<InstanceResult<Merge<E, Awaited<InstanceType<C>>>>>;
468
446
  <E extends object, T extends object, Args extends unknown[]>(entity: E, Constructor: CtorParameter<T, Args>, ...args: NoInfer<Args>): InstanceResult<Merge<E, T>>;
469
447
  }
470
448
  export interface BindFunction extends CallableFunction {
449
+ <E extends object, C extends Constructor<PromiseLike<object>>>(entity: E, Constructor: C & NotAny<C>): (...args: ConstructorParameters<C>) => Promise<InstanceResult<Merge<E, Awaited<InstanceType<C>>>>>;
471
450
  <E extends object, T extends object, Args extends unknown[]>(entity: E, Constructor: CtorParameter<T, Args>): (...args: Args) => InstanceResult<Merge<E, T>>;
472
451
  }
473
452
  export interface UtilsCollection {
@@ -479,7 +458,9 @@ export interface UtilsCollection {
479
458
  clone<T extends object>(instance: T): T;
480
459
  fork<T extends object>(instance: T): ForkInvoker<T>;
481
460
  sibling(instance: object): SiblingAccessor;
482
- collectConstructors: (instance: object, flat?: boolean) => (DefineNewableOrCallable | string)[];
461
+ collectConstructors(instance: object, asSequence: true): string[];
462
+ collectConstructors(instance: object, asSequence?: false): Record<string, boolean>;
463
+ collectConstructors(instance: object, asSequence?: boolean): string[] | Record<string, boolean>;
483
464
  merge<A extends object, B extends object>(a: A, b: B, ...args: unknown[]): InstanceResult<Merge<B, A>>;
484
465
  parse<T extends object>(self: T): Parsed<T>;
485
466
  parse(self: null): EmptyParsed;
@@ -491,12 +472,47 @@ export interface UtilsCollection {
491
472
  toJSON<T extends object>(instance: T): string;
492
473
  [key: string]: UtilFunction;
493
474
  }
475
+ export type LineageValue = null | boolean | string | number | LineageValue[] | {
476
+ $ref: string;
477
+ } | {
478
+ '$mnemonica': 'unsupported';
479
+ kind: string;
480
+ } | {
481
+ [key: string]: LineageValue;
482
+ };
483
+ export interface LineageTypeRef {
484
+ collection: string;
485
+ path: string;
486
+ }
487
+ export interface LineageNode {
488
+ type: LineageTypeRef;
489
+ own: {
490
+ [key: string]: LineageValue;
491
+ };
492
+ parent: string | null;
493
+ args?: LineageValue;
494
+ props?: {
495
+ [key: string]: LineageValue;
496
+ };
497
+ }
498
+ export interface LineageGraph {
499
+ version: '1';
500
+ heads: string[];
501
+ nodes: {
502
+ [id: string]: LineageNode;
503
+ };
504
+ }
505
+ export interface LineageOptions {
506
+ args?: boolean;
507
+ props?: string[];
508
+ }
494
509
  export interface MnemonicaModule<Registry extends object = {}> extends RegistryHolder<Registry, object> {
495
510
  apply: ApplyFunction;
496
511
  call: CallFunction;
497
512
  bind: BindFunction;
498
- decorate: <T extends Constructor<object> | constructorOptions | undefined = undefined>(target?: T, config?: constructorOptions) => <U extends Constructor<object>>(cstr: U) => DecoratedClass<U, Registry>;
499
- registerHook: <T extends object, HT extends hooksTypes = hooksTypes>(Constructor: IDEF<T>, hookType: HT, cb: typedHook<HT, object, T>) => void;
513
+ decorate: <T extends Constructor<object> | NoHandlerConfig | undefined = undefined>(target?: T, config?: DefineConfig) => <U extends Constructor<object>>(cstr: U) => DecoratedClass<U, Registry>;
514
+ registerHook: <T extends object, HT extends hookName = hooksTypes>(Constructor: HookableConstructor<T>, hookType: HT, cb: typedHook<HT, object, T>) => void;
515
+ unregisterHook: (Constructor: Pick<HookMethods, 'unregisterHook'>, hookType: hookName, cb: AnyHookCallback) => boolean;
500
516
  defaultTypes: TypesCollection<Registry>;
501
517
  BASE_MNEMONICA_ERROR: MnemonicaErrorConstructor;
502
518
  WRONG_TYPE_DEFINITION: MnemonicaErrorConstructor;
@@ -511,6 +527,7 @@ export interface MnemonicaModule<Registry extends object = {}> extends RegistryH
511
527
  HANDLER_MUST_BE_A_FUNCTION: MnemonicaErrorConstructor;
512
528
  OPTIONS_ERROR: MnemonicaErrorConstructor;
513
529
  WRONG_STACK_CLEANER: MnemonicaErrorConstructor;
530
+ defaultOptions: Required<constructorOptions>;
514
531
  MNEMONICA: string;
515
532
  MNEMOSYNE: string;
516
533
  SymbolParentType: symbol;