@lyxa.ai/core 1.1.102 → 1.1.104
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/adjustment-information.model.d.ts +2 -2
- package/dist/libraries/mongo/models/embedded/adjustment-information.model.js +1 -1
- package/dist/libraries/mongo/models/embedded/adjustment-information.model.js.map +1 -1
- package/dist/libraries/mongo/models/finance-settlement.model.d.ts +2 -0
- package/dist/libraries/mongo/models/finance-settlement.model.js +10 -0
- package/dist/libraries/mongo/models/finance-settlement.model.js.map +1 -1
- package/dist/libraries/mongo/models/user.model.d.ts +1 -1
- package/dist/libraries/socket/adapters/socket-subscription.d.ts +1 -1
- package/dist/libraries/socket/adapters/socket-subscription.js +6 -8
- package/dist/libraries/socket/adapters/socket-subscription.js.map +1 -1
- package/dist/libraries/socket/core/local-subscription-registry.d.ts +4 -4
- package/dist/libraries/socket/core/local-subscription-registry.js +39 -24
- package/dist/libraries/socket/core/local-subscription-registry.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/types/utilities/validation/common-validation.d.ts +2 -78
- package/dist/types/utilities/validation/global-validation.d.ts +14 -38
- package/dist/utilities/validation/common-validation.d.ts +2 -78
- package/dist/utilities/validation/global-validation.d.ts +14 -38
- package/package.json +1 -1
|
@@ -8,11 +8,11 @@ export declare class AdjustedLineItem {
|
|
|
8
8
|
note?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare class AdjustmentInformation {
|
|
11
|
-
reason
|
|
11
|
+
reason?: AdjustmentReason;
|
|
12
12
|
suggestedProduct?: Ref<Product>[];
|
|
13
13
|
adjustedLineItems?: AdjustedLineItem[];
|
|
14
14
|
requestedAt?: Date;
|
|
15
15
|
resolvedAt?: Date;
|
|
16
16
|
admin?: Ref<Admin>;
|
|
17
|
-
isRequestByShop
|
|
17
|
+
isRequestByShop?: boolean;
|
|
18
18
|
}
|
|
@@ -21,7 +21,7 @@ class AdjustedLineItem {
|
|
|
21
21
|
}
|
|
22
22
|
exports.AdjustedLineItem = AdjustedLineItem;
|
|
23
23
|
__decorate([
|
|
24
|
-
(0, typegoose_1.prop)({ ref: () => line_item_model_1.LineItem }),
|
|
24
|
+
(0, typegoose_1.prop)({ required: true, ref: () => line_item_model_1.LineItem }),
|
|
25
25
|
__metadata("design:type", Object)
|
|
26
26
|
], AdjustedLineItem.prototype, "lineItem", void 0);
|
|
27
27
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adjustment-information.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/adjustment-information.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA8D;AAC9D,oDAA2C;AAC3C,wDAA8C;AAC9C,gDAAuC;AAEvC,MAAa,gBAAgB;IAErB,QAAQ,CAAiB;IAGzB,IAAI,CAAU;CACrB;AAND,4CAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"adjustment-information.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/adjustment-information.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAiD;AACjD,qDAA8D;AAC9D,oDAA2C;AAC3C,wDAA8C;AAC9C,gDAAuC;AAEvC,MAAa,gBAAgB;IAErB,QAAQ,CAAiB;IAGzB,IAAI,CAAU;CACrB;AAND,4CAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,0BAAQ,EAAE,CAAC;;kDACd;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;8CAClB;AAEtB,MAAa,qBAAqB;IAE1B,MAAM,CAAoB;IAG1B,gBAAgB,CAAkB;IAGlC,iBAAiB,CAAsB;IAGvC,WAAW,CAAQ;IAGnB,UAAU,CAAQ;IAGlB,KAAK,CAAc;IAGnB,eAAe,CAAW;CACjC;AArBD,sDAqBC;AAnBO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAgB,EAAE,CAAC;;qDACd;AAG1B;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,uBAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;+DACD;AAGlC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gEACR;AAGvC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAC3B,IAAI;0DAAC;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;8BACP,IAAI;yDAAC;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;oDACD;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;8DACP","sourcesContent":["import { prop, Ref } from '@typegoose/typegoose';\nimport { AdjustmentReason } from '../../../../utilities/enum';\nimport { Product } from '../product.model';\nimport { LineItem } from '../line-item.model';\nimport { Admin } from '../admin.model';\n\nexport class AdjustedLineItem {\n\t@prop({ required: true, ref: () => LineItem })\n\tpublic lineItem!: Ref<LineItem>;\n\n\t@prop({ type: String, maxlength: 150 })\n\tpublic note?: string;\n}\nexport class AdjustmentInformation {\n\t@prop({ type: String, enum: AdjustmentReason })\n\tpublic reason?: AdjustmentReason;\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic suggestedProduct?: Ref<Product>[];\n\n\t@prop({ type: () => [AdjustedLineItem], default: [] })\n\tpublic adjustedLineItems?: AdjustedLineItem[];\n\n\t@prop({ type: Date, default: () => new Date() })\n\tpublic requestedAt?: Date;\n\n\t@prop({ type: () => Date })\n\tpublic resolvedAt?: Date;\n\n\t@prop({ ref: () => Admin })\n\tpublic admin?: Ref<Admin>;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isRequestByShop?: boolean;\n}\n"]}
|
|
@@ -24,6 +24,8 @@ export declare class FinanceSettlement extends TimeStamps {
|
|
|
24
24
|
secondaryAmountFromItems?: number;
|
|
25
25
|
amountFromDelivery?: number;
|
|
26
26
|
secondaryAmountFromDelivery?: number;
|
|
27
|
+
cashbackAmount?: number;
|
|
28
|
+
secondaryCashbackAmount?: number;
|
|
27
29
|
paymentIntentId?: string;
|
|
28
30
|
settleBy?: Ref<Admin>;
|
|
29
31
|
adminNote?: string;
|
|
@@ -38,6 +38,8 @@ let FinanceSettlement = class FinanceSettlement extends defaultClasses_1.TimeSta
|
|
|
38
38
|
secondaryAmountFromItems;
|
|
39
39
|
amountFromDelivery;
|
|
40
40
|
secondaryAmountFromDelivery;
|
|
41
|
+
cashbackAmount;
|
|
42
|
+
secondaryCashbackAmount;
|
|
41
43
|
paymentIntentId;
|
|
42
44
|
settleBy;
|
|
43
45
|
adminNote;
|
|
@@ -107,6 +109,14 @@ __decorate([
|
|
|
107
109
|
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
108
110
|
__metadata("design:type", Number)
|
|
109
111
|
], FinanceSettlement.prototype, "secondaryAmountFromDelivery", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
114
|
+
__metadata("design:type", Number)
|
|
115
|
+
], FinanceSettlement.prototype, "cashbackAmount", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, typegoose_1.prop)({ type: Number, default: 0 }),
|
|
118
|
+
__metadata("design:type", Number)
|
|
119
|
+
], FinanceSettlement.prototype, "secondaryCashbackAmount", void 0);
|
|
110
120
|
__decorate([
|
|
111
121
|
(0, typegoose_1.prop)({ type: String }),
|
|
112
122
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finance-settlement.model.js","sourceRoot":"/","sources":["libraries/mongo/models/finance-settlement.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,+CAAsC;AACtC,6CAAoC;AACpC,+CAAsC;AACtC,kDAA6F;AAC7F,6CAAoC;AACpC,+CAAsC;AACtC,iDAAwC;AAExC,wBAAyD;AACzD,kEAA6D;AAUtD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,2BAAU;IAEzC,YAAY,CAAS;IAGrB,WAAW,CAAe;IAG1B,KAAK,CAAc;IAGnB,OAAO,CAAU;IAGjB,MAAM,CAAe;IAGrB,IAAI,CAAa;IAGjB,QAAQ,CAAY;IAGpB,KAAK,CAAc;IAGnB,IAAI,CAAa;IAGjB,cAAc,CAAkB;IAGhC,MAAM,CAAU;IAGhB,eAAe,CAAU;IAGzB,eAAe,CAAU;IAGzB,wBAAwB,CAAU;IAGlC,kBAAkB,CAAU;IAG5B,2BAA2B,CAAU;IAGrC,eAAe,CAAU;IAGzB,QAAQ,CAAc;IAGtB,SAAS,CAAU;CAC1B,CAAA;
|
|
1
|
+
{"version":3,"file":"finance-settlement.model.js","sourceRoot":"/","sources":["libraries/mongo/models/finance-settlement.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,+CAAsC;AACtC,6CAAoC;AACpC,+CAAsC;AACtC,kDAA6F;AAC7F,6CAAoC;AACpC,+CAAsC;AACtC,iDAAwC;AAExC,wBAAyD;AACzD,kEAA6D;AAUtD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DACS;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,mBAAK,EAAE,CAAC;;mDACE;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;;oDACb;4BA9Dd,iBAAiB;IAR7B,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAAE,CAAC;IACrE,IAAA,iBAAK,EAAC,EAAE,cAAc,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IAC3C,IAAA,iBAAK,EAAC,EAAE,WAAW,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC;IAC3D,IAAA,eAAG,EAAoB,MAAM,EAAE,KAAK;QACpC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,YAAY,GAAG,MAAM,IAAA,yBAAU,EAAC,eAAY,EAAE,kBAAW,CAAC,WAAW,CAAC,CAAC;QAC7E,CAAC;IACF,CAAC,CAAC;GACW,iBAAiB,CA+D7B","sourcesContent":["import { index, modelOptions, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Order } from './order.model';\nimport { Shop } from './shop.model';\nimport { Rider } from './rider.model';\nimport { AccountType, CounterType, ItemType, SettlementType } from '../../../utilities/enum';\nimport { User } from './user.model';\nimport { Admin } from './admin.model';\nimport { Parent } from './parent.model';\nimport { handlePreSaveForUniqueId } from '../utilities/unique-id.hooks';\nimport { CounterModel, FinanceSettlementModel } from '.';\nimport { generateId } from '../../../utilities/id-generator';\n\n@modelOptions({ schemaOptions: { collection: 'financeSettlements' } })\n@index({ settlementType: 1, createdAt: -1 })\n@index({ accountType: 1, settlementType: 1, createdAt: -1 })\n@pre<FinanceSettlement>('save', async function () {\n\tif (this.isNew) {\n\t\tthis.settlementId = await generateId(CounterModel, CounterType.TRANSACTION);\n\t}\n})\nexport class FinanceSettlement extends TimeStamps {\n\t@prop({ type: String, unique: true, index: true })\n\tpublic settlementId: string;\n\n\t@prop({ required: true, type: String, enum: AccountType })\n\tpublic accountType!: AccountType;\n\n\t@prop({ ref: () => Order, index: true })\n\tpublic order?: Ref<Order>;\n\n\t@prop({ type: String, index: true })\n\tpublic orderId?: string;\n\n\t@prop({ ref: () => Parent, index: true })\n\tpublic parent?: Ref<Parent>;\n\n\t@prop({ ref: () => Shop, index: true })\n\tpublic shop?: Ref<Shop>;\n\n\t@prop({ type: String, enum: ItemType, index: true })\n\tpublic itemType?: ItemType;\n\n\t@prop({ ref: () => Rider, index: true })\n\tpublic rider?: Ref<Rider>;\n\n\t@prop({ ref: () => User, index: true })\n\tpublic user?: Ref<User>;\n\n\t@prop({ required: true, type: String, enum: SettlementType })\n\tpublic settlementType!: SettlementType;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic amount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryAmount?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic amountFromItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryAmountFromItems?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic amountFromDelivery?: number;\n\n\t@prop({ type: Number, default: 0 })\n\tpublic secondaryAmountFromDelivery?: number;\n\n\t@prop({ type: Number, default: 0 }) // used for deducting cashback when refund order\n\tpublic cashbackAmount?: number;\n\n\t@prop({ type: Number, default: 0 }) // used for deducting cashback when refund order\n\tpublic secondaryCashbackAmount?: number;\n\n\t@prop({ type: String })\n\tpublic paymentIntentId?: string;\n\n\t@prop({ ref: () => Admin })\n\tpublic settleBy?: Ref<Admin>;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic adminNote?: string;\n}\n"]}
|
|
@@ -33,7 +33,7 @@ export declare class User extends TimeStamps {
|
|
|
33
33
|
onlineStatus?: OnlineStatus;
|
|
34
34
|
fcmTokens?: string[];
|
|
35
35
|
wallet?: Wallet;
|
|
36
|
-
static updateWallet(this: ReturnModelType<typeof User>, userId: string, main?: number, reserve?: number): Promise<(import("mongoose").Document<unknown, import("@typegoose/typegoose/lib/types").BeAnObject, User, import("@typegoose/typegoose/lib/types").BeAnyObject> & Omit<User & {
|
|
36
|
+
static updateWallet(this: ReturnModelType<typeof User>, userId: string, main?: number, reserve?: number): Promise<(import("mongoose").Document<unknown, import("@typegoose/typegoose/lib/types").BeAnObject, User, import("@typegoose/typegoose/lib/types").BeAnyObject, {}> & Omit<User & {
|
|
37
37
|
_id: import("mongoose").Types.ObjectId;
|
|
38
38
|
} & {
|
|
39
39
|
__v: number;
|
|
@@ -12,5 +12,5 @@ interface _SubscriptionOpts<TEventType extends SocketEventType, TInput> {
|
|
|
12
12
|
ctx: _SubscriptionContext;
|
|
13
13
|
input: TInput;
|
|
14
14
|
}
|
|
15
|
-
export declare function createSocketSubscriptionAdapter<TEventType extends SocketEventType, TInput>(eventType: TEventType
|
|
15
|
+
export declare function createSocketSubscriptionAdapter<TEventType extends SocketEventType, TInput>(eventType: TEventType): (opts: _SubscriptionOpts<TEventType, TInput>) => AsyncGenerator<Awaited<OutputFor<TEventType>>, void, unknown>;
|
|
16
16
|
export {};
|
|
@@ -5,35 +5,33 @@ const index_1 = require("../index");
|
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
6
|
const instance_utils_1 = require("../../../utilities/instance.utils");
|
|
7
7
|
const ws_1 = require("ws");
|
|
8
|
-
const server_1 = require("@trpc/server");
|
|
9
8
|
async function* _createSocketSubscription(options) {
|
|
10
|
-
const { eventType, ctx, input
|
|
9
|
+
const { eventType, ctx, input } = options;
|
|
11
10
|
const registration = index_1.EventFactory.getRegistration(eventType);
|
|
12
11
|
const socketId = (0, crypto_1.randomUUID)();
|
|
13
12
|
const localEE = new index_1.LocalEventEmitter(socketId);
|
|
14
13
|
const entityId = ctx.entity.id;
|
|
15
14
|
const entityType = ctx.entity.type;
|
|
15
|
+
const entity = { id: entityId, type: entityType };
|
|
16
16
|
const eventKey = index_1.EventFactory.getSubscriptionKey(eventType, input);
|
|
17
17
|
const instanceId = (0, instance_utils_1.getInstanceId)();
|
|
18
18
|
const socketInfo = { socketId, eventKey, instanceId };
|
|
19
19
|
await (0, index_1.connectEntityToSocketEvent)(ctx.entity, socketInfo);
|
|
20
|
-
index_1.LocalSubs.bind(
|
|
20
|
+
index_1.LocalSubs.bind(entity, eventKey, localEE);
|
|
21
21
|
ctx.signal?.addEventListener('abort', () => {
|
|
22
|
-
index_1.LocalSubs.unbind(
|
|
22
|
+
index_1.LocalSubs.unbind(entity, eventKey, localEE);
|
|
23
23
|
(0, index_1.disconnectEntityFromSocketEvent)(ctx.entity, socketInfo).catch(console.error);
|
|
24
24
|
});
|
|
25
25
|
for await (const [data] of (0, ws_1.on)(localEE.ee, eventKey, { signal: ctx.signal })) {
|
|
26
26
|
const payload = data;
|
|
27
|
-
|
|
28
|
-
yield (0, server_1.tracked)(id, payload);
|
|
27
|
+
yield payload;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
function createSocketSubscriptionAdapter(eventType
|
|
30
|
+
function createSocketSubscriptionAdapter(eventType) {
|
|
32
31
|
return (opts) => _createSocketSubscription({
|
|
33
32
|
eventType,
|
|
34
33
|
ctx: opts.ctx,
|
|
35
34
|
input: opts.input,
|
|
36
|
-
getTrackingId,
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
37
|
//# sourceMappingURL=socket-subscription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-subscription.js","sourceRoot":"/","sources":["libraries/socket/adapters/socket-subscription.ts"],"names":[],"mappings":";;AAiEA,
|
|
1
|
+
{"version":3,"file":"socket-subscription.js","sourceRoot":"/","sources":["libraries/socket/adapters/socket-subscription.ts"],"names":[],"mappings":";;AAiEA,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IAGH,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,OAAE,EAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QAC7E,MAAM,OAAO,GAAG,IAAW,CAAC;QAC5B,MAAM,OAAO,CAAC;IACf,CAAC;AACF,CAAC;AAED,SAAgB,+BAA+B,CAA6C,SAAqB;IAChH,OAAO,CAAC,IAA2C,EAAE,EAAE,CACtD,yBAAyB,CAAC;QACzB,SAAS;QACT,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,KAAK,EAAE,IAAI,CAAC,KAAK;KACjB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { SocketEventType } from '../../../utilities/enum';\nimport {\n\tconnectEntityToSocketEvent,\n\tdisconnectEntityFromSocketEvent,\n\tEntitySubscription,\n\tEventFactory,\n\tLocalEventEmitter,\n\tLocalSubs,\n\tOutputFor,\n} from '../index';\nimport { randomUUID } from 'crypto';\nimport { getInstanceId } from '../../../utilities/instance.utils';\nimport { on } from 'ws';\nimport { AuthEntityType } from '../../auth';\n\ninterface _SubscriptionContext {\n\tentity?: { id: string; type: AuthEntityType };\n\tsignal?: AbortSignal;\n}\n\ninterface _SubscriptionOpts<TEventType extends SocketEventType, TInput> {\n\tctx: _SubscriptionContext;\n\tinput: TInput;\n}\n\ninterface _CreateSubscriptionOptions<TEventType extends SocketEventType, TInput> {\n\teventType: TEventType;\n\tctx: _SubscriptionContext;\n\tinput: TInput;\n}\n\nasync function* _createSocketSubscription<TEventType extends SocketEventType, TInput>(\n\toptions: _CreateSubscriptionOptions<TEventType, TInput>\n) {\n\tconst { eventType, ctx, input } = options;\n\n\tconst registration = EventFactory.getRegistration(eventType);\n\tconst socketId = randomUUID();\n\tconst localEE = new LocalEventEmitter(socketId);\n\n\tconst entityId = ctx.entity!.id;\n\tconst entityType = ctx.entity!.type;\n\n\tconst entity: EntitySubscription = { id: entityId, type: entityType };\n\n\tconst eventKey = EventFactory.getSubscriptionKey(eventType, input);\n\n\tconst instanceId = getInstanceId();\n\tconst socketInfo = { socketId, eventKey, instanceId };\n\n\tawait connectEntityToSocketEvent(ctx.entity!, socketInfo);\n\tLocalSubs.bind(entity, eventKey, localEE);\n\n\tctx.signal?.addEventListener('abort', () => {\n\t\tLocalSubs.unbind(entity, eventKey, localEE);\n\t\tdisconnectEntityFromSocketEvent(ctx.entity!, socketInfo).catch(console.error);\n\t});\n\n\ttype Out = OutputFor<TEventType>;\n\tfor await (const [data] of on(localEE.ee, eventKey, { signal: ctx.signal })) {\n\t\tconst payload = data as Out;\n\t\tyield payload;\n\t}\n}\n\nexport function createSocketSubscriptionAdapter<TEventType extends SocketEventType, TInput>(eventType: TEventType) {\n\treturn (opts: _SubscriptionOpts<TEventType, TInput>) =>\n\t\t_createSocketSubscription({\n\t\t\teventType,\n\t\t\tctx: opts.ctx,\n\t\t\tinput: opts.input,\n\t\t});\n}\n\n/**\n * @Example\n * const socketRouterTwo = createTRPCRouter({\n * \tonMessage: createAuthenticatedProcedure({ entityTypes: [AuthEntityType.CRM] })\n * \t\t.input(ChatroomMessageSendSocketInputSchema)\n * \t\t.output(\n * \t\t\tzAsyncIterable({\n * \t\t\t\tyield: ChatroomMessageSendOutputSchema,\n * \t\t\t})\n * \t\t)\n * \t\t.subscription(createSocketSubscriptionAdapter(SocketEventType.CHATROOM_MESSAGE_SEND)),\n * });\n */\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
|
+
import { EntitySubscription } from './socket-redis-connections';
|
|
2
3
|
type EventKey = string;
|
|
3
|
-
type EntityId = string;
|
|
4
4
|
type SocketId = string;
|
|
5
5
|
export declare class LocalEventEmitter {
|
|
6
6
|
private _ee;
|
|
@@ -11,9 +11,9 @@ export declare class LocalEventEmitter {
|
|
|
11
11
|
}
|
|
12
12
|
declare class LocalSubscriptionRegistry {
|
|
13
13
|
private byEntity;
|
|
14
|
-
bind(
|
|
15
|
-
unbind(
|
|
16
|
-
emit(
|
|
14
|
+
bind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter): void;
|
|
15
|
+
unbind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter): void;
|
|
16
|
+
emit(entity: EntitySubscription, eventKey: EventKey, payload: unknown): void;
|
|
17
17
|
}
|
|
18
18
|
export declare const LocalSubs: LocalSubscriptionRegistry;
|
|
19
19
|
export {};
|
|
@@ -5,6 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LocalSubs = exports.LocalEventEmitter = void 0;
|
|
7
7
|
const events_1 = __importDefault(require("events"));
|
|
8
|
+
function entityKey(entity) {
|
|
9
|
+
return entity.type ? `${entity.type}:${entity.id}` : entity.id;
|
|
10
|
+
}
|
|
8
11
|
class LocalEventEmitter {
|
|
9
12
|
_ee;
|
|
10
13
|
_socketId;
|
|
@@ -22,36 +25,48 @@ class LocalEventEmitter {
|
|
|
22
25
|
exports.LocalEventEmitter = LocalEventEmitter;
|
|
23
26
|
class LocalSubscriptionRegistry {
|
|
24
27
|
byEntity = new Map();
|
|
25
|
-
bind(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
bind(entity, eventKey, ee) {
|
|
29
|
+
const key = entityKey(entity);
|
|
30
|
+
let eventMap = this.byEntity.get(key);
|
|
31
|
+
if (!eventMap) {
|
|
32
|
+
eventMap = new Map();
|
|
33
|
+
this.byEntity.set(key, eventMap);
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
if (!
|
|
33
|
-
|
|
35
|
+
let listenerSet = eventMap.get(eventKey);
|
|
36
|
+
if (!listenerSet) {
|
|
37
|
+
listenerSet = new Set();
|
|
38
|
+
eventMap.set(eventKey, listenerSet);
|
|
34
39
|
}
|
|
35
|
-
|
|
40
|
+
listenerSet.add(ee);
|
|
41
|
+
console.log(`[LocalSubs] Bound ${key} -> ${eventKey}, socket=${ee.socketId}`);
|
|
36
42
|
}
|
|
37
|
-
unbind(
|
|
38
|
-
const
|
|
39
|
-
|
|
43
|
+
unbind(entity, eventKey, ee) {
|
|
44
|
+
const key = entityKey(entity);
|
|
45
|
+
const eventMap = this.byEntity.get(key);
|
|
46
|
+
if (!eventMap)
|
|
40
47
|
return;
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
48
|
+
const listenerSet = eventMap.get(eventKey);
|
|
49
|
+
if (listenerSet) {
|
|
50
|
+
listenerSet.delete(ee);
|
|
51
|
+
if (listenerSet.size === 0)
|
|
52
|
+
eventMap.delete(eventKey);
|
|
46
53
|
}
|
|
47
|
-
if (
|
|
48
|
-
this.byEntity.delete(
|
|
54
|
+
if (eventMap.size === 0)
|
|
55
|
+
this.byEntity.delete(key);
|
|
56
|
+
console.log(`[LocalSubs] Unbound ${key} -> ${eventKey}, socket=${ee.socketId}`);
|
|
49
57
|
}
|
|
50
|
-
emit(
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
emit(entity, eventKey, payload) {
|
|
59
|
+
const key = entityKey(entity);
|
|
60
|
+
const eventMap = this.byEntity.get(key);
|
|
61
|
+
const listeners = eventMap?.get(eventKey);
|
|
62
|
+
console.log('LocalSubs emit called', {
|
|
63
|
+
payload,
|
|
64
|
+
});
|
|
65
|
+
if (!listeners)
|
|
66
|
+
return;
|
|
67
|
+
for (const listener of listeners) {
|
|
68
|
+
listener.ee.emit(eventKey, payload);
|
|
69
|
+
}
|
|
55
70
|
}
|
|
56
71
|
}
|
|
57
72
|
exports.LocalSubs = new LocalSubscriptionRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-subscription-registry.js","sourceRoot":"/","sources":["libraries/socket/core/local-subscription-registry.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAkC;
|
|
1
|
+
{"version":3,"file":"local-subscription-registry.js","sourceRoot":"/","sources":["libraries/socket/core/local-subscription-registry.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAkC;AAOlC,SAAS,SAAS,CAAC,MAA0B;IAC5C,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;AAChE,CAAC;AAED,MAAa,iBAAiB;IACrB,GAAG,CAAe;IAClB,SAAS,CAAW;IAE5B,YAAY,QAAkB;QAC7B,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAY,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED,IAAI,EAAE;QACL,OAAO,IAAI,CAAC,GAAG,CAAC;IACjB,CAAC;CACD;AAhBD,8CAgBC;AAED,MAAM,yBAAyB;IACtB,QAAQ,GAAG,IAAI,GAAG,EAAiD,CAAC;IAE5E,IAAI,CAAC,MAA0B,EAAE,QAAkB,EAAE,EAAqB;QACzE,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;QAED,IAAI,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,WAAW,GAAG,IAAI,GAAG,EAAE,CAAC;YACxB,Q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C,OAAO;SACP,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS;YAAE,OAAO;QAEvB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YAClC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;CACD;AAEY,QAAA,SAAS,GAAG,IAAI,yBAAyB,EAAE,CAAC","sourcesContent":["import EventEmitter from 'events';\nimport { EntitySubscription } from './socket-redis-connections';\n\ntype EventKey = string;\ntype SocketId = string;\n\n// Utility: create a unique key for each EntitySubscription\nfunction entityKey(entity: EntitySubscription): string {\n\treturn entity.type ? `${entity.type}:${entity.id}` : entity.id;\n}\n\nexport class LocalEventEmitter {\n\tprivate _ee: EventEmitter;\n\tprivate _socketId: SocketId;\n\n\tconstructor(socketId: SocketId) {\n\t\tthis._ee = new EventEmitter();\n\t\tthis._socketId = socketId;\n\t}\n\n\tget socketId() {\n\t\treturn this._socketId;\n\t}\n\n\tget ee() {\n\t\treturn this._ee;\n\t}\n}\n\nclass LocalSubscriptionRegistry {\n\tprivate byEntity = new Map<string, Map<EventKey, Set<LocalEventEmitter>>>();\n\n\tbind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter) {\n\t\tconst key = entityKey(entity);\n\t\tlet eventMap = this.byEntity.get(key);\n\t\tif (!eventMap) {\n\t\t\teventMap = new Map();\n\t\t\tthis.byEntity.set(key, eventMap);\n\t\t}\n\n\t\tlet listenerSet = eventMap.get(eventKey);\n\t\tif (!listenerSet) {\n\t\t\tlistenerSet = new Set();\n\t\t\teventMap.set(eventKey, listenerSet);\n\t\t}\n\n\t\tlistenerSet.add(ee);\n\n\t\tconsole.log(`[LocalSubs] Bound ${key} -> ${eventKey}, socket=${ee.socketId}`);\n\t}\n\n\tunbind(entity: EntitySubscription, eventKey: EventKey, ee: LocalEventEmitter) {\n\t\tconst key = entityKey(entity);\n\t\tconst eventMap = this.byEntity.get(key);\n\t\tif (!eventMap) return;\n\n\t\tconst listenerSet = eventMap.get(eventKey);\n\t\tif (listenerSet) {\n\t\t\tlistenerSet.delete(ee);\n\t\t\tif (listenerSet.size === 0) eventMap.delete(eventKey);\n\t\t}\n\t\tif (eventMap.size === 0) this.byEntity.delete(key);\n\n\t\tconsole.log(`[LocalSubs] Unbound ${key} -> ${eventKey}, socket=${ee.socketId}`);\n\t}\n\n\temit(entity: EntitySubscription, eventKey: EventKey, payload: unknown) {\n\t\tconst key = entityKey(entity);\n\t\tconst eventMap = this.byEntity.get(key);\n\t\tconst listeners = eventMap?.get(eventKey);\n\n\t\tconsole.log('LocalSubs emit called', {\n\t\t\tpayload,\n\t\t});\n\n\t\tif (!listeners) return;\n\n\t\tfor (const listener of listeners) {\n\t\t\tlistener.ee.emit(eventKey, payload);\n\t\t}\n\t}\n}\n\nexport const LocalSubs = new LocalSubscriptionRegistry();\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -646,7 +646,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
646
646
|
totalPages: number;
|
|
647
647
|
} | undefined;
|
|
648
648
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
649
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.
|
|
649
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
650
650
|
success: z.ZodBoolean;
|
|
651
651
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
652
652
|
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -684,83 +684,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
684
684
|
totalPages: number;
|
|
685
685
|
} | undefined;
|
|
686
686
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
687
|
-
}
|
|
688
|
-
success: z.ZodBoolean;
|
|
689
|
-
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
690
|
-
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
691
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
692
|
-
page: z.ZodNumber;
|
|
693
|
-
size: z.ZodNumber;
|
|
694
|
-
totalElements: z.ZodNumber;
|
|
695
|
-
totalPages: z.ZodNumber;
|
|
696
|
-
}, "strip", z.ZodTypeAny, {
|
|
697
|
-
size: number;
|
|
698
|
-
page: number;
|
|
699
|
-
totalElements: number;
|
|
700
|
-
totalPages: number;
|
|
701
|
-
}, {
|
|
702
|
-
size: number;
|
|
703
|
-
page: number;
|
|
704
|
-
totalElements: number;
|
|
705
|
-
totalPages: number;
|
|
706
|
-
}>>;
|
|
707
|
-
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
708
|
-
}, "strip", z.ZodTypeAny, {
|
|
709
|
-
documents: T[];
|
|
710
|
-
metadata?: {
|
|
711
|
-
size: number;
|
|
712
|
-
page: number;
|
|
713
|
-
totalElements: number;
|
|
714
|
-
totalPages: number;
|
|
715
|
-
} | undefined;
|
|
716
|
-
}, {
|
|
717
|
-
documents: T[];
|
|
718
|
-
metadata?: {
|
|
719
|
-
size: number;
|
|
720
|
-
page: number;
|
|
721
|
-
totalElements: number;
|
|
722
|
-
totalPages: number;
|
|
723
|
-
} | undefined;
|
|
724
|
-
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
725
|
-
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
726
|
-
success: z.ZodBoolean;
|
|
727
|
-
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
728
|
-
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
729
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
730
|
-
page: z.ZodNumber;
|
|
731
|
-
size: z.ZodNumber;
|
|
732
|
-
totalElements: z.ZodNumber;
|
|
733
|
-
totalPages: z.ZodNumber;
|
|
734
|
-
}, "strip", z.ZodTypeAny, {
|
|
735
|
-
size: number;
|
|
736
|
-
page: number;
|
|
737
|
-
totalElements: number;
|
|
738
|
-
totalPages: number;
|
|
739
|
-
}, {
|
|
740
|
-
size: number;
|
|
741
|
-
page: number;
|
|
742
|
-
totalElements: number;
|
|
743
|
-
totalPages: number;
|
|
744
|
-
}>>;
|
|
745
|
-
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
746
|
-
}, "strip", z.ZodTypeAny, {
|
|
747
|
-
documents: T[];
|
|
748
|
-
metadata?: {
|
|
749
|
-
size: number;
|
|
750
|
-
page: number;
|
|
751
|
-
totalElements: number;
|
|
752
|
-
totalPages: number;
|
|
753
|
-
} | undefined;
|
|
754
|
-
}, {
|
|
755
|
-
documents: T[];
|
|
756
|
-
metadata?: {
|
|
757
|
-
size: number;
|
|
758
|
-
page: number;
|
|
759
|
-
totalElements: number;
|
|
760
|
-
totalPages: number;
|
|
761
|
-
} | undefined;
|
|
762
|
-
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
763
|
-
}>[k_1]; } : never>;
|
|
687
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
764
688
|
export type PaginatedDTO<T> = {
|
|
765
689
|
metadata: DTO<typeof metadataSchema>;
|
|
766
690
|
documents: T[];
|
|
@@ -76,34 +76,22 @@ 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]: T_1[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[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<z.objectUtil.extendShape<T, {
|
|
82
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<T_1[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<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
|
-
}>[k]>; } : never,
|
|
84
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<T_2[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<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
|
|
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">>;
|
|
86
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
93
87
|
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>]>;
|
|
94
88
|
getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
|
|
95
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>]>;
|
|
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, {
|
|
90
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<T_1[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
103
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>]>;
|
|
104
|
-
}> extends infer
|
|
92
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<T_2[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
105
93
|
_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>]>;
|
|
106
|
-
}>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
94
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
107
95
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
108
96
|
}, "strict", z.ZodTypeAny, {
|
|
109
97
|
[x: string]: any;
|
|
@@ -126,34 +114,22 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
|
|
|
126
114
|
[x: string]: any;
|
|
127
115
|
}>;
|
|
128
116
|
getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
|
|
129
|
-
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
117
|
+
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
130
118
|
EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
131
119
|
_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
|
-
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
120
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<T_3[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
133
121
|
_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>]>;
|
|
134
|
-
}>[k_2]>; } : never,
|
|
122
|
+
}> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<T_4[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
135
123
|
_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>]>;
|
|
136
|
-
}> extends infer
|
|
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">>;
|
|
124
|
+
}> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<T_5[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
143
125
|
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>]>;
|
|
144
126
|
UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
145
127
|
_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>]>;
|
|
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, {
|
|
128
|
+
}> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<T_6[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
153
129
|
_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>]>;
|
|
154
|
-
}> extends infer
|
|
130
|
+
}> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<T_7[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
155
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>]>;
|
|
156
|
-
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
132
|
+
}> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<T_8[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
157
133
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
158
134
|
}, "strict", z.ZodTypeAny, {
|
|
159
135
|
[x: string]: any;
|
|
@@ -646,7 +646,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
646
646
|
totalPages: number;
|
|
647
647
|
} | undefined;
|
|
648
648
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
649
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.
|
|
649
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
650
650
|
success: z.ZodBoolean;
|
|
651
651
|
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
652
652
|
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
@@ -684,83 +684,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
|
|
|
684
684
|
totalPages: number;
|
|
685
685
|
} | undefined;
|
|
686
686
|
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
687
|
-
}
|
|
688
|
-
success: z.ZodBoolean;
|
|
689
|
-
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
690
|
-
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
691
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
692
|
-
page: z.ZodNumber;
|
|
693
|
-
size: z.ZodNumber;
|
|
694
|
-
totalElements: z.ZodNumber;
|
|
695
|
-
totalPages: z.ZodNumber;
|
|
696
|
-
}, "strip", z.ZodTypeAny, {
|
|
697
|
-
page: number;
|
|
698
|
-
size: number;
|
|
699
|
-
totalElements: number;
|
|
700
|
-
totalPages: number;
|
|
701
|
-
}, {
|
|
702
|
-
page: number;
|
|
703
|
-
size: number;
|
|
704
|
-
totalElements: number;
|
|
705
|
-
totalPages: number;
|
|
706
|
-
}>>;
|
|
707
|
-
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
708
|
-
}, "strip", z.ZodTypeAny, {
|
|
709
|
-
documents: T[];
|
|
710
|
-
metadata?: {
|
|
711
|
-
page: number;
|
|
712
|
-
size: number;
|
|
713
|
-
totalElements: number;
|
|
714
|
-
totalPages: number;
|
|
715
|
-
} | undefined;
|
|
716
|
-
}, {
|
|
717
|
-
documents: T[];
|
|
718
|
-
metadata?: {
|
|
719
|
-
page: number;
|
|
720
|
-
size: number;
|
|
721
|
-
totalElements: number;
|
|
722
|
-
totalPages: number;
|
|
723
|
-
} | undefined;
|
|
724
|
-
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
725
|
-
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
726
|
-
success: z.ZodBoolean;
|
|
727
|
-
message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
728
|
-
data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
729
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
730
|
-
page: z.ZodNumber;
|
|
731
|
-
size: z.ZodNumber;
|
|
732
|
-
totalElements: z.ZodNumber;
|
|
733
|
-
totalPages: z.ZodNumber;
|
|
734
|
-
}, "strip", z.ZodTypeAny, {
|
|
735
|
-
page: number;
|
|
736
|
-
size: number;
|
|
737
|
-
totalElements: number;
|
|
738
|
-
totalPages: number;
|
|
739
|
-
}, {
|
|
740
|
-
page: number;
|
|
741
|
-
size: number;
|
|
742
|
-
totalElements: number;
|
|
743
|
-
totalPages: number;
|
|
744
|
-
}>>;
|
|
745
|
-
documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
|
|
746
|
-
}, "strip", z.ZodTypeAny, {
|
|
747
|
-
documents: T[];
|
|
748
|
-
metadata?: {
|
|
749
|
-
page: number;
|
|
750
|
-
size: number;
|
|
751
|
-
totalElements: number;
|
|
752
|
-
totalPages: number;
|
|
753
|
-
} | undefined;
|
|
754
|
-
}, {
|
|
755
|
-
documents: T[];
|
|
756
|
-
metadata?: {
|
|
757
|
-
page: number;
|
|
758
|
-
size: number;
|
|
759
|
-
totalElements: number;
|
|
760
|
-
totalPages: number;
|
|
761
|
-
} | undefined;
|
|
762
|
-
}>, z.ZodType<T, z.ZodTypeDef, T>]>>;
|
|
763
|
-
}>[k_1]; } : never>;
|
|
687
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
764
688
|
export type PaginatedDTO<T> = {
|
|
765
689
|
metadata: DTO<typeof metadataSchema>;
|
|
766
690
|
documents: T[];
|
|
@@ -76,34 +76,22 @@ 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]: T_1[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[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<z.objectUtil.extendShape<T, {
|
|
82
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<T_1[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<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
|
-
}>[k]>; } : never,
|
|
84
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<T_2[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<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
|
|
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">>;
|
|
86
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
93
87
|
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>]>;
|
|
94
88
|
getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
|
|
95
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>]>;
|
|
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, {
|
|
90
|
+
}> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<T_1[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
103
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>]>;
|
|
104
|
-
}> extends infer
|
|
92
|
+
}> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<T_2[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
105
93
|
_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>]>;
|
|
106
|
-
}>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
94
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
107
95
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
108
96
|
}, "strict", z.ZodTypeAny, {
|
|
109
97
|
[x: string]: any;
|
|
@@ -126,34 +114,22 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
|
|
|
126
114
|
[x: string]: any;
|
|
127
115
|
}>;
|
|
128
116
|
getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
|
|
129
|
-
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]:
|
|
117
|
+
BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
130
118
|
EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
131
119
|
_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
|
-
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
|
|
120
|
+
}> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<T_3[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
133
121
|
_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>]>;
|
|
134
|
-
}>[k_2]>; } : never,
|
|
122
|
+
}> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<T_4[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
135
123
|
_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>]>;
|
|
136
|
-
}> extends infer
|
|
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">>;
|
|
124
|
+
}> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<T_5[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
|
|
143
125
|
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>]>;
|
|
144
126
|
UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
|
|
145
127
|
_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>]>;
|
|
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, {
|
|
128
|
+
}> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<T_6[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
|
|
153
129
|
_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>]>;
|
|
154
|
-
}> extends infer
|
|
130
|
+
}> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<T_7[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
|
|
155
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>]>;
|
|
156
|
-
}>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
132
|
+
}> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<T_8[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
|
|
157
133
|
[x: string]: z.ZodOptional<z.ZodTypeAny>;
|
|
158
134
|
}, "strict", z.ZodTypeAny, {
|
|
159
135
|
[x: string]: any;
|