biz-slide-core 1.2.86 → 1.2.87
Sign up to get free protection for your applications and to get access to all the features.
- package/{entity → dist/entity}/analytic.entity.js +4 -4
- package/{entity → dist/entity}/config.enity.js +2 -2
- package/{entity → dist/entity}/cron.entity.js +2 -2
- package/{entity → dist/entity}/customer.entity.js +3 -3
- package/{entity → dist/entity}/image.entity.js +2 -2
- package/{entity → dist/entity}/logs.entity.js +2 -2
- package/{entity → dist/entity}/png-svg.entity.js +2 -2
- package/{entity → dist/entity}/ppt-email-queue.entity.js +2 -2
- package/{entity → dist/entity}/ppt-event.entity.js +2 -2
- package/{entity → dist/entity}/ppt-slide.entity.js +2 -2
- package/{entity → dist/entity}/ppt.entity.d.ts +1 -0
- package/{entity → dist/entity}/ppt.entity.d.ts.map +1 -1
- package/{entity → dist/entity}/ppt.entity.js +2 -2
- package/{entity → dist/entity}/slide-layout.entity.js +4 -4
- package/{entity → dist/entity}/slide.entity.js +3 -3
- package/{entity → dist/entity}/socket.entity.js +2 -2
- package/{entity → dist/entity}/template-type.entity.js +6 -6
- package/{entity → dist/entity}/template.entity.js +2 -2
- package/{entity → dist/entity}/training-queue.entity.js +2 -2
- package/{entity → dist/entity}/user.entity.js +2 -2
- package/dist/middleware/authentication.js +141 -0
- package/dist/middleware/schemaValidate.js +16 -0
- package/dist/resHandler/errorHandler.js +55 -0
- package/{resHandler → dist/resHandler}/successHandler.js +1 -1
- package/dist/utilities/callWithRetries.js +15 -0
- package/dist/utilities/createFolder.js +18 -0
- package/dist/utilities/encryptionUtils.js +26 -0
- package/{utilities → dist/utilities}/hasAbusiveWords.js +4 -5
- package/package.json +3 -1
- package/middleware/authentication.js +0 -244
- package/middleware/schemaValidate.js +0 -58
- package/resHandler/errorHandler.js +0 -77
- package/utilities/callWithRetries.js +0 -73
- package/utilities/createFolder.js +0 -59
- package/utilities/encryptionUtils.js +0 -66
- /package/{entity → dist/entity}/analytic.entity.d.ts +0 -0
- /package/{entity → dist/entity}/analytic.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/common.d.ts +0 -0
- /package/{entity → dist/entity}/common.d.ts.map +0 -0
- /package/{entity → dist/entity}/common.js +0 -0
- /package/{entity → dist/entity}/config.enity.d.ts +0 -0
- /package/{entity → dist/entity}/config.enity.d.ts.map +0 -0
- /package/{entity → dist/entity}/cron.entity.d.ts +0 -0
- /package/{entity → dist/entity}/cron.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/customer.entity.d.ts +0 -0
- /package/{entity → dist/entity}/customer.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/image.entity.d.ts +0 -0
- /package/{entity → dist/entity}/image.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/index.d.ts +0 -0
- /package/{entity → dist/entity}/index.d.ts.map +0 -0
- /package/{entity → dist/entity}/index.js +0 -0
- /package/{entity → dist/entity}/logs.entity.d.ts +0 -0
- /package/{entity → dist/entity}/logs.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/png-svg.entity.d.ts +0 -0
- /package/{entity → dist/entity}/png-svg.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/ppt-email-queue.entity.d.ts +0 -0
- /package/{entity → dist/entity}/ppt-email-queue.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/ppt-event.entity.d.ts +0 -0
- /package/{entity → dist/entity}/ppt-event.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/ppt-slide.entity.d.ts +0 -0
- /package/{entity → dist/entity}/ppt-slide.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/slide-layout.entity.d.ts +0 -0
- /package/{entity → dist/entity}/slide-layout.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/slide.entity.d.ts +0 -0
- /package/{entity → dist/entity}/slide.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/socket.entity.d.ts +0 -0
- /package/{entity → dist/entity}/socket.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/template-type.entity.d.ts +0 -0
- /package/{entity → dist/entity}/template-type.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/template.entity.d.ts +0 -0
- /package/{entity → dist/entity}/template.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/training-queue.entity.d.ts +0 -0
- /package/{entity → dist/entity}/training-queue.entity.d.ts.map +0 -0
- /package/{entity → dist/entity}/user.entity.d.ts +0 -0
- /package/{entity → dist/entity}/user.entity.d.ts.map +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.d.ts.map → dist/index.d.ts.map} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{middleware → dist/middleware}/authentication.d.ts +0 -0
- /package/{middleware → dist/middleware}/authentication.d.ts.map +0 -0
- /package/{middleware → dist/middleware}/index.d.ts +0 -0
- /package/{middleware → dist/middleware}/index.d.ts.map +0 -0
- /package/{middleware → dist/middleware}/index.js +0 -0
- /package/{middleware → dist/middleware}/role.d.ts +0 -0
- /package/{middleware → dist/middleware}/role.d.ts.map +0 -0
- /package/{middleware → dist/middleware}/role.js +0 -0
- /package/{middleware → dist/middleware}/schemaValidate.d.ts +0 -0
- /package/{middleware → dist/middleware}/schemaValidate.d.ts.map +0 -0
- /package/{resHandler → dist/resHandler}/errorHandler.d.ts +0 -0
- /package/{resHandler → dist/resHandler}/errorHandler.d.ts.map +0 -0
- /package/{resHandler → dist/resHandler}/index.d.ts +0 -0
- /package/{resHandler → dist/resHandler}/index.d.ts.map +0 -0
- /package/{resHandler → dist/resHandler}/index.js +0 -0
- /package/{resHandler → dist/resHandler}/successHandler.d.ts +0 -0
- /package/{resHandler → dist/resHandler}/successHandler.d.ts.map +0 -0
- /package/{types → dist/types}/IController.d.ts +0 -0
- /package/{types → dist/types}/IController.d.ts.map +0 -0
- /package/{types → dist/types}/IController.js +0 -0
- /package/{types → dist/types}/IRequest.d.ts +0 -0
- /package/{types → dist/types}/IRequest.d.ts.map +0 -0
- /package/{types → dist/types}/IRequest.js +0 -0
- /package/{types → dist/types}/index.d.ts +0 -0
- /package/{types → dist/types}/index.d.ts.map +0 -0
- /package/{types → dist/types}/index.js +0 -0
- /package/{utilities → dist/utilities}/callWithRetries.d.ts +0 -0
- /package/{utilities → dist/utilities}/callWithRetries.d.ts.map +0 -0
- /package/{utilities → dist/utilities}/createFolder.d.ts +0 -0
- /package/{utilities → dist/utilities}/createFolder.d.ts.map +0 -0
- /package/{utilities → dist/utilities}/encryptionUtils.d.ts +0 -0
- /package/{utilities → dist/utilities}/encryptionUtils.d.ts.map +0 -0
- /package/{utilities → dist/utilities}/hasAbusiveWords.d.ts +0 -0
- /package/{utilities → dist/utilities}/hasAbusiveWords.d.ts.map +0 -0
- /package/{utilities → dist/utilities}/index.d.ts +0 -0
- /package/{utilities → dist/utilities}/index.d.ts.map +0 -0
- /package/{utilities → dist/utilities}/index.js +0 -0
- /package/{utilities → dist/utilities}/pngSvgCategories.d.ts +0 -0
- /package/{utilities → dist/utilities}/pngSvgCategories.d.ts.map +0 -0
- /package/{utilities → dist/utilities}/pngSvgCategories.js +0 -0
@@ -1,15 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.AnalyticModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const eventSchema = new mongoose_1.Schema({
|
6
6
|
name: { type: String, required: true },
|
7
7
|
count: { type: Number, default: 0 }
|
8
8
|
}, {
|
9
9
|
timestamps: false,
|
10
10
|
_id: false
|
11
11
|
});
|
12
|
-
|
12
|
+
const layoutAnalyticsSchema = new mongoose_1.Schema({
|
13
13
|
name: { type: String, required: true },
|
14
14
|
count: { type: Number, default: 0 },
|
15
15
|
percentage: { type: Number, default: 0 }
|
@@ -17,7 +17,7 @@ var layoutAnalyticsSchema = new mongoose_1.Schema({
|
|
17
17
|
timestamps: false,
|
18
18
|
_id: false
|
19
19
|
});
|
20
|
-
|
20
|
+
const AnalyticSchema = new mongoose_1.Schema({
|
21
21
|
templateTypeId: { type: mongoose_1.Schema.Types.ObjectId, ref: "template-type" },
|
22
22
|
appName: { type: String, required: true },
|
23
23
|
noOfPPT: { type: Number, default: 0 },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ConfigModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const CongigSchema = new mongoose_1.Schema({
|
6
6
|
configType: { type: String, required: true },
|
7
7
|
value: { type: String, required: true },
|
8
8
|
}, {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.CronModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const CronSchema = new mongoose_1.Schema({
|
6
6
|
name: { type: String, required: true },
|
7
7
|
status: { type: Boolean, default: false }
|
8
8
|
}, {
|
@@ -1,14 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.CustomerModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const EmailTemplateStatusSchema = new mongoose_1.Schema({
|
6
6
|
sent: { type: Boolean, default: false },
|
7
7
|
}, {
|
8
8
|
timestamps: false,
|
9
9
|
_id: false
|
10
10
|
});
|
11
|
-
|
11
|
+
const CustomerSchema = new mongoose_1.Schema({
|
12
12
|
appName: { type: String, required: true },
|
13
13
|
userId: { type: String, required: true },
|
14
14
|
emailId: { type: String, default: "" },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ImageModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const ImageSchema = new mongoose_1.Schema({
|
6
6
|
focusPoint: { x: Number, y: Number },
|
7
7
|
url: { type: String, required: true },
|
8
8
|
radius: { type: String, required: true },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.LogsModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const LogsSchema = new mongoose_1.Schema({
|
6
6
|
type: { type: String, required: true },
|
7
7
|
event: { type: String, required: true },
|
8
8
|
message: { type: String, required: true },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PngSvgModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const PngSvgSchema = new mongoose_1.Schema({
|
6
6
|
deletedAt: { type: Date, default: null },
|
7
7
|
isLocked: { type: Boolean, default: false },
|
8
8
|
optionsDownloaded: mongoose_1.Schema.Types.Mixed,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PPTEmailQueueModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const PPTEmailQueueSchema = new mongoose_1.Schema({
|
6
6
|
pptRef: { type: mongoose_1.Schema.Types.ObjectId, ref: 'ppt' },
|
7
7
|
emailType: { type: String, required: true },
|
8
8
|
sent: { type: Boolean, default: false }
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PPTSlideEventModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const PPTEventSchema = new mongoose_1.Schema({
|
6
6
|
pptRef: { type: mongoose_1.Schema.Types.ObjectId, ref: 'ppt' },
|
7
7
|
message: { type: String, default: null },
|
8
8
|
event: { type: String, default: null },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PPTSlideModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const PPTSlideSchema = new mongoose_1.Schema({
|
6
6
|
deletedAt: { type: Date, default: null },
|
7
7
|
pptRef: { type: mongoose_1.Schema.Types.ObjectId, ref: 'ppt' },
|
8
8
|
slideRef: { type: mongoose_1.Schema.Types.ObjectId, ref: 'slide' },
|
@@ -55,6 +55,7 @@ export interface IPPTSchema {
|
|
55
55
|
navigateFromGPT: boolean;
|
56
56
|
googleDriveId: string;
|
57
57
|
isPartialFile: boolean;
|
58
|
+
isEditable: boolean;
|
58
59
|
}
|
59
60
|
export declare const PPTModel: import("mongoose").Model<IPPTSchema, {}, {}, {}, import("mongoose").Document<unknown, {}, IPPTSchema> & Omit<IPPTSchema & {
|
60
61
|
_id: Types.ObjectId;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ppt.entity.d.ts","sourceRoot":"","sources":["../../src/entity/ppt.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,UAAU;IACvB,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"ppt.entity.d.ts","sourceRoot":"","sources":["../../src/entity/ppt.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,UAAU;IACvB,qBAAqB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,SAAS,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;CACvB;AA2CD,eAAO,MAAM,QAAQ;;eAAsC,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.PPTModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const PPTSchema = new mongoose_1.Schema({
|
6
6
|
deletedAt: { type: Date, default: null },
|
7
7
|
isLocked: { type: Boolean, default: false },
|
8
8
|
isCompleted: { type: Boolean, default: false },
|
@@ -1,22 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.SlideLayoutModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const messageSchema = new mongoose_1.Schema({
|
6
6
|
message: { type: String },
|
7
7
|
keys: { type: [String] },
|
8
8
|
}, {
|
9
9
|
timestamps: false,
|
10
10
|
_id: false
|
11
11
|
});
|
12
|
-
|
12
|
+
const systemSchema = new mongoose_1.Schema({
|
13
13
|
system: messageSchema,
|
14
14
|
user: messageSchema
|
15
15
|
}, {
|
16
16
|
timestamps: false,
|
17
17
|
_id: false
|
18
18
|
});
|
19
|
-
|
19
|
+
const SlideLayoutSchema = new mongoose_1.Schema({
|
20
20
|
published: { type: Boolean, default: false },
|
21
21
|
name: { type: String, default: "", required: true },
|
22
22
|
displayName: { type: String, default: "" },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.SlideModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const layerSchema = new mongoose_1.Schema({
|
6
6
|
metaType: { type: String, enum: ['text', 'image', 'shape', 'list', 'table'] },
|
7
7
|
optionsMeta: { type: String },
|
8
8
|
chatMeta: { type: String },
|
@@ -10,7 +10,7 @@ var layerSchema = new mongoose_1.Schema({
|
|
10
10
|
timestamps: false,
|
11
11
|
_id: false
|
12
12
|
});
|
13
|
-
|
13
|
+
const SlideSchema = new mongoose_1.Schema({
|
14
14
|
name: { type: String, default: "", required: true },
|
15
15
|
published: { type: Boolean, default: false },
|
16
16
|
postfix: { type: String, default: "" },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.SocketModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const SocketSchema = new mongoose_1.Schema({
|
6
6
|
userId: { type: String, default: null },
|
7
7
|
socketIds: { type: [String], default: [] }
|
8
8
|
}, {
|
@@ -1,36 +1,36 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TemplateTypeModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const layoutsSchema = new mongoose_1.Schema({
|
6
6
|
title: { type: String },
|
7
7
|
layoutType: { type: String },
|
8
8
|
}, {
|
9
9
|
timestamps: false,
|
10
10
|
_id: false
|
11
11
|
});
|
12
|
-
|
12
|
+
const messageSchema = new mongoose_1.Schema({
|
13
13
|
message: { type: String },
|
14
14
|
keys: { type: [String] },
|
15
15
|
}, {
|
16
16
|
timestamps: false,
|
17
17
|
_id: false
|
18
18
|
});
|
19
|
-
|
19
|
+
const systemSchema = new mongoose_1.Schema({
|
20
20
|
system: messageSchema,
|
21
21
|
user: messageSchema
|
22
22
|
}, {
|
23
23
|
timestamps: false,
|
24
24
|
_id: false
|
25
25
|
});
|
26
|
-
|
26
|
+
const variantsSystemSchema = new mongoose_1.Schema({
|
27
27
|
single: systemSchema,
|
28
28
|
multiple: systemSchema
|
29
29
|
}, {
|
30
30
|
timestamps: false,
|
31
31
|
_id: false
|
32
32
|
});
|
33
|
-
|
33
|
+
const TemplateTypeSchema = new mongoose_1.Schema({
|
34
34
|
published: { type: Boolean, default: false },
|
35
35
|
name: { type: String, default: "", required: true },
|
36
36
|
layouts: [layoutsSchema],
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TemplateModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const TemplateSchema = new mongoose_1.Schema({
|
6
6
|
name: { type: String, default: "", required: true },
|
7
7
|
published: { type: Boolean, default: false },
|
8
8
|
templateTypeId: { type: mongoose_1.Schema.Types.ObjectId, ref: "template-type" },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TrainingQueueModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const TrainingQueueSchema = new mongoose_1.Schema({
|
6
6
|
filename: { type: String, default: null },
|
7
7
|
isCompleted: { type: Boolean, default: false },
|
8
8
|
userId: { type: mongoose_1.Schema.Types.ObjectId, ref: "user" },
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.UserModel = void 0;
|
4
|
-
|
5
|
-
|
4
|
+
const mongoose_1 = require("mongoose");
|
5
|
+
const UserSchema = new mongoose_1.Schema({
|
6
6
|
email: { type: String, unique: true, sparse: true },
|
7
7
|
password: { type: String, default: null },
|
8
8
|
role: { type: String, default: null },
|
@@ -0,0 +1,141 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
3
|
+
var t = {};
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
+
t[p] = s[p];
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
+
t[p[i]] = s[p[i]];
|
10
|
+
}
|
11
|
+
return t;
|
12
|
+
};
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
+
exports.authorizeWithGpt = exports.nonAuthorizeWithSlideApp = exports.authorizeWithSlideApp = exports.authorize = void 0;
|
15
|
+
const utilities_1 = require("../utilities");
|
16
|
+
const entity_1 = require("../entity");
|
17
|
+
const authorize = (roles) => {
|
18
|
+
return async function (req, res, next) {
|
19
|
+
if (!req.headers.authorization) {
|
20
|
+
return res.status(401).json({ message: 'Unauthorized' });
|
21
|
+
}
|
22
|
+
if (!roles.length) {
|
23
|
+
return res.status(401).json({ message: 'Unauthorized' });
|
24
|
+
}
|
25
|
+
if (req.headers.authorization) {
|
26
|
+
const token = await (0, utilities_1.verifyUid)(req.headers.authorization);
|
27
|
+
if (!token) {
|
28
|
+
return res.status(401).json({ message: 'Session Expired' });
|
29
|
+
}
|
30
|
+
let user = await entity_1.UserModel.findOne({ email: token.value.email });
|
31
|
+
if (!user) {
|
32
|
+
return res.status(401).json({ message: 'No User Found' });
|
33
|
+
}
|
34
|
+
const hasAccess = roles.find(role => role === user.role);
|
35
|
+
if (!hasAccess) {
|
36
|
+
return res.status(403).json({ message: 'Forbbiden' });
|
37
|
+
}
|
38
|
+
const _a = user.toObject(), { createdAt, updatedAt, deletedAt, password } = _a, rest = __rest(_a, ["createdAt", "updatedAt", "deletedAt", "password"]);
|
39
|
+
req.user = Object.assign(Object.assign({}, rest), { userId: rest.email });
|
40
|
+
next();
|
41
|
+
}
|
42
|
+
};
|
43
|
+
};
|
44
|
+
exports.authorize = authorize;
|
45
|
+
const createUser = async (emailId, userId, appName) => {
|
46
|
+
const customer = await entity_1.CustomerModel.findOne({ userId });
|
47
|
+
if (!customer) {
|
48
|
+
const newCustomer = new entity_1.CustomerModel({
|
49
|
+
appName: appName || "default",
|
50
|
+
emailId,
|
51
|
+
emailTemplateStatus: {},
|
52
|
+
userId
|
53
|
+
});
|
54
|
+
await newCustomer.save();
|
55
|
+
}
|
56
|
+
};
|
57
|
+
const authorizeWithSlideApp = () => {
|
58
|
+
return async function (req, res, next) {
|
59
|
+
var _a;
|
60
|
+
const ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
61
|
+
const sessionId = req.headers['x-fingerprint-key'];
|
62
|
+
if (!req.headers.authorization) {
|
63
|
+
return res.status(401).json({ message: 'Unauthorized' });
|
64
|
+
}
|
65
|
+
if (req.headers.authorization) {
|
66
|
+
const token = await (0, utilities_1.verifyUid)(req.headers.authorization);
|
67
|
+
if (!token) {
|
68
|
+
return res.status(401).json({ message: 'Session Expired' });
|
69
|
+
}
|
70
|
+
const userId = (token === null || token === void 0 ? void 0 : token.customer_id) || ((_a = token === null || token === void 0 ? void 0 : token.value) === null || _a === void 0 ? void 0 : _a.email);
|
71
|
+
if (!userId) {
|
72
|
+
return res.status(401).json({ message: 'userId not found' });
|
73
|
+
}
|
74
|
+
req.user = {
|
75
|
+
userId: userId,
|
76
|
+
sessionId,
|
77
|
+
ipAddress,
|
78
|
+
appName: req.headers['x-app-name'],
|
79
|
+
email: (token === null || token === void 0 ? void 0 : token.customer_email) || ""
|
80
|
+
};
|
81
|
+
await createUser(req.user.email, req.user.userId, req.user.appName);
|
82
|
+
next();
|
83
|
+
}
|
84
|
+
};
|
85
|
+
};
|
86
|
+
exports.authorizeWithSlideApp = authorizeWithSlideApp;
|
87
|
+
const nonAuthorizeWithSlideApp = () => {
|
88
|
+
return async function (req, res, next) {
|
89
|
+
var _a;
|
90
|
+
const ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
91
|
+
const sessionId = req.headers['x-fingerprint-key'];
|
92
|
+
let userId = "guest";
|
93
|
+
let email = "";
|
94
|
+
if (req.headers.authorization) {
|
95
|
+
const token = await (0, utilities_1.verifyUid)(req.headers.authorization);
|
96
|
+
if (!token) {
|
97
|
+
return res.status(401).json({ message: 'Session Expired' });
|
98
|
+
}
|
99
|
+
userId = (token === null || token === void 0 ? void 0 : token.customer_id) || ((_a = token === null || token === void 0 ? void 0 : token.value) === null || _a === void 0 ? void 0 : _a.email);
|
100
|
+
email = (token === null || token === void 0 ? void 0 : token.customer_email) || "";
|
101
|
+
if (!userId) {
|
102
|
+
return res.status(401).json({ message: 'userId not found' });
|
103
|
+
}
|
104
|
+
await createUser(email, userId, req.headers['x-app-name']);
|
105
|
+
}
|
106
|
+
else {
|
107
|
+
if (!ipAddress || !sessionId) {
|
108
|
+
return res.status(401).json({ message: 'We are not able to track your actions' });
|
109
|
+
}
|
110
|
+
}
|
111
|
+
req.user = {
|
112
|
+
userId,
|
113
|
+
sessionId,
|
114
|
+
ipAddress,
|
115
|
+
appName: req.headers['x-app-name'],
|
116
|
+
email
|
117
|
+
};
|
118
|
+
next();
|
119
|
+
};
|
120
|
+
};
|
121
|
+
exports.nonAuthorizeWithSlideApp = nonAuthorizeWithSlideApp;
|
122
|
+
// TODO: Delete It
|
123
|
+
const authorizeWithGpt = () => {
|
124
|
+
return async function (req, res, next) {
|
125
|
+
const secret = req.headers['authorization'];
|
126
|
+
const secretKey = secret ? secret.split(":") : undefined;
|
127
|
+
if (secretKey && secretKey.length === 2 && secretKey[0] !== `Bearer ${process.env.GPT_API_KEY}`) {
|
128
|
+
return res.status(401).json({ message: 'keys not matching' });
|
129
|
+
}
|
130
|
+
const ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
131
|
+
let userId = "guest";
|
132
|
+
req.user = {
|
133
|
+
userId,
|
134
|
+
ipAddress,
|
135
|
+
appName: secretKey[1],
|
136
|
+
navigateFromGPT: true
|
137
|
+
};
|
138
|
+
next();
|
139
|
+
};
|
140
|
+
};
|
141
|
+
exports.authorizeWithGpt = authorizeWithGpt;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validateSchema = void 0;
|
4
|
+
const validateSchema = (schema) => {
|
5
|
+
return async function (req, res, next) {
|
6
|
+
const { error } = schema.validate(req.body, { abortEarly: false });
|
7
|
+
if (error) {
|
8
|
+
const errorMessage = error.details.map((err) => err.message).join(', ');
|
9
|
+
return res.status(400).json({ message: errorMessage });
|
10
|
+
}
|
11
|
+
else {
|
12
|
+
next();
|
13
|
+
}
|
14
|
+
};
|
15
|
+
};
|
16
|
+
exports.validateSchema = validateSchema;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.errorHandler = exports.CustomRequestError = exports.NotFoundRequestError = exports.BadRequestError = void 0;
|
4
|
+
class BadRequestError extends Error {
|
5
|
+
constructor(message) {
|
6
|
+
super(message);
|
7
|
+
Object.setPrototypeOf(this, BadRequestError.prototype);
|
8
|
+
this.name = 'BadRequestError';
|
9
|
+
}
|
10
|
+
}
|
11
|
+
exports.BadRequestError = BadRequestError;
|
12
|
+
class NotFoundRequestError extends Error {
|
13
|
+
constructor(message) {
|
14
|
+
super(message);
|
15
|
+
Object.setPrototypeOf(this, NotFoundRequestError.prototype);
|
16
|
+
this.name = 'NotFoundRequestError';
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.NotFoundRequestError = NotFoundRequestError;
|
20
|
+
class CustomRequestError {
|
21
|
+
constructor(title, description) {
|
22
|
+
this.name = 'CustomRequestError';
|
23
|
+
this.message = {
|
24
|
+
title,
|
25
|
+
description
|
26
|
+
};
|
27
|
+
}
|
28
|
+
}
|
29
|
+
exports.CustomRequestError = CustomRequestError;
|
30
|
+
// Custom error handler middleware
|
31
|
+
const errorHandler = (err, req, res, next) => {
|
32
|
+
let statusCode = 500; // Default status code
|
33
|
+
let errorMessage = 'Internal Server Error'; // Default error message
|
34
|
+
if (err instanceof BadRequestError) {
|
35
|
+
statusCode = 400;
|
36
|
+
errorMessage = err.message;
|
37
|
+
}
|
38
|
+
else if (err instanceof NotFoundRequestError) {
|
39
|
+
statusCode = 404;
|
40
|
+
errorMessage = err.message;
|
41
|
+
}
|
42
|
+
else if (err instanceof CustomRequestError) {
|
43
|
+
statusCode = 422;
|
44
|
+
errorMessage = err.message;
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
console.error(err.stack); // Log the error for debugging
|
48
|
+
}
|
49
|
+
// Send an error response
|
50
|
+
res.status(statusCode).json({
|
51
|
+
message: errorMessage,
|
52
|
+
error: err.name // Optionally send the error name/type
|
53
|
+
});
|
54
|
+
};
|
55
|
+
exports.errorHandler = errorHandler;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.successHandler = void 0;
|
4
4
|
// Generic success handler middleware
|
5
|
-
|
5
|
+
const successHandler = (data, req, res, next) => {
|
6
6
|
res.status(200).json(data);
|
7
7
|
};
|
8
8
|
exports.successHandler = successHandler;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.callWithRetries = void 0;
|
4
|
+
async function callWithRetries(retryCount, failedMessage, functionRef, ...args) {
|
5
|
+
try {
|
6
|
+
return await functionRef(...args);
|
7
|
+
}
|
8
|
+
catch (error) {
|
9
|
+
if (retryCount <= 0)
|
10
|
+
throw error;
|
11
|
+
console.log("callWithRetries", (error === null || error === void 0 ? void 0 : error.message) || error);
|
12
|
+
return callWithRetries(retryCount - 1, failedMessage, functionRef, ...args);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
exports.callWithRetries = callWithRetries;
|
@@ -0,0 +1,18 @@
|
|
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.createFolder = void 0;
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
8
|
+
async function createFolder(folderPath) {
|
9
|
+
try {
|
10
|
+
if (!fs_1.default.existsSync(folderPath)) {
|
11
|
+
fs_1.default.mkdirSync(folderPath);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
catch (error) {
|
15
|
+
console.error(`Error: ${error.message}`);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
exports.createFolder = createFolder;
|
@@ -0,0 +1,26 @@
|
|
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.verifyUid = exports.signUid = void 0;
|
7
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
8
|
+
const signUid = (value) => {
|
9
|
+
return jsonwebtoken_1.default.sign({ value }, process.env.JWTSECRET || 'secret', {
|
10
|
+
expiresIn: '8h' // expires in 8 hours
|
11
|
+
});
|
12
|
+
};
|
13
|
+
exports.signUid = signUid;
|
14
|
+
const verifyUid = async (token) => new Promise(resolve => {
|
15
|
+
const jwtToken = token.split(" ")[1] || token;
|
16
|
+
jsonwebtoken_1.default.verify(jwtToken, process.env.JWTSECRET || 'secret', (err, decoded) => {
|
17
|
+
if (err) {
|
18
|
+
// console.log("error verifyUid", err)
|
19
|
+
resolve(null);
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
resolve(decoded);
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
exports.verifyUid = verifyUid;
|
@@ -3,27 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasAbusiveWords = exports.hasSpecialCharacter = exports.hasExactMatch = void 0;
|
4
4
|
function hasExactMatch(str, word) {
|
5
5
|
// Construct a regular expression to match the word as a whole word
|
6
|
-
|
6
|
+
const regex = new RegExp('\\b' + word + '\\b', 'i'); // 'i' for case-insensitive matching
|
7
7
|
// Test if the word has an exact match in the string
|
8
8
|
return regex.test(str);
|
9
9
|
}
|
10
10
|
exports.hasExactMatch = hasExactMatch;
|
11
11
|
function hasSpecialCharacter(str) {
|
12
12
|
// Define a regular expression with a character class containing special characters
|
13
|
-
|
13
|
+
const regex = /[!@#$%^&*()_+\-=\[\]{};:\\|<>\/?]/;
|
14
14
|
// Test if the string contains any special character
|
15
15
|
return regex.test(str);
|
16
16
|
}
|
17
17
|
exports.hasSpecialCharacter = hasSpecialCharacter;
|
18
18
|
function hasAbusiveWords(str, words) {
|
19
19
|
// Convert the string to lowercase for case-insensitive matching
|
20
|
-
|
20
|
+
const lowerStr = str.toLowerCase();
|
21
21
|
if (hasSpecialCharacter(lowerStr)) {
|
22
22
|
return true;
|
23
23
|
}
|
24
24
|
// Check if any abusive word exists in the string
|
25
|
-
for (
|
26
|
-
var word = words_1[_i];
|
25
|
+
for (const word of words) {
|
27
26
|
if (hasExactMatch(lowerStr, word.toLowerCase())) {
|
28
27
|
return true;
|
29
28
|
}
|
package/package.json
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "biz-slide-core",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.87",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
|
+
"types": "dist/index.d.ts",
|
7
|
+
"files": ["dist"],
|
6
8
|
"scripts": {
|
7
9
|
"build": "tsc",
|
8
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|