@solidstarters/solid-core 1.2.170 → 1.2.172
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/config/iam.config.d.ts +2 -0
- package/dist/config/iam.config.d.ts.map +1 -1
- package/dist/config/iam.config.js +2 -1
- package/dist/config/iam.config.js.map +1 -1
- package/dist/controllers/authentication.controller.d.ts.map +1 -1
- package/dist/controllers/authentication.controller.js +0 -8
- package/dist/controllers/authentication.controller.js.map +1 -1
- package/dist/controllers/email-template.controller.d.ts +1 -1
- package/dist/controllers/email-template.controller.d.ts.map +1 -1
- package/dist/controllers/email-template.controller.js +3 -6
- package/dist/controllers/email-template.controller.js.map +1 -1
- package/dist/controllers/google-authentication.controller.d.ts +3 -3
- package/dist/controllers/google-authentication.controller.d.ts.map +1 -1
- package/dist/controllers/google-authentication.controller.js +5 -8
- package/dist/controllers/google-authentication.controller.js.map +1 -1
- package/dist/controllers/media.controller.d.ts +1 -1
- package/dist/controllers/media.controller.d.ts.map +1 -1
- package/dist/controllers/media.controller.js +1 -5
- package/dist/controllers/media.controller.js.map +1 -1
- package/dist/controllers/model-metadata.controller.d.ts.map +1 -1
- package/dist/controllers/model-metadata.controller.js +0 -5
- package/dist/controllers/model-metadata.controller.js.map +1 -1
- package/dist/controllers/otp-authentication.controller.js +0 -3
- package/dist/controllers/otp-authentication.controller.js.map +1 -1
- package/dist/controllers/service.controller.d.ts +2 -2
- package/dist/controllers/service.controller.d.ts.map +1 -1
- package/dist/controllers/service.controller.js +3 -7
- package/dist/controllers/service.controller.js.map +1 -1
- package/dist/controllers/sms-template.controller.d.ts.map +1 -1
- package/dist/controllers/sms-template.controller.js +0 -3
- package/dist/controllers/sms-template.controller.js.map +1 -1
- package/dist/entities/user.entity.d.ts +3 -0
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +13 -1
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.d.ts +2 -1
- package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.js +3 -3
- package/dist/helpers/field-crud-managers/PasswordFieldCrudManager.js.map +1 -1
- package/dist/passport-strategies/local.strategy.js +1 -1
- package/dist/passport-strategies/local.strategy.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +43 -0
- package/dist/services/authentication.service.d.ts +2 -1
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +28 -5
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/bcrypt.service.d.ts +11 -1
- package/dist/services/bcrypt.service.d.ts.map +1 -1
- package/dist/services/bcrypt.service.js +35 -5
- package/dist/services/bcrypt.service.js.map +1 -1
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +2 -1
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/hashing.service.d.ts +4 -1
- package/dist/services/hashing.service.d.ts.map +1 -1
- package/dist/services/hashing.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +45 -62
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/audit.subscriber.d.ts.map +1 -1
- package/dist/subscribers/audit.subscriber.js +1 -1
- package/dist/subscribers/audit.subscriber.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/config/iam.config.ts +2 -1
- package/src/controllers/authentication.controller.ts +8 -10
- package/src/controllers/email-template.controller.ts +7 -10
- package/src/controllers/google-authentication.controller.ts +9 -10
- package/src/controllers/media.controller.ts +5 -6
- package/src/controllers/model-metadata.controller.ts +5 -6
- package/src/controllers/otp-authentication.controller.ts +3 -3
- package/src/controllers/service.controller.ts +8 -9
- package/src/controllers/sms-template.controller.ts +3 -4
- package/src/entities/user.entity.ts +9 -0
- package/src/helpers/field-crud-managers/PasswordFieldCrudManager.ts +4 -3
- package/src/passport-strategies/local.strategy.ts +1 -1
- package/src/seeders/seed-data/solid-core-metadata.json +43 -0
- package/src/services/authentication.service.ts +32 -3
- package/src/services/bcrypt.service.ts +45 -7
- package/src/services/crud.service.ts +2 -1
- package/src/services/hashing.service.ts +5 -2
- package/src/solid-core.module.ts +60 -62
- package/src/subscribers/audit.subscriber.ts +6 -1
|
@@ -20,6 +20,7 @@ export declare const iamConfig: (() => {
|
|
|
20
20
|
redirectURL: string;
|
|
21
21
|
};
|
|
22
22
|
iamAutoGeneratedPassword: string | boolean;
|
|
23
|
+
passwordPepper: string;
|
|
23
24
|
}) & import("@nestjs/config").ConfigFactoryKeyHost<{
|
|
24
25
|
passwordlessRegistration: boolean;
|
|
25
26
|
iamPasswordRegistrationEnabled: boolean;
|
|
@@ -42,6 +43,7 @@ export declare const iamConfig: (() => {
|
|
|
42
43
|
redirectURL: string;
|
|
43
44
|
};
|
|
44
45
|
iamAutoGeneratedPassword: string | boolean;
|
|
46
|
+
passwordPepper: string;
|
|
45
47
|
}>;
|
|
46
48
|
export declare const jwtConfig: (() => {
|
|
47
49
|
secret: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iam.config.d.ts","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"iam.config.d.ts","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBpB,CAAA;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;EAQpB,CAAC"}
|
|
@@ -24,7 +24,8 @@ exports.iamConfig = (0, config_1.registerAs)('iam', () => {
|
|
|
24
24
|
callbackURL: process.env.IAM_GOOGLE_OAUTH_CALLBACK_URL,
|
|
25
25
|
redirectURL: process.env.IAM_GOOGLE_OAUTH_REDIRECT_URL,
|
|
26
26
|
},
|
|
27
|
-
iamAutoGeneratedPassword: process.env.IAM_AUTOGENERATED_PASSWORD || true
|
|
27
|
+
iamAutoGeneratedPassword: process.env.IAM_AUTOGENERATED_PASSWORD || true,
|
|
28
|
+
passwordPepper: process.env.IAM_PASSWORD_PEPPER || '',
|
|
28
29
|
};
|
|
29
30
|
});
|
|
30
31
|
exports.jwtConfig = (0, config_1.registerAs)('jwt', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iam.config.js","sourceRoot":"","sources":["../../src/config/iam.config.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE/B,QAAA,SAAS,GAAG,IAAA,mBAAU,EAAC,KAAK,EAAE,GAAG,EAAE;IAC5C,OAAO;QACH,wBAAwB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,OAAO,CAAC,KAAK,MAAM;QAC5F,8BAA8B,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,MAAM,CAAC,KAAK,MAAM;QACpG,oCAAoC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACjJ,uBAAuB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,MAAM,CAAC,KAAK,MAAM;QACzF,0BAA0B,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,MAAM,CAAC,KAAK,MAAM;QAChG,2BAA2B,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAmC,IAAI,OAAO,CAAC,KAAK,MAAM;QACpG,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC;QACvD,qCAAqC,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6CAA6C,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AAc;QAClC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB;QAC5C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;QACxC,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,MAAM,EAAE,EAAE,CAAC;QAC5E,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,OAAO,EAAE,EAAE,CAAC;KAClF,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import { registerAs } from '@nestjs/config';\n\nexport const iamConfig = registerAs('iam', () => {\n return {\n passwordlessRegistration: (process.env.IAM_PASSWORD_LESS_REGISTRATION ?? 'false') === 'true',\n iamPasswordRegistrationEnabled: (process.env.IAM_PASSWORD_REGISTRATION_ENABLED ?? 'true') === 'true',\n passwordlessRegistrationValidateWhat: (process.env.IAM_PASSWORD_LESS_REGISTRATION_VALIDATE_WHAT ?? 'email').split(',').map((item) => item.trim()),\n allowPublicRegistration: (process.env.IAM_ALLOW_PUBLIC_REGISTRATION ?? 'true') === 'true',\n activateUserOnRegistration: (process.env.IAM_ACTIVATE_USER_ON_REGISTRATION ?? 'true') === 'true',\n autoLoginUserOnRegistration: (process.env.IAM_AUTO_LOGIN_USER_ON_REGISTRATION ?? 'false') === 'true',\n otpExpiry: parseInt(process.env.IAM_OTP_EXPIRY ?? '10'),\n forgotPasswordVerificationTokenExpiry: parseInt(process.env.IAM_FORGOT_PASSWORD_VERIFICATION_TOKEN_EXPIRY ?? '10'),\n defaultRole: process.env.IAM_DEFAULT_ROLE ?? 'Public',\n dummyOtp: process.env.IAM_OTP_DUMMY,\n forgotPasswordSendVerificationTokenOn: process.env.IAM_FORGOT_PASSWORD_SEND_VERIFICATION_TOKEN_ON ?? 'email',\n forceChangePasswordOnFirstLogin:true,\n PASSWORD_REGEX: process.env.PASSWORD_REGEX || '^$|^(?=.*[a-z])(?=.*[A-Z])(?=.*\\\\d)(?=.*[^\\\\da-zA-Z]).*$',\n PASSWORD_COMPLEXITY_DESC : process.env.PASSWORD_COMPLEXITY_DESC || 'Password must contain at least one uppercase, one lowercase, one number, and one special character.',\n googleOauth: {\n clientID: process.env.IAM_GOOGLE_OAUTH_CLIENT_ID,\n clientSecret: process.env.IAM_GOOGLE_OAUTH_CLIENT_SECRET,\n callbackURL: process.env.IAM_GOOGLE_OAUTH_CALLBACK_URL,\n redirectURL: process.env.IAM_GOOGLE_OAUTH_REDIRECT_URL,\n },\n iamAutoGeneratedPassword:process.env.IAM_AUTOGENERATED_PASSWORD || true,\n passwordPepper: process.env.IAM_PASSWORD_PEPPER || '', // Adding a pepper to the password hashing process for extra security\n };\n})\n\nexport const jwtConfig = registerAs('jwt', () => {\n return {\n secret: process.env.IAM_JWT_SECRET,\n audience: process.env.IAM_JWT_TOKEN_AUDIENCE,\n issuer: process.env.IAM_JWT_TOKEN_ISSUER,\n accessTokenTtl: parseInt(process.env.IAM_JWT_ACCESS_TOKEN_TTL ?? '3600', 10),\n refreshTokenTtl: parseInt(process.env.IAM_JWT_REFRESH_TOKEN_TTL ?? '86400', 10),\n };\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authentication.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAI3E,qBAIa,wBAAwB;IAGrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAFxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;gBAEvC,WAAW,EAAE,qBAAqB;IAK/D,MAAM,CAAS,SAAS,EAAE,SAAS;IAMnC,aAAa,CAAS,SAAS,EAAE,SAAS,EAAgB,UAAU,EAAE,cAAc;IAQ9E,MAAM,CACoB,QAAQ,EAAE,QAAQ,EACtC,SAAS,EAAE,SAAS;;;;;;;;;;;;IAqBhC,aAAa,CAAS,eAAe,EAAE,eAAe;;;;IAOtD,sBAAsB,CAAS,yBAAyB,EAAE,yBAAyB;;;;;;;;;;;IAOnF,qBAAqB,CAAS,wBAAwB,EAAE,wBAAwB;;;;;;;IAMhF,cAAc,CAAS,iBAAiB,EAAE,iBAAiB,EAAgB,UAAU,EAAE,cAAc;IAMrG,EAAE,CACgB,UAAU,EAAE,cAAc;;;;;;;;;;;IAQtC,MAAM;;;CAGf"}
|
|
@@ -17,7 +17,6 @@ exports.AuthenticationController = void 0;
|
|
|
17
17
|
const openapi = require("@nestjs/swagger");
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
19
|
const swagger_1 = require("@nestjs/swagger");
|
|
20
|
-
const throttler_1 = require("@nestjs/throttler");
|
|
21
20
|
const active_user_decorator_1 = require("../decorators/active-user.decorator");
|
|
22
21
|
const public_decorator_1 = require("../decorators/public.decorator");
|
|
23
22
|
const change_password_dto_1 = require("../dtos/change-password.dto");
|
|
@@ -63,7 +62,6 @@ let AuthenticationController = AuthenticationController_1 = class Authentication
|
|
|
63
62
|
exports.AuthenticationController = AuthenticationController;
|
|
64
63
|
__decorate([
|
|
65
64
|
(0, public_decorator_1.Public)(),
|
|
66
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: true, burst: true, sustained: true }),
|
|
67
65
|
(0, common_1.Post)('register'),
|
|
68
66
|
openapi.ApiResponse({ status: 201, type: require("../entities/user.entity").User }),
|
|
69
67
|
__param(0, (0, common_1.Body)()),
|
|
@@ -83,7 +81,6 @@ __decorate([
|
|
|
83
81
|
], AuthenticationController.prototype, "signUpPrivate", null);
|
|
84
82
|
__decorate([
|
|
85
83
|
(0, public_decorator_1.Public)(),
|
|
86
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: true, burst: true, sustained: true }),
|
|
87
84
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
88
85
|
(0, common_1.Post)('authenticate'),
|
|
89
86
|
openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
|
|
@@ -95,7 +92,6 @@ __decorate([
|
|
|
95
92
|
], AuthenticationController.prototype, "signIn", null);
|
|
96
93
|
__decorate([
|
|
97
94
|
(0, public_decorator_1.Public)(),
|
|
98
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: true, burst: true, sustained: true }),
|
|
99
95
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
100
96
|
(0, common_1.Post)('refresh-tokens'),
|
|
101
97
|
openapi.ApiResponse({ status: common_1.HttpStatus.OK }),
|
|
@@ -106,7 +102,6 @@ __decorate([
|
|
|
106
102
|
], AuthenticationController.prototype, "refreshTokens", null);
|
|
107
103
|
__decorate([
|
|
108
104
|
(0, public_decorator_1.Public)(),
|
|
109
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: true, burst: true, sustained: true }),
|
|
110
105
|
(0, common_1.Post)('initiate/forgot-password'),
|
|
111
106
|
openapi.ApiResponse({ status: 201 }),
|
|
112
107
|
__param(0, (0, common_1.Body)()),
|
|
@@ -116,7 +111,6 @@ __decorate([
|
|
|
116
111
|
], AuthenticationController.prototype, "initiateForgotPassword", null);
|
|
117
112
|
__decorate([
|
|
118
113
|
(0, public_decorator_1.Public)(),
|
|
119
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: true, burst: true, sustained: true }),
|
|
120
114
|
(0, common_1.Post)('confirm/forgot-password'),
|
|
121
115
|
openapi.ApiResponse({ status: 201 }),
|
|
122
116
|
__param(0, (0, common_1.Body)()),
|
|
@@ -155,8 +149,6 @@ __decorate([
|
|
|
155
149
|
exports.AuthenticationController = AuthenticationController = AuthenticationController_1 = __decorate([
|
|
156
150
|
(0, common_1.Controller)('iam'),
|
|
157
151
|
(0, swagger_1.ApiTags)("Iam"),
|
|
158
|
-
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
159
|
-
(0, throttler_1.SkipThrottle)({ login: true, short: true, burst: true, sustained: true }),
|
|
160
152
|
__metadata("design:paramtypes", [authentication_service_1.AuthenticationService])
|
|
161
153
|
], AuthenticationController);
|
|
162
154
|
//# sourceMappingURL=authentication.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAgG;AAChG,6CAAyD;AAEzD,+EAAiE;AACjE,qEAAwD;AACxD,qEAAgE;AAChE,qFAA+E;AAC/E,uFAAiF;AACjF,iEAA4D;AAC5D,qDAAgD;AAChD,qDAAgD;AAEhD,+EAA2E;AAQpE,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAGjC,YAA6B,WAAkC;QAAlC,gBAAW,GAAX,WAAW,CAAuB;QAF9C,WAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAED,CAAC;IAKpE,MAAM,CAAS,SAAoB;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC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AAd,mBAAU,CAAC,EAAE;;;;sDAGtB;mCAlFQ,wBAAwB;IAJpC,IAAA,mBAAU,EAAC,KAAK,CAAC;IACjB,IAAA,iBAAO,EAAC,KAAK,CAAC;qCAM+B,8CAAqB;GAHtD,wBAAwB,CAmFpC","sourcesContent":["import { Body, Controller, Get, HttpCode, HttpStatus, Logger, Post, Res } from '@nestjs/common';\nimport { ApiBearerAuth, ApiTags } from '@nestjs/swagger';\nimport { Response } from 'express';\nimport { ActiveUser } from \"../decorators/active-user.decorator\";\nimport { Public } from '../decorators/public.decorator';\nimport { ChangePasswordDto } from \"../dtos/change-password.dto\";\nimport { ConfirmForgotPasswordDto } from '../dtos/confirm-forgot-password.dto';\nimport { InitiateForgotPasswordDto } from '../dtos/initiate-forgot-password.dto';\nimport { RefreshTokenDto } from '../dtos/refresh-token.dto';\nimport { SignInDto } from '../dtos/sign-in.dto';\nimport { SignUpDto } from '../dtos/sign-up.dto';\nimport { ActiveUserData } from \"../interfaces/active-user-data.interface\";\nimport { AuthenticationService } from '../services/authentication.service';\n\n\n// @Auth(AuthType.None)\n@Controller('iam')\n@ApiTags(\"Iam\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({login: true, short: true, burst: true, sustained: true}) // disable all sets by default for this controller\nexport class AuthenticationController {\n private readonly logger = new Logger(AuthenticationController.name);\n\n constructor(private readonly authService: AuthenticationService) { }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('register')\n signUp(@Body() signUpDto: SignUpDto) {\n return this.authService.signUp(signUpDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('register-private')\n signUpPrivate(@Body() signUpDto: SignUpDto, @ActiveUser() activeUser: ActiveUserData) {\n return this.authService.signUp(signUpDto, activeUser);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @HttpCode(HttpStatus.OK) // by default @Post does 201, we wanted 200 - hence using @HttpCode(HttpStatus.OK)\n @Post('authenticate')\n async signIn(\n @Res({ passthrough: true }) response: Response,\n @Body() signInDto: SignInDto\n ) {\n // This means that we are passing the token back in plain text. \n // This is less secure. \n // console.log(\"signInDto in Signin Controller\", signInDto);\n\n return this.authService.signIn(signInDto);\n\n // This means we are setting the token as a http only cookie.\n // const accessToken = await this.authService.signIn(signInDto);\n // response.cookie('accessToken', accessToken, {\n // secure: true,\n // httpOnly: true,\n // sameSite: true,\n // });\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @HttpCode(HttpStatus.OK) // changed since the default is 201\n @Post('refresh-tokens')\n refreshTokens(@Body() refreshTokenDto: RefreshTokenDto) {\n return this.authService.refreshTokens(refreshTokenDto);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('initiate/forgot-password')\n initiateForgotPassword(@Body() initiateForgotPasswordDto: InitiateForgotPasswordDto) {\n return this.authService.initiateForgotPassword(initiateForgotPasswordDto);\n }\n\n @Public()\n // @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\n @Post('confirm/forgot-password')\n confirmForgotPassword(@Body() confirmForgotPasswordDto: ConfirmForgotPasswordDto) {\n return this.authService.confirmForgotPassword(confirmForgotPasswordDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('change-password')\n changePassword(@Body() changePasswordDto: ChangePasswordDto, @ActiveUser() activeUser: ActiveUserData) {\n return this.authService.changePassword(changePasswordDto, activeUser);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get('me')\n me(\n @ActiveUser() activeUser: ActiveUserData\n ) {\n return this.authService.me(activeUser);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('logout')\n @HttpCode(HttpStatus.OK)\n async logout() {\n return this.authService.logout();\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EmailTemplateService } from '../services/email-template.service';
|
|
2
1
|
import { CreateEmailTemplateDto } from '../dtos/create-email-template.dto';
|
|
3
2
|
import { UpdateEmailTemplateDto } from '../dtos/update-email-template.dto';
|
|
3
|
+
import { EmailTemplateService } from '../services/email-template.service';
|
|
4
4
|
export declare class EmailTemplateController {
|
|
5
5
|
private readonly service;
|
|
6
6
|
constructor(service: EmailTemplateService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-template.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/email-template.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"email-template.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/email-template.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAS1E,qBAIa,uBAAuB;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,oBAAoB;IAKxD,MAAM,CAAS,SAAS,EAAE,sBAAsB,EAAmB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAOpG,UAAU,CAAS,UAAU,EAAE,sBAAsB,EAAE,EAAmB,UAAU,GAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAO;IAOlH,MAAM,CAAc,EAAE,EAAE,MAAM,EAAU,SAAS,EAAE,sBAAsB,EAAmB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAgBvH,QAAQ,CAAU,KAAK,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;IAM5B,OAAO,CAAc,EAAE,EAAE,MAAM,EAAW,KAAK,EAAE,GAAG;IAKpD,UAAU,CAAS,GAAG,EAAE,MAAM,EAAE;IAMhC,MAAM,CAAc,EAAE,EAAE,MAAM;IAStC,uBAAuB,CAAwB,YAAY,EAAE,MAAM;CAuFpE"}
|
|
@@ -15,14 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.EmailTemplateController = void 0;
|
|
16
16
|
const openapi = require("@nestjs/swagger");
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
+
const platform_express_1 = require("@nestjs/platform-express");
|
|
18
19
|
const swagger_1 = require("@nestjs/swagger");
|
|
19
|
-
const
|
|
20
|
+
const public_decorator_1 = require("../decorators/public.decorator");
|
|
20
21
|
const create_email_template_dto_1 = require("../dtos/create-email-template.dto");
|
|
21
22
|
const update_email_template_dto_1 = require("../dtos/update-email-template.dto");
|
|
22
|
-
const
|
|
23
|
+
const email_template_service_1 = require("../services/email-template.service");
|
|
23
24
|
const Mailgen = require("mailgen");
|
|
24
|
-
const platform_express_1 = require("@nestjs/platform-express");
|
|
25
|
-
const throttler_1 = require("@nestjs/throttler");
|
|
26
25
|
let EmailTemplateController = class EmailTemplateController {
|
|
27
26
|
constructor(service) {
|
|
28
27
|
this.service = service;
|
|
@@ -208,8 +207,6 @@ __decorate([
|
|
|
208
207
|
exports.EmailTemplateController = EmailTemplateController = __decorate([
|
|
209
208
|
(0, common_1.Controller)('email-template'),
|
|
210
209
|
(0, swagger_1.ApiTags)("Common"),
|
|
211
|
-
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
212
|
-
(0, throttler_1.SkipThrottle)({ short: false, login: true, burst: true, sustained: true }),
|
|
213
210
|
__metadata("design:paramtypes", [email_template_service_1.EmailTemplateService])
|
|
214
211
|
], EmailTemplateController);
|
|
215
212
|
//# sourceMappingURL=email-template.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-template.controller.js","sourceRoot":"","sources":["../../src/controllers/email-template.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAkJ;AAClJ,6CAAmE;AAGnE,+EAA0E;AAC1E,iFAA2E;AAC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IAAA,eAAM,EAAC,KAAK,CAAC;;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;qDAExB;AAOH;IAHC,IAAA,yBAAM,GAAE;IACR,IAAA,YAAG,EAAC,gCAAgC,CAAC;IACrC,IAAA,eAAM,EAAC,cAAc,EAAE,WAAW,CAAC;;IACX,WAAA,IAAA,cAAK,EAAC,cAAc,CAAC,CAAA;;;;sEAqF7C;kCAnJU,uBAAuB;IAJnC,IAAA,mBAAU,EAAC,gBAAgB,CAAC;IAC5B,IAAA,iBAAO,EAAC,QAAQ,CAAC;IACjB,IAAA,kBAAS,EAAC,0BAAc,CAAC;IACzB,IAAA,wBAAY,EAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;qCAElC,6CAAoB;GAD/C,uBAAuB,CAqJnC","sourcesContent":["import { Body, Controller, Delete, Get, Header, Param, Patch, Post, Put, Query, UploadedFiles, UseGuards, UseInterceptors } from '@nestjs/common';\nimport { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { PaginationQueryDto } from 'src/dtos/pagination-query.dto';\nimport { Roles } from 'src/decorators/roles.decorator';\nimport { EmailTemplateService } from '../services/email-template.service';\nimport { CreateEmailTemplateDto } from '../dtos/create-email-template.dto';\nimport { UpdateEmailTemplateDto } from '../dtos/update-email-template.dto';\nimport { Public } from 'src/decorators/public.decorator';\n\n\n\n// TODO: esInterop not working somehow, defaulted to using the require syntax to import Mailgen. Figure a better way to do this. \n// import { Mailgen } from 'mailgen';\nimport Mailgen = require('mailgen');\nimport { AnyFilesInterceptor } from '@nestjs/platform-express';\nimport { ThrottlerGuard, SkipThrottle } from '@nestjs/throttler';\n\n\n@Controller('email-template')\n@ApiTags(\"Common\")\n@UseGuards(ThrottlerGuard)\n@SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only \nexport class EmailTemplateController {\n constructor(private readonly service: EmailTemplateService) { }\n\n @Public()\n @Post()\n @UseInterceptors(AnyFilesInterceptor())\n create(@Body() createDto: CreateEmailTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.create(createDto, files);\n }\n \n @Public()\n @Post('/bulk')\n @UseInterceptors(AnyFilesInterceptor())\n insertMany(@Body() createDtos: CreateEmailTemplateDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {\n return this.service.insertMany(createDtos, filesArray);\n }\n \n @Public()\n @Put(':id')\n @UseInterceptors(AnyFilesInterceptor())\n update(@Param('id') id: number, @Body() updateDto: UpdateEmailTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.update(id, updateDto, files);\n }\n \n @Public()\n @ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'limit', required: false, type: Number })\n @ApiQuery({ name: 'offset', required: false, type: Number })\n @ApiQuery({ name: 'fields', required: false, type: Array })\n @ApiQuery({ name: 'sort', required: false, type: Array })\n @ApiQuery({ name: 'groupBy', required: false, type: Array })\n @ApiQuery({ name: 'populate', required: false, type: Array })\n @ApiQuery({ name: 'populateMedia', required: false, type: Array })\n @ApiQuery({ name: 'filters', required: false, type: Array })\n @Get()\n async findMany(@Query() query: any) {\n return this.service.find(query);\n }\n \n @Public()\n @Get(':id')\n async findOne(@Param('id') id: string, @Query() query: any) {\n return this.service.findOne(+id, query);\n }\n \n @Delete('/bulk')\n async deleteMany(@Body() ids: number[]) {\n return this.service.deleteMany(ids);\n }\n \n @Public()\n @Delete(':id')\n async delete(@Param('id') id: number) {\n return this.service.delete(id);\n }\n // /api/email-templates/mailgen-template/otp-template\n // @ApiBearerAuth(\"jwt\")\n // @Roles('Admin')\n @Public()\n @Get('mailgen-template/:templateType')\n @Header('content-type', 'text/html')\n generateMailgenTemplate(@Param('templateType') templateType: string) {\n const appName = process.env.SOLID_APP_NAME;\n const appUrl = process.env.SOLID_APP_WEBSITE_URL;\n\n // Configure mailgen by setting a theme and your product info\n var mailGenerator = new Mailgen({\n theme: 'default',\n product: {\n // Appears in header & footer of e-mails\n name: appName,\n link: appUrl\n // Optional product logo\n // logo: 'https://mailgen.js/img/logo.png'\n }\n });\n\n let email = null;\n if (templateType === 'otp-on-register') {\n email = {\n body: {\n name: 'John Appleseed',\n intro: `Welcome to ${appName}! We\\'re very excited to have you on board.`,\n action: {\n instructions: `To get started with ${appName}, please verify your account using the below verification code.`,\n button: {\n color: '#22BC66', // Optional action button color\n text: `321455`,\n link: null\n }\n },\n outro: 'Need help, or have questions? Just reply to this email, we\\'d love to help.'\n }\n };\n }\n if (templateType === 'otp-on-login') {\n email = {\n body: {\n name: 'John Appleseed',\n intro: `Welcome to ${appName}!`,\n action: {\n instructions: `Login to ${appName}, using the below verification code.`,\n button: {\n color: '#22BC66', // Optional action button color\n text: `321455`,\n link: null\n }\n },\n outro: 'Need help, or have questions? Just reply to this email, we\\'d love to help.'\n }\n };\n }\n if (templateType === 'forgot-password') {\n email = {\n body: {\n name: 'John Appleseed',\n intro: `Welcome to ${appName}!`,\n action: {\n instructions: `Click on the below link to reset your password. Please note that this link will expire in 10 minutes.`,\n button: {\n color: '#22BC66', // Optional action button color\n text: `Reset Password`,\n link: `https://example.com`\n }\n },\n outro: 'Need help, or have questions? Just reply to this email, we\\'d love to help.'\n }\n };\n }\n\n // Generate an HTML email with the provided contents\n var emailBody = mailGenerator.generate(email);\n\n // Generate the plaintext version of the e-mail (for clients that do not support HTML)\n // var emailText = mailGenerator.generatePlaintext(email);\n\n // Optionally, preview the generated HTML e-mail by writing it to a local file\n // require('fs').writeFileSync('preview.html', emailBody, 'utf8');\n\n // `emailBody` now contains the HTML body,\n // and `emailText` contains the textual version.\n //\n // It's up to you to send the e-mail.\n // Check out nodemailer to accomplish this:\n // https://nodemailer.com/\n return emailBody;\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"email-template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AGK;IADL,IAAA,eAAM,EAAC,OAAO,CAAC;;IACE,WAAA,IAAA,aAAI,GAAE,CAAA;;;;yDAEvB;AAIK;IAFL,IAAA,yBAAM,GAAE;IACR,IAAA,eAAM,EAAC,KAAK,CAAC;;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;qDAExB;AAOH;IAHC,IAAA,yBAAM,GAAE;IACR,IAAA,YAAG,EAAC,gCAAgC,CAAC;IACrC,IAAA,eAAM,EAAC,cAAc,EAAE,WAAW,CAAC;;IACX,WAAA,IAAA,cAAK,EAAC,cAAc,CAAC,CAAA;;;;sEAqF7C;kCAnJU,uBAAuB;IAJnC,IAAA,mBAAU,EAAC,gBAAgB,CAAC;IAC5B,IAAA,iBAAO,EAAC,QAAQ,CAAC;qCAIsB,6CAAoB;GAD/C,uBAAuB,CAqJnC","sourcesContent":["import { Body, Controller, Delete, Get, Header, Param, Post, Put, Query, UploadedFiles, UseInterceptors } from '@nestjs/common';\nimport { AnyFilesInterceptor } from '@nestjs/platform-express';\nimport { ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { Public } from 'src/decorators/public.decorator';\nimport { CreateEmailTemplateDto } from '../dtos/create-email-template.dto';\nimport { UpdateEmailTemplateDto } from '../dtos/update-email-template.dto';\nimport { EmailTemplateService } from '../services/email-template.service';\n\n\n\n// TODO: esInterop not working somehow, defaulted to using the require syntax to import Mailgen. Figure a better way to do this. \n// import { Mailgen } from 'mailgen';\nimport Mailgen = require('mailgen');\n\n\n@Controller('email-template')\n@ApiTags(\"Common\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only \nexport class EmailTemplateController {\n constructor(private readonly service: EmailTemplateService) { }\n\n @Public()\n @Post()\n @UseInterceptors(AnyFilesInterceptor())\n create(@Body() createDto: CreateEmailTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.create(createDto, files);\n }\n \n @Public()\n @Post('/bulk')\n @UseInterceptors(AnyFilesInterceptor())\n insertMany(@Body() createDtos: CreateEmailTemplateDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {\n return this.service.insertMany(createDtos, filesArray);\n }\n \n @Public()\n @Put(':id')\n @UseInterceptors(AnyFilesInterceptor())\n update(@Param('id') id: number, @Body() updateDto: UpdateEmailTemplateDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.update(id, updateDto, files);\n }\n \n @Public()\n @ApiQuery({ name: 'showSoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'showOnlySoftDeleted', required: false, type: Boolean })\n @ApiQuery({ name: 'limit', required: false, type: Number })\n @ApiQuery({ name: 'offset', required: false, type: Number })\n @ApiQuery({ name: 'fields', required: false, type: Array })\n @ApiQuery({ name: 'sort', required: false, type: Array })\n @ApiQuery({ name: 'groupBy', required: false, type: Array })\n @ApiQuery({ name: 'populate', required: false, type: Array })\n @ApiQuery({ name: 'populateMedia', required: false, type: Array })\n @ApiQuery({ name: 'filters', required: false, type: Array })\n @Get()\n async findMany(@Query() query: any) {\n return this.service.find(query);\n }\n \n @Public()\n @Get(':id')\n async findOne(@Param('id') id: string, @Query() query: any) {\n return this.service.findOne(+id, query);\n }\n \n @Delete('/bulk')\n async deleteMany(@Body() ids: number[]) {\n return this.service.deleteMany(ids);\n }\n \n @Public()\n @Delete(':id')\n async delete(@Param('id') id: number) {\n return this.service.delete(id);\n }\n // /api/email-templates/mailgen-template/otp-template\n // @ApiBearerAuth(\"jwt\")\n // @Roles('Admin')\n @Public()\n @Get('mailgen-template/:templateType')\n @Header('content-type', 'text/html')\n generateMailgenTemplate(@Param('templateType') templateType: string) {\n const appName = process.env.SOLID_APP_NAME;\n const appUrl = process.env.SOLID_APP_WEBSITE_URL;\n\n // Configure mailgen by setting a theme and your product info\n var mailGenerator = new Mailgen({\n theme: 'default',\n product: {\n // Appears in header & footer of e-mails\n name: appName,\n link: appUrl\n // Optional product logo\n // logo: 'https://mailgen.js/img/logo.png'\n }\n });\n\n let email = null;\n if (templateType === 'otp-on-register') {\n email = {\n body: {\n name: 'John Appleseed',\n intro: `Welcome to ${appName}! We\\'re very excited to have you on board.`,\n action: {\n instructions: `To get started with ${appName}, please verify your account using the below verification code.`,\n button: {\n color: '#22BC66', // Optional action button color\n text: `321455`,\n link: null\n }\n },\n outro: 'Need help, or have questions? Just reply to this email, we\\'d love to help.'\n }\n };\n }\n if (templateType === 'otp-on-login') {\n email = {\n body: {\n name: 'John Appleseed',\n intro: `Welcome to ${appName}!`,\n action: {\n instructions: `Login to ${appName}, using the below verification code.`,\n button: {\n color: '#22BC66', // Optional action button color\n text: `321455`,\n link: null\n }\n },\n outro: 'Need help, or have questions? Just reply to this email, we\\'d love to help.'\n }\n };\n }\n if (templateType === 'forgot-password') {\n email = {\n body: {\n name: 'John Appleseed',\n intro: `Welcome to ${appName}!`,\n action: {\n instructions: `Click on the below link to reset your password. Please note that this link will expire in 10 minutes.`,\n button: {\n color: '#22BC66', // Optional action button color\n text: `Reset Password`,\n link: `https://example.com`\n }\n },\n outro: 'Need help, or have questions? Just reply to this email, we\\'d love to help.'\n }\n };\n }\n\n // Generate an HTML email with the provided contents\n var emailBody = mailGenerator.generate(email);\n\n // Generate the plaintext version of the e-mail (for clients that do not support HTML)\n // var emailText = mailGenerator.generatePlaintext(email);\n\n // Optionally, preview the generated HTML e-mail by writing it to a local file\n // require('fs').writeFileSync('preview.html', emailBody, 'utf8');\n\n // `emailBody` now contains the HTML body,\n // and `emailText` contains the textual version.\n //\n // It's up to you to send the e-mail.\n // Check out nodemailer to accomplish this:\n // https://nodemailer.com/\n return emailBody;\n }\n\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AuthenticationService } from '../services/authentication.service';
|
|
2
|
-
import { Request, Response } from 'express';
|
|
3
1
|
import { ConfigType } from '@nestjs/config';
|
|
4
|
-
import {
|
|
2
|
+
import { Request, Response } from 'express';
|
|
5
3
|
import { iamConfig } from '../config/iam.config';
|
|
4
|
+
import { AuthenticationService } from '../services/authentication.service';
|
|
5
|
+
import { UserService } from '../services/user.service';
|
|
6
6
|
export declare class GoogleAuthenticationController {
|
|
7
7
|
private iamConfiguration;
|
|
8
8
|
private readonly userService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-authentication.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/google-authentication.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"google-authentication.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/google-authentication.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,qBAKa,8BAA8B;IAEZ,OAAO,CAAC,gBAAgB;IAC/C,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAFG,gBAAgB,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,EAC5D,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,qBAAqB;IAMjD,OAAO;IAIb,OAAO,CAAC,qBAAqB;IAS7B,kBAAkB,CAAQ,GAAG,EAAE,OAAO,EAAS,GAAG,EAAE,QAAQ;IA0BtD,uBAAuB,CAAsB,UAAU,KAAA;IAkBvD,UAAU,CAAsB,UAAU,KAAA;;;;;;;;;;;CAInD"}
|
|
@@ -15,16 +15,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.GoogleAuthenticationController = void 0;
|
|
16
16
|
const openapi = require("@nestjs/swagger");
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
-
const
|
|
18
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
19
|
+
const google_oauth_helper_1 = require("../helpers/google-oauth.helper");
|
|
20
|
+
const iam_config_1 = require("../config/iam.config");
|
|
19
21
|
const auth_decorator_1 = require("../decorators/auth.decorator");
|
|
22
|
+
const public_decorator_1 = require("../decorators/public.decorator");
|
|
20
23
|
const auth_type_enum_1 = require("../enums/auth-type.enum");
|
|
21
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
22
24
|
const google_oauth_strategy_1 = require("../passport-strategies/google-oauth.strategy");
|
|
25
|
+
const authentication_service_1 = require("../services/authentication.service");
|
|
23
26
|
const user_service_1 = require("../services/user.service");
|
|
24
|
-
const public_decorator_1 = require("../decorators/public.decorator");
|
|
25
|
-
const iam_config_1 = require("../config/iam.config");
|
|
26
|
-
const google_oauth_helper_1 = require("../helpers/google-oauth.helper");
|
|
27
|
-
const throttler_1 = require("@nestjs/throttler");
|
|
28
27
|
let GoogleAuthenticationController = class GoogleAuthenticationController {
|
|
29
28
|
constructor(iamConfiguration, userService, authService) {
|
|
30
29
|
this.iamConfiguration = iamConfiguration;
|
|
@@ -99,8 +98,6 @@ exports.GoogleAuthenticationController = GoogleAuthenticationController = __deco
|
|
|
99
98
|
(0, auth_decorator_1.Auth)(auth_type_enum_1.AuthType.None),
|
|
100
99
|
(0, common_1.Controller)('iam/google'),
|
|
101
100
|
(0, swagger_1.ApiTags)("Iam"),
|
|
102
|
-
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
103
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: false, burst: true, sustained: true }),
|
|
104
101
|
__param(0, (0, common_1.Inject)(iam_config_1.iamConfig.KEY)),
|
|
105
102
|
__metadata("design:paramtypes", [void 0, user_service_1.UserService,
|
|
106
103
|
authentication_service_1.AuthenticationService])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/google-authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmH;
|
|
1
|
+
{"version":3,"file":"google-authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/google-authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmH;AAEnH,6CAAoD;AAEpD,wEAA0E;AAC1E,qDAAiD;AACjD,iEAAoD;AACpD,qEAAwD;AACxD,4DAAmD;AACnD,wFAAgF;AAChF,+EAA2E;AAC3E,2DAAuD;AAShD,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACvC,YACmC,gBAA8C,EAC5D,WAAwB,EACxB,WAAkC;QAFpB,qBAAgB,GAAhB,gBAAgB,CAA8B;QAC5D,gBAAW,GAAX,WAAW,CAAa;QACxB,gBAAW,GAAX,WAAW,CAAuB;IACnD,CAAC;IAKC,AAAN,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACjC,CAAC;IAEO,qBAAqB;QACzB,IAAI,CAAC,IAAA,6CAAuB,EAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,qCAA4B,CAAC,gCAAgC,CAAC,CAAC;QAC7E,CAAC;IACL,CAAC;IAKD,kBAAkB,CAAQ,GAAY,EAAS,GAAa;QACxD,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QAYtB,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,WAAW,eAAe,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC7G,CAAC;IAWK,AAAN,KAAK,CAAC,uBAAuB,CAAsB,UAAU;QACzD,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAEpE,OAAO,I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erErrorException, Query, Req, Res, UseGuards } from '@nestjs/common';\nimport { ConfigType } from '@nestjs/config';\nimport { ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { Request, Response } from 'express';\nimport { isGoogleOAuthConfigured } from 'src/helpers/google-oauth.helper';\nimport { iamConfig } from '../config/iam.config';\nimport { Auth } from '../decorators/auth.decorator';\nimport { Public } from '../decorators/public.decorator';\nimport { AuthType } from '../enums/auth-type.enum';\nimport { GoogleOauthGuard } from '../passport-strategies/google-oauth.strategy';\nimport { AuthenticationService } from '../services/authentication.service';\nimport { UserService } from '../services/user.service';\n\n\n\n@Auth(AuthType.None)\n@Controller('iam/google')\n@ApiTags(\"Iam\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ login: false, short: false, burst: true, sustained: true }) //Enable the login throttle only \nexport class GoogleAuthenticationController {\n constructor(\n @Inject(iamConfig.KEY) private iamConfiguration: ConfigType<typeof iamConfig>,\n private readonly userService: UserService,\n private readonly authService: AuthenticationService,\n ) { }\n\n @Public()\n @UseGuards(GoogleOauthGuard)\n @Get('connect')\n async connect() {\n this.validateConfiguration();\n }\n\n private validateConfiguration() {\n if (!isGoogleOAuthConfigured(this.iamConfiguration)) {\n throw new InternalServerErrorException('Google OAuth is not configured');\n }\n }\n\n @Public()\n @Get('connect/callback')\n @UseGuards(GoogleOauthGuard)\n googleAuthCallback(@Req() req: Request, @Res() res: Response) {\n this.validateConfiguration();\n const user = req.user;\n\n // console.log(`Found user: ${JSON.stringify(user)}`);\n // const token = await this.authService.signIn(req.user);\n // res.cookie('access_token', token, {\n // maxAge: 2592000000,\n // sameSite: true,\n // secure: false,\n // });\n // return req.user;\n // return res;\n\n return res.redirect(`${this.iamConfiguration.googleOauth.redirectURL}?accessCode=${user['accessCode']}`);\n }\n\n /**\n * This is just a dummy endpoint where we are passing in the accessCode, this will be configured in the .env as an environment variable and \n * will be passed the accessCode, using the accessCode the UI code on this page will mostly invoke the /iam/google/auth endpoint which will finally generate the JWT token.\n * \n * @param accessCode \n * @returns \n */\n @Public()\n @Get('dummy-redirect')\n async dummyGoogleAuthRedirect(@Query('accessCode') accessCode) {\n this.validateConfiguration();\n const user = await this.userService.findOneByAccessCode(accessCode);\n\n delete user['password'];\n\n return user;\n }\n\n /**\n * Use this endpoint to authenticate using an accessCode with Google.\n * \n * @param accessCode \n * @returns \n */\n @Public()\n @Get('authenticate')\n @ApiQuery({ name: 'accessCode', required: true, type: String })\n async googleAuth(@Query('accessCode') accessCode) {\n this.validateConfiguration();\n return this.authService.signInUsingGoogle(accessCode);\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MediaService } from 'src/services/media.service';
|
|
2
1
|
import { CreateMediaDto } from 'src/dtos/create-media.dto';
|
|
3
2
|
import { UpdateMediaDto } from 'src/dtos/update-media.dto';
|
|
3
|
+
import { MediaService } from 'src/services/media.service';
|
|
4
4
|
export declare class MediaController {
|
|
5
5
|
private readonly service;
|
|
6
6
|
constructor(service: MediaService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/media.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"media.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/media.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAO1D,qBAIa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,YAAY;IAKlD,MAAM,CAAS,SAAS,EAAE,cAAc,EAAmB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAO5F,UAAU,CAAS,UAAU,EAAE,cAAc,EAAE,EAAmB,UAAU,GAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAO;IAQ1G,MAAM,CAAc,EAAE,EAAE,MAAM,EAAU,SAAS,EAAE,cAAc,EAAmB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAOrH,aAAa,CAAc,EAAE,EAAE,MAAM,EAAU,SAAS,EAAE,cAAc,EAAmB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;IAS5H,MAAM,CAAkB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAU,SAAS,EAAE,cAAc;IAQtF,WAAW,CAAS,GAAG,EAAE,MAAM,EAAE;;;;IAMjC,OAAO,CAAc,EAAE,EAAE,MAAM;;;;IAe/B,QAAQ,CAAU,KAAK,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;IAM5B,OAAO,CAAc,EAAE,EAAE,MAAM,EAAW,KAAK,EAAE,GAAG;IAMpD,UAAU,CAAS,GAAG,EAAE,MAAM,EAAE;IAMhC,MAAM,CAAc,EAAE,EAAE,MAAM;CAKrC"}
|
|
@@ -18,10 +18,9 @@ const common_1 = require("@nestjs/common");
|
|
|
18
18
|
const platform_express_1 = require("@nestjs/platform-express");
|
|
19
19
|
const swagger_1 = require("@nestjs/swagger");
|
|
20
20
|
const public_decorator_1 = require("../decorators/public.decorator");
|
|
21
|
-
const media_service_1 = require("../services/media.service");
|
|
22
21
|
const create_media_dto_1 = require("../dtos/create-media.dto");
|
|
23
22
|
const update_media_dto_1 = require("../dtos/update-media.dto");
|
|
24
|
-
const
|
|
23
|
+
const media_service_1 = require("../services/media.service");
|
|
25
24
|
var ShowSoftDeleted;
|
|
26
25
|
(function (ShowSoftDeleted) {
|
|
27
26
|
ShowSoftDeleted["INCLUSIVE"] = "inclusive";
|
|
@@ -114,7 +113,6 @@ __decorate([
|
|
|
114
113
|
], MediaController.prototype, "partialUpdate", null);
|
|
115
114
|
__decorate([
|
|
116
115
|
(0, public_decorator_1.Public)(),
|
|
117
|
-
(0, throttler_1.SkipThrottle)({ short: false, login: true, burst: true, sustained: true }),
|
|
118
116
|
(0, swagger_1.ApiBearerAuth)("jwt"),
|
|
119
117
|
(0, common_1.Post)('/upload'),
|
|
120
118
|
(0, common_1.UseInterceptors)((0, platform_express_1.AnyFilesInterceptor)()),
|
|
@@ -192,8 +190,6 @@ __decorate([
|
|
|
192
190
|
exports.MediaController = MediaController = __decorate([
|
|
193
191
|
(0, swagger_1.ApiTags)('Solid Core'),
|
|
194
192
|
(0, common_1.Controller)('media'),
|
|
195
|
-
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
196
|
-
(0, throttler_1.SkipThrottle)({ short: true, login: true, burst: true, sustained: true }),
|
|
197
193
|
__metadata("design:paramtypes", [media_service_1.MediaService])
|
|
198
194
|
], MediaController);
|
|
199
195
|
//# sourceMappingURL=media.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.controller.js","sourceRoot":"","sources":["../../src/controllers/media.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"media.controller.js","sourceRoot":"","sources":["../../src/controllers/media.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA+H;AAC/H,+DAA+D;AAC/D,6CAAmE;AACnE,qEAAyD;AACzD,+DAA2D;AAC3D,+DAA2D;AAC3D,6DAA0D;AAE1D,IAAK,eAGJ;AAHD,WAAK,eAAe;IAClB,0CAAuB,CAAA;IACvB,0CAAuB,CAAA;AACzB,CAAC,EAHI,eAAe,KAAf,eAAe,QAGnB;AAMM,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,YAA6B,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;IAAG,CAAC;IAKtD,MAAM,CAAS,SAAyB,EAAmB,KAAiC;QAC1F,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,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,EAAE,CAAC;IAC3D,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC5D,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACjE,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC3D,IAAA,YAAG,GAAE;;IACU,WAAA,IAAA,cAAK,GAAE,CAAA;;;;+CAEtB;AAIK;IAFL,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,YAAG,EAAC,KAAK,CAAC;;IACI,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,cAAK,GAAE,CAAA;;;;8CAE9C;AAIK;IAFL,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,eAAM,EAAC,OAAO,CAAC;;IACE,WAAA,IAAA,aAAI,GAAE,CAAA;;;;iDAEvB;AAIK;IAFL,IAAA,uBAAa,EAAC,KAAK,CAAC;IACpB,IAAA,eAAM,EAAC,KAAK,CAAC;;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;6CAExB;0BAtFU,eAAe;IAJ3B,IAAA,iBAAO,EAAC,YAAY,CAAC;IACrB,IAAA,mBAAU,EAAC,OAAO,CAAC;qCAIoB,4BAAY;GADvC,eAAe,CAyF3B","sourcesContent":["import { Body, Controller, Delete, Get, Param, Patch, Post, Put, Query, UploadedFiles, UseInterceptors } from '@nestjs/common';\nimport { AnyFilesInterceptor } from \"@nestjs/platform-express\";\nimport { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { Public } from 'src/decorators/public.decorator';\nimport { CreateMediaDto } from 'src/dtos/create-media.dto';\nimport { UpdateMediaDto } from 'src/dtos/update-media.dto';\nimport { MediaService } from 'src/services/media.service';\n\nenum ShowSoftDeleted {\n INCLUSIVE = \"inclusive\",\n EXCLUSIVE = \"exclusive\",\n}\n\n@ApiTags('Solid Core')\n@Controller('media')\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ short: true, login: true, burst: true, sustained: true }) //Skip all\nexport class MediaController {\n constructor(private readonly service: MediaService) {}\n\n @ApiBearerAuth(\"jwt\")\n @Post()\n @UseInterceptors(AnyFilesInterceptor())\n create(@Body() createDto: CreateMediaDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.create(createDto, files);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post('/bulk')\n @UseInterceptors(AnyFilesInterceptor())\n insertMany(@Body() createDtos: CreateMediaDto[], @UploadedFiles() filesArray: Express.Multer.File[][] = []) {\n return this.service.insertMany(createDtos, filesArray);\n }\n\n\n @ApiBearerAuth(\"jwt\")\n @Put(':id')\n @UseInterceptors(AnyFilesInterceptor())\n update(@Param('id') id: number, @Body() updateDto: UpdateMediaDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.update(id, updateDto, files);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Patch(':id')\n @UseInterceptors(AnyFilesInterceptor())\n partialUpdate(@Param('id') id: number, @Body() updateDto: UpdateMediaDto, @UploadedFiles() files: Array<Express.Multer.File>) {\n return this.service.update(id, updateDto, files, true);\n }\n\n @Public()\n // @SkipThrottle({ short: false, login: true, burst: true, sustained: true }) //Enable the short throttle only\n @ApiBearerAuth(\"jwt\")\n @Post('/upload')\n @UseInterceptors(AnyFilesInterceptor())\n upload(@UploadedFiles() files: Array<Express.Multer.File>, @Body() createDto: CreateMediaDto, ) {\n // this.logger.log(`Creating a new model: ${JSON.stringify(createDto)}`);\n return this.service.upload(createDto, files);\n }\n\n\n @ApiBearerAuth(\"jwt\")\n @Post('/bulk-recover')\n async recoverMany(@Body() ids: number[]) {\n return this.service.recoverMany(ids);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get('/recover/:id')\n async recover(@Param('id') id: number) {\n return this.service.recover(id);\n }\n \n @ApiBearerAuth(\"jwt\")\n @ApiQuery({ name: 'showSoftDeleted', required: false, enum: ShowSoftDeleted })\n @ApiQuery({ name: 'limit', required: false, type: Number })\n @ApiQuery({ name: 'offset', required: false, type: Number })\n @ApiQuery({ name: 'fields', required: false, type: Array })\n @ApiQuery({ name: 'sort', required: false, type: Array }) \n @ApiQuery({ name: 'groupBy', required: false, type: Array })\n @ApiQuery({ name: 'populate', required: false, type: Array })\n @ApiQuery({ name: 'populateMedia', required: false, type: Array })\n @ApiQuery({ name: 'filters', required: false, type: Array })\n @Get()\n async findMany(@Query() query: any) { \n return this.service.find(query); \n }\n\n @ApiBearerAuth(\"jwt\")\n @Get(':id')\n async findOne(@Param('id') id: string, @Query() query: any) {\n return this.service.findOne(+id, query);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Delete('/bulk')\n async deleteMany(@Body() ids: number[]) {\n return this.service.deleteMany(ids);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Delete(':id')\n async delete(@Param('id') id: number) {\n return this.service.delete(id);\n }\n\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-metadata.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/model-metadata.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"model-metadata.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/model-metadata.controller.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,qBAIa,uBAAuB;IAI5B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAHzC,OAAO,CAAC,MAAM,CAAyC;gBAGlC,oBAAoB,EAAE,oBAAoB;IAazD,QAAQ,CACD,cAAc,EAAE,cAAc;;;;;;;;;;;IAQrC,cAAc;;;;;;;;;;;IAgBpB,OAAO,CAA4B,EAAE,EAAE,MAAM,EAAW,KAAK,EAAE,GAAG;IAMlE,MAAM,CAAS,SAAS,EAAE,sBAAsB;IAQhD,aAAa,CAAS,IAAI,EAAE,GAAG;;;;IAM/B,YAAY,CAA4B,EAAE,EAAE,MAAM;IAMlD,MAAM,CAAc,EAAE,EAAE,MAAM,EAAU,sBAAsB,EAAE,sBAAsB;IAMhF,UAAU,CAAS,GAAG,EAAE,MAAM,EAAE;IAMhC,MAAM,CAAc,EAAE,EAAE,MAAM;CAIvC"}
|
|
@@ -21,7 +21,6 @@ const basic_filters_dto_1 = require("../dtos/basic-filters.dto");
|
|
|
21
21
|
const create_model_metadata_dto_1 = require("../dtos/create-model-metadata.dto");
|
|
22
22
|
const update_model_metadata_dto_1 = require("../dtos/update-model-metadata.dto");
|
|
23
23
|
const model_metadata_service_1 = require("../services/model-metadata.service");
|
|
24
|
-
const throttler_1 = require("@nestjs/throttler");
|
|
25
24
|
let ModelMetadataController = class ModelMetadataController {
|
|
26
25
|
constructor(modelMetadataService) {
|
|
27
26
|
this.modelMetadataService = modelMetadataService;
|
|
@@ -85,7 +84,6 @@ __decorate([
|
|
|
85
84
|
], ModelMetadataController.prototype, "findMany", null);
|
|
86
85
|
__decorate([
|
|
87
86
|
(0, public_decorator_1.Public)(),
|
|
88
|
-
(0, throttler_1.SkipThrottle)({ burst: false, short: true, login: true, sustained: true }),
|
|
89
87
|
(0, common_1.Get)('public'),
|
|
90
88
|
openapi.ApiResponse({ status: 200 }),
|
|
91
89
|
__metadata("design:type", Function),
|
|
@@ -113,7 +111,6 @@ __decorate([
|
|
|
113
111
|
], ModelMetadataController.prototype, "create", null);
|
|
114
112
|
__decorate([
|
|
115
113
|
(0, public_decorator_1.Public)(),
|
|
116
|
-
(0, throttler_1.SkipThrottle)({ short: false, burst: true, login: true, sustained: true }),
|
|
117
114
|
(0, common_1.Post)('/update-user-key'),
|
|
118
115
|
openapi.ApiResponse({ status: 201 }),
|
|
119
116
|
__param(0, (0, common_1.Body)()),
|
|
@@ -161,8 +158,6 @@ __decorate([
|
|
|
161
158
|
exports.ModelMetadataController = ModelMetadataController = __decorate([
|
|
162
159
|
(0, common_1.Controller)('model-metadata'),
|
|
163
160
|
(0, swagger_1.ApiTags)("App Builder"),
|
|
164
|
-
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
165
|
-
(0, throttler_1.SkipThrottle)({ short: true, login: true, burst: true, sustained: true }),
|
|
166
161
|
__metadata("design:paramtypes", [model_metadata_service_1.ModelMetadataService])
|
|
167
162
|
], ModelMetadataController);
|
|
168
163
|
//# sourceMappingURL=model-metadata.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-metadata.controller.js","sourceRoot":"","sources":["../../src/controllers/model-metadata.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"model-metadata.controller.js","sourceRoot":"","sources":["../../src/controllers/model-metadata.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA8G;AAC9G,6CAAmE;AACnE,qEAAyD;AACzD,iEAA2D;AAC3D,iFAA2E;AAC3E,iFAA2E;AAC3E,+EAA0E;AAMnE,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAGhC,YACqB,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;QAHvD,WAAM,GA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uB,CAoFnC","sourcesContent":["import { Body, Controller, Delete, Get, Logger, Param, ParseIntPipe, Post, Put, Query } from '@nestjs/common';\nimport { ApiBearerAuth, ApiQuery, ApiTags } from '@nestjs/swagger';\nimport { Public } from 'src/decorators/public.decorator';\nimport { BasicFilterDto } from '../dtos/basic-filters.dto';\nimport { CreateModelMetadataDto } from '../dtos/create-model-metadata.dto';\nimport { UpdateModelMetaDataDto } from '../dtos/update-model-metadata.dto';\nimport { ModelMetadataService } from '../services/model-metadata.service';\n\n@Controller('model-metadata')\n@ApiTags(\"App Builder\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ short: true, login: true, burst: true, sustained: true }) //Skip all\nexport class ModelMetadataController {\n private logger = new Logger('ModelMetadataController');\n\n constructor(\n private readonly modelMetadataService: ModelMetadataService\n ) { }\n\n @ApiBearerAuth(\"jwt\")\n @ApiQuery({ name: 'limit', required: false, type: Number })\n @ApiQuery({ name: 'offset', required: false, type: Number })\n @ApiQuery({ name: 'fields', required: false, type: Array })\n @ApiQuery({ name: 'sort', required: false, type: Array })\n @ApiQuery({ name: 'groupBy', required: false, type: Array })\n @ApiQuery({ name: 'populate', required: false, type: Array })\n @ApiQuery({ name: 'populateMedia', required: false, type: Array })\n @ApiQuery({ name: 'filters', required: false, type: Array })\n @Get()\n async findMany(\n @Query() basicFilterDto: BasicFilterDto\n ) {\n return this.modelMetadataService.findMany(basicFilterDto);\n }\n\n @Public()\n // @SkipThrottle({ burst: false, short: true, login: true, sustained: true }) //Enable burst only\n @Get('public')\n async findManyPublic() {\n const basicFilterDto: BasicFilterDto = {\n fields: ['singularName'],\n limit: 10000,\n offset: 0,\n filters: [],\n groupBy: [],\n populate: [], \n populateMedia: [],\n sort: []\n }\n return this.modelMetadataService.findMany(basicFilterDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Get(':id')\n findOne(@Param('id', ParseIntPipe) id: number, @Query() query: any) {\n return this.modelMetadataService.findOne(id, query);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post()\n create(@Body() createDto: CreateModelMetadataDto) {\n // this.logger.log(`Creating a new model: ${JSON.stringify(createDto)}`);\n return this.modelMetadataService.create(createDto);\n }\n\n @Public()\n // @SkipThrottle({ short: false, burst: true, login: true, sustained: true }) //Enable short only\n @Post('/update-user-key')\n updateUserKey(@Body() data: any) {\n return this.modelMetadataService.updateUserKey(data);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Post(':id/generate-code')\n generateCode(@Param('id', ParseIntPipe) id: number) {\n return this.modelMetadataService.handleGenerateCode({ modelId: id });\n }\n\n @ApiBearerAuth(\"jwt\")\n @Put(':id')\n update(@Param('id') id: number, @Body() updateModelMetaDataDto: UpdateModelMetaDataDto) {\n return this.modelMetadataService.update(id, updateModelMetaDataDto);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Delete('/bulk')\n async deleteMany(@Body() ids: number[]) {\n return this.modelMetadataService.deleteMany(ids);\n }\n\n @ApiBearerAuth(\"jwt\")\n @Delete(':id')\n async delete(@Param('id') id: number) {\n return this.modelMetadataService.remove(id);\n }\n\n}\n"]}
|
|
@@ -23,7 +23,6 @@ const otp_sign_in_dto_1 = require("../dtos/otp-sign-in.dto");
|
|
|
23
23
|
const otp_sign_up_dto_1 = require("../dtos/otp-sign-up.dto");
|
|
24
24
|
const auth_type_enum_1 = require("../enums/auth-type.enum");
|
|
25
25
|
const authentication_service_1 = require("../services/authentication.service");
|
|
26
|
-
const throttler_1 = require("@nestjs/throttler");
|
|
27
26
|
let OTPAuthenticationController = class OTPAuthenticationController {
|
|
28
27
|
constructor(authService) {
|
|
29
28
|
this.authService = authService;
|
|
@@ -86,8 +85,6 @@ exports.OTPAuthenticationController = OTPAuthenticationController = __decorate([
|
|
|
86
85
|
(0, auth_decorator_1.Auth)(auth_type_enum_1.AuthType.None),
|
|
87
86
|
(0, common_1.Controller)('iam/otp'),
|
|
88
87
|
(0, swagger_1.ApiTags)("Iam"),
|
|
89
|
-
(0, common_1.UseGuards)(throttler_1.ThrottlerGuard),
|
|
90
|
-
(0, throttler_1.SkipThrottle)({ login: false, short: true, burst: true, sustained: true }),
|
|
91
88
|
__metadata("design:paramtypes", [authentication_service_1.AuthenticationService])
|
|
92
89
|
], OTPAuthenticationController);
|
|
93
90
|
//# sourceMappingURL=otp-authentication.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/otp-authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,6CAA0C;AAE1C,iEAAoD;AACpD,qEAAwD;AACxD,qEAA+D;AAC/D,6DAAuD;AACvD,6DAAuD;AACvD,4DAAmD;AACnD,+EAA2E;
|
|
1
|
+
{"version":3,"file":"otp-authentication.controller.js","sourceRoot":"","sources":["../../src/controllers/otp-authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,6CAA0C;AAE1C,iEAAoD;AACpD,qEAAwD;AACxD,qEAA+D;AAC/D,6DAAuD;AACvD,6DAAuD;AACvD,4DAAmD;AACnD,+EAA2E;AASpE,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACpC,YAA6B,WAAkC;QAAlC,gBAAW,GAAX,WAAW,CAAuB;IAAI,CAAC;IAIpE,oBAAoB,CAAS,SAAuB;QAChD,OAAO,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC/D,CAAC;IAKK,AAAN,KAAK,CAAC,mBAAmB,CACO,QAAkB,EACtC,SAA2B;QAInC,OAAO,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;IAID,aAAa,CAAS,SAAuB;QACzC,OAAO,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;IAKK,AAAN,KAAK,CAAC,YAAY,CACc,QAAkB,EACtC,SAA2B;QAInC,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IASvD,CAAC;CAGJ,CAAA;AAhDY,kEAA2B;AAKpC;IAFC,IAAA,yBAAM,GAAE;IACR,IAAA,aAAI,EAAC,mBAAmB,CAAC;;IACJ,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAY,8BAAY;;uEAEnD;AAKK;IAHL,IAAA,yBAAM,GAAE;IACR,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,aAAI,EAAC,kBAAkB,CAAC;kCADf,mBAAU,CAAC,EAAE;IAGlB,WAAA,IAAA,YAAG,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAY,sCAAgB;;sEAKtC;AAID;IAFC,IAAA,yBAAM,GAAE;IACR,IAAA,aAAI,EAAC,gBAAgB,CAAC;;IACR,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAY,8BAAY;;gEAE5C;AAKK;IAHL,IAAA,yBAAM,GAAE;IACR,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,aAAI,EAAC,eAAe,CAAC;kCADZ,mBAAU,CAAC,EAAE;IAGlB,WAAA,IAAA,YAAG,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAY,sCAAgB;;+DAatC;sCA7CQ,2BAA2B;IALvC,IAAA,qBAAI,EAAC,yBAAQ,CAAC,IAAI,CAAC;IACnB,IAAA,mBAAU,EAAC,SAAS,CAAC;IACrB,IAAA,iBAAO,EAAC,KAAK,CAAC;qCAI+B,8CAAqB;GADtD,2BAA2B,CAgDvC","sourcesContent":["import { Body, Controller, HttpCode, HttpStatus, Post, Res, UseGuards } from '@nestjs/common';\nimport { ApiTags } from '@nestjs/swagger';\nimport { Response } from 'express';\nimport { Auth } from '../decorators/auth.decorator';\nimport { Public } from '../decorators/public.decorator';\nimport { OTPConfirmOTPDto } from '../dtos/otp-confirm-otp.dto';\nimport { OTPSignInDto } from '../dtos/otp-sign-in.dto';\nimport { OTPSignUpDto } from '../dtos/otp-sign-up.dto';\nimport { AuthType } from '../enums/auth-type.enum';\nimport { AuthenticationService } from '../services/authentication.service';\n// import { ThrottlerGuard, SkipThrottle } from '@nestjs/throttler';\n\n\n@Auth(AuthType.None)\n@Controller('iam/otp')\n@ApiTags(\"Iam\")\n// @UseGuards(ThrottlerGuard)\n// @SkipThrottle({ login: false, short: true, burst: true, sustained: true }) //Enable the login throttle only\nexport class OTPAuthenticationController {\n constructor(private readonly authService: AuthenticationService) { }\n\n @Public()\n @Post('register/initiate')\n initiateRegistration(@Body() signUpDto: OTPSignUpDto) {\n return this.authService.otpInitiateRegistration(signUpDto); //TODO finalize if 200 or 201 to be returned\n }\n\n @Public()\n @HttpCode(HttpStatus.OK) // by default @Post does 201, we wanted 200 - hence using @HttpCode(HttpStatus.OK)\n @Post('register/confirm')\n async confirmRegistration(\n @Res({ passthrough: true }) response: Response,\n @Body() signInDto: OTPConfirmOTPDto\n ) {\n // This means that we are passing the token back in plain text. \n // This is less secure. \n return this.authService.otpConfirmRegistration(signInDto);\n }\n\n @Public()\n @Post('login/initiate')\n initiateLogin(@Body() signInDto: OTPSignInDto) {\n return this.authService.otpInitiateLogin(signInDto);\n }\n\n @Public()\n @HttpCode(HttpStatus.OK) // by default @Post does 201, we wanted 200 - hence using @HttpCode(HttpStatus.OK)\n @Post('login/confirm')\n async confirmLogin(\n @Res({ passthrough: true }) response: Response,\n @Body() signInDto: OTPConfirmOTPDto\n ) {\n // This means that we are passing the token back in plain text. \n // This is less secure. \n return this.authService.otpConfirmLogin(signInDto);\n\n // This means we are setting the token as a http only cookie.\n // const accessToken = await this.authService.signIn(signInDto);\n // response.cookie('accessToken', accessToken, {\n // secure: true,\n // httpOnly: true,\n // sameSite: true,\n // });\n }\n\n\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ErrorMapperService } from 'src/helpers/error-mapper.service';
|
|
2
2
|
import { ActiveUserData } from 'src/interfaces/active-user-data.interface';
|
|
3
3
|
import { AiInteractionService } from 'src/services/ai-interaction.service';
|
|
4
4
|
import { MqMessageService } from 'src/services/mq-message.service';
|
|
5
|
-
import {
|
|
5
|
+
import { SolidRegistry } from '../helpers/solid-registry';
|
|
6
6
|
export declare class ServiceController {
|
|
7
7
|
private readonly solidRegistry;
|
|
8
8
|
private readonly aiInteractionService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/service.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/service.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,qBAIa,iBAAiB;IAItB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW;IANhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAGxC,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,kBAAkB;IAKpD,QAAQ;;;IAMF,WAAW,CAAe,UAAU,EAAE,cAAc;;;;;;;;IAyDpD,QAAQ,CAAS,QAAQ,EAAE,GAAG;;;CAiCvC"}
|