bxo 0.0.5-dev.49 → 0.0.5-dev.50
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/index.ts +13 -16
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -17,7 +17,6 @@ type InferResponseType<T> = T extends ResponseSchema
|
|
|
17
17
|
|
|
18
18
|
// Cookie options interface for setting cookies
|
|
19
19
|
interface CookieOptions {
|
|
20
|
-
value: string;
|
|
21
20
|
domain?: string;
|
|
22
21
|
path?: string;
|
|
23
22
|
expires?: Date;
|
|
@@ -65,7 +64,7 @@ export type Context<TConfig extends RouteConfig = {}> = {
|
|
|
65
64
|
set: {
|
|
66
65
|
status: number;
|
|
67
66
|
headers: Record<string, string>;
|
|
68
|
-
cookies: (name: string,
|
|
67
|
+
cookies: (name: string, value: string, options?: CookieOptions) => void;
|
|
69
68
|
redirect?: { location: string; status?: number };
|
|
70
69
|
};
|
|
71
70
|
status: <T extends number>(
|
|
@@ -747,11 +746,11 @@ export default class BXO {
|
|
|
747
746
|
set: {
|
|
748
747
|
status: 200,
|
|
749
748
|
headers: {},
|
|
750
|
-
cookies: (name: string, options?: CookieOptions) => {
|
|
749
|
+
cookies: (name: string, value: string, options?: CookieOptions) => {
|
|
751
750
|
// This is a placeholder for setting cookies.
|
|
752
751
|
// In a real Bun.serve context, you'd use Bun.serve's cookie handling.
|
|
753
752
|
// For now, we'll just log it or throw an error if not Bun.serve.
|
|
754
|
-
console.warn(`Setting cookie '${name}' via ctx.set.cookies is not directly supported by Bun.serve. Use Bun.serve's cookie handling.`);
|
|
753
|
+
console.warn(`Setting cookie '${name}' with value '${value}' via ctx.set.cookies is not directly supported by Bun.serve. Use Bun.serve's cookie handling.`);
|
|
755
754
|
},
|
|
756
755
|
redirect: undefined
|
|
757
756
|
},
|
|
@@ -883,17 +882,17 @@ export default class BXO {
|
|
|
883
882
|
set: {
|
|
884
883
|
status: 200,
|
|
885
884
|
headers: {},
|
|
886
|
-
cookies: (name: string,
|
|
885
|
+
cookies: (name: string, value: string, options?: CookieOptions) => {
|
|
887
886
|
internalCookies.push({
|
|
888
887
|
name,
|
|
889
|
-
value
|
|
890
|
-
domain: options
|
|
891
|
-
path: options
|
|
892
|
-
expires: options
|
|
893
|
-
maxAge: options
|
|
894
|
-
secure: options
|
|
895
|
-
httpOnly: options
|
|
896
|
-
sameSite: options
|
|
888
|
+
value,
|
|
889
|
+
domain: options?.domain,
|
|
890
|
+
path: options?.path,
|
|
891
|
+
expires: options?.expires,
|
|
892
|
+
maxAge: options?.maxAge,
|
|
893
|
+
secure: options?.secure,
|
|
894
|
+
httpOnly: options?.httpOnly,
|
|
895
|
+
sameSite: options?.sameSite
|
|
897
896
|
});
|
|
898
897
|
}
|
|
899
898
|
},
|
|
@@ -1550,9 +1549,7 @@ export type { RouteConfig, RouteDetail, Handler, WebSocketHandler, WSRoute, Cook
|
|
|
1550
1549
|
|
|
1551
1550
|
// Helper function to create cookie options
|
|
1552
1551
|
export const createCookieOptions = (
|
|
1553
|
-
|
|
1554
|
-
options: Omit<CookieOptions, 'value'> = {}
|
|
1552
|
+
options: CookieOptions = {}
|
|
1555
1553
|
): CookieOptions => ({
|
|
1556
|
-
value,
|
|
1557
1554
|
...options
|
|
1558
1555
|
});
|