zova-module-a-bean 5.1.12 → 5.1.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.
@@ -1,8 +1,6 @@
1
1
  import type { IMetadataCustomGenerateOptions } from '@cabloy/cli';
2
2
  import type { IGlobBeanFile } from '@cabloy/module-info';
3
3
 
4
- import { combineResourceName } from '@cabloy/utils';
5
- import { toLowerCaseFirstChar, toUpperCaseFirstChar } from '@cabloy/word-utils';
6
4
  import fse from 'fs-extra';
7
5
  import path from 'node:path';
8
6
 
@@ -133,6 +131,31 @@ export async function generateFileComponent(options: IMetadataCustomGenerateOpti
133
131
  },
134
132
  prepareComponentOptions(${componentOptions}),
135
133
  );`;
134
+ // rest props
135
+ let contentRestPropsType = '';
136
+ if (hasProps) {
137
+ contentRestPropsType += `${nameProps}`;
138
+ }
139
+ if (hasModels) {
140
+ if (hasProps) {
141
+ contentRestPropsType += ' & ';
142
+ }
143
+ contentRestPropsType += `${nameModels} &
144
+ {
145
+ [KEY in keyof ${nameModels} as TypePropValueFromModel<KEY>]: ${nameModels}[KEY];
146
+ } &
147
+ {
148
+ [KEY in keyof ${nameModels} as TypePropUpdateFromModel<KEY>]: (value: ${nameModels}[KEY]) => void;
149
+ }`;
150
+ }
151
+ let contentRestProps = '';
152
+ if (contentRestPropsType) {
153
+ contentRestProps = `declare module 'zova-module-a-bean' {
154
+ export interface IVonaComponentRecord {
155
+ '${moduleName}:${name}': ${contentRestPropsType};
156
+ }
157
+ }`;
158
+ }
136
159
  // content
137
160
  const content = `${contentImports.join('\n')}
138
161
  ${contentTypeControllerPublicProps}
@@ -141,96 +164,21 @@ ${contentControllerInnerProps}
141
164
  ${contentControllerInterface}
142
165
  ${combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDeclare, genericArguments)}
143
166
  ${contentComponent}
