@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,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Registry | Fluent
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Central registry of all built‑in validators and parsers.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Central registry of all built‑in Jane validators and parsers.
|
|
12
|
+
*
|
|
13
|
+
* This object provides a single, authoritative lookup table for every
|
|
14
|
+
* first‑party rule Jane ships with. Validators define how values are checked
|
|
15
|
+
* for correctness, while parsers convert raw input into structured forms.
|
|
16
|
+
* Keeping them together in one immutable registry ensures predictable
|
|
17
|
+
* resolution, consistent behavior across subsystems, and a stable surface
|
|
18
|
+
* for contributors extending or inspecting Jane’s rule set.
|
|
19
|
+
*/
|
|
20
|
+
export declare const janeRegistry: {
|
|
21
|
+
readonly validators: {
|
|
22
|
+
readonly alphaNum: import("./shapes").ValidationRule;
|
|
23
|
+
readonly alpha: import("./shapes").ValidationRule;
|
|
24
|
+
readonly array: import("./shapes").ValidationRule;
|
|
25
|
+
readonly arrayMinItems: (min: number) => import("./shapes").ValidationRule;
|
|
26
|
+
readonly arrayMaxItems: (max: number) => import("./shapes").ValidationRule;
|
|
27
|
+
readonly beforeEpoch: import("./shapes").ValidationRule;
|
|
28
|
+
readonly bigint: import("./shapes").ValidationRule;
|
|
29
|
+
readonly bigintEquals: (target: bigint) => import("./shapes").ValidationRule;
|
|
30
|
+
readonly bigintMax: (max: bigint) => import("./shapes").ValidationRule;
|
|
31
|
+
readonly bigintMin: (min: bigint) => import("./shapes").ValidationRule;
|
|
32
|
+
readonly bigintNegative: import("./shapes").ValidationRule;
|
|
33
|
+
readonly bigintNonNegative: import("./shapes").ValidationRule;
|
|
34
|
+
readonly bigintNonPositive: import("./shapes").ValidationRule;
|
|
35
|
+
readonly bigintPositive: import("./shapes").ValidationRule;
|
|
36
|
+
readonly bigintSafe: import("./shapes").ValidationRule;
|
|
37
|
+
readonly boolean: import("./shapes").ValidationRule;
|
|
38
|
+
readonly charsEqual: (exact: number) => import("./shapes").ValidationRule;
|
|
39
|
+
readonly dateNowRequired: import("./shapes").ValidationRule;
|
|
40
|
+
readonly deepEquals: (expected: unknown) => import("./shapes").ValidationRule;
|
|
41
|
+
readonly endsWith: (suffix: string) => import("./shapes").ValidationRule;
|
|
42
|
+
readonly excludes: (item: unknown) => import("./shapes").ValidationRule;
|
|
43
|
+
readonly finite: import("./shapes").ValidationRule;
|
|
44
|
+
readonly hasKey: (requiredKey: string) => import("./shapes").ValidationRule;
|
|
45
|
+
readonly hasUniqueItems: import("./shapes").ValidationRule;
|
|
46
|
+
readonly hasValue: (target: unknown) => import("./shapes").ValidationRule;
|
|
47
|
+
readonly includes: (item: unknown) => import("./shapes").ValidationRule;
|
|
48
|
+
readonly integer: import("./shapes").ValidationRule;
|
|
49
|
+
readonly isAscii: import("./shapes").ValidationRule;
|
|
50
|
+
readonly isCountryCode: import("./shapes").ValidationRule;
|
|
51
|
+
readonly isCurrencyCode: import("./shapes").ValidationRule;
|
|
52
|
+
readonly isDate: import("./shapes").ValidationRule;
|
|
53
|
+
readonly isEmail: import("./shapes").ValidationRule;
|
|
54
|
+
readonly isEmailStrict: import("./shapes").ValidationRule;
|
|
55
|
+
readonly isFalse: import("./shapes").ValidationRule;
|
|
56
|
+
readonly isFarFuture: import("./shapes").ValidationRule;
|
|
57
|
+
readonly isFuture: import("./shapes").ValidationRule;
|
|
58
|
+
readonly isIp: import("./shapes").ValidationRule;
|
|
59
|
+
readonly isPast: import("./shapes").ValidationRule;
|
|
60
|
+
readonly isPhone: import("./shapes").ValidationRule;
|
|
61
|
+
readonly isPhoneStrict: import("./shapes").ValidationRule;
|
|
62
|
+
readonly isPort: import("./shapes").ValidationRule;
|
|
63
|
+
readonly isPostalCode: import("./shapes").ValidationRule;
|
|
64
|
+
readonly isPrintable: import("./shapes").ValidationRule;
|
|
65
|
+
readonly isNull: import("./shapes").ValidationRule;
|
|
66
|
+
readonly isNullOrUndefined: import("./shapes").ValidationRule;
|
|
67
|
+
readonly isTrue: import("./shapes").ValidationRule;
|
|
68
|
+
readonly isUrl: import("./shapes").ValidationRule;
|
|
69
|
+
readonly isUndefined: import("./shapes").ValidationRule;
|
|
70
|
+
readonly isUuid: import("./shapes").ValidationRule;
|
|
71
|
+
readonly itemsEqual: (exact: number) => import("./shapes").ValidationRule;
|
|
72
|
+
readonly keysEqual: (expectedKeys: readonly string[]) => import("./shapes").ValidationRule;
|
|
73
|
+
readonly lessThan: (limit: number) => import("./shapes").ValidationRule;
|
|
74
|
+
readonly matches: (pattern: RegExp) => import("./shapes").ValidationRule;
|
|
75
|
+
readonly max: (limit: number) => import("./shapes").ValidationRule;
|
|
76
|
+
readonly maxKeys: (maximum: number) => import("./shapes").ValidationRule;
|
|
77
|
+
readonly maxLength: (max: number) => import("./shapes").ValidationRule;
|
|
78
|
+
readonly min: (limit: number) => import("./shapes").ValidationRule;
|
|
79
|
+
readonly minKeys: (minimum: number) => import("./shapes").ValidationRule;
|
|
80
|
+
readonly minLength: (min: number) => import("./shapes").ValidationRule;
|
|
81
|
+
readonly missingKey: (requiredKeys: readonly string[]) => import("./shapes").ValidationRule;
|
|
82
|
+
readonly moreThan: (limit: number) => import("./shapes").ValidationRule;
|
|
83
|
+
readonly negative: import("./shapes").ValidationRule;
|
|
84
|
+
readonly noEmptyArrayValues: import("./shapes").ValidationRule;
|
|
85
|
+
readonly noEmptyObjectValues: import("./shapes").ValidationRule;
|
|
86
|
+
readonly noEmptyStringItems: import("./shapes").ValidationRule;
|
|
87
|
+
readonly noLeadSpace: import("./shapes").ValidationRule;
|
|
88
|
+
readonly noNullItems: import("./shapes").ValidationRule;
|
|
89
|
+
readonly noNullValues: import("./shapes").ValidationRule;
|
|
90
|
+
readonly noRepeatSpace: import("./shapes").ValidationRule;
|
|
91
|
+
readonly noSpace: import("./shapes").ValidationRule;
|
|
92
|
+
readonly noTrailSpace: import("./shapes").ValidationRule;
|
|
93
|
+
readonly noUndefinedItems: import("./shapes").ValidationRule;
|
|
94
|
+
readonly noUndefinedValues: import("./shapes").ValidationRule;
|
|
95
|
+
readonly nonEmpty: import("./shapes").ValidationRule;
|
|
96
|
+
readonly nonEmptyArray: import("./shapes").ValidationRule;
|
|
97
|
+
readonly nonEmptyObject: import("./shapes").ValidationRule;
|
|
98
|
+
readonly nonNegative: import("./shapes").ValidationRule;
|
|
99
|
+
readonly nonPositive: import("./shapes").ValidationRule;
|
|
100
|
+
readonly notAfter: (max: Date) => import("./shapes").ValidationRule;
|
|
101
|
+
readonly notBefore: (min: Date) => import("./shapes").ValidationRule;
|
|
102
|
+
readonly notOneOf: (disallowed: readonly string[]) => import("./shapes").ValidationRule;
|
|
103
|
+
readonly notSparse: import("./shapes").ValidationRule;
|
|
104
|
+
readonly number: import("./shapes").ValidationRule;
|
|
105
|
+
readonly numString: import("./shapes").ValidationRule;
|
|
106
|
+
readonly oneOf: (allowed: readonly string[]) => import("./shapes").ValidationRule;
|
|
107
|
+
readonly onlyKeys: (allowed: readonly string[]) => import("./shapes").ValidationRule;
|
|
108
|
+
readonly plainObject: import("./shapes").ValidationRule;
|
|
109
|
+
readonly positive: import("./shapes").ValidationRule;
|
|
110
|
+
readonly safeInteger: import("./shapes").ValidationRule;
|
|
111
|
+
readonly sameDay: (other: Date) => import("./shapes").ValidationRule;
|
|
112
|
+
readonly sameMonth: (other: Date) => import("./shapes").ValidationRule;
|
|
113
|
+
readonly sameYear: (other: Date) => import("./shapes").ValidationRule;
|
|
114
|
+
readonly startsWith: (prefix: string) => import("./shapes").ValidationRule;
|
|
115
|
+
readonly string: import("./shapes").ValidationRule;
|
|
116
|
+
readonly tooEarly: (min: Date) => import("./shapes").ValidationRule;
|
|
117
|
+
readonly tooLate: (max: Date) => import("./shapes").ValidationRule;
|
|
118
|
+
readonly trimmed: import("./shapes").ValidationRule;
|
|
119
|
+
readonly weekday: (required: number) => import("./shapes").ValidationRule;
|
|
120
|
+
readonly weekend: import("./shapes").ValidationRule;
|
|
121
|
+
};
|
|
122
|
+
readonly parsers: {
|
|
123
|
+
readonly numeric: import("./shapes").ParseRule<unknown>;
|
|
124
|
+
readonly integer: import("./shapes").ParseRule<unknown>;
|
|
125
|
+
readonly boolean: import("./shapes").ParseRule<unknown>;
|
|
126
|
+
readonly bigint: import("./shapes").ParseRule<unknown>;
|
|
127
|
+
readonly hex: import("./shapes").ParseRule<unknown>;
|
|
128
|
+
readonly binary: import("./shapes").ParseRule<unknown>;
|
|
129
|
+
readonly octal: import("./shapes").ParseRule<unknown>;
|
|
130
|
+
readonly date: import("./shapes").ParseRule<unknown>;
|
|
131
|
+
readonly json: import("./shapes").ParseRule<unknown>;
|
|
132
|
+
readonly array: import("./shapes").ParseRule<unknown>;
|
|
133
|
+
readonly object: import("./shapes").ParseRule<unknown>;
|
|
134
|
+
readonly url: import("./shapes").ParseRule<string>;
|
|
135
|
+
readonly duration: import("./shapes").ParseRule<unknown>;
|
|
136
|
+
readonly scientific: import("./shapes").ParseRule<unknown>;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Registry | Fluent
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Central registry of all built‑in validators and parsers.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
11
|
+
|* Parsers *|
|
|
12
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
13
|
+
import { parseArrayString, parseBigIntString, parseBinaryString, parseBooleanString, parseDurationString, parseHexString, parseIsoDateString, parseJsonString, parseNumericString, parseObjectString, parseOctalString, parseUrlString, } from './parsers';
|
|
14
|
+
import { parseIntegerString } from './parsers/parse-integer-string';
|
|
15
|
+
import { parseScientificNotationString } from './parsers/parse-scientific-notation-string';
|
|
16
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
17
|
+
|* Validators *|
|
|
18
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
19
|
+
import { alpha, alphaNum, array, arrayMaxItems, arrayMinItems, beforeEpoch, bigint, bigintEquals, bigintMax, bigintMin, bigintNegative, bigintNonNegative, bigintNonPositive, bigintPositive, bigintSafe, boolean, charsEqual, dateNowRequired, deepEquals, endsWith, excludes, finite, hasKey, hasUniqueItems, hasValue, includes, integer, isAscii, isCountryCode, isCurrencyCode, isDate, isEmail, isEmailStrict, isFalse, isFarFuture, isFuture, isIp, isNull, isNullOrUndefined, isPast, isPhone, isPhoneStrict, isPort, isPostalCode, isPrintable, isTrue, isUndefined, isUrl, isUuid, itemsEqual, keysEqual, lessThan, matches, max, maxLength, maxKeys, min, minLength, minKeys, missingKey, moreThan, negative, noEmptyArrayValues, noEmptyObjectValues, noEmptyStringItems, noNullItems, noNullValues, noUndefinedItems, noUndefinedValues, nonEmptyArray, nonEmptyObject, noLeadSpace, noRepeatSpace, noSpace, noTrailSpace, nonNegative, nonPositive, notAfter, notBefore, nonEmpty, notOneOf, notSparse, number, numString, oneOf, onlyKeys, plainObject, positive, safeInteger, sameDay, sameMonth, sameYear, startsWith, string, tooEarly, tooLate, trimmed, weekday, weekend, } from './validators';
|
|
20
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
21
|
+
|* Fluent API *|
|
|
22
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
23
|
+
/**
|
|
24
|
+
* Central registry of all built‑in Jane validators and parsers.
|
|
25
|
+
*
|
|
26
|
+
* This object provides a single, authoritative lookup table for every
|
|
27
|
+
* first‑party rule Jane ships with. Validators define how values are checked
|
|
28
|
+
* for correctness, while parsers convert raw input into structured forms.
|
|
29
|
+
* Keeping them together in one immutable registry ensures predictable
|
|
30
|
+
* resolution, consistent behavior across subsystems, and a stable surface
|
|
31
|
+
* for contributors extending or inspecting Jane’s rule set.
|
|
32
|
+
*/
|
|
33
|
+
export const janeRegistry = {
|
|
34
|
+
validators: {
|
|
35
|
+
alphaNum,
|
|
36
|
+
alpha,
|
|
37
|
+
array,
|
|
38
|
+
arrayMinItems,
|
|
39
|
+
arrayMaxItems,
|
|
40
|
+
beforeEpoch,
|
|
41
|
+
bigint,
|
|
42
|
+
bigintEquals,
|
|
43
|
+
bigintMax,
|
|
44
|
+
bigintMin,
|
|
45
|
+
bigintNegative,
|
|
46
|
+
bigintNonNegative,
|
|
47
|
+
bigintNonPositive,
|
|
48
|
+
bigintPositive,
|
|
49
|
+
bigintSafe,
|
|
50
|
+
boolean,
|
|
51
|
+
charsEqual,
|
|
52
|
+
dateNowRequired,
|
|
53
|
+
deepEquals,
|
|
54
|
+
endsWith,
|
|
55
|
+
excludes,
|
|
56
|
+
finite,
|
|
57
|
+
hasKey,
|
|
58
|
+
hasUniqueItems,
|
|
59
|
+
hasValue,
|
|
60
|
+
includes,
|
|
61
|
+
integer,
|
|
62
|
+
isAscii,
|
|
63
|
+
isCountryCode,
|
|
64
|
+
isCurrencyCode,
|
|
65
|
+
isDate,
|
|
66
|
+
isEmail,
|
|
67
|
+
isEmailStrict,
|
|
68
|
+
isFalse,
|
|
69
|
+
isFarFuture,
|
|
70
|
+
isFuture,
|
|
71
|
+
isIp,
|
|
72
|
+
isPast,
|
|
73
|
+
isPhone,
|
|
74
|
+
isPhoneStrict,
|
|
75
|
+
isPort,
|
|
76
|
+
isPostalCode,
|
|
77
|
+
isPrintable,
|
|
78
|
+
isNull,
|
|
79
|
+
isNullOrUndefined,
|
|
80
|
+
isTrue,
|
|
81
|
+
isUrl,
|
|
82
|
+
isUndefined,
|
|
83
|
+
isUuid,
|
|
84
|
+
itemsEqual,
|
|
85
|
+
keysEqual,
|
|
86
|
+
lessThan,
|
|
87
|
+
matches,
|
|
88
|
+
max,
|
|
89
|
+
maxKeys,
|
|
90
|
+
maxLength,
|
|
91
|
+
min,
|
|
92
|
+
minKeys,
|
|
93
|
+
minLength,
|
|
94
|
+
missingKey,
|
|
95
|
+
moreThan,
|
|
96
|
+
negative,
|
|
97
|
+
noEmptyArrayValues,
|
|
98
|
+
noEmptyObjectValues,
|
|
99
|
+
noEmptyStringItems,
|
|
100
|
+
noLeadSpace,
|
|
101
|
+
noNullItems,
|
|
102
|
+
noNullValues,
|
|
103
|
+
noRepeatSpace,
|
|
104
|
+
noSpace,
|
|
105
|
+
noTrailSpace,
|
|
106
|
+
noUndefinedItems,
|
|
107
|
+
noUndefinedValues,
|
|
108
|
+
nonEmpty,
|
|
109
|
+
nonEmptyArray,
|
|
110
|
+
nonEmptyObject,
|
|
111
|
+
nonNegative,
|
|
112
|
+
nonPositive,
|
|
113
|
+
notAfter,
|
|
114
|
+
notBefore,
|
|
115
|
+
notOneOf,
|
|
116
|
+
notSparse,
|
|
117
|
+
number,
|
|
118
|
+
numString,
|
|
119
|
+
oneOf,
|
|
120
|
+
onlyKeys,
|
|
121
|
+
plainObject,
|
|
122
|
+
positive,
|
|
123
|
+
safeInteger,
|
|
124
|
+
sameDay,
|
|
125
|
+
sameMonth,
|
|
126
|
+
sameYear,
|
|
127
|
+
startsWith,
|
|
128
|
+
string,
|
|
129
|
+
tooEarly,
|
|
130
|
+
tooLate,
|
|
131
|
+
trimmed,
|
|
132
|
+
weekday,
|
|
133
|
+
weekend,
|
|
134
|
+
},
|
|
135
|
+
parsers: {
|
|
136
|
+
numeric: parseNumericString,
|
|
137
|
+
integer: parseIntegerString,
|
|
138
|
+
boolean: parseBooleanString,
|
|
139
|
+
bigint: parseBigIntString,
|
|
140
|
+
hex: parseHexString,
|
|
141
|
+
binary: parseBinaryString,
|
|
142
|
+
octal: parseOctalString,
|
|
143
|
+
date: parseIsoDateString,
|
|
144
|
+
json: parseJsonString,
|
|
145
|
+
array: parseArrayString,
|
|
146
|
+
object: parseObjectString,
|
|
147
|
+
url: parseUrlString,
|
|
148
|
+
duration: parseDurationString,
|
|
149
|
+
scientific: parseScientificNotationString,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Compact Sparse Array
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes sparse array holes while preserving all defined
|
|
7
|
+
* elements, producing a dense structure without altering the
|
|
8
|
+
* array’s semantic content.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { NormalizationRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Compacts sparse arrays by removing empty slots while preserving all defined
|
|
15
|
+
* elements. This targets only structural holes—never values—ensuring arrays
|
|
16
|
+
* become dense without altering their semantic content.
|
|
17
|
+
*
|
|
18
|
+
* Useful for normalizing inputs that originate from user interfaces, spread
|
|
19
|
+
* operations, or partial constructions where sparse positions may appear
|
|
20
|
+
* unintentionally.
|
|
21
|
+
*/
|
|
22
|
+
export declare const compactSparseArray: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Compact Sparse Array
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes sparse array holes while preserving all defined
|
|
7
|
+
* elements, producing a dense structure without altering the
|
|
8
|
+
* array’s semantic content.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { normalizationEvent } from '../../pipeline';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Compacts sparse arrays by removing empty slots while preserving all defined
|
|
18
|
+
* elements. This targets only structural holes—never values—ensuring arrays
|
|
19
|
+
* become dense without altering their semantic content.
|
|
20
|
+
*
|
|
21
|
+
* Useful for normalizing inputs that originate from user interfaces, spread
|
|
22
|
+
* operations, or partial constructions where sparse positions may appear
|
|
23
|
+
* unintentionally.
|
|
24
|
+
*/
|
|
25
|
+
export const compactSparseArray = (value, _mode, path) => {
|
|
26
|
+
if (!Array.isArray(value))
|
|
27
|
+
return [];
|
|
28
|
+
const compacted = value.filter(() => true); // removes holes only
|
|
29
|
+
if (compacted.length === value.length)
|
|
30
|
+
return [];
|
|
31
|
+
const event = normalizationEvent('info', 'array.now.compacted', path, 'Removed sparse array holes.', 'Empty array slots were removed.', { before: value, after: compacted });
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
path,
|
|
35
|
+
nextValue: compacted,
|
|
36
|
+
lossy: 'lossless',
|
|
37
|
+
events: [event],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Empty String Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes empty string entries from arrays, eliminating
|
|
7
|
+
* placeholder or accidental text values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { NormalizationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Flattens nested arrays by a single level, simplifying structure while
|
|
14
|
+
* preserving item order. Useful for normalizing inputs where shallow nesting
|
|
15
|
+
* appears unintentionally.
|
|
16
|
+
*/
|
|
17
|
+
export declare const flattenOneLevel: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Empty String Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes empty string entries from arrays, eliminating
|
|
7
|
+
* placeholder or accidental text values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Flattens nested arrays by a single level, simplifying structure while
|
|
17
|
+
* preserving item order. Useful for normalizing inputs where shallow nesting
|
|
18
|
+
* appears unintentionally.
|
|
19
|
+
*/
|
|
20
|
+
export const flattenOneLevel = (value, _mode, path) => {
|
|
21
|
+
if (!Array.isArray(value))
|
|
22
|
+
return [];
|
|
23
|
+
let changed = false;
|
|
24
|
+
const flattened = [];
|
|
25
|
+
for (const item of value) {
|
|
26
|
+
if (Array.isArray(item)) {
|
|
27
|
+
changed = true;
|
|
28
|
+
flattened.push(...item);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
flattened.push(item);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!changed)
|
|
35
|
+
return [];
|
|
36
|
+
const event = normalizationEvent('info', 'array.now.flattened', path, 'Flattened nested arrays by one level.', 'Nested items were simplified.', { before: value, after: flattened });
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
path,
|
|
40
|
+
nextValue: flattened,
|
|
41
|
+
lossy: 'lossy',
|
|
42
|
+
events: [event],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NormalizationRule } from '../../shapes';
|
|
2
|
+
/**
|
|
3
|
+
* Removes empty string entries from arrays, eliminating placeholder or
|
|
4
|
+
* accidental text values while preserving all meaningful items.
|
|
5
|
+
*/
|
|
6
|
+
export declare const removeEmptyStringItems: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Empty String Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes empty string entries from arrays, eliminating
|
|
7
|
+
* placeholder or accidental text values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Removes empty string entries from arrays, eliminating placeholder or
|
|
17
|
+
* accidental text values while preserving all meaningful items.
|
|
18
|
+
*/
|
|
19
|
+
export const removeEmptyStringItems = (value, _mode, path) => {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return [];
|
|
22
|
+
const filtered = value.filter((v) => v !== '');
|
|
23
|
+
if (filtered.length === value.length)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'array.without.empty-strings', path, 'Removed empty string items from array.', 'Empty text items were removed.', { before: value, after: filtered });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: filtered,
|
|
30
|
+
lossy: 'lossy',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Null Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Filters out null entries from arrays, removing structurally
|
|
7
|
+
* empty items while preserving all defined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { NormalizationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Filters out null entries from arrays, removing structurally empty items
|
|
14
|
+
* without altering the order or meaning of defined values.
|
|
15
|
+
*/
|
|
16
|
+
export declare const removeNullItems: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Null Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Filters out null entries from arrays, removing structurally
|
|
7
|
+
* empty items while preserving all defined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Filters out null entries from arrays, removing structurally empty items
|
|
17
|
+
* without altering the order or meaning of defined values.
|
|
18
|
+
*/
|
|
19
|
+
export const removeNullItems = (value, _mode, path) => {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return [];
|
|
22
|
+
const filtered = value.filter((v) => v !== null);
|
|
23
|
+
if (filtered.length === value.length)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'array.without.null-items', path, 'Removed null items from array.', 'Empty items were removed.', { before: value, after: filtered });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: filtered,
|
|
30
|
+
lossy: 'lossy',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Undefined Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes undefined entries from arrays, producing a cleaner
|
|
7
|
+
* and more predictable sequence of defined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { NormalizationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Removes undefined entries from arrays, producing a cleaner and more
|
|
14
|
+
* predictable sequence of defined values.
|
|
15
|
+
*/
|
|
16
|
+
export declare const removeUndefinedItems: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Remove Undefined Items
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes undefined entries from arrays, producing a cleaner
|
|
7
|
+
* and more predictable sequence of defined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Removes undefined entries from arrays, producing a cleaner and more
|
|
17
|
+
* predictable sequence of defined values.
|
|
18
|
+
*/
|
|
19
|
+
export const removeUndefinedItems = (value, _mode, path) => {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return [];
|
|
22
|
+
const filtered = value.filter((v) => v !== undefined);
|
|
23
|
+
if (filtered.length === value.length)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'array.without.undefined-items', path, 'Removed undefined items from array.', 'Empty items were removed.', { before: value, after: filtered });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: filtered,
|
|
30
|
+
lossy: 'lossy',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Invalid Date To Undefined
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Converts invalid Date instances (timestamp NaN) to undefined,
|
|
7
|
+
* preventing malformed or unparsable date values from
|
|
8
|
+
* propagating through normalization.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { NormalizationRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Converts invalid Date instances (timestamp NaN) to undefined, ensuring that
|
|
15
|
+
* malformed or unparsable date values do not propagate through normalization.
|
|
16
|
+
*/
|
|
17
|
+
export declare const invalidDateToUndefined: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Invalid Date To Undefined
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Converts invalid Date instances (timestamp NaN) to undefined,
|
|
7
|
+
* preventing malformed or unparsable date values from
|
|
8
|
+
* propagating through normalization.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { normalizationEvent } from '../../pipeline';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Converts invalid Date instances (timestamp NaN) to undefined, ensuring that
|
|
18
|
+
* malformed or unparsable date values do not propagate through normalization.
|
|
19
|
+
*/
|
|
20
|
+
export const invalidDateToUndefined = (value, _mode, path) => {
|
|
21
|
+
if (!(value instanceof Date))
|
|
22
|
+
return [];
|
|
23
|
+
// Invalid Date → timestamp is NaN
|
|
24
|
+
if (!Number.isNaN(value.getTime()))
|
|
25
|
+
return [];
|
|
26
|
+
const event = normalizationEvent('info', 'date.now.undefined', path, 'Converted an invalid Date instance to undefined.', 'Invalid date values were removed.', { before: value, after: undefined });
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
path,
|
|
30
|
+
nextValue: undefined,
|
|
31
|
+
lossy: 'lossy',
|
|
32
|
+
events: [event],
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports all normalization rules, providing a single,
|
|
7
|
+
* consolidated entry point for the normalization subsystem.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
export { compactSparseArray } from './array/compact-sparse-array';
|
|
12
|
+
export { flattenOneLevel } from './array/flatten-one-level';
|
|
13
|
+
export { removeEmptyStringItems } from './array/remove-empty-string-items';
|
|
14
|
+
export { removeNullItems } from './array/remove-null-items';
|
|
15
|
+
export { removeUndefinedItems } from './array/remove-undefined-items';
|
|
16
|
+
export { invalidDateToUndefined } from './date/invalid-date-to-undefined';
|
|
17
|
+
export { infinityToUndefined } from './number/infinity-to-undefined';
|
|
18
|
+
export { nanToUndefined } from './number/nan-to-undefined';
|
|
19
|
+
export { normalizeNegativeZero } from './number/normalize-negative-zero';
|
|
20
|
+
export { removeEmptyArrayKeys } from './object/remove-empty-array-keys';
|
|
21
|
+
export { removeEmptyObjectKeys } from './object/remove-empty-object-keys';
|
|
22
|
+
export { removeEmptyStringKeys } from './object/remove-empty-string-keys';
|
|
23
|
+
export { removeNullKeys } from './object/remove-null-keys';
|
|
24
|
+
export { removeUndefinedKeys } from './object/remove-undefined-keys';
|
|
25
|
+
export { collapseWhitespace } from './string/collapse-whitespace';
|
|
26
|
+
export { emptyToUndefined } from './string/empty-to-undefined';
|
|
27
|
+
export { trim } from './string/trim';
|
|
28
|
+
export { normalizationRuleRegistry } from './normalizer-register';
|