coding-agent-benchmarks 0.5.0 → 0.5.1
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/README.md +7 -3
- package/dist/evaluator.d.ts +1 -0
- package/dist/evaluator.d.ts.map +1 -1
- package/dist/evaluator.js +1 -1
- package/dist/evaluator.js.map +1 -1
- package/dist/longest-common-subsequence.d.ts +45 -0
- package/dist/longest-common-subsequence.d.ts.map +1 -0
- package/dist/longest-common-subsequence.js +162 -0
- package/dist/longest-common-subsequence.js.map +1 -0
- package/dist/longestCommonSubsequence.d.ts +39 -0
- package/dist/longestCommonSubsequence.d.ts.map +1 -0
- package/dist/longestCommonSubsequence.js +166 -0
- package/dist/longestCommonSubsequence.js.map +1 -0
- package/dist/runner.js +8 -4
- package/dist/runner.js.map +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/user-registration/example.d.ts +2 -0
- package/dist/user-registration/example.d.ts.map +1 -0
- package/dist/user-registration/example.js +41 -0
- package/dist/user-registration/example.js.map +1 -0
- package/dist/user-registration/index.d.ts +9 -0
- package/dist/user-registration/index.d.ts.map +1 -0
- package/dist/user-registration/index.js +22 -0
- package/dist/user-registration/index.js.map +1 -0
- package/dist/user-registration/services/email-service.d.ts +13 -0
- package/dist/user-registration/services/email-service.d.ts.map +1 -0
- package/dist/user-registration/services/email-service.js +34 -0
- package/dist/user-registration/services/email-service.js.map +1 -0
- package/dist/user-registration/services/password-service.d.ts +5 -0
- package/dist/user-registration/services/password-service.d.ts.map +1 -0
- package/dist/user-registration/services/password-service.js +23 -0
- package/dist/user-registration/services/password-service.js.map +1 -0
- package/dist/user-registration/services/registration-service.d.ts +19 -0
- package/dist/user-registration/services/registration-service.d.ts.map +1 -0
- package/dist/user-registration/services/registration-service.js +60 -0
- package/dist/user-registration/services/registration-service.js.map +1 -0
- package/dist/user-registration/services/user-repository.d.ts +12 -0
- package/dist/user-registration/services/user-repository.d.ts.map +1 -0
- package/dist/user-registration/services/user-repository.js +24 -0
- package/dist/user-registration/services/user-repository.js.map +1 -0
- package/dist/user-registration/types.d.ts +26 -0
- package/dist/user-registration/types.d.ts.map +1 -0
- package/dist/user-registration/types.js +18 -0
- package/dist/user-registration/types.js.map +1 -0
- package/dist/user-registration/validators/email-validator.d.ts +3 -0
- package/dist/user-registration/validators/email-validator.d.ts.map +1 -0
- package/dist/user-registration/validators/email-validator.js +22 -0
- package/dist/user-registration/validators/email-validator.js.map +1 -0
- package/dist/user-registration/validators/password-validator.d.ts +3 -0
- package/dist/user-registration/validators/password-validator.d.ts.map +1 -0
- package/dist/user-registration/validators/password-validator.js +36 -0
- package/dist/user-registration/validators/password-validator.js.map +1 -0
- package/dist/user-registration/validators/required-fields-validator.d.ts +3 -0
- package/dist/user-registration/validators/required-fields-validator.d.ts.map +1 -0
- package/dist/user-registration/validators/required-fields-validator.js +17 -0
- package/dist/user-registration/validators/required-fields-validator.js.map +1 -0
- package/dist/utils/dataFetcher.d.ts +21 -0
- package/dist/utils/dataFetcher.d.ts.map +1 -0
- package/dist/utils/dataFetcher.js +71 -0
- package/dist/utils/dataFetcher.js.map +1 -0
- package/dist/utils/imageProcessor.d.ts +16 -0
- package/dist/utils/imageProcessor.d.ts.map +1 -0
- package/dist/utils/imageProcessor.js +121 -0
- package/dist/utils/imageProcessor.js.map +1 -0
- package/dist/utils/lcs.d.ts +37 -0
- package/dist/utils/lcs.d.ts.map +1 -0
- package/dist/utils/lcs.js +139 -0
- package/dist/utils/lcs.js.map +1 -0
- package/dist/utils/notifications.d.ts +2 -0
- package/dist/utils/notifications.d.ts.map +1 -0
- package/dist/utils/notifications.js +8 -0
- package/dist/utils/notifications.js.map +1 -0
- package/dist/utils/timeUtils.d.ts +16 -1
- package/dist/utils/timeUtils.d.ts.map +1 -1
- package/dist/utils/timeUtils.js +54 -17
- package/dist/utils/timeUtils.js.map +1 -1
- package/dist/utils/userReport.d.ts +10 -0
- package/dist/utils/userReport.d.ts.map +1 -0
- package/dist/utils/userReport.js +19 -0
- package/dist/utils/userReport.js.map +1 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -344,9 +344,13 @@ export interface BenchmarkConfig {
|
|
|
344
344
|
*/
|
|
345
345
|
defaultAdapter?: AdapterType;
|
|
346
346
|
/**
|
|
347
|
-
* Default
|
|
347
|
+
* Default model for the coding agent adapter
|
|
348
348
|
*/
|
|
349
349
|
defaultModel?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Default LLM model for judge validation (default: openai/gpt-5)
|
|
352
|
+
*/
|
|
353
|
+
defaultJudgeModel?: string;
|
|
350
354
|
/**
|
|
351
355
|
* Workspace root directory (auto-detected if not specified)
|
|
352
356
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,OAAO,GACP,SAAS,GACT,cAAc,GACd,aAAa,GACb,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC;;;OAGG;IACH,gBAAgB,CAAC,EA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OAEG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC;IAE7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../../src/user-registration/example.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("./index");
|
|
4
|
+
const createRegistrationService = () => {
|
|
5
|
+
const userRepository = new index_1.InMemoryUserRepository();
|
|
6
|
+
const passwordService = new index_1.PasswordService();
|
|
7
|
+
const emailService = new index_1.EmailService({
|
|
8
|
+
from: 'noreply@example.com',
|
|
9
|
+
subject: 'Welcome to Our Platform',
|
|
10
|
+
});
|
|
11
|
+
return new index_1.RegistrationService({
|
|
12
|
+
userRepository,
|
|
13
|
+
passwordService,
|
|
14
|
+
emailService,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const exampleUsage = async () => {
|
|
18
|
+
const registrationService = createRegistrationService();
|
|
19
|
+
const input = {
|
|
20
|
+
email: 'user@example.com',
|
|
21
|
+
password: 'SecurePass123!',
|
|
22
|
+
name: 'John Doe',
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
const user = await registrationService.register(input);
|
|
26
|
+
console.log('User registered successfully:', {
|
|
27
|
+
id: user.id,
|
|
28
|
+
email: user.email,
|
|
29
|
+
createdAt: user.createdAt,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof Error) {
|
|
34
|
+
console.error('Registration failed:', error.message);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (require.main === module) {
|
|
39
|
+
exampleUsage();
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","sourceRoot":"","sources":["../../src/user-registration/example.ts"],"names":[],"mappings":";;AAAA,mCAMiB;AAEjB,MAAM,yBAAyB,GAAG,GAAwB,EAAE;IAC1D,MAAM,cAAc,GAAG,IAAI,8BAAsB,EAAE,CAAC;IACpD,MAAM,eAAe,GAAG,IAAI,uBAAe,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAG,IAAI,oBAAY,CAAC;QACpC,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EAAE,yBAAyB;KACnC,CAAC,CAAC;IAEH,OAAO,IAAI,2BAAmB,CAAC;QAC7B,cAAc;QACd,eAAe;QACf,YAAY;KACb,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,IAAmB,EAAE;IAC7C,MAAM,mBAAmB,GAAG,yBAAyB,EAAE,CAAC;IAExD,MAAM,KAAK,GAA0B;QACnC,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,gBAAgB;QAC1B,IAAI,EAAE,UAAU;KACjB,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE;YAC3C,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { User, UserRegistrationInput, ValidationResult, RegistrationError, ERROR_CODES, } from './types';
|
|
2
|
+
export { validateEmail } from './validators/email-validator';
|
|
3
|
+
export { validatePassword } from './validators/password-validator';
|
|
4
|
+
export { validateRequiredFields } from './validators/required-fields-validator';
|
|
5
|
+
export { PasswordService } from './services/password-service';
|
|
6
|
+
export { EmailService, EmailServiceConfig } from './services/email-service';
|
|
7
|
+
export { UserRepository, InMemoryUserRepository, generateUserId, } from './services/user-repository';
|
|
8
|
+
export { RegistrationService, RegistrationServiceDependencies, } from './services/registration-service';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/user-registration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegistrationService = exports.generateUserId = exports.InMemoryUserRepository = exports.EmailService = exports.PasswordService = exports.validateRequiredFields = exports.validatePassword = exports.validateEmail = exports.ERROR_CODES = exports.RegistrationError = void 0;
|
|
4
|
+
var types_1 = require("./types");
|
|
5
|
+
Object.defineProperty(exports, "RegistrationError", { enumerable: true, get: function () { return types_1.RegistrationError; } });
|
|
6
|
+
Object.defineProperty(exports, "ERROR_CODES", { enumerable: true, get: function () { return types_1.ERROR_CODES; } });
|
|
7
|
+
var email_validator_1 = require("./validators/email-validator");
|
|
8
|
+
Object.defineProperty(exports, "validateEmail", { enumerable: true, get: function () { return email_validator_1.validateEmail; } });
|
|
9
|
+
var password_validator_1 = require("./validators/password-validator");
|
|
10
|
+
Object.defineProperty(exports, "validatePassword", { enumerable: true, get: function () { return password_validator_1.validatePassword; } });
|
|
11
|
+
var required_fields_validator_1 = require("./validators/required-fields-validator");
|
|
12
|
+
Object.defineProperty(exports, "validateRequiredFields", { enumerable: true, get: function () { return required_fields_validator_1.validateRequiredFields; } });
|
|
13
|
+
var password_service_1 = require("./services/password-service");
|
|
14
|
+
Object.defineProperty(exports, "PasswordService", { enumerable: true, get: function () { return password_service_1.PasswordService; } });
|
|
15
|
+
var email_service_1 = require("./services/email-service");
|
|
16
|
+
Object.defineProperty(exports, "EmailService", { enumerable: true, get: function () { return email_service_1.EmailService; } });
|
|
17
|
+
var user_repository_1 = require("./services/user-repository");
|
|
18
|
+
Object.defineProperty(exports, "InMemoryUserRepository", { enumerable: true, get: function () { return user_repository_1.InMemoryUserRepository; } });
|
|
19
|
+
Object.defineProperty(exports, "generateUserId", { enumerable: true, get: function () { return user_repository_1.generateUserId; } });
|
|
20
|
+
var registration_service_1 = require("./services/registration-service");
|
|
21
|
+
Object.defineProperty(exports, "RegistrationService", { enumerable: true, get: function () { return registration_service_1.RegistrationService; } });
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/user-registration/index.ts"],"names":[],"mappings":";;;AAAA,iCAMiB;AAFf,0GAAA,iBAAiB,OAAA;AACjB,oGAAA,WAAW,OAAA;AAGb,gEAA6D;AAApD,gHAAA,aAAa,OAAA;AACtB,sEAAmE;AAA1D,sHAAA,gBAAgB,OAAA;AACzB,oFAAgF;AAAvE,mIAAA,sBAAsB,OAAA;AAE/B,gEAA8D;AAArD,mHAAA,eAAe,OAAA;AACxB,0DAA4E;AAAnE,6GAAA,YAAY,OAAA;AACrB,8DAIoC;AAFlC,yHAAA,sBAAsB,OAAA;AACtB,iHAAA,cAAc,OAAA;AAEhB,wEAGyC;AAFvC,2HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { User } from '../types';
|
|
2
|
+
export interface EmailServiceConfig {
|
|
3
|
+
readonly from: string;
|
|
4
|
+
readonly subject: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class EmailService {
|
|
7
|
+
private readonly config;
|
|
8
|
+
constructor(config: EmailServiceConfig);
|
|
9
|
+
sendWelcomeEmail(user: User): Promise<void>;
|
|
10
|
+
private buildWelcomeEmail;
|
|
11
|
+
private sendEmail;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=email-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-service.d.ts","sourceRoot":"","sources":["../../../src/user-registration/services/email-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,kBAAkB;IAEjD,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,OAAO,CAAC,iBAAiB;YAcX,SAAS;CAQxB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailService = void 0;
|
|
4
|
+
class EmailService {
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
}
|
|
8
|
+
async sendWelcomeEmail(user) {
|
|
9
|
+
const emailContent = this.buildWelcomeEmail(user);
|
|
10
|
+
await this.sendEmail(user.email, emailContent);
|
|
11
|
+
}
|
|
12
|
+
buildWelcomeEmail(user) {
|
|
13
|
+
return `
|
|
14
|
+
Welcome to our platform!
|
|
15
|
+
|
|
16
|
+
Thank you for registering with us. Your account has been successfully created.
|
|
17
|
+
|
|
18
|
+
Email: ${user.email}
|
|
19
|
+
Registration Date: ${user.createdAt.toISOString()}
|
|
20
|
+
|
|
21
|
+
Best regards,
|
|
22
|
+
The Team
|
|
23
|
+
`.trim();
|
|
24
|
+
}
|
|
25
|
+
async sendEmail(to, content) {
|
|
26
|
+
// In production, integrate with email service (SendGrid, AWS SES, etc.)
|
|
27
|
+
// For now, simulate email sending
|
|
28
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
29
|
+
console.log(`Email sent to ${to}:`);
|
|
30
|
+
console.log(content);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.EmailService = EmailService;
|
|
34
|
+
//# sourceMappingURL=email-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-service.js","sourceRoot":"","sources":["../../../src/user-registration/services/email-service.ts"],"names":[],"mappings":";;;AAOA,MAAa,YAAY;IACvB,YAA6B,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;IAAG,CAAC;IAE3D,KAAK,CAAC,gBAAgB,CAAC,IAAU;QAC/B,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAEO,iBAAiB,CAAC,IAAU;QAClC,OAAO;;;;;SAKF,IAAI,CAAC,KAAK;qBACE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;;;;KAI5C,CAAC,IAAI,EAAE,CAAC;IACX,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,EAAU,EAAE,OAAe;QACjD,wEAAwE;QACxE,kCAAkC;QAClC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAEzD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;CACF;AA9BD,oCA8BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-service.d.ts","sourceRoot":"","sources":["../../../src/user-registration/services/password-service.ts"],"names":[],"mappings":"AAOA,qBAAa,eAAe;IACpB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/C,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAMvE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordService = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const scryptAsync = (0, util_1.promisify)(crypto_1.scrypt);
|
|
7
|
+
const SALT_LENGTH = 16;
|
|
8
|
+
const KEY_LENGTH = 64;
|
|
9
|
+
class PasswordService {
|
|
10
|
+
async hashPassword(password) {
|
|
11
|
+
const salt = (0, crypto_1.randomBytes)(SALT_LENGTH).toString('hex');
|
|
12
|
+
const derivedKey = (await scryptAsync(password, salt, KEY_LENGTH));
|
|
13
|
+
return `${salt}:${derivedKey.toString('hex')}`;
|
|
14
|
+
}
|
|
15
|
+
async verifyPassword(password, hash) {
|
|
16
|
+
const [salt, key] = hash.split(':');
|
|
17
|
+
const keyBuffer = Buffer.from(key, 'hex');
|
|
18
|
+
const derivedKey = (await scryptAsync(password, salt, KEY_LENGTH));
|
|
19
|
+
return (0, crypto_1.timingSafeEqual)(keyBuffer, derivedKey);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.PasswordService = PasswordService;
|
|
23
|
+
//# sourceMappingURL=password-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-service.js","sourceRoot":"","sources":["../../../src/user-registration/services/password-service.ts"],"names":[],"mappings":";;;AAAA,mCAA8D;AAC9D,+BAAiC;AAEjC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAAC,eAAM,CAAC,CAAC;AACtC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAa,eAAe;IAC1B,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,CAAC,MAAM,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAW,CAAC;QAC7E,OAAO,GAAG,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAAgB,EAAE,IAAY;QACjD,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1C,MAAM,UAAU,GAAG,CAAC,MAAM,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAW,CAAC;QAC7E,OAAO,IAAA,wBAAe,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAChD,CAAC;CACF;AAbD,0CAaC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { User, UserRegistrationInput } from '../types';
|
|
2
|
+
import { PasswordService } from './password-service';
|
|
3
|
+
import { EmailService } from './email-service';
|
|
4
|
+
import { UserRepository } from './user-repository';
|
|
5
|
+
export interface RegistrationServiceDependencies {
|
|
6
|
+
readonly userRepository: UserRepository;
|
|
7
|
+
readonly passwordService: PasswordService;
|
|
8
|
+
readonly emailService: EmailService;
|
|
9
|
+
}
|
|
10
|
+
export declare class RegistrationService {
|
|
11
|
+
private readonly deps;
|
|
12
|
+
constructor(deps: RegistrationServiceDependencies);
|
|
13
|
+
register(input: UserRegistrationInput): Promise<User>;
|
|
14
|
+
private checkDuplicateEmail;
|
|
15
|
+
private hashPassword;
|
|
16
|
+
private saveUser;
|
|
17
|
+
private sendWelcomeEmail;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=registration-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration-service.d.ts","sourceRoot":"","sources":["../../../src/user-registration/services/registration-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAkC,MAAM,UAAU,CAAC;AAEvF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAEnE,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,+BAA+B;IAE5D,QAAQ,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;YAwB7C,mBAAmB;YAWnB,YAAY;YAIZ,QAAQ;YAkBR,gBAAgB;CAU/B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegistrationService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const required_fields_validator_1 = require("../validators/required-fields-validator");
|
|
6
|
+
const user_repository_1 = require("./user-repository");
|
|
7
|
+
class RegistrationService {
|
|
8
|
+
constructor(deps) {
|
|
9
|
+
this.deps = deps;
|
|
10
|
+
}
|
|
11
|
+
async register(input) {
|
|
12
|
+
const validationResult = (0, required_fields_validator_1.validateRequiredFields)(input);
|
|
13
|
+
if (!validationResult.isValid) {
|
|
14
|
+
throw new types_1.RegistrationError(`Validation failed: ${validationResult.errors.join(', ')}`, types_1.ERROR_CODES.VALIDATION_FAILED);
|
|
15
|
+
}
|
|
16
|
+
const existingUser = await this.checkDuplicateEmail(input.email);
|
|
17
|
+
if (existingUser) {
|
|
18
|
+
throw new types_1.RegistrationError('Email already registered', types_1.ERROR_CODES.DUPLICATE_EMAIL);
|
|
19
|
+
}
|
|
20
|
+
const passwordHash = await this.hashPassword(input.password);
|
|
21
|
+
const user = await this.saveUser(input.email, passwordHash);
|
|
22
|
+
await this.sendWelcomeEmail(user);
|
|
23
|
+
return user;
|
|
24
|
+
}
|
|
25
|
+
async checkDuplicateEmail(email) {
|
|
26
|
+
try {
|
|
27
|
+
return await this.deps.userRepository.findByEmail(email);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw new types_1.RegistrationError(`Database error while checking email: ${error}`, types_1.ERROR_CODES.DATABASE_ERROR);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async hashPassword(password) {
|
|
34
|
+
return await this.deps.passwordService.hashPassword(password);
|
|
35
|
+
}
|
|
36
|
+
async saveUser(email, passwordHash) {
|
|
37
|
+
const user = {
|
|
38
|
+
id: (0, user_repository_1.generateUserId)(),
|
|
39
|
+
email: email.toLowerCase(),
|
|
40
|
+
passwordHash,
|
|
41
|
+
createdAt: new Date(),
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
return await this.deps.userRepository.save(user);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw new types_1.RegistrationError(`Database error while saving user: ${error}`, types_1.ERROR_CODES.DATABASE_ERROR);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async sendWelcomeEmail(user) {
|
|
51
|
+
try {
|
|
52
|
+
await this.deps.emailService.sendWelcomeEmail(user);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw new types_1.RegistrationError(`Failed to send welcome email: ${error}`, types_1.ERROR_CODES.EMAIL_SEND_FAILED);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.RegistrationService = RegistrationService;
|
|
60
|
+
//# sourceMappingURL=registration-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration-service.js","sourceRoot":"","sources":["../../../src/user-registration/services/registration-service.ts"],"names":[],"mappings":";;;AAAA,oCAAuF;AACvF,uFAAiF;AAGjF,uDAAmE;AAQnE,MAAa,mBAAmB;IAC9B,YAA6B,IAAqC;QAAr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C,QAAQ,CAAC,CAAC;IAChE,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,YAAoB;QACxD,MAAM,IAAI,GAAS;YACjB,EAAE,EAAE,IAAA,gCAAc,GAAE;YACpB,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;YAC1B,YAAY;YACZ,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC;QAEF,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,yBAAiB,CACzB,qCAAqC,KAAK,EAAE,EAC5C,mBAAW,CAAC,cAAc,CAC3B,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,IAAU;QACvC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,yBAAiB,CACzB,iCAAiC,KAAK,EAAE,EACxC,mBAAW,CAAC,iBAAiB,CAC9B,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAtED,kDAsEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { User } from '../types';
|
|
2
|
+
export interface UserRepository {
|
|
3
|
+
findByEmail(email: string): Promise<User | null>;
|
|
4
|
+
save(user: User): Promise<User>;
|
|
5
|
+
}
|
|
6
|
+
export declare class InMemoryUserRepository implements UserRepository {
|
|
7
|
+
private users;
|
|
8
|
+
findByEmail(email: string): Promise<User | null>;
|
|
9
|
+
save(user: User): Promise<User>;
|
|
10
|
+
}
|
|
11
|
+
export declare const generateUserId: () => string;
|
|
12
|
+
//# sourceMappingURL=user-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-repository.d.ts","sourceRoot":"","sources":["../../../src/user-registration/services/user-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED,qBAAa,sBAAuB,YAAW,cAAc;IAC3D,OAAO,CAAC,KAAK,CAAgC;IAEvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAMhD,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAItC;AAED,eAAO,MAAM,cAAc,QAAO,MAEjC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateUserId = exports.InMemoryUserRepository = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
class InMemoryUserRepository {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.users = new Map();
|
|
8
|
+
}
|
|
9
|
+
async findByEmail(email) {
|
|
10
|
+
const normalizedEmail = email.toLowerCase();
|
|
11
|
+
const users = Array.from(this.users.values());
|
|
12
|
+
return users.find((u) => u.email.toLowerCase() === normalizedEmail) || null;
|
|
13
|
+
}
|
|
14
|
+
async save(user) {
|
|
15
|
+
this.users.set(user.id, user);
|
|
16
|
+
return user;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.InMemoryUserRepository = InMemoryUserRepository;
|
|
20
|
+
const generateUserId = () => {
|
|
21
|
+
return (0, crypto_1.randomBytes)(16).toString('hex');
|
|
22
|
+
};
|
|
23
|
+
exports.generateUserId = generateUserId;
|
|
24
|
+
//# sourceMappingURL=user-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-repository.js","sourceRoot":"","sources":["../../../src/user-registration/services/user-repository.ts"],"names":[],"mappings":";;;AACA,mCAAqC;AAOrC,MAAa,sBAAsB;IAAnC;QACU,UAAK,GAAsB,IAAI,GAAG,EAAE,CAAC;IAY/C,CAAC;IAVC,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,eAAe,CAAC,IAAI,IAAI,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAU;QACnB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAbD,wDAaC;AAEM,MAAM,cAAc,GAAG,GAAW,EAAE;IACzC,OAAO,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface User {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly email: string;
|
|
4
|
+
readonly passwordHash: string;
|
|
5
|
+
readonly createdAt: Date;
|
|
6
|
+
}
|
|
7
|
+
export interface UserRegistrationInput {
|
|
8
|
+
readonly email: string;
|
|
9
|
+
readonly password: string;
|
|
10
|
+
readonly name?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ValidationResult {
|
|
13
|
+
readonly isValid: boolean;
|
|
14
|
+
readonly errors: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare class RegistrationError extends Error {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
constructor(message: string, code: string);
|
|
19
|
+
}
|
|
20
|
+
export declare const ERROR_CODES: {
|
|
21
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
22
|
+
readonly DUPLICATE_EMAIL: "DUPLICATE_EMAIL";
|
|
23
|
+
readonly DATABASE_ERROR: "DATABASE_ERROR";
|
|
24
|
+
readonly EMAIL_SEND_FAILED: "EMAIL_SEND_FAILED";
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/user-registration/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,qBAAa,iBAAkB,SAAQ,KAAK;aACG,IAAI,EAAE,MAAM;gBAA7C,OAAO,EAAE,MAAM,EAAkB,IAAI,EAAE,MAAM;CAI1D;AAED,eAAO,MAAM,WAAW;;;;;CAKd,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERROR_CODES = exports.RegistrationError = void 0;
|
|
4
|
+
class RegistrationError extends Error {
|
|
5
|
+
constructor(message, code) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.name = 'RegistrationError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.RegistrationError = RegistrationError;
|
|
12
|
+
exports.ERROR_CODES = {
|
|
13
|
+
VALIDATION_FAILED: 'VALIDATION_FAILED',
|
|
14
|
+
DUPLICATE_EMAIL: 'DUPLICATE_EMAIL',
|
|
15
|
+
DATABASE_ERROR: 'DATABASE_ERROR',
|
|
16
|
+
EMAIL_SEND_FAILED: 'EMAIL_SEND_FAILED',
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/user-registration/types.ts"],"names":[],"mappings":";;;AAkBA,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe,EAAkB,IAAY;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD4B,SAAI,GAAJ,IAAI,CAAQ;QAEvD,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAEY,QAAA,WAAW,GAAG;IACzB,iBAAiB,EAAE,mBAAmB;IACtC,eAAe,EAAE,iBAAiB;IAClC,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;CAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-validator.d.ts","sourceRoot":"","sources":["../../../src/user-registration/validators/email-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI5C,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,gBAe7C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateEmail = void 0;
|
|
4
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
5
|
+
const validateEmail = (email) => {
|
|
6
|
+
const errors = [];
|
|
7
|
+
if (!email || email.trim() === '') {
|
|
8
|
+
errors.push('Email is required');
|
|
9
|
+
}
|
|
10
|
+
else if (!EMAIL_REGEX.test(email)) {
|
|
11
|
+
errors.push('Invalid email format');
|
|
12
|
+
}
|
|
13
|
+
else if (email.length > 255) {
|
|
14
|
+
errors.push('Email must be less than 255 characters');
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
isValid: errors.length === 0,
|
|
18
|
+
errors,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.validateEmail = validateEmail;
|
|
22
|
+
//# sourceMappingURL=email-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-validator.js","sourceRoot":"","sources":["../../../src/user-registration/validators/email-validator.ts"],"names":[],"mappings":";;;AAEA,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAE1C,MAAM,aAAa,GAAG,CAAC,KAAa,EAAoB,EAAE;IAC/D,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACnC,CAAC;SAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;SAAM,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,aAAa,iBAexB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-validator.d.ts","sourceRoot":"","sources":["../../../src/user-registration/validators/password-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,KAAG,gBAoCnD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validatePassword = void 0;
|
|
4
|
+
const MIN_PASSWORD_LENGTH = 8;
|
|
5
|
+
const MAX_PASSWORD_LENGTH = 128;
|
|
6
|
+
const validatePassword = (password) => {
|
|
7
|
+
const errors = [];
|
|
8
|
+
if (!password) {
|
|
9
|
+
errors.push('Password is required');
|
|
10
|
+
return { isValid: false, errors };
|
|
11
|
+
}
|
|
12
|
+
if (password.length < MIN_PASSWORD_LENGTH) {
|
|
13
|
+
errors.push(`Password must be at least ${MIN_PASSWORD_LENGTH} characters long`);
|
|
14
|
+
}
|
|
15
|
+
if (password.length > MAX_PASSWORD_LENGTH) {
|
|
16
|
+
errors.push(`Password must be less than ${MAX_PASSWORD_LENGTH} characters`);
|
|
17
|
+
}
|
|
18
|
+
if (!/[a-z]/.test(password)) {
|
|
19
|
+
errors.push('Password must contain at least one lowercase letter');
|
|
20
|
+
}
|
|
21
|
+
if (!/[A-Z]/.test(password)) {
|
|
22
|
+
errors.push('Password must contain at least one uppercase letter');
|
|
23
|
+
}
|
|
24
|
+
if (!/[0-9]/.test(password)) {
|
|
25
|
+
errors.push('Password must contain at least one number');
|
|
26
|
+
}
|
|
27
|
+
if (!/[^a-zA-Z0-9]/.test(password)) {
|
|
28
|
+
errors.push('Password must contain at least one special character');
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
isValid: errors.length === 0,
|
|
32
|
+
errors,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
exports.validatePassword = validatePassword;
|
|
36
|
+
//# sourceMappingURL=password-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-validator.js","sourceRoot":"","sources":["../../../src/user-registration/validators/password-validator.ts"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEzB,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAoB,EAAE;IACrE,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACpC,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,6BAA6B,mBAAmB,kBAAkB,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,8BAA8B,mBAAmB,aAAa,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,gBAAgB,oBAoC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"required-fields-validator.d.ts","sourceRoot":"","sources":["../../../src/user-registration/validators/required-fields-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAInE,eAAO,MAAM,sBAAsB,GAAI,OAAO,qBAAqB,KAAG,gBAYrE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRequiredFields = void 0;
|
|
4
|
+
const email_validator_1 = require("./email-validator");
|
|
5
|
+
const password_validator_1 = require("./password-validator");
|
|
6
|
+
const validateRequiredFields = (input) => {
|
|
7
|
+
const errors = [];
|
|
8
|
+
const emailValidation = (0, email_validator_1.validateEmail)(input.email);
|
|
9
|
+
const passwordValidation = (0, password_validator_1.validatePassword)(input.password);
|
|
10
|
+
errors.push(...emailValidation.errors, ...passwordValidation.errors);
|
|
11
|
+
return {
|
|
12
|
+
isValid: errors.length === 0,
|
|
13
|
+
errors,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.validateRequiredFields = validateRequiredFields;
|
|
17
|
+
//# sourceMappingURL=required-fields-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"required-fields-validator.js","sourceRoot":"","sources":["../../../src/user-registration/validators/required-fields-validator.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAClD,6DAAwD;AAEjD,MAAM,sBAAsB,GAAG,CAAC,KAA4B,EAAoB,EAAE;IACvF,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,MAAM,eAAe,GAAG,IAAA,+BAAa,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,kBAAkB,GAAG,IAAA,qCAAgB,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE5D,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAErE,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,sBAAsB,0BAYjC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface User {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
email: string;
|
|
5
|
+
username: string;
|
|
6
|
+
}
|
|
7
|
+
interface Post {
|
|
8
|
+
id: number;
|
|
9
|
+
userId: number;
|
|
10
|
+
title: string;
|
|
11
|
+
body: string;
|
|
12
|
+
}
|
|
13
|
+
interface EnrichedPost extends Post {
|
|
14
|
+
commentCount: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const fetchUserWithPosts: (userId: number, baseUrl?: string) => Promise<{
|
|
17
|
+
user: User;
|
|
18
|
+
posts: readonly EnrichedPost[];
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=dataFetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../src/utils/dataFetcher.ts"],"names":[],"mappings":"AAAA,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,IAAI;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,YAAa,SAAQ,IAAI;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB;AA0CD,eAAO,MAAM,kBAAkB,GAAU,QAAQ,MAAM,EAAE,UAAS,MAA+C,KAAG,OAAO,CAAC;IAC1H,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CAChC,CA8CA,CAAC"}
|