@clementine-solutions/jane-io 1.0.0 → 1.0.2
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/README.md +132 -1
- package/dist/core/analysis/diff.d.ts +35 -0
- package/dist/core/analysis/diff.js +88 -0
- package/dist/core/analysis/explain.d.ts +35 -0
- package/dist/core/analysis/explain.js +117 -0
- package/dist/core/analysis/index.d.ts +14 -0
- package/dist/core/analysis/index.js +26 -0
- package/dist/core/analysis/replay.d.ts +34 -0
- package/dist/core/analysis/replay.js +68 -0
- package/dist/core/analysis/telemetry.d.ts +28 -0
- package/dist/core/analysis/telemetry.js +123 -0
- package/dist/core/boundary-rules/at-most-one.d.ts +17 -0
- package/dist/core/boundary-rules/at-most-one.js +38 -0
- package/dist/core/boundary-rules/conditionally-required.d.ts +18 -0
- package/dist/core/boundary-rules/conditionally-required.js +44 -0
- package/dist/core/boundary-rules/date-range.d.ts +17 -0
- package/dist/core/boundary-rules/date-range.js +39 -0
- package/dist/core/boundary-rules/index.d.ts +18 -0
- package/dist/core/boundary-rules/index.js +21 -0
- package/dist/core/boundary-rules/mutually-exclusive.d.ts +16 -0
- package/dist/core/boundary-rules/mutually-exclusive.js +38 -0
- package/dist/core/boundary-rules/no-unknown-fields.d.ts +17 -0
- package/dist/core/boundary-rules/no-unknown-fields.js +39 -0
- package/dist/core/boundary-rules/require-all.d.ts +16 -0
- package/dist/core/boundary-rules/require-all.js +39 -0
- package/dist/core/boundary-rules/require-one.d.ts +17 -0
- package/dist/core/boundary-rules/require-one.js +41 -0
- package/dist/core/common/events.d.ts +37 -0
- package/dist/core/common/events.js +82 -0
- package/dist/core/common/fluent.d.ts +151 -0
- package/dist/core/common/fluent.js +429 -0
- package/dist/core/common/index.d.ts +16 -0
- package/dist/core/common/index.js +31 -0
- package/dist/core/common/policy.d.ts +170 -0
- package/dist/core/common/policy.js +550 -0
- package/dist/core/common/utilities.d.ts +59 -0
- package/dist/core/common/utilities.js +177 -0
- package/dist/core/common/wildcard.d.ts +27 -0
- package/dist/core/common/wildcard.js +63 -0
- package/dist/core/field-path/construct.d.ts +77 -0
- package/dist/core/field-path/construct.js +189 -0
- package/dist/core/field-path/format.d.ts +41 -0
- package/dist/core/field-path/format.js +154 -0
- package/dist/core/field-path/index.d.ts +14 -0
- package/dist/core/field-path/index.js +26 -0
- package/dist/core/field-path/utilities.d.ts +85 -0
- package/dist/core/field-path/utilities.js +138 -0
- package/dist/core/field-path/walk.d.ts +36 -0
- package/dist/core/field-path/walk.js +80 -0
- package/dist/core/fluent-registry.d.ts +138 -0
- package/dist/core/fluent-registry.js +151 -0
- package/dist/core/normalizers/array/compact-sparse-array.d.ts +22 -0
- package/dist/core/normalizers/array/compact-sparse-array.js +40 -0
- package/dist/core/normalizers/array/flatten-one-level.d.ts +17 -0
- package/dist/core/normalizers/array/flatten-one-level.js +45 -0
- package/dist/core/normalizers/array/remove-empty-string-items.d.ts +6 -0
- package/dist/core/normalizers/array/remove-empty-string-items.js +34 -0
- package/dist/core/normalizers/array/remove-null-items.d.ts +16 -0
- package/dist/core/normalizers/array/remove-null-items.js +34 -0
- package/dist/core/normalizers/array/remove-undefined-items.d.ts +16 -0
- package/dist/core/normalizers/array/remove-undefined-items.js +34 -0
- package/dist/core/normalizers/date/invalid-date-to-undefined.d.ts +17 -0
- package/dist/core/normalizers/date/invalid-date-to-undefined.js +35 -0
- package/dist/core/normalizers/index.d.ts +28 -0
- package/dist/core/normalizers/index.js +46 -0
- package/dist/core/normalizers/normalizer-register.d.ts +17 -0
- package/dist/core/normalizers/normalizer-register.js +41 -0
- package/dist/core/normalizers/number/infinity-to-undefined.d.ts +18 -0
- package/dist/core/normalizers/number/infinity-to-undefined.js +35 -0
- package/dist/core/normalizers/number/nan-to-undefined.d.ts +17 -0
- package/dist/core/normalizers/number/nan-to-undefined.js +34 -0
- package/dist/core/normalizers/number/normalize-negative-zero.d.ts +16 -0
- package/dist/core/normalizers/number/normalize-negative-zero.js +33 -0
- package/dist/core/normalizers/object/remove-empty-array-keys.d.ts +17 -0
- package/dist/core/normalizers/object/remove-empty-array-keys.js +38 -0
- package/dist/core/normalizers/object/remove-empty-object-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-empty-object-keys.js +42 -0
- package/dist/core/normalizers/object/remove-empty-string-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-empty-string-keys.js +37 -0
- package/dist/core/normalizers/object/remove-null-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-null-keys.js +37 -0
- package/dist/core/normalizers/object/remove-undefined-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-undefined-keys.js +37 -0
- package/dist/core/normalizers/string/collapse-whitespace.d.ts +17 -0
- package/dist/core/normalizers/string/collapse-whitespace.js +35 -0
- package/dist/core/normalizers/string/empty-to-undefined.d.ts +16 -0
- package/dist/core/normalizers/string/empty-to-undefined.js +33 -0
- package/dist/core/normalizers/string/trim.d.ts +16 -0
- package/dist/core/normalizers/string/trim.js +34 -0
- package/dist/core/parsers/index.d.ts +22 -0
- package/dist/core/parsers/index.js +43 -0
- package/dist/core/parsers/parse-array-string.d.ts +16 -0
- package/dist/core/parsers/parse-array-string.js +36 -0
- package/dist/core/parsers/parse-bigint-string.d.ts +16 -0
- package/dist/core/parsers/parse-bigint-string.js +33 -0
- package/dist/core/parsers/parse-binary-string.d.ts +16 -0
- package/dist/core/parsers/parse-binary-string.js +33 -0
- package/dist/core/parsers/parse-boolean-string.d.ts +16 -0
- package/dist/core/parsers/parse-boolean-string.js +27 -0
- package/dist/core/parsers/parse-date-string.d.ts +16 -0
- package/dist/core/parsers/parse-date-string.js +30 -0
- package/dist/core/parsers/parse-duration-string.d.ts +16 -0
- package/dist/core/parsers/parse-duration-string.js +37 -0
- package/dist/core/parsers/parse-hex-string.d.ts +16 -0
- package/dist/core/parsers/parse-hex-string.js +29 -0
- package/dist/core/parsers/parse-integer-string.d.ts +16 -0
- package/dist/core/parsers/parse-integer-string.js +30 -0
- package/dist/core/parsers/parse-json-string.d.ts +17 -0
- package/dist/core/parsers/parse-json-string.js +35 -0
- package/dist/core/parsers/parse-numeric-string.d.ts +16 -0
- package/dist/core/parsers/parse-numeric-string.js +29 -0
- package/dist/core/parsers/parse-object-string.d.ts +16 -0
- package/dist/core/parsers/parse-object-string.js +36 -0
- package/dist/core/parsers/parse-octal-string.d.ts +16 -0
- package/dist/core/parsers/parse-octal-string.js +33 -0
- package/dist/core/parsers/parse-scientific-notation-string.d.ts +16 -0
- package/dist/core/parsers/parse-scientific-notation-string.js +30 -0
- package/dist/core/parsers/parse-url-string.d.ts +16 -0
- package/dist/core/parsers/parse-url-string.js +36 -0
- package/dist/core/pipeline/boundary.d.ts +36 -0
- package/dist/core/pipeline/boundary.js +256 -0
- package/dist/core/pipeline/contain.d.ts +122 -0
- package/dist/core/pipeline/contain.js +339 -0
- package/dist/core/pipeline/index.d.ts +16 -0
- package/dist/core/pipeline/index.js +37 -0
- package/dist/core/pipeline/normalize.d.ts +34 -0
- package/dist/core/pipeline/normalize.js +76 -0
- package/dist/core/pipeline/parse.d.ts +40 -0
- package/dist/core/pipeline/parse.js +91 -0
- package/dist/core/pipeline/pipeline.d.ts +23 -0
- package/dist/core/pipeline/pipeline.js +418 -0
- package/dist/core/pipeline/scan.d.ts +46 -0
- package/dist/core/pipeline/scan.js +115 -0
- package/dist/core/pipeline/validate.d.ts +40 -0
- package/dist/core/pipeline/validate.js +74 -0
- package/dist/core/scanners/any/scan-for-sentinels.d.ts +19 -0
- package/dist/core/scanners/any/scan-for-sentinels.js +35 -0
- package/dist/core/scanners/array/array-is-deep.d.ts +19 -0
- package/dist/core/scanners/array/array-is-deep.js +38 -0
- package/dist/core/scanners/array/array-is-heterogenous.d.ts +18 -0
- package/dist/core/scanners/array/array-is-heterogenous.js +39 -0
- package/dist/core/scanners/array/array-is-large.d.ts +19 -0
- package/dist/core/scanners/array/array-is-large.js +32 -0
- package/dist/core/scanners/bigint/bigint-is-large.d.ts +20 -0
- package/dist/core/scanners/bigint/bigint-is-large.js +34 -0
- package/dist/core/scanners/bigint/bigint-not-safe.d.ts +20 -0
- package/dist/core/scanners/bigint/bigint-not-safe.js +34 -0
- package/dist/core/scanners/date/date-is-before-epoch.d.ts +19 -0
- package/dist/core/scanners/date/date-is-before-epoch.js +32 -0
- package/dist/core/scanners/date/date-is-far-future.d.ts +19 -0
- package/dist/core/scanners/date/date-is-far-future.js +32 -0
- package/dist/core/scanners/date/date-is-invalid.d.ts +19 -0
- package/dist/core/scanners/date/date-is-invalid.js +31 -0
- package/dist/core/scanners/index.d.ts +31 -0
- package/dist/core/scanners/index.js +58 -0
- package/dist/core/scanners/number/number-is-infinite.d.ts +19 -0
- package/dist/core/scanners/number/number-is-infinite.js +31 -0
- package/dist/core/scanners/number/number-is-nan.d.ts +19 -0
- package/dist/core/scanners/number/number-is-nan.js +31 -0
- package/dist/core/scanners/number/number-is-too-large.d.ts +20 -0
- package/dist/core/scanners/number/number-is-too-large.js +33 -0
- package/dist/core/scanners/number/number-is-unsafe-integer.d.ts +19 -0
- package/dist/core/scanners/number/number-is-unsafe-integer.js +31 -0
- package/dist/core/scanners/object/object-has-circular-references.d.ts +20 -0
- package/dist/core/scanners/object/object-has-circular-references.js +43 -0
- package/dist/core/scanners/object/object-has-many-keys.d.ts +19 -0
- package/dist/core/scanners/object/object-has-many-keys.js +33 -0
- package/dist/core/scanners/object/object-is-deep.d.ts +20 -0
- package/dist/core/scanners/object/object-is-deep.js +38 -0
- package/dist/core/scanners/scanner-registry.d.ts +19 -0
- package/dist/core/scanners/scanner-registry.js +36 -0
- package/dist/core/scanners/string/string-has-unsafe-unicode.d.ts +19 -0
- package/dist/core/scanners/string/string-has-unsafe-unicode.js +32 -0
- package/dist/core/scanners/string/string-has-whitespace-edges.d.ts +19 -0
- package/dist/core/scanners/string/string-has-whitespace-edges.js +31 -0
- package/dist/core/scanners/string/string-is-long.d.ts +19 -0
- package/dist/core/scanners/string/string-is-long.js +32 -0
- package/dist/core/scanners/unknown/unknown-not-scannable.d.ts +21 -0
- package/dist/core/scanners/unknown/unknown-not-scannable.js +34 -0
- package/dist/core/shapes/analysis.d.ts +239 -0
- package/dist/core/shapes/analysis.js +11 -0
- package/dist/core/shapes/boundary.d.ts +126 -0
- package/dist/core/shapes/boundary.js +11 -0
- package/dist/core/shapes/events.d.ts +83 -0
- package/dist/core/shapes/events.js +10 -0
- package/dist/core/shapes/field-path.d.ts +51 -0
- package/dist/core/shapes/field-path.js +10 -0
- package/dist/core/shapes/index.d.ts +21 -0
- package/dist/core/shapes/index.js +11 -0
- package/dist/core/shapes/normalize.d.ts +59 -0
- package/dist/core/shapes/normalize.js +11 -0
- package/dist/core/shapes/parse.d.ts +75 -0
- package/dist/core/shapes/parse.js +11 -0
- package/dist/core/shapes/pipeline.d.ts +149 -0
- package/dist/core/shapes/pipeline.js +11 -0
- package/dist/core/shapes/policy.d.ts +158 -0
- package/dist/core/shapes/policy.js +11 -0
- package/dist/core/shapes/public.d.ts +92 -0
- package/dist/core/shapes/public.js +10 -0
- package/dist/core/shapes/scan.d.ts +126 -0
- package/dist/core/shapes/scan.js +11 -0
- package/dist/core/shapes/validate.d.ts +65 -0
- package/dist/core/shapes/validate.js +11 -0
- package/dist/core/validators/array/array-max-items.d.ts +25 -0
- package/dist/core/validators/array/array-max-items.js +42 -0
- package/dist/core/validators/array/array-min-items.d.ts +25 -0
- package/dist/core/validators/array/array-min-items.js +42 -0
- package/dist/core/validators/array/array.d.ts +22 -0
- package/dist/core/validators/array/array.js +34 -0
- package/dist/core/validators/array/excludes.d.ts +25 -0
- package/dist/core/validators/array/excludes.js +47 -0
- package/dist/core/validators/array/has-unique-items.d.ts +24 -0
- package/dist/core/validators/array/has-unique-items.js +46 -0
- package/dist/core/validators/array/includes.d.ts +24 -0
- package/dist/core/validators/array/includes.js +46 -0
- package/dist/core/validators/array/items-equal.d.ts +25 -0
- package/dist/core/validators/array/items-equal.js +42 -0
- package/dist/core/validators/array/no-empty-string-items.d.ts +24 -0
- package/dist/core/validators/array/no-empty-string-items.js +46 -0
- package/dist/core/validators/array/no-null-items.d.ts +24 -0
- package/dist/core/validators/array/no-null-items.js +46 -0
- package/dist/core/validators/array/no-undefined-items.d.ts +24 -0
- package/dist/core/validators/array/no-undefined-items.js +45 -0
- package/dist/core/validators/array/non-empty-array.d.ts +24 -0
- package/dist/core/validators/array/non-empty-array.js +45 -0
- package/dist/core/validators/array/not-sparse.d.ts +25 -0
- package/dist/core/validators/array/not-sparse.js +44 -0
- package/dist/core/validators/bigint/bigint-equals.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-equals.js +57 -0
- package/dist/core/validators/bigint/bigint-max.d.ts +25 -0
- package/dist/core/validators/bigint/bigint-max.js +63 -0
- package/dist/core/validators/bigint/bigint-min.d.ts +25 -0
- package/dist/core/validators/bigint/bigint-min.js +87 -0
- package/dist/core/validators/bigint/bigint-negative.d.ts +23 -0
- package/dist/core/validators/bigint/bigint-negative.js +73 -0
- package/dist/core/validators/bigint/bigint-non-negative.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-non-negative.js +72 -0
- package/dist/core/validators/bigint/bigint-non-positive.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-non-positive.js +72 -0
- package/dist/core/validators/bigint/bigint-positive.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-positive.js +72 -0
- package/dist/core/validators/bigint/bigint-safe.d.ts +25 -0
- package/dist/core/validators/bigint/bigint-safe.js +75 -0
- package/dist/core/validators/bigint/bigint.d.ts +20 -0
- package/dist/core/validators/bigint/bigint.js +38 -0
- package/dist/core/validators/boolean/boolean.d.ts +21 -0
- package/dist/core/validators/boolean/boolean.js +39 -0
- package/dist/core/validators/boolean/is-false.d.ts +22 -0
- package/dist/core/validators/boolean/is-false.js +48 -0
- package/dist/core/validators/boolean/is-true.d.ts +22 -0
- package/dist/core/validators/boolean/is-true.js +48 -0
- package/dist/core/validators/common/is-country-code.d.ts +17 -0
- package/dist/core/validators/common/is-country-code.js +36 -0
- package/dist/core/validators/common/is-currency-code.d.ts +17 -0
- package/dist/core/validators/common/is-currency-code.js +36 -0
- package/dist/core/validators/common/is-email-strict.d.ts +17 -0
- package/dist/core/validators/common/is-email-strict.js +36 -0
- package/dist/core/validators/common/is-email.d.ts +17 -0
- package/dist/core/validators/common/is-email.js +36 -0
- package/dist/core/validators/common/is-ip.d.ts +17 -0
- package/dist/core/validators/common/is-ip.js +37 -0
- package/dist/core/validators/common/is-phone-strict.d.ts +17 -0
- package/dist/core/validators/common/is-phone-strict.js +36 -0
- package/dist/core/validators/common/is-phone.d.ts +17 -0
- package/dist/core/validators/common/is-phone.js +36 -0
- package/dist/core/validators/common/is-port.d.ts +17 -0
- package/dist/core/validators/common/is-port.js +35 -0
- package/dist/core/validators/common/is-postal-code.d.ts +17 -0
- package/dist/core/validators/common/is-postal-code.js +36 -0
- package/dist/core/validators/common/is-url.d.ts +17 -0
- package/dist/core/validators/common/is-url.js +38 -0
- package/dist/core/validators/common/is-uuid.d.ts +17 -0
- package/dist/core/validators/common/is-uuid.js +36 -0
- package/dist/core/validators/date/before-epoch.d.ts +28 -0
- package/dist/core/validators/date/before-epoch.js +56 -0
- package/dist/core/validators/date/date-now-required.d.ts +22 -0
- package/dist/core/validators/date/date-now-required.js +48 -0
- package/dist/core/validators/date/is-date.d.ts +21 -0
- package/dist/core/validators/date/is-date.js +47 -0
- package/dist/core/validators/date/is-far-future.d.ts +23 -0
- package/dist/core/validators/date/is-far-future.js +46 -0
- package/dist/core/validators/date/is-future.d.ts +24 -0
- package/dist/core/validators/date/is-future.js +59 -0
- package/dist/core/validators/date/is-past.d.ts +24 -0
- package/dist/core/validators/date/is-past.js +59 -0
- package/dist/core/validators/date/not-after.d.ts +25 -0
- package/dist/core/validators/date/not-after.js +66 -0
- package/dist/core/validators/date/not-before.d.ts +25 -0
- package/dist/core/validators/date/not-before.js +66 -0
- package/dist/core/validators/date/same-day.d.ts +25 -0
- package/dist/core/validators/date/same-day.js +60 -0
- package/dist/core/validators/date/same-month.d.ts +25 -0
- package/dist/core/validators/date/same-month.js +59 -0
- package/dist/core/validators/date/same-year.d.ts +24 -0
- package/dist/core/validators/date/same-year.js +56 -0
- package/dist/core/validators/date/too-early.d.ts +25 -0
- package/dist/core/validators/date/too-early.js +57 -0
- package/dist/core/validators/date/too-late.d.ts +25 -0
- package/dist/core/validators/date/too-late.js +57 -0
- package/dist/core/validators/date/weekday.d.ts +32 -0
- package/dist/core/validators/date/weekday.js +65 -0
- package/dist/core/validators/date/weekend.d.ts +27 -0
- package/dist/core/validators/date/weekend.js +56 -0
- package/dist/core/validators/index.d.ts +112 -0
- package/dist/core/validators/index.js +139 -0
- package/dist/core/validators/nullish/is-null-or-undefined.d.ts +22 -0
- package/dist/core/validators/nullish/is-null-or-undefined.js +40 -0
- package/dist/core/validators/nullish/is-null.d.ts +21 -0
- package/dist/core/validators/nullish/is-null.js +39 -0
- package/dist/core/validators/nullish/is-undefined.d.ts +21 -0
- package/dist/core/validators/nullish/is-undefined.js +39 -0
- package/dist/core/validators/number/finite.d.ts +22 -0
- package/dist/core/validators/number/finite.js +40 -0
- package/dist/core/validators/number/integer.d.ts +22 -0
- package/dist/core/validators/number/integer.js +40 -0
- package/dist/core/validators/number/less-than.d.ts +21 -0
- package/dist/core/validators/number/less-than.js +39 -0
- package/dist/core/validators/number/max.d.ts +21 -0
- package/dist/core/validators/number/max.js +39 -0
- package/dist/core/validators/number/min.d.ts +21 -0
- package/dist/core/validators/number/min.js +39 -0
- package/dist/core/validators/number/more-than.d.ts +21 -0
- package/dist/core/validators/number/more-than.js +39 -0
- package/dist/core/validators/number/negative.d.ts +20 -0
- package/dist/core/validators/number/negative.js +38 -0
- package/dist/core/validators/number/non-negative.d.ts +19 -0
- package/dist/core/validators/number/non-negative.js +37 -0
- package/dist/core/validators/number/non-positive.d.ts +19 -0
- package/dist/core/validators/number/non-positive.js +37 -0
- package/dist/core/validators/number/number.d.ts +19 -0
- package/dist/core/validators/number/number.js +31 -0
- package/dist/core/validators/number/positive.d.ts +20 -0
- package/dist/core/validators/number/positive.js +38 -0
- package/dist/core/validators/number/safe-integer.d.ts +19 -0
- package/dist/core/validators/number/safe-integer.js +42 -0
- package/dist/core/validators/object/deep-equals.d.ts +24 -0
- package/dist/core/validators/object/deep-equals.js +47 -0
- package/dist/core/validators/object/has-key.d.ts +23 -0
- package/dist/core/validators/object/has-key.js +42 -0
- package/dist/core/validators/object/has-value.d.ts +27 -0
- package/dist/core/validators/object/has-value.js +59 -0
- package/dist/core/validators/object/keys-equal.d.ts +26 -0
- package/dist/core/validators/object/keys-equal.js +47 -0
- package/dist/core/validators/object/max-keys.d.ts +24 -0
- package/dist/core/validators/object/max-keys.js +43 -0
- package/dist/core/validators/object/min-keys.d.ts +24 -0
- package/dist/core/validators/object/min-keys.js +43 -0
- package/dist/core/validators/object/missing-key.d.ts +23 -0
- package/dist/core/validators/object/missing-key.js +42 -0
- package/dist/core/validators/object/no-empty-array-values.d.ts +23 -0
- package/dist/core/validators/object/no-empty-array-values.js +44 -0
- package/dist/core/validators/object/no-empty-object-values.d.ts +23 -0
- package/dist/core/validators/object/no-empty-object-values.js +44 -0
- package/dist/core/validators/object/no-null-values.d.ts +23 -0
- package/dist/core/validators/object/no-null-values.js +44 -0
- package/dist/core/validators/object/no-undefined-values.d.ts +23 -0
- package/dist/core/validators/object/no-undefined-values.js +44 -0
- package/dist/core/validators/object/non-empty-object.d.ts +21 -0
- package/dist/core/validators/object/non-empty-object.js +40 -0
- package/dist/core/validators/object/only-keys.d.ts +23 -0
- package/dist/core/validators/object/only-keys.js +43 -0
- package/dist/core/validators/object/plain-object.d.ts +22 -0
- package/dist/core/validators/object/plain-object.js +35 -0
- package/dist/core/validators/string/alpha-num.d.ts +23 -0
- package/dist/core/validators/string/alpha-num.js +50 -0
- package/dist/core/validators/string/alpha.d.ts +24 -0
- package/dist/core/validators/string/alpha.js +51 -0
- package/dist/core/validators/string/chars-equal.d.ts +23 -0
- package/dist/core/validators/string/chars-equal.js +49 -0
- package/dist/core/validators/string/ends-with.d.ts +23 -0
- package/dist/core/validators/string/ends-with.js +50 -0
- package/dist/core/validators/string/is-ascii.d.ts +24 -0
- package/dist/core/validators/string/is-ascii.js +53 -0
- package/dist/core/validators/string/is-printable.d.ts +25 -0
- package/dist/core/validators/string/is-printable.js +53 -0
- package/dist/core/validators/string/matches.d.ts +23 -0
- package/dist/core/validators/string/matches.js +50 -0
- package/dist/core/validators/string/max-length.d.ts +24 -0
- package/dist/core/validators/string/max-length.js +50 -0
- package/dist/core/validators/string/min-length.d.ts +24 -0
- package/dist/core/validators/string/min-length.js +50 -0
- package/dist/core/validators/string/no-lead-space.d.ts +23 -0
- package/dist/core/validators/string/no-lead-space.js +50 -0
- package/dist/core/validators/string/no-repeat-space.d.ts +25 -0
- package/dist/core/validators/string/no-repeat-space.js +52 -0
- package/dist/core/validators/string/no-space.d.ts +24 -0
- package/dist/core/validators/string/no-space.js +51 -0
- package/dist/core/validators/string/no-trail-space.d.ts +23 -0
- package/dist/core/validators/string/no-trail-space.js +50 -0
- package/dist/core/validators/string/non-empty.d.ts +22 -0
- package/dist/core/validators/string/non-empty.js +48 -0
- package/dist/core/validators/string/not-one-of.d.ts +24 -0
- package/dist/core/validators/string/not-one-of.js +51 -0
- package/dist/core/validators/string/num-string.d.ts +23 -0
- package/dist/core/validators/string/num-string.js +50 -0
- package/dist/core/validators/string/one-of.d.ts +23 -0
- package/dist/core/validators/string/one-of.js +50 -0
- package/dist/core/validators/string/starts-with.d.ts +23 -0
- package/dist/core/validators/string/starts-with.js +50 -0
- package/dist/core/validators/string/string.d.ts +21 -0
- package/dist/core/validators/string/string.js +39 -0
- package/dist/core/validators/string/trimmed.d.ts +24 -0
- package/dist/core/validators/string/trimmed.js +51 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +26 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +12 -0
- package/package.json +2 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Analysis | Telemetry
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Emits structured records for each pipeline stage for
|
|
7
|
+
* auditing and observability.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { defaultPolicy } from '../common';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Telemetry *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Collects flat telemetry records for each pipeline stage.
|
|
17
|
+
*
|
|
18
|
+
* Emits one record per stage with boundary, pipeline, timestamp, and the
|
|
19
|
+
* stage‑specific payload (events, diff, explain, replay). Stages are reported
|
|
20
|
+
* in pipeline order, and a final `decide` record captures the policy outcome.
|
|
21
|
+
* No aggregation, filtering, or interpretation occurs here.
|
|
22
|
+
*/
|
|
23
|
+
export function telemetry(ctx) {
|
|
24
|
+
const { boundaryName, pipelineName, result } = ctx;
|
|
25
|
+
const timestamp = new Date().toISOString();
|
|
26
|
+
const records = [];
|
|
27
|
+
if (result.scanEvents?.length) {
|
|
28
|
+
records.push({
|
|
29
|
+
boundary: boundaryName,
|
|
30
|
+
pipeline: pipelineName,
|
|
31
|
+
timestamp,
|
|
32
|
+
stage: 'scan',
|
|
33
|
+
events: result.scanEvents,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (result.normalizeEvents?.length) {
|
|
37
|
+
records.push({
|
|
38
|
+
boundary: boundaryName,
|
|
39
|
+
pipeline: pipelineName,
|
|
40
|
+
timestamp,
|
|
41
|
+
stage: 'normalize',
|
|
42
|
+
events: result.normalizeEvents,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (result.parseEvents?.length) {
|
|
46
|
+
records.push({
|
|
47
|
+
boundary: boundaryName,
|
|
48
|
+
pipeline: pipelineName,
|
|
49
|
+
timestamp,
|
|
50
|
+
stage: 'parse',
|
|
51
|
+
events: result.parseEvents,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (result.validateEvents?.length) {
|
|
55
|
+
records.push({
|
|
56
|
+
boundary: boundaryName,
|
|
57
|
+
pipeline: pipelineName,
|
|
58
|
+
timestamp,
|
|
59
|
+
stage: 'validate',
|
|
60
|
+
events: result.validateEvents,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (result.diff) {
|
|
64
|
+
records.push({
|
|
65
|
+
boundary: boundaryName,
|
|
66
|
+
pipeline: pipelineName,
|
|
67
|
+
timestamp,
|
|
68
|
+
stage: 'diff',
|
|
69
|
+
diff: result.diff,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (result.explain) {
|
|
73
|
+
records.push({
|
|
74
|
+
boundary: boundaryName,
|
|
75
|
+
pipeline: pipelineName,
|
|
76
|
+
timestamp,
|
|
77
|
+
stage: 'explain',
|
|
78
|
+
explain: result.explain,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (result.replay) {
|
|
82
|
+
records.push({
|
|
83
|
+
boundary: boundaryName,
|
|
84
|
+
pipeline: pipelineName,
|
|
85
|
+
timestamp,
|
|
86
|
+
stage: 'replay',
|
|
87
|
+
replay: result.replay,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
records.push({
|
|
91
|
+
boundary: boundaryName,
|
|
92
|
+
pipeline: pipelineName,
|
|
93
|
+
timestamp,
|
|
94
|
+
stage: 'decide',
|
|
95
|
+
decision: result.decision.code,
|
|
96
|
+
mode: result.policy.mode,
|
|
97
|
+
eventCount: result.events.length,
|
|
98
|
+
});
|
|
99
|
+
return { records };
|
|
100
|
+
}
|
|
101
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
102
|
+
|* Run With Telemetry *|
|
|
103
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
104
|
+
/**
|
|
105
|
+
* Runs the pipeline and emits telemetry if enabled by policy.
|
|
106
|
+
*
|
|
107
|
+
* Delegates execution to the builder, collects stage records through the
|
|
108
|
+
* telemetry helper, and forwards them to the provided sink. Returns the full
|
|
109
|
+
* pipeline result unchanged.
|
|
110
|
+
*/
|
|
111
|
+
export async function runTelemetry(builder, sink) {
|
|
112
|
+
const result = await builder.run();
|
|
113
|
+
const policy = builder.policy ?? defaultPolicy;
|
|
114
|
+
if (policy.analysis?.telemetry) {
|
|
115
|
+
const tel = telemetry({
|
|
116
|
+
boundaryName: policy.boundaryName ?? 'unknown-boundary',
|
|
117
|
+
pipelineName: policy.pipelineName ?? 'unknown-pipeline',
|
|
118
|
+
result,
|
|
119
|
+
});
|
|
120
|
+
sink(tel.records);
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | At Most One
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures that no more than one of the specified fields is
|
|
7
|
+
* accepted. If multiple fields are present, a boundary error
|
|
8
|
+
* is emitted.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Ensures that at most one of the specified fields is accepted. If more than
|
|
15
|
+
* one field is present, a boundary‑level error is emitted.
|
|
16
|
+
*/
|
|
17
|
+
export declare function atMostOne(...keys: string[]): BoundaryRule;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | At Most One
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures that no more than one of the specified fields is
|
|
7
|
+
* accepted. If multiple fields are present, a boundary error
|
|
8
|
+
* is emitted.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { rootPath } from '../field-path';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Ensures that at most one of the specified fields is accepted. If more than
|
|
18
|
+
* one field is present, a boundary‑level error is emitted.
|
|
19
|
+
*/
|
|
20
|
+
export function atMostOne(...keys) {
|
|
21
|
+
return ({ fields }) => {
|
|
22
|
+
const events = [];
|
|
23
|
+
const issues = [];
|
|
24
|
+
const present = keys.filter((k) => fields[k]?.decision?.code === 'accept');
|
|
25
|
+
if (present.length > 1) {
|
|
26
|
+
const ev = {
|
|
27
|
+
phase: 'decide',
|
|
28
|
+
kind: 'error',
|
|
29
|
+
code: 'boundary.does.at-most-one',
|
|
30
|
+
message: `At most one of [${keys.join(', ')}] may be present`,
|
|
31
|
+
path: rootPath(),
|
|
32
|
+
};
|
|
33
|
+
events.push(ev);
|
|
34
|
+
issues.push(ev);
|
|
35
|
+
}
|
|
36
|
+
return { events, issues };
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Conditionally Required
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires a set of fields when a controlling field matches a
|
|
7
|
+
* specific value. Missing or rejected fields trigger
|
|
8
|
+
* boundary‑level errors.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Requires a set of fields when a controlling field matches a specific value.
|
|
15
|
+
* If the condition is met and any required field is missing or rejected, an
|
|
16
|
+
* error is emitted for each missing field.
|
|
17
|
+
*/
|
|
18
|
+
export declare function conditionallyRequired(typeKey: string, typeValue: unknown, ...required: string[]): BoundaryRule;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Conditionally Required
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires a set of fields when a controlling field matches a
|
|
7
|
+
* specific value. Missing or rejected fields trigger
|
|
8
|
+
* boundary‑level errors.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { rootPath } from '../field-path';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Requires a set of fields when a controlling field matches a specific value.
|
|
18
|
+
* If the condition is met and any required field is missing or rejected, an
|
|
19
|
+
* error is emitted for each missing field.
|
|
20
|
+
*/
|
|
21
|
+
export function conditionallyRequired(typeKey, typeValue, ...required) {
|
|
22
|
+
return ({ fields }) => {
|
|
23
|
+
const events = [];
|
|
24
|
+
const issues = [];
|
|
25
|
+
const type = fields[typeKey]?.final;
|
|
26
|
+
if (type === typeValue) {
|
|
27
|
+
for (const key of required) {
|
|
28
|
+
const r = fields[key];
|
|
29
|
+
if (!r || r.decision?.code !== 'accept') {
|
|
30
|
+
const ev = {
|
|
31
|
+
phase: 'decide',
|
|
32
|
+
kind: 'error',
|
|
33
|
+
code: 'boundary.does.require-field',
|
|
34
|
+
message: `Field "${key}" is required when "${typeKey}" = "${typeValue}"`,
|
|
35
|
+
path: rootPath(key),
|
|
36
|
+
};
|
|
37
|
+
events.push(ev);
|
|
38
|
+
issues.push(ev);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return { events, issues };
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Date Range
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that a start and end date form a proper
|
|
7
|
+
* chronological range. Emits an error when the start occurs
|
|
8
|
+
* after the end.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Validates that a start/end date pair forms a proper chronological range.
|
|
15
|
+
* Emits an error when both fields are dates and the start occurs after the end.
|
|
16
|
+
*/
|
|
17
|
+
export declare function dateRange(startKey: string, endKey: string): BoundaryRule;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Date Range
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that a start and end date form a proper
|
|
7
|
+
* chronological range. Emits an error when the start occurs
|
|
8
|
+
* after the end.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { rootPath } from '../field-path';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Validates that a start/end date pair forms a proper chronological range.
|
|
18
|
+
* Emits an error when both fields are dates and the start occurs after the end.
|
|
19
|
+
*/
|
|
20
|
+
export function dateRange(startKey, endKey) {
|
|
21
|
+
return ({ fields }) => {
|
|
22
|
+
const events = [];
|
|
23
|
+
const issues = [];
|
|
24
|
+
const start = fields[startKey]?.final;
|
|
25
|
+
const end = fields[endKey]?.final;
|
|
26
|
+
if (start instanceof Date && end instanceof Date && start > end) {
|
|
27
|
+
const ev = {
|
|
28
|
+
phase: 'decide',
|
|
29
|
+
kind: 'error',
|
|
30
|
+
code: 'boundary.does.require-date-range',
|
|
31
|
+
message: `"${startKey}" must be before "${endKey}"`,
|
|
32
|
+
path: rootPath(),
|
|
33
|
+
};
|
|
34
|
+
events.push(ev);
|
|
35
|
+
issues.push(ev);
|
|
36
|
+
}
|
|
37
|
+
return { events, issues };
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports shared boundary rules to provide a stable,
|
|
7
|
+
* minimal entry point for internal consumers. This file
|
|
8
|
+
* exposes no logic of its own.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
export { atMostOne } from './at-most-one';
|
|
13
|
+
export { conditionallyRequired } from './conditionally-required';
|
|
14
|
+
export { dateRange } from './date-range';
|
|
15
|
+
export { mutuallyExclusive } from './mutually-exclusive';
|
|
16
|
+
export { noUnknownFields } from './no-unknown-fields';
|
|
17
|
+
export { requireAll } from './require-all';
|
|
18
|
+
export { requireOne } from './require-one';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports shared boundary rules to provide a stable,
|
|
7
|
+
* minimal entry point for internal consumers. This file
|
|
8
|
+
* exposes no logic of its own.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Boundary Rules *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
export { atMostOne } from './at-most-one';
|
|
16
|
+
export { conditionallyRequired } from './conditionally-required';
|
|
17
|
+
export { dateRange } from './date-range';
|
|
18
|
+
export { mutuallyExclusive } from './mutually-exclusive';
|
|
19
|
+
export { noUnknownFields } from './no-unknown-fields';
|
|
20
|
+
export { requireAll } from './require-all';
|
|
21
|
+
export { requireOne } from './require-one';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Mutually Exclusive
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Enforces that two fields cannot both be accepted. If both
|
|
7
|
+
* appear, a mutual‑exclusion boundary error is produced.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Enforces mutual exclusion between two fields. If both fields are accepted,
|
|
14
|
+
* a boundary‑level error is emitted indicating the conflict.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mutuallyExclusive(a: string, b: string): BoundaryRule;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Mutually Exclusive
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Enforces that two fields cannot both be accepted. If both
|
|
7
|
+
* appear, a mutual‑exclusion boundary error is produced.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { rootPath } from '../field-path';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Enforces mutual exclusion between two fields. If both fields are accepted,
|
|
17
|
+
* a boundary‑level error is emitted indicating the conflict.
|
|
18
|
+
*/
|
|
19
|
+
export function mutuallyExclusive(a, b) {
|
|
20
|
+
return ({ fields }) => {
|
|
21
|
+
const events = [];
|
|
22
|
+
const issues = [];
|
|
23
|
+
const ra = fields[a];
|
|
24
|
+
const rb = fields[b];
|
|
25
|
+
if (ra?.decision?.code === 'accept' && rb?.decision?.code === 'accept') {
|
|
26
|
+
const ev = {
|
|
27
|
+
phase: 'decide',
|
|
28
|
+
kind: 'error',
|
|
29
|
+
code: 'boundary.does.mutual-exclusion',
|
|
30
|
+
message: `Fields "${a}" and "${b}" cannot both be present`,
|
|
31
|
+
path: rootPath(),
|
|
32
|
+
};
|
|
33
|
+
events.push(ev);
|
|
34
|
+
issues.push(ev);
|
|
35
|
+
}
|
|
36
|
+
return { events, issues };
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | No Unknown Fields
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures that only explicitly allowed fields appear in the
|
|
7
|
+
* boundary input. Any unknown key results in a boundary error.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Ensures that only the explicitly allowed fields appear in the boundary
|
|
14
|
+
* input. Any field not listed is treated as an unknown key and produces a
|
|
15
|
+
* boundary‑level error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function noUnknownFields(...allowed: string[]): BoundaryRule;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | No Unknown Fields
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures that only explicitly allowed fields appear in the
|
|
7
|
+
* boundary input. Any unknown key results in a boundary error.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { rootPath } from '../field-path';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Ensures that only the explicitly allowed fields appear in the boundary
|
|
17
|
+
* input. Any field not listed is treated as an unknown key and produces a
|
|
18
|
+
* boundary‑level error.
|
|
19
|
+
*/
|
|
20
|
+
export function noUnknownFields(...allowed) {
|
|
21
|
+
return ({ fields }) => {
|
|
22
|
+
const events = [];
|
|
23
|
+
const issues = [];
|
|
24
|
+
for (const key of Object.keys(fields)) {
|
|
25
|
+
if (!allowed.includes(key)) {
|
|
26
|
+
const ev = {
|
|
27
|
+
phase: 'decide',
|
|
28
|
+
kind: 'error',
|
|
29
|
+
code: 'boundary.cannot.allow-unknown',
|
|
30
|
+
message: `Unknown field "${key}"`,
|
|
31
|
+
path: rootPath(key),
|
|
32
|
+
};
|
|
33
|
+
events.push(ev);
|
|
34
|
+
issues.push(ev);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { events, issues };
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Require All
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires that all specified fields be present and accepted.
|
|
7
|
+
* Missing or rejected fields each produce a boundary error.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Requires that all specified fields be present and accepted. Any missing or
|
|
14
|
+
* rejected field results in a boundary‑level error for that key.
|
|
15
|
+
*/
|
|
16
|
+
export declare function requireAll(...keys: string[]): BoundaryRule;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Require All
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires that all specified fields be present and accepted.
|
|
7
|
+
* Missing or rejected fields each produce a boundary error.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { rootPath } from '../field-path';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Requires that all specified fields be present and accepted. Any missing or
|
|
17
|
+
* rejected field results in a boundary‑level error for that key.
|
|
18
|
+
*/
|
|
19
|
+
export function requireAll(...keys) {
|
|
20
|
+
return ({ fields }) => {
|
|
21
|
+
const events = [];
|
|
22
|
+
const issues = [];
|
|
23
|
+
for (const key of keys) {
|
|
24
|
+
const r = fields[key];
|
|
25
|
+
if (!r || r.decision?.code !== 'accept') {
|
|
26
|
+
const ev = {
|
|
27
|
+
phase: 'decide',
|
|
28
|
+
kind: 'error',
|
|
29
|
+
code: 'boundary.does.require-all',
|
|
30
|
+
message: `Field "${key}" is required`,
|
|
31
|
+
path: rootPath(key),
|
|
32
|
+
};
|
|
33
|
+
events.push(ev);
|
|
34
|
+
issues.push(ev);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return { events, issues };
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Require One
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires that at least one of the specified fields be
|
|
7
|
+
* accepted. If none are present, a single boundary error is
|
|
8
|
+
* emitted.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Requires that at least one of the specified fields be present and accepted.
|
|
15
|
+
* If none are provided, a single boundary‑level error is emitted.
|
|
16
|
+
*/
|
|
17
|
+
export declare function requireOne(...keys: string[]): BoundaryRule;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Require One
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires that at least one of the specified fields be
|
|
7
|
+
* accepted. If none are present, a single boundary error is
|
|
8
|
+
* emitted.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { rootPath } from '../field-path';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Requires that at least one of the specified fields be present and accepted.
|
|
18
|
+
* If none are provided, a single boundary‑level error is emitted.
|
|
19
|
+
*/
|
|
20
|
+
export function requireOne(...keys) {
|
|
21
|
+
return ({ fields }) => {
|
|
22
|
+
const events = [];
|
|
23
|
+
const issues = [];
|
|
24
|
+
const ok = keys.some((key) => {
|
|
25
|
+
const r = fields[key];
|
|
26
|
+
return r && r.decision?.code === 'accept';
|
|
27
|
+
});
|
|
28
|
+
if (!ok) {
|
|
29
|
+
const ev = {
|
|
30
|
+
phase: 'decide',
|
|
31
|
+
kind: 'error',
|
|
32
|
+
code: 'boundary.does.require-one',
|
|
33
|
+
message: `At least one of [${keys.join(', ')}] is required`,
|
|
34
|
+
path: rootPath(),
|
|
35
|
+
};
|
|
36
|
+
events.push(ev);
|
|
37
|
+
issues.push(ev);
|
|
38
|
+
}
|
|
39
|
+
return { events, issues };
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Common | Events
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Shared event types, factories, and helpers used across all
|
|
7
|
+
* pipeline stages. These modules define how Jane records and
|
|
8
|
+
* communicates observable facts during execution.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { EventCode, EventKind, FieldPath, JaneEvent, PipelinePhase } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Creates a frozen JaneEvent with consistent metadata.
|
|
15
|
+
*
|
|
16
|
+
* This factory centralizes event construction so all stages emit the same
|
|
17
|
+
* shape: stable identifiers, optional context, and a metadata block that
|
|
18
|
+
* tooling can rely on. Callers provide only the facts; the factory attaches
|
|
19
|
+
* timestamps and prepares the object for safe sharing across the pipeline.
|
|
20
|
+
*
|
|
21
|
+
* The returned event is immutable to prevent accidental mutation during
|
|
22
|
+
* scan, parse, normalize, validate, boundary, or policy execution.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createEvent(phase: PipelinePhase, kind: EventKind, code: EventCode, path?: FieldPath, message?: string, userMessage?: string, meta?: Record<string, unknown>): JaneEvent;
|
|
25
|
+
/**
|
|
26
|
+
* Structural type guard for JaneEvent.
|
|
27
|
+
*
|
|
28
|
+
* This check verifies that a value has the minimal shape required for an
|
|
29
|
+
* event: a valid phase, kind, code, and optional context fields. It does not
|
|
30
|
+
* validate semantics or metadata—only that the object is structurally safe to
|
|
31
|
+
* treat as a JaneEvent inside the pipeline.
|
|
32
|
+
*
|
|
33
|
+
* The guard is intentionally strict and literal. It accepts only the phases
|
|
34
|
+
* and kinds defined here, ensuring that stray or misspelled values cannot
|
|
35
|
+
* enter policy, explain, or replay logic.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isJaneEvent(value: unknown): value is JaneEvent;
|