blaizejs 0.3.2 → 0.3.4

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 (30) hide show
  1. package/dist/chunk-DTDGIBMA.js +11 -0
  2. package/dist/{chunk-IFP53BNM.js.map → chunk-DTDGIBMA.js.map} +1 -1
  3. package/dist/{unsupported-media-type-error-VVHRDTUH.js → chunk-EE2VJ6JY.js} +3 -9
  4. package/dist/{chunk-3VK325MM.js.map → chunk-EE2VJ6JY.js.map} +1 -1
  5. package/dist/chunk-HSLLYUVO.js +11 -0
  6. package/dist/{chunk-CQKM74J4.js.map → chunk-HSLLYUVO.js.map} +1 -1
  7. package/dist/chunk-TL4GIFTB.js +11 -0
  8. package/dist/{chunk-HB6MRTGD.js.map → chunk-TL4GIFTB.js.map} +1 -1
  9. package/dist/chunk-VLVWNGUO.js +11 -0
  10. package/dist/{chunk-7IM52S7P.js.map → chunk-VLVWNGUO.js.map} +1 -1
  11. package/dist/index.cjs +12 -3486
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +2 -2
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.js +12 -3153
  16. package/dist/index.js.map +1 -1
  17. package/dist/{validation-error-TXMSFWZL.js → internal-server-error-GWBNT3OO.js} +3 -9
  18. package/dist/{internal-server-error-PVME2DGN.js → payload-too-large-error-EBM5BNWG.js} +3 -9
  19. package/dist/{payload-too-large-error-QQG7MKGT.js → unsupported-media-type-error-YQ7GCZ32.js} +3 -9
  20. package/dist/validation-error-6JDCGV2S.js +11 -0
  21. package/package.json +5 -5
  22. package/dist/chunk-3VK325MM.js +0 -31
  23. package/dist/chunk-7IM52S7P.js +0 -31
  24. package/dist/chunk-CQKM74J4.js +0 -39
  25. package/dist/chunk-HB6MRTGD.js +0 -39
  26. package/dist/chunk-IFP53BNM.js +0 -149
  27. /package/dist/{internal-server-error-PVME2DGN.js.map → internal-server-error-GWBNT3OO.js.map} +0 -0
  28. /package/dist/{payload-too-large-error-QQG7MKGT.js.map → payload-too-large-error-EBM5BNWG.js.map} +0 -0
  29. /package/dist/{unsupported-media-type-error-VVHRDTUH.js.map → unsupported-media-type-error-YQ7GCZ32.js.map} +0 -0
  30. /package/dist/{validation-error-TXMSFWZL.js.map → validation-error-6JDCGV2S.js.map} +0 -0
@@ -1,17 +1,11 @@
1
1
 
2
2
  /**
3
- * blaizejs v0.3.2
3
+ * blaizejs v0.3.4
4
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
5
  *
6
6
  * Copyright (c) 2025 BlaizeJS Contributors
7
7
  * @license MIT
8
8
  */
9
9
 
10
- import {
11
- ValidationError
12
- } from "./chunk-HB6MRTGD.js";
13
- import "./chunk-IFP53BNM.js";
14
- export {
15
- ValidationError
16
- };
17
- //# sourceMappingURL=validation-error-TXMSFWZL.js.map
10
+ import{a}from"./chunk-HSLLYUVO.js";import"./chunk-DTDGIBMA.js";export{a as InternalServerError};
11
+ //# sourceMappingURL=internal-server-error-GWBNT3OO.js.map
@@ -1,17 +1,11 @@
1
1
 
2
2
  /**
3
- * blaizejs v0.3.2
3
+ * blaizejs v0.3.4
4
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
5
  *
6
6
  * Copyright (c) 2025 BlaizeJS Contributors
7
7
  * @license MIT
8
8
  */
9
9
 
10
- import {
11
- InternalServerError
12
- } from "./chunk-CQKM74J4.js";
13
- import "./chunk-IFP53BNM.js";
14
- export {
15
- InternalServerError
16
- };
17
- //# sourceMappingURL=internal-server-error-PVME2DGN.js.map
10
+ import{a}from"./chunk-EE2VJ6JY.js";import"./chunk-DTDGIBMA.js";export{a as PayloadTooLargeError};
11
+ //# sourceMappingURL=payload-too-large-error-EBM5BNWG.js.map
@@ -1,17 +1,11 @@
1
1
 
2
2
  /**
3
- * blaizejs v0.3.2
3
+ * blaizejs v0.3.4
4
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
5
  *
6
6
  * Copyright (c) 2025 BlaizeJS Contributors
7
7
  * @license MIT
8
8
  */
9
9
 
