@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.
- package/dist/etags.vo.d.ts +1 -1
- package/dist/etags.vo.js +1 -1
- package/dist/filter.vo.d.ts +4 -4
- package/dist/iban-mask.service.d.ts +6 -0
- package/dist/iban-mask.service.js +9 -0
- package/dist/iban.vo.js +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/package-version.vo.js +1 -1
- package/dist/pagination.service.d.ts +3 -3
- package/dist/pagination.service.js +3 -4
- package/dist/rate-limiter.service.d.ts +2 -3
- package/dist/reordering.service.d.ts +7 -7
- package/dist/reordering.service.js +3 -3
- package/dist/revision.vo.d.ts +2 -1
- package/dist/revision.vo.js +1 -1
- package/dist/size.vo.d.ts +3 -3
- package/dist/size.vo.js +8 -8
- package/dist/timestamp.vo.js +1 -1
- package/dist/timezone.vo.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +9 -6
- package/src/etags.vo.ts +1 -1
- package/src/iban-mask.service.ts +15 -0
- package/src/iban.vo.ts +4 -4
- package/src/index.ts +3 -3
- package/src/mean.service.ts +1 -1
- package/src/min-max-scaler.service.ts +1 -1
- package/src/money.vo.ts +1 -1
- package/src/package-version.vo.ts +1 -1
- package/src/pagination.service.ts +3 -4
- package/src/percentage.service.ts +1 -1
- package/src/population-standard-deviation.service.ts +1 -1
- package/src/rate-limiter.service.ts +2 -1
- package/src/reordering.service.ts +3 -3
- package/src/revision.vo.ts +1 -1
- package/src/simple-linear-regression.service.ts +1 -1
- package/src/size.vo.ts +10 -10
- package/src/timestamp.vo.ts +1 -1
- package/src/timezone.vo.ts +1 -1
- package/src/z-score.service.ts +1 -1
- package/dist/sleep.service.d.ts +0 -3
- package/dist/sleep.service.js +0 -3
- package/src/sleep.service.ts +0 -3
package/dist/etags.vo.d.ts
CHANGED
|
@@ -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
package/dist/filter.vo.d.ts
CHANGED
|
@@ -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,
|
|
13
|
-
default(): z.core.$InferObjectOutput<T,
|
|
14
|
-
static parse<T extends DefaultFilterSchemaType>(config: FilterParseConfigType<T>): z.core.$InferObjectOutput<T,
|
|
15
|
-
static default<T extends DefaultFilterSchemaType>(config: Omit<FilterParseConfigType<T>, "values">): z.core.$InferObjectOutput<T,
|
|
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
|
}
|
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
|
-
.
|
|
7
|
-
.
|
|
8
|
-
|
|
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";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
declare const Take: z.
|
|
2
|
+
declare const Take: z.ZodNumber;
|
|
3
3
|
type TakeType = z.infer<typeof Take>;
|
|
4
|
-
declare const Skip: z.
|
|
4
|
+
declare const Skip: z.ZodNumber;
|
|
5
5
|
type SkipType = z.infer<typeof Skip>;
|
|
6
|
-
declare const Page: z.
|
|
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)
|
|
3
|
-
const Skip = z.number().int().gte(0)
|
|
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.
|
|
2
|
+
export declare const ReorderingItemPositionValue: z.ZodNumber;
|
|
3
3
|
export type ReorderingItemPositionValueType = z.infer<typeof ReorderingItemPositionValue>;
|
|
4
|
-
export declare const ReorderingCorrelationId: z.
|
|
4
|
+
export declare const ReorderingCorrelationId: z.ZodString;
|
|
5
5
|
export type ReorderingCorrelationIdType = z.infer<typeof ReorderingCorrelationId>;
|
|
6
|
-
export declare const ReorderingItemId: z.
|
|
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.
|
|
10
|
-
id: z.
|
|
11
|
-
position: z.
|
|
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:
|
|
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)
|
|
4
|
-
export const ReorderingCorrelationId = z.string().min(1)
|
|
5
|
-
export const ReorderingItemId = z.uuid()
|
|
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,
|
package/dist/revision.vo.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
import { ETag, WeakETag } from "./etags.vo";
|
|
3
|
-
|
|
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 {};
|
package/dist/revision.vo.js
CHANGED
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
|
-
|
|
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:
|
|
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(
|
|
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(
|
|
58
|
-
switch (
|
|
57
|
+
calculateBytes() {
|
|
58
|
+
switch (this.unit) {
|
|
59
59
|
case SizeUnit.kB:
|
|
60
|
-
return SizeValue.parse(
|
|
60
|
+
return SizeValue.parse(this.value * Size.KB_MULTIPLIER);
|
|
61
61
|
case SizeUnit.MB:
|
|
62
|
-
return SizeValue.parse(
|
|
62
|
+
return SizeValue.parse(this.value * Size.MB_MULTIPLIER);
|
|
63
63
|
case SizeUnit.GB:
|
|
64
|
-
return SizeValue.parse(
|
|
64
|
+
return SizeValue.parse(this.value * Size.GB_MULTIPLIER);
|
|
65
65
|
default:
|
|
66
66
|
// SizeUnit.b
|
|
67
|
-
return
|
|
67
|
+
return this.value;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
package/dist/timestamp.vo.js
CHANGED
package/dist/timezone.vo.js
CHANGED
|
@@ -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.
|
|
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": [
|
|
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": "
|
|
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.
|
|
26
|
-
"lefthook": "1.11.
|
|
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.
|
|
36
|
+
"zod": "3.25.67"
|
|
34
37
|
},
|
|
35
38
|
"sideEffects": false
|
|
36
39
|
}
|
package/src/etags.vo.ts
CHANGED
|
@@ -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
|
-
.
|
|
9
|
-
.
|
|
10
|
-
|
|
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";
|
package/src/mean.service.ts
CHANGED
package/src/money.vo.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
const Take = z.number().int().gte(0)
|
|
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)
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import { Mean } from "./mean.service";
|
|
2
|
-
import {
|
|
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 =
|
|
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)
|
|
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)
|
|
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()
|
|
13
|
+
export const ReorderingItemId = z.uuid();
|
|
14
14
|
|
|
15
15
|
export type ReorderingItemIdType = z.infer<typeof ReorderingItemId>;
|
|
16
16
|
|
package/src/revision.vo.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod/v4";
|
|
|
2
2
|
|
|
3
3
|
import { ETag, WeakETag } from "./etags.vo";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const RevisionValue = z.number().int().min(0).brand("RevisionValue");
|
|
6
6
|
|
|
7
7
|
export type RevisionValueType = z.infer<typeof RevisionValue>;
|
|
8
8
|
|
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
|
-
|
|
14
|
+
type SizeValueType = z.infer<typeof SizeValue>;
|
|
15
15
|
|
|
16
|
-
type SizeConfigType = { unit: SizeUnit; value:
|
|
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(
|
|
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(
|
|
82
|
-
switch (
|
|
81
|
+
private calculateBytes(): SizeValueType {
|
|
82
|
+
switch (this.unit) {
|
|
83
83
|
case SizeUnit.kB:
|
|
84
|
-
return SizeValue.parse(
|
|
84
|
+
return SizeValue.parse(this.value * Size.KB_MULTIPLIER);
|
|
85
85
|
case SizeUnit.MB:
|
|
86
|
-
return SizeValue.parse(
|
|
86
|
+
return SizeValue.parse(this.value * Size.MB_MULTIPLIER);
|
|
87
87
|
case SizeUnit.GB:
|
|
88
|
-
return SizeValue.parse(
|
|
88
|
+
return SizeValue.parse(this.value * Size.GB_MULTIPLIER);
|
|
89
89
|
default:
|
|
90
90
|
// SizeUnit.b
|
|
91
|
-
return
|
|
91
|
+
return this.value;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
package/src/timestamp.vo.ts
CHANGED
package/src/timezone.vo.ts
CHANGED
package/src/z-score.service.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mean } from "./mean.service";
|
|
2
2
|
import { PopulationStandardDeviation } from "./population-standard-deviation.service";
|
|
3
|
-
import {
|
|
3
|
+
import { RoundingStrategy, RoundToDecimal } from "./rounding.service";
|
|
4
4
|
|
|
5
5
|
export class ZScore {
|
|
6
6
|
private readonly mean: number;
|
package/dist/sleep.service.d.ts
DELETED
package/dist/sleep.service.js
DELETED
package/src/sleep.service.ts
DELETED