@ai-matrx/records-ui 0.116.123 → 0.116.124
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/CHANGELOG.md +5 -0
- package/dist/{SaveToTable-7Z33WFLA.js → SaveToTable-BEKANHD3.js} +4 -4
- package/dist/{chunk-W2P3LXJY.js → chunk-5RU7BPCU.js} +2 -2
- package/dist/{chunk-CSGNQAQD.js → chunk-6DK2DKTD.js} +2 -2
- package/dist/{chunk-CSGNQAQD.js.map → chunk-6DK2DKTD.js.map} +1 -1
- package/dist/{chunk-EPZG2VCY.js → chunk-B7A3B6F4.js} +2 -2
- package/dist/{chunk-5452DUL7.js → chunk-EB6IVWGJ.js} +188 -74
- package/dist/chunk-EB6IVWGJ.js.map +1 -0
- package/dist/data-source.d.cts +1 -1
- package/dist/data-source.d.ts +1 -1
- package/dist/decision-gate.d.cts +4 -4
- package/dist/decision-gate.d.ts +4 -4
- package/dist/entity-doors.d.cts +24 -28
- package/dist/entity-doors.d.ts +24 -28
- package/dist/entity-ref.d.cts +48 -52
- package/dist/entity-ref.d.ts +48 -52
- package/dist/first-page.d.cts +4 -4
- package/dist/first-page.d.ts +4 -4
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +104 -106
- package/dist/helpers.d.ts +104 -106
- package/dist/helpers.js.map +1 -1
- package/dist/html-frame.d.cts +2 -2
- package/dist/html-frame.d.ts +2 -2
- package/dist/index.cjs +531 -282
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +488 -480
- package/dist/index.d.ts +488 -480
- package/dist/index.js +341 -206
- package/dist/index.js.map +1 -1
- package/dist/list-dimensions.cjs +2 -2
- package/dist/list-dimensions.cjs.map +1 -1
- package/dist/list-dimensions.d.cts +8 -8
- package/dist/list-dimensions.d.ts +8 -8
- package/dist/list-dimensions.js +3 -3
- package/dist/list-dimensions.js.map +1 -1
- package/dist/objectActions-DeP_tTmc.d.cts +12 -12
- package/dist/objectActions-DeP_tTmc.d.ts +12 -12
- package/dist/pickers.cjs +179 -55
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.d.cts +13 -13
- package/dist/pickers.d.ts +13 -13
- package/dist/pickers.js +3 -3
- package/dist/skeleton.d.cts +11 -11
- package/dist/skeleton.d.ts +11 -11
- package/dist/table-shape.d.cts +7 -7
- package/dist/table-shape.d.ts +7 -7
- package/package.json +2 -2
- package/dist/chunk-5452DUL7.js.map +0 -1
- /package/dist/{SaveToTable-7Z33WFLA.js.map → SaveToTable-BEKANHD3.js.map} +0 -0
- /package/dist/{chunk-W2P3LXJY.js.map → chunk-5RU7BPCU.js.map} +0 -0
- /package/dist/{chunk-EPZG2VCY.js.map → chunk-B7A3B6F4.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.116.124
|
|
4
|
+
|
|
5
|
+
- The formula box names the row its answer comes from ("On Paddle: 4"), never "First row": the sampled row is the store's first, not the top row of the grid a person is looking at, so "First row: 4" over a grid whose top row works out to 10 read as a wrong answer. Consumer action: none.
|
|
6
|
+
- History rows never cut their words off: in the narrow panel a formula's history squeezed the cause ("Record edited", "Formula changed") to one letter, and a column's history cut the change itself to an ellipsis. Both now draw two lines per row: the answer (or before -> after) and its formula version first, then why, who and when, with the ways back. Guard: `a-history-row-never-cuts-off-its-words`. Consumer action: none.
|
|
7
|
+
|
|
3
8
|
## 0.116.123
|
|
4
9
|
|
|
5
10
|
- `list-dimensions`: every read failure shows the door's people sentence through `refusalSentence`, never `error.message` raw (the refusal census found five raw renders). Tests follow two deliberate changes: the hydration test's browser runs the server's streamed Suspense reveal (the lazy data table), and on a phone the grid's search, select-all and New record follow design-system's sheet toolbar (search in Tools, primary + select-all on the row); the ungrouped Grouping button reads "Group by". Consumer action: none.
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
SAVE_TO_TABLE_TYPES,
|
|
4
4
|
SaveToTable,
|
|
5
5
|
shapesOfSource
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-B7A3B6F4.js";
|
|
7
7
|
import "./chunk-MTA5CGMH.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-5RU7BPCU.js";
|
|
9
|
+
import "./chunk-6DK2DKTD.js";
|
|
10
10
|
import "./chunk-YHPVSUK6.js";
|
|
11
11
|
import "./chunk-LBZZDHV6.js";
|
|
12
12
|
import "./chunk-RKI2YQHW.js";
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
SaveToTable,
|
|
18
18
|
shapesOfSource
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=SaveToTable-
|
|
20
|
+
//# sourceMappingURL=SaveToTable-BEKANHD3.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
refusalForAPerson,
|
|
6
6
|
refusalLineForAPerson,
|
|
7
7
|
refusalSentence
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6DK2DKTD.js";
|
|
9
9
|
import {
|
|
10
10
|
NOT_ANSWERED_YET,
|
|
11
11
|
whatYouMayDo,
|
|
@@ -1578,4 +1578,4 @@ export {
|
|
|
1578
1578
|
choiceNudgeOf,
|
|
1579
1579
|
useChoiceNudge
|
|
1580
1580
|
};
|
|
1581
|
-
//# sourceMappingURL=chunk-
|
|
1581
|
+
//# sourceMappingURL=chunk-5RU7BPCU.js.map
|
|
@@ -216,7 +216,7 @@ function refusalIsMissingInput(error) {
|
|
|
216
216
|
return error.sqlstate === "22023" || error.code === "invalid_argument";
|
|
217
217
|
}
|
|
218
218
|
function withoutInternalCodes(text) {
|
|
219
|
-
return text.replace(/\s*\((?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+)(?:\s*\/\s*(?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+))*\)/g, "").replace(/\s+([.,;])/g, "$1").trim();
|
|
219
|
+
return text.replace(/^(?:[A-Z]{2,}-)+\d+[A-Za-z]?:\s*/, "").replace(/\s*\((?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+)(?:\s*\/\s*(?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+))*\)/g, "").replace(/\s+([.,;])/g, "$1").trim();
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
export {
|
|
@@ -232,4 +232,4 @@ export {
|
|
|
232
232
|
refusalIsMissingInput,
|
|
233
233
|
withoutInternalCodes
|
|
234
234
|
};
|
|
235
|
-
//# sourceMappingURL=chunk-
|
|
235
|
+
//# sourceMappingURL=chunk-6DK2DKTD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/plainWords.ts"],"sourcesContent":["// src/plainWords.ts — @ai-matrx/records-ui\n//\n// THE ONE FORMATTER EVERY REFUSAL PASSES THROUGH.\n//\n// WHAT A PERSON READ (independent verdict, sixth pass, 19-20 September):\n//\n// \"You do not have access to this table, so custom.applicable_fields has\n// nothing to show you.\"\n// \"config.via names a relation Field of this same table, by its key… The\n// store's code for this was 23514.\"\n//\n// The verdict's third measured gap against Airtable, Notion and Linear was\n// exactly this: \"The machinery still shows through… two column types answer\n// with a contract row id and a SQL error number. Airtable, Notion and Linear\n// never show a person an internal name.\"\n//\n// WHY FILTERING THE HINT WAS NOT ENOUGH. The previous pass filtered the store's\n// HINT — the half written for whoever fixes the caller — and printed the\n// MESSAGE verbatim, because the store writes good messages. Most of them are\n// good. But the store's access refusals are built by `format()` from the DOOR'S\n// OWN NAME (`assert_client_may_change`: \"…so % may not write to it\", with the\n// door name substituted in), so the machine identity is IN the sentence a\n// person reads and no amount of hint-filtering reaches it.\n//\n// SO: ONE function, here, and every screen in this package renders what it\n// returns and nothing else. It does three things and refuses to do a fourth:\n//\n// 1. It KEEPS the store's own words wherever they are a person's words. The\n// store writes the best sentences in this feature (\"Being a member of the\n// organization is not by itself permission to rewrite somebody else's\n// row\") and this package does not rewrite them.\n// 2. It DROPS the clause that carries machine identity, by SHAPE — a\n// schema-qualified object, a document path, a contract row id, a SQLSTATE,\n// a uuid, a bare snake_case token. Dropped, never deleted: it joins the\n// SQLSTATE on the notice for whoever has to debug it.\n// 3. It ADDS a REMEDY — the sentence that says what to do now — keyed off the\n// store's own refusal code, because a refusal with nothing to do about it\n// is a dead end with an explanation.\n//\n// 4. It does NOT invent a diagnosis. When every clause of a message is\n// machine identity there is nothing honest left to say about the specifics,\n// so it says what happened in general terms and offers the remedy. Making\n// something up would be worse than the identifier it replaced.\n//\n// The guard for all of this is `demo/plain-words.test.tsx` plus the sweep in\n// `demo/honest.test.tsx`, which reads the RENDERED text of the real screens and\n// fails on any of the shapes below. A formatter nobody is forced through is a\n// formatter somebody bypasses next week.\n\nimport type { RecordsError } from \"@ai-matrx/records\";\n\n/**\n * MACHINE IDENTITY, BY SHAPE — never by a list of the sentences we happen to\n * have seen, because the next refusal is one nobody has read yet.\n *\n * `FLD-11:` / `REC-29:` / `AGT-7:` a contract row id\n * `custom.field_declare` a schema-qualified database object\n * `config.via` / `data.fields` a path inside a stored document\n * `retention_days` a document key, snake_case\n * `8f2c1b0a-…` a uuid\n * `23514` / `PT409` a SQLSTATE\n * `STORE-TAILS-3:` / `UI-FIX-19:` a build lane's tag (UI-FIX-19)\n */\nexport const MACHINE_IDENTITY: RegExp[] = [\n /\\b[A-Z]{2,4}-\\d{1,3}\\b/,\n // A build lane's tag: capital words joined by hyphens, then a colon (\"STORE-TAILS-3:\",\n // \"MOVE-AND-OUTSIDER:\"). A person never reads which lane wrote a sentence.\n /\\b[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+:/,\n /\\b(?:custom|platform|iam|history|public|auth|campaign_watch)\\.[a-z_]+/,\n /\\b(?:config|data|document|spec|patch)\\.[a-z_]+/,\n /\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b/i,\n /\\b[a-z][a-z0-9]*(?:_[a-z0-9]+)+\\b/,\n // Five characters of digits and capitals, at least one a digit — so `23514`\n // and `PT409` match and an emphatic `NEVER` does not.\n /\\b(?=[0-9A-Z]{5}\\b)(?=[0-9A-Z]*\\d)[0-9A-Z]{5}\\b/,\n];\n\n/** Whether any shape above appears in this text. */\nexport function isMachineIdentity(text: string): boolean {\n return MACHINE_IDENTITY.some((shape) => shape.test(text));\n}\n\n/**\n * Every fragment of `text` that a person should never have been shown. Used by\n * the suite to say WHAT it found rather than only that it found something.\n */\nexport function machineIdentityIn(text: string): string[] {\n const found: string[] = [];\n for (const shape of MACHINE_IDENTITY) {\n const all = new RegExp(shape.source, shape.flags.includes(\"g\") ? shape.flags : `${shape.flags}g`);\n for (const hit of text.matchAll(all)) if (hit[0]) found.push(hit[0]);\n }\n return [...new Set(found)];\n}\n\n/** What the notice is called. The store's code, in the words of what went wrong. */\nconst TITLE: Record<string, string> = {\n stale_write: \"Someone else wrote first\",\n door: \"You do not have access to this\",\n door_absent: \"That is not built yet\",\n refused_by_rule: \"That value was not accepted\",\n invalid_argument: \"That was not accepted\",\n not_found: \"Not there any more\",\n missing_reference: \"That points at something that is not there\",\n already_exists: \"That already exists\",\n not_supported: \"That cannot be done here\",\n store_limit: \"This has got as big as it can\",\n // 🚨 NOT \"THE SWITCH IS OFF\" (lane 7 W1 fix round 1). PGRST202 / PGRST205 land here, and the\n // commonest cause is a door this screen asks for that the database it talks to does not serve\n // YET — a release in flight. Telling the person her organization has its store switched off was\n // false (the switch is answered by its own door, `platform.unified_data_store_on`). Honest:\n // nothing happened, and it is ours, and it passes.\n store_not_served: \"This isn't available right now\",\n unreachable: \"We could not reach your data\",\n needs_approval: \"This is waiting on someone's approval\",\n stale_read: \"Your view of this is a moment behind\",\n timed_out: \"That took too long to answer\",\n internal: \"Something went wrong at our end\",\n};\n\n/**\n * WHAT TO DO NOW. One sentence per refusal code, and it is the whole reason\n * this file exists rather than a regular expression in `Refusal.tsx`: a\n * sentence that names what went wrong and nothing to do about it is a dead end.\n */\nconst REMEDY: Record<string, string> = {\n stale_write:\n \"Look at what they wrote. Keep theirs, or try again and yours goes on top.\",\n door:\n \"Ask somebody who administers this to share it with you at the level you need.\",\n door_absent:\n \"There is nothing to do here yet. It is on our list, not yours.\",\n refused_by_rule: \"Change the value so it passes, then try again.\",\n invalid_argument: \"Change what you entered, then try again.\",\n not_found:\n \"It may have been deleted. Go back to the list and open it again from there.\",\n missing_reference: \"Pick something that is still there.\",\n already_exists: \"Use a different name.\",\n not_supported: \"There is another way to do this — ask, and we will point you at it.\",\n store_limit: \"Split it up, or ask us to raise the ceiling for your organization.\",\n store_not_served: \"Nothing was changed. Try again in a few minutes.\",\n // 🚨 NOTHING WAS WRITTEN AND NOTHING WAS REFUSED (lane TAILS-6). The call\n // never arrived, so \"try again\" is the honest instruction rather than a\n // consolation — and saying nothing changed is the half a person actually\n // worries about.\n unreachable:\n \"Nothing was changed. Check your connection and open this again.\",\n needs_approval:\n \"Nothing was changed yet. The people who can approve it have been asked.\",\n stale_read: \"Open this again in a moment and it will be up to date.\",\n // 🚨 ONE REMEDY THAT IS TRUE OF EVERY DOOR (lane CHAIR-STORE-PERF, 2026-10-03). The store cancels the\n // WHOLE statement at its clock, so a timed-out door wrote nothing — a create, a column add and a page\n // read alike. \"Try a smaller page\" was written for the page read and was printed to a person adding\n // one row to a three-row table (clone walk, 2026-10-03; the clock was a lock another lane's\n // rehearsal held, not the row). A door whose page can shrink says so in its own hint, which wins here.\n // ONE SENTENCE, NOT TWO (lane TIMEOUT-ONE-SENTENCE, 2026-10-19): the shared timed-out sentence (\"That took too long.\n // Nothing was lost; try again.\") already says what happened and what to do, so the table adds NO second remedy\n // (\"Nothing was changed\" was also wrong on a read). Empty = the notice prints no remedy line and the one-line\n // form is the sentence alone. A door's own hint still wins.\n timed_out: \"\",\n internal:\n \"Nothing you did caused this. Try again, and tell us if it keeps happening.\",\n};\n\n/**\n * 🚨 A HINT THIS PACKAGE OR ITS CLIENT WROTE IS NOT A PERSON'S REMEDY.\n *\n * `refusalForAPerson` prefers the DOOR's own hint over the table above, because\n * the door that refused knows more about the way out than a code does. That is\n * right — but it assumed every hint came from the store. It did not: until\n * `@ai-matrx/records` 0.47.0 the client appended its OWN note to `hint` when it\n * met a SQLSTATE it did not know, and the machine-identity filter let it\n * through whenever the code was not exactly five characters (an empty code from\n * a dropped connection, or an HTTP status like `404`). So the Checklists tab of\n * a plumbing company's jobs table told its owner:\n *\n * @ai-matrx/records did not recognize SQLSTATE from checklistTemplates\n *\n * The client no longer writes there. This is the guard on the other side, by\n * SHAPE and not by that one sentence: a hint that talks about a package, a\n * SQLSTATE, or a `camelCaseDoor` is engineer text wherever it came from, and it\n * joins the engineer's line instead of a person's screen.\n */\nexport const ENGINEER_TEXT: RegExp[] = [\n /@ai-matrx\\//,\n /\\bSQLSTATE\\b/i,\n /\\bPostgREST\\b/i,\n /\\bIndexedDB\\b/i,\n // `<RecordsUiProvider>` — a component, on a screen.\n /<\\/?[A-Z][A-Za-z0-9]*\\s*\\/?>/,\n // `savedViews`, `openRecords`, `onReask` — an identifier, however it is\n // quoted. English does not write camelCase; code does.\n /\\b[a-z][a-z0-9]*[A-Z][A-Za-z0-9]*\\b/,\n // A backticked token is a thing you type into an editor, not a thing you do.\n /`[A-Za-z_][A-Za-z0-9_.]*`/,\n // \"bind X on Y\", \"pass X\", \"import X\" — an instruction to whoever maintains\n // the app, arriving on the screen of somebody who cannot act on it.\n /\\bbind\\s+[`'\"A-Za-z]/i,\n];\n\n/**\n * THE ONE GUARD ON A DOOR'S HINT. True when the hint is developer text and must never be\n * printed at a person: engineer shapes (package, SQLSTATE, component, camelCase, backticked\n * token), a code fence, stack-like lines, or a block too long to be one remedy (over 600).\n * Machine clauses INSIDE an otherwise plain hint are cut by `plainSentence`, not by this.\n */\nexport function isDeveloperHint(hint: string): boolean {\n const text = hint.trim();\n if (text === \"\") return false;\n if (text.includes(\"```\")) return true;\n if (/\\n\\s+at\\s+\\S+/.test(text)) return true;\n if (text.length > 600) return true;\n return isEngineerText(text);\n}\n\n/** The hint a person may read: cleaned to people's sentences, or null. The one place that decides. */\nexport function peopleHint(hint: string | null | undefined): string | null {\n const said = (hint ?? \"\").trim();\n if (said === \"\" || isDeveloperHint(said)) return null;\n return plainSentence(said).kept;\n}\n\n/** Whether this sentence was written for whoever maintains the code. */\nexport function isEngineerText(text: string): boolean {\n return ENGINEER_TEXT.some((shape) => shape.test(text));\n}\n\n/** The one shape every screen in this package renders a refusal from. */\nexport interface PlainRefusal {\n /** The heading. Never the store's code. */\n title: string;\n /**\n * What happened, in the store's own words where they are a person's words\n * and in ours where they are not. Never empty.\n */\n sentence: string;\n /** What to do now. Never empty. */\n remedy: string;\n /**\n * TRUE when `sentence` is the store's own words (UI-FIX-19): a notice is then HEADED by that\n * sentence, never by the generic `title` over it.\n */\n storeSaid: boolean;\n /**\n * Everything a person should not read, kept for whoever has to debug it: the\n * SQLSTATE, the hint written for a caller, and any clause dropped above.\n * Kept on the notice's `data-for-engineers` attribute only (UI-FIX-19): never a\n * tooltip, never text a screen can copy or read aloud; never deleted.\n */\n forEngineers: string;\n}\n\n/**\n * A sentence with its machine clauses taken out — or null when nothing honest\n * is left. Clauses are split on the joins the store's own `format()` templates\n * use (\"…, so custom.x may not write to it\", \"… — FLD-11: …\").\n */\nfunction withoutMachineClauses(sentence: string): { kept: string | null; dropped: string[] } {\n const dropped: string[] = [];\n // 🚨 A PARENTHETICAL ID IS EXCISED, NOT A REASON TO BIN THE SENTENCE AROUND IT\n // (lane LIMITS-FIX-UI, 2026-09-21). The store's own way out for a colleague who\n // is not in the organization — \"Invite them to the organization, share with\n // their organization instead (VIS-23), or, if they are a client rather than a\n // colleague, put them in a portal\" — was thrown away WHOLE because of those\n // eight characters, so a plumbing company trying to show one customer her own\n // jobs was told nothing at all about what to do instead. A contract id in\n // brackets is a footnote: lift it out and the sentence around it is a person's\n // sentence. It is still kept for the engineer, below.\n const footnotes: string[] = [];\n const withoutFootnotes = sentence.replace(/\\s*\\((?:see\\s+)?[A-Z]{2,5}-[A-Z0-9-]{1,8}\\)/g, (hit) => {\n footnotes.push(hit.trim());\n return \"\";\n });\n dropped.push(...footnotes);\n const clauses = withoutFootnotes\n .split(/(?:,\\s+so\\s+|\\s+—\\s+|\\s+--\\s+|\\s*\\|\\s*)/)\n .map((clause) => clause.trim())\n .filter((clause) => clause !== \"\");\n const kept = clauses.filter((clause) => {\n if (!isMachineIdentity(clause)) return true;\n dropped.push(clause);\n return false;\n });\n if (kept.length === 0) return { kept: null, dropped };\n // 🚨 A CLEANER THAT DROPPED NOTHING CHANGES NOTHING (same lane, same day).\n //\n // The split above is on the joins the store's `format()` templates use, and\n // \", so \" is one of them — which is also how ordinary English joins two\n // clauses. So \"That person is not in this organization, so they cannot be\n // given access to this table yet.\" came back out as \"That person is not in\n // this organization. they cannot be given access to this table yet.\" — a\n // sentence nobody wrote, with a lower-case word after a full stop, shown to\n // every person every time. Nothing was dropped from it; there was nothing to\n // clean. When that is true the sentence is returned exactly as the store wrote\n // it, and this function's re-joining only ever runs on a sentence it actually\n // took something out of.\n if (dropped.length === 0) return { kept: sentence.trim(), dropped };\n let joined = kept.join(\". \").replace(/\\.\\.+/g, \".\").trim();\n if (!/[.!?]$/.test(joined)) joined = `${joined}.`;\n return { kept: joined, dropped };\n}\n\n/**\n * THE PEOPLE-FACING SENTENCE OF A STORE MESSAGE, AND NOTHING AFTER IT (lane\n * RECORDS-UI-REFUSAL-TEXT, 2026-10-01). A refusal's message is one plain sentence,\n * then ` — ` and developer detail, or a second sentence written for whoever fixes the\n * caller. A person reads the first sentence only; the rest rides `forEngineers`.\n */\nfunction peopleSentence(message: string): { kept: string | null; dropped: string[] } {\n const [lead = \"\", ...tail] = message.split(/\\s+—\\s+|\\s+--\\s+/);\n // A full stop after an abbreviation or an initial (\"Ask Dr. Whitfield\", \"e.g. a quote\") is not an end.\n const sentences = lead.trim().split(/(?<=(?<!\\b(?:Dr|Mr|Mrs|Ms|St|vs|No|e\\.g|i\\.e|etc|[A-Z]))[.!?])\\s+/);\n const first = sentences[0] ?? \"\";\n const rest = [...sentences.slice(1), ...tail].map((part) => part.trim()).filter((part) => part !== \"\");\n const cleaned = plainSentence(first);\n return { kept: cleaned.kept, dropped: [...cleaned.dropped, ...rest] };\n}\n\n/**\n * THE ONE SENTENCE A PERSON READS FOR A REFUSAL — the store's first sentence, or the\n * title when nothing of it is a person's words. Never the hint, details, code or\n * SQLSTATE. Every place that needs a refusal as a string (a toast, a cell, a banner)\n * calls this and nothing else; `check:records-ui-refusal-text` fails on a raw\n * `error.message` / `error.hint` render anywhere else.\n */\nexport function refusalSentence(error: Pick<RecordsError, \"message\"> & Partial<RecordsError>): string {\n return refusalForAPerson(error as RecordsError).sentence;\n}\n\n// A BUILD LABEL OPENING A SENTENCE (lane CLOSE-LINK, CD-LINK-07): the acceptance test or the lane/rule tag the store was\n// built against — \"Test 3 (Reparent):\", \"REC-21:\", \"T5 / VAL-4:\", \"CLOSE-LINK:\". A person never reads it, and it is\n// never a reason to drop the remedy after it (which is what the machine-identity filter did to the whole sentence).\nconst BUILD_LABEL = String.raw`(?:Test \\d+ \\([^)]{1,40}\\)|[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+|[A-Z]{1,5}\\d+[a-z]?)`;\nconst LEADING_BUILD_LABEL = new RegExp(String.raw`^${BUILD_LABEL}(?:\\s*\\/\\s*${BUILD_LABEL})*:\\s+`);\n\n/** The sentence with any build label lifted off its start, the label kept for engineers. */\nfunction withoutBuildLabel(sentence: string): { label: string | null; rest: string } {\n const hit = LEADING_BUILD_LABEL.exec(sentence);\n if (!hit) return { label: null, rest: sentence };\n const rest = sentence.slice(hit[0].length).trim();\n return { label: hit[0].trim(), rest: rest.charAt(0).toUpperCase() + rest.slice(1) };\n}\n\n/** Every sentence of a message, cleaned; the ones that cannot be cleaned are dropped. */\nfunction plainSentence(message: string): { kept: string | null; dropped: string[] } {\n const dropped: string[] = [];\n const kept: string[] = [];\n for (const raw of message.split(/(?<=[.!?])\\s+/)) {\n const labelled = withoutBuildLabel(raw.trim());\n if (labelled.label) dropped.push(labelled.label);\n const sentence = labelled.rest;\n if (sentence === \"\") continue;\n const cleaned = withoutMachineClauses(sentence);\n dropped.push(...cleaned.dropped);\n if (cleaned.kept) kept.push(cleaned.kept);\n }\n return { kept: kept.length === 0 ? null : kept.join(\" \"), dropped };\n}\n\n/** A remedy is a sentence, not the one word left after a build label was lifted off (\"FLD-1: text.\" keeps \"Text.\"). */\nfunction readsAsASentence(text: string | null): boolean {\n return (text ?? \"\").trim().split(/\\s+/).filter(Boolean).length >= 2;\n}\n\n/** The example a pattern refusal carries in its detail, when it carries one. */\nfunction exampleOf(error: RecordsError): string | null {\n const detail = (error as { detail?: unknown }).detail;\n if (!detail || typeof detail !== \"object\") return null;\n const example = (detail as { example?: unknown }).example;\n return typeof example === \"string\" && example.trim() !== \"\" ? example.trim() : null;\n}\n\n/** What a statement timeout says of itself, in place of the database's own words. */\n// ONE SENTENCE EVERYWHERE: the same words as design-system's `TIMED_OUT_SENTENCE` (what every screen prints through\n// `refusalSaid`) and records' `TIMED_OUT_MESSAGE`. This file is the light helpers door, so it cannot import either\n// (design-system's root is heavy); `a-timeout-reads-as-the-platforms-sentence.test.tsx` fails if the three drift.\nconst TIMED_OUT_SAID = \"That took too long. Nothing was lost; try again.\";\n\n/**\n * THE FORMATTER. Every refusal a screen in this package shows goes through\n * here, and nothing in this package renders `error.message` directly.\n */\nexport function refusalForAPerson(error: RecordsError): PlainRefusal {\n const code = error.code ?? \"internal\";\n // A STATEMENT TIMEOUT is the database's words, never a person's (AT-SNAPJOB-2, 2026-10-19: a base rename showed\n // \"canceling statement due to statement timeout\"). Whatever way it arrived (the package's `timed_out`, SQLSTATE\n // 57014, or only Postgres' sentence on an error with no code) it reads as the timed-out refusal: its title and\n // remedy below, and a sentence of our own in place of the database's.\n const timedOut =\n code === \"timed_out\" ||\n (error as { sqlstate?: string }).sqlstate === \"57014\" ||\n /canceling statement due to statement timeout/i.test(String(error.message ?? \"\"));\n // A refusal THIS package wrote (`refusals.ts` marks it `ours`) is whole people-facing prose, a\n // count then a reason; only a door's message is cut after its first sentence.\n const ours = (error as { ours?: unknown }).ours === true;\n const hint = plainSentence(String(error.hint ?? \"\"));\n const message = ours ? plainSentence(String(error.message ?? \"\")) : peopleSentence(String(error.message ?? \"\"));\n\n const title = timedOut ? TITLE[\"timed_out\"]! : (TITLE[code] ?? \"That was refused\");\n\n // 🚨 ONE REMEDY, AND IT IS THE DOOR'S OWN WHEN THE DOOR HAS ONE (lane\n // LIMITS-FIX-UI, 2026-09-21).\n //\n // The table below is a FALLBACK, not an answer. `custom.share_grant` refuses a\n // colleague who is not in the organization with its own three ways forward —\n // *\"Invite them to the organization, share with their organization instead, or,\n // if they are a client rather than a colleague, put them in a portal\"* — and\n // this formatter used to print that AND then \"Change the value so it passes,\n // then try again\", which is not a thing anybody can do about a membership. Two\n // remedies, one of them wrong, is worse than one: a person follows the last\n // sentence they read. The door that refused knows more about the way out than\n // a table keyed on a code does, so its hint wins whenever it survived the\n // machine-identity filter, and the table answers when it did not.\n // 🚨 THE DOOR'S HINT IS THE REMEDY WHEN IT READS AS A PERSON'S SENTENCE (chair ruling,\n // 2026-10-01, restoring the 2026-09-21 one-remedy ruling). A hint that is developer text (a\n // SQL state, a snake_case name, a uuid, a code fence, a stack, a package or component name)\n // is never printed: it rides `forEngineers` and the code's table sentence is the remedy.\n const hintIsForEngineers = isDeveloperHint(String(error.hint ?? \"\"));\n // STORE-RULE-GAPS: a pattern that carries an example hands it over as DATA\n // (`detail.example`), because an example is the person's own shape of value.\n const example = exampleOf(error);\n const remedy =\n (example ? `Enter it like ${example}.` : null) ??\n (hintIsForEngineers || !readsAsASentence(hint.kept) ? null : hint.kept) ??\n (timedOut ? REMEDY[\"timed_out\"] : REMEDY[code]) ??\n REMEDY[\"internal\"]!;\n\n // The store's own sentence for what happened. Its hint is the REMEDY above\n // rather than more of this, so the two halves never say the same thing twice.\n // A STORE MESSAGE IS NEVER ENGINEER TEXT; a stand-in written by a client can\n // be, and a person must not read it. It still reaches the engineer's line.\n const messageIsForEngineers = isEngineerText(String(error.message ?? \"\"));\n const said = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? \"\" : (message.kept ?? \"\")).trim();\n\n const forEngineers = [\n error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,\n // The client's own note about a class it did not recognize, or a call that\n // never reached the store. It is rendered out of sight, never as a sentence.\n error.diagnostic ? error.diagnostic : null,\n messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,\n error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,\n message.dropped.length > 0 || hint.dropped.length > 0\n ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(\" | \")}`\n : null,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return {\n title,\n // Nothing invented. When every clause was machine identity the title says\n // what happened and the remedy says what to do; a made-up diagnosis would\n // be worse than the identifier it replaced.\n sentence: said === \"\" ? `${title}.` : said,\n remedy,\n storeSaid: said !== \"\",\n forEngineers,\n };\n}\n\n/**\n * The same answer as one line, for a cell or a field where a block would break\n * the layout. Still one sentence and one remedy — never the sentence alone,\n * because half of this formatter's job is the thing to do next.\n */\nexport function refusalLineForAPerson(error: RecordsError): string {\n const plain = refusalForAPerson(error);\n // TWO SENTENCES, NOT ONE RUN-ON (VERIFIER-15/16): the store's rule message has no\n // full stop (\"Pressure (psi) has to be at least 0\"), and joining it to the remedy\n // read \"…at least 0 Send this column somewhere else\". A line ends its sentence.\n const sentence = plain.sentence.trim();\n const ended = sentence === \"\" || /[.!?…:]$/.test(sentence) ? sentence : `${sentence}.`;\n return `${ended} ${plain.remedy}`.trim();\n}\n\n/** The store refused because the request was missing something (22023 / invalid_argument): a decision, never text to print. */\nexport function refusalIsMissingInput(error: Partial<RecordsError>): boolean {\n return error.sqlstate === \"22023\" || error.code === \"invalid_argument\";\n}\n\n/**\n * A STORED SENTENCE WITHOUT ITS INTERNAL CODES (lane F2, D11). The store's older sentences — a kept-aside\n * reason, a migration note — end with the spec codes they were written against (\"(FLD-4 / T12)\",\n * \"(VAL-1)\"). Those codes are for the people who wrote the store; the store no longer writes them, and the\n * ones already saved come off here, wherever a person reads them.\n */\nexport function withoutInternalCodes(text: string): string {\n return text\n .replace(/\\s*\\((?:[A-Z]{2,}-\\d+[A-Za-z]?|T\\d+)(?:\\s*\\/\\s*(?:[A-Z]{2,}-\\d+[A-Za-z]?|T\\d+))*\\)/g, \"\")\n .replace(/\\s+([.,;])/g, \"$1\")\n .trim();\n}\n"],"mappings":";;;AA+DO,IAAM,mBAA6B;AAAA,EACxC;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AACF;AAGO,SAAS,kBAAkB,MAAuB;AACvD,SAAO,iBAAiB,KAAK,CAAC,UAAU,MAAM,KAAK,IAAI,CAAC;AAC1D;AAMO,SAAS,kBAAkB,MAAwB;AACxD,QAAM,QAAkB,CAAC;AACzB,aAAW,SAAS,kBAAkB;AACpC,UAAM,MAAM,IAAI,OAAO,MAAM,QAAQ,MAAM,MAAM,SAAS,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM,KAAK,GAAG;AAChG,eAAW,OAAO,KAAK,SAAS,GAAG,EAAG,KAAI,IAAI,CAAC,EAAG,OAAM,KAAK,IAAI,CAAC,CAAC;AAAA,EACrE;AACA,SAAO,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC;AAC3B;AAGA,IAAM,QAAgC;AAAA,EACpC,aAAa;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMb,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,gBAAgB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AAA;AAAA;AAAA;AAAA,IAIA,UAAU,SAAS,KAAK,GAAG,KAAK,MAAM;AAAA,IACtC;AAAA,IACA,WAAW,SAAS;AAAA,IACpB;AAAA,EACF;AACF;AAOO,SAAS,sBAAsB,OAA6B;AACjE,QAAM,QAAQ,kBAAkB,KAAK;AAIrC,QAAM,WAAW,MAAM,SAAS,KAAK;AACrC,QAAM,QAAQ,aAAa,MAAM,WAAW,KAAK,QAAQ,IAAI,WAAW,GAAG,QAAQ;AACnF,SAAO,GAAG,KAAK,IAAI,MAAM,MAAM,GAAG,KAAK;AACzC;AAGO,SAAS,sBAAsB,OAAuC;AAC3E,SAAO,MAAM,aAAa,WAAW,MAAM,SAAS;AACtD;AAQO,SAAS,qBAAqB,MAAsB;AACzD,SAAO,KACJ,QAAQ,uFAAuF,EAAE,EACjG,QAAQ,eAAe,IAAI,EAC3B,KAAK;AACV;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/plainWords.ts"],"sourcesContent":["// src/plainWords.ts — @ai-matrx/records-ui\n//\n// THE ONE FORMATTER EVERY REFUSAL PASSES THROUGH.\n//\n// WHAT A PERSON READ (independent verdict, sixth pass, 19-20 September):\n//\n// \"You do not have access to this table, so custom.applicable_fields has\n// nothing to show you.\"\n// \"config.via names a relation Field of this same table, by its key… The\n// store's code for this was 23514.\"\n//\n// The verdict's third measured gap against Airtable, Notion and Linear was\n// exactly this: \"The machinery still shows through… two column types answer\n// with a contract row id and a SQL error number. Airtable, Notion and Linear\n// never show a person an internal name.\"\n//\n// WHY FILTERING THE HINT WAS NOT ENOUGH. The previous pass filtered the store's\n// HINT — the half written for whoever fixes the caller — and printed the\n// MESSAGE verbatim, because the store writes good messages. Most of them are\n// good. But the store's access refusals are built by `format()` from the DOOR'S\n// OWN NAME (`assert_client_may_change`: \"…so % may not write to it\", with the\n// door name substituted in), so the machine identity is IN the sentence a\n// person reads and no amount of hint-filtering reaches it.\n//\n// SO: ONE function, here, and every screen in this package renders what it\n// returns and nothing else. It does three things and refuses to do a fourth:\n//\n// 1. It KEEPS the store's own words wherever they are a person's words. The\n// store writes the best sentences in this feature (\"Being a member of the\n// organization is not by itself permission to rewrite somebody else's\n// row\") and this package does not rewrite them.\n// 2. It DROPS the clause that carries machine identity, by SHAPE — a\n// schema-qualified object, a document path, a contract row id, a SQLSTATE,\n// a uuid, a bare snake_case token. Dropped, never deleted: it joins the\n// SQLSTATE on the notice for whoever has to debug it.\n// 3. It ADDS a REMEDY — the sentence that says what to do now — keyed off the\n// store's own refusal code, because a refusal with nothing to do about it\n// is a dead end with an explanation.\n//\n// 4. It does NOT invent a diagnosis. When every clause of a message is\n// machine identity there is nothing honest left to say about the specifics,\n// so it says what happened in general terms and offers the remedy. Making\n// something up would be worse than the identifier it replaced.\n//\n// The guard for all of this is `demo/plain-words.test.tsx` plus the sweep in\n// `demo/honest.test.tsx`, which reads the RENDERED text of the real screens and\n// fails on any of the shapes below. A formatter nobody is forced through is a\n// formatter somebody bypasses next week.\n\nimport type { RecordsError } from \"@ai-matrx/records\";\n\n/**\n * MACHINE IDENTITY, BY SHAPE — never by a list of the sentences we happen to\n * have seen, because the next refusal is one nobody has read yet.\n *\n * `FLD-11:` / `REC-29:` / `AGT-7:` a contract row id\n * `custom.field_declare` a schema-qualified database object\n * `config.via` / `data.fields` a path inside a stored document\n * `retention_days` a document key, snake_case\n * `8f2c1b0a-…` a uuid\n * `23514` / `PT409` a SQLSTATE\n * `STORE-TAILS-3:` / `UI-FIX-19:` a build lane's tag (UI-FIX-19)\n */\nexport const MACHINE_IDENTITY: RegExp[] = [\n /\\b[A-Z]{2,4}-\\d{1,3}\\b/,\n // A build lane's tag: capital words joined by hyphens, then a colon (\"STORE-TAILS-3:\",\n // \"MOVE-AND-OUTSIDER:\"). A person never reads which lane wrote a sentence.\n /\\b[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+:/,\n /\\b(?:custom|platform|iam|history|public|auth|campaign_watch)\\.[a-z_]+/,\n /\\b(?:config|data|document|spec|patch)\\.[a-z_]+/,\n /\\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\b/i,\n /\\b[a-z][a-z0-9]*(?:_[a-z0-9]+)+\\b/,\n // Five characters of digits and capitals, at least one a digit — so `23514`\n // and `PT409` match and an emphatic `NEVER` does not.\n /\\b(?=[0-9A-Z]{5}\\b)(?=[0-9A-Z]*\\d)[0-9A-Z]{5}\\b/,\n];\n\n/** Whether any shape above appears in this text. */\nexport function isMachineIdentity(text: string): boolean {\n return MACHINE_IDENTITY.some((shape) => shape.test(text));\n}\n\n/**\n * Every fragment of `text` that a person should never have been shown. Used by\n * the suite to say WHAT it found rather than only that it found something.\n */\nexport function machineIdentityIn(text: string): string[] {\n const found: string[] = [];\n for (const shape of MACHINE_IDENTITY) {\n const all = new RegExp(shape.source, shape.flags.includes(\"g\") ? shape.flags : `${shape.flags}g`);\n for (const hit of text.matchAll(all)) if (hit[0]) found.push(hit[0]);\n }\n return [...new Set(found)];\n}\n\n/** What the notice is called. The store's code, in the words of what went wrong. */\nconst TITLE: Record<string, string> = {\n stale_write: \"Someone else wrote first\",\n door: \"You do not have access to this\",\n door_absent: \"That is not built yet\",\n refused_by_rule: \"That value was not accepted\",\n invalid_argument: \"That was not accepted\",\n not_found: \"Not there any more\",\n missing_reference: \"That points at something that is not there\",\n already_exists: \"That already exists\",\n not_supported: \"That cannot be done here\",\n store_limit: \"This has got as big as it can\",\n // 🚨 NOT \"THE SWITCH IS OFF\" (lane 7 W1 fix round 1). PGRST202 / PGRST205 land here, and the\n // commonest cause is a door this screen asks for that the database it talks to does not serve\n // YET — a release in flight. Telling the person her organization has its store switched off was\n // false (the switch is answered by its own door, `platform.unified_data_store_on`). Honest:\n // nothing happened, and it is ours, and it passes.\n store_not_served: \"This isn't available right now\",\n unreachable: \"We could not reach your data\",\n needs_approval: \"This is waiting on someone's approval\",\n stale_read: \"Your view of this is a moment behind\",\n timed_out: \"That took too long to answer\",\n internal: \"Something went wrong at our end\",\n};\n\n/**\n * WHAT TO DO NOW. One sentence per refusal code, and it is the whole reason\n * this file exists rather than a regular expression in `Refusal.tsx`: a\n * sentence that names what went wrong and nothing to do about it is a dead end.\n */\nconst REMEDY: Record<string, string> = {\n stale_write:\n \"Look at what they wrote. Keep theirs, or try again and yours goes on top.\",\n door:\n \"Ask somebody who administers this to share it with you at the level you need.\",\n door_absent:\n \"There is nothing to do here yet. It is on our list, not yours.\",\n refused_by_rule: \"Change the value so it passes, then try again.\",\n invalid_argument: \"Change what you entered, then try again.\",\n not_found:\n \"It may have been deleted. Go back to the list and open it again from there.\",\n missing_reference: \"Pick something that is still there.\",\n already_exists: \"Use a different name.\",\n not_supported: \"There is another way to do this — ask, and we will point you at it.\",\n store_limit: \"Split it up, or ask us to raise the ceiling for your organization.\",\n store_not_served: \"Nothing was changed. Try again in a few minutes.\",\n // 🚨 NOTHING WAS WRITTEN AND NOTHING WAS REFUSED (lane TAILS-6). The call\n // never arrived, so \"try again\" is the honest instruction rather than a\n // consolation — and saying nothing changed is the half a person actually\n // worries about.\n unreachable:\n \"Nothing was changed. Check your connection and open this again.\",\n needs_approval:\n \"Nothing was changed yet. The people who can approve it have been asked.\",\n stale_read: \"Open this again in a moment and it will be up to date.\",\n // 🚨 ONE REMEDY THAT IS TRUE OF EVERY DOOR (lane CHAIR-STORE-PERF, 2026-10-03). The store cancels the\n // WHOLE statement at its clock, so a timed-out door wrote nothing — a create, a column add and a page\n // read alike. \"Try a smaller page\" was written for the page read and was printed to a person adding\n // one row to a three-row table (clone walk, 2026-10-03; the clock was a lock another lane's\n // rehearsal held, not the row). A door whose page can shrink says so in its own hint, which wins here.\n // ONE SENTENCE, NOT TWO (lane TIMEOUT-ONE-SENTENCE, 2026-10-19): the shared timed-out sentence (\"That took too long.\n // Nothing was lost; try again.\") already says what happened and what to do, so the table adds NO second remedy\n // (\"Nothing was changed\" was also wrong on a read). Empty = the notice prints no remedy line and the one-line\n // form is the sentence alone. A door's own hint still wins.\n timed_out: \"\",\n internal:\n \"Nothing you did caused this. Try again, and tell us if it keeps happening.\",\n};\n\n/**\n * 🚨 A HINT THIS PACKAGE OR ITS CLIENT WROTE IS NOT A PERSON'S REMEDY.\n *\n * `refusalForAPerson` prefers the DOOR's own hint over the table above, because\n * the door that refused knows more about the way out than a code does. That is\n * right — but it assumed every hint came from the store. It did not: until\n * `@ai-matrx/records` 0.47.0 the client appended its OWN note to `hint` when it\n * met a SQLSTATE it did not know, and the machine-identity filter let it\n * through whenever the code was not exactly five characters (an empty code from\n * a dropped connection, or an HTTP status like `404`). So the Checklists tab of\n * a plumbing company's jobs table told its owner:\n *\n * @ai-matrx/records did not recognize SQLSTATE from checklistTemplates\n *\n * The client no longer writes there. This is the guard on the other side, by\n * SHAPE and not by that one sentence: a hint that talks about a package, a\n * SQLSTATE, or a `camelCaseDoor` is engineer text wherever it came from, and it\n * joins the engineer's line instead of a person's screen.\n */\nexport const ENGINEER_TEXT: RegExp[] = [\n /@ai-matrx\\//,\n /\\bSQLSTATE\\b/i,\n /\\bPostgREST\\b/i,\n /\\bIndexedDB\\b/i,\n // `<RecordsUiProvider>` — a component, on a screen.\n /<\\/?[A-Z][A-Za-z0-9]*\\s*\\/?>/,\n // `savedViews`, `openRecords`, `onReask` — an identifier, however it is\n // quoted. English does not write camelCase; code does.\n /\\b[a-z][a-z0-9]*[A-Z][A-Za-z0-9]*\\b/,\n // A backticked token is a thing you type into an editor, not a thing you do.\n /`[A-Za-z_][A-Za-z0-9_.]*`/,\n // \"bind X on Y\", \"pass X\", \"import X\" — an instruction to whoever maintains\n // the app, arriving on the screen of somebody who cannot act on it.\n /\\bbind\\s+[`'\"A-Za-z]/i,\n];\n\n/**\n * THE ONE GUARD ON A DOOR'S HINT. True when the hint is developer text and must never be\n * printed at a person: engineer shapes (package, SQLSTATE, component, camelCase, backticked\n * token), a code fence, stack-like lines, or a block too long to be one remedy (over 600).\n * Machine clauses INSIDE an otherwise plain hint are cut by `plainSentence`, not by this.\n */\nexport function isDeveloperHint(hint: string): boolean {\n const text = hint.trim();\n if (text === \"\") return false;\n if (text.includes(\"```\")) return true;\n if (/\\n\\s+at\\s+\\S+/.test(text)) return true;\n if (text.length > 600) return true;\n return isEngineerText(text);\n}\n\n/** The hint a person may read: cleaned to people's sentences, or null. The one place that decides. */\nexport function peopleHint(hint: string | null | undefined): string | null {\n const said = (hint ?? \"\").trim();\n if (said === \"\" || isDeveloperHint(said)) return null;\n return plainSentence(said).kept;\n}\n\n/** Whether this sentence was written for whoever maintains the code. */\nexport function isEngineerText(text: string): boolean {\n return ENGINEER_TEXT.some((shape) => shape.test(text));\n}\n\n/** The one shape every screen in this package renders a refusal from. */\nexport interface PlainRefusal {\n /** The heading. Never the store's code. */\n title: string;\n /**\n * What happened, in the store's own words where they are a person's words\n * and in ours where they are not. Never empty.\n */\n sentence: string;\n /** What to do now. Never empty. */\n remedy: string;\n /**\n * TRUE when `sentence` is the store's own words (UI-FIX-19): a notice is then HEADED by that\n * sentence, never by the generic `title` over it.\n */\n storeSaid: boolean;\n /**\n * Everything a person should not read, kept for whoever has to debug it: the\n * SQLSTATE, the hint written for a caller, and any clause dropped above.\n * Kept on the notice's `data-for-engineers` attribute only (UI-FIX-19): never a\n * tooltip, never text a screen can copy or read aloud; never deleted.\n */\n forEngineers: string;\n}\n\n/**\n * A sentence with its machine clauses taken out — or null when nothing honest\n * is left. Clauses are split on the joins the store's own `format()` templates\n * use (\"…, so custom.x may not write to it\", \"… — FLD-11: …\").\n */\nfunction withoutMachineClauses(sentence: string): { kept: string | null; dropped: string[] } {\n const dropped: string[] = [];\n // 🚨 A PARENTHETICAL ID IS EXCISED, NOT A REASON TO BIN THE SENTENCE AROUND IT\n // (lane LIMITS-FIX-UI, 2026-09-21). The store's own way out for a colleague who\n // is not in the organization — \"Invite them to the organization, share with\n // their organization instead (VIS-23), or, if they are a client rather than a\n // colleague, put them in a portal\" — was thrown away WHOLE because of those\n // eight characters, so a plumbing company trying to show one customer her own\n // jobs was told nothing at all about what to do instead. A contract id in\n // brackets is a footnote: lift it out and the sentence around it is a person's\n // sentence. It is still kept for the engineer, below.\n const footnotes: string[] = [];\n const withoutFootnotes = sentence.replace(/\\s*\\((?:see\\s+)?[A-Z]{2,5}-[A-Z0-9-]{1,8}\\)/g, (hit) => {\n footnotes.push(hit.trim());\n return \"\";\n });\n dropped.push(...footnotes);\n const clauses = withoutFootnotes\n .split(/(?:,\\s+so\\s+|\\s+—\\s+|\\s+--\\s+|\\s*\\|\\s*)/)\n .map((clause) => clause.trim())\n .filter((clause) => clause !== \"\");\n const kept = clauses.filter((clause) => {\n if (!isMachineIdentity(clause)) return true;\n dropped.push(clause);\n return false;\n });\n if (kept.length === 0) return { kept: null, dropped };\n // 🚨 A CLEANER THAT DROPPED NOTHING CHANGES NOTHING (same lane, same day).\n //\n // The split above is on the joins the store's `format()` templates use, and\n // \", so \" is one of them — which is also how ordinary English joins two\n // clauses. So \"That person is not in this organization, so they cannot be\n // given access to this table yet.\" came back out as \"That person is not in\n // this organization. they cannot be given access to this table yet.\" — a\n // sentence nobody wrote, with a lower-case word after a full stop, shown to\n // every person every time. Nothing was dropped from it; there was nothing to\n // clean. When that is true the sentence is returned exactly as the store wrote\n // it, and this function's re-joining only ever runs on a sentence it actually\n // took something out of.\n if (dropped.length === 0) return { kept: sentence.trim(), dropped };\n let joined = kept.join(\". \").replace(/\\.\\.+/g, \".\").trim();\n if (!/[.!?]$/.test(joined)) joined = `${joined}.`;\n return { kept: joined, dropped };\n}\n\n/**\n * THE PEOPLE-FACING SENTENCE OF A STORE MESSAGE, AND NOTHING AFTER IT (lane\n * RECORDS-UI-REFUSAL-TEXT, 2026-10-01). A refusal's message is one plain sentence,\n * then ` — ` and developer detail, or a second sentence written for whoever fixes the\n * caller. A person reads the first sentence only; the rest rides `forEngineers`.\n */\nfunction peopleSentence(message: string): { kept: string | null; dropped: string[] } {\n const [lead = \"\", ...tail] = message.split(/\\s+—\\s+|\\s+--\\s+/);\n // A full stop after an abbreviation or an initial (\"Ask Dr. Whitfield\", \"e.g. a quote\") is not an end.\n const sentences = lead.trim().split(/(?<=(?<!\\b(?:Dr|Mr|Mrs|Ms|St|vs|No|e\\.g|i\\.e|etc|[A-Z]))[.!?])\\s+/);\n const first = sentences[0] ?? \"\";\n const rest = [...sentences.slice(1), ...tail].map((part) => part.trim()).filter((part) => part !== \"\");\n const cleaned = plainSentence(first);\n return { kept: cleaned.kept, dropped: [...cleaned.dropped, ...rest] };\n}\n\n/**\n * THE ONE SENTENCE A PERSON READS FOR A REFUSAL — the store's first sentence, or the\n * title when nothing of it is a person's words. Never the hint, details, code or\n * SQLSTATE. Every place that needs a refusal as a string (a toast, a cell, a banner)\n * calls this and nothing else; `check:records-ui-refusal-text` fails on a raw\n * `error.message` / `error.hint` render anywhere else.\n */\nexport function refusalSentence(error: Pick<RecordsError, \"message\"> & Partial<RecordsError>): string {\n return refusalForAPerson(error as RecordsError).sentence;\n}\n\n// A BUILD LABEL OPENING A SENTENCE (lane CLOSE-LINK, CD-LINK-07): the acceptance test or the lane/rule tag the store was\n// built against — \"Test 3 (Reparent):\", \"REC-21:\", \"T5 / VAL-4:\", \"CLOSE-LINK:\". A person never reads it, and it is\n// never a reason to drop the remedy after it (which is what the machine-identity filter did to the whole sentence).\nconst BUILD_LABEL = String.raw`(?:Test \\d+ \\([^)]{1,40}\\)|[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+|[A-Z]{1,5}\\d+[a-z]?)`;\nconst LEADING_BUILD_LABEL = new RegExp(String.raw`^${BUILD_LABEL}(?:\\s*\\/\\s*${BUILD_LABEL})*:\\s+`);\n\n/** The sentence with any build label lifted off its start, the label kept for engineers. */\nfunction withoutBuildLabel(sentence: string): { label: string | null; rest: string } {\n const hit = LEADING_BUILD_LABEL.exec(sentence);\n if (!hit) return { label: null, rest: sentence };\n const rest = sentence.slice(hit[0].length).trim();\n return { label: hit[0].trim(), rest: rest.charAt(0).toUpperCase() + rest.slice(1) };\n}\n\n/** Every sentence of a message, cleaned; the ones that cannot be cleaned are dropped. */\nfunction plainSentence(message: string): { kept: string | null; dropped: string[] } {\n const dropped: string[] = [];\n const kept: string[] = [];\n for (const raw of message.split(/(?<=[.!?])\\s+/)) {\n const labelled = withoutBuildLabel(raw.trim());\n if (labelled.label) dropped.push(labelled.label);\n const sentence = labelled.rest;\n if (sentence === \"\") continue;\n const cleaned = withoutMachineClauses(sentence);\n dropped.push(...cleaned.dropped);\n if (cleaned.kept) kept.push(cleaned.kept);\n }\n return { kept: kept.length === 0 ? null : kept.join(\" \"), dropped };\n}\n\n/** A remedy is a sentence, not the one word left after a build label was lifted off (\"FLD-1: text.\" keeps \"Text.\"). */\nfunction readsAsASentence(text: string | null): boolean {\n return (text ?? \"\").trim().split(/\\s+/).filter(Boolean).length >= 2;\n}\n\n/** The example a pattern refusal carries in its detail, when it carries one. */\nfunction exampleOf(error: RecordsError): string | null {\n const detail = (error as { detail?: unknown }).detail;\n if (!detail || typeof detail !== \"object\") return null;\n const example = (detail as { example?: unknown }).example;\n return typeof example === \"string\" && example.trim() !== \"\" ? example.trim() : null;\n}\n\n/** What a statement timeout says of itself, in place of the database's own words. */\n// ONE SENTENCE EVERYWHERE: the same words as design-system's `TIMED_OUT_SENTENCE` (what every screen prints through\n// `refusalSaid`) and records' `TIMED_OUT_MESSAGE`. This file is the light helpers door, so it cannot import either\n// (design-system's root is heavy); `a-timeout-reads-as-the-platforms-sentence.test.tsx` fails if the three drift.\nconst TIMED_OUT_SAID = \"That took too long. Nothing was lost; try again.\";\n\n/**\n * THE FORMATTER. Every refusal a screen in this package shows goes through\n * here, and nothing in this package renders `error.message` directly.\n */\nexport function refusalForAPerson(error: RecordsError): PlainRefusal {\n const code = error.code ?? \"internal\";\n // A STATEMENT TIMEOUT is the database's words, never a person's (AT-SNAPJOB-2, 2026-10-19: a base rename showed\n // \"canceling statement due to statement timeout\"). Whatever way it arrived (the package's `timed_out`, SQLSTATE\n // 57014, or only Postgres' sentence on an error with no code) it reads as the timed-out refusal: its title and\n // remedy below, and a sentence of our own in place of the database's.\n const timedOut =\n code === \"timed_out\" ||\n (error as { sqlstate?: string }).sqlstate === \"57014\" ||\n /canceling statement due to statement timeout/i.test(String(error.message ?? \"\"));\n // A refusal THIS package wrote (`refusals.ts` marks it `ours`) is whole people-facing prose, a\n // count then a reason; only a door's message is cut after its first sentence.\n const ours = (error as { ours?: unknown }).ours === true;\n const hint = plainSentence(String(error.hint ?? \"\"));\n const message = ours ? plainSentence(String(error.message ?? \"\")) : peopleSentence(String(error.message ?? \"\"));\n\n const title = timedOut ? TITLE[\"timed_out\"]! : (TITLE[code] ?? \"That was refused\");\n\n // 🚨 ONE REMEDY, AND IT IS THE DOOR'S OWN WHEN THE DOOR HAS ONE (lane\n // LIMITS-FIX-UI, 2026-09-21).\n //\n // The table below is a FALLBACK, not an answer. `custom.share_grant` refuses a\n // colleague who is not in the organization with its own three ways forward —\n // *\"Invite them to the organization, share with their organization instead, or,\n // if they are a client rather than a colleague, put them in a portal\"* — and\n // this formatter used to print that AND then \"Change the value so it passes,\n // then try again\", which is not a thing anybody can do about a membership. Two\n // remedies, one of them wrong, is worse than one: a person follows the last\n // sentence they read. The door that refused knows more about the way out than\n // a table keyed on a code does, so its hint wins whenever it survived the\n // machine-identity filter, and the table answers when it did not.\n // 🚨 THE DOOR'S HINT IS THE REMEDY WHEN IT READS AS A PERSON'S SENTENCE (chair ruling,\n // 2026-10-01, restoring the 2026-09-21 one-remedy ruling). A hint that is developer text (a\n // SQL state, a snake_case name, a uuid, a code fence, a stack, a package or component name)\n // is never printed: it rides `forEngineers` and the code's table sentence is the remedy.\n const hintIsForEngineers = isDeveloperHint(String(error.hint ?? \"\"));\n // STORE-RULE-GAPS: a pattern that carries an example hands it over as DATA\n // (`detail.example`), because an example is the person's own shape of value.\n const example = exampleOf(error);\n const remedy =\n (example ? `Enter it like ${example}.` : null) ??\n (hintIsForEngineers || !readsAsASentence(hint.kept) ? null : hint.kept) ??\n (timedOut ? REMEDY[\"timed_out\"] : REMEDY[code]) ??\n REMEDY[\"internal\"]!;\n\n // The store's own sentence for what happened. Its hint is the REMEDY above\n // rather than more of this, so the two halves never say the same thing twice.\n // A STORE MESSAGE IS NEVER ENGINEER TEXT; a stand-in written by a client can\n // be, and a person must not read it. It still reaches the engineer's line.\n const messageIsForEngineers = isEngineerText(String(error.message ?? \"\"));\n const said = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? \"\" : (message.kept ?? \"\")).trim();\n\n const forEngineers = [\n error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,\n // The client's own note about a class it did not recognize, or a call that\n // never reached the store. It is rendered out of sight, never as a sentence.\n error.diagnostic ? error.diagnostic : null,\n messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,\n error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,\n message.dropped.length > 0 || hint.dropped.length > 0\n ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(\" | \")}`\n : null,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return {\n title,\n // Nothing invented. When every clause was machine identity the title says\n // what happened and the remedy says what to do; a made-up diagnosis would\n // be worse than the identifier it replaced.\n sentence: said === \"\" ? `${title}.` : said,\n remedy,\n storeSaid: said !== \"\",\n forEngineers,\n };\n}\n\n/**\n * The same answer as one line, for a cell or a field where a block would break\n * the layout. Still one sentence and one remedy — never the sentence alone,\n * because half of this formatter's job is the thing to do next.\n */\nexport function refusalLineForAPerson(error: RecordsError): string {\n const plain = refusalForAPerson(error);\n // TWO SENTENCES, NOT ONE RUN-ON (VERIFIER-15/16): the store's rule message has no\n // full stop (\"Pressure (psi) has to be at least 0\"), and joining it to the remedy\n // read \"…at least 0 Send this column somewhere else\". A line ends its sentence.\n const sentence = plain.sentence.trim();\n const ended = sentence === \"\" || /[.!?…:]$/.test(sentence) ? sentence : `${sentence}.`;\n return `${ended} ${plain.remedy}`.trim();\n}\n\n/** The store refused because the request was missing something (22023 / invalid_argument): a decision, never text to print. */\nexport function refusalIsMissingInput(error: Partial<RecordsError>): boolean {\n return error.sqlstate === \"22023\" || error.code === \"invalid_argument\";\n}\n\n/**\n * A STORED SENTENCE WITHOUT ITS INTERNAL CODES (lane F2, D11). The store's older sentences — a kept-aside\n * reason, a migration note — end with the spec codes they were written against (\"(FLD-4 / T12)\",\n * \"(VAL-1)\"). Those codes are for the people who wrote the store; the store no longer writes them, and the\n * ones already saved come off here, wherever a person reads them.\n */\nexport function withoutInternalCodes(text: string): string {\n return text\n // a leading \"STORE-TAILS-4: \" is the same kind of code, written in front instead of behind\n .replace(/^(?:[A-Z]{2,}-)+\\d+[A-Za-z]?:\\s*/, \"\")\n .replace(/\\s*\\((?:[A-Z]{2,}-\\d+[A-Za-z]?|T\\d+)(?:\\s*\\/\\s*(?:[A-Z]{2,}-\\d+[A-Za-z]?|T\\d+))*\\)/g, \"\")\n .replace(/\\s+([.,;])/g, \"$1\")\n .trim();\n}\n"],"mappings":";;;AA+DO,IAAM,mBAA6B;AAAA,EACxC;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AACF;AAGO,SAAS,kBAAkB,MAAuB;AACvD,SAAO,iBAAiB,KAAK,CAAC,UAAU,MAAM,KAAK,IAAI,CAAC;AAC1D;AAMO,SAAS,kBAAkB,MAAwB;AACxD,QAAM,QAAkB,CAAC;AACzB,aAAW,SAAS,kBAAkB;AACpC,UAAM,MAAM,IAAI,OAAO,MAAM,QAAQ,MAAM,MAAM,SAAS,GAAG,IAAI,MAAM,QAAQ,GAAG,MAAM,KAAK,GAAG;AAChG,eAAW,OAAO,KAAK,SAAS,GAAG,EAAG,KAAI,IAAI,CAAC,EAAG,OAAM,KAAK,IAAI,CAAC,CAAC;AAAA,EACrE;AACA,SAAO,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC;AAC3B;AAGA,IAAM,QAAgC;AAAA,EACpC,aAAa;AAAA,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,QAAQ,SAAS,MAAM,IAAI,KAAK;AAAA,IACzF,QAAQ,QAAQ,SAAS,KAAK,KAAK,QAAQ,SAAS,IAChD,mCAAmC,CAAC,GAAG,QAAQ,SAAS,GAAG,KAAK,OAAO,EAAE,KAAK,KAAK,CAAC,KACpF;AAAA,EACN,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAIA,UAAU,SAAS,KAAK,GAAG,KAAK,MAAM;AAAA,IACtC;AAAA,IACA,WAAW,SAAS;AAAA,IACpB;AAAA,EACF;AACF;AAOO,SAAS,sBAAsB,OAA6B;AACjE,QAAM,QAAQ,kBAAkB,KAAK;AAIrC,QAAM,WAAW,MAAM,SAAS,KAAK;AACrC,QAAM,QAAQ,aAAa,MAAM,WAAW,KAAK,QAAQ,IAAI,WAAW,GAAG,QAAQ;AACnF,SAAO,GAAG,KAAK,IAAI,MAAM,MAAM,GAAG,KAAK;AACzC;AAGO,SAAS,sBAAsB,OAAuC;AAC3E,SAAO,MAAM,aAAa,WAAW,MAAM,SAAS;AACtD;AAQO,SAAS,qBAAqB,MAAsB;AACzD,SAAO,KAEJ,QAAQ,oCAAoC,EAAE,EAC9C,QAAQ,uFAAuF,EAAE,EACjG,QAAQ,eAAe,IAAI,EAC3B,KAAK;AACV;","names":[]}
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
useRecordsUi,
|
|
28
28
|
useTableRights,
|
|
29
29
|
writeOnTheWinningVersion_exports
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-5RU7BPCU.js";
|
|
31
31
|
import {
|
|
32
32
|
guessColumn,
|
|
33
33
|
readTableShapes,
|
|
@@ -5206,4 +5206,4 @@ export {
|
|
|
5206
5206
|
shapesOfSource,
|
|
5207
5207
|
SaveToTable
|
|
5208
5208
|
};
|
|
5209
|
-
//# sourceMappingURL=chunk-
|
|
5209
|
+
//# sourceMappingURL=chunk-B7A3B6F4.js.map
|