@vibeorm/runtime 2.0.0-alpha.5 → 2.0.0-alpha.6

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
@@ -31,7 +31,7 @@ function isDbNow(value) {
31
31
  return false;
32
32
  }
33
33
  const candidate = value;
34
- return candidate.__vibeDbNow === true && typeof candidate.offsetSeconds === "number" && Number.isInteger(candidate.offsetSeconds);
34
+ return candidate.__vibeDbNow === true && typeof candidate.offsetSeconds === "number" && Number.isFinite(candidate.offsetSeconds);
35
35
  }
36
36
  // packages/runtime/src/model-meta.ts
37
37
  import { VibeError as VibeError2, isEnumType, validateComputedConfig } from "@vibeorm/schema";
@@ -178,10 +178,10 @@ function buildModelMeta(params) {
178
178
  }
179
179
  return resolved;
180
180
  };
181
- const addCompound = (names, nullsNotDistinct) => {
181
+ const addCompound = (names, nullsNotDistinct, clientName) => {
182
182
  if (names.length < 2)
183
183
  return;
184
- const key = names.join("_");
184
+ const key = clientName ?? names.join("_");
185
185
  if (compoundUniques.has(key))
186
186
  return;
187
187
  const resolved = resolveFields(names);
@@ -189,8 +189,9 @@ function buildModelMeta(params) {
189
189
  return;
190
190
  compoundUniques.set(key, { fields: resolved, nullsNotDistinct });
191
191
  };
192
- if (primaryKey.length > 1)
193
- addCompound(primaryKey.map((field) => field.name), false);
192
+ if (primaryKey.length > 1) {
193
+ addCompound(primaryKey.map((field) => field.name), false, model.primaryKey?.clientName);
194
+ }
194
195
  for (const index of model.indexes) {
195
196
  if (index.kind !== "unique" || index.where !== undefined)
196
197
  continue;
@@ -204,7 +205,7 @@ function buildModelMeta(params) {
204
205
  continue;
205
206
  singleIndexUniques.push({ fields: [field], nullsNotDistinct });
206
207
  } else {
207
- addCompound(names, nullsNotDistinct);
208
+ addCompound(names, nullsNotDistinct, index.clientName);
208
209
  }
209
210
  }
210
211
  const computedSpecs = params.computed;
@@ -7029,4 +7030,4 @@ export {
7029
7030
  COUNT_ALIAS
7030
7031
  };
7031
7032
 
7032
- //# debugId=0C003BB2F334C66D64756E2164756E21
7033
+ //# debugId=4B6B11C516D4A81A64756E2164756E21