@vibeorm/runtime 2.5.0 → 2.6.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/dist/index.js CHANGED
@@ -1306,6 +1306,7 @@ var DATETIME_NEEDS_PRECISION_ASSERTION = Object.freeze({
1306
1306
  mysql: true,
1307
1307
  sqlite: false
1308
1308
  });
1309
+ var MILLISECOND_EXACT_NATIVE_TYPE = /^(?:timestamptz|timestamp|datetime)\(\s*[0-3]\s*\)$/i;
1309
1310
  function keysetValidation(params) {
1310
1311
  return new VibeError11({ code: "VIBE_VALIDATION", message: params.message, meta: params.meta });
1311
1312
  }
@@ -1415,9 +1416,9 @@ function compileKeysetOrderPlan(params) {
1415
1416
  meta: { model: model.name, field: field.name, feature: "keysetOrderKey" }
1416
1417
  });
1417
1418
  }
1418
- if (tag === "t" && DATETIME_NEEDS_PRECISION_ASSERTION[dialect.name] === true && timestampPrecision === undefined) {
1419
+ if (tag === "t" && DATETIME_NEEDS_PRECISION_ASSERTION[dialect.name] === true && timestampPrecision === undefined && (model.isView || !MILLISECOND_EXACT_NATIVE_TYPE.test(field.nativeType ?? ""))) {
1419
1420
  throw keysetUnsupported({
1420
- message: `keyset pagination cannot order by ${model.name}.${field.name} on ${dialect.name}: this engine may store sub-millisecond timestamps, ` + "and a JavaScript Date truncates them, which would re-deliver rows inside the same millisecond. " + 'Pass keyset: { timestampPrecision: "milliseconds" } to assert the column is millisecond-exact, or order by a lossless key.',
1421
+ message: `keyset pagination cannot order by ${model.name}.${field.name} on ${dialect.name}: this engine may store sub-millisecond timestamps, ` + "and a JavaScript Date truncates them, which would re-deliver rows inside the same millisecond. " + "Declare the column millisecond-exact (@db.Timestamptz(3), dsl.datetime().tz({ precision: 3 })), " + 'pass keyset: { timestampPrecision: "milliseconds" } to assert it is, or order by a lossless key.',
1421
1422
  meta: { model: model.name, field: field.name, feature: "keysetTimestampPrecision", dialect: dialect.name }
1422
1423
  });
1423
1424
  }
@@ -15051,4 +15052,4 @@ export {
15051
15052
  validateWriteData
15052
15053
  };
15053
15054
 
15054
- //# debugId=9B1DF0989FAC48E264756E2164756E21
15055
+ //# debugId=F8F07DD9CF6AA47D64756E2164756E21