@bgord/tools 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/etags.vo.d.ts +4 -4
- package/dist/etags.vo.js +1 -1
- package/dist/package-version.vo.d.ts +2 -2
- package/dist/package-version.vo.js +3 -3
- package/dist/size.vo.d.ts +2 -2
- package/dist/size.vo.js +2 -2
- package/package.json +2 -2
- package/src/etags.vo.ts +4 -4
- package/src/package-version.vo.ts +4 -4
- package/src/size.vo.ts +3 -3
package/dist/etags.vo.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
declare const
|
|
3
|
-
type
|
|
2
|
+
declare const RevisionValue: z.ZodNumber;
|
|
3
|
+
type RevisionValueType = z.infer<typeof RevisionValue>;
|
|
4
4
|
type ETagValueType = string;
|
|
5
5
|
export declare class ETag {
|
|
6
|
-
readonly revision:
|
|
6
|
+
readonly revision: RevisionValueType;
|
|
7
7
|
static HEADER_NAME: string;
|
|
8
8
|
static IF_MATCH_HEADER_NAME: string;
|
|
9
9
|
readonly value: ETagValueType;
|
|
@@ -12,7 +12,7 @@ export declare class ETag {
|
|
|
12
12
|
}
|
|
13
13
|
export type WeakETagValueType = string;
|
|
14
14
|
export declare class WeakETag {
|
|
15
|
-
readonly revision:
|
|
15
|
+
readonly revision: RevisionValueType;
|
|
16
16
|
static HEADER_NAME: string;
|
|
17
17
|
static IF_MATCH_HEADER_NAME: string;
|
|
18
18
|
readonly value: WeakETagValueType;
|
package/dist/etags.vo.js
CHANGED
|
@@ -2,12 +2,12 @@ import { z } from "zod/v4";
|
|
|
2
2
|
type MajorType = number;
|
|
3
3
|
type MinorType = number;
|
|
4
4
|
type PatchType = number;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const PackageVersionValue: z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
6
6
|
major: number;
|
|
7
7
|
minor: number;
|
|
8
8
|
patch: number;
|
|
9
9
|
}, string>>;
|
|
10
|
-
export type
|
|
10
|
+
export type PackageVersionValueType = z.infer<typeof PackageVersionValue>;
|
|
11
11
|
export declare class PackageVersion {
|
|
12
12
|
readonly major: MajorType;
|
|
13
13
|
readonly minor: MinorType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
export const
|
|
2
|
+
export const PackageVersionValue = z
|
|
3
3
|
.string()
|
|
4
4
|
.min(1)
|
|
5
5
|
.refine((value) => {
|
|
@@ -59,11 +59,11 @@ export class PackageVersion {
|
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
61
|
static fromStringWithV(value) {
|
|
62
|
-
const version =
|
|
62
|
+
const version = PackageVersionValue.parse(value);
|
|
63
63
|
return new PackageVersion(version.major, version.minor, version.patch);
|
|
64
64
|
}
|
|
65
65
|
static fromString(value) {
|
|
66
|
-
const version =
|
|
66
|
+
const version = PackageVersionValue.parse(`v${value}`);
|
|
67
67
|
return new PackageVersion(version.major, version.minor, version.patch);
|
|
68
68
|
}
|
|
69
69
|
}
|
package/dist/size.vo.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export declare enum SizeUnit {
|
|
|
5
5
|
MB = "MB",
|
|
6
6
|
GB = "GB"
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
9
|
-
export type SizeValueType = z.infer<typeof
|
|
8
|
+
declare const SizeValue: z.ZodNumber;
|
|
9
|
+
export type SizeValueType = z.infer<typeof SizeValue>;
|
|
10
10
|
type SizeConfigType = {
|
|
11
11
|
unit: SizeUnit;
|
|
12
12
|
value: SizeValueType;
|
package/dist/size.vo.js
CHANGED
|
@@ -7,11 +7,11 @@ export var SizeUnit;
|
|
|
7
7
|
SizeUnit["MB"] = "MB";
|
|
8
8
|
SizeUnit["GB"] = "GB";
|
|
9
9
|
})(SizeUnit || (SizeUnit = {}));
|
|
10
|
-
const
|
|
10
|
+
const SizeValue = z.number().positive();
|
|
11
11
|
export class Size {
|
|
12
12
|
constructor(config) {
|
|
13
13
|
this.unit = config.unit;
|
|
14
|
-
this.value =
|
|
14
|
+
this.value = SizeValue.parse(config.value);
|
|
15
15
|
this.bytes = this.calculateBytes(config);
|
|
16
16
|
}
|
|
17
17
|
toString() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bgord/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bartosz Gordon",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"date-fns": "4.1.0",
|
|
33
|
-
"zod": "3.25.
|
|
33
|
+
"zod": "3.25.51"
|
|
34
34
|
},
|
|
35
35
|
"sideEffects": false
|
|
36
36
|
}
|
package/src/etags.vo.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const RevisionValue = z.number().int().min(0);
|
|
4
4
|
|
|
5
|
-
type
|
|
5
|
+
type RevisionValueType = z.infer<typeof RevisionValue>;
|
|
6
6
|
|
|
7
7
|
type ETagValueType = string;
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ export class ETag {
|
|
|
13
13
|
|
|
14
14
|
readonly value: ETagValueType;
|
|
15
15
|
|
|
16
|
-
private constructor(readonly revision:
|
|
16
|
+
private constructor(readonly revision: RevisionValueType) {
|
|
17
17
|
this.value = revision.toString();
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -36,7 +36,7 @@ export class WeakETag {
|
|
|
36
36
|
|
|
37
37
|
readonly value: WeakETagValueType;
|
|
38
38
|
|
|
39
|
-
private constructor(readonly revision:
|
|
39
|
+
private constructor(readonly revision: RevisionValueType) {
|
|
40
40
|
this.value = `W/${revision.toString()}`;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -4,7 +4,7 @@ type MajorType = number;
|
|
|
4
4
|
type MinorType = number;
|
|
5
5
|
type PatchType = number;
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const PackageVersionValue = z
|
|
8
8
|
.string()
|
|
9
9
|
.min(1)
|
|
10
10
|
.refine(
|
|
@@ -56,7 +56,7 @@ export const PackageVersionSchema = z
|
|
|
56
56
|
patch: Number(patch),
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
|
-
export type
|
|
59
|
+
export type PackageVersionValueType = z.infer<typeof PackageVersionValue>;
|
|
60
60
|
|
|
61
61
|
export class PackageVersion {
|
|
62
62
|
constructor(
|
|
@@ -79,13 +79,13 @@ export class PackageVersion {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
static fromStringWithV(value: string) {
|
|
82
|
-
const version =
|
|
82
|
+
const version = PackageVersionValue.parse(value);
|
|
83
83
|
|
|
84
84
|
return new PackageVersion(version.major, version.minor, version.patch);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
static fromString(value: string) {
|
|
88
|
-
const version =
|
|
88
|
+
const version = PackageVersionValue.parse(`v${value}`);
|
|
89
89
|
|
|
90
90
|
return new PackageVersion(version.major, version.minor, version.patch);
|
|
91
91
|
}
|
package/src/size.vo.ts
CHANGED
|
@@ -9,9 +9,9 @@ export enum SizeUnit {
|
|
|
9
9
|
GB = "GB",
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const SizeValue = z.number().positive();
|
|
13
13
|
|
|
14
|
-
export type SizeValueType = z.infer<typeof
|
|
14
|
+
export type SizeValueType = z.infer<typeof SizeValue>;
|
|
15
15
|
|
|
16
16
|
type SizeConfigType = { unit: SizeUnit; value: SizeValueType };
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@ export class Size {
|
|
|
30
30
|
|
|
31
31
|
constructor(config: SizeConfigType) {
|
|
32
32
|
this.unit = config.unit;
|
|
33
|
-
this.value =
|
|
33
|
+
this.value = SizeValue.parse(config.value);
|
|
34
34
|
this.bytes = this.calculateBytes(config);
|
|
35
35
|
}
|
|
36
36
|
|