@lyxa.ai/core 1.0.276 → 1.0.277

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.
@@ -13,7 +13,6 @@ export declare class Cart extends TimeStamps {
13
13
  shop: Ref<Shop>;
14
14
  deliveryAddress?: UserAddress;
15
15
  isGroupOrder?: boolean;
16
- deadlineToOrder?: Date;
17
16
  paymentPreference?: PaymentPreference;
18
17
  spendingLimitForGuest?: number;
19
18
  secondarySpendingLimitForGuest?: number;
@@ -30,7 +30,6 @@ let Cart = class Cart extends defaultClasses_1.TimeStamps {
30
30
  shop;
31
31
  deliveryAddress;
32
32
  isGroupOrder;
33
- deadlineToOrder;
34
33
  paymentPreference;
35
34
  spendingLimitForGuest;
36
35
  secondarySpendingLimitForGuest;
@@ -63,10 +62,6 @@ __decorate([
63
62
  (0, typegoose_1.prop)({ type: Boolean, default: false }),
64
63
  __metadata("design:type", Boolean)
65
64
  ], Cart.prototype, "isGroupOrder", void 0);
66
- __decorate([
67
- (0, typegoose_1.prop)({ type: Date }),
68
- __metadata("design:type", Date)
69
- ], Cart.prototype, "deadlineToOrder", void 0);
70
65
  __decorate([
71
66
  (0, typegoose_1.prop)({ type: String, enum: enum_1.PaymentPreference }),
72
67
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,6CAAoC;AACpC,4EAAqE;AACrE,kDAAwE;AACxE,0DAAqD;AACrD,sDAA8B;AAC9B,mCAAqC;AAErC,iDAAwC;AACxC,6CAAoC;AACpC,uDAA6C;AA0CtC,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,IAAI,CAAa;IAGjB,IAAI,CAAa;IAGjB,eAAe,CAAe;IAG9B,YAAY,CAAW;IAGvB,eAAe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,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,IAAA,iBAAO,EAAC,IAAI,CAAC,KAAK,EAAE;gBACpC,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACV,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CAgDhB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity, pre } from '@typegoose/typegoose';\nimport { Shop } from './shop.model';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { CartStatus, PaymentPreference } from '../../../utilities/enum';\nimport { UserAddress } from './shared/address.model';\nimport slugify from 'slugify';\nimport { randomBytes } from 'crypto';\n\nimport { Coupon } from './coupon.model';\nimport { User } from './user.model';\nimport { LineItem } from './line-item.model';\n\n/**\n * Cart configuration model using Typegoose with automatic slug generation\n */\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'carts',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ slug: 1 }, { unique: true, sparse: true })\n@index({ user: 1 })\n@index({ shop: 1 })\n@index({ status: 1 })\n@index(\n\t{ user: 1, shop: 1 },\n\t{\n\t\tunique: true,\n\t\tpartialFilterExpression: {\n\t\t\tstatus: { $in: [CartStatus.ACTIVE, CartStatus.LOCKED] },\n\t\t\tdeletedAt: null,\n\t\t},\n\t}\n)\n@pre<Cart>('save', async function (next) {\n\tif (this.title && !this.slug) {\n\t\tconst baseSlug = slugify(this.title, {\n\t\t\tlower: true,\n\t\t\tstrict: true,\n\t\t\ttrim: true,\n\t\t});\n\n\t\tconst uniqueId = randomBytes(8).toString('hex');\n\t\tthis.slug = `${baseSlug}-${uniqueId}`;\n\t}\n\tnext();\n})\nexport class Cart extends TimeStamps {\n\t@prop({ trim: true, maxlength: 100 })\n\tpublic title?: string;\n\n\t@prop()\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: false, type: UserAddress })\n\tpublic deliveryAddress?: UserAddress;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isGroupOrder?: boolean;\n\n\t@prop({ type: Date })\n\tpublic deadlineToOrder?: Date;\n\n\t@prop({ type: String, enum: PaymentPreference })\n\tpublic paymentPreference?: PaymentPreference;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic spendingLimitForGuest?: number;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic secondarySpendingLimitForGuest?: number;\n\n\t@prop({\n\t\tenum: CartStatus,\n\t\ttype: String,\n\t\tdefault: CartStatus.ACTIVE,\n\t\trequired: true,\n\t})\n\tpublic status!: CartStatus;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({\n\t\tref: () => LineItem,\n\t\tforeignField: 'cart',\n\t\tlocalField: '_id',\n\t})\n\tpublic lineItems: Ref<LineItem>[];\n}\n"]}
1
+ {"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,6CAAoC;AACpC,4EAAqE;AACrE,kDAAwE;AACxE,0DAAqD;AACrD,sDAA8B;AAC9B,mCAAqC;AAErC,iDAAwC;AACxC,6CAAoC;AACpC,uDAA6C;AA0CtC,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,2BAAU;IAE5B,KAAK,CAAU;IAGf,IAAI,CAAU;IAGd,IAAI,CAAa;IAG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AQ,GAAG,IAAA,iBAAO,EAAC,IAAI,CAAC,KAAK,EAAE;gBACpC,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACV,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CA8ChB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity, pre } from '@typegoose/typegoose';\nimport { Shop } from './shop.model';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { CartStatus, PaymentPreference } from '../../../utilities/enum';\nimport { UserAddress } from './shared/address.model';\nimport slugify from 'slugify';\nimport { randomBytes } from 'crypto';\n\nimport { Coupon } from './coupon.model';\nimport { User } from './user.model';\nimport { LineItem } from './line-item.model';\n\n/**\n * Cart configuration model using Typegoose with automatic slug generation\n */\n@modelOptions({\n\tschemaOptions: {\n\t\tcollection: 'carts',\n\t\ttoJSON: { virtuals: true },\n\t\ttoObject: { virtuals: true },\n\t},\n\toptions: {\n\t\tallowMixed: Severity.ALLOW,\n\t},\n})\n@index({ slug: 1 }, { unique: true, sparse: true })\n@index({ user: 1 })\n@index({ shop: 1 })\n@index({ status: 1 })\n@index(\n\t{ user: 1, shop: 1 },\n\t{\n\t\tunique: true,\n\t\tpartialFilterExpression: {\n\t\t\tstatus: { $in: [CartStatus.ACTIVE, CartStatus.LOCKED] },\n\t\t\tdeletedAt: null,\n\t\t},\n\t}\n)\n@pre<Cart>('save', async function (next) {\n\tif (this.title && !this.slug) {\n\t\tconst baseSlug = slugify(this.title, {\n\t\t\tlower: true,\n\t\t\tstrict: true,\n\t\t\ttrim: true,\n\t\t});\n\n\t\tconst uniqueId = randomBytes(8).toString('hex');\n\t\tthis.slug = `${baseSlug}-${uniqueId}`;\n\t}\n\tnext();\n})\nexport class Cart extends TimeStamps {\n\t@prop({ trim: true, maxlength: 100 })\n\tpublic title?: string;\n\n\t@prop()\n\tpublic slug?: string;\n\n\t@prop({ required: true, ref: () => User })\n\tpublic user!: Ref<User>;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: false, type: UserAddress })\n\tpublic deliveryAddress?: UserAddress;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isGroupOrder?: boolean;\n\n\n\t@prop({ type: String, enum: PaymentPreference })\n\tpublic paymentPreference?: PaymentPreference;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic spendingLimitForGuest?: number;\n\n\t@prop({ type: Number, default: Infinity })\n\tpublic secondarySpendingLimitForGuest?: number;\n\n\t@prop({\n\t\tenum: CartStatus,\n\t\ttype: String,\n\t\tdefault: CartStatus.ACTIVE,\n\t\trequired: true,\n\t})\n\tpublic status!: CartStatus;\n\n\t@prop({ ref: () => Coupon })\n\tpublic coupon?: Ref<Coupon>;\n\n\t@prop({\n\t\tref: () => LineItem,\n\t\tforeignField: 'cart',\n\t\tlocalField: '_id',\n\t})\n\tpublic lineItems: Ref<LineItem>[];\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, {}> & Omit<User & {
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;
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createPhoneVerifiedProcedure = createPhoneVerifiedProcedure;
4
4
  const server_1 = require("@trpc/server");
5
5
  const auth_1 = require("./auth");
6
+ const auth_2 = require("../../auth");
6
7
  const models_1 = require("../../mongo/models");
7
8
  function createPhoneVerifiedProcedure(options) {
8
9
  return (0, auth_1.createAuthenticatedProcedure)(options).use(async ({ ctx, next }) => {
9
10
  if (!ctx.entity) {
10
11
  throw new server_1.TRPCError({ code: 'UNAUTHORIZED', message: 'User not authenticated' });
11
12
  }
13
+ if (ctx.entity.type == auth_2.AuthEntityType.CRM)
14
+ return next({ ctx });
12
15
  const user = await models_1.UserModel.findOne({ _id: ctx.entity.id });
13
16
  if (!user) {
14
17
  throw new server_1.TRPCError({ code: 'UNAUTHORIZED', message: 'User not found' });
@@ -1 +1 @@
1
- {"version":3,"file":"phone-verified.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/phone-verified.ts"],"names":[],"mappings":";;AAaA,oEAkBC;AA/BD,yCAAyC;AACzC,iCAAsD;AAEtD,+CAA+C;AAU/C,SAAgB,4BAA4B,CAAC,OAA6B;IACzE,OAAO,IAAA,mCAA4B,EAAC,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;QACxE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,kBAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,kBAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,EAAE,CAAC;YACX,MAAM,IAAI,kBAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,eAAe;YACxB,MAAM,IAAI,kBAAS,CAAC;gBACnB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,yDAAyD;aAClE,CAAC,CAAC;QAEJ,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\nimport { createAuthenticatedProcedure } from './auth'; // Adjust import path!\nimport { AuthEntityType } from '../../auth';\nimport { UserModel } from '../../mongo/models';\n\ninterface PhoneVerifiedOptions {\n\tentityTypes: AuthEntityType[];\n}\n\n/**\n * A factory that creates a procedure requiring a verified phone number,\n * ensuring the user is authenticated and their phone is verified.\n */\nexport function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions) {\n\treturn createAuthenticatedProcedure(options).use(async ({ ctx, next }) => {\n\t\tif (!ctx.entity) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'User not authenticated' });\n\t\t}\n\n\t\tconst user = await UserModel.findOne({ _id: ctx.entity.id });\n\t\tif (!user) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'User not found' });\n\t\t}\n\t\tif (!user.isPhoneVerified)\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'FORBIDDEN',\n\t\t\t\tmessage: 'Please verify your phone number to access this resource',\n\t\t\t});\n\n\t\treturn next({ ctx });\n\t});\n}\n"]}
1
+ {"version":3,"file":"phone-verified.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/phone-verified.ts"],"names":[],"mappings":";;AAaA,oEAoBC;AAjCD,yCAAyC;AACzC,iCAAsD;AACtD,qCAA4C;AAC5C,+CAA+C;AAU/C,SAAgB,4BAA4B,CAAC,OAA6B;IACzE,OAAO,IAAA,mCAA4B,EAAC,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;QACxE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,kBAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC,CAAC;QAClF,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,qBAAc,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAEhE,MAAM,IAAI,GAAG,MAAM,kBAAS,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,EAAE,CAAC;YACX,MAAM,IAAI,kBAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,eAAe;YACxB,MAAM,IAAI,kBAAS,CAAC;gBACnB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,yDAAyD;aAClE,CAAC,CAAC;QAEJ,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { TRPCError } from '@trpc/server';\nimport { createAuthenticatedProcedure } from './auth'; // Adjust import path!\nimport { AuthEntityType } from '../../auth';\nimport { UserModel } from '../../mongo/models';\n\ninterface PhoneVerifiedOptions {\n\tentityTypes: AuthEntityType[];\n}\n\n/**\n * A factory that creates a procedure requiring a verified phone number,\n * ensuring the user is authenticated and their phone is verified.\n */\nexport function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions) {\n\treturn createAuthenticatedProcedure(options).use(async ({ ctx, next }) => {\n\t\tif (!ctx.entity) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'User not authenticated' });\n\t\t}\n\n\t\tif (ctx.entity.type == AuthEntityType.CRM) return next({ ctx });\n\n\t\tconst user = await UserModel.findOne({ _id: ctx.entity.id });\n\t\tif (!user) {\n\t\t\tthrow new TRPCError({ code: 'UNAUTHORIZED', message: 'User not found' });\n\t\t}\n\t\tif (!user.isPhoneVerified)\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: 'FORBIDDEN',\n\t\t\t\tmessage: 'Please verify your phone number to access this resource',\n\t\t\t});\n\n\t\treturn next({ ctx });\n\t});\n}\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.0.276
25
+ Version: 1.0.277
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.0.276",
3
+ "version": "1.0.277",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -504,7 +504,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
504
504
  totalPages: number;
505
505
  } | undefined;
506
506
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
507
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
507
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
508
508
  success: z.ZodBoolean;
509
509
  message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
510
510
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
@@ -542,7 +542,83 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
542
542
  totalPages: number;
543
543
  } | undefined;
544
544
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
545
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
545
+ }>, any>[k]; } : never, z.baseObjectInputType<{
546
+ success: z.ZodBoolean;
547
+ message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
548
+ data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
549
+ metadata: z.ZodOptional<z.ZodObject<{
550
+ page: z.ZodNumber;
551
+ size: z.ZodNumber;
552
+ totalElements: z.ZodNumber;
553
+ totalPages: z.ZodNumber;
554
+ }, "strip", z.ZodTypeAny, {
555
+ size: number;
556
+ page: number;
557
+ totalElements: number;
558
+ totalPages: number;
559
+ }, {
560
+ size: number;
561
+ page: number;
562
+ totalElements: number;
563
+ totalPages: number;
564
+ }>>;
565
+ documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
566
+ }, "strip", z.ZodTypeAny, {
567
+ documents: T[];
568
+ metadata?: {
569
+ size: number;
570
+ page: number;
571
+ totalElements: number;
572
+ totalPages: number;
573
+ } | undefined;
574
+ }, {
575
+ documents: T[];
576
+ metadata?: {
577
+ size: number;
578
+ page: number;
579
+ totalElements: number;
580
+ totalPages: number;
581
+ } | undefined;
582
+ }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
583
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
584
+ success: z.ZodBoolean;
585
+ message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
586
+ data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
587
+ metadata: z.ZodOptional<z.ZodObject<{
588
+ page: z.ZodNumber;
589
+ size: z.ZodNumber;
590
+ totalElements: z.ZodNumber;
591
+ totalPages: z.ZodNumber;
592
+ }, "strip", z.ZodTypeAny, {
593
+ size: number;
594
+ page: number;
595
+ totalElements: number;
596
+ totalPages: number;
597
+ }, {
598
+ size: number;
599
+ page: number;
600
+ totalElements: number;
601
+ totalPages: number;
602
+ }>>;
603
+ documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
604
+ }, "strip", z.ZodTypeAny, {
605
+ documents: T[];
606
+ metadata?: {
607
+ size: number;
608
+ page: number;
609
+ totalElements: number;
610
+ totalPages: number;
611
+ } | undefined;
612
+ }, {
613
+ documents: T[];
614
+ metadata?: {
615
+ size: number;
616
+ page: number;
617
+ totalElements: number;
618
+ totalPages: number;
619
+ } | undefined;
620
+ }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
621
+ }>[k_1]; } : never>;
546
622
  export declare const TokenSchema: z.ZodObject<{
547
623
  accessToken: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
548
624
  refreshToken: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
@@ -61,22 +61,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
61
61
  private baseSchema;
62
62
  constructor(baseFields: T, includeTimestamps?: boolean, includeTracking?: boolean);
63
63
  private createBaseSchema;
64
- 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>;
64
+ 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>;
65
65
  getEntitySchema(): z.ZodObject<z.objectUtil.extendShape<T, {
66
66
  _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>]>;
67
- }> 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, {
67
+ }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
68
68
  _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>]>;
