@kikiutils/mongoose 5.0.1 → 5.1.1

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 (39) hide show
  1. package/dist/_internals.js.map +1 -1
  2. package/dist/_virtual/rolldown_runtime.js +13 -0
  3. package/dist/constants.js.map +1 -1
  4. package/dist/options.js.map +1 -1
  5. package/dist/plugins/normalize.js.map +1 -1
  6. package/dist/schema-builders/boolean.d.ts.map +1 -1
  7. package/dist/schema-builders/decimal128.d.ts.map +1 -1
  8. package/dist/schema-builders/decimal128.js.map +1 -1
  9. package/dist/schema-builders/ref.d.ts.map +1 -1
  10. package/dist/schema-builders/ref.js.map +1 -1
  11. package/dist/schema-builders/string.d.ts.map +1 -1
  12. package/dist/schema-builders/string.js.map +1 -1
  13. package/dist/types/aggregate-paginate.d.ts +4 -2
  14. package/dist/types/aggregate-paginate.d.ts.map +1 -1
  15. package/dist/types/index.d.ts +3 -3
  16. package/dist/types/paginate.d.ts +4 -2
  17. package/dist/types/paginate.d.ts.map +1 -1
  18. package/dist/utils.d.ts +1 -1
  19. package/dist/utils.d.ts.map +1 -1
  20. package/dist/utils.js.map +1 -1
  21. package/package.json +22 -10
  22. package/src/_internals.ts +1 -1
  23. package/src/constants.ts +1 -1
  24. package/src/options.ts +4 -4
  25. package/src/plugins/normalize.ts +1 -1
  26. package/src/schema-builders/decimal128.ts +1 -1
  27. package/src/schema-builders/ref.ts +1 -1
  28. package/src/schema-builders/string.ts +1 -1
  29. package/src/types/aggregate-paginate.ts +0 -2
  30. package/src/types/index.ts +2 -2
  31. package/src/types/options.ts +2 -2
  32. package/src/types/paginate.ts +0 -2
  33. package/src/utils.ts +9 -9
  34. package/dist/types/aggregate-paginate.js +0 -1
  35. package/dist/types/data.js +0 -1
  36. package/dist/types/index.js +0 -1
  37. package/dist/types/options.js +0 -1
  38. package/dist/types/paginate.js +0 -1
  39. package/dist/types/utils.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"_internals.js","names":["customMongooseOptions: CustomMongooseOptions"],"sources":["../src/_internals.ts"],"sourcesContent":["import type { CustomMongooseOptions } from './types/options';\n\nexport const customMongooseOptions: CustomMongooseOptions = {};\n"],"mappings":";AAEA,MAAaA,wBAA+C,EAAE"}
