@lyxa.ai/core 1.0.154 → 1.0.156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/libraries/auth/index.d.ts +2 -1
  2. package/dist/libraries/auth/index.js +1 -0
  3. package/dist/libraries/auth/index.js.map +1 -1
  4. package/dist/libraries/map/providers/google-maps.js +9 -40
  5. package/dist/libraries/map/providers/google-maps.js.map +1 -1
  6. package/dist/libraries/mongo/models/index.d.ts +9 -0
  7. package/dist/libraries/mongo/models/index.js +10 -1
  8. package/dist/libraries/mongo/models/index.js.map +1 -1
  9. package/dist/libraries/mongo/models/rider.model.d.ts +2 -0
  10. package/dist/libraries/mongo/models/rider.model.js +12 -2
  11. package/dist/libraries/mongo/models/rider.model.js.map +1 -1
  12. package/dist/libraries/mongo/models/service-package.model.d.ts +8 -0
  13. package/dist/libraries/mongo/models/service-package.model.js +41 -1
  14. package/dist/libraries/mongo/models/service-package.model.js.map +1 -1
  15. package/dist/libraries/mongo/models/vendor-access-control.model.d.ts +13 -0
  16. package/dist/libraries/mongo/models/vendor-access-control.model.js +70 -0
  17. package/dist/libraries/mongo/models/vendor-access-control.model.js.map +1 -0
  18. package/dist/libraries/socket-manager/connection.store.d.ts +11 -0
  19. package/dist/libraries/socket-manager/connection.store.js +46 -0
  20. package/dist/libraries/socket-manager/connection.store.js.map +1 -0
  21. package/dist/libraries/socket-manager/index.d.ts +1 -0
  22. package/dist/libraries/socket-manager/index.js +18 -0
  23. package/dist/libraries/socket-manager/index.js.map +1 -0
  24. package/dist/libraries/socket-manager/socket-manager.service.d.ts +23 -0
  25. package/dist/libraries/socket-manager/socket-manager.service.js +94 -0
  26. package/dist/libraries/socket-manager/socket-manager.service.js.map +1 -0
  27. package/dist/libraries/trpc/context.d.ts +1 -0
  28. package/dist/libraries/trpc/context.js.map +1 -1
  29. package/dist/types/README.md +1 -1
  30. package/dist/types/package.json +1 -1
  31. package/dist/types/utilities/enum.d.ts +20 -9
  32. package/dist/types/utilities/enum.js +23 -10
  33. package/dist/types/utilities/enum.js.map +1 -1
  34. package/dist/utilities/connection.types.d.ts +9 -0
  35. package/dist/utilities/connection.types.js +3 -0
  36. package/dist/utilities/connection.types.js.map +1 -0
  37. package/dist/utilities/enum.d.ts +20 -9
  38. package/dist/utilities/enum.js +23 -10
  39. package/dist/utilities/enum.js.map +1 -1
  40. package/package.json +1 -1
@@ -19,8 +19,16 @@ let ServicePackage = class ServicePackage extends defaultClasses_1.TimeStamps {
19
19
  name;
20
20
  vendor;
21
21
  category;
22
+ price;
23
+ secondaryPrice;
24
+ duration;
25
+ numberOfProfessionals;
26
+ description;
22
27
  image;
28
+ addons;
23
29
  status;
30
+ includeMaterials;
31
+ materialsCost;
24
32
  };
25
33
  exports.ServicePackage = ServicePackage;
26
34
  __decorate([
@@ -35,16 +43,48 @@ __decorate([
35
43
  (0, typegoose_1.prop)({ required: true, ref: () => service_category_model_1.ServiceCategory }),
36
44
  __metadata("design:type", Object)
37
45
  ], ServicePackage.prototype, "category", void 0);
46
+ __decorate([
47
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 1 }),
48
+ __metadata("design:type", Number)
49
+ ], ServicePackage.prototype, "price", void 0);
50
+ __decorate([
51
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 1 }),
52
+ __metadata("design:type", Number)
53
+ ], ServicePackage.prototype, "secondaryPrice", void 0);
54
+ __decorate([
55
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 0 }),
56
+ __metadata("design:type", Number)
57
+ ], ServicePackage.prototype, "duration", void 0);
58
+ __decorate([
59
+ (0, typegoose_1.prop)({ required: true, type: Number, min: 1 }),
60
+ __metadata("design:type", Number)
61
+ ], ServicePackage.prototype, "numberOfProfessionals", void 0);
62
+ __decorate([
63
+ (0, typegoose_1.prop)({ type: String, trim: true }),
64
+ __metadata("design:type", String)
65
+ ], ServicePackage.prototype, "description", void 0);
38
66
  __decorate([
39
67
  (0, typegoose_1.prop)({ type: String }),
40
68
  __metadata("design:type", String)
41
69
  ], ServicePackage.prototype, "image", void 0);
