@ningboyz/wxmp 1.0.11 → 1.0.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/es/client/core/index.d.ts +11 -0
- package/es/client/core/index.js +15 -0
- package/es/client/core/types.d.ts +11 -0
- package/es/client/core/types.js +8 -0
- package/es/client/core/user.d.ts +14 -0
- package/es/client/{wxClient.js → core/user.js} +2 -6
- package/es/client/noti/index.d.ts +11 -0
- package/es/client/noti/index.js +15 -0
- package/es/client/noti/main.d.ts +14 -0
- package/es/client/noti/main.js +17 -0
- package/es/client/noti/types.d.ts +9 -0
- package/es/client/noti/types.js +7 -0
- package/es/index.d.ts +4 -3
- package/es/index.js +12 -7
- package/es/request/wxRequest.d.ts +4 -4
- package/es/types.d.ts +2 -12
- package/es/types.js +1 -7
- package/package.json +1 -1
- package/es/client/wxClient.d.ts +0 -15
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IWxConfig } from '../../types';
|
|
2
|
+
import { default as UserRequest } from './user';
|
|
3
|
+
declare class CoreClient {
|
|
4
|
+
user: UserRequest;
|
|
5
|
+
private constructor();
|
|
6
|
+
static create: (config: IWxConfig) => CoreClient;
|
|
7
|
+
}
|
|
8
|
+
declare const createCoreClient: (config: IWxConfig) => CoreClient;
|
|
9
|
+
export default CoreClient;
|
|
10
|
+
export { CoreClient, createCoreClient };
|
|
11
|
+
export * from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createWxRequest as c } from "../../request/wxRequest.js";
|
|
2
|
+
import o from "./user.js";
|
|
3
|
+
class r {
|
|
4
|
+
user;
|
|
5
|
+
constructor(e) {
|
|
6
|
+
const s = c(e);
|
|
7
|
+
this.user = new o(s);
|
|
8
|
+
}
|
|
9
|
+
static create = (e) => new r(e);
|
|
10
|
+
}
|
|
11
|
+
const a = (t) => r.create(t);
|
|
12
|
+
export {
|
|
13
|
+
r as CoreClient,
|
|
14
|
+
a as createCoreClient
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TCore } from '@ningboyz/types';
|
|
2
|
+
import { WxRequest } from '../../request/wxRequest';
|
|
3
|
+
import { IWxLoginParams } from './types';
|
|
4
|
+
declare class UserRequest {
|
|
5
|
+
private wxRequest;
|
|
6
|
+
constructor(wxRequest: WxRequest);
|
|
7
|
+
/**
|
|
8
|
+
* 微信登录
|
|
9
|
+
* @param params
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
login(params: IWxLoginParams): Promise<import('@ningboyz/types/src/response').IResponse<TCore.IUserResponse[]>>;
|
|
13
|
+
}
|
|
14
|
+
export default UserRequest;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { createWxRequest as s } from "../request/wxRequest.js";
|
|
2
1
|
class t {
|
|
3
2
|
wxRequest;
|
|
4
3
|
constructor(e) {
|
|
5
|
-
this.wxRequest =
|
|
4
|
+
this.wxRequest = e;
|
|
6
5
|
}
|
|
7
|
-
static create = (e) => new t(e);
|
|
8
6
|
/**
|
|
9
7
|
* 微信登录
|
|
10
8
|
* @param params
|
|
@@ -14,8 +12,6 @@ class t {
|
|
|
14
12
|
return this.wxRequest.post("/gapi/core/tuser/verifyd2/weixin", void 0, e);
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
|
-
const c = (r) => t.create(r);
|
|
18
15
|
export {
|
|
19
|
-
t as
|
|
20
|
-
c as createWxClient
|
|
16
|
+
t as default
|
|
21
17
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IWxConfig } from '../../types';
|
|
2
|
+
import { default as MainRequest } from './main';
|
|
3
|
+
declare class NoticeClient {
|
|
4
|
+
main: MainRequest;
|
|
5
|
+
private constructor();
|
|
6
|
+
static create: (config: IWxConfig) => NoticeClient;
|
|
7
|
+
}
|
|
8
|
+
declare const createNoticeClient: (config: IWxConfig) => NoticeClient;
|
|
9
|
+
export default NoticeClient;
|
|
10
|
+
export { NoticeClient, createNoticeClient };
|
|
11
|
+
export * from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createWxRequest as n } from "../../request/wxRequest.js";
|
|
2
|
+
import o from "./main.js";
|
|
3
|
+
class t {
|
|
4
|
+
main;
|
|
5
|
+
constructor(e) {
|
|
6
|
+
const c = n(e);
|
|
7
|
+
this.main = new o(c);
|
|
8
|
+
}
|
|
9
|
+
static create = (e) => new t(e);
|
|
10
|
+
}
|
|
11
|
+
const i = (r) => t.create(r);
|
|
12
|
+
export {
|
|
13
|
+
t as NoticeClient,
|
|
14
|
+
i as createNoticeClient
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TNoti } from '@ningboyz/types';
|
|
2
|
+
import { WxRequest } from '../../request/wxRequest';
|
|
3
|
+
import { INotiMainGet4NotiQuerys } from './types';
|
|
4
|
+
declare class MainRequest {
|
|
5
|
+
private wxRequest;
|
|
6
|
+
constructor(wxRequest: WxRequest);
|
|
7
|
+
/**
|
|
8
|
+
* 获取用户权限内通知
|
|
9
|
+
* @param querys
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
get4noti(querys: INotiMainGet4NotiQuerys): Promise<import('@ningboyz/types/src/response').IResponse<TNoti.INotiMainResponse[]>>;
|
|
13
|
+
}
|
|
14
|
+
export default MainRequest;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class s {
|
|
2
|
+
wxRequest;
|
|
3
|
+
constructor(t) {
|
|
4
|
+
this.wxRequest = t;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 获取用户权限内通知
|
|
8
|
+
* @param querys
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
get4noti(t) {
|
|
12
|
+
return this.wxRequest.post("/gapi/noti/tmain/get4noti", t);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
s as default
|
|
17
|
+
};
|
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CoreClient, createCoreClient, IWxLoginParams, TWxLoginParams } from './client/core';
|
|
2
|
+
import { NoticeClient, createNoticeClient, INotiMainGet4NotiQuerys, TNotiMainGet4NotiQuerys } from './client/noti';
|
|
2
3
|
import { WxRequest, createWxRequest } from './request/wxRequest';
|
|
3
|
-
import { IWxConfig, IWxInternalRequestConfig,
|
|
4
|
-
export { type
|
|
4
|
+
import { IWxConfig, IWxInternalRequestConfig, IWxQueryParams, IWxRequestOptions, IWxResponse, TWxConfig, TWxHttpMethod, TWxInterceptorsRequest, TWxInterceptorsResponse } from './types';
|
|
5
|
+
export { type CoreClient, createCoreClient, type NoticeClient, createNoticeClient, type INotiMainGet4NotiQuerys, TNotiMainGet4NotiQuerys, type WxRequest, createWxRequest, type IWxConfig, type IWxInternalRequestConfig, type IWxLoginParams, type IWxQueryParams, type IWxRequestOptions, type IWxResponse, type TWxHttpMethod, type TWxInterceptorsRequest, type TWxInterceptorsResponse, TWxConfig, TWxLoginParams };
|
package/es/index.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { createCoreClient as r } from "./client/core/index.js";
|
|
2
|
+
import { createNoticeClient as x } from "./client/noti/index.js";
|
|
3
|
+
import { createWxRequest as f } from "./request/wxRequest.js";
|
|
4
|
+
import { TWxConfig as a } from "./types.js";
|
|
5
|
+
import { TNotiMainGet4NotiQuerys as n } from "./client/noti/types.js";
|
|
6
|
+
import { TWxLoginParams as C } from "./client/core/types.js";
|
|
4
7
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
n as TNotiMainGet4NotiQuerys,
|
|
9
|
+
a as TWxConfig,
|
|
10
|
+
C as TWxLoginParams,
|
|
11
|
+
r as createCoreClient,
|
|
12
|
+
x as createNoticeClient,
|
|
13
|
+
f as createWxRequest
|
|
9
14
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TResp } from '@ningboyz/types';
|
|
2
|
-
import { IWxConfig,
|
|
2
|
+
import { IWxConfig, IWxRequestOptions } from '../types';
|
|
3
3
|
declare class WxRequest {
|
|
4
4
|
private config;
|
|
5
5
|
private constructor();
|
|
@@ -7,12 +7,12 @@ declare class WxRequest {
|
|
|
7
7
|
/**
|
|
8
8
|
* 表单提交。body 字段名 params,值是 JSON 字符串,对应 apis 里的 post。
|
|
9
9
|
*/
|
|
10
|
-
post<T>(url: string, querys?:
|
|
10
|
+
post<T>(url: string, querys?: object, params?: object, headers?: Record<string, string>): Promise<TResp.IResponse<T>>;
|
|
11
11
|
/**
|
|
12
12
|
* JSON 提交,对应 apis 里的 postJson。国密加密接口请走此方法。
|
|
13
13
|
*/
|
|
14
|
-
postJson<T>(url: string, querys?:
|
|
15
|
-
get<T>(url: string, querys?:
|
|
14
|
+
postJson<T>(url: string, querys?: object, params?: object, headers?: Record<string, string>): Promise<TResp.IResponse<T>>;
|
|
15
|
+
get<T>(url: string, querys?: object, headers?: Record<string, string>): Promise<TResp.IResponse<T>>;
|
|
16
16
|
request<T>(url: string, options: IWxRequestOptions): Promise<TResp.IResponse<T>>;
|
|
17
17
|
private send;
|
|
18
18
|
private handleSuccess;
|
package/es/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface IWxInternalRequestConfig {
|
|
|
11
11
|
/** 业务 path,不含 baseURL / query */
|
|
12
12
|
url: string;
|
|
13
13
|
method: TWxHttpMethod;
|
|
14
|
-
querys?:
|
|
14
|
+
querys?: object;
|
|
15
15
|
data?: object;
|
|
16
16
|
header: Record<string, string>;
|
|
17
17
|
/** 国密会话 SM4,供响应拦截解密 */
|
|
@@ -27,7 +27,7 @@ export interface IWxResponse<T = unknown> {
|
|
|
27
27
|
}
|
|
28
28
|
export interface IWxRequestOptions {
|
|
29
29
|
method: TWxHttpMethod;
|
|
30
|
-
querys?:
|
|
30
|
+
querys?: object;
|
|
31
31
|
data?: object;
|
|
32
32
|
headers?: Record<string, string>;
|
|
33
33
|
contentType?: string;
|
|
@@ -68,14 +68,4 @@ export declare class TWxConfig implements IWxConfig {
|
|
|
68
68
|
loseTokenState?: () => void;
|
|
69
69
|
sessionExpiredErrorKey?: string;
|
|
70
70
|
}
|
|
71
|
-
export interface IWxLoginParams {
|
|
72
|
-
code: string;
|
|
73
|
-
encryptedData: string;
|
|
74
|
-
iv: string;
|
|
75
|
-
}
|
|
76
|
-
export declare class TWxLoginParams implements IWxLoginParams {
|
|
77
|
-
code: string;
|
|
78
|
-
encryptedData: string;
|
|
79
|
-
iv: string;
|
|
80
|
-
}
|
|
81
71
|
export { REQUEST_TIMEOUT_MILLISECONDS };
|
package/es/types.js
CHANGED
|
@@ -11,13 +11,7 @@ class s {
|
|
|
11
11
|
loseTokenState = void 0;
|
|
12
12
|
sessionExpiredErrorKey = void 0;
|
|
13
13
|
}
|
|
14
|
-
class i {
|
|
15
|
-
code = "";
|
|
16
|
-
encryptedData = "";
|
|
17
|
-
iv = "";
|
|
18
|
-
}
|
|
19
14
|
export {
|
|
20
15
|
o as REQUEST_TIMEOUT_MILLISECONDS,
|
|
21
|
-
s as TWxConfig
|
|
22
|
-
i as TWxLoginParams
|
|
16
|
+
s as TWxConfig
|
|
23
17
|
};
|
package/package.json
CHANGED
package/es/client/wxClient.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TCore } from '@ningboyz/types';
|
|
2
|
-
import { IWxConfig, IWxLoginParams } from '../types';
|
|
3
|
-
declare class WxClient {
|
|
4
|
-
private wxRequest;
|
|
5
|
-
private constructor();
|
|
6
|
-
static create: (config: IWxConfig) => WxClient;
|
|
7
|
-
/**
|
|
8
|
-
* 微信登录
|
|
9
|
-
* @param params
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
login(params: IWxLoginParams): Promise<import('@ningboyz/types/src/response').IResponse<TCore.IUserResponse[]>>;
|
|
13
|
-
}
|
|
14
|
-
declare const createWxClient: (config: IWxConfig) => WxClient;
|
|
15
|
-
export { WxClient, createWxClient };
|