@airweave/sdk 0.3.46 → 0.3.47
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/Client.js +2 -2
- package/dist/cjs/api/resources/whiteLabels/client/Client.d.ts +4 -4
- package/dist/cjs/api/resources/whiteLabels/client/Client.js +5 -5
- package/dist/cjs/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.d.ts → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.d.ts} +1 -1
- package/dist/cjs/api/resources/whiteLabels/client/requests/index.d.ts +1 -1
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +7 -4
- package/dist/cjs/core/fetcher/BinaryResponse.js +5 -2
- package/dist/cjs/core/fetcher/Fetcher.js +3 -3
- package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
- package/dist/cjs/core/fetcher/getErrorResponseBody.js +44 -0
- package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -4
- package/dist/cjs/core/fetcher/getFetchFn.js +1 -52
- package/dist/cjs/core/fetcher/getResponseBody.js +3 -3
- package/dist/cjs/core/url/join.js +23 -3
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/whiteLabels/client/Client.d.mts +4 -4
- package/dist/esm/api/resources/whiteLabels/client/Client.mjs +5 -5
- package/dist/esm/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.d.mts → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.d.mts} +1 -1
- package/dist/esm/api/resources/whiteLabels/client/requests/index.d.mts +1 -1
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +7 -4
- package/dist/esm/core/fetcher/BinaryResponse.mjs +5 -2
- package/dist/esm/core/fetcher/Fetcher.mjs +3 -3
- package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
- package/dist/esm/core/fetcher/getErrorResponseBody.mjs +41 -0
- package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -4
- package/dist/esm/core/fetcher/getFetchFn.mjs +1 -19
- package/dist/esm/core/fetcher/getResponseBody.mjs +3 -3
- package/dist/esm/core/url/join.mjs +23 -3
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +14 -16
- package/reference.md +3 -3
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
- package/dist/cjs/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -247
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
- package/dist/cjs/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -126
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
- package/dist/cjs/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -229
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
- package/dist/cjs/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -59
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.mts +0 -30
- package/dist/esm/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.mjs +0 -243
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.mts +0 -21
- package/dist/esm/core/fetcher/stream-wrappers/NodePre18StreamWrapper.mjs +0 -122
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.mts +0 -31
- package/dist/esm/core/fetcher/stream-wrappers/UndiciStreamWrapper.mjs +0 -225
- package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.d.mts +0 -18
- package/dist/esm/core/fetcher/stream-wrappers/chooseStreamWrapper.mjs +0 -23
- /package/dist/cjs/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.js → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.js} +0 -0
- /package/dist/esm/api/resources/whiteLabels/client/requests/{BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodePost.mjs → BodyExchangeWhiteLabelOauth2CodeWhiteLabelsWhiteLabelIdOauth2CodeOptions.mjs} +0 -0
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
11
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
12
|
-
var m = o[Symbol.asyncIterator], i;
|
|
13
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
14
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
15
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
16
|
-
};
|
|
17
|
-
export class NodePre18StreamWrapper {
|
|
18
|
-
constructor(readableStream) {
|
|
19
|
-
this.readableStream = readableStream;
|
|
20
|
-
}
|
|
21
|
-
on(event, callback) {
|
|
22
|
-
this.readableStream.on(event, callback);
|
|
23
|
-
}
|
|
24
|
-
off(event, callback) {
|
|
25
|
-
this.readableStream.off(event, callback);
|
|
26
|
-
}
|
|
27
|
-
pipe(dest) {
|
|
28
|
-
this.readableStream.pipe(dest);
|
|
29
|
-
return dest;
|
|
30
|
-
}
|
|
31
|
-
pipeTo(dest) {
|
|
32
|
-
return this.pipe(dest);
|
|
33
|
-
}
|
|
34
|
-
unpipe(dest) {
|
|
35
|
-
if (dest) {
|
|
36
|
-
this.readableStream.unpipe(dest);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.readableStream.unpipe();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
destroy(error) {
|
|
43
|
-
this.readableStream.destroy(error);
|
|
44
|
-
}
|
|
45
|
-
pause() {
|
|
46
|
-
this.readableStream.pause();
|
|
47
|
-
}
|
|
48
|
-
resume() {
|
|
49
|
-
this.readableStream.resume();
|
|
50
|
-
}
|
|
51
|
-
get isPaused() {
|
|
52
|
-
return this.readableStream.isPaused();
|
|
53
|
-
}
|
|
54
|
-
read() {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
const chunk = this.readableStream.read();
|
|
58
|
-
if (chunk) {
|
|
59
|
-
resolve(chunk);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
this.readableStream.once("readable", () => {
|
|
63
|
-
const chunk = this.readableStream.read();
|
|
64
|
-
resolve(chunk);
|
|
65
|
-
});
|
|
66
|
-
this.readableStream.once("error", reject);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
setEncoding(encoding) {
|
|
72
|
-
this.readableStream.setEncoding(encoding);
|
|
73
|
-
this.encoding = encoding;
|
|
74
|
-
}
|
|
75
|
-
text() {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
var _a, e_1, _b, _c;
|
|
78
|
-
const chunks = [];
|
|
79
|
-
const encoder = new TextEncoder();
|
|
80
|
-
this.readableStream.setEncoding((this.encoding || "utf-8"));
|
|
81
|
-
try {
|
|
82
|
-
for (var _d = true, _e = __asyncValues(this.readableStream), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
83
|
-
_c = _f.value;
|
|
84
|
-
_d = false;
|
|
85
|
-
const chunk = _c;
|
|
86
|
-
chunks.push(encoder.encode(chunk));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
90
|
-
finally {
|
|
91
|
-
try {
|
|
92
|
-
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
93
|
-
}
|
|
94
|
-
finally { if (e_1) throw e_1.error; }
|
|
95
|
-
}
|
|
96
|
-
const decoder = new TextDecoder(this.encoding || "utf-8");
|
|
97
|
-
return decoder.decode(Buffer.concat(chunks));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
json() {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
const text = yield this.text();
|
|
103
|
-
return JSON.parse(text);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
[Symbol.asyncIterator]() {
|
|
107
|
-
const readableStream = this.readableStream;
|
|
108
|
-
const iterator = readableStream[Symbol.asyncIterator]();
|
|
109
|
-
// Create and return an async iterator that yields buffers
|
|
110
|
-
return {
|
|
111
|
-
next() {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
const { value, done } = yield iterator.next();
|
|
114
|
-
return { value: value, done };
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
[Symbol.asyncIterator]() {
|
|
118
|
-
return this;
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { StreamWrapper } from "./chooseStreamWrapper.mjs";
|
|
2
|
-
type EventCallback = (data?: any) => void;
|
|
3
|
-
export declare class UndiciStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>, ReadFormat> {
|
|
4
|
-
private readableStream;
|
|
5
|
-
private reader;
|
|
6
|
-
private events;
|
|
7
|
-
private paused;
|
|
8
|
-
private resumeCallback;
|
|
9
|
-
private encoding;
|
|
10
|
-
constructor(readableStream: ReadableStream<ReadFormat>);
|
|
11
|
-
on(event: string, callback: EventCallback): void;
|
|
12
|
-
off(event: string, callback: EventCallback): void;
|
|
13
|
-
pipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
|
|
14
|
-
pipeTo(dest: UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>): UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>;
|
|
15
|
-
unpipe(dest: UndiciStreamWrapper<ReadFormat> | WritableStream): void;
|
|
16
|
-
destroy(error?: Error): void;
|
|
17
|
-
pause(): void;
|
|
18
|
-
resume(): void;
|
|
19
|
-
get isPaused(): boolean;
|
|
20
|
-
read(): Promise<ReadFormat | undefined>;
|
|
21
|
-
setEncoding(encoding: string): void;
|
|
22
|
-
text(): Promise<string>;
|
|
23
|
-
json<T>(): Promise<T>;
|
|
24
|
-
private _write;
|
|
25
|
-
private _end;
|
|
26
|
-
private _error;
|
|
27
|
-
private _emit;
|
|
28
|
-
private _startReading;
|
|
29
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export class UndiciStreamWrapper {
|
|
11
|
-
constructor(readableStream) {
|
|
12
|
-
this.readableStream = readableStream;
|
|
13
|
-
this.reader = this.readableStream.getReader();
|
|
14
|
-
this.events = {
|
|
15
|
-
data: [],
|
|
16
|
-
end: [],
|
|
17
|
-
error: [],
|
|
18
|
-
readable: [],
|
|
19
|
-
close: [],
|
|
20
|
-
pause: [],
|
|
21
|
-
resume: [],
|
|
22
|
-
};
|
|
23
|
-
this.paused = false;
|
|
24
|
-
this.resumeCallback = null;
|
|
25
|
-
this.encoding = null;
|
|
26
|
-
}
|
|
27
|
-
on(event, callback) {
|
|
28
|
-
var _a;
|
|
29
|
-
(_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.push(callback);
|
|
30
|
-
}
|
|
31
|
-
off(event, callback) {
|
|
32
|
-
var _a;
|
|
33
|
-
this.events[event] = (_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.filter((cb) => cb !== callback);
|
|
34
|
-
}
|
|
35
|
-
pipe(dest) {
|
|
36
|
-
this.on("data", (chunk) => {
|
|
37
|
-
if (dest instanceof UndiciStreamWrapper) {
|
|
38
|
-
dest._write(chunk);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const writer = dest.getWriter();
|
|
42
|
-
writer.write(chunk).then(() => writer.releaseLock());
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
this.on("end", () => {
|
|
46
|
-
if (dest instanceof UndiciStreamWrapper) {
|
|
47
|
-
dest._end();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const writer = dest.getWriter();
|
|
51
|
-
writer.close();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this.on("error", (error) => {
|
|
55
|
-
if (dest instanceof UndiciStreamWrapper) {
|
|
56
|
-
dest._error(error);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const writer = dest.getWriter();
|
|
60
|
-
writer.abort(error);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
this._startReading();
|
|
64
|
-
return dest;
|
|
65
|
-
}
|
|
66
|
-
pipeTo(dest) {
|
|
67
|
-
return this.pipe(dest);
|
|
68
|
-
}
|
|
69
|
-
unpipe(dest) {
|
|
70
|
-
this.off("data", (chunk) => {
|
|
71
|
-
if (dest instanceof UndiciStreamWrapper) {
|
|
72
|
-
dest._write(chunk);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const writer = dest.getWriter();
|
|
76
|
-
writer.write(chunk).then(() => writer.releaseLock());
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
this.off("end", () => {
|
|
80
|
-
if (dest instanceof UndiciStreamWrapper) {
|
|
81
|
-
dest._end();
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const writer = dest.getWriter();
|
|
85
|
-
writer.close();
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
this.off("error", (error) => {
|
|
89
|
-
if (dest instanceof UndiciStreamWrapper) {
|
|
90
|
-
dest._error(error);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
const writer = dest.getWriter();
|
|
94
|
-
writer.abort(error);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
destroy(error) {
|
|
99
|
-
this.reader
|
|
100
|
-
.cancel(error)
|
|
101
|
-
.then(() => {
|
|
102
|
-
this._emit("close");
|
|
103
|
-
})
|
|
104
|
-
.catch((err) => {
|
|
105
|
-
this._emit("error", err);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
pause() {
|
|
109
|
-
this.paused = true;
|
|
110
|
-
this._emit("pause");
|
|
111
|
-
}
|
|
112
|
-
resume() {
|
|
113
|
-
if (this.paused) {
|
|
114
|
-
this.paused = false;
|
|
115
|
-
this._emit("resume");
|
|
116
|
-
if (this.resumeCallback) {
|
|
117
|
-
this.resumeCallback();
|
|
118
|
-
this.resumeCallback = null;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
get isPaused() {
|
|
123
|
-
return this.paused;
|
|
124
|
-
}
|
|
125
|
-
read() {
|
|
126
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
if (this.paused) {
|
|
128
|
-
yield new Promise((resolve) => {
|
|
129
|
-
this.resumeCallback = resolve;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
const { done, value } = yield this.reader.read();
|
|
133
|
-
if (done) {
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
return value;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
setEncoding(encoding) {
|
|
140
|
-
this.encoding = encoding;
|
|
141
|
-
}
|
|
142
|
-
text() {
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const chunks = [];
|
|
145
|
-
while (true) {
|
|
146
|
-
const { done, value } = yield this.reader.read();
|
|
147
|
-
if (done) {
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
if (value) {
|
|
151
|
-
chunks.push(value);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
const decoder = new TextDecoder(this.encoding || "utf-8");
|
|
155
|
-
return decoder.decode(yield new Blob(chunks).arrayBuffer());
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
json() {
|
|
159
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
-
const text = yield this.text();
|
|
161
|
-
return JSON.parse(text);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
_write(chunk) {
|
|
165
|
-
this._emit("data", chunk);
|
|
166
|
-
}
|
|
167
|
-
_end() {
|
|
168
|
-
this._emit("end");
|
|
169
|
-
}
|
|
170
|
-
_error(error) {
|
|
171
|
-
this._emit("error", error);
|
|
172
|
-
}
|
|
173
|
-
_emit(event, data) {
|
|
174
|
-
if (this.events[event]) {
|
|
175
|
-
for (const callback of this.events[event] || []) {
|
|
176
|
-
callback(data);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
_startReading() {
|
|
181
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
-
try {
|
|
183
|
-
this._emit("readable");
|
|
184
|
-
while (true) {
|
|
185
|
-
if (this.paused) {
|
|
186
|
-
yield new Promise((resolve) => {
|
|
187
|
-
this.resumeCallback = resolve;
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
const { done, value } = yield this.reader.read();
|
|
191
|
-
if (done) {
|
|
192
|
-
this._emit("end");
|
|
193
|
-
this._emit("close");
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
if (value) {
|
|
197
|
-
this._emit("data", value);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
catch (error) {
|
|
202
|
-
this._emit("error", error);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
[Symbol.asyncIterator]() {
|
|
207
|
-
return {
|
|
208
|
-
next: () => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
-
if (this.paused) {
|
|
210
|
-
yield new Promise((resolve) => {
|
|
211
|
-
this.resumeCallback = resolve;
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
const { done, value } = yield this.reader.read();
|
|
215
|
-
if (done) {
|
|
216
|
-
return { done: true, value: undefined };
|
|
217
|
-
}
|
|
218
|
-
return { done: false, value };
|
|
219
|
-
}),
|
|
220
|
-
[Symbol.asyncIterator]() {
|
|
221
|
-
return this;
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type EventCallback = (data?: any) => void;
|
|
2
|
-
export interface StreamWrapper<WritableStream, ReadFormat> {
|
|
3
|
-
setEncoding(encoding?: string): void;
|
|
4
|
-
on(event: string, callback: EventCallback): void;
|
|
5
|
-
off(event: string, callback: EventCallback): void;
|
|
6
|
-
pipe(dest: WritableStream): WritableStream;
|
|
7
|
-
pipeTo(dest: WritableStream): WritableStream;
|
|
8
|
-
unpipe(dest?: WritableStream): void;
|
|
9
|
-
destroy(error?: Error): void;
|
|
10
|
-
pause(): void;
|
|
11
|
-
resume(): void;
|
|
12
|
-
get isPaused(): boolean;
|
|
13
|
-
read(): Promise<ReadFormat | undefined>;
|
|
14
|
-
text(): Promise<string>;
|
|
15
|
-
json<T>(): Promise<T>;
|
|
16
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
|
|
17
|
-
}
|
|
18
|
-
export declare function chooseStreamWrapper(responseBody: any): Promise<Promise<StreamWrapper<any, any>>>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { RUNTIME } from "../../runtime/index.mjs";
|
|
11
|
-
export function chooseStreamWrapper(responseBody) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) {
|
|
14
|
-
return new (yield import("./Node18UniversalStreamWrapper.mjs")).Node18UniversalStreamWrapper(responseBody);
|
|
15
|
-
}
|
|
16
|
-
else if (RUNTIME.type !== "node" && typeof fetch === "function") {
|
|
17
|
-
return new (yield import("./UndiciStreamWrapper.mjs")).UndiciStreamWrapper(responseBody);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return new (yield import("./NodePre18StreamWrapper.mjs")).NodePre18StreamWrapper(responseBody);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
File without changes
|