@classytic/mongokit 3.4.0 → 3.4.1
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 +4 -4
- package/dist/{PaginationEngine-PLyDhrO7.mjs → PaginationEngine-nY04eGUM.mjs} +33 -242
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.mjs +1 -1
- package/dist/ai/index.d.mts +1 -1
- package/dist/ai/index.mjs +2 -1
- package/dist/cursor-CHToazHy.mjs +250 -0
- package/dist/{index-Df3ernpC.d.mts → index-BuoZIZ15.d.mts} +1 -1
- package/dist/index.d.mts +12 -6
- package/dist/index.mjs +13 -6
- package/dist/{mongooseToJsonSchema-BqgVOlrR.d.mts → mongooseToJsonSchema-RX9YfJLu.d.mts} +1 -1
- package/dist/pagination/PaginationEngine.d.mts +1 -1
- package/dist/pagination/PaginationEngine.mjs +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/sort-C-BJEWUZ.mjs +57 -0
- package/dist/{types-BlCwDszq.d.mts → types-COINbsdL.d.mts} +32 -4
- package/dist/{update-DXwVh6M1.mjs → update-DGKMmBgG.mjs} +42 -35
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +2 -2
- package/dist/{validation-chain.plugin-DxqiHv-E.d.mts → validation-chain.plugin-BNoaKDOm.d.mts} +2 -2
- package/dist/{validation-chain.plugin-Ow6EUIoo.mjs → validation-chain.plugin-da3fOo8A.mjs} +156 -54
- package/package.json +3 -3
- /package/dist/{field-selection-CalOB7yM.mjs → field-selection-reyDRzXf.mjs} +0 -0
- /package/dist/{mongooseToJsonSchema-OmdmnHtx.mjs → mongooseToJsonSchema-B6Qyl8BK.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as warn, i as debug, n as parseDuplicateKeyError, t as createError } from "./error-Bpbi_NKo.mjs";
|
|
2
|
-
import { _ as LookupBuilder, a as getById, d as create, f as createMany, g as distinct, i as exists, l as deleteById, m as upsert, o as getByQuery, r as count, s as getOrCreate, t as update } from "./update-
|
|
3
|
-
import { t as PaginationEngine } from "./PaginationEngine-
|
|
4
|
-
import { a as byIdKey, c as listQueryKey, l as modelPattern, o as byQueryKey, r as getFieldsForUser, u as versionKey } from "./field-selection-
|
|
2
|
+
import { _ as LookupBuilder, a as getById, d as create, f as createMany, g as distinct, i as exists, l as deleteById, m as upsert, o as getByQuery, r as count, s as getOrCreate, t as update } from "./update-DGKMmBgG.mjs";
|
|
3
|
+
import { t as PaginationEngine } from "./PaginationEngine-nY04eGUM.mjs";
|
|
4
|
+
import { a as byIdKey, c as listQueryKey, l as modelPattern, o as byQueryKey, r as getFieldsForUser, u as versionKey } from "./field-selection-reyDRzXf.mjs";
|
|
5
5
|
import mongoose from "mongoose";
|
|
6
6
|
//#region src/plugins/aggregate-helpers.plugin.ts
|
|
7
7
|
/**
|
|
@@ -30,14 +30,14 @@ function aggregateHelpersPlugin() {
|
|
|
30
30
|
count: { $sum: 1 }
|
|
31
31
|
} }, { $sort: { count: -1 } }];
|
|
32
32
|
if (options.limit) pipeline.push({ $limit: options.limit });
|
|
33
|
-
return this.aggregate
|
|
33
|
+
return this.aggregate(pipeline, options);
|
|
34
34
|
});
|
|
35
35
|
const aggregateOperation = async function(field, operator, resultKey, query = {}, options = {}) {
|
|
36
36
|
const pipeline = [{ $match: query }, { $group: {
|
|
37
37
|
_id: null,
|
|
38
38
|
[resultKey]: { [operator]: `$${field}` }
|
|
39
39
|
} }];
|
|
40
|
-
return (await this.aggregate
|
|
40
|
+
return (await this.aggregate(pipeline, options))[0]?.[resultKey] || 0;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Sum field values
|
|
@@ -501,7 +501,7 @@ function batchOperationsPlugin() {
|
|
|
501
501
|
* Update multiple documents
|
|
502
502
|
*/
|
|
503
503
|
repo.registerMethod("updateMany", async function(query, data, options = {}) {
|
|
504
|
-
const context = await this._buildContext
|
|
504
|
+
const context = await this._buildContext("updateMany", {
|
|
505
505
|
query,
|
|
506
506
|
data,
|
|
507
507
|
...options
|
|
@@ -526,7 +526,7 @@ function batchOperationsPlugin() {
|
|
|
526
526
|
context,
|
|
527
527
|
error
|
|
528
528
|
});
|
|
529
|
-
throw this._handleError
|
|
529
|
+
throw this._handleError(error);
|
|
530
530
|
}
|
|
531
531
|
});
|
|
532
532
|
/**
|
|
@@ -544,7 +544,7 @@ function batchOperationsPlugin() {
|
|
|
544
544
|
* ]);
|
|
545
545
|
*/
|
|
546
546
|
repo.registerMethod("bulkWrite", async function(operations, options = {}) {
|
|
547
|
-
const context = await this._buildContext
|
|
547
|
+
const context = await this._buildContext("bulkWrite", {
|
|
548
548
|
operations,
|
|
549
549
|
...options
|
|
550
550
|
});
|
|
@@ -575,14 +575,14 @@ function batchOperationsPlugin() {
|
|
|
575
575
|
context,
|
|
576
576
|
error
|
|
577
577
|
});
|
|
578
|
-
throw this._handleError
|
|
578
|
+
throw this._handleError(error);
|
|
579
579
|
}
|
|
580
580
|
});
|
|
581
581
|
/**
|
|
582
582
|
* Delete multiple documents
|
|
583
583
|
*/
|
|
584
584
|
repo.registerMethod("deleteMany", async function(query, options = {}) {
|
|
585
|
-
const context = await this._buildContext
|
|
585
|
+
const context = await this._buildContext("deleteMany", {
|
|
586
586
|
query,
|
|
587
587
|
...options
|
|
588
588
|
});
|
|
@@ -611,7 +611,7 @@ function batchOperationsPlugin() {
|
|
|
611
611
|
context,
|
|
612
612
|
error
|
|
613
613
|
});
|
|
614
|
-
throw this._handleError
|
|
614
|
+
throw this._handleError(error);
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
617
|
}
|
|
@@ -1105,6 +1105,13 @@ var AggregationBuilder = class AggregationBuilder {
|
|
|
1105
1105
|
};
|
|
1106
1106
|
//#endregion
|
|
1107
1107
|
//#region src/Repository.ts
|
|
1108
|
+
function ensureLookupProjectionIncludesCursorFields(projection, sort) {
|
|
1109
|
+
if (!projection || !sort) return projection;
|
|
1110
|
+
if (!Object.values(projection).some((value) => value === 1)) return projection;
|
|
1111
|
+
const nextProjection = { ...projection };
|
|
1112
|
+
for (const field of [...Object.keys(sort), "_id"]) nextProjection[field] = 1;
|
|
1113
|
+
return nextProjection;
|
|
1114
|
+
}
|
|
1108
1115
|
/**
|
|
1109
1116
|
* Plugin phase priorities (lower = runs first)
|
|
1110
1117
|
* Policy hooks (multi-tenant, soft-delete, validation) MUST run before cache
|
|
@@ -1156,7 +1163,7 @@ var Repository = class {
|
|
|
1156
1163
|
*/
|
|
1157
1164
|
on(event, listener, options) {
|
|
1158
1165
|
if (!this._hooks.has(event)) this._hooks.set(event, []);
|
|
1159
|
-
const hooks = this._hooks.get(event);
|
|
1166
|
+
const hooks = this._hooks.get(event) ?? [];
|
|
1160
1167
|
const priority = options?.priority ?? HOOK_PRIORITY.DEFAULT;
|
|
1161
1168
|
hooks.push({
|
|
1162
1169
|
listener,
|
|
@@ -1413,32 +1420,49 @@ var Repository = class {
|
|
|
1413
1420
|
session: options.session,
|
|
1414
1421
|
hint: context.hint ?? params.hint,
|
|
1415
1422
|
maxTimeMS: context.maxTimeMS ?? params.maxTimeMS,
|
|
1416
|
-
readPreference: context.readPreference ?? options.readPreference ?? params.readPreference
|
|
1423
|
+
readPreference: context.readPreference ?? options.readPreference ?? params.readPreference,
|
|
1424
|
+
collation: context.collation ?? params.collation
|
|
1417
1425
|
};
|
|
1418
|
-
const lookups = params.lookups;
|
|
1426
|
+
const lookups = context.lookups ?? params.lookups;
|
|
1419
1427
|
if (lookups && lookups.length > 0) try {
|
|
1420
1428
|
const lookupResult = await this.lookupPopulate({
|
|
1421
1429
|
filters: query,
|
|
1422
1430
|
lookups,
|
|
1423
1431
|
sort: paginationOptions.sort,
|
|
1424
|
-
page: page || 1,
|
|
1432
|
+
page: useKeyset ? void 0 : page || 1,
|
|
1433
|
+
after: useKeyset ? after : void 0,
|
|
1425
1434
|
limit,
|
|
1426
1435
|
select: paginationOptions.select,
|
|
1427
1436
|
session: options.session,
|
|
1428
|
-
readPreference: paginationOptions.readPreference
|
|
1437
|
+
readPreference: paginationOptions.readPreference,
|
|
1438
|
+
collation: paginationOptions.collation,
|
|
1439
|
+
countStrategy: context.countStrategy ?? params.countStrategy
|
|
1429
1440
|
});
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
method: "offset",
|
|
1441
|
+
let result;
|
|
1442
|
+
if (lookupResult.next !== void 0) result = {
|
|
1443
|
+
method: "keyset",
|
|
1434
1444
|
docs: lookupResult.data,
|
|
1435
|
-
page: currentPage,
|
|
1436
1445
|
limit: lookupResult.limit ?? limit,
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
hasNext: currentPage < totalPages,
|
|
1440
|
-
hasPrev: currentPage > 1
|
|
1446
|
+
hasMore: lookupResult.hasMore ?? false,
|
|
1447
|
+
next: lookupResult.next ?? null
|
|
1441
1448
|
};
|
|
1449
|
+
else {
|
|
1450
|
+
const total = lookupResult.total ?? 0;
|
|
1451
|
+
const resultLimit = lookupResult.limit ?? limit;
|
|
1452
|
+
const totalPages = Math.ceil(total / resultLimit);
|
|
1453
|
+
const currentPage = lookupResult.page ?? 1;
|
|
1454
|
+
const hasNext = lookupResult.hasMore !== void 0 ? lookupResult.hasMore : currentPage < totalPages;
|
|
1455
|
+
result = {
|
|
1456
|
+
method: "offset",
|
|
1457
|
+
docs: lookupResult.data,
|
|
1458
|
+
page: currentPage,
|
|
1459
|
+
limit: resultLimit,
|
|
1460
|
+
total,
|
|
1461
|
+
pages: totalPages,
|
|
1462
|
+
hasNext,
|
|
1463
|
+
hasPrev: currentPage > 1
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1442
1466
|
await this._emitHook("after:getAll", {
|
|
1443
1467
|
context,
|
|
1444
1468
|
result
|
|
@@ -1741,42 +1765,120 @@ var Repository = class {
|
|
|
1741
1765
|
async lookupPopulate(options) {
|
|
1742
1766
|
const context = await this._buildContext("lookupPopulate", options);
|
|
1743
1767
|
try {
|
|
1744
|
-
const
|
|
1768
|
+
const MAX_LOOKUPS = 10;
|
|
1769
|
+
const lookups = context.lookups ?? options.lookups;
|
|
1770
|
+
if (lookups.length > MAX_LOOKUPS) throw createError(400, `Too many lookups (${lookups.length}). Maximum is ${MAX_LOOKUPS}.`);
|
|
1745
1771
|
const filters = context.filters ?? options.filters;
|
|
1746
|
-
if (filters && Object.keys(filters).length > 0) builder.match(filters);
|
|
1747
|
-
builder.multiLookup(options.lookups);
|
|
1748
1772
|
const sort = context.sort ?? options.sort;
|
|
1749
|
-
if (sort) builder.sort(this._parseSort(sort));
|
|
1750
|
-
const page = context.page ?? options.page ?? 1;
|
|
1751
1773
|
const limit = context.limit ?? options.limit ?? this._pagination.config.defaultLimit ?? 20;
|
|
1752
|
-
const
|
|
1753
|
-
const
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
const
|
|
1774
|
+
const readPref = context.readPreference ?? options.readPreference;
|
|
1775
|
+
const session = context.session ?? options.session;
|
|
1776
|
+
const collation = context.collation ?? options.collation;
|
|
1777
|
+
const after = context.after ?? options.after;
|
|
1778
|
+
const pageFromContext = context.page ?? options.page;
|
|
1779
|
+
const isKeyset = !!after || !pageFromContext && !!sort;
|
|
1780
|
+
const countStrategy = context.countStrategy ?? options.countStrategy ?? "exact";
|
|
1758
1781
|
const selectSpec = context.select ?? options.select;
|
|
1782
|
+
let projection;
|
|
1759
1783
|
if (selectSpec) {
|
|
1760
|
-
let projection;
|
|
1761
1784
|
if (typeof selectSpec === "string") {
|
|
1762
1785
|
projection = {};
|
|
1763
|
-
const
|
|
1764
|
-
for (const field of fields) if (field.startsWith("-")) projection[field.substring(1)] = 0;
|
|
1786
|
+
for (const field of selectSpec.split(",").map((f) => f.trim())) if (field.startsWith("-")) projection[field.substring(1)] = 0;
|
|
1765
1787
|
else projection[field] = 1;
|
|
1766
1788
|
} else if (Array.isArray(selectSpec)) {
|
|
1767
1789
|
projection = {};
|
|
1768
1790
|
for (const field of selectSpec) if (field.startsWith("-")) projection[field.substring(1)] = 0;
|
|
1769
1791
|
else projection[field] = 1;
|
|
1770
|
-
} else projection = selectSpec;
|
|
1771
|
-
|
|
1792
|
+
} else projection = { ...selectSpec };
|
|
1793
|
+
if (Object.values(projection).some((v) => v === 1)) for (const lookup of lookups) {
|
|
1794
|
+
const asField = lookup.as || lookup.from;
|
|
1795
|
+
if (!(asField in projection)) projection[asField] = 1;
|
|
1796
|
+
}
|
|
1772
1797
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1798
|
+
const appendLookupStages = (pipeline) => {
|
|
1799
|
+
pipeline.push(...LookupBuilder.multiple(lookups));
|
|
1800
|
+
for (const lookup of lookups) if (lookup.single) {
|
|
1801
|
+
const asField = lookup.as || lookup.from;
|
|
1802
|
+
pipeline.push({ $addFields: { [asField]: { $ifNull: [`$${asField}`, null] } } });
|
|
1803
|
+
}
|
|
1804
|
+
const finalProjection = ensureLookupProjectionIncludesCursorFields(projection, isKeyset && sort ? this._parseSort(sort) : void 0);
|
|
1805
|
+
if (finalProjection) pipeline.push({ $project: finalProjection });
|
|
1806
|
+
};
|
|
1807
|
+
if (isKeyset && sort) {
|
|
1808
|
+
const parsedSort = this._parseSort(sort);
|
|
1809
|
+
const { validateKeysetSort } = await import("./sort-C-BJEWUZ.mjs").then((n) => n.n);
|
|
1810
|
+
const { encodeCursor, resolveCursorFilter } = await import("./cursor-CHToazHy.mjs").then((n) => n.t);
|
|
1811
|
+
const { getPrimaryField } = await import("./sort-C-BJEWUZ.mjs").then((n) => n.n);
|
|
1812
|
+
const normalizedSort = validateKeysetSort(parsedSort);
|
|
1813
|
+
const cursorVersion = this._pagination.config.cursorVersion ?? 1;
|
|
1814
|
+
const matchFilters = after ? resolveCursorFilter(after, normalizedSort, cursorVersion, { ...filters || {} }) : { ...filters || {} };
|
|
1815
|
+
if (projection) {
|
|
1816
|
+
if (Object.values(projection).some((v) => v === 1)) {
|
|
1817
|
+
for (const sortField of Object.keys(normalizedSort)) if (!(sortField in projection)) projection[sortField] = 1;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
const pipeline = [];
|
|
1821
|
+
if (Object.keys(matchFilters).length > 0) pipeline.push({ $match: matchFilters });
|
|
1822
|
+
pipeline.push({ $sort: normalizedSort });
|
|
1823
|
+
pipeline.push({ $limit: limit + 1 });
|
|
1824
|
+
appendLookupStages(pipeline);
|
|
1825
|
+
const aggregation = this.Model.aggregate(pipeline).session(session || null);
|
|
1826
|
+
if (collation) aggregation.collation(collation);
|
|
1827
|
+
if (readPref) aggregation.read(readPref);
|
|
1828
|
+
const docs = await aggregation;
|
|
1829
|
+
const hasMore = docs.length > limit;
|
|
1830
|
+
if (hasMore) docs.pop();
|
|
1831
|
+
const primaryField = getPrimaryField(normalizedSort);
|
|
1832
|
+
const nextCursor = hasMore && docs.length > 0 ? encodeCursor(docs[docs.length - 1], primaryField, normalizedSort, cursorVersion) : null;
|
|
1833
|
+
await this._emitHook("after:lookupPopulate", {
|
|
1834
|
+
context,
|
|
1835
|
+
result: docs
|
|
1836
|
+
});
|
|
1837
|
+
return {
|
|
1838
|
+
data: docs,
|
|
1839
|
+
limit,
|
|
1840
|
+
next: nextCursor,
|
|
1841
|
+
hasMore
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
const page = pageFromContext ?? 1;
|
|
1845
|
+
const skip = (page - 1) * limit;
|
|
1846
|
+
if (skip > 1e4) warn(`[mongokit] Large offset (${skip}) in lookupPopulate. Consider using keyset pagination: getAll({ sort, after, limit, lookups })`);
|
|
1847
|
+
const dataPipeline = [];
|
|
1848
|
+
if (filters && Object.keys(filters).length > 0) dataPipeline.push({ $match: filters });
|
|
1849
|
+
if (sort) dataPipeline.push({ $sort: this._parseSort(sort) });
|
|
1850
|
+
if (countStrategy === "none") {
|
|
1851
|
+
dataPipeline.push({ $skip: skip }, { $limit: limit + 1 });
|
|
1852
|
+
appendLookupStages(dataPipeline);
|
|
1853
|
+
const aggregation = this.Model.aggregate(dataPipeline).session(session || null);
|
|
1854
|
+
if (collation) aggregation.collation(collation);
|
|
1855
|
+
if (readPref) aggregation.read(readPref);
|
|
1856
|
+
const docs = await aggregation;
|
|
1857
|
+
const hasNext = docs.length > limit;
|
|
1858
|
+
if (hasNext) docs.pop();
|
|
1859
|
+
await this._emitHook("after:lookupPopulate", {
|
|
1860
|
+
context,
|
|
1861
|
+
result: docs
|
|
1862
|
+
});
|
|
1863
|
+
return {
|
|
1864
|
+
data: docs,
|
|
1865
|
+
total: 0,
|
|
1866
|
+
page,
|
|
1867
|
+
limit,
|
|
1868
|
+
hasMore: hasNext
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
dataPipeline.push({ $skip: skip }, { $limit: limit });
|
|
1872
|
+
appendLookupStages(dataPipeline);
|
|
1873
|
+
const countPipeline = [];
|
|
1874
|
+
if (filters && Object.keys(filters).length > 0) countPipeline.push({ $match: filters });
|
|
1875
|
+
countPipeline.push({ $count: "total" });
|
|
1876
|
+
const pipeline = [{ $facet: {
|
|
1877
|
+
metadata: countPipeline,
|
|
1878
|
+
data: dataPipeline
|
|
1879
|
+
} }];
|
|
1880
|
+
const aggregation = this.Model.aggregate(pipeline).session(session || null);
|
|
1881
|
+
if (collation) aggregation.collation(collation);
|
|
1780
1882
|
if (readPref) aggregation.read(readPref);
|
|
1781
1883
|
const result = (await aggregation)[0] || {
|
|
1782
1884
|
metadata: [],
|
|
@@ -3569,7 +3671,7 @@ function softDeletePlugin(options = {}) {
|
|
|
3569
3671
|
}, { priority: HOOK_PRIORITY.POLICY });
|
|
3570
3672
|
if (addRestoreMethod) {
|
|
3571
3673
|
const restoreMethod = async function(id, restoreOptions = {}) {
|
|
3572
|
-
const context = await this._buildContext
|
|
3674
|
+
const context = await this._buildContext("restore", {
|
|
3573
3675
|
id,
|
|
3574
3676
|
...restoreOptions
|
|
3575
3677
|
});
|
|
@@ -3602,7 +3704,7 @@ function softDeletePlugin(options = {}) {
|
|
|
3602
3704
|
}
|
|
3603
3705
|
if (addGetDeletedMethod) {
|
|
3604
3706
|
const getDeletedMethod = async function(params = {}, getDeletedOptions = {}) {
|
|
3605
|
-
const context = await this._buildContext
|
|
3707
|
+
const context = await this._buildContext("getDeleted", {
|
|
3606
3708
|
...params,
|
|
3607
3709
|
...getDeletedOptions
|
|
3608
3710
|
});
|
|
@@ -3676,13 +3778,13 @@ function subdocumentPlugin() {
|
|
|
3676
3778
|
* Add subdocument to array
|
|
3677
3779
|
*/
|
|
3678
3780
|
repo.registerMethod("addSubdocument", async function(parentId, arrayPath, subData, options = {}) {
|
|
3679
|
-
return this.update
|
|
3781
|
+
return this.update(parentId, { $push: { [arrayPath]: subData } }, options);
|
|
3680
3782
|
});
|
|
3681
3783
|
/**
|
|
3682
3784
|
* Get subdocument from array
|
|
3683
3785
|
*/
|
|
3684
3786
|
repo.registerMethod("getSubdocument", async function(parentId, arrayPath, subId, options = {}) {
|
|
3685
|
-
return this._executeQuery
|
|
3787
|
+
return this._executeQuery(async (Model) => {
|
|
3686
3788
|
const parent = await Model.findById(parentId).session(options.session).exec();
|
|
3687
3789
|
if (!parent) throw createError(404, "Parent not found");
|
|
3688
3790
|
const arrayField = parent[arrayPath];
|
|
@@ -3696,7 +3798,7 @@ function subdocumentPlugin() {
|
|
|
3696
3798
|
* Update subdocument in array
|
|
3697
3799
|
*/
|
|
3698
3800
|
repo.registerMethod("updateSubdocument", async function(parentId, arrayPath, subId, updateData, options = {}) {
|
|
3699
|
-
return this._executeQuery
|
|
3801
|
+
return this._executeQuery(async (Model) => {
|
|
3700
3802
|
const query = {
|
|
3701
3803
|
_id: parentId,
|
|
3702
3804
|
[`${arrayPath}._id`]: subId
|
|
@@ -3718,7 +3820,7 @@ function subdocumentPlugin() {
|
|
|
3718
3820
|
* Delete subdocument from array
|
|
3719
3821
|
*/
|
|
3720
3822
|
repo.registerMethod("deleteSubdocument", async function(parentId, arrayPath, subId, options = {}) {
|
|
3721
|
-
return this.update
|
|
3823
|
+
return this.update(parentId, { $pull: { [arrayPath]: { _id: subId } } }, options);
|
|
3722
3824
|
});
|
|
3723
3825
|
}
|
|
3724
3826
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/mongokit",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Production-grade MongoDB repositories with zero dependencies - smart pagination, events, and plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"mongoose": "^9.0.0"
|
|
85
85
|
},
|
|
86
86
|
"engines": {
|
|
87
|
-
"node": ">=
|
|
87
|
+
"node": ">=22"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "tsdown",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"lint": "biome check src/",
|
|
97
97
|
"lint:fix": "biome check src/ --write",
|
|
98
98
|
"format": "biome format src/ --write",
|
|
99
|
-
"check": "biome ci src/",
|
|
99
|
+
"check": "biome ci src/ --diagnostic-level=error",
|
|
100
100
|
"prepublishOnly": "npm run check && npm run build && npm run typecheck && npm test",
|
|
101
101
|
"publish:dry": "npm publish --dry-run --access public",
|
|
102
102
|
"publish:npm": "npm publish --access public",
|
|
File without changes
|
|
File without changes
|