@cyberskill/shared 1.43.0 → 1.45.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 (43) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +44 -46
  2. package/dist/_tsup-dts-rollup.d.ts +44 -46
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +4 -7
  5. package/dist/index.d.ts +4 -7
  6. package/dist/index.js +1 -1
  7. package/dist/nodejs/index.cjs +1 -1
  8. package/dist/nodejs/index.d.cts +3 -7
  9. package/dist/nodejs/index.d.ts +3 -7
  10. package/dist/nodejs/index.js +1 -1
  11. package/dist/nodejs/mongo.cjs +1 -1
  12. package/dist/nodejs/mongo.d.cts +5 -2
  13. package/dist/nodejs/mongo.d.ts +5 -2
  14. package/dist/nodejs/mongo.js +1 -1
  15. package/dist/react/index.cjs +1 -1
  16. package/dist/react/index.js +1 -1
  17. package/dist/react/next-intl.cjs +1 -1
  18. package/dist/react/next-intl.js +1 -1
  19. package/dist/react/storage.cjs +1 -1
  20. package/dist/react/storage.js +1 -1
  21. package/dist/typescript/index.cjs +1 -1
  22. package/dist/typescript/index.js +1 -1
  23. package/dist/typescript/mongo.cjs +1 -1
  24. package/dist/typescript/mongo.d.cts +48 -0
  25. package/dist/typescript/mongo.d.ts +48 -0
  26. package/dist/typescript/mongo.js +1 -1
  27. package/dist/utils/index.cjs +1 -1
  28. package/dist/utils/index.d.cts +1 -0
  29. package/dist/utils/index.d.ts +1 -0
  30. package/dist/utils/index.js +1 -1
  31. package/dist/utils/validate.cjs +1 -0
  32. package/dist/utils/validate.d.cts +1 -0
  33. package/dist/utils/validate.d.ts +1 -0
  34. package/dist/utils/validate.js +1 -0
  35. package/package.json +10 -5
  36. package/dist/nodejs/mongoose.cjs +0 -1
  37. package/dist/nodejs/mongoose.d.cts +0 -7
  38. package/dist/nodejs/mongoose.d.ts +0 -7
  39. package/dist/nodejs/mongoose.js +0 -1
  40. package/dist/typescript/mongoose.cjs +0 -1
  41. package/dist/typescript/mongoose.d.cts +0 -48
  42. package/dist/typescript/mongoose.d.ts +0 -48
  43. package/dist/typescript/mongoose.js +0 -1
@@ -27,7 +27,7 @@ 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 mongoose from 'mongoose';
30
+ import type { default as mongoose_2 } from 'mongoose';
31
31
  import mongoosePaginate from 'mongoose-paginate-v2';
32
32
  import type { OptionalUnlessRequiredId } from 'mongodb';
33
33
  import type { PaginateModel } from 'mongoose';