70
+ __decorate([
71
+ (0, typegoose_1.prop)({ ref: () => ServicePackage, default: [], type: [String] }),
72
+ __metadata("design:type", Array)
73
+ ], ServicePackage.prototype, "addons", void 0);
42
74
  __decorate([
43
75
  (0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
44
76
  __metadata("design:type", String)
45
77
  ], ServicePackage.prototype, "status", void 0);
78
+ __decorate([
79
+ (0, typegoose_1.prop)({ type: Boolean, default: false }),
80
+ __metadata("design:type", Boolean)
81
+ ], ServicePackage.prototype, "includeMaterials", void 0);
82
+ __decorate([
83
+ (0, typegoose_1.prop)({ type: Number, default: 0, min: 0 }),
84
+ __metadata("design:type", Number)
85
+ ], ServicePackage.prototype, "materialsCost", void 0);
46
86
  exports.ServicePackage = ServicePackage = __decorate([
47
- (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'servicePackages' } }),
87
+ (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'servicePackages', timestamps: true } }),
48
88
  (0, typegoose_1.Index)({ name: 1, vendor: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })
49
89
  ], ServicePackage);
50
90
  //# sourceMappingURL=service-package.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAA0D;AAC1D,iDAAwC;AACxC,qEAA2D;AAOpD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGX,MAAM,CAAe;IAGrB,QAAQ,CAAwB;IAGnC,KAAK,CAAU;IAGf,MAAM,CAAU;CACvB,CAAA;AAfY,wCAAc;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;4CAC7C;AAGX;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;8CAChB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,wCAAe,EAAE,CAAC;;gDACd;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;8CACtC;yBAdX,cAAc;IAL1B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,CAAC;IAClE,IAAA,iBAAK,EACL,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EACtB,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC9D;GACY,cAAc,CAe1B","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Service, Status } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages' } })\n@Index(\n\t{ name: 1, vendor: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\nexport class ServicePackage extends TimeStamps {\n\t@prop({ required: true, type: String, trim: true, maxlength: 20 })\n\tpublic name!: string;\n\n @prop({ required: true, ref: () => Vendor })\n public vendor!: Ref<Vendor>;\n\n @prop({ required: true, ref: () => ServiceCategory })\n public category!: Ref<ServiceCategory>;\n\n\t@prop({ type: String })\n\tpublic image?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n}\n"]}
1
+ {"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,qEAA2D;AAOpD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEnC,IAAI,CAAU;IAGd,MAAM,CAAe;IAGrB,QAAQ,CAAwB;IAGhC,KAAK,CAAU;IAGf,cAAc,CAAU;IAGxB,QAAQ,CAAU;IAGlB,qBAAqB,CAAU;IAG/B,WAAW,CAAU;IAGrB,KAAK,CAAU;IAGf,MAAM,CAAyB;IAG/B,MAAM,CAAU;IAGhB,gBAAgB,CAAW;IAG3B,aAAa,CAAU;CACjC,CAAA;AAvCY,wCAAc;AAEhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;;4CAC7C;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAM,EAAE,CAAC;;8CAChB;AAGrB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,wCAAe,EAAE,CAAC;;gDACd;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;6CACzB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE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AAE,SAAS,EAAE,IAAI,EAAE,EAAE,CACjE;GACY,cAAc,CAuC1B","sourcesContent":["import { Index, modelOptions, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages', timestamps: true } })\n@Index(\n { name: 1, vendor: 1 },\n { unique: true, partialFilterExpression: { deletedAt: null } }\n)\nexport class ServicePackage extends TimeStamps {\n @prop({ required: true, type: String, trim: true, maxlength: 20 })\n public name!: string;\n\n @prop({ required: true, ref: () => Vendor })\n public vendor!: Ref<Vendor>;\n\n @prop({ required: true, ref: () => ServiceCategory })\n public category!: Ref<ServiceCategory>;\n\n @prop({ required: true, type: Number, min: 1 })\n public price!: number;\n\n @prop({ required: true, type: Number, min: 1 })\n public secondaryPrice!: number;\n\n @prop({ required: true, type: Number, min: 0 })\n public duration!: number;\n\n @prop({ required: true, type: Number, min: 1 })\n public numberOfProfessionals!: number;\n\n @prop({ type: String, trim: true })\n public description?: string;\n\n @prop({ type: String })\n public image?: string;\n\n @prop({ ref: () => ServicePackage, default: [], type: [String] })\n public addons?: Ref<ServicePackage>[];\n\n @prop({ type: String, enum: Status, default: Status.ACTIVE })\n public status?: Status;\n\n @prop({ type: Boolean, default: false })\n public includeMaterials!: boolean;\n\n @prop({ type: Number, default: 0, min: 0 })\n public materialsCost?: number;\n}\n\n"]}
@@ -0,0 +1,13 @@
1
+ import { Ref } from "@typegoose/typegoose";
2
+ import { TimeStamps } from "@typegoose/typegoose/lib/defaultClasses";
3
+ import { Vendor } from "./vendor.model";
4
+ import { VendorRole } from "../../../utilities/enum";
5
+ import { ServiceParent } from "./service-parent.model";
6
+ export declare class VendorAccessControl extends TimeStamps {
7
+ name: string;
8
+ email: string;
9
+ password: string;
10
+ parent?: Ref<ServiceParent>;
11
+ vendors?: Ref<Vendor>[];
12
+ role: VendorRole;
13
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.VendorAccessControl = void 0;
13
+ const typegoose_1 = require("@typegoose/typegoose");
14
+ const defaultClasses_1 = require("@typegoose/typegoose/lib/defaultClasses");
15
+ const vendor_model_1 = require("./vendor.model");
16
+ const enum_1 = require("../../../utilities/enum");
17
+ const password_1 = require("../../../utilities/common/password");
18
+ const service_parent_model_1 = require("./service-parent.model");
19
+ let VendorAccessControl = class VendorAccessControl extends defaultClasses_1.TimeStamps {
20
+ name;
21
+ email;
22
+ password;
23
+ parent;
24
+ vendors;
25
+ role;
26
+ };
27
+ exports.VendorAccessControl = VendorAccessControl;
28
+ __decorate([
29
+ (0, typegoose_1.prop)({ required: true, type: String, maxlength: 50 }),
30
+ __metadata("design:type", String)
31
+ ], VendorAccessControl.prototype, "name", void 0);
32
+ __decorate([
33
+ (0, typegoose_1.prop)({ required: true, type: String }),
34
+ __metadata("design:type", String)
35
+ ], VendorAccessControl.prototype, "email", void 0);
36
+ __decorate([
37
+ (0, typegoose_1.prop)({ required: true, type: String, minlength: 8 }),
38
+ __metadata("design:type", String)
39
+ ], VendorAccessControl.prototype, "password", void 0);
40
+ __decorate([
41
+ (0, typegoose_1.prop)({ required: true, ref: () => service_parent_model_1.ServiceParent }),
42
+ __metadata("design:type", Object)
43
+ ], VendorAccessControl.prototype, "parent", void 0);
44
+ __decorate([
45
+ (0, typegoose_1.prop)({ ref: () => vendor_model_1.Vendor, default: [] }),
46
+ __metadata("design:type", Array)
47
+ ], VendorAccessControl.prototype, "vendors", void 0);
48
+ __decorate([
49
+ (0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.VendorRole }),
50
+ __metadata("design:type", String)
51
+ ], VendorAccessControl.prototype, "role", void 0);
52
+ exports.VendorAccessControl = VendorAccessControl = __decorate([
53
+ (0, typegoose_1.pre)('save', async function (next) {
54
+ if (this.isModified('password')) {
55
+ this.password = await (0, password_1.hashPassword)(this.password);
56
+ }
57
+ next();
58
+ }),
59
+ (0, typegoose_1.pre)('findOneAndUpdate', async function (next) {
60
+ const update = this.getUpdate();
61
+ if (update?.password) {
62
+ update.password = await (0, password_1.hashPassword)(update.password);
63
+ this.setUpdate(update);
64
+ }
65
+ next();
66
+ }),
67
+ (0, typegoose_1.index)({ email: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } }),
68
+ (0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'vendorAccessControls' } })
69
+ ], VendorAccessControl);
70
+ //# sourceMappingURL=vendor-access-control.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendor-access-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/vendor-access-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,iDAAwC;AACxC,kDAAqD;AACrD,iEAAkE;AAElE,iEAAuD;AAkBhD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,2BAAU;IAExC,IAAI,CAAS;IAGb,KAAK,CAAS;IAGd,QAAQ,CAAS;IAGjB,MAAM,CAAqB;IAG3B,OAAO,CAAgB;IAGvB,IAAI,CAAa;CAC3B,CAAA;AAlBY,kDAAmB;AAErB;IADN,IAAA,gBAAI,EA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AAC,MAAM,CAAC,CAAA;QAC1B,CAAC;QACD,IAAI,EAAE,CAAA;IACV,CAAC,CAAC;IACD,IAAA,iBAAK,EAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAC,CAAC;IAClF,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,sBAAsB,EAAC,EAAC,CAAC;GACzD,mBAAmB,CAkB/B","sourcesContent":["import { index, modelOptions, pre, prop, Ref } from \"@typegoose/typegoose\";\nimport { TimeStamps } from \"@typegoose/typegoose/lib/defaultClasses\";\nimport { Vendor } from \"./vendor.model\";\nimport { VendorRole } from \"../../../utilities/enum\";\nimport { hashPassword } from \"../../../utilities/common/password\";\nimport { Query } from \"mongoose\";\nimport { ServiceParent } from \"./service-parent.model\";\n\n@pre<VendorAccessControl>('save', async function (next) {\n if (this.isModified('password')) {\n this.password = await hashPassword(this.password)\n }\n next()\n})\n@pre<Query<any, VendorAccessControl>>('findOneAndUpdate', async function (next) {\n const update = this.getUpdate() as Record<string, any>\n if(update?.password) {\n update.password = await hashPassword(update.password)\n this.setUpdate(update)\n }\n next()\n})\n@index({ email: 1 }, { unique: true, partialFilterExpression: { deletedAt: null }})\n@modelOptions({ schemaOptions: { collection: 'vendorAccessControls'}})\nexport class VendorAccessControl extends TimeStamps {\n @prop({ required: true, type: String, maxlength: 50})\n public name!: string\n\n @prop({ required: true, type: String })\n public email!: string\n\n @prop({ required: true, type: String, minlength: 8 })\n public password!: string\n\n @prop({ required: true, ref: () => ServiceParent })\n public parent?: Ref<ServiceParent>\n\n @prop({ ref: () => Vendor, default: []})\n public vendors?: Ref<Vendor>[]\n\n @prop({ required: true, type: String, enum: VendorRole }) \n public role!: VendorRole\n}"]}
@@ -0,0 +1,11 @@
1
+ import { ConnectionInfo } from '../../utilities/connection.types';
2
+ export declare class ConnectionStore {
3
+ private connections;
4
+ private entityConnections;
5
+ add(contextId: string, info: ConnectionInfo): void;
6
+ remove(contextId: string): void;
7
+ getByContext(contextId: string): ConnectionInfo | undefined;
8
+ getContextsByClientId(clientIdStr: string): string[];
9
+ getAll(): Map<string, ConnectionInfo>;
10
+ clear(): void;
11
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConnectionStore = void 0;
4
+ class ConnectionStore {
5
+ connections = new Map();
6
+ entityConnections = new Map();
7
+ add(contextId, info) {
8
+ this.connections.set(contextId, info);
9
+ const clientId = info.clientId.toString();
10
+ if (!this.entityConnections.has(clientId)) {
11
+ this.entityConnections.set(clientId, []);
12
+ }
13
+ const contexts = this.entityConnections.get(clientId);
14
+ if (!contexts.includes(contextId))
15
+ contexts.push(contextId);
16
+ }
17
+ remove(contextId) {
18
+ const info = this.connections.get(contextId);
19
+ if (!info)
20
+ return;
21
+ const clientId = info.clientId.toString();
22
+ this.connections.delete(contextId);
23
+ const updated = (this.entityConnections.get(clientId) || []).filter(id => id !== contextId);
24
+ if (updated.length === 0) {
25
+ this.entityConnections.delete(clientId);
26
+ }
27
+ else {
28
+ this.entityConnections.set(clientId, updated);
29
+ }
30
+ }
31
+ getByContext(contextId) {
32
+ return this.connections.get(contextId);
33
+ }
34
+ getContextsByClientId(clientIdStr) {
35
+ return this.entityConnections.get(clientIdStr) || [];
36
+ }
37
+ getAll() {
38
+ return new Map(this.connections);
39
+ }
40
+ clear() {
41
+ this.connections.clear();
42
+ this.entityConnections.clear();
43
+ }
44
+ }
45
+ exports.ConnectionStore = ConnectionStore;
46
+ //# sourceMappingURL=connection.store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.store.js","sourceRoot":"/","sources":["libraries/socket-manager/connection.store.ts"],"names":[],"mappings":";;;AAEA,MAAa,eAAe;IACnB,WAAW,GAAgC,IAAI,GAAG,EAAE,CAAC;IACrD,iBAAiB,GAA0B,IAAI,GAAG,EA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AC/C,CAAC;IACF,CAAC;IAED,YAAY,CAAC,SAAiB;QAC7B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,qBAAqB,CAAC,WAAmB;QACxC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACtD,CAAC;IAED,MAAM;QACL,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACD;AA/CD,0CA+CC","sourcesContent":["import { ConnectionInfo } from '../../utilities/connection.types';\n\nexport class ConnectionStore {\n\tprivate connections: Map<string, ConnectionInfo> = new Map();\n\tprivate entityConnections: Map<string, string[]> = new Map();\n\n\tadd(contextId: string, info: ConnectionInfo) {\n\t\tthis.connections.set(contextId, info);\n\n\t\tconst clientId = info.clientId.toString();\n\t\tif (!this.entityConnections.has(clientId)) {\n\t\t\tthis.entityConnections.set(clientId, []);\n\t\t}\n\n\t\tconst contexts = this.entityConnections.get(clientId)!;\n\t\tif (!contexts.includes(contextId)) contexts.push(contextId);\n\t}\n\n\tremove(contextId: string): void {\n\t\tconst info = this.connections.get(contextId);\n\t\tif (!info) return;\n\n\t\tconst clientId = info.clientId.toString();\n\t\tthis.connections.delete(contextId);\n\n\t\tconst updated = (this.entityConnections.get(clientId) || []).filter(id => id !== contextId);\n\t\tif (updated.length === 0) {\n\t\t\tthis.entityConnections.delete(clientId);\n\t\t} else {\n\t\t\tthis.entityConnections.set(clientId, updated);\n\t\t}\n\t}\n\n\tgetByContext(contextId: string): ConnectionInfo | undefined {\n\t\treturn this.connections.get(contextId);\n\t}\n\n\tgetContextsByClientId(clientIdStr: string): string[] {\n\t\treturn this.entityConnections.get(clientIdStr) || [];\n\t}\n\n\tgetAll(): Map<string, ConnectionInfo> {\n\t\treturn new Map(this.connections);\n\t}\n\n\tclear(): void {\n\t\tthis.connections.clear();\n\t\tthis.entityConnections.clear();\n\t}\n}\n"]}
@@ -0,0 +1 @@
1
+ export * from './socket-manager.service';
@@ -0,0 +1,18 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./socket-manager.service"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/socket-manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC","sourcesContent":["export * from './socket-manager.service';\n"]}
@@ -0,0 +1,23 @@
1
+ import { ConnectionStore } from './connection.store';
2
+ import { mongoose } from '@typegoose/typegoose';
3
+ import { UserRef } from '../../utilities/enum';
4
+ import { ConnectionInfo } from '../../utilities/connection.types';
5
+ import { Observer } from '@trpc/server/observable';
6
+ export declare class SocketManager {
7
+ private readonly store;
8
+ private readonly instanceId;
9
+ constructor(store: ConnectionStore);
10
+ subscribeUser(userId: mongoose.Types.ObjectId, userType: UserRef, emit: Observer<unknown, unknown>): {
11
+ cleanup: () => void;
12
+ };
13
+ private addConnection;
14
+ private removeConnection;
15
+ sendToClient(clientIds: mongoose.Types.ObjectId[], event: string, data: any): Promise<{
16
+ successCount: number;
17
+ failedClientIds: string[];
18
+ }>;
19
+ getAllConnections(): Map<string, ConnectionInfo>;
20
+ getInstanceId(): string;
21
+ cleanup(): Promise<void>;
22
+ }
23
+ export declare const socketManager: SocketManager;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.socketManager = exports.SocketManager = void 0;
16
+ const typedi_1 = require("typedi");
17
+ const connection_store_1 = require("./connection.store");
18
+ let SocketManager = class SocketManager {
19
+ store;
20
+ instanceId = `instance-${process.pid}-${Date.now()}`;
21
+ constructor(store) {
22
+ this.store = store;
23
+ }
24
+ subscribeUser(userId, userType, emit) {
25
+ const contextId = `${userId}-${Date.now()}-${Math.random()}`;
26
+ this.addConnection(contextId, userId, userType, emit.next.bind(emit));
27
+ return {
28
+ cleanup: () => {
29
+ this.removeConnection(contextId);
30
+ },
31
+ };
32
+ }
33
+ addConnection(contextId, clientId, entityType, emitter) {
34
+ this.store.remove(contextId);
35
+ this.store.add(contextId, {
36
+ clientId,
37
+ entityType,
38
+ emitter,
39
+ connectedAt: new Date(),
40
+ instanceId: this.instanceId,
41
+ });
42
+ }
43
+ removeConnection(contextId) {
44
+ this.store.remove(contextId);
45
+ }
46
+ async sendToClient(clientIds, event, data) {
47
+ let successCount = 0;
48
+ const failedClientIds = [];
49
+ const message = {
50
+ type: event,
51
+ data,
52
+ timestamp: new Date().toISOString(),
53
+ };
54
+ for (const clientId of clientIds) {
55
+ const clientIdStr = clientId.toString();
56
+ const contexts = this.store.getContextsByClientId(clientIdStr);
57
+ let sent = false;
58
+ for (const ctx of contexts) {
59
+ const connection = this.store.getByContext(ctx);
60
+ if (connection && typeof connection.emitter === 'function') {
61
+ try {
62
+ connection.emitter(message);
63
+ sent = true;
64
+ }
65
+ catch {
66
+ this.store.remove(ctx);
67
+ }
68
+ }
69
+ }
70
+ if (sent)
71
+ successCount++;
72
+ else
73
+ failedClientIds.push(clientIdStr);
74
+ }
75
+ return { successCount, failedClientIds };
76
+ }
77
+ getAllConnections() {
78
+ return this.store.getAll();
79
+ }
80
+ getInstanceId() {
81
+ return this.instanceId;
82
+ }
83
+ async cleanup() {
84
+ this.store.clear();
85
+ }
86
+ };
87
+ exports.SocketManager = SocketManager;
88
+ exports.SocketManager = SocketManager = __decorate([
89
+ (0, typedi_1.Service)(),
90
+ __param(0, (0, typedi_1.Inject)(() => connection_store_1.ConnectionStore)),
91
+ __metadata("design:paramtypes", [connection_store_1.ConnectionStore])
92
+ ], SocketManager);
93
+ exports.socketManager = typedi_1.Container.get(SocketManager);
94
+ //# sourceMappingURL=socket-manager.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socket-manager.service.js","sourceRoot":"/","sources":["libraries/socket-manager/socket-manager.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAoD;AACpD,yDAAqD;AAO9C,IAAM,aAAa,GAAnB,MAAM,aAAa;IACR,KAAK,CAAkB;IACvB,UAAU,GAAG,YAAY,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;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{ Service, Inject, Container } from 'typedi';\nimport { ConnectionStore } from './connection.store';\nimport { mongoose } from '@typegoose/typegoose';\nimport { UserRef } from '../../utilities/enum';\nimport { ConnectionInfo } from '../../utilities/connection.types';\nimport { Observer } from '@trpc/server/observable';\n\n@Service()\nexport class SocketManager {\n\tprivate readonly store: ConnectionStore;\n\tprivate readonly instanceId = `instance-${process.pid}-${Date.now()}`;\n\n\tconstructor(@Inject(() => ConnectionStore) store: ConnectionStore) {\n\t\tthis.store = store;\n\t}\n\n\tpublic subscribeUser(\n\t\tuserId: mongoose.Types.ObjectId,\n\t\tuserType: UserRef,\n\t\temit: Observer<unknown, unknown>\n\t): { cleanup: () => void } {\n\t\tconst contextId = `${userId}-${Date.now()}-${Math.random()}`;\n\t\tthis.addConnection(contextId, userId, userType, emit.next.bind(emit));\n\n\t\treturn {\n\t\t\tcleanup: () => {\n\t\t\t\tthis.removeConnection(contextId);\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate addConnection(\n\t\tcontextId: string,\n\t\tclientId: mongoose.Types.ObjectId,\n\t\tentityType: UserRef,\n\t\temitter: (data: any) => void\n\t): void {\n\t\tthis.store.remove(contextId);\n\t\tthis.store.add(contextId, {\n\t\t\tclientId,\n\t\t\tentityType,\n\t\t\temitter,\n\t\t\tconnectedAt: new Date(),\n\t\t\tinstanceId: this.instanceId,\n\t\t});\n\t}\n\n\tprivate removeConnection(contextId: string): void {\n\t\tthis.store.remove(contextId);\n\t}\n\n\tpublic async sendToClient(\n\t\tclientIds: mongoose.Types.ObjectId[],\n\t\tevent: string,\n\t\tdata: any\n\t): Promise<{ successCount: number; failedClientIds: string[] }> {\n\t\tlet successCount = 0;\n\t\tconst failedClientIds: string[] = [];\n\n\t\tconst message = {\n\t\t\ttype: event,\n\t\t\tdata,\n\t\t\ttimestamp: new Date().toISOString(),\n\t\t};\n\n\t\tfor (const clientId of clientIds) {\n\t\t\tconst clientIdStr = clientId.toString();\n\t\t\tconst contexts = this.store.getContextsByClientId(clientIdStr);\n\n\t\t\tlet sent = false;\n\t\t\tfor (const ctx of contexts) {\n\t\t\t\tconst connection = this.store.getByContext(ctx);\n\t\t\t\tif (connection && typeof connection.emitter === 'function') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconnection.emitter(message);\n\t\t\t\t\t\tsent = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthis.store.remove(ctx);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (sent) successCount++;\n\t\t\telse failedClientIds.push(clientIdStr);\n\t\t}\n\n\t\treturn { successCount, failedClientIds };\n\t}\n\n\tpublic getAllConnections(): Map<string, ConnectionInfo> {\n\t\treturn this.store.getAll();\n\t}\n\n\tpublic getInstanceId(): string {\n\t\treturn this.instanceId;\n\t}\n\n\tpublic async cleanup(): Promise<void> {\n\t\tthis.store.clear();\n\t}\n}\n\nexport const socketManager = Container.get(SocketManager);\n"]}
@@ -26,3 +26,4 @@ export declare const createLyxaWsContext: (opts: CreateWSSContextFnOptions) => P
26
26
  res: import("ws").WebSocket;
