expressentials 0.0.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/dist/index.js ADDED
@@ -0,0 +1,467 @@
1
+ // src/status/index.ts
2
+ var status = {
3
+ // 1xx Informational
4
+ continue: 100,
5
+ switchingProtocols: 101,
6
+ processing: 102,
7
+ earlyHints: 103,
8
+ // 2xx Success
9
+ ok: 200,
10
+ created: 201,
11
+ accepted: 202,
12
+ nonAuthoritativeInformation: 203,
13
+ noContent: 204,
14
+ resetContent: 205,
15
+ partialContent: 206,
16
+ // 3xx Redirection
17
+ multipleChoices: 300,
18
+ movedPermanently: 301,
19
+ found: 302,
20
+ seeOther: 303,
21
+ notModified: 304,
22
+ useProxy: 305,
23
+ temporaryRedirect: 307,
24
+ permanentRedirect: 308,
25
+ // 4xx Client Error
26
+ badRequest: 400,
27
+ unauthorized: 401,
28
+ paymentRequired: 402,
29
+ forbidden: 403,
30
+ notFound: 404,
31
+ methodNotAllowed: 405,
32
+ notAcceptable: 406,
33
+ proxyAuthenticationRequired: 407,
34
+ requestTimeout: 408,
35
+ conflict: 409,
36
+ gone: 410,
37
+ lengthRequired: 411,
38
+ preconditionFailed: 412,
39
+ payloadTooLarge: 413,
40
+ uriTooLong: 414,
41
+ unsupportedMediaType: 415,
42
+ rangeNotSatisfiable: 416,
43
+ expectationFailed: 417,
44
+ imATeapot: 418,
45
+ unprocessableEntity: 422,
46
+ tooEarly: 425,
47
+ upgradeRequired: 426,
48
+ preconditionRequired: 428,
49
+ tooManyRequests: 429,
50
+ requestHeaderFieldsTooLarge: 431,
51
+ unavailableForLegalReasons: 451,
52
+ // 5xx Server Error
53
+ internalServerError: 500,
54
+ notImplemented: 501,
55
+ badGateway: 502,
56
+ serviceUnavailable: 503,
57
+ gatewayTimeout: 504,
58
+ httpVersionNotSupported: 505,
59
+ insufficientStorage: 507,
60
+ loopDetected: 508,
61
+ notExtended: 510,
62
+ networkAuthenticationRequired: 511
63
+ };
64
+
65
+ // src/message/index.ts
66
+ var message = {
67
+ // 1xx Informational
68
+ continue: "Continue",
69
+ switchingProtocols: "Switching Protocols",
70
+ processing: "Processing request",
71
+ earlyHints: "Early hints available",
72
+ // 2xx Success
73
+ ok: "Success",
74
+ created: "Created successfully",
75
+ accepted: "Request accepted",
76
+ nonAuthoritativeInformation: "Non-authoritative information",
77
+ noContent: "No content",
78
+ resetContent: "Reset content",
79
+ partialContent: "Partial content",
80
+ // 3xx Redirection
81
+ multipleChoices: "Multiple redirect options available",
82
+ movedPermanently: "Resource moved permanently",
83
+ found: "Resource found elsewhere",
84
+ seeOther: "See other resource",
85
+ notModified: "Resource not modified",
86
+ useProxy: "Use proxy to access resource",
87
+ temporaryRedirect: "Resource temporarily moved",
88
+ permanentRedirect: "Resource permanently moved",
89
+ // 4xx Client Error
90
+ badRequest: "Invalid request",
91
+ unauthorized: "Authentication required",
92
+ paymentRequired: "Payment required",
93
+ forbidden: "You don't have permission to access this resource",
94
+ notFound: "Resource not found",
95
+ methodNotAllowed: "Method not allowed for this resource",
96
+ notAcceptable: "Requested format not available",
97
+ proxyAuthenticationRequired: "Proxy authentication required",
98
+ requestTimeout: "Request timed out",
99
+ conflict: "Resource conflict detected",
100
+ gone: "Resource no longer available",
101
+ lengthRequired: "Content length header is required",
102
+ preconditionFailed: "Request precondition failed",
103
+ payloadTooLarge: "Request payload exceeds size limit",
104
+ uriTooLong: "Request URI exceeds length limit",
105
+ unsupportedMediaType: "Unsupported media type",
106
+ rangeNotSatisfiable: "Requested range is not available",
107
+ expectationFailed: "Request expectation could not be met",
108
+ imATeapot: "I'm a teapot",
109
+ unprocessableEntity: "Unable to process request entity",
110
+ tooEarly: "Request sent too early, retry later",
111
+ upgradeRequired: "Protocol upgrade required",
112
+ preconditionRequired: "Precondition header is required",
113
+ tooManyRequests: "Too many requests, please slow down",
114
+ requestHeaderFieldsTooLarge: "Request headers exceed size limit",
115
+ unavailableForLegalReasons: "Resource unavailable for legal reasons",
116
+ // 5xx Server Error
117
+ internalServerError: "Something went wrong on our end",
118
+ notImplemented: "Feature not yet implemented",
119
+ badGateway: "Bad gateway response from upstream",
120
+ serviceUnavailable: "Service temporarily unavailable, try again later",
121
+ gatewayTimeout: "Upstream server timed out",
122
+ httpVersionNotSupported: "HTTP version not supported by server",
123
+ insufficientStorage: "Server has insufficient storage",
124
+ loopDetected: "Infinite request loop detected",
125
+ notExtended: "Server cannot fulfill extended request",
126
+ networkAuthenticationRequired: "Network authentication required"
127
+ };
128
+
129
+ // src/errors/api-error.ts
130
+ var ApiError = class _ApiError extends Error {
131
+ constructor(statusCode, message2, details) {
132
+ super(message2 ??= getDefaultMessage(statusCode));
133
+ this.statusCode = statusCode;
134
+ this.details = details;
135
+ this.name = "ApiError";
136
+ }
137
+ statusCode;
138
+ details;
139
+ static notFound(message2) {
140
+ return new _ApiError(status.notFound, message2);
141
+ }
142
+ static badRequest(message2) {
143
+ return new _ApiError(status.badRequest, message2);
144
+ }
145
+ static unauthorized(message2) {
146
+ return new _ApiError(status.unauthorized, message2);
147
+ }
148
+ static forbidden(message2) {
149
+ return new _ApiError(status.forbidden, message2);
150
+ }
151
+ static conflict(message2) {
152
+ return new _ApiError(status.conflict, message2);
153
+ }
154
+ static internalServerError(message2) {
155
+ return new _ApiError(status.internalServerError, message2);
156
+ }
157
+ static serviceUnavailable(message2) {
158
+ return new _ApiError(status.serviceUnavailable, message2);
159
+ }
160
+ static tooManyRequests(message2) {
161
+ return new _ApiError(status.tooManyRequests, message2);
162
+ }
163
+ };
164
+ function getDefaultMessage(code) {
165
+ const entry = Object.entries(status).find(([, v]) => v === code);
166
+ if (!entry) return "Error";
167
+ return message[entry[0]];
168
+ }
169
+
170
+ // src/errors/http-error.ts
171
+ var NotFound = class extends ApiError {
172
+ constructor(message2) {
173
+ super(404, message2);
174
+ }
175
+ };
176
+ var BadRequest = class extends ApiError {
177
+ constructor(message2) {
178
+ super(400, message2);
179
+ }
180
+ };
181
+ var Unauthorized = class extends ApiError {
182
+ constructor(message2) {
183
+ super(401, message2);
184
+ }
185
+ };
186
+ var Forbidden = class extends ApiError {
187
+ constructor(message2) {
188
+ super(403, message2);
189
+ }
190
+ };
191
+ var Conflict = class extends ApiError {
192
+ constructor(message2) {
193
+ super(409, message2);
194
+ }
195
+ };
196
+ var InternalServerError = class extends ApiError {
197
+ constructor(message2) {
198
+ super(500, message2);
199
+ }
200
+ };
201
+ var ServiceUnavailable = class extends ApiError {
202
+ constructor(message2) {
203
+ super(503, message2);
204
+ }
205
+ };
206
+ var TooManyRequests = class extends ApiError {
207
+ constructor(message2) {
208
+ super(429, message2);
209
+ }
210
+ };
211
+ var ValidationError = class extends ApiError {
212
+ constructor(message2, details) {
213
+ super(422, message2 ?? "Validation failed", details);
214
+ }
215
+ };
216
+ var GatewayTimeout = class extends ApiError {
217
+ constructor(message2) {
218
+ super(504, message2);
219
+ }
220
+ };
221
+
222
+ // src/logger/index.ts
223
+ var levelPriority = {
224
+ debug: 0,
225
+ info: 1,
226
+ warn: 2,
227
+ error: 3
228
+ };
229
+ var defaultDestination = (entry) => {
230
+ console.log(JSON.stringify(entry));
231
+ };
232
+ var Logger = class _Logger {
233
+ level;
234
+ destination;
235
+ bindings;
236
+ constructor(options = {}, bindings = {}) {
237
+ this.level = options.level ?? "info";
238
+ this.destination = options.destination ?? defaultDestination;
239
+ this.bindings = bindings;
240
+ }
241
+ shouldLog(level) {
242
+ return levelPriority[level] >= levelPriority[this.level];
243
+ }
244
+ log(level, ...args) {
245
+ if (!this.shouldLog(level)) return;
246
+ let message2;
247
+ let meta = {};
248
+ if (args.length === 1) {
249
+ message2 = String(args[0]);
250
+ } else if (typeof args[0] === "object" && args[0] !== null) {
251
+ meta = { ...args[0] };
252
+ message2 = String(args[1]);
253
+ } else {
254
+ message2 = String(args[0]);
255
+ if (args[1] !== void 0) {
256
+ meta = args[1];
257
+ }
258
+ }
259
+ this.destination({
260
+ level,
261
+ ...this.bindings,
262
+ ...meta,
263
+ ...message2 ? { message: message2 } : {}
264
+ });
265
+ }
266
+ debug(...args) {
267
+ this.log("debug", ...args);
268
+ }
269
+ info(...args) {
270
+ this.log("info", ...args);
271
+ }
272
+ warn(...args) {
273
+ this.log("warn", ...args);
274
+ }
275
+ error(...args) {
276
+ this.log("error", ...args);
277
+ }
278
+ child(bindings) {
279
+ return new _Logger(
280
+ { level: this.level, destination: this.destination },
281
+ { ...this.bindings, ...bindings }
282
+ );
283
+ }
284
+ };
285
+ function createLogger(options) {
286
+ return new Logger(options);
287
+ }
288
+
289
+ // src/context/index.ts
290
+ import { AsyncLocalStorage } from "async_hooks";
291
+ var storage = new AsyncLocalStorage();
292
+ function getRequestContext() {
293
+ return storage.getStore();
294
+ }
295
+ function getLogger() {
296
+ return storage.getStore()?.log;
297
+ }
298
+ function getRequestId() {
299
+ return storage.getStore()?.requestId;
300
+ }
301
+ function runWithContext(context, fn) {
302
+ storage.run(context, fn);
303
+ }
304
+
305
+ // src/middleware/error-handler.ts
306
+ function errorHandler(options = {}) {
307
+ const log = options.log ?? true;
308
+ return (err, _req, res, _next) => {
309
+ if (err instanceof ApiError) {
310
+ res.status(err.statusCode).json({
311
+ error: {
312
+ message: err.message,
313
+ statusCode: err.statusCode,
314
+ ...err.details !== void 0 && { details: err.details }
315
+ }
316
+ });
317
+ return;
318
+ }
319
+ if (log) {
320
+ console.error(err);
321
+ }
322
+ res.status(500).json({
323
+ error: {
324
+ message: message.internalServerError,
325
+ statusCode: 500
326
+ }
327
+ });
328
+ };
329
+ }
330
+
331
+ // src/middleware/request-id.ts
332
+ import crypto from "crypto";
333
+ function requestId(options = {}) {
334
+ const {
335
+ header = "x-request-id",
336
+ generator = crypto.randomUUID,
337
+ respectExisting = true
338
+ } = options;
339
+ return (req, res, next) => {
340
+ const existing = req.get(header);
341
+ const id = existing && respectExisting ? existing : generator();
342
+ req.requestId = id;
343
+ res.setHeader(header, id);
344
+ next();
345
+ };
346
+ }
347
+
348
+ // src/middleware/request-context.ts
349
+ function requestContext(options = {}) {
350
+ const logger = options.logger ?? new Logger();
351
+ return (req, _res, next) => {
352
+ const scoped = logger.child({ requestId: req.requestId });
353
+ req.log = scoped;
354
+ runWithContext({ requestId: req.requestId, log: scoped }, () => {
355
+ next();
356
+ });
357
+ };
358
+ }
359
+
360
+ // src/middleware/http-logger.ts
361
+ function httpLogger(options = {}) {
362
+ const { skip } = options;
363
+ return (req, res, next) => {
364
+ if (skip?.(req, res)) {
365
+ next();
366
+ return;
367
+ }
368
+ const start = Date.now();
369
+ res.on("finish", () => {
370
+ req.log.info({
371
+ method: req.method,
372
+ path: req.originalUrl ?? req.url,
373
+ status: res.statusCode,
374
+ durationMs: Date.now() - start
375
+ });
376
+ });
377
+ next();
378
+ };
379
+ }
380
+
381
+ // src/middleware/validate.ts
382
+ function defaultFormatter(error) {
383
+ if (error && typeof error === "object" && "issues" in error && Array.isArray(error.issues)) {
384
+ return error.issues;
385
+ }
386
+ if (error instanceof Error) {
387
+ return [{ path: [], message: error.message }];
388
+ }
389
+ return [{ path: [], message: String(error) }];
390
+ }
391
+ function validate(schemas, options = {}) {
392
+ const formatError = options.formatError ?? defaultFormatter;
393
+ return (req, _res, next) => {
394
+ try {
395
+ if (schemas.body) req.body = schemas.body.parse(req.body);
396
+ if (schemas.params) req.params = schemas.params.parse(req.params);
397
+ if (schemas.query) req.query = schemas.query.parse(req.query);
398
+ next();
399
+ } catch (err) {
400
+ next(new ValidationError("Validation failed", formatError(err)));
401
+ }
402
+ };
403
+ }
404
+
405
+ // src/middleware/async-handler.ts
406
+ function asyncHandler(fn) {
407
+ return (req, res, next) => {
408
+ Promise.resolve(fn(req, res, next)).catch(next);
409
+ };
410
+ }
411
+
412
+ // src/middleware/timeout.ts
413
+ function timeout(ms, options = {}) {
414
+ return (req, _res, next) => {
415
+ const timer = setTimeout(() => {
416
+ next(new GatewayTimeout(options.message ?? "Request timed out"));
417
+ }, ms);
418
+ const done = () => clearTimeout(timer);
419
+ _res.on("finish", done);
420
+ _res.on("close", done);
421
+ next();
422
+ };
423
+ }
424
+
425
+ // src/middleware/health-check.ts
426
+ function healthCheck(options = {}) {
427
+ const getUptime = options.uptime ?? (() => process.uptime());
428
+ const getTimestamp = options.timestamp ?? (() => (/* @__PURE__ */ new Date()).toISOString());
429
+ return (_req, res, _next) => {
430
+ res.json({
431
+ status: "ok",
432
+ uptime: getUptime(),
433
+ timestamp: getTimestamp(),
434
+ ...options.checks?.() ?? {}
435
+ });
436
+ };
437
+ }
438
+ export {
439
+ ApiError,
440
+ BadRequest,
441
+ Conflict,
442
+ Forbidden,
443
+ GatewayTimeout,
444
+ InternalServerError,
445
+ Logger,
446
+ NotFound,
447
+ ServiceUnavailable,
448
+ TooManyRequests,
449
+ Unauthorized,
450
+ ValidationError,
451
+ asyncHandler,
452
+ createLogger,
453
+ errorHandler,
454
+ getLogger,
455
+ getRequestContext,
456
+ getRequestId,
457
+ healthCheck,
458
+ httpLogger,
459
+ message,
460
+ requestContext,
461
+ requestId,
462
+ runWithContext,
463
+ status,
464
+ timeout,
465
+ validate
466
+ };
467
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/status/index.ts","../src/message/index.ts","../src/errors/api-error.ts","../src/errors/http-error.ts","../src/logger/index.ts","../src/context/index.ts","../src/middleware/error-handler.ts","../src/middleware/request-id.ts","../src/middleware/request-context.ts","../src/middleware/http-logger.ts","../src/middleware/validate.ts","../src/middleware/async-handler.ts","../src/middleware/timeout.ts","../src/middleware/health-check.ts"],"sourcesContent":["export const status = {\n // 1xx Informational\n continue: 100,\n switchingProtocols: 101,\n processing: 102,\n earlyHints: 103,\n\n // 2xx Success\n ok: 200,\n created: 201,\n accepted: 202,\n nonAuthoritativeInformation: 203,\n noContent: 204,\n resetContent: 205,\n partialContent: 206,\n\n // 3xx Redirection\n multipleChoices: 300,\n movedPermanently: 301,\n found: 302,\n seeOther: 303,\n notModified: 304,\n useProxy: 305,\n temporaryRedirect: 307,\n permanentRedirect: 308,\n\n // 4xx Client Error\n badRequest: 400,\n unauthorized: 401,\n paymentRequired: 402,\n forbidden: 403,\n notFound: 404,\n methodNotAllowed: 405,\n notAcceptable: 406,\n proxyAuthenticationRequired: 407,\n requestTimeout: 408,\n conflict: 409,\n gone: 410,\n lengthRequired: 411,\n preconditionFailed: 412,\n payloadTooLarge: 413,\n uriTooLong: 414,\n unsupportedMediaType: 415,\n rangeNotSatisfiable: 416,\n expectationFailed: 417,\n imATeapot: 418,\n unprocessableEntity: 422,\n tooEarly: 425,\n upgradeRequired: 426,\n preconditionRequired: 428,\n tooManyRequests: 429,\n requestHeaderFieldsTooLarge: 431,\n unavailableForLegalReasons: 451,\n\n // 5xx Server Error\n internalServerError: 500,\n notImplemented: 501,\n badGateway: 502,\n serviceUnavailable: 503,\n gatewayTimeout: 504,\n httpVersionNotSupported: 505,\n insufficientStorage: 507,\n loopDetected: 508,\n notExtended: 510,\n networkAuthenticationRequired: 511,\n} as const;\n","export const message = {\n // 1xx Informational\n continue: \"Continue\",\n switchingProtocols: \"Switching Protocols\",\n processing: \"Processing request\",\n earlyHints: \"Early hints available\",\n\n // 2xx Success\n ok: \"Success\",\n created: \"Created successfully\",\n accepted: \"Request accepted\",\n nonAuthoritativeInformation: \"Non-authoritative information\",\n noContent: \"No content\",\n resetContent: \"Reset content\",\n partialContent: \"Partial content\",\n\n // 3xx Redirection\n multipleChoices: \"Multiple redirect options available\",\n movedPermanently: \"Resource moved permanently\",\n found: \"Resource found elsewhere\",\n seeOther: \"See other resource\",\n notModified: \"Resource not modified\",\n useProxy: \"Use proxy to access resource\",\n temporaryRedirect: \"Resource temporarily moved\",\n permanentRedirect: \"Resource permanently moved\",\n\n // 4xx Client Error\n badRequest: \"Invalid request\",\n unauthorized: \"Authentication required\",\n paymentRequired: \"Payment required\",\n forbidden: \"You don't have permission to access this resource\",\n notFound: \"Resource not found\",\n methodNotAllowed: \"Method not allowed for this resource\",\n notAcceptable: \"Requested format not available\",\n proxyAuthenticationRequired: \"Proxy authentication required\",\n requestTimeout: \"Request timed out\",\n conflict: \"Resource conflict detected\",\n gone: \"Resource no longer available\",\n lengthRequired: \"Content length header is required\",\n preconditionFailed: \"Request precondition failed\",\n payloadTooLarge: \"Request payload exceeds size limit\",\n uriTooLong: \"Request URI exceeds length limit\",\n unsupportedMediaType: \"Unsupported media type\",\n rangeNotSatisfiable: \"Requested range is not available\",\n expectationFailed: \"Request expectation could not be met\",\n imATeapot: \"I'm a teapot\",\n unprocessableEntity: \"Unable to process request entity\",\n tooEarly: \"Request sent too early, retry later\",\n upgradeRequired: \"Protocol upgrade required\",\n preconditionRequired: \"Precondition header is required\",\n tooManyRequests: \"Too many requests, please slow down\",\n requestHeaderFieldsTooLarge: \"Request headers exceed size limit\",\n unavailableForLegalReasons: \"Resource unavailable for legal reasons\",\n\n // 5xx Server Error\n internalServerError: \"Something went wrong on our end\",\n notImplemented: \"Feature not yet implemented\",\n badGateway: \"Bad gateway response from upstream\",\n serviceUnavailable: \"Service temporarily unavailable, try again later\",\n gatewayTimeout: \"Upstream server timed out\",\n httpVersionNotSupported: \"HTTP version not supported by server\",\n insufficientStorage: \"Server has insufficient storage\",\n loopDetected: \"Infinite request loop detected\",\n notExtended: \"Server cannot fulfill extended request\",\n networkAuthenticationRequired: \"Network authentication required\",\n} as const;\n","import { status } from \"../status/index.js\";\nimport { message } from \"../message/index.js\";\n\nexport class ApiError extends Error {\n constructor(\n public readonly statusCode: number,\n message?: string,\n public readonly details?: unknown,\n ) {\n super(message ??= getDefaultMessage(statusCode));\n this.name = \"ApiError\";\n }\n\n static notFound(message?: string) {\n return new ApiError(status.notFound, message);\n }\n\n static badRequest(message?: string) {\n return new ApiError(status.badRequest, message);\n }\n\n static unauthorized(message?: string) {\n return new ApiError(status.unauthorized, message);\n }\n\n static forbidden(message?: string) {\n return new ApiError(status.forbidden, message);\n }\n\n static conflict(message?: string) {\n return new ApiError(status.conflict, message);\n }\n\n static internalServerError(message?: string) {\n return new ApiError(status.internalServerError, message);\n }\n\n static serviceUnavailable(message?: string) {\n return new ApiError(status.serviceUnavailable, message);\n }\n\n static tooManyRequests(message?: string) {\n return new ApiError(status.tooManyRequests, message);\n }\n}\n\nfunction getDefaultMessage(code: number): string {\n const entry = Object.entries(status).find(([, v]) => v === code);\n if (!entry) return \"Error\";\n return message[entry[0] as keyof typeof message];\n}\n","import { ApiError } from \"./api-error.js\";\n\nexport class NotFound extends ApiError {\n constructor(message?: string) {\n super(404, message);\n }\n}\n\nexport class BadRequest extends ApiError {\n constructor(message?: string) {\n super(400, message);\n }\n}\n\nexport class Unauthorized extends ApiError {\n constructor(message?: string) {\n super(401, message);\n }\n}\n\nexport class Forbidden extends ApiError {\n constructor(message?: string) {\n super(403, message);\n }\n}\n\nexport class Conflict extends ApiError {\n constructor(message?: string) {\n super(409, message);\n }\n}\n\nexport class InternalServerError extends ApiError {\n constructor(message?: string) {\n super(500, message);\n }\n}\n\nexport class ServiceUnavailable extends ApiError {\n constructor(message?: string) {\n super(503, message);\n }\n}\n\nexport class TooManyRequests extends ApiError {\n constructor(message?: string) {\n super(429, message);\n }\n}\n\nexport class ValidationError extends ApiError {\n constructor(message?: string, details?: unknown) {\n super(422, message ?? \"Validation failed\", details);\n }\n}\n\nexport class GatewayTimeout extends ApiError {\n constructor(message?: string) {\n super(504, message);\n }\n}\n","export type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\n\nconst levelPriority: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n};\n\nexport interface LoggerEntry {\n level: LogLevel;\n message?: string;\n [key: string]: unknown;\n}\n\nexport type LogDestination = (entry: LoggerEntry) => void;\n\nexport interface LoggerOptions {\n level?: LogLevel;\n destination?: LogDestination;\n}\n\nconst defaultDestination: LogDestination = (entry) => {\n console.log(JSON.stringify(entry));\n};\n\nexport class Logger {\n private level: LogLevel;\n private destination: LogDestination;\n private bindings: Record<string, unknown>;\n\n constructor(options: LoggerOptions = {}, bindings: Record<string, unknown> = {}) {\n this.level = options.level ?? \"info\";\n this.destination = options.destination ?? defaultDestination;\n this.bindings = bindings;\n }\n\n private shouldLog(level: LogLevel): boolean {\n return levelPriority[level] >= levelPriority[this.level];\n }\n\n private log(level: LogLevel, ...args: [unknown, ...unknown[]]) {\n if (!this.shouldLog(level)) return;\n\n let message: string | undefined;\n let meta: Record<string, unknown> = {};\n\n if (args.length === 1) {\n message = String(args[0]);\n } else if (typeof args[0] === \"object\" && args[0] !== null) {\n meta = { ...args[0] as Record<string, unknown> };\n message = String(args[1]);\n } else {\n message = String(args[0]);\n if (args[1] !== undefined) {\n meta = args[1] as Record<string, unknown>;\n }\n }\n\n this.destination({\n level,\n ...this.bindings,\n ...meta,\n ...(message ? { message } : {}),\n });\n }\n\n debug(...args: [unknown, ...unknown[]]) {\n this.log(\"debug\", ...args);\n }\n\n info(...args: [unknown, ...unknown[]]) {\n this.log(\"info\", ...args);\n }\n\n warn(...args: [unknown, ...unknown[]]) {\n this.log(\"warn\", ...args);\n }\n\n error(...args: [unknown, ...unknown[]]) {\n this.log(\"error\", ...args);\n }\n\n child(bindings: Record<string, unknown>): Logger {\n return new Logger(\n { level: this.level, destination: this.destination },\n { ...this.bindings, ...bindings },\n );\n }\n}\n\nexport function createLogger(options?: LoggerOptions): Logger {\n return new Logger(options);\n}\n","import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Logger } from \"../logger/index.js\";\n\nexport interface RequestContext {\n requestId: string;\n log: Logger;\n}\n\nconst storage = new AsyncLocalStorage<RequestContext>();\n\nexport function getRequestContext(): RequestContext | undefined {\n return storage.getStore();\n}\n\nexport function getLogger(): Logger | undefined {\n return storage.getStore()?.log;\n}\n\nexport function getRequestId(): string | undefined {\n return storage.getStore()?.requestId;\n}\n\nexport function runWithContext(context: RequestContext, fn: () => void): void {\n storage.run(context, fn);\n}\n\nexport { storage };\n","import type { Request, Response, NextFunction } from \"express\";\nimport { ApiError } from \"../errors/api-error.js\";\nimport { message } from \"../message/index.js\";\n\nexport interface ErrorHandlerOptions {\n log?: boolean;\n}\n\nexport function errorHandler(options: ErrorHandlerOptions = {}) {\n const log = options.log ?? true;\n\n return (err: unknown, _req: Request, res: Response, _next: NextFunction): void => {\n if (err instanceof ApiError) {\n res.status(err.statusCode).json({\n error: {\n message: err.message,\n statusCode: err.statusCode,\n ...(err.details !== undefined && { details: err.details }),\n },\n });\n return;\n }\n\n if (log) {\n console.error(err);\n }\n\n res.status(500).json({\n error: {\n message: message.internalServerError,\n statusCode: 500,\n },\n });\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\nimport crypto from \"node:crypto\";\n\ndeclare global {\n namespace Express {\n interface Request {\n requestId: string;\n }\n }\n}\n\nexport interface RequestIdOptions {\n header?: string;\n generator?: () => string;\n respectExisting?: boolean;\n}\n\nexport function requestId(options: RequestIdOptions = {}) {\n const {\n header = \"x-request-id\",\n generator = crypto.randomUUID,\n respectExisting = true,\n } = options;\n\n return (req: Request, res: Response, next: NextFunction): void => {\n const existing = req.get(header);\n const id = existing && respectExisting ? existing : generator();\n\n req.requestId = id;\n res.setHeader(header, id);\n next();\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\nimport { Logger } from \"../logger/index.js\";\nimport { runWithContext } from \"../context/index.js\";\n\ndeclare global {\n namespace Express {\n interface Request {\n log: Logger;\n }\n }\n}\n\nexport interface RequestContextOptions {\n logger?: Logger;\n}\n\nexport function requestContext(options: RequestContextOptions = {}) {\n const logger = options.logger ?? new Logger();\n\n return (req: Request, _res: Response, next: NextFunction): void => {\n const scoped = logger.child({ requestId: req.requestId });\n req.log = scoped;\n\n runWithContext({ requestId: req.requestId, log: scoped }, () => {\n next();\n });\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\n\nexport interface HttpLoggerOptions {\n skip?: (req: Request, res: Response) => boolean;\n}\n\nexport function httpLogger(options: HttpLoggerOptions = {}) {\n const { skip } = options;\n\n return (req: Request, res: Response, next: NextFunction): void => {\n if (skip?.(req, res)) {\n next();\n return;\n }\n\n const start = Date.now();\n\n res.on(\"finish\", () => {\n req.log.info({\n method: req.method,\n path: req.originalUrl ?? req.url,\n status: res.statusCode,\n durationMs: Date.now() - start,\n });\n });\n\n next();\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\nimport { ValidationError } from \"../errors/http-error.js\";\n\nexport interface Schema {\n parse: (data: unknown) => unknown;\n}\n\nexport interface ValidationSchemas {\n body?: Schema;\n params?: Schema;\n query?: Schema;\n}\n\nexport interface ValidationIssue {\n path: (string | number)[];\n message: string;\n code?: string;\n}\n\nexport type IssueFormatter = (error: unknown) => ValidationIssue[];\n\nfunction defaultFormatter(error: unknown): ValidationIssue[] {\n if (\n error &&\n typeof error === \"object\" &&\n \"issues\" in error &&\n Array.isArray((error as { issues: unknown }).issues)\n ) {\n return (error as { issues: ValidationIssue[] }).issues;\n }\n\n if (error instanceof Error) {\n return [{ path: [], message: error.message }];\n }\n\n return [{ path: [], message: String(error) }];\n}\n\nexport interface ValidateOptions {\n formatError?: IssueFormatter;\n}\n\nexport function validate(\n schemas: ValidationSchemas,\n options: ValidateOptions = {},\n) {\n const formatError = options.formatError ?? defaultFormatter;\n\n return (req: Request, _res: Response, next: NextFunction): void => {\n try {\n if (schemas.body) req.body = schemas.body.parse(req.body);\n if (schemas.params) req.params = schemas.params.parse(req.params) as typeof req.params;\n if (schemas.query) req.query = schemas.query.parse(req.query) as typeof req.query;\n next();\n } catch (err) {\n next(new ValidationError(\"Validation failed\", formatError(err)));\n }\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\n\nexport function asyncHandler(\n fn: (req: Request, res: Response, next: NextFunction) => Promise<void>,\n) {\n return (req: Request, res: Response, next: NextFunction): void => {\n Promise.resolve(fn(req, res, next)).catch(next);\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\nimport { GatewayTimeout } from \"../errors/http-error.js\";\n\nexport interface TimeoutOptions {\n message?: string;\n}\n\nexport function timeout(ms: number, options: TimeoutOptions = {}) {\n return (req: Request, _res: Response, next: NextFunction): void => {\n const timer = setTimeout(() => {\n next(new GatewayTimeout(options.message ?? \"Request timed out\"));\n }, ms);\n\n const done = () => clearTimeout(timer);\n\n _res.on(\"finish\", done);\n _res.on(\"close\", done);\n\n next();\n };\n}\n","import type { Request, Response, NextFunction } from \"express\";\n\nexport interface HealthCheckOptions {\n uptime?: () => number;\n timestamp?: () => string;\n checks?: () => Record<string, unknown>;\n}\n\nexport function healthCheck(options: HealthCheckOptions = {}) {\n const getUptime = options.uptime ?? (() => process.uptime());\n const getTimestamp = options.timestamp ?? (() => new Date().toISOString());\n\n return (_req: Request, res: Response, _next: NextFunction): void => {\n res.json({\n status: \"ok\",\n uptime: getUptime(),\n timestamp: getTimestamp(),\n ...(options.checks?.() ?? {}),\n });\n };\n}\n"],"mappings":";AAAO,IAAM,SAAS;AAAA;AAAA,EAEpB,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,YAAY;AAAA,EACZ,YAAY;AAAA;AAAA,EAGZ,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,UAAU;AAAA,EACV,6BAA6B;AAAA,EAC7B,WAAW;AAAA,EACX,cAAc;AAAA,EACd,gBAAgB;AAAA;AAAA,EAGhB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,aAAa;AAAA,EACb,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,mBAAmB;AAAA;AAAA,EAGnB,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,6BAA6B;AAAA,EAC7B,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA,EACnB,WAAW;AAAA,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,GAAE,YAAY;AAExE,SAAO,CAAC,MAAe,KAAe,UAA8B;AAClE,QAAI,KAAK;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ,UAAU;AAAA,MAClB,WAAW,aAAa;AAAA,MACxB,GAAI,QAAQ,SAAS,KAAK,CAAC;AAAA,IAC7B,CAAC;AAAA,EACH;AACF;","names":["message","message","message"]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "expressentials",
3
+ "version": "0.0.1",
4
+ "description": "Essential Express.js helpers — status codes, errors, logging, validation, and more",
5
+ "keywords": [
6
+ "express",
7
+ "expressjs",
8
+ "middleware",
9
+ "http",
10
+ "status",
11
+ "errors",
12
+ "logger",
13
+ "validation",
14
+ "request-id",
15
+ "health-check"
16
+ ],
17
+ "homepage": "https://github.com/callmegautam/expressentials#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/callmegautam/expressentials.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/callmegautam/expressentials/issues"
24
+ },
25
+ "license": "MIT",
26
+ "author": "Gautam Suthar (https://github.com/callmegautam)",
27
+ "type": "module",
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js",
35
+ "require": "./dist/index.cjs"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "scripts": {
42
+ "build": "tsup",
43
+ "dev": "tsup --watch",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "format": "prettier --check \"src/**/*.ts\"",
47
+ "format:fix": "prettier --write \"src/**/*.ts\"",
48
+ "typecheck": "tsc --noEmit"
49
+ },
50
+ "peerDependencies": {
51
+ "express": "^4.18.0 || ^5.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/express": "^5.0.0",
55
+ "express": "^5.0.0",
56
+ "prettier": "^3.9.4",
57
+ "tsup": "^8.4.0",
58
+ "typescript": "^5.7.0",
59
+ "vitest": "^2.1.0"
60
+ }
61
+ }