suppa-mcp-2 1.42.6 → 1.43.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/README.md +4 -2
- package/dist/httpClient.js +2 -2
- package/dist/server.js +121 -45
- package/dist/toolTable.js +2 -2
- package/dist/tools/automation.js +82 -4
- package/dist/tools/docs.js +5 -1
- package/dist/tools/entity.js +68 -0
- package/dist/tools/formLifecycle.js +103 -13
- package/dist/tools/formV2.js +297 -15
- package/dist/tools/migrate.js +1 -1
- package/dist/tools/query.js +129 -50
- package/dist/tools/queryAnalyze.js +617 -0
- package/dist/tools/sqlKb.js +324 -0
- package/dist/tools/tasks.js +12 -2
- package/dist/utils.js +10 -3
- package/dist/version.js +24 -0
- package/package.json +7 -1
- package/skills/suppa-cli/SKILL.md +1 -1
- package/skills/suppa-entity-code/SKILL.md +55 -17
- package/skills/suppa-entity-code/references/enforcement.md +1 -1
- package/skills/suppa-entity-code/references/entities.md +11 -7
- package/skills/suppa-entity-code/references/form-seeds.md +106 -0
- package/skills/suppa-entity-code/references/permission-seeds.md +122 -0
- package/skills/suppa-entity-code/references/registration.md +6 -4
- package/skills/suppa-entity-code/references/runtime.md +72 -9
- package/skills/suppa-entity-code/references/seeds.md +13 -4
- package/skills/suppa-entity-code/references/v1-mapping.md +1 -1
- package/skills/suppa-entity-code/scripts/house-rules.mjs +11 -5
- package/skills/suppa-entity-code/scripts/validate-suppa-schema.mjs +613 -40
- package/skills/suppa-entity-code/templates/AGENTS.entity-code.md +6 -4
- package/skills/suppa-entity-code/templates/entity-extension.template.ts +1 -1
- package/skills/suppa-entity-code/templates/entity.template.ts +16 -12
- package/skills/suppa-entity-code/templates/seed.template.ts +6 -10
- package/skills/suppa-form-v2/CARD_KIT.json +53 -0
- package/skills/suppa-form-v2/CELL_RULES.json +31 -0
- package/skills/suppa-form-v2/SKILL.md +71 -57
- package/skills/suppa-form-v2/SOURCE.json +4 -4
- package/skills/suppa-form-v2/assets/card-kit/form-639.json +8877 -0
- package/skills/suppa-form-v2/data/base-props.json +12 -0
- package/skills/suppa-form-v2/data/cell-widget-rules.fixtures.json +299 -0
- package/skills/suppa-form-v2/data/component-index.json +7 -19
- package/skills/suppa-form-v2/data/component-props.json +331 -51
- package/skills/suppa-form-v2/data/templates/entity-workspace.json +11 -0
- package/skills/suppa-form-v2/data/templates/hero-registration.json +1 -0
- package/skills/suppa-form-v2/data/templates/kpi-dashboard.json +268 -48
- package/skills/suppa-form-v2/data/templates/list-management.json +11 -0
- package/skills/suppa-form-v2/data/templates/record-detail-side-panel.json +74 -8
- package/skills/suppa-form-v2/data/templates/simple-form.json +59 -3
- package/skills/suppa-form-v2/data/templates/tabbed-settings.json +114 -7
- package/skills/suppa-form-v2/data/templates/wizard.json +30 -0
- package/skills/suppa-form-v2/notes/chart.md +4 -4
- package/skills/suppa-form-v2/notes/dynamicComponent.md +159 -0
- package/skills/suppa-form-v2/notes/table.md +2 -0
- package/skills/suppa-form-v2/references/binding.md +8 -2
- package/skills/suppa-form-v2/references/card-kit.md +258 -0
- package/skills/suppa-form-v2/references/charts.md +32 -7
- package/skills/suppa-form-v2/references/choosing-elements.md +2 -2
- package/skills/suppa-form-v2/references/custom-chart.md +77 -19
- package/skills/suppa-form-v2/references/layout.md +15 -1
- package/skills/suppa-form-v2/references/publishing.md +15 -0
- package/skills/suppa-form-v2/references/styling.md +42 -6
- package/skills/suppa-form-v2/references/tables.md +48 -3
- package/skills/suppa-form-v2/scripts/card-kit/card-check.mjs +136 -0
- package/skills/suppa-form-v2/scripts/card-kit/card-kit.mjs +181 -0
- package/skills/suppa-form-v2/scripts/card-kit/kit-form.mjs +167 -0
- package/skills/suppa-form-v2/scripts/cell-rules.mjs +35 -0
- package/skills/suppa-form-v2/scripts/form-core.mjs +2310 -549
- package/skills/suppa-form-v2/scripts/form-rules.mjs +20 -8
- package/skills/suppa-form-v2/scripts/validate-form-schema.mjs +1137 -21
- package/skills/suppa-form-v2/scripts/widget-code.mjs +691 -20
- package/skills/writing-suppa-sql/SKILL.md +175 -0
- package/skills/writing-suppa-sql/SOURCE.json +28 -0
- package/skills/writing-suppa-sql/references/actions.md +53 -0
- package/skills/writing-suppa-sql/references/analytics.md +121 -0
- package/skills/writing-suppa-sql/references/http-api.md +78 -0
- package/skills/writing-suppa-sql/references/language.md +429 -0
- package/skills/writing-suppa-sql/references/performance.md +256 -0
- package/skills/writing-suppa-sql/references/practices.md +165 -0
- package/skills/writing-suppa-sql/references/unsupported.md +111 -0
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ No API key needed to start — the server authenticates interactively via the `s
|
|
|
30
30
|
|
|
31
31
|
## The `suppa` command
|
|
32
32
|
|
|
33
|
-
The same
|
|
33
|
+
The same 106 operations the MCP server exposes are available as a command, for
|
|
34
34
|
shells, scripts and CI:
|
|
35
35
|
|
|
36
36
|
```bash
|
|
@@ -414,7 +414,7 @@ extension table is created outside that check and is not subject to it.
|
|
|
414
414
|
|
|
415
415
|
## Available tools
|
|
416
416
|
|
|
417
|
-
|
|
417
|
+
106 tools across the areas below.
|
|
418
418
|
|
|
419
419
|
### Session & identity
|
|
420
420
|
|
|
@@ -482,6 +482,8 @@ extension table is created outside that check and is not subject to it.
|
|
|
482
482
|
| `suppa_search_records` | Search / filter records in any entity — nested AND/OR groups, auto-diagnoses an empty result (`deleted_scope` finds soft-deleted rows) |
|
|
483
483
|
| `suppa_validate_select` | Check a select/filter payload against the entity without running it — names the field that does not resolve |
|
|
484
484
|
| `suppa_query` | Run one read-only SuppaSQL statement (SELECT/WITH) with the caller's read permissions — check a SQL chart or table source before writing the form |
|
|
485
|
+
| `suppa_sql_kb` | The SuppaSQL skill offline (`skills/writing-suppa-sql`): rules, cheat sheet, common mistakes, references by section, and `check` — what the platform refuses and the measured slow shapes a draft's text shows |
|
|
486
|
+
| `suppa_query_analyze` | One analysis of a final query: its plan for you and every role, the tables' storage and indexes, the index / rewrite actions to propose (none applied). Plan only; needs `DATABASE_ANALYTICS.VIEW` |
|
|
485
487
|
| `suppa_get_record` | Get a single record (`deleted_scope` reads a soft-deleted one) |
|
|
486
488
|
| `suppa_create_entity` | Create a new entity (`options_json`: comments / globalSearch / hierarchy …) |
|
|
487
489
|
| `suppa_create_tabular_part` | Create a tabular part (owned rows) of a parent |
|
package/dist/httpClient.js
CHANGED
|
@@ -314,7 +314,7 @@ async function sendWithReauth(ctx, buildHeaders, method, url, data, timeout, opt
|
|
|
314
314
|
}
|
|
315
315
|
let refreshed = false;
|
|
316
316
|
let transientRetried = false;
|
|
317
|
-
const retriable = isSafeRequest(method, url);
|
|
317
|
+
const retriable = opts.retryTransient !== false && isSafeRequest(method, url);
|
|
318
318
|
// eslint-disable-next-line no-constant-condition
|
|
319
319
|
while (true) {
|
|
320
320
|
const token = ctx.getToken();
|
|
@@ -574,7 +574,7 @@ export async function makeRequest(method, path, body = null, opts = {}) {
|
|
|
574
574
|
data = JSON.stringify(body);
|
|
575
575
|
extra["Content-Type"] = "application/json; charset=UTF-8";
|
|
576
576
|
}
|
|
577
|
-
return sendWithReauth(ctx, (t) => headers(ctx, t, extra), method, url, data, timeout, { unwrap: !opts.raw });
|
|
577
|
+
return sendWithReauth(ctx, (t) => headers(ctx, t, extra), method, url, data, timeout, { unwrap: !opts.raw, retryTransient: opts.retryTransient });
|
|
578
578
|
}
|
|
579
579
|
/** Make a raw-bytes request (for multipart uploads). */
|
|
580
580
|
export async function makeRequestRawBytes(method, path, data, contentType, opts = {}) {
|
package/dist/server.js
CHANGED
|
@@ -26,12 +26,14 @@ import * as migrate from "./tools/migrate.js";
|
|
|
26
26
|
import * as workspace from "./tools/workspace.js";
|
|
27
27
|
import * as automation from "./tools/automation.js";
|
|
28
28
|
import * as query from "./tools/query.js";
|
|
29
|
+
import * as sqlKb from "./tools/sqlKb.js";
|
|
30
|
+
import * as queryAnalyze from "./tools/queryAnalyze.js";
|
|
29
31
|
import * as auth from "./auth.js";
|
|
30
32
|
import * as tenants from "./tenants.js";
|
|
31
33
|
import { confirmRequired, jsonResponse } from "./utils.js";
|
|
32
34
|
import { suggestName } from "./cli/flags.js";
|
|
33
35
|
import { installToolsListEconomy } from "./toolsListEconomy.js";
|
|
34
|
-
import { PACKAGE_NAME, PACKAGE_VERSION, knownLatest, isOutdated, refreshLatestVersion, upgradeNotice, } from "./version.js";
|
|
36
|
+
import { PACKAGE_CAPABILITIES, PACKAGE_NAME, PACKAGE_VERSION, knownLatest, isOutdated, refreshLatestVersion, upgradeNotice, } from "./version.js";
|
|
35
37
|
export { PACKAGE_VERSION };
|
|
36
38
|
// ---------------------------------------------------------------------------
|
|
37
39
|
// Tool-behavior hints (MCP spec): clients use these for auto-approval policies.
|
|
@@ -624,7 +626,7 @@ export function buildToolTable() {
|
|
|
624
626
|
name: z
|
|
625
627
|
.string()
|
|
626
628
|
.default("")
|
|
627
|
-
.describe("
|
|
629
|
+
.describe("Words of the full name, any order; returned ids feed assigned_to_id and mentions."),
|
|
628
630
|
limit: z.number().int().default(20),
|
|
629
631
|
},
|
|
630
632
|
annotations: _READ,
|
|
@@ -643,7 +645,7 @@ export function buildToolTable() {
|
|
|
643
645
|
fields_json: FieldsJsonOpt,
|
|
644
646
|
},
|
|
645
647
|
annotations: _READ,
|
|
646
|
-
}, async (a) => text(await docs.listDocs(a.search, a.limit)));
|
|
648
|
+
}, async (a) => text(await docs.listDocs(a.search, a.limit, a.fields_json ?? null)));
|
|
647
649
|
reg("suppa_get_doc", {
|
|
648
650
|
description: "Get a document by ID including its page tree, or only fields_json.",
|
|
649
651
|
inputSchema: { doc_id: z.number().int(), fields_json: FieldsJsonOpt },
|
|
@@ -944,8 +946,10 @@ export function buildToolTable() {
|
|
|
944
946
|
}, async (a) => text(await entity.listTabularParts(a.entity_name)));
|
|
945
947
|
reg("suppa_search_records", {
|
|
946
948
|
description: "Search records of any entity. filters_json: [{field, value, comparator}]. fields_json: {field: true}.\n" +
|
|
947
|
-
" Comparators: =, !=, <, >, <=, >=, like, in,
|
|
948
|
-
"
|
|
949
|
+
" Comparators: =, !=, <, >, <=, >=, like, not like, in, not in, between, not between,\n" +
|
|
950
|
+
" is null, is not null. 'like' is a case-insensitive CONTAINS — send the bare text; the\n" +
|
|
951
|
+
" platform adds % and escapes yours, so 'LMS.%' matches nothing. 'in' takes a JSON array,\n" +
|
|
952
|
+
" 'between' [from, to] or a period like \"$this_month\". Field paths may be dotted —\n" +
|
|
949
953
|
' "stage.status.value", "owner.id" — and the value "$current-user" resolves to the\n' +
|
|
950
954
|
" signed-in user's id.\n" +
|
|
951
955
|
" match_any=true combines filters with OR instead of AND.\n" +
|
|
@@ -967,7 +971,7 @@ export function buildToolTable() {
|
|
|
967
971
|
filters_json: z
|
|
968
972
|
.string()
|
|
969
973
|
.default("[]")
|
|
970
|
-
.describe('JSON array of filters: [{"field": "status.value", "value": "active", "comparator": "="}]. \'like\'
|
|
974
|
+
.describe('JSON array of filters: [{"field": "status.value", "value": "active", "comparator": "="}]. \'like\' = contains, bare text, no %; dotted paths allowed. ' +
|
|
971
975
|
'An entry may also be a NESTED GROUP {"operator": "and"|"or", "filters": [...]} (shorthand {"or": [...]}), so (a AND b) OR c is one call.'),
|
|
972
976
|
fields_json: ProjectionJson.default('{"id": true}'),
|
|
973
977
|
limit: z.number().int().default(20),
|
|
@@ -1020,17 +1024,21 @@ export function buildToolTable() {
|
|
|
1020
1024
|
description: "Run ONE read-only SuppaSQL statement — POST /core/data/query, the endpoint the\n" +
|
|
1021
1025
|
" builder's SQL charts and tables use. Check a chart/table SQL source with it before\n" +
|
|
1022
1026
|
" writing the form: an incomplete one shows demo data, a wrong one fails at runtime.\n\n" +
|
|
1023
|
-
" SELECT / WITH only, one statement
|
|
1024
|
-
" Runs with the caller's read permissions; deleted rows are
|
|
1025
|
-
" is added and a bigger literal one clamped, so at most `limit
|
|
1026
|
-
" `truncated` and `columns` — the
|
|
1027
|
-
" (owner.firstName): a TABLE column's key.
|
|
1028
|
-
"
|
|
1029
|
-
"
|
|
1027
|
+
" SELECT / WITH only, one statement, no comments (SuppaSQL has none); anything else is\n" +
|
|
1028
|
+
" refused and nothing is sent. Runs with the caller's read permissions; deleted rows are\n" +
|
|
1029
|
+
" excluded. A missing LIMIT is added and a bigger literal one clamped, so at most `limit`\n" +
|
|
1030
|
+
" rows come back, with `truncated` and `columns` — the keys of every row, nested ones as\n" +
|
|
1031
|
+
" dot paths (owner.firstName): a TABLE column's key. `chart_note` says when the same\n" +
|
|
1032
|
+
" text fails as a CHART source: a chart needs LIMIT 10000 or less (it sends LIMIT 10001,\n" +
|
|
1033
|
+
" refused with query.row_limit). A CHART's sqlCategoryColumn / sqlValueColumns[].key is a\n" +
|
|
1034
|
+
" field's last segment (firstName) or the alias of a COMPUTED item (COUNT, CASE,\n" +
|
|
1035
|
+
" TO_CHAR…); never alias a plain field in a chart query — the chart reads it by its path\n" +
|
|
1036
|
+
" and shows nothing. Writing one: suppa_sql_kb (check a draft offline first); slow, or\n" +
|
|
1037
|
+
" failing for some role: suppa_query_analyze, once.",
|
|
1030
1038
|
inputSchema: {
|
|
1031
1039
|
query: z
|
|
1032
1040
|
.string()
|
|
1033
|
-
.describe('The SuppaSQL statement, e.g. SELECT "stage.name"
|
|
1041
|
+
.describe('The SuppaSQL statement, e.g. SELECT "stage.name", COUNT("id") AS "n" FROM Tasks GROUP BY "stage.name" LIMIT 100 — as a chart: sqlCategoryColumn "name", sqlValueColumns [{"key": "n"}].'),
|
|
1034
1042
|
bind_params_json: z
|
|
1035
1043
|
.string()
|
|
1036
1044
|
.optional()
|
|
@@ -1045,6 +1053,50 @@ export function buildToolTable() {
|
|
|
1045
1053
|
},
|
|
1046
1054
|
annotations: _READ,
|
|
1047
1055
|
}, async (a) => text(await query.runQuery(a.query, a.bind_params_json ?? null, a.limit)));
|
|
1056
|
+
reg("suppa_sql_kb", {
|
|
1057
|
+
description: "The SuppaSQL skill (skills/writing-suppa-sql): write, check and tune a query for\n" +
|
|
1058
|
+
" suppa_query, a chart / table SQL source or an application. Offline; touches no tenant.\n\n" +
|
|
1059
|
+
" rules the cycle, request discipline, the five rules cheatsheet goal → query\n" +
|
|
1060
|
+
" mistakes common mistakes and their fix\n" +
|
|
1061
|
+
" check a draft's TEXT: what the platform refuses ($now, CURRENT_DATE, LEFT JOIN,\n" +
|
|
1062
|
+
" LIMIT > 10000…) and the measured slow shapes it shows (P1–P14)\n" +
|
|
1063
|
+
" ref topic language|unsupported|performance|practices|analytics|actions|http-api,\n" +
|
|
1064
|
+
" section = a heading (e.g. P14); a long topic without one lists its sections",
|
|
1065
|
+
inputSchema: {
|
|
1066
|
+
mode: z.enum(["rules", "cheatsheet", "mistakes", "check", "ref"]).describe("Which part of the skill to read, or 'check' a draft."),
|
|
1067
|
+
topic: z.string().optional().describe("mode='ref': the reference. Omit to list them with their sections."),
|
|
1068
|
+
section: z.string().optional().describe("mode='ref': words of a heading ('P14', 'Bind parameters'); '*' = the whole reference."),
|
|
1069
|
+
query: z.string().optional().describe("mode='check': the SuppaSQL text."),
|
|
1070
|
+
bind_params_json: z.string().optional().describe("mode='check': the bind values you will send, so a bound $name is not flagged."),
|
|
1071
|
+
},
|
|
1072
|
+
annotations: _READ,
|
|
1073
|
+
}, async (a) => text(await sqlKb.sqlKb(a.mode, a.topic ?? null, a.section ?? null, a.query ?? null, a.bind_params_json ?? null)));
|
|
1074
|
+
reg("suppa_query_analyze", {
|
|
1075
|
+
description: "ONE analysis of a FINAL SuppaSQL query on the active tenant: the plan for you and for every\n" +
|
|
1076
|
+
" role (× the full-rights cost, the access rules' share, the roles it FAILS for), the size\n" +
|
|
1077
|
+
" and indexes of the tables it reads, and the actions to PROPOSE — create / rebuild / drop an\n" +
|
|
1078
|
+
" index, rewrite the query; none is applied. Plan only: nothing runs unless run_query=true.\n" +
|
|
1079
|
+
" Needs the owner group or DATABASE_ANALYTICS.VIEW. Up to 13 requests; /query-analyze allows\n" +
|
|
1080
|
+
" 10 calls a minute per user — iterate on drafts with suppa_sql_kb mode='check', analyse the\n" +
|
|
1081
|
+
" final one once. On a rate limit it stops and reports what it has: do not repeat it.",
|
|
1082
|
+
inputSchema: {
|
|
1083
|
+
query: z.string().describe("The SuppaSQL statement, as the chart, table or application sends it."),
|
|
1084
|
+
bind_params_json: z.string().optional().describe('JSON object of bind values for $name, e.g. {"from": "2026-10-01"}.'),
|
|
1085
|
+
run_query: z
|
|
1086
|
+
.boolean()
|
|
1087
|
+
.default(false)
|
|
1088
|
+
.describe("true RUNS the query on the tenant's database (EXPLAIN ANALYZE, rolled back) for real numbers — only when the user asked."),
|
|
1089
|
+
role_plans: z
|
|
1090
|
+
.number()
|
|
1091
|
+
.int()
|
|
1092
|
+
.min(0)
|
|
1093
|
+
.max(queryAnalyze.MAX_ROLE_PLANS)
|
|
1094
|
+
.default(queryAnalyze.MAX_ROLE_PLANS)
|
|
1095
|
+
.describe("Detailed plans for the slowest roles (0-2)."),
|
|
1096
|
+
format: z.enum(["text", "json"]).default("text").describe("text: the report; json: every answer, whole."),
|
|
1097
|
+
},
|
|
1098
|
+
annotations: _READ,
|
|
1099
|
+
}, async (a) => text(await queryAnalyze.analyzeQuery(a.query, a.bind_params_json ?? null, a.run_query ?? false, a.role_plans ?? queryAnalyze.MAX_ROLE_PLANS, a.format ?? "text")));
|
|
1048
1100
|
reg("suppa_get_record", {
|
|
1049
1101
|
description: "Get a single record of any entity by id. fields_json: {field: true} projection —\n" +
|
|
1050
1102
|
' request only the fields you need (relations as nested objects, e.g. {"owner": {"id": true, "fullName": true}}).\n\n' +
|
|
@@ -1744,7 +1796,8 @@ export function buildToolTable() {
|
|
|
1744
1796
|
" returns {created, requested, entity, records} and is validated as a unit:\n" +
|
|
1745
1797
|
" if any record is malformed, nothing is inserted.\n\n" +
|
|
1746
1798
|
' Write relations as {"id": N} and enum fields as {"id": <enumValueId>} —\n' +
|
|
1747
|
-
" a bare number/string returns HTTP 201 but silently stores null."
|
|
1799
|
+
" a bare number/string returns HTTP 201 but silently stores null. A Forms widget with a\n" +
|
|
1800
|
+
" stale compiledRender is refused.",
|
|
1748
1801
|
inputSchema: {
|
|
1749
1802
|
entity_name: EntityName,
|
|
1750
1803
|
fields_json: RecordValuesOrBatchJson,
|
|
@@ -1759,6 +1812,7 @@ export function buildToolTable() {
|
|
|
1759
1812
|
' [{"id": 15}]} makes 15 the ONLY watcher — every other watcher is dropped.\n' +
|
|
1760
1813
|
' To ADD the listed items instead, pass merge_json=["watchers"]; to REMOVE\n' +
|
|
1761
1814
|
' only the listed items, pass unmerge_json=["watchers"].\n\n' +
|
|
1815
|
+
" A form's draft is suppa_write_form_draft; a Forms widget with a stale compiledRender is refused.\n\n" +
|
|
1762
1816
|
" APPROVAL GATE: without confirm=true this returns a confirmation request and changes nothing.",
|
|
1763
1817
|
inputSchema: {
|
|
1764
1818
|
entity_name: EntityName,
|
|
@@ -2162,14 +2216,15 @@ export function buildToolTable() {
|
|
|
2162
2216
|
reg("suppa_publish_automation", {
|
|
2163
2217
|
description: "Publish (activate) an automation — promotes the draft to the live snapshot via\n" +
|
|
2164
2218
|
" the automation-service. Requires the automation-service deployed on the tenant;\n" +
|
|
2165
|
-
" if absent the call 404s and the error is returned
|
|
2166
|
-
"
|
|
2167
|
-
" APPROVAL GATE: without confirm=true
|
|
2219
|
+
" if absent the call 404s and the error is returned. A typed 400 returns\n" +
|
|
2220
|
+
" {published:false, errors, warnings, message}.\n\n" +
|
|
2221
|
+
" APPROVAL GATE: without confirm=true nothing changes; the answer carries the\n" +
|
|
2222
|
+
" draft's pre-flight (E1–E21 run on publish).",
|
|
2168
2223
|
inputSchema: { automation_id: AutomationId, confirm: Confirm },
|
|
2169
2224
|
annotations: _MUT,
|
|
2170
2225
|
}, async (a) => {
|
|
2171
2226
|
if (!a.confirm) {
|
|
2172
|
-
return text(
|
|
2227
|
+
return text(await automation.previewPublishAutomation(a.automation_id));
|
|
2173
2228
|
}
|
|
2174
2229
|
return text(await automation.publishAutomation(a.automation_id));
|
|
2175
2230
|
});
|
|
@@ -2401,7 +2456,8 @@ export function buildToolTable() {
|
|
|
2401
2456
|
annotations: _READ,
|
|
2402
2457
|
}, async (a) => text(await forms.listForms(a.entity_name, a.form_type, a.limit)));
|
|
2403
2458
|
reg("suppa_get_form", {
|
|
2404
|
-
description: "Get a form by ID
|
|
2459
|
+
description: "Get a SUPPA 1.0 form by ID (data.formShema, settings). A 2.x form's draft is the schema\n" +
|
|
2460
|
+
" COLUMN: read Forms or FormVersions (snapshot) with suppa_search_records.",
|
|
2405
2461
|
inputSchema: { form_id: z.number().int() },
|
|
2406
2462
|
annotations: _READ,
|
|
2407
2463
|
}, async (a) => text(await forms.getForm(a.form_id)));
|
|
@@ -2411,7 +2467,7 @@ export function buildToolTable() {
|
|
|
2411
2467
|
" (without entity_name it is refused, rather than creating an empty form).\n" +
|
|
2412
2468
|
" Form names are UNIQUE platform-wide — a duplicate name fails; pick a distinct one.\n" +
|
|
2413
2469
|
"\n SUPPA 1.0 FORM. This writes data.formShema and the v1 field types. A Suppa 2.0\n" +
|
|
2414
|
-
" (entity-builder) form is a different product — the `schema` column,
|
|
2470
|
+
" (entity-builder) form is a different product — the `schema` column, 56 types:\n" +
|
|
2415
2471
|
" use suppa_form_kb and suppa_validate_form_schema.",
|
|
2416
2472
|
inputSchema: {
|
|
2417
2473
|
name: z.string(),
|
|
@@ -2563,6 +2619,7 @@ export function buildToolTable() {
|
|
|
2563
2619
|
' returned JSON includes a URL to open manually. Returns {"status":"ok", ...}\n' +
|
|
2564
2620
|
' on success, or {"error": ...} (e.g. the localhost origin isn\'t whitelisted in\n' +
|
|
2565
2621
|
" the Google OAuth client, or the account isn't a member of that tenant).\n" +
|
|
2622
|
+
" A successful login also makes that tenant the ACTIVE one for every later call.\n" +
|
|
2566
2623
|
" After a successful login, retry whatever the user originally asked for.\n\n" +
|
|
2567
2624
|
" tenant: alias / host / URL (default: the active tenant).",
|
|
2568
2625
|
inputSchema: { tenant: TenantArg.default("") },
|
|
@@ -2581,16 +2638,19 @@ export function buildToolTable() {
|
|
|
2581
2638
|
}, async () => text(tenants.listTenants()));
|
|
2582
2639
|
reg("suppa_form_kb", {
|
|
2583
2640
|
description: "The Suppa 2.0 (entity-builder) FORM knowledge base. Offline; touches no tenant.\n\n" +
|
|
2584
|
-
" components the
|
|
2641
|
+
" components the 56 element types (start here) api prop table for the types you name\n" +
|
|
2585
2642
|
" base props every element supports note one type's BEHAVIOUR\n" +
|
|
2586
2643
|
" ref layout|binding|tables|charts|custom-chart|conditions|styling|publishing|\n" +
|
|
2587
2644
|
" choosing-elements\n" +
|
|
2588
|
-
" template a starting draft by name rules the nine rules and what blocks\n
|
|
2589
|
-
"
|
|
2645
|
+
" template a starting draft by name rules the nine rules and what blocks\n" +
|
|
2646
|
+
" kit the look of every record card, create form, window: the card kit's\n" +
|
|
2647
|
+
" patterns (topic='p_block,…' = their elements); rules: ref card-kit\n" +
|
|
2648
|
+
" note dynamicComponent = the widget contract (sandbox, formAPI, styles, translations)\n\n" +
|
|
2649
|
+
" No mode returns all 56 prop tables: they are ~14,200 tokens stripped, and not carrying\n" +
|
|
2590
2650
|
" them is what this skill is for. Full skill: skills/suppa-form-v2/SKILL.md.",
|
|
2591
2651
|
inputSchema: {
|
|
2592
2652
|
mode: z
|
|
2593
|
-
.enum(["components", "api", "base", "note", "ref", "template", "rules"])
|
|
2653
|
+
.enum(["components", "api", "base", "note", "ref", "template", "rules", "kit"])
|
|
2594
2654
|
.describe("Which part of the knowledge base to read."),
|
|
2595
2655
|
types: z
|
|
2596
2656
|
.array(z.string())
|
|
@@ -2599,7 +2659,7 @@ export function buildToolTable() {
|
|
|
2599
2659
|
topic: z
|
|
2600
2660
|
.string()
|
|
2601
2661
|
.optional()
|
|
2602
|
-
.describe("mode='note'/'ref'/'template': the type,
|
|
2662
|
+
.describe("mode='note'/'ref'/'template'/'kit': the type, topic, template or pattern(s). Omit to list what exists."),
|
|
2603
2663
|
},
|
|
2604
2664
|
annotations: _READ,
|
|
2605
2665
|
}, async (a) => text(await formV2.formKb(a.mode, a.types ?? null, a.topic ?? null)));
|
|
@@ -2608,8 +2668,10 @@ export function buildToolTable() {
|
|
|
2608
2668
|
" The platform form builder's own STRUCTURAL checker: 37 error codes — unknown types and\n" +
|
|
2609
2669
|
" props, bindings that resolve to nothing, malformed geometry and containment, bad option\n" +
|
|
2610
2670
|
" values, collisions. It does NOT carry the authoring lints (an unbound select, an empty\n" +
|
|
2611
|
-
" container, a
|
|
2612
|
-
"
|
|
2671
|
+
" container, a second Save): those live in the source agent's uxVerify pass, which is\n" +
|
|
2672
|
+
" not vendored here. Passing is structural, not editorial. It also refuses chart SQL the\n" +
|
|
2673
|
+
" runtime refuses or reads empty, warns on low contrast and heightless charts, and\n" +
|
|
2674
|
+
" compiles every widget's compiledRender as the builder does.\n\n" +
|
|
2613
2675
|
" FOR AN EDIT PASS baseline_path, the form as it exists on the tenant: the component\n" +
|
|
2614
2676
|
" manifest lags the live platform, so without it the tenant's own props read as errors.\n" +
|
|
2615
2677
|
" Measured on every live form of a dev tenant: 59 of 96 cold, 73 as an edit.\n\n" +
|
|
@@ -2621,14 +2683,18 @@ export function buildToolTable() {
|
|
|
2621
2683
|
baseline_path: z
|
|
2622
2684
|
.string()
|
|
2623
2685
|
.optional()
|
|
2624
|
-
.describe("Absolute path to the CURRENT form, for an edit
|
|
2686
|
+
.describe("Absolute path to the CURRENT form, for an edit: a draft envelope, a one-record suppa_search_records answer, or a FormVersions row with `snapshot`. Omit only for a brand-new form."),
|
|
2625
2687
|
normalize: z
|
|
2626
2688
|
.boolean()
|
|
2627
2689
|
.optional()
|
|
2628
|
-
.describe("Run the repair pipeline
|
|
2690
|
+
.describe("Run the repair pipeline first: it expands theme/styleIntent, re-packs geometry, AND snaps font size, radius, spacing and colour to this gate's own scales — never over a look taken from a design kit or a live form. Default false."),
|
|
2691
|
+
purpose: z
|
|
2692
|
+
.enum(["create", "record"])
|
|
2693
|
+
.optional()
|
|
2694
|
+
.describe("A create form or an existing record's card: the card kit then judges each field's look. Writes take it from the form's type."),
|
|
2629
2695
|
},
|
|
2630
2696
|
annotations: _READ,
|
|
2631
|
-
}, async (a) => text(await formV2.validateFormSchema(a.path, a.baseline_path ?? null, a.normalize ?? false)));
|
|
2697
|
+
}, async (a) => text(await formV2.validateFormSchema(a.path, a.baseline_path ?? null, a.normalize ?? false, a.purpose ?? null)));
|
|
2632
2698
|
reg("suppa_write_form_draft", {
|
|
2633
2699
|
description: "Save a Suppa 2.0 form as a DRAFT on the tenant, through the builder's own save\n" +
|
|
2634
2700
|
" (PUT /core/forms/:id/schema). It never publishes: what others see stays the published\n" +
|
|
@@ -2657,7 +2723,7 @@ export function buildToolTable() {
|
|
|
2657
2723
|
normalize: z
|
|
2658
2724
|
.boolean()
|
|
2659
2725
|
.optional()
|
|
2660
|
-
.describe("Run the repair pipeline before checking AND saving,
|
|
2726
|
+
.describe("Run the repair pipeline (see suppa_validate_form_schema) before checking AND saving — it rewrites a kit's or a live form's fonts, radii and colours to the gate's scales."),
|
|
2661
2727
|
expected_revision: z
|
|
2662
2728
|
.string()
|
|
2663
2729
|
.optional()
|
|
@@ -2667,21 +2733,25 @@ export function buildToolTable() {
|
|
|
2667
2733
|
}, async (a) => text(await formV2.writeFormDraft(a.form_id, a.path, a.confirm ?? false, a.normalize ?? false, a.expected_revision ?? null)));
|
|
2668
2734
|
reg("suppa_create_form_v2", {
|
|
2669
2735
|
description: "Create a Suppa 2.0 form: the row and its draft in one transaction (POST /core/forms/schema),\n" +
|
|
2670
|
-
" as the builder does — isFormBuilderV2 stamped
|
|
2671
|
-
"
|
|
2672
|
-
"
|
|
2673
|
-
"
|
|
2674
|
-
" A
|
|
2736
|
+
" as the builder does — isFormBuilderV2 stamped. The default variable of a form with an\n" +
|
|
2737
|
+
" entity is the record (a relation named after it; a draft's entity-less `submitData`\n" +
|
|
2738
|
+
" default is replaced, and refused if fields bind into it); `submitData` otherwise. A\n" +
|
|
2739
|
+
" draft, nothing is published. `path` (optional) is a draft file, gated against those\n" +
|
|
2740
|
+
" variables. A duplicate name or an unknown entity or folder is refused before any write.\n" +
|
|
2741
|
+
" `workspace` forms inherit the base form: builder only. A dashboard is `custom` with\n" +
|
|
2742
|
+
" folder='dashboards'. A create / update form takes the record-card kit's look\n" +
|
|
2743
|
+
" (suppa_form_kb mode='kit'), judged by `type`. Without confirm=true: the plan only.",
|
|
2675
2744
|
inputSchema: {
|
|
2676
2745
|
name: z.string().describe("Unique on the tenant."),
|
|
2677
2746
|
type: z.enum(formLifecycle.CREATABLE_FORM_TYPES).describe("create / update need an entity; custom may have none."),
|
|
2678
2747
|
entity: z.string().optional().describe("Entity system name the form edits."),
|
|
2679
2748
|
path: z.string().optional().describe("Absolute path to a draft JSON { schema, settings, variables }."),
|
|
2680
2749
|
folder: z.string().optional().describe("FormsFolders alias or id to file the form into."),
|
|
2750
|
+
alias: z.string().optional().describe("Forms.alias — a drill-down details form is chartDetails_<Entity>_<8 hex>."),
|
|
2681
2751
|
confirm: z.boolean().default(false).describe("true = create. Omitted means NO."),
|
|
2682
2752
|
},
|
|
2683
2753
|
annotations: _ADD,
|
|
2684
|
-
}, async (a) => text(await formLifecycle.createFormV2(a.name, a.type, a.entity ?? null, a.path ?? null, a.folder ?? null, a.confirm ?? false)));
|
|
2754
|
+
}, async (a) => text(await formLifecycle.createFormV2(a.name, a.type, a.entity ?? null, a.path ?? null, a.folder ?? null, a.confirm ?? false, false, a.alias ?? null)));
|
|
2685
2755
|
reg("suppa_form_versions", {
|
|
2686
2756
|
description: "A Suppa 2.0 form's published versions (newest first, which one users see), optionally the\n" +
|
|
2687
2757
|
" component diff between two of THIS form's versions, and a summary of the last N draft\n" +
|
|
@@ -2706,10 +2776,11 @@ export function buildToolTable() {
|
|
|
2706
2776
|
form_id: z.number().int(),
|
|
2707
2777
|
action: z.enum(formLifecycle.LIFECYCLE_ACTIONS),
|
|
2708
2778
|
version_id: z.number().int().optional().describe("rollback / promote: the FormVersions id (suppa_form_versions)."),
|
|
2779
|
+
description: z.string().optional().describe("publish / rollback: the new version's description."),
|
|
2709
2780
|
confirm: z.boolean().default(false).describe("true = do it. Omitted means NO."),
|
|
2710
2781
|
},
|
|
2711
2782
|
annotations: _ONCE,
|
|
2712
|
-
}, async (a) => text(await formLifecycle.formLifecycle(a.form_id, a.action, a.version_id ?? null, a.confirm ?? false)));
|
|
2783
|
+
}, async (a) => text(await formLifecycle.formLifecycle(a.form_id, a.action, a.version_id ?? null, a.confirm ?? false, a.description ?? null)));
|
|
2713
2784
|
reg("suppa_validate_entity_code", {
|
|
2714
2785
|
description: "Run the schema gate over an application repo's *.entity.ts / *.seed.ts / module files.\n\n" +
|
|
2715
2786
|
" CALL THIS BEFORE REPORTING ANY ENTITY OR SEED FILE DONE. It is the same checker the\n" +
|
|
@@ -2722,7 +2793,7 @@ export function buildToolTable() {
|
|
|
2722
2793
|
" * enum member keys are PascalCase;\n" +
|
|
2723
2794
|
" * no field option may be written at its default (canGroup/canSort/showInTable/\n" +
|
|
2724
2795
|
" editFromTable/canFilter are already true, readOnly/searchable already false);\n" +
|
|
2725
|
-
" * @Enum/@MultiEnum take a global name ONLY when
|
|
2796
|
+
" * @Enum/@MultiEnum take a global name ONLY when another entity shares the enum;\n" +
|
|
2726
2797
|
" * a relation target that already exists on the tenant gets a STUB — @Entity({name,key})\n" +
|
|
2727
2798
|
" + extends SystemBaseEntity, EMPTY body, its own file, registered in forFeature();\n" +
|
|
2728
2799
|
" a bare 'export class Accounts {}' registers nothing (E116), and stubs sharing a file\n" +
|
|
@@ -2748,7 +2819,7 @@ export function buildToolTable() {
|
|
|
2748
2819
|
strict: z
|
|
2749
2820
|
.boolean()
|
|
2750
2821
|
.default(true)
|
|
2751
|
-
.describe("true (default): the house rules above (W607/W609-W613, W615,
|
|
2822
|
+
.describe("true (default): the house rules above (W607/W609-W613, W615-W623, W625, W626, W628, W634-W637, W640) fail the gate. false: " +
|
|
2752
2823
|
"they are reported as advisory — for a legacy repo you are not cleaning up in this pass, " +
|
|
2753
2824
|
"never for a file you just wrote. Errors, E116 included, block either way."),
|
|
2754
2825
|
},
|
|
@@ -2760,7 +2831,8 @@ export function buildToolTable() {
|
|
|
2760
2831
|
" missing or behaves the old way: an MCP client keeps whatever version it started with\n" +
|
|
2761
2832
|
" (npx cache / node_modules) for the whole session, so a release changes nothing until\n" +
|
|
2762
2833
|
" the client is restarted on the new package. Reports running, latest, whether an\n" +
|
|
2763
|
-
" upgrade is available,
|
|
2834
|
+
" upgrade is available, the command to run, and capabilities (cellWidgets = the\n" +
|
|
2835
|
+
" form gate checks table cell widgets).",
|
|
2764
2836
|
annotations: _READ,
|
|
2765
2837
|
}, async () => {
|
|
2766
2838
|
// Force a live lookup: this tool is the one place staleness must be
|
|
@@ -2770,6 +2842,8 @@ export function buildToolTable() {
|
|
|
2770
2842
|
return text(jsonResponse({
|
|
2771
2843
|
package: PACKAGE_NAME,
|
|
2772
2844
|
running: PACKAGE_VERSION,
|
|
2845
|
+
// package.json `suppa.capabilities` of THIS build — what the suppa plugin's hooks gate on.
|
|
2846
|
+
capabilities: PACKAGE_CAPABILITIES,
|
|
2773
2847
|
latest: latest ?? knownLatest(),
|
|
2774
2848
|
up_to_date: latest ? !outdated : null,
|
|
2775
2849
|
checked: latest !== null,
|
|
@@ -2962,7 +3036,7 @@ export function buildServer() {
|
|
|
2962
3036
|
},
|
|
2963
3037
|
}, (a) => `Write Suppa 2.0 application schema code for: ${a.entity_purpose}\n\n` +
|
|
2964
3038
|
"Follow the bundled 'suppa-entity-code' skill (skills/suppa-entity-code/SKILL.md inside the installed suppa-mcp-2 package):\n" +
|
|
2965
|
-
"1. Pre-flight: the target app repo exists, its src/index.ts exports a named AppModule, @suppa/sdk is in dependencies at the version extension-runner
|
|
3039
|
+
"1. Pre-flight: the target app repo exists, its src/index.ts exports a named AppModule, @suppa/sdk is in dependencies at the LOWEST version the runners of its target stands ship (dev = extension-runner develop 1.40.2, stage = release 1.38.7, prod = tag v1.7.0 1.38.7 — newer APIs compile but are missing at runtime there; 1.38.7 reaches every stand), " +
|
|
2966
3040
|
"every runtime import is in dependencies, imports are relative (the platform build ignores the app tsconfig's paths/baseUrl), and its tsconfig enables experimentalDecorators + emitDecoratorMetadata for local tsc.\n" +
|
|
2967
3041
|
"2. Resolve the blocking questions BEFORE writing any file: importKeyFields (the stable business key — wrong means duplicate seed rows on every restart), " +
|
|
2968
3042
|
"representativeFieldName, and per-field nullable.\n" +
|
|
@@ -2971,8 +3045,8 @@ export function buildServer() {
|
|
|
2971
3045
|
"TYPE every relation property to match its decorator (@ManyToOne -> `owner: Target;`, or `owner?: Target` when the relation is nullable; " +
|
|
2972
3046
|
"@ManyToMany/@OneToMany/@ManyToManyBackRef -> `peers: Target[];`) — an untyped relation is `any` to every caller. " +
|
|
2973
3047
|
"Fixed choices via @Enum(StatusEnum, StatusTitles, { ... }) with PascalCase member keys (Active = 'active') and NO global name — " +
|
|
2974
|
-
"the decorator derives
|
|
2975
|
-
"
|
|
3048
|
+
"the decorator derives <@Entity name>.<field name> (the entity's name, not its class); add the '<Entity>.<field>' first argument ONLY when one value set is shared " +
|
|
3049
|
+
"by several entities — a seed writes the bare value (status: StatusEnum.Active) and needs no global name; key the titles map by VALUE ([StatusEnum.Active]: { title }) and type the property { id?: number; value?: StatusEnum }. Attachments via @File/@MultiFile; " +
|
|
2976
3050
|
"NEVER write a field option that already holds its default — canGroup/canSort/showInTable/editFromTable/canFilter are true and " +
|
|
2977
3051
|
"readOnly/searchable are false already, so declare one only where the field DEPARTS from that. If the repo's existing entities " +
|
|
2978
3052
|
"restate those defaults on every field, do not copy that habit into the new file. " +
|
|
@@ -3025,7 +3099,9 @@ async function healthCheck(deep = true) {
|
|
|
3025
3099
|
form_v2_core: await formV2.coreStatus(),
|
|
3026
3100
|
form_v2_gate: formV2.skillFile("scripts", "validate-form-schema.mjs") ? "present" : "MISSING",
|
|
3027
3101
|
form_v2_widget_compiler: await formV2.widgetCompilerStatus(),
|
|
3102
|
+
form_v2_cell_rules: await formV2.cellRulesStatus(),
|
|
3028
3103
|
entity_code_validator: await entityCode.validatorStatus(),
|
|
3104
|
+
sql_skill: sqlKb.sqlSkillFile("SKILL.md") && sqlKb.sqlSkillFile("references") ? "present" : "MISSING",
|
|
3029
3105
|
},
|
|
3030
3106
|
};
|
|
3031
3107
|
if (!token) {
|
package/dist/toolTable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const PROFILES = {
|
|
2
2
|
core: ["login", "logout", "use_tenant", "list_tenants", "get_me", "health_check", "diagnostics", "version"],
|
|
3
|
-
data: ["search_records", "get_record", "create_record", "update_record", "delete_record", "restore_record", "copy_record", "validate_select", "query", "search_entities", "list_entities", "describe_entity", "search_users"],
|
|
3
|
+
data: ["search_records", "get_record", "create_record", "update_record", "delete_record", "restore_record", "copy_record", "validate_select", "query", "sql_kb", "query_analyze", "search_entities", "list_entities", "describe_entity", "search_users"],
|
|
4
4
|
tasks: ["search_tasks", "get_task", "create_task", "update_task", "close_task", "delete_task", "move_task", "count_tasks", "list_stages", "list_task_types", "list_workflows", "add_comment", "get_comments", "create_workspace", "add_menu_item"],
|
|
5
5
|
files: ["attach_file", "attach_file_to_record", "download_file", "download_files_zip", "list_record_files"],
|
|
6
6
|
schema: ["create_entity", "add_field", "update_field", "change_field_type", "update_entity_options", "set_title_field", "create_tabular_part", "list_tabular_parts", "list_field_types", "add_enum_values", "add_custom_field", "add_custom_fields_batch", "remove_custom_field", "restore_custom_field", "resolve_custom_fields", "link_custom_field", "apply_custom_fields", "validate_entity_code", "migrate_entities_from_v1", "read_v1_entities", "read_v1_entity_props", "read_v1_enum"],
|
|
@@ -8,7 +8,7 @@ export const PROFILES = {
|
|
|
8
8
|
// Two form PRODUCTS live in this group, and the split is the thing to know before reading the
|
|
9
9
|
// list. The first seven are Suppa 1.0: they read and write `data.formShema` (the platform's
|
|
10
10
|
// misspelling) and the v1 field types. `form_kb` and `validate_form_schema` serve the 2.0
|
|
11
|
-
// entity-builder canvas — the `schema` COLUMN on the row since 2.1,
|
|
11
|
+
// entity-builder canvas — the `schema` COLUMN on the row since 2.1, 56 component
|
|
12
12
|
// types — and share nothing with them.
|
|
13
13
|
forms: ["create_form", "get_form", "list_forms", "update_form", "add_field_to_form", "generate_form_schema", "list_form_field_types", "form_kb", "validate_form_schema",
|
|
14
14
|
"write_form_draft", "create_form_v2", "form_versions", "form_lifecycle"],
|
package/dist/tools/automation.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { makeRequest, searchEntity, selectEntity, insertEntity, updateEntity, removeEntity, } from "../httpClient.js";
|
|
12
12
|
import { ownProjection } from "../projection.js";
|
|
13
|
-
import { makeFilter, jsonResponse, parseJsonParam, ACCESS_METADATA_KEYS } from "../utils.js";
|
|
13
|
+
import { makeFilter, jsonResponse, parseJsonParam, ACCESS_METADATA_KEYS, confirmRequired } from "../utils.js";
|
|
14
14
|
export const WORKFLOW_ENTITY = "AutomationWorkflow";
|
|
15
15
|
export const EXECUTE_ENTITY = "AutomationWorkflowExecute";
|
|
16
16
|
export const EXECUTE_DATA_ENTITY = "AutomationWorkflowExecuteData";
|
|
@@ -1000,9 +1000,11 @@ export function _validateWorkflow(nodes, connections, extraTriggerTypes = new Se
|
|
|
1000
1000
|
errors.push(`trigger node '${idLabel}' (triggerSchedule, once) requires parameters.runAt — epoch milliseconds`);
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
// suppa data node:
|
|
1004
|
-
|
|
1005
|
-
|
|
1003
|
+
// suppa data node: type 'suppa' (FE workflowBuilder/docs/nodes.md, category `suppa`) — and nothing
|
|
1004
|
+
// else. Not "any node with an `action` param": `responseEntity` has its own (apply | abort), and
|
|
1005
|
+
// reading it as a data node refused every before-hook workflow that rejects a save as having
|
|
1006
|
+
// «invalid parameters.action» and no entityName (WP-23 on modern-expo.test, 2026-10-19).
|
|
1007
|
+
if (n.type === "suppa") {
|
|
1006
1008
|
const action = params.action;
|
|
1007
1009
|
if (typeof action !== "string" || !_SUPPA_ACTIONS.has(action)) {
|
|
1008
1010
|
errors.push(`suppa node '${idLabel}' has invalid or missing parameters.action ` +
|
|
@@ -1015,6 +1017,31 @@ export function _validateWorkflow(nodes, connections, extraTriggerTypes = new Se
|
|
|
1015
1017
|
errors.push(`suppa node '${idLabel}' with action '${action}' requires parameters.conditions`);
|
|
1016
1018
|
}
|
|
1017
1019
|
}
|
|
1020
|
+
// FE nodes.md "Entity Response": action 'apply' (the default) or 'abort'; `values` are
|
|
1021
|
+
// [{ name, value }] with `name` a plain column of the entity (no $json path, no dot-path). The
|
|
1022
|
+
// backend validates `values` fail-open — a bad row is not applied and the save goes through — so
|
|
1023
|
+
// a wrong name is never said by anything after this.
|
|
1024
|
+
if (n.type === "responseEntity") {
|
|
1025
|
+
const action = params.action;
|
|
1026
|
+
if (action !== undefined && action !== "apply" && action !== "abort" && !_isExpression(action)) {
|
|
1027
|
+
errors.push(`responseEntity node '${idLabel}' parameters.action is ${JSON.stringify(action)} — it is 'apply' (the default: write the incoming item as the record) or 'abort' (reject the operation, with parameters.abortReason)`);
|
|
1028
|
+
}
|
|
1029
|
+
const values = params.values;
|
|
1030
|
+
if (values !== undefined && values !== null) {
|
|
1031
|
+
if (!Array.isArray(values)) {
|
|
1032
|
+
errors.push(`responseEntity node '${idLabel}' parameters.values must be an array of { name, value }`);
|
|
1033
|
+
}
|
|
1034
|
+
else {
|
|
1035
|
+
values.forEach((v, i) => {
|
|
1036
|
+
const name = isPlainObject(v) ? v.name : undefined;
|
|
1037
|
+
if (typeof name !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name.trim())) {
|
|
1038
|
+
errors.push(`responseEntity node '${idLabel}' parameters.values[${i}].name ${JSON.stringify(name)} is not a plain column name — ` +
|
|
1039
|
+
"no $json path, no dot-path (FE nodes.md, Entity Response); the backend checks values fail-open, so a bad row is not applied and the save goes through without it");
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1018
1045
|
}
|
|
1019
1046
|
// connections: every source id and every target .node id must exist; count cap
|
|
1020
1047
|
const adj = {};
|
|
@@ -1215,6 +1242,57 @@ export async function publishAutomation(automationId) {
|
|
|
1215
1242
|
return _serviceError(automationId, ex, "published");
|
|
1216
1243
|
}
|
|
1217
1244
|
}
|
|
1245
|
+
/**
|
|
1246
|
+
* The confirm=false answer of suppa_publish_automation: what a confirmed publish would act on, and
|
|
1247
|
+
* what this server's pre-flight says about the DRAFT it would promote. Until 2026-10-19 that answer
|
|
1248
|
+
* was a bare confirmation request (WP-23 on modern-expo.test), so a draft that could not publish was
|
|
1249
|
+
* found out only on the confirmed call — after the user had already said yes.
|
|
1250
|
+
*
|
|
1251
|
+
* The platform's own publish validation (E1–E21, the automation-service) has no dry-run endpoint:
|
|
1252
|
+
* it still runs only on the confirmed call, and its refusal comes back as {published:false, errors,
|
|
1253
|
+
* warnings}. This is the half that can run before anyone is asked.
|
|
1254
|
+
*/
|
|
1255
|
+
export async function previewPublishAutomation(automationId) {
|
|
1256
|
+
const target = { automation_id: automationId };
|
|
1257
|
+
let row = null;
|
|
1258
|
+
try {
|
|
1259
|
+
row = (await selectEntity(WORKFLOW_ENTITY, [makeFilter("id", automationId)], {
|
|
1260
|
+
id: true,
|
|
1261
|
+
name: true,
|
|
1262
|
+
isActive: true,
|
|
1263
|
+
hasUnpublishedChanges: true,
|
|
1264
|
+
publishedAt: true,
|
|
1265
|
+
nodes: true,
|
|
1266
|
+
connections: true,
|
|
1267
|
+
}));
|
|
1268
|
+
}
|
|
1269
|
+
catch (ex) {
|
|
1270
|
+
return confirmRequired("publish automation", target, undefined, [
|
|
1271
|
+
`the workflow could not be read (${ex instanceof Error ? ex.message : String(ex)}) — nothing was checked before asking`,
|
|
1272
|
+
]);
|
|
1273
|
+
}
|
|
1274
|
+
if (row === null) {
|
|
1275
|
+
return confirmRequired("publish automation", target, undefined, [
|
|
1276
|
+
`no automation ${automationId} (wrong id, deleted, or no access) — a publish would fail`,
|
|
1277
|
+
]);
|
|
1278
|
+
}
|
|
1279
|
+
target.name = row.name ?? null;
|
|
1280
|
+
const errors = _validateWorkflow(row.nodes, row.connections, await _catalogTriggerTypes());
|
|
1281
|
+
const warnings = [
|
|
1282
|
+
...errors.map((e) => `pre-flight: ${e}`),
|
|
1283
|
+
...(errors.length
|
|
1284
|
+
? [`the draft fails this server's pre-flight (${errors.length}) — fix it with suppa_update_automation before asking to publish`]
|
|
1285
|
+
: []),
|
|
1286
|
+
"the platform's own publish validation (E1–E21) has no dry run: it runs on the confirmed call, and a refusal comes back as {published:false, errors, warnings}",
|
|
1287
|
+
];
|
|
1288
|
+
return confirmRequired("publish automation", target, {
|
|
1289
|
+
draft_nodes: Array.isArray(row.nodes) ? row.nodes.length : 0,
|
|
1290
|
+
is_active: row.isActive ?? null,
|
|
1291
|
+
has_unpublished_changes: row.hasUnpublishedChanges ?? null,
|
|
1292
|
+
published_at: row.publishedAt ?? null,
|
|
1293
|
+
preflight: errors.length ? `FAILS (${errors.length} — see warnings)` : "passes",
|
|
1294
|
+
}, warnings);
|
|
1295
|
+
}
|
|
1218
1296
|
/**
|
|
1219
1297
|
* Unpublish a workflow — clears the live snapshot via the automation-service.
|
|
1220
1298
|
* Requires the automation-service deployed (else 404, returned as an error).
|
package/dist/tools/docs.js
CHANGED
|
@@ -270,7 +270,11 @@ async function _fetchBlocks(pageId) {
|
|
|
270
270
|
export async function listDocs(search = "", limit = 20, fieldsJson = null) {
|
|
271
271
|
const filters = [];
|
|
272
272
|
if (search) {
|
|
273
|
-
|
|
273
|
+
// The bare text: `like` is a case-insensitive CONTAINS and the platform adds the wildcards —
|
|
274
|
+
// `format('%s', field) ILIKE '%<v>%'` with `\ % _` in the value escaped (entity-builder
|
|
275
|
+
// select-adaptor.service.ts:533-553, ilike.util.ts:6-11; 84195fec6, 2026-06-29). The `%…%`
|
|
276
|
+
// this used to send became `%\%x\%%`, a title containing the literal "%x%": nothing matched.
|
|
277
|
+
filters.push(makeFilter("title", search, "like"));
|
|
274
278
|
}
|
|
275
279
|
const fields = _projection(fieldsJson, DOC_FIELDS);
|
|
276
280
|
if ("error" in fields)
|