@kikiutils/mongoose 7.1.0 → 8.0.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 (90) hide show
  1. package/README.md +8 -8
  2. package/dist/_internals.d.ts +4 -0
  3. package/dist/_internals.d.ts.map +1 -1
  4. package/dist/_internals.js +2 -1
  5. package/dist/_internals.js.map +1 -1
  6. package/dist/builders.d.ts.map +1 -1
  7. package/dist/builders.js +2 -3
  8. package/dist/builders.js.map +1 -1
  9. package/dist/connection.d.ts +5 -0
  10. package/dist/connection.d.ts.map +1 -0
  11. package/dist/connection.js +10 -0
  12. package/dist/connection.js.map +1 -0
  13. package/dist/options.d.ts.map +1 -1
  14. package/dist/options.js +2 -1
  15. package/dist/options.js.map +1 -1
  16. package/dist/plugins/normalize.d.ts +21 -14
  17. package/dist/plugins/normalize.d.ts.map +1 -1
  18. package/dist/plugins/normalize.js +15 -10
  19. package/dist/plugins/normalize.js.map +1 -1
  20. package/dist/schema-builders/base.d.ts +1 -1
  21. package/dist/schema-builders/base.d.ts.map +1 -1
  22. package/dist/schema-builders/base.js.map +1 -1
  23. package/dist/schema-builders/bigint.d.ts +48 -0
  24. package/dist/schema-builders/bigint.d.ts.map +1 -0
  25. package/dist/schema-builders/bigint.js +36 -0
  26. package/dist/schema-builders/bigint.js.map +1 -0
  27. package/dist/schema-builders/boolean.d.ts.map +1 -1
  28. package/dist/schema-builders/boolean.js.map +1 -1
  29. package/dist/schema-builders/decimal128.d.ts +16 -12
  30. package/dist/schema-builders/decimal128.d.ts.map +1 -1
  31. package/dist/schema-builders/decimal128.js.map +1 -1
  32. package/dist/schema-builders/double.d.ts +48 -0
  33. package/dist/schema-builders/double.d.ts.map +1 -0
  34. package/dist/schema-builders/double.js +37 -0
  35. package/dist/schema-builders/double.js.map +1 -0
  36. package/dist/schema-builders/index.d.ts +6 -1
  37. package/dist/schema-builders/index.js +6 -1
  38. package/dist/schema-builders/int32.d.ts +48 -0
  39. package/dist/schema-builders/int32.d.ts.map +1 -0
  40. package/dist/schema-builders/int32.js +36 -0
  41. package/dist/schema-builders/int32.js.map +1 -0
  42. package/dist/schema-builders/mixed.d.ts +34 -0
  43. package/dist/schema-builders/mixed.d.ts.map +1 -0
  44. package/dist/schema-builders/mixed.js +8 -0
  45. package/dist/schema-builders/mixed.js.map +1 -0
  46. package/dist/schema-builders/string.d.ts +33 -23
  47. package/dist/schema-builders/string.d.ts.map +1 -1
  48. package/dist/schema-builders/string.js.map +1 -1
  49. package/dist/schema-builders/uuid.d.ts +34 -0
  50. package/dist/schema-builders/uuid.d.ts.map +1 -0
  51. package/dist/schema-builders/uuid.js +8 -0
  52. package/dist/schema-builders/uuid.js.map +1 -0
  53. package/dist/types/aggregate-paginate.d.ts +24 -8
  54. package/dist/types/aggregate-paginate.d.ts.map +1 -1
  55. package/dist/types/index.d.ts +1 -4
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/options.d.ts +2 -1
  58. package/dist/types/options.d.ts.map +1 -1
  59. package/dist/types/paginate.d.ts +6 -2
  60. package/dist/types/paginate.d.ts.map +1 -1
  61. package/package.json +16 -12
  62. package/src/_internals.ts +3 -0
  63. package/src/builders.ts +3 -10
  64. package/src/connection.ts +14 -0
  65. package/src/options.ts +8 -1
  66. package/src/plugins/normalize.ts +23 -15
  67. package/src/schema-builders/base.ts +6 -1
  68. package/src/schema-builders/bigint.ts +134 -0
  69. package/src/schema-builders/boolean.ts +1 -4
  70. package/src/schema-builders/decimal128.ts +16 -12
  71. package/src/schema-builders/double.ts +135 -0
  72. package/src/schema-builders/index.ts +15 -0
  73. package/src/schema-builders/int32.ts +135 -0
  74. package/src/schema-builders/mixed.ts +37 -0
  75. package/src/schema-builders/string.ts +33 -23
  76. package/src/schema-builders/uuid.ts +48 -0
  77. package/src/types/aggregate-paginate.ts +29 -8
  78. package/src/types/index.ts +0 -5
  79. package/src/types/options.ts +3 -0
  80. package/src/types/paginate.ts +6 -2
  81. package/dist/constants.d.ts +0 -5
  82. package/dist/constants.d.ts.map +0 -1
  83. package/dist/constants.js +0 -6
  84. package/dist/constants.js.map +0 -1
  85. package/dist/helpers.d.ts +0 -5
  86. package/dist/helpers.d.ts.map +0 -1
  87. package/dist/helpers.js +0 -9
  88. package/dist/helpers.js.map +0 -1
  89. package/src/constants.ts +0 -3
  90. package/src/helpers.ts +0 -5
