better-call 1.0.4 → 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 +36 -8
- 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 +36 -8
- 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/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
|
|
2
|
-
import { j as Router, W as UnionToIntersection, b as Endpoint, T as HasRequiredKeys } from './router-
|
|
2
|
+
import { j as Router, W as UnionToIntersection, b as Endpoint, T as HasRequiredKeys } from './router-DQIhoWK3.cjs';
|
|
3
3
|
|
|
4
4
|
type HasRequired<T extends {
|
|
5
5
|
body?: any;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
|
|
2
|
-
import { j as Router, W as UnionToIntersection, b as Endpoint, T as HasRequiredKeys } from './router-
|
|
2
|
+
import { j as Router, W as UnionToIntersection, b as Endpoint, T as HasRequiredKeys } from './router-DQIhoWK3.js';
|
|
3
3
|
|
|
4
4
|
type HasRequired<T extends {
|
|
5
5
|
body?: any;
|
package/dist/index.cjs
CHANGED
|
@@ -151,6 +151,13 @@ async function getBody(request) {
|
|
|
151
151
|
function isAPIError(error) {
|
|
152
152
|
return error instanceof APIError || error?.name === "APIError";
|
|
153
153
|
}
|
|
154
|
+
function tryDecode(str) {
|
|
155
|
+
try {
|
|
156
|
+
return str.includes("%") ? decodeURIComponent(str) : str;
|
|
157
|
+
} catch {
|
|
158
|
+
return str;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
154
161
|
|
|
155
162
|
// src/to-response.ts
|
|
156
163
|
function isJSONSerializable(value) {
|
|
@@ -328,14 +335,35 @@ var getCookieKey = (key, prefix) => {
|
|
|
328
335
|
}
|
|
329
336
|
return finalKey;
|
|
330
337
|
};
|
|
331
|
-
function parseCookies(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
function parseCookies(str) {
|
|
339
|
+
if (typeof str !== "string") {
|
|
340
|
+
throw new TypeError("argument str must be a string");
|
|
341
|
+
}
|
|
342
|
+
const cookies = /* @__PURE__ */ new Map();
|
|
343
|
+
let index = 0;
|
|
344
|
+
while (index < str.length) {
|
|
345
|
+
const eqIdx = str.indexOf("=", index);
|
|
346
|
+
if (eqIdx === -1) {
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
let endIdx = str.indexOf(";", index);
|
|
350
|
+
if (endIdx === -1) {
|
|
351
|
+
endIdx = str.length;
|
|
352
|
+
} else if (endIdx < eqIdx) {
|
|
353
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
const key = str.slice(index, eqIdx).trim();
|
|
357
|
+
if (!cookies.has(key)) {
|
|
358
|
+
let val = str.slice(eqIdx + 1, endIdx).trim();
|
|
359
|
+
if (val.codePointAt(0) === 34) {
|
|
360
|
+
val = val.slice(1, -1);
|
|
361
|
+
}
|
|
362
|
+
cookies.set(key, tryDecode(val));
|
|
363
|
+
}
|
|
364
|
+
index = endIdx + 1;
|
|
365
|
+
}
|
|
366
|
+
return cookies;
|
|
339
367
|
}
|
|
340
368
|
var _serialize = (key, value, opt = {}) => {
|
|
341
369
|
let cookie;
|