@knovator/pagecreator-node 1.2.2 → 1.2.4

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.
Files changed (71) hide show
  1. package/README.md +458 -458
  2. package/package.json +3 -2
  3. package/src/constants/index.d.ts +20 -20
  4. package/src/constants/index.js +33 -33
  5. package/src/controllers/PageController.d.ts +4 -4
  6. package/src/controllers/PageController.js +83 -83
  7. package/src/controllers/TabController.d.ts +4 -4
  8. package/src/controllers/TabController.js +45 -45
  9. package/src/controllers/UserController.d.ts +2 -2
  10. package/src/controllers/UserController.js +64 -64
  11. package/src/controllers/WidgetController.d.ts +10 -10
  12. package/src/controllers/WidgetController.js +328 -328
  13. package/src/index.d.ts +8 -8
  14. package/src/index.js +47 -47
  15. package/src/models/Item.d.ts +30 -30
  16. package/src/models/Item.js +49 -49
  17. package/src/models/Page.d.ts +30 -30
  18. package/src/models/Page.js +23 -22
  19. package/src/models/Page.js.map +1 -1
  20. package/src/models/SrcSet.d.ts +30 -30
  21. package/src/models/SrcSet.js +16 -16
  22. package/src/models/Tab.d.ts +30 -30
  23. package/src/models/Tab.js +27 -27
  24. package/src/models/Widget.d.ts +30 -30
  25. package/src/models/Widget.js +62 -62
  26. package/src/models/index.d.ts +6 -6
  27. package/src/models/index.js +18 -18
  28. package/src/plugins/softDelete.d.ts +7 -7
  29. package/src/plugins/softDelete.js +63 -63
  30. package/src/routes/PageRoute.d.ts +3 -3
  31. package/src/routes/PageRoute.js +29 -29
  32. package/src/routes/UserRoute.d.ts +3 -3
  33. package/src/routes/UserRoute.js +22 -22
  34. package/src/routes/WidgetRoute.d.ts +3 -3
  35. package/src/routes/WidgetRoute.js +67 -67
  36. package/src/services/dataService.d.ts +9 -9
  37. package/src/services/dataService.js +402 -402
  38. package/src/services/dbService.d.ts +16 -16
  39. package/src/services/dbService.js +88 -87
  40. package/src/services/dbService.js.map +1 -1
  41. package/src/types/IRequest.d.ts +6 -6
  42. package/src/types/IRequest.js +2 -2
  43. package/src/types/IResponse.d.ts +6 -6
  44. package/src/types/IResponse.js +2 -2
  45. package/src/types/Router.d.ts +4 -4
  46. package/src/types/Router.js +2 -2
  47. package/src/types/common.d.ts +143 -142
  48. package/src/types/common.js +2 -2
  49. package/src/types/enums.d.ts +14 -14
  50. package/src/types/enums.js +20 -20
  51. package/src/types/index.d.ts +5 -5
  52. package/src/types/index.js +8 -8
  53. package/src/utils/defaults.d.ts +7 -7
  54. package/src/utils/defaults.js +40 -40
  55. package/src/utils/helper.d.ts +7 -7
  56. package/src/utils/helper.js +224 -224
  57. package/src/utils/redis.d.ts +3 -3
  58. package/src/utils/redis.js +58 -58
  59. package/src/utils/responseHandlers.d.ts +6 -6
  60. package/src/utils/responseHandlers.js +56 -56
  61. package/src/utils/validate.d.ts +4 -4
  62. package/src/utils/validate.js +23 -23
  63. package/src/utils/validations/page.d.ts +7 -7
  64. package/src/utils/validations/page.js +52 -50
  65. package/src/utils/validations/page.js.map +1 -1
  66. package/src/utils/validations/tab.d.ts +6 -6
  67. package/src/utils/validations/tab.js +25 -25
  68. package/src/utils/validations/user.d.ts +3 -3
  69. package/src/utils/validations/user.js +12 -12
  70. package/src/utils/validations/widget.d.ts +9 -9
  71. package/src/utils/validations/widget.js +152 -152
