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