@@ -124,28 +124,6 @@ declare function createGraphqlCodegenConfig({ uri, from, to, withComponent, with
124
124
  export { createGraphqlCodegenConfig }
125
125
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_1 }
126
126
 
127
- declare function createModel<T extends Partial<C_Document_2>>({ mongoose, name, schema, pagination, aggregate, virtuals, middlewares, }: I_CreateModelOptions_2<T>): I_ExtendedModel_2<T>;
128
- export { createModel }
129
- export { createModel as createModel_alias_1 }
130
- export { createModel as createModel_alias_2 }
131
-
132
- declare function createMongoGenericFields({ returnDateAs, }?: {
133
- returnDateAs?: 'string' | 'date';
134
- }): I_GenericDocument_2;
135
- export { createMongoGenericFields }
136
- export { createMongoGenericFields as createMongoGenericFields_alias_1 }
137
- export { createMongoGenericFields as createMongoGenericFields_alias_2 }
138
-
139
- declare function createSchema<T extends Partial<C_Document_2>>({ mongoose, schema, virtuals, standalone, }: I_CreateSchemaOptions_2<T>): T_MongooseShema_2<T>;
140
- export { createSchema }
141
- export { createSchema as createSchema_alias_1 }
142
- export { createSchema as createSchema_alias_2 }
143
-
144
- declare function createSlugQuery<T>(slug: string, filters?: T_FilterQuery_2<T>, id?: string): T_CreateSlugQueryResponse_2<T>;
145
- export { createSlugQuery }
146
- export { createSlugQuery as createSlugQuery_alias_1 }
147
- export { createSlugQuery as createSlugQuery_alias_2 }
148
-
149
127
  declare function deepMerge(...configs: (I_Config_2 | I_Config_2[])[]): I_Config_2;
150
128
  export { deepMerge }
151
129
  export { deepMerge as deepMerge_alias_1 }
@@ -5979,11 +5957,6 @@ export { getLatestPackageVersion }
5979
5957
  export { getLatestPackageVersion as getLatestPackageVersion_alias_1 }
5980
5958
  export { getLatestPackageVersion as getLatestPackageVersion_alias_2 }
5981
5959
 
5982
- declare function getMongoDateTime(now?: Date): string;
5983
- export { getMongoDateTime }
5984
- export { getMongoDateTime as getMongoDateTime_alias_1 }
5985
- export { getMongoDateTime as getMongoDateTime_alias_2 }
5986
-
5987
5960
  declare function getStoredErrorLists(): Promise<I_ErrorEntry_2[]>;
5988
5961
  export { getStoredErrorLists }
5989
5962
  export { getStoredErrorLists as getStoredErrorLists_alias_1 }
@@ -6319,7 +6292,7 @@ declare interface I_MongooseModelMiddleware_2<T extends Partial<C_Document_2>> {
6319
6292
  }
6320
6293
 
6321
6294
  declare interface I_MongooseOptions<T extends Partial<C_Document>> {
6322
- mongoose: typeof mongoose;
6295
+ mongoose: typeof mongoose_2;
6323
6296
  virtuals?: {
6324
6297
  name: keyof T | string;
6325
6298
  options?: I_VirtualOptions_2;
@@ -6331,7 +6304,7 @@ export { I_MongooseOptions as I_MongooseOptions_alias_1 }
6331
6304
  export { I_MongooseOptions as I_MongooseOptions_alias_2 }
6332
6305
 
6333
6306
  declare interface I_MongooseOptions_2<T extends Partial<C_Document_2>> {
6334
- mongoose: typeof mongoose;
6307
+ mongoose: typeof mongoose_2;
6335
6308
  virtuals?: {
6336
6309
  name: keyof T | string;
6337
6310
  options?: I_VirtualOptions;
@@ -6341,7 +6314,7 @@ declare interface I_MongooseOptions_2<T extends Partial<C_Document_2>> {
6341
6314
 
6342
6315
  declare interface I_NextIntlContextType {
6343
6316
  languages: I_NextIntlLanguage[];
6344
- currentLanguage: I_NextIntlLanguage;
6317
+ currentLanguage?: I_NextIntlLanguage;
6345
6318
  setCurrentLanguage: (newLang: I_NextIntlLanguage) => void;
6346
6319
  }
6347
6320
  export { I_NextIntlContextType }
@@ -6350,7 +6323,7 @@ export { I_NextIntlContextType as I_NextIntlContextType_alias_2 }
6350
6323
 
6351
6324
  declare interface I_NextIntlContextType_2 {
6352
6325
  languages: I_NextIntlLanguage_2[];
6353
- currentLanguage: I_NextIntlLanguage_2;
6326
+ currentLanguage?: I_NextIntlLanguage_2;
6354
6327
  setCurrentLanguage: (newLang: I_NextIntlLanguage_2) => void;
6355
6328
  }
6356
6329
 
@@ -6534,6 +6507,16 @@ export { LoadingProvider }
6534
6507
  export { LoadingProvider as LoadingProvider_alias_1 }
6535
6508
  export { LoadingProvider as LoadingProvider_alias_2 }
6536
6509
 
6510
+ declare const mongo: {
6511
+ getDateTime(now?: Date): string;
6512
+ createGenericFields({ returnDateAs, }?: {
6513
+ returnDateAs?: "string" | "date";
6514
+ }): I_GenericDocument_2;
6515
+ };
6516
+ export { mongo }
6517
+ export { mongo as mongo_alias_1 }
6518
+ export { mongo as mongo_alias_2 }
6519
+
6537
6520
  declare class MongoController<D extends Partial<C_Document_2>> {
6538
6521
  private collection;
6539
6522
  constructor(db: C_Db_2, collectionName: string);
@@ -6587,6 +6570,24 @@ export { MongoController }
6587
6570
  export { MongoController as MongoController_alias_1 }
6588
6571
  export { MongoController as MongoController_alias_2 }
6589
6572
 
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
+
6590
6591
  declare class MongooseController<T extends Partial<C_Document_2>> {
6591
6592
  private model;
6592
6593
  constructor(model: I_ExtendedModel_2<T>);
@@ -7073,12 +7074,12 @@ export { T_MongoosePlugin }
7073
7074
  export { T_MongoosePlugin as T_MongoosePlugin_alias_1 }
7074
7075
  export { T_MongoosePlugin as T_MongoosePlugin_alias_2 }
7075
7076
 
7076
- declare type T_MongooseShema<T> = mongoose.Schema<T>;
7077
+ declare type T_MongooseShema<T> = mongoose_2.Schema<T>;
7077
7078
  export { T_MongooseShema }
7078
7079
  export { T_MongooseShema as T_MongooseShema_alias_1 }
7079
7080
  export { T_MongooseShema as T_MongooseShema_alias_2 }
7080
7081
 
7081
- declare type T_MongooseShema_2<T> = mongoose.Schema<T>;
7082
+ declare type T_MongooseShema_2<T> = mongoose_2.Schema<T>;
7082
7083
 
7083
7084
  declare type T_NextIntlMessageList = Record<string, AbstractIntlMessages>;
7084
7085
  export { T_NextIntlMessageList }
@@ -7241,7 +7242,11 @@ export { useNextIntl }
7241
7242
  export { useNextIntl as useNextIntl_alias_1 }
7242
7243
  export { useNextIntl as useNextIntl_alias_2 }
7243
7244
 
7244
- declare function useStorage<T>(key: string, initialValue: T, serializer?: I_Serializer_2<T>): readonly [T, (value: T | ((val: T) => T)) => void];
7245
+ declare function useStorage<T>(key: string, initialValue?: T, serializer?: I_Serializer_2<T>): {
7246
+ value: T | undefined;
7247
+ set: (newValue: T | ((val: T | undefined) => T)) => void;
7248
+ remove: () => Promise<void>;
7249
+ };
7245
7250
  export { useStorage }
7246
7251
  export { useStorage as useStorage_alias_1 }
7247
7252
  export { useStorage as useStorage_alias_2 }
@@ -7251,19 +7256,12 @@ export { useTranslateNextIntl }
7251
7256
  export { useTranslateNextIntl as useTranslateNextIntl_alias_1 }
7252
7257
  export { useTranslateNextIntl as useTranslateNextIntl_alias_2 }
7253
7258
 
7254
- declare const validateMongooseField: {
7259
+ declare const validate: {
7255
7260
  isEmpty(value: unknown): boolean;
7256
- isEmptyValidator<T>(): (this: T, value: unknown) => Promise<boolean>;
7257
- isUniqueValidator<T extends {
7258
- constructor: {
7259
- findOne: (query: Record<string, unknown>) => Promise<unknown>;
7260
- };
7261
- }>(fields: string[]): (this: T, value: unknown) => Promise<boolean>;
7262
- matchesRegexValidator(regexArray: RegExp[]): (value: string) => Promise<boolean>;
7263
7261
  };
7264
- export { validateMongooseField }
7265
- export { validateMongooseField as validateMongooseField_alias_1 }
7266
- export { validateMongooseField as validateMongooseField_alias_2 }
7262
+ export { validate }
7263
+ export { validate as validate_alias_1 }
7264
+ export { validate as validate_alias_2 }
7267
7265
 
7268
7266
  declare function withNextIntl<T extends {
7269
7267
  children: T_Children_2;
@@ -27,7 +27,7 @@ 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 mongoose from 'mongoose';
30
+ import type { default as mongoose_2 } from 'mongoose';
31
31
  import mongoosePaginate from 'mongoose-paginate-v2';
32
32
  import type { OptionalUnlessRequiredId } from 'mongodb';
33
33
  import type { PaginateModel } from 'mongoose';
@@ -124,28 +124,6 @@ declare function createGraphqlCodegenConfig({ uri, from, to, withComponent, with
124
124
  export { createGraphqlCodegenConfig }
125
125
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_1 }
126
126
 
127
- declare function createModel<T extends Partial<C_Document_2>>({ mongoose, name, schema, pagination, aggregate, virtuals, middlewares, }: I_CreateModelOptions_2<T>): I_ExtendedModel_2<T>;
128
- export { createModel }
129
- export { createModel as createModel_alias_1 }
130
- export { createModel as createModel_alias_2 }
131
-
132
- declare function createMongoGenericFields({ returnDateAs, }?: {
133
- returnDateAs?: 'string' | 'date';
134
- }): I_GenericDocument_2;
135
- export { createMongoGenericFields }
136
- export { createMongoGenericFields as createMongoGenericFields_alias_1 }
137
- export { createMongoGenericFields as createMongoGenericFields_alias_2 }
138
-
139
- declare function createSchema<T extends Partial<C_Document_2>>({ mongoose, schema, virtuals, standalone, }: I_CreateSchemaOptions_2<T>): T_MongooseShema_2<T>;
140
- export { createSchema }
141
- export { createSchema as createSchema_alias_1 }
142
- export { createSchema as createSchema_alias_2 }
143
-
144
- declare function createSlugQuery<T>(slug: string, filters?: T_FilterQuery_2<T>, id?: string): T_CreateSlugQueryResponse_2<T>;
145
- export { createSlugQuery }
146
- export { createSlugQuery as createSlugQuery_alias_1 }
147
- export { createSlugQuery as createSlugQuery_alias_2 }
148
-
149
127
  declare function deepMerge(...configs: (I_Config_2 | I_Config_2[])[]): I_Config_2;
150
128
  export { deepMerge }
151
129
  export { deepMerge as deepMerge_alias_1 }
@@ -5979,11 +5957,6 @@ export { getLatestPackageVersion }
5979
5957
  export { getLatestPackageVersion as getLatestPackageVersion_alias_1 }
5980
5958
  export { getLatestPackageVersion as getLatestPackageVersion_alias_2 }
5981
5959
 
5982
- declare function getMongoDateTime(now?: Date): string;
5983
- export { getMongoDateTime }
5984
- export { getMongoDateTime as getMongoDateTime_alias_1 }
5985
- export { getMongoDateTime as getMongoDateTime_alias_2 }
5986
-
5987
5960
  declare function getStoredErrorLists(): Promise<I_ErrorEntry_2[]>;
5988
5961
  export { getStoredErrorLists }
5989
5962
  export { getStoredErrorLists as getStoredErrorLists_alias_1 }
@@ -6319,7 +6292,7 @@ declare interface I_MongooseModelMiddleware_2<T extends Partial<C_Document_2>> {
6319
6292
  }
6320
6293
 
6321
6294
  declare interface I_MongooseOptions<T extends Partial<C_Document>> {
6322
- mongoose: typeof mongoose;
6295
+ mongoose: typeof mongoose_2;
6323
6296
  virtuals?: {
6324
6297
  name: keyof T | string;
6325
6298
  options?: I_VirtualOptions_2;
@@ -6331,7 +6304,7 @@ export { I_MongooseOptions as I_MongooseOptions_alias_1 }
6331
6304
  export { I_MongooseOptions as I_MongooseOptions_alias_2 }
6332
6305
 
6333
6306
  declare interface I_MongooseOptions_2<T extends Partial<C_Document_2>> {
6334
- mongoose: typeof mongoose;
6307
+ mongoose: typeof mongoose_2;
6335
6308
  virtuals?: {
6336
6309
  name: keyof T | string;
6337
6310
  options?: I_VirtualOptions;
@@ -6341,7 +6314,7 @@ declare interface I_MongooseOptions_2<T extends Partial<C_Document_2>> {
6341
6314
 
6342
6315
  declare interface I_NextIntlContextType {
6343
6316
  languages: I_NextIntlLanguage[];
6344
- currentLanguage: I_NextIntlLanguage;
6317
+ currentLanguage?: I_NextIntlLanguage;
6345
6318
  setCurrentLanguage: (newLang: I_NextIntlLanguage) => void;
6346
6319
  }
6347
6320
  export { I_NextIntlContextType }
@@ -6350,7 +6323,7 @@ export { I_NextIntlContextType as I_NextIntlContextType_alias_2 }
6350
6323
 
6351
6324
  declare interface I_NextIntlContextType_2 {
6352
6325
  languages: I_NextIntlLanguage_2[];
6353
- currentLanguage: I_NextIntlLanguage_2;
6326
+ currentLanguage?: I_NextIntlLanguage_2;
6354
6327
  setCurrentLanguage: (newLang: I_NextIntlLanguage_2) => void;
6355
6328
  }
6356
6329
 
@@ -6534,6 +6507,16 @@ export { LoadingProvider }
6534
6507
  export { LoadingProvider as LoadingProvider_alias_1 }
6535
6508
  export { LoadingProvider as LoadingProvider_alias_2 }
6536
6509
 
6510
+ declare const mongo: {
6511
+ getDateTime(now?: Date): string;
6512
+ createGenericFields({ returnDateAs, }?: {
6513
+ returnDateAs?: "string" | "date";
6514
+ }): I_GenericDocument_2;
6515
+ };
6516
+ export { mongo }
6517
+ export { mongo as mongo_alias_1 }
6518
+ export { mongo as mongo_alias_2 }
6519
+
6537
6520
  declare class MongoController<D extends Partial<C_Document_2>> {
6538
6521
  private collection;
6539
6522
  constructor(db: C_Db_2, collectionName: string);
@@ -6587,6 +6570,24 @@ export { MongoController }
6587
6570
  export { MongoController as MongoController_alias_1 }
6588
6571
  export { MongoController as MongoController_alias_2 }
6589
6572
 
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
+
6590
6591
  declare class MongooseController<T extends Partial<C_Document_2>> {
6591
6592
  private model;
6592
6593
  constructor(model: I_ExtendedModel_2<T>);
@@ -7073,12 +7074,12 @@ export { T_MongoosePlugin }
7073
7074
  export { T_MongoosePlugin as T_MongoosePlugin_alias_1 }
7074
7075
  export { T_MongoosePlugin as T_MongoosePlugin_alias_2 }
7075
7076
 
7076
- declare type T_MongooseShema<T> = mongoose.Schema<T>;
7077
+ declare type T_MongooseShema<T> = mongoose_2.Schema<T>;
7077
7078
  export { T_MongooseShema }
7078
7079
  export { T_MongooseShema as T_MongooseShema_alias_1 }
7079
7080
  export { T_MongooseShema as T_MongooseShema_alias_2 }
7080
7081
 
7081
- declare type T_MongooseShema_2<T> = mongoose.Schema<T>;
7082
+ declare type T_MongooseShema_2<T> = mongoose_2.Schema<T>;
7082
7083
 
7083
7084
  declare type T_NextIntlMessageList = Record<string, AbstractIntlMessages>;
7084
7085
  export { T_NextIntlMessageList }
@@ -7241,7 +7242,11 @@ export { useNextIntl }
7241
7242
  export { useNextIntl as useNextIntl_alias_1 }
7242
7243
  export { useNextIntl as useNextIntl_alias_2 }
7243
7244
 
7244
- declare function useStorage<T>(key: string, initialValue: T, serializer?: I_Serializer_2<T>): readonly [T, (value: T | ((val: T) => T)) => void];
7245
+ declare function useStorage<T>(key: string, initialValue?: T, serializer?: I_Serializer_2<T>): {
7246
+ value: T | undefined;
7247
+ set: (newValue: T | ((val: T | undefined) => T)) => void;
7248
+ remove: () => Promise<void>;
7249
+ };
7245
7250
  export { useStorage }
7246
7251
  export { useStorage as useStorage_alias_1 }
7247
7252
  export { useStorage as useStorage_alias_2 }
@@ -7251,19 +7256,12 @@ export { useTranslateNextIntl }
7251
7256
  export { useTranslateNextIntl as useTranslateNextIntl_alias_1 }
7252
7257
  export { useTranslateNextIntl as useTranslateNextIntl_alias_2 }
7253
7258
 
7254
- declare const validateMongooseField: {
7259
+ declare const validate: {
7255
7260
  isEmpty(value: unknown): boolean;
7256
- isEmptyValidator<T>(): (this: T, value: unknown) => Promise<boolean>;
7257
- isUniqueValidator<T extends {
7258
- constructor: {
7259
- findOne: (query: Record<string, unknown>) => Promise<unknown>;
7260
- };
7261
- }>(fields: string[]): (this: T, value: unknown) => Promise<boolean>;
7262
- matchesRegexValidator(regexArray: RegExp[]): (value: string) => Promise<boolean>;
7263
7261
  };
7264
- export { validateMongooseField }
7265
- export { validateMongooseField as validateMongooseField_alias_1 }
7266
- export { validateMongooseField as validateMongooseField_alias_2 }
7262
+ export { validate }
7263
+ export { validate as validate_alias_1 }
7264
+ export { validate as validate_alias_2 }
7267
7265
 
7268
7266
  declare function withNextIntl<T extends {
7269
7267
  children: T_Children_2;