@bgord/tools 1.2.1 → 1.2.3
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/age-years.vo.d.ts +2 -2
- package/dist/age.vo.d.ts +1 -1
- package/dist/api-key.vo.d.ts +3 -3
- package/dist/api-key.vo.js +1 -5
- package/dist/basename.vo.d.ts +7 -7
- package/dist/date-range.vo.d.ts +1 -1
- package/dist/day-iso-id.vo.d.ts +3 -3
- package/dist/directory-path-absolute.vo.d.ts +6 -6
- package/dist/directory-path-relative.vo.d.ts +6 -6
- package/dist/distance.vo.d.ts +1 -1
- package/dist/distance.vo.js +1 -3
- package/dist/division-factor.vo.d.ts +2 -2
- package/dist/division-factor.vo.js +1 -4
- package/dist/duration-ms.vo.d.ts +1 -1
- package/dist/email.vo.d.ts +1 -1
- package/dist/etags.vo.d.ts +1 -1
- package/dist/extension.vo.d.ts +4 -4
- package/dist/feature-flag-value.vo.d.ts +1 -1
- package/dist/file-path-absolute-schema.vo.d.ts +5 -5
- package/dist/file-path-relative-schema.vo.d.ts +5 -5
- package/dist/filename-affix.vo.d.ts +4 -4
- package/dist/filename-from-string.vo.d.ts +2 -2
- package/dist/filename-from-string.vo.js +1 -1
- package/dist/height-milimiters.vo.d.ts +2 -2
- package/dist/iban-schema.vo.d.ts +2 -2
- package/dist/image.vo.d.ts +4 -4
- package/dist/language.vo.d.ts +2 -2
- package/dist/linear-regression.service.d.ts +6 -6
- package/dist/mean.service.d.ts +1 -1
- package/dist/mime.vo.d.ts +1 -1
- package/dist/min-max-scaler.service.d.ts +5 -5
- package/dist/money.vo.d.ts +1 -1
- package/dist/month-iso-id.vo.d.ts +3 -3
- package/dist/multiplication-factor.vo.d.ts +2 -2
- package/dist/object-key.vo.d.ts +6 -6
- package/dist/outlier-detector.service.d.ts +1 -1
- package/dist/package-version-schema.vo.d.ts +2 -2
- package/dist/pagination-page.vo.d.ts +1 -1
- package/dist/pagination-skip.vo.d.ts +2 -2
- package/dist/pagination-skip.vo.js +1 -4
- package/dist/pagination-take.vo.d.ts +2 -2
- package/dist/pagination-take.vo.js +1 -4
- package/dist/percentage.service.d.ts +1 -1
- package/dist/population-standard-deviation.service.d.ts +1 -1
- package/dist/quarter-iso-id.vo.d.ts +2 -2
- package/dist/random.service.d.ts +1 -1
- package/dist/reordering-item-position-value.vo.d.ts +1 -1
- package/dist/revision-value.vo.d.ts +2 -2
- package/dist/revision.vo.d.ts +2 -2
- package/dist/rounding.adapter.d.ts +2 -2
- package/dist/rounding.adapter.js +1 -4
- package/dist/size-bytes.vo.d.ts +1 -1
- package/dist/stopwatch.service.d.ts +1 -1
- package/dist/timestamp-value.vo.d.ts +1 -1
- package/dist/timezone.vo.d.ts +4 -4
- package/dist/url-with-slash.vo.d.ts +1 -1
- package/dist/url-without-slash.vo.d.ts +1 -1
- package/dist/week-iso-id.vo.d.ts +3 -3
- package/dist/weight-grams.vo.d.ts +2 -2
- package/dist/year-iso-id.vo.d.ts +2 -2
- package/dist/z-score.service.d.ts +1 -1
- package/package.json +6 -5
- package/src/age-years.vo.ts +1 -1
- package/src/age.vo.ts +1 -1
- package/src/api-key.vo.ts +1 -5
- package/src/basename.vo.ts +1 -1
- package/src/clock-format.service.ts +1 -1
- package/src/date-range.vo.ts +1 -1
- package/src/day-iso-id.vo.ts +1 -1
- package/src/directory-path-absolute.vo.ts +1 -1
- package/src/directory-path-relative.vo.ts +1 -1
- package/src/distance.vo.ts +1 -3
- package/src/division-factor.vo.ts +1 -4
- package/src/duration-ms.vo.ts +1 -1
- package/src/email.vo.ts +1 -1
- package/src/etags.vo.ts +1 -1
- package/src/extension.vo.ts +1 -1
- package/src/feature-flag-value.vo.ts +1 -1
- package/src/file-path-absolute-schema.vo.ts +1 -1
- package/src/file-path-relative-schema.vo.ts +1 -1
- package/src/filename-affix.vo.ts +1 -1
- package/src/filename-from-string.vo.ts +2 -2
- package/src/height-milimiters.vo.ts +1 -1
- package/src/iban-schema.vo.ts +1 -1
- package/src/image.vo.ts +2 -2
- package/src/language.vo.ts +1 -1
- package/src/linear-regression.service.ts +1 -1
- package/src/mean.service.ts +1 -1
- package/src/mime.vo.ts +1 -1
- package/src/min-max-scaler.service.ts +1 -1
- package/src/money.vo.ts +1 -1
- package/src/month-iso-id.vo.ts +1 -1
- package/src/multiplication-factor.vo.ts +1 -1
- package/src/object-key.vo.ts +1 -1
- package/src/outlier-detector.service.ts +1 -1
- package/src/package-version-schema.vo.ts +1 -1
- package/src/pagination-page.vo.ts +1 -1
- package/src/pagination-skip.vo.ts +1 -4
- package/src/pagination-take.vo.ts +1 -4
- package/src/percentage.service.ts +1 -1
- package/src/population-standard-deviation.service.ts +1 -1
- package/src/quarter-iso-id.vo.ts +1 -1
- package/src/random.service.ts +1 -1
- package/src/reordering-item-position-value.vo.ts +1 -1
- package/src/reordering.service.ts +1 -1
- package/src/revision-value.vo.ts +1 -1
- package/src/revision.vo.ts +1 -1
- package/src/rounding.adapter.ts +1 -4
- package/src/size-bytes.vo.ts +1 -1
- package/src/stopwatch.service.ts +1 -1
- package/src/timestamp-value.vo.ts +1 -1
- package/src/timezone.vo.ts +1 -1
- package/src/url-with-slash.vo.ts +1 -1
- package/src/url-without-slash.vo.ts +1 -1
- package/src/week-iso-id.vo.ts +1 -1
- package/src/weight-grams.vo.ts +1 -1
- package/src/year-iso-id.vo.ts +1 -1
- package/src/z-score.service.ts +1 -1
package/dist/size-bytes.vo.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const SizeBytesError: {
|
|
3
|
-
|
|
3
|
+
Invalid: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const SizeBytes: z.core.$ZodBranded<z.ZodNumber, "SizeBytes">;
|
|
6
6
|
export type SizeBytesType = z.infer<typeof SizeBytes>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Duration } from "./duration.service";
|
|
2
2
|
import { Timestamp } from "./timestamp.vo";
|
|
3
3
|
export declare const StopwatchError: {
|
|
4
|
-
|
|
4
|
+
AlreadyStopped: string;
|
|
5
5
|
};
|
|
6
6
|
export type StopwatchResultType = Duration;
|
|
7
7
|
export declare class Stopwatch {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const TimestampValueError: {
|
|
3
|
-
|
|
3
|
+
Invalid: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const TimestampValue: z.core.$ZodBranded<z.ZodNumber, "TimestampValue">;
|
|
6
6
|
export type TimestampValueType = z.infer<typeof TimestampValue>;
|
package/dist/timezone.vo.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const TimezoneError: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
Type: string;
|
|
4
|
+
Empty: string;
|
|
5
|
+
TooLong: string;
|
|
6
|
+
Invalid: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const Timezone: z.core.$ZodBranded<z.ZodString, "Timezone">;
|
|
9
9
|
export type TimezoneType = z.infer<typeof Timezone>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const UrlWithSlashError: {
|
|
3
|
-
|
|
3
|
+
Invalid: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const UrlWithSlash: z.core.$ZodBranded<z.ZodURL, "UrlWithSlash">;
|
|
6
6
|
export type UrlWithSlashType = z.infer<typeof UrlWithSlash>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const UrlWithoutSlashError: {
|
|
3
|
-
|
|
3
|
+
Invalid: string;
|
|
4
4
|
};
|
|
5
5
|
export declare const UrlWithoutSlash: z.core.$ZodBranded<z.ZodURL, "UrlWithoutSlash">;
|
|
6
6
|
export type UrlWithoutSlashType = z.infer<typeof UrlWithoutSlash>;
|
package/dist/week-iso-id.vo.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const WeekIsoIdError: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Type: string;
|
|
4
|
+
BadChars: string;
|
|
5
|
+
Invalid: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const WeekIsoId: z.core.$ZodBranded<z.ZodString, "WeekIsoId">;
|
|
8
8
|
export type WeekIsoIdType = z.infer<typeof WeekIsoId>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const WeightGramsError: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Type: string;
|
|
4
|
+
Invalid: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const WeightGrams: z.core.$ZodBranded<z.ZodNumber, "WeightGrams">;
|
|
7
7
|
export type WeightGramsType = z.infer<typeof WeightGrams>;
|
package/dist/year-iso-id.vo.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
export declare const YearIsoIdError: {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Type: string;
|
|
4
|
+
BadChars: string;
|
|
5
5
|
};
|
|
6
6
|
export declare const YearIsoId: z.core.$ZodBranded<z.ZodString, "YearIsoId">;
|
|
7
7
|
export type YearIsoIdType = z.infer<typeof YearIsoId>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/tools",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -21,25 +21,26 @@
|
|
|
21
21
|
"preinstall": "bunx only-allow bun"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@biomejs/biome": "2.3.
|
|
24
|
+
"@biomejs/biome": "2.3.9",
|
|
25
25
|
"@commitlint/cli": "20.2.0",
|
|
26
26
|
"@commitlint/config-conventional": "20.2.0",
|
|
27
27
|
"@types/bun": "1.3.4",
|
|
28
28
|
"@types/mime-types": "3.0.1",
|
|
29
29
|
"cspell": "9.4.0",
|
|
30
|
-
"knip": "5.
|
|
30
|
+
"knip": "5.75.1",
|
|
31
31
|
"lefthook": "2.0.12",
|
|
32
|
+
"lockfile-lint": "4.14.1",
|
|
32
33
|
"only-allow": "1.2.2",
|
|
33
34
|
"shellcheck": "4.1.0",
|
|
34
35
|
"typescript": "5.9.3",
|
|
35
|
-
"zod": "4.2.
|
|
36
|
+
"zod": "4.2.1"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"date-fns": "4.1.0",
|
|
39
40
|
"mime-types": "3.0.2"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
|
-
"zod": "4.2.
|
|
43
|
+
"zod": "4.2.1"
|
|
43
44
|
},
|
|
44
45
|
"sideEffects": false
|
|
45
46
|
}
|
package/src/age-years.vo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const AgeYearsError = { Type: "age.years.type", Invalid: "age.years.invalid" }
|
|
3
|
+
export const AgeYearsError = { Type: "age.years.type", Invalid: "age.years.invalid" };
|
|
4
4
|
|
|
5
5
|
export const AgeYearsConstraints = { min: 1, max: 130 };
|
|
6
6
|
|
package/src/age.vo.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { differenceInYears } from "date-fns";
|
|
|
2
2
|
import { AgeYears, AgeYearsConstraints, type AgeYearsType } from "./age-years.vo";
|
|
3
3
|
import { Timestamp } from "./timestamp.vo";
|
|
4
4
|
|
|
5
|
-
export const AgeError = { FutureBirthdate: "age.future.birthdate" }
|
|
5
|
+
export const AgeError = { FutureBirthdate: "age.future.birthdate" };
|
|
6
6
|
|
|
7
7
|
export class Age {
|
|
8
8
|
static readonly MIN = AgeYearsConstraints.min;
|
package/src/api-key.vo.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const ApiKeyError = {
|
|
4
|
-
Type: "api.key.type",
|
|
5
|
-
Length: "api.key.length",
|
|
6
|
-
BadChars: "api.key.bad.chars",
|
|
7
|
-
} as const;
|
|
3
|
+
export const ApiKeyError = { Type: "api.key.type", Length: "api.key.length", BadChars: "api.key.bad.chars" };
|
|
8
4
|
|
|
9
5
|
// 64 letters and digits allowed
|
|
10
6
|
const API_KEY_CHARS = /^[a-zA-Z0-9]{64}$/;
|
package/src/basename.vo.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const BasenameError = {
|
|
|
8
8
|
Dotfiles: "basename.dotfiles",
|
|
9
9
|
TrailingDot: "basename.trailing.dot",
|
|
10
10
|
BadChars: "basename.bad.chars",
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
// Letters, digits, dots, underscores, and hyphens allowed
|
|
14
14
|
const BASENAME_CHARS = /^[a-zA-Z0-9._-]+$/;
|
|
@@ -12,4 +12,4 @@ enum ClockFormatterEnum {
|
|
|
12
12
|
export const ClockFormatters: Record<ClockFormatterEnum, ClockFormatter> = {
|
|
13
13
|
TWENTY_FOUR_HOURS: (hour, minute) => `${hour.toString()}:${minute.toString()}`,
|
|
14
14
|
TWELVE_HOURS: (hour, minute) => `${hour.format(HourFormatters.TWELVE_HOURS)}:${minute.toString()}`,
|
|
15
|
-
}
|
|
15
|
+
};
|
package/src/date-range.vo.ts
CHANGED
package/src/day-iso-id.vo.ts
CHANGED
|
@@ -5,7 +5,7 @@ export const DayIsoIdError = {
|
|
|
5
5
|
Type: "day.iso.id.type",
|
|
6
6
|
BadChars: "day.iso.id.bad.chars",
|
|
7
7
|
InvalidDate: "day.iso.id.invalid.date",
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
// Four digits, hyphen, two digits, hyphen, two digits
|
|
11
11
|
export const DAY_ISO_ID_CHARS = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
|
|
@@ -7,7 +7,7 @@ export const DirectoryPathAbsoluteError = {
|
|
|
7
7
|
TooLong: "directory.path.absolue.too.long",
|
|
8
8
|
TrailingSlash: "directory.path.absolue.trailing.slash",
|
|
9
9
|
Type: "directory.path.absolue.type",
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
// Letters, digits, dots, underscores, and hyphens
|
|
13
13
|
export const DIRECTORY_PATH_ABSOLUTE_CHARS = /^[a-zA-Z0-9._-]+$/;
|
|
@@ -7,7 +7,7 @@ export const DirectoryPathRelativeError = {
|
|
|
7
7
|
TooLong: "directory.path.absolue.too.long",
|
|
8
8
|
TrailingSlash: "directory.path.absolue.trailing.slash",
|
|
9
9
|
Type: "directory.path.relative.not.type",
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
// Letters, digits, dots, underscores, and hyphens
|
|
13
13
|
export const DIRECTORY_PATH_RELATIVE_CHARS = /^[A-Za-z0-9._-]+$/;
|
package/src/distance.vo.ts
CHANGED
|
@@ -2,9 +2,7 @@ import { DistanceValue, type DistanceValueType } from "./distance-value.vo";
|
|
|
2
2
|
import { RoundToNearest } from "./rounding.adapter";
|
|
3
3
|
import type { RoundingPort } from "./rounding.port";
|
|
4
4
|
|
|
5
|
-
export const DistanceError = {
|
|
6
|
-
SubtractResultLessThanZero: "distance.subtract.result.less.than.zero",
|
|
7
|
-
} as const;
|
|
5
|
+
export const DistanceError = { SubtractResultLessThanZero: "distance.subtract.result.less.than.zero" };
|
|
8
6
|
|
|
9
7
|
export class Distance {
|
|
10
8
|
private static readonly ZERO = DistanceValue.parse(0);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const DivisionFactorError = {
|
|
4
|
-
Type: "division.factor.type",
|
|
5
|
-
Invalid: "division.factor.invalid",
|
|
6
|
-
} as const;
|
|
3
|
+
export const DivisionFactorError = { Type: "division.factor.type", Invalid: "division.factor.invalid" };
|
|
7
4
|
|
|
8
5
|
export const DivisionFactor = z
|
|
9
6
|
.number(DivisionFactorError.Type)
|
package/src/duration-ms.vo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const DurationMsError = { Invalid: "duration.invalid" }
|
|
3
|
+
export const DurationMsError = { Invalid: "duration.invalid" };
|
|
4
4
|
|
|
5
5
|
export const DurationMs = z.number(DurationMsError.Invalid).int(DurationMsError.Invalid).brand("DurationMs");
|
|
6
6
|
|
package/src/email.vo.ts
CHANGED
package/src/etags.vo.ts
CHANGED
|
@@ -25,7 +25,7 @@ export class ETag {
|
|
|
25
25
|
|
|
26
26
|
export type WeakETagValueType = string;
|
|
27
27
|
|
|
28
|
-
export const WeakETagError = { Invalid: "weak.etag.invalid" }
|
|
28
|
+
export const WeakETagError = { Invalid: "weak.etag.invalid" };
|
|
29
29
|
|
|
30
30
|
export class WeakETag {
|
|
31
31
|
static HEADER_NAME = "ETag";
|
package/src/extension.vo.ts
CHANGED
|
@@ -8,7 +8,7 @@ export const FilePathAbsoluteSchemaError = {
|
|
|
8
8
|
TrailingSlash: "file.path.absolute.trailing.slash",
|
|
9
9
|
BackslashForbidden: "file.path.absolute.backslash.forbidden",
|
|
10
10
|
Empty: "file.path.absolute.empty",
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
export const FilePathAbsoluteSchema = z
|
|
14
14
|
.string(FilePathAbsoluteSchemaError.Type)
|
|
@@ -8,7 +8,7 @@ export const FilePathRelativeSchemaError = {
|
|
|
8
8
|
BackslashForbidden: "file.path.relative.backslash.forbidden",
|
|
9
9
|
RequiresDirectory: "file.path.relative.requires.directory",
|
|
10
10
|
Empty: "file.path.relative.empty",
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
export const FilePathRelativeSchema = z
|
|
14
14
|
.string(FilePathRelativeSchemaError.Type)
|
package/src/filename-affix.vo.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Extension } from "./extension.vo";
|
|
|
4
4
|
|
|
5
5
|
export const FilenameFromStringError = {
|
|
6
6
|
Type: "filename.from.string.type",
|
|
7
|
-
Invalid: "filename.from.string.
|
|
8
|
-
}
|
|
7
|
+
Invalid: "filename.from.string.invalid",
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
// .+ at least one character, advances to the last dot
|
|
11
11
|
// .
|
package/src/iban-schema.vo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const IbanSchemaError = { Type: "iban.schema.type", Invalid: "iban.schema.invalid" }
|
|
3
|
+
export const IbanSchemaError = { Type: "iban.schema.type", Invalid: "iban.schema.invalid" };
|
|
4
4
|
|
|
5
5
|
// Two letters for country code, two digits, 11–30 uppercase letters or digits
|
|
6
6
|
const IBAN_CHARS_WHITELIST = /^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/;
|
package/src/image.vo.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const ImageWidthError = { Type: "image.width.type", Length: "image.width.length" }
|
|
4
|
-
export const ImageHeightError = { Type: "image.height.type", Length: "image.height.length" }
|
|
3
|
+
export const ImageWidthError = { Type: "image.width.type", Length: "image.width.length" };
|
|
4
|
+
export const ImageHeightError = { Type: "image.height.type", Length: "image.height.length" };
|
|
5
5
|
|
|
6
6
|
const IMAGE_DIMENSIONS_CONSTRAINTS = { min: 1, max: 10_000 };
|
|
7
7
|
|
package/src/language.vo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const LanguageError = { Type: "language.type", BadChars: "language.bad.chars" }
|
|
3
|
+
export const LanguageError = { Type: "language.type", BadChars: "language.bad.chars" };
|
|
4
4
|
|
|
5
5
|
// Two lowercase letters
|
|
6
6
|
const LANGUAGE_CHARS_WHITELIST = /^[a-z]{2}$/;
|
|
@@ -12,7 +12,7 @@ export const LinearRegressionError = {
|
|
|
12
12
|
SumXSquaredTooBig: "linear.regression.sum.x.squared.too.big",
|
|
13
13
|
SumXTimesYTooBig: "linear.regression.sum.x.times.y.too.big",
|
|
14
14
|
ModelCreation: "linear.regression.model.creation",
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
export class LinearRegression {
|
|
18
18
|
private static readonly DEFAULT_ROUNDING: RoundingPort = new RoundToNearest();
|
package/src/mean.service.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { RoundToDecimal } from "./rounding.adapter";
|
|
|
2
2
|
import type { RoundingPort } from "./rounding.port";
|
|
3
3
|
import { Sum } from "./sum.service";
|
|
4
4
|
|
|
5
|
-
export const MeanError = { NotEnoughValues: "mean.not.enough.values" }
|
|
5
|
+
export const MeanError = { NotEnoughValues: "mean.not.enough.values" };
|
|
6
6
|
|
|
7
7
|
export class Mean {
|
|
8
8
|
private static readonly DEFAULT_ROUNDING: RoundingPort = new RoundToDecimal(2);
|
package/src/mime.vo.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as mime from "mime-types";
|
|
|
2
2
|
import { Extension, type ExtensionType } from "./extension.vo";
|
|
3
3
|
import { MimeValue } from "./mime-value.vo";
|
|
4
4
|
|
|
5
|
-
export const MimeError = { NotAccepted: "mime.not.accepted" }
|
|
5
|
+
export const MimeError = { NotAccepted: "mime.not.accepted" };
|
|
6
6
|
|
|
7
7
|
export class Mime {
|
|
8
8
|
private constructor(
|
|
@@ -30,7 +30,7 @@ export const MinMaxScalerError = {
|
|
|
30
30
|
ValueOutOfRange: "min.max.scaler.value.out.of.range",
|
|
31
31
|
ScaledOutOfBounds: "min.max.scaler.scaled.out.of.bounds",
|
|
32
32
|
EmptyArray: "min.max.scaler.empty.array",
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
export class MinMaxScaler {
|
|
36
36
|
private static readonly DEFAULT_ROUNDING: RoundingPort = new RoundToDecimal(2);
|
package/src/money.vo.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { MultiplicationFactorType } from "./multiplication-factor.vo";
|
|
|
4
4
|
import { RoundDown, RoundToNearest } from "./rounding.adapter";
|
|
5
5
|
import type { RoundingPort } from "./rounding.port";
|
|
6
6
|
|
|
7
|
-
export const MoneyError = { SubtractResultLessThanZero: "money.subtract.result.less.than.zero" }
|
|
7
|
+
export const MoneyError = { SubtractResultLessThanZero: "money.subtract.result.less.than.zero" };
|
|
8
8
|
|
|
9
9
|
export class Money {
|
|
10
10
|
private static readonly ZERO = MoneyAmount.parse(0);
|
package/src/month-iso-id.vo.ts
CHANGED
package/src/object-key.vo.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const ObjectKeyError = {
|
|
|
7
7
|
TooLong: "object.key.too.long",
|
|
8
8
|
BadChars: "object.key.bad.chars",
|
|
9
9
|
DotSegments: "object.key.dot.segments",
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
// Lowercase letters, digits, dots, underscores, and hyphens
|
|
13
13
|
const OBJECT_KEY_SEGMENT_CHARS_WHITELIST = /^[a-z0-9._-]+$/;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ZScore } from "./z-score.service";
|
|
2
2
|
|
|
3
|
-
export const OutlierDetectorError = { NotEnoughValues: "outlier.detector.not.enough.values" }
|
|
3
|
+
export const OutlierDetectorError = { NotEnoughValues: "outlier.detector.not.enough.values" };
|
|
4
4
|
|
|
5
5
|
export class OutlierDetector {
|
|
6
6
|
private readonly zScore: ZScore;
|
|
@@ -3,7 +3,7 @@ import { z } from "zod/v4";
|
|
|
3
3
|
export const PackageVersionSchemaError = {
|
|
4
4
|
Type: "package.version.schema.error",
|
|
5
5
|
BadChars: "package.version.schema.bad.chars",
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
|
|
8
8
|
// v, 1-4 digits, dot, 1-4 digits, dot, 1-4 digits - () for capturing groups
|
|
9
9
|
const PACKAGE_VERSIONS_CHARS_WHITELIST = /^v([0-9]{1,4})\.([0-9]{1,4})\.([0-9]{1,4})$/;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const PaginationSkipError = {
|
|
4
|
-
Type: "pagination.skip.type",
|
|
5
|
-
Invalid: "pagination.skip.invalid",
|
|
6
|
-
} as const;
|
|
3
|
+
export const PaginationSkipError = { Type: "pagination.skip.type", Invalid: "pagination.skip.invalid" };
|
|
7
4
|
|
|
8
5
|
export const Skip = z
|
|
9
6
|
.number(PaginationSkipError.Type)
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const PaginationTakeError = {
|
|
4
|
-
Type: "pagination.take.type",
|
|
5
|
-
Invalid: "pagination.take.invalid",
|
|
6
|
-
} as const;
|
|
3
|
+
export const PaginationTakeError = { Type: "pagination.take.type", Invalid: "pagination.take.invalid" };
|
|
7
4
|
|
|
8
5
|
export const Take = z
|
|
9
6
|
.number(PaginationTakeError.Type)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RoundToNearest } from "./rounding.adapter";
|
|
2
2
|
import type { RoundingPort } from "./rounding.port";
|
|
3
3
|
|
|
4
|
-
export const PercentageError = { InvalidDenominator: "percentage.invalid.denominator" }
|
|
4
|
+
export const PercentageError = { InvalidDenominator: "percentage.invalid.denominator" };
|
|
5
5
|
|
|
6
6
|
export class Percentage {
|
|
7
7
|
static of(numerator: number, denominator: number, rounding: RoundingPort = new RoundToNearest()): number {
|
|
@@ -5,7 +5,7 @@ import { Sum } from "./sum.service";
|
|
|
5
5
|
|
|
6
6
|
export const PopulationStandardDeviationError = {
|
|
7
7
|
NotEnoughValues: "population.standard.deviation.not.enough.values",
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
export class PopulationStandardDeviation {
|
|
11
11
|
static calculate(values: number[], rounding: RoundingPort = new RoundToDecimal(2)): number {
|
package/src/quarter-iso-id.vo.ts
CHANGED
package/src/random.service.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { RoundDown } from "./rounding.adapter";
|
|
|
2
2
|
|
|
3
3
|
type RandomGenerateConfigType = { min: number; max: number };
|
|
4
4
|
|
|
5
|
-
export const RandomError = { MinMax: "random.min.max" }
|
|
5
|
+
export const RandomError = { MinMax: "random.min.max" };
|
|
6
6
|
|
|
7
7
|
export class Random {
|
|
8
8
|
private static readonly DEFAULT_MIN = 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const ReorderingItemPositionValueError = { Invalid: "reordering.position.type" }
|
|
3
|
+
export const ReorderingItemPositionValueError = { Invalid: "reordering.position.type" };
|
|
4
4
|
|
|
5
5
|
export const ReorderingItemPositionValue = z
|
|
6
6
|
.number(ReorderingItemPositionValueError.Invalid)
|
|
@@ -11,7 +11,7 @@ export const ReorderingError = {
|
|
|
11
11
|
CannotFindTarget: "reordering.cannot.find.target",
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const ReorderingIdError = { Type: "reordering.id.type" }
|
|
14
|
+
const ReorderingIdError = { Type: "reordering.id.type" };
|
|
15
15
|
|
|
16
16
|
export const ReorderingId = z.string(ReorderingIdError.Type).min(1, ReorderingIdError.Type);
|
|
17
17
|
export type ReorderingItemIdType = z.infer<typeof ReorderingId>;
|
package/src/revision-value.vo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
export const RevisionValueError = { Type: "revision.value.type", Invalid: "revision.value.invalid" }
|
|
3
|
+
export const RevisionValueError = { Type: "revision.value.type", Invalid: "revision.value.invalid" };
|
|
4
4
|
|
|
5
5
|
export const RevisionValue = z
|
|
6
6
|
.number(RevisionValueError.Type)
|
package/src/revision.vo.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ETag, WeakETag } from "./etags.vo";
|
|
2
2
|
import { RevisionValue, type RevisionValueType } from "./revision-value.vo";
|
|
3
3
|
|
|
4
|
-
export const RevisionError = { Missing: "revision.missing", Mismatch: "revision.mismatch" }
|
|
4
|
+
export const RevisionError = { Missing: "revision.missing", Mismatch: "revision.mismatch" };
|
|
5
5
|
|
|
6
6
|
export class Revision {
|
|
7
7
|
static readonly INITIAL: RevisionValueType = RevisionValue.parse(0);
|
package/src/rounding.adapter.ts
CHANGED
|
@@ -19,10 +19,7 @@ export class RoundDown implements RoundingPort {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const RoundingDecimalError = {
|
|
23
|
-
Type: "rounding.decimal.type",
|
|
24
|
-
Invalid: "rounding.decimal.invalid",
|
|
25
|
-
} as const;
|
|
22
|
+
export const RoundingDecimalError = { Type: "rounding.decimal.type", Invalid: "rounding.decimal.invalid" };
|
|
26
23
|
|
|
27
24
|
export const RoundingDecimal = z
|
|
28
25
|
.number(RoundingDecimalError.Type)
|
package/src/size-bytes.vo.ts
CHANGED