@ai-matrx/records 0.87.14 → 0.87.15

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.
@@ -6286,10 +6286,14 @@ function relationIdsOf(value) {
6286
6286
  }
6287
6287
  return out;
6288
6288
  }
6289
- var WORD_TYPES = /* @__PURE__ */ new Set(["text", "long_text", "rich_text", "email", "url", "phone", "markdown"]);
6290
- function blankToNull(type, value) {
6291
- if (typeof value === "string" && value.trim() === "" && !WORD_TYPES.has(type)) return null;
6292
- return value;
6289
+ var FREE_WORD_TYPES = /* @__PURE__ */ new Set(["text", "long", "long_text", "rich_text", "markdown"]);
6290
+ function hasPatternRule(field) {
6291
+ return Array.isArray(field?.rules) && field.rules.some((rule) => rule?.kind === "pattern");
6292
+ }
6293
+ function blankToNull(type, value, field) {
6294
+ if (typeof value !== "string" || value.trim() !== "") return value;
6295
+ if (!FREE_WORD_TYPES.has(type)) return null;
6296
+ return hasPatternRule(field) ? null : value;
6293
6297
  }
6294
6298
  function createTableDataPort({ client, aliases }) {
6295
6299
  const shapes = /* @__PURE__ */ new Map();
@@ -6364,7 +6368,7 @@ function createTableDataPort({ client, aliases }) {
6364
6368
  if (!column) return refuse2("invalid_argument", `This table has no column "${key}".`, "Ask columns() for the keys this table has now. Nothing was saved.");
6365
6369
  if (column.readOnly) return refuse2("invalid_argument", `"${column.label}" is worked out by the table, so it cannot be written.`, "Nothing was saved.");
6366
6370
  const kinds = column.type === "relation" ? entityKindsOf(shape.fields.get(key)) : [];
6367
- out[key] = kinds.length ? entityRefsOf2(value, kinds) : column.type === "relation" ? relationIdsOf(value) : blankToNull(column.type, value);
6371
+ out[key] = kinds.length ? entityRefsOf2(value, kinds) : column.type === "relation" ? relationIdsOf(value) : blankToNull(column.type, value, shape.fields.get(key));
6368
6372
  }
6369
6373
  return { ok: true, data: out };
6370
6374
  }