biz-slide-core 1.2.85 → 1.2.86
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/entity/analytic.entity.ts +0 -62
- package/src/entity/common.ts +0 -19
- package/src/entity/config.enity.ts +0 -18
- package/src/entity/cron.entity.ts +0 -22
- package/src/entity/customer.entity.ts +0 -40
- package/src/entity/image.entity.ts +0 -32
- package/src/entity/index.ts +0 -20
- package/src/entity/logs.entity.ts +0 -20
- package/src/entity/png-svg.entity.ts +0 -44
- package/src/entity/ppt-email-queue.entity.ts +0 -22
- package/src/entity/ppt-event.entity.ts +0 -25
- package/src/entity/ppt-slide.entity.ts +0 -40
- package/src/entity/ppt.entity.ts +0 -79
- package/src/entity/slide-layout.entity.ts +0 -56
- package/src/entity/slide.entity.ts +0 -61
- package/src/entity/socket.entity.ts +0 -20
- package/src/entity/template-type.entity.ts +0 -87
- package/src/entity/template.entity.ts +0 -38
- package/src/entity/training-queue.entity.ts +0 -26
- package/src/entity/user.entity.ts +0 -24
- package/src/index.ts +0 -6
- package/src/middleware/authentication.ts +0 -150
- package/src/middleware/index.ts +0 -3
- package/src/middleware/role.ts +0 -5
- package/src/middleware/schemaValidate.ts +0 -20
- package/src/resHandler/errorHandler.ts +0 -66
- package/src/resHandler/index.ts +0 -2
- package/src/resHandler/successHandler.ts +0 -11
- package/src/types/IController.ts +0 -6
- package/src/types/IRequest.ts +0 -8
- package/src/types/index.ts +0 -11
- package/src/utilities/callWithRetries.ts +0 -9
- package/src/utilities/createFolder.ts +0 -11
- package/src/utilities/encryptionUtils.ts +0 -26
- package/src/utilities/hasAbusiveWords.ts +0 -33
- package/src/utilities/index.ts +0 -5
- package/src/utilities/pngSvgCategories.ts +0 -167
- package/tsconfig.json +0 -11
- /package/{dist/entity → entity}/analytic.entity.d.ts +0 -0
- /package/{dist/entity → entity}/analytic.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/analytic.entity.js +0 -0
- /package/{dist/entity → entity}/common.d.ts +0 -0
- /package/{dist/entity → entity}/common.d.ts.map +0 -0
- /package/{dist/entity → entity}/common.js +0 -0
- /package/{dist/entity → entity}/config.enity.d.ts +0 -0
- /package/{dist/entity → entity}/config.enity.d.ts.map +0 -0
- /package/{dist/entity → entity}/config.enity.js +0 -0
- /package/{dist/entity → entity}/cron.entity.d.ts +0 -0
- /package/{dist/entity → entity}/cron.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/cron.entity.js +0 -0
- /package/{dist/entity → entity}/customer.entity.d.ts +0 -0
- /package/{dist/entity → entity}/customer.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/customer.entity.js +0 -0
- /package/{dist/entity → entity}/image.entity.d.ts +0 -0
- /package/{dist/entity → entity}/image.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/image.entity.js +0 -0
- /package/{dist/entity → entity}/index.d.ts +0 -0
- /package/{dist/entity → entity}/index.d.ts.map +0 -0
- /package/{dist/entity → entity}/index.js +0 -0
- /package/{dist/entity → entity}/logs.entity.d.ts +0 -0
- /package/{dist/entity → entity}/logs.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/logs.entity.js +0 -0
- /package/{dist/entity → entity}/png-svg.entity.d.ts +0 -0
- /package/{dist/entity → entity}/png-svg.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/png-svg.entity.js +0 -0
- /package/{dist/entity → entity}/ppt-email-queue.entity.d.ts +0 -0
- /package/{dist/entity → entity}/ppt-email-queue.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/ppt-email-queue.entity.js +0 -0
- /package/{dist/entity → entity}/ppt-event.entity.d.ts +0 -0
- /package/{dist/entity → entity}/ppt-event.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/ppt-event.entity.js +0 -0
- /package/{dist/entity → entity}/ppt-slide.entity.d.ts +0 -0
- /package/{dist/entity → entity}/ppt-slide.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/ppt-slide.entity.js +0 -0
- /package/{dist/entity → entity}/ppt.entity.d.ts +0 -0
- /package/{dist/entity → entity}/ppt.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/ppt.entity.js +0 -0
- /package/{dist/entity → entity}/slide-layout.entity.d.ts +0 -0
- /package/{dist/entity → entity}/slide-layout.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/slide-layout.entity.js +0 -0
- /package/{dist/entity → entity}/slide.entity.d.ts +0 -0
- /package/{dist/entity → entity}/slide.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/slide.entity.js +0 -0
- /package/{dist/entity → entity}/socket.entity.d.ts +0 -0
- /package/{dist/entity → entity}/socket.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/socket.entity.js +0 -0
- /package/{dist/entity → entity}/template-type.entity.d.ts +0 -0
- /package/{dist/entity → entity}/template-type.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/template-type.entity.js +0 -0
- /package/{dist/entity → entity}/template.entity.d.ts +0 -0
- /package/{dist/entity → entity}/template.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/template.entity.js +0 -0
- /package/{dist/entity → entity}/training-queue.entity.d.ts +0 -0
- /package/{dist/entity → entity}/training-queue.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/training-queue.entity.js +0 -0
- /package/{dist/entity → entity}/user.entity.d.ts +0 -0
- /package/{dist/entity → entity}/user.entity.d.ts.map +0 -0
- /package/{dist/entity → entity}/user.entity.js +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/middleware → middleware}/authentication.d.ts +0 -0
- /package/{dist/middleware → middleware}/authentication.d.ts.map +0 -0
- /package/{dist/middleware → middleware}/authentication.js +0 -0
- /package/{dist/middleware → middleware}/index.d.ts +0 -0
- /package/{dist/middleware → middleware}/index.d.ts.map +0 -0
- /package/{dist/middleware → middleware}/index.js +0 -0
- /package/{dist/middleware → middleware}/role.d.ts +0 -0
- /package/{dist/middleware → middleware}/role.d.ts.map +0 -0
- /package/{dist/middleware → middleware}/role.js +0 -0
- /package/{dist/middleware → middleware}/schemaValidate.d.ts +0 -0
- /package/{dist/middleware → middleware}/schemaValidate.d.ts.map +0 -0
- /package/{dist/middleware → middleware}/schemaValidate.js +0 -0
- /package/{dist/resHandler → resHandler}/errorHandler.d.ts +0 -0
- /package/{dist/resHandler → resHandler}/errorHandler.d.ts.map +0 -0
- /package/{dist/resHandler → resHandler}/errorHandler.js +0 -0
- /package/{dist/resHandler → resHandler}/index.d.ts +0 -0
- /package/{dist/resHandler → resHandler}/index.d.ts.map +0 -0
- /package/{dist/resHandler → resHandler}/index.js +0 -0
- /package/{dist/resHandler → resHandler}/successHandler.d.ts +0 -0
- /package/{dist/resHandler → resHandler}/successHandler.d.ts.map +0 -0
- /package/{dist/resHandler → resHandler}/successHandler.js +0 -0
- /package/{dist/types → types}/IController.d.ts +0 -0
- /package/{dist/types → types}/IController.d.ts.map +0 -0
- /package/{dist/types → types}/IController.js +0 -0
- /package/{dist/types → types}/IRequest.d.ts +0 -0
- /package/{dist/types → types}/IRequest.d.ts.map +0 -0
- /package/{dist/types → types}/IRequest.js +0 -0
- /package/{dist/types → types}/index.d.ts +0 -0
- /package/{dist/types → types}/index.d.ts.map +0 -0
- /package/{dist/types → types}/index.js +0 -0
- /package/{dist/utilities → utilities}/callWithRetries.d.ts +0 -0
- /package/{dist/utilities → utilities}/callWithRetries.d.ts.map +0 -0
- /package/{dist/utilities → utilities}/callWithRetries.js +0 -0
- /package/{dist/utilities → utilities}/createFolder.d.ts +0 -0
- /package/{dist/utilities → utilities}/createFolder.d.ts.map +0 -0
- /package/{dist/utilities → utilities}/createFolder.js +0 -0
- /package/{dist/utilities → utilities}/encryptionUtils.d.ts +0 -0
- /package/{dist/utilities → utilities}/encryptionUtils.d.ts.map +0 -0
- /package/{dist/utilities → utilities}/encryptionUtils.js +0 -0
- /package/{dist/utilities → utilities}/hasAbusiveWords.d.ts +0 -0
- /package/{dist/utilities → utilities}/hasAbusiveWords.d.ts.map +0 -0
- /package/{dist/utilities → utilities}/hasAbusiveWords.js +0 -0
- /package/{dist/utilities → utilities}/index.d.ts +0 -0
- /package/{dist/utilities → utilities}/index.d.ts.map +0 -0
- /package/{dist/utilities → utilities}/index.js +0 -0
- /package/{dist/utilities → utilities}/pngSvgCategories.d.ts +0 -0
- /package/{dist/utilities → utilities}/pngSvgCategories.d.ts.map +0 -0
- /package/{dist/utilities → utilities}/pngSvgCategories.js +0 -0
@@ -1,38 +0,0 @@
|
|
1
|
-
import { Schema, model, Types } from "mongoose";
|
2
|
-
|
3
|
-
export interface ITemplateSchema{
|
4
|
-
name: string;
|
5
|
-
templateTypeId: Types.ObjectId;
|
6
|
-
createdAt: Date,
|
7
|
-
updatedAt: Date,
|
8
|
-
deletedAt: Date,
|
9
|
-
defaultColorPallete: Array<string>;
|
10
|
-
colorPalletes: Array<Array<string>>;
|
11
|
-
staticImageDir: string;
|
12
|
-
published: boolean;
|
13
|
-
}
|
14
|
-
|
15
|
-
const TemplateSchema = new Schema<ITemplateSchema>(
|
16
|
-
{
|
17
|
-
name: { type: String, default: "", required: true },
|
18
|
-
published: { type: Boolean, default: false },
|
19
|
-
templateTypeId: { type: Schema.Types.ObjectId, ref: "template-type" },
|
20
|
-
defaultColorPallete: { type: [String], default: [], _id: false },
|
21
|
-
colorPalletes: {
|
22
|
-
type: [
|
23
|
-
{
|
24
|
-
type: [String],
|
25
|
-
default: [],
|
26
|
-
_id: false
|
27
|
-
}
|
28
|
-
], default: [], _id: false
|
29
|
-
},
|
30
|
-
deletedAt: { type: Date, default: null },
|
31
|
-
staticImageDir: { type: String, default: "", required: true }
|
32
|
-
},
|
33
|
-
{
|
34
|
-
timestamps: true,
|
35
|
-
}
|
36
|
-
);
|
37
|
-
|
38
|
-
export const TemplateModel = model<ITemplateSchema>("template", TemplateSchema);
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { Schema, model, Types } from "mongoose";
|
2
|
-
|
3
|
-
interface ITrainingQueue {
|
4
|
-
filename: string,
|
5
|
-
isCompleted: boolean,
|
6
|
-
isLocked: boolean,
|
7
|
-
userId: Types.ObjectId;
|
8
|
-
createdAt: Date,
|
9
|
-
updatedAt: Date,
|
10
|
-
deletedAt: Date
|
11
|
-
}
|
12
|
-
|
13
|
-
const TrainingQueueSchema = new Schema<ITrainingQueue>(
|
14
|
-
{
|
15
|
-
filename: { type: String, default: null },
|
16
|
-
isCompleted: { type: Boolean, default: false },
|
17
|
-
userId: { type: Schema.Types.ObjectId, ref: "user" },
|
18
|
-
isLocked: { type: Boolean, default: false },
|
19
|
-
deletedAt: { type: Date, default: null},
|
20
|
-
},
|
21
|
-
{
|
22
|
-
timestamps: true,
|
23
|
-
}
|
24
|
-
);
|
25
|
-
|
26
|
-
export const TrainingQueueModel = model<ITrainingQueue>("training-queue", TrainingQueueSchema);
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { Schema, model } from "mongoose";
|
2
|
-
|
3
|
-
interface IUser {
|
4
|
-
email: string | null;
|
5
|
-
password: string,
|
6
|
-
role: string,
|
7
|
-
createdAt: Date,
|
8
|
-
updatedAt: Date,
|
9
|
-
deletedAt: Date
|
10
|
-
}
|
11
|
-
|
12
|
-
const UserSchema = new Schema<IUser>(
|
13
|
-
{
|
14
|
-
email: { type: String, unique: true, sparse: true },
|
15
|
-
password: { type: String, default: null },
|
16
|
-
role: { type: String, default: null },
|
17
|
-
deletedAt: { type: Date, default: null},
|
18
|
-
},
|
19
|
-
{
|
20
|
-
timestamps: true,
|
21
|
-
}
|
22
|
-
);
|
23
|
-
|
24
|
-
export const UserModel = model<IUser>("user", UserSchema);
|
package/src/index.ts
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
import { Response, NextFunction } from "express";
|
2
|
-
import { verifyUid } from "../utilities";
|
3
|
-
import { IRequest } from "../types";
|
4
|
-
import { UserModel, CustomerModel } from "../entity";
|
5
|
-
|
6
|
-
|
7
|
-
const authorize = (roles: string[]) => {
|
8
|
-
return async function (req: IRequest, res: Response, next: NextFunction) {
|
9
|
-
if (!req.headers.authorization) {
|
10
|
-
return res.status(401).json({ message: 'Unauthorized' })
|
11
|
-
}
|
12
|
-
if (!roles.length) {
|
13
|
-
return res.status(401).json({ message: 'Unauthorized' })
|
14
|
-
}
|
15
|
-
if (req.headers.authorization) {
|
16
|
-
const token = await verifyUid(req.headers.authorization);
|
17
|
-
if (!token) {
|
18
|
-
return res.status(401).json({ message: 'Session Expired' })
|
19
|
-
}
|
20
|
-
|
21
|
-
let user: any = await UserModel.findOne({ email: token.value.email })
|
22
|
-
|
23
|
-
if (!user) {
|
24
|
-
return res.status(401).json({ message: 'No User Found' })
|
25
|
-
}
|
26
|
-
|
27
|
-
const hasAccess = roles.find(role => role === user.role);
|
28
|
-
|
29
|
-
if (!hasAccess) {
|
30
|
-
return res.status(403).json({ message: 'Forbbiden' })
|
31
|
-
}
|
32
|
-
|
33
|
-
const { createdAt, updatedAt, deletedAt, password, ...rest } = user.toObject();
|
34
|
-
|
35
|
-
req.user = {...rest, userId: rest.email};
|
36
|
-
next();
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
const createUser = async (emailId: string, userId: string, appName: string) => {
|
42
|
-
const customer = await CustomerModel.findOne({userId});
|
43
|
-
if(!customer) {
|
44
|
-
const newCustomer = new CustomerModel({
|
45
|
-
appName: appName || "default",
|
46
|
-
emailId,
|
47
|
-
emailTemplateStatus: {},
|
48
|
-
userId
|
49
|
-
})
|
50
|
-
await newCustomer.save();
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
const authorizeWithSlideApp = () => {
|
55
|
-
return async function (req: IRequest, res: Response, next: NextFunction) {
|
56
|
-
const ipAddress = req.headers['x-forwarded-for'] || (req as any).connection.remoteAddress;
|
57
|
-
const sessionId = req.headers['x-fingerprint-key'];
|
58
|
-
|
59
|
-
if (!req.headers.authorization) {
|
60
|
-
return res.status(401).json({ message: 'Unauthorized' })
|
61
|
-
}
|
62
|
-
|
63
|
-
if (req.headers.authorization) {
|
64
|
-
const token = await verifyUid(req.headers.authorization);
|
65
|
-
if (!token) {
|
66
|
-
return res.status(401).json({ message: 'Session Expired' })
|
67
|
-
}
|
68
|
-
|
69
|
-
const userId = token?.customer_id || token?.value?.email;
|
70
|
-
|
71
|
-
if(!userId) {
|
72
|
-
return res.status(401).json({ message: 'userId not found' })
|
73
|
-
}
|
74
|
-
|
75
|
-
|
76
|
-
req.user = {
|
77
|
-
userId: userId,
|
78
|
-
sessionId,
|
79
|
-
ipAddress,
|
80
|
-
appName: req.headers['x-app-name'],
|
81
|
-
email: token?.customer_email || ""
|
82
|
-
}
|
83
|
-
|
84
|
-
await createUser(req.user.email, req.user.userId, req.user.appName);
|
85
|
-
next();
|
86
|
-
}
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
const nonAuthorizeWithSlideApp = () => {
|
91
|
-
return async function (req: IRequest, res: Response, next: NextFunction) {
|
92
|
-
const ipAddress = req.headers['x-forwarded-for'] || (req as any).connection.remoteAddress;
|
93
|
-
const sessionId = req.headers['x-fingerprint-key'];
|
94
|
-
let userId = "guest";
|
95
|
-
let email = "";
|
96
|
-
|
97
|
-
if (req.headers.authorization) {
|
98
|
-
const token = await verifyUid(req.headers.authorization);
|
99
|
-
if (!token) {
|
100
|
-
return res.status(401).json({ message: 'Session Expired' })
|
101
|
-
}
|
102
|
-
|
103
|
-
userId = token?.customer_id || token?.value?.email;
|
104
|
-
email = token?.customer_email || "";
|
105
|
-
if(!userId) {
|
106
|
-
return res.status(401).json({ message: 'userId not found' })
|
107
|
-
}
|
108
|
-
await createUser(email, userId, req.headers['x-app-name'] as string);
|
109
|
-
} else {
|
110
|
-
if(!ipAddress || !sessionId) {
|
111
|
-
return res.status(401).json({ message: 'We are not able to track your actions'})
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
req.user = {
|
116
|
-
userId,
|
117
|
-
sessionId,
|
118
|
-
ipAddress,
|
119
|
-
appName: req.headers['x-app-name'],
|
120
|
-
email
|
121
|
-
}
|
122
|
-
|
123
|
-
next();
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
// TODO: Delete It
|
128
|
-
const authorizeWithGpt = () => {
|
129
|
-
return async function (req: IRequest, res: Response, next: NextFunction) {
|
130
|
-
const secret = req.headers['authorization'];
|
131
|
-
const secretKey: Array<string> = secret ? secret.split(":") : undefined!;
|
132
|
-
|
133
|
-
if(secretKey && secretKey.length === 2 && secretKey[0]!==`Bearer ${process.env.GPT_API_KEY}`) {
|
134
|
-
return res.status(401).json({ message: 'keys not matching' })
|
135
|
-
}
|
136
|
-
|
137
|
-
const ipAddress = req.headers['x-forwarded-for'] || (req as any).connection.remoteAddress;
|
138
|
-
let userId = "guest";
|
139
|
-
|
140
|
-
req.user = {
|
141
|
-
userId,
|
142
|
-
ipAddress,
|
143
|
-
appName: secretKey[1],
|
144
|
-
navigateFromGPT: true
|
145
|
-
}
|
146
|
-
next();
|
147
|
-
}
|
148
|
-
}
|
149
|
-
|
150
|
-
export {authorize, authorizeWithSlideApp, nonAuthorizeWithSlideApp, authorizeWithGpt};
|
package/src/middleware/index.ts
DELETED
package/src/middleware/role.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { NextFunction, Response } from "express";
|
2
|
-
import Joi from 'joi';
|
3
|
-
|
4
|
-
import { IRequest } from "../types";
|
5
|
-
|
6
|
-
export const validateSchema = (schema: Joi.ObjectSchema<any>) => {
|
7
|
-
return async function (req: IRequest, res: Response, next: NextFunction) {
|
8
|
-
|
9
|
-
const { error } = schema.validate(req.body, { abortEarly: false });
|
10
|
-
|
11
|
-
if(error) {
|
12
|
-
const errorMessage = error.details.map((err) => err.message).join(', ');
|
13
|
-
return res.status(400).json({ message: errorMessage });
|
14
|
-
} else {
|
15
|
-
next();
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
|
@@ -1,66 +0,0 @@
|
|
1
|
-
import { Request, Response, NextFunction } from 'express';
|
2
|
-
|
3
|
-
export class BadRequestError extends Error {
|
4
|
-
constructor(message: string) {
|
5
|
-
super(message);
|
6
|
-
Object.setPrototypeOf(this, BadRequestError.prototype);
|
7
|
-
this.name = 'BadRequestError';
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
export class NotFoundRequestError extends Error {
|
12
|
-
constructor(message: string) {
|
13
|
-
super(message);
|
14
|
-
Object.setPrototypeOf(this, NotFoundRequestError.prototype);
|
15
|
-
this.name = 'NotFoundRequestError';
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
export class CustomRequestError {
|
20
|
-
name: string;
|
21
|
-
message: {
|
22
|
-
title: string,
|
23
|
-
description: string
|
24
|
-
};
|
25
|
-
|
26
|
-
constructor(title: string, description: string) {
|
27
|
-
this.name = 'CustomRequestError';
|
28
|
-
this.message = {
|
29
|
-
title,
|
30
|
-
description
|
31
|
-
};
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
// Custom error handler middleware
|
38
|
-
export const errorHandler = (
|
39
|
-
err: Error,
|
40
|
-
req: Request,
|
41
|
-
res: Response,
|
42
|
-
next: NextFunction
|
43
|
-
) => {
|
44
|
-
|
45
|
-
let statusCode = 500; // Default status code
|
46
|
-
let errorMessage = 'Internal Server Error'; // Default error message
|
47
|
-
|
48
|
-
if (err instanceof BadRequestError) {
|
49
|
-
statusCode = 400;
|
50
|
-
errorMessage = err.message;
|
51
|
-
} else if(err instanceof NotFoundRequestError) {
|
52
|
-
statusCode = 404;
|
53
|
-
errorMessage = err.message;
|
54
|
-
} else if(err instanceof CustomRequestError) {
|
55
|
-
statusCode = 422;
|
56
|
-
errorMessage = err.message;
|
57
|
-
} else {
|
58
|
-
console.error(err.stack); // Log the error for debugging
|
59
|
-
}
|
60
|
-
|
61
|
-
// Send an error response
|
62
|
-
res.status(statusCode).json({
|
63
|
-
message: errorMessage,
|
64
|
-
error: err.name // Optionally send the error name/type
|
65
|
-
});
|
66
|
-
};
|
package/src/resHandler/index.ts
DELETED
package/src/types/IController.ts
DELETED
package/src/types/IRequest.ts
DELETED
package/src/types/index.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
export * from "./IController";
|
2
|
-
export * from "./IRequest";
|
3
|
-
|
4
|
-
export enum QUEUES {
|
5
|
-
IMAGE_MODEL_BULK = "image-model-bulk", // Will be used for bulk training model
|
6
|
-
IMAGE_MODEL_SINGLE = "image-model-single", // Will be used for single image training
|
7
|
-
NOTIFICATION = "notification", // Notify to user
|
8
|
-
THUMBNAIL = "thumbnail", // To create thubmnail
|
9
|
-
PPT = "ppt", // to call PPT Service
|
10
|
-
PNG_SVG = "png-svg" // to convert raster to vector image
|
11
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
export async function callWithRetries(retryCount: number, failedMessage: string, functionRef: Function, ...args: any): Promise<any> {
|
2
|
-
try {
|
3
|
-
return await functionRef(...args)
|
4
|
-
} catch (error: any) {
|
5
|
-
if (retryCount <= 0) throw error;
|
6
|
-
console.log("callWithRetries", error?.message || error)
|
7
|
-
return callWithRetries(retryCount - 1, failedMessage, functionRef, ...args);
|
8
|
-
}
|
9
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import jwt from 'jsonwebtoken';
|
2
|
-
|
3
|
-
const signUid = (value: object) => {
|
4
|
-
return jwt.sign({ value }, process.env.JWTSECRET || 'secret', {
|
5
|
-
expiresIn: '8h' // expires in 8 hours
|
6
|
-
});
|
7
|
-
};
|
8
|
-
|
9
|
-
const verifyUid = async (token: string): Promise<any> =>
|
10
|
-
new Promise(resolve => {
|
11
|
-
const jwtToken = token.split(" ")[1] || token;
|
12
|
-
jwt.verify(
|
13
|
-
jwtToken,
|
14
|
-
process.env.JWTSECRET || 'secret',
|
15
|
-
(err, decoded) => {
|
16
|
-
if (err) {
|
17
|
-
// console.log("error verifyUid", err)
|
18
|
-
resolve(null);
|
19
|
-
} else {
|
20
|
-
resolve(decoded);
|
21
|
-
}
|
22
|
-
},
|
23
|
-
);
|
24
|
-
});
|
25
|
-
|
26
|
-
export { signUid, verifyUid }
|
@@ -1,33 +0,0 @@
|
|
1
|
-
export function hasExactMatch(str: string, word: string) {
|
2
|
-
// Construct a regular expression to match the word as a whole word
|
3
|
-
const regex = new RegExp('\\b' + word + '\\b', 'i'); // 'i' for case-insensitive matching
|
4
|
-
|
5
|
-
// Test if the word has an exact match in the string
|
6
|
-
return regex.test(str);
|
7
|
-
}
|
8
|
-
|
9
|
-
export function hasSpecialCharacter(str: string) {
|
10
|
-
// Define a regular expression with a character class containing special characters
|
11
|
-
const regex = /[!@#$%^&*()_+\-=\[\]{};:\\|<>\/?]/;
|
12
|
-
|
13
|
-
// Test if the string contains any special character
|
14
|
-
return regex.test(str);
|
15
|
-
}
|
16
|
-
|
17
|
-
|
18
|
-
export function hasAbusiveWords(str: string, words: string[]) {
|
19
|
-
// Convert the string to lowercase for case-insensitive matching
|
20
|
-
const lowerStr = str.toLowerCase();
|
21
|
-
|
22
|
-
if(hasSpecialCharacter(lowerStr)) {
|
23
|
-
return true;
|
24
|
-
}
|
25
|
-
|
26
|
-
// Check if any abusive word exists in the string
|
27
|
-
for (const word of words) {
|
28
|
-
if(hasExactMatch(lowerStr, word.toLowerCase())) {
|
29
|
-
return true
|
30
|
-
}
|
31
|
-
}
|
32
|
-
return false;
|
33
|
-
}
|
package/src/utilities/index.ts
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
export const pngSvgCategories = {
|
2
|
-
"Logo": {
|
3
|
-
"Outline": {
|
4
|
-
"alias": ""
|
5
|
-
},
|
6
|
-
"Monogram": {
|
7
|
-
"alias": ""
|
8
|
-
},
|
9
|
-
"Wordmark": {
|
10
|
-
"alias": ""
|
11
|
-
},
|
12
|
-
"Emblem": {
|
13
|
-
"alias": ""
|
14
|
-
},
|
15
|
-
"Abstract Logo": {
|
16
|
-
"alias": ""
|
17
|
-
},
|
18
|
-
"Mascot": {
|
19
|
-
"alias": ""
|
20
|
-
}
|
21
|
-
},
|
22
|
-
"Icons": {
|
23
|
-
"Outline": {
|
24
|
-
"alias": ""
|
25
|
-
},
|
26
|
-
"Pictogram": {
|
27
|
-
"alias": ""
|
28
|
-
},
|
29
|
-
"Broken Line": {
|
30
|
-
"alias": ""
|
31
|
-
},
|
32
|
-
"Gradient Line": {
|
33
|
-
"alias": ""
|
34
|
-
},
|
35
|
-
"Gradient Shape": {
|
36
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme."
|
37
|
-
},
|
38
|
-
"Doodle": {
|
39
|
-
"alias": ""
|
40
|
-
},
|
41
|
-
"Flat": {
|
42
|
-
"alias": ""
|
43
|
-
},
|
44
|
-
"Minimalistic": {
|
45
|
-
"alias": ""
|
46
|
-
},
|
47
|
-
"Isometric": {
|
48
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
49
|
-
},
|
50
|
-
"3D Icons": {
|
51
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme."
|
52
|
-
}
|
53
|
-
},
|
54
|
-
"Illustrations": {
|
55
|
-
"Hand Drawn": {
|
56
|
-
"alias": ""
|
57
|
-
},
|
58
|
-
"Glow": {
|
59
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
60
|
-
},
|
61
|
-
"Pixel Art": {
|
62
|
-
"alias": ""
|
63
|
-
},
|
64
|
-
"Watercolour": {
|
65
|
-
"alias": ""
|
66
|
-
},
|
67
|
-
"Psychedelic": {
|
68
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
69
|
-
},
|
70
|
-
"80's": {
|
71
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
72
|
-
},
|
73
|
-
"Digital Art": {
|
74
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
75
|
-
},
|
76
|
-
"Abstract": {
|
77
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
78
|
-
},
|
79
|
-
"Realistic": {
|
80
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
81
|
-
},
|
82
|
-
"Comic Style": {
|
83
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
84
|
-
},
|
85
|
-
"Fantasy": {
|
86
|
-
"alias": "The icon should have strong and dramatic lighting and have a clean look on white background and should have only the suggested colour scheme. "
|
87
|
-
},
|
88
|
-
"Anime": {
|
89
|
-
"alias": ""
|
90
|
-
},
|
91
|
-
"Minimalist": {
|
92
|
-
"alias": ""
|
93
|
-
},
|
94
|
-
"Pencil Sketch": {
|
95
|
-
"alias": ""
|
96
|
-
},
|
97
|
-
},
|
98
|
-
"3D illustration": {
|
99
|
-
"Wireframe": {
|
100
|
-
"alias": ""
|
101
|
-
},
|
102
|
-
"Low Poly": {
|
103
|
-
"alias": ""
|
104
|
-
},
|
105
|
-
"Cartoon 3D": {
|
106
|
-
"alias": ""
|
107
|
-
},
|
108
|
-
"Plastic 3D": {
|
109
|
-
"alias": ""
|
110
|
-
},
|
111
|
-
"3D render": {
|
112
|
-
"alias": ""
|
113
|
-
},
|
114
|
-
},
|
115
|
-
"Photorealism": {
|
116
|
-
"Photorealistic Painting": {
|
117
|
-
"alias": ""
|
118
|
-
},
|
119
|
-
"Photorealistic Drawing": {
|
120
|
-
"alias": ""
|
121
|
-
},
|
122
|
-
"Hyperealism": {
|
123
|
-
"alias": ""
|
124
|
-
},
|
125
|
-
"Photorealism": {
|
126
|
-
"alias": ""
|
127
|
-
},
|
128
|
-
},
|
129
|
-
"Vector Art": {
|
130
|
-
"Line Art": {
|
131
|
-
"alias": ""
|
132
|
-
},
|
133
|
-
"Cartoon": {
|
134
|
-
"alias": ""
|
135
|
-
},
|
136
|
-
"Vector Kawai": {
|
137
|
-
"alias": ""
|
138
|
-
},
|
139
|
-
"Linocut": {
|
140
|
-
"alias": ""
|
141
|
-
},
|
142
|
-
"Engraving": {
|
143
|
-
"alias": ""
|
144
|
-
},
|
145
|
-
"Doodle Line Art": {
|
146
|
-
"alias": ""
|
147
|
-
},
|
148
|
-
"Geometric": {
|
149
|
-
"alias": ""
|
150
|
-
},
|
151
|
-
"Abstract": {
|
152
|
-
"alias": ""
|
153
|
-
},
|
154
|
-
"Vintage": {
|
155
|
-
"alias": ""
|
156
|
-
},
|
157
|
-
"Minimalist": {
|
158
|
-
"alias": ""
|
159
|
-
},
|
160
|
-
"Stylized": {
|
161
|
-
"alias": ""
|
162
|
-
},
|
163
|
-
"Flat Design": {
|
164
|
-
"alias": ""
|
165
|
-
},
|
166
|
-
}
|
167
|
-
}
|
package/tsconfig.json
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|