@ningboyz/wxmp 1.0.11 → 1.0.12

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.
@@ -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,11 @@
1
+ /** ========== user ========== */
2
+ export interface IWxLoginParams {
3
+ code: string;
4
+ encryptedData: string;
5
+ iv: string;
6
+ }
7
+ export declare class TWxLoginParams implements IWxLoginParams {
8
+ code: string;
9
+ encryptedData: string;
10
+ iv: string;
11
+ }
@@ -0,0 +1,8 @@
1
+ class e {
2
+ code = "";
3
+ encryptedData = "";
4
+ iv = "";
5
+ }
6
+ export {
7
+ e as TWxLoginParams
8
+ };
@@ -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 = s(e);
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 WxClient,
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
+ };
@@ -0,0 +1,9 @@
1
+ /** ========== main ========== */
2
+ export interface INotiMainGet4NotiQuerys {
3
+ syspartc: number;
4
+ sourcend: number;
5
+ }
6
+ export declare class TNotiMainGet4NotiQuerys implements INotiMainGet4NotiQuerys {
7
+ syspartc: number;
8
+ sourcend: number;
9
+ }
@@ -0,0 +1,7 @@
1
+ class t {
2
+ syspartc = -1;
3
+ sourcend = -1;
4
+ }
5
+ export {
6
+ t as TNotiMainGet4NotiQuerys
7
+ };
package/es/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { WxClient, createWxClient } from './client/wxClient';
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, IWxLoginParams, IWxQueryParams, IWxRequestOptions, IWxResponse, TWxConfig, TWxHttpMethod, TWxInterceptorsRequest, TWxInterceptorsResponse, TWxLoginParams } from './types';
4
- export { type WxClient, createWxClient, type WxRequest, createWxRequest, type IWxConfig, type IWxInternalRequestConfig, type IWxLoginParams, type IWxQueryParams, type IWxRequestOptions, type IWxResponse, type TWxHttpMethod, type TWxInterceptorsRequest, type TWxInterceptorsResponse, TWxConfig, TWxLoginParams };
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 { createWxClient as o } from "./client/wxClient.js";
2
- import { createWxRequest as x } from "./request/wxRequest.js";
3
- import { TWxConfig as f, TWxLoginParams as m } from "./types.js";
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
- f as TWxConfig,
6
- m as TWxLoginParams,
7
- o as createWxClient,
8
- x as createWxRequest
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, IWxQueryParams, IWxRequestOptions } from '../types';
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?: IWxQueryParams, params?: object, headers?: Record<string, string>): Promise<TResp.IResponse<T>>;
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?: IWxQueryParams, params?: object, headers?: Record<string, string>): Promise<TResp.IResponse<T>>;
15
- get<T>(url: string, querys?: IWxQueryParams, headers?: Record<string, string>): Promise<TResp.IResponse<T>>;
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?: IWxQueryParams;
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?: IWxQueryParams;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ningboyz/wxmp",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "private": false,
5
5
  "description": "宁波甬政微信小程序库",
6
6
  "author": "nbyt-syq",
@@ -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 };