@lyxa.ai/core 1.1.76 → 1.1.77

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.
@@ -213,4 +213,10 @@ exports.Product = Product = __decorate([
213
213
  }),
214
214
  (0, typegoose_1.plugin)(normalize_field_plugin_1.normalizeFieldPlugin, { field: 'name' })
215
215
  ], Product);
216
+ _1.ProductModel.schema.pre('insertMany', async function (next, docs) {
217
+ for (const doc of docs) {
218
+ doc.productId = await (0, id_generator_1.generateId)(_1.CounterModel, enum_1.CounterType.ITEM);
219
+ }
220
+ next();
221
+ });
216
222
  //# sourceMappingURL=product.model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmF;AACnF,4EAAqE;AACrE,kDAOiC;AACjC,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiE;AACjE,0EAA2E;AAE3E,8EAAyE;AACzE,kEAA6D;AAC7D,0EAAgE;AA2BzD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,SAAS,CAAS;IAGlB,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,cAAc,CAAU;IAGxB,OAAO,CAAU;IAGjB,YAAY,CAAqB;IAGjC,QAAQ,CAAY;IAGpB,WAAW,CAAe;IAG1B,IAAI,CAAU;IAGd,MAAM,CAAY;IAGlB,WAAW,CAAe;IAG1B,eAAe,CAAoB;IAGnC,WAAW,CAAU;IAGrB,aAAa,CAAkB;IAG/B,MAAM,CAAkB;IAGxB,kBAAkB,CAAW;IAG7B,iBAAiB,CAAU;IAG3B,qBAAqB,CAAU;IAG/B,UAAU,CAAsB;IAGhC,YAAY,CAAwB;IAGpC,iBAAiB,CAAU;IAG3B,cAAc,CAAW;IAGzB,aAAa,CAAU;IAGvB,eAAe,CAA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AAE,KAAK;QAC1B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,MAAM,IAAA,yBAAU,EAAC,eAAY,EAAE,kBAAW,CAAC,IAAI,CAAC,CAAC;QACnE,CAAC;IACF,CAAC,CAAC;IACD,IAAA,kBAAM,EAAC,6CAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACnC,OAAO,CAsGnB","sourcesContent":["import { Index, modelOptions, plugin, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport {\n\tProductType,\n\tItemType,\n\tProductDietaryType,\n\tStatus,\n\tPriceOption,\n\tCounterType,\n} from '../../../utilities/enum';\nimport { ProductNutrition } from './embedded/product-nutrition.model';\nimport { Shop } from './shop.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { AttributeMap } from './embedded/attribute-map.model';\nimport { ShopCategory } from './shop-category.model';\nimport { CounterModel, ProductMarketing, ProductModel } from '.';\nimport { handlePreSaveForSorting } from '../utilities/sorting-order.hooks';\nimport { handlePreSaveForUniqueId } from '../utilities/unique-id.hooks';\nimport { normalizeFieldPlugin } from '../plugins/normalize-field.plugin';\nimport { generateId } from '../../../utilities/id-generator';\nimport { PreparingTime } from './embedded/preparing-time.model';\n\n@modelOptions({\n\tschemaOptions: { collection: 'products', toJSON: { virtuals: true }, toObject: { virtuals: true } },\n})\n@Index(\n\t{ nameNormalized: 1, shop: 1, shopCategory: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@Index({ shop: 1, shopCategory: 1 }, { partialFilterExpression: { deletedAt: null } })\n@Index({ shop: 1, isStockEnabled: 1, stockQuantity: 1 }, { partialFilterExpression: { deletedAt: null } })\n@Index({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } })\n@pre<Product>('save', async function (next) {\n\t// Set sortingOrder\n\tawait handlePreSaveForSorting.call(this, ProductModel, {\n\t\tshop: this.shop,\n\t\tshopCategory: this.shopCategory,\n\t});\n\n\tnext();\n})\n@pre<Product>('save', async function () {\n\tif (this.isNew) {\n\t\tthis.productId = await generateId(CounterModel, CounterType.ITEM);\n\t}\n})\n@plugin(normalizeFieldPlugin, { field: 'name' })\nexport class Product extends TimeStamps {\n\t@prop({ type: String, unique: true, index: true })\n\tpublic productId: string;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, trim: true, maxlength: 100 })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, lowercase: true, select: false })\n\tpublic nameNormalized?: string;\n\n\t@prop({ type: String, trim: true, maxlength: 50 })\n\tpublic barcode?: string;\n\n\t@prop({ required: true, ref: () => ShopCategory })\n\tpublic shopCategory!: Ref<ShopCategory>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: String, enum: ProductType })\n\tpublic productType?: ProductType;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: [String], default: [] })\n\tpublic images?: string[];\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: [PriceBreakdown] })\n\tpublic priceBreakdowns?: PriceBreakdown[];\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: [AttributeMap], default: [] })\n\tpublic attributeMaps?: AttributeMap[];\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic addons?: Ref<Product>[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isNutritionEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionPackSize?: number;\n\n\t@prop({ type: String })\n\tpublic nutritionPackSizeUnit?: string;\n\n\t@prop({ type: [ProductNutrition], default: [] })\n\tpublic nutritions?: ProductNutrition[];\n\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\n\tpublic dietaryTypes?: ProductDietaryType[];\n\n\t@prop({ type: Number, min: -9999, max: 9999 })\n\tpublic storedTemperature?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isStockEnabled?: boolean;\n\n\t@prop({ type: Number, max: 999999999 }) // isStockEnabled: true and stockQuantity < 1 means out of stock\n\tpublic stockQuantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isDrinkIncluded?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLargeItem?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPreOrderEnabled?: boolean;\n\n\t// this field needed when pre-order enabled\n\t@prop({ type: PreparingTime })\n\tpublic preparingTime?: PreparingTime;\n\n\t@prop({ type: Number, min: 0, max: 999999999 }) // 0 means, it is disable\n\tpublic orderQuantityLimit?: number;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic note?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({\n\t\tref: () => ProductMarketing,\n\t\tforeignField: 'product',\n\t\tlocalField: '_id',\n\t\tjustOne: true,\n\t})\n\tpublic productMarketing: Ref<ProductMarketing>; // Virtual reference to ProductMarketing\n}\n"]}
