@moluoxixi/ajax-package 0.0.12 → 0.0.14-beta.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.
@@ -5,8 +5,22 @@ declare global {
5
5
  $http?: vueHttpServiceType;
6
6
  }
7
7
  }
8
+ /**
9
+ * 创建 HTTP 服务实例
10
+ * @param options - API 配置对象
11
+ * @returns BaseApi 实例
12
+ */
8
13
  declare function createHttpService(options?: BaseApiConfig): BaseApi;
14
+ /**
15
+ * Vue Axios 插件,用于在 Vue 应用中全局注册 HTTP 服务
16
+ * 提供 this.$http、inject('$http') 和 window.$http 三种使用方式
17
+ */
9
18
  declare const VueAxiosPlugin: vueAxiosPluginType;
19
+ /**
20
+ * 获取 HTTP 服务实例,与 createHttpService 功能相同
21
+ * @param options - API 配置对象
22
+ * @returns BaseApi 实例
23
+ */
10
24
  declare function getHttpService(options?: BaseApiConfig): BaseApi;
11
25
  export default VueAxiosPlugin;
12
26
  export { createHttpService, getHttpService };
@@ -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.12",
3
+ "version": "0.0.14-beta.1",
4
4
  "description": "AjaxPackage 组件",
5
5
  "sideEffects": [
6
6
  "*.css",