@coro-ai/runner 0.1.27 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard-dist/assets/{index-CbvmOLWN.js → index--JceWwKS.js} +10 -10
- package/dashboard-dist/assets/index-V3YMhXZt.css +2 -0
- package/dashboard-dist/index.html +2 -2
- package/dist/src/jobs/campaign-context.d.ts +40 -0
- package/dist/src/jobs/campaign-context.js +234 -0
- package/dist/src/jobs/campaign-context.js.map +1 -0
- package/dist/src/jobs/dispatcher.d.ts +10 -1
- package/dist/src/jobs/dispatcher.js +108 -21
- package/dist/src/jobs/dispatcher.js.map +1 -1
- package/dist/src/jobs/workspace-layout.d.ts +2 -0
- package/dist/src/jobs/workspace-layout.js +7 -1
- package/dist/src/jobs/workspace-layout.js.map +1 -1
- package/dist/src/prompt/builder.js +21 -1
- package/dist/src/prompt/builder.js.map +1 -1
- package/dist/src/tools/campaign.js +15 -6
- package/dist/src/tools/campaign.js.map +1 -1
- package/node_modules/@coro-ai/cloud-protocol/package.json +1 -1
- package/node_modules/@coro-ai/intelligence-base/layer/agents/campaign-evaluator.md +16 -2
- package/node_modules/@coro-ai/intelligence-base/layer/agents/campaign-integrator.md +57 -16
- package/node_modules/@coro-ai/intelligence-base/layer/agents/campaign-planner.md +18 -0
- package/node_modules/@coro-ai/intelligence-base/layer/agents/coder.md +2 -2
- package/node_modules/@coro-ai/intelligence-base/layer/agents/planner.md +4 -3
- package/node_modules/@coro-ai/intelligence-base/layer/agents/pr-reviewer.md +2 -0
- package/node_modules/@coro-ai/intelligence-base/layer/workflows/campaign/workflow.md +38 -13
- package/node_modules/@coro-ai/intelligence-base/package.json +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts +11 -0
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js +29 -3
- package/node_modules/@coro-ai/llm-anthropic/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/steering-errors.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/dist/steering-errors.js +10 -2
- package/node_modules/@coro-ai/llm-anthropic/dist/steering-errors.js.map +1 -1
- package/node_modules/@coro-ai/llm-anthropic/package.json +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/executor.d.ts.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/executor.js +43 -30
- package/node_modules/@coro-ai/llm-openai/dist/executor.js.map +1 -1
- package/node_modules/@coro-ai/llm-openai/dist/steering-input.d.ts +21 -0
- package/node_modules/@coro-ai/llm-openai/dist/steering-input.d.ts.map +1 -0
- package/node_modules/@coro-ai/llm-openai/dist/steering-input.js +64 -0
- package/node_modules/@coro-ai/llm-openai/dist/steering-input.js.map +1 -0
- package/node_modules/@coro-ai/llm-openai/package.json +1 -1
- package/node_modules/@coro-ai/plugin-sdk/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/README.md +16 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/index.js +4 -20
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/read.js +17 -17
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/json.js +60 -32
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/raw.js +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/text.js +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/urlencoded.js +16 -20
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/utils.js +18 -16
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/LICENSE +22 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/README.md +69 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/node_modules/content-type/package.json +52 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/package.json +23 -10
- package/node_modules/better-sqlite3/deps/download.sh +1 -1
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +692 -176
- package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +17 -5
- package/node_modules/better-sqlite3/package.json +1 -1
- package/node_modules/better-sqlite3/src/better_sqlite3.cpp +1 -1
- package/node_modules/better-sqlite3/src/util/helpers.cpp +1 -1
- package/node_modules/better-sqlite3/src/util/macros.cpp +8 -1
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +5 -3
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +8 -2
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +5 -3
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +8 -2
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +2 -5
- package/node_modules/hono/dist/cjs/middleware/language/language.js +10 -32
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/timing/timing.js +3 -1
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +6 -1
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +2 -5
- package/node_modules/hono/dist/middleware/language/language.js +10 -32
- package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
- package/node_modules/hono/dist/middleware/timing/timing.js +3 -1
- package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +1 -1
- package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +1 -1
- package/node_modules/hono/dist/utils/ipaddr.js +6 -1
- package/node_modules/hono/package.json +19 -13
- package/node_modules/openai/CHANGELOG.md +30 -1
- package/node_modules/openai/README.md +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js +6 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.js.map +1 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +6 -1
- package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs.map +1 -1
- package/node_modules/openai/package.json +2 -11
- package/node_modules/openai/resources/admin/organization/admin-api-keys.d.mts +9 -0
- package/node_modules/openai/resources/admin/organization/admin-api-keys.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/admin-api-keys.d.ts +9 -0
- package/node_modules/openai/resources/admin/organization/admin-api-keys.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.d.mts +113 -3
- package/node_modules/openai/resources/admin/organization/audit-logs.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/audit-logs.d.ts +113 -3
- package/node_modules/openai/resources/admin/organization/audit-logs.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/index.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts +2 -2
- package/node_modules/openai/resources/admin/organization/projects/projects.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/projects.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.d.mts +20 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.d.ts +20 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.js +19 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs +19 -0
- package/node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs.map +1 -1
- package/node_modules/openai/resources/admin/organization/spend-alerts.d.mts +12 -0
- package/node_modules/openai/resources/admin/organization/spend-alerts.d.mts.map +1 -1
- package/node_modules/openai/resources/admin/organization/spend-alerts.d.ts +12 -0
- package/node_modules/openai/resources/admin/organization/spend-alerts.d.ts.map +1 -1
- package/node_modules/openai/resources/admin/organization/spend-alerts.js +17 -0
- package/node_modules/openai/resources/admin/organization/spend-alerts.js.map +1 -1
- package/node_modules/openai/resources/admin/organization/spend-alerts.mjs +17 -0
- package/node_modules/openai/resources/admin/organization/spend-alerts.mjs.map +1 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.mts +9 -4
- package/node_modules/openai/resources/realtime/client-secrets.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/client-secrets.d.ts +9 -4
- package/node_modules/openai/resources/realtime/client-secrets.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.d.mts +18 -8
- package/node_modules/openai/resources/realtime/realtime.d.mts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.d.ts +18 -8
- package/node_modules/openai/resources/realtime/realtime.d.ts.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.js.map +1 -1
- package/node_modules/openai/resources/realtime/realtime.mjs.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.mts +6 -5
- package/node_modules/openai/resources/responses/input-tokens.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/input-tokens.d.ts +6 -5
- package/node_modules/openai/resources/responses/input-tokens.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.mts +11 -6
- package/node_modules/openai/resources/responses/responses.d.mts.map +1 -1
- package/node_modules/openai/resources/responses/responses.d.ts +11 -6
- package/node_modules/openai/resources/responses/responses.d.ts.map +1 -1
- package/node_modules/openai/resources/responses/responses.js.map +1 -1
- package/node_modules/openai/resources/responses/responses.mjs.map +1 -1
- package/node_modules/openai/resources/shared.d.mts +6 -0
- package/node_modules/openai/resources/shared.d.mts.map +1 -1
- package/node_modules/openai/resources/shared.d.ts +6 -0
- package/node_modules/openai/resources/shared.d.ts.map +1 -1
- package/node_modules/openai/resources/videos.d.mts +1 -1
- package/node_modules/openai/resources/videos.d.ts +1 -1
- package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +6 -1
- package/node_modules/openai/src/resources/admin/organization/admin-api-keys.ts +11 -0
- package/node_modules/openai/src/resources/admin/organization/audit-logs.ts +148 -1
- package/node_modules/openai/src/resources/admin/organization/projects/index.ts +1 -0
- package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +2 -0
- package/node_modules/openai/src/resources/admin/organization/projects/spend-alerts.ts +32 -0
- package/node_modules/openai/src/resources/admin/organization/spend-alerts.ts +18 -0
- package/node_modules/openai/src/resources/realtime/client-secrets.ts +10 -4
- package/node_modules/openai/src/resources/realtime/realtime.ts +20 -8
- package/node_modules/openai/src/resources/responses/input-tokens.ts +6 -5
- package/node_modules/openai/src/resources/responses/responses.ts +12 -6
- package/node_modules/openai/src/resources/shared.ts +7 -0
- package/node_modules/openai/src/resources/videos.ts +1 -1
- package/node_modules/openai/src/version.ts +1 -1
- package/node_modules/openai/version.d.mts +1 -1
- package/node_modules/openai/version.d.ts +1 -1
- package/node_modules/openai/version.js +1 -1
- package/node_modules/openai/version.mjs +1 -1
- package/node_modules/semver/classes/range.js +11 -2
- package/node_modules/semver/package.json +2 -2
- package/node_modules/side-channel/CHANGELOG.md +10 -0
- package/node_modules/side-channel/README.md +1 -1
- package/node_modules/side-channel/index.js +5 -2
- package/node_modules/side-channel/package.json +10 -10
- package/node_modules/side-channel/test/index.js +16 -0
- package/package.json +7 -6
- package/scripts/install-platform-native-deps.mjs +16 -1
- package/scripts/preinstall-windows-native-env.mjs +31 -0
- package/dashboard-dist/assets/index-BJUGO8PI.css +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coro-ai/plugin-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Public SDK for authoring Coro plugins (SCM, tracker, …). Re-exports the runner's plugin contracts plus a small set of authoring helpers (HMAC verification, base classes, MCP-server descriptors).",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,7 +51,14 @@ $ npm install body-parser
|
|
|
51
51
|
## API
|
|
52
52
|
|
|
53
53
|
```js
|
|
54
|
+
// Import all parsers
|
|
54
55
|
const bodyParser = require('body-parser')
|
|
56
|
+
|
|
57
|
+
// Or import individual parsers directly
|
|
58
|
+
const json = require('body-parser/json')
|
|
59
|
+
const urlencoded = require('body-parser/urlencoded')
|
|
60
|
+
const raw = require('body-parser/raw')
|
|
61
|
+
const text = require('body-parser/text')
|
|
55
62
|
```
|
|
56
63
|
|
|
57
64
|
The `bodyParser` object exposes various factories to create middlewares. All
|
|
@@ -93,11 +100,13 @@ specifies the number of bytes; if it is a string, the value is passed to the
|
|
|
93
100
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
|
94
101
|
to `'100kb'`.
|
|
95
102
|
|
|
103
|
+
> It’s recommended not to configure a very high limit and to use the default value whenever possible. Allowing larger payloads increases memory usage because of the resources required for decoding and transformations, and it can also lead to longer response times as more data is processed. By ‘very high’, we mean values above the default, for example payloads of 5 MB or more can already start to introduce these risks. With the default limits, these issues do not occur.
|
|
104
|
+
|
|
96
105
|
##### reviver
|
|
97
106
|
|
|
98
107
|
The `reviver` option is passed directly to `JSON.parse` as the second
|
|
99
108
|
argument. You can find more information on this argument
|
|
100
|
-
[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#
|
|
109
|
+
[in the MDN documentation about JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#the_reviver_parameter).
|
|
101
110
|
|
|
102
111
|
##### strict
|
|
103
112
|
|
|
@@ -149,6 +158,8 @@ specifies the number of bytes; if it is a string, the value is passed to the
|
|
|
149
158
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
|
150
159
|
to `'100kb'`.
|
|
151
160
|
|
|
161
|
+
> It’s recommended not to configure a very high limit and to use the default value whenever possible. Allowing larger payloads increases memory usage because of the resources required for decoding and transformations, and it can also lead to longer response times as more data is processed. By ‘very high’, we mean values above the default, for example payloads of 5 MB or more can already start to introduce these risks. With the default limits, these issues do not occur.
|
|
162
|
+
|
|
152
163
|
##### type
|
|
153
164
|
|
|
154
165
|
The `type` option is used to determine what media type the middleware will
|
|
@@ -200,6 +211,8 @@ specifies the number of bytes; if it is a string, the value is passed to the
|
|
|
200
211
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
|
201
212
|
to `'100kb'`.
|
|
202
213
|
|
|
214
|
+
> It’s recommended not to configure a very high limit and to use the default value whenever possible. Allowing larger payloads increases memory usage because of the resources required for decoding and transformations, and it can also lead to longer response times as more data is processed. By ‘very high’, we mean values above the default, for example payloads of 5 MB or more can already start to introduce these risks. With the default limits, these issues do not occur.
|
|
215
|
+
|
|
203
216
|
##### type
|
|
204
217
|
|
|
205
218
|
The `type` option is used to determine what media type the middleware will
|
|
@@ -255,6 +268,8 @@ specifies the number of bytes; if it is a string, the value is passed to the
|
|
|
255
268
|
[bytes](https://www.npmjs.com/package/bytes) library for parsing. Defaults
|
|
256
269
|
to `'100kb'`.
|
|
257
270
|
|
|
271
|
+
> It’s recommended not to configure a very high limit and to use the default value whenever possible. Allowing larger payloads increases memory usage because of the resources required for decoding and transformations, and it can also lead to longer response times as more data is processed. By ‘very high’, we mean values above the default, for example payloads of 5 MB or more can already start to introduce these risks. With the default limits, these issues do not occur.
|
|
272
|
+
|
|
258
273
|
##### parameterLimit
|
|
259
274
|
|
|
260
275
|
The `parameterLimit` option controls the maximum number of parameters that
|
|
@@ -24,41 +24,25 @@ exports = module.exports = bodyParser
|
|
|
24
24
|
* JSON parser.
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
|
|
28
|
-
configurable: true,
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: () => require('./lib/types/json')
|
|
31
|
-
})
|
|
27
|
+
exports.json = require('./lib/types/json')
|
|
32
28
|
|
|
33
29
|
/**
|
|
34
30
|
* Raw parser.
|
|
35
31
|
* @public
|
|
36
32
|
*/
|
|
37
|
-
|
|
38
|
-
configurable: true,
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: () => require('./lib/types/raw')
|
|
41
|
-
})
|
|
33
|
+
exports.raw = require('./lib/types/raw')
|
|
42
34
|
|
|
43
35
|
/**
|
|
44
36
|
* Text parser.
|
|
45
37
|
* @public
|
|
46
38
|
*/
|
|
47
|
-
|
|
48
|
-
configurable: true,
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: () => require('./lib/types/text')
|
|
51
|
-
})
|
|
39
|
+
exports.text = require('./lib/types/text')
|
|
52
40
|
|
|
53
41
|
/**
|
|
54
42
|
* URL-encoded parser.
|
|
55
43
|
* @public
|
|
56
44
|
*/
|
|
57
|
-
|
|
58
|
-
configurable: true,
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: () => require('./lib/types/urlencoded')
|
|
61
|
-
})
|
|
45
|
+
exports.urlencoded = require('./lib/types/urlencoded')
|
|
62
46
|
|
|
63
47
|
/**
|
|
64
48
|
* Create a middleware to parse json and urlencoded bodies.
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
* @private
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const createError = require('http-errors')
|
|
15
|
+
const getBody = require('raw-body')
|
|
16
|
+
const iconv = require('iconv-lite')
|
|
17
|
+
const onFinished = require('on-finished')
|
|
18
|
+
const zlib = require('node:zlib')
|
|
19
|
+
const hasBody = require('type-is').hasBody
|
|
20
|
+
const { getCharset } = require('./utils')
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Module exports.
|
|
@@ -63,7 +63,7 @@ function read (req, res, next, parse, debug, options) {
|
|
|
63
63
|
return
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
let encoding = null
|
|
67
67
|
if (options?.skipCharset !== true) {
|
|
68
68
|
encoding = getCharset(req) || options.defaultCharset
|
|
69
69
|
|
|
@@ -78,12 +78,12 @@ function read (req, res, next, parse, debug, options) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
let length
|
|
82
|
+
const opts = options
|
|
83
|
+
let stream
|
|
84
84
|
|
|
85
85
|
// read options
|
|
86
|
-
|
|
86
|
+
const verify = opts.verify
|
|
87
87
|
|
|
88
88
|
try {
|
|
89
89
|
// get the content stream
|
|
@@ -112,7 +112,7 @@ function read (req, res, next, parse, debug, options) {
|
|
|
112
112
|
debug('read body')
|
|
113
113
|
getBody(stream, opts, function (error, body) {
|
|
114
114
|
if (error) {
|
|
115
|
-
|
|
115
|
+
let _error
|
|
116
116
|
|
|
117
117
|
if (error.type === 'encoding.unsupported') {
|
|
118
118
|
// echo back charset
|
|
@@ -153,7 +153,7 @@ function read (req, res, next, parse, debug, options) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// parse
|
|
156
|
-
|
|
156
|
+
let str = body
|
|
157
157
|
try {
|
|
158
158
|
debug('parse body')
|
|
159
159
|
str = typeof body !== 'string' && encoding !== null
|
|
@@ -182,8 +182,8 @@ function read (req, res, next, parse, debug, options) {
|
|
|
182
182
|
* @private
|
|
183
183
|
*/
|
|
184
184
|
function contentstream (req, debug, inflate) {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
const encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
|
|
186
|
+
const length = req.headers['content-length']
|
|
187
187
|
|
|
188
188
|
debug('content-encoding "%s"', encoding)
|
|
189
189
|
|
|
@@ -199,7 +199,7 @@ function contentstream (req, debug, inflate) {
|
|
|
199
199
|
return req
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
const stream = createDecompressionStream(encoding, debug)
|
|
203
203
|
req.pipe(stream)
|
|
204
204
|
return stream
|
|
205
205
|
}
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const debug = require('debug')('body-parser:json')
|
|
16
|
+
const read = require('../read')
|
|
17
|
+
const { normalizeOptions } = require('../utils')
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Module exports.
|
|
@@ -33,10 +33,10 @@ module.exports = json
|
|
|
33
33
|
* %x0A / ; Line feed or New line
|
|
34
34
|
* %x0D ) ; Carriage return
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
const FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const JSON_SYNTAX_CHAR = '#'
|
|
39
|
+
const JSON_SYNTAX_REGEXP = /#+/g
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Create a middleware to parse JSON bodies.
|
|
@@ -48,23 +48,61 @@ var JSON_SYNTAX_REGEXP = /#+/g
|
|
|
48
48
|
function json (options) {
|
|
49
49
|
const normalizedOptions = normalizeOptions(options, 'application/json')
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
var strict = options?.strict !== false
|
|
51
|
+
const parse = createJsonParser(options)
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
53
|
+
const readOptions = {
|
|
54
|
+
...normalizedOptions,
|
|
55
|
+
// assert charset per RFC 7159 sec 8.1
|
|
56
|
+
isValidCharset: (charset) => charset.slice(0, 4) === 'utf-'
|
|
57
|
+
}
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
return function jsonParser (req, res, next) {
|
|
60
|
+
read(req, res, next, parse, debug, readOptions)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Create a JSON parse function
|
|
66
|
+
*
|
|
67
|
+
* @param {object} [options]
|
|
68
|
+
* @return {function}
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
function createJsonParser (options) {
|
|
72
|
+
const reviver = options?.reviver
|
|
73
|
+
const strict = options?.strict !== false
|
|
74
|
+
|
|
75
|
+
if (strict) {
|
|
76
|
+
return function parse (body) {
|
|
77
|
+
if (body.length === 0) {
|
|
78
|
+
// special-case empty json body, as it's a common client-side mistake
|
|
79
|
+
// TODO: maybe make this configurable or part of "strict" option
|
|
80
|
+
return {}
|
|
81
|
+
}
|
|
63
82
|
|
|
83
|
+
const first = firstchar(body)
|
|
64
84
|
if (first !== '{' && first !== '[') {
|
|
65
85
|
debug('strict violation')
|
|
66
86
|
throw createStrictSyntaxError(body, first)
|
|
67
87
|
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
debug('parse json')
|
|
91
|
+
return JSON.parse(body, reviver)
|
|
92
|
+
} catch (e) {
|
|
93
|
+
throw normalizeJsonSyntaxError(e, {
|
|
94
|
+
message: e.message,
|
|
95
|
+
stack: e.stack
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return function parse (body) {
|
|
102
|
+
if (body.length === 0) {
|
|
103
|
+
// special-case empty json body, as it's a common client-side mistake
|
|
104
|
+
// TODO: maybe make this configurable or part of "strict" option
|
|
105
|
+
return {}
|
|
68
106
|
}
|
|
69
107
|
|
|
70
108
|
try {
|
|
@@ -77,16 +115,6 @@ function json (options) {
|
|
|
77
115
|
})
|
|
78
116
|
}
|
|
79
117
|
}
|
|
80
|
-
|
|
81
|
-
const readOptions = {
|
|
82
|
-
...normalizedOptions,
|
|
83
|
-
// assert charset per RFC 7159 sec 8.1
|
|
84
|
-
isValidCharset: (charset) => charset.slice(0, 4) === 'utf-'
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return function jsonParser (req, res, next) {
|
|
88
|
-
read(req, res, next, parse, debug, readOptions)
|
|
89
|
-
}
|
|
90
118
|
}
|
|
91
119
|
|
|
92
120
|
/**
|
|
@@ -98,8 +126,8 @@ function json (options) {
|
|
|
98
126
|
* @private
|
|
99
127
|
*/
|
|
100
128
|
function createStrictSyntaxError (str, char) {
|
|
101
|
-
|
|
102
|
-
|
|
129
|
+
const index = str.indexOf(char)
|
|
130
|
+
let partial = ''
|
|
103
131
|
|
|
104
132
|
if (index !== -1) {
|
|
105
133
|
partial = str.substring(0, index) + JSON_SYNTAX_CHAR.repeat(str.length - index)
|
|
@@ -125,7 +153,7 @@ function createStrictSyntaxError (str, char) {
|
|
|
125
153
|
* @private
|
|
126
154
|
*/
|
|
127
155
|
function firstchar (str) {
|
|
128
|
-
|
|
156
|
+
const match = FIRST_CHAR_REGEXP.exec(str)
|
|
129
157
|
|
|
130
158
|
return match
|
|
131
159
|
? match[1]
|
|
@@ -141,10 +169,10 @@ function firstchar (str) {
|
|
|
141
169
|
* @private
|
|
142
170
|
*/
|
|
143
171
|
function normalizeJsonSyntaxError (error, obj) {
|
|
144
|
-
|
|
172
|
+
const keys = Object.getOwnPropertyNames(error)
|
|
145
173
|
|
|
146
|
-
for (
|
|
147
|
-
|
|
174
|
+
for (let i = 0; i < keys.length; i++) {
|
|
175
|
+
const key = keys[i]
|
|
148
176
|
if (key !== 'stack' && key !== 'message') {
|
|
149
177
|
delete error[key]
|
|
150
178
|
}
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* Module dependencies.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const debug = require('debug')('body-parser:raw')
|
|
14
|
+
const read = require('../read')
|
|
15
|
+
const { normalizeOptions, passthrough } = require('../utils')
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Module exports.
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* Module dependencies.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const debug = require('debug')('body-parser:text')
|
|
14
|
+
const read = require('../read')
|
|
15
|
+
const { normalizeOptions, passthrough } = require('../utils')
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Module exports.
|
package/node_modules/@modelcontextprotocol/sdk/node_modules/body-parser/lib/types/urlencoded.js
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* @private
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const createError = require('http-errors')
|
|
16
|
+
const debug = require('debug')('body-parser:urlencoded')
|
|
17
|
+
const read = require('../read')
|
|
18
|
+
const qs = require('qs')
|
|
19
|
+
const { normalizeOptions } = require('../utils')
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Module exports.
|
|
@@ -39,13 +39,7 @@ function urlencoded (options) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// create the appropriate query parser
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function parse (body, encoding) {
|
|
45
|
-
return body.length
|
|
46
|
-
? queryparse(body, encoding)
|
|
47
|
-
: {}
|
|
48
|
-
}
|
|
42
|
+
const parse = createQueryParser(options)
|
|
49
43
|
|
|
50
44
|
const readOptions = {
|
|
51
45
|
...normalizedOptions,
|
|
@@ -66,13 +60,13 @@ function urlencoded (options) {
|
|
|
66
60
|
* @private
|
|
67
61
|
*/
|
|
68
62
|
function createQueryParser (options) {
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
const extended = Boolean(options?.extended)
|
|
64
|
+
let parameterLimit = options?.parameterLimit !== undefined
|
|
71
65
|
? options?.parameterLimit
|
|
72
66
|
: 1000
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
const charsetSentinel = options?.charsetSentinel
|
|
68
|
+
const interpretNumericEntities = options?.interpretNumericEntities
|
|
69
|
+
const depth = extended ? (options?.depth !== undefined ? options?.depth : 32) : 0
|
|
76
70
|
|
|
77
71
|
if (isNaN(parameterLimit) || parameterLimit < 1) {
|
|
78
72
|
throw new TypeError('option parameterLimit must be a positive number')
|
|
@@ -86,8 +80,10 @@ function createQueryParser (options) {
|
|
|
86
80
|
parameterLimit = parameterLimit | 0
|
|
87
81
|
}
|
|
88
82
|
|
|
89
|
-
return function
|
|
90
|
-
|
|
83
|
+
return function parse (body, encoding) {
|
|
84
|
+
if (!body.length) return {}
|
|
85
|
+
|
|
86
|
+
const paramCount = parameterCount(body, parameterLimit)
|
|
91
87
|
|
|
92
88
|
if (paramCount === undefined) {
|
|
93
89
|
debug('too many parameters')
|
|
@@ -96,7 +92,7 @@ function createQueryParser (options) {
|
|
|
96
92
|
})
|
|
97
93
|
}
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
const arrayLimit = extended ? Math.max(100, paramCount) : paramCount
|
|
100
96
|
|
|
101
97
|
debug('parse ' + (extended ? 'extended ' : '') + 'urlencoding')
|
|
102
98
|
try {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Module dependencies.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const bytes = require('bytes')
|
|
8
|
+
const contentType = require('content-type')
|
|
9
|
+
const typeis = require('type-is')
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Module exports.
|
|
@@ -25,11 +25,9 @@ module.exports = {
|
|
|
25
25
|
* @private
|
|
26
26
|
*/
|
|
27
27
|
function getCharset (req) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return undefined
|
|
32
|
-
}
|
|
28
|
+
const header = req.headers['content-type']
|
|
29
|
+
if (!header) return undefined
|
|
30
|
+
return contentType.parse(header).parameters.charset?.toLowerCase()
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
/**
|
|
@@ -59,20 +57,24 @@ function normalizeOptions (options, defaultType) {
|
|
|
59
57
|
throw new TypeError('defaultType must be provided')
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
?
|
|
65
|
-
: options
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const inflate = options?.inflate !== false
|
|
61
|
+
const limit = typeof options?.limit === 'undefined' || options?.limit === null
|
|
62
|
+
? 102400 // 100kb default
|
|
63
|
+
: bytes.parse(options.limit)
|
|
64
|
+
const type = options?.type || defaultType
|
|
65
|
+
const verify = options?.verify || false
|
|
66
|
+
const defaultCharset = options?.defaultCharset || 'utf-8'
|
|
67
|
+
|
|
68
|
+
if (limit === null) {
|
|
69
|
+
throw new TypeError(`option limit "${String(options.limit)}" is invalid`)
|
|
70
|
+
}
|
|
69
71
|
|
|
70
72
|
if (verify !== false && typeof verify !== 'function') {
|
|
71
73
|
throw new TypeError('option verify must be function')
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
// create the appropriate type checking function
|
|
75
|
-
|
|
77
|
+
const shouldParse = typeof type !== 'function'
|
|
76
78
|
? typeChecker(type)
|
|
77
79
|
: type
|
|
78
80
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Douglas Christopher Wilson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# content-type
|
|
2
|
+
|
|
3
|
+
[![NPM version][npm-image]][npm-url]
|
|
4
|
+
[![NPM downloads][downloads-image]][downloads-url]
|
|
5
|
+
[![Build status][build-image]][build-url]
|
|
6
|
+
[![Build coverage][coverage-image]][coverage-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
|
+
|
|
9
|
+
Create and parse HTTP `Content-Type` header.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install content-type
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
const contentType = require("content-type");
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### contentType.parse(string, options?)
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const obj = contentType.parse("image/svg+xml; charset=utf-8");
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Parse a `Content-Type` header. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
|
|
30
|
+
|
|
31
|
+
- `type`: The media type. Example: `'image/svg+xml'`.
|
|
32
|
+
- `parameters`: An object of the parameters in the media type (parameter name is always lower case). Example: `{charset: 'utf-8'}`.
|
|
33
|
+
|
|
34
|
+
The parser is lenient and does not error. You should validate `type` and `parameters` before trusting them.
|
|
35
|
+
|
|
36
|
+
#### Options
|
|
37
|
+
|
|
38
|
+
- `parameters` (default: `true`): Set to `false` to skip parameters.
|
|
39
|
+
|
|
40
|
+
### contentType.format(obj)
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
const str = contentType.format({
|
|
44
|
+
type: "image/svg+xml",
|
|
45
|
+
parameters: { charset: "utf-8" },
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Format an object into a `Content-Type` header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string `'image/svg+xml; charset=utf-8'`):
|
|
50
|
+
|
|
51
|
+
- `type`: The media type. Example: `'image/svg+xml'`.
|
|
52
|
+
- `parameters`: An optional object of the parameters in the media type. Example: `{charset: 'utf-8'}`.
|
|
53
|
+
|
|
54
|
+
Throws a `TypeError` if the object contains an invalid type or parameter names.
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
[MIT](LICENSE)
|
|
59
|
+
|
|
60
|
+
[npm-image]: https://img.shields.io/npm/v/content-type
|
|
61
|
+
[npm-url]: https://npmjs.org/package/content-type
|
|
62
|
+
[downloads-image]: https://img.shields.io/npm/dm/content-type
|
|
63
|
+
[downloads-url]: https://npmjs.org/package/content-type
|
|
64
|
+
[build-image]: https://img.shields.io/github/actions/workflow/status/jshttp/content-type/ci.yml?branch=master
|
|
65
|
+
[build-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml?query=branch%3Amaster
|
|
66
|
+
[coverage-image]: https://img.shields.io/codecov/c/gh/jshttp/content-type
|
|
67
|
+
[coverage-url]: https://codecov.io/gh/jshttp/content-type
|
|
68
|
+
[license-image]: http://img.shields.io/npm/l/content-type.svg?style=flat
|
|
69
|
+
[license-url]: LICENSE
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* content-type
|
|
3
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The content type object contains a type string and optional parameters.
|
|
8
|
+
*/
|
|
9
|
+
export interface ContentType {
|
|
10
|
+
type: string;
|
|
11
|
+
parameters: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Format an object into a `Content-Type` header.
|
|
15
|
+
*/
|
|
16
|
+
export declare function format(obj: Partial<ContentType>): string;
|
|
17
|
+
/**
|
|
18
|
+
* Options for parsing a `Content-Type` header.
|
|
19
|
+
*/
|
|
20
|
+
export interface ParseOptions {
|
|
21
|
+
parameters?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse a `Content-Type` header.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parse(header: string, options?: ParseOptions): ContentType;
|