better-call 1.0.4-beta.2 → 1.0.5
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/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.cjs +37 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -9
- package/dist/index.js.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/{router-uAmry411.d.cts → router-DQIhoWK3.d.cts} +9 -1
- package/dist/{router-uAmry411.d.ts → router-DQIhoWK3.d.ts} +9 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-
|
|
1
|
+
export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-DQIhoWK3.cjs';
|
|
2
2
|
|
|
3
3
|
declare function toResponse(data?: any, init?: ResponseInit): Response;
|
|
4
4
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-
|
|
1
|
+
export { A as APIError, k as CookieOptions, C as CookiePrefixOptions, b as Endpoint, a as EndpointContext, E as EndpointOptions, H as HTTPMethod, T as HasRequiredKeys, t as InferBody, I as InferBodyInput, B as InferHeaders, D as InferHeadersInput, x as InferInputMethod, w as InferMethod, G as InferMiddlewareBody, J as InferMiddlewareQuery, y as InferParam, Y as InferParamPath, Z as InferParamWildCard, v as InferQuery, u as InferQueryInput, z as InferRequest, F as InferUse, N as Input, K as InputContext, V as IsEmptyObject, X as MergeObject, r as Method, h as Middleware, e as MiddlewareContext, g as MiddlewareInputContext, M as MiddlewareOptions, d as MiddlewareResponse, n as OpenAPIParameter, O as OpenAPISchemaType, P as Path, U as Prettify, Q as RequiredKeysOf, j as Router, R as RouterConfig, $ as StandardSchemaV1, S as Status, W as UnionToIntersection, _ as _statusCode, c as createEndpoint, L as createInternalContext, f as createMiddleware, i as createRouter, o as generator, l as getCookieKey, q as getHTML, p as parseCookies, s as serializeCookie, m as serializeSignedCookie } from './router-DQIhoWK3.js';
|
|
2
2
|
|
|
3
3
|
declare function toResponse(data?: any, init?: ResponseInit): Response;
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -111,7 +111,14 @@ async function getBody(request) {
|
|
|
111
111
|
return await request.text();
|
|
112
112
|
}
|
|
113
113
|
function isAPIError(error) {
|
|
114
|
-
return error instanceof APIError || error
|
|
114
|
+
return error instanceof APIError || error?.name === "APIError";
|
|
115
|
+
}
|
|
116
|
+
function tryDecode(str) {
|
|
117
|
+
try {
|
|
118
|
+
return str.includes("%") ? decodeURIComponent(str) : str;
|
|
119
|
+
} catch {
|
|
120
|
+
return str;
|
|
121
|
+
}
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
// src/to-response.ts
|
|
@@ -290,14 +297,35 @@ var getCookieKey = (key, prefix) => {
|
|
|
290
297
|
}
|
|
291
298
|
return finalKey;
|
|
292
299
|
};
|
|
293
|
-
function parseCookies(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
function parseCookies(str) {
|
|
301
|
+
if (typeof str !== "string") {
|
|
302
|
+
throw new TypeError("argument str must be a string");
|
|
303
|
+
}
|
|
304
|
+
const cookies = /* @__PURE__ */ new Map();
|
|
305
|
+
let index = 0;
|
|
306
|
+
while (index < str.length) {
|
|
307
|
+
const eqIdx = str.indexOf("=", index);
|
|
308
|
+
if (eqIdx === -1) {
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
let endIdx = str.indexOf(";", index);
|
|
312
|
+
if (endIdx === -1) {
|
|
313
|
+
endIdx = str.length;
|
|
314
|
+
} else if (endIdx < eqIdx) {
|
|
315
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const key = str.slice(index, eqIdx).trim();
|
|
319
|
+
if (!cookies.has(key)) {
|
|
320
|
+
let val = str.slice(eqIdx + 1, endIdx).trim();
|
|
321
|
+
if (val.codePointAt(0) === 34) {
|
|
322
|
+
val = val.slice(1, -1);
|
|
323
|
+
}
|
|
324
|
+
cookies.set(key, tryDecode(val));
|
|
325
|
+
}
|
|
326
|
+
index = endIdx + 1;
|
|
327
|
+
}
|
|
328
|
+
return cookies;
|
|
301
329
|
}
|
|
302
330
|
var _serialize = (key, value, opt = {}) => {
|
|
303
331
|
let cookie;
|