167
+ ${contentRestProps}
144
168
  `;
145
169
  // restComponent
146
- await generateRestComponent(options, globFile, controllerInfo, genericDeclare, genericArguments, generateImports, _contentImportTypeController);
170
+ await generateRestComponent(options);
147
171
  // ok
148
172
  return content;
149
173
  }
150
174
 
151
- async function generateRestComponent(
152
- options: IMetadataCustomGenerateOptions,
153
- _globFile: IGlobBeanFile,
154
- controllerInfo: IControllerInfo,
155
- genericDeclare: string,
156
- genericArguments: string,
157
- generateImports: string[] | null | undefined,
158
- _contentImportTypeController: string[],
159
- ) {
160
- const { cli, moduleName, modulePath } = options;
161
- // const { className } = globFile;
162
- const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels } = controllerInfo;
163
- // TypeControllerPublicProps
164
- const typeControllerPublicPropsName = `TypeController${nameCapitalize}PublicProps`;
165
- let contentTypeControllerPublicProps = `type ${typeControllerPublicPropsName}${genericDeclare} = TypeRenderComponentJsxPropsPublic`;
166
- if (hasProps) {
167
- contentTypeControllerPublicProps += `\n & ${nameProps}${genericArguments}`;
168
- }
169
- if (hasModels) {
170
- contentTypeControllerPublicProps += `\n & ${nameModels}${genericArguments} &
171
- {
172
- [KEY in keyof ${nameModels}${genericArguments} as TypePropValueFromModel<KEY>]: ${nameModels}${genericArguments}[KEY];
173
- } &
174
- {
175
- [KEY in keyof ${nameModels}${genericArguments} as TypePropUpdateFromModel<KEY>]: (value: ${nameModels}${genericArguments}[KEY]) => void;
176
- }`;
177
- }
178
- contentTypeControllerPublicProps = `${contentTypeControllerPublicProps};`;
179
- // import
180
- const contentImports: string[] = [];
181
- if (generateImports) {
182
- contentImports.push(...generateImports);
183
- }
184
- const _contentImportTypeZova: string[] = [];
185
- if (hasModels) _contentImportTypeZova.push('TypePropUpdateFromModel', 'TypePropValueFromModel');
186
- if (_contentImportTypeZova.length > 0) {
187
- contentImports.push(`import type { ${_contentImportTypeZova.join(', ')} } from 'zova';`);
188
- }
189
- contentImports.push("import type { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';");
190
- if (_contentImportTypeController.length > 0) {
191
- contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from 'zova-module-${moduleName}';`);
192
- }
193
- // component
194
- let componentNamePrefix;
195
- let componentName;
196
- if (name !== 'formField' && name.startsWith('formField')) {
197
- componentNamePrefix = 'BBF';
198
- componentName = toLowerCaseFirstChar(name.substring('formField'.length));
199
- } else if (name.startsWith('restPage')) {
200
- componentNamePrefix = 'BBP';
201
- componentName = toLowerCaseFirstChar(name.substring('restPage'.length));
202
- } else {
203
- componentNamePrefix = 'BBZ';
204
- componentName = name;
205
- }
206
- const componentNameFull = `${componentNamePrefix}${toUpperCaseFirstChar(combineResourceName(componentName, moduleName, true, true))}`;
207
- const contentComponent = `export function ${componentNameFull}${genericDeclare}(
208
- _props: ${typeControllerPublicPropsName}${genericArguments},
209
- ) {
210
- return '${moduleName}:${name}';
211
- }`;
212
- // content
213
- const content = `${contentImports.join('\n')}
214
-
215
- ${contentTypeControllerPublicProps}
216
- ${contentComponent}
217
- `;
218
- // output
219
- const fileDest = path.join(modulePath, `rest/component/${name}.ts`);
220
- await fse.outputFile(fileDest, content);
221
- await cli.helper.formatFile({ fileName: fileDest });
175
+ async function generateRestComponent(options: IMetadataCustomGenerateOptions) {
176
+ const { moduleName, modulePath } = options;
222
177
  // components
223
178
  const fileComponents = path.join(modulePath, 'rest/components.ts');
224
- let contentComponents = '';
225
- if (fse.existsSync(fileComponents)) {
226
- contentComponents = (await fse.readFile(fileComponents)).toString();
227
- }
228
- const exportContent = `export * from './component/${name}.js';`;
229
- if (!contentComponents.includes(exportContent)) {
230
- contentComponents = `${contentComponents}${exportContent}\n`;
231
- await fse.outputFile(fileComponents, contentComponents);
232
- await cli.helper.formatFile({ fileName: fileComponents });
233
- }
179
+ if (fse.existsSync(fileComponents)) return;
180
+ const contentComponents = `export * from 'zova-module-${moduleName}';`;
181
+ await fse.outputFile(fileComponents, contentComponents);
234
182
  // index
235
183
  const exportIndexContent = "export * from './components.js';";
236
184
  await generateRestIndex(options, modulePath, exportIndexContent);
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,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B,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"}
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 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,OAAA;AACT,QAAA,oBAAA,QAAA,MAAA;;AAEA,SAAgB,OAAO;AACrB,QAAO,oBAAoB,QAAQ,MAAI;;;AAGzC,QAAO,oBAAiB,cAAe,MAAA;;AAEvC,SAAA,SAAA;;;AAGA,SAAS,QAAA;AACT,QAAA,oBAAA,SAAA,MAAA;;AAEA,SAAgB,IAAA,SAAa;AAC3B,QAAO,oBAAoB,OAAC,OAAa,MAAM,QAAA;;;AAGjD,QAAO,oBAAmB,aAAe,OAAA,MAAA,QAAA;;;;AC7BzC,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,KAAM;;;AAMzB,MAAA,QAAa,IAAA,OAAA,KAAA,KAAA,kBAAA,MACb,OAAQ,IAAA,MAAA,0BAAA;AAEP,OAAA,WAAkB;AAClB,OAAA,YAAiB;AACjB,OAAA,YAAW,mBAAc,KAAA,IAAA,KAAA,OAAA,YAAA,QAAA,CAAA,KAAA;;AAEzB,QAAS,gBAA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B;KACtB,WAAA,WAAwB;KAC5B;KACC,SAAQ,WAAA;KACL,CAAA;;AAEJ,wBAAA,QAAA;;AAEA,SAAM,OAAA,KAAa,qBAAqB,CAAA,WAAY,IAAI,KAAA,IAAI;;GAE7D,cAAO,0BAAsB,QAAA,WAAyB,cAAA,CAAA,OAAA,MAAA,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":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,wBAAgB,GAAG,IAAI,cAAc,CAEpC;AAED,wBAAgB,IAAI,IAAI,cAAc,CAErC;AAED,wBAAgB,OAAO,IAAI,cAAc,CAExC;AAED,wBAAgB,KAAK,IAAI,cAAc,CAEtC;AAED,wBAAgB,IAAI,IAAI,cAAc,CAErC;AAED,wBAAgB,IAAI,IAAI,cAAc,CAErC;AAED,wBAAgB,UAAU,IAAI,cAAc,CAE3C;AAED,wBAAgB,MAAM,IAAI,cAAc,CAEvC;AAED,wBAAgB,KAAK,IAAI,cAAc,CAEtC;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CAEjE;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,0BAA0B,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,cAAc,CAE3F"}
1
+ {"version":3,"file":"bean.d.ts","sourceRoot":"","sources":["../../src/lib/bean.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAExE,wBAAgB,GAAG,IAAI,cAAc,CAEpC;AAED,wBAAgB,IAAI,IAAI,cAAc,CAErC;AAED,wBAAgB,OAAO,IAAI,cAAc,CAExC;AAED,wBAAgB,IAAI,IAAI,cAAc,CAErC;AAED,wBAAgB,IAAI,IAAI,cAAc,CAErC;AAED,wBAAgB,UAAU,IAAI,cAAc,CAE3C;AAED,wBAAgB,MAAM,IAAI,cAAc,CAEvC;AAED,wBAAgB,KAAK,IAAI,cAAc,CAEtC;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CAEjE;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,0BAA0B,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"}
@@ -0,0 +1,13 @@
1
+ import { types } from 'typestyle';
2
+ import { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';
3
+ export interface IVonaComponentRecord {
4
+ }
5
+ export type TypeComponentOptions<K extends keyof IVonaComponentRecord> = {
6
+ name: K;
7
+ options?: IVonaComponentRecord[K];
8
+ } & TypeComponentOptionsProps;
9
+ export interface TypeComponentOptionsProps extends TypeRenderComponentJsxPropsPublic {
10
+ class?: any;
11
+ style?: types.NestedCSSProperties;
12
+ }
13
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/types/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAE7D,MAAM,WAAW,oBAAoB;CAAG;AAExC,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,MAAM,oBAAoB,IAAI;IACvE,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;CACnC,GAAG,yBAAyB,CAAC;AAE9B,MAAM,WAAW,yBAA0B,SAAQ,iCAAiC;IAClF,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,KAAK,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC;CACnC"}
@@ -3,4 +3,5 @@ export * from './aopMethod.js';
3
3
  export * from './bean.js';
4
4
  export * from './onion.js';
5
5
  export * from './service.js';
6
+ export * from './component.js';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
@@ -1,5 +1,3 @@
1
- import { combineResourceName } from '@cabloy/utils';
2
- import { toLowerCaseFirstChar, toUpperCaseFirstChar } from '@cabloy/word-utils';
3
1
  import fse from 'fs-extra';
4
2
  import path from 'node:path';
5
3
  import { combineContentRenderAndStyle, generateRestIndex } from "./utils.js";
@@ -106,6 +104,31 @@ export async function generateFileComponent(options, globFile, controllerInfo) {
106
104
  },
107
105
  prepareComponentOptions(${componentOptions}),
108
106
  );`;
107
+ // rest props
108
+ let contentRestPropsType = '';
109
+ if (hasProps) {
110
+ contentRestPropsType += `${nameProps}`;
111
+ }
112
+ if (hasModels) {
113
+ if (hasProps) {
114
+ contentRestPropsType += ' & ';
115
+ }
116
+ contentRestPropsType += `${nameModels} &
117
+ {
118
+ [KEY in keyof ${nameModels} as TypePropValueFromModel<KEY>]: ${nameModels}[KEY];
119
+ } &
120
+ {
121
+ [KEY in keyof ${nameModels} as TypePropUpdateFromModel<KEY>]: (value: ${nameModels}[KEY]) => void;
122
+ }`;
123
+ }
124
+ let contentRestProps = '';
125
+ if (contentRestPropsType) {
126
+ contentRestProps = `declare module 'zova-module-a-bean' {
127
+ export interface IVonaComponentRecord {
128
+ '${moduleName}:${name}': ${contentRestPropsType};
129
+ }
130
+ }`;
131
+ }
109
132
  // content
110
133
  const content = `${contentImports.join('\n')}
111
134
  ${contentTypeControllerPublicProps}
@@ -114,90 +137,21 @@ ${contentControllerInnerProps}
114
137
  ${contentControllerInterface}
115
138
  ${combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDeclare, genericArguments)}