@@ -0,0 +1,135 @@
1
+ import { Schema } from 'mongoose';
2
+ import type {
3
+ DefaultType,
4
+ IndexDirection,
5
+ IndexOptions,
6
+ } from 'mongoose';
7
+ import type { Merge } from 'type-fest';
8
+
9
+ import type { Readonlyable } from '../types/_internals';
10
+
11
+ import { createBaseSchemaBuilderFactory } from './base';
12
+
13
+ type ExtendSchemaBuilder<
14
+ Props extends BaseProps,
15
+ ExtraOmitFields extends string,
16
+ > = Omit<
17
+ Int32SchemaBuilder<Props, ExtraOmitFields>,
18
+ ExtraOmitFields | keyof Props
19
+ >;
20
+
21
+ type Int32Limit = number;
22
+
23
+ interface BaseProps {
24
+ type: typeof Schema.Types.Int32;
25
+ }
26
+
27
+ interface Int32LimitValidator {
28
+ max?: number;
29
+ message: string;
30
+ min?: number;
31
+ type: 'max' | 'min';
32
+ validator: (value: null | number | undefined) => boolean;
33
+ }
34
+
35
+ export interface Int32SchemaBuilder<Props extends BaseProps = BaseProps, ExtraOmitFields extends string = never> {
36
+ default: <
37
+ T extends ((this: any, doc: any) => DefaultType<D> | null | undefined) | DefaultType<D> | null | undefined,
38
+ D extends number,
39
+ >(value: T) => ExtendSchemaBuilder<
40
+ Merge<Props, { default: T }>,
41
+ ExtraOmitFields
42
+ >;
43
+
44
+ immutable: ExtendSchemaBuilder<Merge<Props, { immutable: true }>, ExtraOmitFields>;
45
+ index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendSchemaBuilder<
46
+ Merge<Props, { index: T }>,
47
+ ExtraOmitFields
48
+ >;
49
+
50
+ max: <
51
+ T extends L | Readonlyable<[L, S]>,
52
+ L extends Int32Limit,
53
+ S extends string,
54
+ >(value: T) => ExtendSchemaBuilder<
55
+ Merge<Props, Int32ValidationSchema>,
56
+ 'max' | ExtraOmitFields
57
+ >;
58
+
59
+ min: <
60
+ T extends L | Readonlyable<[L, S]>,
61
+ L extends Int32Limit,
62
+ S extends string,
63
+ >(value: T) => ExtendSchemaBuilder<
64
+ Merge<Props, Int32ValidationSchema>,
65
+ 'min' | ExtraOmitFields
66
+ >;
67
+
68
+ nonRequired: Props;
69
+ private: ExtendSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;
70
+ required: Merge<Props, { required: true }>;
71
+ sparse: ExtendSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;
72
+ unique: ExtendSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;
73
+ }
74
+
75
+ interface Int32ValidationSchema {
76
+ validate: Int32LimitValidator[];
77
+ }
78
+
79
+ // Constants/Variables
80
+ const defaultMinValidateMessage = 'Path `{PATH}` ({VALUE}) is less than minimum allowed value ({MIN}).';
81
+ const defaultMaxValidateMessage = 'Path `{PATH}` ({VALUE}) is more than maximum allowed value ({MAX}).';
82
+
83
+ // Functions
84
+ const baseBuilderFactory = createBaseSchemaBuilderFactory(Schema.Types.Int32);
85
+
86
+ function createLimitValidator(
87
+ type: 'max' | 'min',
88
+ value: Int32Limit | Readonlyable<[Int32Limit, string]>,
89
+ ): Int32LimitValidator {
90
+ const [numericLimit, message] = Array.isArray(value)
91
+ ? value as Readonly<[Int32Limit, string]>
92
+ : [
93
+ value as Int32Limit,
94
+ undefined,
95
+ ];
96
+
97
+ if (!Number.isFinite(numericLimit)) throw new RangeError(`Int32 ${type} limit must be finite`);
98
+
99
+ return {
100
+ message: message ?? (type === 'min' ? defaultMinValidateMessage : defaultMaxValidateMessage),
101
+ [type]: numericLimit,
102
+ type,
103
+ validator: (value) => {
104
+ if (value === null || value === undefined) return true;
105
+
106
+ return type === 'min' ? value >= numericLimit : value <= numericLimit;
107
+ },
108
+ };
109
+ }
110
+
111
+ export function int32SchemaBuilder() {
112
+ const schema: Record<string, any> = {};
113
+ const baseBuilder = baseBuilderFactory(schema);
114
+ return new Proxy(
115
+ baseBuilder,
116
+ {
117
+ get(target, key, receiver) {
118
+ if (key === 'max' || key === 'min') {
119
+ return (value: Int32Limit | Readonlyable<[Int32Limit, string]>) => {
120
+ const validator = createLimitValidator(key, value);
121
+ const validators = Array.isArray(schema.validate) ? schema.validate : [];
122
+ schema.validate = [
123
+ ...validators.filter(({ type }) => type !== key),
124
+ validator,
125
+ ];
126
+
127
+ return receiver;
128
+ };
129
+ }
130
+
131
+ return Reflect.get(target, key, receiver);
132
+ },
133
+ },
134
+ ) as Int32SchemaBuilder;
135
+ }
@@ -0,0 +1,37 @@
1
+ import { Schema } from 'mongoose';
2
+ import type {
3
+ IndexDirection,
4
+ IndexOptions,
5
+ } from 'mongoose';
6
+ import type { Merge } from 'type-fest';
7
+
8
+ import { createBaseSchemaBuilderFactory } from './base';
9
+
10
+ type ExtendSchemaBuilder<
11
+ Props extends BaseProps,
12
+ ExtraOmitFields extends string,
13
+ > = Omit<
14
+ MixedSchemaBuilder<Props, ExtraOmitFields>,
15
+ ExtraOmitFields | keyof Props
16
+ >;
17
+
18
+ interface BaseProps {
19
+ type: typeof Schema.Types.Mixed;
20
+ }
21
+
22
+ export interface MixedSchemaBuilder<Props extends BaseProps = BaseProps, ExtraOmitFields extends string = never> {
23
+ default: <T>(value: T) => ExtendSchemaBuilder<Merge<Props, { default: T }>, ExtraOmitFields>;
24
+ immutable: ExtendSchemaBuilder<Merge<Props, { immutable: true }>, ExtraOmitFields>;
25
+ index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendSchemaBuilder<
26
+ Merge<Props, { index: T }>,
27
+ ExtraOmitFields
28
+ >;
29
+
30
+ nonRequired: Props;
31
+ private: ExtendSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;
32
+ required: Merge<Props, { required: true }>;
33
+ sparse: ExtendSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;
34
+ unique: ExtendSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;
35
+ }
36
+
37
+ export const mixedSchemaBuilder = createBaseSchemaBuilderFactory<MixedSchemaBuilder>(Schema.Types.Mixed);
@@ -63,13 +63,14 @@ export interface StringSchemaBuilder<
63
63
  >;
