From 780b2f822718e9afafc6ab411b90568926c07c79 Mon Sep 17 00:00:00 2001 From: Meysam Hadeli <35596795+meysamhadeli@users.noreply.github.com> Date: Thu, 26 Dec 2024 03:00:41 +0330 Subject: [PATCH] fix: fixing test issue --- .../docker-compose/infrastructure.yaml | 2 +- src/building-blocks/context/context.js | 3 + src/building-blocks/context/context.js.map | 2 +- .../contracts/booking.contract.js | 12 ++ .../contracts/booking.contract.js.map | 2 +- .../contracts/flight.contract.js | 64 ++++++ .../contracts/flight.contract.js.map | 2 +- .../contracts/identity.contract.js | 24 +++ .../contracts/identity.contract.js.map | 2 +- .../contracts/passenger.contract.js | 7 + .../contracts/passenger.contract.js.map | 2 +- .../monitoring/request-counter.middleware.js | 10 +- .../request-counter.middleware.js.map | 2 +- src/building-blocks/nest-cli.json | 2 +- .../openTelemetry/open-telemetry-tracer.js | 16 +- .../open-telemetry-tracer.js.map | 2 +- src/building-blocks/passport/jwt.guard.d.ts | 2 +- src/building-blocks/passport/jwt.guard.js | 1 + .../rabbitmq/rabbitmq-connection.js | 15 +- .../rabbitmq/rabbitmq-connection.js.map | 2 +- .../rabbitmq/rabbitmq-publisher.js | 2 + .../rabbitmq/rabbitmq-publisher.js.map | 2 +- .../rabbitmq/rabbitmq-subscriber.js | 5 +- .../rabbitmq/rabbitmq-subscriber.js.map | 2 +- .../rabbitmq/rabbitmq.module.js | 1 + .../rabbitmq/rabbitmq.module.js.map | 2 +- .../postgres/postgres-container.d.ts | 2 +- .../container/postgres/postgres-container.js | 9 +- .../postgres/postgres-container.js.map | 2 +- .../container/postgres/postgres-container.ts | 15 +- .../container/rabbitmq/rabbitmq-container.js | 17 +- .../rabbitmq/rabbitmq-container.js.map | 2 +- .../container/rabbitmq/rabbitmq-container.ts | 2 +- src/building-blocks/tsconfig.json | 10 +- .../types/exeptions/application.exception.js | 2 + .../exeptions/application.exception.js.map | 2 +- .../types/exeptions/http-client.exception.js | 2 + .../exeptions/http-client.exception.js.map | 2 +- .../types/pagination/paged-result.js | 2 + .../types/pagination/paged-result.js.map | 2 +- src/building-blocks/utils/encryption.js.map | 2 +- .../user/features/create-user.test.d.ts | 1 - .../user/features/create-user.test.js | 23 -- .../user/features/create-user.test.js.map | 1 - .../user/features/create-user.test.d.ts | 1 - .../user/features/create-user.test.js | 23 -- .../user/features/create-user.test.js.map | 1 - .../user/features/create-user.test.ts | 8 +- .../shared/fixtures/end-to-end.fixture.d.ts | 3 - .../shared/fixtures/end-to-end.fixture.js | 8 - .../shared/fixtures/end-to-end.fixture.js.map | 1 - .../fixtures/integration-test.fixture.d.ts | 25 --- .../fixtures/integration-test.fixture.js | 95 -------- .../fixtures/integration-test.fixture.js.map | 1 - .../fixtures/integration-test.fixture.ts | 204 +++++++++--------- 55 files changed, 308 insertions(+), 348 deletions(-) delete mode 100644 src/identity/test/end-to-end-test/user/features/create-user.test.d.ts delete mode 100644 src/identity/test/end-to-end-test/user/features/create-user.test.js delete mode 100644 src/identity/test/end-to-end-test/user/features/create-user.test.js.map delete mode 100644 src/identity/test/integration-test/user/features/create-user.test.d.ts delete mode 100644 src/identity/test/integration-test/user/features/create-user.test.js delete mode 100644 src/identity/test/integration-test/user/features/create-user.test.js.map delete mode 100644 src/identity/test/shared/fixtures/end-to-end.fixture.d.ts delete mode 100644 src/identity/test/shared/fixtures/end-to-end.fixture.js delete mode 100644 src/identity/test/shared/fixtures/end-to-end.fixture.js.map delete mode 100644 src/identity/test/shared/fixtures/integration-test.fixture.d.ts delete mode 100644 src/identity/test/shared/fixtures/integration-test.fixture.js delete mode 100644 src/identity/test/shared/fixtures/integration-test.fixture.js.map diff --git a/deployments/docker-compose/infrastructure.yaml b/deployments/docker-compose/infrastructure.yaml index cc3eed2..bee76d4 100644 --- a/deployments/docker-compose/infrastructure.yaml +++ b/deployments/docker-compose/infrastructure.yaml @@ -5,7 +5,7 @@ services: # Rabbitmq ####################################################### rabbitmq: - image: rabbitmq:3-management + image: rabbitmq:management container_name: rabbitmq restart: unless-stopped ports: diff --git a/src/building-blocks/context/context.js b/src/building-blocks/context/context.js index 6149fd6..7cd3341 100644 --- a/src/building-blocks/context/context.js +++ b/src/building-blocks/context/context.js @@ -2,6 +2,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.HttpContextMiddleware = exports.HttpContext = void 0; class HttpContext { + static request; + static response; + static headers; } exports.HttpContext = HttpContext; class HttpContextMiddleware { diff --git a/src/building-blocks/context/context.js.map b/src/building-blocks/context/context.js.map index 62223e0..51a2878 100644 --- a/src/building-blocks/context/context.js.map +++ b/src/building-blocks/context/context.js.map @@ -1 +1 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["context.ts"],"names":[],"mappings":";;;AAIA,MAAa,WAAW;CAIvB;AAJD,kCAIC;AAED,MAAa,qBAAqB;IAChC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB;QACjD,WAAW,CAAC,OAAO,GAAG,GAAG,CAAC;QAE1B,WAAW,CAAC,QAAQ,GAAG,GAAG,CAAC;QAE3B,WAAW,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAElC,IAAI,EAAE,CAAC;IACT,CAAC;CACF;AAVD,sDAUC"} \ No newline at end of file +{"version":3,"file":"context.js","sourceRoot":"","sources":["context.ts"],"names":[],"mappings":";;;AAIA,MAAa,WAAW;IACtB,MAAM,CAAC,OAAO,CAAU;IACxB,MAAM,CAAC,QAAQ,CAAW;IAC1B,MAAM,CAAC,OAAO,CAAsB;CACrC;AAJD,kCAIC;AAED,MAAa,qBAAqB;IAChC,GAAG,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB;QACjD,WAAW,CAAC,OAAO,GAAG,GAAG,CAAC;QAE1B,WAAW,CAAC,QAAQ,GAAG,GAAG,CAAC;QAE3B,WAAW,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAElC,IAAI,EAAE,CAAC;IACT,CAAC;CACF;AAVD,sDAUC"} \ No newline at end of file diff --git a/src/building-blocks/contracts/booking.contract.js b/src/building-blocks/contracts/booking.contract.js index 34e4ee5..b3fc080 100644 --- a/src/building-blocks/contracts/booking.contract.js +++ b/src/building-blocks/contracts/booking.contract.js @@ -2,6 +2,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.BookingCreated = void 0; class BookingCreated { + id; + flightNumber; + aircraftId; + departureAirportId; + arriveAirportId; + flightDate; + price; + description; + seatNumber; + passengerName; + createdAt; + updatedAt; constructor(partial) { Object.assign(this, partial); } diff --git a/src/building-blocks/contracts/booking.contract.js.map b/src/building-blocks/contracts/booking.contract.js.map index 516bc8a..12d7b96 100644 --- a/src/building-blocks/contracts/booking.contract.js.map +++ b/src/building-blocks/contracts/booking.contract.js.map @@ -1 +1 @@ -{"version":3,"file":"booking.contract.js","sourceRoot":"","sources":["booking.contract.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IAczB,YAAY,OAAiC;QAC3C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAjBD,wCAiBC"} \ No newline at end of file +{"version":3,"file":"booking.contract.js","sourceRoot":"","sources":["booking.contract.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IACzB,EAAE,CAAS;IACX,YAAY,CAAS;IACrB,UAAU,CAAS;IACnB,kBAAkB,CAAS;IAC3B,eAAe,CAAS;IACxB,UAAU,CAAO;IACjB,KAAK,CAAS;IACd,WAAW,CAAS;IACpB,UAAU,CAAS;IACnB,aAAa,CAAS;IACtB,SAAS,CAAO;IAChB,SAAS,CAAe;IAExB,YAAY,OAAiC;QAC3C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAjBD,wCAiBC"} \ No newline at end of file diff --git a/src/building-blocks/contracts/flight.contract.js b/src/building-blocks/contracts/flight.contract.js index fe9bc5d..ff79c36 100644 --- a/src/building-blocks/contracts/flight.contract.js +++ b/src/building-blocks/contracts/flight.contract.js @@ -2,48 +2,112 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.SeatType = exports.SeatClass = exports.FlightStatus = exports.ReserveSeatRequestDto = exports.SeatDto = exports.FlightDto = exports.SeatReserved = exports.SeatCreated = exports.AirportCreated = exports.AircraftCreated = exports.FlightCreated = void 0; class FlightCreated { + id; + flightNumber; + price; + flightStatus; + flightDate; + departureDate; + departureAirportId; + aircraftId; + arriveDate; + arriveAirportId; + durationMinutes; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.FlightCreated = FlightCreated; class AircraftCreated { + id; + model; + name; + manufacturingYear; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.AircraftCreated = AircraftCreated; class AirportCreated { + id; + code; + name; + address; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.AirportCreated = AirportCreated; class SeatCreated { + id; + seatNumber; + seatClass; + seatType; + flightId; + isReserved; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.SeatCreated = SeatCreated; class SeatReserved { + id; + seatNumber; + seatClass; + seatType; + flightId; + isReserved; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.SeatReserved = SeatReserved; class FlightDto { + id; + flightNumber; + price; + flightStatus; + flightDate; + departureDate; + departureAirportId; + aircraftId; + arriveDate; + arriveAirportId; + durationMinutes; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.FlightDto = FlightDto; class SeatDto { + id; + seatNumber; + seatClass; + seatType; + flightId; + isReserved; + createdAt; + updatedAt; constructor(request = {}) { Object.assign(this, request); } } exports.SeatDto = SeatDto; class ReserveSeatRequestDto { + seatNumber; + flightId; constructor(request = {}) { Object.assign(this, request); } diff --git a/src/building-blocks/contracts/flight.contract.js.map b/src/building-blocks/contracts/flight.contract.js.map index acccfbd..4df0501 100644 --- a/src/building-blocks/contracts/flight.contract.js.map +++ b/src/building-blocks/contracts/flight.contract.js.map @@ -1 +1 @@ -{"version":3,"file":"flight.contract.js","sourceRoot":"","s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Z,yDAAa,CAAA;AACf,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAED,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,+CAAW,CAAA;IACX,uDAAW,CAAA;IACX,iDAAQ,CAAA;IACR,+CAAO,CAAA;AACT,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AAED,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,2CAAM,CAAA;IACN,2CAAM,CAAA;IACN,yCAAK,CAAA;AACP,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB"} \ No newline at end of file +{"version":3,"file":"flight.contract.js","sourceRoot":"","sources":["flight.contract.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IACxB,EAAE,CAAS;IACX,YAAY,CAAS;IACrB,KAAK,CAAS;IACd,YAAY,CAAe;IAC3B,UAAU,CAAO;IACjB,aAAa,CAAO;IACpB,kBAAkB,CAAS;IAC3B,UAAU,CAAS;IACnB,UAAU,CAAO;IACjB,eAAe,CAAS;IACxB,eAAe,CAAS;IACxB,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,UAAkC,EAAE;QAC9C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAlBD,sCAkBC;AAED,MAAa,eAAe;IAC1B,EAAE,CAAS;IACX,KAAK,CAAS;IACd,IAAI,CAAS;IACb,iBAAiB,CAAS;IAC1B,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,UAAoC,EAAE;QAChD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAXD,0CAWC;AAED,MAAa,cAAc;IACzB,EAAE,CAAS;IACX,IAAI,CAAS;IACb,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,UAAmC,EAAE;QAC/C,MAAM,CAAC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AAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,0BAaC;AAED,MAAa,qBAAqB;IAChC,UAAU,CAAS;IACnB,QAAQ,CAAS;IAEjB,YAAY,UAA0C,EAAE;QACtD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAPD,sDAOC;AAED,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,mDAAU,CAAA;IACV,iDAAS,CAAA;IACT,uDAAY,CAAA;IACZ,yDAAa,CAAA;AACf,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AAED,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,+CAAW,CAAA;IACX,uDAAW,CAAA;IACX,iDAAQ,CAAA;IACR,+CAAO,CAAA;AACT,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AAED,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,6CAAW,CAAA;IACX,2CAAM,CAAA;IACN,2CAAM,CAAA;IACN,yCAAK,CAAA;AACP,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB"} \ No newline at end of file diff --git a/src/building-blocks/contracts/identity.contract.js b/src/building-blocks/contracts/identity.contract.js index a605b34..0dfcb4c 100644 --- a/src/building-blocks/contracts/identity.contract.js +++ b/src/building-blocks/contracts/identity.contract.js @@ -2,18 +2,42 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Role = exports.UserUpdated = exports.UserDeleted = exports.UserCreated = void 0; class UserCreated { + id; + email; + name; + isEmailVerified; + role; + passportNumber; + createdAt; + updatedAt; constructor(partial) { Object.assign(this, partial); } } exports.UserCreated = UserCreated; class UserDeleted { + id; + email; + name; + isEmailVerified; + role; + passportNumber; + createdAt; + updatedAt; constructor(partial) { Object.assign(this, partial); } } exports.UserDeleted = UserDeleted; class UserUpdated { + id; + email; + name; + isEmailVerified; + role; + passportNumber; + createdAt; + updatedAt; constructor(partial) { Object.assign(this, partial); } diff --git a/src/building-blocks/contracts/identity.contract.js.map b/src/building-blocks/contracts/identity.contract.js.map index c2834d3..13def8f 100644 --- a/src/building-blocks/contracts/identity.contract.js.map +++ b/src/building-blocks/contracts/identity.contract.js.map @@ -1 +1 @@ -{"version":3,"file":"identity.contract.js","sourceRoot":"","sources":["identity.contract.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAUtB,YAAY,OAA8B;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,kCAaC;AAED,MAAa,WAAW;IAUtB,YAAY,OAA8B;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,kCAaC;AAED,MAAa,WAAW;IAUtB,YAAY,OAA8B;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,kCAaC;AAED,IAAY,IAGX;AAHD,WAAY,IAAI;IACd,+BAAQ,CAAA;IACR,iCAAS,CAAA;AACX,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf"} \ No newline at end of file +{"version":3,"file":"identity.contract.js","sourceRoot":"","sources":["identity.contract.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACtB,EAAE,CAAS;IACX,KAAK,CAAS;IACd,IAAI,CAAS;IACb,eAAe,CAAU;IACzB,IAAI,CAAO;IACX,cAAc,CAAS;IACvB,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,OAA8B;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,kCAaC;AAED,MAAa,WAAW;IACtB,EAAE,CAAS;IACX,KAAK,CAAS;IACd,IAAI,CAAS;IACb,eAAe,CAAU;IACzB,IAAI,CAAO;IACX,cAAc,CAAS;IACvB,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,OAA8B;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,kCAaC;AAED,MAAa,WAAW;IACtB,EAAE,CAAS;IACX,KAAK,CAAS;IACd,IAAI,CAAS;IACb,eAAe,CAAU;IACzB,IAAI,CAAO;IACX,cAAc,CAAS;IACvB,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,OAA8B;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAbD,kCAaC;AAED,IAAY,IAGX;AAHD,WAAY,IAAI;IACd,+BAAQ,CAAA;IACR,iCAAS,CAAA;AACX,CAAC,EAHW,IAAI,oBAAJ,IAAI,QAGf"} \ No newline at end of file diff --git a/src/building-blocks/contracts/passenger.contract.js b/src/building-blocks/contracts/passenger.contract.js index 2f109a4..fa3f0ca 100644 --- a/src/building-blocks/contracts/passenger.contract.js +++ b/src/building-blocks/contracts/passenger.contract.js @@ -2,6 +2,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.PassengerType = exports.PassengerDto = void 0; class PassengerDto { + id; + name; + age; + passportNumber; + passportType; + createdAt; + updatedAt; constructor(partial) { Object.assign(this, partial); } diff --git a/src/building-blocks/contracts/passenger.contract.js.map b/src/building-blocks/contracts/passenger.contract.js.map index 7dfe0bf..f4c0987 100644 --- a/src/building-blocks/contracts/passenger.contract.js.map +++ b/src/building-blocks/contracts/passenger.contract.js.map @@ -1 +1 @@ -{"version":3,"file":"passenger.contract.js","sourceRoot":"","sources":["passenger.contract.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAY;IASvB,YAAY,OAA+B;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAZD,oCAYC;AAED,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,iDAAI,CAAA;IACJ,qDAAM,CAAA;IACN,iDAAI,CAAA;AACN,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB"} \ No newline at end of file +{"version":3,"file":"passenger.contract.js","sourceRoot":"","sources":["passenger.contract.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAY;IACvB,EAAE,CAAS;IACX,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,cAAc,CAAS;IACvB,YAAY,CAAgB;IAC5B,SAAS,CAAO;IAChB,SAAS,CAAQ;IAEjB,YAAY,OAA+B;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AAZD,oCAYC;AAED,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,iDAAI,CAAA;IACJ,qDAAM,CAAA;IACN,iDAAI,CAAA;AACN,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB"} \ No newline at end of file diff --git a/src/building-blocks/monitoring/request-counter.middleware.js b/src/building-blocks/monitoring/request-counter.middleware.js index d4eae5c..030fd66 100644 --- a/src/building-blocks/monitoring/request-counter.middleware.js +++ b/src/building-blocks/monitoring/request-counter.middleware.js @@ -50,9 +50,15 @@ const requestCounterMiddleware = (err, req, res, next) => { requestCounter.inc(labels); res.on('finish', () => { const status = res.statusCode.toString(); - requestCounter.inc(Object.assign(Object.assign({}, labels), { status })); + requestCounter.inc({ + ...labels, + status + }); if (status.startsWith('4') || status.startsWith('5')) { - errorCounter.inc(Object.assign(Object.assign({}, labels), { status })); + errorCounter.inc({ + ...labels, + status + }); } }); next(); diff --git a/src/building-blocks/monitoring/request-counter.middleware.js.map b/src/building-blocks/monitoring/request-counter.middleware.js.map index 2763a01..fb758db 100644 --- a/src/building-blocks/monitoring/request-counter.middleware.js.map +++ b/src/building-blocks/monitoring/request-counter.middleware.js.map @@ -1 +1 @@ -{"version":3,"file":"request-counter.middleware.js","sourceRoot":"","sources":["request-counter.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0C;AAE1C,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC;IAC5C,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,+BAA+B;IACrC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC;IAC1C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,6BAA6B;IACnC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;CACzC,CAAC,CAAC;AAEI,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IAC9D,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;IAEtD,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE3B,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACpB,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QAEzC,cAAc,CAAC,GAAG,iCACb,MAAM,KACT,MAAM,IACN,CAAC;QAGH,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,YAAY,CAAC,GAAG,iCACX,MAAM,KACT,MAAM,IACN,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,EAAE,CAAC;AACT,CAAC,CAAC;AAvBW,QAAA,wBAAwB,4BAuBnC"} \ No newline at end of file +{"version":3,"file":"request-counter.middleware.js","sourceRoot":"","sources":["request-counter.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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a/src/building-blocks/nest-cli.json +++ b/src/building-blocks/nest-cli.json @@ -1,6 +1,6 @@ { + "$schema": "https://json.schemastore.org/nest-cli", "collection": "@nestjs/schematics", - "sourceRoot": "src", "compilerOptions": { } } diff --git a/src/building-blocks/openTelemetry/open-telemetry-tracer.js b/src/building-blocks/openTelemetry/open-telemetry-tracer.js index 8b60fee..b54abae 100644 --- a/src/building-blocks/openTelemetry/open-telemetry-tracer.js +++ b/src/building-blocks/openTelemetry/open-telemetry-tracer.js @@ -31,6 +31,9 @@ const api_1 = require("@opentelemetry/api"); const configs_1 = __importDefault(require("../configs/configs")); const sdk_node_1 = require("@opentelemetry/sdk-node"); class OpenTelemetryOptions { + jaegerEndpoint; + zipkinEndpoint; + serviceName; constructor(partial) { Object.assign(this, partial); } @@ -39,18 +42,17 @@ exports.OpenTelemetryOptions = OpenTelemetryOptions; let openTelemetryOptions = new OpenTelemetryOptions(); const otelSDK = initSdk(); async function initSdk() { - var _a, _b, _c, _d; const provider = new sdk_trace_node_1.NodeTracerProvider({ resource: new resources_1.Resource({ - [semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: (_a = openTelemetryOptions === null || openTelemetryOptions === void 0 ? void 0 : openTelemetryOptions.serviceName) !== null && _a !== void 0 ? _a : configs_1.default.serviceName + [semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: openTelemetryOptions?.serviceName ?? configs_1.default.serviceName }) }); const jaegerExporter = new exporter_jaeger_1.JaegerExporter({ - endpoint: (_b = openTelemetryOptions === null || openTelemetryOptions === void 0 ? void 0 : openTelemetryOptions.jaegerEndpoint) !== null && _b !== void 0 ? _b : configs_1.default.monitoring.jaegerEndpoint + endpoint: openTelemetryOptions?.jaegerEndpoint ?? configs_1.default.monitoring.jaegerEndpoint }); const zipkinExporter = new exporter_zipkin_1.ZipkinExporter({ - url: (_c = openTelemetryOptions === null || openTelemetryOptions === void 0 ? void 0 : openTelemetryOptions.zipkinEndpoint) !== null && _c !== void 0 ? _c : configs_1.default.monitoring.zipkinEndpoint, - serviceName: (_d = openTelemetryOptions === null || openTelemetryOptions === void 0 ? void 0 : openTelemetryOptions.serviceName) !== null && _d !== void 0 ? _d : configs_1.default.serviceName + url: openTelemetryOptions?.zipkinEndpoint ?? configs_1.default.monitoring.zipkinEndpoint, + serviceName: openTelemetryOptions?.serviceName ?? configs_1.default.serviceName }); provider.addSpanProcessor(new sdk_trace_base_1.SimpleSpanProcessor(jaegerExporter)); provider.addSpanProcessor(new sdk_trace_node_1.BatchSpanProcessor(zipkinExporter)); @@ -67,6 +69,7 @@ async function initSdk() { }); } let OpenTelemetryTracer = class OpenTelemetryTracer { + options; constructor(options) { this.options = options; openTelemetryOptions = this.options; @@ -75,8 +78,7 @@ let OpenTelemetryTracer = class OpenTelemetryTracer { (await otelSDK).start(); } async createTracer(options) { - var _a; - const tracer = api_1.trace.getTracer((_a = options === null || options === void 0 ? void 0 : options.serviceName) !== null && _a !== void 0 ? _a : configs_1.default.serviceName); + const tracer = api_1.trace.getTracer(options?.serviceName ?? configs_1.default.serviceName); return tracer; } }; diff --git a/src/building-blocks/openTelemetry/open-telemetry-tracer.js.map b/src/building-blocks/openTelemetry/open-telemetry-tracer.js.map index 31457be..d07d5be 100644 --- a/src/building-blocks/openTelemetry/open-telemetry-tracer.js.map +++ b/src/building-blocks/openTelemetry/open-telemetry-tracer.js.map @@ -1 +1 @@ -{"version":3,"file":"open-telemetry-tracer.js","sourceRoot":"","sources":["open-telemetry-tracer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAkE;AAClE,kEAAuF;AACvF,oEAAgE;AAChE,oFAAgF;AAChF,kEAAoE;AACpE,8EAA0E;AAC1E,oFAAgF;AAChF,4FAAiF;AACjF,wDAAoD;AACpD,8EAAiF;AACjF,oEAAgE;AAChE,4CAAmD;AACnD,iEAAyC;AACzC,sDAAkD;AAElD,MAAa,oBAAoB;IAK/B,YAAY,OAAuC;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI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ACzB,IAAI,gDAAsB,EAAE;YAC5B,IAAI,iDAAmB,EAAE;YACzB,IAAI,gDAAsB,EAAE;SAC7B;KACF,CAAC,CAAC;AACL,CAAC;AAOM,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAA2D,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QACtF,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC;IACtC,CAAC;IACD,KAAK,CAAC,YAAY;QAChB,CAAC,MAAM,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA6B;;QAC9C,MAAM,MAAM,GAAG,WAAK,CAAC,SAAS,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,iBAAO,CAAC,WAAW,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAZY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAEE,WAAA,IAAA,eAAM,EAAC,oBAAoB,CAAC,CAAA;qCAA2B,oBAAoB;GAD7E,mBAAmB,CAY/B"} \ No newline at end of file +{"version":3,"file":"open-telemetry-tracer.js","sourceRoot":"","sources":["open-telemetry-tracer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAkE;AAClE,kEAAuF;AACvF,oEAAgE;AAChE,oFAAgF;AAChF,kEAAoE;AACpE,8EAA0E;AAC1E,oFAAgF;AAChF,4FAAiF;AACjF,wDAAoD;AACpD,8EAAiF;AACjF,oEAAgE;AAChE,4CAAmD;AACnD,iEAAyC;AACzC,sDAAkD;AAElD,MAAa,oBAAoB;IAC/B,cAAc,CAAU;IACxB,cAAc,CAAU;IACxB,WAAW,CAAS;IAEpB,YAAY,OAAuC;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF;AARD,oDAQC;AAED,I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AAsB;QACtF,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC;IACtC,CAAC;IACD,KAAK,CAAC,YAAY;QAChB,CAAC,MAAM,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAA6B;QAC9C,MAAM,MAAM,GAAG,WAAK,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,IAAI,iBAAO,CAAC,WAAW,CAAC,CAAC;QAC5E,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAZY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAEE,WAAA,IAAA,eAAM,EAAC,oBAAoB,CAAC,CAAA;qCAA2B,oBAAoB;GAD7E,mBAAmB,CAY/B"} \ No newline at end of file diff --git a/src/building-blocks/passport/jwt.guard.d.ts b/src/building-blocks/passport/jwt.guard.d.ts index c212a10..32494ff 100644 --- a/src/building-blocks/passport/jwt.guard.d.ts +++ b/src/building-blocks/passport/jwt.guard.d.ts @@ -1,7 +1,7 @@ import { ExecutionContext } from '@nestjs/common'; declare const JwtGuard_base: import("@nestjs/passport").Type; export declare class JwtGuard extends JwtGuard_base { - canActivate(context: ExecutionContext): boolean | Promise | import("node_modules/rxjs/dist/types").Observable; + canActivate(context: ExecutionContext): boolean | Promise | import("rxjs").Observable; handleRequest(err: any, user: any, _info: any): any; } export {}; diff --git a/src/building-blocks/passport/jwt.guard.js b/src/building-blocks/passport/jwt.guard.js index 09e4f9d..60b295b 100644 --- a/src/building-blocks/passport/jwt.guard.js +++ b/src/building-blocks/passport/jwt.guard.js @@ -24,3 +24,4 @@ exports.JwtGuard = JwtGuard; exports.JwtGuard = JwtGuard = __decorate([ (0, common_1.Injectable)() ], JwtGuard); +//# sourceMappingURL=jwt.guard.js.map \ No newline at end of file diff --git a/src/building-blocks/rabbitmq/rabbitmq-connection.js b/src/building-blocks/rabbitmq/rabbitmq-connection.js index a9a1717..d52c83d 100644 --- a/src/building-blocks/rabbitmq/rabbitmq-connection.js +++ b/src/building-blocks/rabbitmq/rabbitmq-connection.js @@ -54,6 +54,10 @@ const amqp = __importStar(require("amqplib")); const configs_1 = __importDefault(require("../configs/configs")); const async_retry_1 = __importDefault(require("async-retry")); class RabbitmqOptions { + host; + port; + password; + username; constructor(partial) { Object.assign(this, partial); } @@ -62,6 +66,7 @@ exports.RabbitmqOptions = RabbitmqOptions; let connection = null; let channel = null; let RabbitmqConnection = class RabbitmqConnection { + options; constructor(options) { this.options = options; } @@ -69,16 +74,14 @@ let RabbitmqConnection = class RabbitmqConnection { await this.createConnection(this.options); } async createConnection(options) { - var _a, _b; if (!connection || !connection == undefined) { try { - const host = (_a = options === null || options === void 0 ? void 0 : options.host) !== null && _a !== void 0 ? _a : configs_1.default.rabbitmq.host; - const port = (_b = options === null || options === void 0 ? void 0 : options.port) !== null && _b !== void 0 ? _b : configs_1.default.rabbitmq.port; + const host = options?.host ?? configs_1.default.rabbitmq.host; + const port = options?.port ?? configs_1.default.rabbitmq.port; await (0, async_retry_1.default)(async () => { - var _a, _b; connection = await amqp.connect(`amqp://${host}:${port}`, { - username: (_a = options === null || options === void 0 ? void 0 : options.username) !== null && _a !== void 0 ? _a : configs_1.default.rabbitmq.username, - password: (_b = options === null || options === void 0 ? void 0 : options.password) !== null && _b !== void 0 ? _b : configs_1.default.rabbitmq.password + username: options?.username ?? configs_1.default.rabbitmq.username, + password: options?.password ?? configs_1.default.rabbitmq.password }); }, { retries: configs_1.default.retry.count, diff --git a/src/building-blocks/rabbitmq/rabbitmq-connection.js.map b/src/building-blocks/rabbitmq/rabbitmq-connection.js.map index 70b38d9..0e68295 100644 --- a/src/building-blocks/rabbitmq/rabbitmq-connection.js.map +++ b/src/building-blocks/rabbitmq/rabbitmq-connection.js.map @@ -1 +1 @@ -{"version":3,"file":"rabbitmq-connection.js","sourceRoot":"","sources":["rabbitmq-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;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/building-blocks/rabbitmq/rabbitmq-publisher.js index 86f5cb7..56a65bd 100644 --- a/src/building-blocks/rabbitmq/rabbitmq-publisher.js +++ b/src/building-blocks/rabbitmq/rabbitmq-publisher.js @@ -27,6 +27,8 @@ const configs_1 = __importDefault(require("../configs/configs")); const async_retry_1 = __importDefault(require("async-retry")); const publishedMessages = []; let RabbitmqPublisher = class RabbitmqPublisher { + rabbitMQConnection; + openTelemetryTracer; constructor(rabbitMQConnection, openTelemetryTracer) { this.rabbitMQConnection = rabbitMQConnection; this.openTelemetryTracer = openTelemetryTracer; diff --git a/src/building-blocks/rabbitmq/rabbitmq-publisher.js.map b/src/building-blocks/rabbitmq/rabbitmq-publisher.js.map index 756a4b6..fa2d41a 100644 --- a/src/building-blocks/rabbitmq/rabbitmq-publisher.js.map +++ b/src/building-blocks/rabbitmq/rabbitmq-publisher.js.map @@ -1 +1 @@ -{"version":3,"file":"rabbitmq-publisher.js","sourceRoot":"","sources":["rabbitmq-publisher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,+DAAgF;AAChF,wDAAwD;AACxD,oDAAkD;AAClD,mCAAmC;AACnC,+BAAoC;AACpC,uCAAuC;AAEvC,iEAAyC;AACzC,8DAAqC;AAErC,MAAM,iBAAiB,GAAa,EAAE,CAAC;AAQhC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAC5B,YACmB,kBAAsC,EACN,mBAAyC;QADzE,uBAAkB,GAAlB,kBAAkB,CAAoB;QACN,wBAAmB,GAAnB,mBAAmB,CAAsB;IACzF,CAAC;IAEJ,KAAK,CAAC,cAAc,CAAI,OAAU;QAChC,IAAI,CAAC;YACH,MAAM,IAAA,qBAAU,EACd,KAAK,IAAI,EAAE;gBACT,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;gBAE3D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC;oBAC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pC,UAAU,EAAE,iBAAO,CAAC,KAAK,CAAC,UAAU;aACrC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,eAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAI,OAAU;QAC7B,MAAM,YAAY,GAAG,IAAA,kBAAS,EAAC,IAAA,wBAAW,EAAC,OAAO,CAAC,CAAC,CAAC;QAErD,MAAM,WAAW,GAAG,iBAAiB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CACF,CAAA;AAjEY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,sBAAsB,CAAC,CAAA;qCADM,wCAAkB;GAF9C,iBAAiB,CAiE7B"} \ No newline at end of file diff --git a/src/building-blocks/rabbitmq/rabbitmq-subscriber.js b/src/building-blocks/rabbitmq/rabbitmq-subscriber.js index 5143699..e071a97 100644 --- a/src/building-blocks/rabbitmq/rabbitmq-subscriber.js +++ b/src/building-blocks/rabbitmq/rabbitmq-subscriber.js @@ -26,6 +26,8 @@ const configs_1 = __importDefault(require("../configs/configs")); const async_retry_1 = __importDefault(require("async-retry")); const consumedMessages = []; let RabbitmqConsumer = class RabbitmqConsumer { + rabbitMQConnection; + openTelemetryTracer; constructor(rabbitMQConnection, openTelemetryTracer) { this.rabbitMQConnection = rabbitMQConnection; this.openTelemetryTracer = openTelemetryTracer; @@ -45,10 +47,9 @@ let RabbitmqConsumer = class RabbitmqConsumer { await channel.bindQueue(q.queue, exchangeName, ''); common_1.Logger.log(`Waiting for messages with exchange name "${exchangeName}". To exit, press CTRL+C`); await channel.consume(q.queue, (message) => { - var _a; if (message !== null) { const span = tracer.startSpan(`receive_message_${exchangeName}`); - const messageContent = (_a = message === null || message === void 0 ? void 0 : message.content) === null || _a === void 0 ? void 0 : _a.toString(); + const messageContent = message?.content?.toString(); const headers = message.properties.headers || {}; handler(q.queue, (0, serilization_1.deserializeObject)(messageContent)); common_1.Logger.log(`Message: ${messageContent} delivered to queue: ${q.queue} with exchange name ${exchangeName}`); diff --git a/src/building-blocks/rabbitmq/rabbitmq-subscriber.js.map b/src/building-blocks/rabbitmq/rabbitmq-subscriber.js.map index be15977..39269d3 100644 --- a/src/building-blocks/rabbitmq/rabbitmq-subscriber.js.map +++ b/src/building-blocks/rabbitmq/rabbitmq-subscriber.js.map @@ -1 +1 @@ -{"version":3,"file":"rabbitmq-subscriber.js","sourceRoot":"","sources":["rabbitmq-subscriber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,+DAA2D;AAC3D,oDAAkD;AAClD,mCAAmC;AACnC,wDAA0D;AAE1D,wCAAsC;AACtC,iEAAyC;AACzC,8DAAqC;AAGrC,MAAM,gBAAgB,GAAa,EAAE,CAAC;AAQ/B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YACmB,kBAAsC,EACN,mBAAyC;QADzE,uBAAkB,GAAlB,kBAAkB,CAAoB;QACN,wBAAmB,GAAnB,mBAAmB,CAAsB;IACzF,CAAC;IAEJ,KAAK,CAAC,cAAc,CAAI,IAAO,EAAE,OAAuB;QACtD,IAAI,CAAC;YACH,MAAM,IAAA,qBAAU,EACd,KAAK,IAAI,EAAE;gBACT,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;gBAE3D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC;oBACzD,WAAW,EAAE,4BAA4B;iBAC1C,CAAC,CAAC;gBAEH,MAAM,YAAY,GAAG,IAAA,kBAAS,EAAC,IAAA,wBAAW,EAAC,IAAI,CAA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GAAG,KAAK,CAAC;QAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,IAAI,cAAc,GAAG,KAAK,CAAC;QAC3B,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,OAAO,IAAI,EAAE,CAAC;YACZ,IAAI,cAAc,EAAE,CAAC;gBACnB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC;YAElB,MAAM,YAAY,GAAG,IAAA,kBAAS,EAAC,IAAA,wBAAW,EAAC,OAAO,CAAC,CAAC,CAAC;YAErD,UAAU,GAAG,gBAAgB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAErD,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,WAAW,CAAC;QACxD,CAAC;IACH,CAAC;CACF,CAAA;AA3FY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,eAAM,EAAC,sBAAsB,CAAC,CAAA;qCADM,wCAAkB;GAF9C,gBAAgB,CA2F5B"} \ No newline at end of file diff --git a/src/building-blocks/rabbitmq/rabbitmq.module.js b/src/building-blocks/rabbitmq/rabbitmq.module.js index 72a5465..0ccbc3d 100644 --- a/src/building-blocks/rabbitmq/rabbitmq.module.js +++ b/src/building-blocks/rabbitmq/rabbitmq.module.js @@ -17,6 +17,7 @@ const rabbitmq_connection_1 = require("./rabbitmq-connection"); const open_telemetry_module_1 = require("../openTelemetry/open-telemetry.module"); const rabbitmq_subscriber_1 = require("./rabbitmq-subscriber"); let RabbitmqModule = RabbitmqModule_1 = class RabbitmqModule { + rabbitmqConnection; constructor(rabbitmqConnection) { this.rabbitmqConnection = rabbitmqConnection; } diff --git a/src/building-blocks/rabbitmq/rabbitmq.module.js.map b/src/building-blocks/rabbitmq/rabbitmq.module.js.map index 9c0bb10..2bdb4e6 100644 --- a/src/building-blocks/rabbitmq/rabbitmq.module.js.map +++ b/src/building-blocks/rabbitmq/rabbitmq.module.js.map @@ -1 +1 @@ -{"version":3,"file":"rabbitmq.module.js","sourceRoot":"","sources":["rabbitmq.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,6DAA6E;AAC7E,+DAAiG;AACjG,kFAA6E;AAC7E,+DAAyD;AAsBlD,IAAM,cAAc,sBAApB,MAAM,cAAc;IACzB,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IACvE,KAAK,CAAC,qBAAqB,CAAC,MAAe;QACzC,MAAM,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,OAAyB;QACtC,OAAO;YACL,MAAM,EAAE,gBAAc;YACtB,SAAS,EAAE,CAAC,wCAAkB,EAAE,EAAE,OAAO,EAAE,qCAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;SACjF,CAAC;IACJ,CAAC;CACF,CAAA;AAZY,wCAAc;yBAAd,cAAc;IApB1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,2CAAmB,CAAC,OAAO,EAAE,CAAC;QACxC,SAAS,EAAE;YACT,sCAAiB;YACjB;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,QAAQ,EAAE,wCAAkB;aAC7B;YACD;gBACE,OAAO,EAAE,oBAAoB;gBAC7B,QAAQ,EAAE,sCAAiB;aAC5B;YACD;gBACE,OAAO,EAAE,mBAAmB;gBAC5B,QAAQ,EAAE,sCAAgB;aAC3B;SACF;QACD,OAAO,EAAE,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,CAAC;KAC5E,CAAC;qCAEiD,wCAAkB;GADxD,cAAc,CAY1B"} \ No newline at end of file +{"version":3,"file":"rabbitmq.module.js","sourceRoot":"","sources":["rabbitmq.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,6DAA6E;AAC7E,+DAAiG;AACjG,kFAA6E;AAC7E,+DAAyD;AAsBlD,IAAM,cAAc,sBAApB,MAAM,cAAc;IACI;IAA7B,YAA6B,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;IAAG,CAAC;IACvE,KAAK,CAAC,qBAAqB,CAAC,MAAe;QACzC,MAAM,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,OAAyB;QACtC,OAAO;YACL,MAAM,EAAE,gBAAc;YACtB,SAAS,EAAE,CAAC,wCAAkB,EAAE,EAAE,OAAO,EAAE,qCAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;SACjF,CAAC;IACJ,CAAC;CACF,CAAA;AAZY,wCAAc;yBAAd,cAAc;IApB1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,2CAAmB,CAAC,OAAO,EAAE,CAAC;QACxC,SAAS,EAAE;YACT,sCAAiB;YACjB;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,QAAQ,EAAE,wCAAkB;aAC7B;YACD;gBACE,OAAO,EAAE,oBAAoB;gBAC7B,QAAQ,EAAE,sCAAiB;aAC5B;YACD;gBACE,OAAO,EAAE,mBAAmB;gBAC5B,QAAQ,EAAE,sCAAgB;aAC3B;SACF;QACD,OAAO,EAAE,CAAC,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,CAAC;KAC5E,CAAC;qCAEiD,wCAAkB;GADxD,cAAc,CAY1B"} \ No newline at end of file diff --git a/src/building-blocks/test/container/postgres/postgres-container.d.ts b/src/building-blocks/test/container/postgres/postgres-container.d.ts index ac530f9..d002413 100644 --- a/src/building-blocks/test/container/postgres/postgres-container.d.ts +++ b/src/building-blocks/test/container/postgres/postgres-container.d.ts @@ -1,6 +1,6 @@ import 'reflect-metadata'; import { StartedTestContainer } from 'testcontainers'; -import { DataSourceOptions, EntitySchema, MixedList } from 'typeorm'; +import { DataSourceOptions, EntitySchema, MixedList } from "typeorm"; export interface PostgresContainerOptions { imageName: string; type: string; diff --git a/src/building-blocks/test/container/postgres/postgres-container.js b/src/building-blocks/test/container/postgres/postgres-container.js index 00605f3..9bf7451 100644 --- a/src/building-blocks/test/container/postgres/postgres-container.js +++ b/src/building-blocks/test/container/postgres/postgres-container.js @@ -9,16 +9,19 @@ class PostgresContainer { const defaultPostgresOptions = await this.getDefaultPostgresTestContainers(); const pgContainerStarted = await this.getContainerStarted(defaultPostgresOptions); const containerPort = pgContainerStarted.getMappedPort(defaultPostgresOptions.port); - const dataSourceOptions = Object.assign(Object.assign({}, defaultPostgresOptions), { type: 'postgres', port: containerPort }); + const dataSourceOptions = { + ...defaultPostgresOptions, + type: 'postgres', + port: containerPort + }; common_1.Logger.log(`Test postgres with port ${containerPort} established`); return [pgContainerStarted, dataSourceOptions]; } async getContainerStarted(options) { - var _a; const pgContainer = new testcontainers_1.GenericContainer(options.imageName) .withExposedPorts(options.port) .withEnvironment({ POSTGRES_USER: options.username }) - .withEnvironment({ POSTGRES_PASSWORD: (_a = options.password) === null || _a === void 0 ? void 0 : _a.toString() }) + .withEnvironment({ POSTGRES_PASSWORD: options.password?.toString() }) .withEnvironment({ POSTGRES_DB: options.database }); const pgContainerStarted = await pgContainer.start(); return pgContainerStarted; diff --git a/src/building-blocks/test/container/postgres/postgres-container.js.map b/src/building-blocks/test/container/postgres/postgres-container.js.map index 9e89f97..0b0b545 100644 --- a/src/building-blocks/test/container/postgres/postgres-container.js.map +++ b/src/building-blocks/test/container/postgres/postgres-container.js.map @@ -1 +1 @@ -{"version":3,"file":"postgres-container.js","sourceRoot":"","sources":["postgres-container.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,mDAAwE;AACxE,2CAAwC;AAgBxC,MAAa,iBAAiB;IACr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kB,CAAC;IAC5B,CAAC;IAEO,KAAK,CAAC,gCAAgC;QAC5C,MAAM,eAAe,GAA6B;YAChD,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,SAAS;YACnB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,gBAAgB;YAC1B,QAAQ,EAAE,gBAAgB;YAC1B,SAAS,EAAE,iBAAiB;YAC5B,WAAW,EAAE,IAAI;YACjB,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,CAAC,2BAA2B,CAAC;SACxC,CAAC;QAEF,OAAO,eAAe,CAAC;IACzB,CAAC;CAEF;AA/CD,8CA+CC"} \ No newline at end of file diff --git a/src/building-blocks/test/container/postgres/postgres-container.ts b/src/building-blocks/test/container/postgres/postgres-container.ts index 260ccdc..0b90839 100644 --- a/src/building-blocks/test/container/postgres/postgres-container.ts +++ b/src/building-blocks/test/container/postgres/postgres-container.ts @@ -1,7 +1,7 @@ import 'reflect-metadata'; import { GenericContainer, StartedTestContainer } from 'testcontainers'; -import { Logger } from '@nestjs/common'; -import { DataSourceOptions, EntitySchema, MixedList } from 'typeorm'; +import {Logger} from "@nestjs/common"; +import {DataSourceOptions, EntitySchema, MixedList} from "typeorm"; export interface PostgresContainerOptions { imageName: string; @@ -16,8 +16,8 @@ export interface PostgresContainerOptions { migrationsRun: boolean; } -export class PostgresContainer { - public async start(): Promise<[StartedTestContainer, DataSourceOptions]> { +export class PostgresContainer{ + public async start(): Promise<[StartedTestContainer, DataSourceOptions]>{ const defaultPostgresOptions = await this.getDefaultPostgresTestContainers(); const pgContainerStarted = await this.getContainerStarted(defaultPostgresOptions); @@ -35,9 +35,7 @@ export class PostgresContainer { return [pgContainerStarted, dataSourceOptions]; } - private async getContainerStarted( - options: PostgresContainerOptions - ): Promise { + private async getContainerStarted(options: PostgresContainerOptions): Promise{ const pgContainer = new GenericContainer(options.imageName) .withExposedPorts(options.port) .withEnvironment({ POSTGRES_USER: options.username }) @@ -48,7 +46,7 @@ export class PostgresContainer { return pgContainerStarted; } - private async getDefaultPostgresTestContainers(): Promise { + private async getDefaultPostgresTestContainers(): Promise{ const postgresOptions: PostgresContainerOptions = { type: 'postgres', database: 'test_db', @@ -64,4 +62,5 @@ export class PostgresContainer { return postgresOptions; } + } diff --git a/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js b/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js index 1d9704d..934c743 100644 --- a/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js +++ b/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js @@ -13,17 +13,24 @@ class RabbitmqContainer { const defaultRabbitmqOptions = await this.getDefaultRabbitmqTestContainers(); const rabbitmqContainerStarted = await this.getContainerStarted(defaultRabbitmqOptions); const containerPort = rabbitmqContainerStarted.getMappedPort(defaultRabbitmqOptions.port); - configs_1.default.rabbitmq = Object.assign(Object.assign({}, configs_1.default.rabbitmq), { port: containerPort, username: defaultRabbitmqOptions.username, password: defaultRabbitmqOptions.password, host: defaultRabbitmqOptions.host }); - const rabbitmqOptions = Object.assign({}, configs_1.default.rabbitmq); + configs_1.default.rabbitmq = { + ...configs_1.default.rabbitmq, + port: containerPort, + username: defaultRabbitmqOptions.username, + password: defaultRabbitmqOptions.password, + host: defaultRabbitmqOptions.host + }; + const rabbitmqOptions = { + ...configs_1.default.rabbitmq + }; common_1.Logger.log(`Test rabbitmq with port ${containerPort} established`); return [rabbitmqContainerStarted, rabbitmqOptions]; } async getContainerStarted(options) { - var _a; const rabbitmqContainer = new testcontainers_1.GenericContainer(options.imageName) .withExposedPorts(options.port) .withEnvironment({ RABBITMQ_DEFAULT_USER: options.username }) - .withEnvironment({ RABBITMQ_DEFAULT_PASS: (_a = options.password) === null || _a === void 0 ? void 0 : _a.toString() }); + .withEnvironment({ RABBITMQ_DEFAULT_PASS: options.password?.toString() }); const rabbitmqContainerStarted = await rabbitmqContainer.start(); return rabbitmqContainerStarted; } @@ -33,7 +40,7 @@ class RabbitmqContainer { host: 'localhost', username: 'guest', password: 'guest', - imageName: 'rabbitmq:3-management' + imageName: 'rabbitmq:management' }; return rabbitmqOptions; } diff --git a/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js.map b/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js.map index 5492f72..6e367ec 100644 --- a/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js.map +++ b/src/building-blocks/test/container/rabbitmq/rabbitmq-container.js.map @@ -1 +1 @@ -{"version":3,"file":"rabbitmq-container.js","sourceRoot":"","sources":["rabbitmq-container.ts"],"names":[],"mappings":";;;;;;AAAA,4BAA0B;AAC1B,mDAAwE;AACxE,2CAAwC;AACxC,uEAA+C;AAW/C,MAAa,iBAAiB;IACrB,KAAK,CAAC,KAAK;QAChB,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,gCAAgC,EAAE,CAAC;QAE7E,MAAM,wBAAwB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;QAExF,MAAM,aAAa,GAAG,wBAAwB,CAAC,aAAa,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAE1F,iBAAO,CAAC,QAAQ,mCACX,iBAAO,CAAC,QAAQ,KACnB,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EACzC,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EACzC,IAAI,EAAE,sBAAsB,CAAC,IAAI,GAClC,CAAC;QAEF,MAAM,eAAe,qBAChB,iBAAO,CAAC,QAAQ,CACpB,CAAC;QAEF,eAAM,CAAC,GAAG,CAAC,2BAA2B,aAAa,cAAc,CAAC,CAAC;QAEnE,OAAO,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAC/B,OAAiC;;QAEjC,MAAM,iBAAiB,GAAG,IAAI,iCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC;aAC9D,gBAAgB,CA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AG,iBAAO,CAAC,QAAQ;SACpB,CAAC;QAEF,eAAM,CAAC,GAAG,CAAC,2BAA2B,aAAa,cAAc,CAAC,CAAC;QAEnE,OAAO,CAAC,wBAAwB,EAAE,eAAe,CAAC,CAAC;IACrD,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAC/B,OAAiC;QAEjC,MAAM,iBAAiB,GAAG,IAAI,iCAAgB,CAAC,OAAO,CAAC,SAAS,CAAC;aAC9D,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC;aAC9B,eAAe,CAAC,EAAE,qBAAqB,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;aAC5D,eAAe,CAAC,EAAE,qBAAqB,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,wBAAwB,GAAG,MAAM,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAEjE,OAAO,wBAAwB,CAAC;IAClC,CAAC;IAEO,KAAK,CAAC,gCAAgC;QAC5C,MAAM,eAAe,GAA6B;YAChD,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE,OAAO;YACjB,SAAS,EAAE,qBAAqB;SACjC,CAAC;QAEF,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAhDD,8CAgDC"} \ No newline at end of file diff --git a/src/building-blocks/test/container/rabbitmq/rabbitmq-container.ts b/src/building-blocks/test/container/rabbitmq/rabbitmq-container.ts index bab6c22..a8f5da3 100644 --- a/src/building-blocks/test/container/rabbitmq/rabbitmq-container.ts +++ b/src/building-blocks/test/container/rabbitmq/rabbitmq-container.ts @@ -55,7 +55,7 @@ export class RabbitmqContainer { host: 'localhost', username: 'guest', password: 'guest', - imageName: 'rabbitmq:3-management' + imageName: 'rabbitmq:management' }; return rabbitmqOptions; diff --git a/src/building-blocks/tsconfig.json b/src/building-blocks/tsconfig.json index fcae4cb..a139042 100644 --- a/src/building-blocks/tsconfig.json +++ b/src/building-blocks/tsconfig.json @@ -8,14 +8,13 @@ // Modules and Output "moduleResolution": "node", // Use Node.js module resolution "baseUrl": "./", // Base directory for paths - "outDir": "./dist", // Output directory - "declaration": true, // Generate .d.ts files (mostly use in library development) - "sourceMap": true, // Generate source maps (mostly use in library development) + "declaration": true, // Generate .d.ts files + "sourceMap": true, // Generate source maps "removeComments": true, // Remove comments in output // Decorators (needed for NestJS) "experimentalDecorators": true, // Enable decorators - "emitDecoratorMetadata": true, // Emit decorator metadata + "emitDecoratorMetadata": true, // Emit decorator metadata // Type Checking "strict": false, // Enable all strict type checking @@ -29,6 +28,7 @@ // Advanced "incremental": true, // Enable incremental compilation "preserveConstEnums": true, // Keep const enums in output - "resolveJsonModule": true // Allow importing JSON files + "resolveJsonModule": true, // Allow importing JSON files + "isolatedModules": false, // Forces each file to be a module or not }, } diff --git a/src/building-blocks/types/exeptions/application.exception.js b/src/building-blocks/types/exeptions/application.exception.js index dad78ea..c85867e 100644 --- a/src/building-blocks/types/exeptions/application.exception.js +++ b/src/building-blocks/types/exeptions/application.exception.js @@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ApplicationException = void 0; const common_1 = require("@nestjs/common"); class ApplicationException extends Error { + statusCode; + isOperational; constructor(message, statusCode = common_1.HttpStatus.BAD_REQUEST, isOperational = true, stack = '') { super(message); this.statusCode = statusCode; diff --git a/src/building-blocks/types/exeptions/application.exception.js.map b/src/building-blocks/types/exeptions/application.exception.js.map index 0b6aaa1..fa64820 100644 --- a/src/building-blocks/types/exeptions/application.exception.js.map +++ b/src/building-blocks/types/exeptions/application.exception.js.map @@ -1 +1 @@ -{"version":3,"file":"application.exception.js","sourceRoot":"","sources":["application.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,MAAa,oBAAqB,SAAQ,KAAK;IAI7C,YACE,OAA2B,EAC3B,aAAqB,mBAAU,CAAC,WAAW,EAC3C,aAAa,GAAG,IAAI,EACpB,KAAK,GAAG,EAAE;QAEV,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAnBD,oDAmBC;AAED,kBAAe,oBAAoB,CAAC"} \ No newline at end of file +{"version":3,"file":"application.exception.js","sourceRoot":"","sources":["application.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,UAAU,CAAS;IACnB,aAAa,CAAU;IAEvB,YACE,OAA2B,EAC3B,aAAqB,mBAAU,CAAC,WAAW,EAC3C,aAAa,GAAG,IAAI,EACpB,KAAK,GAAG,EAAE;QAEV,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAnBD,oDAmBC;AAED,kBAAe,oBAAoB,CAAC"} \ No newline at end of file diff --git a/src/building-blocks/types/exeptions/http-client.exception.js b/src/building-blocks/types/exeptions/http-client.exception.js index 2a1252f..b36a8da 100644 --- a/src/building-blocks/types/exeptions/http-client.exception.js +++ b/src/building-blocks/types/exeptions/http-client.exception.js @@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.HttpClientException = void 0; const common_1 = require("@nestjs/common"); class HttpClientException extends Error { + statusCode; + isOperational; constructor(message, statusCode = common_1.HttpStatus.BAD_REQUEST, isOperational = true, stack = '') { super(message); this.statusCode = statusCode; diff --git a/src/building-blocks/types/exeptions/http-client.exception.js.map b/src/building-blocks/types/exeptions/http-client.exception.js.map index cb9d333..95175a6 100644 --- a/src/building-blocks/types/exeptions/http-client.exception.js.map +++ b/src/building-blocks/types/exeptions/http-client.exception.js.map @@ -1 +1 @@ -{"version":3,"file":"http-client.exception.js","sourceRoot":"","sources":["http-client.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,MAAa,mBAAoB,SAAQ,KAAK;IAI5C,YACE,OAA2B,EAC3B,aAAqB,mBAAU,CAAC,WAAW,EAC3C,aAAa,GAAG,IAAI,EACpB,KAAK,GAAG,EAAE;QAEV,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAnBD,kDAmBC;AAED,kBAAe,mBAAmB,CAAC"} \ No newline at end of file +{"version":3,"file":"http-client.exception.js","sourceRoot":"","sources":["http-client.exception.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,MAAa,mBAAoB,SAAQ,KAAK;IAC5C,UAAU,CAAS;IACnB,aAAa,CAAU;IAEvB,YACE,OAA2B,EAC3B,aAAqB,mBAAU,CAAC,WAAW,EAC3C,aAAa,GAAG,IAAI,EACpB,KAAK,GAAG,EAAE;QAEV,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAnBD,kDAmBC;AAED,kBAAe,mBAAmB,CAAC"} \ No newline at end of file diff --git a/src/building-blocks/types/pagination/paged-result.js b/src/building-blocks/types/pagination/paged-result.js index 4707cda..f498a19 100644 --- a/src/building-blocks/types/pagination/paged-result.js +++ b/src/building-blocks/types/pagination/paged-result.js @@ -2,6 +2,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.PagedResult = void 0; class PagedResult { + result; + total; constructor(result, total) { this.result = result; this.total = total; diff --git a/src/building-blocks/types/pagination/paged-result.js.map b/src/building-blocks/types/pagination/paged-result.js.map index 1f6158e..318e4af 100644 --- a/src/building-blocks/types/pagination/paged-result.js.map +++ b/src/building-blocks/types/pagination/paged-result.js.map @@ -1 +1 @@ -{"version":3,"file":"paged-result.js","sourceRoot":"","sources":["paged-result.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAItB,YAAY,MAAS,EAAE,KAAa;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AARD,kCAQC"} \ No newline at end of file +{"version":3,"file":"paged-result.js","sourceRoot":"","sources":["paged-result.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IACtB,MAAM,CAAI;IACV,KAAK,CAAS;IAEd,YAAY,MAAS,EAAE,KAAa;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AARD,kCAQC"} \ No newline at end of file diff --git a/src/building-blocks/utils/encryption.js.map b/src/building-blocks/utils/encryption.js.map index 9ca55bb..98103a8 100644 --- a/src/building-blocks/utils/encryption.js.map +++ b/src/building-blocks/utils/encryption.js.map @@ -1 +1 @@ -{"version":3,"file":"encryption.js","sourceRoot":"","sources":["encryption.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA8B;AAC9B,kDAAoC;AACpC,iEAAyC;AAGlC,MAAM,eAAe,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IACxD,MAAM,iBAAiB,GAAG,MAAM,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACzD,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B;AAEK,MAAM,eAAe,GAAG,KAAK,EAAE,QAAgB,EAAE,YAAoB,EAAE,EAAE;IAC9E,OAAO,kBAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEK,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IACzD,MAAM,QAAQ,GAAG;QACf,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B"} \ No newline at end of file +{"version":3,"file":"encryption.js","sourceRoot":"","sources":["encryption.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA8B;AAC9B,kDAAoC;AACpC,iEAAyC;AAElC,MAAM,eAAe,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IACxD,MAAM,iBAAiB,GAAG,MAAM,kBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACzD,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B;AAEK,MAAM,eAAe,GAAG,KAAK,EAAE,QAAgB,EAAE,YAAoB,EAAE,EAAE;IAC9E,OAAO,kBAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEK,MAAM,eAAe,GAAG,KAAK,IAAqB,EAAE;IACzD,MAAM,QAAQ,GAAG;QACf,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,iBAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B"} \ No newline at end of file diff --git a/src/identity/test/end-to-end-test/user/features/create-user.test.d.ts b/src/identity/test/end-to-end-test/user/features/create-user.test.d.ts deleted file mode 100644 index d2c9bc6..0000000 --- a/src/identity/test/end-to-end-test/user/features/create-user.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'reflect-metadata'; diff --git a/src/identity/test/end-to-end-test/user/features/create-user.test.js b/src/identity/test/end-to-end-test/user/features/create-user.test.js deleted file mode 100644 index ad1ae49..0000000 --- a/src/identity/test/end-to-end-test/user/features/create-user.test.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -require("reflect-metadata"); -const end_to_end_fixture_1 = require("../../../shared/fixtures/end-to-end.fixture"); -const fake_create_user_request_dto_1 = require("../../../shared/fakes/user/fake-create-user-request.dto"); -const request = require('supertest'); -describe('end-to-end test for create user', () => { - const endToEndFixture = new end_to_end_fixture_1.EndToEndTestFixture(); - let fixture; - beforeAll(async () => { - fixture = await endToEndFixture.initializeFixture(); - }); - afterAll(async () => { - await endToEndFixture.cleanUp(); - }); - it('should create user and retrieve 201 status code', async () => { - const createUserResponse = await request(fixture.app.getHttpServer()) - .post('/api/v1/user/create') - .send(fake_create_user_request_dto_1.FakeCreateUserRequestDto.generate()) - .expect(201); - }); -}); -//# sourceMappingURL=create-user.test.js.map \ No newline at end of file diff --git a/src/identity/test/end-to-end-test/user/features/create-user.test.js.map b/src/identity/test/end-to-end-test/user/features/create-user.test.js.map deleted file mode 100644 index 51c70e5..0000000 --- a/src/identity/test/end-to-end-test/user/features/create-user.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-user.test.js","sourceRoot":"","sources":["create-user.test.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAC1B,oFAAkF;AAElF,0GAAmG;AACnG,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErC,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,MAAM,eAAe,GAAG,IAAI,wCAAmB,EAAE,CAAC;IAClD,IAAI,OAAgB,CAAC;IAErB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,OAAO,GAAG,MAAM,eAAe,CAAC,iBAAiB,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;aAClE,IAAI,CAAC,qBAAqB,CAAC;aAC3B,IAAI,CAAC,uDAAwB,CAAC,QAAQ,EAAE,CAAC;aACzC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/src/identity/test/integration-test/user/features/create-user.test.d.ts b/src/identity/test/integration-test/user/features/create-user.test.d.ts deleted file mode 100644 index d2c9bc6..0000000 --- a/src/identity/test/integration-test/user/features/create-user.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -import 'reflect-metadata'; diff --git a/src/identity/test/integration-test/user/features/create-user.test.js b/src/identity/test/integration-test/user/features/create-user.test.js deleted file mode 100644 index 8f6dd50..0000000 --- a/src/identity/test/integration-test/user/features/create-user.test.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -require("reflect-metadata"); -const integration_test_fixture_1 = require("../../../shared/fixtures/integration-test.fixture"); -const fake_create_user_1 = require("../../../shared/fakes/user/fake-create-user"); -const identity_contract_1 = require("building-blocks/contracts/identity.contract"); -describe('integration test for create user', () => { - const integrationTestFixture = new integration_test_fixture_1.IntegrationTestFixture(); - let fixture; - beforeAll(async () => { - fixture = await integrationTestFixture.initializeFixture(); - }); - afterAll(async () => { - await integrationTestFixture.cleanUp(); - }); - it('should create user and retrieve a user from the database', async () => { - const result = await fixture.commandBus.execute(fake_create_user_1.FakeCreateUser.generate()); - const isPublished = await fixture.rabbitmqPublisher.isPublished(new identity_contract_1.UserCreated()); - expect(isPublished).toBe(true); - const user = fixture.userRepository.findUserById(result.id); - expect(user).not.toBeNull(); - }); -}); diff --git a/src/identity/test/integration-test/user/features/create-user.test.js.map b/src/identity/test/integration-test/user/features/create-user.test.js.map deleted file mode 100644 index 40ad22a..0000000 --- a/src/identity/test/integration-test/user/features/create-user.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-user.test.js","sourceRoot":"","sources":["create-user.test.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAC1B,gGAAoG;AACpG,kFAA6E;AAC7E,mFAA0E;AAE1E,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,MAAM,sBAAsB,GAAG,IAAI,iDAAsB,EAAE,CAAC;IAC5D,IAAI,OAAgB,CAAC;IAErB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,OAAO,GAAG,MAAM,sBAAsB,CAAC,iBAAiB,EAAE,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,sBAAsB,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACxE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,iCAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE3E,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,+BAAW,EAAE,CAAC,CAAC;QACnF,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE/B,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/src/identity/test/integration-test/user/features/create-user.test.ts b/src/identity/test/integration-test/user/features/create-user.test.ts index 4c3c449..a17b000 100644 --- a/src/identity/test/integration-test/user/features/create-user.test.ts +++ b/src/identity/test/integration-test/user/features/create-user.test.ts @@ -1,14 +1,14 @@ import 'reflect-metadata'; -import { Fixture, IntegrationTestFixture } from '../../../shared/fixtures/integration-test.fixture'; -import { FakeCreateUser } from '../../../shared/fakes/user/fake-create-user'; -import { UserCreated } from 'building-blocks/contracts/identity.contract'; +import {Fixture, IntegrationTestFixture} from "../../../shared/fixtures/integration-test.fixture"; +import {FakeCreateUser} from "../../../shared/fakes/user/fake-create-user"; +import {UserCreated} from "building-blocks/contracts/identity.contract"; describe('integration test for create user', () => { const integrationTestFixture = new IntegrationTestFixture(); let fixture: Fixture; beforeAll(async () => { - fixture = await integrationTestFixture.initializeFixture(); + fixture = await integrationTestFixture.initializeFixture() as Fixture;; }); afterAll(async () => { diff --git a/src/identity/test/shared/fixtures/end-to-end.fixture.d.ts b/src/identity/test/shared/fixtures/end-to-end.fixture.d.ts deleted file mode 100644 index f11afa7..0000000 --- a/src/identity/test/shared/fixtures/end-to-end.fixture.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IntegrationTestFixture } from '/integration-test.fixture'; -export declare class EndToEndTestFixture extends IntegrationTestFixture { -} diff --git a/src/identity/test/shared/fixtures/end-to-end.fixture.js b/src/identity/test/shared/fixtures/end-to-end.fixture.js deleted file mode 100644 index 51ee0aa..0000000 --- a/src/identity/test/shared/fixtures/end-to-end.fixture.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.EndToEndTestFixture = void 0; -const integration_test_fixture_1 = require("/integration-test.fixture"); -class EndToEndTestFixture extends integration_test_fixture_1.IntegrationTestFixture { -} -exports.EndToEndTestFixture = EndToEndTestFixture; -//# sourceMappingURL=end-to-end.fixture.js.map \ No newline at end of file diff --git a/src/identity/test/shared/fixtures/end-to-end.fixture.js.map b/src/identity/test/shared/fixtures/end-to-end.fixture.js.map deleted file mode 100644 index e2a6d65..0000000 --- a/src/identity/test/shared/fixtures/end-to-end.fixture.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"end-to-end.fixture.js","sourceRoot":"","sources":["end-to-end.fixture.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEnE,MAAa,mBAAoB,SAAQ,iDAAsB;CAAG;AAAlE,kDAAkE"} \ No newline at end of file diff --git a/src/identity/test/shared/fixtures/integration-test.fixture.d.ts b/src/identity/test/shared/fixtures/integration-test.fixture.d.ts deleted file mode 100644 index 9dd02a0..0000000 --- a/src/identity/test/shared/fixtures/integration-test.fixture.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IUserRepository } from '../../../src/data/repositories/user.repository'; -import { INestApplication } from '@nestjs/common'; -import { IAuthRepository } from '../../../src/data/repositories/auth.repository'; -import { IRabbitmqConsumer } from 'building-blocks/rabbitmq/rabbitmq-subscriber'; -import { IRabbitmqPublisher } from 'building-blocks/rabbitmq/rabbitmq-publisher'; -import { CommandBus, QueryBus } from '@nestjs/cqrs'; -import { IRabbitmqConnection } from 'building-blocks/rabbitmq/rabbitmq-connection'; -import { StartedTestContainer } from 'testcontainers'; -export declare class Fixture { - userRepository: IUserRepository; - authRepository: IAuthRepository; - postgresContainer: StartedTestContainer; - rabbitmqContainer: StartedTestContainer; - rabbitmqConsumer: IRabbitmqConsumer; - rabbitmqConnection: IRabbitmqConnection; - rabbitmqPublisher: IRabbitmqPublisher; - commandBus: CommandBus; - queryBus: QueryBus; - app: INestApplication; -} -export declare class IntegrationTestFixture { - private fixture; - initializeFixture(): Promise; - cleanUp(): Promise; -} diff --git a/src/identity/test/shared/fixtures/integration-test.fixture.js b/src/identity/test/shared/fixtures/integration-test.fixture.js deleted file mode 100644 index e0c407c..0000000 --- a/src/identity/test/shared/fixtures/integration-test.fixture.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.IntegrationTestFixture = exports.Fixture = void 0; -const common_1 = require("@nestjs/common"); -const testing_1 = require("@nestjs/testing"); -const postgres_container_1 = require("building-blocks/test/container/postgres/postgres-container"); -const rabbitmq_container_1 = require("building-blocks/test/container/rabbitmq/rabbitmq-container"); -const cqrs_1 = require("@nestjs/cqrs"); -const passport_1 = require("@nestjs/passport"); -const jwt_1 = require("@nestjs/jwt"); -const configs_1 = __importDefault(require("building-blocks/configs/configs")); -const open_telemetry_module_1 = require("building-blocks/openTelemetry/open-telemetry.module"); -const typeorm_1 = require("@nestjs/typeorm"); -const user_module_1 = require("../../../src/user/user.module"); -const auth_module_1 = require("../../../src/auth/auth.module"); -const core_1 = require("@nestjs/core"); -const jwt_strategy_1 = require("building-blocks/passport/jwt.strategy"); -const jwt_guard_1 = require("building-blocks/passport/jwt.guard"); -class Fixture { - userRepository; - authRepository; - postgresContainer; - rabbitmqContainer; - rabbitmqConsumer; - rabbitmqConnection; - rabbitmqPublisher; - commandBus; - queryBus; - app; -} -exports.Fixture = Fixture; -class IntegrationTestFixture { - fixture = new Fixture(); - async initializeFixture() { - const [postgresContainer, postgresOptions] = await new postgres_container_1.PostgresContainer().start(); - this.fixture.postgresContainer = postgresContainer; - const [rabbitmqContainer, rabbitmqOptions] = await new rabbitmq_container_1.RabbitmqContainer().start(); - this.fixture.rabbitmqContainer = rabbitmqContainer; - const module = await testing_1.Test.createTestingModule({ - imports: [ - passport_1.PassportModule, - jwt_1.JwtModule.register({ - secret: configs_1.default.jwt.secret, - signOptions: { expiresIn: configs_1.default.jwt.refreshExpirationDays } - }), - open_telemetry_module_1.OpenTelemetryModule.forRoot(), - typeorm_1.TypeOrmModule.forRootAsync(postgresOptions), - user_module_1.UserModule, - auth_module_1.AuthModule, - core_1.RouterModule.register([ - { - path: '/', - module: user_module_1.UserModule - }, - { - path: '/', - module: auth_module_1.AuthModule - } - ]) - ], - providers: [jwt_strategy_1.JwtStrategy, cqrs_1.CommandBus, cqrs_1.QueryBus] - }) - .overrideGuard(jwt_guard_1.JwtGuard) - .useValue({ - canActivate: (context) => { - const req = context.switchToHttp().getRequest(); - req.user = { userId: 1, username: 'test_user' }; - return true; - } - }) - .compile(); - this.fixture.app = module.createNestApplication(); - this.fixture.app.setGlobalPrefix('api'); - this.fixture.app.enableVersioning({ - type: common_1.VersioningType.URI - }); - await this.fixture.app.init(); - this.fixture.userRepository = module.get('IUserRepository'); - this.fixture.authRepository = module.get('IAuthRepository'); - this.fixture.rabbitmqPublisher = module.get('IRabbitmqPublisher'); - this.fixture.rabbitmqConnection = module.get('IRabbitmqConnection'); - this.fixture.commandBus = module.get(cqrs_1.CommandBus); - this.fixture.queryBus = module.get(cqrs_1.QueryBus); - return this.fixture; - } - async cleanUp() { - await this.fixture.rabbitmqContainer.stop(); - await this.fixture.postgresContainer.stop(); - await this.fixture.app.close(); - } -} -exports.IntegrationTestFixture = IntegrationTestFixture; diff --git a/src/identity/test/shared/fixtures/integration-test.fixture.js.map b/src/identity/test/shared/fixtures/integration-test.fixture.js.map deleted file mode 100644 index 7e542fd..0000000 --- a/src/identity/test/shared/fixtures/integration-test.fixture.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"integration-test.fixture.js","sourceRoot":"","sources":["integration-test.fixture.ts"],"names":[],"mappings":";;;;;;AACA,2CAAoF;AACpF,6CAAsD;AACtD,mGAA+F;AAC/F,mGAA+F;AAI/F,uCAAoD;AACpD,+CAAkD;AAClD,qCAAwC;AACxC,8EAAsD;AACtD,+FAA0F;AAC1F,6CAAgD;AAChD,+DAA2D;AAC3D,+DAA2D;AAC3D,uCAA4C;AAC5C,wEAAoE;AACpE,kEAA8D;AAI9D,MAAa,OAAO;IAClB,cAAc,CAAkB;IAChC,cAAc,CAAkB;IAChC,iBAAiB,CAAuB;IACxC,iBAAiB,CAAuB;IACxC,gBAAgB,CAAoB;IACpC,kBAAkB,CAAsB;IACxC,iBAAiB,CAAqB;IACtC,UAAU,CAAa;IACvB,QAAQ,CAAW;IACnB,GAAG,CAAmB;CACvB;AAXD,0BAWC;AAED,MAAa,sBAAsB;IACzB,OAAO,GAAY,IAAI,OAAO,EAAE,CAAC;IAElC,KAAK,CAAC,iBAAiB;QAC5B,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAAG,MAAM,IAAI,sCAAiB,EAAE,CAAC,KAAK,EAAE,CAAC;QACnF,IAAI,CAAC,OAAO,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAEnD,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAAG,MAAM,IAAI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G,CAAC,gBAAgB,CAAC;YAChC,IAAI,EAAE,uBAAc,CAAC,GAAG;SACzB,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,CAAkB,iBAAiB,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,CAAkB,iBAAiB,CAAC,CAAC;QAE7E,IAAI,CAAC,OAAO,CAAC,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAqB,oBAAoB,CAAC,CAAC;QACtF,IAAI,CAAC,OAAO,CAAC,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAsB,qBAAqB,CAAC,CAAC;QAEzF,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,CAAa,iBAAU,CAAC,CAAC;QAC7D,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAW,eAAQ,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAE5C,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;CACF;AAxED,wDAwEC"} \ No newline at end of file diff --git a/src/identity/test/shared/fixtures/integration-test.fixture.ts b/src/identity/test/shared/fixtures/integration-test.fixture.ts index bd92381..3adfd55 100644 --- a/src/identity/test/shared/fixtures/integration-test.fixture.ts +++ b/src/identity/test/shared/fixtures/integration-test.fixture.ts @@ -1,108 +1,110 @@ -import { IUserRepository } from '../../../src/data/repositories/user.repository'; -import { ExecutionContext, INestApplication, VersioningType } from '@nestjs/common'; -import { Test, TestingModule } from '@nestjs/testing'; -import { PostgresContainer } from 'building-blocks/test/container/postgres/postgres-container'; -import { RabbitmqContainer } from 'building-blocks/test/container/rabbitmq/rabbitmq-container'; -import { IAuthRepository } from '../../../src/data/repositories/auth.repository'; -import { IRabbitmqConsumer } from 'building-blocks/rabbitmq/rabbitmq-subscriber'; -import { IRabbitmqPublisher } from 'building-blocks/rabbitmq/rabbitmq-publisher'; -import { CommandBus, QueryBus } from '@nestjs/cqrs'; -import { PassportModule } from '@nestjs/passport'; -import { JwtModule } from '@nestjs/jwt'; +import {IUserRepository} from '../../../src/data/repositories/user.repository'; +import {ExecutionContext, INestApplication, VersioningType} from '@nestjs/common'; +import {Test, TestingModule} from '@nestjs/testing'; +import {PostgresContainer} from 'building-blocks/test/container/postgres/postgres-container'; +import {RabbitmqContainer} from 'building-blocks/test/container/rabbitmq/rabbitmq-container'; +import {IAuthRepository} from '../../../src/data/repositories/auth.repository'; +import {IRabbitmqConsumer} from 'building-blocks/rabbitmq/rabbitmq-subscriber'; +import {IRabbitmqPublisher} from 'building-blocks/rabbitmq/rabbitmq-publisher'; +import {CommandBus, QueryBus} from '@nestjs/cqrs'; +import {PassportModule} from '@nestjs/passport'; +import {JwtModule} from '@nestjs/jwt'; import configs from 'building-blocks/configs/configs'; -import { OpenTelemetryModule } from 'building-blocks/openTelemetry/open-telemetry.module'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { UserModule } from '../../../src/user/user.module'; -import { AuthModule } from '../../../src/auth/auth.module'; -import { RouterModule } from '@nestjs/core'; -import { JwtStrategy } from 'building-blocks/passport/jwt.strategy'; -import { JwtGuard } from 'building-blocks/passport/jwt.guard'; -import { IRabbitmqConnection } from 'building-blocks/rabbitmq/rabbitmq-connection'; -import { StartedTestContainer } from 'testcontainers'; +import {OpenTelemetryModule} from 'building-blocks/openTelemetry/open-telemetry.module'; +import {TypeOrmModule} from '@nestjs/typeorm'; +import {UserModule} from '../../../src/user/user.module'; +import {AuthModule} from '../../../src/auth/auth.module'; +import {RouterModule} from '@nestjs/core'; +import {JwtStrategy} from 'building-blocks/passport/jwt.strategy'; +import {JwtGuard} from 'building-blocks/passport/jwt.guard'; +import {IRabbitmqConnection} from 'building-blocks/rabbitmq/rabbitmq-connection'; +import {StartedTestContainer} from 'testcontainers'; +import {TypeOrmModuleOptions} from "@nestjs/typeorm/dist/interfaces/typeorm-options.interface"; export class Fixture { - userRepository: IUserRepository; - authRepository: IAuthRepository; - postgresContainer: StartedTestContainer; - rabbitmqContainer: StartedTestContainer; - rabbitmqConsumer: IRabbitmqConsumer; - rabbitmqConnection: IRabbitmqConnection; - rabbitmqPublisher: IRabbitmqPublisher; - commandBus: CommandBus; - queryBus: QueryBus; - app: INestApplication; + userRepository: IUserRepository; + authRepository: IAuthRepository; + postgresContainer: StartedTestContainer; + rabbitmqContainer: StartedTestContainer; + rabbitmqConsumer: IRabbitmqConsumer; + rabbitmqConnection: IRabbitmqConnection; + rabbitmqPublisher: IRabbitmqPublisher; + commandBus: CommandBus; + queryBus: QueryBus; + app: INestApplication; } export class IntegrationTestFixture { - private fixture: Fixture = new Fixture(); - - public async initializeFixture(): Promise { - const [postgresContainer, postgresOptions] = await new PostgresContainer().start(); - this.fixture.postgresContainer = postgresContainer; - - const [rabbitmqContainer, rabbitmqOptions] = await new RabbitmqContainer().start(); - this.fixture.rabbitmqContainer = rabbitmqContainer; - - const module: TestingModule = await Test.createTestingModule({ - imports: [ - PassportModule, - JwtModule.register({ - secret: configs.jwt.secret, - signOptions: { expiresIn: configs.jwt.refreshExpirationDays } - }), - OpenTelemetryModule.forRoot(), - TypeOrmModule.forRootAsync(postgresOptions), - UserModule, - AuthModule, - RouterModule.register([ - { - path: '/', - module: UserModule - }, - { - path: '/', - module: AuthModule - } - ]) - ], - providers: [JwtStrategy, CommandBus, QueryBus] - }) - .overrideGuard(JwtGuard) - .useValue({ - canActivate: (context: ExecutionContext) => { - const req = context.switchToHttp().getRequest(); - req.user = { userId: 1, username: 'test_user' }; - return true; - } - }) - .compile(); - - this.fixture.app = module.createNestApplication(); - - this.fixture.app.setGlobalPrefix('api'); - - this.fixture.app.enableVersioning({ - type: VersioningType.URI - }); - - await this.fixture.app.init(); - - this.fixture.userRepository = module.get('IUserRepository'); - this.fixture.authRepository = module.get('IAuthRepository'); - - this.fixture.rabbitmqPublisher = module.get('IRabbitmqPublisher'); - this.fixture.rabbitmqConnection = module.get('IRabbitmqConnection'); - - this.fixture.commandBus = module.get(CommandBus); - this.fixture.queryBus = module.get(QueryBus); - - return this.fixture; - } - - public async cleanUp() { - await this.fixture.rabbitmqContainer.stop(); - await this.fixture.postgresContainer.stop(); - - await this.fixture.app.close(); - } + private fixture: Fixture = new Fixture(); + + public async initializeFixture(): Promise { + const [postgresContainer, postgresOptions] = await new PostgresContainer().start(); + this.fixture.postgresContainer = postgresContainer; + + const [rabbitmqContainer, rabbitmqOptions] = await new RabbitmqContainer().start(); + this.fixture.rabbitmqContainer = rabbitmqContainer; + + const module: TestingModule = await Test.createTestingModule({ + imports: [ + PassportModule, + JwtModule.register({ + secret: configs.jwt.secret, + signOptions: {expiresIn: configs.jwt.refreshExpirationDays} + }), + OpenTelemetryModule.forRoot(), + TypeOrmModule.forRoot(postgresOptions as TypeOrmModuleOptions), + UserModule, + AuthModule, + RouterModule.register([ + { + path: '/', + module: UserModule + }, + { + path: '/', + module: AuthModule + } + ]) + ], + providers: [JwtStrategy, CommandBus, QueryBus] + }) + .overrideGuard(JwtGuard) + .useValue({ + canActivate: (context: ExecutionContext) => { + const req = context.switchToHttp().getRequest(); + req.user = {userId: 1, username: 'test_user'}; + return true; + } + }) + .compile(); + + this.fixture.app = module.createNestApplication(); + + this.fixture.app.setGlobalPrefix('api'); + + this.fixture.app.enableVersioning({ + type: VersioningType.URI + }); + + await this.fixture.app.init(); + + this.fixture.userRepository = module.get('IUserRepository'); + this.fixture.authRepository = module.get('IAuthRepository'); + + this.fixture.rabbitmqPublisher = module.get('IRabbitmqPublisher'); + this.fixture.rabbitmqConnection = module.get('IRabbitmqConnection'); + + this.fixture.commandBus = module.get(CommandBus); + this.fixture.queryBus = module.get(QueryBus); + + return this.fixture; + } + + public async cleanUp() { + + await this.fixture.rabbitmqContainer.stop(); + await this.fixture.postgresContainer.stop(); + + await this.fixture.app.close(); + } }