@nxtedition/types 1.0.0 → 1.2.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 +3 -0
- package/dist/common/index.js +3 -0
- package/dist/common/location.d.ts +20 -0
- package/dist/common/location.js +268 -0
- package/dist/common/lock.d.ts +5 -3
- package/dist/common/lock.js +128 -42
- package/dist/common/rule.d.ts +15 -0
- package/dist/common/rule.js +255 -0
- package/package.json +2 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type AssertionGuard as __AssertionGuard } from "typia";
|
|
2
|
+
export interface Location {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string | null;
|
|
5
|
+
size: number | null;
|
|
6
|
+
free: number | null;
|
|
7
|
+
capcity: number | null;
|
|
8
|
+
available: number | null;
|
|
9
|
+
cache: boolean | null;
|
|
10
|
+
limit: number;
|
|
11
|
+
origin: string;
|
|
12
|
+
zone: string;
|
|
13
|
+
allows: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare const isLocation: (input: unknown) => input is Location;
|
|
16
|
+
export declare const assertLocation: (input: unknown) => Location;
|
|
17
|
+
export declare const randomLocation: () => Location;
|
|
18
|
+
export declare const assertGuardLocation: __AssertionGuard<Location>;
|
|
19
|
+
export declare const stringifyLocation: (input: Location) => string;
|
|
20
|
+
export declare const assertStringifyLocation: (input: unknown) => string;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import __typia from "typia";
|
|
2
|
+
export const isLocation = input => {
|
|
3
|
+
const $io0 = input => "string" === typeof input.id && (null === input.title || "string" === typeof input.title) && (null === input.size || "number" === typeof input.size) && (null === input.free || "number" === typeof input.free) && (null === input.capcity || "number" === typeof input.capcity) && (null === input.available || "number" === typeof input.available) && (null === input.cache || "boolean" === typeof input.cache) && "number" === typeof input.limit && "string" === typeof input.origin && "string" === typeof input.zone && (Array.isArray(input.allows) && input.allows.every(elem => "string" === typeof elem));
|
|
4
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
5
|
+
};
|
|
6
|
+
export const assertLocation = (input, errorFactory) => {
|
|
7
|
+
const __is = input => {
|
|
8
|
+
const $io0 = input => "string" === typeof input.id && (null === input.title || "string" === typeof input.title) && (null === input.size || "number" === typeof input.size) && (null === input.free || "number" === typeof input.free) && (null === input.capcity || "number" === typeof input.capcity) && (null === input.available || "number" === typeof input.available) && (null === input.cache || "boolean" === typeof input.cache) && "number" === typeof input.limit && "string" === typeof input.origin && "string" === typeof input.zone && (Array.isArray(input.allows) && input.allows.every(elem => "string" === typeof elem));
|
|
9
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
10
|
+
};
|
|
11
|
+
if (false === __is(input))
|
|
12
|
+
((input, _path, _exceptionable = true) => {
|
|
13
|
+
const $guard = __typia.createAssert.guard;
|
|
14
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || $guard(_exceptionable, {
|
|
15
|
+
path: _path + ".id",
|
|
16
|
+
expected: "string",
|
|
17
|
+
value: input.id
|
|
18
|
+
}, errorFactory)) && (null === input.title || "string" === typeof input.title || $guard(_exceptionable, {
|
|
19
|
+
path: _path + ".title",
|
|
20
|
+
expected: "(null | string)",
|
|
21
|
+
value: input.title
|
|
22
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size || $guard(_exceptionable, {
|
|
23
|
+
path: _path + ".size",
|
|
24
|
+
expected: "(null | number)",
|
|
25
|
+
value: input.size
|
|
26
|
+
}, errorFactory)) && (null === input.free || "number" === typeof input.free || $guard(_exceptionable, {
|
|
27
|
+
path: _path + ".free",
|
|
28
|
+
expected: "(null | number)",
|
|
29
|
+
value: input.free
|
|
30
|
+
}, errorFactory)) && (null === input.capcity || "number" === typeof input.capcity || $guard(_exceptionable, {
|
|
31
|
+
path: _path + ".capcity",
|
|
32
|
+
expected: "(null | number)",
|
|
33
|
+
value: input.capcity
|
|
34
|
+
}, errorFactory)) && (null === input.available || "number" === typeof input.available || $guard(_exceptionable, {
|
|
35
|
+
path: _path + ".available",
|
|
36
|
+
expected: "(null | number)",
|
|
37
|
+
value: input.available
|
|
38
|
+
}, errorFactory)) && (null === input.cache || "boolean" === typeof input.cache || $guard(_exceptionable, {
|
|
39
|
+
path: _path + ".cache",
|
|
40
|
+
expected: "(boolean | null)",
|
|
41
|
+
value: input.cache
|
|
42
|
+
}, errorFactory)) && ("number" === typeof input.limit || $guard(_exceptionable, {
|
|
43
|
+
path: _path + ".limit",
|
|
44
|
+
expected: "number",
|
|
45
|
+
value: input.limit
|
|
46
|
+
}, errorFactory)) && ("string" === typeof input.origin || $guard(_exceptionable, {
|
|
47
|
+
path: _path + ".origin",
|
|
48
|
+
expected: "string",
|
|
49
|
+
value: input.origin
|
|
50
|
+
}, errorFactory)) && ("string" === typeof input.zone || $guard(_exceptionable, {
|
|
51
|
+
path: _path + ".zone",
|
|
52
|
+
expected: "string",
|
|
53
|
+
value: input.zone
|
|
54
|
+
}, errorFactory)) && ((Array.isArray(input.allows) || $guard(_exceptionable, {
|
|
55
|
+
path: _path + ".allows",
|
|
56
|
+
expected: "Array<string>",
|
|
57
|
+
value: input.allows
|
|
58
|
+
}, errorFactory)) && input.allows.every((elem, _index1) => "string" === typeof elem || $guard(_exceptionable, {
|
|
59
|
+
path: _path + ".allows[" + _index1 + "]",
|
|
60
|
+
expected: "string",
|
|
61
|
+
value: elem
|
|
62
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
63
|
+
path: _path + ".allows",
|
|
64
|
+
expected: "Array<string>",
|
|
65
|
+
value: input.allows
|
|
66
|
+
}, errorFactory));
|
|
67
|
+
return ("object" === typeof input && null !== input || $guard(true, {
|
|
68
|
+
path: _path + "",
|
|
69
|
+
expected: "Location",
|
|
70
|
+
value: input
|
|
71
|
+
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
72
|
+
path: _path + "",
|
|
73
|
+
expected: "Location",
|
|
74
|
+
value: input
|
|
75
|
+
}, errorFactory);
|
|
76
|
+
})(input, "$input", true);
|
|
77
|
+
return input;
|
|
78
|
+
};
|
|
79
|
+
export const randomLocation = generator => {
|
|
80
|
+
const $generator = __typia.createRandom.generator;
|
|
81
|
+
const $pick = __typia.createRandom.pick;
|
|
82
|
+
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
83
|
+
id: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
84
|
+
title: $pick([
|
|
85
|
+
() => null,
|
|
86
|
+
() => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
87
|
+
])(),
|
|
88
|
+
size: $pick([
|
|
89
|
+
() => null,
|
|
90
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
|
|
91
|
+
])(),
|
|
92
|
+
free: $pick([
|
|
93
|
+
() => null,
|
|
94
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
|
|
95
|
+
])(),
|
|
96
|
+
capcity: $pick([
|
|
97
|
+
() => null,
|
|
98
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
|
|
99
|
+
])(),
|
|
100
|
+
available: $pick([
|
|
101
|
+
() => null,
|
|
102
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
|
|
103
|
+
])(),
|
|
104
|
+
cache: $pick([
|
|
105
|
+
() => null,
|
|
106
|
+
() => (generator?.boolean ?? $generator.boolean)()
|
|
107
|
+
])(),
|
|
108
|
+
limit: (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100),
|
|
109
|
+
origin: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
110
|
+
zone: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
111
|
+
allows: (generator?.array ?? $generator.array)(() => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)())
|
|
112
|
+
});
|
|
113
|
+
return $ro0();
|
|
114
|
+
};
|
|
115
|
+
export const assertGuardLocation = (input, errorFactory) => {
|
|
116
|
+
const __is = input => {
|
|
117
|
+
const $io0 = input => "string" === typeof input.id && (null === input.title || "string" === typeof input.title) && (null === input.size || "number" === typeof input.size) && (null === input.free || "number" === typeof input.free) && (null === input.capcity || "number" === typeof input.capcity) && (null === input.available || "number" === typeof input.available) && (null === input.cache || "boolean" === typeof input.cache) && "number" === typeof input.limit && "string" === typeof input.origin && "string" === typeof input.zone && (Array.isArray(input.allows) && input.allows.every(elem => "string" === typeof elem));
|
|
118
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
119
|
+
};
|
|
120
|
+
if (false === __is(input))
|
|
121
|
+
((input, _path, _exceptionable = true) => {
|
|
122
|
+
const $guard = __typia.createAssertGuard.guard;
|
|
123
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || $guard(_exceptionable, {
|
|
124
|
+
path: _path + ".id",
|
|
125
|
+
expected: "string",
|
|
126
|
+
value: input.id
|
|
127
|
+
}, errorFactory)) && (null === input.title || "string" === typeof input.title || $guard(_exceptionable, {
|
|
128
|
+
path: _path + ".title",
|
|
129
|
+
expected: "(null | string)",
|
|
130
|
+
value: input.title
|
|
131
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size || $guard(_exceptionable, {
|
|
132
|
+
path: _path + ".size",
|
|
133
|
+
expected: "(null | number)",
|
|
134
|
+
value: input.size
|
|
135
|
+
}, errorFactory)) && (null === input.free || "number" === typeof input.free || $guard(_exceptionable, {
|
|
136
|
+
path: _path + ".free",
|
|
137
|
+
expected: "(null | number)",
|
|
138
|
+
value: input.free
|
|
139
|
+
}, errorFactory)) && (null === input.capcity || "number" === typeof input.capcity || $guard(_exceptionable, {
|
|
140
|
+
path: _path + ".capcity",
|
|
141
|
+
expected: "(null | number)",
|
|
142
|
+
value: input.capcity
|
|
143
|
+
}, errorFactory)) && (null === input.available || "number" === typeof input.available || $guard(_exceptionable, {
|
|
144
|
+
path: _path + ".available",
|
|
145
|
+
expected: "(null | number)",
|
|
146
|
+
value: input.available
|
|
147
|
+
}, errorFactory)) && (null === input.cache || "boolean" === typeof input.cache || $guard(_exceptionable, {
|
|
148
|
+
path: _path + ".cache",
|
|
149
|
+
expected: "(boolean | null)",
|
|
150
|
+
value: input.cache
|
|
151
|
+
}, errorFactory)) && ("number" === typeof input.limit || $guard(_exceptionable, {
|
|
152
|
+
path: _path + ".limit",
|
|
153
|
+
expected: "number",
|
|
154
|
+
value: input.limit
|
|
155
|
+
}, errorFactory)) && ("string" === typeof input.origin || $guard(_exceptionable, {
|
|
156
|
+
path: _path + ".origin",
|
|
157
|
+
expected: "string",
|
|
158
|
+
value: input.origin
|
|
159
|
+
}, errorFactory)) && ("string" === typeof input.zone || $guard(_exceptionable, {
|
|
160
|
+
path: _path + ".zone",
|
|
161
|
+
expected: "string",
|
|
162
|
+
value: input.zone
|
|
163
|
+
}, errorFactory)) && ((Array.isArray(input.allows) || $guard(_exceptionable, {
|
|
164
|
+
path: _path + ".allows",
|
|
165
|
+
expected: "Array<string>",
|
|
166
|
+
value: input.allows
|
|
167
|
+
}, errorFactory)) && input.allows.every((elem, _index1) => "string" === typeof elem || $guard(_exceptionable, {
|
|
168
|
+
path: _path + ".allows[" + _index1 + "]",
|
|
169
|
+
expected: "string",
|
|
170
|
+
value: elem
|
|
171
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
172
|
+
path: _path + ".allows",
|
|
173
|
+
expected: "Array<string>",
|
|
174
|
+
value: input.allows
|
|
175
|
+
}, errorFactory));
|
|
176
|
+
return ("object" === typeof input && null !== input || $guard(true, {
|
|
177
|
+
path: _path + "",
|
|
178
|
+
expected: "Location",
|
|
179
|
+
value: input
|
|
180
|
+
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
181
|
+
path: _path + "",
|
|
182
|
+
expected: "Location",
|
|
183
|
+
value: input
|
|
184
|
+
}, errorFactory);
|
|
185
|
+
})(input, "$input", true);
|
|
186
|
+
};
|
|
187
|
+
export const stringifyLocation = input => {
|
|
188
|
+
const $string = __typia.json.createStringify.string;
|
|
189
|
+
const $so0 = input => `{"id":${$string(input.id)},"title":${null !== input.title ? $string(input.title) : "null"},"size":${null !== input.size ? input.size : "null"},"free":${null !== input.free ? input.free : "null"},"capcity":${null !== input.capcity ? input.capcity : "null"},"available":${null !== input.available ? input.available : "null"},"cache":${null !== input.cache ? input.cache : "null"},"limit":${input.limit},"origin":${$string(input.origin)},"zone":${$string(input.zone)},"allows":${`[${input.allows.map(elem => $string(elem)).join(",")}]`}}`;
|
|
190
|
+
return $so0(input);
|
|
191
|
+
};
|
|
192
|
+
export const assertStringifyLocation = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
193
|
+
const __is = input => {
|
|
194
|
+
const $io0 = input => "string" === typeof input.id && (null === input.title || "string" === typeof input.title) && (null === input.size || "number" === typeof input.size && !Number.isNaN(input.size)) && (null === input.free || "number" === typeof input.free && !Number.isNaN(input.free)) && (null === input.capcity || "number" === typeof input.capcity && !Number.isNaN(input.capcity)) && (null === input.available || "number" === typeof input.available && !Number.isNaN(input.available)) && (null === input.cache || "boolean" === typeof input.cache) && ("number" === typeof input.limit && !Number.isNaN(input.limit)) && "string" === typeof input.origin && "string" === typeof input.zone && (Array.isArray(input.allows) && input.allows.every(elem => "string" === typeof elem));
|
|
195
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
196
|
+
};
|
|
197
|
+
if (false === __is(input))
|
|
198
|
+
((input, _path, _exceptionable = true) => {
|
|
199
|
+
const $guard = __typia.json.createAssertStringify.guard;
|
|
200
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id || $guard(_exceptionable, {
|
|
201
|
+
path: _path + ".id",
|
|
202
|
+
expected: "string",
|
|
203
|
+
value: input.id
|
|
204
|
+
}, errorFactory)) && (null === input.title || "string" === typeof input.title || $guard(_exceptionable, {
|
|
205
|
+
path: _path + ".title",
|
|
206
|
+
expected: "(null | string)",
|
|
207
|
+
value: input.title
|
|
208
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && !Number.isNaN(input.size) || $guard(_exceptionable, {
|
|
209
|
+
path: _path + ".size",
|
|
210
|
+
expected: "(null | number)",
|
|
211
|
+
value: input.size
|
|
212
|
+
}, errorFactory)) && (null === input.free || "number" === typeof input.free && !Number.isNaN(input.free) || $guard(_exceptionable, {
|
|
213
|
+
path: _path + ".free",
|
|
214
|
+
expected: "(null | number)",
|
|
215
|
+
value: input.free
|
|
216
|
+
}, errorFactory)) && (null === input.capcity || "number" === typeof input.capcity && !Number.isNaN(input.capcity) || $guard(_exceptionable, {
|
|
217
|
+
path: _path + ".capcity",
|
|
218
|
+
expected: "(null | number)",
|
|
219
|
+
value: input.capcity
|
|
220
|
+
}, errorFactory)) && (null === input.available || "number" === typeof input.available && !Number.isNaN(input.available) || $guard(_exceptionable, {
|
|
221
|
+
path: _path + ".available",
|
|
222
|
+
expected: "(null | number)",
|
|
223
|
+
value: input.available
|
|
224
|
+
}, errorFactory)) && (null === input.cache || "boolean" === typeof input.cache || $guard(_exceptionable, {
|
|
225
|
+
path: _path + ".cache",
|
|
226
|
+
expected: "(boolean | null)",
|
|
227
|
+
value: input.cache
|
|
228
|
+
}, errorFactory)) && ("number" === typeof input.limit && !Number.isNaN(input.limit) || $guard(_exceptionable, {
|
|
229
|
+
path: _path + ".limit",
|
|
230
|
+
expected: "number",
|
|
231
|
+
value: input.limit
|
|
232
|
+
}, errorFactory)) && ("string" === typeof input.origin || $guard(_exceptionable, {
|
|
233
|
+
path: _path + ".origin",
|
|
234
|
+
expected: "string",
|
|
235
|
+
value: input.origin
|
|
236
|
+
}, errorFactory)) && ("string" === typeof input.zone || $guard(_exceptionable, {
|
|
237
|
+
path: _path + ".zone",
|
|
238
|
+
expected: "string",
|
|
239
|
+
value: input.zone
|
|
240
|
+
}, errorFactory)) && ((Array.isArray(input.allows) || $guard(_exceptionable, {
|
|
241
|
+
path: _path + ".allows",
|
|
242
|
+
expected: "Array<string>",
|
|
243
|
+
value: input.allows
|
|
244
|
+
}, errorFactory)) && input.allows.every((elem, _index1) => "string" === typeof elem || $guard(_exceptionable, {
|
|
245
|
+
path: _path + ".allows[" + _index1 + "]",
|
|
246
|
+
expected: "string",
|
|
247
|
+
value: elem
|
|
248
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
249
|
+
path: _path + ".allows",
|
|
250
|
+
expected: "Array<string>",
|
|
251
|
+
value: input.allows
|
|
252
|
+
}, errorFactory));
|
|
253
|
+
return ("object" === typeof input && null !== input || $guard(true, {
|
|
254
|
+
path: _path + "",
|
|
255
|
+
expected: "Location",
|
|
256
|
+
value: input
|
|
257
|
+
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
258
|
+
path: _path + "",
|
|
259
|
+
expected: "Location",
|
|
260
|
+
value: input
|
|
261
|
+
}, errorFactory);
|
|
262
|
+
})(input, "$input", true);
|
|
263
|
+
return input;
|
|
264
|
+
}; const stringify = input => {
|
|
265
|
+
const $string = __typia.json.createAssertStringify.string;
|
|
266
|
+
const $so0 = input => `{"id":${$string(input.id)},"title":${null !== input.title ? $string(input.title) : "null"},"size":${null !== input.size ? input.size : "null"},"free":${null !== input.free ? input.free : "null"},"capcity":${null !== input.capcity ? input.capcity : "null"},"available":${null !== input.available ? input.available : "null"},"cache":${null !== input.cache ? input.cache : "null"},"limit":${input.limit},"origin":${$string(input.origin)},"zone":${$string(input.zone)},"allows":${`[${input.allows.map(elem => $string(elem)).join(",")}]`}}`;
|
|
267
|
+
return $so0(input);
|
|
268
|
+
}; return stringify(assert(input, errorFactory)); };
|
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)); };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type AssertionGuard as __AssertionGuard } from "typia";
|
|
2
|
+
import { tags } from 'typia';
|
|
3
|
+
export interface Rule {
|
|
4
|
+
locations: string[];
|
|
5
|
+
replicas: number & tags.Type<"uint32">;
|
|
6
|
+
priority: number & tags.Type<"uint32">;
|
|
7
|
+
includes: string[];
|
|
8
|
+
excludes: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const isRule: (input: unknown) => input is Rule;
|
|
11
|
+
export declare const assertRule: (input: unknown) => Rule;
|
|
12
|
+
export declare const randomRule: () => Rule;
|
|
13
|
+
export declare const assertGuardRule: __AssertionGuard<Rule>;
|
|
14
|
+
export declare const stringifyRule: (input: Rule) => string;
|
|
15
|
+
export declare const assertStringifyRule: (input: unknown) => string;
|