@bgord/tools 1.4.6 → 1.4.7

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.
Files changed (221) hide show
  1. package/package.json +1 -1
  2. package/dist/age-years.vo.d.ts +0 -11
  3. package/dist/age-years.vo.js +0 -6
  4. package/dist/age.vo.d.ts +0 -28
  5. package/dist/age.vo.js +0 -51
  6. package/dist/api-key.vo.d.ts +0 -7
  7. package/dist/api-key.vo.js +0 -7
  8. package/dist/basename.vo.d.ts +0 -12
  9. package/dist/basename.vo.js +0 -22
  10. package/dist/batch.d.ts +0 -2
  11. package/dist/batch.js +0 -3
  12. package/dist/date-calculator.service.d.ts +0 -10
  13. package/dist/date-calculator.service.js +0 -12
  14. package/dist/date-formatter.service.d.ts +0 -9
  15. package/dist/date-formatter.service.js +0 -15
  16. package/dist/date-range.vo.d.ts +0 -21
  17. package/dist/date-range.vo.js +0 -35
  18. package/dist/day-iso-id.vo.d.ts +0 -9
  19. package/dist/day-iso-id.vo.js +0 -12
  20. package/dist/day.vo.d.ts +0 -16
  21. package/dist/day.vo.js +0 -43
  22. package/dist/directory-path-absolute.vo.d.ts +0 -12
  23. package/dist/directory-path-absolute.vo.js +0 -20
  24. package/dist/directory-path-relative.vo.d.ts +0 -12
  25. package/dist/directory-path-relative.vo.js +0 -17
  26. package/dist/distance-value.vo.d.ts +0 -7
  27. package/dist/distance-value.vo.js +0 -5
  28. package/dist/distance.vo.d.ts +0 -23
  29. package/dist/distance.vo.js +0 -53
  30. package/dist/division-factor.vo.d.ts +0 -7
  31. package/dist/division-factor.vo.js +0 -5
  32. package/dist/dll.service.d.ts +0 -29
  33. package/dist/dll.service.js +0 -148
  34. package/dist/duration-ms.vo.d.ts +0 -6
  35. package/dist/duration-ms.vo.js +0 -5
  36. package/dist/duration.service.d.ts +0 -37
  37. package/dist/duration.service.js +0 -87
  38. package/dist/email-mask.service.d.ts +0 -4
  39. package/dist/email-mask.service.js +0 -12
  40. package/dist/email.vo.d.ts +0 -6
  41. package/dist/email.vo.js +0 -4
  42. package/dist/etags.vo.d.ts +0 -23
  43. package/dist/etags.vo.js +0 -37
  44. package/dist/extension.vo.d.ts +0 -9
  45. package/dist/extension.vo.js +0 -15
  46. package/dist/feature-flag-value.vo.d.ts +0 -10
  47. package/dist/feature-flag-value.vo.js +0 -8
  48. package/dist/feature-flag.vo.d.ts +0 -5
  49. package/dist/feature-flag.vo.js +0 -9
  50. package/dist/file-path-absolute-schema.vo.d.ts +0 -17
  51. package/dist/file-path-absolute-schema.vo.js +0 -20
  52. package/dist/file-path-relative-schema.vo.d.ts +0 -17
  53. package/dist/file-path-relative-schema.vo.js +0 -20
  54. package/dist/file-path.vo.d.ts +0 -31
  55. package/dist/file-path.vo.js +0 -81
  56. package/dist/filename-affix.vo.d.ts +0 -13
  57. package/dist/filename-affix.vo.js +0 -17
  58. package/dist/filename-from-string.vo.d.ts +0 -10
  59. package/dist/filename-from-string.vo.js +0 -17
  60. package/dist/filename.vo.d.ts +0 -24
  61. package/dist/filename.vo.js +0 -69
  62. package/dist/height-milimiters.vo.d.ts +0 -7
  63. package/dist/height-milimiters.vo.js +0 -8
  64. package/dist/height.vo.d.ts +0 -21
  65. package/dist/height.vo.js +0 -51
  66. package/dist/hour-value.vo.d.ts +0 -7
  67. package/dist/hour-value.vo.js +0 -5
  68. package/dist/hour.vo.d.ts +0 -20
  69. package/dist/hour.vo.js +0 -48
  70. package/dist/iban-mask.service.d.ts +0 -4
  71. package/dist/iban-mask.service.js +0 -12
  72. package/dist/iban-schema.vo.d.ts +0 -7
  73. package/dist/iban-schema.vo.js +0 -7
  74. package/dist/iban.vo.d.ts +0 -9
  75. package/dist/iban.vo.js +0 -23
  76. package/dist/image.vo.d.ts +0 -13
  77. package/dist/image.vo.js +0 -10
  78. package/dist/index.d.ts +0 -110
  79. package/dist/index.js +0 -110
  80. package/dist/int.vo.d.ts +0 -8
  81. package/dist/int.vo.js +0 -15
  82. package/dist/integer-non-negative.vo.d.ts +0 -7
  83. package/dist/integer-non-negative.vo.js +0 -8
  84. package/dist/integer-positive.vo.d.ts +0 -7
  85. package/dist/integer-positive.vo.js +0 -5
  86. package/dist/integer.vo.d.ts +0 -6
  87. package/dist/integer.vo.js +0 -4
  88. package/dist/language.vo.d.ts +0 -7
  89. package/dist/language.vo.js +0 -5
  90. package/dist/linear-regression.service.d.ts +0 -27
  91. package/dist/linear-regression.service.js +0 -58
  92. package/dist/mean.service.d.ts +0 -8
  93. package/dist/mean.service.js +0 -13
  94. package/dist/mime-registry-entry.vo.d.ts +0 -7
  95. package/dist/mime-registry-entry.vo.js +0 -8
  96. package/dist/mime-registry.service.d.ts +0 -16
  97. package/dist/mime-registry.service.js +0 -31
  98. package/dist/mime-value.vo.d.ts +0 -7
  99. package/dist/mime-value.vo.js +0 -7
  100. package/dist/mime.vo.d.ts +0 -12
  101. package/dist/mime.vo.js +0 -26
  102. package/dist/mimes.d.ts +0 -13
  103. package/dist/mimes.js +0 -19
  104. package/dist/min-max-scaler.service.d.ts +0 -46
  105. package/dist/min-max-scaler.service.js +0 -61
  106. package/dist/minute-value.vo.d.ts +0 -7
  107. package/dist/minute-value.vo.js +0 -5
  108. package/dist/minute.vo.d.ts +0 -20
  109. package/dist/minute.vo.js +0 -48
  110. package/dist/money-amount.vo.d.ts +0 -7
  111. package/dist/money-amount.vo.js +0 -5
  112. package/dist/money.vo.d.ts +0 -26
  113. package/dist/money.vo.js +0 -56
  114. package/dist/month-iso-id.vo.d.ts +0 -8
  115. package/dist/month-iso-id.vo.js +0 -14
  116. package/dist/month.vo.d.ts +0 -16
  117. package/dist/month.vo.js +0 -40
  118. package/dist/multiplication-factor.vo.d.ts +0 -7
  119. package/dist/multiplication-factor.vo.js +0 -8
  120. package/dist/noop.service.d.ts +0 -2
  121. package/dist/noop.service.js +0 -2
  122. package/dist/object-key.vo.d.ts +0 -11
  123. package/dist/object-key.vo.js +0 -19
  124. package/dist/outlier-detector.service.d.ts +0 -9
  125. package/dist/outlier-detector.service.js +0 -16
  126. package/dist/package-version-schema.vo.d.ts +0 -8
  127. package/dist/package-version-schema.vo.js +0 -10
  128. package/dist/package-version.vo.d.ts +0 -22
  129. package/dist/package-version.vo.js +0 -58
  130. package/dist/pagination-page.vo.d.ts +0 -6
  131. package/dist/pagination-page.vo.js +0 -3
  132. package/dist/pagination-skip.vo.d.ts +0 -7
  133. package/dist/pagination-skip.vo.js +0 -3
  134. package/dist/pagination-take.vo.d.ts +0 -7
  135. package/dist/pagination-take.vo.js +0 -3
  136. package/dist/pagination.service.d.ts +0 -53
  137. package/dist/pagination.service.js +0 -44
  138. package/dist/percentage.service.d.ts +0 -7
  139. package/dist/percentage.service.js +0 -9
  140. package/dist/population-standard-deviation.service.d.ts +0 -7
  141. package/dist/population-standard-deviation.service.js +0 -17
  142. package/dist/quarter-iso-id.vo.d.ts +0 -8
  143. package/dist/quarter-iso-id.vo.js +0 -7
  144. package/dist/quarter.vo.d.ts +0 -12
  145. package/dist/quarter.vo.js +0 -30
  146. package/dist/random.service.d.ts +0 -13
  147. package/dist/random.service.js +0 -13
  148. package/dist/rate-limiter.service.d.ts +0 -17
  149. package/dist/rate-limiter.service.js +0 -19
  150. package/dist/relative-date.vo.d.ts +0 -13
  151. package/dist/relative-date.vo.js +0 -14
  152. package/dist/reordering-item-position-value.vo.d.ts +0 -6
  153. package/dist/reordering-item-position-value.vo.js +0 -3
  154. package/dist/reordering.service.d.ts +0 -63
  155. package/dist/reordering.service.js +0 -135
  156. package/dist/repeat.d.ts +0 -1
  157. package/dist/repeat.js +0 -3
  158. package/dist/revision-value.vo.d.ts +0 -7
  159. package/dist/revision-value.vo.js +0 -3
  160. package/dist/revision.vo.d.ts +0 -18
  161. package/dist/revision.vo.js +0 -36
  162. package/dist/rounding-decimal.strategy.d.ts +0 -12
  163. package/dist/rounding-decimal.strategy.js +0 -14
  164. package/dist/rounding-down.strategy.d.ts +0 -4
  165. package/dist/rounding-down.strategy.js +0 -5
  166. package/dist/rounding-to-nearest.strategy.d.ts +0 -4
  167. package/dist/rounding-to-nearest.strategy.js +0 -5
  168. package/dist/rounding-up.strategy.d.ts +0 -4
  169. package/dist/rounding-up.strategy.js +0 -5
  170. package/dist/rounding.strategy.d.ts +0 -3
  171. package/dist/rounding.strategy.js +0 -0
  172. package/dist/size-bytes.vo.d.ts +0 -6
  173. package/dist/size-bytes.vo.js +0 -5
  174. package/dist/size.vo.d.ts +0 -41
  175. package/dist/size.vo.js +0 -91
  176. package/dist/slug.service.d.ts +0 -4
  177. package/dist/slug.service.js +0 -15
  178. package/dist/sms-body.vo.d.ts +0 -8
  179. package/dist/sms-body.vo.js +0 -9
  180. package/dist/sms-message.vo.d.ts +0 -13
  181. package/dist/sms-message.vo.js +0 -13
  182. package/dist/sum.service.d.ts +0 -4
  183. package/dist/sum.service.js +0 -16
  184. package/dist/telephone-number.vo.d.ts +0 -7
  185. package/dist/telephone-number.vo.js +0 -10
  186. package/dist/thousands-separator.service.d.ts +0 -4
  187. package/dist/thousands-separator.service.js +0 -9
  188. package/dist/time-zone-offset-value.vo.d.ts +0 -8
  189. package/dist/time-zone-offset-value.vo.js +0 -13
  190. package/dist/timestamp-value.vo.d.ts +0 -6
  191. package/dist/timestamp-value.vo.js +0 -5
  192. package/dist/timestamp.vo.d.ts +0 -21
  193. package/dist/timestamp.vo.js +0 -54
  194. package/dist/timezone.vo.d.ts +0 -9
  195. package/dist/timezone.vo.js +0 -20
  196. package/dist/ts-utils.d.ts +0 -3
  197. package/dist/ts-utils.js +0 -0
  198. package/dist/url-with-slash.vo.d.ts +0 -6
  199. package/dist/url-with-slash.vo.js +0 -5
  200. package/dist/url-without-slash.vo.d.ts +0 -6
  201. package/dist/url-without-slash.vo.js +0 -5
  202. package/dist/visually-unambiguous-characters-generator.service.d.ts +0 -4
  203. package/dist/visually-unambiguous-characters-generator.service.js +0 -32
  204. package/dist/week-iso-id.vo.d.ts +0 -8
  205. package/dist/week-iso-id.vo.js +0 -19
  206. package/dist/week.vo.d.ts +0 -16
  207. package/dist/week.vo.js +0 -45
  208. package/dist/weekday-iso-id.vo.d.ts +0 -7
  209. package/dist/weekday-iso-id.vo.js +0 -5
  210. package/dist/weekday.vo.d.ts +0 -28
  211. package/dist/weekday.vo.js +0 -60
  212. package/dist/weight-grams.vo.d.ts +0 -7
  213. package/dist/weight-grams.vo.js +0 -5
  214. package/dist/weight.vo.d.ts +0 -25
  215. package/dist/weight.vo.js +0 -65
  216. package/dist/year-iso-id.vo.d.ts +0 -7
  217. package/dist/year-iso-id.vo.js +0 -7
  218. package/dist/year.vo.d.ts +0 -18
  219. package/dist/year.vo.js +0 -50
  220. package/dist/z-score.service.d.ts +0 -11
  221. package/dist/z-score.service.js +0 -19
