@bgord/tools 0.9.1 → 0.9.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.
Files changed (44) hide show
  1. package/dist/etags.vo.d.ts +1 -1
  2. package/dist/etags.vo.js +1 -1
  3. package/dist/filter.vo.d.ts +4 -4
  4. package/dist/iban-mask.service.d.ts +6 -0
  5. package/dist/iban-mask.service.js +9 -0
  6. package/dist/iban.vo.js +4 -4
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.js +3 -3
  9. package/dist/package-version.vo.js +1 -1
  10. package/dist/pagination.service.d.ts +3 -3
  11. package/dist/pagination.service.js +3 -4
  12. package/dist/rate-limiter.service.d.ts +2 -3
  13. package/dist/reordering.service.d.ts +7 -7
  14. package/dist/reordering.service.js +3 -3
  15. package/dist/revision.vo.d.ts +2 -1
  16. package/dist/revision.vo.js +1 -1
  17. package/dist/size.vo.d.ts +3 -3
  18. package/dist/size.vo.js +8 -8
  19. package/dist/timestamp.vo.js +1 -1
  20. package/dist/timezone.vo.js +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -0
  22. package/package.json +9 -6
  23. package/src/etags.vo.ts +1 -1
  24. package/src/iban-mask.service.ts +15 -0
  25. package/src/iban.vo.ts +4 -4
  26. package/src/index.ts +3 -3
  27. package/src/mean.service.ts +1 -1
  28. package/src/min-max-scaler.service.ts +1 -1
  29. package/src/money.vo.ts +1 -1
  30. package/src/package-version.vo.ts +1 -1
  31. package/src/pagination.service.ts +3 -4
  32. package/src/percentage.service.ts +1 -1
  33. package/src/population-standard-deviation.service.ts +1 -1
  34. package/src/rate-limiter.service.ts +2 -1
  35. package/src/reordering.service.ts +3 -3
  36. package/src/revision.vo.ts +1 -1
  37. package/src/simple-linear-regression.service.ts +1 -1
  38. package/src/size.vo.ts +10 -10
  39. package/src/timestamp.vo.ts +1 -1
  40. package/src/timezone.vo.ts +1 -1
  41. package/src/z-score.service.ts +1 -1
  42. package/dist/sleep.service.d.ts +0 -3
  43. package/dist/sleep.service.js +0 -3
  44. package/src/sleep.service.ts +0 -3
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod/v4";
2
- declare const RevisionValue: z.core.$ZodBranded<z.ZodNumber, "RevisionValue">;
2
+ export declare const RevisionValue: z.core.$ZodBranded<z.ZodNumber, "RevisionValue">;
3
3
  type RevisionValueType = z.infer<typeof RevisionValue>;
4
4
  type ETagValueType = string;
