@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,1046 +0,0 @@
1
- "use strict";
2
- const require$$0 = require("stream");
3
- const sbmh = require("../../../streamsearch/lib/sbmh.cjs");
4
- const utils = require("../utils.cjs");
5
- const { Readable, Writable } = require$$0;
6
- const StreamSearch = sbmh;
7
- const {
8
- basename,
9
- convertToUTF8,
10
- getDecoder,
11
- parseContentType,
12
- parseDisposition
13
- } = utils;
14
- const BUF_CRLF = Buffer.from("\r\n");
15
- const BUF_CR = Buffer.from("\r");
16
- const BUF_DASH = Buffer.from("-");
17
- function noop() {
18
- }
19
- const MAX_HEADER_PAIRS = 2e3;
20
- const MAX_HEADER_SIZE = 16 * 1024;
21
- const HPARSER_NAME = 0;
22
- const HPARSER_PRE_OWS = 1;
23
- const HPARSER_VALUE = 2;
24
- class HeaderParser {
25
- constructor(cb) {
26
- this.header = /* @__PURE__ */ Object.create(null);
27
- this.pairCount = 0;
28
- this.byteCount = 0;
29
- this.state = HPARSER_NAME;
30
- this.name = "";
31
- this.value = "";
32
- this.crlf = 0;
33
- this.cb = cb;
34
- }
35
- reset() {
36
- this.header = /* @__PURE__ */ Object.create(null);
37
- this.pairCount = 0;
38
- this.byteCount = 0;
39
- this.state = HPARSER_NAME;
40
- this.name = "";
41
- this.value = "";
42
- this.crlf = 0;
43
- }
44
- push(chunk, pos, end) {
45
- let start = pos;
46
- while (pos < end) {
47
- switch (this.state) {
48
- case HPARSER_NAME: {
49
- let done = false;
50
- for (; pos < end; ++pos) {
51
- if (this.byteCount === MAX_HEADER_SIZE)
52
- return -1;
53
- ++this.byteCount;
54
- const code = chunk[pos];
55
- if (TOKEN[code] !== 1) {
56
- if (code !== 58)
57
- return -1;
58
- this.name += chunk.latin1Slice(start, pos);
59
- if (this.name.length === 0)
60
- return -1;
61
- ++pos;
62
- done = true;
63
- this.state = HPARSER_PRE_OWS;
64
- break;
65
- }
66
- }
67
- if (!done) {
68
- this.name += chunk.latin1Slice(start, pos);
69
- break;
70
- }
71
- }
72
- case HPARSER_PRE_OWS: {
73
- let done = false;
74
- for (; pos < end; ++pos) {
75
- if (this.byteCount === MAX_HEADER_SIZE)
76
- return -1;
77
- ++this.byteCount;
78
- const code = chunk[pos];
79
- if (code !== 32 && code !== 9) {
80
- start = pos;
81
- done = true;
82
- this.state = HPARSER_VALUE;
83
- break;
84
- }
85
- }
86
- if (!done)
87
- break;
88
- }
89
- case HPARSER_VALUE:
90
- switch (this.crlf) {
91
- case 0:
92
- for (; pos < end; ++pos) {
93
- if (this.byteCount === MAX_HEADER_SIZE)
94
- return -1;
95
- ++this.byteCount;
96
- const code = chunk[pos];
97
- if (FIELD_VCHAR[code] !== 1) {
98
- if (code !== 13)
99
- return -1;
100
- ++this.crlf;
101
- break;
102
- }
103
- }
104
- this.value += chunk.latin1Slice(start, pos++);
105
- break;
106
- case 1:
107
- if (this.byteCount === MAX_HEADER_SIZE)
108
- return -1;
109
- ++this.byteCount;
110
- if (chunk[pos++] !== 10)
111
- return -1;
112
- ++this.crlf;
113
- break;
114
- case 2: {
115
- if (this.byteCount === MAX_HEADER_SIZE)
116
- return -1;
117
- ++this.byteCount;
118
- const code = chunk[pos];
119
- if (code === 32 || code === 9) {
120
- start = pos;
121
- this.crlf = 0;
122
- } else {
123
- if (++this.pairCount < MAX_HEADER_PAIRS) {
124
- this.name = this.name.toLowerCase();
125
- if (this.header[this.name] === void 0)
126
- this.header[this.name] = [this.value];
127
- else
128
- this.header[this.name].push(this.value);
129
- }
130
- if (code === 13) {
131
- ++this.crlf;
132
- ++pos;
133
- } else {
134
- start = pos;
135
- this.crlf = 0;
136
- this.state = HPARSER_NAME;
137
- this.name = "";
138
- this.value = "";
139
- }
140
- }
141
- break;
142
- }
143
- case 3: {
144
- if (this.byteCount === MAX_HEADER_SIZE)
145
- return -1;
146
- ++this.byteCount;
147
- if (chunk[pos++] !== 10)
148
- return -1;
149
- const header = this.header;
150
- this.reset();
151
- this.cb(header);
152
- return pos;
153
- }
154
- }
155
- break;
156
- }
157
- }
158
- return pos;
159
- }
160
- }
161
- class FileStream extends Readable {
162
- constructor(opts, owner) {
163
- super(opts);
164
- this.truncated = false;
165
- this._readcb = null;
166
- this.once("end", () => {
167
- this._read();
168
- if (--owner._fileEndsLeft === 0 && owner._finalcb) {
169
- const cb = owner._finalcb;
170
- owner._finalcb = null;
171
- process.nextTick(cb);
172
- }
173
- });
174
- }
175
- _read(n) {
176
- const cb = this._readcb;
177
- if (cb) {
178
- this._readcb = null;
179
- cb();
180
- }
181
- }
182
- }
183
- const ignoreData = {
184
- push: (chunk, pos) => {
185
- },
186
- destroy: () => {
187
- }
188
- };
189
- function callAndUnsetCb(self, err) {
190
- const cb = self._writecb;
191
- self._writecb = null;
192
- if (err)
193
- self.destroy(err);
194
- else if (cb)
195
- cb();
196
- }
197
- function nullDecoder(val, hint) {
198
- return val;
199
- }
200
- class Multipart extends Writable {
201
- constructor(cfg) {
202
- const streamOpts = {
203
- autoDestroy: true,
204
- emitClose: true,
205
- highWaterMark: typeof cfg.highWaterMark === "number" ? cfg.highWaterMark : void 0
206
- };
207
- super(streamOpts);
208
- if (!cfg.conType.params || typeof cfg.conType.params.boundary !== "string")
209
- throw new Error("Multipart: Boundary not found");
210
- const boundary = cfg.conType.params.boundary;
211
- const paramDecoder = typeof cfg.defParamCharset === "string" && cfg.defParamCharset ? getDecoder(cfg.defParamCharset) : nullDecoder;
212
- const defCharset = cfg.defCharset || "utf8";
213
- const preservePath = cfg.preservePath;
214
- const fileOpts = {
215
- autoDestroy: true,
216
- emitClose: true,
217
- highWaterMark: typeof cfg.fileHwm === "number" ? cfg.fileHwm : void 0
218
- };
219
- const limits = cfg.limits;
220
- const fieldSizeLimit = limits && typeof limits.fieldSize === "number" ? limits.fieldSize : 1 * 1024 * 1024;
221
- const fileSizeLimit = limits && typeof limits.fileSize === "number" ? limits.fileSize : Infinity;
222
- const filesLimit = limits && typeof limits.files === "number" ? limits.files : Infinity;
223
- const fieldsLimit = limits && typeof limits.fields === "number" ? limits.fields : Infinity;
224
- const partsLimit = limits && typeof limits.parts === "number" ? limits.parts : Infinity;
225
- let parts = -1;
226
- let fields = 0;
227
- let files = 0;
228
- let skipPart = false;
229
- this._fileEndsLeft = 0;
230
- this._fileStream = void 0;
231
- this._complete = false;
232
- let fileSize = 0;
233
- let field;
234
- let fieldSize = 0;
235
- let partCharset;
236
- let partEncoding;
237
- let partType;
238
- let partName;
239
- let partTruncated = false;
240
- let hitFilesLimit = false;
241
- let hitFieldsLimit = false;
242
- this._hparser = null;
243
- const hparser = new HeaderParser((header) => {
244
- this._hparser = null;
245
- skipPart = false;
246
- partType = "text/plain";
247
- partCharset = defCharset;
248
- partEncoding = "7bit";
249
- partName = void 0;
250
- partTruncated = false;
251
- let filename;
252
- if (!header["content-disposition"]) {
253
- skipPart = true;
254
- return;
255
- }
256
- const disp = parseDisposition(
257
- header["content-disposition"][0],
258
- paramDecoder
259
- );
260
- if (!disp || disp.type !== "form-data") {
261
- skipPart = true;
262
- return;
263
- }
264
- if (disp.params) {
265
- if (disp.params.name)
266
- partName = disp.params.name;
267
- if (disp.params["filename*"])
268
- filename = disp.params["filename*"];
269
- else if (disp.params.filename)
270
- filename = disp.params.filename;
271
- if (filename !== void 0 && !preservePath)
272
- filename = basename(filename);
273
- }
274
- if (header["content-type"]) {
275
- const conType = parseContentType(header["content-type"][0]);
276
- if (conType) {
277
- partType = `${conType.type}/${conType.subtype}`;
278
- if (conType.params && typeof conType.params.charset === "string")
279
- partCharset = conType.params.charset.toLowerCase();
280
- }
281
- }
282
- if (header["content-transfer-encoding"])
283
- partEncoding = header["content-transfer-encoding"][0].toLowerCase();
284
- if (partType === "application/octet-stream" || filename !== void 0) {
285
- if (files === filesLimit) {
286
- if (!hitFilesLimit) {
287
- hitFilesLimit = true;
288
- this.emit("filesLimit");
289
- }
290
- skipPart = true;
291
- return;
292
- }
293
- ++files;
294
- if (this.listenerCount("file") === 0) {
295
- skipPart = true;
296
- return;
297
- }
298
- fileSize = 0;
299
- this._fileStream = new FileStream(fileOpts, this);
300
- ++this._fileEndsLeft;
301
- this.emit(
302
- "file",
303
- partName,
304
- this._fileStream,
305
- {
306
- filename,
307
- encoding: partEncoding,
308
- mimeType: partType
309
- }
310
- );
311
- } else {
312
- if (fields === fieldsLimit) {
313
- if (!hitFieldsLimit) {
314
- hitFieldsLimit = true;
315
- this.emit("fieldsLimit");
316
- }
317
- skipPart = true;
318
- return;
319
- }
320
- ++fields;
321
- if (this.listenerCount("field") === 0) {
322
- skipPart = true;
323
- return;
324
- }
325
- field = [];
326
- fieldSize = 0;
327
- }
328
- });
329
- let matchPostBoundary = 0;
330
- const ssCb = (isMatch, data, start, end, isDataSafe) => {
331
- retrydata:
332
- while (data) {
333
- if (this._hparser !== null) {
334
- const ret = this._hparser.push(data, start, end);
335
- if (ret === -1) {
336
- this._hparser = null;
337
- hparser.reset();
338
- this.emit("error", new Error("Malformed part header"));
339
- break;
340
- }
341
- start = ret;
342
- }
343
- if (start === end)
344
- break;
345
- if (matchPostBoundary !== 0) {
346
- if (matchPostBoundary === 1) {
347
- switch (data[start]) {
348
- case 45:
349
- matchPostBoundary = 2;
350
- ++start;
351
- break;
352
- case 13:
353
- matchPostBoundary = 3;
354
- ++start;
355
- break;
356
- default:
357
- matchPostBoundary = 0;
358
- }
359
- if (start === end)
360
- return;
361
- }
362
- if (matchPostBoundary === 2) {
363
- matchPostBoundary = 0;
364
- if (data[start] === 45) {
365
- this._complete = true;
366
- this._bparser = ignoreData;
367
- return;
368
- }
369
- const writecb = this._writecb;
370
- this._writecb = noop;
371
- ssCb(false, BUF_DASH, 0, 1, false);
372
- this._writecb = writecb;
373
- } else if (matchPostBoundary === 3) {
374
- matchPostBoundary = 0;
375
- if (data[start] === 10) {
376
- ++start;
377
- if (parts >= partsLimit)
378
- break;
379
- this._hparser = hparser;
380
- if (start === end)
381
- break;
382
- continue retrydata;
383
- } else {
384
- const writecb = this._writecb;
385
- this._writecb = noop;
386
- ssCb(false, BUF_CR, 0, 1, false);
387
- this._writecb = writecb;
388
- }
389
- }
390
- }
391
- if (!skipPart) {
392
- if (this._fileStream) {
393
- let chunk;
394
- const actualLen = Math.min(end - start, fileSizeLimit - fileSize);
395
- if (!isDataSafe) {
396
- chunk = Buffer.allocUnsafe(actualLen);
397
- data.copy(chunk, 0, start, start + actualLen);
398
- } else {
399
- chunk = data.slice(start, start + actualLen);
400
- }
401
- fileSize += chunk.length;
402
- if (fileSize === fileSizeLimit) {
403
- if (chunk.length > 0)
404
- this._fileStream.push(chunk);
405
- this._fileStream.emit("limit");
406
- this._fileStream.truncated = true;
407
- skipPart = true;
408
- } else if (!this._fileStream.push(chunk)) {
409
- if (this._writecb)
410
- this._fileStream._readcb = this._writecb;
411
- this._writecb = null;
412
- }
413
- } else if (field !== void 0) {
414
- let chunk;
415
- const actualLen = Math.min(
416
- end - start,
417
- fieldSizeLimit - fieldSize
418
- );
419
- if (!isDataSafe) {
420
- chunk = Buffer.allocUnsafe(actualLen);
421
- data.copy(chunk, 0, start, start + actualLen);
422
- } else {
423
- chunk = data.slice(start, start + actualLen);
424
- }
425
- fieldSize += actualLen;
426
- field.push(chunk);
427
- if (fieldSize === fieldSizeLimit) {
428
- skipPart = true;
429
- partTruncated = true;
430
- }
431
- }
432
- }
433
- break;
434
- }
435
- if (isMatch) {
436
- matchPostBoundary = 1;
437
- if (this._fileStream) {
438
- this._fileStream.push(null);
439
- this._fileStream = null;
440
- } else if (field !== void 0) {
441
- let data2;
442
- switch (field.length) {
443
- case 0:
444
- data2 = "";
445
- break;
446
- case 1:
447
- data2 = convertToUTF8(field[0], partCharset, 0);
448
- break;
449
- default:
450
- data2 = convertToUTF8(
451
- Buffer.concat(field, fieldSize),
452
- partCharset,
453
- 0
454
- );
455
- }
456
- field = void 0;
457
- fieldSize = 0;
458
- this.emit(
459
- "field",
460
- partName,
461
- data2,
462
- {
463
- nameTruncated: false,
464
- valueTruncated: partTruncated,
465
- encoding: partEncoding,
466
- mimeType: partType
467
- }
468
- );
469
- }
470
- if (++parts === partsLimit)
471
- this.emit("partsLimit");
472
- }
473
- };
474
- this._bparser = new StreamSearch(`\r
475
- --${boundary}`, ssCb);
476
- this._writecb = null;
477
- this._finalcb = null;
478
- this.write(BUF_CRLF);
479
- }
480
- static detect(conType) {
481
- return conType.type === "multipart" && conType.subtype === "form-data";
482
- }
483
- _write(chunk, enc, cb) {
484
- this._writecb = cb;
485
- this._bparser.push(chunk, 0);
486
- if (this._writecb)
487
- callAndUnsetCb(this);
488
- }
489
- _destroy(err, cb) {
490
- this._hparser = null;
491
- this._bparser = ignoreData;
492
- if (!err)
493
- err = checkEndState(this);
494
- const fileStream = this._fileStream;
495
- if (fileStream) {
496
- this._fileStream = null;
497
- fileStream.destroy(err);
498
- }
499
- cb(err);
500
- }
501
- _final(cb) {
502
- this._bparser.destroy();
503
- if (!this._complete)
504
- return cb(new Error("Unexpected end of form"));
505
- if (this._fileEndsLeft)
506
- this._finalcb = finalcb.bind(null, this, cb);
507
- else
508
- finalcb(this, cb);
509
- }
510
- }
511
- function finalcb(self, cb, err) {
512
- if (err)
513
- return cb(err);
514
- err = checkEndState(self);
515
- cb(err);
516
- }
517
- function checkEndState(self) {
518
- if (self._hparser)
519
- return new Error("Malformed part header");
520
- const fileStream = self._fileStream;
521
- if (fileStream) {
522
- self._fileStream = null;
523
- fileStream.destroy(new Error("Unexpected end of file"));
524
- }
525
- if (!self._complete)
526
- return new Error("Unexpected end of form");
527
- }
528
- const TOKEN = [
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
- 0,
562
- 1,
563
- 0,
564
- 1,
565
- 1,
566
- 1,
567
- 1,
568
- 1,
569
- 0,
570
- 0,
571
- 1,
572
- 1,
573
- 0,
574
- 1,
575
- 1,
576
- 0,
577
- 1,
578
- 1,
579
- 1,
580
- 1,
581
- 1,
582
- 1,
583
- 1,
584
- 1,
585
- 1,
586
- 1,
587
- 0,
588
- 0,
589
- 0,
590
- 0,
591
- 0,
592
- 0,
593
- 0,
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
- 1,
620
- 0,
621
- 0,
622
- 0,
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
- 1,
652
- 0,
653
- 1,
654
- 0,
655
- 1,
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
- 0
785
- ];
786
- const FIELD_VCHAR = [
787
- 0,
788
- 0,
789
- 0,
790
- 0,
791
- 0,
792
- 0,
793
- 0,
794
- 0,
795
- 0,
796
- 1,
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
- 0,
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
- 1,
914
- 0,
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
- 1
1043
- ];
1044
- var multipart = Multipart;
1045
- module.exports = multipart;
1046
- //# sourceMappingURL=multipart.cjs.map