@tryfinch/finch-api 3.1.0 → 3.1.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.
- package/CHANGELOG.md +42 -0
- package/_shims/fetch.js +1 -1
- package/_shims/formdata.node.d.ts +1 -0
- package/core.d.ts +14 -10
- package/core.d.ts.map +1 -1
- package/core.js +82 -66
- package/core.js.map +1 -1
- package/core.mjs +71 -25
- package/core.mjs.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.js +12 -3
- package/error.js.map +1 -1
- package/error.mjs +12 -3
- package/error.mjs.map +1 -1
- package/index.d.mts +4 -5
- package/index.d.ts +4 -5
- package/index.d.ts.map +1 -1
- package/index.js +26 -26
- package/index.js.map +1 -1
- package/index.mjs +26 -26
- package/index.mjs.map +1 -1
- package/package.json +6 -8
- package/pagination.d.ts.map +1 -1
- package/resources/account.d.ts.map +1 -1
- package/resources/ats/applications.d.ts.map +1 -1
- package/resources/ats/ats.d.ts.map +1 -1
- package/resources/ats/ats.js.map +1 -1
- package/resources/ats/candidates.d.ts.map +1 -1
- package/resources/ats/jobs.d.ts.map +1 -1
- package/resources/ats/offers.d.ts.map +1 -1
- package/resources/ats/stages.d.ts.map +1 -1
- package/resources/hris/benefits/benefits.d.ts.map +1 -1
- package/resources/hris/benefits/benefits.js.map +1 -1
- package/resources/hris/benefits/individuals.d.ts.map +1 -1
- package/resources/hris/company.d.ts.map +1 -1
- package/resources/hris/directory.d.ts.map +1 -1
- package/resources/hris/hris.d.ts.map +1 -1
- package/resources/hris/hris.js.map +1 -1
- package/resources/hris/index.d.ts.map +1 -1
- package/resources/hris/index.js +7 -7
- package/resources/hris/index.js.map +1 -1
- package/resources/hris/individuals/employment-data.d.ts.map +1 -1
- package/resources/hris/individuals/employment-data.js.map +1 -1
- package/resources/hris/individuals/individuals.d.ts.map +1 -1
- package/resources/hris/individuals/individuals.js.map +1 -1
- package/resources/hris/pay-statements.d.ts.map +1 -1
- package/resources/hris/payments.d.ts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/providers.d.ts.map +1 -1
- package/src/_shims/fetch.deno.ts +23 -0
- package/src/_shims/fetch.js +1 -1
- package/src/_shims/formdata.deno.ts +16 -0
- package/src/_shims/formdata.node.d.ts +1 -0
- package/src/core.ts +79 -26
- package/src/error.ts +11 -1
- package/src/index.ts +28 -25
- package/src/pagination.ts +2 -2
- package/src/resources/account.ts +1 -1
- package/src/resources/ats/applications.ts +1 -1
- package/src/resources/ats/ats.ts +1 -1
- package/src/resources/ats/candidates.ts +1 -1
- package/src/resources/ats/jobs.ts +1 -1
- package/src/resources/ats/offers.ts +1 -1
- package/src/resources/ats/stages.ts +1 -1
- package/src/resources/hris/benefits/benefits.ts +1 -1
- package/src/resources/hris/benefits/individuals.ts +1 -1
- package/src/resources/hris/company.ts +1 -1
- package/src/resources/hris/directory.ts +1 -1
- package/src/resources/hris/hris.ts +1 -1
- package/src/resources/hris/index.ts +2 -2
- package/src/resources/hris/individuals/employment-data.ts +1 -1
- package/src/resources/hris/individuals/individuals.ts +1 -1
- package/src/resources/hris/pay-statements.ts +1 -1
- package/src/resources/hris/payments.ts +1 -1
- package/src/resources/index.ts +1 -0
- package/src/resources/providers.ts +1 -1
- package/src/uploads.ts +11 -10
- package/src/version.ts +1 -1
- package/uploads.d.ts +5 -4
- package/uploads.d.ts.map +1 -1
- package/uploads.js +4 -4
- package/uploads.js.map +1 -1
- package/uploads.mjs +4 -4
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/src/streaming.ts +0 -274
- package/streaming.d.ts +0 -14
- package/streaming.d.ts.map +0 -1
- package/streaming.js +0 -213
- package/streaming.js.map +0 -1
- package/streaming.mjs +0 -209
- package/streaming.mjs.map +0 -1
package/uploads.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":";;;AAGA,kEAAsG;AACtG,sGAAmG;AACnG,0EAAuE;AAG9D,6FAHA,2BAAY,OAGA;AAFrB,4EAA6F;AAmDtF,MAAM,cAAc,GAAG,CAAC,KAAU,EAAyB,EAAE,CAClE,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;IAC7B,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AAJtB,QAAA,cAAc,kBAIQ;AAE5B,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE,CAC1D,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,OAAO,KAAK,CAAC,YAAY,KAAK,QAAQ;IACtC,IAAA,kBAAU,EAAC,KAAK,CAAC,CAAC;AALP,QAAA,UAAU,cAKH;AAEpB;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,KAAU,EAA+D,EAAE,CACpG,KAAK,IAAI,IAAI;IACb,OAAO,KAAK,KAAK,QAAQ;IACzB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU;IAChC,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;IACjC,OAAO,KAAK,CAAC,WAAW,KAAK,UAAU,CAAC;AAP7B,QAAA,UAAU,cAOmB;AAEnC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAuB,EAAE;IAC9D,OAAO,IAAA,kBAAU,EAAC,KAAK,CAAC,IAAI,IAAA,sBAAc,EAAC,KAAK,CAA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K,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QACxF,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACjC;SAAM,IAAI,IAAA,oBAAY,EAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAY,CAAC,CAAC;KAChC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAC/B,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;KAChF;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;KACH;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;KACH;AACH,CAAC,CAAC"}
|
package/uploads.mjs
CHANGED
|
@@ -31,7 +31,7 @@ export const isUploadable = (value) => {
|
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
34
|
-
* @param
|
|
34
|
+
* @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s
|
|
35
35
|
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
|
|
36
36
|
* @param {Object=} options additional properties
|
|
37
37
|
* @param {string=} options.type the MIME type of the content
|
|
@@ -40,6 +40,8 @@ export const isUploadable = (value) => {
|
|
|
40
40
|
*/
|
|
41
41
|
export async function toFile(value, name, options = {}) {
|
|
42
42
|
var _a, _b, _c;
|
|
43
|
+
// If it's a promise, resolve it.
|
|
44
|
+
value = await value;
|
|
43
45
|
if (isResponseLike(value)) {
|
|
44
46
|
const blob = await value.blob();
|
|
45
47
|
name ||
|
|
@@ -61,8 +63,6 @@ export async function toFile(value, name, options = {}) {
|
|
|
61
63
|
}
|
|
62
64
|
async function getBytes(value) {
|
|
63
65
|
var _a;
|
|
64
|
-
// resolve input promise or promiselike object
|
|
65
|
-
value = await value;
|
|
66
66
|
let parts = [];
|
|
67
67
|
if (
|
|
68
68
|
typeof value === 'string' ||
|
|
@@ -156,7 +156,7 @@ const addFormValue = async (form, key, value) => {
|
|
|
156
156
|
}
|
|
157
157
|
// TODO: make nested formats configurable
|
|
158
158
|
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
159
|
-
form.append(key, value);
|
|
159
|
+
form.append(key, String(value));
|
|
160
160
|
} else if (isUploadable(value)) {
|
|
161
161
|
const file = await toFile(value);
|
|
162
162
|
form.append(key, file);
|
package/uploads.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["src/uploads.ts"],"names":[],"mappings":"OAGO,EAAE,QAAQ,EAAE,IAAI,EAAmC,MAAM,qCAAqC;OAC9F,EAAE,0BAA0B,EAAE,MAAM,uDAAuD;OAC3F,EAAE,YAAY,EAAE,MAAM,yCAAyC;OAC/D,EAAqB,cAAc,EAAE,MAAM,0CAA0C;AAE5F,OAAO,EAAE,YAAY,EAAE,CAAC;AAiDxB,MAAM,CAAC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G,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;KAChF;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QACpC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;KACH;SAAM;QACL,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;KACH;AACH,CAAC,CAAC"}
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = '3.1.
|
|
1
|
+
export declare const VERSION = '3.1.3';
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.1.
|
|
1
|
+
export const VERSION = '3.1.3'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/src/streaming.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
import type { Response } from './_shims/fetch.js';
|
|
2
|
-
|
|
3
|
-
import { APIResponse, Headers, createResponseHeaders } from './core';
|
|
4
|
-
|
|
5
|
-
type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
|
|
6
|
-
|
|
7
|
-
type ServerSentEvent = {
|
|
8
|
-
event: string | null;
|
|
9
|
-
data: string;
|
|
10
|
-
raw: string[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export class Stream<Item> implements AsyncIterable<Item>, APIResponse<Stream<Item>> {
|
|
14
|
-
/** @deprecated - please use the async iterator instead. We plan to add additional helper methods shortly. */
|
|
15
|
-
response: Response;
|
|
16
|
-
/** @deprecated - we plan to add a different way to access raw response information shortly. */
|
|
17
|
-
responseHeaders: Headers;
|
|
18
|
-
controller: AbortController;
|
|
19
|
-
|
|
20
|
-
private decoder: SSEDecoder;
|
|
21
|
-
|
|
22
|
-
constructor(response: Response, controller: AbortController) {
|
|
23
|
-
this.response = response;
|
|
24
|
-
this.controller = controller;
|
|
25
|
-
this.decoder = new SSEDecoder();
|
|
26
|
-
this.responseHeaders = createResponseHeaders(response.headers);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private async *iterMessages(): AsyncGenerator<ServerSentEvent, void, unknown> {
|
|
30
|
-
if (!this.response.body) {
|
|
31
|
-
this.controller.abort();
|
|
32
|
-
throw new Error(`Attempted to iterate over a response with no body`);
|
|
33
|
-
}
|
|
34
|
-
const lineDecoder = new LineDecoder();
|
|
35
|
-
|
|
36
|
-
const iter = readableStreamAsyncIterable<Bytes>(this.response.body);
|
|
37
|
-
for await (const chunk of iter) {
|
|
38
|
-
for (const line of lineDecoder.decode(chunk)) {
|
|
39
|
-
const sse = this.decoder.decode(line);
|
|
40
|
-
if (sse) yield sse;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
for (const line of lineDecoder.flush()) {
|
|
45
|
-
const sse = this.decoder.decode(line);
|
|
46
|
-
if (sse) yield sse;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async *[Symbol.asyncIterator](): AsyncIterator<Item, any, undefined> {
|
|
51
|
-
let done = false;
|
|
52
|
-
try {
|
|
53
|
-
for await (const sse of this.iterMessages()) {
|
|
54
|
-
try {
|
|
55
|
-
yield JSON.parse(sse.data);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
console.error(`Could not parse message into JSON:`, sse.data);
|
|
58
|
-
console.error(`From chunk:`, sse.raw);
|
|
59
|
-
throw e;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
done = true;
|
|
63
|
-
} catch (e) {
|
|
64
|
-
// If the user calls `stream.controller.abort()`, we should exit without throwing.
|
|
65
|
-
if (e instanceof Error && e.name === 'AbortError') return;
|
|
66
|
-
throw e;
|
|
67
|
-
} finally {
|
|
68
|
-
// If the user `break`s, abort the ongoing request.
|
|
69
|
-
if (!done) this.controller.abort();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
class SSEDecoder {
|
|
75
|
-
private data: string[];
|
|
76
|
-
private event: string | null;
|
|
77
|
-
private chunks: string[];
|
|
78
|
-
|
|
79
|
-
constructor() {
|
|
80
|
-
this.event = null;
|
|
81
|
-
this.data = [];
|
|
82
|
-
this.chunks = [];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
decode(line: string) {
|
|
86
|
-
if (line.endsWith('\r')) {
|
|
87
|
-
line = line.substring(0, line.length - 1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (!line) {
|
|
91
|
-
// empty line and we didn't previously encounter any messages
|
|
92
|
-
if (!this.event && !this.data.length) return null;
|
|
93
|
-
|
|
94
|
-
const sse: ServerSentEvent = {
|
|
95
|
-
event: this.event,
|
|
96
|
-
data: this.data.join('\n'),
|
|
97
|
-
raw: this.chunks,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
this.event = null;
|
|
101
|
-
this.data = [];
|
|
102
|
-
this.chunks = [];
|
|
103
|
-
|
|
104
|
-
return sse;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this.chunks.push(line);
|
|
108
|
-
|
|
109
|
-
if (line.startsWith(':')) {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let [fieldname, _, value] = partition(line, ':');
|
|
114
|
-
|
|
115
|
-
if (value.startsWith(' ')) {
|
|
116
|
-
value = value.substring(1);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (fieldname === 'event') {
|
|
120
|
-
this.event = value;
|
|
121
|
-
} else if (fieldname === 'data') {
|
|
122
|
-
this.data.push(value);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
|
|
131
|
-
* reading lines from text.
|
|
132
|
-
*
|
|
133
|
-
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
|
|
134
|
-
*/
|
|
135
|
-
class LineDecoder {
|
|
136
|
-
// prettier-ignore
|
|
137
|
-
static NEWLINE_CHARS = new Set(['\n', '\r', '\x0b', '\x0c', '\x1c', '\x1d', '\x1e', '\x85', '\u2028', '\u2029']);
|
|
138
|
-
static NEWLINE_REGEXP = /\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;
|
|
139
|
-
|
|
140
|
-
buffer: string[];
|
|
141
|
-
trailingCR: boolean;
|
|
142
|
-
textDecoder: any; // TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types.
|
|
143
|
-
|
|
144
|
-
constructor() {
|
|
145
|
-
this.buffer = [];
|
|
146
|
-
this.trailingCR = false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
decode(chunk: Bytes): string[] {
|
|
150
|
-
let text = this.decodeText(chunk);
|
|
151
|
-
|
|
152
|
-
if (this.trailingCR) {
|
|
153
|
-
text = '\r' + text;
|
|
154
|
-
this.trailingCR = false;
|
|
155
|
-
}
|
|
156
|
-
if (text.endsWith('\r')) {
|
|
157
|
-
this.trailingCR = true;
|
|
158
|
-
text = text.slice(0, -1);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (!text) {
|
|
162
|
-
return [];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || '');
|
|
166
|
-
let lines = text.split(LineDecoder.NEWLINE_REGEXP);
|
|
167
|
-
|
|
168
|
-
if (lines.length === 1 && !trailingNewline) {
|
|
169
|
-
this.buffer.push(lines[0]!);
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (this.buffer.length > 0) {
|
|
174
|
-
lines = [this.buffer.join('') + lines[0], ...lines.slice(1)];
|
|
175
|
-
this.buffer = [];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (!trailingNewline) {
|
|
179
|
-
this.buffer = [lines.pop() || ''];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return lines;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
decodeText(bytes: Bytes): string {
|
|
186
|
-
if (bytes == null) return '';
|
|
187
|
-
if (typeof bytes === 'string') return bytes;
|
|
188
|
-
|
|
189
|
-
// Node:
|
|
190
|
-
if (typeof Buffer !== 'undefined') {
|
|
191
|
-
if (bytes instanceof Buffer) {
|
|
192
|
-
return bytes.toString();
|
|
193
|
-
}
|
|
194
|
-
if (bytes instanceof Uint8Array) {
|
|
195
|
-
return Buffer.from(bytes).toString();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
throw new Error(
|
|
199
|
-
`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`,
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Browser
|
|
204
|
-
if (typeof TextDecoder !== 'undefined') {
|
|
205
|
-
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
|
|
206
|
-
this.textDecoder ??= new TextDecoder('utf8');
|
|
207
|
-
return this.textDecoder.decode(bytes);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
throw new Error(
|
|
211
|
-
`Unexpected: received non-Uint8Array/ArrayBuffer (${
|
|
212
|
-
(bytes as any).constructor.name
|
|
213
|
-
}) in a web platform. Please report this error.`,
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
throw new Error(
|
|
218
|
-
`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`,
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
flush(): string[] {
|
|
223
|
-
if (!this.buffer.length && !this.trailingCR) {
|
|
224
|
-
return [];
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
const lines = [this.buffer.join('')];
|
|
228
|
-
this.buffer = [];
|
|
229
|
-
this.trailingCR = false;
|
|
230
|
-
return lines;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function partition(str: string, delimiter: string): [string, string, string] {
|
|
235
|
-
const index = str.indexOf(delimiter);
|
|
236
|
-
if (index !== -1) {
|
|
237
|
-
return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return [str, '', ''];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
245
|
-
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
246
|
-
*
|
|
247
|
-
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
248
|
-
*/
|
|
249
|
-
function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T> {
|
|
250
|
-
if (stream[Symbol.asyncIterator]) return stream;
|
|
251
|
-
|
|
252
|
-
const reader = stream.getReader();
|
|
253
|
-
return {
|
|
254
|
-
async next() {
|
|
255
|
-
try {
|
|
256
|
-
const result = await reader.read();
|
|
257
|
-
if (result?.done) reader.releaseLock(); // release lock when stream becomes closed
|
|
258
|
-
return result;
|
|
259
|
-
} catch (e) {
|
|
260
|
-
reader.releaseLock(); // release lock when stream becomes errored
|
|
261
|
-
throw e;
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
async return() {
|
|
265
|
-
const cancelPromise = reader.cancel();
|
|
266
|
-
reader.releaseLock();
|
|
267
|
-
await cancelPromise;
|
|
268
|
-
return { done: true, value: undefined };
|
|
269
|
-
},
|
|
270
|
-
[Symbol.asyncIterator]() {
|
|
271
|
-
return this;
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
}
|
package/streaming.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Response } from '@tryfinch/finch-api/_shims/fetch';
|
|
2
|
-
import { APIResponse, Headers } from './core.js';
|
|
3
|
-
export declare class Stream<Item> implements AsyncIterable<Item>, APIResponse<Stream<Item>> {
|
|
4
|
-
/** @deprecated - please use the async iterator instead. We plan to add additional helper methods shortly. */
|
|
5
|
-
response: Response;
|
|
6
|
-
/** @deprecated - we plan to add a different way to access raw response information shortly. */
|
|
7
|
-
responseHeaders: Headers;
|
|
8
|
-
controller: AbortController;
|
|
9
|
-
private decoder;
|
|
10
|
-
constructor(response: Response, controller: AbortController);
|
|
11
|
-
private iterMessages;
|
|
12
|
-
[Symbol.asyncIterator](): AsyncIterator<Item, any, undefined>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=streaming.d.ts.map
|
package/streaming.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAyB,MAAM,QAAQ,CAAC;AAUrE,qBAAa,MAAM,CAAC,IAAI,CAAE,YAAW,aAAa,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjF,6GAA6G;IAC7G,QAAQ,EAAE,QAAQ,CAAC;IACnB,+FAA+F;IAC/F,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,eAAe,CAAC;IAE5B,OAAO,CAAC,OAAO,CAAa;gBAEhB,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe;YAO5C,YAAY;IAqBpB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC;CAsBrE"}
|
package/streaming.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.Stream = void 0;
|
|
4
|
-
const core_1 = require('./core.js');
|
|
5
|
-
class Stream {
|
|
6
|
-
constructor(response, controller) {
|
|
7
|
-
this.response = response;
|
|
8
|
-
this.controller = controller;
|
|
9
|
-
this.decoder = new SSEDecoder();
|
|
10
|
-
this.responseHeaders = (0, core_1.createResponseHeaders)(response.headers);
|
|
11
|
-
}
|
|
12
|
-
async *iterMessages() {
|
|
13
|
-
if (!this.response.body) {
|
|
14
|
-
this.controller.abort();
|
|
15
|
-
throw new Error(`Attempted to iterate over a response with no body`);
|
|
16
|
-
}
|
|
17
|
-
const lineDecoder = new LineDecoder();
|
|
18
|
-
const iter = readableStreamAsyncIterable(this.response.body);
|
|
19
|
-
for await (const chunk of iter) {
|
|
20
|
-
for (const line of lineDecoder.decode(chunk)) {
|
|
21
|
-
const sse = this.decoder.decode(line);
|
|
22
|
-
if (sse) yield sse;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
for (const line of lineDecoder.flush()) {
|
|
26
|
-
const sse = this.decoder.decode(line);
|
|
27
|
-
if (sse) yield sse;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
async *[Symbol.asyncIterator]() {
|
|
31
|
-
let done = false;
|
|
32
|
-
try {
|
|
33
|
-
for await (const sse of this.iterMessages()) {
|
|
34
|
-
try {
|
|
35
|
-
yield JSON.parse(sse.data);
|
|
36
|
-
} catch (e) {
|
|
37
|
-
console.error(`Could not parse message into JSON:`, sse.data);
|
|
38
|
-
console.error(`From chunk:`, sse.raw);
|
|
39
|
-
throw e;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
done = true;
|
|
43
|
-
} catch (e) {
|
|
44
|
-
// If the user calls `stream.controller.abort()`, we should exit without throwing.
|
|
45
|
-
if (e instanceof Error && e.name === 'AbortError') return;
|
|
46
|
-
throw e;
|
|
47
|
-
} finally {
|
|
48
|
-
// If the user `break`s, abort the ongoing request.
|
|
49
|
-
if (!done) this.controller.abort();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.Stream = Stream;
|
|
54
|
-
class SSEDecoder {
|
|
55
|
-
constructor() {
|
|
56
|
-
this.event = null;
|
|
57
|
-
this.data = [];
|
|
58
|
-
this.chunks = [];
|
|
59
|
-
}
|
|
60
|
-
decode(line) {
|
|
61
|
-
if (line.endsWith('\r')) {
|
|
62
|
-
line = line.substring(0, line.length - 1);
|
|
63
|
-
}
|
|
64
|
-
if (!line) {
|
|
65
|
-
// empty line and we didn't previously encounter any messages
|
|
66
|
-
if (!this.event && !this.data.length) return null;
|
|
67
|
-
const sse = {
|
|
68
|
-
event: this.event,
|
|
69
|
-
data: this.data.join('\n'),
|
|
70
|
-
raw: this.chunks,
|
|
71
|
-
};
|
|
72
|
-
this.event = null;
|
|
73
|
-
this.data = [];
|
|
74
|
-
this.chunks = [];
|
|
75
|
-
return sse;
|
|
76
|
-
}
|
|
77
|
-
this.chunks.push(line);
|
|
78
|
-
if (line.startsWith(':')) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
let [fieldname, _, value] = partition(line, ':');
|
|
82
|
-
if (value.startsWith(' ')) {
|
|
83
|
-
value = value.substring(1);
|
|
84
|
-
}
|
|
85
|
-
if (fieldname === 'event') {
|
|
86
|
-
this.event = value;
|
|
87
|
-
} else if (fieldname === 'data') {
|
|
88
|
-
this.data.push(value);
|
|
89
|
-
}
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
|
|
95
|
-
* reading lines from text.
|
|
96
|
-
*
|
|
97
|
-
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
|
|
98
|
-
*/
|
|
99
|
-
class LineDecoder {
|
|
100
|
-
constructor() {
|
|
101
|
-
this.buffer = [];
|
|
102
|
-
this.trailingCR = false;
|
|
103
|
-
}
|
|
104
|
-
decode(chunk) {
|
|
105
|
-
let text = this.decodeText(chunk);
|
|
106
|
-
if (this.trailingCR) {
|
|
107
|
-
text = '\r' + text;
|
|
108
|
-
this.trailingCR = false;
|
|
109
|
-
}
|
|
110
|
-
if (text.endsWith('\r')) {
|
|
111
|
-
this.trailingCR = true;
|
|
112
|
-
text = text.slice(0, -1);
|
|
113
|
-
}
|
|
114
|
-
if (!text) {
|
|
115
|
-
return [];
|
|
116
|
-
}
|
|
117
|
-
const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || '');
|
|
118
|
-
let lines = text.split(LineDecoder.NEWLINE_REGEXP);
|
|
119
|
-
if (lines.length === 1 && !trailingNewline) {
|
|
120
|
-
this.buffer.push(lines[0]);
|
|
121
|
-
return [];
|
|
122
|
-
}
|
|
123
|
-
if (this.buffer.length > 0) {
|
|
124
|
-
lines = [this.buffer.join('') + lines[0], ...lines.slice(1)];
|
|
125
|
-
this.buffer = [];
|
|
126
|
-
}
|
|
127
|
-
if (!trailingNewline) {
|
|
128
|
-
this.buffer = [lines.pop() || ''];
|
|
129
|
-
}
|
|
130
|
-
return lines;
|
|
131
|
-
}
|
|
132
|
-
decodeText(bytes) {
|
|
133
|
-
var _a;
|
|
134
|
-
if (bytes == null) return '';
|
|
135
|
-
if (typeof bytes === 'string') return bytes;
|
|
136
|
-
// Node:
|
|
137
|
-
if (typeof Buffer !== 'undefined') {
|
|
138
|
-
if (bytes instanceof Buffer) {
|
|
139
|
-
return bytes.toString();
|
|
140
|
-
}
|
|
141
|
-
if (bytes instanceof Uint8Array) {
|
|
142
|
-
return Buffer.from(bytes).toString();
|
|
143
|
-
}
|
|
144
|
-
throw new Error(
|
|
145
|
-
`Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`,
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
// Browser
|
|
149
|
-
if (typeof TextDecoder !== 'undefined') {
|
|
150
|
-
if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) {
|
|
151
|
-
(_a = this.textDecoder) !== null && _a !== void 0 ? _a : (this.textDecoder = new TextDecoder('utf8'));
|
|
152
|
-
return this.textDecoder.decode(bytes);
|
|
153
|
-
}
|
|
154
|
-
throw new Error(
|
|
155
|
-
`Unexpected: received non-Uint8Array/ArrayBuffer (${bytes.constructor.name}) in a web platform. Please report this error.`,
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
throw new Error(
|
|
159
|
-
`Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`,
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
flush() {
|
|
163
|
-
if (!this.buffer.length && !this.trailingCR) {
|
|
164
|
-
return [];
|
|
165
|
-
}
|
|
166
|
-
const lines = [this.buffer.join('')];
|
|
167
|
-
this.buffer = [];
|
|
168
|
-
this.trailingCR = false;
|
|
169
|
-
return lines;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// prettier-ignore
|
|
173
|
-
LineDecoder.NEWLINE_CHARS = new Set(['\n', '\r', '\x0b', '\x0c', '\x1c', '\x1d', '\x1e', '\x85', '\u2028', '\u2029']);
|
|
174
|
-
LineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;
|
|
175
|
-
function partition(str, delimiter) {
|
|
176
|
-
const index = str.indexOf(delimiter);
|
|
177
|
-
if (index !== -1) {
|
|
178
|
-
return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
|
|
179
|
-
}
|
|
180
|
-
return [str, '', ''];
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Most browsers don't yet have async iterable support for ReadableStream,
|
|
184
|
-
* and Node has a very different way of reading bytes from its "ReadableStream".
|
|
185
|
-
*
|
|
186
|
-
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
|
|
187
|
-
*/
|
|
188
|
-
function readableStreamAsyncIterable(stream) {
|
|
189
|
-
if (stream[Symbol.asyncIterator]) return stream;
|
|
190
|
-
const reader = stream.getReader();
|
|
191
|
-
return {
|
|
192
|
-
async next() {
|
|
193
|
-
try {
|
|
194
|
-
const result = await reader.read();
|
|
195
|
-
if (result === null || result === void 0 ? void 0 : result.done) reader.releaseLock(); // release lock when stream becomes closed
|
|
196
|
-
return result;
|
|
197
|
-
} catch (e) {
|
|
198
|
-
reader.releaseLock(); // release lock when stream becomes errored
|
|
199
|
-
throw e;
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
async return() {
|
|
203
|
-
const cancelPromise = reader.cancel();
|
|
204
|
-
reader.releaseLock();
|
|
205
|
-
await cancelPromise;
|
|
206
|
-
return { done: true, value: undefined };
|
|
207
|
-
},
|
|
208
|
-
[Symbol.asyncIterator]() {
|
|
209
|
-
return this;
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
//# sourceMappingURL=streaming.js.map
|
package/streaming.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.js","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":";;;AAEA,oCAAqE;AAUrE,MAAa,MAAM;IASjB,YAAY,QAAkB,EAAE,UAA2B;QACzD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAA,4BAAqB,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjE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