@classytic/mongokit 3.10.0 → 3.10.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/dist/actions/index.d.mts +1 -1
- package/dist/ai/index.d.mts +3 -3
- package/dist/{index-C7WmYP6F.d.mts → index-CNNavGpM.d.mts} +23 -23
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/{mongooseToJsonSchema-t-MoVleF.d.mts → mongooseToJsonSchema-Bi8hNbj8.d.mts} +1 -1
- package/dist/pagination/PaginationEngine.d.mts +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/{types-BUS0Zj8y.d.mts → types-CYFJa36g.d.mts} +52 -21
- package/dist/utils/index.d.mts +2 -2
- package/dist/{validation-chain.plugin-JkipjuOR.d.mts → validation-chain.plugin-BNG3coI0.d.mts} +7 -7
- package/dist/{validation-chain.plugin-Ccu6irtx.mjs → validation-chain.plugin-Bt8HepWW.mjs} +11 -7
- package/package.json +4 -3
package/dist/actions/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as create_d_exports, i as delete_d_exports, n as update_d_exports, o as aggregate_d_exports, r as read_d_exports } from "../index-
|
|
1
|
+
import { a as create_d_exports, i as delete_d_exports, n as update_d_exports, o as aggregate_d_exports, r as read_d_exports } from "../index-CNNavGpM.mjs";
|
|
2
2
|
export { aggregate_d_exports as aggregate, create_d_exports as create, delete_d_exports as deleteActions, read_d_exports as read, update_d_exports as update };
|
package/dist/ai/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as Plugin } from "../types-
|
|
2
|
-
import {
|
|
1
|
+
import { K as Plugin } from "../types-CYFJa36g.mjs";
|
|
2
|
+
import { PipelineStage } from "mongoose";
|
|
3
3
|
|
|
4
4
|
//#region src/ai/types.d.ts
|
|
5
5
|
/** Supported similarity metrics for vector search */
|
|
@@ -73,7 +73,7 @@ interface VectorSearchParams {
|
|
|
73
73
|
/** Which vector field config to use (default: first configured) */
|
|
74
74
|
field?: string;
|
|
75
75
|
/** MongoDB session for transactions */
|
|
76
|
-
session?:
|
|
76
|
+
session?: unknown;
|
|
77
77
|
/** Fields to include/exclude in results */
|
|
78
78
|
project?: Record<string, 0 | 1>;
|
|
79
79
|
/** Include similarity score in results */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dt as LookupOptions, E as GroupResult, H as OperationOptions, L as MinMaxResult, Q as ReadPreferenceType, T as FindOneAndUpdateOptions, Y as PopulateSpec, a as AnyDocument, at as SelectSpec, dt as SortSpec, g as CreateOptions, gt as UpdateWithValidationResult, ht as UpdateOptions, mt as UpdateManyResult, y as DeleteResult, z as ObjectId } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { Dt as LookupOptions, E as GroupResult, H as OperationOptions, L as MinMaxResult, Q as ReadPreferenceType, T as FindOneAndUpdateOptions, Y as PopulateSpec, a as AnyDocument, at as SelectSpec, dt as SortSpec, g as CreateOptions, gt as UpdateWithValidationResult, ht as UpdateOptions, mt as UpdateManyResult, y as DeleteResult, z as ObjectId } from "./types-CYFJa36g.mjs";
|
|
2
|
+
import { Model, PipelineStage } from "mongoose";
|
|
3
3
|
|
|
4
4
|
//#region src/actions/aggregate.d.ts
|
|
5
5
|
declare namespace aggregate_d_exports {
|
|
@@ -9,7 +9,7 @@ declare namespace aggregate_d_exports {
|
|
|
9
9
|
* Execute aggregation pipeline
|
|
10
10
|
*/
|
|
11
11
|
declare function aggregate<TResult = unknown>(Model: Model<any>, pipeline: PipelineStage[], options?: {
|
|
12
|
-
session?:
|
|
12
|
+
session?: unknown;
|
|
13
13
|
}): Promise<TResult[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Aggregate with pagination using native MongoDB $facet
|
|
@@ -19,7 +19,7 @@ declare function aggregate<TResult = unknown>(Model: Model<any>, pipeline: Pipel
|
|
|
19
19
|
declare function aggregatePaginate<TDoc = AnyDocument>(Model: Model<TDoc>, pipeline: PipelineStage[], options?: {
|
|
20
20
|
page?: number;
|
|
21
21
|
limit?: number;
|
|
22
|
-
session?:
|
|
22
|
+
session?: unknown;
|
|
23
23
|
}): Promise<{
|
|
24
24
|
docs: TDoc[];
|
|
25
25
|
total: number;
|
|
@@ -34,13 +34,13 @@ declare function aggregatePaginate<TDoc = AnyDocument>(Model: Model<TDoc>, pipel
|
|
|
34
34
|
*/
|
|
35
35
|
declare function groupBy(Model: Model<any>, field: string, options?: {
|
|
36
36
|
limit?: number;
|
|
37
|
-
session?:
|
|
37
|
+
session?: unknown;
|
|
38
38
|
}): Promise<GroupResult[]>;
|
|
39
39
|
/**
|
|
40
40
|
* Count by field values
|
|
41
41
|
*/
|
|
42
42
|
declare function countBy(Model: Model<any>, field: string, query?: Record<string, unknown>, options?: {
|
|
43
|
-
session?:
|
|
43
|
+
session?: unknown;
|
|
44
44
|
}): Promise<GroupResult[]>;
|
|
45
45
|
/**
|
|
46
46
|
* Lookup (join) with another collection
|
|
@@ -57,38 +57,38 @@ declare function lookup<TDoc = AnyDocument>(Model: Model<TDoc>, lookupOptions: L
|
|
|
57
57
|
*/
|
|
58
58
|
declare function unwind<TDoc = AnyDocument>(Model: Model<TDoc>, field: string, options?: {
|
|
59
59
|
preserveEmpty?: boolean;
|
|
60
|
-
session?:
|
|
60
|
+
session?: unknown;
|
|
61
61
|
}): Promise<TDoc[]>;
|
|
62
62
|
/**
|
|
63
63
|
* Facet search (multiple aggregations in one query)
|
|
64
64
|
*/
|
|
65
65
|
declare function facet<TResult = Record<string, unknown[]>>(Model: Model<any>, facets: Record<string, PipelineStage[]>, options?: {
|
|
66
|
-
session?:
|
|
66
|
+
session?: unknown;
|
|
67
67
|
}): Promise<TResult[]>;
|
|
68
68
|
/**
|
|
69
69
|
* Get distinct values
|
|
70
70
|
*/
|
|
71
71
|
declare function distinct<T = unknown>(Model: Model<any>, field: string, query?: Record<string, unknown>, options?: {
|
|
72
|
-
session?:
|
|
72
|
+
session?: unknown;
|
|
73
73
|
readPreference?: string;
|
|
74
74
|
}): Promise<T[]>;
|
|
75
75
|
/**
|
|
76
76
|
* Calculate sum
|
|
77
77
|
*/
|
|
78
78
|
declare function sum(Model: Model<any>, field: string, query?: Record<string, unknown>, options?: {
|
|
79
|
-
session?:
|
|
79
|
+
session?: unknown;
|
|
80
80
|
}): Promise<number>;
|
|
81
81
|
/**
|
|
82
82
|
* Calculate average
|
|
83
83
|
*/
|
|
84
84
|
declare function average(Model: Model<any>, field: string, query?: Record<string, unknown>, options?: {
|
|
85
|
-
session?:
|
|
85
|
+
session?: unknown;
|
|
86
86
|
}): Promise<number>;
|
|
87
87
|
/**
|
|
88
88
|
* Min/Max
|
|
89
89
|
*/
|
|
90
90
|
declare function minMax(Model: Model<any>, field: string, query?: Record<string, unknown>, options?: {
|
|
91
|
-
session?:
|
|
91
|
+
session?: unknown;
|
|
92
92
|
}): Promise<MinMaxResult>;
|
|
93
93
|
declare namespace create_d_exports {
|
|
94
94
|
export { create, createDefault, createMany, upsert };
|
|
@@ -109,7 +109,7 @@ declare function createDefault<TDoc = AnyDocument>(Model: Model<TDoc>, overrides
|
|
|
109
109
|
* Upsert (create or update)
|
|
110
110
|
*/
|
|
111
111
|
declare function upsert<TDoc = AnyDocument>(Model: Model<TDoc>, query: Record<string, unknown>, data: Record<string, unknown>, options?: {
|
|
112
|
-
session?:
|
|
112
|
+
session?: unknown;
|
|
113
113
|
updatePipeline?: boolean;
|
|
114
114
|
}): Promise<TDoc | null>;
|
|
115
115
|
declare namespace delete_d_exports {
|
|
@@ -119,34 +119,34 @@ declare namespace delete_d_exports {
|
|
|
119
119
|
* Delete by ID
|
|
120
120
|
*/
|
|
121
121
|
declare function deleteById<TDoc = AnyDocument>(Model: Model<TDoc>, id: string | ObjectId, options?: {
|
|
122
|
-
session?:
|
|
122
|
+
session?: unknown;
|
|
123
123
|
query?: Record<string, unknown>;
|
|
124
124
|
}): Promise<DeleteResult>;
|
|
125
125
|
/**
|
|
126
126
|
* Delete many documents
|
|
127
127
|
*/
|
|
128
128
|
declare function deleteMany<TDoc = AnyDocument>(Model: Model<TDoc>, query: Record<string, unknown>, options?: {
|
|
129
|
-
session?:
|
|
129
|
+
session?: unknown;
|
|
130
130
|
}): Promise<DeleteResult>;
|
|
131
131
|
/**
|
|
132
132
|
* Delete by query
|
|
133
133
|
*/
|
|
134
134
|
declare function deleteByQuery(Model: Model<any>, query: Record<string, unknown>, options?: {
|
|
135
|
-
session?:
|
|
135
|
+
session?: unknown;
|
|
136
136
|
throwOnNotFound?: boolean;
|
|
137
137
|
}): Promise<DeleteResult>;
|
|
138
138
|
/**
|
|
139
139
|
* Soft delete (set deleted flag)
|
|
140
140
|
*/
|
|
141
141
|
declare function softDelete<TDoc = AnyDocument>(Model: Model<TDoc>, id: string | ObjectId, options?: {
|
|
142
|
-
session?:
|
|
142
|
+
session?: unknown;
|
|
143
143
|
userId?: string;
|
|
144
144
|
}): Promise<DeleteResult>;
|
|
145
145
|
/**
|
|
146
146
|
* Restore soft deleted document
|
|
147
147
|
*/
|
|
148
148
|
declare function restore<TDoc = AnyDocument>(Model: Model<TDoc>, id: string | ObjectId, options?: {
|
|
149
|
-
session?:
|
|
149
|
+
session?: unknown;
|
|
150
150
|
}): Promise<DeleteResult>;
|
|
151
151
|
declare namespace read_d_exports {
|
|
152
152
|
export { count, exists, getAll, getById, getByQuery, getOrCreate, tryGetByQuery };
|
|
@@ -186,28 +186,28 @@ declare function getAll<TDoc = AnyDocument>(Model: Model<TDoc>, query?: Record<s
|
|
|
186
186
|
limit?: number;
|
|
187
187
|
skip?: number;
|
|
188
188
|
lean?: boolean;
|
|
189
|
-
session?:
|
|
189
|
+
session?: unknown;
|
|
190
190
|
readPreference?: ReadPreferenceType;
|
|
191
191
|
}): Promise<TDoc[]>;
|
|
192
192
|
/**
|
|
193
193
|
* Get or create document (upsert)
|
|
194
194
|
*/
|
|
195
195
|
declare function getOrCreate<TDoc = AnyDocument>(Model: Model<TDoc>, query: Record<string, unknown>, createData: Record<string, unknown>, options?: {
|
|
196
|
-
session?:
|
|
196
|
+
session?: unknown;
|
|
197
197
|
updatePipeline?: boolean;
|
|
198
198
|
}): Promise<TDoc | null>;
|
|
199
199
|
/**
|
|
200
200
|
* Count documents matching query
|
|
201
201
|
*/
|
|
202
202
|
declare function count<TDoc = AnyDocument>(Model: Model<TDoc>, query?: Record<string, unknown>, options?: {
|
|
203
|
-
session?:
|
|
203
|
+
session?: unknown;
|
|
204
204
|
readPreference?: ReadPreferenceType;
|
|
205
205
|
}): Promise<number>;
|
|
206
206
|
/**
|
|
207
207
|
* Check if document exists
|
|
208
208
|
*/
|
|
209
209
|
declare function exists<TDoc = AnyDocument>(Model: Model<TDoc>, query: Record<string, unknown>, options?: {
|
|
210
|
-
session?:
|
|
210
|
+
session?: unknown;
|
|
211
211
|
readPreference?: ReadPreferenceType;
|
|
212
212
|
}): Promise<{
|
|
213
213
|
_id: unknown;
|
|
@@ -247,7 +247,7 @@ declare function updateWithValidation<TDoc = AnyDocument>(Model: Model<TDoc>, id
|
|
|
247
247
|
* Update many documents
|
|
248
248
|
*/
|
|
249
249
|
declare function updateMany(Model: Model<unknown>, query: Record<string, unknown>, data: Record<string, unknown>, options?: {
|
|
250
|
-
session?:
|
|
250
|
+
session?: unknown;
|
|
251
251
|
updatePipeline?: boolean;
|
|
252
252
|
arrayFilters?: Record<string, unknown>[];
|
|
253
253
|
}): Promise<UpdateManyResult>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as RepositoryContext, A as InferRawDoc, B as OffsetPaginationOptions, C as EventPhase, Ct as IControllerResponse, D as HookMode, Dt as LookupOptions, E as GroupResult, Et as LookupBuilder, F as LookupPopulateOptions, G as PartialBy, H as OperationOptions, I as LookupPopulateResult, J as PluginType, K as Plugin, L as MinMaxResult, M as KeysetPaginationOptions, N as KeysetPaginationResult, O as HttpError, P as Logger, Q as ReadPreferenceType, R as NonNullableFields, S as EventPayload, St as IController, T as FindOneAndUpdateOptions, Tt as IResponseFormatter, U as PaginationConfig, V as OffsetPaginationResult, W as PaginationResult, X as PrioritizedHook, Y as PopulateSpec, Z as ReadOptions, _ as DecodedCursor, _t as UserContext, a as AnyDocument, at as SelectSpec, b as DocField, bt as WithPlugins, c as CacheOperationOptions, ct as SoftDeleteOptions, d as CacheableOptions, dt as SortSpec, et as RepositoryEvent, f as CascadeOptions, ft as Strict, g as CreateOptions, gt as UpdateWithValidationResult, h as CreateInput, ht as UpdateOptions, i as AllPluginMethods, it as RequiredBy, j as KeysOfType, k as InferDocument, l as CacheOptions, lt as SoftDeleteRepository, m as CollationOptions, mt as UpdateManyResult, n as AggregatePaginationOptions, nt as RepositoryOperation, o as AnyModel, ot as SessionOptions, p as CascadeRelation, pt as UpdateInput, q as PluginFunction, r as AggregatePaginationResult, rt as RepositoryOptions, s as CacheAdapter, st as SoftDeleteFilterMode, t as AggregateOptions, tt as RepositoryInstance, u as CacheStats, ut as SortDirection, v as DeepPartial, vt as ValidationChainOptions, w as FieldPreset, wt as IRequestContext, x as EventHandlers, xt as WithTransactionOptions, y as DeleteResult, yt as ValidatorDefinition, z as ObjectId } from "./types-
|
|
2
|
-
import { t as index_d_exports } from "./index-
|
|
1
|
+
import { $ as RepositoryContext, A as InferRawDoc, B as OffsetPaginationOptions, C as EventPhase, Ct as IControllerResponse, D as HookMode, Dt as LookupOptions, E as GroupResult, Et as LookupBuilder, F as LookupPopulateOptions, G as PartialBy, H as OperationOptions, I as LookupPopulateResult, J as PluginType, K as Plugin, L as MinMaxResult, M as KeysetPaginationOptions, N as KeysetPaginationResult, O as HttpError, P as Logger, Q as ReadPreferenceType, R as NonNullableFields, S as EventPayload, St as IController, T as FindOneAndUpdateOptions, Tt as IResponseFormatter, U as PaginationConfig, V as OffsetPaginationResult, W as PaginationResult, X as PrioritizedHook, Y as PopulateSpec, Z as ReadOptions, _ as DecodedCursor, _t as UserContext, a as AnyDocument, at as SelectSpec, b as DocField, bt as WithPlugins, c as CacheOperationOptions, ct as SoftDeleteOptions, d as CacheableOptions, dt as SortSpec, et as RepositoryEvent, f as CascadeOptions, ft as Strict, g as CreateOptions, gt as UpdateWithValidationResult, h as CreateInput, ht as UpdateOptions, i as AllPluginMethods, it as RequiredBy, j as KeysOfType, k as InferDocument, l as CacheOptions, lt as SoftDeleteRepository, m as CollationOptions, mt as UpdateManyResult, n as AggregatePaginationOptions, nt as RepositoryOperation, o as AnyModel, ot as SessionOptions, p as CascadeRelation, pt as UpdateInput, q as PluginFunction, r as AggregatePaginationResult, rt as RepositoryOptions, s as CacheAdapter, st as SoftDeleteFilterMode, t as AggregateOptions, tt as RepositoryInstance, u as CacheStats, ut as SortDirection, v as DeepPartial, vt as ValidationChainOptions, w as FieldPreset, wt as IRequestContext, x as EventHandlers, xt as WithTransactionOptions, y as DeleteResult, yt as ValidatorDefinition, z as ObjectId } from "./types-CYFJa36g.mjs";
|
|
2
|
+
import { t as index_d_exports } from "./index-CNNavGpM.mjs";
|
|
3
3
|
import { PaginationEngine } from "./pagination/PaginationEngine.mjs";
|
|
4
|
-
import { $ as aggregateHelpersPlugin, A as PrefixedIdOptions, B as BatchOperationsMethods, C as methodRegistryPlugin, D as CustomIdOptions, E as elasticSearchPlugin, F as prefixedId, G as AuditQueryOptions, H as batchOperationsPlugin, I as sequentialId, J as AuditTrailOptions, K as AuditQueryResult, L as cascadePlugin, M as customIdPlugin, N as dateSequentialId, O as DateSequentialIdOptions, P as getNextSequence, Q as AggregateHelpersMethods, R as CacheMethods, T as ElasticSearchOptions, U as AuditEntry, V as BulkWriteResult, W as AuditOperation, X as auditTrailPlugin, Y as AuditTrailQuery, Z as auditLogPlugin, _ as observabilityPlugin, a as uniqueField, b as MongoOperationsMethods, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as SequentialIdOptions, k as IdGenerator, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, q as AuditTrailMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MultiTenantOptions, w as fieldFilterPlugin, x as mongoOperationsPlugin, y as multiTenantPlugin, z as cachePlugin } from "./validation-chain.plugin-
|
|
4
|
+
import { $ as aggregateHelpersPlugin, A as PrefixedIdOptions, B as BatchOperationsMethods, C as methodRegistryPlugin, D as CustomIdOptions, E as elasticSearchPlugin, F as prefixedId, G as AuditQueryOptions, H as batchOperationsPlugin, I as sequentialId, J as AuditTrailOptions, K as AuditQueryResult, L as cascadePlugin, M as customIdPlugin, N as dateSequentialId, O as DateSequentialIdOptions, P as getNextSequence, Q as AggregateHelpersMethods, R as CacheMethods, T as ElasticSearchOptions, U as AuditEntry, V as BulkWriteResult, W as AuditOperation, X as auditTrailPlugin, Y as AuditTrailQuery, Z as auditLogPlugin, _ as observabilityPlugin, a as uniqueField, b as MongoOperationsMethods, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as SequentialIdOptions, k as IdGenerator, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, q as AuditTrailMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MultiTenantOptions, w as fieldFilterPlugin, x as mongoOperationsPlugin, y as multiTenantPlugin, z as cachePlugin } from "./validation-chain.plugin-BNG3coI0.mjs";
|
|
5
5
|
import { n as SchemaPathsLike, t as FieldType$1 } from "./coercion-oM8G4b6m.mjs";
|
|
6
6
|
import { n as SchemaIndexes } from "./indexes-C26GNZRU.mjs";
|
|
7
|
-
import { a as createFieldPreset, c as getMongooseProjection, d as parseDuplicateKeyError, i as configureLogger, l as createError, n as buildCrudSchemasFromMongooseSchema, o as filterResponseData, r as createMemoryCache, s as getFieldsForUser, t as buildCrudSchemasFromModel, u as isDuplicateKeyError } from "./mongooseToJsonSchema-
|
|
7
|
+
import { a as createFieldPreset, c as getMongooseProjection, d as parseDuplicateKeyError, i as configureLogger, l as createError, n as buildCrudSchemasFromMongooseSchema, o as filterResponseData, r as createMemoryCache, s as getFieldsForUser, t as buildCrudSchemasFromModel, u as isDuplicateKeyError } from "./mongooseToJsonSchema-Bi8hNbj8.mjs";
|
|
8
8
|
import * as _$mongoose from "mongoose";
|
|
9
9
|
import { ClientSession, Expression, Model, PipelineStage, PopulateOptions } from "mongoose";
|
|
10
10
|
import { AggPaginationRequest, AggRequest, AggResult, RepositoryBase } from "@classytic/repo-core/repository";
|
|
@@ -1193,7 +1193,7 @@ declare class Repository<TDoc = unknown> extends RepositoryBase {
|
|
|
1193
1193
|
* });
|
|
1194
1194
|
* ```
|
|
1195
1195
|
*/
|
|
1196
|
-
lookupPopulate(options: LookupPopulateOptions): Promise<LookupPopulateResult<TDoc>>;
|
|
1196
|
+
lookupPopulate<TExtra extends Record<string, unknown> = Record<string, unknown>>(options: LookupPopulateOptions<TDoc>): Promise<LookupPopulateResult<TDoc, TExtra>>;
|
|
1197
1197
|
/**
|
|
1198
1198
|
* Create an aggregation builder for this model
|
|
1199
1199
|
* Useful for building complex custom aggregations
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { r as warn, t as configureLogger } from "./logger-DJ7egMnd.mjs";
|
|
|
2
2
|
import { b as LookupBuilder } from "./update-CWXfFC6O.mjs";
|
|
3
3
|
import { n as isDuplicateKeyError, r as parseDuplicateKeyError, t as createError } from "./error-CzYwrfUP.mjs";
|
|
4
4
|
import { t as actions_exports } from "./actions/index.mjs";
|
|
5
|
-
import { A as AuditTrailQuery, C as cachePlugin, D as withTransaction, E as isTransactionUnsupported, F as MUTATING_OPERATIONS, I as OP_REGISTRY, L as READ_OPERATIONS, M as auditLogPlugin, N as aggregateHelpersPlugin, O as AggregationBuilder, P as ALL_OPERATIONS, R as operationsByPolicyKey, S as cascadePlugin, T as Repository, _ as customIdPlugin, a as uniqueField, b as prefixedId, c as createTenantContext, d as observabilityPlugin, f as multiTenantPlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, j as auditTrailPlugin, k as batchOperationsPlugin, l as subdocumentPlugin, m as methodRegistryPlugin, n as blockIf, o as validationChainPlugin, p as mongoOperationsPlugin, r as immutableField, s as timestampPlugin, t as autoInject, u as softDeletePlugin, v as dateSequentialId, w as HOOK_PRIORITY, x as sequentialId, y as getNextSequence } from "./validation-chain.plugin-
|
|
5
|
+
import { A as AuditTrailQuery, C as cachePlugin, D as withTransaction, E as isTransactionUnsupported, F as MUTATING_OPERATIONS, I as OP_REGISTRY, L as READ_OPERATIONS, M as auditLogPlugin, N as aggregateHelpersPlugin, O as AggregationBuilder, P as ALL_OPERATIONS, R as operationsByPolicyKey, S as cascadePlugin, T as Repository, _ as customIdPlugin, a as uniqueField, b as prefixedId, c as createTenantContext, d as observabilityPlugin, f as multiTenantPlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, j as auditTrailPlugin, k as batchOperationsPlugin, l as subdocumentPlugin, m as methodRegistryPlugin, n as blockIf, o as validationChainPlugin, p as mongoOperationsPlugin, r as immutableField, s as timestampPlugin, t as autoInject, u as softDeletePlugin, v as dateSequentialId, w as HOOK_PRIORITY, x as sequentialId, y as getNextSequence } from "./validation-chain.plugin-Bt8HepWW.mjs";
|
|
6
6
|
import { t as PaginationEngine } from "./PaginationEngine-B93fLCcO.mjs";
|
|
7
7
|
import { isGeoOperator, parseGeoFilter } from "./query/primitives/geo.mjs";
|
|
8
8
|
import { i as getMongooseProjection, n as filterResponseData, r as getFieldsForUser, t as createFieldPreset } from "./field-selection-dI0m4RBs.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as HttpError, _t as UserContext, s as CacheAdapter, w as FieldPreset } from "./types-
|
|
1
|
+
import { O as HttpError, _t as UserContext, s as CacheAdapter, w as FieldPreset } from "./types-CYFJa36g.mjs";
|
|
2
2
|
import mongoose, { Schema } from "mongoose";
|
|
3
3
|
import { CrudSchemas, SchemaBuilderOptions } from "@classytic/repo-core/schema";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as OffsetPaginationOptions, M as KeysetPaginationOptions, N as KeysetPaginationResult, U as PaginationConfig, V as OffsetPaginationResult, a as AnyDocument, n as AggregatePaginationOptions, r as AggregatePaginationResult } from "../types-
|
|
1
|
+
import { B as OffsetPaginationOptions, M as KeysetPaginationOptions, N as KeysetPaginationResult, U as PaginationConfig, V as OffsetPaginationResult, a as AnyDocument, n as AggregatePaginationOptions, r as AggregatePaginationResult } from "../types-CYFJa36g.mjs";
|
|
2
2
|
import { Model } from "mongoose";
|
|
3
3
|
|
|
4
4
|
//#region src/pagination/PaginationEngine.d.ts
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as aggregateHelpersPlugin, A as PrefixedIdOptions, B as BatchOperationsMethods, C as methodRegistryPlugin, D as CustomIdOptions, E as elasticSearchPlugin, F as prefixedId, G as AuditQueryOptions, H as batchOperationsPlugin, I as sequentialId, J as AuditTrailOptions, K as AuditQueryResult, L as cascadePlugin, M as customIdPlugin, N as dateSequentialId, O as DateSequentialIdOptions, P as getNextSequence, Q as AggregateHelpersMethods, R as CacheMethods, S as MethodRegistryRepository, T as ElasticSearchOptions, U as AuditEntry, W as AuditOperation, X as auditTrailPlugin, Y as AuditTrailQuery, Z as auditLogPlugin, _ as observabilityPlugin, a as uniqueField, b as MongoOperationsMethods, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as SequentialIdOptions, k as IdGenerator, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, q as AuditTrailMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MultiTenantOptions, w as fieldFilterPlugin, x as mongoOperationsPlugin, y as multiTenantPlugin, z as cachePlugin } from "../validation-chain.plugin-
|
|
1
|
+
import { $ as aggregateHelpersPlugin, A as PrefixedIdOptions, B as BatchOperationsMethods, C as methodRegistryPlugin, D as CustomIdOptions, E as elasticSearchPlugin, F as prefixedId, G as AuditQueryOptions, H as batchOperationsPlugin, I as sequentialId, J as AuditTrailOptions, K as AuditQueryResult, L as cascadePlugin, M as customIdPlugin, N as dateSequentialId, O as DateSequentialIdOptions, P as getNextSequence, Q as AggregateHelpersMethods, R as CacheMethods, S as MethodRegistryRepository, T as ElasticSearchOptions, U as AuditEntry, W as AuditOperation, X as auditTrailPlugin, Y as AuditTrailQuery, Z as auditLogPlugin, _ as observabilityPlugin, a as uniqueField, b as MongoOperationsMethods, c as TenantContext, d as SubdocumentMethods, f as subdocumentPlugin, g as OperationMetric, h as ObservabilityOptions, i as requireField, j as SequentialIdOptions, k as IdGenerator, l as TenantStore, m as softDeletePlugin, n as blockIf, o as validationChainPlugin, p as SoftDeleteMethods, q as AuditTrailMethods, r as immutableField, s as timestampPlugin, t as autoInject, u as createTenantContext, v as MultiTenantOptions, w as fieldFilterPlugin, x as mongoOperationsPlugin, y as multiTenantPlugin, z as cachePlugin } from "../validation-chain.plugin-BNG3coI0.mjs";
|
|
2
2
|
export { type AggregateHelpersMethods, type AuditEntry, type AuditOperation, type AuditQueryOptions, type AuditQueryResult, type AuditTrailMethods, type AuditTrailOptions, AuditTrailQuery, type BatchOperationsMethods, type CacheMethods, type CustomIdOptions, type DateSequentialIdOptions, type ElasticSearchOptions, type IdGenerator, type MethodRegistryRepository, type MongoOperationsMethods, type MultiTenantOptions, type ObservabilityOptions, type OperationMetric, type PrefixedIdOptions, type SequentialIdOptions, type SoftDeleteMethods, type SubdocumentMethods, type TenantContext, type TenantStore, aggregateHelpersPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, fieldFilterPlugin, getNextSequence, immutableField, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as AuditTrailQuery, C as cachePlugin, M as auditLogPlugin, N as aggregateHelpersPlugin, S as cascadePlugin, _ as customIdPlugin, a as uniqueField, b as prefixedId, c as createTenantContext, d as observabilityPlugin, f as multiTenantPlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, j as auditTrailPlugin, k as batchOperationsPlugin, l as subdocumentPlugin, m as methodRegistryPlugin, n as blockIf, o as validationChainPlugin, p as mongoOperationsPlugin, r as immutableField, s as timestampPlugin, t as autoInject, u as softDeletePlugin, v as dateSequentialId, x as sequentialId, y as getNextSequence } from "../validation-chain.plugin-
|
|
1
|
+
import { A as AuditTrailQuery, C as cachePlugin, M as auditLogPlugin, N as aggregateHelpersPlugin, S as cascadePlugin, _ as customIdPlugin, a as uniqueField, b as prefixedId, c as createTenantContext, d as observabilityPlugin, f as multiTenantPlugin, g as elasticSearchPlugin, h as fieldFilterPlugin, i as requireField, j as auditTrailPlugin, k as batchOperationsPlugin, l as subdocumentPlugin, m as methodRegistryPlugin, n as blockIf, o as validationChainPlugin, p as mongoOperationsPlugin, r as immutableField, s as timestampPlugin, t as autoInject, u as softDeletePlugin, v as dateSequentialId, x as sequentialId, y as getNextSequence } from "../validation-chain.plugin-Bt8HepWW.mjs";
|
|
2
2
|
export { AuditTrailQuery, aggregateHelpersPlugin, auditLogPlugin, auditTrailPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, createTenantContext, customIdPlugin, dateSequentialId, elasticSearchPlugin, fieldFilterPlugin, getNextSequence, immutableField, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, prefixedId, requireField, sequentialId, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _$mongoose from "mongoose";
|
|
2
|
-
import {
|
|
2
|
+
import { Document, Model, PipelineStage, PopulateOptions, Types } from "mongoose";
|
|
3
|
+
import * as _$_classytic_repo_core_filter0 from "@classytic/repo-core/filter";
|
|
3
4
|
import * as _$_classytic_repo_core_repository0 from "@classytic/repo-core/repository";
|
|
4
5
|
import { DeleteResult, LookupPopulateResult, UpdateManyResult } from "@classytic/repo-core/repository";
|
|
5
6
|
import { ValidationResult } from "@classytic/repo-core/schema";
|
|
@@ -26,7 +27,7 @@ interface LookupOptions {
|
|
|
26
27
|
query?: Record<string, unknown>;
|
|
27
28
|
/** Query options (legacy, for aggregate.ts compatibility) */
|
|
28
29
|
options?: {
|
|
29
|
-
session?:
|
|
30
|
+
session?: unknown;
|
|
30
31
|
};
|
|
31
32
|
/** Sanitize pipeline stages (default: true). Set false only for trusted server-side pipelines */
|
|
32
33
|
sanitize?: boolean;
|
|
@@ -495,8 +496,15 @@ type SortDirection = 1 | -1;
|
|
|
495
496
|
type SortSpec = Record<string, SortDirection>;
|
|
496
497
|
/** Populate specification */
|
|
497
498
|
type PopulateSpec = string | string[] | PopulateOptions | PopulateOptions[];
|
|
498
|
-
/**
|
|
499
|
-
|
|
499
|
+
/**
|
|
500
|
+
* Select specification. `readonly string[]` widens the legacy `string[]`
|
|
501
|
+
* form to also accept the immutable variant repo-core's contract uses
|
|
502
|
+
* (`LookupPopulateOptions.select: readonly string[] | Record<string, 0
|
|
503
|
+
* | 1>`), so `Repository<TDoc>` assigns to `StandardRepo<TDoc>` without
|
|
504
|
+
* TS2322 on the `select` field. Any existing mutable-array caller stays
|
|
505
|
+
* compatible — `string[]` is assignable to `readonly string[]`.
|
|
506
|
+
*/
|
|
507
|
+
type SelectSpec = string | readonly string[] | Record<string, 0 | 1>;
|
|
500
508
|
/** Filter query type for MongoDB queries (compatible with Mongoose 8 & 9) */
|
|
501
509
|
type FilterQuery<_T = unknown> = Record<string, unknown>;
|
|
502
510
|
/**
|
|
@@ -651,7 +659,7 @@ interface BasePaginationOptions {
|
|
|
651
659
|
/** Return plain JavaScript objects */
|
|
652
660
|
lean?: boolean;
|
|
653
661
|
/** MongoDB session for transactions */
|
|
654
|
-
session?:
|
|
662
|
+
session?: unknown;
|
|
655
663
|
/** Query hint (index name or document) */
|
|
656
664
|
hint?: string | Record<string, 1 | -1>;
|
|
657
665
|
/** Maximum execution time in milliseconds */
|
|
@@ -692,7 +700,7 @@ interface AggregatePaginationOptions {
|
|
|
692
700
|
/** Number of documents per page */
|
|
693
701
|
limit?: number;
|
|
694
702
|
/** MongoDB session for transactions */
|
|
695
|
-
session?:
|
|
703
|
+
session?: unknown;
|
|
696
704
|
/** Query hint (index name or document) for aggregation */
|
|
697
705
|
hint?: string | Record<string, 1 | -1>;
|
|
698
706
|
/** Maximum execution time in milliseconds */
|
|
@@ -766,7 +774,7 @@ type PaginationResult<T = unknown> = OffsetPaginationResult<T> | KeysetPaginatio
|
|
|
766
774
|
/** Session-only options — shared base for lightweight operations */
|
|
767
775
|
interface SessionOptions {
|
|
768
776
|
/** MongoDB session for transactions */
|
|
769
|
-
session?:
|
|
777
|
+
session?: unknown;
|
|
770
778
|
/** Organization/tenant ID for multi-tenant plugin scoping */
|
|
771
779
|
organizationId?: string | ObjectId;
|
|
772
780
|
/** Extensible — plugins can read custom fields from options */
|
|
@@ -870,8 +878,12 @@ interface AggregateOptions extends ReadOptions {
|
|
|
870
878
|
/** Lookup populate options */
|
|
871
879
|
/**
|
|
872
880
|
* Mongokit's `lookupPopulate` options — kit-native superset of the
|
|
873
|
-
* portable `LookupPopulateOptions
|
|
881
|
+
* portable `LookupPopulateOptions<TBase>` from repo-core. Widens three
|
|
882
|
+
* slots so arc / mongoose consumers compose cleanly:
|
|
874
883
|
*
|
|
884
|
+
* - `filters`: accepts Filter IR, a `Partial<TBase> & Record<string,
|
|
885
|
+
* unknown>` literal (same shape repo-core's contract uses), or a
|
|
886
|
+
* plain `Record<string, unknown>` for legacy callers.
|
|
875
887
|
* - `lookups`: accepts either the portable `LookupSpec[]` (works on
|
|
876
888
|
* every kit) or mongokit's `LookupOptions[]` (adds `pipeline` /
|
|
877
889
|
* `let` / `sanitize` for mongo-correlated joins).
|
|
@@ -879,13 +891,19 @@ interface AggregateOptions extends ReadOptions {
|
|
|
879
891
|
* (`'name email'`) in addition to the portable array / inclusion
|
|
880
892
|
* map. Kept for arc + existing controller convenience.
|
|
881
893
|
*
|
|
882
|
-
*
|
|
883
|
-
* `
|
|
884
|
-
* —
|
|
894
|
+
* `TBase` defaults to `unknown` so legacy non-generic usage still
|
|
895
|
+
* compiles; pass the doc type for arc `RepositoryLike<TDoc>` structural
|
|
896
|
+
* assignment — `LookupPopulateOptions<TDoc>` is bit-compatible with
|
|
897
|
+
* `import('@classytic/repo-core/repository').LookupPopulateOptions<TDoc>`.
|
|
885
898
|
*/
|
|
886
|
-
interface LookupPopulateOptions
|
|
887
|
-
/**
|
|
888
|
-
|
|
899
|
+
interface LookupPopulateOptions<TBase = unknown> {
|
|
900
|
+
/**
|
|
901
|
+
* Base-table filter. Accepts Filter IR from repo-core, a typed
|
|
902
|
+
* `Partial<TBase> & Record<string, unknown>` literal (what arc
|
|
903
|
+
* controllers produce when typed against `StandardRepo<TDoc>`), or
|
|
904
|
+
* a plain `Record<string, unknown>` for ad-hoc callers.
|
|
905
|
+
*/
|
|
906
|
+
filters?: _$_classytic_repo_core_filter0.Filter | (Partial<TBase> & Record<string, unknown>) | Record<string, unknown>;
|
|
889
907
|
/**
|
|
890
908
|
* Portable `LookupSpec[]` (cross-kit) or mongokit-native
|
|
891
909
|
* `LookupOptions[]` (with `pipeline` / `let` / `sanitize`). The
|
|
@@ -906,6 +924,19 @@ interface LookupPopulateOptions extends ReadOptions {
|
|
|
906
924
|
collation?: CollationOptions;
|
|
907
925
|
/** Count strategy for offset pagination */
|
|
908
926
|
countStrategy?: 'exact' | 'estimated' | 'none';
|
|
927
|
+
/**
|
|
928
|
+
* Transaction session. Typed `unknown` to match repo-core's
|
|
929
|
+
* `RepositorySession` contract — mongokit narrows to `ClientSession`
|
|
930
|
+
* internally. Not inherited from `ReadOptions` because the repo-core
|
|
931
|
+
* contract type has no `[key: string]: unknown` escape hatch, and
|
|
932
|
+
* arc's `Partial<StandardRepo<TDoc>>` boundary rejects index-signature
|
|
933
|
+
* drift under strict function-type variance.
|
|
934
|
+
*/
|
|
935
|
+
session?: unknown;
|
|
936
|
+
/** Read preference for replica sets (e.g. 'secondaryPreferred') */
|
|
937
|
+
readPreference?: ReadPreferenceType;
|
|
938
|
+
/** Multi-tenant plugin scoping (applied via before:lookupPopulate hook). */
|
|
939
|
+
organizationId?: string | ObjectId;
|
|
909
940
|
}
|
|
910
941
|
/**
|
|
911
942
|
* Union emitted by the validation-chain plugin. Keeps the violation shape
|
|
@@ -957,7 +988,7 @@ interface RepositoryContext {
|
|
|
957
988
|
/** Return lean documents */
|
|
958
989
|
lean?: boolean;
|
|
959
990
|
/** MongoDB session */
|
|
960
|
-
session?:
|
|
991
|
+
session?: unknown;
|
|
961
992
|
/** Read preference for replica sets */
|
|
962
993
|
readPreference?: ReadPreferenceType;
|
|
963
994
|
/** Pagination filters */
|
|
@@ -1157,7 +1188,7 @@ interface SoftDeleteRepository<TDoc = unknown> {
|
|
|
1157
1188
|
* @returns The restored document
|
|
1158
1189
|
*/
|
|
1159
1190
|
restore(id: string | ObjectId, options?: {
|
|
1160
|
-
session?:
|
|
1191
|
+
session?: unknown;
|
|
1161
1192
|
}): Promise<TDoc>;
|
|
1162
1193
|
/**
|
|
1163
1194
|
* Get all soft-deleted documents
|
|
@@ -1174,7 +1205,7 @@ interface SoftDeleteRepository<TDoc = unknown> {
|
|
|
1174
1205
|
select?: SelectSpec;
|
|
1175
1206
|
populate?: PopulateSpec;
|
|
1176
1207
|
lean?: boolean;
|
|
1177
|
-
session?:
|
|
1208
|
+
session?: unknown;
|
|
1178
1209
|
}): Promise<OffsetPaginationResult<TDoc>>;
|
|
1179
1210
|
}
|
|
1180
1211
|
/** Group result */
|
|
@@ -1370,7 +1401,7 @@ type AllPluginMethods<TDoc> = {
|
|
|
1370
1401
|
setMax(id: string | ObjectId, field: DocField<TDoc>, value: unknown, options?: Record<string, unknown>): Promise<TDoc>;
|
|
1371
1402
|
atomicUpdate(id: string | ObjectId, operators: Record<string, Record<string, unknown>>, options?: Record<string, unknown>): Promise<TDoc>;
|
|
1372
1403
|
updateMany(query: Record<string, unknown>, data: Record<string, unknown>, options?: {
|
|
1373
|
-
session?:
|
|
1404
|
+
session?: unknown;
|
|
1374
1405
|
updatePipeline?: boolean;
|
|
1375
1406
|
}): Promise<{
|
|
1376
1407
|
acknowledged: boolean;
|
|
@@ -1384,7 +1415,7 @@ type AllPluginMethods<TDoc> = {
|
|
|
1384
1415
|
deletedCount: number;
|
|
1385
1416
|
}>;
|
|
1386
1417
|
bulkWrite(operations: Record<string, unknown>[], options?: {
|
|
1387
|
-
session?:
|
|
1418
|
+
session?: unknown;
|
|
1388
1419
|
ordered?: boolean;
|
|
1389
1420
|
}): Promise<{
|
|
1390
1421
|
ok: number;
|
|
@@ -1417,7 +1448,7 @@ type AllPluginMethods<TDoc> = {
|
|
|
1417
1448
|
}): Promise<TDoc>;
|
|
1418
1449
|
deleteSubdocument(parentId: string | ObjectId, arrayPath: DocField<TDoc>, subId: string | ObjectId, options?: Record<string, unknown>): Promise<TDoc>;
|
|
1419
1450
|
restore(id: string | ObjectId, options?: {
|
|
1420
|
-
session?:
|
|
1451
|
+
session?: unknown;
|
|
1421
1452
|
}): Promise<TDoc>;
|
|
1422
1453
|
getDeleted(params?: {
|
|
1423
1454
|
filters?: Record<string, unknown>;
|
|
@@ -1428,7 +1459,7 @@ type AllPluginMethods<TDoc> = {
|
|
|
1428
1459
|
select?: SelectSpec;
|
|
1429
1460
|
populate?: PopulateSpec;
|
|
1430
1461
|
lean?: boolean;
|
|
1431
|
-
session?:
|
|
1462
|
+
session?: unknown;
|
|
1432
1463
|
}): Promise<OffsetPaginationResult<TDoc>>;
|
|
1433
1464
|
invalidateCache(id: string): Promise<void>;
|
|
1434
1465
|
invalidateListCache(): Promise<void>;
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Y as PopulateSpec, at as SelectSpec, dt as SortSpec } from "../types-
|
|
2
|
-
import { a as createFieldPreset, c as getMongooseProjection, i as configureLogger, l as createError, n as buildCrudSchemasFromMongooseSchema, o as filterResponseData, r as createMemoryCache, s as getFieldsForUser, t as buildCrudSchemasFromModel } from "../mongooseToJsonSchema-
|
|
1
|
+
import { Y as PopulateSpec, at as SelectSpec, dt as SortSpec } from "../types-CYFJa36g.mjs";
|
|
2
|
+
import { a as createFieldPreset, c as getMongooseProjection, i as configureLogger, l as createError, n as buildCrudSchemasFromMongooseSchema, o as filterResponseData, r as createMemoryCache, s as getFieldsForUser, t as buildCrudSchemasFromModel } from "../mongooseToJsonSchema-Bi8hNbj8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/cache-keys.d.ts
|
|
5
5
|
/**
|
package/dist/{validation-chain.plugin-JkipjuOR.d.mts → validation-chain.plugin-BNG3coI0.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as RepositoryContext, K as Plugin, P as Logger, V as OffsetPaginationResult, Y as PopulateSpec, at as SelectSpec, ct as SoftDeleteOptions, dt as SortSpec, f as CascadeOptions, l as CacheOptions, tt as RepositoryInstance, u as CacheStats, vt as ValidationChainOptions, w as FieldPreset, yt as ValidatorDefinition, z as ObjectId } from "./types-
|
|
2
|
-
import mongoose
|
|
1
|
+
import { $ as RepositoryContext, K as Plugin, P as Logger, V as OffsetPaginationResult, Y as PopulateSpec, at as SelectSpec, ct as SoftDeleteOptions, dt as SortSpec, f as CascadeOptions, l as CacheOptions, tt as RepositoryInstance, u as CacheStats, vt as ValidationChainOptions, w as FieldPreset, yt as ValidatorDefinition, z as ObjectId } from "./types-CYFJa36g.mjs";
|
|
2
|
+
import mongoose from "mongoose";
|
|
3
3
|
import { BulkWriteResult } from "@classytic/repo-core/repository";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
|
|
@@ -266,7 +266,7 @@ interface BatchOperationsMethods {
|
|
|
266
266
|
* @returns Update result with matchedCount, modifiedCount, etc.
|
|
267
267
|
*/
|
|
268
268
|
updateMany(query: Record<string, unknown>, data: Record<string, unknown>, options?: {
|
|
269
|
-
session?:
|
|
269
|
+
session?: unknown;
|
|
270
270
|
updatePipeline?: boolean;
|
|
271
271
|
}): Promise<{
|
|
272
272
|
acknowledged: boolean;
|
|
@@ -287,7 +287,7 @@ interface BatchOperationsMethods {
|
|
|
287
287
|
* @returns Delete result with deletedCount
|
|
288
288
|
*/
|
|
289
289
|
deleteMany(query: Record<string, unknown>, options?: {
|
|
290
|
-
session?:
|
|
290
|
+
session?: unknown;
|
|
291
291
|
mode?: 'hard' | 'soft';
|
|
292
292
|
[key: string]: unknown;
|
|
293
293
|
}): Promise<{
|
|
@@ -311,7 +311,7 @@ interface BatchOperationsMethods {
|
|
|
311
311
|
* console.log(result.insertedCount, result.modifiedCount, result.deletedCount);
|
|
312
312
|
*/
|
|
313
313
|
bulkWrite(operations: Record<string, unknown>[], options?: {
|
|
314
|
-
session?:
|
|
314
|
+
session?: unknown;
|
|
315
315
|
ordered?: boolean;
|
|
316
316
|
}): Promise<BulkWriteResult>;
|
|
317
317
|
}
|
|
@@ -928,7 +928,7 @@ interface SoftDeleteMethods<TDoc> {
|
|
|
928
928
|
* @returns Restored document
|
|
929
929
|
*/
|
|
930
930
|
restore(id: string | ObjectId, options?: {
|
|
931
|
-
session?:
|
|
931
|
+
session?: unknown;
|
|
932
932
|
}): Promise<TDoc>;
|
|
933
933
|
/**
|
|
934
934
|
* Get paginated list of soft-deleted documents
|
|
@@ -945,7 +945,7 @@ interface SoftDeleteMethods<TDoc> {
|
|
|
945
945
|
select?: SelectSpec;
|
|
946
946
|
populate?: PopulateSpec;
|
|
947
947
|
lean?: boolean;
|
|
948
|
-
session?:
|
|
948
|
+
session?: unknown;
|
|
949
949
|
}): Promise<OffsetPaginationResult<TDoc>>;
|
|
950
950
|
}
|
|
951
951
|
//#endregion
|
|
@@ -985,12 +985,13 @@ function buildAggPipeline(req) {
|
|
|
985
985
|
//#endregion
|
|
986
986
|
//#region src/actions/aggregate-ir/count.ts
|
|
987
987
|
async function countAggGroups(Model, req, options = {}) {
|
|
988
|
+
const session = options.session;
|
|
988
989
|
const groupCols = normalizeGroupBy(req.groupBy);
|
|
989
990
|
if (req.having) {
|
|
990
991
|
const { pipeline, prePaginationIndex } = buildAggPipeline(req);
|
|
991
992
|
const finalPipeline = [...pipeline.slice(0, prePaginationIndex), { $count: "n" }];
|
|
992
993
|
const aggregation = Model.aggregate(finalPipeline);
|
|
993
|
-
if (
|
|
994
|
+
if (session) aggregation.session(session);
|
|
994
995
|
const [row] = await aggregation.exec();
|
|
995
996
|
return row?.n ?? 0;
|
|
996
997
|
}
|
|
@@ -1001,7 +1002,7 @@ async function countAggGroups(Model, req, options = {}) {
|
|
|
1001
1002
|
pipeline.push({ $limit: 1 });
|
|
1002
1003
|
pipeline.push({ $count: "n" });
|
|
1003
1004
|
const aggregation = Model.aggregate(pipeline);
|
|
1004
|
-
if (
|
|
1005
|
+
if (session) aggregation.session(session);
|
|
1005
1006
|
const [row] = await aggregation.exec();
|
|
1006
1007
|
return row?.n ?? 0;
|
|
1007
1008
|
}
|
|
@@ -1014,16 +1015,17 @@ async function countAggGroups(Model, req, options = {}) {
|
|
|
1014
1015
|
pipeline.push({ $group: { _id: groupId } });
|
|
1015
1016
|
pipeline.push({ $count: "n" });
|
|
1016
1017
|
const aggregation = Model.aggregate(pipeline);
|
|
1017
|
-
if (
|
|
1018
|
+
if (session) aggregation.session(session);
|
|
1018
1019
|
const [row] = await aggregation.exec();
|
|
1019
1020
|
return row?.n ?? 0;
|
|
1020
1021
|
}
|
|
1021
1022
|
//#endregion
|
|
1022
1023
|
//#region src/actions/aggregate-ir/execute.ts
|
|
1023
1024
|
async function executeAgg(Model, req, options = {}) {
|
|
1025
|
+
const session = options.session;
|
|
1024
1026
|
const { pipeline } = buildAggPipeline(req);
|
|
1025
1027
|
const aggregation = Model.aggregate(pipeline);
|
|
1026
|
-
if (
|
|
1028
|
+
if (session) aggregation.session(session);
|
|
1027
1029
|
return await aggregation.exec();
|
|
1028
1030
|
}
|
|
1029
1031
|
//#endregion
|
|
@@ -2712,9 +2714,11 @@ var Repository = class extends RepositoryBase {
|
|
|
2712
2714
|
for (const field of selectSpec) if (field.startsWith("-")) projection[field.substring(1)] = 0;
|
|
2713
2715
|
else projection[field] = 1;
|
|
2714
2716
|
} else projection = { ...selectSpec };
|
|
2715
|
-
if (
|
|
2716
|
-
|
|
2717
|
-
|
|
2717
|
+
if (projection) {
|
|
2718
|
+
if (Object.values(projection).some((v) => v === 1)) for (const lookup of lookups) {
|
|
2719
|
+
const asField = lookup.as || lookup.from;
|
|
2720
|
+
if (!(asField in projection)) projection[asField] = 1;
|
|
2721
|
+
}
|
|
2718
2722
|
}
|
|
2719
2723
|
}
|
|
2720
2724
|
const appendLookupStages = (pipeline) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/mongokit",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"description": "Production-grade MongoDB repositories - smart pagination, events, and plugins. Built on @classytic/repo-core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -110,14 +110,15 @@
|
|
|
110
110
|
"test:watch": "vitest --project unit --project integration",
|
|
111
111
|
"test:coverage": "vitest run --coverage",
|
|
112
112
|
"typecheck": "tsc --noEmit",
|
|
113
|
+
"typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
|
|
113
114
|
"lint": "biome check src/",
|
|
114
115
|
"lint:fix": "biome check src/ --write",
|
|
115
116
|
"format": "biome format src/ --write",
|
|
116
117
|
"check": "biome ci src/ --diagnostic-level=error",
|
|
117
|
-
"prepublishOnly": "npm run check && npm run build && npm run typecheck && npm test",
|
|
118
|
+
"prepublishOnly": "npm run check && npm run build && npm run typecheck && npm run typecheck:tests && npm test",
|
|
118
119
|
"publish:dry": "npm publish --dry-run --access public",
|
|
119
120
|
"publish:npm": "npm publish --access public",
|
|
120
|
-
"release": "npm run check && npm run build && npm run typecheck && npm test && npm publish --access public",
|
|
121
|
+
"release": "npm run check && npm run build && npm run typecheck && npm run typecheck:tests && npm test && npm publish --access public",
|
|
121
122
|
"release:patch": "npm version patch && npm run release",
|
|
122
123
|
"release:minor": "npm version minor && npm run release",
|
|
123
124
|
"release:major": "npm version major && npm run release"
|