@lyxa.ai/core 1.0.14 → 1.0.15-debug
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/libraries/event/index.js.map +1 -1
- package/dist/libraries/mongo/models/admin.model.d.ts +5 -3
- package/dist/libraries/mongo/models/admin.model.js +23 -6
- package/dist/libraries/mongo/models/admin.model.js.map +1 -1
- package/dist/libraries/mongo/models/base/base-review.model.d.ts +2 -2
- package/dist/libraries/mongo/models/base/base-review.model.js +2 -2
- package/dist/libraries/mongo/models/base/base-review.model.js.map +1 -1
- package/dist/libraries/mongo/models/core-auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/{auth-identity.model.js → core-auth-identity.model.js} +13 -12
- package/dist/libraries/mongo/models/core-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/{user.model.d.ts → core-user.model.d.ts} +2 -2
- package/dist/libraries/mongo/models/{user.model.js → core-user.model.js} +18 -17
- package/dist/libraries/mongo/models/core-user.model.js.map +1 -0
- package/dist/libraries/mongo/models/favourite.model.d.ts +2 -2
- package/dist/libraries/mongo/models/favourite.model.js +2 -2
- package/dist/libraries/mongo/models/favourite.model.js.map +1 -1
- package/dist/libraries/mongo/models/index.d.ts +66 -0
- package/dist/libraries/mongo/models/index.js +83 -0
- package/dist/libraries/mongo/models/index.js.map +1 -0
- package/dist/libraries/mongo/models/notification.model.d.ts +2 -2
- package/dist/libraries/mongo/models/notification.model.js +2 -2
- package/dist/libraries/mongo/models/notification.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/{apple-auth-identity.model.js → core-apple-auth-identity.model.js} +8 -7
- package/dist/libraries/mongo/models/providers/core-apple-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.d.ts +9 -0
- package/dist/libraries/mongo/models/providers/{email-auth-identity.model.js → core-email-auth-identity.model.js} +10 -9
- package/dist/libraries/mongo/models/providers/core-email-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/{google-auth-identity.model.js → core-google-auth-identity.model.js} +8 -7
- package/dist/libraries/mongo/models/providers/core-google-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/providers/{phone-auth-identity.model.js → core-phone-auth-identity.model.js} +9 -8
- package/dist/libraries/mongo/models/providers/core-phone-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/custom-coupon.model.d.ts +2 -2
- package/dist/libraries/mongo/models/providers/custom-coupon.model.js +2 -2
- package/dist/libraries/mongo/models/providers/custom-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/individual-user-coupon.model.d.ts +2 -2
- package/dist/libraries/mongo/models/providers/individual-user-coupon.model.js +2 -2
- package/dist/libraries/mongo/models/providers/individual-user-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/{referral-code-coupon.mode.d.ts → referral-code-coupon.model.d.ts} +2 -2
- package/dist/libraries/mongo/models/providers/{referral-code-coupon.mode.js → referral-code-coupon.model.js} +3 -3
- package/dist/libraries/mongo/models/providers/referral-code-coupon.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.d.ts +3 -3
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js +3 -3
- package/dist/libraries/mongo/models/providers/referral-reward-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/punch-marketing-history.model.d.ts +2 -2
- package/dist/libraries/mongo/models/punch-marketing-history.model.js +2 -2
- package/dist/libraries/mongo/models/punch-marketing-history.model.js.map +1 -1
- package/dist/libraries/mongo/models/request-area.model.d.ts +2 -2
- package/dist/libraries/mongo/models/request-area.model.js +2 -2
- package/dist/libraries/mongo/models/request-area.model.js.map +1 -1
- package/dist/libraries/mongo/models/{role.model.ts.js → role.model.js} +3 -2
- package/dist/libraries/mongo/models/role.model.js.map +1 -0
- package/dist/libraries/mongo/models/{shop-review.js → shop-review.model.js} +1 -1
- package/dist/libraries/mongo/models/shop-review.model.js.map +1 -0
- package/dist/libraries/mongo/models/shop.model.d.ts +1 -1
- package/dist/libraries/mongo/models/shop.model.js +1 -1
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/dist/libraries/mongo/models/subscription.model.d.ts +2 -2
- package/dist/libraries/mongo/models/subscription.model.js +2 -2
- package/dist/libraries/mongo/models/subscription.model.js.map +1 -1
- package/dist/libraries/mongo/models/{zone.model..js → zone.model.js} +1 -1
- package/dist/libraries/mongo/models/zone.model.js.map +1 -0
- package/dist/libraries/mongo/plugins/soft-delete-plugin.d.ts +10 -9
- package/dist/libraries/mongo/plugins/soft-delete-plugin.js +17 -17
- package/dist/libraries/mongo/plugins/soft-delete-plugin.js.map +1 -1
- package/dist/libraries/trpc/middlewares/cors.d.ts +12 -0
- package/dist/libraries/trpc/middlewares/cors.js +46 -0
- package/dist/libraries/trpc/middlewares/cors.js.map +1 -0
- package/dist/utilities/enum.d.ts +1 -1
- package/dist/utilities/enum.js +8 -8
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/error-middleware.d.ts +11 -0
- package/dist/utilities/error-middleware.js +177 -0
- package/dist/utilities/error-middleware.js.map +1 -0
- package/dist/utilities/validation/common-validation.d.ts +22 -2
- package/dist/utilities/validation/common-validation.js +41 -41
- package/dist/utilities/validation/common-validation.js.map +1 -1
- package/dist/utilities/validation/global-validation.d.ts +29 -6
- package/dist/utilities/validation/global-validation.js +64 -52
- package/dist/utilities/validation/global-validation.js.map +1 -1
- package/package.json +2 -2
- package/dist/libraries/mongo/models/address.model.d.ts +0 -19
- package/dist/libraries/mongo/models/address.model.js +0 -91
- package/dist/libraries/mongo/models/address.model.js.map +0 -1
- package/dist/libraries/mongo/models/auth-identity.model.d.ts +0 -8
- package/dist/libraries/mongo/models/auth-identity.model.js.map +0 -1
- package/dist/libraries/mongo/models/duration.model.d.ts +0 -4
- package/dist/libraries/mongo/models/duration.model.js +0 -27
- package/dist/libraries/mongo/models/duration.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +0 -6
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +0 -9
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +0 -6
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +0 -8
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +0 -1
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +0 -1
- package/dist/libraries/mongo/models/role.model.ts.js.map +0 -1
- package/dist/libraries/mongo/models/shop-review.js.map +0 -1
- package/dist/libraries/mongo/models/user.model.js.map +0 -1
- package/dist/libraries/mongo/models/work-hour.model.d.ts +0 -20
- package/dist/libraries/mongo/models/work-hour.model.js +0 -80
- package/dist/libraries/mongo/models/work-hour.model.js.map +0 -1
- package/dist/libraries/mongo/models/zone.model..js.map +0 -1
- package/dist/utilities/validation.d.ts +0 -25
- package/dist/utilities/validation.js +0 -44
- package/dist/utilities/validation.js.map +0 -1
- /package/dist/libraries/mongo/models/{role.model.ts.d.ts → role.model.d.ts} +0 -0
- /package/dist/libraries/mongo/models/{shop-review.d.ts → shop-review.model.d.ts} +0 -0
- /package/dist/libraries/mongo/models/{zone.model..d.ts → zone.model.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.model.js","sourceRoot":"/","sources":["libraries/mongo/models/subscription.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,4EAAqE;AACrE,kDAMiC;AACjC,4DAAmD;AACnD,sFAA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pB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAkB,EAAE,OAAO,EAAE,yBAAkB,CAAC,OAAO,EAAE,CAAC;;4CACnD;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;+CACZ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDACM;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,CAAC;;mDACvB;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAa,EAAE,OAAO,EAAE,oBAAa,CAAC,OAAO,EAAE,CAAC;;mDACvC;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,+BAAW,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;kDACL;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAY,EAAE,OAAO,EAAE,mBAAY,CAAC,IAAI,EAAE,CAAC;;kDACpC;uBAtCvB,YAAY;IADxB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,eAAe,EAAE,EAAE,CAAC;GACpD,YAAY,CAuCxB;AAEY,QAAA,iBAAiB,GAAyC,IAAA,4BAAgB,EAAC,YAAY,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport {\r\n\tPaidCurrency,\r\n\tPaymentMethod,\r\n\tPaymentStatus,\r\n\tSubscriptionPackage,\r\n\tSubscriptionStatus,\r\n} from '../../../utilities/enum';\r\nimport { Duration } from './shared/duration.model';\r\nimport { SubscriptionSummary } from './embedded/subscription-summary.model';\r\nimport { CoreUser } from './core-user.model';\r\nimport { Transaction } from './transaction.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'subscriptions' } })\r\nexport class Subscription extends TimeStamps {\r\n\t@prop({ required: true, ref: () => CoreUser })\r\n\tpublic user!: Ref<CoreUser>;\r\n\r\n\t@prop({ type: String, enum: SubscriptionPackage, default: SubscriptionPackage.MONTHLY })\r\n\tpublic package?: SubscriptionPackage;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic fee!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic secondaryFee!: number;\r\n\r\n\t@prop({ type: SubscriptionSummary })\r\n\tpublic summary?: SubscriptionSummary;\r\n\r\n\t@prop({ required: true, type: Duration })\r\n\tpublic duration!: Duration;\r\n\r\n\t@prop({ type: String, enum: SubscriptionStatus, default: SubscriptionStatus.ONGOING })\r\n\tpublic status?: SubscriptionStatus;\r\n\r\n\t@prop({ type: Boolean, default: true })\r\n\tpublic autoRenew?: boolean;\r\n\r\n\t@prop({ type: String })\r\n\tpublic cancelReason?: string;\r\n\r\n\t@prop({ required: true, type: String, enum: PaymentMethod })\r\n\tpublic paymentMethod!: PaymentMethod;\r\n\r\n\t@prop({ type: String, enum: PaymentStatus, default: PaymentStatus.PENDING })\r\n\tpublic paymentStatus?: PaymentStatus;\r\n\r\n\t@prop({ ref: () => Transaction, default: [] })\r\n\tpublic transactions?: Ref<Transaction>[];\r\n\r\n\t@prop({ type: String, enum: PaidCurrency, default: PaidCurrency.BASE })\r\n\tpublic paidCurrency?: PaidCurrency;\r\n}\r\n\r\nexport const SubscriptionModel: ReturnModelType<typeof Subscription> = getModelForClass(Subscription);\r\n"]}
|
|
@@ -61,4 +61,4 @@ exports.Zone = Zone = __decorate([
|
|
|
61
61
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'zones' } })
|
|
62
62
|
], Zone);
|
|
63
63
|
exports.ZoneModel = (0, typegoose_1.getModelForClass)(Zone);
|
|
64
|
-
//# sourceMappingURL=zone.model
|
|
64
|
+
//# sourceMappingURL=zone.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zone.model.js","sourceRoot":"/","sources":["libraries/mongo/models/zone.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA6F;AAC7F,4EAAqE;AACrE,kDAAqD;AACrD,sEAA6D;AAGtD,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,QAAQ,CAAU;IAGlB,QAAQ,CAAU;IAGlB,YAAY,CAAgB;IAG5B,MAAM,CAAc;IAGpB,aAAa,CAAU;IAGvB,mBAAmB,CAAU;IAI7B,iBAAiB,CAAU;IAG3B,iBAAiB,CAAU;CAClC,CAAA;AAzBY,oBAAI;AAET;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACE;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,iCAAY,EAAE,CAAC;8BACvB,iCAAY;0CAAC;AAG5B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAU,EAAE,OAAO,EAAE,iBAAU,CAAC,MAAM,EAAE,CAAC;;oCAC1C;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACO;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACa;AAI7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACD;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;+CACD;eAxBtB,IAAI;IADhB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;GAC5C,IAAI,CAyBhB;AAEY,QAAA,SAAS,GAAiC,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import { modelOptions, prop, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { ZoneStatus } from '../../../utilities/enum';\r\nimport { ZoneGeometry } from './embedded/zone-geometry.mode';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'zones' } })\r\nexport class Zone extends TimeStamps {\r\n\t@prop({ required: true, type: String })\r\n\tpublic zoneName!: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneArea?: string;\r\n\r\n\t@prop({ required: true, type: ZoneGeometry })\r\n\tpublic zoneGeometry!: ZoneGeometry;\r\n\r\n\t@prop({ type: String, enum: ZoneStatus, default: ZoneStatus.ACTIVE })\r\n\tpublic status?: ZoneStatus;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyTitle?: string;\r\n\r\n\t@prop({ type: String })\r\n\tpublic zoneBusyDescription?: string;\r\n\r\n\t// Rider reward feature when he reached the target\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyTarget?: number;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\tpublic riderWeeklyReward?: number;\r\n}\r\n\r\nexport const ZoneModel: ReturnModelType<typeof Zone> = getModelForClass(Zone);\r\n"]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Schema, Model } from
|
|
2
|
-
import { ReturnModelType } from
|
|
3
|
-
import { AnyParamConstructor } from
|
|
1
|
+
import { Schema, Model } from "mongoose";
|
|
2
|
+
import { ReturnModelType, mongoose } from "@typegoose/typegoose";
|
|
3
|
+
import { AnyParamConstructor } from "@typegoose/typegoose/lib/types";
|
|
4
|
+
import { FilterDTO } from "../../../utilities/validation";
|
|
4
5
|
export interface SoftDeleteModel<T> extends Model<T> {
|
|
5
|
-
softDelete(
|
|
6
|
-
softDeleteMany(filter?:
|
|
7
|
-
restore(
|
|
8
|
-
restoreMany(filter?:
|
|
9
|
-
findWithDeleted(filter?:
|
|
10
|
-
findDeleted(filter?:
|
|
6
|
+
softDelete(_id: mongoose.Types.ObjectId): Promise<any>;
|
|
7
|
+
softDeleteMany(filter?: FilterDTO): Promise<any>;
|
|
8
|
+
restore(_id: mongoose.Types.ObjectId): Promise<any>;
|
|
9
|
+
restoreMany(filter?: FilterDTO): Promise<any>;
|
|
10
|
+
findWithDeleted(filter?: FilterDTO): any;
|
|
11
|
+
findDeleted(filter?: FilterDTO): any;
|
|
11
12
|
}
|
|
12
13
|
export declare class SoftDeleteBase {
|
|
13
14
|
deletedAt?: Date | null;
|
|
@@ -8,7 +8,7 @@ class SoftDeleteBase {
|
|
|
8
8
|
exports.SoftDeleteBase = SoftDeleteBase;
|
|
9
9
|
class SoftDelete {
|
|
10
10
|
static applyToSchema(schema) {
|
|
11
|
-
if (!schema.path(
|
|
11
|
+
if (!schema.path("deletedAt")) {
|
|
12
12
|
schema.add({
|
|
13
13
|
deletedAt: {
|
|
14
14
|
type: Date,
|
|
@@ -22,7 +22,7 @@ class SoftDelete {
|
|
|
22
22
|
this.addStaticMethods(schema);
|
|
23
23
|
}
|
|
24
24
|
static applyGlobally() {
|
|
25
|
-
const mongoose = require(
|
|
25
|
+
const mongoose = require("mongoose");
|
|
26
26
|
mongoose.plugin((schema) => this.applyToSchema(schema));
|
|
27
27
|
}
|
|
28
28
|
static createModel(modelClass) {
|
|
@@ -35,17 +35,17 @@ class SoftDelete {
|
|
|
35
35
|
this.where({ deletedAt: null });
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
schema.pre(
|
|
39
|
-
schema.pre(
|
|
40
|
-
schema.pre(
|
|
41
|
-
schema.pre(
|
|
42
|
-
schema.pre(
|
|
43
|
-
schema.pre(
|
|
44
|
-
schema.pre(
|
|
45
|
-
schema.pre(
|
|
46
|
-
schema.pre(
|
|
47
|
-
schema.statics.findById = function (
|
|
48
|
-
return this.findOne({ _id
|
|
38
|
+
schema.pre("find", queryMiddleware);
|
|
39
|
+
schema.pre("findOne", queryMiddleware);
|
|
40
|
+
schema.pre("findOneAndUpdate", queryMiddleware);
|
|
41
|
+
schema.pre("findOneAndDelete", queryMiddleware);
|
|
42
|
+
schema.pre("findOneAndReplace", queryMiddleware);
|
|
43
|
+
schema.pre("updateOne", queryMiddleware);
|
|
44
|
+
schema.pre("updateMany", queryMiddleware);
|
|
45
|
+
schema.pre("count", queryMiddleware);
|
|
46
|
+
schema.pre("countDocuments", queryMiddleware);
|
|
47
|
+
schema.statics.findById = function (_id, projection, options) {
|
|
48
|
+
return this.findOne({ _id, deletedAt: null }, projection, options);
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
static addInstanceMethods(schema) {
|
|
@@ -59,15 +59,15 @@ class SoftDelete {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
static addStaticMethods(schema) {
|
|
62
|
-
schema.statics.softDelete = async function (
|
|
63
|
-
const result = await this.updateOne({ _id
|
|
62
|
+
schema.statics.softDelete = async function (_id) {
|
|
63
|
+
const result = await this.updateOne({ _id }, { deletedAt: new Date() });
|
|
64
64
|
return result.modifiedCount > 0;
|
|
65
65
|
};
|
|
66
66
|
schema.statics.softDeleteMany = function (filter = {}) {
|
|
67
67
|
return this.updateMany(filter, { deletedAt: new Date() });
|
|
68
68
|
};
|
|
69
|
-
schema.statics.restore = function (
|
|
70
|
-
return this.updateOne({ _id
|
|
69
|
+
schema.statics.restore = function (_id) {
|
|
70
|
+
return this.updateOne({ _id }, { deletedAt: null });
|
|
71
71
|
};
|
|
72
72
|
schema.statics.restoreMany = function (filter = {}) {
|
|
73
73
|
return this.updateMany(filter, { deletedAt: null });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soft-delete-plugin.js","sourceRoot":"/","sources":["libraries/mongo/plugins/soft-delete-plugin.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"soft-delete-plugin.js","sourceRoot":"/","sources":["libraries/mongo/plugins/soft-delete-plugin.ts"],"names":[],"mappings":";;;AACA,oDAI8B;AAmB9B,MAAa,cAAc;IACzB,SAAS,CAAe;CACzB;AAFD,wCAEC;AAKD,MAAa,UAAU;IAKd,MAAM,CAAC,aAAa,CAAC,MAAc;QAExC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC;gBACT,SAAS,EAAE;oBACT,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,IAAI;oBACb,KAAK,EAAE,IAAI;iBACZ;aACF,CAAC,CAAC;QACL,CAAC;QAGD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAGhC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAGhC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAKM,MAAM,CAAC,aAAa;QACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACrC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IAOM,MAAM,CAAC,WAAW,CACvB,UAAkC;QAElC,MAAM,KAAK,GAAG,IAAA,4BAAgB,EAAC,UAAU,CAAC,CAAC;QAC3C,OAAO,KAAY,CAAC;IACtB,CAAC;IAMO,MAAM,CAAC,kBAAkB,CAAC,MAAc;QAC9C,MAAM,eAAe,GAAG;YACtB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS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IC;AAGM,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAQ,EAAE,CACvD,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AADtB,QAAA,gBAAgB,oBACM;AAC5B,MAAM,qBAAqB,GAAG,GAAS,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;AAA/D,QAAA,qBAAqB,yBAA0C;AACrE,MAAM,qBAAqB,GAAG,CACnC,UAAkC,EAC4B,EAAE,CAChE,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAHxB,QAAA,qBAAqB,yBAGG","sourcesContent":["import { Schema, Query, Model } from \"mongoose\";\r\nimport {\r\n getModelForClass,\r\n ReturnModelType,\r\n mongoose,\r\n} from \"@typegoose/typegoose\";\r\nimport { AnyParamConstructor } from \"@typegoose/typegoose/lib/types\";\r\nimport { FilterDTO } from \"../../../utilities/validation\";\r\n\r\n/**\r\n * Interface for models with soft delete capabilities\r\n */\r\nexport interface SoftDeleteModel<T> extends Model<T> {\r\n softDelete(_id: mongoose.Types.ObjectId): Promise<any>;\r\n softDeleteMany(filter?: FilterDTO): Promise<any>;\r\n restore(_id: mongoose.Types.ObjectId): Promise<any>;\r\n restoreMany(filter?: FilterDTO): Promise<any>;\r\n findWithDeleted(filter?: FilterDTO): any;\r\n findDeleted(filter?: FilterDTO): any;\r\n}\r\n\r\n/**\r\n * Base class for models with soft delete functionality\r\n */\r\nexport class SoftDeleteBase {\r\n deletedAt?: Date | null;\r\n}\r\n\r\n/**\r\n * SoftDelete class providing soft deletion functionality for mongoose models\r\n */\r\nexport class SoftDelete {\r\n /**\r\n * Apply soft delete plugin to a specific schema\r\n * @param schema Mongoose schema to enhance with soft delete functionality\r\n */\r\n public static applyToSchema(schema: Schema): void {\r\n // Add deletedAt field if it doesn't exist\r\n if (!schema.path(\"deletedAt\")) {\r\n schema.add({\r\n deletedAt: {\r\n type: Date,\r\n default: null,\r\n index: true,\r\n },\r\n });\r\n }\r\n\r\n // Add schema middleware\r\n this.addQueryMiddleware(schema);\r\n\r\n // Add instance methods\r\n this.addInstanceMethods(schema);\r\n\r\n // Add static methods\r\n this.addStaticMethods(schema);\r\n }\r\n\r\n /**\r\n * Apply soft delete plugin globally to all mongoose schemas\r\n */\r\n public static applyGlobally(): void {\r\n const mongoose = require(\"mongoose\");\r\n mongoose.plugin((schema: Schema) => this.applyToSchema(schema));\r\n }\r\n\r\n /**\r\n * Create a model with soft delete capabilities and proper TypeScript types\r\n * @param modelClass The class to create a model from\r\n * @returns A model with soft delete functionality\r\n */\r\n public static createModel<T extends SoftDeleteBase>(\r\n modelClass: AnyParamConstructor<T>\r\n ): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> {\r\n const model = getModelForClass(modelClass);\r\n return model as any; // The plugin adds the methods, we just need to tell TypeScript they exist\r\n }\r\n\r\n /**\r\n * Add query middleware to filter out soft-deleted documents\r\n * @param schema Schema to add middleware to\r\n */\r\n private static addQueryMiddleware(schema: Schema): void {\r\n const queryMiddleware = function (this: Query<any, any>) {\r\n if (!this.getQuery().deletedAt) {\r\n this.where({ deletedAt: null });\r\n }\r\n };\r\n\r\n // Apply middleware to relevant query methods\r\n schema.pre(\"find\", queryMiddleware);\r\n schema.pre(\"findOne\", queryMiddleware);\r\n schema.pre(\"findOneAndUpdate\", queryMiddleware);\r\n schema.pre(\"findOneAndDelete\", queryMiddleware);\r\n schema.pre(\"findOneAndReplace\", queryMiddleware);\r\n schema.pre(\"updateOne\", queryMiddleware);\r\n schema.pre(\"updateMany\", queryMiddleware);\r\n // TypeScript workaround for count hook\r\n (schema as any).pre(\"count\", queryMiddleware);\r\n schema.pre(\"countDocuments\", queryMiddleware);\r\n\r\n // Override findById to respect soft delete\r\n schema.statics.findById = function (\r\n _id: mongoose.Types.ObjectId,\r\n projection?: any,\r\n options?: any\r\n ) {\r\n return this.findOne({ _id, deletedAt: null }, projection, options);\r\n };\r\n }\r\n\r\n /**\r\n * Add instance methods for soft delete operations\r\n * @param schema Schema to add methods to\r\n */\r\n private static addInstanceMethods(schema: Schema): void {\r\n schema.methods.softDelete = function () {\r\n this.deletedAt = new Date();\r\n return this.save();\r\n };\r\n\r\n schema.methods.restore = function () {\r\n this.deletedAt = null;\r\n return this.save();\r\n };\r\n }\r\n\r\n /**\r\n * Add static methods for soft delete operations\r\n * @param schema Schema to add methods to\r\n */\r\n private static addStaticMethods(schema: Schema): void {\r\n schema.statics.softDelete = async function (_id: mongoose.Types.ObjectId) {\r\n const result = await this.updateOne(\r\n { _id },\r\n { deletedAt: new Date() }\r\n );\r\n return result.modifiedCount > 0;\r\n };\r\n\r\n schema.statics.softDeleteMany = function (filter = {}) {\r\n return this.updateMany(filter, { deletedAt: new Date() });\r\n };\r\n\r\n schema.statics.restore = function (_id: mongoose.Types.ObjectId) {\r\n return this.updateOne({ _id }, { deletedAt: null });\r\n };\r\n\r\n schema.statics.restoreMany = function (filter = {}) {\r\n return this.updateMany(filter, { deletedAt: null });\r\n };\r\n\r\n schema.statics.findWithDeleted = function (filter = {}) {\r\n return this.find(filter);\r\n };\r\n\r\n schema.statics.findDeleted = function (filter = {}) {\r\n return this.find({ ...filter, deletedAt: { $ne: null } });\r\n };\r\n }\r\n}\r\n\r\n// Export convenience functions with the same names as before for backward compatibility\r\nexport const softDeletePlugin = (schema: Schema): void =>\r\n SoftDelete.applyToSchema(schema);\r\nexport const applySoftDeletePlugin = (): void => SoftDelete.applyGlobally();\r\nexport const createSoftDeleteModel = <T extends SoftDeleteBase>(\r\n modelClass: AnyParamConstructor<T>\r\n): SoftDeleteModel<T> & ReturnModelType<AnyParamConstructor<T>> =>\r\n SoftDelete.createModel(modelClass);"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
interface CorsOptions {
|
|
3
|
+
origin?: string | string[];
|
|
4
|
+
methods?: string[];
|
|
5
|
+
allowedHeaders?: string[];
|
|
6
|
+
exposedHeaders?: string[];
|
|
7
|
+
credentials?: boolean;
|
|
8
|
+
maxAge?: number;
|
|
9
|
+
preflightContinue?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function corsMiddleware(options?: CorsOptions): (req: IncomingMessage, res: ServerResponse, next: () => void) => void;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.corsMiddleware = corsMiddleware;
|
|
4
|
+
function corsMiddleware(options = {}) {
|
|
5
|
+
const config = {
|
|
6
|
+
origin: options.origin || '*',
|
|
7
|
+
methods: options.methods || ['GET, POST, OPTIONS'],
|
|
8
|
+
allowedHeaders: options.allowedHeaders || ['Content-Type', 'Authorization', 'X-Requested-With'],
|
|
9
|
+
exposedHeaders: options.exposedHeaders || ['Content-Range', 'X-Content-Range'],
|
|
10
|
+
credentials: options.credentials || false,
|
|
11
|
+
maxAge: options.maxAge || 86400,
|
|
12
|
+
preflightContinue: options.preflightContinue || false
|
|
13
|
+
};
|
|
14
|
+
const methodsString = Array.isArray(config.methods) ? config.methods.join(', ') : config.methods;
|
|
15
|
+
const allowedHeadersString = Array.isArray(config.allowedHeaders) ? config.allowedHeaders.join(', ') : config.allowedHeaders;
|
|
16
|
+
const exposedHeadersString = Array.isArray(config.exposedHeaders) ? config.exposedHeaders.join(', ') : config.exposedHeaders;
|
|
17
|
+
return (req, res, next) => {
|
|
18
|
+
try {
|
|
19
|
+
res.setHeader('Access-Control-Allow-Origin', config.origin);
|
|
20
|
+
if (config.origin !== 'none') {
|
|
21
|
+
res.setHeader('Access-Control-Allow-Methods', methodsString);
|
|
22
|
+
res.setHeader('Access-Control-Allow-Headers', allowedHeadersString);
|
|
23
|
+
if (exposedHeadersString) {
|
|
24
|
+
res.setHeader('Access-Control-Expose-Headers', exposedHeadersString);
|
|
25
|
+
}
|
|
26
|
+
if (config.credentials) {
|
|
27
|
+
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
28
|
+
}
|
|
29
|
+
if (config.maxAge) {
|
|
30
|
+
res.setHeader('Access-Control-Max-Age', config.maxAge.toString());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (req.method === 'OPTIONS') {
|
|
34
|
+
res.writeHead(204);
|
|
35
|
+
res.end();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
next();
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('CORS middleware error:', error);
|
|
42
|
+
next();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=cors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/cors.ts"],"names":[],"mappings":";;AAqBA,wCAyDC;AAzDD,SAAgB,cAAc,CAAC,UAAuB,EAAE;IAEtD,MAAM,MAAM,GAA0B;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC;QAClD,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC,cAAc,EAAE,eAAe,EAAE,kBAAkB,CAAC;QAC/F,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC;QAC9E,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;QACzC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,KAAK;KACtD,CAAC;IAGF,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IACjG,MAAM,oBAAoB,GAAG,KAAK,CAAC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AC;YAGD,IAAI,EAAE,CAAC;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAE/C,IAAI,EAAE,CAAC;QACT,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http';\r\n\r\n/**\r\n * Interface for CORS middleware options\r\n */\r\ninterface CorsOptions {\r\n origin?: string | string[];\r\n methods?: string[];\r\n allowedHeaders?: string[];\r\n exposedHeaders?: string[];\r\n credentials?: boolean;\r\n maxAge?: number;\r\n preflightContinue?: boolean;\r\n}\r\n\r\n/**\r\n * Creates a configurable CORS middleware for tRPC applications\r\n * \r\n * @param options Configuration options for CORS\r\n * @returns A middleware function for handling CORS\r\n */\r\nexport function corsMiddleware(options: CorsOptions = {}) {\r\n // Default configuration with sensible values\r\n const config: Required<CorsOptions> = {\r\n origin: options.origin || '*',\r\n methods: options.methods || ['GET, POST, OPTIONS'],\r\n allowedHeaders: options.allowedHeaders || ['Content-Type', 'Authorization', 'X-Requested-With'],\r\n exposedHeaders: options.exposedHeaders || ['Content-Range', 'X-Content-Range'],\r\n credentials: options.credentials || false,\r\n maxAge: options.maxAge || 86400, // 24 hours\r\n preflightContinue: options.preflightContinue || false\r\n };\r\n\r\n // Convert arrays to comma-separated strings for header values\r\n const methodsString = Array.isArray(config.methods) ? config.methods.join(', ') : config.methods;\r\n const allowedHeadersString = Array.isArray(config.allowedHeaders) ? config.allowedHeaders.join(', ') : config.allowedHeaders;\r\n const exposedHeadersString = Array.isArray(config.exposedHeaders) ? config.exposedHeaders.join(', ') : config.exposedHeaders;\r\n\r\n // Return the middleware function\r\n return (req: IncomingMessage, res: ServerResponse, next: () => void) => {\r\n try {\r\n // Always set the CORS headers\r\n res.setHeader('Access-Control-Allow-Origin', config.origin);\r\n \r\n // Only set other headers if origin is not blocking the request\r\n if (config.origin !== 'none') {\r\n res.setHeader('Access-Control-Allow-Methods', methodsString);\r\n res.setHeader('Access-Control-Allow-Headers', allowedHeadersString);\r\n \r\n if (exposedHeadersString) {\r\n res.setHeader('Access-Control-Expose-Headers', exposedHeadersString);\r\n }\r\n \r\n if (config.credentials) {\r\n res.setHeader('Access-Control-Allow-Credentials', 'true');\r\n }\r\n \r\n if (config.maxAge) {\r\n res.setHeader('Access-Control-Max-Age', config.maxAge.toString());\r\n }\r\n }\r\n\r\n // Handle OPTIONS preflight requests\r\n if (req.method === 'OPTIONS') {\r\n res.writeHead(204); // 204 No Content is more appropriate for preflight\r\n res.end();\r\n return;\r\n }\r\n\r\n // Move to the next middleware\r\n next();\r\n } catch (error) {\r\n // Handle any errors that might occur\r\n console.error('CORS middleware error:', error);\r\n // Call next without the error as it expects no arguments\r\n next();\r\n }\r\n };\r\n}"]}
|
package/dist/utilities/enum.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare enum SectionType {
|
|
|
103
103
|
AUTHENTIC_BEIRUT = "authentic_beirut",
|
|
104
104
|
NEAR_ME = "near_me"
|
|
105
105
|
}
|
|
106
|
-
export declare enum
|
|
106
|
+
export declare enum CoreAuthIdentityType {
|
|
107
107
|
EMAIL = "email",
|
|
108
108
|
PHONE = "phone",
|
|
109
109
|
GOOGLE = "google",
|
package/dist/utilities/enum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdminRole = exports.MarketingStatus = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.ShopRole = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.AttributeItemSelectionType = exports.PriceType = exports.FoodGroup = exports.
|
|
3
|
+
exports.AdminRole = exports.MarketingStatus = exports.MarketingType = exports.FavouriteType = exports.CouponExpirationReason = exports.CouponType = exports.BobType = exports.BobModel = exports.BobSettlementStatus = exports.BobSettlementType = exports.BobAccountType = exports.ZoneStatus = exports.FaqAccountType = exports.CounterType = exports.BannerUserType = exports.BannerLinkType = exports.BannerClickType = exports.ShopRole = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.AttributeItemSelectionType = exports.PriceType = exports.FoodGroup = exports.CoreAuthIdentityType = exports.SectionType = exports.UpdatedField = exports.GeoLocationType = exports.RatingAccountType = exports.SubscriptionStatus = exports.SubscriptionPackage = exports.PaidCurrency = exports.PaymentStatus = exports.PaymentMethod = exports.ValueType = exports.HolidayWorkStatus = exports.WorkStatus = exports.WeekDay = exports.ItemType = exports.Status = void 0;
|
|
4
4
|
var Status;
|
|
5
5
|
(function (Status) {
|
|
6
6
|
Status["ACTIVE"] = "active";
|
|
@@ -121,13 +121,13 @@ var SectionType;
|
|
|
121
121
|
SectionType["AUTHENTIC_BEIRUT"] = "authentic_beirut";
|
|
122
122
|
SectionType["NEAR_ME"] = "near_me";
|
|
123
123
|
})(SectionType || (exports.SectionType = SectionType = {}));
|
|
124
|
-
var
|
|
125
|
-
(function (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
})(
|
|
124
|
+
var CoreAuthIdentityType;
|
|
125
|
+
(function (CoreAuthIdentityType) {
|
|
126
|
+
CoreAuthIdentityType["EMAIL"] = "email";
|
|
127
|
+
CoreAuthIdentityType["PHONE"] = "phone";
|
|
128
|
+
CoreAuthIdentityType["GOOGLE"] = "google";
|
|
129
|
+
CoreAuthIdentityType["APPLE"] = "apple";
|
|
130
|
+
})(CoreAuthIdentityType || (exports.CoreAuthIdentityType = CoreAuthIdentityType = {}));
|
|
131
131
|
var FoodGroup;
|
|
132
132
|
(function (FoodGroup) {
|
|
133
133
|
FoodGroup["MEAT"] = "meat";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"/","sources":["utilities/enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAGX;AAHD,WAAY,MAAM;IACjB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACtB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB;AAED,IAAY,QAQX;AARD,WAAY,QAAQ;IACnB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,uBAAW,CAAA;IACX,6CAAiC,CAAA;AAClC,CAAC,EARW,QAAQ,wBAAR,QAAQ,QAQnB;AAED,IAAY,OAQX;AARD,WAAY,OAAO;IAClB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACb,CAAC,EARW,OAAO,uBAAP,OAAO,QAQlB;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACrB,2BAAa,CAAA;IACb,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;AACtB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC5B,sCAA0B,CAAA;IAC1B,0CAA8B,CAAA;AAC/B,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,sCAAyB,CAAA;IACzB,4BAAe,CAAA;AAChB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACxB,8BAAa,CAAA;IACb,8BAAa,CAAA;AACd,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,aAIX;AAJD,WAAY,aAA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}\r\n\r\nexport enum ItemType {\r\n\tFOOD = 'food',\r\n\tGROCERY = 'grocery',\r\n\tPHARMACY = 'pharmacy',\r\n\tCOFFEE = 'coffee',\r\n\tFLOWER = 'flower',\r\n\tPET = 'pet',\r\n\tHEALTHY_CORNER = 'healthy_corner',\r\n}\r\n\r\nexport enum WeekDay {\r\n\tSunday = 0,\r\n\tMonday = 1,\r\n\tTuesday = 2,\r\n\tWednesday = 3,\r\n\tThursday = 4,\r\n\tFriday = 5,\r\n\tSaturday = 6,\r\n}\r\n\r\nexport enum WorkStatus {\r\n\tOPEN = 'open',\r\n\tCLOSED = 'closed',\r\n\tFULL_DAY = 'full_day',\r\n}\r\n\r\nexport enum HolidayWorkStatus {\r\n\tCLOSED = WorkStatus.CLOSED,\r\n\tFULL_DAY = WorkStatus.FULL_DAY,\r\n}\r\n\r\nexport enum ValueType {\r\n\tPERCENTAGE = 'percentage',\r\n\tFIXED = 'fixed',\r\n}\r\n\r\nexport enum PaymentMethod {\r\n\tCASH = 'cash',\r\n\tCARD = 'card',\r\n}\r\n\r\nexport enum PaymentStatus {\r\n\tPAID = 'paid',\r\n\tPENDING = 'pending',\r\n\tFAILED = 'failed',\r\n}\r\n\r\nexport enum PaidCurrency {\r\n\tBASE = 'base',\r\n\tSECONDARY = 'secondary',\r\n\tMIXED = 'mixed',\r\n}\r\n\r\nexport enum SubscriptionPackage {\r\n\tMONTHLY = 'monthly',\r\n\tYEARLY = 'yearly',\r\n}\r\n\r\nexport enum SubscriptionStatus {\r\n\tONGOING = 'ongoing',\r\n\tEXPIRED = 'expired',\r\n}\r\n\r\nexport enum RatingAccountType {\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum GeoLocationType {\r\n\tPOINT = 'point',\r\n\tPOLYGON = 'polygon',\r\n}\r\n\r\nexport enum UpdatedField {\r\n\tMAX_TOTAL_EST_ITEMS_PRICE = 'max_total_est_items_price',\r\n\tMAX_DISTANCE = 'max_distance',\r\n\tDAILY_WORKING_HOURS = 'daily_working_hours',\r\n\tBOB_CASH_SETTLEMENT_LIMIT = 'bob_cash_settlement_limit',\r\n\tTIPS = 'tips',\r\n\tEQUIPMENTS = 'equipments',\r\n\tMONTHLY_SHOP_TARGET = 'monthly_shop_target',\r\n\tMONTHLY_REWARD_PRIZE = 'monthly_reward_prize',\r\n\tBASE_CURRENCY = 'base_currency',\r\n\tSECONDARY_CURRENCY = 'secondary_currency',\r\n\tIS_DUAL_CURRENCY_ENABLED = 'is_dual_currency_enabled',\r\n\tEXCHANGE_RATE = 'exchange_rate',\r\n\tISSUANCE_DAY = 'issuance_day',\r\n\tOVER_DUE_PERIODS = 'over_due_periods',\r\n\tPAY_LIMIT_FOR_USER = 'pay_limit_for_user',\r\n\tVAT_PERCENTAGE = 'vat_percentage',\r\n\tRIDER_SEARCH_RANGES = 'rider_search_ranges',\r\n\tNEAR_BY_SHOP_DISTANCE = 'near_by_shop_distance',\r\n\tNEAR_BY_SHOP_DISTANCE_IN_HOME_SCREEN = 'near_by_shop_distance_in_home_screen',\r\n\tUNITS = 'units',\r\n\tCURRENCY_SETTING = 'currency_setting',\r\n\tPAYMENT_METHODS = 'payment_methods',\r\n\tIS_GROUND_ORDER_ENABLED = 'is_ground_order_enabled',\r\n\tCUSTOMER_SUPPORT_PHONE_NUMBER = 'customer_support_phone_number',\r\n}\r\n\r\nexport enum SectionType {\r\n\tSTORE_PUNCHES = 'store_punches',\r\n\tNEARBY_RESTAURANT = 'nearby_restaurant',\r\n\tNEARBY_GROCERY = 'nearby_grocery',\r\n\tNEARBY_PHARMACY = 'nearby_pharmacy',\r\n\tDISCOUNT = 'discount',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tCRAZY_OFFER_SHOPS = 'crazy_offer_shops',\r\n\tORDER_AGAIN = 'order_again',\r\n\tFEATURED = 'featured',\r\n\tLOVE = 'love',\r\n\tAUTHENTIC_BEIRUT = 'authentic_beirut',\r\n\tNEAR_ME = 'near_me',\r\n}\r\n\r\nexport enum AuthIdentityType {\r\n\tEMAIL = 'email',\r\n\tPHONE = 'phone',\r\n\tGOOGLE = 'google',\r\n\tAPPLE = 'apple',\r\n}\r\n\r\nexport enum FoodGroup {\r\n\tMEAT = 'meat',\r\n\tCHICKEN = 'chicken',\r\n\tFISH = 'fish',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tOTHER = 'other',\r\n}\r\n\r\nexport enum PriceType {\r\n\tPRICE = 'price',\r\n\tUNIT = 'unit',\r\n\tPORTION = 'portion',\r\n}\r\n\r\nexport enum AttributeItemSelectionType {\r\n\tSINGLE = 'single',\r\n\tMULTIPLE = 'multiple',\r\n}\r\n\r\nexport enum ProductDietaryType {\r\n\tGLUTEN_FREE = 'gluten_free',\r\n\tLOW_CAL = 'low_cal',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tVEGAN = 'vegan',\r\n\tGLUE_FREE = 'glue_free',\r\n\tKETO = 'keto',\r\n\tLACTOSE_FREE = 'lactose_free',\r\n\tHIGH_PROTEIN = 'high_protein',\r\n}\r\n\r\nexport enum DishCategory {\r\n\tBREAKFAST = 'breakfast',\r\n\tLUNCH = 'lunch',\r\n\tDINNER = 'dinner',\r\n\tSNACKS = 'snacks',\r\n}\r\n\r\nexport enum NotificationAccountType {\r\n\tUSER = 'user',\r\n\tPARENT = 'parent',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n\tADMIN = 'admin',\r\n\tCUSTOMER_SERVICE = 'customer_service',\r\n}\r\n\r\nexport enum ClickType {\r\n\tCLICKABLE_URL = 'clickable_url',\r\n\tCLICKABLE_ORDER = 'clickable_order',\r\n\tCLICKABLE_SHOP = 'clickable_shop',\r\n\tCLICKABLE_PRODUCT = 'clickable_product',\r\n\tCLICKABLE_LIST_CONTAINER = 'clickable_list_container',\r\n\tCLICKABLE_PAYOUT = 'clickable_payout',\r\n\tCLICKABLE_BOB_FINANCE = 'clickable_bob_finance',\r\n\tCLICKABLE_REQUEST_AREA = 'clickable_request_area',\r\n}\r\n\r\nexport enum ChargeType {\r\n\tGLOBAL = 'global',\r\n\tCUSTOM = 'custom',\r\n}\r\n\r\nexport enum ShopOnlineStatus {\r\n\tONLINE = 'online',\r\n\tOFFLINE = 'offline',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum ShopRole {\r\n\tPARENT = 'parent',\r\n\tPARENT_ORDER_MANAGER = 'parent_order_manager',\r\n\tSHOP = 'shop',\r\n\tSHOP_ORDER_MANAGER = 'shop_order_manager',\r\n}\r\n\r\nexport enum BannerClickType {\r\n\tLINK = 'link',\r\n\tSHOP = 'shop',\r\n\tPRODUCT = 'product',\r\n\tLIST_CONTAINER = 'list_container',\r\n\tPLUS = 'plus',\r\n}\r\n\r\nexport enum BannerLinkType {\r\n\tURL = 'url',\r\n\tAPP_ROUTE = 'app-route',\r\n}\r\n\r\nexport enum BannerUserType {\r\n\tALL = 'all',\r\n\tPLUS = 'plus',\r\n\tNORMAL = 'normal',\r\n}\r\n\r\nexport enum CounterType {\r\n\tORDER = 'order',\r\n\tCRM_NUMBER = 'crm_number',\r\n\tshop = 'shop',\r\n}\r\n\r\nexport enum FaqAccountType {\r\n\tUSER = 'user',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum ZoneStatus {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum BobAccountType {\r\n\tRIDER = 'rider',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum BobSettlementType {\r\n\tSETTLE_CASH = 'settle_cash',\r\n\tSETTLE_PAYOUT = 'settle_Payout',\r\n}\r\n\r\nexport enum BobSettlementStatus {\r\n\tNOT_PAID = 'not_paid',\r\n\tPAID = 'paid',\r\n\tREVOKED = 'revoked',\r\n}\r\n\r\nexport enum BobModel {\r\n\tC2B = 'C2B',\r\n\tB2C = 'B2C',\r\n}\r\n\r\nexport enum BobType {\r\n\tINWARD = 'inward',\r\n\tOUTWARD = 'outward',\r\n}\r\n\r\nexport enum CouponType {\r\n\tGLOBAL = 'global',\r\n\tINDIVIDUAL_STORE = 'individual_store',\r\n\tINDIVIDUAL_USER = 'individual_user',\r\n\tCUSTOM_COUPON = 'custom_coupon',\r\n\tREFERRAL_CODE = 'referral_code',\r\n\tREFERRAL_REWARD = 'referral_reward',\r\n}\r\n\r\nexport enum CouponExpirationReason {\r\n\tDURATION = 'duration',\r\n\tSPEND_LIMIT = 'spendLimit',\r\n\tTOTAL_ORDER_LIMIT = 'totalOrderLimit',\r\n}\r\n\r\nexport enum FavouriteType {\r\n\tPRODUCT = 'product',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum MarketingType {\r\n\tDISCOUNT = 'discount',\r\n\tBUY1GET1 = 'buy1get1',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tFEATURED = 'featured',\r\n\tLOYALTY_POINT = 'loyalty_point',\r\n\tPUNCH_MARKETING = 'punch_marketing',\r\n}\r\n\r\nexport enum MarketingStatus {\r\n\tACTIVE = 'active',\r\n\tPAUSED = 'paused',\r\n\tEXPIRED = 'expired',\r\n\tDELETED = 'deleted',\r\n}\r\n\r\nexport enum AdminRole {\r\n\tSUPER_ADMIN = 'super_admin',\r\n\tGENERAL_MANAGER = 'general_manager',\r\n\tORDER_MANAGEMENT_MANAGER = 'order_management_lead',\r\n\tORDER_MANAGEMENT_AGENT = 'order_management_agent',\r\n\tACCOUNT_MANAGER = 'account_manager',\r\n\tBUSINESS_DEVELOPMENT_EXECUTIVE = 'business_development_executive',\r\n\tACCOUNTING = 'accounting',\r\n\tMARKETING_MANAGER = 'marketing_manager',\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"/","sources":["utilities/enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAGX;AAHD,WAAY,MAAM;IACjB,2BAAiB,CAAA;IACjB,+BAAqB,CAAA;AACtB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB;A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U,0BAAV,UAAU,QAOrB;AAED,IAAY,sBAIX;AAJD,WAAY,sBAAsB;IACjC,+CAAqB,CAAA;IACrB,oDAA0B,CAAA;IAC1B,+DAAqC,CAAA;AACtC,CAAC,EAJW,sBAAsB,sCAAtB,sBAAsB,QAIjC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACxB,oCAAmB,CAAA;IACnB,8BAAa,CAAA;AACd,CAAC,EAHW,aAAa,6BAAb,aAAa,QAGxB;AAED,IAAY,aAOX;AAPD,WAAY,aAAa;IACxB,sCAAqB,CAAA;IACrB,sCAAqB,CAAA;IACrB,gDAA+B,CAAA;IAC/B,sCAAqB,CAAA;IACrB,gDAA+B,CAAA;IAC/B,oDAAmC,CAAA;AACpC,CAAC,EAPW,aAAa,6BAAb,aAAa,QAOxB;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IAC1B,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACpB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAED,IAAY,SASX;AATD,WAAY,SAAS;IACpB,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,+DAAkD,CAAA;IAClD,8DAAiD,CAAA;IACjD,gDAAmC,CAAA;IACnC,8EAAiE,CAAA;IACjE,sCAAyB,CAAA;IACzB,oDAAuC,CAAA;AACxC,CAAC,EATW,SAAS,yBAAT,SAAS,QASpB","sourcesContent":["export enum Status {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n}\r\n\r\nexport enum ItemType {\r\n\tFOOD = 'food',\r\n\tGROCERY = 'grocery',\r\n\tPHARMACY = 'pharmacy',\r\n\tCOFFEE = 'coffee',\r\n\tFLOWER = 'flower',\r\n\tPET = 'pet',\r\n\tHEALTHY_CORNER = 'healthy_corner',\r\n}\r\n\r\nexport enum WeekDay {\r\n\tSunday = 0,\r\n\tMonday = 1,\r\n\tTuesday = 2,\r\n\tWednesday = 3,\r\n\tThursday = 4,\r\n\tFriday = 5,\r\n\tSaturday = 6,\r\n}\r\n\r\nexport enum WorkStatus {\r\n\tOPEN = 'open',\r\n\tCLOSED = 'closed',\r\n\tFULL_DAY = 'full_day',\r\n}\r\n\r\nexport enum HolidayWorkStatus {\r\n\tCLOSED = WorkStatus.CLOSED,\r\n\tFULL_DAY = WorkStatus.FULL_DAY,\r\n}\r\n\r\nexport enum ValueType {\r\n\tPERCENTAGE = 'percentage',\r\n\tFIXED = 'fixed',\r\n}\r\n\r\nexport enum PaymentMethod {\r\n\tCASH = 'cash',\r\n\tCARD = 'card',\r\n}\r\n\r\nexport enum PaymentStatus {\r\n\tPAID = 'paid',\r\n\tPENDING = 'pending',\r\n\tFAILED = 'failed',\r\n}\r\n\r\nexport enum PaidCurrency {\r\n\tBASE = 'base',\r\n\tSECONDARY = 'secondary',\r\n\tMIXED = 'mixed',\r\n}\r\n\r\nexport enum SubscriptionPackage {\r\n\tMONTHLY = 'monthly',\r\n\tYEARLY = 'yearly',\r\n}\r\n\r\nexport enum SubscriptionStatus {\r\n\tONGOING = 'ongoing',\r\n\tEXPIRED = 'expired',\r\n}\r\n\r\nexport enum RatingAccountType {\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum GeoLocationType {\r\n\tPOINT = 'point',\r\n\tPOLYGON = 'polygon',\r\n}\r\n\r\nexport enum UpdatedField {\r\n\tMAX_TOTAL_EST_ITEMS_PRICE = 'max_total_est_items_price',\r\n\tMAX_DISTANCE = 'max_distance',\r\n\tDAILY_WORKING_HOURS = 'daily_working_hours',\r\n\tBOB_CASH_SETTLEMENT_LIMIT = 'bob_cash_settlement_limit',\r\n\tTIPS = 'tips',\r\n\tEQUIPMENTS = 'equipments',\r\n\tMONTHLY_SHOP_TARGET = 'monthly_shop_target',\r\n\tMONTHLY_REWARD_PRIZE = 'monthly_reward_prize',\r\n\tBASE_CURRENCY = 'base_currency',\r\n\tSECONDARY_CURRENCY = 'secondary_currency',\r\n\tIS_DUAL_CURRENCY_ENABLED = 'is_dual_currency_enabled',\r\n\tEXCHANGE_RATE = 'exchange_rate',\r\n\tISSUANCE_DAY = 'issuance_day',\r\n\tOVER_DUE_PERIODS = 'over_due_periods',\r\n\tPAY_LIMIT_FOR_USER = 'pay_limit_for_user',\r\n\tVAT_PERCENTAGE = 'vat_percentage',\r\n\tRIDER_SEARCH_RANGES = 'rider_search_ranges',\r\n\tNEAR_BY_SHOP_DISTANCE = 'near_by_shop_distance',\r\n\tNEAR_BY_SHOP_DISTANCE_IN_HOME_SCREEN = 'near_by_shop_distance_in_home_screen',\r\n\tUNITS = 'units',\r\n\tCURRENCY_SETTING = 'currency_setting',\r\n\tPAYMENT_METHODS = 'payment_methods',\r\n\tIS_GROUND_ORDER_ENABLED = 'is_ground_order_enabled',\r\n\tCUSTOMER_SUPPORT_PHONE_NUMBER = 'customer_support_phone_number',\r\n}\r\n\r\nexport enum SectionType {\r\n\tSTORE_PUNCHES = 'store_punches',\r\n\tNEARBY_RESTAURANT = 'nearby_restaurant',\r\n\tNEARBY_GROCERY = 'nearby_grocery',\r\n\tNEARBY_PHARMACY = 'nearby_pharmacy',\r\n\tDISCOUNT = 'discount',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tCRAZY_OFFER_SHOPS = 'crazy_offer_shops',\r\n\tORDER_AGAIN = 'order_again',\r\n\tFEATURED = 'featured',\r\n\tLOVE = 'love',\r\n\tAUTHENTIC_BEIRUT = 'authentic_beirut',\r\n\tNEAR_ME = 'near_me',\r\n}\r\n\r\nexport enum CoreAuthIdentityType {\r\n\tEMAIL = 'email',\r\n\tPHONE = 'phone',\r\n\tGOOGLE = 'google',\r\n\tAPPLE = 'apple',\r\n}\r\n\r\nexport enum FoodGroup {\r\n\tMEAT = 'meat',\r\n\tCHICKEN = 'chicken',\r\n\tFISH = 'fish',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tOTHER = 'other',\r\n}\r\n\r\nexport enum PriceType {\r\n\tPRICE = 'price',\r\n\tUNIT = 'unit',\r\n\tPORTION = 'portion',\r\n}\r\n\r\nexport enum AttributeItemSelectionType {\r\n\tSINGLE = 'single',\r\n\tMULTIPLE = 'multiple',\r\n}\r\n\r\nexport enum ProductDietaryType {\r\n\tGLUTEN_FREE = 'gluten_free',\r\n\tLOW_CAL = 'low_cal',\r\n\tVEGETARIAN = 'vegetarian',\r\n\tVEGAN = 'vegan',\r\n\tGLUE_FREE = 'glue_free',\r\n\tKETO = 'keto',\r\n\tLACTOSE_FREE = 'lactose_free',\r\n\tHIGH_PROTEIN = 'high_protein',\r\n}\r\n\r\nexport enum DishCategory {\r\n\tBREAKFAST = 'breakfast',\r\n\tLUNCH = 'lunch',\r\n\tDINNER = 'dinner',\r\n\tSNACKS = 'snacks',\r\n}\r\n\r\nexport enum NotificationAccountType {\r\n\tUSER = 'user',\r\n\tPARENT = 'parent',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n\tADMIN = 'admin',\r\n\tCUSTOMER_SERVICE = 'customer_service',\r\n}\r\n\r\nexport enum ClickType {\r\n\tCLICKABLE_URL = 'clickable_url',\r\n\tCLICKABLE_ORDER = 'clickable_order',\r\n\tCLICKABLE_SHOP = 'clickable_shop',\r\n\tCLICKABLE_PRODUCT = 'clickable_product',\r\n\tCLICKABLE_LIST_CONTAINER = 'clickable_list_container',\r\n\tCLICKABLE_PAYOUT = 'clickable_payout',\r\n\tCLICKABLE_BOB_FINANCE = 'clickable_bob_finance',\r\n\tCLICKABLE_REQUEST_AREA = 'clickable_request_area',\r\n}\r\n\r\nexport enum ChargeType {\r\n\tGLOBAL = 'global',\r\n\tCUSTOM = 'custom',\r\n}\r\n\r\nexport enum ShopOnlineStatus {\r\n\tONLINE = 'online',\r\n\tOFFLINE = 'offline',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum ShopRole {\r\n\tPARENT = 'parent',\r\n\tPARENT_ORDER_MANAGER = 'parent_order_manager',\r\n\tSHOP = 'shop',\r\n\tSHOP_ORDER_MANAGER = 'shop_order_manager',\r\n}\r\n\r\nexport enum BannerClickType {\r\n\tLINK = 'link',\r\n\tSHOP = 'shop',\r\n\tPRODUCT = 'product',\r\n\tLIST_CONTAINER = 'list_container',\r\n\tPLUS = 'plus',\r\n}\r\n\r\nexport enum BannerLinkType {\r\n\tURL = 'url',\r\n\tAPP_ROUTE = 'app-route',\r\n}\r\n\r\nexport enum BannerUserType {\r\n\tALL = 'all',\r\n\tPLUS = 'plus',\r\n\tNORMAL = 'normal',\r\n}\r\n\r\nexport enum CounterType {\r\n\tORDER = 'order',\r\n\tCRM_NUMBER = 'crm_number',\r\n\tshop = 'shop',\r\n}\r\n\r\nexport enum FaqAccountType {\r\n\tUSER = 'user',\r\n\tSHOP = 'shop',\r\n\tRIDER = 'rider',\r\n}\r\n\r\nexport enum ZoneStatus {\r\n\tACTIVE = 'active',\r\n\tINACTIVE = 'inactive',\r\n\tBUSY = 'busy',\r\n}\r\n\r\nexport enum BobAccountType {\r\n\tRIDER = 'rider',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum BobSettlementType {\r\n\tSETTLE_CASH = 'settle_cash',\r\n\tSETTLE_PAYOUT = 'settle_Payout',\r\n}\r\n\r\nexport enum BobSettlementStatus {\r\n\tNOT_PAID = 'not_paid',\r\n\tPAID = 'paid',\r\n\tREVOKED = 'revoked',\r\n}\r\n\r\nexport enum BobModel {\r\n\tC2B = 'C2B',\r\n\tB2C = 'B2C',\r\n}\r\n\r\nexport enum BobType {\r\n\tINWARD = 'inward',\r\n\tOUTWARD = 'outward',\r\n}\r\n\r\nexport enum CouponType {\r\n\tGLOBAL = 'global',\r\n\tINDIVIDUAL_STORE = 'individual_store',\r\n\tINDIVIDUAL_USER = 'individual_user',\r\n\tCUSTOM_COUPON = 'custom_coupon',\r\n\tREFERRAL_CODE = 'referral_code',\r\n\tREFERRAL_REWARD = 'referral_reward',\r\n}\r\n\r\nexport enum CouponExpirationReason {\r\n\tDURATION = 'duration',\r\n\tSPEND_LIMIT = 'spendLimit',\r\n\tTOTAL_ORDER_LIMIT = 'totalOrderLimit',\r\n}\r\n\r\nexport enum FavouriteType {\r\n\tPRODUCT = 'product',\r\n\tSHOP = 'shop',\r\n}\r\n\r\nexport enum MarketingType {\r\n\tDISCOUNT = 'discount',\r\n\tBUY1GET1 = 'buy1get1',\r\n\tFREE_DELIVERY = 'free_delivery',\r\n\tFEATURED = 'featured',\r\n\tLOYALTY_POINT = 'loyalty_point',\r\n\tPUNCH_MARKETING = 'punch_marketing',\r\n}\r\n\r\nexport enum MarketingStatus {\r\n\tACTIVE = 'active',\r\n\tPAUSED = 'paused',\r\n\tEXPIRED = 'expired',\r\n\tDELETED = 'deleted',\r\n}\r\n\r\nexport enum AdminRole {\r\n\tSUPER_ADMIN = 'super_admin',\r\n\tGENERAL_MANAGER = 'general_manager',\r\n\tORDER_MANAGEMENT_MANAGER = 'order_management_lead',\r\n\tORDER_MANAGEMENT_AGENT = 'order_management_agent',\r\n\tACCOUNT_MANAGER = 'account_manager',\r\n\tBUSINESS_DEVELOPMENT_EXECUTIVE = 'business_development_executive',\r\n\tACCOUNTING = 'accounting',\r\n\tMARKETING_MANAGER = 'marketing_manager',\r\n}\r\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TRPCError } from '@trpc/server';
|
|
2
|
+
interface ErrorHandlerParams {
|
|
3
|
+
error: TRPCError | Error | unknown;
|
|
4
|
+
type: 'query' | 'mutation' | 'subscription' | 'unknown';
|
|
5
|
+
path: string | undefined;
|
|
6
|
+
ctx: Record<string, any> | undefined;
|
|
7
|
+
req: any;
|
|
8
|
+
input: unknown;
|
|
9
|
+
}
|
|
10
|
+
export declare function handleTRPCError({ error, type, path, ctx }: ErrorHandlerParams): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.handleTRPCError = handleTRPCError;
|
|
37
|
+
const server_1 = require("@trpc/server");
|
|
38
|
+
const error_handler_1 = require("./error-handler");
|
|
39
|
+
const util = __importStar(require("util"));
|
|
40
|
+
function handleTRPCError({ error, type, path, ctx }) {
|
|
41
|
+
const errorContext = {
|
|
42
|
+
procedurePath: path ?? 'unknown',
|
|
43
|
+
procedureType: type,
|
|
44
|
+
requestId: ctx?.requestId ?? 'unknown',
|
|
45
|
+
timestamp: new Date().toISOString(),
|
|
46
|
+
};
|
|
47
|
+
console.error(error);
|
|
48
|
+
console.error('\n\n');
|
|
49
|
+
console.error('╔═══════════════════════════════════════════════════════════════════╗');
|
|
50
|
+
console.error('║ 🔥 TRPC ERROR 🔥 ║');
|
|
51
|
+
console.error('╚═══════════════════════════════════════════════════════════════════╝');
|
|
52
|
+
console.error('\n📋 Error Context:');
|
|
53
|
+
console.error('┌─────────────────────────────────────────────────────────────────┐');
|
|
54
|
+
console.error(`│ Path: ${errorContext.procedurePath.padEnd(52)} │`);
|
|
55
|
+
console.error(`│ Type: ${errorContext.procedureType.padEnd(52)} │`);
|
|
56
|
+
console.error(`│ Request ID: ${errorContext.requestId.padEnd(51)} │`);
|
|
57
|
+
console.error(`│ Timestamp: ${errorContext.timestamp.padEnd(51)} │`);
|
|
58
|
+
console.error('└─────────────────────────────────────────────────────────────────┘');
|
|
59
|
+
if (error instanceof server_1.TRPCError) {
|
|
60
|
+
console.error('\n🚨 Error Details:');
|
|
61
|
+
console.error('┌─────────────────────────────────────────────────────────────────┐');
|
|
62
|
+
console.error(`│ Code: ${error.code.padEnd(54)} │`);
|
|
63
|
+
console.error('└─────────────────────────────────────────────────────────────────┘');
|
|
64
|
+
if (error.code === 'BAD_REQUEST') {
|
|
65
|
+
try {
|
|
66
|
+
if (error.message.trim().startsWith('[') && error.message.includes('"code"')) {
|
|
67
|
+
const validationErrors = JSON.parse(error.message);
|
|
68
|
+
console.error('\n📋 Validation Errors:');
|
|
69
|
+
validationErrors.forEach((err, index) => {
|
|
70
|
+
const fieldPath = err.path.join('.');
|
|
71
|
+
console.error(`│ ${(index + 1).toString().padStart(2)}. Field: ${fieldPath.padEnd(52)} │`);
|
|
72
|
+
console.error(`│ Error: ${err.message.padEnd(53)} │`);
|
|
73
|
+
console.error(`│ Expected: ${err.expected?.padEnd(50) || 'N/A'.padEnd(50)} │`);
|
|
74
|
+
console.error(`│ Received: ${err.received?.padEnd(50) || 'N/A'.padEnd(50)} │`);
|
|
75
|
+
if (index < validationErrors.length - 1) {
|
|
76
|
+
console.error('│ │');
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const fieldErrors = validationErrors.map(err => `(${err.path.join('.')}: ${err.message})`);
|
|
80
|
+
error.message = `Validation failed: ${fieldErrors.join(', ')}`;
|
|
81
|
+
console.error('\n📤 Client Response Message:');
|
|
82
|
+
const message = error.message;
|
|
83
|
+
const chunkSize = 65;
|
|
84
|
+
for (let i = 0; i < message.length; i += chunkSize) {
|
|
85
|
+
const chunk = message.substring(i, i + chunkSize);
|
|
86
|
+
console.error(`│ ${chunk.padEnd(65)}`);
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (parseError) {
|
|
92
|
+
console.error('\n⚠️ Error Parsing Validation Error:');
|
|
93
|
+
console.error(`│ ${parseError instanceof Error ? parseError.message.padEnd(65) : String(parseError).padEnd(65)}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
console.error('\n📝 Error Message:');
|
|
97
|
+
const message = error.message;
|
|
98
|
+
const chunkSize = 65;
|
|
99
|
+
for (let i = 0; i < message.length; i += chunkSize) {
|
|
100
|
+
const chunk = message.substring(i, i + chunkSize);
|
|
101
|
+
console.error(`│ ${chunk.padEnd(65)}`);
|
|
102
|
+
}
|
|
103
|
+
if (error.cause) {
|
|
104
|
+
console.error('\n🔍 Error Cause:');
|
|
105
|
+
const causeString = util.inspect(error.cause, { depth: 4, colors: true });
|
|
106
|
+
const causeLines = causeString.split('\n');
|
|
107
|
+
causeLines.forEach(line => {
|
|
108
|
+
const plainLine = line.replace(/\x1b\[\d+m/g, '');
|
|
109
|
+
console.error(`│ ${line.padEnd(65 - (line.length - plainLine.length))}`);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (error.stack) {
|
|
113
|
+
console.error('\n📚 Stack Trace:');
|
|
114
|
+
const stackLines = error.stack.split('\n');
|
|
115
|
+
stackLines.forEach(line => {
|
|
116
|
+
if (line.length > 65) {
|
|
117
|
+
for (let i = 0; i < line.length; i += 65) {
|
|
118
|
+
const chunk = line.substring(i, i + 65);
|
|
119
|
+
console.error(`│ ${chunk.padEnd(65)}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
console.error(`│ ${line.padEnd(65)}`);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (error instanceof Error) {
|
|
129
|
+
console.error('\n🚨 Standard Error:');
|
|
130
|
+
console.error('┌─────────────────────────────────────────────────────────────────┐');
|
|
131
|
+
console.error(`│ Name: ${error.name.padEnd(54)} │`);
|
|
132
|
+
console.error(`│ Message: ${error.message.padEnd(54)} │`);
|
|
133
|
+
console.error('└─────────────────────────────────────────────────────────────────┘');
|
|
134
|
+
if (error.stack) {
|
|
135
|
+
console.error('\n📚 Stack Trace:');
|
|
136
|
+
const stackLines = error.stack.split('\n');
|
|
137
|
+
stackLines.forEach(line => {
|
|
138
|
+
if (line.length > 65) {
|
|
139
|
+
for (let i = 0; i < line.length; i += 65) {
|
|
140
|
+
const chunk = line.substring(i, i + 65);
|
|
141
|
+
console.error(`│ ${chunk.padEnd(65)} │`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
console.error(`│ ${line.padEnd(65)} │`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
console.error('\n❓ Unknown Error:');
|
|
152
|
+
const errorString = util.inspect(error, { depth: 4, colors: true });
|
|
153
|
+
const errorLines = errorString.split('\n');
|
|
154
|
+
errorLines.forEach(line => {
|
|
155
|
+
const plainLine = line.replace(/\x1b\[\d+m/g, '');
|
|
156
|
+
console.error(`│ ${line.padEnd(65 - (line.length - plainLine.length))}`);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const errorMeta = error_handler_1.ErrorHandler.extractErrorMetadata(error);
|
|
161
|
+
if (errorMeta && Object.keys(errorMeta).length > 0) {
|
|
162
|
+
console.error('\n🔬 Additional Error Metadata:');
|
|
163
|
+
const metaString = util.inspect(errorMeta, { depth: 4, colors: true });
|
|
164
|
+
const metaLines = metaString.split('\n');
|
|
165
|
+
metaLines.forEach(line => {
|
|
166
|
+
const plainLine = line.replace(/\x1b\[\d+m/g, '');
|
|
167
|
+
console.error(`│ ${line.padEnd(65 - (line.length - plainLine.length))}`);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (handlingError) {
|
|
172
|
+
console.error('\n⚠️ Error While Extracting Metadata:');
|
|
173
|
+
console.error(`│ ${handlingError instanceof Error ? handlingError.message.padEnd(65) : String(handlingError).padEnd(65)}`);
|
|
174
|
+
}
|
|
175
|
+
console.error('\n\n');
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=error-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-middleware.js","sourceRoot":"/","sources":["utilities/error-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,0CA6LC;AA7PD,yCAAyC;AACzC,mDAA+C;AAC/C,2CAA6B;AA8D7B,SAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAsB;IAC7E,MAAM,YAAY,GAAG;QACpB,aAAa,EAAE,IAAI,IAAI,SAAS;QAChC,aAAa,EAAE,IAAI;QACnB,SAAS,EAAE,GAAG,EAAE,SAAS,IAAI,SAAS;QACtC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACnC,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,KAAK,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AO,CAAC,IAAI,CAAC,EAAE;gBAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAClD,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAAC,OAAO,aAAa,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACvD,OAAO,CAAC,KAAK,CACZ,KACC,aAAa,YAAY,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,EAAE,CACpG,EAAE,CACF,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\r\nimport { ErrorHandler } from './error-handler';\r\nimport * as util from 'util';\r\n\r\n/**\r\n * Parameters for the tRPC error handler\r\n * @typedef {Object} ErrorHandlerParams\r\n * @property {TRPCError|Error|unknown} error - The error object to handle\r\n * @property {'query'|'mutation'|'subscription'|'unknown'} type - The type of tRPC procedure\r\n * @property {string|undefined} path - The path of the tRPC procedure\r\n * @property {Record<string,any>|undefined} ctx - The context of the request\r\n * @property {any} req - The request object\r\n * @property {unknown} input - The input parameters for the procedure\r\n */\r\ninterface ErrorHandlerParams {\r\n\terror: TRPCError | Error | unknown;\r\n\ttype: 'query' | 'mutation' | 'subscription' | 'unknown';\r\n\tpath: string | undefined;\r\n\tctx: Record<string, any> | undefined;\r\n\treq: any;\r\n\tinput: unknown;\r\n}\r\n\r\n/**\r\n * Structure of validation errors from zod validation\r\n * @typedef {Object} ValidationError\r\n * @property {string} code - The error code (e.g., 'invalid_type')\r\n * @property {string} expected - The expected type or value\r\n * @property {string} received - The received type or value\r\n * @property {(string|number)[]} path - The path to the field with the error\r\n * @property {string} message - The error message\r\n */\r\ninterface ValidationError {\r\n\tcode: string;\r\n\texpected: string;\r\n\treceived: string;\r\n\tpath: (string | number)[];\r\n\tmessage: string;\r\n}\r\n\r\n/**\r\n * Central error handler for tRPC HTTP server.\r\n * \r\n * This handler provides comprehensive error logging with structured, formatted output in the console.\r\n * It specializes in handling validation errors from zod schemas, presenting them in a readable format\r\n * both for console debugging and client response.\r\n * \r\n * Key features:\r\n * - Beautiful console formatting with box-styled outputs\r\n * - Special handling for validation errors with field-by-field breakdown\r\n * - Proper handling of nested error objects and stack traces\r\n * - Integration with ErrorHandler utility for extracting additional metadata\r\n * - Client-friendly error message formatting for validation errors\r\n * \r\n * @param {ErrorHandlerParams} params - The error handler parameters\r\n * @param {TRPCError|Error|unknown} params.error - The error that occurred\r\n * @param {'query'|'mutation'|'subscription'|'unknown'} params.type - Type of tRPC procedure\r\n * @param {string|undefined} params.path - Path of the tRPC procedure\r\n * @param {Record<string,any>|undefined} params.ctx - Request context\r\n * @param {any} params.req - The request object\r\n * @param {unknown} params.input - The input parameters\r\n * \r\n * @returns {void}\r\n */\r\nexport function handleTRPCError({ error, type, path, ctx }: ErrorHandlerParams): void {\r\n\tconst errorContext = {\r\n\t\tprocedurePath: path ?? 'unknown',\r\n\t\tprocedureType: type,\r\n\t\trequestId: ctx?.requestId ?? 'unknown',\r\n\t\ttimestamp: new Date().toISOString(),\r\n\t};\r\n\r\n\tconsole.error(error);\r\n\r\n\t// Print a clear error header with context\r\n\tconsole.error('\\n\\n');\r\n\tconsole.error('╔═══════════════════════════════════════════════════════════════════╗');\r\n\tconsole.error('║ 🔥 TRPC ERROR 🔥 ║');\r\n\tconsole.error('╚═══════════════════════════════════════════════════════════════════╝');\r\n\r\n\t// Print context information in a structured format\r\n\tconsole.error('\\n📋 Error Context:');\r\n\tconsole.error('┌─────────────────────────────────────────────────────────────────┐');\r\n\tconsole.error(`│ Path: ${errorContext.procedurePath.padEnd(52)} │`);\r\n\tconsole.error(`│ Type: ${errorContext.procedureType.padEnd(52)} │`);\r\n\tconsole.error(`│ Request ID: ${errorContext.requestId.padEnd(51)} │`);\r\n\tconsole.error(`│ Timestamp: ${errorContext.timestamp.padEnd(51)} │`);\r\n\tconsole.error('└─────────────────────────────────────────────────────────────────┘');\r\n\r\n\tif (error instanceof TRPCError) {\r\n\t\t// Print basic error info\r\n\t\tconsole.error('\\n🚨 Error Details:');\r\n\t\tconsole.error('┌─────────────────────────────────────────────────────────────────┐');\r\n\t\tconsole.error(`│ Code: ${error.code.padEnd(54)} │`);\r\n\t\tconsole.error('└─────────────────────────────────────────────────────────────────┘');\r\n\r\n\t\t// Handle validation errors specially\r\n\t\tif (error.code === 'BAD_REQUEST') {\r\n\t\t\ttry {\r\n\t\t\t\tif (error.message.trim().startsWith('[') && error.message.includes('\"code\"')) {\r\n\t\t\t\t\tconst validationErrors = JSON.parse(error.message) as ValidationError[];\r\n\r\n\t\t\t\t\tconsole.error('\\n📋 Validation Errors:');\r\n\r\n\t\t\t\t\tvalidationErrors.forEach((err, index) => {\r\n\t\t\t\t\t\tconst fieldPath = err.path.join('.');\r\n\t\t\t\t\t\tconsole.error(`│ ${(index + 1).toString().padStart(2)}. Field: ${fieldPath.padEnd(52)} │`);\r\n\t\t\t\t\t\tconsole.error(`│ Error: ${err.message.padEnd(53)} │`);\r\n\t\t\t\t\t\tconsole.error(`│ Expected: ${err.expected?.padEnd(50) || 'N/A'.padEnd(50)} │`);\r\n\t\t\t\t\t\tconsole.error(`│ Received: ${err.received?.padEnd(50) || 'N/A'.padEnd(50)} │`);\r\n\r\n\t\t\t\t\t\t// Add a separator between errors, except for the last one\r\n\t\t\t\t\t\tif (index < validationErrors.length - 1) {\r\n\t\t\t\t\t\t\tconsole.error('│ │');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\t// Format field errors for the client response\r\n\t\t\t\t\tconst fieldErrors = validationErrors.map(err => `(${err.path.join('.')}: ${err.message})`);\r\n\r\n\t\t\t\t\terror.message = `Validation failed: ${fieldErrors.join(', ')}`;\r\n\r\n\t\t\t\t\t// Print the formatted client message\r\n\t\t\t\t\tconsole.error('\\n📤 Client Response Message:');\r\n\r\n\t\t\t\t\t// Split the message into multiple lines if it's too long\r\n\t\t\t\t\tconst message = error.message;\r\n\t\t\t\t\tconst chunkSize = 65;\r\n\r\n\t\t\t\t\tfor (let i = 0; i < message.length; i += chunkSize) {\r\n\t\t\t\t\t\tconst chunk = message.substring(i, i + chunkSize);\r\n\t\t\t\t\t\tconsole.error(`│ ${chunk.padEnd(65)}`);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t} catch (parseError) {\r\n\t\t\t\tconsole.error('\\n⚠️ Error Parsing Validation Error:');\r\n\t\t\t\tconsole.error(\r\n\t\t\t\t\t`│ ${parseError instanceof Error ? parseError.message.padEnd(65) : String(parseError).padEnd(65)}`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Print the error message\r\n\t\tconsole.error('\\n📝 Error Message:');\r\n\r\n\t\t// Split the message into multiple lines if it's too long\r\n\t\tconst message = error.message;\r\n\t\tconst chunkSize = 65;\r\n\r\n\t\tfor (let i = 0; i < message.length; i += chunkSize) {\r\n\t\t\tconst chunk = message.substring(i, i + chunkSize);\r\n\t\t\tconsole.error(`│ ${chunk.padEnd(65)}`);\r\n\t\t}\r\n\r\n\t\t// Print the error cause if available\r\n\t\tif (error.cause) {\r\n\t\t\tconsole.error('\\n🔍 Error Cause:');\r\n\r\n\t\t\t// Use util.inspect to format the cause object nicely\r\n\t\t\tconst causeString = util.inspect(error.cause, { depth: 4, colors: true });\r\n\t\t\tconst causeLines = causeString.split('\\n');\r\n\r\n\t\t\tcauseLines.forEach(line => {\r\n\t\t\t\t// Remove ANSI color codes for padding calculation\r\n\t\t\t\tconst plainLine = line.replace(/\\x1b\\[\\d+m/g, '');\r\n\t\t\t\tconsole.error(`│ ${line.padEnd(65 - (line.length - plainLine.length))}`);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Print stack trace if available\r\n\t\tif (error.stack) {\r\n\t\t\tconsole.error('\\n📚 Stack Trace:');\r\n\r\n\t\t\tconst stackLines = error.stack.split('\\n');\r\n\t\t\tstackLines.forEach(line => {\r\n\t\t\t\t// Truncate or split long lines\r\n\t\t\t\tif (line.length > 65) {\r\n\t\t\t\t\tfor (let i = 0; i < line.length; i += 65) {\r\n\t\t\t\t\t\tconst chunk = line.substring(i, i + 65);\r\n\t\t\t\t\t\tconsole.error(`│ ${chunk.padEnd(65)}`);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconsole.error(`│ ${line.padEnd(65)}`);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t} else if (error instanceof Error) {\r\n\t\t// Handle standard errors\r\n\t\tconsole.error('\\n🚨 Standard Error:');\r\n\t\tconsole.error('┌─────────────────────────────────────────────────────────────────┐');\r\n\t\tconsole.error(`│ Name: ${error.name.padEnd(54)} │`);\r\n\t\tconsole.error(`│ Message: ${error.message.padEnd(54)} │`);\r\n\t\tconsole.error('└─────────────────────────────────────────────────────────────────┘');\r\n\r\n\t\t// Print stack trace if available\r\n\t\tif (error.stack) {\r\n\t\t\tconsole.error('\\n📚 Stack Trace:');\r\n\r\n\t\t\tconst stackLines = error.stack.split('\\n');\r\n\t\t\tstackLines.forEach(line => {\r\n\t\t\t\t// Truncate or split long lines\r\n\t\t\t\tif (line.length > 65) {\r\n\t\t\t\t\tfor (let i = 0; i < line.length; i += 65) {\r\n\t\t\t\t\t\tconst chunk = line.substring(i, i + 65);\r\n\t\t\t\t\t\tconsole.error(`│ ${chunk.padEnd(65)} │`);\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tconsole.error(`│ ${line.padEnd(65)} │`);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\t} else {\r\n\t\t// Handle unknown errors\r\n\t\tconsole.error('\\n❓ Unknown Error:');\r\n\r\n\t\tconst errorString = util.inspect(error, { depth: 4, colors: true });\r\n\t\tconst errorLines = errorString.split('\\n');\r\n\r\n\t\terrorLines.forEach(line => {\r\n\t\t\t// Remove ANSI color codes for padding calculation\r\n\t\t\tconst plainLine = line.replace(/\\x1b\\[\\d+m/g, '');\r\n\t\t\tconsole.error(`│ ${line.padEnd(65 - (line.length - plainLine.length))}`);\r\n\t\t});\r\n\t}\r\n\r\n\t// Use ErrorHandler's methods for additional metadata\r\n\ttry {\r\n\t\tconst errorMeta = ErrorHandler.extractErrorMetadata(error);\r\n\r\n\t\tif (errorMeta && Object.keys(errorMeta).length > 0) {\r\n\t\t\tconsole.error('\\n🔬 Additional Error Metadata:');\r\n\r\n\t\t\tconst metaString = util.inspect(errorMeta, { depth: 4, colors: true });\r\n\t\t\tconst metaLines = metaString.split('\\n');\r\n\r\n\t\t\tmetaLines.forEach(line => {\r\n\t\t\t\t// Remove ANSI color codes for padding calculation\r\n\t\t\t\tconst plainLine = line.replace(/\\x1b\\[\\d+m/g, '');\r\n\t\t\t\tconsole.error(`│ ${line.padEnd(65 - (line.length - plainLine.length))}`);\r\n\t\t\t});\r\n\t\t}\r\n\t} catch (handlingError) {\r\n\t\tconsole.error('\\n⚠️ Error While Extracting Metadata:');\r\n\t\tconsole.error(\r\n\t\t\t`│ ${\r\n\t\t\t\thandlingError instanceof Error ? handlingError.message.padEnd(65) : String(handlingError).padEnd(65)\r\n\t\t\t}`\r\n\t\t);\r\n\t}\r\n\r\n\tconsole.error('\\n\\n');\r\n}"]}
|