1
+ {"version":3,"file":"product.model.js","sourceRoot":"/","sources":["libraries/mongo/models/product.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmF;AACnF,4EAAqE;AACrE,kDAOiC;AACjC,gFAAsE;AACtE,6CAAoC;AACpC,4EAAkE;AAClE,wEAA8D;AAC9D,+DAAqD;AACrD,wBAAiE;AACjE,0EAA2E;AAE3E,8EAAyE;AACzE,kEAA6D;AAC7D,0EAAgE;AA2BzD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,2BAAU;IAE/B,SAAS,CAAS;IAGlB,IAAI,CAAa;IAGjB,IAAI,CAAU;IAGd,cAAc,CAAU;IAGxB,OAAO,CAAU;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,EAAE,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAC9E,IAAA,eAAG,EAAU,MAAM,EAAE,KAAK,WAAW,IAAI;QAEzC,MAAM,6CAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,eAAY,EAAE;YACtD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY;SAC/B,CAAC,CAAC;QAEH,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;IACD,IAAA,eAAG,EAAU,MAAM,EAAE,KAAK;QAC1B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,MAAM,IAAA,yBAAU,EAAC,eAAY,EAAE,kBAAW,CAAC,IAAI,CAAC,CAAC;QACnE,CAAC;IACF,CAAC,CAAC;IACD,IAAA,kBAAM,EAAC,6CAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;GACnC,OAAO,CAsGnB;AAED,eAAY,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,WAAW,IAAI,EAAE,IAAe;IAC1E,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,GAAG,CAAC,SAAS,GAAG,MAAM,IAAA,yBAAU,EAAC,eAAY,EAAE,kBAAW,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,EAAE,CAAC;AACR,CAAC,CAAC,CAAC","sourcesContent":["import { Index, modelOptions, plugin, pre, prop, Ref } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport {\n\tProductType,\n\tItemType,\n\tProductDietaryType,\n\tStatus,\n\tPriceOption,\n\tCounterType,\n} from '../../../utilities/enum';\nimport { ProductNutrition } from './embedded/product-nutrition.model';\nimport { Shop } from './shop.model';\nimport { PriceBreakdown } from './embedded/price-breakdown.model';\nimport { AttributeMap } from './embedded/attribute-map.model';\nimport { ShopCategory } from './shop-category.model';\nimport { CounterModel, ProductMarketing, ProductModel } from '.';\nimport { handlePreSaveForSorting } from '../utilities/sorting-order.hooks';\nimport { handlePreSaveForUniqueId } from '../utilities/unique-id.hooks';\nimport { normalizeFieldPlugin } from '../plugins/normalize-field.plugin';\nimport { generateId } from '../../../utilities/id-generator';\nimport { PreparingTime } from './embedded/preparing-time.model';\n\n@modelOptions({\n\tschemaOptions: { collection: 'products', toJSON: { virtuals: true }, toObject: { virtuals: true } },\n})\n@Index(\n\t{ nameNormalized: 1, shop: 1, shopCategory: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@Index({ shop: 1, shopCategory: 1 }, { partialFilterExpression: { deletedAt: null } })\n@Index({ shop: 1, isStockEnabled: 1, stockQuantity: 1 }, { partialFilterExpression: { deletedAt: null } })\n@Index({ nameNormalized: 1 }, { partialFilterExpression: { deletedAt: null } })\n@pre<Product>('save', async function (next) {\n\t// Set sortingOrder\n\tawait handlePreSaveForSorting.call(this, ProductModel, {\n\t\tshop: this.shop,\n\t\tshopCategory: this.shopCategory,\n\t});\n\n\tnext();\n})\n@pre<Product>('save', async function () {\n\tif (this.isNew) {\n\t\tthis.productId = await generateId(CounterModel, CounterType.ITEM);\n\t}\n})\n@plugin(normalizeFieldPlugin, { field: 'name' })\nexport class Product extends TimeStamps {\n\t@prop({ type: String, unique: true, index: true })\n\tpublic productId: string;\n\n\t@prop({ required: true, ref: () => Shop })\n\tpublic shop!: Ref<Shop>;\n\n\t@prop({ required: true, type: String, trim: true, maxlength: 100 })\n\tpublic name!: string;\n\n\t@prop({ type: String, trim: true, lowercase: true, select: false })\n\tpublic nameNormalized?: string;\n\n\t@prop({ type: String, trim: true, maxlength: 50 })\n\tpublic barcode?: string;\n\n\t@prop({ required: true, ref: () => ShopCategory })\n\tpublic shopCategory!: Ref<ShopCategory>;\n\n\t@prop({ required: true, type: String, enum: ItemType })\n\tpublic itemType!: ItemType;\n\n\t@prop({ type: String, enum: ProductType })\n\tpublic productType?: ProductType;\n\n\t@prop({ type: String })\n\tpublic logo?: string;\n\n\t@prop({ type: [String], default: [] })\n\tpublic images?: string[];\n\n\t@prop({ type: String, enum: PriceOption, default: PriceOption.SINGLE_PRICE })\n\tpublic priceOption?: PriceOption;\n\n\t@prop({ required: true, type: [PriceBreakdown] })\n\tpublic priceBreakdowns?: PriceBreakdown[];\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic description?: string;\n\n\t@prop({ type: [AttributeMap], default: [] })\n\tpublic attributeMaps?: AttributeMap[];\n\n\t@prop({ ref: () => Product, default: [] })\n\tpublic addons?: Ref<Product>[];\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isNutritionEnabled?: boolean;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic nutritionPackSize?: number;\n\n\t@prop({ type: String })\n\tpublic nutritionPackSizeUnit?: string;\n\n\t@prop({ type: [ProductNutrition], default: [] })\n\tpublic nutritions?: ProductNutrition[];\n\n\t@prop({ type: [String], enum: ProductDietaryType, default: [] })\n\tpublic dietaryTypes?: ProductDietaryType[];\n\n\t@prop({ type: Number, min: -9999, max: 9999 })\n\tpublic storedTemperature?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isStockEnabled?: boolean;\n\n\t@prop({ type: Number, max: 999999999 }) // isStockEnabled: true and stockQuantity < 1 means out of stock\n\tpublic stockQuantity?: number;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isDrinkIncluded?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isLargeItem?: boolean;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic isPreOrderEnabled?: boolean;\n\n\t// this field needed when pre-order enabled\n\t@prop({ type: PreparingTime })\n\tpublic preparingTime?: PreparingTime;\n\n\t@prop({ type: Number, min: 0, max: 999999999 }) // 0 means, it is disable\n\tpublic orderQuantityLimit?: number;\n\n\t@prop({ type: String, maxlength: 250 })\n\tpublic note?: string;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n\n\t@prop({\n\t\tref: () => ProductMarketing,\n\t\tforeignField: 'product',\n\t\tlocalField: '_id',\n\t\tjustOne: true,\n\t})\n\tpublic productMarketing: Ref<ProductMarketing>; // Virtual reference to ProductMarketing\n}\n\nProductModel.schema.pre('insertMany', async function (next, docs: Product[]) {\n\tfor (const doc of docs) {\n\t\tdoc.productId = await generateId(CounterModel, CounterType.ITEM);\n\t}\n\tnext();\n});\n"]}
@@ -32,7 +32,7 @@ export declare class User extends TimeStamps {
32
32
  isPhoneVerified?: boolean;
33
33
  onlineStatus?: OnlineStatus;
34
34
  fcmTokens?: string[];
35
- 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
+ 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 & {
36
36
  _id: import("mongoose").Types.ObjectId;
37
37
  } & {
38
38
  __v: number;
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.1.76
25
+ Version: 1.1.77
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.1.76",
3
+ "version": "1.1.77",
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",
@@ -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.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
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
- }>, any>[k]; } : never, z.baseObjectInputType<{
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]: 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>;
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, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
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 T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
87
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
88
- }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
89
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
90
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
91
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
92
- }>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
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 T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
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]: 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>;
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, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
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 T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
137
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
138
- }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
139
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
140
- }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
141
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
142
- }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
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 T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
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;
@@ -1 +1 @@
1
- {"version":3,"file":"id-generator.js","sourceRoot":"/","sources":["utilities/id-generator.ts"],"names":[],"mappings":";;AAqHA,gCAyBC;AA9ID,iCAAqC;AAGrC,SAAS,gBAAgB,CAAC,OAAe;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChC,IAAI,KAAK,GAAG,IAAI,CAAC;IAGjB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACtB,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACf,KAAK,GAAG,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACP,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3D,KAAK,GAAG,KAAK,CAAC;QACf,CAAC;IACF,CAAC;IAGD,IAAI,KAAK,EAAE,CAAC;QACX,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvB,CAAC;AAMD,SAAS,W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,EAAE,IAAI;KACzB,CACD,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IAG1C,MAAM,YAAY,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAG1G,OAAO,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { CounterType } from './enum';\n\n\nfunction incrementLetters(letters: string): string {\n\tconst chars = letters.split('');\n\tlet carry = true;\n\n\t// Increment from right to left\n\tfor (let i = chars.length - 1; i >= 0 && carry; i--) {\n\t\tif (chars[i] === 'Z') {\n\t\t\tchars[i] = 'A';\n\t\t\tcarry = true; // Carry continues\n\t\t} else {\n\t\t\tchars[i] = String.fromCharCode(chars[i].charCodeAt(0) + 1);\n\t\t\tcarry = false;\n\t\t}\n\t}\n\n\t// If still carrying (e.g., 'Z' or 'ZZZ'), add a new letter 'A'\n\tif (carry) {\n\t\treturn 'A' + chars.join('');\n\t}\n\n\treturn chars.join('');\n}\n\n/**\n * Get the next core value following your leveling rules.\n * Example: A0001 → ... → Z9999 → AA001 → ... → ZZZZZ → A00001\n */\nfunction getNextCore(core: string): string {\n\tconst totalLength = core.length;\n\n\t// Parse as letters + optional numbers\n\tconst match = core.match(/^([A-Z]+)(\\d*)$/);\n\tif (!match) throw new Error(`Invalid core format: ${core}`);\n\n\tlet letters = match[1];\n\tlet numbers = match[2];\n\n\t// --- SCENARIO 1: All Letters (e.g., AAAAA or ZZZZZ) ---\n\tif (numbers === '') {\n\t\t// If it's the max combination for this length (e.g., ZZZZZ)\n\t\tif (letters === 'Z'.repeat(totalLength)) {\n\t\t\t// FIX: ZZZZZ (Length 5) → A00001 (Length 6).\n\t\t\t// Need (CurrentLength - 1) zeros before the final '1'.\n\t\t\t// totalLength is 5, so we need 4 zeros.\n\t\t\treturn 'A' + '0'.repeat(totalLength - 1) + '1';\n\t\t}\n\n\t\t// Otherwise, it's just an all-letter increment (e.g., AAAAA → AAAAB)\n\t\treturn incrementLetters(letters);\n\t}\n\n\t// --- SCENARIO 2: Letters + Numbers (e.g., A0001) ---\n\n\tlet numValue = parseInt(numbers, 10);\n\tconst numLength = numbers.length;\n\t// const maxNum = parseInt('9'.repeat(numLength), 10);\n\tconst maxNum = Math.pow(10, numLength) - 1;\n\n\t// 1. Increment number first\n\tnumValue++;\n\n\t// 2. If number overflows, reset and increment letters\n\tif (numValue > maxNum) {\n\t\tnumValue = 1;\n\n\t\tconst oldLettersLength = letters.length;\n\t\tletters = incrementLetters(letters);\n\t\tconst newLettersLength = letters.length;\n\n\t\t// Check if the letter increment caused the letter length to expand (e.g., Z → AA)\n\t\tif (newLettersLength > oldLettersLength) {\n\t\t\t// The number of available digits must decrease to maintain total length\n\t\t\tconst letterExpansion = newLettersLength - oldLettersLength;\n\t\t\tconst newNumLength = numLength - letterExpansion;\n\n\t\t\t// If the number of digits is reduced to 0 or less (e.g., ZZZZ9 → AAAAA)\n\t\t\tif (newNumLength <= 0) {\n\t\t\t\tif (newLettersLength === totalLength) {\n\t\t\t\t\treturn letters; // Return the all-letter core (e.g., AAAAA)\n\t\t\t\t}\n\n\t\t\t\tif (newLettersLength > totalLength) {\n\t\t\t\t\treturn 'A'.repeat(totalLength);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If new number length is positive, pad the number (which is currently 1)\n\t\t\treturn letters + '1'.padStart(newNumLength, '0');\n\t\t}\n\t}\n\n\t// 3. Normal increment (A0001 → A0002) or letter carry-over without expansion (AA999 → AB001)\n\treturn letters + numValue.toString().padStart(numLength, '0');\n}\n\n// ----------------------------------------------------------------------\n\n/**\n * Get prefix for a counter type (Robust version)\n */\nfunction getPrefixForType(counterType: CounterType): string {\n\tconst prefixMap: Record<string, string> = {\n\t\t[CounterType.USER]: 'U',\n\t\t[CounterType.RIDER]: 'R',\n\t\t[CounterType.PARENT]: 'P',\n\t\t[CounterType.SHOP]: 'S',\n\t\t[CounterType.ITEM]: 'I',\n\t\t[CounterType.TRANSACTION]: 'T',\n\t};\n\t// Ensure a string is always returned\n\treturn prefixMap[counterType] || 'X';\n}\n\n\nexport async function generateId(CounterModel: any, counterType: CounterType): Promise<string> {\n\tconst prefix = getPrefixForType(counterType);\n\tconst initialCore = 'A0001';\n\n\t// 1. Fetch the current state OR initialize it.\n\tlet currentDoc = await CounterModel.findOneAndUpdate(\n\t\t{ counterType },\n\t\t{\n\t\t\t$setOnInsert: { core: initialCore },\n\t\t},\n\t\t{\n\t\t\tupsert: true,\n\t\t\tnew: true, // Returns the current DB state after potential insertion\n\t\t\tsetDefaultsOnInsert: true,\n\t\t}\n\t).lean();\n\n\tconst coreToIssue = currentDoc.core;\n\tconst nextCore = getNextCore(coreToIssue);\n\n\t// 2. Unconditionally update the counter to the next value.\n\tawait CounterModel.findOneAndUpdate({ counterType }, { $set: { core: nextCore } }, { new: false }).lean();\n\n\t// 3. Return the ID based on the value read in Step 1.\n\treturn `${prefix}${coreToIssue}`;\n}\n\n// ----------------------------------------------------------------------\n\n"]}
1
+ {"version":3,"file":"id-generator.js","sourceRoot":"/","sources":["utilities/id-generator.ts"],"names":[],"mappings":";;AAmHA,gCAyBC;AA5ID,iCAAqC;AAErC,SAAS,gBAAgB,CAAC,OAAe;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAChC,IAAI,KAAK,GAAG,IAAI,CAAC;IAGjB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACtB,K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vB,CAAC,kBAAW,CAAC,WAAW,CAAC,EAAE,GAAG;KAC9B,CAAC;IAEF,OAAO,SAAS,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC;AACtC,CAAC;AAEM,KAAK,UAAU,UAAU,CAAC,YAAiB,EAAE,WAAwB;IAC3E,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,CAAC;IAG5B,IAAI,UAAU,GAAG,MAAM,YAAY,CAAC,gBAAgB,CACnD,EAAE,WAAW,EAAE,EACf;QACC,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;KACnC,EACD;QACC,MAAM,EAAE,IAAI;QACZ,GAAG,EAAE,IAAI;QACT,mBAAmB,EAAE,IAAI;KACzB,CACD,CAAC,IAAI,EAAE,CAAC;IAET,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IAG1C,MAAM,YAAY,CAAC,gBAAgB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAG1G,OAAO,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { CounterType } from './enum';\n\nfunction incrementLetters(letters: string): string {\n\tconst chars = letters.split('');\n\tlet carry = true;\n\n\t// Increment from right to left\n\tfor (let i = chars.length - 1; i >= 0 && carry; i--) {\n\t\tif (chars[i] === 'Z') {\n\t\t\tchars[i] = 'A';\n\t\t\tcarry = true; // Carry continues\n\t\t} else {\n\t\t\tchars[i] = String.fromCharCode(chars[i].charCodeAt(0) + 1);\n\t\t\tcarry = false;\n\t\t}\n\t}\n\n\t// If still carrying (e.g., 'Z' or 'ZZZ'), add a new letter 'A'\n\tif (carry) {\n\t\treturn 'A' + chars.join('');\n\t}\n\n\treturn chars.join('');\n}\n\n/**\n * Get the next core value following your leveling rules.\n * Example: A0001 → ... → Z9999 → AA001 → ... → ZZZZZ → A00001\n */\nfunction getNextCore(core: string): string {\n\tconst totalLength = core.length;\n\n\t// Parse as letters + optional numbers\n\tconst match = core.match(/^([A-Z]+)(\\d*)$/);\n\tif (!match) throw new Error(`Invalid core format: ${core}`);\n\n\tlet letters = match[1];\n\tlet numbers = match[2];\n\n\t// --- SCENARIO 1: All Letters (e.g., AAAAA or ZZZZZ) ---\n\tif (numbers === '') {\n\t\t// If it's the max combination for this length (e.g., ZZZZZ)\n\t\tif (letters === 'Z'.repeat(totalLength)) {\n\t\t\t// FIX: ZZZZZ (Length 5) → A00001 (Length 6).\n\t\t\t// Need (CurrentLength - 1) zeros before the final '1'.\n\t\t\t// totalLength is 5, so we need 4 zeros.\n\t\t\treturn 'A' + '0'.repeat(totalLength - 1) + '1';\n\t\t}\n\n\t\t// Otherwise, it's just an all-letter increment (e.g., AAAAA → AAAAB)\n\t\treturn incrementLetters(letters);\n\t}\n\n\t// --- SCENARIO 2: Letters + Numbers (e.g., A0001) ---\n\n\tlet numValue = parseInt(numbers, 10);\n\tconst numLength = numbers.length;\n\t// const maxNum = parseInt('9'.repeat(numLength), 10);\n\tconst maxNum = Math.pow(10, numLength) - 1;\n\n\t// 1. Increment number first\n\tnumValue++;\n\n\t// 2. If number overflows, reset and increment letters\n\tif (numValue > maxNum) {\n\t\tnumValue = 1;\n\n\t\tconst oldLettersLength = letters.length;\n\t\tletters = incrementLetters(letters);\n\t\tconst newLettersLength = letters.length;\n\n\t\t// Check if the letter increment caused the letter length to expand (e.g., Z → AA)\n\t\tif (newLettersLength > oldLettersLength) {\n\t\t\t// The number of available digits must decrease to maintain total length\n\t\t\tconst letterExpansion = newLettersLength - oldLettersLength;\n\t\t\tconst newNumLength = numLength - letterExpansion;\n\n\t\t\t// If the number of digits is reduced to 0 or less (e.g., ZZZZ9 → AAAAA)\n\t\t\tif (newNumLength <= 0) {\n\t\t\t\tif (newLettersLength === totalLength) {\n\t\t\t\t\treturn letters; // Return the all-letter core (e.g., AAAAA)\n\t\t\t\t}\n\n\t\t\t\tif (newLettersLength > totalLength) {\n\t\t\t\t\treturn 'A'.repeat(totalLength);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If new number length is positive, pad the number (which is currently 1)\n\t\t\treturn letters + '1'.padStart(newNumLength, '0');\n\t\t}\n\t}\n\n\t// 3. Normal increment (A0001 → A0002) or letter carry-over without expansion (AA999 → AB001)\n\treturn letters + numValue.toString().padStart(numLength, '0');\n}\n\n// ----------------------------------------------------------------------\n\n/**\n * Get prefix for a counter type (Robust version)\n */\nfunction getPrefixForType(counterType: CounterType): string {\n\tconst prefixMap: Record<string, string> = {\n\t\t[CounterType.USER]: 'U',\n\t\t[CounterType.RIDER]: 'R',\n\t\t[CounterType.PARENT]: 'P',\n\t\t[CounterType.SHOP]: 'S',\n\t\t[CounterType.ITEM]: 'I',\n\t\t[CounterType.TRANSACTION]: 'T',\n\t};\n\t// Ensure a string is always returned\n\treturn prefixMap[counterType] || 'X';\n}\n\nexport async function generateId(CounterModel: any, counterType: CounterType): Promise<string> {\n\tconst prefix = getPrefixForType(counterType);\n\tconst initialCore = 'A0001';\n\n\t// 1. Fetch the current state OR initialize it.\n\tlet currentDoc = await CounterModel.findOneAndUpdate(\n\t\t{ counterType },\n\t\t{\n\t\t\t$setOnInsert: { core: initialCore },\n\t\t},\n\t\t{\n\t\t\tupsert: true,\n\t\t\tnew: true, // Returns the current DB state after potential insertion\n\t\t\tsetDefaultsOnInsert: true,\n\t\t}\n\t).lean();\n\n\tconst coreToIssue = currentDoc.core;\n\tconst nextCore = getNextCore(coreToIssue);\n\n\t// 2. Unconditionally update the counter to the next value.\n\tawait CounterModel.findOneAndUpdate({ counterType }, { $set: { core: nextCore } }, { new: false }).lean();\n\n\t// 3. Return the ID based on the value read in Step 1.\n\treturn `${prefix}${coreToIssue}`;\n}\n\n// ----------------------------------------------------------------------\n"]}
@@ -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.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
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
- }>, any>[k]; } : never, z.baseObjectInputType<{
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]: 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>;
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, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
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 T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
87
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
88
- }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
89
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
90
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
91
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
92
- }>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
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 T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
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]: 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>;
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, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
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 T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
137
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
138
- }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
139
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
140
- }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
141
- _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
142
- }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
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 T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.1.76",
3
+ "version": "1.1.77",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",