moost 0.5.14 → 0.5.16
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 +14 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +12 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -70,6 +70,14 @@ function setInfactLoggingOptions(options) {
|
|
|
70
70
|
function getMoostInfact() {
|
|
71
71
|
return sharedMoostInfact;
|
|
72
72
|
}
|
|
73
|
+
const scopeVarsMap = new Map();
|
|
74
|
+
function defineInfactScope(name, scopeVars) {
|
|
75
|
+
scopeVarsMap.set(name, scopeVars);
|
|
76
|
+
getMoostInfact().registerScope(name);
|
|
77
|
+
}
|
|
78
|
+
function getInfactScopeVars(name) {
|
|
79
|
+
return scopeVarsMap.get(name);
|
|
80
|
+
}
|
|
73
81
|
function getNewMoostInfact() {
|
|
74
82
|
return new infact$1.Infact({
|
|
75
83
|
describeClass(classConstructor) {
|
|
@@ -741,6 +749,9 @@ function Replace(type, newType) {
|
|
|
741
749
|
function Inject(type) {
|
|
742
750
|
return getMoostMate().decorate('inject', type);
|
|
743
751
|
}
|
|
752
|
+
function FromScope(name) {
|
|
753
|
+
return getMoostMate().decorate('fromScope', name);
|
|
754
|
+
}
|
|
744
755
|
|
|
745
756
|
function defineInterceptorFn(fn, priority = exports.TInterceptorPriority.INTERCEPTOR) {
|
|
746
757
|
fn.priority = priority;
|
|
@@ -1023,6 +1034,7 @@ exports.Const = Const;
|
|
|
1023
1034
|
exports.ConstFactory = ConstFactory;
|
|
1024
1035
|
exports.Controller = Controller;
|
|
1025
1036
|
exports.Description = Description;
|
|
1037
|
+
exports.FromScope = FromScope;
|
|
1026
1038
|
exports.Id = Id;
|
|
1027
1039
|
exports.ImportController = ImportController;
|
|
1028
1040
|
exports.Inherit = Inherit;
|
|
@@ -1044,9 +1056,11 @@ exports.Replace = Replace;
|
|
|
1044
1056
|
exports.Required = Required;
|
|
1045
1057
|
exports.Resolve = Resolve;
|
|
1046
1058
|
exports.Value = Value;
|
|
1059
|
+
exports.defineInfactScope = defineInfactScope;
|
|
1047
1060
|
exports.defineInterceptorFn = defineInterceptorFn;
|
|
1048
1061
|
exports.defineMoostEventHandler = defineMoostEventHandler;
|
|
1049
1062
|
exports.definePipeFn = definePipeFn;
|
|
1063
|
+
exports.getInfactScopeVars = getInfactScopeVars;
|
|
1050
1064
|
exports.getInstanceOwnMethods = getInstanceOwnMethods;
|
|
1051
1065
|
exports.getInstanceOwnProps = getInstanceOwnProps;
|
|
1052
1066
|
exports.getMoostInfact = getMoostInfact;
|
package/dist/index.d.ts
CHANGED
|
@@ -147,6 +147,8 @@ declare function getMoostInfact(): Infact<TMoostMetadata<TEmpty>, TMoostMetadata
|
|
|
147
147
|
interface TCustom {
|
|
148
148
|
pipes?: TPipeData[];
|
|
149
149
|
}
|
|
150
|
+
declare function defineInfactScope(name: string | symbol, scopeVars: Record<string, unknown>): void;
|
|
151
|
+
declare function getInfactScopeVars(name: string | symbol): Record<string, unknown> | undefined;
|
|
150
152
|
declare function getNewMoostInfact(): Infact<TMoostMetadata<TEmpty>, TMoostMetadata<TEmpty>, TMoostParamsMetadata, TCustom>;
|
|
151
153
|
|
|
152
154
|
interface TPipeMetas<T extends TObject = TEmpty> {
|
|
@@ -208,6 +210,7 @@ interface TMoostParamsMetadata extends TCommonMetaFields, TCommonMoostMeta {
|
|
|
208
210
|
nullable?: boolean;
|
|
209
211
|
paramSource?: string;
|
|
210
212
|
paramName?: string;
|
|
213
|
+
fromScope?: string | symbol;
|
|
211
214
|
}
|
|
212
215
|
type TInjectableScope = 'FOR_EVENT' | 'SINGLETON';
|
|
213
216
|
type TMoostHandler<T> = {
|
|
@@ -303,6 +306,7 @@ declare function Replace(type: TClassConstructor, newType: TClassConstructor): C
|
|
|
303
306
|
* @param type - string or class constructor
|
|
304
307
|
*/
|
|
305
308
|
declare function Inject(type: string | TClassConstructor): ParameterDecorator;
|
|
309
|
+
declare function FromScope(name: string | symbol): ParameterDecorator;
|
|
306
310
|
|
|
307
311
|
/**
|
|
308
312
|
* Hook to the Response Status
|
|
@@ -659,4 +663,4 @@ type TInterceptorClass = TClassFunction<TInterceptorFn>;
|
|
|
659
663
|
*/
|
|
660
664
|
declare function definePipeFn<T extends TObject = TEmpty>(fn: TPipeFn<T>, priority?: TPipePriority): TPipeFn<T>;
|
|
661
665
|
|
|
662
|
-
export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, InjectMoostLogger, Injectable, Intercept, InterceptorHandler, Label, LoggerTopic, Moost, Optional, Param, Params, Pipe, Provide, Replace, Required, Resolve, type TCallableClassFunction, type TClassConstructor, type TClassFunction, type TContextInjectorHook, 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, getInstanceOwnProps, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, setInfactLoggingOptions, useControllerContext };
|
|
666
|
+
export { Circular, Const, ConstFactory, Controller, Description, FromScope, Id, ImportController, Inherit, Inject, InjectEventLogger, InjectMoostLogger, Injectable, Intercept, InterceptorHandler, Label, LoggerTopic, Moost, Optional, Param, Params, Pipe, Provide, Replace, Required, Resolve, type TCallableClassFunction, type TClassConstructor, type TClassFunction, type TContextInjectorHook, 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, defineInfactScope, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getInfactScopeVars, getInstanceOwnMethods, getInstanceOwnProps, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, setInfactLoggingOptions, useControllerContext };
|
package/dist/index.mjs
CHANGED
|
@@ -72,6 +72,14 @@ function setInfactLoggingOptions(options) {
|
|
|
72
72
|
function getMoostInfact() {
|
|
73
73
|
return sharedMoostInfact;
|
|
74
74
|
}
|
|
75
|
+
const scopeVarsMap = new Map();
|
|
76
|
+
function defineInfactScope(name, scopeVars) {
|
|
77
|
+
scopeVarsMap.set(name, scopeVars);
|
|
78
|
+
getMoostInfact().registerScope(name);
|
|
79
|
+
}
|
|
80
|
+
function getInfactScopeVars(name) {
|
|
81
|
+
return scopeVarsMap.get(name);
|
|
82
|
+
}
|
|
75
83
|
function getNewMoostInfact() {
|
|
76
84
|
return new Infact({
|
|
77
85
|
describeClass(classConstructor) {
|
|
@@ -743,6 +751,9 @@ function Replace(type, newType) {
|
|
|
743
751
|
function Inject(type) {
|
|
744
752
|
return getMoostMate().decorate('inject', type);
|
|
745
753
|
}
|
|
754
|
+
function FromScope(name) {
|
|
755
|
+
return getMoostMate().decorate('fromScope', name);
|
|
756
|
+
}
|
|
746
757
|
|
|
747
758
|
function defineInterceptorFn(fn, priority = TInterceptorPriority.INTERCEPTOR) {
|
|
748
759
|
fn.priority = priority;
|
|
@@ -968,4 +979,4 @@ class Moost extends Hookable {
|
|
|
968
979
|
}
|
|
969
980
|
}
|
|
970
981
|
|
|
971
|
-
export { Circular, Const, ConstFactory, Controller, Description, Id, ImportController, Inherit, Inject, InjectEventLogger, InjectMoostLogger, Injectable, Intercept, InterceptorHandler, Label, LoggerTopic, Moost, Optional, Param, Params, Pipe, Provide, Replace, Required, Resolve, TInterceptorPriority, TPipePriority, Value, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getInstanceOwnMethods, getInstanceOwnProps, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, setInfactLoggingOptions, useControllerContext };
|
|
982
|
+
export { Circular, Const, ConstFactory, Controller, Description, FromScope, Id, ImportController, Inherit, Inject, InjectEventLogger, InjectMoostLogger, Injectable, Intercept, InterceptorHandler, Label, LoggerTopic, Moost, Optional, Param, Params, Pipe, Provide, Replace, Required, Resolve, TInterceptorPriority, TPipePriority, Value, defineInfactScope, defineInterceptorFn, defineMoostEventHandler, definePipeFn, getInfactScopeVars, getInstanceOwnMethods, getInstanceOwnProps, getMoostInfact, getMoostMate, getNewMoostInfact, registerEventScope, resolvePipe, setControllerContext, setInfactLoggingOptions, useControllerContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moost",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.16",
|
|
4
4
|
"description": "moost",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"prostojs"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@prostojs/infact": "^0.3.
|
|
34
|
+
"@prostojs/infact": "^0.3.1",
|
|
35
35
|
"@prostojs/mate": "^0.3.3",
|
|
36
36
|
"@prostojs/logger": "^0.4.3",
|
|
37
|
-
"@wooksjs/event-core": "^0.5.
|
|
37
|
+
"@wooksjs/event-core": "^0.5.20",
|
|
38
38
|
"hookable": "^5.5.3",
|
|
39
|
-
"wooks": "^0.5.
|
|
39
|
+
"wooks": "^0.5.20"
|
|
40
40
|
},
|
|
41
41
|
"author": "Artem Maltsev",
|
|
42
42
|
"license": "MIT",
|