rahad-all-downloader 2.1.4 → 2.1.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.
- package/.cache/nix/binary-cache-v6.sqlite +0 -0
- package/.cache/replit/modules/nix.res +1 -0
- package/.cache/replit/nix/env.json +1 -1
- package/.cache/typescript/5.4/node_modules/.package-lock.json +0 -88
- package/.cache/typescript/5.4/package-lock.json +0 -90
- package/.cache/typescript/5.4/package.json +1 -1
- package/.replit +4 -4
- package/README.md +2 -2
- package/index.js +1 -19
- package/package.json +4 -19
- package/.cache/replit/__replit_disk_meta.json +0 -1
- package/.cache/typescript/5.0/node_modules/.package-lock.json +0 -12
- package/.cache/typescript/5.0/node_modules/types-registry/README.md +0 -2
- package/.cache/typescript/5.0/node_modules/types-registry/index.json +0 -1
- package/.cache/typescript/5.0/node_modules/types-registry/package.json +0 -20
- package/.cache/typescript/5.0/package-lock.json +0 -17
- package/.cache/typescript/5.0/package.json +0 -1
- package/.cache/typescript/5.3/node_modules/.package-lock.json +0 -99
- package/.cache/typescript/5.3/node_modules/@types/node/LICENSE +0 -21
- package/.cache/typescript/5.3/node_modules/@types/node/README.md +0 -15
- package/.cache/typescript/5.3/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/.cache/typescript/5.3/node_modules/@types/node/assert.d.ts +0 -996
- package/.cache/typescript/5.3/node_modules/@types/node/async_hooks.d.ts +0 -539
- package/.cache/typescript/5.3/node_modules/@types/node/buffer.d.ts +0 -2362
- package/.cache/typescript/5.3/node_modules/@types/node/child_process.d.ts +0 -1540
- package/.cache/typescript/5.3/node_modules/@types/node/cluster.d.ts +0 -432
- package/.cache/typescript/5.3/node_modules/@types/node/console.d.ts +0 -415
- package/.cache/typescript/5.3/node_modules/@types/node/constants.d.ts +0 -19
- package/.cache/typescript/5.3/node_modules/@types/node/crypto.d.ts +0 -4456
- package/.cache/typescript/5.3/node_modules/@types/node/dgram.d.ts +0 -586
- package/.cache/typescript/5.3/node_modules/@types/node/diagnostics_channel.d.ts +0 -191
- package/.cache/typescript/5.3/node_modules/@types/node/dns/promises.d.ts +0 -425
- package/.cache/typescript/5.3/node_modules/@types/node/dns.d.ts +0 -809
- package/.cache/typescript/5.3/node_modules/@types/node/dom-events.d.ts +0 -122
- package/.cache/typescript/5.3/node_modules/@types/node/domain.d.ts +0 -170
- package/.cache/typescript/5.3/node_modules/@types/node/events.d.ts +0 -879
- package/.cache/typescript/5.3/node_modules/@types/node/fs/promises.d.ts +0 -1239
- package/.cache/typescript/5.3/node_modules/@types/node/fs.d.ts +0 -4291
- package/.cache/typescript/5.3/node_modules/@types/node/globals.d.ts +0 -385
- package/.cache/typescript/5.3/node_modules/@types/node/globals.global.d.ts +0 -1
- package/.cache/typescript/5.3/node_modules/@types/node/http.d.ts +0 -1888
- package/.cache/typescript/5.3/node_modules/@types/node/http2.d.ts +0 -2382
- package/.cache/typescript/5.3/node_modules/@types/node/https.d.ts +0 -550
- package/.cache/typescript/5.3/node_modules/@types/node/index.d.ts +0 -88
- package/.cache/typescript/5.3/node_modules/@types/node/inspector.d.ts +0 -2747
- package/.cache/typescript/5.3/node_modules/@types/node/module.d.ts +0 -301
- package/.cache/typescript/5.3/node_modules/@types/node/net.d.ts +0 -949
- package/.cache/typescript/5.3/node_modules/@types/node/os.d.ts +0 -478
- package/.cache/typescript/5.3/node_modules/@types/node/package.json +0 -230
- package/.cache/typescript/5.3/node_modules/@types/node/path.d.ts +0 -191
- package/.cache/typescript/5.3/node_modules/@types/node/perf_hooks.d.ts +0 -639
- package/.cache/typescript/5.3/node_modules/@types/node/process.d.ts +0 -1539
- package/.cache/typescript/5.3/node_modules/@types/node/punycode.d.ts +0 -117
- package/.cache/typescript/5.3/node_modules/@types/node/querystring.d.ts +0 -141
- package/.cache/typescript/5.3/node_modules/@types/node/readline/promises.d.ts +0 -150
- package/.cache/typescript/5.3/node_modules/@types/node/readline.d.ts +0 -539
- package/.cache/typescript/5.3/node_modules/@types/node/repl.d.ts +0 -430
- package/.cache/typescript/5.3/node_modules/@types/node/stream/consumers.d.ts +0 -12
- package/.cache/typescript/5.3/node_modules/@types/node/stream/promises.d.ts +0 -83
- package/.cache/typescript/5.3/node_modules/@types/node/stream/web.d.ts +0 -350
- package/.cache/typescript/5.3/node_modules/@types/node/stream.d.ts +0 -1701
- package/.cache/typescript/5.3/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/.cache/typescript/5.3/node_modules/@types/node/test.d.ts +0 -1382
- package/.cache/typescript/5.3/node_modules/@types/node/timers/promises.d.ts +0 -93
- package/.cache/typescript/5.3/node_modules/@types/node/timers.d.ts +0 -240
- package/.cache/typescript/5.3/node_modules/@types/node/tls.d.ts +0 -1210
- package/.cache/typescript/5.3/node_modules/@types/node/trace_events.d.ts +0 -182
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/console.d.ts +0 -415
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/events.d.ts +0 -879
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs.d.ts +0 -4291
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.d.ts +0 -385
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/https.d.ts +0 -550
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/index.d.ts +0 -88
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/module.d.ts +0 -301
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/net.d.ts +0 -949
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/os.d.ts +0 -478
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/path.d.ts +0 -191
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/process.d.ts +0 -1539
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/url.d.ts +0 -927
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
- package/.cache/typescript/5.3/node_modules/@types/node/tty.d.ts +0 -208
- package/.cache/typescript/5.3/node_modules/@types/node/url.d.ts +0 -927
- package/.cache/typescript/5.3/node_modules/@types/node/util.d.ts +0 -2183
- package/.cache/typescript/5.3/node_modules/@types/node/v8.d.ts +0 -635
- package/.cache/typescript/5.3/node_modules/@types/node/vm.d.ts +0 -903
- package/.cache/typescript/5.3/node_modules/@types/node/wasi.d.ts +0 -158
- package/.cache/typescript/5.3/node_modules/@types/node/worker_threads.d.ts +0 -691
- package/.cache/typescript/5.3/node_modules/@types/node/zlib.d.ts +0 -517
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/LICENSE +0 -21
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/README.md +0 -15
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/externals.d.ts +0 -32
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/index.d.ts +0 -214
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/package.json +0 -83
- package/.cache/typescript/5.3/node_modules/asynckit/LICENSE +0 -21
- package/.cache/typescript/5.3/node_modules/asynckit/README.md +0 -233
- package/.cache/typescript/5.3/node_modules/asynckit/bench.js +0 -76
- package/.cache/typescript/5.3/node_modules/asynckit/index.js +0 -6
- package/.cache/typescript/5.3/node_modules/asynckit/lib/abort.js +0 -29
- package/.cache/typescript/5.3/node_modules/asynckit/lib/async.js +0 -34
- package/.cache/typescript/5.3/node_modules/asynckit/lib/defer.js +0 -26
- package/.cache/typescript/5.3/node_modules/asynckit/lib/iterate.js +0 -75
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_asynckit.js +0 -91
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_parallel.js +0 -25
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial.js +0 -25
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
- package/.cache/typescript/5.3/node_modules/asynckit/lib/state.js +0 -37
- package/.cache/typescript/5.3/node_modules/asynckit/lib/streamify.js +0 -141
- package/.cache/typescript/5.3/node_modules/asynckit/lib/terminator.js +0 -29
- package/.cache/typescript/5.3/node_modules/asynckit/package.json +0 -63
- package/.cache/typescript/5.3/node_modules/asynckit/parallel.js +0 -43
- package/.cache/typescript/5.3/node_modules/asynckit/serial.js +0 -17
- package/.cache/typescript/5.3/node_modules/asynckit/serialOrdered.js +0 -75
- package/.cache/typescript/5.3/node_modules/asynckit/stream.js +0 -21
- package/.cache/typescript/5.3/node_modules/combined-stream/License +0 -19
- package/.cache/typescript/5.3/node_modules/combined-stream/Readme.md +0 -138
- package/.cache/typescript/5.3/node_modules/combined-stream/lib/combined_stream.js +0 -208
- package/.cache/typescript/5.3/node_modules/combined-stream/package.json +0 -25
- package/.cache/typescript/5.3/node_modules/combined-stream/yarn.lock +0 -17
- package/.cache/typescript/5.3/node_modules/delayed-stream/License +0 -19
- package/.cache/typescript/5.3/node_modules/delayed-stream/Makefile +0 -7
- package/.cache/typescript/5.3/node_modules/delayed-stream/Readme.md +0 -141
- package/.cache/typescript/5.3/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
- package/.cache/typescript/5.3/node_modules/delayed-stream/package.json +0 -27
- package/.cache/typescript/5.3/node_modules/form-data/License +0 -19
- package/.cache/typescript/5.3/node_modules/form-data/README.md.bak +0 -358
- package/.cache/typescript/5.3/node_modules/form-data/Readme.md +0 -358
- package/.cache/typescript/5.3/node_modules/form-data/index.d.ts +0 -62
- package/.cache/typescript/5.3/node_modules/form-data/lib/browser.js +0 -2
- package/.cache/typescript/5.3/node_modules/form-data/lib/form_data.js +0 -501
- package/.cache/typescript/5.3/node_modules/form-data/lib/populate.js +0 -10
- package/.cache/typescript/5.3/node_modules/form-data/package.json +0 -68
- package/.cache/typescript/5.3/node_modules/mime-db/HISTORY.md +0 -507
- package/.cache/typescript/5.3/node_modules/mime-db/LICENSE +0 -23
- package/.cache/typescript/5.3/node_modules/mime-db/README.md +0 -100
- package/.cache/typescript/5.3/node_modules/mime-db/db.json +0 -8519
- package/.cache/typescript/5.3/node_modules/mime-db/index.js +0 -12
- package/.cache/typescript/5.3/node_modules/mime-db/package.json +0 -60
- package/.cache/typescript/5.3/node_modules/mime-types/HISTORY.md +0 -397
- package/.cache/typescript/5.3/node_modules/mime-types/LICENSE +0 -23
- package/.cache/typescript/5.3/node_modules/mime-types/README.md +0 -113
- package/.cache/typescript/5.3/node_modules/mime-types/index.js +0 -188
- package/.cache/typescript/5.3/node_modules/mime-types/package.json +0 -44
- package/.cache/typescript/5.3/node_modules/types-registry/README.md +0 -2
- package/.cache/typescript/5.3/node_modules/types-registry/index.json +0 -1
- package/.cache/typescript/5.3/node_modules/types-registry/package.json +0 -20
- package/.cache/typescript/5.3/node_modules/undici-types/README.md +0 -6
- package/.cache/typescript/5.3/node_modules/undici-types/agent.d.ts +0 -31
- package/.cache/typescript/5.3/node_modules/undici-types/api.d.ts +0 -43
- package/.cache/typescript/5.3/node_modules/undici-types/balanced-pool.d.ts +0 -18
- package/.cache/typescript/5.3/node_modules/undici-types/cache.d.ts +0 -36
- package/.cache/typescript/5.3/node_modules/undici-types/client.d.ts +0 -97
- package/.cache/typescript/5.3/node_modules/undici-types/connector.d.ts +0 -34
- package/.cache/typescript/5.3/node_modules/undici-types/content-type.d.ts +0 -21
- package/.cache/typescript/5.3/node_modules/undici-types/cookies.d.ts +0 -28
- package/.cache/typescript/5.3/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
- package/.cache/typescript/5.3/node_modules/undici-types/dispatcher.d.ts +0 -241
- package/.cache/typescript/5.3/node_modules/undici-types/errors.d.ts +0 -128
- package/.cache/typescript/5.3/node_modules/undici-types/fetch.d.ts +0 -209
- package/.cache/typescript/5.3/node_modules/undici-types/file.d.ts +0 -39
- package/.cache/typescript/5.3/node_modules/undici-types/filereader.d.ts +0 -54
- package/.cache/typescript/5.3/node_modules/undici-types/formdata.d.ts +0 -108
- package/.cache/typescript/5.3/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/.cache/typescript/5.3/node_modules/undici-types/global-origin.d.ts +0 -7
- package/.cache/typescript/5.3/node_modules/undici-types/handlers.d.ts +0 -9
- package/.cache/typescript/5.3/node_modules/undici-types/header.d.ts +0 -4
- package/.cache/typescript/5.3/node_modules/undici-types/index.d.ts +0 -63
- package/.cache/typescript/5.3/node_modules/undici-types/interceptors.d.ts +0 -5
- package/.cache/typescript/5.3/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/.cache/typescript/5.3/node_modules/undici-types/mock-client.d.ts +0 -25
- package/.cache/typescript/5.3/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/.cache/typescript/5.3/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/.cache/typescript/5.3/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/.cache/typescript/5.3/node_modules/undici-types/package.json +0 -55
- package/.cache/typescript/5.3/node_modules/undici-types/patch.d.ts +0 -71
- package/.cache/typescript/5.3/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/.cache/typescript/5.3/node_modules/undici-types/pool.d.ts +0 -28
- package/.cache/typescript/5.3/node_modules/undici-types/proxy-agent.d.ts +0 -30
- package/.cache/typescript/5.3/node_modules/undici-types/readable.d.ts +0 -61
- package/.cache/typescript/5.3/node_modules/undici-types/webidl.d.ts +0 -220
- package/.cache/typescript/5.3/node_modules/undici-types/websocket.d.ts +0 -131
- package/.cache/typescript/5.3/package-lock.json +0 -107
- package/.cache/typescript/5.3/package.json +0 -1
- package/.cache/typescript/5.4/node_modules/@types/body-parser/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/body-parser/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/body-parser/index.d.ts +0 -95
- package/.cache/typescript/5.4/node_modules/@types/body-parser/package.json +0 -58
- package/.cache/typescript/5.4/node_modules/@types/connect/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/connect/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/connect/index.d.ts +0 -91
- package/.cache/typescript/5.4/node_modules/@types/connect/package.json +0 -32
- package/.cache/typescript/5.4/node_modules/@types/express/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/express/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/express/index.d.ts +0 -128
- package/.cache/typescript/5.4/node_modules/@types/express/package.json +0 -45
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/index.d.ts +0 -1295
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/package.json +0 -50
- package/.cache/typescript/5.4/node_modules/@types/http-errors/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/http-errors/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/http-errors/index.d.ts +0 -77
- package/.cache/typescript/5.4/node_modules/@types/http-errors/package.json +0 -30
- package/.cache/typescript/5.4/node_modules/@types/mime/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/mime/Mime.d.ts +0 -10
- package/.cache/typescript/5.4/node_modules/@types/mime/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/mime/index.d.ts +0 -31
- package/.cache/typescript/5.4/node_modules/@types/mime/lite.d.ts +0 -7
- package/.cache/typescript/5.4/node_modules/@types/mime/package.json +0 -30
- package/.cache/typescript/5.4/node_modules/@types/qs/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/qs/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/qs/index.d.ts +0 -79
- package/.cache/typescript/5.4/node_modules/@types/qs/package.json +0 -65
- package/.cache/typescript/5.4/node_modules/@types/range-parser/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/range-parser/README.md +0 -53
- package/.cache/typescript/5.4/node_modules/@types/range-parser/index.d.ts +0 -34
- package/.cache/typescript/5.4/node_modules/@types/range-parser/package.json +0 -25
- package/.cache/typescript/5.4/node_modules/@types/send/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/send/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/send/index.d.ts +0 -225
- package/.cache/typescript/5.4/node_modules/@types/send/package.json +0 -33
- package/.cache/typescript/5.4/node_modules/@types/serve-static/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/serve-static/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/serve-static/index.d.ts +0 -107
- package/.cache/typescript/5.4/node_modules/@types/serve-static/package.json +0 -39
- package/.upm/store.json +0 -1
|
@@ -1,1295 +0,0 @@
|
|
|
1
|
-
// This extracts the core definitions from express to prevent a circular dependency between express and serve-static
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
|
|
4
|
-
import { SendOptions } from "send";
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
namespace Express {
|
|
8
|
-
// These open interfaces may be extended in an application-specific manner via declaration merging.
|
|
9
|
-
// See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts)
|
|
10
|
-
interface Request {}
|
|
11
|
-
interface Response {}
|
|
12
|
-
interface Locals {}
|
|
13
|
-
interface Application {}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
import { EventEmitter } from "events";
|
|
18
|
-
import * as http from "http";
|
|
19
|
-
import { ParsedQs } from "qs";
|
|
20
|
-
import { Options as RangeParserOptions, Ranges as RangeParserRanges, Result as RangeParserResult } from "range-parser";
|
|
21
|
-
|
|
22
|
-
export {};
|
|
23
|
-
|
|
24
|
-
export type Query = ParsedQs;
|
|
25
|
-
|
|
26
|
-
export interface NextFunction {
|
|
27
|
-
(err?: any): void;
|
|
28
|
-
/**
|
|
29
|
-
* "Break-out" of a router by calling {next('router')};
|
|
30
|
-
* @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}
|
|
31
|
-
*/
|
|
32
|
-
(deferToNext: "router"): void;
|
|
33
|
-
/**
|
|
34
|
-
* "Break-out" of a route by calling {next('route')};
|
|
35
|
-
* @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}
|
|
36
|
-
*/
|
|
37
|
-
(deferToNext: "route"): void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface Dictionary<T> {
|
|
41
|
-
[key: string]: T;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface ParamsDictionary {
|
|
45
|
-
[key: string]: string;
|
|
46
|
-
}
|
|
47
|
-
export type ParamsArray = string[];
|
|
48
|
-
export type Params = ParamsDictionary | ParamsArray;
|
|
49
|
-
|
|
50
|
-
export interface Locals extends Express.Locals {}
|
|
51
|
-
|
|
52
|
-
export interface RequestHandler<
|
|
53
|
-
P = ParamsDictionary,
|
|
54
|
-
ResBody = any,
|
|
55
|
-
ReqBody = any,
|
|
56
|
-
ReqQuery = ParsedQs,
|
|
57
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
58
|
-
> {
|
|
59
|
-
// tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2)
|
|
60
|
-
(
|
|
61
|
-
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
|
62
|
-
res: Response<ResBody, LocalsObj>,
|
|
63
|
-
next: NextFunction,
|
|
64
|
-
): void;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export type ErrorRequestHandler<
|
|
68
|
-
P = ParamsDictionary,
|
|
69
|
-
ResBody = any,
|
|
70
|
-
ReqBody = any,
|
|
71
|
-
ReqQuery = ParsedQs,
|
|
72
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
73
|
-
> = (
|
|
74
|
-
err: any,
|
|
75
|
-
req: Request<P, ResBody, ReqBody, ReqQuery, LocalsObj>,
|
|
76
|
-
res: Response<ResBody, LocalsObj>,
|
|
77
|
-
next: NextFunction,
|
|
78
|
-
) => void;
|
|
79
|
-
|
|
80
|
-
export type PathParams = string | RegExp | Array<string | RegExp>;
|
|
81
|
-
|
|
82
|
-
export type RequestHandlerParams<
|
|
83
|
-
P = ParamsDictionary,
|
|
84
|
-
ResBody = any,
|
|
85
|
-
ReqBody = any,
|
|
86
|
-
ReqQuery = ParsedQs,
|
|
87
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
88
|
-
> =
|
|
89
|
-
| RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>
|
|
90
|
-
| ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>
|
|
91
|
-
| Array<RequestHandler<P> | ErrorRequestHandler<P>>;
|
|
92
|
-
|
|
93
|
-
type RemoveTail<S extends string, Tail extends string> = S extends `${infer P}${Tail}` ? P : S;
|
|
94
|
-
type GetRouteParameter<S extends string> = RemoveTail<
|
|
95
|
-
RemoveTail<RemoveTail<S, `/${string}`>, `-${string}`>,
|
|
96
|
-
`.${string}`
|
|
97
|
-
>;
|
|
98
|
-
|
|
99
|
-
// prettier-ignore
|
|
100
|
-
export type RouteParameters<Route extends string> = string extends Route ? ParamsDictionary
|
|
101
|
-
: Route extends `${string}(${string}` ? ParamsDictionary // TODO: handling for regex parameters
|
|
102
|
-
: Route extends `${string}:${infer Rest}` ?
|
|
103
|
-
& (
|
|
104
|
-
GetRouteParameter<Rest> extends never ? ParamsDictionary
|
|
105
|
-
: GetRouteParameter<Rest> extends `${infer ParamName}?` ? { [P in ParamName]?: string }
|
|
106
|
-
: { [P in GetRouteParameter<Rest>]: string }
|
|
107
|
-
)
|
|
108
|
-
& (Rest extends `${GetRouteParameter<Rest>}${infer Next}` ? RouteParameters<Next> : unknown)
|
|
109
|
-
: {};
|
|
110
|
-
|
|
111
|
-
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
|
112
|
-
export interface IRouterMatcher<
|
|
113
|
-
T,
|
|
114
|
-
Method extends "all" | "get" | "post" | "put" | "delete" | "patch" | "options" | "head" = any,
|
|
115
|
-
> {
|
|
116
|
-
<
|
|
117
|
-
Route extends string,
|
|
118
|
-
P = RouteParameters<Route>,
|
|
119
|
-
ResBody = any,
|
|
120
|
-
ReqBody = any,
|
|
121
|
-
ReqQuery = ParsedQs,
|
|
122
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
123
|
-
>(
|
|
124
|
-
// (it's used as the default type parameter for P)
|
|
125
|
-
path: Route,
|
|
126
|
-
// (This generic is meant to be passed explicitly.)
|
|
127
|
-
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
128
|
-
): T;
|
|
129
|
-
<
|
|
130
|
-
Path extends string,
|
|
131
|
-
P = RouteParameters<Path>,
|
|
132
|
-
ResBody = any,
|
|
133
|
-
ReqBody = any,
|
|
134
|
-
ReqQuery = ParsedQs,
|
|
135
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
136
|
-
>(
|
|
137
|
-
// (it's used as the default type parameter for P)
|
|
138
|
-
path: Path,
|
|
139
|
-
// (This generic is meant to be passed explicitly.)
|
|
140
|
-
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
141
|
-
): T;
|
|
142
|
-
<
|
|
143
|
-
P = ParamsDictionary,
|
|
144
|
-
ResBody = any,
|
|
145
|
-
ReqBody = any,
|
|
146
|
-
ReqQuery = ParsedQs,
|
|
147
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
148
|
-
>(
|
|
149
|
-
path: PathParams,
|
|
150
|
-
// (This generic is meant to be passed explicitly.)
|
|
151
|
-
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
152
|
-
): T;
|
|
153
|
-
<
|
|
154
|
-
P = ParamsDictionary,
|
|
155
|
-
ResBody = any,
|
|
156
|
-
ReqBody = any,
|
|
157
|
-
ReqQuery = ParsedQs,
|
|
158
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
159
|
-
>(
|
|
160
|
-
path: PathParams,
|
|
161
|
-
// (This generic is meant to be passed explicitly.)
|
|
162
|
-
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
163
|
-
): T;
|
|
164
|
-
(path: PathParams, subApplication: Application): T;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface IRouterHandler<T, Route extends string = string> {
|
|
168
|
-
(...handlers: Array<RequestHandler<RouteParameters<Route>>>): T;
|
|
169
|
-
(...handlers: Array<RequestHandlerParams<RouteParameters<Route>>>): T;
|
|
170
|
-
<
|
|
171
|
-
P = RouteParameters<Route>,
|
|
172
|
-
ResBody = any,
|
|
173
|
-
ReqBody = any,
|
|
174
|
-
ReqQuery = ParsedQs,
|
|
175
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
176
|
-
>(
|
|
177
|
-
// (This generic is meant to be passed explicitly.)
|
|
178
|
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
179
|
-
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
180
|
-
): T;
|
|
181
|
-
<
|
|
182
|
-
P = RouteParameters<Route>,
|
|
183
|
-
ResBody = any,
|
|
184
|
-
ReqBody = any,
|
|
185
|
-
ReqQuery = ParsedQs,
|
|
186
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
187
|
-
>(
|
|
188
|
-
// (This generic is meant to be passed explicitly.)
|
|
189
|
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
190
|
-
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
191
|
-
): T;
|
|
192
|
-
<
|
|
193
|
-
P = ParamsDictionary,
|
|
194
|
-
ResBody = any,
|
|
195
|
-
ReqBody = any,
|
|
196
|
-
ReqQuery = ParsedQs,
|
|
197
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
198
|
-
>(
|
|
199
|
-
// (This generic is meant to be passed explicitly.)
|
|
200
|
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
201
|
-
...handlers: Array<RequestHandler<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
202
|
-
): T;
|
|
203
|
-
<
|
|
204
|
-
P = ParamsDictionary,
|
|
205
|
-
ResBody = any,
|
|
206
|
-
ReqBody = any,
|
|
207
|
-
ReqQuery = ParsedQs,
|
|
208
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
209
|
-
>(
|
|
210
|
-
// (This generic is meant to be passed explicitly.)
|
|
211
|
-
// eslint-disable-next-line @definitelytyped/no-unnecessary-generics
|
|
212
|
-
...handlers: Array<RequestHandlerParams<P, ResBody, ReqBody, ReqQuery, LocalsObj>>
|
|
213
|
-
): T;
|
|
214
|
-
}
|
|
215
|
-
/* eslint-enable @definitelytyped/no-unnecessary-generics */
|
|
216
|
-
|
|
217
|
-
export interface IRouter extends RequestHandler {
|
|
218
|
-
/**
|
|
219
|
-
* Map the given param placeholder `name`(s) to the given callback(s).
|
|
220
|
-
*
|
|
221
|
-
* Parameter mapping is used to provide pre-conditions to routes
|
|
222
|
-
* which use normalized placeholders. For example a _:user_id_ parameter
|
|
223
|
-
* could automatically load a user's information from the database without
|
|
224
|
-
* any additional code,
|
|
225
|
-
*
|
|
226
|
-
* The callback uses the samesignature as middleware, the only differencing
|
|
227
|
-
* being that the value of the placeholder is passed, in this case the _id_
|
|
228
|
-
* of the user. Once the `next()` function is invoked, just like middleware
|
|
229
|
-
* it will continue on to execute the route, or subsequent parameter functions.
|
|
230
|
-
*
|
|
231
|
-
* app.param('user_id', function(req, res, next, id){
|
|
232
|
-
* User.find(id, function(err, user){
|
|
233
|
-
* if (err) {
|
|
234
|
-
* next(err);
|
|
235
|
-
* } else if (user) {
|
|
236
|
-
* req.user = user;
|
|
237
|
-
* next();
|
|
238
|
-
* } else {
|
|
239
|
-
* next(new Error('failed to load user'));
|
|
240
|
-
* }
|
|
241
|
-
* });
|
|
242
|
-
* });
|
|
243
|
-
*/
|
|
244
|
-
param(name: string, handler: RequestParamHandler): this;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
|
|
248
|
-
*
|
|
249
|
-
* @deprecated since version 4.11
|
|
250
|
-
*/
|
|
251
|
-
param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Special-cased "all" method, applying the given route `path`,
|
|
255
|
-
* middleware, and callback to _every_ HTTP method.
|
|
256
|
-
*/
|
|
257
|
-
all: IRouterMatcher<this, "all">;
|
|
258
|
-
get: IRouterMatcher<this, "get">;
|
|
259
|
-
post: IRouterMatcher<this, "post">;
|
|
260
|
-
put: IRouterMatcher<this, "put">;
|
|
261
|
-
delete: IRouterMatcher<this, "delete">;
|
|
262
|
-
patch: IRouterMatcher<this, "patch">;
|
|
263
|
-
options: IRouterMatcher<this, "options">;
|
|
264
|
-
head: IRouterMatcher<this, "head">;
|
|
265
|
-
|
|
266
|
-
checkout: IRouterMatcher<this>;
|
|
267
|
-
connect: IRouterMatcher<this>;
|
|
268
|
-
copy: IRouterMatcher<this>;
|
|
269
|
-
lock: IRouterMatcher<this>;
|
|
270
|
-
merge: IRouterMatcher<this>;
|
|
271
|
-
mkactivity: IRouterMatcher<this>;
|
|
272
|
-
mkcol: IRouterMatcher<this>;
|
|
273
|
-
move: IRouterMatcher<this>;
|
|
274
|
-
"m-search": IRouterMatcher<this>;
|
|
275
|
-
notify: IRouterMatcher<this>;
|
|
276
|
-
propfind: IRouterMatcher<this>;
|
|
277
|
-
proppatch: IRouterMatcher<this>;
|
|
278
|
-
purge: IRouterMatcher<this>;
|
|
279
|
-
report: IRouterMatcher<this>;
|
|
280
|
-
search: IRouterMatcher<this>;
|
|
281
|
-
subscribe: IRouterMatcher<this>;
|
|
282
|
-
trace: IRouterMatcher<this>;
|
|
283
|
-
unlock: IRouterMatcher<this>;
|
|
284
|
-
unsubscribe: IRouterMatcher<this>;
|
|
285
|
-
link: IRouterMatcher<this>;
|
|
286
|
-
unlink: IRouterMatcher<this>;
|
|
287
|
-
|
|
288
|
-
use: IRouterHandler<this> & IRouterMatcher<this>;
|
|
289
|
-
|
|
290
|
-
route<T extends string>(prefix: T): IRoute<T>;
|
|
291
|
-
route(prefix: PathParams): IRoute;
|
|
292
|
-
/**
|
|
293
|
-
* Stack of configured routes
|
|
294
|
-
*/
|
|
295
|
-
stack: ILayer[];
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export interface ILayer {
|
|
299
|
-
route?: IRoute;
|
|
300
|
-
name: string | "<anonymous>";
|
|
301
|
-
params?: Record<string, any>;
|
|
302
|
-
keys: string[];
|
|
303
|
-
path?: string;
|
|
304
|
-
method: string;
|
|
305
|
-
regexp: RegExp;
|
|
306
|
-
handle: (req: Request, res: Response, next: NextFunction) => any;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export interface IRoute<Route extends string = string> {
|
|
310
|
-
path: string;
|
|
311
|
-
stack: ILayer[];
|
|
312
|
-
all: IRouterHandler<this, Route>;
|
|
313
|
-
get: IRouterHandler<this, Route>;
|
|
314
|
-
post: IRouterHandler<this, Route>;
|
|
315
|
-
put: IRouterHandler<this, Route>;
|
|
316
|
-
delete: IRouterHandler<this, Route>;
|
|
317
|
-
patch: IRouterHandler<this, Route>;
|
|
318
|
-
options: IRouterHandler<this, Route>;
|
|
319
|
-
head: IRouterHandler<this, Route>;
|
|
320
|
-
|
|
321
|
-
checkout: IRouterHandler<this, Route>;
|
|
322
|
-
copy: IRouterHandler<this, Route>;
|
|
323
|
-
lock: IRouterHandler<this, Route>;
|
|
324
|
-
merge: IRouterHandler<this, Route>;
|
|
325
|
-
mkactivity: IRouterHandler<this, Route>;
|
|
326
|
-
mkcol: IRouterHandler<this, Route>;
|
|
327
|
-
move: IRouterHandler<this, Route>;
|
|
328
|
-
"m-search": IRouterHandler<this, Route>;
|
|
329
|
-
notify: IRouterHandler<this, Route>;
|
|
330
|
-
purge: IRouterHandler<this, Route>;
|
|
331
|
-
report: IRouterHandler<this, Route>;
|
|
332
|
-
search: IRouterHandler<this, Route>;
|
|
333
|
-
subscribe: IRouterHandler<this, Route>;
|
|
334
|
-
trace: IRouterHandler<this, Route>;
|
|
335
|
-
unlock: IRouterHandler<this, Route>;
|
|
336
|
-
unsubscribe: IRouterHandler<this, Route>;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export interface Router extends IRouter {}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Options passed down into `res.cookie`
|
|
343
|
-
* @link https://expressjs.com/en/api.html#res.cookie
|
|
344
|
-
*/
|
|
345
|
-
export interface CookieOptions {
|
|
346
|
-
/** Convenient option for setting the expiry time relative to the current time in **milliseconds**. */
|
|
347
|
-
maxAge?: number | undefined;
|
|
348
|
-
/** Indicates if the cookie should be signed. */
|
|
349
|
-
signed?: boolean | undefined;
|
|
350
|
-
/** Expiry date of the cookie in GMT. If not specified or set to 0, creates a session cookie. */
|
|
351
|
-
expires?: Date | undefined;
|
|
352
|
-
/** Flags the cookie to be accessible only by the web server. */
|
|
353
|
-
httpOnly?: boolean | undefined;
|
|
354
|
-
/** Path for the cookie. Defaults to “/”. */
|
|
355
|
-
path?: string | undefined;
|
|
356
|
-
/** Domain name for the cookie. Defaults to the domain name of the app. */
|
|
357
|
-
domain?: string | undefined;
|
|
358
|
-
/** Marks the cookie to be used with HTTPS only. */
|
|
359
|
-
secure?: boolean | undefined;
|
|
360
|
-
/** A synchronous function used for cookie value encoding. Defaults to encodeURIComponent. */
|
|
361
|
-
encode?: ((val: string) => string) | undefined;
|
|
362
|
-
/**
|
|
363
|
-
* Value of the “SameSite” Set-Cookie attribute.
|
|
364
|
-
* @link https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-4.1.1.
|
|
365
|
-
*/
|
|
366
|
-
sameSite?: boolean | "lax" | "strict" | "none" | undefined;
|
|
367
|
-
/**
|
|
368
|
-
* Value of the “Priority” Set-Cookie attribute.
|
|
369
|
-
* @link https://datatracker.ietf.org/doc/html/draft-west-cookie-priority-00#section-4.3
|
|
370
|
-
*/
|
|
371
|
-
priority?: "low" | "medium" | "high";
|
|
372
|
-
/** Marks the cookie to use partioned storage. */
|
|
373
|
-
partitioned?: boolean | undefined;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export interface ByteRange {
|
|
377
|
-
start: number;
|
|
378
|
-
end: number;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
export interface RequestRanges extends RangeParserRanges {}
|
|
382
|
-
|
|
383
|
-
export type Errback = (err: Error) => void;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* @param P For most requests, this should be `ParamsDictionary`, but if you're
|
|
387
|
-
* using this in a route handler for a route that uses a `RegExp` or a wildcard
|
|
388
|
-
* `string` path (e.g. `'/user/*'`), then `req.params` will be an array, in
|
|
389
|
-
* which case you should use `ParamsArray` instead.
|
|
390
|
-
*
|
|
391
|
-
* @see https://expressjs.com/en/api.html#req.params
|
|
392
|
-
*
|
|
393
|
-
* @example
|
|
394
|
-
* app.get('/user/:id', (req, res) => res.send(req.params.id)); // implicitly `ParamsDictionary`
|
|
395
|
-
* app.get<ParamsArray>(/user\/(.*)/, (req, res) => res.send(req.params[0]));
|
|
396
|
-
* app.get<ParamsArray>('/user/*', (req, res) => res.send(req.params[0]));
|
|
397
|
-
*/
|
|
398
|
-
export interface Request<
|
|
399
|
-
P = ParamsDictionary,
|
|
400
|
-
ResBody = any,
|
|
401
|
-
ReqBody = any,
|
|
402
|
-
ReqQuery = ParsedQs,
|
|
403
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
404
|
-
> extends http.IncomingMessage, Express.Request {
|
|
405
|
-
/**
|
|
406
|
-
* Return request header.
|
|
407
|
-
*
|
|
408
|
-
* The `Referrer` header field is special-cased,
|
|
409
|
-
* both `Referrer` and `Referer` are interchangeable.
|
|
410
|
-
*
|
|
411
|
-
* Examples:
|
|
412
|
-
*
|
|
413
|
-
* req.get('Content-Type');
|
|
414
|
-
* // => "text/plain"
|
|
415
|
-
*
|
|
416
|
-
* req.get('content-type');
|
|
417
|
-
* // => "text/plain"
|
|
418
|
-
*
|
|
419
|
-
* req.get('Something');
|
|
420
|
-
* // => undefined
|
|
421
|
-
*
|
|
422
|
-
* Aliased as `req.header()`.
|
|
423
|
-
*/
|
|
424
|
-
get(name: "set-cookie"): string[] | undefined;
|
|
425
|
-
get(name: string): string | undefined;
|
|
426
|
-
|
|
427
|
-
header(name: "set-cookie"): string[] | undefined;
|
|
428
|
-
header(name: string): string | undefined;
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Check if the given `type(s)` is acceptable, returning
|
|
432
|
-
* the best match when true, otherwise `undefined`, in which
|
|
433
|
-
* case you should respond with 406 "Not Acceptable".
|
|
434
|
-
*
|
|
435
|
-
* The `type` value may be a single mime type string
|
|
436
|
-
* such as "application/json", the extension name
|
|
437
|
-
* such as "json", a comma-delimted list such as "json, html, text/plain",
|
|
438
|
-
* or an array `["json", "html", "text/plain"]`. When a list
|
|
439
|
-
* or array is given the _best_ match, if any is returned.
|
|
440
|
-
*
|
|
441
|
-
* Examples:
|
|
442
|
-
*
|
|
443
|
-
* // Accept: text/html
|
|
444
|
-
* req.accepts('html');
|
|
445
|
-
* // => "html"
|
|
446
|
-
*
|
|
447
|
-
* // Accept: text/*, application/json
|
|
448
|
-
* req.accepts('html');
|
|
449
|
-
* // => "html"
|
|
450
|
-
* req.accepts('text/html');
|
|
451
|
-
* // => "text/html"
|
|
452
|
-
* req.accepts('json, text');
|
|
453
|
-
* // => "json"
|
|
454
|
-
* req.accepts('application/json');
|
|
455
|
-
* // => "application/json"
|
|
456
|
-
*
|
|
457
|
-
* // Accept: text/*, application/json
|
|
458
|
-
* req.accepts('image/png');
|
|
459
|
-
* req.accepts('png');
|
|
460
|
-
* // => false
|
|
461
|
-
*
|
|
462
|
-
* // Accept: text/*;q=.5, application/json
|
|
463
|
-
* req.accepts(['html', 'json']);
|
|
464
|
-
* req.accepts('html, json');
|
|
465
|
-
* // => "json"
|
|
466
|
-
*/
|
|
467
|
-
accepts(): string[];
|
|
468
|
-
accepts(type: string): string | false;
|
|
469
|
-
accepts(type: string[]): string | false;
|
|
470
|
-
accepts(...type: string[]): string | false;
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Returns the first accepted charset of the specified character sets,
|
|
474
|
-
* based on the request's Accept-Charset HTTP header field.
|
|
475
|
-
* If none of the specified charsets is accepted, returns false.
|
|
476
|
-
*
|
|
477
|
-
* For more information, or if you have issues or concerns, see accepts.
|
|
478
|
-
*/
|
|
479
|
-
acceptsCharsets(): string[];
|
|
480
|
-
acceptsCharsets(charset: string): string | false;
|
|
481
|
-
acceptsCharsets(charset: string[]): string | false;
|
|
482
|
-
acceptsCharsets(...charset: string[]): string | false;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Returns the first accepted encoding of the specified encodings,
|
|
486
|
-
* based on the request's Accept-Encoding HTTP header field.
|
|
487
|
-
* If none of the specified encodings is accepted, returns false.
|
|
488
|
-
*
|
|
489
|
-
* For more information, or if you have issues or concerns, see accepts.
|
|
490
|
-
*/
|
|
491
|
-
acceptsEncodings(): string[];
|
|
492
|
-
acceptsEncodings(encoding: string): string | false;
|
|
493
|
-
acceptsEncodings(encoding: string[]): string | false;
|
|
494
|
-
acceptsEncodings(...encoding: string[]): string | false;
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Returns the first accepted language of the specified languages,
|
|
498
|
-
* based on the request's Accept-Language HTTP header field.
|
|
499
|
-
* If none of the specified languages is accepted, returns false.
|
|
500
|
-
*
|
|
501
|
-
* For more information, or if you have issues or concerns, see accepts.
|
|
502
|
-
*/
|
|
503
|
-
acceptsLanguages(): string[];
|
|
504
|
-
acceptsLanguages(lang: string): string | false;
|
|
505
|
-
acceptsLanguages(lang: string[]): string | false;
|
|
506
|
-
acceptsLanguages(...lang: string[]): string | false;
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Parse Range header field, capping to the given `size`.
|
|
510
|
-
*
|
|
511
|
-
* Unspecified ranges such as "0-" require knowledge of your resource length. In
|
|
512
|
-
* the case of a byte range this is of course the total number of bytes.
|
|
513
|
-
* If the Range header field is not given `undefined` is returned.
|
|
514
|
-
* If the Range header field is given, return value is a result of range-parser.
|
|
515
|
-
* See more ./types/range-parser/index.d.ts
|
|
516
|
-
*
|
|
517
|
-
* NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
|
|
518
|
-
* should respond with 4 users when available, not 3.
|
|
519
|
-
*/
|
|
520
|
-
range(size: number, options?: RangeParserOptions): RangeParserRanges | RangeParserResult | undefined;
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Return an array of Accepted media types
|
|
524
|
-
* ordered from highest quality to lowest.
|
|
525
|
-
*/
|
|
526
|
-
accepted: MediaType[];
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* @deprecated since 4.11 Use either req.params, req.body or req.query, as applicable.
|
|
530
|
-
*
|
|
531
|
-
* Return the value of param `name` when present or `defaultValue`.
|
|
532
|
-
*
|
|
533
|
-
* - Checks route placeholders, ex: _/user/:id_
|
|
534
|
-
* - Checks body params, ex: id=12, {"id":12}
|
|
535
|
-
* - Checks query string params, ex: ?id=12
|
|
536
|
-
*
|
|
537
|
-
* To utilize request bodies, `req.body`
|
|
538
|
-
* should be an object. This can be done by using
|
|
539
|
-
* the `connect.bodyParser()` middleware.
|
|
540
|
-
*/
|
|
541
|
-
param(name: string, defaultValue?: any): string;
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Check if the incoming request contains the "Content-Type"
|
|
545
|
-
* header field, and it contains the give mime `type`.
|
|
546
|
-
*
|
|
547
|
-
* Examples:
|
|
548
|
-
*
|
|
549
|
-
* // With Content-Type: text/html; charset=utf-8
|
|
550
|
-
* req.is('html');
|
|
551
|
-
* req.is('text/html');
|
|
552
|
-
* req.is('text/*');
|
|
553
|
-
* // => true
|
|
554
|
-
*
|
|
555
|
-
* // When Content-Type is application/json
|
|
556
|
-
* req.is('json');
|
|
557
|
-
* req.is('application/json');
|
|
558
|
-
* req.is('application/*');
|
|
559
|
-
* // => true
|
|
560
|
-
*
|
|
561
|
-
* req.is('html');
|
|
562
|
-
* // => false
|
|
563
|
-
*/
|
|
564
|
-
is(type: string | string[]): string | false | null;
|
|
565
|
-
|
|
566
|
-
/**
|
|
567
|
-
* Return the protocol string "http" or "https"
|
|
568
|
-
* when requested with TLS. When the "trust proxy"
|
|
569
|
-
* setting is enabled the "X-Forwarded-Proto" header
|
|
570
|
-
* field will be trusted. If you're running behind
|
|
571
|
-
* a reverse proxy that supplies https for you this
|
|
572
|
-
* may be enabled.
|
|
573
|
-
*/
|
|
574
|
-
readonly protocol: string;
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* Short-hand for:
|
|
578
|
-
*
|
|
579
|
-
* req.protocol == 'https'
|
|
580
|
-
*/
|
|
581
|
-
readonly secure: boolean;
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Return the remote address, or when
|
|
585
|
-
* "trust proxy" is `true` return
|
|
586
|
-
* the upstream addr.
|
|
587
|
-
*
|
|
588
|
-
* Value may be undefined if the `req.socket` is destroyed
|
|
589
|
-
* (for example, if the client disconnected).
|
|
590
|
-
*/
|
|
591
|
-
readonly ip: string | undefined;
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* When "trust proxy" is `true`, parse
|
|
595
|
-
* the "X-Forwarded-For" ip address list.
|
|
596
|
-
*
|
|
597
|
-
* For example if the value were "client, proxy1, proxy2"
|
|
598
|
-
* you would receive the array `["client", "proxy1", "proxy2"]`
|
|
599
|
-
* where "proxy2" is the furthest down-stream.
|
|
600
|
-
*/
|
|
601
|
-
readonly ips: string[];
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* Return subdomains as an array.
|
|
605
|
-
*
|
|
606
|
-
* Subdomains are the dot-separated parts of the host before the main domain of
|
|
607
|
-
* the app. By default, the domain of the app is assumed to be the last two
|
|
608
|
-
* parts of the host. This can be changed by setting "subdomain offset".
|
|
609
|
-
*
|
|
610
|
-
* For example, if the domain is "tobi.ferrets.example.com":
|
|
611
|
-
* If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`.
|
|
612
|
-
* If "subdomain offset" is 3, req.subdomains is `["tobi"]`.
|
|
613
|
-
*/
|
|
614
|
-
readonly subdomains: string[];
|
|
615
|
-
|
|
616
|
-
/**
|
|
617
|
-
* Short-hand for `url.parse(req.url).pathname`.
|
|
618
|
-
*/
|
|
619
|
-
readonly path: string;
|
|
620
|
-
|
|
621
|
-
/**
|
|
622
|
-
* Parse the "Host" header field hostname.
|
|
623
|
-
*/
|
|
624
|
-
readonly hostname: string;
|
|
625
|
-
|
|
626
|
-
/**
|
|
627
|
-
* @deprecated Use hostname instead.
|
|
628
|
-
*/
|
|
629
|
-
readonly host: string;
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Check if the request is fresh, aka
|
|
633
|
-
* Last-Modified and/or the ETag
|
|
634
|
-
* still match.
|
|
635
|
-
*/
|
|
636
|
-
readonly fresh: boolean;
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Check if the request is stale, aka
|
|
640
|
-
* "Last-Modified" and / or the "ETag" for the
|
|
641
|
-
* resource has changed.
|
|
642
|
-
*/
|
|
643
|
-
readonly stale: boolean;
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* Check if the request was an _XMLHttpRequest_.
|
|
647
|
-
*/
|
|
648
|
-
readonly xhr: boolean;
|
|
649
|
-
|
|
650
|
-
// body: { username: string; password: string; remember: boolean; title: string; };
|
|
651
|
-
body: ReqBody;
|
|
652
|
-
|
|
653
|
-
// cookies: { string; remember: boolean; };
|
|
654
|
-
cookies: any;
|
|
655
|
-
|
|
656
|
-
method: string;
|
|
657
|
-
|
|
658
|
-
params: P;
|
|
659
|
-
|
|
660
|
-
query: ReqQuery;
|
|
661
|
-
|
|
662
|
-
route: any;
|
|
663
|
-
|
|
664
|
-
signedCookies: any;
|
|
665
|
-
|
|
666
|
-
originalUrl: string;
|
|
667
|
-
|
|
668
|
-
url: string;
|
|
669
|
-
|
|
670
|
-
baseUrl: string;
|
|
671
|
-
|
|
672
|
-
app: Application;
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* After middleware.init executed, Request will contain res and next properties
|
|
676
|
-
* See: express/lib/middleware/init.js
|
|
677
|
-
*/
|
|
678
|
-
res?: Response<ResBody, LocalsObj> | undefined;
|
|
679
|
-
next?: NextFunction | undefined;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
export interface MediaType {
|
|
683
|
-
value: string;
|
|
684
|
-
quality: number;
|
|
685
|
-
type: string;
|
|
686
|
-
subtype: string;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
export type Send<ResBody = any, T = Response<ResBody>> = (body?: ResBody) => T;
|
|
690
|
-
|
|
691
|
-
export interface SendFileOptions extends SendOptions {
|
|
692
|
-
/** Object containing HTTP headers to serve with the file. */
|
|
693
|
-
headers?: Record<string, unknown>;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export interface DownloadOptions extends SendOptions {
|
|
697
|
-
/** Object containing HTTP headers to serve with the file. The header `Content-Disposition` will be overridden by the filename argument. */
|
|
698
|
-
headers?: Record<string, unknown>;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
export interface Response<
|
|
702
|
-
ResBody = any,
|
|
703
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
704
|
-
StatusCode extends number = number,
|
|
705
|
-
> extends http.ServerResponse, Express.Response {
|
|
706
|
-
/**
|
|
707
|
-
* Set status `code`.
|
|
708
|
-
*/
|
|
709
|
-
status(code: StatusCode): this;
|
|
710
|
-
|
|
711
|
-
/**
|
|
712
|
-
* Set the response HTTP status code to `statusCode` and send its string representation as the response body.
|
|
713
|
-
* @link http://expressjs.com/4x/api.html#res.sendStatus
|
|
714
|
-
*
|
|
715
|
-
* Examples:
|
|
716
|
-
*
|
|
717
|
-
* res.sendStatus(200); // equivalent to res.status(200).send('OK')
|
|
718
|
-
* res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
|
|
719
|
-
* res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
|
|
720
|
-
* res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
|
|
721
|
-
*/
|
|
722
|
-
sendStatus(code: StatusCode): this;
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* Set Link header field with the given `links`.
|
|
726
|
-
*
|
|
727
|
-
* Examples:
|
|
728
|
-
*
|
|
729
|
-
* res.links({
|
|
730
|
-
* next: 'http://api.example.com/users?page=2',
|
|
731
|
-
* last: 'http://api.example.com/users?page=5'
|
|
732
|
-
* });
|
|
733
|
-
*/
|
|
734
|
-
links(links: any): this;
|
|
735
|
-
|
|
736
|
-
/**
|
|
737
|
-
* Send a response.
|
|
738
|
-
*
|
|
739
|
-
* Examples:
|
|
740
|
-
*
|
|
741
|
-
* res.send(new Buffer('wahoo'));
|
|
742
|
-
* res.send({ some: 'json' });
|
|
743
|
-
* res.send('<p>some html</p>');
|
|
744
|
-
* res.status(404).send('Sorry, cant find that');
|
|
745
|
-
*/
|
|
746
|
-
send: Send<ResBody, this>;
|
|
747
|
-
|
|
748
|
-
/**
|
|
749
|
-
* Send JSON response.
|
|
750
|
-
*
|
|
751
|
-
* Examples:
|
|
752
|
-
*
|
|
753
|
-
* res.json(null);
|
|
754
|
-
* res.json({ user: 'tj' });
|
|
755
|
-
* res.status(500).json('oh noes!');
|
|
756
|
-
* res.status(404).json('I dont have that');
|
|
757
|
-
*/
|
|
758
|
-
json: Send<ResBody, this>;
|
|
759
|
-
|
|
760
|
-
/**
|
|
761
|
-
* Send JSON response with JSONP callback support.
|
|
762
|
-
*
|
|
763
|
-
* Examples:
|
|
764
|
-
*
|
|
765
|
-
* res.jsonp(null);
|
|
766
|
-
* res.jsonp({ user: 'tj' });
|
|
767
|
-
* res.status(500).jsonp('oh noes!');
|
|
768
|
-
* res.status(404).jsonp('I dont have that');
|
|
769
|
-
*/
|
|
770
|
-
jsonp: Send<ResBody, this>;
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Transfer the file at the given `path`.
|
|
774
|
-
*
|
|
775
|
-
* Automatically sets the _Content-Type_ response header field.
|
|
776
|
-
* The callback `fn(err)` is invoked when the transfer is complete
|
|
777
|
-
* or when an error occurs. Be sure to check `res.headersSent`
|
|
778
|
-
* if you wish to attempt responding, as the header and some data
|
|
779
|
-
* may have already been transferred.
|
|
780
|
-
*
|
|
781
|
-
* Options:
|
|
782
|
-
*
|
|
783
|
-
* - `maxAge` defaulting to 0 (can be string converted by `ms`)
|
|
784
|
-
* - `root` root directory for relative filenames
|
|
785
|
-
* - `headers` object of headers to serve with file
|
|
786
|
-
* - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them
|
|
787
|
-
*
|
|
788
|
-
* Other options are passed along to `send`.
|
|
789
|
-
*
|
|
790
|
-
* Examples:
|
|
791
|
-
*
|
|
792
|
-
* The following example illustrates how `res.sendFile()` may
|
|
793
|
-
* be used as an alternative for the `static()` middleware for
|
|
794
|
-
* dynamic situations. The code backing `res.sendFile()` is actually
|
|
795
|
-
* the same code, so HTTP cache support etc is identical.
|
|
796
|
-
*
|
|
797
|
-
* app.get('/user/:uid/photos/:file', function(req, res){
|
|
798
|
-
* var uid = req.params.uid
|
|
799
|
-
* , file = req.params.file;
|
|
800
|
-
*
|
|
801
|
-
* req.user.mayViewFilesFrom(uid, function(yes){
|
|
802
|
-
* if (yes) {
|
|
803
|
-
* res.sendFile('/uploads/' + uid + '/' + file);
|
|
804
|
-
* } else {
|
|
805
|
-
* res.send(403, 'Sorry! you cant see that.');
|
|
806
|
-
* }
|
|
807
|
-
* });
|
|
808
|
-
* });
|
|
809
|
-
*
|
|
810
|
-
* @api public
|
|
811
|
-
*/
|
|
812
|
-
sendFile(path: string, fn?: Errback): void;
|
|
813
|
-
sendFile(path: string, options: SendFileOptions, fn?: Errback): void;
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* @deprecated Use sendFile instead.
|
|
817
|
-
*/
|
|
818
|
-
sendfile(path: string): void;
|
|
819
|
-
/**
|
|
820
|
-
* @deprecated Use sendFile instead.
|
|
821
|
-
*/
|
|
822
|
-
sendfile(path: string, options: SendFileOptions): void;
|
|
823
|
-
/**
|
|
824
|
-
* @deprecated Use sendFile instead.
|
|
825
|
-
*/
|
|
826
|
-
sendfile(path: string, fn: Errback): void;
|
|
827
|
-
/**
|
|
828
|
-
* @deprecated Use sendFile instead.
|
|
829
|
-
*/
|
|
830
|
-
sendfile(path: string, options: SendFileOptions, fn: Errback): void;
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* Transfer the file at the given `path` as an attachment.
|
|
834
|
-
*
|
|
835
|
-
* Optionally providing an alternate attachment `filename`,
|
|
836
|
-
* and optional callback `fn(err)`. The callback is invoked
|
|
837
|
-
* when the data transfer is complete, or when an error has
|
|
838
|
-
* ocurred. Be sure to check `res.headersSent` if you plan to respond.
|
|
839
|
-
*
|
|
840
|
-
* The optional options argument passes through to the underlying
|
|
841
|
-
* res.sendFile() call, and takes the exact same parameters.
|
|
842
|
-
*
|
|
843
|
-
* This method uses `res.sendfile()`.
|
|
844
|
-
*/
|
|
845
|
-
download(path: string, fn?: Errback): void;
|
|
846
|
-
download(path: string, filename: string, fn?: Errback): void;
|
|
847
|
-
download(path: string, filename: string, options: DownloadOptions, fn?: Errback): void;
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
|
851
|
-
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
852
|
-
*
|
|
853
|
-
* Examples:
|
|
854
|
-
*
|
|
855
|
-
* res.type('.html');
|
|
856
|
-
* res.type('html');
|
|
857
|
-
* res.type('json');
|
|
858
|
-
* res.type('application/json');
|
|
859
|
-
* res.type('png');
|
|
860
|
-
*/
|
|
861
|
-
contentType(type: string): this;
|
|
862
|
-
|
|
863
|
-
/**
|
|
864
|
-
* Set _Content-Type_ response header with `type` through `mime.lookup()`
|
|
865
|
-
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
866
|
-
*
|
|
867
|
-
* Examples:
|
|
868
|
-
*
|
|
869
|
-
* res.type('.html');
|
|
870
|
-
* res.type('html');
|
|
871
|
-
* res.type('json');
|
|
872
|
-
* res.type('application/json');
|
|
873
|
-
* res.type('png');
|
|
874
|
-
*/
|
|
875
|
-
type(type: string): this;
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* Respond to the Acceptable formats using an `obj`
|
|
879
|
-
* of mime-type callbacks.
|
|
880
|
-
*
|
|
881
|
-
* This method uses `req.accepted`, an array of
|
|
882
|
-
* acceptable types ordered by their quality values.
|
|
883
|
-
* When "Accept" is not present the _first_ callback
|
|
884
|
-
* is invoked, otherwise the first match is used. When
|
|
885
|
-
* no match is performed the server responds with
|
|
886
|
-
* 406 "Not Acceptable".
|
|
887
|
-
*
|
|
888
|
-
* Content-Type is set for you, however if you choose
|
|
889
|
-
* you may alter this within the callback using `res.type()`
|
|
890
|
-
* or `res.set('Content-Type', ...)`.
|
|
891
|
-
*
|
|
892
|
-
* res.format({
|
|
893
|
-
* 'text/plain': function(){
|
|
894
|
-
* res.send('hey');
|
|
895
|
-
* },
|
|
896
|
-
*
|
|
897
|
-
* 'text/html': function(){
|
|
898
|
-
* res.send('<p>hey</p>');
|
|
899
|
-
* },
|
|
900
|
-
*
|
|
901
|
-
* 'appliation/json': function(){
|
|
902
|
-
* res.send({ message: 'hey' });
|
|
903
|
-
* }
|
|
904
|
-
* });
|
|
905
|
-
*
|
|
906
|
-
* In addition to canonicalized MIME types you may
|
|
907
|
-
* also use extnames mapped to these types:
|
|
908
|
-
*
|
|
909
|
-
* res.format({
|
|
910
|
-
* text: function(){
|
|
911
|
-
* res.send('hey');
|
|
912
|
-
* },
|
|
913
|
-
*
|
|
914
|
-
* html: function(){
|
|
915
|
-
* res.send('<p>hey</p>');
|
|
916
|
-
* },
|
|
917
|
-
*
|
|
918
|
-
* json: function(){
|
|
919
|
-
* res.send({ message: 'hey' });
|
|
920
|
-
* }
|
|
921
|
-
* });
|
|
922
|
-
*
|
|
923
|
-
* By default Express passes an `Error`
|
|
924
|
-
* with a `.status` of 406 to `next(err)`
|
|
925
|
-
* if a match is not made. If you provide
|
|
926
|
-
* a `.default` callback it will be invoked
|
|
927
|
-
* instead.
|
|
928
|
-
*/
|
|
929
|
-
format(obj: any): this;
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* Set _Content-Disposition_ header to _attachment_ with optional `filename`.
|
|
933
|
-
*/
|
|
934
|
-
attachment(filename?: string): this;
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* Set header `field` to `val`, or pass
|
|
938
|
-
* an object of header fields.
|
|
939
|
-
*
|
|
940
|
-
* Examples:
|
|
941
|
-
*
|
|
942
|
-
* res.set('Foo', ['bar', 'baz']);
|
|
943
|
-
* res.set('Accept', 'application/json');
|
|
944
|
-
* res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
|
|
945
|
-
*
|
|
946
|
-
* Aliased as `res.header()`.
|
|
947
|
-
*/
|
|
948
|
-
set(field: any): this;
|
|
949
|
-
set(field: string, value?: string | string[]): this;
|
|
950
|
-
|
|
951
|
-
header(field: any): this;
|
|
952
|
-
header(field: string, value?: string | string[]): this;
|
|
953
|
-
|
|
954
|
-
// Property indicating if HTTP headers has been sent for the response.
|
|
955
|
-
headersSent: boolean;
|
|
956
|
-
|
|
957
|
-
/** Get value for header `field`. */
|
|
958
|
-
get(field: string): string | undefined;
|
|
959
|
-
|
|
960
|
-
/** Clear cookie `name`. */
|
|
961
|
-
clearCookie(name: string, options?: CookieOptions): this;
|
|
962
|
-
|
|
963
|
-
/**
|
|
964
|
-
* Set cookie `name` to `val`, with the given `options`.
|
|
965
|
-
*
|
|
966
|
-
* Options:
|
|
967
|
-
*
|
|
968
|
-
* - `maxAge` max-age in milliseconds, converted to `expires`
|
|
969
|
-
* - `signed` sign the cookie
|
|
970
|
-
* - `path` defaults to "/"
|
|
971
|
-
*
|
|
972
|
-
* Examples:
|
|
973
|
-
*
|
|
974
|
-
* // "Remember Me" for 15 minutes
|
|
975
|
-
* res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
|
|
976
|
-
*
|
|
977
|
-
* // save as above
|
|
978
|
-
* res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
|
|
979
|
-
*/
|
|
980
|
-
cookie(name: string, val: string, options: CookieOptions): this;
|
|
981
|
-
cookie(name: string, val: any, options: CookieOptions): this;
|
|
982
|
-
cookie(name: string, val: any): this;
|
|
983
|
-
|
|
984
|
-
/**
|
|
985
|
-
* Set the location header to `url`.
|
|
986
|
-
*
|
|
987
|
-
* The given `url` can also be the name of a mapped url, for
|
|
988
|
-
* example by default express supports "back" which redirects
|
|
989
|
-
* to the _Referrer_ or _Referer_ headers or "/".
|
|
990
|
-
*
|
|
991
|
-
* Examples:
|
|
992
|
-
*
|
|
993
|
-
* res.location('/foo/bar').;
|
|
994
|
-
* res.location('http://example.com');
|
|
995
|
-
* res.location('../login'); // /blog/post/1 -> /blog/login
|
|
996
|
-
*
|
|
997
|
-
* Mounting:
|
|
998
|
-
*
|
|
999
|
-
* When an application is mounted and `res.location()`
|
|
1000
|
-
* is given a path that does _not_ lead with "/" it becomes
|
|
1001
|
-
* relative to the mount-point. For example if the application
|
|
1002
|
-
* is mounted at "/blog", the following would become "/blog/login".
|
|
1003
|
-
*
|
|
1004
|
-
* res.location('login');
|
|
1005
|
-
*
|
|
1006
|
-
* While the leading slash would result in a location of "/login":
|
|
1007
|
-
*
|
|
1008
|
-
* res.location('/login');
|
|
1009
|
-
*/
|
|
1010
|
-
location(url: string): this;
|
|
1011
|
-
|
|
1012
|
-
/**
|
|
1013
|
-
* Redirect to the given `url` with optional response `status`
|
|
1014
|
-
* defaulting to 302.
|
|
1015
|
-
*
|
|
1016
|
-
* The resulting `url` is determined by `res.location()`, so
|
|
1017
|
-
* it will play nicely with mounted apps, relative paths,
|
|
1018
|
-
* `"back"` etc.
|
|
1019
|
-
*
|
|
1020
|
-
* Examples:
|
|
1021
|
-
*
|
|
1022
|
-
* res.redirect('back');
|
|
1023
|
-
* res.redirect('/foo/bar');
|
|
1024
|
-
* res.redirect('http://example.com');
|
|
1025
|
-
* res.redirect(301, 'http://example.com');
|
|
1026
|
-
* res.redirect('http://example.com', 301);
|
|
1027
|
-
* res.redirect('../login'); // /blog/post/1 -> /blog/login
|
|
1028
|
-
*/
|
|
1029
|
-
redirect(url: string): void;
|
|
1030
|
-
redirect(status: number, url: string): void;
|
|
1031
|
-
/** @deprecated use res.redirect(status, url) instead */
|
|
1032
|
-
redirect(url: string, status: number): void;
|
|
1033
|
-
|
|
1034
|
-
/**
|
|
1035
|
-
* Render `view` with the given `options` and optional callback `fn`.
|
|
1036
|
-
* When a callback function is given a response will _not_ be made
|
|
1037
|
-
* automatically, otherwise a response of _200_ and _text/html_ is given.
|
|
1038
|
-
*
|
|
1039
|
-
* Options:
|
|
1040
|
-
*
|
|
1041
|
-
* - `cache` boolean hinting to the engine it should cache
|
|
1042
|
-
* - `filename` filename of the view being rendered
|
|
1043
|
-
*/
|
|
1044
|
-
render(view: string, options?: object, callback?: (err: Error, html: string) => void): void;
|
|
1045
|
-
render(view: string, callback?: (err: Error, html: string) => void): void;
|
|
1046
|
-
|
|
1047
|
-
locals: LocalsObj & Locals;
|
|
1048
|
-
|
|
1049
|
-
charset: string;
|
|
1050
|
-
|
|
1051
|
-
/**
|
|
1052
|
-
* Adds the field to the Vary response header, if it is not there already.
|
|
1053
|
-
* Examples:
|
|
1054
|
-
*
|
|
1055
|
-
* res.vary('User-Agent').render('docs');
|
|
1056
|
-
*/
|
|
1057
|
-
vary(field: string): this;
|
|
1058
|
-
|
|
1059
|
-
app: Application;
|
|
1060
|
-
|
|
1061
|
-
/**
|
|
1062
|
-
* Appends the specified value to the HTTP response header field.
|
|
1063
|
-
* If the header is not already set, it creates the header with the specified value.
|
|
1064
|
-
* The value parameter can be a string or an array.
|
|
1065
|
-
*
|
|
1066
|
-
* Note: calling res.set() after res.append() will reset the previously-set header value.
|
|
1067
|
-
*
|
|
1068
|
-
* @since 4.11.0
|
|
1069
|
-
*/
|
|
1070
|
-
append(field: string, value?: string[] | string): this;
|
|
1071
|
-
|
|
1072
|
-
/**
|
|
1073
|
-
* After middleware.init executed, Response will contain req property
|
|
1074
|
-
* See: express/lib/middleware/init.js
|
|
1075
|
-
*/
|
|
1076
|
-
req: Request;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
export interface Handler extends RequestHandler {}
|
|
1080
|
-
|
|
1081
|
-
export type RequestParamHandler = (req: Request, res: Response, next: NextFunction, value: any, name: string) => any;
|
|
1082
|
-
|
|
1083
|
-
export type ApplicationRequestHandler<T> =
|
|
1084
|
-
& IRouterHandler<T>
|
|
1085
|
-
& IRouterMatcher<T>
|
|
1086
|
-
& ((...handlers: RequestHandlerParams[]) => T);
|
|
1087
|
-
|
|
1088
|
-
export interface Application<
|
|
1089
|
-
LocalsObj extends Record<string, any> = Record<string, any>,
|
|
1090
|
-
> extends EventEmitter, IRouter, Express.Application {
|
|
1091
|
-
/**
|
|
1092
|
-
* Express instance itself is a request handler, which could be invoked without
|
|
1093
|
-
* third argument.
|
|
1094
|
-
*/
|
|
1095
|
-
(req: Request | http.IncomingMessage, res: Response | http.ServerResponse): any;
|
|
1096
|
-
|
|
1097
|
-
/**
|
|
1098
|
-
* Initialize the server.
|
|
1099
|
-
*
|
|
1100
|
-
* - setup default configuration
|
|
1101
|
-
* - setup default middleware
|
|
1102
|
-
* - setup route reflection methods
|
|
1103
|
-
*/
|
|
1104
|
-
init(): void;
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* Initialize application configuration.
|
|
1108
|
-
*/
|
|
1109
|
-
defaultConfiguration(): void;
|
|
1110
|
-
|
|
1111
|
-
/**
|
|
1112
|
-
* Register the given template engine callback `fn`
|
|
1113
|
-
* as `ext`.
|
|
1114
|
-
*
|
|
1115
|
-
* By default will `require()` the engine based on the
|
|
1116
|
-
* file extension. For example if you try to render
|
|
1117
|
-
* a "foo.jade" file Express will invoke the following internally:
|
|
1118
|
-
*
|
|
1119
|
-
* app.engine('jade', require('jade').__express);
|
|
1120
|
-
*
|
|
1121
|
-
* For engines that do not provide `.__express` out of the box,
|
|
1122
|
-
* or if you wish to "map" a different extension to the template engine
|
|
1123
|
-
* you may use this method. For example mapping the EJS template engine to
|
|
1124
|
-
* ".html" files:
|
|
1125
|
-
*
|
|
1126
|
-
* app.engine('html', require('ejs').renderFile);
|
|
1127
|
-
*
|
|
1128
|
-
* In this case EJS provides a `.renderFile()` method with
|
|
1129
|
-
* the same signature that Express expects: `(path, options, callback)`,
|
|
1130
|
-
* though note that it aliases this method as `ejs.__express` internally
|
|
1131
|
-
* so if you're using ".ejs" extensions you dont need to do anything.
|
|
1132
|
-
*
|
|
1133
|
-
* Some template engines do not follow this convention, the
|
|
1134
|
-
* [Consolidate.js](https://github.com/visionmedia/consolidate.js)
|
|
1135
|
-
* library was created to map all of node's popular template
|
|
1136
|
-
* engines to follow this convention, thus allowing them to
|
|
1137
|
-
* work seamlessly within Express.
|
|
1138
|
-
*/
|
|
1139
|
-
engine(
|
|
1140
|
-
ext: string,
|
|
1141
|
-
fn: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void,
|
|
1142
|
-
): this;
|
|
1143
|
-
|
|
1144
|
-
/**
|
|
1145
|
-
* Assign `setting` to `val`, or return `setting`'s value.
|
|
1146
|
-
*
|
|
1147
|
-
* app.set('foo', 'bar');
|
|
1148
|
-
* app.get('foo');
|
|
1149
|
-
* // => "bar"
|
|
1150
|
-
* app.set('foo', ['bar', 'baz']);
|
|
1151
|
-
* app.get('foo');
|
|
1152
|
-
* // => ["bar", "baz"]
|
|
1153
|
-
*
|
|
1154
|
-
* Mounted servers inherit their parent server's settings.
|
|
1155
|
-
*/
|
|
1156
|
-
set(setting: string, val: any): this;
|
|
1157
|
-
get: ((name: string) => any) & IRouterMatcher<this>;
|
|
1158
|
-
|
|
1159
|
-
param(name: string | string[], handler: RequestParamHandler): this;
|
|
1160
|
-
|
|
1161
|
-
/**
|
|
1162
|
-
* Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()
|
|
1163
|
-
*
|
|
1164
|
-
* @deprecated since version 4.11
|
|
1165
|
-
*/
|
|
1166
|
-
param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this;
|
|
1167
|
-
|
|
1168
|
-
/**
|
|
1169
|
-
* Return the app's absolute pathname
|
|
1170
|
-
* based on the parent(s) that have
|
|
1171
|
-
* mounted it.
|
|
1172
|
-
*
|
|
1173
|
-
* For example if the application was
|
|
1174
|
-
* mounted as "/admin", which itself
|
|
1175
|
-
* was mounted as "/blog" then the
|
|
1176
|
-
* return value would be "/blog/admin".
|
|
1177
|
-
*/
|
|
1178
|
-
path(): string;
|
|
1179
|
-
|
|
1180
|
-
/**
|
|
1181
|
-
* Check if `setting` is enabled (truthy).
|
|
1182
|
-
*
|
|
1183
|
-
* app.enabled('foo')
|
|
1184
|
-
* // => false
|
|
1185
|
-
*
|
|
1186
|
-
* app.enable('foo')
|
|
1187
|
-
* app.enabled('foo')
|
|
1188
|
-
* // => true
|
|
1189
|
-
*/
|
|
1190
|
-
enabled(setting: string): boolean;
|
|
1191
|
-
|
|
1192
|
-
/**
|
|
1193
|
-
* Check if `setting` is disabled.
|
|
1194
|
-
*
|
|
1195
|
-
* app.disabled('foo')
|
|
1196
|
-
* // => true
|
|
1197
|
-
*
|
|
1198
|
-
* app.enable('foo')
|
|
1199
|
-
* app.disabled('foo')
|
|
1200
|
-
* // => false
|
|
1201
|
-
*/
|
|
1202
|
-
disabled(setting: string): boolean;
|
|
1203
|
-
|
|
1204
|
-
/** Enable `setting`. */
|
|
1205
|
-
enable(setting: string): this;
|
|
1206
|
-
|
|
1207
|
-
/** Disable `setting`. */
|
|
1208
|
-
disable(setting: string): this;
|
|
1209
|
-
|
|
1210
|
-
/**
|
|
1211
|
-
* Render the given view `name` name with `options`
|
|
1212
|
-
* and a callback accepting an error and the
|
|
1213
|
-
* rendered template string.
|
|
1214
|
-
*
|
|
1215
|
-
* Example:
|
|
1216
|
-
*
|
|
1217
|
-
* app.render('email', { name: 'Tobi' }, function(err, html){
|
|
1218
|
-
* // ...
|
|
1219
|
-
* })
|
|
1220
|
-
*/
|
|
1221
|
-
render(name: string, options?: object, callback?: (err: Error, html: string) => void): void;
|
|
1222
|
-
render(name: string, callback: (err: Error, html: string) => void): void;
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* Listen for connections.
|
|
1226
|
-
*
|
|
1227
|
-
* A node `http.Server` is returned, with this
|
|
1228
|
-
* application (which is a `Function`) as its
|
|
1229
|
-
* callback. If you wish to create both an HTTP
|
|
1230
|
-
* and HTTPS server you may do so with the "http"
|
|
1231
|
-
* and "https" modules as shown here:
|
|
1232
|
-
*
|
|
1233
|
-
* var http = require('http')
|
|
1234
|
-
* , https = require('https')
|
|
1235
|
-
* , express = require('express')
|
|
1236
|
-
* , app = express();
|
|
1237
|
-
*
|
|
1238
|
-
* http.createServer(app).listen(80);
|
|
1239
|
-
* https.createServer({ ... }, app).listen(443);
|
|
1240
|
-
*/
|
|
1241
|
-
listen(port: number, hostname: string, backlog: number, callback?: () => void): http.Server;
|
|
1242
|
-
listen(port: number, hostname: string, callback?: () => void): http.Server;
|
|
1243
|
-
listen(port: number, callback?: () => void): http.Server;
|
|
1244
|
-
listen(callback?: () => void): http.Server;
|
|
1245
|
-
listen(path: string, callback?: () => void): http.Server;
|
|
1246
|
-
listen(handle: any, listeningListener?: () => void): http.Server;
|
|
1247
|
-
|
|
1248
|
-
router: string;
|
|
1249
|
-
|
|
1250
|
-
settings: any;
|
|
1251
|
-
|
|
1252
|
-
resource: any;
|
|
1253
|
-
|
|
1254
|
-
map: any;
|
|
1255
|
-
|
|
1256
|
-
locals: LocalsObj & Locals;
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
1259
|
-
* The app.routes object houses all of the routes defined mapped by the
|
|
1260
|
-
* associated HTTP verb. This object may be used for introspection
|
|
1261
|
-
* capabilities, for example Express uses this internally not only for
|
|
1262
|
-
* routing but to provide default OPTIONS behaviour unless app.options()
|
|
1263
|
-
* is used. Your application or framework may also remove routes by
|
|
1264
|
-
* simply by removing them from this object.
|
|
1265
|
-
*/
|
|
1266
|
-
routes: any;
|
|
1267
|
-
|
|
1268
|
-
/**
|
|
1269
|
-
* Used to get all registered routes in Express Application
|
|
1270
|
-
*/
|
|
1271
|
-
_router: any;
|
|
1272
|
-
|
|
1273
|
-
use: ApplicationRequestHandler<this>;
|
|
1274
|
-
|
|
1275
|
-
/**
|
|
1276
|
-
* The mount event is fired on a sub-app, when it is mounted on a parent app.
|
|
1277
|
-
* The parent app is passed to the callback function.
|
|
1278
|
-
*
|
|
1279
|
-
* NOTE:
|
|
1280
|
-
* Sub-apps will:
|
|
1281
|
-
* - Not inherit the value of settings that have a default value. You must set the value in the sub-app.
|
|
1282
|
-
* - Inherit the value of settings with no default value.
|
|
1283
|
-
*/
|
|
1284
|
-
on: (event: string, callback: (parent: Application) => void) => this;
|
|
1285
|
-
|
|
1286
|
-
/**
|
|
1287
|
-
* The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
|
|
1288
|
-
*/
|
|
1289
|
-
mountpath: string | string[];
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
export interface Express extends Application {
|
|
1293
|
-
request: Request;
|
|
1294
|
-
response: Response;
|
|
1295
|
-
}
|