@slicemachine/manager 0.1.1-dev-plugins.3 → 0.1.1-dev-plugins.5

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.
Files changed (157) hide show
  1. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.cjs +65 -0
  2. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.cjs.map +1 -0
  3. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.js +65 -0
  4. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/CachedKeyDecoder.js.map +1 -0
  5. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.cjs +40 -0
  6. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.cjs.map +1 -0
  7. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.js +40 -0
  8. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/DecodeError.js.map +1 -0
  9. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.cjs +801 -0
  10. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.cjs.map +1 -0
  11. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.js +801 -0
  12. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Decoder.js.map +1 -0
  13. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.cjs +351 -0
  14. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.cjs.map +1 -0
  15. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.js +351 -0
  16. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/Encoder.js.map +1 -0
  17. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.cjs +11 -0
  18. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.cjs.map +1 -0
  19. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.js +11 -0
  20. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtData.js.map +1 -0
  21. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.cjs +62 -0
  22. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.cjs.map +1 -0
  23. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.js +62 -0
  24. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/ExtensionCodec.js.map +1 -0
  25. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/decode.cjs +14 -0
  26. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/decode.cjs.map +1 -0
  27. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/decode.js +14 -0
  28. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/decode.js.map +1 -0
  29. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/encode.cjs +13 -0
  30. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/encode.cjs.map +1 -0
  31. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/encode.js +13 -0
  32. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/encode.js.map +1 -0
  33. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.cjs +91 -0
  34. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.cjs.map +1 -0
  35. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.js +91 -0
  36. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/timestamp.js.map +1 -0
  37. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.cjs +31 -0
  38. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.cjs.map +1 -0
  39. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.js +31 -0
  40. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/int.js.map +1 -0
  41. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.cjs +7 -0
  42. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.cjs.map +1 -0
  43. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.js +7 -0
  44. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/prettyByte.js.map +1 -0
  45. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.cjs +23 -0
  46. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.cjs.map +1 -0
  47. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.js +23 -0
  48. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/typedArrays.js.map +1 -0
  49. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.cjs +132 -0
  50. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.cjs.map +1 -0
  51. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.js +132 -0
  52. package/dist/__node_modules/@msgpack/msgpack/dist.es5_esm/utils/utf8.js.map +1 -0
  53. package/dist/__node_modules/r19/dist/client/createRPCClient.cjs +29 -11
  54. package/dist/__node_modules/r19/dist/client/createRPCClient.cjs.map +1 -1
  55. package/dist/__node_modules/r19/dist/client/createRPCClient.js +29 -11
  56. package/dist/__node_modules/r19/dist/client/createRPCClient.js.map +1 -1
  57. package/dist/__node_modules/r19/dist/createRPCMiddleware.cjs +5 -4
  58. package/dist/__node_modules/r19/dist/createRPCMiddleware.cjs.map +1 -1
  59. package/dist/__node_modules/r19/dist/createRPCMiddleware.js +6 -5
  60. package/dist/__node_modules/r19/dist/createRPCMiddleware.js.map +1 -1
  61. package/dist/__node_modules/r19/dist/handleRPCRequest.cjs +39 -110
  62. package/dist/__node_modules/r19/dist/handleRPCRequest.cjs.map +1 -1
  63. package/dist/__node_modules/r19/dist/handleRPCRequest.js +39 -110
  64. package/dist/__node_modules/r19/dist/handleRPCRequest.js.map +1 -1
  65. package/dist/__node_modules/r19/dist/lib/replaceLeaves.cjs +28 -0
  66. package/dist/__node_modules/r19/dist/lib/replaceLeaves.cjs.map +1 -0
  67. package/dist/__node_modules/r19/dist/lib/replaceLeaves.js +28 -0
  68. package/dist/__node_modules/r19/dist/lib/replaceLeaves.js.map +1 -0
  69. package/dist/managers/createSliceMachineManagerMiddleware.cjs +0 -4
  70. package/dist/managers/createSliceMachineManagerMiddleware.cjs.map +1 -1
  71. package/dist/managers/createSliceMachineManagerMiddleware.js +0 -4
  72. package/dist/managers/createSliceMachineManagerMiddleware.js.map +1 -1
  73. package/dist/managers/screenshots/ScreenshotsManager.cjs +33 -16
  74. package/dist/managers/screenshots/ScreenshotsManager.cjs.map +1 -1
  75. package/dist/managers/screenshots/ScreenshotsManager.d.ts +2 -4
  76. package/dist/managers/screenshots/ScreenshotsManager.js +34 -17
  77. package/dist/managers/screenshots/ScreenshotsManager.js.map +1 -1
  78. package/dist/test/createSliceMachineManagerMSWHandler.cjs +3 -10
  79. package/dist/test/createSliceMachineManagerMSWHandler.cjs.map +1 -1
  80. package/dist/test/createSliceMachineManagerMSWHandler.js +3 -10
  81. package/dist/test/createSliceMachineManagerMSWHandler.js.map +1 -1
  82. package/package.json +4 -4
  83. package/src/client/index.ts +1 -1
  84. package/src/managers/screenshots/ScreenshotsManager.ts +65 -18
  85. package/src/test/createSliceMachineManagerMSWHandler.ts +2 -14
  86. package/dist/__node_modules/busboy/lib/index.cjs +0 -51
  87. package/dist/__node_modules/busboy/lib/index.cjs.map +0 -1
  88. package/dist/__node_modules/busboy/lib/index.js +0 -52
  89. package/dist/__node_modules/busboy/lib/index.js.map +0 -1
  90. package/dist/__node_modules/busboy/lib/types/multipart.cjs +0 -1046
  91. package/dist/__node_modules/busboy/lib/types/multipart.cjs.map +0 -1
  92. package/dist/__node_modules/busboy/lib/types/multipart.js +0 -1047
  93. package/dist/__node_modules/busboy/lib/types/multipart.js.map +0 -1
  94. package/dist/__node_modules/busboy/lib/types/urlencoded.cjs +0 -545
  95. package/dist/__node_modules/busboy/lib/types/urlencoded.cjs.map +0 -1
  96. package/dist/__node_modules/busboy/lib/types/urlencoded.js +0 -546
  97. package/dist/__node_modules/busboy/lib/types/urlencoded.js.map +0 -1
  98. package/dist/__node_modules/busboy/lib/utils.cjs +0 -1681
  99. package/dist/__node_modules/busboy/lib/utils.cjs.map +0 -1
  100. package/dist/__node_modules/busboy/lib/utils.js +0 -1682
  101. package/dist/__node_modules/busboy/lib/utils.js.map +0 -1
  102. package/dist/__node_modules/devalue/src/constants.cjs +0 -15
  103. package/dist/__node_modules/devalue/src/constants.cjs.map +0 -1
  104. package/dist/__node_modules/devalue/src/constants.js +0 -15
  105. package/dist/__node_modules/devalue/src/constants.js.map +0 -1
  106. package/dist/__node_modules/devalue/src/parse.cjs +0 -95
  107. package/dist/__node_modules/devalue/src/parse.cjs.map +0 -1
  108. package/dist/__node_modules/devalue/src/parse.js +0 -95
  109. package/dist/__node_modules/devalue/src/parse.js.map +0 -1
  110. package/dist/__node_modules/devalue/src/stringify.cjs +0 -140
  111. package/dist/__node_modules/devalue/src/stringify.cjs.map +0 -1
  112. package/dist/__node_modules/devalue/src/stringify.js +0 -140
  113. package/dist/__node_modules/devalue/src/stringify.js.map +0 -1
  114. package/dist/__node_modules/devalue/src/uneval.cjs +0 -4
  115. package/dist/__node_modules/devalue/src/uneval.cjs.map +0 -1
  116. package/dist/__node_modules/devalue/src/uneval.js +0 -3
  117. package/dist/__node_modules/devalue/src/uneval.js.map +0 -1
  118. package/dist/__node_modules/devalue/src/utils.cjs +0 -68
  119. package/dist/__node_modules/devalue/src/utils.cjs.map +0 -1
  120. package/dist/__node_modules/devalue/src/utils.js +0 -68
  121. package/dist/__node_modules/devalue/src/utils.js.map +0 -1
  122. package/dist/__node_modules/formdata-node/lib/browser.cjs +0 -16
  123. package/dist/__node_modules/formdata-node/lib/browser.cjs.map +0 -1
  124. package/dist/__node_modules/formdata-node/lib/browser.js +0 -16
  125. package/dist/__node_modules/formdata-node/lib/browser.js.map +0 -1
  126. package/dist/__node_modules/r19/dist/constants.cjs +0 -5
  127. package/dist/__node_modules/r19/dist/constants.cjs.map +0 -1
  128. package/dist/__node_modules/r19/dist/constants.js +0 -5
  129. package/dist/__node_modules/r19/dist/constants.js.map +0 -1
  130. package/dist/__node_modules/r19/dist/lib/encodeFormData.cjs +0 -46
  131. package/dist/__node_modules/r19/dist/lib/encodeFormData.cjs.map +0 -1
  132. package/dist/__node_modules/r19/dist/lib/encodeFormData.js +0 -46
  133. package/dist/__node_modules/r19/dist/lib/encodeFormData.js.map +0 -1
  134. package/dist/__node_modules/r19/dist/lib/flattenObject.cjs +0 -43
  135. package/dist/__node_modules/r19/dist/lib/flattenObject.cjs.map +0 -1
  136. package/dist/__node_modules/r19/dist/lib/flattenObject.js +0 -43
  137. package/dist/__node_modules/r19/dist/lib/flattenObject.js.map +0 -1
  138. package/dist/__node_modules/r19/dist/lib/formDataToObject.client.cjs +0 -19
  139. package/dist/__node_modules/r19/dist/lib/formDataToObject.client.cjs.map +0 -1
  140. package/dist/__node_modules/r19/dist/lib/formDataToObject.client.js +0 -19
  141. package/dist/__node_modules/r19/dist/lib/formDataToObject.client.js.map +0 -1
  142. package/dist/__node_modules/r19/dist/lib/objectToFormData.client.cjs +0 -20
  143. package/dist/__node_modules/r19/dist/lib/objectToFormData.client.cjs.map +0 -1
  144. package/dist/__node_modules/r19/dist/lib/objectToFormData.client.js +0 -20
  145. package/dist/__node_modules/r19/dist/lib/objectToFormData.client.js.map +0 -1
  146. package/dist/__node_modules/r19/dist/lib/objectToFormData.server.cjs +0 -22
  147. package/dist/__node_modules/r19/dist/lib/objectToFormData.server.cjs.map +0 -1
  148. package/dist/__node_modules/r19/dist/lib/objectToFormData.server.js +0 -22
  149. package/dist/__node_modules/r19/dist/lib/objectToFormData.server.js.map +0 -1
  150. package/dist/__node_modules/r19/dist/lib/unflattenObject.cjs +0 -20
  151. package/dist/__node_modules/r19/dist/lib/unflattenObject.cjs.map +0 -1
  152. package/dist/__node_modules/r19/dist/lib/unflattenObject.js +0 -20
  153. package/dist/__node_modules/r19/dist/lib/unflattenObject.js.map +0 -1
  154. package/dist/__node_modules/streamsearch/lib/sbmh.cjs +0 -393
  155. package/dist/__node_modules/streamsearch/lib/sbmh.cjs.map +0 -1
  156. package/dist/__node_modules/streamsearch/lib/sbmh.js +0 -394
  157. package/dist/__node_modules/streamsearch/lib/sbmh.js.map +0 -1
