@guren/server 2.25.1 → 2.27.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/{DocsViewerServiceProvider-CIRNHQ2I.js → DocsViewerServiceProvider-BMbcTYVw.js} +1 -1
- package/dist/{Gate-YOt54xGF.js → Gate-BL_zW82W.js} +1 -1
- package/dist/{Job-COMzBNOL.js → Job-DsFMcXVk.js} +35 -3
- package/dist/{McpServiceProvider-B-LioPSz.js → McpServiceProvider-PGFPlYTy.js} +1 -1
- package/dist/{Resource-BdYd4J9a.js → Resource-q3tJpJ0K.js} +194 -54
- package/dist/{ServiceProvider-DDW3MqQJ.js → ServiceProvider-G0YclITd.js} +60 -8
- package/dist/agent/dispatch.d.ts +4 -4
- package/dist/agent/public.js +1 -1
- package/dist/agent/scopes.d.ts +1 -3
- package/dist/agent-request-Caj6bnbj.js +18 -0
- package/dist/auth/AuthManager.d.ts +4 -0
- package/dist/auth/email-verification.d.ts +8 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/password/describe-hasher.d.ts +11 -0
- package/dist/auth/password-reset.d.ts +8 -2
- package/dist/{auth-vFeem6uM.js → auth-DIugW0O-.js} +108 -13
- package/dist/authorization/index.js +2 -2
- package/dist/authorization/middleware.d.ts +8 -0
- package/dist/{authorization-BLhwA2Yh.js → authorization-Daa6CxCg.js} +17 -2
- package/dist/broadcasting/BroadcastManager.d.ts +23 -6
- package/dist/broadcasting/index.d.ts +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/types.d.ts +13 -1
- package/dist/{broadcasting-BUBCPCnu.js → broadcasting-N4cRV42s.js} +205 -34
- package/dist/cache/CacheManager.d.ts +5 -0
- package/dist/cache/TaggedCache.d.ts +2 -0
- package/dist/cache/index.js +1 -1
- package/dist/cache/pending-computations.d.ts +22 -0
- package/dist/cache/stores/FileStore.d.ts +2 -0
- package/dist/cache/stores/MemoryStore.d.ts +1 -0
- package/dist/cache/stores/RedisStore.d.ts +1 -0
- package/dist/cache/stores/file-lock.d.ts +1 -0
- package/dist/cache/types.d.ts +2 -0
- package/dist/{cache-93n2PCnB.js → cache-BlXopnH1.js} +247 -38
- package/dist/contained-path-BkNSBljW.js +78 -0
- package/dist/container/Container.d.ts +6 -2
- package/dist/container/ServiceProvider.d.ts +27 -2
- package/dist/container/defineModule.d.ts +14 -5
- package/dist/container/definePlugin.d.ts +2 -0
- package/dist/{default-application-D5ezhhiV.js → default-application-DWwscxfW.js} +14 -18
- package/dist/dev-banner-CfQDnkfQ.js +51 -0
- package/dist/{dispatch-BAwzftws.js → dispatch-ENWpBxbE.js} +26 -4
- package/dist/driver-map-CkQc52j-.js +12 -0
- package/dist/encryption/index.js +1 -1
- package/dist/{encryption-D1dxfMqD.js → encryption-CWK5l22W.js} +1 -1
- package/dist/events/EventManager.d.ts +2 -0
- package/dist/events/index.js +1 -1
- package/dist/{events-c94CdUFc.js → events-DQavGm8W.js} +20 -7
- package/dist/health/HealthManager.d.ts +0 -1
- package/dist/health/index.js +1 -1
- package/dist/{health-CB0oS_UE.js → health-Bg0Xj3aD.js} +8 -8
- package/dist/host-port-t6wQFaRu.js +15 -0
- package/dist/hot-reload/testing.d.ts +2 -1
- package/dist/http/Application.d.ts +31 -2
- package/dist/http/dev-banner.d.ts +0 -8
- package/dist/http/host-port.d.ts +8 -0
- package/dist/http/middleware/force-https.d.ts +2 -1
- package/dist/http/middleware/index.d.ts +1 -0
- package/dist/http/middleware/rate-limit.d.ts +1 -4
- package/dist/http/middleware/session-manager.d.ts +5 -0
- package/dist/http/middleware/websocket-origin.d.ts +22 -0
- package/dist/http/public-assets.d.ts +6 -1
- package/dist/i18n/index.js +1 -1
- package/dist/{i18n-DqcRD4qL.js → i18n-DmMKcbqj.js} +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +744 -273
- package/dist/internal/agent-request.d.ts +18 -0
- package/dist/internal/app-conventions.d.ts +6 -0
- package/dist/internal/app-conventions.js +9 -0
- package/dist/internal/dispatched-request.d.ts +4 -0
- package/dist/internal/testing.d.ts +1 -1
- package/dist/internal/testing.js +3 -3
- package/dist/internal/zod-json-schema.js +1 -1
- package/dist/introspection/driver-map.d.ts +3 -0
- package/dist/introspection/flag.d.ts +12 -0
- package/dist/introspection/manifest.d.ts +17 -0
- package/dist/introspection/plain-json.d.ts +7 -0
- package/dist/introspection/types.d.ts +167 -0
- package/dist/lambda/index.js +66 -28
- package/dist/logging/index.js +1 -1
- package/dist/{logging-YbKmbAd7.js → logging-Ci0mBk5k.js} +1 -1
- package/dist/mail/index.js +1 -1
- package/dist/{mail-uRBrUl9q.js → mail-CI2Kfe8P.js} +2 -2
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +3 -2
- package/dist/mvc/Router.d.ts +33 -0
- package/dist/mvc/inertia/InertiaEngine.d.ts +31 -0
- package/dist/mvc/inertia/props.d.ts +71 -0
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/registry.d.ts +2 -2
- package/dist/{notifications-LHuujttf.js → notifications-Bp2uamzD.js} +7 -5
- package/dist/providers/ConfigServiceProvider.d.ts +12 -5
- package/dist/queue/Job.d.ts +5 -0
- package/dist/queue/QueueManager.d.ts +3 -0
- package/dist/queue/Worker.d.ts +6 -1
- package/dist/queue/drivers/RedisDriver.d.ts +4 -2
- package/dist/queue/drivers/SqsDriver.d.ts +31 -2
- package/dist/queue/drivers/redis-queue-scripts.d.ts +83 -0
- package/dist/queue/index.js +2 -2
- package/dist/queue/serialize.d.ts +7 -0
- package/dist/queue/types.d.ts +13 -2
- package/dist/{queue-BiBn5Sff.js → queue-C8s3buYz.js} +299 -125
- package/dist/redis/RedisEmailVerificationStore.d.ts +2 -0
- package/dist/redis/RedisPasswordResetStore.d.ts +2 -0
- package/dist/redis/auth-token-scripts.d.ts +4 -0
- package/dist/redis/index.js +50 -0
- package/dist/runtime/index.js +17 -37
- package/dist/scheduling/ScheduledTask.d.ts +2 -1
- package/dist/scheduling/index.js +1 -1
- package/dist/{scheduling-DhYfbJFj.js → scheduling-DNV5tj44.js} +32 -38
- package/dist/serialize-CKXek0Tr.js +17 -0
- package/dist/storage/StorageManager.d.ts +5 -0
- package/dist/storage/drivers/LocalDriver.d.ts +15 -0
- package/dist/storage/index.js +1 -1
- package/dist/storage/url-path.d.ts +2 -0
- package/dist/{storage-6HLaUf9j.js → storage-IlUesK2t.js} +91 -29
- package/dist/support/contained-path.d.ts +8 -0
- package/dist/support/registry-collision.d.ts +12 -0
- package/dist/{vite-manifest-DK55BTLk.js → vite-manifest-wPxfAzjW.js} +2 -58
- package/package.json +6 -2
- package/dist/trim-slashes-BLY9hKAa.js +0 -22
package/dist/{DocsViewerServiceProvider-CIRNHQ2I.js → DocsViewerServiceProvider-BMbcTYVw.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ServiceProvider } from "./ServiceProvider-
|
|
1
|
+
import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
|
|
2
2
|
import { n as createDocsViewerAccessGuard, r as isDocsViewerEnabled, t as DOCS_VIEWER_PATH } from "./endpoint-CTIzcagh.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
|
|
2
|
-
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-
|
|
2
|
+
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-DWwscxfW.js";
|
|
3
3
|
import { r as getAuthContext } from "./context-af2n5abO.js";
|
|
4
4
|
//#region src/http/request-container.ts
|
|
5
5
|
/**
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as warnOnce } from "./warn-once-p-IlMjra.js";
|
|
3
|
+
import { h as warnDeprecatedSetter, m as warnDeprecatedGetter, n as ambientBinding, o as defaultContainer, r as ambientContainer } from "./default-application-DWwscxfW.js";
|
|
3
4
|
import { randomBytes } from "node:crypto";
|
|
5
|
+
//#region src/support/registry-collision.ts
|
|
6
|
+
const ADVICE = {
|
|
7
|
+
job: "A queued message runs whichever registered last. Give one a different class name or its own static jobName.",
|
|
8
|
+
event: "Listeners are keyed by the name, so each class's listeners also run for the other's emits, and a queued emit is rebuilt as whichever registered last. Give one a different class name or its own static eventName.",
|
|
9
|
+
notification: "A queued notification is rebuilt as whichever registered last. Give one a different class name or override its type getter."
|
|
10
|
+
};
|
|
11
|
+
function label(cls) {
|
|
12
|
+
return cls.name === "" ? "(anonymous class)" : cls.name;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Warns when a different class takes a name another class holds; the same class
|
|
16
|
+
* again is silent. The caller still overwrites, last wins, so only the log
|
|
17
|
+
* changes. A future major will throw here instead.
|
|
18
|
+
*/
|
|
19
|
+
function reportRegistryCollision(kind, name, taken, incoming) {
|
|
20
|
+
if (taken === void 0 || taken === incoming) return;
|
|
21
|
+
const classes = taken.name === incoming.name ? `both named ${label(taken)}` : `${label(taken)} and ${label(incoming)}`;
|
|
22
|
+
warnOnce(`registry-collision:${kind}:${name}`, `[guren] Two different ${kind} classes are registered as "${name}" (${classes}). ${ADVICE[kind]} A future major will throw here instead.`);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
4
25
|
//#region src/queue/Job.ts
|
|
5
26
|
/**
|
|
6
27
|
* The pin `setQueueDriver()` writes, and nothing else does. A manager that
|
|
@@ -105,6 +126,15 @@ var Job = class {
|
|
|
105
126
|
*/
|
|
106
127
|
static backoff = "exponential";
|
|
107
128
|
container;
|
|
129
|
+
executionSignal;
|
|
130
|
+
/** Aborted when the worker times out or loses its reservation. Pass it to cancellable I/O. */
|
|
131
|
+
get signal() {
|
|
132
|
+
return this.executionSignal ??= new AbortController().signal;
|
|
133
|
+
}
|
|
134
|
+
/** @internal Installed by the worker before handle(). */
|
|
135
|
+
setExecutionSignal(signal) {
|
|
136
|
+
this.executionSignal = signal;
|
|
137
|
+
}
|
|
108
138
|
/** @internal Called by the Worker with the container of the app it drains, before `handle()`. */
|
|
109
139
|
setContainer(container) {
|
|
110
140
|
this.container = container;
|
|
@@ -142,7 +172,9 @@ function resolveJobName(jobClass) {
|
|
|
142
172
|
}
|
|
143
173
|
const jobRegistry = /* @__PURE__ */ new Map();
|
|
144
174
|
function registerJob(jobClass) {
|
|
145
|
-
|
|
175
|
+
const name = resolveJobName(jobClass);
|
|
176
|
+
reportRegistryCollision("job", name, jobRegistry.get(name), jobClass);
|
|
177
|
+
jobRegistry.set(name, jobClass);
|
|
146
178
|
}
|
|
147
179
|
function getJob(name) {
|
|
148
180
|
return jobRegistry.get(name);
|
|
@@ -155,4 +187,4 @@ function clearJobRegistry() {
|
|
|
155
187
|
jobRegistry.clear();
|
|
156
188
|
}
|
|
157
189
|
//#endregion
|
|
158
|
-
export { getJob as a, pinnedQueueDriver as c, resolveQueueDriver as d, setQueueDriver as f, enqueueJob as i, registerJob as l, clearJobRegistry as n, getQueueDriver as o, clearQueueDriver as r, getRegisteredJobs as s, Job as t, resolveJobName as u };
|
|
190
|
+
export { getJob as a, pinnedQueueDriver as c, resolveQueueDriver as d, setQueueDriver as f, enqueueJob as i, registerJob as l, clearJobRegistry as n, getQueueDriver as o, reportRegistryCollision as p, clearQueueDriver as r, getRegisteredJobs as s, Job as t, resolveJobName as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { n as ServiceProvider } from "./ServiceProvider-
|
|
2
|
+
import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
|
|
3
3
|
import { n as createMcpAccessGuard, r as isMcpEndpointEnabled, t as MCP_ENDPOINT_PATH } from "./endpoint-Coq0K_6I.js";
|
|
4
4
|
//#region src/mcp/McpServiceProvider.ts
|
|
5
5
|
var McpServiceProvider_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -3,12 +3,12 @@ import { n as getValidatedInput, r as readValidatedInput } from "./validated-inp
|
|
|
3
3
|
import { n as ValidationException } from "./errors-JpkcCjjn.js";
|
|
4
4
|
import { n as parseImportMap, t as DEFAULT_DEV_STYLES_ENTRY } from "./inertia-defaults-BjrcT7za.js";
|
|
5
5
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
6
|
-
import { h as warnDeprecatedSetter, m as warnDeprecatedGetter } from "./default-application-
|
|
7
|
-
import { n as ServiceProvider } from "./ServiceProvider-
|
|
6
|
+
import { h as warnDeprecatedSetter, m as warnDeprecatedGetter } from "./default-application-DWwscxfW.js";
|
|
7
|
+
import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
|
|
8
8
|
import { r as getAuthContext } from "./context-af2n5abO.js";
|
|
9
9
|
import { o as getApiTokenOrFail } from "./api-token-BbgDEd6j.js";
|
|
10
|
-
import { a as resolveI18n } from "./i18n-
|
|
11
|
-
import { d as resolveGate, g as tryGetRequestContainer } from "./Gate-
|
|
10
|
+
import { a as resolveI18n } from "./i18n-DmMKcbqj.js";
|
|
11
|
+
import { d as resolveGate, g as tryGetRequestContainer } from "./Gate-BL_zW82W.js";
|
|
12
12
|
import { t as jsx_runtime_exports } from "./jsx-runtime.js";
|
|
13
13
|
import { getCookie } from "hono/cookie";
|
|
14
14
|
import { isAbsolute, resolve } from "node:path";
|
|
@@ -67,6 +67,117 @@ function copyStackFromError(target, source) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
|
+
//#region src/mvc/inertia/props.ts
|
|
71
|
+
/**
|
|
72
|
+
* Prop evaluation for the Inertia protocol's partial reloads and deferred
|
|
73
|
+
* props (https://inertiajs.com/the-protocol, "Prop Evaluation Model").
|
|
74
|
+
* `@guren/testing`'s controller mock resolves through the same function, so a
|
|
75
|
+
* test cannot pass on a prop set production would not send.
|
|
76
|
+
*/
|
|
77
|
+
const DEFERRED_BRAND = Symbol.for("guren.inertia.deferred");
|
|
78
|
+
const ALWAYS_BRAND = Symbol.for("guren.inertia.always");
|
|
79
|
+
/**
|
|
80
|
+
* A prop sent on every response, partial reloads included, whatever the
|
|
81
|
+
* `only`/`except` lists say (Laravel's `Inertia::always()`). The protocol's
|
|
82
|
+
* `errors` is one; a flash-backed shared prop is the usual other, since a
|
|
83
|
+
* flash the partial filter drops is gone with the request.
|
|
84
|
+
*/
|
|
85
|
+
function always(value) {
|
|
86
|
+
return Object.freeze({
|
|
87
|
+
[ALWAYS_BRAND]: true,
|
|
88
|
+
value,
|
|
89
|
+
toJSON: () => value
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function isAlwaysProp(value) {
|
|
93
|
+
return typeof value === "object" && value !== null && value[ALWAYS_BRAND] === true;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A prop resolved in a follow-up request rather than the initial visit
|
|
97
|
+
* (Laravel's `Inertia::defer()`). The initial response announces the key under
|
|
98
|
+
* `deferredProps[group]` and the client fetches each group with one partial
|
|
99
|
+
* reload; `resolve` runs only on the request that asks for the key.
|
|
100
|
+
*/
|
|
101
|
+
function defer(resolve, group = "default") {
|
|
102
|
+
return Object.freeze({
|
|
103
|
+
[DEFERRED_BRAND]: true,
|
|
104
|
+
resolve,
|
|
105
|
+
group
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function isDeferredProp(value) {
|
|
109
|
+
return typeof value === "object" && value !== null && value[DEFERRED_BRAND] === true;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A header list as its top-level prop names: `author.name` selects `author`.
|
|
113
|
+
* The prototype client (`@guren/inertia-client/prototype`) answers a fixture
|
|
114
|
+
* with the same rule; the two cannot import each other, so keep them in step.
|
|
115
|
+
*/
|
|
116
|
+
function propNames(value) {
|
|
117
|
+
const names = (value ?? "").split(",").map((item) => item.trim().split(".")[0]);
|
|
118
|
+
return new Set(names.filter((name) => Boolean(name)));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The partial reload a request asks for, or undefined for a full visit. A
|
|
122
|
+
* partial reload is an Inertia request whose `X-Inertia-Partial-Component`
|
|
123
|
+
* names the component being rendered; a different component (the visit was
|
|
124
|
+
* redirected elsewhere) is a full visit again.
|
|
125
|
+
*/
|
|
126
|
+
function readPartialReload(request, component) {
|
|
127
|
+
if (!request?.headers.get("X-Inertia")) return void 0;
|
|
128
|
+
if (request.headers.get("X-Inertia-Partial-Component") !== component) return void 0;
|
|
129
|
+
return {
|
|
130
|
+
only: propNames(request.headers.get("X-Inertia-Partial-Data")),
|
|
131
|
+
except: propNames(request.headers.get("X-Inertia-Partial-Except"))
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function isSelected(key, partial) {
|
|
135
|
+
if (partial.only.size > 0 && !partial.only.has(key)) return false;
|
|
136
|
+
return !partial.except.has(key);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Starts one prop's value. Through a promise so a resolver that throws
|
|
140
|
+
* synchronously rejects like one that throws later: `Promise.all` then settles
|
|
141
|
+
* every sibling rather than leaving the ones already started unhandled.
|
|
142
|
+
*/
|
|
143
|
+
function startProp(value) {
|
|
144
|
+
return Promise.resolve().then(() => isDeferredProp(value) ? value.resolve() : value());
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The props a response carries under the protocol's evaluation rules: a full
|
|
148
|
+
* visit resolves every prop but the deferred ones, which it announces; a
|
|
149
|
+
* partial reload resolves only the selected props, deferred ones included, and
|
|
150
|
+
* announces nothing; an always prop is sent either way; a lazy prop (a function
|
|
151
|
+
* value) runs only when sent. Resolvers run concurrently, unlike Laravel's.
|
|
152
|
+
*/
|
|
153
|
+
async function resolveInertiaProps(input, partial) {
|
|
154
|
+
const props = {};
|
|
155
|
+
const deferredProps = {};
|
|
156
|
+
const pending = [];
|
|
157
|
+
for (const [key, raw] of Object.entries(input)) {
|
|
158
|
+
const alwaysProp = isAlwaysProp(raw);
|
|
159
|
+
const value = alwaysProp ? raw.value : raw;
|
|
160
|
+
const deferred = isDeferredProp(value);
|
|
161
|
+
if (partial) {
|
|
162
|
+
if (!alwaysProp && !isSelected(key, partial)) continue;
|
|
163
|
+
} else if (deferred) {
|
|
164
|
+
(deferredProps[value.group] ??= []).push(key);
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (deferred || typeof value === "function") {
|
|
168
|
+
props[key] = void 0;
|
|
169
|
+
pending.push(startProp(value).then((resolved) => {
|
|
170
|
+
props[key] = resolved;
|
|
171
|
+
}));
|
|
172
|
+
} else props[key] = value;
|
|
173
|
+
}
|
|
174
|
+
if (pending.length > 0) await Promise.all(pending);
|
|
175
|
+
return Object.keys(deferredProps).length > 0 ? {
|
|
176
|
+
props,
|
|
177
|
+
deferredProps
|
|
178
|
+
} : { props };
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
70
181
|
//#region src/mvc/inertia/InertiaEngine.ts
|
|
71
182
|
ensureErrorStackTracePolyfill();
|
|
72
183
|
let documentOptions;
|
|
@@ -109,47 +220,71 @@ const DEV_FALLBACK_IMPORT_MAP = {
|
|
|
109
220
|
"@inertiajs/react": "https://esm.sh/@inertiajs/react@2.2.15?dev&external=react,react-dom/client"
|
|
110
221
|
};
|
|
111
222
|
async function inertia(component, props, options = {}) {
|
|
223
|
+
const { response } = await renderInertia(component, props, options);
|
|
224
|
+
return response;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The page body varies on the partial-reload headers as well as on
|
|
228
|
+
* `X-Inertia`: a shared cache keyed on the URL alone would hand a narrowed
|
|
229
|
+
* partial response to the next full visit.
|
|
230
|
+
*/
|
|
231
|
+
const INERTIA_VARY = "Accept, X-Inertia, X-Inertia-Partial-Component, X-Inertia-Partial-Data, X-Inertia-Partial-Except";
|
|
232
|
+
/**
|
|
233
|
+
* {@link inertia} plus the page it sent, for a caller that records the props
|
|
234
|
+
* actually resolved (`Controller.inertia()`'s response marker). The version
|
|
235
|
+
* check runs before any prop resolves: a 409 must not run a lazy prop's query.
|
|
236
|
+
*/
|
|
237
|
+
async function renderInertia(component, props, options = {}) {
|
|
112
238
|
const resolvedVersion = options.version ?? process.env.GUREN_INERTIA_VERSION ?? void 0;
|
|
113
|
-
const page = {
|
|
114
|
-
component,
|
|
115
|
-
props,
|
|
116
|
-
url: options.url ?? inertiaPageUrl(options.request) ?? "",
|
|
117
|
-
version: resolvedVersion
|
|
118
|
-
};
|
|
119
239
|
const request = options.request;
|
|
120
240
|
const isInertiaVisit = Boolean(request?.headers.get("X-Inertia"));
|
|
121
241
|
const prefersJson = request ? acceptsJson(request) : false;
|
|
122
242
|
const versionHeader = resolvedVersion ? { "X-Inertia-Version": resolvedVersion } : {};
|
|
123
243
|
if (request && resolvedVersion && isInertiaVisit && request.method === "GET") {
|
|
124
|
-
if (request.headers.get("X-Inertia-Version") !== resolvedVersion) return new Response(null, {
|
|
244
|
+
if (request.headers.get("X-Inertia-Version") !== resolvedVersion) return { response: new Response(null, {
|
|
125
245
|
status: 409,
|
|
126
246
|
headers: {
|
|
127
247
|
"X-Inertia-Location": options.url ?? request.url,
|
|
128
248
|
Vary: "Accept"
|
|
129
249
|
}
|
|
130
|
-
});
|
|
250
|
+
}) };
|
|
131
251
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"X-Inertia": "true",
|
|
137
|
-
Vary: "Accept",
|
|
138
|
-
...versionHeader,
|
|
139
|
-
...options.headers
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
const html = await renderDocument$1(page, options);
|
|
143
|
-
return new Response(html, {
|
|
144
|
-
status: options.status ?? 200,
|
|
145
|
-
headers: {
|
|
146
|
-
"Content-Type": "text/html; charset=utf-8",
|
|
147
|
-
"X-Inertia": "true",
|
|
148
|
-
Vary: "Accept",
|
|
149
|
-
...versionHeader,
|
|
150
|
-
...options.headers
|
|
151
|
-
}
|
|
252
|
+
const page = await buildInertiaPage(component, props, {
|
|
253
|
+
url: options.url,
|
|
254
|
+
version: resolvedVersion,
|
|
255
|
+
request
|
|
152
256
|
});
|
|
257
|
+
const wantsJson = isInertiaVisit || prefersJson;
|
|
258
|
+
const body = wantsJson ? serializePage(page) : await renderDocument$1(page, options);
|
|
259
|
+
return {
|
|
260
|
+
page,
|
|
261
|
+
response: new Response(body, {
|
|
262
|
+
status: options.status ?? 200,
|
|
263
|
+
headers: {
|
|
264
|
+
"Content-Type": wantsJson ? "application/json; charset=utf-8" : "text/html; charset=utf-8",
|
|
265
|
+
"X-Inertia": "true",
|
|
266
|
+
Vary: INERTIA_VARY,
|
|
267
|
+
...versionHeader,
|
|
268
|
+
...options.headers
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The page object for one request: props resolved under the request's
|
|
275
|
+
* partial-reload headers, the deferred announcement, and the page url derived
|
|
276
|
+
* from the request when `url` is absent. `@guren/testing`'s mock builds its
|
|
277
|
+
* page here too, so the two cannot disagree on the payload's shape.
|
|
278
|
+
*/
|
|
279
|
+
async function buildInertiaPage(component, props, options) {
|
|
280
|
+
const resolved = await resolveInertiaProps(props, readPartialReload(options.request, component));
|
|
281
|
+
return {
|
|
282
|
+
component,
|
|
283
|
+
props: resolved.props,
|
|
284
|
+
url: options.url ?? inertiaPageUrl(options.request) ?? "",
|
|
285
|
+
version: options.version,
|
|
286
|
+
...resolved.deferredProps ? { deferredProps: resolved.deferredProps } : {}
|
|
287
|
+
};
|
|
153
288
|
}
|
|
154
289
|
/**
|
|
155
290
|
* The Inertia protocol's page `url` is the request path plus query string, kept
|
|
@@ -473,8 +608,14 @@ function definePlugin(definition) {
|
|
|
473
608
|
return definition.boot?.(this.container, config);
|
|
474
609
|
}
|
|
475
610
|
}
|
|
476
|
-
|
|
477
|
-
|
|
611
|
+
const introspect = definition.introspect;
|
|
612
|
+
const Provider = introspect === void 0 ? ConfiguredPluginProvider : class extends ConfiguredPluginProvider {
|
|
613
|
+
introspect() {
|
|
614
|
+
return introspect(this.container, config);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
Object.defineProperty(Provider, "name", { value: className });
|
|
618
|
+
return Provider;
|
|
478
619
|
};
|
|
479
620
|
}
|
|
480
621
|
//#endregion
|
|
@@ -486,28 +627,28 @@ function defineModule(definition) {
|
|
|
486
627
|
prefix: definition.prefix,
|
|
487
628
|
routes: definition.routes,
|
|
488
629
|
providers: definition.providers ?? [],
|
|
489
|
-
commands: definition.commands ?? []
|
|
630
|
+
commands: definition.commands ?? [],
|
|
631
|
+
config: definition.config ?? []
|
|
490
632
|
};
|
|
491
633
|
}
|
|
492
634
|
/**
|
|
493
|
-
* Runs a module's route registrar
|
|
494
|
-
* Shared by `Application.mountRoutes()` and the CLI's route loader, so both see
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
* inside an async prefixed registrar run with the prefix already popped.
|
|
635
|
+
* Runs a module's route registrar under its `prefix` and names the module on each route it added.
|
|
636
|
+
* Shared by `Application.mountRoutes()` and the CLI's route loader, so both see the same route set.
|
|
637
|
+
* `router.group()`'s callback is synchronous, so route calls made after an `await` inside an
|
|
638
|
+
* async prefixed registrar run with the prefix already popped (and still carry the module).
|
|
498
639
|
*/
|
|
499
640
|
async function mountModuleRoutes(router, gurenModule) {
|
|
500
641
|
const registrar = gurenModule.routes;
|
|
501
642
|
if (!registrar) return;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
pending
|
|
509
|
-
});
|
|
510
|
-
|
|
643
|
+
const start = router.routeCount;
|
|
644
|
+
if (gurenModule.prefix) {
|
|
645
|
+
let pending = void 0;
|
|
646
|
+
router.group(gurenModule.prefix, (grouped) => {
|
|
647
|
+
pending = registrar(grouped);
|
|
648
|
+
});
|
|
649
|
+
await pending;
|
|
650
|
+
} else await registrar(router);
|
|
651
|
+
router.assignModule(start, gurenModule.name);
|
|
511
652
|
}
|
|
512
653
|
//#endregion
|
|
513
654
|
//#region src/http/middleware/detect-locale.ts
|
|
@@ -755,11 +896,10 @@ var Controller = class {
|
|
|
755
896
|
async inertia(componentOrPage, props, options = {}) {
|
|
756
897
|
const ctx = this.ctx;
|
|
757
898
|
const component = typeof componentOrPage === "string" ? componentOrPage : componentOrPage.component ?? componentOrPage.id;
|
|
758
|
-
const
|
|
899
|
+
const { response, page } = await renderInertia(component, {
|
|
759
900
|
...await resolveSharedInertiaProps(ctx, this._container),
|
|
760
901
|
...props
|
|
761
|
-
}
|
|
762
|
-
const response = await inertia(component, propsWithShared, {
|
|
902
|
+
}, {
|
|
763
903
|
...options,
|
|
764
904
|
lang: options.lang ?? this.#resolveLocale(),
|
|
765
905
|
request: ctx.req.raw,
|
|
@@ -767,7 +907,7 @@ var Controller = class {
|
|
|
767
907
|
});
|
|
768
908
|
response.__gurenInertia = {
|
|
769
909
|
component,
|
|
770
|
-
props:
|
|
910
|
+
props: page?.props ?? {}
|
|
771
911
|
};
|
|
772
912
|
return response;
|
|
773
913
|
}
|
|
@@ -1032,4 +1172,4 @@ var JsonResource = class extends Resource {
|
|
|
1032
1172
|
}
|
|
1033
1173
|
};
|
|
1034
1174
|
//#endregion
|
|
1035
|
-
export { ensureErrorStackTracePolyfill as S,
|
|
1175
|
+
export { setInertiaSsrRenderer as C, isDeferredProp as D, isAlwaysProp as E, ensureErrorStackTracePolyfill as O, setInertiaDocument as S, defer as T, INERTIA_VARY as _, renderDocument as a, inertia as b, getRequestLocale as c, mountModuleRoutes as d, definePlugin as f, shareInertiaProps as g, setInertiaSharedProps as h, Controller as i, getRequestTranslator as l, resolveSharedInertiaProps as m, Resource as n, LOCALE_CONTEXT_KEY as o, getInertiaSharedPropsResolver as p, collect as r, detectLocaleMiddleware as s, JsonResource as t, defineModule as u, acceptsJson as v, always as w, serializePage as x, buildInertiaPage as y };
|
|
@@ -23,6 +23,12 @@ var ServiceProvider = class {
|
|
|
23
23
|
function isBindingOwner(provider) {
|
|
24
24
|
return typeof provider.ownedBindings === "function";
|
|
25
25
|
}
|
|
26
|
+
function isManifestWarningSource(provider) {
|
|
27
|
+
return typeof provider.manifestWarnings === "function";
|
|
28
|
+
}
|
|
29
|
+
function describeError(error) {
|
|
30
|
+
return error instanceof Error ? error.message : String(error);
|
|
31
|
+
}
|
|
26
32
|
/**
|
|
27
33
|
* Provider manager for registering and booting providers.
|
|
28
34
|
*/
|
|
@@ -36,31 +42,77 @@ var ProviderManager = class {
|
|
|
36
42
|
deferredActivations = /* @__PURE__ */ new Map();
|
|
37
43
|
bindingOwners = [];
|
|
38
44
|
allBooted = false;
|
|
45
|
+
/** Every provider in registration order, deferred ones included, with where it came from. */
|
|
46
|
+
origins = /* @__PURE__ */ new Map();
|
|
39
47
|
constructor(container) {
|
|
40
48
|
this.container = container;
|
|
41
49
|
}
|
|
42
|
-
|
|
50
|
+
/** `origin` is internal: `Application` passes it for the manifest (RFC 0026). */
|
|
51
|
+
register(providerOrClass, origin = { source: "app.register" }) {
|
|
43
52
|
if (this.allBooted) {
|
|
44
53
|
const name = providerOrClass instanceof ServiceProvider ? providerOrClass.constructor.name : providerOrClass.name;
|
|
45
54
|
throw new Error(`Cannot register provider "${name}" after bootAll() has been called. Register all providers before booting the application.`);
|
|
46
55
|
}
|
|
47
56
|
const provider = providerOrClass instanceof ServiceProvider ? providerOrClass : new providerOrClass(this.container);
|
|
48
57
|
if (provider.isDeferred() && provider.provides().length === 0) throw new Error(`Deferred provider "${provider.constructor.name}" must declare at least one service in "provides", otherwise it can never be loaded.`);
|
|
58
|
+
if (this.origins.has(provider)) return this;
|
|
59
|
+
this.origins.set(provider, origin);
|
|
49
60
|
if (provider.isDeferred()) for (const service of provider.provides()) this.deferredProviders.set(service, provider);
|
|
50
61
|
else this.providers.push(provider);
|
|
51
62
|
return this;
|
|
52
63
|
}
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
/** `origin` is internal, as on {@link register}. */
|
|
65
|
+
registerMany(providers, origin) {
|
|
66
|
+
for (const provider of providers) this.register(provider, origin);
|
|
55
67
|
return this;
|
|
56
68
|
}
|
|
57
69
|
async registerAll() {
|
|
58
|
-
for (const provider of this.providers) if (!this.registered.has(provider))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
for (const provider of this.providers) if (!this.registered.has(provider)) await this.registerOne(provider, () => provider.register());
|
|
71
|
+
}
|
|
72
|
+
async registerOne(provider, run) {
|
|
73
|
+
await run();
|
|
74
|
+
this.assertOwnedBindingsKept(provider);
|
|
75
|
+
this.registered.add(provider);
|
|
76
|
+
if (isBindingOwner(provider)) this.bindingOwners.push(provider);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @internal `registerAll()` for introspection (RFC 0026 §2): `introspect()` where a
|
|
80
|
+
* provider has one, and a throw is recorded rather than stopping the rest.
|
|
81
|
+
* Deferred providers are reported `skipped`; they register only after boot.
|
|
82
|
+
*/
|
|
83
|
+
async registerAllForIntrospection() {
|
|
84
|
+
const outcomes = /* @__PURE__ */ new Map();
|
|
85
|
+
for (const provider of this.providers) {
|
|
86
|
+
if (this.registered.has(provider)) {
|
|
87
|
+
outcomes.set(provider, { register: "ran" });
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const hook = provider.introspect;
|
|
91
|
+
try {
|
|
92
|
+
await this.registerOne(provider, hook ? () => hook.call(provider) : () => provider.register());
|
|
93
|
+
outcomes.set(provider, { register: hook ? "introspect-hook" : "ran" });
|
|
94
|
+
} catch (error) {
|
|
95
|
+
outcomes.set(provider, {
|
|
96
|
+
register: "threw",
|
|
97
|
+
error: describeError(error)
|
|
98
|
+
});
|
|
99
|
+
}
|
|
63
100
|
}
|
|
101
|
+
return [...this.origins].map(([provider, origin]) => ({
|
|
102
|
+
name: provider.constructor.name,
|
|
103
|
+
source: origin.source,
|
|
104
|
+
...origin.module === void 0 ? {} : { module: origin.module },
|
|
105
|
+
deferred: provider.isDeferred(),
|
|
106
|
+
provides: [...provider.provides()],
|
|
107
|
+
...outcomes.get(provider) ?? { register: "skipped" }
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
/** @internal Findings registered providers hold for the manifest, each named after its provider. */
|
|
111
|
+
manifestWarnings() {
|
|
112
|
+
return this.providers.filter((provider) => this.registered.has(provider)).filter(isManifestWarningSource).flatMap((provider) => provider.manifestWarnings().map((warning) => ({
|
|
113
|
+
...warning,
|
|
114
|
+
provider: provider.constructor.name
|
|
115
|
+
})));
|
|
64
116
|
}
|
|
65
117
|
assertOwnedBindingsKept(provider) {
|
|
66
118
|
for (const owner of this.bindingOwners) for (const [key, { binding, source }] of owner.ownedBindings()) if (this.container.bindingOf(key) !== binding) throw new Error(`[guren] "${key}" is configured twice: ${source} and ${provider.constructor.name}.register(). Keep one.`);
|
package/dist/agent/dispatch.d.ts
CHANGED
|
@@ -28,10 +28,10 @@ export interface BuildToolRequestOptions {
|
|
|
28
28
|
preflight?: boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Which protocol surface the call arrived on, announced as
|
|
31
|
-
* `X-Guren-Agent-Surface`; defaults to `'mcp'`.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* `X-Guren-Agent-Surface`; defaults to `'mcp'`. The audit trail's own `surface`
|
|
32
|
+
* comes from the adapter, not from here. The auth guards read its presence to
|
|
33
|
+
* refuse with JSON rather than a redirect; nothing may authorize on it, since
|
|
34
|
+
* any client sets any header it likes.
|
|
35
35
|
*/
|
|
36
36
|
surface?: AgentSurface;
|
|
37
37
|
}
|
package/dist/agent/public.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as mapToolResponse, i as describeBuildFailure, n as advertisesStructuredOutput, r as buildToolRequest, t as PREFLIGHT_ARGUMENT } from "../dispatch-
|
|
1
|
+
import { a as mapToolResponse, i as describeBuildFailure, n as advertisesStructuredOutput, r as buildToolRequest, t as PREFLIGHT_ARGUMENT } from "../dispatch-ENWpBxbE.js";
|
|
2
2
|
export { PREFLIGHT_ARGUMENT, advertisesStructuredOutput, buildToolRequest, describeBuildFailure, mapToolResponse };
|
package/dist/agent/scopes.d.ts
CHANGED
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* The MCP tool-name grammar (SEP-986), which a `tool:` scope names and a
|
|
13
|
-
* `tools:<prefix>.*` scope must stay inside.
|
|
14
|
-
* holds the same pattern; collapsing the two needs a built server, so it waits
|
|
15
|
-
* for the PR doing that build-order work. `*` is not in the charset, so
|
|
13
|
+
* `tools:<prefix>.*` scope must stay inside. `*` is not in the charset, so
|
|
16
14
|
* `tool:posts.*` is rejected with no special case.
|
|
17
15
|
*/
|
|
18
16
|
export declare const AGENT_TOOL_NAME_PATTERN: RegExp;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/internal/agent-request.ts
|
|
2
|
+
/**
|
|
3
|
+
* How a request says it is an agent tool call (RFC 0016 §3), in a leaf module
|
|
4
|
+
* so the dispatcher that writes the header and the auth middlewares that read
|
|
5
|
+
* it share one spelling. Not exported from the package index.
|
|
6
|
+
*
|
|
7
|
+
* Read only to choose the *shape* of a refusal: a tool caller cannot follow a
|
|
8
|
+
* redirect, so a guard answers it with JSON instead. Nothing may authorize on
|
|
9
|
+
* it, since any client can send it and gets no more than a JSON refusal.
|
|
10
|
+
*/
|
|
11
|
+
/** Request header naming the protocol surface a tool call arrived on. */
|
|
12
|
+
const AGENT_SURFACE_HEADER = "X-Guren-Agent-Surface";
|
|
13
|
+
/** Whether the request was built by the agent dispatcher (`buildToolRequest`). */
|
|
14
|
+
function isAgentToolRequest(ctx) {
|
|
15
|
+
return ctx.req?.header(AGENT_SURFACE_HEADER) !== void 0;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { isAgentToolRequest as n, AGENT_SURFACE_HEADER as t };
|
|
@@ -3,6 +3,7 @@ import type { Model, PlainObject } from '@guren/orm';
|
|
|
3
3
|
import { type ModelUserProviderOptions } from './providers/ModelUserProvider.js';
|
|
4
4
|
import { type ApiTokenStore } from './api-token.js';
|
|
5
5
|
import type { PasswordHasher } from './password/PasswordHasher.js';
|
|
6
|
+
import type { AuthEntry } from '../introspection/types.js';
|
|
6
7
|
import type { AttachContextOptions, AuthContext, AuthManagerContract, AuthManagerOptions, AuthCredentials, Guard, GuardContext, GuardFactory, ProviderFactory, UserProvider } from './types.js';
|
|
7
8
|
/** The guard and provider names an app gets without naming either: `createApp()` registers them, `useModel()` fills them. */
|
|
8
9
|
export declare const DEFAULT_GUARD = "web";
|
|
@@ -34,6 +35,7 @@ export declare class AuthManager implements AuthManagerContract {
|
|
|
34
35
|
hasher(): PasswordHasher;
|
|
35
36
|
registerGuard<User>(name: string, factory: GuardFactory<User>): void;
|
|
36
37
|
registerProvider<User>(name: string, factory: ProviderFactory<User>): void;
|
|
38
|
+
private setProvider;
|
|
37
39
|
/** The guard `useTokens()` registered, or null. On this class rather than the contract, like `getApiTokenOptions()`. */
|
|
38
40
|
getTokenGuard(): string | null;
|
|
39
41
|
/** Whether a provider factory is registered under `name`; `getProvider()` throws where this is false. */
|
|
@@ -98,5 +100,7 @@ export declare class AuthManager implements AuthManagerContract {
|
|
|
98
100
|
* rather than `AuthManagerContract`, which describes what a *request* needs.
|
|
99
101
|
*/
|
|
100
102
|
getApiTokenStore(): ApiTokenStore | undefined;
|
|
103
|
+
/** Guards and providers as registered, constructing no provider (RFC 0026 §1). */
|
|
104
|
+
describe(): AuthEntry;
|
|
101
105
|
}
|
|
102
106
|
export type { AuthCredentials } from './types.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HeaderReader } from '../internal/agent-request.js';
|
|
1
2
|
import { buildTokenUrl, parseTokenUrl } from './utils.js';
|
|
2
3
|
/**
|
|
3
4
|
* Email verification token data stored in the backing store. Only the opaque
|
|
@@ -17,6 +18,10 @@ export interface EmailVerificationToken {
|
|
|
17
18
|
export interface EmailVerificationTokenStore {
|
|
18
19
|
/** Store a new verification token. */
|
|
19
20
|
store(token: EmailVerificationToken): Promise<void>;
|
|
21
|
+
/** Atomically replace every token for this email. Required by token issuance. */
|
|
22
|
+
replace?(token: EmailVerificationToken): Promise<void>;
|
|
23
|
+
/** Atomically delete this token only if its stored email matches. Required by completion. */
|
|
24
|
+
consume?(tokenId: string, email: string): Promise<boolean>;
|
|
20
25
|
/** Find a token by its opaque token ID. */
|
|
21
26
|
findByTokenId(tokenId: string): Promise<EmailVerificationToken | null>;
|
|
22
27
|
/** Delete a token by its opaque token ID. */
|
|
@@ -28,6 +33,8 @@ export interface EmailVerificationTokenStore {
|
|
|
28
33
|
export declare class MemoryEmailVerificationStore implements EmailVerificationTokenStore {
|
|
29
34
|
private tokens;
|
|
30
35
|
store(token: EmailVerificationToken): Promise<void>;
|
|
36
|
+
replace(token: EmailVerificationToken): Promise<void>;
|
|
37
|
+
consume(tokenId: string, email: string): Promise<boolean>;
|
|
31
38
|
findByTokenId(tokenId: string): Promise<EmailVerificationToken | null>;
|
|
32
39
|
delete(tokenId: string): Promise<void>;
|
|
33
40
|
deleteForEmail(email: string): Promise<void>;
|
|
@@ -102,4 +109,4 @@ export declare function requireVerifiedEmail(options?: {
|
|
|
102
109
|
}): (ctx: {
|
|
103
110
|
get: <T = unknown>(key: string) => T;
|
|
104
111
|
redirect: (url: string) => Response;
|
|
105
|
-
}, next: () => Promise<void>) => Promise<Response | undefined>;
|
|
112
|
+
} & HeaderReader, next: () => Promise<void>) => Promise<Response | undefined>;
|
package/dist/auth/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as verifyOAuthState, B as
|
|
1
|
+
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, H as NodeHasher, I as AuthManager, O as parseOAuthRedirectUrl, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "../auth-DIugW0O-.js";
|
|
2
2
|
import { C as secureCompare, S as parseTokenUrl, _ as verifyApiToken, a as getApiToken, b as generateToken, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAny, h as tokenCanAll, i as createBearerTokenMiddleware, l as parseApiToken, m as tokenCan, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken, v as buildTokenUrl, w as secureStringCompare, x as hashToken, y as generateId } from "../api-token-BbgDEd6j.js";
|
|
3
3
|
export { API_TOKEN_KEY, ScryptHasher as Argon2Hasher, ScryptHasher, AuthManager, AuthenticatableModel, BaseUserProvider, MemoryApiTokenStore, MemoryEmailVerificationStore, MemoryOAuthStateStore, MemoryPasswordResetStore, ModelUserProvider, NodeHasher, OAUTH_SESSION_BINDING_KEY, OAuthManager, SessionGuard, TokenGuard, buildOAuthAuthorizeUrl, buildOAuthRedirectUrl, buildPasswordResetUrl, buildTokenUrl, buildVerificationUrl, completeEmailVerification, completePasswordReset, createApiToken, createBearerTokenMiddleware, createDiscordOAuthProviderConfig, createEmailVerificationToken, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createOAuthManager, createOAuthState, createPasswordResetToken, exchangeOAuthCode, fetchOAuthUserProfile, generateId, generateToken, getApiToken, getApiTokenOrFail, getUserApiTokens, hashToken, isEmailVerified, parseApiToken, parseOAuthRedirectUrl, parsePasswordResetUrl, parseTokenUrl, parseVerificationUrl, readBearerToken, requireVerifiedEmail, revokeAllApiTokens, revokeApiToken, sanitizeOAuthRedirect, secureCompare, secureStringCompare, tokenCan, tokenCanAll, tokenCanAny, verifyApiToken, verifyEmailToken, verifyOAuthState, verifyPasswordResetToken };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PasswordHasher } from './PasswordHasher.js';
|
|
2
|
+
/** What introspection reports of a hasher (RFC 0026 §1): the format it writes, and whether writing needs `Bun.password`. */
|
|
3
|
+
export interface PasswordHasherDescription {
|
|
4
|
+
algorithm: 'scrypt' | 'argon2' | 'bcrypt' | null;
|
|
5
|
+
requiresBun: boolean | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Matched by exact constructor, so a subclass (which may override `hash()`) or an
|
|
9
|
+
* app's own `PasswordHasher` reads as unknown rather than as the class it extends.
|
|
10
|
+
*/
|
|
11
|
+
export declare function describePasswordHasher(hasher: PasswordHasher): PasswordHasherDescription;
|