@classytic/mongokit 3.31.1 → 3.32.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.
@@ -792,4 +792,4 @@ var PaginationEngine = class {
792
792
  }
793
793
  };
794
794
  //#endregion
795
- export { sort_exports as n, cursor_exports as r, PaginationEngine as t };
795
+ export { cursor_exports as i, sort_exports as n, calculateTotalPages as r, PaginationEngine as t };
@@ -2,7 +2,7 @@ import { i as isValidIdForType, t as getSchemaIdType } from "./id-resolution-BqD
2
2
  import { a as count, b as LookupBuilder, c as getByQuery, d as deleteById, f as deleteByQuery, h as createMany, l as getOrCreate, m as create, n as update, o as exists, r as updateByQuery, s as getById, t as findOneAndUpdate, x as compileFilterToMongo, y as distinct } from "./update-w5i-pa_c.mjs";
3
3
  import { n as warn } from "./logger-K7dPmu2U.mjs";
4
4
  import { n as isDuplicateKeyError, r as parseDuplicateKeyError, t as createError } from "./error-BuByZwKU.mjs";
5
- import { t as PaginationEngine } from "./PaginationEngine-CuONvwCM.mjs";
5
+ import { r as calculateTotalPages, t as PaginationEngine } from "./PaginationEngine-CSh-P8Nh.mjs";
6
6
  import { hasNearOperator, rewriteNearForCount } from "./query/primitives/geo.mjs";
7
7
  import { RepositoryBase, runChunkedArchive, runChunkedPurge, throwIfAborted, validatePluginOrder, withRetry } from "@classytic/repo-core/repository";
8
8
  import mongoose from "mongoose";
@@ -4207,7 +4207,7 @@ var Repository = class extends RepositoryBase {
4207
4207
  page,
4208
4208
  limit,
4209
4209
  total,
4210
- pages: Math.max(1, Math.ceil(total / limit)),
4210
+ pages: calculateTotalPages(total, limit),
4211
4211
  hasNext: page * limit < total,
4212
4212
  hasPrev: page > 1
4213
4213
  };