@@ -1,1047 +0,0 @@
1
- import require$$0 from "stream";
2
- import sbmh from "../../../streamsearch/lib/sbmh.js";
3
- import utils from "../utils.js";
4
- const { Readable, Writable } = require$$0;
5
- const StreamSearch = sbmh;
6
- const {
7
- basename,
8
- convertToUTF8,
9
- getDecoder,
10
- parseContentType,
11
- parseDisposition
12
- } = utils;
13
- const BUF_CRLF = Buffer.from("\r\n");
14
- const BUF_CR = Buffer.from("\r");
15
- const BUF_DASH = Buffer.from("-");
16
- function noop() {
17
- }
18
- const MAX_HEADER_PAIRS = 2e3;
19
- const MAX_HEADER_SIZE = 16 * 1024;
20
- const HPARSER_NAME = 0;
21
- const HPARSER_PRE_OWS = 1;
22
- const HPARSER_VALUE = 2;
23
- class HeaderParser {
24
- constructor(cb) {
25
- this.header = /* @__PURE__ */ Object.create(null);
26
- this.pairCount = 0;
27
- this.byteCount = 0;
28
- this.state = HPARSER_NAME;
29
- this.name = "";
30
- this.value = "";
31
- this.crlf = 0;
32
- this.cb = cb;
33
- }
34
- reset() {
35
- this.header = /* @__PURE__ */ Object.create(null);
36
- this.pairCount = 0;
37
- this.byteCount = 0;
38
- this.state = HPARSER_NAME;
39
- this.name = "";
40
- this.value = "";
41
- this.crlf = 0;
42
- }
43
- push(chunk, pos, end) {
44
- let start = pos;
45
- while (pos < end) {
46
- switch (this.state) {
47
- case HPARSER_NAME: {
48
- let done = false;
49
- for (; pos < end; ++pos) {
50
- if (this.byteCount === MAX_HEADER_SIZE)
51
- return -1;
52
- ++this.byteCount;
53
- const code = chunk[pos];
54
- if (TOKEN[code] !== 1) {
55
- if (code !== 58)
56
- return -1;
57
- this.name += chunk.latin1Slice(start, pos);
58
- if (this.name.length === 0)
59
- return -1;
60
- ++pos;
61
- done = true;
62
- this.state = HPARSER_PRE_OWS;
63
- break;
64
- }
65
- }
66
- if (!done) {
67
- this.name += chunk.latin1Slice(start, pos);
68
- break;
69
- }
70
- }
71
- case HPARSER_PRE_OWS: {
72
- let done = false;
73
- for (; pos < end; ++pos) {
74
- if (this.byteCount === MAX_HEADER_SIZE)
75
- return -1;
76
- ++this.byteCount;
77
- const code = chunk[pos];
78
- if (code !== 32 && code !== 9) {
79
- start = pos;
80
- done = true;
81
- this.state = HPARSER_VALUE;
82
- break;
83
- }
84
- }
85
- if (!done)
86
- break;
87
- }
88
- case HPARSER_VALUE:
89
- switch (this.crlf) {
90
- case 0:
91
- for (; pos < end; ++pos) {
92
- if (this.byteCount === MAX_HEADER_SIZE)
93
- return -1;
94
- ++this.byteCount;
95
- const code = chunk[pos];
96
- if (FIELD_VCHAR[code] !== 1) {
97
- if (code !== 13)
98
- return -1;
99
- ++this.crlf;
100
- break;
101
- }
102
- }
103
- this.value += chunk.latin1Slice(start, pos++);
104
- break;
105
- case 1:
106
- if (this.byteCount === MAX_HEADER_SIZE)
107
- return -1;
108
- ++this.byteCount;
109
- if (chunk[pos++] !== 10)
110
- return -1;
111
- ++this.crlf;
112
- break;
113
- case 2: {
114
- if (this.byteCount === MAX_HEADER_SIZE)
115
- return -1;
116
- ++this.byteCount;
117
- const code = chunk[pos];
118
- if (code === 32 || code === 9) {
119
- start = pos;
120
- this.crlf = 0;
121
- } else {
122
- if (++this.pairCount < MAX_HEADER_PAIRS) {
123
- this.name = this.name.toLowerCase();
124
- if (this.header[this.name] === void 0)
125
- this.header[this.name] = [this.value];
126
- else
127
- this.header[this.name].push(this.value);
128
- }
129
- if (code === 13) {
130
- ++this.crlf;
131
- ++pos;
132
- } else {
133
- start = pos;
134
- this.crlf = 0;
135
- this.state = HPARSER_NAME;
136
- this.name = "";
137
- this.value = "";
138
- }
139
- }
140
- break;
141
- }
142
- case 3: {
143
- if (this.byteCount === MAX_HEADER_SIZE)
144
- return -1;
145
- ++this.byteCount;
146
- if (chunk[pos++] !== 10)
147
- return -1;
148
- const header = this.header;
149
- this.reset();
150
- this.cb(header);
151
- return pos;
152
- }
153
- }
154
- break;
155
- }
156
- }
157
- return pos;
158
- }
159
- }
160
- class FileStream extends Readable {
161
- constructor(opts, owner) {
162
- super(opts);
163
- this.truncated = false;
164
- this._readcb = null;
165
- this.once("end", () => {
166
- this._read();
167
- if (--owner._fileEndsLeft === 0 && owner._finalcb) {
168
- const cb = owner._finalcb;
169
- owner._finalcb = null;
170
- process.nextTick(cb);
171
- }
172
- });
173
- }
174
- _read(n) {
175
- const cb = this._readcb;
176
- if (cb) {
177
- this._readcb = null;
178
- cb();
179
- }
180
- }
181
- }
182
- const ignoreData = {
183
- push: (chunk, pos) => {
184
- },
185
- destroy: () => {
186
- }
187
- };
188
- function callAndUnsetCb(self, err) {
189
- const cb = self._writecb;
190
- self._writecb = null;
191
- if (err)
192
- self.destroy(err);
193
- else if (cb)
194
- cb();
195
- }
196
- function nullDecoder(val, hint) {
197
- return val;
198
- }
199
- class Multipart extends Writable {
200
- constructor(cfg) {
201
- const streamOpts = {
202
- autoDestroy: true,
203
- emitClose: true,
204
- highWaterMark: typeof cfg.highWaterMark === "number" ? cfg.highWaterMark : void 0
205
- };
206
- super(streamOpts);
207
- if (!cfg.conType.params || typeof cfg.conType.params.boundary !== "string")
208
- throw new Error("Multipart: Boundary not found");
209
- const boundary = cfg.conType.params.boundary;
210
- const paramDecoder = typeof cfg.defParamCharset === "string" && cfg.defParamCharset ? getDecoder(cfg.defParamCharset) : nullDecoder;
211
- const defCharset = cfg.defCharset || "utf8";
212
- const preservePath = cfg.preservePath;
213
- const fileOpts = {
214
- autoDestroy: true,
215
- emitClose: true,
216
- highWaterMark: typeof cfg.fileHwm === "number" ? cfg.fileHwm : void 0
217
- };
218
- const limits = cfg.limits;
219
- const fieldSizeLimit = limits && typeof limits.fieldSize === "number" ? limits.fieldSize : 1 * 1024 * 1024;
220
- const fileSizeLimit = limits && typeof limits.fileSize === "number" ? limits.fileSize : Infinity;
221
- const filesLimit = limits && typeof limits.files === "number" ? limits.files : Infinity;
222
- const fieldsLimit = limits && typeof limits.fields === "number" ? limits.fields : Infinity;
223
- const partsLimit = limits && typeof limits.parts === "number" ? limits.parts : Infinity;
224
- let parts = -1;
225
- let fields = 0;
226
- let files = 0;
227
- let skipPart = false;
228
- this._fileEndsLeft = 0;
229
- this._fileStream = void 0;
230
- this._complete = false;
231
- let fileSize = 0;
232
- let field;
233
- let fieldSize = 0;
234
- let partCharset;
235
- let partEncoding;
236
- let partType;
237
- let partName;
238
- let partTruncated = false;
239
- let hitFilesLimit = false;
240
- let hitFieldsLimit = false;
241
- this._hparser = null;
242
- const hparser = new HeaderParser((header) => {
243
- this._hparser = null;
244
- skipPart = false;
245
- partType = "text/plain";
246
- partCharset = defCharset;
247
- partEncoding = "7bit";
248
- partName = void 0;
249
- partTruncated = false;
250
- let filename;
251
- if (!header["content-disposition"]) {
252
- skipPart = true;
253
- return;
254
- }
255
- const disp = parseDisposition(
256
- header["content-disposition"][0],
257
- paramDecoder
258
- );
259
- if (!disp || disp.type !== "form-data") {
260
- skipPart = true;
261
- return;
262
- }
263
- if (disp.params) {
264
- if (disp.params.name)
265
- partName = disp.params.name;
266
- if (disp.params["filename*"])
267
- filename = disp.params["filename*"];
268
- else if (disp.params.filename)
269
- filename = disp.params.filename;
270
- if (filename !== void 0 && !preservePath)
271
- filename = basename(filename);
272
- }
273
- if (header["content-type"]) {
274
- const conType = parseContentType(header["content-type"][0]);
275
- if (conType) {
276
- partType = `${conType.type}/${conType.subtype}`;
277
- if (conType.params && typeof conType.params.charset === "string")
278
- partCharset = conType.params.charset.toLowerCase();
279
- }
280
- }
281
- if (header["content-transfer-encoding"])
282
- partEncoding = header["content-transfer-encoding"][0].toLowerCase();
283
- if (partType === "application/octet-stream" || filename !== void 0) {
284
- if (files === filesLimit) {
285
- if (!hitFilesLimit) {
286
- hitFilesLimit = true;
287
- this.emit("filesLimit");
288
- }
289
- skipPart = true;
290
- return;
291
- }
292
- ++files;
293
- if (this.listenerCount("file") === 0) {
294
- skipPart = true;
295
- return;
296
- }
297
- fileSize = 0;
298
- this._fileStream = new FileStream(fileOpts, this);
299
- ++this._fileEndsLeft;
300
- this.emit(
301
- "file",
302
- partName,
303
- this._fileStream,
304
- {
305
- filename,
306
- encoding: partEncoding,
307
- mimeType: partType
308
- }
309
- );
310
- } else {
311
- if (fields === fieldsLimit) {
312
- if (!hitFieldsLimit) {
313
- hitFieldsLimit = true;
314
- this.emit("fieldsLimit");
315
- }
316
- skipPart = true;
317
- return;
318
- }
319
- ++fields;
320
- if (this.listenerCount("field") === 0) {
321
- skipPart = true;
322
- return;
323
- }
324
- field = [];
325
- fieldSize = 0;
326
- }
327
- });
328
- let matchPostBoundary = 0;
329
- const ssCb = (isMatch, data, start, end, isDataSafe) => {
330
- retrydata:
331
- while (data) {
332
- if (this._hparser !== null) {
333
- const ret = this._hparser.push(data, start, end);
334
- if (ret === -1) {
335
- this._hparser = null;
336
- hparser.reset();
337
- this.emit("error", new Error("Malformed part header"));
338
- break;
339
- }
340
- start = ret;
341
- }
342
- if (start === end)
343
- break;
344
- if (matchPostBoundary !== 0) {
345
- if (matchPostBoundary === 1) {
346
- switch (data[start]) {
347
- case 45:
348
- matchPostBoundary = 2;
349
- ++start;
350
- break;
351
- case 13:
352
- matchPostBoundary = 3;
353
- ++start;
354
- break;
355
- default:
356
- matchPostBoundary = 0;
357
- }
358
- if (start === end)
359
- return;
360
- }
361
- if (matchPostBoundary === 2) {
362
- matchPostBoundary = 0;
363
- if (data[start] === 45) {
364
- this._complete = true;
365
- this._bparser = ignoreData;
366
- return;
367
- }
368
- const writecb = this._writecb;
369
- this._writecb = noop;
370
- ssCb(false, BUF_DASH, 0, 1, false);
371
- this._writecb = writecb;
372
- } else if (matchPostBoundary === 3) {
373
- matchPostBoundary = 0;
374
- if (data[start] === 10) {
375
- ++start;
376
- if (parts >= partsLimit)
377
- break;
378
- this._hparser = hparser;
379
- if (start === end)
380
- break;
381
- continue retrydata;
382
- } else {
383
- const writecb = this._writecb;
384
- this._writecb = noop;
385
- ssCb(false, BUF_CR, 0, 1, false);
386
- this._writecb = writecb;
387
- }
388
- }
389
- }
390
- if (!skipPart) {
391
- if (this._fileStream) {
392
- let chunk;
393
- const actualLen = Math.min(end - start, fileSizeLimit - fileSize);
394
- if (!isDataSafe) {
395
- chunk = Buffer.allocUnsafe(actualLen);
396
- data.copy(chunk, 0, start, start + actualLen);
397
- } else {
398
- chunk = data.slice(start, start + actualLen);
399
- }
400
- fileSize += chunk.length;
401
- if (fileSize === fileSizeLimit) {
402
- if (chunk.length > 0)
403
- this._fileStream.push(chunk);
404
- this._fileStream.emit("limit");
405
- this._fileStream.truncated = true;
406
- skipPart = true;
407
- } else if (!this._fileStream.push(chunk)) {
408
- if (this._writecb)
409
- this._fileStream._readcb = this._writecb;
410
- this._writecb = null;
411
- }
412
- } else if (field !== void 0) {
413
- let chunk;
414
- const actualLen = Math.min(
415
- end - start,
416
- fieldSizeLimit - fieldSize
417
- );
418
- if (!isDataSafe) {
419
- chunk = Buffer.allocUnsafe(actualLen);
420
- data.copy(chunk, 0, start, start + actualLen);
421
- } else {
422
- chunk = data.slice(start, start + actualLen);
423
- }
424
- fieldSize += actualLen;
425
- field.push(chunk);
426
- if (fieldSize === fieldSizeLimit) {
427
- skipPart = true;
428
- partTruncated = true;
429
- }
430
- }
431
- }
432
- break;
433
- }
434
- if (isMatch) {
435
- matchPostBoundary = 1;
436
- if (this._fileStream) {
437
- this._fileStream.push(null);
438
- this._fileStream = null;
439
- } else if (field !== void 0) {
440
- let data2;
441
- switch (field.length) {
442
- case 0:
443
- data2 = "";
444
- break;
445
- case 1:
446
- data2 = convertToUTF8(field[0], partCharset, 0);
447
- break;
448
- default:
449
- data2 = convertToUTF8(
450
- Buffer.concat(field, fieldSize),
451
- partCharset,
452
- 0
453
- );
454
- }
455
- field = void 0;
456
- fieldSize = 0;
457
- this.emit(
458
- "field",
459
- partName,
460
- data2,
461
- {
462
- nameTruncated: false,
463
- valueTruncated: partTruncated,
464
- encoding: partEncoding,
465
- mimeType: partType
466
- }
467
- );
468
- }
469
- if (++parts === partsLimit)
470
- this.emit("partsLimit");
471
- }
472
- };
473
- this._bparser = new StreamSearch(`\r
474
- --${boundary}`, ssCb);
475
- this._writecb = null;
476
- this._finalcb = null;
477
- this.write(BUF_CRLF);
478
- }
479
- static detect(conType) {
480
- return conType.type === "multipart" && conType.subtype === "form-data";
481
- }
482
- _write(chunk, enc, cb) {
483
- this._writecb = cb;
484
- this._bparser.push(chunk, 0);
485
- if (this._writecb)
486
- callAndUnsetCb(this);
487
- }
488
- _destroy(err, cb) {
489
- this._hparser = null;
490
- this._bparser = ignoreData;
491
- if (!err)
492
- err = checkEndState(this);
493
- const fileStream = this._fileStream;
494
- if (fileStream) {
495
- this._fileStream = null;
496
- fileStream.destroy(err);
497
- }
498
- cb(err);
499
- }
500
- _final(cb) {
501
- this._bparser.destroy();
502
- if (!this._complete)
503
- return cb(new Error("Unexpected end of form"));
504
- if (this._fileEndsLeft)
505
- this._finalcb = finalcb.bind(null, this, cb);
506
- else
507
- finalcb(this, cb);
508
- }
509
- }
510
- function finalcb(self, cb, err) {
511
- if (err)
512
- return cb(err);
513
- err = checkEndState(self);
514
- cb(err);
515
- }
516
- function checkEndState(self) {
517
- if (self._hparser)
518
- return new Error("Malformed part header");
519
- const fileStream = self._fileStream;
520
- if (fileStream) {
521
- self._fileStream = null;
522
- fileStream.destroy(new Error("Unexpected end of file"));
523
- }
524
- if (!self._complete)
525
- return new Error("Unexpected end of form");
526
- }
527
- const TOKEN = [
528
- 0,
529
- 0,
530
- 0,
531
- 0,
532
- 0,
533
- 0,
534
- 0,
535
- 0,
536
- 0,
537
- 0,
538
- 0,
539
- 0,
540
- 0,
541
- 0,
542
- 0,
543
- 0,
544
- 0,
545
- 0,
546
- 0,
547
- 0,
548
- 0,
549
- 0,
550
- 0,
551
- 0,
552
- 0,
553
- 0,
554
- 0,
555
- 0,
556
- 0,
557
- 0,
558
- 0,
559
- 0,
560
- 0,
561
- 1,
562
- 0,
563
- 1,
564
- 1,
565
- 1,
566
- 1,
567
- 1,
568
- 0,
569
- 0,
570
- 1,
571
- 1,
572
- 0,
573
- 1,
574
- 1,
575
- 0,
576
- 1,
577
- 1,
578
- 1,
579
- 1,
580
- 1,
581
- 1,
582
- 1,
583
- 1,
584
- 1,
585
- 1,
586
- 0,
587
- 0,
588
- 0,
589
- 0,
590
- 0,
591
- 0,
592
- 0,
593
- 1,
594
- 1,
595
- 1,
596
- 1,
597
- 1,
598
- 1,
599
- 1,
600
- 1,
601
- 1,
602
- 1,
603
- 1,
604
- 1,
605
- 1,
606
- 1,
607
- 1,
608
- 1,
609
- 1,
610
- 1,
611
- 1,
612
- 1,
613
- 1,
614
- 1,
615
- 1,
616
- 1,
617
- 1,
618
- 1,
619
- 0,
620
- 0,
621
- 0,
622
- 1,
623
- 1,
624
- 1,
625
- 1,
626
- 1,
627
- 1,
628
- 1,
629
- 1,
630
- 1,
631
- 1,
632
- 1,
633
- 1,
634
- 1,
635
- 1,
636
- 1,
637
- 1,
638
- 1,
639
- 1,
640
- 1,
641
- 1,
642
- 1,
643
- 1,
644
- 1,
645
- 1,
646
- 1,
647
- 1,
648
- 1,
649
- 1,
650
- 1,
651
- 0,
652
- 1,
653
- 0,
654
- 1,
655
- 0,
656
- 0,
657
- 0,
658
- 0,
659
- 0,
660
- 0,
661
- 0,
662
- 0,
663
- 0,
664
- 0,
665
- 0,
666
- 0,
667
- 0,
668
- 0,
669
- 0,
670
- 0,
671
- 0,
672
- 0,
673
- 0,
674
- 0,
675
- 0,
676
- 0,
677
- 0,
678
- 0,
679
- 0,
680
- 0,
681
- 0,
682
- 0,
683
- 0,
684
- 0,
685
- 0,
686
- 0,
687
- 0,
688
- 0,
689
- 0,
690
- 0,
691
- 0,
692
- 0,
693
- 0,
694
- 0,
695
- 0,
696
- 0,
697
- 0,
698
- 0,
699
- 0,
700
- 0,
701
- 0,
702
- 0,
703
- 0,
704
- 0,
705
- 0,
706
- 0,
707
- 0,
708
- 0,
709
- 0,
710
- 0,
711
- 0,
712
- 0,
713
- 0,
714
- 0,
715
- 0,
716
- 0,
717
- 0,
718
- 0,
719
- 0,
720
- 0,
721
- 0,
722
- 0,
723
- 0,
724
- 0,
725
- 0,
726
- 0,
727
- 0,
728
- 0,
729
- 0,
730
- 0,
731
- 0,
732
- 0,
733
- 0,
734
- 0,
735
- 0,
736
- 0,
737
- 0,
738
- 0,
739
- 0,
740
- 0,
741
- 0,
742
- 0,
743
- 0,
744
- 0,
745
- 0,
746
- 0,
747
- 0,
748
- 0,
749
- 0,
750
- 0,
751
- 0,
752
- 0,
753
- 0,
754
- 0,
755
- 0,
756
- 0,
757
- 0,
758
- 0,
759
- 0,
760
- 0,
761
- 0,
762
- 0,
763
- 0,
764
- 0,
765
- 0,
766
- 0,
767
- 0,
768
- 0,
769
- 0,
770
- 0,
771
- 0,
772
- 0,
773
- 0,
774
- 0,
775
- 0,
776
- 0,
777
- 0,
778
- 0,
779
- 0,
780
- 0,
781
- 0,
782
- 0,
783
- 0
784
- ];
785
- const FIELD_VCHAR = [
786
- 0,
787
- 0,
788
- 0,
789
- 0,
790
- 0,
791
- 0,
792
- 0,
793
- 0,
794
- 0,
795
- 1,
796
- 0,
797
- 0,
798
- 0,
799
- 0,
800
- 0,
801
- 0,
802
- 0,
803
- 0,
804
- 0,
805
- 0,
806
- 0,
807
- 0,
808
- 0,
809
- 0,
810
- 0,
811
- 0,
812
- 0,
813
- 0,
814
- 0,
815
- 0,
816
- 0,
817
- 0,
818
- 1,
819
- 1,
820
- 1,
821
- 1,
822
- 1,
823
- 1,
824
- 1,
825
- 1,
826
- 1,
827
- 1,
828
- 1,
829
- 1,
830
- 1,
831
- 1,
832
- 1,
833
- 1,
834
- 1,
835
- 1,
836
- 1,
837
- 1,
838
- 1,
839
- 1,
840
- 1,
841
- 1,
842
- 1,
843
- 1,
844
- 1,
845
- 1,
846
- 1,
847
- 1,
848
- 1,
849
- 1,
850
- 1,
851
- 1,
852
- 1,
853
- 1,
854
- 1,
855
- 1,
856
- 1,
857
- 1,
858
- 1,
859
- 1,
860
- 1,
861
- 1,
862
- 1,
863
- 1,
864
- 1,
865
- 1,
866
- 1,
867
- 1,
868
- 1,
869
- 1,
870
- 1,
871
- 1,
872
- 1,
873
- 1,
874
- 1,
875
- 1,
876
- 1,
877
- 1,
878
- 1,
879
- 1,
880
- 1,
881
- 1,
882
- 1,
883
- 1,
884
- 1,
885
- 1,
886
- 1,
887
- 1,
888
- 1,
889
- 1,
890
- 1,
891
- 1,
892
- 1,
893
- 1,
894
- 1,
895
- 1,
896
- 1,
897
- 1,
898
- 1,
899
- 1,
900
- 1,
901
- 1,
902
- 1,
903
- 1,
904
- 1,
905
- 1,
906
- 1,
907
- 1,
908
- 1,
909
- 1,
910
- 1,
911
- 1,
912
- 1,
913
- 0,
914
- 1,
915
- 1,
916
- 1,
917
- 1,
918
- 1,
919
- 1,
920
- 1,
921
- 1,
922
- 1,
923
- 1,
924
- 1,
925
- 1,
926
- 1,
927
- 1,
928
- 1,
929
- 1,
930
- 1,
931
- 1,
932
- 1,
933
- 1,
934
- 1,
935
- 1,
936
- 1,
937
- 1,
938
- 1,
939
- 1,
940
- 1,
941
- 1,
942
- 1,
943
- 1,
944
- 1,
945
- 1,
946
- 1,
947
- 1,
948
- 1,
949
- 1,
950
- 1,
951
- 1,
952
- 1,
953
- 1,
954
- 1,
955
- 1,
956
- 1,
957
- 1,
958
- 1,
959
- 1,
960
- 1,
961
- 1,
962
- 1,
963
- 1,
964
- 1,
965
- 1,
966
- 1,
967
- 1,
968
- 1,
969
- 1,
970
- 1,
971
- 1,
972
- 1,
973
- 1,
974
- 1,
975
- 1,
976
- 1,
977
- 1,
978
- 1,
979
- 1,
980
- 1,
981
- 1,
982
- 1,
983
- 1,
984
- 1,
985
- 1,
986
- 1,
987
- 1,
988
- 1,
989
- 1,
990
- 1,
991
- 1,
992
- 1,
993
- 1,
994
- 1,
995
- 1,
996
- 1,
997
- 1,
998
- 1,
999
- 1,
1000
- 1,
1001
- 1,
1002
- 1,
1003
- 1,
1004
- 1,
1005
- 1,
1006
- 1,
1007
- 1,
1008
- 1,
1009
- 1,
1010
- 1,
1011
- 1,
1012
- 1,
1013
- 1,
1014
- 1,
1015
- 1,
1016
- 1,
1017
- 1,
1018
- 1,
1019
- 1,
1020
- 1,
1021
- 1,
1022
- 1,
1023
- 1,
1024
- 1,
1025
- 1,
1026
- 1,
1027
- 1,
1028
- 1,
1029
- 1,
1030
- 1,
1031
- 1,
1032
- 1,
1033
- 1,
1034
- 1,
1035
- 1,
1036
- 1,
1037
- 1,
1038
- 1,
1039
- 1,
1040
- 1,
1041
- 1
1042
- ];
1043
- var multipart = Multipart;
1044
- export {
1045
- multipart as default
1046
- };
1047
- //# sourceMappingURL=multipart.js.map