5
5
  export declare class ETag {
package/dist/etags.vo.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod/v4";
2
- const RevisionValue = z.number().int().min(0).brand("RevisionValue");
2
+ export const RevisionValue = z.number().int().min(0).brand("RevisionValue");
3
3
  export class ETag {
4
4
  revision;
5
5
  static HEADER_NAME = "ETag";
@@ -9,9 +9,9 @@ export type FilterParseConfigType<T extends DefaultFilterSchemaType> = {
9
9
  export declare class Filter<T extends DefaultFilterSchemaType> {
10
10
  private readonly schema;
11
11
  constructor(schema: FilterSchemaType<T>);
12
- parse(values: FilterValuesType): z.core.$InferObjectOutput<T, Record<string, unknown>> | undefined;
13
- default(): z.core.$InferObjectOutput<T, Record<string, unknown>> | undefined;
14
- static parse<T extends DefaultFilterSchemaType>(config: FilterParseConfigType<T>): z.core.$InferObjectOutput<T, Record<string, unknown>> | undefined;
15
- static default<T extends DefaultFilterSchemaType>(config: Omit<FilterParseConfigType<T>, "values">): z.core.$InferObjectOutput<T, Record<string, unknown>> | undefined;
12
+ parse(values: FilterValuesType): z.core.$InferObjectOutput<T, {}> | undefined;
13
+ default(): z.core.$InferObjectOutput<T, {}> | undefined;
14
+ static parse<T extends DefaultFilterSchemaType>(config: FilterParseConfigType<T>): z.core.$InferObjectOutput<T, {}> | undefined;
15
+ static default<T extends DefaultFilterSchemaType>(config: Omit<FilterParseConfigType<T>, "values">): z.core.$InferObjectOutput<T, {}> | undefined;
16
16
  private static _parse;
17
17
  }
@@ -0,0 +1,6 @@
1
+ import { IBAN } from "./iban.vo";
2
+ type IbanMaskedType = string;
3
+ export declare class IbanMask {
4
+ static censor(iban: IBAN): IbanMaskedType;
5
+ }
6
+ export {};
@@ -0,0 +1,9 @@
1
+ export class IbanMask {
2
+ static censor(iban) {
3
+ const value = iban.format();
4
+ const start = value.slice(0, 4);
5
+ const middle = value.slice(5, -5).replace(/\d/g, "*");
6
+ const end = value.slice(-4);
7
+ return `${start} ${middle} ${end}`;
8
+ }
9
+ }
package/dist/iban.vo.js CHANGED
@@ -3,10 +3,10 @@ import { z } from "zod/v4";
3
3
  const IBAN_REGEX = /^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/;
4
4
  const IBANValueSchema = z
5
5
  .string()
6
- .transform((val) => val.replace(/\s+/g, "").toUpperCase())
7
- .refine((iban) => IBAN_REGEX.test(iban), {
8
- message: "invalid.iban.format",
9
- });
6
+ .trim()
7
+ .toUpperCase()
8
+ .transform((val) => val.replace(/\s+/g, ""))
9
+ .refine((iban) => IBAN_REGEX.test(iban), { message: "invalid.iban.format" });
10
10
  export class IBAN {
11
11
  value;
12
12
  constructor(value) {
package/dist/index.d.ts CHANGED
@@ -11,12 +11,13 @@ export * from "./feature-flag.vo";
11
11
  export * from "./filter.vo";
12
12
  export * from "./hour.vo";
13
13
  export * from "./iban.vo";
14
+ export * from "./iban-mask.service";
14
15
  export * from "./image.vo";
15
16
  export * from "./language.vo";
16
17
  export * from "./leap-year-checker.service";
17
18
  export * from "./mean.service";
18
- export * from "./mime-types.vo";
19
19
  export * from "./mime.vo";
20
+ export * from "./mime-types.vo";
20
21
  export * from "./min-max-scaler.service";
21
22
  export * from "./minute.vo";
22
23
  export * from "./money.vo";
@@ -34,14 +35,13 @@ export * from "./revision.vo";
34
35
  export * from "./rounding.service";
35
36
  export * from "./simple-linear-regression.service";
36
37
  export * from "./size.vo";
37
- export * from "./sleep.service";
38
38
  export * from "./stepper.service";
39
39
  export * from "./stopwatch.service";
40
40
  export * from "./streak-calculator.service";
41
41
  export * from "./sum.service";
42
42
  export * from "./thousands-separator.service";
43
- export * from "./time-zone-offset-value.vo";
44
43
  export * from "./time.service";
44
+ export * from "./time-zone-offset-value.vo";
45
45
  export * from "./timestamp.vo";
46
46
  export * from "./timezone.vo";
47
47
  export * from "./ts-utils";
package/dist/index.js CHANGED
@@ -11,12 +11,13 @@ export * from "./feature-flag.vo";
11
11
  export * from "./filter.vo";
12
12
  export * from "./hour.vo";
13
13
  export * from "./iban.vo";
14
+ export * from "./iban-mask.service";
14
15
  export * from "./image.vo";
15
16
  export * from "./language.vo";
16
17
  export * from "./leap-year-checker.service";
17
18
  export * from "./mean.service";
18
- export * from "./mime-types.vo";
19
19
  export * from "./mime.vo";
20
+ export * from "./mime-types.vo";
20
21
  export * from "./min-max-scaler.service";
21
22
  export * from "./minute.vo";
22
23
  export * from "./money.vo";
@@ -34,14 +35,13 @@ export * from "./revision.vo";
34
35
  export * from "./rounding.service";
35
36
  export * from "./simple-linear-regression.service";
36
37
  export * from "./size.vo";
37
- export * from "./sleep.service";
38
38
  export * from "./stepper.service";
39
39
  export * from "./stopwatch.service";
40
40
  export * from "./streak-calculator.service";
41
41
  export * from "./sum.service";
42
42
  export * from "./thousands-separator.service";
43
- export * from "./time-zone-offset-value.vo";
44
43
  export * from "./time.service";
44
+ export * from "./time-zone-offset-value.vo";
45
45
  export * from "./timestamp.vo";
46
46
  export * from "./timezone.vo";
47
47
  export * from "./ts-utils";
@@ -24,7 +24,7 @@ export const PackageVersionValue = z
24
24
  }
25
25
  return true;
26
26
  }
27
- catch (error) {
27
+ catch (_error) {
28
28
  return false;
29
29
  }
30
30
  }, { message: "package.version.error" })
@@ -1,9 +1,9 @@
1
1
  import { z } from "zod/v4";
2
- declare const Take: z.core.$ZodBranded<z.ZodNumber, "Take">;
2
+ declare const Take: z.ZodNumber;
3
3
  type TakeType = z.infer<typeof Take>;
4
- declare const Skip: z.core.$ZodBranded<z.ZodNumber, "Skip">;
4
+ declare const Skip: z.ZodNumber;
5
5
  type SkipType = z.infer<typeof Skip>;
6
- declare const Page: z.core.$ZodBranded<z.ZodDefault<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number, number>>>, "Page">;
6
+ declare const Page: z.ZodDefault<z.ZodPipe<z.ZodCoercedNumber<unknown>, z.ZodTransform<number, number>>>;
7
7
  export type PageType = z.infer<typeof Page>;
8
8
  export type PaginationType = {
9
9
  values: {
@@ -1,12 +1,11 @@
1
1
  import { z } from "zod/v4";
2
- const Take = z.number().int().gte(0).brand("Take");
3
- const Skip = z.number().int().gte(0).brand("Skip");
2
+ const Take = z.number().int().gte(0);
3
+ const Skip = z.number().int().gte(0);
4
4
  const Page = z.coerce
5
5
  .number()
6
6
  .int()
7
7
  .transform((value) => (value <= 0 ? 1 : value))
8
- .default(1)
9
- .brand("Page");
8
+ .default(1);
10
9
  export class Pagination {
11
10
  static parse(values, _take) {
12
11
  const page = Page.parse(values.page);
@@ -1,7 +1,6 @@
1
+ import type { TimeResult } from "./time.service";
1
2
  import { TimestampType } from "./timestamp.vo";
2
- type RateLimiterOptionsType = {
3
- ms: TimestampType;
4
- };
3
+ type RateLimiterOptionsType = Pick<TimeResult, "ms">;
5
4
  type RateLimiterResultSuccessType = {
6
5
  allowed: true;
7
6
  };
@@ -1,14 +1,14 @@
1
1
  import { z } from "zod/v4";
2
- export declare const ReorderingItemPositionValue: z.core.$ZodBranded<z.ZodNumber, "ReorderingItemPositionValue">;
2
+ export declare const ReorderingItemPositionValue: z.ZodNumber;
3
3
  export type ReorderingItemPositionValueType = z.infer<typeof ReorderingItemPositionValue>;
4
- export declare const ReorderingCorrelationId: z.core.$ZodBranded<z.ZodString, "ReorderingCorrelationId">;
4
+ export declare const ReorderingCorrelationId: z.ZodString;
5
5
  export type ReorderingCorrelationIdType = z.infer<typeof ReorderingCorrelationId>;
6
- export declare const ReorderingItemId: z.core.$ZodBranded<z.ZodUUID, "ReorderingItemId">;
6
+ export declare const ReorderingItemId: z.ZodUUID;
7
7
  export type ReorderingItemIdType = z.infer<typeof ReorderingItemId>;
8
8
  export declare const Reordering: z.ZodObject<{
9
- correlationId: z.core.$ZodBranded<z.ZodString, "ReorderingCorrelationId">;
10
- id: z.core.$ZodBranded<z.ZodUUID, "ReorderingItemId">;
11
- position: z.core.$ZodBranded<z.ZodNumber, "ReorderingItemPositionValue">;
9
+ correlationId: z.ZodString;
10
+ id: z.ZodUUID;
11
+ position: z.ZodNumber;
12
12
  }, z.core.$strip>;
13
13
  export type ReorderingType = z.infer<typeof Reordering>;
14
14
  export type WithReorderingPositionValue<T> = T & {
@@ -47,7 +47,7 @@ export declare class ReorderingCalculator {
47
47
  delete(id: ReorderingItem["id"]): void;
48
48
  transfer(transfer: ReorderingTransfer): ReturnType<ReorderingCalculator["read"]>;
49
49
  read(): {
50
- ids: (string & z.core.$brand<"ReorderingItemId">)[];
50
+ ids: string[];
51
51
  items: ReorderingItem[];
52
52
  };
53
53
  private recalculate;
@@ -1,8 +1,8 @@
1
1
  import { z } from "zod/v4";
2
2
  import { DoublyLinkedList, Node } from "./dll.service";
3
- export const ReorderingItemPositionValue = z.number().int().min(0).brand("ReorderingItemPositionValue");
4
- export const ReorderingCorrelationId = z.string().min(1).brand("ReorderingCorrelationId");
5
- export const ReorderingItemId = z.uuid().brand("ReorderingItemId");
3
+ export const ReorderingItemPositionValue = z.number().int().min(0);
4
+ export const ReorderingCorrelationId = z.string().min(1);
5
+ export const ReorderingItemId = z.uuid();
6
6
  export const Reordering = z.object({
7
7
  correlationId: ReorderingCorrelationId,
8
8
  id: ReorderingItemId,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
  import { ETag, WeakETag } from "./etags.vo";
3
- export declare const RevisionValue: z.core.$ZodBranded<z.ZodNumber, "RevisionValue">;
3
+ declare const RevisionValue: z.core.$ZodBranded<z.ZodNumber, "RevisionValue">;
4
4
  export type RevisionValueType = z.infer<typeof RevisionValue>;
5
5
  export declare class Revision {
6
6
  readonly value: RevisionValueType;
@@ -18,3 +18,4 @@ export declare class RevisionMismatchError extends Error {
18
18
  export declare class InvalidRevisionError extends Error {
19
19
  constructor();
20
20
  }
21
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod/v4";
2
- export const RevisionValue = z.number().int().min(0).brand("RevisionValue");
2
+ const RevisionValue = z.number().int().min(0).brand("RevisionValue");
3
3
  export class Revision {
4
4
  value;
5
5
  static initial = RevisionValue.parse(0);
package/dist/size.vo.d.ts CHANGED
@@ -5,11 +5,11 @@ export declare enum SizeUnit {
5
5
  MB = "MB",
6
6
  GB = "GB"
7
7
  }
8
- declare const SizeValue: z.core.$ZodBranded<z.ZodNumber, "SizeValue">;
9
- export type SizeValueType = z.infer<typeof SizeValue>;
8
+ export declare const SizeValue: z.core.$ZodBranded<z.ZodNumber, "SizeValue">;
9
+ type SizeValueType = z.infer<typeof SizeValue>;
10
10
  type SizeConfigType = {
11
11
  unit: SizeUnit;
12
- value: SizeValueType;
12
+ value: number;
13
13
  };
14
14
  export declare class Size {
15
15
  private readonly unit;
package/dist/size.vo.js CHANGED
@@ -7,7 +7,7 @@ export var SizeUnit;
7
7
  SizeUnit["MB"] = "MB";
8
8
  SizeUnit["GB"] = "GB";
9
9
  })(SizeUnit || (SizeUnit = {}));
10
- const SizeValue = z.number().positive().brand("SizeValue");
10
+ export const SizeValue = z.number().positive().brand("SizeValue");
11
11
  export class Size {
12
12
  unit;
13
13
  value;
@@ -18,7 +18,7 @@ export class Size {
18
18
  constructor(config) {
19
19
  this.unit = config.unit;
20
20
  this.value = SizeValue.parse(config.value);
21
- this.bytes = this.calculateBytes(config);
21
+ this.bytes = this.calculateBytes();
22
22
  }
23
23
  toString() {
24
24
  return `${this.value} ${this.unit}`;
@@ -54,17 +54,17 @@ export class Size {
54
54
  return new Size(config).toBytes();
55
55
  }
56
56
  static unit = SizeUnit;
57
- calculateBytes(config) {
58
- switch (config.unit) {
57
+ calculateBytes() {
58
+ switch (this.unit) {
59
59
  case SizeUnit.kB:
60
- return SizeValue.parse(config.value * Size.KB_MULTIPLIER);
60
+ return SizeValue.parse(this.value * Size.KB_MULTIPLIER);
61
61
  case SizeUnit.MB:
62
- return SizeValue.parse(config.value * Size.MB_MULTIPLIER);
62
+ return SizeValue.parse(this.value * Size.MB_MULTIPLIER);
63
63
  case SizeUnit.GB:
64
- return SizeValue.parse(config.value * Size.GB_MULTIPLIER);
64
+ return SizeValue.parse(this.value * Size.GB_MULTIPLIER);
65
65
  default:
66
66
  // SizeUnit.b
67
- return config.value;
67
+ return this.value;
68
68
  }
69
69
  }
70
70
  }
@@ -2,6 +2,6 @@ import { z } from "zod/v4";
2
2
  export const Timestamp = z
3
3
  .number()
4
4
  .int()
5
- .positive()
5
+ .gte(0)
6
6
  .default(() => Date.now())
7
7
  .brand("Timestamp");
@@ -12,7 +12,7 @@ export const Timezone = z
12
12
  // If the formatting succeeds without throwing an error, the timezone is valid
13
13
  return true;
14
14
  }
15
- catch (error) {
15
+ catch (_error) {
16
16
  // An error occurred, indicating an invalid timezone
17
17
  return false;
18
18
  }
@@ -0,0 +1 @@
1
+ {"root":["../src/api-key.vo.ts","../src/build-version.vo.ts","../src/clock.vo.ts","../src/date-calculator.service.ts","../src/date-formatter.service.ts","../src/dates-of-the-week.vo.ts","../src/dll.service.ts","../src/email-mask.service.ts","../src/etags.vo.ts","../src/feature-flag.vo.ts","../src/filter.vo.ts","../src/hour.vo.ts","../src/iban-mask.service.ts","../src/iban.vo.ts","../src/image.vo.ts","../src/index.ts","../src/language.vo.ts","../src/leap-year-checker.service.ts","../src/mean.service.ts","../src/mime-types.vo.ts","../src/mime.vo.ts","../src/min-max-scaler.service.ts","../src/minute.vo.ts","../src/money.vo.ts","../src/noop.service.ts","../src/outlier-detector.service.ts","../src/package-version.vo.ts","../src/pagination.service.ts","../src/percentage.service.ts","../src/population-standard-deviation.service.ts","../src/random.service.ts","../src/rate-limiter.service.ts","../src/relative-date.vo.ts","../src/reordering.service.ts","../src/revision.vo.ts","../src/rounding.service.ts","../src/simple-linear-regression.service.ts","../src/size.vo.ts","../src/stepper.service.ts","../src/stopwatch.service.ts","../src/streak-calculator.service.ts","../src/sum.service.ts","../src/thousands-separator.service.ts","../src/time-zone-offset-value.vo.ts","../src/time.service.ts","../src/timestamp.vo.ts","../src/timezone.vo.ts","../src/ts-utils.ts","../src/visually-unambiguous-characters-generator.service.ts","../src/z-score.service.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/tools",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Bartosz Gordon",
@@ -12,25 +12,28 @@
12
12
  "types": "./dist/index.d.ts"
13
13
  }
14
14
  },
15
- "files": ["dist", "src"],
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
16
19
  "scripts": {
17
20
  "build": "rm -rf dist/ && tsc --build",
18
21
  "preinstall": "bunx only-allow bun"
19
22
  },
20
23
  "devDependencies": {
21
- "@biomejs/biome": "1.9.4",
24
+ "@biomejs/biome": "2.0.0",
22
25
  "@commitlint/cli": "19.8.1",
23
26
  "@commitlint/config-conventional": "19.8.1",
24
27
  "@types/bun": "1.2.16",
25
- "cspell": "9.0.2",
26
- "lefthook": "1.11.13",
28
+ "cspell": "9.1.1",
29
+ "lefthook": "1.11.14",
27
30
  "only-allow": "1.2.1",
28
31
  "shellcheck": "3.1.0",
29
32
  "typescript": "5.8.3"
30
33
  },
31
34
  "dependencies": {
32
35
  "date-fns": "4.1.0",
33
- "zod": "3.25.64"
36
+ "zod": "3.25.67"
34
37
  },
35
38
  "sideEffects": false
36
39
  }
package/src/etags.vo.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- const RevisionValue = z.number().int().min(0).brand("RevisionValue");
3
+ export const RevisionValue = z.number().int().min(0).brand("RevisionValue");
4
4
 
5
5
  type RevisionValueType = z.infer<typeof RevisionValue>;
6
6
 
@@ -0,0 +1,15 @@
1
+ import { IBAN } from "./iban.vo";
2
+
3
+ type IbanMaskedType = string;
4
+
5
+ export class IbanMask {
6
+ static censor(iban: IBAN): IbanMaskedType {
7
+ const value = iban.format();
8
+
9
+ const start = value.slice(0, 4);
10
+ const middle = value.slice(5, -5).replace(/\d/g, "*");
11
+ const end = value.slice(-4);
12
+
13
+ return `${start} ${middle} ${end}`;
14
+ }
15
+ }
package/src/iban.vo.ts CHANGED
@@ -5,10 +5,10 @@ const IBAN_REGEX = /^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/;
5
5
 
6
6
  const IBANValueSchema = z
7
7
  .string()
8
- .transform((val) => val.replace(/\s+/g, "").toUpperCase())
9
- .refine((iban) => IBAN_REGEX.test(iban), {
10
- message: "invalid.iban.format",
11
- });
8
+ .trim()
9
+ .toUpperCase()
10
+ .transform((val) => val.replace(/\s+/g, ""))
11
+ .refine((iban) => IBAN_REGEX.test(iban), { message: "invalid.iban.format" });
12
12
 
13
13
  type IBANValueType = z.infer<typeof IBANValueSchema>;
14
14
 
package/src/index.ts CHANGED
@@ -11,12 +11,13 @@ export * from "./feature-flag.vo";
11
11
  export * from "./filter.vo";
12
12
  export * from "./hour.vo";
13
13
  export * from "./iban.vo";
14
+ export * from "./iban-mask.service";
14
15
  export * from "./image.vo";
15
16
  export * from "./language.vo";
16
17
  export * from "./leap-year-checker.service";
17
18
  export * from "./mean.service";
18
- export * from "./mime-types.vo";
19
19
  export * from "./mime.vo";
20
+ export * from "./mime-types.vo";
20
21
  export * from "./min-max-scaler.service";
21
22
  export * from "./minute.vo";
22
23
  export * from "./money.vo";
@@ -34,14 +35,13 @@ export * from "./revision.vo";
34
35
  export * from "./rounding.service";
35
36
  export * from "./simple-linear-regression.service";
36
37
  export * from "./size.vo";
37
- export * from "./sleep.service";
38
38
  export * from "./stepper.service";
39
39
  export * from "./stopwatch.service";
40
40
  export * from "./streak-calculator.service";
41
41
  export * from "./sum.service";
42
42
  export * from "./thousands-separator.service";
43
- export * from "./time-zone-offset-value.vo";
44
43
  export * from "./time.service";
44
+ export * from "./time-zone-offset-value.vo";
45
45
  export * from "./timestamp.vo";
46
46
  export * from "./timezone.vo";
47
47
  export * from "./ts-utils";
@@ -1,4 +1,4 @@
1
- import { RoundToDecimal, RoundingStrategy } from "./rounding.service";
1
+ import { RoundingStrategy, RoundToDecimal } from "./rounding.service";
2
2
  import { Sum } from "./sum.service";
3
3
 
4
4
  export class Mean {
@@ -1,4 +1,4 @@
1
- import { RoundToDecimal, RoundingStrategy } from "./rounding.service";
1
+ import { RoundingStrategy, RoundToDecimal } from "./rounding.service";
2
2
 
3
3
  type MinMaxScalerValueType = number;
4
4
 
package/src/money.vo.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- import { RoundToNearest, RoundingStrategy } from "./rounding.service";
3
+ import { RoundingStrategy, RoundToNearest } from "./rounding.service";
4
4
 
5
5
  export const MoneyAmount = z
6
6
  .number()
@@ -41,7 +41,7 @@ export const PackageVersionValue = z
41
41
  }
42
42
 
43
43
  return true;
44
- } catch (error) {
44
+ } catch (_error) {
45
45
  return false;
46
46
  }
47
47
  },
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod/v4";
2
2
 
3
- const Take = z.number().int().gte(0).brand("Take");
3
+ const Take = z.number().int().gte(0);
4
4
 
5
5
  type TakeType = z.infer<typeof Take>;
6
6
 
7
- const Skip = z.number().int().gte(0).brand("Skip");
7
+ const Skip = z.number().int().gte(0);
8
8
 
9
9
  type SkipType = z.infer<typeof Skip>;
10
10
 
@@ -12,8 +12,7 @@ const Page = z.coerce
12
12
  .number()
13
13
  .int()
14
14
  .transform((value) => (value <= 0 ? 1 : value))
15
- .default(1)
16
- .brand("Page");
15
+ .default(1);
17
16
 
18
17
  export type PageType = z.infer<typeof Page>;
19
18
 
@@ -1,4 +1,4 @@
1
- import { RoundToNearest, RoundingStrategy } from "./rounding.service";
1
+ import { RoundingStrategy, RoundToNearest } from "./rounding.service";
2
2
 
3
3
  export class Percentage {
4
4
  static of(
@@ -1,5 +1,5 @@
1
1
  import { Mean } from "./mean.service";
2
- import { RoundToDecimal, RoundingStrategy } from "./rounding.service";
2
+ import { RoundingStrategy, RoundToDecimal } from "./rounding.service";
3
3
  import { Sum } from "./sum.service";
4
4
 
5
5
  export class PopulationStandardDeviation {
@@ -1,7 +1,8 @@
1
+ import type { TimeResult } from "./time.service";
1
2
  import { Timestamp, TimestampType } from "./timestamp.vo";
2
3
  import type { Falsy } from "./ts-utils";
3
4
 
4
- type RateLimiterOptionsType = { ms: TimestampType };
5
+ type RateLimiterOptionsType = Pick<TimeResult, "ms">;
5
6
 
6
7
  type RateLimiterResultSuccessType = { allowed: true };
7
8
 
@@ -2,15 +2,15 @@ import { z } from "zod/v4";
2
2
 
3
3
  import { DoublyLinkedList, Node } from "./dll.service";
4
4
 
5
- export const ReorderingItemPositionValue = z.number().int().min(0).brand("ReorderingItemPositionValue");
5
+ export const ReorderingItemPositionValue = z.number().int().min(0);
6
6
 
7
7
  export type ReorderingItemPositionValueType = z.infer<typeof ReorderingItemPositionValue>;
8
8
 
9
- export const ReorderingCorrelationId = z.string().min(1).brand("ReorderingCorrelationId");
9
+ export const ReorderingCorrelationId = z.string().min(1);
10
10
 
11
11
  export type ReorderingCorrelationIdType = z.infer<typeof ReorderingCorrelationId>;
12
12
 
13
- export const ReorderingItemId = z.uuid().brand("ReorderingItemId");
13
+ export const ReorderingItemId = z.uuid();
14
14
 
15
15
  export type ReorderingItemIdType = z.infer<typeof ReorderingItemId>;
16
16
 
@@ -2,7 +2,7 @@ import { z } from "zod/v4";
2
2
 
3
3
  import { ETag, WeakETag } from "./etags.vo";
4
4
 
5
- export const RevisionValue = z.number().int().min(0).brand("RevisionValue");
5
+ const RevisionValue = z.number().int().min(0).brand("RevisionValue");
6
6
 
7
7
  export type RevisionValueType = z.infer<typeof RevisionValue>;
8
8
 
@@ -1,4 +1,4 @@
1
- import { RoundToNearest, RoundingStrategy } from "./rounding.service";
1
+ import { RoundingStrategy, RoundToNearest } from "./rounding.service";
2
2
  import { Sum } from "./sum.service";
3
3
 
4
4
  export type SLRPairType = { x: number; y: number };
package/src/size.vo.ts CHANGED
@@ -9,11 +9,11 @@ export enum SizeUnit {
9
9
  GB = "GB",
10
10
  }
11
11
 
12
- const SizeValue = z.number().positive().brand("SizeValue");
12
+ export const SizeValue = z.number().positive().brand("SizeValue");
13
13
 
14
- export type SizeValueType = z.infer<typeof SizeValue>;
14
+ type SizeValueType = z.infer<typeof SizeValue>;
15
15
 
16
- type SizeConfigType = { unit: SizeUnit; value: SizeValueType };
16
+ type SizeConfigType = { unit: SizeUnit; value: number };
17
17
 
18
18
  export class Size {
19
19
  private readonly unit: SizeUnit;
@@ -31,7 +31,7 @@ export class Size {
31
31
  constructor(config: SizeConfigType) {
32
32
  this.unit = config.unit;
33
33
  this.value = SizeValue.parse(config.value);
34
- this.bytes = this.calculateBytes(config);
34
+ this.bytes = this.calculateBytes();
35
35
  }
36
36
 
37
37
  toString(): string {
@@ -78,17 +78,17 @@ export class Size {
78
78
 
79
79
  static unit = SizeUnit;
80
80
 
81
- private calculateBytes(config: SizeConfigType): SizeValueType {
82
- switch (config.unit) {
81
+ private calculateBytes(): SizeValueType {
82
+ switch (this.unit) {
83
83
  case SizeUnit.kB:
84
- return SizeValue.parse(config.value * Size.KB_MULTIPLIER);
84
+ return SizeValue.parse(this.value * Size.KB_MULTIPLIER);
85
85
  case SizeUnit.MB:
86
- return SizeValue.parse(config.value * Size.MB_MULTIPLIER);
86
+ return SizeValue.parse(this.value * Size.MB_MULTIPLIER);
87
87
  case SizeUnit.GB:
88
- return SizeValue.parse(config.value * Size.GB_MULTIPLIER);
88
+ return SizeValue.parse(this.value * Size.GB_MULTIPLIER);
89
89
  default:
90
90
  // SizeUnit.b
91
- return config.value;
91
+ return this.value;
92
92
  }
93
93
  }
94
94
  }
@@ -3,7 +3,7 @@ import { z } from "zod/v4";
3
3
  export const Timestamp = z
4
4
  .number()
5
5
  .int()
6
- .positive()
6
+ .gte(0)
7
7
  .default(() => Date.now())
8
8
  .brand("Timestamp");
9
9
 
@@ -15,7 +15,7 @@ export const Timezone = z
15
15
 
16
16
  // If the formatting succeeds without throwing an error, the timezone is valid
17
17
  return true;
18
- } catch (error) {
18
+ } catch (_error) {
19
19
  // An error occurred, indicating an invalid timezone
20
20
  return false;
21
21
  }
@@ -1,6 +1,6 @@
1
1
  import { Mean } from "./mean.service";
2
2
  import { PopulationStandardDeviation } from "./population-standard-deviation.service";
3
- import { RoundToDecimal, RoundingStrategy } from "./rounding.service";
3
+ import { RoundingStrategy, RoundToDecimal } from "./rounding.service";
4
4
 
5
5
  export class ZScore {
6
6
  private readonly mean: number;
@@ -1,3 +0,0 @@
1
- export declare function sleep(config: {
2
- ms: number;
3
- }): Promise<unknown>;
@@ -1,3 +0,0 @@
1
- export function sleep(config) {
2
- return new Promise((resolve) => setTimeout(resolve, config.ms));
3
- }
@@ -1,3 +0,0 @@
1
- export function sleep(config: { ms: number }) {
2
- return new Promise((resolve) => setTimeout(resolve, config.ms));
3
- }