suppa-mcp-2 1.44.4 → 1.44.5
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 +11 -0
- package/dist/httpClient.js +131 -6
- package/dist/projection.js +18 -3
- package/dist/tools/automation.js +16 -1
- package/dist/tools/docs.js +5 -1
- package/dist/tools/entity.js +16 -6
- package/dist/tools/forms.js +2 -1
- package/dist/tools/tasks.js +7 -7
- package/package.json +3 -2
- package/skills/writing-suppa-sql/references/language.md +1 -1
package/README.md
CHANGED
|
@@ -818,6 +818,17 @@ npm publish
|
|
|
818
818
|
|
|
819
819
|
The `prepublishOnly` script automatically runs `tsc` + the full test suite before publishing.
|
|
820
820
|
|
|
821
|
+
Before a release, check the projections this server sends against a stand people use (read-only, the platform's own
|
|
822
|
+
`select/validate`; needs a build and a session for that tenant):
|
|
823
|
+
|
|
824
|
+
```bash
|
|
825
|
+
npm run build && npm run check:projections -- --tenant modern-expo.test.suppa.me
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
It names every field the code asks for that the tenant does not have — the way `Tasks.author` sat in the task
|
|
829
|
+
projection after every tenant had renamed it `createdBy`, and cost one 400 in the platform's log per process start.
|
|
830
|
+
At run time a read is checked the same way before it is sent, so no tool learns a tenant's fields from a 400.
|
|
831
|
+
|
|
821
832
|
---
|
|
822
833
|
|
|
823
834
|
## Project structure
|
package/dist/httpClient.js
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* Faithful 1:1 port of the Python `suppa_mcp/http_client.py`. Uses the native
|
|
5
5
|
* global `fetch` in place of `urllib`, with an AbortController for timeouts.
|
|
6
6
|
*/
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
7
10
|
import { config } from "./config.js";
|
|
11
|
+
import { homeDir } from "./registry.js";
|
|
8
12
|
import { assertMergeLists, elideEchoedResponse, stripAccessMetadata } from "./utils.js";
|
|
9
13
|
import * as tenants from "./tenants.js";
|
|
10
14
|
import { lastRefreshError } from "./sessionDiag.js";
|
|
@@ -644,21 +648,138 @@ function invalidProjectionPaths(e) {
|
|
|
644
648
|
f.location === "fields")
|
|
645
649
|
.map((f) => f.path);
|
|
646
650
|
}
|
|
651
|
+
// ---------------------------------------------------------------------------
|
|
652
|
+
// A read is checked BEFORE it is sent
|
|
653
|
+
//
|
|
654
|
+
// Every 400 lands in the platform's error log. Learning a tenant's fields from its
|
|
655
|
+
// 400s cost one per process start, per user, per tenant: on 2026-11-10/11 the
|
|
656
|
+
// suppa_get_task / suppa_search_tasks projection (`author` beside `createdBy`)
|
|
657
|
+
// put 79 of them in entity-builder's log from ~10 people, and 53 more came from
|
|
658
|
+
// projections agents wrote themselves (`author { fullName }`, a `name` that does
|
|
659
|
+
// not exist). POST /data/:entity/select/validate answers 200 with the same
|
|
660
|
+
// invalidFields the select would refuse with (entity-builder data.controller.ts,
|
|
661
|
+
// @HttpCode(OK), 1000 calls a minute; the select runs the same validator), so the
|
|
662
|
+
// read is checked there first:
|
|
663
|
+
// - a path of THIS SERVER's projection the tenant lacks is dropped before sending;
|
|
664
|
+
// - anything else invalid — a caller's projection, a filter, an order — is refused
|
|
665
|
+
// here with the platform's own words, and nothing reaches the platform.
|
|
666
|
+
// The verdict is kept per tenant, entity and query SHAPE (paths and comparators,
|
|
667
|
+
// never values): in memory for the process, and for this server's own reads also
|
|
668
|
+
// on disk for a day, so a new process does not ask again.
|
|
669
|
+
// ---------------------------------------------------------------------------
|
|
670
|
+
const READ_CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
671
|
+
/** `sha1(host|entity|shape)` -> the paths the platform's validator rejected (none = valid). */
|
|
672
|
+
const checkedReads = new Map();
|
|
673
|
+
/** The structure of a condition tree without its values: what the validator judges. */
|
|
674
|
+
function conditionShape(node) {
|
|
675
|
+
if (Array.isArray(node))
|
|
676
|
+
return node.map(conditionShape);
|
|
677
|
+
if (node === null || typeof node !== "object")
|
|
678
|
+
return typeof node;
|
|
679
|
+
const o = node;
|
|
680
|
+
if (Array.isArray(o.filters))
|
|
681
|
+
return { operator: o.operator ?? null, filters: o.filters.map(conditionShape) };
|
|
682
|
+
return { field: o.field ?? null, comparator: o.comparator ?? null };
|
|
683
|
+
}
|
|
684
|
+
function readCheckKey(ctx, entity, body) {
|
|
685
|
+
const shape = JSON.stringify({ fields: body.fields ?? null, orderBy: body.orderBy ?? null, conditions: conditionShape(body.conditions ?? null) });
|
|
686
|
+
return createHash("sha1").update(`${ctx.host}|${entity}|${shape}`).digest("hex");
|
|
687
|
+
}
|
|
688
|
+
function readCheckFile(key) {
|
|
689
|
+
return join(homeDir(), "cache", "select-validate", `${key}.json`);
|
|
690
|
+
}
|
|
691
|
+
function loadReadCheck(key) {
|
|
692
|
+
try {
|
|
693
|
+
const file = readCheckFile(key);
|
|
694
|
+
if (Date.now() - statSync(file).mtimeMs > READ_CHECK_TTL_MS)
|
|
695
|
+
return undefined;
|
|
696
|
+
const invalid = JSON.parse(readFileSync(file, "utf-8"));
|
|
697
|
+
return Array.isArray(invalid) ? invalid : undefined;
|
|
698
|
+
}
|
|
699
|
+
catch {
|
|
700
|
+
return undefined; // no verdict on disk, or an unreadable one: ask the validator
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
function saveReadCheck(key, invalid) {
|
|
704
|
+
try {
|
|
705
|
+
const file = readCheckFile(key);
|
|
706
|
+
mkdirSync(join(file, ".."), { recursive: true });
|
|
707
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
708
|
+
writeFileSync(tmp, JSON.stringify(invalid));
|
|
709
|
+
renameSync(tmp, file);
|
|
710
|
+
}
|
|
711
|
+
catch {
|
|
712
|
+
// a verdict that cannot be kept costs one validator call next process, nothing else
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
/** The validator's verdict on a read, or null when it cannot answer (then the read goes as it was). */
|
|
716
|
+
async function validateRead(entity, body, ctx) {
|
|
717
|
+
const check = { fields: body.fields };
|
|
718
|
+
if (body.conditions !== undefined && body.conditions !== null)
|
|
719
|
+
check.conditions = body.conditions;
|
|
720
|
+
if (Array.isArray(body.orderBy) && body.orderBy.length > 0)
|
|
721
|
+
check.orderBy = body.orderBy;
|
|
722
|
+
let answer;
|
|
723
|
+
try {
|
|
724
|
+
// No retry: a validator that is busy or down is skipped, never paid for twice.
|
|
725
|
+
answer = await makeRequest("POST", dataUrl(entity, "select/validate"), check, { ctx, retryTransient: false });
|
|
726
|
+
}
|
|
727
|
+
catch (e) {
|
|
728
|
+
debug(`${entity}: select/validate did not answer (${e instanceof Error ? e.message : String(e)}) — the read goes unchecked`);
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
if (answer === null || typeof answer !== "object" || Array.isArray(answer))
|
|
732
|
+
return null;
|
|
733
|
+
const list = answer.invalidFields;
|
|
734
|
+
return Array.isArray(list) ? list.filter((f) => Boolean(f) && typeof f === "object") : [];
|
|
735
|
+
}
|
|
736
|
+
/** What the platform would have answered, said here — nothing was sent. */
|
|
737
|
+
function refusedBeforeSending(entity, invalid) {
|
|
738
|
+
const paths = invalid.map((f) => (f.location && f.location !== "fields" ? `${f.path} (${f.location})` : String(f.path))).join(", ");
|
|
739
|
+
return new ApiError(400, "Bad Request", JSON.stringify({
|
|
740
|
+
statusCode: 400,
|
|
741
|
+
code: "request.invalid",
|
|
742
|
+
message: `Select query on ${entity} references invalid fields: ${paths}. Checked with the platform's own ` +
|
|
743
|
+
"validator before sending — nothing was sent. suppa_describe_entity lists the entity's fields.",
|
|
744
|
+
invalidFields: invalid,
|
|
745
|
+
checkedBeforeSending: true,
|
|
746
|
+
}));
|
|
747
|
+
}
|
|
647
748
|
/**
|
|
648
|
-
* POST an entity read,
|
|
749
|
+
* POST an entity read, checked first and trimmed to fit the tenant (see above).
|
|
649
750
|
*
|
|
650
|
-
* The
|
|
651
|
-
*
|
|
652
|
-
*
|
|
751
|
+
* The 400 path below is the safety net for what the check cannot see — a field
|
|
752
|
+
* removed since its verdict was kept, or a validator that did not answer: the
|
|
753
|
+
* platform names the offending paths in its 400, they are dropped, the read is
|
|
754
|
+
* retried once, and the verdict is corrected.
|
|
653
755
|
*/
|
|
654
756
|
async function postEntityRead(entity, path, body, fields, opts = {}) {
|
|
655
757
|
const ctx = opts.ctx ?? tenants.current();
|
|
656
758
|
const own = fields !== null && isOwnProjection(fields);
|
|
759
|
+
const checkKey = readCheckKey(ctx, entity, body);
|
|
760
|
+
let invalid = checkedReads.get(checkKey) ?? (own ? loadReadCheck(checkKey) : undefined);
|
|
761
|
+
if (invalid === undefined) {
|
|
762
|
+
const verdict = await validateRead(entity, body, ctx);
|
|
763
|
+
if (verdict !== null) {
|
|
764
|
+
invalid = verdict;
|
|
765
|
+
if (own)
|
|
766
|
+
saveReadCheck(checkKey, verdict);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
if (invalid !== undefined)
|
|
770
|
+
checkedReads.set(checkKey, invalid);
|
|
657
771
|
let payload = body;
|
|
772
|
+
if (invalid !== undefined && invalid.length > 0) {
|
|
773
|
+
// Only this server's projection bends: a caller's, a filter or an order is the question asked.
|
|
774
|
+
const refused = own ? invalid.filter((f) => f.location !== "fields") : invalid;
|
|
775
|
+
if (refused.length > 0)
|
|
776
|
+
throw refusedBeforeSending(entity, refused);
|
|
777
|
+
payload = { ...body, fields: withoutPaths(fields, invalid.map((f) => String(f.path))) };
|
|
778
|
+
}
|
|
658
779
|
if (own) {
|
|
659
780
|
const known = rejectedFields.get(rejectKey(ctx, entity));
|
|
660
781
|
if (known && known.size > 0) {
|
|
661
|
-
payload = { ...
|
|
782
|
+
payload = { ...payload, fields: withoutPaths(payload.fields, known) };
|
|
662
783
|
}
|
|
663
784
|
}
|
|
664
785
|
// A projection this server wrote also comes back without the platform's
|
|
@@ -685,8 +806,12 @@ async function postEntityRead(entity, path, body, fields, opts = {}) {
|
|
|
685
806
|
if (known.size === before) {
|
|
686
807
|
throw e; // the retry named the same fields — the problem is elsewhere
|
|
687
808
|
}
|
|
809
|
+
// The kept verdict was wrong (or there was none): correct it, so the next read is checked right.
|
|
810
|
+
const corrected = [...(invalid ?? []), ...bad.map((p) => ({ path: p, location: "fields" }))];
|
|
811
|
+
checkedReads.set(checkKey, corrected);
|
|
812
|
+
saveReadCheck(checkKey, corrected);
|
|
688
813
|
debug(`${entity}: this tenant has no ${bad.join(", ")} — retrying without them`);
|
|
689
|
-
return shaped(await makeRequest("POST", path, { ...
|
|
814
|
+
return shaped(await makeRequest("POST", path, { ...payload, fields: withoutPaths(payload.fields, known) }, opts));
|
|
690
815
|
}
|
|
691
816
|
}
|
|
692
817
|
export async function searchEntity(entity, filters = null, fields = null, limit = 50, offset = 0, orderBy = null, searchValue = "", operator = "and", deletedScope = DEFAULT_DELETED_SCOPE, includeDeletedRelations = DEFAULT_INCLUDE_DELETED_RELATIONS) {
|
package/dist/projection.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Which field projections belong to THIS SERVER, and how to trim one.
|
|
3
3
|
*
|
|
4
4
|
* A tenant's entities are editable, so a field this server names may simply not
|
|
5
|
-
* be there — `Tasks.author`
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* be there — `Tasks.author` (now gone everywhere, `createdBy` replaced it) once
|
|
6
|
+
* failed every task read with an opaque 400 about a projection the user never
|
|
7
|
+
* chose and could not change. httpClient checks such a read with the platform's
|
|
8
|
+
* validator first and drops the missing paths before sending.
|
|
8
9
|
*
|
|
9
10
|
* A projection tagged here may be trimmed to fit the tenant. One a caller
|
|
10
11
|
* supplied never is: quietly returning everything except what someone asked for
|
|
@@ -20,6 +21,20 @@ export function ownProjection(fields) {
|
|
|
20
21
|
OWN_PROJECTIONS.add(fields);
|
|
21
22
|
return fields;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Every projection this server owns, with the entity it reads — what scripts/check-own-projections.mjs checks against
|
|
26
|
+
* a tenant's schema before a release, so a field that does not exist (as `Tasks.author` did) is found by a check, not
|
|
27
|
+
* by a 400 in the platform's log.
|
|
28
|
+
*/
|
|
29
|
+
export const OWN_PROJECTION_REGISTRY = [];
|
|
30
|
+
/** Register named own projections as reads of `entity` (call it right after their declarations). */
|
|
31
|
+
export function registerOwnProjections(entity, named) {
|
|
32
|
+
for (const [name, fields] of Object.entries(named)) {
|
|
33
|
+
if (!OWN_PROJECTIONS.has(fields))
|
|
34
|
+
throw new Error(`${name} is not an own projection — wrap it in ownProjection()`);
|
|
35
|
+
OWN_PROJECTION_REGISTRY.push({ entity, name, fields });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
23
38
|
/** True when `fields` is a projection this server owns. */
|
|
24
39
|
export function isOwnProjection(fields) {
|
|
25
40
|
return OWN_PROJECTIONS.has(fields);
|
package/dist/tools/automation.js
CHANGED
|
@@ -12,7 +12,8 @@ import { makeRequest, searchEntity, selectEntity, insertEntity, updateEntity, re
|
|
|
12
12
|
import { existsSync } from "node:fs";
|
|
13
13
|
import { dirname, join } from "node:path";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
|
-
import { ownProjection } from "../projection.js";
|
|
15
|
+
import { ownProjection, registerOwnProjections } from "../projection.js";
|
|
16
|
+
import { current as currentTenant } from "../tenants.js";
|
|
16
17
|
import { makeFilter, jsonResponse, parseJsonParam, ACCESS_METADATA_KEYS, confirmRequired } from "../utils.js";
|
|
17
18
|
/**
|
|
18
19
|
* The bundled building-suppa-automations skill folder, from dist/tools/ or src/tools/ alike — what
|
|
@@ -74,6 +75,8 @@ const _RUN_FIELDS = ownProjection({
|
|
|
74
75
|
triggerEntityName: true,
|
|
75
76
|
error: true,
|
|
76
77
|
});
|
|
78
|
+
registerOwnProjections(WORKFLOW_ENTITY, { _LIST_FIELDS, _GRAPH_FIELDS });
|
|
79
|
+
registerOwnProjections(EXECUTE_ENTITY, { _RUN_FIELDS });
|
|
77
80
|
function isPlainObject(v) {
|
|
78
81
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
79
82
|
}
|
|
@@ -435,6 +438,11 @@ async function _scanWorkflows() {
|
|
|
435
438
|
* fallback signal. Non-404 errors (e.g. 401) propagate.
|
|
436
439
|
*/
|
|
437
440
|
export async function _fetchNodeCatalog() {
|
|
441
|
+
// A stand without the route answers 404 to every create / update / publish preview that asks; once is enough to
|
|
442
|
+
// know, for the rest of the process — a 404 the platform is certain to give is not asked for again.
|
|
443
|
+
const host = currentTenant().host;
|
|
444
|
+
if (_catalogAbsent.has(host))
|
|
445
|
+
return null;
|
|
438
446
|
let cat;
|
|
439
447
|
try {
|
|
440
448
|
cat = await makeRequest("GET", NODE_CATALOG_PATH);
|
|
@@ -445,12 +453,19 @@ export async function _fetchNodeCatalog() {
|
|
|
445
453
|
// must NOT be misread as "route absent" (and 401 must still surface).
|
|
446
454
|
const msg = ex instanceof Error ? ex.message : String(ex);
|
|
447
455
|
if (msg.startsWith("HTTP 404")) {
|
|
456
|
+
_catalogAbsent.add(host);
|
|
448
457
|
return null;
|
|
449
458
|
}
|
|
450
459
|
throw ex;
|
|
451
460
|
}
|
|
452
461
|
return Array.isArray(cat) ? cat : null;
|
|
453
462
|
}
|
|
463
|
+
/** Tenant hosts whose build has no /api/automation/nodes (answered 404), for this process. */
|
|
464
|
+
const _catalogAbsent = new Set();
|
|
465
|
+
/** Forget which stands lack the catalog — for tests that play several stands under one host. */
|
|
466
|
+
export function _forgetCatalogAbsence() {
|
|
467
|
+
_catalogAbsent.clear();
|
|
468
|
+
}
|
|
454
469
|
/**
|
|
455
470
|
* {node type: occurrences} across live graphs. Best-effort enrichment —
|
|
456
471
|
* never raises (returns {} on any failure).
|
package/dist/tools/docs.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Python's server.py), so it is applied uniformly across all tools.
|
|
10
10
|
*/
|
|
11
11
|
import { makeRequest, dataUrl, customOrderUrl, searchEntity, selectEntity, insertEntity, updateEntity, removeEntity, } from "../httpClient.js";
|
|
12
|
-
import { ownProjection } from "../projection.js";
|
|
12
|
+
import { ownProjection, registerOwnProjections } from "../projection.js";
|
|
13
13
|
import { makeFilter, writeOutcome, stripHtml, jsonResponse, wrapHtml, unescapeUnicode, parseJsonParam, parseProjectionParam, notFoundAnswer, } from "../utils.js";
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
// Constants
|
|
@@ -74,6 +74,9 @@ export const BLOCK_FIELDS = ownProjection({
|
|
|
74
74
|
children: "#expand_tree(10)",
|
|
75
75
|
createdAt: true,
|
|
76
76
|
});
|
|
77
|
+
registerOwnProjections(ENTITY_DOCS, { DOC_FIELDS });
|
|
78
|
+
registerOwnProjections(ENTITY_PAGES, { PAGE_FIELDS });
|
|
79
|
+
registerOwnProjections(ENTITY_PAGE_BLOCKS, { BLOCK_FIELDS });
|
|
77
80
|
// ---------------------------------------------------------------------------
|
|
78
81
|
// Block content helpers
|
|
79
82
|
// ---------------------------------------------------------------------------
|
|
@@ -296,6 +299,7 @@ const DOC_DETAIL_FIELDS = ownProjection({
|
|
|
296
299
|
...DOC_FIELDS,
|
|
297
300
|
pages: { id: true, title: true, status: true, parent: { id: true } },
|
|
298
301
|
});
|
|
302
|
+
registerOwnProjections(ENTITY_DOCS, { DOC_DETAIL_FIELDS });
|
|
299
303
|
/** Get a document by ID, including its pages. */
|
|
300
304
|
export async function getDoc(docId, fieldsJson = null) {
|
|
301
305
|
const fields = _projection(fieldsJson, DOC_DETAIL_FIELDS);
|
package/dist/tools/entity.js
CHANGED
|
@@ -901,11 +901,14 @@ export async function searchRecords(entityName, filtersJson = "[]", fieldsJson =
|
|
|
901
901
|
return ent.error;
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
|
+
// A read refused before sending already carries the validator's answer (httpClient postEntityRead).
|
|
905
|
+
const body = e?.parsedBody;
|
|
906
|
+
const known = body?.checkedBeforeSending === true && Array.isArray(body.invalidFields) ? body.invalidFields : undefined;
|
|
904
907
|
const diag = await _selectDiagnostic(entityName, {
|
|
905
908
|
fields: fields,
|
|
906
909
|
conditions,
|
|
907
910
|
orderBy: order,
|
|
908
|
-
});
|
|
911
|
+
}, known);
|
|
909
912
|
if (!diag) {
|
|
910
913
|
throw e;
|
|
911
914
|
}
|
|
@@ -942,13 +945,20 @@ export async function searchRecords(entityName, filtersJson = "[]", fieldsJson =
|
|
|
942
945
|
* check itself fails — a diagnostic must never turn a legitimate empty result
|
|
943
946
|
* into an error.
|
|
944
947
|
*/
|
|
945
|
-
async function _selectDiagnostic(entityName, payload
|
|
948
|
+
async function _selectDiagnostic(entityName, payload,
|
|
949
|
+
/** The validator's answer when it is already in hand — no second request for it. */
|
|
950
|
+
known) {
|
|
946
951
|
let result;
|
|
947
|
-
|
|
948
|
-
result =
|
|
952
|
+
if (known !== undefined) {
|
|
953
|
+
result = { valid: known.length === 0, invalidFields: known };
|
|
949
954
|
}
|
|
950
|
-
|
|
951
|
-
|
|
955
|
+
else {
|
|
956
|
+
try {
|
|
957
|
+
result = await validateSelect(entityName, payload);
|
|
958
|
+
}
|
|
959
|
+
catch {
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
952
962
|
}
|
|
953
963
|
if (!result || result.valid !== false) {
|
|
954
964
|
return null;
|
package/dist/tools/forms.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
import { makeRequest, searchEntity, selectEntity, insertEntity, } from "../httpClient.js";
|
|
12
|
-
import { ownProjection } from "../projection.js";
|
|
12
|
+
import { ownProjection, registerOwnProjections } from "../projection.js";
|
|
13
13
|
import { makeFilter, jsonResponse, parseJsonParam, notFoundAnswer } from "../utils.js";
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
// Constants
|
|
@@ -30,6 +30,7 @@ export const FORM_DETAIL_FIELDS = ownProjection({
|
|
|
30
30
|
...FORM_LIST_FIELDS,
|
|
31
31
|
data: true,
|
|
32
32
|
});
|
|
33
|
+
registerOwnProjections(ENTITY_FORMS, { FORM_LIST_FIELDS, FORM_DETAIL_FIELDS });
|
|
33
34
|
export const DEFAULT_FORM_SETTINGS = {
|
|
34
35
|
id: 0,
|
|
35
36
|
size: "md",
|
package/dist/tools/tasks.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* mutations lives one layer up (server.ts, mirroring server.py) — NOT here.
|
|
9
9
|
*/
|
|
10
10
|
import { searchEntity, selectEntity, insertEntity, updateEntity, removeEntity, } from "../httpClient.js";
|
|
11
|
-
import { ownProjection } from "../projection.js";
|
|
11
|
+
import { ownProjection, registerOwnProjections } from "../projection.js";
|
|
12
12
|
import { dropDerivablePlainDescription, statusValue } from "../readEconomy.js";
|
|
13
13
|
import { makeFilter, parseDeadline, parseProjectionParam, wrapHtml, jsonResponse, localDayRange, writeOutcome, notFoundAnswer, } from "../utils.js";
|
|
14
14
|
import * as tenants from "../tenants.js";
|
|
@@ -16,11 +16,11 @@ import { config } from "../config.js";
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
// Field projections
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
19
|
-
// `ownProjection` marks these as THIS SERVER's, not the caller's: a
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
19
|
+
// `ownProjection` marks these as THIS SERVER's, not the caller's: a field a
|
|
20
|
+
// tenant lacks is dropped before the read is sent (httpClient postEntityRead,
|
|
21
|
+
// checked with select/validate). The person who filed the task is `createdBy`:
|
|
22
|
+
// `author` is gone on every tenant, and asking for both put one 400 per process
|
|
23
|
+
// start per user in entity-builder's log (79 in 36 h, 2026-11-10/11).
|
|
24
24
|
export const TASK_LIST_FIELDS = ownProjection({
|
|
25
25
|
id: true,
|
|
26
26
|
title: true,
|
|
@@ -30,7 +30,6 @@ export const TASK_LIST_FIELDS = ownProjection({
|
|
|
30
30
|
updatedAt: true,
|
|
31
31
|
estimatedDuration: true,
|
|
32
32
|
assignedTo: { id: true, firstName: true, lastName: true, fullName: true },
|
|
33
|
-
author: { id: true, fullName: true },
|
|
34
33
|
createdBy: { id: true, fullName: true },
|
|
35
34
|
project: { id: true, title: true },
|
|
36
35
|
parent: { id: true, title: true },
|
|
@@ -57,6 +56,7 @@ export const TASK_DETAIL_FIELDS = ownProjection({
|
|
|
57
56
|
children: { id: true, title: true },
|
|
58
57
|
attachments: { id: true, fileName: true, filePath: true },
|
|
59
58
|
});
|
|
59
|
+
registerOwnProjections("Tasks", { TASK_LIST_FIELDS, TASK_DETAIL_FIELDS });
|
|
60
60
|
const _ACTIVE_STATES = ["active", "inprogress"];
|
|
61
61
|
/** Build the Tasks filter list shared by searchTasks and countTasks. */
|
|
62
62
|
function _taskFilters(my = false, active = false, overdue = false, dueToday = false, projectId = null, workflowId = null, stageId = null, assignedToId = null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suppa-mcp-2",
|
|
3
|
-
"version": "1.44.
|
|
3
|
+
"version": "1.44.5",
|
|
4
4
|
"description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"form:gate": "node skills/suppa-form-v2/scripts/validate-form-schema.mjs",
|
|
42
42
|
"sync:formbuilder": "node scripts/sync-formbuilder.mjs",
|
|
43
43
|
"sync:vue-compiler": "node scripts/sync-vue-compiler.mjs",
|
|
44
|
-
"guards:install": "node skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
|
|
44
|
+
"guards:install": "node skills/suppa-entity-code/scripts/install-entity-code-guards.mjs",
|
|
45
|
+
"check:projections": "node scripts/check-own-projections.mjs"
|
|
45
46
|
},
|
|
46
47
|
"keywords": [
|
|
47
48
|
"mcp",
|
|
@@ -72,7 +72,7 @@ SELECT "id", "assignee", "tags" FROM TestTasks -- assignee:{i
|
|
|
72
72
|
|
|
73
73
|
```sql
|
|
74
74
|
SELECT "id" FROM TestTasks WHERE "assignee.firstName" = $v -- :149
|
|
75
|
-
SELECT id FROM Tasks WHERE "
|
|
75
|
+
SELECT id FROM Tasks WHERE "createdBy.department.company.name" = 'Acme' -- 3-hop equality (the spec says author; Tasks has createdBy) parser-round-trip.spec.ts:1907
|
|
76
76
|
SELECT "id" FROM TestTasks WHERE "children.id" IS NOT NULL -- o2m existence planner-parity.spec.ts:172
|
|
77
77
|
SELECT "id" FROM TestTasks WHERE "tags.label" = $v -- m2m subfield → EXISTS :185
|
|
78
78
|
SELECT "id" FROM TestTasks WHERE "tags.taggedTasks.title" = 'x' -- deep m2m→backref chain :3478
|