biz-email-builder-shared 1.6.60 → 1.6.62
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.
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Types, Document } from "mongoose";
|
|
2
|
+
export interface ICampaign extends Document {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
createdBy?: Types.ObjectId;
|
|
6
|
+
templateId: Types.ObjectId;
|
|
7
|
+
templateVersion: number;
|
|
8
|
+
organisationId: Types.ObjectId;
|
|
9
|
+
isDeleted?: boolean;
|
|
10
|
+
updateBy?: Types.ObjectId;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
export interface ICampaignUsers extends Document {
|
|
15
|
+
campaignId: Types.ObjectId;
|
|
16
|
+
email: string;
|
|
17
|
+
sentAt?: Date;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
isDelivered?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const CampaignUsersModel: import("mongoose").Model<ICampaignUsers, {}, {}, {}, Document<unknown, {}, ICampaignUsers> & ICampaignUsers & Required<{
|
|
23
|
+
_id: unknown;
|
|
24
|
+
}> & {
|
|
25
|
+
__v: number;
|
|
26
|
+
}, any>;
|
|
27
|
+
export declare const CampaignModel: import("mongoose").Model<ICampaign, {}, {}, {}, Document<unknown, {}, ICampaign> & ICampaign & Required<{
|
|
28
|
+
_id: unknown;
|
|
29
|
+
}> & {
|
|
30
|
+
__v: number;
|
|
31
|
+
}, any>;
|
|
32
|
+
//# sourceMappingURL=compaign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaign.d.ts","sourceRoot":"","sources":["../../src/entity/compaign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAgBD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAYD,eAAO,MAAM,kBAAkB;;;;OAA+D,CAAC;AAC/F,eAAO,MAAM,aAAa;;;;OAA+C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CampaignModel = exports.CampaignUsersModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const CampaignSchema = new mongoose_1.Schema({
|
|
6
|
+
name: { type: String, required: true },
|
|
7
|
+
description: { type: String, default: null },
|
|
8
|
+
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", required: true },
|
|
9
|
+
templateId: { type: mongoose_1.Schema.Types.ObjectId, ref: "template", required: true },
|
|
10
|
+
templateVersion: { type: Number, required: true, default: 0 },
|
|
11
|
+
organisationId: { type: mongoose_1.Schema.Types.ObjectId, ref: "organisation", required: false, default: null },
|
|
12
|
+
isDeleted: { type: Boolean, default: false },
|
|
13
|
+
updateBy: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", default: null },
|
|
14
|
+
}, { timestamps: true });
|
|
15
|
+
const CampaignUsersSchema = new mongoose_1.Schema({
|
|
16
|
+
campaignId: { type: mongoose_1.Schema.Types.ObjectId, ref: "campaign", required: true },
|
|
17
|
+
email: { type: String, required: true },
|
|
18
|
+
sentAt: { type: Date, default: Date.now },
|
|
19
|
+
isDelivered: { type: Boolean, default: false },
|
|
20
|
+
}, { timestamps: true });
|
|
21
|
+
exports.CampaignUsersModel = (0, mongoose_1.model)("campaign-users", CampaignUsersSchema);
|
|
22
|
+
exports.CampaignModel = (0, mongoose_1.model)("campaign", CampaignSchema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cryptoUtils.d.ts","sourceRoot":"","sources":["../../src/utilities/cryptoUtils.ts"],"names":[],"mappings":"AAcA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"cryptoUtils.d.ts","sourceRoot":"","sources":["../../src/utilities/cryptoUtils.ts"],"names":[],"mappings":"AAcA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkB5C"}
|
|
@@ -23,10 +23,15 @@ function encrypt(text) {
|
|
|
23
23
|
return iv.toString('hex') + ':' + encrypted; // Return the IV and encrypted text
|
|
24
24
|
}
|
|
25
25
|
function decrypt(text) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
26
|
+
if (typeof text !== 'string' || !text.includes(':')) {
|
|
27
|
+
throw new Error("Invalid encrypted format: missing IV or separator");
|
|
28
|
+
}
|
|
29
|
+
const [ivHex, encryptedText] = text.split(':');
|
|
30
|
+
if (!ivHex || ivHex.length !== 32 || !encryptedText) {
|
|
31
|
+
throw new Error("Invalid encrypted format: IV or ciphertext invalid");
|
|
32
|
+
}
|
|
33
|
+
const iv = Buffer.from(ivHex, 'hex');
|
|
34
|
+
const decipher = crypto_1.default.createDecipheriv('aes-256-cbc', encryptionKey, iv);
|
|
30
35
|
let decrypted = decipher.update(encryptedText, 'hex', 'utf8');
|
|
31
36
|
decrypted += decipher.final('utf8');
|
|
32
37
|
return decrypted;
|