suppa-mcp-2 1.40.1 → 1.40.3

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.
@@ -135,21 +135,12 @@ export function defaultValueMayBeSent(unique = false) {
135
135
  // the searchable option participate."). `searchable` (and searchPriority) are
136
136
  // therefore the ones worth setting deliberately; the rest already hold the
137
137
  // value most fields want.
138
- /**
139
- * The display flags the platform's own client sends on every field it creates
140
- * (`fieldDraft.DEFAULT_TRUE_OPTIONS` in the entity builder, `setDefaultTrueOptions` in the legacy
141
- * admin). They are NOT defaulted by the backend, and a consumer that reads the stored options
142
- * object treats an absent key as false — which is how agent-created fields ended up non-groupable,
143
- * unsortable and hidden from tables. `searchable` and `readOnly` are deliberately absent: they
144
- * default to false and are the two worth setting deliberately.
145
- */
146
- export const DEFAULT_TRUE_FIELD_OPTIONS = {
147
- canGroup: true,
148
- canSort: true,
149
- canFilter: true,
150
- showInTable: true,
151
- editFromTable: true,
152
- };
138
+ // The five DISPLAY flags — canGroup, canSort, canFilter, showInTable, editFromTable — are the
139
+ // ones the platform's own client sends on every field it creates (`fieldDraft.DEFAULT_TRUE_OPTIONS`
140
+ // in the entity builder, `setDefaultTrueOptions` in the legacy admin). Whether an omission means
141
+ // "true" or "false" is unsettled — see the decision point in buildFieldDefinition, which leaves
142
+ // the write path alone and says so rather than guessing. No constant here: an exported set with no
143
+ // consumer is how a decision nobody made starts to look like one that was.
153
144
  /** Boolean members of the Field Options object. */
154
145
  export const FIELD_OPTION_BOOLEAN_KEYS = [
155
146
  "searchable", // builder.txt:66 — "Available for search."
@@ -1745,6 +1736,15 @@ export async function buildFieldDef(entityName, fieldName, fieldType, title, opt
1745
1736
  notApplicable.push(`defaultValue was NOT set: it does not apply to a unique field. The field was created ` +
1746
1737
  "WITHOUT a default.");
1747
1738
  }
1739
+ else if (defaultValue !== null && defaultValue !== undefined) {
1740
+ // The caller passed something that carries no value — "", " ", or []. The update path
1741
+ // REFUSES this outright; this path used to drop it without a word, which is the silent drop
1742
+ // the comment above says was already fixed for notNull and unique. Reporting it keeps the two
1743
+ // paths telling the caller the same thing about the same input.
1744
+ notApplicable.push(`defaultValue was NOT set: ${Array.isArray(defaultValue) ? "an empty array" : JSON.stringify(String(defaultValue))} carries no value, and the builder rejects one — suppa_update_field refuses the same input ` +
1745
+ "outright. The field was created WITHOUT a default. Pass the value every row without an " +
1746
+ 'explicit one gets ("0", "\'draft\'", "now()"), or omit default_value.');
1747
+ }
1748
1748
  // Sent exactly as validated: subTypeProblem() judged the TRIMMED value, and
1749
1749
  // ' date ' used to pass that check and then go out with the spaces.
1750
1750
  if (typeof subType === "string" && subType.trim() !== "") {
@@ -2029,8 +2029,10 @@ export async function updateField(entityName, fieldName, opts = {}) {
2029
2029
  // Same rule as add-fields: an empty string is not a default and the builder
2030
2030
  // rejects it. It used to be sent here verbatim.
2031
2031
  if (String(opts.defaultValue).trim() === "") {
2032
+ // `[]` stringifies to "" too, and calling it "an empty string" names the wrong problem.
2033
+ const what = Array.isArray(opts.defaultValue) ? "an empty array" : "an empty string";
2032
2034
  return jsonResponse({
2033
- error: `Refused: default_value is an empty string — that is not a default, and the builder ` +
2035
+ error: `Refused: default_value is ${what} — that is not a default, and the builder ` +
2034
2036
  `rejects one on '${entityName}.${fieldName}' just as it does on add-fields. Nothing was ` +
2035
2037
  "sent. Pass the value every row without an explicit one gets (\"0\", \"'draft'\", " +
2036
2038
  '"now()"), or omit default_value to leave the current default as it is.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suppa-mcp-2",
3
- "version": "1.40.1",
3
+ "version": "1.40.3",
4
4
  "description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -455,6 +455,21 @@ function offKitSpacing(schema, skipIds) {
455
455
  /** Container types whose children are placed in GRID cells and carry their own column count. */
456
456
  const GRID_PARENT_TYPES = new Set(["container", "tabsContainer", "accordionContainer", "stepsContainer"]);
457
457
 
458
+ /**
459
+ * A grid's column count, read the way the rest of this package already reads it.
460
+ *
461
+ * `columnsOf()` and `polishList()` in form-core both require a finite number `>= 1` and floor it,
462
+ * treating anything else as absent. This check used a bare `typeof === "number"`, so a 0, a
463
+ * negative or a 2.5 flowed into both the arithmetic and the advice — and "write width 2.5, which is
464
+ * full width here" is not a remedy an author can follow. Out-of-range counts now read as absent,
465
+ * which is what the normalizer does with them.
466
+ *
467
+ * @returns {number|null} a usable count, or null when none was declared (the grid then holds 1)
468
+ */
469
+ function gridColumns(v) {
470
+ return typeof v === "number" && Number.isFinite(v) && v >= 1 ? Math.floor(v) : null;
471
+ }
472
+
458
473
  /**
459
474
  * A grid child cannot span more columns than its parent grid has.
460
475
  *
@@ -465,13 +480,15 @@ const GRID_PARENT_TYPES = new Set(["container", "tabsContainer", "accordionConta
465
480
  * is precisely the shape this check now refuses. Rare in the wild, so it reads as a defect and not
466
481
  * a convention: 7 occurrences across 4 of the 103 dev forms that have a `schema` column.
467
482
  */
468
- function spanOverflow(schema, settings, skipIds) {
483
+ function spanOverflow(schema, settings, skipIds, presentation = "schema") {
469
484
  const out = [];
470
485
  const list = Array.isArray(schema) ? schema : [];
471
486
  const byId = new Map();
472
487
  for (const el of list) if (el && typeof el === "object" && el.id !== undefined) byId.set(el.id, el);
473
- const rootCols = settings && typeof settings === "object" && typeof settings.columnsNumber === "number"
474
- ? settings.columnsNumber : null;
488
+ const rootCols = gridColumns(settings && typeof settings === "object" ? settings.columnsNumber : undefined);
489
+ // The mobile presentation is laid out against the SAME root count: form-core hands its own
490
+ // `formColumns` to both lists (`normalizeSchemaList(draft.mobileSchema, formColumns, …)`).
491
+ const where0 = presentation === "mobileSchema" ? "mobileSchema — " : "";
475
492
 
476
493
  for (const el of list) {
477
494
  if (!el || typeof el !== "object") continue;
@@ -494,17 +511,18 @@ function spanOverflow(schema, settings, skipIds) {
494
511
  const parent = byId.get(pid);
495
512
  if (!parent || typeof parent !== "object") continue; // dangling parents are reported elsewhere
496
513
  if (!GRID_PARENT_TYPES.has(parent.type)) continue; // a flex parent places by `order`
497
- cols = typeof parent.columnsNumber === "number" ? parent.columnsNumber : 1;
498
- where = typeof parent.columnsNumber === "number"
499
- ? `\`${parent.name || parent.id}\` (columnsNumber: ${parent.columnsNumber})`
500
- : `\`${parent.name || parent.id}\`, whose \`columnsNumber\` is unset and therefore 1`;
514
+ const declared = gridColumns(parent.columnsNumber);
515
+ cols = declared === null ? 1 : declared;
516
+ where = declared === null
517
+ ? `\`${parent.name || parent.id}\`, whose \`columnsNumber\` is unset and therefore 1`
518
+ : `\`${parent.name || parent.id}\` (columnsNumber: ${declared})`;
501
519
  }
502
520
  if (width > cols) {
503
521
  out.push({
504
522
  code: "span_exceeds_parent_columns",
505
523
  elementId: el.name || el.id || el.type,
506
524
  detail:
507
- `layout.${bp}.width is ${width} but its parent grid has ${cols} column${cols === 1 ? "" : "s"} — ` +
525
+ `${where0}layout.${bp}.width is ${width} but its parent grid has ${cols} column${cols === 1 ? "" : "s"} — ` +
508
526
  `${where}. Column count is per grid and defaults to 1: set the count you intend on the grid ` +
509
527
  `FIRST, then span against it. Either raise that grid's column count to ${width} (1-12) and ` +
510
528
  `re-span its other children in the same turn, or write width ${cols}, which is full width here.`,
@@ -801,6 +819,16 @@ export async function validateForm(input, { baseline = null, normalize = false }
801
819
  // missing breakpoint records) and none for what it does not.
802
820
  const docErrors = [
803
821
  ...spanOverflow(draft.schema, draft.settings, baselineIds),
822
+ // The mobile presentation is a component set of its own, and it was passing unchecked: a
823
+ // mobileSchema element spanning 12 in a 4-column grid returned ok:true with zero findings,
824
+ // while the identical shape on the desktop schema was an error. Both lists are laid out
825
+ // against the same `settings.columnsNumber`, so the same check applies to both.
826
+ //
827
+ // Swept over all 217 live dev forms: NONE carries a non-empty `mobileSchema`, so this branch
828
+ // adds zero findings to anything on the tenant today. That is coverage, not evidence — unlike
829
+ // the desktop branch (7 hits on 4 forms), it rests on the shared column model above and on the
830
+ // same documented invariant, not on a measurement of forms that exercise it.
831
+ ...spanOverflow(draft.mobileSchema, draft.settings, baselineIds, "mobileSchema"),
804
832
  ...crossPresentationIds(draft.schema, draft.mobileSchema),
805
833
  ...connectionsWithoutId(draft.connections),
806
834
  ];