moost 0.3.21 → 0.3.23

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.
package/dist/index.cjs CHANGED
@@ -5,6 +5,29 @@ var infact$1 = require('@prostojs/infact');
5
5
  var eventCore = require('@wooksjs/event-core');
6
6
  var logger = require('@prostojs/logger');
7
7
 
8
+ function getInstanceOwnMethods(instance) {
9
+ const proto = Object.getPrototypeOf(instance);
10
+ return [
11
+ ...getParentProps(mate$1.getConstructor(instance)),
12
+ ...Object.getOwnPropertyNames(proto),
13
+ ...Object.getOwnPropertyNames(instance),
14
+ ].filter((m) => typeof instance[m] === 'function');
15
+ }
16
+ const fnProto = Object.getPrototypeOf(Function);
17
+ function getParentProps(constructor) {
18
+ const parent = Object.getPrototypeOf(constructor);
19
+ if (typeof parent === 'function' &&
20
+ parent !== fnProto &&
21
+ parent !== constructor &&
22
+ parent.prototype) {
23
+ return [
24
+ ...getParentProps(parent),
25
+ ...Object.getOwnPropertyNames(parent.prototype),
26
+ ];
27
+ }
28
+ return [];
29
+ }
30
+
8
31
  const METADATA_WORKSPACE = 'moost';
9
32
  const moostMate = new mate$1.Mate(METADATA_WORKSPACE, {
10
33
  readType: true,
@@ -85,29 +108,6 @@ function getNewMoostInfact() {
85
108
  });
86
109
  }
87
110
 
88
- function getInstanceOwnMethods(instance) {
89
- const proto = Object.getPrototypeOf(instance);
90
- return [
91
- ...getParentProps(mate$1.getConstructor(instance)),
92
- ...Object.getOwnPropertyNames(proto),
93
- ...Object.getOwnPropertyNames(instance),
94
- ].filter((m) => typeof instance[m] === 'function');
95
- }
96
- const fnProto = Object.getPrototypeOf(Function);
97
- function getParentProps(constructor) {
98
- const parent = Object.getPrototypeOf(constructor);
99
- if (typeof parent === 'function' &&
100
- parent !== fnProto &&
101
- parent !== constructor &&
102
- parent.prototype) {
103
- return [
104
- ...getParentProps(parent),
105
- ...Object.getOwnPropertyNames(parent.prototype),
106
- ];
107
- }
108
- return [];
109
- }
110
-
111
111
  async function getCallableFn(targetInstance, fn, restoreCtx, pipes, logger) {
112
112
  const mate = getMoostMate();
113
113
  const meta = mate.read(fn);
@@ -867,6 +867,7 @@ exports.Value = Value;
867
867
  exports.defineInterceptorFn = defineInterceptorFn;
868
868
  exports.defineMoostEventHandler = defineMoostEventHandler;
869
869
  exports.definePipeFn = definePipeFn;
870
+ exports.getInstanceOwnMethods = getInstanceOwnMethods;
870
871
  exports.getMoostInfact = getMoostInfact;
871
872
  exports.getMoostMate = getMoostMate;
872
873
  exports.getNewMoostInfact = getNewMoostInfact;
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ type TClassConstructor<T = unknown> = new (...args: TAny[]) => T;
16
16
  interface TEmpty {
17
17
  }
18
18
 
19
+ declare function getInstanceOwnMethods<T = TAny>(instance: T): (keyof T)[];
20
+
19
21
  interface TClassFunction<T extends TAnyFn = TAnyFn> {
20
22
  handler: T;
21
23
  }
@@ -478,24 +480,20 @@ declare function useControllerContext<T extends object>(): {
478
480
  getMethod: () => keyof T;
479
481
  getControllerMeta: () => (TMoostMetadata<TEmpty> & TEmpty & {
480
482
  params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
481
- }) | (TMoostMetadata<TEmpty> & TEmpty & {
482
- params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
483
- } & {
484
- params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
485
- } & _prostojs_mate.TMateClassMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty> & _prostojs_mate.TMatePropMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty>);
486
- getMethodMeta: (name?: string) => TMoostMetadata<TEmpty> & TEmpty & {
483
+ }) | undefined;
484
+ getMethodMeta: (name?: string) => (TMoostMetadata<TEmpty> & TEmpty & {
487
485
  params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
488
486
  } & {
489
487
  params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
490
- } & _prostojs_mate.TMateClassMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty> & _prostojs_mate.TMatePropMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty>;
488
+ } & _prostojs_mate.TMateClassMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty> & _prostojs_mate.TMatePropMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty>) | undefined;
491
489
  getPropertiesList: () => (string | symbol)[];
