import CloudKernel from 'mpserverless-sdk-core'; import upperFirst from './utils/upper-first'; import set from './utils/set'; import AliyunShortMessageService from './aliyun/shortMessage/client'; import BaseOAuthService from './base/oauth/client'; import BaseQrcodeService from './base/qrcode/client'; import MarketingTemplateMessageService from './marketing/templateMessage/client'; import MarketingExchangeVoucherService from './marketing/exchangevoucher/client'; import MemberIdentificationService from './member/identification/client'; import PaymentCommonService from './payment/common/client'; import PaymentFaceToFaceService from './payment/faceToFace/client'; import PaymentHuabeiService from './payment/huabei/client'; import TransferAccountService from './fund/transferAccount/client'; import TransferBankcardService from './fund/transferBankcard/client'; import B2CRedPacketService from './fund/b2credpacket/client'; import SecurityTextRiskService from './security/textRisk/client'; import UtilGenericService from './util/generic/client'; import DeliveryCompanyService from './delivery/company/client'; import DeliveryOrderService from './delivery/order/client'; import DeliveryInvoiceService from './delivery/invoice/client'; import MerchantOrderService from './merchant/order/client'; import MerchantItemService from './merchant/item/client'; import MarketingCardService from './marketing/card/client'; class CloudSDK extends CloudKernel { public registerService(namespace: string, service: any, alias?: string) { set(this, namespace, service); // this[namespace] = service; if (alias) { set(this, alias, service); } else { const ns = namespace.split('.').map(str => upperFirst(str)).join('.'); set(this, ns, service); } } } const cloud = new CloudSDK(); [ ['aliyun.shortMessage', new AliyunShortMessageService(cloud)], ['base.oauth', new BaseOAuthService(cloud), 'Base.OAuth'], ['base.qrcode', new BaseQrcodeService(cloud)], ['marketing.templateMessage', new MarketingTemplateMessageService(cloud)], ['marketing.exchangevoucher', new MarketingExchangeVoucherService(cloud)], ['marketing.card', new MarketingCardService(cloud)], ['member.identification', new MemberIdentificationService(cloud)], ['payment.common', new PaymentCommonService(cloud)], ['payment.faceToFace', new PaymentFaceToFaceService(cloud)], ['payment.huabei', new PaymentHuabeiService(cloud)], ['fund.transferAccount', new TransferAccountService(cloud)], ['fund.transferBankcard', new TransferBankcardService(cloud)], ['fund.b2cRedPacket', new B2CRedPacketService(cloud)], ['security.textRisk', new SecurityTextRiskService(cloud)], ['merchant.item', new MerchantItemService(cloud)], ['merchant.order', new MerchantOrderService(cloud)], ['instantdelivery.company', new DeliveryCompanyService(cloud)], ['instantdelivery.invoice', new DeliveryInvoiceService(cloud)], ['instantdelivery.order', new DeliveryOrderService(cloud)], ['util.generic', new UtilGenericService(cloud)], ].forEach(item => { const [key, service, alias = ''] = item; cloud.registerService( key, service, alias); }); export default cloud;