@laboratory-one/api-components 0.0.24 → 0.0.25
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/src/ability/ability.factory.d.ts +5 -0
- package/dist/src/ability/ability.factory.d.ts.map +1 -0
- package/dist/src/ability/ability.factory.js +22 -0
- package/dist/src/ability/ability.factory.js.map +1 -0
- package/dist/src/ability/ability.module.d.ts +3 -0
- package/dist/src/ability/ability.module.d.ts.map +1 -0
- package/dist/src/ability/ability.module.js +16 -0
- package/dist/src/ability/ability.module.js.map +1 -0
- package/dist/src/ability/ability.util.d.ts +7 -0
- package/dist/src/ability/ability.util.d.ts.map +1 -0
- package/dist/src/ability/ability.util.js +30 -0
- package/dist/src/ability/ability.util.js.map +1 -0
- package/dist/src/ability/action.enum.d.ts +9 -0
- package/dist/src/ability/action.enum.d.ts.map +1 -0
- package/dist/src/ability/action.enum.js +11 -0
- package/dist/src/ability/action.enum.js.map +1 -0
- package/dist/src/ability/app-ability.type.d.ts +7 -0
- package/dist/src/ability/app-ability.type.d.ts.map +1 -0
- package/dist/src/ability/app-ability.type.js +3 -0
- package/dist/src/ability/app-ability.type.js.map +1 -0
- package/dist/src/ability/index.d.ts +7 -0
- package/dist/src/ability/index.d.ts.map +1 -0
- package/dist/src/ability/index.js +10 -0
- package/dist/src/ability/index.js.map +1 -0
- package/dist/src/ability/services.enum.d.ts +7 -0
- package/dist/src/ability/services.enum.d.ts.map +1 -0
- package/dist/src/ability/services.enum.js +9 -0
- package/dist/src/ability/services.enum.js.map +1 -0
- package/dist/src/cron/cron.module.d.ts.map +1 -0
- package/dist/src/cron/cron.module.js.map +1 -0
- package/dist/src/cron/cron.service.d.ts.map +1 -0
- package/dist/src/cron/cron.service.js.map +1 -0
- package/dist/src/cron/cron.util.d.ts.map +1 -0
- package/dist/src/cron/cron.util.js.map +1 -0
- package/dist/src/cron/index.d.ts.map +1 -0
- package/dist/src/cron/index.js.map +1 -0
- package/dist/src/decorator/index.d.ts +3 -0
- package/dist/src/decorator/index.d.ts.map +1 -0
- package/dist/src/decorator/index.js +6 -0
- package/dist/src/decorator/index.js.map +1 -0
- package/dist/src/decorator/policies.decorator.d.ts +4 -0
- package/dist/src/decorator/policies.decorator.d.ts.map +1 -0
- package/dist/src/decorator/policies.decorator.js +8 -0
- package/dist/src/decorator/policies.decorator.js.map +1 -0
- package/dist/src/decorator/policies.handler.d.ts +9 -0
- package/dist/src/decorator/policies.handler.d.ts.map +1 -0
- package/dist/src/decorator/policies.handler.js +14 -0
- package/dist/src/decorator/policies.handler.js.map +1 -0
- package/dist/src/enums/humanDay.enum.d.ts.map +1 -0
- package/dist/src/enums/humanDay.enum.js.map +1 -0
- package/dist/src/enums/index.d.ts.map +1 -0
- package/dist/src/enums/index.js.map +1 -0
- package/dist/src/enums/serverDay.enum.d.ts.map +1 -0
- package/dist/src/enums/serverDay.enum.js.map +1 -0
- package/dist/src/guard/auth.guard.d.ts.map +1 -0
- package/dist/src/guard/auth.guard.js.map +1 -0
- package/dist/src/guard/index.d.ts +3 -0
- package/dist/src/guard/index.d.ts.map +1 -0
- package/{src → dist/src}/guard/index.js +1 -0
- package/dist/src/guard/index.js.map +1 -0
- package/dist/src/guard/policies.guard.d.ts +11 -0
- package/dist/src/guard/policies.guard.d.ts.map +1 -0
- package/dist/src/guard/policies.guard.js +44 -0
- package/dist/src/guard/policies.guard.js.map +1 -0
- package/dist/src/health/dtos/health.response.dto.d.ts.map +1 -0
- package/dist/src/health/dtos/health.response.dto.js.map +1 -0
- package/dist/src/health/dtos/index.d.ts.map +1 -0
- package/dist/src/health/dtos/index.js.map +1 -0
- package/dist/src/health/health.controller.d.ts.map +1 -0
- package/dist/src/health/health.controller.js.map +1 -0
- package/dist/src/health/health.module.d.ts.map +1 -0
- package/dist/src/health/health.module.js.map +1 -0
- package/dist/src/health/health.service.d.ts.map +1 -0
- package/dist/src/health/health.service.js.map +1 -0
- package/dist/src/health/index.d.ts.map +1 -0
- package/dist/src/health/index.js.map +1 -0
- package/dist/src/middleware/index.d.ts.map +1 -0
- package/dist/src/middleware/index.js.map +1 -0
- package/dist/src/middleware/logger.middleware.d.ts.map +1 -0
- package/dist/src/middleware/logger.middleware.js.map +1 -0
- package/dist/src/prisma/index.d.ts.map +1 -0
- package/dist/src/prisma/index.js.map +1 -0
- package/dist/src/prisma/prisma.module.d.ts.map +1 -0
- package/dist/src/prisma/prisma.module.js.map +1 -0
- package/dist/src/prisma/prisma.service.d.ts.map +1 -0
- package/dist/src/prisma/prisma.service.js.map +1 -0
- package/dist/src/push/index.d.ts.map +1 -0
- package/dist/src/push/index.js.map +1 -0
- package/dist/src/push/push.module.d.ts.map +1 -0
- package/dist/src/push/push.module.js.map +1 -0
- package/dist/src/push/push.service.d.ts.map +1 -0
- package/dist/src/push/push.service.js.map +1 -0
- package/dist/src/search/index.d.ts.map +1 -0
- package/dist/src/search/index.js.map +1 -0
- package/dist/src/search/search.module.d.ts.map +1 -0
- package/dist/src/search/search.module.js.map +1 -0
- package/dist/src/search/search.service.d.ts.map +1 -0
- package/dist/src/search/search.service.js.map +1 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/instrument-sentry.d.ts.map +1 -0
- package/dist/src/services/instrument-sentry.js.map +1 -0
- package/dist/src/types/index.d.ts +5 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/{src → dist/src}/types/index.js +2 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/policy.type.d.ts +8 -0
- package/dist/src/types/policy.type.d.ts.map +1 -0
- package/dist/src/types/policy.type.js +3 -0
- package/dist/src/types/policy.type.js.map +1 -0
- package/dist/src/types/req.type.d.ts.map +1 -0
- package/dist/src/types/req.type.js.map +1 -0
- package/dist/src/types/reqWithUser.type.d.ts +4 -0
- package/dist/src/types/reqWithUser.type.d.ts.map +1 -0
- package/dist/src/types/reqWithUser.type.js +3 -0
- package/dist/src/types/reqWithUser.type.js.map +1 -0
- package/dist/src/types/success.response.dto.d.ts.map +1 -0
- package/dist/src/types/success.response.dto.js.map +1 -0
- package/dist/src/utils/datetime.util.d.ts.map +1 -0
- package/dist/src/utils/datetime.util.js.map +1 -0
- package/dist/src/utils/error.util.d.ts.map +1 -0
- package/dist/src/utils/error.util.js.map +1 -0
- package/{src → dist/src}/utils/index.d.ts +0 -1
- package/dist/src/utils/index.d.ts.map +1 -0
- package/{src → dist/src}/utils/index.js +0 -1
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/input.util.d.ts.map +1 -0
- package/dist/src/utils/input.util.js.map +1 -0
- package/dist/src/utils/noop.util.d.ts.map +1 -0
- package/dist/src/utils/noop.util.js.map +1 -0
- package/dist/src/utils/string.util.d.ts.map +1 -0
- package/dist/src/utils/string.util.js.map +1 -0
- package/dist/src/utils/version.util.d.ts.map +1 -0
- package/dist/src/utils/version.util.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +12 -100
- package/src/ability/ability.factory.ts +19 -0
- package/src/ability/ability.module.ts +8 -0
- package/src/ability/ability.util.ts +37 -0
- package/src/ability/action.enum.ts +9 -0
- package/src/ability/app-ability.type.ts +7 -0
- package/src/ability/index.ts +6 -0
- package/src/ability/services.enum.ts +7 -0
- package/src/decorator/index.ts +2 -0
- package/src/decorator/policies.decorator.ts +7 -0
- package/src/decorator/policies.handler.ts +16 -0
- package/src/guard/index.ts +1 -0
- package/src/guard/policies.guard.ts +65 -0
- package/src/types/index.ts +2 -0
- package/src/types/policy.type.ts +9 -0
- package/src/types/reqWithUser.type.ts +3 -0
- package/src/utils/index.ts +0 -1
- package/src/auth/auth.module.d.ts +0 -3
- package/src/auth/auth.module.js +0 -18
- package/src/auth/auth.module.ts +0 -10
- package/src/auth/auth.service.d.ts +0 -18
- package/src/auth/auth.service.js +0 -65
- package/src/auth/auth.service.ts +0 -80
- package/src/auth/index.d.ts +0 -3
- package/src/auth/index.js +0 -6
- package/src/auth/index.ts +0 -2
- package/src/guard/index.d.ts +0 -2
- package/src/types/index.d.ts +0 -3
- package/src/user/dtos/delete-user.request.dto.d.ts +0 -4
- package/src/user/dtos/delete-user.request.dto.js +0 -15
- package/src/user/dtos/delete-user.request.dto.ts +0 -8
- package/src/user/dtos/get-user.response.dto.d.ts +0 -7
- package/src/user/dtos/get-user.response.dto.js +0 -32
- package/src/user/dtos/get-user.response.dto.ts +0 -22
- package/src/user/dtos/index.d.ts +0 -9
- package/src/user/dtos/index.js +0 -12
- package/src/user/dtos/index.ts +0 -8
- package/src/user/dtos/phone-login-verify.request.dto.d.ts +0 -6
- package/src/user/dtos/phone-login-verify.request.dto.js +0 -25
- package/src/user/dtos/phone-login-verify.request.dto.ts +0 -16
- package/src/user/dtos/phone-login.request.dto.d.ts +0 -4
- package/src/user/dtos/phone-login.request.dto.js +0 -15
- package/src/user/dtos/phone-login.request.dto.ts +0 -8
- package/src/user/dtos/phone-login.response.dto.d.ts +0 -5
- package/src/user/dtos/phone-login.response.dto.js +0 -20
- package/src/user/dtos/phone-login.response.dto.ts +0 -12
- package/src/user/dtos/register.request.dto.d.ts +0 -5
- package/src/user/dtos/register.request.dto.js +0 -20
- package/src/user/dtos/register.request.dto.ts +0 -12
- package/src/user/dtos/register.response.dto.d.ts +0 -5
- package/src/user/dtos/register.response.dto.js +0 -16
- package/src/user/dtos/register.response.dto.ts +0 -10
- package/src/user/dtos/update-user.request.dto.d.ts +0 -8
- package/src/user/dtos/update-user.request.dto.js +0 -40
- package/src/user/dtos/update-user.request.dto.ts +0 -29
- package/src/user/index.d.ts +0 -7
- package/src/user/index.js +0 -10
- package/src/user/index.ts +0 -6
- package/src/user/schemas/delete-user.schema.d.ts +0 -5
- package/src/user/schemas/delete-user.schema.js +0 -9
- package/src/user/schemas/delete-user.schema.ts +0 -7
- package/src/user/schemas/index.d.ts +0 -6
- package/src/user/schemas/index.js +0 -9
- package/src/user/schemas/index.ts +0 -5
- package/src/user/schemas/phone-login-verify.schema.d.ts +0 -7
- package/src/user/schemas/phone-login-verify.schema.js +0 -11
- package/src/user/schemas/phone-login-verify.schema.ts +0 -9
- package/src/user/schemas/phone-login.schema.d.ts +0 -5
- package/src/user/schemas/phone-login.schema.js +0 -9
- package/src/user/schemas/phone-login.schema.ts +0 -7
- package/src/user/schemas/signup.schema.d.ts +0 -6
- package/src/user/schemas/signup.schema.js +0 -10
- package/src/user/schemas/signup.schema.ts +0 -8
- package/src/user/schemas/update-user.schema.d.ts +0 -9
- package/src/user/schemas/update-user.schema.js +0 -15
- package/src/user/schemas/update-user.schema.ts +0 -13
- package/src/user/user.controller.d.ts +0 -22
- package/src/user/user.controller.js +0 -279
- package/src/user/user.controller.ts +0 -321
- package/src/user/user.module.d.ts +0 -3
- package/src/user/user.module.js +0 -22
- package/src/user/user.module.ts +0 -16
- package/src/user/user.service.d.ts +0 -15
- package/src/user/user.service.js +0 -62
- package/src/user/user.service.ts +0 -68
- package/src/user/user.util.d.ts +0 -3
- package/src/user/user.util.js +0 -8
- package/src/user/user.util.ts +0 -5
- package/src/utils/schema.util.d.ts +0 -13
- package/src/utils/schema.util.js +0 -16
- package/src/utils/schema.util.ts +0 -13
- /package/{src → dist/src}/cron/cron.module.d.ts +0 -0
- /package/{src → dist/src}/cron/cron.module.js +0 -0
- /package/{src → dist/src}/cron/cron.service.d.ts +0 -0
- /package/{src → dist/src}/cron/cron.service.js +0 -0
- /package/{src → dist/src}/cron/cron.util.d.ts +0 -0
- /package/{src → dist/src}/cron/cron.util.js +0 -0
- /package/{src → dist/src}/cron/index.d.ts +0 -0
- /package/{src → dist/src}/cron/index.js +0 -0
- /package/{src → dist/src}/enums/humanDay.enum.d.ts +0 -0
- /package/{src → dist/src}/enums/humanDay.enum.js +0 -0
- /package/{src → dist/src}/enums/index.d.ts +0 -0
- /package/{src → dist/src}/enums/index.js +0 -0
- /package/{src → dist/src}/enums/serverDay.enum.d.ts +0 -0
- /package/{src → dist/src}/enums/serverDay.enum.js +0 -0
- /package/{src → dist/src}/guard/auth.guard.d.ts +0 -0
- /package/{src → dist/src}/guard/auth.guard.js +0 -0
- /package/{src → dist/src}/health/dtos/health.response.dto.d.ts +0 -0
- /package/{src → dist/src}/health/dtos/health.response.dto.js +0 -0
- /package/{src → dist/src}/health/dtos/index.d.ts +0 -0
- /package/{src → dist/src}/health/dtos/index.js +0 -0
- /package/{src → dist/src}/health/health.controller.d.ts +0 -0
- /package/{src → dist/src}/health/health.controller.js +0 -0
- /package/{src → dist/src}/health/health.module.d.ts +0 -0
- /package/{src → dist/src}/health/health.module.js +0 -0
- /package/{src → dist/src}/health/health.service.d.ts +0 -0
- /package/{src → dist/src}/health/health.service.js +0 -0
- /package/{src → dist/src}/health/index.d.ts +0 -0
- /package/{src → dist/src}/health/index.js +0 -0
- /package/{src → dist/src}/middleware/index.d.ts +0 -0
- /package/{src → dist/src}/middleware/index.js +0 -0
- /package/{src → dist/src}/middleware/logger.middleware.d.ts +0 -0
- /package/{src → dist/src}/middleware/logger.middleware.js +0 -0
- /package/{src → dist/src}/prisma/index.d.ts +0 -0
- /package/{src → dist/src}/prisma/index.js +0 -0
- /package/{src → dist/src}/prisma/prisma.module.d.ts +0 -0
- /package/{src → dist/src}/prisma/prisma.module.js +0 -0
- /package/{src → dist/src}/prisma/prisma.service.d.ts +0 -0
- /package/{src → dist/src}/prisma/prisma.service.js +0 -0
- /package/{src → dist/src}/push/index.d.ts +0 -0
- /package/{src → dist/src}/push/index.js +0 -0
- /package/{src → dist/src}/push/push.module.d.ts +0 -0
- /package/{src → dist/src}/push/push.module.js +0 -0
- /package/{src → dist/src}/push/push.service.d.ts +0 -0
- /package/{src → dist/src}/push/push.service.js +0 -0
- /package/{src → dist/src}/search/index.d.ts +0 -0
- /package/{src → dist/src}/search/index.js +0 -0
- /package/{src → dist/src}/search/search.module.d.ts +0 -0
- /package/{src → dist/src}/search/search.module.js +0 -0
- /package/{src → dist/src}/search/search.service.d.ts +0 -0
- /package/{src → dist/src}/search/search.service.js +0 -0
- /package/{src → dist/src}/services/index.d.ts +0 -0
- /package/{src → dist/src}/services/index.js +0 -0
- /package/{src → dist/src}/services/instrument-sentry.d.ts +0 -0
- /package/{src → dist/src}/services/instrument-sentry.js +0 -0
- /package/{src → dist/src}/types/req.type.d.ts +0 -0
- /package/{src → dist/src}/types/req.type.js +0 -0
- /package/{src → dist/src}/types/success.response.dto.d.ts +0 -0
- /package/{src → dist/src}/types/success.response.dto.js +0 -0
- /package/{src → dist/src}/utils/datetime.util.d.ts +0 -0
- /package/{src → dist/src}/utils/datetime.util.js +0 -0
- /package/{src → dist/src}/utils/error.util.d.ts +0 -0
- /package/{src → dist/src}/utils/error.util.js +0 -0
- /package/{src → dist/src}/utils/input.util.d.ts +0 -0
- /package/{src → dist/src}/utils/input.util.js +0 -0
- /package/{src → dist/src}/utils/noop.util.d.ts +0 -0
- /package/{src → dist/src}/utils/noop.util.js +0 -0
- /package/{src → dist/src}/utils/string.util.d.ts +0 -0
- /package/{src → dist/src}/utils/string.util.js +0 -0
- /package/{src → dist/src}/utils/version.util.d.ts +0 -0
- /package/{src → dist/src}/utils/version.util.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ability.factory.d.ts","sourceRoot":"","sources":["../../../src/ability/ability.factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,qBACa,cAAc;IACzB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,UAAU;CAWjD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbilityFactory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const ability_1 = require("@casl/ability");
|
|
7
|
+
const ability_util_1 = require("./ability.util");
|
|
8
|
+
let AbilityFactory = class AbilityFactory {
|
|
9
|
+
createForUser(permissions) {
|
|
10
|
+
const { can, build } = new ability_1.AbilityBuilder(ability_1.createMongoAbility);
|
|
11
|
+
const abilities = (0, ability_util_1.mapPermissionToAbility)(permissions);
|
|
12
|
+
abilities.forEach(({ action, subject }) => {
|
|
13
|
+
can(action, subject);
|
|
14
|
+
});
|
|
15
|
+
return build();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.AbilityFactory = AbilityFactory;
|
|
19
|
+
exports.AbilityFactory = AbilityFactory = tslib_1.__decorate([
|
|
20
|
+
(0, common_1.Injectable)()
|
|
21
|
+
], AbilityFactory);
|
|
22
|
+
//# sourceMappingURL=ability.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ability.factory.js","sourceRoot":"","sources":["../../../src/ability/ability.factory.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,2CAAmE;AAEnE,iDAAwD;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,aAAa,CAAC,WAAqB;QACjC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,wBAAc,CAAa,4BAAkB,CAAC,CAAC;QAE1E,MAAM,SAAS,GAAG,IAAA,qCAAsB,EAAC,WAAW,CAAC,CAAC;QAEtD,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YACxC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,EAAE,CAAC;IACjB,CAAC;CACF,CAAA;AAZY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAY1B","sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { AbilityBuilder, createMongoAbility } from '@casl/ability';\nimport { AppAbility } from './app-ability.type';\nimport { mapPermissionToAbility } from './ability.util';\n\n@Injectable()\nexport class AbilityFactory {\n createForUser(permissions: string[]): AppAbility {\n const { can, build } = new AbilityBuilder<AppAbility>(createMongoAbility);\n\n const abilities = mapPermissionToAbility(permissions);\n\n abilities.forEach(({ action, subject }) => {\n can(action, subject);\n });\n\n return build();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ability.module.d.ts","sourceRoot":"","sources":["../../../src/ability/ability.module.ts"],"names":[],"mappings":"AAGA,qBAIa,aAAa;CAAG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbilityModule = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const ability_factory_1 = require("./ability.factory");
|
|
7
|
+
let AbilityModule = class AbilityModule {
|
|
8
|
+
};
|
|
9
|
+
exports.AbilityModule = AbilityModule;
|
|
10
|
+
exports.AbilityModule = AbilityModule = tslib_1.__decorate([
|
|
11
|
+
(0, common_1.Module)({
|
|
12
|
+
providers: [ability_factory_1.AbilityFactory],
|
|
13
|
+
exports: [ability_factory_1.AbilityFactory],
|
|
14
|
+
})
|
|
15
|
+
], AbilityModule);
|
|
16
|
+
//# sourceMappingURL=ability.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ability.module.js","sourceRoot":"","sources":["../../../src/ability/ability.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,uDAAmD;AAM5C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAJzB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG","sourcesContent":["import { Module } from '@nestjs/common';\nimport { AbilityFactory } from './ability.factory';\n\n@Module({\n providers: [AbilityFactory],\n exports: [AbilityFactory],\n})\nexport class AbilityModule {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ability.util.d.ts","sourceRoot":"","sources":["../../../src/ability/ability.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,eAAO,MAAM,sBAAsB,GACjC,aAAa,MAAM,EAAE,KACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EA+BtC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapPermissionToAbility = void 0;
|
|
4
|
+
const action_enum_1 = require("./action.enum");
|
|
5
|
+
const mapPermissionToAbility = (permissions) => {
|
|
6
|
+
return permissions.map((permission) => {
|
|
7
|
+
const split = permission.split(':');
|
|
8
|
+
if (split.length !== 2) {
|
|
9
|
+
throw new Error(`Invalid permission format: ${permission}`);
|
|
10
|
+
}
|
|
11
|
+
const action = split[0];
|
|
12
|
+
const subject = split[1];
|
|
13
|
+
switch (action) {
|
|
14
|
+
case action_enum_1.ACTIONS.MANAGE:
|
|
15
|
+
return { action: action_enum_1.ACTIONS.MANAGE, subject };
|
|
16
|
+
case action_enum_1.ACTIONS.CREATE:
|
|
17
|
+
return { action: action_enum_1.ACTIONS.CREATE, subject };
|
|
18
|
+
case action_enum_1.ACTIONS.READ:
|
|
19
|
+
return { action: action_enum_1.ACTIONS.READ, subject };
|
|
20
|
+
case action_enum_1.ACTIONS.UPDATE:
|
|
21
|
+
return { action: action_enum_1.ACTIONS.UPDATE, subject };
|
|
22
|
+
case action_enum_1.ACTIONS.DELETE:
|
|
23
|
+
return { action: action_enum_1.ACTIONS.DELETE, subject };
|
|
24
|
+
default:
|
|
25
|
+
throw new Error(`Invalid permission: ${permission}`);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.mapPermissionToAbility = mapPermissionToAbility;
|
|
30
|
+
//# sourceMappingURL=ability.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ability.util.js","sourceRoot":"","sources":["../../../src/ability/ability.util.ts"],"names":[],"mappings":";;;AAAA,+CAAgD;AAGzC,MAAM,sBAAsB,GAAG,CACpC,WAAqB,EACmB,EAAE;IAC1C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAkB,EAAE,EAAE;QAC5C,MAAM,KAAK,GAAa,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,MAAM,GAAW,KAAK,CAAC,CAAC,CAAW,CAAC;QAC1C,MAAM,OAAO,GAAY,KAAK,CAAC,CAAC,CAAY,CAAC;QAE7C,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,qBAAO,CAAC,MAAM;gBACjB,OAAO,EAAE,MAAM,EAAE,qBAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAE7C,KAAK,qBAAO,CAAC,MAAM;gBACjB,OAAO,EAAE,MAAM,EAAE,qBAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAE7C,KAAK,qBAAO,CAAC,IAAI;gBACf,OAAO,EAAE,MAAM,EAAE,qBAAO,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;YAE3C,KAAK,qBAAO,CAAC,MAAM;gBACjB,OAAO,EAAE,MAAM,EAAE,qBAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAE7C,KAAK,qBAAO,CAAC,MAAM;gBACjB,OAAO,EAAE,MAAM,EAAE,qBAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAE7C;gBACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,UAAU,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAjCW,QAAA,sBAAsB,0BAiCjC","sourcesContent":["import { Action, ACTIONS } from './action.enum';\nimport { Subject } from './services.enum';\n\nexport const mapPermissionToAbility = (\n permissions: string[],\n): { action: Action; subject: Subject }[] => {\n return permissions.map((permission: string) => {\n const split: string[] = permission.split(':');\n\n if (split.length !== 2) {\n throw new Error(`Invalid permission format: ${permission}`);\n }\n\n const action: Action = split[0] as Action;\n const subject: Subject = split[1] as Subject;\n\n switch (action) {\n case ACTIONS.MANAGE:\n return { action: ACTIONS.MANAGE, subject };\n\n case ACTIONS.CREATE:\n return { action: ACTIONS.CREATE, subject };\n\n case ACTIONS.READ:\n return { action: ACTIONS.READ, subject };\n\n case ACTIONS.UPDATE:\n return { action: ACTIONS.UPDATE, subject };\n\n case ACTIONS.DELETE:\n return { action: ACTIONS.DELETE, subject };\n\n default:\n throw new Error(`Invalid permission: ${permission}`);\n }\n });\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const ACTIONS: {
|
|
2
|
+
readonly MANAGE: "manage";
|
|
3
|
+
readonly CREATE: "create";
|
|
4
|
+
readonly READ: "read";
|
|
5
|
+
readonly UPDATE: "update";
|
|
6
|
+
readonly DELETE: "delete";
|
|
7
|
+
};
|
|
8
|
+
export type Action = (typeof ACTIONS)[keyof typeof ACTIONS];
|
|
9
|
+
//# sourceMappingURL=action.enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.enum.d.ts","sourceRoot":"","sources":["../../../src/ability/action.enum.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;CAMV,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACTIONS = void 0;
|
|
4
|
+
exports.ACTIONS = {
|
|
5
|
+
MANAGE: 'manage',
|
|
6
|
+
CREATE: 'create',
|
|
7
|
+
READ: 'read',
|
|
8
|
+
UPDATE: 'update',
|
|
9
|
+
DELETE: 'delete',
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=action.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.enum.js","sourceRoot":"","sources":["../../../src/ability/action.enum.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG;IACrB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC","sourcesContent":["export const ACTIONS = {\n MANAGE: 'manage',\n CREATE: 'create',\n READ: 'read',\n UPDATE: 'update',\n DELETE: 'delete',\n} as const;\n\nexport type Action = (typeof ACTIONS)[keyof typeof ACTIONS];\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MongoAbility, InferSubjects } from '@casl/ability';
|
|
2
|
+
import { Subject } from './services.enum';
|
|
3
|
+
import { Action } from './action.enum';
|
|
4
|
+
type SubjectTypes = InferSubjects<Subject>;
|
|
5
|
+
export type AppAbility = MongoAbility<[Action, SubjectTypes]>;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=app-ability.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-ability.type.d.ts","sourceRoot":"","sources":["../../../src/ability/app-ability.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,KAAK,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;AAE3C,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-ability.type.js","sourceRoot":"","sources":["../../../src/ability/app-ability.type.ts"],"names":[],"mappings":"","sourcesContent":["import { MongoAbility, InferSubjects } from '@casl/ability';\nimport { Subject } from './services.enum';\nimport { Action } from './action.enum';\n\ntype SubjectTypes = InferSubjects<Subject>;\n\nexport type AppAbility = MongoAbility<[Action, SubjectTypes]>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ability/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./ability.factory"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./ability.module"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./action.enum"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./app-ability.type"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./services.enum"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./ability.util"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ability/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,2DAAiC;AACjC,wDAA8B;AAC9B,6DAAmC;AACnC,0DAAgC;AAChC,yDAA+B","sourcesContent":["export * from './ability.factory';\nexport * from './ability.module';\nexport * from './action.enum';\nexport * from './app-ability.type';\nexport * from './services.enum';\nexport * from './ability.util';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.enum.d.ts","sourceRoot":"","sources":["../../../src/ability/services.enum.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.enum.js","sourceRoot":"","sources":["../../../src/ability/services.enum.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACF,CAAC","sourcesContent":["export const SUBJECTS = {\n SUNG_JINWOO: 'sung-jinwoo',\n AUTH: 'auth',\n ALL: 'all',\n} as const;\n\nexport type Subject = (typeof SUBJECTS)[keyof typeof SUBJECTS];\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.module.d.ts","sourceRoot":"","sources":["../../../src/cron/cron.module.ts"],"names":[],"mappings":"AAIA,qBAIa,UAAU;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.module.js","sourceRoot":"","sources":["../../../src/cron/cron.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AAExC,iDAA6C;AAMtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IAJtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,CAAC,0BAAW,CAAC;KACzB,CAAC;GACW,UAAU,CAAG","sourcesContent":["import { Module } from '@nestjs/common';\n\nimport { CronService } from './cron.service';\n\n@Module({\n imports: [],\n providers: [CronService],\n})\nexport class CronModule {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.service.d.ts","sourceRoot":"","sources":["../../../src/cron/cron.service.ts"],"names":[],"mappings":"AAUA,qBACa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;;IAO/D,UAAU,IAAI,IAAI;CAGnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.service.js","sourceRoot":"","sources":["../../../src/cron/cron.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,+CAAwC;AACxC,2CAA4C;AAG5C,2CAAmD;AAEnD,MAAM,uBAAuB,GAC3B,IAAA,gCAAoB,EAAC,aAAa,CAAC,CAAC;AAG/B,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAGtB;QAFiB,WAAM,GAAW,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAEhD,CAAC;IAKhB,UAAU;QACR,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;AAXY,kCAAW;AAQtB;IAFC,IAAA,eAAI,EAAC,aAAa,CAAC;IACnB,IAAA,mBAAU,EAAC,YAAY,EAAE,uBAAuB,CAAC;;;;6CAGjD;sBAVU,WAAW;IADvB,IAAA,mBAAU,GAAE;;GACA,WAAW,CAWvB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport { Cron } from '@nestjs/schedule';\nimport { SentryCron } from '@sentry/nestjs';\nimport { MonitorConfig } from '@sentry/types';\n\nimport { getCronMonitorConfig } from './cron.util';\n\nconst handleTaskMonitorConfig: MonitorConfig =\n getCronMonitorConfig('0 0 * * * *');\n\n@Injectable()\nexport class CronService {\n private readonly logger: Logger = new Logger(CronService.name);\n\n constructor() {}\n\n // @Cron('45 * * * * *')\n @Cron('0 0 * * * *')\n @SentryCron('handleTask', handleTaskMonitorConfig)\n handleTask(): void {\n this.logger.debug('handleTask');\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.util.d.ts","sourceRoot":"","sources":["../../../src/cron/cron.util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,oBAAoB,GAAI,UAAU,MAAM,KAAG,aAOvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.util.js","sourceRoot":"","sources":["../../../src/cron/cron.util.ts"],"names":[],"mappings":";;;AAEO,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAiB,EAAE;IACtE,OAAO;QACL,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,QAAQ;SAChB;KACF,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B","sourcesContent":["import type { MonitorConfig } from '@sentry/types';\n\nexport const getCronMonitorConfig = (schedule: string): MonitorConfig => {\n return {\n schedule: {\n type: 'crontab',\n value: schedule,\n },\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cron/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cron/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B;AAC9B,yDAA+B;AAC/B,sDAA4B","sourcesContent":["export * from './cron.module';\nexport * from './cron.service';\nexport * from './cron.util';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorator/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./policies.decorator"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./policies.handler"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorator/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,6DAAmC","sourcesContent":["export * from './policies.decorator';\nexport * from './policies.handler';\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PolicyHandler } from '../types/policy.type';
|
|
2
|
+
export declare const CHECK_POLICIES_KEY = "check_policy";
|
|
3
|
+
export declare const CheckPolicies: (...handlers: PolicyHandler[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
4
|
+
//# sourceMappingURL=policies.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorator/policies.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,eAAO,MAAM,aAAa,GAAI,GAAG,UAAU,aAAa,EAAE,qDACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CheckPolicies = exports.CHECK_POLICIES_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.CHECK_POLICIES_KEY = 'check_policy';
|
|
6
|
+
const CheckPolicies = (...handlers) => (0, common_1.SetMetadata)(exports.CHECK_POLICIES_KEY, handlers);
|
|
7
|
+
exports.CheckPolicies = CheckPolicies;
|
|
8
|
+
//# sourceMappingURL=policies.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.decorator.js","sourceRoot":"","sources":["../../../src/decorator/policies.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAGhC,QAAA,kBAAkB,GAAG,cAAc,CAAC;AAE1C,MAAM,aAAa,GAAG,CAAC,GAAG,QAAyB,EAAE,EAAE,CAC5D,IAAA,oBAAW,EAAC,0BAAkB,EAAE,QAAQ,CAAC,CAAC;AAD/B,QAAA,aAAa,iBACkB","sourcesContent":["import { SetMetadata } from '@nestjs/common';\nimport { PolicyHandler } from '../types/policy.type';\n\nexport const CHECK_POLICIES_KEY = 'check_policy';\n\nexport const CheckPolicies = (...handlers: PolicyHandler[]) =>\n SetMetadata(CHECK_POLICIES_KEY, handlers);\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppAbility, Action, Subject } from '../ability';
|
|
2
|
+
import { IPolicyHandler } from '../types';
|
|
3
|
+
export declare class AuthPolicyHandler implements IPolicyHandler {
|
|
4
|
+
action: Action;
|
|
5
|
+
subject: Subject;
|
|
6
|
+
constructor(action: Action, subject: Subject);
|
|
7
|
+
handle(ability: AppAbility): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=policies.handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.handler.d.ts","sourceRoot":"","sources":["../../../src/decorator/policies.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,qBAAa,iBAAkB,YAAW,cAAc;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;gBAEL,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAK5C,MAAM,CAAC,OAAO,EAAE,UAAU;CAG3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthPolicyHandler = void 0;
|
|
4
|
+
class AuthPolicyHandler {
|
|
5
|
+
constructor(action, subject) {
|
|
6
|
+
this.action = action;
|
|
7
|
+
this.subject = subject;
|
|
8
|
+
}
|
|
9
|
+
handle(ability) {
|
|
10
|
+
return ability.can(this.action, this.subject);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AuthPolicyHandler = AuthPolicyHandler;
|
|
14
|
+
//# sourceMappingURL=policies.handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.handler.js","sourceRoot":"","sources":["../../../src/decorator/policies.handler.ts"],"names":[],"mappings":";;;AAGA,MAAa,iBAAiB;IAI5B,YAAY,MAAc,EAAE,OAAgB;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,OAAmB;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACF;AAZD,8CAYC","sourcesContent":["import { AppAbility, Action, Subject } from '../ability';\nimport { IPolicyHandler } from '../types';\n\nexport class AuthPolicyHandler implements IPolicyHandler {\n action: Action;\n subject: Subject;\n\n constructor(action: Action, subject: Subject) {\n this.action = action;\n this.subject = subject;\n }\n\n handle(ability: AppAbility) {\n return ability.can(this.action, this.subject);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"humanDay.enum.d.ts","sourceRoot":"","sources":["../../../src/enums/humanDay.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"humanDay.enum.js","sourceRoot":"","sources":["../../../src/enums/humanDay.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,gCAAmB,CAAA;IACnB,oCAAuB,CAAA;IACvB,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;AACnB,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB","sourcesContent":["export enum EHumanDay {\n MONDAY = 'Monday',\n TUESDAY = 'Tuesday',\n WEDNESDAY = 'Wednesday',\n THURSDAY = 'Thursday',\n FRIDAY = 'Friday',\n SATURDAY = 'Saturday',\n SUNDAY = 'Sunday',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/enums/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,2DAAiC","sourcesContent":["export * from './humanDay.enum';\nexport * from './serverDay.enum';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverDay.enum.d.ts","sourceRoot":"","sources":["../../../src/enums/serverDay.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,MAAM,IAAI;IACV,OAAO,IAAI;IACX,SAAS,IAAI;IACb,QAAQ,IAAI;IACZ,MAAM,IAAI;IACV,QAAQ,IAAI;IACZ,MAAM,IAAI;CACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverDay.enum.js","sourceRoot":"","sources":["../../../src/enums/serverDay.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,+CAAU,CAAA;IACV,iDAAW,CAAA;IACX,qDAAa,CAAA;IACb,mDAAY,CAAA;IACZ,+CAAU,CAAA;IACV,mDAAY,CAAA;IACZ,+CAAU,CAAA;AACZ,CAAC,EARW,UAAU,0BAAV,UAAU,QAQrB","sourcesContent":["export enum EServerDay {\n MONDAY = 0,\n TUESDAY = 1,\n WEDNESDAY = 2,\n THURSDAY = 3,\n FRIDAY = 4,\n SATURDAY = 5,\n SUNDAY = 6,\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.guard.d.ts","sourceRoot":"","sources":["../../../src/guard/auth.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,qBACa,SAAU,YAAW,WAAW;IAEzC,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,aAAa;gBADb,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa;IAGhC,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB9D,OAAO,CAAC,sBAAsB;CAI/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.guard.js","sourceRoot":"","sources":["../../../src/guard/auth.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAKwB;AACxB,qCAAyC;AAEzC,2CAA+C;AAGxC,IAAM,SAAS,GAAf,MAAM,SAAS;IACpB,YACU,UAAsB,EACtB,aAA4B;QAD5B,eAAU,GAAV,UAAU,CAAY;QACtB,kBAAa,GAAb,aAAa,CAAe;IACnC,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAyB;QACzC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,EAAE;gBACvD,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,YAAY,CAAC;aACrD,CAAC,CAAC;YAEH,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;QAC5B,CAAC;QAAC,WAAM,CAAC;YACP,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,sBAAsB,CAAC,OAAgB;;QAC7C,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,aAAa,0CAAE,KAAK,CAAC,GAAG,CAAC,mCAAI,EAAE,CAAC;QACtE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;CACF,CAAA;AA/BY,8BAAS;oBAAT,SAAS;IADrB,IAAA,mBAAU,GAAE;6CAGW,gBAAU;QACP,sBAAa;GAH3B,SAAS,CA+BrB","sourcesContent":["import {\n CanActivate,\n ExecutionContext,\n Injectable,\n UnauthorizedException,\n} from '@nestjs/common';\nimport { JwtService } from '@nestjs/jwt';\nimport { Request } from 'express';\nimport { ConfigService } from '@nestjs/config';\n\n@Injectable()\nexport class AuthGuard implements CanActivate {\n constructor(\n private jwtService: JwtService,\n private configService: ConfigService,\n ) {}\n\n async canActivate(context: ExecutionContext): Promise<boolean> {\n const request = context.switchToHttp().getRequest();\n const token = this.extractTokenFromHeader(request);\n\n if (!token) {\n throw new UnauthorizedException();\n }\n\n try {\n const payload = await this.jwtService.verifyAsync(token, {\n secret: this.configService.get<string>('JWT_SECRET'),\n });\n\n request['user'] = payload;\n } catch {\n throw new UnauthorizedException();\n }\n\n return true;\n }\n\n private extractTokenFromHeader(request: Request): string | undefined {\n const [type, token] = request.headers.authorization?.split(' ') ?? [];\n return type === 'Bearer' ? token : undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/guard/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/guard/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,2DAAiC","sourcesContent":["export * from './auth.guard';\nexport * from './policies.guard';\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { Reflector } from '@nestjs/core';
|
|
3
|
+
import { AbilityFactory } from '../ability';
|
|
4
|
+
export declare class PoliciesGuard implements CanActivate {
|
|
5
|
+
private reflector;
|
|
6
|
+
private abilityFactory;
|
|
7
|
+
constructor(reflector: Reflector, abilityFactory: AbilityFactory);
|
|
8
|
+
canActivate(context: ExecutionContext): boolean;
|
|
9
|
+
private execPolicyHandler;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=policies.guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.guard.d.ts","sourceRoot":"","sources":["../../../src/guard/policies.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,gBAAgB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAc,MAAM,YAAY,CAAC;AAKxD,qBACa,aAAc,YAAW,WAAW;IAE7C,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc;gBADd,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc;IAGxC,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAmC/C,OAAO,CAAC,iBAAiB;CAS1B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PoliciesGuard = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const core_1 = require("@nestjs/core");
|
|
7
|
+
const ability_1 = require("../ability");
|
|
8
|
+
const decorator_1 = require("../decorator");
|
|
9
|
+
let PoliciesGuard = class PoliciesGuard {
|
|
10
|
+
constructor(reflector, abilityFactory) {
|
|
11
|
+
this.reflector = reflector;
|
|
12
|
+
this.abilityFactory = abilityFactory;
|
|
13
|
+
}
|
|
14
|
+
canActivate(context) {
|
|
15
|
+
const policyHandlers = this.reflector.get(decorator_1.CHECK_POLICIES_KEY, context.getHandler()) || [];
|
|
16
|
+
const request = context.switchToHttp().getRequest();
|
|
17
|
+
if (!request.headers.permissions) {
|
|
18
|
+
throw new common_1.UnauthorizedException('No permissions provided');
|
|
19
|
+
}
|
|
20
|
+
if (!request.headers['user-id']) {
|
|
21
|
+
throw new common_1.UnauthorizedException('No user provided');
|
|
22
|
+
}
|
|
23
|
+
request['userId'] = request.headers['user-id'];
|
|
24
|
+
const userPermissions = JSON.parse(request.headers.permissions);
|
|
25
|
+
if (!Array.isArray(userPermissions)) {
|
|
26
|
+
throw new common_1.BadRequestException('Permissions must be an array of strings');
|
|
27
|
+
}
|
|
28
|
+
const ability = this.abilityFactory.createForUser(userPermissions);
|
|
29
|
+
return policyHandlers.every((handler) => this.execPolicyHandler(handler, ability));
|
|
30
|
+
}
|
|
31
|
+
execPolicyHandler(handler, ability) {
|
|
32
|
+
if (typeof handler === 'function') {
|
|
33
|
+
return handler(ability);
|
|
34
|
+
}
|
|
35
|
+
return handler.handle(ability);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.PoliciesGuard = PoliciesGuard;
|
|
39
|
+
exports.PoliciesGuard = PoliciesGuard = tslib_1.__decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
tslib_1.__metadata("design:paramtypes", [core_1.Reflector,
|
|
42
|
+
ability_1.AbilityFactory])
|
|
43
|
+
], PoliciesGuard);
|
|
44
|
+
//# sourceMappingURL=policies.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.guard.js","sourceRoot":"","sources":["../../../src/guard/policies.guard.ts"],"names":[],"mappings":";;;;AAAA,2CAMwB;AACxB,uCAAyC;AACzC,wCAAwD;AACxD,4CAAkD;AAK3C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YACU,SAAoB,EACpB,cAA8B;QAD9B,cAAS,GAAT,SAAS,CAAW;QACpB,mBAAc,GAAd,cAAc,CAAgB;IACrC,CAAC;IAEJ,WAAW,CAAC,OAAyB;QACnC,MAAM,cAAc,GAClB,IAAI,CAAC,SAAS,CAAC,GAAG,CAChB,8BAAkB,EAClB,OAAO,CAAC,UAAU,EAAE,CACrB,IAAI,EAAE,CAAC;QAEV,MAAM,OAAO,GACX,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAEtC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACjC,MAAM,IAAI,8BAAqB,CAAC,yBAAyB,CAAC,CAAC;QAC7D,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,8BAAqB,CAAC,kBAAkB,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE/C,MAAM,eAAe,GAAa,IAAI,CAAC,KAAK,CAC1C,OAAO,CAAC,OAAO,CAAC,WAAW,CAChB,CAAC;QAEd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,4BAAmB,CAAC,yCAAyC,CAAC,CAAC;QAC3E,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAEnE,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CACtC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CACzC,CAAC;IACJ,CAAC;IAEO,iBAAiB,CACvB,OAAsB,EACtB,OAAmB;QAEnB,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;CACF,CAAA;AAlDY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;6CAGU,gBAAS;QACJ,wBAAc;GAH7B,aAAa,CAkDzB","sourcesContent":["import {\n BadRequestException,\n CanActivate,\n ExecutionContext,\n Injectable,\n UnauthorizedException,\n} from '@nestjs/common';\nimport { Reflector } from '@nestjs/core';\nimport { AbilityFactory, AppAbility } from '../ability';\nimport { CHECK_POLICIES_KEY } from '../decorator';\nimport { Request, Headers } from 'node-fetch';\nimport { PolicyHandler } from '../types';\n\n@Injectable()\nexport class PoliciesGuard implements CanActivate {\n constructor(\n private reflector: Reflector,\n private abilityFactory: AbilityFactory,\n ) {}\n\n canActivate(context: ExecutionContext): boolean {\n const policyHandlers =\n this.reflector.get<PolicyHandler[]>(\n CHECK_POLICIES_KEY,\n context.getHandler(),\n ) || [];\n\n const request: Request & { headers: Headers & { permissions: string } } =\n context.switchToHttp().getRequest();\n\n if (!request.headers.permissions) {\n throw new UnauthorizedException('No permissions provided');\n }\n\n if (!request.headers['user-id']) {\n throw new UnauthorizedException('No user provided');\n }\n\n request['userId'] = request.headers['user-id'];\n\n const userPermissions: string[] = JSON.parse(\n request.headers.permissions,\n ) as string[];\n\n if (!Array.isArray(userPermissions)) {\n throw new BadRequestException('Permissions must be an array of strings');\n }\n\n const ability = this.abilityFactory.createForUser(userPermissions);\n\n return policyHandlers.every((handler) =>\n this.execPolicyHandler(handler, ability),\n );\n }\n\n private execPolicyHandler(\n handler: PolicyHandler,\n ability: AppAbility,\n ): boolean {\n if (typeof handler === 'function') {\n return handler(ability);\n }\n return handler.handle(ability);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.response.dto.d.ts","sourceRoot":"","sources":["../../../../src/health/dtos/health.response.dto.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,iBAAkB,YAAW,iBAAiB;IAEzD,MAAM,EAAE,iBAAiB,CAAC;IAG1B,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAG7B,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAG9B,OAAO,EAAE,qBAAqB,CAAC;IAI/B,WAAW,EAAE,MAAM,CAAC;IAIpB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.response.dto.js","sourceRoot":"","sources":["../../../../src/health/dtos/health.response.dto.ts"],"names":[],"mappings":";;;;AAAA,qDAA2C;AAC3C,6CAA8C;AAO9C,MAAa,iBAAiB;CAoB7B;AApBD,8CAoBC;AAlBC;IADC,IAAA,qBAAW,GAAE;;iDACY;AAG1B;IADC,IAAA,qBAAW,GAAE;;+CACe;AAG7B;IADC,IAAA,qBAAW,GAAE;;gDACgB;AAG9B;IADC,IAAA,qBAAW,GAAE;;kDACiB;AAI/B;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;sDACM;AAIpB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;kDACE","sourcesContent":["import { IsString } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\nimport type {\n HealthCheckResult,\n HealthCheckStatus,\n HealthIndicatorResult,\n} from '@nestjs/terminus';\n\nexport class HealthResponseDto implements HealthCheckResult {\n @ApiProperty()\n status: HealthCheckStatus;\n\n @ApiProperty()\n info?: HealthIndicatorResult;\n\n @ApiProperty()\n error?: HealthIndicatorResult;\n\n @ApiProperty()\n details: HealthIndicatorResult;\n\n @IsString()\n @ApiProperty()\n environment: string;\n\n @IsString()\n @ApiProperty()\n version: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/health/dtos/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/health/dtos/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC","sourcesContent":["export * from './health.response.dto';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.controller.d.ts","sourceRoot":"","sources":["../../../src/health/health.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,qBAEa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IASnD,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAGhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../../src/health/health.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAiD;AACjD,+CAA+C;AAC/C,6CAAuD;AAEvD,qDAAiD;AACjD,oEAA+D;AAIxD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IASvD,AAAN,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAbY,4CAAgB;AAUrB;IAPL,IAAA,YAAG,GAAE;IACL,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,uCAAiB;KACxB,CAAC;IACD,IAAA,sBAAW,GAAE;;;;mDAGb;2BAZU,gBAAgB;IAF5B,IAAA,iBAAO,EAAC,QAAQ,CAAC;IACjB,IAAA,mBAAU,EAAC,QAAQ,CAAC;6CAEyB,8BAAa;GAD9C,gBAAgB,CAa5B","sourcesContent":["import { Controller, Get } from '@nestjs/common';\nimport { HealthCheck } from '@nestjs/terminus';\nimport { ApiResponse, ApiTags } from '@nestjs/swagger';\n\nimport { HealthService } from './health.service';\nimport { HealthResponseDto } from './dtos/health.response.dto';\n\n@ApiTags('Health')\n@Controller('health')\nexport class HealthController {\n constructor(private readonly healthService: HealthService) {}\n\n @Get()\n @ApiResponse({\n status: 200,\n description: 'health check successful',\n type: HealthResponseDto,\n })\n @HealthCheck()\n async healthCheck(): Promise<HealthResponseDto> {\n return this.healthService.check();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.module.d.ts","sourceRoot":"","sources":["../../../src/health/health.module.ts"],"names":[],"mappings":"AAOA,qBAKa,YAAY;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.module.js","sourceRoot":"","sources":["../../../src/health/health.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,+CAAkD;AAClD,yCAA2C;AAE3C,2DAAuD;AACvD,qDAAiD;AAO1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,EAAC;QACN,WAAW,EAAE,CAAC,oCAAgB,CAAC;QAC/B,OAAO,EAAE,CAAC,yBAAc,EAAE,kBAAU,CAAC;QACrC,SAAS,EAAE,CAAC,8BAAa,CAAC;KAC3B,CAAC;GACW,YAAY,CAAG","sourcesContent":["import { Module } from '@nestjs/common';\nimport { TerminusModule } from '@nestjs/terminus';\nimport { HttpModule } from '@nestjs/axios';\n\nimport { HealthController } from './health.controller';\nimport { HealthService } from './health.service';\n\n@Module({\n controllers: [HealthController],\n imports: [TerminusModule, HttpModule],\n providers: [HealthService],\n})\nexport class HealthModule {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.service.d.ts","sourceRoot":"","sources":["../../../src/health/health.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAK3C,qBACa,aAAa;IAKtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;gBAG9C,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,qBAAqB;IAG1C,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAkB1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.service.js","sourceRoot":"","sources":["../../../src/health/health.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AACpD,+CAI0B;AAC1B,2CAA+C;AAG/C,oCAAsC;AAK/B,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAIxB,YACmB,aAA4B,EAC5B,MAA0B,EAC1B,MAA6B;QAF7B,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAAoB;QAC1B,WAAM,GAAN,MAAM,CAAuB;QAL/B,WAAM,GAAW,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAM9D,CAAC;IAEJ,KAAK,CAAC,KAAK;QAET,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEzB,MAAM,QAAQ,GAAsB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YAC1D,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;YAClE,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;SAClE,CAAC,CAAC;QAEH,MAAM,WAAW,GAAW,IAAI,CAAC,aAAa,CAAC,GAAG,CAAS,UAAU,CAAC,CAAC;QACvE,MAAM,OAAO,GAAW,IAAA,kBAAU,GAAE,CAAC;QAErC,uBACE,WAAW;YACX,OAAO,IACJ,QAAQ,EACX;IACJ,CAAC;CACF,CAAA;AA5BY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;6CAMuB,sBAAa;QACpB,6BAAkB;QAClB,gCAAqB;GAPrC,aAAa,CA4BzB","sourcesContent":["import { Injectable, Logger } from '@nestjs/common';\nimport {\n HealthCheckResult,\n HealthCheckService,\n MemoryHealthIndicator,\n} from '@nestjs/terminus';\nimport { ConfigService } from '@nestjs/config';\n\nimport { HealthResponseDto } from './dtos';\nimport { getVersion } from '../utils';\n\n// this decorator indicates to nest that this class can be provided to a module\n// we want to handle logic in services to keep our resolvers and controllers clean\n@Injectable()\nexport class HealthService {\n // grab the global logger instance\n private readonly logger: Logger = new Logger(HealthService.name);\n\n constructor(\n private readonly configService: ConfigService,\n private readonly health: HealthCheckService,\n private readonly memory: MemoryHealthIndicator,\n ) {}\n\n async check(): Promise<HealthResponseDto> {\n // this logger has several logging levels\n this.logger.log('check');\n\n const statuses: HealthCheckResult = await this.health.check([\n async () => this.memory.checkHeap('memoryHeap', 200 * 1024 * 1024),\n async () => this.memory.checkRSS('memoryRss', 3000 * 1024 * 1024),\n ]);\n\n const environment: string = this.configService.get<string>('NODE_ENV');\n const version: string = getVersion();\n\n return {\n environment,\n version,\n ...statuses,\n };\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/health/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/health/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,8DAAoC;AACpC,0DAAgC;AAChC,2DAAiC","sourcesContent":["export * from './dtos';\nexport * from './health.controller';\nexport * from './health.module';\nexport * from './health.service';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/middleware/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC","sourcesContent":["export * from './logger.middleware';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.middleware.d.ts","sourceRoot":"","sources":["../../../src/middleware/logger.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D,qBACa,gBAAiB,YAAW,cAAc;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE5D,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;CAe5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.middleware.js","sourceRoot":"","sources":["../../../src/middleware/logger.middleware.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoE;AAI7D,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAAtB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;IAiB9D,CAAC;IAfC,GAAG,CAAC,GAAY,EAAE,IAAc,EAAE,IAAkB;;QAClD,IACE,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,MAAK,MAAM;YACtB,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,MAAK,UAAU;aAC/B,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,0CAAE,aAAa,CAAA,EACxB,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,CAC7D,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;QACtD,CAAC;QAED,IAAI,EAAE,CAAC;IACT,CAAC;CACF,CAAA;AAlBY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;GACA,gBAAgB,CAkB5B","sourcesContent":["import { Injectable, Logger, NestMiddleware } from '@nestjs/common';\nimport { NextFunction, Request, Response } from 'express';\n\n@Injectable()\nexport class LoggerMiddleware implements NestMiddleware {\n private readonly logger = new Logger(LoggerMiddleware.name);\n\n use(req: Request, _res: Response, next: NextFunction): void {\n if (\n req?.method === 'POST' &&\n req?.originalUrl === '/graphql' &&\n req?.body?.operationName\n ) {\n this.logger.log(\n `${req.method} ${req.originalUrl} ${req.body.operationName}`,\n );\n } else {\n this.logger.log(`${req.method} ${req.originalUrl}`);\n }\n\n next();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prisma/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prisma/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,2DAAiC","sourcesContent":["export * from './prisma.module';\nexport * from './prisma.service';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.module.d.ts","sourceRoot":"","sources":["../../../src/prisma/prisma.module.ts"],"names":[],"mappings":"AAIA,qBAKa,YAAY;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.module.js","sourceRoot":"","sources":["../../../src/prisma/prisma.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AAExC,qDAAiD;AAO1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,CAAC,8BAAa,CAAC;QAC1B,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAAG","sourcesContent":["import { Module } from '@nestjs/common';\n\nimport { PrismaService } from './prisma.service';\n\n@Module({\n imports: [],\n providers: [PrismaService],\n exports: [PrismaService],\n})\nexport class PrismaModule {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.service.d.ts","sourceRoot":"","sources":["../../../src/prisma/prisma.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGhB,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAU,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEtD,qBACa,aAAc,SAAQ,YAAa,YAAW,YAAY;IACrE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;;IAcnD,YAAY;IAIZ,mBAAmB,CAAC,GAAG,EAAE,gBAAgB;CAKhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.service.js","sourceRoot":"","sources":["../../../src/prisma/prisma.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAKwB;AACxB,2CAAsD;AAG/C,IAAM,aAAa,qBAAnB,MAAM,aAAc,SAAQ,qBAAY;IAG7C;QACE,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;QAHrC,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;QAKvD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,eAAM,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;QAE1D,IAAI,CAAC,GAAG,CAAC,OAAgB,EAAE,CAAC,KAAwB,EAAE,EAAE;YACtD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,IAAI,KAAK,CAAC,QAAQ,OAAO,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CACxD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,GAAqB;QAC7C,IAAI,CAAC,GAAG,CAAC,YAAqB,EAAE,KAAK,IAAI,EAAE;YACzC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAxBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;;GACA,aAAa,CAwBzB","sourcesContent":["import {\n INestApplication,\n Injectable,\n Logger,\n OnModuleInit,\n} from '@nestjs/common';\nimport { Prisma, PrismaClient } from '@prisma/client';\n\n@Injectable()\nexport class PrismaService extends PrismaClient implements OnModuleInit {\n private readonly logger = new Logger(PrismaService.name);\n\n constructor() {\n super({ log: [{ emit: 'event', level: 'query' }] });\n\n this.logger.log(`Prisma v${Prisma.prismaVersion.client}`);\n\n this.$on('query' as never, (event: Prisma.QueryEvent) => {\n this.logger.debug(\n `[${event.duration}ms] ${event.query} ${event.params} `,\n );\n });\n }\n\n async onModuleInit() {\n await this.$connect();\n }\n\n async enableShutdownHooks(app: INestApplication) {\n this.$on('beforeExit' as never, async () => {\n await app.close();\n });\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/push/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|