style Dashboard

This commit is contained in:
Lieu Le
2019-09-13 11:27:52 +07:00
parent 558fb07261
commit 07322c9084
17151 changed files with 1686347 additions and 103 deletions

3
node_modules/body/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules
*.log
*.err

3
node_modules/body/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.10

19
node_modules/body/LICENCE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2012 Raynos.
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.

303
node_modules/body/README.md generated vendored Normal file
View File

@@ -0,0 +1,303 @@
# body [![build status][1]][2]
Body parsing
Originally taken from [npm-www](https://github.com/isaacs/npm-www)
## Example
```js
var textBody = require("body")
var jsonBody = require("body/json")
var formBody = require("body/form")
var anyBody = require("body/any")
var http = require("http")
var sendJson = require("send-data/json")
http.createServer(function handleRequest(req, res) {
function send(err, body) {
sendJson(req, res, body)
}
if (req.url === "/body") {
// all functions can be called with (req, cb)
textBody(req, send)
} else if (req.url === "/form") {
// all functions can be called with (req, opts, cb)
formBody(req, {}, send)
} else if (req.url === "/json") {
// all functions can be called with (req, res, cb)
jsonBody(req, res, send)
} else if (req.url === "/any") {
// all functions can be called with (req, res, opts, cb)
anyBody(req, res, {}, send)
}
})
```
`body` simply parses the request body and returns it in the callback. `jsonBody` and `formBody` call JSON.parse and querystring.parse respectively on the body.
anyBody will detect the content-type of the request and use the appropiate body method.
## Example generators
You can use `body` with generators as the body functions will
return a continuable if you don't pass a callback.
```js
var http = require("http")
var Router = require("routes-router")
var jsonBody = require("body/json")
var formBody = require("body/form")
// async turns a generator into an async function taking a cb
var async = require("gens")
// the router works with normal async functions.
// router automatically handles errors as 500 responses
var app = Router({
// do whatever you want. the jsonBody error would go here
errorHandler: function (req, res, err) {
res.statusCode = 500
res.end(err.message)
}
})
app.addRoute("/json", async(function* (req, res) {
// if jsonBody has an error it just goes to the cb
// in the called in the router. and it does the correct thing
// it shows your 500 page.
var body = yield jsonBody(req, res)
res.setHeader("content-type", "application/json")
res.end(JSON.stringify(body))
}))
app.addRoute("/form", async(function* (req, res) {
var body = yield formBody(req, res)
res.setHeader("content-type", "application/json")
res.end(JSON.stringify(body))
}))
// app returned from the router is just a function(req, res) {}
// that dispatches the req/res to the correct route based on
// the routers routing table & req.url
http.createServer(app).listen(8080)
```
## Documentation
### `textBody(req, res?, opts?, cb<Error, String>)`
```ocaml
textBody := (
req: HttpRequest,
res?: HttpResponse,
opts?: {
limit?: Number,
cache?: Boolean,
encoding?: String
},
cb: Callback<err: Error, bodyPayload: String>
) => void
```
`textBody` allows you to get the body from any readable stream.
It will read the entire content of the stream into memory and
give it back to you in the callback.
- `limit`: You can set `opts.limit` to a custom number to change the
limit at which `textBody` gives up. By default it will only
read a 1MB body, if a stream contains more then 1MB it returns
an error. This prevents someone attacking your HTTP server
with an infinite body causing an out of memory attack.
- `encoding`: You can set `encoding`. All encodings that are valid on a
[`Buffer`](http://nodejs.org/api/buffer.html#buffer_buffer) are
valid options. It defaults to `'utf8'`
```js
var textBody = require("body")
var http = require("http")
http.createServer(function (req, res) {
textBody(req, res, function (err, body) {
// err probably means invalid HTTP protocol or some shiz.
if (err) {
res.statusCode = 500
return res.end("NO U")
}
// I am an echo server
res.end(body)
})
}).listen(8080)
```
### `formBody(req, res?, opts?, cb<Error, Any>)`
```ocaml
formBody := (
req: HttpRequest,
res?: HttpResponse,
opts?: {
limit?: Number,
encoding?: String,
querystring: {
parse: (String, Callback<Error, Any>) => void
}
},
cb: Callback<err: Error, bodyPayload: Any>
) => void
```
`formBody` allows you to get the body of a readable stream. It
does the same as `textBody` but assumes the content is querystring
encoded and parses just like it was a &lt;form&gt; submit.
- `limit`: same as `textBody`
- `encoding`: same as `textBody`
- `querystring`: You can pass a custom querystring parser if
you want. It should have a `parse` method that takes a
string and a callback. It should return the value in the
callback or a parsing error
```js
var formBody = require("body/form")
var http = require("http")
http.createServer(function (req, res) {
formBody(req, res, function (err, body) {
// err probably means invalid HTTP protocol or some shiz.
if (err) {
res.statusCode = 500
return res.end("NO U")
}
// I am an echo server
res.setHeader("content-type", "application/json")
res.end(JSON.stringify(body))
})
}).listen(8080)
```
### `jsonBody(req, res?, opts?, cb<Error, Any>)`
```ocaml
jsonBody := (
req: HttpRequest,
res?: HttpResponse,
opts?: {
limit?: Number,
encoding?: String,
reviver?: (Any) => Any
JSON?: {
parse: (String, reviver?: Function, Callback<Error, Any>) => void
}
},
cb: Callback<err: Error, bodyPayload: Any>
) => void
```
`jsonBody` allows you to get the body of a readable stream. It
does the same as `textbody` but assumes the content it a JSON
value and parses it using `JSON.parse`. If `JSON.parse` throws
an exception then it calls the callback with the exception.
- `limit`: same as `textBody`
- `encoding`: same as `textBody`
- `reviver`: A reviver function that will be passed to `JSON.parse`
as the second argument
- `JSON`: You can pass a custom JSON parser if you want.
It should have a `parse` method that takes a string, an
optional reviver and a callback. It should return the value
in the callback or a parsing error.
```js
var jsonBody = require("body/json")
var http = require("http")
http.createServer(function (req, res) {
jsonBody(req, res, function (err, body) {
// err is probably an invalid json error
if (err) {
res.statusCode = 500
return res.end("NO U")
}
// I am an echo server
res.setHeader("content-type", "application/json")
res.end(JSON.stringify(body))
})
}).listen(8080)
```
### `anyBody(req, res?, opts?, cb<Error, Any>)`
```ocaml
anyBody := (
req: HttpRequest,
res?: HttpResponse,
opts?: {
limit?: Number,
encoding?: String,
reviver?: (Any) => Any
JSON?: {
parse: (String, reviver?: Function, Callback<Error, Any>) => void
},
querystring: {
parse: (String, Callback<Error, Any>) => void
}
},
cb: Callback<err: Error, bodyPayload: Any>
) => void
```
`anyBody` allows you to get the body of a HTTPRequest. It
does the same as `textBody` except it parses the `content-type`
header and uses either the jsonBody or the formBody function.
This allows you to write POST route handlers that work with
both ajax and html form submits.
- `limit`: same as `textBody`
- `encoding`: same as `textBody`
- `reviver`: same as `jsonBody`
- `JSON`: same as `jsonBody`
- `querystring`: same as `formBody`
```js
var anyBody = require("body/any")
var http = require("http")
http.createServer(function (req, res) {
anyBody(req, res, function (err, body) {
// err is probably an invalid json error
if (err) {
res.statusCode = 500
return res.end("NO U")
}
// I am an echo server
res.setHeader("content-type", "application/json")
res.end(JSON.stringify(body))
})
}).listen(8080)
```
## Installation
`npm install body`
## Tests
`npm test`
## Contributors
- Raynos
## MIT Licenced
[1]: https://secure.travis-ci.org/Raynos/body.png
[2]: http://travis-ci.org/Raynos/body

38
node_modules/body/any.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
var TypedError = require("error/typed")
var parseArguments = require("./parse-arguments.js")
var jsonBody = require("./json.js")
var formBody = require("./form.js")
var jsonType = "application/json"
var formType = "application/x-www-form-urlencoded"
var INVALID_CONTENT_TYPE = TypedError({
message: "Could not parse content type header: {contentType}",
type: "invalid.content.type",
statusCode: 415,
contentType: null
})
module.exports = anyBody
function anyBody(req, res, opts, callback) {
var args = parseArguments(req, res, opts, callback)
req = args.req
res = args.res
opts = args.opts
callback = args.callback
if (!callback) {
return anyBody.bind(null, req, res, opts)
}
var contentType = req.headers["content-type"] || ""
if (contentType.indexOf(jsonType) !== -1) {
jsonBody(req, res, opts, callback)
} else if (contentType.indexOf(formType) !== -1) {
formBody(req, res, opts, callback)
} else {
callback(INVALID_CONTENT_TYPE({contentType: contentType}))
}
}

33
node_modules/body/form.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
var querystringParse = require("querystring").parse
var body = require("./index.js")
var parseArguments = require("./parse-arguments.js")
module.exports = formBody
function formBody(req, res, opts, callback) {
var args = parseArguments(req, res, opts, callback)
req = args.req
res = args.res
opts = args.opts
callback = args.callback
if (!callback) {
return formBody.bind(null, req, res, opts)
}
var parse = opts.querystring ?
opts.querystring.parse : defaultQueryStringParse
body(req, res, opts, function (err, body) {
if (err) {
return callback(err)
}
parse(body, callback)
})
}
function defaultQueryStringParse(str, callback) {
callback(null, querystringParse(str))
}

47
node_modules/body/index.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
var rawBody = require("raw-body")
var cache = require("continuable-cache")
var parseArguments = require("./parse-arguments.js")
var ONE_MB = 1024 * 1024
var THUNK_KEY = '__npm_body_thunk_cache__';
module.exports = body
function parseBodyThunk(req, res, opts) {
return function thunk(callback) {
var limit = "limit" in opts ? opts.limit : ONE_MB
var contentLength = req.headers ?
Number(req.headers["content-length"]) : null;
rawBody(req, {
limit: limit,
length: contentLength,
encoding: "encoding" in opts ? opts.encoding : true
}, callback);
};
}
function body(req, res, opts, callback) {
var args = parseArguments(req, res, opts, callback)
req = args.req
res = args.res
opts = args.opts
callback = args.callback
var thunk;
if (opts.cache) {
var thunk = req[THUNK_KEY] ||
cache(parseBodyThunk(req, res, opts));
req[THUNK_KEY] = thunk;
} else {
thunk = parseBodyThunk(req, res, opts);
}
if (!callback) {
return thunk;
}
thunk(callback);
}

29
node_modules/body/json.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
var jsonParse = require("safe-json-parse")
var body = require("./index.js")
var parseArguments = require("./parse-arguments.js")
module.exports = jsonBody
function jsonBody(req, res, opts, callback) {
var args = parseArguments(req, res, opts, callback)
req = args.req
res = args.res
opts = args.opts
callback = args.callback
if (!callback) {
return jsonBody.bind(null, req, res, opts)
}
var parse = opts.JSON ? opts.JSON.parse : jsonParse
var reviver = opts.reviver || null
body(req, res, opts, function (err, body) {
if (err) {
return callback(err)
}
parse(body, reviver, callback)
})
}

1
node_modules/body/node_modules/bytes/.npmignore generated vendored Normal file
View File

@@ -0,0 +1 @@
test

25
node_modules/body/node_modules/bytes/History.md generated vendored Normal file
View File

@@ -0,0 +1,25 @@
1.0.0 / 2014-05-05
==================
* add negative support. fixes #6
0.3.0 / 2014-03-19
==================
* added terabyte support
0.2.1 / 2013-04-01
==================
* add .component
0.2.0 / 2012-10-28
==================
* bytes(200).should.eql('200b')
0.1.0 / 2012-07-04
==================
* add bytes to string conversion [yields]

7
node_modules/body/node_modules/bytes/Makefile generated vendored Normal file
View File

@@ -0,0 +1,7 @@
test:
@./node_modules/.bin/mocha \
--reporter spec \
--require should
.PHONY: test

54
node_modules/body/node_modules/bytes/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,54 @@
# node-bytes
Byte string parser / formatter.
## Example:
```js
bytes('1kb')
// => 1024
bytes('2mb')
// => 2097152
bytes('1gb')
// => 1073741824
bytes(1073741824)
// => 1gb
bytes(1099511627776)
// => 1tb
```
## Installation
```
$ npm install bytes
$ component install visionmedia/bytes.js
```
## License
(The MIT License)
Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
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.

7
node_modules/body/node_modules/bytes/component.json generated vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"name": "bytes",
"description": "byte size string parser / serializer",
"keywords": ["bytes", "utility"],
"version": "0.2.1",
"scripts": ["index.js"]
}

41
node_modules/body/node_modules/bytes/index.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
/**
* Parse byte `size` string.
*
* @param {String} size
* @return {Number}
* @api public
*/
module.exports = function(size) {
if ('number' == typeof size) return convert(size);
var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb|tb)$/)
, n = parseFloat(parts[1])
, type = parts[2];
var map = {
kb: 1 << 10
, mb: 1 << 20
, gb: 1 << 30
, tb: ((1 << 30) * 1024)
};
return map[type] * n;
};
/**
* convert bytes into string.
*
* @param {Number} b - bytes to convert
* @return {String}
* @api public
*/
function convert (b) {
var tb = ((1 << 30) * 1024), gb = 1 << 30, mb = 1 << 20, kb = 1 << 10, abs = Math.abs(b);
if (abs >= tb) return (Math.round(b / tb * 100) / 100) + 'tb';
if (abs >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
if (abs >= mb) return (Math.round(b / mb * 100) / 100) + 'mb';
if (abs >= kb) return (Math.round(b / kb * 100) / 100) + 'kb';
return b + 'b';
}

54
node_modules/body/node_modules/bytes/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"_from": "bytes@1",
"_id": "bytes@1.0.0",
"_inBundle": false,
"_integrity": "sha1-NWnt6Lo0MV+rmcPpLLBMciDeH6g=",
"_location": "/body/bytes",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "bytes@1",
"name": "bytes",
"escapedName": "bytes",
"rawSpec": "1",
"saveSpec": null,
"fetchSpec": "1"
},
"_requiredBy": [
"/body/raw-body"
],
"_resolved": "https://registry.npmjs.org/bytes/-/bytes-1.0.0.tgz",
"_shasum": "3569ede8ba34315fab99c3e92cb04c7220de1fa8",
"_spec": "bytes@1",
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/latehome/wp-content/plugins/opal-estate-pro/node_modules/body/node_modules/raw-body",
"author": {
"name": "TJ Holowaychuk",
"email": "tj@vision-media.ca",
"url": "http://tjholowaychuk.com"
},
"bugs": {
"url": "https://github.com/visionmedia/bytes.js/issues"
},
"bundleDependencies": false,
"component": {
"scripts": {
"bytes/index.js": "index.js"
}
},
"dependencies": {},
"deprecated": false,
"description": "byte size string parser / serializer",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"homepage": "https://github.com/visionmedia/bytes.js#readme",
"main": "index.js",
"name": "bytes",
"repository": {
"type": "git",
"url": "git+https://github.com/visionmedia/bytes.js.git"
},
"version": "1.0.0"
}