69
- }> 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, {
69
+ }>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
70
70
  _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>]>;
71
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">>;
71
+ }> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
72
+ _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>]>;
73
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
74
+ _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>]>;
75
+ }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
76
+ _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>]>;
77
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
72
78
  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>]>;
73
79
  getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
74
80
  _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>]>;
75
- }> 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, {
81
+ }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
82
+ _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>]>;
83
+ }>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
84
+ _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>]>;
85
+ }> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
86
+ _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>]>;
87
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
76
88
  _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>]>;
77
- }> 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, {
89
+ }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
78
90
  _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>]>;
79
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
91
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
80
92
  [x: string]: z.ZodOptional<z.ZodTypeAny>;
81
93
  }, "strict", z.ZodTypeAny, {
82
94
  [x: string]: any;
@@ -99,22 +111,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
99
111
  [x: string]: any;
100
112
  }>;
101
113
  getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
102
- 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>;
114
+ 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>;
103
115
  EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
104
116
  _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>]>;
105
- }> 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, {
117
+ }> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
106
118
  _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>]>;
107
- }> 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, {
119
+ }>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
108
120
  _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>]>;
109
- }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<T_5[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
121
+ }> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
122
+ _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>]>;
123
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
124
+ _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>]>;
125
+ }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
126
+ _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>]>;
127
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
110
128
  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>]>;
