@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,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Validate
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Evaluates the normalized value and emits rule‑driven
|
|
7
|
+
* correctness events.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { createEvent } from '../common';
|
|
12
|
+
import { rootPath } from '../field-path';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Is Validation Factory *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether a fluent validator entry is a factory.
|
|
18
|
+
*
|
|
19
|
+
* Factories accept arbitrary parameters and return a ValidationRule,
|
|
20
|
+
* distinguishing them from fixed‑signature fluent validators.
|
|
21
|
+
*/
|
|
22
|
+
export function isValidationFactory(fn) {
|
|
23
|
+
// A factory returns a ValidationRule when called with ANY args
|
|
24
|
+
return typeof fn === 'function' && fn.length !== 2;
|
|
25
|
+
}
|
|
26
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
27
|
+
|* Is Fluent Validator *|
|
|
28
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether a fluent validator entry is a direct validation rule.
|
|
31
|
+
*
|
|
32
|
+
* Fluent validators always expose a two‑argument signature—value and path—
|
|
33
|
+
* making them distinguishable from parameterized factories.
|
|
34
|
+
*/
|
|
35
|
+
export function isFluentValidator(fn) {
|
|
36
|
+
return typeof fn === 'function' && fn.length === 2;
|
|
37
|
+
}
|
|
38
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
39
|
+
|* Validation Event *|
|
|
40
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
41
|
+
/**
|
|
42
|
+
* Creates a validation‑stage event.
|
|
43
|
+
*
|
|
44
|
+
* Wraps createEvent with the 'validate' phase tag, producing correctness‑
|
|
45
|
+
* focused messages emitted during rule evaluation.
|
|
46
|
+
*/
|
|
47
|
+
export const validationEvent = (kind, code, path, message, userMessage, meta) => createEvent('validate', kind, code, path, message, userMessage, meta);
|
|
48
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
49
|
+
|* Validation Runner *|
|
|
50
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
51
|
+
/**
|
|
52
|
+
* Executes the validation stage.
|
|
53
|
+
*
|
|
54
|
+
* Applies each validation rule to the value, collects all emitted events,
|
|
55
|
+
* and records fatal errors when rules throw. Produces the complete set of
|
|
56
|
+
* correctness observations for the stage.
|
|
57
|
+
*/
|
|
58
|
+
export const validationRunner = async (input) => {
|
|
59
|
+
const { value, path: inputPath, rules } = input;
|
|
60
|
+
const path = inputPath ?? rootPath();
|
|
61
|
+
const events = [];
|
|
62
|
+
for (const rule of rules) {
|
|
63
|
+
try {
|
|
64
|
+
const emitted = await rule(value, path);
|
|
65
|
+
if (emitted && emitted.length > 0) {
|
|
66
|
+
events.push(...emitted);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
events.push(createEvent('validate', 'fatal', 'error.while.validating', path, String(err)));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { events };
|
|
74
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Scan For Sentinels
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects sentinel markers in raw input and emits structural‑
|
|
7
|
+
* hazard events.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects containment sentinels produced during safe‑clone operations.
|
|
14
|
+
*
|
|
15
|
+
* Flags any sentinel string as a fatal structural hazard, emitting a
|
|
16
|
+
* scan event that identifies the hazard code and the original sentinel
|
|
17
|
+
* value for downstream analysis and policy decisions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const scanForSentinels: ScanRule;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Scan For Sentinels
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects sentinel markers in raw input and emits structural‑
|
|
7
|
+
* hazard events.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
12
|
+
|* Internal Modules *|
|
|
13
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
14
|
+
import { isSentinel, sentinelEvent } from '../../../core/pipeline';
|
|
15
|
+
import { scanEvent } from '../../pipeline';
|
|
16
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
17
|
+
|* Implementation *|
|
|
18
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
19
|
+
/**
|
|
20
|
+
* Detects containment sentinels produced during safe‑clone operations.
|
|
21
|
+
*
|
|
22
|
+
* Flags any sentinel string as a fatal structural hazard, emitting a
|
|
23
|
+
* scan event that identifies the hazard code and the original sentinel
|
|
24
|
+
* value for downstream analysis and policy decisions.
|
|
25
|
+
*/
|
|
26
|
+
export const scanForSentinels = (raw, path) => {
|
|
27
|
+
if (typeof raw !== 'string')
|
|
28
|
+
return [];
|
|
29
|
+
if (!isSentinel(raw))
|
|
30
|
+
return [];
|
|
31
|
+
const meta = sentinelEvent(raw);
|
|
32
|
+
return [
|
|
33
|
+
scanEvent('fatal', 'value.was.contained', path, `Structural hazard detected: ${meta.code}.`, 'A structural hazard was detected in the input.', { sentinel: raw, hazard: meta.code }),
|
|
34
|
+
];
|
|
35
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Deep
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects arrays nested beyond a safe structural depth and
|
|
7
|
+
* emits a warning event.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Warns when an array is nested beyond a safe structural depth.
|
|
14
|
+
*
|
|
15
|
+
* Walks down the first element chain to estimate nesting. If the depth
|
|
16
|
+
* exceeds the conservative threshold, emits a warning describing the
|
|
17
|
+
* observed and allowed depth.
|
|
18
|
+
*/
|
|
19
|
+
export declare const arrayIsDeep: ScanRule;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Deep
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects arrays nested beyond a safe structural depth and
|
|
7
|
+
* emits a warning event.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { scanEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Warns when an array is nested beyond a safe structural depth.
|
|
17
|
+
*
|
|
18
|
+
* Walks down the first element chain to estimate nesting. If the depth
|
|
19
|
+
* exceeds the conservative threshold, emits a warning describing the
|
|
20
|
+
* observed and allowed depth.
|
|
21
|
+
*/
|
|
22
|
+
export const arrayIsDeep = (raw, path) => {
|
|
23
|
+
if (!Array.isArray(raw))
|
|
24
|
+
return [];
|
|
25
|
+
const maxDepth = 20;
|
|
26
|
+
let depth = 0;
|
|
27
|
+
let current = raw;
|
|
28
|
+
while (Array.isArray(current)) {
|
|
29
|
+
depth++;
|
|
30
|
+
if (depth > maxDepth) {
|
|
31
|
+
return [
|
|
32
|
+
scanEvent('warn', 'array.is.deep', path, `Array nesting depth exceeds safe threshold ${maxDepth}.`, 'This list is nested too deeply.', { depth, maxDepth }),
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
current = current[0];
|
|
36
|
+
}
|
|
37
|
+
return [];
|
|
38
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Heterogeneous
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when an array contains mixed structural types,
|
|
7
|
+
* indicating inconsistent data shape.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Flags arrays whose length exceeds a conservative safety threshold.
|
|
14
|
+
*
|
|
15
|
+
* Emits a warning when the list is unusually large, helping prevent
|
|
16
|
+
* excessive memory usage or pathological input shapes during scanning.
|
|
17
|
+
*/
|
|
18
|
+
export declare const arrayIsHeterogeneous: ScanRule;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Heterogeneous
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when an array contains mixed structural types,
|
|
7
|
+
* indicating inconsistent data shape.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
12
|
+
|* Internal Modules *|
|
|
13
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
14
|
+
import { detectStructuralType } from '../../../core/pipeline';
|
|
15
|
+
import { scanEvent } from '../../pipeline';
|
|
16
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
17
|
+
|* Implementation *|
|
|
18
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
19
|
+
/**
|
|
20
|
+
* Flags arrays whose length exceeds a conservative safety threshold.
|
|
21
|
+
*
|
|
22
|
+
* Emits a warning when the list is unusually large, helping prevent
|
|
23
|
+
* excessive memory usage or pathological input shapes during scanning.
|
|
24
|
+
*/
|
|
25
|
+
export const arrayIsHeterogeneous = (raw, path) => {
|
|
26
|
+
if (!Array.isArray(raw))
|
|
27
|
+
return [];
|
|
28
|
+
if (raw.length < 2)
|
|
29
|
+
return [];
|
|
30
|
+
const firstType = detectStructuralType(raw[0]);
|
|
31
|
+
for (let i = 1; i < raw.length; i++) {
|
|
32
|
+
if (detectStructuralType(raw[i]) !== firstType) {
|
|
33
|
+
return [
|
|
34
|
+
scanEvent('warn', 'array.is.heterogeneous', path, 'Array contains mixed element types.', 'This list contains different kinds of values.', { firstType, mixedType: detectStructuralType(raw[i]) }),
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
39
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags arrays whose length exceeds a conservative safety
|
|
7
|
+
* threshold.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects containment sentinels produced during safe‑clone operations.
|
|
14
|
+
*
|
|
15
|
+
* Flags any sentinel string as a fatal structural hazard, emitting a
|
|
16
|
+
* scan event that identifies the hazard code and the original sentinel
|
|
17
|
+
* value for downstream analysis and policy decisions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const arrayIsLarge: ScanRule;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags arrays whose length exceeds a conservative safety
|
|
7
|
+
* threshold.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { scanEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Detects containment sentinels produced during safe‑clone operations.
|
|
17
|
+
*
|
|
18
|
+
* Flags any sentinel string as a fatal structural hazard, emitting a
|
|
19
|
+
* scan event that identifies the hazard code and the original sentinel
|
|
20
|
+
* value for downstream analysis and policy decisions.
|
|
21
|
+
*/
|
|
22
|
+
export const arrayIsLarge = (raw, path) => {
|
|
23
|
+
if (!Array.isArray(raw))
|
|
24
|
+
return [];
|
|
25
|
+
const max = 10_000;
|
|
26
|
+
if (raw.length > max) {
|
|
27
|
+
return [
|
|
28
|
+
scanEvent('warn', 'array.is.large', path, `Array length ${raw.length} exceeds safe threshold ${max}.`, 'This list is very large.', { length: raw.length, max }),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Bigint Is Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags BigInt values that fall outside JavaScript’s safe
|
|
7
|
+
* integer range, surfacing numbers that cannot be reliably
|
|
8
|
+
* represented or compared using standard numeric APIs.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { ScanRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Flags `BigInt` values whose bit‑length exceeds a safe structural boundary.
|
|
15
|
+
*
|
|
16
|
+
* Extremely large integers can stress memory, break downstream serializers,
|
|
17
|
+
* and indicate adversarial or malformed input. This rule surfaces oversized
|
|
18
|
+
* values early so validators and policy layers can decide how to handle them.
|
|
19
|
+
*/
|
|
20
|
+
export declare const bigintIsLarge: ScanRule;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Bigint Is Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags BigInt values that fall outside JavaScript’s safe
|
|
7
|
+
* integer range, surfacing numbers that cannot be reliably
|
|
8
|
+
* represented or compared using standard numeric APIs.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { scanEvent } from '../../pipeline';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Flags `BigInt` values whose bit‑length exceeds a safe structural boundary.
|
|
18
|
+
*
|
|
19
|
+
* Extremely large integers can stress memory, break downstream serializers,
|
|
20
|
+
* and indicate adversarial or malformed input. This rule surfaces oversized
|
|
21
|
+
* values early so validators and policy layers can decide how to handle them.
|
|
22
|
+
*/
|
|
23
|
+
export const bigintIsLarge = (raw, path) => {
|
|
24
|
+
if (typeof raw !== 'bigint')
|
|
25
|
+
return [];
|
|
26
|
+
const maxBits = 2048;
|
|
27
|
+
const bitLength = raw === 0n ? 1 : raw.toString(2).length;
|
|
28
|
+
if (bitLength > maxBits) {
|
|
29
|
+
return [
|
|
30
|
+
scanEvent('warn', 'bigint.is.large', path, `BigInt exceeds safe bit-length threshold ${maxBits} bits.`, 'This number is too large to safely handle.', { bitLength, maxBits }),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Bigint Not Safe
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects BigInt values whose bit-length exceeds a safe
|
|
7
|
+
* structural threshold, highlighting oversized or adversarial
|
|
8
|
+
* integers before deeper validation occurs.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { ScanRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Flags `BigInt` values that fall outside JavaScript’s safe integer range.
|
|
15
|
+
*
|
|
16
|
+
* While `BigInt` itself is unbounded, many systems assume values remain within
|
|
17
|
+
* the safe `number` range for interoperability. This rule highlights integers
|
|
18
|
+
* that cannot be safely represented or compared using standard numeric APIs.
|
|
19
|
+
*/
|
|
20
|
+
export declare const bigintNotSafe: ScanRule;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Bigint Not Safe
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects BigInt values whose bit-length exceeds a safe
|
|
7
|
+
* structural threshold, highlighting oversized or adversarial
|
|
8
|
+
* integers before deeper validation occurs.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import { scanEvent } from '../../pipeline';
|
|
13
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
14
|
+
|* Implementation *|
|
|
15
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
16
|
+
/**
|
|
17
|
+
* Flags `BigInt` values that fall outside JavaScript’s safe integer range.
|
|
18
|
+
*
|
|
19
|
+
* While `BigInt` itself is unbounded, many systems assume values remain within
|
|
20
|
+
* the safe `number` range for interoperability. This rule highlights integers
|
|
21
|
+
* that cannot be safely represented or compared using standard numeric APIs.
|
|
22
|
+
*/
|
|
23
|
+
export const bigintNotSafe = (raw, path) => {
|
|
24
|
+
if (typeof raw !== 'bigint')
|
|
25
|
+
return [];
|
|
26
|
+
const maxSafe = BigInt(Number.MAX_SAFE_INTEGER);
|
|
27
|
+
const minSafe = BigInt(Number.MIN_SAFE_INTEGER);
|
|
28
|
+
if (raw > maxSafe || raw < minSafe) {
|
|
29
|
+
return [
|
|
30
|
+
scanEvent('warn', 'bigint.not.safe', path, 'BigInt exceeds JavaScript safe integer range.', 'This number is outside the safe range.', { value: raw.toString(), maxSafe, minSafe }),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Before Epoch
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags Date values that occur before the Unix epoch,
|
|
7
|
+
* surfacing malformed or legacy timestamps early in scanning.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Flags Date values that occur before the Unix epoch (1970‑01‑01).
|
|
14
|
+
*
|
|
15
|
+
* Dates earlier than the epoch often indicate malformed input, legacy
|
|
16
|
+
* serialization issues, or unexpected coercions. This rule surfaces those
|
|
17
|
+
* anomalies early so downstream validators can respond appropriately.
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateIsBeforeEpoch: ScanRule;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Before Epoch
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags Date values that occur before the Unix epoch,
|
|
7
|
+
* surfacing malformed or legacy timestamps early in scanning.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { scanEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Flags Date values that occur before the Unix epoch (1970‑01‑01).
|
|
17
|
+
*
|
|
18
|
+
* Dates earlier than the epoch often indicate malformed input, legacy
|
|
19
|
+
* serialization issues, or unexpected coercions. This rule surfaces those
|
|
20
|
+
* anomalies early so downstream validators can respond appropriately.
|
|
21
|
+
*/
|
|
22
|
+
export const dateIsBeforeEpoch = (raw, path) => {
|
|
23
|
+
if (!(raw instanceof Date))
|
|
24
|
+
return [];
|
|
25
|
+
const epoch = 0;
|
|
26
|
+
if (raw.getTime() < epoch) {
|
|
27
|
+
return [
|
|
28
|
+
scanEvent('warn', 'date.is.before-epoch', path, 'Date occurs before Unix epoch (1970-01-01).', 'This date is earlier than 1970.', { timestamp: raw.getTime(), epoch }),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Far Future
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects Date values that fall far beyond a safe future
|
|
7
|
+
* boundary, highlighting unrealistic or adversarial timestamps.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects Date values that fall far beyond a conservative future boundary.
|
|
14
|
+
*
|
|
15
|
+
* Extremely future‑dated timestamps can signal corrupted data, unrealistic
|
|
16
|
+
* scheduling values, or adversarial input. This rule highlights such values
|
|
17
|
+
* before they propagate into business logic or policy layers.
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateIsFarFuture: ScanRule;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Far Future
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects Date values that fall far beyond a safe future
|
|
7
|
+
* boundary, highlighting unrealistic or adversarial timestamps.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { scanEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Detects Date values that fall far beyond a conservative future boundary.
|
|
17
|
+
*
|
|
18
|
+
* Extremely future‑dated timestamps can signal corrupted data, unrealistic
|
|
19
|
+
* scheduling values, or adversarial input. This rule highlights such values
|
|
20
|
+
* before they propagate into business logic or policy layers.
|
|
21
|
+
*/
|
|
22
|
+
export const dateIsFarFuture = (raw, path) => {
|
|
23
|
+
if (!(raw instanceof Date))
|
|
24
|
+
return [];
|
|
25
|
+
const max = new Date('2100-01-01T00:00:00.000Z').getTime();
|
|
26
|
+
if (raw.getTime() > max) {
|
|
27
|
+
return [
|
|
28
|
+
scanEvent('warn', 'date.is.far-future', path, 'Date occurs far in the future beyond safe bounds.', 'This date is far in the future.', { timestamp: raw.getTime(), max }),
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Invalid
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when a Date instance resolves to an invalid timestamp,
|
|
7
|
+
* ensuring parsing failures are surfaced explicitly.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Warns when a Date instance resolves to an invalid (NaN) timestamp.
|
|
14
|
+
*
|
|
15
|
+
* Invalid Date objects commonly arise from parsing failures or unexpected
|
|
16
|
+
* transformations. This rule ensures they are surfaced explicitly rather than
|
|
17
|
+
* silently passing through the scan pipeline.
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateIsInvalid: ScanRule;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Invalid
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when a Date instance resolves to an invalid timestamp,
|
|
7
|
+
* ensuring parsing failures are surfaced explicitly.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { scanEvent } from '../../pipeline';
|
|
12
|
+
/* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* ——— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ————— * ——— */
|
|
15
|
+
/**
|
|
16
|
+
* Warns when a Date instance resolves to an invalid (NaN) timestamp.
|
|
17
|
+
*
|
|
18
|
+
* Invalid Date objects commonly arise from parsing failures or unexpected
|
|
19
|
+
* transformations. This rule ensures they are surfaced explicitly rather than
|
|
20
|
+
* silently passing through the scan pipeline.
|
|
21
|
+
*/
|
|
22
|
+
export const dateIsInvalid = (raw, path) => {
|
|
23
|
+
if (!(raw instanceof Date))
|
|
24
|
+
return [];
|
|
25
|
+
if (Number.isNaN(raw.getTime())) {
|
|
26
|
+
return [
|
|
27
|
+
scanEvent('warn', 'date.is.invalid', path, 'Date value is invalid (NaN timestamp).', 'This date is not valid.', { value: raw }),
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
return [];
|
|
31
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports all scanner modules, providing a single,
|
|
7
|
+
* consolidated entry point for the scanning subsystem.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
export { scanForSentinels } from './any/scan-for-sentinels';
|
|
12
|
+
export { arrayIsDeep } from './array/array-is-deep';
|
|
13
|
+
export { arrayIsHeterogeneous } from './array/array-is-heterogenous';
|
|
14
|
+
export { arrayIsLarge } from './array/array-is-large';
|
|
15
|
+
export { bigintIsLarge } from './bigint/bigint-is-large';
|
|
16
|
+
export { bigintNotSafe } from './bigint/bigint-not-safe';
|
|
17
|
+
export { dateIsBeforeEpoch } from './date/date-is-before-epoch';
|
|
18
|
+
export { dateIsFarFuture } from './date/date-is-far-future';
|
|
19
|
+
export { dateIsInvalid } from './date/date-is-invalid';
|
|
20
|
+
export { numberIsInfinite } from './number/number-is-infinite';
|
|
21
|
+
export { numberIsNaN } from './number/number-is-nan';
|
|
22
|
+
export { numberIsTooLarge } from './number/number-is-too-large';
|
|
23
|
+
export { numberIsUnsafeInteger } from './number/number-is-unsafe-integer';
|
|
24
|
+
export { objectHasCircularReferences } from './object/object-has-circular-references';
|
|
25
|
+
export { objectHasManyKeys } from './object/object-has-many-keys';
|
|
26
|
+
export { objectIsDeep } from './object/object-is-deep';
|
|
27
|
+
export { stringHasUnsafeUnicode } from './string/string-has-unsafe-unicode';
|
|
28
|
+
export { stringHasWhitespaceEdges } from './string/string-has-whitespace-edges';
|
|
29
|
+
export { stringIsLong } from './string/string-is-long';
|
|
30
|
+
export { unknownNotScannable } from './unknown/unknown-not-scannable';
|
|
31
|
+
export { scanRuleRegistry } from './scanner-registry';
|