@cyberskill/shared 1.45.0 → 1.46.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.
@@ -27,8 +27,9 @@ import type { JSX } from 'react';
27
27
  import { JSX as JSX_2 } from 'react/jsx-runtime';
28
28
  import type { Locale } from 'date-fns';
29
29
  import { Model } from 'mongoose';
30
- import type { default as mongoose_2 } from 'mongoose';
30
+ import type mongoose from 'mongoose';
31
31
  import mongoosePaginate from 'mongoose-paginate-v2';
32
+ import type mongooseRaw from 'mongoose';
32
33
  import type { OptionalUnlessRequiredId } from 'mongodb';
33
34
  import type { PaginateModel } from 'mongoose';
34
35
  import type { PaginateOptions } from 'mongoose';
@@ -6292,7 +6293,7 @@ declare interface I_MongooseModelMiddleware_2<T extends Partial<C_Document_2>> {
6292
6293
  }
6293
6294
 
6294
6295
  declare interface I_MongooseOptions<T extends Partial<C_Document>> {
6295
- mongoose: typeof mongoose_2;
6296
+ mongoose: typeof mongoose;
6296
6297
  virtuals?: {
6297
6298
  name: keyof T | string;
6298
6299
  options?: I_VirtualOptions_2;
@@ -6304,7 +6305,7 @@ export { I_MongooseOptions as I_MongooseOptions_alias_1 }
6304
6305
  export { I_MongooseOptions as I_MongooseOptions_alias_2 }
6305
6306
 
6306
6307
  declare interface I_MongooseOptions_2<T extends Partial<C_Document_2>> {
6307
- mongoose: typeof mongoose_2;
6308
+ mongoose: typeof mongoose;
6308
6309
  virtuals?: {
6309
6310
  name: keyof T | string;
6310
6311
  options?: I_VirtualOptions;
@@ -6512,6 +6513,29 @@ declare const mongo: {
6512
6513
  createGenericFields({ returnDateAs, }?: {
6513
6514
  returnDateAs?: "string" | "date";
6514
6515
  }): I_GenericDocument_2;
6516
+ applyPlugins<T>(schema: T_MongooseShema_2<T>, plugins: Array<T_MongoosePlugin_2 | false>): void;
6517
+ applyMiddlewares<T extends Partial<C_Document_2>>(schema: T_MongooseShema_2<T>, middlewares: I_MongooseModelMiddleware_2<T>[]): void;
6518
+ createGenericSchema(mongoose: typeof mongooseRaw): mongooseRaw.Schema<I_GenericDocument_2, mongooseRaw.Model<I_GenericDocument_2, any, any, any, mongooseRaw.Document<unknown, any, I_GenericDocument_2> & I_GenericDocument_2 & Required<{
6519
+ _id: unknown;
6520
+ }> & {
6521
+ __v: number;
6522
+ }, any>, {}, {}, {}, {}, mongooseRaw.DefaultSchemaOptions, I_GenericDocument_2, mongooseRaw.Document<unknown, {}, mongooseRaw.FlatRecord<I_GenericDocument_2>> & mongooseRaw.FlatRecord<I_GenericDocument_2> & Required<{
6523
+ _id: unknown;
6524
+ }> & {
6525
+ __v: number;
6526
+ }>;
6527
+ createSchema<T extends Partial<C_Document_2>>({ mongoose, schema, virtuals, standalone, }: I_CreateSchemaOptions_2<T>): T_MongooseShema_2<T>;
6528
+ createModel<T extends Partial<C_Document_2>>({ mongoose: currentMongooseInstance, name, schema, pagination, aggregate, virtuals, middlewares, }: I_CreateModelOptions_2<T>): I_ExtendedModel_2<T>;
6529
+ createSlugQuery<T>(slug: string, filters?: T_FilterQuery_2<T>, id?: string): T_CreateSlugQueryResponse_2<T>;
6530
+ validator: {
6531
+ isEmpty<T>(): (this: T, value: unknown) => Promise<boolean>;
6532
+ isUnique<T extends {
6533
+ constructor: {
6534
+ findOne: (query: Record<string, unknown>) => Promise<unknown>;
6535
+ };
6536
+ }>(fields: string[]): (this: T, value: unknown) => Promise<boolean>;
6537
+ matchesRegex(regexArray: RegExp[]): (value: string) => Promise<boolean>;
6538
+ };
6515
6539
  };
6516
6540
  export { mongo }
6517
6541
  export { mongo as mongo_alias_1 }
@@ -6570,24 +6594,6 @@ export { MongoController }
6570
6594
  export { MongoController as MongoController_alias_1 }
6571
6595
  export { MongoController as MongoController_alias_2 }
6572
6596
 
6573
- declare const mongoose: {
6574
- createSchema<T extends Partial<C_Document_2>>({ mongoose, schema, virtuals, standalone, }: I_CreateSchemaOptions_2<T>): T_MongooseShema_2<T>;
6575
- createModel<T extends Partial<C_Document_2>>({ mongoose: currentMongooseInstance, name, schema, pagination, aggregate, virtuals, middlewares, }: I_CreateModelOptions_2<T>): I_ExtendedModel_2<T>;
6576
- createSlugQuery<T>(slug: string, filters?: T_FilterQuery_2<T>, id?: string): T_CreateSlugQueryResponse_2<T>;
6577
- validator: {
6578
- isEmpty<T>(): (this: T, value: unknown) => Promise<boolean>;
6579
- isUnique<T extends {
6580
- constructor: {
6581
- findOne: (query: Record<string, unknown>) => Promise<unknown>;
6582
- };
6583
- }>(fields: string[]): (this: T, value: unknown) => Promise<boolean>;
6584
- matchesRegex(regexArray: RegExp[]): (value: string) => Promise<boolean>;
6585
- };
6586
- };
6587
- export { mongoose }
6588
- export { mongoose as mongoose_alias_1 }
6589
- export { mongoose as mongoose_alias_2 }
6590
-
6591
6597
  declare class MongooseController<T extends Partial<C_Document_2>> {
6592
6598
  private model;
6593
6599
  constructor(model: I_ExtendedModel_2<T>);
@@ -7074,12 +7080,14 @@ export { T_MongoosePlugin }
7074
7080
  export { T_MongoosePlugin as T_MongoosePlugin_alias_1 }
7075
7081
  export { T_MongoosePlugin as T_MongoosePlugin_alias_2 }
7076
7082
 
7077
- declare type T_MongooseShema<T> = mongoose_2.Schema<T>;
7083
+ declare type T_MongoosePlugin_2 = (schema: Schema, options?: Record<string, unknown>) => void;
7084
+
7085
+ declare type T_MongooseShema<T> = mongoose.Schema<T>;
7078
7086
  export { T_MongooseShema }
7079
7087
  export { T_MongooseShema as T_MongooseShema_alias_1 }
7080
7088
  export { T_MongooseShema as T_MongooseShema_alias_2 }
7081
7089
 
7082
- declare type T_MongooseShema_2<T> = mongoose_2.Schema<T>;
7090
+ declare type T_MongooseShema_2<T> = mongoose.Schema<T>;
7083
7091
 
7084
7092
  declare type T_NextIntlMessageList = Record<string, AbstractIntlMessages>;
7085
7093
  export { T_NextIntlMessageList }
@@ -27,8 +27,9 @@ import type { JSX } from 'react';
27
27
  import { JSX as JSX_2 } from 'react/jsx-runtime';
28
28
  import type { Locale } from 'date-fns';
29
29
  import { Model } from 'mongoose';
30
- import type { default as mongoose_2 } from 'mongoose';
30
+ import type mongoose from 'mongoose';
31
31
  import mongoosePaginate from 'mongoose-paginate-v2';
32
+ import type mongooseRaw from 'mongoose';
32
33
  import type { OptionalUnlessRequiredId } from 'mongodb';
33
34
  import type { PaginateModel } from 'mongoose';
34
35
  import type { PaginateOptions } from 'mongoose';
@@ -6292,7 +6293,7 @@ declare interface I_MongooseModelMiddleware_2<T extends Partial<C_Document_2>> {
6292
6293
  }
6293
6294
 
6294
6295
  declare interface I_MongooseOptions<T extends Partial<C_Document>> {
6295
- mongoose: typeof mongoose_2;
6296
+ mongoose: typeof mongoose;
6296
6297
  virtuals?: {
6297
6298
  name: keyof T | string;
6298
6299
  options?: I_VirtualOptions_2;
@@ -6304,7 +6305,7 @@ export { I_MongooseOptions as I_MongooseOptions_alias_1 }
6304
6305
  export { I_MongooseOptions as I_MongooseOptions_alias_2 }
6305
6306
 
6306
6307
  declare interface I_MongooseOptions_2<T extends Partial<C_Document_2>> {
6307
- mongoose: typeof mongoose_2;
6308
+ mongoose: typeof mongoose;
6308
6309
  virtuals?: {
6309
6310
  name: keyof T | string;
6310
6311
  options?: I_VirtualOptions;
@@ -6512,6 +6513,29 @@ declare const mongo: {
6512
6513
  createGenericFields({ returnDateAs, }?: {
6513
6514
  returnDateAs?: "string" | "date";
6514
6515
  }): I_GenericDocument_2;
6516
+ applyPlugins<T>(schema: T_MongooseShema_2<T>, plugins: Array<T_MongoosePlugin_2 | false>): void;
6517
+ applyMiddlewares<T extends Partial<C_Document_2>>(schema: T_MongooseShema_2<T>, middlewares: I_MongooseModelMiddleware_2<T>[]): void;
6518
+ createGenericSchema(mongoose: typeof mongooseRaw): mongooseRaw.Schema<I_GenericDocument_2, mongooseRaw.Model<I_GenericDocument_2, any, any, any, mongooseRaw.Document<unknown, any, I_GenericDocument_2> & I_GenericDocument_2 & Required<{
6519
+ _id: unknown;
6520
+ }> & {
6521
+ __v: number;
6522
+ }, any>, {}, {}, {}, {}, mongooseRaw.DefaultSchemaOptions, I_GenericDocument_2, mongooseRaw.Document<unknown, {}, mongooseRaw.FlatRecord<I_GenericDocument_2>> & mongooseRaw.FlatRecord<I_GenericDocument_2> & Required<{
6523
+ _id: unknown;
6524
+ }> & {
6525
+ __v: number;
6526
+ }>;
6527
+ createSchema<T extends Partial<C_Document_2>>({ mongoose, schema, virtuals, standalone, }: I_CreateSchemaOptions_2<T>): T_MongooseShema_2<T>;
6528
+ createModel<T extends Partial<C_Document_2>>({ mongoose: currentMongooseInstance, name, schema, pagination, aggregate, virtuals, middlewares, }: I_CreateModelOptions_2<T>): I_ExtendedModel_2<T>;
6529
+ createSlugQuery<T>(slug: string, filters?: T_FilterQuery_2<T>, id?: string): T_CreateSlugQueryResponse_2<T>;
6530
+ validator: {
6531
+ isEmpty<T>(): (this: T, value: unknown) => Promise<boolean>;
6532
+ isUnique<T extends {
6533
+ constructor: {
6534
+ findOne: (query: Record<string, unknown>) => Promise<unknown>;
6535
+ };
6536
+ }>(fields: string[]): (this: T, value: unknown) => Promise<boolean>;
6537
+ matchesRegex(regexArray: RegExp[]): (value: string) => Promise<boolean>;
6538
+ };
6515
6539
  };
6516
6540
  export { mongo }
6517
6541
  export { mongo as mongo_alias_1 }
@@ -6570,24 +6594,6 @@ export { MongoController }
6570
6594
  export { MongoController as MongoController_alias_1 }
6571
6595
  export { MongoController as MongoController_alias_2 }
6572
6596
 
6573
- declare const mongoose: {
6574
- createSchema<T extends Partial<C_Document_2>>({ mongoose, schema, virtuals, standalone, }: I_CreateSchemaOptions_2<T>): T_MongooseShema_2<T>;
6575
- createModel<T extends Partial<C_Document_2>>({ mongoose: currentMongooseInstance, name, schema, pagination, aggregate, virtuals, middlewares, }: I_CreateModelOptions_2<T>): I_ExtendedModel_2<T>;
6576
- createSlugQuery<T>(slug: string, filters?: T_FilterQuery_2<T>, id?: string): T_CreateSlugQueryResponse_2<T>;
6577
- validator: {
6578
- isEmpty<T>(): (this: T, value: unknown) => Promise<boolean>;
6579
- isUnique<T extends {
6580
- constructor: {
6581
- findOne: (query: Record<string, unknown>) => Promise<unknown>;
6582
- };
6583
- }>(fields: string[]): (this: T, value: unknown) => Promise<boolean>;
6584
- matchesRegex(regexArray: RegExp[]): (value: string) => Promise<boolean>;
6585
- };
6586
- };
6587
- export { mongoose }
6588
- export { mongoose as mongoose_alias_1 }
6589
- export { mongoose as mongoose_alias_2 }
6590
-
6591
6597
  declare class MongooseController<T extends Partial<C_Document_2>> {
6592
6598
  private model;
6593
6599
  constructor(model: I_ExtendedModel_2<T>);
@@ -7074,12 +7080,14 @@ export { T_MongoosePlugin }
7074
7080
  export { T_MongoosePlugin as T_MongoosePlugin_alias_1 }
7075
7081
  export { T_MongoosePlugin as T_MongoosePlugin_alias_2 }
7076
7082
 
7077
- declare type T_MongooseShema<T> = mongoose_2.Schema<T>;
7083
+ declare type T_MongoosePlugin_2 = (schema: Schema, options?: Record<string, unknown>) => void;
7084
+
7085
+ declare type T_MongooseShema<T> = mongoose.Schema<T>;
7078
7086
  export { T_MongooseShema }
7079
7087
  export { T_MongooseShema as T_MongooseShema_alias_1 }
7080
7088
  export { T_MongooseShema as T_MongooseShema_alias_2 }
7081
7089
 
7082
- declare type T_MongooseShema_2<T> = mongoose_2.Schema<T>;
7090
+ declare type T_MongooseShema_2<T> = mongoose.Schema<T>;
7083
7091
 
7084
7092
  declare type T_NextIntlMessageList = Record<string, AbstractIntlMessages>;
7085
7093
  export { T_NextIntlMessageList }