biz-email-builder-shared 1.0.5 → 1.0.6

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,3 @@
1
+ export declare const connectDB: (mongoURI: string) => Promise<void>;
2
+ export declare const disconnectDB: () => Promise<void>;
3
+ //# sourceMappingURL=db.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.config.d.ts","sourceRoot":"","sources":["../../src/config/db.config.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,aAAoB,MAAM,KAAG,OAAO,CAAC,IAAI,CAQ9D,CAAC;AAEF,eAAO,MAAM,YAAY,QAAa,OAAO,CAAC,IAAI,CAOjD,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.disconnectDB = exports.connectDB = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const connectDB = async (mongoURI) => {
9
+ try {
10
+ await mongoose_1.default.connect(mongoURI);
11
+ console.log("Connected to DB");
12
+ }
13
+ catch (error) {
14
+ console.error("Error connecting to DB:", error);
15
+ process.exit(1);
16
+ }
17
+ };
18
+ exports.connectDB = connectDB;
19
+ const disconnectDB = async () => {
20
+ try {
21
+ await mongoose_1.default.disconnect();
22
+ console.log("Disconnected from DB");
23
+ }
24
+ catch (error) {
25
+ console.error("Error disconnecting from DB:", error);
26
+ }
27
+ };
28
+ exports.disconnectDB = disconnectDB;
@@ -0,0 +1,2 @@
1
+ export * from "./db.config";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1,17 @@
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("./db.config"), exports);
@@ -0,0 +1,6 @@
1
+ import { IEmailLayout } from "../types";
2
+ declare const EmailTemplate: import("mongoose").Model<IEmailLayout, {}, {}, {}, import("mongoose").Document<unknown, {}, IEmailLayout> & Omit<IEmailLayout & {
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }, never>, any>;
5
+ export default EmailTemplate;
6
+ //# sourceMappingURL=emailTemplate.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emailTemplate.entity.d.ts","sourceRoot":"","sources":["../../src/entity/emailTemplate.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,YAAY,EAAE,MAAM,UAAU,CAAC;AAwDnD,QAAA,MAAM,aAAa;;eAA2D,CAAC;AAC/E,eAAe,aAAa,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const types_1 = require("../types");
5
+ const BlockDataPropsSchema = new mongoose_1.Schema({
6
+ imageUrl: { type: String, default: "" },
7
+ text: { type: String, default: "" },
8
+ rows: { type: Number, default: 0 },
9
+ columns: { type: Number, default: 0 },
10
+ navigateToUrl: { type: String, default: "" },
11
+ altText: { type: String, default: "" },
12
+ cellWidths: { type: [Number], default: [] },
13
+ }, { _id: false });
14
+ const BlockDataSchema = new mongoose_1.Schema({
15
+ style: { type: mongoose_1.Schema.Types.Mixed },
16
+ props: { type: BlockDataPropsSchema },
17
+ childrenIds: { type: [String], default: [] },
18
+ }, { _id: false });
19
+ const BlockSchema = new mongoose_1.Schema({
20
+ type: {
21
+ type: String,
22
+ required: true,
23
+ enum: Object.values(types_1.BlockType),
24
+ },
25
+ data: BlockDataSchema,
26
+ }, { _id: false });
27
+ const EmailLayoutSchema = new mongoose_1.Schema({
28
+ templateName: {
29
+ type: String,
30
+ required: true
31
+ },
32
+ blocks: {
33
+ type: Map,
34
+ of: BlockSchema,
35
+ required: true,
36
+ },
37
+ isDeleted: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'user' },
42
+ deletedAt: Date
43
+ }, { timestamps: true });
44
+ const EmailTemplate = (0, mongoose_1.model)("email-template", EmailLayoutSchema);
45
+ exports.default = EmailTemplate;
@@ -1,28 +1,3 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose" />
25
- /// <reference types="mongoose/types/inferschematype" />
26
1
  interface IUser {
27
2
  email: string | null;
28
3
  password: string;
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entity/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAA;CAChB;AAcD,eAAO,MAAM,SAAS;;eAAmC,CAAC"}
1
+ {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entity/user.entity.ts"],"names":[],"mappings":"AAEA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAA;CAChB;AAcD,eAAO,MAAM,SAAS;;eAAmC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from "./middleware";
3
3
  export * from "./resHandler";
4
4
  export * from "./types";
5
5
  export * from "./utilities";
6
+ export * from "./config";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -19,3 +19,4 @@ __exportStar(require("./middleware"), exports);
19
19
  __exportStar(require("./resHandler"), exports);
20
20
  __exportStar(require("./types"), exports);
21
21
  __exportStar(require("./utilities"), exports);
22
+ __exportStar(require("./config"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"schemaValidate.d.ts","sourceRoot":"","sources":["../../src/middleware/schemaValidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,cAAc,WAAY,IAAI,YAAY,CAAC,GAAG,CAAC,WAC9B,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAWxE,CAAA"}
1
+ {"version":3,"file":"schemaValidate.d.ts","sourceRoot":"","sources":["../../src/middleware/schemaValidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,cAAc,WAAY,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,WAC9B,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAWxE,CAAA"}
@@ -0,0 +1,43 @@
1
+ export declare enum BlockType {
2
+ TEXT = "Text",
3
+ IMAGE = "Image",
4
+ BUTTON = "Button",
5
+ GRID = "Grid",
6
+ EMPTY = "EMPTY",
7
+ GRIDCELL = "GridCell",
8
+ SPACER = "Spacer",
9
+ DIVIDER = "Divider",
10
+ EMAILLAYOUT = "EmailLayout"
11
+ }
12
+ interface IProps {
13
+ imageUrl: string;
14
+ text: string;
15
+ rows: number;
16
+ columns: number;
17
+ textAlign: string;
18
+ navigateToUrl: string;
19
+ altText: string;
20
+ cellWidths: number[];
21
+ }
22
+ interface IStyle {
23
+ [key: string]: any;
24
+ }
25
+ export interface IBlockData {
26
+ type: BlockType;
27
+ data: {
28
+ style: IStyle;
29
+ props: IProps;
30
+ childrenIds: string[];
31
+ };
32
+ }
33
+ export interface IEmailLayout {
34
+ templateName: string;
35
+ user: string;
36
+ blocks: Map<string, IBlockData>;
37
+ isDeleted: boolean;
38
+ createdAt: Date;
39
+ updatedAt: Date;
40
+ deletedAt: Date;
41
+ }
42
+ export {};
43
+ //# sourceMappingURL=ITemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ITemplate.d.ts","sourceRoot":"","sources":["../../src/types/ITemplate.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACpB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC3B;AAED,UAAU,MAAM;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,UAAU,MAAM;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;CACF;AAED,MAAM,WAAW,YAAY;IAC5B,YAAY,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CAChB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlockType = void 0;
4
+ var BlockType;
5
+ (function (BlockType) {
6
+ BlockType["TEXT"] = "Text";
7
+ BlockType["IMAGE"] = "Image";
8
+ BlockType["BUTTON"] = "Button";
9
+ BlockType["GRID"] = "Grid";
10
+ BlockType["EMPTY"] = "EMPTY";
11
+ BlockType["GRIDCELL"] = "GridCell";
12
+ BlockType["SPACER"] = "Spacer";
13
+ BlockType["DIVIDER"] = "Divider";
14
+ BlockType["EMAILLAYOUT"] = "EmailLayout";
15
+ })(BlockType || (exports.BlockType = BlockType = {}));
@@ -1,3 +1,4 @@
1
1
  export * from "./IController";
2
2
  export * from "./IRequest";
3
+ export * from "./ITemplate";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IController"), exports);
18
18
  __exportStar(require("./IRequest"), exports);
19
+ __exportStar(require("./ITemplate"), exports);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callWithRetries = void 0;
3
+ exports.callWithRetries = callWithRetries;
4
4
  async function callWithRetries(retryCount, failedMessage, functionRef, ...args) {
5
5
  try {
6
6
  return await functionRef(...args);
@@ -12,4 +12,3 @@ async function callWithRetries(retryCount, failedMessage, functionRef, ...args)
12
12
  return callWithRetries(retryCount - 1, failedMessage, functionRef, ...args);
13
13
  }
14
14
  }
15
- exports.callWithRetries = callWithRetries;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createFolder = void 0;
6
+ exports.createFolder = createFolder;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  async function createFolder(folderPath) {
9
9
  try {
@@ -15,4 +15,3 @@ async function createFolder(folderPath) {
15
15
  console.error(`Error: ${error.message}`);
16
16
  }
17
17
  }
18
- exports.createFolder = createFolder;
@@ -1 +1 @@
1
- {"version":3,"file":"encryptionUtils.d.ts","sourceRoot":"","sources":["../../src/utilities/encryptionUtils.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,UAAW,MAAM,WAI7B,CAAC;AAEF,QAAA,MAAM,SAAS,UAAiB,MAAM,KAAG,QAAQ,GAAG,CAgBnD,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA"}
1
+ {"version":3,"file":"encryptionUtils.d.ts","sourceRoot":"","sources":["../../src/utilities/encryptionUtils.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,OAAO,UAAW,MAAM,WAI7B,CAAC;AAEF,QAAA,MAAM,SAAS,UAAiB,MAAM,KAAG,OAAO,CAAC,GAAG,CAgBnD,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz-email-builder-shared",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": ["dist"],