vector-framework 0.9.9 → 1.1.1
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/README.md +6 -5
- package/dist/cache/manager.d.ts +5 -2
- package/dist/cache/manager.d.ts.map +1 -1
- package/dist/cache/manager.js +21 -7
- package/dist/cache/manager.js.map +1 -1
- package/dist/cli/index.js +76 -98
- package/dist/cli/index.js.map +1 -1
- package/dist/cli.js +134 -69
- package/dist/core/config-loader.d.ts +2 -2
- package/dist/core/config-loader.d.ts.map +1 -1
- package/dist/core/config-loader.js +16 -21
- package/dist/core/config-loader.js.map +1 -1
- package/dist/core/router.d.ts +2 -0
- package/dist/core/router.d.ts.map +1 -1
- package/dist/core/router.js +52 -16
- package/dist/core/router.js.map +1 -1
- package/dist/core/server.d.ts +4 -3
- package/dist/core/server.d.ts.map +1 -1
- package/dist/core/server.js +40 -20
- package/dist/core/server.js.map +1 -1
- package/dist/core/vector.d.ts +7 -7
- package/dist/core/vector.d.ts.map +1 -1
- package/dist/core/vector.js +20 -21
- package/dist/core/vector.js.map +1 -1
- package/dist/dev/route-scanner.d.ts +1 -1
- package/dist/dev/route-scanner.d.ts.map +1 -1
- package/dist/dev/route-scanner.js +40 -42
- package/dist/dev/route-scanner.js.map +1 -1
- package/dist/http.d.ts +2 -2
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +70 -63
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/middleware/manager.d.ts +1 -1
- package/dist/middleware/manager.d.ts.map +1 -1
- package/dist/middleware/manager.js.map +1 -1
- package/dist/utils/path.d.ts +1 -0
- package/dist/utils/path.d.ts.map +1 -1
- package/dist/utils/path.js +9 -3
- package/dist/utils/path.js.map +1 -1
- package/package.json +14 -9
- package/src/cache/manager.ts +23 -14
- package/src/cli/index.ts +83 -117
- package/src/core/config-loader.ts +19 -27
- package/src/core/router.ts +52 -18
- package/src/core/server.ts +43 -30
- package/src/core/vector.ts +25 -35
- package/src/dev/route-scanner.ts +41 -47
- package/src/http.ts +82 -112
- package/src/index.ts +3 -3
- package/src/middleware/manager.ts +4 -11
- package/src/utils/path.ts +13 -4
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { existsSync, promises as fs } from
|
|
2
|
-
import { join, relative, resolve, sep } from
|
|
1
|
+
import { existsSync, promises as fs } from 'node:fs';
|
|
2
|
+
import { join, relative, resolve, sep } from 'node:path';
|
|
3
3
|
export class RouteScanner {
|
|
4
4
|
routesDir;
|
|
5
5
|
excludePatterns;
|
|
6
6
|
static DEFAULT_EXCLUDE_PATTERNS = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
'*.test.ts',
|
|
8
|
+
'*.test.js',
|
|
9
|
+
'*.test.tsx',
|
|
10
|
+
'*.test.jsx',
|
|
11
|
+
'*.spec.ts',
|
|
12
|
+
'*.spec.js',
|
|
13
|
+
'*.spec.tsx',
|
|
14
|
+
'*.spec.jsx',
|
|
15
|
+
'*.tests.ts',
|
|
16
|
+
'*.tests.js',
|
|
17
|
+
'**/__tests__/**',
|
|
18
|
+
'*.interface.ts',
|
|
19
|
+
'*.type.ts',
|
|
20
|
+
'*.d.ts',
|
|
21
21
|
];
|
|
22
|
-
constructor(routesDir =
|
|
22
|
+
constructor(routesDir = './routes', excludePatterns) {
|
|
23
23
|
// Always resolve from the current working directory (user's project)
|
|
24
24
|
this.routesDir = resolve(process.cwd(), routesDir);
|
|
25
|
-
this.excludePatterns =
|
|
26
|
-
excludePatterns || RouteScanner.DEFAULT_EXCLUDE_PATTERNS;
|
|
25
|
+
this.excludePatterns = excludePatterns || RouteScanner.DEFAULT_EXCLUDE_PATTERNS;
|
|
27
26
|
}
|
|
28
27
|
async scan() {
|
|
29
28
|
const routes = [];
|
|
@@ -35,7 +34,7 @@ export class RouteScanner {
|
|
|
35
34
|
await this.scanDirectory(this.routesDir, routes);
|
|
36
35
|
}
|
|
37
36
|
catch (error) {
|
|
38
|
-
if (error.code ===
|
|
37
|
+
if (error.code === 'ENOENT') {
|
|
39
38
|
console.warn(` ✗ Routes directory not accessible: ${this.routesDir}`);
|
|
40
39
|
return [];
|
|
41
40
|
}
|
|
@@ -48,20 +47,21 @@ export class RouteScanner {
|
|
|
48
47
|
for (const pattern of this.excludePatterns) {
|
|
49
48
|
// Convert glob pattern to regex
|
|
50
49
|
const regexPattern = pattern
|
|
51
|
-
.replace(/\./g,
|
|
52
|
-
.replace(
|
|
53
|
-
.replace(
|
|
54
|
-
.replace(
|
|
50
|
+
.replace(/\./g, '\\.') // Escape dots
|
|
51
|
+
.replace(/\*\*/g, '__GLOBSTAR__') // protect ** before * replacement
|
|
52
|
+
.replace(/\*/g, '[^/]*') // * matches anything except /
|
|
53
|
+
.replace(/__GLOBSTAR__/g, '.*') // ** matches anything including /
|
|
54
|
+
.replace(/\?/g, '.'); // ? matches single character
|
|
55
55
|
const regex = new RegExp(`^${regexPattern}$`);
|
|
56
56
|
// Check both the full relative path and just the filename
|
|
57
|
-
const filename = relativePath.split(sep).pop() ||
|
|
57
|
+
const filename = relativePath.split(sep).pop() || '';
|
|
58
58
|
if (regex.test(relativePath) || regex.test(filename)) {
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
|
-
async scanDirectory(dir, routes, basePath =
|
|
64
|
+
async scanDirectory(dir, routes, basePath = '') {
|
|
65
65
|
const entries = await fs.readdir(dir);
|
|
66
66
|
for (const entry of entries) {
|
|
67
67
|
const fullPath = join(dir, entry);
|
|
@@ -70,42 +70,40 @@ export class RouteScanner {
|
|
|
70
70
|
const newBasePath = basePath ? `${basePath}/${entry}` : entry;
|
|
71
71
|
await this.scanDirectory(fullPath, routes, newBasePath);
|
|
72
72
|
}
|
|
73
|
-
else if (entry.endsWith(
|
|
73
|
+
else if (entry.endsWith('.ts') || entry.endsWith('.js')) {
|
|
74
74
|
// Skip excluded files (test files, etc.)
|
|
75
75
|
if (this.isExcluded(fullPath)) {
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
78
|
const routePath = relative(this.routesDir, fullPath)
|
|
79
|
-
.replace(/\.(ts|js)$/,
|
|
79
|
+
.replace(/\.(ts|js)$/, '')
|
|
80
80
|
.split(sep)
|
|
81
|
-
.join(
|
|
81
|
+
.join('/');
|
|
82
82
|
try {
|
|
83
83
|
// Convert Windows paths to URLs for import
|
|
84
|
-
const importPath = process.platform ===
|
|
85
|
-
? `file:///${fullPath.replace(/\\/g, "/")}`
|
|
86
|
-
: fullPath;
|
|
84
|
+
const importPath = process.platform === 'win32' ? `file:///${fullPath.replace(/\\/g, '/')}` : fullPath;
|
|
87
85
|
const module = await import(importPath);
|
|
88
|
-
if (module.default && typeof module.default ===
|
|
86
|
+
if (module.default && typeof module.default === 'function') {
|
|
89
87
|
routes.push({
|
|
90
|
-
name:
|
|
88
|
+
name: 'default',
|
|
91
89
|
path: fullPath,
|
|
92
|
-
method:
|
|
90
|
+
method: 'GET',
|
|
93
91
|
options: {
|
|
94
|
-
method:
|
|
92
|
+
method: 'GET',
|
|
95
93
|
path: `/${routePath}`,
|
|
96
94
|
expose: true,
|
|
97
95
|
},
|
|
98
96
|
});
|
|
99
97
|
}
|
|
100
98
|
for (const [name, value] of Object.entries(module)) {
|
|
101
|
-
if (name ===
|
|
99
|
+
if (name === 'default')
|
|
102
100
|
continue;
|
|
103
101
|
// Check for new RouteDefinition format
|
|
104
102
|
if (value &&
|
|
105
|
-
typeof value ===
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
typeof value === 'object' &&
|
|
104
|
+
'entry' in value &&
|
|
105
|
+
'options' in value &&
|
|
106
|
+
'handler' in value) {
|
|
109
107
|
const routeDef = value;
|
|
110
108
|
routes.push({
|
|
111
109
|
name,
|
|
@@ -137,7 +135,7 @@ export class RouteScanner {
|
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
enableWatch(callback) {
|
|
140
|
-
if (typeof Bun !==
|
|
138
|
+
if (typeof Bun !== 'undefined' && Bun.env.NODE_ENV === 'development') {
|
|
141
139
|
console.log(`Watching for route changes in ${this.routesDir}`);
|
|
142
140
|
setInterval(async () => {
|
|
143
141
|
await callback();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-scanner.js","sourceRoot":"","sources":["../../src/dev/route-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGzD,MAAM,OAAO,YAAY;IACf,SAAS,CAAS;IAClB,eAAe,CAAW;IAC1B,MAAM,CAAU,wBAAwB,GAAG;QACjD,WAAW;QACX,WAAW;QACX,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,WAAW;QACX,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,YAAY;QACZ,iBAAiB;QACjB,gBAAgB;QAChB,WAAW;QACX,QAAQ;KACT,CAAC;IAEF,YAAY,SAAS,GAAG,UAAU,EAAE,eAA0B;QAC5D,qEAAqE;QACrE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe
|
|
1
|
+
{"version":3,"file":"route-scanner.js","sourceRoot":"","sources":["../../src/dev/route-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAA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AAQ,EAAE,CAAC;YACnB,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC"}
|
package/dist/http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type IRequest, type RouteEntry } from
|
|
2
|
-
import type { CacheOptions, DefaultVectorTypes, GetAuthType, VectorRequest, VectorTypes } from
|
|
1
|
+
import { type IRequest, type RouteEntry } from 'itty-router';
|
|
2
|
+
import type { CacheOptions, DefaultVectorTypes, GetAuthType, VectorRequest, VectorTypes } from './types';
|
|
3
3
|
export interface ProtectedRequest<TTypes extends VectorTypes = DefaultVectorTypes> extends IRequest {
|
|
4
4
|
authUser?: GetAuthType<TTypes>;
|
|
5
5
|
}
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAe,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAe,MAAM,aAAa,CAAC;AAGhF,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACZ,MAAM,SAAS,CAAC;AAGjB,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,WAAW,GAAG,kBAAkB,CAC/E,SAAQ,QAAQ;IAChB,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,eAAO,MAAQ,SAAS,8CAAE,OAAO,qDAO/B,CAAC;AAEH,UAAU,kBAAmB,SAAQ,UAAU;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe,CAAC,MAAM,SAAS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AC,EAAE,OAAO,EACd,WAAW,GAAE,MAA2B,GACvC,QAAQ,CAOV;AAED,eAAO,MAAM,cAAc,GAAU,MAAM,SAAS,WAAW,GAAG,kBAAkB,EAClF,SAAS,aAAa,CAAC,MAAM,CAAC,EAC9B,sBAAsB,MAAM,kBAmB7B,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,GAAG,CAAC,MAAM,SAAS,WAAW,GAAG,kBAAkB,EACjE,OAAO,EAAE,UAAU,EACnB,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,IAY1C,SAAS,QAAQ,sBA2BhC;AAED,eAAe,WAAW,CAAC"}
|
package/dist/http.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import { cors, withContent } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { cors, withContent } from 'itty-router';
|
|
2
|
+
import { buildRouteRegex } from './utils/path';
|
|
3
|
+
import { CONTENT_TYPES, HTTP_STATUS } from './constants';
|
|
4
|
+
import { getVectorInstance } from './core/vector';
|
|
4
5
|
export const { preflight, corsify } = cors({
|
|
5
|
-
origin:
|
|
6
|
+
origin: '*',
|
|
6
7
|
credentials: true,
|
|
7
|
-
allowHeaders:
|
|
8
|
-
allowMethods:
|
|
9
|
-
exposeHeaders:
|
|
8
|
+
allowHeaders: 'Content-Type, Authorization',
|
|
9
|
+
allowMethods: 'GET, POST, PUT, PATCH, DELETE, OPTIONS',
|
|
10
|
+
exposeHeaders: 'Authorization',
|
|
10
11
|
maxAge: 86_400,
|
|
11
12
|
});
|
|
12
13
|
export function route(options, fn) {
|
|
13
14
|
const handler = api(options, fn);
|
|
14
15
|
const entry = [
|
|
15
16
|
options.method.toUpperCase(),
|
|
16
|
-
|
|
17
|
-
.replace(/\/+(\/|$)/g, "$1") // strip double & trailing splash
|
|
18
|
-
.replace(/(\/?\.?):(\w+)\+/g, "($1(?<$2>*))") // greedy params
|
|
19
|
-
.replace(/(\/?\.?):(\w+)/g, "($1(?<$2>[^$1/]+?))") // named params and image format
|
|
20
|
-
.replace(/\./g, "\\.") // dot in path
|
|
21
|
-
.replace(/(\/?)\*/g, "($1.*)?") // wildcard
|
|
22
|
-
}/*$`),
|
|
17
|
+
buildRouteRegex(options.path),
|
|
23
18
|
[handler],
|
|
24
19
|
options.path,
|
|
25
20
|
];
|
|
@@ -29,8 +24,22 @@ export function route(options, fn) {
|
|
|
29
24
|
handler: fn,
|
|
30
25
|
};
|
|
31
26
|
}
|
|
27
|
+
function hasBigInt(value, depth = 0) {
|
|
28
|
+
if (typeof value === 'bigint')
|
|
29
|
+
return true;
|
|
30
|
+
if (depth > 4 || value === null || typeof value !== 'object')
|
|
31
|
+
return false;
|
|
32
|
+
for (const v of Object.values(value)) {
|
|
33
|
+
if (hasBigInt(v, depth + 1))
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
32
38
|
function stringifyData(data) {
|
|
33
|
-
|
|
39
|
+
const val = data ?? null;
|
|
40
|
+
if (!hasBigInt(val))
|
|
41
|
+
return JSON.stringify(val);
|
|
42
|
+
return JSON.stringify(val, (_key, value) => typeof value === 'bigint' ? value.toString() : value);
|
|
34
43
|
}
|
|
35
44
|
const ApiResponse = {
|
|
36
45
|
success: (data, contentType) => createResponse(HTTP_STATUS.OK, data, contentType),
|
|
@@ -47,50 +56,50 @@ function createErrorResponse(code, message, contentType) {
|
|
|
47
56
|
}
|
|
48
57
|
export const APIError = {
|
|
49
58
|
// 4xx Client Errors
|
|
50
|
-
badRequest: (msg =
|
|
51
|
-
unauthorized: (msg =
|
|
52
|
-
paymentRequired: (msg =
|
|
53
|
-
forbidden: (msg =
|
|
54
|
-
notFound: (msg =
|
|
55
|
-
methodNotAllowed: (msg =
|
|
56
|
-
notAcceptable: (msg =
|
|
57
|
-
requestTimeout: (msg =
|
|
58
|
-
conflict: (msg =
|
|
59
|
-
gone: (msg =
|
|
60
|
-
lengthRequired: (msg =
|
|
61
|
-
preconditionFailed: (msg =
|
|
62
|
-
payloadTooLarge: (msg =
|
|
63
|
-
uriTooLong: (msg =
|
|
64
|
-
unsupportedMediaType: (msg =
|
|
65
|
-
rangeNotSatisfiable: (msg =
|
|
66
|
-
expectationFailed: (msg =
|
|
59
|
+
badRequest: (msg = 'Bad Request', contentType) => createErrorResponse(HTTP_STATUS.BAD_REQUEST, msg, contentType),
|
|
60
|
+
unauthorized: (msg = 'Unauthorized', contentType) => createErrorResponse(HTTP_STATUS.UNAUTHORIZED, msg, contentType),
|
|
61
|
+
paymentRequired: (msg = 'Payment Required', contentType) => createErrorResponse(402, msg, contentType),
|
|
62
|
+
forbidden: (msg = 'Forbidden', contentType) => createErrorResponse(HTTP_STATUS.FORBIDDEN, msg, contentType),
|
|
63
|
+
notFound: (msg = 'Not Found', contentType) => createErrorResponse(HTTP_STATUS.NOT_FOUND, msg, contentType),
|
|
64
|
+
methodNotAllowed: (msg = 'Method Not Allowed', contentType) => createErrorResponse(405, msg, contentType),
|
|
65
|
+
notAcceptable: (msg = 'Not Acceptable', contentType) => createErrorResponse(406, msg, contentType),
|
|
66
|
+
requestTimeout: (msg = 'Request Timeout', contentType) => createErrorResponse(408, msg, contentType),
|
|
67
|
+
conflict: (msg = 'Conflict', contentType) => createErrorResponse(HTTP_STATUS.CONFLICT, msg, contentType),
|
|
68
|
+
gone: (msg = 'Gone', contentType) => createErrorResponse(410, msg, contentType),
|
|
69
|
+
lengthRequired: (msg = 'Length Required', contentType) => createErrorResponse(411, msg, contentType),
|
|
70
|
+
preconditionFailed: (msg = 'Precondition Failed', contentType) => createErrorResponse(412, msg, contentType),
|
|
71
|
+
payloadTooLarge: (msg = 'Payload Too Large', contentType) => createErrorResponse(413, msg, contentType),
|
|
72
|
+
uriTooLong: (msg = 'URI Too Long', contentType) => createErrorResponse(414, msg, contentType),
|
|
73
|
+
unsupportedMediaType: (msg = 'Unsupported Media Type', contentType) => createErrorResponse(415, msg, contentType),
|
|
74
|
+
rangeNotSatisfiable: (msg = 'Range Not Satisfiable', contentType) => createErrorResponse(416, msg, contentType),
|
|
75
|
+
expectationFailed: (msg = 'Expectation Failed', contentType) => createErrorResponse(417, msg, contentType),
|
|
67
76
|
imATeapot: (msg = "I'm a teapot", contentType) => createErrorResponse(418, msg, contentType),
|
|
68
|
-
misdirectedRequest: (msg =
|
|
69
|
-
unprocessableEntity: (msg =
|
|
70
|
-
locked: (msg =
|
|
71
|
-
failedDependency: (msg =
|
|
72
|
-
tooEarly: (msg =
|
|
73
|
-
upgradeRequired: (msg =
|
|
74
|
-
preconditionRequired: (msg =
|
|
75
|
-
tooManyRequests: (msg =
|
|
76
|
-
requestHeaderFieldsTooLarge: (msg =
|
|
77
|
-
unavailableForLegalReasons: (msg =
|
|
77
|
+
misdirectedRequest: (msg = 'Misdirected Request', contentType) => createErrorResponse(421, msg, contentType),
|
|
78
|
+
unprocessableEntity: (msg = 'Unprocessable Entity', contentType) => createErrorResponse(HTTP_STATUS.UNPROCESSABLE_ENTITY, msg, contentType),
|
|
79
|
+
locked: (msg = 'Locked', contentType) => createErrorResponse(423, msg, contentType),
|
|
80
|
+
failedDependency: (msg = 'Failed Dependency', contentType) => createErrorResponse(424, msg, contentType),
|
|
81
|
+
tooEarly: (msg = 'Too Early', contentType) => createErrorResponse(425, msg, contentType),
|
|
82
|
+
upgradeRequired: (msg = 'Upgrade Required', contentType) => createErrorResponse(426, msg, contentType),
|
|
83
|
+
preconditionRequired: (msg = 'Precondition Required', contentType) => createErrorResponse(428, msg, contentType),
|
|
84
|
+
tooManyRequests: (msg = 'Too Many Requests', contentType) => createErrorResponse(429, msg, contentType),
|
|
85
|
+
requestHeaderFieldsTooLarge: (msg = 'Request Header Fields Too Large', contentType) => createErrorResponse(431, msg, contentType),
|
|
86
|
+
unavailableForLegalReasons: (msg = 'Unavailable For Legal Reasons', contentType) => createErrorResponse(451, msg, contentType),
|
|
78
87
|
// 5xx Server Errors
|
|
79
|
-
internalServerError: (msg =
|
|
80
|
-
notImplemented: (msg =
|
|
81
|
-
badGateway: (msg =
|
|
82
|
-
serviceUnavailable: (msg =
|
|
83
|
-
gatewayTimeout: (msg =
|
|
84
|
-
httpVersionNotSupported: (msg =
|
|
85
|
-
variantAlsoNegotiates: (msg =
|
|
86
|
-
insufficientStorage: (msg =
|
|
87
|
-
loopDetected: (msg =
|
|
88
|
-
notExtended: (msg =
|
|
89
|
-
networkAuthenticationRequired: (msg =
|
|
88
|
+
internalServerError: (msg = 'Internal Server Error', contentType) => createErrorResponse(HTTP_STATUS.INTERNAL_SERVER_ERROR, msg, contentType),
|
|
89
|
+
notImplemented: (msg = 'Not Implemented', contentType) => createErrorResponse(501, msg, contentType),
|
|
90
|
+
badGateway: (msg = 'Bad Gateway', contentType) => createErrorResponse(502, msg, contentType),
|
|
91
|
+
serviceUnavailable: (msg = 'Service Unavailable', contentType) => createErrorResponse(503, msg, contentType),
|
|
92
|
+
gatewayTimeout: (msg = 'Gateway Timeout', contentType) => createErrorResponse(504, msg, contentType),
|
|
93
|
+
httpVersionNotSupported: (msg = 'HTTP Version Not Supported', contentType) => createErrorResponse(505, msg, contentType),
|
|
94
|
+
variantAlsoNegotiates: (msg = 'Variant Also Negotiates', contentType) => createErrorResponse(506, msg, contentType),
|
|
95
|
+
insufficientStorage: (msg = 'Insufficient Storage', contentType) => createErrorResponse(507, msg, contentType),
|
|
96
|
+
loopDetected: (msg = 'Loop Detected', contentType) => createErrorResponse(508, msg, contentType),
|
|
97
|
+
notExtended: (msg = 'Not Extended', contentType) => createErrorResponse(510, msg, contentType),
|
|
98
|
+
networkAuthenticationRequired: (msg = 'Network Authentication Required', contentType) => createErrorResponse(511, msg, contentType),
|
|
90
99
|
// Aliases for common use cases
|
|
91
|
-
invalidArgument: (msg =
|
|
92
|
-
rateLimitExceeded: (msg =
|
|
93
|
-
maintenance: (msg =
|
|
100
|
+
invalidArgument: (msg = 'Invalid Argument', contentType) => createErrorResponse(HTTP_STATUS.UNPROCESSABLE_ENTITY, msg, contentType),
|
|
101
|
+
rateLimitExceeded: (msg = 'Rate Limit Exceeded', contentType) => createErrorResponse(429, msg, contentType),
|
|
102
|
+
maintenance: (msg = 'Service Under Maintenance', contentType) => createErrorResponse(503, msg, contentType),
|
|
94
103
|
// Helper to create custom error with any status code
|
|
95
104
|
custom: (statusCode, msg, contentType) => createErrorResponse(statusCode, msg, contentType),
|
|
96
105
|
};
|
|
@@ -98,7 +107,7 @@ export function createResponse(statusCode, data, contentType = CONTENT_TYPES.JSO
|
|
|
98
107
|
const body = contentType === CONTENT_TYPES.JSON ? stringifyData(data) : data;
|
|
99
108
|
return new Response(body, {
|
|
100
109
|
status: statusCode,
|
|
101
|
-
headers: {
|
|
110
|
+
headers: { 'content-type': contentType },
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
113
|
export const protectedRoute = async (request, responseContentType) => {
|
|
@@ -106,14 +115,14 @@ export const protectedRoute = async (request, responseContentType) => {
|
|
|
106
115
|
const vector = getVectorInstance();
|
|
107
116
|
const protectedHandler = vector.getProtectedHandler();
|
|
108
117
|
if (!protectedHandler) {
|
|
109
|
-
throw APIError.unauthorized(
|
|
118
|
+
throw APIError.unauthorized('Authentication not configured', responseContentType);
|
|
110
119
|
}
|
|
111
120
|
try {
|
|
112
121
|
const authUser = await protectedHandler(request);
|
|
113
122
|
request.authUser = authUser;
|
|
114
123
|
}
|
|
115
124
|
catch (error) {
|
|
116
|
-
throw APIError.unauthorized(error instanceof Error ? error.message :
|
|
125
|
+
throw APIError.unauthorized(error instanceof Error ? error.message : 'Authentication failed', responseContentType);
|
|
117
126
|
}
|
|
118
127
|
};
|
|
119
128
|
export function api(options, fn) {
|
|
@@ -122,7 +131,7 @@ export function api(options, fn) {
|
|
|
122
131
|
// This wrapper is only used when routes are NOT auto-discovered
|
|
123
132
|
return async (request) => {
|
|
124
133
|
if (!expose) {
|
|
125
|
-
return APIError.forbidden(
|
|
134
|
+
return APIError.forbidden('Forbidden');
|
|
126
135
|
}
|
|
127
136
|
try {
|
|
128
137
|
if (auth) {
|
|
@@ -133,9 +142,7 @@ export function api(options, fn) {
|
|
|
133
142
|
}
|
|
134
143
|
// Cache handling is now done in the router
|
|
135
144
|
const result = await fn(request);
|
|
136
|
-
return rawResponse
|
|
137
|
-
? result
|
|
138
|
-
: ApiResponse.success(result, responseContentType);
|
|
145
|
+
return rawResponse ? result : ApiResponse.success(result, responseContentType);
|
|
139
146
|
}
|
|
140
147
|
catch (err) {
|
|
141
148
|
// Ensure we return a Response object
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkC,WAAW,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkC,WAAW,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOlD,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,C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'./http';
|
|
2
2
|
export { route };
|
|
3
|
-
export { APIError, createResponse } from
|
|
4
|
-
export * from
|
|
3
|
+
export { APIError, createResponse } from './http';
|
|
4
|
+
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|