@flowscripter/dynamic-cli-framework-api 4.0.3 → 4.0.5

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.
@@ -47,6 +47,22 @@ export default interface Argument {
47
47
  * validation error. The error string is associated with
48
48
  * {@link InvalidArgumentReason.CUSTOM_VALIDATION}.
49
49
  *
50
+ * Validators declared on properties nested inside {@link ComplexOption.properties} are also
51
+ * invoked, at any depth:
52
+ *
53
+ * * Validation is bottom-up and depth-first, in `properties` declaration order. A property's
54
+ * validator is invoked after the validators of its own child properties, and only if they all
55
+ * passed. A parent therefore always receives a fully converted and child-validated value.
56
+ * * Validation stops at the first failure, so later validators are not invoked.
57
+ * * For an argument with `isArray`, the validator is invoked once with the whole converted
58
+ * array. For an array of {@link ComplexOption} values, the child property validators are
59
+ * invoked for each element.
60
+ * * An absent nested property with a `defaultValue` is validated using the default value. An
61
+ * absent nested property with `isOptional` and no default is skipped and its validator is not
62
+ * invoked.
63
+ * * A nested failure is reported with the full property path as the invalid argument name,
64
+ * e.g. `opt.sub[2].field`.
65
+ *
50
66
  * Example: ensure array values are unique:
51
67
  * ```typescript
52
68
  * validate: (value) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Argument.d.ts","sourceRoot":"","sources":["../../../src/argument/Argument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1D;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAEpC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;CACvF"}
1
+ {"version":3,"file":"Argument.d.ts","sourceRoot":"","sources":["../../../src/argument/Argument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAE1D;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAEpC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;CACvF"}
@@ -11,6 +11,11 @@ export default interface ComplexOption extends Omit<Option, "type" | "defaultVal
11
11
  readonly type: ComplexValueTypeName;
12
12
  /**
13
13
  * List of child {@link Option} properties.
14
+ *
15
+ * Each property is validated in declaration order, including its own
16
+ * {@link Argument.validate} function if one is defined. Property validators run before the
17
+ * validator of this complex option. A property's `defaultValue` is used when it is absent,
18
+ * and an absent property with `isOptional` is skipped.
14
19
  */
15
20
  readonly properties: ReadonlyArray<Option | ComplexOption>;
16
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ComplexOption.d.ts","sourceRoot":"","sources":["../../../src/argument/ComplexOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhE,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,aAAc,SAAQ,IAAI,CACjD,MAAM,EACN,MAAM,GAAG,cAAc,GAAG,iBAAiB,CAC5C;IACC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CAChD"}
1
+ {"version":3,"file":"ComplexOption.d.ts","sourceRoot":"","sources":["../../../src/argument/ComplexOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhE,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,aAAc,SAAQ,IAAI,CACjD,MAAM,EACN,MAAM,GAAG,cAAc,GAAG,iBAAiB,CAC5C;IACC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAEpC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IAE3D;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;CAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowscripter/dynamic-cli-framework-api",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "API for https://github.com/flowscripter/dynamic-cli-framework",
5
5
  "keywords": [
6
6
  "bun",
@@ -43,7 +43,7 @@
43
43
  "prepare": "tsc -p tsconfig.build.json"
44
44
  },
45
45
  "devDependencies": {
46
- "@flowscripter/dynamic-plugin-framework": "2.2.11",
46
+ "@flowscripter/dynamic-plugin-framework": "2.2.12",
47
47
  "@types/bun": "^1.4.2",
48
48
  "highlight.js": "^11.12.0",
49
49
  "oxfmt": "0.70.0",
@@ -54,6 +54,22 @@ export default interface Argument {
54
54
  * validation error. The error string is associated with
55
55
  * {@link InvalidArgumentReason.CUSTOM_VALIDATION}.
56
56
  *
57
+ * Validators declared on properties nested inside {@link ComplexOption.properties} are also
58
+ * invoked, at any depth:
59
+ *
60
+ * * Validation is bottom-up and depth-first, in `properties` declaration order. A property's
61
+ * validator is invoked after the validators of its own child properties, and only if they all
62
+ * passed. A parent therefore always receives a fully converted and child-validated value.
63
+ * * Validation stops at the first failure, so later validators are not invoked.
64
+ * * For an argument with `isArray`, the validator is invoked once with the whole converted
65
+ * array. For an array of {@link ComplexOption} values, the child property validators are
66
+ * invoked for each element.
67
+ * * An absent nested property with a `defaultValue` is validated using the default value. An
68
+ * absent nested property with `isOptional` and no default is skipped and its validator is not
69
+ * invoked.
70
+ * * A nested failure is reported with the full property path as the invalid argument name,
71
+ * e.g. `opt.sub[2].field`.
72
+ *
57
73
  * Example: ensure array values are unique:
58
74
  * ```typescript
59
75
  * validate: (value) => {
@@ -17,6 +17,11 @@ export default interface ComplexOption extends Omit<
17
17
 
18
18
  /**
19
19
  * List of child {@link Option} properties.
20
+ *
21
+ * Each property is validated in declaration order, including its own
22
+ * {@link Argument.validate} function if one is defined. Property validators run before the
23
+ * validator of this complex option. A property's `defaultValue` is used when it is absent,
24
+ * and an absent property with `isOptional` is skipped.
20
25
  */
21
26
  readonly properties: ReadonlyArray<Option | ComplexOption>;
22
27