@guren/server 2.3.0 → 2.5.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.
@@ -72,7 +72,7 @@ export interface RouteOpenApiMetadata {
72
72
  * Represents a registered route definition for introspection.
73
73
  */
74
74
  export interface RouteDefinition {
75
- /** HTTP method (GET, POST, PUT, PATCH, DELETE) */
75
+ /** Uppercased HTTP method (GET, POST, PUT, PATCH, DELETE, QUERY, or any custom method registered via on()) */
76
76
  method: string;
77
77
  /** URL path pattern (e.g., '/users/:id') */
78
78
  path: string;
@@ -193,6 +193,15 @@ export declare class Router<M extends string = never> {
193
193
  delete<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
194
194
  delete<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
195
195
  delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
196
+ /**
197
+ * Registers a route for the HTTP QUERY method (RFC 10008): safe and
198
+ * idempotent like GET, but the request carries a body like POST. Handlers
199
+ * must not mutate state — CSRF protection deliberately skips QUERY on that
200
+ * assumption (see `createCsrfMiddleware`'s `methods` option to opt in).
201
+ */
202
+ query<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
203
+ query<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
204
+ query<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
196
205
  group(prefix: string, callback: (router: Router<M>) => void): this;
197
206
  route(name: string, params?: Record<string, string | number>): string;
198
207
  hasRoute(name: string): boolean;
@@ -235,5 +244,11 @@ declare class RouterMiddlewareGroupBuilder<M extends string = never> {
235
244
  delete<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
236
245
  delete<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
237
246
  delete<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
247
+ query<C extends ControllerConstructor>(path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
248
+ query<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
249
+ query<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
250
+ on<C extends ControllerConstructor>(method: string, path: string, handler: RouteHandler<C>, ...middlewares: MiddlewareHandler[]): RouteBuilder<M>;
251
+ on<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
252
+ on<C extends ControllerConstructor, TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(method: string, path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: ControllerAction<C>): RouteBuilder<M>;
238
253
  }
239
254
  export {};
@@ -373,10 +373,12 @@ var RedisApiTokenStore = class {
373
373
  userId: data.userId,
374
374
  abilities: decodeAbilities(data.abilities),
375
375
  lastUsedAt: toDate(data.lastUsedAt),
376
- // Absent means "never expires"; present-but-unparseable means a corrupt
377
- // record, which must not read as immortal — `verifyApiToken` skips its
378
- // expiry check entirely when this is null.
379
- expiresAt: toOptionalExpiry(data.expiresAt),
376
+ // A never-expiring token serializes `expiresAt` as '' (a Redis hash has no
377
+ // null), so an empty string is "absent" here, not a corrupt value. Map it
378
+ // to undefined before `toOptionalExpiry`, which would otherwise degrade ''
379
+ // to epoch and reject every non-expiring token. A genuinely unparseable
380
+ // value still degrades to epoch and reads as expired.
381
+ expiresAt: toOptionalExpiry(data.expiresAt === "" ? void 0 : data.expiresAt),
380
382
  createdAt: toDate(data.createdAt) ?? /* @__PURE__ */ new Date(0)
381
383
  };
382
384
  }
@@ -1,9 +1,10 @@
1
1
  import {
2
+ DEFAULT_DEV_STYLES_ENTRY,
2
3
  GUREN_ASCII_ART,
3
4
  logDevServerBanner,
4
5
  parseImportMap,
5
6
  startViteDevServer
6
- } from "../chunk-6IGN233M.js";
7
+ } from "../chunk-62AB24ZU.js";
7
8
  import {
8
9
  trimTrailingSlashes
9
10
  } from "../chunk-AZOYI43J.js";
@@ -354,7 +355,6 @@ import { dirname as dirname2, resolve as resolve3, join as join2 } from "path";
354
355
  import { fileURLToPath as fileURLToPath2 } from "url";
355
356
  import { readFileSync } from "fs";
356
357
  var DEFAULT_STYLES_ENTRY = "/public/assets/app.css";
357
- var DEFAULT_DEV_STYLES_ENTRY = "/resources/css/app.css";
358
358
  var DEFAULT_SCRIPT_ENTRY = "/assets/app.js";
359
359
  var DEFAULT_VENDOR_CLIENT_PATH = "/vendor/inertia-client.tsx";
360
360
  function configureInertiaAssets(app, options) {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The stylesheet *source* path the dev asset configuration falls back to.
3
+ *
4
+ * Lives in a leaf module because two sides read it and must agree: the dev
5
+ * configuration in `http/inertia-assets.ts` publishes it into
6
+ * `GUREN_INERTIA_STYLES`, and the document renderer in
7
+ * `mvc/inertia/InertiaEngine.ts` drops exactly this path again when a dev
8
+ * server owns the script entry (the compiled CSS then arrives through the
9
+ * module graph). Importing either of those modules from the other would drag
10
+ * runtime-specific dependencies across the Workers/Lambda boundary or create
11
+ * an import cycle.
12
+ */
13
+ export declare const DEFAULT_DEV_STYLES_ENTRY = "/resources/css/app.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/server",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -113,7 +113,7 @@
113
113
  "test": "bun test"
114
114
  },
115
115
  "dependencies": {
116
- "@guren/orm": "^2.2.1",
116
+ "@guren/orm": "^2.3.0",
117
117
  "@modelcontextprotocol/sdk": "^1.30.0",
118
118
  "chalk": "^5.3.0",
119
119
  "consola": "^3.4.2",