better-call 1.0.25-beta.3 → 1.0.26-beta.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/node.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Router } from "./router-DOTL_ENw.cjs";
1
+ import { Router } from "./router-CeSGPJlX.cjs";
2
2
  import { IncomingMessage, ServerResponse } from "node:http";
3
3
 
4
4
  //#region src/adapters/node/request.d.ts
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Router } from "./router-CC_up1_c.js";
1
+ import { Router } from "./router-BH6Wndse.js";
2
2
  import { IncomingMessage, ServerResponse } from "node:http";
3
3
 
4
4
  //#region src/adapters/node/request.d.ts
@@ -320,6 +320,7 @@ type InferMiddlewareQuery<Options extends MiddlewareOptions> = Options["query"]
320
320
  type InputContext<Path extends string, Options extends EndpointOptions> = InferBodyInput<Options> & InferInputMethod<Options> & InferQueryInput<Options> & InferParamInput<Path> & InferRequestInput<Options> & InferHeadersInput<Options> & {
321
321
  asResponse?: boolean;
322
322
  returnHeaders?: boolean;
323
+ returnStatus?: boolean;
323
324
  use?: Middleware[];
324
325
  path?: string;
325
326
  };
@@ -380,6 +381,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
380
381
  } & {
381
382
  errorStack: string | undefined;
382
383
  };
384
+ setStatus: (status: Status) => void;
383
385
  json: (json: Record<string, any>, routerResponse?: {
384
386
  status?: number;
385
387
  headers?: Record<string, string>;
@@ -387,8 +389,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
387
389
  body?: Record<string, any>;
388
390
  } | Response) => Record<string, any>;
389
391
  responseHeaders: Headers;
392
+ responseStatus: Status | undefined;
390
393
  asResponse?: boolean;
391
394
  returnHeaders?: boolean;
395
+ returnStatus?: boolean;
392
396
  use?: Middleware[];
393
397
  } | {
394
398
  body: any;
@@ -441,6 +445,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
441
445
  } & {
442
446
  errorStack: string | undefined;
443
447
  };
448
+ setStatus: (status: Status) => void;
444
449
  json: (json: Record<string, any>, routerResponse?: {
445
450
  status?: number;
446
451
  headers?: Record<string, string>;
@@ -448,8 +453,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
448
453
  body?: Record<string, any>;
449
454
  } | Response) => Record<string, any>;
450
455
  responseHeaders: Headers;
456
+ responseStatus: Status | undefined;
451
457
  asResponse?: boolean;
452
458
  returnHeaders?: boolean;
459
+ returnStatus?: boolean;
453
460
  use?: Middleware[];
454
461
  } | {
455
462
  body: any;
@@ -502,6 +509,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
502
509
  } & {
503
510
  errorStack: string | undefined;
504
511
  };
512
+ setStatus: (status: Status) => void;
505
513
  json: (json: Record<string, any>, routerResponse?: {
506
514
  status?: number;
507
515
  headers?: Record<string, string>;
@@ -509,8 +517,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
509
517
  body?: Record<string, any>;
510
518
  } | Response) => Record<string, any>;
511
519
  responseHeaders: Headers;
520
+ responseStatus: Status | undefined;
512
521
  asResponse?: boolean;
513
522
  returnHeaders?: boolean;
523
+ returnStatus?: boolean;
514
524
  use?: Middleware[];
515
525
  } | {
516
526
  body: any;
@@ -563,6 +573,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
563
573
  } & {
564
574
  errorStack: string | undefined;
565
575
  };
576
+ setStatus: (status: Status) => void;
566
577
  json: (json: Record<string, any>, routerResponse?: {
567
578
  status?: number;
568
579
  headers?: Record<string, string>;
@@ -570,8 +581,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
570
581
  body?: Record<string, any>;
571
582
  } | Response) => Record<string, any>;
572
583
  responseHeaders: Headers;
