lambder 5.1.2 → 5.1.3

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.
@@ -297,7 +297,7 @@ export default class Lambder<TSessionData = any, _TContract extends Record<strin
297
297
  addSessionRoute<TPath extends Path>(condition: TPath, actionFn: (ctx: LambderSessionRenderContext<any, TSessionData, PathParamsOf<TPath>>, resolver: LambderResolver) => MaybePromise<LambderResponse>): this;
298
298
  addSessionRoute(condition: RegExp | ConditionFunction | LambderRouteMatcher, actionFn: SessionActionFunction<TSessionData>): this;
299
299
  use<_TNewContract extends Record<string, any>>(plugin: (lambder: Lambder<TSessionData, _TContract, any, any, any, any, any>) => Lambder<TSessionData, _TNewContract, any, any, any, any, any>): Lambder<TSessionData, _TNewContract extends _TContract ? _TNewContract : (_TContract & _TNewContract), _TRateLimitPolicies, _TGuards, _TIdempotencyEnabled, _TSessionGuardsRequired, _TPublicGuardsRequired>;
300
- addApi<TName extends string, TInput extends z.ZodTypeAny, TOutput extends z.ZodTypeAny, const TRateOpt extends LambderRateLimitOption<_TRateLimitPolicies, z.infer<TInput>, false> = never, const TGuardsOpt extends LambderGuardsOption<_TGuards, z.infer<TInput>, false> = never>(name: TName, schema: {
300
+ addApi<TName extends string, TInput extends z.ZodType, TOutput extends z.ZodType, const TRateOpt extends LambderRateLimitOption<_TRateLimitPolicies, z.infer<TInput>, false> = never, const TGuardsOpt extends LambderGuardsOption<_TGuards, z.infer<TInput>, false> = never>(name: TName, schema: {
301
301
  input: TInput;
302
302
  output: TOutput;
303
303
  } & {
@@ -308,7 +308,7 @@ export default class Lambder<TSessionData = any, _TContract extends Record<strin
308
308
  ttlSeconds?: number;
309
309
  }) : never;
310
310
  } & LambderRequirableGuardsField<_TPublicGuardsRequired, TGuardsOpt>, handler: (ctx: LambderRenderContext<z.infer<TInput>, Record<string, string>, LambderGuardDataOf<_TGuards, TGuardsOpt>>, resolver: LambderResolver<z.infer<TOutput>>) => MaybePromise<LambderResponse>): Lambder<TSessionData, MergeContract<_TContract, TName, z.infer<TInput>, z.infer<TOutput>, LambderGuardInputsOf<_TGuards, TGuardsOpt>, TGuardsOpt>, _TRateLimitPolicies, _TGuards, _TIdempotencyEnabled, _TSessionGuardsRequired, _TPublicGuardsRequired>;
