@moluoxixi/ajax-package 0.0.13 → 0.0.14

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/class.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AxiosError, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
1
+ import { AxiosError, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
2
2
  import { BaseApiConfig } from './_types/index.ts';
3
3
  import { default as BaseHttpClient } from './BaseHttpClient.ts';
4
4
  export default class BaseApi extends BaseHttpClient {
@@ -6,6 +6,7 @@ export default class BaseApi extends BaseHttpClient {
6
6
  protected enableSystemErrorDialog: boolean;
7
7
  constructor(config: BaseApiConfig);
8
8
  processRequestConfig(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig;
9
+ processResponseConfig(response: AxiosResponse): AxiosResponse['data'];
9
10
  processResponseError(error: AxiosError): Promise<AxiosError>;
10
11
  protected handleHttpStatus(response: AxiosResponse): void;
11
12
  protected handleAuthenticationError(error: AxiosError): void;
@@ -31,4 +32,12 @@ export default class BaseApi extends BaseHttpClient {
31
32
  }>): void;
32
33
  private showSystemExceptionDialog;
33
34
  protected reportError(errorInfo: any): Promise<void>;
35
+ protected request<R>(config: AxiosRequestConfig): Promise<AxiosResponse['data']>;
36
+ get<R>(url: string, params?: Record<string, any>, config?: AxiosRequestConfig): Promise<AxiosResponse['data']>;
37
+ post<R>(url: string, data?: Record<string, any>, config?: AxiosRequestConfig): Promise<AxiosResponse['data']>;
38
+ delete<R>(url: string, params?: Record<string, any>, config?: AxiosRequestConfig): Promise<AxiosResponse['data']>;
39
+ put<R>(url: string, data?: Record<string, any>, config?: AxiosRequestConfig): Promise<AxiosResponse['data']>;
40
+ all<R>(requests: Array<AxiosRequestConfig | Promise<AxiosResponse<R>>>): Promise<AxiosResponse['data'][]>;
41
+ uploadFile<R>(url: string, file: File | Blob, config?: AxiosRequestConfig): Promise<AxiosResponse['data']>;
42
+ downloadFile(blob: Blob, filename?: string): void;
34
43
  }
package/es/index.d.ts CHANGED
@@ -2,4 +2,5 @@ import { default as BaseHttpClient } from './BaseHttpClient.ts';
2
2
  import { default as BaseApi } from './class.ts';
3
3
  import { default as VueAxiosPlugin, createHttpService, getHttpService } from './netseriver.ts';
4
4
  export { BaseApi, BaseHttpClient, createHttpService, getHttpService, VueAxiosPlugin, };
5
+ export type { BaseApiConfig, BaseHttpClientConfig, vueAxiosPluginOptionsType, vueAxiosPluginType, vueHttpServiceType, } from './_types/index.ts';
5
6
  export default getHttpService;
package/es/index.mjs CHANGED
@@ -2,9 +2,9 @@
2
2
  "use strict";
3
3
  try {
4
4
  if (typeof document !== "undefined") {
5
- if (!document.getElementById("065a78da-34dc-4a45-874d-4fb480012cd9")) {
5
+ if (!document.getElementById("75eddb1d-8897-4198-902d-b3b4a60a3856")) {
6
6
  var elementStyle = document.createElement("style");
7
- elementStyle.id = "065a78da-34dc-4a45-874d-4fb480012cd9";
7
+ elementStyle.id = "75eddb1d-8897-4198-902d-b3b4a60a3856";
8
8
  elementStyle.appendChild(document.createTextNode("._root_11p33_1 .el-dialog__header {\n padding: 0 12px 12px;\n}\n\n._root_11p33_1 .el-dialog__body {\n border-top: 1px solid #e5e7eb;\n border-bottom: 1px solid #e5e7eb;\n padding: 0 12px;\n}\n\n._root_11p33_1 .el-dialog__footer {\n padding: 0 12px;\n}"));
9
9
  document.head.appendChild(elementStyle);
10
10
  }
@@ -12513,6 +12513,9 @@ class BaseApi extends BaseHttpClient {
12513
12513
  processRequestConfig(config) {
12514
12514
  return super.processRequestConfig(config);
12515
12515
  }
12516
+ processResponseConfig(response) {
12517
+ return super.processResponseConfig(response);
12518
+ }
12516
12519
  async processResponseError(error) {
12517
12520
  return super.processResponseError(error);
12518
12521
  }
@@ -12691,6 +12694,30 @@ class BaseApi extends BaseHttpClient {
12691
12694
  });
12692
12695
  }
12693
12696
  }
12697
+ async request(config) {
12698
+ return super.request(config);
12699
+ }
12700
+ async get(url, params, config) {
12701
+ return super.get(url, params, config);
12702
+ }
12703
+ async post(url, data, config) {
12704
+ return super.post(url, data, config);
12705
+ }
12706
+ async delete(url, params, config) {
12707
+ return super.delete(url, params, config);
12708
+ }
12709
+ async put(url, data, config) {
12710
+ return super.put(url, data, config);
12711
+ }
12712
+ async all(requests) {
12713
+ return super.all(requests);
12714
+ }
12715
+ async uploadFile(url, file, config) {
12716
+ return super.uploadFile(url, file, config);
12717
+ }
12718
+ downloadFile(blob, filename) {
12719
+ return super.downloadFile(blob, filename);
12720
+ }
12694
12721
  }
12695
12722
  function createHttpService(options = {}) {
12696
12723
  return new BaseApi(options);
@@ -0,0 +1,9 @@
1
+ import { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
2
+ import { BaseApi, BaseApiConfig } from '@moluoxixi/ajax-package';
3
+ export default class BaseRequestApi extends BaseApi {
4
+ constructor(config?: Partial<BaseApiConfig>);
5
+ processRequestConfig(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig;
6
+ protected handleSuccessResponse(response: AxiosResponse): AxiosResponse['data'];
7
+ protected handleHttpStatus(response: AxiosResponse): void;
8
+ protected handleBusinessError(code: any, message: any): void;
9
+ }
@@ -0,0 +1,21 @@
1
+ import { AxiosError, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
2
+ import { default as BaseRequestApi } from './BaseRequestApi.ts';
3
+ export default class DownloadApi extends BaseRequestApi {
4
+ private downloadingFiles;
5
+ constructor();
6
+ processRequestConfig(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig;
7
+ processResponseError(error: AxiosError): Promise<AxiosError>;
8
+ protected handleSuccessResponse(response: AxiosResponse): AxiosResponse['data'];
9
+ downloadFileFromUrl(url: string, filename?: string, params?: Record<string, any>, data?: Record<string, any>, method?: 'get' | 'post', config?: AxiosRequestConfig): Promise<boolean>;
10
+ private getFilenameFromUrl;
11
+ downloadMultipleFiles(files: Array<{
12
+ url: string;
13
+ filename?: string;
14
+ params?: Record<string, any>;
15
+ data?: Record<string, any>;
16
+ method?: 'get' | 'post';
17
+ }>, onProgress?: (progress: number, currentFile: string) => void): Promise<{
18
+ success: number;
19
+ total: number;
20
+ }>;
21
+ }
@@ -0,0 +1,4 @@
1
+ import { BaseApi, BaseApiConfig } from '@moluoxixi/ajax-package';
2
+ export default class RoleApi extends BaseApi {
3
+ constructor(config?: Partial<BaseApiConfig>);
4
+ }
@@ -0,0 +1,4 @@
1
+ import { BaseApi, BaseApiConfig } from '@moluoxixi/ajax-package';
2
+ export default class UserApi extends BaseApi {
3
+ constructor(config?: Partial<BaseApiConfig>);
4
+ }
@@ -0,0 +1,9 @@
1
+ import { default as DownloadApi } from './DownloadApi.ts';
2
+ import { default as BaseRequestApi } from './BaseRequestApi.ts';
3
+ import { default as UserApi } from './UserApi.ts';
4
+ import { default as RoleApi } from './RoleApi.ts';
5
+ export declare const downloadRequest: DownloadApi;
6
+ export declare const userRequest: any;
7
+ export declare const baseRequest: any;
8
+ export declare const roleRequest: any;
9
+ export { DownloadApi, BaseRequestApi, UserApi, RoleApi, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moluoxixi/ajax-package",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "AjaxPackage 组件",
5
5
  "sideEffects": [
6
6
  "*.css",