111
129
  UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
112
130
  _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>]>;
113
- }> 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, {
131
+ }> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<z.objectUtil.extendShape<T, {
132
+ _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>]>;
133
+ }>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
134
+ _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>]>;
135
+ }> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<z.objectUtil.extendShape<T, {
136
+ _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>]>;
137
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
114
138
  _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>]>;
115
- }> 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, {
139
+ }> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
116
140
  _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>]>;
117
- }> 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<{
141
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
118
142
  [x: string]: z.ZodOptional<z.ZodTypeAny>;
119
143
  }, "strict", z.ZodTypeAny, {
120
144
  [x: string]: any;
@@ -504,7 +504,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
504
504
  totalPages: number;
505
505
  } | undefined;
506
506
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
507
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
507
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
508
508
  success: z.ZodBoolean;
509
509
  message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
510
510
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
@@ -542,7 +542,83 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
542
542
  totalPages: number;
543
543
  } | undefined;
544
544
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
545
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
545
+ }>, any>[k]; } : never, z.baseObjectInputType<{
546
+ success: z.ZodBoolean;
547
+ message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
548
+ data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
549
+ metadata: z.ZodOptional<z.ZodObject<{
550
+ page: z.ZodNumber;
551
+ size: z.ZodNumber;
552
+ totalElements: z.ZodNumber;
553
+ totalPages: z.ZodNumber;
554
+ }, "strip", z.ZodTypeAny, {
555
+ page: number;
556
+ size: number;
557
+ totalElements: number;
558
+ totalPages: number;
559
+ }, {
560
+ page: number;
561
+ size: number;
562
+ totalElements: number;
563
+ totalPages: number;
564
+ }>>;
565
+ documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
566
+ }, "strip", z.ZodTypeAny, {
567
+ documents: T[];
568
+ metadata?: {
569
+ page: number;
570
+ size: number;
571
+ totalElements: number;
572
+ totalPages: number;
573
+ } | undefined;
574
+ }, {
575
+ documents: T[];
576
+ metadata?: {
577
+ page: number;
578
+ size: number;
579
+ totalElements: number;
580
+ totalPages: number;
581
+ } | undefined;
582
+ }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
583
+ }> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
584
+ success: z.ZodBoolean;
585
+ message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
586
+ data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
587
+ metadata: z.ZodOptional<z.ZodObject<{
588
+ page: z.ZodNumber;
589
+ size: z.ZodNumber;
590
+ totalElements: z.ZodNumber;
591
+ totalPages: z.ZodNumber;
592
+ }, "strip", z.ZodTypeAny, {
593
+ page: number;
594
+ size: number;
595
+ totalElements: number;
596
+ totalPages: number;
597
+ }, {
598
+ page: number;
599
+ size: number;
600
+ totalElements: number;
601
+ totalPages: number;
602
+ }>>;
603
+ documents: z.ZodArray<z.ZodType<T, z.ZodTypeDef, T>, "many">;
604
+ }, "strip", z.ZodTypeAny, {
605
+ documents: T[];
606
+ metadata?: {
607
+ page: number;
608
+ size: number;
609
+ totalElements: number;
610
+ totalPages: number;
611
+ } | undefined;
612
+ }, {
613
+ documents: T[];
614
+ metadata?: {
615
+ page: number;
616
+ size: number;
617
+ totalElements: number;
618
+ totalPages: number;
619
+ } | undefined;
620
+ }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
621
+ }>[k_1]; } : never>;
546
622
  export declare const TokenSchema: z.ZodObject<{
547
623
  accessToken: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
548
624
  refreshToken: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
@@ -61,22 +61,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
61
61
  private baseSchema;
62
62
  constructor(baseFields: T, includeTimestamps?: boolean, includeTracking?: boolean);
63
63
  private createBaseSchema;
64
- 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>;
64
+ 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>;
65
65
  getEntitySchema(): z.ZodObject<z.objectUtil.extendShape<T, {
66
66
  _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>]>;
67
- }> 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, {
67
+ }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
68
68
  _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>]>;
