suppa-mcp-2 1.45.0 → 1.46.1

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.
@@ -0,0 +1,266 @@
1
+ /**
2
+ * suppa_reorder_records and suppa_insert_record_at — the generic writes of the
3
+ * platform's manual order. The contract (context, anchors, direction) is
4
+ * customOrder.ts; this file adds what a write needs around it.
5
+ *
6
+ * The platform's custom-order write runs as sudo and checks no rights on the rows
7
+ * (custom-order.controller.ts updateRows, CustomOrderService.setOrder). So every
8
+ * row a call moves, and every anchor, is read first WITH THE CALLER'S RIGHTS, and
9
+ * a row that is missing, soft-deleted, not visible or in another list is refused
10
+ * before anything is sent.
11
+ */
12
+ import { customOrderUrl, makeRequest, searchEntity } from "../httpClient.js";
13
+ import { jsonResponse, parseJsonParam } from "../utils.js";
14
+ import { createRecord } from "./entity.js";
15
+ import { contextFilters, customOrderBy, flip, idOf, idsProblem, listFields, listProblem, MAX_ORDER_IDS, membershipRefusal, orderByText, orderContextRefusal, placementProblem, readOrderRows, reorderBody, } from "./customOrder.js";
16
+ function refuse(error) {
17
+ return jsonResponse({ error });
18
+ }
19
+ /** The first (or last) record of the list as the reader sees it, other than `exclude`; null when there is none. */
20
+ async function edgeAnchor(entity, list, direction, edge, exclude) {
21
+ const filters = [...contextFilters(list.context, list.topLevelField)];
22
+ if (exclude.length)
23
+ filters.push({ field: "id", comparator: "not in", value: exclude });
24
+ const rows = (await searchEntity(entity, filters, { id: true }, 1, 0, customOrderBy(list.context, edge === "first" ? direction : flip(direction))));
25
+ return idOf(rows[0]?.id ?? null);
26
+ }
27
+ async function resolveAnchor(entity, list, direction, where, anchorId, exclude) {
28
+ if (where === "before")
29
+ return { beforeId: anchorId };
30
+ if (where === "after")
31
+ return { afterId: anchorId };
32
+ const edge = await edgeAnchor(entity, list, direction, where, exclude);
33
+ if (edge === null)
34
+ return null;
35
+ return where === "first" ? { beforeId: edge } : { afterId: edge };
36
+ }
37
+ /** Send one order write. True when the platform answered that the order row already exists. */
38
+ async function sendOrder(entity, body) {
39
+ try {
40
+ await makeRequest("POST", customOrderUrl(entity), body);
41
+ return false;
42
+ }
43
+ catch (e) {
44
+ // Not idempotent: a send whose answer was lost and is sent again comes back
45
+ // 409 "Another Custom Order with the same combination already exists" — the
46
+ // unique index CustomOrdersEntityIdFieldIdValueInstanceIdUIndex. The front
47
+ // treats it as done (pageBlocksAdapter.ts reorder()), but the row it found may
48
+ // also be another writer's, so it is said, never passed off as a fresh write.
49
+ const msg = e instanceof Error ? e.message : String(e);
50
+ if (/HTTP 409/.test(msg) && /same combination already exists/i.test(msg))
51
+ return true;
52
+ throw e;
53
+ }
54
+ }
55
+ /**
56
+ * Write the order of `ids` at `anchor`. With no anchor the list holds nothing
57
+ * else: the ids are ordered among themselves (ids[1..] after ids[0]), and one id
58
+ * alone needs no write.
59
+ */
60
+ async function place(entity, context, direction, ids, anchor) {
61
+ if (anchor) {
62
+ return { anchor, alreadyWritten: await sendOrder(entity, reorderBody(ids, context, direction, anchor)) };
63
+ }
64
+ if (ids.length < 2)
65
+ return { anchor: null, alreadyWritten: false };
66
+ const first = { afterId: ids[0] };
67
+ return { anchor: first, alreadyWritten: await sendOrder(entity, reorderBody(ids.slice(1), context, direction, first)) };
68
+ }
69
+ /** The anchor used, and a 409 said out loud. */
70
+ function placedAnswer({ anchor, alreadyWritten }) {
71
+ const out = anchor === null ? {} : "beforeId" in anchor ? { before_id: anchor.beforeId } : { after_id: anchor.afterId };
72
+ if (alreadyWritten) {
73
+ out.already_written = true;
74
+ out.note =
75
+ "The platform answered 409 'same combination already exists': an order row for these records was already " +
76
+ "there — a retried send of this write, or another writer's. Read back with read_back to confirm the order.";
77
+ }
78
+ return out;
79
+ }
80
+ /** The exact suppa_reorder_records call that places `ids` the way this call meant to. */
81
+ function reorderCall(entity, ids, context, where, anchorId, direction) {
82
+ const arg = (v) => JSON.stringify(v ?? null);
83
+ return (`suppa_reorder_records(entity_name=${arg(entity)}, record_ids=${arg(ids)}, context_field=${arg(context.field)}, ` +
84
+ `context_value=${arg(context.value)}, where=${arg(where)}, anchor_id=${arg(anchorId)}, direction=${arg(direction)})`);
85
+ }
86
+ /** Where rows with no order row of their own stand in a list read in `direction` (F4: desc reads them last). */
87
+ function unplacedSide(direction) {
88
+ return direction === "desc" ? "read last in the list (desc)" : "read first in the list (asc)";
89
+ }
90
+ /** Move existing records of `entityName` within one manual-order list. */
91
+ export async function reorderRecords(entityName, recordIds, contextField, contextValue, where, anchorId, direction = "desc") {
92
+ const context = { field: contextField ?? null, value: contextValue ?? null };
93
+ const problem = idsProblem(recordIds) ?? placementProblem(where, anchorId ?? null, recordIds);
94
+ if (problem)
95
+ return refuse(problem);
96
+ const check = await orderContextRefusal(entityName, context);
97
+ if (check.refusal !== null)
98
+ return refuse(check.refusal);
99
+ const { list } = check;
100
+ const toCheck = anchorId === null || anchorId === undefined ? [...recordIds] : [...recordIds, anchorId];
101
+ const notHere = await membershipRefusal(entityName, list, toCheck);
102
+ if (notHere)
103
+ return refuse(notHere);
104
+ const anchor = await resolveAnchor(entityName, list, direction, where, anchorId ?? null, recordIds);
105
+ const placed = await place(entityName, context, direction, recordIds, anchor);
106
+ return jsonResponse({
107
+ reordered: placed.anchor === null ? [] : recordIds,
108
+ entity: entityName,
109
+ context_field: context.field,
110
+ context_value: context.value,
111
+ direction,
112
+ ...placedAnswer(placed),
113
+ ...(placed.anchor === null ? { note: "Nothing else stands in that list — a single record has no place to move to." } : {}),
114
+ read_back: orderByText(context, direction),
115
+ });
116
+ }
117
+ /**
118
+ * Create records of `entityName` at a place in one manual-order list. Everything
119
+ * that can be refused is refused BEFORE the create — the context, a record that
120
+ * names another list, an anchor that is missing or elsewhere — so a refusal never
121
+ * leaves a stray record. After the create, the new rows are checked to stand in
122
+ * the list before they are placed; if they do not, or only the placing fails,
123
+ * the records exist and the answer says so, with their ids and the exact
124
+ * suppa_reorder_records call that places them.
125
+ */
126
+ export async function insertRecordAt(entityName, fieldsJson, contextField, contextValue, where, anchorId, direction = "desc") {
127
+ const context = { field: contextField ?? null, value: contextValue ?? null };
128
+ let parsed;
129
+ try {
130
+ parsed = parseJsonParam(fieldsJson, "fields_json");
131
+ }
132
+ catch (e) {
133
+ return refuse(e instanceof Error ? e.message : String(e));
134
+ }
135
+ const rows = (Array.isArray(parsed) ? parsed : [parsed]);
136
+ if (rows.length === 0)
137
+ return refuse("fields_json is an empty array — nothing to insert.");
138
+ if (rows.length > MAX_ORDER_IDS)
139
+ return refuse(`fields_json has ${rows.length} records; one call inserts at most ${MAX_ORDER_IDS}.`);
140
+ const bad = rows.findIndex((r) => r === null || typeof r !== "object" || Array.isArray(r));
141
+ if (bad !== -1)
142
+ return refuse(`fields_json[${bad}] must be a JSON object of field values.`);
143
+ const problem = placementProblem(where, anchorId ?? null, []);
144
+ if (problem)
145
+ return refuse(problem);
146
+ const check = await orderContextRefusal(entityName, context);
147
+ if (check.refusal !== null)
148
+ return refuse(check.refusal);
149
+ const { list } = check;
150
+ // A record placed in a list must stand in it: the context field is filled in
151
+ // when a record leaves it out, and a record that names another list is refused.
152
+ const records = rows.map((r) => ({ ...r }));
153
+ if (context.field !== null) {
154
+ for (const [i, r] of records.entries()) {
155
+ const given = r[context.field];
156
+ if (given === undefined) {
157
+ if (context.value !== null)
158
+ r[context.field] = { id: context.value };
159
+ continue;
160
+ }
161
+ if (idOf(given) !== context.value) {
162
+ return refuse(`fields_json[${i}].${context.field} is ${JSON.stringify(given)}, but the list is ` +
163
+ `${context.field} = ${String(context.value)} — a record inserted there must stand in it. Nothing was inserted.`);
164
+ }
165
+ }
166
+ }
167
+ // An owner list holds the top level: a record with a parent belongs to that parent's list.
168
+ const top = list.topLevelField;
169
+ if (top !== null) {
170
+ const i = records.findIndex((r) => idOf(r[top] ?? null) !== null);
171
+ if (i !== -1) {
172
+ const parent = idOf(records[i][top]);
173
+ return refuse(`fields_json[${i}].${top} is ${JSON.stringify(records[i][top])}: the list ${String(context.field)} = ` +
174
+ `${String(context.value)} holds the top level only, and a record with a ${top} stands in that ${top}'s list — ` +
175
+ `insert it with context_field='${top}', context_value=${parent}. Nothing was inserted.`);
176
+ }
177
+ }
178
+ if (anchorId !== null && anchorId !== undefined) {
179
+ const notHere = await membershipRefusal(entityName, list, [anchorId]);
180
+ if (notHere)
181
+ return refuse(notHere);
182
+ }
183
+ const anchor = await resolveAnchor(entityName, list, direction, where, anchorId ?? null, []);
184
+ const created = JSON.parse(await createRecord(entityName, JSON.stringify(records)));
185
+ const ids = Array.isArray(created.records)
186
+ ? created.records.map((r) => idOf(r)).filter((n) => n !== null)
187
+ : [];
188
+ if (ids.length === 0)
189
+ return jsonResponse(created); // a refusal, or nothing came back: nothing to place
190
+ const notes = createNotes(created);
191
+ const recovery = reorderCall(entityName, ids, context, where, anchorId ?? null, direction);
192
+ // The new rows must stand in the list before an order row is written for them.
193
+ const outside = await createdOutsideList(entityName, list, ids, created.records);
194
+ if (outside) {
195
+ return jsonResponse({
196
+ inserted_ids: ids,
197
+ entity: entityName,
198
+ placed: false,
199
+ warning: `The records were created but NOT placed: ${outside} An order row would go into a list they do not stand ` +
200
+ `in. Do NOT insert them again — check them with suppa_search_records; once they stand in the list, place ` +
201
+ `them with ${recovery}.`,
202
+ ...notes,
203
+ });
204
+ }
205
+ try {
206
+ const placed = await place(entityName, context, direction, ids, anchor);
207
+ return jsonResponse({
208
+ inserted_ids: ids,
209
+ entity: entityName,
210
+ context_field: context.field,
211
+ context_value: context.value,
212
+ direction,
213
+ ...placedAnswer(placed),
214
+ read_back: orderByText(context, direction),
215
+ ...notes,
216
+ });
217
+ }
218
+ catch (e) {
219
+ const msg = e instanceof Error ? e.message : String(e);
220
+ return jsonResponse({
221
+ inserted_ids: ids,
222
+ entity: entityName,
223
+ warning: `The records were created but placing them failed: ${msg}. With no place of their own yet they ` +
224
+ `${unplacedSide(direction)}. Do NOT insert them again — place them with ${recovery}.`,
225
+ ...notes,
226
+ });
227
+ }
228
+ }
229
+ /**
230
+ * Why the created rows do not stand in `list`, or null. A platform default or a
231
+ * hook can put a record elsewhere, and a context field the caller may not write
232
+ * is dropped. The create's answer shows the fields it was sent; when it does not
233
+ * show every list field, the rows are read back with the caller's rights.
234
+ */
235
+ async function createdOutsideList(entity, list, ids, answered) {
236
+ if (list.context.field === null)
237
+ return null; // the entity's own list holds every row
238
+ const fields = listFields(list);
239
+ const rows = (Array.isArray(answered) ? answered : []).filter((r) => r !== null && typeof r === "object");
240
+ const shown = rows.length === ids.length && rows.every((r) => fields.every((f) => Object.prototype.hasOwnProperty.call(r, f)));
241
+ if (shown)
242
+ return listProblem(entity, list, ids, new Map(rows.map((r) => [r.id, r])));
243
+ try {
244
+ return listProblem(entity, list, ids, await readOrderRows(entity, ids, fields));
245
+ }
246
+ catch (e) {
247
+ return `they could not be read back to check their list (${e instanceof Error ? e.message : String(e)}).`;
248
+ }
249
+ }
250
+ /**
251
+ * What suppa_create_record says about the same write and an insert at a place
252
+ * must not drop: a wrong-group enum value, a direct write to a custom-values
253
+ * table, and fewer rows created than requested.
254
+ */
255
+ function createNotes(created) {
256
+ const notes = {};
257
+ if (created.enum_group_warning)
258
+ notes.enum_group_warning = created.enum_group_warning;
259
+ if (created.direct_extension_write_warning)
260
+ notes.direct_extension_write_warning = created.direct_extension_write_warning;
261
+ if (typeof created.created === "number" && created.created !== created.requested) {
262
+ notes.created = created.created;
263
+ notes.requested = created.requested;
264
+ }
265
+ return notes;
266
+ }
@@ -396,25 +396,80 @@ async function _resolveCurrentUserId() {
396
396
  }
