zova-module-a-bean 5.1.11 → 5.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/controller/metadata/_extractGenericParams.ts +64 -0
- package/cli/controller/metadata/generate.ts +13 -6
- package/cli/controller/metadata/generateFile.ts +9 -2
- package/cli/controller/metadata/generateFileComponent.ts +36 -80
- package/cli/controller/metadata/generateFilePage.ts +11 -3
- package/cli/controller/metadata/generateMetaPage.ts +38 -10
- package/cli/controller/metadata/types.ts +1 -0
- package/cli/controller/metadata/utils.ts +28 -7
- package/dist/bean/sys.onion.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/useAopMethod.d.ts.map +1 -1
- package/dist/service/aop.d.ts.map +1 -1
- package/dist/service/onion_.d.ts.map +1 -1
- package/dist/types/aop.d.ts.map +1 -1
- package/dist/types/aopMethod.d.ts.map +1 -1
- package/dist/types/component.d.ts +13 -0
- package/dist/types/component.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/onion.d.ts.map +1 -1
- package/dist-cli/controller/metadata/_extractGenericParams.js +57 -0
- package/dist-cli/controller/metadata/generate.js +12 -6
- package/dist-cli/controller/metadata/generateFileComponent.js +37 -77
- package/dist-cli/controller/metadata/generateMetaPage.js +5 -2
- package/dist-cli/controller/metadata/utils.js +1 -1
- package/package.json +2 -2
- package/src/bean/sys.onion.ts +16 -4
- package/src/lib/useAopMethod.ts +5 -1
- package/src/service/aop.ts +28 -8
- package/src/service/onion_.ts +29 -8
- package/src/types/aop.ts +7 -1
- package/src/types/aopMethod.ts +14 -2
- package/src/types/component.ts +14 -0
- package/src/types/index.ts +1 -0
- package/src/types/onion.ts +14 -4
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).options as IOnionOptionsDeps<string>;\n return onionOptions.dependencies as any;\n },\n dependents: item => {\n const onionOptions = cast<IOnionItem<OPTIONS, ONIONNAME>>(item).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(selector?: string | boolean, matchThis?: any, ...matchArgs: any[]): 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 = item.options !== undefined ? deepExtend({}, beanOptions.options, item.options) : 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 & IOnionOptionsMatch<TypeOnionOptionsMatchRule<string>>;\n return this.sysOnion.checkOnionOptionsEnabled(onionOptions, selector, matchThis, ...matchArgs);\n }) as unknown as IOnionSlice<OPTIONS, ONIONNAME, T>[];\n }\n\n compose(onions: IOnionSlice<OPTIONS, ONIONNAME>[], executeCustom: IOnionExecuteCustom<OPTIONS, ONIONNAME>) {\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(item: IOnionSlice<OPTIONS, ONIONNAME>, executeCustom: IOnionExecuteCustom<OPTIONS, ONIONNAME>) {\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 { IOnionOptionsEnable, IOnionOptionsMatch, IOnionOptionsMeta, TypeOnionOptionsMatchRules } 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) && __onionMatchSelector(options.match, selector, matchThis, ...matchArgs)) ||\n (!isNil(options.ignore) && !__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(match: TypeOnionOptionsMatchRules<string>, selector: string | boolean, matchThis: any, ...matchArgs: any[]) {\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(options: IDecoratorAopMethodOptions, value: any, next: NextSync, receiver: any, prop: string): boolean;\n}\n\nexport interface IAopMethodExecute {\n execute(options: IDecoratorAopMethodOptions, args: [], next: Next | NextSync, receiver: any, prop: string): 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 { IAopMethodRecord, IDecoratorAopMethodOptions, IUseAopMethodPropMetadata, SymbolDecoratorUseAopMethod } 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>(A: Constructable<T>): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched<K extends keyof IBeanRecord>(beanFullName: K): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched(beanFullName: string): Promise<IOnionSlice<IDecoratorAopOptions, keyof IAopRecord>[] | undefined>;\n async findAopsMatched<T>(beanFullName: Constructable<T> | string): 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>(beanFullName: K): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched(beanFullName: string): Promise<AopMethodsMatchedAll | undefined>;\n async findAopMethodsMatched<T>(beanFullName: Constructable<T> | string): 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[]>>(SymbolDecoratorUseAopMethod, beanOptions.beanClass.prototype);\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>[]>(true, SymbolDecoratorUseAopMethod, target);\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> = (onionSlice: IOnionSlice<OPTIONS, ONIONNAME>, data: any, next: Function) => any;\n\nexport type TypeUseOnionGlobalBaseOptions<T> = Omit<T, 'global' | 'dependencies' | 'dependents' | 'ignore' | 'match'>;\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> = TypeOnionOptionsMatchRule<T>[] | 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> 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,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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"}
|
|
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,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,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAopMethod.d.ts","sourceRoot":"","sources":["../../src/lib/useAopMethod.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAA6B,MAAM,uBAAuB,CAAC;AAIzF,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAC3D,aAAa,EAAE,CAAC,EAChB,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACrC,kBAAkB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"useAopMethod.d.ts","sourceRoot":"","sources":["../../src/lib/useAopMethod.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAA6B,MAAM,uBAAuB,CAAC;AAIzF,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAC3D,aAAa,EAAE,CAAC,EAChB,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACrC,kBAAkB,GAAG,eAAe,CAYtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aop.d.ts","sourceRoot":"","sources":["../../src/service/aop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,aAAa,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAE1E,OAAO,EAA4B,QAAQ,EAAqB,MAAM,MAAM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,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IACxF,qBAAqB,CAAC,CAAC,SAAS,MAAM,WAAW,EACrD,YAAY,EAAE,CAAC,GACd,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IACtC,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;CAwC7F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onion_.d.ts","sourceRoot":"","sources":["../../src/service/onion_.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAKjC,OAAO,EAAe,UAAU,EAAkC,MAAM,MAAM,CAAC;AAE/E,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EAIV,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMhD,qBAEa,YAAY,CAAC,OAAO,EAAE,SAAS,SAAS,MAAM,CAAE,SAAQ,UAAU;IAC7E,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,cAAc,CAAC;IAE1B,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;IAK5C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAaxD,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,WAAW;
|
|
1
|
+
{"version":3,"file":"onion_.d.ts","sourceRoot":"","sources":["../../src/service/onion_.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KA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MAAM,GACX,OAAO,CAAC;CACZ;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CACL,OAAO,EAAE,0BAA0B,EACnC,IAAI,EAAE,EAAE,EACR,IAAI,EAAE,IAAI,GAAG,QAAQ,EACrB,QAAQ,EAAE,GAAG,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;CACvB;AAED,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;CAAG;AAE1E,OAAO,QAAQ,oBAAoB,CAAC;IAClC,UAAiB,QAAQ;QACvB,SAAS,EAAE,YAAY,CAAC,0BAA0B,EAAE,MAAM,gBAAgB,CAAC,CAAC;KAC7E;CACF;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,YAAY;QAC3B,SAAS,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;KACxC;IAED,UAAiB,gBAAgB;QAC/B,SAAS,EAAE,KAAK,CAAC;KAClB;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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onion.d.ts","sourceRoot":"","sources":["../../src/types/onion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AACjE,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAErE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7D,MAAM,MAAM,mBAAmB,CAAC,OAAO,EAA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WAAW,iBAAiB,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IACvB,UAAU,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;CAAG;AAElE,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,CACjD,SAAQ,mBAAmB,EAAE,kBAAkB,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;CAAG;AAElF,MAAM,WAAW,WAAW,CAAC,OAAO,GAAG,OAAO,EAAE,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO;IAC7E,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,CAAC;CAClB;AAED,MAAM,WAAW,UAAU,CAAC,OAAO,GAAG,OAAO,EAAE,SAAS,GAAG,MAAM;IAC/D,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;CAAG;AAEhC,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,UAAU;QACzB,MAAM,EAAE,YAAY,CAAC;KACtB;CACF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
export function extractGenericParamsAndImports(filePath, interfaceName) {
|
|
4
|
+
const sourceText = fs.readFileSync(filePath, 'utf-8');
|
|
5
|
+
const sourceFile = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
6
|
+
// 1. Find the target interface
|
|
7
|
+
let targetInterface;
|
|
8
|
+
ts.forEachChild(sourceFile, node => {
|
|
9
|
+
if (ts.isInterfaceDeclaration(node) && node.name.text === interfaceName) {
|
|
10
|
+
targetInterface = node;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
if (!targetInterface?.typeParameters) {
|
|
14
|
+
return { genericParams: '', imports: [] };
|
|
15
|
+
}
|
|
16
|
+
// 2. Extract generic parameters text
|
|
17
|
+
const genericParams = targetInterface.typeParameters.map(tp => tp.getText(sourceFile)).join(', ');
|
|
18
|
+
// 3. Collect type reference identifiers within generic parameters
|
|
19
|
+
const typeRefNames = new Set();
|
|
20
|
+
const visit = (node) => {
|
|
21
|
+
if (ts.isTypeReferenceNode(node)) {
|
|
22
|
+
// For qualified names like A.B, only take the leftmost identifier
|
|
23
|
+
const id = ts.isQualifiedName(node.typeName) ? node.typeName.left : node.typeName;
|
|
24
|
+
typeRefNames.add(id.getText(sourceFile));
|
|
25
|
+
}
|
|
26
|
+
ts.forEachChild(node, visit);
|
|
27
|
+
};
|
|
28
|
+
targetInterface.typeParameters.forEach(tp => visit(tp));
|
|
29
|
+
// Exclude the generic parameter names themselves (TParentData, TComponentName, etc.)
|
|
30
|
+
for (const tp of targetInterface.typeParameters) {
|
|
31
|
+
typeRefNames.delete(tp.name.text);
|
|
32
|
+
}
|
|
33
|
+
// 4. Match type references to import statements
|
|
34
|
+
const imports = [];
|
|
35
|
+
ts.forEachChild(sourceFile, node => {
|
|
36
|
+
if (!ts.isImportDeclaration(node))
|
|
37
|
+
return;
|
|
38
|
+
const clause = node.importClause;
|
|
39
|
+
if (!clause?.namedBindings || !ts.isNamedImports(clause.namedBindings))
|
|
40
|
+
return;
|
|
41
|
+
const matched = clause.namedBindings.elements.map(el => el.name.text).filter(name => typeRefNames.has(name));
|
|
42
|
+
if (matched.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
const specifier = node.moduleSpecifier.text;
|
|
45
|
+
const prefix = clause.isTypeOnly ? 'type ' : '';
|
|
46
|
+
imports.push(`import ${prefix}{ ${matched.join(', ')} } from '${specifier}';`);
|
|
47
|
+
});
|
|
48
|
+
return { genericParams, imports };
|
|
49
|
+
}
|
|
50
|
+
// // --- Demo ---
|
|
51
|
+
// const result = extractGenericParamsAndImports(
|
|
52
|
+
// import.meta.url.replace('file://', '').replace(/_extractGenericParams\.ts$/, 'controller.tsx'),
|
|
53
|
+
// 'ControllerFormFieldPresetProps',
|
|
54
|
+
// );
|
|
55
|
+
// console.log('Generic params:', result.genericParams);
|
|
56
|
+
// console.log('Imports:');
|
|
57
|
+
// result.imports.forEach(imp => console.log(' ', imp));
|
|
@@ -2,9 +2,11 @@ import { toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
|
2
2
|
import fse from 'fs-extra';
|
|
3
3
|
import { globbySync } from 'globby';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
import { extractGenericParamsAndImports } from "./_extractGenericParams.js";
|
|
5
6
|
import { generateFile } from "./generateFile.js";
|
|
6
7
|
import { generateMetaComponent } from "./generateMetaComponent.js";
|
|
7
8
|
import { generateMetaPage } from "./generateMetaPage.js";
|
|
9
|
+
// const __regProps = /interface Controller[^<]*Props<(.*?)>/;
|
|
8
10
|
export default async function (options) {
|
|
9
11
|
const { globFiles } = options;
|
|
10
12
|
const globFilesPage = [];
|
|
@@ -29,7 +31,7 @@ export default async function (options) {
|
|
|
29
31
|
return content;
|
|
30
32
|
}
|
|
31
33
|
function _parseControllerInfo(options, globFile) {
|
|
32
|
-
const { className, fileContent, fileNameJSRelative } = globFile;
|
|
34
|
+
const { className, fileContent, fileNameJSRelative, file } = globFile;
|
|
33
35
|
const matches = fileNameJSRelative.match(/..\/(.+?)\/(.+?)\/controller(.jsx?)$/);
|
|
34
36
|
if (!matches)
|
|
35
37
|
return;
|
|
@@ -52,10 +54,11 @@ function _parseControllerInfo(options, globFile) {
|
|
|
52
54
|
const hasModels = fileContent.includes(nameModels);
|
|
53
55
|
const hasModelValue = fileContent.includes("'vModel'");
|
|
54
56
|
// generic
|
|
55
|
-
const matchGeneric =
|
|
56
|
-
const hasGeneric = !!matchGeneric;
|
|
57
|
-
const generic = matchGeneric
|
|
58
|
-
const genericKeys =
|
|
57
|
+
const matchGeneric = hasProps && extractGenericParamsAndImports(file, nameProps); // fileContent.match(__regProps);
|
|
58
|
+
const hasGeneric = !!(matchGeneric && matchGeneric.genericParams);
|
|
59
|
+
const generic = hasGeneric ? matchGeneric.genericParams : undefined;
|
|
60
|
+
const genericKeys = hasGeneric ? matchGeneric.genericParams.split(',').map(item => item.trim().split(' ')[0]) : undefined;
|
|
61
|
+
const generateImports = hasGeneric ? matchGeneric.imports : undefined;
|
|
59
62
|
// schemaParams
|
|
60
63
|
const nameSchemaParams = `${className}SchemaParams`;
|
|
61
64
|
const hasSchemaParams = fileContent.includes(nameSchemaParams);
|
|
@@ -67,7 +70,9 @@ function _parseControllerInfo(options, globFile) {
|
|
|
67
70
|
const hasRenderFirst = fse.existsSync(fileRenderFirst);
|
|
68
71
|
const classNameRenderFirst = `Render${type === 'page' ? 'Page' : ''}${nameCapitalize}`;
|
|
69
72
|
const importRenderFirst = `import { ${classNameRenderFirst} } from '../../${type}/${name}/render.jsx';`;
|
|
70
|
-
const fileRenderOthers = globbySync(`src/${type}/${name}/render.*.tsx`, {
|
|
73
|
+
const fileRenderOthers = globbySync(`src/${type}/${name}/render.*.tsx`, {
|
|
74
|
+
cwd: options.modulePath,
|
|
75
|
+
});
|
|
71
76
|
const nameRenderOthers = fileRenderOthers.map(item => /render\.(.*)\.tsx/.exec(item)[1]);
|
|
72
77
|
const classNameRenderOthers = nameRenderOthers.map(item => `Render${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`);
|
|
73
78
|
const importRenderOthers = nameRenderOthers.map(item => `import { ${`Render${type === 'page' ? 'Page' : ''}${toUpperCaseFirstChar(item)}`} } from '../../${type}/${name}/render.${item}.jsx';`);
|
|
@@ -97,6 +102,7 @@ function _parseControllerInfo(options, globFile) {
|
|
|
97
102
|
hasGeneric,
|
|
98
103
|
generic,
|
|
99
104
|
genericKeys,
|
|
105
|
+
generateImports,
|
|
100
106
|
nameSchemaParams,
|
|
101
107
|
hasSchemaParams,
|
|
102
108
|
nameSchemaQuery,
|
|
@@ -1,13 +1,14 @@
|
|
|
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";
|
|
6
4
|
export async function generateFileComponent(options, globFile, controllerInfo) {
|
|
7
5
|
const { moduleName } = options;
|
|
8
6
|
const { className } = globFile;
|
|
9
|
-
const { name, nameCapitalize, controllerExtJs, hasComponentOptions, nameProps, hasProps, hasGeneric, nameModels, hasModels, hasModelValue, generic, genericKeys, importRenderFirst, hasRenderFirst, classNameRenderFirst, importStyleFirst, hasStyleFirst, classNameStyleFirst, } = controllerInfo;
|
|
7
|
+
const { name, nameCapitalize, controllerExtJs, hasComponentOptions, nameProps, hasProps, hasGeneric, nameModels, hasModels, hasModelValue, generic, genericKeys, generateImports, importRenderFirst, hasRenderFirst, classNameRenderFirst, importStyleFirst, hasStyleFirst, classNameStyleFirst, } = controllerInfo;
|
|
10
8
|
const contentImports = [];
|
|
9
|
+
if (generateImports) {
|
|
10
|
+
contentImports.push(...generateImports);
|
|
11
|
+
}
|
|
11
12
|
const genericDeclare = hasGeneric ? `<${generic}>` : '';
|
|
12
13
|
const genericArguments = hasGeneric ? `<${genericKeys?.join(', ')}>` : '';
|
|
13
14
|
const componentOptions = hasComponentOptions ? `Controller${nameCapitalize}.$componentOptions` : '';
|
|
@@ -103,6 +104,31 @@ export async function generateFileComponent(options, globFile, controllerInfo) {
|
|
|
103
104
|
},
|
|
104
105
|
prepareComponentOptions(${componentOptions}),
|
|
105
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
|
+
}
|
|
106
132
|
// content
|
|
107
133
|
const content = `${contentImports.join('\n')}
|
|
108
134
|
${contentTypeControllerPublicProps}
|
|
@@ -111,87 +137,21 @@ ${contentControllerInnerProps}
|
|
|
111
137
|
${contentControllerInterface}
|
|
112
138
|
${combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDeclare, genericArguments)}
|
|
113
139
|
${contentComponent}
|
|
140
|
+
${contentRestProps}
|
|
114
141
|
`;
|
|
115
142
|
// restComponent
|
|
116
|
-
await generateRestComponent(options
|
|
143
|
+
await generateRestComponent(options);
|
|
117
144
|
// ok
|
|
118
145
|
return content;
|
|
119
146
|
}
|
|
120
|
-
async function generateRestComponent(options
|
|
121
|
-
const {
|
|
122
|
-
// const { className } = globFile;
|
|
123
|
-
const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels } = controllerInfo;
|
|
124
|
-
// TypeControllerPublicProps
|
|
125
|
-
const typeControllerPublicPropsName = `TypeController${nameCapitalize}PublicProps`;
|
|
126
|
-
let contentTypeControllerPublicProps = `type ${typeControllerPublicPropsName}${genericDeclare} = TypeRenderComponentJsxPropsPublic`;
|
|
127
|
-
if (hasProps) {
|
|
128
|
-
contentTypeControllerPublicProps += `\n & ${nameProps}${genericArguments}`;
|
|
129
|
-
}
|
|
130
|
-
if (hasModels) {
|
|
131
|
-
contentTypeControllerPublicProps += `\n & ${nameModels}${genericArguments} &
|
|
132
|
-
{
|
|
133
|
-
[KEY in keyof ${nameModels}${genericArguments} as TypePropValueFromModel<KEY>]: ${nameModels}${genericArguments}[KEY];
|
|
134
|
-
} &
|
|
135
|
-
{
|
|
136
|
-
[KEY in keyof ${nameModels}${genericArguments} as TypePropUpdateFromModel<KEY>]: (value: ${nameModels}${genericArguments}[KEY]) => void;
|
|
137
|
-
}`;
|
|
138
|
-
}
|
|
139
|
-
contentTypeControllerPublicProps = `${contentTypeControllerPublicProps};`;
|
|
140
|
-
// import
|
|
141
|
-
const contentImports = [];
|
|
142
|
-
const _contentImportTypeZova = [];
|
|
143
|
-
if (hasModels)
|
|
144
|
-
_contentImportTypeZova.push('TypePropUpdateFromModel', 'TypePropValueFromModel');
|
|
145
|
-
if (_contentImportTypeZova.length > 0) {
|
|
146
|
-
contentImports.push(`import type { ${_contentImportTypeZova.join(', ')} } from 'zova';`);
|
|
147
|
-
}
|
|
148
|
-
contentImports.push("import type { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';");
|
|
149
|
-
if (_contentImportTypeController.length > 0) {
|
|
150
|
-
contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from 'zova-module-${moduleName}';`);
|
|
151
|
-
}
|
|
152
|
-
// component
|
|
153
|
-
let componentNamePrefix;
|
|
154
|
-
let componentName;
|
|
155
|
-
if (name !== 'formField' && name.startsWith('formField')) {
|
|
156
|
-
componentNamePrefix = 'BBF';
|
|
157
|
-
componentName = toLowerCaseFirstChar(name.substring('formField'.length));
|
|
158
|
-
}
|
|
159
|
-
else if (name.startsWith('restPage')) {
|
|
160
|
-
componentNamePrefix = 'BBP';
|
|
161
|
-
componentName = toLowerCaseFirstChar(name.substring('restPage'.length));
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
componentNamePrefix = 'BBZ';
|
|
165
|
-
componentName = name;
|
|
166
|
-
}
|
|
167
|
-
const componentNameFull = `${componentNamePrefix}${toUpperCaseFirstChar(combineResourceName(componentName, moduleName, true, true))}`;
|
|
168
|
-
const contentComponent = `export function ${componentNameFull}${genericDeclare}(
|
|
169
|
-
_props: ${typeControllerPublicPropsName}${genericArguments},
|
|
170
|
-
) {
|
|
171
|
-
return '${moduleName}:${name}';
|
|
172
|
-
}`;
|
|
173
|
-
// content
|
|
174
|
-
const content = `${contentImports.join('\n')}
|
|
175
|
-
|
|
176
|
-
${contentTypeControllerPublicProps}
|
|
177
|
-
${contentComponent}
|
|
178
|
-
`;
|
|
179
|
-
// output
|
|
180
|
-
const fileDest = path.join(modulePath, `rest/component/${name}.ts`);
|
|
181
|
-
await fse.outputFile(fileDest, content);
|
|
182
|
-
await cli.helper.formatFile({ fileName: fileDest });
|
|
147
|
+
async function generateRestComponent(options) {
|
|
148
|
+
const { moduleName, modulePath } = options;
|
|
183
149
|
// components
|
|
184
150
|
const fileComponents = path.join(modulePath, 'rest/components.ts');
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
const exportContent = `export * from './component/${name}.js';`;
|
|
190
|
-
if (!contentComponents.includes(exportContent)) {
|
|
191
|
-
contentComponents = `${contentComponents}${exportContent}\n`;
|
|
192
|
-
await fse.outputFile(fileComponents, contentComponents);
|
|
193
|
-
await cli.helper.formatFile({ fileName: fileComponents });
|
|
194
|
-
}
|
|
151
|
+
if (fse.existsSync(fileComponents))
|
|
152
|
+
return;
|
|
153
|
+
const contentComponents = `export * from 'zova-module-${moduleName}';`;
|
|
154
|
+
await fse.outputFile(fileComponents, contentComponents);
|
|
195
155
|
// index
|
|
196
156
|
const exportIndexContent = "export * from './components.js';";
|
|
197
157
|
await generateRestIndex(options, modulePath, exportIndexContent);
|
|
@@ -31,7 +31,9 @@ export async function generateMetaPage(options, globFiles) {
|
|
|
31
31
|
// controller.tsx
|
|
32
32
|
const { routePath, routeName } = _extractRoutePathOrName(options, globFile, controllerInfo);
|
|
33
33
|
// no matter that: route.meta?.absolute
|
|
34
|
-
const routePathFull = routePath
|
|
34
|
+
const routePathFull = routePath
|
|
35
|
+
? `/${moduleName.replace('-', '/')}/${routePath}`
|
|
36
|
+
: `/${moduleName.replace('-', '/')}`;
|
|
35
37
|
const routeNameFull = `${moduleName}:${routeName}`;
|
|
36
38
|
contentPathRecords.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespace));
|
|
37
39
|
contentPathRecordsRest.push(_combineContentPathRecord(routePathFull, hasSchemaParams, hasSchemaQuery, namespaceRest));
|
|
@@ -141,7 +143,8 @@ function _extractRoutePathOrName(options, _globFile, controllerInfo) {
|
|
|
141
143
|
const astMatch = astMatches.find(item => {
|
|
142
144
|
return item.node.properties.some(prop => {
|
|
143
145
|
return (prop.key.name === 'component' &&
|
|
144
|
-
(prop.value.name === controllerInfo.nameCapitalize ||
|
|
146
|
+
(prop.value.name === controllerInfo.nameCapitalize ||
|
|
147
|
+
prop.value.name === `ZPage${controllerInfo.nameCapitalize}`));
|
|
145
148
|
});
|
|
146
149
|
});
|
|
147
150
|
if (!astMatch) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fse from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
export function combineContentRenderAndStyle(controllerInfo, moduleName, className, genericDeclare, genericArguments) {
|
|
4
|
-
const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers } = controllerInfo;
|
|
4
|
+
const { hasRenderFirst, classNameRenderFirst, classNameRenderOthers, hasStyleFirst, classNameStyleFirst, classNameStyleOthers, } = controllerInfo;
|
|
5
5
|
const contentControllerInterfaceRecords = [];
|
|
6
6
|
if (hasStyleFirst) {
|
|
7
7
|
contentControllerInterfaceRecords.push(`export interface ${classNameStyleFirst}${genericDeclare} extends ${className}${genericArguments} {}`);
|
package/package.json
CHANGED
package/src/bean/sys.onion.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { checkMeta, isNil, matchSelector } from '@cabloy/utils';
|
|
2
2
|
import { BeanBase, ProxyDisable } from 'zova';
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
IOnionOptionsEnable,
|
|
6
|
+
IOnionOptionsMatch,
|
|
7
|
+
IOnionOptionsMeta,
|
|
8
|
+
TypeOnionOptionsMatchRules,
|
|
9
|
+
} from '../types/onion.js';
|
|
5
10
|
|
|
6
11
|
import { Sys } from '../lib/bean.js';
|
|
7
12
|
import { ServiceOnion } from '../service/onion_.js';
|
|
@@ -32,8 +37,10 @@ export class SysOnion extends BeanBase {
|
|
|
32
37
|
if (isNil(selector) || selector === false) return true;
|
|
33
38
|
if (isNil(options.match) && isNil(options.ignore)) return true;
|
|
34
39
|
return (
|
|
35
|
-
(!isNil(options.match) &&
|
|
36
|
-
|
|
40
|
+
(!isNil(options.match) &&
|
|
41
|
+
__onionMatchSelector(options.match, selector, matchThis, ...matchArgs)) ||
|
|
42
|
+
(!isNil(options.ignore) &&
|
|
43
|
+
!__onionMatchSelector(options.ignore, selector, matchThis, ...matchArgs))
|
|
37
44
|
);
|
|
38
45
|
}
|
|
39
46
|
|
|
@@ -42,6 +49,11 @@ export class SysOnion extends BeanBase {
|
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
|
|
45
|
-
function __onionMatchSelector(
|
|
52
|
+
function __onionMatchSelector(
|
|
53
|
+
match: TypeOnionOptionsMatchRules<string>,
|
|
54
|
+
selector: string | boolean,
|
|
55
|
+
matchThis: any,
|
|
56
|
+
...matchArgs: any[]
|
|
57
|
+
) {
|
|
46
58
|
return matchSelector(match, selector, matchThis, ...matchArgs);
|
|
47
59
|
}
|
package/src/lib/useAopMethod.ts
CHANGED
|
@@ -12,7 +12,11 @@ export function UseAopMethod<T extends keyof IAopMethodRecord>(
|
|
|
12
12
|
): PropertyDescriptor & MethodDecorator {
|
|
13
13
|
return function (target: object, prop: MetadataKey, descriptor?: PropertyDescriptor) {
|
|
14
14
|
registerMappedClassMetadataKey(target, SymbolDecoratorUseAopMethod);
|
|
15
|
-
const uses = appMetadata.getOwnMetadataMap<MetadataKey, IUseAopMethodPropMetadata<T>[]>(
|
|
15
|
+
const uses = appMetadata.getOwnMetadataMap<MetadataKey, IUseAopMethodPropMetadata<T>[]>(
|
|
16
|
+
true,
|
|
17
|
+
SymbolDecoratorUseAopMethod,
|
|
18
|
+
target,
|
|
19
|
+
);
|
|
16
20
|
if (!uses[prop]) uses[prop] = [];
|
|
17
21
|
uses[prop].push({ onionName: aopMethodName, options });
|
|
18
22
|
return descriptor;
|