laravel-request 1.1.19 → 1.1.20
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/dist/Api.d.ts +125 -0
- package/dist/Api.d.ts.map +1 -0
- package/dist/ApiProxy.d.ts +4 -0
- package/dist/ApiProxy.d.ts.map +1 -0
- package/dist/ApiRequest.d.ts +149 -0
- package/dist/ApiRequest.d.ts.map +1 -0
- package/dist/Binding.d.ts +11 -0
- package/dist/Binding.d.ts.map +1 -0
- package/dist/Builder.d.ts +7 -0
- package/dist/Builder.d.ts.map +1 -0
- package/dist/UrlBind.d.ts +8 -0
- package/dist/UrlBind.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/Api.js +10 -0
- package/src/ApiRequest.js +1 -0
- package/tsconfig.json +25 -0
- package/types/Api.d.ts +124 -0
- package/types/ApiRequest.d.ts +148 -0
- package/types/Binding.d.ts +10 -0
- package/types/Builder.d.ts +6 -0
package/dist/Api.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export default class Api {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @type {ApiRequest}
|
|
5
|
+
*/
|
|
6
|
+
static debug: ApiRequest;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {ApiRequest}
|
|
10
|
+
*/
|
|
11
|
+
static requestClass: ApiRequest;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @return {Promise<string>}
|
|
15
|
+
*/
|
|
16
|
+
static tokenResolver: () => Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param controller
|
|
20
|
+
* @param action
|
|
21
|
+
* @param arg
|
|
22
|
+
* @param data
|
|
23
|
+
* @return {ApiRequest}
|
|
24
|
+
*/
|
|
25
|
+
static getArg(controller: any, action: any, arg: any, data?: {}): ApiRequest;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param controller
|
|
29
|
+
* @param action
|
|
30
|
+
* @param arg
|
|
31
|
+
* @param data
|
|
32
|
+
* @return {ApiRequest}
|
|
33
|
+
*/
|
|
34
|
+
static postArg(controller: any, action: any, arg: any, data?: {}): ApiRequest;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param controller
|
|
38
|
+
* @param action
|
|
39
|
+
* @param arg
|
|
40
|
+
* @param data
|
|
41
|
+
* @return {ApiRequest}
|
|
42
|
+
*/
|
|
43
|
+
static putArg(controller: any, action: any, arg: any, data?: {}): ApiRequest;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param url
|
|
47
|
+
* @param data
|
|
48
|
+
* @return {ApiRequest}
|
|
49
|
+
*/
|
|
50
|
+
static getUrl(url: any, data?: {}): ApiRequest;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param url
|
|
54
|
+
* @param data
|
|
55
|
+
* @return {ApiRequest}
|
|
56
|
+
*/
|
|
57
|
+
static postUrl(url: any, data?: {}): ApiRequest;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param url
|
|
61
|
+
* @param data
|
|
62
|
+
* @return {ApiRequest}
|
|
63
|
+
*/
|
|
64
|
+
static putUrl(url: any, data?: {}): ApiRequest;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param controller
|
|
68
|
+
* @param action
|
|
69
|
+
* @param data
|
|
70
|
+
* @returns {ApiRequest}
|
|
71
|
+
*/
|
|
72
|
+
static get(controller: any, action: any, data?: {}): ApiRequest;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param controller
|
|
76
|
+
* @param action
|
|
77
|
+
* @param data
|
|
78
|
+
* @returns {ApiRequest}
|
|
79
|
+
*/
|
|
80
|
+
static post(controller: any, action: any, data?: {}): ApiRequest;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param controller
|
|
84
|
+
* @param action
|
|
85
|
+
* @param data
|
|
86
|
+
* @returns {ApiRequest}
|
|
87
|
+
*/
|
|
88
|
+
static put(controller: any, action: any, data?: {}): ApiRequest;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param controller
|
|
92
|
+
* @param action
|
|
93
|
+
* @param id
|
|
94
|
+
* @param data
|
|
95
|
+
* @return {ApiRequest}
|
|
96
|
+
*/
|
|
97
|
+
static delete(controller: any, action: any, id: any, data?: {}): ApiRequest;
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param params
|
|
101
|
+
* @return {*}
|
|
102
|
+
*/
|
|
103
|
+
static encodeQueryString(params: any): any;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param request
|
|
107
|
+
*/
|
|
108
|
+
static logRequest(request: any): void;
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param obj
|
|
112
|
+
* @return {*}
|
|
113
|
+
*/
|
|
114
|
+
static makeRequest({ url, method, data, params, headers, success, error }: {
|
|
115
|
+
url: any;
|
|
116
|
+
method: any;
|
|
117
|
+
data?: {};
|
|
118
|
+
params?: {};
|
|
119
|
+
headers?: {};
|
|
120
|
+
success?: () => void;
|
|
121
|
+
error?: () => void;
|
|
122
|
+
}): any;
|
|
123
|
+
}
|
|
124
|
+
import ApiRequest from "./ApiRequest";
|
|
125
|
+
//# sourceMappingURL=Api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../src/Api.js"],"names":[],"mappings":"AAGA;IAEE;;;OAGG;IACH,cAFU,UAAU,CAEC;IACrB;;;OAGG;IACH,qBAFU,UAAU,CAEa;IAEjC;;;OAGG;IACH,4BAFY,QAAQ,MAAM,CAAC,CAK1B;IAED;;;;;;;OAOG;IACH,kEAFY,UAAU,CAIrB;IAED;;;;;;;OAOG;IACH,mEAFY,UAAU,CAIrB;IAED;;;;;;;OAOG;IACH,kEAFY,UAAU,CAIrB;IAED;;;;;OAKG;IACH,oCAFY,UAAU,CAKrB;IAED;;;;;OAKG;IACH,qCAFY,UAAU,CAKrB;IAED;;;;;OAKG;IACH,oCAFY,UAAU,CAKrB;IAED;;;;;;OAMG;IACH,qDAFa,UAAU,CAItB;IACD;;;;;;OAMG;IACH,sDAFa,UAAU,CAItB;IACD;;;;;;OAMG;IACH,qDAFa,UAAU,CAItB;IAED;;;;;;;OAOG;IACH,iEAFY,UAAU,CAIrB;IAED;;;;OAIG;IACH,2CAeC;IAED;;;OAGG;IACH,sCAUC;IAED;;;;OAIG;IACH;;;;;;;;YA0GC;CACF;uBA/RsB,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiProxy.d.ts","sourceRoot":"","sources":["../src/ApiProxy.js"],"names":[],"mappings":"AAEA;CAGC;gBALe,OAAO"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export default class ApiRequest {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {null}
|
|
8
|
+
*/
|
|
9
|
+
static notifyClass: null;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param target
|
|
13
|
+
* @param focus
|
|
14
|
+
* @param data
|
|
15
|
+
* @param method
|
|
16
|
+
*/
|
|
17
|
+
constructor(target: any, focus: any, data?: {}, method?: string);
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
*/
|
|
22
|
+
url: string;
|
|
23
|
+
domain: string;
|
|
24
|
+
target: any;
|
|
25
|
+
focus: any;
|
|
26
|
+
method: string;
|
|
27
|
+
data: {};
|
|
28
|
+
headers: any[];
|
|
29
|
+
arguments: any[];
|
|
30
|
+
builder: Builder;
|
|
31
|
+
notifyCallback: (status: any) => boolean;
|
|
32
|
+
responseBinding: any[] | Binding;
|
|
33
|
+
responseBindingErrors: Binding;
|
|
34
|
+
callSuccess: () => void;
|
|
35
|
+
callError: () => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @return {null}
|
|
39
|
+
*/
|
|
40
|
+
getNotifyManager(): null;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param url
|
|
44
|
+
* @return {ApiRequest}
|
|
45
|
+
*/
|
|
46
|
+
setUrl(url: any): ApiRequest;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param domain
|
|
50
|
+
* @return {ApiRequest}
|
|
51
|
+
*/
|
|
52
|
+
setDomain(domain: any): ApiRequest;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param arg
|
|
56
|
+
* @returns {ApiRequest}
|
|
57
|
+
*/
|
|
58
|
+
addArg(arg: any): ApiRequest;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param successCallback
|
|
62
|
+
* @param errorCallback
|
|
63
|
+
* @returns {*}
|
|
64
|
+
*/
|
|
65
|
+
first(successCallback?: (r: any) => void, errorCallback?: () => void): any;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param successCallback
|
|
69
|
+
* @param errorCallback
|
|
70
|
+
* @returns {*}
|
|
71
|
+
*/
|
|
72
|
+
all(successCallback?: (r: any) => void, errorCallback?: () => void): any;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param page
|
|
76
|
+
* @param perPage
|
|
77
|
+
* @param successCallback
|
|
78
|
+
* @param errorCallback
|
|
79
|
+
* @returns {*}
|
|
80
|
+
*/
|
|
81
|
+
paginate(page?: number, perPage?: number, successCallback?: (r: any) => void, errorCallback?: () => void): any;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param fields
|
|
85
|
+
* @param successCallback
|
|
86
|
+
* @param errorCallback
|
|
87
|
+
* @return {ApiRequest}
|
|
88
|
+
*/
|
|
89
|
+
pluck(fields: any, successCallback?: (r: any) => void, errorCallback?: () => void): ApiRequest;
|
|
90
|
+
getUrl(): string;
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param successCallback
|
|
94
|
+
* @param errorCallback
|
|
95
|
+
* @param params
|
|
96
|
+
* @param dataKey
|
|
97
|
+
* @param argumentsKey
|
|
98
|
+
* @param queryKey
|
|
99
|
+
* @param byUrl
|
|
100
|
+
* @return {ApiRequest}
|
|
101
|
+
*/
|
|
102
|
+
call(successCallback?: (r: any) => void, errorCallback?: () => void, params?: {}, dataKey?: string, argumentsKey?: string, queryKey?: string, byUrl?: boolean): ApiRequest;
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param notify
|
|
106
|
+
* @param errorCallback
|
|
107
|
+
* @param xhr
|
|
108
|
+
* @param errorText
|
|
109
|
+
*/
|
|
110
|
+
handleError(notify: any, errorCallback: any, xhr: any, errorText: any): void;
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @param successCallback
|
|
114
|
+
* @param errorCallback
|
|
115
|
+
* @return {ApiRequest}
|
|
116
|
+
*/
|
|
117
|
+
callSync(successCallback?: (r: any) => void, errorCallback?: () => void): ApiRequest;
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
* @param successCallback
|
|
121
|
+
* @param errorCallback
|
|
122
|
+
* @param params
|
|
123
|
+
* @param dataKey
|
|
124
|
+
* @param argumentsKey
|
|
125
|
+
* @param queryKey
|
|
126
|
+
* @return {ApiRequest}
|
|
127
|
+
*/
|
|
128
|
+
callUrl(successCallback?: (r: any) => void, errorCallback?: () => void, params?: {}, dataKey?: string, argumentsKey?: string, queryKey?: string): ApiRequest;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param obj
|
|
132
|
+
* @param item
|
|
133
|
+
* @param rerender
|
|
134
|
+
* @param cb
|
|
135
|
+
*/
|
|
136
|
+
bind(obj: any, item: any, rerender: boolean, cb: any): this;
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param response
|
|
140
|
+
*/
|
|
141
|
+
toBind(response: any): void;
|
|
142
|
+
resetBindErrors(): void;
|
|
143
|
+
toBindErrors(response?: {}): void;
|
|
144
|
+
withValidateForm(obj: any, item?: string, key?: string): this;
|
|
145
|
+
withoutNotify(callback: any): this;
|
|
146
|
+
}
|
|
147
|
+
import Builder from "./Builder";
|
|
148
|
+
import Binding from "./Binding";
|
|
149
|
+
//# sourceMappingURL=ApiRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiRequest.d.ts","sourceRoot":"","sources":["../src/ApiRequest.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAQE;;;OAGG;IACH,oBAFU,IAAI,CAEY;IAE1B;;;;;;OAMG;IACH,iEA6BC;IAjDD;;;OAGG;IACH,KAFU,MAAM,CAEP;IAkBP,eAA2C;IAC3C,YAAoB;IACpB,WAAkB;IAClB,eAAoB;IACpB,SAAgB;IAChB,eAAiB;IACjB,iBAAmB;IACnB,iBAA4B;IAC5B,yCAA+C;IAC/C,iCAA2B;IAC3B,+BAAiC;IAEjC,wBAEC;IACD,sBAEC;IAYH;;;OAGG;IACH,oBAFY,IAAI,CAKf;IAED;;;;OAIG;IACH,kBAFY,UAAU,CAOrB;IAED;;;;OAIG;IACH,wBAFY,UAAU,CAOrB;IAED;;;;OAIG;IACH,kBAFa,UAAU,CAStB;IAED;;;;;OAKG;IACH,2EAKC;IAED;;;;;OAKG;IACH,yEAKC;IAED;;;;;;;OAOG;IACH,+GAOC;IAED;;;;;;OAMG;IACH,oFAFY,UAAU,CAQrB;IAED,iBAGC;IAED;;;;;;;;;;OAUG;IACH,gKAFY,UAAU,CAuErB;IAED;;;;;;OAMG;IACH,6EAmEC;IAED;;;;;OAKG;IACH,0EAFY,UAAU,CAMrB;IAED;;;;;;;;;OASG;IACH,kJAFY,UAAU,CAOrB;IAED;;;;;;OAMG;IACH,4DAgBC;IAED;;;OAGG;IACH,4BAaC;IAED,wBAIC;IAED,kCAMC;IAED,8DAGC;IAED,mCAYC;CACF;oBA/amB,WAAW;oBACX,WAAW"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default class Binding {
|
|
2
|
+
constructor(target: any, pathTarget: any, pathData: any, rerender: any, onSuccess: any);
|
|
3
|
+
target: any;
|
|
4
|
+
pathTarget: any;
|
|
5
|
+
pathData: any;
|
|
6
|
+
callback: any;
|
|
7
|
+
rerender: any;
|
|
8
|
+
fire(data: any): void;
|
|
9
|
+
getData(value: any): any;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Binding.d.ts","sourceRoot":"","sources":["../src/Binding.js"],"names":[],"mappings":"AAAA;IAEI,wFAOC;IALG,YAAoB;IACpB,gBAAuC;IACvC,cAAmC;IACnC,cAAyB;IACzB,cAAwB;IAG5B,sBA4BC;IAED,yBAaC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["../src/Builder.js"],"names":[],"mappings":"AAAA;IAEI,iCAqCE;IAIE,aAAe;IAYnB,kCAcC;IAED,iBAEC;CACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default class UrlBind {
|
|
2
|
+
static parse: boolean;
|
|
3
|
+
static order(query: any, options: any): any;
|
|
4
|
+
static filter(query: any, options: any): any;
|
|
5
|
+
static getParams(query: any, options: any): any;
|
|
6
|
+
static urlParse(obj: any): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=UrlBind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UrlBind.d.ts","sourceRoot":"","sources":["../src/UrlBind.js"],"names":[],"mappings":"AAEA;IAEI,sBAAqB;IAGrB,4CAOC;IAED,6CA4BC;IAED,gDA8BC;IAED,gCAWC;CACJ"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Api from "./Api";
|
|
2
|
+
import ApiProxy from "./ApiProxy";
|
|
3
|
+
import ApiRequest from "./ApiRequest";
|
|
4
|
+
import Binding from "./Binding";
|
|
5
|
+
import Builder from "./Builder";
|
|
6
|
+
import UrlBind from "./UrlBind";
|
|
7
|
+
export { Api, ApiProxy, ApiRequest, Binding, Builder, UrlBind };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"gBAAgB,OAAO;qBACF,YAAY;uBACV,cAAc;oBACjB,WAAW;oBACX,WAAW;oBACX,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "laravel-request",
|
|
3
3
|
"productName": "laravel-request",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.20",
|
|
5
5
|
"description": "laravel-request",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "dist/index.js",
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"keywords": [],
|
|
9
9
|
"author": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
+
"@types/node": "^20.11.28",
|
|
15
16
|
"axios": "^1.3.2",
|
|
16
17
|
"query-string": "^8.1.0"
|
|
17
18
|
}
|
package/src/Api.js
CHANGED
|
@@ -14,6 +14,10 @@ export default class Api {
|
|
|
14
14
|
*/
|
|
15
15
|
static requestClass = ApiRequest;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @return {Promise<string>}
|
|
20
|
+
*/
|
|
17
21
|
static tokenResolver = async () =>
|
|
18
22
|
{
|
|
19
23
|
return localStorage.getItem('api_token');
|
|
@@ -131,6 +135,11 @@ export default class Api {
|
|
|
131
135
|
return new this.requestClass(controller, action, data, 'DELETE').addArg(id);
|
|
132
136
|
}
|
|
133
137
|
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param params
|
|
141
|
+
* @return {*}
|
|
142
|
+
*/
|
|
134
143
|
static encodeQueryString(params) {
|
|
135
144
|
const flattenObject = (obj, parentKey = '') => {
|
|
136
145
|
return Object.entries(obj).map(([key, value]) => {
|
|
@@ -144,6 +153,7 @@ export default class Api {
|
|
|
144
153
|
};
|
|
145
154
|
|
|
146
155
|
const flatParams = flattenObject(params);
|
|
156
|
+
|
|
147
157
|
return flatParams.join('&');
|
|
148
158
|
}
|
|
149
159
|
|
package/src/ApiRequest.js
CHANGED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Change this to match your project
|
|
3
|
+
"include": ["src/*"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
// Tells TypeScript to read JS files, as
|
|
6
|
+
// normally they are ignored as source files
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
// Generate d.ts files
|
|
9
|
+
"declaration": true,
|
|
10
|
+
// This compiler run should
|
|
11
|
+
// only output d.ts files
|
|
12
|
+
"emitDeclarationOnly": true,
|
|
13
|
+
// Types should go into this directory.
|
|
14
|
+
// Removing this would place the .d.ts files
|
|
15
|
+
// next to the .js files
|
|
16
|
+
"outDir": "dist",
|
|
17
|
+
// go to js file when using IDE functions like
|
|
18
|
+
// "Go to Definition" in VSCode
|
|
19
|
+
"declarationMap": true,
|
|
20
|
+
|
|
21
|
+
"types": [
|
|
22
|
+
"node"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
package/types/Api.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export default class Api {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @type {ApiRequest}
|
|
5
|
+
*/
|
|
6
|
+
static debug: ApiRequest;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {ApiRequest}
|
|
10
|
+
*/
|
|
11
|
+
static requestClass: ApiRequest;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @return {Promise<string>}
|
|
15
|
+
*/
|
|
16
|
+
static tokenResolver: () => Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param controller
|
|
20
|
+
* @param action
|
|
21
|
+
* @param arg
|
|
22
|
+
* @param data
|
|
23
|
+
* @return {ApiRequest}
|
|
24
|
+
*/
|
|
25
|
+
static getArg(controller: any, action: any, arg: any, data?: {}): ApiRequest;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param controller
|
|
29
|
+
* @param action
|
|
30
|
+
* @param arg
|
|
31
|
+
* @param data
|
|
32
|
+
* @return {ApiRequest}
|
|
33
|
+
*/
|
|
34
|
+
static postArg(controller: any, action: any, arg: any, data?: {}): ApiRequest;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param controller
|
|
38
|
+
* @param action
|
|
39
|
+
* @param arg
|
|
40
|
+
* @param data
|
|
41
|
+
* @return {ApiRequest}
|
|
42
|
+
*/
|
|
43
|
+
static putArg(controller: any, action: any, arg: any, data?: {}): ApiRequest;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param url
|
|
47
|
+
* @param data
|
|
48
|
+
* @return {ApiRequest}
|
|
49
|
+
*/
|
|
50
|
+
static getUrl(url: any, data?: {}): ApiRequest;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param url
|
|
54
|
+
* @param data
|
|
55
|
+
* @return {ApiRequest}
|
|
56
|
+
*/
|
|
57
|
+
static postUrl(url: any, data?: {}): ApiRequest;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param url
|
|
61
|
+
* @param data
|
|
62
|
+
* @return {ApiRequest}
|
|
63
|
+
*/
|
|
64
|
+
static putUrl(url: any, data?: {}): ApiRequest;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param controller
|
|
68
|
+
* @param action
|
|
69
|
+
* @param data
|
|
70
|
+
* @returns {ApiRequest}
|
|
71
|
+
*/
|
|
72
|
+
static get(controller: any, action: any, data?: {}): ApiRequest;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param controller
|
|
76
|
+
* @param action
|
|
77
|
+
* @param data
|
|
78
|
+
* @returns {ApiRequest}
|
|
79
|
+
*/
|
|
80
|
+
static post(controller: any, action: any, data?: {}): ApiRequest;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param controller
|
|
84
|
+
* @param action
|
|
85
|
+
* @param data
|
|
86
|
+
* @returns {ApiRequest}
|
|
87
|
+
*/
|
|
88
|
+
static put(controller: any, action: any, data?: {}): ApiRequest;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param controller
|
|
92
|
+
* @param action
|
|
93
|
+
* @param id
|
|
94
|
+
* @param data
|
|
95
|
+
* @return {ApiRequest}
|
|
96
|
+
*/
|
|
97
|
+
static delete(controller: any, action: any, id: any, data?: {}): ApiRequest;
|
|
98
|
+
/**
|
|
99
|
+
*
|
|
100
|
+
* @param params
|
|
101
|
+
* @return {*}
|
|
102
|
+
*/
|
|
103
|
+
static encodeQueryString(params: any): any;
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param request
|
|
107
|
+
*/
|
|
108
|
+
static logRequest(request: any): void;
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param obj
|
|
112
|
+
* @return {*}
|
|
113
|
+
*/
|
|
114
|
+
static makeRequest({ url, method, data, params, headers, success, error }: {
|
|
115
|
+
url: any;
|
|
116
|
+
method: any;
|
|
117
|
+
data?: {};
|
|
118
|
+
params?: {};
|
|
119
|
+
headers?: {};
|
|
120
|
+
success?: () => void;
|
|
121
|
+
error?: () => void;
|
|
122
|
+
}): any;
|
|
123
|
+
}
|
|
124
|
+
import ApiRequest from "./ApiRequest";
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export default class ApiRequest {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {null}
|
|
8
|
+
*/
|
|
9
|
+
static notifyClass: null;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param target
|
|
13
|
+
* @param focus
|
|
14
|
+
* @param data
|
|
15
|
+
* @param method
|
|
16
|
+
*/
|
|
17
|
+
constructor(target: any, focus: any, data?: {}, method?: string);
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
*/
|
|
22
|
+
url: string;
|
|
23
|
+
domain: any;
|
|
24
|
+
target: any;
|
|
25
|
+
focus: any;
|
|
26
|
+
method: string;
|
|
27
|
+
data: {};
|
|
28
|
+
headers: any[];
|
|
29
|
+
arguments: any[];
|
|
30
|
+
builder: Builder;
|
|
31
|
+
notifyCallback: (status: any) => boolean;
|
|
32
|
+
responseBinding: any[] | Binding;
|
|
33
|
+
responseBindingErrors: Binding;
|
|
34
|
+
callSuccess: () => void;
|
|
35
|
+
callError: () => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @return {null}
|
|
39
|
+
*/
|
|
40
|
+
getNotifyManager(): null;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param url
|
|
44
|
+
* @return {ApiRequest}
|
|
45
|
+
*/
|
|
46
|
+
setUrl(url: any): ApiRequest;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param domain
|
|
50
|
+
* @return {ApiRequest}
|
|
51
|
+
*/
|
|
52
|
+
setDomain(domain: any): ApiRequest;
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @param arg
|
|
56
|
+
* @returns {ApiRequest}
|
|
57
|
+
*/
|
|
58
|
+
addArg(arg: any): ApiRequest;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param successCallback
|
|
62
|
+
* @param errorCallback
|
|
63
|
+
* @returns {*}
|
|
64
|
+
*/
|
|
65
|
+
first(successCallback?: (r: any) => void, errorCallback?: () => void): any;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param successCallback
|
|
69
|
+
* @param errorCallback
|
|
70
|
+
* @returns {*}
|
|
71
|
+
*/
|
|
72
|
+
all(successCallback?: (r: any) => void, errorCallback?: () => void): any;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param page
|
|
76
|
+
* @param perPage
|
|
77
|
+
* @param successCallback
|
|
78
|
+
* @param errorCallback
|
|
79
|
+
* @returns {*}
|
|
80
|
+
*/
|
|
81
|
+
paginate(page?: number, perPage?: number, successCallback?: (r: any) => void, errorCallback?: () => void): any;
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param fields
|
|
85
|
+
* @param successCallback
|
|
86
|
+
* @param errorCallback
|
|
87
|
+
* @return {ApiRequest}
|
|
88
|
+
*/
|
|
89
|
+
pluck(fields: any, successCallback?: (r: any) => void, errorCallback?: () => void): ApiRequest;
|
|
90
|
+
getUrl(): string;
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param successCallback
|
|
94
|
+
* @param errorCallback
|
|
95
|
+
* @param params
|
|
96
|
+
* @param dataKey
|
|
97
|
+
* @param argumentsKey
|
|
98
|
+
* @param queryKey
|
|
99
|
+
* @param byUrl
|
|
100
|
+
* @return {ApiRequest}
|
|
101
|
+
*/
|
|
102
|
+
call(successCallback?: (r: any) => void, errorCallback?: () => void, params?: {}, dataKey?: string, argumentsKey?: string, queryKey?: string, byUrl?: boolean): ApiRequest;
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param notify
|
|
106
|
+
* @param errorCallback
|
|
107
|
+
* @param xhr
|
|
108
|
+
* @param errorText
|
|
109
|
+
*/
|
|
110
|
+
handleError(notify: any, errorCallback: any, xhr: any, errorText: any): void;
|
|
111
|
+
/**
|
|
112
|
+
*
|
|
113
|
+
* @param successCallback
|
|
114
|
+
* @param errorCallback
|
|
115
|
+
* @return {ApiRequest}
|
|
116
|
+
*/
|
|
117
|
+
callSync(successCallback?: (r: any) => void, errorCallback?: () => void): ApiRequest;
|
|
118
|
+
/**
|
|
119
|
+
*
|
|
120
|
+
* @param successCallback
|
|
121
|
+
* @param errorCallback
|
|
122
|
+
* @param params
|
|
123
|
+
* @param dataKey
|
|
124
|
+
* @param argumentsKey
|
|
125
|
+
* @param queryKey
|
|
126
|
+
* @return {ApiRequest}
|
|
127
|
+
*/
|
|
128
|
+
callUrl(successCallback?: (r: any) => void, errorCallback?: () => void, params?: {}, dataKey?: string, argumentsKey?: string, queryKey?: string): ApiRequest;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param obj
|
|
132
|
+
* @param item
|
|
133
|
+
* @param rerender
|
|
134
|
+
* @param cb
|
|
135
|
+
*/
|
|
136
|
+
bind(obj: any, item: any, rerender: boolean, cb: any): this;
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param response
|
|
140
|
+
*/
|
|
141
|
+
toBind(response: any): void;
|
|
142
|
+
resetBindErrors(): void;
|
|
143
|
+
toBindErrors(response?: {}): void;
|
|
144
|
+
withValidateForm(obj: any, item?: string, key?: string): this;
|
|
145
|
+
withoutNotify(callback: any): this;
|
|
146
|
+
}
|
|
147
|
+
import Builder from "./Builder";
|
|
148
|
+
import Binding from "./Binding";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default class Binding {
|
|
2
|
+
constructor(target: any, pathTarget: any, pathData: any, rerender: any, onSuccess: any);
|
|
3
|
+
target: any;
|
|
4
|
+
pathTarget: any;
|
|
5
|
+
pathData: any;
|
|
6
|
+
callback: any;
|
|
7
|
+
rerender: any;
|
|
8
|
+
fire(data: any): void;
|
|
9
|
+
getData(value: any): any;
|
|
10
|
+
}
|