@hemia/common 0.0.4 → 0.0.6
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/hemia-common.esm.js +232 -1
- package/dist/hemia-common.js +268 -0
- package/dist/types/errors/domain.error.d.ts +34 -0
- package/dist/types/errors/index.d.ts +3 -0
- package/dist/types/errors/infrastructure.error.d.ts +40 -0
- package/dist/types/errors/persistence.error.d.ts +43 -0
- package/dist/types/interfaces/configuration/aws-s3-configuration.interface.d.ts +6 -0
- package/dist/types/interfaces/configuration/drizzle-db-configuration.interface.d.ts +7 -0
- package/dist/types/interfaces/configuration/mongo-db-configuration.interface.d.ts +7 -0
- package/dist/types/interfaces/configuration/olap-db-configuration.interface.d.ts +6 -0
- package/dist/types/interfaces/configuration/redis-configuration.interface.d.ts +8 -0
- package/dist/types/interfaces/configuration/smtp-configuration.interface.d.ts +7 -0
- package/dist/types/interfaces/index.d.ts +6 -0
- package/package.json +1 -1
package/dist/hemia-common.esm.js
CHANGED
|
@@ -250,4 +250,235 @@ class HttpErrorWithDetails extends HttpError {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
class PersistenceError extends Error {
|
|
254
|
+
constructor(message, originalError) {
|
|
255
|
+
super(message);
|
|
256
|
+
this.originalError = originalError;
|
|
257
|
+
this.name = 'PersistenceError';
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
class DataNotFoundError extends PersistenceError {
|
|
261
|
+
constructor(entity, criteria, originalError) {
|
|
262
|
+
super(`${entity} not found with criteria: ${criteria}`, originalError);
|
|
263
|
+
this.name = 'DataNotFoundError';
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
class DataConflictError extends PersistenceError {
|
|
267
|
+
constructor(entity, criteria, originalError) {
|
|
268
|
+
super(`Data conflict for ${entity} with criteria: ${criteria}`, originalError);
|
|
269
|
+
this.name = 'DataConflictError';
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
class DataValidationError extends PersistenceError {
|
|
273
|
+
constructor(message, originalError) {
|
|
274
|
+
super(`Data Validation Error: ${message}`, originalError);
|
|
275
|
+
this.name = 'DataValidationError';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
class TransactionError extends PersistenceError {
|
|
279
|
+
constructor(message, originalError) {
|
|
280
|
+
super(`Transaction Error: ${message}`, originalError);
|
|
281
|
+
this.name = 'TransactionError';
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
class QueryExecutionError extends PersistenceError {
|
|
285
|
+
constructor(query, originalError) {
|
|
286
|
+
super(`Query Execution Error for query: ${query}`, originalError);
|
|
287
|
+
this.name = 'QueryExecutionError';
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
class ConnectionError extends PersistenceError {
|
|
291
|
+
constructor(databaseType, originalError) {
|
|
292
|
+
super(`Connection Error to ${databaseType} database`, originalError);
|
|
293
|
+
this.name = 'ConnectionError';
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
class SchemaMismatchError extends PersistenceError {
|
|
297
|
+
constructor(expectedSchema, actualSchema, originalError) {
|
|
298
|
+
super(`Schema Mismatch Error: expected ${expectedSchema}, got ${actualSchema}`, originalError);
|
|
299
|
+
this.name = 'SchemaMismatchError';
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
class DataIntegrityError extends PersistenceError {
|
|
303
|
+
constructor(message, originalError) {
|
|
304
|
+
super(`Data Integrity Error: ${message}`, originalError);
|
|
305
|
+
this.name = 'DataIntegrityError';
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
class BackupError extends PersistenceError {
|
|
309
|
+
constructor(message, originalError) {
|
|
310
|
+
super(`Backup Error: ${message}`, originalError);
|
|
311
|
+
this.name = 'BackupError';
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
class RestoreError extends PersistenceError {
|
|
315
|
+
constructor(message, originalError) {
|
|
316
|
+
super(`Restore Error: ${message}`, originalError);
|
|
317
|
+
this.name = 'RestoreError';
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
class IndexingError extends PersistenceError {
|
|
321
|
+
constructor(indexName, originalError) {
|
|
322
|
+
super(`Indexing Error on index: ${indexName}`, originalError);
|
|
323
|
+
this.name = 'IndexingError';
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
class DataMigrationError extends PersistenceError {
|
|
327
|
+
constructor(migrationName, originalError) {
|
|
328
|
+
super(`Data Migration Error during migration: ${migrationName}`, originalError);
|
|
329
|
+
this.name = 'DataMigrationError';
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
class ResourceLimitError extends PersistenceError {
|
|
333
|
+
constructor(resourceType, limit, originalError) {
|
|
334
|
+
super(`Resource Limit Exceeded: ${resourceType} limit of ${limit} has been exceeded`, originalError);
|
|
335
|
+
this.name = 'ResourceLimitError';
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Errores de lógica de negocio (Business Layer)
|
|
341
|
+
* No conocen HTTP, son agnósticos a la infraestructura
|
|
342
|
+
*/
|
|
343
|
+
class DomainError extends Error {
|
|
344
|
+
constructor(message) {
|
|
345
|
+
super(message);
|
|
346
|
+
this.name = 'DomainError';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
class EntityNotFoundError extends DomainError {
|
|
350
|
+
constructor(entity, criteria) {
|
|
351
|
+
super(`${entity} not found with criteria: ${criteria}`);
|
|
352
|
+
this.name = 'EntityNotFoundError';
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
class DuplicateEntityError extends DomainError {
|
|
356
|
+
constructor(entity, criteria) {
|
|
357
|
+
super(`Duplicate ${entity} found with criteria: ${criteria}`);
|
|
358
|
+
this.name = 'DuplicateEntityError';
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
class ValidationError extends DomainError {
|
|
362
|
+
constructor(message) {
|
|
363
|
+
super(`Validation Error: ${message}`);
|
|
364
|
+
this.name = 'ValidationError';
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
class BusinessRuleViolationError extends DomainError {
|
|
368
|
+
constructor(message) {
|
|
369
|
+
super(`Business Rule Violation: ${message}`);
|
|
370
|
+
this.name = 'BusinessRuleViolationError';
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
class OperationNotAllowedError extends DomainError {
|
|
374
|
+
constructor(operation) {
|
|
375
|
+
super(`Operation not allowed: ${operation}`);
|
|
376
|
+
this.name = 'OperationNotAllowedError';
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
class DependencyError extends DomainError {
|
|
380
|
+
constructor(dependency, message) {
|
|
381
|
+
super(`Dependency Error in ${dependency}: ${message}`);
|
|
382
|
+
this.name = 'DependencyError';
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
class TimeoutError extends DomainError {
|
|
386
|
+
constructor(operation, timeout) {
|
|
387
|
+
super(`Timeout Error: Operation "${operation}" exceeded time limit of ${timeout}ms`);
|
|
388
|
+
this.name = 'TimeoutError';
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
class ResourceLimitExceededError extends DomainError {
|
|
392
|
+
constructor(resource, limit) {
|
|
393
|
+
super(`Resource Limit Exceeded: ${resource} limit of ${limit} has been exceeded`);
|
|
394
|
+
this.name = 'ResourceLimitExceededError';
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
class ConfigurationError extends DomainError {
|
|
398
|
+
constructor(message) {
|
|
399
|
+
super(`Configuration Error: ${message}`);
|
|
400
|
+
this.name = 'ConfigurationError';
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
class InfrastructureError extends Error {
|
|
405
|
+
constructor(message, originalError) {
|
|
406
|
+
super(message);
|
|
407
|
+
this.originalError = originalError;
|
|
408
|
+
this.name = 'InfrastructureError';
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
class InfraDatabaseConnectionError extends InfrastructureError {
|
|
412
|
+
constructor(dbType, originalError) {
|
|
413
|
+
super(`Failed to connect to the ${dbType} database`, originalError);
|
|
414
|
+
this.name = 'InfraDatabaseConnectionError';
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
class InfraCacheConnectionError extends InfrastructureError {
|
|
418
|
+
constructor(cacheType, originalError) {
|
|
419
|
+
super(`Failed to connect to the ${cacheType} cache`, originalError);
|
|
420
|
+
this.name = 'InfraCacheConnectionError';
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
class InfraMessageQueueError extends InfrastructureError {
|
|
424
|
+
constructor(queueType, originalError) {
|
|
425
|
+
super(`Message Queue Error in ${queueType}`, originalError);
|
|
426
|
+
this.name = 'InfraMessageQueueError';
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
class InfraExternalServiceError extends InfrastructureError {
|
|
430
|
+
constructor(serviceName, originalError) {
|
|
431
|
+
super(`External Service Error: ${serviceName}`, originalError);
|
|
432
|
+
this.name = 'InfraExternalServiceError';
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
class InfraConfigurationError extends InfrastructureError {
|
|
436
|
+
constructor(configItem, originalError) {
|
|
437
|
+
super(`Configuration Error: ${configItem}`, originalError);
|
|
438
|
+
this.name = 'InfraConfigurationError';
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
class InfraNetworkError extends InfrastructureError {
|
|
442
|
+
constructor(message, originalError) {
|
|
443
|
+
super(`Network Error: ${message}`, originalError);
|
|
444
|
+
this.name = 'InfraNetworkError';
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
class InfraTimeoutError extends InfrastructureError {
|
|
448
|
+
constructor(operation, timeout, originalError) {
|
|
449
|
+
super(`Timeout Error: Operation "${operation}" exceeded time limit of ${timeout}ms`, originalError);
|
|
450
|
+
this.name = 'InfraTimeoutError';
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
class InfraAuthenticationError extends InfrastructureError {
|
|
454
|
+
constructor(message, originalError) {
|
|
455
|
+
super(`Authentication Error: ${message}`, originalError);
|
|
456
|
+
this.name = 'InfraAuthenticationError';
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
class InfraAuthorizationError extends InfrastructureError {
|
|
460
|
+
constructor(message, originalError) {
|
|
461
|
+
super(`Authorization Error: ${message}`, originalError);
|
|
462
|
+
this.name = 'InfraAuthorizationError';
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
class InfraServiceUnavailableError extends InfrastructureError {
|
|
466
|
+
constructor(serviceName, originalError) {
|
|
467
|
+
super(`Service Unavailable: ${serviceName}`, originalError);
|
|
468
|
+
this.name = 'InfraServiceUnavailableError';
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
class InfraDataSerializationError extends InfrastructureError {
|
|
472
|
+
constructor(dataType, originalError) {
|
|
473
|
+
super(`Data Serialization Error for type: ${dataType}`, originalError);
|
|
474
|
+
this.name = 'InfraDataSerializationError';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
class InfraDataDeserializationError extends InfrastructureError {
|
|
478
|
+
constructor(dataType, originalError) {
|
|
479
|
+
super(`Data Deserialization Error for type: ${dataType}`, originalError);
|
|
480
|
+
this.name = 'InfraDataDeserializationError';
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export { ApiResponse, BackupError, BadRequestError, Body, BusinessRuleViolationError, ConfigurationError, ConflictError, ConnectionError, Controller, CustomHttpError, DataConflictError, DataIntegrityError, DataMigrationError, DataNotFoundError, DataValidationError, Delete, DependencyError, DomainError, DuplicateEntityError, EntityNotFoundError, ForbiddenError, GatewayTimeoutError, Get, Head, Header, Headers, Host, HttpError, HttpErrorWithDetails, HttpMethod, IndexingError, InfraAuthenticationError, InfraAuthorizationError, InfraCacheConnectionError, InfraConfigurationError, InfraDataDeserializationError, InfraDataSerializationError, InfraDatabaseConnectionError, InfraExternalServiceError, InfraMessageQueueError, InfraNetworkError, InfraServiceUnavailableError, InfraTimeoutError, InfrastructureError, InternalServerError, Ip, METADATA_KEYS, Next, NotFoundError, OperationNotAllowedError, Options, Param, ParamType, Patch, PersistenceError, Post, Put, Query, QueryExecutionError, Redirect, Req, Request, Res, ResourceLimitError, ResourceLimitExceededError, Response, RestoreError, SchemaMismatchError, Serialize, ServiceUnavailableError, Session, SetMetadata, TimeoutError, TransactionError, UnauthorizedError, UnprocessableEntityError, UseGuards, UseInterceptors, ValidationError, isRedirectResponse };
|
package/dist/hemia-common.js
CHANGED
|
@@ -252,13 +252,257 @@ class HttpErrorWithDetails extends HttpError {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
class PersistenceError extends Error {
|
|
256
|
+
constructor(message, originalError) {
|
|
257
|
+
super(message);
|
|
258
|
+
this.originalError = originalError;
|
|
259
|
+
this.name = 'PersistenceError';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
class DataNotFoundError extends PersistenceError {
|
|
263
|
+
constructor(entity, criteria, originalError) {
|
|
264
|
+
super(`${entity} not found with criteria: ${criteria}`, originalError);
|
|
265
|
+
this.name = 'DataNotFoundError';
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
class DataConflictError extends PersistenceError {
|
|
269
|
+
constructor(entity, criteria, originalError) {
|
|
270
|
+
super(`Data conflict for ${entity} with criteria: ${criteria}`, originalError);
|
|
271
|
+
this.name = 'DataConflictError';
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
class DataValidationError extends PersistenceError {
|
|
275
|
+
constructor(message, originalError) {
|
|
276
|
+
super(`Data Validation Error: ${message}`, originalError);
|
|
277
|
+
this.name = 'DataValidationError';
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
class TransactionError extends PersistenceError {
|
|
281
|
+
constructor(message, originalError) {
|
|
282
|
+
super(`Transaction Error: ${message}`, originalError);
|
|
283
|
+
this.name = 'TransactionError';
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
class QueryExecutionError extends PersistenceError {
|
|
287
|
+
constructor(query, originalError) {
|
|
288
|
+
super(`Query Execution Error for query: ${query}`, originalError);
|
|
289
|
+
this.name = 'QueryExecutionError';
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
class ConnectionError extends PersistenceError {
|
|
293
|
+
constructor(databaseType, originalError) {
|
|
294
|
+
super(`Connection Error to ${databaseType} database`, originalError);
|
|
295
|
+
this.name = 'ConnectionError';
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
class SchemaMismatchError extends PersistenceError {
|
|
299
|
+
constructor(expectedSchema, actualSchema, originalError) {
|
|
300
|
+
super(`Schema Mismatch Error: expected ${expectedSchema}, got ${actualSchema}`, originalError);
|
|
301
|
+
this.name = 'SchemaMismatchError';
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
class DataIntegrityError extends PersistenceError {
|
|
305
|
+
constructor(message, originalError) {
|
|
306
|
+
super(`Data Integrity Error: ${message}`, originalError);
|
|
307
|
+
this.name = 'DataIntegrityError';
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
class BackupError extends PersistenceError {
|
|
311
|
+
constructor(message, originalError) {
|
|
312
|
+
super(`Backup Error: ${message}`, originalError);
|
|
313
|
+
this.name = 'BackupError';
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
class RestoreError extends PersistenceError {
|
|
317
|
+
constructor(message, originalError) {
|
|
318
|
+
super(`Restore Error: ${message}`, originalError);
|
|
319
|
+
this.name = 'RestoreError';
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
class IndexingError extends PersistenceError {
|
|
323
|
+
constructor(indexName, originalError) {
|
|
324
|
+
super(`Indexing Error on index: ${indexName}`, originalError);
|
|
325
|
+
this.name = 'IndexingError';
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
class DataMigrationError extends PersistenceError {
|
|
329
|
+
constructor(migrationName, originalError) {
|
|
330
|
+
super(`Data Migration Error during migration: ${migrationName}`, originalError);
|
|
331
|
+
this.name = 'DataMigrationError';
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
class ResourceLimitError extends PersistenceError {
|
|
335
|
+
constructor(resourceType, limit, originalError) {
|
|
336
|
+
super(`Resource Limit Exceeded: ${resourceType} limit of ${limit} has been exceeded`, originalError);
|
|
337
|
+
this.name = 'ResourceLimitError';
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Errores de lógica de negocio (Business Layer)
|
|
343
|
+
* No conocen HTTP, son agnósticos a la infraestructura
|
|
344
|
+
*/
|
|
345
|
+
class DomainError extends Error {
|
|
346
|
+
constructor(message) {
|
|
347
|
+
super(message);
|
|
348
|
+
this.name = 'DomainError';
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
class EntityNotFoundError extends DomainError {
|
|
352
|
+
constructor(entity, criteria) {
|
|
353
|
+
super(`${entity} not found with criteria: ${criteria}`);
|
|
354
|
+
this.name = 'EntityNotFoundError';
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
class DuplicateEntityError extends DomainError {
|
|
358
|
+
constructor(entity, criteria) {
|
|
359
|
+
super(`Duplicate ${entity} found with criteria: ${criteria}`);
|
|
360
|
+
this.name = 'DuplicateEntityError';
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
class ValidationError extends DomainError {
|
|
364
|
+
constructor(message) {
|
|
365
|
+
super(`Validation Error: ${message}`);
|
|
366
|
+
this.name = 'ValidationError';
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
class BusinessRuleViolationError extends DomainError {
|
|
370
|
+
constructor(message) {
|
|
371
|
+
super(`Business Rule Violation: ${message}`);
|
|
372
|
+
this.name = 'BusinessRuleViolationError';
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
class OperationNotAllowedError extends DomainError {
|
|
376
|
+
constructor(operation) {
|
|
377
|
+
super(`Operation not allowed: ${operation}`);
|
|
378
|
+
this.name = 'OperationNotAllowedError';
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
class DependencyError extends DomainError {
|
|
382
|
+
constructor(dependency, message) {
|
|
383
|
+
super(`Dependency Error in ${dependency}: ${message}`);
|
|
384
|
+
this.name = 'DependencyError';
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
class TimeoutError extends DomainError {
|
|
388
|
+
constructor(operation, timeout) {
|
|
389
|
+
super(`Timeout Error: Operation "${operation}" exceeded time limit of ${timeout}ms`);
|
|
390
|
+
this.name = 'TimeoutError';
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
class ResourceLimitExceededError extends DomainError {
|
|
394
|
+
constructor(resource, limit) {
|
|
395
|
+
super(`Resource Limit Exceeded: ${resource} limit of ${limit} has been exceeded`);
|
|
396
|
+
this.name = 'ResourceLimitExceededError';
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
class ConfigurationError extends DomainError {
|
|
400
|
+
constructor(message) {
|
|
401
|
+
super(`Configuration Error: ${message}`);
|
|
402
|
+
this.name = 'ConfigurationError';
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
class InfrastructureError extends Error {
|
|
407
|
+
constructor(message, originalError) {
|
|
408
|
+
super(message);
|
|
409
|
+
this.originalError = originalError;
|
|
410
|
+
this.name = 'InfrastructureError';
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
class InfraDatabaseConnectionError extends InfrastructureError {
|
|
414
|
+
constructor(dbType, originalError) {
|
|
415
|
+
super(`Failed to connect to the ${dbType} database`, originalError);
|
|
416
|
+
this.name = 'InfraDatabaseConnectionError';
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
class InfraCacheConnectionError extends InfrastructureError {
|
|
420
|
+
constructor(cacheType, originalError) {
|
|
421
|
+
super(`Failed to connect to the ${cacheType} cache`, originalError);
|
|
422
|
+
this.name = 'InfraCacheConnectionError';
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
class InfraMessageQueueError extends InfrastructureError {
|
|
426
|
+
constructor(queueType, originalError) {
|
|
427
|
+
super(`Message Queue Error in ${queueType}`, originalError);
|
|
428
|
+
this.name = 'InfraMessageQueueError';
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
class InfraExternalServiceError extends InfrastructureError {
|
|
432
|
+
constructor(serviceName, originalError) {
|
|
433
|
+
super(`External Service Error: ${serviceName}`, originalError);
|
|
434
|
+
this.name = 'InfraExternalServiceError';
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
class InfraConfigurationError extends InfrastructureError {
|
|
438
|
+
constructor(configItem, originalError) {
|
|
439
|
+
super(`Configuration Error: ${configItem}`, originalError);
|
|
440
|
+
this.name = 'InfraConfigurationError';
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
class InfraNetworkError extends InfrastructureError {
|
|
444
|
+
constructor(message, originalError) {
|
|
445
|
+
super(`Network Error: ${message}`, originalError);
|
|
446
|
+
this.name = 'InfraNetworkError';
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
class InfraTimeoutError extends InfrastructureError {
|
|
450
|
+
constructor(operation, timeout, originalError) {
|
|
451
|
+
super(`Timeout Error: Operation "${operation}" exceeded time limit of ${timeout}ms`, originalError);
|
|
452
|
+
this.name = 'InfraTimeoutError';
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
class InfraAuthenticationError extends InfrastructureError {
|
|
456
|
+
constructor(message, originalError) {
|
|
457
|
+
super(`Authentication Error: ${message}`, originalError);
|
|
458
|
+
this.name = 'InfraAuthenticationError';
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
class InfraAuthorizationError extends InfrastructureError {
|
|
462
|
+
constructor(message, originalError) {
|
|
463
|
+
super(`Authorization Error: ${message}`, originalError);
|
|
464
|
+
this.name = 'InfraAuthorizationError';
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
class InfraServiceUnavailableError extends InfrastructureError {
|
|
468
|
+
constructor(serviceName, originalError) {
|
|
469
|
+
super(`Service Unavailable: ${serviceName}`, originalError);
|
|
470
|
+
this.name = 'InfraServiceUnavailableError';
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
class InfraDataSerializationError extends InfrastructureError {
|
|
474
|
+
constructor(dataType, originalError) {
|
|
475
|
+
super(`Data Serialization Error for type: ${dataType}`, originalError);
|
|
476
|
+
this.name = 'InfraDataSerializationError';
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
class InfraDataDeserializationError extends InfrastructureError {
|
|
480
|
+
constructor(dataType, originalError) {
|
|
481
|
+
super(`Data Deserialization Error for type: ${dataType}`, originalError);
|
|
482
|
+
this.name = 'InfraDataDeserializationError';
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
255
486
|
exports.ApiResponse = ApiResponse;
|
|
487
|
+
exports.BackupError = BackupError;
|
|
256
488
|
exports.BadRequestError = BadRequestError;
|
|
257
489
|
exports.Body = Body;
|
|
490
|
+
exports.BusinessRuleViolationError = BusinessRuleViolationError;
|
|
491
|
+
exports.ConfigurationError = ConfigurationError;
|
|
258
492
|
exports.ConflictError = ConflictError;
|
|
493
|
+
exports.ConnectionError = ConnectionError;
|
|
259
494
|
exports.Controller = Controller;
|
|
260
495
|
exports.CustomHttpError = CustomHttpError;
|
|
496
|
+
exports.DataConflictError = DataConflictError;
|
|
497
|
+
exports.DataIntegrityError = DataIntegrityError;
|
|
498
|
+
exports.DataMigrationError = DataMigrationError;
|
|
499
|
+
exports.DataNotFoundError = DataNotFoundError;
|
|
500
|
+
exports.DataValidationError = DataValidationError;
|
|
261
501
|
exports.Delete = Delete;
|
|
502
|
+
exports.DependencyError = DependencyError;
|
|
503
|
+
exports.DomainError = DomainError;
|
|
504
|
+
exports.DuplicateEntityError = DuplicateEntityError;
|
|
505
|
+
exports.EntityNotFoundError = EntityNotFoundError;
|
|
262
506
|
exports.ForbiddenError = ForbiddenError;
|
|
263
507
|
exports.GatewayTimeoutError = GatewayTimeoutError;
|
|
264
508
|
exports.Get = Get;
|
|
@@ -268,28 +512,52 @@ exports.Headers = Headers;
|
|
|
268
512
|
exports.Host = Host;
|
|
269
513
|
exports.HttpError = HttpError;
|
|
270
514
|
exports.HttpErrorWithDetails = HttpErrorWithDetails;
|
|
515
|
+
exports.IndexingError = IndexingError;
|
|
516
|
+
exports.InfraAuthenticationError = InfraAuthenticationError;
|
|
517
|
+
exports.InfraAuthorizationError = InfraAuthorizationError;
|
|
518
|
+
exports.InfraCacheConnectionError = InfraCacheConnectionError;
|
|
519
|
+
exports.InfraConfigurationError = InfraConfigurationError;
|
|
520
|
+
exports.InfraDataDeserializationError = InfraDataDeserializationError;
|
|
521
|
+
exports.InfraDataSerializationError = InfraDataSerializationError;
|
|
522
|
+
exports.InfraDatabaseConnectionError = InfraDatabaseConnectionError;
|
|
523
|
+
exports.InfraExternalServiceError = InfraExternalServiceError;
|
|
524
|
+
exports.InfraMessageQueueError = InfraMessageQueueError;
|
|
525
|
+
exports.InfraNetworkError = InfraNetworkError;
|
|
526
|
+
exports.InfraServiceUnavailableError = InfraServiceUnavailableError;
|
|
527
|
+
exports.InfraTimeoutError = InfraTimeoutError;
|
|
528
|
+
exports.InfrastructureError = InfrastructureError;
|
|
271
529
|
exports.InternalServerError = InternalServerError;
|
|
272
530
|
exports.Ip = Ip;
|
|
273
531
|
exports.METADATA_KEYS = METADATA_KEYS;
|
|
274
532
|
exports.Next = Next;
|
|
275
533
|
exports.NotFoundError = NotFoundError;
|
|
534
|
+
exports.OperationNotAllowedError = OperationNotAllowedError;
|
|
276
535
|
exports.Options = Options;
|
|
277
536
|
exports.Param = Param;
|
|
278
537
|
exports.Patch = Patch;
|
|
538
|
+
exports.PersistenceError = PersistenceError;
|
|
279
539
|
exports.Post = Post;
|
|
280
540
|
exports.Put = Put;
|
|
281
541
|
exports.Query = Query;
|
|
542
|
+
exports.QueryExecutionError = QueryExecutionError;
|
|
282
543
|
exports.Redirect = Redirect;
|
|
283
544
|
exports.Req = Req;
|
|
284
545
|
exports.Request = Request;
|
|
285
546
|
exports.Res = Res;
|
|
547
|
+
exports.ResourceLimitError = ResourceLimitError;
|
|
548
|
+
exports.ResourceLimitExceededError = ResourceLimitExceededError;
|
|
286
549
|
exports.Response = Response;
|
|
550
|
+
exports.RestoreError = RestoreError;
|
|
551
|
+
exports.SchemaMismatchError = SchemaMismatchError;
|
|
287
552
|
exports.Serialize = Serialize;
|
|
288
553
|
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
289
554
|
exports.Session = Session;
|
|
290
555
|
exports.SetMetadata = SetMetadata;
|
|
556
|
+
exports.TimeoutError = TimeoutError;
|
|
557
|
+
exports.TransactionError = TransactionError;
|
|
291
558
|
exports.UnauthorizedError = UnauthorizedError;
|
|
292
559
|
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
293
560
|
exports.UseGuards = UseGuards;
|
|
294
561
|
exports.UseInterceptors = UseInterceptors;
|
|
562
|
+
exports.ValidationError = ValidationError;
|
|
295
563
|
exports.isRedirectResponse = isRedirectResponse;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Errores de lógica de negocio (Business Layer)
|
|
3
|
+
* No conocen HTTP, son agnósticos a la infraestructura
|
|
4
|
+
*/
|
|
5
|
+
export declare class DomainError extends Error {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class EntityNotFoundError extends DomainError {
|
|
9
|
+
constructor(entity: string, criteria: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class DuplicateEntityError extends DomainError {
|
|
12
|
+
constructor(entity: string, criteria: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class ValidationError extends DomainError {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class BusinessRuleViolationError extends DomainError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class OperationNotAllowedError extends DomainError {
|
|
21
|
+
constructor(operation: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class DependencyError extends DomainError {
|
|
24
|
+
constructor(dependency: string, message: string);
|
|
25
|
+
}
|
|
26
|
+
export declare class TimeoutError extends DomainError {
|
|
27
|
+
constructor(operation: string, timeout: number);
|
|
28
|
+
}
|
|
29
|
+
export declare class ResourceLimitExceededError extends DomainError {
|
|
30
|
+
constructor(resource: string, limit: number);
|
|
31
|
+
}
|
|
32
|
+
export declare class ConfigurationError extends DomainError {
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare class InfrastructureError extends Error {
|
|
2
|
+
readonly originalError?: Error | undefined;
|
|
3
|
+
constructor(message: string, originalError?: Error | undefined);
|
|
4
|
+
}
|
|
5
|
+
export declare class InfraDatabaseConnectionError extends InfrastructureError {
|
|
6
|
+
constructor(dbType: string, originalError?: Error);
|
|
7
|
+
}
|
|
8
|
+
export declare class InfraCacheConnectionError extends InfrastructureError {
|
|
9
|
+
constructor(cacheType: string, originalError?: Error);
|
|
10
|
+
}
|
|
11
|
+
export declare class InfraMessageQueueError extends InfrastructureError {
|
|
12
|
+
constructor(queueType: string, originalError?: Error);
|
|
13
|
+
}
|
|
14
|
+
export declare class InfraExternalServiceError extends InfrastructureError {
|
|
15
|
+
constructor(serviceName: string, originalError?: Error);
|
|
16
|
+
}
|
|
17
|
+
export declare class InfraConfigurationError extends InfrastructureError {
|
|
18
|
+
constructor(configItem: string, originalError?: Error);
|
|
19
|
+
}
|
|
20
|
+
export declare class InfraNetworkError extends InfrastructureError {
|
|
21
|
+
constructor(message: string, originalError?: Error);
|
|
22
|
+
}
|
|
23
|
+
export declare class InfraTimeoutError extends InfrastructureError {
|
|
24
|
+
constructor(operation: string, timeout: number, originalError?: Error);
|
|
25
|
+
}
|
|
26
|
+
export declare class InfraAuthenticationError extends InfrastructureError {
|
|
27
|
+
constructor(message: string, originalError?: Error);
|
|
28
|
+
}
|
|
29
|
+
export declare class InfraAuthorizationError extends InfrastructureError {
|
|
30
|
+
constructor(message: string, originalError?: Error);
|
|
31
|
+
}
|
|
32
|
+
export declare class InfraServiceUnavailableError extends InfrastructureError {
|
|
33
|
+
constructor(serviceName: string, originalError?: Error);
|
|
34
|
+
}
|
|
35
|
+
export declare class InfraDataSerializationError extends InfrastructureError {
|
|
36
|
+
constructor(dataType: string, originalError?: Error);
|
|
37
|
+
}
|
|
38
|
+
export declare class InfraDataDeserializationError extends InfrastructureError {
|
|
39
|
+
constructor(dataType: string, originalError?: Error);
|
|
40
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare class PersistenceError extends Error {
|
|
2
|
+
readonly originalError?: Error | undefined;
|
|
3
|
+
constructor(message: string, originalError?: Error | undefined);
|
|
4
|
+
}
|
|
5
|
+
export declare class DataNotFoundError extends PersistenceError {
|
|
6
|
+
constructor(entity: string, criteria: string, originalError?: Error);
|
|
7
|
+
}
|
|
8
|
+
export declare class DataConflictError extends PersistenceError {
|
|
9
|
+
constructor(entity: string, criteria: string, originalError?: Error);
|
|
10
|
+
}
|
|
11
|
+
export declare class DataValidationError extends PersistenceError {
|
|
12
|
+
constructor(message: string, originalError?: Error);
|
|
13
|
+
}
|
|
14
|
+
export declare class TransactionError extends PersistenceError {
|
|
15
|
+
constructor(message: string, originalError?: Error);
|
|
16
|
+
}
|
|
17
|
+
export declare class QueryExecutionError extends PersistenceError {
|
|
18
|
+
constructor(query: string, originalError?: Error);
|
|
19
|
+
}
|
|
20
|
+
export declare class ConnectionError extends PersistenceError {
|
|
21
|
+
constructor(databaseType: string, originalError?: Error);
|
|
22
|
+
}
|
|
23
|
+
export declare class SchemaMismatchError extends PersistenceError {
|
|
24
|
+
constructor(expectedSchema: string, actualSchema: string, originalError?: Error);
|
|
25
|
+
}
|
|
26
|
+
export declare class DataIntegrityError extends PersistenceError {
|
|
27
|
+
constructor(message: string, originalError?: Error);
|
|
28
|
+
}
|
|
29
|
+
export declare class BackupError extends PersistenceError {
|
|
30
|
+
constructor(message: string, originalError?: Error);
|
|
31
|
+
}
|
|
32
|
+
export declare class RestoreError extends PersistenceError {
|
|
33
|
+
constructor(message: string, originalError?: Error);
|
|
34
|
+
}
|
|
35
|
+
export declare class IndexingError extends PersistenceError {
|
|
36
|
+
constructor(indexName: string, originalError?: Error);
|
|
37
|
+
}
|
|
38
|
+
export declare class DataMigrationError extends PersistenceError {
|
|
39
|
+
constructor(migrationName: string, originalError?: Error);
|
|
40
|
+
}
|
|
41
|
+
export declare class ResourceLimitError extends PersistenceError {
|
|
42
|
+
constructor(resourceType: string, limit: number, originalError?: Error);
|
|
43
|
+
}
|
|
@@ -7,3 +7,9 @@ export * from "./features/arguments-host.interface";
|
|
|
7
7
|
export * from './type.interface';
|
|
8
8
|
export * from './handler.interface';
|
|
9
9
|
export * from './interceptor.interface';
|
|
10
|
+
export * from './configuration/redis-configuration.interface';
|
|
11
|
+
export * from './configuration/mongo-db-configuration.interface';
|
|
12
|
+
export * from './configuration/aws-s3-configuration.interface';
|
|
13
|
+
export * from './configuration/drizzle-db-configuration.interface';
|
|
14
|
+
export * from './configuration/olap-db-configuration.interface';
|
|
15
|
+
export * from './configuration/smtp-configuration.interface';
|