116
139
  ${contentComponent}
140
+ ${contentRestProps}
117
141
  `;
118
142
  // restComponent
119
- await generateRestComponent(options, globFile, controllerInfo, genericDeclare, genericArguments, generateImports, _contentImportTypeController);
143
+ await generateRestComponent(options);
120
144
  // ok
121
145
  return content;
122
146
  }
123
- async function generateRestComponent(options, _globFile, controllerInfo, genericDeclare, genericArguments, generateImports, _contentImportTypeController) {
124
- const { cli, moduleName, modulePath } = options;
125
- // const { className } = globFile;
126
- const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels } = controllerInfo;
127
- // TypeControllerPublicProps
128
- const typeControllerPublicPropsName = `TypeController${nameCapitalize}PublicProps`;
129
- let contentTypeControllerPublicProps = `type ${typeControllerPublicPropsName}${genericDeclare} = TypeRenderComponentJsxPropsPublic`;
130
- if (hasProps) {
131
- contentTypeControllerPublicProps += `\n & ${nameProps}${genericArguments}`;
132
- }
133
- if (hasModels) {
134
- contentTypeControllerPublicProps += `\n & ${nameModels}${genericArguments} &
135
- {
136
- [KEY in keyof ${nameModels}${genericArguments} as TypePropValueFromModel<KEY>]: ${nameModels}${genericArguments}[KEY];
137
- } &
138
- {
139
- [KEY in keyof ${nameModels}${genericArguments} as TypePropUpdateFromModel<KEY>]: (value: ${nameModels}${genericArguments}[KEY]) => void;
140
- }`;
141
- }
142
- contentTypeControllerPublicProps = `${contentTypeControllerPublicProps};`;
143
- // import
144
- const contentImports = [];
145
- if (generateImports) {
146
- contentImports.push(...generateImports);
147
- }
148
- const _contentImportTypeZova = [];
149
- if (hasModels)
150
- _contentImportTypeZova.push('TypePropUpdateFromModel', 'TypePropValueFromModel');
151
- if (_contentImportTypeZova.length > 0) {
152
- contentImports.push(`import type { ${_contentImportTypeZova.join(', ')} } from 'zova';`);
153
- }
154
- contentImports.push("import type { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';");
155
- if (_contentImportTypeController.length > 0) {
156
- contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from 'zova-module-${moduleName}';`);
157
- }
158
- // component
159
- let componentNamePrefix;
160
- let componentName;
161
- if (name !== 'formField' && name.startsWith('formField')) {
162
- componentNamePrefix = 'BBF';
163
- componentName = toLowerCaseFirstChar(name.substring('formField'.length));
164
- }
165
- else if (name.startsWith('restPage')) {
166
- componentNamePrefix = 'BBP';
167
- componentName = toLowerCaseFirstChar(name.substring('restPage'.length));
168
- }
169
- else {
170
- componentNamePrefix = 'BBZ';
171
- componentName = name;
172
- }
173
- const componentNameFull = `${componentNamePrefix}${toUpperCaseFirstChar(combineResourceName(componentName, moduleName, true, true))}`;
174
- const contentComponent = `export function ${componentNameFull}${genericDeclare}(
175
- _props: ${typeControllerPublicPropsName}${genericArguments},
176
- ) {
177
- return '${moduleName}:${name}';
178
- }`;
179
- // content
180
- const content = `${contentImports.join('\n')}
181
-
182
- ${contentTypeControllerPublicProps}
183
- ${contentComponent}
184
- `;
185
- // output
186
- const fileDest = path.join(modulePath, `rest/component/${name}.ts`);
187
- await fse.outputFile(fileDest, content);
188
- await cli.helper.formatFile({ fileName: fileDest });
147
+ async function generateRestComponent(options) {
148
+ const { moduleName, modulePath } = options;
189
149
  // components
190
150
  const fileComponents = path.join(modulePath, 'rest/components.ts');
191
- let contentComponents = '';
192
- if (fse.existsSync(fileComponents)) {
193
- contentComponents = (await fse.readFile(fileComponents)).toString();
194
- }
195
- const exportContent = `export * from './component/${name}.js';`;
196
- if (!contentComponents.includes(exportContent)) {
197
- contentComponents = `${contentComponents}${exportContent}\n`;
198
- await fse.outputFile(fileComponents, contentComponents);
199
- await cli.helper.formatFile({ fileName: fileComponents });
200
- }
151
+ if (fse.existsSync(fileComponents))
152
+ return;
153
+ const contentComponents = `export * from 'zova-module-${moduleName}';`;
154
+ await fse.outputFile(fileComponents, contentComponents);
201
155
  // index
202
156
  const exportIndexContent = "export * from './components.js';";
203
157
  await generateRestIndex(options, modulePath, exportIndexContent);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-module-a-bean",
3
- "version": "5.1.12",
4
- "gitHead": "a247f88a55c663d313296039f874560ee5a13e01",
3
+ "version": "5.1.16",
4
+ "gitHead": "6c7a09c8f0a8a0f41c5090b544a1667dbc689f0e",
5
5
  "description": "",
6
6
  "keywords": [
7
7
  "Zova Module"
@@ -64,11 +64,6 @@
64
64
  "optionsGlobalInterfaceFrom": "zova-module-a-bean",
65
65
  "boilerplate": "service/boilerplate"
66
66
  },
67
- "store": {
68
- "beanGeneral": true,
69
- "optionsNone": true,
70
- "boilerplate": "store/boilerplate"
71
- },
72
67
  "tool": {
73
68
  "beanGeneral": true,
74
69
  "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;
@@ -0,0 +1,14 @@
1
+ import { types } from 'typestyle';
2
+ import { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';
3
+
4
+ export interface IVonaComponentRecord {}
5
+
6
+ export type TypeComponentOptions<K extends keyof IVonaComponentRecord> = {
7
+ name: K;
8
+ options?: IVonaComponentRecord[K];
9
+ } & TypeComponentOptionsProps;
10
+
11
+ export interface TypeComponentOptionsProps extends TypeRenderComponentJsxPropsPublic {
12
+ class?: any;
13
+ style?: types.NestedCSSProperties;
14
+ }
@@ -3,3 +3,4 @@ export * from './aopMethod.js';
3
3
  export * from './bean.js';
4
4
  export * from './onion.js';
5
5
  export * from './service.js';
6
+ export * from './component.js';
@@ -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
- }