@aldb2b/common 1.0.103 → 1.0.106
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.
- package/build/db/CustomModel.d.ts +4 -4
- package/build/db/CustomModel.js +7 -7
- package/build/db/MongooseBase.d.ts +37 -37
- package/build/db/MongooseBase.js +321 -321
- package/build/db/aggregate/AggregateConvertor.d.ts +23 -23
- package/build/db/aggregate/AggregateConvertor.js +211 -211
- package/build/db/aggregate/createAggregateResponse.d.ts +2 -2
- package/build/db/aggregate/createAggregateResponse.js +49 -49
- package/build/db/mongoose-find-options.d.ts +12 -12
- package/build/db/mongoose-find-options.js +67 -67
- package/build/decorators/get-event-id-decorator.d.ts +1 -1
- package/build/decorators/get-event-id-decorator.js +9 -9
- package/build/decorators/get-user-decorator.d.ts +1 -1
- package/build/decorators/get-user-decorator.js +12 -12
- package/build/events/attendee-contact.interface.d.ts +10 -10
- package/build/events/attendee-contact.interface.js +2 -2
- package/build/events/authorize-user.interface.d.ts +13 -13
- package/build/events/authorize-user.interface.js +2 -2
- package/build/events/campaign-users.interface.d.ts +11 -11
- package/build/events/campaign-users.interface.js +2 -2
- package/build/events/compute-calendar.interface.d.ts +14 -14
- package/build/events/compute-calendar.interface.js +2 -2
- package/build/events/contacts-by-search.interface.d.ts +10 -10
- package/build/events/contacts-by-search.interface.js +2 -2
- package/build/events/create-company-setting.interface.d.ts +18 -16
- package/build/events/create-company-setting.interface.js +2 -2
- package/build/events/create-company.interface.d.ts +15 -15
- package/build/events/create-company.interface.js +2 -2
- package/build/events/create-contact.interface.d.ts +17 -17
- package/build/events/create-contact.interface.js +2 -2
- package/build/events/data-by-search.interface.d.ts +10 -10
- package/build/events/data-by-search.interface.js +2 -2
- package/build/events/edit-list-users.interface.d.ts +10 -10
- package/build/events/edit-list-users.interface.js +2 -2
- package/build/events/email-specs.interface.d.ts +18 -18
- package/build/events/email-specs.interface.js +2 -2
- package/build/events/get-companies.interface.d.ts +10 -10
- package/build/events/get-companies.interface.js +2 -2
- package/build/events/get-event.interface.d.ts +10 -10
- package/build/events/get-event.interface.js +2 -2
- package/build/events/get-unavailable-by-user.interface.d.ts +13 -13
- package/build/events/get-unavailable-by-user.interface.js +2 -2
- package/build/events/get-user-by-id.interface.d.ts +10 -10
- package/build/events/get-user-by-id.interface.js +2 -2
- package/build/events/groups-by-company.interface.d.ts +13 -13
- package/build/events/groups-by-company.interface.js +2 -2
- package/build/events/groups-by-ids.interface.d.ts +10 -10
- package/build/events/groups-by-ids.interface.js +2 -2
- package/build/events/manage-asseccibillity.interface.d.ts +13 -13
- package/build/events/manage-asseccibillity.interface.js +2 -2
- package/build/events/meeting-count-by-company.interface.d.ts +10 -10
- package/build/events/meeting-count-by-company.interface.js +2 -2
- package/build/events/meeting-count-by-user.interface.d.ts +10 -10
- package/build/events/meeting-count-by-user.interface.js +2 -2
- package/build/events/meeting-request-created.interface.d.ts +20 -20
- package/build/events/meeting-request-created.interface.js +2 -2
- package/build/events/meeting-requested-users.interface.d.ts +10 -10
- package/build/events/meeting-requested-users.interface.js +2 -2
- package/build/events/send-emails.interface.d.ts +21 -21
- package/build/events/send-emails.interface.js +2 -2
- package/build/events/send-notifications.interface.d.ts +19 -0
- package/build/events/send-notifications.interface.js +3 -0
- package/build/events/send-notifications.interface.js.map +1 -0
- package/build/events/subjects.d.ts +27 -26
- package/build/events/subjects.js +31 -30
- package/build/events/subjects.js.map +1 -1
- package/build/events/update-company-setting.interface.d.ts +18 -16
- package/build/events/update-company-setting.interface.js +2 -2
- package/build/events/update-user-event-info.interface.d.ts +17 -17
- package/build/events/update-user-event-info.interface.js +2 -2
- package/build/index.d.ts +78 -71
- package/build/index.js +90 -83
- package/build/index.js.map +1 -1
- package/build/interceptors/response.interceptor.d.ts +6 -6
- package/build/interceptors/response.interceptor.js +30 -30
- package/build/interceptors/serialize.interceptor.d.ts +12 -12
- package/build/interceptors/serialize.interceptor.js +24 -24
- package/build/middlewares/app.middleware.d.ts +6 -6
- package/build/middlewares/app.middleware.js +29 -29
- package/build/middlewares/authorizer.middleware.d.ts +10 -10
- package/build/middlewares/authorizer.middleware.js +102 -102
- package/build/tsconfig.tsbuildinfo +5085 -5015
- package/build/types/analytic-group.interface.d.ts +12 -0
- package/build/types/analytic-group.interface.js +3 -0
- package/build/types/analytic-group.interface.js.map +1 -0
- package/build/types/chat-group.interface.d.ts +4 -0
- package/build/types/{visibility.interface.js → chat-group.interface.js} +3 -3
- package/build/types/chat-group.interface.js.map +1 -0
- package/build/types/{visibility.interface.d.ts → default-visibility.interface.d.ts} +13 -10
- package/build/types/default-visibility.interface.js +3 -0
- package/build/types/default-visibility.interface.js.map +1 -0
- package/build/types/download-presigned-url.interface.d.ts +4 -4
- package/build/types/download-presigned-url.interface.js +2 -2
- package/build/types/group-visibility.interface.d.ts +13 -0
- package/build/types/group-visibility.interface.js +3 -0
- package/build/types/group-visibility.interface.js.map +1 -0
- package/build/types/header-user.interface.d.ts +8 -8
- package/build/types/header-user.interface.js +2 -2
- package/build/types/match-group.interface.d.ts +7 -7
- package/build/types/match-group.interface.js +2 -2
- package/build/types/match.interface.d.ts +6 -6
- package/build/types/match.interface.js +2 -2
- package/build/types/meeting-request-token.interface.d.ts +7 -6
- package/build/types/meeting-request-token.interface.js +2 -2
- package/build/types/meeting-type.enum.d.ts +6 -6
- package/build/types/meeting-type.enum.js +10 -10
- package/build/types/notification-event.enum.d.ts +12 -0
- package/build/types/notification-event.enum.js +17 -0
- package/build/types/notification-event.enum.js.map +1 -0
- package/build/types/notification-type.enum.d.ts +6 -0
- package/build/types/notification-type.enum.js +11 -0
- package/build/types/notification-type.enum.js.map +1 -0
- package/build/types/operation-types.d.ts +5 -5
- package/build/types/operation-types.js +9 -9
- package/build/types/read-result.interface.d.ts +5 -5
- package/build/types/read-result.interface.js +2 -2
- package/build/types/update-input-data.interface.d.ts +10 -10
- package/build/types/update-input-data.interface.js +2 -2
- package/build/types/upload-presigned-url.interface.d.ts +4 -4
- package/build/types/upload-presigned-url.interface.js +2 -2
- package/build/types/user-invitations.interface.d.ts +6 -6
- package/build/types/user-invitations.interface.js +2 -2
- package/build/types/user-role.enum.d.ts +7 -7
- package/build/types/user-role.enum.js +11 -11
- package/build/types/user-type.enum.d.ts +5 -5
- package/build/types/user-type.enum.js +9 -9
- package/build/types/visibility-group.interface.d.ts +6 -6
- package/build/types/visibility-group.interface.js +2 -2
- package/build/utils/create-default-directories.d.ts +1 -1
- package/build/utils/create-default-directories.js +23 -23
- package/build/utils/equal-array-object.d.ts +1 -1
- package/build/utils/equal-array-object.js +9 -9
- package/build/utils/equal-object.d.ts +1 -1
- package/build/utils/equal-object.js +8 -8
- package/build/utils/parse-query.d.ts +1 -1
- package/build/utils/parse-query.js +30 -30
- package/build/utils/projection.d.ts +1 -1
- package/build/utils/projection.js +25 -25
- package/build/utils/timezone.d.ts +2 -2
- package/build/utils/timezone.js +14 -14
- package/build/validators/conditional-required.d.ts +2 -2
- package/build/validators/conditional-required.js +23 -23
- package/build/validators/date-validator.d.ts +2 -2
- package/build/validators/date-validator.js +20 -20
- package/build/validators/responses/customizeArrayResponse.d.ts +3 -3
- package/build/validators/responses/customizeArrayResponse.js +23 -23
- package/build/validators/responses/error.d.ts +2 -2
- package/build/validators/responses/error.interface.d.ts +4 -4
- package/build/validators/responses/error.interface.js +2 -2
- package/build/validators/responses/error.js +28 -28
- package/build/validators/responses/response-option.interface.d.ts +7 -7
- package/build/validators/responses/response-option.interface.js +2 -2
- package/build/validators/responses/succes-result.interface.d.ts +10 -10
- package/build/validators/responses/succes-result.interface.js +2 -2
- package/build/validators/responses/success.d.ts +3 -3
- package/build/validators/responses/success.interface.d.ts +4 -4
- package/build/validators/responses/success.interface.js +2 -2
- package/build/validators/responses/success.js +14 -14
- package/build/validators/validateNewItem.d.ts +1 -1
- package/build/validators/validateNewItem.js +22 -22
- package/build/validators/validateProjection.d.ts +1 -1
- package/build/validators/validateProjection.js +32 -32
- package/build/validators/validateProjectionResult.d.ts +1 -1
- package/build/validators/validateProjectionResult.js +36 -36
- package/build/validators/validateUpdateItem.d.ts +1 -1
- package/build/validators/validateUpdateItem.js +22 -22
- package/package.json +35 -35
- package/build/types/visibility.interface.js.map +0 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseQuery = void 0;
|
|
4
|
-
function parseQuery(filterDto) {
|
|
5
|
-
if (typeof filterDto === 'object' && (filterDto === null || filterDto === void 0 ? void 0 : filterDto.order)) {
|
|
6
|
-
const newDto = JSON.parse(filterDto.order);
|
|
7
|
-
filterDto.order = newDto;
|
|
8
|
-
}
|
|
9
|
-
if (filterDto === null || filterDto === void 0 ? void 0 : filterDto.join) {
|
|
10
|
-
const newDto = JSON.parse(filterDto.join);
|
|
11
|
-
filterDto.join = newDto;
|
|
12
|
-
}
|
|
13
|
-
if ((filterDto === null || filterDto === void 0 ? void 0 : filterDto.where) && typeof filterDto.where === 'string') {
|
|
14
|
-
const newDto = JSON.parse(filterDto.where);
|
|
15
|
-
filterDto.where = newDto;
|
|
16
|
-
}
|
|
17
|
-
if ((filterDto === null || filterDto === void 0 ? void 0 : filterDto.where) && Array.isArray(filterDto.where)) {
|
|
18
|
-
const newWhere = filterDto.where.map((item) => {
|
|
19
|
-
if (typeof item === 'string') {
|
|
20
|
-
JSON.parse(item);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return item;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
filterDto.where = newWhere;
|
|
27
|
-
}
|
|
28
|
-
return filterDto;
|
|
29
|
-
}
|
|
30
|
-
exports.parseQuery = parseQuery;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseQuery = void 0;
|
|
4
|
+
function parseQuery(filterDto) {
|
|
5
|
+
if (typeof filterDto === 'object' && (filterDto === null || filterDto === void 0 ? void 0 : filterDto.order)) {
|
|
6
|
+
const newDto = JSON.parse(filterDto.order);
|
|
7
|
+
filterDto.order = newDto;
|
|
8
|
+
}
|
|
9
|
+
if (filterDto === null || filterDto === void 0 ? void 0 : filterDto.join) {
|
|
10
|
+
const newDto = JSON.parse(filterDto.join);
|
|
11
|
+
filterDto.join = newDto;
|
|
12
|
+
}
|
|
13
|
+
if ((filterDto === null || filterDto === void 0 ? void 0 : filterDto.where) && typeof filterDto.where === 'string') {
|
|
14
|
+
const newDto = JSON.parse(filterDto.where);
|
|
15
|
+
filterDto.where = newDto;
|
|
16
|
+
}
|
|
17
|
+
if ((filterDto === null || filterDto === void 0 ? void 0 : filterDto.where) && Array.isArray(filterDto.where)) {
|
|
18
|
+
const newWhere = filterDto.where.map((item) => {
|
|
19
|
+
if (typeof item === 'string') {
|
|
20
|
+
JSON.parse(item);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return item;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
filterDto.where = newWhere;
|
|
27
|
+
}
|
|
28
|
+
return filterDto;
|
|
29
|
+
}
|
|
30
|
+
exports.parseQuery = parseQuery;
|
|
31
31
|
//# sourceMappingURL=parse-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function projection(allProjectionFieldArray: string[], necessaryProjectionArray: string[]): {};
|
|
1
|
+
export declare function projection(allProjectionFieldArray: string[], necessaryProjectionArray: string[]): {};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.projection = void 0;
|
|
4
|
-
function projection(allProjectionFieldArray, necessaryProjectionArray) {
|
|
5
|
-
try {
|
|
6
|
-
const projection = {};
|
|
7
|
-
let returnAll = true;
|
|
8
|
-
Array.isArray(necessaryProjectionArray) &&
|
|
9
|
-
necessaryProjectionArray.length &&
|
|
10
|
-
necessaryProjectionArray.map((key) => {
|
|
11
|
-
if (allProjectionFieldArray.includes(key)) {
|
|
12
|
-
returnAll = false;
|
|
13
|
-
projection[key] = true;
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
if (returnAll) {
|
|
17
|
-
allProjectionFieldArray.map((key) => (projection[key] = true));
|
|
18
|
-
}
|
|
19
|
-
return projection;
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.projection = projection;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projection = void 0;
|
|
4
|
+
function projection(allProjectionFieldArray, necessaryProjectionArray) {
|
|
5
|
+
try {
|
|
6
|
+
const projection = {};
|
|
7
|
+
let returnAll = true;
|
|
8
|
+
Array.isArray(necessaryProjectionArray) &&
|
|
9
|
+
necessaryProjectionArray.length &&
|
|
10
|
+
necessaryProjectionArray.map((key) => {
|
|
11
|
+
if (allProjectionFieldArray.includes(key)) {
|
|
12
|
+
returnAll = false;
|
|
13
|
+
projection[key] = true;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
if (returnAll) {
|
|
17
|
+
allProjectionFieldArray.map((key) => (projection[key] = true));
|
|
18
|
+
}
|
|
19
|
+
return projection;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.projection = projection;
|
|
26
26
|
//# sourceMappingURL=projection.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function setTimezone(tz?: string): string;
|
|
2
|
-
export declare function getTimezone(): string;
|
|
1
|
+
export declare function setTimezone(tz?: string): string;
|
|
2
|
+
export declare function getTimezone(): string;
|
package/build/utils/timezone.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTimezone = exports.setTimezone = void 0;
|
|
4
|
-
function setTimezone(tz) {
|
|
5
|
-
if (tz)
|
|
6
|
-
return process.env.TZ = tz;
|
|
7
|
-
else
|
|
8
|
-
return process.env.TZ = 'Etc/GMT';
|
|
9
|
-
}
|
|
10
|
-
exports.setTimezone = setTimezone;
|
|
11
|
-
function getTimezone() {
|
|
12
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
13
|
-
}
|
|
14
|
-
exports.getTimezone = getTimezone;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTimezone = exports.setTimezone = void 0;
|
|
4
|
+
function setTimezone(tz) {
|
|
5
|
+
if (tz)
|
|
6
|
+
return process.env.TZ = tz;
|
|
7
|
+
else
|
|
8
|
+
return process.env.TZ = 'Etc/GMT';
|
|
9
|
+
}
|
|
10
|
+
exports.setTimezone = setTimezone;
|
|
11
|
+
function getTimezone() {
|
|
12
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
13
|
+
}
|
|
14
|
+
exports.getTimezone = getTimezone;
|
|
15
15
|
//# sourceMappingURL=timezone.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ValidationOptions } from 'class-validator';
|
|
2
|
-
export declare function ConditionalRequired(property: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
1
|
+
import { ValidationOptions } from 'class-validator';
|
|
2
|
+
export declare function ConditionalRequired(property: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConditionalRequired = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
function ConditionalRequired(property, validationOptions) {
|
|
6
|
-
return function (object, propertyName) {
|
|
7
|
-
class_validator_1.registerDecorator({
|
|
8
|
-
name: 'conditionalRequired',
|
|
9
|
-
target: object.constructor,
|
|
10
|
-
propertyName: propertyName,
|
|
11
|
-
constraints: [property],
|
|
12
|
-
options: validationOptions,
|
|
13
|
-
validator: {
|
|
14
|
-
validate(value, args) {
|
|
15
|
-
const [relatedPropertyName] = args.constraints;
|
|
16
|
-
const relatedValue = args.object[relatedPropertyName];
|
|
17
|
-
return !(!value && relatedValue);
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.ConditionalRequired = ConditionalRequired;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConditionalRequired = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
function ConditionalRequired(property, validationOptions) {
|
|
6
|
+
return function (object, propertyName) {
|
|
7
|
+
class_validator_1.registerDecorator({
|
|
8
|
+
name: 'conditionalRequired',
|
|
9
|
+
target: object.constructor,
|
|
10
|
+
propertyName: propertyName,
|
|
11
|
+
constraints: [property],
|
|
12
|
+
options: validationOptions,
|
|
13
|
+
validator: {
|
|
14
|
+
validate(value, args) {
|
|
15
|
+
const [relatedPropertyName] = args.constraints;
|
|
16
|
+
const relatedValue = args.object[relatedPropertyName];
|
|
17
|
+
return !(!value && relatedValue);
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.ConditionalRequired = ConditionalRequired;
|
|
24
24
|
//# sourceMappingURL=conditional-required.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ValidationOptions } from 'class-validator';
|
|
2
|
-
export declare function DateValidator(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
1
|
+
import { ValidationOptions } from 'class-validator';
|
|
2
|
+
export declare function DateValidator(validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateValidator = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
function DateValidator(validationOptions) {
|
|
6
|
-
return function (object, propertyName) {
|
|
7
|
-
class_validator_1.registerDecorator({
|
|
8
|
-
name: 'dateValidator',
|
|
9
|
-
target: object.constructor,
|
|
10
|
-
propertyName: propertyName,
|
|
11
|
-
options: validationOptions,
|
|
12
|
-
validator: {
|
|
13
|
-
validate(value) {
|
|
14
|
-
return new Date(value) > new Date();
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
exports.DateValidator = DateValidator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateValidator = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
function DateValidator(validationOptions) {
|
|
6
|
+
return function (object, propertyName) {
|
|
7
|
+
class_validator_1.registerDecorator({
|
|
8
|
+
name: 'dateValidator',
|
|
9
|
+
target: object.constructor,
|
|
10
|
+
propertyName: propertyName,
|
|
11
|
+
options: validationOptions,
|
|
12
|
+
validator: {
|
|
13
|
+
validate(value) {
|
|
14
|
+
return new Date(value) > new Date();
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.DateValidator = DateValidator;
|
|
21
21
|
//# sourceMappingURL=date-validator.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ResponseOption } from './response-option.interface';
|
|
2
|
-
import { SuccessResult } from './succes-result.interface';
|
|
3
|
-
export declare const customizeArrayResponse: (data?: unknown[], { hasTotal, total, skip, limit, sort, }?: ResponseOption) => SuccessResult;
|
|
1
|
+
import { ResponseOption } from './response-option.interface';
|
|
2
|
+
import { SuccessResult } from './succes-result.interface';
|
|
3
|
+
export declare const customizeArrayResponse: (data?: unknown[], { hasTotal, total, skip, limit, sort, }?: ResponseOption) => SuccessResult;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.customizeArrayResponse = void 0;
|
|
4
|
-
const customizeArrayResponse = (data = [], { hasTotal = false, total = 0, skip = null, limit = null, sort = null, } = {}) => {
|
|
5
|
-
const result = {
|
|
6
|
-
data: data,
|
|
7
|
-
count: data.length ? data.length : 0,
|
|
8
|
-
};
|
|
9
|
-
if (hasTotal) {
|
|
10
|
-
result.total = total >= data.length ? total : data.length;
|
|
11
|
-
}
|
|
12
|
-
if (skip || limit) {
|
|
13
|
-
result.hasStaticRange = true;
|
|
14
|
-
result.skip = skip;
|
|
15
|
-
result.limit = limit;
|
|
16
|
-
}
|
|
17
|
-
if (sort) {
|
|
18
|
-
result.customSort = true;
|
|
19
|
-
result.sort = sort;
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
23
|
-
exports.customizeArrayResponse = customizeArrayResponse;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customizeArrayResponse = void 0;
|
|
4
|
+
const customizeArrayResponse = (data = [], { hasTotal = false, total = 0, skip = null, limit = null, sort = null, } = {}) => {
|
|
5
|
+
const result = {
|
|
6
|
+
data: data,
|
|
7
|
+
count: data.length ? data.length : 0,
|
|
8
|
+
};
|
|
9
|
+
if (hasTotal) {
|
|
10
|
+
result.total = total >= data.length ? total : data.length;
|
|
11
|
+
}
|
|
12
|
+
if (skip || limit) {
|
|
13
|
+
result.hasStaticRange = true;
|
|
14
|
+
result.skip = skip;
|
|
15
|
+
result.limit = limit;
|
|
16
|
+
}
|
|
17
|
+
if (sort) {
|
|
18
|
+
result.customSort = true;
|
|
19
|
+
result.sort = sort;
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
exports.customizeArrayResponse = customizeArrayResponse;
|
|
24
24
|
//# sourceMappingURL=customizeArrayResponse.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ErrorResponse } from './error.interface';
|
|
2
|
-
export declare function error(err: any): ErrorResponse;
|
|
1
|
+
import { ErrorResponse } from './error.interface';
|
|
2
|
+
export declare function error(err: any): ErrorResponse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface ErrorResponse {
|
|
2
|
-
success: boolean;
|
|
3
|
-
error: object;
|
|
4
|
-
}
|
|
1
|
+
export interface ErrorResponse {
|
|
2
|
+
success: boolean;
|
|
3
|
+
error: object;
|
|
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=error.interface.js.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.error = void 0;
|
|
4
|
-
function error(err) {
|
|
5
|
-
var _a;
|
|
6
|
-
const error = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.message)
|
|
7
|
-
? err.response.message
|
|
8
|
-
: err.stack
|
|
9
|
-
? err.stack
|
|
10
|
-
: extractError(err) || err;
|
|
11
|
-
return {
|
|
12
|
-
success: false,
|
|
13
|
-
error: error,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.error = error;
|
|
17
|
-
const extractError = err => {
|
|
18
|
-
if (err.errors) {
|
|
19
|
-
for (const errorKey in err.errors) {
|
|
20
|
-
if (err.errors[errorKey].message) {
|
|
21
|
-
return err.errors[errorKey].message;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.error = void 0;
|
|
4
|
+
function error(err) {
|
|
5
|
+
var _a;
|
|
6
|
+
const error = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.message)
|
|
7
|
+
? err.response.message
|
|
8
|
+
: err.stack
|
|
9
|
+
? err.stack
|
|
10
|
+
: extractError(err) || err;
|
|
11
|
+
return {
|
|
12
|
+
success: false,
|
|
13
|
+
error: error,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.error = error;
|
|
17
|
+
const extractError = err => {
|
|
18
|
+
if (err.errors) {
|
|
19
|
+
for (const errorKey in err.errors) {
|
|
20
|
+
if (err.errors[errorKey].message) {
|
|
21
|
+
return err.errors[errorKey].message;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
29
|
//# sourceMappingURL=error.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface ResponseOption {
|
|
2
|
-
hasTotal?: boolean;
|
|
3
|
-
total?: number;
|
|
4
|
-
skip?: number;
|
|
5
|
-
limit?: number;
|
|
6
|
-
sort?: object | string;
|
|
7
|
-
}
|
|
1
|
+
export interface ResponseOption {
|
|
2
|
+
hasTotal?: boolean;
|
|
3
|
+
total?: number;
|
|
4
|
+
skip?: number;
|
|
5
|
+
limit?: number;
|
|
6
|
+
sort?: object | string;
|
|
7
|
+
}
|
|
@@ -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=response-option.interface.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface SuccessResult {
|
|
2
|
-
data: object | object[];
|
|
3
|
-
count?: number;
|
|
4
|
-
total?: number;
|
|
5
|
-
hasStaticRange?: boolean;
|
|
6
|
-
skip?: number;
|
|
7
|
-
limit?: number;
|
|
8
|
-
sort?: object | string;
|
|
9
|
-
customSort?: boolean;
|
|
10
|
-
}
|
|
1
|
+
export interface SuccessResult {
|
|
2
|
+
data: object | object[];
|
|
3
|
+
count?: number;
|
|
4
|
+
total?: number;
|
|
5
|
+
hasStaticRange?: boolean;
|
|
6
|
+
skip?: number;
|
|
7
|
+
limit?: number;
|
|
8
|
+
sort?: object | string;
|
|
9
|
+
customSort?: boolean;
|
|
10
|
+
}
|
|
@@ -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=succes-result.interface.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ResponseOption } from './response-option.interface';
|
|
2
|
-
import { SuccessResponse } from './success.interface';
|
|
3
|
-
export declare function success(result: object | object[], options?: ResponseOption): SuccessResponse;
|
|
1
|
+
import { ResponseOption } from './response-option.interface';
|
|
2
|
+
import { SuccessResponse } from './success.interface';
|
|
3
|
+
export declare function success(result: object | object[], options?: ResponseOption): SuccessResponse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface SuccessResponse {
|
|
2
|
-
success: boolean;
|
|
3
|
-
[key: string]: object | boolean;
|
|
4
|
-
}
|
|
1
|
+
export interface SuccessResponse {
|
|
2
|
+
success: boolean;
|
|
3
|
+
[key: string]: object | boolean;
|
|
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=success.interface.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.success = void 0;
|
|
4
|
-
const customizeArrayResponse_1 = require("./customizeArrayResponse");
|
|
5
|
-
function success(result, options) {
|
|
6
|
-
const response = {
|
|
7
|
-
success: true,
|
|
8
|
-
result: Array.isArray(result)
|
|
9
|
-
? customizeArrayResponse_1.customizeArrayResponse(result, options)
|
|
10
|
-
: result,
|
|
11
|
-
};
|
|
12
|
-
return response;
|
|
13
|
-
}
|
|
14
|
-
exports.success = success;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.success = void 0;
|
|
4
|
+
const customizeArrayResponse_1 = require("./customizeArrayResponse");
|
|
5
|
+
function success(result, options) {
|
|
6
|
+
const response = {
|
|
7
|
+
success: true,
|
|
8
|
+
result: Array.isArray(result)
|
|
9
|
+
? customizeArrayResponse_1.customizeArrayResponse(result, options)
|
|
10
|
+
: result,
|
|
11
|
+
};
|
|
12
|
+
return response;
|
|
13
|
+
}
|
|
14
|
+
exports.success = success;
|
|
15
15
|
//# sourceMappingURL=success.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function validateNewItem(allValidateNewItemFieldArray: string[], newItemObj: object): object;
|
|
1
|
+
export declare function validateNewItem(allValidateNewItemFieldArray: string[], newItemObj: object): object;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateNewItem = void 0;
|
|
4
|
-
function validateNewItem(allValidateNewItemFieldArray, newItemObj) {
|
|
5
|
-
const validatedNewItem = {};
|
|
6
|
-
try {
|
|
7
|
-
if (Array.isArray(allValidateNewItemFieldArray) &&
|
|
8
|
-
allValidateNewItemFieldArray.length) {
|
|
9
|
-
for (const fieldName in newItemObj) {
|
|
10
|
-
if (newItemObj[fieldName] !== undefined &&
|
|
11
|
-
allValidateNewItemFieldArray.includes(fieldName)) {
|
|
12
|
-
validatedNewItem[fieldName] = newItemObj[fieldName];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return validatedNewItem;
|
|
17
|
-
}
|
|
18
|
-
catch (err) {
|
|
19
|
-
throw err;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.validateNewItem = validateNewItem;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateNewItem = void 0;
|
|
4
|
+
function validateNewItem(allValidateNewItemFieldArray, newItemObj) {
|
|
5
|
+
const validatedNewItem = {};
|
|
6
|
+
try {
|
|
7
|
+
if (Array.isArray(allValidateNewItemFieldArray) &&
|
|
8
|
+
allValidateNewItemFieldArray.length) {
|
|
9
|
+
for (const fieldName in newItemObj) {
|
|
10
|
+
if (newItemObj[fieldName] !== undefined &&
|
|
11
|
+
allValidateNewItemFieldArray.includes(fieldName)) {
|
|
12
|
+
validatedNewItem[fieldName] = newItemObj[fieldName];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return validatedNewItem;
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
throw err;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.validateNewItem = validateNewItem;
|
|
23
23
|
//# sourceMappingURL=validateNewItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function validateProjection(allProjectionFieldArray: string[], necessaryProjectionArray: string[]): object;
|
|
1
|
+
export declare function validateProjection(allProjectionFieldArray: string[], necessaryProjectionArray: string[]): object;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateProjection = void 0;
|
|
4
|
-
function validateProjection(allProjectionFieldArray, necessaryProjectionArray) {
|
|
5
|
-
const validatedProjection = {};
|
|
6
|
-
try {
|
|
7
|
-
let returnAll = true;
|
|
8
|
-
Array.isArray(necessaryProjectionArray) &&
|
|
9
|
-
necessaryProjectionArray.length &&
|
|
10
|
-
necessaryProjectionArray.map((key) => {
|
|
11
|
-
if (allProjectionFieldArray.length) {
|
|
12
|
-
if (allProjectionFieldArray.includes(key)) {
|
|
13
|
-
returnAll = false;
|
|
14
|
-
validatedProjection[key] = true;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
returnAll = false;
|
|
19
|
-
validatedProjection[key] = true;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
if (returnAll) {
|
|
23
|
-
allProjectionFieldArray.map((key) => (validatedProjection[key] = true));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
}
|
|
28
|
-
finally {
|
|
29
|
-
return validatedProjection;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.validateProjection = validateProjection;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateProjection = void 0;
|
|
4
|
+
function validateProjection(allProjectionFieldArray, necessaryProjectionArray) {
|
|
5
|
+
const validatedProjection = {};
|
|
6
|
+
try {
|
|
7
|
+
let returnAll = true;
|
|
8
|
+
Array.isArray(necessaryProjectionArray) &&
|
|
9
|
+
necessaryProjectionArray.length &&
|
|
10
|
+
necessaryProjectionArray.map((key) => {
|
|
11
|
+
if (allProjectionFieldArray.length) {
|
|
12
|
+
if (allProjectionFieldArray.includes(key)) {
|
|
13
|
+
returnAll = false;
|
|
14
|
+
validatedProjection[key] = true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
returnAll = false;
|
|
19
|
+
validatedProjection[key] = true;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (returnAll) {
|
|
23
|
+
allProjectionFieldArray.map((key) => (validatedProjection[key] = true));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
return validatedProjection;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.validateProjection = validateProjection;
|
|
33
33
|
//# sourceMappingURL=validateProjection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function validateProjectionResult(allProjectionFieldArray: string[], necessaryProjectionObj: any): object;
|
|
1
|
+
export declare function validateProjectionResult(allProjectionFieldArray: string[], necessaryProjectionObj: any): object;
|