node-easywechat 2.9.1 → 3.0.0-alpha.1
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/CHANGELOG.md +8 -0
- package/README.md +20 -283
- package/dist/Core/Cache/FileCache.d.ts +6 -5
- package/dist/Core/Cache/FileCache.js +5 -5
- package/dist/Core/Config.d.ts +66 -0
- package/dist/Core/Config.js +117 -0
- package/dist/Core/Contracts/AccessTokenInterface.d.ts +13 -0
- package/dist/Core/Contracts/AccessTokenInterface.js +28 -0
- package/dist/Core/Contracts/CacheInterface.d.ts +28 -5
- package/dist/Core/Contracts/CacheInterface.js +31 -18
- package/dist/Core/Contracts/ConfigInterface.d.ts +29 -0
- package/dist/Core/Contracts/ConfigInterface.js +34 -0
- package/dist/Core/Contracts/ObjectAccessInterface.d.ts +31 -0
- package/dist/Core/Contracts/ObjectAccessInterface.js +33 -0
- package/dist/Core/Contracts/RefreshableAccessTokenInterface.d.ts +9 -0
- package/dist/{OfficialAccount/Server/Guard.js → Core/Contracts/RefreshableAccessTokenInterface.js} +9 -8
- package/dist/Core/Contracts/ServerInterface.d.ts +8 -0
- package/dist/Core/Contracts/ServerInterface.js +20 -0
- package/dist/Core/Encryptor.d.ts +29 -3
- package/dist/Core/Encryptor.js +37 -12
- package/dist/Core/Http/Contracts/MessageInterface.d.ts +69 -0
- package/dist/Core/Http/Contracts/MessageInterface.js +70 -0
- package/dist/Core/Http/Contracts/RequestInterface.d.ts +37 -0
- package/dist/Core/Http/Contracts/RequestInterface.js +42 -0
- package/dist/Core/Http/Contracts/ResponseInterface.d.ts +21 -0
- package/dist/Core/Http/Contracts/ResponseInterface.js +26 -0
- package/dist/Core/Http/Contracts/ServerRequestInterface.d.ts +78 -0
- package/dist/Core/Http/Contracts/ServerRequestInterface.js +83 -0
- package/dist/Core/Http/Minxins/MessageMixin.d.ts +24 -0
- package/dist/Core/Http/Minxins/MessageMixin.js +93 -0
- package/dist/Core/Http/Minxins/RequestMixin.d.ts +12 -0
- package/dist/Core/Http/Minxins/RequestMixin.js +30 -0
- package/dist/Core/Http/Request.d.ts +8 -25
- package/dist/Core/Http/Request.js +12 -177
- package/dist/Core/Http/Response.d.ts +11 -12
- package/dist/Core/Http/Response.js +30 -26
- package/dist/Core/Http/ServerRequest.d.ts +47 -0
- package/dist/Core/Http/ServerRequest.js +136 -0
- package/dist/Core/HttpClient/AccessTokenAwareClient.d.ts +19 -0
- package/dist/Core/HttpClient/AccessTokenAwareClient.js +47 -0
- package/dist/Core/HttpClient/Contracts/AccessTokenAwareHttpClientInterface.d.ts +9 -0
- package/dist/Core/HttpClient/Contracts/AccessTokenAwareHttpClientInterface.js +13 -0
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.d.ts +18 -0
- package/dist/Core/HttpClient/Contracts/HttpClientInterface.js +29 -0
- package/dist/Core/HttpClient/Contracts/HttpClientResponseInterface.d.ts +35 -0
- package/dist/Core/HttpClient/Contracts/HttpClientResponseInterface.js +37 -0
- package/dist/Core/HttpClient/HttpClient.d.ts +20 -0
- package/dist/Core/HttpClient/HttpClient.js +92 -0
- package/dist/Core/HttpClient/HttpClientResponse.d.ts +76 -0
- package/dist/Core/HttpClient/HttpClientResponse.js +171 -0
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.d.ts +48 -0
- package/dist/Core/HttpClient/Mixins/HttpClientMethodsMixin.js +88 -0
- package/dist/Core/Message.d.ts +144 -0
- package/dist/Core/Message.js +74 -0
- package/dist/Core/Mixins/CacheMixin.d.ts +40 -0
- package/dist/Core/Mixins/CacheMixin.js +63 -0
- package/dist/Core/Mixins/ClientMixin.d.ts +16 -0
- package/dist/Core/Mixins/ClientMixin.js +21 -0
- package/dist/Core/Mixins/ConfigMixin.d.ts +16 -0
- package/dist/Core/Mixins/ConfigMixin.js +21 -0
- package/dist/Core/Mixins/DecryptXmlMessageMixin.d.ts +11 -0
- package/dist/Core/Mixins/DecryptXmlMessageMixin.js +38 -0
- package/dist/Core/Mixins/HandlersMixin.d.ts +79 -0
- package/dist/Core/Mixins/HandlersMixin.js +163 -0
- package/dist/Core/Mixins/HasAttributesMixin.d.ts +46 -0
- package/dist/Core/Mixins/HasAttributesMixin.js +75 -0
- package/dist/Core/Mixins/HttpClientMixin.d.ts +26 -0
- package/dist/Core/Mixins/HttpClientMixin.js +45 -0
- package/dist/Core/Mixins/ResponseXmlMessageMixin.d.ts +13 -0
- package/dist/Core/Mixins/ResponseXmlMessageMixin.js +63 -0
- package/dist/Core/Mixins/ServerRequestMixin.d.ts +16 -0
- package/dist/Core/Mixins/ServerRequestMixin.js +21 -0
- package/dist/Core/{AES.d.ts → Support/AES.d.ts} +0 -0
- package/dist/Core/{AES.js → Support/AES.js} +0 -0
- package/dist/Core/Support/Obj.d.ts +62 -0
- package/dist/Core/Support/Obj.js +136 -0
- package/dist/Core/{PKCS.d.ts → Support/PKCS.d.ts} +2 -1
- package/dist/Core/{PKCS.js → Support/PKCS.js} +1 -3
- package/dist/Core/{RSA.d.ts → Support/RSA.d.ts} +2 -1
- package/dist/Core/{RSA.js → Support/RSA.js} +1 -2
- package/dist/Core/Support/Utils.d.ts +89 -0
- package/dist/Core/{Utils.js → Support/Utils.js} +84 -40
- package/dist/OfficialAccount/AccessToken.d.ts +26 -0
- package/dist/OfficialAccount/AccessToken.js +83 -0
- package/dist/OfficialAccount/Account.d.ts +13 -0
- package/dist/OfficialAccount/Account.js +29 -0
- package/dist/OfficialAccount/Application.d.ts +70 -66
- package/dist/OfficialAccount/Application.js +146 -222
- package/dist/OfficialAccount/Config.d.ts +5 -0
- package/dist/OfficialAccount/Config.js +14 -0
- package/dist/OfficialAccount/Contracts/AccountInterface.d.ts +23 -0
- package/dist/OfficialAccount/Contracts/AccountInterface.js +25 -0
- package/dist/OfficialAccount/Contracts/ApplicationInterface.d.ts +87 -0
- package/dist/OfficialAccount/Contracts/ApplicationInterface.js +76 -0
- package/dist/OfficialAccount/JsApiTicket.d.ts +23 -0
- package/dist/OfficialAccount/JsApiTicket.js +76 -0
- package/dist/OfficialAccount/Message.d.ts +4 -0
- package/dist/OfficialAccount/Message.js +8 -0
- package/dist/OfficialAccount/Server.d.ts +43 -0
- package/dist/OfficialAccount/Server.js +96 -0
- package/dist/OfficialAccount/Utils.d.ts +7 -0
- package/dist/{Work/MiniProgram/Auth/AuthClient.js → OfficialAccount/Utils.js} +14 -13
- package/dist/Types/global.d.ts +343 -0
- package/official_account.access_token.mock-access_token-appid.cache +1 -0
- package/official_account.jsapi_ticket.mock-ticket-appid.cache +1 -0
- package/package.json +13 -13
- package/dist/BaseService/Application.d.ts +0 -17
- package/dist/BaseService/Application.js +0 -46
- package/dist/BaseService/ContentSecurity/ContentSecurityClient.d.ts +0 -16
- package/dist/BaseService/ContentSecurity/ContentSecurityClient.js +0 -47
- package/dist/BaseService/Jssdk/JssdkClient.d.ts +0 -52
- package/dist/BaseService/Jssdk/JssdkClient.js +0 -128
- package/dist/BaseService/Media/MediaClient.d.ts +0 -57
- package/dist/BaseService/Media/MediaClient.js +0 -151
- package/dist/BaseService/Qrcode/QrcodeClient.d.ts +0 -28
- package/dist/BaseService/Qrcode/QrcodeClient.js +0 -79
- package/dist/BaseService/Url/UrlClient.d.ts +0 -9
- package/dist/BaseService/Url/UrlClient.js +0 -24
- package/dist/Core/BaseAccessToken.d.ts +0 -89
- package/dist/Core/BaseAccessToken.js +0 -206
- package/dist/Core/BaseApplication.d.ts +0 -72
- package/dist/Core/BaseApplication.js +0 -138
- package/dist/Core/BaseClient.d.ts +0 -20
- package/dist/Core/BaseClient.js +0 -109
- package/dist/Core/Contracts/RequestInterface.d.ts +0 -10
- package/dist/Core/Contracts/RequestInterface.js +0 -30
- package/dist/Core/Decorators/FinallResult.d.ts +0 -4
- package/dist/Core/Decorators/FinallResult.js +0 -8
- package/dist/Core/Decorators/TerminateResult.d.ts +0 -4
- package/dist/Core/Decorators/TerminateResult.js +0 -8
- package/dist/Core/Http/StreamResponse.d.ts +0 -6
- package/dist/Core/Http/StreamResponse.js +0 -40
- package/dist/Core/Messages/Article.d.ts +0 -7
- package/dist/Core/Messages/Article.js +0 -31
- package/dist/Core/Messages/Card.d.ts +0 -6
- package/dist/Core/Messages/Card.js +0 -15
- package/dist/Core/Messages/DeviceEvent.d.ts +0 -5
- package/dist/Core/Messages/DeviceEvent.js +0 -19
- package/dist/Core/Messages/DeviceText.d.ts +0 -6
- package/dist/Core/Messages/DeviceText.js +0 -27
- package/dist/Core/Messages/File.d.ts +0 -4
- package/dist/Core/Messages/File.js +0 -12
- package/dist/Core/Messages/Image.d.ts +0 -4
- package/dist/Core/Messages/Image.js +0 -12
- package/dist/Core/Messages/InteractiveTaskCard.d.ts +0 -8
- package/dist/Core/Messages/InteractiveTaskCard.js +0 -22
- package/dist/Core/Messages/Link.d.ts +0 -5
- package/dist/Core/Messages/Link.js +0 -17
- package/dist/Core/Messages/Location.d.ts +0 -5
- package/dist/Core/Messages/Location.js +0 -19
- package/dist/Core/Messages/Markdown.d.ts +0 -5
- package/dist/Core/Messages/Markdown.js +0 -15
- package/dist/Core/Messages/Media.d.ts +0 -8
- package/dist/Core/Messages/Media.js +0 -31
- package/dist/Core/Messages/Message.d.ts +0 -47
- package/dist/Core/Messages/Message.js +0 -133
- package/dist/Core/Messages/MiniProgramNotice.d.ts +0 -5
- package/dist/Core/Messages/MiniProgramNotice.js +0 -16
- package/dist/Core/Messages/MiniProgramPage.d.ts +0 -6
- package/dist/Core/Messages/MiniProgramPage.js +0 -23
- package/dist/Core/Messages/Music.d.ts +0 -7
- package/dist/Core/Messages/Music.js +0 -39
- package/dist/Core/Messages/News.d.ts +0 -9
- package/dist/Core/Messages/News.js +0 -47
- package/dist/Core/Messages/NewsItem.d.ts +0 -7
- package/dist/Core/Messages/NewsItem.js +0 -34
- package/dist/Core/Messages/Raw.d.ts +0 -9
- package/dist/Core/Messages/Raw.js +0 -26
- package/dist/Core/Messages/ReplyInteractiveTaskCard.d.ts +0 -10
- package/dist/Core/Messages/ReplyInteractiveTaskCard.js +0 -25
- package/dist/Core/Messages/ShortVideo.d.ts +0 -4
- package/dist/Core/Messages/ShortVideo.js +0 -12
- package/dist/Core/Messages/TaskCard.d.ts +0 -5
- package/dist/Core/Messages/TaskCard.js +0 -19
- package/dist/Core/Messages/Text.d.ts +0 -7
- package/dist/Core/Messages/Text.js +0 -20
- package/dist/Core/Messages/TextCard.d.ts +0 -5
- package/dist/Core/Messages/TextCard.js +0 -17
- package/dist/Core/Messages/Transfer.d.ts +0 -7
- package/dist/Core/Messages/Transfer.js +0 -22
- package/dist/Core/Messages/Video.d.ts +0 -7
- package/dist/Core/Messages/Video.js +0 -33
- package/dist/Core/Messages/Voice.d.ts +0 -5
- package/dist/Core/Messages/Voice.js +0 -16
- package/dist/Core/Messages/index.d.ts +0 -24
- package/dist/Core/Messages/index.js +0 -36
- package/dist/Core/Mixins/HttpMixin.d.ts +0 -4
- package/dist/Core/Mixins/HttpMixin.js +0 -57
- package/dist/Core/ServerGuard.d.ts +0 -54
- package/dist/Core/ServerGuard.js +0 -288
- package/dist/Core/Types.d.ts +0 -237
- package/dist/Core/Types.js +0 -3
- package/dist/Core/Utils.d.ts +0 -31
- package/dist/MicroMerchant/Application.d.ts +0 -27
- package/dist/MicroMerchant/Application.js +0 -105
- package/dist/MicroMerchant/Base/MicroMerchantBase.d.ts +0 -7
- package/dist/MicroMerchant/Base/MicroMerchantBase.js +0 -52
- package/dist/MicroMerchant/Certficates/CertficatesClient.d.ts +0 -5
- package/dist/MicroMerchant/Certficates/CertficatesClient.js +0 -52
- package/dist/MicroMerchant/Core/BaseClient.d.ts +0 -9
- package/dist/MicroMerchant/Core/BaseClient.js +0 -106
- package/dist/MicroMerchant/Media/MediaClient.d.ts +0 -6
- package/dist/MicroMerchant/Media/MediaClient.js +0 -33
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.d.ts +0 -8
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +0 -49
- package/dist/MicroMerchant/Meterial/MeterialClient.d.ts +0 -5
- package/dist/MicroMerchant/Meterial/MeterialClient.js +0 -30
- package/dist/MicroMerchant/Withdraw/WithdrawClient.d.ts +0 -5
- package/dist/MicroMerchant/Withdraw/WithdrawClient.js +0 -28
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.d.ts +0 -6
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +0 -42
- package/dist/MiniProgram/AppCode/AppCodeClient.d.ts +0 -22
- package/dist/MiniProgram/AppCode/AppCodeClient.js +0 -79
- package/dist/MiniProgram/Application.d.ts +0 -83
- package/dist/MiniProgram/Application.js +0 -238
- package/dist/MiniProgram/Auth/AccessToken.d.ts +0 -5
- package/dist/MiniProgram/Auth/AccessToken.js +0 -31
- package/dist/MiniProgram/Auth/AuthClient.d.ts +0 -8
- package/dist/MiniProgram/Auth/AuthClient.js +0 -22
- package/dist/MiniProgram/Base/MiniProgramBase.d.ts +0 -9
- package/dist/MiniProgram/Base/MiniProgramBase.js +0 -21
- package/dist/MiniProgram/Broadcast/BroadcastClient.d.ts +0 -40
- package/dist/MiniProgram/Broadcast/BroadcastClient.js +0 -141
- package/dist/MiniProgram/DataCube/DataCubeClient.d.ts +0 -70
- package/dist/MiniProgram/DataCube/DataCubeClient.js +0 -116
- package/dist/MiniProgram/Encryptor.d.ts +0 -4
- package/dist/MiniProgram/Encryptor.js +0 -23
- package/dist/MiniProgram/Express/ExpressClient.d.ts +0 -47
- package/dist/MiniProgram/Express/ExpressClient.js +0 -80
- package/dist/MiniProgram/Live/LiveClient.d.ts +0 -5
- package/dist/MiniProgram/Live/LiveClient.js +0 -23
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.d.ts +0 -31
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +0 -67
- package/dist/MiniProgram/OpenData/OpenDataClient.d.ts +0 -7
- package/dist/MiniProgram/OpenData/OpenDataClient.js +0 -46
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.d.ts +0 -10
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.js +0 -20
- package/dist/MiniProgram/Plugin/PluginClient.d.ts +0 -17
- package/dist/MiniProgram/Plugin/PluginClient.js +0 -37
- package/dist/MiniProgram/Plugin/PluginDevClient.d.ts +0 -23
- package/dist/MiniProgram/Plugin/PluginDevClient.js +0 -49
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.d.ts +0 -11
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +0 -25
- package/dist/MiniProgram/RiskControl/RiskControlClient.d.ts +0 -4
- package/dist/MiniProgram/RiskControl/RiskControlClient.js +0 -12
- package/dist/MiniProgram/Search/SearchClient.d.ts +0 -4
- package/dist/MiniProgram/Search/SearchClient.js +0 -14
- package/dist/MiniProgram/Shop/AccoutClient.d.ts +0 -25
- package/dist/MiniProgram/Shop/AccoutClient.js +0 -42
- package/dist/MiniProgram/Shop/AftersaleClient.d.ts +0 -22
- package/dist/MiniProgram/Shop/AftersaleClient.js +0 -35
- package/dist/MiniProgram/Shop/BasicClient.d.ts +0 -39
- package/dist/MiniProgram/Shop/BasicClient.js +0 -69
- package/dist/MiniProgram/Shop/DeliveryClient.d.ts +0 -20
- package/dist/MiniProgram/Shop/DeliveryClient.js +0 -32
- package/dist/MiniProgram/Shop/OrderClient.d.ts +0 -32
- package/dist/MiniProgram/Shop/OrderClient.js +0 -51
- package/dist/MiniProgram/Shop/RegisterClient.d.ts +0 -25
- package/dist/MiniProgram/Shop/RegisterClient.js +0 -43
- package/dist/MiniProgram/Shop/SpuClient.d.ts +0 -67
- package/dist/MiniProgram/Shop/SpuClient.js +0 -92
- package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +0 -11
- package/dist/MiniProgram/ShortLink/ShortLinkClient.js +0 -23
- package/dist/MiniProgram/Soter/SoterClient.d.ts +0 -10
- package/dist/MiniProgram/Soter/SoterClient.js +0 -22
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.d.ts +0 -50
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +0 -122
- package/dist/MiniProgram/TemplateMessage/TemplateMessageClient.d.ts +0 -18
- package/dist/MiniProgram/TemplateMessage/TemplateMessageClient.js +0 -50
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.d.ts +0 -26
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +0 -68
- package/dist/MiniProgram/Union/UnionClient.d.ts +0 -16
- package/dist/MiniProgram/Union/UnionClient.js +0 -69
- package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +0 -9
- package/dist/MiniProgram/UrlLink/UrlLinkClient.js +0 -17
- package/dist/MiniProgram/UrlScheme/UrlSchemeClient.d.ts +0 -4
- package/dist/MiniProgram/UrlScheme/UrlSchemeClient.js +0 -12
- package/dist/OfficialAccount/Auth/AccessToken.d.ts +0 -5
- package/dist/OfficialAccount/Auth/AccessToken.js +0 -31
- package/dist/OfficialAccount/AutoReply/AutoReplyClient.d.ts +0 -7
- package/dist/OfficialAccount/AutoReply/AutoReplyClient.js +0 -15
- package/dist/OfficialAccount/Base/OfficialAccountBase.d.ts +0 -13
- package/dist/OfficialAccount/Base/OfficialAccountBase.js +0 -38
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.d.ts +0 -158
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +0 -233
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.d.ts +0 -14
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +0 -63
- package/dist/OfficialAccount/Card/BoardingPassClient.d.ts +0 -4
- package/dist/OfficialAccount/Card/BoardingPassClient.js +0 -12
- package/dist/OfficialAccount/Card/Card.d.ts +0 -17
- package/dist/OfficialAccount/Card/Card.js +0 -31
- package/dist/OfficialAccount/Card/Client.d.ts +0 -108
- package/dist/OfficialAccount/Card/Client.js +0 -218
- package/dist/OfficialAccount/Card/CodeClient.d.ts +0 -51
- package/dist/OfficialAccount/Card/CodeClient.js +0 -100
- package/dist/OfficialAccount/Card/CoinClient.d.ts +0 -10
- package/dist/OfficialAccount/Card/CoinClient.js +0 -41
- package/dist/OfficialAccount/Card/GeneralCardClient.d.ts +0 -19
- package/dist/OfficialAccount/Card/GeneralCardClient.js +0 -34
- package/dist/OfficialAccount/Card/JssdkClient.d.ts +0 -6
- package/dist/OfficialAccount/Card/JssdkClient.js +0 -67
- package/dist/OfficialAccount/Card/MeetingTicketClient.d.ts +0 -8
- package/dist/OfficialAccount/Card/MeetingTicketClient.js +0 -16
- package/dist/OfficialAccount/Card/MemberCardClient.d.ts +0 -35
- package/dist/OfficialAccount/Card/MemberCardClient.js +0 -62
- package/dist/OfficialAccount/Card/MovieTicketClient.d.ts +0 -8
- package/dist/OfficialAccount/Card/MovieTicketClient.js +0 -16
- package/dist/OfficialAccount/Card/SubMerchantClient.d.ts +0 -26
- package/dist/OfficialAccount/Card/SubMerchantClient.js +0 -73
- package/dist/OfficialAccount/Comment/CommentClient.d.ts +0 -60
- package/dist/OfficialAccount/Comment/CommentClient.js +0 -115
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.d.ts +0 -15
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +0 -78
- package/dist/OfficialAccount/CustomerService/CustomerServiceSession.d.ts +0 -8
- package/dist/OfficialAccount/CustomerService/CustomerServiceSession.js +0 -36
- package/dist/OfficialAccount/CustomerService/Messenger.d.ts +0 -18
- package/dist/OfficialAccount/CustomerService/Messenger.js +0 -62
- package/dist/OfficialAccount/DataCube/DataCubeClient.d.ts +0 -135
- package/dist/OfficialAccount/DataCube/DataCubeClient.js +0 -203
- package/dist/OfficialAccount/Device/DeviceClient.d.ts +0 -15
- package/dist/OfficialAccount/Device/DeviceClient.js +0 -70
- package/dist/OfficialAccount/Goods/GoodsClient.d.ts +0 -30
- package/dist/OfficialAccount/Goods/GoodsClient.js +0 -60
- package/dist/OfficialAccount/Material/MaterialClient.d.ts +0 -67
- package/dist/OfficialAccount/Material/MaterialClient.js +0 -193
- package/dist/OfficialAccount/Menu/MenuClient.d.ts +0 -27
- package/dist/OfficialAccount/Menu/MenuClient.js +0 -58
- package/dist/OfficialAccount/OCR/OCRClient.d.ts +0 -40
- package/dist/OfficialAccount/OCR/OCRClient.js +0 -85
- package/dist/OfficialAccount/POI/POIClient.d.ts +0 -39
- package/dist/OfficialAccount/POI/POIClient.js +0 -87
- package/dist/OfficialAccount/Semantic/SemanticClient.d.ts +0 -10
- package/dist/OfficialAccount/Semantic/SemanticClient.js +0 -24
- package/dist/OfficialAccount/Server/Guard.d.ts +0 -4
- package/dist/OfficialAccount/ShakeAround/Client.d.ts +0 -23
- package/dist/OfficialAccount/ShakeAround/Client.js +0 -43
- package/dist/OfficialAccount/ShakeAround/DeviceClient.d.ts +0 -51
- package/dist/OfficialAccount/ShakeAround/DeviceClient.js +0 -100
- package/dist/OfficialAccount/ShakeAround/GroupClient.d.ts +0 -44
- package/dist/OfficialAccount/ShakeAround/GroupClient.js +0 -84
- package/dist/OfficialAccount/ShakeAround/MaterialClient.d.ts +0 -9
- package/dist/OfficialAccount/ShakeAround/MaterialClient.js +0 -21
- package/dist/OfficialAccount/ShakeAround/PageClient.d.ts +0 -30
- package/dist/OfficialAccount/ShakeAround/PageClient.js +0 -56
- package/dist/OfficialAccount/ShakeAround/RelationClient.d.ts +0 -21
- package/dist/OfficialAccount/ShakeAround/RelationClient.js +0 -44
- package/dist/OfficialAccount/ShakeAround/ShakeAround.d.ts +0 -14
- package/dist/OfficialAccount/ShakeAround/ShakeAround.js +0 -25
- package/dist/OfficialAccount/ShakeAround/StatsClient.d.ts +0 -29
- package/dist/OfficialAccount/ShakeAround/StatsClient.js +0 -57
- package/dist/OfficialAccount/Store/StoreClient.d.ts +0 -63
- package/dist/OfficialAccount/Store/StoreClient.js +0 -104
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.d.ts +0 -39
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +0 -116
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.d.ts +0 -42
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +0 -114
- package/dist/OfficialAccount/User/TagClient.d.ts +0 -46
- package/dist/OfficialAccount/User/TagClient.js +0 -92
- package/dist/OfficialAccount/User/UserClient.d.ts +0 -47
- package/dist/OfficialAccount/User/UserClient.js +0 -95
- package/dist/OpenPlatform/Application.d.ts +0 -88
- package/dist/OpenPlatform/Application.js +0 -223
- package/dist/OpenPlatform/Auth/AccessToken.d.ts +0 -7
- package/dist/OpenPlatform/Auth/AccessToken.js +0 -33
- package/dist/OpenPlatform/Auth/VerifyTicket.d.ts +0 -8
- package/dist/OpenPlatform/Auth/VerifyTicket.js +0 -40
- package/dist/OpenPlatform/Authorizer/Aggregate/Account/Client.d.ts +0 -21
- package/dist/OpenPlatform/Authorizer/Aggregate/Account/Client.js +0 -45
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.d.ts +0 -12
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +0 -43
- package/dist/OpenPlatform/Authorizer/MiniProgram/Account/AccountClient.d.ts +0 -21
- package/dist/OpenPlatform/Authorizer/MiniProgram/Account/AccountClient.js +0 -42
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.d.ts +0 -15
- package/dist/OpenPlatform/Authorizer/MiniProgram/Application.js +0 -42
- package/dist/OpenPlatform/Authorizer/MiniProgram/Auth/Client.d.ts +0 -11
- package/dist/OpenPlatform/Authorizer/MiniProgram/Auth/Client.js +0 -39
- package/dist/OpenPlatform/Authorizer/MiniProgram/Code/CodeClient.d.ts +0 -85
- package/dist/OpenPlatform/Authorizer/MiniProgram/Code/CodeClient.js +0 -152
- package/dist/OpenPlatform/Authorizer/MiniProgram/Domain/DomainClient.d.ts +0 -14
- package/dist/OpenPlatform/Authorizer/MiniProgram/Domain/DomainClient.js +0 -27
- package/dist/OpenPlatform/Authorizer/MiniProgram/Setting/SettingClient.d.ts +0 -72
- package/dist/OpenPlatform/Authorizer/MiniProgram/Setting/SettingClient.js +0 -133
- package/dist/OpenPlatform/Authorizer/MiniProgram/Tester/TesterClient.d.ts +0 -17
- package/dist/OpenPlatform/Authorizer/MiniProgram/Tester/TesterClient.js +0 -35
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.d.ts +0 -18
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +0 -38
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.d.ts +0 -7
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Application.js +0 -22
- package/dist/OpenPlatform/Authorizer/OfficialAccount/MiniProgram/MiniProgramClient.d.ts +0 -19
- package/dist/OpenPlatform/Authorizer/OfficialAccount/MiniProgram/MiniProgramClient.js +0 -37
- package/dist/OpenPlatform/Authorizer/Server/Guard.d.ts +0 -4
- package/dist/OpenPlatform/Authorizer/Server/Guard.js +0 -13
- package/dist/OpenPlatform/Base/OpenPlatformBase.d.ts +0 -40
- package/dist/OpenPlatform/Base/OpenPlatformBase.js +0 -83
- package/dist/OpenPlatform/CodeTemplate/CodeTemplateClient.d.ts +0 -23
- package/dist/OpenPlatform/CodeTemplate/CodeTemplateClient.js +0 -48
- package/dist/OpenPlatform/Component/ComponentClient.d.ts +0 -15
- package/dist/OpenPlatform/Component/ComponentClient.js +0 -33
- package/dist/OpenPlatform/Server/OpenPlatformGuard.d.ts +0 -11
- package/dist/OpenPlatform/Server/OpenPlatformGuard.js +0 -54
- package/dist/OpenWork/Application.d.ts +0 -37
- package/dist/OpenWork/Application.js +0 -128
- package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +0 -8
- package/dist/OpenWork/Auth/ProviderAccessToken.js +0 -33
- package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +0 -8
- package/dist/OpenWork/Auth/SuiteAccessToken.js +0 -34
- package/dist/OpenWork/Auth/SuiteTicket.d.ts +0 -8
- package/dist/OpenWork/Auth/SuiteTicket.js +0 -40
- package/dist/OpenWork/Corp/CorpClient.d.ts +0 -72
- package/dist/OpenWork/Corp/CorpClient.js +0 -150
- package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +0 -5
- package/dist/OpenWork/MiniProgram/MiniProgramClient.js +0 -18
- package/dist/OpenWork/Provider/ProviderClient.d.ts +0 -81
- package/dist/OpenWork/Provider/ProviderClient.js +0 -172
- package/dist/OpenWork/Server/OpenWorkGuard.d.ts +0 -13
- package/dist/OpenWork/Server/OpenWorkGuard.js +0 -51
- package/dist/OpenWork/Work/Application.d.ts +0 -5
- package/dist/OpenWork/Work/Application.js +0 -22
- package/dist/OpenWork/Work/Auth/AccessToken.d.ts +0 -12
- package/dist/OpenWork/Work/Auth/AccessToken.js +0 -44
- package/dist/Payment/Application.d.ts +0 -76
- package/dist/Payment/Application.js +0 -199
- package/dist/Payment/Base/PaymentBase.d.ts +0 -13
- package/dist/Payment/Base/PaymentBase.js +0 -40
- package/dist/Payment/Bill/BillClient.d.ts +0 -10
- package/dist/Payment/Bill/BillClient.js +0 -43
- package/dist/Payment/Core/BaseClient.d.ts +0 -17
- package/dist/Payment/Core/BaseClient.js +0 -116
- package/dist/Payment/Coupon/CouponClient.d.ts +0 -6
- package/dist/Payment/Coupon/CouponClient.js +0 -37
- package/dist/Payment/Jssdk/JssdkClient.d.ts +0 -38
- package/dist/Payment/Jssdk/JssdkClient.js +0 -122
- package/dist/Payment/Merchant/MerchantClient.d.ts +0 -7
- package/dist/Payment/Merchant/MerchantClient.js +0 -40
- package/dist/Payment/Notify/Handler.d.ts +0 -25
- package/dist/Payment/Notify/Handler.js +0 -96
- package/dist/Payment/Notify/Paid.d.ts +0 -6
- package/dist/Payment/Notify/Paid.js +0 -32
- package/dist/Payment/Notify/Refunded.d.ts +0 -7
- package/dist/Payment/Notify/Refunded.js +0 -39
- package/dist/Payment/Notify/Scanned.d.ts +0 -9
- package/dist/Payment/Notify/Scanned.js +0 -54
- package/dist/Payment/Order/OrderClient.d.ts +0 -25
- package/dist/Payment/Order/OrderClient.js +0 -76
- package/dist/Payment/ProfitSharing/ProfitSharingClient.d.ts +0 -10
- package/dist/Payment/ProfitSharing/ProfitSharingClient.js +0 -59
- package/dist/Payment/Redpack/RedpackClient.d.ts +0 -23
- package/dist/Payment/Redpack/RedpackClient.js +0 -73
- package/dist/Payment/Refund/RefundClient.d.ts +0 -43
- package/dist/Payment/Refund/RefundClient.js +0 -80
- package/dist/Payment/Reverse/ReverseClient.d.ts +0 -14
- package/dist/Payment/Reverse/ReverseClient.js +0 -30
- package/dist/Payment/Sandbox/SandboxClient.d.ts +0 -8
- package/dist/Payment/Sandbox/SandboxClient.js +0 -40
- package/dist/Payment/Security/SecurityClient.d.ts +0 -7
- package/dist/Payment/Security/SecurityClient.js +0 -18
- package/dist/Payment/Transfer/TransferClient.d.ts +0 -23
- package/dist/Payment/Transfer/TransferClient.js +0 -78
- package/dist/Work/Agent/AgentClient.d.ts +0 -6
- package/dist/Work/Agent/AgentClient.js +0 -25
- package/dist/Work/Agent/WorkbenchClient.d.ts +0 -24
- package/dist/Work/Agent/WorkbenchClient.js +0 -39
- package/dist/Work/Application.d.ts +0 -78
- package/dist/Work/Application.js +0 -258
- package/dist/Work/Auth/AccessToken.d.ts +0 -5
- package/dist/Work/Auth/AccessToken.js +0 -36
- package/dist/Work/Base/WorkBase.d.ts +0 -4
- package/dist/Work/Base/WorkBase.js +0 -12
- package/dist/Work/Calendar/CalendarClient.d.ts +0 -7
- package/dist/Work/Calendar/CalendarClient.js +0 -32
- package/dist/Work/Chat/ChatClient.d.ts +0 -7
- package/dist/Work/Chat/ChatClient.js +0 -27
- package/dist/Work/CorpGroup/CorpGroupClient.d.ts +0 -40
- package/dist/Work/CorpGroup/CorpGroupClient.js +0 -68
- package/dist/Work/Department/DepartmentClient.d.ts +0 -7
- package/dist/Work/Department/DepartmentClient.js +0 -29
- package/dist/Work/ExternalContact/Client.d.ts +0 -222
- package/dist/Work/ExternalContact/Client.js +0 -365
- package/dist/Work/ExternalContact/ContactWayClient.d.ts +0 -44
- package/dist/Work/ExternalContact/ContactWayClient.js +0 -82
- package/dist/Work/ExternalContact/MessageClient.d.ts +0 -58
- package/dist/Work/ExternalContact/MessageClient.js +0 -158
- package/dist/Work/ExternalContact/MessageTemplateClient.d.ts +0 -14
- package/dist/Work/ExternalContact/MessageTemplateClient.js +0 -78
- package/dist/Work/ExternalContact/MomentClient.d.ts +0 -61
- package/dist/Work/ExternalContact/MomentClient.js +0 -104
- package/dist/Work/ExternalContact/SchoolClient.d.ts +0 -28
- package/dist/Work/ExternalContact/SchoolClient.js +0 -177
- package/dist/Work/ExternalContact/StatisticsClient.d.ts +0 -28
- package/dist/Work/ExternalContact/StatisticsClient.js +0 -52
- package/dist/Work/GroupRobot/GroupRobotClient.d.ts +0 -7
- package/dist/Work/GroupRobot/GroupRobotClient.js +0 -18
- package/dist/Work/GroupRobot/Messages/Image.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/Image.js +0 -15
- package/dist/Work/GroupRobot/Messages/Markdown.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/Markdown.js +0 -14
- package/dist/Work/GroupRobot/Messages/Message.d.ts +0 -3
- package/dist/Work/GroupRobot/Messages/Message.js +0 -7
- package/dist/Work/GroupRobot/Messages/News.d.ts +0 -8
- package/dist/Work/GroupRobot/Messages/News.js +0 -29
- package/dist/Work/GroupRobot/Messages/NewsItem.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/NewsItem.js +0 -20
- package/dist/Work/GroupRobot/Messages/Text.d.ts +0 -8
- package/dist/Work/GroupRobot/Messages/Text.js +0 -24
- package/dist/Work/GroupRobot/Messages/index.d.ts +0 -6
- package/dist/Work/GroupRobot/Messages/index.js +0 -18
- package/dist/Work/GroupRobot/Messenger.d.ts +0 -11
- package/dist/Work/GroupRobot/Messenger.js +0 -39
- package/dist/Work/Invoice/InvoiceClient.d.ts +0 -7
- package/dist/Work/Invoice/InvoiceClient.js +0 -38
- package/dist/Work/Jssdk/JssdkClient.d.ts +0 -21
- package/dist/Work/Jssdk/JssdkClient.js +0 -106
- package/dist/Work/Kf/KfAccountClient.d.ts +0 -41
- package/dist/Work/Kf/KfAccountClient.js +0 -71
- package/dist/Work/Kf/KfMessageClient.d.ts +0 -44
- package/dist/Work/Kf/KfMessageClient.js +0 -73
- package/dist/Work/Kf/KfServicerClient.d.ts +0 -26
- package/dist/Work/Kf/KfServicerClient.js +0 -47
- package/dist/Work/Live/LiveClient.d.ts +0 -6
- package/dist/Work/Live/LiveClient.js +0 -32
- package/dist/Work/Media/MediaClient.d.ts +0 -52
- package/dist/Work/Media/MediaClient.js +0 -124
- package/dist/Work/Menu/MenuClient.d.ts +0 -6
- package/dist/Work/Menu/MenuClient.js +0 -24
- package/dist/Work/Message/MessageClient.d.ts +0 -7
- package/dist/Work/Message/MessageClient.js +0 -16
- package/dist/Work/Message/Messenger.d.ts +0 -18
- package/dist/Work/Message/Messenger.js +0 -69
- package/dist/Work/MiniProgram/Application.d.ts +0 -7
- package/dist/Work/MiniProgram/Application.js +0 -26
- package/dist/Work/MiniProgram/Auth/AuthClient.d.ts +0 -8
- package/dist/Work/MsgAudit/MsgAuditClient.d.ts +0 -7
- package/dist/Work/MsgAudit/MsgAuditClient.js +0 -32
- package/dist/Work/OA/OAClient.d.ts +0 -11
- package/dist/Work/OA/OAClient.js +0 -67
- package/dist/Work/Schedule/ScheduleClient.d.ts +0 -8
- package/dist/Work/Schedule/ScheduleClient.js +0 -39
- package/dist/Work/Server/Guard.d.ts +0 -6
- package/dist/Work/Server/Guard.js +0 -34
- package/dist/Work/User/TagClient.d.ts +0 -13
- package/dist/Work/User/TagClient.js +0 -53
- package/dist/Work/User/UserClient.d.ts +0 -16
- package/dist/Work/User/UserClient.js +0 -80
- package/dist/index.d.ts +0 -119
- package/dist/index.js +0 -86
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const ServerGuard_1 = __importDefault(require("../../../Core/ServerGuard"));
|
|
7
|
-
class Guard extends ServerGuard_1.default {
|
|
8
|
-
getToken() {
|
|
9
|
-
return this.app['encryptor'].getToken();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.default = Guard;
|
|
13
|
-
;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import BaseClient from '../../Core/BaseClient';
|
|
2
|
-
export default class OpenPlatformBase extends BaseClient {
|
|
3
|
-
/**
|
|
4
|
-
* 使用授权码换取接口调用凭据和授权信息
|
|
5
|
-
* @param authCode 授权码, 会在授权成功的回调返回给第三方平台
|
|
6
|
-
*/
|
|
7
|
-
handleAuthorize(authCode?: string): Promise<any>;
|
|
8
|
-
/**
|
|
9
|
-
* 获取授权方的帐号基本信息
|
|
10
|
-
* @param appId 授权方app_id
|
|
11
|
-
*/
|
|
12
|
-
getAuthorizer(appId: string): Promise<any>;
|
|
13
|
-
/**
|
|
14
|
-
* 设置授权方的选项信息
|
|
15
|
-
* @param appId 授权方app_id
|
|
16
|
-
* @param name 选项名称
|
|
17
|
-
*/
|
|
18
|
-
getAuthorizerOption(appId: string, name: string): Promise<any>;
|
|
19
|
-
/**
|
|
20
|
-
* 设置授权方的选项信息
|
|
21
|
-
* @param appId 授权方app_id
|
|
22
|
-
* @param name 选项名称
|
|
23
|
-
* @param value 选项值
|
|
24
|
-
*/
|
|
25
|
-
setAuthorizerOption(appId: string, name: string, value: string): Promise<any>;
|
|
26
|
-
/**
|
|
27
|
-
* 获取已授权的授权方列表
|
|
28
|
-
* @param offset 起始位置,从0开始
|
|
29
|
-
* @param count 获取记录数,最大500
|
|
30
|
-
*/
|
|
31
|
-
getAuthorizers(offset?: number, count?: number): Promise<any>;
|
|
32
|
-
/**
|
|
33
|
-
* 获取预授权码
|
|
34
|
-
*/
|
|
35
|
-
createPreAuthorizationCode(): Promise<any>;
|
|
36
|
-
/**
|
|
37
|
-
* 清零调用次数
|
|
38
|
-
*/
|
|
39
|
-
clearQuota(): Promise<any>;
|
|
40
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
-
class OpenPlatformBase extends BaseClient_1.default {
|
|
8
|
-
/**
|
|
9
|
-
* 使用授权码换取接口调用凭据和授权信息
|
|
10
|
-
* @param authCode 授权码, 会在授权成功的回调返回给第三方平台
|
|
11
|
-
*/
|
|
12
|
-
handleAuthorize(authCode = null) {
|
|
13
|
-
return this.httpPostJson('cgi-bin/component/api_query_auth', {
|
|
14
|
-
component_appid: this.app.config.app_id,
|
|
15
|
-
authorization_code: authCode || this.app['request'].get('auth_code'),
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 获取授权方的帐号基本信息
|
|
20
|
-
* @param appId 授权方app_id
|
|
21
|
-
*/
|
|
22
|
-
getAuthorizer(appId) {
|
|
23
|
-
return this.httpPostJson('cgi-bin/component/api_get_authorizer_info', {
|
|
24
|
-
component_appid: this.app.config.app_id,
|
|
25
|
-
authorizer_appid: appId,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* 设置授权方的选项信息
|
|
30
|
-
* @param appId 授权方app_id
|
|
31
|
-
* @param name 选项名称
|
|
32
|
-
*/
|
|
33
|
-
getAuthorizerOption(appId, name) {
|
|
34
|
-
return this.httpPostJson('cgi-bin/component/api_get_authorizer_option', {
|
|
35
|
-
component_appid: this.app.config.app_id,
|
|
36
|
-
authorizer_appid: appId,
|
|
37
|
-
option_name: name,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* 设置授权方的选项信息
|
|
42
|
-
* @param appId 授权方app_id
|
|
43
|
-
* @param name 选项名称
|
|
44
|
-
* @param value 选项值
|
|
45
|
-
*/
|
|
46
|
-
setAuthorizerOption(appId, name, value) {
|
|
47
|
-
return this.httpPostJson('cgi-bin/component/api_set_authorizer_option', {
|
|
48
|
-
component_appid: this.app.config.app_id,
|
|
49
|
-
authorizer_appid: appId,
|
|
50
|
-
option_name: name,
|
|
51
|
-
option_value: value,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 获取已授权的授权方列表
|
|
56
|
-
* @param offset 起始位置,从0开始
|
|
57
|
-
* @param count 获取记录数,最大500
|
|
58
|
-
*/
|
|
59
|
-
getAuthorizers(offset = 0, count = 500) {
|
|
60
|
-
return this.httpPostJson('cgi-bin/component/api_get_authorizer_list', {
|
|
61
|
-
component_appid: this.app.config.app_id,
|
|
62
|
-
offset,
|
|
63
|
-
count,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 获取预授权码
|
|
68
|
-
*/
|
|
69
|
-
createPreAuthorizationCode() {
|
|
70
|
-
return this.httpPostJson('cgi-bin/component/api_create_preauthcode', {
|
|
71
|
-
component_appid: this.app.config.app_id,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* 清零调用次数
|
|
76
|
-
*/
|
|
77
|
-
clearQuota() {
|
|
78
|
-
return this.httpPostJson('cgi-bin/component/clear_quota', {
|
|
79
|
-
component_appid: this.app.config.app_id,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.default = OpenPlatformBase;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import BaseClient from '../../Core/BaseClient';
|
|
2
|
-
export default class CodeTemplateClient extends BaseClient {
|
|
3
|
-
/**
|
|
4
|
-
* 获取代码草稿列表
|
|
5
|
-
*/
|
|
6
|
-
getDrafts(): Promise<any>;
|
|
7
|
-
/**
|
|
8
|
-
* 将草稿添加到代码模板库
|
|
9
|
-
* @param draftId 草稿 ID
|
|
10
|
-
* @param templateType 默认值是0,对应普通模板;可选1,对应标准模板库
|
|
11
|
-
*/
|
|
12
|
-
createFromDraft(draftId: number, templateType?: number): Promise<any>;
|
|
13
|
-
/**
|
|
14
|
-
* 获取代码模板列表
|
|
15
|
-
* @param templateType 默认值是0,对应普通模板;可选1,对应标准模板库
|
|
16
|
-
*/
|
|
17
|
-
list(templateType?: number): Promise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* 删除指定代码模板
|
|
20
|
-
* @param templateId 模板 ID
|
|
21
|
-
*/
|
|
22
|
-
delete(templateId: string): Promise<any>;
|
|
23
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
-
class CodeTemplateClient extends BaseClient_1.default {
|
|
8
|
-
/**
|
|
9
|
-
* 获取代码草稿列表
|
|
10
|
-
*/
|
|
11
|
-
getDrafts() {
|
|
12
|
-
return this.httpGet('wxa/gettemplatedraftlist');
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* 将草稿添加到代码模板库
|
|
16
|
-
* @param draftId 草稿 ID
|
|
17
|
-
* @param templateType 默认值是0,对应普通模板;可选1,对应标准模板库
|
|
18
|
-
*/
|
|
19
|
-
createFromDraft(draftId, templateType = 0) {
|
|
20
|
-
return this.httpPostJson('wxa/addtotemplate', {
|
|
21
|
-
draft_id: draftId,
|
|
22
|
-
template_type: templateType,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 获取代码模板列表
|
|
27
|
-
* @param templateType 默认值是0,对应普通模板;可选1,对应标准模板库
|
|
28
|
-
*/
|
|
29
|
-
list(templateType = null) {
|
|
30
|
-
let query = null;
|
|
31
|
-
if (templateType !== null) {
|
|
32
|
-
query = {
|
|
33
|
-
template_type: templateType,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return this.httpGet('wxa/gettemplatelist', query);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 删除指定代码模板
|
|
40
|
-
* @param templateId 模板 ID
|
|
41
|
-
*/
|
|
42
|
-
delete(templateId) {
|
|
43
|
-
return this.httpPostJson('wxa/deletetemplate', {
|
|
44
|
-
template_id: templateId,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.default = CodeTemplateClient;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import BaseClient from '../../Core/BaseClient';
|
|
2
|
-
export default class ComponentClient extends BaseClient {
|
|
3
|
-
/**
|
|
4
|
-
* 创建小程序
|
|
5
|
-
* @param params 小程序信息
|
|
6
|
-
*/
|
|
7
|
-
registerMiniProgram(params: object): Promise<any>;
|
|
8
|
-
/**
|
|
9
|
-
* 查询创建任务状态
|
|
10
|
-
* @param companyName 企业名
|
|
11
|
-
* @param legalPersonaWechat 法人微信
|
|
12
|
-
* @param legalPersonaName 法人姓名
|
|
13
|
-
*/
|
|
14
|
-
getRegistrationStatus(companyName: string, legalPersonaWechat: string, legalPersonaName: string): Promise<any>;
|
|
15
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
|
|
7
|
-
class ComponentClient extends BaseClient_1.default {
|
|
8
|
-
/**
|
|
9
|
-
* 创建小程序
|
|
10
|
-
* @param params 小程序信息
|
|
11
|
-
*/
|
|
12
|
-
registerMiniProgram(params) {
|
|
13
|
-
return this.httpPostJson('cgi-bin/component/fastregisterweapp', params, {
|
|
14
|
-
action: 'create',
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 查询创建任务状态
|
|
19
|
-
* @param companyName 企业名
|
|
20
|
-
* @param legalPersonaWechat 法人微信
|
|
21
|
-
* @param legalPersonaName 法人姓名
|
|
22
|
-
*/
|
|
23
|
-
getRegistrationStatus(companyName, legalPersonaWechat, legalPersonaName) {
|
|
24
|
-
return this.httpPostJson('cgi-bin/component/fastregisterweapp', {
|
|
25
|
-
name: companyName,
|
|
26
|
-
legal_persona_wechat: legalPersonaWechat,
|
|
27
|
-
legal_persona_name: legalPersonaName,
|
|
28
|
-
}, {
|
|
29
|
-
action: 'search',
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = ComponentClient;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import ServerGuard from '../../Core/ServerGuard';
|
|
2
|
-
import Response from '../../Core/Http/Response';
|
|
3
|
-
export declare const EVENT_AUTHORIZED = "authorized";
|
|
4
|
-
export declare const EVENT_UNAUTHORIZED = "unauthorized";
|
|
5
|
-
export declare const EVENT_UPDATE_AUTHORIZED = "updateauthorized";
|
|
6
|
-
export declare const EVENT_COMPONENT_VERIFY_TICKET = "component_verify_ticket";
|
|
7
|
-
export declare const EVENT_THIRD_FAST_REGISTERED = "notify_third_fasteregister";
|
|
8
|
-
export default class OpenPlatformGuard extends ServerGuard {
|
|
9
|
-
protected resolve(): Promise<Response>;
|
|
10
|
-
protected registerHandlers(): void;
|
|
11
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.EVENT_THIRD_FAST_REGISTERED = exports.EVENT_COMPONENT_VERIFY_TICKET = exports.EVENT_UPDATE_AUTHORIZED = exports.EVENT_UNAUTHORIZED = exports.EVENT_AUTHORIZED = void 0;
|
|
16
|
-
const ServerGuard_1 = __importDefault(require("../../Core/ServerGuard"));
|
|
17
|
-
const Response_1 = __importDefault(require("../../Core/Http/Response"));
|
|
18
|
-
exports.EVENT_AUTHORIZED = 'authorized';
|
|
19
|
-
exports.EVENT_UNAUTHORIZED = 'unauthorized';
|
|
20
|
-
exports.EVENT_UPDATE_AUTHORIZED = 'updateauthorized';
|
|
21
|
-
exports.EVENT_COMPONENT_VERIFY_TICKET = 'component_verify_ticket';
|
|
22
|
-
exports.EVENT_THIRD_FAST_REGISTERED = 'notify_third_fasteregister';
|
|
23
|
-
class OpenPlatformGuard extends ServerGuard_1.default {
|
|
24
|
-
resolve() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
this.registerHandlers();
|
|
27
|
-
let message = yield this.getMessage();
|
|
28
|
-
if (message['InfoType']) {
|
|
29
|
-
yield this.dispatch(message['InfoType'], message);
|
|
30
|
-
}
|
|
31
|
-
return new Response_1.default(Buffer.from(ServerGuard_1.default.SUCCESS_EMPTY_RESPONSE));
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
registerHandlers() {
|
|
35
|
-
this.on(exports.EVENT_AUTHORIZED, function () {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
37
|
-
});
|
|
38
|
-
this.on(exports.EVENT_UNAUTHORIZED, function () {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
40
|
-
});
|
|
41
|
-
this.on(exports.EVENT_UPDATE_AUTHORIZED, function () {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () { });
|
|
43
|
-
});
|
|
44
|
-
this.on(exports.EVENT_COMPONENT_VERIFY_TICKET, function (payload) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
if (payload['ComponentVerifyTicket']) {
|
|
47
|
-
this.app['verify_ticket'].setTicket(payload['ComponentVerifyTicket']);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.default = OpenPlatformGuard;
|
|
54
|
-
;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import BaseApplication from '../Core/BaseApplication';
|
|
2
|
-
import MiniProgram from '../Work/MiniProgram/Application';
|
|
3
|
-
import Work from './Work/Application';
|
|
4
|
-
import ProviderAccessToken from './Auth/ProviderAccessToken';
|
|
5
|
-
import SuiteAccessToken from './Auth/SuiteAccessToken';
|
|
6
|
-
import SuiteTicket from './Auth/SuiteTicket';
|
|
7
|
-
import CorpClient from './Corp/CorpClient';
|
|
8
|
-
import MiniProgramClient from './MiniProgram/MiniProgramClient';
|
|
9
|
-
import ProviderClient from './Provider/ProviderClient';
|
|
10
|
-
import Encryptor from '../Core/Encryptor';
|
|
11
|
-
import OpenWorkGuard from './Server/OpenWorkGuard';
|
|
12
|
-
import { EasyWechatConfig } from '../Core/Types';
|
|
13
|
-
export default class OpenWork extends BaseApplication {
|
|
14
|
-
protected defaultConfig: EasyWechatConfig;
|
|
15
|
-
provider_access_token: ProviderAccessToken;
|
|
16
|
-
suite_access_token: SuiteAccessToken;
|
|
17
|
-
suite_ticket: SuiteTicket;
|
|
18
|
-
corp: CorpClient;
|
|
19
|
-
mini_program: MiniProgramClient;
|
|
20
|
-
provider: ProviderClient;
|
|
21
|
-
encryptor_corp: Encryptor;
|
|
22
|
-
encryptor: Encryptor;
|
|
23
|
-
server: OpenWorkGuard;
|
|
24
|
-
constructor(config?: EasyWechatConfig, prepends?: Object, id?: String);
|
|
25
|
-
registerProviders(): void;
|
|
26
|
-
/**
|
|
27
|
-
* 代理小程序实现业务,返回SDK实例
|
|
28
|
-
*/
|
|
29
|
-
miniProgram(): MiniProgram;
|
|
30
|
-
/**
|
|
31
|
-
* 代理企业微信实现业务,返回SDK实例
|
|
32
|
-
* @param authCorpId 企业 corp_id
|
|
33
|
-
* @param permanentCode 企业永久授权码
|
|
34
|
-
* @returns
|
|
35
|
-
*/
|
|
36
|
-
work(authCorpId: string, permanentCode: string): Work;
|
|
37
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const BaseApplication_1 = __importDefault(require("../Core/BaseApplication"));
|
|
16
|
-
const Application_1 = __importDefault(require("../Work/MiniProgram/Application"));
|
|
17
|
-
const Application_2 = __importDefault(require("./Work/Application"));
|
|
18
|
-
const ProviderAccessToken_1 = __importDefault(require("./Auth/ProviderAccessToken"));
|
|
19
|
-
const SuiteAccessToken_1 = __importDefault(require("./Auth/SuiteAccessToken"));
|
|
20
|
-
const SuiteTicket_1 = __importDefault(require("./Auth/SuiteTicket"));
|
|
21
|
-
const CorpClient_1 = __importDefault(require("./Corp/CorpClient"));
|
|
22
|
-
const MiniProgramClient_1 = __importDefault(require("./MiniProgram/MiniProgramClient"));
|
|
23
|
-
const ProviderClient_1 = __importDefault(require("./Provider/ProviderClient"));
|
|
24
|
-
const Encryptor_1 = __importDefault(require("../Core/Encryptor"));
|
|
25
|
-
const OpenWorkGuard_1 = __importDefault(require("./Server/OpenWorkGuard"));
|
|
26
|
-
const FinallResult_1 = __importDefault(require("../Core/Decorators/FinallResult"));
|
|
27
|
-
class OpenWork extends BaseApplication_1.default {
|
|
28
|
-
constructor(config = {}, prepends = {}, id = null) {
|
|
29
|
-
super(config, prepends, id);
|
|
30
|
-
this.defaultConfig = {
|
|
31
|
-
// 必要配置
|
|
32
|
-
app_id: '',
|
|
33
|
-
key: '',
|
|
34
|
-
http: {
|
|
35
|
-
baseURL: 'https://qyapi.weixin.qq.com/',
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
this.provider_access_token = null;
|
|
39
|
-
this.suite_access_token = null;
|
|
40
|
-
this.suite_ticket = null;
|
|
41
|
-
this.corp = null;
|
|
42
|
-
this.mini_program = null;
|
|
43
|
-
this.provider = null;
|
|
44
|
-
this.encryptor_corp = null;
|
|
45
|
-
this.encryptor = null;
|
|
46
|
-
this.server = null;
|
|
47
|
-
this.registerProviders();
|
|
48
|
-
}
|
|
49
|
-
registerProviders() {
|
|
50
|
-
super.registerCommonProviders();
|
|
51
|
-
if (!this.provider_access_token) {
|
|
52
|
-
this.offsetSet('provider_access_token', function (app) {
|
|
53
|
-
return new ProviderAccessToken_1.default(app);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
this.offsetSet('suite_ticket', function (app) {
|
|
57
|
-
return new SuiteTicket_1.default(app);
|
|
58
|
-
});
|
|
59
|
-
if (!this.suite_access_token) {
|
|
60
|
-
this.offsetSet('suite_access_token', function (app) {
|
|
61
|
-
return new SuiteAccessToken_1.default(app);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
if (!this.corp) {
|
|
65
|
-
this.offsetSet('corp', function (app) {
|
|
66
|
-
return new CorpClient_1.default(app);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (!this.mini_program) {
|
|
70
|
-
this.offsetSet('mini_program', function (app) {
|
|
71
|
-
return new MiniProgramClient_1.default(app);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (!this.provider) {
|
|
75
|
-
this.offsetSet('provider', function (app) {
|
|
76
|
-
return new ProviderClient_1.default(app);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (!this.encryptor_corp) {
|
|
80
|
-
this.offsetSet('encryptor_corp', function (app) {
|
|
81
|
-
return new Encryptor_1.default(app.config['corp_id'], app.config['token'], app.config['aes_key']);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (!this.encryptor) {
|
|
85
|
-
this.offsetSet('encryptor', function (app) {
|
|
86
|
-
return new Encryptor_1.default(app.config['suite_id'], app.config['token'], app.config['aes_key']);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (!this.server) {
|
|
90
|
-
this.offsetSet('server', function (app) {
|
|
91
|
-
let guard = new OpenWorkGuard_1.default(app);
|
|
92
|
-
guard.push(function (payload) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
let decrypted = yield this.app.request.get('echostr');
|
|
95
|
-
if (decrypted) {
|
|
96
|
-
let str = this.app.encryptor_corp.decrypt(decrypted, this.app.request.get('msg_signature'), this.app.request.get('nonce'), this.app.request.get('timestamp'));
|
|
97
|
-
return new FinallResult_1.default(str);
|
|
98
|
-
}
|
|
99
|
-
// 缓存SuiteTicket
|
|
100
|
-
if (typeof payload['SuiteTicket'] != 'undefined') {
|
|
101
|
-
yield this.app.suite_ticket.setTicket(payload['SuiteTicket']);
|
|
102
|
-
return new FinallResult_1.default('success');
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
return guard;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* 代理小程序实现业务,返回SDK实例
|
|
113
|
-
*/
|
|
114
|
-
miniProgram() {
|
|
115
|
-
return new Application_1.default(this.getConfig());
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* 代理企业微信实现业务,返回SDK实例
|
|
119
|
-
* @param authCorpId 企业 corp_id
|
|
120
|
-
* @param permanentCode 企业永久授权码
|
|
121
|
-
* @returns
|
|
122
|
-
*/
|
|
123
|
-
work(authCorpId, permanentCode) {
|
|
124
|
-
return new Application_2.default(authCorpId, permanentCode, this);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
exports.default = OpenWork;
|
|
128
|
-
;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import BaseAccessToken from '../../Core/BaseAccessToken';
|
|
2
|
-
export default class ProviderAccessToken extends BaseAccessToken {
|
|
3
|
-
protected requestMethod: string;
|
|
4
|
-
protected tokenKey: string;
|
|
5
|
-
protected endpointToGetToken: string;
|
|
6
|
-
protected cachePrefix: string;
|
|
7
|
-
protected getCredentials(): Promise<object>;
|
|
8
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const BaseAccessToken_1 = __importDefault(require("../../Core/BaseAccessToken"));
|
|
16
|
-
class ProviderAccessToken extends BaseAccessToken_1.default {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.requestMethod = 'POST';
|
|
20
|
-
this.tokenKey = 'provider_access_token';
|
|
21
|
-
this.endpointToGetToken = 'cgi-bin/service/get_provider_token';
|
|
22
|
-
this.cachePrefix = 'easywechat.kernel.provider_access_token.';
|
|
23
|
-
}
|
|
24
|
-
getCredentials() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
return {
|
|
27
|
-
corpid: this.app.config.corp_id,
|
|
28
|
-
provider_secret: this.app.config.secret,
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = ProviderAccessToken;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import BaseAccessToken from '../../Core/BaseAccessToken';
|
|
2
|
-
export default class SuiteAccessToken extends BaseAccessToken {
|
|
3
|
-
protected requestMethod: string;
|
|
4
|
-
protected tokenKey: string;
|
|
5
|
-
protected endpointToGetToken: string;
|
|
6
|
-
protected cachePrefix: string;
|
|
7
|
-
protected getCredentials(): Promise<object>;
|
|
8
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const BaseAccessToken_1 = __importDefault(require("../../Core/BaseAccessToken"));
|
|
16
|
-
class SuiteAccessToken extends BaseAccessToken_1.default {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.requestMethod = 'POST';
|
|
20
|
-
this.tokenKey = 'suite_access_token';
|
|
21
|
-
this.endpointToGetToken = 'cgi-bin/service/get_suite_token';
|
|
22
|
-
this.cachePrefix = 'easywechat.kernel.suite_access_token.';
|
|
23
|
-
}
|
|
24
|
-
getCredentials() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
return {
|
|
27
|
-
suite_id: this.app.config.suite_id,
|
|
28
|
-
suite_secret: this.app.config.suite_secret,
|
|
29
|
-
suite_ticket: yield this.app['suite_ticket'].getTicket(),
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.default = SuiteAccessToken;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import BaseApplication from '../../Core/BaseApplication';
|
|
2
|
-
export default class SuiteTicket {
|
|
3
|
-
protected app: BaseApplication;
|
|
4
|
-
constructor(app: BaseApplication);
|
|
5
|
-
setTicket(ticket: string): Promise<this>;
|
|
6
|
-
getTicket(): Promise<string>;
|
|
7
|
-
protected getCacheKey(): string;
|
|
8
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
class SuiteTicket {
|
|
13
|
-
constructor(app) {
|
|
14
|
-
this.app = null;
|
|
15
|
-
this.app = app;
|
|
16
|
-
}
|
|
17
|
-
setTicket(ticket) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
let cacher = this.app.getCache();
|
|
20
|
-
yield cacher.set(this.getCacheKey(), ticket, 3600);
|
|
21
|
-
if (!(yield cacher.has(this.getCacheKey()))) {
|
|
22
|
-
throw new Error('Failed to cache suite ticket.');
|
|
23
|
-
}
|
|
24
|
-
return this;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
getTicket() {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
let cached = yield this.app.getCache().get(this.getCacheKey());
|
|
30
|
-
if (cached) {
|
|
31
|
-
return cached;
|
|
32
|
-
}
|
|
33
|
-
throw new Error('Credential "suite_ticket" does not exist in cache.');
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
getCacheKey() {
|
|
37
|
-
return 'easywechat.open_work.suite_ticket.' + this.app.config.suite_id;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.default = SuiteTicket;
|