10
- import {
11
- PayloadTooLargeError
12
- } from "./chunk-3VK325MM.js";
13
- import "./chunk-IFP53BNM.js";
14
- export {
15
- PayloadTooLargeError
16
- };
17
- //# sourceMappingURL=payload-too-large-error-QQG7MKGT.js.map
10
+ import{a}from"./chunk-VLVWNGUO.js";import"./chunk-DTDGIBMA.js";export{a as UnsupportedMediaTypeError};
11
+ //# sourceMappingURL=unsupported-media-type-error-YQ7GCZ32.js.map
@@ -0,0 +1,11 @@
1
+
2
+ /**
3
+ * blaizejs v0.3.4
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-TL4GIFTB.js";import"./chunk-DTDGIBMA.js";export{a as ValidationError};
11
+ //# sourceMappingURL=validation-error-6JDCGV2S.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blaizejs",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
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,14 +28,14 @@
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",
@@ -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,31 +0,0 @@
1
-
2
- /**
3
- * blaizejs v0.3.2
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 {
11
- BlaizeError,
12
- getCurrentCorrelationId
13
- } from "./chunk-IFP53BNM.js";
14
-
15
- // src/errors/payload-too-large-error.ts
16
- var PayloadTooLargeError = class extends BlaizeError {
17
- constructor(title, details, correlationId) {
18
- super(
19
- "PAYLOAD_TOO_LARGE" /* PAYLOAD_TOO_LARGE */,
20
- title,
21
- 413,
22
- correlationId ?? getCurrentCorrelationId(),
23
- details
24
- );
25
- }
26
- };
27
-
28
- export {
29
- PayloadTooLargeError
30
- };
31
- //# sourceMappingURL=chunk-3VK325MM.js.map
@@ -1,31 +0,0 @@
1
-
2
- /**
3
- * blaizejs v0.3.2
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 {
11
- BlaizeError,
12
- getCurrentCorrelationId
13
- } from "./chunk-IFP53BNM.js";
14
-
15
- // src/errors/unsupported-media-type-error.ts
16
- var UnsupportedMediaTypeError = class extends BlaizeError {
17
- constructor(title, details, correlationId) {
18
- super(
19
- "UNSUPPORTED_MEDIA_TYPE" /* UNSUPPORTED_MEDIA_TYPE */,
20
- title,
21
- 415,
22
- correlationId ?? getCurrentCorrelationId(),
23
- details
24
- );
25
- }
26
- };
27
-
28
- export {
29
- UnsupportedMediaTypeError
30
- };
31
- //# sourceMappingURL=chunk-7IM52S7P.js.map
@@ -1,39 +0,0 @@
1
-
2
- /**
3
- * blaizejs v0.3.2
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 {
11
- BlaizeError,
12
- getCurrentCorrelationId
13
- } from "./chunk-IFP53BNM.js";
14
-
15
- // src/errors/internal-server-error.ts
16
- var InternalServerError = class extends BlaizeError {
17
- /**
18
- * Creates a new InternalServerError instance
19
- *
20
- * @param title - Human-readable error message
21
- * @param details - Optional debugging context
22
- * @param correlationId - Optional correlation ID (uses current context if not provided)
23
- */
24
- constructor(title, details = void 0, correlationId = void 0) {
25
- super(
26
- "INTERNAL_SERVER_ERROR" /* INTERNAL_SERVER_ERROR */,
27
- title,
28
- 500,
29
- // HTTP 500 Internal Server Error
30
- correlationId ?? getCurrentCorrelationId(),
31
- details
32
- );
33
- }
34
- };
35
-
36
- export {
37
- InternalServerError
38
- };
39
- //# sourceMappingURL=chunk-CQKM74J4.js.map
@@ -1,39 +0,0 @@
1
-
2
- /**
3
- * blaizejs v0.3.2
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 {
11
- BlaizeError,
12
- getCurrentCorrelationId
13
- } from "./chunk-IFP53BNM.js";
14
-
15
- // src/errors/validation-error.ts
16
- var ValidationError = class extends BlaizeError {
17
- /**
18
- * Creates a new ValidationError instance
19
- *
20
- * @param title - Human-readable error message
21
- * @param details - Optional structured validation details
22
- * @param correlationId - Optional correlation ID (uses current context if not provided)
23
- */
24
- constructor(title, details = void 0, correlationId = void 0) {
25
- super(
26
- "VALIDATION_ERROR" /* VALIDATION_ERROR */,
27
- title,
28
- 400,
29
- // HTTP 400 Bad Request
30
- correlationId ?? getCurrentCorrelationId(),
31
- details
32
- );
33
- }
34
- };
35
-
36
- export {
37
- ValidationError
38
- };
39
- //# sourceMappingURL=chunk-HB6MRTGD.js.map
@@ -1,149 +0,0 @@
1
-
2
- /**
3
- * blaizejs v0.3.2
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
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof require !== "undefined") return require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
16
-
17
- // ../blaize-types/src/errors.ts
18
- var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
19
- ErrorType2["VALIDATION_ERROR"] = "VALIDATION_ERROR";
20
- ErrorType2["NOT_FOUND"] = "NOT_FOUND";
21
- ErrorType2["UNAUTHORIZED"] = "UNAUTHORIZED";
22
- ErrorType2["FORBIDDEN"] = "FORBIDDEN";
23
- ErrorType2["CONFLICT"] = "CONFLICT";
24
- ErrorType2["RATE_LIMITED"] = "RATE_LIMITED";
25
- ErrorType2["INTERNAL_SERVER_ERROR"] = "INTERNAL_SERVER_ERROR";
26
- ErrorType2["PAYLOAD_TOO_LARGE"] = "PAYLOAD_TOO_LARGE";
27
- ErrorType2["UNSUPPORTED_MEDIA_TYPE"] = "UNSUPPORTED_MEDIA_TYPE";
28
- ErrorType2["UPLOAD_TIMEOUT"] = "UPLOAD_TIMEOUT";
29
- ErrorType2["UNPROCESSABLE_ENTITY"] = "UNPROCESSABLE_ENTITY";
30
- ErrorType2["NETWORK_ERROR"] = "NETWORK_ERROR";
31
- ErrorType2["TIMEOUT_ERROR"] = "TIMEOUT_ERROR";
32
- ErrorType2["PARSE_ERROR"] = "PARSE_ERROR";
33
- ErrorType2["HTTP_ERROR"] = "HTTP_ERROR";
34
- return ErrorType2;
35
- })(ErrorType || {});
36
- var ErrorSeverity = /* @__PURE__ */ ((ErrorSeverity2) => {
37
- ErrorSeverity2["LOW"] = "low";
38
- ErrorSeverity2["MEDIUM"] = "medium";
39
- ErrorSeverity2["HIGH"] = "high";
40
- ErrorSeverity2["CRITICAL"] = "critical";
41
- return ErrorSeverity2;
42
- })(ErrorSeverity || {});
43
- var BlaizeError = class extends Error {
44
- /**
45
- * Error type identifier from the ErrorType enum
46
- * Used for programmatic error handling and client-side error routing
47
- */
48
- type;
49
- /**
50
- * Human-readable error title/message
51
- * Should be descriptive enough for debugging but safe for end users
52
- */
53
- title;
54
- /**
55
- * HTTP status code associated with this error
56
- * Used by the error boundary to set appropriate response status
57
- */
58
- status;
59
- /**
60
- * Correlation ID for request tracing
61
- * Links this error to the specific request that generated it
62
- */
63
- correlationId;
64
- /**
65
- * Timestamp when the error occurred
66
- * Useful for debugging and log correlation
67
- */
68
- timestamp;
69
- /**
70
- * Additional error-specific details
71
- * Type-safe error context that varies by error type
72
- */
73
- details;
74
- /**
75
- * Creates a new BlaizeError instance
76
- *
77
- * @param type - Error type from the ErrorType enum
78
- * @param title - Human-readable error message
79
- * @param status - HTTP status code
80
- * @param correlationId - Request correlation ID for tracing
81
- * @param details - Optional error-specific details
82
- */
83
- constructor(type, title, status, correlationId, details) {
84
- super(title);
85
- this.name = this.constructor.name;
86
- this.type = type;
87
- this.title = title;
88
- this.status = status;
89
- this.correlationId = correlationId;
90
- this.timestamp = /* @__PURE__ */ new Date();
91
- this.details = details;
92
- Object.setPrototypeOf(this, new.target.prototype);
93
- if (Error.captureStackTrace) {
94
- Error.captureStackTrace(this, this.constructor);
95
- }
96
- }
97
- /**
98
- * Serializes the error to a plain object suitable for HTTP responses
99
- *
100
- * @returns Object representation of the error
101
- */
102
- toJSON() {
103
- const base = {
104
- type: this.type,
105
- title: this.title,
106
- status: this.status,
107
- correlationId: this.correlationId,
108
- timestamp: this.timestamp.toISOString()
109
- };
110
- if (this.details !== void 0) {
111
- return { ...base, details: this.details };
112
- }
113
- return base;
114
- }
115
- /**
116
- * Returns a string representation of the error
117
- * Includes correlation ID for easier debugging
118
- */
119
- toString() {
120
- return `${this.name}: ${this.title} [${this.correlationId}]`;
121
- }
122
- };
123
- function isBodyParseError(error) {
124
- return typeof error === "object" && error !== null && "type" in error && "message" in error && "error" in error && typeof error.type === "string" && typeof error.message === "string";
125
- }
126
-
127
- // src/errors/correlation.ts
128
- import { AsyncLocalStorage } from "node:async_hooks";
129
- var correlationStorage = new AsyncLocalStorage();
130
- function generateCorrelationId() {
131
- const timestamp = Date.now().toString(36);
132
- const random = Math.random().toString(36).substr(2, 9);
133
- return `req_${timestamp}_${random}`;
134
- }
135
- function getCurrentCorrelationId() {
136
- const stored = correlationStorage.getStore();
137
- return stored && stored.trim() ? stored : "unknown";
138
- }
139
-
140
- export {
141
- __require,
142
- ErrorType,
143
- ErrorSeverity,
144
- BlaizeError,
145
- isBodyParseError,
146
- generateCorrelationId,
147
- getCurrentCorrelationId
148
- };
149
- //# sourceMappingURL=chunk-IFP53BNM.js.map