@cyberskill/shared 2.20.0 → 2.25.0

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.
Files changed (63) hide show
  1. package/dist/config/eslint/index.cjs +1 -1
  2. package/dist/config/eslint/index.d.ts +2 -7
  3. package/dist/config/eslint/index.js +1 -1
  4. package/dist/config/storybook/storybook.main.cjs +1 -1
  5. package/dist/config/storybook/storybook.main.js +1 -1
  6. package/dist/config/vitest/vitest.e2e.cjs +1 -1
  7. package/dist/config/vitest/vitest.e2e.js +6 -6
  8. package/dist/config/vitest/vitest.unit.cjs +1 -1
  9. package/dist/config/vitest/vitest.unit.js +5 -5
  10. package/dist/config/vitest/vitest.unit.setup.d.ts +0 -1
  11. package/dist/node/cli/index.cjs +4 -4
  12. package/dist/node/cli/index.js +56 -51
  13. package/dist/node/command/command.util.cjs +2 -2
  14. package/dist/node/command/command.util.d.ts +4 -1
  15. package/dist/node/command/command.util.js +125 -112
  16. package/dist/node/express/express.util.cjs +1 -1
  17. package/dist/node/express/express.util.js +24 -23
  18. package/dist/node/mongo/index.cjs +1 -1
  19. package/dist/node/mongo/index.d.ts +1 -0
  20. package/dist/node/mongo/index.js +15 -12
  21. package/dist/node/mongo/mongo.controller.cjs +1 -0
  22. package/dist/node/mongo/mongo.controller.d.ts +317 -0
  23. package/dist/node/mongo/mongo.controller.js +956 -0
  24. package/dist/node/mongo/mongo.controller.test.unit.d.ts +1 -0
  25. package/dist/node/mongo/mongo.type.d.ts +9 -10
  26. package/dist/node/mongo/mongo.util.cjs +5 -5
  27. package/dist/node/mongo/mongo.util.d.ts +32 -515
  28. package/dist/node/mongo/mongo.util.js +314 -1239
  29. package/dist/node/mongo/mongo.util.test.unit.d.ts +1 -0
  30. package/dist/node/path/path.constant.cjs +1 -1
  31. package/dist/node/path/path.constant.d.ts +2 -2
  32. package/dist/node/path/path.constant.js +120 -116
  33. package/dist/node/path/path.test.unit.d.ts +1 -0
  34. package/dist/node/path/path.util.d.ts +2 -2
  35. package/dist/react/loading/loading.component.cjs +2 -2
  36. package/dist/react/loading/loading.component.js +32 -19
  37. package/dist/react/loading/loading.test.unit.d.ts +1 -0
  38. package/dist/react/loading/loading.type.d.ts +2 -1
  39. package/dist/util/common/common.test.unit.d.ts +1 -0
  40. package/dist/util/common/common.util.cjs +1 -1
  41. package/dist/util/common/common.util.d.ts +3 -0
  42. package/dist/util/common/common.util.js +35 -35
  43. package/dist/util/index.cjs +1 -1
  44. package/dist/util/index.js +16 -15
  45. package/dist/util/object/index.cjs +1 -1
  46. package/dist/util/object/index.js +4 -3
  47. package/dist/util/object/object.test.unit.d.ts +1 -0
  48. package/dist/util/object/object.util.cjs +1 -1
  49. package/dist/util/object/object.util.d.ts +10 -30
  50. package/dist/util/object/object.util.js +110 -73
  51. package/dist/util/serializer/serializer.test.unit.d.ts +1 -0
  52. package/dist/util/serializer/serializer.util.cjs +1 -1
  53. package/dist/util/serializer/serializer.util.js +19 -16
  54. package/dist/util/string/string.test.unit.d.ts +1 -0
  55. package/dist/util/string/string.util.cjs +1 -1
  56. package/dist/util/string/string.util.d.ts +4 -3
  57. package/dist/util/string/string.util.js +32 -41
  58. package/dist/util/validate/validate.test.unit.d.ts +1 -0
  59. package/dist/util/validate/validate.util.cjs +1 -1
  60. package/dist/util/validate/validate.util.js +9 -9
  61. package/package.json +44 -51
  62. /package/dist/node_modules/.pnpm/{vitest@4.0.13_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.2_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
  63. /package/dist/node_modules/.pnpm/{vitest@4.0.13_@types_debug@4.1.12_@types_node@24.10.1_jiti@2.6.1_jsdom@27.2.0_sass@1.94.2_tsx@4.20.6_yaml@2.8.1 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
@@ -1,7 +1,15 @@
1
1
  import { default as mongooseRaw } from 'mongoose';
2
2
  import { default as migrate } from 'migrate-mongo';
3
- import { I_Return } from '../../typescript/index.js';
4
- import { C_Db, C_Document, I_CreateModelOptions, I_CreateSchemaOptions, I_DeleteOptionsExtended, I_DynamicVirtualOptions, I_ExtendedModel, I_GenericDocument, I_Input_CheckSlug, I_Input_CreateSlug, I_Input_GenerateSlug, I_MongooseModelMiddleware, I_PaginateOptionsWithPopulate, I_UpdateOptionsExtended, T_AggregatePaginateResult, T_DeleteResult, T_Filter, T_FilterQuery, T_Input_Populate, T_InsertManyOptions, T_MongoosePlugin, T_MongooseShema, T_PaginateResult, T_PipelineStage, T_ProjectionType, T_QueryOptions, T_UpdateQuery, T_UpdateResult, T_VirtualOptions, T_WithId } from './mongo.type.js';
3
+ import { MongoController } from './mongo.controller.js';
4
+ import { C_Document, I_CreateModelOptions, I_CreateSchemaOptions, I_DynamicVirtualConfig, I_DynamicVirtualOptions, I_ExtendedModel, I_GenericDocument, I_MongooseModelMiddleware, T_Input_Populate, T_MongoosePlugin, T_MongooseShema, T_QueryFilter, T_VirtualOptions, T_WithId } from './mongo.type.js';
5
+ /**
6
+ * Converts enum values to proper model names.
7
+ * Handles common naming conventions like converting 'USER' to 'User'.
8
+ *
9
+ * @param enumValue - The enum value to convert
10
+ * @returns The converted model name
11
+ */
12
+ export declare function convertEnumToModelName(enumValue: string): string;
5
13
  /**
6
14
  * MongoDB utility object providing comprehensive database operations and utilities.
7
15
  * This object contains methods for creating generic fields, applying plugins and middlewares,
@@ -150,6 +158,8 @@ export declare const mongo: {
150
158
  _id: mongooseRaw.Types.ObjectId;
151
159
  } & {
152
160
  __v: number;
161
+ } & {
162
+ id: string;
153
163
  }, any, unknown>>(name: string): ModelType;
154
164
  <ModelType = mongooseRaw.Model<any, {}, {}, {}, any, any, any>>(): ModelType;
155
165
  } | undefined, I_GenericDocument, mongooseRaw.Document<unknown, {}, I_GenericDocument, {}, mongooseRaw.ResolveSchemaOptions<mongooseRaw.DefaultSchemaOptions>> & I_GenericDocument & Required<{
@@ -157,7 +167,7 @@ export declare const mongo: {
157
167
  }> & {
158
168
  __v: number;
159
169
  }> | undefined;
160
- $op?: mongooseRaw.SchemaDefinitionProperty<"remove" | "save" | "validate" | null | undefined, I_GenericDocument, mongooseRaw.Document<unknown, {}, I_GenericDocument, {}, mongooseRaw.ResolveSchemaOptions<mongooseRaw.DefaultSchemaOptions>> & I_GenericDocument & Required<{
170
+ $op?: mongooseRaw.SchemaDefinitionProperty<"save" | "validate" | "remove" | null | undefined, I_GenericDocument, mongooseRaw.Document<unknown, {}, I_GenericDocument, {}, mongooseRaw.ResolveSchemaOptions<mongooseRaw.DefaultSchemaOptions>> & I_GenericDocument & Required<{
161
171
  _id: mongooseRaw.Types.ObjectId;
162
172
  }> & {
163
173
  __v: number;
@@ -319,6 +329,8 @@ export declare const mongo: {
319
329
  _id: mongooseRaw.Types.ObjectId;
320
330
  } & {
321
331
  __v: number;
332
+ } & {
333
+ id: string;
322
334
  }, any, unknown>>(name: string): ModelType;
323
335
  <ModelType = mongooseRaw.Model<any, {}, {}, {}, any, any, any>>(): ModelType;
324
336
  } | undefined, I_GenericDocument, mongooseRaw.Document<unknown, {}, I_GenericDocument, {}, mongooseRaw.ResolveSchemaOptions<mongooseRaw.DefaultSchemaOptions>> & I_GenericDocument & Required<{
@@ -406,7 +418,11 @@ export declare const mongo: {
406
418
  }, "id"> & {
407
419
  id: string;
408
420
  }> | undefined;
409
- }, {} & Required<{
421
+ }, {
422
+ [x: number]: {};
423
+ [x: symbol]: {};
424
+ [x: string]: {};
425
+ } & Required<{
410
426
  _id: unknown;
411
427
  }> & {
412
428
  __v: number;
@@ -984,7 +1000,7 @@ export declare const mongo: {
984
1000
  * @param fields - An array of field names to convert to regex patterns.
985
1001
  * @returns A new filter object with string values converted to regex patterns.
986
1002
  */
987
- regexify<T>(filter?: T_FilterQuery<T>, fields?: (keyof T | string)[]): T_FilterQuery<T>;
1003
+ regexify<T>(filter?: T_QueryFilter<T>, fields?: (keyof T | string)[]): T_QueryFilter<T>;
988
1004
  /**
989
1005
  * Checks if a virtual options object has a dynamic ref function.
990
1006
  *
@@ -1010,514 +1026,15 @@ export declare const mongo: {
1010
1026
  getExistingRecords<T extends I_GenericDocument>(controller: MongoController<T>, recordsToCheck: T[], filterFn: (existingRecord: T_WithId<T>, newRecord: T) => boolean): Promise<T_WithId<T>[]>;
1011
1027
  };
1012
1028
  /**
1013
- * MongoDB native driver controller for direct database operations.
1014
- * This class provides a simplified interface for MongoDB operations using the native driver,
1015
- * with automatic generic field generation and standardized response formatting.
1029
+ * Recursively applies nested populate options to populated documents.
1030
+ * This function handles cases where a populated field needs further population.
1031
+ *
1032
+ * @template T - The document type
1033
+ * @param mongoose - The Mongoose instance
1034
+ * @param documents - The documents to apply nested populations to
1035
+ * @param populateOptions - The populate options to apply
1036
+ * @param virtualConfigs - Optional virtual configurations for model inference
1037
+ * @param currentModel - The current model context (which model's schema to search for virtuals)
1038
+ * @returns Promise with documents that have nested populations applied
1016
1039
  */
1017
- export declare class MongoController<D extends Partial<C_Document>> {
1018
- private collection;
1019
- /**
1020
- * Creates a new MongoDB controller instance.
1021
- *
1022
- * @param db - The MongoDB database instance.
1023
- * @param collectionName - The name of the collection to operate on.
1024
- */
1025
- constructor(db: C_Db, collectionName: string);
1026
- /**
1027
- * Creates a single document in the collection.
1028
- * This method adds generic fields (id, isDel, timestamps) to the document before insertion.
1029
- *
1030
- * @param document - The document to create, with or without generic fields.
1031
- * @returns A promise that resolves to a standardized response with the created document.
1032
- */
1033
- createOne(document: D | Partial<D>): Promise<I_Return<D | Partial<D>>>;
1034
- /**
1035
- * Creates multiple documents in the collection.
1036
- * This method adds generic fields to each document before bulk insertion.
1037
- *
1038
- * @param documents - An array of documents to create.
1039
- * @returns A promise that resolves to a standardized response with the created documents.
1040
- */
1041
- createMany(documents: (D | Partial<D>)[]): Promise<I_Return<(D | Partial<D>)[]>>;
1042
- /**
1043
- * Finds a single document by filter criteria.
1044
- *
1045
- * @param filter - The filter criteria to find the document.
1046
- * @returns A promise that resolves to a standardized response with the found document.
1047
- */
1048
- findOne(filter: T_Filter<D>): Promise<I_Return<T_WithId<D>>>;
1049
- /**
1050
- * Finds all documents matching the filter criteria.
1051
- *
1052
- * @param filter - The filter criteria to find documents (defaults to empty object for all documents).
1053
- * @returns A promise that resolves to a standardized response with the found documents.
1054
- */
1055
- findAll(filter?: T_Filter<D>): Promise<I_Return<T_WithId<D>[]>>;
1056
- /**
1057
- * Counts documents matching the filter criteria.
1058
- *
1059
- * @param filter - The filter criteria to count documents (defaults to empty object for all documents).
1060
- * @returns A promise that resolves to a standardized response with the document count.
1061
- */
1062
- count(filter?: T_Filter<D>): Promise<I_Return<number>>;
1063
- /**
1064
- * Updates a single document matching the filter criteria.
1065
- *
1066
- * @param filter - The filter criteria to find the document to update.
1067
- * @param update - The update data to apply to the document.
1068
- * @returns A promise that resolves to a standardized response with the update result.
1069
- */
1070
- updateOne(filter: T_Filter<D>, update: Partial<D>): Promise<I_Return<T_UpdateResult>>;
1071
- /**
1072
- * Updates multiple documents matching the filter criteria.
1073
- *
1074
- * @param filter - The filter criteria to find documents to update.
1075
- * @param update - The update data to apply to the documents.
1076
- * @returns A promise that resolves to a standardized response with the update result.
1077
- */
1078
- updateMany(filter: T_Filter<D>, update: Partial<D>): Promise<I_Return<T_UpdateResult>>;
1079
- /**
1080
- * Deletes a single document matching the filter criteria.
1081
- *
1082
- * @param filter - The filter criteria to find the document to delete.
1083
- * @returns A promise that resolves to a standardized response with the delete result.
1084
- */
1085
- deleteOne(filter: T_Filter<D>): Promise<I_Return<T_DeleteResult>>;
1086
- /**
1087
- * Deletes multiple documents matching the filter criteria.
1088
- *
1089
- * @param filter - The filter criteria to find documents to delete.
1090
- * @returns A promise that resolves to a standardized response with the delete result.
1091
- */
1092
- deleteMany(filter: T_Filter<D>): Promise<I_Return<T_DeleteResult>>;
1093
- }
1094
- /**
1095
- * Mongoose controller for database operations with advanced features.
1096
- * This class provides a comprehensive interface for Mongoose operations including
1097
- * pagination, aggregation, slug generation, and short ID creation.
1098
- */
1099
- export declare class MongooseController<T extends Partial<C_Document>> {
1100
- private model;
1101
- /**
1102
- * Creates a new Mongoose controller instance.
1103
- *
1104
- * @param model - The Mongoose model to operate on.
1105
- */
1106
- constructor(model: I_ExtendedModel<T>);
1107
- /**
1108
- * Gets the model name for logging and error messages.
1109
- *
1110
- * @returns The name of the model.
1111
- */
1112
- private getModelName;
1113
- /**
1114
- * Gets the dynamic virtuals configuration from the model instance.
1115
- *
1116
- * @returns Array of dynamic virtual configurations or undefined if none exist.
1117
- */
1118
- private getDynamicVirtuals;
1119
- /**
1120
- * Populates dynamic virtuals for a single document.
1121
- *
1122
- * @param result - The document to populate dynamic virtuals for.
1123
- * @param populate - The populate options to determine which virtuals to populate.
1124
- * @returns The document with dynamic virtuals populated.
1125
- */
1126
- private populateDynamicVirtualsForDocument;
1127
- /**
1128
- * Populates dynamic virtuals for an array of documents.
1129
- *
1130
- * @param results - The documents to populate dynamic virtuals for.
1131
- * @param populate - The populate options to determine which virtuals to populate.
1132
- * @returns The documents with dynamic virtuals populated.
1133
- */
1134
- private populateDynamicVirtualsForDocuments;
1135
- /**
1136
- * Finds a single document with optional population and projection.
1137
- * Automatically handles dynamic virtual population if configured.
1138
- *
1139
- * @param filter - The filter criteria to find the document.
1140
- * @param projection - The fields to include/exclude in the result.
1141
- * @param options - Query options for the operation.
1142
- * @param populate - Population configuration for related documents.
1143
- * @returns A promise that resolves to a standardized response with the found document.
1144
- */
1145
- findOne(filter?: T_FilterQuery<T>, projection?: T_ProjectionType<T>, options?: T_QueryOptions<T>, populate?: T_Input_Populate): Promise<I_Return<T>>;
1146
- /**
1147
- * Finds all documents with optional population and projection.
1148
- * Automatically handles dynamic virtual population if configured.
1149
- *
1150
- * @param filter - The filter criteria to find documents.
1151
- * @param projection - The fields to include/exclude in the result.
1152
- * @param options - Query options for the operation.
1153
- * @param populate - Population configuration for related documents.
1154
- * @returns A promise that resolves to a standardized response with the found documents.
1155
- */
1156
- findAll(filter?: T_FilterQuery<T>, projection?: T_ProjectionType<T>, options?: T_QueryOptions<T>, populate?: T_Input_Populate): Promise<I_Return<T[]>>;
1157
- /**
1158
- * Finds documents with pagination support.
1159
- * Automatically handles dynamic virtual population if configured.
1160
- *
1161
- * @param filter - The filter criteria to find documents.
1162
- * @param options - Pagination options including page, limit, and population.
1163
- * @returns A promise that resolves to a standardized response with paginated results.
1164
- */
1165
- findPaging(filter?: T_FilterQuery<T>, options?: I_PaginateOptionsWithPopulate): Promise<I_Return<T_PaginateResult<T>>>;
1166
- /**
1167
- * Performs aggregation with pagination support.
1168
- *
1169
- * @param pipeline - The aggregation pipeline stages.
1170
- * @param options - Pagination options for the aggregation result.
1171
- * @returns A promise that resolves to a standardized response with paginated aggregation results.
1172
- */
1173
- findPagingAggregate(pipeline: T_PipelineStage[], options?: I_PaginateOptionsWithPopulate): Promise<I_Return<T_AggregatePaginateResult<T>>>;
1174
- /**
1175
- * Counts documents matching the filter criteria.
1176
- *
1177
- * @param filter - The filter criteria to count documents.
1178
- * @returns A promise that resolves to a standardized response with the document count.
1179
- */
1180
- count(filter?: T_FilterQuery<T>): Promise<I_Return<number>>;
1181
- /**
1182
- * Creates a single document.
1183
- *
1184
- * @param doc - The document to create.
1185
- * @returns A promise that resolves to a standardized response with the created document.
1186
- */
1187
- createOne(doc: T | Partial<T>): Promise<I_Return<T>>;
1188
- /**
1189
- * Creates multiple documents with bulk insertion.
1190
- *
1191
- * @param docs - An array of documents to create.
1192
- * @param options - Options for the bulk insertion operation.
1193
- * @returns A promise that resolves to a standardized response with the created documents.
1194
- */
1195
- createMany(docs: (T | Partial<T>)[], options?: T_InsertManyOptions): Promise<I_Return<T[]>>;
1196
- /**
1197
- * Updates a single document and returns the updated version.
1198
- *
1199
- * @param filter - The filter criteria to find the document to update.
1200
- * @param update - The update data to apply.
1201
- * @param options - Options for the update operation.
1202
- * @returns A promise that resolves to a standardized response with the updated document.
1203
- */
1204
- updateOne(filter?: T_FilterQuery<T>, update?: T_UpdateQuery<T>, options?: I_UpdateOptionsExtended): Promise<I_Return<T>>;
1205
- /**
1206
- * Updates multiple documents matching the filter criteria.
1207
- *
1208
- * @param filter - The filter criteria to find documents to update.
1209
- * @param update - The update data to apply.
1210
- * @param options - Options for the update operation.
1211
- * @returns A promise that resolves to a standardized response with the update result.
1212
- */
1213
- updateMany(filter?: T_FilterQuery<T>, update?: T_UpdateQuery<T>, options?: I_UpdateOptionsExtended): Promise<I_Return<T_UpdateResult>>;
1214
- /**
1215
- * Deletes a single document and returns the deleted version.
1216
- *
1217
- * @param filter - The filter criteria to find the document to delete.
1218
- * @param options - Options for the delete operation.
1219
- * @returns A promise that resolves to a standardized response with the deleted document.
1220
- */
1221
- deleteOne(filter?: T_FilterQuery<T>, options?: I_DeleteOptionsExtended): Promise<I_Return<T>>;
1222
- /**
1223
- * Deletes multiple documents matching the filter criteria.
1224
- *
1225
- * @param filter - The filter criteria to find documents to delete.
1226
- * @param options - Options for the delete operation.
1227
- * @returns A promise that resolves to a standardized response with the delete result.
1228
- */
1229
- deleteMany(filter?: T_FilterQuery<T>, options?: I_DeleteOptionsExtended): Promise<I_Return<T_DeleteResult>>;
1230
- /**
1231
- * Creates a unique short ID based on a given ID.
1232
- * This method generates multiple short IDs with increasing lengths and finds the first available one.
1233
- *
1234
- * @param id - The base ID to generate short IDs from.
1235
- * @param length - The initial length for short ID generation (default: 4).
1236
- * @returns A promise that resolves to a standardized response with the unique short ID.
1237
- */
1238
- createShortId(id: string, length?: number): Promise<I_Return<string>>;
1239
- /**
1240
- * Creates a query for slug existence checking.
1241
- * This method generates a query that checks for slug existence in both current and historical slug fields.
1242
- *
1243
- * @param options - Configuration for slug query generation including slug, field, and filter.
1244
- * @param options.slug - The slug string to check for existence.
1245
- * @param options.field - The field name for object-based slug checking.
1246
- * @param options.isObject - Whether the slug is stored as an object with nested fields.
1247
- * @param options.haveHistory - Whether to check historical slug fields for existence.
1248
- * @param options.filter - Additional filter conditions to apply to the query.
1249
- * @returns A MongoDB query object for checking slug existence.
1250
- */
1251
- createSlugQuery({ slug, field, isObject, haveHistory, filter }: I_Input_GenerateSlug<T>): {
1252
- $or: ({
1253
- [x: string]: string;
1254
- slugHistory?: undefined;
1255
- } | {
1256
- slugHistory: {
1257
- $elemMatch: {
1258
- [x: string]: string;
1259
- };
1260
- };
1261
- })[];
1262
- _mongooseOptions?: any;
1263
- exec?: any;
1264
- $where?: string | (mongooseRaw.mongo.Condition<mongooseRaw.ApplyBasicQueryCasting<mongooseRaw.WithLevel1NestedPaths<T, keyof T>["$where"]>> & (string | ((this: mongooseRaw.WithLevel1NestedPaths<T, keyof T> extends infer T_1 ? { [P in keyof T_1]?: mongooseRaw.ApplyBasicQueryCasting<T_1[P]> | undefined; } : never) => boolean))) | ((argument: string | Function) => mongooseRaw.Query<any[], any, {}, unknown, "find", Record<string, never>>) | ((this: {
1265
- [x: string]: any;
1266
- }) => boolean) | undefined;
1267
- all?: any;
1268
- allowDiskUse?: any;
1269
- and?: any;
1270
- batchSize?: any;
1271
- box?: any;
1272
- cast?: any;
1273
- catch?: any;
1274
- finally?: any;
1275
- circle?: any;
1276
- clone?: any;
1277
- collation?: any;
1278
- comment?: any;
1279
- countDocuments?: any;
1280
- cursor?: any;
1281
- deleteMany?: any;
1282
- deleteOne?: any;
1283
- distinct?: any;
1284
- elemMatch?: any;
1285
- error?: any;
1286
- equals?: any;
1287
- estimatedDocumentCount?: any;
1288
- exists?: any;
1289
- explain?: any;
1290
- find?: any;
1291
- findOne?: any;
1292
- findOneAndDelete?: any;
1293
- findOneAndUpdate?: any;
1294
- findById?: any;
1295
- findByIdAndDelete?: any;
1296
- findByIdAndUpdate?: any;
1297
- geometry?: any;
1298
- get?: any;
1299
- getFilter?: any;
1300
- getOptions?: any;
1301
- getPopulatedPaths?: any;
1302
- getQuery?: any;
1303
- getUpdate?: any;
1304
- gt?: any;
1305
- gte?: any;
1306
- hint?: any;
1307
- in?: any;
1308
- intersects?: any;
1309
- j?: any;
1310
- lean?: any;
1311
- limit?: any;
1312
- lt?: any;
1313
- lte?: any;
1314
- transform?: any;
1315
- maxDistance?: any;
1316
- maxTimeMS?: any;
1317
- merge?: any;
1318
- mod?: any;
1319
- model?: any;
1320
- mongooseOptions?: any;
1321
- ne?: any;
1322
- near?: any;
1323
- nin?: any;
1324
- nor?: any;
1325
- or?: any;
1326
- orFail?: any;
1327
- polygon?: any;
1328
- populate?: any;
1329
- pre?: any;
1330
- post?: any;
1331
- projection?: any;
1332
- read?: any;
1333
- readConcern?: any;
1334
- regex?: any;
1335
- replaceOne?: any;
1336
- sanitizeProjection?: any;
1337
- schemaLevelProjections?: any;
1338
- select?: any;
1339
- selected?: any;
1340
- selectedExclusively?: any;
1341
- selectedInclusively?: any;
1342
- session?: any;
1343
- set?: any;
1344
- setOptions?: any;
1345
- setQuery?: any;
1346
- setUpdate?: any;
1347
- size?: any;
1348
- skip?: any;
1349
- slice?: any;
1350
- sort?: any;
1351
- tailable?: any;
1352
- then?: any;
1353
- toConstructor?: any;
1354
- updateMany?: any;
1355
- updateOne?: any;
1356
- w?: any;
1357
- where?: any;
1358
- within?: any;
1359
- wtimeout?: any;
1360
- paginate?: any;
1361
- } | {
1362
- $or: ({
1363
- slug: string;
1364
- slugHistory?: undefined;
1365
- } | {
1366
- slugHistory: string;
1367
- slug?: undefined;
1368
- })[];
1369
- _mongooseOptions?: any;
1370
- exec?: any;
1371
- $where?: string | (mongooseRaw.mongo.Condition<mongooseRaw.ApplyBasicQueryCasting<mongooseRaw.WithLevel1NestedPaths<T, keyof T>["$where"]>> & (string | ((this: mongooseRaw.WithLevel1NestedPaths<T, keyof T> extends infer T_1 ? { [P in keyof T_1]?: mongooseRaw.ApplyBasicQueryCasting<T_1[P]> | undefined; } : never) => boolean))) | ((argument: string | Function) => mongooseRaw.Query<any[], any, {}, unknown, "find", Record<string, never>>) | ((this: {
1372
- [x: string]: any;
1373
- }) => boolean) | undefined;
1374
- all?: any;
1375
- allowDiskUse?: any;
1376
- and?: any;
1377
- batchSize?: any;
1378
- box?: any;
1379
- cast?: any;
1380
- catch?: any;
1381
- finally?: any;
1382
- circle?: any;
1383
- clone?: any;
1384
- collation?: any;
1385
- comment?: any;
1386
- countDocuments?: any;
1387
- cursor?: any;
1388
- deleteMany?: any;
1389
- deleteOne?: any;
1390
- distinct?: any;
1391
- elemMatch?: any;
1392
- error?: any;
1393
- equals?: any;
1394
- estimatedDocumentCount?: any;
1395
- exists?: any;
1396
- explain?: any;
1397
- find?: any;
1398
- findOne?: any;
1399
- findOneAndDelete?: any;
1400
- findOneAndUpdate?: any;
1401
- findById?: any;
1402
- findByIdAndDelete?: any;
1403
- findByIdAndUpdate?: any;
1404
- geometry?: any;
1405
- get?: any;
1406
- getFilter?: any;
1407
- getOptions?: any;
1408
- getPopulatedPaths?: any;
1409
- getQuery?: any;
1410
- getUpdate?: any;
1411
- gt?: any;
1412
- gte?: any;
1413
- hint?: any;
1414
- in?: any;
1415
- intersects?: any;
1416
- j?: any;
1417
- lean?: any;
1418
- limit?: any;
1419
- lt?: any;
1420
- lte?: any;
1421
- transform?: any;
1422
- maxDistance?: any;
1423
- maxTimeMS?: any;
1424
- merge?: any;
1425
- mod?: any;
1426
- model?: any;
1427
- mongooseOptions?: any;
1428
- ne?: any;
1429
- near?: any;
1430
- nin?: any;
1431
- nor?: any;
1432
- or?: any;
1433
- orFail?: any;
1434
- polygon?: any;
1435
- populate?: any;
1436
- pre?: any;
1437
- post?: any;
1438
- projection?: any;
1439
- read?: any;
1440
- readConcern?: any;
1441
- regex?: any;
1442
- replaceOne?: any;
1443
- sanitizeProjection?: any;
1444
- schemaLevelProjections?: any;
1445
- select?: any;
1446
- selected?: any;
1447
- selectedExclusively?: any;
1448
- selectedInclusively?: any;
1449
- session?: any;
1450
- set?: any;
1451
- setOptions?: any;
1452
- setQuery?: any;
1453
- setUpdate?: any;
1454
- size?: any;
1455
- skip?: any;
1456
- slice?: any;
1457
- sort?: any;
1458
- tailable?: any;
1459
- then?: any;
1460
- toConstructor?: any;
1461
- updateMany?: any;
1462
- updateOne?: any;
1463
- w?: any;
1464
- where?: any;
1465
- within?: any;
1466
- wtimeout?: any;
1467
- paginate?: any;
1468
- };
1469
- /**
1470
- * Creates a unique slug based on a given string.
1471
- * This method generates multiple slug variations and finds the first available one.
1472
- *
1473
- * @param options - Configuration for slug generation including slug, field, and filter.
1474
- * @param options.slug - The base slug string to make unique.
1475
- * @param options.field - The field name for object-based slug checking.
1476
- * @param options.isObject - Whether the slug is stored as an object with nested fields.
1477
- * @param options.haveHistory - Whether to check historical slug fields for uniqueness.
1478
- * @param options.filter - Additional filter conditions to apply when checking slug existence.
1479
- * @returns A promise that resolves to a unique slug string.
1480
- */
1481
- createUniqueSlug({ slug, field, isObject, haveHistory, filter }: I_Input_GenerateSlug<T>): Promise<string>;
1482
- /**
1483
- * Creates a slug for a document field.
1484
- * This method handles both simple string fields and object fields with nested slug generation.
1485
- *
1486
- * @param options - Configuration for slug creation including field, source document, and filter.
1487
- * @param options.field - The field name to create a slug for.
1488
- * @param options.from - The source document containing the field value.
1489
- * @param options.haveHistory - Whether to check historical slug fields for uniqueness.
1490
- * @param options.filter - Additional filter conditions to apply when checking slug existence.
1491
- * @returns A promise that resolves to a standardized response with the created slug(s).
1492
- */
1493
- createSlug<R = string>({ field, from, filter, haveHistory }: I_Input_CreateSlug<T>): Promise<I_Return<R>>;
1494
- /**
1495
- * Checks if a slug already exists in the collection.
1496
- * This method verifies slug existence in both current and historical slug fields.
1497
- *
1498
- * @param options - Configuration for slug checking including slug, field, source document, and filter.
1499
- * @param options.slug - The slug string to check for existence.
1500
- * @param options.field - The field name for object-based slug checking.
1501
- * @param options.from - The source document containing the field value.
1502
- * @param options.haveHistory - Whether to check historical slug fields for existence.
1503
- * @param options.filter - Additional filter conditions to apply to the query.
1504
- * @returns A promise that resolves to a standardized response indicating whether the slug exists.
1505
- */
1506
- checkSlug({ slug, field, from, filter, haveHistory }: I_Input_CheckSlug<T>): Promise<I_Return<boolean>>;
1507
- /**
1508
- * Performs aggregation operations on the collection.
1509
- *
1510
- * @param pipeline - The aggregation pipeline stages to execute.
1511
- * @returns A promise that resolves to a standardized response with the aggregation results.
1512
- */
1513
- aggregate(pipeline: T_PipelineStage[]): Promise<I_Return<T[]>>;
1514
- /**
1515
- * Retrieves distinct values for the specified key from the collection.
1516
- *
1517
- * @param key - The field for which to return distinct values.
1518
- * @param filter - The filter query to apply (optional).
1519
- * @param options - Additional options for the distinct operation (optional).
1520
- * @returns A promise that resolves to a standardized response with the array of distinct values.
1521
- */
1522
- distinct(key: string, filter?: T_FilterQuery<T>, options?: T_QueryOptions<T>): Promise<I_Return<unknown[]>>;
1523
- }
1040
+ export declare function applyNestedPopulate<T extends object>(mongoose: typeof mongooseRaw, documents: T[], populateOptions: T_Input_Populate, virtualConfigs?: I_DynamicVirtualConfig<unknown, string>[], currentModel?: any): Promise<T[]>;