sst-http 0.2.3 → 0.4.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.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ Auth: () => Auth,
23
24
  Body: () => Body,
24
25
  Delete: () => Delete,
25
26
  FirebaseAuth: () => FirebaseAuth,
@@ -37,6 +38,7 @@ __export(index_exports, {
37
38
  Res: () => Res,
38
39
  configureRoutes: () => configureRoutes,
39
40
  createHandler: () => createHandler,
41
+ handleError: () => handleError,
40
42
  json: () => json,
41
43
  noContent: () => noContent,
42
44
  text: () => text
@@ -316,6 +318,10 @@ function buildHandlerArguments(entry, ctx, getBody) {
316
318
  args[meta.index] = ctx.response;
317
319
  break;
318
320
  }
321
+ case "auth": {
322
+ args[meta.index] = ctx.auth;
323
+ break;
324
+ }
319
325
  default: {
320
326
  args[meta.index] = ctx;
321
327
  }
@@ -515,6 +521,9 @@ function FirebaseAuth(options2) {
515
521
  registerFirebaseAuth(handler, options2);
516
522
  };
517
523
  }
524
+ function Auth() {
525
+ return createParameterDecorator("auth");
526
+ }
518
527
  function Body(schema) {
519
528
  return createParameterDecorator("body", schema);
520
529
  }
@@ -535,6 +544,7 @@ function Res() {
535
544
  }
536
545
  // Annotate the CommonJS export names for ESM import in node:
537
546
  0 && (module.exports = {
547
+ Auth,
538
548
  Body,
539
549
  Delete,
540
550
  FirebaseAuth,
@@ -552,6 +562,7 @@ function Res() {
552
562
  Res,
553
563
  configureRoutes,
554
564
  createHandler,
565
+ handleError,
555
566
  json,
556
567
  noContent,
557
568
  text
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2 } from 'aws-lambda';
2
- import { c as ResponseLike, F as FirebaseAuthOptions, d as RouteOptions } from './types-D69iuoxv.cjs';
3
- export { g as FirebaseAuthMetadata, e as Handler, f as HandlerContext, H as HttpMethod } from './types-D69iuoxv.cjs';
2
+ import { c as ResponseLike, F as FirebaseAuthOptions, d as RouteOptions } from './types-BF3w-wTx.cjs';
3
+ export { g as FirebaseAuthMetadata, h as FirebaseClaims, e as Handler, f as HandlerContext, H as HttpMethod } from './types-BF3w-wTx.cjs';
4
4
  import { ZodTypeAny } from 'zod/v4';
5
5
 
6
6
  declare class HttpError extends Error {
@@ -19,6 +19,7 @@ declare function noContent(headers?: Record<string, string>): ResponseLike;
19
19
  type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2;
20
20
  type LambdaResult = APIGatewayProxyResult | APIGatewayProxyResultV2;
21
21
  declare function createHandler(): (event: LambdaEvent, lambdaContext: unknown) => Promise<LambdaResult>;
22
+ declare function handleError(error: unknown, preferV2: boolean): LambdaResult;
22
23
 
23
24
  type LegacyDecorator = (target: unknown, propertyKey?: string | symbol, descriptor?: PropertyDescriptor) => void;
24
25
  type LegacyParameterDecorator = (target: unknown, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
@@ -30,6 +31,7 @@ declare const Delete: (path?: string) => LegacyDecorator;
30
31
  declare const Head: (path?: string) => LegacyDecorator;
31
32
  declare const Options: (path?: string) => LegacyDecorator;
32
33
  declare function FirebaseAuth(options?: FirebaseAuthOptions): LegacyDecorator;
34
+ declare function Auth(): LegacyParameterDecorator;
33
35
  declare function Body(schema?: ZodTypeAny): LegacyParameterDecorator;
34
36
  declare function Query(): LegacyParameterDecorator;
35
37
  declare function Param(): LegacyParameterDecorator;
@@ -39,4 +41,4 @@ declare function Res(): LegacyParameterDecorator;
39
41
 
40
42
  declare function configureRoutes(next?: RouteOptions): void;
41
43
 
42
- export { Body, Delete, FirebaseAuth, FirebaseAuthOptions, Get, Head, Headers, HttpError, Options, Param, Patch, Post, Put, Query, Req, Res, ResponseLike, RouteOptions, configureRoutes, createHandler, json, noContent, text };
44
+ export { Auth, Body, Delete, FirebaseAuth, FirebaseAuthOptions, Get, Head, Headers, HttpError, Options, Param, Patch, Post, Put, Query, Req, Res, ResponseLike, RouteOptions, configureRoutes, createHandler, handleError, json, noContent, text };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2 } from 'aws-lambda';
2
- import { c as ResponseLike, F as FirebaseAuthOptions, d as RouteOptions } from './types-D69iuoxv.js';
3
- export { g as FirebaseAuthMetadata, e as Handler, f as HandlerContext, H as HttpMethod } from './types-D69iuoxv.js';
2
+ import { c as ResponseLike, F as FirebaseAuthOptions, d as RouteOptions } from './types-BF3w-wTx.js';
3
+ export { g as FirebaseAuthMetadata, h as FirebaseClaims, e as Handler, f as HandlerContext, H as HttpMethod } from './types-BF3w-wTx.js';
4
4
  import { ZodTypeAny } from 'zod/v4';
5
5
 
6
6
  declare class HttpError extends Error {
@@ -19,6 +19,7 @@ declare function noContent(headers?: Record<string, string>): ResponseLike;
19
19
  type LambdaEvent = APIGatewayProxyEvent | APIGatewayProxyEventV2;
20
20
  type LambdaResult = APIGatewayProxyResult | APIGatewayProxyResultV2;
21
21
  declare function createHandler(): (event: LambdaEvent, lambdaContext: unknown) => Promise<LambdaResult>;
22
+ declare function handleError(error: unknown, preferV2: boolean): LambdaResult;
22
23
 
23
24
  type LegacyDecorator = (target: unknown, propertyKey?: string | symbol, descriptor?: PropertyDescriptor) => void;
24
25
  type LegacyParameterDecorator = (target: unknown, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
@@ -30,6 +31,7 @@ declare const Delete: (path?: string) => LegacyDecorator;
30
31
  declare const Head: (path?: string) => LegacyDecorator;
31
32
  declare const Options: (path?: string) => LegacyDecorator;
32
33
  declare function FirebaseAuth(options?: FirebaseAuthOptions): LegacyDecorator;
34
+ declare function Auth(): LegacyParameterDecorator;
33
35
  declare function Body(schema?: ZodTypeAny): LegacyParameterDecorator;
34
36
  declare function Query(): LegacyParameterDecorator;
35
37
  declare function Param(): LegacyParameterDecorator;
@@ -39,4 +41,4 @@ declare function Res(): LegacyParameterDecorator;
39
41
 
40
42
  declare function configureRoutes(next?: RouteOptions): void;
41
43
 
42
- export { Body, Delete, FirebaseAuth, FirebaseAuthOptions, Get, Head, Headers, HttpError, Options, Param, Patch, Post, Put, Query, Req, Res, ResponseLike, RouteOptions, configureRoutes, createHandler, json, noContent, text };
44
+ export { Auth, Body, Delete, FirebaseAuth, FirebaseAuthOptions, Get, Head, Headers, HttpError, Options, Param, Patch, Post, Put, Query, Req, Res, ResponseLike, RouteOptions, configureRoutes, createHandler, handleError, json, noContent, text };
package/dist/index.js CHANGED
@@ -271,6 +271,10 @@ function buildHandlerArguments(entry, ctx, getBody) {
271
271
  args[meta.index] = ctx.response;
272
272
  break;
273
273
  }
274
+ case "auth": {
275
+ args[meta.index] = ctx.auth;
276
+ break;
277
+ }
274
278
  default: {
275
279
  args[meta.index] = ctx;
276
280
  }
@@ -470,6 +474,9 @@ function FirebaseAuth(options2) {
470
474
  registerFirebaseAuth(handler, options2);
471
475
  };
472
476
  }
477
+ function Auth() {
478
+ return createParameterDecorator("auth");
479
+ }
473
480
  function Body(schema) {
474
481
  return createParameterDecorator("body", schema);
475
482
  }
@@ -489,6 +496,7 @@ function Res() {
489
496
  return createParameterDecorator("res");
490
497
  }
491
498
  export {
499
+ Auth,
492
500
  Body,
493
501
  Delete,
494
502
  FirebaseAuth,
@@ -506,6 +514,7 @@ export {
506
514
  Res,
507
515
  configureRoutes,
508
516
  createHandler,
517
+ handleError,
509
518
  json,
510
519
  noContent,
511
520
  text
package/dist/infra.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HttpMethod, R as RoutesManifest } from './types-D69iuoxv.cjs';
2
- export { b as RoutesManifestAuth, a as RoutesManifestRoute } from './types-D69iuoxv.cjs';
1
+ import { H as HttpMethod, R as RoutesManifest } from './types-BF3w-wTx.cjs';
2
+ export { b as RoutesManifestAuth, a as RoutesManifestRoute } from './types-BF3w-wTx.cjs';
3
3
  import 'aws-lambda';
4
4
 
5
5
  type SstApiGateway = any;
package/dist/infra.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as HttpMethod, R as RoutesManifest } from './types-D69iuoxv.js';
2
- export { b as RoutesManifestAuth, a as RoutesManifestRoute } from './types-D69iuoxv.js';
1
+ import { H as HttpMethod, R as RoutesManifest } from './types-BF3w-wTx.js';
2
+ export { b as RoutesManifestAuth, a as RoutesManifestRoute } from './types-BF3w-wTx.js';
3
3
  import 'aws-lambda';
4
4
 
5
5
  type SstApiGateway = any;
@@ -51,4 +51,4 @@ type RoutesManifest = {
51
51
  routes: RoutesManifestRoute[];
52
52
  };
53
53
 
54
- export type { FirebaseAuthOptions as F, HttpMethod as H, RoutesManifest as R, RoutesManifestRoute as a, RoutesManifestAuth as b, ResponseLike as c, RouteOptions as d, Handler as e, HandlerContext as f, FirebaseAuthMetadata as g };
54
+ export type { FirebaseAuthOptions as F, HttpMethod as H, RoutesManifest as R, RoutesManifestRoute as a, RoutesManifestAuth as b, ResponseLike as c, RouteOptions as d, Handler as e, HandlerContext as f, FirebaseAuthMetadata as g, FirebaseClaims as h };
@@ -51,4 +51,4 @@ type RoutesManifest = {
51
51
  routes: RoutesManifestRoute[];
52
52
  };
53
53
 
54
- export type { FirebaseAuthOptions as F, HttpMethod as H, RoutesManifest as R, RoutesManifestRoute as a, RoutesManifestAuth as b, ResponseLike as c, RouteOptions as d, Handler as e, HandlerContext as f, FirebaseAuthMetadata as g };
54
+ export type { FirebaseAuthOptions as F, HttpMethod as H, RoutesManifest as R, RoutesManifestRoute as a, RoutesManifestAuth as b, ResponseLike as c, RouteOptions as d, Handler as e, HandlerContext as f, FirebaseAuthMetadata as g, FirebaseClaims as h };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst-http",
3
- "version": "0.2.3",
3
+ "version": "0.4.1",
4
4
  "description": "Decorator-based routing for SST v3 with a single Lambda and Firebase JWT authorizer.",
5
5
  "license": "MIT",
6
6
  "author": "",