64
64
 
65
65
  /**
66
- * Adds IPv4 validation to the string schema.
67
- * Ensures the string is a valid IPv4 address and trims the input. The validation message can be customized.
66
+ * Adds IPv4 address validation and enables input trimming.
68
67
  *
69
- * @param message - The custom error message to return if validation fails. Defaults to a standard
70
- * IPv4 validation message.
68
+ * @remarks
69
+ * Replaces the configured custom validator and sets `trim` to `true` on this builder.
71
70
  *
72
- * @returns A schema builder with IPv4 validation and the `trim` option enabled.
71
+ * @param message - The validation error message. Defaults to the built-in IPv4 validation message.
72
+ *
73
+ * @returns This instance for chaining.
73
74
  */
74
75
  ipv4: <T extends string = typeof defaultIpv4ValidateMessage>(message?: T) => ExtendSchemaBuilder<
75
76
  Merge<Props, IpSchema<T>>,
@@ -77,13 +78,14 @@ export interface StringSchemaBuilder<
77
78
  >;
78
79
 
79
80
  /**
80
- * Adds IPv6 validation to the string schema.
81
- * Ensures the string is a valid IPv6 address and trims the input. The validation message can be customized.
81
+ * Adds IPv6 address validation and enables input trimming.
82
+ *
83
+ * @remarks
84
+ * Replaces the configured custom validator and sets `trim` to `true` on this builder.
82
85
  *
83
- * @param message - The custom error message to return if validation fails. Defaults to a standard
84
- * IPv6 validation message.
86
+ * @param message - The validation error message. Defaults to the built-in IPv6 validation message.
85
87
  *
86
- * @returns A schema builder with IPv6 validation and the `trim` option enabled.
88
+ * @returns This instance for chaining.
87
89
  */