@@ -4310,9 +4310,9 @@ var Repository = class extends RepositoryBase {
4310
4310
  const appendLookupStages$2 = (pipeline) => appendLookupStages(pipeline, lookups, projection, isKeyset && sort ? this._parseSort(sort) : void 0);
4311
4311
  if (isKeyset && sort) {
4312
4312
  const parsedSort = this._parseSort(sort);
4313
- const { validateKeysetSort } = await import("./PaginationEngine-CuONvwCM.mjs").then((n) => n.n);
4314
- const { encodeCursor, resolveCursorFilter } = await import("./PaginationEngine-CuONvwCM.mjs").then((n) => n.r);
4315
- const { getPrimaryField } = await import("./PaginationEngine-CuONvwCM.mjs").then((n) => n.n);
4313
+ const { validateKeysetSort } = await import("./PaginationEngine-CSh-P8Nh.mjs").then((n) => n.n);
4314
+ const { encodeCursor, resolveCursorFilter } = await import("./PaginationEngine-CSh-P8Nh.mjs").then((n) => n.i);
4315
+ const { getPrimaryField } = await import("./PaginationEngine-CSh-P8Nh.mjs").then((n) => n.n);
4316
4316
  const normalizedSort = validateKeysetSort(parsedSort, this._pagination.config.strictKeysetSortFields);
4317
4317
  const cursorVersion = this._pagination.config.cursorVersion ?? 1;
4318
4318
  const minCursorVersion = this._pagination.config.minCursorVersion ?? 1;
@@ -4401,7 +4401,7 @@ var Repository = class extends RepositoryBase {
4401
4401
  page,
4402
4402
  limit,
4403
4403
  total,
4404
- pages: Math.max(1, Math.ceil(total / limit)),
4404
+ pages: calculateTotalPages(total, limit),
4405
4405
  hasNext: page * limit < total,
4406
4406
  hasPrev: page > 1
4407
4407
  };
@@ -1,4 +1,4 @@
1
- import { n as Repository } from "../Repository-Cx7BwvDA.mjs";
1
+ import { n as Repository } from "../Repository-B_1y9cCf.mjs";
2
2
  import { n as createMongooseAdapter } from "../adapter-BitHg-CN.mjs";
3
3
  import { pluralizeBetterAuthCollection, resolveBetterAuthCollections } from "@classytic/repo-core/better-auth";
4
4
  //#region src/better-auth/index.ts
@@ -1,5 +1,5 @@
1
- import { n as Repository } from "./Repository-Cx7BwvDA.mjs";
2
- import { a as customIdPlugin, f as auditTrailPlugin, i as multiTenantPlugin, m as auditLogPlugin, n as softDeletePlugin, t as timestampPlugin, u as cachePlugin } from "./timestamp.plugin-CX_kw6TN.mjs";
1
+ import { n as Repository } from "./Repository-B_1y9cCf.mjs";
2
+ import { a as customIdPlugin, f as auditTrailPlugin, i as multiTenantPlugin, m as auditLogPlugin, n as softDeletePlugin, t as timestampPlugin, u as cachePlugin } from "./timestamp.plugin-CAXzHs9y.mjs";
3
3
  import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "./method-registry.plugin-DblM7V6j.mjs";
4
4
  //#region src/create-repository.ts
5
5
  function isLoggerAudit(value) {
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { n as idVariants } from "./id-resolution-BqDrk0S2.mjs";
2
- import { _ as resetCapabilityProbeCache, a as supportsTransactions, b as transactionResolutionOf, c as ALL_OPERATIONS, d as READ_OPERATIONS, f as operationsByPolicyKey, g as probeMongoCapabilities, h as classifyHelloReply, i as isTransactionUnsupported, l as MUTATING_OPERATIONS, m as capabilitiesForSupport, n as Repository, o as withTransaction, p as MONGOKIT_CAPABILITIES, r as batchTransaction, s as AggregationBuilder, t as HOOK_PRIORITY, u as OP_REGISTRY, v as resolveMongoCapabilities, x as createMongoPurgePort, y as resolveTransactionSupport } from "./Repository-Cx7BwvDA.mjs";
2
+ import { _ as resetCapabilityProbeCache, a as supportsTransactions, b as transactionResolutionOf, c as ALL_OPERATIONS, d as READ_OPERATIONS, f as operationsByPolicyKey, g as probeMongoCapabilities, h as classifyHelloReply, i as isTransactionUnsupported, l as MUTATING_OPERATIONS, m as capabilitiesForSupport, n as Repository, o as withTransaction, p as MONGOKIT_CAPABILITIES, r as batchTransaction, s as AggregationBuilder, t as HOOK_PRIORITY, u as OP_REGISTRY, v as resolveMongoCapabilities, x as createMongoPurgePort, y as resolveTransactionSupport } from "./Repository-B_1y9cCf.mjs";
3
3
  import { b as LookupBuilder, x as compileFilterToMongo } from "./update-w5i-pa_c.mjs";
4
4
  import { n as warn, t as configureLogger } from "./logger-K7dPmu2U.mjs";
5
5
  import { n as isDuplicateKeyError, r as parseDuplicateKeyError, t as createError } from "./error-BuByZwKU.mjs";
6
6
  import { t as actions_exports } from "./actions/index.mjs";
7
- import { a as customIdPlugin, c as prefixedId, d as AuditTrailQuery, f as auditTrailPlugin, i as multiTenantPlugin, l as sequentialId, m as auditLogPlugin, n as softDeletePlugin, o as dateSequentialId, p as ensureAuditTrailReady, r as adminBypass, s as getNextSequence, t as timestampPlugin, u as cachePlugin } from "./timestamp.plugin-CX_kw6TN.mjs";
7
+ import { a as customIdPlugin, c as prefixedId, d as AuditTrailQuery, f as auditTrailPlugin, i as multiTenantPlugin, l as sequentialId, m as auditLogPlugin, n as softDeletePlugin, o as dateSequentialId, p as ensureAuditTrailReady, r as adminBypass, s as getNextSequence, t as timestampPlugin, u as cachePlugin } from "./timestamp.plugin-CAXzHs9y.mjs";
8
8
  import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "./method-registry.plugin-DblM7V6j.mjs";
9
- import { t as PaginationEngine } from "./PaginationEngine-CuONvwCM.mjs";
9
+ import { t as PaginationEngine } from "./PaginationEngine-CSh-P8Nh.mjs";
10
10
  import { isGeoOperator, parseGeoFilter } from "./query/primitives/geo.mjs";
11
- import { t as createRepository } from "./create-repository-EWKzpsyM.mjs";
11
+ import { t as createRepository } from "./create-repository-a3DQ5tzt.mjs";
12
12
  import { n as defineModel, r as isModelRegistered, t as ModelCollisionError } from "./model-registry-ClKtWiHa.mjs";
13
- import { _ as cascadePlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, l as observabilityPlugin, m as idempotencyStorePlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as appendOnlyPlugin, y as aggregateHelpersPlugin } from "./validation-chain.plugin-DbcBOWi3.mjs";
13
+ import { _ as cascadePlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, l as observabilityPlugin, m as idempotencyStorePlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as appendOnlyPlugin, y as aggregateHelpersPlugin } from "./validation-chain.plugin-BihbMQRq.mjs";
14
14
  import { i as getMongooseProjection, n as filterResponseData, r as getFieldsForUser, t as createFieldPreset } from "./field-selection-FSQFLpsU.mjs";
15
15
  import { buildFieldTypeMap, coerceFieldValue, coerceHeuristic } from "./query/primitives/coercion.mjs";
16
16
  import { extractSchemaIndexes } from "./query/primitives/indexes.mjs";
@@ -837,6 +837,23 @@ function parsePositiveInt(rt, raw, label) {
837
837
  }
838
838
  //#endregion
839
839
  //#region src/query/parser/sort-select.ts
840
+ /**
841
+ * The sort applied when a request names none. Mongo/mongokit convention.
842
+ *
843
+ * Exported so `parse()` can ask whether it is PERMITTED before applying it,
844
+ * rather than substituting it and then validating it like caller input.
845
+ */
846
+ const DEFAULT_PARSER_SORT = "-createdAt";
847
+ /**
848
+ * Is every field of `sort` inside `allowedSortFields`? True when no allowlist
849
+ * is configured. Pure predicate — never rejects, never warns, so it is safe to
850
+ * ask about a default the caller did not send.
851
+ */
852
+ function isSortFieldAllowed(rt, sort) {
853
+ const allowed = rt.options.allowedSortFields;
854
+ if (!allowed || allowed.length === 0) return true;
855
+ return sort.split(",").map((s) => s.trim()).filter(Boolean).every((field) => allowed.includes(field.startsWith("-") ? field.substring(1) : field));
856
+ }
840
857
  /** Parse a sort spec (string or object form), honoring `allowedSortFields`. */
841
858
  function parseSort(rt, sort) {
842
859
  if (!sort) return void 0;
@@ -1390,18 +1407,35 @@ var QueryParser = class {
1390
1407
  */
1391
1408
  parse(query) {
1392
1409
  const rt = this.rt;
1393
- const { page, limit = 20, sort = "-createdAt", populate, search, after, cursor, select, lookup, aggregate, ...filters } = query || {};
1410
+ const { page, limit = 20, sort, populate, search, after, cursor, select, lookup, aggregate, ...filters } = query || {};
1394
1411
  let parsedLimit = parsePositiveInt(rt, limit, "limit") ?? 20;
1395
1412
  if (parsedLimit > rt.options.maxLimit) {
1396
1413
  warn(`[mongokit] Limit ${parsedLimit} exceeds maximum ${rt.options.maxLimit}, capping to max`);
1397
1414
  parsedLimit = rt.options.maxLimit;
1398
1415
  }
1416
+ /**
1417
+ * The DEFAULT sort applies only when the allowlist permits it.
1418
+ *
1419
+ * `sort = '-createdAt'` was a DESTRUCTURING default, so an absent `?sort=`
1420
+ * became `-createdAt` and was then validated exactly like caller input. With
1421
+ * `allowedSortFields` set and `createdAt` not among them, the parser
1422
+ * REJECTED ITS OWN DEFAULT — and since 3.25 rejection throws, so `parse({})`
1423
+ * threw on an empty query. Every list call on such a resource answered 400
1424
+ * (`Blocked sort field not in allowlist: createdAt`), REST and MCP alike,
1425
+ * and no request the caller could make would avoid it.
1426
+ *
1427
+ * A default the resource forbade must simply not be applied: it is not a
1428
+ * caller error, and there is nobody to report it to. A sort the caller DID
1429
+ * send still rejects — that is the fail-closed behaviour 3.25 added, and it
1430
+ * is deliberately unchanged.
1431
+ */
1432
+ const effectiveSort = sort === void 0 && isSortFieldAllowed(rt, "-createdAt") ? DEFAULT_PARSER_SORT : sort;
1399
1433
  const sanitizedSearch = sanitizeSearch(rt, search);
1400
1434
  const { simplePopulate, populateOptions } = parsePopulate(rt, populate);
1401
1435
  const parsed = {
1402
1436
  filters: parseFilters(rt, filters),
1403
1437
  limit: parsedLimit,
1404
- sort: parseSort(rt, sort),
1438
+ sort: parseSort(rt, effectiveSort),
1405
1439
  populate: simplePopulate,
1406
1440
  populateOptions,
1407
1441
  search: sanitizedSearch
@@ -1,4 +1,4 @@
1
- import { n as Repository } from "../Repository-Cx7BwvDA.mjs";
1
+ import { n as Repository } from "../Repository-B_1y9cCf.mjs";
2
2
  import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "../method-registry.plugin-DblM7V6j.mjs";
3
3
  import { Schema } from "mongoose";
4
4
  //#region src/outbox/index.ts
@@ -1,2 +1,2 @@
1
- import { t as PaginationEngine } from "../PaginationEngine-CuONvwCM.mjs";
1
+ import { t as PaginationEngine } from "../PaginationEngine-CSh-P8Nh.mjs";
2
2
  export { PaginationEngine };
@@ -1,6 +1,6 @@
1
- import { a as customIdPlugin, c as prefixedId, d as AuditTrailQuery, f as auditTrailPlugin, i as multiTenantPlugin, l as sequentialId, m as auditLogPlugin, n as softDeletePlugin, o as dateSequentialId, p as ensureAuditTrailReady, s as getNextSequence, t as timestampPlugin, u as cachePlugin } from "../timestamp.plugin-CX_kw6TN.mjs";
1
+ import { a as customIdPlugin, c as prefixedId, d as AuditTrailQuery, f as auditTrailPlugin, i as multiTenantPlugin, l as sequentialId, m as auditLogPlugin, n as softDeletePlugin, o as dateSequentialId, p as ensureAuditTrailReady, s as getNextSequence, t as timestampPlugin, u as cachePlugin } from "../timestamp.plugin-CAXzHs9y.mjs";
2
2
  import { n as batchOperationsPlugin, t as methodRegistryPlugin } from "../method-registry.plugin-DblM7V6j.mjs";
3
- import { _ as cascadePlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, l as observabilityPlugin, m as idempotencyStorePlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as appendOnlyPlugin, y as aggregateHelpersPlugin } from "../validation-chain.plugin-DbcBOWi3.mjs";
3
+ import { _ as cascadePlugin, a as uniqueField, c as subdocumentPlugin, d as mongoOperationsPlugin, f as leasePlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, l as observabilityPlugin, m as idempotencyStorePlugin, n as blockIf, o as validationChainPlugin, p as immutableStatesPlugin, r as immutableField, s as createTenantContext, t as autoInject, u as MONGOKIT_PLUGIN_NAMES, v as appendOnlyPlugin, y as aggregateHelpersPlugin } from "../validation-chain.plugin-BihbMQRq.mjs";
4
4
  //#region src/plugins/change-log.plugin.ts
5
5
  const PLUGIN_NAME = "changeLog";
6
6
  function isSkipped(context) {
@@ -1,4 +1,4 @@
1
- import { t as createRepository } from "../create-repository-EWKzpsyM.mjs";
1
+ import { t as createRepository } from "../create-repository-a3DQ5tzt.mjs";
2
2
  import { createConnection } from "mongoose";
3
3
  //#region src/testkit/index.ts
4
4
  function idempotentStop(server) {
@@ -1,4 +1,4 @@
1
- import { c as ALL_OPERATIONS, t as HOOK_PRIORITY, u as OP_REGISTRY } from "./Repository-Cx7BwvDA.mjs";
1
+ import { c as ALL_OPERATIONS, t as HOOK_PRIORITY, u as OP_REGISTRY } from "./Repository-B_1y9cCf.mjs";
2
2
  import { n as warn } from "./logger-K7dPmu2U.mjs";
3
3
  import { throwIfAborted, withRetry } from "@classytic/repo-core/repository";
4
4
  import mongoose from "mongoose";
@@ -1,4 +1,4 @@
1
- import { c as ALL_OPERATIONS, u as OP_REGISTRY } from "./Repository-Cx7BwvDA.mjs";
1
+ import { c as ALL_OPERATIONS, u as OP_REGISTRY } from "./Repository-B_1y9cCf.mjs";
2
2
  import { _ as upsert } from "./update-w5i-pa_c.mjs";
3
3
  import { n as warn } from "./logger-K7dPmu2U.mjs";
4
4
  import { t as createError } from "./error-BuByZwKU.mjs";
package/package.json CHANGED
@@ -1,193 +1,193 @@
1
- {
2
- "name": "@classytic/mongokit",
3
- "version": "3.31.1",
4
- "description": "Production-grade MongoDB repositories - smart pagination, events, and plugins. Built on @classytic/repo-core.",
5
- "type": "module",
6
- "sideEffects": false,
7
- "main": "./dist/index.mjs",
8
- "module": "./dist/index.mjs",
9
- "types": "./dist/index.d.mts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.mts",
13
- "default": "./dist/index.mjs"
14
- },
15
- "./pagination": {
16
- "types": "./dist/pagination/PaginationEngine.d.mts",
17
- "default": "./dist/pagination/PaginationEngine.mjs"
18
- },
19
- "./plugins": {
20
- "types": "./dist/plugins/index.d.mts",
21
- "default": "./dist/plugins/index.mjs"
22
- },
23
- "./utils": {
24
- "types": "./dist/utils/index.d.mts",
25
- "default": "./dist/utils/index.mjs"
26
- },
27
- "./actions": {
28
- "types": "./dist/actions/index.d.mts",
29
- "default": "./dist/actions/index.mjs"
30
- },
31
- "./ai": {
32
- "types": "./dist/ai/index.d.mts",
33
- "default": "./dist/ai/index.mjs"
34
- },
35
- "./adapter": {
36
- "types": "./dist/adapter/index.d.mts",
37
- "default": "./dist/adapter/index.mjs"
38
- },
39
- "./better-auth": {
40
- "types": "./dist/better-auth/index.d.mts",
41
- "default": "./dist/better-auth/index.mjs"
42
- },
43
- "./outbox": {
44
- "types": "./dist/outbox/index.d.mts",
45
- "default": "./dist/outbox/index.mjs"
46
- },
47
- "./lock": {
48
- "types": "./dist/lock/index.d.mts",
49
- "default": "./dist/lock/index.mjs"
50
- },
51
- "./usage": {
52
- "types": "./dist/usage/index.d.mts",
53
- "default": "./dist/usage/index.mjs"
54
- },
55
- "./query/primitives/geo": {
56
- "types": "./dist/query/primitives/geo.d.mts",
57
- "default": "./dist/query/primitives/geo.mjs"
58
- },
59
- "./query/primitives/coercion": {
60
- "types": "./dist/query/primitives/coercion.d.mts",
61
- "default": "./dist/query/primitives/coercion.mjs"
62
- },
63
- "./query/primitives/indexes": {
64
- "types": "./dist/query/primitives/indexes.d.mts",
65
- "default": "./dist/query/primitives/indexes.mjs"
66
- },
67
- "./testkit": {
68
- "types": "./dist/testkit/index.d.mts",
69
- "default": "./dist/testkit/index.mjs"
70
- },
71
- "./kernel-conformance": {
72
- "types": "./dist/kernel-conformance/index.d.mts",
73
- "default": "./dist/kernel-conformance/index.mjs"
74
- }
75
- },
76
- "files": [
77
- "dist",
78
- "README.md",
79
- "LICENSE",
80
- "TRADEMARK.md"
81
- ],
82
- "keywords": [
83
- "mongodb",
84
- "mongoose",
85
- "repository",
86
- "repository-pattern",
87
- "data-access",
88
- "pagination",
89
- "cursor-pagination",
90
- "infinite-scroll",
91
- "offset-pagination",
92
- "keyset-pagination",
93
- "caching",
94
- "redis",
95
- "cache",
96
- "multi-tenant",
97
- "multi-tenancy",
98
- "vector-search",
99
- "embeddings",
100
- "atlas-search",
101
- "observability",
102
- "event-driven",
103
- "plugin-based",
104
- "zero-dependencies",
105
- "express",
106
- "fastify",
107
- "nestjs",
108
- "nextjs",
109
- "typescript"
110
- ],
111
- "author": "Classytic <classytic.dev@gmail.com> (https://github.com/classytic)",
112
- "contributors": [
113
- "Sadman Chowdhury (https://github.com/siam923)"
114
- ],
115
- "license": "MIT",
116
- "repository": {
117
- "type": "git",
118
- "url": "git+https://github.com/classytic/mongokit.git"
119
- },
120
- "bugs": {
121
- "url": "https://github.com/classytic/mongokit/issues"
122
- },
123
- "homepage": "https://github.com/classytic/mongokit#readme",
124
- "peerDependencies": {
125
- "@classytic/repo-core": ">=0.20.0",
126
- "mongodb-memory-server": ">=10.4.3",
127
- "mongoose": ">=9.4.1"
128
- },
129
- "peerDependenciesMeta": {
130
- "mongodb-memory-server": {
131
- "optional": true
132
- }
133
- },
134
- "engines": {
135
- "node": ">=22"
136
- },
137
- "publishConfig": {
138
- "access": "public"
139
- },
140
- "scripts": {
141
- "build": "tsdown",
142
- "dev": "tsdown --watch",
143
- "test": "vitest run --project unit --project integration",
144
- "test:unit": "vitest run --project unit",
145
- "test:integration": "vitest run --project integration",
146
- "test:e2e": "vitest run --project e2e",
147
- "test:all": "vitest run --project unit --project integration --project e2e",
148
- "test:watch": "vitest --project unit --project integration",
149
- "test:coverage": "vitest run --coverage",
150
- "typecheck": "tsc --noEmit",
151
- "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
152
- "lint": "biome check src/",
153
- "lint:fix": "biome check src/ --write",
154
- "check:exports": "node scripts/check-exports.mjs",
155
- "lint:package": "npm run check:exports && publint && attw --pack . --profile esm-only",
156
- "format": "biome format src/ --write",
157
- "check": "biome ci src/ --diagnostic-level=error",
158
- "check:dead-code": "knip",
159
- "ci": "npm run check && npm run typecheck && npm run typecheck:tests && npm run build && npm run lint:package && npm run check:dead-code && npm run check:forgotten-exports && npm test",
160
- "push": "classytic-push",
161
- "prepublishOnly": "npm run ci",
162
- "publish:dry": "npm publish --dry-run --access public",
163
- "publish:npm": "npm publish --access public",
164
- "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
165
- "release": "npm run push -- main && npm run release:tag && npm publish --access public",
166
- "release:patch": "npm version patch && npm run release",
167
- "release:minor": "npm version minor && npm run release",
168
- "release:major": "npm version major && npm run release",
169
- "check:forgotten-exports": "node scripts/check-forgotten-exports.mjs"
170
- },
171
- "devDependencies": {
172
- "@arethetypeswrong/cli": "^0.18.2",
173
- "@better-auth/api-key": "^1.6.22",
174
- "@better-auth/mongo-adapter": "^1.6.22",
175
- "@biomejs/biome": "^2.4.10",
176
- "@classytic/dev-tools": "^0.2.0",
177
- "@classytic/repo-core": "^0.21.0",
178
- "@types/node": "^22.0.0",
179
- "@vitest/coverage-v8": "^4.1.4",
180
- "ajv": "^8.18.0",
181
- "ajv-formats": "^3.0.1",
182
- "better-auth": "^1.6.23",
183
- "dotenv": "^17.4.2",
184
- "knip": "^6.31.0",
185
- "mongodb": "^7.5.0",
186
- "mongodb-memory-server": "^10.4.3",
187
- "mongoose": "^9.9.1",
188
- "publint": "^0.3.18",
189
- "tsdown": "^0.22.14",
190
- "typescript": "~5.9.0",
191
- "vitest": "^4.1.4"
192
- }
193
- }
1
+ {
2
+ "name": "@classytic/mongokit",
3
+ "version": "3.32.0",
4
+ "description": "Production-grade MongoDB repositories - smart pagination, events, and plugins. Built on @classytic/repo-core.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.mjs",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.mts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "./pagination": {
16
+ "types": "./dist/pagination/PaginationEngine.d.mts",
17
+ "default": "./dist/pagination/PaginationEngine.mjs"
18
+ },
19
+ "./plugins": {
20
+ "types": "./dist/plugins/index.d.mts",
21
+ "default": "./dist/plugins/index.mjs"
22
+ },
23
+ "./utils": {
24
+ "types": "./dist/utils/index.d.mts",
25
+ "default": "./dist/utils/index.mjs"
26
+ },
27
+ "./actions": {
28
+ "types": "./dist/actions/index.d.mts",
29
+ "default": "./dist/actions/index.mjs"
30
+ },
31
+ "./ai": {
32
+ "types": "./dist/ai/index.d.mts",
33
+ "default": "./dist/ai/index.mjs"
34
+ },
35
+ "./adapter": {
36
+ "types": "./dist/adapter/index.d.mts",
37
+ "default": "./dist/adapter/index.mjs"
38
+ },
39
+ "./better-auth": {
40
+ "types": "./dist/better-auth/index.d.mts",
41
+ "default": "./dist/better-auth/index.mjs"
42
+ },
43
+ "./outbox": {
44
+ "types": "./dist/outbox/index.d.mts",
45
+ "default": "./dist/outbox/index.mjs"
46
+ },
47
+ "./lock": {
48
+ "types": "./dist/lock/index.d.mts",
49
+ "default": "./dist/lock/index.mjs"
50
+ },
51
+ "./usage": {
52
+ "types": "./dist/usage/index.d.mts",
53
+ "default": "./dist/usage/index.mjs"
54
+ },
55
+ "./query/primitives/geo": {
56
+ "types": "./dist/query/primitives/geo.d.mts",
57
+ "default": "./dist/query/primitives/geo.mjs"
58
+ },
59
+ "./query/primitives/coercion": {
60
+ "types": "./dist/query/primitives/coercion.d.mts",
61
+ "default": "./dist/query/primitives/coercion.mjs"
62
+ },
63
+ "./query/primitives/indexes": {
64
+ "types": "./dist/query/primitives/indexes.d.mts",
65
+ "default": "./dist/query/primitives/indexes.mjs"
66
+ },
67
+ "./testkit": {
68
+ "types": "./dist/testkit/index.d.mts",
69
+ "default": "./dist/testkit/index.mjs"
70
+ },
71
+ "./kernel-conformance": {
72
+ "types": "./dist/kernel-conformance/index.d.mts",
73
+ "default": "./dist/kernel-conformance/index.mjs"
74
+ }
75
+ },
76
+ "files": [
77
+ "dist",
78
+ "README.md",
79
+ "LICENSE",
80
+ "TRADEMARK.md"
81
+ ],
82
+ "keywords": [
83
+ "mongodb",
84
+ "mongoose",
85
+ "repository",
86
+ "repository-pattern",
87
+ "data-access",
88
+ "pagination",
89
+ "cursor-pagination",
90
+ "infinite-scroll",
91
+ "offset-pagination",
92
+ "keyset-pagination",
93
+ "caching",
94
+ "redis",
95
+ "cache",
96
+ "multi-tenant",
97
+ "multi-tenancy",
98
+ "vector-search",
99
+ "embeddings",
100
+ "atlas-search",
101
+ "observability",
102
+ "event-driven",
103
+ "plugin-based",
104
+ "zero-dependencies",
105
+ "express",
106
+ "fastify",
107
+ "nestjs",
108
+ "nextjs",
109
+ "typescript"
110
+ ],
111
+ "author": "Classytic <classytic.dev@gmail.com> (https://github.com/classytic)",
112
+ "contributors": [
113
+ "Sadman Chowdhury (https://github.com/siam923)"
114
+ ],
115
+ "license": "MIT",
116
+ "repository": {
117
+ "type": "git",
118
+ "url": "git+https://github.com/classytic/mongokit.git"
119
+ },
120
+ "bugs": {
121
+ "url": "https://github.com/classytic/mongokit/issues"
122
+ },
123
+ "homepage": "https://github.com/classytic/mongokit#readme",
124
+ "peerDependencies": {
125
+ "@classytic/repo-core": ">=0.20.0",
126
+ "mongodb-memory-server": ">=10.4.3",
127
+ "mongoose": ">=9.4.1"
128
+ },
129
+ "peerDependenciesMeta": {
130
+ "mongodb-memory-server": {
131
+ "optional": true
132
+ }
133
+ },
134
+ "engines": {
135
+ "node": ">=22"
136
+ },
137
+ "publishConfig": {
138
+ "access": "public"
139
+ },
140
+ "scripts": {
141
+ "build": "tsdown",
142
+ "dev": "tsdown --watch",
143
+ "test": "vitest run --project unit --project integration",
144
+ "test:unit": "vitest run --project unit",
145
+ "test:integration": "vitest run --project integration",
146
+ "test:e2e": "vitest run --project e2e",
147
+ "test:all": "vitest run --project unit --project integration --project e2e",
148
+ "test:watch": "vitest --project unit --project integration",
149
+ "test:coverage": "vitest run --coverage",
150
+ "typecheck": "tsc --noEmit",
151
+ "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
152
+ "lint": "biome check src/",
153
+ "lint:fix": "biome check src/ --write",
154
+ "check:exports": "node scripts/check-exports.mjs",
155
+ "lint:package": "npm run check:exports && publint && attw --pack . --profile esm-only",
156
+ "format": "biome format src/ --write",
157
+ "check": "biome ci src/ --diagnostic-level=error",
158
+ "check:dead-code": "knip",
159
+ "ci": "npm run check && npm run typecheck && npm run typecheck:tests && npm run build && npm run lint:package && npm run check:dead-code && npm run check:forgotten-exports && npm test",
160
+ "push": "classytic-push",
161
+ "prepublishOnly": "npm run ci",
162
+ "publish:dry": "npm publish --dry-run --access public",
163
+ "publish:npm": "npm publish --access public",
164
+ "release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
165
+ "release": "npm run push -- main && npm run release:tag && npm publish --access public",
166
+ "release:patch": "npm version patch && npm run release",
167
+ "release:minor": "npm version minor && npm run release",
168
+ "release:major": "npm version major && npm run release",
169
+ "check:forgotten-exports": "node scripts/check-forgotten-exports.mjs"
170
+ },
171
+ "devDependencies": {
172
+ "@arethetypeswrong/cli": "^0.18.2",
173
+ "@better-auth/api-key": "^1.6.22",
174
+ "@better-auth/mongo-adapter": "^1.6.22",
175
+ "@biomejs/biome": "^2.4.10",
176
+ "@classytic/dev-tools": "^0.2.0",
177
+ "@classytic/repo-core": "^0.21.0",
178
+ "@types/node": "^22.0.0",
179
+ "@vitest/coverage-v8": "^4.1.4",
180
+ "ajv": "^8.18.0",
181
+ "ajv-formats": "^3.0.1",
182
+ "better-auth": "^1.6.23",
183
+ "dotenv": "^17.4.2",
184
+ "knip": "^6.31.0",
185
+ "mongodb": "^7.5.0",
186
+ "mongodb-memory-server": "^10.4.3",
187
+ "mongoose": "^9.9.1",
188
+ "publint": "^0.3.18",
189
+ "tsdown": "^0.22.14",
190
+ "typescript": "~5.9.0",
191
+ "vitest": "^4.1.4"
192
+ }
193
+ }