rads-db 3.1.2 → 3.1.4

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/index.cjs CHANGED
@@ -357,7 +357,9 @@ const computedPresets = {
357
357
  throw new Error('To use "updatedBy" preset, please, provide "context.getUser" to "createRads" call.');
358
358
  return ___default.pick(ctx.getUser(), "id");
359
359
  },
360
- updatedAt: ({ doc, oldDoc }) => {
360
+ updatedAt: ({ doc, oldDoc, ctx }) => {
361
+ if (ctx.isVerifying && oldDoc.updatedAt)
362
+ return oldDoc.updatedAt;
361
363
  return (/* @__PURE__ */ new Date()).toISOString();
362
364
  },
363
365
  autoincrement: () => {
@@ -819,7 +821,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
819
821
  if (driverInstance.verifyMany) {
820
822
  return driverInstance.verifyMany(args, ctx);
821
823
  }
822
- ctx = { ...options.context, ...ctx };
824
+ ctx = { ...options.context, ...ctx, isVerifying: true };
823
825
  if (args?.dryRun) {
824
826
  ctx._logs = ctx._logs || [];
825
827
  ctx.dryRun = true;
package/dist/index.mjs CHANGED
@@ -350,7 +350,9 @@ const computedPresets = {
350
350
  throw new Error('To use "updatedBy" preset, please, provide "context.getUser" to "createRads" call.');
351
351
  return _.pick(ctx.getUser(), "id");
352
352
  },
353
- updatedAt: ({ doc, oldDoc }) => {
353
+ updatedAt: ({ doc, oldDoc, ctx }) => {
354
+ if (ctx.isVerifying && oldDoc.updatedAt)
355
+ return oldDoc.updatedAt;
354
356
  return (/* @__PURE__ */ new Date()).toISOString();
355
357
  },
356
358
  autoincrement: () => {
@@ -812,7 +814,7 @@ function getRadsDbMethods(key, computedContext, driverInstance) {
812
814
  if (driverInstance.verifyMany) {
813
815
  return driverInstance.verifyMany(args, ctx);
814
816
  }
815
- ctx = { ...options.context, ...ctx };
817
+ ctx = { ...options.context, ...ctx, isVerifying: true };
816
818
  if (args?.dryRun) {
817
819
  ctx._logs = ctx._logs || [];
818
820
  ctx.dryRun = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rads-db",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "packageManager": "pnpm@8.6.1",
5
5
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
6
6
  "author": "",