ts-patch-mongoose 3.0.0 → 3.1.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.
package/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.4.7/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.4.9/schema.json",
3
3
  "vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4
4
  "files": {
5
5
  "ignoreUnknown": false,
@@ -27,10 +27,7 @@
27
27
  "linter": {
28
28
  "enabled": true,
29
29
  "rules": {
30
- "recommended": true,
31
- "correctness": {
32
- "noUnusedVariables": "off"
33
- }
30
+ "recommended": true
34
31
  }
35
32
  },
36
33
  "javascript": {
package/dist/index.cjs CHANGED
@@ -140,6 +140,12 @@ const cloneImmutable = (value) => {
140
140
  cloned.lastIndex = re.lastIndex;
141
141
  return cloned;
142
142
  }
143
+ case "[object Error]": {
144
+ const err = value;
145
+ const cloned = new err.constructor(err.message);
146
+ if (err.stack) cloned.stack = err.stack;
147
+ return cloned;
148
+ }
143
149
  case "[object ArrayBuffer]":
144
150
  return cloneArrayBuffer(value);
145
151
  case "[object DataView]": {
@@ -188,7 +194,11 @@ const cloneDeep = (value, seen = /* @__PURE__ */ new WeakMap()) => {
188
194
  if (seen.has(value)) return seen.get(value);
189
195
  const immutable = cloneImmutable(value);
190
196
  if (immutable !== void 0) return immutable;
191
- if ("toJSON" in value && typeof value.toJSON === "function") {
197
+ const record = value;
198
+ if (typeof record._bsontype === "string" && typeof record.toHexString === "function") {
199
+ return new value.constructor(record.toHexString());
200
+ }
201
+ if (typeof record.toJSON === "function") {
192
202
  return JSON.parse(JSON.stringify(value));
193
203
  }
194
204
  return cloneCollection(value, seen);
@@ -207,7 +217,7 @@ const toObjectOptions = {
207
217
  depopulate: true,
208
218
  virtuals: false
209
219
  };
210
- const setPatchHistoryTTL = async (ttl) => {
220
+ const setPatchHistoryTTL = async (ttl, onError) => {
211
221
  const name = "createdAt_1_TTL";
212
222
  try {
213
223
  const indexes = await HistoryModel.collection.indexes();
@@ -230,7 +240,8 @@ const setPatchHistoryTTL = async (ttl) => {
230
240
  }
231
241
  await HistoryModel.collection.createIndex({ createdAt: 1 }, { expireAfterSeconds, name });
232
242
  } catch (err) {
233
- console.error("Couldn't create or update index for history collection", err);
243
+ const handler = onError ?? console.error;
244
+ handler(err);
234
245
  }
235
246
  };
236
247
 
@@ -246,113 +257,65 @@ const isPlainObject = (val) => {
246
257
  const isUnsafeKey = (key) => {
247
258
  return key === "__proto__" || key === "constructor" || key === "prototype";
248
259
  };
249
- const getValue$1 = (obj, path) => {
250
- const segs = path.split(".");
251
- let current = obj;
252
- for (const seg of segs) {
253
- if (current == null || typeof current !== "object") return void 0;
254
- current = current[seg];
255
- }
256
- return current;
257
- };
258
- const hasValue = (val) => {
259
- if (val == null) return false;
260
- if (typeof val === "boolean" || typeof val === "number" || typeof val === "function") return true;
261
- if (typeof val === "string") return val.length !== 0;
262
- if (Array.isArray(val)) return val.length !== 0;
263
- if (val instanceof RegExp) return val.source !== "(?:)" && val.source !== "";
264
- if (val instanceof Error) return val.message !== "";
265
- if (val instanceof Map || val instanceof Set) return val.size !== 0;
266
- if (typeof val === "object") {
267
- for (const key of Object.keys(val)) {
268
- if (hasValue(val[key])) return true;
269
- }
270
- return false;
271
- }
272
- return true;
273
- };
274
- const has = (obj, path) => {
275
- if (obj != null && typeof obj === "object" && typeof path === "string") {
276
- return hasValue(getValue$1(obj, path));
277
- }
278
- return false;
279
- };
280
- const unset = (obj, prop) => {
281
- if (typeof obj !== "object" || obj === null) return false;
282
- if (Object.hasOwn(obj, prop)) {
283
- delete obj[prop];
284
- return true;
285
- }
286
- if (has(obj, prop)) {
287
- const segs = prop.split(".");
288
- let last = segs.pop();
289
- while (segs.length && segs.at(-1)?.slice(-1) === "\\") {
290
- last = `${segs.pop().slice(0, -1)}.${last}`;
291
- }
292
- let target = obj;
293
- while (segs.length) {
294
- const seg = segs.shift();
295
- if (isUnsafeKey(seg)) return false;
296
- target = target[seg];
260
+ const classifyKeys = (omitKeys) => {
261
+ const topLevel = /* @__PURE__ */ new Set();
262
+ const nested = /* @__PURE__ */ new Map();
263
+ for (const key of omitKeys) {
264
+ const dotIdx = key.indexOf(".");
265
+ if (dotIdx === -1) {
266
+ topLevel.add(key);
267
+ } else {
268
+ const head = key.slice(0, dotIdx);
269
+ const tail = key.slice(dotIdx + 1);
270
+ if (!isUnsafeKey(head)) {
271
+ const existing = nested.get(head) ?? [];
272
+ existing.push(tail);
273
+ nested.set(head, existing);
274
+ }
297
275
  }
298
- return delete target[last ?? ""];
299
276
  }
300
- return true;
277
+ return { topLevel, nested };
301
278
  };
302
279
  const omitDeep = (value, keys) => {
303
280
  if (value === void 0) return {};
304
281
  if (Array.isArray(value)) {
305
- for (let i = 0; i < value.length; i++) {
306
- value[i] = omitDeep(value[i], keys);
307
- }
308
- return value;
282
+ return value.map((item) => omitDeep(item, keys));
309
283
  }
310
284
  if (!isPlainObject(value)) return value;
311
285
  const omitKeys = typeof keys === "string" ? [keys] : keys;
312
286
  if (!Array.isArray(omitKeys)) return value;
313
- for (const key of omitKeys) {
314
- unset(value, key);
315
- }
287
+ const { topLevel, nested } = classifyKeys(omitKeys);
288
+ const result = {};
316
289
  for (const key of Object.keys(value)) {
317
- value[key] = omitDeep(value[key], omitKeys);
290
+ if (topLevel.has(key)) continue;
291
+ const nestedKeys = nested.get(key);
292
+ result[key] = omitDeep(value[key], nestedKeys ?? omitKeys);
318
293
  }
319
- return value;
294
+ return result;
320
295
  };
321
296
 
322
297
  const isPatchHistoryEnabled = (opts, context) => {
323
298
  return !opts.patchHistoryDisabled && !context.ignorePatchHistory;
324
299
  };
300
+ const applyOmit = (object, opts) => {
301
+ return opts.omit ? omitDeep(object, opts.omit) : object;
302
+ };
303
+ const replacer = (_key, value) => typeof value === "bigint" ? value.toString() : value;
325
304
  const getJsonOmit = (opts, doc) => {
326
- const object = JSON.parse(JSON.stringify(doc));
327
- if (opts.omit) {
328
- return omitDeep(object, opts.omit);
329
- }
330
- return object;
305
+ return applyOmit(JSON.parse(JSON.stringify(doc, replacer)), opts);
331
306
  };
332
307
  const getObjectOmit = (opts, doc) => {
333
- if (opts.omit) {
334
- return omitDeep(isFunction(doc?.toObject) ? doc.toObject() : doc, opts.omit);
335
- }
336
- return doc;
337
- };
338
- const getUser = async (opts, doc) => {
339
- if (isFunction(opts.getUser)) {
340
- return await opts.getUser(doc);
341
- }
342
- return void 0;
343
- };
344
- const getReason = async (opts, doc) => {
345
- if (isFunction(opts.getReason)) {
346
- return await opts.getReason(doc);
347
- }
348
- return void 0;
308
+ return applyOmit(isFunction(doc?.toObject) ? doc.toObject() : doc, opts);
349
309
  };
350
- const getMetadata = async (opts, doc) => {
351
- if (isFunction(opts.getMetadata)) {
352
- return await opts.getMetadata(doc);
310
+ const getOptionalField = async (fn, doc) => {
311
+ if (isFunction(fn)) {
312
+ return await fn(doc);
353
313
  }
354
314
  return void 0;
355
315
  };
316
+ const getUser = async (opts, doc) => getOptionalField(opts.getUser, doc);
317
+ const getReason = async (opts, doc) => getOptionalField(opts.getReason, doc);
318
+ const getMetadata = async (opts, doc) => getOptionalField(opts.getMetadata, doc);
356
319
  const getValue = (item) => {
357
320
  return item.status === "fulfilled" ? item.value : void 0;
358
321
  };
@@ -363,7 +326,10 @@ const getData = async (opts, doc) => {
363
326
  };
364
327
  const emitEvent = (context, event, data) => {
365
328
  if (event && !context.ignoreEvent) {
366
- em.emit(event, data);
329
+ try {
330
+ em.emit(event, data);
331
+ } catch {
332
+ }
367
333
  }
368
334
  };
369
335
  const bulkPatch = async (opts, context, eventKey, docsKey) => {
@@ -376,7 +342,8 @@ const bulkPatch = async (opts, context, eventKey, docsKey) => {
376
342
  for (const batch of chunks) {
377
343
  const bulk = [];
378
344
  for (const doc of batch) {
379
- emitEvent(context, event, { [key]: doc });
345
+ const omitted = getObjectOmit(opts, doc);
346
+ emitEvent(context, event, { [key]: omitted });
380
347
  if (history) {
381
348
  const [user, reason, metadata] = await getData(opts, doc);
382
349
  bulk.push({
@@ -386,7 +353,7 @@ const bulkPatch = async (opts, context, eventKey, docsKey) => {
386
353
  modelName: context.modelName,
387
354
  collectionName: context.collectionName,
388
355
  collectionId: doc._id,
389
- doc: getObjectOmit(opts, doc),
356
+ doc: omitted,
390
357
  version: 0,
391
358
  ...user !== void 0 && { user },
392
359
  ...reason !== void 0 && { reason },
@@ -397,8 +364,9 @@ const bulkPatch = async (opts, context, eventKey, docsKey) => {
397
364
  }
398
365
  }
399
366
  if (history && !isEmpty(bulk)) {
367
+ const onError = opts.onError ?? console.error;
400
368
  await HistoryModel.bulkWrite(bulk, { ordered: false }).catch((error) => {
401
- console.error(error.message);
369
+ onError(error);
402
370
  });
403
371
  }
404
372
  }
@@ -421,6 +389,7 @@ const updatePatch = async (opts, context, current, original) => {
421
389
  version = lastHistory.version + 1;
422
390
  }
423
391
  const [user, reason, metadata] = await getData(opts, current);
392
+ const onError = opts.onError ?? console.error;
424
393
  await HistoryModel.create({
425
394
  op: context.op,
426
395
  modelName: context.modelName,
@@ -431,6 +400,8 @@ const updatePatch = async (opts, context, current, original) => {
431
400
  ...user !== void 0 && { user },
432
401
  ...reason !== void 0 && { reason },
433
402
  ...metadata !== void 0 && { metadata }
403
+ }).catch((error) => {
404
+ onError(error);
434
405
  });
435
406
  }
436
407
  };
@@ -447,8 +418,8 @@ const deleteHooksInitialize = (schema, opts) => {
447
418
  const filter = this.getFilter();
448
419
  this._context = {
449
420
  op: this.op,
450
- modelName: opts.modelName ?? this.model.modelName,
451
- collectionName: opts.collectionName ?? this.model.collection.collectionName,
421
+ modelName: opts.modelName ?? model.modelName,
422
+ collectionName: opts.collectionName ?? model.collection.collectionName,
452
423
  ignoreEvent: options.ignoreEvent,
453
424
  ignorePatchHistory: options.ignorePatchHistory
454
425
  };
@@ -464,12 +435,13 @@ const deleteHooksInitialize = (schema, opts) => {
464
435
  }
465
436
  }
466
437
  if (opts.preDelete && isArray(this._context.deletedDocs) && !isEmpty(this._context.deletedDocs)) {
467
- await opts.preDelete(this._context.deletedDocs);
438
+ await opts.preDelete(cloneDeep(this._context.deletedDocs));
468
439
  }
469
440
  });
470
441
  schema.post(deleteMethods, { document: false, query: true }, async function() {
471
442
  const options = this.getOptions();
472
443
  if (isHookIgnored(options)) return;
444
+ if (!this._context) return;
473
445
  await deletePatch(opts, this._context);
474
446
  });
475
447
  };
@@ -497,15 +469,42 @@ const saveHooksInitialize = (schema, opts) => {
497
469
  };
498
470
 
499
471
  const updateMethods = ["update", "updateOne", "replaceOne", "updateMany", "findOneAndUpdate", "findOneAndReplace", "findByIdAndUpdate"];
472
+ const trackChangedFields = (fields, updated, changed) => {
473
+ if (!fields) return;
474
+ for (const key of Object.keys(fields)) {
475
+ const root = key.split(".")[0];
476
+ changed.set(root, updated[root]);
477
+ }
478
+ };
479
+ const applyPullAll = (updated, fields, changed) => {
480
+ for (const [field, values] of Object.entries(fields)) {
481
+ const arr = updated[field];
482
+ if (Array.isArray(arr)) {
483
+ const filtered = arr.filter((item) => !values.some((v) => JSON.stringify(v) === JSON.stringify(item)));
484
+ updated[field] = filtered;
485
+ changed.set(field, filtered);
486
+ }
487
+ }
488
+ };
500
489
  const assignUpdate = (document, update, commands) => {
501
490
  let updated = powerAssign.assign(document.toObject(toObjectOptions), update);
491
+ const changedByCommand = /* @__PURE__ */ new Map();
502
492
  for (const command of commands) {
493
+ const op = Object.keys(command)[0];
494
+ const fields = command[op];
503
495
  try {
504
496
  updated = powerAssign.assign(updated, command);
497
+ trackChangedFields(fields, updated, changedByCommand);
505
498
  } catch {
499
+ if (op === "$pullAll" && fields) {
500
+ applyPullAll(updated, fields, changedByCommand);
501
+ }
506
502
  }
507
503
  }
508
504
  const doc = document.set(updated).toObject(toObjectOptions);
505
+ for (const [field, value] of changedByCommand) {
506
+ doc[field] = value;
507
+ }
509
508
  if (update.createdAt) doc.createdAt = update.createdAt;
510
509
  return doc;
511
510
  };
@@ -525,17 +524,16 @@ const splitUpdateAndCommands = (updateQuery) => {
525
524
  return { update, commands };
526
525
  };
527
526
  const updateHooksInitialize = (schema, opts) => {
528
- schema.pre(updateMethods, async function() {
527
+ schema.pre(updateMethods, { document: false, query: true }, async function() {
529
528
  const options = this.getOptions();
530
529
  if (isHookIgnored(options)) return;
531
530
  const model = this.model;
532
531
  const filter = this.getFilter();
533
- const count = await this.model.countDocuments(filter).exec();
534
532
  this._context = {
535
533
  op: this.op,
536
- modelName: opts.modelName ?? this.model.modelName,
537
- collectionName: opts.collectionName ?? this.model.collection.collectionName,
538
- isNew: Boolean(options.upsert) && count === 0,
534
+ modelName: opts.modelName ?? model.modelName,
535
+ collectionName: opts.collectionName ?? model.collection.collectionName,
536
+ isNew: Boolean(options.upsert) && await model.countDocuments(filter).exec() === 0,
539
537
  ignoreEvent: options.ignoreEvent,
540
538
  ignorePatchHistory: options.ignorePatchHistory
541
539
  };
@@ -547,24 +545,20 @@ const updateHooksInitialize = (schema, opts) => {
547
545
  await updatePatch(opts, this._context, assignUpdate(doc, update, commands), origDoc);
548
546
  });
549
547
  });
550
- schema.post(updateMethods, async function() {
548
+ schema.post(updateMethods, { document: false, query: true }, async function() {
551
549
  const options = this.getOptions();
552
550
  if (isHookIgnored(options)) return;
551
+ if (!this._context) return;
553
552
  if (!this._context.isNew) return;
554
553
  const model = this.model;
555
554
  const updateQuery = this.getUpdate();
556
555
  const { update, commands } = splitUpdateAndCommands(updateQuery);
557
- let current = null;
558
556
  const filter = this.getFilter();
559
- const combined = assignUpdate(model.hydrate({}), update, commands);
560
- if (!isEmpty(update) && !current) {
561
- current = await model.findOne(update).sort("desc").lean().exec();
562
- }
563
- if (!isEmpty(combined) && !current) {
564
- current = await model.findOne(combined).sort("desc").lean().exec();
565
- }
566
- if (!isEmpty(filter) && !current) {
567
- current = await model.findOne(filter).sort("desc").lean().exec();
557
+ const candidates = [update, assignUpdate(model.hydrate({}), update, commands), filter];
558
+ let current = null;
559
+ for (const query of candidates) {
560
+ if (current || isEmpty(query)) continue;
561
+ current = await model.findOne(query).sort({ _id: -1 }).lean().exec();
568
562
  }
569
563
  if (current) {
570
564
  this._context.createdDocs = [current];
package/dist/index.d.cts CHANGED
@@ -47,6 +47,7 @@ interface PluginOptions<T> {
47
47
  omit?: string[];
48
48
  patchHistoryDisabled?: boolean;
49
49
  preDelete?: (docs: HydratedDocument<T>[]) => Promise<void>;
50
+ onError?: (error: Error) => void;
50
51
  }
51
52
 
52
53
  declare class PatchEventEmitter extends EventEmitter {
@@ -92,7 +93,7 @@ declare const UNITS: {
92
93
  type Unit = keyof typeof UNITS;
93
94
  type Duration = number | `${number}` | `${number}${Unit}` | `${number} ${Unit}`;
94
95
 
95
- declare const setPatchHistoryTTL: (ttl: Duration) => Promise<void>;
96
+ declare const setPatchHistoryTTL: (ttl: Duration, onError?: (error: Error) => void) => Promise<void>;
96
97
 
97
98
  declare const patchHistoryPlugin: <T>(schema: Schema<T>, opts: PluginOptions<T>) => void;
98
99
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sources":["../src/types.ts","../src/em.ts","../src/ms.ts","../src/helpers.ts","../src/index.ts"],"mappings":";;;;AAGM,UAAW,OAAO;;;;kBAIR,KAAK,CAAC,QAAQ;;;;;;YAMpB,SAAS;;AAGb,UAAW,UAAU;aAChB,gBAAgB;UACnB,gBAAgB;YACd,SAAS;;AAGb,UAAW,YAAY;;;;;kBAKb,gBAAgB;kBAChB,gBAAgB;;;;AAK1B,KAAM,WAAW,MAAM,KAAK;;cAAiC,YAAY;;AAEzE,KAAM,IAAI,GAAG,MAAM;AAEnB,KAAM,QAAQ,GAAG,MAAM;AAEvB,UAAW,aAAa;;;;;;oBAMZ,gBAAgB,QAAQ,OAAO,CAAC,IAAI,IAAI,IAAI;sBAC1C,gBAAgB,QAAQ,OAAO;wBAC7B,gBAAgB,QAAQ,OAAO,CAAC,QAAQ,IAAI,QAAQ;;;uBAGrD,gBAAgB,UAAU,OAAO;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WAAW,aAAa","names":[]}
package/dist/index.d.mts CHANGED
@@ -47,6 +47,7 @@ interface PluginOptions<T> {
47
47
  omit?: string[];
48
48
  patchHistoryDisabled?: boolean;
49
49
  preDelete?: (docs: HydratedDocument<T>[]) => Promise<void>;
50
+ onError?: (error: Error) => void;
50
51
  }
51
52
 
52
53
  declare class PatchEventEmitter extends EventEmitter {
@@ -92,7 +93,7 @@ declare const UNITS: {
92
93
  type Unit = keyof typeof UNITS;
93
94
  type Duration = number | `${number}` | `${number}${Unit}` | `${number} ${Unit}`;
94
95
 
95
- declare const setPatchHistoryTTL: (ttl: Duration) => Promise<void>;
96
+ declare const setPatchHistoryTTL: (ttl: Duration, onError?: (error: Error) => void) => Promise<void>;
96
97
 
97
98
  declare const patchHistoryPlugin: <T>(schema: Schema<T>, opts: PluginOptions<T>) => void;
98
99
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sources":["../src/types.ts","../src/em.ts","../src/ms.ts","../src/helpers.ts","../src/index.ts"],"mappings":";;;;AAGM,UAAW,OAAO;;;;kBAIR,KAAK,CAAC,QAAQ;;;;;;YAMpB,SAAS;;AAGb,UAAW,UAAU;aAChB,gBAAgB;UACnB,gBAAgB;YACd,SAAS;;AAGb,UAAW,YAAY;;;;;kBAKb,gBAAgB;kBAChB,gBAAgB;;;;AAK1B,KAAM,WAAW,MAAM,KAAK;;cAAiC,YAAY;;AAEzE,KAAM,IAAI,GAAG,MAAM;AAEnB,KAAM,QAAQ,GAAG,MAAM;AAEvB,UAAW,aAAa;;;;;;oBAMZ,gBAAgB,QAAQ,OAAO,CAAC,IAAI,IAAI,IAAI;sBAC1C,gBAAgB,QAAQ,OAAO;wBAC7B,gBAAgB,QAAQ,OAAO,CAAC,QAAQ,IAAI,QAAQ;;;uBAGrD,gBAAgB,UAAU,OAAO;;;AChDtD,cAAM,iBAAkB,SAAQ,YAAY;;AAC5C,cAAM,EAAE,mBAA0B;;ACKlC,cAAa,KAAK;;;;;;;;;;;;;;;;;;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