blaizejs 0.3.1 → 0.3.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 (31) hide show
  1. package/README.md +462 -646
  2. package/dist/chunk-337RPHG5.js +11 -0
  3. package/dist/{chunk-3A5J5MKL.js.map → chunk-337RPHG5.js.map} +1 -1
  4. package/dist/chunk-HX7XLEO3.js +11 -0
  5. package/dist/{unsupported-media-type-error-VUXOJ72O.js.map → chunk-HX7XLEO3.js.map} +1 -1
  6. package/dist/chunk-KE2IOPV4.js +11 -0
  7. package/dist/{chunk-SF7ZGOEK.js.map → chunk-KE2IOPV4.js.map} +1 -1
  8. package/dist/chunk-LY65OJH4.js +11 -0
  9. package/dist/{payload-too-large-error-WZMDORKR.js.map → chunk-LY65OJH4.js.map} +1 -1
  10. package/dist/chunk-VM3QGHVO.js +11 -0
  11. package/dist/{chunk-ZZEQFU5V.js.map → chunk-VM3QGHVO.js.map} +1 -1
  12. package/dist/index.cjs +39 -3442
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +18 -2
  15. package/dist/index.d.ts +18 -2
  16. package/dist/index.js +39 -3117
  17. package/dist/index.js.map +1 -1
  18. package/dist/{validation-error-WZFF75S7.js → internal-server-error-JHHSKW5B.js} +4 -9
  19. package/dist/{internal-server-error-PKVC3ZEU.js → payload-too-large-error-SOQINKUL.js} +4 -9
  20. package/dist/unsupported-media-type-error-KJMHH5CY.js +11 -0
  21. package/dist/unsupported-media-type-error-KJMHH5CY.js.map +1 -0
  22. package/dist/validation-error-Q6IOTN4C.js +11 -0
  23. package/dist/validation-error-Q6IOTN4C.js.map +1 -0
  24. package/package.json +8 -8
  25. package/dist/chunk-3A5J5MKL.js +0 -38
  26. package/dist/chunk-SF7ZGOEK.js +0 -148
  27. package/dist/chunk-ZZEQFU5V.js +0 -38
  28. package/dist/payload-too-large-error-WZMDORKR.js +0 -29
  29. package/dist/unsupported-media-type-error-VUXOJ72O.js +0 -29
  30. /package/dist/{internal-server-error-PKVC3ZEU.js.map → internal-server-error-JHHSKW5B.js.map} +0 -0
  31. /package/dist/{validation-error-WZFF75S7.js.map → payload-too-large-error-SOQINKUL.js.map} +0 -0
@@ -1,16 +1,11 @@
1
+
1
2
  /**
2
- * blaizejs v0.3.1
3
+ * blaizejs v0.3.3
3
4
  * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
5
  *
5
6
  * Copyright (c) 2025 BlaizeJS Contributors
6
7
  * @license MIT
7
8
  */
8
9
 
9
- import {
10
- ValidationError
11
- } from "./chunk-3A5J5MKL.js";
12
- import "./chunk-SF7ZGOEK.js";
13
- export {
14
- ValidationError
15
- };
16
- //# sourceMappingURL=validation-error-WZFF75S7.js.map
10
+ import{a}from"./chunk-VM3QGHVO.js";import"./chunk-KE2IOPV4.js";export{a as InternalServerError};
11
+ //# sourceMappingURL=internal-server-error-JHHSKW5B.js.map
@@ -1,16 +1,11 @@
1
+
1
2
  /**
2
- * blaizejs v0.3.1
3
+ * blaizejs v0.3.3
3
4
  * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
5
  *
5
6
  * Copyright (c) 2025 BlaizeJS Contributors
6
7
  * @license MIT
7
8
  */
8
9
 
