@foxford/services 1.4.3 → 1.4.4
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/index.d.ts +30 -3
- package/index.js.flow +35 -3
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -23,13 +23,13 @@ export type ApiMethod = "get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" |
|
|
|
23
23
|
export type ApiResponseType = "arraybuffer" | "blob" | "document" | "json" | "text" | "stream";
|
|
24
24
|
export type ApiRequestConfig = {
|
|
25
25
|
url?: string;
|
|
26
|
-
method?: ApiMethod;
|
|
26
|
+
method?: ApiMethod | string;
|
|
27
27
|
baseURL?: string;
|
|
28
28
|
transformRequest?: ApiTransformer | ApiTransformer[];
|
|
29
29
|
transformResponse?: ApiTransformer | ApiTransformer[];
|
|
30
30
|
headers?: any;
|
|
31
31
|
params?: any;
|
|
32
|
-
paramsSerializer?:
|
|
32
|
+
paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;
|
|
33
33
|
data?: any;
|
|
34
34
|
timeout?: number;
|
|
35
35
|
timeoutErrorMessage?: string;
|
|
@@ -73,7 +73,7 @@ export interface CancelStatic {
|
|
|
73
73
|
new (message?: string): Cancel;
|
|
74
74
|
}
|
|
75
75
|
export interface Cancel {
|
|
76
|
-
message: string;
|
|
76
|
+
message: string | undefined;
|
|
77
77
|
}
|
|
78
78
|
export interface Canceler {
|
|
79
79
|
(message?: string): void;
|
|
@@ -160,6 +160,33 @@ export type ApiConfig = {
|
|
|
160
160
|
config: ApiRequestConfigExtended;
|
|
161
161
|
plugins?: Array<RequestPluginInterface | ResponseSuccessPluginInterface>;
|
|
162
162
|
};
|
|
163
|
+
export interface GenericFormData {
|
|
164
|
+
append(name: string, value: any, options?: any): any;
|
|
165
|
+
}
|
|
166
|
+
export interface FormDataVisitorHelpers {
|
|
167
|
+
defaultVisitor: SerializerVisitor;
|
|
168
|
+
convertValue: (value: any) => any;
|
|
169
|
+
isVisitable: (value: any) => boolean;
|
|
170
|
+
}
|
|
171
|
+
export interface SerializerVisitor {
|
|
172
|
+
(this: GenericFormData, value: any, key: string | number, path: null | Array<string | number>, helpers: FormDataVisitorHelpers): boolean;
|
|
173
|
+
}
|
|
174
|
+
export interface SerializerOptions {
|
|
175
|
+
visitor?: SerializerVisitor;
|
|
176
|
+
dots?: boolean;
|
|
177
|
+
metaTokens?: boolean;
|
|
178
|
+
indexes?: boolean | null;
|
|
179
|
+
}
|
|
180
|
+
export interface ParamEncoder {
|
|
181
|
+
(value: any, defaultEncoder: (value: any) => any): any;
|
|
182
|
+
}
|
|
183
|
+
export interface CustomParamsSerializer {
|
|
184
|
+
(params: Record<string, any>, options?: ParamsSerializerOptions): string;
|
|
185
|
+
}
|
|
186
|
+
export interface ParamsSerializerOptions extends SerializerOptions {
|
|
187
|
+
encode?: ParamEncoder;
|
|
188
|
+
serialize?: CustomParamsSerializer;
|
|
189
|
+
}
|
|
163
190
|
export declare abstract class RequestPlugin implements RequestPluginInterface {
|
|
164
191
|
pluginType: "request";
|
|
165
192
|
abstract pluginName: string;
|
package/index.js.flow
CHANGED
|
@@ -54,13 +54,13 @@ export type ApiResponseType =
|
|
|
54
54
|
| "stream";
|
|
55
55
|
export type ApiRequestConfig = {|
|
|
56
56
|
url?: string,
|
|
57
|
-
method?: ApiMethod,
|
|
57
|
+
method?: ApiMethod | string,
|
|
58
58
|
baseURL?: string,
|
|
59
59
|
transformRequest?: ApiTransformer | ApiTransformer[],
|
|
60
60
|
transformResponse?: ApiTransformer | ApiTransformer[],
|
|
61
61
|
headers?: any,
|
|
62
62
|
params?: any,
|
|
63
|
-
paramsSerializer?:
|
|
63
|
+
paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer,
|
|
64
64
|
data?: any,
|
|
65
65
|
timeout?: number,
|
|
66
66
|
timeoutErrorMessage?: string,
|
|
@@ -104,7 +104,7 @@ export interface CancelStatic {
|
|
|
104
104
|
new(message?: string): Cancel;
|
|
105
105
|
}
|
|
106
106
|
export interface Cancel {
|
|
107
|
-
message: string;
|
|
107
|
+
message: string | void;
|
|
108
108
|
}
|
|
109
109
|
export interface Canceler {
|
|
110
110
|
(message?: string): void;
|
|
@@ -221,6 +221,38 @@ export type ApiConfig = {|
|
|
|
221
221
|
config: ApiRequestConfigExtended,
|
|
222
222
|
plugins?: Array<RequestPluginInterface | ResponseSuccessPluginInterface>,
|
|
223
223
|
|};
|
|
224
|
+
export interface GenericFormData {
|
|
225
|
+
append(name: string, value: any, options?: any): any;
|
|
226
|
+
}
|
|
227
|
+
export interface FormDataVisitorHelpers {
|
|
228
|
+
defaultVisitor: SerializerVisitor;
|
|
229
|
+
convertValue: (value: any) => any;
|
|
230
|
+
isVisitable: (value: any) => boolean;
|
|
231
|
+
}
|
|
232
|
+
export interface SerializerVisitor {
|
|
233
|
+
(
|
|
234
|
+
value: any,
|
|
235
|
+
key: string | number,
|
|
236
|
+
path: null | Array<string | number>,
|
|
237
|
+
helpers: FormDataVisitorHelpers
|
|
238
|
+
): boolean;
|
|
239
|
+
}
|
|
240
|
+
export interface SerializerOptions {
|
|
241
|
+
visitor?: SerializerVisitor;
|
|
242
|
+
dots?: boolean;
|
|
243
|
+
metaTokens?: boolean;
|
|
244
|
+
indexes?: boolean | null;
|
|
245
|
+
}
|
|
246
|
+
export interface ParamEncoder {
|
|
247
|
+
(value: any, defaultEncoder: (value: any) => any): any;
|
|
248
|
+
}
|
|
249
|
+
export interface CustomParamsSerializer {
|
|
250
|
+
(params: { [key: string]: any }, options?: ParamsSerializerOptions): string;
|
|
251
|
+
}
|
|
252
|
+
export type ParamsSerializerOptions = {
|
|
253
|
+
encode?: ParamEncoder,
|
|
254
|
+
serialize?: CustomParamsSerializer,
|
|
255
|
+
} & SerializerOptions;
|
|
224
256
|
declare export class RequestPlugin implements RequestPluginInterface {
|
|
225
257
|
pluginType: "request";
|
|
226
258
|
pluginName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foxford/services",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "Foxford services",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foxford",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"main": "./index.js",
|
|
27
27
|
"types": "./index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"axios": "0.
|
|
30
|
-
"axios-retry": "3.1
|
|
29
|
+
"axios": "0.28.1",
|
|
30
|
+
"axios-retry": "3.3.1",
|
|
31
31
|
"broadcast-channel": "5.5.1",
|
|
32
32
|
"centrifuge": "5.1.1"
|
|
33
33
|
},
|