@plinthjs/http 0.1.0 → 0.1.1

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/index.js CHANGED
@@ -105,7 +105,7 @@ var Response = class _Response {
105
105
  * matches the `Content-Length` set by {@link Response.file}/{@link Response.download}.
106
106
  */
107
107
  bodyEncoding = "utf8";
108
- /** Flash intent queued by {@link Response.with}; drained by the session layer (Laravel flash). */
108
+ /** Flash intent queued by {@link Response.with}; drained by the session layer. */
109
109
  flashData = {};
110
110
  /** The streaming body source, when this is a streamed response (see {@link Response.stream}). */
111
111
  streamSource;
@@ -228,7 +228,7 @@ var Response = class _Response {
228
228
  }
229
229
  // --- Macros (the `Response::macro` extension point) -----------------------
230
230
  /**
231
- * Register a reusable response builder under `name`. The Laravel `Response::macro()` equivalent —
231
+ * Register a reusable response builder under `name`. The `Response::macro()` equivalent —
232
232
  * application code installs a named factory once and invokes it via {@link Response.callMacro}
233
233
  * (`Response.callMacro('caps', text)`). Re-registering a name overwrites the previous macro.
234
234
  */
@@ -245,8 +245,7 @@ var Response = class _Response {
245
245
  }
246
246
  /**
247
247
  * Invoke a previously {@link Response.macro registered} macro by name, forwarding `args` and
248
- * returning the {@link Response} it builds. Throws when no macro is registered under `name` (the
249
- * `BadMethodCallException` Laravel raises for an unknown macro). Typed pragmatically: callers cast
248
+ * returning the {@link Response} it builds. Throws when no macro is registered under `name`. Typed pragmatically: callers cast
250
249
  * `args` to the macro's expected parameters.
251
250
  */
252
251
  static callMacro(name, ...args) {
@@ -399,7 +398,7 @@ var Response = class _Response {
399
398
  };
400
399
 
401
400
  // src/exceptions.ts
402
- var EXCEPTION_HANDLER = /* @__PURE__ */ Symbol("mason.exceptionHandler");
401
+ var EXCEPTION_HANDLER = /* @__PURE__ */ Symbol("plinth.exceptionHandler");
403
402
  var HttpException = class extends Error {
404
403
  constructor(status, message = "", headers = {}) {
405
404
  super(message);
@@ -450,7 +449,7 @@ var ExceptionHandler = class {
450
449
  renderCallbacks = [];
451
450
  /**
452
451
  * Error constructors whose instances are not reported. Seeded with {@link HttpException} (an
453
- * `instanceof` check, so every subclass — 404/405/… — is covered too), mirroring Laravel's small
452
+ * `instanceof` check, so every subclass — 404/405/… — is covered too), following the usual small
454
453
  * internal don't-report list. Extend with {@link ExceptionHandler.ignore} / shrink with
455
454
  * {@link ExceptionHandler.stopIgnoring}.
456
455
  */
@@ -465,7 +464,7 @@ var ExceptionHandler = class {
465
464
  /** Per-constructor log levels consulted by {@link ExceptionHandler.levelFor}. */
466
465
  levels = [];
467
466
  /**
468
- * Input keys never flashed back to the session on a validation redirect — the Laravel
467
+ * Input keys never flashed back to the session on a validation redirect — the conventional
469
468
  * `$dontFlash` list, seeded with its defaults. `@plinthjs/http` itself has no redirect/flash path,
470
469
  * so the list is stored here and exposed via {@link ExceptionHandler.getDontFlash} for the
471
470
  * session/validation layer to consume when it re-flashes old input.
@@ -484,7 +483,7 @@ var ExceptionHandler = class {
484
483
  // --- Exception mapping / levels / dontFlash --------------------------------
485
484
  /**
486
485
  * Map one exception type to another: whenever an instance of `from` reaches the handler, it is
487
- * first converted via `to` and the *result* is reported and rendered instead. The Laravel
486
+ * first converted via `to` and the *result* is reported and rendered instead. The conventional
488
487
  * `$exceptions->map(From::class, fn ($e) => new To(..., $e))` equivalent. Mappings are checked in
489
488
  * registration order; the first `instanceof` match applies (once — the mapped error is not
490
489
  * re-mapped). Chains.
@@ -501,8 +500,7 @@ var ExceptionHandler = class {
501
500
  return error;
502
501
  }
503
502
  /**
504
- * Set the log level instances of `ctor` are reported at — the Laravel
505
- * `$exceptions->level(Type::class, LogLevel::WARNING)` equivalent. The level is surfaced as the
503
+ * Set the log level instances of `ctor` are reported at. The level is surfaced as the
506
504
  * `level` key of the context passed to the {@link ReportSink}. Chains.
507
505
  */
508
506
  level(ctor, logLevel) {
@@ -518,7 +516,7 @@ var ExceptionHandler = class {
518
516
  }
519
517
  /**
520
518
  * Replace the list of input keys that must never be flashed back on a validation redirect — the
521
- * Laravel `$exceptions->dontFlash([...])` equivalent. Defaults to `current_password`, `password`,
519
+ * `$exceptions->dontFlash([...])` equivalent. Defaults to `current_password`, `password`,
522
520
  * and `password_confirmation`. There is no redirect/flash path inside `@plinthjs/http`, so the list
523
521
  * is exposed via {@link ExceptionHandler.getDontFlash} for the session/validation layer that
524
522
  * re-flashes old input. Chains.
@@ -531,7 +529,7 @@ var ExceptionHandler = class {
531
529
  getDontFlash() {
532
530
  return [...this.dontFlashKeys];
533
531
  }
534
- // --- Reporting (the `report()` half of Laravel's Handler) -----------------
532
+ // --- Reporting -----------------
535
533
  /**
536
534
  * Register a reportable callback. Runs in order during {@link ExceptionHandler.report}; returning
537
535
  * `false` from a callback stops all further reporting of that error. Chains.
@@ -541,18 +539,17 @@ var ExceptionHandler = class {
541
539
  return this;
542
540
  }
543
541
  /**
544
- * Add error constructors to the don't-report list (the Laravel `ignore()` / `$dontReport`
545
- * equivalent). Matching is by `instanceof`, so a base class also suppresses its subclasses. Chains.
542
+ * Add error constructors to the don't-report list. Matching is by `instanceof`, so a base class also suppresses its subclasses. Chains.
546
543
  */
547
544
  ignore(...classes) {
548
545
  this.ignored.push(...classes);
549
546
  return this;
550
547
  }
551
- /** Alias of {@link ExceptionHandler.ignore} — the Laravel `$dontReport` spelling. */
548
+ /** Alias of {@link ExceptionHandler.ignore} — the `$dontReport` spelling. */
552
549
  dontReport(...classes) {
553
550
  return this.ignore(...classes);
554
551
  }
555
- /** Remove error constructors from the don't-report list. The Laravel `stopIgnoring()` equivalent. */
552
+ /** Remove error constructors from the don't-report list. */
556
553
  stopIgnoring(...classes) {
557
554
  const drop = new Set(classes);
558
555
  for (let i = this.ignored.length - 1; i >= 0; i--) {
@@ -567,7 +564,7 @@ var ExceptionHandler = class {
567
564
  }
568
565
  return true;
569
566
  }
570
- /** Replace the terminal report sink (the logger seam). The Laravel `reportable`/logger wiring. */
567
+ /** Replace the terminal report sink (the logger seam). */
571
568
  reportUsing(sink) {
572
569
  this.reportSink = sink;
573
570
  return this;
@@ -579,7 +576,7 @@ var ExceptionHandler = class {
579
576
  }
580
577
  /**
581
578
  * A hook for additional report context, merged into every report. Override in a subclass to attach
582
- * request-scoped data (user id, etc.). The Laravel `Handler::context()` equivalent.
579
+ * request-scoped data (user id, etc.).
583
580
  */
584
581
  context() {
585
582
  return {};
@@ -588,7 +585,7 @@ var ExceptionHandler = class {
588
585
  * Report `error`: if {@link ExceptionHandler.shouldReport} and not a duplicate (when
589
586
  * {@link ExceptionHandler.withoutDuplicates} is on), run the reportable callbacks in order — a
590
587
  * `false` return stops the chain (the default sink is skipped) — otherwise fall through to the
591
- * terminal sink. The Laravel `Handler::report()` equivalent.
588
+ * terminal sink.
592
589
  */
593
590
  report(error) {
594
591
  const mapped = this.mapException(error);
@@ -735,8 +732,7 @@ var HttpKernel = class _HttpKernel {
735
732
  return this.exceptionHandler;
736
733
  }
737
734
  /**
738
- * Report `error` (guarded so a throwing report can never break rendering — the Laravel handler
739
- * also isolates reporting from rendering), then render it to a {@link Response}. Used at both
735
+ * Report `error`, then render it to a {@link Response}. Used at both
740
736
  * pipeline catch sites so every thrown error is both reported and rendered.
741
737
  */
742
738
  reportThenRender(req, error) {
@@ -972,7 +968,7 @@ var UploadedFile = class {
972
968
  this.content = init.content;
973
969
  this.size = init.content.byteLength;
974
970
  }
975
- /** The raw uploaded bytes. The `get()` content accessor (Laravel `$file->get()`). */
971
+ /** The raw uploaded bytes. The `get()` content accessor. */
976
972
  get() {
977
973
  return this.content;
978
974
  }
@@ -1001,7 +997,7 @@ var UploadedFile = class {
1001
997
  }
1002
998
  /**
1003
999
  * Whether the upload is valid — here, simply that it carries a non-empty filename. Mirrors the
1004
- * Laravel `$file->isValid()` predicate at this layer (no PHP upload-error codes exist in Node).
1000
+ * `$file->isValid()` predicate at this layer (no PHP upload-error codes exist in Node).
1005
1001
  */
1006
1002
  isValid() {
1007
1003
  return this.clientOriginalName.length > 0;
@@ -1032,7 +1028,7 @@ var UploadedFile = class {
1032
1028
  }
1033
1029
  /**
1034
1030
  * A unique storage filename preserving the original extension — a timestamp/random base, the way
1035
- * Laravel's `hashName()` produces a collision-resistant name. Used by {@link UploadedFile.store}.
1031
+ * the conventional `hashName()` produces a collision-resistant name. Used by {@link UploadedFile.store}.
1036
1032
  */
1037
1033
  hashName() {
1038
1034
  const extension = this.getClientOriginalExtension();
@@ -1164,7 +1160,7 @@ var Request = class _Request {
1164
1160
  }
1165
1161
  /**
1166
1162
  * Build a {@link Request} from a live Node {@link IncomingMessage}, draining and parsing the body.
1167
- * The Laravel `Request::capture()` equivalent for the `node:http` runtime. The body is buffered
1163
+ * The body is buffered
1168
1164
  * up to {@link FromNodeOptions.maxBodyBytes} (default 1 MiB); anything larger rejects with a
1169
1165
  * {@link PayloadTooLargeHttpException} without buffering past the cap.
1170
1166
  */
@@ -1333,7 +1329,7 @@ var Request = class _Request {
1333
1329
  /**
1334
1330
  * The scheme plus host (e.g. `https://acme.myapp.com:8080`) — the `$request->schemeAndHttpHost()`
1335
1331
  * equivalent. The scheme is read from the first `X-Forwarded-Proto` hop, defaulting to `http`
1336
- * (Mason's adapter sits on plain `node:http`; a TLS-terminating proxy sets the header).
1332
+ * (Plinth's adapter sits on plain `node:http`; a TLS-terminating proxy sets the header).
1337
1333
  * `undefined` when no host is known.
1338
1334
  */
1339
1335
  schemeAndHttpHost() {
@@ -1351,7 +1347,7 @@ var Request = class _Request {
1351
1347
  }
1352
1348
  /**
1353
1349
  * Whether the request arrived over HTTPS — the `$request->isSecure()` equivalent. Reads the first
1354
- * `X-Forwarded-Proto` hop (Mason sits on plain `node:http` behind a TLS-terminating proxy), so it
1350
+ * `X-Forwarded-Proto` hop (Plinth sits on plain `node:http` behind a TLS-terminating proxy), so it
1355
1351
  * is the trust-proxy signal a `secure` cookie or HSTS header should gate on.
1356
1352
  */
1357
1353
  isSecure() {
@@ -1515,7 +1511,7 @@ var Request = class _Request {
1515
1511
  }
1516
1512
  /**
1517
1513
  * Read an input value coerced to a primitive string. When the key is absent, `def` (default `''`)
1518
- * is returned. The Laravel `$request->string()` equivalent — note this returns a primitive
1514
+ * is returned. The `$request->string()` equivalent — note this returns a primitive
1519
1515
  * `string` rather than a `Stringable`; wrap it with `@plinthjs/support`'s `Str.of()` for fluent
1520
1516
  * helpers if needed.
1521
1517
  */
@@ -1526,7 +1522,7 @@ var Request = class _Request {
1526
1522
  }
1527
1523
  /**
1528
1524
  * Read an input value if (and only if) it is one of `values`, else `undefined`. Generic over the
1529
- * union of allowed values. The Laravel `$request->enum()` equivalent (returning the value, not a
1525
+ * union of allowed values. The `$request->enum()` equivalent (returning the value, not a
1530
1526
  * native enum case). Comparison is by strict equality against the supplied members.
1531
1527
  */
1532
1528
  enum(key, values) {
@@ -1821,7 +1817,7 @@ var Request = class _Request {
1821
1817
  }
1822
1818
  /**
1823
1819
  * The route value for `key`: the resolved bound model when route-model binding applied, otherwise
1824
- * the raw route parameter (the Laravel `$request->route('user')`). `undefined` when neither exists.
1820
+ * the raw route parameter. `undefined` when neither exists.
1825
1821
  */
1826
1822
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- caller-supplied cast for the resolved bound model
1827
1823
  route(key) {
@@ -2015,9 +2011,7 @@ var Route = class {
2015
2011
  return this.domainPattern;
2016
2012
  }
2017
2013
  /**
2018
- * Match a request `host` against this route's domain. Returns the extracted domain params (an
2019
- * empty object when the route has no domain — a domain-less route matches any host, mirroring
2020
- * Laravel), or `undefined` when the route has a domain that the host does not satisfy (including
2014
+ * Match a request `host` against this route's domain. Returns the extracted domain params, or `undefined` when the route has a domain that the host does not satisfy (including
2021
2015
  * when the route requires a domain but no host was supplied).
2022
2016
  */
2023
2017
  matchDomain(host) {
@@ -2045,23 +2039,23 @@ var Route = class {
2045
2039
  }
2046
2040
  return this;
2047
2041
  }
2048
- /** Constrain `param` to digits only. The Laravel `->whereNumber()` equivalent. Chains. */
2042
+ /** Constrain `param` to digits only. Chains. */
2049
2043
  whereNumber(param) {
2050
2044
  return this.where(param, WHERE_PATTERNS.number);
2051
2045
  }
2052
- /** Constrain `param` to ASCII letters only. The Laravel `->whereAlpha()` equivalent. Chains. */
2046
+ /** Constrain `param` to ASCII letters only. Chains. */
2053
2047
  whereAlpha(param) {
2054
2048
  return this.where(param, WHERE_PATTERNS.alpha);
2055
2049
  }
2056
- /** Constrain `param` to letters and digits. The Laravel `->whereAlphaNumeric()` equivalent. Chains. */
2050
+ /** Constrain `param` to letters and digits. Chains. */
2057
2051
  whereAlphaNumeric(param) {
2058
2052
  return this.where(param, WHERE_PATTERNS.alphanumeric);
2059
2053
  }
2060
- /** Constrain `param` to a UUID shape. The Laravel `->whereUuid()` equivalent. Chains. */
2054
+ /** Constrain `param` to a UUID shape. Chains. */
2061
2055
  whereUuid(param) {
2062
2056
  return this.where(param, WHERE_PATTERNS.uuid);
2063
2057
  }
2064
- /** Constrain `param` to a ULID shape. The Laravel `->whereUlid()` equivalent. Chains. */
2058
+ /** Constrain `param` to a ULID shape. Chains. */
2065
2059
  whereUlid(param) {
2066
2060
  return this.where(param, WHERE_PATTERNS.ulid);
2067
2061
  }
@@ -2269,7 +2263,7 @@ var SingletonRegistration = class {
2269
2263
  register;
2270
2264
  isDestroyable = false;
2271
2265
  builtRoutes;
2272
- /** Also register `DELETE name` → `destroy`. The Laravel `->destroyable()` equivalent. Chains. */
2266
+ /** Also register `DELETE name` → `destroy`. Chains. */
2273
2267
  destroyable(value) {
2274
2268
  this.isDestroyable = value ?? true;
2275
2269
  return this;
@@ -2353,14 +2347,14 @@ var Router = class _Router {
2353
2347
  // --- Convenience routes (the `Route::view` / `Route::redirect` family) -----
2354
2348
  /**
2355
2349
  * Install the renderer {@link Router.view} routes defer to — the seam an app (or a view package)
2356
- * plugs its template engine into. The Laravel view-factory binding equivalent. Chains.
2350
+ * plugs its template engine into. Chains.
2357
2351
  */
2358
2352
  renderViewsUsing(renderer) {
2359
2353
  this.viewRenderer = renderer;
2360
2354
  return this;
2361
2355
  }
2362
2356
  /**
2363
- * Register a `GET` route that renders `view` with `data` — the Laravel `Route::view()` equivalent.
2357
+ * Register a `GET` route that renders `view` with `data`.
2364
2358
  * `@plinthjs/http` ships no template engine, so rendering is deferred to the {@link ViewRenderer}
2365
2359
  * configured via {@link Router.renderViewsUsing} (or the `viewRenderer` construction option);
2366
2360
  * dispatching the route without one throws a clear error. The renderer's string becomes an HTML
@@ -2378,19 +2372,19 @@ var Router = class _Router {
2378
2372
  }
2379
2373
  /**
2380
2374
  * Register a route answering every verb with a redirect to `destination` (default `302`). The
2381
- * Laravel `Route::redirect()` equivalent.
2375
+ * `Route::redirect()` equivalent.
2382
2376
  */
2383
2377
  redirect(uri, destination, status = 302) {
2384
2378
  return this.any(uri, () => Response.redirect(destination, status));
2385
2379
  }
2386
- /** Register a `301` redirect route. The Laravel `Route::permanentRedirect()` equivalent. */
2380
+ /** Register a `301` redirect route. */
2387
2381
  permanentRedirect(uri, destination) {
2388
2382
  return this.redirect(uri, destination, 301);
2389
2383
  }
2390
2384
  // --- Resource routes (the `Route::resource` family) -----------------------
2391
2385
  /**
2392
2386
  * Register the seven canonical RESTful routes for `controller` under `name`, mapping each verb+URI
2393
- * to a controller method — the Laravel `Route::resource()` equivalent:
2387
+ * to a controller method:
2394
2388
  *
2395
2389
  * - `GET name` → `index` (`name.index`)
2396
2390
  * - `GET name/create` → `create` (`name.create`)
@@ -2413,7 +2407,7 @@ var Router = class _Router {
2413
2407
  }
2414
2408
  /**
2415
2409
  * Like {@link Router.resource} but for APIs: registers the same routes minus `create` and `edit`
2416
- * (the HTML form-presenting endpoints). The Laravel `Route::apiResource()` equivalent.
2410
+ * (the HTML form-presenting endpoints).
2417
2411
  */
2418
2412
  apiResource(name, controller, options) {
2419
2413
  return this.registerResource(name, controller, true, options);
@@ -2436,8 +2430,7 @@ var Router = class _Router {
2436
2430
  /**
2437
2431
  * Register a singleton resource — routes for a resource with exactly one instance (a profile, a
2438
2432
  * settings page), mapping `GET name` → `show`, `GET name/edit` → `edit`, and `PUT|PATCH name` →
2439
- * `update` (no `{param}` segment, no `index`/`create`/`store`). The Laravel `Route::singleton()`
2440
- * equivalent. Chain {@link SingletonRegistration.destroyable} to add `DELETE name` → `destroy`.
2433
+ * `update` (no `{param}` segment, no `index`/`create`/`store`). Chain {@link SingletonRegistration.destroyable} to add `DELETE name` → `destroy`.
2441
2434
  * Registration is deferred exactly like {@link Router.resource}.
2442
2435
  */
2443
2436
  singleton(name, controller) {
@@ -2445,8 +2438,7 @@ var Router = class _Router {
2445
2438
  }
2446
2439
  /**
2447
2440
  * Like {@link Router.singleton} but for APIs: omits the HTML `edit` route, registering only
2448
- * `show` and `update` (plus `destroy` after `.destroyable()`). The Laravel
2449
- * `Route::apiSingleton()` equivalent.
2441
+ * `show` and `update` (plus `destroy` after `.destroyable()`).
2450
2442
  */
2451
2443
  apiSingleton(name, controller) {
2452
2444
  return this.registerSingleton(name, controller, true);
@@ -2522,7 +2514,7 @@ var Router = class _Router {
2522
2514
  /**
2523
2515
  * Register a named middleware *group* — a list of references (concrete entries and/or other
2524
2516
  * alias/group names) that expand in place wherever the group name is used on a route or group. The
2525
- * Laravel `Route::middlewareGroup('web', [...])` equivalent. Re-registering a name replaces it.
2517
+ * `Route::middlewareGroup('web', [...])` equivalent. Re-registering a name replaces it.
2526
2518
  * Names are resolved (recursively) at match time by {@link Router.resolveMiddleware}.
2527
2519
  */
2528
2520
  middlewareGroup(name, entries) {
@@ -2531,7 +2523,7 @@ var Router = class _Router {
2531
2523
  }
2532
2524
  /**
2533
2525
  * Register a middleware *alias* — a short `string` name for a single concrete {@link MiddlewareEntry}.
2534
- * The Laravel `$middlewareAliases` / `Route::aliasMiddleware('auth', Authenticate)` equivalent.
2526
+ *
2535
2527
  * Re-registering a name replaces it.
2536
2528
  */
2537
2529
  aliasMiddleware(name, entry) {
@@ -2553,7 +2545,7 @@ var Router = class _Router {
2553
2545
  /**
2554
2546
  * Resolve a middleware reference list to concrete {@link MiddlewareEntry entries}, expanding
2555
2547
  * `string` names: a name resolves first as an **alias** (→ its single entry), else as a **group**
2556
- * (→ its references, expanded recursively). An unknown name **throws** — mirroring Laravel, which
2548
+ * (→ its references, expanded recursively). An unknown name **throws** —, which
2557
2549
  * raises when a route references a middleware that is neither an alias nor a group. Cyclic group
2558
2550
  * references (a group that, directly or transitively, contains itself) also throw rather than
2559
2551
  * recursing without bound. Function/class entries pass through unchanged and in order.
@@ -2608,7 +2600,7 @@ var Router = class _Router {
2608
2600
  * Serialize the registered routes to a plain, JSON-serializable {@link RouteCache} snapshot
2609
2601
  * (methods, path, name, domain, middleware names, and the `[controller, method]` action).
2610
2602
  *
2611
- * Closures cannot be serialized. Mirroring Laravel's `route:cache` — which aborts with
2603
+ * Closures cannot be serialized. Mirroring the conventional `route:cache` — which aborts with
2612
2604
  * "Unable to prepare route … for serialization. Uses Closure." — this **throws** when any route
2613
2605
  * uses a closure handler, rather than silently dropping it, so a cache is always complete or
2614
2606
  * absent. Rehydrate with {@link Router.loadCache} or {@link Router.fromCache}.
@@ -2818,7 +2810,7 @@ var Router = class _Router {
2818
2810
  return this.signingKey;
2819
2811
  }
2820
2812
  /**
2821
- * Build a signed URL for the named route. The Laravel `URL::signedRoute()` equivalent: the route
2813
+ * Build a signed URL for the named route. The `URL::signedRoute()` equivalent: the route
2822
2814
  * URL is generated as usual, an optional `expires` (a {@link Date} or unix-seconds number) is
2823
2815
  * appended, and an HMAC `signature` over the canonical URL is added last. Verify it later with
2824
2816
  * {@link Router.hasValidSignature}.
@@ -2834,7 +2826,7 @@ var Router = class _Router {
2834
2826
  return `${pathname}?${search.toString()}`;
2835
2827
  }
2836
2828
  /**
2837
- * Build a signed URL that expires after `expiresIn` seconds from now. The Laravel
2829
+ * Build a signed URL that expires after `expiresIn` seconds from now. The conventional
2838
2830
  * `URL::temporarySignedRoute()` equivalent (with the expiry expressed in seconds rather than a
2839
2831
  * `DateTime`/minutes).
2840
2832
  */
@@ -2867,8 +2859,7 @@ var Router = class _Router {
2867
2859
  return this.validateSignature(req.url()) === "valid";
2868
2860
  }
2869
2861
  /**
2870
- * A middleware that aborts unsigned/invalid/expired requests with a `403` (the Laravel
2871
- * `signed` / `ValidateSignature` middleware). On a valid signature it passes control inward.
2862
+ * A middleware that aborts unsigned/invalid/expired requests with a `403`. On a valid signature it passes control inward.
2872
2863
  */
2873
2864
  signedMiddleware() {
2874
2865
  return (req, next) => {
@@ -3039,7 +3030,7 @@ function throttle(options) {
3039
3030
  const decaySeconds = options.decaySeconds ?? 60;
3040
3031
  const keyFor = options.key ?? ((req) => `${req.ip() ?? "unknown"}|${req.method()}|${req.path()}`);
3041
3032
  return async (req, next) => {
3042
- const key = `mason-throttle:${keyFor(req)}`;
3033
+ const key = `plinth-throttle:${keyFor(req)}`;
3043
3034
  if (options.limiter.tooManyAttempts(key, max)) {
3044
3035
  const retryAfter = options.limiter.availableIn(key);
3045
3036
  return Response.json({ message: "Too Many Attempts." }, 429).withHeaders({