584
+ responseStatus: Status | undefined;
573
585
  asResponse?: boolean;
574
586
  returnHeaders?: boolean;
587
+ returnStatus?: boolean;
575
588
  use?: Middleware[];
576
589
  }>;
577
590
  //#endregion
@@ -1029,6 +1042,10 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
1029
1042
  * If it's called outside of a request it will just be ignored.
1030
1043
  */
1031
1044
  setHeader: (key: string, value: string) => void;
1045
+ /**
1046
+ * Set the response status code
1047
+ */
1048
+ setStatus: (status: Status) => void;
1032
1049
  /**
1033
1050
  * Get header
1034
1051
  *
@@ -1124,16 +1141,43 @@ type StrictEndpoint<Path extends string, Options extends EndpointOptions, R = an
1124
1141
  asResponse: true;
1125
1142
  }): Promise<Response>;
1126
1143
  (context: InputContext<Path, Options> & {
1127
- asResponse: false;
1128
- returnHeaders?: false;
1144
+ returnHeaders: true;
1145
+ returnStatus: true;
1146
+ }): Promise<{
1147
+ headers: Headers;
1148
+ status: number;
1149
+ response: Awaited<R>;
1150
+ }>;
1151
+ (context: InputContext<Path, Options> & {
1152
+ returnHeaders: true;
1153
+ returnStatus: false;
1154
+ }): Promise<{
1155
+ headers: Headers;
1156
+ response: Awaited<R>;
1157
+ }>;
1158
+ (context: InputContext<Path, Options> & {
1159
+ returnHeaders: false;
1160
+ returnStatus: true;
1161
+ }): Promise<{
1162
+ status: number;
1163
+ response: Awaited<R>;
1164
+ }>;
1165
+ (context: InputContext<Path, Options> & {
1166
+ returnHeaders: false;
1167
+ returnStatus: false;
1129
1168
  }): Promise<R>;
1130
1169
  (context: InputContext<Path, Options> & {
1131
- asResponse?: false;
1132
1170
  returnHeaders: true;
1133
1171
  }): Promise<{
1134
1172
  headers: Headers;
1135
1173
  response: Awaited<R>;
1136
1174
  }>;
1175
+ (context: InputContext<Path, Options> & {
1176
+ returnStatus: true;
1177
+ }): Promise<{
1178
+ status: number;
1179
+ response: Awaited<R>;
1180
+ }>;
1137
1181
  (context?: InputContext<Path, Options>): Promise<R>;
1138
1182
  options: Options;
1139
1183
  path: Path;
@@ -1216,4 +1260,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1216
1260
  type Router = ReturnType<typeof createRouter>;
1217
1261
  //#endregion
1218
1262
  export { APIError, BetterCallError, CookieOptions, CookiePrefixOptions, Endpoint, EndpointBaseOptions, EndpointBodyMethodOptions, EndpointContext, EndpointOptions, HTTPMethod, HasRequiredKeys, InferBody, InferBodyInput, InferHeaders, InferHeadersInput, InferInputMethod, InferMethod, InferMiddlewareBody, InferMiddlewareQuery, InferParam, InferParamInput, InferParamPath, InferParamWildCard, InferQuery, InferQueryInput, InferRequest, InferRequestInput, InferUse, InputContext, IsEmptyObject, MergeObject, Method, Middleware, MiddlewareContext, MiddlewareInputContext, MiddlewareOptions, MiddlewareResponse, OpenAPIParameter, OpenAPISchemaType, Path$1 as Path, Prettify, RequiredKeysOf, Router, RouterConfig, StandardSchemaV1, Status, StrictEndpoint, UnionToIntersection, _statusCode, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie };
1219
- //# sourceMappingURL=router-CC_up1_c.d.ts.map
1263
+ //# sourceMappingURL=router-BH6Wndse.d.ts.map
@@ -320,6 +320,7 @@ type InferMiddlewareQuery<Options extends MiddlewareOptions> = Options["query"]
320
320
  type InputContext<Path extends string, Options extends EndpointOptions> = InferBodyInput<Options> & InferInputMethod<Options> & InferQueryInput<Options> & InferParamInput<Path> & InferRequestInput<Options> & InferHeadersInput<Options> & {
321
321
  asResponse?: boolean;
322
322
  returnHeaders?: boolean;
323
+ returnStatus?: boolean;
323
324
  use?: Middleware[];
324
325
  path?: string;
325
326
  };
@@ -380,6 +381,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
380
381
  } & {
381
382
  errorStack: string | undefined;
382
383
  };
384
+ setStatus: (status: Status) => void;
383
385
  json: (json: Record<string, any>, routerResponse?: {
384
386
  status?: number;
385
387
  headers?: Record<string, string>;
@@ -387,8 +389,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
387
389
  body?: Record<string, any>;
388
390
  } | Response) => Record<string, any>;
389
391
  responseHeaders: Headers;
392
+ responseStatus: Status | undefined;
390
393
  asResponse?: boolean;
391
394
  returnHeaders?: boolean;
395
+ returnStatus?: boolean;
392
396
  use?: Middleware[];
393
397
  } | {
394
398
  body: any;
@@ -441,6 +445,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
441
445
  } & {
442
446
  errorStack: string | undefined;
443
447
  };
448
+ setStatus: (status: Status) => void;
444
449
  json: (json: Record<string, any>, routerResponse?: {
445
450
  status?: number;
446
451
  headers?: Record<string, string>;
@@ -448,8 +453,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
448
453
  body?: Record<string, any>;
449
454
  } | Response) => Record<string, any>;
450
455
  responseHeaders: Headers;
456
+ responseStatus: Status | undefined;
451
457
  asResponse?: boolean;
452
458
  returnHeaders?: boolean;
459
+ returnStatus?: boolean;
453
460
  use?: Middleware[];
454
461
  } | {
455
462
  body: any;
@@ -502,6 +509,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
502
509
  } & {
503
510
  errorStack: string | undefined;
504
511
  };
512
+ setStatus: (status: Status) => void;
505
513
  json: (json: Record<string, any>, routerResponse?: {
506
514
  status?: number;
507
515
  headers?: Record<string, string>;
@@ -509,8 +517,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
509
517
  body?: Record<string, any>;
510
518
  } | Response) => Record<string, any>;
511
519
  responseHeaders: Headers;
520
+ responseStatus: Status | undefined;
512
521
  asResponse?: boolean;
513
522
  returnHeaders?: boolean;
523
+ returnStatus?: boolean;
514
524
  use?: Middleware[];
515
525
  } | {
516
526
  body: any;
@@ -563,6 +573,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
563
573
  } & {
564
574
  errorStack: string | undefined;
565
575
  };
576
+ setStatus: (status: Status) => void;
566
577
  json: (json: Record<string, any>, routerResponse?: {
567
578
  status?: number;
568
579
  headers?: Record<string, string>;
@@ -570,8 +581,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
570
581
  body?: Record<string, any>;
571
582
  } | Response) => Record<string, any>;
572
583
  responseHeaders: Headers;
584
+ responseStatus: Status | undefined;
573
585
  asResponse?: boolean;
574
586
  returnHeaders?: boolean;
587
+ returnStatus?: boolean;
575
588
  use?: Middleware[];
576
589
  }>;
577
590
  //#endregion
@@ -1029,6 +1042,10 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
1029
1042
  * If it's called outside of a request it will just be ignored.
1030
1043
  */
