jordy 0.14.0 → 0.14.3
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useNavigate as useRcNavigate, useSearchParams, } from 'react-router-dom';
|
|
4
|
-
import { isObject, isUndefined } from '../util';
|
|
4
|
+
import { isNullable, isObject, isUndefined } from '../util';
|
|
5
5
|
function instanceOfTo(to) {
|
|
6
6
|
return isObject(to) && ('pathname' in to || 'search' in to || 'hash' in to);
|
|
7
7
|
}
|
|
@@ -11,6 +11,15 @@ function instanceOfSearchParams(to) {
|
|
|
11
11
|
function isMergeQueries(option) {
|
|
12
12
|
return isUndefined(option) || (option && option['merge'] === true);
|
|
13
13
|
}
|
|
14
|
+
function refineQueries(queries) {
|
|
15
|
+
return Object.entries(queries).reduce(function (acc, _a) {
|
|
16
|
+
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
17
|
+
if (!isNullable(value) && value !== '') {
|
|
18
|
+
acc[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return acc;
|
|
21
|
+
}, {});
|
|
22
|
+
}
|
|
14
23
|
export function useNavigate() {
|
|
15
24
|
var _a = __read(useSearchParams(), 2), currentSearchParams = _a[0], setSearchParams = _a[1];
|
|
16
25
|
var navigate = useRcNavigate();
|
|
@@ -31,9 +40,10 @@ export function useNavigate() {
|
|
|
31
40
|
acc[key] = value;
|
|
32
41
|
return acc;
|
|
33
42
|
}, {});
|
|
34
|
-
|
|
43
|
+
var mergeQueries = __assign(__assign({}, currentQueries), to);
|
|
44
|
+
return setSearchParams(refineQueries(mergeQueries), option);
|
|
35
45
|
}
|
|
36
|
-
return setSearchParams(to, option);
|
|
46
|
+
return setSearchParams(refineQueries(to), option);
|
|
37
47
|
}
|
|
38
48
|
return navigate(to, option);
|
|
39
49
|
}, [currentSearchParams, navigate, setSearchParams]);
|
|
@@ -14,110 +14,140 @@ var BasicHttpApi = (function (_super) {
|
|
|
14
14
|
}
|
|
15
15
|
BasicHttpApi.prototype.get = function (url, params, timeout) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function () {
|
|
17
|
-
var headers;
|
|
17
|
+
var headers, error_1;
|
|
18
18
|
return __generator(this, function (_a) {
|
|
19
19
|
switch (_a.label) {
|
|
20
|
-
case 0:
|
|
20
|
+
case 0:
|
|
21
|
+
_a.trys.push([0, 3, , 4]);
|
|
22
|
+
return [4, this.headersCreator()];
|
|
21
23
|
case 1:
|
|
22
24
|
headers = _a.sent();
|
|
23
|
-
return [
|
|
24
|
-
.get({
|
|
25
|
+
return [4, this.provider.get({
|
|
25
26
|
url: "".concat(this.baseUrl).concat(url),
|
|
26
27
|
headers: headers,
|
|
27
28
|
withCredentials: this.withCredentials,
|
|
28
29
|
paramsSerializer: this.paramsSerializer,
|
|
29
30
|
params: this.mergeParams('get', url, params),
|
|
30
31
|
timeout: timeout,
|
|
31
|
-
})
|
|
32
|
-
|
|
32
|
+
})];
|
|
33
|
+
case 2: return [2, _a.sent()];
|
|
34
|
+
case 3:
|
|
35
|
+
error_1 = _a.sent();
|
|
36
|
+
this.throwWithInterceptor(error_1);
|
|
37
|
+
return [3, 4];
|
|
38
|
+
case 4: return [2];
|
|
33
39
|
}
|
|
34
40
|
});
|
|
35
41
|
});
|
|
36
42
|
};
|
|
37
43
|
BasicHttpApi.prototype.post = function (url, body, timeout) {
|
|
38
44
|
return __awaiter(this, void 0, void 0, function () {
|
|
39
|
-
var headers;
|
|
45
|
+
var headers, error_2;
|
|
40
46
|
return __generator(this, function (_a) {
|
|
41
47
|
switch (_a.label) {
|
|
42
|
-
case 0:
|
|
48
|
+
case 0:
|
|
49
|
+
_a.trys.push([0, 3, , 4]);
|
|
50
|
+
return [4, this.headersCreator()];
|
|
43
51
|
case 1:
|
|
44
52
|
headers = _a.sent();
|
|
45
|
-
return [
|
|
46
|
-
.post({
|
|
53
|
+
return [4, this.provider.post({
|
|
47
54
|
url: "".concat(this.baseUrl).concat(this.mergeQueries('post', url, body)),
|
|
48
55
|
headers: headers,
|
|
49
56
|
withCredentials: this.withCredentials,
|
|
50
57
|
paramsSerializer: this.paramsSerializer,
|
|
51
58
|
params: body,
|
|
52
59
|
timeout: timeout,
|
|
53
|
-
})
|
|
54
|
-
|
|
60
|
+
})];
|
|
61
|
+
case 2: return [2, _a.sent()];
|
|
62
|
+
case 3:
|
|
63
|
+
error_2 = _a.sent();
|
|
64
|
+
this.throwWithInterceptor(error_2);
|
|
65
|
+
return [3, 4];
|
|
66
|
+
case 4: return [2];
|
|
55
67
|
}
|
|
56
68
|
});
|
|
57
69
|
});
|
|
58
70
|
};
|
|
59
71
|
BasicHttpApi.prototype.put = function (url, body, timeout) {
|
|
60
72
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var headers;
|
|
73
|
+
var headers, error_3;
|
|
62
74
|
return __generator(this, function (_a) {
|
|
63
75
|
switch (_a.label) {
|
|
64
|
-
case 0:
|
|
76
|
+
case 0:
|
|
77
|
+
_a.trys.push([0, 3, , 4]);
|
|
78
|
+
return [4, this.headersCreator()];
|
|
65
79
|
case 1:
|
|
66
80
|
headers = _a.sent();
|
|
67
|
-
return [
|
|
68
|
-
.put({
|
|
81
|
+
return [4, this.provider.put({
|
|
69
82
|
url: "".concat(this.baseUrl).concat(this.mergeQueries('put', url, body)),
|
|
70
83
|
headers: headers,
|
|
71
84
|
withCredentials: this.withCredentials,
|
|
72
85
|
paramsSerializer: this.paramsSerializer,
|
|
73
86
|
params: body,
|
|
74
87
|
timeout: timeout,
|
|
75
|
-
})
|
|
76
|
-
|
|
88
|
+
})];
|
|
89
|
+
case 2: return [2, _a.sent()];
|
|
90
|
+
case 3:
|
|
91
|
+
error_3 = _a.sent();
|
|
92
|
+
this.throwWithInterceptor(error_3);
|
|
93
|
+
return [3, 4];
|
|
94
|
+
case 4: return [2];
|
|
77
95
|
}
|
|
78
96
|
});
|
|
79
97
|
});
|
|
80
98
|
};
|
|
81
99
|
BasicHttpApi.prototype.patch = function (url, body, timeout) {
|
|
82
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var headers;
|
|
101
|
+
var headers, error_4;
|
|
84
102
|
return __generator(this, function (_a) {
|
|
85
103
|
switch (_a.label) {
|
|
86
|
-
case 0:
|
|
104
|
+
case 0:
|
|
105
|
+
_a.trys.push([0, 3, , 4]);
|
|
106
|
+
return [4, this.headersCreator()];
|
|
87
107
|
case 1:
|
|
88
108
|
headers = _a.sent();
|
|
89
|
-
return [
|
|
90
|
-
.patch({
|
|
109
|
+
return [4, this.provider.patch({
|
|
91
110
|
url: "".concat(this.baseUrl).concat(this.mergeQueries('patch', url, body)),
|
|
92
111
|
headers: headers,
|
|
93
112
|
withCredentials: this.withCredentials,
|
|
94
113
|
paramsSerializer: this.paramsSerializer,
|
|
95
114
|
params: body,
|
|
96
115
|
timeout: timeout,
|
|
97
|
-
})
|
|
98
|
-
|
|
116
|
+
})];
|
|
117
|
+
case 2: return [2, _a.sent()];
|
|
118
|
+
case 3:
|
|
119
|
+
error_4 = _a.sent();
|
|
120
|
+
this.throwWithInterceptor(error_4);
|
|
121
|
+
return [3, 4];
|
|
122
|
+
case 4: return [2];
|
|
99
123
|
}
|
|
100
124
|
});
|
|
101
125
|
});
|
|
102
126
|
};
|
|
103
127
|
BasicHttpApi.prototype.delete = function (url, body, timeout) {
|
|
104
128
|
return __awaiter(this, void 0, void 0, function () {
|
|
105
|
-
var headers;
|
|
129
|
+
var headers, error_5;
|
|
106
130
|
return __generator(this, function (_a) {
|
|
107
131
|
switch (_a.label) {
|
|
108
|
-
case 0:
|
|
132
|
+
case 0:
|
|
133
|
+
_a.trys.push([0, 3, , 4]);
|
|
134
|
+
return [4, this.headersCreator()];
|
|
109
135
|
case 1:
|
|
110
136
|
headers = _a.sent();
|
|
111
|
-
return [
|
|
112
|
-
.delete({
|
|
137
|
+
return [4, this.provider.delete({
|
|
113
138
|
url: "".concat(this.baseUrl).concat(this.mergeQueries('delete', url, body)),
|
|
114
139
|
headers: headers,
|
|
115
140
|
withCredentials: this.withCredentials,
|
|
116
141
|
paramsSerializer: this.paramsSerializer,
|
|
117
142
|
params: body,
|
|
118
143
|
timeout: timeout,
|
|
119
|
-
})
|
|
120
|
-
|
|
144
|
+
})];
|
|
145
|
+
case 2: return [2, _a.sent()];
|
|
146
|
+
case 3:
|
|
147
|
+
error_5 = _a.sent();
|
|
148
|
+
this.throwWithInterceptor(error_5);
|
|
149
|
+
return [3, 4];
|
|
150
|
+
case 4: return [2];
|
|
121
151
|
}
|
|
122
152
|
});
|
|
123
153
|
});
|
|
@@ -131,21 +161,27 @@ var BasicHttpApi = (function (_super) {
|
|
|
131
161
|
};
|
|
132
162
|
BasicHttpApi.prototype.getBlob = function (url, params) {
|
|
133
163
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
var headers;
|
|
164
|
+
var headers, error_6;
|
|
135
165
|
return __generator(this, function (_a) {
|
|
136
166
|
switch (_a.label) {
|
|
137
|
-
case 0:
|
|
167
|
+
case 0:
|
|
168
|
+
_a.trys.push([0, 3, , 4]);
|
|
169
|
+
return [4, this.headersCreator()];
|
|
138
170
|
case 1:
|
|
139
171
|
headers = _a.sent();
|
|
140
|
-
return [
|
|
141
|
-
.getBlob({
|
|
172
|
+
return [4, this.provider.getBlob({
|
|
142
173
|
url: "".concat(this.baseUrl).concat(url),
|
|
143
174
|
headers: headers,
|
|
144
175
|
withCredentials: this.withCredentials,
|
|
145
176
|
paramsSerializer: this.paramsSerializer,
|
|
146
177
|
params: this.mergeParams('get', url, params),
|
|
147
|
-
})
|
|
148
|
-
|
|
178
|
+
})];
|
|
179
|
+
case 2: return [2, _a.sent()];
|
|
180
|
+
case 3:
|
|
181
|
+
error_6 = _a.sent();
|
|
182
|
+
this.throwWithInterceptor(error_6);
|
|
183
|
+
return [3, 4];
|
|
184
|
+
case 4: return [2];
|
|
149
185
|
}
|
|
150
186
|
});
|
|
151
187
|
});
|
|
@@ -13,44 +13,56 @@ var BasicHttpUploadApi = (function (_super) {
|
|
|
13
13
|
}
|
|
14
14
|
BasicHttpUploadApi.prototype.postUpload = function (url, data, progressCallback, timeout) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function () {
|
|
16
|
-
var headers;
|
|
16
|
+
var headers, error_1;
|
|
17
17
|
return __generator(this, function (_a) {
|
|
18
18
|
switch (_a.label) {
|
|
19
|
-
case 0:
|
|
19
|
+
case 0:
|
|
20
|
+
_a.trys.push([0, 3, , 4]);
|
|
21
|
+
return [4, this.headersCreator()];
|
|
20
22
|
case 1:
|
|
21
23
|
headers = _a.sent();
|
|
22
|
-
return [
|
|
23
|
-
.post({
|
|
24
|
+
return [4, this.provider.post({
|
|
24
25
|
url: "".concat(this.baseUrl).concat(this.mergeQueries('post', url, data)),
|
|
25
26
|
headers: headers,
|
|
26
27
|
withCredentials: this.withCredentials,
|
|
27
28
|
data: data,
|
|
28
29
|
timeout: timeout,
|
|
29
30
|
onProgress: progressCallback,
|
|
30
|
-
})
|
|
31
|
-
|
|
31
|
+
})];
|
|
32
|
+
case 2: return [2, _a.sent()];
|
|
33
|
+
case 3:
|
|
34
|
+
error_1 = _a.sent();
|
|
35
|
+
this.throwWithInterceptor(error_1);
|
|
36
|
+
return [3, 4];
|
|
37
|
+
case 4: return [2];
|
|
32
38
|
}
|
|
33
39
|
});
|
|
34
40
|
});
|
|
35
41
|
};
|
|
36
42
|
BasicHttpUploadApi.prototype.putUpload = function (url, data, progressCallback, timeout) {
|
|
37
43
|
return __awaiter(this, void 0, void 0, function () {
|
|
38
|
-
var headers;
|
|
44
|
+
var headers, error_2;
|
|
39
45
|
return __generator(this, function (_a) {
|
|
40
46
|
switch (_a.label) {
|
|
41
|
-
case 0:
|
|
47
|
+
case 0:
|
|
48
|
+
_a.trys.push([0, 3, , 4]);
|
|
49
|
+
return [4, this.headersCreator()];
|
|
42
50
|
case 1:
|
|
43
51
|
headers = _a.sent();
|
|
44
|
-
return [
|
|
45
|
-
.put({
|
|
52
|
+
return [4, this.provider.put({
|
|
46
53
|
url: "".concat(this.baseUrl).concat(this.mergeQueries('put', url, data)),
|
|
47
54
|
headers: headers,
|
|
48
55
|
withCredentials: this.withCredentials,
|
|
49
56
|
data: data,
|
|
50
57
|
timeout: timeout,
|
|
51
58
|
onProgress: progressCallback,
|
|
52
|
-
})
|
|
53
|
-
|
|
59
|
+
})];
|
|
60
|
+
case 2: return [2, _a.sent()];
|
|
61
|
+
case 3:
|
|
62
|
+
error_2 = _a.sent();
|
|
63
|
+
this.throwWithInterceptor(error_2);
|
|
64
|
+
return [3, 4];
|
|
65
|
+
case 4: return [2];
|
|
54
66
|
}
|
|
55
67
|
});
|
|
56
68
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyAction, EnhancedStore,
|
|
1
|
+
import { AnyAction, EnhancedStore, MiddlewareArray } from '@reduxjs/toolkit';
|
|
2
2
|
interface MutationHooksCreatorSettingOptionDto<SR, SP, R, P, ReduxRootState> {
|
|
3
3
|
/**
|
|
4
4
|
* Mutation hooks의 고유키이다. auto dispatch 사용 시 반드시 필요하다.
|
|
@@ -33,5 +33,5 @@ interface MutationResultType<R = void, P = void, E extends Error = Error> {
|
|
|
33
33
|
interface MutationHooks<R = void, P = void, E extends Error = Error> {
|
|
34
34
|
(params?: R): MutationResultType<R, P, E>;
|
|
35
35
|
}
|
|
36
|
-
export declare function buildMutationCreator<S>(store: EnhancedStore<S, AnyAction, MiddlewareArray<
|
|
36
|
+
export declare function buildMutationCreator<S>(store: EnhancedStore<S, AnyAction, MiddlewareArray<any[]>>): <SR, SP, R, P, E extends Error>({ key, mutator, parameterConverter, resultConverter, }: MutationHooksCreatorSettingOptionDto<SR, SP, R, P, S>) => MutationHooks<R, P, E>;
|
|
37
37
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyAction, EnhancedStore,
|
|
1
|
+
import { AnyAction, EnhancedStore, MiddlewareArray } from '@reduxjs/toolkit';
|
|
2
2
|
import { StorageType } from '../storage';
|
|
3
3
|
/**
|
|
4
4
|
* query hooks가 리턴하는 객체
|
|
@@ -111,5 +111,5 @@ interface CreateRepositoryQuery<S> {
|
|
|
111
111
|
<SR, SP, R, P, E extends Error = Error>(config: QueryHooksCreatorSettingOptionDto<SR, SP, R, P, S>): QueryHooks<R, P, E>;
|
|
112
112
|
<R, P, E extends Error = Error>(config: QueryHooksCreatorSettingOptionDto<R, P, R, P, S>): QueryHooks<R, P, E>;
|
|
113
113
|
}
|
|
114
|
-
export declare function buildQueryCreator<S>(store: EnhancedStore<S, AnyAction, MiddlewareArray<
|
|
114
|
+
export declare function buildQueryCreator<S>(store: EnhancedStore<S, AnyAction, MiddlewareArray<any[]>>): CreateRepositoryQuery<S>;
|
|
115
115
|
export {};
|