bpmax-cli 0.1.44-beta.27 → 0.1.44-beta.28

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 CHANGED
@@ -469,7 +469,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
469
469
  // package.json
470
470
  var package_default = {
471
471
  name: "bpmax-cli",
472
- version: "0.1.44-beta.27",
472
+ version: "0.1.44-beta.28",
473
473
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
474
474
  type: "module",
475
475
  bin: {
@@ -5325,7 +5325,9 @@ function buildStructuredFormTemplatePayload(work) {
5325
5325
  throw new Error(`form-template field_type mismatch for ${ref}.`);
5326
5326
  }
5327
5327
  const rule = mode === "create" ? stripKeys(bundle.rule, FORM_RULE_ID_KEYS) : { ...bundle.rule };
5328
- const value = mode === "create" ? stripKeys(bundle.value, FORM_VALUE_ID_KEYS) : { ...bundle.value };
5328
+ const value = normalizeFormTemplateValueValidateMap(
5329
+ mode === "create" ? stripKeys(bundle.value, FORM_VALUE_ID_KEYS) : { ...bundle.value }
5330
+ );
5329
5331
  submitRow.push(rule);
5330
5332
  valueItems.push(value);
5331
5333
  seen.add(ref);
@@ -5341,7 +5343,7 @@ function buildStructuredFormTemplatePayload(work) {
5341
5343
  for (const value of preservedValues) {
5342
5344
  const field = typeof value.field === "string" ? value.field : "";
5343
5345
  if (field && !seen.has(field) && !removedFields.has(field)) {
5344
- valueItems.push({ ...value });
5346
+ valueItems.push(normalizeFormTemplateValueValidateMap(value));
5345
5347
  }
5346
5348
  }
5347
5349
  return {
@@ -5376,13 +5378,75 @@ function looksLikeFormTemplateWork(value) {
5376
5378
  }
5377
5379
  return isRecord3(value.basic) && Array.isArray(value.layout) && isRecord3(value.fields);
5378
5380
  }
5381
+ function isValidFormTemplateRequiredFlag(value) {
5382
+ return value === true || value === false || value === null;
5383
+ }
5384
+ function normalizeFormTemplateValueValidateMap(item) {
5385
+ const validateMap = isRecord3(item.validateMap) ? { ...item.validateMap } : {};
5386
+ if (!Object.prototype.hasOwnProperty.call(validateMap, "required") || validateMap.required === void 0) {
5387
+ validateMap.required = null;
5388
+ }
5389
+ return { ...item, validateMap };
5390
+ }
5391
+ function normalizeFormTemplateValueItems(value) {
5392
+ if (!Array.isArray(value)) {
5393
+ return value;
5394
+ }
5395
+ return value.map((item) => isRecord3(item) ? normalizeFormTemplateValueValidateMap(item) : item);
5396
+ }
5397
+ function formTemplateValueFieldLabel(item, index) {
5398
+ const field = typeof item.field === "string" && item.field ? item.field : `#${index}`;
5399
+ const title = typeof item.title === "string" && item.title ? ` (${item.title})` : "";
5400
+ return `${field}${title}`;
5401
+ }
5402
+ function validateFormTemplateValueValidateMaps(payload, errors) {
5403
+ const values = Array.isArray(payload.value) ? payload.value : isRecord3(payload.preserve) && Array.isArray(payload.preserve.value) ? payload.preserve.value : [];
5404
+ for (const [index, item] of values.entries()) {
5405
+ if (!isRecord3(item)) {
5406
+ continue;
5407
+ }
5408
+ const validateMap = item.validateMap;
5409
+ if (!isRecord3(validateMap)) {
5410
+ errors.push(
5411
+ `form-template value ${formTemplateValueFieldLabel(item, index)} is missing validateMap; add value.validateMap.required (true/false/null) before build/submit.`
5412
+ );
5413
+ continue;
5414
+ }
5415
+ if (!Object.prototype.hasOwnProperty.call(validateMap, "required") || validateMap.required === void 0) {
5416
+ errors.push(
5417
+ `form-template value ${formTemplateValueFieldLabel(item, index)} is missing validateMap.required; i_form_create.setValue() reads it during initialization validation.`
5418
+ );
5419
+ } else if (!isValidFormTemplateRequiredFlag(validateMap.required)) {
5420
+ errors.push(
5421
+ `form-template value ${formTemplateValueFieldLabel(item, index)} has invalid validateMap.required; use true, false, or null.`
5422
+ );
5423
+ }
5424
+ }
5425
+ if (isRecord3(payload.fields)) {
5426
+ for (const [field, bundle] of Object.entries(payload.fields)) {
5427
+ if (!isRecord3(bundle) || !isRecord3(bundle.value)) {
5428
+ continue;
5429
+ }
5430
+ const validateMap = bundle.value.validateMap;
5431
+ if (!isRecord3(validateMap)) {
5432
+ errors.push(`form-template fields.${field}.value is missing validateMap; add value.validateMap.required (true/false/null) before build/submit.`);
5433
+ } else if (!Object.prototype.hasOwnProperty.call(validateMap, "required") || validateMap.required === void 0) {
5434
+ errors.push(`form-template fields.${field}.value is missing validateMap.required; i_form_create.setValue() reads it during initialization validation.`);
5435
+ } else if (!isValidFormTemplateRequiredFlag(validateMap.required)) {
5436
+ errors.push(`form-template fields.${field}.value has invalid validateMap.required; use true, false, or null.`);
5437
+ }
5438
+ }
5439
+ }
5440
+ }
5379
5441
  function stripFormTemplateCreateIds(payload) {
5380
5442
  const next = { ...payload };
5381
5443
  if (Array.isArray(next.rule)) {
5382
5444
  next.rule = next.rule.map((row) => Array.isArray(row) ? row.map((item) => isRecord3(item) ? stripKeys(item, FORM_RULE_ID_KEYS) : item) : row);
5383
5445
  }
5384
5446
  if (Array.isArray(next.value)) {
5385
- next.value = next.value.map((item) => isRecord3(item) ? stripKeys(item, FORM_VALUE_ID_KEYS) : item);
5447
+ next.value = normalizeFormTemplateValueItems(
5448
+ next.value.map((item) => isRecord3(item) ? stripKeys(item, FORM_VALUE_ID_KEYS) : item)
5449
+ );
5386
5450
  }
5387
5451
  return next;
5388
5452
  }
@@ -6238,7 +6302,13 @@ function buildDomainSubmitPayload(domain, work, options = {}, raw) {
6238
6302
  return buildStructuredFormTemplatePayload(work);
6239
6303
  }
6240
6304
  const payload = pickDefined(work, ["name", "desc", "category", "option", "rule", "value"]);
6241
- return work.mode === "create" ? stripFormTemplateCreateIds(payload) : payload;
6305
+ if (work.mode === "create") {
6306
+ return stripFormTemplateCreateIds(payload);
6307
+ }
6308
+ if (Array.isArray(payload.value)) {
6309
+ payload.value = normalizeFormTemplateValueItems(payload.value);
6310
+ }
6311
+ return payload;
6242
6312
  }
6243
6313
  if (domain === "flow-template") {
6244
6314
  return normalizeFlowTemplatePayload(work);
@@ -7189,6 +7259,13 @@ async function buildConfigSubmitPayload(domain, workFile, outFile, metaFile, opt
7189
7259
  throw new Error(`flow-template plugin lint failed: ${pluginLint.errors.join("; ")}`);
7190
7260
  }
7191
7261
  }
7262
+ if (domain === "form-template" && isRecord3(work)) {
7263
+ const errors = [];
7264
+ validateFormTemplateValueValidateMaps(work, errors);
7265
+ if (errors.length) {
7266
+ throw new Error(`form-template lint failed: ${errors.join("; ")}`);
7267
+ }
7268
+ }
7192
7269
  const payload = buildDomainSubmitPayload(domain, work, options, raw);
7193
7270
  if (domain === "flow-template" && options.publishLive) {
7194
7271
  payload.publish_live = true;
@@ -7261,8 +7338,10 @@ async function lintConfigWorkFile(file, options = {}) {
7261
7338
  if (Object.prototype.hasOwnProperty.call(value, "content")) {
7262
7339
  lintTemplateFieldReferences(value, errors);
7263
7340
  }
7264
- if (looksLikeFormTemplateWork(value)) {
7341
+ const shouldLintFormTemplate = options.domain ? options.domain === "form-template" : looksLikeFormTemplateWork(value);
7342
+ if (shouldLintFormTemplate) {
7265
7343
  validateFormTemplateNameLength(value, errors);
7344
+ validateFormTemplateValueValidateMaps(value, errors);
7266
7345
  }
7267
7346
  if ((Object.prototype.hasOwnProperty.call(value, "content") || isRecord3(value.basic)) && pageTemplateType(value) === 1) {
7268
7347
  validateListTemplateActionGate(value, errors);
@@ -7910,6 +7989,19 @@ var CONFIG_DOMAINS2 = [
7910
7989
  ["role", "bpmax-role-editor", "\u89D2\u8272\u6743\u9650"],
7911
7990
  ["nav-config", "bpmax-nav-config-editor", "\u5BFC\u822A\u914D\u7F6E"]
7912
7991
  ];
7992
+ var CONFIG_DIRECTORY_PURPOSES = [
7993
+ ["think_configuration/", "Workspace-level configs: navmenus, permissions, plugin settings, message templates"],
7994
+ ["think_flow/", "Business process/flow definitions with nodes, conditions, and scripts"],
7995
+ ["think_data_set/", "Data set definitions linked to flows"],
7996
+ ["think_data_set_field/", "Field definitions for data sets"],
7997
+ ["think_flow_page_template/", "Page templates used in flows"],
7998
+ ["think_form_template/", "Form template definitions"],
7999
+ ["think_api_platform/", "External API platform integrations (e.g., D365)"],
8000
+ ["think_api_proxy/", "API proxy configurations"],
8001
+ ["think_workspace/", "Workspace definitions"],
8002
+ ["think_role/", "Role definitions"],
8003
+ ["think_category/", "Category definitions"]
8004
+ ];
7913
8005
  function escapeRegExp(value) {
7914
8006
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
7915
8007
  }
@@ -7953,6 +8045,9 @@ function renderConfigWorkspaceGuide(options) {
7953
8045
  const rows = CONFIG_DOMAINS2.map(
7954
8046
  ([domain, skill, label]) => `| ${label} | \`${skill}\` | \`${commandPrefix3} config ${domain} ...\` |`
7955
8047
  ).join("\n");
8048
+ const directoryRows = CONFIG_DIRECTORY_PURPOSES.map(
8049
+ ([directory, purpose]) => `| \`${directory}\` | ${purpose} |`
8050
+ ).join("\n");
7956
8051
  return `${start}
7957
8052
  # BPMAX \u914D\u7F6E\u5DE5\u4F5C\u533A\uFF1A${display(options.env)}
7958
8053
 
@@ -7962,11 +8057,15 @@ function renderConfigWorkspaceGuide(options) {
7962
8057
  - BPMAX: \`${display(options.environment.bpmax_base_url || options.profile.origin)}\`
7963
8058
  - Workspace: \`${display(options.environment.workspace || options.profile.workspace)}\`
7964
8059
  - sysconfigdiff: \`${display(options.environment.sysconfigdiff_base_url)}\`
7965
- - sysconfig repo: \`${display(options.environment.sysconfig_repo_path)}\`
7966
8060
  - sysconfig user: \`${display(options.environment.username)}\`
7967
8061
  - secrets: \`[REDACTED]\`
7968
8062
 
7969
8063
  ${configEnabled ? "" : "> \u5F53\u524D profile \u7684 API Key \u5C1A\u672A\u5F00\u542F\u914D\u7F6E\u80FD\u529B\u3002\u9700\u8981\u91CD\u65B0\u6388\u6743\u5E76\u5728\u6388\u6743\u9875\u624B\u52A8\u52FE\u9009\u201C\u5F00\u542F\u914D\u7F6E\u80FD\u529B\u201D\u540E\uFF0C\u624D\u80FD\u6267\u884C\u8FDC\u7AEF\u914D\u7F6E\u5199\u64CD\u4F5C\u3002\n"}
8064
+ ## \u76EE\u5F55\u8BF4\u660E
8065
+ | Directory | Purpose |
8066
+ | --- | --- |
8067
+ ${directoryRows}
8068
+
7970
8069
  ## \u5F3A\u5236\u89C4\u5219
7971
8070
  - \u914D\u7F6E\u5199\u64CD\u4F5C\u53EA\u80FD\u4F7F\u7528 typed CLI\uFF1A\`${commandPrefix3} config <domain> submit\`\uFF1B\u63D2\u4EF6\u914D\u7F6E\u53EA\u80FD\u4F7F\u7528 \`${commandPrefix3} config plugin <domain> submit\`\u3002
7972
8071
  - \u5982\u679C CLI \u63D0\u793A\u7F3A\u5C11 capability\u3001\u5F53\u524D profile \u672A\u5F00\u542F\u914D\u7F6E\u80FD\u529B\uFF0C\u6216\u672A\u6765\u65B0\u589E domain \u5C1A\u672A\u8FDB\u5165 adapter \u77E9\u9635 / \`config plugin adapters\`\uFF0C\u5FC5\u987B\u505C\u6B62\u8FDC\u7AEF\u5199\u5165\uFF1B\u4E0D\u5F97\u624B\u5199 raw API\u3002
@@ -8015,7 +8114,7 @@ ${commandPrefix3} config plugin <domain> verify --id <id> --expect <work-file> -
8015
8114
  \u5148\u6309 \`bpmax-config-latest\` \u6267\u884C\uFF0C\u4E0D\u8981\u4F7F\u7528\u73AF\u5883\u4E13\u5C5E latest skill \u6216\u65E7\u811A\u672C\u3002
8016
8115
 
8017
8116
  \`\`\`bash
8018
- ${commandPrefix3} config workspace init ${envArg} --profile ${profileArg} --workspace-dir ${shellQuote3(options.environment.sysconfig_repo_path)} --format json
8117
+ ${commandPrefix3} config workspace init ${envArg} --profile ${profileArg} --workspace-dir . --format json
8019
8118
  ${commandPrefix3} config latest pull ${envArg} --profile ${profileArg} --format json
8020
8119
  \`\`\`
8021
8120
 
@@ -9558,7 +9657,7 @@ function registerConfigCommands(program2) {
9558
9657
  requireInstalled: true
9559
9658
  });
9560
9659
  }
9561
- const result = await lintConfigWorkFile(options.work, { pluginLint });
9660
+ const result = await lintConfigWorkFile(options.work, { domain, pluginLint });
9562
9661
  if (!result.ok) {
9563
9662
  printResult(options.format, result);
9564
9663
  throw new Error(`Config lint failed for ${options.work}`);