@nocobase/plugin-idp-oauth 2.1.0-beta.25 → 2.1.0-beta.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,11 +11,11 @@ module.exports = {
11
11
  "antd": "5.24.2",
12
12
  "react": "18.2.0",
13
13
  "react-router-dom": "6.30.1",
14
- "@nocobase/client": "2.1.0-beta.25",
15
- "@nocobase/flow-engine": "2.1.0-beta.25",
16
- "@nocobase/server": "2.1.0-beta.25",
17
- "@nocobase/cache": "2.1.0-beta.25",
18
- "@nocobase/plugin-auth": "2.1.0-beta.25",
19
- "@nocobase/utils": "2.1.0-beta.25",
20
- "@nocobase/database": "2.1.0-beta.25"
14
+ "@nocobase/client": "2.1.0-beta.27",
15
+ "@nocobase/flow-engine": "2.1.0-beta.27",
16
+ "@nocobase/server": "2.1.0-beta.27",
17
+ "@nocobase/cache": "2.1.0-beta.27",
18
+ "@nocobase/plugin-auth": "2.1.0-beta.27",
19
+ "@nocobase/utils": "2.1.0-beta.27",
20
+ "@nocobase/database": "2.1.0-beta.27"
21
21
  };
@@ -1 +1 @@
1
- {"name":"light-my-request","version":"6.6.0","description":"Fake HTTP injection library","main":"index.js","type":"commonjs","types":"types/index.d.ts","dependencies":{"cookie":"^1.0.1","process-warning":"^4.0.0","set-cookie-parser":"^2.6.0"},"devDependencies":{"@fastify/ajv-compiler":"^4.0.0","@fastify/pre-commit":"^2.1.0","@types/node":"^22.7.7","c8":"^10.1.2","end-of-stream":"^1.4.4","eslint":"^9.17.0","express":"^4.19.2","form-auto-content":"^3.2.1","form-data":"^4.0.0","formdata-node":"^6.0.3","multer":"^1.4.5-lts.1","neostandard":"^0.12.0","tinybench":"^3.0.0","tsd":"^0.31.0","undici":"^7.0.0"},"scripts":{"benchmark":"node benchmark/benchmark.js","coverage":"npm run unit -- --cov --coverage-report=html","lint":"eslint","lint:fix":"eslint --fix","test":"npm run lint && npm run test:unit && npm run test:typescript","test:typescript":"tsd","test:unit":"c8 --100 node --test"},"repository":{"type":"git","url":"git+https://github.com/fastify/light-my-request.git"},"keywords":["http","inject","fake","request","server"],"author":"Tomas Della Vedova - @delvedor (http://delved.org)","contributors":[{"name":"Matteo Collina","email":"hello@matteocollina.com"},{"name":"Manuel Spigolon","email":"behemoth89@gmail.com"},{"name":"Aras Abbasi","email":"aras.abbasi@gmail.com"},{"name":"Frazer Smith","email":"frazer.dev@icloud.com","url":"https://github.com/fdawgs"}],"license":"BSD-3-Clause","bugs":{"url":"https://github.com/fastify/light-my-request/issues"},"homepage":"https://github.com/fastify/light-my-request#readme","funding":[{"type":"github","url":"https://github.com/sponsors/fastify"},{"type":"opencollective","url":"https://opencollective.com/fastify"}],"_lastModified":"2026-05-06T11:08:06.437Z"}
1
+ {"name":"light-my-request","version":"6.6.0","description":"Fake HTTP injection library","main":"index.js","type":"commonjs","types":"types/index.d.ts","dependencies":{"cookie":"^1.0.1","process-warning":"^4.0.0","set-cookie-parser":"^2.6.0"},"devDependencies":{"@fastify/ajv-compiler":"^4.0.0","@fastify/pre-commit":"^2.1.0","@types/node":"^22.7.7","c8":"^10.1.2","end-of-stream":"^1.4.4","eslint":"^9.17.0","express":"^4.19.2","form-auto-content":"^3.2.1","form-data":"^4.0.0","formdata-node":"^6.0.3","multer":"^1.4.5-lts.1","neostandard":"^0.12.0","tinybench":"^3.0.0","tsd":"^0.31.0","undici":"^7.0.0"},"scripts":{"benchmark":"node benchmark/benchmark.js","coverage":"npm run unit -- --cov --coverage-report=html","lint":"eslint","lint:fix":"eslint --fix","test":"npm run lint && npm run test:unit && npm run test:typescript","test:typescript":"tsd","test:unit":"c8 --100 node --test"},"repository":{"type":"git","url":"git+https://github.com/fastify/light-my-request.git"},"keywords":["http","inject","fake","request","server"],"author":"Tomas Della Vedova - @delvedor (http://delved.org)","contributors":[{"name":"Matteo Collina","email":"hello@matteocollina.com"},{"name":"Manuel Spigolon","email":"behemoth89@gmail.com"},{"name":"Aras Abbasi","email":"aras.abbasi@gmail.com"},{"name":"Frazer Smith","email":"frazer.dev@icloud.com","url":"https://github.com/fdawgs"}],"license":"BSD-3-Clause","bugs":{"url":"https://github.com/fastify/light-my-request/issues"},"homepage":"https://github.com/fastify/light-my-request#readme","funding":[{"type":"github","url":"https://github.com/sponsors/fastify"},{"type":"opencollective","url":"https://opencollective.com/fastify"}],"_lastModified":"2026-05-09T06:29:13.129Z"}
@@ -1 +1 @@
1
- {"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/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":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-05-06T11:08:06.491Z"}
1
+ {"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/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":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-05-09T06:29:13.181Z"}
@@ -1,3 +1,25 @@
1
+ 2.0.2 / 2025-06-06
2
+ ==================
3
+
4
+ * Migrate to `String.prototype.slice()`
5
+
6
+ 2.0.1 / 2021-01-03
7
+ ==================
8
+
9
+ * Fix returning values from `Object.prototype`
10
+
11
+ 2.0.0 / 2020-04-19
12
+ ==================
13
+
14
+ * Drop support for Node.js 0.6
15
+ * Fix messaging casing of `418 I'm a Teapot`
16
+ * Remove code 306
17
+ * Remove `status[code]` exports; use `status.message[code]`
18
+ * Remove `status[msg]` exports; use `status.code[msg]`
19
+ * Rename `425 Unordered Collection` to standard `425 Too Early`
20
+ * Rename `STATUS_CODES` export to `message`
21
+ * Return status message for `statuses(code)` when given code
22
+
1
23
  1.5.0 / 2018-03-27
2
24
  ==================
3
25
 
@@ -1,10 +1,11 @@
1
- # Statuses
1
+ # statuses
2
2
 
3
- [![NPM Version][npm-image]][npm-url]
4
- [![NPM Downloads][downloads-image]][downloads-url]
3
+ [![NPM Version][npm-version-image]][npm-url]
4
+ [![NPM Downloads][npm-downloads-image]][npm-url]
5
5
  [![Node.js Version][node-version-image]][node-version-url]
6
- [![Build Status][travis-image]][travis-url]
6
+ [![Build Status][ci-image]][ci-url]
7
7
  [![Test Coverage][coveralls-image]][coveralls-url]
8
+ [![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
8
9
 
9
10
  HTTP status utility for node.
10
11
 
@@ -34,74 +35,80 @@ $ npm install statuses
34
35
  var status = require('statuses')
35
36
  ```
36
37
 
37
- ### var code = status(Integer || String)
38
+ ### status(code)
38
39
 
39
- If `Integer` or `String` is a valid HTTP code or status message, then the
40
- appropriate `code` will be returned. Otherwise, an error will be thrown.
40
+ Returns the status message string for a known HTTP status code. The code
41
+ may be a number or a string. An error is thrown for an unknown status code.
41
42
 
42
43
  <!-- eslint-disable no-undef -->
43
44
 
44
45
  ```js
45
- status(403) // => 403
46
- status('403') // => 403
47
- status('forbidden') // => 403
48
- status('Forbidden') // => 403
49
- status(306) // throws, as it's not supported by node.js
46
+ status(403) // => 'Forbidden'
47
+ status('403') // => 'Forbidden'
48
+ status(306) // throws
50
49
  ```
51
50
 
52
- ### status.STATUS_CODES
51
+ ### status(msg)
52
+
53
+ Returns the numeric status code for a known HTTP status message. The message
54
+ is case-insensitive. An error is thrown for an unknown status message.
55
+
56
+ <!-- eslint-disable no-undef -->
53
57
 
54
- Returns an object which maps status codes to status messages, in
55
- the same format as the
56
- [Node.js http module](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
58
+ ```js
59
+ status('forbidden') // => 403
60
+ status('Forbidden') // => 403
61
+ status('foo') // throws
62
+ ```
57
63
 
58
64
  ### status.codes
59
65
 
60
66
  Returns an array of all the status codes as `Integer`s.
61
67
 
62
- ### var msg = status[code]
68
+ ### status.code[msg]
63
69
 
64
- Map of `code` to `status message`. `undefined` for invalid `code`s.
70
+ Returns the numeric status code for a known status message (in lower-case),
71
+ otherwise `undefined`.
65
72
 
66
73
  <!-- eslint-disable no-undef, no-unused-expressions -->
67
74
 
68
75
  ```js
69
- status[404] // => 'Not Found'
76
+ status['not found'] // => 404
70
77
  ```
71
78
 
72
- ### var code = status[msg]
79
+ ### status.empty[code]
73
80
 
74
- Map of `status message` to `code`. `msg` can either be title-cased or
75
- lower-cased. `undefined` for invalid `status message`s.
81
+ Returns `true` if a status code expects an empty body.
76
82
 
77
83
  <!-- eslint-disable no-undef, no-unused-expressions -->
78
84
 
79
85
  ```js
80
- status['not found'] // => 404
81
- status['Not Found'] // => 404
86
+ status.empty[200] // => undefined
87
+ status.empty[204] // => true
88
+ status.empty[304] // => true
82
89
  ```
83
90
 
84
- ### status.redirect[code]
91
+ ### status.message[code]
85
92
 
86
- Returns `true` if a status code is a valid redirect status.
93
+ Returns the string message for a known numeric status code, otherwise
94
+ `undefined`. This object is the same format as the
95
+ [Node.js http module `http.STATUS_CODES`](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
87
96
 
88
97
  <!-- eslint-disable no-undef, no-unused-expressions -->
89
98
 
90
99
  ```js
91
- status.redirect[200] // => undefined
92
- status.redirect[301] // => true
100
+ status.message[404] // => 'Not Found'
93
101
  ```
94
102
 
95
- ### status.empty[code]
103
+ ### status.redirect[code]
96
104
 
97
- Returns `true` if a status code expects an empty body.
105
+ Returns `true` if a status code is a valid redirect status.
98
106
 
99
107
  <!-- eslint-disable no-undef, no-unused-expressions -->
100
108
 
101
109
  ```js
102
- status.empty[200] // => undefined
103
- status.empty[204] // => true
104
- status.empty[304] // => true
110
+ status.redirect[200] // => undefined
111
+ status.redirect[301] // => true
105
112
  ```
106
113
 
107
114
  ### status.retry[code]
@@ -115,13 +122,18 @@ status.retry[501] // => undefined
115
122
  status.retry[503] // => true
116
123
  ```
117
124
 
118
- [npm-image]: https://img.shields.io/npm/v/statuses.svg
119
- [npm-url]: https://npmjs.org/package/statuses
120
- [node-version-image]: https://img.shields.io/node/v/statuses.svg
121
- [node-version-url]: https://nodejs.org/en/download
122
- [travis-image]: https://img.shields.io/travis/jshttp/statuses.svg
123
- [travis-url]: https://travis-ci.org/jshttp/statuses
124
- [coveralls-image]: https://img.shields.io/coveralls/jshttp/statuses.svg
125
+ ## License
126
+
127
+ [MIT](LICENSE)
128
+
129
+ [ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci
130
+ [ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci
131
+ [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master
125
132
  [coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
126
- [downloads-image]: https://img.shields.io/npm/dm/statuses.svg
127
- [downloads-url]: https://npmjs.org/package/statuses
133
+ [node-version-image]: https://badgen.net/npm/node/statuses
134
+ [node-version-url]: https://nodejs.org/en/download
135
+ [npm-downloads-image]: https://badgen.net/npm/dm/statuses
136
+ [npm-url]: https://npmjs.org/package/statuses
137
+ [npm-version-image]: https://badgen.net/npm/v/statuses
138
+ [ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/jshttp/statuses/badge
139
+ [ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/jshttp/statuses
@@ -19,7 +19,6 @@
19
19
  "303": "See Other",
20
20
  "304": "Not Modified",
21
21
  "305": "Use Proxy",
22
- "306": "(Unused)",
23
22
  "307": "Temporary Redirect",
24
23
  "308": "Permanent Redirect",
25
24
  "400": "Bad Request",
@@ -40,12 +39,12 @@
40
39
  "415": "Unsupported Media Type",
41
40
  "416": "Range Not Satisfiable",
42
41
  "417": "Expectation Failed",
43
- "418": "I'm a teapot",
42
+ "418": "I'm a Teapot",
44
43
  "421": "Misdirected Request",
45
44
  "422": "Unprocessable Entity",
46
45
  "423": "Locked",
47
46
  "424": "Failed Dependency",
48
- "425": "Unordered Collection",
47
+ "425": "Too Early",
49
48
  "426": "Upgrade Required",
50
49
  "428": "Precondition Required",
51
50
  "429": "Too Many Requests",
@@ -22,10 +22,13 @@ var codes = require('./codes.json')
22
22
  module.exports = status
23
23
 
24
24
  // status code to message map
25
- status.STATUS_CODES = codes
25
+ status.message = codes
26
+
27
+ // status message (lower-case) to code map
28
+ status.code = createMessageToStatusCodeMap(codes)
26
29
 
27
30
  // array of status codes
28
- status.codes = populateStatusesMap(status, codes)
31
+ status.codes = createStatusCodeList(codes)
29
32
 
30
33
  // status codes for redirects
31
34
  status.redirect = {
@@ -53,27 +56,61 @@ status.retry = {
53
56
  }
54
57
 
55
58
  /**
56
- * Populate the statuses map for given codes.
59
+ * Create a map of message to status code.
57
60
  * @private
58
61
  */
59
62
 
60
- function populateStatusesMap (statuses, codes) {
61
- var arr = []
63
+ function createMessageToStatusCodeMap (codes) {
64
+ var map = {}
62
65
 
63
66
  Object.keys(codes).forEach(function forEachCode (code) {
64
67
  var message = codes[code]
65
68
  var status = Number(code)
66
69
 
67
- // Populate properties
68
- statuses[status] = message
69
- statuses[message] = status
70
- statuses[message.toLowerCase()] = status
70
+ // populate map
71
+ map[message.toLowerCase()] = status
72
+ })
73
+
74
+ return map
75
+ }
76
+
77
+ /**
78
+ * Create a list of all status codes.
79
+ * @private
80
+ */
71
81
 
72
- // Add to array
73
- arr.push(status)
82
+ function createStatusCodeList (codes) {
83
+ return Object.keys(codes).map(function mapCode (code) {
84
+ return Number(code)
74
85
  })
86
+ }
87
+
88
+ /**
89
+ * Get the status code for given message.
90
+ * @private
91
+ */
92
+
93
+ function getStatusCode (message) {
94
+ var msg = message.toLowerCase()
95
+
96
+ if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
97
+ throw new Error('invalid status message: "' + message + '"')
98
+ }
99
+
100
+ return status.code[msg]
101
+ }
102
+
103
+ /**
104
+ * Get the status message for given code.
105
+ * @private
106
+ */
107
+
108
+ function getStatusMessage (code) {
109
+ if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
110
+ throw new Error('invalid status code: ' + code)
111
+ }
75
112
 
76
- return arr
113
+ return status.message[code]
77
114
  }
78
115
 
79
116
  /**
@@ -92,8 +129,7 @@ function populateStatusesMap (statuses, codes) {
92
129
 
93
130
  function status (code) {
94
131
  if (typeof code === 'number') {
95
- if (!status[code]) throw new Error('invalid status code: ' + code)
96
- return code
132
+ return getStatusMessage(code)
97
133
  }
98
134
 
99
135
  if (typeof code !== 'string') {
@@ -103,11 +139,8 @@ function status (code) {
103
139
  // '403'
104
140
  var n = parseInt(code, 10)
105
141
  if (!isNaN(n)) {
106
- if (!status[n]) throw new Error('invalid status code: ' + n)
107
- return n
142
+ return getStatusMessage(n)
108
143
  }
109
144
 
110
- n = status[code.toLowerCase()]
111
- if (!n) throw new Error('invalid status message: "' + code + '"')
112
- return n
145
+ return getStatusCode(code)
113
146
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "statuses",
3
3
  "description": "HTTP status utility",
4
- "version": "1.5.0",
4
+ "version": "2.0.2",
5
5
  "contributors": [
6
6
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
7
  "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
@@ -20,29 +20,30 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "devDependencies": {
23
- "csv-parse": "1.2.4",
24
- "eslint": "4.19.1",
25
- "eslint-config-standard": "11.0.0",
26
- "eslint-plugin-import": "2.9.0",
27
- "eslint-plugin-markdown": "1.0.0-beta.6",
28
- "eslint-plugin-node": "6.0.1",
29
- "eslint-plugin-promise": "3.7.0",
30
- "eslint-plugin-standard": "3.0.1",
31
- "istanbul": "0.4.5",
32
- "mocha": "1.21.5",
33
- "raw-body": "2.3.2",
23
+ "csv-parse": "4.16.3",
24
+ "eslint": "7.19.0",
25
+ "eslint-config-standard": "14.1.1",
26
+ "eslint-plugin-import": "2.31.0",
27
+ "eslint-plugin-markdown": "1.0.2",
28
+ "eslint-plugin-node": "11.1.0",
29
+ "eslint-plugin-promise": "4.3.1",
30
+ "eslint-plugin-standard": "4.1.0",
31
+ "mocha": "8.4.0",
32
+ "nyc": "15.1.0",
33
+ "raw-body": "2.5.2",
34
34
  "stream-to-array": "2.3.0"
35
35
  },
36
36
  "engines": {
37
- "node": ">= 0.6"
37
+ "node": ">= 0.8"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node scripts/build.js",
41
41
  "fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
42
42
  "lint": "eslint --plugin markdown --ext js,md .",
43
43
  "test": "mocha --reporter spec --check-leaks --bail test/",
44
- "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
45
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
46
- "update": "npm run fetch && npm run build"
44
+ "test-ci": "nyc --reporter=lcov --reporter=text npm test",
45
+ "test-cov": "nyc --reporter=html --reporter=text npm test",
46
+ "update": "npm run fetch && npm run build",
47
+ "version": "node scripts/version-history.js && git add HISTORY.md"
47
48
  }
48
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-idp-oauth",
3
- "version": "2.1.0-beta.25",
3
+ "version": "2.1.0-beta.27",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "IdP: OAuth",
6
6
  "displayName.zh-CN": "IdP: OAuth",
@@ -22,5 +22,5 @@
22
22
  "keywords": [
23
23
  "Authentication"
24
24
  ],
25
- "gitHead": "824f8b8200e9fe086135768934d3ef427b212446"
25
+ "gitHead": "6d9e2d4ac3c6bf40951c8eb252860e47aa3a3c37"
26
26
  }
@@ -1,87 +0,0 @@
1
- 2.0.2 / 2025-06-06
2
- ==================
3
-
4
- * Migrate to `String.prototype.slice()`
5
-
6
- 2.0.1 / 2021-01-03
7
- ==================
8
-
9
- * Fix returning values from `Object.prototype`
10
-
11
- 2.0.0 / 2020-04-19
12
- ==================
13
-
14
- * Drop support for Node.js 0.6
15
- * Fix messaging casing of `418 I'm a Teapot`
16
- * Remove code 306
17
- * Remove `status[code]` exports; use `status.message[code]`
18
- * Remove `status[msg]` exports; use `status.code[msg]`
19
- * Rename `425 Unordered Collection` to standard `425 Too Early`
20
- * Rename `STATUS_CODES` export to `message`
21
- * Return status message for `statuses(code)` when given code
22
-
23
- 1.5.0 / 2018-03-27
24
- ==================
25
-
26
- * Add `103 Early Hints`
27
-
28
- 1.4.0 / 2017-10-20
29
- ==================
30
-
31
- * Add `STATUS_CODES` export
32
-
33
- 1.3.1 / 2016-11-11
34
- ==================
35
-
36
- * Fix return type in JSDoc
37
-
38
- 1.3.0 / 2016-05-17
39
- ==================
40
-
41
- * Add `421 Misdirected Request`
42
- * perf: enable strict mode
43
-
44
- 1.2.1 / 2015-02-01
45
- ==================
46
-
47
- * Fix message for status 451
48
- - `451 Unavailable For Legal Reasons`
49
-
50
- 1.2.0 / 2014-09-28
51
- ==================
52
-
53
- * Add `208 Already Repored`
54
- * Add `226 IM Used`
55
- * Add `306 (Unused)`
56
- * Add `415 Unable For Legal Reasons`
57
- * Add `508 Loop Detected`
58
-
59
- 1.1.1 / 2014-09-24
60
- ==================
61
-
62
- * Add missing 308 to `codes.json`
63
-
64
- 1.1.0 / 2014-09-21
65
- ==================
66
-
67
- * Add `codes.json` for universal support
68
-
69
- 1.0.4 / 2014-08-20
70
- ==================
71
-
72
- * Package cleanup
73
-
74
- 1.0.3 / 2014-06-08
75
- ==================
76
-
77
- * Add 308 to `.redirect` category
78
-
79
- 1.0.2 / 2014-03-13
80
- ==================
81
-
82
- * Add `.retry` category
83
-
84
- 1.0.1 / 2014-03-12
85
- ==================
86
-
87
- * Initial release
@@ -1,23 +0,0 @@
1
-
2
- The MIT License (MIT)
3
-
4
- Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
5
- Copyright (c) 2016 Douglas Christopher Wilson <doug@somethingdoug.com>
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
@@ -1,139 +0,0 @@
1
- # statuses
2
-
3
- [![NPM Version][npm-version-image]][npm-url]
4
- [![NPM Downloads][npm-downloads-image]][npm-url]
5
- [![Node.js Version][node-version-image]][node-version-url]
6
- [![Build Status][ci-image]][ci-url]
7
- [![Test Coverage][coveralls-image]][coveralls-url]
8
- [![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
9
-
10
- HTTP status utility for node.
11
-
12
- This module provides a list of status codes and messages sourced from
13
- a few different projects:
14
-
15
- * The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
16
- * The [Node.js project](https://nodejs.org/)
17
- * The [NGINX project](https://www.nginx.com/)
18
- * The [Apache HTTP Server project](https://httpd.apache.org/)
19
-
20
- ## Installation
21
-
22
- This is a [Node.js](https://nodejs.org/en/) module available through the
23
- [npm registry](https://www.npmjs.com/). Installation is done using the
24
- [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
25
-
26
- ```sh
27
- $ npm install statuses
28
- ```
29
-
30
- ## API
31
-
32
- <!-- eslint-disable no-unused-vars -->
33
-
34
- ```js
35
- var status = require('statuses')
36
- ```
37
-
38
- ### status(code)
39
-
40
- Returns the status message string for a known HTTP status code. The code
41
- may be a number or a string. An error is thrown for an unknown status code.
42
-
43
- <!-- eslint-disable no-undef -->
44
-
45
- ```js
46
- status(403) // => 'Forbidden'
47
- status('403') // => 'Forbidden'
48
- status(306) // throws
49
- ```
50
-
51
- ### status(msg)
52
-
53
- Returns the numeric status code for a known HTTP status message. The message
54
- is case-insensitive. An error is thrown for an unknown status message.
55
-
56
- <!-- eslint-disable no-undef -->
57
-
58
- ```js
59
- status('forbidden') // => 403
60
- status('Forbidden') // => 403
61
- status('foo') // throws
62
- ```
63
-
64
- ### status.codes
65
-
66
- Returns an array of all the status codes as `Integer`s.
67
-
68
- ### status.code[msg]
69
-
70
- Returns the numeric status code for a known status message (in lower-case),
71
- otherwise `undefined`.
72
-
73
- <!-- eslint-disable no-undef, no-unused-expressions -->
74
-
75
- ```js
76
- status['not found'] // => 404
77
- ```
78
-
79
- ### status.empty[code]
80
-
81
- Returns `true` if a status code expects an empty body.
82
-
83
- <!-- eslint-disable no-undef, no-unused-expressions -->
84
-
85
- ```js
86
- status.empty[200] // => undefined
87
- status.empty[204] // => true
88
- status.empty[304] // => true
89
- ```
90
-
91
- ### status.message[code]
92
-
93
- Returns the string message for a known numeric status code, otherwise
94
- `undefined`. This object is the same format as the
95
- [Node.js http module `http.STATUS_CODES`](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
96
-
97
- <!-- eslint-disable no-undef, no-unused-expressions -->
98
-
99
- ```js
100
- status.message[404] // => 'Not Found'
101
- ```
102
-
103
- ### status.redirect[code]
104
-
105
- Returns `true` if a status code is a valid redirect status.
106
-
107
- <!-- eslint-disable no-undef, no-unused-expressions -->
108
-
109
- ```js
110
- status.redirect[200] // => undefined
111
- status.redirect[301] // => true
112
- ```
113
-
114
- ### status.retry[code]
115
-
116
- Returns `true` if you should retry the rest.
117
-
118
- <!-- eslint-disable no-undef, no-unused-expressions -->
119
-
120
- ```js
121
- status.retry[501] // => undefined
122
- status.retry[503] // => true
123
- ```
124
-
125
- ## License
126
-
127
- [MIT](LICENSE)
128
-
129
- [ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci
130
- [ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci
131
- [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master
132
- [coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
133
- [node-version-image]: https://badgen.net/npm/node/statuses
134
- [node-version-url]: https://nodejs.org/en/download
135
- [npm-downloads-image]: https://badgen.net/npm/dm/statuses
136
- [npm-url]: https://npmjs.org/package/statuses
137
- [npm-version-image]: https://badgen.net/npm/v/statuses
138
- [ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/jshttp/statuses/badge
139
- [ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/jshttp/statuses
@@ -1,65 +0,0 @@
1
- {
2
- "100": "Continue",
3
- "101": "Switching Protocols",
4
- "102": "Processing",
5
- "103": "Early Hints",
6
- "200": "OK",
7
- "201": "Created",
8
- "202": "Accepted",
9
- "203": "Non-Authoritative Information",
10
- "204": "No Content",
11
- "205": "Reset Content",
12
- "206": "Partial Content",
13
- "207": "Multi-Status",
14
- "208": "Already Reported",
15
- "226": "IM Used",
16
- "300": "Multiple Choices",
17
- "301": "Moved Permanently",
18
- "302": "Found",
19
- "303": "See Other",
20
- "304": "Not Modified",
21
- "305": "Use Proxy",
22
- "307": "Temporary Redirect",
23
- "308": "Permanent Redirect",
24
- "400": "Bad Request",
25
- "401": "Unauthorized",
26
- "402": "Payment Required",
27
- "403": "Forbidden",
28
- "404": "Not Found",
29
- "405": "Method Not Allowed",
30
- "406": "Not Acceptable",
31
- "407": "Proxy Authentication Required",
32
- "408": "Request Timeout",
33
- "409": "Conflict",
34
- "410": "Gone",
35
- "411": "Length Required",
36
- "412": "Precondition Failed",
37
- "413": "Payload Too Large",
38
- "414": "URI Too Long",
39
- "415": "Unsupported Media Type",
40
- "416": "Range Not Satisfiable",
41
- "417": "Expectation Failed",
42
- "418": "I'm a Teapot",
43
- "421": "Misdirected Request",
44
- "422": "Unprocessable Entity",
45
- "423": "Locked",
46
- "424": "Failed Dependency",
47
- "425": "Too Early",
48
- "426": "Upgrade Required",
49
- "428": "Precondition Required",
50
- "429": "Too Many Requests",
51
- "431": "Request Header Fields Too Large",
52
- "451": "Unavailable For Legal Reasons",
53
- "500": "Internal Server Error",
54
- "501": "Not Implemented",
55
- "502": "Bad Gateway",
56
- "503": "Service Unavailable",
57
- "504": "Gateway Timeout",
58
- "505": "HTTP Version Not Supported",
59
- "506": "Variant Also Negotiates",
60
- "507": "Insufficient Storage",
61
- "508": "Loop Detected",
62
- "509": "Bandwidth Limit Exceeded",
63
- "510": "Not Extended",
64
- "511": "Network Authentication Required"
65
- }
@@ -1,146 +0,0 @@
1
- /*!
2
- * statuses
3
- * Copyright(c) 2014 Jonathan Ong
4
- * Copyright(c) 2016 Douglas Christopher Wilson
5
- * MIT Licensed
6
- */
7
-
8
- 'use strict'
9
-
10
- /**
11
- * Module dependencies.
12
- * @private
13
- */
14
-
15
- var codes = require('./codes.json')
16
-
17
- /**
18
- * Module exports.
19
- * @public
20
- */
21
-
22
- module.exports = status
23
-
24
- // status code to message map
25
- status.message = codes
26
-
27
- // status message (lower-case) to code map
28
- status.code = createMessageToStatusCodeMap(codes)
29
-
30
- // array of status codes
31
- status.codes = createStatusCodeList(codes)
32
-
33
- // status codes for redirects
34
- status.redirect = {
35
- 300: true,
36
- 301: true,
37
- 302: true,
38
- 303: true,
39
- 305: true,
40
- 307: true,
41
- 308: true
42
- }
43
-
44
- // status codes for empty bodies
45
- status.empty = {
46
- 204: true,
47
- 205: true,
48
- 304: true
49
- }
50
-
51
- // status codes for when you should retry the request
52
- status.retry = {
53
- 502: true,
54
- 503: true,
55
- 504: true
56
- }
57
-
58
- /**
59
- * Create a map of message to status code.
60
- * @private
61
- */
62
-
63
- function createMessageToStatusCodeMap (codes) {
64
- var map = {}
65
-
66
- Object.keys(codes).forEach(function forEachCode (code) {
67
- var message = codes[code]
68
- var status = Number(code)
69
-
70
- // populate map
71
- map[message.toLowerCase()] = status
72
- })
73
-
74
- return map
75
- }
76
-
77
- /**
78
- * Create a list of all status codes.
79
- * @private
80
- */
81
-
82
- function createStatusCodeList (codes) {
83
- return Object.keys(codes).map(function mapCode (code) {
84
- return Number(code)
85
- })
86
- }
87
-
88
- /**
89
- * Get the status code for given message.
90
- * @private
91
- */
92
-
93
- function getStatusCode (message) {
94
- var msg = message.toLowerCase()
95
-
96
- if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
97
- throw new Error('invalid status message: "' + message + '"')
98
- }
99
-
100
- return status.code[msg]
101
- }
102
-
103
- /**
104
- * Get the status message for given code.
105
- * @private
106
- */
107
-
108
- function getStatusMessage (code) {
109
- if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
110
- throw new Error('invalid status code: ' + code)
111
- }
112
-
113
- return status.message[code]
114
- }
115
-
116
- /**
117
- * Get the status code.
118
- *
119
- * Given a number, this will throw if it is not a known status
120
- * code, otherwise the code will be returned. Given a string,
121
- * the string will be parsed for a number and return the code
122
- * if valid, otherwise will lookup the code assuming this is
123
- * the status message.
124
- *
125
- * @param {string|number} code
126
- * @returns {number}
127
- * @public
128
- */
129
-
130
- function status (code) {
131
- if (typeof code === 'number') {
132
- return getStatusMessage(code)
133
- }
134
-
135
- if (typeof code !== 'string') {
136
- throw new TypeError('code must be a number or string')
137
- }
138
-
139
- // '403'
140
- var n = parseInt(code, 10)
141
- if (!isNaN(n)) {
142
- return getStatusMessage(n)
143
- }
144
-
145
- return getStatusCode(code)
146
- }
@@ -1,49 +0,0 @@
1
- {
2
- "name": "statuses",
3
- "description": "HTTP status utility",
4
- "version": "2.0.2",
5
- "contributors": [
6
- "Douglas Christopher Wilson <doug@somethingdoug.com>",
7
- "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
8
- ],
9
- "repository": "jshttp/statuses",
10
- "license": "MIT",
11
- "keywords": [
12
- "http",
13
- "status",
14
- "code"
15
- ],
16
- "files": [
17
- "HISTORY.md",
18
- "index.js",
19
- "codes.json",
20
- "LICENSE"
21
- ],
22
- "devDependencies": {
23
- "csv-parse": "4.16.3",
24
- "eslint": "7.19.0",
25
- "eslint-config-standard": "14.1.1",
26
- "eslint-plugin-import": "2.31.0",
27
- "eslint-plugin-markdown": "1.0.2",
28
- "eslint-plugin-node": "11.1.0",
29
- "eslint-plugin-promise": "4.3.1",
30
- "eslint-plugin-standard": "4.1.0",
31
- "mocha": "8.4.0",
32
- "nyc": "15.1.0",
33
- "raw-body": "2.5.2",
34
- "stream-to-array": "2.3.0"
35
- },
36
- "engines": {
37
- "node": ">= 0.8"
38
- },
39
- "scripts": {
40
- "build": "node scripts/build.js",
41
- "fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
42
- "lint": "eslint --plugin markdown --ext js,md .",
43
- "test": "mocha --reporter spec --check-leaks --bail test/",
44
- "test-ci": "nyc --reporter=lcov --reporter=text npm test",
45
- "test-cov": "nyc --reporter=html --reporter=text npm test",
46
- "update": "npm run fetch && npm run build",
47
- "version": "node scripts/version-history.js && git add HISTORY.md"
48
- }
49
- }