@lyxa.ai/core 1.1.44 → 1.1.46

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.
@@ -76,22 +76,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
76
76
  private baseSchema;
77
77
  constructor(baseFields: T, includeTimestamps?: boolean, includeTracking?: boolean);
78
78
  private createBaseSchema;
79
- getBaseSchema(): z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[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]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<T>[k_1]; } : never>;
80
80
  getEntitySchema(): z.ZodObject<z.objectUtil.extendShape<T, {
81
81
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
82
- }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<T_1[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
82
+ }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
83
83
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
84
- }> 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, {
84
+ }>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
85
85
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
86
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">>;
86
+ }> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
87
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
88
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
89
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
90
+ }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
91
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
92
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">>;
87
93
  getIdSchema(): z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
88
94
  getUpdateSchema(excludeFields?: ExcludeFromUpdate): z.ZodObject<z.objectUtil.extendShape<T, {
89
95
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
90
- }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<T_1[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
96
+ }> extends infer T_1 extends z.ZodRawShape ? { [k in keyof T_1]: z.ZodOptional<z.objectUtil.extendShape<T, {
97
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
98
+ }>[k]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
99
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
100
+ }> extends infer T_2 extends z.ZodRawShape ? { [k in keyof T_2]: z.ZodOptional<z.objectUtil.extendShape<T, {
101
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
102
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
91
103
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
92
- }> extends infer 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, {
104
+ }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
93
105
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
94
- }> extends infer T_3 extends z.ZodRawShape ? { [k in keyof T_3]: z.ZodOptional<T_3[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
106
+ }>[k]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
95
107
  [x: string]: z.ZodOptional<z.ZodTypeAny>;
96
108
  }, "strict", z.ZodTypeAny, {
97
109
  [x: string]: any;
@@ -114,22 +126,34 @@ export declare class SchemaBuilder<T extends z.ZodRawShape> {
114
126
  [x: string]: any;
115
127
  }>;
116
128
  getAllSchemas(excludeFromUpdate?: ExcludeFromUpdate): {
117
- BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
129
+ BaseSchema: z.ZodObject<T, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any>[k]; } : never, z.baseObjectInputType<T> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<T>[k_1]; } : never>;
118
130
  EntitySchema: z.ZodObject<z.objectUtil.extendShape<T, {
119
131
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
120
- }> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<T_3[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
132
+ }> extends infer T_3 extends z.ZodRawShape ? { [k_2 in keyof T_3]: z.ZodOptional<z.objectUtil.extendShape<T, {
121
133
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
122
- }> 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, {
134
+ }>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
123
135
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
124
- }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<T_5[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
136
+ }> extends infer T_4 extends z.ZodRawShape ? { [k_2 in keyof T_4]: z.ZodOptional<z.objectUtil.extendShape<T, {
137
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
138
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
139
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
140
+ }> extends infer T_5 extends z.ZodRawShape ? { [k_2 in keyof T_5]: z.ZodOptional<z.objectUtil.extendShape<T, {
141
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
142
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">>;
125
143
  IdSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
126
144
  UpdateSchema: z.ZodObject<z.objectUtil.extendShape<T, {
127
145
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
128
- }> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<T_6[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
146
+ }> extends infer T_6 extends z.ZodRawShape ? { [k_2 in keyof T_6]: z.ZodOptional<z.objectUtil.extendShape<T, {
147
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
148
+ }>[k_2]>; } : never, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<T, {
149
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
150
+ }> extends infer T_7 extends z.ZodRawShape ? { [k_2 in keyof T_7]: z.ZodOptional<z.objectUtil.extendShape<T, {
151
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
152
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<T, {
129
153
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
130
- }> extends infer 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, {
154
+ }> extends infer T_8 extends z.ZodRawShape ? { [k_2 in keyof T_8]: z.ZodOptional<z.objectUtil.extendShape<T, {
131
155
  _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>;
132
- }> 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<{
156
+ }>[k_2]>; } : never, z.ZodTypeAny, "passthrough">> | z.ZodObject<{
133
157
  [x: string]: z.ZodOptional<z.ZodTypeAny>;
134
158
  }, "strict", z.ZodTypeAny, {
135
159
  [x: string]: any;
@@ -2,30 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateId = generateId;
4
4
  const enum_1 = require("./enum");
5
- function getNextCore(core) {
6
- const match = core.match(/^([A-Z]+)(\d*)$/);
7
- if (!match)
8
- throw new Error(`Invalid core format: ${core}`);
9
- let letters = match[1];
10
- let numbers = match[2] || '1';
11
- let numberLength = numbers.length;
12
- let number = parseInt(numbers, 10);
13
- const maxNumber = parseInt('9'.repeat(numberLength), 10);
14
- const isMaxCore = letters.split('').every(c => c === 'Z') && number === maxNumber;
15
- if (isMaxCore) {
16
- numberLength += 1;
17
- number = 1;
18
- letters = 'A'.repeat(letters.length);
19
- return `${letters}${number.toString().padStart(numberLength, '0')}`;
20
- }
21
- number++;
22
- if (number > maxNumber) {
23
- number = 1;
24
- letters = incrementLettersLevel(letters);
25
- }
26
- return `${letters}${number.toString().padStart(numberLength, '0')}`;
27
- }
28
- function incrementLettersLevel(letters) {
5
+ function incrementLetters(letters) {
29
6
  const chars = letters.split('');
30
7
  let carry = true;
31
8
  for (let i = chars.length - 1; i >= 0 && carry; i--) {
@@ -38,10 +15,49 @@ function incrementLettersLevel(letters) {
38
15
  carry = false;
39
16
  }
40
17
  }
41
- if (carry)
18
+ if (carry) {
42
19
  return 'A' + chars.join('');
20
+ }
43
21
  return chars.join('');
44
22
  }
23
+ function getNextCore(core) {
24
+ const totalLength = core.length;
25
+ const match = core.match(/^([A-Z]+)(\d*)$/);
26
+ if (!match)
27
+ throw new Error(`Invalid core format: ${core}`);
28
+ let letters = match[1];
29
+ let numbers = match[2];
30
+ if (numbers === '') {
31
+ if (letters === 'Z'.repeat(totalLength)) {
32
+ return 'A' + '0'.repeat(totalLength - 1) + '1';
33
+ }
34
+ return incrementLetters(letters);
35
+ }
36
+ let numValue = parseInt(numbers, 10);
37
+ const numLength = numbers.length;
38
+ const maxNum = Math.pow(10, numLength) - 1;
39
+ numValue++;
40
+ if (numValue > maxNum) {
41
+ numValue = 1;
42
+ const oldLettersLength = letters.length;
43
+ letters = incrementLetters(letters);
44
+ const newLettersLength = letters.length;
45
+ if (newLettersLength > oldLettersLength) {
46
+ const letterExpansion = newLettersLength - oldLettersLength;
47
+ const newNumLength = numLength - letterExpansion;
48
+ if (newNumLength <= 0) {
49
+ if (newLettersLength === totalLength) {
50
+ return letters;
51
+ }
52
+ if (newLettersLength > totalLength) {
53
+ return 'A'.repeat(totalLength);
54
+ }
55
+ }
56
+ return letters + '1'.padStart(newNumLength, '0');
57
+ }
58
+ }
59
+ return letters + numValue.toString().padStart(numLength, '0');
60
+ }
45
61
  function getPrefixForType(counterType) {
46
62
  const prefixMap = {
47
63
  [enum_1.CounterType.USER]: 'U',
@@ -51,22 +67,21 @@ function getPrefixForType(counterType) {
51
67
  [enum_1.CounterType.ITEM]: 'I',
52
68
  [enum_1.CounterType.TRANSACTION]: 'T',
53
69
  };
54
- return prefixMap[counterType];
70
+ return prefixMap[counterType] || 'X';
55
71
  }
56
72
  async function generateId(CounterModel, counterType) {
57
73
  const prefix = getPrefixForType(counterType);
58
74
  const initialCore = 'A0001';
59
- let counterDoc = await CounterModel.findOne({ counterType }).lean();
60
- if (!counterDoc) {
61
- await CounterModel.create({ counterType, core: initialCore });
62
- counterDoc = { core: initialCore };
63
- }
64
- const currentCore = counterDoc.core;
65
- const nextCore = getNextCore(currentCore);
66
- const updatedDoc = await CounterModel.findOneAndUpdate({ counterType, core: currentCore }, { $set: { core: nextCore } }, { new: false }).lean();
67
- if (!updatedDoc) {
68
- return generateId(CounterModel, counterType);
69
- }
70
- return `${prefix}${currentCore}`;
75
+ let currentDoc = await CounterModel.findOneAndUpdate({ counterType }, {
76
+ $setOnInsert: { core: initialCore },
77
+ }, {
78
+ upsert: true,
79
+ new: true,
80
+ setDefaultsOnInsert: true,
81
+ }).lean();
82
+ const coreToIssue = currentDoc.core;
83
+ const nextCore = getNextCore(coreToIssue);
84
+ await CounterModel.findOneAndUpdate({ counterType }, { $set: { core: nextCore } }, { new: false }).lean();
85
+ return `${prefix}${coreToIssue}`;
71
86
  }
72
87
  //# sourceMappingURL=id-generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"id-generator.js","sourceRoot":"/","sources":["utilities/id-generator.ts"],"names":[],"mappings":";;AA2EA,gCA6BC;AAxGD,iCAAqC;AAMrC,SAAS,WAAW,CAAC,IAAY;IAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;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AG,OAAO,CAAC;IAE5B,IAAI,UAAU,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAEpE,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,MAAM,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QAC9D,UAAU,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC;IACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAClD,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EAClC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAC5B,EAAE,GAAG,EAAE,KAAK,EAAE,CACjB,CAAC,IAAI,EAAE,CAAC;IAET,IAAI,CAAC,UAAU,EAAE,CAAC;QAEd,OAAO,UAAU,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import { CounterType } from './enum';\n\n/**\n * Get the next core value following your leveling rules.\n * Example: A0001 → A0002 → ... → A9999B0001 → ... → ZZZZZ → A00001\n */\nfunction getNextCore(core: string): string {\n const match = core.match(/^([A-Z]+)(\\d*)$/); // allow optional numbers\n if (!match) throw new Error(`Invalid core format: ${core}`);\n\n let letters = match[1];\n let numbers = match[2] || '1'; // default to 1 if missing\n\n let numberLength = numbers.length;\n let number = parseInt(numbers, 10);\n\n const maxNumber = parseInt('9'.repeat(numberLength), 10);\n\n // Check if we are at the final state: all letters are Z and number is max\n const isMaxCore = letters.split('').every(c => c === 'Z') && number === maxNumber;\n\n if (isMaxCore) {\n // Increase numeric length and reset letters to A\n numberLength += 1;\n number = 1;\n letters = 'A'.repeat(letters.length); // or just 'A' if you want single letter prefix\n return `${letters}${number.toString().padStart(numberLength, '0')}`;\n }\n\n // Normal increment\n number++;\n if (number > maxNumber) {\n number = 1;\n letters = incrementLettersLevel(letters);\n }\n\n return `${letters}${number.toString().padStart(numberLength, '0')}`;\n}\n\nfunction incrementLettersLevel(letters: string): string {\n const chars = letters.split('');\n let carry = true;\n\n for (let i = chars.length - 1; i >= 0 && carry; i--) {\n if (chars[i] === 'Z') {\n chars[i] = 'A';\n carry = true;\n } else {\n chars[i] = String.fromCharCode(chars[i].charCodeAt(0) + 1);\n carry = false;\n }\n }\n\n if (carry) return 'A' + chars.join('');\n return chars.join('');\n}\n\n/**\n * Get prefix for a counter type\n */\nfunction getPrefixForType(counterType: CounterType): string {\n const prefixMap: any = {\n [CounterType.USER]: 'U',\n [CounterType.RIDER]: 'R',\n [CounterType.PARENT]: 'P',\n [CounterType.SHOP]: 'S',\n [CounterType.ITEM]: 'I',\n [CounterType.TRANSACTION]: 'T',\n };\n return prefixMap[counterType];\n}\n\n/**\n * Generate a new unique ID for a given counter type\n */\nexport async function generateId(\n CounterModel: any,\n counterType: CounterType\n): Promise<string> {\n const prefix = getPrefixForType(counterType);\n const initialCore = 'A0001';\n\n let counterDoc = await CounterModel.findOne({ counterType }).lean();\n\n if (!counterDoc) {\n await CounterModel.create({ counterType, core: initialCore });\n counterDoc = { core: initialCore };\n }\n\n const currentCore = counterDoc.core;\n const nextCore = getNextCore(currentCore);\n\n const updatedDoc = await CounterModel.findOneAndUpdate(\n { counterType, core: currentCore },\n { $set: { core: nextCore } },\n { new: false }\n ).lean();\n\n if (!updatedDoc) {\n // Retry if another process updated the counter\n return generateId(CounterModel, counterType);\n }\n\n return `${prefix}${currentCore}`;\n}\n"]}
1
+ {"version":3,"file":"id-generator.js","sourceRoot":"/","sources":["utilities/id-generator.ts"],"names":[],"mappings":";;AAqHA,gCAyBC;AA9ID,iCAAqC;AAGrC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ters(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 → ... → Z9999AA001 → ... → 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,7 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { DTO } from './global-validation';
3
3
  import { ActionType, GeoLocationType, HolidayWorkStatus, WeekDay, WorkStatus } from '../enum';
4
- import { mongoose } from '@typegoose/typegoose';
5
4
  export declare const FilterSchema: z.ZodOptional<z.ZodObject<{
6
5
  size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
6
  page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
@@ -62,7 +61,7 @@ export declare const AddressSchema: z.ZodObject<{
62
61
  }>;
63
62
  latitude: z.ZodNumber;
64
63
  longitude: z.ZodNumber;
65
- zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>>;
64
+ zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
66
65
  }, "strip", z.ZodTypeAny, {
67
66
  location: {
68
67
  type: GeoLocationType;
@@ -75,7 +74,7 @@ export declare const AddressSchema: z.ZodObject<{
75
74
  longitude: number;
76
75
  state?: string | undefined;
77
76
  description?: string | undefined;
78
- zone?: mongoose.Types.ObjectId | undefined;
77
+ zone?: import("mongoose").Types.ObjectId | undefined;
79
78
  }, {
80
79
  location: {
81
80
  coordinates: [number, number];
@@ -88,7 +87,7 @@ export declare const AddressSchema: z.ZodObject<{
88
87
  longitude: number;
89
88
  state?: string | undefined;
90
89
  description?: string | undefined;
91
- zone?: string | mongoose.Types.ObjectId | undefined;
90
+ zone?: string | import("mongoose").Types.ObjectId | undefined;
92
91
  }>;
93
92
  export type AddressDTO = DTO<typeof AddressSchema>;
94
93
  export declare const UserAddressSchema: z.ZodObject<{
@@ -109,7 +108,7 @@ export declare const UserAddressSchema: z.ZodObject<{
109
108
  }>;
110
109
  latitude: z.ZodNumber;
111
110
  longitude: z.ZodNumber;
112
- zone: z.ZodOptional<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
+ zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
113
112
  } & {
114
113
  addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
115
114
  apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
@@ -131,7 +130,7 @@ export declare const UserAddressSchema: z.ZodObject<{
131
130
  buildingName: string;
132
131
  state?: string | undefined;
133
132
  description?: string | undefined;
134
- zone?: mongoose.Types.ObjectId | undefined;
133
+ zone?: import("mongoose").Types.ObjectId | undefined;
135
134
  deliveryOption?: string | undefined;
136
135
  instructions?: string | undefined;
137
136
  }, {
@@ -149,7 +148,7 @@ export declare const UserAddressSchema: z.ZodObject<{
149
148
  buildingName: string;
150
149
  state?: string | undefined;
151
150
  description?: string | undefined;
152
- zone?: string | mongoose.Types.ObjectId | undefined;
151
+ zone?: string | import("mongoose").Types.ObjectId | undefined;
153
152
  deliveryOption?: string | undefined;
154
153
  instructions?: string | undefined;
155
154
  }>;
@@ -172,7 +171,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
172
171
  }>;
173
172
  latitude: z.ZodNumber;
174
173
  longitude: z.ZodNumber;
175
- zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>>;
174
+ zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
176
175
  } & {
177
176
  addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
178
177
  apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
@@ -180,7 +179,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
180
179
  deliveryOption: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
181
180
  instructions: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
182
181
  } & {
183
- _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>]>;
182
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
184
183
  }, "strip", z.ZodTypeAny, {
185
184
  location: {
186
185
  type: GeoLocationType;
@@ -188,7 +187,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
188
187
  };
189
188
  address: string;
190
189
  country: string;
191
- _id: mongoose.Types.ObjectId;
190
+ _id: import("mongoose").Types.ObjectId;
192
191
  city: string;
193
192
  latitude: number;
194
193
  longitude: number;
@@ -197,7 +196,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
197
196
  buildingName: string;
198
197
  state?: string | undefined;
199
198
  description?: string | undefined;
200
- zone?: mongoose.Types.ObjectId | undefined;
199
+ zone?: import("mongoose").Types.ObjectId | undefined;
201
200
  deliveryOption?: string | undefined;
202
201
  instructions?: string | undefined;
203
202
  }, {
@@ -207,7 +206,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
207
206
  };
208
207
  address: string;
209
208
  country: string;
210
- _id: string | mongoose.Types.ObjectId;
209
+ _id: string | import("mongoose").Types.ObjectId;
211
210
  city: string;
212
211
  latitude: number;
213
212
  longitude: number;
@@ -216,7 +215,7 @@ export declare const RegularOrderAddressSchema: z.ZodObject<{
216
215
  buildingName: string;
217
216
  state?: string | undefined;
218
217
  description?: string | undefined;
219
- zone?: string | mongoose.Types.ObjectId | undefined;
218
+ zone?: string | import("mongoose").Types.ObjectId | undefined;
220
219
  deliveryOption?: string | undefined;
221
220
  instructions?: string | undefined;
222
221
  }>;
@@ -239,7 +238,7 @@ export declare const CourierAddressSchema: z.ZodObject<{
239
238
  }>;
240
239
  latitude: z.ZodNumber;
241
240
  longitude: z.ZodNumber;
242
- zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, mongoose.Types.ObjectId, string>, z.ZodType<mongoose.Types.ObjectId, z.ZodTypeDef, mongoose.Types.ObjectId>]>>;
241
+ zone: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>>;
243
242
  } & {
244
243
  addressLabel: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
245
244
  apartment: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
@@ -266,7 +265,7 @@ export declare const CourierAddressSchema: z.ZodObject<{
266
265
  phoneNumber: string;
267
266
  state?: string | undefined;
268
267
  description?: string | undefined;
269
- zone?: mongoose.Types.ObjectId | undefined;
268
+ zone?: import("mongoose").Types.ObjectId | undefined;
270
269
  deliveryOption?: string | undefined;
271
270
  instructions?: string | undefined;
272
271
  }, {
@@ -286,7 +285,7 @@ export declare const CourierAddressSchema: z.ZodObject<{
286
285
  phoneNumber: string;
287
286
  state?: string | undefined;
288
287
  description?: string | undefined;
289
- zone?: string | mongoose.Types.ObjectId | undefined;
288
+ zone?: string | import("mongoose").Types.ObjectId | undefined;
290
289
  deliveryOption?: string | undefined;
291
290
  instructions?: string | undefined;
292
291
  }>;
@@ -647,7 +646,7 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
647
646
  totalPages: number;
648
647
  } | undefined;
649
648
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
650
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
649
+ }>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
651
650
  success: z.ZodBoolean;
652
651
  message: z.ZodString | z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
653
652
  data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
@@ -685,7 +684,83 @@ export declare const createResponseSchema: <T>(schema: z.ZodSchema<T>) => z.ZodO
685
684
  totalPages: number;
686
685
  } | undefined;
687
686
  }>, z.ZodType<T, z.ZodTypeDef, T>]>>;
688
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
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>;
689
764
  export type PaginatedDTO<T> = {
690
765
  metadata: DTO<typeof metadataSchema>;
691
766
  documents: T[];
@@ -706,54 +781,54 @@ export declare const TokenSchema: z.ZodObject<{
706
781
  refreshToken: string;
707
782
  }>;
708
783
  export declare const UpdateSortingOrderSchema: z.ZodObject<{
709
- _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>]>;
784
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
710
785
  newPosition: z.ZodNumber;
711
786
  }, "strip", z.ZodTypeAny, {
712
- _id: mongoose.Types.ObjectId;
787
+ _id: import("mongoose").Types.ObjectId;
713
788
  newPosition: number;
714
789
  }, {
715
- _id: string | mongoose.Types.ObjectId;
790
+ _id: string | import("mongoose").Types.ObjectId;
716
791
  newPosition: number;
717
792
  }>;
718
793
  export type UpdateSortingOrderDTO = DTO<typeof UpdateSortingOrderSchema>;
719
794
  export declare const DeleteSchema: z.ZodObject<{
720
- _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>]>;
795
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
721
796
  softDelete: z.ZodDefault<z.ZodBoolean>;
722
797
  }, "strip", z.ZodTypeAny, {
723
- _id: mongoose.Types.ObjectId;
798
+ _id: import("mongoose").Types.ObjectId;
724
799
  softDelete: boolean;
725
800
  }, {
726
- _id: string | mongoose.Types.ObjectId;
801
+ _id: string | import("mongoose").Types.ObjectId;
727
802
  softDelete?: boolean | undefined;
728
803
  }>;
729
804
  export type DeleteDTO = DTO<typeof DeleteSchema>;
730
- export declare const 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>]>;
805
+ export declare const IdSchema: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
731
806
  export declare const GetByIdInputSchema: z.ZodObject<{
732
- _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>]>;
807
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
733
808
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
734
809
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
735
810
  }, "strip", z.ZodTypeAny, {
736
- _id: mongoose.Types.ObjectId;
811
+ _id: import("mongoose").Types.ObjectId;
737
812
  select?: Record<string, 0 | 1> | undefined;
738
813
  populate?: any;
739
814
  }, {
740
- _id: string | mongoose.Types.ObjectId;
815
+ _id: string | import("mongoose").Types.ObjectId;
741
816
  select?: Record<string, 0 | 1> | undefined;
742
817
  populate?: any;
743
818
  }>;
744
819
  export type GetByIdInputDTO = DTO<typeof GetByIdInputSchema>;
745
820
  export declare const GetProductByIdInputSchema: z.ZodObject<{
746
- _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>]>;
821
+ _id: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, import("mongoose").Types.ObjectId, string>, z.ZodType<import("mongoose").Types.ObjectId, z.ZodTypeDef, import("mongoose").Types.ObjectId>]>;
747
822
  select: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>>>;
748
823
  populate: z.ZodOptional<z.ZodUnion<[z.ZodType<any, z.ZodTypeDef, any>, z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">]>>;
749
824
  withAttributeHiddenItems: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
750
825
  }, "strip", z.ZodTypeAny, {
751
- _id: mongoose.Types.ObjectId;
826
+ _id: import("mongoose").Types.ObjectId;
752
827
  withAttributeHiddenItems: boolean;
753
828
  select?: Record<string, 0 | 1> | undefined;
754
829
  populate?: any;
755
830
  }, {
756
- _id: string | mongoose.Types.ObjectId;
831
+ _id: string | import("mongoose").Types.ObjectId;
757
832
  select?: Record<string, 0 | 1> | undefined;
758
833
  populate?: any;
759
834
  withAttributeHiddenItems?: boolean | undefined;