492
490
  getScope: () => true | TInjectableScope;
493
491
  getParamsMeta: () => (_prostojs_mate.TMateParamMeta & TMoostParamsMetadata)[] & (TEmpty & _prostojs_mate.TMateParamMeta)[] & (_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty)[];
494
- getPropMeta: (name: string) => TMoostMetadata<TEmpty> & TEmpty & {
492
+ getPropMeta: (name: string) => (TMoostMetadata<TEmpty> & TEmpty & {
495
493
  params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
496
494
  } & {
497
495
  params: (TEmpty & _prostojs_mate.TMateParamMeta)[];
498
- } & _prostojs_mate.TMateClassMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty> & _prostojs_mate.TMatePropMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty>;
496
+ } & _prostojs_mate.TMateClassMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty> & _prostojs_mate.TMatePropMeta<_prostojs_mate.TMateParamMeta & TMoostParamsMetadata & TEmpty>) | undefined;
499
497
  };
500
498
 
501
499
  interface TMoostEventHandlerHookOptions<T> {
@@ -570,4 +568,4 @@ type TInterceptorClass = TClassFunction<TInterceptorFn>;
570
568
  */
571
569
  declare function definePipeFn<T extends TObject = TEmpty>(fn: TPipeFn<T>, priority?: TPipePriority): TPipeFn<T>;
572
570
 
573
- export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, Injectable, Intercept, InterceptorHandler, Label, Moost, Optional, Param, Params, Pipe, Provide, Required, Resolve, type TCallableClassFunction, type TClassFunction, type TControllerOverview, type TInjectableScope, type TInterceptorAfter, type TInterceptorBefore, type TInterceptorClass, type TInterceptorData, type TInterceptorFn, type TInterceptorOnError, TInterceptorPriority, type TMoostAdapter, type TMoostAdapterOptions, type TMoostEventHandlerHookOptions, type TMoostEventHandlerOptions, type TMoostHandler, type TMoostMetadata, type TMoostOptions, type TMoostParamsMetadata, type TPipeData, type TPipeFn, type TPipeMetas, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, useControllerContext };
571
+ export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, Injectable, Intercept, InterceptorHandler, Label, Moost, Optional, Param, Params, Pipe, Provide, Required, Resolve, type TCallableClassFunction, type TClassFunction, type TControllerOverview, type TInjectableScope, type TInterceptorAfter, type TInterceptorBefore, type TInterceptorClass, type TInterceptorData, type TInterceptorFn, type TInterceptorOnError, TInterceptorPriority, type TMoostAdapter, type TMoostAdapterOptions, type TMoostEventHandlerHookOptions, type TMoostEventHandlerOptions, type TMoostHandler, type TMoostMetadata, type TMoostOptions, type TMoostParamsMetadata, type TPipeData, type TPipeFn, type TPipeMetas, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getInstanceOwnMethods, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, useControllerContext };
package/dist/index.mjs CHANGED
@@ -1,10 +1,33 @@
1
- import { Mate, getConstructor, isConstructor } from '@prostojs/mate';
1
+ import { getConstructor, Mate, isConstructor } from '@prostojs/mate';
2
2
  import { Infact, createProvideRegistry } from '@prostojs/infact';
