aws-service-stack 0.18.419 → 0.18.420
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/_examples/controller/profile/profile.config.js +1 -1
- package/dist/_examples/controller/profile/profile.config.js.map +1 -1
- package/dist/_examples/controller/profile/profile.controller.d.ts +1 -1
- package/dist/_examples/controller/profile/profile.controller.js +1 -0
- package/dist/_examples/controller/profile/profile.controller.js.map +1 -1
- package/dist/_examples/model-shared/example.model.d.ts +0 -12
- package/dist/_examples/model-shared/example.model.js.map +1 -1
- package/dist/controller/base-controller.js +5 -2
- package/dist/controller/base-controller.js.map +1 -1
- package/dist/controller/controller-api.d.ts +2 -2
- package/dist/controller/controller-api.js +10 -12
- package/dist/controller/controller-api.js.map +1 -1
- package/dist/controller/controller-request.d.ts +2 -2
- package/dist/controller/controller-request.js +7 -7
- package/dist/controller/controller-request.js.map +1 -1
- package/dist/exception/errors.d.ts +5 -5
- package/dist/exception/errors.js +9 -5
- package/dist/exception/errors.js.map +1 -1
- package/dist/exception/exception-handler.d.ts +62 -60
- package/dist/exception/exception-handler.js +87 -98
- package/dist/exception/exception-handler.js.map +1 -1
- package/dist/service/crud.service.d.ts +7 -0
- package/dist/service/crud.service.interface.d.ts +15 -0
- package/dist/service/crud.service.interface.js.map +1 -1
- package/dist/service/crud.service.js +32 -0
- package/dist/service/crud.service.js.map +1 -1
- package/package.json +6 -6
- package/dist/_examples/controller/branch/branch-config.d.ts +0 -6
- package/dist/_examples/controller/branch/branch-config.js +0 -47
- package/dist/_examples/controller/branch/branch-config.js.map +0 -1
- package/dist/_examples/controller/branch/branch-controller.d.ts +0 -16
- package/dist/_examples/controller/branch/branch-controller.js +0 -77
- package/dist/_examples/controller/branch/branch-controller.js.map +0 -1
- package/dist/_examples/controller/branch/branch-crud.d.ts +0 -4
- package/dist/_examples/controller/branch/branch-crud.js +0 -57
- package/dist/_examples/controller/branch/branch-crud.js.map +0 -1
- package/dist/_examples/controller/commission/commission-controller.d.ts +0 -9
- package/dist/_examples/controller/commission/commission-controller.js +0 -66
- package/dist/_examples/controller/commission/commission-controller.js.map +0 -1
- package/dist/_examples/controller/commission/commission-crud.d.ts +0 -4
- package/dist/_examples/controller/commission/commission-crud.js +0 -57
- package/dist/_examples/controller/commission/commission-crud.js.map +0 -1
- package/dist/_examples/controller/commission/commission.config.d.ts +0 -6
- package/dist/_examples/controller/commission/commission.config.js +0 -46
- package/dist/_examples/controller/commission/commission.config.js.map +0 -1
- package/dist/_examples/controller/e-order/e-order-crud-simple.d.ts +0 -2
- package/dist/_examples/controller/e-order/e-order-crud-simple.js +0 -294
- package/dist/_examples/controller/e-order/e-order-crud-simple.js.map +0 -1
- package/dist/_examples/controller/e-order/e-order-crud.d.ts +0 -4
- package/dist/_examples/controller/e-order/e-order-crud.js +0 -58
- package/dist/_examples/controller/e-order/e-order-crud.js.map +0 -1
- package/dist/_examples/controller/e-order/e-order.config.d.ts +0 -10
- package/dist/_examples/controller/e-order/e-order.config.js +0 -53
- package/dist/_examples/controller/e-order/e-order.config.js.map +0 -1
- package/dist/_examples/controller/e-order/e-order.controller.d.ts +0 -13
- package/dist/_examples/controller/e-order/e-order.controller.js +0 -68
- package/dist/_examples/controller/e-order/e-order.controller.js.map +0 -1
- package/dist/_examples/controller/entity/entity-config.d.ts +0 -10
- package/dist/_examples/controller/entity/entity-config.js +0 -49
- package/dist/_examples/controller/entity/entity-config.js.map +0 -1
- package/dist/_examples/controller/entity/entity-controller.d.ts +0 -13
- package/dist/_examples/controller/entity/entity-controller.js +0 -74
- package/dist/_examples/controller/entity/entity-controller.js.map +0 -1
- package/dist/_examples/controller/entity/entity-crud.d.ts +0 -4
- package/dist/_examples/controller/entity/entity-crud.js +0 -60
- package/dist/_examples/controller/entity/entity-crud.js.map +0 -1
- package/dist/_examples/controller/index.d.ts +0 -3
- package/dist/_examples/controller/index.js +0 -74
- package/dist/_examples/controller/index.js.map +0 -1
- package/dist/_examples/controller/local-task-controller.d.ts +0 -2
- package/dist/_examples/controller/local-task-controller.js +0 -23
- package/dist/_examples/controller/local-task-controller.js.map +0 -1
- package/dist/_examples/controller/product/product.config.d.ts +0 -12
- package/dist/_examples/controller/product/product.config.js +0 -33
- package/dist/_examples/controller/product/product.config.js.map +0 -1
- package/dist/_examples/controller/properties/properties-crud.d.ts +0 -4
- package/dist/_examples/controller/properties/properties-crud.js +0 -58
- package/dist/_examples/controller/properties/properties-crud.js.map +0 -1
- package/dist/_examples/controller/properties/property.config.d.ts +0 -10
- package/dist/_examples/controller/properties/property.config.js +0 -51
- package/dist/_examples/controller/properties/property.config.js.map +0 -1
- package/dist/_examples/controller/properties/property.controller.d.ts +0 -13
- package/dist/_examples/controller/properties/property.controller.js +0 -68
- package/dist/_examples/controller/properties/property.controller.js.map +0 -1
- package/dist/_examples/controller/raccount/raccount-config.d.ts +0 -6
- package/dist/_examples/controller/raccount/raccount-config.js +0 -60
- package/dist/_examples/controller/raccount/raccount-config.js.map +0 -1
- package/dist/_examples/controller/raccount/raccount-controller.d.ts +0 -14
- package/dist/_examples/controller/raccount/raccount-controller.js +0 -73
- package/dist/_examples/controller/raccount/raccount-controller.js.map +0 -1
- package/dist/_examples/controller/raccount/raccount-crud.d.ts +0 -4
- package/dist/_examples/controller/raccount/raccount-crud.js +0 -57
- package/dist/_examples/controller/raccount/raccount-crud.js.map +0 -1
- package/dist/_examples/controller/rorder/order-config.d.ts +0 -6
- package/dist/_examples/controller/rorder/order-config.js +0 -48
- package/dist/_examples/controller/rorder/order-config.js.map +0 -1
- package/dist/_examples/controller/rorder/order-controller.d.ts +0 -9
- package/dist/_examples/controller/rorder/order-controller.js +0 -66
- package/dist/_examples/controller/rorder/order-controller.js.map +0 -1
- package/dist/_examples/controller/rorder/order-crud.d.ts +0 -4
- package/dist/_examples/controller/rorder/order-crud.js +0 -57
- package/dist/_examples/controller/rorder/order-crud.js.map +0 -1
- package/dist/_examples/controller/supplier/supplier-config.d.ts +0 -10
- package/dist/_examples/controller/supplier/supplier-config.js +0 -70
- package/dist/_examples/controller/supplier/supplier-config.js.map +0 -1
- package/dist/_examples/controller/supplier/supplier-controller-api.d.ts +0 -9
- package/dist/_examples/controller/supplier/supplier-controller-api.js +0 -69
- package/dist/_examples/controller/supplier/supplier-controller-api.js.map +0 -1
- package/dist/_examples/controller/supplier/supplier-controller-stream.d.ts +0 -12
- package/dist/_examples/controller/supplier/supplier-controller-stream.js +0 -67
- package/dist/_examples/controller/supplier/supplier-controller-stream.js.map +0 -1
- package/dist/_examples/controller/supplier/supplier-crud.d.ts +0 -4
- package/dist/_examples/controller/supplier/supplier-crud.js +0 -60
- package/dist/_examples/controller/supplier/supplier-crud.js.map +0 -1
- package/dist/_examples/controller/supplier/supplier-streamer.d.ts +0 -4
- package/dist/_examples/controller/supplier/supplier-streamer.js +0 -58
- package/dist/_examples/controller/supplier/supplier-streamer.js.map +0 -1
- package/dist/_examples/controller/user/user.config.d.ts +0 -12
- package/dist/_examples/controller/user/user.config.js +0 -30
- package/dist/_examples/controller/user/user.config.js.map +0 -1
- package/dist/_examples/controller/user.controller.d.ts +0 -15
- package/dist/_examples/controller/user.controller.js +0 -30
- package/dist/_examples/controller/user.controller.js.map +0 -1
- package/dist/_examples/controller/users/users-crud.d.ts +0 -4
- package/dist/_examples/controller/users/users-crud.js +0 -58
- package/dist/_examples/controller/users/users-crud.js.map +0 -1
- package/dist/_examples/controller/users/users.config.d.ts +0 -10
- package/dist/_examples/controller/users/users.config.js +0 -51
- package/dist/_examples/controller/users/users.config.js.map +0 -1
- package/dist/_examples/controller/users/users.controller.d.ts +0 -13
- package/dist/_examples/controller/users/users.controller.js +0 -68
- package/dist/_examples/controller/users/users.controller.js.map +0 -1
- package/dist/_examples/model/user.model.d.ts +0 -1
- package/dist/_examples/model/user.model.js +0 -3
- package/dist/_examples/model/user.model.js.map +0 -1
- package/dist/_examples/model-shared/address.model.d.ts +0 -18
- package/dist/_examples/model-shared/address.model.js +0 -3
- package/dist/_examples/model-shared/address.model.js.map +0 -1
- package/dist/_examples/model-shared/branch.model.d.ts +0 -72
- package/dist/_examples/model-shared/branch.model.js +0 -64
- package/dist/_examples/model-shared/branch.model.js.map +0 -1
- package/dist/_examples/model-shared/commission.model.d.ts +0 -30
- package/dist/_examples/model-shared/commission.model.js +0 -38
- package/dist/_examples/model-shared/commission.model.js.map +0 -1
- package/dist/_examples/model-shared/raccount.model.d.ts +0 -134
- package/dist/_examples/model-shared/raccount.model.js +0 -187
- package/dist/_examples/model-shared/raccount.model.js.map +0 -1
- package/dist/_examples/model-shared/suppler.model-to-remove.d.ts +0 -119
- package/dist/_examples/model-shared/suppler.model-to-remove.js +0 -103
- package/dist/_examples/model-shared/suppler.model-to-remove.js.map +0 -1
- package/dist/_examples/model-shared/supplier-portal.model.d.ts +0 -22862
- package/dist/_examples/model-shared/supplier-portal.model.js +0 -1035
- package/dist/_examples/model-shared/supplier-portal.model.js.map +0 -1
- package/dist/_examples/model-shared/supplier.model.d.ts +0 -77
- package/dist/_examples/model-shared/supplier.model.js +0 -124
- package/dist/_examples/model-shared/supplier.model.js.map +0 -1
- package/dist/_examples/repositories/branch/branch-db.repo.d.ts +0 -6
- package/dist/_examples/repositories/branch/branch-db.repo.interface.d.ts +0 -4
- package/dist/_examples/repositories/branch/branch-db.repo.interface.js +0 -3
- package/dist/_examples/repositories/branch/branch-db.repo.interface.js.map +0 -1
- package/dist/_examples/repositories/branch/branch-db.repo.js +0 -19
- package/dist/_examples/repositories/branch/branch-db.repo.js.map +0 -1
- package/dist/_examples/repositories/commission/commission-repo-db.d.ts +0 -5
- package/dist/_examples/repositories/commission/commission-repo-db.interface.d.ts +0 -4
- package/dist/_examples/repositories/commission/commission-repo-db.interface.js +0 -3
- package/dist/_examples/repositories/commission/commission-repo-db.interface.js.map +0 -1
- package/dist/_examples/repositories/commission/commission-repo-db.js +0 -18
- package/dist/_examples/repositories/commission/commission-repo-db.js.map +0 -1
- package/dist/_examples/repositories/entity/entity-repo-db.d.ts +0 -6
- package/dist/_examples/repositories/entity/entity-repo-db.interface.d.ts +0 -4
- package/dist/_examples/repositories/entity/entity-repo-db.interface.js +0 -3
- package/dist/_examples/repositories/entity/entity-repo-db.interface.js.map +0 -1
- package/dist/_examples/repositories/entity/entity-repo-db.js +0 -19
- package/dist/_examples/repositories/entity/entity-repo-db.js.map +0 -1
- package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.d.ts +0 -3
- package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.js +0 -3
- package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.js.map +0 -1
- package/dist/_examples/repositories/entity/entity-repo-erp-coremind.d.ts +0 -0
- package/dist/_examples/repositories/entity/entity-repo-erp-coremind.js +0 -2
- package/dist/_examples/repositories/entity/entity-repo-erp-coremind.js.map +0 -1
- package/dist/_examples/repositories/entity/entity-repo-es.d.ts +0 -6
- package/dist/_examples/repositories/entity/entity-repo-es.interface.d.ts +0 -4
- package/dist/_examples/repositories/entity/entity-repo-es.interface.js +0 -3
- package/dist/_examples/repositories/entity/entity-repo-es.interface.js.map +0 -1
- package/dist/_examples/repositories/entity/entity-repo-es.js +0 -19
- package/dist/_examples/repositories/entity/entity-repo-es.js.map +0 -1
- package/dist/_examples/repositories/order/order-es.repo.d.ts +0 -12
- package/dist/_examples/repositories/order/order-es.repo.interface.d.ts +0 -7
- package/dist/_examples/repositories/order/order-es.repo.interface.js +0 -3
- package/dist/_examples/repositories/order/order-es.repo.interface.js.map +0 -1
- package/dist/_examples/repositories/order/order-es.repo.js +0 -64
- package/dist/_examples/repositories/order/order-es.repo.js.map +0 -1
- package/dist/_examples/repositories/order/order-repo-db.d.ts +0 -6
- package/dist/_examples/repositories/order/order-repo-db.interface.d.ts +0 -17
- package/dist/_examples/repositories/order/order-repo-db.interface.js +0 -22
- package/dist/_examples/repositories/order/order-repo-db.interface.js.map +0 -1
- package/dist/_examples/repositories/order/order-repo-db.js +0 -19
- package/dist/_examples/repositories/order/order-repo-db.js.map +0 -1
- package/dist/_examples/repositories/raccount/raccount-db.repo.d.ts +0 -5
- package/dist/_examples/repositories/raccount/raccount-db.repo.interface.d.ts +0 -4
- package/dist/_examples/repositories/raccount/raccount-db.repo.interface.js +0 -3
- package/dist/_examples/repositories/raccount/raccount-db.repo.interface.js.map +0 -1
- package/dist/_examples/repositories/raccount/raccount-db.repo.js +0 -18
- package/dist/_examples/repositories/raccount/raccount-db.repo.js.map +0 -1
- package/dist/_examples/repositories/raccount/raccount-es.repo.d.ts +0 -6
- package/dist/_examples/repositories/raccount/raccount-es.repo.interface.d.ts +0 -4
- package/dist/_examples/repositories/raccount/raccount-es.repo.interface.js +0 -3
- package/dist/_examples/repositories/raccount/raccount-es.repo.interface.js.map +0 -1
- package/dist/_examples/repositories/raccount/raccount-es.repo.js +0 -19
- package/dist/_examples/repositories/raccount/raccount-es.repo.js.map +0 -1
- package/dist/_examples/repositories/rorder/rorder-db.repo.d.ts +0 -5
- package/dist/_examples/repositories/rorder/rorder-db.repo.interface.d.ts +0 -4
- package/dist/_examples/repositories/rorder/rorder-db.repo.interface.js +0 -3
- package/dist/_examples/repositories/rorder/rorder-db.repo.interface.js.map +0 -1
- package/dist/_examples/repositories/rorder/rorder-db.repo.js +0 -18
- package/dist/_examples/repositories/rorder/rorder-db.repo.js.map +0 -1
- package/dist/_examples/repositories/rorder/rorder-es.repo.d.ts +0 -7
- package/dist/_examples/repositories/rorder/rorder-es.repo.interface.d.ts +0 -5
- package/dist/_examples/repositories/rorder/rorder-es.repo.interface.js +0 -3
- package/dist/_examples/repositories/rorder/rorder-es.repo.interface.js.map +0 -1
- package/dist/_examples/repositories/rorder/rorder-es.repo.js +0 -22
- package/dist/_examples/repositories/rorder/rorder-es.repo.js.map +0 -1
- package/dist/_examples/repositories/supplier/supplier-repo-db.d.ts +0 -6
- package/dist/_examples/repositories/supplier/supplier-repo-db.interface.d.ts +0 -4
- package/dist/_examples/repositories/supplier/supplier-repo-db.interface.js +0 -3
- package/dist/_examples/repositories/supplier/supplier-repo-db.interface.js.map +0 -1
- package/dist/_examples/repositories/supplier/supplier-repo-db.js +0 -19
- package/dist/_examples/repositories/supplier/supplier-repo-db.js.map +0 -1
- package/dist/_examples/repositories/supplier/supplier-repo-es.d.ts +0 -6
- package/dist/_examples/repositories/supplier/supplier-repo-es.interface.d.ts +0 -4
- package/dist/_examples/repositories/supplier/supplier-repo-es.interface.js +0 -3
- package/dist/_examples/repositories/supplier/supplier-repo-es.interface.js.map +0 -1
- package/dist/_examples/repositories/supplier/supplier-repo-es.js +0 -19
- package/dist/_examples/repositories/supplier/supplier-repo-es.js.map +0 -1
- package/dist/_examples/repositories/user-repo-db.d.ts +0 -7
- package/dist/_examples/repositories/user-repo-db.interface.d.ts +0 -5
- package/dist/_examples/repositories/user-repo-db.interface.js +0 -3
- package/dist/_examples/repositories/user-repo-db.interface.js.map +0 -1
- package/dist/_examples/repositories/user-repo-db.js +0 -24
- package/dist/_examples/repositories/user-repo-db.js.map +0 -1
- package/dist/_examples/service/branch/branch-service.d.ts +0 -13
- package/dist/_examples/service/branch/branch-service.interface.d.ts +0 -4
- package/dist/_examples/service/branch/branch-service.interface.js +0 -3
- package/dist/_examples/service/branch/branch-service.interface.js.map +0 -1
- package/dist/_examples/service/branch/branch-service.js +0 -70
- package/dist/_examples/service/branch/branch-service.js.map +0 -1
- package/dist/_examples/service/commission/commission-service.d.ts +0 -15
- package/dist/_examples/service/commission/commission-service.interface.d.ts +0 -6
- package/dist/_examples/service/commission/commission-service.interface.js +0 -3
- package/dist/_examples/service/commission/commission-service.interface.js.map +0 -1
- package/dist/_examples/service/commission/commission-service.js +0 -116
- package/dist/_examples/service/commission/commission-service.js.map +0 -1
- package/dist/_examples/service/entity/entity-service.d.ts +0 -13
- package/dist/_examples/service/entity/entity-service.interface.d.ts +0 -5
- package/dist/_examples/service/entity/entity-service.interface.js +0 -3
- package/dist/_examples/service/entity/entity-service.interface.js.map +0 -1
- package/dist/_examples/service/entity/entity-service.js +0 -92
- package/dist/_examples/service/entity/entity-service.js.map +0 -1
- package/dist/_examples/service/order-service.d.ts +0 -12
- package/dist/_examples/service/order-service.interface.d.ts +0 -5
- package/dist/_examples/service/order-service.interface.js +0 -4
- package/dist/_examples/service/order-service.interface.js.map +0 -1
- package/dist/_examples/service/order-service.js +0 -31
- package/dist/_examples/service/order-service.js.map +0 -1
- package/dist/_examples/service/raccount/raccount-service.d.ts +0 -10
- package/dist/_examples/service/raccount/raccount-service.interface.d.ts +0 -4
- package/dist/_examples/service/raccount/raccount-service.interface.js +0 -3
- package/dist/_examples/service/raccount/raccount-service.interface.js.map +0 -1
- package/dist/_examples/service/raccount/raccount-service.js +0 -64
- package/dist/_examples/service/raccount/raccount-service.js.map +0 -1
- package/dist/_examples/service/rorder/rorder-service.d.ts +0 -11
- package/dist/_examples/service/rorder/rorder-service.interface.d.ts +0 -10
- package/dist/_examples/service/rorder/rorder-service.interface.js +0 -3
- package/dist/_examples/service/rorder/rorder-service.interface.js.map +0 -1
- package/dist/_examples/service/rorder/rorder-service.js +0 -65
- package/dist/_examples/service/rorder/rorder-service.js.map +0 -1
- package/dist/_examples/service/supplier/supplier-service-crud.d.ts +0 -25
- package/dist/_examples/service/supplier/supplier-service-crud.interface.d.ts +0 -14
- package/dist/_examples/service/supplier/supplier-service-crud.interface.js +0 -3
- package/dist/_examples/service/supplier/supplier-service-crud.interface.js.map +0 -1
- package/dist/_examples/service/supplier/supplier-service-crud.js +0 -129
- package/dist/_examples/service/supplier/supplier-service-crud.js.map +0 -1
- package/dist/_examples/service/supplier/supplier-service-stream.d.ts +0 -13
- package/dist/_examples/service/supplier/supplier-service-stream.interface.d.ts +0 -5
- package/dist/_examples/service/supplier/supplier-service-stream.interface.js +0 -4
- package/dist/_examples/service/supplier/supplier-service-stream.interface.js.map +0 -1
- package/dist/_examples/service/supplier/supplier-service-stream.js +0 -72
- package/dist/_examples/service/supplier/supplier-service-stream.js.map +0 -1
- package/dist/_examples/service/user-service.d.ts +0 -11
- package/dist/_examples/service/user-service.interface.d.ts +0 -5
- package/dist/_examples/service/user-service.interface.js +0 -3
- package/dist/_examples/service/user-service.interface.js.map +0 -1
- package/dist/_examples/service/user-service.js +0 -41
- package/dist/_examples/service/user-service.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/exception/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/exception/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;IAClB,IAAI,CAAS;IACb,KAAK,CAAW;IAEhC,YAAY,IAAY,EAAE,OAAe,EAAE,KAAe;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAElC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAlBD,8BAkBC;AAED,MAAa,aAAc,SAAQ,KAAK;IACtC,SAAS,CAAS;IAClB,OAAO,CAAM;IACb,YAAY,SAAiB,EAAE,OAAY,EAAE,YAAkB;QAC7D,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AARD,sCAQC;AAQD,MAAa,SAAU,SAAQ,KAAK;IAClC,UAAU,CAAS;IACnB,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,IAAI,CAAM;IAEV,YAAY,YAA0B,EAAE,YAAkB,EAAE,SAAe;QACzE,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,GAAG,IAAI,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC;QAC1D,IAAI,CAAC,OAAO,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QAC9F,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,CAAC;CACF;AAbD,8BAaC;AAED,MAAa,eAAgB,SAAQ,KAAK;IACxC,UAAU,CAAS;IACnB,UAAU,CAAmB;IAC7B,KAAK,CAAM;IACX,OAAO,CAAM;IAEb,YAAY,UAAkB,EAAE,UAA4B,EAAE,YAAkB;QAC9E,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;CACF;AAZD,0CAYC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,SAAiB;QAC3B,KAAK,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AALD,sDAKC","sourcesContent":["export class ErrorBase extends Error {\n public readonly code: number;\n public readonly error?: unknown;\n\n constructor(code: number, message: string, error?: unknown) {\n super(message);\n\n this.code = code;\n this.error = error;\n\n Object.setPrototypeOf(this, new.target.prototype);\n\n this.name = this.constructor.name;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\nexport class ErrorDynamoDB extends Error {\n tableName: string;\n command: any;\n constructor(tableName: string, command: any, errorContent?: any) {\n super(errorContent);\n this.tableName = tableName;\n this.command = command;\n }\n}\n\nexport interface ErrorCodeMsg {\n code: number;\n msg?: string;\n error?: string;\n}\n\nexport class ErrorHttp extends Error {\n statusCode: number;\n error: string;\n message: string;\n data: any;\n\n constructor(errorCodeMsg: ErrorCodeMsg, errorMessage?: any, errorData?: any) {\n super(errorData);\n this.statusCode = errorCodeMsg.code;\n this.error = errorCodeMsg.msg ?? errorCodeMsg.error ?? \"\";\n this.message = typeof errorMessage === \"object\" ? JSON.stringify(errorMessage) : errorMessage;\n this.data = errorData;\n }\n}\n\nexport class ErrorValidation extends Error {\n entityName: string;\n validation: Map<string, any>;\n error: any;\n content: any;\n\n constructor(entityName: string, validation: Map<string, any>, errorContent?: any) {\n super(errorContent);\n this.entityName = entityName;\n this.validation = validation;\n this.content = errorContent;\n }\n}\n\nexport class MissingParameterError extends Error {\n constructor(paramName: string) {\n super(`${paramName} is required.`);\n this.name = \"MissingParameterError\";\n }\n}\n"]}
|
|
@@ -1,238 +1,240 @@
|
|
|
1
|
-
|
|
1
|
+
type HttpErrorResponse = {
|
|
2
2
|
statusCode: number;
|
|
3
3
|
content: {
|
|
4
4
|
error: string;
|
|
5
|
-
message:
|
|
6
|
-
data:
|
|
5
|
+
message: unknown;
|
|
6
|
+
data: unknown;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
+
export declare const refineHttpError: (err: any) => HttpErrorResponse;
|
|
9
10
|
export declare const HTTP: {
|
|
10
11
|
CONTINUE: {
|
|
11
|
-
|
|
12
|
+
msg: string;
|
|
12
13
|
code: number;
|
|
13
14
|
};
|
|
14
15
|
SWITCHING_PROTOCOLS: {
|
|
15
|
-
|
|
16
|
+
msg: string;
|
|
16
17
|
code: number;
|
|
17
18
|
};
|
|
18
19
|
PROCESSING: {
|
|
19
|
-
|
|
20
|
+
msg: string;
|
|
20
21
|
code: number;
|
|
21
22
|
};
|
|
22
23
|
OK: {
|
|
23
|
-
|
|
24
|
+
msg: string;
|
|
24
25
|
code: number;
|
|
25
26
|
};
|
|
26
27
|
CREATED: {
|
|
27
|
-
|
|
28
|
+
msg: string;
|
|
28
29
|
code: number;
|
|
29
30
|
};
|
|
30
31
|
ACCEPTED: {
|
|
31
|
-
|
|
32
|
+
msg: string;
|
|
32
33
|
code: number;
|
|
33
34
|
};
|
|
34
35
|
NON_AUTHORITATIVE_INFORMATION: {
|
|
35
|
-
|
|
36
|
+
msg: string;
|
|
36
37
|
code: number;
|
|
37
38
|
};
|
|
38
39
|
NO_CONTENT: {
|
|
39
|
-
|
|
40
|
+
msg: string;
|
|
40
41
|
code: number;
|
|
41
42
|
};
|
|
42
43
|
RESET_CONTENT: {
|
|
43
|
-
|
|
44
|
+
msg: string;
|
|
44
45
|
code: number;
|
|
45
46
|
};
|
|
46
47
|
PARTIAL_CONTENT: {
|
|
47
|
-
|
|
48
|
+
msg: string;
|
|
48
49
|
code: number;
|
|
49
50
|
};
|
|
50
51
|
MULTIPLE_CHOICES: {
|
|
51
|
-
|
|
52
|
+
msg: string;
|
|
52
53
|
code: number;
|
|
53
54
|
};
|
|
54
55
|
MOVED_PERMANENTLY: {
|
|
55
|
-
|
|
56
|
+
msg: string;
|
|
56
57
|
code: number;
|
|
57
58
|
};
|
|
58
59
|
FOUND: {
|
|
59
|
-
|
|
60
|
+
msg: string;
|
|
60
61
|
code: number;
|
|
61
62
|
};
|
|
62
63
|
SEE_OTHER: {
|
|
63
|
-
|
|
64
|
+
msg: string;
|
|
64
65
|
code: number;
|
|
65
66
|
};
|
|
66
67
|
NOT_MODIFIED: {
|
|
67
|
-
|
|
68
|
+
msg: string;
|
|
68
69
|
code: number;
|
|
69
70
|
};
|
|
70
71
|
TEMPORARY_REDIRECT: {
|
|
71
|
-
|
|
72
|
+
msg: string;
|
|
72
73
|
code: number;
|
|
73
74
|
};
|
|
74
75
|
PERMANENT_REDIRECT: {
|
|
75
|
-
|
|
76
|
+
msg: string;
|
|
76
77
|
code: number;
|
|
77
78
|
};
|
|
78
79
|
BAD_REQUEST: {
|
|
79
|
-
|
|
80
|
+
msg: string;
|
|
80
81
|
code: number;
|
|
81
82
|
};
|
|
82
83
|
UNAUTHORIZED: {
|
|
83
|
-
|
|
84
|
+
msg: string;
|
|
84
85
|
code: number;
|
|
85
86
|
};
|
|
86
87
|
PAYMENT_REQUIRED: {
|
|
87
|
-
|
|
88
|
+
msg: string;
|
|
88
89
|
code: number;
|
|
89
90
|
};
|
|
90
91
|
FORBIDDEN: {
|
|
91
|
-
|
|
92
|
+
msg: string;
|
|
92
93
|
code: number;
|
|
93
94
|
};
|
|
94
95
|
NOT_FOUND: {
|
|
95
|
-
|
|
96
|
+
msg: string;
|
|
96
97
|
code: number;
|
|
97
98
|
};
|
|
98
99
|
METHOD_NOT_ALLOWED: {
|
|
99
|
-
|
|
100
|
+
msg: string;
|
|
100
101
|
code: number;
|
|
101
102
|
};
|
|
102
103
|
NOT_ACCEPTABLE: {
|
|
103
|
-
|
|
104
|
+
msg: string;
|
|
104
105
|
code: number;
|
|
105
106
|
};
|
|
106
107
|
PROXY_AUTHENTICATION_REQUIRED: {
|
|
107
|
-
|
|
108
|
+
msg: string;
|
|
108
109
|
code: number;
|
|
109
110
|
};
|
|
110
111
|
REQUEST_TIMEOUT: {
|
|
111
|
-
|
|
112
|
+
msg: string;
|
|
112
113
|
code: number;
|
|
113
114
|
};
|
|
114
115
|
CONFLICT: {
|
|
115
|
-
|
|
116
|
+
msg: string;
|
|
116
117
|
code: number;
|
|
117
118
|
};
|
|
118
119
|
GONE: {
|
|
119
|
-
|
|
120
|
+
msg: string;
|
|
120
121
|
code: number;
|
|
121
122
|
};
|
|
122
123
|
LENGTH_REQUIRED: {
|
|
123
|
-
|
|
124
|
+
msg: string;
|
|
124
125
|
code: number;
|
|
125
126
|
};
|
|
126
127
|
PRECONDITION_FAILED: {
|
|
127
|
-
|
|
128
|
+
msg: string;
|
|
128
129
|
code: number;
|
|
129
130
|
};
|
|
130
131
|
PAYLOAD_TOO_LARGE: {
|
|
131
|
-
|
|
132
|
+
msg: string;
|
|
132
133
|
code: number;
|
|
133
134
|
};
|
|
134
135
|
URI_TOO_LONG: {
|
|
135
|
-
|
|
136
|
+
msg: string;
|
|
136
137
|
code: number;
|
|
137
138
|
};
|
|
138
139
|
UNSUPPORTED_MEDIA_TYPE: {
|
|
139
|
-
|
|
140
|
+
msg: string;
|
|
140
141
|
code: number;
|
|
141
142
|
};
|
|
142
143
|
RANGE_NOT_SATISFIABLE: {
|
|
143
|
-
|
|
144
|
+
msg: string;
|
|
144
145
|
code: number;
|
|
145
146
|
};
|
|
146
147
|
EXPECTATION_FAILED: {
|
|
147
|
-
|
|
148
|
+
msg: string;
|
|
148
149
|
code: number;
|
|
149
150
|
};
|
|
150
151
|
IM_A_TEAPOT: {
|
|
151
|
-
|
|
152
|
+
msg: string;
|
|
152
153
|
code: number;
|
|
153
154
|
};
|
|
154
155
|
MISDIRECTED_REQUEST: {
|
|
155
|
-
|
|
156
|
+
msg: string;
|
|
156
157
|
code: number;
|
|
157
158
|
};
|
|
158
159
|
UNPROCESSABLE_ENTITY: {
|
|
159
|
-
|
|
160
|
+
msg: string;
|
|
160
161
|
code: number;
|
|
161
162
|
};
|
|
162
163
|
LOCKED: {
|
|
163
|
-
|
|
164
|
+
msg: string;
|
|
164
165
|
code: number;
|
|
165
166
|
};
|
|
166
167
|
FAILED_DEPENDENCY: {
|
|
167
|
-
|
|
168
|
+
msg: string;
|
|
168
169
|
code: number;
|
|
169
170
|
};
|
|
170
171
|
TOO_EARLY: {
|
|
171
|
-
|
|
172
|
+
msg: string;
|
|
172
173
|
code: number;
|
|
173
174
|
};
|
|
174
175
|
UPGRADE_REQUIRED: {
|
|
175
|
-
|
|
176
|
+
msg: string;
|
|
176
177
|
code: number;
|
|
177
178
|
};
|
|
178
179
|
PRECONDITION_REQUIRED: {
|
|
179
|
-
|
|
180
|
+
msg: string;
|
|
180
181
|
code: number;
|
|
181
182
|
};
|
|
182
183
|
TOO_MANY_REQUESTS: {
|
|
183
|
-
|
|
184
|
+
msg: string;
|
|
184
185
|
code: number;
|
|
185
186
|
};
|
|
186
187
|
REQUEST_HEADER_FIELDS_TOO_LARGE: {
|
|
187
|
-
|
|
188
|
+
msg: string;
|
|
188
189
|
code: number;
|
|
189
190
|
};
|
|
190
191
|
UNAVAILABLE_FOR_LEGAL_REASONS: {
|
|
191
|
-
|
|
192
|
+
msg: string;
|
|
192
193
|
code: number;
|
|
193
194
|
};
|
|
194
195
|
INTERNAL_SERVER_ERROR: {
|
|
195
|
-
|
|
196
|
+
msg: string;
|
|
196
197
|
code: number;
|
|
197
198
|
};
|
|
198
199
|
NOT_IMPLEMENTED: {
|
|
199
|
-
|
|
200
|
+
msg: string;
|
|
200
201
|
code: number;
|
|
201
202
|
};
|
|
202
203
|
BAD_GATEWAY: {
|
|
203
|
-
|
|
204
|
+
msg: string;
|
|
204
205
|
code: number;
|
|
205
206
|
};
|
|
206
207
|
SERVICE_UNAVAILABLE: {
|
|
207
|
-
|
|
208
|
+
msg: string;
|
|
208
209
|
code: number;
|
|
209
210
|
};
|
|
210
211
|
GATEWAY_TIMEOUT: {
|
|
211
|
-
|
|
212
|
+
msg: string;
|
|
212
213
|
code: number;
|
|
213
214
|
};
|
|
214
215
|
HTTP_VERSION_NOT_SUPPORTED: {
|
|
215
|
-
|
|
216
|
+
msg: string;
|
|
216
217
|
code: number;
|
|
217
218
|
};
|
|
218
219
|
VARIANT_ALSO_NEGOTIATES: {
|
|
219
|
-
|
|
220
|
+
msg: string;
|
|
220
221
|
code: number;
|
|
221
222
|
};
|
|
222
223
|
INSUFFICIENT_STORAGE: {
|
|
223
|
-
|
|
224
|
+
msg: string;
|
|
224
225
|
code: number;
|
|
225
226
|
};
|
|
226
227
|
LOOP_DETECTED: {
|
|
227
|
-
|
|
228
|
+
msg: string;
|
|
228
229
|
code: number;
|
|
229
230
|
};
|
|
230
231
|
NOT_EXTENDED: {
|
|
231
|
-
|
|
232
|
+
msg: string;
|
|
232
233
|
code: number;
|
|
233
234
|
};
|
|
234
235
|
NETWORK_AUTHENTICATION_REQUIRED: {
|
|
235
|
-
|
|
236
|
+
msg: string;
|
|
236
237
|
code: number;
|
|
237
238
|
};
|
|
238
239
|
};
|
|
240
|
+
export {};
|
|
@@ -1,120 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HTTP = exports.
|
|
3
|
+
exports.HTTP = exports.refineHttpError = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
responseMsg = Object.fromEntries(error.validation.entries());
|
|
16
|
-
data = error.content;
|
|
17
|
-
}
|
|
18
|
-
else if (error instanceof errors_1.ErrorHttp) {
|
|
19
|
-
response.code = error.statusCode;
|
|
20
|
-
response.error = error.error;
|
|
21
|
-
responseMsg = error.message;
|
|
22
|
-
data = error.data;
|
|
5
|
+
const refineHttpError = (err) => {
|
|
6
|
+
let http = {
|
|
7
|
+
code: err.statusCode ?? exports.HTTP.INTERNAL_SERVER_ERROR.code,
|
|
8
|
+
msg: err.error ?? exports.HTTP.INTERNAL_SERVER_ERROR.msg,
|
|
9
|
+
};
|
|
10
|
+
let message = err.message ?? "An unexpected error occurred.";
|
|
11
|
+
let data = err.content;
|
|
12
|
+
if (err instanceof errors_1.ErrorValidation) {
|
|
13
|
+
http = exports.HTTP.BAD_REQUEST;
|
|
14
|
+
http.msg += " - Validation failed.";
|
|
23
15
|
}
|
|
24
|
-
else if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
response.error = response.error + " - DynamoDB Error";
|
|
29
|
-
responseMsg =
|
|
30
|
-
`ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}, error: ` +
|
|
31
|
-
JSON.stringify(err);
|
|
16
|
+
else if (err instanceof errors_1.ErrorDynamoDB) {
|
|
17
|
+
if (message.includes("requires indexName and indexValue")) {
|
|
18
|
+
http = exports.HTTP.BAD_REQUEST;
|
|
19
|
+
message = `Index name and value are required: ${err.tableName}`;
|
|
32
20
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
if (message.includes("ResourceNotFoundException")) {
|
|
22
|
+
http = exports.HTTP.BAD_REQUEST;
|
|
23
|
+
message = `Resource not found: ${err.tableName}`;
|
|
36
24
|
}
|
|
37
|
-
else if (
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
else if (message.includes("ConditionalCheckFailedException")) {
|
|
26
|
+
http = exports.HTTP.BAD_REQUEST;
|
|
27
|
+
message = `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}}`;
|
|
40
28
|
}
|
|
29
|
+
message = `Database Error: ${err.tableName}`;
|
|
41
30
|
}
|
|
42
|
-
else if (
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
else if (message.includes("search_phase_execution_exception")) {
|
|
32
|
+
http = exports.HTTP.BAD_REQUEST;
|
|
33
|
+
message = "OpenSearch: Cannot sort by text field - use '.keyword' instead.";
|
|
45
34
|
}
|
|
46
35
|
return {
|
|
47
|
-
statusCode:
|
|
36
|
+
statusCode: http.code,
|
|
48
37
|
content: {
|
|
49
|
-
error:
|
|
50
|
-
message
|
|
51
|
-
data
|
|
38
|
+
error: http.msg,
|
|
39
|
+
message,
|
|
40
|
+
data,
|
|
52
41
|
},
|
|
53
42
|
};
|
|
54
43
|
};
|
|
55
|
-
exports.
|
|
44
|
+
exports.refineHttpError = refineHttpError;
|
|
56
45
|
exports.HTTP = {
|
|
57
46
|
// 1xx Informational
|
|
58
|
-
CONTINUE: {
|
|
59
|
-
SWITCHING_PROTOCOLS: {
|
|
60
|
-
PROCESSING: {
|
|
47
|
+
CONTINUE: { msg: "Continue", code: 100 },
|
|
48
|
+
SWITCHING_PROTOCOLS: { msg: "Switching Protocols", code: 101 },
|
|
49
|
+
PROCESSING: { msg: "Processing", code: 102 },
|
|
61
50
|
// 2xx Success
|
|
62
|
-
OK: {
|
|
63
|
-
CREATED: {
|
|
64
|
-
ACCEPTED: {
|
|
65
|
-
NON_AUTHORITATIVE_INFORMATION: {
|
|
66
|
-
NO_CONTENT: {
|
|
67
|
-
RESET_CONTENT: {
|
|
68
|
-
PARTIAL_CONTENT: {
|
|
51
|
+
OK: { msg: "OK", code: 200 },
|
|
52
|
+
CREATED: { msg: "Created", code: 201 },
|
|
53
|
+
ACCEPTED: { msg: "Accepted", code: 202 },
|
|
54
|
+
NON_AUTHORITATIVE_INFORMATION: { msg: "Non-Authoritative Information", code: 203 },
|
|
55
|
+
NO_CONTENT: { msg: "No Content", code: 204 },
|
|
56
|
+
RESET_CONTENT: { msg: "Reset Content", code: 205 },
|
|
57
|
+
PARTIAL_CONTENT: { msg: "Partial Content", code: 206 },
|
|
69
58
|
// 3xx Redirection
|
|
70
|
-
MULTIPLE_CHOICES: {
|
|
71
|
-
MOVED_PERMANENTLY: {
|
|
72
|
-
FOUND: {
|
|
73
|
-
SEE_OTHER: {
|
|
74
|
-
NOT_MODIFIED: {
|
|
75
|
-
TEMPORARY_REDIRECT: {
|
|
76
|
-
PERMANENT_REDIRECT: {
|
|
59
|
+
MULTIPLE_CHOICES: { msg: "Multiple Choices", code: 300 },
|
|
60
|
+
MOVED_PERMANENTLY: { msg: "Moved Permanently", code: 301 },
|
|
61
|
+
FOUND: { msg: "Found", code: 302 },
|
|
62
|
+
SEE_OTHER: { msg: "See Other", code: 303 },
|
|
63
|
+
NOT_MODIFIED: { msg: "Not Modified", code: 304 },
|
|
64
|
+
TEMPORARY_REDIRECT: { msg: "Temporary Redirect", code: 307 },
|
|
65
|
+
PERMANENT_REDIRECT: { msg: "Permanent Redirect", code: 308 },
|
|
77
66
|
// 4xx Client Errors
|
|
78
|
-
BAD_REQUEST: {
|
|
79
|
-
UNAUTHORIZED: {
|
|
80
|
-
PAYMENT_REQUIRED: {
|
|
81
|
-
FORBIDDEN: {
|
|
82
|
-
NOT_FOUND: {
|
|
83
|
-
METHOD_NOT_ALLOWED: {
|
|
84
|
-
NOT_ACCEPTABLE: {
|
|
85
|
-
PROXY_AUTHENTICATION_REQUIRED: {
|
|
86
|
-
REQUEST_TIMEOUT: {
|
|
87
|
-
CONFLICT: {
|
|
88
|
-
GONE: {
|
|
89
|
-
LENGTH_REQUIRED: {
|
|
90
|
-
PRECONDITION_FAILED: {
|
|
91
|
-
PAYLOAD_TOO_LARGE: {
|
|
92
|
-
URI_TOO_LONG: {
|
|
93
|
-
UNSUPPORTED_MEDIA_TYPE: {
|
|
94
|
-
RANGE_NOT_SATISFIABLE: {
|
|
95
|
-
EXPECTATION_FAILED: {
|
|
96
|
-
IM_A_TEAPOT: {
|
|
97
|
-
MISDIRECTED_REQUEST: {
|
|
98
|
-
UNPROCESSABLE_ENTITY: {
|
|
99
|
-
LOCKED: {
|
|
100
|
-
FAILED_DEPENDENCY: {
|
|
101
|
-
TOO_EARLY: {
|
|
102
|
-
UPGRADE_REQUIRED: {
|
|
103
|
-
PRECONDITION_REQUIRED: {
|
|
104
|
-
TOO_MANY_REQUESTS: {
|
|
105
|
-
REQUEST_HEADER_FIELDS_TOO_LARGE: {
|
|
106
|
-
UNAVAILABLE_FOR_LEGAL_REASONS: {
|
|
67
|
+
BAD_REQUEST: { msg: "Bad Request", code: 400 },
|
|
68
|
+
UNAUTHORIZED: { msg: "Unauthorized", code: 401 },
|
|
69
|
+
PAYMENT_REQUIRED: { msg: "Payment Required", code: 402 },
|
|
70
|
+
FORBIDDEN: { msg: "Forbidden", code: 403 },
|
|
71
|
+
NOT_FOUND: { msg: "Not Found", code: 404 },
|
|
72
|
+
METHOD_NOT_ALLOWED: { msg: "Method Not Allowed", code: 405 },
|
|
73
|
+
NOT_ACCEPTABLE: { msg: "Not Acceptable", code: 406 },
|
|
74
|
+
PROXY_AUTHENTICATION_REQUIRED: { msg: "Proxy Authentication Required", code: 407 },
|
|
75
|
+
REQUEST_TIMEOUT: { msg: "Request Timeout", code: 408 },
|
|
76
|
+
CONFLICT: { msg: "Conflict", code: 409 },
|
|
77
|
+
GONE: { msg: "Gone", code: 410 },
|
|
78
|
+
LENGTH_REQUIRED: { msg: "Length Required", code: 411 },
|
|
79
|
+
PRECONDITION_FAILED: { msg: "Precondition Failed", code: 412 },
|
|
80
|
+
PAYLOAD_TOO_LARGE: { msg: "Payload Too Large", code: 413 },
|
|
81
|
+
URI_TOO_LONG: { msg: "URI Too Long", code: 414 },
|
|
82
|
+
UNSUPPORTED_MEDIA_TYPE: { msg: "Unsupported Media Type", code: 415 },
|
|
83
|
+
RANGE_NOT_SATISFIABLE: { msg: "Range Not Satisfiable", code: 416 },
|
|
84
|
+
EXPECTATION_FAILED: { msg: "Expectation Failed", code: 417 },
|
|
85
|
+
IM_A_TEAPOT: { msg: "I'm a teapot", code: 418 },
|
|
86
|
+
MISDIRECTED_REQUEST: { msg: "Misdirected Request", code: 421 },
|
|
87
|
+
UNPROCESSABLE_ENTITY: { msg: "Unprocessable Entity", code: 422 },
|
|
88
|
+
LOCKED: { msg: "Locked", code: 423 },
|
|
89
|
+
FAILED_DEPENDENCY: { msg: "Failed Dependency", code: 424 },
|
|
90
|
+
TOO_EARLY: { msg: "Too Early", code: 425 },
|
|
91
|
+
UPGRADE_REQUIRED: { msg: "Upgrade Required", code: 426 },
|
|
92
|
+
PRECONDITION_REQUIRED: { msg: "Precondition Required", code: 428 },
|
|
93
|
+
TOO_MANY_REQUESTS: { msg: "Too Many Requests", code: 429 },
|
|
94
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE: { msg: "Request Header Fields Too Large", code: 431 },
|
|
95
|
+
UNAVAILABLE_FOR_LEGAL_REASONS: { msg: "Unavailable For Legal Reasons", code: 451 },
|
|
107
96
|
// 5xx Server Errors
|
|
108
|
-
INTERNAL_SERVER_ERROR: {
|
|
109
|
-
NOT_IMPLEMENTED: {
|
|
110
|
-
BAD_GATEWAY: {
|
|
111
|
-
SERVICE_UNAVAILABLE: {
|
|
112
|
-
GATEWAY_TIMEOUT: {
|
|
113
|
-
HTTP_VERSION_NOT_SUPPORTED: {
|
|
114
|
-
VARIANT_ALSO_NEGOTIATES: {
|
|
115
|
-
INSUFFICIENT_STORAGE: {
|
|
116
|
-
LOOP_DETECTED: {
|
|
117
|
-
NOT_EXTENDED: {
|
|
118
|
-
NETWORK_AUTHENTICATION_REQUIRED: {
|
|
97
|
+
INTERNAL_SERVER_ERROR: { msg: "Internal Server Error", code: 500 },
|
|
98
|
+
NOT_IMPLEMENTED: { msg: "Not Implemented", code: 501 },
|
|
99
|
+
BAD_GATEWAY: { msg: "Bad Gateway", code: 502 },
|
|
100
|
+
SERVICE_UNAVAILABLE: { msg: "Service Unavailable", code: 503 },
|
|
101
|
+
GATEWAY_TIMEOUT: { msg: "Gateway Timeout", code: 504 },
|
|
102
|
+
HTTP_VERSION_NOT_SUPPORTED: { msg: "HTTP Version Not Supported", code: 505 },
|
|
103
|
+
VARIANT_ALSO_NEGOTIATES: { msg: "Variant Also Negotiates", code: 506 },
|
|
104
|
+
INSUFFICIENT_STORAGE: { msg: "Insufficient Storage", code: 507 },
|
|
105
|
+
LOOP_DETECTED: { msg: "Loop Detected", code: 508 },
|
|
106
|
+
NOT_EXTENDED: { msg: "Not Extended", code: 510 },
|
|
107
|
+
NETWORK_AUTHENTICATION_REQUIRED: { msg: "Network Authentication Required", code: 511 },
|
|
119
108
|
};
|
|
120
109
|
//# sourceMappingURL=exception-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception-handler.js","sourceRoot":"","sources":["../../src/exception/exception-handler.ts"],"names":[],"mappings":";;;AAAA,qCAAqE;AAE9D,MAAM,gBAAgB,GAAG,CAAC,KAAU,EAAE,EAAE;IAC7C,MAAM,UAAU,GAAG,YAAI,CAAC;IAExB,MAAM,GAAG,GAAG,KAAK,EAAE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E;IAClD,+BAA+B,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;CACzF,CAAC","sourcesContent":["import { ErrorDynamoDB, ErrorHttp, ErrorValidation } from \"./errors\";\n\nexport const errorHandlerHttp = (error: any) => {\n const httpStatus = HTTP;\n\n const msg = error?.message;\n\n let response = httpStatus.INTERNAL_SERVER_ERROR;\n let responseMsg = msg;\n let data = error?.data;\n\n if (error instanceof ErrorValidation) {\n response = httpStatus.BAD_REQUEST;\n response.error = response.error + \" - Validation Error\";\n // responseMsg = error.validation\n responseMsg = Object.fromEntries(error.validation.entries());\n data = error.content;\n } else if (error instanceof ErrorHttp) {\n response.code = error.statusCode;\n response.error = error.error;\n responseMsg = error.message;\n data = error.data;\n } else if (error instanceof ErrorDynamoDB) {\n const err = error;\n if (msg.includes(\"ConditionalCheckFailedException\")) {\n response = httpStatus.CONFLICT;\n response.error = response.error + \" - DynamoDB Error\";\n responseMsg =\n `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}, error: ` +\n JSON.stringify(err);\n } else if (msg.includes(\"ResourceNotFoundException\")) {\n response = httpStatus.NOT_FOUND;\n responseMsg = `Resource not found: ${err.tableName}`;\n } else if (msg.includes(\"requires indexName and indexValue\")) {\n response = httpStatus.BAD_REQUEST;\n responseMsg = `Index name and value are required: ${err.tableName}`;\n }\n } else if (msg?.includes(\"search_phase_execution_exception\")) {\n response = httpStatus.BAD_REQUEST;\n responseMsg = \"OpenSearch: Cannot sort by text field — use '.keyword' instead.\";\n }\n\n return {\n statusCode: response.code,\n content: {\n error: response.error,\n message: responseMsg,\n data: data,\n },\n };\n};\n\nexport const HTTP = {\n // 1xx Informational\n CONTINUE: { error: \"Continue\", code: 100 },\n SWITCHING_PROTOCOLS: { error: \"Switching Protocols\", code: 101 },\n PROCESSING: { error: \"Processing\", code: 102 },\n\n // 2xx Success\n OK: { error: \"OK\", code: 200 },\n CREATED: { error: \"Created\", code: 201 },\n ACCEPTED: { error: \"Accepted\", code: 202 },\n NON_AUTHORITATIVE_INFORMATION: { error: \"Non-Authoritative Information\", code: 203 },\n NO_CONTENT: { error: \"No Content\", code: 204 },\n RESET_CONTENT: { error: \"Reset Content\", code: 205 },\n PARTIAL_CONTENT: { error: \"Partial Content\", code: 206 },\n\n // 3xx Redirection\n MULTIPLE_CHOICES: { error: \"Multiple Choices\", code: 300 },\n MOVED_PERMANENTLY: { error: \"Moved Permanently\", code: 301 },\n FOUND: { error: \"Found\", code: 302 },\n SEE_OTHER: { error: \"See Other\", code: 303 },\n NOT_MODIFIED: { error: \"Not Modified\", code: 304 },\n TEMPORARY_REDIRECT: { error: \"Temporary Redirect\", code: 307 },\n PERMANENT_REDIRECT: { error: \"Permanent Redirect\", code: 308 },\n\n // 4xx Client Errors\n BAD_REQUEST: { error: \"Bad Request\", code: 400 },\n UNAUTHORIZED: { error: \"Unauthorized\", code: 401 },\n PAYMENT_REQUIRED: { error: \"Payment Required\", code: 402 },\n FORBIDDEN: { error: \"Forbidden\", code: 403 },\n NOT_FOUND: { error: \"Not Found\", code: 404 },\n METHOD_NOT_ALLOWED: { error: \"Method Not Allowed\", code: 405 },\n NOT_ACCEPTABLE: { error: \"Not Acceptable\", code: 406 },\n PROXY_AUTHENTICATION_REQUIRED: { error: \"Proxy Authentication Required\", code: 407 },\n REQUEST_TIMEOUT: { error: \"Request Timeout\", code: 408 },\n CONFLICT: { error: \"Conflict\", code: 409 },\n GONE: { error: \"Gone\", code: 410 },\n LENGTH_REQUIRED: { error: \"Length Required\", code: 411 },\n PRECONDITION_FAILED: { error: \"Precondition Failed\", code: 412 },\n PAYLOAD_TOO_LARGE: { error: \"Payload Too Large\", code: 413 },\n URI_TOO_LONG: { error: \"URI Too Long\", code: 414 },\n UNSUPPORTED_MEDIA_TYPE: { error: \"Unsupported Media Type\", code: 415 },\n RANGE_NOT_SATISFIABLE: { error: \"Range Not Satisfiable\", code: 416 },\n EXPECTATION_FAILED: { error: \"Expectation Failed\", code: 417 },\n IM_A_TEAPOT: { error: \"I'm a teapot\", code: 418 },\n MISDIRECTED_REQUEST: { error: \"Misdirected Request\", code: 421 },\n UNPROCESSABLE_ENTITY: { error: \"Unprocessable Entity\", code: 422 },\n LOCKED: { error: \"Locked\", code: 423 },\n FAILED_DEPENDENCY: { error: \"Failed Dependency\", code: 424 },\n TOO_EARLY: { error: \"Too Early\", code: 425 },\n UPGRADE_REQUIRED: { error: \"Upgrade Required\", code: 426 },\n PRECONDITION_REQUIRED: { error: \"Precondition Required\", code: 428 },\n TOO_MANY_REQUESTS: { error: \"Too Many Requests\", code: 429 },\n REQUEST_HEADER_FIELDS_TOO_LARGE: { error: \"Request Header Fields Too Large\", code: 431 },\n UNAVAILABLE_FOR_LEGAL_REASONS: { error: \"Unavailable For Legal Reasons\", code: 451 },\n\n // 5xx Server Errors\n INTERNAL_SERVER_ERROR: { error: \"Internal Server Error\", code: 500 },\n NOT_IMPLEMENTED: { error: \"Not Implemented\", code: 501 },\n BAD_GATEWAY: { error: \"Bad Gateway\", code: 502 },\n SERVICE_UNAVAILABLE: { error: \"Service Unavailable\", code: 503 },\n GATEWAY_TIMEOUT: { error: \"Gateway Timeout\", code: 504 },\n HTTP_VERSION_NOT_SUPPORTED: { error: \"HTTP Version Not Supported\", code: 505 },\n VARIANT_ALSO_NEGOTIATES: { error: \"Variant Also Negotiates\", code: 506 },\n INSUFFICIENT_STORAGE: { error: \"Insufficient Storage\", code: 507 },\n LOOP_DETECTED: { error: \"Loop Detected\", code: 508 },\n NOT_EXTENDED: { error: \"Not Extended\", code: 510 },\n NETWORK_AUTHENTICATION_REQUIRED: { error: \"Network Authentication Required\", code: 511 },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"exception-handler.js","sourceRoot":"","sources":["../../src/exception/exception-handler.ts"],"names":[],"mappings":";;;AAAA,qCAA0D;AAanD,MAAM,eAAe,GAAG,CAAC,GAAQ,EAAqB,EAAE;IAC7D,IAAI,IAAI,GAAe;QACrB,IAAI,EAAE,G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G,EAAE;IAElF,oBAAoB;IACpB,qBAAqB,EAAE,EAAE,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;IAClE,eAAe,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;IACtD,WAAW,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,EAAE;IAC9C,mBAAmB,EAAE,EAAE,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,GAAG,EAAE;IAC9D,eAAe,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;IACtD,0BAA0B,EAAE,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,GAAG,EAAE;IAC5E,uBAAuB,EAAE,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,GAAG,EAAE;IACtE,oBAAoB,EAAE,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,GAAG,EAAE;IAChE,aAAa,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE;IAClD,YAAY,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;IAChD,+BAA+B,EAAE,EAAE,GAAG,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;CACvF,CAAC","sourcesContent":["import { ErrorDynamoDB, ErrorValidation } from \"./errors\";\n\ntype HttpStatus = { code: number; msg: string };\n\ntype HttpErrorResponse = {\n statusCode: number;\n content: {\n error: string;\n message: unknown;\n data: unknown;\n };\n};\n\nexport const refineHttpError = (err: any): HttpErrorResponse => {\n let http: HttpStatus = {\n code: err.statusCode ?? HTTP.INTERNAL_SERVER_ERROR.code,\n msg: err.error ?? HTTP.INTERNAL_SERVER_ERROR.msg,\n };\n\n let message = err.message ?? \"An unexpected error occurred.\";\n let data = err.content;\n\n if (err instanceof ErrorValidation) {\n http = HTTP.BAD_REQUEST;\n http.msg += \" - Validation failed.\";\n } else if (err instanceof ErrorDynamoDB) {\n if (message.includes(\"requires indexName and indexValue\")) {\n http = HTTP.BAD_REQUEST;\n message = `Index name and value are required: ${err.tableName}`;\n }\n if (message.includes(\"ResourceNotFoundException\")) {\n http = HTTP.BAD_REQUEST;\n message = `Resource not found: ${err.tableName}`;\n } else if (message.includes(\"ConditionalCheckFailedException\")) {\n http = HTTP.BAD_REQUEST;\n message = `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}}`;\n }\n message = `Database Error: ${err.tableName}`;\n } else if (message.includes(\"search_phase_execution_exception\")) {\n http = HTTP.BAD_REQUEST;\n message = \"OpenSearch: Cannot sort by text field - use '.keyword' instead.\";\n }\n\n return {\n statusCode: http.code,\n content: {\n error: http.msg,\n message,\n data,\n },\n };\n};\n\nexport const HTTP = {\n // 1xx Informational\n CONTINUE: { msg: \"Continue\", code: 100 },\n SWITCHING_PROTOCOLS: { msg: \"Switching Protocols\", code: 101 },\n PROCESSING: { msg: \"Processing\", code: 102 },\n\n // 2xx Success\n OK: { msg: \"OK\", code: 200 },\n CREATED: { msg: \"Created\", code: 201 },\n ACCEPTED: { msg: \"Accepted\", code: 202 },\n NON_AUTHORITATIVE_INFORMATION: { msg: \"Non-Authoritative Information\", code: 203 },\n NO_CONTENT: { msg: \"No Content\", code: 204 },\n RESET_CONTENT: { msg: \"Reset Content\", code: 205 },\n PARTIAL_CONTENT: { msg: \"Partial Content\", code: 206 },\n\n // 3xx Redirection\n MULTIPLE_CHOICES: { msg: \"Multiple Choices\", code: 300 },\n MOVED_PERMANENTLY: { msg: \"Moved Permanently\", code: 301 },\n FOUND: { msg: \"Found\", code: 302 },\n SEE_OTHER: { msg: \"See Other\", code: 303 },\n NOT_MODIFIED: { msg: \"Not Modified\", code: 304 },\n TEMPORARY_REDIRECT: { msg: \"Temporary Redirect\", code: 307 },\n PERMANENT_REDIRECT: { msg: \"Permanent Redirect\", code: 308 },\n\n // 4xx Client Errors\n BAD_REQUEST: { msg: \"Bad Request\", code: 400 },\n UNAUTHORIZED: { msg: \"Unauthorized\", code: 401 },\n PAYMENT_REQUIRED: { msg: \"Payment Required\", code: 402 },\n FORBIDDEN: { msg: \"Forbidden\", code: 403 },\n NOT_FOUND: { msg: \"Not Found\", code: 404 },\n METHOD_NOT_ALLOWED: { msg: \"Method Not Allowed\", code: 405 },\n NOT_ACCEPTABLE: { msg: \"Not Acceptable\", code: 406 },\n PROXY_AUTHENTICATION_REQUIRED: { msg: \"Proxy Authentication Required\", code: 407 },\n REQUEST_TIMEOUT: { msg: \"Request Timeout\", code: 408 },\n CONFLICT: { msg: \"Conflict\", code: 409 },\n GONE: { msg: \"Gone\", code: 410 },\n LENGTH_REQUIRED: { msg: \"Length Required\", code: 411 },\n PRECONDITION_FAILED: { msg: \"Precondition Failed\", code: 412 },\n PAYLOAD_TOO_LARGE: { msg: \"Payload Too Large\", code: 413 },\n URI_TOO_LONG: { msg: \"URI Too Long\", code: 414 },\n UNSUPPORTED_MEDIA_TYPE: { msg: \"Unsupported Media Type\", code: 415 },\n RANGE_NOT_SATISFIABLE: { msg: \"Range Not Satisfiable\", code: 416 },\n EXPECTATION_FAILED: { msg: \"Expectation Failed\", code: 417 },\n IM_A_TEAPOT: { msg: \"I'm a teapot\", code: 418 },\n MISDIRECTED_REQUEST: { msg: \"Misdirected Request\", code: 421 },\n UNPROCESSABLE_ENTITY: { msg: \"Unprocessable Entity\", code: 422 },\n LOCKED: { msg: \"Locked\", code: 423 },\n FAILED_DEPENDENCY: { msg: \"Failed Dependency\", code: 424 },\n TOO_EARLY: { msg: \"Too Early\", code: 425 },\n UPGRADE_REQUIRED: { msg: \"Upgrade Required\", code: 426 },\n PRECONDITION_REQUIRED: { msg: \"Precondition Required\", code: 428 },\n TOO_MANY_REQUESTS: { msg: \"Too Many Requests\", code: 429 },\n REQUEST_HEADER_FIELDS_TOO_LARGE: { msg: \"Request Header Fields Too Large\", code: 431 },\n UNAVAILABLE_FOR_LEGAL_REASONS: { msg: \"Unavailable For Legal Reasons\", code: 451 },\n\n // 5xx Server Errors\n INTERNAL_SERVER_ERROR: { msg: \"Internal Server Error\", code: 500 },\n NOT_IMPLEMENTED: { msg: \"Not Implemented\", code: 501 },\n BAD_GATEWAY: { msg: \"Bad Gateway\", code: 502 },\n SERVICE_UNAVAILABLE: { msg: \"Service Unavailable\", code: 503 },\n GATEWAY_TIMEOUT: { msg: \"Gateway Timeout\", code: 504 },\n HTTP_VERSION_NOT_SUPPORTED: { msg: \"HTTP Version Not Supported\", code: 505 },\n VARIANT_ALSO_NEGOTIATES: { msg: \"Variant Also Negotiates\", code: 506 },\n INSUFFICIENT_STORAGE: { msg: \"Insufficient Storage\", code: 507 },\n LOOP_DETECTED: { msg: \"Loop Detected\", code: 508 },\n NOT_EXTENDED: { msg: \"Not Extended\", code: 510 },\n NETWORK_AUTHENTICATION_REQUIRED: { msg: \"Network Authentication Required\", code: 511 },\n};\n"]}
|
|
@@ -39,6 +39,13 @@ export declare abstract class CrudServiceImpl<T extends BaseEntity, D extends Ba
|
|
|
39
39
|
findByField(fieldName: string, fieldValue: any): Promise<List<T>>;
|
|
40
40
|
findFirst(fieldName: string, fieldValue: string | boolean | number | Date): Promise<T>;
|
|
41
41
|
find(filter: Filter | string): Promise<List<Partial<T>>>;
|
|
42
|
+
findStream(filter: string, size?: number): AsyncGenerator<T>;
|
|
43
|
+
searchStream(filter: string, size?: number): AsyncGenerator<T>;
|
|
44
|
+
searchStreamAggr(filter: string, size?: number): AsyncGenerator<{
|
|
45
|
+
items: Partial<T>[];
|
|
46
|
+
total: number;
|
|
47
|
+
aggs?: Record<string, any>;
|
|
48
|
+
}>;
|
|
42
49
|
findById(entityId: string, requestUser?: CognitoUser): Promise<T>;
|
|
43
50
|
findByIds(entityIds: string[], requestUser?: CognitoUser): Promise<T[]>;
|
|
44
51
|
scan(filter: Filter): Promise<List<Partial<T>>>;
|
|
@@ -97,6 +97,21 @@ export interface CrudService<T extends BaseEntity> {
|
|
|
97
97
|
total: number;
|
|
98
98
|
aggs?: Record<string, any>;
|
|
99
99
|
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a lazy async iterator over paginated DynamoDB query results.
|
|
102
|
+
* Each `next()` call loads the next page only when the current buffer is empty.
|
|
103
|
+
*/
|
|
104
|
+
findStream(filter: string, size?: number): AsyncGenerator<T>;
|
|
105
|
+
/**
|
|
106
|
+
* Returns a lazy async iterator over paginated OpenSearch query results.
|
|
107
|
+
* Each `next()` call loads the next page only when the current buffer is empty.
|
|
108
|
+
*/
|
|
109
|
+
searchStream(filter: string, size?: number): AsyncGenerator<T>;
|
|
110
|
+
searchStreamAggr(filter: string, size?: number): AsyncGenerator<{
|
|
111
|
+
items: Partial<T>[];
|
|
112
|
+
total: number;
|
|
113
|
+
aggs?: Record<string, any>;
|
|
114
|
+
}>;
|
|
100
115
|
searchQueryTotalCount(queryParams: any): Promise<number>;
|
|
101
116
|
findAll(): Promise<T[]>;
|
|
102
117
|
findAllMatch(filter: Filter | string): Promise<T[]>;
|