@suveren/gateway 0.20.1 → 0.21.0

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 (27) hide show
  1. package/content/integrations/erp.json +1 -1
  2. package/dist/mcp-server/http.mjs +152 -11
  3. package/dist/ui/assets/index-BBjT8ue7.js +116 -0
  4. package/dist/ui/assets/{index-blnpvM2g.css → index-D5hgQ_8Z.css} +1 -1
  5. package/dist/ui/index.html +2 -2
  6. package/node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition/README.md +105 -35
  7. package/node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition/dist/index.d.ts +72 -0
  8. package/node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition/dist/index.js +388 -0
  9. package/node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition/dist/index.js.map +1 -0
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition/package.json +31 -19
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/Readme.md +15 -9
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/lib/application.js +2 -2
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/lib/request.js +32 -19
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/lib/response.js +27 -30
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/content-type/LICENSE +22 -0
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/content-type/README.md +71 -0
  17. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/content-type/dist/index.d.ts +46 -0
  18. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/content-type/dist/index.js +176 -0
  19. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/content-type/dist/index.js.map +1 -0
  20. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/node_modules/content-type/package.json +52 -0
  21. package/node_modules/@modelcontextprotocol/sdk/node_modules/express/package.json +10 -10
  22. package/node_modules/@types/node/README.md +1 -1
  23. package/node_modules/@types/node/package.json +2 -2
  24. package/node_modules/@types/node/util.d.ts +6 -3
  25. package/package.json +1 -1
  26. package/dist/ui/assets/index-1s1q-XLL.js +0 -116
  27. package/node_modules/@modelcontextprotocol/sdk/node_modules/content-disposition/index.js +0 -536
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ /*!
3
+ * content-disposition
4
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
5
+ * MIT Licensed
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.create = create;
9
+ exports.parse = parse;
10
+ exports.decodeExtended = decodeExtended;
11
+ exports.format = format;
12
+ exports.encodeExtended = encodeExtended;
13
+ /**
14
+ * Null object perf optimization. Faster than `Object.create(null)` and `{ __proto__: null }`.
15
+ */
16
+ const NullObject = /* @__PURE__ */ (() => {
17
+ const C = function () { };
18
+ C.prototype = Object.create(null);
19
+ return C;
20
+ })();
21
+ /**
22
+ * Create an attachment Content-Disposition header.
23
+ */
24
+ function create(filename, options) {
25
+ const type = options?.type || 'attachment';
26
+ const parameters = createParameters(filename, options?.fallback);
27
+ return format({ type, parameters }, { extended: false });
28
+ }
29
+ const SP = 32; // " "
30
+ const HTAB = 9; // "\t"
31
+ const SEMI = 59; // ";"
32
+ const EQ = 61; // "="
33
+ const DQUOTE = 34; // '"'
34
+ const BSLASH = 92; // "\\"
35
+ const ASTERISK = 42; // "*"
36
+ /**
37
+ * Parse Content-Disposition header string.
38
+ */
39
+ function parse(header, options) {
40
+ const len = header.length;
41
+ const multipart = options?.multipart === true;
42
+ const extended = options?.extended !== false;
43
+ let index = skipOWS(header, 0, header.length);
44
+ const typeStart = index;
45
+ index = parseToken(header, index, len);
46
+ const typeEnd = trailingOWS(header, typeStart, index);
47
+ const type = header.slice(typeStart, typeEnd).toLowerCase();
48
+ const parameters = new NullObject();
49
+ parameter: while (index < len) {
50
+ index = skipOWS(header, index + 1, len); // Skip over semicolon.
51
+ const keyStart = index;
52
+ while (index < len) {
53
+ const char = header.charCodeAt(index);
54
+ if (char === SEMI)
55
+ continue parameter;
56
+ if (char === EQ) {
57
+ const keyEnd = trailingOWS(header, keyStart, index);
58
+ const key = header.slice(keyStart, keyEnd).toLowerCase();
59
+ index = skipOWS(header, index + 1, len);
60
+ if (index < len && header.charCodeAt(index) === DQUOTE) {
61
+ index++;
62
+ let value = '';
63
+ if (multipart) {
64
+ while (index < len) {
65
+ const code = header.charCodeAt(index++);
66
+ if (code === DQUOTE) {
67
+ index = parseToken(header, index, len);
68
+ if (parameters[key] === undefined)
69
+ parameters[key] = value;
70
+ break;
71
+ }
72
+ if (code === /* % */ 37 && index + 1 < len) {
73
+ const code2 = header.charCodeAt(index);
74
+ const code3 = header.charCodeAt(index + 1);
75
+ if (code2 === 50 /* "2" */ && code3 === 50 /* "2" */) {
76
+ value += '"';
77
+ index += 2;
78
+ continue;
79
+ }
80
+ if (code2 === 48 /* "0" */) {
81
+ if (code3 === 100 /* "d" */ || code3 === 68 /* "D" */) {
82
+ value += '\r';
83
+ index += 2;
84
+ continue;
85
+ }
86
+ if (code3 === 97 /* "a" */ || code3 === 65 /* "A" */) {
87
+ value += '\n';
88
+ index += 2;
89
+ continue;
90
+ }
91
+ }
92
+ }
93
+ value += String.fromCharCode(code);
94
+ }
95
+ }
96
+ else {
97
+ while (index < len) {
98
+ const code = header.charCodeAt(index++);
99
+ if (code === DQUOTE) {
100
+ index = parseToken(header, index, len);
101
+ if (parameters[key] === undefined)
102
+ parameters[key] = value;
103
+ break;
104
+ }
105
+ if (code === BSLASH && index < len) {
106
+ value += header[index++];
107
+ continue;
108
+ }
109
+ value += String.fromCharCode(code);
110
+ }
111
+ }
112
+ continue parameter;
113
+ }
114
+ const valueStart = index;
115
+ index = parseToken(header, index, len);
116
+ const valueEnd = trailingOWS(header, valueStart, index);
117
+ const value = header.slice(valueStart, valueEnd);
118
+ if (parameters[key] === undefined) {
119
+ parameters[key] = value;
120
+ if (extended && key.charCodeAt(key.length - 1) === ASTERISK) {
121
+ const normalizedKey = key.slice(0, -1);
122
+ const decoded = decodeExtended(value);
123
+ if (decoded !== undefined)
124
+ parameters[normalizedKey] = decoded;
125
+ }
126
+ }
127
+ continue parameter;
128
+ }
129
+ index++;
130
+ }
131
+ }
132
+ return { type, parameters };
133
+ }
134
+ /**
135
+ * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")
136
+ */
137
+ const ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g; // eslint-disable-line no-control-regex
138
+ /**
139
+ * RegExp to match non-US-ASCII characters.
140
+ */
141
+ const NON_ASCII_REGEXP = /[^\x20-\x7e]/g;
142
+ /**
143
+ * RegExp to match chars that must be quoted-pair in RFC 2616
144
+ */
145
+ const QUOTE_REGEXP = /[\\"]/g;
146
+ /**
147
+ * Match chars that can't be used in the filename for compatibility.
148
+ */
149
+ const INVALID_FILENAME_REGEXP = /%[0-9A-Fa-f]{2}/;
150
+ /**
151
+ * RegExp for various RFC 2616 grammar
152
+ *
153
+ * parameter = token "=" ( token | quoted-string )
154
+ * token = 1*<any CHAR except CTLs or separators>
155
+ * separators = "(" | ")" | "<" | ">" | "@"
156
+ * | "," | ";" | ":" | "\" | <">
157
+ * | "/" | "[" | "]" | "?" | "="
158
+ * | "{" | "}" | SP | HT
159
+ * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
160
+ * qdtext = <any TEXT except <">>
161
+ * quoted-pair = "\" CHAR
162
+ * CHAR = <any US-ASCII character (octets 0 - 127)>
163
+ * TEXT = <any OCTET except CTLs, but including LWS>
164
+ * LWS = [CRLF] 1*( SP | HT )
165
+ * CRLF = CR LF
166
+ * CR = <US-ASCII CR, carriage return (13)>
167
+ * LF = <US-ASCII LF, linefeed (10)>
168
+ * SP = <US-ASCII SP, space (32)>
169
+ * HT = <US-ASCII HT, horizontal-tab (9)>
170
+ * CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
171
+ * OCTET = <any 8-bit sequence of data>
172
+ */
173
+ const TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]*$/;
174
+ const ASCII_TEXT_REGEXP = /^[\x20-\x7e]*$/;
175
+ const TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/;
176
+ /**
177
+ * Create parameters object from filename and fallback.
178
+ */
179
+ function createParameters(filename, fallback = true) {
180
+ if (filename === undefined)
181
+ return;
182
+ if (typeof fallback === 'string') {
183
+ if (!ASCII_TEXT_REGEXP.test(fallback)) {
184
+ throw new TypeError('Fallback must be valid US-ASCII: ' + fallback);
185
+ }
186
+ if (fallback === filename)
187
+ return { filename };
188
+ return { filename: fallback, 'filename*': encodeExtended(filename) };
189
+ }
190
+ // Use `filename` when possible, otherwise use `filename*`.
191
+ if (ASCII_TEXT_REGEXP.test(filename) &&
192
+ !INVALID_FILENAME_REGEXP.test(filename)) {
193
+ return { filename };
194
+ }
195
+ if (fallback === false) {
196
+ return { 'filename*': encodeExtended(filename) };
197
+ }
198
+ return {
199
+ filename: getAscii(filename),
200
+ 'filename*': encodeExtended(filename),
201
+ };
202
+ }
203
+ /**
204
+ * Decode a RFC 8187 field value (gracefully).
205
+ */
206
+ function decodeExtended(str) {
207
+ const charsetEnd = str.indexOf("'");
208
+ if (charsetEnd <= 0) {
209
+ return undefined;
210
+ }
211
+ const languageEnd = str.indexOf("'", charsetEnd + 1);
212
+ if (languageEnd === -1) {
213
+ return undefined;
214
+ }
215
+ const charset = str.slice(0, charsetEnd).toLowerCase();
216
+ const encoded = str.slice(languageEnd + 1);
217
+ switch (charset) {
218
+ case 'iso-8859-1': {
219
+ return decodeHexEscapes(encoded);
220
+ }
221
+ case 'utf-8':
222
+ case 'utf8': {
223
+ return tryDecodeURIComponent(encoded);
224
+ }
225
+ }
226
+ return undefined;
227
+ }
228
+ /**
229
+ * Decode URI component but return `undefined` on error.
230
+ */
231
+ function tryDecodeURIComponent(str) {
232
+ try {
233
+ return decodeURIComponent(str);
234
+ }
235
+ catch {
236
+ return undefined;
237
+ }
238
+ }
239
+ /**
240
+ * Parse a token starting at the provided index.
241
+ */
242
+ function parseToken(str, index, len) {
243
+ while (index < len) {
244
+ const char = str.charCodeAt(index);
245
+ if (char === SEMI)
246
+ break;
247
+ index++;
248
+ }
249
+ return index;
250
+ }
251
+ /**
252
+ * Skip RFC 2616 linear whitespace (space / tab).
253
+ */
254
+ function skipOWS(str, index, len) {
255
+ while (index < len) {
256
+ const char = str.charCodeAt(index);
257
+ if (char !== SP && char !== HTAB)
258
+ break;
259
+ index++;
260
+ }
261
+ return index;
262
+ }
263
+ /**
264
+ * Skip RFC 2616 linear whitespace (space / tab) from the end of a string.
265
+ */
266
+ function trailingOWS(str, start, end) {
267
+ while (end > start) {
268
+ const char = str.charCodeAt(end - 1);
269
+ if (char !== SP && char !== HTAB)
270
+ break;
271
+ end--;
272
+ }
273
+ return end;
274
+ }
275
+ /**
276
+ * Format object to Content-Disposition header.
277
+ */
278
+ function format(obj, options) {
279
+ const { type, parameters } = obj;
280
+ const multipart = options?.multipart === true;
281
+ const extended = options?.extended !== false;
282
+ if (!type || !TOKEN_REGEXP.test(type)) {
283
+ throw new TypeError('Invalid type: ' + type);
284
+ }
285
+ let result = type;
286
+ if (parameters) {
287
+ for (const param of Object.keys(parameters)) {
288
+ const value = parameters[param];
289
+ if (!TOKEN_REGEXP.test(param)) {
290
+ throw new TypeError('Invalid parameter name: ' + param);
291
+ }
292
+ if (multipart) {
293
+ result += '; ' + param + '=' + qmultipart(value);
294
+ continue;
295
+ }
296
+ if (TOKEN_REGEXP.test(value)) {
297
+ result += '; ' + param + '=' + value;
298
+ continue;
299
+ }
300
+ if (TEXT_REGEXP.test(value)) {
301
+ result += '; ' + param + '=' + qstring(value);
302
+ continue;
303
+ }
304
+ if (!extended) {
305
+ throw new TypeError('Invalid parameter value: ' + value);
306
+ }
307
+ result += '; ' + param + '*=' + encodeExtended(value);
308
+ }
309
+ }
310
+ return result;
311
+ }
312
+ /**
313
+ * Get US-ASCII version of string.
314
+ */
315
+ function getAscii(val) {
316
+ // simple Unicode -> US-ASCII transformation
317
+ return val.replace(NON_ASCII_REGEXP, '?');
318
+ }
319
+ /**
320
+ * Percent encode a single character.
321
+ */
322
+ function pencode(char) {
323
+ return '%' + char.charCodeAt(0).toString(16).toUpperCase();
324
+ }
325
+ /**
326
+ * Quote a string for HTTP.
327
+ */
328
+ function qstring(str) {
329
+ return '"' + str.replace(QUOTE_REGEXP, '\\$&') + '"';
330
+ }
331
+ /**
332
+ * Quote a string for multipart/form-data.
333
+ *
334
+ * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data
335
+ */
336
+ function qmultipart(str) {
337
+ return '"' + str.replace(/[\n\r"]/g, multipartEscape) + '"';
338
+ }
339
+ /**
340
+ * Escape a multipart/form-data string character.
341
+ */
342
+ function multipartEscape(char) {
343
+ if (char === '\n')
344
+ return '%0A';
345
+ if (char === '\r')
346
+ return '%0D';
347
+ return '%22';
348
+ }
349
+ /**
350
+ * Encode a Unicode string for HTTP (RFC 8187).
351
+ */
352
+ function encodeExtended(str) {
353
+ const encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
354
+ return "UTF-8''" + encoded;
355
+ }
356
+ /**
357
+ * Check if a character is a hex digit [0-9A-Fa-f]
358
+ */
359
+ function isHexDigit(char) {
360
+ const code = char.charCodeAt(0);
361
+ return ((code >= 48 && code <= 57) || // 0-9
362
+ (code >= 65 && code <= 70) || // A-F
363
+ (code >= 97 && code <= 102) // a-f
364
+ );
365
+ }
366
+ /**
367
+ * Decode hex escapes in a string (e.g., %20 -> space)
368
+ */
369
+ function decodeHexEscapes(str) {
370
+ const firstEscape = str.indexOf('%');
371
+ if (firstEscape === -1)
372
+ return str;
373
+ let result = str.slice(0, firstEscape);
374
+ for (let idx = firstEscape; idx < str.length; idx++) {
375
+ if (str[idx] === '%' &&
376
+ idx + 2 < str.length &&
377
+ isHexDigit(str[idx + 1]) &&
378
+ isHexDigit(str[idx + 2])) {
379
+ result += String.fromCharCode(Number.parseInt(str[idx + 1] + str[idx + 2], 16));
380
+ idx += 2;
381
+ }
382
+ else {
383
+ result += str[idx];
384
+ }
385
+ }
386
+ return result;
387
+ }
388
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAsCH,wBAKC;AA0BD,sBAoHC;AAwFD,wCAyBC;AAkED,wBA8CC;AA6CD,wCAOC;AAjcD;;GAEG;AACH,MAAM,UAAU,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE;IACvC,MAAM,CAAC,GAAG,cAAa,CAAC,CAAC;IACzB,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,CAAC,CAAC;AACX,CAAC,CAAC,EAAgC,CAAC;AAenC;;GAEG;AACH,SAAgB,MAAM,CAAC,QAAiB,EAAE,OAAuB;IAC/D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,YAAY,CAAC;IAC3C,MAAM,UAAU,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEjE,OAAO,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM;AACrB,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO;AACvB,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,MAAM;AACvB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM;AACrB,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,MAAM;AACzB,MAAM,MAAM,GAAG,EAAE,CAAC,CAAC,OAAO;AAC1B,MAAM,QAAQ,GA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AE,CAAC,CACjD,CAAC;YACF,GAAG,IAAI,CAAC,CAAC;QACX,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * content-disposition\n * Copyright(c) 2014-2017 Douglas Christopher Wilson\n * MIT Licensed\n */\n\nexport interface ContentDisposition {\n /**\n * Content-Disposition type, such as \"attachment\" or \"inline\"\n */\n type: string;\n /**\n * Content-Disposition parameters, such as \"filename\"\n */\n parameters: Record<string, string>;\n}\n\n/**\n * Null object perf optimization. Faster than `Object.create(null)` and `{ __proto__: null }`.\n */\nconst NullObject = /* @__PURE__ */ (() => {\n const C = function () {};\n C.prototype = Object.create(null);\n return C;\n})() as unknown as { new (): any };\n\nexport interface CreateOptions {\n /**\n * Content-Disposition type, defaults to \"attachment\"\n * @default \"attachment\"\n */\n type?: string;\n /**\n * Fallback filename for non-US-ASCII strings. If true, a fallback will be generated by replacing non-US-ASCII characters with \"?\". If false, no fallback will be generated.\n * @default true\n */\n fallback?: string | boolean;\n}\n\n/**\n * Create an attachment Content-Disposition header.\n */\nexport function create(filename?: string, options?: CreateOptions): string {\n const type = options?.type || 'attachment';\n const parameters = createParameters(filename, options?.fallback);\n\n return format({ type, parameters }, { extended: false });\n}\n\nconst SP = 32; // \" \"\nconst HTAB = 9; // \"\\t\"\nconst SEMI = 59; // \";\"\nconst EQ = 61; // \"=\"\nconst DQUOTE = 34; // '\"'\nconst BSLASH = 92; // \"\\\\\"\nconst ASTERISK = 42; // \"*\"\n\nexport interface ParseOptions {\n /**\n * Whether to decode RFC 8187 encoded parameters.\n * @default true\n */\n extended?: boolean;\n /**\n * Parse parameters as sent by browsers in `multipart/form-data`.\n * @default false\n */\n multipart?: boolean;\n}\n\n/**\n * Parse Content-Disposition header string.\n */\nexport function parse(\n header: string,\n options?: ParseOptions,\n): ContentDisposition {\n const len = header.length;\n const multipart = options?.multipart === true;\n const extended = options?.extended !== false;\n let index = skipOWS(header, 0, header.length);\n\n const typeStart = index;\n index = parseToken(header, index, len);\n const typeEnd = trailingOWS(header, typeStart, index);\n const type = header.slice(typeStart, typeEnd).toLowerCase();\n\n const parameters: Record<string, string> = new NullObject();\n\n parameter: while (index < len) {\n index = skipOWS(header, index + 1, len); // Skip over semicolon.\n\n const keyStart = index;\n\n while (index < len) {\n const char = header.charCodeAt(index);\n if (char === SEMI) continue parameter;\n\n if (char === EQ) {\n const keyEnd = trailingOWS(header, keyStart, index);\n const key = header.slice(keyStart, keyEnd).toLowerCase();\n\n index = skipOWS(header, index + 1, len);\n\n if (index < len && header.charCodeAt(index) === DQUOTE) {\n index++;\n\n let value = '';\n\n if (multipart) {\n while (index < len) {\n const code = header.charCodeAt(index++);\n if (code === DQUOTE) {\n index = parseToken(header, index, len);\n if (parameters[key] === undefined) parameters[key] = value;\n break;\n }\n\n if (code === /* % */ 37 && index + 1 < len) {\n const code2 = header.charCodeAt(index);\n const code3 = header.charCodeAt(index + 1);\n\n if (code2 === 50 /* \"2\" */ && code3 === 50 /* \"2\" */) {\n value += '\"';\n index += 2;\n continue;\n }\n\n if (code2 === 48 /* \"0\" */) {\n if (code3 === 100 /* \"d\" */ || code3 === 68 /* \"D\" */) {\n value += '\\r';\n index += 2;\n continue;\n }\n\n if (code3 === 97 /* \"a\" */ || code3 === 65 /* \"A\" */) {\n value += '\\n';\n index += 2;\n continue;\n }\n }\n }\n\n value += String.fromCharCode(code);\n }\n } else {\n while (index < len) {\n const code = header.charCodeAt(index++);\n if (code === DQUOTE) {\n index = parseToken(header, index, len);\n if (parameters[key] === undefined) parameters[key] = value;\n break;\n }\n\n if (code === BSLASH && index < len) {\n value += header[index++];\n continue;\n }\n\n value += String.fromCharCode(code);\n }\n }\n\n continue parameter;\n }\n\n const valueStart = index;\n index = parseToken(header, index, len);\n const valueEnd = trailingOWS(header, valueStart, index);\n const value = header.slice(valueStart, valueEnd);\n\n if (parameters[key] === undefined) {\n parameters[key] = value;\n\n if (extended && key.charCodeAt(key.length - 1) === ASTERISK) {\n const normalizedKey = key.slice(0, -1);\n const decoded = decodeExtended(value);\n if (decoded !== undefined) parameters[normalizedKey] = decoded;\n }\n }\n\n continue parameter;\n }\n\n index++;\n }\n }\n\n return { type, parameters };\n}\n\n/**\n * RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including \"%\")\n */\nconst ENCODE_URL_ATTR_CHAR_REGEXP = /[\\x00-\\x20\"'()*,/:;<=>?@[\\\\\\]{}\\x7f]/g; // eslint-disable-line no-control-regex\n\n/**\n * RegExp to match non-US-ASCII characters.\n */\nconst NON_ASCII_REGEXP = /[^\\x20-\\x7e]/g;\n\n/**\n * RegExp to match chars that must be quoted-pair in RFC 2616\n */\nconst QUOTE_REGEXP = /[\\\\\"]/g;\n\n/**\n * Match chars that can't be used in the filename for compatibility.\n */\nconst INVALID_FILENAME_REGEXP = /%[0-9A-Fa-f]{2}/;\n\n/**\n * RegExp for various RFC 2616 grammar\n *\n * parameter = token \"=\" ( token | quoted-string )\n * token = 1*<any CHAR except CTLs or separators>\n * separators = \"(\" | \")\" | \"<\" | \">\" | \"@\"\n * | \",\" | \";\" | \":\" | \"\\\" | <\">\n * | \"/\" | \"[\" | \"]\" | \"?\" | \"=\"\n * | \"{\" | \"}\" | SP | HT\n * quoted-string = ( <\"> *(qdtext | quoted-pair ) <\"> )\n * qdtext = <any TEXT except <\">>\n * quoted-pair = \"\\\" CHAR\n * CHAR = <any US-ASCII character (octets 0 - 127)>\n * TEXT = <any OCTET except CTLs, but including LWS>\n * LWS = [CRLF] 1*( SP | HT )\n * CRLF = CR LF\n * CR = <US-ASCII CR, carriage return (13)>\n * LF = <US-ASCII LF, linefeed (10)>\n * SP = <US-ASCII SP, space (32)>\n * HT = <US-ASCII HT, horizontal-tab (9)>\n * CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>\n * OCTET = <any 8-bit sequence of data>\n */\nconst TEXT_REGEXP = /^[\\x20-\\x7e\\x80-\\xff]*$/;\nconst ASCII_TEXT_REGEXP = /^[\\x20-\\x7e]*$/;\nconst TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/;\n\n/**\n * Create parameters object from filename and fallback.\n */\nfunction createParameters(\n filename?: string,\n fallback: string | boolean = true,\n): Record<string, string> | undefined {\n if (filename === undefined) return;\n\n if (typeof fallback === 'string') {\n if (!ASCII_TEXT_REGEXP.test(fallback)) {\n throw new TypeError('Fallback must be valid US-ASCII: ' + fallback);\n }\n\n if (fallback === filename) return { filename };\n return { filename: fallback, 'filename*': encodeExtended(filename) };\n }\n\n // Use `filename` when possible, otherwise use `filename*`.\n if (\n ASCII_TEXT_REGEXP.test(filename) &&\n !INVALID_FILENAME_REGEXP.test(filename)\n ) {\n return { filename };\n }\n\n if (fallback === false) {\n return { 'filename*': encodeExtended(filename) };\n }\n\n return {\n filename: getAscii(filename),\n 'filename*': encodeExtended(filename),\n };\n}\n\n/**\n * Decode a RFC 8187 field value (gracefully).\n */\nexport function decodeExtended(str: string): string | undefined {\n const charsetEnd = str.indexOf(\"'\");\n if (charsetEnd <= 0) {\n return undefined;\n }\n\n const languageEnd = str.indexOf(\"'\", charsetEnd + 1);\n if (languageEnd === -1) {\n return undefined;\n }\n\n const charset = str.slice(0, charsetEnd).toLowerCase();\n const encoded = str.slice(languageEnd + 1);\n\n switch (charset) {\n case 'iso-8859-1': {\n return decodeHexEscapes(encoded);\n }\n case 'utf-8':\n case 'utf8': {\n return tryDecodeURIComponent(encoded);\n }\n }\n\n return undefined;\n}\n\n/**\n * Decode URI component but return `undefined` on error.\n */\nfunction tryDecodeURIComponent(str: string): string | undefined {\n try {\n return decodeURIComponent(str);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Parse a token starting at the provided index.\n */\nfunction parseToken(str: string, index: number, len: number): number {\n while (index < len) {\n const char = str.charCodeAt(index);\n if (char === SEMI) break;\n index++;\n }\n return index;\n}\n\n/**\n * Skip RFC 2616 linear whitespace (space / tab).\n */\nfunction skipOWS(str: string, index: number, len: number): number {\n while (index < len) {\n const char = str.charCodeAt(index);\n if (char !== SP && char !== HTAB) break;\n index++;\n }\n return index;\n}\n\n/**\n * Skip RFC 2616 linear whitespace (space / tab) from the end of a string.\n */\nfunction trailingOWS(str: string, start: number, end: number): number {\n while (end > start) {\n const char = str.charCodeAt(end - 1);\n if (char !== SP && char !== HTAB) break;\n end--;\n }\n return end;\n}\n\nexport interface FormatOptions {\n /**\n * Whether to use extended parameter encoding for non-ISO-8859-1 strings.\n * If false, an error will be thrown when formatting such strings.\n * @default true\n */\n extended?: boolean;\n /**\n * Format parameters as sent by browsers in `multipart/form-data`.\n * @default false\n */\n multipart?: boolean;\n}\n\n/**\n * Format object to Content-Disposition header.\n */\nexport function format(\n obj: Partial<ContentDisposition>,\n options?: FormatOptions,\n): string {\n const { type, parameters } = obj;\n const multipart = options?.multipart === true;\n const extended = options?.extended !== false;\n\n if (!type || !TOKEN_REGEXP.test(type)) {\n throw new TypeError('Invalid type: ' + type);\n }\n\n let result = type;\n\n if (parameters) {\n for (const param of Object.keys(parameters)) {\n const value = parameters[param];\n\n if (!TOKEN_REGEXP.test(param)) {\n throw new TypeError('Invalid parameter name: ' + param);\n }\n\n if (multipart) {\n result += '; ' + param + '=' + qmultipart(value);\n continue;\n }\n\n if (TOKEN_REGEXP.test(value)) {\n result += '; ' + param + '=' + value;\n continue;\n }\n\n if (TEXT_REGEXP.test(value)) {\n result += '; ' + param + '=' + qstring(value);\n continue;\n }\n\n if (!extended) {\n throw new TypeError('Invalid parameter value: ' + value);\n }\n\n result += '; ' + param + '*=' + encodeExtended(value);\n }\n }\n\n return result;\n}\n\n/**\n * Get US-ASCII version of string.\n */\nfunction getAscii(val: string): string {\n // simple Unicode -> US-ASCII transformation\n return val.replace(NON_ASCII_REGEXP, '?');\n}\n\n/**\n * Percent encode a single character.\n */\nfunction pencode(char: string): string {\n return '%' + char.charCodeAt(0).toString(16).toUpperCase();\n}\n\n/**\n * Quote a string for HTTP.\n */\nfunction qstring(str: string): string {\n return '\"' + str.replace(QUOTE_REGEXP, '\\\\$&') + '\"';\n}\n\n/**\n * Quote a string for multipart/form-data.\n *\n * @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data\n */\nfunction qmultipart(str: string): string {\n return '\"' + str.replace(/[\\n\\r\"]/g, multipartEscape) + '\"';\n}\n\n/**\n * Escape a multipart/form-data string character.\n */\nfunction multipartEscape(char: string): string {\n if (char === '\\n') return '%0A';\n if (char === '\\r') return '%0D';\n return '%22';\n}\n\n/**\n * Encode a Unicode string for HTTP (RFC 8187).\n */\nexport function encodeExtended(str: string): string {\n const encoded = encodeURIComponent(str).replace(\n ENCODE_URL_ATTR_CHAR_REGEXP,\n pencode,\n );\n\n return \"UTF-8''\" + encoded;\n}\n\n/**\n * Check if a character is a hex digit [0-9A-Fa-f]\n */\nfunction isHexDigit(char: string): boolean {\n const code = char.charCodeAt(0);\n return (\n (code >= 48 && code <= 57) || // 0-9\n (code >= 65 && code <= 70) || // A-F\n (code >= 97 && code <= 102) // a-f\n );\n}\n\n/**\n * Decode hex escapes in a string (e.g., %20 -> space)\n */\nfunction decodeHexEscapes(str: string): string {\n const firstEscape = str.indexOf('%');\n if (firstEscape === -1) return str;\n\n let result = str.slice(0, firstEscape);\n for (let idx = firstEscape; idx < str.length; idx++) {\n if (\n str[idx] === '%' &&\n idx + 2 < str.length &&\n isHexDigit(str[idx + 1]) &&\n isHexDigit(str[idx + 2])\n ) {\n result += String.fromCharCode(\n Number.parseInt(str[idx + 1] + str[idx + 2], 16),\n );\n idx += 2;\n } else {\n result += str[idx];\n }\n }\n return result;\n}\n"]}
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "name": "content-disposition",
3
+ "version": "2.0.1",
3
4
  "description": "Create and parse Content-Disposition header",
4
- "version": "1.1.0",
5
- "author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
6
- "license": "MIT",
7
5
  "keywords": [
8
6
  "content-disposition",
9
7
  "http",
@@ -15,26 +13,40 @@
15
13
  "type": "opencollective",
16
14
  "url": "https://opencollective.com/express"
17
15
  },
18
- "devDependencies": {
19
- "c8": "^10.1.2",
20
- "eslint": "^8.57.1",
21
- "eslint-config-standard": "^14.1.1",
22
- "eslint-plugin-import": "^2.32.0",
23
- "eslint-plugin-markdown": "^3.0.1",
24
- "eslint-plugin-node": "^11.1.0",
25
- "eslint-plugin-promise": "^6.6.0",
26
- "eslint-plugin-standard": "^4.1.0"
27
- },
16
+ "license": "MIT",
17
+ "author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
18
+ "type": "commonjs",
19
+ "exports": "./dist/index.js",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
28
22
  "files": [
29
- "index.js"
23
+ "dist/"
30
24
  ],
25
+ "scripts": {
26
+ "bench": "vitest bench",
27
+ "build": "ts-scripts build",
28
+ "demo": "node demo/server.js",
29
+ "format": "ts-scripts format",
30
+ "lint": "ts-scripts lint",
31
+ "prepare": "ts-scripts install && npm run build",
32
+ "specs": "ts-scripts specs",
33
+ "test": "ts-scripts test"
34
+ },
35
+ "devDependencies": {
36
+ "@borderless/ts-scripts": "^0.15.0",
37
+ "@vitest/coverage-v8": "^3.2.4",
38
+ "typescript": "^5.9.3",
39
+ "vitest": "^3.2.4"
40
+ },
31
41
  "engines": {
32
42
  "node": ">=18"
33
43
  },
34
- "scripts": {
35
- "lint": "eslint .",
36
- "test": "node --test --test-reporter spec",
37
- "test-ci": "c8 --reporter=lcovonly --reporter=text npm test",
38
- "test-cov": "c8 --reporter=html --reporter=text npm test"
44
+ "ts-scripts": {
45
+ "dist": [
46
+ "dist"
47
+ ],
48
+ "project": [
49
+ "tsconfig.build.json"
50
+ ]
39
51
  }
40
52
  }
@@ -1,12 +1,14 @@
1
- [![Express Logo](https://i.cloudup.com/zfY6lL7eFa-3000x3000.png)](https://expressjs.com/)
1
+ <a href="https://expressjs.com/">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://expressjs.com/images/logos/logo-express-white.svg">
4
+ <img alt="Express Logo" src="https://expressjs.com/images/logos/logo-express-black.svg" width="280">
5
+ </picture>
6
+ </a>
2
7
 
3
8
  **Fast, unopinionated, minimalist web framework for [Node.js](https://nodejs.org).**
4
9
 
5
- **This project has a [Code of Conduct].**
6
-
7
10
  ## Table of contents
8
11
 
9
- - [Table of contents](#table-of-contents)
10
12
  - [Installation](#installation)
11
13
  - [Features](#features)
12
14
  - [Docs \& Community](#docs--community)
@@ -57,7 +59,7 @@ If this is a brand new project, make sure to create a `package.json` first with
57
59
  the [`npm init` command](https://docs.npmjs.com/creating-a-package-json-file).
58
60
 
59
61
  Installation is done using the
60
- [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
62
+ [`npm install` command](https://docs.npmjs.com/downloading-and-installing-packages-locally):
61
63
 
62
64
  ```bash
63
65
  npm install express
@@ -80,7 +82,7 @@ for more information.
80
82
 
81
83
  * [Website and Documentation](https://expressjs.com/) - [[website repo](https://github.com/expressjs/expressjs.com)]
82
84
  * [GitHub Organization](https://github.com/expressjs) for Official Middleware & Modules
83
- * [Github Discussions](https://github.com/expressjs/discussions) for discussion on the development and usage of Express
85
+ * [GitHub Discussions](https://github.com/expressjs/discussions) for discussion on the development and usage of Express
84
86
 
85
87
  **PROTIP** Be sure to read the [migration guide to v5](https://expressjs.com/en/guide/migrating-5)
86
88
 
@@ -152,9 +154,11 @@ tests, triaging incoming pull requests and issues, and more!
152
154
 
153
155
  See the [Contributing Guide] for more technical details on contributing.
154
156
 
157
+ This project has a [Code of Conduct]. By participating, you are expected to uphold this code.
158
+
155
159
  ### Security Issues
156
160
 
157
- If you discover a security vulnerability in Express, please see [Security Policies and Procedures](SECURITY.md).
161
+ If you discover a security vulnerability in Express, please see [Security Policies and Procedures](https://github.com/expressjs/express/security/policy).
158
162
 
159
163
  ### Running Tests
160
164
 
@@ -212,7 +216,9 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
212
216
  * [IamLizu](https://github.com/IamLizu) - **S M Mahmudul Hasan** (he/him)
213
217
  * [Phillip9587](https://github.com/Phillip9587) - **Phillip Barta**
214
218
  * [efekrskl](https://github.com/efekrskl) - **Efe Karasakal**
215
-
219
+ * [rxmarbles](https://github.com/rxmarbles) - **Rick Markins** (he/him)
220
+ * [krzysdz](https://github.com/krzysdz)
221
+ * [GroophyLifefor](https://github.com/GroophyLifefor) - **Murat Kirazkaya**
216
222
 
217
223
  <details>
218
224
  <summary>Triagers emeriti members</summary>
@@ -247,7 +253,7 @@ The original author of Express is [TJ Holowaychuk](https://github.com/tj)
247
253
  * [tunniclm](https://github.com/tunniclm) - **Mike Tunnicliffe**
248
254
  * [enyoghasim](https://github.com/enyoghasim) - **David Enyoghasim**
249
255
  * [0ss](https://github.com/0ss) - **Salah**
250
- * [import-brain](https://github.com/import-brain) - **Eric Cheng** (he/him)
256
+ * [ejcheng](https://github.com/ejcheng)- **Eric Cheng** (he/him)
251
257
  * [dakshkhetan](https://github.com/dakshkhetan) - **Daksh Khetan** (he/him)
252
258
  * [lucasraziel](https://github.com/lucasraziel) - **Lucas Soares Do Rego**
253
259
  * [mertcanaltin](https://github.com/mertcanaltin) - **Mert Can Altin**
@@ -523,7 +523,7 @@ app.render = function render(name, options, callback) {
523
523
  var cache = this.cache;
524
524
  var done = callback;
525
525
  var engines = this.engines;
526
- var opts = options;
526
+ var opts = options || {};
527
527
  var view;
528
528
 
529
529
  // support callback function as second arg
@@ -614,7 +614,7 @@ app.listen = function listen() {
614
614
 
615
615
  function logerror(err) {
616
616
  /* istanbul ignore next */
617
- if (this.get('env') !== 'test') console.error(err.stack || err.toString());
617
+ if (this.get('env') !== 'test') console.error(err);
618
618
  }
619
619
 
620
620
  /**