@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,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Empty To Undefined
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Converts empty strings to undefined, removing text fields
|
|
7
|
+
* that contain no meaningful content.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Converts empty strings to undefined, removing text fields that contain no
|
|
17
|
+
* meaningful content.
|
|
18
|
+
*/
|
|
19
|
+
export const emptyToUndefined = (value, _mode, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
if (value.length > 0)
|
|
23
|
+
return [];
|
|
24
|
+
const event = normalizationEvent('info', 'string.now.undefined', path, 'Converted empty string to undefined.', 'Empty text was removed.', { before: value, after: undefined });
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
path,
|
|
28
|
+
nextValue: undefined,
|
|
29
|
+
lossy: 'lossy',
|
|
30
|
+
events: [event],
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Trim
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes leading and trailing whitespace, normalizing text
|
|
7
|
+
* edges while preserving internal content exactly as provided.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { NormalizationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Trims leading and trailing whitespace, normalizing text edges while
|
|
14
|
+
* preserving the internal content exactly as provided.
|
|
15
|
+
*/
|
|
16
|
+
export declare const trim: NormalizationRule<unknown>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Normalizers | Trim
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Removes leading and trailing whitespace, normalizing text
|
|
7
|
+
* edges while preserving internal content exactly as provided.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { normalizationEvent } from '../../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Trims leading and trailing whitespace, normalizing text edges while
|
|
17
|
+
* preserving the internal content exactly as provided.
|
|
18
|
+
*/
|
|
19
|
+
export const trim = (value, _mode, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (trimmed === value)
|
|
24
|
+
return [];
|
|
25
|
+
const event = normalizationEvent('info', 'string.now.trimmed', path, 'Removed leading and trailing whitespace.', 'Extra spaces at the beginning or end were removed.', { before: value, after: trimmed });
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
path,
|
|
29
|
+
nextValue: trimmed,
|
|
30
|
+
lossy: 'lossless',
|
|
31
|
+
events: [event],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Reβexports all parser implementations, providing a unified
|
|
7
|
+
* entry point for Janeβs parsing subsystem.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
export { parseArrayString } from './parse-array-string';
|
|
12
|
+
export { parseJsonString } from './parse-json-string';
|
|
13
|
+
export { parseBigIntString } from './parse-bigint-string';
|
|
14
|
+
export { parseBinaryString } from './parse-binary-string';
|
|
15
|
+
export { parseHexString } from './parse-hex-string';
|
|
16
|
+
export { parseOctalString } from './parse-octal-string';
|
|
17
|
+
export { parseBooleanString } from './parse-boolean-string';
|
|
18
|
+
export { parseIsoDateString } from './parse-date-string';
|
|
19
|
+
export { parseDurationString } from './parse-duration-string';
|
|
20
|
+
export { parseNumericString } from './parse-numeric-string';
|
|
21
|
+
export { parseObjectString } from './parse-object-string';
|
|
22
|
+
export { parseUrlString } from './parse-url-string';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Reβexports all parser implementations, providing a unified
|
|
7
|
+
* entry point for Janeβs parsing subsystem.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
12
|
+
|* Array Values *|
|
|
13
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
14
|
+
export { parseArrayString } from './parse-array-string';
|
|
15
|
+
export { parseJsonString } from './parse-json-string';
|
|
16
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
17
|
+
|* Bigint Values *|
|
|
18
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
19
|
+
export { parseBigIntString } from './parse-bigint-string';
|
|
20
|
+
export { parseBinaryString } from './parse-binary-string';
|
|
21
|
+
export { parseHexString } from './parse-hex-string';
|
|
22
|
+
export { parseOctalString } from './parse-octal-string';
|
|
23
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
24
|
+
|* Boolean Values *|
|
|
25
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
26
|
+
export { parseBooleanString } from './parse-boolean-string';
|
|
27
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
28
|
+
|* Date Values *|
|
|
29
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
30
|
+
export { parseIsoDateString } from './parse-date-string';
|
|
31
|
+
export { parseDurationString } from './parse-duration-string';
|
|
32
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
33
|
+
|* Number Values *|
|
|
34
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
35
|
+
export { parseNumericString } from './parse-numeric-string';
|
|
36
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
37
|
+
|* Object Values *|
|
|
38
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
39
|
+
export { parseObjectString } from './parse-object-string';
|
|
40
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
41
|
+
|* URL Values *|
|
|
42
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
43
|
+
export { parseUrlString } from './parse-url-string';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Array String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses JSONβcompatible array strings into actual arrays,
|
|
7
|
+
* rejecting ambiguous or nonβarray input.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses JSONβcompatible array strings into actual arrays, rejecting anything
|
|
14
|
+
* that is not a syntactically valid array literal.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseArrayString: ParseRule<unknown>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Array String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses JSONβcompatible array strings into actual arrays,
|
|
7
|
+
* rejecting ambiguous or nonβarray input.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses JSONβcompatible array strings into actual arrays, rejecting anything
|
|
17
|
+
* that is not a syntactically valid array literal.
|
|
18
|
+
*/
|
|
19
|
+
export const parseArrayString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (!trimmed.startsWith('[') || !trimmed.endsWith(']'))
|
|
24
|
+
return [];
|
|
25
|
+
let parsed;
|
|
26
|
+
try {
|
|
27
|
+
parsed = JSON.parse(trimmed);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
if (!Array.isArray(parsed))
|
|
33
|
+
return [];
|
|
34
|
+
const event = parseEvent('info', 'string.now.array', 'Parsed string into a JSON array.', path, 'Converted text into a list.', { before: value, after: parsed });
|
|
35
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
36
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Bigint String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses canonical decimal bigint literals into `bigint`
|
|
7
|
+
* values, enforcing strict, nonβguessing numeric rules.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses canonical decimal bigint strings into `bigint` values, enforcing a
|
|
14
|
+
* strict digitsβonly format with an optional leading minus.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseBigIntString: ParseRule<unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Bigint String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses canonical decimal bigint literals into `bigint`
|
|
7
|
+
* values, enforcing strict, nonβguessing numeric rules.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses canonical decimal bigint strings into `bigint` values, enforcing a
|
|
17
|
+
* strict digitsβonly format with an optional leading minus.
|
|
18
|
+
*/
|
|
19
|
+
export const parseBigIntString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
if (!/^-?\d+$/.test(value))
|
|
23
|
+
return [];
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
parsed = BigInt(value);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const event = parseEvent('info', 'string.now.bigint', `String parsed into bigint ${parsed}.`, path, 'Converted text into a large integer.', { before: value, after: parsed });
|
|
32
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Binary String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses binary string literals (0bβ¦) into `bigint` values,
|
|
7
|
+
* validating format and rejecting malformed input.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses binary string literals (`0bβ¦`) into `bigint` values, validating format
|
|
14
|
+
* and rejecting malformed or nonβbinary input.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseBinaryString: ParseRule<unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Binary String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses binary string literals (0bβ¦) into `bigint` values,
|
|
7
|
+
* validating format and rejecting malformed input.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses binary string literals (`0bβ¦`) into `bigint` values, validating format
|
|
17
|
+
* and rejecting malformed or nonβbinary input.
|
|
18
|
+
*/
|
|
19
|
+
export const parseBinaryString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
if (!/^0b[01]+$/.test(value))
|
|
23
|
+
return [];
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
parsed = BigInt(value);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const event = parseEvent('info', 'string.now.binary', `Binary string parsed into bigint ${parsed}.`, path, 'Converted binary text into a number.', { before: value, after: parsed });
|
|
32
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Boolean String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict boolean strings (`"true"` / `"false"`) into
|
|
7
|
+
* boolean values without accepting loose or coercive forms.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses strict boolean strings (`"true"` or `"false"`) into boolean values,
|
|
14
|
+
* without accepting loose or coercive forms.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseBooleanString: ParseRule<unknown>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Boolean String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict boolean strings (`"true"` / `"false"`) into
|
|
7
|
+
* boolean values without accepting loose or coercive forms.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses strict boolean strings (`"true"` or `"false"`) into boolean values,
|
|
17
|
+
* without accepting loose or coercive forms.
|
|
18
|
+
*/
|
|
19
|
+
export const parseBooleanString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
if (value !== 'true' && value !== 'false')
|
|
23
|
+
return [];
|
|
24
|
+
const parsed = value === 'true';
|
|
25
|
+
const event = parseEvent('info', 'string.now.boolean', `String parsed into boolean ${parsed}.`, path, 'Converted text into true or false.', { before: value, after: parsed });
|
|
26
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse ISO Date String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict ISOβ8601 date strings into `Date` objects,
|
|
7
|
+
* rejecting malformed or nonβstandard formats.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses strict ISOβ8601 date strings into `Date` objects, rejecting malformed
|
|
14
|
+
* or nonβstandard formats and ensuring the resulting timestamp is valid.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseIsoDateString: ParseRule<unknown>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse ISO Date String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict ISOβ8601 date strings into `Date` objects,
|
|
7
|
+
* rejecting malformed or nonβstandard formats.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses strict ISOβ8601 date strings into `Date` objects, rejecting malformed
|
|
17
|
+
* or nonβstandard formats and ensuring the resulting timestamp is valid.
|
|
18
|
+
*/
|
|
19
|
+
export const parseIsoDateString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
const iso = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,3})?)?(?:Z|[+-]\d{2}:\d{2})?)?$/;
|
|
23
|
+
if (!iso.test(value))
|
|
24
|
+
return [];
|
|
25
|
+
const parsed = new Date(value);
|
|
26
|
+
if (Number.isNaN(parsed.getTime()))
|
|
27
|
+
return [];
|
|
28
|
+
const event = parseEvent('info', 'string.now.date', `String parsed into Date ${parsed.toISOString()}.`, path, 'Converted text into a date.', { before: value, after: parsed });
|
|
29
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
30
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Duration String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses duration strings of the form `<number><unit>` (s, m,
|
|
7
|
+
* h, d) into structured duration objects.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses duration strings of the form `<number><unit>` (s, m, h, d) into
|
|
14
|
+
* structured duration objects, rejecting ambiguous or partial formats.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseDurationString: ParseRule<unknown>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Duration String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses duration strings of the form `<number><unit>` (s, m,
|
|
7
|
+
* h, d) into structured duration objects.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses duration strings of the form `<number><unit>` (s, m, h, d) into
|
|
17
|
+
* structured duration objects, rejecting ambiguous or partial formats.
|
|
18
|
+
*/
|
|
19
|
+
export const parseDurationString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
// Strict: number + unit (s, m, h, d)
|
|
23
|
+
const match = /^(-?\d+)([smhd])$/.exec(value);
|
|
24
|
+
if (!match)
|
|
25
|
+
return [];
|
|
26
|
+
const amount = Number(match[1]);
|
|
27
|
+
const unit = match[2];
|
|
28
|
+
const parsed = unit === 's'
|
|
29
|
+
? { seconds: amount }
|
|
30
|
+
: unit === 'm'
|
|
31
|
+
? { minutes: amount }
|
|
32
|
+
: unit === 'h'
|
|
33
|
+
? { hours: amount }
|
|
34
|
+
: { days: amount };
|
|
35
|
+
const event = parseEvent('info', 'string.now.duration', `String parsed into duration object (${JSON.stringify(parsed)}).`, path, 'Converted text into a time duration.', { before: value, after: parsed });
|
|
36
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
37
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Hex String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses hexadecimal string literals (0xβ¦) into `bigint`
|
|
7
|
+
* values, enforcing canonical formatting.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses hexadecimal string literals (`0xβ¦`) into numeric values, rejecting
|
|
14
|
+
* malformed or nonβhexadecimal input.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseHexString: ParseRule<unknown>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Hex String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses hexadecimal string literals (0xβ¦) into `bigint`
|
|
7
|
+
* values, enforcing canonical formatting.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses hexadecimal string literals (`0xβ¦`) into numeric values, rejecting
|
|
17
|
+
* malformed or nonβhexadecimal input.
|
|
18
|
+
*/
|
|
19
|
+
export const parseHexString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
if (!/^0x[0-9a-fA-F]+$/.test(value))
|
|
23
|
+
return [];
|
|
24
|
+
const parsed = Number(value);
|
|
25
|
+
if (Number.isNaN(parsed))
|
|
26
|
+
return [];
|
|
27
|
+
const event = parseEvent('info', 'string.now.hex', `Hex string parsed into number ${parsed}.`, path, 'Converted hexadecimal text into a number.', { before: value, after: parsed });
|
|
28
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
29
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Integer String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict integer strings into numeric values, rejecting
|
|
7
|
+
* floats, scientific notation, and ambiguous formats.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses strict integer strings into numeric values, rejecting floats,
|
|
14
|
+
* scientific notation, and any nonβdigit characters.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseIntegerString: ParseRule<unknown>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Integer String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict integer strings into numeric values, rejecting
|
|
7
|
+
* floats, scientific notation, and ambiguous formats.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses strict integer strings into numeric values, rejecting floats,
|
|
17
|
+
* scientific notation, and any nonβdigit characters.
|
|
18
|
+
*/
|
|
19
|
+
export const parseIntegerString = (value, path) => {
|
|
20
|
+
if (typeof value !== 'string')
|
|
21
|
+
return [];
|
|
22
|
+
// Strict integer: optional leading minus, digits only
|
|
23
|
+
if (!/^-?\d+$/.test(value))
|
|
24
|
+
return [];
|
|
25
|
+
const parsed = Number(value);
|
|
26
|
+
if (!Number.isInteger(parsed))
|
|
27
|
+
return [];
|
|
28
|
+
const event = parseEvent('info', 'string.now.integer', `String parsed into integer ${parsed}.`, path, 'Converted text into a whole number.', { before: value, after: parsed });
|
|
29
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
30
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse JSON String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses JSONβcompatible strings into structured data,
|
|
7
|
+
* accepting only valid objects, arrays, or quoted strings.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses JSONβcompatible strings into structured data, accepting only objects,
|
|
14
|
+
* arrays, or quoted strings and rejecting anything that cannot be parsed
|
|
15
|
+
* safely.
|
|
16
|
+
*/
|
|
17
|
+
export declare const parseJsonString: ParseRule<unknown>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse JSON String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses JSONβcompatible strings into structured data,
|
|
7
|
+
* accepting only valid objects, arrays, or quoted strings.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import { parseEvent } from '../pipeline';
|
|
12
|
+
/* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ *\
|
|
13
|
+
|* Implementation *|
|
|
14
|
+
\* βββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββββ * βββ */
|
|
15
|
+
/**
|
|
16
|
+
* Parses JSONβcompatible strings into structured data, accepting only objects,
|
|
17
|
+
* arrays, or quoted strings and rejecting anything that cannot be parsed
|
|
18
|
+
* safely.
|
|
19
|
+
*/
|
|
20
|
+
export const parseJsonString = (value, path) => {
|
|
21
|
+
if (typeof value !== 'string')
|
|
22
|
+
return [];
|
|
23
|
+
const first = value.trim()[0];
|
|
24
|
+
if (first !== '{' && first !== '[' && first !== '"')
|
|
25
|
+
return [];
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(value);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const event = parseEvent('info', 'string.now.json', 'String parsed as JSON.', path, 'Converted text into structured data.', { before: value, after: parsed });
|
|
34
|
+
return [{ path, nextValue: parsed, events: [event] }];
|
|
35
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Parsers | Parse Numeric String
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Parses strict numeric strings into numbers, supporting
|
|
7
|
+
* optional decimals while rejecting ambiguous formats.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ParseRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Parses strict numeric strings into JavaScript numbers, supporting optional
|
|
14
|
+
* decimals while rejecting scientific notation and nonβnumeric characters.
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseNumericString: ParseRule<unknown>;
|