9
- import {
10
- InternalServerError
11
- } from "./chunk-ZZEQFU5V.js";
12
- import "./chunk-SF7ZGOEK.js";
13
- export {
14
- InternalServerError
15
- };
16
- //# sourceMappingURL=internal-server-error-PKVC3ZEU.js.map
10
+ import{a}from"./chunk-LY65OJH4.js";import"./chunk-KE2IOPV4.js";export{a as PayloadTooLargeError};
11
+ //# sourceMappingURL=payload-too-large-error-SOQINKUL.js.map
@@ -0,0 +1,11 @@
1
+
2
+ /**
3
+ * blaizejs v0.3.3
4
+ * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
5
+ *
6
+ * Copyright (c) 2025 BlaizeJS Contributors
7
+ * @license MIT
8
+ */
9
+
10
+ import{a}from"./chunk-HX7XLEO3.js";import"./chunk-KE2IOPV4.js";export{a as UnsupportedMediaTypeError};
11
+ //# sourceMappingURL=unsupported-media-type-error-KJMHH5CY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+
2
+ /**
3
+ * blaizejs v0.3.3
4
+ * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
5
+ *
6
+ * Copyright (c) 2025 BlaizeJS Contributors
7
+ * @license MIT
8
+ */
9
+
10
+ import{a}from"./chunk-337RPHG5.js";import"./chunk-KE2IOPV4.js";export{a as ValidationError};
11
+ //# sourceMappingURL=validation-error-Q6IOTN4C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaizejs",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.",
5
5
  "author": "J.Lea-Jones <jason@careymarcel.com>",
6
6
  "repository": {
@@ -28,23 +28,23 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "chokidar": "^4.0.3",
32
- "selfsigned": "^2.4.1",
33
31
  "zod": "^3.24.4"
34
32
  },
35
33
  "devDependencies": {
36
34
  "@types/node": "^22.15.17",
37
35
  "@types/selfsigned": "^2.1.0",
38
36
  "@vitest/coverage-v8": "^3.1.3",
37
+ "chokidar": "^4.0.3",
38
+ "selfsigned": "^2.4.1",
39
39
  "tsx": "^4.19.4",
40
40
  "typescript": "^5.8.3",
41
41
  "vite-tsconfig-paths": "^5.1.4",
42
42
  "vitest": "^3.1.3",
43
- "@blaizejs/testing-utils": "0.3.0",
44
43
  "@blaizejs/eslint-config": "0.1.0",
44
+ "@blaizejs/tsconfig": "0.1.0",
45
45
  "@blaizejs/tsup-config": "0.1.0",
46
- "@blaizejs/vitest-config": "0.1.0",
47
- "@blaizejs/tsconfig": "0.1.0"
46
+ "@blaizejs/testing-utils": "0.3.0",
47
+ "@blaizejs/vitest-config": "0.1.0"
48
48
  },