88
90
  ipv6: <T extends string = typeof defaultIpv6ValidateMessage>(message?: T) => ExtendSchemaBuilder<
89
91
  Merge<Props, IpSchema<T>>,
@@ -91,12 +93,15 @@ export interface StringSchemaBuilder<
91
93
  >;
92
94
 
93
95
  /**
94
- * Sets both the maximum and minimum length of the string.
95
- * This method ensures the string length is exactly or within a specified range.
96
+ * Sets equal minimum and maximum string lengths.
97
+ *
98
+ * @remarks
99
+ * Assigns the same value to `minlength` and `maxlength`, replacing any previously configured limits.
96
100
  *
97
- * @param value - A number representing the exact length or an array specifying [minimum, maximum] length.
101
+ * @param value - The exact length in UTF-16 code units, or a tuple containing the length and a validation
102
+ * error message.
98
103
  *
99
- * @returns A schema builder with both `maxlength` and `minlength` options applied.
104
+ * @returns This instance for chaining.
100
105
  */
101
106
  length: <
102
107
  T extends L | Readonlyable<[L, S]>,
@@ -110,13 +115,15 @@ export interface StringSchemaBuilder<
110
115
  lowercase: ExtendSchemaBuilder<Merge<Props, { lowercase: true }>, ExtraOmitFields>;
111
116
 
112
117
  /**
113
- * Adds regular expression validation to the string schema.
114
- * The validation message can be customized.
118
+ * Configures regular expression validation for the string field.
115
119
  *
116
- * @param regex - The regular expression that the string must match.
117
- * @param message - Optional custom validation message.
120
+ * @remarks
121
+ * Replaces any previously configured `match` option.
118
122
  *
119
- * @returns A schema builder with the Mongoose `match` option configured.
123
+ * @param regex - The regular expression used by Mongoose to validate the string.
124
+ * @param message - The validation error message. If omitted, Mongoose uses its default message.
125
+ *
126
+ * @returns This instance for chaining.
120
127
  */
121
128
  match: <
122
129
  T extends RegExp,
@@ -154,12 +161,15 @@ export interface StringSchemaBuilder<
154
161
  uppercase: ExtendSchemaBuilder<Merge<Props, { uppercase: true }>, ExtraOmitFields>;
155
162
 
156
163
  /**
157
- * Adds WHATWG URL validation to the string schema. Credentials and non-HTTP schemes are allowed.
158
- * The input is parsed only; no DNS lookup or normalization is performed. The validation message can be customized.
164
+ * Adds WHATWG URL parseability validation.
165
+ *
166
+ * @remarks
167
+ * Accepts URLs with credentials and non-HTTP schemes. Performs no DNS lookup or stored-value normalization,
168
+ * and does not enable trimming. Replaces the configured custom validator on this builder.
159
169
  *
160
- * @param message - Custom validation error message. Defaults to the standard URL validation message.
170
+ * @param message - The validation error message. Defaults to the built-in URL validation message.
161
171
  *
162
- * @returns A schema builder with URL validation enabled.
172
+ * @returns This instance for chaining.
163
173
  */