1031
1044
  setHeader: (key: string, value: string) => void;
1045
+ /**
1046
+ * Set the response status code
1047
+ */
1048
+ setStatus: (status: Status) => void;
1032
1049
  /**
1033
1050
  * Get header
1034
1051
  *
@@ -1124,16 +1141,43 @@ type StrictEndpoint<Path extends string, Options extends EndpointOptions, R = an
1124
1141
  asResponse: true;
1125
1142
  }): Promise<Response>;
1126
1143
  (context: InputContext<Path, Options> & {
1127
- asResponse: false;
1128
- returnHeaders?: false;
1144
+ returnHeaders: true;
1145
+ returnStatus: true;
1146
+ }): Promise<{
1147
+ headers: Headers;
1148
+ status: number;
1149
+ response: Awaited<R>;
1150
+ }>;
1151
+ (context: InputContext<Path, Options> & {
1152
+ returnHeaders: true;
1153
+ returnStatus: false;
1154
+ }): Promise<{
1155
+ headers: Headers;
1156
+ response: Awaited<R>;
1157
+ }>;
1158
+ (context: InputContext<Path, Options> & {
1159
+ returnHeaders: false;
1160
+ returnStatus: true;
1161
+ }): Promise<{
1162
+ status: number;
1163
+ response: Awaited<R>;
1164
+ }>;
1165
+ (context: InputContext<Path, Options> & {
1166
+ returnHeaders: false;
1167
+ returnStatus: false;
1129
1168
  }): Promise<R>;
1130
1169
  (context: InputContext<Path, Options> & {
1131
- asResponse?: false;
1132
1170
  returnHeaders: true;
1133
1171
  }): Promise<{
1134
1172
  headers: Headers;
1135
1173
  response: Awaited<R>;
1136
1174
  }>;
1175
+ (context: InputContext<Path, Options> & {
1176
+ returnStatus: true;
1177
+ }): Promise<{
1178
+ status: number;
1179
+ response: Awaited<R>;
1180
+ }>;
1137
1181
  (context?: InputContext<Path, Options>): Promise<R>;
1138
1182
  options: Options;
1139
1183
  path: Path;
@@ -1216,4 +1260,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1216
1260
  type Router = ReturnType<typeof createRouter>;
1217
1261
  //#endregion
1218
1262
  export { APIError, BetterCallError, CookieOptions, CookiePrefixOptions, Endpoint, EndpointBaseOptions, EndpointBodyMethodOptions, EndpointContext, EndpointOptions, HTTPMethod, HasRequiredKeys, InferBody, InferBodyInput, InferHeaders, InferHeadersInput, InferInputMethod, InferMethod, InferMiddlewareBody, InferMiddlewareQuery, InferParam, InferParamInput, InferParamPath, InferParamWildCard, InferQuery, InferQueryInput, InferRequest, InferRequestInput, InferUse, InputContext, IsEmptyObject, MergeObject, Method, Middleware, MiddlewareContext, MiddlewareInputContext, MiddlewareOptions, MiddlewareResponse, OpenAPIParameter, OpenAPISchemaType, Path$1 as Path, Prettify, RequiredKeysOf, Router, RouterConfig, StandardSchemaV1, Status, StrictEndpoint, UnionToIntersection, _statusCode, createEndpoint, createInternalContext, createMiddleware, createRouter, generator, getCookieKey, getHTML, hideInternalStackFrames, makeErrorForHideStackFrame, parseCookies, serializeCookie, serializeSignedCookie };
1219
- //# sourceMappingURL=router-DOTL_ENw.d.cts.map
1263
+ //# sourceMappingURL=router-CeSGPJlX.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-call",
3
- "version": "1.0.25-beta.3",
3
+ "version": "1.0.26-beta.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,8 +33,7 @@
33
33
  "@better-auth/utils": "^0.3.0",
34
34
  "@better-fetch/fetch": "^1.1.4",
35
35
  "rou3": "^0.5.1",
36
- "set-cookie-parser": "^2.7.1",
37
- "uncrypto": "^0.1.3"
36
+ "set-cookie-parser": "^2.7.1"
38
37
  },
39
38
  "exports": {
40
39
  ".": {