69
- }> 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, {
69
+ }>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
70
70
  _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>]>;
71
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">>;
71
+ }> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
72
+ _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>]>;
73
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
74
+ _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>]>;
75
+ }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
76
+ _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>]>;
77
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
72
78
  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>]>;
73
79
  getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
74
80
  _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>]>;
75
- }> 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, {
81
+ }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
82
+ _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>]>;
83
+ }>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
84
+ _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>]>;
85
+ }> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
86
+ _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>]>;
87
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
76
88
  _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>]>;
77
- }> 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, {
89
+ }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
78
90
  _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>]>;
79
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
91
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
80
92
  [x: string]: z.ZodOptional<z.ZodTypeAny>;
81
93
  }, "strict", z.ZodTypeAny, {
82
94
  [x: string]: any;
@@ -99,22 +111,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
99
111
  [x: string]: any;
100
112
  }>;
101
113
  getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
102
- 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>;
114
+ 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>;
103
115
  EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
104
116
  _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>]>;
105
- }> 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, {
117
+ }> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
106
118
  _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>]>;
107
- }> 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, {
119
+ }>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
108
120
  _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>]>;
109
- }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<T_5[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
121
+ }> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
122
+ _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>]>;
123
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
124
+ _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>]>;
125
+ }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
126
+ _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>]>;
127
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
110
128
  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>]>;
111
129
  UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
112
130
  _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>]>;
113
- }> 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, {
131
+ }> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<z.objectUtil.extendShape<T, {
132
+ _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>]>;
133
+ }>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
134
+ _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>]>;
135
+ }> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<z.objectUtil.extendShape<T, {
136
+ _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>]>;
137
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
114
138
  _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>]>;
115
- }> 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, {
139
+ }> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
116
140
  _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>]>;
117
- }> 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<{
141
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
118
142
  [x: string]: z.ZodOptional<z.ZodTypeAny>;
119
143
  }, "strict", z.ZodTypeAny, {
120
144
  [x: string]: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.0.276",
3
+ "version": "1.0.277",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@
41
41
  "moment": "^2.30.1",
42
42
  "mongoose": "^8.13.0",
43
43
  "nanoid": "^5.1.5",
44
- "pino": "^9.5.0",
44
+ "pino": "9.5.0",
45
45
  "pino-mongodb": "^4.3.0",
46
46
  "pino-pretty": "^13.0.0",
47
47
  "sharp": "^0.33.5",