@xy-planning-network/trees 0.4.8-rc-2 → 0.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xy-planning-network/trees",
3
- "version": "0.4.8-rc-2",
3
+ "version": "0.4.8",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "github:xy-planning-network/trees",
@@ -1,15 +1,21 @@
1
- import { AxiosResponse, AxiosRequestConfig } from "axios";
1
+ import { AxiosRequestConfig } from "axios";
2
2
  export declare type RequestMethod = "GET" | "get" | "PUT" | "put" | "POST" | "post" | "DELETE" | "delete";
3
- export interface TreesResponse<T> extends AxiosResponse<T> {
4
- data: T;
5
- }
6
- export interface RequestOptions {
3
+ export interface RequestOptions extends AxiosRequestConfig {
4
+ /**
5
+ * returns the nested data key inside the AxiosResponse data when true
6
+ */
7
7
  dataIntercept?: boolean;
8
+ /**
9
+ * disables the full screen loading interface during the request when true
10
+ */
8
11
  skipLoader?: boolean;
12
+ /**
13
+ * artificially delay's the request by the time specified when set
14
+ */
9
15
  withDelay?: number;
10
16
  }
11
17
  declare const BaseAPI: {
12
- makeRequest<T = any>(config: AxiosRequestConfig, opts: RequestOptions): Promise<T>;
18
+ makeRequest<T = any>(opts: RequestOptions): Promise<T>;
13
19
  get<T_1 = any>(path: string, opts: RequestOptions, params?: Record<string, unknown> | undefined): Promise<T_1>;
14
20
  delete<T_2 = any>(path: string, opts: RequestOptions): Promise<T_2>;
15
21
  post<T_3 = any>(path: string, data: Record<string, unknown>, opts: RequestOptions): Promise<T_3>;
@@ -1,4 +1,4 @@
1
- import { AxiosError, AxiosRequestConfig } from "axios";
1
+ import { AxiosError } from "axios";
2
2
  import { Ref, ShallowRef } from "vue";
3
3
  import type { RequestMethod, RequestOptions } from "../api/base";
4
4
  /**
@@ -51,7 +51,7 @@ export interface UseBaseAPI<T> {
51
51
  * Manually call the axios request
52
52
  * can be used multiple times
53
53
  */
54
- execute: (data?: Record<string, unknown>, opts?: RequestOptions, config?: AxiosRequestConfig) => Promise<T>;
54
+ execute: (data?: Record<string, unknown>, opts?: RequestOptions) => Promise<T>;
55
55
  }
56
56
  /**
57
57
  * useBaseAPI is a composable wrapper of BaseAPI
@@ -61,7 +61,7 @@ export interface UseBaseAPI<T> {
61
61
  * @param initConfig {AxiosRequestConfig}
62
62
  * @returns {UseBaseAPI<T>}
63
63
  */
64
- export default function useBaseAPI<T = any>(path: string, method?: RequestMethod, initOpts?: UseBaseAPIOptions, initConfig?: AxiosRequestConfig): {
64
+ export default function useBaseAPI<T = any>(path: string, method?: RequestMethod, initOpts?: UseBaseAPIOptions): {
65
65
  result: Ref<T | undefined>;
66
66
  error: ShallowRef<Error | AxiosError<T, any> | undefined>;
67
67
  isFinished: Ref<boolean>;
@@ -69,7 +69,7 @@ export default function useBaseAPI<T = any>(path: string, method?: RequestMethod
69
69
  isAborted: Ref<boolean>;
70
70
  hasFetched: Ref<boolean>;
71
71
  abort: () => void;
72
- execute: (data?: Record<string, unknown>, execOpts?: RequestOptions, execConfig?: AxiosRequestConfig) => Promise<T>;
72
+ execute: (data?: Record<string, unknown>, opts?: RequestOptions) => Promise<T>;
73
73
  };
74
74
  /**
75
75
  * useBaseAPIGet is a convenience function for useBaseAPI
@@ -78,7 +78,7 @@ export default function useBaseAPI<T = any>(path: string, method?: RequestMethod
78
78
  * @param initConfig {AxiosRequestConfig}
79
79
  * @returns {UseBaseAPI<T>}
80
80
  */
81
- export declare function useBaseAPIGet<T = any>(url: string, initOpts?: UseBaseAPIOptions, initConfig?: AxiosRequestConfig): UseBaseAPI<T>;
81
+ export declare function useBaseAPIGet<T = any>(url: string, opts?: UseBaseAPIOptions): UseBaseAPI<T>;
82
82
  /**
83
83
  * useBaseAPIDelete is a convenience function for useBaseAPI
84
84
  * @param path {string} the api path or full url for the
@@ -86,7 +86,7 @@ export declare function useBaseAPIGet<T = any>(url: string, initOpts?: UseBaseAP
86
86
  * @param initConfig {AxiosRequestConfig}
87
87
  * @returns {UseBaseAPI<T>}
88
88
  */
89
- export declare function useBaseAPIDelete<T = any>(url: string, initOpts?: UseBaseAPIOptions, initConfig?: AxiosRequestConfig): UseBaseAPI<T>;
89
+ export declare function useBaseAPIDelete<T = any>(url: string, opts?: UseBaseAPIOptions): UseBaseAPI<T>;
90
90
  /**
91
91
  * useBaseAPIPost is a convenience function for useBaseAPI
92
92
  * @param path {string} the api path or full url for the
@@ -94,7 +94,7 @@ export declare function useBaseAPIDelete<T = any>(url: string, initOpts?: UseBas
94
94
  * @param initConfig {AxiosRequestConfig}
95
95
  * @returns {UseBaseAPI<T>}
96
96
  */
97
- export declare function useBaseAPIPost<T = any>(url: string, initOpts?: UseBaseAPIOptions, initConfig?: AxiosRequestConfig): UseBaseAPI<T>;
97
+ export declare function useBaseAPIPost<T = any>(url: string, opts?: UseBaseAPIOptions): UseBaseAPI<T>;
98
98
  /**
99
99
  * useBaseAPIPut is a convenience function for useBaseAPI
100
100
  * @param path {string} the api path or full url for the
@@ -102,4 +102,4 @@ export declare function useBaseAPIPost<T = any>(url: string, initOpts?: UseBaseA
102
102
  * @param initConfig {AxiosRequestConfig}
103
103
  * @returns {UseBaseAPI<T>}
104
104
  */
105
- export declare function useBaseAPIPut<T = any>(url: string, initOpts?: UseBaseAPIOptions, initConfig?: AxiosRequestConfig): UseBaseAPI<T>;
105
+ export declare function useBaseAPIPut<T = any>(url: string, opts?: UseBaseAPIOptions): UseBaseAPI<T>;
package/types/entry.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { Plugin } from "vue";
2
2
  import BaseAPI from "./api/base";
3
+ import type { RequestOptions } from "./api/base";
3
4
  declare const install: Exclude<Plugin["install"], undefined>;
4
5
  export default install;
5
6
  export * from "./composables/index";
6
7
  export * from "./lib-components/index";
7
8
  export { BaseAPI };
9
+ export type { RequestOptions };
@@ -1,12 +0,0 @@
1
- export interface Pagination {
2
- page: number;
3
- perPage: number;
4
- totalItems: number;
5
- totalPages: number;
6
- }
7
- export interface PaginationItems<T = any> {
8
- items: T[];
9
- }
10
- export interface PaginationData<T = any> {
11
- data: Pagination & PaginationItems<T>;
12
- }