@@ -1,16 +1,16 @@
1
- import { Model, FilterQuery, QueryOptions, ProjectionType, HydratedDocument, QueryWithHelpers } from 'mongoose';
2
- import { EntityType, IModel, ReturnDocument } from '../types';
3
- export declare function create<T extends EntityType>(Modal: Model<T>, data: Partial<T>): Promise<ReturnDocument>;
4
- export declare function update<T extends EntityType>(Modal: Model<T>, query: FilterQuery<EntityType>, data: Partial<T>): Promise<T | undefined>;
5
- export declare function remove<T extends EntityType>(Modal: Model<T>, query: FilterQuery<EntityType>): Promise<T | undefined>;
6
- export declare function deleteAll<T extends EntityType>(Modal: Model<T>, query: FilterQuery<T>): Promise<import("mongodb").DeleteResult>;
7
- export declare function getAll<T extends EntityType>(Modal: Model<T>, query?: FilterQuery<EntityType>, options?: QueryOptions<EntityType>, projection?: ProjectionType<EntityType>): QueryWithHelpers<Array<T>, T, {}, T>;
8
- export declare function list<T extends EntityType>(Modal: IModel<T>, where: FilterQuery<T>, options: QueryOptions<T>): Promise<ReturnDocument[]>;
9
- export declare function getOne<T extends EntityType>(Modal: Model<T>, query: FilterQuery<EntityType>, projection?: ProjectionType<EntityType>): Promise<HydratedDocument<T>>;
10
- export declare function bulkInsert<T extends EntityType>(Modal: Model<T>, docs: T[]): Promise<ReturnDocument[]>;
11
- export declare function checkUnique<T extends EntityType>({ Modal, uniqueField, errorMessage, value }: {
12
- Modal: Model<T>;
13
- uniqueField: keyof T;
14
- value: any;
15
- errorMessage: string;
16
- }): Promise<void>;
1
+ import { Model, FilterQuery, QueryOptions, ProjectionType, HydratedDocument, QueryWithHelpers } from 'mongoose';
2
+ import { EntityType, IModel } from '../types';
3
+ export declare function create<T>(Modal: Model<T>, data: Partial<T>): Promise<HydratedDocument<T>>;
4
+ export declare function update<T>(Modal: Model<T>, query: FilterQuery<T>, data: Partial<T>): Promise<HydratedDocument<T> | undefined>;
5
+ export declare function remove<T>(Modal: Model<T>, query: FilterQuery<T>): Promise<HydratedDocument<T>>;
6
+ export declare function deleteAll<T>(Modal: Model<T>, query: FilterQuery<T>): Promise<import("mongodb").DeleteResult>;
7
+ export declare function getAll<T>(Modal: Model<T>, query?: FilterQuery<T>, options?: QueryOptions<T>, projection?: ProjectionType<T>): QueryWithHelpers<Array<HydratedDocument<T>>, HydratedDocument<T>, {}, T>;
8
+ export declare function list<T>(Modal: IModel<T>, where: FilterQuery<T>, options: QueryOptions<T>): Promise<any>;
9
+ export declare function getOne<T>(Modal: Model<T>, query: FilterQuery<T>, projection?: ProjectionType<T>): Promise<HydratedDocument<T>>;
10
+ export declare function bulkInsert<T>(Modal: Model<T>, docs: T[]): Promise<Array<HydratedDocument<T>>>;
11
+ export declare function checkUnique<T extends EntityType>({ Modal, uniqueField, errorMessage, value }: {
12
+ Modal: Model<T>;
13
+ uniqueField: keyof T;
14
+ value: any;
15
+ errorMessage: string;
16
+ }): Promise<void>;
@@ -1,88 +1,89 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkUnique = exports.bulkInsert = exports.getOne = exports.list = exports.getAll = exports.deleteAll = exports.remove = exports.update = exports.create = void 0;
4
- const tslib_1 = require("tslib");
5
- // create
6
- function create(Modal, data) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const modalInstance = new Modal(data);
9
- return yield modalInstance.save();
10
- });
11
- }
12
- exports.create = create;
13
- // update
14
- function update(Modal, query, data) {
15
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
- yield getOne(Modal, query);
17
- const result = yield Modal.findOneAndUpdate(query, data, { new: true });
18
- return result || undefined;
19
- });
20
- }
21
- exports.update = update;
22
- // soft-delete
23
- function remove(Modal, query) {
24
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
- const modalInstance = yield getOne(Modal, query);
26
- yield modalInstance.remove();
27
- return modalInstance;
28
- });
29
- }
30
- exports.remove = remove;
31
- // delete-all
32
- function deleteAll(Modal, query) {
33
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
34
- return Modal.deleteMany(query);
35
- });
36
- }
37
- exports.deleteAll = deleteAll;
38
- // get-all
39
- function getAll(Modal, query = {}, options, projection
40
- // eslint-disable-next-line @typescript-eslint/ban-types
41
- ) {
42
- return Modal.find(query, projection, options);
43
- }
44
- exports.getAll = getAll;
45
- // list
46
- function list(Modal, where, options) {
47
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
48
- try {
49
- const documents = Modal.paginate(where, options);
50
- return documents;
51
- }
52
- catch (error) {
53
- throw new Error(error.message);
54
- }
55
- });
56
- }
57
- exports.list = list;
58
- // get-one
59
- function getOne(Modal, query, projection) {
60
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
- const modalInstance = yield Modal.findOne(query, projection);
62
- if (!modalInstance)
63
- throw new Error(`Record not found ${Modal.name ? `in ${Modal.name}` : ''}`);
64
- return modalInstance;
65
- });
66
- }
67
- exports.getOne = getOne;
68
- // bulk-insert
69
- function bulkInsert(Modal, docs) {
70
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
- return yield Modal.insertMany(docs);
72
- });
73
- }
74
- exports.bulkInsert = bulkInsert;
75
- function checkUnique({ Modal, uniqueField, errorMessage, value }) {
76
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
77
- const query = { [uniqueField]: value };
78
- let result;
79
- try {
80
- result = yield getOne(Modal, query);
81
- }
82
- catch (error) { }
83
- if (result)
84
- throw new Error(errorMessage);
85
- });
86
- }
87
- exports.checkUnique = checkUnique;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkUnique = exports.bulkInsert = exports.getOne = exports.list = exports.getAll = exports.deleteAll = exports.remove = exports.update = exports.create = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // create
6
+ function create(Modal, data) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ const modalInstance = new Modal(data);
9
+ return (yield modalInstance.save());
10
+ });
11
+ }
12
+ exports.create = create;
13
+ // update
14
+ function update(Modal, query, data) {
15
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
+ yield getOne(Modal, query);
17
+ const result = (yield Modal.findOneAndUpdate(query, data, {
18
+ new: true,
19
+ }));
20
+ return result || undefined;
21
+ });
22
+ }
23
+ exports.update = update;
24
+ // soft-delete
25
+ function remove(Modal, query) {
26
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
+ const modalInstance = yield getOne(Modal, query);
28
+ return (yield modalInstance.remove());
29
+ });
30
+ }
31
+ exports.remove = remove;
32
+ // delete-all
33
+ function deleteAll(Modal, query) {
34
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ return Modal.deleteMany(query);
36
+ });
37
+ }
38
+ exports.deleteAll = deleteAll;
39
+ // get-all
40
+ function getAll(Modal, query = {}, options, projection
41
+ // eslint-disable-next-line @typescript-eslint/ban-types
42
+ ) {
43
+ return Modal.find(query, projection, options);
44
+ }
45
+ exports.getAll = getAll;
46
+ // list
47
+ function list(Modal, where, options) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ try {
50
+ const documents = Modal.paginate(where, options);
51
+ return documents;
52
+ }
53
+ catch (error) {
54
+ throw new Error(error.message);
55
+ }
56
+ });
57
+ }
58
+ exports.list = list;
59
+ // get-one
60
+ function getOne(Modal, query, projection) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ const modalInstance = (yield Modal.findOne(query, projection));
63
+ if (!modalInstance)
64
+ throw new Error(`Record not found ${Modal.name ? `in ${Modal.name}` : ''}`);
65
+ return modalInstance;
66
+ });
67
+ }
68
+ exports.getOne = getOne;
69
+ // bulk-insert
70
+ function bulkInsert(Modal, docs) {
71
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
+ return (yield Modal.insertMany(docs));
73
+ });
74
+ }
75
+ exports.bulkInsert = bulkInsert;
76
+ function checkUnique({ Modal, uniqueField, errorMessage, value }) {
77
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
78
+ const query = { [uniqueField]: value };
79
+ let result;
80
+ try {
81
+ result = yield getOne(Modal, query);
82
+ }
83
+ catch (error) { }
84
+ if (result)
85
+ throw new Error(errorMessage);
86
+ });
87
+ }
88
+ exports.checkUnique = checkUnique;
88
89
  //# sourceMappingURL=dbService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dbService.js","sourceRoot":"","sources":["../../../../../libs/node/src/services/dbService.ts"],"names":[],"mappings":";;;;AAUA,SAAS;AACT,SAAsB,MAAM,CAC1B,KAAe,EACf,IAAgB;;QAEhB,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;CAAA;AAND,wBAMC;AACD,SAAS;AACT,SAAsB,MAAM,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,UAAuC;;QAEvC,MAAM,aAAa,GAA+B,MAAM,KAAK,CAAC,OAAO,CACnE,KAAK,EACL,UAAU,CACX,CAAC;QACF,IAAI,CAAC,aAAa;YAChB,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE9E,OAAO,aAAa,CAAC;IACvB,CAAC;CAAA;AAbD,wBAaC;AACD,cAAc;AACd,SAAsB,UAAU,CAAuB,KAAe,EAAE,IAAS;;QAC/E,OAAO,MAAM,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CAAA;AAFD,gCAEC;AAED,SAAsB,WAAW,CAAuB,EACxD,KAAK,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EAMJ;;QACC,MAAM,KAAK,GAAmB,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,EAAoB,CAAC;QACzE,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE,GAAE;QAClB,IAAG,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IAC1C,CAAC;CAAA;AAjBD,kCAiBC"}
