@arex95/vue-core 1.1.40 → 1.1.41
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,9 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { UseQueryOptions } from '@tanstack/vue-query';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a fetchFn for Axios requests with an optional custom instance.
|
|
5
|
+
* @param fetchComposable - The fn to use for the request (can be any fetch function).
|
|
6
|
+
* @param axiosCustomInstance - An optional custom Axios instance to use for the request.
|
|
7
|
+
* @returns A function that handles the request using the provided fn.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFetch(fetchFn: Function, axiosCustomInstance?: AxiosInstance): (axiosRequestConfig: AxiosRequestConfig, options?: UseQueryOptions) => any;
|
package/dist/index.mjs
CHANGED
|
@@ -2926,7 +2926,7 @@ class RestStd {
|
|
|
2926
2926
|
static resource;
|
|
2927
2927
|
static isFormData = false;
|
|
2928
2928
|
static headers = {};
|
|
2929
|
-
static
|
|
2929
|
+
static fetchFn;
|
|
2930
2930
|
/**
|
|
2931
2931
|
* Set global headers for all requests.
|
|
2932
2932
|
* @param headers Object containing headers to be set globally.
|
|
@@ -2950,12 +2950,12 @@ class RestStd {
|
|
|
2950
2950
|
* Fetch a list of items from the server.
|
|
2951
2951
|
*
|
|
2952
2952
|
* @param params Query parameters for filtering the results.
|
|
2953
|
-
* @param options Additional options for the fetch
|
|
2954
|
-
* @returns The result of the fetch
|
|
2953
|
+
* @param options Additional options for the fetch function.
|
|
2954
|
+
* @returns The result of the fetch function (typically a promise).
|
|
2955
2955
|
*/
|
|
2956
2956
|
static getAll(params, options = {}) {
|
|
2957
|
-
return this.
|
|
2958
|
-
method:
|
|
2957
|
+
return this.fetchFn({
|
|
2958
|
+
method: "GET",
|
|
2959
2959
|
url: this.resource,
|
|
2960
2960
|
params,
|
|
2961
2961
|
headers: this.headers,
|
|
@@ -2966,12 +2966,12 @@ class RestStd {
|
|
|
2966
2966
|
*
|
|
2967
2967
|
* @param id The ID of the item to fetch.
|
|
2968
2968
|
* @param params Additional query parameters for the request.
|
|
2969
|
-
* @param options Additional options for the fetch
|
|
2970
|
-
* @returns The result of the fetch
|
|
2969
|
+
* @param options Additional options for the fetch function.
|
|
2970
|
+
* @returns The result of the fetch function (typically a promise).
|
|
2971
2971
|
*/
|
|
2972
2972
|
static getOne(id, params, options = {}) {
|
|
2973
|
-
return this.
|
|
2974
|
-
method:
|
|
2973
|
+
return this.fetchFn({
|
|
2974
|
+
method: "GET",
|
|
2975
2975
|
url: `${this.resource}/${id}`,
|
|
2976
2976
|
params,
|
|
2977
2977
|
headers: this.headers,
|
|
@@ -2981,18 +2981,43 @@ class RestStd {
|
|
|
2981
2981
|
* Create a new item on the server.
|
|
2982
2982
|
*
|
|
2983
2983
|
* @param data The data for the new item to create.
|
|
2984
|
-
* @param options Additional options for the fetch
|
|
2985
|
-
* @returns The result of the fetch
|
|
2984
|
+
* @param options Additional options for the fetch function.
|
|
2985
|
+
* @returns The result of the fetch function (typically a promise).
|
|
2986
2986
|
*/
|
|
2987
2987
|
static create(data, options = {}) {
|
|
2988
2988
|
const transformedData = this.transformData(data);
|
|
2989
|
-
return this.
|
|
2990
|
-
method:
|
|
2989
|
+
return this.fetchFn({
|
|
2990
|
+
method: "POST",
|
|
2991
2991
|
url: this.resource,
|
|
2992
2992
|
data: transformedData,
|
|
2993
2993
|
headers: {
|
|
2994
2994
|
...this.headers,
|
|
2995
|
-
|
|
2995
|
+
"Content-Type": this.isFormData
|
|
2996
|
+
? ContentTypeEnum.FORM_DATA
|
|
2997
|
+
: ContentTypeEnum.JSON,
|
|
2998
|
+
},
|
|
2999
|
+
}, options);
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Create multiple new items on the server.
|
|
3003
|
+
*
|
|
3004
|
+
* @param data An array of data for the items to create.
|
|
3005
|
+
* @param options Additional options for the fetch function.
|
|
3006
|
+
* @returns The result of the fetch function.
|
|
3007
|
+
*/
|
|
3008
|
+
static bulkCreate(data, options = {}) {
|
|
3009
|
+
const transformedData = this.isFormData
|
|
3010
|
+
? data.map((item) => this.transformData(item))
|
|
3011
|
+
: data;
|
|
3012
|
+
return this.fetchFn({
|
|
3013
|
+
method: "POST",
|
|
3014
|
+
url: `${this.resource}/bulk`,
|
|
3015
|
+
data: transformedData,
|
|
3016
|
+
headers: {
|
|
3017
|
+
...this.headers,
|
|
3018
|
+
"Content-Type": this.isFormData
|
|
3019
|
+
? ContentTypeEnum.FORM_DATA
|
|
3020
|
+
: ContentTypeEnum.JSON,
|
|
2996
3021
|
},
|
|
2997
3022
|
}, options);
|
|
2998
3023
|
}
|
|
@@ -3001,18 +3026,43 @@ class RestStd {
|
|
|
3001
3026
|
*
|
|
3002
3027
|
* @param id The ID of the item to update.
|
|
3003
3028
|
* @param data The updated data for the item.
|
|
3004
|
-
* @param options Additional options for the fetch
|
|
3005
|
-
* @returns The result of the fetch
|
|
3029
|
+
* @param options Additional options for the fetch function.
|
|
3030
|
+
* @returns The result of the fetch function (typically a promise).
|
|
3006
3031
|
*/
|
|
3007
3032
|
static update(id, data, options = {}) {
|
|
3008
3033
|
const transformedData = this.transformData(data);
|
|
3009
|
-
return this.
|
|
3010
|
-
method:
|
|
3034
|
+
return this.fetchFn({
|
|
3035
|
+
method: "PUT",
|
|
3011
3036
|
url: `${this.resource}/${id}`,
|
|
3012
3037
|
data: transformedData,
|
|
3013
3038
|
headers: {
|
|
3014
3039
|
...this.headers,
|
|
3015
|
-
|
|
3040
|
+
"Content-Type": this.isFormData
|
|
3041
|
+
? ContentTypeEnum.FORM_DATA
|
|
3042
|
+
: ContentTypeEnum.JSON,
|
|
3043
|
+
},
|
|
3044
|
+
}, options);
|
|
3045
|
+
}
|
|
3046
|
+
/**
|
|
3047
|
+
* Update multiple existing items on the server.
|
|
3048
|
+
*
|
|
3049
|
+
* @param data An array of data for the items to update (each object should have an ID).
|
|
3050
|
+
* @param options Additional options for the fetch function.
|
|
3051
|
+
* @returns The result of the fetch function.
|
|
3052
|
+
*/
|
|
3053
|
+
static bulkUpdate(data, options = {}) {
|
|
3054
|
+
const transformedData = this.isFormData
|
|
3055
|
+
? data.map((item) => this.transformData(item))
|
|
3056
|
+
: data;
|
|
3057
|
+
return this.fetchFn({
|
|
3058
|
+
method: "PUT",
|
|
3059
|
+
url: `${this.resource}/bulk`,
|
|
3060
|
+
data: transformedData,
|
|
3061
|
+
headers: {
|
|
3062
|
+
...this.headers,
|
|
3063
|
+
"Content-Type": this.isFormData
|
|
3064
|
+
? ContentTypeEnum.FORM_DATA
|
|
3065
|
+
: ContentTypeEnum.JSON,
|
|
3016
3066
|
},
|
|
3017
3067
|
}, options);
|
|
3018
3068
|
}
|
|
@@ -3021,18 +3071,20 @@ class RestStd {
|
|
|
3021
3071
|
*
|
|
3022
3072
|
* @param id The ID of the item to update.
|
|
3023
3073
|
* @param data The updated data for the item.
|
|
3024
|
-
* @param options Additional options for the fetch
|
|
3025
|
-
* @returns The result of the fetch
|
|
3074
|
+
* @param options Additional options for the fetch function.
|
|
3075
|
+
* @returns The result of the fetch function (typically a promise).
|
|
3026
3076
|
*/
|
|
3027
3077
|
static patch(id, data, options = {}) {
|
|
3028
3078
|
const transformedData = this.transformData(data);
|
|
3029
|
-
return this.
|
|
3030
|
-
method:
|
|
3079
|
+
return this.fetchFn({
|
|
3080
|
+
method: "PATCH",
|
|
3031
3081
|
url: `${this.resource}/${id}`,
|
|
3032
3082
|
data: transformedData,
|
|
3033
3083
|
headers: {
|
|
3034
3084
|
...this.headers,
|
|
3035
|
-
|
|
3085
|
+
"Content-Type": this.isFormData
|
|
3086
|
+
? ContentTypeEnum.FORM_DATA
|
|
3087
|
+
: ContentTypeEnum.JSON,
|
|
3036
3088
|
},
|
|
3037
3089
|
}, options);
|
|
3038
3090
|
}
|
|
@@ -3040,47 +3092,39 @@ class RestStd {
|
|
|
3040
3092
|
* Delete an item from the server.
|
|
3041
3093
|
*
|
|
3042
3094
|
* @param id The ID of the item to delete.
|
|
3043
|
-
* @param options Additional options for the fetch
|
|
3044
|
-
* @returns The result of the fetch
|
|
3095
|
+
* @param options Additional options for the fetch function.
|
|
3096
|
+
* @returns The result of the fetch function (typically a promise).
|
|
3045
3097
|
*/
|
|
3046
3098
|
static delete(id, options = {}) {
|
|
3047
|
-
return this.
|
|
3048
|
-
method:
|
|
3099
|
+
return this.fetchFn({
|
|
3100
|
+
method: "DELETE",
|
|
3049
3101
|
url: `${this.resource}/${id}`,
|
|
3050
3102
|
headers: this.headers,
|
|
3051
3103
|
}, options);
|
|
3052
3104
|
}
|
|
3053
3105
|
/**
|
|
3054
|
-
*
|
|
3106
|
+
* Delete multiple items from the server by their IDs.
|
|
3055
3107
|
*
|
|
3056
|
-
* @param
|
|
3057
|
-
* @param
|
|
3058
|
-
* @
|
|
3059
|
-
* @param options Additional options for the fetch composable.
|
|
3060
|
-
* @returns The result of the fetch composable (typically a promise).
|
|
3108
|
+
* @param ids An array of IDs of the items to delete.
|
|
3109
|
+
* @param options Additional options for the fetch function.
|
|
3110
|
+
* @returns The result of the fetch function.
|
|
3061
3111
|
*/
|
|
3062
|
-
static
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
data: transformedData,
|
|
3069
|
-
headers: {
|
|
3070
|
-
...this.headers,
|
|
3071
|
-
'Content-Type': this.isFormData ? ContentTypeEnum.FORM_DATA : ContentTypeEnum.JSON,
|
|
3072
|
-
},
|
|
3112
|
+
static bulkDelete(ids, options = {}) {
|
|
3113
|
+
return this.fetchFn({
|
|
3114
|
+
method: "DELETE",
|
|
3115
|
+
url: `${this.resource}/bulk`,
|
|
3116
|
+
data: { ids },
|
|
3117
|
+
headers: this.headers,
|
|
3073
3118
|
}, options);
|
|
3074
3119
|
}
|
|
3075
3120
|
/**
|
|
3076
|
-
*
|
|
3077
|
-
* It calls either create or update based on the data.
|
|
3121
|
+
* Upsert method that decides whether to create or update based on the presence of 'id'.
|
|
3078
3122
|
*
|
|
3079
3123
|
* @param data The data for the item to create or update.
|
|
3080
|
-
* @param options Additional options for the fetch
|
|
3081
|
-
* @returns The result of the fetch
|
|
3124
|
+
* @param options Additional options for the fetch function.
|
|
3125
|
+
* @returns The result of the fetch function (typically a promise).
|
|
3082
3126
|
*/
|
|
3083
|
-
static
|
|
3127
|
+
static upsert(data, options = {}) {
|
|
3084
3128
|
if (data.id) {
|
|
3085
3129
|
return this.update(data.id, data, options);
|
|
3086
3130
|
}
|
|
@@ -3088,6 +3132,31 @@ class RestStd {
|
|
|
3088
3132
|
return this.create(data, options);
|
|
3089
3133
|
}
|
|
3090
3134
|
}
|
|
3135
|
+
/**
|
|
3136
|
+
* Custom request method for more flexibility.
|
|
3137
|
+
*
|
|
3138
|
+
* @param method HTTP method (GET, POST, etc.).
|
|
3139
|
+
* @param url The custom URL for the request.
|
|
3140
|
+
* @param params Query parameters.
|
|
3141
|
+
* @param data Request body data.
|
|
3142
|
+
* @param options Additional options for the fetch function.
|
|
3143
|
+
* @returns The result of the fetch function (typically a promise).
|
|
3144
|
+
*/
|
|
3145
|
+
static customRequest(method, url, params, data, options = {}) {
|
|
3146
|
+
const transformedData = this.transformData(data);
|
|
3147
|
+
return this.fetchFn({
|
|
3148
|
+
method: method,
|
|
3149
|
+
url: url,
|
|
3150
|
+
params: params,
|
|
3151
|
+
data: transformedData,
|
|
3152
|
+
headers: {
|
|
3153
|
+
...this.headers,
|
|
3154
|
+
"Content-Type": this.isFormData
|
|
3155
|
+
? ContentTypeEnum.FORM_DATA
|
|
3156
|
+
: ContentTypeEnum.JSON,
|
|
3157
|
+
},
|
|
3158
|
+
}, options);
|
|
3159
|
+
}
|
|
3091
3160
|
}
|
|
3092
3161
|
|
|
3093
3162
|
/**
|
|
@@ -3107,15 +3176,15 @@ async function axiosFetch(axios, axiosRequest) {
|
|
|
3107
3176
|
}
|
|
3108
3177
|
|
|
3109
3178
|
/**
|
|
3110
|
-
* Creates a
|
|
3111
|
-
* @param fetchComposable - The
|
|
3179
|
+
* Creates a fetchFn for Axios requests with an optional custom instance.
|
|
3180
|
+
* @param fetchComposable - The fn to use for the request (can be any fetch function).
|
|
3112
3181
|
* @param axiosCustomInstance - An optional custom Axios instance to use for the request.
|
|
3113
|
-
* @returns A function that handles the request using the provided
|
|
3182
|
+
* @returns A function that handles the request using the provided fn.
|
|
3114
3183
|
*/
|
|
3115
|
-
function
|
|
3184
|
+
function useFetch(fetchFn, axiosCustomInstance) {
|
|
3116
3185
|
const instance = axiosCustomInstance || getConfiguredAxiosInstance();
|
|
3117
3186
|
return (axiosRequestConfig, options) => {
|
|
3118
|
-
return
|
|
3187
|
+
return fetchFn(instance, axiosRequestConfig, options);
|
|
3119
3188
|
};
|
|
3120
3189
|
}
|
|
3121
3190
|
|
|
@@ -3579,4 +3648,4 @@ const ArexVueCore = {
|
|
|
3579
3648
|
},
|
|
3580
3649
|
};
|
|
3581
3650
|
|
|
3582
|
-
export { AppTypes, ArchiveTypes, ArexVueCore, AudioTypes, AxiosService, ContentTypeEnum, DocumentTypes, ERROR_MESSAGES, ERROR_STYLES, ErrorEnum, ErrorMessages, ErrorStyles, ExceptionEnum, FontTypes, ImageTypes, KeyCodeEnum, OtherTypes, RestStd, ScreenBreakpoint, ScreenSize, StorageKeyEnum, StorageTypeEnum, TextTypes, VideoTypes, ab2hex, addCustomKeyboardShortcut, addDays, addDoubleClickListener, addKeyListener, ageAtDate, axiosFetch, blobToFormData, bufferToBlob, calculateAge, cleanCredentials, clickOutside, compareObject, configAppKey, configAxios, configEndpoints, configRefreshTokenPaths, configSession, configTokenKeys, configTokenPaths, copyToClipboard, countWords,
|
|
3651
|
+
export { AppTypes, ArchiveTypes, ArexVueCore, AudioTypes, AxiosService, ContentTypeEnum, DocumentTypes, ERROR_MESSAGES, ERROR_STYLES, ErrorEnum, ErrorMessages, ErrorStyles, ExceptionEnum, FontTypes, ImageTypes, KeyCodeEnum, OtherTypes, RestStd, ScreenBreakpoint, ScreenSize, StorageKeyEnum, StorageTypeEnum, TextTypes, VideoTypes, ab2hex, addCustomKeyboardShortcut, addDays, addDoubleClickListener, addKeyListener, ageAtDate, axiosFetch, blobToFormData, bufferToBlob, calculateAge, cleanCredentials, clickOutside, compareObject, configAppKey, configAxios, configEndpoints, configRefreshTokenPaths, configSession, configTokenKeys, configTokenPaths, copyToClipboard, countWords, createKeyMap, customShortcut, daysBetween, daysToNextBirthday, debounce, debounceAsync, debounceAsyncValidator, debounceAsyncWithImmediate, debounceLeading, debounceLeadingTrailing, debounceTrailing, decrypt, deepClone, deepEqual, deepMerge, detectKeyHold, disableCopy, disableF12Key, disableMouseButtons, disableRightClick, disableSpecificKeys, downloadBlob, enableMouseButtons, enableRightClick, enableSpecificKeys, encrypt, exportToCSV, exportToExcel, exportToJSON, exportToText, exportToXML, extractAndValidateTokens, filterObjectByKeys, flattenObject, formDataToObject, formatDate, generateRandomString, getAppKey, getAuthRefreshToken, getAuthToken, getConfiguredAxiosInstance, getDecryptedItem, getEndOfMonth, getEndpointsConfig, getObjectDifferences, getObjectKeys, getQueryParam, getRefreshTokenPathsConfig, getSessionConfig, getSessionId, getSessionPersistence, getStartOfMonth, getTokenConfig, getTokenPathsConfig, handleError, hasNestedProperties, hex2ab, importKey, isEmptyObject, isLeapYear, isStrongPassword, isValidAge, isValidCreditCard, isValidDate, isValidEmail, isValidExpiryDate, isValidHexColor, isValidHexColorAlpha, isValidHexNumber, isValidIP, isValidPhoneNumber, isValidSSN, isValidTime, isValidURL, isValidUsername, isValidZIP, lowerFirst, objectToFormData, objectToFormDataEnhanced, objectToQueryString, openWindow, parseDate, proxyToPlainObject, readFileAsDataURL, readFileAsText, refreshTokens, registerKeyboardShortcuts, removeAccent, removeClickOutside, removeCustomKeyboardShortcut, removeCustomShortcuts, removeDoubleClickListener, removeEmptyProperties, removeKeyListeners, replaceAll, reverseString, safeGet, screenMap, scrollToTop, simulateKeyPress, stopDetectingKeyHold, storeAuthRefreshToken, storeAuthToken, storeEncryptedItem, storeTokens, stringToBlob, subtractDays, throttle, toCamelCase, toKebabCase, toggleTabNavigation, truncateString, unregisterKeyboardShortcuts, upperFirst, useAuth, useBreakpoint, useFetch, useFilter, usePagination, useSorter, useVueQuery, validateAlphanumeric, validateLetters, validateNumbers, verifyAuth };
|
package/dist/rest/RestStd.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare class RestStd {
|
|
|
2
2
|
static resource: string;
|
|
3
3
|
static isFormData: boolean;
|
|
4
4
|
static headers: Record<string, string>;
|
|
5
|
-
static
|
|
5
|
+
static fetchFn: Function;
|
|
6
6
|
/**
|
|
7
7
|
* Set global headers for all requests.
|
|
8
8
|
* @param headers Object containing headers to be set globally.
|
|
@@ -18,8 +18,8 @@ export declare class RestStd {
|
|
|
18
18
|
* Fetch a list of items from the server.
|
|
19
19
|
*
|
|
20
20
|
* @param params Query parameters for filtering the results.
|
|
21
|
-
* @param options Additional options for the fetch
|
|
22
|
-
* @returns The result of the fetch
|
|
21
|
+
* @param options Additional options for the fetch function.
|
|
22
|
+
* @returns The result of the fetch function (typically a promise).
|
|
23
23
|
*/
|
|
24
24
|
static getAll<T>(params?: Record<string, any>, options?: object): any;
|
|
25
25
|
/**
|
|
@@ -27,61 +27,85 @@ export declare class RestStd {
|
|
|
27
27
|
*
|
|
28
28
|
* @param id The ID of the item to fetch.
|
|
29
29
|
* @param params Additional query parameters for the request.
|
|
30
|
-
* @param options Additional options for the fetch
|
|
31
|
-
* @returns The result of the fetch
|
|
30
|
+
* @param options Additional options for the fetch function.
|
|
31
|
+
* @returns The result of the fetch function (typically a promise).
|
|
32
32
|
*/
|
|
33
33
|
static getOne<T>(id: string | number, params?: Record<string, any>, options?: object): any;
|
|
34
34
|
/**
|
|
35
35
|
* Create a new item on the server.
|
|
36
36
|
*
|
|
37
37
|
* @param data The data for the new item to create.
|
|
38
|
-
* @param options Additional options for the fetch
|
|
39
|
-
* @returns The result of the fetch
|
|
38
|
+
* @param options Additional options for the fetch function.
|
|
39
|
+
* @returns The result of the fetch function (typically a promise).
|
|
40
40
|
*/
|
|
41
41
|
static create<T>(data: any, options?: object): any;
|
|
42
|
+
/**
|
|
43
|
+
* Create multiple new items on the server.
|
|
44
|
+
*
|
|
45
|
+
* @param data An array of data for the items to create.
|
|
46
|
+
* @param options Additional options for the fetch function.
|
|
47
|
+
* @returns The result of the fetch function.
|
|
48
|
+
*/
|
|
49
|
+
static bulkCreate<T>(data: any[], options?: object): any;
|
|
42
50
|
/**
|
|
43
51
|
* Update an existing item on the server.
|
|
44
52
|
*
|
|
45
53
|
* @param id The ID of the item to update.
|
|
46
54
|
* @param data The updated data for the item.
|
|
47
|
-
* @param options Additional options for the fetch
|
|
48
|
-
* @returns The result of the fetch
|
|
55
|
+
* @param options Additional options for the fetch function.
|
|
56
|
+
* @returns The result of the fetch function (typically a promise).
|
|
49
57
|
*/
|
|
50
58
|
static update<T>(id: string | number, data: any, options?: object): any;
|
|
59
|
+
/**
|
|
60
|
+
* Update multiple existing items on the server.
|
|
61
|
+
*
|
|
62
|
+
* @param data An array of data for the items to update (each object should have an ID).
|
|
63
|
+
* @param options Additional options for the fetch function.
|
|
64
|
+
* @returns The result of the fetch function.
|
|
65
|
+
*/
|
|
66
|
+
static bulkUpdate<T>(data: any[], options?: object): any;
|
|
51
67
|
/**
|
|
52
68
|
* Partially update an existing item on the server.
|
|
53
69
|
*
|
|
54
70
|
* @param id The ID of the item to update.
|
|
55
71
|
* @param data The updated data for the item.
|
|
56
|
-
* @param options Additional options for the fetch
|
|
57
|
-
* @returns The result of the fetch
|
|
72
|
+
* @param options Additional options for the fetch function.
|
|
73
|
+
* @returns The result of the fetch function (typically a promise).
|
|
58
74
|
*/
|
|
59
75
|
static patch<T>(id: string | number, data: any, options?: object): any;
|
|
60
76
|
/**
|
|
61
77
|
* Delete an item from the server.
|
|
62
78
|
*
|
|
63
79
|
* @param id The ID of the item to delete.
|
|
64
|
-
* @param options Additional options for the fetch
|
|
65
|
-
* @returns The result of the fetch
|
|
80
|
+
* @param options Additional options for the fetch function.
|
|
81
|
+
* @returns The result of the fetch function (typically a promise).
|
|
66
82
|
*/
|
|
67
83
|
static delete<T>(id: string | number, options?: object): any;
|
|
68
84
|
/**
|
|
69
|
-
*
|
|
85
|
+
* Delete multiple items from the server by their IDs.
|
|
70
86
|
*
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @
|
|
74
|
-
* @param options Additional options for the fetch composable.
|
|
75
|
-
* @returns The result of the fetch composable (typically a promise).
|
|
87
|
+
* @param ids An array of IDs of the items to delete.
|
|
88
|
+
* @param options Additional options for the fetch function.
|
|
89
|
+
* @returns The result of the fetch function.
|
|
76
90
|
*/
|
|
77
|
-
static
|
|
91
|
+
static bulkDelete<T>(ids: (string | number)[], options?: object): any;
|
|
78
92
|
/**
|
|
79
|
-
*
|
|
80
|
-
* It calls either create or update based on the data.
|
|
93
|
+
* Upsert method that decides whether to create or update based on the presence of 'id'.
|
|
81
94
|
*
|
|
82
95
|
* @param data The data for the item to create or update.
|
|
83
|
-
* @param options Additional options for the fetch
|
|
84
|
-
* @returns The result of the fetch
|
|
96
|
+
* @param options Additional options for the fetch function.
|
|
97
|
+
* @returns The result of the fetch function (typically a promise).
|
|
98
|
+
*/
|
|
99
|
+
static upsert<T>(data: any, options?: object): any;
|
|
100
|
+
/**
|
|
101
|
+
* Custom request method for more flexibility.
|
|
102
|
+
*
|
|
103
|
+
* @param method HTTP method (GET, POST, etc.).
|
|
104
|
+
* @param url The custom URL for the request.
|
|
105
|
+
* @param params Query parameters.
|
|
106
|
+
* @param data Request body data.
|
|
107
|
+
* @param options Additional options for the fetch function.
|
|
108
|
+
* @returns The result of the fetch function (typically a promise).
|
|
85
109
|
*/
|
|
86
|
-
static
|
|
110
|
+
static customRequest<T>(method: string, url: string, params?: Record<string, any>, data?: any, options?: object): any;
|
|
87
111
|
}
|