3
3
  export { createProvideRegistry } from '@prostojs/infact';
4
4
  import { useEventId, useEventContext, useRouteParams, useEventLogger } from '@wooksjs/event-core';
5
5
  export { EventLogger, useEventContext, useEventLogger } from '@wooksjs/event-core';
6
6
  import { ProstoLogger, createConsoleTransort, coloredConsole } from '@prostojs/logger';
7
7
 
8
+ function getInstanceOwnMethods(instance) {
9
+ const proto = Object.getPrototypeOf(instance);
10
+ return [
11
+ ...getParentProps(getConstructor(instance)),
12
+ ...Object.getOwnPropertyNames(proto),
13
+ ...Object.getOwnPropertyNames(instance),
14
+ ].filter((m) => typeof instance[m] === 'function');
15
+ }
16
+ const fnProto = Object.getPrototypeOf(Function);
17
+ function getParentProps(constructor) {
18
+ const parent = Object.getPrototypeOf(constructor);
19
+ if (typeof parent === 'function' &&
20
+ parent !== fnProto &&
21
+ parent !== constructor &&
22
+ parent.prototype) {
23
+ return [
24
+ ...getParentProps(parent),
25
+ ...Object.getOwnPropertyNames(parent.prototype),
26
+ ];
27
+ }
28
+ return [];
29
+ }
30
+
8
31
  const METADATA_WORKSPACE = 'moost';
9
32
  const moostMate = new Mate(METADATA_WORKSPACE, {
10
33
  readType: true,
@@ -85,29 +108,6 @@ function getNewMoostInfact() {
85
108
  });
86
109
  }
87
110
 
88
- function getInstanceOwnMethods(instance) {
89
- const proto = Object.getPrototypeOf(instance);
90
- return [
91
- ...getParentProps(getConstructor(instance)),
92
- ...Object.getOwnPropertyNames(proto),
93
- ...Object.getOwnPropertyNames(instance),
94
- ].filter((m) => typeof instance[m] === 'function');
95
- }
96
- const fnProto = Object.getPrototypeOf(Function);
97
- function getParentProps(constructor) {
98
- const parent = Object.getPrototypeOf(constructor);
99
- if (typeof parent === 'function' &&
100
- parent !== fnProto &&
101
- parent !== constructor &&
102
- parent.prototype) {
103
- return [
104
- ...getParentProps(parent),
105
- ...Object.getOwnPropertyNames(parent.prototype),
106
- ];
107
- }
108
- return [];
109
- }
110
-
111
111
  async function getCallableFn(targetInstance, fn, restoreCtx, pipes, logger) {
112
112
  const mate = getMoostMate();
113
113
  const meta = mate.read(fn);
@@ -825,4 +825,4 @@ function defineMoostEventHandler(options) {
825
825
  };
826
826
  }
827
827
 
828
- export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, Injectable, Intercept, InterceptorHandler, Label, Moost, Optional, Param, Params, Pipe, Provide, Required, Resolve, TInterceptorPriority, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, useControllerContext };
828
+ export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, Injectable, Intercept, InterceptorHandler, Label, Moost, Optional, Param, Params, Pipe, Provide, Required, Resolve, TInterceptorPriority, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getInstanceOwnMethods, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, useControllerContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moost",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "moost",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -32,10 +32,10 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@prostojs/infact": "^0.1.13",
35
- "@prostojs/mate": "^0.2.1",
35
+ "@prostojs/mate": "^0.3.0",
36
36
  "@prostojs/logger": "^0.4.0",
37
- "@wooksjs/event-core": "^0.4.24",
38
- "wooks": "^0.4.24"
37
+ "@wooksjs/event-core": "^0.4.26",
38
+ "wooks": "^0.4.26"
39
39
  },
40
40
  "author": "Artem Maltsev",
41
41
  "license": "MIT",