{"version":3,"sources":["../../../../src/lib/A-ServerRouter/A-ServerRouterDefine.decorator.ts"],"names":[],"mappings":";;;;AAYO,SAAS,8BAA8B,KAAA,EAAsB;AAChE,EAAA,OAAO,SACH,MAAA,EACA,WAAA,EACA,UAAA,EACF;AAEE,IAAA,MAAM,IAAA,GAA2B,SAAA,CAAU,IAAA,CAAyB,cAAc,CAAA;AAElF,IAAA,MAAM,YAAY,KAAA,CAAM,mBAAA,CAAoB,CAAC,gBAAA,EAAkB,WAAW,CAAC,CAAA;AAE3E,IAAA,IAAA,CAAK,SAAS,SAAA,EAAW;AAAA,MACrB,SAAA,EAAW,MAAA;AAAA,MACX,OAAA,EAAS,WAAA;AAAA,MACT;AAAA,KACH,CAAA;AAED,IAAA,gBAAA,CAAiB;AAAA,MACb,MAAM,SAAA,CAAU,MAAA;AAAA,MAChB,MAAA,EAAQ;AAAA,KACX,CAAA,CAAE,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA;AAElC,IAAA,OAAO,gBAAA,CAAiB,SAAS,CAAA,CAAE,MAAA,EAAQ,aAAa,UAAU,CAAA;AAAA,EACtE,CAAA;AACJ","file":"A-ServerRouterDefine.decorator.mjs","sourcesContent":["import { A_Component, A_Context, A_Feature_Define, A_Feature_Extend, A_TYPES__MetaLinkedComponentConstructors } from \"@adaas/a-concept\";\nimport { A_ServerRouterMeta } from \"./A-ServerRouter.meta\";\nimport { A_ServerRoute } from \"../A-ServerRoute/A-ServerRoute.entity\";\nimport { A_ServerRouter } from \"./A-ServerRouter.component\";\n\n/**\n * \n * This decorator should allow to set a default meta type for the class, this helps to avoid\n * the need to create custom meta classes for each class.\n * \n * @returns \n */\nexport function A_ServerRouterDefineDecorator(route: A_ServerRoute) {\n    return function <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(\n        target: A_Component,\n        propertyKey: string,\n        descriptor: PropertyDescriptor\n    ) {\n\n        const meta: A_ServerRouterMeta = A_Context.meta<A_ServerRouterMeta>(A_ServerRouter);\n\n        const searchKey = route.toAFeatureExtension(['A_ServerRouter', 'A_Service']);\n\n        meta.addRoute(searchKey, {\n            component: target,\n            handler: propertyKey,\n            route\n        });\n\n        A_Feature_Define({\n            name: searchKey.source,\n            invoke: false\n        })(target, propertyKey, descriptor)\n\n        return A_Feature_Extend(searchKey)(target, propertyKey, descriptor);\n    }\n}"]}