311
- addSessionApi<TName extends string, TInput extends z.ZodTypeAny, TOutput extends z.ZodTypeAny, const TRateOpt extends LambderRateLimitOption<_TRateLimitPolicies, z.infer<TInput>, true> = never, const TGuardsOpt extends LambderGuardsOption<_TGuards, z.infer<TInput>, true> = never>(name: TName, schema: {
311
+ addSessionApi<TName extends string, TInput extends z.ZodType, TOutput extends z.ZodType, const TRateOpt extends LambderRateLimitOption<_TRateLimitPolicies, z.infer<TInput>, true> = never, const TGuardsOpt extends LambderGuardsOption<_TGuards, z.infer<TInput>, true> = never>(name: TName, schema: {
312
312
  input: TInput;
313
313
  output: TOutput;
314
314
  } & {
@@ -36,7 +36,7 @@ import type { LambderResponse } from "../core/LambderResponse.js";
36
36
  * and the handler refuses by throwing (typically refuse()/LambderApiError).
37
37
  * Build with lambderGuard() so the handler's payload/ctx/param types line up.
38
38
  */
39
- export type LambderApiGuard<TInput extends z.ZodTypeAny = z.ZodTypeAny, TParam = any, TOutput = any> = {
39
+ export type LambderApiGuard<TInput extends z.ZodType = z.ZodType, TParam = any, TOutput = any> = {
40
40
  apiInput: TInput;
41
41
  guardInput?: undefined;
42
42
  session?: boolean;
@@ -61,7 +61,7 @@ type GuardSessionCtx = LambderSessionRenderContext<any, any>;
61
61
  * inferred from the handler's 4th argument annotation; the output from its
62
62
  * return type.
63
63
  */
64
- export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undefined, TOutput = void>(guard: {
64
+ export declare function lambderGuard<TInput extends z.ZodType, TParam = undefined, TOutput = void>(guard: {
65
65
  apiInput: TInput;
66
66
  session: true;
67
67
  handler: (ctx: GuardSessionCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
@@ -71,7 +71,7 @@ export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undef
71
71
  session: true;
72
72
  handler: (ctx: GuardSessionCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
73
73
  };
74
- export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undefined, TOutput = void>(guard: {
74
+ export declare function lambderGuard<TInput extends z.ZodType, TParam = undefined, TOutput = void>(guard: {
75
75
  apiInput: TInput;
76
76
  handler: (ctx: GuardCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
77
77
  }): {
@@ -80,7 +80,7 @@ export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undef
80
80
  session?: undefined;
81
81
  handler: (ctx: GuardCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
82
82
  };
83
- export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undefined, TOutput = void>(guard: {
83
+ export declare function lambderGuard<TInput extends z.ZodType, TParam = undefined, TOutput = void>(guard: {
84
84
  guardInput: TInput;
85
85
  session: true;
86
86
  handler: (ctx: GuardSessionCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
@@ -90,7 +90,7 @@ export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undef
90
90
  session: true;
91
91
  handler: (ctx: GuardSessionCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
92
92
  };
93
- export declare function lambderGuard<TInput extends z.ZodTypeAny, TParam = undefined, TOutput = void>(guard: {
93
+ export declare function lambderGuard<TInput extends z.ZodType, TParam = undefined, TOutput = void>(guard: {
94
94
  guardInput: TInput;
95
95
  handler: (ctx: GuardCtx, payload: z.output<TInput>, res: LambderResolver, param: TParam) => TOutput | Promise<TOutput>;
96
96
  }): {
@@ -126,11 +126,11 @@ type LambderGuardOutputOf<G> = G extends {
126
126
  } ? Awaited<R> : never;
127
127
  /** Per-guard metadata carried on the Lambder instance: input mode, session requirement, param type, output type. */
128
128
  export type LambderGuardMeta<G> = (G extends {
129
- apiInput: infer S extends z.ZodTypeAny;
129
+ apiInput: infer S extends z.ZodType;
130
130
  } ? {
131
131
  apiInput: z.output<S>;
132
132
  } : G extends {
133
- guardInput: infer S extends z.ZodTypeAny;
133
+ guardInput: infer S extends z.ZodType;
134
134
  } ? {
135
135
  guardInput: z.output<S>;
136
136
  } : {}) & (G extends {
@@ -237,7 +237,7 @@ export type LambderInputValidationRefusal = (ctx: LambderRenderContext, resolver
237
237
  * same one regular input validation answers. Shared with the rate-limit
238
238
  * engine's apiInput-keyed policies.
239
239
  */
240
- export declare const parsePreflightSlice: (input: z.ZodTypeAny, value: unknown, ctx: LambderRenderContext, resolver: LambderResolver, onInvalid: LambderInputValidationRefusal) => Promise<unknown>;
240
+ export declare const parsePreflightSlice: (input: z.ZodType, value: unknown, ctx: LambderRenderContext, resolver: LambderResolver, onInvalid: LambderInputValidationRefusal) => Promise<unknown>;
241
241
  /**
242
242
  * Runtime side of the guards subsystem: holds the defined guards, asserts
243
243
  * API registrations against them at startup, and executes an API's declared
@@ -14,7 +14,7 @@ import { type LambderInputValidationRefusal } from "./LambderApiGuards.js";
14
14
  * stays the single owner of the field. Build with lambderRateLimitKey() so
15
15
  * the handler's payload type follows `apiInput`.
16
16
  */
17
- export type LambderRateLimitKeyFn<TInput extends z.ZodTypeAny = z.ZodTypeAny> = {
17
+ export type LambderRateLimitKeyFn<TInput extends z.ZodType = z.ZodType> = {
18
18
  apiInput: TInput;
19
19
  handler: (ctx: LambderRenderContext, payload: z.output<TInput>) => string | Promise<string>;
20
20
  } | {
@@ -26,7 +26,7 @@ export type LambderRateLimitKeyFn<TInput extends z.ZodTypeAny = z.ZodTypeAny> =
26
26
  * inside one literal. Returns the exact union member so type extraction can
27
27
  * see the schema.
28
28
  */
29
- export declare function lambderRateLimitKey<TInput extends z.ZodTypeAny>(key: {
29
+ export declare function lambderRateLimitKey<TInput extends z.ZodType>(key: {
30
30
  apiInput: TInput;
31
31
  handler: (ctx: LambderRenderContext, payload: z.output<TInput>) => string | Promise<string>;
32
32
  }): {
@@ -78,7 +78,7 @@ export type LambderAllowedPolicyNames<TPolicies, TPayload, TIncludeSession exten
78
78
  per: "session";
79
79
  } ? (TIncludeSession extends true ? K : never) : TPolicies[K] extends {
80
80
  per: {
81
- apiInput: infer S extends z.ZodTypeAny;
81
+ apiInput: infer S extends z.ZodType;
82
82
  };
83
83
  } ? (TPayload extends z.output<S> ? K : never) : K;
84
84
  }[keyof TPolicies] & string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambder",
3
- "version": "5.1.2",
3
+ "version": "5.1.3",
4
4
  "description": "Opinionated serverless web framework for TypeScript on AWS Lambda: type-safe APIs from Zod schemas, DynamoDB sessions, and declarative rate limits, authorization guards and idempotency.",
5
5
  "keywords": [
6
6
  "lambda",
@@ -90,7 +90,7 @@
90
90
  "@aws-sdk/client-s3": "^3.574.0",
91
91
  "@aws-sdk/lib-dynamodb": "^3.574.0",
92
92
  "msw": "^2.0.0",
93
- "zod": "^4.1.12"
93
+ "zod": "^4.6.2"
94
94
  },
95
95
  "peerDependenciesMeta": {
96
96
  "@aws-sdk/client-dynamodb": {
@@ -125,6 +125,6 @@
125
125
  "eslint": "^8.57.0",
126
126
  "typescript": "^5.9.3",
127
127
  "vitest": "^3.2.4",
128
- "zod": "^4.1.12"
128
+ "zod": "^4.6.2"
129
129
  }
130
130
  }