@coro-ai/runner 0.1.27 → 0.1.30
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/dispatcher.d.ts +10 -1
- package/dist/src/jobs/dispatcher.js +55 -12
- package/dist/src/jobs/dispatcher.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/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/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 +18 -10
- 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
|
@@ -146,12 +146,12 @@ extern "C" {
|
|
|
146
146
|
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
|
|
147
147
|
** [sqlite_version()] and [sqlite_source_id()].
|
|
148
148
|
*/
|
|
149
|
-
#define SQLITE_VERSION "3.53.
|
|
150
|
-
#define SQLITE_VERSION_NUMBER
|
|
151
|
-
#define SQLITE_SOURCE_ID "2026-
|
|
149
|
+
#define SQLITE_VERSION "3.53.2"
|
|
150
|
+
#define SQLITE_VERSION_NUMBER 3053002
|
|
151
|
+
#define SQLITE_SOURCE_ID "2026-06-03 19:12:13 d6e03d8c777cfa2d35e3b60d8ec3e0187f3e9f99d8e2ee9cac695fd6fcdf1a24"
|
|
152
152
|
#define SQLITE_SCM_BRANCH "branch-3.53"
|
|
153
|
-
#define SQLITE_SCM_TAGS "release version-3.53.
|
|
154
|
-
#define SQLITE_SCM_DATETIME "2026-
|
|
153
|
+
#define SQLITE_SCM_TAGS "release version-3.53.2"
|
|
154
|
+
#define SQLITE_SCM_DATETIME "2026-06-03T19:12:13.350Z"
|
|
155
155
|
|
|
156
156
|
/*
|
|
157
157
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -12853,11 +12853,23 @@ SQLITE_API int sqlite3changeset_apply_v3(
|
|
|
12853
12853
|
** database behave as if they were declared with "ON UPDATE NO ACTION ON
|
|
12854
12854
|
** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL
|
|
12855
12855
|
** or SET DEFAULT.
|
|
12856
|
+
**
|
|
12857
|
+
** <dt>SQLITE_CHANGESETAPPLY_NOUPDATELOOP <dd>
|
|
12858
|
+
** Sometimes, a changeset contains two or more update statements such that
|
|
12859
|
+
** although after applying all updates the database will contain no
|
|
12860
|
+
** constraint violations, no single update can be applied before the others.
|
|
12861
|
+
** The simplest example of this is a pair of UPDATEs that have "swapped"
|
|
12862
|
+
** two column values with a UNIQUE constraint.
|
|
12863
|
+
** <p>
|
|
12864
|
+
** Usually, sqlite3changeset_apply() and similar functions work hard to try
|
|
12865
|
+
** to find a way to apply such a changeset. However, if this flag is set,
|
|
12866
|
+
** then all such updates are considered CONSTRAINT conflicts.
|
|
12856
12867
|
*/
|
|
12857
12868
|
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
|
|
12858
12869
|
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
|
|
12859
12870
|
#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
|
|
12860
12871
|
#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
|
|
12872
|
+
#define SQLITE_CHANGESETAPPLY_NOUPDATELOOP 0x0010
|
|
12861
12873
|
|
|
12862
12874
|
/*
|
|
12863
12875
|
** CAPI3REF: Constants Passed To The Conflict Handler
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-sqlite3",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.11.1",
|
|
4
4
|
"description": "The fastest and simplest library for SQLite in Node.js.",
|
|
5
5
|
"homepage": "http://github.com/WiseLibs/better-sqlite3",
|
|
6
6
|
"author": "Joshua Wise <joshuathomaswise@gmail.com>",
|
|
@@ -57,7 +57,7 @@ NODE_MODULE_INIT(/* exports, context */) {
|
|
|
57
57
|
|
|
58
58
|
// Initialize addon instance.
|
|
59
59
|
Addon* addon = new Addon(isolate);
|
|
60
|
-
v8::Local<v8::External> data =
|
|
60
|
+
v8::Local<v8::External> data = EXTERNAL_NEW(isolate, addon);
|
|
61
61
|
node::AddEnvironmentCleanupHook(isolate, Addon::Cleanup, addon);
|
|
62
62
|
|
|
63
63
|
// Create and export native-backed classes and functions.
|
|
@@ -27,7 +27,14 @@
|
|
|
27
27
|
#define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
|
|
28
28
|
#define OnlyIsolate info.GetIsolate()
|
|
29
29
|
#define OnlyContext isolate->GetCurrentContext()
|
|
30
|
-
#
|
|
30
|
+
#if defined(NODE_MODULE_VERSION) && NODE_MODULE_VERSION >= 146
|
|
31
|
+
#define EXTERNAL_NEW(isolate, value) v8::External::New((isolate), (value), 0)
|
|
32
|
+
#define EXTERNAL_VALUE(value) (value)->Value(0)
|
|
33
|
+
#else
|
|
34
|
+
#define EXTERNAL_NEW(isolate, value) v8::External::New((isolate), (value))
|
|
35
|
+
#define EXTERNAL_VALUE(value) (value)->Value()
|
|
36
|
+
#endif
|
|
37
|
+
#define OnlyAddon static_cast<Addon*>(EXTERNAL_VALUE(info.Data().As<v8::External>()))
|
|
31
38
|
#define UseIsolate v8::Isolate* isolate = OnlyIsolate
|
|
32
39
|
#define UseContext v8::Local<v8::Context> ctx = OnlyContext
|
|
33
40
|
#define UseAddon Addon* addon = OnlyAddon
|
|
@@ -109,7 +109,9 @@ var EventProcessor = class {
|
|
|
109
109
|
method
|
|
110
110
|
};
|
|
111
111
|
if (event.body) {
|
|
112
|
-
|
|
112
|
+
const body = event.isBase64Encoded ? decodeBase64(event.body) : new TextEncoder().encode(event.body);
|
|
113
|
+
requestInit.body = body;
|
|
114
|
+
headers.set("content-length", body.length.toString());
|
|
113
115
|
}
|
|
114
116
|
return new Request(url, requestInit);
|
|
115
117
|
}
|
|
@@ -281,7 +283,7 @@ var ALBProcessor = class extends EventProcessor {
|
|
|
281
283
|
if (result.multiValueHeaders) {
|
|
282
284
|
result.multiValueHeaders["set-cookie"] = cookies;
|
|
283
285
|
} else {
|
|
284
|
-
result.headers["set-cookie"] = cookies
|
|
286
|
+
result.headers["set-cookie"] = cookies[0];
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
289
|
};
|
|
@@ -316,7 +318,7 @@ var LatticeV2Processor = class extends EventProcessor {
|
|
|
316
318
|
setCookiesToResult(result, cookies) {
|
|
317
319
|
result.headers = {
|
|
318
320
|
...result.headers,
|
|
319
|
-
"set-cookie": cookies
|
|
321
|
+
"set-cookie": cookies
|
|
320
322
|
};
|
|
321
323
|
}
|
|
322
324
|
};
|
|
@@ -45,11 +45,17 @@ var createRequest = (event) => {
|
|
|
45
45
|
const url = queryString ? `${urlPath}?${queryString}` : urlPath;
|
|
46
46
|
const headers = new Headers();
|
|
47
47
|
Object.entries(event.Records[0].cf.request.headers).forEach(([k, v]) => {
|
|
48
|
-
v.forEach((header) => headers.
|
|
48
|
+
v.forEach((header) => headers.append(k, header.value));
|
|
49
49
|
});
|
|
50
50
|
const requestBody = event.Records[0].cf.request.body;
|
|
51
51
|
const method = event.Records[0].cf.request.method;
|
|
52
|
-
const
|
|
52
|
+
const rawBody = createBody(method, requestBody);
|
|
53
|
+
let body = rawBody;
|
|
54
|
+
if (rawBody !== void 0) {
|
|
55
|
+
const bytes = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
|
|
56
|
+
body = bytes;
|
|
57
|
+
headers.set("content-length", bytes.length.toString());
|
|
58
|
+
}
|
|
53
59
|
return new Request(url, {
|
|
54
60
|
headers,
|
|
55
61
|
method,
|
|
@@ -139,7 +139,9 @@ class EventProcessor {
|
|
|
139
139
|
method
|
|
140
140
|
};
|
|
141
141
|
if (event.body) {
|
|
142
|
-
|
|
142
|
+
const body = event.isBase64Encoded ? (0, import_encode.decodeBase64)(event.body) : new TextEncoder().encode(event.body);
|
|
143
|
+
requestInit.body = body;
|
|
144
|
+
headers.set("content-length", body.length.toString());
|
|
143
145
|
}
|
|
144
146
|
return new Request(url, requestInit);
|
|
145
147
|
}
|
|
@@ -311,7 +313,7 @@ class ALBProcessor extends EventProcessor {
|
|
|
311
313
|
if (result.multiValueHeaders) {
|
|
312
314
|
result.multiValueHeaders["set-cookie"] = cookies;
|
|
313
315
|
} else {
|
|
314
|
-
result.headers["set-cookie"] = cookies
|
|
316
|
+
result.headers["set-cookie"] = cookies[0];
|
|
315
317
|
}
|
|
316
318
|
}
|
|
317
319
|
}
|
|
@@ -346,7 +348,7 @@ class LatticeV2Processor extends EventProcessor {
|
|
|
346
348
|
setCookiesToResult(result, cookies) {
|
|
347
349
|
result.headers = {
|
|
348
350
|
...result.headers,
|
|
349
|
-
"set-cookie": cookies
|
|
351
|
+
"set-cookie": cookies
|
|
350
352
|
};
|
|
351
353
|
}
|
|
352
354
|
}
|
|
@@ -78,11 +78,17 @@ const createRequest = (event) => {
|
|
|
78
78
|
const url = queryString ? `${urlPath}?${queryString}` : urlPath;
|
|
79
79
|
const headers = new Headers();
|
|
80
80
|
Object.entries(event.Records[0].cf.request.headers).forEach(([k, v]) => {
|
|
81
|
-
v.forEach((header) => headers.
|
|
81
|
+
v.forEach((header) => headers.append(k, header.value));
|
|
82
82
|
});
|
|
83
83
|
const requestBody = event.Records[0].cf.request.body;
|
|
84
84
|
const method = event.Records[0].cf.request.method;
|
|
85
|
-
const
|
|
85
|
+
const rawBody = createBody(method, requestBody);
|
|
86
|
+
let body = rawBody;
|
|
87
|
+
if (rawBody !== void 0) {
|
|
88
|
+
const bytes = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
|
|
89
|
+
body = bytes;
|
|
90
|
+
headers.set("content-length", bytes.length.toString());
|
|
91
|
+
}
|
|
86
92
|
return new Request(url, {
|
|
87
93
|
headers,
|
|
88
94
|
method,
|
|
@@ -27,7 +27,7 @@ const PREFIX = "Bearer";
|
|
|
27
27
|
const HEADER = "Authorization";
|
|
28
28
|
const bearerAuth = (options) => {
|
|
29
29
|
if (!("token" in options || "verifyToken" in options)) {
|
|
30
|
-
throw new Error('bearer auth middleware requires options for "token"');
|
|
30
|
+
throw new Error('bearer auth middleware requires options for "token" or "verifyToken"');
|
|
31
31
|
}
|
|
32
32
|
if (!options.realm) {
|
|
33
33
|
options.realm = "";
|
|
@@ -31,9 +31,6 @@ const cors = (options) => {
|
|
|
31
31
|
const findAllowOrigin = ((optsOrigin) => {
|
|
32
32
|
if (typeof optsOrigin === "string") {
|
|
33
33
|
if (optsOrigin === "*") {
|
|
34
|
-
if (opts.credentials) {
|
|
35
|
-
return (origin) => origin || null;
|
|
36
|
-
}
|
|
37
34
|
return () => optsOrigin;
|
|
38
35
|
} else {
|
|
39
36
|
return (origin) => optsOrigin === origin ? origin : null;
|
|
@@ -68,7 +65,7 @@ const cors = (options) => {
|
|
|
68
65
|
set("Access-Control-Expose-Headers", opts.exposeHeaders.join(","));
|
|
69
66
|
}
|
|
70
67
|
if (c.req.method === "OPTIONS") {
|
|
71
|
-
if (opts.origin !== "*"
|
|
68
|
+
if (opts.origin !== "*") {
|
|
72
69
|
set("Vary", "Origin");
|
|
73
70
|
}
|
|
74
71
|
if (opts.maxAge != null) {
|
|
@@ -98,7 +95,7 @@ const cors = (options) => {
|
|
|
98
95
|
});
|
|
99
96
|
}
|
|
100
97
|
await next();
|
|
101
|
-
if (opts.origin !== "*"
|
|
98
|
+
if (opts.origin !== "*") {
|
|
102
99
|
c.header("Vary", "Origin", { append: true });
|
|
103
100
|
}
|
|
104
101
|
};
|
|
@@ -83,20 +83,12 @@ const normalizeLanguage = (lang, options) => {
|
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
const detectFromQuery = (c, options) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return normalizeLanguage(query, options);
|
|
89
|
-
} catch {
|
|
90
|
-
return void 0;
|
|
91
|
-
}
|
|
86
|
+
const query = c.req.query(options.lookupQueryString);
|
|
87
|
+
return normalizeLanguage(query, options);
|
|
92
88
|
};
|
|
93
89
|
const detectFromCookie = (c, options) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return normalizeLanguage(cookie, options);
|
|
97
|
-
} catch {
|
|
98
|
-
return void 0;
|
|
99
|
-
}
|
|
90
|
+
const cookie = (0, import_cookie.getCookie)(c, options.lookupCookie);
|
|
91
|
+
return normalizeLanguage(cookie, options);
|
|
100
92
|
};
|
|
101
93
|
function detectFromHeader(c, options) {
|
|
102
94
|
try {
|
|
@@ -117,14 +109,10 @@ function detectFromHeader(c, options) {
|
|
|
117
109
|
}
|
|
118
110
|
}
|
|
119
111
|
function detectFromPath(c, options) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return normalizeLanguage(langSegment, options);
|
|
125
|
-
} catch {
|
|
126
|
-
return void 0;
|
|
127
|
-
}
|
|
112
|
+
const url = new URL(c.req.url);
|
|
113
|
+
const pathSegments = url.pathname.split("/").filter(Boolean);
|
|
114
|
+
const langSegment = pathSegments[options.lookupFromPathIndex];
|
|
115
|
+
return normalizeLanguage(langSegment, options);
|
|
128
116
|
}
|
|
129
117
|
const detectors = {
|
|
130
118
|
querystring: detectFromQuery,
|
|
@@ -159,9 +147,6 @@ const detectLanguage = (c, options) => {
|
|
|
159
147
|
let detectedLang;
|
|
160
148
|
for (const detectorName of options.order) {
|
|
161
149
|
const detector = detectors[detectorName];
|
|
162
|
-
if (!detector) {
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
150
|
try {
|
|
166
151
|
detectedLang = detector(c, options);
|
|
167
152
|
if (detectedLang) {
|
|
@@ -194,15 +179,8 @@ const languageDetector = (userOptions) => {
|
|
|
194
179
|
};
|
|
195
180
|
validateOptions(options);
|
|
196
181
|
return async function languageDetector2(ctx, next) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
ctx.set("language", lang);
|
|
200
|
-
} catch (error) {
|
|
201
|
-
if (options.debug) {
|
|
202
|
-
console.error("Language detection failed:", error);
|
|
203
|
-
}
|
|
204
|
-
ctx.set("language", options.fallbackLanguage);
|
|
205
|
-
}
|
|
182
|
+
const lang = detectLanguage(ctx, options);
|
|
183
|
+
ctx.set("language", lang);
|
|
206
184
|
await next();
|
|
207
185
|
};
|
|
208
186
|
};
|
|
@@ -45,7 +45,7 @@ const serveStatic = (options) => {
|
|
|
45
45
|
} else {
|
|
46
46
|
try {
|
|
47
47
|
filename = (0, import_url.tryDecodeURI)(c.req.path);
|
|
48
|
-
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}
|
|
48
|
+
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}|\\/.test(filename)) {
|
|
49
49
|
throw new Error();
|
|
50
50
|
}
|
|
51
51
|
} catch {
|
|
@@ -56,7 +56,9 @@ const timing = (config) => {
|
|
|
56
56
|
endTime(c, "total");
|
|
57
57
|
}
|
|
58
58
|
if (options.autoEnd) {
|
|
59
|
-
timers.forEach((_, key) =>
|
|
59
|
+
timers.forEach((_, key) => {
|
|
60
|
+
endTime(c, key);
|
|
61
|
+
});
|
|
60
62
|
}
|
|
61
63
|
const enabled = typeof options.enabled === "function" ? options.enabled(c) : options.enabled;
|
|
62
64
|
if (enabled) {
|
|
@@ -43,7 +43,9 @@ const expandIPv6 = (ipV6) => {
|
|
|
43
43
|
if (node !== "") {
|
|
44
44
|
sections[i] = node.padStart(4, "0");
|
|
45
45
|
} else {
|
|
46
|
-
sections[i + 1] === ""
|
|
46
|
+
while (sections[i + 1] === "") {
|
|
47
|
+
sections.splice(i + 1, 1);
|
|
48
|
+
}
|
|
47
49
|
sections[i] = new Array(8 - sections.length + 1).fill("0000").join(":");
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -263,6 +265,9 @@ const convertIPv4BinaryToString = (ipV4) => {
|
|
|
263
265
|
const isIPv4MappedIPv6 = (ipv6binary) => ipv6binary >> 32n === 0xffffn;
|
|
264
266
|
const convertIPv4MappedIPv6ToIPv4 = (ipv6binary) => ipv6binary & 0xffffffffn;
|
|
265
267
|
const convertIPv6BinaryToString = (ipV6) => {
|
|
268
|
+
if (ipV6 === 0n) {
|
|
269
|
+
return "::";
|
|
270
|
+
}
|
|
266
271
|
if (isIPv4MappedIPv6(ipV6)) {
|
|
267
272
|
return `::ffff:${convertIPv4BinaryToString(convertIPv4MappedIPv6ToIPv4(ipV6))}`;
|
|
268
273
|
}
|
|
@@ -6,7 +6,7 @@ var PREFIX = "Bearer";
|
|
|
6
6
|
var HEADER = "Authorization";
|
|
7
7
|
var bearerAuth = (options) => {
|
|
8
8
|
if (!("token" in options || "verifyToken" in options)) {
|
|
9
|
-
throw new Error('bearer auth middleware requires options for "token"');
|
|
9
|
+
throw new Error('bearer auth middleware requires options for "token" or "verifyToken"');
|
|
10
10
|
}
|
|
11
11
|
if (!options.realm) {
|
|
12
12
|
options.realm = "";
|
|
@@ -10,9 +10,6 @@ var cors = (options) => {
|
|
|
10
10
|
const findAllowOrigin = ((optsOrigin) => {
|
|
11
11
|
if (typeof optsOrigin === "string") {
|
|
12
12
|
if (optsOrigin === "*") {
|
|
13
|
-
if (opts.credentials) {
|
|
14
|
-
return (origin) => origin || null;
|
|
15
|
-
}
|
|
16
13
|
return () => optsOrigin;
|
|
17
14
|
} else {
|
|
18
15
|
return (origin) => optsOrigin === origin ? origin : null;
|
|
@@ -47,7 +44,7 @@ var cors = (options) => {
|
|
|
47
44
|
set("Access-Control-Expose-Headers", opts.exposeHeaders.join(","));
|
|
48
45
|
}
|
|
49
46
|
if (c.req.method === "OPTIONS") {
|
|
50
|
-
if (opts.origin !== "*"
|
|
47
|
+
if (opts.origin !== "*") {
|
|
51
48
|
set("Vary", "Origin");
|
|
52
49
|
}
|
|
53
50
|
if (opts.maxAge != null) {
|
|
@@ -77,7 +74,7 @@ var cors = (options) => {
|
|
|
77
74
|
});
|
|
78
75
|
}
|
|
79
76
|
await next();
|
|
80
|
-
if (opts.origin !== "*"
|
|
77
|
+
if (opts.origin !== "*") {
|
|
81
78
|
c.header("Vary", "Origin", { append: true });
|
|
82
79
|
}
|
|
83
80
|
};
|
|
@@ -53,20 +53,12 @@ var normalizeLanguage = (lang, options) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
var detectFromQuery = (c, options) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return normalizeLanguage(query, options);
|
|
59
|
-
} catch {
|
|
60
|
-
return void 0;
|
|
61
|
-
}
|
|
56
|
+
const query = c.req.query(options.lookupQueryString);
|
|
57
|
+
return normalizeLanguage(query, options);
|
|
62
58
|
};
|
|
63
59
|
var detectFromCookie = (c, options) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return normalizeLanguage(cookie, options);
|
|
67
|
-
} catch {
|
|
68
|
-
return void 0;
|
|
69
|
-
}
|
|
60
|
+
const cookie = getCookie(c, options.lookupCookie);
|
|
61
|
+
return normalizeLanguage(cookie, options);
|
|
70
62
|
};
|
|
71
63
|
function detectFromHeader(c, options) {
|
|
72
64
|
try {
|
|
@@ -87,14 +79,10 @@ function detectFromHeader(c, options) {
|
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
function detectFromPath(c, options) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return normalizeLanguage(langSegment, options);
|
|
95
|
-
} catch {
|
|
96
|
-
return void 0;
|
|
97
|
-
}
|
|
82
|
+
const url = new URL(c.req.url);
|
|
83
|
+
const pathSegments = url.pathname.split("/").filter(Boolean);
|
|
84
|
+
const langSegment = pathSegments[options.lookupFromPathIndex];
|
|
85
|
+
return normalizeLanguage(langSegment, options);
|
|
98
86
|
}
|
|
99
87
|
var detectors = {
|
|
100
88
|
querystring: detectFromQuery,
|
|
@@ -129,9 +117,6 @@ var detectLanguage = (c, options) => {
|
|
|
129
117
|
let detectedLang;
|
|
130
118
|
for (const detectorName of options.order) {
|
|
131
119
|
const detector = detectors[detectorName];
|
|
132
|
-
if (!detector) {
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
120
|
try {
|
|
136
121
|
detectedLang = detector(c, options);
|
|
137
122
|
if (detectedLang) {
|
|
@@ -164,15 +149,8 @@ var languageDetector = (userOptions) => {
|
|
|
164
149
|
};
|
|
165
150
|
validateOptions(options);
|
|
166
151
|
return async function languageDetector2(ctx, next) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
ctx.set("language", lang);
|
|
170
|
-
} catch (error) {
|
|
171
|
-
if (options.debug) {
|
|
172
|
-
console.error("Language detection failed:", error);
|
|
173
|
-
}
|
|
174
|
-
ctx.set("language", options.fallbackLanguage);
|
|
175
|
-
}
|
|
152
|
+
const lang = detectLanguage(ctx, options);
|
|
153
|
+
ctx.set("language", lang);
|
|
176
154
|
await next();
|
|
177
155
|
};
|
|
178
156
|
};
|
|
@@ -24,7 +24,7 @@ var serveStatic = (options) => {
|
|
|
24
24
|
} else {
|
|
25
25
|
try {
|
|
26
26
|
filename = tryDecodeURI(c.req.path);
|
|
27
|
-
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}
|
|
27
|
+
if (/(?:^|[\/\\])\.{1,2}(?:$|[\/\\])|[\/\\]{2,}|\\/.test(filename)) {
|
|
28
28
|
throw new Error();
|
|
29
29
|
}
|
|
30
30
|
} catch {
|
|
@@ -31,7 +31,9 @@ var timing = (config) => {
|
|
|
31
31
|
endTime(c, "total");
|
|
32
32
|
}
|
|
33
33
|
if (options.autoEnd) {
|
|
34
|
-
timers.forEach((_, key) =>
|
|
34
|
+
timers.forEach((_, key) => {
|
|
35
|
+
endTime(c, key);
|
|
36
|
+
});
|
|
35
37
|
}
|
|
36
38
|
const enabled = typeof options.enabled === "function" ? options.enabled(c) : options.enabled;
|
|
37
39
|
if (enabled) {
|