@nocobase/plugin-flow-engine 2.2.0-alpha.1 → 2.2.0-alpha.10

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.
Files changed (86) hide show
  1. package/dist/ai/ai-employees/nathan/prompt.md +2 -0
  2. package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +1 -0
  3. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextApis.js +2 -2
  4. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextEnvs.js +2 -2
  5. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/getContextVars.js +2 -2
  6. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/lintAndTestJS.js +2 -2
  7. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +4 -4
  8. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +2 -2
  9. package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +2 -2
  10. package/dist/ai/docs/runjs/context/ai.md +206 -0
  11. package/dist/client/index.js +1 -1
  12. package/dist/externalVersion.js +9 -9
  13. package/dist/locale/en-US.json +3 -0
  14. package/dist/locale/index.d.ts +6 -0
  15. package/dist/locale/zh-CN.json +3 -0
  16. package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
  17. package/dist/node_modules/acorn/package.json +1 -1
  18. package/dist/node_modules/acorn-jsx/package.json +1 -1
  19. package/dist/node_modules/acorn-walk/package.json +1 -1
  20. package/dist/node_modules/ses/package.json +1 -1
  21. package/dist/node_modules/zod/package.json +1 -1
  22. package/dist/server/flow-surfaces/{runjs-authoring/blocked-global-stop/index.d.ts → approval/authoring-validation.d.ts} +1 -2
  23. package/dist/server/flow-surfaces/approval/authoring-validation.js +1151 -0
  24. package/dist/server/flow-surfaces/approval/blueprint-service.js +2 -0
  25. package/dist/server/flow-surfaces/authoring-validation.d.ts +3 -1
  26. package/dist/server/flow-surfaces/authoring-validation.js +645 -59
  27. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +7 -3
  28. package/dist/server/flow-surfaces/blueprint/compile-plan.js +23 -15
  29. package/dist/server/flow-surfaces/blueprint/export-document.d.ts +50 -0
  30. package/dist/server/flow-surfaces/blueprint/export-document.js +2510 -0
  31. package/dist/server/flow-surfaces/blueprint/normalize-document.js +18 -1
  32. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +2 -0
  33. package/dist/server/flow-surfaces/builder.js +43 -5
  34. package/dist/server/flow-surfaces/catalog.js +13 -2
  35. package/dist/server/flow-surfaces/configure-options.js +5 -3
  36. package/dist/server/flow-surfaces/constants.d.ts +16 -2
  37. package/dist/server/flow-surfaces/constants.js +2 -0
  38. package/dist/server/flow-surfaces/contract-guard.js +37 -5
  39. package/dist/server/flow-surfaces/default-action-popup.d.ts +2 -0
  40. package/dist/server/flow-surfaces/default-action-popup.js +27 -13
  41. package/dist/server/flow-surfaces/errors.d.ts +2 -2
  42. package/dist/server/flow-surfaces/errors.js +4 -4
  43. package/dist/server/flow-surfaces/filter-group.d.ts +19 -2
  44. package/dist/server/flow-surfaces/filter-group.js +232 -3
  45. package/dist/server/flow-surfaces/navigation-targets.d.ts +73 -0
  46. package/dist/server/flow-surfaces/navigation-targets.js +439 -0
  47. package/dist/server/flow-surfaces/planning/compiler.d.ts +1 -0
  48. package/dist/server/flow-surfaces/planning/compiler.js +205 -82
  49. package/dist/server/flow-surfaces/planning/key-registry.d.ts +1 -1
  50. package/dist/server/flow-surfaces/planning/runtime.js +1 -0
  51. package/dist/server/flow-surfaces/planning/step-link.d.ts +1 -1
  52. package/dist/server/flow-surfaces/planning/step-link.js +22 -3
  53. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +0 -9
  54. package/dist/server/flow-surfaces/reaction/field-value.d.ts +9 -0
  55. package/dist/server/flow-surfaces/reaction/field-value.js +51 -2
  56. package/dist/server/flow-surfaces/reaction/linkage.d.ts +6 -1
  57. package/dist/server/flow-surfaces/reaction/linkage.js +18 -3
  58. package/dist/server/flow-surfaces/reaction/meta.js +19 -1
  59. package/dist/server/flow-surfaces/reaction/types.d.ts +19 -0
  60. package/dist/server/flow-surfaces/relation-backing-foreign-key.d.ts +10 -0
  61. package/dist/server/flow-surfaces/relation-backing-foreign-key.js +79 -0
  62. package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +1 -0
  63. package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +20 -0
  64. package/dist/server/flow-surfaces/runjs-authoring/rules.js +0 -2
  65. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +0 -1
  66. package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +12 -19
  67. package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +0 -12
  68. package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +12 -2
  69. package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +0 -14
  70. package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +10 -8
  71. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +0 -14
  72. package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +18 -73
  73. package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
  74. package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +9 -53
  75. package/dist/server/flow-surfaces/service.d.ts +65 -0
  76. package/dist/server/flow-surfaces/service.js +1372 -148
  77. package/dist/server/flow-surfaces/types.d.ts +2 -1
  78. package/dist/server/variables/records.js +7 -2
  79. package/dist/server/variables/registry.js +3 -0
  80. package/dist/swagger/flow-surfaces.d.ts +289 -0
  81. package/dist/swagger/flow-surfaces.examples.d.ts +11 -0
  82. package/dist/swagger/flow-surfaces.examples.js +11 -0
  83. package/dist/swagger/flow-surfaces.js +261 -11
  84. package/dist/swagger/index.d.ts +289 -0
  85. package/package.json +2 -2
  86. package/dist/server/flow-surfaces/runjs-authoring/blocked-global-stop/index.js +0 -40
@@ -36,11 +36,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
37
  var filter_group_exports = {};
38
38
  __export(filter_group_exports, {
39
+ FLOW_SURFACE_DATE_FILTER_OPERATORS: () => FLOW_SURFACE_DATE_FILTER_OPERATORS,
39
40
  FLOW_SURFACE_EMPTY_FILTER_GROUP: () => FLOW_SURFACE_EMPTY_FILTER_GROUP,
40
41
  FLOW_SURFACE_FILTER_GROUP_EXAMPLE: () => FLOW_SURFACE_FILTER_GROUP_EXAMPLE,
41
42
  assertFlowSurfaceFilterGroupShape: () => assertFlowSurfaceFilterGroupShape,
42
43
  assertFlowSurfaceFilterOperator: () => assertFlowSurfaceFilterOperator,
44
+ isFlowSurfaceDateLikeFieldMeta: () => isFlowSurfaceDateLikeFieldMeta,
43
45
  normalizeFlowSurfaceCompatibleFilterGroupValue: () => normalizeFlowSurfaceCompatibleFilterGroupValue,
46
+ normalizeFlowSurfaceDateConditionValue: () => normalizeFlowSurfaceDateConditionValue,
44
47
  normalizeFlowSurfaceFilterDateValue: () => normalizeFlowSurfaceFilterDateValue,
45
48
  normalizeFlowSurfaceFilterGroupValue: () => normalizeFlowSurfaceFilterGroupValue,
46
49
  normalizeFlowSurfaceStrictFilterDateValue: () => normalizeFlowSurfaceStrictFilterDateValue
@@ -76,6 +79,17 @@ const FLOW_SURFACE_DATE_FILTER_OPERATORS = /* @__PURE__ */ new Set([
76
79
  "$dateNotAfter",
77
80
  "$dateBetween"
78
81
  ]);
82
+ const FLOW_SURFACE_DATE_COMPARISON_OPERATORS = /* @__PURE__ */ new Set(["$eq", "$ne", "$lt", "$lte", "$gt", "$gte", "$in", "$notIn"]);
83
+ const FLOW_SURFACE_EMPTY_FILTER_OPERATORS = /* @__PURE__ */ new Set(["$empty", "$notEmpty", "$exists", "$notExists"]);
84
+ const FLOW_SURFACE_DATE_LIKE_TYPES = /* @__PURE__ */ new Set([
85
+ "date",
86
+ "datetime",
87
+ "dateonly",
88
+ "datetimenotz",
89
+ "unixtimestamp",
90
+ "createdat",
91
+ "updatedat"
92
+ ]);
79
93
  const FLOW_SURFACE_DATE_RANGE_TYPES = /* @__PURE__ */ new Set([
80
94
  "today",
81
95
  "yesterday",
@@ -109,6 +123,18 @@ const FLOW_SURFACE_DATE_VALUE_REPAIR_EXAMPLE = {
109
123
  }
110
124
  ]
111
125
  };
126
+ const FLOW_SURFACE_DATE_CONDITION_REPAIR_HINT = "Date/DateTime condition values must be valid UI date values or safe context-path templates. Do not use template arithmetic such as {{$now - 14 * 24 * 60 * 60 * 1000}}; use date operators such as $dateBefore with a relative descriptor instead.";
127
+ const FLOW_SURFACE_DATE_CONDITION_REPAIR_EXAMPLE = {
128
+ logic: "$and",
129
+ items: [
130
+ {
131
+ path: "lastFollowUpAt",
132
+ operator: "$dateBefore",
133
+ value: { type: "past", number: 14, unit: "day" }
134
+ }
135
+ ]
136
+ };
137
+ const FLOW_SURFACE_ISO_DATE_VALUE_RE = /^\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,6})?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
112
138
  const FLOW_SURFACE_KNOWN_FILTER_OPERATORS = buildFlowSurfaceKnownFilterOperators();
113
139
  function buildFlowSurfaceKnownFilterOperators() {
114
140
  const operators = new Set(Object.keys(import_database.operators));
@@ -156,13 +182,16 @@ function assertFlowSurfaceFilterOperator(operator, path) {
156
182
  );
157
183
  }
158
184
  }
159
- function normalizeFlowSurfaceFilterDateValue(operator, value, path) {
185
+ function normalizeFlowSurfaceFilterDateValue(operator, value, path, options = {}) {
160
186
  if (typeof operator !== "string" || !FLOW_SURFACE_DATE_FILTER_OPERATORS.has(operator)) {
161
187
  return value;
162
188
  }
189
+ if (options.allowContextPathValue && isFlowSurfaceContextPathValueObject(value)) {
190
+ return value;
191
+ }
163
192
  return normalizeFlowSurfaceDateValue(value, path);
164
193
  }
165
- function normalizeFlowSurfaceStrictFilterDateValue(operator, value, path) {
194
+ function normalizeFlowSurfaceStrictFilterDateValue(operator, value, path, options = {}) {
166
195
  if (typeof operator !== "string" || !FLOW_SURFACE_DATE_FILTER_OPERATORS.has(operator)) {
167
196
  return value;
168
197
  }
@@ -171,8 +200,33 @@ function normalizeFlowSurfaceStrictFilterDateValue(operator, value, path) {
171
200
  invalidReason: "date filter value is required"
172
201
  });
173
202
  }
203
+ if (options.allowContextPathValue && isFlowSurfaceContextPathValueObject(value)) {
204
+ return value;
205
+ }
174
206
  return normalizeFlowSurfaceDateValue(value, path);
175
207
  }
208
+ function isFlowSurfaceDateLikeFieldMeta(value) {
209
+ const fieldType = String((value == null ? void 0 : value.type) || "").trim().toLowerCase();
210
+ const fieldInterface = String((value == null ? void 0 : value.interface) || "").trim().toLowerCase();
211
+ return FLOW_SURFACE_DATE_LIKE_TYPES.has(fieldType) || FLOW_SURFACE_DATE_LIKE_TYPES.has(fieldInterface);
212
+ }
213
+ function normalizeFlowSurfaceDateConditionValue(operator, value, path, options = {}) {
214
+ const normalizedOperator = typeof operator === "string" ? operator.trim() : "";
215
+ if (!normalizedOperator || FLOW_SURFACE_EMPTY_FILTER_OPERATORS.has(normalizedOperator)) {
216
+ return value;
217
+ }
218
+ if (options.allowContextPathValue && isFlowSurfaceContextPathValueObject(value)) {
219
+ return value;
220
+ }
221
+ if (FLOW_SURFACE_DATE_FILTER_OPERATORS.has(normalizedOperator)) {
222
+ assertNoUnsafeFlowSurfaceDateTemplateValues(value, path, options);
223
+ return normalizeFlowSurfaceStrictFilterDateValue(normalizedOperator, value, path);
224
+ }
225
+ if (!FLOW_SURFACE_DATE_COMPARISON_OPERATORS.has(normalizedOperator)) {
226
+ return value;
227
+ }
228
+ return normalizeFlowSurfaceDateComparisonValue(normalizedOperator, value, path, options);
229
+ }
176
230
  function normalizeFlowSurfaceFilterGroupValue(value, errorPrefix, options = {}) {
177
231
  const normalized = value === null || import_lodash.default.isPlainObject(value) && !Object.keys(value).length ? import_lodash.default.cloneDeep(FLOW_SURFACE_EMPTY_FILTER_GROUP) : import_lodash.default.cloneDeep(value);
178
232
  try {
@@ -332,7 +386,11 @@ function normalizeFlowSurfaceFilterGroupDateValues(filter, errorPrefix, options)
332
386
  normalizeFlowSurfaceFilterGroupDateValues(item, itemPath, options);
333
387
  return;
334
388
  }
335
- item.value = options.strictDateValues ? normalizeFlowSurfaceStrictFilterDateValue(item.operator, item.value, `${itemPath}.value`) : normalizeFlowSurfaceFilterDateValue(item.operator, item.value, `${itemPath}.value`);
389
+ item.value = options.strictDateValues ? normalizeFlowSurfaceStrictFilterDateValue(item.operator, item.value, `${itemPath}.value`, {
390
+ allowContextPathValue: options.allowContextPathValue
391
+ }) : normalizeFlowSurfaceFilterDateValue(item.operator, item.value, `${itemPath}.value`, {
392
+ allowContextPathValue: options.allowContextPathValue
393
+ });
336
394
  });
337
395
  }
338
396
  function normalizeFlowSurfaceDateValue(value, path) {
@@ -344,6 +402,82 @@ function normalizeFlowSurfaceDateValue(value, path) {
344
402
  }
345
403
  return normalizeFlowSurfaceDateValuePart(value, path);
346
404
  }
405
+ function normalizeFlowSurfaceDateComparisonValue(operator, value, path, options) {
406
+ if (operator === "$in" || operator === "$notIn") {
407
+ if (!Array.isArray(value)) {
408
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
409
+ ...options,
410
+ operator,
411
+ invalidReason: "date comparison array operators require an array value"
412
+ });
413
+ }
414
+ return value.map(
415
+ (item, index) => normalizeFlowSurfaceDateComparisonValuePart(item, `${path}[${index}]`, {
416
+ ...options,
417
+ operator
418
+ })
419
+ );
420
+ }
421
+ return normalizeFlowSurfaceDateComparisonValuePart(value, path, {
422
+ ...options,
423
+ operator
424
+ });
425
+ }
426
+ function normalizeFlowSurfaceDateComparisonValuePart(value, path, options) {
427
+ if (import_lodash.default.isNil(value) || value === "") {
428
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
429
+ ...options,
430
+ invalidReason: "date comparison value is required; use $empty or $notEmpty for empty checks"
431
+ });
432
+ }
433
+ if (options.allowContextPathValue && isFlowSurfaceContextPathValueObject(value)) {
434
+ return value;
435
+ }
436
+ if (isTemplateDateString(value)) {
437
+ if (isUnsafeFlowSurfaceDateTemplateString(value)) {
438
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
439
+ ...options,
440
+ invalidReason: "date condition template strings must be simple context-path references; template arithmetic, $now, Date/dayjs/moment calls, and Invalid date are not supported"
441
+ });
442
+ }
443
+ return value;
444
+ }
445
+ if (import_lodash.default.isDate(value)) {
446
+ if (!Number.isNaN(value.getTime())) {
447
+ return value;
448
+ }
449
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
450
+ ...options,
451
+ invalidReason: "date condition value must be a valid Date"
452
+ });
453
+ }
454
+ if (typeof value === "string") {
455
+ const normalized = value.trim();
456
+ if (/invalid\s+date/i.test(normalized)) {
457
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
458
+ ...options,
459
+ invalidReason: "date condition value cannot be Invalid date"
460
+ });
461
+ }
462
+ if (isFlowSurfaceIsoLikeDateValue(normalized)) {
463
+ return normalized;
464
+ }
465
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
466
+ ...options,
467
+ invalidReason: "date comparison strings must use concrete YYYY-MM-DD or ISO-like date/datetime strings"
468
+ });
469
+ }
470
+ if (import_lodash.default.isPlainObject(value)) {
471
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
472
+ ...options,
473
+ invalidReason: "relative date descriptors require date operators such as $dateBefore or $dateBetween instead of comparison operators"
474
+ });
475
+ }
476
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
477
+ ...options,
478
+ invalidReason: "date condition value must be an exact date string, ISO datetime string, or safe context path template"
479
+ });
480
+ }
347
481
  function normalizeFlowSurfaceDateArrayValue(value, path) {
348
482
  if (value.length !== 2) {
349
483
  throwInvalidFlowSurfaceDateValue(path, value, {
@@ -386,6 +520,25 @@ function isFlowSurfaceExactDateValue(value) {
386
520
  return parsed.isValid() && parsed.format(format) === value;
387
521
  });
388
522
  }
523
+ function isFlowSurfaceIsoLikeDateValue(value) {
524
+ const match = FLOW_SURFACE_ISO_DATE_VALUE_RE.exec(value);
525
+ if (!match) {
526
+ return false;
527
+ }
528
+ const [year, month, day] = value.slice(0, 10).split("-").map((item) => Number(item));
529
+ const date = new Date(Date.UTC(year, month - 1, day));
530
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
531
+ return false;
532
+ }
533
+ const timeMatch = /[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,6}))?)?/.exec(value);
534
+ if (!timeMatch) {
535
+ return true;
536
+ }
537
+ const hour = Number(timeMatch[1]);
538
+ const minute = Number(timeMatch[2]);
539
+ const second = Number(timeMatch[3] || 0);
540
+ return hour <= 23 && minute <= 59 && second <= 59 && (0, import_utils.dayjs)(value).isValid();
541
+ }
389
542
  function normalizeRelativeDateDescriptor(value, path) {
390
543
  const invalidKeys = Object.keys(value).filter((key) => !FLOW_SURFACE_RELATIVE_DATE_DESCRIPTOR_KEYS.has(key));
391
544
  if (invalidKeys.length) {
@@ -456,6 +609,67 @@ function normalizeRelativeDateDescriptor(value, path) {
456
609
  function isTemplateDateString(value) {
457
610
  return typeof value === "string" && /^\s*\{\{[\s\S]*\}\}\s*$/.test(value);
458
611
  }
612
+ function isFlowSurfaceContextPathValueObject(value) {
613
+ if (!import_lodash.default.isPlainObject(value) || value.source !== "path") {
614
+ return false;
615
+ }
616
+ const path = value.path;
617
+ if (typeof path !== "string") {
618
+ return false;
619
+ }
620
+ const normalizedPath = path.trim();
621
+ if (isTemplateDateString(normalizedPath)) {
622
+ return !isUnsafeFlowSurfaceDateTemplateString(normalizedPath);
623
+ }
624
+ return isSimpleFlowSurfaceTemplateReference(normalizedPath);
625
+ }
626
+ function extractTemplateDateExpression(value) {
627
+ return value.replace(/^\s*\{\{\s*/, "").replace(/\s*\}\}\s*$/, "").trim();
628
+ }
629
+ function isSimpleFlowSurfaceTemplateReference(expression) {
630
+ const identifier = "[A-Za-z_$][A-Za-z0-9_$-]*";
631
+ const segment = `(?:\\.${identifier}|\\[(?:\\d+|"[^"\\]]+"|'[^'\\]]+')\\])`;
632
+ return new RegExp(`^${identifier}(?:${segment})*$`).test(expression.replace(/\s+/g, ""));
633
+ }
634
+ function isUnsafeFlowSurfaceDateTemplateString(value) {
635
+ const expression = extractTemplateDateExpression(value);
636
+ if (!expression) {
637
+ return true;
638
+ }
639
+ if (/\$now\b/i.test(expression)) {
640
+ return true;
641
+ }
642
+ if (/invalid\s+date/i.test(expression)) {
643
+ return true;
644
+ }
645
+ if (/\bnew\s+Date\b|\bDate\s*\(|\bdayjs\s*\(|\bmoment\s*\(/.test(expression)) {
646
+ return true;
647
+ }
648
+ if (isSimpleFlowSurfaceTemplateReference(expression)) {
649
+ return false;
650
+ }
651
+ return /[+\-*/%()]|=>/.test(expression);
652
+ }
653
+ function assertNoUnsafeFlowSurfaceDateTemplateValues(value, path, options = {}) {
654
+ if (isTemplateDateString(value)) {
655
+ if (isUnsafeFlowSurfaceDateTemplateString(value)) {
656
+ throwInvalidFlowSurfaceDateConditionValue(path, value, {
657
+ ...options,
658
+ invalidReason: "date filter template strings must be simple context-path references; template arithmetic, $now, Date/dayjs/moment calls, and Invalid date are not supported"
659
+ });
660
+ }
661
+ return;
662
+ }
663
+ if (Array.isArray(value)) {
664
+ value.forEach((item, index) => assertNoUnsafeFlowSurfaceDateTemplateValues(item, `${path}[${index}]`, options));
665
+ return;
666
+ }
667
+ if (import_lodash.default.isPlainObject(value)) {
668
+ Object.entries(value).forEach(
669
+ ([key, item]) => assertNoUnsafeFlowSurfaceDateTemplateValues(item, `${path}.${key}`, options)
670
+ );
671
+ }
672
+ }
459
673
  function hasTemplateDateValue(value) {
460
674
  if (isTemplateDateString(value)) {
461
675
  return true;
@@ -468,6 +682,18 @@ function hasTemplateDateValue(value) {
468
682
  }
469
683
  return false;
470
684
  }
685
+ function throwInvalidFlowSurfaceDateConditionValue(path, value, details = {}) {
686
+ (0, import_errors.throwBadRequest)(`${path} must be a valid Date/DateTime condition value`, {
687
+ path,
688
+ ruleId: "date-condition-value-invalid",
689
+ details: {
690
+ invalidValue: value,
691
+ ...details,
692
+ repairHint: FLOW_SURFACE_DATE_CONDITION_REPAIR_HINT,
693
+ repairExample: FLOW_SURFACE_DATE_CONDITION_REPAIR_EXAMPLE
694
+ }
695
+ });
696
+ }
471
697
  function throwInvalidFlowSurfaceDateValue(path, value, details = {}) {
472
698
  (0, import_errors.throwBadRequest)(`${path} must be a valid date filter value`, {
473
699
  path,
@@ -482,11 +708,14 @@ function throwInvalidFlowSurfaceDateValue(path, value, details = {}) {
482
708
  }
483
709
  // Annotate the CommonJS export names for ESM import in node:
484
710
  0 && (module.exports = {
711
+ FLOW_SURFACE_DATE_FILTER_OPERATORS,
485
712
  FLOW_SURFACE_EMPTY_FILTER_GROUP,
486
713
  FLOW_SURFACE_FILTER_GROUP_EXAMPLE,
487
714
  assertFlowSurfaceFilterGroupShape,
488
715
  assertFlowSurfaceFilterOperator,
716
+ isFlowSurfaceDateLikeFieldMeta,
489
717
  normalizeFlowSurfaceCompatibleFilterGroupValue,
718
+ normalizeFlowSurfaceDateConditionValue,
490
719
  normalizeFlowSurfaceFilterDateValue,
491
720
  normalizeFlowSurfaceFilterGroupValue,
492
721
  normalizeFlowSurfaceStrictFilterDateValue
@@ -0,0 +1,73 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { Database, Transaction } from '@nocobase/database';
10
+ export declare const DEFAULT_ADMIN_UI_LAYOUT_UID = "admin-layout-model";
11
+ export declare const DEFAULT_MOBILE_UI_LAYOUT_UID = "mobile-layout-model";
12
+ export declare const DEFAULT_ADMIN_MULTI_PORTAL_UID = "__default_admin__";
13
+ export declare const DEFAULT_MOBILE_MULTI_PORTAL_UID = "__default_mobile__";
14
+ export type FlowSurfaceNavigationRequestRoles = readonly string[] | string;
15
+ export type FlowSurfaceResolvedMultiPortal = {
16
+ uid: string;
17
+ title: string;
18
+ icon?: string | null;
19
+ routeName?: string;
20
+ routePath?: string;
21
+ authCheck?: boolean;
22
+ enabled: true;
23
+ layoutUid: string;
24
+ layoutType?: string;
25
+ };
26
+ export type FlowSurfaceNavigationTarget = {
27
+ kind: 'layout' | 'portal';
28
+ uid: string;
29
+ title: string;
30
+ icon?: string | null;
31
+ layoutUid: string;
32
+ layoutType?: string;
33
+ routeName?: string;
34
+ routePath?: string;
35
+ authCheck?: boolean;
36
+ default?: boolean;
37
+ portalUid?: string;
38
+ };
39
+ export type FlowSurfaceNavigationTargetsResult = {
40
+ version: '1';
41
+ capabilities: {
42
+ multiPortal: boolean;
43
+ };
44
+ targets: FlowSurfaceNavigationTarget[];
45
+ };
46
+ type PortalResolveOptions = {
47
+ actionName: string;
48
+ path: string;
49
+ currentRoles?: FlowSurfaceNavigationRequestRoles;
50
+ transaction?: Transaction;
51
+ };
52
+ export declare class FlowSurfaceNavigationTargetsService {
53
+ private readonly db;
54
+ constructor(db: Database);
55
+ hasMultiPortalCapability(): boolean;
56
+ hasUiLayoutCapability(): boolean;
57
+ normalizePortalUid(value: unknown): string;
58
+ listNavigationTargets(currentRoles?: FlowSurfaceNavigationRequestRoles, transaction?: Transaction): Promise<FlowSurfaceNavigationTargetsResult>;
59
+ resolvePortal(portalUidValue: unknown, options: PortalResolveOptions): Promise<FlowSurfaceResolvedMultiPortal>;
60
+ readRoutePortalUids(routeId: unknown, transaction?: Transaction): Promise<string[]>;
61
+ assertRouteBelongsToPortal(actionName: string, routeId: unknown, portalUid: string, path: string, transaction?: Transaction): Promise<void>;
62
+ attachRouteTreeToPortals(routeId: unknown, portalUids: string[], options: {
63
+ portalOnly: boolean;
64
+ transaction?: Transaction;
65
+ }): Promise<void>;
66
+ private listLayoutTargets;
67
+ private listAccessiblePortalTargets;
68
+ private canAccessPortal;
69
+ private collectRouteTreeIds;
70
+ private removeDefaultLayoutRoutePermissions;
71
+ private grantDefaultPortalRouteAccess;
72
+ }
73
+ export {};