@lyxa.ai/core 1.1.5 → 1.1.6
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/mongo/models/embedded/chat-participant.model.d.ts +2 -0
- package/dist/libraries/mongo/models/embedded/chat-participant.model.js +6 -0
- package/dist/libraries/mongo/models/embedded/chat-participant.model.js.map +1 -1
- package/dist/libraries/mongo/models/shared/entity-ref.model.d.ts +23 -0
- package/dist/libraries/mongo/models/shared/entity-ref.model.js +102 -0
- package/dist/libraries/mongo/models/shared/entity-ref.model.js.map +1 -0
- package/dist/libraries/mongo/models/user.model.d.ts +1 -1
- package/dist/libraries/trpc/middlewares/createSocketSubscriptionProcedure.d.ts +2 -2
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/types/utilities/validation/common-validation.d.ts +78 -2
- package/dist/types/utilities/validation/global-validation.d.ts +38 -14
- package/dist/utilities/validation/common-validation.d.ts +78 -2
- package/dist/utilities/validation/global-validation.d.ts +38 -14
- package/package.json +1 -1
|
@@ -5,9 +5,11 @@ import { Shop } from '../shop.model';
|
|
|
5
5
|
import { Rider } from '../rider.model';
|
|
6
6
|
import { UserRef } from '../../../../utilities/enum';
|
|
7
7
|
import { Message } from '../message.model';
|
|
8
|
+
import { EntityRef } from '../shared/entity-ref.model';
|
|
8
9
|
export declare class ChatParticipant {
|
|
9
10
|
ref: Ref<User | Admin | Shop | Rider>;
|
|
10
11
|
type: UserRef;
|
|
12
|
+
entity: EntityRef;
|
|
11
13
|
joinedAt?: Date;
|
|
12
14
|
lastReadAt?: Date;
|
|
13
15
|
isActive?: boolean;
|
|
@@ -13,9 +13,11 @@ exports.ChatParticipant = void 0;
|
|
|
13
13
|
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
14
|
const enum_1 = require("../../../../utilities/enum");
|
|
15
15
|
const message_model_1 = require("../message.model");
|
|
16
|
+
const entity_ref_model_1 = require("../shared/entity-ref.model");
|
|
16
17
|
class ChatParticipant {
|
|
17
18
|
ref;
|
|
18
19
|
type;
|
|
20
|
+
entity;
|
|
19
21
|
joinedAt;
|
|
20
22
|
lastReadAt;
|
|
21
23
|
isActive;
|
|
@@ -33,6 +35,10 @@ __decorate([
|
|
|
33
35
|
(0, typegoose_1.prop)({ required: true, enum: enum_1.UserRef }),
|
|
34
36
|
__metadata("design:type", String)
|
|
35
37
|
], ChatParticipant.prototype, "type", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typegoose_1.prop)({ required: true, type: () => entity_ref_model_1.EntityRef }),
|
|
40
|
+
__metadata("design:type", entity_ref_model_1.EntityRef)
|
|
41
|
+
], ChatParticipant.prototype, "entity", void 0);
|
|
36
42
|
__decorate([
|
|
37
43
|
(0, typegoose_1.prop)({ type: Date, default: () => new Date() }),
|
|
38
44
|
__metadata("design:type", Date)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/chat-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AAKjD,qDAAqD;AACrD,oDAA2C;
|
|
1
|
+
{"version":3,"file":"chat-participant.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/chat-participant.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AAKjD,qDAAqD;AACrD,oDAA2C;AAC3C,iEAAuD;AAEvD,MAAa,eAAe;IAE3B,GAAG,CAAoC;IAGvC,IAAI,CAAW;IAGf,MAAM,CAAa;IAGnB,QAAQ,CAAQ;IAGhB,UAAU,CAAQ;IAGlB,QAAQ,CAAW;IAGnB,eAAe,CAAgB;IAG/B,iBAAiB,CAAQ;IAGzB,WAAW,CAAU;IAGrB,MAAM,CAAQ;CACd;AA9BD,0CA8BC;AA5BA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;;4CACH;AAGvC;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;6CACzB;AAGf;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,4BAAS,EAAE,CAAC;8BACvC,4BAAS;+CAAC;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BACrC,IAAI;iDAAC;AAGhB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACR,IAAI;mDAAC;AAGlB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACpB;AAGnB;IADC,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,uBAAO,EAAE,CAAC;;wDACE;AAG/B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACD,IAAI;0DAAC;AAGzB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oDACd;AAGrB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACZ,IAAI;+CAAC","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { User } from '../user.model';\nimport { Admin } from '../admin.model';\nimport { Shop } from '../shop.model';\nimport { Rider } from '../rider.model';\nimport { UserRef } from '../../../../utilities/enum';\nimport { Message } from '../message.model';\nimport { EntityRef } from '../shared/entity-ref.model';\n\nexport class ChatParticipant {\n\t@prop({ required: true, refPath: 'type' })\n\tref!: Ref<User | Admin | Shop | Rider>;\n\n\t@prop({ required: true, enum: UserRef })\n\ttype!: UserRef;\n\n\t@prop({ required: true, type: () => EntityRef })\n\tentity!: EntityRef;\n\n\t@prop({ type: Date, default: () => new Date() })\n\tjoinedAt?: Date;\n\n\t@prop({ type: Date })\n\tlastReadAt?: Date;\n\n\t@prop({ type: Boolean, default: true })\n\tisActive?: boolean;\n\n\t@prop({ ref: () => Message })\n\tlastReadMessage?: Ref<Message>;\n\n\t@prop({ type: Date })\n\tlastReadMessageAt?: Date;\n\n\t@prop({ type: Number, default: 0 })\n\tunreadCount?: number;\n\n\t@prop({ type: Date })\n\tleftAt?: Date;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DocumentType, Ref } from '@typegoose/typegoose';
|
|
2
|
+
import { Admin } from '../admin.model';
|
|
3
|
+
import { Shop } from '../shop.model';
|
|
4
|
+
import { User } from '../user.model';
|
|
5
|
+
import { Rider } from '../rider.model';
|
|
6
|
+
import { UserRef } from '../../../../utilities/enum';
|
|
7
|
+
import { Types } from 'mongoose';
|
|
8
|
+
type RefModel = User | Admin | Shop | Rider;
|
|
9
|
+
export interface EntityData {
|
|
10
|
+
id: Types.ObjectId;
|
|
11
|
+
type: UserRef;
|
|
12
|
+
name: string;
|
|
13
|
+
profilePicture?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
phone?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class EntityRef {
|
|
18
|
+
ref: Ref<RefModel>;
|
|
19
|
+
type: UserRef;
|
|
20
|
+
getProfile(this: DocumentType<EntityRef>): Promise<EntityData | null>;
|
|
21
|
+
static mapToProfile(entity: DocumentType<RefModel>, type: UserRef): EntityData;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
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.EntityRef = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../../utilities/enum");
|
|
15
|
+
class EntityRef {
|
|
16
|
+
ref;
|
|
17
|
+
type;
|
|
18
|
+
async getProfile() {
|
|
19
|
+
if (!this.populated('ref')) {
|
|
20
|
+
await this.populate('ref');
|
|
21
|
+
}
|
|
22
|
+
const entity = this.ref;
|
|
23
|
+
if (!entity)
|
|
24
|
+
return null;
|
|
25
|
+
if (this.type === enum_1.UserRef.USER) {
|
|
26
|
+
const user = entity;
|
|
27
|
+
if (user.coreUser && !user.populated('coreUser')) {
|
|
28
|
+
await user.populate('coreUser');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (this.type === enum_1.UserRef.ADMIN) {
|
|
32
|
+
const admin = entity;
|
|
33
|
+
if (admin.accessControl && !admin.populated('accessControl')) {
|
|
34
|
+
await admin.populate('accessControl');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return EntityRef.mapToProfile(entity, this.type);
|
|
38
|
+
}
|
|
39
|
+
static mapToProfile(entity, type) {
|
|
40
|
+
const mappers = {
|
|
41
|
+
[enum_1.UserRef.USER]: (e) => ({
|
|
42
|
+
id: e._id,
|
|
43
|
+
name: e.coreUser?.name || 'Unknown User',
|
|
44
|
+
profilePicture: e.coreUser?.profilePhoto,
|
|
45
|
+
email: e.coreUser?.email,
|
|
46
|
+
phone: e.phoneNumber,
|
|
47
|
+
type: enum_1.UserRef.USER,
|
|
48
|
+
}),
|
|
49
|
+
[enum_1.UserRef.ADMIN]: (e) => ({
|
|
50
|
+
id: e._id,
|
|
51
|
+
name: e.name,
|
|
52
|
+
profilePicture: e.profilePhoto,
|
|
53
|
+
email: e.accessControl.email,
|
|
54
|
+
phone: e.phoneNumber,
|
|
55
|
+
type: enum_1.UserRef.ADMIN,
|
|
56
|
+
}),
|
|
57
|
+
[enum_1.UserRef.SHOP]: (e) => ({
|
|
58
|
+
id: e._id,
|
|
59
|
+
name: e.name,
|
|
60
|
+
profilePicture: e.logo,
|
|
61
|
+
email: e.email,
|
|
62
|
+
phone: e.phoneNumber,
|
|
63
|
+
type: enum_1.UserRef.SHOP,
|
|
64
|
+
}),
|
|
65
|
+
[enum_1.UserRef.RIDER]: (e) => ({
|
|
66
|
+
id: e._id,
|
|
67
|
+
name: e.name,
|
|
68
|
+
profilePicture: e.image,
|
|
69
|
+
email: e.email,
|
|
70
|
+
phone: e.number,
|
|
71
|
+
type: enum_1.UserRef.RIDER,
|
|
72
|
+
}),
|
|
73
|
+
[enum_1.UserRef.VENDOR]: (e) => ({
|
|
74
|
+
id: e._id,
|
|
75
|
+
name: e.name,
|
|
76
|
+
profilePicture: e.logo,
|
|
77
|
+
email: e.email,
|
|
78
|
+
phone: e.phoneNumber,
|
|
79
|
+
type: enum_1.UserRef.VENDOR,
|
|
80
|
+
}),
|
|
81
|
+
[enum_1.UserRef.PROFESSIONAL]: (e) => ({
|
|
82
|
+
id: e._id,
|
|
83
|
+
name: e.name,
|
|
84
|
+
profilePicture: e.image,
|
|
85
|
+
email: e.email,
|
|
86
|
+
phone: e.phoneNumber,
|
|
87
|
+
type: enum_1.UserRef.PROFESSIONAL,
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
return mappers[type](entity);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.EntityRef = EntityRef;
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typegoose_1.prop)({ required: true, refPath: 'type' }),
|
|
96
|
+
__metadata("design:type", Object)
|
|
97
|
+
], EntityRef.prototype, "ref", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typegoose_1.prop)({ required: true, enum: enum_1.UserRef }),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], EntityRef.prototype, "type", void 0);
|
|
102
|
+
//# sourceMappingURL=entity-ref.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-ref.model.js","sourceRoot":"/","sources":["libraries/mongo/models/shared/entity-ref.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA+D;AAM/D,qDAAqD;AAmBrD,MAAa,SAAS;IAErB,GAAG,CAAiB;IAGpB,IAAI,CAAW;IAEf,KAAK,CAAC,UAAU;QACf,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,GAA6B,CAAC;QAClD,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,IAAI,IAAI,CAAC,IAAI,KAAK,cAAO,CAAC,IAAI,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,MAA4B,CAAC;YAC1C,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClD,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;QACF,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,cAAO,CAAC,KAAK,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,MAA6B,CAAC;YAC5C,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC9D,MAAM,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;YACvC,CAAC;QACF,CAAC;QAED,OAAO,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,MAA8B,EAAE,IAAa;QAChE,MAAM,OAAO,GAA4C;YACxD,CAAC,cAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAA8B,EAAE,EAAE,CAAC,CAAC;gBACpD,EAAE,EAAE,CAAC,CAAC,GAAG;gBACT,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,IAAI,cAAc;gBACxC,cAAc,EAAE,CAAC,CAAC,QAAQ,EAAE,YAAY;gBACxC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,KAAK;gBACxB,KAAK,EAAE,CAAC,CAAC,WAAW;gBACpB,IAAI,EAAE,cAAO,CAAC,IAAI;aAClB,CAAC;YAEF,CAAC,cAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAA+B,EAAE,EAAE,CAAC,CAAC;gBACtD,EAAE,EAAE,CAAC,CAAC,GAAG;gBACT,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,cAAc,EAAE,CAAC,CAAC,YAAY;gBAC9B,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,KAAK;gBAC5B,KAAK,EAAE,CAAC,CAAC,WAAW;gBACpB,IAAI,EAAE,cAAO,CAAC,KAAK;aACnB,CAAC;YAEF,CAAC,cAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAqB,EAAE,EAAE,CAAC,CAAC;gBAC3C,EAAE,EAAE,CAAC,CAAC,GAAG;gBACT,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,cAAc,EAAE,CAAC,CAAC,IAAI;gBACtB,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC,WAAW;gBACpB,IAAI,EAAE,cAAO,CAAC,IAAI;aAClB,CAAC;YAEF,CAAC,cAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAsB,EAAE,EAAE,CAAC,CAAC;gBAC7C,EAAE,EAAE,CAAC,CAAC,GAAG;gBACT,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,cAAc,EAAE,CAAC,CAAC,KAAK;gBACvB,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC,MAAM;gBACf,IAAI,EAAE,cAAO,CAAC,KAAK;aACnB,CAAC;YAEF,CAAC,cAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAuB,EAAE,EAAE,CAAC,CAAC;gBAC/C,EAAE,EAAE,CAAC,CAAC,GAAG;gBACT,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,cAAc,EAAE,CAAC,CAAC,IAAI;gBACtB,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC,WAAW;gBACpB,IAAI,EAAE,cAAO,CAAC,MAAM;aACpB,CAAC;YAEF,CAAC,cAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAA6B,EAAE,EAAE,CAAC,CAAC;gBAC3D,EAAE,EAAE,CAAC,CAAC,GAAG;gBACT,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,cAAc,EAAE,CAAC,CAAC,KAAK;gBACvB,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC,WAAW;gBACpB,IAAI,EAAE,cAAO,CAAC,YAAY;aAC1B,CAAC;SACF,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAa,CAAC,CAAC;IACrC,CAAC;CACD;AA3FD,8BA2FC;AAzFA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;;sCACtB;AAGpB;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,cAAO,EAAE,CAAC;;uCACzB","sourcesContent":["import { DocumentType, prop, Ref } from '@typegoose/typegoose';\nimport { Admin } from '../admin.model';\nimport { Shop } from '../shop.model';\nimport { User } from '../user.model';\nimport { Rider } from '../rider.model';\nimport { CoreUser } from '../core-user.model';\nimport { UserRef } from '../../../../utilities/enum';\nimport { AdminAccessControl } from '../admin-access-control.model';\nimport { Vendor } from '../vendor.model';\nimport { Professional } from '../professional.model';\nimport { Types } from 'mongoose';\n\ntype RefModel = User | Admin | Shop | Rider;\ntype PopulatedUser = User & { coreUser: DocumentType<CoreUser> };\ntype PopulatedAdmin = Admin & { accessControl: DocumentType<AdminAccessControl> };\n\nexport interface EntityData {\n\tid: Types.ObjectId;\n\ttype: UserRef;\n\tname: string;\n\tprofilePicture?: string;\n\temail?: string;\n\tphone?: string;\n}\n\nexport class EntityRef {\n\t@prop({ required: true, refPath: 'type' })\n\tref!: Ref<RefModel>;\n\n\t@prop({ required: true, enum: UserRef })\n\ttype!: UserRef;\n\n\tasync getProfile(this: DocumentType<EntityRef>): Promise<EntityData | null> {\n\t\tif (!this.populated('ref')) {\n\t\t\tawait this.populate('ref');\n\t\t}\n\n\t\tconst entity = this.ref as DocumentType<RefModel>;\n\t\tif (!entity) return null;\n\n\t\tif (this.type === UserRef.USER) {\n\t\t\tconst user = entity as DocumentType<User>;\n\t\t\tif (user.coreUser && !user.populated('coreUser')) {\n\t\t\t\tawait user.populate('coreUser');\n\t\t\t}\n\t\t}\n\n\t\tif (this.type === UserRef.ADMIN) {\n\t\t\tconst admin = entity as DocumentType<Admin>;\n\t\t\tif (admin.accessControl && !admin.populated('accessControl')) {\n\t\t\t\tawait admin.populate('accessControl');\n\t\t\t}\n\t\t}\n\n\t\treturn EntityRef.mapToProfile(entity, this.type);\n\t}\n\n\tstatic mapToProfile(entity: DocumentType<RefModel>, type: UserRef): EntityData {\n\t\tconst mappers: Record<UserRef, (e: any) => EntityData> = {\n\t\t\t[UserRef.USER]: (e: DocumentType<PopulatedUser>) => ({\n\t\t\t\tid: e._id,\n\t\t\t\tname: e.coreUser?.name || 'Unknown User',\n\t\t\t\tprofilePicture: e.coreUser?.profilePhoto,\n\t\t\t\temail: e.coreUser?.email,\n\t\t\t\tphone: e.phoneNumber,\n\t\t\t\ttype: UserRef.USER,\n\t\t\t}),\n\n\t\t\t[UserRef.ADMIN]: (e: DocumentType<PopulatedAdmin>) => ({\n\t\t\t\tid: e._id,\n\t\t\t\tname: e.name,\n\t\t\t\tprofilePicture: e.profilePhoto,\n\t\t\t\temail: e.accessControl.email,\n\t\t\t\tphone: e.phoneNumber,\n\t\t\t\ttype: UserRef.ADMIN,\n\t\t\t}),\n\n\t\t\t[UserRef.SHOP]: (e: DocumentType<Shop>) => ({\n\t\t\t\tid: e._id,\n\t\t\t\tname: e.name,\n\t\t\t\tprofilePicture: e.logo,\n\t\t\t\temail: e.email,\n\t\t\t\tphone: e.phoneNumber,\n\t\t\t\ttype: UserRef.SHOP,\n\t\t\t}),\n\n\t\t\t[UserRef.RIDER]: (e: DocumentType<Rider>) => ({\n\t\t\t\tid: e._id,\n\t\t\t\tname: e.name,\n\t\t\t\tprofilePicture: e.image,\n\t\t\t\temail: e.email,\n\t\t\t\tphone: e.number,\n\t\t\t\ttype: UserRef.RIDER,\n\t\t\t}),\n\n\t\t\t[UserRef.VENDOR]: (e: DocumentType<Vendor>) => ({\n\t\t\t\tid: e._id,\n\t\t\t\tname: e.name,\n\t\t\t\tprofilePicture: e.logo,\n\t\t\t\temail: e.email,\n\t\t\t\tphone: e.phoneNumber,\n\t\t\t\ttype: UserRef.VENDOR,\n\t\t\t}),\n\n\t\t\t[UserRef.PROFESSIONAL]: (e: DocumentType<Professional>) => ({\n\t\t\t\tid: e._id,\n\t\t\t\tname: e.name,\n\t\t\t\tprofilePicture: e.image,\n\t\t\t\temail: e.email,\n\t\t\t\tphone: e.phoneNumber,\n\t\t\t\ttype: UserRef.PROFESSIONAL,\n\t\t\t}),\n\t\t};\n\n\t\treturn mappers[type](entity as any);\n\t}\n}\n"]}
|
|
@@ -31,7 +31,7 @@ export declare class User extends TimeStamps {
|
|
|
31
31
|
isPhoneVerified?: boolean;
|
|
32
32
|
onlineStatus?: OnlineStatus;
|
|
33
33
|
fcmTokens?: string[];
|
|
34
|
-
static updateWallet(this: ReturnModelType<typeof User>, userId: string, amount: number): Promise<(import("mongoose").Document<unknown, import("@typegoose/typegoose/lib/types").BeAnObject, User, import("@typegoose/typegoose/lib/types").BeAnyObject
|
|
34
|
+
static updateWallet(this: ReturnModelType<typeof User>, userId: string, amount: number): Promise<(import("mongoose").Document<unknown, import("@typegoose/typegoose/lib/types").BeAnObject, User, import("@typegoose/typegoose/lib/types").BeAnyObject> & Omit<User & {
|
|
35
35
|
_id: import("mongoose").Types.ObjectId;
|
|
36
36
|
} & {
|
|
37
37
|
__v: number;
|
|
@@ -8,7 +8,7 @@ export declare function createSocketSubscriptionProcedure<I extends ZodTypeAny,
|
|
|
8
8
|
outputSchema: O;
|
|
9
9
|
getId: (out: z.infer<O>) => string;
|
|
10
10
|
}): import("@trpc/server").TRPCSubscriptionProcedure<{
|
|
11
|
-
input: import("@trpc/server/dist/unstable-core-do-not-import.d-
|
|
12
|
-
output: AsyncIterable<import("@trpc/server/dist/unstable-core-do-not-import.d-
|
|
11
|
+
input: import("@trpc/server/dist/unstable-core-do-not-import.d-C6mFWtNG.cjs").inferParser<I>["in"] extends infer T ? T extends import("@trpc/server/dist/unstable-core-do-not-import.d-C6mFWtNG.cjs").inferParser<I>["in"] ? T extends import("@trpc/server").TRPCUnsetMarker ? void : T : never : never;
|
|
12
|
+
output: AsyncIterable<import("@trpc/server/dist/unstable-core-do-not-import.d-C6mFWtNG.cjs").TrackedData<any>, void, unknown>;
|
|
13
13
|
meta: object;
|
|
14
14
|
}>;
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -587,7 +587,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
587
587
|
totalPages: number;
|
|
588
588
|
} | undefined;
|
|
589
589
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
590
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
590
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
591
591
|
success: z.ZodBoolean;
|
|
592
592
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
593
593
|
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -625,7 +625,83 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
625
625
|
totalPages: number;
|
|
626
626
|
} | undefined;
|
|
627
627
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
628
|
-
}>
|
|
628
|
+
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
629
|
+
success: z.ZodBoolean;
|
|
630
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
631
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
632
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
633
|
+
page: z.ZodNumber;
|
|
634
|
+
size: z.ZodNumber;
|
|
635
|
+
totalElements: z.ZodNumber;
|
|
636
|
+
totalPages: z.ZodNumber;
|
|
637
|
+
}, "strip", z.ZodTypeAny, {
|
|
638
|
+
size: number;
|
|
639
|
+
page: number;
|
|
640
|
+
totalElements: number;
|
|
641
|
+
totalPages: number;
|
|
642
|
+
}, {
|
|
643
|
+
size: number;
|
|
644
|
+
page: number;
|
|
645
|
+
totalElements: number;
|
|
646
|
+
totalPages: number;
|
|
647
|
+
}>>;
|
|
648
|
+
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
649
|
+
}, "strip", z.ZodTypeAny, {
|
|
650
|
+
documents: T[];
|
|
651
|
+
metadata?: {
|
|
652
|
+
size: number;
|
|
653
|
+
page: number;
|
|
654
|
+
totalElements: number;
|
|
655
|
+
totalPages: number;
|
|
656
|
+
} | undefined;
|
|
657
|
+
}, {
|
|
658
|
+
documents: T[];
|
|
659
|
+
metadata?: {
|
|
660
|
+
size: number;
|
|
661
|
+
page: number;
|
|
662
|
+
totalElements: number;
|
|
663
|
+
totalPages: number;
|
|
664
|
+
} | undefined;
|
|
665
|
+
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
666
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
667
|
+
success: z.ZodBoolean;
|
|
668
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
669
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
670
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
671
|
+
page: z.ZodNumber;
|
|
672
|
+
size: z.ZodNumber;
|
|
673
|
+
totalElements: z.ZodNumber;
|
|
674
|
+
totalPages: z.ZodNumber;
|
|
675
|
+
}, "strip", z.ZodTypeAny, {
|
|
676
|
+
size: number;
|
|
677
|
+
page: number;
|
|
678
|
+
totalElements: number;
|
|
679
|
+
totalPages: number;
|
|
680
|
+
}, {
|
|
681
|
+
size: number;
|
|
682
|
+
page: number;
|
|
683
|
+
totalElements: number;
|
|
684
|
+
totalPages: number;
|
|
685
|
+
}>>;
|
|
686
|
+
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
687
|
+
}, "strip", z.ZodTypeAny, {
|
|
688
|
+
documents: T[];
|
|
689
|
+
metadata?: {
|
|
690
|
+
size: number;
|
|
691
|
+
page: number;
|
|
692
|
+
totalElements: number;
|
|
693
|
+
totalPages: number;
|
|
694
|
+
} | undefined;
|
|
695
|
+
}, {
|
|
696
|
+
documents: T[];
|
|
697
|
+
metadata?: {
|
|
698
|
+
size: number;
|
|
699
|
+
page: number;
|
|
700
|
+
totalElements: number;
|
|
701
|
+
totalPages: number;
|
|
702
|
+
} | undefined;
|
|
703
|
+
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
704
|
+
}>[k_1]; } : never>;
|
|
629
705
|
export type PaginatedDTO<T> = {
|
|
630
706
|
metadata: DTO<typeof metadataSchema>;
|
|
631
707
|
documents: T[];
|
|
@@ -76,22 +76,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
|
|
|
76
76
|
private baseSchema;
|
|
77
77
|
constructor(baseFields: T, includeTimestamps?: boolean, includeTracking?: boolean);
|
|
78
78
|
private createBaseSchema;
|
|
79
|
-
getBaseSchema(): z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
79
|
+
getBaseSchema(): z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<T>[k_1]; } : never>;
|
|
80
80
|
getEntitySchema(): z.ZodObject<z.objectUtil.extendShape<T, {
|
|
81
81
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
82
|
-
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<
|
|
82
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
83
83
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
84
|
-
}>
|
|
84
|
+
}>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
85
85
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
86
|
-
}> extends infer
|
|
86
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
87
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
88
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
89
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
90
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
91
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
92
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
87
93
|
getIdSchema(): z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
88
94
|
getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
|
|
89
95
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
90
|
-
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<
|
|
96
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
97
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
98
|
+
}>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
99
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
100
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
101
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
102
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
91
103
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
92
|
-
}> extends infer
|
|
104
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
93
105
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
94
|
-
}>
|
|
106
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
95
107
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
96
108
|
}, "strict", z.ZodTypeAny, {
|
|
97
109
|
[x: string]: any;
|
|
@@ -114,22 +126,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
|
|
|
114
126
|
[x: string]: any;
|
|
115
127
|
}>;
|
|
116
128
|
getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
|
|
117
|
-
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
129
|
+
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<T>[k_1]; } : never>;
|
|
118
130
|
EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
119
131
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
120
|
-
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<
|
|
132
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
121
133
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
122
|
-
}>
|
|
134
|
+
}>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
123
135
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
124
|
-
}> extends infer
|
|
136
|
+
}> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
137
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
138
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
139
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
140
|
+
}> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
141
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
142
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
125
143
|
IdSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
126
144
|
UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
127
145
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
128
|
-
}> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<
|
|
146
|
+
}> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
147
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
148
|
+
}>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
149
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
150
|
+
}> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
151
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
152
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
129
153
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
130
|
-
}> extends infer
|
|
154
|
+
}> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
131
155
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
132
|
-
}>
|
|
156
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
133
157
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
134
158
|
}, "strict", z.ZodTypeAny, {
|
|
135
159
|
[x: string]: any;
|
|
@@ -587,7 +587,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
587
587
|
totalPages: number;
|
|
588
588
|
} | undefined;
|
|
589
589
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
590
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
590
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
591
591
|
success: z.ZodBoolean;
|
|
592
592
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
593
593
|
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -625,7 +625,83 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
625
625
|
totalPages: number;
|
|
626
626
|
} | undefined;
|
|
627
627
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
628
|
-
}>
|
|
628
|
+
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
629
|
+
success: z.ZodBoolean;
|
|
630
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
631
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
632
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
633
|
+
page: z.ZodNumber;
|
|
634
|
+
size: z.ZodNumber;
|
|
635
|
+
totalElements: z.ZodNumber;
|
|
636
|
+
totalPages: z.ZodNumber;
|
|
637
|
+
}, "strip", z.ZodTypeAny, {
|
|
638
|
+
page: number;
|
|
639
|
+
size: number;
|
|
640
|
+
totalElements: number;
|
|
641
|
+
totalPages: number;
|
|
642
|
+
}, {
|
|
643
|
+
page: number;
|
|
644
|
+
size: number;
|
|
645
|
+
totalElements: number;
|
|
646
|
+
totalPages: number;
|
|
647
|
+
}>>;
|
|
648
|
+
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
649
|
+
}, "strip", z.ZodTypeAny, {
|
|
650
|
+
documents: T[];
|
|
651
|
+
metadata?: {
|
|
652
|
+
page: number;
|
|
653
|
+
size: number;
|
|
654
|
+
totalElements: number;
|
|
655
|
+
totalPages: number;
|
|
656
|
+
} | undefined;
|
|
657
|
+
}, {
|
|
658
|
+
documents: T[];
|
|
659
|
+
metadata?: {
|
|
660
|
+
page: number;
|
|
661
|
+
size: number;
|
|
662
|
+
totalElements: number;
|
|
663
|
+
totalPages: number;
|
|
664
|
+
} | undefined;
|
|
665
|
+
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
666
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
667
|
+
success: z.ZodBoolean;
|
|
668
|
+
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
669
|
+
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
670
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
671
|
+
page: z.ZodNumber;
|
|
672
|
+
size: z.ZodNumber;
|
|
673
|
+
totalElements: z.ZodNumber;
|
|
674
|
+
totalPages: z.ZodNumber;
|
|
675
|
+
}, "strip", z.ZodTypeAny, {
|
|
676
|
+
page: number;
|
|
677
|
+
size: number;
|
|
678
|
+
totalElements: number;
|
|
679
|
+
totalPages: number;
|
|
680
|
+
}, {
|
|
681
|
+
page: number;
|
|
682
|
+
size: number;
|
|
683
|
+
totalElements: number;
|
|
684
|
+
totalPages: number;
|
|
685
|
+
}>>;
|
|
686
|
+
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
687
|
+
}, "strip", z.ZodTypeAny, {
|
|
688
|
+
documents: T[];
|
|
689
|
+
metadata?: {
|
|
690
|
+
page: number;
|
|
691
|
+
size: number;
|
|
692
|
+
totalElements: number;
|
|
693
|
+
totalPages: number;
|
|
694
|
+
} | undefined;
|
|
695
|
+
}, {
|
|
696
|
+
documents: T[];
|
|
697
|
+
metadata?: {
|
|
698
|
+
page: number;
|
|
699
|
+
size: number;
|
|
700
|
+
totalElements: number;
|
|
701
|
+
totalPages: number;
|
|
702
|
+
} | undefined;
|
|
703
|
+
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
704
|
+
}>[k_1]; } : never>;
|
|
629
705
|
export type PaginatedDTO<T> = {
|
|
630
706
|
metadata: DTO<typeof metadataSchema>;
|
|
631
707
|
documents: T[];
|
|
@@ -76,22 +76,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
|
|
|
76
76
|
private baseSchema;
|
|
77
77
|
constructor(baseFields: T, includeTimestamps?: boolean, includeTracking?: boolean);
|
|
78
78
|
private createBaseSchema;
|
|
79
|
-
getBaseSchema(): z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
79
|
+
getBaseSchema(): z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<T>[k_1]; } : never>;
|
|
80
80
|
getEntitySchema(): z.ZodObject<z.objectUtil.extendShape<T, {
|
|
81
81
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
82
|
-
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<
|
|
82
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
83
83
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
84
|
-
}>
|
|
84
|
+
}>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
85
85
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
86
|
-
}> extends infer
|
|
86
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
87
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
88
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
89
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
90
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
91
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
92
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
87
93
|
getIdSchema(): z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
88
94
|
getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
|
|
89
95
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
90
|
-
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<
|
|
96
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
97
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
98
|
+
}>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
99
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
100
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
101
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
102
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
91
103
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
92
|
-
}> extends infer
|
|
104
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
93
105
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
94
|
-
}>
|
|
106
|
+
}>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
95
107
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
96
108
|
}, "strict", z.ZodTypeAny, {
|
|
97
109
|
[x: string]: any;
|
|
@@ -114,22 +126,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
|
|
|
114
126
|
[x: string]: any;
|
|
115
127
|
}>;
|
|
116
128
|
getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
|
|
117
|
-
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
129
|
+
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<T>[k_1]; } : never>;
|
|
118
130
|
EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
119
131
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
120
|
-
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<
|
|
132
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
121
133
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
122
|
-
}>
|
|
134
|
+
}>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
123
135
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
124
|
-
}> extends infer
|
|
136
|
+
}> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
137
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
138
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
139
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
140
|
+
}> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
141
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
142
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
125
143
|
IdSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
126
144
|
UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
127
145
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
128
|
-
}> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<
|
|
146
|
+
}> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
147
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
148
|
+
}>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
149
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
150
|
+
}> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
151
|
+
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
152
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
129
153
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
130
|
-
}> extends infer
|
|
154
|
+
}> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
131
155
|
_id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
|
|
132
|
-
}>
|
|
156
|
+
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
133
157
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
134
158
|
}, "strict", z.ZodTypeAny, {
|
|
135
159
|
[x: string]: any;
|