bpmax-cli 0.2.1-beta.76 → 0.2.1-beta.78
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/dist/bin.js +857 -27
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-cli/SKILL.md +1 -0
- package/skills/bpmax-home-portal-editor/SKILL.md +79 -0
- package/skills/bpmax-page-composition-template-editor/SKILL.md +91 -2
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-dashboard.json +215 -6
- package/skills/bpmax-page-composition-template-editor/examples/presets/project-operations-visual-light.json +52 -3
package/dist/bin.js
CHANGED
|
@@ -326,6 +326,14 @@ function capabilityForRequest(method, path29) {
|
|
|
326
326
|
if (normalizedMethod === "GET" && /^\/page_composition_asset\/\d+$/.test(normalizedPath)) return "config.page_template.asset.list";
|
|
327
327
|
if (normalizedMethod === "POST" && /^\/page_composition_asset\/\d+$/.test(normalizedPath)) return "config.page_template.asset.upload";
|
|
328
328
|
if (normalizedMethod === "DELETE" && /^\/page_composition_asset\/\d+$/.test(normalizedPath)) return "config.page_template.asset.delete";
|
|
329
|
+
if (normalizedMethod === "GET" && normalizedPath === "/home_portal") return "config.home_portal.export";
|
|
330
|
+
if (normalizedMethod === "GET" && normalizedPath === "/home_portal/flows") return "config.home_portal.flows";
|
|
331
|
+
if (normalizedMethod === "GET" && normalizedPath === "/home_portal/nav_preview") return "config.home_portal.preview";
|
|
332
|
+
if (normalizedMethod === "GET" && normalizedPath === "/home_portal/workspaces") return "config.home_portal.preview";
|
|
333
|
+
if (normalizedMethod === "GET" && normalizedPath === "/home_portal/copy_preview") return "config.home_portal.preview";
|
|
334
|
+
if (normalizedMethod === "PUT" && normalizedPath === "/home_portal") return "config.home_portal.submit";
|
|
335
|
+
if (normalizedMethod === "POST" && normalizedPath === "/home_portal/nav_import") return "config.home_portal.nav_import";
|
|
336
|
+
if (normalizedMethod === "POST" && normalizedPath === "/home_portal/copy") return "config.home_portal.copy";
|
|
329
337
|
if (normalizedMethod === "GET" && normalizedPath === "/flow_page_template/generate_report") return "config.flow_detail_template.render";
|
|
330
338
|
if (normalizedMethod === "POST" && normalizedPath === "/flow_page_template") return `${pageTemplatePrefix}.create`;
|
|
331
339
|
if (normalizedMethod === "GET" && normalizedPath === "/flow_page_template") return `${pageTemplatePrefix}.export`;
|
|
@@ -514,7 +522,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
|
|
|
514
522
|
// package.json
|
|
515
523
|
var package_default = {
|
|
516
524
|
name: "bpmax-cli",
|
|
517
|
-
version: "0.2.1-beta.
|
|
525
|
+
version: "0.2.1-beta.78",
|
|
518
526
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
519
527
|
type: "module",
|
|
520
528
|
bin: {
|
|
@@ -1368,7 +1376,7 @@ function parseQuery(path29) {
|
|
|
1368
1376
|
}
|
|
1369
1377
|
function isRawConfigPath(method, path29) {
|
|
1370
1378
|
const normalizedPath = normalizeApiPath2(path29);
|
|
1371
|
-
if (/^\/(configuration|form_template|flow_page_template|data_set|data_set_field|api_platform|api_platform_instance|api_proxy|api_proxy_entity_binding|entity|entity_field|role|point|user_role|workspace|group|config_repository)(\/|$)/.test(normalizedPath)) {
|
|
1379
|
+
if (/^\/(configuration|home_portal|form_template|flow_page_template|data_set|data_set_field|api_platform|api_platform_instance|api_proxy|api_proxy_entity_binding|entity|entity_field|role|point|user_role|workspace|group|config_repository)(\/|$)/.test(normalizedPath)) {
|
|
1372
1380
|
return true;
|
|
1373
1381
|
}
|
|
1374
1382
|
if (normalizedPath === "/flow/list/lightweight" || normalizedPath.startsWith("/flow/configuration/")) {
|
|
@@ -4929,6 +4937,48 @@ function textOf(value) {
|
|
|
4929
4937
|
if (isRecord4(value)) return Object.values(value).map(textOf).join(" ");
|
|
4930
4938
|
return "";
|
|
4931
4939
|
}
|
|
4940
|
+
function changedTextFragment(before, after) {
|
|
4941
|
+
if (before === after) return "";
|
|
4942
|
+
let prefix = 0;
|
|
4943
|
+
while (prefix < before.length && prefix < after.length && before[prefix] === after[prefix]) prefix += 1;
|
|
4944
|
+
let suffix = 0;
|
|
4945
|
+
while (suffix < before.length - prefix && suffix < after.length - prefix && before[before.length - 1 - suffix] === after[after.length - 1 - suffix]) suffix += 1;
|
|
4946
|
+
const changedExpression = (text5, offset, endOffset) => {
|
|
4947
|
+
const boundary = Math.max(
|
|
4948
|
+
text5.lastIndexOf("\n", Math.max(0, offset - 1)),
|
|
4949
|
+
text5.lastIndexOf(";", Math.max(0, offset - 1)),
|
|
4950
|
+
text5.lastIndexOf("{", Math.max(0, offset - 1)),
|
|
4951
|
+
text5.lastIndexOf("}", Math.max(0, offset - 1))
|
|
4952
|
+
) + 1;
|
|
4953
|
+
const end = text5.indexOf(";", endOffset);
|
|
4954
|
+
return text5.slice(boundary, end === -1 ? text5.length : end);
|
|
4955
|
+
};
|
|
4956
|
+
const enclosingFunction = (text5, offset) => {
|
|
4957
|
+
const starts = [...text5.matchAll(/\bfunction\s+[A-Za-z_$][\w$]*\s*\([^)]*\)\s*\{/g)].map((match) => match.index ?? -1).filter((index) => index >= 0 && index < offset);
|
|
4958
|
+
const start = starts.at(-1);
|
|
4959
|
+
if (start === void 0) return "";
|
|
4960
|
+
let depth = 0;
|
|
4961
|
+
let opened = false;
|
|
4962
|
+
for (let index = start; index < text5.length; index += 1) {
|
|
4963
|
+
if (text5[index] === "{") {
|
|
4964
|
+
depth += 1;
|
|
4965
|
+
opened = true;
|
|
4966
|
+
} else if (text5[index] === "}" && opened) {
|
|
4967
|
+
depth -= 1;
|
|
4968
|
+
if (depth === 0) return offset <= index ? text5.slice(start, index + 1) : "";
|
|
4969
|
+
}
|
|
4970
|
+
}
|
|
4971
|
+
return "";
|
|
4972
|
+
};
|
|
4973
|
+
return [
|
|
4974
|
+
changedExpression(before, prefix, before.length - suffix),
|
|
4975
|
+
before.slice(prefix, before.length - suffix),
|
|
4976
|
+
changedExpression(after, prefix, after.length - suffix),
|
|
4977
|
+
after.slice(prefix, after.length - suffix),
|
|
4978
|
+
enclosingFunction(before, prefix),
|
|
4979
|
+
enclosingFunction(after, prefix)
|
|
4980
|
+
].join("\n");
|
|
4981
|
+
}
|
|
4932
4982
|
function containsPermissionIdentifier(value) {
|
|
4933
4983
|
return /(?:^|[^A-Za-z0-9])(?:permission|permissions|role|roles|scope|organization|product|gtm|authorize|authorization)(?:$|[^A-Za-z0-9])|\$CAN_|\$canInFlow|__owner_id|project\.(?:view|delete)/i.test(value);
|
|
4934
4984
|
}
|
|
@@ -4952,7 +5002,10 @@ function matchesBoundary(path29, declared) {
|
|
|
4952
5002
|
}
|
|
4953
5003
|
function analyzeListTemplatePermissionBoundary(raw, work, manifest) {
|
|
4954
5004
|
const changedPaths = changedJsonPaths(raw, work);
|
|
4955
|
-
const permissionRelated = changedPaths.some((path29) => containsPermissionIdentifier(path29) || containsPermissionIdentifier(
|
|
5005
|
+
const permissionRelated = changedPaths.some((path29) => containsPermissionIdentifier(path29) || containsPermissionIdentifier(changedTextFragment(
|
|
5006
|
+
textOf(valueAtPointer(raw, path29)),
|
|
5007
|
+
textOf(valueAtPointer(work, path29))
|
|
5008
|
+
)));
|
|
4956
5009
|
if (!permissionRelated) {
|
|
4957
5010
|
return { permission_related: false, changed_paths: changedPaths, boundary: null };
|
|
4958
5011
|
}
|
|
@@ -5559,6 +5612,18 @@ var CONFIG_DOMAINS = {
|
|
|
5559
5612
|
readEndpoints: ["GET /api/configuration?q_type=:type&is_default_action=1&page=1&page_size=10000", "GET /api/point/point_list", "GET /api/group/sub_groups"],
|
|
5560
5613
|
writeEndpoints: ["PUT /api/configuration/:id?is_default_action=1", "POST /api/configuration?is_default_action=1", "DELETE /api/configuration/:id?is_default_action=1"],
|
|
5561
5614
|
notes: ["Nav config is four configuration records (navmenu/shortcut/navmenu_mobile/shortcut_mobile). Export id is the workspace key. Submit writes all four records as an operation plan."]
|
|
5615
|
+
},
|
|
5616
|
+
"home-portal": {
|
|
5617
|
+
capability: "config.home_portal",
|
|
5618
|
+
exportPath: () => "/home_portal",
|
|
5619
|
+
exportStatus: "supported",
|
|
5620
|
+
buildStatus: "supported",
|
|
5621
|
+
submitStatus: "supported",
|
|
5622
|
+
submitPath: () => "/home_portal",
|
|
5623
|
+
submitMethod: "PUT",
|
|
5624
|
+
readEndpoints: ["GET /api/home_portal", "GET /api/home_portal/flows", "GET /api/home_portal/nav_preview", "GET /api/home_portal/workspaces", "GET /api/home_portal/copy_preview"],
|
|
5625
|
+
writeEndpoints: ["PUT /api/home_portal", "POST /api/home_portal/nav_import", "POST /api/home_portal/copy"],
|
|
5626
|
+
notes: ["Workspace-scoped flow portal bundle. Export/submit uses the workspace profile and optimistic version CAS; use nav/copy specialized APIs for preview-token imports."]
|
|
5562
5627
|
}
|
|
5563
5628
|
};
|
|
5564
5629
|
var CONFIG_SUBMIT_UNSUPPORTED_MESSAGE = "Typed config build/submit adapters are not implemented for this domain yet. Stop before remote writes and use the matching editor Skill verified scripts until bpmax-cli adds a domain-specific adapter.";
|
|
@@ -5684,6 +5749,53 @@ function normalizeWorkspaceKey(workspace) {
|
|
|
5684
5749
|
const nextWorkspace = workspace.trim().replace(/^\/+|\/+$/g, "");
|
|
5685
5750
|
return nextWorkspace.startsWith("w:") ? nextWorkspace.slice(2) : nextWorkspace;
|
|
5686
5751
|
}
|
|
5752
|
+
function normalizeHomePortalPayload(work) {
|
|
5753
|
+
const version = Number(work.version);
|
|
5754
|
+
if (!Number.isSafeInteger(version) || version < 0) throw new Error("home-portal version must be a non-negative integer.");
|
|
5755
|
+
const categories = Array.isArray(work.categories) ? work.categories : [];
|
|
5756
|
+
const entries = Array.isArray(work.entries) ? work.entries : [];
|
|
5757
|
+
const categoryIds = new Set(categories.map((item) => isRecord5(item) ? String(item.id ?? "") : ""));
|
|
5758
|
+
if (categories.some((item) => !isRecord5(item) || !String(item.id ?? "").trim())) throw new Error("home-portal categories require string ids.");
|
|
5759
|
+
const clean = (value, max) => String(value ?? "").trim().slice(0, max);
|
|
5760
|
+
const normalizedEntries = entries.map((item, index) => {
|
|
5761
|
+
if (!isRecord5(item)) throw new Error(`home-portal entry ${index} must be an object.`);
|
|
5762
|
+
const categoryId = clean(item.categoryId ?? item.category_id, 120);
|
|
5763
|
+
const pathValue2 = clean(item.path, 2e3);
|
|
5764
|
+
if (!categoryIds.has(categoryId) || !pathValue2) throw new Error(`home-portal entry ${index} requires a valid categoryId and path.`);
|
|
5765
|
+
return {
|
|
5766
|
+
id: clean(item.id, 120) || `entry-${index + 1}`,
|
|
5767
|
+
categoryId,
|
|
5768
|
+
name: clean(item.name, 120) || `\u5165\u53E3 ${index + 1}`,
|
|
5769
|
+
description: clean(item.description, 500),
|
|
5770
|
+
path: pathValue2,
|
|
5771
|
+
linkLabel: clean(item.linkLabel ?? item.link_label, 120),
|
|
5772
|
+
secondPath: clean(item.secondPath ?? item.second_path, 2e3),
|
|
5773
|
+
secondLinkLabel: clean(item.secondLinkLabel ?? item.second_link_label, 120),
|
|
5774
|
+
icon: clean(item.icon, 120),
|
|
5775
|
+
color: clean(item.color, 30) || "#4C86F7",
|
|
5776
|
+
openInWindow: Boolean(item.openInWindow ?? item.open_in_window),
|
|
5777
|
+
common: Boolean(item.common),
|
|
5778
|
+
enabled: item.enabled !== false,
|
|
5779
|
+
order: Number(item.order ?? index),
|
|
5780
|
+
flowType: clean(item.flowType ?? item.flow_type, 120),
|
|
5781
|
+
flowKey: clean(item.flowKey ?? item.flow_key, 120),
|
|
5782
|
+
permissionType: clean(item.permissionType ?? item.permission_type, 40),
|
|
5783
|
+
permission: clean(item.permission, 255),
|
|
5784
|
+
visibility: clean(item.visibility, 40) || "public",
|
|
5785
|
+
visibility_scope: item.visibility_scope ?? "",
|
|
5786
|
+
sourceNavId: clean(item.sourceNavId ?? item.source_nav_id, 120)
|
|
5787
|
+
};
|
|
5788
|
+
});
|
|
5789
|
+
return {
|
|
5790
|
+
workspace: normalizeWorkspaceKey(clean(work.workspace, 120)),
|
|
5791
|
+
version,
|
|
5792
|
+
categories: categories.map((item, index) => {
|
|
5793
|
+
if (!isRecord5(item)) throw new Error(`home-portal category ${index} must be an object.`);
|
|
5794
|
+
return { id: clean(item.id, 120), name: clean(item.name, 120) || `\u5206\u7C7B ${index + 1}`, icon: clean(item.icon, 120), color: clean(item.color, 30), order: Number(item.order ?? index), enabled: item.enabled !== false, permissionType: clean(item.permissionType ?? item.permission_type, 40), permission: clean(item.permission, 255), visibility: clean(item.visibility, 40) || "public", visibility_scope: item.visibility_scope ?? "", sourceNavId: clean(item.sourceNavId ?? item.source_nav_id, 120) };
|
|
5795
|
+
}),
|
|
5796
|
+
entries: normalizedEntries
|
|
5797
|
+
};
|
|
5798
|
+
}
|
|
5687
5799
|
function numericId(value) {
|
|
5688
5800
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
5689
5801
|
return value;
|
|
@@ -10295,6 +10407,44 @@ function pageCompositionCapabilities(template) {
|
|
|
10295
10407
|
return [...new Set([...declared, ...blocks, ...actions].filter((item) => typeof item === "string" && !!item.trim()).map((item) => item.trim()))];
|
|
10296
10408
|
}
|
|
10297
10409
|
var PAGE_COMPOSITION_QUERY_ENGINES = /* @__PURE__ */ new Set(["es", "sql", "api"]);
|
|
10410
|
+
var PAGE_COMPOSITION_QUERY_MODES = /* @__PURE__ */ new Set(["list", "aggregate"]);
|
|
10411
|
+
var PAGE_COMPOSITION_AGGREGATE_TYPES = /* @__PURE__ */ new Set([
|
|
10412
|
+
"terms",
|
|
10413
|
+
"date_histogram",
|
|
10414
|
+
"sum",
|
|
10415
|
+
"avg",
|
|
10416
|
+
"min",
|
|
10417
|
+
"max",
|
|
10418
|
+
"stats",
|
|
10419
|
+
"cardinality",
|
|
10420
|
+
"value_count"
|
|
10421
|
+
]);
|
|
10422
|
+
var PAGE_COMPOSITION_AGGREGATE_BUCKET_TYPES = /* @__PURE__ */ new Set([
|
|
10423
|
+
"terms",
|
|
10424
|
+
"date_histogram"
|
|
10425
|
+
]);
|
|
10426
|
+
var PAGE_COMPOSITION_AGGREGATE_MAX_NODES = 32;
|
|
10427
|
+
var PAGE_COMPOSITION_AGGREGATE_MAX_DEPTH = 3;
|
|
10428
|
+
var PAGE_COMPOSITION_AGGREGATE_MAX_TERMS_SIZE = 100;
|
|
10429
|
+
var PAGE_COMPOSITION_AGGREGATE_PARAM_KEYS = /* @__PURE__ */ new Set([
|
|
10430
|
+
"data_set_id",
|
|
10431
|
+
"data_set_key",
|
|
10432
|
+
"flow_type",
|
|
10433
|
+
"flow_key",
|
|
10434
|
+
"query"
|
|
10435
|
+
]);
|
|
10436
|
+
var PAGE_COMPOSITION_AGGREGATE_QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
10437
|
+
"term",
|
|
10438
|
+
"terms",
|
|
10439
|
+
"match",
|
|
10440
|
+
"match_phrase",
|
|
10441
|
+
"prefix",
|
|
10442
|
+
"wildcard",
|
|
10443
|
+
"exists",
|
|
10444
|
+
"range"
|
|
10445
|
+
]);
|
|
10446
|
+
var PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_FIELDS = 50;
|
|
10447
|
+
var PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_VALUES = 100;
|
|
10298
10448
|
var PAGE_COMPOSITION_ES_BODY_KEYS = [
|
|
10299
10449
|
"data_set_id",
|
|
10300
10450
|
"data_set_key",
|
|
@@ -10308,6 +10458,7 @@ var PAGE_COMPOSITION_ES_DEFAULT_PAGE_SIZE = 20;
|
|
|
10308
10458
|
var PAGE_COMPOSITION_ROW_PATH = /^[A-Za-z_$][A-Za-z0-9_$]*(?:\.[A-Za-z0-9_$-]+)*$/;
|
|
10309
10459
|
var PAGE_COMPOSITION_METHOD_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
10310
10460
|
var PAGE_COMPOSITION_METHOD_SHA = /^[a-f0-9]{64}$/i;
|
|
10461
|
+
var PAGE_COMPOSITION_METHOD_RESOURCE_URL = /^\/static\/client\/[^\s"'<>?#]+\.mjs(?:\?[^\s"'<>#]*)?$/i;
|
|
10311
10462
|
var PAGE_COMPOSITION_METHOD_FORBIDDEN = /(?:\b(?:constructor|__proto__|prototype|Function|eval|globalThis|window|document|process|require|import|this|ownerDocument|defaultView|fetch|XMLHttpRequest|WebSocket|setTimeout|setInterval|location|localStorage|sessionStorage|navigator|alert|confirm|prompt)\b|\$(?:root|parent|children|refs|el)\b)/i;
|
|
10312
10463
|
var PAGE_COMPOSITION_METHOD_RESERVED = /* @__PURE__ */ new Set([
|
|
10313
10464
|
"queryRows",
|
|
@@ -10391,7 +10542,7 @@ ${code}
|
|
|
10391
10542
|
const resource = resources.find(
|
|
10392
10543
|
(item) => isRecord5(item) && item.name === definition.resource
|
|
10393
10544
|
);
|
|
10394
|
-
if (!resource || resource.kind !== "script" || resource.format !== "esm" || typeof resource.url !== "string" || !PAGE_COMPOSITION_METHOD_SHA.test(String(resource.sha256 || "")) || !/\.mjs$/i.test(String(resource.name || "")) || !PAGE_COMPOSITION_METHOD_NAME.test(String(definition.export || ""))) {
|
|
10545
|
+
if (!resource || resource.kind !== "script" || resource.format !== "esm" || typeof resource.url !== "string" || !PAGE_COMPOSITION_METHOD_RESOURCE_URL.test(resource.url) || !PAGE_COMPOSITION_METHOD_SHA.test(String(resource.sha256 || "")) || !/\.mjs$/i.test(String(resource.name || "")) || !PAGE_COMPOSITION_METHOD_NAME.test(String(definition.export || ""))) {
|
|
10395
10546
|
errors.push(
|
|
10396
10547
|
`page-template method ${name} requires a registered ESM .mjs script with SHA-256 and a named export.`
|
|
10397
10548
|
);
|
|
@@ -10442,6 +10593,344 @@ function isProjectListResource(resource) {
|
|
|
10442
10593
|
const normalized = String(resource ?? "").trim().replace(/^\/?(api\/)?/, "/").replace(/\/+$/, "");
|
|
10443
10594
|
return normalized === "/project/list";
|
|
10444
10595
|
}
|
|
10596
|
+
function isProjectAggregateResource(resource) {
|
|
10597
|
+
const normalized = String(resource ?? "").trim().replace(/^\/?(api\/)?/, "/").replace(/\/+$/, "");
|
|
10598
|
+
return normalized === "/project/aggregate";
|
|
10599
|
+
}
|
|
10600
|
+
var PAGE_COMPOSITION_FILTER_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
10601
|
+
"status",
|
|
10602
|
+
"keyword",
|
|
10603
|
+
"owner",
|
|
10604
|
+
"created_date",
|
|
10605
|
+
"createdDate"
|
|
10606
|
+
]);
|
|
10607
|
+
var PAGE_COMPOSITION_FILTER_GROUP_NAME = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
10608
|
+
function normalizePageCompositionFilterGroup(name, definition, errors) {
|
|
10609
|
+
const hasCamel = Object.prototype.hasOwnProperty.call(definition, "filterGroup");
|
|
10610
|
+
const hasSnake = Object.prototype.hasOwnProperty.call(definition, "filter_group");
|
|
10611
|
+
if (hasCamel && hasSnake) {
|
|
10612
|
+
errors.push(
|
|
10613
|
+
`[page_template.filter.group_duplicate] query ${name} must use only filterGroup; filter_group is an input alias, not a second declaration.`
|
|
10614
|
+
);
|
|
10615
|
+
return void 0;
|
|
10616
|
+
}
|
|
10617
|
+
if (!hasCamel && !hasSnake) return void 0;
|
|
10618
|
+
const raw = hasCamel ? definition.filterGroup : definition.filter_group;
|
|
10619
|
+
if (typeof raw !== "string" || !PAGE_COMPOSITION_FILTER_GROUP_NAME.test(raw.trim())) {
|
|
10620
|
+
errors.push(
|
|
10621
|
+
`[page_template.filter.group_invalid] query ${name} filterGroup must be a non-empty name matching ${PAGE_COMPOSITION_FILTER_GROUP_NAME.source}.`
|
|
10622
|
+
);
|
|
10623
|
+
return void 0;
|
|
10624
|
+
}
|
|
10625
|
+
return raw.trim();
|
|
10626
|
+
}
|
|
10627
|
+
function normalizePageCompositionFilterFields(name, value, errors) {
|
|
10628
|
+
if (value === void 0) return void 0;
|
|
10629
|
+
if (!isRecord5(value) || Object.keys(value).length === 0) {
|
|
10630
|
+
errors.push(
|
|
10631
|
+
`[page_template.filter.fields_invalid] query ${name} filter_fields must be a non-empty object.`
|
|
10632
|
+
);
|
|
10633
|
+
return void 0;
|
|
10634
|
+
}
|
|
10635
|
+
const normalized = {};
|
|
10636
|
+
for (const [rawKey, rawField] of Object.entries(value)) {
|
|
10637
|
+
if (!PAGE_COMPOSITION_FILTER_FIELD_KEYS.has(rawKey)) {
|
|
10638
|
+
errors.push(
|
|
10639
|
+
`[page_template.filter.fields_unknown] query ${name} filter_fields.${rawKey} is not a supported control; use status, keyword, owner or created_date.`
|
|
10640
|
+
);
|
|
10641
|
+
continue;
|
|
10642
|
+
}
|
|
10643
|
+
const key = rawKey === "createdDate" ? "created_date" : rawKey;
|
|
10644
|
+
if (Object.prototype.hasOwnProperty.call(normalized, key)) {
|
|
10645
|
+
errors.push(
|
|
10646
|
+
`[page_template.filter.fields_duplicate] query ${name} declares both created_date and createdDate; use one canonical key.`
|
|
10647
|
+
);
|
|
10648
|
+
continue;
|
|
10649
|
+
}
|
|
10650
|
+
if (!isSafePageCompositionAggregateField(rawField)) {
|
|
10651
|
+
errors.push(
|
|
10652
|
+
`[page_template.filter.fields_unsafe] query ${name} filter_fields.${rawKey} must be a safe ES field path.`
|
|
10653
|
+
);
|
|
10654
|
+
continue;
|
|
10655
|
+
}
|
|
10656
|
+
const duplicateKey = Object.entries(normalized).find(
|
|
10657
|
+
([, field]) => field === rawField
|
|
10658
|
+
)?.[0];
|
|
10659
|
+
if (duplicateKey) {
|
|
10660
|
+
errors.push(
|
|
10661
|
+
`[page_template.filter.fields_duplicate] query ${name} filter_fields.${rawKey} maps to the same ES field as ${duplicateKey}; each interactive control needs a distinct field.`
|
|
10662
|
+
);
|
|
10663
|
+
continue;
|
|
10664
|
+
}
|
|
10665
|
+
normalized[key] = rawField;
|
|
10666
|
+
}
|
|
10667
|
+
return Object.keys(normalized).length === Object.keys(value).length && !errors.some((error) => error.includes(`query ${name} filter_fields.`)) ? normalized : void 0;
|
|
10668
|
+
}
|
|
10669
|
+
function isSafePageCompositionAggregateField(value) {
|
|
10670
|
+
return typeof value === "string" && value.length <= 256 && PAGE_COMPOSITION_ROW_PATH.test(value) && !value.split(".").some((part) => ["__proto__", "prototype", "constructor"].includes(part));
|
|
10671
|
+
}
|
|
10672
|
+
function isSafePageCompositionAggregateInteger(value) {
|
|
10673
|
+
return typeof value === "number" && Number.isSafeInteger(value);
|
|
10674
|
+
}
|
|
10675
|
+
function isSafePageCompositionAggregateName(value) {
|
|
10676
|
+
return /^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(value) && !["__proto__", "prototype", "constructor"].includes(value);
|
|
10677
|
+
}
|
|
10678
|
+
function validatePageCompositionAggregateQuery(name, value, errors) {
|
|
10679
|
+
if (value === void 0 || value === null) return;
|
|
10680
|
+
if (!isRecord5(value)) {
|
|
10681
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} params.query must be an object.`);
|
|
10682
|
+
return;
|
|
10683
|
+
}
|
|
10684
|
+
const fields = Object.entries(value);
|
|
10685
|
+
if (fields.length > PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_FIELDS) {
|
|
10686
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} params.query must contain at most ${PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_FIELDS} fields.`);
|
|
10687
|
+
return;
|
|
10688
|
+
}
|
|
10689
|
+
const scalar = (input, path29) => {
|
|
10690
|
+
if (![
|
|
10691
|
+
"string",
|
|
10692
|
+
"number",
|
|
10693
|
+
"boolean"
|
|
10694
|
+
].includes(typeof input) || input === "" || typeof input === "number" && !Number.isFinite(input) || typeof input === "string" && input.length > 1024) {
|
|
10695
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} ${path29} must be a finite scalar.`);
|
|
10696
|
+
}
|
|
10697
|
+
};
|
|
10698
|
+
fields.forEach(([field, item]) => {
|
|
10699
|
+
const path29 = `params.query.${field}`;
|
|
10700
|
+
if (!isSafePageCompositionAggregateField(field)) {
|
|
10701
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} ${path29} uses an unsafe field path.`);
|
|
10702
|
+
return;
|
|
10703
|
+
}
|
|
10704
|
+
if (!isRecord5(item) || typeof item.type !== "string" || !PAGE_COMPOSITION_AGGREGATE_QUERY_TYPES.has(item.type) || Object.keys(item).some((key) => !["type", "value"].includes(key))) {
|
|
10705
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} ${path29} must use exactly the typed type/value filter shape.`);
|
|
10706
|
+
return;
|
|
10707
|
+
}
|
|
10708
|
+
if (item.type === "exists") {
|
|
10709
|
+
if (item.value !== void 0) errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value is not allowed for exists.`);
|
|
10710
|
+
return;
|
|
10711
|
+
}
|
|
10712
|
+
if (item.type === "range") {
|
|
10713
|
+
const rangeValue = item.value;
|
|
10714
|
+
if (!isRecord5(rangeValue)) {
|
|
10715
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value must be an object.`);
|
|
10716
|
+
return;
|
|
10717
|
+
}
|
|
10718
|
+
const keys = Object.keys(rangeValue);
|
|
10719
|
+
if (!keys.length || keys.some((key) => !["gt", "gte", "lt", "lte"].includes(key))) {
|
|
10720
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value only supports gt, gte, lt and lte.`);
|
|
10721
|
+
return;
|
|
10722
|
+
}
|
|
10723
|
+
keys.forEach((key) => scalar(rangeValue[key], `${path29}.value.${key}`));
|
|
10724
|
+
return;
|
|
10725
|
+
}
|
|
10726
|
+
if (item.type === "terms") {
|
|
10727
|
+
const termsValue = item.value;
|
|
10728
|
+
if (!Array.isArray(termsValue) || termsValue.length > PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_VALUES) {
|
|
10729
|
+
errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value must contain at most ${PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_VALUES} values.`);
|
|
10730
|
+
return;
|
|
10731
|
+
}
|
|
10732
|
+
termsValue.forEach((entry, index) => scalar(entry, `${path29}.value[${index}]`));
|
|
10733
|
+
return;
|
|
10734
|
+
}
|
|
10735
|
+
scalar(item.value, `${path29}.value`);
|
|
10736
|
+
});
|
|
10737
|
+
}
|
|
10738
|
+
function validatePageCompositionInteractiveQuery(name, value, filterFields, errors) {
|
|
10739
|
+
if (value === void 0) return;
|
|
10740
|
+
const queryErrors = [];
|
|
10741
|
+
validatePageCompositionAggregateQuery(name, value, queryErrors);
|
|
10742
|
+
errors.push(
|
|
10743
|
+
...queryErrors.map(
|
|
10744
|
+
(error) => error.replace(
|
|
10745
|
+
"[page_template.query.aggregate_query]",
|
|
10746
|
+
"[page_template.filter.query_invalid]"
|
|
10747
|
+
)
|
|
10748
|
+
)
|
|
10749
|
+
);
|
|
10750
|
+
if (queryErrors.length || !isRecord5(value)) return;
|
|
10751
|
+
const controlledFields = new Set(Object.values(filterFields));
|
|
10752
|
+
for (const [field, clause] of Object.entries(value)) {
|
|
10753
|
+
if (controlledFields.has(field) && isRecord5(clause) && !["term", "terms"].includes(String(clause.type))) {
|
|
10754
|
+
errors.push(
|
|
10755
|
+
`[page_template.filter.query_conflict] query ${name} fixed query field ${field} must use term or terms when it is controlled by filter_fields; other clauses cannot be safely intersected with an interactive filter.`
|
|
10756
|
+
);
|
|
10757
|
+
}
|
|
10758
|
+
}
|
|
10759
|
+
}
|
|
10760
|
+
function validatePageCompositionAggregateOrder(name, value, errors) {
|
|
10761
|
+
if (value === void 0) return void 0;
|
|
10762
|
+
if (!isRecord5(value) || Object.keys(value).length !== 1) {
|
|
10763
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation order must contain one field mapped to asc or desc.`);
|
|
10764
|
+
return void 0;
|
|
10765
|
+
}
|
|
10766
|
+
const [field, direction] = Object.entries(value)[0];
|
|
10767
|
+
if (!/^(?:_count|_key|[A-Za-z][A-Za-z0-9_-]{0,63})$/.test(field) || !["asc", "desc"].includes(String(direction))) {
|
|
10768
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation order only supports a safe aggregation key with asc or desc.`);
|
|
10769
|
+
return void 0;
|
|
10770
|
+
}
|
|
10771
|
+
return { [field]: String(direction) };
|
|
10772
|
+
}
|
|
10773
|
+
function validatePageCompositionAggregations(name, value, errors) {
|
|
10774
|
+
if (!isRecord5(value) || Object.keys(value).length === 0) {
|
|
10775
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} requires a non-empty aggs object.`);
|
|
10776
|
+
return void 0;
|
|
10777
|
+
}
|
|
10778
|
+
let nodeCount = 0;
|
|
10779
|
+
const visit = (aggregationName, input, depth) => {
|
|
10780
|
+
nodeCount += 1;
|
|
10781
|
+
if (nodeCount > PAGE_COMPOSITION_AGGREGATE_MAX_NODES) {
|
|
10782
|
+
errors.push(`[page_template.query.aggregate_limit] query ${name} exceeds ${PAGE_COMPOSITION_AGGREGATE_MAX_NODES} aggregation nodes.`);
|
|
10783
|
+
return void 0;
|
|
10784
|
+
}
|
|
10785
|
+
if (depth > PAGE_COMPOSITION_AGGREGATE_MAX_DEPTH) {
|
|
10786
|
+
errors.push(`[page_template.query.aggregate_limit] query ${name} exceeds aggregation depth ${PAGE_COMPOSITION_AGGREGATE_MAX_DEPTH}.`);
|
|
10787
|
+
return void 0;
|
|
10788
|
+
}
|
|
10789
|
+
if (!isRecord5(input) || typeof input.type !== "string" || !PAGE_COMPOSITION_AGGREGATE_TYPES.has(input.type)) {
|
|
10790
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} type must be one of ${[...PAGE_COMPOSITION_AGGREGATE_TYPES].join(", ")}.`);
|
|
10791
|
+
return void 0;
|
|
10792
|
+
}
|
|
10793
|
+
const type = input.type;
|
|
10794
|
+
if (Object.prototype.hasOwnProperty.call(input, "aggregations")) {
|
|
10795
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} aggregations is not allowed; use aggs.`);
|
|
10796
|
+
return void 0;
|
|
10797
|
+
}
|
|
10798
|
+
const commonKeys = ["type", "field", "aggs"];
|
|
10799
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
10800
|
+
...commonKeys,
|
|
10801
|
+
...type === "terms" ? ["size", "order", "missing", "min_doc_count"] : [],
|
|
10802
|
+
...type === "date_histogram" ? ["calendar_interval", "fixed_interval", "interval", "min_doc_count", "format", "time_zone", "order", "missing"] : [],
|
|
10803
|
+
...type === "cardinality" ? ["missing", "precision_threshold", "rehash"] : [],
|
|
10804
|
+
...(/* @__PURE__ */ new Set(["sum", "avg", "min", "max", "stats", "value_count"])).has(type) ? ["missing"] : []
|
|
10805
|
+
]);
|
|
10806
|
+
const invalidKey = Object.keys(input).find((key) => !allowed.has(key));
|
|
10807
|
+
if (invalidKey) {
|
|
10808
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} contains unsupported key ${invalidKey}; script, runtime_mappings and arbitrary DSL are forbidden.`);
|
|
10809
|
+
return void 0;
|
|
10810
|
+
}
|
|
10811
|
+
if (!isSafePageCompositionAggregateField(input.field)) {
|
|
10812
|
+
errors.push(`[page_template.query.aggregate_field] query ${name} aggregation ${aggregationName} requires a safe field path.`);
|
|
10813
|
+
return void 0;
|
|
10814
|
+
}
|
|
10815
|
+
const result = { type, field: input.field };
|
|
10816
|
+
if (input.size !== void 0) {
|
|
10817
|
+
const size = input.size;
|
|
10818
|
+
if (!isSafePageCompositionAggregateInteger(size) || size < 1 || size > PAGE_COMPOSITION_AGGREGATE_MAX_TERMS_SIZE || type !== "terms") {
|
|
10819
|
+
errors.push(`[page_template.query.aggregate_limit] query ${name} aggregation ${aggregationName} size must be an integer from 1 to ${PAGE_COMPOSITION_AGGREGATE_MAX_TERMS_SIZE} and is only supported for terms.`);
|
|
10820
|
+
} else result.size = size;
|
|
10821
|
+
}
|
|
10822
|
+
if (type === "terms" && input.min_doc_count !== void 0) {
|
|
10823
|
+
const min = input.min_doc_count;
|
|
10824
|
+
if (!isSafePageCompositionAggregateInteger(min) || min < 0 || min > 1e6) {
|
|
10825
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} terms ${aggregationName} min_doc_count must be an integer from 0 to 1000000.`);
|
|
10826
|
+
} else result.min_doc_count = min;
|
|
10827
|
+
}
|
|
10828
|
+
const order = validatePageCompositionAggregateOrder(name, input.order, errors);
|
|
10829
|
+
if (input.order !== void 0 && !PAGE_COMPOSITION_AGGREGATE_BUCKET_TYPES.has(type)) {
|
|
10830
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} metric aggregation ${aggregationName} cannot contain order.`);
|
|
10831
|
+
}
|
|
10832
|
+
if (order) result.order = order;
|
|
10833
|
+
if (input.missing !== void 0) {
|
|
10834
|
+
const missingType = typeof input.missing;
|
|
10835
|
+
if (!["string", "number", "boolean"].includes(missingType) || missingType === "string" && (!String(input.missing).length || String(input.missing).length > 1024) || missingType === "number" && !Number.isFinite(input.missing)) {
|
|
10836
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} missing must be a scalar.`);
|
|
10837
|
+
} else result.missing = input.missing;
|
|
10838
|
+
}
|
|
10839
|
+
if (type === "date_histogram") {
|
|
10840
|
+
const calendar = input.calendar_interval;
|
|
10841
|
+
const fixed = input.fixed_interval;
|
|
10842
|
+
const interval = input.interval;
|
|
10843
|
+
const intervals = [calendar, fixed, interval].filter((item) => item !== void 0);
|
|
10844
|
+
if (intervals.length !== 1) {
|
|
10845
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} requires exactly one calendar_interval, fixed_interval or interval.`);
|
|
10846
|
+
} else if (calendar !== void 0 && !["minute", "hour", "day", "week", "month", "quarter", "year"].includes(String(calendar))) {
|
|
10847
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} has an unsupported calendar_interval.`);
|
|
10848
|
+
} else if (fixed !== void 0 && (typeof fixed !== "string" || !/^[1-9]\d{0,8}(?:ms|s|m|h|d)$/.test(fixed))) {
|
|
10849
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} has an unsupported fixed_interval.`);
|
|
10850
|
+
} else if (interval !== void 0 && (typeof interval !== "string" || !["minute", "hour", "day", "week", "month", "quarter", "year"].includes(interval) && !/^\d{1,9}(?:ms|s|m|h|d|w|M|q|y)$/.test(interval))) {
|
|
10851
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} has an unsupported interval.`);
|
|
10852
|
+
} else {
|
|
10853
|
+
if (calendar !== void 0) result.calendar_interval = String(calendar);
|
|
10854
|
+
if (fixed !== void 0) result.fixed_interval = String(fixed);
|
|
10855
|
+
if (interval !== void 0) result.interval = String(interval);
|
|
10856
|
+
}
|
|
10857
|
+
if (input.min_doc_count !== void 0) {
|
|
10858
|
+
const min = input.min_doc_count;
|
|
10859
|
+
if (!isSafePageCompositionAggregateInteger(min) || min < 0 || min > 1) errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} min_doc_count must be 0 or 1.`);
|
|
10860
|
+
else result.min_doc_count = min;
|
|
10861
|
+
}
|
|
10862
|
+
if (input.format !== void 0) {
|
|
10863
|
+
if (typeof input.format !== "string" || !input.format.trim() || input.format.length > 64 || input.format.includes("\0")) errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} format is invalid.`);
|
|
10864
|
+
else result.format = input.format;
|
|
10865
|
+
}
|
|
10866
|
+
if (input.time_zone !== void 0) {
|
|
10867
|
+
if (typeof input.time_zone !== "string" || !input.time_zone.trim() || input.time_zone.length > 64 || input.time_zone.includes("\0")) errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} time_zone is invalid.`);
|
|
10868
|
+
else result.time_zone = input.time_zone;
|
|
10869
|
+
}
|
|
10870
|
+
const dateOrder = validatePageCompositionAggregateOrder(name, input.order, errors);
|
|
10871
|
+
if (dateOrder) result.order = dateOrder;
|
|
10872
|
+
}
|
|
10873
|
+
if (type === "cardinality" && input.precision_threshold !== void 0) {
|
|
10874
|
+
const precision = input.precision_threshold;
|
|
10875
|
+
if (!isSafePageCompositionAggregateInteger(precision) || precision < 0 || precision > 4e4) errors.push(`[page_template.query.aggregate_limit] query ${name} cardinality ${aggregationName} precision_threshold must be between 0 and 40000.`);
|
|
10876
|
+
else result.precision_threshold = precision;
|
|
10877
|
+
}
|
|
10878
|
+
if (type === "cardinality" && input.rehash !== void 0) {
|
|
10879
|
+
if (typeof input.rehash !== "boolean") errors.push(`[page_template.query.aggregate_invalid] query ${name} cardinality ${aggregationName} rehash must be a boolean.`);
|
|
10880
|
+
else result.rehash = input.rehash;
|
|
10881
|
+
}
|
|
10882
|
+
if (input.aggs !== void 0) {
|
|
10883
|
+
if (!PAGE_COMPOSITION_AGGREGATE_BUCKET_TYPES.has(type)) {
|
|
10884
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} metric aggregation ${aggregationName} cannot contain nested aggs.`);
|
|
10885
|
+
} else {
|
|
10886
|
+
const children = input.aggs;
|
|
10887
|
+
if (!isRecord5(children) || Object.keys(children).length === 0) {
|
|
10888
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} nested aggs for ${aggregationName} must be a non-empty object.`);
|
|
10889
|
+
} else {
|
|
10890
|
+
const normalizedChildren = {};
|
|
10891
|
+
for (const [childName, child] of Object.entries(children)) {
|
|
10892
|
+
if (!isSafePageCompositionAggregateName(childName)) {
|
|
10893
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation name ${childName} is invalid.`);
|
|
10894
|
+
continue;
|
|
10895
|
+
}
|
|
10896
|
+
const normalizedChild = visit(childName, child, depth + 1);
|
|
10897
|
+
if (normalizedChild) normalizedChildren[childName] = normalizedChild;
|
|
10898
|
+
}
|
|
10899
|
+
result.aggs = normalizedChildren;
|
|
10900
|
+
}
|
|
10901
|
+
}
|
|
10902
|
+
}
|
|
10903
|
+
return result;
|
|
10904
|
+
};
|
|
10905
|
+
const normalized = {};
|
|
10906
|
+
for (const [aggregationName, aggregation] of Object.entries(value)) {
|
|
10907
|
+
if (!isSafePageCompositionAggregateName(aggregationName)) {
|
|
10908
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation name ${aggregationName} is invalid.`);
|
|
10909
|
+
continue;
|
|
10910
|
+
}
|
|
10911
|
+
const normalizedAggregation = visit(aggregationName, aggregation, 1);
|
|
10912
|
+
if (normalizedAggregation) normalized[aggregationName] = normalizedAggregation;
|
|
10913
|
+
}
|
|
10914
|
+
return normalized;
|
|
10915
|
+
}
|
|
10916
|
+
function pageCompositionAggregationTrace(value) {
|
|
10917
|
+
if (!isRecord5(value)) return [];
|
|
10918
|
+
const trace = [];
|
|
10919
|
+
const visit = (name, aggregation, depth) => {
|
|
10920
|
+
if (!isRecord5(aggregation)) return;
|
|
10921
|
+
trace.push({
|
|
10922
|
+
name,
|
|
10923
|
+
type: aggregation.type ?? null,
|
|
10924
|
+
field: aggregation.field ?? null,
|
|
10925
|
+
depth,
|
|
10926
|
+
...aggregation.size !== void 0 ? { size: aggregation.size } : {}
|
|
10927
|
+
});
|
|
10928
|
+
const children = isRecord5(aggregation.aggs) ? aggregation.aggs : {};
|
|
10929
|
+
Object.entries(children).forEach(([childName, child]) => visit(childName, child, depth + 1));
|
|
10930
|
+
};
|
|
10931
|
+
Object.entries(value).forEach(([name, aggregation]) => visit(name, aggregation, 1));
|
|
10932
|
+
return trace;
|
|
10933
|
+
}
|
|
10445
10934
|
function hasNonEmptyParam(params, key) {
|
|
10446
10935
|
const value = params[key];
|
|
10447
10936
|
return value !== void 0 && value !== null && String(value).trim() !== "";
|
|
@@ -10539,6 +11028,26 @@ function analyzePageCompositionQueries(queries) {
|
|
|
10539
11028
|
errors.push(`page-template query ${name} must be an object.`);
|
|
10540
11029
|
continue;
|
|
10541
11030
|
}
|
|
11031
|
+
const filterGroup = normalizePageCompositionFilterGroup(
|
|
11032
|
+
name,
|
|
11033
|
+
definition,
|
|
11034
|
+
errors
|
|
11035
|
+
);
|
|
11036
|
+
if ((Object.prototype.hasOwnProperty.call(definition, "filterGroup") || Object.prototype.hasOwnProperty.call(definition, "filter_group")) && !filterGroup) {
|
|
11037
|
+
continue;
|
|
11038
|
+
}
|
|
11039
|
+
const hasFilterFields = Object.prototype.hasOwnProperty.call(definition, "filter_fields") || Object.prototype.hasOwnProperty.call(definition, "filterFields");
|
|
11040
|
+
if (Object.prototype.hasOwnProperty.call(definition, "filter_fields") && Object.prototype.hasOwnProperty.call(definition, "filterFields")) {
|
|
11041
|
+
errors.push(
|
|
11042
|
+
`[page_template.filter.fields_duplicate] query ${name} must use only filter_fields; filterFields is an input alias, not a second declaration.`
|
|
11043
|
+
);
|
|
11044
|
+
}
|
|
11045
|
+
const filterFields = normalizePageCompositionFilterFields(
|
|
11046
|
+
name,
|
|
11047
|
+
definition.filter_fields ?? definition.filterFields,
|
|
11048
|
+
errors
|
|
11049
|
+
);
|
|
11050
|
+
if (hasFilterFields && !filterFields) continue;
|
|
10542
11051
|
const params = isRecord5(definition.params) ? definition.params : {};
|
|
10543
11052
|
validatePageCompositionRowMapping(
|
|
10544
11053
|
name,
|
|
@@ -10552,6 +11061,175 @@ function analyzePageCompositionQueries(queries) {
|
|
|
10552
11061
|
}
|
|
10553
11062
|
const resource = definition.resource ?? definition.endpoint ?? (declared === "es" ? "/project/list" : void 0);
|
|
10554
11063
|
const projectList = isProjectListResource(resource);
|
|
11064
|
+
const projectAggregate = isProjectAggregateResource(resource);
|
|
11065
|
+
const mode = definition.mode === void 0 ? void 0 : String(definition.mode).trim().toLowerCase();
|
|
11066
|
+
if (mode !== void 0 && !PAGE_COMPOSITION_QUERY_MODES.has(mode)) {
|
|
11067
|
+
errors.push(`[page_template.query.aggregate_mode] query ${name} mode must be list or aggregate.`);
|
|
11068
|
+
continue;
|
|
11069
|
+
}
|
|
11070
|
+
if (Object.prototype.hasOwnProperty.call(definition, "aggregations") && mode !== "aggregate" && !projectAggregate) {
|
|
11071
|
+
errors.push(
|
|
11072
|
+
`[page_template.query.aggregate_mode] query ${name} top-level aggregations is not supported; move it to top-level aggs on a mode: "aggregate" query using /project/aggregate.`
|
|
11073
|
+
);
|
|
11074
|
+
continue;
|
|
11075
|
+
}
|
|
11076
|
+
if (mode === "aggregate" || projectAggregate || Object.prototype.hasOwnProperty.call(definition, "aggs")) {
|
|
11077
|
+
if (filterFields) {
|
|
11078
|
+
errors.push(
|
|
11079
|
+
`[page_template.filter.fields_resource] query ${name} filter_fields is only supported on the paginated /project/list query; declare it on the list query in the filterGroup.`
|
|
11080
|
+
);
|
|
11081
|
+
continue;
|
|
11082
|
+
}
|
|
11083
|
+
if (mode !== "aggregate") {
|
|
11084
|
+
errors.push(`[page_template.query.aggregate_mode] query ${name} aggregate queries must declare mode: "aggregate".`);
|
|
11085
|
+
continue;
|
|
11086
|
+
}
|
|
11087
|
+
if (declared !== "es") {
|
|
11088
|
+
errors.push(`[page_template.query.aggregate_mode] query ${name} aggregate queries must declare engine: "es".`);
|
|
11089
|
+
continue;
|
|
11090
|
+
}
|
|
11091
|
+
if (!projectAggregate) {
|
|
11092
|
+
errors.push(`[page_template.query.aggregate_resource] query ${name} aggregate queries must use resource /project/aggregate.`);
|
|
11093
|
+
continue;
|
|
11094
|
+
}
|
|
11095
|
+
if (definition.method !== void 0 && String(definition.method).trim().toUpperCase() !== "POST") {
|
|
11096
|
+
errors.push(`[page_template.query.aggregate_resource] query ${name} /project/aggregate must use POST.`);
|
|
11097
|
+
continue;
|
|
11098
|
+
}
|
|
11099
|
+
if (!hasNonEmptyParam(params, "data_set_key") && !hasNonEmptyParam(params, "data_set_id")) {
|
|
11100
|
+
errors.push(`[page_template.query.es_dataset_required] query ${name} engine "es" requires params.data_set_key or params.data_set_id.`);
|
|
11101
|
+
continue;
|
|
11102
|
+
}
|
|
11103
|
+
if (hasNonEmptyParam(params, "data_set_key") && hasNonEmptyParam(params, "data_set_id")) {
|
|
11104
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} must use exactly one of params.data_set_key or params.data_set_id.`);
|
|
11105
|
+
continue;
|
|
11106
|
+
}
|
|
11107
|
+
if (hasNonEmptyParam(params, "data_set_key")) {
|
|
11108
|
+
if (typeof params.data_set_key !== "string" || !params.data_set_key.trim()) {
|
|
11109
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} params.data_set_key must be a non-empty string.`);
|
|
11110
|
+
continue;
|
|
11111
|
+
}
|
|
11112
|
+
if (typeof params.flow_type !== "string" || !params.flow_type.trim() || typeof params.flow_key !== "string") {
|
|
11113
|
+
warnings.push(
|
|
11114
|
+
`[page_template.query.dataset_scope] query ${name}: aggregate data_set_key requires string params.flow_type and params.flow_key (flow_key may be empty); the runtime may inherit them from the current route.`
|
|
11115
|
+
);
|
|
11116
|
+
}
|
|
11117
|
+
}
|
|
11118
|
+
if (hasNonEmptyParam(params, "data_set_id") && (!Number.isSafeInteger(params.data_set_id) || Number(params.data_set_id) <= 0)) {
|
|
11119
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} params.data_set_id must be a positive safe integer.`);
|
|
11120
|
+
continue;
|
|
11121
|
+
}
|
|
11122
|
+
if (params.flow_type !== void 0 && (typeof params.flow_type !== "string" || !params.flow_type.trim())) {
|
|
11123
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} params.flow_type must be a non-empty string when provided.`);
|
|
11124
|
+
continue;
|
|
11125
|
+
}
|
|
11126
|
+
if (params.flow_key !== void 0 && typeof params.flow_key !== "string") {
|
|
11127
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} params.flow_key must be a string when provided.`);
|
|
11128
|
+
continue;
|
|
11129
|
+
}
|
|
11130
|
+
const aggregateDefinitionKeys = /* @__PURE__ */ new Set([
|
|
11131
|
+
"engine",
|
|
11132
|
+
"mode",
|
|
11133
|
+
"resource",
|
|
11134
|
+
"endpoint",
|
|
11135
|
+
"method",
|
|
11136
|
+
"params",
|
|
11137
|
+
"aggs",
|
|
11138
|
+
"filterGroup",
|
|
11139
|
+
"filter_group"
|
|
11140
|
+
]);
|
|
11141
|
+
const unsupportedDefinitionKey = Object.keys(definition).find((key) => !aggregateDefinitionKeys.has(key));
|
|
11142
|
+
if (unsupportedDefinitionKey) {
|
|
11143
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} cannot contain ${unsupportedDefinitionKey}; arbitrary ES DSL and unsupported aggregate fields are forbidden. Aggregate queries only accept engine, mode, resource, method, params, aggs and filterGroup.`);
|
|
11144
|
+
continue;
|
|
11145
|
+
}
|
|
11146
|
+
const forbiddenAggregateDefinitionKeys = ["query", "body", "dsl", "script", "runtime_mappings", "aggregations", "index", "shard_size", "page", "page_size", "sort", "sorts", "preProcessHook", "postProcessHook", "hooks", "is_select_all"];
|
|
11147
|
+
const forbiddenAggregateParamKeys = ["body", "dsl", "script", "runtime_mappings", "aggregations", "index", "aggs"];
|
|
11148
|
+
const forbiddenDefinitionKey = forbiddenAggregateDefinitionKeys.find((key) => Object.prototype.hasOwnProperty.call(definition, key));
|
|
11149
|
+
if (forbiddenDefinitionKey) {
|
|
11150
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} cannot contain ${forbiddenDefinitionKey}; arbitrary ES DSL is forbidden.`);
|
|
11151
|
+
continue;
|
|
11152
|
+
}
|
|
11153
|
+
const forbiddenParamKey = forbiddenAggregateParamKeys.find((key) => Object.prototype.hasOwnProperty.call(params, key));
|
|
11154
|
+
if (forbiddenParamKey) {
|
|
11155
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} params cannot contain ${forbiddenParamKey}; arbitrary ES DSL is forbidden.`);
|
|
11156
|
+
continue;
|
|
11157
|
+
}
|
|
11158
|
+
const unsupportedParamKey = Object.keys(params).find((key) => !PAGE_COMPOSITION_AGGREGATE_PARAM_KEYS.has(key));
|
|
11159
|
+
if (unsupportedParamKey) {
|
|
11160
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} params cannot contain ${unsupportedParamKey}; aggregate queries only accept dataset, flow and typed query parameters.`);
|
|
11161
|
+
continue;
|
|
11162
|
+
}
|
|
11163
|
+
validatePageCompositionAggregateQuery(name, params.query, errors);
|
|
11164
|
+
if (errors.some((error) => error.includes(`[page_template.query.aggregate_query] query ${name} `))) continue;
|
|
11165
|
+
const normalizedAggs = validatePageCompositionAggregations(name, definition.aggs, errors);
|
|
11166
|
+
if (!normalizedAggs || errors.some((error) => error.includes(`query ${name} `) && error.includes("aggregate"))) continue;
|
|
11167
|
+
if (Object.prototype.hasOwnProperty.call(params, "page") || Object.prototype.hasOwnProperty.call(params, "page_size")) {
|
|
11168
|
+
errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregate queries must not carry pagination parameters.`);
|
|
11169
|
+
continue;
|
|
11170
|
+
}
|
|
11171
|
+
const normalizedDefinition2 = {
|
|
11172
|
+
...definition,
|
|
11173
|
+
engine: "es",
|
|
11174
|
+
mode: "aggregate",
|
|
11175
|
+
resource: "/project/aggregate",
|
|
11176
|
+
method: "POST",
|
|
11177
|
+
params: { ...params },
|
|
11178
|
+
aggs: normalizedAggs,
|
|
11179
|
+
...filterGroup ? { filterGroup } : {}
|
|
11180
|
+
};
|
|
11181
|
+
delete normalizedDefinition2.endpoint;
|
|
11182
|
+
delete normalizedDefinition2.aggregations;
|
|
11183
|
+
delete normalizedDefinition2.filter_group;
|
|
11184
|
+
normalized[name] = normalizedDefinition2;
|
|
11185
|
+
continue;
|
|
11186
|
+
}
|
|
11187
|
+
if (filterFields && !projectList) {
|
|
11188
|
+
errors.push(
|
|
11189
|
+
`[page_template.filter.fields_resource] query ${name} filter_fields requires resource /project/list.`
|
|
11190
|
+
);
|
|
11191
|
+
continue;
|
|
11192
|
+
}
|
|
11193
|
+
if (filterFields && declared !== void 0 && declared !== "es") {
|
|
11194
|
+
errors.push(
|
|
11195
|
+
`[page_template.filter.fields_engine] query ${name} filter_fields requires engine: "es".`
|
|
11196
|
+
);
|
|
11197
|
+
continue;
|
|
11198
|
+
}
|
|
11199
|
+
if ((filterFields || filterGroup) && definition.filterMode !== "server") {
|
|
11200
|
+
errors.push(
|
|
11201
|
+
`[page_template.filter.fields_mode] query ${name} filter_fields requires filterMode: "server" so controls are sent to the server.`
|
|
11202
|
+
);
|
|
11203
|
+
continue;
|
|
11204
|
+
}
|
|
11205
|
+
if (filterGroup && !filterFields) {
|
|
11206
|
+
errors.push(
|
|
11207
|
+
`[page_template.filter.fields_required] query ${name} filterGroup requires an explicit filter_fields mapping on the paginated /project/list query; runtime defaults are not allowed.`
|
|
11208
|
+
);
|
|
11209
|
+
continue;
|
|
11210
|
+
}
|
|
11211
|
+
if (filterGroup && filterFields) {
|
|
11212
|
+
validatePageCompositionInteractiveQuery(
|
|
11213
|
+
name,
|
|
11214
|
+
params.query,
|
|
11215
|
+
filterFields,
|
|
11216
|
+
errors
|
|
11217
|
+
);
|
|
11218
|
+
if (errors.some(
|
|
11219
|
+
(error) => error.includes(`[page_template.filter.query_`) && error.includes(`query ${name} `)
|
|
11220
|
+
)) {
|
|
11221
|
+
continue;
|
|
11222
|
+
}
|
|
11223
|
+
}
|
|
11224
|
+
const misplacedAggregateParam = ["aggs", "aggregations"].find(
|
|
11225
|
+
(key) => Object.prototype.hasOwnProperty.call(params, key)
|
|
11226
|
+
);
|
|
11227
|
+
if (misplacedAggregateParam) {
|
|
11228
|
+
errors.push(
|
|
11229
|
+
`[page_template.query.aggregate_mode] query ${name} params.${misplacedAggregateParam} is ignored by /project/list; move it to top-level aggs on a mode: "aggregate" query using /project/aggregate.`
|
|
11230
|
+
);
|
|
11231
|
+
continue;
|
|
11232
|
+
}
|
|
10555
11233
|
const esShaped = PAGE_COMPOSITION_ES_BODY_KEYS.some(
|
|
10556
11234
|
(key) => Object.prototype.hasOwnProperty.call(params, key)
|
|
10557
11235
|
);
|
|
@@ -10623,8 +11301,12 @@ function analyzePageCompositionQueries(queries) {
|
|
|
10623
11301
|
...definition,
|
|
10624
11302
|
engine,
|
|
10625
11303
|
...resolvedResource,
|
|
10626
|
-
...engine === "es" && projectList ? { method: "POST" } : {}
|
|
11304
|
+
...engine === "es" && projectList ? { method: "POST" } : {},
|
|
11305
|
+
...filterFields ? { filter_fields: filterFields } : {},
|
|
11306
|
+
...filterGroup ? { filterGroup } : {}
|
|
10627
11307
|
};
|
|
11308
|
+
delete normalizedDefinition.filterFields;
|
|
11309
|
+
delete normalizedDefinition.filter_group;
|
|
10628
11310
|
if (definition.row_mapping !== void 0 || definition.rowMapping !== void 0) {
|
|
10629
11311
|
normalizedDefinition.row_mapping = definition.row_mapping ?? definition.rowMapping;
|
|
10630
11312
|
delete normalizedDefinition.rowMapping;
|
|
@@ -10638,6 +11320,25 @@ function analyzePageCompositionQueries(queries) {
|
|
|
10638
11320
|
}
|
|
10639
11321
|
normalized[name] = normalizedDefinition;
|
|
10640
11322
|
}
|
|
11323
|
+
const groups = /* @__PURE__ */ new Map();
|
|
11324
|
+
for (const [name, definition] of Object.entries(normalized)) {
|
|
11325
|
+
const group = isRecord5(definition) ? definition.filterGroup : void 0;
|
|
11326
|
+
if (typeof group !== "string") continue;
|
|
11327
|
+
const entry = groups.get(group) || { lists: [], aggregates: [] };
|
|
11328
|
+
if (isRecord5(definition) && definition.mode === "aggregate") {
|
|
11329
|
+
entry.aggregates.push(name);
|
|
11330
|
+
} else {
|
|
11331
|
+
entry.lists.push(name);
|
|
11332
|
+
}
|
|
11333
|
+
groups.set(group, entry);
|
|
11334
|
+
}
|
|
11335
|
+
for (const [group, members] of groups) {
|
|
11336
|
+
if (members.aggregates.length && !members.lists.length) {
|
|
11337
|
+
warnings.push(
|
|
11338
|
+
`[page_template.filter.group_list_missing] filterGroup ${group} has aggregate queries (${members.aggregates.join(", ")}) but no grouped /project/list query; interactive filters cannot refresh this group.`
|
|
11339
|
+
);
|
|
11340
|
+
}
|
|
11341
|
+
}
|
|
10641
11342
|
return { queries: normalized, errors, warnings };
|
|
10642
11343
|
}
|
|
10643
11344
|
function pageCompositionQueryEngineTrace(queries) {
|
|
@@ -10645,13 +11346,18 @@ function pageCompositionQueryEngineTrace(queries) {
|
|
|
10645
11346
|
Object.entries(queries).map(([name, definition]) => {
|
|
10646
11347
|
const item = isRecord5(definition) ? definition : {};
|
|
10647
11348
|
const params = isRecord5(item.params) ? item.params : {};
|
|
11349
|
+
const filterFields = isRecord5(item.filter_fields) ? item.filter_fields : void 0;
|
|
10648
11350
|
return [
|
|
10649
11351
|
name,
|
|
10650
11352
|
{
|
|
10651
11353
|
engine: item.engine ?? null,
|
|
11354
|
+
mode: item.mode ?? (item.engine === "es" ? "list" : null),
|
|
10652
11355
|
resource: item.resource ?? item.endpoint ?? null,
|
|
11356
|
+
...item.filterGroup || item.filter_group ? { filterGroup: item.filterGroup ?? item.filter_group } : {},
|
|
10653
11357
|
data_set_key: params.data_set_key ?? null,
|
|
10654
11358
|
data_set_id: params.data_set_id ?? null,
|
|
11359
|
+
...filterFields ? { filter_fields: filterFields } : {},
|
|
11360
|
+
...item.mode === "aggregate" ? { aggregations: pageCompositionAggregationTrace(item.aggs) } : {},
|
|
10655
11361
|
...item.engine === "sql" ? { reason: item.reason ?? null } : {}
|
|
10656
11362
|
}
|
|
10657
11363
|
];
|
|
@@ -14158,6 +14864,9 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
|
|
|
14158
14864
|
if (domain === "page-template") {
|
|
14159
14865
|
return normalizePageCompositionTemplatePayload(work);
|
|
14160
14866
|
}
|
|
14867
|
+
if (domain === "home-portal") {
|
|
14868
|
+
return normalizeHomePortalPayload(work);
|
|
14869
|
+
}
|
|
14161
14870
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
14162
14871
|
}
|
|
14163
14872
|
function responseDataId(response) {
|
|
@@ -16255,6 +16964,8 @@ async function previewPageTemplateWork(workFile, outDir, mode = "mock") {
|
|
|
16255
16964
|
]
|
|
16256
16965
|
)
|
|
16257
16966
|
),
|
|
16967
|
+
methods_registry_version: 1,
|
|
16968
|
+
methods_registry_hash: hashJson(isRecord5(data.methods) ? data.methods : {}),
|
|
16258
16969
|
compiled_template_hash: hashJson(render),
|
|
16259
16970
|
submit_payload_hash: hashJson(payload),
|
|
16260
16971
|
data_trace_hash: hashJson(dataTrace),
|
|
@@ -16333,6 +17044,7 @@ function validatePageTemplatePreviewManifest(manifest, payload) {
|
|
|
16333
17044
|
}
|
|
16334
17045
|
async function exportConfigDomain(config, profile, domain, id, outDir, options = {}) {
|
|
16335
17046
|
void config;
|
|
17047
|
+
const definition = CONFIG_DOMAINS[domain];
|
|
16336
17048
|
assertNotLocalUuidConfigId(domain, id, "export");
|
|
16337
17049
|
if (domain === "api-platform") {
|
|
16338
17050
|
const { raw, work: work2 } = await collectApiPlatformAggregate(profile, id);
|
|
@@ -16379,7 +17091,21 @@ async function exportConfigDomain(config, profile, domain, id, outDir, options =
|
|
|
16379
17091
|
});
|
|
16380
17092
|
return { domain, id, raw_file: rawFile2, work_file: workFile2, meta_file: metaFile2, base_hash: baseHash2 };
|
|
16381
17093
|
}
|
|
16382
|
-
|
|
17094
|
+
if (domain === "home-portal") {
|
|
17095
|
+
const workspace = normalizeWorkspaceKey(id || profile.config.workspace);
|
|
17096
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
17097
|
+
const data2 = await apiRequest(createApiClient(profile), "GET", "/home_portal", { params: { workspace }, capability: `${definition.capability}.export` });
|
|
17098
|
+
const payload = isRecord5(data2) ? { workspace, ...data2 } : { workspace, version: 0, categories: [], entries: [] };
|
|
17099
|
+
const baseHash2 = hashJson(payload);
|
|
17100
|
+
const stem2 = `${domain}-${workspace.replace(/[^a-zA-Z0-9._-]+/g, "-")}`;
|
|
17101
|
+
const rawFile2 = path6.join(outDir, "raw", `${stem2}.json`);
|
|
17102
|
+
const workFile2 = path6.join(outDir, "work", `${stem2}.json`);
|
|
17103
|
+
const metaFile2 = path6.join(outDir, "meta", `${stem2}.meta.json`);
|
|
17104
|
+
await writeJsonFile(rawFile2, payload);
|
|
17105
|
+
await writeJsonFile(workFile2, payload);
|
|
17106
|
+
await writeJsonFile(metaFile2, { domain, id: workspace, profile: profile.name, workspace: profile.config.workspace, exported_at: (/* @__PURE__ */ new Date()).toISOString(), base_hash: baseHash2, raw_file: rawFile2, work_file: workFile2 });
|
|
17107
|
+
return { domain, id: workspace, raw_file: rawFile2, work_file: workFile2, meta_file: metaFile2, base_hash: baseHash2 };
|
|
17108
|
+
}
|
|
16383
17109
|
if (!definition.exportPath) {
|
|
16384
17110
|
throw new Error(definition.unsupportedExportReason || `Config export is not implemented for ${domain}.`);
|
|
16385
17111
|
}
|
|
@@ -17229,6 +17955,24 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17229
17955
|
readback_hash: hashJson(readback2)
|
|
17230
17956
|
};
|
|
17231
17957
|
}
|
|
17958
|
+
if (domain === "home-portal") {
|
|
17959
|
+
const submit2 = await readJsonFile(submitFile);
|
|
17960
|
+
if (!isRecord5(submit2) || submit2.domain !== domain || !isRecord5(submit2.payload) || !isRecord5(submit2.meta)) throw new Error("Config submit requires a payload produced by `config home-portal build`.");
|
|
17961
|
+
const workspace = normalizeWorkspaceKey(String(submit2.payload.workspace || id || profile.config.workspace));
|
|
17962
|
+
if (String(submit2.meta.id || workspace) !== workspace) throw new Error(`Config submit metadata id mismatch. Expected ${workspace}.`);
|
|
17963
|
+
if (typeof submit2.base_hash !== "string") throw new Error("home-portal submit requires base_hash from export/build.");
|
|
17964
|
+
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
17965
|
+
await ensureConfigCapability(profile, `${definition.capability}.submit`);
|
|
17966
|
+
const currentRaw = await apiRequest(createApiClient(profile), "GET", "/home_portal", { params: { workspace }, capability: `${definition.capability}.export` });
|
|
17967
|
+
const current2 = isRecord5(currentRaw) ? { workspace, ...currentRaw } : { workspace, version: 0, categories: [], entries: [] };
|
|
17968
|
+
if (hashJson(current2) !== submit2.base_hash) throw new Error("Remote config changed after export. Re-export before submitting.");
|
|
17969
|
+
const expectedConfirm2 = `submit ${domain} ${workspace}`;
|
|
17970
|
+
if (confirm3 !== expectedConfirm2) return { ...dryRunFields(expectedConfirm2), domain, id: workspace, endpoint: "/home_portal", method: "PUT", payload: submit2.payload, current_hash: hashJson(current2), next: `Run again with --confirm "${expectedConfirm2}" to submit.` };
|
|
17971
|
+
const response2 = await apiRequest(createApiClient(profile), "PUT", "/home_portal", { data: { version: submit2.payload.version, categories: submit2.payload.categories, entries: submit2.payload.entries }, params: { workspace }, capability: `${definition.capability}.submit` });
|
|
17972
|
+
const readbackRaw = await apiRequest(createApiClient(profile), "GET", "/home_portal", { params: { workspace }, capability: `${definition.capability}.export` });
|
|
17973
|
+
const readback2 = isRecord5(readbackRaw) ? { workspace, ...readbackRaw } : readbackRaw;
|
|
17974
|
+
return { ...executedFields(), domain, id: workspace, endpoint: "/home_portal", method: "PUT", response: response2, readback_hash: hashJson(readback2) };
|
|
17975
|
+
}
|
|
17232
17976
|
if (domain === "role" || domain === "api-platform" || domain === "nav-config") {
|
|
17233
17977
|
if (definition.submitStatus !== "supported") {
|
|
17234
17978
|
throw new Error(`${CONFIG_SUBMIT_UNSUPPORTED_MESSAGE} Domain: ${domain}.`);
|
|
@@ -17314,6 +18058,13 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17314
18058
|
if (domain === "page-template" && submit.preview_manifest !== void 0) {
|
|
17315
18059
|
validatePageTemplatePreviewManifest(submit.preview_manifest, submit.payload);
|
|
17316
18060
|
}
|
|
18061
|
+
const pageTemplatePreviewConfirmation = domain === "page-template" && isRecord5(submit.preview_manifest) && options.dryRun !== true;
|
|
18062
|
+
const pageTemplateExpectedConfirm = `submit ${domain} ${id}`;
|
|
18063
|
+
if (pageTemplatePreviewConfirmation && confirm3 !== void 0 && confirm3 !== pageTemplateExpectedConfirm) {
|
|
18064
|
+
throw new Error(
|
|
18065
|
+
`[page_template_confirmation_mismatch] Expected "${pageTemplateExpectedConfirm}" when --confirm is provided; omit --confirm to use the verified preview manifest.`
|
|
18066
|
+
);
|
|
18067
|
+
}
|
|
17317
18068
|
let listTemplateValidation;
|
|
17318
18069
|
let listTemplateOverride;
|
|
17319
18070
|
if (domain === "list-template") {
|
|
@@ -17415,7 +18166,12 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17415
18166
|
}
|
|
17416
18167
|
await ensureConfigCapability(profile, `${definition.capability}.create`);
|
|
17417
18168
|
const expectedConfirm2 = `submit ${domain} ${id}`;
|
|
17418
|
-
if (confirm3
|
|
18169
|
+
if (domain === "page-template" && submit.preview_manifest === void 0 && confirm3 === expectedConfirm2) {
|
|
18170
|
+
throw new Error(
|
|
18171
|
+
"[page_template_preview_manifest_required] Confirmed page-template writes require the preview manifest produced by preview/build. Re-run preview, then rebuild with --preview-manifest before submitting."
|
|
18172
|
+
);
|
|
18173
|
+
}
|
|
18174
|
+
if (confirm3 !== expectedConfirm2 && !pageTemplatePreviewConfirmation) {
|
|
17419
18175
|
return {
|
|
17420
18176
|
...dryRunFields(expectedConfirm2),
|
|
17421
18177
|
domain,
|
|
@@ -17532,6 +18288,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17532
18288
|
domain,
|
|
17533
18289
|
...standardConfigWriteResponse({ domain, id, executedId: createdId ?? null, payload: submit.payload, response: response2 }),
|
|
17534
18290
|
created_id: createdId ?? null,
|
|
18291
|
+
...pageTemplatePreviewConfirmation ? {
|
|
18292
|
+
confirmation_mode: "verified_preview_manifest",
|
|
18293
|
+
confirmation_reused: true
|
|
18294
|
+
} : {},
|
|
17535
18295
|
endpoint: definition.createPath,
|
|
17536
18296
|
method: definition.createMethod,
|
|
17537
18297
|
response: response2,
|
|
@@ -17713,6 +18473,11 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17713
18473
|
};
|
|
17714
18474
|
}
|
|
17715
18475
|
const expectedConfirm = `submit ${domain} ${id}`;
|
|
18476
|
+
if (domain === "page-template" && submit.preview_manifest === void 0 && confirm3 === expectedConfirm) {
|
|
18477
|
+
throw new Error(
|
|
18478
|
+
"[page_template_preview_manifest_required] Confirmed page-template writes require the preview manifest produced by preview/build. Re-run preview, then rebuild with --preview-manifest before submitting."
|
|
18479
|
+
);
|
|
18480
|
+
}
|
|
17716
18481
|
if (submitMode !== "create" && typeof submit.base_hash !== "string") {
|
|
17717
18482
|
throw new Error(`${domain} submit requires a current base_hash from export/build. Re-export the remote config, rebuild, then submit.`);
|
|
17718
18483
|
}
|
|
@@ -17790,7 +18555,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17790
18555
|
const mutationDiff = diffJsonNormalized(domain, current, submitPayload);
|
|
17791
18556
|
const datasetCustomKeyInitialization = domain === "dataset" && isRecord5(current) && !normalizeText(current.custom_key).trim() && Boolean(normalizeText(submit.payload.custom_key).trim()) && options.initializeDatasetCustomKey;
|
|
17792
18557
|
const requiredConfirm = datasetCustomKeyInitialization ? `initialize dataset custom_key ${id} ${normalizeText(submit.payload.custom_key).trim()}` : expectedConfirm;
|
|
17793
|
-
if (confirm3 !== requiredConfirm) {
|
|
18558
|
+
if (confirm3 !== requiredConfirm && !pageTemplatePreviewConfirmation) {
|
|
17794
18559
|
return {
|
|
17795
18560
|
...dryRunFields(requiredConfirm),
|
|
17796
18561
|
domain,
|
|
@@ -17928,6 +18693,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
|
|
|
17928
18693
|
...standardConfigWriteResponse({ domain, id, payload: submitPayload, response }),
|
|
17929
18694
|
endpoint,
|
|
17930
18695
|
method: definition.submitMethod,
|
|
18696
|
+
...pageTemplatePreviewConfirmation ? {
|
|
18697
|
+
confirmation_mode: "verified_preview_manifest",
|
|
18698
|
+
confirmation_reused: true
|
|
18699
|
+
} : {},
|
|
17931
18700
|
...publishMode ? { publish_mode: publishMode } : {},
|
|
17932
18701
|
...consoleTemplateWarnings.length ? {
|
|
17933
18702
|
warnings: consoleTemplateWarnings,
|
|
@@ -21359,7 +22128,17 @@ function registerConfigCommands(program2) {
|
|
|
21359
22128
|
printResult(options.format, result);
|
|
21360
22129
|
});
|
|
21361
22130
|
}
|
|
21362
|
-
|
|
22131
|
+
if (domain === "home-portal") {
|
|
22132
|
+
domainCommand.command("flows").description("List flow options available to portal entries").option("--profile <profile>").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
22133
|
+
const profile2 = resolveProfile(await loadConfig(), options.profile);
|
|
22134
|
+
printResult(options.format, await apiRequest(createApiClient(profile2), "GET", "/home_portal/flows", { capability: "config.home_portal.flows" }));
|
|
22135
|
+
});
|
|
22136
|
+
domainCommand.command("nav-preview").description("Preview importing PC navigation into the portal").option("--profile <profile>").option("--format <format>", "Output format", "json").action(async (options) => {
|
|
22137
|
+
const profile2 = resolveProfile(await loadConfig(), options.profile);
|
|
22138
|
+
printResult(options.format, await apiRequest(createApiClient(profile2), "GET", "/home_portal/nav_preview", { capability: "config.home_portal.preview" }));
|
|
22139
|
+
});
|
|
22140
|
+
}
|
|
22141
|
+
const createCommand = domainCommand.command("create").description(domain === "flow-template" ? "Create a new main flow template through the typed adapter" : domain === "page-template" ? "Create a page-template config object through the typed adapter; a verified preview manifest authorizes the write" : `Create a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, publish the created flow to live after saving draft").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty");
|
|
21363
22142
|
if (domain === "flow-template") {
|
|
21364
22143
|
createCommand.requiredOption("--work <file>", "Flow-template work JSON file").option("--agent <agent>", "Agent adapter for installed plugin lint discovery", "codex");
|
|
21365
22144
|
} else {
|
|
@@ -21552,7 +22331,7 @@ function registerConfigCommands(program2) {
|
|
|
21552
22331
|
await writeResponseOut(options.out, output);
|
|
21553
22332
|
printResult(options.format, output);
|
|
21554
22333
|
});
|
|
21555
|
-
domainCommand.command("submit").description(`Submit a ${domain} payload when a verified domain adapter is available;
|
|
22334
|
+
domainCommand.command("submit").description(`Submit a ${domain} payload when a verified domain adapter is available; page-template reuses a verified preview manifest and other domains require --confirm`).requiredOption("--id <id>", "Remote config id").requiredOption("--payload <file>", "Submit payload JSON file produced by build").option("--profile <profile>", "Profile name").option("--agent <agent>", "Agent adapter for installed plugin lint discovery", "codex").option("--confirm <text>", "Exact confirmation text").option("--dry-run", "Validate and print the submit result without writing remotely").option("--publish-live", "For flow-template, submit this payload as a live publish").option("--initialize-custom-key", "For a legacy dataset only, permit one-time empty custom_key initialization with an exact confirmation").option("--validation-report <file>", "Runtime/E2E permission matrix evidence bound to this submit payload").option("--override-reason <reason>", "Explicit audited reason for bypassing a required list-template validation report").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
21556
22335
|
const configData = await loadConfig();
|
|
21557
22336
|
const resolved = resolveProfile(configData, options.profile);
|
|
21558
22337
|
const result = await submitConfigDomain(
|
|
@@ -21561,10 +22340,11 @@ function registerConfigCommands(program2) {
|
|
|
21561
22340
|
domain,
|
|
21562
22341
|
options.id,
|
|
21563
22342
|
options.payload,
|
|
21564
|
-
options.confirm,
|
|
22343
|
+
options.dryRun ? void 0 : options.confirm,
|
|
21565
22344
|
{
|
|
21566
22345
|
publishLive: Boolean(options.publishLive),
|
|
21567
22346
|
agent: options.agent || "codex",
|
|
22347
|
+
dryRun: Boolean(options.dryRun),
|
|
21568
22348
|
initializeDatasetCustomKey: Boolean(options.initializeCustomKey),
|
|
21569
22349
|
validationReportFile: options.validationReport,
|
|
21570
22350
|
overrideReason: options.overrideReason
|
|
@@ -21869,6 +22649,12 @@ var schemaEntries = [
|
|
|
21869
22649
|
{ name: "config.page_template.asset.list", description: "List static resources registered for an independent page-composition template.", method: "GET", path: "/api/page_composition_asset/:templateId" },
|
|
21870
22650
|
{ name: "config.page_template.asset.upload", description: "Upload and register a static resource for an independent page-composition template.", method: "POST", path: "/api/page_composition_asset/:templateId" },
|
|
21871
22651
|
{ name: "config.page_template.asset.delete", description: "Delete an unreferenced static resource from an independent page-composition template.", method: "DELETE", path: "/api/page_composition_asset/:assetId" },
|
|
22652
|
+
{ name: "config.home_portal.export", description: "Export the workspace-scoped flow portal bundle.", method: "GET", path: "/api/home_portal" },
|
|
22653
|
+
{ name: "config.home_portal.submit", description: "Replace the workspace flow portal bundle with optimistic version checking.", method: "PUT", path: "/api/home_portal" },
|
|
22654
|
+
{ name: "config.home_portal.flows", description: "List flow options available to flow portal editors.", method: "GET", path: "/api/home_portal/flows" },
|
|
22655
|
+
{ name: "config.home_portal.preview", description: "Preview navigation, workspaces, or portal copy operations.", method: "GET", path: "/api/home_portal/nav_preview + /api/home_portal/workspaces + /api/home_portal/copy_preview" },
|
|
22656
|
+
{ name: "config.home_portal.import", description: "Import navigation into the flow portal using a preview token.", method: "POST", path: "/api/home_portal/nav_import" },
|
|
22657
|
+
{ name: "config.home_portal.copy", description: "Copy a flow portal from another workspace using a preview token.", method: "POST", path: "/api/home_portal/copy" },
|
|
21872
22658
|
{ name: "config.step_detail_template.export", description: "Export type=6 flow-step detail template config.", method: "GET", path: "/api/flow_page_template/:id?type=6&skip_i18n=true" },
|
|
21873
22659
|
{ name: "config.step_detail_template.create", description: "Create a type=6 flow-step detail template through a verified typed adapter.", method: "POST", path: "/api/flow_page_template?type=6" },
|
|
21874
22660
|
{ name: "config.step_detail_template.delete", description: "Delete a type=6 flow-step detail template through a verified typed adapter.", method: "DELETE", path: "/api/flow_page_template/:id?type=6" },
|
|
@@ -22498,7 +23284,7 @@ function hasDynamicRuntimeId(value) {
|
|
|
22498
23284
|
if (!value || value.includes("{{")) return false;
|
|
22499
23285
|
return /(?:[?&](?:id|project_id|step_id|trace_id)=\d+)|(?:\/project(?:Continue|_detail)?\/\d+)/i.test(value);
|
|
22500
23286
|
}
|
|
22501
|
-
function targetIssues(target, stepKey, actionIndex) {
|
|
23287
|
+
function targetIssues(target, stepKey, actionIndex, actionType = "") {
|
|
22502
23288
|
if (!isRecord9(target)) {
|
|
22503
23289
|
return [{
|
|
22504
23290
|
rule_id: "test_suite.automation.target_missing",
|
|
@@ -22538,7 +23324,8 @@ function targetIssues(target, stepKey, actionIndex) {
|
|
|
22538
23324
|
}];
|
|
22539
23325
|
}
|
|
22540
23326
|
const css = stringValue2(target.css);
|
|
22541
|
-
|
|
23327
|
+
const knownListContainerCss = actionType === "list.assert_record" && css === ".project-table-container";
|
|
23328
|
+
if (css && !knownListContainerCss && !/^(?:\[(?:data-[\w-]+|name|aria-label)=|#[A-Za-z][\w:-]*$)/.test(css)) {
|
|
22542
23329
|
return [{
|
|
22543
23330
|
rule_id: "test_suite.automation.selector_unstable",
|
|
22544
23331
|
step_key: stepKey,
|
|
@@ -22626,7 +23413,7 @@ function actionIssues(action, stepKey, index, check, resolutionOutcome) {
|
|
|
22626
23413
|
"file.download",
|
|
22627
23414
|
"wait.visible"
|
|
22628
23415
|
].includes(type)) {
|
|
22629
|
-
issues.push(...targetIssues(action.target ?? (action.field ? { field: action.field } : void 0), stepKey, index));
|
|
23416
|
+
issues.push(...targetIssues(action.target ?? (action.field ? { field: action.field } : void 0), stepKey, index, type));
|
|
22630
23417
|
}
|
|
22631
23418
|
if (type === "page.assert_text_sequence") {
|
|
22632
23419
|
const target = isRecord9(action.target) ? action.target : {};
|
|
@@ -31226,7 +32013,10 @@ function browserPageStepMatches(expected, bodyText, textVisible, runtimeUrl = ""
|
|
|
31226
32013
|
return normalizedActiveSteps.includes(normalizedExpected);
|
|
31227
32014
|
}
|
|
31228
32015
|
if (handledCurrentStep) return expected === "\u64CD\u4F5C\u6210\u529F";
|
|
31229
|
-
|
|
32016
|
+
if (normalizedExpected === "\u5F52\u6863" && textVisible && /归档[\s\S]{0,80}(?:完成|已完成|已归档)/.test(bodyText)) {
|
|
32017
|
+
return true;
|
|
32018
|
+
}
|
|
32019
|
+
return false;
|
|
31230
32020
|
}
|
|
31231
32021
|
function browserEvidenceStatusIsVerified(status) {
|
|
31232
32022
|
return status !== "submitted_outcome_unknown";
|
|
@@ -31994,7 +32784,7 @@ function browserListContainerKind(descriptor) {
|
|
|
31994
32784
|
if (classes.has("el-table")) return "element_table";
|
|
31995
32785
|
if (descriptor.tag === "table") return "table";
|
|
31996
32786
|
if (descriptor.role === "rowgroup") return "rowgroup";
|
|
31997
|
-
if (/(?:^|[-_])(list|table|records)(?:$|[-_])/i.test(descriptor.test_id) || classes.has("project-list") || classes.has("list-container")) return "known_list";
|
|
32787
|
+
if (/(?:^|[-_])(list|table|records)(?:$|[-_])/i.test(descriptor.test_id) || classes.has("project-list") || classes.has("list-container") || classes.has("project-table-container")) return "known_list";
|
|
31998
32788
|
return void 0;
|
|
31999
32789
|
}
|
|
32000
32790
|
async function visibleBrowserRecords(records) {
|
|
@@ -32438,7 +33228,13 @@ async function executeAction(page, action, variables, runtime) {
|
|
|
32438
33228
|
}
|
|
32439
33229
|
case "detail.assert_rows": {
|
|
32440
33230
|
const table = await tableLocator(page, String(next.table));
|
|
32441
|
-
const
|
|
33231
|
+
const rowGroups = [
|
|
33232
|
+
table.locator(".el-table__body-wrapper:not(.el-table__fixed-body-wrapper) > table.el-table__body > tbody > tr"),
|
|
33233
|
+
table.locator("table:not(.el-table__fixed) > tbody > tr"),
|
|
33234
|
+
table.locator('[role="rowgroup"] > [role="row"]')
|
|
33235
|
+
];
|
|
33236
|
+
const rows2 = await firstVisibleBrowserRecordGroup(rowGroups);
|
|
33237
|
+
const count = rows2.length;
|
|
32442
33238
|
const passed = count === Number(next.count);
|
|
32443
33239
|
if (!passed) throw new Error(`detail row count mismatch: expected ${next.count}, got ${count}`);
|
|
32444
33240
|
return { assertion: { type: next.type, passed, table: next.table, count } };
|
|
@@ -36131,40 +36927,74 @@ function mergeField(existing, incoming) {
|
|
|
36131
36927
|
...children?.length ? { children } : {}
|
|
36132
36928
|
};
|
|
36133
36929
|
}
|
|
36134
|
-
function
|
|
36930
|
+
function fieldRecords(value) {
|
|
36931
|
+
if (Array.isArray(value)) return value.flatMap((item) => fieldRecords(item));
|
|
36932
|
+
if (!isRecord14(value)) return [];
|
|
36933
|
+
if (pickString(value, FIELD_KEY_NAMES)) return [value];
|
|
36934
|
+
return Object.values(value).flatMap((item) => fieldRecords(item));
|
|
36935
|
+
}
|
|
36936
|
+
function fieldLabel(value) {
|
|
36937
|
+
return pickString(value, FIELD_LABEL_NAMES)?.toLowerCase() ?? "";
|
|
36938
|
+
}
|
|
36939
|
+
function collectFieldCandidates(value, fields, aliases = /* @__PURE__ */ new Map(), depth = 0) {
|
|
36135
36940
|
if (depth > 8) {
|
|
36136
36941
|
return;
|
|
36137
36942
|
}
|
|
36138
36943
|
if (Array.isArray(value)) {
|
|
36139
36944
|
for (const item of value) {
|
|
36140
|
-
collectFieldCandidates(item, fields, depth + 1);
|
|
36945
|
+
collectFieldCandidates(item, fields, new Map(aliases), depth + 1);
|
|
36141
36946
|
}
|
|
36142
36947
|
return;
|
|
36143
36948
|
}
|
|
36144
36949
|
if (!isRecord14(value)) {
|
|
36145
36950
|
return;
|
|
36146
36951
|
}
|
|
36952
|
+
const localAliases = new Map(aliases);
|
|
36953
|
+
for (const [ruleName, valueName] of [["rule", "value"], ["rules", "values"]]) {
|
|
36954
|
+
const rules = fieldRecords(value[ruleName]);
|
|
36955
|
+
const values = fieldRecords(value[valueName]);
|
|
36956
|
+
if (rules.length === 0 || values.length === 0) continue;
|
|
36957
|
+
const usedValues = /* @__PURE__ */ new Set();
|
|
36958
|
+
for (let index = 0; index < rules.length; index += 1) {
|
|
36959
|
+
const rule = rules[index];
|
|
36960
|
+
const ruleKey = pickString(rule, FIELD_KEY_NAMES);
|
|
36961
|
+
if (!ruleKey) continue;
|
|
36962
|
+
let valueIndex = values.findIndex((candidate, candidateIndex) => !usedValues.has(candidateIndex) && fieldLabel(rule) !== "" && fieldLabel(rule) === fieldLabel(candidate));
|
|
36963
|
+
const positionalCandidate = index < values.length ? values[index] : void 0;
|
|
36964
|
+
const labelsCompatible = !fieldLabel(rule) || !positionalCandidate || !fieldLabel(positionalCandidate) || fieldLabel(rule) === fieldLabel(positionalCandidate);
|
|
36965
|
+
if (valueIndex < 0 && labelsCompatible && index < values.length && !usedValues.has(index)) valueIndex = index;
|
|
36966
|
+
if (valueIndex < 0) continue;
|
|
36967
|
+
const persisted = values[valueIndex];
|
|
36968
|
+
const persistedKey = pickString(persisted, FIELD_KEY_NAMES);
|
|
36969
|
+
if (!ruleKey || !persistedKey || ruleKey === persistedKey) continue;
|
|
36970
|
+
usedValues.add(valueIndex);
|
|
36971
|
+
localAliases.set(ruleKey, persistedKey);
|
|
36972
|
+
localAliases.set(persistedKey, persistedKey);
|
|
36973
|
+
}
|
|
36974
|
+
}
|
|
36147
36975
|
const field = fieldFromRecord(value);
|
|
36148
36976
|
if (field) {
|
|
36149
|
-
|
|
36977
|
+
const canonicalKey = localAliases.get(field.key) ?? field.key;
|
|
36978
|
+
const canonicalField = canonicalKey === field.key ? field : { ...field, key: canonicalKey };
|
|
36979
|
+
if (isSubFormField(canonicalField)) {
|
|
36150
36980
|
const childFields = /* @__PURE__ */ new Map();
|
|
36151
36981
|
for (const child of Object.values(value)) {
|
|
36152
36982
|
if (isRecord14(child) || Array.isArray(child)) {
|
|
36153
|
-
collectFieldCandidates(child, childFields, depth + 1);
|
|
36983
|
+
collectFieldCandidates(child, childFields, localAliases, depth + 1);
|
|
36154
36984
|
}
|
|
36155
36985
|
}
|
|
36156
36986
|
const children = [...childFields.values()].sort((left, right) => left.key.localeCompare(right.key));
|
|
36157
36987
|
fields.set(
|
|
36158
|
-
|
|
36159
|
-
mergeField(fields.get(
|
|
36988
|
+
canonicalKey,
|
|
36989
|
+
mergeField(fields.get(canonicalKey), { ...canonicalField, ...children.length ? { children } : {} })
|
|
36160
36990
|
);
|
|
36161
36991
|
return;
|
|
36162
36992
|
}
|
|
36163
|
-
fields.set(
|
|
36993
|
+
fields.set(canonicalKey, mergeField(fields.get(canonicalKey), canonicalField));
|
|
36164
36994
|
}
|
|
36165
36995
|
for (const child of Object.values(value)) {
|
|
36166
36996
|
if (isRecord14(child) || Array.isArray(child)) {
|
|
36167
|
-
collectFieldCandidates(child, fields, depth + 1);
|
|
36997
|
+
collectFieldCandidates(child, fields, localAliases, depth + 1);
|
|
36168
36998
|
}
|
|
36169
36999
|
}
|
|
36170
37000
|
}
|
|
@@ -41000,7 +41830,7 @@ function cancelIfNeeded(value) {
|
|
|
41000
41830
|
throw new Error("Interactive project creation cancelled.");
|
|
41001
41831
|
}
|
|
41002
41832
|
}
|
|
41003
|
-
function
|
|
41833
|
+
function fieldLabel2(field) {
|
|
41004
41834
|
return field.label ? `${field.label} (${field.key})` : field.key;
|
|
41005
41835
|
}
|
|
41006
41836
|
function isArrayField(field) {
|
|
@@ -41026,7 +41856,7 @@ function subFormHint(field) {
|
|
|
41026
41856
|
return `JSON array rows: ${children}`;
|
|
41027
41857
|
}
|
|
41028
41858
|
async function promptField(field, currentValue) {
|
|
41029
|
-
const message = field.required ? `${
|
|
41859
|
+
const message = field.required ? `${fieldLabel2(field)} *` : fieldLabel2(field);
|
|
41030
41860
|
if (isSubFormField(field)) {
|
|
41031
41861
|
const value2 = await text3({
|
|
41032
41862
|
message,
|