@bgord/tools 1.3.24 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/age-years.vo.d.ts +11 -0
- package/dist/src/age-years.vo.js +6 -0
- package/dist/{age.vo.js → src/age.vo.js} +2 -1
- package/dist/src/api-key.vo.d.ts +7 -0
- package/dist/src/api-key.vo.js +7 -0
- package/dist/src/basename.vo.d.ts +12 -0
- package/dist/src/basename.vo.js +22 -0
- package/dist/src/day-iso-id.vo.d.ts +9 -0
- package/dist/{day-iso-id.vo.js → src/day-iso-id.vo.js} +4 -8
- package/dist/{day.vo.js → src/day.vo.js} +7 -6
- package/dist/src/directory-path-absolute.vo.d.ts +12 -0
- package/dist/{directory-path-absolute.vo.js → src/directory-path-absolute.vo.js} +5 -12
- package/dist/src/directory-path-relative.vo.d.ts +12 -0
- package/dist/{directory-path-relative.vo.js → src/directory-path-relative.vo.js} +5 -12
- package/dist/src/distance-value.vo.d.ts +7 -0
- package/dist/src/distance-value.vo.js +5 -0
- package/dist/{distance.vo.js → src/distance.vo.js} +7 -6
- package/dist/src/division-factor.vo.d.ts +7 -0
- package/dist/src/division-factor.vo.js +5 -0
- package/dist/src/duration-ms.vo.d.ts +6 -0
- package/dist/src/duration-ms.vo.js +5 -0
- package/dist/{duration.service.js → src/duration.service.js} +2 -1
- package/dist/src/email.vo.d.ts +6 -0
- package/dist/src/email.vo.js +4 -0
- package/dist/{etags.vo.js → src/etags.vo.js} +3 -2
- package/dist/src/extension.vo.d.ts +9 -0
- package/dist/src/extension.vo.js +15 -0
- package/dist/src/feature-flag-value.vo.d.ts +10 -0
- package/dist/{feature-flag-value.vo.js → src/feature-flag-value.vo.js} +2 -2
- package/dist/src/file-path-absolute-schema.vo.d.ts +17 -0
- package/dist/{file-path-absolute-schema.vo.js → src/file-path-absolute-schema.vo.js} +6 -13
- package/dist/src/file-path-relative-schema.vo.d.ts +17 -0
- package/dist/{file-path-relative-schema.vo.js → src/file-path-relative-schema.vo.js} +6 -13
- package/dist/{file-path.vo.js → src/file-path.vo.js} +5 -4
- package/dist/src/filename-affix.vo.d.ts +13 -0
- package/dist/{filename-affix.vo.js → src/filename-affix.vo.js} +4 -9
- package/dist/src/filename-from-string.vo.d.ts +10 -0
- package/dist/{filename-from-string.vo.js → src/filename-from-string.vo.js} +5 -8
- package/dist/{filename.vo.js → src/filename.vo.js} +8 -7
- package/dist/src/height-milimiters.vo.d.ts +7 -0
- package/dist/src/height-milimiters.vo.js +8 -0
- package/dist/{height.vo.js → src/height.vo.js} +4 -3
- package/dist/src/hour-value.vo.d.ts +7 -0
- package/dist/src/hour-value.vo.js +5 -0
- package/dist/{hour.vo.js → src/hour.vo.js} +3 -2
- package/dist/src/iban-schema.vo.d.ts +7 -0
- package/dist/src/iban-schema.vo.js +7 -0
- package/dist/{iban.vo.js → src/iban.vo.js} +2 -1
- package/dist/src/image.vo.d.ts +13 -0
- package/dist/src/image.vo.js +10 -0
- package/dist/src/integer-non-negative.vo.d.ts +7 -0
- package/dist/src/integer-non-negative.vo.js +8 -0
- package/dist/src/integer-positive.vo.d.ts +7 -0
- package/dist/src/integer-positive.vo.js +5 -0
- package/dist/src/integer.vo.d.ts +6 -0
- package/dist/src/integer.vo.js +4 -0
- package/dist/src/language.vo.d.ts +7 -0
- package/dist/{language.vo.js → src/language.vo.js} +2 -2
- package/dist/src/mime-value.vo.d.ts +7 -0
- package/dist/{mime-value.vo.js → src/mime-value.vo.js} +4 -7
- package/dist/{mime.vo.js → src/mime.vo.js} +2 -1
- package/dist/src/mimes.js +19 -0
- package/dist/src/minute-value.vo.d.ts +7 -0
- package/dist/src/minute-value.vo.js +5 -0
- package/dist/{minute.vo.js → src/minute.vo.js} +3 -2
- package/dist/src/money-amount.vo.d.ts +7 -0
- package/dist/src/money-amount.vo.js +5 -0
- package/dist/{money.vo.js → src/money.vo.js} +7 -6
- package/dist/src/month-iso-id.vo.d.ts +8 -0
- package/dist/{month-iso-id.vo.js → src/month-iso-id.vo.js} +5 -9
- package/dist/{month.vo.js → src/month.vo.js} +5 -4
- package/dist/src/multiplication-factor.vo.d.ts +7 -0
- package/dist/src/multiplication-factor.vo.js +8 -0
- package/dist/src/object-key.vo.d.ts +11 -0
- package/dist/src/object-key.vo.js +19 -0
- package/dist/src/package-version-schema.vo.d.ts +8 -0
- package/dist/{package-version-schema.vo.js → src/package-version-schema.vo.js} +4 -7
- package/dist/{package-version.vo.js → src/package-version.vo.js} +3 -4
- package/dist/src/pagination-page.vo.d.ts +6 -0
- package/dist/src/pagination-page.vo.js +3 -0
- package/dist/src/pagination-skip.vo.d.ts +7 -0
- package/dist/src/pagination-skip.vo.js +3 -0
- package/dist/src/pagination-take.vo.d.ts +7 -0
- package/dist/src/pagination-take.vo.js +3 -0
- package/dist/{pagination.service.js → src/pagination.service.js} +8 -7
- package/dist/src/quarter-iso-id.vo.d.ts +8 -0
- package/dist/src/quarter-iso-id.vo.js +7 -0
- package/dist/{quarter.vo.js → src/quarter.vo.js} +3 -2
- package/dist/src/reordering-item-position-value.vo.d.ts +6 -0
- package/dist/src/reordering-item-position-value.vo.js +3 -0
- package/dist/{reordering.service.d.ts → src/reordering.service.d.ts} +9 -9
- package/dist/{reordering.service.js → src/reordering.service.js} +7 -7
- package/dist/src/revision-value.vo.d.ts +7 -0
- package/dist/src/revision-value.vo.js +3 -0
- package/dist/{revision.vo.js → src/revision.vo.js} +3 -2
- package/dist/{rounding-decimal.strategy.d.ts → src/rounding-decimal.strategy.d.ts} +2 -2
- package/dist/src/rounding-decimal.strategy.js +14 -0
- package/dist/src/size-bytes.vo.d.ts +6 -0
- package/dist/src/size-bytes.vo.js +5 -0
- package/dist/{size.vo.js → src/size.vo.js} +5 -4
- package/dist/src/time-zone-offset-value.vo.d.ts +8 -0
- package/dist/src/time-zone-offset-value.vo.js +13 -0
- package/dist/src/timestamp-value.vo.d.ts +6 -0
- package/dist/src/timestamp-value.vo.js +5 -0
- package/dist/{timestamp.vo.js → src/timestamp.vo.js} +2 -1
- package/dist/src/timezone.vo.d.ts +9 -0
- package/dist/{timezone.vo.js → src/timezone.vo.js} +7 -10
- package/dist/src/url-with-slash.vo.d.ts +6 -0
- package/dist/src/url-with-slash.vo.js +5 -0
- package/dist/src/url-without-slash.vo.d.ts +6 -0
- package/dist/src/url-without-slash.vo.js +5 -0
- package/dist/src/week-iso-id.vo.d.ts +8 -0
- package/dist/{week-iso-id.vo.js → src/week-iso-id.vo.js} +5 -9
- package/dist/{week.vo.js → src/week.vo.js} +5 -4
- package/dist/src/weekday-iso-id.vo.d.ts +7 -0
- package/dist/src/weekday-iso-id.vo.js +5 -0
- package/dist/{weekday.vo.js → src/weekday.vo.js} +9 -8
- package/dist/src/weight-grams.vo.d.ts +7 -0
- package/dist/src/weight-grams.vo.js +5 -0
- package/dist/{weight.vo.js → src/weight.vo.js} +8 -7
- package/dist/src/year-iso-id.vo.d.ts +7 -0
- package/dist/src/year-iso-id.vo.js +7 -0
- package/dist/{year.vo.js → src/year.vo.js} +6 -5
- package/dist/tests/age-years.vo.test.d.ts +1 -0
- package/dist/tests/age-years.vo.test.js +24 -0
- package/dist/tests/age.vo.test.d.ts +1 -0
- package/dist/tests/age.vo.test.js +106 -0
- package/dist/tests/api-key.vo.test.d.ts +1 -0
- package/dist/tests/api-key.vo.test.js +24 -0
- package/dist/tests/basename.vo.test.d.ts +1 -0
- package/dist/tests/basename.vo.test.js +53 -0
- package/dist/tests/batch.test.d.ts +1 -0
- package/dist/tests/batch.test.js +24 -0
- package/dist/tests/date-calculator.service.test.d.ts +1 -0
- package/dist/tests/date-calculator.service.test.js +32 -0
- package/dist/tests/date-formatter.service.test.d.ts +1 -0
- package/dist/tests/date-formatter.service.test.js +22 -0
- package/dist/tests/date-range.vo.test.d.ts +1 -0
- package/dist/tests/date-range.vo.test.js +49 -0
- package/dist/tests/day-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/day-iso-id.vo.test.js +36 -0
- package/dist/tests/day.vo.test.d.ts +1 -0
- package/dist/tests/day.vo.test.js +68 -0
- package/dist/tests/directory-path-absolute.vo.test.d.ts +1 -0
- package/dist/tests/directory-path-absolute.vo.test.js +47 -0
- package/dist/tests/directory-path-relative.vo.test.d.ts +1 -0
- package/dist/tests/directory-path-relative.vo.test.js +44 -0
- package/dist/tests/distance-value.vo.test.d.ts +1 -0
- package/dist/tests/distance-value.vo.test.js +21 -0
- package/dist/tests/distance.vo.test.d.ts +1 -0
- package/dist/tests/distance.vo.test.js +74 -0
- package/dist/tests/division-factor.vo.test.d.ts +1 -0
- package/dist/tests/division-factor.vo.test.js +21 -0
- package/dist/tests/dll.service.test.d.ts +1 -0
- package/dist/tests/dll.service.test.js +381 -0
- package/dist/tests/duration-ms.vo.test.d.ts +1 -0
- package/dist/tests/duration-ms.vo.test.js +18 -0
- package/dist/tests/duration.service.test.d.ts +1 -0
- package/dist/tests/duration.service.test.js +126 -0
- package/dist/tests/email-mask.service.test.d.ts +1 -0
- package/dist/tests/email-mask.service.test.js +15 -0
- package/dist/tests/email.vo.test.d.ts +1 -0
- package/dist/tests/email.vo.test.js +17 -0
- package/dist/tests/etags.vo.test.d.ts +1 -0
- package/dist/tests/etags.vo.test.js +54 -0
- package/dist/tests/extension.vo.test.d.ts +1 -0
- package/dist/tests/extension.vo.test.js +51 -0
- package/dist/tests/feature-flag-value.vo.test.d.ts +1 -0
- package/dist/tests/feature-flag-value.vo.test.js +12 -0
- package/dist/tests/feature-flag.vo.test.d.ts +1 -0
- package/dist/tests/feature-flag.vo.test.js +13 -0
- package/dist/tests/file-path-absolute-schema.vo.test.d.ts +1 -0
- package/dist/tests/file-path-absolute-schema.vo.test.js +53 -0
- package/dist/tests/file-path-relative-schema.vo.test.d.ts +1 -0
- package/dist/tests/file-path-relative-schema.vo.test.js +52 -0
- package/dist/tests/file-path.vo.test.d.ts +1 -0
- package/dist/tests/file-path.vo.test.js +74 -0
- package/dist/tests/filename-affix.vo.test.d.ts +1 -0
- package/dist/tests/filename-affix.vo.test.js +30 -0
- package/dist/tests/filename-from-string.vo.test.d.ts +1 -0
- package/dist/tests/filename-from-string.vo.test.js +37 -0
- package/dist/tests/filename.vo.test.d.ts +1 -0
- package/dist/tests/filename.vo.test.js +93 -0
- package/dist/tests/height-milimiters.vo.test.d.ts +1 -0
- package/dist/tests/height-milimiters.vo.test.js +21 -0
- package/dist/tests/height.vo.test.d.ts +1 -0
- package/dist/tests/height.vo.test.js +64 -0
- package/dist/tests/hour-value.vo.test.d.ts +1 -0
- package/dist/tests/hour-value.vo.test.js +24 -0
- package/dist/tests/hour.vo.test.d.ts +1 -0
- package/dist/tests/hour.vo.test.js +64 -0
- package/dist/tests/iban-mask.service.test.d.ts +1 -0
- package/dist/tests/iban-mask.service.test.js +13 -0
- package/dist/tests/iban-schema.vo.test.d.ts +1 -0
- package/dist/tests/iban-schema.vo.test.js +43 -0
- package/dist/tests/iban.vo.test.d.ts +1 -0
- package/dist/tests/iban.vo.test.js +46 -0
- package/dist/tests/image.vo.test.d.ts +1 -0
- package/dist/tests/image.vo.test.js +41 -0
- package/dist/tests/integer-non-negative.vo.test.d.ts +1 -0
- package/dist/tests/integer-non-negative.vo.test.js +22 -0
- package/dist/tests/integer-positive.vo.test.d.ts +1 -0
- package/dist/tests/integer-positive.vo.test.js +21 -0
- package/dist/tests/integer.vo.test.d.ts +1 -0
- package/dist/tests/integer.vo.test.js +21 -0
- package/dist/tests/language.vo.test.d.ts +1 -0
- package/dist/tests/language.vo.test.js +28 -0
- package/dist/tests/linear-regression.service.test.d.ts +1 -0
- package/dist/tests/linear-regression.service.test.js +111 -0
- package/dist/tests/mean.service.test.d.ts +1 -0
- package/dist/tests/mean.service.test.js +23 -0
- package/dist/tests/mime-registry-entry.vo.test.d.ts +1 -0
- package/dist/tests/mime-registry-entry.vo.test.js +15 -0
- package/dist/tests/mime-registry.service.test.d.ts +1 -0
- package/dist/tests/mime-registry.service.test.js +45 -0
- package/dist/tests/mime-value.vo.test.d.ts +1 -0
- package/dist/tests/mime-value.vo.test.js +49 -0
- package/dist/tests/mime.vo.test.d.ts +1 -0
- package/dist/tests/mime.vo.test.js +53 -0
- package/dist/tests/mimes.test.d.ts +1 -0
- package/dist/tests/mimes.test.js +28 -0
- package/dist/tests/min-max-scaler.service.test.d.ts +1 -0
- package/dist/tests/min-max-scaler.service.test.js +116 -0
- package/dist/tests/minute-value.vo.test.d.ts +1 -0
- package/dist/tests/minute-value.vo.test.js +24 -0
- package/dist/tests/minute.vo.test.d.ts +1 -0
- package/dist/tests/minute.vo.test.js +64 -0
- package/dist/tests/mocks.d.ts +6 -0
- package/dist/tests/mocks.js +7 -0
- package/dist/tests/money-amount.vo.test.d.ts +1 -0
- package/dist/tests/money-amount.vo.test.js +21 -0
- package/dist/tests/money.vo.test.d.ts +1 -0
- package/dist/tests/money.vo.test.js +90 -0
- package/dist/tests/month-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/month-iso-id.vo.test.js +36 -0
- package/dist/tests/month.vo.test.d.ts +1 -0
- package/dist/tests/month.vo.test.js +65 -0
- package/dist/tests/multiplication-factor.vo.test.d.ts +1 -0
- package/dist/tests/multiplication-factor.vo.test.js +19 -0
- package/dist/tests/noop.test.d.ts +1 -0
- package/dist/tests/noop.test.js +12 -0
- package/dist/tests/object-key.vo.test.d.ts +1 -0
- package/dist/tests/object-key.vo.test.js +56 -0
- package/dist/tests/outlier-detector.service.test.d.ts +1 -0
- package/dist/tests/outlier-detector.service.test.js +35 -0
- package/dist/tests/package-version-schema.vo.test.d.ts +1 -0
- package/dist/tests/package-version-schema.vo.test.js +32 -0
- package/dist/tests/package-version.vo.test.d.ts +1 -0
- package/dist/tests/package-version.vo.test.js +138 -0
- package/dist/tests/pagination-page.vo.test.d.ts +1 -0
- package/dist/tests/pagination-page.vo.test.js +26 -0
- package/dist/tests/pagination-skip.vo.test.d.ts +1 -0
- package/dist/tests/pagination-skip.vo.test.js +23 -0
- package/dist/tests/pagination-take.vo.test.d.ts +1 -0
- package/dist/tests/pagination-take.vo.test.js +25 -0
- package/dist/tests/pagination.service.test.d.ts +1 -0
- package/dist/tests/pagination.service.test.js +92 -0
- package/dist/tests/percentage.service.test.d.ts +1 -0
- package/dist/tests/percentage.service.test.js +16 -0
- package/dist/tests/population-standard-deviation.service.test.d.ts +1 -0
- package/dist/tests/population-standard-deviation.service.test.js +20 -0
- package/dist/tests/quarter-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/quarter-iso-id.vo.test.js +30 -0
- package/dist/tests/quarter.vo.test.d.ts +1 -0
- package/dist/tests/quarter.vo.test.js +54 -0
- package/dist/tests/random.service.test.d.ts +1 -0
- package/dist/tests/random.service.test.js +93 -0
- package/dist/tests/rate-limiter.service.test.d.ts +1 -0
- package/dist/tests/rate-limiter.service.test.js +39 -0
- package/dist/tests/relative-date.vo.test.d.ts +1 -0
- package/dist/tests/relative-date.vo.test.js +22 -0
- package/dist/tests/reordering-item-position-value.vo.test.d.ts +1 -0
- package/dist/tests/reordering-item-position-value.vo.test.js +21 -0
- package/dist/tests/reordering.service.test.d.ts +1 -0
- package/dist/tests/reordering.service.test.js +76 -0
- package/dist/tests/repeat.test.d.ts +1 -0
- package/dist/tests/repeat.test.js +8 -0
- package/dist/tests/revision-value.vo.test.d.ts +1 -0
- package/dist/tests/revision-value.vo.test.js +21 -0
- package/dist/tests/revision.vo.test.d.ts +1 -0
- package/dist/tests/revision.vo.test.js +52 -0
- package/dist/tests/rounding-decimal.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-decimal.strategy.test.js +17 -0
- package/dist/tests/rounding-down.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-down.strategy.test.js +9 -0
- package/dist/tests/rounding-to-nearest.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-to-nearest.strategy.test.js +9 -0
- package/dist/tests/rounding-up.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-up.strategy.test.js +9 -0
- package/dist/tests/size-bytes.vo.test.d.ts +1 -0
- package/dist/tests/size-bytes.vo.test.js +21 -0
- package/dist/tests/size.vo.test.d.ts +1 -0
- package/dist/tests/size.vo.test.js +93 -0
- package/dist/tests/slug.service.test.d.ts +1 -0
- package/dist/tests/slug.service.test.js +45 -0
- package/dist/tests/sum.service.test.d.ts +1 -0
- package/dist/tests/sum.service.test.js +22 -0
- package/dist/tests/thousands-separator.service.test.d.ts +1 -0
- package/dist/tests/thousands-separator.service.test.js +27 -0
- package/dist/tests/time-zone-offset-value.test.d.ts +1 -0
- package/dist/tests/time-zone-offset-value.test.js +27 -0
- package/dist/tests/timestamp-value.vo.test.d.ts +1 -0
- package/dist/tests/timestamp-value.vo.test.js +21 -0
- package/dist/tests/timestamp.vo.test.d.ts +1 -0
- package/dist/tests/timestamp.vo.test.js +73 -0
- package/dist/tests/timezone.vo.test.d.ts +1 -0
- package/dist/tests/timezone.vo.test.js +29 -0
- package/dist/tests/url-with-slash.vo.test.d.ts +1 -0
- package/dist/tests/url-with-slash.vo.test.js +24 -0
- package/dist/tests/url-without-slash.vo.test.d.ts +1 -0
- package/dist/tests/url-without-slash.vo.test.js +25 -0
- package/dist/tests/visually-unambiguous-characters-generator.service.test.d.ts +1 -0
- package/dist/tests/visually-unambiguous-characters-generator.service.test.js +89 -0
- package/dist/tests/week-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/week-iso-id.vo.test.js +37 -0
- package/dist/tests/week.vo.test.d.ts +1 -0
- package/dist/tests/week.vo.test.js +64 -0
- package/dist/tests/weekday-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/weekday-iso-id.vo.test.js +24 -0
- package/dist/tests/weekday.vo.test.d.ts +1 -0
- package/dist/tests/weekday.vo.test.js +51 -0
- package/dist/tests/weight-grams.vo.test.d.ts +1 -0
- package/dist/tests/weight-grams.vo.test.js +21 -0
- package/dist/tests/weight.vo.test.d.ts +1 -0
- package/dist/tests/weight.vo.test.js +66 -0
- package/dist/tests/year-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/year-iso-id.vo.test.js +23 -0
- package/dist/tests/year.vo.test.d.ts +1 -0
- package/dist/tests/year.vo.test.js +79 -0
- package/dist/tests/z-score.service.test.d.ts +1 -0
- package/dist/tests/z-score.service.test.js +26 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -12
- package/dist/age-years.vo.d.ts +0 -11
- package/dist/age-years.vo.js +0 -11
- package/dist/api-key.vo.d.ts +0 -8
- package/dist/api-key.vo.js +0 -11
- package/dist/basename.vo.d.ts +0 -12
- package/dist/basename.vo.js +0 -27
- package/dist/day-iso-id.vo.d.ts +0 -9
- package/dist/directory-path-absolute.vo.d.ts +0 -12
- package/dist/directory-path-relative.vo.d.ts +0 -12
- package/dist/distance-value.vo.d.ts +0 -7
- package/dist/distance-value.vo.js +0 -9
- package/dist/division-factor.vo.d.ts +0 -7
- package/dist/division-factor.vo.js +0 -8
- package/dist/duration-ms.vo.d.ts +0 -6
- package/dist/duration-ms.vo.js +0 -4
- package/dist/email.vo.d.ts +0 -6
- package/dist/email.vo.js +0 -4
- package/dist/extension.vo.d.ts +0 -9
- package/dist/extension.vo.js +0 -21
- package/dist/feature-flag-value.vo.d.ts +0 -10
- package/dist/file-path-absolute-schema.vo.d.ts +0 -14
- package/dist/file-path-relative-schema.vo.d.ts +0 -14
- package/dist/filename-affix.vo.d.ts +0 -13
- package/dist/filename-from-string.vo.d.ts +0 -10
- package/dist/height-milimiters.vo.d.ts +0 -7
- package/dist/height-milimiters.vo.js +0 -12
- package/dist/hour-value.vo.d.ts +0 -7
- package/dist/hour-value.vo.js +0 -10
- package/dist/iban-schema.vo.d.ts +0 -7
- package/dist/iban-schema.vo.js +0 -12
- package/dist/image.vo.d.ts +0 -13
- package/dist/image.vo.js +0 -20
- package/dist/integer-non-negative.vo.d.ts +0 -7
- package/dist/integer-non-negative.vo.js +0 -12
- package/dist/integer-positive.vo.d.ts +0 -7
- package/dist/integer-positive.vo.js +0 -9
- package/dist/integer.vo.d.ts +0 -6
- package/dist/integer.vo.js +0 -4
- package/dist/language.vo.d.ts +0 -7
- package/dist/mime-value.vo.d.ts +0 -6
- package/dist/mimes.js +0 -18
- package/dist/minute-value.vo.d.ts +0 -7
- package/dist/minute-value.vo.js +0 -10
- package/dist/money-amount.vo.d.ts +0 -7
- package/dist/money-amount.vo.js +0 -9
- package/dist/month-iso-id.vo.d.ts +0 -8
- package/dist/multiplication-factor.vo.d.ts +0 -7
- package/dist/multiplication-factor.vo.js +0 -11
- package/dist/object-key.vo.d.ts +0 -11
- package/dist/object-key.vo.js +0 -24
- package/dist/package-version-schema.vo.d.ts +0 -8
- package/dist/pagination-page.vo.d.ts +0 -6
- package/dist/pagination-page.vo.js +0 -7
- package/dist/pagination-skip.vo.d.ts +0 -7
- package/dist/pagination-skip.vo.js +0 -6
- package/dist/pagination-take.vo.d.ts +0 -7
- package/dist/pagination-take.vo.js +0 -6
- package/dist/quarter-iso-id.vo.d.ts +0 -7
- package/dist/quarter-iso-id.vo.js +0 -11
- package/dist/reordering-item-position-value.vo.d.ts +0 -6
- package/dist/reordering-item-position-value.vo.js +0 -6
- package/dist/revision-value.vo.d.ts +0 -7
- package/dist/revision-value.vo.js +0 -6
- package/dist/rounding-decimal.strategy.js +0 -19
- package/dist/size-bytes.vo.d.ts +0 -6
- package/dist/size-bytes.vo.js +0 -9
- package/dist/time-zone-offset-value.vo.d.ts +0 -8
- package/dist/time-zone-offset-value.vo.js +0 -17
- package/dist/timestamp-value.vo.d.ts +0 -6
- package/dist/timestamp-value.vo.js +0 -9
- package/dist/timezone.vo.d.ts +0 -9
- package/dist/url-with-slash.vo.d.ts +0 -6
- package/dist/url-with-slash.vo.js +0 -8
- package/dist/url-without-slash.vo.d.ts +0 -6
- package/dist/url-without-slash.vo.js +0 -8
- package/dist/week-iso-id.vo.d.ts +0 -8
- package/dist/weekday-iso-id.vo.d.ts +0 -7
- package/dist/weekday-iso-id.vo.js +0 -10
- package/dist/weight-grams.vo.d.ts +0 -7
- package/dist/weight-grams.vo.js +0 -9
- package/dist/year-iso-id.vo.d.ts +0 -7
- package/dist/year-iso-id.vo.js +0 -10
- package/dist/{age.vo.d.ts → src/age.vo.d.ts} +0 -0
- package/dist/{batch.d.ts → src/batch.d.ts} +0 -0
- package/dist/{batch.js → src/batch.js} +0 -0
- package/dist/{date-calculator.service.d.ts → src/date-calculator.service.d.ts} +0 -0
- package/dist/{date-calculator.service.js → src/date-calculator.service.js} +0 -0
- package/dist/{date-formatter.service.d.ts → src/date-formatter.service.d.ts} +0 -0
- package/dist/{date-formatter.service.js → src/date-formatter.service.js} +0 -0
- package/dist/{date-range.vo.d.ts → src/date-range.vo.d.ts} +0 -0
- package/dist/{date-range.vo.js → src/date-range.vo.js} +0 -0
- package/dist/{day.vo.d.ts → src/day.vo.d.ts} +1 -1
- /package/dist/{distance.vo.d.ts → src/distance.vo.d.ts} +0 -0
- /package/dist/{dll.service.d.ts → src/dll.service.d.ts} +0 -0
- /package/dist/{dll.service.js → src/dll.service.js} +0 -0
- /package/dist/{duration.service.d.ts → src/duration.service.d.ts} +0 -0
- /package/dist/{email-mask.service.d.ts → src/email-mask.service.d.ts} +0 -0
- /package/dist/{email-mask.service.js → src/email-mask.service.js} +0 -0
- /package/dist/{etags.vo.d.ts → src/etags.vo.d.ts} +0 -0
- /package/dist/{feature-flag.vo.d.ts → src/feature-flag.vo.d.ts} +0 -0
- /package/dist/{feature-flag.vo.js → src/feature-flag.vo.js} +0 -0
- /package/dist/{file-path.vo.d.ts → src/file-path.vo.d.ts} +0 -0
- /package/dist/{filename.vo.d.ts → src/filename.vo.d.ts} +0 -0
- /package/dist/{height.vo.d.ts → src/height.vo.d.ts} +0 -0
- /package/dist/{hour.vo.d.ts → src/hour.vo.d.ts} +0 -0
- /package/dist/{iban-mask.service.d.ts → src/iban-mask.service.d.ts} +0 -0
- /package/dist/{iban-mask.service.js → src/iban-mask.service.js} +0 -0
- /package/dist/{iban.vo.d.ts → src/iban.vo.d.ts} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{linear-regression.service.d.ts → src/linear-regression.service.d.ts} +0 -0
- /package/dist/{linear-regression.service.js → src/linear-regression.service.js} +0 -0
- /package/dist/{mean.service.d.ts → src/mean.service.d.ts} +0 -0
- /package/dist/{mean.service.js → src/mean.service.js} +0 -0
- /package/dist/{mime-registry-entry.vo.d.ts → src/mime-registry-entry.vo.d.ts} +0 -0
- /package/dist/{mime-registry-entry.vo.js → src/mime-registry-entry.vo.js} +0 -0
- /package/dist/{mime-registry.service.d.ts → src/mime-registry.service.d.ts} +0 -0
- /package/dist/{mime-registry.service.js → src/mime-registry.service.js} +0 -0
- /package/dist/{mime.vo.d.ts → src/mime.vo.d.ts} +0 -0
- /package/dist/{mimes.d.ts → src/mimes.d.ts} +0 -0
- /package/dist/{min-max-scaler.service.d.ts → src/min-max-scaler.service.d.ts} +0 -0
- /package/dist/{min-max-scaler.service.js → src/min-max-scaler.service.js} +0 -0
- /package/dist/{minute.vo.d.ts → src/minute.vo.d.ts} +0 -0
- /package/dist/{money.vo.d.ts → src/money.vo.d.ts} +0 -0
- /package/dist/{month.vo.d.ts → src/month.vo.d.ts} +0 -0
- /package/dist/{noop.service.d.ts → src/noop.service.d.ts} +0 -0
- /package/dist/{noop.service.js → src/noop.service.js} +0 -0
- /package/dist/{outlier-detector.service.d.ts → src/outlier-detector.service.d.ts} +0 -0
- /package/dist/{outlier-detector.service.js → src/outlier-detector.service.js} +0 -0
- /package/dist/{package-version.vo.d.ts → src/package-version.vo.d.ts} +0 -0
- /package/dist/{pagination.service.d.ts → src/pagination.service.d.ts} +0 -0
- /package/dist/{percentage.service.d.ts → src/percentage.service.d.ts} +0 -0
- /package/dist/{percentage.service.js → src/percentage.service.js} +0 -0
- /package/dist/{population-standard-deviation.service.d.ts → src/population-standard-deviation.service.d.ts} +0 -0
- /package/dist/{population-standard-deviation.service.js → src/population-standard-deviation.service.js} +0 -0
- /package/dist/{quarter.vo.d.ts → src/quarter.vo.d.ts} +0 -0
- /package/dist/{random.service.d.ts → src/random.service.d.ts} +0 -0
- /package/dist/{random.service.js → src/random.service.js} +0 -0
- /package/dist/{rate-limiter.service.d.ts → src/rate-limiter.service.d.ts} +0 -0
- /package/dist/{rate-limiter.service.js → src/rate-limiter.service.js} +0 -0
- /package/dist/{relative-date.vo.d.ts → src/relative-date.vo.d.ts} +0 -0
- /package/dist/{relative-date.vo.js → src/relative-date.vo.js} +0 -0
- /package/dist/{repeat.d.ts → src/repeat.d.ts} +0 -0
- /package/dist/{repeat.js → src/repeat.js} +0 -0
- /package/dist/{revision.vo.d.ts → src/revision.vo.d.ts} +0 -0
- /package/dist/{rounding-down.strategy.d.ts → src/rounding-down.strategy.d.ts} +0 -0
- /package/dist/{rounding-down.strategy.js → src/rounding-down.strategy.js} +0 -0
- /package/dist/{rounding-to-nearest.strategy.d.ts → src/rounding-to-nearest.strategy.d.ts} +0 -0
- /package/dist/{rounding-to-nearest.strategy.js → src/rounding-to-nearest.strategy.js} +0 -0
- /package/dist/{rounding-up.strategy.d.ts → src/rounding-up.strategy.d.ts} +0 -0
- /package/dist/{rounding-up.strategy.js → src/rounding-up.strategy.js} +0 -0
- /package/dist/{rounding.strategy.d.ts → src/rounding.strategy.d.ts} +0 -0
- /package/dist/{rounding.strategy.js → src/rounding.strategy.js} +0 -0
- /package/dist/{size.vo.d.ts → src/size.vo.d.ts} +0 -0
- /package/dist/{slug.service.d.ts → src/slug.service.d.ts} +0 -0
- /package/dist/{slug.service.js → src/slug.service.js} +0 -0
- /package/dist/{sum.service.d.ts → src/sum.service.d.ts} +0 -0
- /package/dist/{sum.service.js → src/sum.service.js} +0 -0
- /package/dist/{thousands-separator.service.d.ts → src/thousands-separator.service.d.ts} +0 -0
- /package/dist/{thousands-separator.service.js → src/thousands-separator.service.js} +0 -0
- /package/dist/{timestamp.vo.d.ts → src/timestamp.vo.d.ts} +0 -0
- /package/dist/{ts-utils.d.ts → src/ts-utils.d.ts} +0 -0
- /package/dist/{ts-utils.js → src/ts-utils.js} +0 -0
- /package/dist/{visually-unambiguous-characters-generator.service.d.ts → src/visually-unambiguous-characters-generator.service.d.ts} +0 -0
- /package/dist/{visually-unambiguous-characters-generator.service.js → src/visually-unambiguous-characters-generator.service.js} +0 -0
- /package/dist/{week.vo.d.ts → src/week.vo.d.ts} +0 -0
- /package/dist/{weekday.vo.d.ts → src/weekday.vo.d.ts} +0 -0
- /package/dist/{weight.vo.d.ts → src/weight.vo.d.ts} +0 -0
- /package/dist/{year.vo.d.ts → src/year.vo.d.ts} +0 -0
- /package/dist/{z-score.service.d.ts → src/z-score.service.d.ts} +0 -0
- /package/dist/{z-score.service.js → src/z-score.service.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
import { Basename } from "./basename.vo";
|
|
3
3
|
import { Extension } from "./extension.vo";
|
|
4
4
|
export const FilenameFromStringError = {
|
|
@@ -9,12 +9,9 @@ export const FilenameFromStringError = {
|
|
|
9
9
|
// .
|
|
10
10
|
// .+ at least one character
|
|
11
11
|
const DOT_WITH_SIDES = /^.+\..+$/;
|
|
12
|
-
export const FilenameFromString =
|
|
13
|
-
.string(FilenameFromStringError.Type)
|
|
14
|
-
.regex(DOT_WITH_SIDES, FilenameFromStringError.Invalid)
|
|
15
|
-
.transform((value) => {
|
|
12
|
+
export const FilenameFromString = v.pipe(v.string(FilenameFromStringError.Type), v.regex(DOT_WITH_SIDES, FilenameFromStringError.Invalid), v.transform((value) => {
|
|
16
13
|
const index = value.lastIndexOf(".");
|
|
17
|
-
const basename =
|
|
18
|
-
const extension =
|
|
14
|
+
const basename = v.parse(Basename, value.slice(0, index));
|
|
15
|
+
const extension = v.parse(Extension, value.slice(index + 1));
|
|
19
16
|
return { basename, extension };
|
|
20
|
-
});
|
|
17
|
+
}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { Basename } from "./basename.vo";
|
|
2
3
|
import { Extension } from "./extension.vo";
|
|
3
4
|
import { FilenameAffix, FilenameAffixStrategy } from "./filename-affix.vo";
|
|
@@ -10,13 +11,13 @@ export class Filename {
|
|
|
10
11
|
this.extension = extension;
|
|
11
12
|
}
|
|
12
13
|
static fromParts(basename, extension) {
|
|
13
|
-
return new Filename(
|
|
14
|
+
return new Filename(v.parse(Basename, basename), v.parse(Extension, extension));
|
|
14
15
|
}
|
|
15
16
|
static fromPartsSafe(basename, extension) {
|
|
16
17
|
return new Filename(basename, extension);
|
|
17
18
|
}
|
|
18
19
|
static fromString(candidate) {
|
|
19
|
-
const filename =
|
|
20
|
+
const filename = v.parse(FilenameFromString, candidate);
|
|
20
21
|
return new Filename(filename.basename, filename.extension);
|
|
21
22
|
}
|
|
22
23
|
get() {
|
|
@@ -35,17 +36,17 @@ export class Filename {
|
|
|
35
36
|
return new Filename(basename, this.extension);
|
|
36
37
|
}
|
|
37
38
|
withAffix(candidate, strategy) {
|
|
38
|
-
const affix =
|
|
39
|
+
const affix = v.parse(FilenameAffix, candidate);
|
|
39
40
|
if (strategy === FilenameAffixStrategy.prefix) {
|
|
40
|
-
return new Filename(
|
|
41
|
+
return new Filename(v.parse(Basename, `${affix}${this.basename}`), this.extension);
|
|
41
42
|
}
|
|
42
|
-
return new Filename(
|
|
43
|
+
return new Filename(v.parse(Basename, `${this.basename}${affix}`), this.extension);
|
|
43
44
|
}
|
|
44
45
|
withAffixSafe(affix, strategy) {
|
|
45
46
|
if (strategy === FilenameAffixStrategy.prefix) {
|
|
46
|
-
return new Filename(
|
|
47
|
+
return new Filename(v.parse(Basename, `${affix}${this.basename}`), this.extension);
|
|
47
48
|
}
|
|
48
|
-
return new Filename(
|
|
49
|
+
return new Filename(v.parse(Basename, `${this.basename}${affix}`), this.extension);
|
|
49
50
|
}
|
|
50
51
|
withSuffix(candidate) {
|
|
51
52
|
return this.withAffix(candidate, FilenameAffixStrategy.suffix);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const HeightMillimetersError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const HeightMillimeters: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "HeightMillimeters">]>;
|
|
7
|
+
export type HeightMillimetersType = v.InferOutput<typeof HeightMillimeters>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const HeightMillimetersError = {
|
|
3
|
+
Type: "height.millimeters.type",
|
|
4
|
+
Invalid: "height.millimeters.invalid",
|
|
5
|
+
};
|
|
6
|
+
export const HeightMillimeters = v.pipe(v.number(HeightMillimetersError.Type), v.integer(HeightMillimetersError.Type), v.minValue(0, HeightMillimetersError.Invalid),
|
|
7
|
+
// Stryker disable next-line StringLiteral
|
|
8
|
+
v.brand("HeightMillimeters"));
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { HeightMillimeters } from "./height-milimiters.vo";
|
|
2
3
|
import { RoundingToNearestStrategy } from "./rounding-to-nearest.strategy";
|
|
3
4
|
export class Height {
|
|
4
5
|
millimeters;
|
|
5
|
-
static ZERO =
|
|
6
|
+
static ZERO = v.parse(HeightMillimeters, 0);
|
|
6
7
|
static MILLIMETERS_PER_CENTIMETER = 10;
|
|
7
8
|
constructor(millimeters) {
|
|
8
9
|
this.millimeters = millimeters;
|
|
9
10
|
}
|
|
10
11
|
static fromMillimeters(millimeters) {
|
|
11
|
-
return new Height(
|
|
12
|
+
return new Height(v.parse(HeightMillimeters, millimeters));
|
|
12
13
|
}
|
|
13
14
|
static fromMillimetersSafe(millimeters) {
|
|
14
15
|
return new Height(millimeters);
|
|
15
16
|
}
|
|
16
17
|
static fromCentimeters(centimeters, rounding = new RoundingToNearestStrategy()) {
|
|
17
18
|
const millimeters = rounding.round(centimeters * Height.MILLIMETERS_PER_CENTIMETER);
|
|
18
|
-
return new Height(
|
|
19
|
+
return new Height(v.parse(HeightMillimeters, millimeters));
|
|
19
20
|
}
|
|
20
21
|
static zero() {
|
|
21
22
|
return Height.fromMillimetersSafe(Height.ZERO);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const HourValueError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const HourValue: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.MaxValueAction<number, 23, string>, v.BrandAction<number, "HourSchema">]>;
|
|
7
|
+
export type HourValueType = v.InferOutput<typeof HourValue>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const HourValueError = { Type: "hour.value.type", Invalid: "hour.value.invalid" };
|
|
3
|
+
export const HourValue = v.pipe(v.number(HourValueError.Type), v.integer(HourValueError.Type), v.minValue(0, HourValueError.Invalid), v.maxValue(23, HourValueError.Invalid),
|
|
4
|
+
// Stryker disable next-line StringLiteral
|
|
5
|
+
v.brand("HourSchema"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { HourValue } from "./hour-value.vo";
|
|
2
3
|
import { Timestamp } from "./timestamp.vo";
|
|
3
4
|
export class Hour {
|
|
@@ -6,13 +7,13 @@ export class Hour {
|
|
|
6
7
|
this.value = value;
|
|
7
8
|
}
|
|
8
9
|
static fromValue(candidate) {
|
|
9
|
-
return new Hour(
|
|
10
|
+
return new Hour(v.parse(HourValue, candidate));
|
|
10
11
|
}
|
|
11
12
|
static fromValueSafe(candidate) {
|
|
12
13
|
return new Hour(candidate);
|
|
13
14
|
}
|
|
14
15
|
static fromTimestamp(timestamp) {
|
|
15
|
-
return new Hour(
|
|
16
|
+
return new Hour(v.parse(HourValue, new Date(timestamp.ms).getUTCHours()));
|
|
16
17
|
}
|
|
17
18
|
static fromTimestampValue(timestamp) {
|
|
18
19
|
return Hour.fromTimestamp(Timestamp.fromValue(timestamp));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const IbanSchemaError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const IbanSchema: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.ToUpperCaseAction, v.TransformAction<string, string>, v.CheckAction<string, string>, v.BrandAction<string, "IbanSchema">]>;
|
|
7
|
+
export type IbanSchemaType = v.InferOutput<typeof IbanSchema>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const IbanSchemaError = { Type: "iban.schema.type", Invalid: "iban.schema.invalid" };
|
|
3
|
+
// Two letters for country code, two digits, 11–30 uppercase letters or digits
|
|
4
|
+
const IBAN_CHARS_WHITELIST = /^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/;
|
|
5
|
+
export const IbanSchema = v.pipe(v.string(IbanSchemaError.Type), v.toUpperCase(), v.transform((value) => value.replaceAll(" ", "")), v.check((value) => IBAN_CHARS_WHITELIST.test(value), IbanSchemaError.Invalid),
|
|
6
|
+
// Stryker disable next-line StringLiteral
|
|
7
|
+
v.brand("IbanSchema"));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { IbanSchema } from "./iban-schema.vo";
|
|
2
3
|
export class IBAN {
|
|
3
4
|
value;
|
|
4
5
|
constructor(candidate) {
|
|
5
|
-
this.value =
|
|
6
|
+
this.value = v.parse(IbanSchema, candidate);
|
|
6
7
|
}
|
|
7
8
|
toString() {
|
|
8
9
|
return this.value;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const ImageWidthError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Length: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const ImageHeightError: {
|
|
7
|
+
Type: string;
|
|
8
|
+
Length: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const ImageWidth: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, number, string>, v.MaxValueAction<number, number, string>, v.BrandAction<number, "ImageWidth">]>;
|
|
11
|
+
export type ImageWidthType = v.InferOutput<typeof ImageWidth>;
|
|
12
|
+
export declare const ImageHeight: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, number, string>, v.MaxValueAction<number, number, string>, v.BrandAction<number, "ImageHeight">]>;
|
|
13
|
+
export type ImageHeightType = v.InferOutput<typeof ImageHeight>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const ImageWidthError = { Type: "image.width.type", Length: "image.width.length" };
|
|
3
|
+
export const ImageHeightError = { Type: "image.height.type", Length: "image.height.length" };
|
|
4
|
+
const IMAGE_DIMENSIONS_CONSTRAINTS = { min: 1, max: 10_000 };
|
|
5
|
+
export const ImageWidth = v.pipe(v.number(ImageWidthError.Type), v.integer(ImageWidthError.Type), v.minValue(IMAGE_DIMENSIONS_CONSTRAINTS.min, ImageWidthError.Length), v.maxValue(IMAGE_DIMENSIONS_CONSTRAINTS.max, ImageWidthError.Length),
|
|
6
|
+
// Stryker disable next-line StringLiteral
|
|
7
|
+
v.brand("ImageWidth"));
|
|
8
|
+
export const ImageHeight = v.pipe(v.number(ImageHeightError.Type), v.integer(ImageHeightError.Type), v.minValue(IMAGE_DIMENSIONS_CONSTRAINTS.min, ImageHeightError.Length), v.maxValue(IMAGE_DIMENSIONS_CONSTRAINTS.max, ImageHeightError.Length),
|
|
9
|
+
// Stryker disable next-line StringLiteral
|
|
10
|
+
v.brand("ImageHeight"));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const IntegerNonNegativeError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const IntegerNonNegative: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "IntegerNonNegative">]>;
|
|
7
|
+
export type IntegerNonNegativeType = v.InferOutput<typeof IntegerNonNegative>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const IntegerNonNegativeError = {
|
|
3
|
+
Type: "integer.non.negative.type",
|
|
4
|
+
Invalid: "integer.non.negative.invalid",
|
|
5
|
+
};
|
|
6
|
+
export const IntegerNonNegative = v.pipe(v.number(IntegerNonNegativeError.Type), v.integer(IntegerNonNegativeError.Type), v.minValue(0, IntegerNonNegativeError.Invalid),
|
|
7
|
+
// Stryker disable next-line StringLiteral
|
|
8
|
+
v.brand("IntegerNonNegative"));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const IntegerPositiveError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const IntegerPositive: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 1, string>, v.BrandAction<number, "IntegerPositive">]>;
|
|
7
|
+
export type IntegerPositiveType = v.InferOutput<typeof IntegerPositive>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const IntegerPositiveError = { Type: "integer.positive.type", Invalid: "integer.positive.invalid" };
|
|
3
|
+
export const IntegerPositive = v.pipe(v.number(IntegerPositiveError.Type), v.integer(IntegerPositiveError.Type), v.minValue(1, IntegerPositiveError.Invalid),
|
|
4
|
+
// Stryker disable next-line StringLiteral
|
|
5
|
+
v.brand("IntegerPositive"));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const IntegerError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const Integer: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.BrandAction<number, "Integer">]>;
|
|
6
|
+
export type IntegerType = v.InferOutput<typeof Integer>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const LanguageError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
BadChars: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Language: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>]>;
|
|
7
|
+
export type LanguageType = v.InferOutput<typeof Language>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
export const LanguageError = { Type: "language.type", BadChars: "language.bad.chars" };
|
|
3
3
|
// Two lowercase letters
|
|
4
4
|
const LANGUAGE_CHARS_WHITELIST = /^[a-z]{2}$/;
|
|
5
|
-
export const Language =
|
|
5
|
+
export const Language = v.pipe(v.string(LanguageError.Type), v.regex(LANGUAGE_CHARS_WHITELIST, LanguageError.BadChars));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const MimeValueError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const MimeValue: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "MimeValue">]>;
|
|
7
|
+
export type MimeValueType = v.InferOutput<typeof MimeValue>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
export const MimeValueError = { Type: "mime.value.type", Invalid: "mime.value.invalid" };
|
|
3
3
|
// One to twenty four lowercase letters, asterisk or hyphen, forward slash, one to seventy two lowercase letters, digits, asterisk, hyphen, plus, dot or underscore
|
|
4
4
|
const MIME_VALUE_CHARS_WHITELIST = /^[a-z*-]{1,24}\/[a-z0-9*+-_.]{1,72}$/;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.string(MimeValueError.Type)
|
|
9
|
-
.regex(MIME_VALUE_CHARS_WHITELIST, MimeValueError.Invalid)
|
|
10
|
-
.brand("MimeValue");
|
|
5
|
+
export const MimeValue = v.pipe(v.string(MimeValueError.Type), v.regex(MIME_VALUE_CHARS_WHITELIST, MimeValueError.Invalid),
|
|
6
|
+
// Stryker disable next-line StringLiteral
|
|
7
|
+
v.brand("MimeValue"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { MimeValue } from "./mime-value.vo";
|
|
2
3
|
export class Mime {
|
|
3
4
|
type;
|
|
@@ -7,7 +8,7 @@ export class Mime {
|
|
|
7
8
|
this.subtype = subtype;
|
|
8
9
|
}
|
|
9
10
|
static fromString(candidate) {
|
|
10
|
-
const value =
|
|
11
|
+
const value = v.parse(MimeValue, candidate.split(";")[0].trim());
|
|
11
12
|
const [type, subtype] = value.split("/");
|
|
12
13
|
return new Mime(type, subtype);
|
|
13
14
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { Extension } from "./extension.vo";
|
|
3
|
+
import { Mime } from "./mime.vo";
|
|
4
|
+
import { MimeRegistryEntry } from "./mime-registry-entry.vo";
|
|
5
|
+
export const Mimes = {
|
|
6
|
+
csv: new MimeRegistryEntry(Mime.fromString("text/csv"), [v.parse(Extension, "csv")]),
|
|
7
|
+
jpg: new MimeRegistryEntry(Mime.fromString("image/jpeg"), [
|
|
8
|
+
v.parse(Extension, "jpg"),
|
|
9
|
+
v.parse(Extension, "jpeg"),
|
|
10
|
+
]),
|
|
11
|
+
markdown: new MimeRegistryEntry(Mime.fromString("text/markdown"), [v.parse(Extension, "md")]),
|
|
12
|
+
mp4: new MimeRegistryEntry(Mime.fromString("video/mp4"), [v.parse(Extension, "mp4")]),
|
|
13
|
+
pdf: new MimeRegistryEntry(Mime.fromString("application/pdf"), [v.parse(Extension, "pdf")]),
|
|
14
|
+
png: new MimeRegistryEntry(Mime.fromString("image/png"), [v.parse(Extension, "png")]),
|
|
15
|
+
text: new MimeRegistryEntry(Mime.fromString("text/plain"), [v.parse(Extension, "txt")]),
|
|
16
|
+
webp: new MimeRegistryEntry(Mime.fromString("image/webp"), [v.parse(Extension, "webp")]),
|
|
17
|
+
wav: new MimeRegistryEntry(Mime.fromString("audio/wav"), [v.parse(Extension, "wav")]),
|
|
18
|
+
zip: new MimeRegistryEntry(Mime.fromString("application/zip"), [v.parse(Extension, "zip")]),
|
|
19
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const MinuteValueError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const MinuteValue: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.MaxValueAction<number, 59, string>, v.BrandAction<number, "MinuteValue">]>;
|
|
7
|
+
export type MinuteValueType = v.InferOutput<typeof MinuteValue>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const MinuteValueError = { Type: "minute.value.type", Invalid: "minute.value.invalid" };
|
|
3
|
+
export const MinuteValue = v.pipe(v.number(MinuteValueError.Type), v.integer(MinuteValueError.Type), v.minValue(0, MinuteValueError.Invalid), v.maxValue(59, MinuteValueError.Invalid),
|
|
4
|
+
// Stryker disable next-line StringLiteral
|
|
5
|
+
v.brand("MinuteValue"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { MinuteValue } from "./minute-value.vo";
|
|
2
3
|
import { Timestamp } from "./timestamp.vo";
|
|
3
4
|
export class Minute {
|
|
@@ -6,13 +7,13 @@ export class Minute {
|
|
|
6
7
|
this.value = value;
|
|
7
8
|
}
|
|
8
9
|
static fromValue(candidate) {
|
|
9
|
-
return new Minute(
|
|
10
|
+
return new Minute(v.parse(MinuteValue, candidate));
|
|
10
11
|
}
|
|
11
12
|
static fromValueSafe(candidate) {
|
|
12
13
|
return new Minute(candidate);
|
|
13
14
|
}
|
|
14
15
|
static fromTimestamp(timestamp) {
|
|
15
|
-
return new Minute(
|
|
16
|
+
return new Minute(v.parse(MinuteValue, new Date(timestamp.ms).getUTCMinutes()));
|
|
16
17
|
}
|
|
17
18
|
static fromTimestampValue(timestamp) {
|
|
18
19
|
return Minute.fromTimestamp(Timestamp.fromValue(timestamp));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const MoneyAmountError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const MoneyAmount: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "MoneyAmount">]>;
|
|
7
|
+
export type MoneyAmountType = v.InferOutput<typeof MoneyAmount>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const MoneyAmountError = { Type: "money.amount.type", Invalid: "money.amount.invalid" };
|
|
3
|
+
export const MoneyAmount = v.pipe(v.number(MoneyAmountError.Type), v.integer(MoneyAmountError.Type), v.minValue(0, MoneyAmountError.Invalid),
|
|
4
|
+
// Stryker disable next-line StringLiteral
|
|
5
|
+
v.brand("MoneyAmount"));
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { MoneyAmount } from "./money-amount.vo";
|
|
2
3
|
import { RoundingToNearestStrategy } from "./rounding-to-nearest.strategy";
|
|
3
4
|
export const MoneyError = { SubtractResultLessThanZero: "money.subtract.result.less.than.zero" };
|
|
4
5
|
export class Money {
|
|
5
6
|
amount;
|
|
6
|
-
static ZERO =
|
|
7
|
+
static ZERO = v.parse(MoneyAmount, 0);
|
|
7
8
|
constructor(amount) {
|
|
8
9
|
this.amount = amount;
|
|
9
10
|
}
|
|
10
11
|
static fromAmount(candidate) {
|
|
11
|
-
return new Money(
|
|
12
|
+
return new Money(v.parse(MoneyAmount, candidate));
|
|
12
13
|
}
|
|
13
14
|
static fromAmountSafe(candidate) {
|
|
14
15
|
return new Money(candidate);
|
|
@@ -20,19 +21,19 @@ export class Money {
|
|
|
20
21
|
return this.amount;
|
|
21
22
|
}
|
|
22
23
|
add(money) {
|
|
23
|
-
return new Money(
|
|
24
|
+
return new Money(v.parse(MoneyAmount, this.amount + money.getAmount()));
|
|
24
25
|
}
|
|
25
26
|
multiply(factor, rounding = new RoundingToNearestStrategy()) {
|
|
26
|
-
return new Money(
|
|
27
|
+
return new Money(v.parse(MoneyAmount, rounding.round(this.amount * factor)));
|
|
27
28
|
}
|
|
28
29
|
subtract(money) {
|
|
29
30
|
const result = this.amount - money.getAmount();
|
|
30
31
|
if (result < Money.ZERO)
|
|
31
32
|
throw new Error(MoneyError.SubtractResultLessThanZero);
|
|
32
|
-
return new Money(
|
|
33
|
+
return new Money(v.parse(MoneyAmount, result));
|
|
33
34
|
}
|
|
34
35
|
divide(factor, rounding = new RoundingToNearestStrategy()) {
|
|
35
|
-
return new Money(
|
|
36
|
+
return new Money(v.parse(MoneyAmount, rounding.round(this.amount / factor)));
|
|
36
37
|
}
|
|
37
38
|
equals(another) {
|
|
38
39
|
return this.amount === another.getAmount();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const MonthIsoIdError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
BadChars: string;
|
|
5
|
+
Invalid: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const MonthIsoId: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.CheckAction<string, string>, v.BrandAction<string, "MonthIsoId">]>;
|
|
8
|
+
export type MonthIsoIdType = v.InferOutput<typeof MonthIsoId>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
export const MonthIsoIdError = {
|
|
3
3
|
Type: "month.iso.id.type",
|
|
4
4
|
BadChars: "month.iso.id.bad.chars",
|
|
@@ -6,13 +6,9 @@ export const MonthIsoIdError = {
|
|
|
6
6
|
};
|
|
7
7
|
// Four digits, hyphen, two digits
|
|
8
8
|
const MONTH_ISO_ID_CHARS_WHITELIST = /^\d{4}-\d{2}$/;
|
|
9
|
-
|
|
10
|
-
export const MonthIsoId = z
|
|
11
|
-
// Stryker restore all
|
|
12
|
-
.string(MonthIsoIdError.Type)
|
|
13
|
-
.regex(MONTH_ISO_ID_CHARS_WHITELIST, MonthIsoIdError.BadChars)
|
|
14
|
-
.refine((value) => {
|
|
9
|
+
export const MonthIsoId = v.pipe(v.string(MonthIsoIdError.Type), v.regex(MONTH_ISO_ID_CHARS_WHITELIST, MonthIsoIdError.BadChars), v.check((value) => {
|
|
15
10
|
const month = value.split("-").map(Number)[1];
|
|
16
11
|
return month >= 1 && month <= 12;
|
|
17
|
-
}, MonthIsoIdError.Invalid)
|
|
18
|
-
|
|
12
|
+
}, MonthIsoIdError.Invalid),
|
|
13
|
+
// Stryker disable next-line StringLiteral
|
|
14
|
+
v.brand("MonthIsoId"));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { endOfMonth, format, startOfMonth } from "date-fns";
|
|
2
|
+
import * as v from "valibot";
|
|
2
3
|
import { DateRange } from "./date-range.vo";
|
|
3
4
|
import { Integer } from "./integer.vo";
|
|
4
5
|
import { MonthIsoId } from "./month-iso-id.vo";
|
|
@@ -16,18 +17,18 @@ export class Month extends DateRange {
|
|
|
16
17
|
return Month.fromTimestamp(now);
|
|
17
18
|
}
|
|
18
19
|
static fromIsoId(iso) {
|
|
19
|
-
const [year, month] =
|
|
20
|
+
const [year, month] = v.parse(MonthIsoId, iso).split("-").map(Number);
|
|
20
21
|
const reference = Timestamp.fromNumber(Date.UTC(year, month - 1, 1));
|
|
21
22
|
return Month.fromTimestamp(reference);
|
|
22
23
|
}
|
|
23
24
|
toIsoId() {
|
|
24
|
-
return
|
|
25
|
+
return v.parse(MonthIsoId, format(this.getStart().ms, "yyyy-MM"));
|
|
25
26
|
}
|
|
26
27
|
previous() {
|
|
27
|
-
return this.shift(
|
|
28
|
+
return this.shift(v.parse(Integer, -1));
|
|
28
29
|
}
|
|
29
30
|
next() {
|
|
30
|
-
return this.shift(
|
|
31
|
+
return this.shift(v.parse(Integer, 1));
|
|
31
32
|
}
|
|
32
33
|
shift(count) {
|
|
33
34
|
const start = new Date(this.getStart().ms);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const MultiplicationFactorError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const MultiplicationFactor: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.MinValueAction<number, 0, string>, v.BrandAction<number, "MultiplicationFactor">]>;
|
|
7
|
+
export type MultiplicationFactorType = v.InferOutput<typeof MultiplicationFactor>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const MultiplicationFactorError = {
|
|
3
|
+
Type: "multiplication.factor.type",
|
|
4
|
+
Invalid: "multiplication.factor.invalid",
|
|
5
|
+
};
|
|
6
|
+
export const MultiplicationFactor = v.pipe(v.number(MultiplicationFactorError.Type), v.minValue(0, MultiplicationFactorError.Invalid),
|
|
7
|
+
// Stryker disable next-line StringLiteral
|
|
8
|
+
v.brand("MultiplicationFactor"));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const ObjectKeyError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
LeadingSlash: string;
|
|
5
|
+
Empty: string;
|
|
6
|
+
TooLong: string;
|
|
7
|
+
BadChars: string;
|
|
8
|
+
DotSegments: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const ObjectKey: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.MinLengthAction<string, 1, string>, v.MaxLengthAction<string, 256, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.CheckAction<string, string>, v.BrandAction<string, "ObjectKey">]>;
|
|
11
|
+
export type ObjectKeyType = v.InferOutput<typeof ObjectKey>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const ObjectKeyError = {
|
|
3
|
+
Type: "object.key.type",
|
|
4
|
+
LeadingSlash: "object.key.leading.slash",
|
|
5
|
+
Empty: "object.key.empty",
|
|
6
|
+
TooLong: "object.key.too.long",
|
|
7
|
+
BadChars: "object.key.bad.chars",
|
|
8
|
+
DotSegments: "object.key.dot.segments",
|
|
9
|
+
};
|
|
10
|
+
// Lowercase letters, digits, dots, underscores, and hyphens
|
|
11
|
+
const OBJECT_KEY_SEGMENT_CHARS_WHITELIST = /^[a-z0-9._-]+$/;
|
|
12
|
+
const DOT_SEGMENTS = [".", ".."];
|
|
13
|
+
export const ObjectKey = v.pipe(v.string(ObjectKeyError.Type), v.minLength(1, ObjectKeyError.Empty), v.maxLength(256, ObjectKeyError.TooLong), v.check((value) => !value.startsWith("/"), ObjectKeyError.LeadingSlash),
|
|
14
|
+
// Allow only known characters for users/avatars/1234567890/avatar.png segments
|
|
15
|
+
v.check((value) => value.split("/").every((segment) => OBJECT_KEY_SEGMENT_CHARS_WHITELIST.test(segment)), ObjectKeyError.BadChars),
|
|
16
|
+
// Reject object keys like users/./avatar.png or users/../avatar.png
|
|
17
|
+
v.check((value) => value.split("/").every((segment) => !DOT_SEGMENTS.includes(segment)), ObjectKeyError.DotSegments),
|
|
18
|
+
// Stryker disable next-line StringLiteral
|
|
19
|
+
v.brand("ObjectKey"));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const PackageVersionSchemaError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
BadChars: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const PACKAGE_VERSIONS_CHARS_WHITELIST: RegExp;
|
|
7
|
+
export declare const PackageVersionSchema: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.BrandAction<string, "PackageVersionSchema">]>;
|
|
8
|
+
export type PackageVersionSchemaType = v.InferOutput<typeof PackageVersionSchema>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as v from "valibot";
|
|
2
2
|
export const PackageVersionSchemaError = {
|
|
3
3
|
Type: "package.version.schema.error",
|
|
4
4
|
BadChars: "package.version.schema.bad.chars",
|
|
5
5
|
};
|
|
6
6
|
// v, 1-4 digits, dot, 1-4 digits, dot, 1-4 digits - () for capturing groups
|
|
7
7
|
export const PACKAGE_VERSIONS_CHARS_WHITELIST = /^v([0-9]{1,4})\.([0-9]{1,4})\.([0-9]{1,4})$/;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.string(PackageVersionSchemaError.Type)
|
|
12
|
-
.regex(PACKAGE_VERSIONS_CHARS_WHITELIST, PackageVersionSchemaError.BadChars)
|
|
13
|
-
.brand("PackageVersionSchema");
|
|
8
|
+
export const PackageVersionSchema = v.pipe(v.string(PackageVersionSchemaError.Type), v.regex(PACKAGE_VERSIONS_CHARS_WHITELIST, PackageVersionSchemaError.BadChars),
|
|
9
|
+
// Stryker disable next-line StringLiteral
|
|
10
|
+
v.brand("PackageVersionSchema"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
1
2
|
import { PACKAGE_VERSIONS_CHARS_WHITELIST, PackageVersionSchema, } from "./package-version-schema.vo";
|
|
2
3
|
export class PackageVersion {
|
|
3
4
|
major;
|
|
@@ -9,16 +10,14 @@ export class PackageVersion {
|
|
|
9
10
|
this.patch = patch;
|
|
10
11
|
}
|
|
11
12
|
static fromVersionString(candidate) {
|
|
12
|
-
|
|
13
|
-
return PackageVersion.fromVersionStringSafe(version);
|
|
13
|
+
return PackageVersion.fromVersionStringSafe(v.parse(PackageVersionSchema, candidate));
|
|
14
14
|
}
|
|
15
15
|
static fromVersionStringSafe(candidate) {
|
|
16
16
|
const [, major, minor, patch] = PACKAGE_VERSIONS_CHARS_WHITELIST.exec(candidate).map(Number);
|
|
17
17
|
return new PackageVersion(major, minor, patch);
|
|
18
18
|
}
|
|
19
19
|
static fromString(candidate) {
|
|
20
|
-
|
|
21
|
-
return PackageVersion.fromVersionStringSafe(version);
|
|
20
|
+
return PackageVersion.fromVersionStringSafe(v.parse(PackageVersionSchema, `v${candidate}`));
|
|
22
21
|
}
|
|
23
22
|
compareTo(another) {
|
|
24
23
|
if (this.major > another.major)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const PaginationPageError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const Page: v.SchemaWithPipe<readonly [v.UnknownSchema, v.TransformAction<unknown, number>, v.NumberSchema<string>, v.IntegerAction<number, string>, v.TransformAction<number, number>]>;
|
|
6
|
+
export type PageType = v.InferOutput<typeof Page>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export const PaginationPageError = { Type: "pagination.page.type" };
|
|
3
|
+
export const Page = v.pipe(v.unknown(), v.transform((value) => (value === undefined ? 1 : Number(value))), v.number(PaginationPageError.Type), v.integer(PaginationPageError.Type), v.transform((value) => (value <= 0 ? 1 : value)));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const PaginationSkipError: {
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Skip: v.SchemaWithPipe<readonly [v.NumberSchema<string>, v.IntegerAction<number, string>, v.MinValueAction<number, 0, string>]>;
|
|
7
|
+
export type SkipType = v.InferOutput<typeof Skip>;
|