1
+ {"version":3,"file":"dbService.js","sourceRoot":"","sources":["../../../../../libs/node/src/services/dbService.ts"],"names":[],"mappings":";;;;AAUA,SAAS;AACT,SAAsB,MAAM,CAC1B,KAAe,EACf,IAAgB;;QAEhB,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,CAAC,MAAM,aAAa,CAAC,IAAI,EAAE,CAAmC,CAAC;IACxE,CAAC;CAAA;AAND,wBAMC;AACD,SAAS;AACT,SAAsB,MAAM,CAC1B,KAAe,EACf,KAAqB,EACrB,IAAgB;;QAEhB,MAA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KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAErD,CAAC;QACT,IAAI,CAAC,aAAa;YAChB,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE9E,OAAO,aAAa,CAAC;IACvB,CAAC;CAAA;AAZD,wBAYC;AACD,cAAc;AACd,SAAsB,UAAU,CAC9B,KAAe,EACf,IAAS;;QAET,OAAO,CAAC,MAAM,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAA+B,CAAC;IACtE,CAAC;CAAA;AALD,gCAKC;AAED,SAAsB,WAAW,CAAuB,EACxD,KAAK,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EAMJ;;QACC,MAAM,KAAK,GAAmB,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,EAAoB,CAAC;QACzE,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE,GAAE;QAClB,IAAG,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAA;IAC1C,CAAC;CAAA;AAjBD,kCAiBC"}
@@ -1,6 +1,6 @@
1
- import { Request } from 'express';
2
- export interface IRequest extends Request {
3
- i18n?: {
4
- t: (key: string) => string;
5
- };
6
- }
1
+ import { Request } from 'express';
2
+ export interface IRequest extends Request {
3
+ i18n?: {
4
+ t: (key: string) => string;
5
+ };
6
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IRequest.js.map
@@ -1,6 +1,6 @@
1
- import { Response } from 'express';
2
- export interface IResponse extends Response {
3
- message?: string;
4
- data?: unknown;
5
- code?: number;
6
- }
1
+ import { Response } from 'express';
2
+ export interface IResponse extends Response {
3
+ message?: string;
4
+ data?: unknown;
5
+ code?: number;
6
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=IResponse.js.map
@@ -1,4 +1,4 @@
1
- import { Router } from 'express';
2
- export interface IRouter extends Router {
3
- descriptor: (text: string) => void;
4
- }
1
+ import { Router } from 'express';
2
+ export interface IRouter extends Router {
3
+ descriptor: (text: string) => void;
4
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=Router.js.map
@@ -1,142 +1,143 @@
1
- /// <reference types="express-serve-static-core" />
2
- import { Document, Model, Models, Types, FilterQuery, QueryOptions, HydratedDocument } from 'mongoose';
3
- import { ItemsType, WidgetTypes, ItemTypes } from '.';
4
- export type TypesType = {
5
- value: string;
6
- label: string;
7
- };
8
- export type LanguageSchemaFieldType = {
9
- [key: string]: string;
10
- };
11
- export interface iConfig {
12
- logger: any;
13
- catchAsync: (fn: any, modal?: string) => (req: any, res: any, next: any) => void;
14
- collections: CollectionItem[];
15
- }
16
- export interface IPageSchema extends Document {
17
- name: string;
18
- code: string;
19
- slug: string;
20
- canDel: boolean;
21
- widgets: string[];
22
- }
23
- export interface ITabSchema extends Document {
24
- name: string;
25
- names: LanguageSchemaFieldType;
26
- widgetId: typeof Types.ObjectId;
27
- collectionItems: string[];
28
- }
29
- export interface ISrcSetSchema extends Document {
30
- width: number;
31
- height: number;
32
- screenSize: number;
33
- itemId: typeof Types.ObjectId;
34
- }
35
- export interface IWidgetSchema extends Document {
36
- items: any;
37
- name: string;
38
- code: string;
39
- autoPlay: boolean;
40
- isActive: boolean;
41
- widgetTitle: string;
42
- widgetTitles: LanguageSchemaFieldType;
43
- webPerRow: number;
44
- mobilePerRow: number;
45
- tabletPerRow: number;
46
- itemsType: ItemsType;
47
- widgetType: WidgetTypes;
48
- collectionName: string;
49
- collectionItems: string[];
50
- tabs: {
51
- name: string;
52
- names?: LanguageSchemaFieldType;
53
- collectionItems: string[];
54
- }[];
55
- backgroundColor: string;
56
- textContent: string;
57
- htmlContent: string;
58
- canDel: boolean;
59
- }
60
- export interface IItemSchema extends Document {
61
- widgetId: typeof Types.ObjectId;
62
- title: string;
63
- titles: LanguageSchemaFieldType;
64
- subtitle: string;
65
- subtitles: LanguageSchemaFieldType;
66
- altText: string;
67
- altTexts: LanguageSchemaFieldType;
68
- link: string;
69
- sequence: number;
70
- itemType: ItemTypes;
71
- img: any;
72
- imgs: any;
73
- srcset?: SrcSetItem[];
74
- }
75
- export interface SrcSetItem {
76
- screenSize: number;
77
- width: number;
78
- height: number;
79
- }
80
- export type CollectionItem = {
81
- title: string;
82
- collectionName: string;
83
- filters?: {
84
- [key: string]: string | number | boolean;
85
- };
86
- searchColumns?: string[];
87
- match?: ObjectType;
88
- aggregations?: any[];
89
- searchLimit?: number;
90
- };
91
- export type RedisConfig = {
92
- HOST: string;
93
- PORT: number;
94
- PASSWORD?: string;
95
- USER?: string;
96
- DB?: number;
97
- };
98
- export interface IConfig {
99
- logger: any;
100
- catchAsync: (fn: any, modal?: string) => (req: any, res: any, next: any) => void;
101
- getModals: (req: Express.Request) => Models;
102
- collections: CollectionItem[];
103
- customWidgetTypes: {
104
- label: string;
105
- value: string;
106
- imageOnly?: boolean;
107
- collectionsOnly?: boolean;
108
- }[];
109
- redis?: string | RedisConfig;
110
- languages?: LanguageType[];
111
- }
112
- export type EntityType = IWidgetSchema | IItemSchema | IPageSchema | ISrcSetSchema | ITabSchema;
113
- export type ReturnDocument = EntityType;
114
- export interface IModel<T> extends Model<T> {
115
- paginate: (query: FilterQuery<T>, options?: QueryOptions) => Promise<HydratedDocument<ReturnDocument>[]>;
116
- }
117
- export type ObjectType = {
118
- [key: string]: string | number | boolean | null | undefined | string[] | number[] | ObjectType | ObjectType[] | any;
119
- };
120
- export interface IDefaultValidations {
121
- createdBy: string;
122
- updatedBy: string;
123
- deletedBy: string;
124
- deletedAt: string;
125
- }
126
- export interface IWidgetDataSchema {
127
- _id: string;
128
- code: string;
129
- collectionName: string;
130
- collectionItems: string[];
131
- tabs: {
132
- name: string;
133
- collectionItems: string[];
134
- }[];
135
- }
136
- export type IWidgetData = {
137
- [key: string]: IWidgetDataSchema;
138
- };
139
- export type LanguageType = {
140
- code: string;
141
- name: string;
142
- };
1
+ /// <reference types="express-serve-static-core" />
2
+ import { Document, Model, Models, Types, FilterQuery, QueryOptions, HydratedDocument } from 'mongoose';
3
+ import { ItemsType, WidgetTypes, ItemTypes } from '.';
4
+ export type TypesType = {
5
+ value: string;
6
+ label: string;
7
+ };
8
+ export type LanguageSchemaFieldType = {
9
+ [key: string]: string;
10
+ };
11
+ export interface iConfig {
12
+ logger: any;
13
+ catchAsync: (fn: any, modal?: string) => (req: any, res: any, next: any) => void;
14
+ collections: CollectionItem[];
15
+ }
16
+ export interface IPageSchema extends Document {
17
+ name: string;
18
+ code: string;
19
+ slug: string;
20
+ canDel: boolean;
21
+ widgets: string[];
22
+ filterQuery: string;
23
+ }
24
+ export interface ITabSchema extends Document {
25
+ name: string;
26
+ names: LanguageSchemaFieldType;
27
+ widgetId: typeof Types.ObjectId;
28
+ collectionItems: string[];
29
+ }
30
+ export interface ISrcSetSchema extends Document {
31
+ width: number;
32
+ height: number;
33
+ screenSize: number;
34
+ itemId: typeof Types.ObjectId;
35
+ }
36
+ export interface IWidgetSchema extends Document {
37
+ items: any;
38
+ name: string;
39
+ code: string;
40
+ autoPlay: boolean;
41
+ isActive: boolean;
42
+ widgetTitle: string;
43
+ widgetTitles: LanguageSchemaFieldType;
44
+ webPerRow: number;
45
+ mobilePerRow: number;
46
+ tabletPerRow: number;
47
+ itemsType: ItemsType;
48
+ widgetType: WidgetTypes;
49
+ collectionName: string;
50
+ collectionItems: string[];
51
+ tabs: {
52
+ name: string;
53
+ names?: LanguageSchemaFieldType;
54
+ collectionItems: string[];
55
+ }[];
56
+ backgroundColor: string;
57
+ textContent: string;
58
+ htmlContent: string;
59
+ canDel: boolean;
60
+ }
61
+ export interface IItemSchema extends Document {
62
+ widgetId: typeof Types.ObjectId;
63
+ title: string;
64
+ titles: LanguageSchemaFieldType;
65
+ subtitle: string;
66
+ subtitles: LanguageSchemaFieldType;
67
+ altText: string;
68
+ altTexts: LanguageSchemaFieldType;
69
+ link: string;
70
+ sequence: number;
71
+ itemType: ItemTypes;
72
+ img: any;
73
+ imgs: any;
74
+ srcset?: SrcSetItem[];
75
+ }
76
+ export interface SrcSetItem {
77
+ screenSize: number;
78
+ width: number;
79
+ height: number;
80
+ }
81
+ export type CollectionItem = {
82
+ title: string;
83
+ collectionName: string;
84
+ filters?: {
85
+ [key: string]: string | number | boolean;
86
+ };
87
+ searchColumns?: string[];
88
+ match?: ObjectType;
89
+ aggregations?: any[];
90
+ searchLimit?: number;
91
+ };
92
+ export type RedisConfig = {
93
+ HOST: string;
94
+ PORT: number;
95
+ PASSWORD?: string;
96
+ USER?: string;
97
+ DB?: number;
98
+ };
99
+ export interface IConfig {
100
+ logger: any;
101
+ catchAsync: (fn: any, modal?: string) => (req: any, res: any, next: any) => void;
102
+ getModals: (req: Express.Request) => Models;
103
+ collections: CollectionItem[];
104
+ customWidgetTypes: {
105
+ label: string;
106
+ value: string;
107
+ imageOnly?: boolean;
108
+ collectionsOnly?: boolean;
109
+ }[];
110
+ redis?: string | RedisConfig;
111
+ languages?: LanguageType[];
112
+ }
113
+ export type EntityType = IWidgetSchema | IItemSchema | IPageSchema | ISrcSetSchema | ITabSchema;
114
+ export type ReturnDocument = EntityType;
115
+ export interface IModel<T> extends Model<T> {
116
+ paginate: (query: FilterQuery<T>, options?: QueryOptions) => Promise<HydratedDocument<ReturnDocument>[]>;
117
+ }
118
+ export type ObjectType = {
119
+ [key: string]: string | number | boolean | null | undefined | string[] | number[] | ObjectType | ObjectType[] | any;
120
+ };
121
+ export interface IDefaultValidations {
122
+ createdBy: string;
123
+ updatedBy: string;
124
+ deletedBy: string;
125
+ deletedAt: string;
126
+ }
127
+ export interface IWidgetDataSchema {
128
+ _id: string;
129
+ code: string;
130
+ collectionName: string;
131
+ collectionItems: string[];
132
+ tabs: {
133
+ name: string;
134
+ collectionItems: string[];
135
+ }[];
136
+ }
137
+ export type IWidgetData = {
138
+ [key: string]: IWidgetDataSchema;
139
+ };
140
+ export type LanguageType = {
141
+ code: string;
142
+ name: string;
143
+ };
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=common.js.map
@@ -1,14 +1,14 @@
1
- export declare enum ItemsType {
2
- Image = "Image"
3
- }
4
- export declare enum WidgetTypes {
5
- FixedCard = "FixedCard",
6
- Carousel = "Carousel",
7
- Tabs = "Tabs",
8
- Text = "Text",
9
- HTML = "HTML"
10
- }
11
- export declare enum ItemTypes {
12
- Web = "Web",
13
- Mobile = "Mobile"
14
- }
1
+ export declare enum ItemsType {
2
+ Image = "Image"
3
+ }
4
+ export declare enum WidgetTypes {
5
+ FixedCard = "FixedCard",
6
+ Carousel = "Carousel",
7
+ Tabs = "Tabs",
8
+ Text = "Text",
9
+ HTML = "HTML"
10
+ }
11
+ export declare enum ItemTypes {
12
+ Web = "Web",
13
+ Mobile = "Mobile"
14
+ }