connectfy-shared 0.0.71 → 0.0.73
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/dist/index.cjs +22 -59
- package/dist/index.d.cts +3 -15
- package/dist/index.d.ts +3 -15
- package/dist/index.mjs +22 -58
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9455,7 +9455,6 @@ __export(index_exports, {
|
|
|
9455
9455
|
ENV: () => ENV,
|
|
9456
9456
|
EXPIRE_DATES: () => EXPIRE_DATES,
|
|
9457
9457
|
ExceptionMessages: () => ExceptionMessages,
|
|
9458
|
-
ExceptionTypes: () => ExceptionTypes,
|
|
9459
9458
|
FIELD_TRANSFORMER_REGISTRY: () => FIELD_TRANSFORMER_REGISTRY,
|
|
9460
9459
|
FIELD_TYPE: () => FIELD_TYPE,
|
|
9461
9460
|
FIELD_VALIDATOR_REGISTRY: () => FIELD_VALIDATOR_REGISTRY,
|
|
@@ -9517,9 +9516,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
9517
9516
|
// src/class/server/base.exception.ts
|
|
9518
9517
|
var import_microservices = require("@nestjs/microservices");
|
|
9519
9518
|
var BaseException = class extends import_microservices.RpcException {
|
|
9520
|
-
constructor(messageOrFunc = ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE, statusCode = 500 /* INTERNAL_SERVER_ERROR */,
|
|
9519
|
+
constructor(messageOrFunc = ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE, statusCode = 500 /* INTERNAL_SERVER_ERROR */, additional) {
|
|
9521
9520
|
const message = typeof messageOrFunc === "function" ? messageOrFunc() : messageOrFunc;
|
|
9522
|
-
super({ message, statusCode,
|
|
9521
|
+
super({ message, statusCode, additional });
|
|
9523
9522
|
}
|
|
9524
9523
|
};
|
|
9525
9524
|
|
|
@@ -9611,7 +9610,7 @@ var COLLECTIONS = {
|
|
|
9611
9610
|
}
|
|
9612
9611
|
},
|
|
9613
9612
|
ACCOUNT: {
|
|
9614
|
-
|
|
9613
|
+
PROFILES: "profiles",
|
|
9615
9614
|
SOCIAL_LINKS: "social_links",
|
|
9616
9615
|
SETTINGS: {
|
|
9617
9616
|
GENERAL: "general_settings",
|
|
@@ -9788,18 +9787,6 @@ var ExceptionMessages = {
|
|
|
9788
9787
|
}),
|
|
9789
9788
|
INVALID_LENGTH_MESSAGE: (field, lang = "en" /* EN */) => i18n_default.t("exception_messages.invalid_length", { field, lng: lang })
|
|
9790
9789
|
};
|
|
9791
|
-
var ExceptionTypes = {
|
|
9792
|
-
INTERNAL_SERVER_ERROR: "InternalServerError",
|
|
9793
|
-
BAD_REQUEST: "BadRequest",
|
|
9794
|
-
UNAUTHORIZED: "Unauthorized",
|
|
9795
|
-
FORBIDDEN: "Forbidden",
|
|
9796
|
-
NOT_FOUND: "NotFound",
|
|
9797
|
-
CONFLICT: "Conflict",
|
|
9798
|
-
UNPROCESSABLE_ENTITY: "UnprocessableEntity",
|
|
9799
|
-
GONE: "Gone",
|
|
9800
|
-
TOO_MANY_REQUESTS: "TooManyRequests",
|
|
9801
|
-
ALREADY_EXISTS: "AlreadyExists"
|
|
9802
|
-
};
|
|
9803
9790
|
|
|
9804
9791
|
// src/enums/enum.ts
|
|
9805
9792
|
var GENDER = /* @__PURE__ */ ((GENDER2) => {
|
|
@@ -11097,7 +11084,6 @@ var AllExceptionsFilter = class {
|
|
|
11097
11084
|
catch(exception, host) {
|
|
11098
11085
|
let message = ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE("en" /* EN */);
|
|
11099
11086
|
let statusCode = import_common3.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
11100
|
-
let errorType = ExceptionTypes.INTERNAL_SERVER_ERROR;
|
|
11101
11087
|
let additional;
|
|
11102
11088
|
const isRpcException = exception instanceof import_microservices2.RpcException || exception && typeof exception === "object" && "error" in exception && typeof exception.getError === "function" || exception && typeof exception === "object" && "error" in exception && typeof exception.error === "object";
|
|
11103
11089
|
if (isRpcException) {
|
|
@@ -11105,7 +11091,6 @@ var AllExceptionsFilter = class {
|
|
|
11105
11091
|
if (typeof errorObj === "object" && errorObj !== null) {
|
|
11106
11092
|
message = errorObj?.message || message;
|
|
11107
11093
|
statusCode = errorObj?.statusCode || statusCode;
|
|
11108
|
-
errorType = errorObj?.error || errorType;
|
|
11109
11094
|
additional = errorObj?.additional;
|
|
11110
11095
|
} else if (typeof errorObj === "string") {
|
|
11111
11096
|
message = errorObj;
|
|
@@ -11115,7 +11100,6 @@ var AllExceptionsFilter = class {
|
|
|
11115
11100
|
const resObj = typeof response === "string" ? { message: response } : response;
|
|
11116
11101
|
message = resObj.message || exception.message;
|
|
11117
11102
|
statusCode = exception.getStatus();
|
|
11118
|
-
errorType = resObj.error || exception.name;
|
|
11119
11103
|
additional = resObj?.additional;
|
|
11120
11104
|
} else if (exception instanceof Error) {
|
|
11121
11105
|
if (message === ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE("en" /* EN */)) {
|
|
@@ -11127,7 +11111,6 @@ var AllExceptionsFilter = class {
|
|
|
11127
11111
|
message,
|
|
11128
11112
|
// This will now be the correct string from Step 1
|
|
11129
11113
|
statusCode,
|
|
11130
|
-
error: errorType,
|
|
11131
11114
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11132
11115
|
// Good practice to add
|
|
11133
11116
|
...additional ? { additional } : {}
|
|
@@ -11146,8 +11129,7 @@ function stringTransform({ value, key }) {
|
|
|
11146
11129
|
if (typeof value !== "string") {
|
|
11147
11130
|
throw new BaseException(
|
|
11148
11131
|
(lang) => ExceptionMessages.STRING_OR_NULL_MESSAGE(key, lang),
|
|
11149
|
-
400 /* BAD_REQUEST
|
|
11150
|
-
ExceptionTypes.BAD_REQUEST
|
|
11132
|
+
400 /* BAD_REQUEST */
|
|
11151
11133
|
);
|
|
11152
11134
|
}
|
|
11153
11135
|
const trimmedValue = value.trim();
|
|
@@ -11164,8 +11146,7 @@ function numberTransform({ value, key }) {
|
|
|
11164
11146
|
if (isNaN(value)) {
|
|
11165
11147
|
throw new BaseException(
|
|
11166
11148
|
(lang) => ExceptionMessages.NUMBER_OR_NULL_MESSAGE(key, lang),
|
|
11167
|
-
400 /* BAD_REQUEST
|
|
11168
|
-
ExceptionTypes.BAD_REQUEST
|
|
11149
|
+
400 /* BAD_REQUEST */
|
|
11169
11150
|
);
|
|
11170
11151
|
}
|
|
11171
11152
|
return value;
|
|
@@ -11177,16 +11158,14 @@ function numberTransform({ value, key }) {
|
|
|
11177
11158
|
if (isNaN(num)) {
|
|
11178
11159
|
throw new BaseException(
|
|
11179
11160
|
(lang) => ExceptionMessages.NUMBER_OR_NULL_MESSAGE(key, lang),
|
|
11180
|
-
400 /* BAD_REQUEST
|
|
11181
|
-
ExceptionTypes.BAD_REQUEST
|
|
11161
|
+
400 /* BAD_REQUEST */
|
|
11182
11162
|
);
|
|
11183
11163
|
}
|
|
11184
11164
|
return num;
|
|
11185
11165
|
}
|
|
11186
11166
|
throw new BaseException(
|
|
11187
11167
|
(lang) => ExceptionMessages.NUMBER_OR_NULL_MESSAGE(key, lang),
|
|
11188
|
-
400 /* BAD_REQUEST
|
|
11189
|
-
ExceptionTypes.BAD_REQUEST
|
|
11168
|
+
400 /* BAD_REQUEST */
|
|
11190
11169
|
);
|
|
11191
11170
|
}
|
|
11192
11171
|
function arrayTransform({ value, key }) {
|
|
@@ -11196,15 +11175,13 @@ function arrayTransform({ value, key }) {
|
|
|
11196
11175
|
if (!Array.isArray(value)) {
|
|
11197
11176
|
throw new BaseException(
|
|
11198
11177
|
(lang) => ExceptionMessages.ARRAY_TYPE_MESSAGE(key, lang),
|
|
11199
|
-
400 /* BAD_REQUEST
|
|
11200
|
-
ExceptionTypes.BAD_REQUEST
|
|
11178
|
+
400 /* BAD_REQUEST */
|
|
11201
11179
|
);
|
|
11202
11180
|
}
|
|
11203
11181
|
if (value.length === 0) {
|
|
11204
11182
|
throw new BaseException(
|
|
11205
11183
|
(lang) => ExceptionMessages.ARRAY_MIN_ONE_MESSAGE(key, lang),
|
|
11206
|
-
400 /* BAD_REQUEST
|
|
11207
|
-
ExceptionTypes.BAD_REQUEST
|
|
11184
|
+
400 /* BAD_REQUEST */
|
|
11208
11185
|
);
|
|
11209
11186
|
}
|
|
11210
11187
|
return value;
|
|
@@ -11216,15 +11193,13 @@ function objectTransform({ value, key }) {
|
|
|
11216
11193
|
if (typeof value !== "object" || Array.isArray(value)) {
|
|
11217
11194
|
throw new BaseException(
|
|
11218
11195
|
(lang) => ExceptionMessages.OBJECT_TYPE_MESSAGE(key, lang),
|
|
11219
|
-
400 /* BAD_REQUEST
|
|
11220
|
-
ExceptionTypes.BAD_REQUEST
|
|
11196
|
+
400 /* BAD_REQUEST */
|
|
11221
11197
|
);
|
|
11222
11198
|
}
|
|
11223
11199
|
if (Object.keys(value).length === 0) {
|
|
11224
11200
|
throw new BaseException(
|
|
11225
11201
|
(lang) => ExceptionMessages.OBJECT_MIN_ONE_PROPERTY_MESSAGE(key, lang),
|
|
11226
|
-
400 /* BAD_REQUEST
|
|
11227
|
-
ExceptionTypes.BAD_REQUEST
|
|
11202
|
+
400 /* BAD_REQUEST */
|
|
11228
11203
|
);
|
|
11229
11204
|
}
|
|
11230
11205
|
return value;
|
|
@@ -11237,8 +11212,7 @@ function dateTransform({ value, key }) {
|
|
|
11237
11212
|
if (isNaN(value.getTime())) {
|
|
11238
11213
|
throw new BaseException(
|
|
11239
11214
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11240
|
-
400 /* BAD_REQUEST
|
|
11241
|
-
ExceptionTypes.BAD_REQUEST
|
|
11215
|
+
400 /* BAD_REQUEST */
|
|
11242
11216
|
);
|
|
11243
11217
|
}
|
|
11244
11218
|
return value;
|
|
@@ -11247,8 +11221,7 @@ function dateTransform({ value, key }) {
|
|
|
11247
11221
|
if (parsedValue) {
|
|
11248
11222
|
throw new BaseException(
|
|
11249
11223
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11250
|
-
400 /* BAD_REQUEST
|
|
11251
|
-
ExceptionTypes.BAD_REQUEST
|
|
11224
|
+
400 /* BAD_REQUEST */
|
|
11252
11225
|
);
|
|
11253
11226
|
}
|
|
11254
11227
|
if (typeof value === "string") {
|
|
@@ -11257,32 +11230,28 @@ function dateTransform({ value, key }) {
|
|
|
11257
11230
|
if (!isNaN(Number(trimmed))) {
|
|
11258
11231
|
throw new BaseException(
|
|
11259
11232
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11260
|
-
400 /* BAD_REQUEST
|
|
11261
|
-
ExceptionTypes.BAD_REQUEST
|
|
11233
|
+
400 /* BAD_REQUEST */
|
|
11262
11234
|
);
|
|
11263
11235
|
}
|
|
11264
11236
|
const date = new Date(trimmed);
|
|
11265
11237
|
if (isNaN(date.getTime())) {
|
|
11266
11238
|
throw new BaseException(
|
|
11267
11239
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11268
|
-
400 /* BAD_REQUEST
|
|
11269
|
-
ExceptionTypes.BAD_REQUEST
|
|
11240
|
+
400 /* BAD_REQUEST */
|
|
11270
11241
|
);
|
|
11271
11242
|
}
|
|
11272
11243
|
return date;
|
|
11273
11244
|
}
|
|
11274
11245
|
throw new BaseException(
|
|
11275
11246
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11276
|
-
400 /* BAD_REQUEST
|
|
11277
|
-
ExceptionTypes.BAD_REQUEST
|
|
11247
|
+
400 /* BAD_REQUEST */
|
|
11278
11248
|
);
|
|
11279
11249
|
}
|
|
11280
11250
|
function booleanTransform({ value, key }) {
|
|
11281
11251
|
if (value === void 0 || value === null) {
|
|
11282
11252
|
throw new BaseException(
|
|
11283
11253
|
(lang) => ExceptionMessages.BOOLEAN_INVALID_MESSAGE(key, lang),
|
|
11284
|
-
400 /* BAD_REQUEST
|
|
11285
|
-
ExceptionTypes.BAD_REQUEST
|
|
11254
|
+
400 /* BAD_REQUEST */
|
|
11286
11255
|
);
|
|
11287
11256
|
}
|
|
11288
11257
|
if (typeof value === "boolean") {
|
|
@@ -11294,14 +11263,12 @@ function booleanTransform({ value, key }) {
|
|
|
11294
11263
|
if (trimmed === "false") return false;
|
|
11295
11264
|
throw new BaseException(
|
|
11296
11265
|
(lang) => ExceptionMessages.BOOLEAN_INVALID_MESSAGE(key, lang),
|
|
11297
|
-
400 /* BAD_REQUEST
|
|
11298
|
-
ExceptionTypes.BAD_REQUEST
|
|
11266
|
+
400 /* BAD_REQUEST */
|
|
11299
11267
|
);
|
|
11300
11268
|
}
|
|
11301
11269
|
throw new BaseException(
|
|
11302
11270
|
(lang) => ExceptionMessages.BOOLEAN_TYPE_MESSAGE(key, lang),
|
|
11303
|
-
400 /* BAD_REQUEST
|
|
11304
|
-
ExceptionTypes.BAD_REQUEST
|
|
11271
|
+
400 /* BAD_REQUEST */
|
|
11305
11272
|
);
|
|
11306
11273
|
}
|
|
11307
11274
|
function enumTransform({
|
|
@@ -11318,8 +11285,7 @@ function enumTransform({
|
|
|
11318
11285
|
}
|
|
11319
11286
|
throw new BaseException(
|
|
11320
11287
|
(lang) => ExceptionMessages.ENUM_INVALID_MESSAGE(key, enumValues, lang),
|
|
11321
|
-
400 /* BAD_REQUEST
|
|
11322
|
-
ExceptionTypes.BAD_REQUEST
|
|
11288
|
+
400 /* BAD_REQUEST */
|
|
11323
11289
|
);
|
|
11324
11290
|
}
|
|
11325
11291
|
function upperCaseTranform(value) {
|
|
@@ -11327,8 +11293,7 @@ function upperCaseTranform(value) {
|
|
|
11327
11293
|
if (typeof value !== "string")
|
|
11328
11294
|
throw new BaseException(
|
|
11329
11295
|
(lang) => ExceptionMessages.STRING_OR_NULL_MESSAGE(value, lang),
|
|
11330
|
-
400 /* BAD_REQUEST
|
|
11331
|
-
ExceptionTypes.BAD_REQUEST
|
|
11296
|
+
400 /* BAD_REQUEST */
|
|
11332
11297
|
);
|
|
11333
11298
|
return value.toUpperCase();
|
|
11334
11299
|
}
|
|
@@ -11337,8 +11302,7 @@ function lowerCaseTranform(value) {
|
|
|
11337
11302
|
if (typeof value !== "string")
|
|
11338
11303
|
throw new BaseException(
|
|
11339
11304
|
(lang) => ExceptionMessages.STRING_OR_NULL_MESSAGE(value, lang),
|
|
11340
|
-
400 /* BAD_REQUEST
|
|
11341
|
-
ExceptionTypes.BAD_REQUEST
|
|
11305
|
+
400 /* BAD_REQUEST */
|
|
11342
11306
|
);
|
|
11343
11307
|
return value.toLowerCase();
|
|
11344
11308
|
}
|
|
@@ -11555,7 +11519,6 @@ var BaseRepository = class {
|
|
|
11555
11519
|
ENV,
|
|
11556
11520
|
EXPIRE_DATES,
|
|
11557
11521
|
ExceptionMessages,
|
|
11558
|
-
ExceptionTypes,
|
|
11559
11522
|
FIELD_TRANSFORMER_REGISTRY,
|
|
11560
11523
|
FIELD_TYPE,
|
|
11561
11524
|
FIELD_VALIDATOR_REGISTRY,
|
package/dist/index.d.cts
CHANGED
|
@@ -8,7 +8,7 @@ import * as rxjs from 'rxjs';
|
|
|
8
8
|
import { Observable } from 'rxjs';
|
|
9
9
|
|
|
10
10
|
declare class BaseException extends RpcException {
|
|
11
|
-
constructor(messageOrFunc?: string | string[] | ((...args: any[]) => string | string[]), statusCode?: HttpStatus,
|
|
11
|
+
constructor(messageOrFunc?: string | string[] | ((...args: any[]) => string | string[]), statusCode?: HttpStatus, additional?: Record<string, any>);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface ICountry {
|
|
@@ -133,7 +133,7 @@ declare const COLLECTIONS: {
|
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
ACCOUNT: {
|
|
136
|
-
|
|
136
|
+
PROFILES: string;
|
|
137
137
|
SOCIAL_LINKS: string;
|
|
138
138
|
SETTINGS: {
|
|
139
139
|
GENERAL: string;
|
|
@@ -191,18 +191,6 @@ declare const ExceptionMessages: {
|
|
|
191
191
|
ENUM_INVALID_MESSAGE: (field: string, validValues: any[], lang?: LANGUAGE) => string;
|
|
192
192
|
INVALID_LENGTH_MESSAGE: (field: string, lang?: LANGUAGE) => string;
|
|
193
193
|
};
|
|
194
|
-
declare const ExceptionTypes: {
|
|
195
|
-
INTERNAL_SERVER_ERROR: string;
|
|
196
|
-
BAD_REQUEST: string;
|
|
197
|
-
UNAUTHORIZED: string;
|
|
198
|
-
FORBIDDEN: string;
|
|
199
|
-
NOT_FOUND: string;
|
|
200
|
-
CONFLICT: string;
|
|
201
|
-
UNPROCESSABLE_ENTITY: string;
|
|
202
|
-
GONE: string;
|
|
203
|
-
TOO_MANY_REQUESTS: string;
|
|
204
|
-
ALREADY_EXISTS: string;
|
|
205
|
-
};
|
|
206
194
|
|
|
207
195
|
declare enum GENDER {
|
|
208
196
|
MALE = "MALE",
|
|
@@ -800,4 +788,4 @@ declare abstract class BaseRepository<TDocument extends Document, TInterface ext
|
|
|
800
788
|
count(query: Record<string, any>): Promise<number>;
|
|
801
789
|
}
|
|
802
790
|
|
|
803
|
-
export { AllExceptionsFilter, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, DATE_FORMAT, DELETE_REASON, DEVICE_TYPE, ENV, EXPIRE_DATES, ExceptionMessages,
|
|
791
|
+
export { AllExceptionsFilter, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, DATE_FORMAT, DELETE_REASON, DEVICE_TYPE, ENV, EXPIRE_DATES, ExceptionMessages, FIELD_TRANSFORMER_REGISTRY, FIELD_TYPE, FIELD_VALIDATOR_REGISTRY, FORGOT_PASSWORD_IDENTIFIER_TYPE, FRIENDSHIP_STATUS, FieldValidator, type FieldValidatorOptions, GENDER, GOOGLE_AUTH_LOGIN_TYPE, HttpStatus, type IAccount, type IArrayFieldOptions, type IBaseFieldOptions, type IBooleanFieldOptions, IDENTIFIER_TYPE, type IDateFieldOptions, type IEnumFieldOptions, type IGeneralSettings, type ILoggedUser, type INotificationSettings, type INumberFieldOptions, type IObjectFieldOptions, type IPhoneNumber, type IPrivacySettings, type IRemoveAllResponse, type IStringFieldOptions, type ITimeZone, type IUser, type IValidateMessageOptions, LANGUAGE, LOCAL_STORAGE_KEYS, MICROSERVICE_NAMES, NOTIFICATION_CONTENT_MODE, NOTIFICATION_SOUND_MODE, OS_TYPE, PHONE_NUMBER_ACTION, PRIVACY_SETTINGS_CHOICE, PROVIDER, PopulateOption, REDUCER_PATH, RESOURCE, ROLE, SOCIAL_LINK_PLATFORM, STARTUP_PAGE, TAG_TYPES, THEME, TIME_DIFFERENCE_TYPE, TIME_FORMAT, TOKEN_TYPE, USER_STATUS, VALIDATION_TYPE, accountDeletedMessage, arrayTransform, booleanTransform, changeEmailMessage, dateTransform, decryptPayload, deleteAccountMessage, emailNotFoundMessage, emitWithContext, encryptPayload, enumTransform, forgotPasswordMessage, getLang, googleSignInMessage, lowerCaseTranform, numberTransform, objectTransform, sendWithContext, signupVerifyMessage, stringTransform, upperCaseTranform, validationMessage, verifyYourselfMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import * as rxjs from 'rxjs';
|
|
|
8
8
|
import { Observable } from 'rxjs';
|
|
9
9
|
|
|
10
10
|
declare class BaseException extends RpcException {
|
|
11
|
-
constructor(messageOrFunc?: string | string[] | ((...args: any[]) => string | string[]), statusCode?: HttpStatus,
|
|
11
|
+
constructor(messageOrFunc?: string | string[] | ((...args: any[]) => string | string[]), statusCode?: HttpStatus, additional?: Record<string, any>);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
interface ICountry {
|
|
@@ -133,7 +133,7 @@ declare const COLLECTIONS: {
|
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
ACCOUNT: {
|
|
136
|
-
|
|
136
|
+
PROFILES: string;
|
|
137
137
|
SOCIAL_LINKS: string;
|
|
138
138
|
SETTINGS: {
|
|
139
139
|
GENERAL: string;
|
|
@@ -191,18 +191,6 @@ declare const ExceptionMessages: {
|
|
|
191
191
|
ENUM_INVALID_MESSAGE: (field: string, validValues: any[], lang?: LANGUAGE) => string;
|
|
192
192
|
INVALID_LENGTH_MESSAGE: (field: string, lang?: LANGUAGE) => string;
|
|
193
193
|
};
|
|
194
|
-
declare const ExceptionTypes: {
|
|
195
|
-
INTERNAL_SERVER_ERROR: string;
|
|
196
|
-
BAD_REQUEST: string;
|
|
197
|
-
UNAUTHORIZED: string;
|
|
198
|
-
FORBIDDEN: string;
|
|
199
|
-
NOT_FOUND: string;
|
|
200
|
-
CONFLICT: string;
|
|
201
|
-
UNPROCESSABLE_ENTITY: string;
|
|
202
|
-
GONE: string;
|
|
203
|
-
TOO_MANY_REQUESTS: string;
|
|
204
|
-
ALREADY_EXISTS: string;
|
|
205
|
-
};
|
|
206
194
|
|
|
207
195
|
declare enum GENDER {
|
|
208
196
|
MALE = "MALE",
|
|
@@ -800,4 +788,4 @@ declare abstract class BaseRepository<TDocument extends Document, TInterface ext
|
|
|
800
788
|
count(query: Record<string, any>): Promise<number>;
|
|
801
789
|
}
|
|
802
790
|
|
|
803
|
-
export { AllExceptionsFilter, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, DATE_FORMAT, DELETE_REASON, DEVICE_TYPE, ENV, EXPIRE_DATES, ExceptionMessages,
|
|
791
|
+
export { AllExceptionsFilter, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, DATE_FORMAT, DELETE_REASON, DEVICE_TYPE, ENV, EXPIRE_DATES, ExceptionMessages, FIELD_TRANSFORMER_REGISTRY, FIELD_TYPE, FIELD_VALIDATOR_REGISTRY, FORGOT_PASSWORD_IDENTIFIER_TYPE, FRIENDSHIP_STATUS, FieldValidator, type FieldValidatorOptions, GENDER, GOOGLE_AUTH_LOGIN_TYPE, HttpStatus, type IAccount, type IArrayFieldOptions, type IBaseFieldOptions, type IBooleanFieldOptions, IDENTIFIER_TYPE, type IDateFieldOptions, type IEnumFieldOptions, type IGeneralSettings, type ILoggedUser, type INotificationSettings, type INumberFieldOptions, type IObjectFieldOptions, type IPhoneNumber, type IPrivacySettings, type IRemoveAllResponse, type IStringFieldOptions, type ITimeZone, type IUser, type IValidateMessageOptions, LANGUAGE, LOCAL_STORAGE_KEYS, MICROSERVICE_NAMES, NOTIFICATION_CONTENT_MODE, NOTIFICATION_SOUND_MODE, OS_TYPE, PHONE_NUMBER_ACTION, PRIVACY_SETTINGS_CHOICE, PROVIDER, PopulateOption, REDUCER_PATH, RESOURCE, ROLE, SOCIAL_LINK_PLATFORM, STARTUP_PAGE, TAG_TYPES, THEME, TIME_DIFFERENCE_TYPE, TIME_FORMAT, TOKEN_TYPE, USER_STATUS, VALIDATION_TYPE, accountDeletedMessage, arrayTransform, booleanTransform, changeEmailMessage, dateTransform, decryptPayload, deleteAccountMessage, emailNotFoundMessage, emitWithContext, encryptPayload, enumTransform, forgotPasswordMessage, getLang, googleSignInMessage, lowerCaseTranform, numberTransform, objectTransform, sendWithContext, signupVerifyMessage, stringTransform, upperCaseTranform, validationMessage, verifyYourselfMessage };
|
package/dist/index.mjs
CHANGED
|
@@ -9432,9 +9432,9 @@ var require_cjs = __commonJS({
|
|
|
9432
9432
|
// src/class/server/base.exception.ts
|
|
9433
9433
|
import { RpcException } from "@nestjs/microservices";
|
|
9434
9434
|
var BaseException = class extends RpcException {
|
|
9435
|
-
constructor(messageOrFunc = ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE, statusCode = 500 /* INTERNAL_SERVER_ERROR */,
|
|
9435
|
+
constructor(messageOrFunc = ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE, statusCode = 500 /* INTERNAL_SERVER_ERROR */, additional) {
|
|
9436
9436
|
const message = typeof messageOrFunc === "function" ? messageOrFunc() : messageOrFunc;
|
|
9437
|
-
super({ message, statusCode,
|
|
9437
|
+
super({ message, statusCode, additional });
|
|
9438
9438
|
}
|
|
9439
9439
|
};
|
|
9440
9440
|
|
|
@@ -9526,7 +9526,7 @@ var COLLECTIONS = {
|
|
|
9526
9526
|
}
|
|
9527
9527
|
},
|
|
9528
9528
|
ACCOUNT: {
|
|
9529
|
-
|
|
9529
|
+
PROFILES: "profiles",
|
|
9530
9530
|
SOCIAL_LINKS: "social_links",
|
|
9531
9531
|
SETTINGS: {
|
|
9532
9532
|
GENERAL: "general_settings",
|
|
@@ -9703,18 +9703,6 @@ var ExceptionMessages = {
|
|
|
9703
9703
|
}),
|
|
9704
9704
|
INVALID_LENGTH_MESSAGE: (field, lang = "en" /* EN */) => i18n_default.t("exception_messages.invalid_length", { field, lng: lang })
|
|
9705
9705
|
};
|
|
9706
|
-
var ExceptionTypes = {
|
|
9707
|
-
INTERNAL_SERVER_ERROR: "InternalServerError",
|
|
9708
|
-
BAD_REQUEST: "BadRequest",
|
|
9709
|
-
UNAUTHORIZED: "Unauthorized",
|
|
9710
|
-
FORBIDDEN: "Forbidden",
|
|
9711
|
-
NOT_FOUND: "NotFound",
|
|
9712
|
-
CONFLICT: "Conflict",
|
|
9713
|
-
UNPROCESSABLE_ENTITY: "UnprocessableEntity",
|
|
9714
|
-
GONE: "Gone",
|
|
9715
|
-
TOO_MANY_REQUESTS: "TooManyRequests",
|
|
9716
|
-
ALREADY_EXISTS: "AlreadyExists"
|
|
9717
|
-
};
|
|
9718
9706
|
|
|
9719
9707
|
// src/enums/enum.ts
|
|
9720
9708
|
var GENDER = /* @__PURE__ */ ((GENDER2) => {
|
|
@@ -11058,7 +11046,6 @@ var AllExceptionsFilter = class {
|
|
|
11058
11046
|
catch(exception, host) {
|
|
11059
11047
|
let message = ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE("en" /* EN */);
|
|
11060
11048
|
let statusCode = HttpStatus2.INTERNAL_SERVER_ERROR;
|
|
11061
|
-
let errorType = ExceptionTypes.INTERNAL_SERVER_ERROR;
|
|
11062
11049
|
let additional;
|
|
11063
11050
|
const isRpcException = exception instanceof RpcException2 || exception && typeof exception === "object" && "error" in exception && typeof exception.getError === "function" || exception && typeof exception === "object" && "error" in exception && typeof exception.error === "object";
|
|
11064
11051
|
if (isRpcException) {
|
|
@@ -11066,7 +11053,6 @@ var AllExceptionsFilter = class {
|
|
|
11066
11053
|
if (typeof errorObj === "object" && errorObj !== null) {
|
|
11067
11054
|
message = errorObj?.message || message;
|
|
11068
11055
|
statusCode = errorObj?.statusCode || statusCode;
|
|
11069
|
-
errorType = errorObj?.error || errorType;
|
|
11070
11056
|
additional = errorObj?.additional;
|
|
11071
11057
|
} else if (typeof errorObj === "string") {
|
|
11072
11058
|
message = errorObj;
|
|
@@ -11076,7 +11062,6 @@ var AllExceptionsFilter = class {
|
|
|
11076
11062
|
const resObj = typeof response === "string" ? { message: response } : response;
|
|
11077
11063
|
message = resObj.message || exception.message;
|
|
11078
11064
|
statusCode = exception.getStatus();
|
|
11079
|
-
errorType = resObj.error || exception.name;
|
|
11080
11065
|
additional = resObj?.additional;
|
|
11081
11066
|
} else if (exception instanceof Error) {
|
|
11082
11067
|
if (message === ExceptionMessages.INTERNAL_SERVER_ERROR_MESSAGE("en" /* EN */)) {
|
|
@@ -11088,7 +11073,6 @@ var AllExceptionsFilter = class {
|
|
|
11088
11073
|
message,
|
|
11089
11074
|
// This will now be the correct string from Step 1
|
|
11090
11075
|
statusCode,
|
|
11091
|
-
error: errorType,
|
|
11092
11076
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11093
11077
|
// Good practice to add
|
|
11094
11078
|
...additional ? { additional } : {}
|
|
@@ -11107,8 +11091,7 @@ function stringTransform({ value, key }) {
|
|
|
11107
11091
|
if (typeof value !== "string") {
|
|
11108
11092
|
throw new BaseException(
|
|
11109
11093
|
(lang) => ExceptionMessages.STRING_OR_NULL_MESSAGE(key, lang),
|
|
11110
|
-
400 /* BAD_REQUEST
|
|
11111
|
-
ExceptionTypes.BAD_REQUEST
|
|
11094
|
+
400 /* BAD_REQUEST */
|
|
11112
11095
|
);
|
|
11113
11096
|
}
|
|
11114
11097
|
const trimmedValue = value.trim();
|
|
@@ -11125,8 +11108,7 @@ function numberTransform({ value, key }) {
|
|
|
11125
11108
|
if (isNaN(value)) {
|
|
11126
11109
|
throw new BaseException(
|
|
11127
11110
|
(lang) => ExceptionMessages.NUMBER_OR_NULL_MESSAGE(key, lang),
|
|
11128
|
-
400 /* BAD_REQUEST
|
|
11129
|
-
ExceptionTypes.BAD_REQUEST
|
|
11111
|
+
400 /* BAD_REQUEST */
|
|
11130
11112
|
);
|
|
11131
11113
|
}
|
|
11132
11114
|
return value;
|
|
@@ -11138,16 +11120,14 @@ function numberTransform({ value, key }) {
|
|
|
11138
11120
|
if (isNaN(num)) {
|
|
11139
11121
|
throw new BaseException(
|
|
11140
11122
|
(lang) => ExceptionMessages.NUMBER_OR_NULL_MESSAGE(key, lang),
|
|
11141
|
-
400 /* BAD_REQUEST
|
|
11142
|
-
ExceptionTypes.BAD_REQUEST
|
|
11123
|
+
400 /* BAD_REQUEST */
|
|
11143
11124
|
);
|
|
11144
11125
|
}
|
|
11145
11126
|
return num;
|
|
11146
11127
|
}
|
|
11147
11128
|
throw new BaseException(
|
|
11148
11129
|
(lang) => ExceptionMessages.NUMBER_OR_NULL_MESSAGE(key, lang),
|
|
11149
|
-
400 /* BAD_REQUEST
|
|
11150
|
-
ExceptionTypes.BAD_REQUEST
|
|
11130
|
+
400 /* BAD_REQUEST */
|
|
11151
11131
|
);
|
|
11152
11132
|
}
|
|
11153
11133
|
function arrayTransform({ value, key }) {
|
|
@@ -11157,15 +11137,13 @@ function arrayTransform({ value, key }) {
|
|
|
11157
11137
|
if (!Array.isArray(value)) {
|
|
11158
11138
|
throw new BaseException(
|
|
11159
11139
|
(lang) => ExceptionMessages.ARRAY_TYPE_MESSAGE(key, lang),
|
|
11160
|
-
400 /* BAD_REQUEST
|
|
11161
|
-
ExceptionTypes.BAD_REQUEST
|
|
11140
|
+
400 /* BAD_REQUEST */
|
|
11162
11141
|
);
|
|
11163
11142
|
}
|
|
11164
11143
|
if (value.length === 0) {
|
|
11165
11144
|
throw new BaseException(
|
|
11166
11145
|
(lang) => ExceptionMessages.ARRAY_MIN_ONE_MESSAGE(key, lang),
|
|
11167
|
-
400 /* BAD_REQUEST
|
|
11168
|
-
ExceptionTypes.BAD_REQUEST
|
|
11146
|
+
400 /* BAD_REQUEST */
|
|
11169
11147
|
);
|
|
11170
11148
|
}
|
|
11171
11149
|
return value;
|
|
@@ -11177,15 +11155,13 @@ function objectTransform({ value, key }) {
|
|
|
11177
11155
|
if (typeof value !== "object" || Array.isArray(value)) {
|
|
11178
11156
|
throw new BaseException(
|
|
11179
11157
|
(lang) => ExceptionMessages.OBJECT_TYPE_MESSAGE(key, lang),
|
|
11180
|
-
400 /* BAD_REQUEST
|
|
11181
|
-
ExceptionTypes.BAD_REQUEST
|
|
11158
|
+
400 /* BAD_REQUEST */
|
|
11182
11159
|
);
|
|
11183
11160
|
}
|
|
11184
11161
|
if (Object.keys(value).length === 0) {
|
|
11185
11162
|
throw new BaseException(
|
|
11186
11163
|
(lang) => ExceptionMessages.OBJECT_MIN_ONE_PROPERTY_MESSAGE(key, lang),
|
|
11187
|
-
400 /* BAD_REQUEST
|
|
11188
|
-
ExceptionTypes.BAD_REQUEST
|
|
11164
|
+
400 /* BAD_REQUEST */
|
|
11189
11165
|
);
|
|
11190
11166
|
}
|
|
11191
11167
|
return value;
|
|
@@ -11198,8 +11174,7 @@ function dateTransform({ value, key }) {
|
|
|
11198
11174
|
if (isNaN(value.getTime())) {
|
|
11199
11175
|
throw new BaseException(
|
|
11200
11176
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11201
|
-
400 /* BAD_REQUEST
|
|
11202
|
-
ExceptionTypes.BAD_REQUEST
|
|
11177
|
+
400 /* BAD_REQUEST */
|
|
11203
11178
|
);
|
|
11204
11179
|
}
|
|
11205
11180
|
return value;
|
|
@@ -11208,8 +11183,7 @@ function dateTransform({ value, key }) {
|
|
|
11208
11183
|
if (parsedValue) {
|
|
11209
11184
|
throw new BaseException(
|
|
11210
11185
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11211
|
-
400 /* BAD_REQUEST
|
|
11212
|
-
ExceptionTypes.BAD_REQUEST
|
|
11186
|
+
400 /* BAD_REQUEST */
|
|
11213
11187
|
);
|
|
11214
11188
|
}
|
|
11215
11189
|
if (typeof value === "string") {
|
|
@@ -11218,32 +11192,28 @@ function dateTransform({ value, key }) {
|
|
|
11218
11192
|
if (!isNaN(Number(trimmed))) {
|
|
11219
11193
|
throw new BaseException(
|
|
11220
11194
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11221
|
-
400 /* BAD_REQUEST
|
|
11222
|
-
ExceptionTypes.BAD_REQUEST
|
|
11195
|
+
400 /* BAD_REQUEST */
|
|
11223
11196
|
);
|
|
11224
11197
|
}
|
|
11225
11198
|
const date = new Date(trimmed);
|
|
11226
11199
|
if (isNaN(date.getTime())) {
|
|
11227
11200
|
throw new BaseException(
|
|
11228
11201
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11229
|
-
400 /* BAD_REQUEST
|
|
11230
|
-
ExceptionTypes.BAD_REQUEST
|
|
11202
|
+
400 /* BAD_REQUEST */
|
|
11231
11203
|
);
|
|
11232
11204
|
}
|
|
11233
11205
|
return date;
|
|
11234
11206
|
}
|
|
11235
11207
|
throw new BaseException(
|
|
11236
11208
|
(lang) => ExceptionMessages.DATE_OR_NULL_MESSAGE(key, lang),
|
|
11237
|
-
400 /* BAD_REQUEST
|
|
11238
|
-
ExceptionTypes.BAD_REQUEST
|
|
11209
|
+
400 /* BAD_REQUEST */
|
|
11239
11210
|
);
|
|
11240
11211
|
}
|
|
11241
11212
|
function booleanTransform({ value, key }) {
|
|
11242
11213
|
if (value === void 0 || value === null) {
|
|
11243
11214
|
throw new BaseException(
|
|
11244
11215
|
(lang) => ExceptionMessages.BOOLEAN_INVALID_MESSAGE(key, lang),
|
|
11245
|
-
400 /* BAD_REQUEST
|
|
11246
|
-
ExceptionTypes.BAD_REQUEST
|
|
11216
|
+
400 /* BAD_REQUEST */
|
|
11247
11217
|
);
|
|
11248
11218
|
}
|
|
11249
11219
|
if (typeof value === "boolean") {
|
|
@@ -11255,14 +11225,12 @@ function booleanTransform({ value, key }) {
|
|
|
11255
11225
|
if (trimmed === "false") return false;
|
|
11256
11226
|
throw new BaseException(
|
|
11257
11227
|
(lang) => ExceptionMessages.BOOLEAN_INVALID_MESSAGE(key, lang),
|
|
11258
|
-
400 /* BAD_REQUEST
|
|
11259
|
-
ExceptionTypes.BAD_REQUEST
|
|
11228
|
+
400 /* BAD_REQUEST */
|
|
11260
11229
|
);
|
|
11261
11230
|
}
|
|
11262
11231
|
throw new BaseException(
|
|
11263
11232
|
(lang) => ExceptionMessages.BOOLEAN_TYPE_MESSAGE(key, lang),
|
|
11264
|
-
400 /* BAD_REQUEST
|
|
11265
|
-
ExceptionTypes.BAD_REQUEST
|
|
11233
|
+
400 /* BAD_REQUEST */
|
|
11266
11234
|
);
|
|
11267
11235
|
}
|
|
11268
11236
|
function enumTransform({
|
|
@@ -11279,8 +11247,7 @@ function enumTransform({
|
|
|
11279
11247
|
}
|
|
11280
11248
|
throw new BaseException(
|
|
11281
11249
|
(lang) => ExceptionMessages.ENUM_INVALID_MESSAGE(key, enumValues, lang),
|
|
11282
|
-
400 /* BAD_REQUEST
|
|
11283
|
-
ExceptionTypes.BAD_REQUEST
|
|
11250
|
+
400 /* BAD_REQUEST */
|
|
11284
11251
|
);
|
|
11285
11252
|
}
|
|
11286
11253
|
function upperCaseTranform(value) {
|
|
@@ -11288,8 +11255,7 @@ function upperCaseTranform(value) {
|
|
|
11288
11255
|
if (typeof value !== "string")
|
|
11289
11256
|
throw new BaseException(
|
|
11290
11257
|
(lang) => ExceptionMessages.STRING_OR_NULL_MESSAGE(value, lang),
|
|
11291
|
-
400 /* BAD_REQUEST
|
|
11292
|
-
ExceptionTypes.BAD_REQUEST
|
|
11258
|
+
400 /* BAD_REQUEST */
|
|
11293
11259
|
);
|
|
11294
11260
|
return value.toUpperCase();
|
|
11295
11261
|
}
|
|
@@ -11298,8 +11264,7 @@ function lowerCaseTranform(value) {
|
|
|
11298
11264
|
if (typeof value !== "string")
|
|
11299
11265
|
throw new BaseException(
|
|
11300
11266
|
(lang) => ExceptionMessages.STRING_OR_NULL_MESSAGE(value, lang),
|
|
11301
|
-
400 /* BAD_REQUEST
|
|
11302
|
-
ExceptionTypes.BAD_REQUEST
|
|
11267
|
+
400 /* BAD_REQUEST */
|
|
11303
11268
|
);
|
|
11304
11269
|
return value.toLowerCase();
|
|
11305
11270
|
}
|
|
@@ -11515,7 +11480,6 @@ export {
|
|
|
11515
11480
|
ENV,
|
|
11516
11481
|
EXPIRE_DATES,
|
|
11517
11482
|
ExceptionMessages,
|
|
11518
|
-
ExceptionTypes,
|
|
11519
11483
|
FIELD_TRANSFORMER_REGISTRY,
|
|
11520
11484
|
FIELD_TYPE,
|
|
11521
11485
|
FIELD_VALIDATOR_REGISTRY,
|