biz-email-builder-shared 1.0.16 → 1.0.18

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.
@@ -1,5 +1,5 @@
1
1
  export * from "./user.entity";
2
- export * from "./emailTemplate.entity";
3
- export * from "./role.entitty";
2
+ export * from "./template.entity";
3
+ export * from "./user-group.entitty";
4
4
  export * from "./feature.entitiy";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./user.entity"), exports);
18
- __exportStar(require("./emailTemplate.entity"), exports);
19
- __exportStar(require("./role.entitty"), exports);
18
+ __exportStar(require("./template.entity"), exports);
19
+ __exportStar(require("./user-group.entitty"), exports);
20
20
  __exportStar(require("./feature.entitiy"), exports);
@@ -0,0 +1,5 @@
1
+ import { ITemplateLayout } from "../types";
2
+ export declare const TemplateModel: import("mongoose").Model<ITemplateLayout, {}, {}, {}, import("mongoose").Document<unknown, {}, ITemplateLayout> & Omit<ITemplateLayout & {
3
+ _id: import("mongoose").Types.ObjectId;
4
+ }, never>, any>;
5
+ //# sourceMappingURL=template.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.entity.d.ts","sourceRoot":"","sources":["../../src/entity/template.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,eAAe,EAAE,MAAM,UAAU,CAAC;AAwDtD,eAAO,MAAM,aAAa;;eAAqD,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateModel = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const types_1 = require("../types");
6
+ const BlockDataPropsSchema = new mongoose_1.Schema({
7
+ imageUrl: { type: String, default: "" },
8
+ text: { type: String, default: "" },
9
+ rows: { type: Number, default: 0 },
10
+ columns: { type: Number, default: 0 },
11
+ navigateToUrl: { type: String, default: "" },
12
+ altText: { type: String, default: "" },
13
+ cellWidths: { type: [Number], default: [] },
14
+ }, { _id: false });
15
+ const BlockDataSchema = new mongoose_1.Schema({
16
+ style: { type: mongoose_1.Schema.Types.Mixed },
17
+ props: { type: BlockDataPropsSchema },
18
+ childrenIds: { type: [String], default: [] },
19
+ }, { _id: false });
20
+ const BlockSchema = new mongoose_1.Schema({
21
+ type: {
22
+ type: String,
23
+ required: true,
24
+ enum: Object.values(types_1.BlockType),
25
+ },
26
+ data: BlockDataSchema,
27
+ }, { _id: false });
28
+ const TemplateSchema = new mongoose_1.Schema({
29
+ name: {
30
+ type: String,
31
+ required: true
32
+ },
33
+ layout: {
34
+ type: Map,
35
+ of: BlockSchema,
36
+ required: true,
37
+ },
38
+ isDeleted: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'user' },
43
+ deletedAt: Date
44
+ }, { timestamps: true });
45
+ exports.TemplateModel = (0, mongoose_1.model)("template", TemplateSchema);
@@ -0,0 +1,19 @@
1
+ import { Types } from "mongoose";
2
+ import { OWNERSHIP_TYPE } from "../utilities";
3
+ interface ITemplateShare {
4
+ sharedBy: Types.ObjectId;
5
+ sharedTo: Types.ObjectId;
6
+ templateId: Types.ObjectId;
7
+ accessType: OWNERSHIP_TYPE;
8
+ comment: string;
9
+ isRevoked: boolean;
10
+ revokedAt: Date;
11
+ revokedBy: Types.ObjectId;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
15
+ export declare const TemplateShareModel: import("mongoose").Model<ITemplateShare, {}, {}, {}, import("mongoose").Document<unknown, {}, ITemplateShare> & Omit<ITemplateShare & {
16
+ _id: Types.ObjectId;
17
+ }, never>, any>;
18
+ export {};
19
+ //# sourceMappingURL=templateShare.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateShare.entity.d.ts","sourceRoot":"","sources":["../../src/entity/templateShare.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAS,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,cAAc;IACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IACzB,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAkBD,eAAO,MAAM,kBAAkB;SACwlH,MAAO,QAAQ;eADxiH,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TemplateShareModel = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const utilities_1 = require("../utilities");
6
+ const TemplateShareSchema = new mongoose_1.Schema({
7
+ sharedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'user', required: true },
8
+ sharedTo: { type: mongoose_1.Schema.Types.ObjectId, ref: 'user', required: true },
9
+ templateId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'email-template', required: true },
10
+ accessType: { type: String, enum: Object.values(utilities_1.OWNERSHIP_TYPE), required: true },
11
+ comment: { type: String, default: "" },
12
+ isRevoked: { type: Boolean, default: false },
13
+ revokedAt: { type: Date, default: null },
14
+ revokedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'user', required: true }
15
+ }, {
16
+ timestamps: true,
17
+ });
18
+ exports.TemplateShareModel = (0, mongoose_1.model)("template-share", TemplateShareSchema);
@@ -0,0 +1,14 @@
1
+ import { Types } from "mongoose";
2
+ interface IUserGroup {
3
+ name: string;
4
+ isDeleted: boolean;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ deletedAt: Date;
8
+ features: Types.ObjectId[];
9
+ }
10
+ export declare const UserGroupModel: import("mongoose").Model<IUserGroup, {}, {}, {}, import("mongoose").Document<unknown, {}, IUserGroup> & Omit<IUserGroup & {
11
+ _id: Types.ObjectId;
12
+ }, never>, any>;
13
+ export {};
14
+ //# sourceMappingURL=user-group.entitty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-group.entitty.d.ts","sourceRoot":"","sources":["../../src/entity/user-group.entitty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;CAC5B;AAcD,eAAO,MAAM,cAAc;SACmkI,MAAO,QAAQ;eAD/hI,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserGroupModel = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const UserGroupSchema = new mongoose_1.Schema({
6
+ name: { type: String, unique: true, sparse: true },
7
+ isDeleted: { type: Boolean, default: false },
8
+ deletedAt: { type: Date, default: null },
9
+ features: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'feature' }], default: [], _id: false },
10
+ }, {
11
+ timestamps: true,
12
+ });
13
+ exports.UserGroupModel = (0, mongoose_1.model)("user-group", UserGroupSchema);
@@ -1,7 +1,10 @@
1
+ import { Types } from "mongoose";
2
+ import { ROLES } from "../utilities";
1
3
  interface IUser {
2
4
  email: string | null;
3
5
  password: string;
4
- role: string;
6
+ role: ROLES;
7
+ groups: Array<Types.ObjectId>;
5
8
  isVerified: boolean;
6
9
  verificationToken: string;
7
10
  createdAt: Date;
@@ -10,7 +13,7 @@ interface IUser {
10
13
  isDeleted: boolean;
11
14
  }
12
15
  export declare const UserModel: import("mongoose").Model<IUser, {}, {}, {}, import("mongoose").Document<unknown, {}, IUser> & Omit<IUser & {
13
- _id: import("mongoose").Types.ObjectId;
16
+ _id: Types.ObjectId;
14
17
  }, never>, any>;
15
18
  export {};
16
19
  //# sourceMappingURL=user.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entity/user.entity.ts"],"names":[],"mappings":"AAGA,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAiBD,eAAO,MAAM,SAAS;;eAAmC,CAAC"}
1
+ {"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entity/user.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,UAAU,KAAK;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAkBD,eAAO,MAAM,SAAS;SACwyH,MAAO,QAAQ;eADpxH,CAAC"}
@@ -10,7 +10,8 @@ const UserSchema = new mongoose_1.Schema({
10
10
  isVerified: { type: Boolean, default: false },
11
11
  verificationToken: { type: String },
12
12
  deletedAt: { type: Date, default: null },
13
- isDeleted: { type: Boolean, default: false }
13
+ isDeleted: { type: Boolean, default: false },
14
+ groups: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'user-group' }], default: [], _id: false }
14
15
  }, {
15
16
  timestamps: true,
16
17
  });