27
27
  }>;
28
28
  export type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;
29
+ export type LyxaWSContext = Awaited<ReturnType<typeof createLyxaWsContext>>;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"/","sources":["libraries/trpc/context.ts"],"names":[],"mappings":";;;AAqBO,MAAM,iBAAiB,GAAG,KAAK,EACrC,IAA8B,EAC0B,EAAE;IAC1D,OAAO;QACN,GAAG,IAAI;QACP,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;KACnB,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEK,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAA+B,EAAE,EAAE;IAC5E,OAAO;QACN,GAAG,IAAI;QACP,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;KACnB,CAAC;AACH,CAAC,CAAC;AATW,QAAA,mBAAmB,uBAS9B","sourcesContent":["import { CreateHTTPContextOptions } from '@trpc/server/dist/adapters/standalone';\nimport type { CreateWSSContextFnOptions } from '@trpc/server/adapters/ws';\nimport { AuthEntityType } from '../auth';\nimport jwt from 'jsonwebtoken';\nimport { TokenType } from '../auth';\nimport { request } from 'http';\n\nexport interface EntityContext extends jwt.JwtPayload {\n\tid: string;\n\ttype: AuthEntityType;\n\tparameters: Record<string, unknown>;\n}\n\nexport interface LyxaContextParams {\n\tentity?: EntityContext;\n\trequestId?: string;\n\ttokenType?: TokenType;\n\tusedRefreshToken?: boolean;\n\ttokenRenewed?: boolean;\n}\n\nexport const createLyxaContext = async (\n\topts: CreateHTTPContextOptions\n): Promise<CreateHTTPContextOptions & LyxaContextParams> => {\n\treturn {\n\t\t...opts,\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t};\n};\n\nexport const createLyxaWsContext = async (opts: CreateWSSContextFnOptions) => {\n\treturn {\n\t\t...opts,\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t};\n};\n\nexport type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"/","sources":["libraries/trpc/context.ts"],"names":[],"mappings":";;;AAqBO,MAAM,iBAAiB,GAAG,KAAK,EACrC,IAA8B,EAC0B,EAAE;IAC1D,OAAO;QACN,GAAG,IAAI;QACP,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;KACnB,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEK,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAA+B,EAAE,EAAE;IAC5E,OAAO;QACN,GAAG,IAAI;QACP,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;KACnB,CAAC;AACH,CAAC,CAAC;AATW,QAAA,mBAAmB,uBAS9B","sourcesContent":["import { CreateHTTPContextOptions } from '@trpc/server/dist/adapters/standalone';\nimport type { CreateWSSContextFnOptions } from '@trpc/server/adapters/ws';\nimport { AuthEntityType } from '../auth';\nimport jwt from 'jsonwebtoken';\nimport { TokenType } from '../auth';\nimport { request } from 'http';\n\nexport interface EntityContext extends jwt.JwtPayload {\n\tid: string;\n\ttype: AuthEntityType;\n\tparameters: Record<string, unknown>;\n}\n\nexport interface LyxaContextParams {\n\tentity?: EntityContext;\n\trequestId?: string;\n\ttokenType?: TokenType;\n\tusedRefreshToken?: boolean;\n\ttokenRenewed?: boolean;\n}\n\nexport const createLyxaContext = async (\n\topts: CreateHTTPContextOptions\n): Promise<CreateHTTPContextOptions & LyxaContextParams> => {\n\treturn {\n\t\t...opts,\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t};\n};\n\nexport const createLyxaWsContext = async (opts: CreateWSSContextFnOptions) => {\n\treturn {\n\t\t...opts,\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t};\n};\n\nexport type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;\nexport type LyxaWSContext = Awaited<ReturnType<typeof createLyxaWsContext>>;\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.0.154
25
+ Version: 1.0.156
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.0.154",
3
+ "version": "1.0.156",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -274,6 +274,14 @@ export declare enum ShopRole {
274
274
  SHOP_MANAGER = "shop_manager",
275
275
  SHOP_ORDER_MANAGER = "shop_order_manager"
276
276
  }
277
+ export declare enum VendorRole {
278
+ PARENT = "parent",
279
+ PARENT_MANAGER = "parent_manager",
280
+ PARENT_ORDER_MANAGER = "parent_order_manager",
281
+ VENDOR = "vendor",
282
+ VENDOR_MANAGER = "vendor_manager",
283
+ VENDOR_ORDER_MANAGER = "vendor_order_manager"
284
+ }
277
285
  export declare enum BannerClickType {
278
286
  LINK = "link",
279
287
  SHOP = "shop",
@@ -565,19 +573,22 @@ export declare enum TicketType {
565
573
  }
566
574
  export declare enum TicketStatus {
567
575
  PENDING = "pending",
568
- ONGOING = "ongoing",
569
- RESOLVED = "resolved"
576
+ RESOLVED = "resolved",
577
+ ONGOING = "ongoing"
570
578
  }
571
579
  export declare enum UserRef {
572
- User = "User",
573
- Admin = "Admin",
574
- Shop = "Shop",
575
- Rider = "Rider"
580
+ USER = "User",
581
+ ADMIN = "Admin",
582
+ SHOP = "Shop",
583
+ RIDER = "Rider"
576
584
  }
577
585
  export declare enum ChatroomType {
578
- TICKET = "TICKET",
579
- DIRECT = "DIRECT",
580
- ORDER_CHAT = "ORDER_CHAT"
586
+ TICKET = "ticket",
587
+ DIRECT = "direct"
588
+ }
589
+ export declare enum SocketEventType {
590
+ MESSAGE_RECEIVED = "message.received",
591
+ TICKET_NOTIFICATION = "ticket.notification"
581
592
  }
582
593
  export declare enum Service {
583
594
  LAUNDRY = "Laundry",
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CardType = exports.PaymentPreference = exports.CartStatus = 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.OnlineStatus = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.PriceOption = exports.ProductType = exports.CoreAuthIdentityType = exports.UserAppSectionItemType = exports.UserAppSectionType = exports.AdminLogsUpdatedFieldsType = 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.GlobalItemType = exports.ItemType = exports.Status = exports.AccountType = void 0;
4
- exports.Service = exports.ChatroomType = exports.UserRef = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.UrgentOrderReason = exports.LateOrderReason = exports.OrderCanceledBy = exports.LogUser = exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = exports.SettlementType = exports.MediaType = exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.LiveStatus = exports.AreebaCardStatus = exports.CardUserType = void 0;
3
+ exports.PaymentPreference = exports.CartStatus = 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.VendorRole = exports.ShopRole = exports.OnlineStatus = exports.ShopOnlineStatus = exports.ChargeType = exports.ClickType = exports.NotificationAccountType = exports.DishCategory = exports.ProductDietaryType = exports.PriceOption = exports.ProductType = exports.CoreAuthIdentityType = exports.UserAppSectionItemType = exports.UserAppSectionType = exports.AdminLogsUpdatedFieldsType = 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.GlobalItemType = exports.ItemType = exports.Status = exports.AccountType = void 0;
4
+ exports.Service = exports.SocketEventType = exports.ChatroomType = exports.UserRef = exports.TicketStatus = exports.TicketType = exports.RewardedToTypeEnum = exports.ReplacementType = exports.ReplacementReason = exports.UrgentOrderReason = exports.LateOrderReason = exports.OrderCanceledBy = exports.LogUser = exports.PayoutStatus = exports.PayoutType = exports.AddRemoveCreditAccountType = exports.SettingsReasonStatus = exports.CancellationReasonTypeEnum = exports.SupportReasonTypeEnum = exports.PlusSettingsPackageType = exports.AddRemoveCreditSettlementType = exports.SettlementType = exports.MediaType = exports.WorkingHourSettingsType = exports.ZoneGeometryType = exports.RiderAssignmentStatus = exports.CourierServiceType = exports.DeliveryStatus = exports.CourierOrderPaymentFrom = exports.CourierOrderStatus = exports.RegularOrderStatus = exports.OrderType = exports.Language = exports.RiderBagSize = exports.RiderType = exports.ShiftType = exports.CreatedBy = exports.LiveStatus = exports.AreebaCardStatus = exports.CardUserType = exports.CardType = void 0;
5
5
  var AccountType;
6
6
  (function (AccountType) {
7
7
  AccountType["USER"] = "user";
@@ -308,6 +308,15 @@ var ShopRole;
308
308
  ShopRole["SHOP_MANAGER"] = "shop_manager";
309
309
  ShopRole["SHOP_ORDER_MANAGER"] = "shop_order_manager";
310
310
  })(ShopRole || (exports.ShopRole = ShopRole = {}));
311
+ var VendorRole;
312
+ (function (VendorRole) {
313
+ VendorRole["PARENT"] = "parent";
314
+ VendorRole["PARENT_MANAGER"] = "parent_manager";
315
+ VendorRole["PARENT_ORDER_MANAGER"] = "parent_order_manager";
316
+ VendorRole["VENDOR"] = "vendor";
317
+ VendorRole["VENDOR_MANAGER"] = "vendor_manager";
318
+ VendorRole["VENDOR_ORDER_MANAGER"] = "vendor_order_manager";
319
+ })(VendorRole || (exports.VendorRole = VendorRole = {}));
311
320
  var BannerClickType;
312
321
  (function (BannerClickType) {
313
322
  BannerClickType["LINK"] = "link";
@@ -655,22 +664,26 @@ var TicketType;
655
664
  var TicketStatus;
656
665
  (function (TicketStatus) {
657
666
  TicketStatus["PENDING"] = "pending";
658
- TicketStatus["ONGOING"] = "ongoing";
659
667
  TicketStatus["RESOLVED"] = "resolved";
668
+ TicketStatus["ONGOING"] = "ongoing";
660
669
  })(TicketStatus || (exports.TicketStatus = TicketStatus = {}));
661
670
  var UserRef;
662
671
  (function (UserRef) {
663
- UserRef["User"] = "User";
664
- UserRef["Admin"] = "Admin";
665
- UserRef["Shop"] = "Shop";
666
- UserRef["Rider"] = "Rider";
672
+ UserRef["USER"] = "User";
673
+ UserRef["ADMIN"] = "Admin";
674
+ UserRef["SHOP"] = "Shop";
675
+ UserRef["RIDER"] = "Rider";
667
676
  })(UserRef || (exports.UserRef = UserRef = {}));
668
677
  var ChatroomType;
669
678
  (function (ChatroomType) {
670
- ChatroomType["TICKET"] = "TICKET";
671
- ChatroomType["DIRECT"] = "DIRECT";
672
- ChatroomType["ORDER_CHAT"] = "ORDER_CHAT";
679
+ ChatroomType["TICKET"] = "ticket";
680
+ ChatroomType["DIRECT"] = "direct";
673
681
  })(ChatroomType || (exports.ChatroomType = ChatroomType = {}));
682
+ var SocketEventType;
683
+ (function (SocketEventType) {
684
+ SocketEventType["MESSAGE_RECEIVED"] = "message.received";
685
+ SocketEventType["TICKET_NOTIFICATION"] = "ticket.notification";
686
+ })(SocketEventType || (exports.SocketEventType = SocketEventType = {}));
674
687
  var Service;
675
688
  (function (Service) {
676
689
  Service["LAUNDRY"] = "Laundry";