zova-module-a-bean 5.1.13 → 5.1.17

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.
@@ -1,12 +1,9 @@
1
1
  import type { IMetadataCustomGenerateOptions } from '@cabloy/cli';
2
2
  import type { IGlobBeanFile } from '@cabloy/module-info';
3
3
 
4
- import fse from 'fs-extra';
5
- import path from 'node:path';
6
-
7
4
  import type { IControllerInfo } from './types.ts';
8
5
 
9
- import { combineContentRenderAndStyle, generateRestIndex } from './utils.ts';
6
+ import { combineContentRenderAndStyle } from './utils.ts';
10
7
 
11
8
  export async function generateFileComponent(options: IMetadataCustomGenerateOptions, globFile: IGlobBeanFile, controllerInfo: IControllerInfo) {
12
9
  const { moduleName } = options;
@@ -166,20 +163,6 @@ ${combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDec
166
163
  ${contentComponent}
167
164
  ${contentRestProps}
168
165
  `;
169
- // restComponent
170
- await generateRestComponent(options);
171
166
  // ok
172
167
  return content;
173
168
  }
174
-
175
- async function generateRestComponent(options: IMetadataCustomGenerateOptions) {
176
- const { moduleName, modulePath } = options;
177
- // components
178
- const fileComponents = path.join(modulePath, 'rest/components.ts');
179
- if (fse.existsSync(fileComponents)) return;
180
- const contentComponents = `export * from 'zova-module-${moduleName}';`;
181
- await fse.outputFile(fileComponents, contentComponents);
182
- // index
183
- const exportIndexContent = "export * from './components.js';";
184
- await generateRestIndex(options, modulePath, exportIndexContent);
185
- }
@@ -8,12 +8,7 @@ import path from 'node:path';
8
8
 
9
9
  import type { IControllerInfo } from './types.ts';
10
10
 
11
- import { generateRestIndex } from './utils.ts';
12
-
13
- export async function generateMetaPage(
14
- options: IMetadataCustomGenerateOptions,
15
- globFiles: [IGlobBeanFile, IControllerInfo][],
16
- ) {
11
+ export async function generateMetaPage(options: IMetadataCustomGenerateOptions, globFiles: [IGlobBeanFile, IControllerInfo][]) {
17
12
  if (globFiles.length === 0) return '';
18
13
  const { moduleName } = options;
19
14
  const contentImports: string[] = [];
@@ -34,27 +29,16 @@ export async function generateMetaPage(
34
29
  if (hasSchemaParams || hasSchemaQuery) {
35
30
  contentImports.push(`import { ${namespace} } from './page/${name}.js';`);
36
31
  // rest
37
- const restIndexFileRelative = path.relative(
38
- srcDirRest,
39
- path.join(options.modulePath, `src/.metadata/page/${name}.js`),
40
- );
41
- contentImportsRest.push(
42
- `import { ${namespace} as ${namespaceRest} } from '${restIndexFileRelative}';`,
43
- );
32
+ const restIndexFileRelative = path.relative(srcDirRest, path.join(options.modulePath, `src/.metadata/page/${name}.js`));
33
+ contentImportsRest.push(`import { ${namespace} as ${namespaceRest} } from '${restIndexFileRelative}';`);
44
34
  }
45
35
  // controller.tsx
46
36
  const { routePath, routeName } = _extractRoutePathOrName(options, globFile, controllerInfo);
47
37
  // no matter that: route.meta?.absolute
48
- const routePathFull = routePath
49
- ? `/${moduleName.replace('-', '/')}/${routePath}`
50
- : `/${moduleName.replace('-', '/')}`;
38
+ const routePathFull = routePath ? `/${moduleName.replace('-', '/')}/${routePath}` : `/${moduleName.replace('-', '/')}`;
51
39
  const routeNameFull = `${moduleName}:${routeName}`;
52
- contentPathRecords.push(
53
- _combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace),
54
- );
55
- contentPathRecordsRest.push(
56
- _combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest),
57
- );
40
+ contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace));
41
+ contentPathRecordsRest.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest));
58
42
  if (!routeName) {
59
43
  // contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, className));
60
44
  } else {
@@ -124,36 +108,14 @@ declare module 'zova-module-${moduleName}' {
124
108
  }
125
109
  /** pages: end */
126
110
  `;
127
- // restComponent
128
- await generateRestMetaPage(options, contentImportsRest, contentPathRecordsRest);
129
111
  return content;
130
112
  }
131
113
 
132
- async function generateRestMetaPage(
133
- options: IMetadataCustomGenerateOptions,
134
- _contentImportsRest: string[],
135
- contentPathRecordsRest: string[],
136
- ) {
137
- if (contentPathRecordsRest.length === 0) return;
138
- const { moduleName, modulePath } = options;
139
- // pages
140
- const contentPages = `export * from 'zova-module-${moduleName}';\n`;
141
- const filePages = path.join(modulePath, 'rest/pages.ts');
142
- await fse.outputFile(filePages, contentPages);
143
- // index
144
- const exportIndexContent = "export * from './pages.js';";
145
- await generateRestIndex(options, modulePath, exportIndexContent);
146
- }
147
-
148
114
  function _combineModuleNameControllerName(moduleName: string, className: string) {
149
115
  return `NS${toUpperCaseFirstChar(combineResourceName(className, moduleName, false, false))}`;
150
116
  }
151
117
 
152
- function _extractRoutePathOrName(
153
- options: IMetadataCustomGenerateOptions,
154
- _globFile: IGlobBeanFile,
155
- controllerInfo: IControllerInfo,
156
- ) {
118
+ function _extractRoutePathOrName(options: IMetadataCustomGenerateOptions, _globFile: IGlobBeanFile, controllerInfo: IControllerInfo) {
157
119
  const cli = options.cli;
158
120
  const targetFile = path.join(options.modulePath, 'src/routes.ts');
159
121
  const content = fse.readFileSync(targetFile).toString('utf8');
@@ -168,8 +130,7 @@ function _extractRoutePathOrName(
168
130
  return (item.node as any).properties.some(prop => {
169
131
  return (
170
132
  prop.key.name === 'component' &&
171
- (prop.value.name === controllerInfo.nameCapitalize ||
172
- prop.value.name === `ZPage${controllerInfo.nameCapitalize}`)
133
+ (prop.value.name === controllerInfo.nameCapitalize || prop.value.name === `ZPage${controllerInfo.nameCapitalize}`)
173
134
  );
174
135
  });
175
136
  });
@@ -187,12 +148,7 @@ function _extractRoutePathOrName(
187
148
  return { routePath, routeName };
188
149
  }
189
150
 
190
- function _combineContentPathRecord(
191
- key: string,
192
- hasSchemaParams,
193
- hasSchemaQuery: boolean,
194
- namespace: string,
195
- ) {
151
+ function _combineContentPathRecord(key: string, hasSchemaParams, hasSchemaQuery: boolean, namespace: string) {
196
152
  return `'${key}': TypePagePathSchema<${hasSchemaParams ? `${namespace}.ParamsInput` : 'undefined'},${hasSchemaQuery ? `${namespace}.QueryInput` : 'undefined'}>;`;
197
153
  // return `'${key}': {
198
154
  // path: ${value},
@@ -1,8 +1,3 @@
1
- import type { IMetadataCustomGenerateOptions } from '@cabloy/cli';
2
-
3
- import fse from 'fs-extra';
4
- import path from 'node:path';
5
-
6
1
  import type { IControllerInfo } from './types.ts';
7
2
 
8
3
  export function combineContentRenderAndStyle(
@@ -12,24 +7,13 @@ export function combineContentRenderAndStyle(
12
7
  genericDeclare: string,
13
8
  genericArguments: string,
14
9
  ) {
15
- const {
16
- hasRenderFirst,
17
- classNameRenderFirst,
18
- classNameRenderOthers,
19
- hasStyleFirst,
20
- classNameStyleFirst,
21
- classNameStyleOthers,
22
- } = controllerInfo;
10
+ const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers } = controllerInfo;
23
11
  const contentControllerInterfaceRecords: string[] = [];
24
12
  if (hasStyleFirst) {
25
- contentControllerInterfaceRecords.push(
26
- `export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`,
27
- );
13
+ contentControllerInterfaceRecords.push(`export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
28
14
  }
29
15
  for (const item of classNameStyleOthers) {
30
- contentControllerInterfaceRecords.push(
31
- `export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`,
32
- );
16
+ contentControllerInterfaceRecords.push(`export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`);
33
17
  }
34
18
  if (hasRenderFirst) {
35
19
  if (hasStyleFirst) {
@@ -37,20 +21,14 @@ export function combineContentRenderAndStyle(
37
21
  `export interface ${classNameRenderFirst}${genericDeclare} extends ${classNameStyleFirst}${genericArguments} {}`,
38
22
  );
39
23
  } else {
40
- contentControllerInterfaceRecords.push(
41
- `export interface ${classNameRenderFirst}${genericDeclare} extends ${className}${genericArguments} {}`,
42
- );
24
+ contentControllerInterfaceRecords.push(`export interface ${classNameRenderFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
43
25
  }
44
26
  }
45
27
  for (const item of classNameRenderOthers) {
46
28
  if (hasStyleFirst) {
47
- contentControllerInterfaceRecords.push(
48
- `export interface ${item}${genericDeclare} extends ${classNameStyleFirst}${genericArguments} {}`,
49
- );
29
+ contentControllerInterfaceRecords.push(`export interface ${item}${genericDeclare} extends ${classNameStyleFirst}${genericArguments} {}`);
50
30
  } else {
51
- contentControllerInterfaceRecords.push(
52
- `export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`,
53
- );
31
+ contentControllerInterfaceRecords.push(`export interface ${item}${genericDeclare} extends ${className}${genericArguments} {}`);
54
32
  }
55
33
  }
56
34
  if (contentControllerInterfaceRecords.length === 0) return '';
@@ -58,22 +36,3 @@ export function combineContentRenderAndStyle(
58
36
  ${contentControllerInterfaceRecords.join('\n')}
59
37
  }`;
60
38
  }
61
-
62
- export async function generateRestIndex(
63
- options: IMetadataCustomGenerateOptions,
64
- modulePath: string,
65
- append: string,
66
- ) {
67
- const { cli } = options;
68
- // index
69
- const fileIndex = path.join(modulePath, 'rest/index.ts');
70
- let contentIndex = '';
71
- if (fse.existsSync(fileIndex)) {
72
- contentIndex = (await fse.readFile(fileIndex)).toString();
73
- }
74
- if (!contentIndex.includes(append)) {
75
- contentIndex = `${contentIndex}${append}\n`;
76
- await fse.outputFile(fileIndex, contentIndex);
77
- await cli.helper.formatFile({ fileName: fileIndex });
78
- }
79
- }
package/dist/index.js CHANGED
@@ -14,9 +14,6 @@ function Bean() {
14
14
  function Service() {
15
15
  return createBeanDecorator("service", "ctx");
16
16
  }
17
- function Store() {
18
- return createBeanDecorator("store", "app");
19
- }
20
17
  function Tool() {
21
18
  return createBeanDecorator("tool", "app");
22
19
  }
@@ -279,6 +276,6 @@ function UseAopMethod(aopMethodName, options) {
279
276
  var SymbolUseOnionLocal = Symbol("SymbolUseOnionLocal");
280
277
  var SymbolUseOnionOptions = Symbol("SymbolUseOnionOptions");
281
278
  //#endregion
282
- export { Aop, AopMethod, Bean, Controller, Data, MonkeySys, Render, Scope, ScopeModuleABean, Service, ServiceAop, ServiceOnion, Store, Style, SymbolDecoratorUseAopMethod, SymbolUseOnionLocal, SymbolUseOnionOptions, Sys, SysOnion, Tool, UseAopMethod };
279
+ export { Aop, AopMethod, Bean, Controller, Data, MonkeySys, Render, Scope, ScopeModuleABean, Service, ServiceAop, ServiceOnion, Style, SymbolDecoratorUseAopMethod, SymbolUseOnionLocal, SymbolUseOnionOptions, Sys, SysOnion, Tool, UseAopMethod };
283
280
 
284
281
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/lib/bean.ts","../src/service/onion_.ts","../src/bean/sys.onion.ts","../src/types/aopMethod.ts","../src/service/aop.ts","../src/monkeySys.ts","../src/lib/scope.ts","../src/.metadata/index.ts","../src/lib/useAopMethod.ts","../src/types/onion.ts"],"sourcesContent":["import { createBeanDecorator } from 'zova';\n\nimport type { IDecoratorAopOptions } from '../types/aop.js';\nimport type { IDecoratorAopMethodOptions } from '../types/aopMethod.js';\n\nexport function Sys(): ClassDecorator {\n return createBeanDecorator('sys', 'sys');\n}\n\nexport function Bean(): ClassDecorator {\n return createBeanDecorator('bean', 'ctx');\n}\n\nexport function Service(): ClassDecorator {\n return createBeanDecorator('service', 'ctx');\n}\n\nexport function Store(): ClassDecorator {\n return createBeanDecorator('store', 'app');\n}\n\nexport function Tool(): ClassDecorator {\n return createBeanDecorator('tool', 'app');\n}\n\nexport function Data(): ClassDecorator {\n return createBeanDecorator('data', 'new');\n}\n\nexport function Controller(): ClassDecorator {\n return createBeanDecorator('controller', 'ctx');\n}\n\nexport function Render(): ClassDecorator {\n return createBeanDecorator('render', 'ctx');\n}\n\nexport function Style(): ClassDecorator {\n return createBeanDecorator('style', 'ctx');\n}\n\nexport function Aop(options: IDecoratorAopOptions): ClassDecorator {\n return createBeanDecorator('aop', 'sys', true, options);\n}\n\nexport function AopMethod<T extends IDecoratorAopMethodOptions>(options?: T): ClassDecorator {\n return createBeanDecorator('aopMethod', 'sys', true, options);\n}\n","import type { ISwapDepsItem } from '@cabloy/deps';\nimport type { OnionSceneMeta } from '@cabloy/module-info';\nimport type { Next } from 'zova';\n\nimport { compose as _compose } from '@cabloy/compose';\nimport { swapDeps } from '@cabloy/deps';\nimport { getOnionScenesMeta } from '@cabloy/module-info';\nimport { appResource, BeanSimple, cast, deepExtend, ProxyDisable } from 'zova';\n\nimport type {\n IOnionExecuteCustom,\n IOnionItem,\n IOnionOptionsDeps,\n IOnionOptionsEnable,\n IOnionOptionsMatch,\n IOnionSlice,\n TypeOnionOptionsMatchRule,\n} from '../types/onion.js';\n\nimport { SysOnion } from '../bean/sys.onion.js';\nimport { Service } from '../lib/bean.js';\n\n// const SymbolOnionsEnabled = Symbol('SymbolOnionsEnabled');\n// const SymbolOnionsEnabledWrapped = Symbol('SymbolOnionsEnabledWrapped');\n\n@ProxyDisable()\n@Service()\nexport class ServiceOnion<OPTIONS, ONIONNAME extends string> extends BeanSimple {\n protected sysOnion: SysOnion;\n sceneName: string;\n sceneMeta: OnionSceneMeta;\n\n onionsAll: IOnionItem<OPTIONS, ONIONNAME>[];\n\n // private [SymbolOnionsEnabled]: Record<string, IOnionSlice<OPTIONS, ONIONNAME>[]> = {};\n // private [SymbolOnionsEnabledWrapped]: Record<string, Function[]> = {};\n\n protected __init__(sceneName: string, sysOnion: SysOnion) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n this.sysOnion = sysOnion;\n this.sceneName = sceneName;\n this.sceneMeta = getOnionScenesMeta(this.sys.meta.module.modulesMeta.modules)[this.sceneName];\n if (this.sceneMeta.optionsPackage) {\n this._initOnionsAll();\n this._swapOnions(this.onionsAll);\n }\n }\n\n private _initOnionsAll() {\n this.onionsAll = [];\n for (const moduleName in this.sys.meta.module.modulesMeta.modules) {\n const module = this.sys.meta.module.modulesMeta.modules[moduleName];\n const nodeItems = module.info.onionsMeta?.onionsConfig?.[this.sceneName];\n if (!nodeItems) continue;\n for (const itemName in nodeItems) {\n let itemOptions = nodeItems[itemName];\n // extend config\n const onionName = `${moduleName}:${itemName}`;\n const optionsConfig = this.sys.config.onions[this.sceneName]?.[onionName];\n if (optionsConfig) {\n itemOptions = deepExtend({}, itemOptions, optionsConfig);\n }\n this.onionsAll.push({\n name: onionName,\n options: itemOptions,\n } as any);\n }\n }\n }\n\n private _swapOnions(onions: IOnionItem<OPTIONS, ONIONNAME>[]) {\n swapDeps(onions as ISwapDepsItem[], {\n name: 'name',\n dependencies: item => {\n const onionOptions = cast<IOnionItem<OPTIONS, ONIONNAME>>(item)\n .options as IOnionOptionsDeps<string>;\n return onionOptions.dependencies as any;\n },\n dependents: item => {\n const onionOptions = cast<IOnionItem<OPTIONS, ONIONNAME>>(item)\n .options as IOnionOptionsDeps<string>;\n return onionOptions.dependents as any;\n },\n });\n }\n\n // getOnionsEnabled(selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabled][selector]) {\n // this[SymbolOnionsEnabled][selector] = this.onionsGlobal.filter(onionSlice => {\n // const onionOptions = onionSlice.beanOptions.options as IOnionOptionsEnable & IOnionOptionsMatch<string>;\n // return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector);\n // }) as unknown as IOnionSlice<OPTIONS, ONIONNAME>[];\n // }\n // return this[SymbolOnionsEnabled][selector];\n // }\n\n // getOnionsEnabledOfMeta(beanName: string, selector?: string) {\n // return this.getOnionsEnabled(selector).filter(item => item.beanOptions.name === beanName);\n // }\n\n // getOnionsEnabledWrapped(wrapFn: Function, selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabledWrapped][selector]) {\n // const onions = this.getOnionsEnabled(selector);\n // this[SymbolOnionsEnabledWrapped][selector] = onions.map(item => {\n // return wrapFn(item);\n // });\n // }\n // return this[SymbolOnionsEnabledWrapped][selector];\n // }\n\n // getOnionSlice(onionName: ONIONNAME): IOnionSlice<OPTIONS, ONIONNAME> {\n // return this.onionsNormal[onionName];\n // }\n\n // getOnionOptions<OPTIONS>(onionName: ONIONNAME): OPTIONS | undefined {\n // return this.getOnionSlice(onionName).beanOptions.options as OPTIONS | undefined;\n // }\n\n async loadOnionsFromPackage(\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ): Promise<IOnionSlice<OPTIONS, ONIONNAME>[]> {\n // onionItems\n const onionItems = this.getOnionsEnabled(this.onionsAll, selector, matchThis, ...matchArgs);\n // loadOnions\n return await this.loadOnions(onionItems, selector, matchThis, ...matchArgs);\n }\n\n async loadOnions<T>(\n onionItems: IOnionItem<OPTIONS, ONIONNAME> | IOnionItem<OPTIONS, ONIONNAME>[],\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ): Promise<IOnionSlice<OPTIONS, ONIONNAME, T>[]> {\n if (!Array.isArray(onionItems)) onionItems = [onionItems];\n if (onionItems.length === 0) return [];\n // load modules\n const moduleNames = onionItems.map(item => item.name.split(':')[0]);\n await this._loadModules(moduleNames);\n // onion slices\n const onionSlices: IOnionSlice<OPTIONS, ONIONNAME, T>[] = [];\n for (const item of onionItems) {\n const beanFullName = item.name.replace(':', `.${this.sceneName}.`);\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) throw new Error(`behavior not found: ${beanFullName}`);\n // options\n let options;\n if (beanOptions.optionsPrimitive) {\n options = item.options !== undefined ? item.options : beanOptions.options;\n } else {\n options =\n item.options !== undefined\n ? deepExtend({}, beanOptions.options, item.options)\n : beanOptions.options;\n }\n // ok\n onionSlices.push({ name: item.name, options, beanFullName });\n }\n // optionsPackage\n if (this.sceneMeta.optionsPackage) return onionSlices;\n // swap\n this._swapOnions(onionSlices);\n // filter\n return this.getOnionsEnabled(onionSlices, selector, matchThis, ...matchArgs);\n }\n\n getOnionsEnabled<T>(\n onions: IOnionItem<OPTIONS, ONIONNAME>[],\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ): IOnionSlice<OPTIONS, ONIONNAME, T>[] {\n if (!onions) return [];\n return onions.filter(onionItem => {\n const onionOptions = onionItem.options as IOnionOptionsEnable &\n IOnionOptionsMatch<TypeOnionOptionsMatchRule<string>>;\n return this.sysOnion.checkOnionOptionsEnabled(\n onionOptions,\n selector,\n matchThis,\n ...matchArgs,\n );\n }) as unknown as IOnionSlice<OPTIONS, ONIONNAME, T>[];\n }\n\n compose(\n onions: IOnionSlice<OPTIONS, ONIONNAME>[],\n executeCustom: IOnionExecuteCustom<OPTIONS, ONIONNAME>,\n ) {\n // fns\n const fns: Function[] = [];\n for (const item of onions) {\n fns.push(this._wrapOnion(item, executeCustom));\n }\n // compose\n return _compose(fns);\n }\n\n async _loadModules(moduleNames: string[]) {\n // load modules\n moduleNames = Array.from(new Set(moduleNames)).filter(item => !this.sys.meta.module.get(item));\n await this.sys.meta.module.loadModules(moduleNames);\n }\n\n /** internal */\n public _wrapOnion(\n item: IOnionSlice<OPTIONS, ONIONNAME>,\n executeCustom: IOnionExecuteCustom<OPTIONS, ONIONNAME>,\n ) {\n const fn = (data: any, next: Next) => {\n return executeCustom(item, data, next);\n };\n fn._name = item.name;\n return fn;\n }\n}\n","import { checkMeta, isNil, matchSelector } from '@cabloy/utils';\nimport { BeanBase, ProxyDisable } from 'zova';\n\nimport type {\n IOnionOptionsEnable,\n IOnionOptionsMatch,\n IOnionOptionsMeta,\n TypeOnionOptionsMatchRules,\n} from '../types/onion.js';\n\nimport { Sys } from '../lib/bean.js';\nimport { ServiceOnion } from '../service/onion_.js';\n\n@ProxyDisable()\n@Sys()\nexport class SysOnion extends BeanBase {\n private __instances: Record<string, any> = {};\n\n protected __get__(prop: string) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n if (!this.__instances[prop]) {\n this.__instances[prop] = this.bean._newBeanSimple(ServiceOnion, false, prop, this);\n }\n return this.__instances[prop];\n }\n\n public checkOnionOptionsEnabled(\n options: IOnionOptionsEnable & IOnionOptionsMatch<any>,\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ) {\n if (options.enable === false) return false;\n if (!this.checkOnionOptionsMeta(options.meta)) return false;\n if (isNil(selector) || selector === false) return true;\n if (isNil(options.match) && isNil(options.ignore)) return true;\n return (\n (!isNil(options.match) &&\n __onionMatchSelector(options.match, selector, matchThis, ...matchArgs)) ||\n (!isNil(options.ignore) &&\n !__onionMatchSelector(options.ignore, selector, matchThis, ...matchArgs))\n );\n }\n\n public checkOnionOptionsMeta(meta?: IOnionOptionsMeta) {\n return checkMeta(meta, this.sys.config.meta);\n }\n}\n\nfunction __onionMatchSelector(\n match: TypeOnionOptionsMatchRules<string>,\n selector: string | boolean,\n matchThis: any,\n ...matchArgs: any[]\n) {\n return matchSelector(match, selector, matchThis, ...matchArgs);\n}\n","import type { Next, NextSync, OmitNever } from 'zova';\n\nimport type { ServiceOnion } from '../service/onion_.js';\nimport type { IOnionOptionsEnable } from './onion.js';\n\nexport const SymbolDecoratorUseAopMethod = Symbol('SymbolDecoratorUseAopMethod');\nexport interface IUseAopMethodPropMetadata<T extends keyof IAopMethodRecord = never> {\n beanInstance?: any;\n onionName?: T;\n options?: Partial<IAopMethodRecord[T]>;\n}\n\nexport interface IAopMethodRecord {}\n\nexport interface IAopMethodGet {\n get(options: IDecoratorAopMethodOptions, next: NextSync, receiver: any, prop: string): any;\n}\n\nexport interface IAopMethodSet {\n set(\n options: IDecoratorAopMethodOptions,\n value: any,\n next: NextSync,\n receiver: any,\n prop: string,\n ): boolean;\n}\n\nexport interface IAopMethodExecute {\n execute(\n options: IDecoratorAopMethodOptions,\n args: [],\n next: Next | NextSync,\n receiver: any,\n prop: string,\n ): Promise<any> | any;\n}\n\nexport interface IDecoratorAopMethodOptions extends IOnionOptionsEnable {}\n\ndeclare module 'zova-module-a-bean' {\n export interface SysOnion {\n aopMethod: ServiceOnion<IDecoratorAopMethodOptions, keyof IAopMethodRecord>;\n }\n}\n\ndeclare module 'zova' {\n export interface ConfigOnions {\n aopMethod: OmitNever<IAopMethodRecord>;\n }\n\n export interface IBeanSceneRecord {\n aopMethod: never;\n }\n}\n","import type { BeanAopMethodBase, Constructable, IBeanRecord } from 'zova';\n\nimport { appMetadata, appResource, BeanBase, ProxyDisable, Use } from 'zova';\n\nimport type { IAopRecord, IDecoratorAopOptions } from '../types/aop.js';\nimport type { IOnionItem, IOnionSlice } from '../types/onion.js';\n\nimport { SysOnion } from '../bean/sys.onion.js';\nimport { Service } from '../lib/bean.js';\nimport {\n IAopMethodRecord,\n IDecoratorAopMethodOptions,\n IUseAopMethodPropMetadata,\n SymbolDecoratorUseAopMethod,\n} from '../types/aopMethod.js';\n\ntype AopMethodsMatchedAll = Record<string, IUseAopMethodPropMetadata[]>;\n\n@ProxyDisable()\n@Service()\nexport class ServiceAop extends BeanBase {\n @Use()\n $$sysOnion: SysOnion;\n\n async findAopsMatched<T>(\n A: Constructable<T>,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched<K extends keyof IBeanRecord>(\n beanFullName: K,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched(\n beanFullName: string,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched<T>(\n beanFullName: Constructable<T> | string,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined> {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName as any);\n if (!beanOptions) return;\n // loadOnions\n return await this.$$sysOnion.aop.loadOnionsFromPackage(beanOptions.beanFullName);\n }\n\n async findAopMethodsMatched<T>(A: Constructable<T>): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched<K extends keyof IBeanRecord>(\n beanFullName: K,\n ): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched(beanFullName: string): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched<T>(\n beanFullName: Constructable<T> | string,\n ): Promise<AopMethodsMatchedAll | undefined> {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName as any);\n if (!beanOptions) return;\n const aopMethodsMatchedAll: AopMethodsMatchedAll = {};\n const uses = appMetadata.getMetadata<Record<string, IUseAopMethodPropMetadata[]>>(\n SymbolDecoratorUseAopMethod,\n beanOptions.beanClass.prototype,\n );\n for (const prop in uses) {\n const onionItems: IOnionItem<IDecoratorAopMethodOptions, keyof IAopMethodRecord>[] = [];\n const aopMethods: IUseAopMethodPropMetadata[] = uses[prop];\n for (const aopMethod of aopMethods) {\n onionItems.push({\n name: aopMethod.onionName as never,\n options: aopMethod.options,\n });\n }\n // load onions\n const onionSlices = await this.$$sysOnion.aopMethod.loadOnions<BeanAopMethodBase>(onionItems);\n // aopMethodsMatched\n const aopMethodsMatched: IUseAopMethodPropMetadata[] = [];\n for (const onionSlice of onionSlices) {\n const beanInstance = await this.sys.bean._getBean(onionSlice.beanFullName as any, true);\n aopMethodsMatched.push({\n onionName: onionSlice.name as any,\n beanInstance,\n options: onionSlice.options as any,\n });\n }\n aopMethodsMatchedAll[prop] = aopMethodsMatched;\n }\n return Object.keys(aopMethodsMatchedAll).length === 0 ? undefined : aopMethodsMatchedAll;\n }\n}\n","import type { IMonkeySysInitialize } from 'zova';\n\nimport { BeanSimple } from 'zova';\n\nexport class MonkeySys extends BeanSimple implements IMonkeySysInitialize {\n async sysInitialize() {\n let beansPreload: string[] = [];\n for (const moduleName in this.sys.meta.module.modulesMeta.modules) {\n const module = this.sys.meta.module.modulesMeta.modules[moduleName];\n if (!module.info.onionsMeta?.beansPreload) continue;\n beansPreload = beansPreload.concat(module.info.onionsMeta?.beansPreload);\n }\n const promises: Promise<any>[] = beansPreload.map(item => {\n return this.sys.bean._getBean(item as any, false);\n });\n await Promise.all(promises);\n }\n}\n","import { createBeanDecorator } from 'zova';\n\nexport function Scope(): ClassDecorator {\n return createBeanDecorator('scope', 'app', false);\n}\n","// eslint-disable\n/** sys: begin */\nexport * from '../bean/sys.onion.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-bean' {\n \n export interface SysOnion {\n /** @internal */\n get scope(): ScopeModuleABean;\n }\n\n export interface SysOnion {\n get $beanFullName(): 'a-bean.sys.onion';\n get $onionName(): 'a-bean:onion';\n \n } \n}\n/** sys: end */\n/** sys: begin */\nimport { SysOnion } from '../bean/sys.onion.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-bean.sys.onion': SysOnion;\n }\n}\n/** sys: end */\n/** service: begin */\nexport * from '../service/aop.js';\nexport * from '../service/onion_.js';\n\nimport 'zova-module-a-bean';\ndeclare module 'zova-module-a-bean' {\n \n export interface IServiceRecord {\n 'a-bean:aop': never;\n }\n\n \n}\ndeclare module 'zova-module-a-bean' {\n \n export interface ServiceAop {\n /** @internal */\n get scope(): ScopeModuleABean;\n }\n\n export interface ServiceAop {\n get $beanFullName(): 'a-bean.service.aop';\n get $onionName(): 'a-bean:aop';\n \n } \n}\n/** service: end */\n/** service: begin */\nimport { ServiceAop } from '../service/aop.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-bean.service.aop': ServiceAop;\n }\n}\n/** service: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil } from 'zova';\nimport { Scope } from '../lib/scope.js';\n\n@Scope()\nexport class ScopeModuleABean extends BeanScopeBase {}\n\nexport interface ScopeModuleABean {\n util: BeanScopeUtil;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-bean': ScopeModuleABean;\n }\n \n \n\n \n\n \n}\n \n/** scope: end */\n","import type { MetadataKey } from 'zova';\n\nimport { appMetadata, registerMappedClassMetadataKey } from 'zova';\n\nimport type { IAopMethodRecord, IUseAopMethodPropMetadata } from '../types/aopMethod.js';\n\nimport { SymbolDecoratorUseAopMethod } from '../types/aopMethod.js';\n\nexport function UseAopMethod<T extends keyof IAopMethodRecord>(\n aopMethodName: T,\n options?: Partial<IAopMethodRecord[T]>,\n): PropertyDescriptor & MethodDecorator {\n return function (target: object, prop: MetadataKey, descriptor?: PropertyDescriptor) {\n registerMappedClassMetadataKey(target, SymbolDecoratorUseAopMethod);\n const uses = appMetadata.getOwnMetadataMap<MetadataKey, IUseAopMethodPropMetadata<T>[]>(\n true,\n SymbolDecoratorUseAopMethod,\n target,\n );\n if (!uses[prop]) uses[prop] = [];\n uses[prop].push({ onionName: aopMethodName, options });\n return descriptor;\n } as any;\n}\n","import type { ZovaOnionOptionsMeta } from '@cabloy/module-info';\n\nexport const SymbolUseOnionLocal = Symbol('SymbolUseOnionLocal');\nexport const SymbolUseOnionOptions = Symbol('SymbolUseOnionOptions');\n\nexport type TypeComposer = (context: any, next?: any) => any;\n\nexport type IOnionExecuteCustom<OPTIONS, ONIONNAME> = (\n onionSlice: IOnionSlice<OPTIONS, ONIONNAME>,\n data: any,\n next: Function,\n) => any;\n\nexport type TypeUseOnionGlobalBaseOptions<T> = Omit<\n T,\n 'global' | 'dependencies' | 'dependents' | 'ignore' | 'match'\n>;\n\nexport interface IOnionOptionsEnable {\n enable?: boolean;\n meta?: IOnionOptionsMeta;\n}\n\nexport type TypeOnionOptionsMatchFunction = (this: any, ...args: any[]) => boolean;\nexport type TypeOnionOptionsMatchRule<T> = T | RegExp | TypeOnionOptionsMatchFunction;\nexport type TypeOnionOptionsMatchRules<T> =\n | TypeOnionOptionsMatchRule<T>[]\n | TypeOnionOptionsMatchRule<T>;\n\nexport interface IOnionOptionsMatch<T> {\n match?: T[] | T;\n ignore?: T[] | T;\n}\n\nexport interface IOnionOptionsDeps<T> {\n dependencies?: T[] | T;\n dependents?: T[] | T;\n}\n\nexport interface IOnionOptionsMeta extends ZovaOnionOptionsMeta {}\n\nexport interface IOnionOptionsBase<T extends string>\n extends IOnionOptionsEnable, IOnionOptionsMatch<TypeOnionOptionsMatchRule<T>> {}\n\nexport interface IOnionSlice<OPTIONS = unknown, ONIONNAME = string, T = unknown> {\n name: ONIONNAME;\n options: OPTIONS;\n beanFullName: string;\n beanInstance?: T;\n}\n\nexport interface IOnionItem<OPTIONS = unknown, ONIONNAME = string> {\n name: ONIONNAME;\n options?: Partial<OPTIONS>;\n}\n\nexport interface ConfigOnions {}\n\ndeclare module 'zova' {\n export interface ZovaConfig {\n onions: ConfigOnions;\n }\n}\n"],"mappings":";;;;;;;;AAEA,QAAO,oBAAO,OAAsB,MAAM;;;AAG1C,QAAO,oBAAgB,QAAc,MAAC;;AAEtC,SAAA,UAAA;;;AAGA,SAAS,QAAA;AACT,QAAA,oBAAA,SAAA,MAAA;;AAEA,SAAgB,OAAO;AACrB,QAAO,oBAAoB,QAAQ,MAAI;;;AAGzC,QAAO,oBAAkB,QAAA,MAAe;;AAExC,SAAA,aAAA;;;AAGA,SAAS,SAAA;AACT,QAAA,oBAAA,UAAA,MAAA;;AAEA,SAAgB,QAAQ;AACtB,QAAO,oBAAoB,SAAS,MAAK;;;AAG3C,QAAO,oBAAsB,OAAC,OAAA,MAAe,QAAA;;AAE7C,SAAA,UAAA,SAAA;;;;;AC/BA,IAAA,QAAO,SAAO,SAAA;AAWd,IAAE,gBAAU,SAAA,cAAA,EAAA,UAAA,SAAA,EAAA,UAAA,SAAA,EACV,QAAA,UACD,CAAC,EAAA,OAAA,WAAA,QAAmB,WAAA,QAAA,WAAA,MAAA,qBAAA,WAAA;CACnB,YAAA,GAAA,MAAkB;AAClB,QAAA,GAAW,KAAA;AACX,OAAA,WAAA,KAAA;AACA,OAAO,YAAQ,KAAS;;AAE1B,OAAS,YAAW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,QAAA,EAA2B;;GAE9B,WAAU;GACd;GACA,CAAA;AACC,SAAA;;;;;ACXH,IAAa,sBAAsB,OAAO,sBAAqB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/lib/bean.ts","../src/service/onion_.ts","../src/bean/sys.onion.ts","../src/types/aopMethod.ts","../src/service/aop.ts","../src/monkeySys.ts","../src/lib/scope.ts","../src/.metadata/index.ts","../src/lib/useAopMethod.ts","../src/types/onion.ts"],"sourcesContent":["import { createBeanDecorator } from 'zova';\n\nimport type { IDecoratorAopOptions } from '../types/aop.js';\nimport type { IDecoratorAopMethodOptions } from '../types/aopMethod.js';\n\nexport function Sys(): ClassDecorator {\n return createBeanDecorator('sys', 'sys');\n}\n\nexport function Bean(): ClassDecorator {\n return createBeanDecorator('bean', 'ctx');\n}\n\nexport function Service(): ClassDecorator {\n return createBeanDecorator('service', 'ctx');\n}\n\nexport function Tool(): ClassDecorator {\n return createBeanDecorator('tool', 'app');\n}\n\nexport function Data(): ClassDecorator {\n return createBeanDecorator('data', 'new');\n}\n\nexport function Controller(): ClassDecorator {\n return createBeanDecorator('controller', 'ctx');\n}\n\nexport function Render(): ClassDecorator {\n return createBeanDecorator('render', 'ctx');\n}\n\nexport function Style(): ClassDecorator {\n return createBeanDecorator('style', 'ctx');\n}\n\nexport function Aop(options: IDecoratorAopOptions): ClassDecorator {\n return createBeanDecorator('aop', 'sys', true, options);\n}\n\nexport function AopMethod<T extends IDecoratorAopMethodOptions>(options?: T): ClassDecorator {\n return createBeanDecorator('aopMethod', 'sys', true, options);\n}\n","import type { ISwapDepsItem } from '@cabloy/deps';\nimport type { OnionSceneMeta } from '@cabloy/module-info';\nimport type { Next } from 'zova';\n\nimport { compose as _compose } from '@cabloy/compose';\nimport { swapDeps } from '@cabloy/deps';\nimport { getOnionScenesMeta } from '@cabloy/module-info';\nimport { appResource, BeanSimple, cast, deepExtend, ProxyDisable } from 'zova';\n\nimport type {\n IOnionExecuteCustom,\n IOnionItem,\n IOnionOptionsDeps,\n IOnionOptionsEnable,\n IOnionOptionsMatch,\n IOnionSlice,\n TypeOnionOptionsMatchRule,\n} from '../types/onion.js';\n\nimport { SysOnion } from '../bean/sys.onion.js';\nimport { Service } from '../lib/bean.js';\n\n// const SymbolOnionsEnabled = Symbol('SymbolOnionsEnabled');\n// const SymbolOnionsEnabledWrapped = Symbol('SymbolOnionsEnabledWrapped');\n\n@ProxyDisable()\n@Service()\nexport class ServiceOnion<OPTIONS, ONIONNAME extends string> extends BeanSimple {\n protected sysOnion: SysOnion;\n sceneName: string;\n sceneMeta: OnionSceneMeta;\n\n onionsAll: IOnionItem<OPTIONS, ONIONNAME>[];\n\n // private [SymbolOnionsEnabled]: Record<string, IOnionSlice<OPTIONS, ONIONNAME>[]> = {};\n // private [SymbolOnionsEnabledWrapped]: Record<string, Function[]> = {};\n\n protected __init__(sceneName: string, sysOnion: SysOnion) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n this.sysOnion = sysOnion;\n this.sceneName = sceneName;\n this.sceneMeta = getOnionScenesMeta(this.sys.meta.module.modulesMeta.modules)[this.sceneName];\n if (this.sceneMeta.optionsPackage) {\n this._initOnionsAll();\n this._swapOnions(this.onionsAll);\n }\n }\n\n private _initOnionsAll() {\n this.onionsAll = [];\n for (const moduleName in this.sys.meta.module.modulesMeta.modules) {\n const module = this.sys.meta.module.modulesMeta.modules[moduleName];\n const nodeItems = module.info.onionsMeta?.onionsConfig?.[this.sceneName];\n if (!nodeItems) continue;\n for (const itemName in nodeItems) {\n let itemOptions = nodeItems[itemName];\n // extend config\n const onionName = `${moduleName}:${itemName}`;\n const optionsConfig = this.sys.config.onions[this.sceneName]?.[onionName];\n if (optionsConfig) {\n itemOptions = deepExtend({}, itemOptions, optionsConfig);\n }\n this.onionsAll.push({\n name: onionName,\n options: itemOptions,\n } as any);\n }\n }\n }\n\n private _swapOnions(onions: IOnionItem<OPTIONS, ONIONNAME>[]) {\n swapDeps(onions as ISwapDepsItem[], {\n name: 'name',\n dependencies: item => {\n const onionOptions = cast<IOnionItem<OPTIONS, ONIONNAME>>(item)\n .options as IOnionOptionsDeps<string>;\n return onionOptions.dependencies as any;\n },\n dependents: item => {\n const onionOptions = cast<IOnionItem<OPTIONS, ONIONNAME>>(item)\n .options as IOnionOptionsDeps<string>;\n return onionOptions.dependents as any;\n },\n });\n }\n\n // getOnionsEnabled(selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabled][selector]) {\n // this[SymbolOnionsEnabled][selector] = this.onionsGlobal.filter(onionSlice => {\n // const onionOptions = onionSlice.beanOptions.options as IOnionOptionsEnable & IOnionOptionsMatch<string>;\n // return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector);\n // }) as unknown as IOnionSlice<OPTIONS, ONIONNAME>[];\n // }\n // return this[SymbolOnionsEnabled][selector];\n // }\n\n // getOnionsEnabledOfMeta(beanName: string, selector?: string) {\n // return this.getOnionsEnabled(selector).filter(item => item.beanOptions.name === beanName);\n // }\n\n // getOnionsEnabledWrapped(wrapFn: Function, selector?: string) {\n // if (!selector) selector = '';\n // if (!this[SymbolOnionsEnabledWrapped][selector]) {\n // const onions = this.getOnionsEnabled(selector);\n // this[SymbolOnionsEnabledWrapped][selector] = onions.map(item => {\n // return wrapFn(item);\n // });\n // }\n // return this[SymbolOnionsEnabledWrapped][selector];\n // }\n\n // getOnionSlice(onionName: ONIONNAME): IOnionSlice<OPTIONS, ONIONNAME> {\n // return this.onionsNormal[onionName];\n // }\n\n // getOnionOptions<OPTIONS>(onionName: ONIONNAME): OPTIONS | undefined {\n // return this.getOnionSlice(onionName).beanOptions.options as OPTIONS | undefined;\n // }\n\n async loadOnionsFromPackage(\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ): Promise<IOnionSlice<OPTIONS, ONIONNAME>[]> {\n // onionItems\n const onionItems = this.getOnionsEnabled(this.onionsAll, selector, matchThis, ...matchArgs);\n // loadOnions\n return await this.loadOnions(onionItems, selector, matchThis, ...matchArgs);\n }\n\n async loadOnions<T>(\n onionItems: IOnionItem<OPTIONS, ONIONNAME> | IOnionItem<OPTIONS, ONIONNAME>[],\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ): Promise<IOnionSlice<OPTIONS, ONIONNAME, T>[]> {\n if (!Array.isArray(onionItems)) onionItems = [onionItems];\n if (onionItems.length === 0) return [];\n // load modules\n const moduleNames = onionItems.map(item => item.name.split(':')[0]);\n await this._loadModules(moduleNames);\n // onion slices\n const onionSlices: IOnionSlice<OPTIONS, ONIONNAME, T>[] = [];\n for (const item of onionItems) {\n const beanFullName = item.name.replace(':', `.${this.sceneName}.`);\n const beanOptions = appResource.getBean(beanFullName);\n if (!beanOptions) throw new Error(`behavior not found: ${beanFullName}`);\n // options\n let options;\n if (beanOptions.optionsPrimitive) {\n options = item.options !== undefined ? item.options : beanOptions.options;\n } else {\n options =\n item.options !== undefined\n ? deepExtend({}, beanOptions.options, item.options)\n : beanOptions.options;\n }\n // ok\n onionSlices.push({ name: item.name, options, beanFullName });\n }\n // optionsPackage\n if (this.sceneMeta.optionsPackage) return onionSlices;\n // swap\n this._swapOnions(onionSlices);\n // filter\n return this.getOnionsEnabled(onionSlices, selector, matchThis, ...matchArgs);\n }\n\n getOnionsEnabled<T>(\n onions: IOnionItem<OPTIONS, ONIONNAME>[],\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ): IOnionSlice<OPTIONS, ONIONNAME, T>[] {\n if (!onions) return [];\n return onions.filter(onionItem => {\n const onionOptions = onionItem.options as IOnionOptionsEnable &\n IOnionOptionsMatch<TypeOnionOptionsMatchRule<string>>;\n return this.sysOnion.checkOnionOptionsEnabled(\n onionOptions,\n selector,\n matchThis,\n ...matchArgs,\n );\n }) as unknown as IOnionSlice<OPTIONS, ONIONNAME, T>[];\n }\n\n compose(\n onions: IOnionSlice<OPTIONS, ONIONNAME>[],\n executeCustom: IOnionExecuteCustom<OPTIONS, ONIONNAME>,\n ) {\n // fns\n const fns: Function[] = [];\n for (const item of onions) {\n fns.push(this._wrapOnion(item, executeCustom));\n }\n // compose\n return _compose(fns);\n }\n\n async _loadModules(moduleNames: string[]) {\n // load modules\n moduleNames = Array.from(new Set(moduleNames)).filter(item => !this.sys.meta.module.get(item));\n await this.sys.meta.module.loadModules(moduleNames);\n }\n\n /** internal */\n public _wrapOnion(\n item: IOnionSlice<OPTIONS, ONIONNAME>,\n executeCustom: IOnionExecuteCustom<OPTIONS, ONIONNAME>,\n ) {\n const fn = (data: any, next: Next) => {\n return executeCustom(item, data, next);\n };\n fn._name = item.name;\n return fn;\n }\n}\n","import { checkMeta, isNil, matchSelector } from '@cabloy/utils';\nimport { BeanBase, ProxyDisable } from 'zova';\n\nimport type {\n IOnionOptionsEnable,\n IOnionOptionsMatch,\n IOnionOptionsMeta,\n TypeOnionOptionsMatchRules,\n} from '../types/onion.js';\n\nimport { Sys } from '../lib/bean.js';\nimport { ServiceOnion } from '../service/onion_.js';\n\n@ProxyDisable()\n@Sys()\nexport class SysOnion extends BeanBase {\n private __instances: Record<string, any> = {};\n\n protected __get__(prop: string) {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n if (!this.__instances[prop]) {\n this.__instances[prop] = this.bean._newBeanSimple(ServiceOnion, false, prop, this);\n }\n return this.__instances[prop];\n }\n\n public checkOnionOptionsEnabled(\n options: IOnionOptionsEnable & IOnionOptionsMatch<any>,\n selector?: string | boolean,\n matchThis?: any,\n ...matchArgs: any[]\n ) {\n if (options.enable === false) return false;\n if (!this.checkOnionOptionsMeta(options.meta)) return false;\n if (isNil(selector) || selector === false) return true;\n if (isNil(options.match) && isNil(options.ignore)) return true;\n return (\n (!isNil(options.match) &&\n __onionMatchSelector(options.match, selector, matchThis, ...matchArgs)) ||\n (!isNil(options.ignore) &&\n !__onionMatchSelector(options.ignore, selector, matchThis, ...matchArgs))\n );\n }\n\n public checkOnionOptionsMeta(meta?: IOnionOptionsMeta) {\n return checkMeta(meta, this.sys.config.meta);\n }\n}\n\nfunction __onionMatchSelector(\n match: TypeOnionOptionsMatchRules<string>,\n selector: string | boolean,\n matchThis: any,\n ...matchArgs: any[]\n) {\n return matchSelector(match, selector, matchThis, ...matchArgs);\n}\n","import type { Next, NextSync, OmitNever } from 'zova';\n\nimport type { ServiceOnion } from '../service/onion_.js';\nimport type { IOnionOptionsEnable } from './onion.js';\n\nexport const SymbolDecoratorUseAopMethod = Symbol('SymbolDecoratorUseAopMethod');\nexport interface IUseAopMethodPropMetadata<T extends keyof IAopMethodRecord = never> {\n beanInstance?: any;\n onionName?: T;\n options?: Partial<IAopMethodRecord[T]>;\n}\n\nexport interface IAopMethodRecord {}\n\nexport interface IAopMethodGet {\n get(options: IDecoratorAopMethodOptions, next: NextSync, receiver: any, prop: string): any;\n}\n\nexport interface IAopMethodSet {\n set(\n options: IDecoratorAopMethodOptions,\n value: any,\n next: NextSync,\n receiver: any,\n prop: string,\n ): boolean;\n}\n\nexport interface IAopMethodExecute {\n execute(\n options: IDecoratorAopMethodOptions,\n args: [],\n next: Next | NextSync,\n receiver: any,\n prop: string,\n ): Promise<any> | any;\n}\n\nexport interface IDecoratorAopMethodOptions extends IOnionOptionsEnable {}\n\ndeclare module 'zova-module-a-bean' {\n export interface SysOnion {\n aopMethod: ServiceOnion<IDecoratorAopMethodOptions, keyof IAopMethodRecord>;\n }\n}\n\ndeclare module 'zova' {\n export interface ConfigOnions {\n aopMethod: OmitNever<IAopMethodRecord>;\n }\n\n export interface IBeanSceneRecord {\n aopMethod: never;\n }\n}\n","import type { BeanAopMethodBase, Constructable, IBeanRecord } from 'zova';\n\nimport { appMetadata, appResource, BeanBase, ProxyDisable, Use } from 'zova';\n\nimport type { IAopRecord, IDecoratorAopOptions } from '../types/aop.js';\nimport type { IOnionItem, IOnionSlice } from '../types/onion.js';\n\nimport { SysOnion } from '../bean/sys.onion.js';\nimport { Service } from '../lib/bean.js';\nimport {\n IAopMethodRecord,\n IDecoratorAopMethodOptions,\n IUseAopMethodPropMetadata,\n SymbolDecoratorUseAopMethod,\n} from '../types/aopMethod.js';\n\ntype AopMethodsMatchedAll = Record<string, IUseAopMethodPropMetadata[]>;\n\n@ProxyDisable()\n@Service()\nexport class ServiceAop extends BeanBase {\n @Use()\n $$sysOnion: SysOnion;\n\n async findAopsMatched<T>(\n A: Constructable<T>,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched<K extends keyof IBeanRecord>(\n beanFullName: K,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched(\n beanFullName: string,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched<T>(\n beanFullName: Constructable<T> | string,\n ): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined> {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName as any);\n if (!beanOptions) return;\n // loadOnions\n return await this.$$sysOnion.aop.loadOnionsFromPackage(beanOptions.beanFullName);\n }\n\n async findAopMethodsMatched<T>(A: Constructable<T>): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched<K extends keyof IBeanRecord>(\n beanFullName: K,\n ): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched(beanFullName: string): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched<T>(\n beanFullName: Constructable<T> | string,\n ): Promise<AopMethodsMatchedAll | undefined> {\n if (process.env.DEV && this.bean.containerType !== 'sys') {\n throw new Error('should in sys container');\n }\n // beanOptions\n const beanOptions = appResource.getBean(beanFullName as any);\n if (!beanOptions) return;\n const aopMethodsMatchedAll: AopMethodsMatchedAll = {};\n const uses = appMetadata.getMetadata<Record<string, IUseAopMethodPropMetadata[]>>(\n SymbolDecoratorUseAopMethod,\n beanOptions.beanClass.prototype,\n );\n for (const prop in uses) {\n const onionItems: IOnionItem<IDecoratorAopMethodOptions, keyof IAopMethodRecord>[] = [];\n const aopMethods: IUseAopMethodPropMetadata[] = uses[prop];\n for (const aopMethod of aopMethods) {\n onionItems.push({\n name: aopMethod.onionName as never,\n options: aopMethod.options,\n });\n }\n // load onions\n const onionSlices = await this.$$sysOnion.aopMethod.loadOnions<BeanAopMethodBase>(onionItems);\n // aopMethodsMatched\n const aopMethodsMatched: IUseAopMethodPropMetadata[] = [];\n for (const onionSlice of onionSlices) {\n const beanInstance = await this.sys.bean._getBean(onionSlice.beanFullName as any, true);\n aopMethodsMatched.push({\n onionName: onionSlice.name as any,\n beanInstance,\n options: onionSlice.options as any,\n });\n }\n aopMethodsMatchedAll[prop] = aopMethodsMatched;\n }\n return Object.keys(aopMethodsMatchedAll).length === 0 ? undefined : aopMethodsMatchedAll;\n }\n}\n","import type { IMonkeySysInitialize } from 'zova';\n\nimport { BeanSimple } from 'zova';\n\nexport class MonkeySys extends BeanSimple implements IMonkeySysInitialize {\n async sysInitialize() {\n let beansPreload: string[] = [];\n for (const moduleName in this.sys.meta.module.modulesMeta.modules) {\n const module = this.sys.meta.module.modulesMeta.modules[moduleName];\n if (!module.info.onionsMeta?.beansPreload) continue;\n beansPreload = beansPreload.concat(module.info.onionsMeta?.beansPreload);\n }\n const promises: Promise<any>[] = beansPreload.map(item => {\n return this.sys.bean._getBean(item as any, false);\n });\n await Promise.all(promises);\n }\n}\n","import { createBeanDecorator } from 'zova';\n\nexport function Scope(): ClassDecorator {\n return createBeanDecorator('scope', 'app', false);\n}\n","// eslint-disable\n/** sys: begin */\nexport * from '../bean/sys.onion.js';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-bean' {\n \n export interface SysOnion {\n /** @internal */\n get scope(): ScopeModuleABean;\n }\n\n export interface SysOnion {\n get $beanFullName(): 'a-bean.sys.onion';\n get $onionName(): 'a-bean:onion';\n \n } \n}\n/** sys: end */\n/** sys: begin */\nimport { SysOnion } from '../bean/sys.onion.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-bean.sys.onion': SysOnion;\n }\n}\n/** sys: end */\n/** service: begin */\nexport * from '../service/aop.js';\nexport * from '../service/onion_.js';\n\nimport 'zova-module-a-bean';\ndeclare module 'zova-module-a-bean' {\n \n export interface IServiceRecord {\n 'a-bean:aop': never;\n }\n\n \n}\ndeclare module 'zova-module-a-bean' {\n \n export interface ServiceAop {\n /** @internal */\n get scope(): ScopeModuleABean;\n }\n\n export interface ServiceAop {\n get $beanFullName(): 'a-bean.service.aop';\n get $onionName(): 'a-bean:aop';\n \n } \n}\n/** service: end */\n/** service: begin */\nimport { ServiceAop } from '../service/aop.js';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordGeneral {\n 'a-bean.service.aop': ServiceAop;\n }\n}\n/** service: end */\n/** monkeySys: begin */\nexport * from '../monkeySys.js';\n/** monkeySys: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil } from 'zova';\nimport { Scope } from '../lib/scope.js';\n\n@Scope()\nexport class ScopeModuleABean extends BeanScopeBase {}\n\nexport interface ScopeModuleABean {\n util: BeanScopeUtil;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-bean': ScopeModuleABean;\n }\n \n \n\n \n\n \n}\n \n/** scope: end */\n","import type { MetadataKey } from 'zova';\n\nimport { appMetadata, registerMappedClassMetadataKey } from 'zova';\n\nimport type { IAopMethodRecord, IUseAopMethodPropMetadata } from '../types/aopMethod.js';\n\nimport { SymbolDecoratorUseAopMethod } from '../types/aopMethod.js';\n\nexport function UseAopMethod<T extends keyof IAopMethodRecord>(\n aopMethodName: T,\n options?: Partial<IAopMethodRecord[T]>,\n): PropertyDescriptor & MethodDecorator {\n return function (target: object, prop: MetadataKey, descriptor?: PropertyDescriptor) {\n registerMappedClassMetadataKey(target, SymbolDecoratorUseAopMethod);\n const uses = appMetadata.getOwnMetadataMap<MetadataKey, IUseAopMethodPropMetadata<T>[]>(\n true,\n SymbolDecoratorUseAopMethod,\n target,\n );\n if (!uses[prop]) uses[prop] = [];\n uses[prop].push({ onionName: aopMethodName, options });\n return descriptor;\n } as any;\n}\n","import type { ZovaOnionOptionsMeta } from '@cabloy/module-info';\n\nexport const SymbolUseOnionLocal = Symbol('SymbolUseOnionLocal');\nexport const SymbolUseOnionOptions = Symbol('SymbolUseOnionOptions');\n\nexport type TypeComposer = (context: any, next?: any) => any;\n\nexport type IOnionExecuteCustom<OPTIONS, ONIONNAME> = (\n onionSlice: IOnionSlice<OPTIONS, ONIONNAME>,\n data: any,\n next: Function,\n) => any;\n\nexport type TypeUseOnionGlobalBaseOptions<T> = Omit<\n T,\n 'global' | 'dependencies' | 'dependents' | 'ignore' | 'match'\n>;\n\nexport interface IOnionOptionsEnable {\n enable?: boolean;\n meta?: IOnionOptionsMeta;\n}\n\nexport type TypeOnionOptionsMatchFunction = (this: any, ...args: any[]) => boolean;\nexport type TypeOnionOptionsMatchRule<T> = T | RegExp | TypeOnionOptionsMatchFunction;\nexport type TypeOnionOptionsMatchRules<T> =\n | TypeOnionOptionsMatchRule<T>[]\n | TypeOnionOptionsMatchRule<T>;\n\nexport interface IOnionOptionsMatch<T> {\n match?: T[] | T;\n ignore?: T[] | T;\n}\n\nexport interface IOnionOptionsDeps<T> {\n dependencies?: T[] | T;\n dependents?: T[] | T;\n}\n\nexport interface IOnionOptionsMeta extends ZovaOnionOptionsMeta {}\n\nexport interface IOnionOptionsBase<T extends string>\n extends IOnionOptionsEnable, IOnionOptionsMatch<TypeOnionOptionsMatchRule<T>> {}\n\nexport interface IOnionSlice<OPTIONS = unknown, ONIONNAME = string, T = unknown> {\n name: ONIONNAME;\n options: OPTIONS;\n beanFullName: string;\n beanInstance?: T;\n}\n\nexport interface IOnionItem<OPTIONS = unknown, ONIONNAME = string> {\n name: ONIONNAME;\n options?: Partial<OPTIONS>;\n}\n\nexport interface Con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AA,EAAA;CACvD,cAAc;CACd,YAAI;CACJ,UAAI;CACJ,aAAG;CACJ,CAAC,EAAE,SAAK,IAAM,SAAQ,IAAK,SAAC,IAAA;;;;CC/D7B,MAAQ,gBAAc;;AAEtB,OAAO,MAAM,cAAU,KAAQ,IAAA,KAAW,OAAA,YAAW,SAAA;GACnD,MAAM,SAAa,KAAG,IAAA,KAAA,OAAA,YAAA,QAAA;AACpB,OAAI,CAAA,OAAA,KAAc,YAAa,aAAA;AAC/B,kBAAW,aAAmB,OAAI,OAAK,KAAO,YAAY,aAAS;;EAEnE,MAAM,WAAQ,aAAgB,KAAC,SAAA;AAC7B,UAAA,KAAY,IAAG,KAAA,SAAa,MAAO,MAAO;IAC5C;AACA,QAAM,QAAQ,IAAE,SAAW;;;;;;ACV/B,QAAO,oBAAkB,SAAA,OAAe,MAAA;;;;;;ACFxC,IAAG,MAAO,OAAA;AA0BV,IAAQ,oBAAc,OAAA,OAAA,EAAA,QAAA,SAAA,EACpB,QAAO,UACR,CAAC,EAAE,KAAG,SAAS,MAAQ,SAAQ,MAAA,yBAAA,cAAA,GAAA,IAAA,OAAA,IAAA;;;;AC1BhC,SAAS,aAAa,eAAA,SAA+B;;AAErD,iCAAgC,QAAA,4BAAqC;;AAErE,MAAQ,CAAC,KAAA,MAAA,MAAA,QAAA,EAA2B;;GAE9B,WAAU;GACd;GACA,CAAA;AACC,SAAA;;;;;ACXH,IAAa,sBAAsB,OAAO,sBAAqB"}
@@ -3,7 +3,6 @@ import type { IDecoratorAopMethodOptions } from '../types/aopMethod.js';
3
3
  export declare function Sys(): ClassDecorator;
4
4
  export declare function Bean(): ClassDecorator;
5
5
  export declare function Service(): ClassDecorator;
6
- export declare function Store(): ClassDecorator;
7
6
  export declare function Tool(): ClassDecorator;
8
7
  export declare function Data(): ClassDecorator;
9
8
  export declare function Controller(): ClassDecorator;
@@ -1 +1 @@
1
- {"version":3,"file":"bean.d.ts","sourceRoot":"","sources":["../../src/lib/bean.ts"],"names":[],"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A0B,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,cAAc,CAE3F"}
@@ -5,7 +5,6 @@ declare module 'zova' {
5
5
  bean: never;
6
6
  scope: never;
7
7
  service: never;
8
- store: never;
9
8
  tool: never;
10
9
  data: never;
11
10
  controller: never;
@@ -1 +1 @@
1
- {"version":3,"file":"bean.d.ts","sourceRoot":"","sources":["../../src/types/bean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AACV,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,gBAAgB;QAC/B,GAAG,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,KAAK,CAAC;QACf,KAAK,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,KAAK,CAAC;QACZ,UAAU,EAAE,KAAK,CAAC;QAClB,MAAM,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,KAAK,CAAC;KACd;CACF"}
1
+ {"version":3,"file":"bean.d.ts","sourceRoot":"","sources":["../../src/types/bean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AACV,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,gBAAgB;QAC/B,GAAG,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,KAAK,CAAC;QACZ,UAAU,EAAE,KAAK,CAAC;QAClB,MAAM,EAAE,KAAK,CAAC;QACd,KAAK,EAAE,KAAK,CAAC;KACd;CACF"}
@@ -1,6 +1,4 @@
1
- import fse from 'fs-extra';
2
- import path from 'node:path';
3
- import { combineContentRenderAndStyle, generateRestIndex } from "./utils.js";
1
+ import { combineContentRenderAndStyle } from "./utils.js";
4
2
  export async function generateFileComponent(options, globFile, controllerInfo) {
5
3
  const { moduleName } = options;
6
4
  const { className } = globFile;
@@ -139,20 +137,6 @@ ${combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDec
139
137
  ${contentComponent}
140
138
  ${contentRestProps}
141
139
  `;
142
- // restComponent
143
- await generateRestComponent(options);
144
140
  // ok
145
141
  return content;
146
142
  }
147
- async function generateRestComponent(options) {
148
- const { moduleName, modulePath } = options;
149
- // components
150
- const fileComponents = path.join(modulePath, 'rest/components.ts');
151
- if (fse.existsSync(fileComponents))
152
- return;
153
- const contentComponents = `export * from 'zova-module-${moduleName}';`;
154
- await fse.outputFile(fileComponents, contentComponents);
155
- // index
156
- const exportIndexContent = "export * from './components.js';";
157
- await generateRestIndex(options, modulePath, exportIndexContent);
158
- }
@@ -2,7 +2,6 @@ import { combineResourceName } from '@cabloy/utils';
2
2
  import { toUpperCaseFirstChar } from '@cabloy/word-utils';
3
3
  import fse from 'fs-extra';
4
4
  import path from 'node:path';
5
- import { generateRestIndex } from "./utils.js";
6
5
  export async function generateMetaPage(options, globFiles) {
7
6
  if (globFiles.length === 0)
8
7
  return '';
@@ -31,9 +30,7 @@ export async function generateMetaPage(options, globFiles) {
31
30
  // controller.tsx
32
31
  const { routePath, routeName } = _extractRoutePathOrName(options, globFile, controllerInfo);
33
32
  // no matter that: route.meta?.absolute
34
- const routePathFull = routePath
35
- ? `/${moduleName.replace('-', '/')}/${routePath}`
36
- : `/${moduleName.replace('-', '/')}`;
33
+ const routePathFull = routePath ? `/${moduleName.replace('-', '/')}/${routePath}` : `/${moduleName.replace('-', '/')}`;
37
34
  const routeNameFull = `${moduleName}:${routeName}`;
38
35
  contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace));
39
36
  contentPathRecordsRest.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest));
@@ -110,22 +107,8 @@ declare module 'zova-module-${moduleName}' {
110
107
  }
111
108
  /** pages: end */
112
109
  `;
113
- // restComponent
114
- await generateRestMetaPage(options, contentImportsRest, contentPathRecordsRest);
115
110
  return content;
116
111
  }
117
- async function generateRestMetaPage(options, _contentImportsRest, contentPathRecordsRest) {
118
- if (contentPathRecordsRest.length === 0)
119
- return;
120
- const { moduleName, modulePath } = options;
121
- // pages
122
- const contentPages = `export * from 'zova-module-${moduleName}';\n`;
123
- const filePages = path.join(modulePath, 'rest/pages.ts');
124
- await fse.outputFile(filePages, contentPages);
125
- // index
126
- const exportIndexContent = "export * from './pages.js';";
127
- await generateRestIndex(options, modulePath, exportIndexContent);
128
- }
129
112
  function _combineModuleNameControllerName(moduleName, className) {
130
113
  return `NS${toUpperCaseFirstChar(combineResourceName(className, moduleName, false, false))}`;
131
114
  }
@@ -143,8 +126,7 @@ function _extractRoutePathOrName(options, _globFile, controllerInfo) {
143
126
  const astMatch = astMatches.find(item => {
144
127
  return item.node.properties.some(prop => {
145
128
  return (prop.key.name === 'component' &&
146
- (prop.value.name === controllerInfo.nameCapitalize ||
147
- prop.value.name === `ZPage${controllerInfo.nameCapitalize}`));
129
+ (prop.value.name === controllerInfo.nameCapitalize || prop.value.name === `ZPage${controllerInfo.nameCapitalize}`));
148
130
  });
149
131
  });
150
132
  if (!astMatch) {
@@ -1,7 +1,5 @@
1
- import fse from 'fs-extra';
2
- import path from 'node:path';
3
1
  export function combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDeclare, genericArguments) {
4
- const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers, } = controllerInfo;
2
+ const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers } = controllerInfo;
5
3
  const contentControllerInterfaceRecords = [];
6
4
  if (hasStyleFirst) {
7
5
  contentControllerInterfaceRecords.push(`export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
@@ -31,17 +29,3 @@ export function combineContentRenderAndStyle(controllerInfo, moduleName, classNa
31
29
  ${contentControllerInterfaceRecords.join('\n')}
32
30
  }`;
33
31
  }
34
- export async function generateRestIndex(options, modulePath, append) {
35
- const { cli } = options;
36
- // index
37
- const fileIndex = path.join(modulePath, 'rest/index.ts');
38
- let contentIndex = '';
39
- if (fse.existsSync(fileIndex)) {
40
- contentIndex = (await fse.readFile(fileIndex)).toString();
41
- }
42
- if (!contentIndex.includes(append)) {
43
- contentIndex = `${contentIndex}${append}\n`;
44
- await fse.outputFile(fileIndex, contentIndex);
45
- await cli.helper.formatFile({ fileName: fileIndex });
46
- }
47
- }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-module-a-bean",
3
- "version": "5.1.13",
4
- "gitHead": "6162f8e212146d3e5f98145fcf43adc52912694e",
3
+ "version": "5.1.17",
4
+ "gitHead": "343c61ad189fe3f0fc997ee9f4c710567657e05c",
5
5
  "description": "",
6
6
  "keywords": [
7
7
  "Zova Module"
@@ -14,7 +14,6 @@
14
14
  "src",
15
15
  "icons",
16
16
  "assets",
17
- "rest",
18
17
  "dist-cli"
19
18
  ],
20
19
  "type": "module",
@@ -64,11 +63,6 @@
64
63
  "optionsGlobalInterfaceFrom": "zova-module-a-bean",
65
64
  "boilerplate": "service/boilerplate"
66
65
  },
67
- "store": {
68
- "beanGeneral": true,
69
- "optionsNone": true,
70
- "boilerplate": "store/boilerplate"
71
- },
72
66
  "tool": {
73
67
  "beanGeneral": true,
74
68
  "optionsNone": true,
package/src/lib/bean.ts CHANGED
@@ -15,10 +15,6 @@ export function Service(): ClassDecorator {
15
15
  return createBeanDecorator('service', 'ctx');
16
16
  }
17
17
 
18
- export function Store(): ClassDecorator {
19
- return createBeanDecorator('store', 'app');
20
- }
21
-
22
18
  export function Tool(): ClassDecorator {
23
19
  return createBeanDecorator('tool', 'app');
24
20
  }
package/src/types/bean.ts CHANGED
@@ -5,7 +5,6 @@ declare module 'zova' {
5
5
  bean: never;
6
6
  scope: never;
7
7
  service: never;
8
- store: never;
9
8
  tool: never;
10
9
  data: never;
11
10
  controller: never;
@@ -1,7 +0,0 @@
1
- import { BeanBase } from 'zova';
2
- import { Store } from 'zova-module-a-bean';
3
-
4
- @Store()
5
- export class Store<%=argv.beanNameCapitalize%> extends BeanBase {
6
- protected async __init__() {}
7
- }