3
node_modules/body/node_modules/raw-body/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
coverage/
test/
.travis.yml

85
node_modules/body/node_modules/raw-body/HISTORY.md generated vendored Normal file
View File

@@ -0,0 +1,85 @@
1.1.7 / 2014-06-12
==================
* use `string_decoder` module from npm
1.1.6 / 2014-05-27
==================
* check encoding for old streams1
* support node.js < 0.10.6
1.1.5 / 2014-05-14
==================
* bump bytes
1.1.4 / 2014-04-19
==================
* allow true as an option
* bump bytes
1.1.3 / 2014-03-02
==================
* fix case when length=null
1.1.2 / 2013-12-01
==================
* be less strict on state.encoding check
1.1.1 / 2013-11-27
==================
* add engines
1.1.0 / 2013-11-27
==================
* add err.statusCode and err.type
* allow for encoding option to be true
* pause the stream instead of dumping on error
* throw if the stream's encoding is set
1.0.1 / 2013-11-19
==================
* dont support streams1, throw if dev set encoding
1.0.0 / 2013-11-17
==================
* rename `expected` option to `length`
0.2.0 / 2013-11-15
==================
* republish
0.1.1 / 2013-11-15
==================
* use bytes
0.1.0 / 2013-11-11
==================
* generator support
0.0.3 / 2013-10-10
==================
* update repo
0.0.2 / 2013-09-14
==================
* dump stream on bad headers
* listen to events after defining received and buffers
0.0.1 / 2013-09-14
==================
* Initial release

