@bepalo/spine 1.0.3

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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +830 -0
  3. package/dist/auth-middlewares.d.ts +119 -0
  4. package/dist/auth-middlewares.d.ts.map +1 -0
  5. package/dist/auth-middlewares.js +168 -0
  6. package/dist/auth-middlewares.js.map +1 -0
  7. package/dist/cjs/auth-middlewares.d.ts +119 -0
  8. package/dist/cjs/auth-middlewares.d.ts.map +1 -0
  9. package/dist/cjs/auth-middlewares.js +168 -0
  10. package/dist/cjs/auth-middlewares.js.map +1 -0
  11. package/dist/cjs/helpers.d.ts +180 -0
  12. package/dist/cjs/helpers.d.ts.map +1 -0
  13. package/dist/cjs/helpers.js +366 -0
  14. package/dist/cjs/helpers.js.map +1 -0
  15. package/dist/cjs/index.d.ts +11 -0
  16. package/dist/cjs/index.d.ts.map +1 -0
  17. package/dist/cjs/index.js +30 -0
  18. package/dist/cjs/index.js.map +1 -0
  19. package/dist/cjs/middlewares.d.ts +88 -0
  20. package/dist/cjs/middlewares.d.ts.map +1 -0
  21. package/dist/cjs/middlewares.js +262 -0
  22. package/dist/cjs/middlewares.js.map +1 -0
  23. package/dist/cjs/parsers.d.ts +177 -0
  24. package/dist/cjs/parsers.d.ts.map +1 -0
  25. package/dist/cjs/parsers.js +1021 -0
  26. package/dist/cjs/parsers.js.map +1 -0
  27. package/dist/cjs/router.d.ts +124 -0
  28. package/dist/cjs/router.d.ts.map +1 -0
  29. package/dist/cjs/router.js +1378 -0
  30. package/dist/cjs/router.js.map +1 -0
  31. package/dist/cjs/status.d.ts +77 -0
  32. package/dist/cjs/status.d.ts.map +1 -0
  33. package/dist/cjs/status.js +252 -0
  34. package/dist/cjs/status.js.map +1 -0
  35. package/dist/cjs/types.d.ts +135 -0
  36. package/dist/cjs/types.d.ts.map +1 -0
  37. package/dist/cjs/types.js +109 -0
  38. package/dist/cjs/types.js.map +1 -0
  39. package/dist/cjs/utils.d.ts +11 -0
  40. package/dist/cjs/utils.d.ts.map +1 -0
  41. package/dist/cjs/utils.js +76 -0
  42. package/dist/cjs/utils.js.map +1 -0
  43. package/dist/cjs/utils.node.d.ts +4 -0
  44. package/dist/cjs/utils.node.d.ts.map +1 -0
  45. package/dist/cjs/utils.node.js +99 -0
  46. package/dist/cjs/utils.node.js.map +1 -0
  47. package/dist/helpers.d.ts +180 -0
  48. package/dist/helpers.d.ts.map +1 -0
  49. package/dist/helpers.js +366 -0
  50. package/dist/helpers.js.map +1 -0
  51. package/dist/index.d.ts +11 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +30 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/middlewares.d.ts +88 -0
  56. package/dist/middlewares.d.ts.map +1 -0
  57. package/dist/middlewares.js +262 -0
  58. package/dist/middlewares.js.map +1 -0
  59. package/dist/parsers.d.ts +177 -0
  60. package/dist/parsers.d.ts.map +1 -0
  61. package/dist/parsers.js +1021 -0
  62. package/dist/parsers.js.map +1 -0
  63. package/dist/router.d.ts +124 -0
  64. package/dist/router.d.ts.map +1 -0
  65. package/dist/router.js +1378 -0
  66. package/dist/router.js.map +1 -0
  67. package/dist/status.d.ts +77 -0
  68. package/dist/status.d.ts.map +1 -0
  69. package/dist/status.js +252 -0
  70. package/dist/status.js.map +1 -0
  71. package/dist/types.d.ts +135 -0
  72. package/dist/types.d.ts.map +1 -0
  73. package/dist/types.js +109 -0
  74. package/dist/types.js.map +1 -0
  75. package/dist/utils.d.ts +11 -0
  76. package/dist/utils.d.ts.map +1 -0
  77. package/dist/utils.js +76 -0
  78. package/dist/utils.js.map +1 -0
  79. package/dist/utils.node.d.ts +4 -0
  80. package/dist/utils.node.d.ts.map +1 -0
  81. package/dist/utils.node.js +66 -0
  82. package/dist/utils.node.js.map +1 -0
  83. package/package.json +57 -0