49
49
  "keywords": [
50
50
  "nodejs",
@@ -61,8 +61,8 @@
61
61
  "license": "MIT",
62
62
  "scripts": {
63
63
  "dev": "NODE_ENV=development tsx --watch src/examples/basic.ts",
64
- "build": "tsup",
65
- "build:watch": "tsup --watch",
64
+ "build": "NODE_ENV=production tsup --minify",
65
+ "build:watch": "NODE_ENV=production tsup --watch",
66
66
  "type-check": "tsc --noEmit",
67
67
  "test": "vitest run --typecheck",
68
68
  "test:watch": "vitest",
@@ -1,38 +0,0 @@
1
- /**
2
- * blaizejs v0.3.1
3
- * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
- *
5
- * Copyright (c) 2025 BlaizeJS Contributors
6
- * @license MIT
7
- */
8
-
9
- import {
10
- BlaizeError,
11
- getCurrentCorrelationId
12
- } from "./chunk-SF7ZGOEK.js";
13
-
14
- // src/errors/validation-error.ts
15
- var ValidationError = class extends BlaizeError {
16
- /**
17
- * Creates a new ValidationError instance
18
- *
19
- * @param title - Human-readable error message
20
- * @param details - Optional structured validation details
21
- * @param correlationId - Optional correlation ID (uses current context if not provided)
22
- */
23
- constructor(title, details = void 0, correlationId = void 0) {
24
- super(
25
- "VALIDATION_ERROR" /* VALIDATION_ERROR */,
26
- title,
27
- 400,
28
- // HTTP 400 Bad Request
29
- correlationId ?? getCurrentCorrelationId(),
30
- details
31
- );
32
- }
33
- };
34
-
35
- export {
36
- ValidationError
37
- };
38
- //# sourceMappingURL=chunk-3A5J5MKL.js.map
@@ -1,148 +0,0 @@
1
- /**
2
- * blaizejs v0.3.1
3
- * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
- *
5
- * Copyright (c) 2025 BlaizeJS Contributors
6
- * @license MIT
7
- */
8
-
9
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
- }) : x)(function(x) {
12
- if (typeof require !== "undefined") return require.apply(this, arguments);
13
- throw Error('Dynamic require of "' + x + '" is not supported');
14
- });
15
-
16
- // ../blaize-types/src/errors.ts
17
- var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
18
- ErrorType2["VALIDATION_ERROR"] = "VALIDATION_ERROR";
19
- ErrorType2["NOT_FOUND"] = "NOT_FOUND";
20
- ErrorType2["UNAUTHORIZED"] = "UNAUTHORIZED";
21
- ErrorType2["FORBIDDEN"] = "FORBIDDEN";
22
- ErrorType2["CONFLICT"] = "CONFLICT";
23
- ErrorType2["RATE_LIMITED"] = "RATE_LIMITED";
24
- ErrorType2["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
25
- ErrorType2["PAYLOAD_TOO_LARGE"] = "PAYLOAD_TOO_LARGE";
26
- ErrorType2["UNSUPPORTED_MEDIA_TYPE"] = "UNSUPPORTED_MEDIA_TYPE";
27
- ErrorType2["UPLOAD_TIMEOUT"] = "UPLOAD_TIMEOUT";
28
- ErrorType2["UNPROCESSABLE_ENTITY"] = "UNPROCESSABLE_ENTITY";
29
- ErrorType2["NETWORK_ERROR"] = "NETWORK_ERROR";
30
- ErrorType2["TIMEOUT_ERROR"] = "TIMEOUT_ERROR";
31
- ErrorType2["PARSE_ERROR"] = "PARSE_ERROR";
32
- ErrorType2["HTTP_ERROR"] = "HTTP_ERROR";
33
- return ErrorType2;
34
- })(ErrorType || {});
35
- var ErrorSeverity = /* @__PURE__ */ ((ErrorSeverity2) => {
36
- ErrorSeverity2["LOW"] = "low";
37
- ErrorSeverity2["MEDIUM"] = "medium";
38
- ErrorSeverity2["HIGH"] = "high";
39
- ErrorSeverity2["CRITICAL"] = "critical";
40
- return ErrorSeverity2;
41
- })(ErrorSeverity || {});
42
- var BlaizeError = class extends Error {
43
- /**
44
- * Error type identifier from the ErrorType enum
45
- * Used for programmatic error handling and client-side error routing
46
- */
47
- type;
48
- /**
49
- * Human-readable error title/message
50
- * Should be descriptive enough for debugging but safe for end users
51
- */
52
- title;
53
- /**
54
- * HTTP status code associated with this error
55
- * Used by the error boundary to set appropriate response status
56
- */
57
- status;
58
- /**
59
- * Correlation ID for request tracing
60
- * Links this error to the specific request that generated it
61
- */
62
- correlationId;
63
- /**
64
- * Timestamp when the error occurred
65
- * Useful for debugging and log correlation
66
- */
67
- timestamp;
68
- /**
69
- * Additional error-specific details
70
- * Type-safe error context that varies by error type
71
- */
72
- details;
73
- /**
74
- * Creates a new BlaizeError instance
75
- *
76
- * @param type - Error type from the ErrorType enum
77
- * @param title - Human-readable error message
78
- * @param status - HTTP status code
79
- * @param correlationId - Request correlation ID for tracing
80
- * @param details - Optional error-specific details
81
- */
82
- constructor(type, title, status, correlationId, details) {
83
- super(title);
84
- this.name = this.constructor.name;
85
- this.type = type;
86
- this.title = title;
87
- this.status = status;
88
- this.correlationId = correlationId;
89
- this.timestamp = /* @__PURE__ */ new Date();
90
- this.details = details;
91
- Object.setPrototypeOf(this, new.target.prototype);
92
- if (Error.captureStackTrace) {
93
- Error.captureStackTrace(this, this.constructor);
94
- }
95
- }
96
- /**
97
- * Serializes the error to a plain object suitable for HTTP responses
98
- *
99
- * @returns Object representation of the error
100
- */
101
- toJSON() {
102
- const base = {
103
- type: this.type,
104
- title: this.title,
105
- status: this.status,
106
- correlationId: this.correlationId,
107
- timestamp: this.timestamp.toISOString()
108
- };
109
- if (this.details !== void 0) {
110
- return { ...base, details: this.details };
111
- }
112
- return base;
113
- }
114
- /**
115
- * Returns a string representation of the error
116
- * Includes correlation ID for easier debugging
117
- */
118
- toString() {
119
- return `${this.name}: ${this.title} [${this.correlationId}]`;
120
- }
121
- };
122
- function isBodyParseError(error) {
123
- return typeof error === "object" && error !== null && "type" in error && "message" in error && "error" in error && typeof error.type === "string" && typeof error.message === "string";
124
- }
125
-
126
- // src/errors/correlation.ts
127
- import { AsyncLocalStorage } from "node:async_hooks";
128
- var correlationStorage = new AsyncLocalStorage();
129
- function generateCorrelationId() {
130
- const timestamp = Date.now().toString(36);
131
- const random = Math.random().toString(36).substr(2, 9);
132
- return `req_${timestamp}_${random}`;
133
- }
134
- function getCurrentCorrelationId() {
135
- const stored = correlationStorage.getStore();
136
- return stored && stored.trim() ? stored : "unknown";
137
- }
138
-
139
- export {
140
- __require,
141
- ErrorType,
142
- ErrorSeverity,
143
- BlaizeError,
144
- isBodyParseError,
145
- generateCorrelationId,
146
- getCurrentCorrelationId
147
- };
148
- //# sourceMappingURL=chunk-SF7ZGOEK.js.map
@@ -1,38 +0,0 @@
1
- /**
2
- * blaizejs v0.3.1
3
- * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
- *
5
- * Copyright (c) 2025 BlaizeJS Contributors
6
- * @license MIT
7
- */
8
-
9
- import {
10
- BlaizeError,
11
- getCurrentCorrelationId
12
- } from "./chunk-SF7ZGOEK.js";
13
-
14
- // src/errors/internal-server-error.ts
15
- var InternalServerError = class extends BlaizeError {
16
- /**
17
- * Creates a new InternalServerError instance
18
- *
19
- * @param title - Human-readable error message
20
- * @param details - Optional debugging context
21
- * @param correlationId - Optional correlation ID (uses current context if not provided)
22
- */
23
- constructor(title, details = void 0, correlationId = void 0) {
24
- super(
25
- "INTERNAL_SERVER_ERROR" /* INTERNAL_SERVER_ERROR */,
26
- title,
27
- 500,
28
- // HTTP 500 Internal Server Error
29
- correlationId ?? getCurrentCorrelationId(),
30
- details
31
- );
32
- }
33
- };
34
-
35
- export {
36
- InternalServerError
37
- };
38
- //# sourceMappingURL=chunk-ZZEQFU5V.js.map
@@ -1,29 +0,0 @@
1
- /**
2
- * blaizejs v0.3.1
3
- * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
- *
5
- * Copyright (c) 2025 BlaizeJS Contributors
6
- * @license MIT
7
- */
8
-
9
- import {
10
- BlaizeError,
11
- getCurrentCorrelationId
12
- } from "./chunk-SF7ZGOEK.js";
13
-
14
- // src/errors/payload-too-large-error.ts
15
- var PayloadTooLargeError = class extends BlaizeError {
16
- constructor(title, details, correlationId) {
17
- super(
18
- "PAYLOAD_TOO_LARGE" /* PAYLOAD_TOO_LARGE */,
19
- title,
20
- 413,
21
- correlationId ?? getCurrentCorrelationId(),
22
- details
23
- );
24
- }
25
- };
26
- export {
27
- PayloadTooLargeError
28
- };
29
- //# sourceMappingURL=payload-too-large-error-WZMDORKR.js.map
@@ -1,29 +0,0 @@
1
- /**
2
- * blaizejs v0.3.1
3
- * A blazing-fast, TypeScript-first Node.js framework with HTTP/2 support, file-based routing, powerful middleware system, and end-to-end type safety for building modern APIs.
4
- *
5
- * Copyright (c) 2025 BlaizeJS Contributors
6
- * @license MIT
7
- */
8
-
9
- import {
10
- BlaizeError,
11
- getCurrentCorrelationId
12
- } from "./chunk-SF7ZGOEK.js";
13
-
14
- // src/errors/unsupported-media-type-error.ts
15
- var UnsupportedMediaTypeError = class extends BlaizeError {
16
- constructor(title, details, correlationId) {
17
- super(
18
- "UNSUPPORTED_MEDIA_TYPE" /* UNSUPPORTED_MEDIA_TYPE */,
19
- title,
20
- 415,
21
- correlationId ?? getCurrentCorrelationId(),
22
- details
23
- );
24
- }
25
- };
26
- export {
27
- UnsupportedMediaTypeError
28
- };
29
- //# sourceMappingURL=unsupported-media-type-error-VUXOJ72O.js.map