164
174
  url: <T extends string = typeof defaultUrlValidateMessage>(message?: T) => ExtendSchemaBuilder<
165
175
  Merge<Props, UrlSchema<T>>,
@@ -0,0 +1,48 @@
1
+ import { Schema } from 'mongoose';
2
+ import type {
3
+ IndexDirection,
4
+ IndexOptions,
5
+ Types,
6
+ } from 'mongoose';
7
+ import type { Merge } from 'type-fest';
8
+
9
+ import { createBaseSchemaBuilderFactory } from './base';
10
+
11
+ type ExtendSchemaBuilder<
12
+ Props extends BaseProps,
13
+ ExtraOmitFields extends string,
14
+ > = Omit<
15
+ UUIDSchemaBuilder<Props, ExtraOmitFields>,
16
+ ExtraOmitFields | keyof Props
17
+ >;
18
+
19
+ interface BaseProps {
20
+ type: typeof Schema.Types.UUID;
21
+ }
22
+
23
+ export interface UUIDSchemaBuilder<Props extends BaseProps = BaseProps, ExtraOmitFields extends string = never> {
24
+ default: <
25
+ T extends
26
+ | ((this: any, doc: any) => null | string | Types.UUID | undefined)
27
+ | null
28
+ | string
29
+ | Types.UUID
30
+ | undefined,
31
+ >(
32
+ value: T,
33
+ ) => ExtendSchemaBuilder<Merge<Props, { default: T }>, ExtraOmitFields>;
34
+
35
+ immutable: ExtendSchemaBuilder<Merge<Props, { immutable: true }>, ExtraOmitFields>;
36
+ index: <T extends boolean | IndexDirection | IndexOptions>(value: T) => ExtendSchemaBuilder<
37
+ Merge<Props, { index: T }>,
38
+ ExtraOmitFields
39
+ >;
40
+
41
+ nonRequired: Props;
42
+ private: ExtendSchemaBuilder<Merge<Props, { private: true }>, ExtraOmitFields>;
43
+ required: Merge<Props, { required: true }>;
44
+ sparse: ExtendSchemaBuilder<Merge<Props, { sparse: true }>, ExtraOmitFields>;
45
+ unique: ExtendSchemaBuilder<Merge<Props, { unique: true }>, ExtraOmitFields>;
46
+ }
47
+
48
+ export const uuidSchemaBuilder = createBaseSchemaBuilderFactory<UUIDSchemaBuilder>(Schema.Types.UUID);
@@ -49,9 +49,13 @@ export interface AggregatePaginateOptions {
49
49
  page?: number;
50
50
 
51
51
  /**
52
- * If pagination is set to `false`, it will return all docs without adding limit condition.
52
+ * Whether to apply pagination to the aggregation results.
53
53
  *
54
- * @default true
54
+ * @remarks
55
+ * If `false`, the pagination plugin adds no pagination `$skip` or `$limit` stages. Existing pipeline stages
56
+ * still apply.
57
+ *
58
+ * @defaultValue `true`, unless overridden by plugin-wide defaults.
55
59
  */
56
60
  pagination?: boolean;
57
61
  sort?: object | string;
@@ -59,17 +63,34 @@ export interface AggregatePaginateOptions {
59
63
  }
60
64
 
61
65
  export interface AggregatePaginateQueryPopulateOptions {
62
- /** optional query conditions to match */
66
+ /**
67
+ * The query conditions used to filter populated documents.
68
+ */
63
69
  match?: any;
64
- /** optional model to use for population */
70
+
71
+ /**
72
+ * The model or model name used to populate the referenced documents.
73
+ */
65
74
  model?: Model<any> | string;
66
- /** optional query options like sort, limit, etc */
75
+
76
+ /**
77
+ * The query options applied when retrieving populated documents, such as sorting and limits.
78
+ */
67
79
  options?: any;
68
- /** space delimited path(s) to populate */
80
+
81
+ /**
82
+ * The path or space-delimited paths to populate.
83
+ */
69
84
  path: string;
70
- /** deep populate */
85
+
86
+ /**
87
+ * The nested population options applied to the populated documents.
88
+ */
71
89
  populate?: AggregatePaginateQueryPopulateOptions | AggregatePaginateQueryPopulateOptions[];
72
- /** optional fields to select */
90
+
91
+ /**
92
+ * The field projection used when retrieving populated documents.
93
+ */
73
94
  select?: any;
74
95
  }
75
96
 
@@ -1,5 +1,4 @@
1
1
  import type {
2
- Connection,
3
2
  HydratedDocument,
4
3
  QueryWithHelpers,
5
4
  Types,
@@ -55,7 +54,3 @@ export type SetFieldsToObjectId<T, K extends keyof T> = SetFieldType<T, K, Types
55
54
  // @ts-expect-error Ignore this error.
56
55
  // eslint-disable-next-line unused-imports/no-unused-vars
57
56
  export interface BaseMongooseModelStatics<RawDocType, InstanceMethodsAndOverrides = object, QueryHelpers = object> {}
58
-
59
- export interface MongooseConnections {
60
- default?: Connection;
61
- }
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  Connection,
3
+ ConnectOptions,
3
4
  Schema,
4
5
  SchemaTimestampsConfig,
5
6
  } from 'mongoose';
@@ -30,4 +31,6 @@ export interface CustomMongooseOptions {
30
31
  QueryHelpers
31
32
  >,
32
33
  ) => void;
34
+
35
+ defaultConnectionOptions?: ConnectOptions;
33
36
  }
