@classytic/mongokit 3.2.0 → 3.2.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/dist/actions/index.js +2 -2
- package/dist/chunks/{chunk-VWKIKZYF.js → chunk-5G42WJHC.js} +7 -7
- package/dist/chunks/{chunk-DEVXDBRL.js → chunk-B64F5ZWE.js} +3 -3
- package/dist/chunks/{chunk-I7CWNAJB.js → chunk-GZBKEPVE.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/plugins/index.js +2 -2
- package/package.json +1 -1
package/dist/actions/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { aggregate_exports as aggregate, delete_exports as deleteActions, read_exports as read, update_exports as update } from '../chunks/chunk-
|
|
2
|
-
export { create_exports as create } from '../chunks/chunk-
|
|
1
|
+
export { aggregate_exports as aggregate, delete_exports as deleteActions, read_exports as read, update_exports as update } from '../chunks/chunk-5G42WJHC.js';
|
|
2
|
+
export { create_exports as create } from '../chunks/chunk-GZBKEPVE.js';
|
|
3
3
|
import '../chunks/chunk-URLJFIR7.js';
|
|
4
4
|
import '../chunks/chunk-JWUAVZ3L.js';
|
|
5
5
|
import '../chunks/chunk-WSFCRVEQ.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { create_exports } from './chunk-
|
|
1
|
+
import { create_exports } from './chunk-GZBKEPVE.js';
|
|
2
2
|
import { warn } from './chunk-URLJFIR7.js';
|
|
3
3
|
import { createError } from './chunk-JWUAVZ3L.js';
|
|
4
4
|
import { __export } from './chunk-WSFCRVEQ.js';
|
|
@@ -78,7 +78,7 @@ async function getOrCreate(Model, query, createData, options = {}) {
|
|
|
78
78
|
{ $setOnInsert: createData },
|
|
79
79
|
{
|
|
80
80
|
upsert: true,
|
|
81
|
-
|
|
81
|
+
returnDocument: "after",
|
|
82
82
|
runValidators: true,
|
|
83
83
|
session: options.session,
|
|
84
84
|
...options.updatePipeline !== void 0 ? { updatePipeline: options.updatePipeline } : {}
|
|
@@ -126,7 +126,7 @@ async function update(Model, id, data, options = {}) {
|
|
|
126
126
|
assertUpdatePipelineAllowed(data, options.updatePipeline);
|
|
127
127
|
const query = { _id: id, ...options.query };
|
|
128
128
|
const document = await Model.findOneAndUpdate(query, data, {
|
|
129
|
-
|
|
129
|
+
returnDocument: "after",
|
|
130
130
|
runValidators: true,
|
|
131
131
|
session: options.session,
|
|
132
132
|
...options.updatePipeline !== void 0 ? { updatePipeline: options.updatePipeline } : {}
|
|
@@ -140,7 +140,7 @@ async function updateWithConstraints(Model, id, data, constraints = {}, options
|
|
|
140
140
|
assertUpdatePipelineAllowed(data, options.updatePipeline);
|
|
141
141
|
const query = { _id: id, ...constraints };
|
|
142
142
|
const document = await Model.findOneAndUpdate(query, data, {
|
|
143
|
-
|
|
143
|
+
returnDocument: "after",
|
|
144
144
|
runValidators: true,
|
|
145
145
|
session: options.session,
|
|
146
146
|
...options.updatePipeline !== void 0 ? { updatePipeline: options.updatePipeline } : {}
|
|
@@ -198,7 +198,7 @@ async function updateMany(Model, query, data, options = {}) {
|
|
|
198
198
|
async function updateByQuery(Model, query, data, options = {}) {
|
|
199
199
|
assertUpdatePipelineAllowed(data, options.updatePipeline);
|
|
200
200
|
const document = await Model.findOneAndUpdate(query, data, {
|
|
201
|
-
|
|
201
|
+
returnDocument: "after",
|
|
202
202
|
runValidators: true,
|
|
203
203
|
session: options.session,
|
|
204
204
|
...options.updatePipeline !== void 0 ? { updatePipeline: options.updatePipeline } : {}
|
|
@@ -258,7 +258,7 @@ async function softDelete(Model, id, options = {}) {
|
|
|
258
258
|
deletedAt: /* @__PURE__ */ new Date(),
|
|
259
259
|
deletedBy: options.userId
|
|
260
260
|
},
|
|
261
|
-
{
|
|
261
|
+
{ returnDocument: "after", session: options.session }
|
|
262
262
|
);
|
|
263
263
|
if (!document) {
|
|
264
264
|
throw createError(404, "Document not found");
|
|
@@ -273,7 +273,7 @@ async function restore(Model, id, options = {}) {
|
|
|
273
273
|
deletedAt: null,
|
|
274
274
|
deletedBy: null
|
|
275
275
|
},
|
|
276
|
-
{
|
|
276
|
+
{ returnDocument: "after", session: options.session }
|
|
277
277
|
);
|
|
278
278
|
if (!document) {
|
|
279
279
|
throw createError(404, "Document not found");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { upsert } from './chunk-
|
|
1
|
+
import { upsert } from './chunk-GZBKEPVE.js';
|
|
2
2
|
import { versionKey, byIdKey, byQueryKey, listQueryKey, modelPattern, getFieldsForUser } from './chunk-2ZN65ZOP.js';
|
|
3
3
|
import { warn, debug } from './chunk-URLJFIR7.js';
|
|
4
4
|
import { createError } from './chunk-JWUAVZ3L.js';
|
|
@@ -195,7 +195,7 @@ function softDeletePlugin(options = {}) {
|
|
|
195
195
|
[deletedByField]: null
|
|
196
196
|
};
|
|
197
197
|
const result = await this.Model.findByIdAndUpdate(id, { $set: updateData }, {
|
|
198
|
-
|
|
198
|
+
returnDocument: "after",
|
|
199
199
|
session: restoreOptions.session
|
|
200
200
|
});
|
|
201
201
|
if (!result) {
|
|
@@ -640,7 +640,7 @@ function subdocumentPlugin() {
|
|
|
640
640
|
const query = { _id: parentId, [`${arrayPath}._id`]: subId };
|
|
641
641
|
const update = { $set: { [`${arrayPath}.$`]: { ...updateData, _id: subId } } };
|
|
642
642
|
const result = await Model.findOneAndUpdate(query, update, {
|
|
643
|
-
|
|
643
|
+
returnDocument: "after",
|
|
644
644
|
runValidators: true,
|
|
645
645
|
session: options.session
|
|
646
646
|
}).exec();
|
|
@@ -35,7 +35,7 @@ async function upsert(Model, query, data, options = {}) {
|
|
|
35
35
|
{ $setOnInsert: data },
|
|
36
36
|
{
|
|
37
37
|
upsert: true,
|
|
38
|
-
|
|
38
|
+
returnDocument: "after",
|
|
39
39
|
runValidators: true,
|
|
40
40
|
session: options.session,
|
|
41
41
|
...options.updatePipeline !== void 0 ? { updatePipeline: options.updatePipeline } : {}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LookupBuilder, getById, getByQuery, getOrCreate, count, exists, update, deleteById, aggregate, distinct } from './chunks/chunk-
|
|
2
|
-
export { LookupBuilder, actions_exports as actions } from './chunks/chunk-
|
|
1
|
+
import { LookupBuilder, getById, getByQuery, getOrCreate, count, exists, update, deleteById, aggregate, distinct } from './chunks/chunk-5G42WJHC.js';
|
|
2
|
+
export { LookupBuilder, actions_exports as actions } from './chunks/chunk-5G42WJHC.js';
|
|
3
3
|
import { PaginationEngine } from './chunks/chunk-44KXLGPO.js';
|
|
4
4
|
export { PaginationEngine } from './chunks/chunk-44KXLGPO.js';
|
|
5
|
-
export { aggregateHelpersPlugin, auditLogPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, fieldFilterPlugin, immutableField, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, requireField, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin } from './chunks/chunk-
|
|
6
|
-
import { create, createMany } from './chunks/chunk-
|
|
5
|
+
export { aggregateHelpersPlugin, auditLogPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, fieldFilterPlugin, immutableField, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, requireField, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin } from './chunks/chunk-B64F5ZWE.js';
|
|
6
|
+
import { create, createMany } from './chunks/chunk-GZBKEPVE.js';
|
|
7
7
|
export { buildCrudSchemasFromModel, buildCrudSchemasFromMongooseSchema, createMemoryCache, getImmutableFields, getSystemManagedFields, isFieldUpdateAllowed, validateUpdateBody } from './chunks/chunk-UE2IEXZJ.js';
|
|
8
8
|
export { createFieldPreset, filterResponseData, getFieldsForUser, getMongooseProjection } from './chunks/chunk-2ZN65ZOP.js';
|
|
9
9
|
import { warn } from './chunks/chunk-URLJFIR7.js';
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { aggregateHelpersPlugin, auditLogPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, fieldFilterPlugin, immutableField, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, requireField, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin } from '../chunks/chunk-
|
|
2
|
-
import '../chunks/chunk-
|
|
1
|
+
export { aggregateHelpersPlugin, auditLogPlugin, autoInject, batchOperationsPlugin, blockIf, cachePlugin, cascadePlugin, fieldFilterPlugin, immutableField, methodRegistryPlugin, mongoOperationsPlugin, multiTenantPlugin, observabilityPlugin, requireField, softDeletePlugin, subdocumentPlugin, timestampPlugin, uniqueField, validationChainPlugin } from '../chunks/chunk-B64F5ZWE.js';
|
|
2
|
+
import '../chunks/chunk-GZBKEPVE.js';
|
|
3
3
|
import '../chunks/chunk-2ZN65ZOP.js';
|
|
4
4
|
import '../chunks/chunk-URLJFIR7.js';
|
|
5
5
|
import '../chunks/chunk-JWUAVZ3L.js';
|
package/package.json
CHANGED