100
node_modules/body/node_modules/raw-body/README.md generated vendored Normal file
View File

@@ -0,0 +1,100 @@
# raw-body
[![NPM version](https://badge.fury.io/js/method-override.svg)](http://badge.fury.io/js/raw-body)
[![Build Status](https://travis-ci.org/stream-utils/raw-body.svg?branch=master)](https://travis-ci.org/stream-utils/raw-body)
[![Coverage Status](https://img.shields.io/coveralls/stream-utils/raw-body.svg?branch=master)](https://coveralls.io/r/stream-utils/raw-body)
Gets the entire buffer of a stream either as a `Buffer` or a string.
Validates the stream's length against an expected length and maximum limit.
Ideal for parsing request bodies.
## API
```js
var getRawBody = require('raw-body')
app.use(function (req, res, next) {
getRawBody(req, {
length: req.headers['content-length'],
limit: '1mb',
encoding: 'utf8'
}, function (err, string) {
if (err)
return next(err)
req.text = string
next()
})
})
```
or in a Koa generator:
```js
app.use(function* (next) {
var string = yield getRawBody(this.req, {
length: this.length,
limit: '1mb',
encoding: 'utf8'
})
})
```
### getRawBody(stream, [options], [callback])
Returns a thunk for yielding with generators.
Options:
- `length` - The length length of the stream.
If the contents of the stream do not add up to this length,
an `400` error code is returned.
- `limit` - The byte limit of the body.
If the body ends up being larger than this limit,
a `413` error code is returned.
- `encoding` - The requested encoding.
By default, a `Buffer` instance will be returned.
Most likely, you want `utf8`.
You can use any type of encoding supported by [StringDecoder](http://nodejs.org/api/string_decoder.html).
You can also pass `true` which sets it to the default `utf8`
`callback(err, res)`:
- `err` - the following attributes will be defined if applicable:
- `limit` - the limit in bytes
- `length` and `expected` - the expected length of the stream
- `received` - the received bytes
- `status` and `statusCode` - the corresponding status code for the error
- `type` - either `entity.too.large`, `request.size.invalid`, or `stream.encoding.set`
- `res` - the result, either as a `String` if an encoding was set or a `Buffer` otherwise.
If an error occurs, the stream will be paused,
and you are responsible for correctly disposing the stream.
For HTTP requests, no handling is required if you send a response.
For streams that use file descriptors, you should `stream.destroy()` or `stream.close()` to prevent leaks.
## License
The MIT License (MIT)
Copyright (c) 2013 Jonathan Ong me@jongleberry.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.

151
node_modules/body/node_modules/raw-body/index.js generated vendored Normal file
View File

@@ -0,0 +1,151 @@
var bytes = require('bytes')
// NOTE: the trailing slash is not a typo
var StringDecoder = require('string_decoder/').StringDecoder
module.exports = function (stream, options, done) {
if (typeof options === 'function') {
done = options
options = {}
} else if (!options) {
options = {}
} else if (options === true) {
options = {
encoding: 'utf8'
}
}
// convert the limit to an integer
var limit = null
if (typeof options.limit === 'number')
limit = options.limit
if (typeof options.limit === 'string')
limit = bytes(options.limit)
// convert the expected length to an integer
var length = null
if (options.length != null && !isNaN(options.length))
length = parseInt(options.length, 10)
// check the length and limit options.
// note: we intentionally leave the stream paused,
// so users should handle the stream themselves.
if (limit !== null && length !== null && length > limit) {
if (typeof stream.pause === 'function')
stream.pause()
process.nextTick(function () {
var err = makeError('request entity too large', 'entity.too.large')
err.status = err.statusCode = 413
err.length = err.expected = length
err.limit = limit
done(err)
})
return defer
}
// streams1: assert request encoding is buffer.
// streams2+: assert the stream encoding is buffer.
// stream._decoder: streams1
// state.encoding: streams2
// state.decoder: streams2, specifically < 0.10.6
var state = stream._readableState
if (stream._decoder || (state && (state.encoding || state.decoder))) {
if (typeof stream.pause === 'function')
stream.pause()
process.nextTick(function () {
var err = makeError('stream encoding should not be set',
'stream.encoding.set')
// developer error
err.status = err.statusCode = 500
done(err)
})
return defer
}
var received = 0
// note: we delegate any invalid encodings to the constructor
var decoder = options.encoding
? new StringDecoder(options.encoding === true ? 'utf8' : options.encoding)
: null
var buffer = decoder
? ''
: []
stream.on('data', onData)
stream.once('end', onEnd)
stream.once('error', onEnd)
stream.once('close', cleanup)
return defer
// yieldable support
function defer(fn) {
done = fn
}
function onData(chunk) {
received += chunk.length
decoder
? buffer += decoder.write(chunk)
: buffer.push(chunk)
if (limit !== null && received > limit) {
if (typeof stream.pause === 'function')
stream.pause()
var err = makeError('request entity too large', 'entity.too.large')
err.status = err.statusCode = 413
err.received = received
err.limit = limit
done(err)
cleanup()
}
}
function onEnd(err) {
if (err) {
if (typeof stream.pause === 'function')
stream.pause()
done(err)
} else if (length !== null && received !== length) {
err = makeError('request size did not match content length',
'request.size.invalid')
err.status = err.statusCode = 400
err.received = received
err.length = err.expected = length
done(err)
} else {
done(null, decoder
? buffer + decoder.end()
: Buffer.concat(buffer)
)
}
cleanup()
}
function cleanup() {
received = buffer = null
stream.removeListener('data', onData)
stream.removeListener('end', onEnd)
stream.removeListener('error', onEnd)
stream.removeListener('close', cleanup)
}
}
// to create serializable errors you must re-set message so
// that it is enumerable and you must re configure the type
// property so that is writable and enumerable
function makeError(message, type) {
var error = new Error()
error.message = message
Object.defineProperty(error, 'type', {
value: type,
enumerable: true,
writable: true,
configurable: true
})
return error
}

63
node_modules/body/node_modules/raw-body/package.json generated vendored Normal file
View File

@@ -0,0 +1,63 @@
{
"_from": "raw-body@~1.1.0",
"_id": "raw-body@1.1.7",
"_inBundle": false,
"_integrity": "sha1-HQJ8K/oRasxmI7yo8AAWVyqH1CU=",
"_location": "/body/raw-body",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "raw-body@~1.1.0",
"name": "raw-body",
"escapedName": "raw-body",
"rawSpec": "~1.1.0",
"saveSpec": null,
"fetchSpec": "~1.1.0"
},
"_requiredBy": [
"/body"
],
"_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.7.tgz",
"_shasum": "1d027c2bfa116acc6623bca8f00016572a87d425",
"_spec": "raw-body@~1.1.0",
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/latehome/wp-content/plugins/opal-estate-pro/node_modules/body",
"author": {
"name": "Jonathan Ong",
"email": "me@jongleberry.com",
"url": "http://jongleberry.com"
},
"bugs": {
"url": "https://github.com/stream-utils/raw-body/issues"
},
"bundleDependencies": false,
"dependencies": {
"bytes": "1",
"string_decoder": "0.10"
},
"deprecated": false,
"description": "Get and validate the raw body of a readable stream.",
"devDependencies": {
"istanbul": "0.2.10",
"mocha": "~1.20.1",
"readable-stream": "~1.0.17",
"request": ">= 2.36.0 < 3",
"through2": "~0.4.1"
},
"engines": {
"node": ">= 0.8.0"
},
"homepage": "https://github.com/stream-utils/raw-body#readme",
"license": "MIT",
"name": "raw-body",
"repository": {
"type": "git",
"url": "git+https://github.com/stream-utils/raw-body.git"
},
"scripts": {
"test": "mocha --reporter spec --bail test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec test/"
},
"version": "1.1.7"
}

View File

@@ -0,0 +1,2 @@
build
test

20
node_modules/body/node_modules/string_decoder/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright Joyent, Inc. and other Node contributors.
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.

View File

@@ -0,0 +1,7 @@
**string_decoder.js** (`require('string_decoder')`) from Node.js core
Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details.
Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**
The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.

221
node_modules/body/node_modules/string_decoder/index.js generated vendored Normal file
View File

@@ -0,0 +1,221 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.
var Buffer = require('buffer').Buffer;
var isBufferEncoding = Buffer.isEncoding
|| function(encoding) {
switch (encoding && encoding.toLowerCase()) {
case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
default: return false;
}
}
function assertEncoding(encoding) {
if (encoding && !isBufferEncoding(encoding)) {
throw new Error('Unknown encoding: ' + encoding);
}
}
// StringDecoder provides an interface for efficiently splitting a series of
// buffers into a series of JS strings without breaking apart multi-byte
// characters. CESU-8 is handled as part of the UTF-8 encoding.
//
// @TODO Handling all encodings inside a single object makes it very difficult
// to reason about this code, so it should be split up in the future.
// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
// points as used by CESU-8.
var StringDecoder = exports.StringDecoder = function(encoding) {
this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
assertEncoding(encoding);
switch (this.encoding) {
case 'utf8':
// CESU-8 represents each of Surrogate Pair by 3-bytes
this.surrogateSize = 3;
break;
case 'ucs2':
case 'utf16le':
// UTF-16 represents each of Surrogate Pair by 2-bytes
this.surrogateSize = 2;
this.detectIncompleteChar = utf16DetectIncompleteChar;
break;
case 'base64':
// Base-64 stores 3 bytes in 4 chars, and pads the remainder.
this.surrogateSize = 3;
this.detectIncompleteChar = base64DetectIncompleteChar;
break;
default:
this.write = passThroughWrite;
return;
}
// Enough space to store all bytes of a single character. UTF-8 needs 4
// bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
this.charBuffer = new Buffer(6);
// Number of bytes received for the current incomplete multi-byte character.
this.charReceived = 0;
// Number of bytes expected for the current incomplete multi-byte character.
this.charLength = 0;
};
// write decodes the given buffer and returns it as JS string that is
// guaranteed to not contain any partial multi-byte characters. Any partial
// character found at the end of the buffer is buffered up, and will be
// returned when calling write again with the remaining bytes.
//
// Note: Converting a Buffer containing an orphan surrogate to a String
// currently works, but converting a String to a Buffer (via `new Buffer`, or
// Buffer#write) will replace incomplete surrogates with the unicode
// replacement character. See https://codereview.chromium.org/121173009/ .
StringDecoder.prototype.write = function(buffer) {
var charStr = '';
// if our last write ended with an incomplete multibyte character
while (this.charLength) {
// determine how many remaining bytes this buffer has to offer for this char
var available = (buffer.length >= this.charLength - this.charReceived) ?
this.charLength - this.charReceived :
buffer.length;
// add the new bytes to the char buffer
buffer.copy(this.charBuffer, this.charReceived, 0, available);
this.charReceived += available;
if (this.charReceived < this.charLength) {
// still not enough chars in this buffer? wait for more ...
return '';
}
// remove bytes belonging to the current character from the buffer
buffer = buffer.slice(available, buffer.length);
// get the character that was split
charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
var charCode = charStr.charCodeAt(charStr.length - 1);
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
this.charLength += this.surrogateSize;
charStr = '';
continue;
}
this.charReceived = this.charLength = 0;
// if there are no more bytes in this buffer, just emit our char
if (buffer.length === 0) {
return charStr;
}
break;
}
// determine and set charLength / charReceived
this.detectIncompleteChar(buffer);
var end = buffer.length;
if (this.charLength) {
// buffer the incomplete character bytes we got
buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
end -= this.charReceived;
}
charStr += buffer.toString(this.encoding, 0, end);
var end = charStr.length - 1;
var charCode = charStr.charCodeAt(end);
// CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
if (charCode >= 0xD800 && charCode <= 0xDBFF) {
var size = this.surrogateSize;
this.charLength += size;
this.charReceived += size;
this.charBuffer.copy(this.charBuffer, size, 0, size);
buffer.copy(this.charBuffer, 0, 0, size);
return charStr.substring(0, end);
}
// or just emit the charStr
return charStr;
};
// detectIncompleteChar determines if there is an incomplete UTF-8 character at
// the end of the given buffer. If so, it sets this.charLength to the byte
// length that character, and sets this.charReceived to the number of bytes
// that are available for this character.
StringDecoder.prototype.detectIncompleteChar = function(buffer) {
// determine how many bytes we have to check at the end of this buffer
var i = (buffer.length >= 3) ? 3 : buffer.length;
// Figure out if one of the last i bytes of our buffer announces an
// incomplete char.
for (; i > 0; i--) {
var c = buffer[buffer.length - i];
// See http://en.wikipedia.org/wiki/UTF-8#Description
// 110XXXXX
if (i == 1 && c >> 5 == 0x06) {
this.charLength = 2;
break;
}
// 1110XXXX
if (i <= 2 && c >> 4 == 0x0E) {
this.charLength = 3;
break;
}
// 11110XXX
if (i <= 3 && c >> 3 == 0x1E) {
this.charLength = 4;
break;
}
}
this.charReceived = i;
};
StringDecoder.prototype.end = function(buffer) {
var res = '';
if (buffer && buffer.length)
res = this.write(buffer);
if (this.charReceived) {
var cr = this.charReceived;
var buf = this.charBuffer;
var enc = this.encoding;
res += buf.slice(0, cr).toString(enc);
}
return res;
};
function passThroughWrite(buffer) {
return buffer.toString(this.encoding);
}
function utf16DetectIncompleteChar(buffer) {
this.charReceived = buffer.length % 2;
this.charLength = this.charReceived ? 2 : 0;
}
function base64DetectIncompleteChar(buffer) {
this.charReceived = buffer.length % 3;
this.charLength = this.charReceived ? 3 : 0;
}

View File

@@ -0,0 +1,53 @@
{
"_from": "string_decoder@0.10",
"_id": "string_decoder@0.10.31",
"_inBundle": false,
"_integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"_location": "/body/string_decoder",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "string_decoder@0.10",
"name": "string_decoder",
"escapedName": "string_decoder",
"rawSpec": "0.10",
"saveSpec": null,
"fetchSpec": "0.10"
},
"_requiredBy": [
"/body/raw-body"
],
"_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
"_spec": "string_decoder@0.10",
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/latehome/wp-content/plugins/opal-estate-pro/node_modules/body/node_modules/raw-body",
"bugs": {
"url": "https://github.com/rvagg/string_decoder/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "The string_decoder module from Node core",
"devDependencies": {
"tap": "~0.4.8"
},
"homepage": "https://github.com/rvagg/string_decoder",
"keywords": [
"string",
"decoder",
"browser",
"browserify"
],
"license": "MIT",
"main": "index.js",
"name": "string_decoder",
"repository": {
"type": "git",
"url": "git://github.com/rvagg/string_decoder.git"
},
"scripts": {
"test": "tap test/simple/*.js"
},
"version": "0.10.31"
}

73
node_modules/body/package.json generated vendored Normal file
View File

@@ -0,0 +1,73 @@
{
"_from": "body@^5.1.0",
"_id": "body@5.1.0",
"_inBundle": false,
"_integrity": "sha1-5LoM5BCkaTYyM2dgnstOZVMSUGk=",
"_location": "/body",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "body@^5.1.0",
"name": "body",
"escapedName": "body",
"rawSpec": "^5.1.0",
"saveSpec": null,
"fetchSpec": "^5.1.0"
},
"_requiredBy": [
"/tiny-lr"
],
"_resolved": "https://registry.npmjs.org/body/-/body-5.1.0.tgz",
"_shasum": "e4ba0ce410a46936323367609ecb4e6553125069",
"_spec": "body@^5.1.0",
"_where": "/Applications/XAMPP/xamppfiles/htdocs/wordpress/latehome/wp-content/plugins/opal-estate-pro/node_modules/tiny-lr",
"author": {
"name": "Raynos",
"email": "raynos2@gmail.com"
},
"bugs": {
"url": "https://github.com/Raynos/body/issues",
"email": "raynos2@gmail.com"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Jake Verbaten"
}
],
"dependencies": {
"continuable-cache": "^0.3.1",
"error": "^7.0.0",
"raw-body": "~1.1.0",
"safe-json-parse": "~1.0.1"
},
"deprecated": false,
"description": "Body parsing",
"devDependencies": {
"after": "~0.7.0",
"hammock": "^1.0.0",
"process": "~0.5.1",
"send-data": "~1.0.1",
"tape": "~2.3.0",
"test-server": "~0.1.3"
},
"homepage": "https://github.com/Raynos/body",
"keywords": [],
"licenses": [
{
"type": "MIT",
"url": "http://github.com/Raynos/body/raw/master/LICENSE"
}
],
"main": "index",
"name": "body",
"repository": {
"type": "git",
"url": "git://github.com/Raynos/body.git"
},
"scripts": {
"test": "node ./test/index.js"
},
"version": "5.1.0"
}

30
node_modules/body/parse-arguments.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
module.exports = parseArguments
function isWritable(stream) {
return typeof stream.write === "function" &&
typeof stream.end === "function"
}
function parseArguments(req, res, opts, callback) {
// (req, cb)
if (typeof res === "function") {
callback = res
opts = {}
res = null
}
// (req, res, cb)
if (typeof opts === "function") {
callback = opts
opts = {}
}
// (req, opts, cb)
if (res && !isWritable(res)) {
opts = res
res = null
}
// default (req, res, opts, cb)
return { req: req, res: res, opts: opts, callback: callback }
}

2
node_modules/body/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
require('./integration.js');
require('./unit.js');

105
node_modules/body/test/integration.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
var testServer = require("test-server")
var test = require("tape")
var sendJson = require("send-data/json")
var after = require("after")
var body = require("../index")
var jsonBody = require("../json")
var formBody = require("../form")
var anyBody = require("../any")
testServer(handleRequest, runTests)
function handleRequest(req, res) {
function send(err, body) {
if (err) {
return sendJson(req, res, err.message)
}
sendJson(req, res, body)
}
if (req.url === "/body") {
body(req, res, {}, send)
} else if (req.url === "/form") {
formBody(req, res, send)
} else if (req.url === "/json") {
jsonBody(req, {}, send)
} else if (req.url === "/any") {
anyBody(req, send)
}
}
function runTests(request, done) {
test("body works", function (t) {
t.end = after(2, t.end.bind(t))
testBody("/body", request, t)
request({
uri: "/any",
body: "foo"
}, function (err, res, body) {
t.equal(err, null)
t.equal(JSON.parse(body), "Could not parse content type header: ")
t.end()
})
})
test("form works", function (t) {
t.end = after(2, t.end.bind(t))
testFormBody("/form", request, t)
testFormBody("/any", request, t)
})
test("json works", function (t) {
t.end = after(2, t.end.bind(t))
testJsonBody("/json", request, t)
testJsonBody("/any", request, t)
})
.on("end", done)
}
function testBody(uri, request, t) {
request({
uri: uri,
body: "foo"
}, function (err, res, body) {
t.equal(err, null, "error is not null")
console.log("body", body, JSON.parse(body))
t.equal(JSON.parse(body), "foo", "body is incorrect")
t.end()
})
}
function testFormBody(uri, request, t) {
request({
uri: uri,
form: {
foo: "bar"
}
}, function (err, res, body) {
t.equal(err, null, "error is not null")
t.equal(JSON.parse(body).foo, "bar", "body is incorrect")
t.end()
})
}
function testJsonBody(uri, request, t) {
request({
uri: uri,
json: {
foo: "bar"
}
}, function (err, res, body) {
t.equal(err, null, "error is not null")
t.equal(body.foo, "bar", "body is incorrect")
t.end()
})
}

60
node_modules/body/test/unit.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
var after = require('after');
var body = require('../index.js');
var hammock = require('hammock');
var test = require('tape');
test('caching works', function t(assert) {
var request = hammock.Request({
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
url: '/somewhere'
});
var response = hammock.Response();
var done = after(2, assert.end.bind(assert));
body(request, response, { cache: true }, function onBody(err, body) {
assert.equal(body, 'thisbody', 'raw body has been set');
assert.pass('body is parsed');
done();
});
request.on('end', function() {
body(request, response, { cache: true }, function onBody(err, body) {
assert.equal(body, 'thisbody', 'cached body is provided');
assert.pass('body is parsed');
done();
});
});
request.end('thisbody');
});
test('parallel caching works', function t(assert) {
var request = hammock.Request({
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
url: '/somewhere'
});
request.end('thisbody');
var response = hammock.Response();
var done = after(5, function() {
process.nextTick(function() {
assert.equal(request.listeners('rawBody').length, 0, 'rawBody listeners cleared');
assert.end();
});
});
for (var i = 0; i < 5; ++i) {
body(request, response, { cache: true }, function onBody(err, body) {
assert.equal(body, 'thisbody', 'raw body has been set');
assert.pass('body is parsed');
done();
});
}
});