@aklinker1/zeta 2.1.0 → 2.1.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aklinker1/zeta",
3
3
  "description": "Composable, testable, OpenAPI-first backend framework with validation built-in",
4
- "version": "2.1.0",
4
+ "version": "2.1.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "packageManager": "bun@1.3.5",
@@ -59,7 +59,7 @@
59
59
  "@opentelemetry/sdk-trace-node": "^2.5.0",
60
60
  "@opentelemetry/semantic-conventions": "^1.39.0",
61
61
  "@types/bun": "latest",
62
- "@typescript/native-preview": "^7.0.0-dev.20251114.1",
62
+ "@typescript/native-preview": "^7.0.0-dev.20260202.1",
63
63
  "changelogen": "^0.6.2",
64
64
  "cookie": "^1.1.1",
65
65
  "dedent": "^1.7.1",
@@ -1,9 +1,9 @@
1
- import type { MaybePromise } from "elysia";
2
1
  import { getMeta } from "../meta";
3
2
  import type {
4
3
  CompiledRouteHandler,
5
4
  LifeCycleHookName,
6
5
  LifeCycleHooks,
6
+ MaybePromise,
7
7
  OnBeforeHandleContext,
8
8
  RouteDef,
9
9
  SchemaAdapter,
@@ -11,6 +11,10 @@ export class Context {
11
11
 
12
12
  matchedRoute: MatchedRoute<RouterData> | undefined;
13
13
 
14
+ // Private storage for overwritten values
15
+ #params: Record<string, any> | undefined;
16
+ #query: Record<string, any> | undefined;
17
+
14
18
  constructor(
15
19
  public request: Request,
16
20
  public path: string,
@@ -21,14 +25,28 @@ export class Context {
21
25
  return new URL(this.request.url, this.origin);
22
26
  }
23
27
 
24
- get params(): Record<string, string> {
28
+ get params(): Record<string, any> {
29
+ if (this.#params !== undefined) {
30
+ return this.#params;
31
+ }
25
32
  return this.matchedRoute?.params ? getRawParams(this.matchedRoute) : {};
26
33
  }
27
34
 
28
- get query(): Record<string, string> {
35
+ set params(value: Record<string, any>) {
36
+ this.#params = value;
37
+ }
38
+
39
+ get query(): Record<string, any> {
40
+ if (this.#query !== undefined) {
41
+ return this.#query;
42
+ }
29
43
  return this.request.url.includes("?") ? getRawQuery(this.request) : {};
30
44
  }
31
45
 
46
+ set query(value: Record<string, any>) {
47
+ this.#query = value;
48
+ }
49
+
32
50
  get route(): string | undefined {
33
51
  return this.matchedRoute?.data.route;
34
52
  }
@@ -96,7 +96,7 @@ export function getRawParams(
96
96
  for (const key in params) {
97
97
  // Rename rou3's _ to ** to match type-system
98
98
  const outKey = key === "_" ? "**" : key;
99
- res[outKey] = decodeURIComponent(params[key]);
99
+ res[outKey] = decodeURIComponent(params[key]!);
100
100
  }
101
101
  return res;
102
102
  }