@zssz-soft/firebase-functions-shared 1.1.0

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.
Files changed (86) hide show
  1. package/README.md +391 -0
  2. package/lib/config/app.config.d.ts +106 -0
  3. package/lib/config/app.config.d.ts.map +1 -0
  4. package/lib/config/app.config.js +55 -0
  5. package/lib/config/app.config.js.map +1 -0
  6. package/lib/config/index.d.ts +2 -0
  7. package/lib/config/index.d.ts.map +1 -0
  8. package/lib/config/index.js +18 -0
  9. package/lib/config/index.js.map +1 -0
  10. package/lib/index.d.ts +13 -0
  11. package/lib/index.d.ts.map +1 -0
  12. package/lib/index.js +29 -0
  13. package/lib/index.js.map +1 -0
  14. package/lib/modules/bootstrap/bootstrap.d.ts +4 -0
  15. package/lib/modules/bootstrap/bootstrap.d.ts.map +1 -0
  16. package/lib/modules/bootstrap/bootstrap.js +162 -0
  17. package/lib/modules/bootstrap/bootstrap.js.map +1 -0
  18. package/lib/modules/bootstrap/bootstrap.models.d.ts +20 -0
  19. package/lib/modules/bootstrap/bootstrap.models.d.ts.map +1 -0
  20. package/lib/modules/bootstrap/bootstrap.models.js +3 -0
  21. package/lib/modules/bootstrap/bootstrap.models.js.map +1 -0
  22. package/lib/modules/bootstrap/index.d.ts +3 -0
  23. package/lib/modules/bootstrap/index.d.ts.map +1 -0
  24. package/lib/modules/bootstrap/index.js +19 -0
  25. package/lib/modules/bootstrap/index.js.map +1 -0
  26. package/lib/modules/email/email.d.ts +5 -0
  27. package/lib/modules/email/email.d.ts.map +1 -0
  28. package/lib/modules/email/email.js +105 -0
  29. package/lib/modules/email/email.js.map +1 -0
  30. package/lib/modules/email/email.models.d.ts +25 -0
  31. package/lib/modules/email/email.models.d.ts.map +1 -0
  32. package/lib/modules/email/email.models.js +3 -0
  33. package/lib/modules/email/email.models.js.map +1 -0
  34. package/lib/modules/email/email.service.d.ts +11 -0
  35. package/lib/modules/email/email.service.d.ts.map +1 -0
  36. package/lib/modules/email/email.service.js +227 -0
  37. package/lib/modules/email/email.service.js.map +1 -0
  38. package/lib/modules/email/email.validator.d.ts +2 -0
  39. package/lib/modules/email/email.validator.d.ts.map +1 -0
  40. package/lib/modules/email/email.validator.js +9 -0
  41. package/lib/modules/email/email.validator.js.map +1 -0
  42. package/lib/modules/email/index.d.ts +5 -0
  43. package/lib/modules/email/index.d.ts.map +1 -0
  44. package/lib/modules/email/index.js +21 -0
  45. package/lib/modules/email/index.js.map +1 -0
  46. package/lib/modules/security/effective-permissions.d.ts +28 -0
  47. package/lib/modules/security/effective-permissions.d.ts.map +1 -0
  48. package/lib/modules/security/effective-permissions.js +133 -0
  49. package/lib/modules/security/effective-permissions.js.map +1 -0
  50. package/lib/modules/security/effective-permissions.models.d.ts +96 -0
  51. package/lib/modules/security/effective-permissions.models.d.ts.map +1 -0
  52. package/lib/modules/security/effective-permissions.models.js +24 -0
  53. package/lib/modules/security/effective-permissions.models.js.map +1 -0
  54. package/lib/modules/security/effective-permissions.triggers.d.ts +83 -0
  55. package/lib/modules/security/effective-permissions.triggers.d.ts.map +1 -0
  56. package/lib/modules/security/effective-permissions.triggers.js +307 -0
  57. package/lib/modules/security/effective-permissions.triggers.js.map +1 -0
  58. package/lib/modules/security/index.d.ts +10 -0
  59. package/lib/modules/security/index.d.ts.map +1 -0
  60. package/lib/modules/security/index.js +28 -0
  61. package/lib/modules/security/index.js.map +1 -0
  62. package/lib/modules/storage/index.d.ts +2 -0
  63. package/lib/modules/storage/index.d.ts.map +1 -0
  64. package/lib/modules/storage/index.js +18 -0
  65. package/lib/modules/storage/index.js.map +1 -0
  66. package/lib/modules/storage/thumbnail-functions.d.ts +10 -0
  67. package/lib/modules/storage/thumbnail-functions.d.ts.map +1 -0
  68. package/lib/modules/storage/thumbnail-functions.js +482 -0
  69. package/lib/modules/storage/thumbnail-functions.js.map +1 -0
  70. package/lib/modules/user/index.d.ts +4 -0
  71. package/lib/modules/user/index.d.ts.map +1 -0
  72. package/lib/modules/user/index.js +20 -0
  73. package/lib/modules/user/index.js.map +1 -0
  74. package/lib/modules/user/user-management.d.ts +29 -0
  75. package/lib/modules/user/user-management.d.ts.map +1 -0
  76. package/lib/modules/user/user-management.js +134 -0
  77. package/lib/modules/user/user-management.js.map +1 -0
  78. package/lib/modules/user/user.d.ts +2 -0
  79. package/lib/modules/user/user.d.ts.map +1 -0
  80. package/lib/modules/user/user.js +15 -0
  81. package/lib/modules/user/user.js.map +1 -0
  82. package/lib/modules/user/user.models.d.ts +15 -0
  83. package/lib/modules/user/user.models.d.ts.map +1 -0
  84. package/lib/modules/user/user.models.js +6 -0
  85. package/lib/modules/user/user.models.js.map +1 -0
  86. package/package.json +72 -0
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkBootstrapStatus = exports.systemBootstrap = void 0;
4
+ const firestore_1 = require("firebase-admin/firestore");
5
+ const https_1 = require("firebase-functions/https");
6
+ const config_1 = require("../../config");
7
+ const user_1 = require("../user");
8
+ exports.systemBootstrap = (0, https_1.onCall)(async (request) => {
9
+ var _a;
10
+ try {
11
+ const config = (0, config_1.getConfig)();
12
+ const { adminEmail, adminDisplayName = 'Bootstrap Admin', adminPassword } = request.data;
13
+ if (!adminEmail) {
14
+ throw new https_1.HttpsError('invalid-argument', 'Admin email is required for system bootstrap');
15
+ }
16
+ const password = adminPassword && adminPassword.length >= 6 ? adminPassword : config.defaultAdminPassword;
17
+ const firestore = config.firestoreDatabaseId
18
+ ? (0, firestore_1.getFirestore)(config.firestoreDatabaseId)
19
+ : (0, firestore_1.getFirestore)();
20
+ const usersSnapshot = await firestore.collection(user_1.USER_FEATURE_KEY).limit(1).get();
21
+ if (!usersSnapshot.empty) {
22
+ return {
23
+ success: true,
24
+ message: 'System already has users - bootstrap not needed',
25
+ userCreated: false,
26
+ };
27
+ }
28
+ let userRecord;
29
+ try {
30
+ userRecord = await (0, user_1.createAuthUser)(adminEmail, adminDisplayName, password);
31
+ }
32
+ catch (error) {
33
+ if (((_a = error === null || error === void 0 ? void 0 : error.errorInfo) === null || _a === void 0 ? void 0 : _a.code) === 'auth/configuration-not-found') {
34
+ throw new https_1.HttpsError('failed-precondition', 'Firebase Authentication is not enabled for this project. Please enable it in the Firebase Console: https://console.firebase.google.com/project/pestcontrol-6f622/authentication');
35
+ }
36
+ throw error;
37
+ }
38
+ const bootstrapRoles = [
39
+ {
40
+ id: '66000',
41
+ editable: false,
42
+ name: 'ADMIN',
43
+ permissions: ['ADMIN', 'createThumbnail'],
44
+ meta: {
45
+ createdAt: new Date().toISOString(),
46
+ updatedAt: new Date().toISOString(),
47
+ createdBy: 'system-bootstrap',
48
+ updatedBy: 'system-bootstrap',
49
+ },
50
+ },
51
+ {
52
+ id: '66001',
53
+ editable: false,
54
+ name: 'USER',
55
+ permissions: ['USER'],
56
+ meta: {
57
+ createdAt: new Date().toISOString(),
58
+ updatedAt: new Date().toISOString(),
59
+ createdBy: 'system-bootstrap',
60
+ updatedBy: 'system-bootstrap',
61
+ },
62
+ },
63
+ ];
64
+ for (const role of bootstrapRoles) {
65
+ const roleRef = firestore.collection(user_1.ROLE_FEATURE_KEY).doc(role.id);
66
+ const roleDoc = await roleRef.get();
67
+ if (!roleDoc.exists) {
68
+ await roleRef.set(role);
69
+ }
70
+ }
71
+ const adminUserDoc = {
72
+ id: userRecord.uid,
73
+ email: adminEmail,
74
+ displayName: adminDisplayName,
75
+ firstName: 'Bootstrap',
76
+ lastName: 'Admin',
77
+ meta: {
78
+ createdAt: new Date(),
79
+ updatedAt: new Date(),
80
+ createdBy: 'system-bootstrap',
81
+ },
82
+ status: 'active',
83
+ roleIds: bootstrapRoles.map((role) => role.id),
84
+ };
85
+ await firestore.collection(user_1.USER_FEATURE_KEY).doc(userRecord.uid).set(adminUserDoc);
86
+ return {
87
+ success: true,
88
+ message: `Admin user created successfully. Login with email: ${adminEmail} and default password: AdminBootstrap2024!`,
89
+ userCreated: true,
90
+ userId: userRecord.uid,
91
+ };
92
+ }
93
+ catch (error) {
94
+ console.error('System bootstrap error:', error);
95
+ throw new https_1.HttpsError('internal', 'System bootstrap failed: ' + (error instanceof Error ? error.message : String(error)));
96
+ }
97
+ });
98
+ exports.checkBootstrapStatus = (0, https_1.onCall)(async () => {
99
+ var _a;
100
+ try {
101
+ const config = (0, config_1.getConfig)();
102
+ const firestore = config.firestoreDatabaseId
103
+ ? (0, firestore_1.getFirestore)(config.firestoreDatabaseId)
104
+ : (0, firestore_1.getFirestore)();
105
+ const usersSnapshot = await firestore.collection(user_1.USER_FEATURE_KEY).get();
106
+ const userCount = usersSnapshot.size;
107
+ const isBootstrapped = userCount > 0;
108
+ return {
109
+ success: true,
110
+ message: isBootstrapped
111
+ ? `System is bootstrapped with ${userCount} user(s)`
112
+ : 'System is not bootstrapped - no users found',
113
+ data: {
114
+ isBootstrapped,
115
+ userCount,
116
+ },
117
+ };
118
+ }
119
+ catch (error) {
120
+ console.error('Bootstrap status check error:', error);
121
+ // Handle database not found error specifically
122
+ if ((error === null || error === void 0 ? void 0 : error.code) === 5 || ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('NOT_FOUND'))) {
123
+ const config = (0, config_1.getConfig)();
124
+ throw new https_1.HttpsError('failed-precondition', `Firestore database "${config.firestoreDatabaseId || 'default'}" not found. Please check your database ID in the Firebase Console: https://console.firebase.google.com/project/${config.projectId}/firestore/databases`);
125
+ }
126
+ throw new https_1.HttpsError('internal', 'Failed to check bootstrap status: ' +
127
+ (error instanceof Error ? error.message : String(error)));
128
+ }
129
+ });
130
+ // Option 2: HTTP Endpoint with manual CORS (uncomment if needed)
131
+ // import * as cors from 'cors';
132
+ // import { onRequest } from 'firebase-functions/https';
133
+ // const corsHandler = cors({ origin: true });
134
+ //
135
+ // export const checkBootstrapStatusHttp = onRequest((req, res) => {
136
+ // corsHandler(req, res, async () => {
137
+ // try {
138
+ // const firestore = getFirestore();
139
+ // const usersSnapshot = await firestore.collection(USER_FEATURE_KEY).get();
140
+ // const userCount = usersSnapshot.size;
141
+ // const isBootstrapped = userCount > 0;
142
+ //
143
+ // res.status(200).json({
144
+ // success: true,
145
+ // message: isBootstrapped
146
+ // ? `System is bootstrapped with ${userCount} user(s)`
147
+ // : 'System is not bootstrapped - no users found',
148
+ // data: {
149
+ // isBootstrapped,
150
+ // userCount,
151
+ // },
152
+ // });
153
+ // } catch (error: unknown) {
154
+ // res.status(500).json({
155
+ // success: false,
156
+ // message: 'Failed to check bootstrap status: ' +
157
+ // (error instanceof Error ? error.message : String(error)),
158
+ // });
159
+ // }
160
+ // });
161
+ // });
162
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/modules/bootstrap/bootstrap.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,oDAA+E;AAE/E,yCAAyC;AACzC,kCAAmF;AAOtE,QAAA,eAAe,GAAG,IAAA,cAAM,EACnC,KAAK,EAAE,OAA6C,EAAkC,EAAE;;IACtF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;QAC3B,MAAM,EAAE,UAAU,EAAE,gBAAgB,GAAG,iBAAiB,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;QAEzF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,kBAAU,CAAC,kBAAkB,EAAE,8CAA8C,CAAC,CAAC;QAC3F,CAAC;QAED,MAAM,QAAQ,GACZ,aAAa,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC;QAC3F,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB;YAC1C,CAAC,CAAC,IAAA,wBAAY,EAAC,MAAM,CAAC,mBAAmB,CAAC;YAC1C,CAAC,CAAC,IAAA,wBAAY,GAAE,CAAC;QACnB,M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AA,kBAAS,GAAE,CAAC;YAC3B,MAAM,IAAI,kBAAU,CAClB,qBAAqB,EACrB,uBAAuB,MAAM,CAAC,mBAAmB,IAAI,SAAS,mHAAmH,MAAM,CAAC,SAAS,sBAAsB,CACxN,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,kBAAU,CAClB,UAAU,EACV,oCAAoC;YAClC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAC3D,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,iEAAiE;AACjE,gCAAgC;AAChC,wDAAwD;AACxD,8CAA8C;AAC9C,EAAE;AACF,oEAAoE;AACpE,wCAAwC;AACxC,YAAY;AACZ,0CAA0C;AAC1C,kFAAkF;AAClF,8CAA8C;AAC9C,8CAA8C;AAC9C,EAAE;AACF,+BAA+B;AAC/B,yBAAyB;AACzB,kCAAkC;AAClC,iEAAiE;AACjE,6DAA6D;AAC7D,kBAAkB;AAClB,4BAA4B;AAC5B,uBAAuB;AACvB,aAAa;AACb,YAAY;AACZ,iCAAiC;AACjC,+BAA+B;AAC/B,0BAA0B;AAC1B,0DAA0D;AAC1D,sEAAsE;AACtE,YAAY;AACZ,QAAQ;AACR,QAAQ;AACR,MAAM"}
@@ -0,0 +1,20 @@
1
+ export interface SystemBootstrapData {
2
+ adminDisplayName?: string;
3
+ adminEmail: string;
4
+ adminPassword?: string;
5
+ }
6
+ export interface SystemBootstrapResult {
7
+ message: string;
8
+ success: boolean;
9
+ userCreated?: boolean;
10
+ userId?: string;
11
+ }
12
+ export interface BootstrapStatusResult {
13
+ success: boolean;
14
+ message: string;
15
+ data?: {
16
+ isBootstrapped: boolean;
17
+ userCount: number;
18
+ };
19
+ }
20
+ //# sourceMappingURL=bootstrap.models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.models.d.ts","sourceRoot":"","sources":["../../../src/modules/bootstrap/bootstrap.models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE;QACL,cAAc,EAAE,OAAO,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=bootstrap.models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.models.js","sourceRoot":"","sources":["../../../src/modules/bootstrap/bootstrap.models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export * from './bootstrap.models';
2
+ export * from './bootstrap';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/bootstrap/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bootstrap.models"), exports);
18
+ __exportStar(require("./bootstrap"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/bootstrap/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,8CAA4B"}
@@ -0,0 +1,5 @@
1
+ export declare function createSendEmailFunction(): import("firebase-functions/v2/https").CallableFunction<any, Promise<{
2
+ success: boolean;
3
+ messageId: string | undefined;
4
+ }>, unknown>;
5
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/modules/email/email.ts"],"names":[],"mappings":"AAQA,wBAAgB,uBAAuB;;;aAyFtC"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createSendEmailFunction = createSendEmailFunction;
37
+ const logger = __importStar(require("firebase-functions/logger"));
38
+ const https_1 = require("firebase-functions/v2/https");
39
+ const config_1 = require("../../config");
40
+ const email_service_1 = require("./email.service");
41
+ const email_validator_1 = require("./email.validator");
42
+ function createSendEmailFunction() {
43
+ const config = (0, config_1.getConfig)();
44
+ return (0, https_1.onCall)({ region: config.region }, async (request) => {
45
+ if (!request.auth) {
46
+ throw new https_1.HttpsError('unauthenticated', 'A felhasználónak be kell jelentkeznie az email küldéséhez.');
47
+ }
48
+ const data = request.data;
49
+ if (!data.to || !data.subject) {
50
+ throw new https_1.HttpsError('invalid-argument', 'A címzett és a tárgy megadása kötelező.');
51
+ }
52
+ const emails = Array.isArray(data.to) ? data.to : [data.to];
53
+ for (const email of emails) {
54
+ if (!(0, email_validator_1.validateEmail)(email)) {
55
+ throw new https_1.HttpsError('invalid-argument', 'Érvénytelen email cím.');
56
+ }
57
+ }
58
+ try {
59
+ let result;
60
+ switch (data.type) {
61
+ case 'welcome':
62
+ if (!data.userName || !data.loginLink) {
63
+ throw new https_1.HttpsError('invalid-argument', 'A felhasználónév és a bejelentkezési link megadása kötelező.');
64
+ }
65
+ result = await email_service_1.emailService.sendWelcomeEmail(data.to, data.userName, data.loginLink);
66
+ break;
67
+ case 'password-reset':
68
+ if (!data.resetLink) {
69
+ throw new https_1.HttpsError('invalid-argument', 'A jelszó visszaállítási link megadása kötelező.');
70
+ }
71
+ result = await email_service_1.emailService.sendPasswordResetEmail(data.to, data.resetLink, data.userName);
72
+ break;
73
+ case 'notification':
74
+ result = await email_service_1.emailService.sendNotificationEmail(data.to, data.subject, data.message);
75
+ break;
76
+ case 'custom':
77
+ default:
78
+ result = await email_service_1.emailService.sendEmail({
79
+ to: data.to,
80
+ subject: data.subject,
81
+ text: data.message,
82
+ html: data.html,
83
+ });
84
+ break;
85
+ }
86
+ if (!result.success) {
87
+ logger.error('Email sending failed:', result.error);
88
+ throw new https_1.HttpsError('internal', `Email küldése sikertelen: ${result.error}`);
89
+ }
90
+ logger.info('Email sent successfully:', result.messageId);
91
+ return {
92
+ success: true,
93
+ messageId: result.messageId,
94
+ };
95
+ }
96
+ catch (error) {
97
+ logger.error('Error sending email:', error);
98
+ if (error instanceof https_1.HttpsError) {
99
+ throw error;
100
+ }
101
+ throw new https_1.HttpsError('internal', 'Hiba történt az email küldése során.');
102
+ }
103
+ });
104
+ }
105
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../../../src/modules/email/email.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,0DAyFC;AAjGD,kEAAoD;AACpD,uDAAiE;AAEjE,yCAAyC;AAEzC,mDAA+C;AAC/C,uDAAkD;AAElD,SAAgB,uBAAuB;IACrC,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;IAE3B,OAAO,IAAA,cAAM,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACzD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,kBAAU,CAClB,iBAAiB,EACjB,4DAA4D,CAC7D,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,OAAO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ACF,MAAM;gBAER,KAAK,cAAc;oBACjB,MAAM,GAAG,MAAM,4BAAY,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;oBACvF,MAAM;gBAER,KAAK,QAAQ,CAAC;gBACd;oBACE,MAAM,GAAG,MAAM,4BAAY,CAAC,SAAS,CAAC;wBACpC,EAAE,EAAE,IAAI,CAAC,EAAE;wBACX,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,IAAI,EAAE,IAAI,CAAC,OAAO;wBAClB,IAAI,EAAE,IAAI,CAAC,IAAI;qBAChB,CAAC,CAAC;oBACH,MAAM;YACV,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpD,MAAM,IAAI,kBAAU,CAAC,UAAU,EAAE,6BAA6B,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YAChF,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;YAC1D,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;YAC5C,IAAI,KAAK,YAAY,kBAAU,EAAE,CAAC;gBAChC,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,IAAI,kBAAU,CAAC,UAAU,EAAE,sCAAsC,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface SendEmailData {
2
+ to: string | string[];
3
+ subject: string;
4
+ message: string;
5
+ html: string;
6
+ type?: 'notification' | 'welcome' | 'password-reset' | 'custom';
7
+ userName?: string;
8
+ resetLink?: string;
9
+ loginLink?: string;
10
+ }
11
+ export interface EmailOptions {
12
+ to: string | string[];
13
+ subject: string;
14
+ text?: string;
15
+ html?: string;
16
+ cc?: string | string[];
17
+ bcc?: string | string[];
18
+ replyTo?: string;
19
+ }
20
+ export interface EmailResult {
21
+ success: boolean;
22
+ messageId?: string;
23
+ error?: string;
24
+ }
25
+ //# sourceMappingURL=email.models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.models.d.ts","sourceRoot":"","sources":["../../../src/modules/email/email.models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,gBAAgB,GAAG,QAAQ,CAAC;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=email.models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.models.js","sourceRoot":"","sources":["../../../src/modules/email/email.models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { EmailOptions, EmailResult } from './email.models';
2
+ export declare class EmailService {
3
+ private transporter;
4
+ private getTransporter;
5
+ sendEmail(options: EmailOptions): Promise<EmailResult>;
6
+ sendPasswordResetEmail(to: string, resetLink: string, userName?: string): Promise<EmailResult>;
7
+ sendWelcomeEmail(to: string, userName: string, loginLink: string): Promise<EmailResult>;
8
+ sendNotificationEmail(to: string | string[], subject: string, message: string): Promise<EmailResult>;
9
+ }
10
+ export declare const emailService: EmailService;
11
+ //# sourceMappingURL=email.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.service.d.ts","sourceRoot":"","sources":["../../../src/modules/email/email.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,YAAY;IACvB,OAAO,CAAC,WAAW,CAAuC;IAE1D,OAAO,CAAC,cAAc;IAiBhB,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAiCtD,sBAAsB,CAC1B,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC;IAyDjB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAqDvF,qBAAqB,CACzB,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,CAAC;CAiCxB;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC"}
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.emailService = exports.EmailService = void 0;
37
+ const firebase_functions_1 = require("firebase-functions");
38
+ const nodemailer = __importStar(require("nodemailer"));
39
+ const config_1 = require("../../config");
40
+ class EmailService {
41
+ constructor() {
42
+ this.transporter = null;
43
+ }
44
+ getTransporter() {
45
+ if (!this.transporter) {
46
+ const emailConfig = (0, config_1.getEmailConfig)();
47
+ this.transporter = nodemailer.createTransport({
48
+ host: emailConfig.host,
49
+ port: emailConfig.port,
50
+ secure: emailConfig.secure,
51
+ auth: {
52
+ user: emailConfig.user,
53
+ pass: emailConfig.pass,
54
+ },
55
+ });
56
+ }
57
+ return this.transporter;
58
+ }
59
+ async sendEmail(options) {
60
+ try {
61
+ const transporter = this.getTransporter();
62
+ const emailConfig = (0, config_1.getEmailConfig)();
63
+ firebase_functions_1.logger.info(`Email transporter configured for host: ${emailConfig.host}, port: ${emailConfig.port}`);
64
+ const mailOptions = {
65
+ from: `"${emailConfig.fromName}" <${emailConfig.fromEmail}>`,
66
+ to: Array.isArray(options.to) ? options.to.join(', ') : options.to,
67
+ subject: options.subject,
68
+ text: options.text,
69
+ html: options.html,
70
+ cc: options.cc,
71
+ bcc: options.bcc,
72
+ replyTo: options.replyTo,
73
+ };
74
+ const info = await transporter.sendMail(mailOptions);
75
+ return {
76
+ success: true,
77
+ messageId: info.messageId,
78
+ };
79
+ }
80
+ catch (error) {
81
+ console.error('Email sending error:', error);
82
+ return {
83
+ success: false,
84
+ error: error instanceof Error ? error.message : 'Unknown error',
85
+ };
86
+ }
87
+ }
88
+ async sendPasswordResetEmail(to, resetLink, userName) {
89
+ const config = (0, config_1.getConfig)();
90
+ const subject = `Jelszó visszaállítás - ${config.appName}`;
91
+ const html = `
92
+ <!DOCTYPE html>
93
+ <html>
94
+ <head>
95
+ <meta charset="utf-8">
96
+ <style>
97
+ body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
98
+ .container { max-width: 600px; margin: 0 auto; padding: 20px; }
99
+ .header { background-color: #4CAF50; color: white; padding: 20px; text-align: center; }
100
+ .content { padding: 20px; background-color: #f9f9f9; }
101
+ .button { display: inline-block; padding: 12px 24px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 4px; margin: 20px 0; }
102
+ .footer { padding: 20px; text-align: center; color: #777; font-size: 12px; }
103
+ </style>
104
+ </head>
105
+ <body>
106
+ <div class="container">
107
+ <div class="header">
108
+ <h1>${config.appName}</h1>
109
+ </div>
110
+ <div class="content">
111
+ <h2>Jelszó visszaállítás</h2>
112
+ <p>Kedves ${userName || 'Felhasználó'}!</p>
113
+ <p>Jelszó visszaállítási kérelmet kaptunk a fiókodhoz.</p>
114
+ <p>Kattints az alábbi gombra a jelszavad visszaállításához:</p>
115
+ <a href="${resetLink}" class="button">Jelszó visszaállítása</a>
116
+ <p>Ha nem te kérted a jelszó visszaállítását, akkor figyelmen kívül hagyhatod ezt az emailt.</p>
117
+ <p>Ez a link 1 órán belül lejár.</p>
118
+ </div>
119
+ <div class="footer">
120
+ <p>© 2025 ${config.appName}. Minden jog fenntartva.</p>
121
+ </div>
122
+ </div>
123
+ </body>
124
+ </html>
125
+ `;
126
+ const text = `
127
+ Kedves ${userName || 'Felhasználó'}!
128
+
129
+ Jelszó visszaállítási kérelmet kaptunk a fiókodhoz.
130
+
131
+ Látogasd meg az alábbi linket a jelszavad visszaállításához:
132
+ ${resetLink}
133
+
134
+ Ha nem te kérted a jelszó visszaállítását, akkor figyelmen kívül hagyhatod ezt az emailt.
135
+
136
+ Ez a link 1 órán belül lejár.
137
+
138
+ © 2025 ${config.appName}. Minden jog fenntartva.
139
+ `;
140
+ return this.sendEmail({ to, subject, html, text });
141
+ }
142
+ async sendWelcomeEmail(to, userName, loginLink) {
143
+ const config = (0, config_1.getConfig)();
144
+ const subject = `Üdvözlünk a ${config.appName} rendszerben!`;
145
+ const html = `
146
+ <!DOCTYPE html>
147
+ <html>
148
+ <head>
149
+ <meta charset="utf-8">
150
+ <style>
151
+ body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
152
+ .container { max-width: 600px; margin: 0 auto; padding: 20px; }
153
+ .header { background-color: #4CAF50; color: white; padding: 20px; text-align: center; }
154
+ .content { padding: 20px; background-color: #f9f9f9; }
155
+ .button { display: inline-block; padding: 12px 24px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 4px; margin: 20px 0; }
156
+ .footer { padding: 20px; text-align: center; color: #777; font-size: 12px; }
157
+ </style>
158
+ </head>
159
+ <body>
160
+ <div class="container">
161
+ <div class="header">
162
+ <h1>${config.appName}</h1>
163
+ </div>
164
+ <div class="content">
165
+ <h2>Üdvözlünk!</h2>
166
+ <p>Kedves ${userName}!</p>
167
+ <p>Sikeresen regisztráltunk a ${config.appName} rendszerben.</p>
168
+ <p>Az alábbi gombra kattintva bejelentkezhetsz:</p>
169
+ <a href="${loginLink}" class="button">Bejelentkezés</a>
170
+ <p>Ha bármilyen kérdésed van, vedd fel velünk a kapcsolatot.</p>
171
+ </div>
172
+ <div class="footer">
173
+ <p>© 2025 ${config.appName}. Minden jog fenntartva.</p>
174
+ </div>
175
+ </div>
176
+ </body>
177
+ </html>
178
+ `;
179
+ const text = `
180
+ Kedves ${userName}!
181
+
182
+ Sikeresen regisztráltunk a ${config.appName} rendszerben.
183
+
184
+ Bejelentkezés: ${loginLink}
185
+
186
+ Ha bármilyen kérdésed van, vedd fel velünk a kapcsolatot.
187
+
188
+ © 2025 ${config.appName}. Minden jog fenntartva.
189
+ `;
190
+ return this.sendEmail({ to, subject, html, text });
191
+ }
192
+ async sendNotificationEmail(to, subject, message) {
193
+ const config = (0, config_1.getConfig)();
194
+ const html = `
195
+ <!DOCTYPE html>
196
+ <html>
197
+ <head>
198
+ <meta charset="utf-8">
199
+ <style>
200
+ body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
201
+ .container { max-width: 600px; margin: 0 auto; padding: 20px; }
202
+ .header { background-color: #4CAF50; color: white; padding: 20px; text-align: center; }
203
+ .content { padding: 20px; background-color: #f9f9f9; }
204
+ .footer { padding: 20px; text-align: center; color: #777; font-size: 12px; }
205
+ </style>
206
+ </head>
207
+ <body>
208
+ <div class="container">
209
+ <div class="header">
210
+ <h1>${config.appName}</h1>
211
+ </div>
212
+ <div class="content">
213
+ <p>${message}</p>
214
+ </div>
215
+ <div class="footer">
216
+ <p>© 2025 ${config.appName}. Minden jog fenntartva.</p>
217
+ </div>
218
+ </div>
219
+ </body>
220
+ </html>
221
+ `;
222
+ return this.sendEmail({ to, subject, html, text: message });
223
+ }
224
+ }
225
+ exports.EmailService = EmailService;
226
+ exports.emailService = new EmailService();
227
+ //# sourceMappingURL=email.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.service.js","sourceRoot":"","sources":["../../../src/modules/email/email.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA4C;AAC5C,uDAAyC;AAEzC,yCAAyD;AAGzD,MAAa,YAAY;IAAzB;QACU,gBAAW,GAAkC,IAAI,CAAC;IA2M5D,CAAC;IAzMS,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,WAAW,GAAG,IAAA,uBAAc,GAAE,CAAC;YAErC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,eAAe,CAAC;gBAC5C,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,IAAI,EAAE;oBACJ,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,IAAI,EAAE,WAAW,CAAC,IAAI;iBACvB;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAqB;QACnC,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,MAAM,WAAW,GAAG,IAAA,uBAAc,GAAE,CAAC;YACrC,2BAAM,CAAC,IAAI,CACT,0CAA0C,WAAW,CAAC,IAAI,WAAW,WAAW,CAAC,IAAI,EAAE,CACxF,CAAC;YACF,MAAM,WAAW,GAAG;gBAClB,IAAI,EAAE,IAAI,WAAW,CAAC,QAAQ,MAAM,WAAW,CAAC,SAAS,GAAG;gBAC5D,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CA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