zova-module-a-action 5.1.12 → 5.1.13

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/lib/performAction.ts","../src/monkey.ts","../src/.metadata/index.ts","../src/lib/action.ts","../src/types/action.ts"],"sourcesContent":["import type { ZovaSys } from 'zova';\nimport type { IJsxRenderContextBase } from 'zova-module-a-openapi';\n\nimport { beanFullNameFromOnionName, deepExtend } from 'zova';\n\nimport type { IActionRecord, SymbolActionResult } from '../types/action.js';\n\nexport function $performAction<T extends keyof IActionRecord>(\n sys: ZovaSys,\n actionName: T,\n options: Partial<IActionRecord[T]> | undefined,\n renderContext: IJsxRenderContextBase,\n next?: Function,\n): IActionRecord[T][typeof SymbolActionResult] {\n if (!next) {\n next = actionRes => {\n return actionRes;\n };\n }\n // action\n const beanFullName = beanFullNameFromOnionName(actionName, 'action');\n const beanInstance = sys.bean._getBeanSyncOnly(beanFullName);\n if (beanInstance) {\n // sync\n return _renderEventActionNormal_inner(beanInstance, options, renderContext, next);\n }\n // async\n return sys.bean._getBean(beanFullName, false).then(beanInstance => {\n return _renderEventActionNormal_inner(beanInstance, options, renderContext, next);\n });\n}\n\nfunction _renderEventActionNormal_inner(\n beanInstance: any,\n options: {} | undefined,\n renderContext: IJsxRenderContextBase,\n next?: Function,\n) {\n const onionOptions = beanInstance.$onionOptions;\n // props\n const props = onionOptions ? deepExtend({}, onionOptions, options) : (options ?? {});\n return beanInstance.execute(props, renderContext, next);\n}\n","import type { BeanBase, BeanContainer, IMonkeyBeanInit } from 'zova';\nimport type { IJsxRenderContextBase } from 'zova-module-a-openapi';\n\nimport { BeanSimple, cast } from 'zova';\n\nimport type { IActionRecord } from './types/action.js';\n\nimport { $performAction } from './lib/performAction.js';\n\nexport class Monkey extends BeanSimple implements IMonkeyBeanInit {\n async beanInit(bean: BeanContainer, beanInstance: BeanBase) {\n const self = this;\n bean.defineProperty(beanInstance, '$performAction', {\n enumerable: false,\n configurable: true,\n get() {\n return function <T extends keyof IActionRecord>(\n actionName: T,\n options: Partial<IActionRecord[T]> | undefined,\n renderContext?: IJsxRenderContextBase,\n next?: Function,\n ) {\n renderContext = Object.assign(\n {\n app: cast(beanInstance).app,\n ctx: cast(beanInstance).ctx,\n $host: beanInstance,\n },\n renderContext,\n );\n return $performAction(self.sys, actionName, options, renderContext, next);\n };\n },\n });\n }\n}\n","// eslint-disable\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleAAction extends BeanScopeBase {}\n\nexport interface ScopeModuleAAction {\n util: BeanScopeUtil;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-action': ScopeModuleAAction;\n }\n \n \n\n \n\n \n}\n \n/** scope: end */\n","import type { PowerPartial } from 'zova';\n\nimport { createBeanDecorator } from 'zova';\n\nimport type { IDecoratorActionOptions } from '../types/action.js';\n\nexport function Action<T extends IDecoratorActionOptions>(\n options?: PowerPartial<T>,\n): ClassDecorator {\n return createBeanDecorator('action', 'sys', true, options);\n}\n","import type { OmitNever } from 'zova';\nimport type { ServiceOnion } from 'zova-module-a-bean';\nimport type { IJsxRenderContextBase } from 'zova-module-a-openapi';\n\nexport const SymbolActionResult = Symbol('SymbolActionResult');\n\nexport type TypeActionOptionsRest<T> = Omit<T, typeof SymbolActionResult> & { res?: string };\n\nexport type NextActionExecute = (res?: any) => any | Promise<any>;\n\nexport interface IActionRecord {}\n\nexport interface IActionExecute {\n execute(options: IDecoratorActionOptions, renderContext: IJsxRenderContextBase, next: NextActionExecute): any | Promise<any>;\n}\n\nexport interface IDecoratorActionOptions<Result = any> {\n [SymbolActionResult]: Result;\n // res?: string; // need not define here\n}\n\ndeclare module 'zova-module-a-bean' {\n export interface SysOnion {\n action: ServiceOnion<IDecoratorActionOptions, keyof IActionRecord>;\n }\n}\n\ndeclare module 'zova' {\n export interface ConfigOnions {\n action: OmitNever<IActionRecord>;\n }\n\n export interface IBeanSceneRecord {\n action: never;\n }\n}\n"],"mappings":";;;AACA,SAAc,eAAA,KAAsB,YAAY,SAAS,eAAS,MAAA;WAElE,SAAS,cAAA;;;CAKP,MAAK,eAAO,0BAAA,YAAA,SAAA;CACZ,MAAA,eAAa,IAAA,KAAA,iBAAA,aAAA;AACb,KAAA,aAEA,QAAO,+BAAQ,cAAA,SAAA,eAAA,KAAA;AAGf,QAAO,IAAE,KAAA,SAAa,cAAA,MAAA,CAAA,MAAA,iBAAA;AACpB,SAAE,+BAAgB,cAAA,SAAA,eAAA,KAAA;GAClB;;AAEJ,SAAK,+BAAA,cAAA,SAAA,eAAA,MAAA;CACH,MAAM,eAAe,aAAA;CAErB,MAAI,QAAA,eAAc,WAAA,EAAA,EAAA,cAAA,QAAA,GAAA,WAAA,EAAA;AAClB,QAAK,aAAA,QAAA,OAAA,eAAA,KAAA;;;;;CCpBP,MAAQ,SAAC,MAAY,cAAa;;AAElC,OAAO,eAAO,cAAwB,kBAAgB;;GAEhD,cAAI;;AAEH,WAAM,SAAO,YAAQ,SAAW,eAAW,MAAgB;AAC1D,qBAAe,OAAA,OAAe;MAC5B,KAAO,KAAI,aAAA,CAAA;MACZ,KAAA,KAAA,aAAe,CAAY;MAC9B,OAAY;MACZ,EAAA,cAAkB;AACd,YAAE,eAAA,KAAA,KAAA,YAAA,SAAA,eAAA,KAAA;;;GAGP,CAAC;;;;;;;AClBN,IAAG,MAAO,OAAA;AASV,IAAO,sBAAyB,OAAQ,OAAA,EAAA,QAAe,SAAA,EAAA,QAAA,YAEvD,CAAA,EAAA,KAAO,SAAU,MAAA,SAAA,MAAmB,2BAAA,cAAA,GAAA,IAAA,OAAA,IAAA;;;;;ACTpC,QAAS,oBAAoB,UAAQ,OAAK,MAAA,QAAA;;;;ACF1C,IAAa,qBAAmB,OAAK,qBAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lib/performAction.ts","../src/monkey.ts","../src/.metadata/index.ts","../src/lib/action.ts","../src/types/action.ts"],"sourcesContent":["import type { ZovaSys } from 'zova';\nimport type { IJsxRenderContextBase } from 'zova-module-a-openapi';\n\nimport { beanFullNameFromOnionName, deepExtend } from 'zova';\n\nimport type { IActionRecord, SymbolActionResult } from '../types/action.js';\n\nexport function $performAction<T extends keyof IActionRecord>(\n sys: ZovaSys,\n actionName: T,\n options: Partial<IActionRecord[T]> | undefined,\n renderContext: IJsxRenderContextBase,\n next?: Function,\n): IActionRecord[T][typeof SymbolActionResult] {\n if (!next) {\n next = actionRes => {\n return actionRes;\n };\n }\n // action\n const beanFullName = beanFullNameFromOnionName(actionName, 'action');\n const beanInstance = sys.bean._getBeanSyncOnly(beanFullName);\n if (beanInstance) {\n // sync\n return _renderEventActionNormal_inner(beanInstance, options, renderContext, next);\n }\n // async\n return sys.bean._getBean(beanFullName, false).then(beanInstance => {\n return _renderEventActionNormal_inner(beanInstance, options, renderContext, next);\n });\n}\n\nfunction _renderEventActionNormal_inner(\n beanInstance: any,\n options: {} | undefined,\n renderContext: IJsxRenderContextBase,\n next?: Function,\n) {\n const onionOptions = beanInstance.$onionOptions;\n // props\n const props = onionOptions ? deepExtend({}, onionOptions, options) : (options ?? {});\n return beanInstance.execute(props, renderContext, next);\n}\n","import type { BeanBase, BeanContainer, IMonkeyBeanInit } from 'zova';\nimport type { IJsxRenderContextBase } from 'zova-module-a-openapi';\n\nimport { BeanSimple, cast } from 'zova';\n\nimport type { IActionRecord } from './types/action.js';\n\nimport { $performAction } from './lib/performAction.js';\n\nexport class Monkey extends BeanSimple implements IMonkeyBeanInit {\n async beanInit(bean: BeanContainer, beanInstance: BeanBase) {\n const self = this;\n bean.defineProperty(beanInstance, '$performAction', {\n enumerable: false,\n configurable: true,\n get() {\n return function <T extends keyof IActionRecord>(\n actionName: T,\n options: Partial<IActionRecord[T]> | undefined,\n renderContext?: IJsxRenderContextBase,\n next?: Function,\n ) {\n renderContext = Object.assign(\n {\n app: cast(beanInstance).app,\n ctx: cast(beanInstance).ctx,\n $host: beanInstance,\n },\n renderContext,\n );\n return $performAction(self.sys, actionName, options, renderContext, next);\n };\n },\n });\n }\n}\n","// eslint-disable\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleAAction extends BeanScopeBase {}\n\nexport interface ScopeModuleAAction {\n util: BeanScopeUtil;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-action': ScopeModuleAAction;\n }\n \n \n\n \n\n \n}\n \n/** scope: end */\n","import type { PowerPartial } from 'zova';\n\nimport { createBeanDecorator } from 'zova';\n\nimport type { IDecoratorActionOptions } from '../types/action.js';\n\nexport function Action<T extends IDecoratorActionOptions>(\n options?: PowerPartial<T>,\n): ClassDecorator {\n return createBeanDecorator('action', 'sys', true, options);\n}\n","import type { OmitNever } from 'zova';\nimport type { ServiceOnion } from 'zova-module-a-bean';\nimport type { IJsxRenderContextBase } from 'zova-module-a-openapi';\n\nexport const SymbolActionResult = Symbol('SymbolActionResult');\n\nexport type TypeActionOptionsRest<T> = Omit<T, typeof SymbolActionResult> & { res?: string };\n\nexport type TypeActionOptions<K extends keyof IActionRecord> = {\n name: K;\n options?: Omit<IActionRecord[K], typeof SymbolActionResult>;\n res?: string;\n};\n\nexport type NextActionExecute = (res?: any) => any | Promise<any>;\n\nexport interface IActionRecord {}\n\nexport interface IActionExecute {\n execute(options: IDecoratorActionOptions, renderContext: IJsxRenderContextBase, next: NextActionExecute): any | Promise<any>;\n}\n\nexport interface IDecoratorActionOptions<Result = any> {\n [SymbolActionResult]: Result;\n // res?: string; // need not define here\n}\n\ndeclare module 'zova-module-a-bean' {\n export interface SysOnion {\n action: ServiceOnion<IDecoratorActionOptions, keyof IActionRecord>;\n }\n}\n\ndeclare module 'zova' {\n export interface ConfigOnions {\n action: OmitNever<IActionRecord>;\n }\n\n export interface IBeanSceneRecord {\n action: never;\n }\n}\n"],"mappings":";;;AACA,SAAc,eAAA,KAAsB,YAAY,SAAS,eAAS,MAAA;WAElE,SAAS,cAAA;;;CAKP,MAAK,eAAO,0BAAA,YAAA,SAAA;CACZ,MAAA,eAAa,IAAA,KAAA,iBAAA,aAAA;AACb,KAAA,aAEA,QAAO,+BAAQ,cAAA,SAAA,eAAA,KAAA;AAGf,QAAO,IAAE,KAAA,SAAa,cAAA,MAAA,CAAA,MAAA,iBAAA;AACpB,SAAE,+BAAgB,cAAA,SAAA,eAAA,KAAA;GAClB;;AAEJ,SAAK,+BAAA,cAAA,SAAA,eAAA,MAAA;CACH,MAAM,eAAe,aAAA;CAErB,MAAI,QAAA,eAAc,WAAA,EAAA,EAAA,cAAA,QAAA,GAAA,WAAA,EAAA;AAClB,QAAK,aAAA,QAAA,OAAA,eAAA,KAAA;;;;;CCpBP,MAAQ,SAAC,MAAY,cAAa;;AAElC,OAAO,eAAO,cAAwB,kBAAgB;;GAEhD,cAAI;;AAEH,WAAM,SAAO,YAAQ,SAAW,eAAW,MAAgB;AAC1D,qBAAe,OAAA,OAAe;MAC5B,KAAO,KAAI,aAAA,CAAA;MACZ,KAAA,KAAA,aAAe,CAAY;MAC9B,OAAY;MACZ,EAAA,cAAkB;AACd,YAAE,eAAA,KAAA,KAAA,YAAA,SAAA,eAAA,KAAA;;;GAGP,CAAC;;;;;;;AClBN,IAAG,MAAO,OAAA;AASV,IAAO,sBAAyB,OAAQ,OAAA,EAAA,QAAe,SAAA,EAAA,QAAA,YAEvD,CAAA,EAAA,KAAO,SAAU,MAAA,SAAA,MAAmB,2BAAA,cAAA,GAAA,IAAA,OAAA,IAAA;;;;;ACTpC,QAAS,oBAAoB,UAAQ,OAAK,MAAA,QAAA;;;;ACF1C,IAAa,qBAAmB,OAAK,qBAAA"}
@@ -5,6 +5,11 @@ export declare const SymbolActionResult: unique symbol;
5
5
  export type TypeActionOptionsRest<T> = Omit<T, typeof SymbolActionResult> & {
6
6
  res?: string;
7
7
  };
8
+ export type TypeActionOptions<K extends keyof IActionRecord> = {
9
+ name: K;
10
+ options?: Omit<IActionRecord[K], typeof SymbolActionResult>;
11
+ res?: string;
12
+ };
8
13
  export type NextActionExecute = (res?: any) => any | Promise<any>;
9
14
  export interface IActionRecord {
10
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/types/action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAE/D,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,kBAAkB,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7F,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAElE,MAAM,WAAW,aAAa;CAAG;AAEjC,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,qBAAqB,EAAE,IAAI,EAAE,iBAAiB,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAC9H;AAED,MAAM,WAAW,uBAAuB,CAAC,MAAM,GAAG,GAAG;IACnD,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAE9B;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAiB,QAAQ;QACvB,MAAM,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,CAAC,MAAM,GAAG,GAAG;IACnD,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAE9B;AAED,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAiB,QAAQ;QACvB,MAAM,EAAE,YAAY,CAAC,uBAAuB,EAAE,MAAM,aAAa,CAAC,CAAC;KACpE;CACF;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,YAAY;QAC3B,MAAM,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;KAClC;IAED,UAAiB,gBAAgB;QAC/B,MAAM,EAAE,KAAK,CAAC;KACf;CACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-module-a-action",
3
- "version": "5.1.12",
4
- "gitHead": "a247f88a55c663d313296039f874560ee5a13e01",
3
+ "version": "5.1.13",
4
+ "gitHead": "9664b8fb5bcc3d8f2836fce8481d3c3a093f3aef",
5
5
  "description": "",
6
6
  "keywords": [
7
7
  "Zova Module"
@@ -6,6 +6,12 @@ export const SymbolActionResult = Symbol('SymbolActionResult');
6
6
 
7
7
  export type TypeActionOptionsRest<T> = Omit<T, typeof SymbolActionResult> & { res?: string };
8
8
 
9
+ export type TypeActionOptions<K extends keyof IActionRecord> = {
10
+ name: K;
11
+ options?: Omit<IActionRecord[K], typeof SymbolActionResult>;
12
+ res?: string;
13
+ };
14
+
9
15
  export type NextActionExecute = (res?: any) => any | Promise<any>;
10
16
 
11
17
  export interface IActionRecord {}