@guren/server 1.5.0 → 2.0.0
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/dist/{AuthManager-C84xF5ks.d.ts → AuthManager-DBP4KYsx.d.ts} +1 -1
- package/dist/{ConsoleKernel-D0dkFt6u.d.ts → ConsoleKernel-DlK9j2Lu.d.ts} +1 -1
- package/dist/DocsViewerServiceProvider-D7RGJPGM.js +75 -0
- package/dist/{I18nManager-CmUqj6bU.d.ts → I18nManager-BiSoczfV.d.ts} +1 -1
- package/dist/McpServiceProvider-7BB5FPF3.js +8 -0
- package/dist/auth/index.d.ts +39 -29
- package/dist/auth/index.js +2 -2
- package/dist/broadcasting/index.js +2 -2
- package/dist/cache/index.js +2 -2
- package/dist/chunk-2V3YID4H.js +20 -0
- package/dist/{chunk-SHYRVOMJ.js → chunk-4DW4GRWF.js} +3 -3
- package/dist/chunk-AZOYI43J.js +18 -0
- package/dist/{chunk-DCYKSYAT.js → chunk-B5E5VBDI.js} +54 -2
- package/dist/{chunk-NYQGAWDN.js → chunk-BZMZEFRG.js} +7 -11
- package/dist/{chunk-4SBGSJNT.js → chunk-CWI4AJ47.js} +2 -1
- package/dist/{chunk-NQCZQAJL.js → chunk-DSDX3ASM.js} +21 -2
- package/dist/{chunk-MC752CQT.js → chunk-EI5GYMAT.js} +2 -1
- package/dist/{chunk-AUXQISW5.js → chunk-HONCNQXZ.js} +38 -5
- package/dist/{chunk-CSRQTEQA.js → chunk-HWEWL6TE.js} +6 -1
- package/dist/chunk-JBG4AR24.js +18 -0
- package/dist/{chunk-RNXTRWKL.js → chunk-K6CUBJX6.js} +9 -15
- package/dist/{chunk-Z3HXKWI6.js → chunk-KTNJG7R7.js} +4 -0
- package/dist/{chunk-74HTZG3V.js → chunk-LAJQCSSF.js} +24 -0
- package/dist/{chunk-H32L2NE3.js → chunk-LVJCZCAV.js} +20 -13
- package/dist/{chunk-5AD7LYWO.js → chunk-N7PLD7MB.js} +9 -8
- package/dist/{chunk-ONSDE37A.js → chunk-SFQP6O52.js} +1 -0
- package/dist/{chunk-XMQZENBP.js → chunk-TVY72CLV.js} +3 -1
- package/dist/chunk-WIXGT4TN.js +18 -0
- package/dist/{email-verification-H_WlpsVH.d.ts → email-verification-D8N7P6Pu.d.ts} +1 -1
- package/dist/encryption/index.js +2 -2
- package/dist/events/index.js +1 -1
- package/dist/i18n/index.d.ts +2 -2
- package/dist/index.d.ts +333 -333
- package/dist/index.js +186 -65
- package/dist/lambda/index.d.ts +5 -5
- package/dist/mail/index.js +3 -2
- package/dist/mcp/index.d.ts +14 -4
- package/dist/mcp/index.js +3 -2
- package/dist/notifications/index.d.ts +5 -5
- package/dist/notifications/index.js +3 -2
- package/dist/queue/index.d.ts +5 -5
- package/dist/queue/index.js +1 -1
- package/dist/redis/index.d.ts +4 -4
- package/dist/redis/index.js +7 -0
- package/dist/runtime/index.d.ts +5 -5
- package/dist/runtime/index.js +24 -9
- package/dist/scheduling/index.js +2 -2
- package/dist/storage/index.js +2 -1
- package/dist/{Application-Bi-olFMF.d.ts → validation-CDR7lRE8.d.ts} +749 -719
- package/package.json +3 -3
- package/dist/McpServiceProvider-TZWQWXCT.js +0 -7
- package/dist/{api-token-COQHXyM_.d.ts → api-token-D24VPr_E.d.ts} +101 -101
- package/dist/{client-BQwF2b9Y.d.ts → rate-limit-D9J2b4S1.d.ts} +36 -36
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
logDevServerBanner,
|
|
3
3
|
parseImportMap,
|
|
4
4
|
startViteDevServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4DW4GRWF.js";
|
|
6
6
|
import {
|
|
7
7
|
PendingSchedule,
|
|
8
8
|
Schedule,
|
|
@@ -16,14 +16,20 @@ import {
|
|
|
16
16
|
matchesCron,
|
|
17
17
|
parseCron,
|
|
18
18
|
toTimezone
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EI5GYMAT.js";
|
|
20
20
|
import {
|
|
21
21
|
LocalDriver,
|
|
22
22
|
MemoryDriver as MemoryDriver3,
|
|
23
23
|
S3Driver,
|
|
24
24
|
StorageManager,
|
|
25
25
|
createStorageManager
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-HWEWL6TE.js";
|
|
27
|
+
import {
|
|
28
|
+
trimSlashes
|
|
29
|
+
} from "./chunk-AZOYI43J.js";
|
|
30
|
+
import {
|
|
31
|
+
isDocsViewerEnabled
|
|
32
|
+
} from "./chunk-WIXGT4TN.js";
|
|
27
33
|
import {
|
|
28
34
|
I18nManager,
|
|
29
35
|
JsonLoader,
|
|
@@ -61,13 +67,15 @@ import {
|
|
|
61
67
|
getMailManager,
|
|
62
68
|
mail,
|
|
63
69
|
setMailManager
|
|
64
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-K6CUBJX6.js";
|
|
65
71
|
import {
|
|
66
72
|
MCP_ENDPOINT_PATH,
|
|
67
|
-
ProviderManager,
|
|
68
|
-
ServiceProvider,
|
|
69
73
|
isMcpEndpointEnabled
|
|
70
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-JBG4AR24.js";
|
|
75
|
+
import {
|
|
76
|
+
ProviderManager,
|
|
77
|
+
ServiceProvider
|
|
78
|
+
} from "./chunk-BZMZEFRG.js";
|
|
71
79
|
import {
|
|
72
80
|
DatabaseChannel,
|
|
73
81
|
MailChannel,
|
|
@@ -82,7 +90,8 @@ import {
|
|
|
82
90
|
registerNotification,
|
|
83
91
|
resolveNotifiableType,
|
|
84
92
|
setNotificationManager
|
|
85
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-N7PLD7MB.js";
|
|
94
|
+
import "./chunk-2V3YID4H.js";
|
|
86
95
|
import {
|
|
87
96
|
FailedJobReporter,
|
|
88
97
|
MemoryDriver,
|
|
@@ -94,7 +103,7 @@ import {
|
|
|
94
103
|
createQueueManager,
|
|
95
104
|
createSqsAdapter,
|
|
96
105
|
processJob
|
|
97
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-KTNJG7R7.js";
|
|
98
107
|
import {
|
|
99
108
|
Container,
|
|
100
109
|
Job,
|
|
@@ -169,7 +178,7 @@ import {
|
|
|
169
178
|
verifyEmailToken,
|
|
170
179
|
verifyOAuthState,
|
|
171
180
|
verifyPasswordResetToken
|
|
172
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-HONCNQXZ.js";
|
|
173
182
|
import {
|
|
174
183
|
Gate,
|
|
175
184
|
Policy,
|
|
@@ -219,7 +228,7 @@ import {
|
|
|
219
228
|
getBroadcastManager,
|
|
220
229
|
parseRequestPayload,
|
|
221
230
|
setBroadcastManager
|
|
222
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-TVY72CLV.js";
|
|
223
232
|
import {
|
|
224
233
|
CacheManager,
|
|
225
234
|
FileStore,
|
|
@@ -227,11 +236,12 @@ import {
|
|
|
227
236
|
RedisStore,
|
|
228
237
|
TaggedCache,
|
|
229
238
|
createCacheManager
|
|
230
|
-
} from "./chunk-
|
|
239
|
+
} from "./chunk-CWI4AJ47.js";
|
|
231
240
|
import {
|
|
232
241
|
claimHotDisposable,
|
|
233
|
-
isHotReloadRuntime
|
|
234
|
-
|
|
242
|
+
isHotReloadRuntime,
|
|
243
|
+
matchingOpenParen
|
|
244
|
+
} from "./chunk-B5E5VBDI.js";
|
|
235
245
|
import {
|
|
236
246
|
Encrypter,
|
|
237
247
|
createEncrypter,
|
|
@@ -256,7 +266,7 @@ import {
|
|
|
256
266
|
urlSafeToken,
|
|
257
267
|
uuid,
|
|
258
268
|
verifySignedUrl
|
|
259
|
-
} from "./chunk-
|
|
269
|
+
} from "./chunk-LVJCZCAV.js";
|
|
260
270
|
import {
|
|
261
271
|
MessageSigner,
|
|
262
272
|
deriveAppKey,
|
|
@@ -267,7 +277,7 @@ import {
|
|
|
267
277
|
normalizeAppKey,
|
|
268
278
|
parseAppKey,
|
|
269
279
|
parsePreviousAppKeys
|
|
270
|
-
} from "./chunk-
|
|
280
|
+
} from "./chunk-SFQP6O52.js";
|
|
271
281
|
import {
|
|
272
282
|
check,
|
|
273
283
|
hash,
|
|
@@ -294,7 +304,7 @@ import {
|
|
|
294
304
|
UserAuthenticated,
|
|
295
305
|
UserLoggedOut,
|
|
296
306
|
createEventManager
|
|
297
|
-
} from "./chunk-
|
|
307
|
+
} from "./chunk-LAJQCSSF.js";
|
|
298
308
|
import {
|
|
299
309
|
CacheCheck,
|
|
300
310
|
CustomCheck,
|
|
@@ -378,6 +388,17 @@ function mountRoute(app, method, path, ...handlers) {
|
|
|
378
388
|
app.on(method, path, ...handlers);
|
|
379
389
|
}
|
|
380
390
|
|
|
391
|
+
// src/http/middleware/capabilities.ts
|
|
392
|
+
var CAPABILITIES = /* @__PURE__ */ Symbol.for("guren.capabilities");
|
|
393
|
+
function stampCapabilities(handler, capabilities) {
|
|
394
|
+
Object.defineProperty(handler, CAPABILITIES, { value: capabilities, enumerable: false });
|
|
395
|
+
return handler;
|
|
396
|
+
}
|
|
397
|
+
function capabilitiesOf(handler) {
|
|
398
|
+
if (typeof handler !== "function") return void 0;
|
|
399
|
+
return handler[CAPABILITIES];
|
|
400
|
+
}
|
|
401
|
+
|
|
381
402
|
// src/mvc/Router.ts
|
|
382
403
|
var RESOURCE_ACTIONS = [
|
|
383
404
|
{ method: "index", suffix: "", httpMethod: "get" },
|
|
@@ -504,6 +525,7 @@ var Router = class {
|
|
|
504
525
|
schemas,
|
|
505
526
|
middlewareNames: [...routeMiddlewareNames],
|
|
506
527
|
hasInlineMiddleware: middlewares.length > 0,
|
|
528
|
+
capabilities: this.aggregateCapabilities(routeMiddlewareNames, middlewares),
|
|
507
529
|
controller: isControllerAction(handler) ? { name: handler[0].name, action: String(handler[1]) } : void 0,
|
|
508
530
|
bindings: serializeBindings(path, bindings, this.modelBindingNames),
|
|
509
531
|
...openapi
|
|
@@ -556,6 +578,37 @@ var Router = class {
|
|
|
556
578
|
this.registry.push(route);
|
|
557
579
|
return createRouteBuilder(route, this.namedRoutes);
|
|
558
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* Security capabilities present on a route's middleware chain, aggregated
|
|
583
|
+
* across named aliases (group-expanded) and inline handlers. Unlike
|
|
584
|
+
* `resolveMiddlewareNames`, unregistered names are skipped rather than
|
|
585
|
+
* thrown: `definitions()` must stay side-effect-free for introspection of
|
|
586
|
+
* routers that never mount (audit, codegen), and an unresolvable alias
|
|
587
|
+
* simply contributes no capabilities.
|
|
588
|
+
*/
|
|
589
|
+
aggregateCapabilities(names, inline, seen) {
|
|
590
|
+
const aggregated = {};
|
|
591
|
+
const visited = seen ?? /* @__PURE__ */ new Set();
|
|
592
|
+
const absorb = (capabilities) => {
|
|
593
|
+
const auth = capabilities?.authentication;
|
|
594
|
+
if (!auth) return;
|
|
595
|
+
if (!aggregated.authentication || auth.mode === "required") {
|
|
596
|
+
aggregated.authentication = auth;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
for (const name of names) {
|
|
600
|
+
if (visited.has(name)) continue;
|
|
601
|
+
visited.add(name);
|
|
602
|
+
const groupNames = this.middlewareGroups.get(name);
|
|
603
|
+
if (groupNames) {
|
|
604
|
+
absorb(this.aggregateCapabilities(groupNames, [], visited));
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
absorb(capabilitiesOf(this.middlewareAliases.get(name)));
|
|
608
|
+
}
|
|
609
|
+
for (const handler of inline) absorb(capabilitiesOf(handler));
|
|
610
|
+
return aggregated;
|
|
611
|
+
}
|
|
559
612
|
resolveMiddlewareNames(names, seen) {
|
|
560
613
|
const handlers = [];
|
|
561
614
|
const visited = seen ?? /* @__PURE__ */ new Set();
|
|
@@ -598,6 +651,8 @@ var RouterMiddlewareGroupBuilder = class {
|
|
|
598
651
|
this.router = router;
|
|
599
652
|
this.names = names;
|
|
600
653
|
}
|
|
654
|
+
router;
|
|
655
|
+
names;
|
|
601
656
|
group(callback) {
|
|
602
657
|
return this.router.applyMiddlewareScope(this.names, () => {
|
|
603
658
|
callback(this.router);
|
|
@@ -665,30 +720,41 @@ function createContractHandler(path, options, handler) {
|
|
|
665
720
|
if (!options.output) {
|
|
666
721
|
return result;
|
|
667
722
|
}
|
|
723
|
+
let outputValue = result;
|
|
724
|
+
let sourceBody;
|
|
668
725
|
if (result instanceof Response) {
|
|
669
726
|
try {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
throw new Error(
|
|
675
|
-
`Route output validation failed for ${options.name ?? path}: ${JSON.stringify(formatValidationErrors(output2.error))}`
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
|
-
} catch (err) {
|
|
679
|
-
if (err instanceof Error && err.message.includes("output validation failed")) throw err;
|
|
727
|
+
sourceBody = await result.clone().text();
|
|
728
|
+
outputValue = JSON.parse(sourceBody);
|
|
729
|
+
} catch {
|
|
730
|
+
return result;
|
|
680
731
|
}
|
|
681
|
-
return result;
|
|
682
732
|
}
|
|
683
|
-
const output = options.output.safeParse(
|
|
684
|
-
if (output.success) {
|
|
733
|
+
const output = options.output.safeParse(outputValue);
|
|
734
|
+
if (!output.success) {
|
|
735
|
+
throw new Error(
|
|
736
|
+
`Route output validation failed for ${options.name ?? path}: ${JSON.stringify(formatValidationErrors(output.error))}`
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
if (!(result instanceof Response)) {
|
|
685
740
|
return output.data;
|
|
686
741
|
}
|
|
687
|
-
|
|
688
|
-
`Route output validation failed for ${options.name ?? path}: ${JSON.stringify(formatValidationErrors(output.error))}`
|
|
689
|
-
);
|
|
742
|
+
return rebuildJsonResponse(result, sourceBody, output.data) ?? result;
|
|
690
743
|
};
|
|
691
744
|
}
|
|
745
|
+
function rebuildJsonResponse(source, sourceBody, data) {
|
|
746
|
+
const body = JSON.stringify(data);
|
|
747
|
+
if (body === sourceBody) {
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
const headers = new Headers(source.headers);
|
|
751
|
+
dropStaleBodyHeaders(headers);
|
|
752
|
+
return new Response(body, { status: source.status, headers });
|
|
753
|
+
}
|
|
754
|
+
function dropStaleBodyHeaders(headers) {
|
|
755
|
+
headers.delete("content-length");
|
|
756
|
+
headers.delete("etag");
|
|
757
|
+
}
|
|
692
758
|
function parseRouteSegment(schema, data, status) {
|
|
693
759
|
if (!schema) {
|
|
694
760
|
return data;
|
|
@@ -733,15 +799,24 @@ function createContractValidationMiddleware(route) {
|
|
|
733
799
|
}
|
|
734
800
|
await next();
|
|
735
801
|
if (schemas.output && c.res) {
|
|
802
|
+
let sourceBody;
|
|
803
|
+
let parsedBody;
|
|
736
804
|
try {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
const parsed = schemas.output.safeParse(body);
|
|
740
|
-
if (!parsed.success) {
|
|
741
|
-
const errors = "flatten" in parsed.error && typeof parsed.error.flatten === "function" ? parsed.error.flatten() : parsed.error;
|
|
742
|
-
c.res = c.json({ message: "Response validation failed", errors }, 500);
|
|
743
|
-
}
|
|
805
|
+
sourceBody = await c.res.clone().text();
|
|
806
|
+
parsedBody = JSON.parse(sourceBody);
|
|
744
807
|
} catch {
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
const parsed = schemas.output.safeParse(parsedBody);
|
|
811
|
+
if (!parsed.success) {
|
|
812
|
+
const errors = "flatten" in parsed.error && typeof parsed.error.flatten === "function" ? parsed.error.flatten() : parsed.error;
|
|
813
|
+
c.res = c.json({ message: "Response validation failed", errors }, 500);
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
const rebuilt = rebuildJsonResponse(c.res, sourceBody, parsed.data);
|
|
817
|
+
if (rebuilt) {
|
|
818
|
+
c.res = rebuilt;
|
|
819
|
+
dropStaleBodyHeaders(c.res.headers);
|
|
745
820
|
}
|
|
746
821
|
}
|
|
747
822
|
};
|
|
@@ -855,7 +930,7 @@ function isRouteContractOptions(value) {
|
|
|
855
930
|
return "params" in value || "query" in value || "body" in value || "output" in value || "bind" in value || "name" in value || "middlewares" in value || "summary" in value || "description" in value || "tags" in value || "operationId" in value || "deprecated" in value;
|
|
856
931
|
}
|
|
857
932
|
function joinPaths(prefixStack, path) {
|
|
858
|
-
const segments = [...prefixStack, path].filter(Boolean).map(
|
|
933
|
+
const segments = [...prefixStack, path].filter(Boolean).map(trimSlashes).filter(Boolean);
|
|
859
934
|
if (segments.length === 0) {
|
|
860
935
|
return "/";
|
|
861
936
|
}
|
|
@@ -1800,7 +1875,7 @@ function resolveAuth(ctx) {
|
|
|
1800
1875
|
}
|
|
1801
1876
|
function requireAuthenticated(options = {}) {
|
|
1802
1877
|
const { redirectTo, status = 401, responseFactory } = options;
|
|
1803
|
-
return async (ctx, next) => {
|
|
1878
|
+
return stampCapabilities(async (ctx, next) => {
|
|
1804
1879
|
const auth = resolveAuth(ctx);
|
|
1805
1880
|
if (!auth) {
|
|
1806
1881
|
throw new Error("Auth context has not been attached. Did you register the auth middleware?");
|
|
@@ -1815,11 +1890,11 @@ function requireAuthenticated(options = {}) {
|
|
|
1815
1890
|
return jsonResponse({ message: "Unauthorized" }, status);
|
|
1816
1891
|
}
|
|
1817
1892
|
await next();
|
|
1818
|
-
};
|
|
1893
|
+
}, { authentication: { mode: "required" } });
|
|
1819
1894
|
}
|
|
1820
1895
|
function requireGuest(options = {}) {
|
|
1821
1896
|
const { redirectTo, status = 403, responseFactory } = options;
|
|
1822
|
-
return async (ctx, next) => {
|
|
1897
|
+
return stampCapabilities(async (ctx, next) => {
|
|
1823
1898
|
const auth = resolveAuth(ctx);
|
|
1824
1899
|
if (!auth) {
|
|
1825
1900
|
throw new Error("Auth context has not been attached. Did you register the auth middleware?");
|
|
@@ -1834,7 +1909,7 @@ function requireGuest(options = {}) {
|
|
|
1834
1909
|
return jsonResponse({ message: "Already authenticated" }, status);
|
|
1835
1910
|
}
|
|
1836
1911
|
await next();
|
|
1837
|
-
};
|
|
1912
|
+
}, { authentication: { mode: "guest-only" } });
|
|
1838
1913
|
}
|
|
1839
1914
|
|
|
1840
1915
|
// src/providers/AuthServiceProvider.ts
|
|
@@ -2416,6 +2491,7 @@ var Application = class {
|
|
|
2416
2491
|
this.providerManager.register(InertiaServiceProvider);
|
|
2417
2492
|
}
|
|
2418
2493
|
}
|
|
2494
|
+
options;
|
|
2419
2495
|
hono;
|
|
2420
2496
|
container;
|
|
2421
2497
|
router;
|
|
@@ -2468,7 +2544,16 @@ var Application = class {
|
|
|
2468
2544
|
await this.providerManager.registerAll();
|
|
2469
2545
|
await this.options.boot?.(this.hono);
|
|
2470
2546
|
await this.mountRoutes();
|
|
2471
|
-
await this.
|
|
2547
|
+
await this.mountDevEndpoint(
|
|
2548
|
+
isMcpEndpointEnabled(),
|
|
2549
|
+
async () => (await import("./McpServiceProvider-7BB5FPF3.js")).McpServiceProvider,
|
|
2550
|
+
"GUREN_MCP=1 but the MCP endpoint could not load \u2014 is @modelcontextprotocol/sdk installed?"
|
|
2551
|
+
);
|
|
2552
|
+
await this.mountDevEndpoint(
|
|
2553
|
+
isDocsViewerEnabled(),
|
|
2554
|
+
async () => (await import("./DocsViewerServiceProvider-D7RGJPGM.js")).DocsViewerServiceProvider,
|
|
2555
|
+
"GUREN_DOCS=1 but the docs viewer could not load \u2014 is @guren/cli resolvable from this app?"
|
|
2556
|
+
);
|
|
2472
2557
|
await this.providerManager.bootAll();
|
|
2473
2558
|
}
|
|
2474
2559
|
/**
|
|
@@ -2487,20 +2572,27 @@ var Application = class {
|
|
|
2487
2572
|
this.hono.use("*", createHostAuthorizationMiddleware(hostAuthorization));
|
|
2488
2573
|
}
|
|
2489
2574
|
/**
|
|
2490
|
-
* Mounts
|
|
2491
|
-
*
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2575
|
+
* Mounts an opt-in, dev-only framework endpoint: the MCP endpoint
|
|
2576
|
+
* (/_guren/mcp) and the docs viewer (/_guren/docs) both work this way.
|
|
2577
|
+
*
|
|
2578
|
+
* Only the dynamic import is allowed to fail silently — these
|
|
2579
|
+
* providers reach optional dependencies (the MCP SDK, @guren/cli) that
|
|
2580
|
+
* an app need not have installed, and `missing` names that case. A
|
|
2581
|
+
* failure inside the provider's own boot is a real problem and is
|
|
2582
|
+
* rethrown, rather than leaving the developer with a silent 404.
|
|
2583
|
+
*/
|
|
2584
|
+
async mountDevEndpoint(enabled, load, missing) {
|
|
2585
|
+
if (!enabled) return;
|
|
2586
|
+
let provider;
|
|
2497
2587
|
try {
|
|
2498
|
-
const
|
|
2499
|
-
|
|
2500
|
-
provider.register();
|
|
2501
|
-
await provider.boot();
|
|
2588
|
+
const Provider = await load();
|
|
2589
|
+
provider = new Provider(this.container);
|
|
2502
2590
|
} catch {
|
|
2591
|
+
console.warn(`[guren] ${missing}`);
|
|
2592
|
+
return;
|
|
2503
2593
|
}
|
|
2594
|
+
provider.register?.();
|
|
2595
|
+
await provider.boot?.();
|
|
2504
2596
|
}
|
|
2505
2597
|
/**
|
|
2506
2598
|
* Fetch handler to integrate with Bun.serve or any standard Fetch runtime.
|
|
@@ -3180,6 +3272,7 @@ var FieldValidator = class {
|
|
|
3180
3272
|
constructor(field) {
|
|
3181
3273
|
this.field = field;
|
|
3182
3274
|
}
|
|
3275
|
+
field;
|
|
3183
3276
|
_rules = [];
|
|
3184
3277
|
isNullable = false;
|
|
3185
3278
|
isSometimes = false;
|
|
@@ -3570,13 +3663,23 @@ function email() {
|
|
|
3570
3663
|
if (typeof value !== "string") {
|
|
3571
3664
|
return "The :attribute must be a valid email address.";
|
|
3572
3665
|
}
|
|
3573
|
-
|
|
3574
|
-
if (!emailRegex.test(value)) {
|
|
3666
|
+
if (!isPlausibleEmail(value)) {
|
|
3575
3667
|
return "The :attribute must be a valid email address.";
|
|
3576
3668
|
}
|
|
3577
3669
|
return true;
|
|
3578
3670
|
};
|
|
3579
3671
|
}
|
|
3672
|
+
function isPlausibleEmail(value) {
|
|
3673
|
+
const at = value.indexOf("@");
|
|
3674
|
+
if (at <= 0 || value.indexOf("@", at + 1) !== -1) {
|
|
3675
|
+
return false;
|
|
3676
|
+
}
|
|
3677
|
+
if (/\s/u.test(value)) {
|
|
3678
|
+
return false;
|
|
3679
|
+
}
|
|
3680
|
+
const domain = value.slice(at + 1);
|
|
3681
|
+
return domain.slice(1, -1).includes(".");
|
|
3682
|
+
}
|
|
3580
3683
|
function url() {
|
|
3581
3684
|
return (value) => {
|
|
3582
3685
|
if (value === void 0 || value === null || value === "") return true;
|
|
@@ -6452,16 +6555,34 @@ function debugErrorMiddleware() {
|
|
|
6452
6555
|
}
|
|
6453
6556
|
};
|
|
6454
6557
|
}
|
|
6558
|
+
function splitLocation(location) {
|
|
6559
|
+
const lastColon = location.lastIndexOf(":");
|
|
6560
|
+
if (lastColon <= 0) return null;
|
|
6561
|
+
const prevColon = location.lastIndexOf(":", lastColon - 1);
|
|
6562
|
+
if (prevColon <= 0) return null;
|
|
6563
|
+
const line = location.slice(prevColon + 1, lastColon);
|
|
6564
|
+
const col = location.slice(lastColon + 1);
|
|
6565
|
+
if (!/^\d+$/.test(line) || !/^\d+$/.test(col)) return null;
|
|
6566
|
+
return { file: location.slice(0, prevColon), line, col };
|
|
6567
|
+
}
|
|
6455
6568
|
function parseStackTrace(stack) {
|
|
6456
6569
|
const lines = stack.split("\n").slice(1);
|
|
6457
6570
|
return lines.map((line) => {
|
|
6458
|
-
const
|
|
6459
|
-
if (
|
|
6460
|
-
|
|
6571
|
+
const trimmed = line.trim();
|
|
6572
|
+
if (!/^at\s/u.test(trimmed)) return null;
|
|
6573
|
+
const rest = trimmed.slice(2).trim();
|
|
6574
|
+
if (rest.endsWith(")")) {
|
|
6575
|
+
const open = matchingOpenParen(rest, rest.length - 1);
|
|
6576
|
+
if (open !== void 0 && open > 0) {
|
|
6577
|
+
const location2 = splitLocation(rest.slice(open + 1, -1));
|
|
6578
|
+
if (location2) {
|
|
6579
|
+
return { func: rest.slice(0, open).trim(), ...location2 };
|
|
6580
|
+
}
|
|
6581
|
+
}
|
|
6461
6582
|
}
|
|
6462
|
-
const
|
|
6463
|
-
if (
|
|
6464
|
-
return { func: "<anonymous>",
|
|
6583
|
+
const location = splitLocation(rest);
|
|
6584
|
+
if (location) {
|
|
6585
|
+
return { func: "<anonymous>", ...location };
|
|
6465
6586
|
}
|
|
6466
6587
|
return null;
|
|
6467
6588
|
}).filter((frame) => frame !== null);
|
package/dist/lambda/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as hono_aws_lambda from 'hono/aws-lambda';
|
|
2
2
|
export { APIGatewayProxyResult, LambdaEvent } from 'hono/aws-lambda';
|
|
3
|
-
import { A as Application } from '../
|
|
3
|
+
import { A as Application } from '../validation-CDR7lRE8.js';
|
|
4
4
|
import { S as Scheduler } from '../Scheduler-pZiT8i57.js';
|
|
5
|
-
import { C as ConsoleKernel } from '../ConsoleKernel-
|
|
5
|
+
import { C as ConsoleKernel } from '../ConsoleKernel-DlK9j2Lu.js';
|
|
6
6
|
import 'hono';
|
|
7
|
-
import '../api-token-
|
|
8
|
-
import '../AuthManager-
|
|
7
|
+
import '../api-token-D24VPr_E.js';
|
|
8
|
+
import '../AuthManager-DBP4KYsx.js';
|
|
9
9
|
import '@guren/orm';
|
|
10
10
|
import 'vite';
|
|
11
11
|
import '../EventManager-CmIoLt7r.js';
|
|
12
12
|
import '../CacheManager-BmDzUKrF.js';
|
|
13
13
|
import '../MailManager-DpMvYiP9.js';
|
|
14
14
|
import '../LogManager-7mxnkaPM.js';
|
|
15
|
-
import '../I18nManager-
|
|
15
|
+
import '../I18nManager-BiSoczfV.js';
|
|
16
16
|
import '../BroadcastManager-D8KoJxiV.js';
|
|
17
17
|
import '../index-9_Jzj5jo.js';
|
|
18
18
|
import '../app-key-CsBfRC_Q.js';
|
package/dist/mail/index.js
CHANGED
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
getMailManager,
|
|
10
10
|
mail,
|
|
11
11
|
setMailManager
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-K6CUBJX6.js";
|
|
13
|
+
import "../chunk-2V3YID4H.js";
|
|
14
|
+
import "../chunk-KTNJG7R7.js";
|
|
14
15
|
import "../chunk-6J6B5KOB.js";
|
|
15
16
|
export {
|
|
16
17
|
LogTransport,
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { S as ServiceProvider } from '../
|
|
2
|
+
import { S as ServiceProvider } from '../validation-CDR7lRE8.js';
|
|
3
3
|
import 'hono';
|
|
4
|
-
import '../api-token-
|
|
5
|
-
import '../AuthManager-
|
|
4
|
+
import '../api-token-D24VPr_E.js';
|
|
5
|
+
import '../AuthManager-DBP4KYsx.js';
|
|
6
6
|
import '@guren/orm';
|
|
7
7
|
import 'vite';
|
|
8
8
|
import '../EventManager-CmIoLt7r.js';
|
|
9
9
|
import '../CacheManager-BmDzUKrF.js';
|
|
10
10
|
import '../MailManager-DpMvYiP9.js';
|
|
11
11
|
import '../LogManager-7mxnkaPM.js';
|
|
12
|
-
import '../I18nManager-
|
|
12
|
+
import '../I18nManager-BiSoczfV.js';
|
|
13
13
|
import '../BroadcastManager-D8KoJxiV.js';
|
|
14
14
|
import '../index-9_Jzj5jo.js';
|
|
15
15
|
import '../app-key-CsBfRC_Q.js';
|
|
@@ -147,6 +147,16 @@ interface GurenCliApi {
|
|
|
147
147
|
* runtime and may predate it — see `McpServiceProvider`.
|
|
148
148
|
*/
|
|
149
149
|
createFreshContextApi?: () => Pick<GurenCliApi, 'generateContext' | 'generateEntityContext'>;
|
|
150
|
+
/**
|
|
151
|
+
* The OKF docs relation graph (RFC 0005). Optional for the same
|
|
152
|
+
* runtime-resolution reason as above.
|
|
153
|
+
*/
|
|
154
|
+
buildDocsGraphReport?(options: {
|
|
155
|
+
cwd?: string;
|
|
156
|
+
entity?: string;
|
|
157
|
+
path?: string;
|
|
158
|
+
}): Promise<unknown>;
|
|
159
|
+
renderDocsGraphMarkdown?(report: unknown): string;
|
|
150
160
|
}
|
|
151
161
|
interface CreateMcpServerOptions {
|
|
152
162
|
cwd: string;
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
McpServiceProvider,
|
|
3
3
|
createMcpServer
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-DSDX3ASM.js";
|
|
5
|
+
import "../chunk-JBG4AR24.js";
|
|
6
|
+
import "../chunk-BZMZEFRG.js";
|
|
6
7
|
export {
|
|
7
8
|
McpServiceProvider,
|
|
8
9
|
createMcpServer
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ab as Notification, aa as Notifiable, ad as NotificationChannel, B as DatabaseNotification, z as DatabaseChannelOptions, aJ as SlackMessage, aA as SentNotification } from '../
|
|
2
|
-
export { ac as NotificationAttachment, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, N as NotificationManager, ah as NotificationManagerOptions, aH as SlackAttachment, aI as SlackBlock, aX as createNotificationManager, b6 as getNotificationManager, bl as setNotificationManager } from '../
|
|
1
|
+
import { ab as Notification, aa as Notifiable, ad as NotificationChannel, B as DatabaseNotification, z as DatabaseChannelOptions, aJ as SlackMessage, aA as SentNotification } from '../validation-CDR7lRE8.js';
|
|
2
|
+
export { ac as NotificationAttachment, ae as NotificationChannelFactory, af as NotificationClass, ag as NotificationMailMessage, N as NotificationManager, ah as NotificationManagerOptions, aH as SlackAttachment, aI as SlackBlock, aX as createNotificationManager, b6 as getNotificationManager, bl as setNotificationManager } from '../validation-CDR7lRE8.js';
|
|
3
3
|
import { M as MailManager } from '../MailManager-DpMvYiP9.js';
|
|
4
4
|
import 'hono';
|
|
5
|
-
import '../api-token-
|
|
6
|
-
import '../AuthManager-
|
|
5
|
+
import '../api-token-D24VPr_E.js';
|
|
6
|
+
import '../AuthManager-DBP4KYsx.js';
|
|
7
7
|
import '@guren/orm';
|
|
8
8
|
import 'vite';
|
|
9
9
|
import '../EventManager-CmIoLt7r.js';
|
|
10
10
|
import '../CacheManager-BmDzUKrF.js';
|
|
11
11
|
import '../LogManager-7mxnkaPM.js';
|
|
12
|
-
import '../I18nManager-
|
|
12
|
+
import '../I18nManager-BiSoczfV.js';
|
|
13
13
|
import '../BroadcastManager-D8KoJxiV.js';
|
|
14
14
|
import '../index-9_Jzj5jo.js';
|
|
15
15
|
import '../app-key-CsBfRC_Q.js';
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
registerNotification,
|
|
13
13
|
resolveNotifiableType,
|
|
14
14
|
setNotificationManager
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-
|
|
15
|
+
} from "../chunk-N7PLD7MB.js";
|
|
16
|
+
import "../chunk-2V3YID4H.js";
|
|
17
|
+
import "../chunk-KTNJG7R7.js";
|
|
17
18
|
import "../chunk-6J6B5KOB.js";
|
|
18
19
|
export {
|
|
19
20
|
DatabaseChannel,
|
package/dist/queue/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { am as QueueDriver, ao as QueuedJob, M as FailedJob, aN as WorkerOptions } from '../
|
|
2
|
-
export { a4 as Job, a5 as JobClass, a6 as JobFailureHandler, a7 as JobHandler, a8 as JobOptions, al as QueueConfig, an as QueueDriverFactory, Q as QueueManager, aR as clearJobRegistry, aY as createQueueManager, b5 as getJob, b7 as getQueueDriver, b8 as getRegisteredJobs, bd as registerJob, bf as resolveJobName, bm as setQueueDriver } from '../
|
|
1
|
+
import { am as QueueDriver, ao as QueuedJob, M as FailedJob, aN as WorkerOptions } from '../validation-CDR7lRE8.js';
|
|
2
|
+
export { a4 as Job, a5 as JobClass, a6 as JobFailureHandler, a7 as JobHandler, a8 as JobOptions, al as QueueConfig, an as QueueDriverFactory, Q as QueueManager, aR as clearJobRegistry, aY as createQueueManager, b5 as getJob, b7 as getQueueDriver, b8 as getRegisteredJobs, bd as registerJob, bf as resolveJobName, bm as setQueueDriver } from '../validation-CDR7lRE8.js';
|
|
3
3
|
import { Redis } from 'ioredis';
|
|
4
4
|
import 'hono';
|
|
5
|
-
import '../api-token-
|
|
6
|
-
import '../AuthManager-
|
|
5
|
+
import '../api-token-D24VPr_E.js';
|
|
6
|
+
import '../AuthManager-DBP4KYsx.js';
|
|
7
7
|
import '@guren/orm';
|
|
8
8
|
import 'vite';
|
|
9
9
|
import '../EventManager-CmIoLt7r.js';
|
|
10
10
|
import '../CacheManager-BmDzUKrF.js';
|
|
11
11
|
import '../MailManager-DpMvYiP9.js';
|
|
12
12
|
import '../LogManager-7mxnkaPM.js';
|
|
13
|
-
import '../I18nManager-
|
|
13
|
+
import '../I18nManager-BiSoczfV.js';
|
|
14
14
|
import '../BroadcastManager-D8KoJxiV.js';
|
|
15
15
|
import '../index-9_Jzj5jo.js';
|
|
16
16
|
import '../app-key-CsBfRC_Q.js';
|
package/dist/queue/index.js
CHANGED
package/dist/redis/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { R as RateLimitStore, a as RateLimitEntry } from '../
|
|
2
|
-
export { b as RedisClientOptions, c as createRedisClient } from '../
|
|
1
|
+
import { R as RateLimitStore, a as RateLimitEntry } from '../rate-limit-D9J2b4S1.js';
|
|
2
|
+
export { b as RedisClientOptions, c as createRedisClient } from '../rate-limit-D9J2b4S1.js';
|
|
3
3
|
import { Redis } from 'ioredis';
|
|
4
4
|
export { default as Redis, RedisOptions } from 'ioredis';
|
|
5
|
-
import { S as SessionStore, h as SessionData, i as ApiTokenStore, j as ApiToken, O as OAuthStateStore, k as OAuthStatePayload } from '../api-token-
|
|
6
|
-
import { P as PasswordResetTokenStore, E as EmailVerificationTokenStore, a as EmailVerificationToken } from '../email-verification-
|
|
5
|
+
import { S as SessionStore, h as SessionData, i as ApiTokenStore, j as ApiToken, O as OAuthStateStore, k as OAuthStatePayload } from '../api-token-D24VPr_E.js';
|
|
6
|
+
import { P as PasswordResetTokenStore, E as EmailVerificationTokenStore, a as EmailVerificationToken } from '../email-verification-D8N7P6Pu.js';
|
|
7
7
|
import 'hono';
|
|
8
8
|
|
|
9
9
|
/**
|