@zimtsui/form-stream 0.0.0-stage → 0.0.2

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/README.md CHANGED
@@ -1,3 +1,37 @@
1
- # Temporary Holding Version
1
+ # form-stream
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![NPM Version](https://img.shields.io/npm/v/@zimtsui/form-stream?style=flat-square)](https://www.npmjs.com/package/@zimtsui/form-stream)
4
+
5
+ ## Examples
6
+
7
+ ```ts
8
+ import * as FormStream from '@zimtsui/form-stream';
9
+ import * as StreamConsumers from 'node:stream/consumers';
10
+ import { MIMEType } from 'node:util';
11
+
12
+ async function parseRequest(request: Request): Promise<void> {
13
+ const contentType = new MIMEType(request.headers.get('content-type')!);
14
+ const entries = FormStream.parse(contentType, request.body!);
15
+ for await (const entry of entries)
16
+ for await (const part of entry)
17
+ if (part.type === 'name') {
18
+ const name = await StreamConsumers.text(part.chunks);
19
+ console.log(name);
20
+ } else if (part.type === 'filename') {
21
+ const filename = await StreamConsumers.text(part.chunks);
22
+ console.log(filename);
23
+ } else if (part.type === 'body') {
24
+ const blob = await StreamConsumers.blob(part.chunks);
25
+ console.log(part.contentType.essence, part.contentType.params.get('charset'), blob.size);
26
+ } else throw new Error();
27
+ }
28
+ ```
29
+
30
+ Each entry yields a `name` part and an optional `filename` part in raw header order, followed by its `body` part. Read each part's `chunks` to EOF before requesting the next part. Read the body stream to EOF before requesting the next entry.
31
+
32
+ ## Compromises
33
+
34
+ - 本软件不考虑健壮性,不按契约使用可能会导致不可恢复的异常和静默异常。
35
+ - 请求头和 form entry 中的 `Content-Type` 被直接使用 `node:util` 的 `MIMEType` 解析,不一定完全符合标准。
36
+ - 部件的 `Content-Type` 为 `multipart/mixed` 时抛出 `MultipartMixedError`。
37
+ - 遇到 `Content-Disposition` 中 `name` 或 `filename` parameter continuation 时抛出 `ParameterContinuationError`。
@@ -0,0 +1,11 @@
1
+ import { type StreamInput } from './input.ts';
2
+ export type Delimiter = 'next' | 'close';
3
+ export declare class Boundary {
4
+ protected input: StreamInput;
5
+ protected pattern: Uint8Array;
6
+ constructor(boundary: string, input: StreamInput);
7
+ protected scan(end: number, matched: number): number;
8
+ protected suffix(): Promise<Delimiter | undefined>;
9
+ first(): Promise<Delimiter>;
10
+ body(): AsyncGenerator<Uint8Array, Delimiter, void>;
11
+ }
@@ -0,0 +1,121 @@
1
+ import { CR, LF, isSpace, outputChunkSize } from "./input.js";
2
+ const dash = 0x2d;
3
+ export class Boundary {
4
+ input;
5
+ pattern;
6
+ constructor(boundary, input) {
7
+ this.input = input;
8
+ this.pattern = new TextEncoder().encode(`\r\n--${boundary}`);
9
+ }
10
+ scan(end, matched) {
11
+ const chunk = this.input.getChunk();
12
+ const offset = this.input.getOffset();
13
+ const pattern = this.pattern;
14
+ let cursor = offset;
15
+ while (cursor < end) {
16
+ const byte = chunk[cursor++];
17
+ if (byte === pattern[matched]) {
18
+ matched++;
19
+ if (matched === pattern.length)
20
+ break;
21
+ }
22
+ else {
23
+ // The leading CR is the only CR in a validated boundary pattern.
24
+ matched = byte === CR ? 1 : 0;
25
+ }
26
+ }
27
+ this.input.advance(cursor - offset);
28
+ return matched;
29
+ }
30
+ async suffix() {
31
+ const input = this.input;
32
+ let byte = input.getByte() ?? await input.peek();
33
+ let closing = false;
34
+ if (byte === dash) {
35
+ input.advance();
36
+ if ((input.getByte() ?? await input.peek()) !== dash)
37
+ return;
38
+ input.advance();
39
+ closing = true;
40
+ byte = input.getByte() ?? await input.peek();
41
+ }
42
+ while (isSpace(byte)) {
43
+ input.advance();
44
+ byte = input.getByte() ?? await input.peek();
45
+ }
46
+ if (byte === undefined && closing)
47
+ return 'close';
48
+ if (byte !== CR)
49
+ return;
50
+ input.advance();
51
+ if ((input.getByte() ?? await input.peek()) !== LF)
52
+ return;
53
+ input.advance();
54
+ return closing ? 'close' : 'next';
55
+ }
56
+ async first() {
57
+ const input = this.input;
58
+ // A delimiter at byte zero has an implicit leading CRLF.
59
+ let matched = 2;
60
+ let startsAtByteZero = true;
61
+ while (input.getByte() !== undefined || await input.fill()) {
62
+ const previous = matched;
63
+ const offset = input.getOffset();
64
+ matched = this.scan(input.getChunk().length, matched);
65
+ startsAtByteZero &&= matched === previous + input.getOffset() - offset;
66
+ if (matched === this.pattern.length) {
67
+ const delimiter = await this.suffix();
68
+ if (delimiter === 'next')
69
+ return delimiter;
70
+ // FormData can serialize an empty form as a standalone closing delimiter.
71
+ if (startsAtByteZero && delimiter === 'close' && await input.peek() === undefined)
72
+ return delimiter;
73
+ startsAtByteZero = false;
74
+ matched = delimiter === 'close' ? 2 : 0;
75
+ }
76
+ }
77
+ throw new SyntaxError('Missing first multipart delimiter');
78
+ }
79
+ async *body() {
80
+ const input = this.input;
81
+ // In a header-only part, the CRLF consumed after the headers is
82
+ // already the leading CRLF of the delimiter.
83
+ let matched = 2;
84
+ let consumedPrefix = matched;
85
+ while (input.getByte() !== undefined || await input.fill()) {
86
+ const chunk = input.getChunk();
87
+ const offset = input.getOffset();
88
+ const previous = matched;
89
+ matched = this.scan(Math.min(chunk.length, offset + outputChunkSize), matched);
90
+ // The uncommitted bytes consist of the old prefix and the bytes
91
+ // just scanned. Only the new matching suffix needs to be held back.
92
+ const length = previous + input.getOffset() - offset - matched;
93
+ if (length > 0) {
94
+ const prefixLength = Math.min(previous, length);
95
+ const prefixStart = Math.min(consumedPrefix, prefixLength);
96
+ consumedPrefix -= prefixStart;
97
+ const end = offset + length - prefixLength;
98
+ if (length > prefixStart) {
99
+ if (prefixLength === prefixStart) {
100
+ yield chunk.slice(offset, end);
101
+ }
102
+ else {
103
+ const output = new Uint8Array(length - prefixStart);
104
+ output.set(this.pattern.subarray(prefixStart, prefixLength));
105
+ output.set(chunk.subarray(offset, end), prefixLength - prefixStart);
106
+ yield output;
107
+ }
108
+ }
109
+ }
110
+ if (matched === this.pattern.length) {
111
+ // RFC 2046 reserves the boundary prefix at the start of a body line.
112
+ const delimiter = await this.suffix();
113
+ if (delimiter === undefined)
114
+ throw new SyntaxError('Invalid multipart delimiter suffix');
115
+ return delimiter;
116
+ }
117
+ }
118
+ throw new SyntaxError('Unexpected end of multipart body');
119
+ }
120
+ }
121
+ //# sourceMappingURL=boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary.js","sourceRoot":"","sources":["../src/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,eAAe,EAAoB,MAAM,YAAY,CAAC;AAIhF,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB,MAAM,OAAO,QAAQ;IACP,KAAK,CAAc;IACnB,OAAO,CAAa;IAE9B,YAAmB,QAAgB,EAAE,KAAkB;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC;IACjE,CAAC;IAES,IAAI,CAAC,GAAW,EAAE,OAAe;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,MAAM,GAAG,MAAM,CAAC;QACpB,OAAO,MAAM,GAAG,GAAG,EAAE,CAAC;YAClB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7B,IAAI,IAAI,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5B,OAAO,EAAE,CAAC;gBACV,IAAI,OAAO,KAAK,OAAO,CAAC,MAAM;oBAAE,MAAM;YAC1C,CAAC;iBAAM,CAAC;gBACJ,iEAAiE;gBACjE,OAAO,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,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,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC,CAAC;wBACpE,MAAM,MAAM,CAAC;oBACjB,CAAC;gBACL,CAAC;YACL,CAAC;YACD,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;gBAClC,qEAAqE;gBACrE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;gBACtC,IAAI,SAAS,KAAK,SAAS;oBAAE,MAAM,IAAI,WAAW,CAAC,oCAAoC,CAAC,CAAC;gBACzF,OAAO,SAAS,CAAC;YACrB,CAAC;QACL,CAAC;QACD,MAAM,IAAI,WAAW,CAAC,kCAAkC,CAAC,CAAC;IAC9D,CAAC;CACJ"}
@@ -0,0 +1,2 @@
1
+ export type TransferEncoding = 'identity' | 'base64' | 'quoted-printable';
2
+ export declare function decodeBody(body: AsyncIterable<Uint8Array>, encoding: TransferEncoding): AsyncIterable<Uint8Array>;
@@ -0,0 +1,108 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { CR, LF, isSpace } from "./input.js";
3
+ export function decodeBody(body, encoding) {
4
+ switch (encoding) {
5
+ case 'identity': return body;
6
+ case 'base64': return decodeBase64(body);
7
+ case 'quoted-printable': return decodeQuotedPrintable(body);
8
+ }
9
+ }
10
+ async function* decodeBase64(body) {
11
+ let remainder = '';
12
+ let padded = false;
13
+ for await (const chunk of body) {
14
+ const bytes = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
15
+ const encoded = remainder + bytes.toString('latin1').replace(/[^A-Za-z0-9+/=]/g, '');
16
+ if (padded && encoded)
17
+ throw new SyntaxError('Unexpected data after base64 padding');
18
+ const end = encoded.length - encoded.length % 4;
19
+ remainder = encoded.slice(end);
20
+ if (!end)
21
+ continue;
22
+ const groups = encoded.slice(0, end);
23
+ const decoded = Buffer.from(groups, 'base64');
24
+ if (groups.includes('=')) {
25
+ if (remainder || decoded.toString('base64') !== groups)
26
+ throw new SyntaxError('Invalid base64 padding');
27
+ padded = true;
28
+ }
29
+ yield Uint8Array.from(decoded);
30
+ }
31
+ if (remainder)
32
+ throw new SyntaxError('Incomplete base64 group');
33
+ }
34
+ const equals = 0x3d;
35
+ function hexDigit(byte) {
36
+ if (byte !== undefined) {
37
+ if (byte >= 0x30 && byte <= 0x39)
38
+ return byte - 0x30;
39
+ if (byte >= 0x41 && byte <= 0x46)
40
+ return byte - 0x41 + 10;
41
+ }
42
+ throw new SyntaxError('Invalid quoted-printable escape');
43
+ }
44
+ function decodeQuotedPrintableLine(line, length, terminated) {
45
+ const softBreak = terminated && line[length - 1] === equals;
46
+ const end = length - Number(softBreak);
47
+ const hardBreak = terminated && !softBreak;
48
+ const output = new Uint8Array(end + (hardBreak ? 2 : 0));
49
+ let offset = 0;
50
+ for (let index = 0; index < end; index++) {
51
+ const byte = line[index];
52
+ if (byte === equals) {
53
+ if (index + 2 >= end)
54
+ throw new SyntaxError('Incomplete quoted-printable escape');
55
+ output[offset++] = hexDigit(line[++index]) * 16 + hexDigit(line[++index]);
56
+ }
57
+ else {
58
+ if (!isSpace(byte) && (byte < 0x21 || byte > 0x7e))
59
+ throw new SyntaxError('Invalid quoted-printable byte');
60
+ output[offset++] = byte;
61
+ }
62
+ }
63
+ if (hardBreak) {
64
+ output[offset++] = CR;
65
+ output[offset++] = LF;
66
+ }
67
+ return output.subarray(0, offset);
68
+ }
69
+ async function* decodeQuotedPrintable(body) {
70
+ const line = new Uint8Array(76);
71
+ let length = 0;
72
+ let contentLength = 0;
73
+ let afterCR = false;
74
+ for await (const chunk of body) {
75
+ for (const byte of chunk) {
76
+ if (afterCR) {
77
+ if (byte !== LF)
78
+ throw new SyntaxError('Expected CRLF in quoted-printable body');
79
+ const output = decodeQuotedPrintableLine(line, contentLength, true);
80
+ length = 0;
81
+ contentLength = 0;
82
+ afterCR = false;
83
+ if (output.length)
84
+ yield output;
85
+ }
86
+ else if (byte === CR) {
87
+ afterCR = true;
88
+ }
89
+ else if (byte === LF) {
90
+ throw new SyntaxError('Expected CRLF in quoted-printable body');
91
+ }
92
+ else {
93
+ // Allow transport padding of any length at the end of the line.
94
+ if (length < line.length)
95
+ line[length++] = byte;
96
+ else if (!isSpace(byte))
97
+ throw new SyntaxError('Quoted-printable line exceeds 76 characters');
98
+ if (!isSpace(byte))
99
+ contentLength = length;
100
+ }
101
+ }
102
+ }
103
+ if (afterCR)
104
+ throw new SyntaxError('Incomplete quoted-printable line break');
105
+ if (contentLength)
106
+ yield decodeQuotedPrintableLine(line, contentLength, false);
107
+ }
108
+ //# sourceMappingURL=encoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI7C,MAAM,UAAU,UAAU,CAAC,IAA+B,EAAE,QAA0B;IAClF,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,UAAU,CAAC,CAAC,OAAO,IAAI,CAAC;QAC7B,KAAK,QAAQ,CAAC,CAAC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;QACzC,KAAK,kBAAkB,CAAC,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;AACL,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,YAAY,CAAC,IAA+B;IACxD,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC5E,MA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AC,IAAI,CAAC;oBAAE,MAAM,IAAI,WAAW,CAAC,6CAA6C,CAAC,CAAC;gBAC9F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;oBAAE,aAAa,GAAG,MAAM,CAAC;YAC/C,CAAC;QACL,CAAC;IACL,CAAC;IACD,IAAI,OAAO;QAAE,MAAM,IAAI,WAAW,CAAC,wCAAwC,CAAC,CAAC;IAC7E,IAAI,aAAa;QAAE,MAAM,yBAAyB,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;AACnF,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './form-stream.ts';
2
+ export { MultipartMixedError, ParameterContinuationError } from './mime.ts';
3
+ export * from './types.ts';
@@ -0,0 +1,4 @@
1
+ export * from "./form-stream.js";
2
+ export { MultipartMixedError, ParameterContinuationError } from "./mime.js";
3
+ export * from "./types.js";
4
+ //# sourceMappingURL=exports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAC5E,cAAc,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { MIMEType } from 'node:util';
2
+ import type { Entry } from './types.ts';
3
+ /**
4
+ * @param body ownership NOT transferred
5
+ */
6
+ export declare function parse(contentType: MIMEType, body: ReadableStream<Uint8Array>): AsyncGenerator<Entry, void, void>;
@@ -0,0 +1,92 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
53
+ import { Boundary } from "./boundary.js";
54
+ import { decodeBody } from "./encoding.js";
55
+ import { StreamInput } from "./input.js";
56
+ import { readBoundary, readMetadata } from "./mime.js";
57
+ /**
58
+ * @param body ownership NOT transferred
59
+ */
60
+ export async function* parse(contentType, body) {
61
+ const env_1 = { stack: [], error: void 0, hasError: false };
62
+ try {
63
+ const boundaryValue = readBoundary(contentType);
64
+ const input = __addDisposableResource(env_1, new StreamInput(body), true);
65
+ const boundary = new Boundary(boundaryValue, input);
66
+ let nextDelimiter = await boundary.first();
67
+ async function* readBody() {
68
+ nextDelimiter = yield* boundary.body();
69
+ }
70
+ async function* readEntry() {
71
+ const { contentType, encoding } = yield* readMetadata(input);
72
+ yield { type: 'body', contentType, chunks: ReadableStream.from(decodeBody(readBody(), encoding)) };
73
+ }
74
+ while (nextDelimiter === 'next') {
75
+ nextDelimiter = undefined;
76
+ yield readEntry();
77
+ }
78
+ if (nextDelimiter === 'close') {
79
+ while (await input.fill()) { }
80
+ }
81
+ }
82
+ catch (e_1) {
83
+ env_1.error = e_1;
84
+ env_1.hasError = true;
85
+ }
86
+ finally {
87
+ const result_1 = __disposeResources(env_1);
88
+ if (result_1)
89
+ await result_1;
90
+ }
91
+ }
92
+ //# sourceMappingURL=form-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-stream.js","sourceRoot":"","sources":["../src/form-stream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAKvD;;GAEG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,KAAK,CAAC,WAAqB,EAAE,IAAgC;;;QAChF,MAAM,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;QAChD,MAAY,KAAK,kCAAG,IAAI,WAAW,CAAC,IAAI,CAAC,OAAA,CAAC;QAC1C,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,aAAa,GAA0B,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;QAElE,KAAK,SAAS,CAAC,CAAC,QAAQ;YACpB,aAAa,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3C,CAAC;QAED,KAAK,SAAS,CAAC,CAAC,SAAS;YACrB,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;QACvG,CAAC;QAED,OAAO,aAAa,KAAK,MAAM,EAAE,CAAC;YAC9B,aAAa,GAAG,SAAS,CAAC;YAC1B,MAAM,SAAS,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;YAC5B,OAAO,MAAM,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;;;;;;;;;;;CACJ"}
@@ -0,0 +1,20 @@
1
+ export declare const CR = 13;
2
+ export declare const LF = 10;
3
+ export declare const outputChunkSize: number;
4
+ export declare function isSpace(byte: number | undefined): boolean;
5
+ export declare abstract class Input {
6
+ protected chunk: Uint8Array;
7
+ protected offset: number;
8
+ getChunk(): Uint8Array;
9
+ getOffset(): number;
10
+ advance(length?: number): void;
11
+ getByte(): number | undefined;
12
+ abstract peek(): number | undefined | Promise<number | undefined>;
13
+ }
14
+ export declare class StreamInput extends Input implements AsyncDisposable {
15
+ protected reader?: ReadableStreamDefaultReader<Uint8Array>;
16
+ constructor(source: ReadableStream<Uint8Array>);
17
+ fill(): Promise<boolean>;
18
+ peek(): Promise<number | undefined>;
19
+ [Symbol.asyncDispose](): Promise<void>;
20
+ }
package/build/input.js ADDED
@@ -0,0 +1,64 @@
1
+ const empty = new Uint8Array(0);
2
+ export const CR = 0x0d;
3
+ export const LF = 0x0a;
4
+ export const outputChunkSize = 16 * 1024;
5
+ export function isSpace(byte) {
6
+ return byte === 0x20 || byte === 0x09;
7
+ }
8
+ function asUint8Array(source) {
9
+ // Use Uint8Array.prototype.slice even when the source is a Buffer.
10
+ return new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
11
+ }
12
+ export class Input {
13
+ chunk = empty;
14
+ offset = 0;
15
+ getChunk() {
16
+ return this.chunk;
17
+ }
18
+ getOffset() {
19
+ return this.offset;
20
+ }
21
+ advance(length = 1) {
22
+ this.offset += length;
23
+ }
24
+ getByte() {
25
+ return this.chunk[this.offset];
26
+ }
27
+ }
28
+ export class StreamInput extends Input {
29
+ reader;
30
+ constructor(source) {
31
+ super();
32
+ this.reader = source.getReader();
33
+ }
34
+ async fill() {
35
+ this.chunk = empty;
36
+ this.offset = 0;
37
+ while (this.reader) {
38
+ const { value, done } = await this.reader.read();
39
+ if (done)
40
+ break;
41
+ if (value.byteLength) {
42
+ this.chunk = asUint8Array(value);
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ }
48
+ async peek() {
49
+ if (this.getByte() === undefined)
50
+ await this.fill();
51
+ return this.getByte();
52
+ }
53
+ async [Symbol.asyncDispose]() {
54
+ const reader = this.reader;
55
+ this.reader = undefined;
56
+ this.chunk = empty;
57
+ this.offset = 0;
58
+ if (!reader)
59
+ return;
60
+ await reader.cancel().catch(() => { });
61
+ reader.releaseLock();
62
+ }
63
+ }
64
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;AACvB,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;AACvB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAEzC,MAAM,UAAU,OAAO,CAAC,IAAwB;IAC5C,OAAO,IAAI,KAAK,IAAI,IAAI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IAEe,KAAK,CAAC,IAAI;QACtB,IAAI,IAAI,CAAC,OAAO,EAAE,KAAK,SAAS;YAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,WAAW,EAAE,CAAC;IACzB,CAAC;CACJ"}
@@ -0,0 +1,15 @@
1
+ import { MIMEType } from 'node:util';
2
+ import type { TransferEncoding } from './encoding.ts';
3
+ import { type Input } from './input.ts';
4
+ import type { Entry } from './types.ts';
5
+ export declare class ParameterContinuationError extends RangeError {
6
+ }
7
+ export declare class MultipartMixedError extends RangeError {
8
+ }
9
+ interface BodyMetadata {
10
+ contentType: MIMEType;
11
+ encoding: TransferEncoding;
12
+ }
13
+ export declare function readBoundary(contentType: MIMEType): string;
14
+ export declare function readMetadata(input: Input): AsyncGenerator<Entry.Part.Name | Entry.Part.Filename, BodyMetadata, void>;
15
+ export {};
package/build/mime.js ADDED
@@ -0,0 +1,292 @@
1
+ import { Buffer } from 'node:buffer';
2
+ import { MIMEType } from 'node:util';
3
+ import { CR, LF, isSpace, outputChunkSize } from "./input.js";
4
+ export class ParameterContinuationError extends RangeError {
5
+ }
6
+ export class MultipartMixedError extends RangeError {
7
+ }
8
+ const quote = 0x22;
9
+ const backslash = 0x5c;
10
+ const openParen = 0x28;
11
+ const closeParen = 0x29;
12
+ const tspecials = '()<>@,;:\\"/[]?=';
13
+ const disposition = 'content-disposition';
14
+ const transferEncoding = 'content-transfer-encoding';
15
+ function isToken(byte) {
16
+ return byte > 0x20 && byte < 0x7f && !tspecials.includes(String.fromCharCode(byte));
17
+ }
18
+ function isQuotedText(byte) {
19
+ return byte !== quote && byte !== backslash && byte !== CR && byte !== LF;
20
+ }
21
+ function isHeaderName(byte) {
22
+ return byte > 0x20 && byte < 0x7f && byte !== 0x3a;
23
+ }
24
+ async function readWord(input, accepts, limit) {
25
+ let word = '';
26
+ let tooLong = false;
27
+ for (;;) {
28
+ const byte = input.getByte() ?? await input.peek();
29
+ if (byte === undefined || !accepts(byte))
30
+ break;
31
+ if (word.length < limit)
32
+ word += String.fromCharCode(byte);
33
+ else
34
+ tooLong = true;
35
+ input.advance();
36
+ }
37
+ if (!word)
38
+ throw new SyntaxError('Expected a MIME token');
39
+ return tooLong ? '' : word.toLowerCase();
40
+ }
41
+ class MimeValue {
42
+ input;
43
+ ended = false;
44
+ constructor(input) {
45
+ this.input = input;
46
+ }
47
+ async fold() {
48
+ const input = this.input;
49
+ input.advance();
50
+ if ((input.getByte() ?? await input.peek()) !== LF)
51
+ throw new SyntaxError('Expected CRLF in MIME header');
52
+ input.advance();
53
+ if (isSpace(input.getByte() ?? await input.peek()))
54
+ return true;
55
+ this.ended = true;
56
+ return false;
57
+ }
58
+ async peek() {
59
+ if (this.ended)
60
+ return;
61
+ const byte = this.input.getByte() ?? await this.input.peek();
62
+ if (byte === CR)
63
+ return await this.fold() ? this.input.getByte() : undefined;
64
+ if (byte === LF)
65
+ throw new SyntaxError('Unexpected LF in MIME header');
66
+ if (byte === undefined)
67
+ throw new SyntaxError('Unexpected end of MIME headers');
68
+ return byte;
69
+ }
70
+ async quotedPair() {
71
+ const input = this.input;
72
+ input.advance();
73
+ let byte = input.getByte() ?? await input.peek();
74
+ if (byte === CR) {
75
+ if (!await this.fold())
76
+ throw new SyntaxError('Expected a continuation after quoted CRLF');
77
+ byte = input.getByte();
78
+ }
79
+ if (byte === undefined || byte === LF)
80
+ throw new SyntaxError('Invalid MIME quoted pair');
81
+ input.advance();
82
+ return byte;
83
+ }
84
+ async skipComment() {
85
+ let depth = 1;
86
+ this.input.advance();
87
+ while (depth) {
88
+ const byte = this.input.getByte();
89
+ const current = byte === undefined || byte === CR || byte === LF ? await this.peek() : byte;
90
+ if (current === undefined || current > 0x7f)
91
+ throw new SyntaxError('Invalid MIME comment');
92
+ if (current === backslash) {
93
+ if (await this.quotedPair() > 0x7f)
94
+ throw new SyntaxError('Invalid MIME comment');
95
+ continue;
96
+ }
97
+ if (current === openParen)
98
+ depth++;
99
+ if (current === closeParen)
100
+ depth--;
101
+ this.input.advance();
102
+ }
103
+ }
104
+ async skipSpace() {
105
+ let byte = await this.peek();
106
+ while (isSpace(byte) || byte === openParen) {
107
+ if (byte === openParen)
108
+ await this.skipComment();
109
+ else
110
+ this.input.advance();
111
+ byte = this.input.getByte();
112
+ if (byte === undefined || byte === CR || byte === LF)
113
+ byte = await this.peek();
114
+ }
115
+ return byte;
116
+ }
117
+ async token(limit = Infinity) {
118
+ if (await this.skipSpace() === undefined)
119
+ throw new SyntaxError('Expected a MIME token');
120
+ return readWord(this.input, isToken, limit);
121
+ }
122
+ async *dispositionParameters() {
123
+ for (;;) {
124
+ const byte = await this.skipSpace();
125
+ if (byte === undefined)
126
+ return;
127
+ if (byte !== 0x3b)
128
+ throw new SyntaxError('Expected ";" before a MIME parameter');
129
+ this.input.advance();
130
+ const name = await this.token();
131
+ if (/^(?:name|filename)\*(?:0|[1-9][0-9]*)\*?$/.test(name))
132
+ throw new ParameterContinuationError('Unsupported Content-Disposition parameter continuation: ' + name);
133
+ if (await this.skipSpace() !== 0x3d)
134
+ throw new SyntaxError('Expected "=" after a MIME parameter name');
135
+ this.input.advance();
136
+ const source = this.parameterValue();
137
+ if (name === 'name' || name === 'filename') {
138
+ yield { name, source };
139
+ }
140
+ else {
141
+ for await (const _ of source) { }
142
+ }
143
+ }
144
+ }
145
+ takeRun(accepts) {
146
+ const input = this.input;
147
+ const chunk = input.getChunk();
148
+ const offset = input.getOffset();
149
+ const limit = Math.min(chunk.length, offset + outputChunkSize);
150
+ let end = offset;
151
+ while (end < limit && accepts(chunk[end]))
152
+ end++;
153
+ input.advance(end - offset);
154
+ return chunk.slice(offset, end);
155
+ }
156
+ async *parameterValue() {
157
+ const input = this.input;
158
+ let byte = await this.skipSpace();
159
+ if (byte === quote) {
160
+ input.advance();
161
+ yield* this.quotedString();
162
+ return;
163
+ }
164
+ if (byte === undefined || !isToken(byte))
165
+ throw new SyntaxError('Expected a MIME parameter value');
166
+ do {
167
+ yield this.takeRun(isToken);
168
+ byte = input.getByte() ?? await input.peek();
169
+ } while (byte !== undefined && isToken(byte));
170
+ }
171
+ async *quotedString() {
172
+ const input = this.input;
173
+ for (;;) {
174
+ const byte = input.getByte() ?? await input.peek();
175
+ if (byte === quote) {
176
+ input.advance();
177
+ return;
178
+ }
179
+ if (byte === backslash) {
180
+ const escaped = await this.quotedPair();
181
+ yield Uint8Array.of(escaped);
182
+ continue;
183
+ }
184
+ if (byte === CR) {
185
+ if (!await this.fold())
186
+ throw new SyntaxError('Unterminated MIME quoted string');
187
+ continue;
188
+ }
189
+ if (byte === undefined || byte === LF)
190
+ throw new SyntaxError('Unterminated MIME quoted string');
191
+ yield this.takeRun(isQuotedText);
192
+ }
193
+ }
194
+ async *line() {
195
+ while (await this.peek() !== undefined) {
196
+ const chunk = this.input.getChunk();
197
+ const offset = this.input.getOffset();
198
+ let end = offset + 1;
199
+ while (end < chunk.length && chunk[end] !== CR && chunk[end] !== LF)
200
+ end++;
201
+ this.input.advance(end - offset);
202
+ yield chunk.subarray(offset, end);
203
+ }
204
+ }
205
+ }
206
+ export function readBoundary(contentType) {
207
+ if (contentType.essence !== 'multipart/form-data')
208
+ throw new SyntaxError('Expected a multipart/form-data Content-Type');
209
+ const boundary = contentType.params.get('boundary');
210
+ if (!boundary || boundary.length > 70 || boundary.endsWith(' ') || /[^0-9A-Za-z'()+_,.\/:=? -]/.test(boundary))
211
+ throw new SyntaxError('Missing or invalid multipart boundary');
212
+ return boundary;
213
+ }
214
+ async function readContentType(header) {
215
+ const chunks = [];
216
+ for await (const chunk of header.line())
217
+ chunks.push(chunk.slice());
218
+ const value = Buffer.concat(chunks).toString('latin1');
219
+ try {
220
+ return new MIMEType(value);
221
+ }
222
+ catch (error) {
223
+ if (error instanceof TypeError)
224
+ return new MIMEType('text/plain');
225
+ throw error;
226
+ }
227
+ }
228
+ export async function* readMetadata(input) {
229
+ let hasDisposition = false;
230
+ let contentType;
231
+ let encoding;
232
+ const seen = { name: false, filename: false };
233
+ while ((input.getByte() ?? await input.peek()) !== CR) {
234
+ const header = await readWord(input, isHeaderName, transferEncoding.length);
235
+ if ((input.getByte() ?? await input.peek()) !== 0x3a)
236
+ throw new SyntaxError('Expected ":" after a MIME header name');
237
+ input.advance();
238
+ const value = new MimeValue(input);
239
+ switch (header) {
240
+ case disposition:
241
+ if (hasDisposition)
242
+ throw new SyntaxError('Duplicate Content-Disposition');
243
+ hasDisposition = true;
244
+ if (await value.token(9) !== 'form-data')
245
+ throw new SyntaxError('Expected Content-Disposition: form-data');
246
+ for await (const { name, source } of value.dispositionParameters()) {
247
+ if (seen[name])
248
+ throw new SyntaxError(`Duplicate ${name} parameter`);
249
+ seen[name] = true;
250
+ yield { type: name, chunks: ReadableStream.from(source) };
251
+ }
252
+ break;
253
+ case 'content-type':
254
+ if (contentType)
255
+ throw new SyntaxError('Duplicate Content-Type');
256
+ contentType = await readContentType(value);
257
+ if (contentType.essence === 'multipart/mixed')
258
+ throw new MultipartMixedError('Unsupported multipart/mixed form entry');
259
+ break;
260
+ case transferEncoding:
261
+ if (encoding !== undefined)
262
+ throw new SyntaxError('Duplicate Content-Transfer-Encoding');
263
+ encoding = await value.token('quoted-printable'.length);
264
+ if (await value.skipSpace() !== undefined)
265
+ throw new SyntaxError('Invalid Content-Transfer-Encoding');
266
+ break;
267
+ default:
268
+ for await (const _ of value.line()) { }
269
+ }
270
+ }
271
+ input.advance();
272
+ if ((input.getByte() ?? await input.peek()) !== LF)
273
+ throw new SyntaxError('Expected CRLF after MIME headers');
274
+ input.advance();
275
+ if (!seen.name)
276
+ throw new SyntaxError('Expected a Content-Disposition name parameter');
277
+ switch (encoding) {
278
+ case 'base64':
279
+ case 'quoted-printable':
280
+ if (contentType?.type === 'multipart')
281
+ throw new SyntaxError('Invalid transfer encoding for a multipart entity');
282
+ return { contentType: contentType ?? new MIMEType('text/plain'), encoding };
283
+ case undefined:
284
+ case 'binary':
285
+ case '7bit':
286
+ case '8bit':
287
+ return { contentType: contentType ?? new MIMEType('text/plain'), encoding: 'identity' };
288
+ default:
289
+ return { contentType: new MIMEType('application/octet-stream'), encoding: 'identity' };
290
+ }
291
+ }
292
+ //# sourceMappingURL=mime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime.js","sourceRoot":"","sources":["../src/mime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAc,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG1E,MAAM,OAAO,0BAA2B,SAAQ,UAAU;CAAI;AAC9D,MAAM,OAAO,mBAAoB,SAAQ,UAAU;CAAI;AAEvD,MAAM,KAAK,GAAG,IAAI,CAAC;AACnB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,kBAAkB,CAAC;AACrC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAYrD,SAAS,OAAO,CAAC,IAAY;IACzB,OAAO,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAI,IAAI,C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QAAE,MAAM,IAAI,WAAW,CAAC,kCAAkC,CAAC,CAAC;IAC9G,KAAK,CAAC,OAAO,EAAE,CAAC;IAChB,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,WAAW,CAAC,+CAA+C,CAAC,CAAC;IACvF,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,QAAQ,CAAC;QACd,KAAK,kBAAkB;YACnB,IAAI,WAAW,EAAE,IAAI,KAAK,WAAW;gBAAE,MAAM,IAAI,WAAW,CAAC,kDAAkD,CAAC,CAAC;YACjH,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,IAAI,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;QAChF,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ,CAAC;QACd,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACP,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,IAAI,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;QAC5F;YACI,OAAO,EAAE,WAAW,EAAE,IAAI,QAAQ,CAAC,0BAA0B,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC/F,CAAC;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function streameter(limit: number): TransformStream<Uint8Array>;
@@ -0,0 +1,18 @@
1
+ class Transformeter {
2
+ limit;
3
+ constructor(limit) {
4
+ this.limit = limit;
5
+ }
6
+ size = 0;
7
+ transform(chunk, controller) {
8
+ if ((this.size += chunk.byteLength) <= this.limit) { }
9
+ else
10
+ return controller.error(new RangeError());
11
+ return controller.enqueue(chunk);
12
+ }
13
+ }
14
+ export function streameter(limit) {
15
+ const transformeter = new Transformeter(limit);
16
+ return new TransformStream(transformeter);
17
+ }
18
+ //# sourceMappingURL=streameter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streameter.js","sourceRoot":"","sources":["../src/streameter.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa;IACc;IAA7B,YAA6B,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;IAAG,CAAC;IAEpC,IAAI,GAAG,CAAC,CAAC;IAEZ,SAAS,CAAC,KAAiB,EAAE,UAAwD;QACxF,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA,CAAC;;YAAM,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC;QACrG,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACJ;AAGD,MAAM,UAAU,UAAU,CAAC,KAAa;IACpC,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,IAAI,eAAe,CAAyB,aAAa,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1 @@
1
+ {"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2023.d.ts","../node_modules/typescript/lib/lib.es2024.d.ts","../node_modules/typescript/lib/lib.es2025.d.ts","../node_modules/typescript/lib/lib.esnext.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.es2023.array.d.ts","../node_modules/typescript/lib/lib.es2023.collection.d.ts","../node_modules/typescript/lib/lib.es2023.intl.d.ts","../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../node_modules/typescript/lib/lib.es2024.collection.d.ts","../node_modules/typescript/lib/lib.es2024.object.d.ts","../node_modules/typescript/lib/lib.es2024.promise.d.ts","../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2024.string.d.ts","../node_modules/typescript/lib/lib.es2025.collection.d.ts","../node_modules/typescript/lib/lib.es2025.float16.d.ts","../node_modules/typescript/lib/lib.es2025.intl.d.ts","../node_modules/typescript/lib/lib.es2025.iterator.d.ts","../node_modules/typescript/lib/lib.es2025.promise.d.ts","../node_modules/typescript/lib/lib.es2025.regexp.d.ts","../node_modules/typescript/lib/lib.esnext.array.d.ts","../node_modules/typescript/lib/lib.esnext.collection.d.ts","../node_modules/typescript/lib/lib.esnext.date.d.ts","../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../node_modules/typescript/lib/lib.esnext.error.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../node_modules/typescript/lib/lib.esnext.temporal.d.ts","../node_modules/typescript/lib/lib.esnext.typedarrays.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/input.ts","../src/boundary.ts","../src/encoding.ts","../src/types.ts","../src/mime.ts","../src/form-stream.ts","../src/exports.ts","../src/streameter.ts","../node_modules/@types/node/compatibility/iterators.d.ts","../node_modules/@types/node/globals.typedarray.d.ts","../node_modules/@types/node/buffer.buffer.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/web-globals/abortcontroller.d.ts","../node_modules/@types/node/web-globals/crypto.d.ts","../node_modules/@types/node/web-globals/domexception.d.ts","../node_modules/@types/node/web-globals/events.d.ts","../node_modules/undici-types/utility.d.ts","../node_modules/undici-types/header.d.ts","../node_modules/undici-types/readable.d.ts","../node_modules/undici-types/fetch.d.ts","../node_modules/undici-types/formdata.d.ts","../node_modules/undici-types/connector.d.ts","../node_modules/undici-types/client-stats.d.ts","../node_modules/undici-types/client.d.ts","../node_modules/undici-types/errors.d.ts","../node_modules/undici-types/dispatcher.d.ts","../node_modules/undici-types/global-dispatcher.d.ts","../node_modules/undici-types/global-origin.d.ts","../node_modules/undici-types/pool-stats.d.ts","../node_modules/undici-types/pool.d.ts","../node_modules/undici-types/handlers.d.ts","../node_modules/undici-types/balanced-pool.d.ts","../node_modules/undici-types/round-robin-pool.d.ts","../node_modules/undici-types/h2c-client.d.ts","../node_modules/undici-types/agent.d.ts","../node_modules/undici-types/mock-interceptor.d.ts","../node_modules/undici-types/mock-call-history.d.ts","../node_modules/undici-types/mock-agent.d.ts","../node_modules/undici-types/mock-client.d.ts","../node_modules/undici-types/mock-pool.d.ts","../node_modules/undici-types/snapshot-agent.d.ts","../node_modules/undici-types/mock-errors.d.ts","../node_modules/undici-types/proxy-agent.d.ts","../node_modules/undici-types/socks5-proxy-agent.d.ts","../node_modules/undici-types/env-http-proxy-agent.d.ts","../node_modules/undici-types/retry-handler.d.ts","../node_modules/undici-types/retry-agent.d.ts","../node_modules/undici-types/api.d.ts","../node_modules/undici-types/cache-interceptor.d.ts","../node_modules/undici-types/interceptors.d.ts","../node_modules/undici-types/util.d.ts","../node_modules/undici-types/cookies.d.ts","../node_modules/undici-types/patch.d.ts","../node_modules/undici-types/websocket.d.ts","../node_modules/undici-types/eventsource.d.ts","../node_modules/undici-types/diagnostics-channel.d.ts","../node_modules/undici-types/content-type.d.ts","../node_modules/undici-types/cache.d.ts","../node_modules/undici-types/index.d.ts","../node_modules/@types/node/web-globals/fetch.d.ts","../node_modules/@types/node/web-globals/navigator.d.ts","../node_modules/@types/node/web-globals/storage.d.ts","../node_modules/@types/node/web-globals/streams.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/inspector.generated.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/sea.d.ts","../node_modules/@types/node/sqlite.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/index.d.ts"],"fileIdsList":[[98,151,152,154,171,172],[98,153,154,171,172],[154,171,172],[98,154,159,171,172,189],[98,154,155,160,165,171,172,174,186,197],[98,154,155,156,165,171,172,174],[98,154,171,172],[98,154,157,171,172,198],[98,154,158,159,166,171,172,175],[98,154,159,171,172,186,194],[98,154,160,162,165,171,172,174],[98,153,154,161,171,172],[98,154,162,163,171,172],[98,154,164,165,171,172],[98,153,154,165,171,172],[98,154,165,166,167,171,172,186,197],[98,154,165,166,167,171,172,181,189],[98,146,154,162,165,168,171,172,174,186,197],[98,154,165,166,168,169,171,172,174,186,194,197],[98,154,168,170,171,172,186,194,197],[96,97,98,99,100,101,102,103,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,195,196,197,198,199,200,201,202,203],[98,154,165,171,172],[98,154,171,172,173,197],[98,154,162,165,171,172,174,186],[98,154,171,172,175],[98,154,171,172,176],[98,153,154,171,172,177],[98,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,195,196,197,198,199,200,201,202,203],[98,154,171,172,179],[98,154,171,172,180],[98,154,165,171,172,181,182],[98,154,171,172,181,183,198,200],[98,154,166,171,172],[98,154,165,171,172,186,187,189],[98,154,171,172,188,189],[98,154,171,172,186,187],[98,154,171,172,189],[98,154,171,172,190],[98,151,154,171,172,186,191,197],[98,154,165,171,172,192,193],[98,154,171,172,192,193],[98,154,159,171,172,174,186,194],[98,154,171,172,195],[98,154,171,172,174,196],[98,154,168,171,172,180,197],[98,154,159,171,172,198],[98,154,171,172,186,199],[98,154,171,172,173,200],[98,154,171,172,201],[98,154,159,171,172],[98,146,154,171,172],[98,154,171,172,202],[98,146,154,165,167,171,172,177,186,189,197,199,200,202],[98,154,171,172,186,203],[98,110,113,116,117,154,171,172,197],[98,113,154,171,172,186,197],[98,113,117,154,171,172,197],[98,154,171,172,186],[98,107,154,171,172],[98,111,154,171,172],[98,109,110,113,154,171,172,197],[98,154,171,172,174,194],[98,154,171,172,204],[98,107,154,171,172,204],[98,109,113,154,171,172,174,197],[98,104,105,106,108,112,154,165,171,172,186,197],[98,113,122,130,154,171,172],[98,105,111,154,171,172],[98,113,140,141,154,171,172],[98,105,108,113,154,171,172,189,197,204],[98,113,154,171,172],[98,109,113,154,171,172,197],[98,104,154,171,172],[98,107,108,109,111,112,113,114,115,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,141,142,143,144,145,154,171,172],[98,113,133,136,154,162,171,172],[98,113,122,123,124,154,171,172],[98,111,113,123,125,154,171,172],[98,112,154,171,172],[98,105,107,113,154,171,172],[98,113,117,123,125,154,171,172],[98,117,154,171,172],[98,111,113,116,154,171,172,197],[98,105,109,113,122,154,171,172],[98,113,133,154,171,172],[98,125,154,171,172],[98,105,109,113,117,154,171,172],[98,107,113,140,154,171,172,189,202,204],[88,98,154,171,172],[91,92,93,98,154,171,172],[88,89,90,91,92,98,154,171,172,198],[88,90,91,98,154,171,172,198],[98,154,171,172,198]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"1e9332c23e9a907175e0ffc6a49e236f97b48838cc8aec9ce7e4cec21e544b65","impliedFormat":1},{"version":"3753fbc1113dc511214802a2342280a8b284ab9094f6420e7aa171e868679f91","impliedFormat":1},{"version":"999ca32883495a866aa5737fe1babc764a469e4cde6ee6b136a4b9ae68853e4b","impliedFormat":1},{"version":"17f13ecb98cbc39243f2eee1f16d45cd8ec4706b03ee314f1915f1a8b42f6984","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"0bd714129fca875f7d4c477a1a392200b0bcd13fb2e80928cd334b63830ea047","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2c9037ae6cd2c52d80ceef0b3c5ffdb488627d71529cf4f63776daf11161c9a","affectsGlobalScope":true,"impliedFormat":1},{"version":"135d5cf4d345f59f1a9caadfafcd858d3d9cc68290db616cc85797224448cccc","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc238c3f81c2984751932b6aab223cd5b830e0ac6cad76389e5e9d2ffc03287d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4a07f9b76d361f572620927e5735b77d6d2101c23cdd94383eb5b706e7b36357","affectsGlobalScope":true,"impliedFormat":1},{"version":"7c4e8dc6ab834cc6baa0227e030606d29e3e8449a9f67cdf5605ea5493c4db29","affectsGlobalScope":true,"impliedFormat":1},{"version":"de7ba0fd02e06cd9a5bd4ab441ed0e122735786e67dde1e849cced1cd8b46b78","affectsGlobalScope":true,"impliedFormat":1},{"version":"6148e4e88d720a06855071c3db02069434142a8332cf9c182cda551adedf3156","affectsGlobalScope":true,"impliedFormat":1},{"version":"d63dba625b108316a40c95a4425f8d4294e0deeccfd6c7e59d819efa19e23409","affectsGlobalScope":true,"impliedFormat":1},{"version":"0568d6befee03dd435bed4fc25c4e46865b24bdcb8c563fdc21f580a2c301904","affectsGlobalScope":true,"impliedFormat":1},{"version":"30d62269b05b584741f19a5369852d5d34895aa2ac4fd948956f886d15f9cc0d","affectsGlobalScope":true,"impliedFormat":1},{"version":"f128dae7c44d8f35ee42e0a437000a57c9f06cc04f8b4fb42eebf44954d53dc8","affectsGlobalScope":true,"impliedFormat":1},{"version":"ffbe6d7b295306b2ba88030f65b74c107d8d99bdcf596ea99c62a02f606108b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"996fb27b15277369c68a4ba46ed138b4e9e839a02fb4ec756f7997629242fd9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"79b712591b270d4778c89706ca2cfc56ddb8c3f895840e477388f1710dc5eda9","affectsGlobalScope":true,"impliedFormat":1},{"version":"20884846cef428b992b9bd032e70a4ef88e349263f63aeddf04dda837a7dba26","affectsGlobalScope":true,"impliedFormat":1},{"version":"5fcab789c73a97cd43828ee3cc94a61264cf24d4c44472ce64ced0e0f148bdb2","affectsGlobalScope":true,"impliedFormat":1},{"version":"db59a81f070c1880ad645b2c0275022baa6a0c4f0acdc58d29d349c6efcf0903","affectsGlobalScope":true,"impliedFormat":1},{"version":"673294292640f5722b700e7d814e17aaf7d93f83a48a2c9b38f33cbc940ad8b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d786b48f934cbca483b3c6d0a798cb43bbb4ada283e76fb22c28e53ae05b9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ecb8e347cb6b2a8927c09b86263663289418df375f5e68e11a0ae683776978f","affectsGlobalScope":true,"impliedFormat":1},{"version":"142efd4ce210576f777dc34df121777be89eda476942d6d6663b03dcb53be3ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"379bc41580c2d774f82e828c70308f24a005b490c25ba34d679d84bcf05c3d9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"ed484fb2aa8a1a23d0277056ec3336e0a0b52f9b8d6a961f338a642faf43235d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ffedae1d1c2d53fdbca1c96d3c7dda544281f7d262f99b6880634f8fd8d9820","affectsGlobalScope":true,"impliedFormat":1},{"version":"83a730b125d477dd264df8ba479afab27a3dae7152b005c214ab94dc7ee44fd3","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"d81058d46be65e4bbcb2b1db7eff666a1e284a34be5db425fb853b9017f3675e","signature":"a1d7d48b23f2635609ae4b0ccbb0609e390b5e9ac66657972bde243dd5856f21"},{"version":"d7a5d5e2b7490642068d91712810f3c9b4e2592d62b10a0ea1da96b4f589f733","signature":"af886970bfddb1846a8a973a9d13a6b4b177b61b948dd5cf2dfbf78f7340be6c"},{"version":"9977fe5bf1c8b6f77902460750642be4e6ba3e2a7a2aa6fe9422a0544455a6fc","signature":"b92f160bd92a99e6c2572c5a8431ed8becb6ab3247d1689890a7912d79136e24"},{"version":"0978ab9318d655c0a9abfbdcefd57688ec241e3c6eeacab0b82ff864c93e7e9d","signature":"202d8fa2b94fbcc223ad0c887b195aeaacd4299ff03f38307eb1b9917d1a7a2a"},{"version":"97666ab2860f54855cb80a8a429db1a51bbea8e2730f100bde3910ee7288e6ad","signature":"4c92645cc871c1a57d566439061310a6e79e2dcee2370ac1df2cdefcd82a82bf"},{"version":"6eb131811f42e6dc062ecaec82e7952c3ad0bcc136b48ae8d628891522112352","signature":"da96b8a7e5a0be50c1ae43c480f5b6ed0b4832a4c4c3aa4162d97f1ce5956ac2"},"d7f9dcb45844e53de3f82cb962a78a8561365a73948f95a24bf36f96ae170402",{"version":"cdd2612b842cd241c5e2031b8546e8007377ef5400b94bfcefc0fa30a102ede9","signature":"3f5d11cbc96b1f8a3196a39878dfb680ecdb6cd0ff3023bde44808127ddbcfe2"},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"378281aa35786c27d5811af7e6bcaa492eebd0c7013d48137c35bbc69a2b9751","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb9de9c4763c447e2fda608854ad494c4a99e10dff9862e2ac437edbd477acab","affectsGlobalScope":true,"impliedFormat":1},{"version":"1b2dd1cbeb0cc6ae20795958ba5950395ebb2849b7c8326853dd15530c77ab0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"387a023d363f755eb63450a66c28b14cdd7bc30a104565e2dbf0a8988bb4a56c","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"156a859e21ef3244d13afeeba4e49760a6afa035c149dda52f0c45ea8903b338","impliedFormat":1},{"version":"10ec5e82144dfac6f04fa5d1d6c11763b3e4dbbac6d99101427219ab3e2ae887","impliedFormat":1},{"version":"615754924717c0b1e293e083b83503c0a872717ad5aa60ed7f1a699eb1b4ea5c","impliedFormat":1},{"version":"14e9acf826baba0ef4b5665704084896e7bcc06f65a9ab13af7e93d27d6b7069","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"21adf13435b9b748529c8cedf80f884e5130b9684188120a686cd2b26a2059c7","impliedFormat":1},{"version":"eec76bf6b9346f3f95fa402621b889489e96930e72295b0369022f332e9b4a6a","impliedFormat":1},{"version":"0ecd58f413f9bc3b7d4383eae31b0c8fc576985cd7404d6f99f8c643543ade74","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"9c32412007b5662fd34a8eb04292fb5314ec370d7016d1c2fb8aa193c807fe22","impliedFormat":1},{"version":"7fd1b31fd35876b0aa650811c25ec2c97a3c6387e5473eb18004bed86cdd76b6","impliedFormat":1},{"version":"4d327f7d72ad0918275cea3eee49a6a8dc8114ae1d5b7f3f5d0774de75f7439a","impliedFormat":1},{"version":"6ebe8ebb8659aaa9d1acbf3710d7dae3e923e97610238b9511c25dc39023a166","impliedFormat":1},{"version":"e85d7f8068f6a26710bff0cc8c0fc5e47f71089c3780fbede05857331d2ddec9","impliedFormat":1},{"version":"7befaf0e76b5671be1d47b77fcc65f2b0aad91cc26529df1904f4a7c46d216e9","impliedFormat":1},{"version":"0a60a292b89ca7218b8616f78e5bbd1c96b87e048849469cccb4355e98af959a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"5b03a034c72146b61573aab280f295b015b9168470f2df05f6080a2122f9b4df","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"249b9cab7f5d628b71308c7d9bb0a808b50b091e640ba3ed6e2d0516f4a8d91d","impliedFormat":1},{"version":"d33ce35e3f9cfcc1d94eca415bdd3bde94d5b153ffdd33e6c4455c029986c630","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"8aee8b6d4f9f62cf3776cda1305fb18763e2aade7e13cea5bbe699112df85214","impliedFormat":1},{"version":"98498b101803bb3dde9f76a56e65c14b75db1cc8bec5f4db72be541570f74fc5","impliedFormat":1},{"version":"4dc59f6e1dbf3d5f66660fceabe6c174d3261b37b696ae1854f0dbaf255fc753","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"436d7b4543b340b0f3eef4310d524242e41369b9652aa9c70428767c4dcac455","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"12950411eeab8563b349cb7959543d92d8d02c289ed893d78499a19becb5a8cc","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"114f493b30f364255290472111b5a4791d5902c308645670cd0401429cbc6930","impliedFormat":1},{"version":"f724236417941ea77ec8d38c6b7021f5fb7f8521c7f8c1538e87661f2c6a0774","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d97fb21da858fb18b8ae72c314e9743fd52f73ebe2764e12af1db32fc03f853f","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ea15fd99b2e34cb25fe8346c955000bb70c8b423ae4377a972ef46bfb37f595","impliedFormat":1},{"version":"7cf69dd5502c41644c9e5106210b5da7144800670cbe861f66726fa209e231c4","impliedFormat":1},{"version":"31a2721bfdb4eaf3af1168396bdc307d14892074aa64801ac975aa9809a1727f","impliedFormat":1},{"version":"01b30c21189d840c5133bd8d250d70c9e8f389884b00e66b093579b49a7cfd4c","affectsGlobalScope":true,"impliedFormat":1},{"version":"45660ca397a0254c7ed61255fe8174ac0951452e4565207d41313b6fbf5b8431","impliedFormat":1},{"version":"51aecd2df90a3cffea1eb4696b33b2d78594ea2aa2138e6b9471ec4841c6c2ee","impliedFormat":1},{"version":"9d8f9e63e29a3396285620908e7f14d874d066caea747dc4b2c378f0599166b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"3b909f9fa68b102e393d86d11f605ea14fe736d69374bd88a1c1e6fb6898f5d6","impliedFormat":1},{"version":"53880a6a8e7ca1536d25eed26f1a74bb893711d7395db74d5a329f8e074a576f","impliedFormat":1},{"version":"9f39e70a354d0fba29ac3cdf6eca00b7f9e96f64b2b2780c432e8ea27f133743","impliedFormat":1},{"version":"cb7ac5f8e38b425e4cc4619bdb9895ceb94b364be8b462f8cf220c2e0963bd75","impliedFormat":1},{"version":"b5cc0993d6853c829184f119e49176bb43061cd0dbcb2192d296f7221b4d7b11","impliedFormat":1},{"version":"1cbdcdef62bf42688e5d825898c3a59458466c48ad8a4ef3f88d8a1cd04310d6","impliedFormat":1},{"version":"1049c567c0a6244b69738cdd83edce170b8d5ca941817cf185f7f55c28b3feb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"e6a2a1eecdb48e9a9eb36d115e212664f20710530e5ec32bbea84bf36979d2c7","impliedFormat":1},{"version":"1e7e5eaeb0526d12e8bc859e537c65779e673d4beb94615da7f062a8bce2fd96","impliedFormat":1},{"version":"06c12e208576282dfd4aa04cc47ae3447008fdf79a360a9b0f3a6fb940960cd1","impliedFormat":1},{"version":"f952e6977043709c36ea7d9f626219f7bcb066b0da6277257eea0d2ec76123ce","impliedFormat":1},{"version":"0c50296ee73dae94efc3f0da4936b1146ca6ce2217acfabb44c19c9a33fa30e5","impliedFormat":1},{"version":"6a4b62da0425ae60eefe00841578be0244a8888a62593a843369c9c311f15eee","impliedFormat":1},{"version":"4dbd12e59b970f64303e68820f395a169e512e48eecd360305591be83592b80d","impliedFormat":1},{"version":"2d25328278ab945e6ad1e73d831a9e79ba274cb994ebc0470f29c08d2550bcd2","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd541a9b163154df9713f5669c157e330f6957f44915a097c4d99e9f4df616dd","impliedFormat":1},{"version":"3e294a1b71ea288a0796d374118150455e8019dbffcf8b4124faaf9721d29a8c","impliedFormat":1},{"version":"04bf1aa481d1adfb16d93d76e44ce71c51c8ef68039d849926551199489637f6","impliedFormat":1},{"version":"0343687443e7684643e8349cb178f2f9bbdeed2ab53445b0f2870ccda91d274d","affectsGlobalScope":true,"impliedFormat":1},{"version":"614d31f77751e038f30e01641443df8591e12b337c675a44f70675fd5dbf5ae9","affectsGlobalScope":true,"impliedFormat":1},{"version":"a58a15da4c5ba3df60c910a043281256fa52d36a0fcdef9b9100c646282e88dd","impliedFormat":1},{"version":"b36beffbf8acdc3ebc58c8bb4b75574b31a2169869c70fc03f82895b93950a12","impliedFormat":1},{"version":"42a350ce4f6f291198dc89833afcc4fd078248b4e1fdc9d05c846c66a670f710","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"8c81fd4a110490c43d7c578e8c6f69b3af01717189196899a6a44f93daa57a3a","impliedFormat":1},{"version":"5fb39858b2459864b139950a09adae4f38dad87c25bf572ce414f10e4bd7baab","impliedFormat":1},{"version":"9ba17a5bdbeb17c5584000b1ae4b3552116f2151f6c04830c070ef36bf4cecec","impliedFormat":1},{"version":"d30fbda663d9683468f519de4062e4a59a1a318b8b1c9e5a8e30073d6bff4b1d","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"3f87014045740d3df7752b1dd6a6d8c245fb646104471dda177e7ce41b6cb296","impliedFormat":1},{"version":"6e11fd90418aae21a4b5f9f8fb79b7d920143486b2a5911c9eed377ab71fe5c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"c119835edf36415081dfd9ed15fc0cd37aaa28d232be029ad073f15f3d88c323","impliedFormat":1},{"version":"f75d37a23477e13019deb34401bac250666de0bca64de6b41698d90bfb3b3db0","impliedFormat":1},{"version":"9705cd157ffbb91c5cab48bdd2de5a437a372e63f870f8a8472e72ff634d47c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ae86f30d5d10e4f75ce8dcb6e1bd3a12ecec3d071a21e8f462c5c85c678efb41","impliedFormat":1},{"version":"10eb385d3120c6c5981249af7ec214a6756b0f40e8bb3d184be3d0457b67b2d9","impliedFormat":1},{"version":"e03460fe72b259f6d25ad029f085e4bedc3f90477da4401d8fbc1efa9793230e","impliedFormat":1},{"version":"3c59c992b671e83a35dec52e894b5bfcf2dcb0104e24b3082b8c793ec3997532","impliedFormat":1},{"version":"85fb581c048b948a48842e6584d61512939566e0c7a4d6439f54902ce6c79bee","affectsGlobalScope":true,"impliedFormat":1},{"version":"673176c21f8a68d5d4e930208c6de7f49857043cc9b9c45909b30244981936b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"09c273ba5bda2a12318fbfc37433a3f45b6137a65dea55e009d1c3f7608b9965","impliedFormat":1},{"version":"bcaf6a7cda69d3744d039c864a8fa59502514a9f8d2d2b8d0107001ceb9b406f","impliedFormat":1},{"version":"0d5b085f36e6dc55bc6332ecb9c733be3a534958c238fb8d8d18d4a2b6f2a15a","impliedFormat":1},{"version":"0b0dfb2d3e8420ead06f6a11acfb02ddcec42257e6ce391993e895ba0af86de4","affectsGlobalScope":true,"impliedFormat":1},{"version":"f3b927f3f6054ebee0c7497a72c574081d21cca71d29d7996ca9aecf9f6ad80d","impliedFormat":1},{"version":"d7e9ab1b0996639047c61c1e62f85c620e4382206b3abb430d9a21fb7bc23c77","impliedFormat":1}],"root":[[88,95]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"experimentalDecorators":true,"module":200,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noUncheckedIndexedAccess":true,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../src","skipLibCheck":true,"sourceMap":true},"referencedMap":[[151,1],[152,1],[153,2],[98,3],[154,4],[155,5],[156,6],[96,7],[157,8],[158,9],[159,10],[160,11],[161,12],[162,13],[163,13],[164,14],[165,15],[166,16],[167,17],[99,7],[97,7],[168,18],[169,19],[170,20],[204,21],[171,22],[172,7],[173,23],[174,24],[175,25],[176,26],[177,27],[178,28],[179,29],[180,30],[181,31],[182,31],[183,32],[184,7],[185,33],[186,34],[188,35],[187,36],[189,37],[190,38],[191,39],[192,40],[193,41],[194,42],[195,43],[196,44],[197,45],[198,46],[199,47],[200,48],[201,49],[100,7],[101,50],[102,7],[103,7],[147,51],[148,52],[149,7],[150,37],[202,53],[203,54],[86,7],[87,7],[15,7],[14,7],[2,7],[16,7],[17,7],[18,7],[19,7],[20,7],[21,7],[22,7],[23,7],[3,7],[24,7],[25,7],[4,7],[26,7],[30,7],[27,7],[28,7],[29,7],[31,7],[32,7],[33,7],[5,7],[34,7],[35,7],[36,7],[37,7],[6,7],[41,7],[38,7],[39,7],[40,7],[42,7],[7,7],[43,7],[48,7],[49,7],[44,7],[45,7],[46,7],[47,7],[8,7],[53,7],[50,7],[51,7],[52,7],[54,7],[9,7],[55,7],[56,7],[57,7],[59,7],[58,7],[60,7],[61,7],[10,7],[62,7],[63,7],[64,7],[11,7],[65,7],[66,7],[67,7],[68,7],[69,7],[70,7],[12,7],[71,7],[72,7],[73,7],[74,7],[75,7],[1,7],[76,7],[77,7],[13,7],[78,7],[79,7],[80,7],[81,7],[82,7],[83,7],[84,7],[85,7],[122,55],[135,56],[119,57],[136,58],[145,59],[110,60],[111,61],[109,62],[144,63],[139,64],[143,65],[113,66],[132,67],[112,68],[142,69],[107,70],[108,64],[114,71],[115,7],[121,72],[118,71],[105,73],[146,74],[137,75],[125,76],[124,71],[126,77],[129,78],[123,79],[127,80],[140,63],[116,81],[117,82],[130,83],[106,58],[134,84],[133,71],[120,82],[128,85],[131,86],[138,7],[104,7],[141,87],[89,88],[90,88],[94,89],[93,90],[88,7],[92,91],[95,37],[91,92]],"latestChangedDtsFile":"./streameter.d.ts","version":"6.0.3"}
@@ -0,0 +1,20 @@
1
+ import { MIMEType } from 'node:util';
2
+ export type Entry = AsyncGenerator<Entry.Part, void, void>;
3
+ export declare namespace Entry {
4
+ type Part = Part.Name | Part.Filename | Part.Body;
5
+ namespace Part {
6
+ interface Name {
7
+ type: 'name';
8
+ chunks: ReadableStream<Uint8Array>;
9
+ }
10
+ interface Filename {
11
+ type: 'filename';
12
+ chunks: ReadableStream<Uint8Array>;
13
+ }
14
+ interface Body {
15
+ type: 'body';
16
+ contentType: MIMEType;
17
+ chunks: ReadableStream<Uint8Array>;
18
+ }
19
+ }
20
+ }
package/build/types.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "@zimtsui/form-stream",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
4
+ "exports": {
5
+ ".": "./build/exports.js",
6
+ "./meter": "./build/streameter.js"
7
+ },
8
+ "description": "",
9
+ "type": "module",
10
+ "engines": {
11
+ "node": ">=24"
12
+ },
13
+ "scripts": {
14
+ "test": "echo \"Error: no test specified\" && exit 1",
15
+ "build": "tsc -b ./src/tsconfig.json",
16
+ "clean": "rm -rf ./build",
17
+ "prepack": "npm run clean && npm run build"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/zimtsui/form-stream.git"
22
+ },
23
+ "author": "Zim",
24
+ "devDependencies": {
25
+ "typescript": "^6.0.3"
26
+ },
27
+ "dependencies": {
28
+ "@types/node": "^24.19.2"
29
+ }
30
+ }