@nxtedition/types 1.0.0 → 1.1.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/common/block.d.ts +8 -8
- package/dist/common/block.js +372 -182
- package/dist/common/file.d.ts +30 -0
- package/dist/common/file.js +592 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/common/lock.d.ts +5 -3
- package/dist/common/lock.js +128 -42
- package/package.json +2 -1
package/dist/common/lock.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type AssertionGuard as __AssertionGuard } from "typia";
|
|
2
|
+
import { tags } from 'typia';
|
|
2
3
|
export interface Lock {
|
|
3
|
-
time: number
|
|
4
|
-
locations: string
|
|
5
|
-
|
|
4
|
+
time: number & tags.ExclusiveMinimum<0>;
|
|
5
|
+
locations: Array<string & tags.MinLength<1>>;
|
|
6
|
+
zone: string & tags.MinLength<1>;
|
|
7
|
+
replicas: number & tags.ExclusiveMinimum<0>;
|
|
6
8
|
}
|
|
7
9
|
export declare const isLock: (input: unknown) => input is Lock;
|
|
8
10
|
export declare const assertLock: (input: unknown) => Lock;
|
package/dist/common/lock.js
CHANGED
|
@@ -1,35 +1,55 @@
|
|
|
1
1
|
import __typia from "typia";
|
|
2
2
|
export const isLock = input => {
|
|
3
|
-
const $io0 = input => "number" === typeof input.time &&
|
|
3
|
+
const $io0 = input => "number" === typeof input.time && 0 < input.time && (Array.isArray(input.locations) && input.locations.every(elem => "string" === typeof elem && 1 <= elem.length)) && ("string" === typeof input.zone && 1 <= input.zone.length) && ("number" === typeof input.replicas && 0 < input.replicas);
|
|
4
4
|
return "object" === typeof input && null !== input && $io0(input);
|
|
5
5
|
};
|
|
6
6
|
export const assertLock = (input, errorFactory) => {
|
|
7
7
|
const __is = input => {
|
|
8
|
-
const $io0 = input => "number" === typeof input.time &&
|
|
8
|
+
const $io0 = input => "number" === typeof input.time && 0 < input.time && (Array.isArray(input.locations) && input.locations.every(elem => "string" === typeof elem && 1 <= elem.length)) && ("string" === typeof input.zone && 1 <= input.zone.length) && ("number" === typeof input.replicas && 0 < input.replicas);
|
|
9
9
|
return "object" === typeof input && null !== input && $io0(input);
|
|
10
10
|
};
|
|
11
11
|
if (false === __is(input))
|
|
12
12
|
((input, _path, _exceptionable = true) => {
|
|
13
13
|
const $guard = __typia.createAssert.guard;
|
|
14
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.time || $guard(_exceptionable, {
|
|
14
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.time && (0 < input.time || $guard(_exceptionable, {
|
|
15
15
|
path: _path + ".time",
|
|
16
|
-
expected: "number",
|
|
16
|
+
expected: "number & ExclusiveMinimum<0>",
|
|
17
17
|
value: input.time
|
|
18
|
-
}, errorFactory))
|
|
18
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
19
|
+
path: _path + ".time",
|
|
20
|
+
expected: "(number & ExclusiveMinimum<0>)",
|
|
21
|
+
value: input.time
|
|
22
|
+
}, errorFactory)) && ((Array.isArray(input.locations) || $guard(_exceptionable, {
|
|
19
23
|
path: _path + ".locations",
|
|
20
|
-
expected: "
|
|
24
|
+
expected: "Array<string & MinLength<1>>",
|
|
21
25
|
value: input.locations
|
|
22
|
-
}, errorFactory)) && input.locations.every((elem, _index1) => "string" === typeof elem || $guard(_exceptionable, {
|
|
26
|
+
}, errorFactory)) && input.locations.every((elem, _index1) => "string" === typeof elem && (1 <= elem.length || $guard(_exceptionable, {
|
|
27
|
+
path: _path + ".locations[" + _index1 + "]",
|
|
28
|
+
expected: "string & MinLength<1>",
|
|
29
|
+
value: elem
|
|
30
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
23
31
|
path: _path + ".locations[" + _index1 + "]",
|
|
24
|
-
expected: "string",
|
|
32
|
+
expected: "(string & MinLength<1>)",
|
|
25
33
|
value: elem
|
|
26
34
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
27
35
|
path: _path + ".locations",
|
|
28
|
-
expected: "
|
|
36
|
+
expected: "Array<string & MinLength<1>>",
|
|
29
37
|
value: input.locations
|
|
30
|
-
}, errorFactory)) && (
|
|
38
|
+
}, errorFactory)) && ("string" === typeof input.zone && (1 <= input.zone.length || $guard(_exceptionable, {
|
|
39
|
+
path: _path + ".zone",
|
|
40
|
+
expected: "string & MinLength<1>",
|
|
41
|
+
value: input.zone
|
|
42
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
43
|
+
path: _path + ".zone",
|
|
44
|
+
expected: "(string & MinLength<1>)",
|
|
45
|
+
value: input.zone
|
|
46
|
+
}, errorFactory)) && ("number" === typeof input.replicas && (0 < input.replicas || $guard(_exceptionable, {
|
|
31
47
|
path: _path + ".replicas",
|
|
32
|
-
expected: "
|
|
48
|
+
expected: "number & ExclusiveMinimum<0>",
|
|
49
|
+
value: input.replicas
|
|
50
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
51
|
+
path: _path + ".replicas",
|
|
52
|
+
expected: "(number & ExclusiveMinimum<0>)",
|
|
33
53
|
value: input.replicas
|
|
34
54
|
}, errorFactory));
|
|
35
55
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
@@ -46,47 +66,85 @@ export const assertLock = (input, errorFactory) => {
|
|
|
46
66
|
};
|
|
47
67
|
export const randomLock = generator => {
|
|
48
68
|
const $generator = __typia.createRandom.generator;
|
|
49
|
-
const $pick = __typia.createRandom.pick;
|
|
50
69
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
51
|
-
time: (generator?.customs ?? $generator.customs)?.number?.([
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
time: (generator?.customs ?? $generator.customs)?.number?.([
|
|
71
|
+
{
|
|
72
|
+
name: "ExclusiveMinimum<0>",
|
|
73
|
+
kind: "exclusiveMinimum",
|
|
74
|
+
value: 0
|
|
75
|
+
}
|
|
76
|
+
]) ?? (generator?.number ?? $generator.number)(0, 10),
|
|
77
|
+
locations: (generator?.array ?? $generator.array)(() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
78
|
+
{
|
|
79
|
+
name: "MinLength<1>",
|
|
80
|
+
kind: "minLength",
|
|
81
|
+
value: 1
|
|
82
|
+
}
|
|
83
|
+
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(1, 25))),
|
|
84
|
+
zone: (generator?.customs ?? $generator.customs)?.string?.([
|
|
85
|
+
{
|
|
86
|
+
name: "MinLength<1>",
|
|
87
|
+
kind: "minLength",
|
|
88
|
+
value: 1
|
|
89
|
+
}
|
|
90
|
+
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(1, 25)),
|
|
91
|
+
replicas: (generator?.customs ?? $generator.customs)?.number?.([
|
|
92
|
+
{
|
|
93
|
+
name: "ExclusiveMinimum<0>",
|
|
94
|
+
kind: "exclusiveMinimum",
|
|
95
|
+
value: 0
|
|
96
|
+
}
|
|
97
|
+
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
60
98
|
});
|
|
61
99
|
return $ro0();
|
|
62
100
|
};
|
|
63
101
|
export const assertGuardLock = (input, errorFactory) => {
|
|
64
102
|
const __is = input => {
|
|
65
|
-
const $io0 = input => "number" === typeof input.time &&
|
|
103
|
+
const $io0 = input => "number" === typeof input.time && 0 < input.time && (Array.isArray(input.locations) && input.locations.every(elem => "string" === typeof elem && 1 <= elem.length)) && ("string" === typeof input.zone && 1 <= input.zone.length) && ("number" === typeof input.replicas && 0 < input.replicas);
|
|
66
104
|
return "object" === typeof input && null !== input && $io0(input);
|
|
67
105
|
};
|
|
68
106
|
if (false === __is(input))
|
|
69
107
|
((input, _path, _exceptionable = true) => {
|
|
70
108
|
const $guard = __typia.createAssertGuard.guard;
|
|
71
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.time || $guard(_exceptionable, {
|
|
109
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.time && (0 < input.time || $guard(_exceptionable, {
|
|
72
110
|
path: _path + ".time",
|
|
73
|
-
expected: "number",
|
|
111
|
+
expected: "number & ExclusiveMinimum<0>",
|
|
112
|
+
value: input.time
|
|
113
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
114
|
+
path: _path + ".time",
|
|
115
|
+
expected: "(number & ExclusiveMinimum<0>)",
|
|
74
116
|
value: input.time
|
|
75
|
-
}, errorFactory)) && (
|
|
117
|
+
}, errorFactory)) && ((Array.isArray(input.locations) || $guard(_exceptionable, {
|
|
76
118
|
path: _path + ".locations",
|
|
77
|
-
expected: "
|
|
119
|
+
expected: "Array<string & MinLength<1>>",
|
|
78
120
|
value: input.locations
|
|
79
|
-
}, errorFactory)) && input.locations.every((elem, _index1) => "string" === typeof elem || $guard(_exceptionable, {
|
|
121
|
+
}, errorFactory)) && input.locations.every((elem, _index1) => "string" === typeof elem && (1 <= elem.length || $guard(_exceptionable, {
|
|
80
122
|
path: _path + ".locations[" + _index1 + "]",
|
|
81
|
-
expected: "string",
|
|
123
|
+
expected: "string & MinLength<1>",
|
|
124
|
+
value: elem
|
|
125
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
126
|
+
path: _path + ".locations[" + _index1 + "]",
|
|
127
|
+
expected: "(string & MinLength<1>)",
|
|
82
128
|
value: elem
|
|
83
129
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
84
130
|
path: _path + ".locations",
|
|
85
|
-
expected: "
|
|
131
|
+
expected: "Array<string & MinLength<1>>",
|
|
86
132
|
value: input.locations
|
|
87
|
-
}, errorFactory)) && (
|
|
133
|
+
}, errorFactory)) && ("string" === typeof input.zone && (1 <= input.zone.length || $guard(_exceptionable, {
|
|
134
|
+
path: _path + ".zone",
|
|
135
|
+
expected: "string & MinLength<1>",
|
|
136
|
+
value: input.zone
|
|
137
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
138
|
+
path: _path + ".zone",
|
|
139
|
+
expected: "(string & MinLength<1>)",
|
|
140
|
+
value: input.zone
|
|
141
|
+
}, errorFactory)) && ("number" === typeof input.replicas && (0 < input.replicas || $guard(_exceptionable, {
|
|
88
142
|
path: _path + ".replicas",
|
|
89
|
-
expected: "
|
|
143
|
+
expected: "number & ExclusiveMinimum<0>",
|
|
144
|
+
value: input.replicas
|
|
145
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
146
|
+
path: _path + ".replicas",
|
|
147
|
+
expected: "(number & ExclusiveMinimum<0>)",
|
|
90
148
|
value: input.replicas
|
|
91
149
|
}, errorFactory));
|
|
92
150
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
@@ -102,36 +160,64 @@ export const assertGuardLock = (input, errorFactory) => {
|
|
|
102
160
|
};
|
|
103
161
|
export const stringifyLock = input => {
|
|
104
162
|
const $string = __typia.json.createStringify.string;
|
|
105
|
-
const $so0 = input => `{"time":${input.time},"locations":${
|
|
163
|
+
const $so0 = input => `{"time":${input.time},"locations":${`[${input.locations.map(elem => $string(elem)).join(",")}]`},"zone":${$string(input.zone)},"replicas":${input.replicas}}`;
|
|
106
164
|
return $so0(input);
|
|
107
165
|
};
|
|
108
166
|
export const assertStringifyLock = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
109
167
|
const __is = input => {
|
|
110
|
-
const $io0 = input => "number" === typeof input.time && !Number.isNaN(input.time) &&
|
|
168
|
+
const $io0 = input => "number" === typeof input.time && (!Number.isNaN(input.time) && 0 < input.time) && (Array.isArray(input.locations) && input.locations.every(elem => "string" === typeof elem && 1 <= elem.length)) && ("string" === typeof input.zone && 1 <= input.zone.length) && ("number" === typeof input.replicas && (!Number.isNaN(input.replicas) && 0 < input.replicas));
|
|
111
169
|
return "object" === typeof input && null !== input && $io0(input);
|
|
112
170
|
};
|
|
113
171
|
if (false === __is(input))
|
|
114
172
|
((input, _path, _exceptionable = true) => {
|
|
115
173
|
const $guard = __typia.json.createAssertStringify.guard;
|
|
116
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.time && !Number.isNaN(input.time) || $guard(_exceptionable, {
|
|
174
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.time && (!Number.isNaN(input.time) || $guard(_exceptionable, {
|
|
117
175
|
path: _path + ".time",
|
|
118
176
|
expected: "number",
|
|
119
177
|
value: input.time
|
|
120
|
-
}, errorFactory)) && (
|
|
178
|
+
}, errorFactory)) && (0 < input.time || $guard(_exceptionable, {
|
|
179
|
+
path: _path + ".time",
|
|
180
|
+
expected: "number & ExclusiveMinimum<0>",
|
|
181
|
+
value: input.time
|
|
182
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
183
|
+
path: _path + ".time",
|
|
184
|
+
expected: "(number & ExclusiveMinimum<0>)",
|
|
185
|
+
value: input.time
|
|
186
|
+
}, errorFactory)) && ((Array.isArray(input.locations) || $guard(_exceptionable, {
|
|
121
187
|
path: _path + ".locations",
|
|
122
|
-
expected: "
|
|
188
|
+
expected: "Array<string & MinLength<1>>",
|
|
123
189
|
value: input.locations
|
|
124
|
-
}, errorFactory)) && input.locations.every((elem, _index1) => "string" === typeof elem || $guard(_exceptionable, {
|
|
190
|
+
}, errorFactory)) && input.locations.every((elem, _index1) => "string" === typeof elem && (1 <= elem.length || $guard(_exceptionable, {
|
|
191
|
+
path: _path + ".locations[" + _index1 + "]",
|
|
192
|
+
expected: "string & MinLength<1>",
|
|
193
|
+
value: elem
|
|
194
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
125
195
|
path: _path + ".locations[" + _index1 + "]",
|
|
126
|
-
expected: "string",
|
|
196
|
+
expected: "(string & MinLength<1>)",
|
|
127
197
|
value: elem
|
|
128
198
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
129
199
|
path: _path + ".locations",
|
|
130
|
-
expected: "
|
|
200
|
+
expected: "Array<string & MinLength<1>>",
|
|
131
201
|
value: input.locations
|
|
132
|
-
}, errorFactory)) && (
|
|
202
|
+
}, errorFactory)) && ("string" === typeof input.zone && (1 <= input.zone.length || $guard(_exceptionable, {
|
|
203
|
+
path: _path + ".zone",
|
|
204
|
+
expected: "string & MinLength<1>",
|
|
205
|
+
value: input.zone
|
|
206
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
207
|
+
path: _path + ".zone",
|
|
208
|
+
expected: "(string & MinLength<1>)",
|
|
209
|
+
value: input.zone
|
|
210
|
+
}, errorFactory)) && ("number" === typeof input.replicas && (!Number.isNaN(input.replicas) || $guard(_exceptionable, {
|
|
211
|
+
path: _path + ".replicas",
|
|
212
|
+
expected: "number",
|
|
213
|
+
value: input.replicas
|
|
214
|
+
}, errorFactory)) && (0 < input.replicas || $guard(_exceptionable, {
|
|
215
|
+
path: _path + ".replicas",
|
|
216
|
+
expected: "number & ExclusiveMinimum<0>",
|
|
217
|
+
value: input.replicas
|
|
218
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
133
219
|
path: _path + ".replicas",
|
|
134
|
-
expected: "(
|
|
220
|
+
expected: "(number & ExclusiveMinimum<0>)",
|
|
135
221
|
value: input.replicas
|
|
136
222
|
}, errorFactory));
|
|
137
223
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
@@ -147,6 +233,6 @@ export const assertStringifyLock = (input, errorFactory) => { const assert = (in
|
|
|
147
233
|
return input;
|
|
148
234
|
}; const stringify = input => {
|
|
149
235
|
const $string = __typia.json.createAssertStringify.string;
|
|
150
|
-
const $so0 = input => `{"time":${input.time},"locations":${
|
|
236
|
+
const $so0 = input => `{"time":${input.time},"locations":${`[${input.locations.map(elem => $string(elem)).join(",")}]`},"zone":${$string(input.zone)},"replicas":${input.replicas}}`;
|
|
151
237
|
return $so0(input);
|
|
152
238
|
}; return stringify(assert(input, errorFactory)); };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "ts-patch install && typia patch",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"fast-json-stringify": "^5.16.0",
|
|
28
28
|
"mitata": "^0.1.11",
|
|
29
29
|
"rimraf": "^5.0.7",
|
|
30
|
+
"spark-md5": "^3.0.2",
|
|
30
31
|
"ts-node": "^10.9.2",
|
|
31
32
|
"ts-patch": "^3.1.2",
|
|
32
33
|
"typescript": "^5.4.5"
|