@tstdl/base 0.78.0-beta62 → 0.78.0-beta64
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/http/client/adapters/got-http-client.adapter.js +17 -10
- package/http/client/adapters/got-http-client.adapter.js.map +1 -1
- package/http/client/adapters/undici-http-client.adapter.d.ts +1 -2
- package/http/client/adapters/undici-http-client.adapter.js +1 -6
- package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
- package/http/client/http-client-request.d.ts +8 -9
- package/http/client/http-client-request.js +0 -2
- package/http/client/http-client-request.js.map +1 -1
- package/http/client/http-client-response.d.ts +8 -7
- package/http/client/http-client-response.js +2 -1
- package/http/client/http-client-response.js.map +1 -1
- package/http/client/http-client.adapter.d.ts +1 -2
- package/http/client/http-client.adapter.js.map +1 -1
- package/http/client/http-client.d.ts +30 -28
- package/http/client/http-client.js +73 -50
- package/http/client/http-client.js.map +1 -1
- package/http/http-body.d.ts +18 -0
- package/http/http-body.js +52 -0
- package/http/http-body.js.map +1 -0
- package/http/http.error.d.ts +4 -1
- package/http/http.error.js +13 -10
- package/http/http.error.js.map +1 -1
- package/http/index.d.ts +2 -0
- package/http/index.js +2 -0
- package/http/index.js.map +1 -1
- package/http/types.d.ts +1 -11
- package/http/types.js +1 -2
- package/http/types.js.map +1 -1
- package/http/utils.d.ts +12 -0
- package/http/utils.js +94 -0
- package/http/utils.js.map +1 -0
- package/package.json +2 -2
- package/schema/schemas/array.d.ts +3 -3
- package/schema/schemas/array.js.map +1 -1
- package/schema/schemas/constraint.d.ts +3 -2
- package/schema/schemas/constraint.js.map +1 -1
- package/schema/schemas/defaulted.d.ts +2 -2
- package/schema/schemas/defaulted.js.map +1 -1
- package/schema/schemas/index.d.ts +0 -1
- package/schema/schemas/index.js +0 -1
- package/schema/schemas/index.js.map +1 -1
- package/schema/schemas/nullable.d.ts +2 -2
- package/schema/schemas/nullable.js.map +1 -1
- package/schema/schemas/omit.d.ts +2 -2
- package/schema/schemas/omit.js +3 -1
- package/schema/schemas/omit.js.map +1 -1
- package/schema/schemas/pick.d.ts +2 -2
- package/schema/schemas/pick.js +3 -1
- package/schema/schemas/pick.js.map +1 -1
- package/schema/schemas/record.d.ts +2 -2
- package/schema/schemas/record.js.map +1 -1
- package/schema/schemas/union.d.ts +3 -3
- package/schema/schemas/union.js.map +1 -1
- package/schema/types.d.ts +1 -1
- package/schema/types.js.map +1 -1
- package/supports.d.ts +4 -0
- package/supports.js +8 -0
- package/supports.js.map +1 -0
- package/utils/clone.js +2 -2
- package/utils/clone.js.map +1 -1
- package/utils/compression.d.ts +10 -6
- package/utils/compression.js +32 -1
- package/utils/compression.js.map +1 -1
- package/utils/encoding.d.ts +7 -0
- package/utils/encoding.js +12 -1
- package/utils/encoding.js.map +1 -1
- package/utils/helpers.js +2 -2
- package/utils/helpers.js.map +1 -1
- package/utils/stream/index.d.ts +2 -0
- package/utils/stream/index.js +2 -0
- package/utils/stream/index.js.map +1 -1
- package/utils/stream/readable-stream-adapter.d.ts +3 -0
- package/utils/stream/readable-stream-adapter.js +42 -0
- package/utils/stream/readable-stream-adapter.js.map +1 -0
- package/utils/stream/readable-stream-from-promise.d.ts +1 -0
- package/utils/stream/readable-stream-from-promise.js +12 -0
- package/utils/stream/readable-stream-from-promise.js.map +1 -0
- package/utils/stream/stream-reader.d.ts +2 -1
- package/utils/stream/stream-reader.js +4 -1
- package/utils/stream/stream-reader.js.map +1 -1
- package/utils/type-guards.d.ts +6 -0
- package/utils/type-guards.js +87 -74
- package/utils/type-guards.js.map +1 -1
- package/http/client/adapters/utils.d.ts +0 -13
- package/http/client/adapters/utils.js +0 -95
- package/http/client/adapters/utils.js.map +0 -1
- package/schema/schemas/exclude.d.ts +0 -7
- package/schema/schemas/exclude.js +0 -12
- package/schema/schemas/exclude.js.map +0 -1
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setBody = exports.getResponseJson = exports.getResponseText = exports.getResponseBuffer = exports.getResponseStream = void 0;
|
|
4
|
-
const is_async_iterable_1 = require("../../../utils/async-iterable-helpers/is-async-iterable");
|
|
5
|
-
const compression_1 = require("../../../utils/compression");
|
|
6
|
-
const encoding_1 = require("../../../utils/encoding");
|
|
7
|
-
const stream_reader_1 = require("../../../utils/stream/stream-reader");
|
|
8
|
-
const type_guards_1 = require("../../../utils/type-guards");
|
|
9
|
-
function getResponseStream(response) {
|
|
10
|
-
if (!(0, is_async_iterable_1.isAsyncIterable)(response.body)) {
|
|
11
|
-
throw new Error('http client adapter does not support streams');
|
|
12
|
-
}
|
|
13
|
-
return response.body;
|
|
14
|
-
}
|
|
15
|
-
exports.getResponseStream = getResponseStream;
|
|
16
|
-
async function getResponseBuffer(response) {
|
|
17
|
-
let uint8Array;
|
|
18
|
-
if ((0, type_guards_1.isUint8Array)(response.body)) {
|
|
19
|
-
uint8Array = response.body;
|
|
20
|
-
}
|
|
21
|
-
else if ((0, type_guards_1.isArrayBuffer)(response.body)) {
|
|
22
|
-
uint8Array = new Uint8Array(response.body);
|
|
23
|
-
}
|
|
24
|
-
else if ((0, type_guards_1.isBlob)(response.body)) {
|
|
25
|
-
const buffer = await response.body.arrayBuffer();
|
|
26
|
-
uint8Array = new Uint8Array(buffer);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
const stream = getResponseStream(response);
|
|
30
|
-
uint8Array = await (0, stream_reader_1.readBinaryStream)(stream, response.headers.contentLength);
|
|
31
|
-
}
|
|
32
|
-
if ((response.headers.contentEncoding == 'gzip') || (response.headers.contentEncoding == 'brotli') || (response.headers.contentEncoding == 'deflate')) {
|
|
33
|
-
uint8Array = await (0, compression_1.decompress)(uint8Array, response.headers.contentEncoding).toBuffer();
|
|
34
|
-
}
|
|
35
|
-
return uint8Array;
|
|
36
|
-
}
|
|
37
|
-
exports.getResponseBuffer = getResponseBuffer;
|
|
38
|
-
async function getResponseText(response) {
|
|
39
|
-
const buffer = await getResponseBuffer(response);
|
|
40
|
-
return (0, encoding_1.decodeText)(buffer, response.headers.charset);
|
|
41
|
-
}
|
|
42
|
-
exports.getResponseText = getResponseText;
|
|
43
|
-
async function getResponseJson(response) {
|
|
44
|
-
const text = await getResponseText(response);
|
|
45
|
-
return JSON.parse(text);
|
|
46
|
-
}
|
|
47
|
-
exports.getResponseJson = getResponseJson;
|
|
48
|
-
/**
|
|
49
|
-
* set body of response to correct type (modifies instance)
|
|
50
|
-
* @param response response with either stream of buffer as body
|
|
51
|
-
* @param type type to convert to
|
|
52
|
-
*/
|
|
53
|
-
// eslint-disable-next-line max-statements
|
|
54
|
-
async function setBody(response, type) {
|
|
55
|
-
switch (type) {
|
|
56
|
-
case 'auto': {
|
|
57
|
-
if (response.headers.contentType?.includes('json') == true) {
|
|
58
|
-
await setBody(response, 'json');
|
|
59
|
-
}
|
|
60
|
-
else if (response.headers.contentType?.startsWith('text') == true) {
|
|
61
|
-
await setBody(response, 'text');
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
await setBody(response, 'buffer');
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
case 'text': {
|
|
69
|
-
response.body = await getResponseText(response);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
case 'json': {
|
|
73
|
-
response.body = await getResponseJson(response);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
case 'buffer': {
|
|
77
|
-
response.body = await getResponseBuffer(response);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case 'stream': {
|
|
81
|
-
response.body = getResponseStream(response);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
case 'none': {
|
|
85
|
-
response.body = undefined;
|
|
86
|
-
response.close();
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
default: {
|
|
90
|
-
throw new Error(`unsupported responseType ${type}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.setBody = setBody;
|
|
95
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../source/http/client/adapters/utils.ts"],"names":[],"mappings":";;;AAEA,+FAAmF;AACnF,4DAAiD;AACjD,sDAA8C;AAC9C,uEAAgE;AAChE,4DAA0E;AAG1E,SAAgB,iBAAiB,CAAC,QAA4B;IAC5D,IAAI,CAAC,IAAA,mCAAe,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;KACjE;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAND,8CAMC;AAEM,KAAK,UAAU,iBAAiB,CAAC,QAA4B;IAClE,IAAI,UAAsB,CAAC;IAE3B,IAAI,IAAA,0BAAY,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC/B,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC;KAC5B;SACI,IAAI,IAAA,2BAAa,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrC,UAAU,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC5C;SACI,IAAI,IAAA,oBAAM,EAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjD,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;KACrC;SACI;QACH,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC3C,UAAU,GAAG,MAAM,IAAA,gCAAgB,EAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;KAC7E;IAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,eAAe,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ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,CAAC;YACV,QAA6C,CAAC,IAAI,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;YACtF,MAAM;SACP;QAED,KAAK,MAAM,CAAC,CAAC;YACV,QAA6C,CAAC,IAAI,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;YACtF,MAAM;SACP;QAED,KAAK,QAAQ,CAAC,CAAC;YACZ,QAA6C,CAAC,IAAI,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YACxF,MAAM;SACP;QAED,KAAK,QAAQ,CAAC,CAAC;YACZ,QAA6C,CAAC,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAClF,MAAM;SACP;QAED,KAAK,MAAM,CAAC,CAAC;YACV,QAA6C,CAAC,IAAI,GAAG,SAAS,CAAC;YAChE,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM;SACP;QAED,OAAO,CAAC,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAc,EAAE,CAAC,CAAC;SAC/D;KACF;AACH,CAAC;AA9CD,0BA8CC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OneOrMany, Record } from "../../types";
|
|
2
|
-
import type { Simplify } from 'type-fest';
|
|
3
|
-
import type { ObjectSchema } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated use {@link omit}
|
|
6
|
-
*/
|
|
7
|
-
export declare function exclude<T extends Record, K extends keyof T>(schema: ObjectSchema<T>, keys: OneOrMany<K>): ObjectSchema<Simplify<Omit<T, K>>>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exclude = void 0;
|
|
4
|
-
const omit_1 = require("./omit");
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated use {@link omit}
|
|
7
|
-
*/
|
|
8
|
-
function exclude(schema, keys) {
|
|
9
|
-
return (0, omit_1.omit)(schema, keys);
|
|
10
|
-
}
|
|
11
|
-
exports.exclude = exclude;
|
|
12
|
-
//# sourceMappingURL=exclude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../../../source/schema/schemas/exclude.ts"],"names":[],"mappings":";;;AAGA,iCAA8B;AAE9B;;GAEG;AACH,SAAgB,OAAO,CAAsC,MAAuB,EAAE,IAAkB;IACtG,OAAO,IAAA,WAAI,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC5B,CAAC;AAFD,0BAEC"}
|