@@ -0,0 +1,180 @@
1
+ import Router from "./router.ts";
2
+ import type { Handler, HttpMethod } from "./types.ts";
3
+ /**
4
+ * Creates a Response with the specified status code.
5
+ * Defaults to 'text/plain; charset=utf-8' content-type if not provided in init.headers.
6
+ * @param {number} status - The HTTP status code
7
+ * @param {string|null} [content] - The response body content
8
+ * @param {ResponseInit} [init] - Additional response initialization options
9
+ * @returns {Response} A Response object
10
+ * @example
11
+ * status(200, "Success");
12
+ * status(404, "Not Found");
13
+ * status(204, null); // No content response
14
+ */
15
+ export declare const status: (status: number, content?: string | null, init?: ResponseInit) => Response;
16
+ /**
17
+ * Creates a redirect Response.
18
+ * Defaults to 302 Found unless another status is provided.
19
+ * @param {string} location - The URL to redirect to
20
+ * @param {number} [code=302] - The HTTP status code (301, 302, 303, 307, 308)
21
+ * @param {ResponseInit} [init] - Additional response initialization options
22
+ * @returns {Response} A Response object with Location header
23
+ */
24
+ export declare const redirect: (location: string, init?: ResponseInit) => Response;
25
+ /**
26
+ * Forwards the request to another route internally.
27
+ * Does not send a redirect to the client but changes the path and method,
28
+ * adds X-Forwarded-[Method|Path] and X-Original-Path headers and calls
29
+ * `(this as Router).respond(newReq, ctx)`.
30
+ * NOTE: parse body only once at the first handler using `parseBody({once: true})`
31
+ * as the body will be consumed at the first parseBody call.
32
+ * @param {Router<ExtendContext>} router - The router instance to forward to
33
+ * @param {string} path - The new path to forward to
34
+ * @returns {Response} A Response object with the forwarded request's response
35
+ */
36
+ export declare const forward: <ExtendContext extends Record<string, unknown> = Record<string, never>>(router: Router<ExtendContext>, path: `/${string}`, options?: {
37
+ method?: HttpMethod;
38
+ }) => Handler<ExtendContext>;
39
+ /**
40
+ * Creates a text/plain Response.
41
+ * Defaults to status 200 and 'text/plain; charset=utf-8' content-type if not specified.
42
+ * @param {string} content - The text content to return
43
+ * @param {ResponseInit} [init] - Additional response initialization options
44
+ * @returns {Response} A Response object with text/plain content-type
45
+ * @example
46
+ * text("Hello, world!");
47
+ * text("Error occurred", { status: 500 });
48
+ */
49
+ export declare const text: (content: string, init?: ResponseInit) => Response;
50
+ /**
51
+ * Creates an HTML Response.
52
+ * Defaults to status 200 and text/html content-type if not specified.
53
+ * @param {string} content - The HTML content to return
54
+ * @param {ResponseInit} [init] - Additional response initialization options
55
+ * @returns {Response} A Response object with text/html content-type
56
+ * @example
57
+ * html("<h1>Hello</h1>");
58
+ * html("<p>Not Found</p>", { status: 404 });
59
+ */
60
+ export declare const html: (content: string, init?: ResponseInit) => Response;
61
+ /**
62
+ * Creates a JSON Response.
63
+ * Defaults to status 200 and 'application/json; charset=utf-8' content-type if not specified.
64
+ * Uses Response.json() internally which automatically serializes the body.
65
+ * @param {any} body - The data to serialize as JSON
66
+ * @param {ResponseInit} [init] - Additional response initialization options
67
+ * @returns {Response} A Response object with application/json content-type
68
+ * @example
69
+ * json({ message: "Success" });
70
+ * json({ error: "Not found" }, { status: 404 });
71
+ */
72
+ export declare const json: (body: any, init?: ResponseInit) => Response;
73
+ /**
74
+ * Creates a Response from a Blob.
75
+ * Automatically sets content-type from blob.type or defaults to application/octet-stream.
76
+ * Also sets content-length header.
77
+ * @param {Blob} blob - The blob data to return
78
+ * @param {ResponseInit} [init] - Additional response initialization options
79
+ * @returns {Response} A Response object with appropriate content-type
80
+ * @example
81
+ * const blob = new Blob(["file content"], { type: "text/plain" });
82
+ * blob(blob);
83
+ */
84
+ export declare const blob: (blob: Blob, init?: ResponseInit) => Response;
85
+ /**
86
+ * Creates a Response from a Blob or ArrayBuffer with application/octet-stream content-type.
87
+ * Forces octet-stream content-type.
88
+ * Also sets content-length header.
89
+ * @param {Blob|ArrayBuffer} octetStream - The blob data to return
90
+ * @param {ResponseInit} [init] - Additional response initialization options
91
+ * @returns {Response} A Response object with application/octet-stream content-type
92
+ * @example
93
+ * const blob = new Blob([binaryData]);
94
+ * octetStream(blob);
95
+ */
96
+ export declare const octetStream: (octet: Blob | ArrayBuffer | ReadableStream, init?: ResponseInit) => Response;
97
+ /**
98
+ * Creates a Response from FormData.
99
+ * @param {FormData} [formData] - The form data to return
100
+ * @param {ResponseInit} [init] - Additional response initialization options
101
+ * @returns {Response} A Response object
102
+ * @example
103
+ * const form = new FormData();
104
+ * form.append("key", "value");
105
+ * formData(form);
106
+ */
107
+ export declare const formData: (formData?: FormData, init?: ResponseInit) => Response;
108
+ /**
109
+ * Creates a Response from URLSearchParams with application/x-www-form-urlencoded content-type.
110
+ * @param {URLSearchParams} [usp] - The URL search parameters to return
111
+ * @param {ResponseInit} [init] - Additional response initialization options
112
+ * @returns {Response} A Response object with application/x-www-form-urlencoded content-type
113
+ * @example
114
+ * const params = new URLSearchParams({ q: "search term" });
115
+ * usp(params);
116
+ */
117
+ export declare const usp: (usp?: URLSearchParams, init?: ResponseInit) => Response;
118
+ /**
119
+ * Creates a Response from various body types with automatic content-type detection.
120
+ * Supports strings, objects (JSON), Blobs, ArrayBuffers, FormData, URLSearchParams, and ReadableStreams.
121
+ * @param {BodyInit|Record<string, unknown>} [body] - The body content to return
122
+ * @param {ResponseInit} [init] - Additional response initialization options
123
+ * @returns {Response} A Response object with appropriate content-type
124
+ * @example
125
+ * send("text"); // text/plain
126
+ * send({ message: "success" }); // application/json; charset=utf-8
127
+ * send(new Blob([])); // blob.type || application/octet-stream
128
+ * send(new FormData()); // multipart/form-data
129
+ * send(new URLSearchParams()); // application/x-www-form-urlencoded
130
+ */
131
+ export declare const send: (body?: BodyInit | Record<string, unknown>, init?: ResponseInit) => Response;
132
+ /**
133
+ * Options for setting cookies.
134
+ * @type {Object} CookieOptions
135
+ * @property {string} [path] - The path for which the cookie is valid
136
+ * @property {string} [domain] - The domain for which the cookie is valid
137
+ * @property {Date|number|string} [expires] - Expiration date of the cookie
138
+ * @property {number} [maxAge] - Maximum age of the cookie in seconds
139
+ * @property {boolean} [httpOnly] - If true, the cookie is not accessible via JavaScript
140
+ * @property {boolean} [secure] - If true, the cookie is only sent over HTTPS
141
+ * @property {"Strict"|"Lax"|"None"} [sameSite] - SameSite attribute for the cookie
142
+ */
143
+ export interface CookieOptions {
144
+ path?: string;
145
+ domain?: string;
146
+ expires?: Date | number | string;
147
+ maxAge?: number;
148
+ httpOnly?: boolean;
149
+ secure?: boolean;
150
+ sameSite?: "Strict" | "Lax" | "None";
151
+ }
152
+ /**
153
+ * Tuple representing a cookie header (key-value pair for Set-Cookie header).
154
+ * @type {[string, string]} CookieTuple
155
+ */
156
+ type CookieTuple = [string, string];
157
+ /**
158
+ * Creates a Set-Cookie header tuple with the given name, value, and options.
159
+ * @param {string} name - The name of the cookie
160
+ * @param {string} value - The value of the cookie
161
+ * @param {CookieOptions} [options] - Cookie configuration options
162
+ * @returns {CookieTuple} A tuple containing the header name "Set-Cookie" and the cookie string
163
+ * @example
164
+ * const cookie = setCookie("session", "abc123", { httpOnly: true, secure: true });
165
+ * // Returns: ["Set-Cookie", "session=abc123; HttpOnly; Secure"]
166
+ */
167
+ export declare const setCookie: (name: string, value: string, options?: CookieOptions) => CookieTuple;
168
+ /**
169
+ * Creates a Set-Cookie header tuple to clear/remove a cookie.
170
+ * Sets the cookie with an empty value and an expired date.
171
+ * @param {string} name - The name of the cookie to clear
172
+ * @param {CookieOptions} [options] - Cookie configuration options (path/domain must match original cookie)
173
+ * @returns {CookieTuple} A tuple containing the header name "Set-Cookie" and the cookie clearing string
174
+ * @example
175
+ * const cookie = clearCookie("session", { path: "/" });
176
+ * // Returns: ["Set-Cookie", "session=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"]
177
+ */
178
+ export declare const clearCookie: (name: string, options?: CookieOptions) => CookieTuple;
179
+ export {};
180
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,KAAK,EAAW,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,GACjB,QAAQ,MAAM,EACd,UAAU,MAAM,GAAG,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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,OAAO,YAAY,KAClB,QA4CF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CACtC;AAED;;;GAGG;AACH,KAAK,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpC;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,MAAM,EACZ,OAAO,MAAM,EACb,UAAU,aAAa,KACtB,WAcF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,UAAU,aAAa,KACtB,WAgBF,CAAC"}
@@ -0,0 +1,366 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.clearCookie = exports.setCookie = exports.send = exports.usp = exports.formData = exports.octetStream = exports.blob = exports.json = exports.html = exports.text = exports.forward = exports.redirect = exports.status = void 0;
13
+ const status_ts_1 = require("./status.js");
14
+ /**
15
+ * Creates a Response with the specified status code.
16
+ * Defaults to 'text/plain; charset=utf-8' content-type if not provided in init.headers.
17
+ * @param {number} status - The HTTP status code
18
+ * @param {string|null} [content] - The response body content
19
+ * @param {ResponseInit} [init] - Additional response initialization options
20
+ * @returns {Response} A Response object
21
+ * @example
22
+ * status(200, "Success");
23
+ * status(404, "Not Found");
24
+ * status(204, null); // No content response
25
+ */
26
+ const status = (status, content, init) => {
27
+ var _a;
28
+ const statusText = (_a = init === null || init === void 0 ? void 0 : init.statusText) !== null && _a !== void 0 ? _a : (0, status_ts_1.getHttpStatusText)(status);
29
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
30
+ if (content !== null && !headers.has("content-type")) {
31
+ headers.set("content-type", "text/plain; charset=utf-8");
32
+ }
33
+ return new Response(content !== undefined ? content : statusText, Object.assign(Object.assign({ statusText }, init), { status,
34
+ headers }));
35
+ };
36
+ exports.status = status;
37
+ /**
38
+ * Creates a redirect Response.
39
+ * Defaults to 302 Found unless another status is provided.
40
+ * @param {string} location - The URL to redirect to
41
+ * @param {number} [code=302] - The HTTP status code (301, 302, 303, 307, 308)
42
+ * @param {ResponseInit} [init] - Additional response initialization options
43
+ * @returns {Response} A Response object with Location header
44
+ */
45
+ const redirect = (location, init) => {
46
+ var _a, _b;
47
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 302;
48
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
49
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
50
+ headers.set("Location", location);
51
+ return new Response(null, Object.assign(Object.assign({ statusText }, init), { status,
52
+ headers }));
53
+ };
54
+ exports.redirect = redirect;
55
+ /**
56
+ * Forwards the request to another route internally.
57
+ * Does not send a redirect to the client but changes the path and method,
58
+ * adds X-Forwarded-[Method|Path] and X-Original-Path headers and calls
59
+ * `(this as Router).respond(newReq, ctx)`.
60
+ * NOTE: parse body only once at the first handler using `parseBody({once: true})`
61
+ * as the body will be consumed at the first parseBody call.
62
+ * @param {Router<ExtendContext>} router - The router instance to forward to
63
+ * @param {string} path - The new path to forward to
64
+ * @returns {Response} A Response object with the forwarded request's response
65
+ */
66
+ const forward = (router, path, options) => {
67
+ return function (ctx) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ var _a;
70
+ const { request } = ctx;
71
+ const method = (_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : request.method;
72
+ const headers = new Headers(request.headers);
73
+ const body = request.body ? request.clone().body : undefined;
74
+ const url = new URL(request.url);
75
+ const originalPathname = url.pathname;
76
+ url.pathname = path;
77
+ if (method != request.method)
78
+ headers.set("X-Forwarded-Method", request.method);
79
+ headers.set("X-Forwarded-Path", originalPathname);
80
+ if (!request.headers.has("X-Original-Path")) {
81
+ headers.set("X-Original-Path", originalPathname);
82
+ }
83
+ const newReq = new Request(url.toString(), { method, headers, body });
84
+ return router.respond(newReq, ctx);
85
+ });
86
+ };
87
+ };
88
+ exports.forward = forward;
89
+ /**
90
+ * Creates a text/plain Response.
91
+ * Defaults to status 200 and 'text/plain; charset=utf-8' content-type if not specified.
92
+ * @param {string} content - The text content to return
93
+ * @param {ResponseInit} [init] - Additional response initialization options
94
+ * @returns {Response} A Response object with text/plain content-type
95
+ * @example
96
+ * text("Hello, world!");
97
+ * text("Error occurred", { status: 500 });
98
+ */
99
+ const text = (content, init) => {
100
+ var _a, _b;
101
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
102
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
103
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
104
+ if (!headers.has("content-type")) {
105
+ headers.set("content-type", "text/plain; charset=utf-8");
106
+ }
107
+ return new Response(content, Object.assign(Object.assign({ statusText }, init), { status,
108
+ headers }));
109
+ };
110
+ exports.text = text;
111
+ /**
112
+ * Creates an HTML Response.
113
+ * Defaults to status 200 and text/html content-type if not specified.
114
+ * @param {string} content - The HTML content to return
115
+ * @param {ResponseInit} [init] - Additional response initialization options
116
+ * @returns {Response} A Response object with text/html content-type
117
+ * @example
118
+ * html("<h1>Hello</h1>");
119
+ * html("<p>Not Found</p>", { status: 404 });
120
+ */
121
+ const html = (content, init) => {
122
+ var _a, _b;
123
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
124
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
125
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
126
+ if (!headers.has("content-type")) {
127
+ headers.set("content-type", "text/html; charset=utf-8");
128
+ }
129
+ return new Response(content, Object.assign(Object.assign({ statusText }, init), { status,
130
+ headers }));
131
+ };
132
+ exports.html = html;
133
+ /**
134
+ * Creates a JSON Response.
135
+ * Defaults to status 200 and 'application/json; charset=utf-8' content-type if not specified.
136
+ * Uses Response.json() internally which automatically serializes the body.
137
+ * @param {any} body - The data to serialize as JSON
138
+ * @param {ResponseInit} [init] - Additional response initialization options
139
+ * @returns {Response} A Response object with application/json content-type
140
+ * @example
141
+ * json({ message: "Success" });
142
+ * json({ error: "Not found" }, { status: 404 });
143
+ */
144
+ const json = (body, init) => {
145
+ var _a, _b;
146
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
147
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
148
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
149
+ if (!headers.has("content-type")) {
150
+ headers.set("content-type", "application/json; charset=utf-8");
151
+ }
152
+ return Response.json(body, Object.assign(Object.assign({ statusText }, init), { status,
153
+ headers }));
154
+ };
155
+ exports.json = json;
156
+ /**
157
+ * Creates a Response from a Blob.
158
+ * Automatically sets content-type from blob.type or defaults to application/octet-stream.
159
+ * Also sets content-length header.
160
+ * @param {Blob} blob - The blob data to return
161
+ * @param {ResponseInit} [init] - Additional response initialization options
162
+ * @returns {Response} A Response object with appropriate content-type
163
+ * @example
164
+ * const blob = new Blob(["file content"], { type: "text/plain" });
165
+ * blob(blob);
166
+ */
167
+ const blob = (blob, init) => {
168
+ var _a, _b;
169
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
170
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
171
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
172
+ if (!headers.has("content-type")) {
173
+ headers.set("content-type", blob.type || "application/octet-stream");
174
+ }
175
+ headers.set("content-length", blob.size.toFixed());
176
+ return new Response(blob, Object.assign(Object.assign({ statusText }, init), { status,
177
+ headers }));
178
+ };
179
+ exports.blob = blob;
180
+ /**
181
+ * Creates a Response from a Blob or ArrayBuffer with application/octet-stream content-type.
182
+ * Forces octet-stream content-type.
183
+ * Also sets content-length header.
184
+ * @param {Blob|ArrayBuffer} octetStream - The blob data to return
185
+ * @param {ResponseInit} [init] - Additional response initialization options
186
+ * @returns {Response} A Response object with application/octet-stream content-type
187
+ * @example
188
+ * const blob = new Blob([binaryData]);
189
+ * octetStream(blob);
190
+ */
191
+ const octetStream = (octet, init) => {
192
+ var _a, _b;
193
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
194
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
195
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
196
+ if (!headers.has("content-type")) {
197
+ headers.set("content-type", "application/octet-stream");
198
+ }
199
+ if (!(octet instanceof ReadableStream)) {
200
+ headers.set("content-length", (octet instanceof Blob ? octet.size : octet.byteLength).toFixed());
201
+ }
202
+ return new Response(octet, Object.assign(Object.assign({ statusText }, init), { status,
203
+ headers }));
204
+ };
205
+ exports.octetStream = octetStream;
206
+ /**
207
+ * Creates a Response from FormData.
208
+ * @param {FormData} [formData] - The form data to return
209
+ * @param {ResponseInit} [init] - Additional response initialization options
210
+ * @returns {Response} A Response object
211
+ * @example
212
+ * const form = new FormData();
213
+ * form.append("key", "value");
214
+ * formData(form);
215
+ */
216
+ const formData = (formData, init) => {
217
+ var _a, _b;
218
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
219
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
220
+ return new Response(formData, Object.assign(Object.assign({ statusText }, init), { status }));
221
+ };
222
+ exports.formData = formData;
223
+ /**
224
+ * Creates a Response from URLSearchParams with application/x-www-form-urlencoded content-type.
225
+ * @param {URLSearchParams} [usp] - The URL search parameters to return
226
+ * @param {ResponseInit} [init] - Additional response initialization options
227
+ * @returns {Response} A Response object with application/x-www-form-urlencoded content-type
228
+ * @example
229
+ * const params = new URLSearchParams({ q: "search term" });
230
+ * usp(params);
231
+ */
232
+ const usp = (usp, init) => {
233
+ var _a, _b;
234
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
235
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
236
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
237
+ if (!headers.has("content-type")) {
238
+ headers.set("content-type", "application/x-www-form-urlencoded");
239
+ }
240
+ return new Response(usp, Object.assign(Object.assign({ statusText }, init), { status,
241
+ headers }));
242
+ };
243
+ exports.usp = usp;
244
+ /**
245
+ * Creates a Response from various body types with automatic content-type detection.
246
+ * Supports strings, objects (JSON), Blobs, ArrayBuffers, FormData, URLSearchParams, and ReadableStreams.
247
+ * @param {BodyInit|Record<string, unknown>} [body] - The body content to return
248
+ * @param {ResponseInit} [init] - Additional response initialization options
249
+ * @returns {Response} A Response object with appropriate content-type
250
+ * @example
251
+ * send("text"); // text/plain
252
+ * send({ message: "success" }); // application/json; charset=utf-8
253
+ * send(new Blob([])); // blob.type || application/octet-stream
254
+ * send(new FormData()); // multipart/form-data
255
+ * send(new URLSearchParams()); // application/x-www-form-urlencoded
256
+ */
257
+ const send = (body, init) => {
258
+ var _a, _b;
259
+ const status = (_a = init === null || init === void 0 ? void 0 : init.status) !== null && _a !== void 0 ? _a : 200;
260
+ const statusText = (_b = init === null || init === void 0 ? void 0 : init.statusText) !== null && _b !== void 0 ? _b : (0, status_ts_1.getHttpStatusText)(status);
261
+ const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
262
+ const isContentTypeNotSet = !headers.has("content-type");
263
+ if (body instanceof URLSearchParams) {
264
+ if (isContentTypeNotSet) {
265
+ headers.set("content-type", "application/x-www-form-urlencoded");
266
+ }
267
+ }
268
+ else if (body instanceof FormData) {
269
+ // content type will be generated
270
+ }
271
+ else if (typeof body === "string") {
272
+ if (isContentTypeNotSet) {
273
+ headers.set("content-type", "text/plain; charset=utf-8");
274
+ }
275
+ }
276
+ else if (body instanceof Blob) {
277
+ if (isContentTypeNotSet) {
278
+ headers.set("content-type", body.type || "application/octet-stream");
279
+ }
280
+ }
281
+ else if (body instanceof ArrayBuffer ||
282
+ ArrayBuffer.isView(body) ||
283
+ body instanceof ReadableStream) {
284
+ if (isContentTypeNotSet) {
285
+ headers.set("content-type", "application/octet-stream");
286
+ }
287
+ }
288
+ else if (body != null) {
289
+ if (isContentTypeNotSet) {
290
+ headers.set("content-type", "application/json; charset=utf-8");
291
+ }
292
+ return Response.json(body, Object.assign(Object.assign({ status,
293
+ statusText }, init), { headers }));
294
+ }
295
+ return new Response(body, Object.assign(Object.assign({ statusText }, init), { status,
296
+ headers }));
297
+ };
298
+ exports.send = send;
299
+ /**
300
+ * Creates a Set-Cookie header tuple with the given name, value, and options.
301
+ * @param {string} name - The name of the cookie
302
+ * @param {string} value - The value of the cookie
303
+ * @param {CookieOptions} [options] - Cookie configuration options
304
+ * @returns {CookieTuple} A tuple containing the header name "Set-Cookie" and the cookie string
305
+ * @example
306
+ * const cookie = setCookie("session", "abc123", { httpOnly: true, secure: true });
307
+ * // Returns: ["Set-Cookie", "session=abc123; HttpOnly; Secure"]
308
+ */
309
+ const setCookie = (name, value, options) => {
310
+ const parts = [`${name}=${value}`];
311
+ if (options) {
312
+ if (options.path)
313
+ parts.push(`Path=${options.path}`);
314
+ if (options.domain)
315
+ parts.push(`Domain=${options.domain}`);
316
+ if (options.expires)
317
+ parts.push(`Expires=${new Date(options.expires).toUTCString()}`);
318
+ if (options.maxAge !== undefined)
319
+ parts.push(`Max-Age=${options.maxAge}`);
320
+ if (options.httpOnly)
321
+ parts.push(`HttpOnly`);
322
+ if (options.secure)
323
+ parts.push(`Secure`);
324
+ if (options.sameSite)
325
+ parts.push(`SameSite=${options.sameSite}`);
326
+ }
327
+ const cookie = parts.join("; ");
328
+ return ["Set-Cookie", cookie];
329
+ };
330
+ exports.setCookie = setCookie;
331
+ /**
332
+ * Creates a Set-Cookie header tuple to clear/remove a cookie.
333
+ * Sets the cookie with an empty value and an expired date.
334
+ * @param {string} name - The name of the cookie to clear
335
+ * @param {CookieOptions} [options] - Cookie configuration options (path/domain must match original cookie)
336
+ * @returns {CookieTuple} A tuple containing the header name "Set-Cookie" and the cookie clearing string
337
+ * @example
338
+ * const cookie = clearCookie("session", { path: "/" });
339
+ * // Returns: ["Set-Cookie", "session=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Path=/"]
340
+ */
341
+ const clearCookie = (name, options) => {
342
+ const parts = [`${name}=`];
343
+ const expires = (options === null || options === void 0 ? void 0 : options.expires)
344
+ ? new Date(options.expires).toUTCString()
345
+ : "Thu, 01 Jan 1970 00:00:00 GMT";
346
+ if (options) {
347
+ if (options.path)
348
+ parts.push(`Path=${options.path}`);
349
+ if (options.domain)
350
+ parts.push(`Domain=${options.domain}`);
351
+ if (options.maxAge !== undefined)
352
+ parts.push(`Max-Age=${options.maxAge}`);
353
+ if (options.httpOnly)
354
+ parts.push(`HttpOnly`);
355
+ if (options.secure)
356
+ parts.push(`Secure`);
357
+ if (options.sameSite)
358
+ parts.push(`SameSite=${options.sameSite}`);
359
+ }
360
+ if (expires)
361
+ parts.push(`Expires=${expires}`);
362
+ const cookie = parts.join("; ");
363
+ return ["Set-Cookie", cookie];
364
+ };
365
+ exports.clearCookie = clearCookie;
366
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAAgD;AAGhD;;;;;;;;;;;GAWG;AACI,MAAM,MAAM,GAAG,CACpB,MAAc,EACd,OAAuB,EACvB,IAAmB,EACT,EAAE;;IACZ,MAAM,UAAU,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,mCAAI,IAAA,6BAAiB,EAAC,MAAM,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,2BAA2B,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,gCAC9D,UAAU,IACP,IAAI,KACP,MAAM;QACN,OAAO,IAC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,+BAA+B,CAAC;IACpC,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,OAAO,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,IAAI,OAAO,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,UAAU,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1E,IAAI,OAAO,CAAC,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,OAAO,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,OAAO,CAAC,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC;AAnBW,QAAA,WAAW,eAmBtB"}
@@ -0,0 +1,11 @@
1
+ export * from "./types.ts";
2
+ export * from "./utils.node.ts";
3
+ export * from "./status.ts";
4
+ export * from "./helpers.ts";
5
+ export * from "./parsers.ts";
6
+ export * from "./auth-middlewares.ts";
7
+ export * from "./middlewares.ts";
8
+ export * from "./router.ts";
9
+ import Router from "./router.ts";
10
+ export default Router;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAE5B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./types.js"), exports);
21
+ __exportStar(require("./utils.node.js"), exports);
22
+ __exportStar(require("./status.js"), exports);
23
+ __exportStar(require("./helpers.js"), exports);
24
+ __exportStar(require("./parsers.js"), exports);
25
+ __exportStar(require("./auth-middlewares.js"), exports);
26
+ __exportStar(require("./middlewares.js"), exports);
27
+ __exportStar(require("./router.js"), exports);
28
+ const router_ts_1 = __importDefault(require("./router.js"));
29
+ exports.default = router_ts_1.default;
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,kDAAgC;AAChC,8CAA4B;AAC5B,+CAA6B;AAC7B,+CAA6B;AAC7B,wDAAsC;AACtC,mDAAiC;AACjC,8CAA4B;AAE5B,4DAAiC;AACjC,kBAAe,mBAAM,CAAC"}