@@ -1,5 +1,8 @@
1
1
  import { Response, NextFunction } from "express";
2
+ import { FEATURE_TYPE, ROLES } from "../utilities";
2
3
  import { IRequest } from "../types";
3
- declare const authorize: (roles: string[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
4
- export { authorize };
4
+ declare const authorize: () => (req: IRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
5
+ declare const checkRoleAccess: (roles: ROLES[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
6
+ declare const checkFeatureAccess: (features: FEATURE_TYPE[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
7
+ export { authorize, checkFeatureAccess, checkRoleAccess };
5
8
  //# sourceMappingURL=authentication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middleware/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,QAAA,MAAM,SAAS,UAAW,MAAM,EAAE,WACJ,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DA+BxE,CAAA;AAGD,OAAO,EAAC,SAAS,EAAC,CAAC"}
1
+ {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middleware/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAAa,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,QAAA,MAAM,SAAS,cACe,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DA0BxE,CAAA;AAED,QAAA,MAAM,eAAe,UAAW,KAAK,EAAE,WACT,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAmBxE,CAAA;AAED,QAAA,MAAM,kBAAkB,aAAc,YAAY,EAAE,WACtB,QAAQ,OAAO,QAAQ,QAAQ,YAAY,4DAmBxE,CAAA;AAGD,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
@@ -11,30 +11,26 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.authorize = void 0;
14
+ exports.checkRoleAccess = exports.checkFeatureAccess = exports.authorize = void 0;
15
15
  const utilities_1 = require("../utilities");
16
16
  const entity_1 = require("../entity");
17
- const authorize = (roles) => {
17
+ const authorize = () => {
18
18
  return async function (req, res, next) {
19
19
  if (!req.headers.authorization) {
20
20
  return res.status(401).json({ message: 'Unauthorized' });
21
21
  }
22
- if (!roles.length) {
23
- return res.status(401).json({ message: 'Unauthorized' });
24
- }
25
22
  if (req.headers.authorization) {
26
23
  const token = await (0, utilities_1.verifyUid)(req.headers.authorization);
27
24
  if (!token) {
28
25
  return res.status(401).json({ message: 'Session Expired' });
29
26
  }
30
- let user = await entity_1.UserModel.findById(token.value.id);
27
+ let user = await entity_1.UserModel.findById(token.value.id).populate({
28
+ path: "groups",
29
+ populate: { path: "features", select: "name" },
30
+ }).lean();
31
31
  if (!user) {
32
32
  return res.status(401).json({ message: 'No User Found' });
33
33
  }
34
- const hasAccess = roles.find(role => role === user.role);
35
- if (!hasAccess) {
36
- return res.status(403).json({ message: 'Forbbiden' });
37
- }
38
34
  const _a = user.toObject(), { createdAt, updatedAt, deletedAt, password } = _a, rest = __rest(_a, ["createdAt", "updatedAt", "deletedAt", "password"]);
39
35
  req.user = rest;
40
36
  next();
@@ -42,3 +38,36 @@ const authorize = (roles) => {
42
38
  };
43
39
  };
44
40
  exports.authorize = authorize;
41
+ const checkRoleAccess = (roles) => {
42
+ return async function (req, res, next) {
43
+ const { user } = req;
44
+ if (!user) {
45
+ return res.status(401).json({ message: 'Unauthorized' });
46
+ }
47
+ const hasAccess = roles.find(role => role === user.role);
48
+ if (!hasAccess) {
49
+ return res.status(403).json({ message: 'Forbbiden: Role access denied' });
50
+ }
51
+ user.isAdmin = user.role === utilities_1.ROLES.ADMIN;
52
+ if (user.isAdmin) {
53
+ user.groups.push({ name: "DEFAULT", features: Object.values(utilities_1.FEATURE_TYPE).map(value => ({ name: value })) });
54
+ }
55
+ next();
56
+ };
57
+ };
58
+ exports.checkRoleAccess = checkRoleAccess;
59
+ const checkFeatureAccess = (features) => {
60
+ return async function (req, res, next) {
61
+ const { user } = req;
62
+ if (!user) {
63
+ return res.status(401).json({ message: 'Unauthorized' });
64
+ }
65
+ const userFeatureNames = user.groups.flatMap(group => group.features ? group.features.map((feature) => feature.name) : []);
66
+ const hasAccess = features.some((feature) => userFeatureNames.includes(feature));
67
+ if (!hasAccess) {
68
+ return res.status(403).json({ message: "Forbidden: Feature access denied" });
69
+ }
70
+ next();
71
+ };
72
+ };
73
+ exports.checkFeatureAccess = checkFeatureAccess;
@@ -1,8 +1,20 @@
1
1
  import { Request } from "express";
2
+ import { FEATURE_TYPE, ROLES } from "../utilities";
3
+ export interface IRequestUser {
4
+ email: string | null;
5
+ role: ROLES;
6
+ groups: Array<{
7
+ name: string;
8
+ features: Array<{
9
+ name: FEATURE_TYPE;
10
+ }>;
11
+ }>;
12
+ isVerified: boolean;
13
+ deletedAt: Date;
14
+ isDeleted: boolean;
15
+ isAdmin: boolean;
16
+ }
2
17
  export interface IRequest extends Request {
3
- user?: any;
4
- role?: any;
5
- file?: any;
6
- features?: Array<any>;
18
+ user?: IRequestUser;
7
19
  }
8
20
  //# sourceMappingURL=IRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IRequest.d.ts","sourceRoot":"","sources":["../../src/types/IRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,WAAW,QAAS,SAAQ,OAAO;IACrC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAC,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACxB"}
1
+ {"version":3,"file":"IRequest.d.ts","sourceRoot":"","sources":["../../src/types/IRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,KAAK,CAAC;QACV,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,YAAY,CAAA;SAAE,CAAC,CAAA;KAC1C,CAAC,CAAA;IACF,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,QAAS,SAAQ,OAAO;IACrC,IAAI,CAAC,EAAE,YAAY,CAAA;CACtB"}
@@ -30,7 +30,7 @@ export interface IBlockData {
30
30
  childrenIds: string[];
31
31
  };
32
32
  }
33
- export interface IEmailTemplateLayout {
33
+ export interface ITemplateLayout {
34
34
  name: string;
35
35
  user: string;
36
36
  layout: Map<string, IBlockData>;
@@ -1 +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,oBAAoB;IACpC,IAAI,EAAE,MAAM,CAAC;IACZ,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"}
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,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,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"}
@@ -11,4 +11,27 @@ export declare enum RECORD_TYPE {
11
11
  ARCHIVE = "ARCHIVE",
12
12
  NON_ARCHIVE = "NON_ARCHIVE"
13
13
  }
14
+ export declare enum OWNERSHIP_TYPE {
15
+ OWNER = "OWNER",
16
+ CO_OWNER = "CO_OWNER",
17
+ VIEWER = "VIEWER",
18
+ EDITOR = "EDITOR"
19
+ }
20
+ export declare enum FEATURE_TYPE {
21
+ ADD_USER = "ADD_USER",
22
+ DELETE_USER = "DELETE_USER",
23
+ MODIFY_USER = "MODIFY_USER",
24
+ LIST_USER = "LIST_USER",
25
+ ADD_USER_GROUP = "ADD_USER_GROUP",
26
+ DELETE_USER_GROUP = "DELETE_USER_GROUP",
27
+ MODIFY_USER_GROUP = "MODIFY_USER_GROUP",
28
+ LIST_USER_GROUP = "LIST_USER_GROUP",
29
+ PREVIEW_PRE_BUILT_TEMPLATE = "PREVIEW_PRE_BUILT_TEMPLATE",
30
+ CLONE_TEMPLATE = "CLONE_TEMPLATE",
31
+ CREATE_TEMPLATE = "CREATE_TEMPLATE",
32
+ DELETE_TEMPLATE = "DELETE_TEMPLATE",
33
+ SHARE_TEMPLATE = "SHARE_TEMPLATE",
34
+ UPDATE_TEAMPLATE = "UPDATE_TEAMPLATE",
35
+ LIST_TEMPLATE = "LIST_TEMPLATE"
36
+ }
14
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAEnC,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,oBAAY,YAAY;IAEtB,QAAQ,aAAW;IACnB,WAAW,gBAAc;IACzB,WAAW,gBAAc;IACzB,SAAS,cAAY;IAGrB,cAAc,mBAAiB;IAC/B,iBAAiB,sBAAoB;IACrC,iBAAiB,sBAAoB;IACrC,eAAe,oBAAkB;IAGjC,0BAA0B,+BAA6B;IACvD,cAAc,mBAAiB;IAC/B,eAAe,oBAAkB;IACjC,eAAe,oBAAkB;IACjC,cAAc,mBAAiB;IAC/B,gBAAgB,qBAAmB;IACnC,aAAa,kBAAgB;CAC9B"}
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.RECORD_TYPE = exports.ROLES = void 0;
17
+ exports.FEATURE_TYPE = exports.OWNERSHIP_TYPE = exports.RECORD_TYPE = exports.ROLES = void 0;
18
18
  __exportStar(require("./callWithRetries"), exports);
19
19
  __exportStar(require("./createFolder"), exports);
20
20
  __exportStar(require("./encryptionUtils"), exports);
@@ -30,3 +30,31 @@ var RECORD_TYPE;
30
30
  RECORD_TYPE["ARCHIVE"] = "ARCHIVE";
31
31
  RECORD_TYPE["NON_ARCHIVE"] = "NON_ARCHIVE";
32
32
  })(RECORD_TYPE || (exports.RECORD_TYPE = RECORD_TYPE = {}));
33
+ var OWNERSHIP_TYPE;
34
+ (function (OWNERSHIP_TYPE) {
35
+ OWNERSHIP_TYPE["OWNER"] = "OWNER";
36
+ OWNERSHIP_TYPE["CO_OWNER"] = "CO_OWNER";
37
+ OWNERSHIP_TYPE["VIEWER"] = "VIEWER";
38
+ OWNERSHIP_TYPE["EDITOR"] = "EDITOR";
39
+ })(OWNERSHIP_TYPE || (exports.OWNERSHIP_TYPE = OWNERSHIP_TYPE = {}));
40
+ var FEATURE_TYPE;
41
+ (function (FEATURE_TYPE) {
42
+ // MANAGE USER
43
+ FEATURE_TYPE["ADD_USER"] = "ADD_USER";
44
+ FEATURE_TYPE["DELETE_USER"] = "DELETE_USER";
45
+ FEATURE_TYPE["MODIFY_USER"] = "MODIFY_USER";
46
+ FEATURE_TYPE["LIST_USER"] = "LIST_USER";
47
+ // MANAGE GROUPS
48
+ FEATURE_TYPE["ADD_USER_GROUP"] = "ADD_USER_GROUP";
49
+ FEATURE_TYPE["DELETE_USER_GROUP"] = "DELETE_USER_GROUP";
50
+ FEATURE_TYPE["MODIFY_USER_GROUP"] = "MODIFY_USER_GROUP";
51
+ FEATURE_TYPE["LIST_USER_GROUP"] = "LIST_USER_GROUP";
52
+ // MANAGE TEMPLATE
53
+ FEATURE_TYPE["PREVIEW_PRE_BUILT_TEMPLATE"] = "PREVIEW_PRE_BUILT_TEMPLATE";
54
+ FEATURE_TYPE["CLONE_TEMPLATE"] = "CLONE_TEMPLATE";
55
+ FEATURE_TYPE["CREATE_TEMPLATE"] = "CREATE_TEMPLATE";
56
+ FEATURE_TYPE["DELETE_TEMPLATE"] = "DELETE_TEMPLATE";
57
+ FEATURE_TYPE["SHARE_TEMPLATE"] = "SHARE_TEMPLATE";
58
+ FEATURE_TYPE["UPDATE_TEAMPLATE"] = "UPDATE_TEAMPLATE";
59
+ FEATURE_TYPE["LIST_TEMPLATE"] = "LIST_TEMPLATE";
60
+ })(FEATURE_TYPE || (exports.FEATURE_TYPE = FEATURE_TYPE = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz-email-builder-shared",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [