mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-03 21:40:53 +00:00
KI
KJ
This commit is contained in:
221
unified-ai-platform/node_modules/morgan/HISTORY.md
generated
vendored
Normal file
221
unified-ai-platform/node_modules/morgan/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
1.10.1 / 2025-07-17
|
||||
===================
|
||||
|
||||
* deps: on-headers@~1.1.0
|
||||
- Fix [CVE-2025-7339](https://www.cve.org/CVERecord?id=CVE-2025-7339) ([GHSA-76c9-3jph-rj3q](https://github.com/expressjs/multer/security/advisories/GHSA-76c9-3jph-rj3q))
|
||||
|
||||
1.10.0 / 2020-03-20
|
||||
===================
|
||||
|
||||
* Add `:total-time` token
|
||||
* Fix trailing space in colored status code for `dev` format
|
||||
* deps: basic-auth@~2.0.1
|
||||
- deps: safe-buffer@5.1.2
|
||||
* deps: depd@~2.0.0
|
||||
- Replace internal `eval` usage with `Function` constructor
|
||||
- Use instance methods on `process` to check for listeners
|
||||
* deps: on-headers@~1.0.2
|
||||
- Fix `res.writeHead` patch missing return value
|
||||
|
||||
1.9.1 / 2018-09-10
|
||||
==================
|
||||
|
||||
* Fix using special characters in format
|
||||
* deps: depd@~1.1.2
|
||||
- perf: remove argument reassignment
|
||||
|
||||
1.9.0 / 2017-09-26
|
||||
==================
|
||||
|
||||
* Use `res.headersSent` when available
|
||||
* deps: basic-auth@~2.0.0
|
||||
- Use `safe-buffer` for improved Buffer API
|
||||
* deps: debug@2.6.9
|
||||
* deps: depd@~1.1.1
|
||||
- Remove unnecessary `Buffer` loading
|
||||
|
||||
1.8.2 / 2017-05-23
|
||||
==================
|
||||
|
||||
* deps: debug@2.6.8
|
||||
- Fix `DEBUG_MAX_ARRAY_LENGTH`
|
||||
- deps: ms@2.0.0
|
||||
|
||||
1.8.1 / 2017-02-04
|
||||
==================
|
||||
|
||||
* deps: debug@2.6.1
|
||||
- Fix deprecation messages in WebStorm and other editors
|
||||
- Undeprecate `DEBUG_FD` set to `1` or `2`
|
||||
|
||||
1.8.0 / 2017-02-04
|
||||
==================
|
||||
|
||||
* Fix sending unnecessary `undefined` argument to token functions
|
||||
* deps: basic-auth@~1.1.0
|
||||
* deps: debug@2.6.0
|
||||
- Allow colors in workers
|
||||
- Deprecated `DEBUG_FD` environment variable
|
||||
- Fix error when running under React Native
|
||||
- Use same color for same namespace
|
||||
- deps: ms@0.7.2
|
||||
* perf: enable strict mode in compiled functions
|
||||
|
||||
1.7.0 / 2016-02-18
|
||||
==================
|
||||
|
||||
* Add `digits` argument to `response-time` token
|
||||
* deps: depd@~1.1.0
|
||||
- Enable strict mode in more places
|
||||
- Support web browser loading
|
||||
* deps: on-headers@~1.0.1
|
||||
- perf: enable strict mode
|
||||
|
||||
1.6.1 / 2015-07-03
|
||||
==================
|
||||
|
||||
* deps: basic-auth@~1.0.3
|
||||
|
||||
1.6.0 / 2015-06-12
|
||||
==================
|
||||
|
||||
* Add `morgan.compile(format)` export
|
||||
* Do not color 1xx status codes in `dev` format
|
||||
* Fix `response-time` token to not include response latency
|
||||
* Fix `status` token incorrectly displaying before response in `dev` format
|
||||
* Fix token return values to be `undefined` or a string
|
||||
* Improve representation of multiple headers in `req` and `res` tokens
|
||||
* Use `res.getHeader` in `res` token
|
||||
* deps: basic-auth@~1.0.2
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expression
|
||||
- perf: parse with regular expressions
|
||||
- perf: remove argument reassignment
|
||||
* deps: on-finished@~2.3.0
|
||||
- Add defined behavior for HTTP `CONNECT` requests
|
||||
- Add defined behavior for HTTP `Upgrade` requests
|
||||
- deps: ee-first@1.1.1
|
||||
* pref: enable strict mode
|
||||
* pref: reduce function closure scopes
|
||||
* pref: remove dynamic compile on every request for `dev` format
|
||||
* pref: remove an argument reassignment
|
||||
* pref: skip function call without `skip` option
|
||||
|
||||
1.5.3 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: basic-auth@~1.0.1
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
* deps: depd@~1.0.1
|
||||
* deps: on-finished@~2.2.1
|
||||
- Fix `isFinished(req)` when data buffered
|
||||
|
||||
1.5.2 / 2015-03-15
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
1.5.1 / 2014-12-31
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.1
|
||||
* deps: on-finished@~2.2.0
|
||||
|
||||
1.5.0 / 2014-11-06
|
||||
==================
|
||||
|
||||
* Add multiple date formats
|
||||
- `clf` for the common log format
|
||||
- `iso` for the common ISO 8601 date time format
|
||||
- `web` for the common RFC 1123 date time format
|
||||
* Deprecate `buffer` option
|
||||
* Fix date format in `common` and `combined` formats
|
||||
* Fix token arguments to accept values with `"`
|
||||
|
||||
1.4.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* deps: on-finished@~2.1.1
|
||||
- Fix handling of pipelined requests
|
||||
|
||||
1.4.0 / 2014-10-16
|
||||
==================
|
||||
|
||||
* Add `debug` messages
|
||||
* deps: depd@~1.0.0
|
||||
|
||||
1.3.2 / 2014-09-27
|
||||
==================
|
||||
|
||||
* Fix `req.ip` integration when `immediate: false`
|
||||
|
||||
1.3.1 / 2014-09-14
|
||||
==================
|
||||
|
||||
* Remove un-used `bytes` dependency
|
||||
* deps: depd@0.4.5
|
||||
|
||||
1.3.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* Assert if `format` is not a function or string
|
||||
|
||||
1.2.3 / 2014-08-16
|
||||
==================
|
||||
|
||||
* deps: on-finished@2.1.0
|
||||
|
||||
1.2.2 / 2014-07-27
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.4
|
||||
- Work-around v8 generating empty stack traces
|
||||
|
||||
1.2.1 / 2014-07-26
|
||||
==================
|
||||
|
||||
* deps: depd@0.4.3
|
||||
- Fix exception when global `Error.stackTraceLimit` is too low
|
||||
|
||||
1.2.0 / 2014-07-19
|
||||
==================
|
||||
|
||||
* Add `:remote-user` token
|
||||
* Add `combined` log format
|
||||
* Add `common` log format
|
||||
* Add `morgan(format, options)` function signature
|
||||
* Deprecate `default` format -- use `combined` format instead
|
||||
* Deprecate not providing a format
|
||||
* Remove non-standard grey color from `dev` format
|
||||
|
||||
1.1.1 / 2014-05-20
|
||||
==================
|
||||
|
||||
* simplify method to get remote address
|
||||
|
||||
1.1.0 / 2014-05-18
|
||||
==================
|
||||
|
||||
* "dev" format will use same tokens as other formats
|
||||
* `:response-time` token is now empty when immediate used
|
||||
* `:response-time` token is now monotonic
|
||||
* `:response-time` token has precision to 1 μs
|
||||
* fix `:status` + immediate output in node.js 0.8
|
||||
* improve `buffer` option to prevent indefinite event loop holding
|
||||
* deps: bytes@1.0.0
|
||||
- add negative support
|
||||
|
||||
1.0.1 / 2014-05-04
|
||||
==================
|
||||
|
||||
* Make buffer unique per morgan instance
|
||||
* deps: bytes@0.3.0
|
||||
* added terabyte support
|
||||
|
||||
1.0.0 / 2014-02-08
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
unified-ai-platform/node_modules/morgan/LICENSE
generated
vendored
Normal file
23
unified-ai-platform/node_modules/morgan/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014-2017 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
436
unified-ai-platform/node_modules/morgan/README.md
generated
vendored
Normal file
436
unified-ai-platform/node_modules/morgan/README.md
generated
vendored
Normal file
@@ -0,0 +1,436 @@
|
||||
# morgan
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP request logger middleware for node.js
|
||||
|
||||
> Named after [Dexter](http://en.wikipedia.org/wiki/Dexter_Morgan), a show you should not watch until completion.
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install morgan
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
|
||||
```js
|
||||
var morgan = require('morgan')
|
||||
```
|
||||
|
||||
### morgan(format, options)
|
||||
|
||||
Create a new morgan logger middleware function using the given `format` and `options`.
|
||||
The `format` argument may be a string of a predefined name (see below for the names),
|
||||
a string of a format string, or a function that will produce a log entry.
|
||||
|
||||
The `format` function will be called with three arguments `tokens`, `req`, and `res`,
|
||||
where `tokens` is an object with all defined tokens, `req` is the HTTP request and `res`
|
||||
is the HTTP response. The function is expected to return a string that will be the log
|
||||
line, or `undefined` / `null` to skip logging.
|
||||
|
||||
#### Using a predefined format string
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
morgan('tiny')
|
||||
```
|
||||
|
||||
#### Using format string of predefined tokens
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
morgan(':method :url :status :res[content-length] - :response-time ms')
|
||||
```
|
||||
|
||||
#### Using a custom format function
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
``` js
|
||||
morgan(function (tokens, req, res) {
|
||||
return [
|
||||
tokens.method(req, res),
|
||||
tokens.url(req, res),
|
||||
tokens.status(req, res),
|
||||
tokens.res(req, res, 'content-length'), '-',
|
||||
tokens['response-time'](req, res), 'ms'
|
||||
].join(' ')
|
||||
})
|
||||
```
|
||||
|
||||
#### Options
|
||||
|
||||
Morgan accepts these properties in the options object.
|
||||
|
||||
##### immediate
|
||||
|
||||
Write log line on request instead of response. This means that a requests will
|
||||
be logged even if the server crashes, _but data from the response (like the
|
||||
response code, content length, etc.) cannot be logged_.
|
||||
|
||||
##### skip
|
||||
|
||||
Function to determine if logging is skipped, defaults to `false`. This function
|
||||
will be called as `skip(req, res)`.
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
// EXAMPLE: only log error responses
|
||||
morgan('combined', {
|
||||
skip: function (req, res) { return res.statusCode < 400 }
|
||||
})
|
||||
```
|
||||
|
||||
##### stream
|
||||
|
||||
Output stream for writing log lines, defaults to `process.stdout`.
|
||||
|
||||
#### Predefined Formats
|
||||
|
||||
There are various pre-defined formats provided:
|
||||
|
||||
##### combined
|
||||
|
||||
Standard Apache combined log output.
|
||||
```
|
||||
:remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"
|
||||
# will output
|
||||
::1 - - [27/Nov/2024:06:21:42 +0000] "GET /combined HTTP/1.1" 200 2 "-" "curl/8.7.1"
|
||||
```
|
||||
|
||||
##### common
|
||||
|
||||
Standard Apache common log output.
|
||||
|
||||
```
|
||||
:remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]
|
||||
# will output
|
||||
::1 - - [27/Nov/2024:06:21:46 +0000] "GET /common HTTP/1.1" 200 2
|
||||
```
|
||||
|
||||
##### dev
|
||||
|
||||
Concise output colored by response status for development use. The `:status`
|
||||
token will be colored green for success codes, red for server error codes,
|
||||
yellow for client error codes, cyan for redirection codes, and uncolored
|
||||
for information codes.
|
||||
|
||||
```
|
||||
:method :url :status :response-time ms - :res[content-length]
|
||||
# will output
|
||||
GET /dev 200 0.224 ms - 2
|
||||
```
|
||||
|
||||
##### short
|
||||
|
||||
Shorter than default, also including response time.
|
||||
|
||||
```
|
||||
:remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
|
||||
# will output
|
||||
::1 - GET /short HTTP/1.1 200 2 - 0.283 ms
|
||||
```
|
||||
|
||||
##### tiny
|
||||
|
||||
The minimal output.
|
||||
|
||||
```
|
||||
:method :url :status :res[content-length] - :response-time ms
|
||||
# will output
|
||||
GET /tiny 200 2 - 0.188 ms
|
||||
```
|
||||
|
||||
#### Tokens
|
||||
|
||||
##### Creating new tokens
|
||||
|
||||
To define a token, simply invoke `morgan.token()` with the name and a callback function.
|
||||
This callback function is expected to return a string value. The value returned is then
|
||||
available as ":type" in this case:
|
||||
|
||||
<!-- eslint-disable no-undef -->
|
||||
|
||||
```js
|
||||
morgan.token('type', function (req, res) { return req.headers['content-type'] })
|
||||
```
|
||||
|
||||
Calling `morgan.token()` using the same name as an existing token will overwrite that
|
||||
token definition.
|
||||
|
||||
The token function is expected to be called with the arguments `req` and `res`, representing
|
||||
the HTTP request and HTTP response. Additionally, the token can accept further arguments of
|
||||
it's choosing to customize behavior.
|
||||
|
||||
##### :date[format]
|
||||
|
||||
The current date and time in UTC. The available formats are:
|
||||
|
||||
- `clf` for the common log format (`"10/Oct/2000:13:55:36 +0000"`)
|
||||
- `iso` for the common ISO 8601 date time format (`2000-10-10T13:55:36.000Z`)
|
||||
- `web` for the common RFC 1123 date time format (`Tue, 10 Oct 2000 13:55:36 GMT`)
|
||||
|
||||
If no format is given, then the default is `web`.
|
||||
|
||||
##### :http-version
|
||||
|
||||
The HTTP version of the request.
|
||||
|
||||
##### :method
|
||||
|
||||
The HTTP method of the request.
|
||||
|
||||
##### :referrer
|
||||
|
||||
The Referrer header of the request. This will use the standard mis-spelled Referer header if exists, otherwise Referrer.
|
||||
|
||||
##### :remote-addr
|
||||
|
||||
The remote address of the request. This will use `req.ip`, otherwise the standard `req.connection.remoteAddress` value (socket address).
|
||||
|
||||
##### :remote-user
|
||||
|
||||
The user authenticated as part of Basic auth for the request.
|
||||
|
||||
##### :req[header]
|
||||
|
||||
The given `header` of the request. If the header is not present, the
|
||||
value will be displayed as `"-"` in the log.
|
||||
|
||||
##### :res[header]
|
||||
|
||||
The given `header` of the response. If the header is not present, the
|
||||
value will be displayed as `"-"` in the log.
|
||||
|
||||
##### :response-time[digits]
|
||||
|
||||
The time between the request coming into `morgan` and when the response
|
||||
headers are written, in milliseconds.
|
||||
|
||||
The `digits` argument is a number that specifies the number of digits to
|
||||
include on the number, defaulting to `3`, which provides microsecond precision.
|
||||
|
||||
##### :status
|
||||
|
||||
The status code of the response.
|
||||
|
||||
If the request/response cycle completes before a response was sent to the
|
||||
client (for example, the TCP socket closed prematurely by a client aborting
|
||||
the request), then the status will be empty (displayed as `"-"` in the log).
|
||||
|
||||
##### :total-time[digits]
|
||||
|
||||
The time between the request coming into `morgan` and when the response
|
||||
has finished being written out to the connection, in milliseconds.
|
||||
|
||||
The `digits` argument is a number that specifies the number of digits to
|
||||
include on the number, defaulting to `3`, which provides microsecond precision.
|
||||
|
||||
##### :url
|
||||
|
||||
The URL of the request. This will use `req.originalUrl` if exists, otherwise `req.url`.
|
||||
|
||||
##### :user-agent
|
||||
|
||||
The contents of the User-Agent header of the request.
|
||||
|
||||
### morgan.compile(format)
|
||||
|
||||
Compile a format string into a `format` function for use by `morgan`. A format string
|
||||
is a string that represents a single log line and can utilize token syntax.
|
||||
Tokens are references by `:token-name`. If tokens accept arguments, they can
|
||||
be passed using `[]`, for example: `:token-name[pretty]` would pass the string
|
||||
`'pretty'` as an argument to the token `token-name`.
|
||||
|
||||
The function returned from `morgan.compile` takes three arguments `tokens`, `req`, and
|
||||
`res`, where `tokens` is object with all defined tokens, `req` is the HTTP request and
|
||||
`res` is the HTTP response. The function will return a string that will be the log line,
|
||||
or `undefined` / `null` to skip logging.
|
||||
|
||||
Normally formats are defined using `morgan.format(name, format)`, but for certain
|
||||
advanced uses, this compile function is directly available.
|
||||
|
||||
## Examples
|
||||
|
||||
### express/connect
|
||||
|
||||
Sample app that will log all request in the Apache combined format to STDOUT
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var morgan = require('morgan')
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(morgan('combined'))
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('hello, world!')
|
||||
})
|
||||
```
|
||||
|
||||
### vanilla http server
|
||||
|
||||
Sample app that will log all request in the Apache combined format to STDOUT
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var http = require('http')
|
||||
var morgan = require('morgan')
|
||||
|
||||
// create "middleware"
|
||||
var logger = morgan('combined')
|
||||
|
||||
http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
logger(req, res, function (err) {
|
||||
if (err) return done(err)
|
||||
|
||||
// respond to request
|
||||
res.setHeader('content-type', 'text/plain')
|
||||
res.end('hello, world!')
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
### write logs to a file
|
||||
|
||||
#### single file
|
||||
|
||||
Sample app that will log all requests in the Apache combined format to the file
|
||||
`access.log`.
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var fs = require('fs')
|
||||
var morgan = require('morgan')
|
||||
var path = require('path')
|
||||
|
||||
var app = express()
|
||||
|
||||
// create a write stream (in append mode)
|
||||
var accessLogStream = fs.createWriteStream(path.join(__dirname, 'access.log'), { flags: 'a' })
|
||||
|
||||
// setup the logger
|
||||
app.use(morgan('combined', { stream: accessLogStream }))
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('hello, world!')
|
||||
})
|
||||
```
|
||||
|
||||
#### log file rotation
|
||||
|
||||
Sample app that will log all requests in the Apache combined format to one log
|
||||
file per day in the `log/` directory using the
|
||||
[rotating-file-stream module](https://www.npmjs.com/package/rotating-file-stream).
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var morgan = require('morgan')
|
||||
var path = require('path')
|
||||
var rfs = require('rotating-file-stream') // version 2.x
|
||||
|
||||
var app = express()
|
||||
|
||||
// create a rotating write stream
|
||||
var accessLogStream = rfs.createStream('access.log', {
|
||||
interval: '1d', // rotate daily
|
||||
path: path.join(__dirname, 'log')
|
||||
})
|
||||
|
||||
// setup the logger
|
||||
app.use(morgan('combined', { stream: accessLogStream }))
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('hello, world!')
|
||||
})
|
||||
```
|
||||
|
||||
### split / dual logging
|
||||
|
||||
The `morgan` middleware can be used as many times as needed, enabling
|
||||
combinations like:
|
||||
|
||||
* Log entry on request and one on response
|
||||
* Log all requests to file, but errors to console
|
||||
* ... and more!
|
||||
|
||||
Sample app that will log all requests to a file using Apache format, but
|
||||
error responses are logged to the console:
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var fs = require('fs')
|
||||
var morgan = require('morgan')
|
||||
var path = require('path')
|
||||
|
||||
var app = express()
|
||||
|
||||
// log only 4xx and 5xx responses to console
|
||||
app.use(morgan('dev', {
|
||||
skip: function (req, res) { return res.statusCode < 400 }
|
||||
}))
|
||||
|
||||
// log all requests to access.log
|
||||
app.use(morgan('common', {
|
||||
stream: fs.createWriteStream(path.join(__dirname, 'access.log'), { flags: 'a' })
|
||||
}))
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('hello, world!')
|
||||
})
|
||||
```
|
||||
|
||||
### use custom token formats
|
||||
|
||||
Sample app that will use custom token formats. This adds an ID to all requests and displays it using the `:id` token.
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var morgan = require('morgan')
|
||||
var uuid = require('node-uuid')
|
||||
|
||||
morgan.token('id', function getId (req) {
|
||||
return req.id
|
||||
})
|
||||
|
||||
var app = express()
|
||||
|
||||
app.use(assignId)
|
||||
app.use(morgan(':id :method :url :response-time'))
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.send('hello, world!')
|
||||
})
|
||||
|
||||
function assignId (req, res, next) {
|
||||
req.id = uuid.v4()
|
||||
next()
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[ci-image]: https://badgen.net/github/checks/expressjs/morgan/master?label=ci
|
||||
[ci-url]: https://github.com/expressjs/morgan/actions/workflows/ci.yml
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/morgan/master
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/morgan?branch=master
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/morgan
|
||||
[npm-url]: https://npmjs.org/package/morgan
|
||||
[npm-version-image]: https://badgen.net/npm/v/morgan
|
||||
544
unified-ai-platform/node_modules/morgan/index.js
generated
vendored
Normal file
544
unified-ai-platform/node_modules/morgan/index.js
generated
vendored
Normal file
@@ -0,0 +1,544 @@
|
||||
/*!
|
||||
* morgan
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = morgan
|
||||
module.exports.compile = compile
|
||||
module.exports.format = format
|
||||
module.exports.token = token
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var auth = require('basic-auth')
|
||||
var debug = require('debug')('morgan')
|
||||
var deprecate = require('depd')('morgan')
|
||||
var onFinished = require('on-finished')
|
||||
var onHeaders = require('on-headers')
|
||||
|
||||
/**
|
||||
* Array of CLF month names.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var CLF_MONTH = [
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
|
||||
]
|
||||
|
||||
/**
|
||||
* Default log buffer duration.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var DEFAULT_BUFFER_DURATION = 1000
|
||||
|
||||
/**
|
||||
* Create a logger middleware.
|
||||
*
|
||||
* @public
|
||||
* @param {String|Function} format
|
||||
* @param {Object} [options]
|
||||
* @return {Function} middleware
|
||||
*/
|
||||
|
||||
function morgan (format, options) {
|
||||
var fmt = format
|
||||
var opts = options || {}
|
||||
|
||||
if (format && typeof format === 'object') {
|
||||
opts = format
|
||||
fmt = opts.format || 'default'
|
||||
|
||||
// smart deprecation message
|
||||
deprecate('morgan(options): use morgan(' + (typeof fmt === 'string' ? JSON.stringify(fmt) : 'format') + ', options) instead')
|
||||
}
|
||||
|
||||
if (fmt === undefined) {
|
||||
deprecate('undefined format: specify a format')
|
||||
}
|
||||
|
||||
// output on request instead of response
|
||||
var immediate = opts.immediate
|
||||
|
||||
// check if log entry should be skipped
|
||||
var skip = opts.skip || false
|
||||
|
||||
// format function
|
||||
var formatLine = typeof fmt !== 'function'
|
||||
? getFormatFunction(fmt)
|
||||
: fmt
|
||||
|
||||
// stream
|
||||
var buffer = opts.buffer
|
||||
var stream = opts.stream || process.stdout
|
||||
|
||||
// buffering support
|
||||
if (buffer) {
|
||||
deprecate('buffer option')
|
||||
|
||||
// flush interval
|
||||
var interval = typeof buffer !== 'number'
|
||||
? DEFAULT_BUFFER_DURATION
|
||||
: buffer
|
||||
|
||||
// swap the stream
|
||||
stream = createBufferStream(stream, interval)
|
||||
}
|
||||
|
||||
return function logger (req, res, next) {
|
||||
// request data
|
||||
req._startAt = undefined
|
||||
req._startTime = undefined
|
||||
req._remoteAddress = getip(req)
|
||||
|
||||
// response data
|
||||
res._startAt = undefined
|
||||
res._startTime = undefined
|
||||
|
||||
// record request start
|
||||
recordStartTime.call(req)
|
||||
|
||||
function logRequest () {
|
||||
if (skip !== false && skip(req, res)) {
|
||||
debug('skip request')
|
||||
return
|
||||
}
|
||||
|
||||
var line = formatLine(morgan, req, res)
|
||||
|
||||
if (line == null) {
|
||||
debug('skip line')
|
||||
return
|
||||
}
|
||||
|
||||
debug('log request')
|
||||
stream.write(line + '\n')
|
||||
};
|
||||
|
||||
if (immediate) {
|
||||
// immediate log
|
||||
logRequest()
|
||||
} else {
|
||||
// record response start
|
||||
onHeaders(res, recordStartTime)
|
||||
|
||||
// log when response finished
|
||||
onFinished(res, logRequest)
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apache combined log format.
|
||||
*/
|
||||
|
||||
morgan.format('combined', ':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"')
|
||||
|
||||
/**
|
||||
* Apache common log format.
|
||||
*/
|
||||
|
||||
morgan.format('common', ':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]')
|
||||
|
||||
/**
|
||||
* Default format.
|
||||
*/
|
||||
|
||||
morgan.format('default', ':remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"')
|
||||
deprecate.property(morgan, 'default', 'default format: use combined format')
|
||||
|
||||
/**
|
||||
* Short format.
|
||||
*/
|
||||
|
||||
morgan.format('short', ':remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms')
|
||||
|
||||
/**
|
||||
* Tiny format.
|
||||
*/
|
||||
|
||||
morgan.format('tiny', ':method :url :status :res[content-length] - :response-time ms')
|
||||
|
||||
/**
|
||||
* dev (colored)
|
||||
*/
|
||||
|
||||
morgan.format('dev', function developmentFormatLine (tokens, req, res) {
|
||||
// get the status code if response written
|
||||
var status = headersSent(res)
|
||||
? res.statusCode
|
||||
: undefined
|
||||
|
||||
// get status color
|
||||
var color = status >= 500 ? 31 // red
|
||||
: status >= 400 ? 33 // yellow
|
||||
: status >= 300 ? 36 // cyan
|
||||
: status >= 200 ? 32 // green
|
||||
: 0 // no color
|
||||
|
||||
// get colored function
|
||||
var fn = developmentFormatLine[color]
|
||||
|
||||
if (!fn) {
|
||||
// compile
|
||||
fn = developmentFormatLine[color] = compile('\x1b[0m:method :url \x1b[' +
|
||||
color + 'm:status\x1b[0m :response-time ms - :res[content-length]\x1b[0m')
|
||||
}
|
||||
|
||||
return fn(tokens, req, res)
|
||||
})
|
||||
|
||||
/**
|
||||
* request url
|
||||
*/
|
||||
|
||||
morgan.token('url', function getUrlToken (req) {
|
||||
return req.originalUrl || req.url
|
||||
})
|
||||
|
||||
/**
|
||||
* request method
|
||||
*/
|
||||
|
||||
morgan.token('method', function getMethodToken (req) {
|
||||
return req.method
|
||||
})
|
||||
|
||||
/**
|
||||
* response time in milliseconds
|
||||
*/
|
||||
|
||||
morgan.token('response-time', function getResponseTimeToken (req, res, digits) {
|
||||
if (!req._startAt || !res._startAt) {
|
||||
// missing request and/or response start time
|
||||
return
|
||||
}
|
||||
|
||||
// calculate diff
|
||||
var ms = (res._startAt[0] - req._startAt[0]) * 1e3 +
|
||||
(res._startAt[1] - req._startAt[1]) * 1e-6
|
||||
|
||||
// return truncated value
|
||||
return ms.toFixed(digits === undefined ? 3 : digits)
|
||||
})
|
||||
|
||||
/**
|
||||
* total time in milliseconds
|
||||
*/
|
||||
|
||||
morgan.token('total-time', function getTotalTimeToken (req, res, digits) {
|
||||
if (!req._startAt || !res._startAt) {
|
||||
// missing request and/or response start time
|
||||
return
|
||||
}
|
||||
|
||||
// time elapsed from request start
|
||||
var elapsed = process.hrtime(req._startAt)
|
||||
|
||||
// cover to milliseconds
|
||||
var ms = (elapsed[0] * 1e3) + (elapsed[1] * 1e-6)
|
||||
|
||||
// return truncated value
|
||||
return ms.toFixed(digits === undefined ? 3 : digits)
|
||||
})
|
||||
|
||||
/**
|
||||
* current date
|
||||
*/
|
||||
|
||||
morgan.token('date', function getDateToken (req, res, format) {
|
||||
var date = new Date()
|
||||
|
||||
switch (format || 'web') {
|
||||
case 'clf':
|
||||
return clfdate(date)
|
||||
case 'iso':
|
||||
return date.toISOString()
|
||||
case 'web':
|
||||
return date.toUTCString()
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* response status code
|
||||
*/
|
||||
|
||||
morgan.token('status', function getStatusToken (req, res) {
|
||||
return headersSent(res)
|
||||
? String(res.statusCode)
|
||||
: undefined
|
||||
})
|
||||
|
||||
/**
|
||||
* normalized referrer
|
||||
*/
|
||||
|
||||
morgan.token('referrer', function getReferrerToken (req) {
|
||||
return req.headers.referer || req.headers.referrer
|
||||
})
|
||||
|
||||
/**
|
||||
* remote address
|
||||
*/
|
||||
|
||||
morgan.token('remote-addr', getip)
|
||||
|
||||
/**
|
||||
* remote user
|
||||
*/
|
||||
|
||||
morgan.token('remote-user', function getRemoteUserToken (req) {
|
||||
// parse basic credentials
|
||||
var credentials = auth(req)
|
||||
|
||||
// return username
|
||||
return credentials
|
||||
? credentials.name
|
||||
: undefined
|
||||
})
|
||||
|
||||
/**
|
||||
* HTTP version
|
||||
*/
|
||||
|
||||
morgan.token('http-version', function getHttpVersionToken (req) {
|
||||
return req.httpVersionMajor + '.' + req.httpVersionMinor
|
||||
})
|
||||
|
||||
/**
|
||||
* UA string
|
||||
*/
|
||||
|
||||
morgan.token('user-agent', function getUserAgentToken (req) {
|
||||
return req.headers['user-agent']
|
||||
})
|
||||
|
||||
/**
|
||||
* request header
|
||||
*/
|
||||
|
||||
morgan.token('req', function getRequestToken (req, res, field) {
|
||||
// get header
|
||||
var header = req.headers[field.toLowerCase()]
|
||||
|
||||
return Array.isArray(header)
|
||||
? header.join(', ')
|
||||
: header
|
||||
})
|
||||
|
||||
/**
|
||||
* response header
|
||||
*/
|
||||
|
||||
morgan.token('res', function getResponseHeader (req, res, field) {
|
||||
if (!headersSent(res)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// get header
|
||||
var header = res.getHeader(field)
|
||||
|
||||
return Array.isArray(header)
|
||||
? header.join(', ')
|
||||
: header
|
||||
})
|
||||
|
||||
/**
|
||||
* Format a Date in the common log format.
|
||||
*
|
||||
* @private
|
||||
* @param {Date} dateTime
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
function clfdate (dateTime) {
|
||||
var date = dateTime.getUTCDate()
|
||||
var hour = dateTime.getUTCHours()
|
||||
var mins = dateTime.getUTCMinutes()
|
||||
var secs = dateTime.getUTCSeconds()
|
||||
var year = dateTime.getUTCFullYear()
|
||||
|
||||
var month = CLF_MONTH[dateTime.getUTCMonth()]
|
||||
|
||||
return pad2(date) + '/' + month + '/' + year +
|
||||
':' + pad2(hour) + ':' + pad2(mins) + ':' + pad2(secs) +
|
||||
' +0000'
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a format string into a function.
|
||||
*
|
||||
* @param {string} format
|
||||
* @return {function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function compile (format) {
|
||||
if (typeof format !== 'string') {
|
||||
throw new TypeError('argument format must be a string')
|
||||
}
|
||||
|
||||
var fmt = String(JSON.stringify(format))
|
||||
var js = ' "use strict"\n return ' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function (_, name, arg) {
|
||||
var tokenArguments = 'req, res'
|
||||
var tokenFunction = 'tokens[' + String(JSON.stringify(name)) + ']'
|
||||
|
||||
if (arg !== undefined) {
|
||||
tokenArguments += ', ' + String(JSON.stringify(arg))
|
||||
}
|
||||
|
||||
return '" +\n (' + tokenFunction + '(' + tokenArguments + ') || "-") + "'
|
||||
})
|
||||
|
||||
// eslint-disable-next-line no-new-func
|
||||
return new Function('tokens, req, res', js)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a basic buffering stream.
|
||||
*
|
||||
* @param {object} stream
|
||||
* @param {number} interval
|
||||
* @public
|
||||
*/
|
||||
|
||||
function createBufferStream (stream, interval) {
|
||||
var buf = []
|
||||
var timer = null
|
||||
|
||||
// flush function
|
||||
function flush () {
|
||||
timer = null
|
||||
stream.write(buf.join(''))
|
||||
buf.length = 0
|
||||
}
|
||||
|
||||
// write function
|
||||
function write (str) {
|
||||
if (timer === null) {
|
||||
timer = setTimeout(flush, interval)
|
||||
}
|
||||
|
||||
buf.push(str)
|
||||
}
|
||||
|
||||
// return a minimal "stream"
|
||||
return { write: write }
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a format with the given name.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string|function} fmt
|
||||
* @public
|
||||
*/
|
||||
|
||||
function format (name, fmt) {
|
||||
morgan[name] = fmt
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup and compile a named format function.
|
||||
*
|
||||
* @param {string} name
|
||||
* @return {function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function getFormatFunction (name) {
|
||||
// lookup format
|
||||
var fmt = morgan[name] || name || morgan.default
|
||||
|
||||
// return compiled format
|
||||
return typeof fmt !== 'function'
|
||||
? compile(fmt)
|
||||
: fmt
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request IP address.
|
||||
*
|
||||
* @private
|
||||
* @param {IncomingMessage} req
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
function getip (req) {
|
||||
return req.ip ||
|
||||
req._remoteAddress ||
|
||||
(req.connection && req.connection.remoteAddress) ||
|
||||
undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the response headers have been sent.
|
||||
*
|
||||
* @param {object} res
|
||||
* @returns {boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function headersSent (res) {
|
||||
// istanbul ignore next: node.js 0.8 support
|
||||
return typeof res.headersSent !== 'boolean'
|
||||
? Boolean(res._header)
|
||||
: res.headersSent
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad number to two digits.
|
||||
*
|
||||
* @private
|
||||
* @param {number} num
|
||||
* @return {string}
|
||||
*/
|
||||
|
||||
function pad2 (num) {
|
||||
var str = String(num)
|
||||
|
||||
// istanbul ignore next: num is current datetime
|
||||
return (str.length === 1 ? '0' : '') + str
|
||||
}
|
||||
|
||||
/**
|
||||
* Record the start time.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function recordStartTime () {
|
||||
this._startAt = process.hrtime()
|
||||
this._startTime = new Date()
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a token function with the given name,
|
||||
* and callback fn(req, res).
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {function} fn
|
||||
* @public
|
||||
*/
|
||||
|
||||
function token (name, fn) {
|
||||
morgan[name] = fn
|
||||
return this
|
||||
}
|
||||
9
unified-ai-platform/node_modules/morgan/node_modules/debug/.npmignore
generated
vendored
9
unified-ai-platform/node_modules/morgan/node_modules/debug/.npmignore
generated
vendored
@@ -1,9 +0,0 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
||||
coverage
|
||||
bower.json
|
||||
0
unified-ai-platform/node_modules/morgan/node_modules/debug/LICENSE
generated
vendored
0
unified-ai-platform/node_modules/morgan/node_modules/debug/LICENSE
generated
vendored
312
unified-ai-platform/node_modules/morgan/node_modules/debug/README.md
generated
vendored
312
unified-ai-platform/node_modules/morgan/node_modules/debug/README.md
generated
vendored
@@ -1,312 +0,0 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
|
||||
|
||||
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||

|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
## Browser support
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
49
unified-ai-platform/node_modules/morgan/node_modules/debug/package.json
generated
vendored
49
unified-ai-platform/node_modules/morgan/node_modules/debug/package.json
generated
vendored
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"version": "2.6.9",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.12.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^1.3.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"sinon": "^1.17.6",
|
||||
"sinon-chai": "^2.8.0"
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"browser": "./src/browser.js",
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
152
unified-ai-platform/node_modules/morgan/node_modules/ms/index.js
generated
vendored
152
unified-ai-platform/node_modules/morgan/node_modules/ms/index.js
generated
vendored
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isNaN(val) === false) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
if (ms >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (ms >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (ms >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (ms >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
return plural(ms, d, 'day') ||
|
||||
plural(ms, h, 'hour') ||
|
||||
plural(ms, m, 'minute') ||
|
||||
plural(ms, s, 'second') ||
|
||||
ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, n, name) {
|
||||
if (ms < n) {
|
||||
return;
|
||||
}
|
||||
if (ms < n * 1.5) {
|
||||
return Math.floor(ms / n) + ' ' + name;
|
||||
}
|
||||
return Math.ceil(ms / n) + ' ' + name + 's';
|
||||
}
|
||||
21
unified-ai-platform/node_modules/morgan/node_modules/ms/license.md
generated
vendored
21
unified-ai-platform/node_modules/morgan/node_modules/ms/license.md
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
37
unified-ai-platform/node_modules/morgan/node_modules/ms/package.json
generated
vendored
37
unified-ai-platform/node_modules/morgan/node_modules/ms/package.json
generated
vendored
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "ms",
|
||||
"version": "2.0.0",
|
||||
"description": "Tiny milisecond conversion utility",
|
||||
"repository": "zeit/ms",
|
||||
"main": "./index",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "3.19.0",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.13.3",
|
||||
"lint-staged": "3.4.1",
|
||||
"mocha": "3.4.1"
|
||||
}
|
||||
}
|
||||
51
unified-ai-platform/node_modules/morgan/node_modules/ms/readme.md
generated
vendored
51
unified-ai-platform/node_modules/morgan/node_modules/ms/readme.md
generated
vendored
@@ -1,51 +0,0 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://zeit.chat/)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
```
|
||||
|
||||
### Convert from milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time format written-out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [node](https://nodejs.org) and in the browser.
|
||||
- If a number is supplied to `ms`, a string with a unit is returned.
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
|
||||
|
||||
## Caught a bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
||||
88
unified-ai-platform/node_modules/morgan/node_modules/on-finished/HISTORY.md
generated
vendored
Normal file
88
unified-ai-platform/node_modules/morgan/node_modules/on-finished/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
2.3.0 / 2015-05-26
|
||||
==================
|
||||
|
||||
* Add defined behavior for HTTP `CONNECT` requests
|
||||
* Add defined behavior for HTTP `Upgrade` requests
|
||||
* deps: ee-first@1.1.1
|
||||
|
||||
2.2.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Fix `isFinished(req)` when data buffered
|
||||
|
||||
2.2.0 / 2014-12-22
|
||||
==================
|
||||
|
||||
* Add message object to callback arguments
|
||||
|
||||
2.1.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* Fix handling of pipelined requests
|
||||
|
||||
2.1.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Check if `socket` is detached
|
||||
* Return `undefined` for `isFinished` if state unknown
|
||||
|
||||
2.0.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Add `isFinished` function
|
||||
* Move to `jshttp` organization
|
||||
* Remove support for plain socket argument
|
||||
* Rename to `on-finished`
|
||||
* Support both `req` and `res` as arguments
|
||||
* deps: ee-first@1.0.5
|
||||
|
||||
1.2.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* Reduce listeners added to emitters
|
||||
- avoids "event emitter leak" warnings when used multiple times on same request
|
||||
|
||||
1.2.1 / 2014-06-08
|
||||
==================
|
||||
|
||||
* Fix returned value when already finished
|
||||
|
||||
1.2.0 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Call callback when called on already-finished socket
|
||||
|
||||
1.1.4 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Support node.js 0.8
|
||||
|
||||
1.1.3 / 2014-04-30
|
||||
==================
|
||||
|
||||
* Make sure errors passed as instanceof `Error`
|
||||
|
||||
1.1.2 / 2014-04-18
|
||||
==================
|
||||
|
||||
* Default the `socket` to passed-in object
|
||||
|
||||
1.1.1 / 2014-01-16
|
||||
==================
|
||||
|
||||
* Rename module to `finished`
|
||||
|
||||
1.1.0 / 2013-12-25
|
||||
==================
|
||||
|
||||
* Call callback when called on already-errored socket
|
||||
|
||||
1.0.1 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Actually pass the error to the callback
|
||||
|
||||
1.0.0 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
unified-ai-platform/node_modules/morgan/node_modules/on-finished/LICENSE
generated
vendored
Normal file
23
unified-ai-platform/node_modules/morgan/node_modules/on-finished/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
154
unified-ai-platform/node_modules/morgan/node_modules/on-finished/README.md
generated
vendored
Normal file
154
unified-ai-platform/node_modules/morgan/node_modules/on-finished/README.md
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
# on-finished
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Execute a callback when a HTTP request closes, finishes, or errors.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install on-finished
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var onFinished = require('on-finished')
|
||||
```
|
||||
|
||||
### onFinished(res, listener)
|
||||
|
||||
Attach a listener to listen for the response to finish. The listener will
|
||||
be invoked only once when the response finished. If the response finished
|
||||
to an error, the first argument will contain the error. If the response
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a response would be used to close things associated
|
||||
with the response, like open files.
|
||||
|
||||
Listener is invoked as `listener(err, res)`.
|
||||
|
||||
```js
|
||||
onFinished(res, function (err, res) {
|
||||
// clean up open fds, etc.
|
||||
// err contains the error is request error'd
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished(req, listener)
|
||||
|
||||
Attach a listener to listen for the request to finish. The listener will
|
||||
be invoked only once when the request finished. If the request finished
|
||||
to an error, the first argument will contain the error. If the request
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a request would be used to know when to continue
|
||||
after reading the data.
|
||||
|
||||
Listener is invoked as `listener(err, req)`.
|
||||
|
||||
```js
|
||||
var data = ''
|
||||
|
||||
req.setEncoding('utf8')
|
||||
res.on('data', function (str) {
|
||||
data += str
|
||||
})
|
||||
|
||||
onFinished(req, function (err, req) {
|
||||
// data is read unless there is err
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished.isFinished(res)
|
||||
|
||||
Determine if `res` is already finished. This would be useful to check and
|
||||
not even start certain operations if the response has already finished.
|
||||
|
||||
### onFinished.isFinished(req)
|
||||
|
||||
Determine if `req` is already finished. This would be useful to check and
|
||||
not even start certain operations if the request has already finished.
|
||||
|
||||
## Special Node.js requests
|
||||
|
||||
### HTTP CONNECT method
|
||||
|
||||
The meaning of the `CONNECT` method from RFC 7231, section 4.3.6:
|
||||
|
||||
> The CONNECT method requests that the recipient establish a tunnel to
|
||||
> the destination origin server identified by the request-target and,
|
||||
> if successful, thereafter restrict its behavior to blind forwarding
|
||||
> of packets, in both directions, until the tunnel is closed. Tunnels
|
||||
> are commonly used to create an end-to-end virtual connection, through
|
||||
> one or more proxies, which can then be secured using TLS (Transport
|
||||
> Layer Security, [RFC5246]).
|
||||
|
||||
In Node.js, these request objects come from the `'connect'` event on
|
||||
the HTTP server.
|
||||
|
||||
When this module is used on a HTTP `CONNECT` request, the request is
|
||||
considered "finished" immediately, **due to limitations in the Node.js
|
||||
interface**. This means if the `CONNECT` request contains a request entity,
|
||||
the request will be considered "finished" even before it has been read.
|
||||
|
||||
There is no such thing as a response object to a `CONNECT` request in
|
||||
Node.js, so there is no support for for one.
|
||||
|
||||
### HTTP Upgrade request
|
||||
|
||||
The meaning of the `Upgrade` header from RFC 7230, section 6.1:
|
||||
|
||||
> The "Upgrade" header field is intended to provide a simple mechanism
|
||||
> for transitioning from HTTP/1.1 to some other protocol on the same
|
||||
> connection.
|
||||
|
||||
In Node.js, these request objects come from the `'upgrade'` event on
|
||||
the HTTP server.
|
||||
|
||||
When this module is used on a HTTP request with an `Upgrade` header, the
|
||||
request is considered "finished" immediately, **due to limitations in the
|
||||
Node.js interface**. This means if the `Upgrade` request contains a request
|
||||
entity, the request will be considered "finished" even before it has been
|
||||
read.
|
||||
|
||||
There is no such thing as a response object to a `Upgrade` request in
|
||||
Node.js, so there is no support for for one.
|
||||
|
||||
## Example
|
||||
|
||||
The following code ensures that file descriptors are always closed
|
||||
once the response finishes.
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
var http = require('http')
|
||||
var onFinished = require('on-finished')
|
||||
|
||||
http.createServer(function onRequest(req, res) {
|
||||
var stream = fs.createReadStream('package.json')
|
||||
stream.pipe(res)
|
||||
onFinished(res, function (err) {
|
||||
destroy(stream)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/on-finished.svg
|
||||
[npm-url]: https://npmjs.org/package/on-finished
|
||||
[node-version-image]: https://img.shields.io/node/v/on-finished.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/on-finished/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/on-finished
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg
|
||||
[downloads-url]: https://npmjs.org/package/on-finished
|
||||
196
unified-ai-platform/node_modules/morgan/node_modules/on-finished/index.js
generated
vendored
Normal file
196
unified-ai-platform/node_modules/morgan/node_modules/on-finished/index.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
/*!
|
||||
* on-finished
|
||||
* Copyright(c) 2013 Jonathan Ong
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = onFinished
|
||||
module.exports.isFinished = isFinished
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var first = require('ee-first')
|
||||
|
||||
/**
|
||||
* Variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Invoke callback when the response has finished, useful for
|
||||
* cleaning up resources afterwards.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} listener
|
||||
* @return {object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function onFinished(msg, listener) {
|
||||
if (isFinished(msg) !== false) {
|
||||
defer(listener, null, msg)
|
||||
return msg
|
||||
}
|
||||
|
||||
// attach the listener to the message
|
||||
attachListener(msg, listener)
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if message is already finished.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function isFinished(msg) {
|
||||
var socket = msg.socket
|
||||
|
||||
if (typeof msg.finished === 'boolean') {
|
||||
// OutgoingMessage
|
||||
return Boolean(msg.finished || (socket && !socket.writable))
|
||||
}
|
||||
|
||||
if (typeof msg.complete === 'boolean') {
|
||||
// IncomingMessage
|
||||
return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable))
|
||||
}
|
||||
|
||||
// don't know
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a finished listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachFinishedListener(msg, callback) {
|
||||
var eeMsg
|
||||
var eeSocket
|
||||
var finished = false
|
||||
|
||||
function onFinish(error) {
|
||||
eeMsg.cancel()
|
||||
eeSocket.cancel()
|
||||
|
||||
finished = true
|
||||
callback(error)
|
||||
}
|
||||
|
||||
// finished on first message event
|
||||
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
|
||||
|
||||
function onSocket(socket) {
|
||||
// remove listener
|
||||
msg.removeListener('socket', onSocket)
|
||||
|
||||
if (finished) return
|
||||
if (eeMsg !== eeSocket) return
|
||||
|
||||
// finished on first socket event
|
||||
eeSocket = first([[socket, 'error', 'close']], onFinish)
|
||||
}
|
||||
|
||||
if (msg.socket) {
|
||||
// socket already assigned
|
||||
onSocket(msg.socket)
|
||||
return
|
||||
}
|
||||
|
||||
// wait for socket to be assigned
|
||||
msg.on('socket', onSocket)
|
||||
|
||||
if (msg.socket === undefined) {
|
||||
// node.js 0.8 patch
|
||||
patchAssignSocket(msg, onSocket)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach the listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachListener(msg, listener) {
|
||||
var attached = msg.__onFinished
|
||||
|
||||
// create a private single listener with queue
|
||||
if (!attached || !attached.queue) {
|
||||
attached = msg.__onFinished = createListener(msg)
|
||||
attachFinishedListener(msg, attached)
|
||||
}
|
||||
|
||||
attached.queue.push(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create listener on message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createListener(msg) {
|
||||
function listener(err) {
|
||||
if (msg.__onFinished === listener) msg.__onFinished = null
|
||||
if (!listener.queue) return
|
||||
|
||||
var queue = listener.queue
|
||||
listener.queue = null
|
||||
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
queue[i](err, msg)
|
||||
}
|
||||
}
|
||||
|
||||
listener.queue = []
|
||||
|
||||
return listener
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch ServerResponse.prototype.assignSocket for node.js 0.8.
|
||||
*
|
||||
* @param {ServerResponse} res
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function patchAssignSocket(res, callback) {
|
||||
var assignSocket = res.assignSocket
|
||||
|
||||
if (typeof assignSocket !== 'function') return
|
||||
|
||||
// res.on('socket', callback) is broken in 0.8
|
||||
res.assignSocket = function _assignSocket(socket) {
|
||||
assignSocket.call(this, socket)
|
||||
callback(socket)
|
||||
}
|
||||
}
|
||||
31
unified-ai-platform/node_modules/morgan/node_modules/on-finished/package.json
generated
vendored
Normal file
31
unified-ai-platform/node_modules/morgan/node_modules/on-finished/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "on-finished",
|
||||
"description": "Execute a callback when a request closes, finishes, or errors",
|
||||
"version": "2.3.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/on-finished",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "2.2.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
}
|
||||
}
|
||||
52
unified-ai-platform/node_modules/morgan/package.json
generated
vendored
Normal file
52
unified-ai-platform/node_modules/morgan/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "morgan",
|
||||
"description": "HTTP request logger middleware for node.js",
|
||||
"version": "1.10.1",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"express",
|
||||
"http",
|
||||
"logger",
|
||||
"middleware"
|
||||
],
|
||||
"repository": "expressjs/morgan",
|
||||
"dependencies": {
|
||||
"basic-auth": "~2.0.1",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~2.0.0",
|
||||
"on-finished": "~2.3.0",
|
||||
"on-headers": "~1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.20.2",
|
||||
"eslint-plugin-markdown": "1.0.2",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.2.1",
|
||||
"eslint-plugin-standard": "4.0.1",
|
||||
"mocha": "10.4.0",
|
||||
"nyc": "15.1.0",
|
||||
"split": "1.0.1",
|
||||
"supertest": "4.0.2"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --check-leaks --reporter spec",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user