@versionzero/schema 1.0.0
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/LICENSE +177 -0
- package/README.md +246 -0
- package/package.json +84 -0
- package/src/compilation/handler-compilation.js +28 -0
- package/src/compilation/metadata-compilation.js +35 -0
- package/src/compilation/schema-compilation.js +142 -0
- package/src/compilation/selection-compilation.js +84 -0
- package/src/compilation/union-compilation.js +510 -0
- package/src/compilation/values-compilation.js +35 -0
- package/src/compiled-schema.js +1709 -0
- package/src/constants.js +1 -0
- package/src/core-library/index.js +32 -0
- package/src/core-library/processors/aggregation-operators.js +75 -0
- package/src/core-library/processors/alpha-constraint.js +20 -0
- package/src/core-library/processors/alphanum-constraint.js +20 -0
- package/src/core-library/processors/array-operator.js +51 -0
- package/src/core-library/processors/assert-constraint.js +75 -0
- package/src/core-library/processors/base64-constraint.js +26 -0
- package/src/core-library/processors/camel-case-operator.js +24 -0
- package/src/core-library/processors/capitalize-operator.js +16 -0
- package/src/core-library/processors/cardnum-constraint.js +193 -0
- package/src/core-library/processors/ceil-operator.js +44 -0
- package/src/core-library/processors/collapse-operator.js +29 -0
- package/src/core-library/processors/compact-operator.js +34 -0
- package/src/core-library/processors/compile-operator.js +65 -0
- package/src/core-library/processors/concat-operator.js +51 -0
- package/src/core-library/processors/conditional-operators.js +301 -0
- package/src/core-library/processors/constant-case-operator.js +16 -0
- package/src/core-library/processors/data-size-operator.js +86 -0
- package/src/core-library/processors/date-object-operator.js +54 -0
- package/src/core-library/processors/date-operator.js +67 -0
- package/src/core-library/processors/date-range-constraint.js +76 -0
- package/src/core-library/processors/defined-constraint.js +30 -0
- package/src/core-library/processors/each-operator.js +57 -0
- package/src/core-library/processors/email-constraint.js +112 -0
- package/src/core-library/processors/entries-operator.js +25 -0
- package/src/core-library/processors/eq-constraint.js +37 -0
- package/src/core-library/processors/filter-operator.js +74 -0
- package/src/core-library/processors/find-schema-operator.js +45 -0
- package/src/core-library/processors/flatten-operator.js +40 -0
- package/src/core-library/processors/floor-operator.js +47 -0
- package/src/core-library/processors/get-operator.js +44 -0
- package/src/core-library/processors/group-by-operator.js +84 -0
- package/src/core-library/processors/has-prefix-constraint.js +37 -0
- package/src/core-library/processors/has-suffix-constraint.js +35 -0
- package/src/core-library/processors/hex-constraint.js +20 -0
- package/src/core-library/processors/hostname-constraint.js +22 -0
- package/src/core-library/processors/http-url-constraint.js +27 -0
- package/src/core-library/processors/in-constraint.js +66 -0
- package/src/core-library/processors/index-by-operator.js +98 -0
- package/src/core-library/processors/index.js +131 -0
- package/src/core-library/processors/input-operator.js +23 -0
- package/src/core-library/processors/instanceof-constraint.js +38 -0
- package/src/core-library/processors/integer-constraint.js +22 -0
- package/src/core-library/processors/invoke-operator.js +33 -0
- package/src/core-library/processors/ipv4-constraint.js +188 -0
- package/src/core-library/processors/ipv6-constraint.js +205 -0
- package/src/core-library/processors/is-array-constraint.js +21 -0
- package/src/core-library/processors/is-date-constraint.js +22 -0
- package/src/core-library/processors/is-number-constraint.js +21 -0
- package/src/core-library/processors/is-object-constraint.js +21 -0
- package/src/core-library/processors/is-string-constraint.js +21 -0
- package/src/core-library/processors/join-operator.js +41 -0
- package/src/core-library/processors/json-constraint.js +22 -0
- package/src/core-library/processors/json-decode-operator.js +25 -0
- package/src/core-library/processors/json-encode-operator.js +35 -0
- package/src/core-library/processors/kebab-case-operator.js +23 -0
- package/src/core-library/processors/keys-operator.js +20 -0
- package/src/core-library/processors/length-constraint.js +85 -0
- package/src/core-library/processors/lookup-operator.js +84 -0
- package/src/core-library/processors/lowercase-operator.js +14 -0
- package/src/core-library/processors/map-operator.js +84 -0
- package/src/core-library/processors/match-operator.js +64 -0
- package/src/core-library/processors/matches-constraint.js +54 -0
- package/src/core-library/processors/math-operators.js +151 -0
- package/src/core-library/processors/merge-deep-operator.js +61 -0
- package/src/core-library/processors/merge-operator.js +54 -0
- package/src/core-library/processors/metadata-operator.js +100 -0
- package/src/core-library/processors/negative-constraint.js +23 -0
- package/src/core-library/processors/never-constraint.js +69 -0
- package/src/core-library/processors/non-empty-constraint.js +59 -0
- package/src/core-library/processors/not-constraint.js +71 -0
- package/src/core-library/processors/number-operator.js +24 -0
- package/src/core-library/processors/numeric-constraint.js +22 -0
- package/src/core-library/processors/object-operator.js +38 -0
- package/src/core-library/processors/omit-operator.js +57 -0
- package/src/core-library/processors/parallel-operator.js +64 -0
- package/src/core-library/processors/pascal-case-operator.js +16 -0
- package/src/core-library/processors/phone-constraint.js +235 -0
- package/src/core-library/processors/pick-operator.js +62 -0
- package/src/core-library/processors/pipeline-operator.js +63 -0
- package/src/core-library/processors/port-constraint.js +22 -0
- package/src/core-library/processors/positive-constraint.js +23 -0
- package/src/core-library/processors/process-operator.js +55 -0
- package/src/core-library/processors/property-operator.js +49 -0
- package/src/core-library/processors/range-constraint.js +72 -0
- package/src/core-library/processors/reference-operator.js +79 -0
- package/src/core-library/processors/require-constraint.js +74 -0
- package/src/core-library/processors/reverse-operator.js +20 -0
- package/src/core-library/processors/round-operator.js +53 -0
- package/src/core-library/processors/schema-handler-operators.js +54 -0
- package/src/core-library/processors/semver-constraint.js +282 -0
- package/src/core-library/processors/sequence-processors.js +406 -0
- package/src/core-library/processors/sort-operator.js +52 -0
- package/src/core-library/processors/split-operator.js +43 -0
- package/src/core-library/processors/string-extra-operators.js +141 -0
- package/src/core-library/processors/string-operator.js +34 -0
- package/src/core-library/processors/target-operator.js +30 -0
- package/src/core-library/processors/template-operator.js +60 -0
- package/src/core-library/processors/title-case-operator.js +17 -0
- package/src/core-library/processors/trim-operator.js +14 -0
- package/src/core-library/processors/truthy-constraint.js +35 -0
- package/src/core-library/processors/type-operator.js +24 -0
- package/src/core-library/processors/unique-operator.js +21 -0
- package/src/core-library/processors/uppercase-operator.js +14 -0
- package/src/core-library/processors/url-constraint.js +31 -0
- package/src/core-library/processors/url-decode-operator.js +50 -0
- package/src/core-library/processors/url-encode-operator.js +44 -0
- package/src/core-library/processors/uuid-constraint.js +31 -0
- package/src/core-library/processors/values-operator.js +20 -0
- package/src/core-library/schemas/any-schema.js +23 -0
- package/src/core-library/schemas/array-schema.js +8 -0
- package/src/core-library/schemas/boolean-schema.js +10 -0
- package/src/core-library/schemas/date-schema.js +12 -0
- package/src/core-library/schemas/function-schema.js +40 -0
- package/src/core-library/schemas/number-schema.js +9 -0
- package/src/core-library/schemas/object-schema.js +10 -0
- package/src/core-library/schemas/root-schema.js +21 -0
- package/src/core-library/schemas/string-schema.js +9 -0
- package/src/core-library-node/index.js +47 -0
- package/src/core-library-node/processors/base64-decode-operator.js +20 -0
- package/src/core-library-node/processors/base64-encode-operator.js +20 -0
- package/src/core-library-node/processors/buffer-operator.js +39 -0
- package/src/core-library-node/processors/directory-constraint.js +35 -0
- package/src/core-library-node/processors/executable-constraint.js +34 -0
- package/src/core-library-node/processors/file-constraint.js +34 -0
- package/src/core-library-node/processors/file-size-constraint.js +94 -0
- package/src/core-library-node/processors/is-buffer-constraint.js +21 -0
- package/src/core-library-node/processors/reachable-constraint.js +28 -0
- package/src/core-library-node/processors/readable-constraint.js +34 -0
- package/src/core-library-node/processors/writable-constraint.js +59 -0
- package/src/core-library-node/schemas/buffer-schema.js +10 -0
- package/src/errors.js +209 -0
- package/src/executor/array-executor.js +78 -0
- package/src/executor/conditional-executor.js +134 -0
- package/src/executor/each-executor.js +68 -0
- package/src/executor/executor.js +123 -0
- package/src/executor/object-executor.js +98 -0
- package/src/executor/parallel-executor.js +43 -0
- package/src/executor/pipeline-executor.js +65 -0
- package/src/executor/sequence-executor.js +206 -0
- package/src/executor/serial-executor.js +24 -0
- package/src/executor/step-executor.js +68 -0
- package/src/helpers/case.js +124 -0
- package/src/helpers/data-size.js +144 -0
- package/src/helpers/debug-sink.js +15 -0
- package/src/helpers/deep.js +280 -0
- package/src/helpers/format.js +121 -0
- package/src/helpers/has-string-properties.js +30 -0
- package/src/helpers/index.js +16 -0
- package/src/helpers/object.js +115 -0
- package/src/helpers/parse-date.js +75 -0
- package/src/helpers/path.js +28 -0
- package/src/helpers/regex.js +18 -0
- package/src/helpers/stringify.js +309 -0
- package/src/helpers/to-data.js +64 -0
- package/src/helpers/truthy.js +55 -0
- package/src/index.js +29 -0
- package/src/schema-compiler.js +531 -0
- package/src/schema-location.js +200 -0
- package/src/schema-resolver.js +546 -0
- package/src/schema.js +1182 -0
- package/src/traversal/executors/check-condition.js +42 -0
- package/src/traversal/executors/check-input.js +27 -0
- package/src/traversal/executors/check-required.js +19 -0
- package/src/traversal/executors/check-schema.js +45 -0
- package/src/traversal/executors/defaults.js +21 -0
- package/src/traversal/executors/enter-existing.js +25 -0
- package/src/traversal/executors/enter-input.js +25 -0
- package/src/traversal/executors/enter.js +37 -0
- package/src/traversal/executors/exit.js +74 -0
- package/src/traversal/executors/finalize.js +64 -0
- package/src/traversal/executors/index.js +42 -0
- package/src/traversal/executors/normalize.js +38 -0
- package/src/traversal/executors/prepare-existing.js +27 -0
- package/src/traversal/executors/prepare-pending.js +54 -0
- package/src/traversal/executors/resolve-union.js +50 -0
- package/src/traversal/executors/serialize.js +48 -0
- package/src/traversal/executors/transform-early.js +51 -0
- package/src/traversal/executors/transform.js +68 -0
- package/src/traversal/executors/traversal-state-executor.js +46 -0
- package/src/traversal/executors/validate.js +63 -0
- package/src/traversal/traversal-context.js +231 -0
- package/src/traversal/traversal-state.js +809 -0
- package/src/types.js +102 -0
- package/src/value-processor/composed-value-processor.js +43 -0
- package/src/value-processor/defined-value-processor.js +72 -0
- package/src/value-processor/function-value-processor.js +68 -0
- package/src/value-processor/parameterized-value-processor.js +45 -0
- package/src/value-processor/parameters-value-processor.js +178 -0
- package/src/value-processor/spec.js +89 -0
- package/src/value-processor/value-processor.js +105 -0
- package/types/compilation/handler-compilation.d.ts +13 -0
- package/types/compilation/metadata-compilation.d.ts +6 -0
- package/types/compilation/schema-compilation.d.ts +32 -0
- package/types/compilation/selection-compilation.d.ts +9 -0
- package/types/compilation/union-compilation.d.ts +42 -0
- package/types/compilation/values-compilation.d.ts +12 -0
- package/types/compiled-schema.d.ts +883 -0
- package/types/constants.d.ts +1 -0
- package/types/core-library/index.d.ts +7 -0
- package/types/core-library/processors/aggregation-operators.d.ts +24 -0
- package/types/core-library/processors/alpha-constraint.d.ts +9 -0
- package/types/core-library/processors/alphanum-constraint.d.ts +9 -0
- package/types/core-library/processors/array-operator.d.ts +12 -0
- package/types/core-library/processors/assert-constraint.d.ts +30 -0
- package/types/core-library/processors/base64-constraint.d.ts +11 -0
- package/types/core-library/processors/camel-case-operator.d.ts +17 -0
- package/types/core-library/processors/capitalize-operator.d.ts +11 -0
- package/types/core-library/processors/cardnum-constraint.d.ts +51 -0
- package/types/core-library/processors/ceil-operator.d.ts +30 -0
- package/types/core-library/processors/collapse-operator.d.ts +24 -0
- package/types/core-library/processors/compact-operator.d.ts +29 -0
- package/types/core-library/processors/compile-operator.d.ts +34 -0
- package/types/core-library/processors/concat-operator.d.ts +23 -0
- package/types/core-library/processors/conditional-operators.d.ts +219 -0
- package/types/core-library/processors/constant-case-operator.d.ts +9 -0
- package/types/core-library/processors/data-size-operator.d.ts +31 -0
- package/types/core-library/processors/date-object-operator.d.ts +16 -0
- package/types/core-library/processors/date-operator.d.ts +21 -0
- package/types/core-library/processors/date-range-constraint.d.ts +26 -0
- package/types/core-library/processors/defined-constraint.d.ts +20 -0
- package/types/core-library/processors/each-operator.d.ts +34 -0
- package/types/core-library/processors/email-constraint.d.ts +54 -0
- package/types/core-library/processors/entries-operator.d.ts +13 -0
- package/types/core-library/processors/eq-constraint.d.ts +20 -0
- package/types/core-library/processors/filter-operator.d.ts +35 -0
- package/types/core-library/processors/find-schema-operator.d.ts +28 -0
- package/types/core-library/processors/flatten-operator.d.ts +26 -0
- package/types/core-library/processors/floor-operator.d.ts +33 -0
- package/types/core-library/processors/get-operator.d.ts +31 -0
- package/types/core-library/processors/group-by-operator.d.ts +36 -0
- package/types/core-library/processors/has-prefix-constraint.d.ts +22 -0
- package/types/core-library/processors/has-suffix-constraint.d.ts +20 -0
- package/types/core-library/processors/hex-constraint.d.ts +9 -0
- package/types/core-library/processors/hostname-constraint.d.ts +11 -0
- package/types/core-library/processors/http-url-constraint.d.ts +9 -0
- package/types/core-library/processors/in-constraint.d.ts +27 -0
- package/types/core-library/processors/index-by-operator.d.ts +26 -0
- package/types/core-library/processors/index.d.ts +8 -0
- package/types/core-library/processors/input-operator.d.ts +20 -0
- package/types/core-library/processors/instanceof-constraint.d.ts +23 -0
- package/types/core-library/processors/integer-constraint.d.ts +9 -0
- package/types/core-library/processors/invoke-operator.d.ts +12 -0
- package/types/core-library/processors/ipv4-constraint.d.ts +37 -0
- package/types/core-library/processors/ipv6-constraint.d.ts +34 -0
- package/types/core-library/processors/is-array-constraint.d.ts +10 -0
- package/types/core-library/processors/is-date-constraint.d.ts +10 -0
- package/types/core-library/processors/is-number-constraint.d.ts +10 -0
- package/types/core-library/processors/is-object-constraint.d.ts +10 -0
- package/types/core-library/processors/is-string-constraint.d.ts +10 -0
- package/types/core-library/processors/join-operator.d.ts +29 -0
- package/types/core-library/processors/json-constraint.d.ts +10 -0
- package/types/core-library/processors/json-decode-operator.d.ts +9 -0
- package/types/core-library/processors/json-encode-operator.d.ts +27 -0
- package/types/core-library/processors/kebab-case-operator.d.ts +16 -0
- package/types/core-library/processors/keys-operator.d.ts +9 -0
- package/types/core-library/processors/length-constraint.d.ts +34 -0
- package/types/core-library/processors/lookup-operator.d.ts +36 -0
- package/types/core-library/processors/lowercase-operator.d.ts +9 -0
- package/types/core-library/processors/map-operator.d.ts +38 -0
- package/types/core-library/processors/match-operator.d.ts +34 -0
- package/types/core-library/processors/matches-constraint.d.ts +29 -0
- package/types/core-library/processors/math-operators.d.ts +91 -0
- package/types/core-library/processors/merge-deep-operator.d.ts +32 -0
- package/types/core-library/processors/merge-operator.d.ts +26 -0
- package/types/core-library/processors/metadata-operator.d.ts +56 -0
- package/types/core-library/processors/negative-constraint.d.ts +13 -0
- package/types/core-library/processors/never-constraint.d.ts +26 -0
- package/types/core-library/processors/non-empty-constraint.d.ts +28 -0
- package/types/core-library/processors/not-constraint.d.ts +28 -0
- package/types/core-library/processors/number-operator.d.ts +9 -0
- package/types/core-library/processors/numeric-constraint.d.ts +10 -0
- package/types/core-library/processors/object-operator.d.ts +10 -0
- package/types/core-library/processors/omit-operator.d.ts +24 -0
- package/types/core-library/processors/parallel-operator.d.ts +41 -0
- package/types/core-library/processors/pascal-case-operator.d.ts +9 -0
- package/types/core-library/processors/phone-constraint.d.ts +65 -0
- package/types/core-library/processors/pick-operator.d.ts +27 -0
- package/types/core-library/processors/pipeline-operator.d.ts +40 -0
- package/types/core-library/processors/port-constraint.d.ts +11 -0
- package/types/core-library/processors/positive-constraint.d.ts +13 -0
- package/types/core-library/processors/process-operator.d.ts +37 -0
- package/types/core-library/processors/property-operator.d.ts +34 -0
- package/types/core-library/processors/range-constraint.d.ts +30 -0
- package/types/core-library/processors/reference-operator.d.ts +38 -0
- package/types/core-library/processors/require-constraint.d.ts +29 -0
- package/types/core-library/processors/reverse-operator.d.ts +9 -0
- package/types/core-library/processors/round-operator.d.ts +34 -0
- package/types/core-library/processors/schema-handler-operators.d.ts +28 -0
- package/types/core-library/processors/semver-constraint.d.ts +43 -0
- package/types/core-library/processors/sequence-processors.d.ts +213 -0
- package/types/core-library/processors/sort-operator.d.ts +31 -0
- package/types/core-library/processors/split-operator.d.ts +33 -0
- package/types/core-library/processors/string-extra-operators.d.ts +83 -0
- package/types/core-library/processors/string-operator.d.ts +10 -0
- package/types/core-library/processors/target-operator.d.ts +27 -0
- package/types/core-library/processors/template-operator.d.ts +31 -0
- package/types/core-library/processors/title-case-operator.d.ts +12 -0
- package/types/core-library/processors/trim-operator.d.ts +9 -0
- package/types/core-library/processors/truthy-constraint.d.ts +23 -0
- package/types/core-library/processors/type-operator.d.ts +11 -0
- package/types/core-library/processors/unique-operator.d.ts +10 -0
- package/types/core-library/processors/uppercase-operator.d.ts +9 -0
- package/types/core-library/processors/url-constraint.d.ts +20 -0
- package/types/core-library/processors/url-decode-operator.d.ts +31 -0
- package/types/core-library/processors/url-encode-operator.d.ts +36 -0
- package/types/core-library/processors/uuid-constraint.d.ts +20 -0
- package/types/core-library/processors/values-operator.d.ts +9 -0
- package/types/core-library/schemas/any-schema.d.ts +2 -0
- package/types/core-library/schemas/array-schema.d.ts +2 -0
- package/types/core-library/schemas/boolean-schema.d.ts +2 -0
- package/types/core-library/schemas/date-schema.d.ts +2 -0
- package/types/core-library/schemas/function-schema.d.ts +2 -0
- package/types/core-library/schemas/number-schema.d.ts +2 -0
- package/types/core-library/schemas/object-schema.d.ts +2 -0
- package/types/core-library/schemas/root-schema.d.ts +2 -0
- package/types/core-library/schemas/string-schema.d.ts +2 -0
- package/types/core-library-node/index.d.ts +12 -0
- package/types/core-library-node/processors/base64-decode-operator.d.ts +9 -0
- package/types/core-library-node/processors/base64-encode-operator.d.ts +9 -0
- package/types/core-library-node/processors/buffer-operator.d.ts +15 -0
- package/types/core-library-node/processors/directory-constraint.d.ts +14 -0
- package/types/core-library-node/processors/executable-constraint.d.ts +17 -0
- package/types/core-library-node/processors/file-constraint.d.ts +13 -0
- package/types/core-library-node/processors/file-size-constraint.d.ts +43 -0
- package/types/core-library-node/processors/is-buffer-constraint.d.ts +10 -0
- package/types/core-library-node/processors/reachable-constraint.d.ts +13 -0
- package/types/core-library-node/processors/readable-constraint.d.ts +17 -0
- package/types/core-library-node/processors/writable-constraint.d.ts +18 -0
- package/types/core-library-node/schemas/buffer-schema.d.ts +2 -0
- package/types/errors.d.ts +58 -0
- package/types/executor/array-executor.d.ts +17 -0
- package/types/executor/conditional-executor.d.ts +45 -0
- package/types/executor/each-executor.d.ts +15 -0
- package/types/executor/executor.d.ts +84 -0
- package/types/executor/object-executor.d.ts +14 -0
- package/types/executor/parallel-executor.d.ts +27 -0
- package/types/executor/pipeline-executor.d.ts +11 -0
- package/types/executor/sequence-executor.d.ts +32 -0
- package/types/executor/serial-executor.d.ts +16 -0
- package/types/executor/step-executor.d.ts +14 -0
- package/types/helpers/case.d.ts +30 -0
- package/types/helpers/data-size.d.ts +25 -0
- package/types/helpers/debug-sink.d.ts +9 -0
- package/types/helpers/deep.d.ts +33 -0
- package/types/helpers/format.d.ts +14 -0
- package/types/helpers/has-string-properties.d.ts +5 -0
- package/types/helpers/index.d.ts +13 -0
- package/types/helpers/object.d.ts +46 -0
- package/types/helpers/parse-date.d.ts +6 -0
- package/types/helpers/path.d.ts +13 -0
- package/types/helpers/regex.d.ts +7 -0
- package/types/helpers/stringify.d.ts +33 -0
- package/types/helpers/to-data.d.ts +13 -0
- package/types/helpers/truthy.d.ts +26 -0
- package/types/index.d.ts +6 -0
- package/types/schema-compiler.d.ts +49 -0
- package/types/schema-location.d.ts +64 -0
- package/types/schema-resolver.d.ts +145 -0
- package/types/schema.d.ts +586 -0
- package/types/traversal/executors/check-condition.d.ts +8 -0
- package/types/traversal/executors/check-input.d.ts +6 -0
- package/types/traversal/executors/check-required.d.ts +6 -0
- package/types/traversal/executors/check-schema.d.ts +7 -0
- package/types/traversal/executors/defaults.d.ts +8 -0
- package/types/traversal/executors/enter-existing.d.ts +6 -0
- package/types/traversal/executors/enter-input.d.ts +8 -0
- package/types/traversal/executors/enter.d.ts +7 -0
- package/types/traversal/executors/exit.d.ts +6 -0
- package/types/traversal/executors/finalize.d.ts +6 -0
- package/types/traversal/executors/index.d.ts +15 -0
- package/types/traversal/executors/normalize.d.ts +7 -0
- package/types/traversal/executors/prepare-existing.d.ts +6 -0
- package/types/traversal/executors/prepare-pending.d.ts +6 -0
- package/types/traversal/executors/resolve-union.d.ts +6 -0
- package/types/traversal/executors/serialize.d.ts +11 -0
- package/types/traversal/executors/transform-early.d.ts +6 -0
- package/types/traversal/executors/transform.d.ts +6 -0
- package/types/traversal/executors/traversal-state-executor.d.ts +19 -0
- package/types/traversal/executors/validate.d.ts +6 -0
- package/types/traversal/traversal-context.d.ts +67 -0
- package/types/traversal/traversal-state.d.ts +97 -0
- package/types/types.d.ts +218 -0
- package/types/value-processor/composed-value-processor.d.ts +17 -0
- package/types/value-processor/defined-value-processor.d.ts +16 -0
- package/types/value-processor/function-value-processor.d.ts +15 -0
- package/types/value-processor/parameterized-value-processor.d.ts +14 -0
- package/types/value-processor/parameters-value-processor.d.ts +28 -0
- package/types/value-processor/spec.d.ts +22 -0
- package/types/value-processor/value-processor.d.ts +92 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize the assigned input value
|
|
3
|
+
* @param {TraversalState} state
|
|
4
|
+
* @returns {TraversalState|null|undefined|Promise<TraversalState|null|undefined>}
|
|
5
|
+
*/
|
|
6
|
+
export function normalize(state: TraversalState): TraversalState | null | undefined | Promise<TraversalState | null | undefined>;
|
|
7
|
+
import { TraversalState } from '../traversal-state.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {TraversalState} state
|
|
3
|
+
* @returns {TraversalState|undefined|null|Promise<TraversalState|undefined|null>}
|
|
4
|
+
*/
|
|
5
|
+
export function preparePending(state: TraversalState): TraversalState | undefined | null | Promise<TraversalState | undefined | null>;
|
|
6
|
+
import { TraversalState } from '../traversal-state.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {TraversalState} state
|
|
3
|
+
* @returns {TraversalState|null|undefined|Promise<TraversalState|null|undefined>}
|
|
4
|
+
*/
|
|
5
|
+
export function resolveUnion(state: TraversalState): TraversalState | null | undefined | Promise<TraversalState | null | undefined>;
|
|
6
|
+
import { TraversalState } from '../traversal-state.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize the pending/input and save as output state value
|
|
3
|
+
*
|
|
4
|
+
* Runs pre-child-traversal; acts in the same way that normalize does.
|
|
5
|
+
* Setting the input will propagate down to assigned values in the child states.
|
|
6
|
+
*
|
|
7
|
+
* @param {TraversalState} state
|
|
8
|
+
* @returns {TraversalState|null|undefined|Promise<TraversalState|null|undefined>}
|
|
9
|
+
*/
|
|
10
|
+
export function serialize(state: TraversalState): TraversalState | null | undefined | Promise<TraversalState | null | undefined>;
|
|
11
|
+
import { TraversalState } from '../traversal-state.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {TraversalState} state
|
|
3
|
+
* @returns {TraversalState|null|undefined|Promise<TraversalState|null|undefined>}
|
|
4
|
+
*/
|
|
5
|
+
export function transformEarly(state: TraversalState): TraversalState | null | undefined | Promise<TraversalState | null | undefined>;
|
|
6
|
+
import { TraversalState } from '../traversal-state.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {TraversalState} state
|
|
3
|
+
* @returns {TraversalState|null|undefined|Promise<TraversalState|null|undefined>}
|
|
4
|
+
*/
|
|
5
|
+
export function transform(state: TraversalState): TraversalState | null | undefined | Promise<TraversalState | null | undefined>;
|
|
6
|
+
import { TraversalState } from '../traversal-state.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @augments Executor<TraversalState>
|
|
3
|
+
*/
|
|
4
|
+
export class TraversalStateExecutor extends Executor<TraversalState> {
|
|
5
|
+
/**
|
|
6
|
+
* @param {any} enter
|
|
7
|
+
* @param {any} exit
|
|
8
|
+
*/
|
|
9
|
+
constructor(enter: any, exit: any);
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {TraversalState} state
|
|
13
|
+
* @returns {TraversalState|null|undefined|Promise<TraversalState|null|undefined>}
|
|
14
|
+
*/
|
|
15
|
+
execute(state: TraversalState): TraversalState | null | undefined | Promise<TraversalState | null | undefined>;
|
|
16
|
+
#private;
|
|
17
|
+
}
|
|
18
|
+
import { TraversalState } from '../traversal-state.js';
|
|
19
|
+
import { Executor } from '../../executor/executor.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} TraversalContextStandardOptions
|
|
3
|
+
* @property {boolean} [strict]
|
|
4
|
+
* @property {boolean} [deep]
|
|
5
|
+
* @property {boolean} [debug]
|
|
6
|
+
*/
|
|
7
|
+
/** @typedef {TraversalContextStandardOptions & {[key:string]:any}} TraversalContextOptions */
|
|
8
|
+
export class TraversalContext {
|
|
9
|
+
/**
|
|
10
|
+
* @param {SchemaLocation|CompiledSchema} root
|
|
11
|
+
* @param {TraversalContextOptions} [options]
|
|
12
|
+
*/
|
|
13
|
+
constructor(root: SchemaLocation | CompiledSchema, options?: TraversalContextOptions);
|
|
14
|
+
root: SchemaLocation;
|
|
15
|
+
_final: boolean;
|
|
16
|
+
_options: {
|
|
17
|
+
deep: boolean;
|
|
18
|
+
strict: boolean;
|
|
19
|
+
debug: boolean;
|
|
20
|
+
};
|
|
21
|
+
traversals: number;
|
|
22
|
+
counter: number;
|
|
23
|
+
/** @type {Map.<string,TraversalState>} */
|
|
24
|
+
stateMap: Map<string, TraversalState>;
|
|
25
|
+
_debugEnabled: boolean;
|
|
26
|
+
compiling: boolean;
|
|
27
|
+
get options(): {
|
|
28
|
+
deep: boolean;
|
|
29
|
+
strict: boolean;
|
|
30
|
+
debug: boolean;
|
|
31
|
+
};
|
|
32
|
+
get deep(): boolean;
|
|
33
|
+
get strict(): boolean;
|
|
34
|
+
update(): void;
|
|
35
|
+
set final(finalize: boolean);
|
|
36
|
+
get final(): boolean;
|
|
37
|
+
_finalizeCount: number;
|
|
38
|
+
finalize(): this;
|
|
39
|
+
get isComplete(): boolean;
|
|
40
|
+
get incomplete(): Set<any>;
|
|
41
|
+
setValue(value: any): void;
|
|
42
|
+
_value: any;
|
|
43
|
+
getValue(): any;
|
|
44
|
+
/**
|
|
45
|
+
* @param {any} input
|
|
46
|
+
* @param {string} [path]
|
|
47
|
+
*/
|
|
48
|
+
setAssignedInput(input: any, path?: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* @param {string|SchemaLocation} path
|
|
51
|
+
* @returns {TraversalState}
|
|
52
|
+
*/
|
|
53
|
+
getState(path: string | SchemaLocation): TraversalState;
|
|
54
|
+
_debug(...args: any[]): void;
|
|
55
|
+
traverse(executor: any): any;
|
|
56
|
+
}
|
|
57
|
+
export type TraversalContextStandardOptions = {
|
|
58
|
+
strict?: boolean | undefined;
|
|
59
|
+
deep?: boolean | undefined;
|
|
60
|
+
debug?: boolean | undefined;
|
|
61
|
+
};
|
|
62
|
+
export type TraversalContextOptions = TraversalContextStandardOptions & {
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
};
|
|
65
|
+
import { SchemaLocation } from '../schema-location.js';
|
|
66
|
+
import { TraversalState } from './traversal-state.js';
|
|
67
|
+
import { CompiledSchema } from "../compiled-schema.js";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export class TraversalState {
|
|
2
|
+
/**
|
|
3
|
+
* @param {TraversalContext} context
|
|
4
|
+
* @param {string} path
|
|
5
|
+
*/
|
|
6
|
+
constructor(context: TraversalContext, path: string);
|
|
7
|
+
/** @type {{[key:string]:Executor}} */
|
|
8
|
+
executorCache: {
|
|
9
|
+
[key: string]: Executor<any>;
|
|
10
|
+
};
|
|
11
|
+
set completed(value: boolean);
|
|
12
|
+
get completed(): boolean;
|
|
13
|
+
get context(): TraversalContext;
|
|
14
|
+
get parent(): TraversalState | undefined;
|
|
15
|
+
get path(): string;
|
|
16
|
+
get name(): string;
|
|
17
|
+
get key(): string | number;
|
|
18
|
+
set location(location: SchemaLocation | undefined);
|
|
19
|
+
/** @type {SchemaLocation|undefined} */
|
|
20
|
+
get location(): SchemaLocation | undefined;
|
|
21
|
+
set schema(schema: CompiledSchema | undefined);
|
|
22
|
+
/** @type {CompiledSchema|undefined} */
|
|
23
|
+
get schema(): CompiledSchema | undefined;
|
|
24
|
+
set unionKey(key: string | undefined);
|
|
25
|
+
/** @type {string|undefined} */
|
|
26
|
+
get unionKey(): string | undefined;
|
|
27
|
+
set condition(condition: boolean | undefined);
|
|
28
|
+
/** @type {boolean|undefined} */
|
|
29
|
+
get condition(): boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} propertyName
|
|
32
|
+
* @returns {TraversalState}
|
|
33
|
+
*/
|
|
34
|
+
getChildState(propertyName: string): TraversalState;
|
|
35
|
+
getRelativeState(path: any): TraversalState | undefined;
|
|
36
|
+
set assignedInput(assignedInput: any);
|
|
37
|
+
get assignedInput(): any;
|
|
38
|
+
set value(value: any);
|
|
39
|
+
get value(): any;
|
|
40
|
+
set processed(value: boolean);
|
|
41
|
+
get processed(): boolean;
|
|
42
|
+
set input(input: any);
|
|
43
|
+
get input(): any;
|
|
44
|
+
set mandatory(value: boolean);
|
|
45
|
+
get mandatory(): boolean;
|
|
46
|
+
set pending(pending: any);
|
|
47
|
+
get pending(): any;
|
|
48
|
+
/**
|
|
49
|
+
* Sometimes transformers get called with a populated pending object. If the transformed object isn't opaque,
|
|
50
|
+
* we can do a selective shallow copy over to the transformed object.
|
|
51
|
+
* @param {any} pending
|
|
52
|
+
* @param {any} value
|
|
53
|
+
* @package
|
|
54
|
+
*/
|
|
55
|
+
copyPendingChildValues(pending: any, value: any): void;
|
|
56
|
+
invalidate(): void;
|
|
57
|
+
get isRequired(): boolean;
|
|
58
|
+
/** @type {boolean} */
|
|
59
|
+
get isComplete(): boolean;
|
|
60
|
+
get hasProcessedInput(): boolean;
|
|
61
|
+
get isPlaceholder(): boolean;
|
|
62
|
+
get hasChildren(): boolean;
|
|
63
|
+
get isContainer(): boolean;
|
|
64
|
+
get isPruned(): any;
|
|
65
|
+
get isDeep(): boolean;
|
|
66
|
+
get isOpaque(): boolean;
|
|
67
|
+
get isIncremental(): boolean;
|
|
68
|
+
get isStrict(): any;
|
|
69
|
+
get allowUnknown(): boolean;
|
|
70
|
+
get isUnion(): boolean;
|
|
71
|
+
get isUnresolved(): boolean;
|
|
72
|
+
get treatAsExplicit(): boolean;
|
|
73
|
+
get hasDescendentStates(): boolean;
|
|
74
|
+
get hasDescendentsToTraverse(): boolean;
|
|
75
|
+
get hasIncompleteDescendents(): boolean;
|
|
76
|
+
get incompleteDescendents(): TraversalState[];
|
|
77
|
+
findIncompleteChildNames(incomplete?: Set<any>): Set<any>;
|
|
78
|
+
listIncompleteChildren(): string[];
|
|
79
|
+
listPendingChildren(): string[];
|
|
80
|
+
invalidateChildren(): void;
|
|
81
|
+
get isEmptyPlaceholder(): boolean;
|
|
82
|
+
get needsInputProcessing(): boolean;
|
|
83
|
+
get hasWorkInProgress(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieve all incomplete child property states
|
|
86
|
+
*
|
|
87
|
+
* @type {Array<TraversalState>}
|
|
88
|
+
*/
|
|
89
|
+
get activePropertyStates(): Array<TraversalState>;
|
|
90
|
+
get target(): any;
|
|
91
|
+
get options(): any;
|
|
92
|
+
#private;
|
|
93
|
+
}
|
|
94
|
+
import { Executor } from "../executor/executor.js";
|
|
95
|
+
import { TraversalContext } from './traversal-context.js';
|
|
96
|
+
import { SchemaLocation } from '../schema-location.js';
|
|
97
|
+
import { CompiledSchema } from '../compiled-schema.js';
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
export type ISchema = {
|
|
2
|
+
/**
|
|
3
|
+
* - Base schema name for extension
|
|
4
|
+
*/
|
|
5
|
+
base?: string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* - Schema properties
|
|
8
|
+
*/
|
|
9
|
+
properties: ISchemaProperties;
|
|
10
|
+
/**
|
|
11
|
+
* - Schema options
|
|
12
|
+
*/
|
|
13
|
+
options: ISchemaOptions;
|
|
14
|
+
/**
|
|
15
|
+
* - Schema metadata
|
|
16
|
+
*/
|
|
17
|
+
metadata: ISchemaMetadata;
|
|
18
|
+
/**
|
|
19
|
+
* - Schema handlers
|
|
20
|
+
*/
|
|
21
|
+
handlers: ISchemaHandlers;
|
|
22
|
+
/**
|
|
23
|
+
* - Union schema definitions
|
|
24
|
+
*/
|
|
25
|
+
unionSchemas: ISchemaUnion;
|
|
26
|
+
/**
|
|
27
|
+
* - Serialize schema to plain object
|
|
28
|
+
*/
|
|
29
|
+
toData: (schema: ISchema) => SchemaData | undefined;
|
|
30
|
+
};
|
|
31
|
+
export type ISchemaMetadataCommon = {
|
|
32
|
+
/**
|
|
33
|
+
* - help text description of the property; used by CommandLineSource
|
|
34
|
+
*/
|
|
35
|
+
description?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* - help text type name of the property value; used by CommandLineSource
|
|
38
|
+
*/
|
|
39
|
+
valueName?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* - help text description of the property value; used by CommandLineSource
|
|
42
|
+
*/
|
|
43
|
+
valueDescription?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* - request a specific flag character; used by CommandLineSource
|
|
46
|
+
*/
|
|
47
|
+
flagHint?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* - filter from basic help text; used by CommandLineSource
|
|
50
|
+
*/
|
|
51
|
+
advanced?: boolean | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* - hide from help; used by CommandLineSource
|
|
54
|
+
*/
|
|
55
|
+
hidden?: boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* - mark this field for CommandLineSource to be used without a flag or option
|
|
58
|
+
*/
|
|
59
|
+
general?: boolean | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* - set to base/primitive types to help source parsers interpret values
|
|
62
|
+
*/
|
|
63
|
+
parserTypeHint?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* - set to true to omit this schema's value when serializing
|
|
66
|
+
*/
|
|
67
|
+
omitFromSerialize?: boolean | undefined;
|
|
68
|
+
};
|
|
69
|
+
export type ISchemaMetadata = ISchemaMetadataCommon & {
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
};
|
|
72
|
+
export type SchemaFundamentalType = "any" | "string" | "number" | "boolean" | "bigint" | "symbol" | "object" | "array" | "function" | "buffer" | "null";
|
|
73
|
+
export type ISchemaOptionsCommon = {
|
|
74
|
+
/**
|
|
75
|
+
* - should only be set on the core types supported by the schema
|
|
76
|
+
*/
|
|
77
|
+
type?: SchemaFundamentalType | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* - a function called during schema compilation
|
|
80
|
+
*/
|
|
81
|
+
compileHook?: ((arg0: string, arg1: ISchema) => void) | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* - whether an array type or string type can be empty
|
|
84
|
+
*/
|
|
85
|
+
allowEmpty?: boolean | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* - whether undefined values can be passed through this schema
|
|
88
|
+
*/
|
|
89
|
+
allowUndefined?: boolean | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* - whether to throw when a processor returns an Error, or treat it as a legal value
|
|
92
|
+
*/
|
|
93
|
+
allowErrors?: boolean | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* - when true, values are advisory (for expansion/metadata) and do not gate ensureAccepts
|
|
96
|
+
*/
|
|
97
|
+
allowUnknownValues?: boolean | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* - whether to do strict typechecking (defaults to true; must be explicitly false to be "lax")
|
|
100
|
+
*/
|
|
101
|
+
strict?: boolean | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* - disallow direct assignment; value will be inherited from a parent
|
|
104
|
+
*/
|
|
105
|
+
reference?: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* - flag indicating whether this field is required
|
|
108
|
+
*/
|
|
109
|
+
required?: boolean | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* - flag indicating that this field always returns the option value
|
|
112
|
+
*/
|
|
113
|
+
literal?: boolean | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* - flag indicating that this field exists implicitly in the post-transform value
|
|
116
|
+
*/
|
|
117
|
+
implicit?: boolean | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* - true/undefined means treat functional values as dynamic lookups; false means treat functions as values
|
|
120
|
+
*/
|
|
121
|
+
dynamic?: boolean | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* - triggers value to be copied to the context field with this name
|
|
124
|
+
*/
|
|
125
|
+
context?: string | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* - default value
|
|
128
|
+
*/
|
|
129
|
+
default?: any;
|
|
130
|
+
/**
|
|
131
|
+
* - list of legal input values for this field (each is normalized during compilation)
|
|
132
|
+
*/
|
|
133
|
+
values?: any[] | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* - true if this schema acts as a selector
|
|
136
|
+
*/
|
|
137
|
+
selector?: boolean | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* - this schema activates if the selector matches the value, or matches this prop name if true
|
|
140
|
+
*/
|
|
141
|
+
selection?: string | boolean | undefined;
|
|
142
|
+
};
|
|
143
|
+
export type ISchemaOptions = ISchemaOptionsCommon & {
|
|
144
|
+
[key: string]: any;
|
|
145
|
+
};
|
|
146
|
+
export type ISchemaHandlers = {
|
|
147
|
+
normalizers?: any[] | undefined;
|
|
148
|
+
conditions?: any[] | undefined;
|
|
149
|
+
transformers?: any[] | undefined;
|
|
150
|
+
serializers?: any[] | undefined;
|
|
151
|
+
unionDiscriminator?: ValueProcessorSpec;
|
|
152
|
+
};
|
|
153
|
+
export type ISchemaMetadataAttributesCommon = {
|
|
154
|
+
/**
|
|
155
|
+
* - help text description of the property; used by CommandLineSource
|
|
156
|
+
*/
|
|
157
|
+
_description?: string | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* - help text type name of the property value; used by CommandLineSource
|
|
160
|
+
*/
|
|
161
|
+
_valueName?: string | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* - help text description of the property value; used by CommandLineSource
|
|
164
|
+
*/
|
|
165
|
+
_valueDescription?: string | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* - request a specific flag character; used by CommandLineSource
|
|
168
|
+
*/
|
|
169
|
+
_flagHint?: string | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* - filter from basic help text; used by CommandLineSource
|
|
172
|
+
*/
|
|
173
|
+
_advanced?: boolean | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* - hide from help; used by CommandLineSource
|
|
176
|
+
*/
|
|
177
|
+
_hidden?: boolean | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* - mark this field for CommandLineSource to be used without a flag or option
|
|
180
|
+
*/
|
|
181
|
+
_general?: boolean | undefined;
|
|
182
|
+
/**
|
|
183
|
+
* - set to base/primitive types to help source parsers interpret values
|
|
184
|
+
*/
|
|
185
|
+
_parserTypeHint?: string | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* - set to true to omit this schema's value when serializing
|
|
188
|
+
*/
|
|
189
|
+
_omitFromSerialize?: boolean | undefined;
|
|
190
|
+
};
|
|
191
|
+
export type ISchemaAttributes = ISchemaOptionsCommon & ISchemaMetadataAttributesCommon & {
|
|
192
|
+
[key: string]: any;
|
|
193
|
+
};
|
|
194
|
+
export type ISchemaProperties = {
|
|
195
|
+
[key: string]: ISchema;
|
|
196
|
+
};
|
|
197
|
+
export type ISchemaUnion = {
|
|
198
|
+
[key: string]: ISchema;
|
|
199
|
+
};
|
|
200
|
+
export type SchemaData = {
|
|
201
|
+
base?: string | undefined;
|
|
202
|
+
properties?: {
|
|
203
|
+
[key: string]: SchemaData;
|
|
204
|
+
} | undefined;
|
|
205
|
+
handlers?: {
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
} | undefined;
|
|
208
|
+
metadata?: {
|
|
209
|
+
[key: string]: string;
|
|
210
|
+
} | undefined;
|
|
211
|
+
options?: {
|
|
212
|
+
[key: string]: any;
|
|
213
|
+
} | undefined;
|
|
214
|
+
unionSchemas?: {
|
|
215
|
+
[key: string]: SchemaData;
|
|
216
|
+
} | undefined;
|
|
217
|
+
};
|
|
218
|
+
import type { ValueProcessorSpec } from './value-processor/value-processor.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrap an existing executor as a ValueProcessor
|
|
3
|
+
*
|
|
4
|
+
* @augments {ValueProcessor}
|
|
5
|
+
*/
|
|
6
|
+
export class ComposedValueProcessor extends ValueProcessor {
|
|
7
|
+
/**
|
|
8
|
+
* @param {Executor<any>} executor
|
|
9
|
+
* @param {any} spec
|
|
10
|
+
* @param {string} [description]
|
|
11
|
+
*/
|
|
12
|
+
constructor(executor: Executor<any>, spec: any, description?: string);
|
|
13
|
+
execute(value: any, target: any, location: any, options: any): any;
|
|
14
|
+
#private;
|
|
15
|
+
}
|
|
16
|
+
import { ValueProcessor } from './value-processor.js';
|
|
17
|
+
import { Executor } from "../executor/executor.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @import {ValueProcessorFunction, ValueProcessorDefinition, ValueProcessorArgs} from './value-processor.js' */
|
|
2
|
+
/**
|
|
3
|
+
* @augments {ParameterizedValueProcessor}
|
|
4
|
+
*/
|
|
5
|
+
export class DefinedValueProcessor extends ParameterizedValueProcessor {
|
|
6
|
+
/**
|
|
7
|
+
* @param {ValueProcessorDefinition} definition
|
|
8
|
+
* @param {ValueProcessor[]|{[parameter:string]:ValueProcessor}} [args]
|
|
9
|
+
*/
|
|
10
|
+
constructor(definition: ValueProcessorDefinition, args?: ValueProcessor[] | {
|
|
11
|
+
[parameter: string]: ValueProcessor;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
import { ParameterizedValueProcessor } from './parameterized-value-processor.js';
|
|
15
|
+
import type { ValueProcessorDefinition } from './value-processor.js';
|
|
16
|
+
import { ValueProcessor } from './value-processor.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @import {ValueProcessorFunction, ValueProcessorDefinition, ValueProcessorArgs} from './value-processor.js' */
|
|
2
|
+
/**
|
|
3
|
+
* @augments {ValueProcessor}
|
|
4
|
+
*/
|
|
5
|
+
export class FunctionValueProcessor extends ValueProcessor {
|
|
6
|
+
/**
|
|
7
|
+
* @param {ValueProcessorFunction} process
|
|
8
|
+
* @param {ValueProcessor} [args]
|
|
9
|
+
*/
|
|
10
|
+
constructor(process: ValueProcessorFunction, args?: ValueProcessor);
|
|
11
|
+
spec: ValueProcessorFunction;
|
|
12
|
+
#private;
|
|
13
|
+
}
|
|
14
|
+
import { ValueProcessor } from './value-processor.js';
|
|
15
|
+
import type { ValueProcessorFunction } from './value-processor.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @augments {ValueProcessor}
|
|
3
|
+
*/
|
|
4
|
+
export class ParameterizedValueProcessor extends ValueProcessor {
|
|
5
|
+
/**
|
|
6
|
+
* @param {ValueProcessor} mainProcessor
|
|
7
|
+
* @param {ValueProcessor|undefined} argsProcessor
|
|
8
|
+
* @param {any} spec
|
|
9
|
+
* @param {string} [description]
|
|
10
|
+
*/
|
|
11
|
+
constructor(mainProcessor: ValueProcessor, argsProcessor: ValueProcessor | undefined, spec: any, description?: string);
|
|
12
|
+
#private;
|
|
13
|
+
}
|
|
14
|
+
import { ValueProcessor } from './value-processor.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @typedef {[key:string, executor:Executor]} ObjectExecutorEntry */
|
|
2
|
+
/**
|
|
3
|
+
* ParametersValueProcessor is an Executor that uses a list of parameter definitions to validate and execute
|
|
4
|
+
* provided argument Executors.
|
|
5
|
+
*
|
|
6
|
+
* Parameters are managed as follows:
|
|
7
|
+
* - The first optional parameter without an explicit default will use the pipeline value as its default.
|
|
8
|
+
* - If a type option is specified, that argument will be validated against that type.
|
|
9
|
+
* - Constant executors will be checked at construction.
|
|
10
|
+
* - If all parameters are passed constant executor arguments, the entire executor will be constant.
|
|
11
|
+
* - Receiving "undefined" as an argument value at runtime should not be interpreted as a missing argument,
|
|
12
|
+
* as it may simply indicate that the value is not yet available (but may become available later.)
|
|
13
|
+
*
|
|
14
|
+
* @augments {ValueProcessor}
|
|
15
|
+
*/
|
|
16
|
+
export class ParametersValueProcessor extends ValueProcessor {
|
|
17
|
+
/**
|
|
18
|
+
* @param {object[]} [parameters]
|
|
19
|
+
* @param {ValueProcessor[]|{[parameter:string]:ValueProcessor}} [argsProcessors]
|
|
20
|
+
*/
|
|
21
|
+
constructor(parameters?: object[], argsProcessors?: ValueProcessor[] | {
|
|
22
|
+
[parameter: string]: ValueProcessor;
|
|
23
|
+
});
|
|
24
|
+
#private;
|
|
25
|
+
}
|
|
26
|
+
export type ObjectExecutorEntry = [key: string, executor: Executor<any>];
|
|
27
|
+
import { ValueProcessor } from './value-processor.js';
|
|
28
|
+
import { Executor } from '../executor/executor.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @import { ValueProcessorSpec, KeywordValueProcessorSpec } from './value-processor.js' */
|
|
2
|
+
/**
|
|
3
|
+
* @param {ValueProcessorSpec} spec
|
|
4
|
+
* @returns {spec is KeywordValueProcessorSpec}
|
|
5
|
+
* @package
|
|
6
|
+
*/
|
|
7
|
+
export function isKeywordValueProcessorSpec(spec: ValueProcessorSpec): spec is KeywordValueProcessorSpec;
|
|
8
|
+
/**
|
|
9
|
+
* @param {KeywordValueProcessorSpec} keywordSpec
|
|
10
|
+
* @returns {[string,any]}
|
|
11
|
+
* @package
|
|
12
|
+
*/
|
|
13
|
+
export function extractKeywordValueProcessorSpec(keywordSpec: KeywordValueProcessorSpec): [string, any];
|
|
14
|
+
/**
|
|
15
|
+
* Check whether a candidate spec is legal
|
|
16
|
+
* @param {any} spec
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
* @package
|
|
19
|
+
*/
|
|
20
|
+
export function isLegalValueProcessorSpec(spec: any): boolean;
|
|
21
|
+
import type { ValueProcessorSpec } from './value-processor.js';
|
|
22
|
+
import type { KeywordValueProcessorSpec } from './value-processor.js';
|