better-call 1.0.25-beta.3 → 1.0.25

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-DeSuoHCx.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-DRUBbubk.js";
2
2
  import { IncomingMessage, ServerResponse } from "node:http";
3
3
 
4
4
  //#region src/adapters/node/request.d.ts
@@ -320,8 +320,8 @@ 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
- path?: string;
325
325
  };
326
326
  declare const createInternalContext: (context: InputContext<any, any>, {
327
327
  options,
@@ -380,6 +380,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
380
380
  } & {
381
381
  errorStack: string | undefined;
382
382
  };
383
+ setStatus: (status: Status) => void;
383
384
  json: (json: Record<string, any>, routerResponse?: {
384
385
  status?: number;
385
386
  headers?: Record<string, string>;
@@ -387,8 +388,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
387
388
  body?: Record<string, any>;
388
389
  } | Response) => Record<string, any>;
389
390
  responseHeaders: Headers;
391
+ responseStatus: Status | undefined;
390
392
  asResponse?: boolean;
391
393
  returnHeaders?: boolean;
394
+ returnStatus?: boolean;
392
395
  use?: Middleware[];
393
396
  } | {
394
397
  body: any;
@@ -441,6 +444,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
441
444
  } & {
442
445
  errorStack: string | undefined;
443
446
  };
447
+ setStatus: (status: Status) => void;
444
448
  json: (json: Record<string, any>, routerResponse?: {
445
449
  status?: number;
446
450
  headers?: Record<string, string>;
@@ -448,8 +452,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
448
452
  body?: Record<string, any>;
449
453
  } | Response) => Record<string, any>;
450
454
  responseHeaders: Headers;
455
+ responseStatus: Status | undefined;
451
456
  asResponse?: boolean;
452
457
  returnHeaders?: boolean;
458
+ returnStatus?: boolean;
453
459
  use?: Middleware[];
454
460
  } | {
455
461
  body: any;
@@ -502,6 +508,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
502
508
  } & {
503
509
  errorStack: string | undefined;
504
510
  };
511
+ setStatus: (status: Status) => void;
505
512
  json: (json: Record<string, any>, routerResponse?: {
506
513
  status?: number;
507
514
  headers?: Record<string, string>;
@@ -509,8 +516,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
509
516
  body?: Record<string, any>;
510
517
  } | Response) => Record<string, any>;
511
518
  responseHeaders: Headers;
519
+ responseStatus: Status | undefined;
512
520
  asResponse?: boolean;
513
521
  returnHeaders?: boolean;
522
+ returnStatus?: boolean;
514
523
  use?: Middleware[];
515
524
  } | {
516
525
  body: any;
@@ -563,6 +572,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
563
572
  } & {
564
573
  errorStack: string | undefined;
565
574
  };
575
+ setStatus: (status: Status) => void;
566
576
  json: (json: Record<string, any>, routerResponse?: {
567
577
  status?: number;
568
578
  headers?: Record<string, string>;
@@ -570,8 +580,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
570
580
  body?: Record<string, any>;
571
581
  } | Response) => Record<string, any>;
572
582
  responseHeaders: Headers;
583
+ responseStatus: Status | undefined;
573
584
  asResponse?: boolean;
574
585
  returnHeaders?: boolean;
586
+ returnStatus?: boolean;
575
587
  use?: Middleware[];
576
588
  }>;
577
589
  //#endregion
@@ -1029,6 +1041,10 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
1029
1041
  * If it's called outside of a request it will just be ignored.
1030
1042
  */
1031
1043
  setHeader: (key: string, value: string) => void;