397
397
  throw new Error("Could not resolve current user id");
398
398
  }
399
- /** Add a comment to a task. Content supports HTML. mention_ids: comma-separated 'id:Name' pairs. */
399
+ /** The user ids a comment's HTML already mentions — `<a class="mention-user" data-id="…">`, the markup the
400
+ * platform reads mentions from (entity-builder common/utils/mention.util.ts, `a.mention-user[data-id]`). */
401
+ export function mentionedIdsIn(html) {
402
+ const out = new Set();
403
+ for (const m of html.matchAll(/<a\b[^>]*>/gi)) {
404
+ const tag = m[0];
405
+ if (!/\bclass\s*=\s*["'][^"']*\bmention-user\b/i.test(tag))
406
+ continue;
407
+ const id = /\bdata-id\s*=\s*["']([^"']+)["']/i.exec(tag)?.[1]?.trim();
408
+ if (id)
409
+ out.add(id);
410
+ }
411
+ return out;
412
+ }
413
+ const escapeHtml = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
414
+ /**
415
+ * Add a comment to a task. Content supports HTML. mention_ids: comma-separated 'id:Name' pairs.
416
+ *
417
+ * A mention is ONE tag per user, in the order given, inside the comment's first paragraph. Up to
418
+ * 1.46.0 every pair was prepended whatever the content held: an agent that wrote the mention into the
419
+ * text AND passed mention_ids got the same `@Name` twice in the comment (reported 2026-11-19), a repeated
420
+ * pair repeated it again, the tags came out in reverse order, and a plain-text comment with a mention
421
+ * lost its <p> (the tags made it start with `<`). A user the content already mentions is not added
422
+ * again; an id that is not a user id (digits, or the front's `$all`) is refused before anything is sent.
423
+ */
400
424
  export async function addComment(taskId, content, mentionIds = null) {
401
- let html = content;
402
- // Process mentions (prepended, matching platform format)
425
+ let html = String(content ?? "");
426
+ // Plain text becomes paragraphs FIRST, so the mentions land inside the first one.
427
+ if (!html.replace(/^\s+/, "").startsWith("<")) {
428
+ html = wrapHtml(html);
429
+ }
430
+ const added = [];
431
+ const alreadyInContent = [];
403
432
  if (mentionIds) {
404
- for (let part of mentionIds.split(",")) {
405
- part = part.trim();
406
- if (part.includes(":")) {
407
- const idx = part.indexOf(":");
408
- const uid = part.slice(0, idx).trim();
409
- const name = part.slice(idx + 1).trim();
410
- const mentionTag = `<a class="mention-user" id="mention-${uid}" ` +
411
- `data-id="${uid}">@${name}</a>&nbsp;`;
412
- html = mentionTag + html;
433
+ const present = mentionedIdsIn(html);
434
+ const seen = new Set();
435
+ const tags = [];
436
+ const bad = [];
437
+ for (const raw of mentionIds.split(",")) {
438
+ const part = raw.trim();
439
+ if (!part)
440
+ continue;
441
+ const idx = part.indexOf(":");
442
+ const uid = (idx === -1 ? part : part.slice(0, idx)).trim();
443
+ const name = idx === -1 ? "" : part.slice(idx + 1).trim();
444
+ if (!/^\d+$/.test(uid) && uid !== "$all") {
445
+ bad.push(part);
446
+ continue;
447
+ }
448
+ if (seen.has(uid))
449
+ continue;
450
+ seen.add(uid);
451
+ if (present.has(uid)) {
452
+ alreadyInContent.push(uid);
453
+ continue;
454
+ }
455
+ if (!name) {
456
+ bad.push(part);
457
+ continue;
413
458
  }
459
+ tags.push(`<a class="mention-user" id="mention-${uid}" data-id="${uid}">@${escapeHtml(name)}</a>&nbsp;`);
460
+ added.push(uid);
461
+ }
462
+ if (bad.length) {
463
+ return jsonResponse({
464
+ error: `mention_ids: ${bad.map((b) => `'${b}'`).join(", ")} — each mention is 'userId:Name' with a numeric user id ` +
465
+ "(suppa_search_users finds it). Nothing was posted.",
466
+ });
467
+ }
468
+ if (tags.length) {
469
+ const prefix = tags.join("");
470
+ const firstParagraph = /^(\s*<p\b[^>]*>)/i.exec(html);
471
+ html = firstParagraph ? firstParagraph[1] + prefix + html.slice(firstParagraph[1].length) : prefix + html;
414
472
  }
415
- }
416
- if (!html.replace(/^\s+/, "").startsWith("<")) {
417
- html = wrapHtml(html);
418
473
  }
419
474
  const fields = {
420
475
  owner: { id: taskId },
@@ -422,7 +477,18 @@ export async function addComment(taskId, content, mentionIds = null) {
422
477
  content: html,
423
478
  };
424
479
  const result = await insertEntity("TasksComments", [fields]);
425
- return jsonResponse(result.length ? result[0] : null);
480
+ const row = result.length ? result[0] : null;
481
+ if (!mentionIds || !row || typeof row !== "object")
482
+ return jsonResponse(row);
483
+ return jsonResponse({
484
+ ...row,
485
+ mentions: {
486
+ added,
487
+ ...(alreadyInContent.length
488
+ ? { already_in_content: alreadyInContent, note: "these users are mentioned in the content itself — not added a second time" }
489
+ : {}),
490
+ },
491
+ });
426
492
  }
427
493
  /**
428
494
  * Get the latest N comments for a task, oldest-first.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suppa-mcp-2",
3
- "version": "1.45.0",
3
+ "version": "1.46.1",
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": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: suppa-cli
3
- description: Use when working with a Suppa 2.0 tenant from a terminal — tasks, records, entities, custom fields, docs, forms, automations, file attachments. The `suppa` command carries all 108 operations with browser-based login and token storage in the OS keychain. Prefer it over hand-written HTTP calls: validates arguments before sending and explains platform refusals.
3
+ description: Use when working with a Suppa 2.0 tenant from a terminal — tasks, records, entities, custom fields, docs, forms, automations, file attachments. The `suppa` command carries all 110 operations with browser-based login and token storage in the OS keychain. Prefer it over hand-written HTTP calls: validates arguments before sending and explains platform refusals.
4
4
  ---
5
5
 
6
6
  # Suppa 2.0 from the shell
@@ -17,7 +17,10 @@ Never ask the user for a token: `suppa login` is the way in.
17
17
 
18
18
  JSON, non-ASCII text or typed numbers go through `--args-file <path>` (a JSON
19
19
  object of arguments) or `--args-stdin` — never through quoted inline JSON, which
20
- PowerShell rewrites silently. `--tenant <alias>` points one call elsewhere
20
+ PowerShell rewrites silently. On Windows `suppa` from PowerShell or cmd runs
21
+ `suppa.cmd`, and cmd.exe ENDS the command at an `&` — every flag after it is lost
22
+ — and may garble non-ASCII: keep both in `--args-file`, or run from Git Bash.
23
+ `--tenant <alias>` points one call elsewhere
21
24
  without remembering it; `--pretty` re-indents the answer. Exit codes: `0` done,
22
25
  `1` the tool or the platform refused, or the answer says the work is not done
23
26
  (`passed: false`, `created: false`, a non-zero `failed`), `2` refused before
@@ -28,11 +31,14 @@ next flag is refused.
28
31
  Writes are gated — an update, move, close or delete does nothing without
29
32
  `--confirm`. Show the user what will change, get their word, then re-run with it.
30
33
 
31
- For an endpoint no command covers, `suppa api <METHOD> <path>` makes the raw
32
- call with this session. Reads (GET; POST to …/select, …/search, …/query,
33
- …/count) go at once. Anything else only prints the request; it is sent with
34
- `--confirm` AND an explicit `--tenant <alias>`, never to the remembered tenant.
35
- It skips every check the commands make, so prefer a command when one exists.
34
+ For an endpoint no command covers, `suppa api <METHOD> <path> --tenant <alias>`
35
+ makes the raw call with this session — every call names its tenant, reads too.
36
+ Reads (GET; POST to …/select, …/search, …/query, …/count, and the register reads
37
+ such as registers/<name>/balance and registers/recorders/status) go at once.
38
+ Anything else only prints the request; `--confirm` sends it. Query parameters go
39
+ as `--query key=value`, never `&` in the path; the whole call fits in
40
+ `--args-file` as {method, path, query, body, tenant}. It skips every check the
41
+ commands make, so prefer a command when one exists.
36
42
  In Git Bash write the path without its leading slash (`core/schema`): MSYS
37
43
  rewrites an argument that starts with `/` into a Windows path.
38
44
 
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "source": "platform-front (suppa front)",
3
- "ref": "origin/backend2/develop",
3
+ "ref": "41a0f90a2e426b8a745353cf29685feab24202aa",
4
4
  "commit": "41a0f90a2e426b8a745353cf29685feab24202aa",
5
5
  "committed": "2026-11-12",
6
- "pulledAt": "2026-11-12",
6
+ "pulledAt": "2026-11-16",
7
7
  "files": {
8
8
  "code-form/sdk/index.d.ts": {
9
9
  "from": "src/formBuilderV2/codeForm/virtualProject/generatedSdkDts.ts (CODE_FORM_SDK_DTS)",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts/code-form/code-form-core.mjs": {
14
14
  "from": "codeForm/typeGen, codeForm/virtualProject, codeForm/diagnostics, codeForm/files, chart/custom/customChartSchema, shared/dynamicWidget/widgetApiKeys",
15
- "bytes": 22840
15
+ "bytes": 22269
16
16
  }
17
17
  },
18
18
  "why": "Vendored, not depended on. The backend builds a form's code against ITS OWN SDK copy, so a check against a stale snapshot can pass here and fail on save (or the reverse) — re-run scripts/sync-code-form.mjs after every front release that touches Code Form."
@@ -1,9 +1,9 @@
1
- // VENDORED from the front (origin/backend2/develop 41a0f90a2e, 2026-11-12) by scripts/sync-code-form.mjs — do not edit.
1
+ // VENDORED from the front (41a0f90a2e426b8a745353cf29685feab24202aa 41a0f90a2e, 2026-11-12) by scripts/sync-code-form.mjs — do not edit.
2
2
  // The Code Form editor's own generators and rules: what suppa_form_code types a form's code with.
3
3
  export const FRONT_COMMIT = "41a0f90a2e426b8a745353cf29685feab24202aa";
4
4
  export const FORBIDDEN_IMPORT_TEXT = "Only relative imports, “{'@'}suppa/frontend-sdk” and shared modules (“{'@'}shared/…”) are allowed in Code Form.";
5
5
 
6
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/codeForm/typeGen/CodeFormTypeGenerator.ts
6
+ // src/formBuilderV2/codeForm/typeGen/CodeFormTypeGenerator.ts
7
7
  var PRESENTATION_TYPE_NAMES = {
8
8
  desktop: { elements: "DesktopFormElements", api: "DesktopFormAPI" },
9
9
  mobile: { elements: "MobileFormElements", api: "MobileFormAPI" }
@@ -156,7 +156,7 @@ function variableApiType(variable) {
156
156
  return `VariableApiFor<'${escapeStringLiteral(variable.type)}'>`;
157
157
  }
158
158
 
159
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/elements/chart/custom/customChartSchema.ts
159
+ // src/formBuilderV2/elements/chart/custom/customChartSchema.ts
160
160
  var PROTOTYPE_NAMES = new Set(Object.getOwnPropertyNames(Object.prototype));
161
161
  function measureKeyOf(measure) {
162
162
  return measure.key || measure.id;
@@ -171,7 +171,7 @@ function customSourcesOfSchema(schema) {
171
171
  return Object.entries(sources).map(([name, source]) => ({ name, measures: measureKeysOf(source) }));
172
172
  }
173
173
 
174
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/shared/dynamicWidget/widgetApiKeys.ts
174
+ // src/formBuilderV2/shared/dynamicWidget/widgetApiKeys.ts
175
175
  var DEFINE_API = "defineApi";
176
176
  var MEMBER_KEY = /^(?:(get|set)\s+)?(?:async\s+)?\*?\s*(?:(['"])((?:[^'"\\]|\\.)+)\2|([\p{ID_Start}_$][\p{ID_Continue}$]*))\s*(\(|:)?/u;
177
177
  var VALUE_LITERAL = /^(?:-?\d|['"`[{/]|true\b|false\b|null\b|undefined\b|new\b)/;
@@ -376,7 +376,7 @@ function parseMember(part) {
376
376
  return { name, kind: "method" };
377
377
  }
378
378
 
379
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/codeForm/virtualProject/CodeFormVirtualProject.ts
379
+ // src/formBuilderV2/codeForm/virtualProject/CodeFormVirtualProject.ts
380
380
  var SDK_LIB_PATH = "file:///node_modules/@suppa/frontend-sdk/index.d.ts";
381
381
  var USER_FILE_SCHEME = "file:///";
382
382
  var CODE_FORM_LIB = ["es2023"];
@@ -492,7 +492,7 @@ export {};
492
492
  `.trimStart();
493
493
  }
494
494
 
495
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/codeForm/runtime/moduleSyntax.ts
495
+ // src/formBuilderV2/codeForm/runtime/moduleSyntax.ts
496
496
  var SHARED_PREFIX = "@shared/";
497
497
  var SHARED_MODULE_NAME = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/;
498
498
  function sharedModuleName(specifier) {
@@ -501,7 +501,7 @@ function sharedModuleName(specifier) {
501
501
  return SHARED_MODULE_NAME.test(name) ? name : null;
502
502
  }
503
503
 
504
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/codeForm/diagnostics/CodeFormDiagnostics.ts
504
+ // src/formBuilderV2/codeForm/diagnostics/CodeFormDiagnostics.ts
505
505
  var FORBIDDEN_IMPORT_MESSAGE_KEY = "formBuilder.code.forbiddenImport";
506
506
  var STATIC_IMPORT_RE = /(?:\bimport\b|\bexport\b)(?:[^'"();]*?\bfrom\b)?\s*(['"])([^'"]+)\1/g;
507
507
  var DYNAMIC_IMPORT_RE = /\bimport\s*\(\s*(['"])([^'"]+)\1\s*\)/g;
@@ -545,7 +545,7 @@ function collectForbidden(code, regex, found) {
545
545
  }
546
546
  }
547
547
 
548
- // ../../../../../../../../../../ANDRII~1.HER/AppData/Local/Temp/sync-code-form-Y0Gw0v/src/formBuilderV2/codeForm/files/CodeFormFileUtils.ts
548
+ // src/formBuilderV2/codeForm/files/CodeFormFileUtils.ts
549
549
  var ENTRY_PATH = "src/index.ts";
550
550
  export {
551
551
  CODE_FORM_LIB,