@@ -91,9 +91,13 @@ export interface PaginateOptions {
91
91
  page?: number;
92
92
 
93
93
  /**
94
- * If pagination is set to `false`, it will return all docs without adding limit condition.
94
+ * Whether to apply pagination to the query results.
95
95
  *
96
- * @default true
96
+ * @remarks
97
+ * If `false`, the pagination plugin does not apply its page-based `skip` or `limit`. Explicit query options
98
+ * and other query conditions still apply.
99
+ *
100
+ * @defaultValue `true`, unless overridden by plugin-wide defaults.
97
101
  */
98
102
  pagination?: boolean;
99
103
  populate?: PopulateOptions | PopulateOptions[] | string | string[];
@@ -1,5 +0,0 @@
1
- import { MongooseConnections } from "./types/index.js";
2
- //#region src/constants.d.ts
3
- export declare const mongooseConnections: MongooseConnections;
4
- //#endregion
5
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;qBAEa,qBAAqB"}
package/dist/constants.js DELETED
@@ -1,6 +0,0 @@
1
- //#region src/constants.ts
2
- const mongooseConnections = {};
3
- //#endregion
4
- export { mongooseConnections };
5
-
6
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { MongooseConnections } from './types';\n\nexport const mongooseConnections: MongooseConnections = {};\n"],"mappings":";AAEA,MAAa,sBAA2C,CAAC"}
package/dist/helpers.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Types } from "mongoose";
2
- //#region src/helpers.d.ts
3
- export declare function toObjectIdHexString(id: string | Types.ObjectId): string;
4
- //#endregion
5
- //# sourceMappingURL=helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","names":[],"sources":["../src/helpers.ts"],"mappings":";;wBAEgB,oBAAoB,aAAa,MAAM"}
package/dist/helpers.js DELETED
@@ -1,9 +0,0 @@
1
- import { Types } from "mongoose";
2
- //#region src/helpers.ts
3
- function toObjectIdHexString(id) {
4
- return id instanceof Types.ObjectId ? id.toHexString() : id;
5
- }
6
- //#endregion
7
- export { toObjectIdHexString };
8
-
9
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","names":[],"sources":["../src/helpers.ts"],"sourcesContent":["import { Types } from 'mongoose';\n\nexport function toObjectIdHexString(id: string | Types.ObjectId) {\n return id instanceof Types.ObjectId ? id.toHexString() : id;\n}\n"],"mappings":";;AAEA,SAAgB,oBAAoB,IAA6B;CAC7D,OAAO,cAAc,MAAM,WAAW,GAAG,YAAY,IAAI;AAC7D"}
package/src/constants.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { MongooseConnections } from './types';
2
-
3
- export const mongooseConnections: MongooseConnections = {};
package/src/helpers.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Types } from 'mongoose';
2
-
3
- export function toObjectIdHexString(id: string | Types.ObjectId) {
4
- return id instanceof Types.ObjectId ? id.toHexString() : id;
5
- }