1044
+ /**
1045
+ * Set the response status code
1046
+ */
1047
+ setStatus: (status: Status) => void;
1032
1048
  /**
1033
1049
  * Get header
1034
1050
  *
@@ -1124,16 +1140,43 @@ type StrictEndpoint<Path extends string, Options extends EndpointOptions, R = an
1124
1140
  asResponse: true;
1125
1141
  }): Promise<Response>;
1126
1142
  (context: InputContext<Path, Options> & {
1127
- asResponse: false;
1128
- returnHeaders?: false;
1143
+ returnHeaders: true;
1144
+ returnStatus: true;
1145
+ }): Promise<{
1146
+ headers: Headers;
1147
+ status: number;
1148
+ response: Awaited<R>;
1149
+ }>;
1150
+ (context: InputContext<Path, Options> & {
1151
+ returnHeaders: true;
1152
+ returnStatus: false;
1153
+ }): Promise<{
1154
+ headers: Headers;
1155
+ response: Awaited<R>;
1156
+ }>;
1157
+ (context: InputContext<Path, Options> & {
1158
+ returnHeaders: false;
1159
+ returnStatus: true;
1160
+ }): Promise<{
1161
+ status: number;
1162
+ response: Awaited<R>;
1163
+ }>;
1164
+ (context: InputContext<Path, Options> & {
1165
+ returnHeaders: false;
1166
+ returnStatus: false;
1129
1167
  }): Promise<R>;
1130
1168
  (context: InputContext<Path, Options> & {
1131
- asResponse?: false;
1132
1169
  returnHeaders: true;
1133
1170
  }): Promise<{
1134
1171
  headers: Headers;
1135
1172
  response: Awaited<R>;
1136
1173
  }>;
1174
+ (context: InputContext<Path, Options> & {
1175
+ returnStatus: true;
1176
+ }): Promise<{
1177
+ status: number;
1178
+ response: Awaited<R>;
1179
+ }>;
1137
1180
  (context?: InputContext<Path, Options>): Promise<R>;
1138
1181
  options: Options;
1139
1182
  path: Path;
@@ -1216,4 +1259,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1216
1259
  type Router = ReturnType<typeof createRouter>;
1217
1260
  //#endregion
1218
1261
  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
1262
+ //# sourceMappingURL=router-DRUBbubk.d.ts.map
@@ -320,8 +320,8 @@ 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
- path?: string;
325
325
  };
326
326
  declare const createInternalContext: (context: InputContext<any, any>, {
327
327
  options,
@@ -380,6 +380,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
380
380
  } & {
381
381
  errorStack: string | undefined;
382
382
  };
383
+ setStatus: (status: Status) => void;
383
384
  json: (json: Record<string, any>, routerResponse?: {
384
385
  status?: number;
385
386
  headers?: Record<string, string>;
@@ -387,8 +388,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
387
388
  body?: Record<string, any>;
388
389
  } | Response) => Record<string, any>;
389
390
  responseHeaders: Headers;
391
+ responseStatus: Status | undefined;
390
392
  asResponse?: boolean;
391
393
  returnHeaders?: boolean;
394
+ returnStatus?: boolean;
392
395
  use?: Middleware[];
393
396
  } | {
394
397
  body: any;
@@ -441,6 +444,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
441
444
  } & {
442
445
  errorStack: string | undefined;
443
446
  };
447
+ setStatus: (status: Status) => void;
444
448
  json: (json: Record<string, any>, routerResponse?: {
445
449
  status?: number;
446
450
  headers?: Record<string, string>;
@@ -448,8 +452,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
448
452
  body?: Record<string, any>;
449
453
  } | Response) => Record<string, any>;
450
454
  responseHeaders: Headers;
455
+ responseStatus: Status | undefined;
451
456
  asResponse?: boolean;
452
457
  returnHeaders?: boolean;
458
+ returnStatus?: boolean;
453
459
  use?: Middleware[];
454
460
  } | {
455
461
  body: any;
@@ -502,6 +508,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
502
508
  } & {
503
509
  errorStack: string | undefined;
504
510
  };
511
+ setStatus: (status: Status) => void;
505
512
  json: (json: Record<string, any>, routerResponse?: {
506
513
  status?: number;
507
514
  headers?: Record<string, string>;
@@ -509,8 +516,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
509
516
  body?: Record<string, any>;
510
517
  } | Response) => Record<string, any>;
511
518
  responseHeaders: Headers;
519
+ responseStatus: Status | undefined;
512
520
  asResponse?: boolean;
513
521
  returnHeaders?: boolean;
522
+ returnStatus?: boolean;
514
523
  use?: Middleware[];
515
524
  } | {
516
525
  body: any;
@@ -563,6 +572,7 @@ declare const createInternalContext: (context: InputContext<any, any>, {
563
572
  } & {
564
573
  errorStack: string | undefined;
565
574
  };
575
+ setStatus: (status: Status) => void;
566
576
  json: (json: Record<string, any>, routerResponse?: {
567
577
  status?: number;
568
578
  headers?: Record<string, string>;
@@ -570,8 +580,10 @@ declare const createInternalContext: (context: InputContext<any, any>, {
570
580
  body?: Record<string, any>;
571
581
  } | Response) => Record<string, any>;
572
582
  responseHeaders: Headers;
583
+ responseStatus: Status | undefined;
573
584
  asResponse?: boolean;
574
585
  returnHeaders?: boolean;
586
+ returnStatus?: boolean;
575
587
  use?: Middleware[];
576
588
  }>;
577
589
  //#endregion
@@ -1029,6 +1041,10 @@ type EndpointContext<Path extends string, Options extends EndpointOptions, Conte
1029
1041
  * If it's called outside of a request it will just be ignored.
1030
1042
  */
1031
1043
  setHeader: (key: string, value: string) => void;
1044
+ /**
1045
+ * Set the response status code
1046
+ */
1047
+ setStatus: (status: Status) => void;
1032
1048
  /**
1033
1049
  * Get header
1034
1050
  *
@@ -1124,16 +1140,43 @@ type StrictEndpoint<Path extends string, Options extends EndpointOptions, R = an
1124
1140
  asResponse: true;
1125
1141
  }): Promise<Response>;
1126
1142
  (context: InputContext<Path, Options> & {
1127
- asResponse: false;
1128
- returnHeaders?: false;
1143
+ returnHeaders: true;
1144
+ returnStatus: true;
1145
+ }): Promise<{
1146
+ headers: Headers;
1147
+ status: number;
1148
+ response: Awaited<R>;
1149
+ }>;
1150
+ (context: InputContext<Path, Options> & {
1151
+ returnHeaders: true;
1152
+ returnStatus: false;
1153
+ }): Promise<{
1154
+ headers: Headers;
1155
+ response: Awaited<R>;
1156
+ }>;
1157
+ (context: InputContext<Path, Options> & {
1158
+ returnHeaders: false;
1159
+ returnStatus: true;
1160
+ }): Promise<{
1161
+ status: number;
1162
+ response: Awaited<R>;
1163
+ }>;
1164
+ (context: InputContext<Path, Options> & {
1165
+ returnHeaders: false;
1166
+ returnStatus: false;
1129
1167
  }): Promise<R>;
1130
1168
  (context: InputContext<Path, Options> & {
1131
- asResponse?: false;
1132
1169
  returnHeaders: true;
1133
1170
  }): Promise<{
1134
1171
  headers: Headers;
1135
1172
  response: Awaited<R>;
1136
1173
  }>;
1174
+ (context: InputContext<Path, Options> & {
1175
+ returnStatus: true;
1176
+ }): Promise<{
1177
+ status: number;
1178
+ response: Awaited<R>;
1179
+ }>;
1137
1180
  (context?: InputContext<Path, Options>): Promise<R>;
1138
1181
  options: Options;
1139
1182
  path: Path;
@@ -1216,4 +1259,4 @@ declare const createRouter: <E extends Record<string, Endpoint>, Config extends
1216
1259
  type Router = ReturnType<typeof createRouter>;
1217
1260
  //#endregion
1218
1261
  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
1262
+ //# sourceMappingURL=router-DeSuoHCx.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.25",
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
  ".": {