@@ -1,17 +0,0 @@
1
- import * as v from "valibot";
2
- export var FilenameAffixStrategy;
3
- (function (FilenameAffixStrategy) {
4
- FilenameAffixStrategy["prefix"] = "prefix";
5
- FilenameAffixStrategy["suffix"] = "suffix";
6
- })(FilenameAffixStrategy || (FilenameAffixStrategy = {}));
7
- export const FilenameAffixError = {
8
- Type: "affix.type",
9
- Empty: "affix.empty",
10
- TooLong: "affix.too.long",
11
- BadChars: "affix.bad.chars",
12
- };
13
- // Letters, digits, underscores, and hyphens allowed
14
- const FILENAME_AFFIX_WHITELIST = /^[a-zA-Z0-9_-]+$/;
15
- export const FilenameAffix = v.pipe(v.string(FilenameAffixError.Type), v.minLength(1, FilenameAffixError.Empty), v.maxLength(32, FilenameAffixError.TooLong), v.regex(FILENAME_AFFIX_WHITELIST, FilenameAffixError.BadChars),
16
- // Stryker disable next-line StringLiteral
17
- v.brand("FilenameAffix"));
@@ -1,10 +0,0 @@
1
- import * as v from "valibot";
2
- export declare const FilenameFromStringError: {
3
- Type: string;
4
- Invalid: string;
5
- };
6
- export declare const FilenameFromString: v.SchemaWithPipe<readonly [v.StringSchema<string>, v.RegexAction<string, string>, v.TransformAction<string, {
7
- basename: string & v.Brand<"Basename">;
8
- extension: string & v.Brand<"Extension">;
9
- }>]>;
10
- export type FilenameFromStringType = v.InferOutput<typeof FilenameFromString>;
@@ -1,17 +0,0 @@
1
- import * as v from "valibot";
2
- import { Basename } from "./basename.vo";
3
- import { Extension } from "./extension.vo";
4
- export const FilenameFromStringError = {
5
- Type: "filename.from.string.type",
6
- Invalid: "filename.from.string.invalid",
7
- };
8
- // .+ at least one character, advances to the last dot
9
- // .
10
- // .+ at least one character
11
- const DOT_WITH_SIDES = /^.+\..+$/;
12
- export const FilenameFromString = v.pipe(v.string(FilenameFromStringError.Type), v.regex(DOT_WITH_SIDES, FilenameFromStringError.Invalid), v.transform((value) => {
13
- const index = value.lastIndexOf(".");
14
- const basename = v.parse(Basename, value.slice(0, index));
15
- const extension = v.parse(Extension, value.slice(index + 1));
16
- return { basename, extension };
17
- }));
@@ -1,24 +0,0 @@
1
- import { type BasenameType } from "./basename.vo";
2
- import { type ExtensionType } from "./extension.vo";
3
- import { FilenameAffixStrategy, type FilenameAffixType } from "./filename-affix.vo";
4
- export declare class Filename {
5
- private readonly basename;
6
- private readonly extension;
7
- private constructor();
8
- static fromParts(basename: string, extension: string): Filename;
9
- static fromPartsSafe(basename: BasenameType, extension: ExtensionType): Filename;
10
- static fromString(candidate: string): Filename;
11
- get(): string;
12
- getBasename(): BasenameType;
13
- getExtension(): ExtensionType;
14
- withExtension(extension: ExtensionType): Filename;
15
- withBasename(basename: BasenameType): Filename;
16
- withAffix(candidate: string, strategy: FilenameAffixStrategy): Filename;
17
- withAffixSafe(affix: FilenameAffixType, strategy: FilenameAffixStrategy): Filename;
18
- withSuffix(candidate: string): Filename;
19
- withSuffixSafe(affix: FilenameAffixType): Filename;
20
- withPrefix(candidate: string): Filename;
21
- withPrefixSafe(affix: FilenameAffixType): Filename;
22
- toString(): string;
23
- toJSON(): string;
24
- }
@@ -1,69 +0,0 @@
1
- import * as v from "valibot";
2
- import { Basename } from "./basename.vo";
3
- import { Extension } from "./extension.vo";
4
- import { FilenameAffix, FilenameAffixStrategy } from "./filename-affix.vo";
5
- import { FilenameFromString } from "./filename-from-string.vo";
6
- export class Filename {
7
- basename;
8
- extension;
9
- constructor(basename, extension) {
10
- this.basename = basename;
11
- this.extension = extension;
12
- }
13
- static fromParts(basename, extension) {
14
- return new Filename(v.parse(Basename, basename), v.parse(Extension, extension));
15
- }
16
- static fromPartsSafe(basename, extension) {
17
- return new Filename(basename, extension);
18
- }
19
- static fromString(candidate) {
20
- const filename = v.parse(FilenameFromString, candidate);
21
- return new Filename(filename.basename, filename.extension);
22
- }
23
- get() {
24
- return `${this.basename}.${this.extension}`;
25
- }
26
- getBasename() {
27
- return this.basename;
28
- }
29
- getExtension() {
30
- return this.extension;
31
- }
32
- withExtension(extension) {
33
- return new Filename(this.basename, extension);
34
- }
35
- withBasename(basename) {
36
- return new Filename(basename, this.extension);
37
- }
38
- withAffix(candidate, strategy) {
39
- const affix = v.parse(FilenameAffix, candidate);
40
- if (strategy === FilenameAffixStrategy.prefix) {
41
- return new Filename(v.parse(Basename, `${affix}${this.basename}`), this.extension);
42
- }
43
- return new Filename(v.parse(Basename, `${this.basename}${affix}`), this.extension);
44
- }
45
- withAffixSafe(affix, strategy) {
46
- if (strategy === FilenameAffixStrategy.prefix) {
47
- return new Filename(v.parse(Basename, `${affix}${this.basename}`), this.extension);
48
- }
49
- return new Filename(v.parse(Basename, `${this.basename}${affix}`), this.extension);
50
- }
51
- withSuffix(candidate) {
52
- return this.withAffix(candidate, FilenameAffixStrategy.suffix);
53
- }
54
- withSuffixSafe(affix) {
55
- return this.withAffix(affix, FilenameAffixStrategy.suffix);
56
- }
57
- withPrefix(candidate) {
58
- return this.withAffix(candidate, FilenameAffixStrategy.prefix);
59
- }
60
- withPrefixSafe(affix) {
61
- return this.withAffix(affix, FilenameAffixStrategy.prefix);
62
- }
63
- toString() {
64
- return this.get();
65
- }
66
- toJSON() {
67
- return this.get();
68
- }
69
- }
@@ -1,7 +0,0 @@
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>;
@@ -1,8 +0,0 @@
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 +0,0 @@
1
- import { type HeightMillimetersType } from "./height-milimiters.vo";
2
- import type { RoundingStrategy } from "./rounding.strategy";
3
- export declare class Height {
4
- private readonly millimeters;
5
- private static readonly ZERO;
6
- private static readonly MILLIMETERS_PER_CENTIMETER;
7
- private constructor();
8
- static fromMillimeters(millimeters: number): Height;
9
- static fromMillimetersSafe(millimeters: HeightMillimetersType): Height;
10
- static fromCentimeters(centimeters: number, rounding?: RoundingStrategy): Height;
11
- static zero(): Height;
12
- get(): number;
13
- toMillimeters(): number;
14
- toCentimeters(): number;
15
- toString(): string;
16
- equals(another: Height): boolean;
17
- greaterThan(another: Height): boolean;
18
- lessThan(another: Height): boolean;
19
- isZero(): boolean;
20
- toJSON(): number;
21
- }
package/dist/height.vo.js DELETED
@@ -1,51 +0,0 @@
1
- import * as v from "valibot";
2
- import { HeightMillimeters } from "./height-milimiters.vo";
3
- import { RoundingToNearestStrategy } from "./rounding-to-nearest.strategy";
4
- export class Height {
5
- millimeters;
6
- static ZERO = v.parse(HeightMillimeters, 0);
7
- static MILLIMETERS_PER_CENTIMETER = 10;
8
- constructor(millimeters) {
9
- this.millimeters = millimeters;
10
- }
11
- static fromMillimeters(millimeters) {
12
- return new Height(v.parse(HeightMillimeters, millimeters));
13
- }
14
- static fromMillimetersSafe(millimeters) {
15
- return new Height(millimeters);
16
- }
17
- static fromCentimeters(centimeters, rounding = new RoundingToNearestStrategy()) {
18
- const millimeters = rounding.round(centimeters * Height.MILLIMETERS_PER_CENTIMETER);
19
- return new Height(v.parse(HeightMillimeters, millimeters));
20
- }
21
- static zero() {
22
- return Height.fromMillimetersSafe(Height.ZERO);
23
- }
24
- get() {
25
- return this.millimeters;
26
- }
27
- toMillimeters() {
28
- return this.millimeters;
29
- }
30
- toCentimeters() {
31
- return this.millimeters / Height.MILLIMETERS_PER_CENTIMETER;
32
- }
33
- toString() {
34
- return this.millimeters.toString();
35
- }
36
- equals(another) {
37
- return this.millimeters === another.millimeters;
38
- }
39
- greaterThan(another) {
40
- return this.millimeters > another.millimeters;
41
- }
42
- lessThan(another) {
43
- return this.millimeters < another.millimeters;
44
- }
45
- isZero() {
46
- return this.millimeters === 0;
47
- }
48
- toJSON() {
49
- return this.millimeters;
50
- }
51
- }
@@ -1,7 +0,0 @@
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>;
@@ -1,5 +0,0 @@
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"));
package/dist/hour.vo.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { type HourValueType } from "./hour-value.vo";
2
- import { Timestamp } from "./timestamp.vo";
3
- import type { TimestampValueType } from "./timestamp-value.vo";
4
- export declare class Hour {
5
- private readonly value;
6
- private constructor();
7
- static fromValue(candidate: number): Hour;
8
- static fromValueSafe(candidate: HourValueType): Hour;
9
- static fromTimestamp(timestamp: Timestamp): Hour;
10
- static fromTimestampValue(timestamp: TimestampValueType): Hour;
11
- static zero(): Hour;
12
- static max(): Hour;
13
- get(): HourValueType;
14
- equals(another: Hour): boolean;
15
- isAfter(another: Hour): boolean;
16
- isBefore(another: Hour): boolean;
17
- static list(): ReadonlyArray<Hour>;
18
- toString(): string;
19
- toJSON(): number;
20
- }
package/dist/hour.vo.js DELETED
@@ -1,48 +0,0 @@
1
- import * as v from "valibot";
2
- import { HourValue } from "./hour-value.vo";
3
- import { Timestamp } from "./timestamp.vo";
4
- export class Hour {
5
- value;
6
- constructor(value) {
7
- this.value = value;
8
- }
9
- static fromValue(candidate) {
10
- return new Hour(v.parse(HourValue, candidate));
11
- }
12
- static fromValueSafe(candidate) {
13
- return new Hour(candidate);
14
- }
15
- static fromTimestamp(timestamp) {
16
- return new Hour(v.parse(HourValue, new Date(timestamp.ms).getUTCHours()));
17
- }
18
- static fromTimestampValue(timestamp) {
19
- return Hour.fromTimestamp(Timestamp.fromValue(timestamp));
20
- }
21
- static zero() {
22
- return Hour.fromValue(0);
23
- }
24
- static max() {
25
- return Hour.fromValue(23);
26
- }
27
- get() {
28
- return this.value;
29
- }
30
- equals(another) {
31
- return this.value === another.value;
32
- }
33
- isAfter(another) {
34
- return this.value > another.value;
35
- }
36
- isBefore(another) {
37
- return this.value < another.value;
38
- }
39
- static list() {
40
- return Array.from({ length: 24 }, (_, index) => Hour.fromValue(index));
41
- }
42
- toString() {
43
- return this.value.toString();
44
- }
45
- toJSON() {
46
- return this.value;
47
- }
48
- }
@@ -1,4 +0,0 @@
1
- import type { IBAN } from "./iban.vo";
2
- export declare class IbanMask {
3
- static censor(iban: IBAN): string;
4
- }
@@ -1,12 +0,0 @@
1
- export class IbanMask {
2
- static censor(iban) {
3
- const value = iban.format();
4
- const FIRST_SPACE_INDEX = 4;
5
- const LAST_SPACE_INDEX = value.length - 5;
6
- const start = value.slice(0, FIRST_SPACE_INDEX);
7
- const middle = value.slice(FIRST_SPACE_INDEX + 1, LAST_SPACE_INDEX);
8
- const end = value.slice(-4);
9
- const maskedMiddle = middle.replace(/[A-Z0-9]/g, "*");
10
- return `${start} ${maskedMiddle} ${end}`;
11
- }
12
- }
@@ -1,7 +0,0 @@
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>;
@@ -1,7 +0,0 @@
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"));
package/dist/iban.vo.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { type IbanSchemaType } from "./iban-schema.vo";
2
- export declare class IBAN {
3
- private readonly value;
4
- constructor(candidate: string);
5
- toString(): IbanSchemaType;
6
- format(): string;
7
- get countryCode(): string;
8
- equals(other: IBAN): boolean;
9
- }
package/dist/iban.vo.js DELETED
@@ -1,23 +0,0 @@
1
- import * as v from "valibot";
2
- import { IbanSchema } from "./iban-schema.vo";
3
- export class IBAN {
4
- value;
5
- constructor(candidate) {
6
- this.value = v.parse(IbanSchema, candidate);
7
- }
8
- toString() {
9
- return this.value;
10
- }
11
- format() {
12
- // (.{4}) - capture any four characters
13
- // (?=.) - positive lookahead, at least one more character after the match
14
- // "$1 " - replace each match with the group and a space
15
- return this.value.replace(/(.{4})(?=.)/g, "$1 ");
16
- }
17
- get countryCode() {
18
- return this.value.slice(0, 2);
19
- }
20
- equals(other) {
21
- return this.value === other.value;
22
- }
23
- }
@@ -1,13 +0,0 @@
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>;
package/dist/image.vo.js DELETED
@@ -1,10 +0,0 @@
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"));
package/dist/index.d.ts DELETED
@@ -1,110 +0,0 @@
1
- export * from "./age.vo";
2
- export * from "./age-years.vo";
3
- export * from "./api-key.vo";
4
- export * from "./basename.vo";
5
- export * from "./batch";
6
- export * from "./date-calculator.service";
7
- export * from "./date-formatter.service";
8
- export * from "./date-range.vo";
9
- export * from "./day.vo";
10
- export * from "./day-iso-id.vo";
11
- export * from "./directory-path-absolute.vo";
12
- export * from "./directory-path-relative.vo";
13
- export * from "./distance.vo";
14
- export * from "./distance-value.vo";
15
- export * from "./division-factor.vo";
16
- export * from "./dll.service";
17
- export * from "./duration.service";
18
- export * from "./duration-ms.vo";
19
- export * from "./email.vo";
20
- export * from "./email-mask.service";
21
- export * from "./etags.vo";
22
- export * from "./extension.vo";
23
- export * from "./feature-flag.vo";
24
- export * from "./feature-flag-value.vo";
25
- export * from "./file-path.vo";
26
- export * from "./file-path-absolute-schema.vo";
27
- export * from "./file-path-relative-schema.vo";
28
- export * from "./filename.vo";
29
- export * from "./filename-affix.vo";
30
- export * from "./filename-from-string.vo";
31
- export * from "./height.vo";
32
- export * from "./height-milimiters.vo";
33
- export * from "./hour.vo";
34
- export * from "./hour-value.vo";
35
- export * from "./iban.vo";
36
- export * from "./iban-mask.service";
37
- export * from "./iban-schema.vo";
38
- export * from "./image.vo";
39
- export * from "./index";
40
- export * from "./int.vo";
41
- export * from "./integer.vo";
42
- export * from "./integer-non-negative.vo";
43
- export * from "./integer-positive.vo";
44
- export * from "./language.vo";
45
- export * from "./linear-regression.service";
46
- export * from "./mean.service";
47
- export * from "./mime.vo";
48
- export * from "./mime-registry.service";
49
- export * from "./mime-registry-entry.vo";
50
- export * from "./mime-value.vo";
51
- export * from "./mimes";
52
- export * from "./min-max-scaler.service";
53
- export * from "./minute.vo";
54
- export * from "./minute-value.vo";
55
- export * from "./money.vo";
56
- export * from "./money-amount.vo";
57
- export * from "./month.vo";
58
- export * from "./month-iso-id.vo";
59
- export * from "./multiplication-factor.vo";
60
- export * from "./noop.service";
61
- export * from "./object-key.vo";
62
- export * from "./outlier-detector.service";
63
- export * from "./package-version.vo";
64
- export * from "./package-version-schema.vo";
65
- export * from "./pagination.service";
66
- export * from "./pagination-page.vo";
67
- export * from "./pagination-skip.vo";
68
- export * from "./pagination-take.vo";
69
- export * from "./percentage.service";
70
- export * from "./population-standard-deviation.service";
71
- export * from "./quarter.vo";
72
- export * from "./quarter-iso-id.vo";
73
- export * from "./random.service";
74
- export * from "./rate-limiter.service";
75
- export * from "./relative-date.vo";
76
- export * from "./reordering.service";
77
- export * from "./reordering-item-position-value.vo";
78
- export * from "./repeat";
79
- export * from "./revision.vo";
80
- export * from "./revision-value.vo";
81
- export * from "./rounding.strategy";
82
- export * from "./rounding-decimal.strategy";
83
- export * from "./rounding-down.strategy";
84
- export * from "./rounding-to-nearest.strategy";
85
- export * from "./rounding-up.strategy";
86
- export * from "./size.vo";
87
- export * from "./size-bytes.vo";
88
- export * from "./slug.service";
89
- export * from "./sms-body.vo";
90
- export * from "./sms-message.vo";
91
- export * from "./sum.service";
92
- export * from "./telephone-number.vo";
93
- export * from "./thousands-separator.service";
94
- export * from "./time-zone-offset-value.vo";
95
- export * from "./timestamp.vo";
96
- export * from "./timestamp-value.vo";
97
- export * from "./timezone.vo";
98
- export * from "./ts-utils";
99
- export * from "./url-with-slash.vo";
100
- export * from "./url-without-slash.vo";
101
- export * from "./visually-unambiguous-characters-generator.service";
102
- export * from "./week.vo";
103
- export * from "./week-iso-id.vo";
104
- export * from "./weekday.vo";
105
- export * from "./weekday-iso-id.vo";
106
- export * from "./weight.vo";
107
- export * from "./weight-grams.vo";
108
- export * from "./year.vo";
109
- export * from "./year-iso-id.vo";
110
- export * from "./z-score.service";
package/dist/index.js DELETED
@@ -1,110 +0,0 @@
1
- export * from "./age.vo";
2
- export * from "./age-years.vo";
3
- export * from "./api-key.vo";
4
- export * from "./basename.vo";
5
- export * from "./batch";
6
- export * from "./date-calculator.service";
7
- export * from "./date-formatter.service";
8
- export * from "./date-range.vo";
9
- export * from "./day.vo";
10
- export * from "./day-iso-id.vo";
11
- export * from "./directory-path-absolute.vo";
12
- export * from "./directory-path-relative.vo";
13
- export * from "./distance.vo";
14
- export * from "./distance-value.vo";
15
- export * from "./division-factor.vo";
16
- export * from "./dll.service";
17
- export * from "./duration.service";
18
- export * from "./duration-ms.vo";
19
- export * from "./email.vo";
20
- export * from "./email-mask.service";
21
- export * from "./etags.vo";
22
- export * from "./extension.vo";
23
- export * from "./feature-flag.vo";
24
- export * from "./feature-flag-value.vo";
25
- export * from "./file-path.vo";
26
- export * from "./file-path-absolute-schema.vo";
27
- export * from "./file-path-relative-schema.vo";
28
- export * from "./filename.vo";
29
- export * from "./filename-affix.vo";
30
- export * from "./filename-from-string.vo";
31
- export * from "./height.vo";
32
- export * from "./height-milimiters.vo";
33
- export * from "./hour.vo";
34
- export * from "./hour-value.vo";
35
- export * from "./iban.vo";
36
- export * from "./iban-mask.service";
37
- export * from "./iban-schema.vo";
38
- export * from "./image.vo";
39
- export * from "./index";
40
- export * from "./int.vo";
41
- export * from "./integer.vo";
42
- export * from "./integer-non-negative.vo";
43
- export * from "./integer-positive.vo";
44
- export * from "./language.vo";
45
- export * from "./linear-regression.service";
46
- export * from "./mean.service";
47
- export * from "./mime.vo";
48
- export * from "./mime-registry.service";
49
- export * from "./mime-registry-entry.vo";
50
- export * from "./mime-value.vo";
51
- export * from "./mimes";
52
- export * from "./min-max-scaler.service";
53
- export * from "./minute.vo";
54
- export * from "./minute-value.vo";
55
- export * from "./money.vo";
56
- export * from "./money-amount.vo";
57
- export * from "./month.vo";
58
- export * from "./month-iso-id.vo";
59
- export * from "./multiplication-factor.vo";
60
- export * from "./noop.service";
61
- export * from "./object-key.vo";
62
- export * from "./outlier-detector.service";
63
- export * from "./package-version.vo";
64
- export * from "./package-version-schema.vo";
65
- export * from "./pagination.service";
66
- export * from "./pagination-page.vo";
67
- export * from "./pagination-skip.vo";
68
- export * from "./pagination-take.vo";
69
- export * from "./percentage.service";
70
- export * from "./population-standard-deviation.service";
71
- export * from "./quarter.vo";
72
- export * from "./quarter-iso-id.vo";
73
- export * from "./random.service";
74
- export * from "./rate-limiter.service";
75
- export * from "./relative-date.vo";
76
- export * from "./reordering.service";
77
- export * from "./reordering-item-position-value.vo";
78
- export * from "./repeat";
79
- export * from "./revision.vo";
80
- export * from "./revision-value.vo";
81
- export * from "./rounding.strategy";
82
- export * from "./rounding-decimal.strategy";
83
- export * from "./rounding-down.strategy";
84
- export * from "./rounding-to-nearest.strategy";
85
- export * from "./rounding-up.strategy";
86
- export * from "./size.vo";
87
- export * from "./size-bytes.vo";
88
- export * from "./slug.service";
89
- export * from "./sms-body.vo";
90
- export * from "./sms-message.vo";
91
- export * from "./sum.service";
92
- export * from "./telephone-number.vo";
93
- export * from "./thousands-separator.service";
94
- export * from "./time-zone-offset-value.vo";
95
- export * from "./timestamp.vo";
96
- export * from "./timestamp-value.vo";
97
- export * from "./timezone.vo";
98
- export * from "./ts-utils";
99
- export * from "./url-with-slash.vo";
100
- export * from "./url-without-slash.vo";
101
- export * from "./visually-unambiguous-characters-generator.service";
102
- export * from "./week.vo";
103
- export * from "./week-iso-id.vo";
104
- export * from "./weekday.vo";
105
- export * from "./weekday-iso-id.vo";
106
- export * from "./weight.vo";
107
- export * from "./weight-grams.vo";
108
- export * from "./year.vo";
109
- export * from "./year-iso-id.vo";
110
- export * from "./z-score.service";
package/dist/int.vo.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { type IntegerType } from "./integer.vo";
2
- import { type IntegerNonNegativeType } from "./integer-non-negative.vo";
3
- import { type IntegerPositiveType } from "./integer-positive.vo";
4
- export declare class Int {
5
- static positive(candidate: number): IntegerPositiveType;
6
- static nonNegative(candidate: number): IntegerNonNegativeType;
7
- static of(candidate: number): IntegerType;
8
- }