@classytic/mongokit 3.18.0 → 3.20.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 (49) hide show
  1. package/README.md +66 -0
  2. package/dist/{PaginationEngine-BcvaXBQ-.mjs → PaginationEngine-BT1ywu9k.mjs} +327 -6
  3. package/dist/PaginationEngine-DYpOD2wY.d.mts +102 -0
  4. package/dist/{Repository-B01VW_fU.mjs → Repository-dbbgOGjK.mjs} +85 -11
  5. package/dist/actions/index.d.mts +1 -1
  6. package/dist/actions/index.mjs +2 -2
  7. package/dist/adapter/index.d.mts +10 -2
  8. package/dist/adapter/index.mjs +1 -1
  9. package/dist/{adapter-DYEMkLwK.mjs → adapter-CW1EL0fF.mjs} +10 -1
  10. package/dist/ai/index.d.mts +1 -2
  11. package/dist/ai/index.mjs +3 -2
  12. package/dist/better-auth/index.d.mts +0 -1
  13. package/dist/better-auth/index.mjs +2 -2
  14. package/dist/create-repository-0TkQhcv-.d.mts +1757 -0
  15. package/dist/create-repository-CJATiAKX.mjs +29 -0
  16. package/dist/{id-resolution-CnN0YA8t.mjs → id-resolution-P2OzcyRl.mjs} +10 -5
  17. package/dist/{index-fi91ycQc.d.mts → index-Cg3SWugF.d.mts} +1 -3
  18. package/dist/index.d.mts +11 -1666
  19. package/dist/index.mjs +51 -37
  20. package/dist/lock/index.d.mts +0 -1
  21. package/dist/{mongooseToJsonSchema-BdQJU39w.d.mts → mongooseToJsonSchema-D2CyAMIC.d.mts} +9 -5
  22. package/dist/{mongooseToJsonSchema-CBEQmeEa.mjs → mongooseToJsonSchema-khdzVo8x.mjs} +1 -1
  23. package/dist/multi-tenant.plugin-CTsWz0XK.d.mts +486 -0
  24. package/dist/pagination/PaginationEngine.d.mts +1 -102
  25. package/dist/pagination/PaginationEngine.mjs +1 -1
  26. package/dist/plugins/index.d.mts +3 -3
  27. package/dist/plugins/index.mjs +2 -1
  28. package/dist/query/primitives/coercion.d.mts +1 -1
  29. package/dist/query/primitives/coercion.mjs +1 -1
  30. package/dist/query/primitives/geo.d.mts +1 -1
  31. package/dist/query/primitives/indexes.d.mts +1 -1
  32. package/dist/testkit/index.d.mts +128 -0
  33. package/dist/testkit/index.mjs +139 -0
  34. package/dist/{validation-chain.plugin-DJtC0KJ-.mjs → timestamp.plugin-nG9Z1JEk.mjs} +5 -1056
  35. package/dist/{types-CU3SEDbD.d.mts → types-DNFMofHy.d.mts} +51 -22
  36. package/dist/{update-CvCMv5Cl.mjs → update-1Lq9OMD2.mjs} +5 -5
  37. package/dist/utils/index.d.mts +1 -1
  38. package/dist/utils/index.mjs +5 -5
  39. package/dist/validation-chain.plugin-Dn_wZYLA.mjs +1056 -0
  40. package/dist/{validation-chain.plugin-BpMfy18N.d.mts → validation-chain.plugin-buy3uvyk.d.mts} +2 -487
  41. package/package.json +16 -7
  42. package/dist/cursor-_SbWVAn-.mjs +0 -254
  43. package/dist/sort-Ca1BPfvE.mjs +0 -72
  44. /package/dist/{coercion-TRMmR49h.d.mts → coercion-BjdPX3YF.d.mts} +0 -0
  45. /package/dist/{error-BTeepSNL.mjs → error-BuByZwKU.mjs} +0 -0
  46. /package/dist/{field-selection-CQW3WBiK.mjs → field-selection-FSQFLpsU.mjs} +0 -0
  47. /package/dist/{indexes-CgOF7Wjd.d.mts → indexes-DIjMpYES.d.mts} +0 -0
  48. /package/dist/{logger-B8wf-Mtb.mjs → logger-K7dPmu2U.mjs} +0 -0
  49. /package/dist/{chunk-CfYAbeIz.mjs → rolldown-runtime-D7D4PA-g.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { t as __exportAll } from "../chunk-CfYAbeIz.mjs";
2
- import { g as create_exports, i as update_exports, p as delete_exports, u as read_exports, v as aggregate_exports } from "../update-CvCMv5Cl.mjs";
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ import { g as create_exports, i as update_exports, p as delete_exports, u as read_exports, v as aggregate_exports } from "../update-1Lq9OMD2.mjs";
3
3
  //#region src/actions/index.ts
4
4
  var actions_exports = /* @__PURE__ */ __exportAll({
5
5
  aggregate: () => aggregate_exports,
@@ -2,7 +2,6 @@ import { StandardRepo } from "@classytic/repo-core/repository";
2
2
  import { Document, Model } from "mongoose";
3
3
  import { SchemaBuilderOptions, SchemaGenerator } from "@classytic/repo-core/schema";
4
4
  import { AdapterRepositoryInput, AdapterSchemaContext, AdapterValidationResult, DataAdapter, OpenApiSchemas, RepositoryLike, SchemaMetadata } from "@classytic/repo-core/adapter";
5
-
6
5
  //#region src/adapter/mongoose-adapter.d.ts
7
6
  /**
8
7
  * Options for creating a Mongoose adapter.
@@ -53,7 +52,7 @@ interface MongooseAdapterOptions<TDoc = unknown> {
53
52
  * `@classytic/repo-core/adapter`.
54
53
  */
55
54
  declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
56
- readonly type: "mongoose";
55
+ readonly type: 'mongoose';
57
56
  readonly name: string;
58
57
  readonly model: Model<TDoc>;
59
58
  readonly repository: RepositoryLike<TDoc>;
@@ -95,6 +94,15 @@ declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
95
94
  * find a no-op success path.
96
95
  */
97
96
  validate(_data: unknown): AdapterValidationResult;
97
+ /**
98
+ * No-op — mongokit's per-call resources (`watch()` change streams,
99
+ * `cursor()` iterators) are released by their own `AbortSignal` /
100
+ * end-of-iteration, so the adapter holds nothing long-lived. Provided
101
+ * so hosts can call `adapter.close()` uniformly across every kit. Per
102
+ * the `DataAdapter.close` ownership rule the host owns the mongoose
103
+ * connection (`mongoose.connect(...)`) and closes it itself.
104
+ */
105
+ close(): Promise<void>;
98
106
  /**
99
107
  * Extract relation metadata from Mongoose ref paths.
100
108
  *
@@ -1,2 +1,2 @@
1
- import { n as createMongooseAdapter, r as isMongooseModel, t as MongooseAdapter } from "../adapter-DYEMkLwK.mjs";
1
+ import { n as createMongooseAdapter, r as isMongooseModel, t as MongooseAdapter } from "../adapter-CW1EL0fF.mjs";
2
2
  export { MongooseAdapter, createMongooseAdapter, isMongooseModel };
@@ -1,4 +1,4 @@
1
- import { n as warn } from "./logger-B8wf-Mtb.mjs";
1
+ import { n as warn } from "./logger-K7dPmu2U.mjs";
2
2
  import { mergeFieldRuleConstraints } from "@classytic/repo-core/schema";
3
3
  import { asRepositoryLike, isRepository } from "@classytic/repo-core/adapter";
4
4
  //#region src/adapter/types.ts
@@ -160,6 +160,15 @@ var MongooseAdapter = class {
160
160
  return { valid: true };
161
161
  }
162
162
  /**
163
+ * No-op — mongokit's per-call resources (`watch()` change streams,
164
+ * `cursor()` iterators) are released by their own `AbortSignal` /
165
+ * end-of-iteration, so the adapter holds nothing long-lived. Provided
166
+ * so hosts can call `adapter.close()` uniformly across every kit. Per
167
+ * the `DataAdapter.close` ownership rule the host owns the mongoose
168
+ * connection (`mongoose.connect(...)`) and closes it itself.
169
+ */
170
+ async close() {}
171
+ /**
163
172
  * Extract relation metadata from Mongoose ref paths.
164
173
  *
165
174
  * Cardinality rules:
@@ -1,6 +1,5 @@
1
- import { G as Plugin } from "../types-CU3SEDbD.mjs";
1
+ import { G as Plugin } from "../types-DNFMofHy.mjs";
2
2
  import { PipelineStage } from "mongoose";
3
-
4
3
  //#region src/ai/types.d.ts
5
4
  /** Supported similarity metrics for vector search */
6
5
  type SimilarityMetric = 'cosine' | 'euclidean' | 'dotProduct';
package/dist/ai/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as warn } from "../logger-B8wf-Mtb.mjs";
1
+ import { n as warn } from "../logger-K7dPmu2U.mjs";
2
2
  //#region src/ai/url-policy.ts
3
3
  /**
4
4
  * URL policy helpers for the vector plugin media pipeline.
@@ -277,7 +277,8 @@ function vectorPlugin(options) {
277
277
  if (Array.isArray(params.query)) queryVector = params.query;
278
278
  else {
279
279
  if (!embedFn) throw new Error("[mongokit] Non-vector queries require embedFn in vectorPlugin options");
280
- queryVector = await embedFn(toEmbeddingInput(params.query));
280
+ const input = toEmbeddingInput(params.query);
281
+ queryVector = await embedFn(input);
281
282
  }
282
283
  if (queryVector.length !== field.dimensions) throw new Error(`[mongokit] Query vector has ${queryVector.length} dimensions, expected ${field.dimensions}`);
283
284
  const pipeline = buildVectorSearchPipeline(field, queryVector, params);
@@ -1,6 +1,5 @@
1
1
  import { DataAdapter, RepositoryLike } from "@classytic/repo-core/adapter";
2
2
  import { BetterAuthPluginKey, BetterAuthPluginKey as BetterAuthPluginKey$1 } from "@classytic/repo-core/better-auth";
3
-
4
3
  //#region src/better-auth/index.d.ts
5
4
  /**
6
5
  * Minimal structural type for the Mongoose surface this module touches.
@@ -1,5 +1,5 @@
1
- import { n as Repository } from "../Repository-B01VW_fU.mjs";
2
- import { n as createMongooseAdapter } from "../adapter-DYEMkLwK.mjs";
1
+ import { n as Repository } from "../Repository-dbbgOGjK.mjs";
2
+ import { n as createMongooseAdapter } from "../adapter-CW1EL0fF.mjs";
3
3
  import { pluralizeBetterAuthCollection, resolveBetterAuthCollections } from "@classytic/repo-core/better-auth";
4
4
  //#region src/better-auth/index.ts
5
5
  /**