1
+ {"version":3,"file":"_internals.js","names":["customMongooseOptions: CustomMongooseOptions"],"sources":["../src/_internals.ts"],"sourcesContent":["import type { CustomMongooseOptions } from '@/types/options';\n\nexport const customMongooseOptions: CustomMongooseOptions = {};\n"],"mappings":";AAEA,MAAaA,wBAA+C,EAAE"}
@@ -0,0 +1,13 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (all) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ return target;
10
+ };
11
+
12
+ //#endregion
13
+ export { __export };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["mongooseConnections: MongooseConnections"],"sources":["../src/constants.ts"],"sourcesContent":["import type { MongooseConnections } from './types';\n\n/**\n * Mongoose connections.\n *\n * This constant is a record of named Mongoose connections, allowing multiple\n * database connections to be managed within the application. An optional `default`\n * connection can also be specified for use when a specific connection is not provided.\n */\nexport const mongooseConnections: MongooseConnections = {};\n"],"mappings":";;;;;;;;AASA,MAAaA,sBAA2C,EAAE"}
1
+ {"version":3,"file":"constants.js","names":["mongooseConnections: MongooseConnections"],"sources":["../src/constants.ts"],"sourcesContent":["import type { MongooseConnections } from '@/types';\n\n/**\n * Mongoose connections.\n *\n * This constant is a record of named Mongoose connections, allowing multiple\n * database connections to be managed within the application. An optional `default`\n * connection can also be specified for use when a specific connection is not provided.\n */\nexport const mongooseConnections: MongooseConnections = {};\n"],"mappings":";;;;;;;;AASA,MAAaA,sBAA2C,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","names":[],"sources":["../src/options.ts"],"sourcesContent":["import { customMongooseOptions } from './_internals';\nimport type { CustomMongooseOptions } from './types/options';\nimport type { buildMongooseModel } from './utils';\n\nexport type DoNotRemoveOrUseThisType = typeof buildMongooseModel;\n\n/**\n * Sets custom options.\n *\n * For example, you can set {@link CustomMongooseOptions.beforeModelBuild} to define a function that will be called\n * every time {@link buildMongooseModel} is used. Inside this function, you can modify\n * the schema, allowing you to apply common settings to all global schemas.\n */\nexport function setCustomMongooseOptions<K extends keyof CustomMongooseOptions>(\n key: K,\n value: CustomMongooseOptions[K],\n): void {\n customMongooseOptions[key] = value;\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAgB,yBACZ,KACA,OACI;AACJ,uBAAsB,OAAO"}
1
+ {"version":3,"file":"options.js","names":[],"sources":["../src/options.ts"],"sourcesContent":["import { customMongooseOptions } from '@/_internals';\nimport type { CustomMongooseOptions } from '@/types/options';\nimport type { buildMongooseModel } from '@/utils';\n\nexport type DoNotRemoveOrUseThisType = typeof buildMongooseModel;\n\n/**\n * Sets custom options.\n *\n * For example, you can set {@link CustomMongooseOptions.beforeModelBuild} to define a function that will be called\n * every time {@link buildMongooseModel} is used. Inside this function, you can modify\n * the schema, allowing you to apply common settings to all global schemas.\n */\nexport function setCustomMongooseOptions<K extends keyof CustomMongooseOptions>(\n key: K,\n value: CustomMongooseOptions[K],\n) {\n customMongooseOptions[key] = value;\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAgB,yBACZ,KACA,OACF;AACE,uBAAsB,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.js","names":["getProp"],"sources":["../../src/plugins/normalize.ts"],"sourcesContent":["import {\n get as getProp,\n set as setProp,\n unset as unsetProp,\n} from 'es-toolkit/compat';\nimport { Types } from 'mongoose';\nimport type { Schema } from 'mongoose';\n\nexport interface MongooseNormalizePluginOptions {\n /**\n * Whether to convert `_id` field to `id`.\n * If true, the `_id` field will be replaced with `id`.\n *\n * @default true\n */\n convertIdField?: boolean;\n\n /**\n * Whether to convert the `_id` field to a hex string if it's an ObjectId.\n *\n * @default true\n */\n toHexIdIfObjectId?: boolean;\n}\n\n/**\n * Mongoose plugin to normalize the JSON output of documents.\n *\n * This plugin modifies the `toJSON` method of Mongoose schemas to:\n * - Add an `id` field equal to the string representation of `_id`\n * - Remove the `_id` field\n * - Exclude fields marked as `private` from the JSON output\n * - Convert `Decimal128` fields to strings\n * - Remove the `__v` version key\n *\n * @template S - The type of the schema.\n *\n * @param schema - The Mongoose schema to apply the plugin to.\n */\nexport function mongooseNormalizePlugin<S extends Schema>(\n schema: S,\n pluginOptions?: MongooseNormalizePluginOptions,\n): void {\n const toJson = schema.get('toJSON');\n const toJsonTransform = toJson?.transform;\n schema.set(\n 'toJSON',\n {\n ...toJson,\n transform(doc, ret, options) {\n // eslint-disable-next-line style/object-curly-newline\n let { __v, _id, ...copiedRet } = ret;\n if (pluginOptions?.toHexIdIfObjectId !== false) {\n _id = _id instanceof Types.ObjectId ? _id.toHexString() : _id;\n }\n\n if (_id !== undefined) {\n if (pluginOptions?.convertIdField !== false) copiedRet.id = _id;\n else copiedRet._id = _id;\n }\n\n for (const path in schema.paths) {\n if (schema.paths[path]?.options?.private) {\n unsetProp(copiedRet, path);\n continue;\n }\n\n if (schema.paths[path]?.instance === 'Decimal128') {\n const value = getProp(copiedRet, path) as Types.Decimal128 | undefined;\n if (value) setProp(copiedRet, path, value.toString());\n }\n }\n\n if (toJsonTransform && typeof toJsonTransform !== 'boolean') {\n return toJsonTransform(doc as any, copiedRet as any, options as any);\n }\n\n return copiedRet;\n },\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,SAAgB,wBACZ,QACA,eACI;CACJ,MAAM,SAAS,OAAO,IAAI,SAAS;CACnC,MAAM,kBAAkB,QAAQ;AAChC,QAAO,IACH,UACA;EACI,GAAG;EACH,UAAU,KAAK,KAAK,SAAS;GAEzB,IAAI,EAAE,KAAK,IAAK,GAAG,cAAc;AACjC,OAAI,eAAe,sBAAsB,MACrC,OAAM,eAAe,MAAM,WAAW,IAAI,aAAa,GAAG;AAG9D,OAAI,QAAQ,OACR,KAAI,eAAe,mBAAmB,MAAO,WAAU,KAAK;OACvD,WAAU,MAAM;AAGzB,QAAK,MAAM,QAAQ,OAAO,OAAO;AAC7B,QAAI,OAAO,MAAM,OAAO,SAAS,SAAS;AACtC,WAAU,WAAW,KAAK;AAC1B;;AAGJ,QAAI,OAAO,MAAM,OAAO,aAAa,cAAc;KAC/C,MAAM,QAAQA,IAAQ,WAAW,KAAK;AACtC,SAAI,MAAO,KAAQ,WAAW,MAAM,MAAM,UAAU,CAAC;;;AAI7D,OAAI,mBAAmB,OAAO,oBAAoB,UAC9C,QAAO,gBAAgB,KAAY,WAAkB,QAAe;AAGxE,UAAO;;EAEd,CACJ"}
1
+ {"version":3,"file":"normalize.js","names":["getProp"],"sources":["../../src/plugins/normalize.ts"],"sourcesContent":["import {\n get as getProp,\n set as setProp,\n unset as unsetProp,\n} from 'es-toolkit/compat';\nimport { Types } from 'mongoose';\nimport type { Schema } from 'mongoose';\n\nexport interface MongooseNormalizePluginOptions {\n /**\n * Whether to convert `_id` field to `id`.\n * If true, the `_id` field will be replaced with `id`.\n *\n * @default true\n */\n convertIdField?: boolean;\n\n /**\n * Whether to convert the `_id` field to a hex string if it's an ObjectId.\n *\n * @default true\n */\n toHexIdIfObjectId?: boolean;\n}\n\n/**\n * Mongoose plugin to normalize the JSON output of documents.\n *\n * This plugin modifies the `toJSON` method of Mongoose schemas to:\n * - Add an `id` field equal to the string representation of `_id`\n * - Remove the `_id` field\n * - Exclude fields marked as `private` from the JSON output\n * - Convert `Decimal128` fields to strings\n * - Remove the `__v` version key\n *\n * @template S - The type of the schema.\n *\n * @param schema - The Mongoose schema to apply the plugin to.\n */\nexport function mongooseNormalizePlugin<S extends Schema>(\n schema: S,\n pluginOptions?: MongooseNormalizePluginOptions,\n) {\n const toJson = schema.get('toJSON');\n const toJsonTransform = toJson?.transform;\n schema.set(\n 'toJSON',\n {\n ...toJson,\n transform(doc, ret, options) {\n // eslint-disable-next-line style/object-curly-newline\n let { __v, _id, ...copiedRet } = ret;\n if (pluginOptions?.toHexIdIfObjectId !== false) {\n _id = _id instanceof Types.ObjectId ? _id.toHexString() : _id;\n }\n\n if (_id !== undefined) {\n if (pluginOptions?.convertIdField !== false) copiedRet.id = _id;\n else copiedRet._id = _id;\n }\n\n for (const path in schema.paths) {\n if (schema.paths[path]?.options?.private) {\n unsetProp(copiedRet, path);\n continue;\n }\n\n if (schema.paths[path]?.instance === 'Decimal128') {\n const value = getProp(copiedRet, path) as Types.Decimal128 | undefined;\n if (value) setProp(copiedRet, path, value.toString());\n }\n }\n\n if (toJsonTransform && typeof toJsonTransform !== 'boolean') {\n return toJsonTransform(doc as any, copiedRet as any, options as any);\n }\n\n return copiedRet;\n },\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,SAAgB,wBACZ,QACA,eACF;CACE,MAAM,SAAS,OAAO,IAAI,SAAS;CACnC,MAAM,kBAAkB,QAAQ;AAChC,QAAO,IACH,UACA;EACI,GAAG;EACH,UAAU,KAAK,KAAK,SAAS;GAEzB,IAAI,EAAE,KAAK,IAAK,GAAG,cAAc;AACjC,OAAI,eAAe,sBAAsB,MACrC,OAAM,eAAe,MAAM,WAAW,IAAI,aAAa,GAAG;AAG9D,OAAI,QAAQ,OACR,KAAI,eAAe,mBAAmB,MAAO,WAAU,KAAK;OACvD,WAAU,MAAM;AAGzB,QAAK,MAAM,QAAQ,OAAO,OAAO;AAC7B,QAAI,OAAO,MAAM,OAAO,SAAS,SAAS;AACtC,WAAU,WAAW,KAAK;AAC1B;;AAGJ,QAAI,OAAO,MAAM,OAAO,aAAa,cAAc;KAC/C,MAAM,QAAQA,IAAQ,WAAW,KAAK;AACtC,SAAI,MAAO,KAAQ,WAAW,MAAM,MAAM,UAAU,CAAC;;;AAI7D,OAAI,mBAAmB,OAAO,oBAAoB,UAC9C,QAAO,gBAAgB,KAAY,WAAkB,QAAe;AAGxE,UAAO;;EAEd,CACJ"}
@@ -1 +1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AA,EAuBH,KAAA,CAAM,UAvBH,EAAA,GAAA,MAAA,GAAA,SAAA;;UA0BX,oBAAA,CAzB2B;KAF2C,EAAA,CAAA,MAAA,EAAA;IAelE,QAAA,EAAA,GAAA,GAAA,MAAA;KAAO,GAAA,MAAA;;AACS,iBAiBd,uBAAA,CAAA,CAjBc,EA0CrB,uBA1CqB"}
@@ -1 +1 @@
1
- {"version":3,"file":"decimal128.js","names":["schema: Record<string, any>"],"sources":["../../src/schema-builders/decimal128.ts"],"sourcesContent":["import { Decimal } from 'decimal.js';\nimport { Schema } from 'mongoose';\nimport type {\n DefaultType,\n IndexDirection,\n IndexOptions,\n Types,\n} from 'mongoose';\nimport type { Merge } from 'type-fest';\n\nimport type { Readonlyable } from '../types/utils';\n\nimport { createBaseSchemaBuilderFactory } from './base';\n\nexport type ExtendDecimal128SchemaBuilder<\n Props extends BaseProps,\n ExtraOmitFields extends string,\n> = Omit<\n Decimal128SchemaBuilder<Props, ExtraOmitFields>,\n ExtraOmitFields | keyof Props\n>;\n\ninterface BaseProps {\n type: typeof Schema.Types.Decimal128;\n}\n\nexport interface Decimal128SchemaBuilder<\n Props extends { type: typeof Schema.Types.Decimal128 } = { type: typeof Schema.Types.Decimal128 },\n ExtraOmitFields extends string = never,\n> {\n default: <\n T extends ((this: any, doc: any) => DefaultType<D>) | DefaultType<D> | null,\n D extends Types.Decimal128,\n >(value: T) => ExtendDecimal128SchemaBuilder<\n Merge<Props, { default: T }>,\n ExtraOmitFields\n >;\n\n enum: <\n T extends\n | Readonlyable<Array<D | null>>\n | { [path: string]: D | null }\n | { message?: M; values: Readonlyable<Array<D | null>> },\n D extends Types.Decimal128,\n M extends string,\n >(value: T) => ExtendDecimal128SchemaBuilder<\n Merge<Props, { enum: T }>,\n ExtraOmitFields\n >;\n\n index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendDecimal128SchemaBuilder<\n Merge<Props, { index: T }>,\n ExtraOmitFields\n >;\n\n nonRequired: Props;\n private: ExtendDecimal128SchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;\n required: Merge<Props, { required: true }>;\n\n /**\n * Sets the rounding and toFixed behavior for Decimal128 fields.\n * This method allows specifying the number of decimal places and the rounding strategy to be used when\n * saving the field to the database.\n *\n * @param places - The number of decimal places to round to (default is 2).\n * @param rounding - The rounding strategy from the Decimal.js library (default is Decimal.ROUND_DOWN).\n *\n * @returns A schema builder with the rounding and toFixed behavior applied to the `set` option in Mongoose.\n */\n setRoundAndToFixedSetter: (places?: number, rounding?: Decimal.Rounding) => ExtendDecimal128SchemaBuilder<\n Merge<Props, ToStringSetterSchema>,\n 'setRoundAndToFixedSetter' | ExtraOmitFields\n >;\n\n /**\n * Sets the toString behavior for Decimal128 fields.\n * This method defines how the Decimal128 field should be converted to a string when processing or\n * retrieving the value in the application (e.g., via getters), while still storing the value as Decimal128\n * in the database.\n *\n * @returns A schema builder with the custom `get` behavior applied to convert the Decimal128 field to a string\n * when accessed in the application.\n */\n setToStringGetter: ExtendDecimal128SchemaBuilder<\n Merge<Props, ToStringGetterSchema>,\n 'setToStringGetter' | ExtraOmitFields\n >;\n\n sparse: ExtendDecimal128SchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;\n unique: ExtendDecimal128SchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;\n}\n\ninterface ToStringGetterSchema {\n get: (value?: Types.Decimal128) => string | undefined;\n}\n\ninterface ToStringSetterSchema {\n set: (value?: { toString: () => string }) => string;\n}\n\nconst baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.Decimal128);\n\nexport function decimal128SchemaBuilder(): Decimal128SchemaBuilder {\n const schema: Record<string, any> = {};\n const baseBuilder = baseBuilderFactory(schema);\n return new Proxy(\n baseBuilder,\n {\n get(target, key, receiver) {\n if (key === 'setRoundAndToFixedSetter') {\n return (places: number = 2, rounding: Decimal.Rounding = Decimal.ROUND_DOWN) => {\n schema.set = (value?: { toString: () => string }) => {\n if (value) return new Decimal(value.toString()).toFixed(places, rounding);\n };\n\n return receiver;\n };\n }\n\n if (key === 'setToStringGetter') {\n schema.get = (value?: Types.Decimal128) => value?.toString();\n return receiver;\n }\n\n return Reflect.get(target, key, receiver);\n },\n },\n ) as Decimal128SchemaBuilder;\n}\n"],"mappings":";;;;;AAoGA,MAAM,qBAAqB,+BAA+B,OAAO,MAAM,WAAW;AAElF,SAAgB,0BAAmD;CAC/D,MAAMA,SAA8B,EAAE;CACtC,MAAM,cAAc,mBAAmB,OAAO;AAC9C,QAAO,IAAI,MACP,aACA,EACI,IAAI,QAAQ,KAAK,UAAU;AACvB,MAAI,QAAQ,2BACR,SAAQ,SAAiB,GAAG,WAA6B,QAAQ,eAAe;AAC5E,UAAO,OAAO,UAAuC;AACjD,QAAI,MAAO,QAAO,IAAI,QAAQ,MAAM,UAAU,CAAC,CAAC,QAAQ,QAAQ,SAAS;;AAG7E,UAAO;;AAIf,MAAI,QAAQ,qBAAqB;AAC7B,UAAO,OAAO,UAA6B,OAAO,UAAU;AAC5D,UAAO;;AAGX,SAAO,QAAQ,IAAI,QAAQ,KAAK,SAAS;IAEhD,CACJ"}
1
+ {"version":3,"file":"decimal128.js","names":["schema: Record<string, any>"],"sources":["../../src/schema-builders/decimal128.ts"],"sourcesContent":["import { Decimal } from 'decimal.js';\nimport { Schema } from 'mongoose';\nimport type {\n DefaultType,\n IndexDirection,\n IndexOptions,\n Types,\n} from 'mongoose';\nimport type { Merge } from 'type-fest';\n\nimport type { Readonlyable } from '../types/utils';\n\nimport { createBaseSchemaBuilderFactory } from './base';\n\nexport type ExtendDecimal128SchemaBuilder<\n Props extends BaseProps,\n ExtraOmitFields extends string,\n> = Omit<\n Decimal128SchemaBuilder<Props, ExtraOmitFields>,\n ExtraOmitFields | keyof Props\n>;\n\ninterface BaseProps {\n type: typeof Schema.Types.Decimal128;\n}\n\nexport interface Decimal128SchemaBuilder<\n Props extends { type: typeof Schema.Types.Decimal128 } = { type: typeof Schema.Types.Decimal128 },\n ExtraOmitFields extends string = never,\n> {\n default: <\n T extends ((this: any, doc: any) => DefaultType<D>) | DefaultType<D> | null,\n D extends Types.Decimal128,\n >(value: T) => ExtendDecimal128SchemaBuilder<\n Merge<Props, { default: T }>,\n ExtraOmitFields\n >;\n\n enum: <\n T extends\n | Readonlyable<Array<D | null>>\n | { [path: string]: D | null }\n | { message?: M; values: Readonlyable<Array<D | null>> },\n D extends Types.Decimal128,\n M extends string,\n >(value: T) => ExtendDecimal128SchemaBuilder<\n Merge<Props, { enum: T }>,\n ExtraOmitFields\n >;\n\n index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendDecimal128SchemaBuilder<\n Merge<Props, { index: T }>,\n ExtraOmitFields\n >;\n\n nonRequired: Props;\n private: ExtendDecimal128SchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;\n required: Merge<Props, { required: true }>;\n\n /**\n * Sets the rounding and toFixed behavior for Decimal128 fields.\n * This method allows specifying the number of decimal places and the rounding strategy to be used when\n * saving the field to the database.\n *\n * @param places - The number of decimal places to round to (default is 2).\n * @param rounding - The rounding strategy from the Decimal.js library (default is Decimal.ROUND_DOWN).\n *\n * @returns A schema builder with the rounding and toFixed behavior applied to the `set` option in Mongoose.\n */\n setRoundAndToFixedSetter: (places?: number, rounding?: Decimal.Rounding) => ExtendDecimal128SchemaBuilder<\n Merge<Props, ToStringSetterSchema>,\n 'setRoundAndToFixedSetter' | ExtraOmitFields\n >;\n\n /**\n * Sets the toString behavior for Decimal128 fields.\n * This method defines how the Decimal128 field should be converted to a string when processing or\n * retrieving the value in the application (e.g., via getters), while still storing the value as Decimal128\n * in the database.\n *\n * @returns A schema builder with the custom `get` behavior applied to convert the Decimal128 field to a string\n * when accessed in the application.\n */\n setToStringGetter: ExtendDecimal128SchemaBuilder<\n Merge<Props, ToStringGetterSchema>,\n 'setToStringGetter' | ExtraOmitFields\n >;\n\n sparse: ExtendDecimal128SchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;\n unique: ExtendDecimal128SchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;\n}\n\ninterface ToStringGetterSchema {\n get: (value?: Types.Decimal128) => string | undefined;\n}\n\ninterface ToStringSetterSchema {\n set: (value?: { toString: () => string }) => string;\n}\n\nconst baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.Decimal128);\n\nexport function decimal128SchemaBuilder() {\n const schema: Record<string, any> = {};\n const baseBuilder = baseBuilderFactory(schema);\n return new Proxy(\n baseBuilder,\n {\n get(target, key, receiver) {\n if (key === 'setRoundAndToFixedSetter') {\n return (places: number = 2, rounding: Decimal.Rounding = Decimal.ROUND_DOWN) => {\n schema.set = (value?: { toString: () => string }) => {\n if (value) return new Decimal(value.toString()).toFixed(places, rounding);\n };\n\n return receiver;\n };\n }\n\n if (key === 'setToStringGetter') {\n schema.get = (value?: Types.Decimal128) => value?.toString();\n return receiver;\n }\n\n return Reflect.get(target, key, receiver);\n },\n },\n ) as Decimal128SchemaBuilder;\n}\n"],"mappings":";;;;;AAoGA,MAAM,qBAAqB,+BAA+B,OAAO,MAAM,WAAW;AAElF,SAAgB,0BAA0B;CACtC,MAAMA,SAA8B,EAAE;CACtC,MAAM,cAAc,mBAAmB,OAAO;AAC9C,QAAO,IAAI,MACP,aACA,EACI,IAAI,QAAQ,KAAK,UAAU;AACvB,MAAI,QAAQ,2BACR,SAAQ,SAAiB,GAAG,WAA6B,QAAQ,eAAe;AAC5E,UAAO,OAAO,UAAuC;AACjD,QAAI,MAAO,QAAO,IAAI,QAAQ,MAAM,UAAU,CAAC,CAAC,QAAQ,QAAQ,SAAS;;AAG7E,UAAO;;AAIf,MAAI,QAAQ,qBAAqB;AAC7B,UAAO,OAAO,UAA6B,OAAO,UAAU;AAC5D,UAAO;;AAGX,SAAO,QAAQ,IAAI,QAAQ,KAAK,SAAS;IAEhD,CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ref.d.ts","names":[],"sources":["../../src/schema-builders/ref.ts"],"sourcesContent":[],"m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KAjBA,CAiBM,KAjBN,EAAA;IACb,MAAA,EAAA,IAAA;MAgB6C,eAhBR,CAAA;QAAb,EAiBlC,sBAjBkC,CAiBX,KAjBW,CAiBL,KAjBK,EAAA;IAAb,MAAA,EAAA,IAAA;MAiBkC,eAf3C,CAAA;;AAEV,iBAkBE,gBAlBF,CAAA,UAAA,CAAA,CAAA,IAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAkBuD,KAlBvD,CAAA,GAAA,CAAA,GAAA,MAAA,CAAA,GAkB8E,KAlB9E,CAAA,GAAA,CAAA,GAAA,MAAA,CAAA,CAAA,GAAA,EAmBL,CAnBK,CAAA,EAqB4B,gBArB5B,CAAA;KAAe,EAqBqC,CArBrC;MAArB,EAAA,OAqB0E,MAAA,CAAO,KAAA,CAAM,QArBvF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ref.js","names":[],"sources":["../../src/schema-builders/ref.ts"],"sourcesContent":["import { Schema } from 'mongoose';\nimport type {\n DefaultType,\n IndexDirection,\n IndexOptions,\n Model,\n Types,\n} from 'mongoose';\nimport type { Merge } from 'type-fest';\n\nimport type { Readonlyable } from '../types/utils';\n\nimport { createBaseSchemaBuilderFactory } from './base';\n\nexport type ExtendRefSchemaBuilder<\n Props extends BaseProps,\n ExtraOmitFields extends string,\n> = Omit<\n RefSchemaBuilder<Props, ExtraOmitFields>,\n ExtraOmitFields | keyof Props\n>;\n\ninterface BaseProps {\n type: typeof Schema.Types.ObjectId;\n}\n\nexport interface RefSchemaBuilder<\n Props extends { type: typeof Schema.Types.ObjectId } = { type: typeof Schema.Types.ObjectId },\n ExtraOmitFields extends string = never,\n> {\n default: <\n T extends ((this: any, doc: any) => DefaultType<D>) | DefaultType<D> | null,\n D extends Types.ObjectId,\n >(value: T) => ExtendRefSchemaBuilder<\n Merge<Props, { default: T }>,\n ExtraOmitFields\n >;\n\n enum: <\n T extends\n | Readonlyable<Array<null | O>>\n | { [path: string]: null | O }\n | { message?: M; values: Readonlyable<Array<null | O>> },\n M extends string,\n O extends Types.ObjectId,\n >(value: T) => ExtendRefSchemaBuilder<\n Merge<Props, { enum: T }>,\n ExtraOmitFields\n >;\n\n index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendRefSchemaBuilder<\n Merge<Props, { index: T }>,\n ExtraOmitFields\n >;\n\n nonRequired: Props;\n private: ExtendRefSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;\n required: Merge<Props, { required: true }>;\n sparse: ExtendRefSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;\n unique: ExtendRefSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;\n}\n\nconst baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.ObjectId);\n\nexport function refSchemaBuilder<T extends ((this: any, doc: any) => Model<any> | string) | Model<any> | string>(\n ref: T,\n): RefSchemaBuilder<{ ref: T; type: typeof Schema.Types.ObjectId }> {\n return baseBuilderFactory({ ref }) as RefSchemaBuilder<{ ref: T; type: typeof Schema.Types.ObjectId }>;\n}\n"],"mappings":";;;;AA8DA,MAAM,qBAAqB,+BAA+B,OAAO,MAAM,SAAS;AAEhF,SAAgB,iBACZ,KACgE;AAChE,QAAO,mBAAmB,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"ref.js","names":[],"sources":["../../src/schema-builders/ref.ts"],"sourcesContent":["import { Schema } from 'mongoose';\nimport type {\n DefaultType,\n IndexDirection,\n IndexOptions,\n Model,\n Types,\n} from 'mongoose';\nimport type { Merge } from 'type-fest';\n\nimport type { Readonlyable } from '../types/utils';\n\nimport { createBaseSchemaBuilderFactory } from './base';\n\nexport type ExtendRefSchemaBuilder<\n Props extends BaseProps,\n ExtraOmitFields extends string,\n> = Omit<\n RefSchemaBuilder<Props, ExtraOmitFields>,\n ExtraOmitFields | keyof Props\n>;\n\ninterface BaseProps {\n type: typeof Schema.Types.ObjectId;\n}\n\nexport interface RefSchemaBuilder<\n Props extends { type: typeof Schema.Types.ObjectId } = { type: typeof Schema.Types.ObjectId },\n ExtraOmitFields extends string = never,\n> {\n default: <\n T extends ((this: any, doc: any) => DefaultType<D>) | DefaultType<D> | null,\n D extends Types.ObjectId,\n >(value: T) => ExtendRefSchemaBuilder<\n Merge<Props, { default: T }>,\n ExtraOmitFields\n >;\n\n enum: <\n T extends\n | Readonlyable<Array<null | O>>\n | { [path: string]: null | O }\n | { message?: M; values: Readonlyable<Array<null | O>> },\n M extends string,\n O extends Types.ObjectId,\n >(value: T) => ExtendRefSchemaBuilder<\n Merge<Props, { enum: T }>,\n ExtraOmitFields\n >;\n\n index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendRefSchemaBuilder<\n Merge<Props, { index: T }>,\n ExtraOmitFields\n >;\n\n nonRequired: Props;\n private: ExtendRefSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;\n required: Merge<Props, { required: true }>;\n sparse: ExtendRefSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;\n unique: ExtendRefSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;\n}\n\nconst baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.ObjectId);\n\nexport function refSchemaBuilder<T extends ((this: any, doc: any) => Model<any> | string) | Model<any> | string>(\n ref: T,\n) {\n return baseBuilderFactory({ ref }) as RefSchemaBuilder<{ ref: T; type: typeof Schema.Types.ObjectId }>;\n}\n"],"mappings":";;;;AA8DA,MAAM,qBAAqB,+BAA+B,OAAO,MAAM,SAAS;AAEhF,SAAgB,iBACZ,KACF;AACE,QAAO,mBAAmB,EAAE,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","names":[],"sources":["../../src/schema-builders/string.ts"],"sourcesContent":[],"mappings":";;;;;KAiBY,wCACM,6CAEd,KACA,oBAAoB,OAAO,kBAC3B,wBAAwB;UAGlB,SAAA;EARE,IAAA,EASF,sBAT2B;;UAY3B,QAXQ,CAAA,UAAA,MAAA,CAAA,CAAA;M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Content":["import {\n isIPv4,\n isIPv6,\n} from 'node:net';\n\nimport type {\n DefaultType,\n IndexDirection,\n IndexOptions,\n StringSchemaDefinition,\n} from 'mongoose';\nimport type { Merge } from 'type-fest';\n\nimport type { Readonlyable } from '../types/utils';\n\nimport { createBaseSchemaBuilderFactory } from './base';\n\nexport type ExtendStringSchemaBuilder<\n Props extends BaseProps,\n ExtraOmitFields extends string,\n> = Omit<\n StringSchemaBuilder<Props, ExtraOmitFields>,\n ExtraOmitFields | keyof Props\n>;\n\ninterface BaseProps {\n type: StringSchemaDefinition;\n}\n\ninterface IpSchema<T extends string> {\n trim: true;\n validate: { message: T; validator: (value: string) => boolean };\n}\n\nexport interface StringSchemaBuilder<\n Props extends { type: StringSchemaDefinition } = { type: StringSchemaDefinition },\n ExtraOmitFields extends string = never,\n> {\n default: <\n T extends ((this: any, doc: any) => DefaultType<D>) | DefaultType<D> | null,\n D extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { default: T }>,\n ExtraOmitFields\n >;\n\n enum: <\n T extends\n | Readonlyable<Array<null | S>>\n | { [path: string]: null | S }\n | { message?: M; values: Readonlyable<Array<null | S>> },\n M extends string,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { enum: T }>,\n ExtraOmitFields\n >;\n\n index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { index: T }>,\n ExtraOmitFields\n >;\n\n /**\n * Adds IPv4 validation to the string schema.\n * Ensures the string is a valid IPv4 address and trims the input. The validation message can be customized.\n *\n * @param message - The custom error message to return if validation fails. Defaults to a standard\n * IPv4 validation message.\n *\n * @returns A schema builder with IPv4 validation and the `trim` option enabled.\n */\n ipv4: <T extends string = typeof defaultIpv4ValidateMessage>(message?: T) => ExtendStringSchemaBuilder<\n Merge<Props, IpSchema<T>>,\n 'ipv4' | 'ipv6' | ExtraOmitFields\n >;\n\n /**\n * Adds IPv6 validation to the string schema.\n * Ensures the string is a valid IPv6 address and trims the input. The validation message can be customized.\n *\n * @param message - The custom error message to return if validation fails. Defaults to a standard\n * IPv6 validation message.\n *\n * @returns A schema builder with IPv6 validation and the `trim` option enabled.\n */\n ipv6: <T extends string = typeof defaultIpv6ValidateMessage>(message?: T) => ExtendStringSchemaBuilder<\n Merge<Props, IpSchema<T>>,\n 'ipv4' | 'ipv6' | ExtraOmitFields\n >;\n\n /**\n * Sets both the maximum and minimum length of the string.\n * This method ensures the string length is exactly or within a specified range.\n *\n * @param value - A number representing the exact length or an array specifying [minimum, maximum] length.\n *\n * @returns A schema builder with both `maxlength` and `minlength` options applied.\n */\n length: <\n T extends L | Readonlyable<[L, S]>,\n L extends number,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { maxlength: T; minlength: T }>,\n ExtraOmitFields\n >;\n\n lowercase: ExtendStringSchemaBuilder<Merge<Props, { lowercase: true }>, ExtraOmitFields>;\n maxlength: <\n T extends L | Readonlyable<[L, S]>,\n L extends number,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { maxlength: T }>,\n ExtraOmitFields\n >;\n\n minlength: <\n T extends L | Readonlyable<[L, S]>,\n L extends number,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { minlength: T }>,\n ExtraOmitFields\n >;\n\n nonRequired: Props;\n private: ExtendStringSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;\n required: Merge<Props, { required: true }>;\n sparse: ExtendStringSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;\n text: ExtendStringSchemaBuilder<Merge<Props, { text: true }>, ExtraOmitFields>;\n trim: ExtendStringSchemaBuilder<Merge<Props, { trim: true }>, ExtraOmitFields>;\n unique: ExtendStringSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;\n uppercase: ExtendStringSchemaBuilder<Merge<Props, { uppercase: true }>, ExtraOmitFields>;\n}\n\nconst baseBuilderFactory = createBaseSchemaBuilderFactory(String);\nconst defaultIpv4ValidateMessage = '`{VALUE}` is not a valid IPv4 address for path `{PATH}`';\nconst defaultIpv6ValidateMessage = '`{VALUE}` is not a valid IPv6 address for path `{PATH}`';\n\nexport function stringSchemaBuilder(): StringSchemaBuilder {\n const schema: Record<string, any> = {};\n const baseBuilder = baseBuilderFactory(schema);\n return new Proxy(\n baseBuilder,\n {\n get(target, key, receiver) {\n if (key === 'ipv4') {\n return (message: string = defaultIpv4ValidateMessage) => {\n schema.trim = true;\n schema.validate = {\n message,\n validator: (value: string) => isIPv4(value),\n };\n\n return receiver;\n };\n }\n\n if (key === 'ipv6') {\n return (message: string = defaultIpv6ValidateMessage) => {\n schema.trim = true;\n schema.validate = {\n message,\n validator: (value: string) => isIPv6(value),\n };\n\n return receiver;\n };\n }\n\n if (key === 'length') {\n return (value: any) => {\n schema.maxlength = schema.minlength = value;\n return receiver;\n };\n }\n\n return Reflect.get(target, key, receiver);\n },\n },\n ) as StringSchemaBuilder;\n}\n"],"mappings":";;;;AAyIA,MAAM,qBAAqB,+BAA+B,OAAO;AACjE,MAAM,6BAA6B;AACnC,MAAM,6BAA6B;AAEnC,SAAgB,sBAA2C;CACvD,MAAMA,SAA8B,EAAE;CACtC,MAAM,cAAc,mBAAmB,OAAO;AAC9C,QAAO,IAAI,MACP,aACA,EACI,IAAI,QAAQ,KAAK,UAAU;AACvB,MAAI,QAAQ,OACR,SAAQ,UAAkB,+BAA+B;AACrD,UAAO,OAAO;AACd,UAAO,WAAW;IACd;IACA,YAAY,UAAkB,OAAO,MAAM;IAC9C;AAED,UAAO;;AAIf,MAAI,QAAQ,OACR,SAAQ,UAAkB,+BAA+B;AACrD,UAAO,OAAO;AACd,UAAO,WAAW;IACd;IACA,YAAY,UAAkB,OAAO,MAAM;IAC9C;AAED,UAAO;;AAIf,MAAI,QAAQ,SACR,SAAQ,UAAe;AACnB,UAAO,YAAY,OAAO,YAAY;AACtC,UAAO;;AAIf,SAAO,QAAQ,IAAI,QAAQ,KAAK,SAAS;IAEhD,CACJ"}
1
+ {"version":3,"file":"string.js","names":["schema: Record<string, any>"],"sources":["../../src/schema-builders/string.ts"],"sourcesContent":["import {\n isIPv4,\n isIPv6,\n} from 'node:net';\n\nimport type {\n DefaultType,\n IndexDirection,\n IndexOptions,\n StringSchemaDefinition,\n} from 'mongoose';\nimport type { Merge } from 'type-fest';\n\nimport type { Readonlyable } from '../types/utils';\n\nimport { createBaseSchemaBuilderFactory } from './base';\n\nexport type ExtendStringSchemaBuilder<\n Props extends BaseProps,\n ExtraOmitFields extends string,\n> = Omit<\n StringSchemaBuilder<Props, ExtraOmitFields>,\n ExtraOmitFields | keyof Props\n>;\n\ninterface BaseProps {\n type: StringSchemaDefinition;\n}\n\ninterface IpSchema<T extends string> {\n trim: true;\n validate: { message: T; validator: (value: string) => boolean };\n}\n\nexport interface StringSchemaBuilder<\n Props extends { type: StringSchemaDefinition } = { type: StringSchemaDefinition },\n ExtraOmitFields extends string = never,\n> {\n default: <\n T extends ((this: any, doc: any) => DefaultType<D>) | DefaultType<D> | null,\n D extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { default: T }>,\n ExtraOmitFields\n >;\n\n enum: <\n T extends\n | Readonlyable<Array<null | S>>\n | { [path: string]: null | S }\n | { message?: M; values: Readonlyable<Array<null | S>> },\n M extends string,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { enum: T }>,\n ExtraOmitFields\n >;\n\n index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { index: T }>,\n ExtraOmitFields\n >;\n\n /**\n * Adds IPv4 validation to the string schema.\n * Ensures the string is a valid IPv4 address and trims the input. The validation message can be customized.\n *\n * @param message - The custom error message to return if validation fails. Defaults to a standard\n * IPv4 validation message.\n *\n * @returns A schema builder with IPv4 validation and the `trim` option enabled.\n */\n ipv4: <T extends string = typeof defaultIpv4ValidateMessage>(message?: T) => ExtendStringSchemaBuilder<\n Merge<Props, IpSchema<T>>,\n 'ipv4' | 'ipv6' | ExtraOmitFields\n >;\n\n /**\n * Adds IPv6 validation to the string schema.\n * Ensures the string is a valid IPv6 address and trims the input. The validation message can be customized.\n *\n * @param message - The custom error message to return if validation fails. Defaults to a standard\n * IPv6 validation message.\n *\n * @returns A schema builder with IPv6 validation and the `trim` option enabled.\n */\n ipv6: <T extends string = typeof defaultIpv6ValidateMessage>(message?: T) => ExtendStringSchemaBuilder<\n Merge<Props, IpSchema<T>>,\n 'ipv4' | 'ipv6' | ExtraOmitFields\n >;\n\n /**\n * Sets both the maximum and minimum length of the string.\n * This method ensures the string length is exactly or within a specified range.\n *\n * @param value - A number representing the exact length or an array specifying [minimum, maximum] length.\n *\n * @returns A schema builder with both `maxlength` and `minlength` options applied.\n */\n length: <\n T extends L | Readonlyable<[L, S]>,\n L extends number,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { maxlength: T; minlength: T }>,\n ExtraOmitFields\n >;\n\n lowercase: ExtendStringSchemaBuilder<Merge<Props, { lowercase: true }>, ExtraOmitFields>;\n maxlength: <\n T extends L | Readonlyable<[L, S]>,\n L extends number,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { maxlength: T }>,\n ExtraOmitFields\n >;\n\n minlength: <\n T extends L | Readonlyable<[L, S]>,\n L extends number,\n S extends string,\n >(value: T) => ExtendStringSchemaBuilder<\n Merge<Props, { minlength: T }>,\n ExtraOmitFields\n >;\n\n nonRequired: Props;\n private: ExtendStringSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;\n required: Merge<Props, { required: true }>;\n sparse: ExtendStringSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;\n text: ExtendStringSchemaBuilder<Merge<Props, { text: true }>, ExtraOmitFields>;\n trim: ExtendStringSchemaBuilder<Merge<Props, { trim: true }>, ExtraOmitFields>;\n unique: ExtendStringSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;\n uppercase: ExtendStringSchemaBuilder<Merge<Props, { uppercase: true }>, ExtraOmitFields>;\n}\n\nconst baseBuilderFactory = createBaseSchemaBuilderFactory(String);\nconst defaultIpv4ValidateMessage = '`{VALUE}` is not a valid IPv4 address for path `{PATH}`';\nconst defaultIpv6ValidateMessage = '`{VALUE}` is not a valid IPv6 address for path `{PATH}`';\n\nexport function stringSchemaBuilder() {\n const schema: Record<string, any> = {};\n const baseBuilder = baseBuilderFactory(schema);\n return new Proxy(\n baseBuilder,\n {\n get(target, key, receiver) {\n if (key === 'ipv4') {\n return (message: string = defaultIpv4ValidateMessage) => {\n schema.trim = true;\n schema.validate = {\n message,\n validator: (value: string) => isIPv4(value),\n };\n\n return receiver;\n };\n }\n\n if (key === 'ipv6') {\n return (message: string = defaultIpv6ValidateMessage) => {\n schema.trim = true;\n schema.validate = {\n message,\n validator: (value: string) => isIPv6(value),\n };\n\n return receiver;\n };\n }\n\n if (key === 'length') {\n return (value: any) => {\n schema.maxlength = schema.minlength = value;\n return receiver;\n };\n }\n\n return Reflect.get(target, key, receiver);\n },\n },\n ) as StringSchemaBuilder;\n}\n"],"mappings":";;;;AAyIA,MAAM,qBAAqB,+BAA+B,OAAO;AACjE,MAAM,6BAA6B;AACnC,MAAM,6BAA6B;AAEnC,SAAgB,sBAAsB;CAClC,MAAMA,SAA8B,EAAE;CACtC,MAAM,cAAc,mBAAmB,OAAO;AAC9C,QAAO,IAAI,MACP,aACA,EACI,IAAI,QAAQ,KAAK,UAAU;AACvB,MAAI,QAAQ,OACR,SAAQ,UAAkB,+BAA+B;AACrD,UAAO,OAAO;AACd,UAAO,WAAW;IACd;IACA,YAAY,UAAkB,OAAO,MAAM;IAC9C;AAED,UAAO;;AAIf,MAAI,QAAQ,OACR,SAAQ,UAAkB,+BAA+B;AACrD,UAAO,OAAO;AACd,UAAO,WAAW;IACd;IACA,YAAY,UAAkB,OAAO,MAAM;IAC9C;AAED,UAAO;;AAIf,MAAI,QAAQ,SACR,SAAQ,UAAe;AACnB,UAAO,YAAY,OAAO,YAAY;AACtC,UAAO;;AAIf,SAAO,QAAQ,IAAI,QAAQ,KAAK,SAAS;IAEhD,CACJ"}
@@ -1,6 +1,9 @@
1
1
  import { Schema } from "mongoose";
2
2
 
3
3
  //#region src/types/aggregate-paginate.d.ts
4
+ declare namespace aggregate_paginate_d_exports {
5
+ export { mongooseAggregatePaginate as default };
6
+ }
4
7
  declare module 'mongoose' {
5
8
  type PrePaginatePipelineStage = '__PREPAGINATE__' | PipelineStage;
6
9
  interface AggregateCustomLabels<T = boolean | string | undefined> {
@@ -68,7 +71,6 @@ declare function mongooseAggregatePaginate(schema: Schema): void;
68
71
  declare namespace mongooseAggregatePaginate {
69
72
  const PREPAGINATION_PLACEHOLDER: string;
70
73
  }
71
- type DoNotRemoveOrUseThisType = unknown;
72
74
  //#endregion
73
- export { DoNotRemoveOrUseThisType, mongooseAggregatePaginate as default };
75
+ export { aggregate_paginate_d_exports, mongooseAggregatePaginate as default };
74
76
  //# sourceMappingURL=aggregate-paginate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-paginate.d.ts","names":[],"sources":["../../src/types/aggregate-paginate.ts"],"sourcesContent":[],"mappings":";;;;sDAawD;EAHtC,UAAA,qBAAA,CAAA,IAAA,OAAA,GAAA,MAAA,GAAA,SAAA,CAAA,CAAA;IAAA,IAAA,CAAA,EAMH,CANG;IAGsC,WAAA,CAAA,EAIlC,CAJkC;IAGzC,WAAA,CAAA,EAEO,CAFP;IACO,KAAA,CAAA,EAEN,CAFM;IACA,IAAA,CAAA,EAEP,CAFO;IACN,QAAA,CAAA,EAEG,CAFH;IACD,IAAA,CAAA,EAEA,CAFA;IACI,aAAA,CAAA,EAEK,CAFL;IACJ,QAAA,CAAA,EAEI,CAFJ;IACS,SAAA,CAAA,EAEJ,CAFI;IACL,UAAA,CAAA,EAEE,CAFF;;YAEE,sBAAA,CAAA,UAAA,EAAA,eAAA,MAAA,EAAA,8BAAA,MAAA,CAAA,SAOP,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seThisType as DoNotRemoveOrUseThisType$1 } from "./paginate.js";
2
+ import { aggregate_paginate_d_exports } from "./aggregate-paginate.js";
3
+ import { paginate_d_exports } from "./paginate.js";
4
4
  import { AggregatePaginateModel, Connection, HydratedDocument, PaginateModel, QueryWithHelpers, Types } from "mongoose";
5
5
  import { SetFieldType } from "type-fest";
6
6
 
@@ -80,5 +80,5 @@ declare global {
80
80
  }
81
81
  //# sourceMappingURL=index.d.ts.map
82
82
  //#endregion
83
- export { BaseModelStatics, MongooseConnections, type DoNotRemoveOrUseThisType as _ADoNotRemoveOrUseThisType, type DoNotRemoveOrUseThisType$1 as _PDoNotRemoveOrUseThisType };
83
+ export { BaseModelStatics, MongooseConnections, type aggregate_paginate_d_exports as _loadAggregatePaginateTypes, type paginate_d_exports as _loadPaginateTypes };
84
84
  //# sourceMappingURL=index.d.ts.map
@@ -2,6 +2,9 @@ import { IfElse } from "./utils.js";
2
2
  import { FilterQuery, PaginateOptions, Schema, mongo } from "mongoose";
3
3
 
4
4
  //#region src/types/paginate.d.ts
5
+ declare namespace paginate_d_exports {
6
+ export { _ as default };
7
+ }
5
8
  declare module 'mongoose' {
6
9
  type PaginateDocument<T, TMethods, TQueryHelpers, O extends PaginateOptions = object> = IfElse<O['lean'], IfElse<O['leanWithId'], T & {
7
10
  id: string;
@@ -110,7 +113,6 @@ declare namespace _ {
110
113
  getQuery: () => FilterQuery<T>;
111
114
  }
112
115
  }
113
- type DoNotRemoveOrUseThisType = unknown;
114
116
  //#endregion
115
- export { DoNotRemoveOrUseThisType, _ as default };
117
+ export { _ as default, paginate_d_exports };
116
118
  //# sourceMappingURL=paginate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paginate.d.ts","names":[],"sources":["../../src/types/paginate.ts"],"sourcesContent":[],"mappings":";;;;;8DAckB,4BACV,OACA,WACA,OACI,iBACA;IAZ0B,EAAA,EAAA,MAAA;EAAA,CAAA,EAa1B,MAb0B,CActB,CAdsB,CAAA,kBAAA,CAAA,EA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,GAAA,MAAA,EAAA;;YAAyB,kBAAA,CAAA;IAApD,UAAA,CAAA,EAAA,OAAA;IAAf,aAAA,CAAA,EAqFC,wBArFD;IAAR,QAAA,CAAA,EAsFI,eAtFJ,GAsFsB,eAtFtB,EAAA,GAAA,MAAA,GAAA,MAAA,EAAA;IAxBmE,IAAA,CAAA,EA+GnE,mBA/GmE;IA8B9D,MAAM,CAAA,EAAA,MAAA,GAAA,MAAA;;;iBAsFT,CAAA,CArEE,MAAA,EAqEQ,MArER,CAAA,EAAA,IAAA;kBAwED,CAAA,CAxEmB;QAEtB,QAAA,EAAA;IAGkB,OAAA,EAoEF,eApEE;;QAWnB,eAAA,EAAA;IAkBK,OAAA,EAwCmB,eAxCnB;;QAGQ,oBAAA,CAAA,CAAA,EAAA,UAuCiB,eAvCjB,CAAA,CAAA;IAGJ,WAAA,CAAA,OAAA,EAAA;MAA2B,KAAA,CAAA,EAqCX,MArCW,CAAA,MAAA,EAAA,GAAA,CAAA;IACF,CAAA;IAAY,GAAA,EAAA,GAAA,GAAA,CAqCxC,WArCwC,CAqC5B,CArC4B,CAAA,EAqCxB,CArCwB,CAAA;IAAkB,UAAA,EAAA,GAAA,GAsCpD,CAtCoD;IAAU,QAAA,EAAA,GAAA,GAuChE,WAvCgE,CAuCpD,CAvCoD,CAAA"}
package/dist/utils.d.ts CHANGED
@@ -46,7 +46,7 @@ declare function assertMongooseUpdateSuccess<T extends mongo.BSON.Document>(upda
46
46
  *
47
47
  * @returns The created Mongoose model.
48
48
  */
49
- declare function buildMongooseModel<DocType, Model extends BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>, InstanceMethodsAndOverrides = object, QueryHelpers = object>(collection: string, name: string, schema: Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>, options?: BuildMongooseModelOptions): Model;
49
+ declare function buildMongooseModel<DocType, Model extends BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>, InstanceMethodsAndOverrides = object, QueryHelpers = object>(collection: string, name: string, schema: Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>, options?: BuildMongooseModelOptions): any;
50
50
  /**
51
51
  * Converts a document or ObjectId to a document using the specified model.
52
52
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"sourcesContent":[],"mappings":";;;;;KAcY,wBAAA,UAAkC;AAA9C;AAgBA;;;;;;;;AAuCA;;;;;AAEkB,iBAzCI,2BAyCJ,CAAA,UAzC0C,KAAA,CAAM,IAAA,CAAK,QAyCrD,CAAA,CAAA,aAAA,EAxCC,OAwCD,CAxCS,KAAA,CAAM,YAwCf,CAxC4B,CAwC5B,CAAA,CAAA,EAAA,qBAAA,CAAA,EAAA,MAAA,CAAA,EAtCf,OAsCe,CAAA,IAAA,CAAA;;;;;;;;;AAuClB;;;;;;;;;;;;;;;AAyBA;;;;iBAlEgB,0CAEE,0BAA0B,SAAS,6BAA6B,sHAMtE,OAAO,SAAS,OAAO,6BAA6B,yBAClD,4BACX;;;;;;;;;;;;;;;;;;iBA+BmB,+CACR,yBAAyB,SAAS,6BAA6B,uFAKrD,2BAA2B,WACxC,0BAA0B,SAAS,6BAA6B,yCAExE,QAAQ;;;;;;;;;iBAgBK,mBAAA,cAAiC,KAAA,CAAM"}
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../src/utils.ts"],"sourcesContent":[],"mappings":";;;;;KAcY,wBAAA,UAAkC;AAA9C;AAgBA;;;;;;;;AAuCA;;;;;AAEkB,iBAzCI,2BAyCJ,CAAA,UAzC0C,KAAA,CAAM,IAAA,CAAK,QAyCrD,CAAA,CAAA,aAAA,EAxCC,OAwCD,CAxCS,KAAA,CAAM,YAwCf,CAxC4B,CAwC5B,CAAA,CAAA,EAAA,qBAAA,CAAA,EAAA,MAAA,CAAA,EAvCW,OAuCX,CAAA,IAAA,CAAA;;;;;;;;AAuClB;;;;;;;;;;;;;;;AAyBA;;;;;iBAlEgB,0CAEE,0BAA0B,SAAS,6BAA6B,sHAMtE,OAAO,SAAS,OAAO,6BAA6B,yBAClD;;;;;;;;;;;;;;;;;;iBAgCQ,+CACR,yBAAyB,SAAS,6BAA6B,uFAKrD,2BAA2B,WACxC,0BAA0B,SAAS,6BAA6B,yCAChD,QAAA;;;;;;;;;iBAiBX,mBAAA,cAAiC,KAAA,CAAM"}
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import mongoose, { Types } from 'mongoose';\nimport type {\n mongo,\n Schema,\n} from 'mongoose';\nimport mongooseAggregatePaginate from 'mongoose-aggregate-paginate-v2';\nimport mongoosePaginate from 'mongoose-paginate-v2';\n\nimport { customMongooseOptions } from './_internals';\nimport { mongooseConnections } from './constants';\nimport type { setCustomMongooseOptions } from './options';\nimport { mongooseNormalizePlugin } from './plugins/normalize';\nimport type { BuildMongooseModelOptions } from './types/options';\n\nexport type DoNotRemoveOrUseThisType = typeof setCustomMongooseOptions;\n\n/**\n * Asserts that a Mongoose update operation was successful by checking that it was acknowledged\n * and that at least the expected number of documents were modified.\n *\n * This function is intended for use with `updateOne`, `updateMany`, or any update operation\n * that returns a MongoDB `UpdateResult`.\n *\n * @template T - The shape of the document being updated.\n * @param updatePromise - A promise returned from a Mongoose update operation.\n * @param expectedModifiedCount - The minimum number of documents expected to be modified. Defaults to 1.\n * @throws Will throw an error if:\n * - The operation was not acknowledged by MongoDB,\n * - Fewer documents were modified than expected.\n */\nexport async function assertMongooseUpdateSuccess<T extends mongo.BSON.Document>(\n updatePromise: Promise<mongo.UpdateResult<T>>,\n expectedModifiedCount = 1,\n): Promise<void> {\n const updateResult = await updatePromise;\n if (!updateResult.acknowledged) throw new Error('Update was not acknowledged');\n if (updateResult.modifiedCount < expectedModifiedCount) {\n // eslint-disable-next-line style/max-len\n throw new Error(`Expected to modify at least ${expectedModifiedCount} document(s), but modified ${updateResult.modifiedCount}`);\n }\n}\n\n/**\n * Builds and returns a Mongoose model with specified schema and options.\n *\n * This function sets up a Mongoose model with optional plugins and timestamp settings.\n * It can optionally use a specified connection or the default connection.\n *\n * Determine the connection to use:\n * 1. Use the connection provided in the options, if available.\n * 2. Otherwise, use the default connection stored in `mongooseConnections`.\n * 3. If there's no default connection, create one using the MongoDB URI from the environment variables,\n * or fallback to a local MongoDB instance.\n *\n * You can set a function to be executed before the final build by using {@link setCustomMongooseOptions}.\n * However, ensure that this option is configured before calling {@link buildMongooseModel}.\n *\n * @template DocType - The type of the document.\n * @template Model - The type of the model, which extends `BaseMongoosePaginateModel`.\n * @template InstanceMethodsAndOverrides - The type for instance methods and overrides.\n * @template QueryHelpers - The type for additional query helpers.\n *\n * @param collection - The name of the collection.\n * @param name - The name of the model.\n * @param schema - The Mongoose schema to use for the model.\n * @param options - Optional settings for building the model.\n *\n * @returns The created Mongoose model.\n */\nexport function buildMongooseModel<\n DocType,\n Model extends BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>,\n InstanceMethodsAndOverrides = object,\n QueryHelpers = object,\n>(\n collection: string,\n name: string,\n schema: Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>,\n options?: BuildMongooseModelOptions,\n): Model {\n if (options?.enableNormalizePlugin !== false) {\n schema.plugin(mongooseNormalizePlugin, options?.normalizePluginOptions);\n }\n\n schema.plugin(mongooseAggregatePaginate);\n schema.plugin(mongoosePaginate);\n schema.set('timestamps', options?.timestamps ?? schema.get('timestamps') ?? true);\n customMongooseOptions.beforeModelBuild?.(schema);\n // eslint-disable-next-line style/max-len\n const connection = options?.connection || (mongooseConnections.default ||= mongoose.createConnection(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017'));\n return connection.model<DocType, Model, QueryHelpers>(name, schema, collection);\n}\n\n/**\n * Converts a document or ObjectId to a document using the specified model.\n *\n * This function takes a document or ObjectId and returns the corresponding document\n * from the database using the specified model. Optionally, specific fields can be selected.\n *\n * @template D - The type of the hydrated document.\n * @template DocType - The type of the document.\n * @template InstanceMethodsAndOverrides - The type for instance methods and overrides.\n * @template QueryHelpers - The type for additional query helpers.\n *\n * @param documentOrObjectId - The document or ObjectId to convert.\n * @param model - The Mongoose model to use for the conversion.\n * @param selectFields - Optional fields to select from the document.\n *\n * @returns The corresponding document or null if not found.\n */\nexport async function mongooseDocumentOrObjectIdToDocument<\n D extends MongooseHydratedDocument<DocType, InstanceMethodsAndOverrides, QueryHelpers>,\n DocType,\n InstanceMethodsAndOverrides,\n QueryHelpers,\n>(\n documentOrObjectId: MongooseDocumentOrObjectId<D>,\n model: BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>,\n selectFields?: string[],\n): Promise<D | null> {\n if (typeof documentOrObjectId === 'string' || documentOrObjectId instanceof Types.ObjectId) {\n return (await model.findById(documentOrObjectId).select(selectFields || [])) as D | null;\n }\n\n return documentOrObjectId;\n}\n\n/**\n * Converts the input, which can be a MongoDB ObjectId or a string,\n * into a 24-character hexadecimal string representation of the ObjectId.\n *\n * @param {string | Types.ObjectId} id - The ObjectId instance or its string representation\n *\n * @returns {string} The hexadecimal string representation of the ObjectId\n */\nexport function toObjectIdHexString(id: string | Types.ObjectId): string {\n return id instanceof Types.ObjectId ? id.toHexString() : id;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,eAAsB,4BAClB,eACA,wBAAwB,GACX;CACb,MAAM,eAAe,MAAM;AAC3B,KAAI,CAAC,aAAa,aAAc,OAAM,IAAI,MAAM,8BAA8B;AAC9E,KAAI,aAAa,gBAAgB,sBAE7B,OAAM,IAAI,MAAM,+BAA+B,sBAAsB,6BAA6B,aAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BvI,SAAgB,mBAMZ,YACA,MACA,QACA,SACK;AACL,KAAI,SAAS,0BAA0B,MACnC,QAAO,OAAO,yBAAyB,SAAS,uBAAuB;AAG3E,QAAO,OAAO,0BAA0B;AACxC,QAAO,OAAO,iBAAiB;AAC/B,QAAO,IAAI,cAAc,SAAS,cAAc,OAAO,IAAI,aAAa,IAAI,KAAK;AACjF,uBAAsB,mBAAmB,OAAO;AAGhD,SADmB,SAAS,eAAe,oBAAoB,YAAY,SAAS,iBAAiB,QAAQ,IAAI,eAAe,4BAA4B,GAC1I,MAAoC,MAAM,QAAQ,WAAW;;;;;;;;;;;;;;;;;;;AAoBnF,eAAsB,qCAMlB,oBACA,OACA,cACiB;AACjB,KAAI,OAAO,uBAAuB,YAAY,8BAA8B,MAAM,SAC9E,QAAQ,MAAM,MAAM,SAAS,mBAAmB,CAAC,OAAO,gBAAgB,EAAE,CAAC;AAG/E,QAAO;;;;;;;;;;AAWX,SAAgB,oBAAoB,IAAqC;AACrE,QAAO,cAAc,MAAM,WAAW,GAAG,aAAa,GAAG"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import mongoose, { Types } from 'mongoose';\nimport type {\n mongo,\n Schema,\n} from 'mongoose';\nimport mongooseAggregatePaginate from 'mongoose-aggregate-paginate-v2';\nimport mongoosePaginate from 'mongoose-paginate-v2';\n\nimport { customMongooseOptions } from '@/_internals';\nimport { mongooseConnections } from '@/constants';\nimport type { setCustomMongooseOptions } from '@/options';\nimport { mongooseNormalizePlugin } from '@/plugins/normalize';\nimport type { BuildMongooseModelOptions } from '@/types/options';\n\nexport type DoNotRemoveOrUseThisType = typeof setCustomMongooseOptions;\n\n/**\n * Asserts that a Mongoose update operation was successful by checking that it was acknowledged\n * and that at least the expected number of documents were modified.\n *\n * This function is intended for use with `updateOne`, `updateMany`, or any update operation\n * that returns a MongoDB `UpdateResult`.\n *\n * @template T - The shape of the document being updated.\n * @param updatePromise - A promise returned from a Mongoose update operation.\n * @param expectedModifiedCount - The minimum number of documents expected to be modified. Defaults to 1.\n * @throws Will throw an error if:\n * - The operation was not acknowledged by MongoDB,\n * - Fewer documents were modified than expected.\n */\nexport async function assertMongooseUpdateSuccess<T extends mongo.BSON.Document>(\n updatePromise: Promise<mongo.UpdateResult<T>>,\n expectedModifiedCount = 1,\n) {\n const updateResult = await updatePromise;\n if (!updateResult.acknowledged) throw new Error('Update was not acknowledged');\n if (updateResult.modifiedCount < expectedModifiedCount) {\n // eslint-disable-next-line style/max-len\n throw new Error(`Expected to modify at least ${expectedModifiedCount} document(s), but modified ${updateResult.modifiedCount}`);\n }\n}\n\n/**\n * Builds and returns a Mongoose model with specified schema and options.\n *\n * This function sets up a Mongoose model with optional plugins and timestamp settings.\n * It can optionally use a specified connection or the default connection.\n *\n * Determine the connection to use:\n * 1. Use the connection provided in the options, if available.\n * 2. Otherwise, use the default connection stored in `mongooseConnections`.\n * 3. If there's no default connection, create one using the MongoDB URI from the environment variables,\n * or fallback to a local MongoDB instance.\n *\n * You can set a function to be executed before the final build by using {@link setCustomMongooseOptions}.\n * However, ensure that this option is configured before calling {@link buildMongooseModel}.\n *\n * @template DocType - The type of the document.\n * @template Model - The type of the model, which extends `BaseMongoosePaginateModel`.\n * @template InstanceMethodsAndOverrides - The type for instance methods and overrides.\n * @template QueryHelpers - The type for additional query helpers.\n *\n * @param collection - The name of the collection.\n * @param name - The name of the model.\n * @param schema - The Mongoose schema to use for the model.\n * @param options - Optional settings for building the model.\n *\n * @returns The created Mongoose model.\n */\nexport function buildMongooseModel<\n DocType,\n Model extends BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>,\n InstanceMethodsAndOverrides = object,\n QueryHelpers = object,\n>(\n collection: string,\n name: string,\n schema: Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>,\n options?: BuildMongooseModelOptions,\n) {\n if (options?.enableNormalizePlugin !== false) {\n schema.plugin(mongooseNormalizePlugin, options?.normalizePluginOptions);\n }\n\n schema.plugin(mongooseAggregatePaginate);\n schema.plugin(mongoosePaginate);\n schema.set('timestamps', options?.timestamps ?? schema.get('timestamps') ?? true);\n customMongooseOptions.beforeModelBuild?.(schema);\n // eslint-disable-next-line style/max-len\n const connection = options?.connection || (mongooseConnections.default ||= mongoose.createConnection(process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017'));\n return connection.model<DocType, Model, QueryHelpers>(name, schema, collection);\n}\n\n/**\n * Converts a document or ObjectId to a document using the specified model.\n *\n * This function takes a document or ObjectId and returns the corresponding document\n * from the database using the specified model. Optionally, specific fields can be selected.\n *\n * @template D - The type of the hydrated document.\n * @template DocType - The type of the document.\n * @template InstanceMethodsAndOverrides - The type for instance methods and overrides.\n * @template QueryHelpers - The type for additional query helpers.\n *\n * @param documentOrObjectId - The document or ObjectId to convert.\n * @param model - The Mongoose model to use for the conversion.\n * @param selectFields - Optional fields to select from the document.\n *\n * @returns The corresponding document or null if not found.\n */\nexport async function mongooseDocumentOrObjectIdToDocument<\n D extends MongooseHydratedDocument<DocType, InstanceMethodsAndOverrides, QueryHelpers>,\n DocType,\n InstanceMethodsAndOverrides,\n QueryHelpers,\n>(\n documentOrObjectId: MongooseDocumentOrObjectId<D>,\n model: BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>,\n selectFields?: string[],\n) {\n if (typeof documentOrObjectId === 'string' || documentOrObjectId instanceof Types.ObjectId) {\n return (await model.findById(documentOrObjectId).select(selectFields || [])) as D | null;\n }\n\n return documentOrObjectId;\n}\n\n/**\n * Converts the input, which can be a MongoDB ObjectId or a string,\n * into a 24-character hexadecimal string representation of the ObjectId.\n *\n * @param {string | Types.ObjectId} id - The ObjectId instance or its string representation\n *\n * @returns {string} The hexadecimal string representation of the ObjectId\n */\nexport function toObjectIdHexString(id: string | Types.ObjectId) {\n return id instanceof Types.ObjectId ? id.toHexString() : id;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,eAAsB,4BAClB,eACA,wBAAwB,GAC1B;CACE,MAAM,eAAe,MAAM;AAC3B,KAAI,CAAC,aAAa,aAAc,OAAM,IAAI,MAAM,8BAA8B;AAC9E,KAAI,aAAa,gBAAgB,sBAE7B,OAAM,IAAI,MAAM,+BAA+B,sBAAsB,6BAA6B,aAAa,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BvI,SAAgB,mBAMZ,YACA,MACA,QACA,SACF;AACE,KAAI,SAAS,0BAA0B,MACnC,QAAO,OAAO,yBAAyB,SAAS,uBAAuB;AAG3E,QAAO,OAAO,0BAA0B;AACxC,QAAO,OAAO,iBAAiB;AAC/B,QAAO,IAAI,cAAc,SAAS,cAAc,OAAO,IAAI,aAAa,IAAI,KAAK;AACjF,uBAAsB,mBAAmB,OAAO;AAGhD,SADmB,SAAS,eAAe,oBAAoB,YAAY,SAAS,iBAAiB,QAAQ,IAAI,eAAe,4BAA4B,GAC1I,MAAoC,MAAM,QAAQ,WAAW;;;;;;;;;;;;;;;;;;;AAoBnF,eAAsB,qCAMlB,oBACA,OACA,cACF;AACE,KAAI,OAAO,uBAAuB,YAAY,8BAA8B,MAAM,SAC9E,QAAQ,MAAM,MAAM,SAAS,mBAAmB,CAAC,OAAO,gBAAgB,EAAE,CAAC;AAG/E,QAAO;;;;;;;;;;AAWX,SAAgB,oBAAoB,IAA6B;AAC7D,QAAO,cAAc,MAAM,WAAW,GAAG,aAAa,GAAG"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kikiutils/mongoose",
3
3
  "type": "module",
4
- "version": "5.0.1",
4
+ "version": "5.1.1",
5
5
  "description": "A Mongoose plugin for enhanced JSON normalization and common schema creation, with built-in support for pagination and automatic Decimal128 conversion.",
6
6
  "author": "kiki-kanri",
7
7
  "license": "MIT",
@@ -33,12 +33,24 @@
33
33
  "./schema-builders/object-id": "./dist/schema-builders/object-id.js",
34
34
  "./schema-builders/ref": "./dist/schema-builders/ref.js",
35
35
  "./schema-builders/string": "./dist/schema-builders/string.js",
36
- "./types": "./dist/types/index.js",
37
- "./types/aggregate-paginate": "./dist/types/aggregate-paginate.js",
38
- "./types/data": "./dist/types/data.js",
39
- "./types/options": "./dist/types/options.js",
40
- "./types/paginate": "./dist/types/paginate.js",
41
- "./types/utils": "./dist/types/utils.js",
36
+ "./types": {
37
+ "types": "./dist/types/index.d.ts"
38
+ },
39
+ "./types/aggregate-paginate": {
40
+ "types": "./dist/types/aggregate-paginate.d.ts"
41
+ },
42
+ "./types/data": {
43
+ "types": "./dist/types/data.d.ts"
44
+ },
45
+ "./types/options": {
46
+ "types": "./dist/types/options.d.ts"
47
+ },
48
+ "./types/paginate": {
49
+ "types": "./dist/types/paginate.d.ts"
50
+ },
51
+ "./types/utils": {
52
+ "types": "./dist/types/utils.d.ts"
53
+ },
42
54
  "./utils": "./dist/utils.js",
43
55
  "./package.json": "./package.json"
44
56
  },
@@ -59,7 +71,7 @@
59
71
  "release": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && changelogen --hideAuthorEmail --push --release && npm publish",
60
72
  "test": "vitest run --coverage",
61
73
  "test:watch": "vitest watch --coverage",
62
- "typecheck": "tsc --noEmit",
74
+ "typecheck": "tsc -b --noEmit",
63
75
  "unused-exports": "ts-unused-exports ./tsconfig.json"
64
76
  },
65
77
  "dependencies": {
@@ -72,9 +84,9 @@
72
84
  },
73
85
  "devDependencies": {
74
86
  "@kikiutils/changelogen": "^0.9.0",
75
- "@kikiutils/eslint-config": "^3.0.0",
87
+ "@kikiutils/eslint-config": "^3.0.1",
76
88
  "@kikiutils/tsconfigs": "^5.0.5",
77
- "@types/node": "^24.3.3",
89
+ "@types/node": "^24.4.0",
78
90
  "@vitest/coverage-v8": "^3.2.4",
79
91
  "depcheck": "^1.4.7",
80
92
  "publint": "^0.3.12",
package/src/_internals.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { CustomMongooseOptions } from './types/options';
1
+ import type { CustomMongooseOptions } from '@/types/options';
2
2
 
3
3
  export const customMongooseOptions: CustomMongooseOptions = {};
package/src/constants.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { MongooseConnections } from './types';
1
+ import type { MongooseConnections } from '@/types';
2
2
 
3
3
  /**
4
4
  * Mongoose connections.
package/src/options.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { customMongooseOptions } from './_internals';
2
- import type { CustomMongooseOptions } from './types/options';
3
- import type { buildMongooseModel } from './utils';
1
+ import { customMongooseOptions } from '@/_internals';
2
+ import type { CustomMongooseOptions } from '@/types/options';
3
+ import type { buildMongooseModel } from '@/utils';
4
4
 
5
5
  export type DoNotRemoveOrUseThisType = typeof buildMongooseModel;
6
6
 
@@ -14,6 +14,6 @@ export type DoNotRemoveOrUseThisType = typeof buildMongooseModel;
14
14
  export function setCustomMongooseOptions<K extends keyof CustomMongooseOptions>(
15
15
  key: K,
16
16
  value: CustomMongooseOptions[K],
17
- ): void {
17
+ ) {
18
18
  customMongooseOptions[key] = value;
19
19
  }
@@ -40,7 +40,7 @@ export interface MongooseNormalizePluginOptions {
40
40
  export function mongooseNormalizePlugin<S extends Schema>(
41
41
  schema: S,
42
42
  pluginOptions?: MongooseNormalizePluginOptions,
43
- ): void {
43
+ ) {
44
44
  const toJson = schema.get('toJSON');
45
45
  const toJsonTransform = toJson?.transform;
46
46
  schema.set(
@@ -100,7 +100,7 @@ interface ToStringSetterSchema {
100
100
 
101
101
  const baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.Decimal128);
102
102
 
103
- export function decimal128SchemaBuilder(): Decimal128SchemaBuilder {
103
+ export function decimal128SchemaBuilder() {
104
104
  const schema: Record<string, any> = {};
105
105
  const baseBuilder = baseBuilderFactory(schema);
106
106
  return new Proxy(
@@ -64,6 +64,6 @@ const baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.ObjectId)
64
64
 
65
65
  export function refSchemaBuilder<T extends ((this: any, doc: any) => Model<any> | string) | Model<any> | string>(
66
66
  ref: T,
67
- ): RefSchemaBuilder<{ ref: T; type: typeof Schema.Types.ObjectId }> {
67
+ ) {
68
68
  return baseBuilderFactory({ ref }) as RefSchemaBuilder<{ ref: T; type: typeof Schema.Types.ObjectId }>;
69
69
  }
@@ -139,7 +139,7 @@ const baseBuilderFactory = createBaseSchemaBuilderFactory(String);
139
139
  const defaultIpv4ValidateMessage = '`{VALUE}` is not a valid IPv4 address for path `{PATH}`';
140
140
  const defaultIpv6ValidateMessage = '`{VALUE}` is not a valid IPv6 address for path `{PATH}`';
141
141
 
142
- export function stringSchemaBuilder(): StringSchemaBuilder {
142
+ export function stringSchemaBuilder() {
143
143
  const schema: Record<string, any> = {};
144
144
  const baseBuilder = baseBuilderFactory(schema);
145
145
  return new Proxy(
@@ -100,6 +100,4 @@ declare namespace _ {
100
100
  const aggregatePaginate: { options: AggregatePaginateOptions };
101
101
  }
102
102
 
103
- export type DoNotRemoveOrUseThisType = unknown;
104
-
105
103
  export default mongooseAggregatePaginate;
@@ -10,8 +10,8 @@ import type { SetFieldType } from 'type-fest';
10
10
 
11
11
  import type { IfElse } from './utils';
12
12
 
13
- export type { DoNotRemoveOrUseThisType as _ADoNotRemoveOrUseThisType } from './aggregate-paginate';
14
- export type { DoNotRemoveOrUseThisType as _PDoNotRemoveOrUseThisType } from './paginate';
13
+ export type * as _loadAggregatePaginateTypes from './aggregate-paginate';
14
+ export type * as _loadPaginateTypes from './paginate';
15
15
 
16
16
  // @ts-expect-error Ignore this error.
17
17
  // eslint-disable-next-line unused-imports/no-unused-vars
@@ -4,8 +4,8 @@ import type {
4
4
  SchemaTimestampsConfig,
5
5
  } from 'mongoose';
6
6
 
7
- import type { MongooseNormalizePluginOptions } from '../plugins/normalize';
8
- import type { buildMongooseModel } from '../utils';
7
+ import type { MongooseNormalizePluginOptions } from '@/plugins/normalize';
8
+ import type { buildMongooseModel } from '@/utils';
9
9
 
10
10
  export type DoNotRemoveOrUseThisType = typeof buildMongooseModel;
11
11
 
@@ -172,6 +172,4 @@ declare namespace _ {
172
172
  }
173
173
  }
174
174
 
175
- export type DoNotRemoveOrUseThisType = unknown;
176
-
177
175
  export default _;
package/src/utils.ts CHANGED
@@ -6,11 +6,11 @@ import type {
6
6
  import mongooseAggregatePaginate from 'mongoose-aggregate-paginate-v2';
7
7
  import mongoosePaginate from 'mongoose-paginate-v2';
8
8
 
9
- import { customMongooseOptions } from './_internals';
10
- import { mongooseConnections } from './constants';
11
- import type { setCustomMongooseOptions } from './options';
12
- import { mongooseNormalizePlugin } from './plugins/normalize';
13
- import type { BuildMongooseModelOptions } from './types/options';
9
+ import { customMongooseOptions } from '@/_internals';
10
+ import { mongooseConnections } from '@/constants';
11
+ import type { setCustomMongooseOptions } from '@/options';
12
+ import { mongooseNormalizePlugin } from '@/plugins/normalize';
13
+ import type { BuildMongooseModelOptions } from '@/types/options';
14
14
 
15
15
  export type DoNotRemoveOrUseThisType = typeof setCustomMongooseOptions;
16
16
 
@@ -31,7 +31,7 @@ export type DoNotRemoveOrUseThisType = typeof setCustomMongooseOptions;
31
31
  export async function assertMongooseUpdateSuccess<T extends mongo.BSON.Document>(
32
32
  updatePromise: Promise<mongo.UpdateResult<T>>,
33
33
  expectedModifiedCount = 1,
34
- ): Promise<void> {
34
+ ) {
35
35
  const updateResult = await updatePromise;
36
36
  if (!updateResult.acknowledged) throw new Error('Update was not acknowledged');
37
37
  if (updateResult.modifiedCount < expectedModifiedCount) {
@@ -77,7 +77,7 @@ export function buildMongooseModel<
77
77
  name: string,
78
78
  schema: Schema<DocType, Model, InstanceMethodsAndOverrides, QueryHelpers>,
79
79
  options?: BuildMongooseModelOptions,
80
- ): Model {
80
+ ) {
81
81
  if (options?.enableNormalizePlugin !== false) {
82
82
  schema.plugin(mongooseNormalizePlugin, options?.normalizePluginOptions);
83
83
  }
@@ -117,7 +117,7 @@ export async function mongooseDocumentOrObjectIdToDocument<
117
117
  documentOrObjectId: MongooseDocumentOrObjectId<D>,
118
118
  model: BaseMongoosePaginateModel<DocType, InstanceMethodsAndOverrides, QueryHelpers>,
119
119
  selectFields?: string[],
120
- ): Promise<D | null> {
120
+ ) {
121
121
  if (typeof documentOrObjectId === 'string' || documentOrObjectId instanceof Types.ObjectId) {
122
122
  return (await model.findById(documentOrObjectId).select(selectFields || [])) as D | null;
123
123
  }
@@ -133,6 +133,6 @@ export async function mongooseDocumentOrObjectIdToDocument<
133
133
  *
134
134
  * @returns {string} The hexadecimal string representation of the ObjectId
135
135
  */
136
- export function toObjectIdHexString(id: string | Types.ObjectId): string {
136
+ export function toObjectIdHexString(id: string | Types.ObjectId) {
137
137
  return id instanceof Types.ObjectId ? id.toHexString() : id;
138
138
  }
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };