@qoretechnologies/reqraft 0.10.39-pr.99.gdbafa34 → 0.10.39

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 (110) hide show
  1. package/.claude/CLAUDE.md +12 -0
  2. package/dist/components/codeSize/index.d.ts +37 -0
  3. package/dist/components/codeSize/index.d.ts.map +1 -0
  4. package/dist/components/codeSize/index.js +87 -0
  5. package/dist/components/codeSize/index.js.map +1 -0
  6. package/dist/components/form/engine/CompactRow.d.ts +20 -1
  7. package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
  8. package/dist/components/form/engine/CompactRow.js +365 -30
  9. package/dist/components/form/engine/CompactRow.js.map +1 -1
  10. package/dist/components/form/engine/CompactToolbar.d.ts.map +1 -1
  11. package/dist/components/form/engine/CompactToolbar.js +6 -8
  12. package/dist/components/form/engine/CompactToolbar.js.map +1 -1
  13. package/dist/components/form/engine/FormEngine.d.ts +24 -45
  14. package/dist/components/form/engine/FormEngine.d.ts.map +1 -1
  15. package/dist/components/form/engine/FormEngine.js +211 -84
  16. package/dist/components/form/engine/FormEngine.js.map +1 -1
  17. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts +37 -0
  18. package/dist/components/form/engine/_structuredData/SchemaDataView.d.ts.map +1 -0
  19. package/dist/components/form/engine/_structuredData/SchemaDataView.js +335 -0
  20. package/dist/components/form/engine/_structuredData/SchemaDataView.js.map +1 -0
  21. package/dist/components/form/engine/compactRowStyles.d.ts +13 -0
  22. package/dist/components/form/engine/compactRowStyles.d.ts.map +1 -1
  23. package/dist/components/form/engine/compactRowStyles.js +30 -5
  24. package/dist/components/form/engine/compactRowStyles.js.map +1 -1
  25. package/dist/components/form/engine/compactToolbarContext.d.ts +0 -8
  26. package/dist/components/form/engine/compactToolbarContext.d.ts.map +1 -1
  27. package/dist/components/form/engine/compactToolbarContext.js.map +1 -1
  28. package/dist/components/form/engine/readFirst.d.ts +73 -1
  29. package/dist/components/form/engine/readFirst.d.ts.map +1 -1
  30. package/dist/components/form/engine/readFirst.js +175 -5
  31. package/dist/components/form/engine/readFirst.js.map +1 -1
  32. package/dist/components/form/fields/Field.d.ts.map +1 -1
  33. package/dist/components/form/fields/Field.js +1 -1
  34. package/dist/components/form/fields/Field.js.map +1 -1
  35. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts +12 -2
  36. package/dist/components/form/fields/allowed-values/AllowedValues.d.ts.map +1 -1
  37. package/dist/components/form/fields/allowed-values/AllowedValues.js +16 -6
  38. package/dist/components/form/fields/allowed-values/AllowedValues.js.map +1 -1
  39. package/dist/components/form/fields/array/ArrayAuto.d.ts.map +1 -1
  40. package/dist/components/form/fields/array/ArrayAuto.js +51 -21
  41. package/dist/components/form/fields/array/ArrayAuto.js.map +1 -1
  42. package/dist/components/form/fields/array/ArrayAutoField.d.ts.map +1 -1
  43. package/dist/components/form/fields/array/ArrayAutoField.js +42 -25
  44. package/dist/components/form/fields/array/ArrayAutoField.js.map +1 -1
  45. package/dist/components/form/fields/auto/AutoFormField.d.ts +4 -0
  46. package/dist/components/form/fields/auto/AutoFormField.d.ts.map +1 -1
  47. package/dist/components/form/fields/auto/AutoFormField.js +29 -4
  48. package/dist/components/form/fields/auto/AutoFormField.js.map +1 -1
  49. package/dist/components/form/fields/long-string/LongString.d.ts +9 -1
  50. package/dist/components/form/fields/long-string/LongString.d.ts.map +1 -1
  51. package/dist/components/form/fields/long-string/LongString.js +25 -4
  52. package/dist/components/form/fields/long-string/LongString.js.map +1 -1
  53. package/dist/components/form/fields/template/TemplateField.d.ts.map +1 -1
  54. package/dist/components/form/fields/template/TemplateField.js +12 -2
  55. package/dist/components/form/fields/template/TemplateField.js.map +1 -1
  56. package/dist/helpers/common.d.ts +8 -1
  57. package/dist/helpers/common.d.ts.map +1 -1
  58. package/dist/helpers/common.js +9 -1
  59. package/dist/helpers/common.js.map +1 -1
  60. package/dist/helpers/optionUiTypes.d.ts +30 -0
  61. package/dist/helpers/optionUiTypes.d.ts.map +1 -0
  62. package/dist/helpers/optionUiTypes.js +148 -0
  63. package/dist/helpers/optionUiTypes.js.map +1 -0
  64. package/dist/helpers/options.d.ts +19 -0
  65. package/dist/helpers/options.d.ts.map +1 -1
  66. package/dist/helpers/options.js +25 -1
  67. package/dist/helpers/options.js.map +1 -1
  68. package/dist/helpers/providerValue.d.ts +68 -0
  69. package/dist/helpers/providerValue.d.ts.map +1 -0
  70. package/dist/helpers/providerValue.js +50 -0
  71. package/dist/helpers/providerValue.js.map +1 -0
  72. package/dist/helpers/singleLineString.d.ts +37 -0
  73. package/dist/helpers/singleLineString.d.ts.map +1 -0
  74. package/dist/helpers/singleLineString.js +66 -0
  75. package/dist/helpers/singleLineString.js.map +1 -0
  76. package/dist/helpers/validations.d.ts +85 -2
  77. package/dist/helpers/validations.d.ts.map +1 -1
  78. package/dist/helpers/validations.js +802 -76
  79. package/dist/helpers/validations.js.map +1 -1
  80. package/dist/index.d.ts +1 -0
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +1 -0
  83. package/dist/index.js.map +1 -1
  84. package/package.json +1 -1
  85. package/src/components/codeSize/index.tsx +79 -0
  86. package/src/components/form/engine/CompactRow.tsx +450 -31
  87. package/src/components/form/engine/CompactToolbar.tsx +16 -21
  88. package/src/components/form/engine/FormEngine.stories.tsx +804 -17
  89. package/src/components/form/engine/FormEngine.tsx +207 -105
  90. package/src/components/form/engine/_structuredData/SchemaDataView.stories.tsx +233 -0
  91. package/src/components/form/engine/_structuredData/SchemaDataView.tsx +630 -0
  92. package/src/components/form/engine/compactRowStyles.ts +44 -2
  93. package/src/components/form/engine/compactToolbarContext.ts +0 -8
  94. package/src/components/form/engine/readFirst.ts +201 -5
  95. package/src/components/form/fields/Field.tsx +3 -1
  96. package/src/components/form/fields/allowed-values/AllowedValues.tsx +24 -2
  97. package/src/components/form/fields/array/ArrayAuto.tsx +35 -4
  98. package/src/components/form/fields/array/ArrayAutoField.stories.tsx +134 -0
  99. package/src/components/form/fields/array/ArrayAutoField.tsx +22 -4
  100. package/src/components/form/fields/auto/AutoFormField.tsx +30 -1
  101. package/src/components/form/fields/long-string/LongString.tsx +46 -5
  102. package/src/components/form/fields/template/TemplateField.tsx +16 -1
  103. package/src/helpers/common.ts +11 -1
  104. package/src/helpers/optionUiTypes.ts +153 -0
  105. package/src/helpers/options.ts +23 -0
  106. package/src/helpers/providerValue.ts +125 -0
  107. package/src/helpers/singleLineString.ts +61 -0
  108. package/src/helpers/validations.ts +1105 -80
  109. package/src/hooks/useWebSocket/useWebsocket.stories.tsx +23 -2
  110. package/src/index.tsx +1 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maybeBuildOptionProvider = void 0;
4
+ /**
5
+ * A provider value as an object, from either representation a caller may hold.
6
+ *
7
+ * A provider reaches the form either already expanded into `IProviderType`, or
8
+ * as the flat path string the server stores — `"factory/db{driver=pgsql}/table"`
9
+ * or the plain `"type/name/path"`. Returns `null` for anything that is neither,
10
+ * so a caller reports an invalid value rather than reading fields off nothing.
11
+ */
12
+ var maybeBuildOptionProvider = function (provider) {
13
+ if (!provider) {
14
+ return null;
15
+ }
16
+ if (typeof provider === 'object') {
17
+ return provider;
18
+ }
19
+ if (typeof provider !== 'string') {
20
+ return null;
21
+ }
22
+ if (provider.startsWith('factory')) {
23
+ var fixedProvider = provider.endsWith('/') ? provider : "".concat(provider, "/");
24
+ var factoryType = fixedProvider.split('/')[0];
25
+ var factoryName = fixedProvider.substring(fixedProvider.indexOf('/') + 1, fixedProvider.lastIndexOf('{'));
26
+ var options = fixedProvider.substring(fixedProvider.indexOf('{') + 1, fixedProvider.lastIndexOf('}'));
27
+ var optionsObject = options
28
+ .split(',')
29
+ .filter(Boolean)
30
+ .reduce(function (result, option) {
31
+ var _a = option.split('='), key = _a[0], value = _a[1];
32
+ result[key] = value;
33
+ return result;
34
+ }, {});
35
+ var result = {
36
+ type: factoryType,
37
+ name: factoryName,
38
+ path: fixedProvider.substring(fixedProvider.lastIndexOf('}/') + 2),
39
+ options: optionsObject,
40
+ };
41
+ if (provider.includes('?options_changed')) {
42
+ result.optionsChanged = true;
43
+ }
44
+ return result;
45
+ }
46
+ var _a = provider.split('/'), type = _a[0], name = _a[1], path = _a.slice(2);
47
+ return { type: type, name: name, path: path.join('/') };
48
+ };
49
+ exports.maybeBuildOptionProvider = maybeBuildOptionProvider;
50
+ //# sourceMappingURL=providerValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerValue.js","sourceRoot":"","sources":["../../src/helpers/providerValue.ts"],"names":[],"mappings":";;;AAiDA;;;;;;;GAOG;AACI,IAAM,wBAAwB,GAAG,UAAC,QAAiB;IACxD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAyB,CAAC;IACnC,CAAC;IACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACnC,IAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAG,QAAQ,MAAG,CAAC;QAClE,IAAA,WAAW,GAAI,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,GAA5B,CAA6B;QAC/C,IAAM,WAAW,GAAG,aAAa,CAAC,SAAS,CACzC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAC9B,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAC/B,CAAC;QACF,IAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CACrC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAC9B,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAC/B,CAAC;QACF,IAAM,aAAa,GAAG,OAAO;aAC1B,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,OAAO,CAAC;aACf,MAAM,CAAyB,UAAC,MAAM,EAAE,MAAM;YACvC,IAAA,KAAe,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAA/B,GAAG,QAAA,EAAE,KAAK,QAAqB,CAAC;YACvC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,OAAO,MAAM,CAAC;QAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,IAAM,MAAM,GAAkB;YAC5B,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,OAAO,EAAE,aAAsC;SAChD,CAAC;QACF,IAAI,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAC1C,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;QAC/B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEK,IAAA,KAAwB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAA1C,IAAI,QAAA,EAAE,IAAI,QAAA,EAAK,IAAI,cAAuB,CAAC;IAClD,OAAO,EAAE,IAAI,MAAA,EAAE,IAAI,MAAA,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9C,CAAC,CAAC;AA5CW,QAAA,wBAAwB,4BA4CnC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Which string field types hold one line, and how to keep them that way.
3
+ *
4
+ * The server already draws this distinction and the IDE was throwing it away:
5
+ * a service's `name` is declared `ui_type: "string"` while its `description` is
6
+ * `ui_type: "long-string"` with `markdown: True` (see `ServiceMetadata.qc`).
7
+ * Every one of them — plus `email`, `uuid`, `hostname`, `ipv4`, `ipv6` and
8
+ * `phone` — rendered through the same growing textarea, so a technical name, a
9
+ * version and an IP address all accepted Enter.
10
+ *
11
+ * That is not a cosmetic problem. These values become YAML keys, class names,
12
+ * URLs and identifiers; a newline in one of them is invalid input that the form
13
+ * happily accepted and passed on, and the operator had no way to see it.
14
+ *
15
+ * The rule is the server's own contract, stated once here rather than guessed
16
+ * per field, and it is enforced in `LongString.tsx`.
17
+ *
18
+ * It lives in reqraft rather than in a consumer because the consumer is not the
19
+ * only renderer: qorus-ide fixed this in its OWN long-string field, and every
20
+ * form that goes through FormEngine — which is where an alert rule's Internal
21
+ * Name, Name and Short Description are — reaches THIS one instead. The fix was
22
+ * real and the field in front of the operator still took Enter.
23
+ */
24
+ /** True when a string field of this type holds a single line. */
25
+ export declare const isSingleLineStringType: (type?: string) => boolean;
26
+ /**
27
+ * Flattens any line break to a single space.
28
+ *
29
+ * A space rather than nothing, because the newline is usually where a word
30
+ * boundary was — pasting two lines into a name should read as two words, not
31
+ * one run-together one. CR, LF and CRLF all collapse to one space, and the
32
+ * result is trimmed of leading/trailing whitespace the break introduced.
33
+ */
34
+ export declare const flattenToSingleLine: (value: string) => string;
35
+ /** True when the value carries a line break this field should not hold. */
36
+ export declare const hasLineBreak: (value: string) => boolean;
37
+ //# sourceMappingURL=singleLineString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleLineString.d.ts","sourceRoot":"","sources":["../../src/helpers/singleLineString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAsBH,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,OACT,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,MACM,CAAC;AAE3D,2EAA2E;AAC3E,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAA8B,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * Which string field types hold one line, and how to keep them that way.
4
+ *
5
+ * The server already draws this distinction and the IDE was throwing it away:
6
+ * a service's `name` is declared `ui_type: "string"` while its `description` is
7
+ * `ui_type: "long-string"` with `markdown: True` (see `ServiceMetadata.qc`).
8
+ * Every one of them — plus `email`, `uuid`, `hostname`, `ipv4`, `ipv6` and
9
+ * `phone` — rendered through the same growing textarea, so a technical name, a
10
+ * version and an IP address all accepted Enter.
11
+ *
12
+ * That is not a cosmetic problem. These values become YAML keys, class names,
13
+ * URLs and identifiers; a newline in one of them is invalid input that the form
14
+ * happily accepted and passed on, and the operator had no way to see it.
15
+ *
16
+ * The rule is the server's own contract, stated once here rather than guessed
17
+ * per field, and it is enforced in `LongString.tsx`.
18
+ *
19
+ * It lives in reqraft rather than in a consumer because the consumer is not the
20
+ * only renderer: qorus-ide fixed this in its OWN long-string field, and every
21
+ * form that goes through FormEngine — which is where an alert rule's Internal
22
+ * Name, Name and Short Description are — reaches THIS one instead. The fix was
23
+ * real and the field in front of the operator still took Enter.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.hasLineBreak = exports.flattenToSingleLine = exports.isSingleLineStringType = void 0;
27
+ /**
28
+ * The string types that hold exactly one line — the ones routed to a textarea
29
+ * today.
30
+ *
31
+ * Listed explicitly rather than derived by excluding the document types,
32
+ * because the two directions fail very differently. Missing a single-line type
33
+ * here leaves it behaving as it does now — no worse. Wrongly treating a new
34
+ * DOCUMENT type as single-line would flatten a user's text as they typed it,
35
+ * which is data loss. So an unrecognised type stays multi-line.
36
+ */
37
+ var SINGLE_LINE_STRING_TYPES = new Set([
38
+ 'string',
39
+ 'email',
40
+ 'uuid',
41
+ 'hostname',
42
+ 'ipv4',
43
+ 'ipv6',
44
+ 'phone',
45
+ ]);
46
+ /** True when a string field of this type holds a single line. */
47
+ var isSingleLineStringType = function (type) {
48
+ return !!type && SINGLE_LINE_STRING_TYPES.has(type);
49
+ };
50
+ exports.isSingleLineStringType = isSingleLineStringType;
51
+ /**
52
+ * Flattens any line break to a single space.
53
+ *
54
+ * A space rather than nothing, because the newline is usually where a word
55
+ * boundary was — pasting two lines into a name should read as two words, not
56
+ * one run-together one. CR, LF and CRLF all collapse to one space, and the
57
+ * result is trimmed of leading/trailing whitespace the break introduced.
58
+ */
59
+ var flattenToSingleLine = function (value) {
60
+ return value.replace(/\r\n|\r|\n/g, ' ').replace(/ {2,}/g, ' ');
61
+ };
62
+ exports.flattenToSingleLine = flattenToSingleLine;
63
+ /** True when the value carries a line break this field should not hold. */
64
+ var hasLineBreak = function (value) { return /\r|\n/.test(value); };
65
+ exports.hasLineBreak = hasLineBreak;
66
+ //# sourceMappingURL=singleLineString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleLineString.js","sourceRoot":"","sources":["../../src/helpers/singleLineString.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAEH;;;;;;;;;GASG;AACH,IAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACvC,QAAQ;IACR,OAAO;IACP,MAAM;IACN,UAAU;IACV,MAAM;IACN,MAAM;IACN,OAAO;CACR,CAAC,CAAC;AAEH,iEAAiE;AAC1D,IAAM,sBAAsB,GAAG,UAAC,IAAa;IAClD,OAAA,CAAC,CAAC,IAAI,IAAI,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC;AAA5C,CAA4C,CAAC;AADlC,QAAA,sBAAsB,0BACY;AAE/C;;;;;;;GAOG;AACI,IAAM,mBAAmB,GAAG,UAAC,KAAa;IAC/C,OAAA,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;AAAxD,CAAwD,CAAC;AAD9C,QAAA,mBAAmB,uBAC2B;AAE3D,2EAA2E;AACpE,IAAM,YAAY,GAAG,UAAC,KAAa,IAAc,OAAA,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAnB,CAAmB,CAAC;AAA/D,QAAA,YAAY,gBAAmD"}
@@ -1,4 +1,19 @@
1
1
  import { IQorusFormSchema, TQorusForm } from '@qoretechnologies/ts-toolkit';
2
+ import { TVariableActionValue } from './providerValue';
3
+ /**
4
+ * A five-field cron expression, from either representation a caller may hold.
5
+ *
6
+ * A schedule reaches the form in one of two shapes, and both are legitimate: a
7
+ * joined string (`"0 0 1 1 *"`), or the hash a Qorus job carries
8
+ * (`{minutes, hours, days, months, dow}` — also accepted under the singular
9
+ * `minute`/`hour`/`day`/`month`/`weekday` spellings). The renderer already
10
+ * accepted both; validation did not, and fed the hash straight to
11
+ * `isValidCron`, which calls `.trim()` on it.
12
+ *
13
+ * Returns `undefined` for anything that is neither, so the caller reports an
14
+ * invalid value rather than throwing.
15
+ */
16
+ export declare const cronExpressionFromValue: (value: unknown) => string | undefined;
2
17
  export interface IValidationResult {
3
18
  isValid: boolean;
4
19
  reason?: string;
@@ -13,16 +28,48 @@ interface IFieldValidationProps {
13
28
  validation_regex?: string;
14
29
  required_groups?: string[];
15
30
  optionSchema?: IQorusFormSchema;
16
- options?: TQorusForm;
31
+ /** The sibling option VALUES, for required-group and dependency checks.
32
+ * Widened because a schema entry is also passed straight in as `field`, and
33
+ * a schema entry carries an `options` of its own — the field's UI options
34
+ * bag (`{ file?: DropzoneOptions }`) — under the same name. */
35
+ options?: TQorusForm | Record<string, any>;
17
36
  isFunction?: boolean;
18
37
  arg_schema?: IQorusFormSchema;
19
38
  ui_element_type?: string;
20
39
  element_type?: string;
21
40
  allowed_values?: any[];
41
+ element_allowed_values?: any[];
22
42
  disabled?: boolean;
23
43
  metadata?: Record<string, any>;
44
+ /** The expression catalogue, when a caller holds one already — see
45
+ * {@link setExpressionCatalogueReader} for where it comes from otherwise. */
46
+ expressions?: any[];
47
+ /** The two key names an `array-of-pairs` row is made of. */
48
+ fields?: string[];
49
+ /** Set for a provider chosen as an FSM variable, which must support an action. */
50
+ isVariable?: boolean;
51
+ /** The declaration a `var-action` is resolved against. Partial because it
52
+ * carries only the provider half — the action supplies the variable half,
53
+ * and the two are merged before the provider validator sees them. */
54
+ variableData?: {
55
+ value?: Partial<TVariableActionValue>;
56
+ };
24
57
  [key: string]: any;
25
58
  }
59
+ /**
60
+ * Where the expression catalogue comes from when a caller does not carry one.
61
+ *
62
+ * Every other rule here is a pure function of the value and its schema, but an
63
+ * expression can only be checked against the catalogue of operations the server
64
+ * publishes — which is application state, fetched once and held in a store. The
65
+ * library must not reach into a consumer's store, so the consumer hands the
66
+ * reader in instead: qorus-ide registers one that reads its expressions store.
67
+ *
68
+ * Unregistered, the catalogue is empty, and `case 'expression'` then validates
69
+ * only what an expression can be judged on by itself (see the ordering there).
70
+ */
71
+ type TExpressionCatalogueReader = () => any[] | undefined;
72
+ export declare const setExpressionCatalogueReader: (reader?: TExpressionCatalogueReader) => void;
26
73
  export declare const _validateField: (type: string, value?: any, field?: IFieldValidationProps, canBeNull?: boolean) => IValidationResult;
27
74
  /**
28
75
  * Read one arg out of a hash, whichever of the two legitimate shapes it is in.
@@ -46,8 +93,44 @@ export declare const validateField: (type: string, value?: any, field?: IFieldVa
46
93
  export declare const maybeParseYaml: (yaml: any) => any;
47
94
  export declare const isValueSet: (value: any, canBeNull?: boolean) => boolean;
48
95
  export declare const getValueOrDefaultValue: (value: any, defaultValue: any, canBeNull?: boolean) => any;
49
- export declare const getTypeFromValue: (value: any) => string;
96
+ /** Deliberately un-annotated: the inferred literal union is what callers assign
97
+ * into their own narrower type aliases, and widening it to `string` breaks
98
+ * them. */
99
+ export declare const getTypeFromValue: (value: any) => "string" | "date" | "list" | "auto" | "int" | "float" | "hash" | "any" | "bool";
50
100
  export declare const validateOptionWithRequiredGroups: (options: TQorusForm, schema: IQorusFormSchema, groups: string[]) => boolean;
101
+ /** Why a required option is not satisfied by the current values. */
102
+ export type TUnresolvedRequiredOptionReason =
103
+ /** No value at all — neither typed, nor defaulted, nor preselected. */
104
+ 'missing'
105
+ /** The option's dependencies are not fulfilled, so its value cannot be final yet. */
106
+ | 'dependency'
107
+ /** A value is present but does not validate against the option's type / schema. */
108
+ | 'invalid';
109
+ export interface IUnresolvedRequiredOption {
110
+ /** The option's key in the schema. */
111
+ name: string;
112
+ reason: TUnresolvedRequiredOptionReason;
113
+ /** The failing validation, present only for the `invalid` reason. */
114
+ validation?: IValidationResult;
115
+ }
116
+ export declare const getUnresolvedRequiredOptionReason: ({ name, reason }: IUnresolvedRequiredOption, optionSchema?: IQorusFormSchema) => string;
117
+ /**
118
+ * List every required option that the given values do not resolve.
119
+ *
120
+ * `required` on an option schema means "the effective configuration must carry
121
+ * this option" — NOT "the user has to type it in". An option whose schema
122
+ * default or preselected value already resolves it needs no user input at all,
123
+ * which is why callers pass values that have been through `fixOptions()`
124
+ * (defaults, preselected values and rich-text default envelopes applied)
125
+ * rather than the raw values the server returned.
126
+ *
127
+ * This is the single owner of the "which required options still need input"
128
+ * question: `validateField('options', …)` uses it for form validity, and
129
+ * qorus-ide's `ConnectionManagementModal` uses it to decide whether a
130
+ * connection can be created — and its OAuth2 flow started — without showing a
131
+ * form at all.
132
+ */
133
+ export declare const getUnresolvedRequiredOptions: (optionSchema?: IQorusFormSchema, options?: TQorusForm) => IUnresolvedRequiredOption[];
51
134
  export declare const hasAllDependenciesFullfilled: (dependencies: string[] | string[][], options: TQorusForm, optionsSchema?: IQorusFormSchema) => boolean;
52
135
  export {};
53
136
  //# sourceMappingURL=validations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../src/helpers/validations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAyB,MAAM,8BAA8B,CAAC;AAenG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,UAAU,qBAAqB;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,0BAA0B,CAAC,EAA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