@datocms/rest-client-utils 5.0.0 → 5.1.0
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/cjs/__tests__/buildNormalizedParams.test.js +91 -53
- package/dist/cjs/__tests__/buildNormalizedParams.test.js.map +1 -1
- package/dist/cjs/buildNormalizedParams.js +15 -30
- package/dist/cjs/buildNormalizedParams.js.map +1 -1
- package/dist/cjs/deserialize.js +7 -22
- package/dist/cjs/deserialize.js.map +1 -1
- package/dist/cjs/errors.js +45 -77
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/makeCancelablePromise.js +9 -28
- package/dist/cjs/makeCancelablePromise.js.map +1 -1
- package/dist/cjs/pollJobResult.js +17 -57
- package/dist/cjs/pollJobResult.js.map +1 -1
- package/dist/cjs/rawPageIterator.js +25 -91
- package/dist/cjs/rawPageIterator.js.map +1 -1
- package/dist/cjs/request.js +133 -200
- package/dist/cjs/request.js.map +1 -1
- package/dist/cjs/serialize.js +17 -40
- package/dist/cjs/serialize.js.map +1 -1
- package/dist/cjs/wait.js +1 -1
- package/dist/cjs/wait.js.map +1 -1
- package/dist/esm/__tests__/buildNormalizedParams.test.js +90 -52
- package/dist/esm/__tests__/buildNormalizedParams.test.js.map +1 -1
- package/dist/esm/buildNormalizedParams.js +15 -30
- package/dist/esm/buildNormalizedParams.js.map +1 -1
- package/dist/esm/deserialize.js +7 -22
- package/dist/esm/deserialize.js.map +1 -1
- package/dist/esm/errors.js +45 -79
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/makeCancelablePromise.js +9 -29
- package/dist/esm/makeCancelablePromise.js.map +1 -1
- package/dist/esm/pollJobResult.js +15 -55
- package/dist/esm/pollJobResult.js.map +1 -1
- package/dist/esm/rawPageIterator.js +24 -90
- package/dist/esm/rawPageIterator.js.map +1 -1
- package/dist/esm/request.js +129 -196
- package/dist/esm/request.js.map +1 -1
- package/dist/esm/serialize.js +17 -40
- package/dist/esm/serialize.js.map +1 -1
- package/dist/esm/wait.js +1 -1
- package/dist/esm/wait.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/request.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,39 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
9
|
});
|
|
21
10
|
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
11
|
import { buildNormalizedParams } from './buildNormalizedParams';
|
|
50
12
|
import { ApiError, TimeoutError, } from './errors';
|
|
51
13
|
import { CanceledPromiseError, makeCancelablePromise, } from './makeCancelablePromise';
|
|
52
14
|
import { wait } from './wait';
|
|
53
|
-
|
|
54
|
-
|
|
15
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
16
|
+
const MAX_RETRY_COUNT_ON_TIMEOUT_ERROR = 5;
|
|
55
17
|
export var LogLevel;
|
|
56
18
|
(function (LogLevel) {
|
|
57
19
|
/** No logging */
|
|
@@ -64,8 +26,8 @@ export var LogLevel;
|
|
|
64
26
|
LogLevel[LogLevel["BODY_AND_HEADERS"] = 3] = "BODY_AND_HEADERS";
|
|
65
27
|
})(LogLevel || (LogLevel = {}));
|
|
66
28
|
function headersToObject(headers) {
|
|
67
|
-
|
|
68
|
-
headers.forEach(
|
|
29
|
+
const result = {};
|
|
30
|
+
headers.forEach((value, key) => {
|
|
69
31
|
result[key] = value;
|
|
70
32
|
});
|
|
71
33
|
return result;
|
|
@@ -73,8 +35,8 @@ function headersToObject(headers) {
|
|
|
73
35
|
function buildApiErrorInitObject(method, url, requestHeaders, requestBody, response, responseBody, preCallStack) {
|
|
74
36
|
return {
|
|
75
37
|
request: {
|
|
76
|
-
url
|
|
77
|
-
method
|
|
38
|
+
url,
|
|
39
|
+
method,
|
|
78
40
|
headers: requestHeaders,
|
|
79
41
|
body: requestBody,
|
|
80
42
|
},
|
|
@@ -84,25 +46,25 @@ function buildApiErrorInitObject(method, url, requestHeaders, requestBody, respo
|
|
|
84
46
|
headers: headersToObject(response.headers),
|
|
85
47
|
body: responseBody,
|
|
86
48
|
},
|
|
87
|
-
preCallStack
|
|
49
|
+
preCallStack,
|
|
88
50
|
};
|
|
89
51
|
}
|
|
90
52
|
function buildTimeoutErrorInitObject(method, url, requestHeaders, requestBody, preCallStack) {
|
|
91
53
|
return {
|
|
92
54
|
request: {
|
|
93
|
-
url
|
|
94
|
-
method
|
|
55
|
+
url,
|
|
56
|
+
method,
|
|
95
57
|
headers: requestHeaders,
|
|
96
58
|
body: requestBody,
|
|
97
59
|
},
|
|
98
|
-
preCallStack
|
|
60
|
+
preCallStack,
|
|
99
61
|
};
|
|
100
62
|
}
|
|
101
63
|
function buildApiErrorInitObjectFromJobResult(method, url, requestHeaders, requestBody, responseStatus, responseBody, preCallStack) {
|
|
102
64
|
return {
|
|
103
65
|
request: {
|
|
104
|
-
url
|
|
105
|
-
method
|
|
66
|
+
url,
|
|
67
|
+
method,
|
|
106
68
|
headers: requestHeaders,
|
|
107
69
|
body: requestBody,
|
|
108
70
|
},
|
|
@@ -112,21 +74,18 @@ function buildApiErrorInitObjectFromJobResult(method, url, requestHeaders, reque
|
|
|
112
74
|
headers: {},
|
|
113
75
|
body: responseBody,
|
|
114
76
|
},
|
|
115
|
-
preCallStack
|
|
77
|
+
preCallStack,
|
|
116
78
|
};
|
|
117
79
|
}
|
|
118
80
|
function isErrorWithCode(error) {
|
|
119
81
|
return typeof error === 'object' && !!error && 'code' in error;
|
|
120
82
|
}
|
|
121
83
|
function lowercaseKeys(obj) {
|
|
122
|
-
return Object.fromEntries(Object.entries(obj).map(
|
|
123
|
-
var k = _a[0], v = _a[1];
|
|
124
|
-
return [k.toLowerCase(), v];
|
|
125
|
-
}));
|
|
84
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k.toLowerCase(), v]));
|
|
126
85
|
}
|
|
127
|
-
|
|
86
|
+
let requestCount = 1;
|
|
128
87
|
export function getFetchFn(customFetchFn) {
|
|
129
|
-
|
|
88
|
+
const fetchFn = customFetchFn ||
|
|
130
89
|
(typeof fetch === 'undefined' ? undefined : fetch) ||
|
|
131
90
|
(typeof globalThis === 'undefined' ? undefined : globalThis.fetch);
|
|
132
91
|
if (typeof fetchFn === 'undefined') {
|
|
@@ -136,152 +95,126 @@ export function getFetchFn(customFetchFn) {
|
|
|
136
95
|
}
|
|
137
96
|
export function request(options) {
|
|
138
97
|
var _a;
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (!autoRetry || (invalidContentType && options.method !== 'GET')) {
|
|
195
|
-
throw new ApiError(buildApiErrorInitObject(options.method, url, headers, options.body, response, undefined, preCallStack));
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const requestId = requestCount;
|
|
100
|
+
requestCount += 1;
|
|
101
|
+
const fetchFn = getFetchFn(options.fetchFn);
|
|
102
|
+
const preCallStack = options.preCallStack;
|
|
103
|
+
const userAgent = options.userAgent || '@datocms/rest-client-utils';
|
|
104
|
+
const retryCount = options.retryCount || 1;
|
|
105
|
+
const logLevel = options.logLevel || LogLevel.NONE;
|
|
106
|
+
const autoRetry = 'autoRetry' in options ? options.autoRetry : true;
|
|
107
|
+
const log = options.logFn || (() => true);
|
|
108
|
+
const headers = Object.assign({ 'content-type': 'application/json', accept: 'application/json', authorization: `Bearer ${options.apiToken}`, 'user-agent': userAgent }, (options.extraHeaders ? lowercaseKeys(options.extraHeaders) : {}));
|
|
109
|
+
if (isBrowser) {
|
|
110
|
+
// user agent cannot be set on browser
|
|
111
|
+
delete headers['user-agent'];
|
|
112
|
+
}
|
|
113
|
+
const baseUrl = options.baseUrl.replace(/\/$/, '');
|
|
114
|
+
const body = options.body ? JSON.stringify(options.body, null, 2) : undefined;
|
|
115
|
+
const queryString = options.queryParams && Object.keys(options.queryParams).length > 0
|
|
116
|
+
? `?${new URLSearchParams(buildNormalizedParams(options.queryParams)).toString()}`
|
|
117
|
+
: '';
|
|
118
|
+
const url = `${baseUrl}${options.url}${queryString}`;
|
|
119
|
+
if (logLevel >= LogLevel.BASIC) {
|
|
120
|
+
log(`[${requestId}] ${options.method} ${url}`);
|
|
121
|
+
if (logLevel >= LogLevel.BODY_AND_HEADERS) {
|
|
122
|
+
for (const [key, value] of Object.entries(headers || {})) {
|
|
123
|
+
log(`[${requestId}] ${key}: ${value}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (logLevel >= LogLevel.BODY && body) {
|
|
127
|
+
log(`[${requestId}] ${body}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
const requestPromise = makeCancelablePromise(fetchFn(url, {
|
|
132
|
+
method: options.method,
|
|
133
|
+
headers,
|
|
134
|
+
body,
|
|
135
|
+
}));
|
|
136
|
+
const timeoutId = setTimeout(() => {
|
|
137
|
+
requestPromise.cancel();
|
|
138
|
+
}, options.requestTimeout || 30000);
|
|
139
|
+
const response = yield requestPromise;
|
|
140
|
+
clearTimeout(timeoutId);
|
|
141
|
+
const responseContentType = response.headers.get('Content-Type');
|
|
142
|
+
const invalidContentType = responseContentType && !responseContentType.includes('application/json');
|
|
143
|
+
if (response.status === 429 || invalidContentType) {
|
|
144
|
+
if (!autoRetry || (invalidContentType && options.method !== 'GET')) {
|
|
145
|
+
throw new ApiError(buildApiErrorInitObject(options.method, url, headers, options.body, response, undefined, preCallStack));
|
|
146
|
+
}
|
|
147
|
+
const waitTimeInSecs = response.headers.has('X-RateLimit-Reset')
|
|
148
|
+
? Number.parseInt(response.headers.get('X-RateLimit-Reset'), 10)
|
|
149
|
+
: retryCount;
|
|
150
|
+
if (logLevel >= LogLevel.BASIC) {
|
|
151
|
+
if (response.status === 429) {
|
|
152
|
+
log(`[${requestId}] Rate limit exceeded, wait ${waitTimeInSecs} seconds then retry...`);
|
|
196
153
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
: retryCount;
|
|
200
|
-
if (logLevel >= LogLevel.BASIC) {
|
|
201
|
-
if (response.status === 429) {
|
|
202
|
-
log("[".concat(requestId, "] Rate limit exceeded, wait ").concat(waitTimeInSecs, " seconds then retry..."));
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
log("[".concat(requestId, "] Invalid response content type \"").concat(responseContentType, "\" (status ").concat(response.status, "). Wait ").concat(waitTimeInSecs, " seconds then retry..."));
|
|
206
|
-
}
|
|
154
|
+
else {
|
|
155
|
+
log(`[${requestId}] Invalid response content type "${responseContentType}" (status ${response.status}). Wait ${waitTimeInSecs} seconds then retry...`);
|
|
207
156
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (value) {
|
|
227
|
-
log("[".concat(requestId, "] ").concat(key, ": ").concat(value));
|
|
228
|
-
}
|
|
229
|
-
}
|
|
157
|
+
}
|
|
158
|
+
yield wait(waitTimeInSecs * 1000);
|
|
159
|
+
return request(Object.assign(Object.assign({}, options), { retryCount: retryCount + 1 }));
|
|
160
|
+
}
|
|
161
|
+
if (logLevel >= LogLevel.BASIC) {
|
|
162
|
+
log(`[${requestId}] Status: ${response.status} (${response.statusText})`);
|
|
163
|
+
if (logLevel >= LogLevel.BODY_AND_HEADERS) {
|
|
164
|
+
for (const key of [
|
|
165
|
+
'x-api-version',
|
|
166
|
+
'x-environment',
|
|
167
|
+
'x-queue-time',
|
|
168
|
+
'x-ratelimit-remaining',
|
|
169
|
+
'x-request-id',
|
|
170
|
+
'cf-ray',
|
|
171
|
+
]) {
|
|
172
|
+
const value = response.headers.get(key);
|
|
173
|
+
if (value) {
|
|
174
|
+
log(`[${requestId}] ${key}: ${value}`);
|
|
230
175
|
}
|
|
231
176
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return [4 /*yield*/, wait(retryCount * 1000)];
|
|
264
|
-
case 10:
|
|
265
|
-
_g.sent();
|
|
266
|
-
return [2 /*return*/, request(__assign(__assign({}, options), { retryCount: retryCount + 1 }))];
|
|
267
|
-
case 11: throw error;
|
|
268
|
-
case 12:
|
|
269
|
-
error_1 = _g.sent();
|
|
270
|
-
if (!(error_1 instanceof CanceledPromiseError ||
|
|
271
|
-
(isErrorWithCode(error_1) && error_1.code.includes('ETIMEDOUT')))) return [3 /*break*/, 15];
|
|
272
|
-
if (!(autoRetry && retryCount < MAX_RETRY_COUNT_ON_TIMEOUT_ERROR)) return [3 /*break*/, 14];
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
let responseBody = response.status === 204 ? undefined : yield response.json();
|
|
180
|
+
if (logLevel >= LogLevel.BODY && responseBody) {
|
|
181
|
+
log(`[${requestId}] ${JSON.stringify(responseBody, null, 2)}`);
|
|
182
|
+
}
|
|
183
|
+
if (response.status === 202) {
|
|
184
|
+
const jobResult = yield options.fetchJobResult(responseBody.data.id);
|
|
185
|
+
if (jobResult.status < 200 || jobResult.status >= 300) {
|
|
186
|
+
throw new ApiError(buildApiErrorInitObjectFromJobResult(options.method, url, headers, options.body, jobResult.status, jobResult.payload, preCallStack));
|
|
187
|
+
}
|
|
188
|
+
responseBody = jobResult.payload;
|
|
189
|
+
}
|
|
190
|
+
if (response.status >= 200 && response.status < 300) {
|
|
191
|
+
return responseBody;
|
|
192
|
+
}
|
|
193
|
+
const error = new ApiError(buildApiErrorInitObject(options.method, url, headers, options.body, response, responseBody, preCallStack));
|
|
194
|
+
const transientErrorCode = (_a = error.errors.find((e) => e.attributes.transient)) === null || _a === void 0 ? void 0 : _a.attributes.code;
|
|
195
|
+
if (autoRetry && transientErrorCode) {
|
|
196
|
+
if (logLevel >= LogLevel.BASIC) {
|
|
197
|
+
log(`[${requestId}] ${transientErrorCode}, wait ${retryCount} seconds then retry...`);
|
|
198
|
+
}
|
|
199
|
+
yield wait(retryCount * 1000);
|
|
200
|
+
return request(Object.assign(Object.assign({}, options), { retryCount: retryCount + 1 }));
|
|
201
|
+
}
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (error instanceof CanceledPromiseError ||
|
|
206
|
+
(isErrorWithCode(error) && error.code.includes('ETIMEDOUT'))) {
|
|
207
|
+
if (autoRetry && retryCount < MAX_RETRY_COUNT_ON_TIMEOUT_ERROR) {
|
|
273
208
|
if (logLevel >= LogLevel.BASIC) {
|
|
274
|
-
log(
|
|
209
|
+
log(`[${requestId}] Timeout error, wait ${retryCount} seconds then retry...`);
|
|
275
210
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
case 14: throw new TimeoutError(buildTimeoutErrorInitObject(options.method, url, headers, options.body, preCallStack));
|
|
281
|
-
case 15: throw error_1;
|
|
282
|
-
case 16: return [2 /*return*/];
|
|
211
|
+
yield wait(retryCount * 1000);
|
|
212
|
+
return request(Object.assign(Object.assign({}, options), { retryCount: retryCount + 1 }));
|
|
213
|
+
}
|
|
214
|
+
throw new TimeoutError(buildTimeoutErrorInitObject(options.method, url, headers, options.body, preCallStack));
|
|
283
215
|
}
|
|
284
|
-
|
|
216
|
+
throw error;
|
|
217
|
+
}
|
|
285
218
|
});
|
|
286
219
|
}
|
|
287
220
|
//# sourceMappingURL=request.js.map
|
package/dist/esm/request.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,2BAA2B
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/request.ts"],"names":[],"mappings":"AAAA,2BAA2B;;;;;;;;;;AAE3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,QAAQ,EAER,YAAY,GAEb,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAE1E,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAE3C,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,iBAAiB;IACjB,uCAAQ,CAAA;IACR,8DAA8D;IAC9D,yCAAS,CAAA;IACT,0EAA0E;IAC1E,uCAAQ,CAAA;IACR,4FAA4F;IAC5F,+DAAoB,CAAA;AACtB,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB;AA8BD,SAAS,eAAe,CAAC,OAAgB;IACvC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,uBAAuB,CAC9B,MAAc,EACd,GAAW,EACX,cAAsC,EACtC,WAAoB,EACpB,QAAkB,EAClB,YAAqB,EACrB,YAAqB;IAErB,OAAO;QACL,OAAO,EAAE;YACP,GAAG;YACH,MAAM;YACN,OAAO,EAAE,cAAc;YACvB,IAAI,EAAE,WAAW;SAClB;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,QAAQ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BAAoB;gBACrC,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,EAC5D;gBACA,IAAI,SAAS,IAAI,UAAU,GAAG,gCAAgC,EAAE;oBAC9D,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE;wBAC9B,GAAG,CACD,IAAI,SAAS,yBAAyB,UAAU,wBAAwB,CACzE,CAAC;qBACH;oBAED,MAAM,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;oBAE9B,OAAO,OAAO,iCAAM,OAAO,KAAE,UAAU,EAAE,UAAU,GAAG,CAAC,IAAG,CAAC;iBAC5D;gBAED,MAAM,IAAI,YAAY,CACpB,2BAA2B,CACzB,OAAO,CAAC,MAAM,EACd,GAAG,EACH,OAAO,EACP,OAAO,CAAC,IAAI,EACZ,YAAY,CACb,CACF,CAAC;aACH;YAED,MAAM,KAAK,CAAC;SACb;;CACF"}
|
package/dist/esm/serialize.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
2
|
var t = {};
|
|
14
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -32,26 +21,22 @@ export function serializeRequestBody(body, options) {
|
|
|
32
21
|
}
|
|
33
22
|
if (Array.isArray(body)) {
|
|
34
23
|
return {
|
|
35
|
-
data: body.map(
|
|
24
|
+
data: body.map((entity) => { var _a; return (_a = serializeRequestBody(entity, options)) === null || _a === void 0 ? void 0 : _a.data; }),
|
|
36
25
|
};
|
|
37
26
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
const _a = body, { id, type: typeInBody, meta } = _a, otherProperties = __rest(_a, ["id", "type", "meta"]);
|
|
28
|
+
const attributes = {};
|
|
29
|
+
const relationships = {};
|
|
41
30
|
if (options.attributes === '*') {
|
|
42
|
-
for (
|
|
43
|
-
var _c = _b[_i], key = _c[0], value = _c[1];
|
|
31
|
+
for (const [key, value] of Object.entries(otherProperties)) {
|
|
44
32
|
if (options.relationships.includes(key)) {
|
|
45
33
|
if (isRel(value)) {
|
|
46
|
-
|
|
47
|
-
relationships[key] = { data: { id
|
|
34
|
+
const { id, type } = value;
|
|
35
|
+
relationships[key] = { data: { id, type } };
|
|
48
36
|
}
|
|
49
37
|
else if (isRelArray(value)) {
|
|
50
38
|
relationships[key] = {
|
|
51
|
-
data: value.map(
|
|
52
|
-
var id = _a.id, type = _a.type;
|
|
53
|
-
return ({ id: id, type: type });
|
|
54
|
-
}),
|
|
39
|
+
data: value.map(({ id, type }) => ({ id, type })),
|
|
55
40
|
};
|
|
56
41
|
}
|
|
57
42
|
else {
|
|
@@ -66,22 +51,18 @@ export function serializeRequestBody(body, options) {
|
|
|
66
51
|
}
|
|
67
52
|
}
|
|
68
53
|
else if (options.relationships === '*') {
|
|
69
|
-
for (
|
|
70
|
-
var _f = _e[_d], key = _f[0], value = _f[1];
|
|
54
|
+
for (const [key, value] of Object.entries(otherProperties)) {
|
|
71
55
|
if (options.attributes.includes(key)) {
|
|
72
56
|
attributes[key] = value;
|
|
73
57
|
}
|
|
74
58
|
else {
|
|
75
59
|
if (isRel(value)) {
|
|
76
|
-
|
|
77
|
-
relationships[key] = { data: { id
|
|
60
|
+
const { id, type } = value;
|
|
61
|
+
relationships[key] = { data: { id, type } };
|
|
78
62
|
}
|
|
79
63
|
else if (isRelArray(value)) {
|
|
80
64
|
relationships[key] = {
|
|
81
|
-
data: value.map(
|
|
82
|
-
var id = _a.id, type = _a.type;
|
|
83
|
-
return ({ id: id, type: type });
|
|
84
|
-
}),
|
|
65
|
+
data: value.map(({ id, type }) => ({ id, type })),
|
|
85
66
|
};
|
|
86
67
|
}
|
|
87
68
|
else {
|
|
@@ -93,22 +74,18 @@ export function serializeRequestBody(body, options) {
|
|
|
93
74
|
}
|
|
94
75
|
}
|
|
95
76
|
else {
|
|
96
|
-
for (
|
|
97
|
-
var _j = _h[_g], key = _j[0], value = _j[1];
|
|
77
|
+
for (const [key, value] of Object.entries(otherProperties)) {
|
|
98
78
|
if (options.attributes.includes(key)) {
|
|
99
79
|
attributes[key] = value;
|
|
100
80
|
}
|
|
101
81
|
else if (options.relationships.includes(key)) {
|
|
102
82
|
if (isRel(value)) {
|
|
103
|
-
|
|
104
|
-
relationships[key] = { data: { id
|
|
83
|
+
const { id, type } = value;
|
|
84
|
+
relationships[key] = { data: { id, type } };
|
|
105
85
|
}
|
|
106
86
|
else if (isRelArray(value)) {
|
|
107
87
|
relationships[key] = {
|
|
108
|
-
data: value.map(
|
|
109
|
-
var id = _a.id, type = _a.type;
|
|
110
|
-
return ({ id: id, type: type });
|
|
111
|
-
}),
|
|
88
|
+
data: value.map(({ id, type }) => ({ id, type })),
|
|
112
89
|
};
|
|
113
90
|
}
|
|
114
91
|
else {
|
|
@@ -125,7 +102,7 @@ export function serializeRequestBody(body, options) {
|
|
|
125
102
|
}
|
|
126
103
|
}
|
|
127
104
|
return {
|
|
128
|
-
data:
|
|
105
|
+
data: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (id || options.id ? { id: id || options.id } : {})), { type: options.type }), (Object.keys(attributes).length > 0 ? { attributes } : {})), (Object.keys(relationships).length > 0 ? { relationships } : {})), (meta ? { meta } : {})),
|
|
129
106
|
};
|
|
130
107
|
}
|
|
131
108
|
//# sourceMappingURL=serialize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/serialize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/serialize.ts"],"names":[],"mappings":";;;;;;;;;;;AAyBA,SAAS,KAAK,CAAC,MAAe;IAC5B,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAC7E,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,MAAe;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,OAAgB;IAEhB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;KAClC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,GAAG,CACZ,CAAC,MAAM,EAAE,EAAE,WAAC,OAAA,MAAA,oBAAoB,CAAI,MAAM,EAAE,OAAO,CAAC,0CAAE,IAAI,CAAA,EAAA,CAC3D;SACc,CAAC;KACnB;IAED,MAAM,KAAqD,IAAW,EAAhE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,OAAoC,EAA/B,eAAe,cAAhD,sBAAkD,CAAc,CAAC;IAEvE,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,MAAM,aAAa,GAA4B,EAAE,CAAC;IAElD,IAAI,OAAO,CAAC,UAAU,KAAK,GAAG,EAAE;QAC9B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;YAC1D,IAAI,OAAO,CAAC,a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I,GAAG,UAAU,CAAC;SAC9B;KACF;IAED,OAAO;QACL,IAAI,4EACC,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACrD,IAAI,EAAE,OAAO,CAAC,IAAI,KACf,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAC1D,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAChE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC1B;KACc,CAAC;AACpB,CAAC"}
|
package/dist/esm/wait.js
CHANGED
package/dist/esm/wait.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait.js","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,OAAO,IAAI,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"wait.js","sourceRoot":"","sources":["../../src/wait.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|