@classytic/mongokit 3.3.0 → 3.3.2
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.
- package/README.md +2 -2
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +21 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
- **Search governance** - Text index guard (throws `400` if no index), allowlisted sort/filter fields, ReDoS protection
|
|
18
18
|
- **Vector search** - MongoDB Atlas `$vectorSearch` with auto-embedding and multimodal support
|
|
19
19
|
- **TypeScript first** - Full type safety with discriminated unions
|
|
20
|
-
- **
|
|
20
|
+
- **700+ passing tests** - Battle-tested and production-ready
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -1247,7 +1247,7 @@ Extending Repository works exactly the same with Mongoose 8 and 9. The package:
|
|
|
1247
1247
|
- Uses its own event system (not Mongoose middleware)
|
|
1248
1248
|
- Defines its own `FilterQuery` type (unaffected by Mongoose 9 rename)
|
|
1249
1249
|
- Properly gates update pipelines (safe for Mongoose 9's stricter defaults)
|
|
1250
|
-
- All
|
|
1250
|
+
- All 700+ tests pass on Mongoose 9
|
|
1251
1251
|
|
|
1252
1252
|
## License
|
|
1253
1253
|
|
package/dist/index.d.mts
CHANGED
|
@@ -945,6 +945,16 @@ declare class QueryParser {
|
|
|
945
945
|
properties: Record<string, unknown>;
|
|
946
946
|
required?: string[];
|
|
947
947
|
};
|
|
948
|
+
/**
|
|
949
|
+
* Get the query schema with OpenAPI extensions (x-internal metadata).
|
|
950
|
+
* Use this when generating OpenAPI/Swagger docs — it includes a documentary
|
|
951
|
+
* `_filterOperators` property describing available filter operators.
|
|
952
|
+
* For validation-only schemas, use `getQuerySchema()` instead.
|
|
953
|
+
*/
|
|
954
|
+
getOpenAPIQuerySchema(): {
|
|
955
|
+
type: "object";
|
|
956
|
+
properties: Record<string, unknown>;
|
|
957
|
+
};
|
|
948
958
|
/**
|
|
949
959
|
* Get the JSON Schema type for a filter operator
|
|
950
960
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -237,8 +237,11 @@ var QueryParser = class {
|
|
|
237
237
|
description: "Fields to include/exclude (comma-separated). Prefix with - to exclude. Example: name,email,-password"
|
|
238
238
|
},
|
|
239
239
|
populate: {
|
|
240
|
-
type: "string",
|
|
241
|
-
|
|
240
|
+
oneOf: [{ type: "string" }, {
|
|
241
|
+
type: "object",
|
|
242
|
+
additionalProperties: true
|
|
243
|
+
}],
|
|
244
|
+
description: "Fields to populate/join. Simple: comma-separated string (author,category). Advanced: bracket-notation object (populate[author][select]=name,email)"
|
|
242
245
|
},
|
|
243
246
|
after: {
|
|
244
247
|
type: "string",
|
|
@@ -267,17 +270,28 @@ var QueryParser = class {
|
|
|
267
270
|
};
|
|
268
271
|
}
|
|
269
272
|
}
|
|
270
|
-
properties["_filterOperators"] = {
|
|
271
|
-
type: "string",
|
|
272
|
-
description: this._buildOperatorDescription(availableOperators),
|
|
273
|
-
"x-internal": true
|
|
274
|
-
};
|
|
275
273
|
return {
|
|
276
274
|
type: "object",
|
|
277
275
|
properties
|
|
278
276
|
};
|
|
279
277
|
}
|
|
280
278
|
/**
|
|
279
|
+
* Get the query schema with OpenAPI extensions (x-internal metadata).
|
|
280
|
+
* Use this when generating OpenAPI/Swagger docs — it includes a documentary
|
|
281
|
+
* `_filterOperators` property describing available filter operators.
|
|
282
|
+
* For validation-only schemas, use `getQuerySchema()` instead.
|
|
283
|
+
*/
|
|
284
|
+
getOpenAPIQuerySchema() {
|
|
285
|
+
const schema = this.getQuerySchema();
|
|
286
|
+
const availableOperators = this.options.allowedOperators ? Object.entries(this.operators).filter(([key]) => this.options.allowedOperators.includes(key)) : Object.entries(this.operators);
|
|
287
|
+
schema.properties["_filterOperators"] = {
|
|
288
|
+
type: "string",
|
|
289
|
+
description: this._buildOperatorDescription(availableOperators),
|
|
290
|
+
"x-internal": true
|
|
291
|
+
};
|
|
292
|
+
return schema;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
281
295
|
* Get the JSON Schema type for a filter operator
|
|
282
296
|
*/
|
|
283
297
|
_getOperatorSchemaType(op) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/mongokit",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Production-grade MongoDB repositories with zero dependencies - smart pagination, events, and plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -110,4 +110,4 @@
|
|
|
110
110
|
"typescript": "^5.7.0",
|
|
111
111
|
"vitest": "^3.2.4"
|
|
112
112
|
}
|
|
113
|
-
}
|
|
113
|
+
}
|