@asenajs/ergenecore 1.5.0 → 3.0.0
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 +20 -5
- package/dist/lib/Ergenecore.d.ts +70 -63
- package/dist/lib/Ergenecore.js +359 -351
- package/dist/lib/Ergenecore.js.map +1 -1
- package/dist/lib/ErgenecoreContextWrapper.js +4 -1
- package/dist/lib/ErgenecoreContextWrapper.js.map +1 -1
- package/dist/lib/ErgenecoreWebsocketAdapter.js +14 -2
- package/dist/lib/ErgenecoreWebsocketAdapter.js.map +1 -1
- package/dist/lib/defaults/ConfigService.d.ts +19 -14
- package/dist/lib/defaults/ConfigService.js +5 -2
- package/dist/lib/defaults/ConfigService.js.map +1 -1
- package/dist/lib/defaults/MiddlewareService.d.ts +6 -2
- package/dist/lib/defaults/MiddlewareService.js.map +1 -1
- package/dist/lib/defaults/ValidationService.js.map +1 -1
- package/dist/lib/errors.d.ts +25 -85
- package/dist/lib/errors.js +34 -95
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/middlewares/RateLimiterMiddleware.d.ts +11 -2
- package/dist/lib/middlewares/RateLimiterMiddleware.js +29 -2
- package/dist/lib/middlewares/RateLimiterMiddleware.js.map +1 -1
- package/dist/lib/stream/SSEStreamWriter.js +6 -1
- package/dist/lib/stream/SSEStreamWriter.js.map +1 -1
- package/dist/lib/stream/StreamWriter.js +9 -2
- package/dist/lib/stream/StreamWriter.js.map +1 -1
- package/dist/lib/utils/factory.d.ts +10 -0
- package/dist/lib/utils/factory.js +2 -2
- package/dist/lib/utils/factory.js.map +1 -1
- package/package.json +15 -8
package/dist/lib/errors.js
CHANGED
|
@@ -1,106 +1,25 @@
|
|
|
1
|
-
import { VALIDATION_ERROR } from '@asenajs/asena/adapter';
|
|
1
|
+
import { HttpException, VALIDATION_ERROR, } from '@asenajs/asena/adapter';
|
|
2
|
+
import { flattenError } from 'zod';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* The exception applications throw, re-exported so `@asenajs/ergenecore` keeps offering it under
|
|
5
|
+
* the name it always had.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* // In middleware
|
|
11
|
-
* if (!user) {
|
|
12
|
-
* throw new HttpException(401, 'Unauthorized', {
|
|
13
|
-
* headers: { 'WWW-Authenticate': 'Bearer' }
|
|
14
|
-
* });
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* // In handler
|
|
18
|
-
* if (!isValid) {
|
|
19
|
-
* throw new HttpException(400, { error: 'Invalid data' });
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* // With cause
|
|
23
|
-
* try { await db.query(...) } catch (err) {
|
|
24
|
-
* throw new HttpException(500, 'Database Error', { cause: err });
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
7
|
+
* It used to be defined here. It now lives in `@asenajs/asena/adapter` so the hono adapter can
|
|
8
|
+
* offer the *same class* rather than a look-alike - one `throw new HttpException(...)` that
|
|
9
|
+
* compiles and behaves identically on both. This is a re-export, not a subclass: the class object
|
|
10
|
+
* is the one core exports, so `instanceof` holds across the two import paths.
|
|
27
11
|
*/
|
|
28
|
-
export
|
|
29
|
-
/**
|
|
30
|
-
* HTTP status code
|
|
31
|
-
*/
|
|
32
|
-
status;
|
|
33
|
-
/**
|
|
34
|
-
* Response body (can be string or object)
|
|
35
|
-
*/
|
|
36
|
-
body;
|
|
37
|
-
/**
|
|
38
|
-
* Optional response init options (headers, statusText, cause, etc.)
|
|
39
|
-
*/
|
|
40
|
-
options;
|
|
41
|
-
/**
|
|
42
|
-
* Creates a new HttpException
|
|
43
|
-
*
|
|
44
|
-
* @param status - HTTP status code (e.g., 401, 403, 404) or HttpStatusCode enum value
|
|
45
|
-
* @param body - Response body (string or object to be JSON stringified)
|
|
46
|
-
* @param options - Optional HttpExceptionInit options (headers, statusText, cause, etc.)
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```typescript
|
|
50
|
-
* // Simple message
|
|
51
|
-
* throw new HttpException(404, 'Not Found');
|
|
52
|
-
*
|
|
53
|
-
* // With HttpStatusCode enum
|
|
54
|
-
* throw new HttpException(ClientErrorStatusCode.NotFound, 'Not Found');
|
|
55
|
-
*
|
|
56
|
-
* // JSON object
|
|
57
|
-
* throw new HttpException(400, { error: 'Invalid input', field: 'email' });
|
|
58
|
-
*
|
|
59
|
-
* // With headers
|
|
60
|
-
* throw new HttpException(429, 'Too Many Requests', {
|
|
61
|
-
* headers: { 'Retry-After': '60' }
|
|
62
|
-
* });
|
|
63
|
-
*
|
|
64
|
-
* // With cause
|
|
65
|
-
* throw new HttpException(500, 'Internal Error', { cause: originalError });
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
constructor(status, body = '', options) {
|
|
69
|
-
const message = typeof body === 'string' ? body : JSON.stringify(body);
|
|
70
|
-
super(message, options?.cause ? { cause: options.cause } : undefined);
|
|
71
|
-
this.name = 'HttpException';
|
|
72
|
-
this.status = status;
|
|
73
|
-
this.body = body;
|
|
74
|
-
this.options = options;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Converts the exception to a Response object
|
|
78
|
-
*
|
|
79
|
-
* @returns Bun Response object ready to be returned
|
|
80
|
-
*/
|
|
81
|
-
getResponse() {
|
|
82
|
-
const body = typeof this.body === 'string' ? this.body : JSON.stringify(this.body);
|
|
83
|
-
const headers = new Headers(this.options?.headers);
|
|
84
|
-
// Set Content-Type to application/json if body is an object and not already set
|
|
85
|
-
if (typeof this.body === 'object' && !headers.has('Content-Type')) {
|
|
86
|
-
headers.set('Content-Type', 'application/json');
|
|
87
|
-
}
|
|
88
|
-
return new Response(body, {
|
|
89
|
-
status: this.status,
|
|
90
|
-
statusText: this.options?.statusText,
|
|
91
|
-
headers,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
12
|
+
export { HttpException } from '@asenajs/asena/adapter';
|
|
95
13
|
/**
|
|
96
14
|
* Thrown when request validation fails, so the failure reaches the application's
|
|
97
15
|
* `ConfigService.onError` like every other error instead of being answered inside
|
|
98
16
|
* the validation step.
|
|
99
17
|
*
|
|
100
|
-
* Extends `HttpException` with status 400 deliberately:
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
18
|
+
* Extends `HttpException` with status 400 deliberately: a handler that matches with
|
|
19
|
+
* `isHttpException()` and replies with `error.status` keeps answering 400, so adopting
|
|
20
|
+
* this does not silently turn validation failures into 500s. Check `isValidationError()`
|
|
21
|
+
* first if you want validation failures to get their own envelope - this is an
|
|
22
|
+
* `HttpException`, so the generic branch would otherwise swallow it.
|
|
104
23
|
*
|
|
105
24
|
* @example
|
|
106
25
|
* ```typescript
|
|
@@ -132,6 +51,26 @@ export class ValidationError extends HttpException {
|
|
|
132
51
|
code: issue.code,
|
|
133
52
|
}));
|
|
134
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The envelope the caller sees when the application does not answer this failure itself.
|
|
56
|
+
*
|
|
57
|
+
* It lives here rather than in the adapter so a validation failure has exactly one response
|
|
58
|
+
* shape - the adapter used to build a richer body inline for applications with no `onError`
|
|
59
|
+
* and fall back to the bare `HttpException` text for everyone else, so the same failure
|
|
60
|
+
* answered two different bodies depending on an unrelated hook.
|
|
61
|
+
*
|
|
62
|
+
* Built on each call rather than stored: a `Response` body can only be read once.
|
|
63
|
+
*/
|
|
64
|
+
getResponse() {
|
|
65
|
+
return new Response(JSON.stringify({
|
|
66
|
+
error: 'Validation failed',
|
|
67
|
+
details: flattenError(this.cause),
|
|
68
|
+
target: this.target,
|
|
69
|
+
}), {
|
|
70
|
+
status: this.status,
|
|
71
|
+
headers: { 'Content-Type': 'application/json' },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
135
74
|
}
|
|
136
75
|
/**
|
|
137
76
|
* Internal error class for middleware response propagation
|
package/dist/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,gBAAgB,GAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAiB,MAAM,KAAK,CAAC;AAElD;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAA0B,MAAM,wBAAwB,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAChC,CAAC,gBAAgB,CAAC,GAAG,IAAa,CAAC;IAEnD,qFAAqF;IACrE,MAAM,CAAS;IAE/B,6CAA6C;IAC7B,MAAM,CAAoB;IAE1C,mEAAmE;IACnD,KAAK,CAAW;IAEhC,YAAmB,KAAe,EAAE,MAAc;QAChD,KAAK,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;QAEhC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACzC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC/F,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACI,WAAW;QAChB,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,SAAS,CAAC;YACb,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;YACjC,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,EACF;YACE,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;SAChD,CACF,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAChD;;OAEG;IACa,QAAQ,CAAW;IAEnC;;;;OAIG;IACH,YAAmB,QAAkB;QACnC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -295,9 +295,18 @@ export declare class RateLimiterMiddleware extends MiddlewareService {
|
|
|
295
295
|
*/
|
|
296
296
|
handle(context: Context, next: () => Promise<void>): Promise<any>;
|
|
297
297
|
/**
|
|
298
|
-
* Cleanup resources (stop cleanup timer)
|
|
298
|
+
* Cleanup resources (stop cleanup timer, drop every bucket)
|
|
299
299
|
*
|
|
300
|
-
*
|
|
300
|
+
* Wired to `@OnStop`, so `server.stop()` releases it without the application having to
|
|
301
|
+
* remember. The timer is `unref()`'d and will not hold the process open, but nothing about
|
|
302
|
+
* unref makes it *stop*: across an in-process restart - the twenty stop/start cycles a test
|
|
303
|
+
* suite performs, a watch-mode reload - each generation of the middleware left behind a live
|
|
304
|
+
* interval and a bucket Map still holding one entry per client that ever called.
|
|
305
|
+
*
|
|
306
|
+
* Inherited by subclasses: the hook is collected across the prototype chain, so a
|
|
307
|
+
* `class ApiRateLimiter extends RateLimiterMiddleware` is released without redeclaring it.
|
|
308
|
+
*
|
|
309
|
+
* Idempotent - the handle is dropped, so a second stop() finds nothing to clear.
|
|
301
310
|
*/
|
|
302
311
|
destroy(): void;
|
|
303
312
|
/**
|
|
@@ -46,7 +46,17 @@
|
|
|
46
46
|
* public login() { ... }
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
50
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
51
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
52
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
53
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
54
|
+
};
|
|
55
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
56
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
57
|
+
};
|
|
49
58
|
import { MiddlewareService } from '../defaults';
|
|
59
|
+
import { OnStop } from '@asenajs/asena/decorators/ioc';
|
|
50
60
|
/**
|
|
51
61
|
* Rate Limiter Middleware
|
|
52
62
|
*
|
|
@@ -238,14 +248,25 @@ export class RateLimiterMiddleware extends MiddlewareService {
|
|
|
238
248
|
return await next();
|
|
239
249
|
}
|
|
240
250
|
/**
|
|
241
|
-
* Cleanup resources (stop cleanup timer)
|
|
251
|
+
* Cleanup resources (stop cleanup timer, drop every bucket)
|
|
242
252
|
*
|
|
243
|
-
*
|
|
253
|
+
* Wired to `@OnStop`, so `server.stop()` releases it without the application having to
|
|
254
|
+
* remember. The timer is `unref()`'d and will not hold the process open, but nothing about
|
|
255
|
+
* unref makes it *stop*: across an in-process restart - the twenty stop/start cycles a test
|
|
256
|
+
* suite performs, a watch-mode reload - each generation of the middleware left behind a live
|
|
257
|
+
* interval and a bucket Map still holding one entry per client that ever called.
|
|
258
|
+
*
|
|
259
|
+
* Inherited by subclasses: the hook is collected across the prototype chain, so a
|
|
260
|
+
* `class ApiRateLimiter extends RateLimiterMiddleware` is released without redeclaring it.
|
|
261
|
+
*
|
|
262
|
+
* Idempotent - the handle is dropped, so a second stop() finds nothing to clear.
|
|
244
263
|
*/
|
|
245
264
|
destroy() {
|
|
246
265
|
if (this.cleanupTimer) {
|
|
247
266
|
clearInterval(this.cleanupTimer);
|
|
267
|
+
this.cleanupTimer = undefined;
|
|
248
268
|
}
|
|
269
|
+
this.buckets.clear();
|
|
249
270
|
}
|
|
250
271
|
/**
|
|
251
272
|
* Get current bucket state for a client (for testing/debugging)
|
|
@@ -300,4 +321,10 @@ export class RateLimiterMiddleware extends MiddlewareService {
|
|
|
300
321
|
this.cleanupTimer.unref();
|
|
301
322
|
}
|
|
302
323
|
}
|
|
324
|
+
__decorate([
|
|
325
|
+
OnStop(),
|
|
326
|
+
__metadata("design:type", Function),
|
|
327
|
+
__metadata("design:paramtypes", []),
|
|
328
|
+
__metadata("design:returntype", void 0)
|
|
329
|
+
], RateLimiterMiddleware.prototype, "destroy", null);
|
|
303
330
|
//# sourceMappingURL=RateLimiterMiddleware.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RateLimiterMiddleware.js","sourceRoot":"","sources":["../../../lib/middlewares/RateLimiterMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG
|
|
1
|
+
{"version":3,"file":"RateLimiterMiddleware.js","sourceRoot":"","sources":["../../../lib/middlewares/RateLimiterMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;;;;;;;;;;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAoIvD;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,YAAY,EAAE,CAAC;gBAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,EAAE,QAAQ,CAAC,CAAC;QAEb,uCAAuC;QACvC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AArEQ;IADN,MAAM,EAAE;;;;oDAQR"}
|
|
@@ -9,7 +9,12 @@ export class SSEStreamWriter extends StreamWriter {
|
|
|
9
9
|
.split(/\r\n|\r|\n/)
|
|
10
10
|
.map((line) => `data: ${line}`)
|
|
11
11
|
.join('\n');
|
|
12
|
-
const sseData = [
|
|
12
|
+
const sseData = [
|
|
13
|
+
message.event && `event: ${message.event}`,
|
|
14
|
+
dataLines,
|
|
15
|
+
message.id && `id: ${message.id}`,
|
|
16
|
+
message.retry && `retry: ${message.retry}`,
|
|
17
|
+
]
|
|
13
18
|
.filter(Boolean)
|
|
14
19
|
.join('\n') + '\n\n';
|
|
15
20
|
await this.write(sseData);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SSEStreamWriter.js","sourceRoot":"","sources":["../../../lib/stream/SSEStreamWriter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IACxC,KAAK,CAAC,QAAQ,CAAC,OAAmB;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI;aAC3B,KAAK,CAAC,YAAY,CAAC;aACnB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC;aAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,OAAO,GACX,
|
|
1
|
+
{"version":3,"file":"SSEStreamWriter.js","sourceRoot":"","sources":["../../../lib/stream/SSEStreamWriter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IACxC,KAAK,CAAC,QAAQ,CAAC,OAAmB;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI;aAC3B,KAAK,CAAC,YAAY,CAAC;aACnB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC;aAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,OAAO,GACX;YACE,OAAO,CAAC,KAAK,IAAI,UAAU,OAAO,CAAC,KAAK,EAAE;YAC1C,SAAS;YACT,OAAO,CAAC,EAAE,IAAI,OAAO,OAAO,CAAC,EAAE,EAAE;YACjC,OAAO,CAAC,KAAK,IAAI,UAAU,OAAO,CAAC,KAAK,EAAE;SAC3C;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QAEzB,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -21,7 +21,12 @@ export class StreamWriter {
|
|
|
21
21
|
this.responseReadable = new ReadableStream({
|
|
22
22
|
async pull(controller) {
|
|
23
23
|
const { done, value } = await reader.read();
|
|
24
|
-
|
|
24
|
+
if (done) {
|
|
25
|
+
controller.close();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
controller.enqueue(value);
|
|
29
|
+
}
|
|
25
30
|
},
|
|
26
31
|
cancel: () => {
|
|
27
32
|
this.abort();
|
|
@@ -65,7 +70,9 @@ export class StreamWriter {
|
|
|
65
70
|
abort() {
|
|
66
71
|
if (!this.aborted) {
|
|
67
72
|
this.aborted = true;
|
|
68
|
-
|
|
73
|
+
// A subscriber may be async - `reader.cancel()` above is. `abort()` is called from a
|
|
74
|
+
// sync teardown path and cannot wait for them, so the promise is dropped deliberately.
|
|
75
|
+
this.abortSubscribers.forEach((subscriber) => void subscriber());
|
|
69
76
|
}
|
|
70
77
|
}
|
|
71
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamWriter.js","sourceRoot":"","sources":["../../../lib/stream/StreamWriter.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,CAA8B;IAEpC,OAAO,CAAc;IAErB,QAAQ,CAAiB;IAEzB,gBAAgB,GAAmC,EAAE,CAAC;IAE9C,gBAAgB,CAAiB;IAE1C,OAAO,GAAG,KAAK,CAAC;IAEhB,MAAM,GAAG,KAAK,CAAC;IAEtB,YAAmB,QAAwB,EAAE,QAAwB;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAEjC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QAEpC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;YACpC,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,gBAAgB,GAAG,IAAI,cAAc,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,UAAU;gBACnB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;gBAE5C,IAAI,
|
|
1
|
+
{"version":3,"file":"StreamWriter.js","sourceRoot":"","sources":["../../../lib/stream/StreamWriter.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,CAA8B;IAEpC,OAAO,CAAc;IAErB,QAAQ,CAAiB;IAEzB,gBAAgB,GAAmC,EAAE,CAAC;IAE9C,gBAAgB,CAAiB;IAE1C,OAAO,GAAG,KAAK,CAAC;IAEhB,MAAM,GAAG,KAAK,CAAC;IAE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I,CAAC,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAoB;QACpC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;IAC1C,CAAC;IAEM,OAAO,CAAC,QAAoC;QACjD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,qFAAqF;YACrF,uFAAuF;YACvF,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,KAAK,UAAU,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -48,6 +48,16 @@ export interface ErgenecoreOptions {
|
|
|
48
48
|
* Only used if enableWebSocket is true
|
|
49
49
|
*/
|
|
50
50
|
websocketAdapter?: ErgenecoreWebsocketAdapter;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the adapter logs an error before handing it to the application's `onError`.
|
|
53
|
+
*
|
|
54
|
+
* 5xx logs at `error` with a stack, 4xx at `debug` (falling back to `info`) without one.
|
|
55
|
+
* Set `false` when your own handler already logs with a correlation id - otherwise every
|
|
56
|
+
* failure produces two uncorrelatable lines.
|
|
57
|
+
*
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
logErrors?: boolean;
|
|
51
61
|
}
|
|
52
62
|
/**
|
|
53
63
|
* Creates a new Ergenecore adapter instance with optional configuration
|
|
@@ -48,13 +48,13 @@ import { Ergenecore } from '../Ergenecore';
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
export function createErgenecoreAdapter(options = {}) {
|
|
51
|
-
const { port = 3000, hostname, logger, enableWebSocket = true, websocketAdapter } = options;
|
|
51
|
+
const { port = 3000, hostname, logger, enableWebSocket = true, websocketAdapter, logErrors = true } = options;
|
|
52
52
|
// Create default logger if not provided
|
|
53
53
|
const adapterLogger = logger || createDefaultLogger();
|
|
54
54
|
// Create WebSocket adapter if enabled
|
|
55
55
|
const wsAdapter = enableWebSocket ? websocketAdapter || new ErgenecoreWebsocketAdapter(adapterLogger) : undefined;
|
|
56
56
|
// Create Ergenecore instance
|
|
57
|
-
const adapter = new Ergenecore(adapterLogger, wsAdapter);
|
|
57
|
+
const adapter = new Ergenecore(adapterLogger, wsAdapter, logErrors);
|
|
58
58
|
// Configure port and hostname
|
|
59
59
|
adapter.setPort(port);
|
|
60
60
|
if (hostname) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../lib/utils/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../lib/utils/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAgD3C;;;;;;;;;;;;;;;;;;;;;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,OAAe,EAAE,EAAE;YAC3B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,uBAAuB,CAAC,UAA6B,EAAE;IACrE,OAAO,uBAAuB,CAAC;QAC7B,GAAG,OAAO;QACV,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,IAAI;KACjD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAA6B,EAAE;IACtE,OAAO,uBAAuB,CAAC;QAC7B,IAAI,EAAE,IAAI;QACV,GAAG,OAAO;QACV,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,mBAAmB,EAAE;QAC/C,eAAe,EAAE,IAAI;KACtB,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -9,14 +9,18 @@
|
|
|
9
9
|
"README.md",
|
|
10
10
|
"LICENSE"
|
|
11
11
|
],
|
|
12
|
-
"version": "
|
|
12
|
+
"version": "3.0.0",
|
|
13
13
|
"author": "LibirSoft",
|
|
14
14
|
"license": "MIT",
|
|
15
|
+
"engines": {
|
|
16
|
+
"bun": ">=1.3.12"
|
|
17
|
+
},
|
|
15
18
|
"scripts": {
|
|
16
19
|
"test": "bun test",
|
|
17
20
|
"test:watch": "bun test --watch",
|
|
18
21
|
"test:coverage": "bun test --coverage",
|
|
19
22
|
"build": "bun run clean && tsc",
|
|
23
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
20
24
|
"clean": "rm -rf dist",
|
|
21
25
|
"prepublishOnly": "bun run build",
|
|
22
26
|
"benchmark": "bun run benchmark/run-benchmark.ts",
|
|
@@ -27,10 +31,13 @@
|
|
|
27
31
|
"format": "prettier --write .",
|
|
28
32
|
"format:check": "prettier --check .",
|
|
29
33
|
"check": "bun run lint && bun run format:check",
|
|
30
|
-
"check:fix": "bun run lint:fix && bun run format"
|
|
34
|
+
"check:fix": "bun run lint:fix && bun run format",
|
|
35
|
+
"changeset": "changeset",
|
|
36
|
+
"version": "changeset version",
|
|
37
|
+
"release": "bun run build && changeset publish"
|
|
31
38
|
},
|
|
32
39
|
"devDependencies": {
|
|
33
|
-
"@asenajs/asena": "^0.
|
|
40
|
+
"@asenajs/asena": "^0.10.0",
|
|
34
41
|
"@changesets/cli": "^2.30.0",
|
|
35
42
|
"@types/bun": "latest",
|
|
36
43
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
@@ -44,13 +51,13 @@
|
|
|
44
51
|
"eslint-plugin-prettier": "^5.5.5",
|
|
45
52
|
"eslint-plugin-promise": "^6.6.0",
|
|
46
53
|
"prettier": "^3.8.2",
|
|
47
|
-
"typescript
|
|
54
|
+
"typescript": "^5.9.3",
|
|
55
|
+
"typescript-eslint": "^8.58.1",
|
|
56
|
+
"zod": "^4.3.6"
|
|
48
57
|
},
|
|
49
58
|
"peerDependencies": {
|
|
50
|
-
"@asenajs/asena": "^0.
|
|
51
|
-
"typescript": "^5.9.3"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
59
|
+
"@asenajs/asena": "^0.10.0",
|
|
60
|
+
"typescript": "^5.9.3",
|
|
54
61
|
"zod": "^4.3.6"
|
|
55
62
|
}
|
|
56
63
|
}
|