@nxtedition/types 1.6.0 → 1.6.2
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 +4 -13
- package/dist/common/block.js +148 -611
- package/dist/common/file.d.ts +8 -5
- package/dist/common/file.js +289 -177
- package/package.json +1 -1
package/dist/common/block.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import __typia from "typia";
|
|
2
2
|
export const isBlock = input => {
|
|
3
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
3
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
4
4
|
const $io1 = input => "string" === typeof input.message;
|
|
5
5
|
return "object" === typeof input && null !== input && $io0(input);
|
|
6
6
|
};
|
|
7
7
|
export const assertBlock = (input, errorFactory) => {
|
|
8
8
|
const __is = input => {
|
|
9
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
9
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
10
10
|
const $io1 = input => "string" === typeof input.message;
|
|
11
11
|
return "object" === typeof input && null !== input && $io0(input);
|
|
12
12
|
};
|
|
@@ -49,7 +49,7 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
49
49
|
path: _path + ".offset",
|
|
50
50
|
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
51
51
|
value: input.offset
|
|
52
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
52
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
53
53
|
path: _path + ".size",
|
|
54
54
|
expected: "number & Minimum<0>",
|
|
55
55
|
value: input.size
|
|
@@ -59,17 +59,17 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
59
59
|
value: input.size
|
|
60
60
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
61
61
|
path: _path + ".size",
|
|
62
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
62
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
63
63
|
value: input.size
|
|
64
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
64
|
+
}, errorFactory)) && (null === input.hash || "string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
65
65
|
path: _path + ".hash",
|
|
66
66
|
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
67
67
|
value: input.hash
|
|
68
68
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
69
69
|
path: _path + ".hash",
|
|
70
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
70
|
+
expected: "((string & Pattern<\"^([A-Fa-f0-9]{32})?$\">) | null)",
|
|
71
71
|
value: input.hash
|
|
72
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
72
|
+
}, errorFactory)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
73
73
|
path: _path + ".btime",
|
|
74
74
|
expected: "number & Minimum<0>",
|
|
75
75
|
value: input.btime
|
|
@@ -79,11 +79,11 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
79
79
|
value: input.btime
|
|
80
80
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
81
81
|
path: _path + ".btime",
|
|
82
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
82
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
83
83
|
value: input.btime
|
|
84
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
84
|
+
}, errorFactory)) && (null === input.path || "string" === typeof input.path || $guard(_exceptionable, {
|
|
85
85
|
path: _path + ".path",
|
|
86
|
-
expected: "string",
|
|
86
|
+
expected: "(null | string)",
|
|
87
87
|
value: input.path
|
|
88
88
|
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
89
89
|
path: _path + ".error",
|
|
@@ -156,38 +156,50 @@ export const randomBlock = generator => {
|
|
|
156
156
|
value: "uint64"
|
|
157
157
|
}
|
|
158
158
|
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
159
|
-
size:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
159
|
+
size: $pick([
|
|
160
|
+
() => null,
|
|
161
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
162
|
+
{
|
|
163
|
+
name: "Minimum<0>",
|
|
164
|
+
kind: "minimum",
|
|
165
|
+
value: 0
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "Type<\"uint64\">",
|
|
169
|
+
kind: "type",
|
|
170
|
+
value: "uint64"
|
|
171
|
+
}
|
|
172
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
173
|
+
])(),
|
|
174
|
+
hash: $pick([
|
|
175
|
+
() => null,
|
|
176
|
+
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
177
|
+
{
|
|
178
|
+
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
179
|
+
kind: "pattern",
|
|
180
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
181
|
+
}
|
|
182
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^([A-Fa-f0-9]{32})?$/)
|
|
183
|
+
])(),
|
|
184
|
+
btime: $pick([
|
|
185
|
+
() => null,
|
|
186
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
187
|
+
{
|
|
188
|
+
name: "Minimum<0>",
|
|
189
|
+
kind: "minimum",
|
|
190
|
+
value: 0
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "Type<\"uint64\">",
|
|
194
|
+
kind: "type",
|
|
195
|
+
value: "uint64"
|
|
196
|
+
}
|
|
197
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
198
|
+
])(),
|
|
199
|
+
path: $pick([
|
|
200
|
+
() => null,
|
|
201
|
+
() => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
202
|
+
])(),
|
|
191
203
|
error: $pick([
|
|
192
204
|
() => null,
|
|
193
205
|
() => (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth))
|
|
@@ -200,7 +212,7 @@ export const randomBlock = generator => {
|
|
|
200
212
|
};
|
|
201
213
|
export const assertGuardBlock = (input, errorFactory) => {
|
|
202
214
|
const __is = input => {
|
|
203
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
215
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
204
216
|
const $io1 = input => "string" === typeof input.message;
|
|
205
217
|
return "object" === typeof input && null !== input && $io0(input);
|
|
206
218
|
};
|
|
@@ -243,7 +255,7 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
243
255
|
path: _path + ".offset",
|
|
244
256
|
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
245
257
|
value: input.offset
|
|
246
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
258
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
247
259
|
path: _path + ".size",
|
|
248
260
|
expected: "number & Minimum<0>",
|
|
249
261
|
value: input.size
|
|
@@ -253,17 +265,17 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
253
265
|
value: input.size
|
|
254
266
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
255
267
|
path: _path + ".size",
|
|
256
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
268
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
257
269
|
value: input.size
|
|
258
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
270
|
+
}, errorFactory)) && (null === input.hash || "string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
259
271
|
path: _path + ".hash",
|
|
260
272
|
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
261
273
|
value: input.hash
|
|
262
274
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
263
275
|
path: _path + ".hash",
|
|
264
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
276
|
+
expected: "((string & Pattern<\"^([A-Fa-f0-9]{32})?$\">) | null)",
|
|
265
277
|
value: input.hash
|
|
266
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
278
|
+
}, errorFactory)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
267
279
|
path: _path + ".btime",
|
|
268
280
|
expected: "number & Minimum<0>",
|
|
269
281
|
value: input.btime
|
|
@@ -273,11 +285,11 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
273
285
|
value: input.btime
|
|
274
286
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
275
287
|
path: _path + ".btime",
|
|
276
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
288
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
277
289
|
value: input.btime
|
|
278
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
290
|
+
}, errorFactory)) && (null === input.path || "string" === typeof input.path || $guard(_exceptionable, {
|
|
279
291
|
path: _path + ".path",
|
|
280
|
-
expected: "string",
|
|
292
|
+
expected: "(null | string)",
|
|
281
293
|
value: input.path
|
|
282
294
|
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
283
295
|
path: _path + ".error",
|
|
@@ -315,12 +327,12 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
315
327
|
export const stringifyBlock = input => {
|
|
316
328
|
const $io1 = input => "string" === typeof input.message;
|
|
317
329
|
const $string = __typia.json.createStringify.string;
|
|
318
|
-
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${input.size},"hash":${$string(input.hash)},"btime":${input.btime},"path":${$string(input.path)},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
330
|
+
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${null !== input.size ? input.size : "null"},"hash":${null !== input.hash ? $string(input.hash) : "null"},"btime":${null !== input.btime ? input.btime : "null"},"path":${null !== input.path ? $string(input.path) : "null"},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
319
331
|
return $so0(input);
|
|
320
332
|
};
|
|
321
333
|
export const assertStringifyBlock = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
322
334
|
const __is = input => {
|
|
323
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
335
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
324
336
|
const $io1 = input => "string" === typeof input.message;
|
|
325
337
|
return "object" === typeof input && null !== input && $io0(input);
|
|
326
338
|
};
|
|
@@ -363,7 +375,7 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
363
375
|
path: _path + ".offset",
|
|
364
376
|
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
365
377
|
value: input.offset
|
|
366
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
378
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
367
379
|
path: _path + ".size",
|
|
368
380
|
expected: "number & Minimum<0>",
|
|
369
381
|
value: input.size
|
|
@@ -373,17 +385,17 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
373
385
|
value: input.size
|
|
374
386
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
375
387
|
path: _path + ".size",
|
|
376
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
388
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
377
389
|
value: input.size
|
|
378
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
390
|
+
}, errorFactory)) && (null === input.hash || "string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
379
391
|
path: _path + ".hash",
|
|
380
392
|
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
381
393
|
value: input.hash
|
|
382
394
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
383
395
|
path: _path + ".hash",
|
|
384
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
396
|
+
expected: "((string & Pattern<\"^([A-Fa-f0-9]{32})?$\">) | null)",
|
|
385
397
|
value: input.hash
|
|
386
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
398
|
+
}, errorFactory)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
387
399
|
path: _path + ".btime",
|
|
388
400
|
expected: "number & Minimum<0>",
|
|
389
401
|
value: input.btime
|
|
@@ -393,11 +405,11 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
393
405
|
value: input.btime
|
|
394
406
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
395
407
|
path: _path + ".btime",
|
|
396
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
408
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
397
409
|
value: input.btime
|
|
398
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
410
|
+
}, errorFactory)) && (null === input.path || "string" === typeof input.path || $guard(_exceptionable, {
|
|
399
411
|
path: _path + ".path",
|
|
400
|
-
expected: "string",
|
|
412
|
+
expected: "(null | string)",
|
|
401
413
|
value: input.path
|
|
402
414
|
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
403
415
|
path: _path + ".error",
|
|
@@ -435,504 +447,17 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
435
447
|
}; const stringify = input => {
|
|
436
448
|
const $io1 = input => "string" === typeof input.message;
|
|
437
449
|
const $string = __typia.json.createAssertStringify.string;
|
|
438
|
-
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${input.size},"hash":${$string(input.hash)},"btime":${input.btime},"path":${$string(input.path)},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
439
|
-
return $so0(input);
|
|
440
|
-
}; return stringify(assert(input, errorFactory)); };
|
|
441
|
-
export const isBlockStats = input => {
|
|
442
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
443
|
-
const $io1 = input => "string" === typeof input.message;
|
|
444
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
445
|
-
};
|
|
446
|
-
export const assertBlockStats = (input, errorFactory) => {
|
|
447
|
-
const __is = input => {
|
|
448
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
449
|
-
const $io1 = input => "string" === typeof input.message;
|
|
450
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
451
|
-
};
|
|
452
|
-
if (false === __is(input))
|
|
453
|
-
((input, _path, _exceptionable = true) => {
|
|
454
|
-
const $guard = __typia.createAssert.guard;
|
|
455
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
456
|
-
path: _path + ".position",
|
|
457
|
-
expected: "number & Minimum<0>",
|
|
458
|
-
value: input.position
|
|
459
|
-
}, errorFactory)) && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000 || $guard(_exceptionable, {
|
|
460
|
-
path: _path + ".position",
|
|
461
|
-
expected: "number & Type<\"uint64\">",
|
|
462
|
-
value: input.position
|
|
463
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
464
|
-
path: _path + ".position",
|
|
465
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
466
|
-
value: input.position
|
|
467
|
-
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
468
|
-
path: _path + ".id",
|
|
469
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
470
|
-
value: input.id
|
|
471
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
472
|
-
path: _path + ".id",
|
|
473
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
474
|
-
value: input.id
|
|
475
|
-
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
476
|
-
path: _path + ".file",
|
|
477
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
478
|
-
value: input.file
|
|
479
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
480
|
-
path: _path + ".file",
|
|
481
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
482
|
-
value: input.file
|
|
483
|
-
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
484
|
-
path: _path + ".location",
|
|
485
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
486
|
-
value: input.location
|
|
487
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
488
|
-
path: _path + ".location",
|
|
489
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
490
|
-
value: input.location
|
|
491
|
-
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
492
|
-
path: _path + ".offset",
|
|
493
|
-
expected: "number & Minimum<0>",
|
|
494
|
-
value: input.offset
|
|
495
|
-
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000 || $guard(_exceptionable, {
|
|
496
|
-
path: _path + ".offset",
|
|
497
|
-
expected: "number & Type<\"uint64\">",
|
|
498
|
-
value: input.offset
|
|
499
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
500
|
-
path: _path + ".offset",
|
|
501
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
502
|
-
value: input.offset
|
|
503
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
504
|
-
path: _path + ".size",
|
|
505
|
-
expected: "number & Minimum<0>",
|
|
506
|
-
value: input.size
|
|
507
|
-
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000 || $guard(_exceptionable, {
|
|
508
|
-
path: _path + ".size",
|
|
509
|
-
expected: "number & Type<\"uint64\">",
|
|
510
|
-
value: input.size
|
|
511
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
512
|
-
path: _path + ".size",
|
|
513
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
514
|
-
value: input.size
|
|
515
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
516
|
-
path: _path + ".hash",
|
|
517
|
-
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
518
|
-
value: input.hash
|
|
519
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
520
|
-
path: _path + ".hash",
|
|
521
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
522
|
-
value: input.hash
|
|
523
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
524
|
-
path: _path + ".btime",
|
|
525
|
-
expected: "number & Minimum<0>",
|
|
526
|
-
value: input.btime
|
|
527
|
-
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000 || $guard(_exceptionable, {
|
|
528
|
-
path: _path + ".btime",
|
|
529
|
-
expected: "number & Type<\"uint64\">",
|
|
530
|
-
value: input.btime
|
|
531
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
532
|
-
path: _path + ".btime",
|
|
533
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
534
|
-
value: input.btime
|
|
535
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
536
|
-
path: _path + ".path",
|
|
537
|
-
expected: "string",
|
|
538
|
-
value: input.path
|
|
539
|
-
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
540
|
-
path: _path + ".error",
|
|
541
|
-
expected: "(Array<__type> | null)",
|
|
542
|
-
value: input.error
|
|
543
|
-
}, errorFactory)) && input.error.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
544
|
-
path: _path + ".error[" + _index1 + "]",
|
|
545
|
-
expected: "__type",
|
|
546
|
-
value: elem
|
|
547
|
-
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
548
|
-
path: _path + ".error[" + _index1 + "]",
|
|
549
|
-
expected: "__type",
|
|
550
|
-
value: elem
|
|
551
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
552
|
-
path: _path + ".error",
|
|
553
|
-
expected: "(Array<__type> | null)",
|
|
554
|
-
value: input.error
|
|
555
|
-
}, errorFactory));
|
|
556
|
-
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
557
|
-
path: _path + ".message",
|
|
558
|
-
expected: "string",
|
|
559
|
-
value: input.message
|
|
560
|
-
}, errorFactory);
|
|
561
|
-
return ("object" === typeof input && null !== input || $guard(true, {
|
|
562
|
-
path: _path + "",
|
|
563
|
-
expected: "BlockStats",
|
|
564
|
-
value: input
|
|
565
|
-
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
566
|
-
path: _path + "",
|
|
567
|
-
expected: "BlockStats",
|
|
568
|
-
value: input
|
|
569
|
-
}, errorFactory);
|
|
570
|
-
})(input, "$input", true);
|
|
571
|
-
return input;
|
|
572
|
-
};
|
|
573
|
-
export const randomBlockStats = generator => {
|
|
574
|
-
const $generator = __typia.createRandom.generator;
|
|
575
|
-
const $pick = __typia.createRandom.pick;
|
|
576
|
-
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
577
|
-
position: (generator?.customs ?? $generator.customs)?.number?.([
|
|
578
|
-
{
|
|
579
|
-
name: "Minimum<0>",
|
|
580
|
-
kind: "minimum",
|
|
581
|
-
value: 0
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
name: "Type<\"uint64\">",
|
|
585
|
-
kind: "type",
|
|
586
|
-
value: "uint64"
|
|
587
|
-
}
|
|
588
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
589
|
-
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
590
|
-
{
|
|
591
|
-
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
592
|
-
kind: "pattern",
|
|
593
|
-
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
594
|
-
}
|
|
595
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
596
|
-
file: (generator?.customs ?? $generator.customs)?.string?.([
|
|
597
|
-
{
|
|
598
|
-
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
599
|
-
kind: "pattern",
|
|
600
|
-
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
601
|
-
}
|
|
602
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
603
|
-
location: (generator?.customs ?? $generator.customs)?.string?.([
|
|
604
|
-
{
|
|
605
|
-
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
606
|
-
kind: "pattern",
|
|
607
|
-
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
608
|
-
}
|
|
609
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
610
|
-
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
611
|
-
{
|
|
612
|
-
name: "Minimum<0>",
|
|
613
|
-
kind: "minimum",
|
|
614
|
-
value: 0
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
name: "Type<\"uint64\">",
|
|
618
|
-
kind: "type",
|
|
619
|
-
value: "uint64"
|
|
620
|
-
}
|
|
621
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
622
|
-
size: (generator?.customs ?? $generator.customs)?.number?.([
|
|
623
|
-
{
|
|
624
|
-
name: "Minimum<0>",
|
|
625
|
-
kind: "minimum",
|
|
626
|
-
value: 0
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
name: "Type<\"uint64\">",
|
|
630
|
-
kind: "type",
|
|
631
|
-
value: "uint64"
|
|
632
|
-
}
|
|
633
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
634
|
-
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
635
|
-
{
|
|
636
|
-
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
637
|
-
kind: "pattern",
|
|
638
|
-
value: "^([A-Fa-f0-9]{32})?$"
|
|
639
|
-
}
|
|
640
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^([A-Fa-f0-9]{32})?$/),
|
|
641
|
-
btime: (generator?.customs ?? $generator.customs)?.number?.([
|
|
642
|
-
{
|
|
643
|
-
name: "Minimum<0>",
|
|
644
|
-
kind: "minimum",
|
|
645
|
-
value: 0
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
name: "Type<\"uint64\">",
|
|
649
|
-
kind: "type",
|
|
650
|
-
value: "uint64"
|
|
651
|
-
}
|
|
652
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
653
|
-
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
654
|
-
error: $pick([
|
|
655
|
-
() => null,
|
|
656
|
-
() => (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth))
|
|
657
|
-
])()
|
|
658
|
-
});
|
|
659
|
-
const $ro1 = (_recursive = false, _depth = 0) => ({
|
|
660
|
-
message: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
661
|
-
});
|
|
662
|
-
return $ro0();
|
|
663
|
-
};
|
|
664
|
-
export const assertGuardBlockStats = (input, errorFactory) => {
|
|
665
|
-
const __is = input => {
|
|
666
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
667
|
-
const $io1 = input => "string" === typeof input.message;
|
|
668
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
669
|
-
};
|
|
670
|
-
if (false === __is(input))
|
|
671
|
-
((input, _path, _exceptionable = true) => {
|
|
672
|
-
const $guard = __typia.createAssertGuard.guard;
|
|
673
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
674
|
-
path: _path + ".position",
|
|
675
|
-
expected: "number & Minimum<0>",
|
|
676
|
-
value: input.position
|
|
677
|
-
}, errorFactory)) && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000 || $guard(_exceptionable, {
|
|
678
|
-
path: _path + ".position",
|
|
679
|
-
expected: "number & Type<\"uint64\">",
|
|
680
|
-
value: input.position
|
|
681
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
682
|
-
path: _path + ".position",
|
|
683
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
684
|
-
value: input.position
|
|
685
|
-
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
686
|
-
path: _path + ".id",
|
|
687
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
688
|
-
value: input.id
|
|
689
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
690
|
-
path: _path + ".id",
|
|
691
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
692
|
-
value: input.id
|
|
693
|
-
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
694
|
-
path: _path + ".file",
|
|
695
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
696
|
-
value: input.file
|
|
697
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
698
|
-
path: _path + ".file",
|
|
699
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
700
|
-
value: input.file
|
|
701
|
-
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
702
|
-
path: _path + ".location",
|
|
703
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
704
|
-
value: input.location
|
|
705
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
706
|
-
path: _path + ".location",
|
|
707
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
708
|
-
value: input.location
|
|
709
|
-
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
710
|
-
path: _path + ".offset",
|
|
711
|
-
expected: "number & Minimum<0>",
|
|
712
|
-
value: input.offset
|
|
713
|
-
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000 || $guard(_exceptionable, {
|
|
714
|
-
path: _path + ".offset",
|
|
715
|
-
expected: "number & Type<\"uint64\">",
|
|
716
|
-
value: input.offset
|
|
717
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
718
|
-
path: _path + ".offset",
|
|
719
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
720
|
-
value: input.offset
|
|
721
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
722
|
-
path: _path + ".size",
|
|
723
|
-
expected: "number & Minimum<0>",
|
|
724
|
-
value: input.size
|
|
725
|
-
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000 || $guard(_exceptionable, {
|
|
726
|
-
path: _path + ".size",
|
|
727
|
-
expected: "number & Type<\"uint64\">",
|
|
728
|
-
value: input.size
|
|
729
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
730
|
-
path: _path + ".size",
|
|
731
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
732
|
-
value: input.size
|
|
733
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
734
|
-
path: _path + ".hash",
|
|
735
|
-
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
736
|
-
value: input.hash
|
|
737
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
738
|
-
path: _path + ".hash",
|
|
739
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
740
|
-
value: input.hash
|
|
741
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
742
|
-
path: _path + ".btime",
|
|
743
|
-
expected: "number & Minimum<0>",
|
|
744
|
-
value: input.btime
|
|
745
|
-
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000 || $guard(_exceptionable, {
|
|
746
|
-
path: _path + ".btime",
|
|
747
|
-
expected: "number & Type<\"uint64\">",
|
|
748
|
-
value: input.btime
|
|
749
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
750
|
-
path: _path + ".btime",
|
|
751
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
752
|
-
value: input.btime
|
|
753
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
754
|
-
path: _path + ".path",
|
|
755
|
-
expected: "string",
|
|
756
|
-
value: input.path
|
|
757
|
-
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
758
|
-
path: _path + ".error",
|
|
759
|
-
expected: "(Array<__type> | null)",
|
|
760
|
-
value: input.error
|
|
761
|
-
}, errorFactory)) && input.error.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
762
|
-
path: _path + ".error[" + _index1 + "]",
|
|
763
|
-
expected: "__type",
|
|
764
|
-
value: elem
|
|
765
|
-
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
766
|
-
path: _path + ".error[" + _index1 + "]",
|
|
767
|
-
expected: "__type",
|
|
768
|
-
value: elem
|
|
769
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
770
|
-
path: _path + ".error",
|
|
771
|
-
expected: "(Array<__type> | null)",
|
|
772
|
-
value: input.error
|
|
773
|
-
}, errorFactory));
|
|
774
|
-
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
775
|
-
path: _path + ".message",
|
|
776
|
-
expected: "string",
|
|
777
|
-
value: input.message
|
|
778
|
-
}, errorFactory);
|
|
779
|
-
return ("object" === typeof input && null !== input || $guard(true, {
|
|
780
|
-
path: _path + "",
|
|
781
|
-
expected: "BlockStats",
|
|
782
|
-
value: input
|
|
783
|
-
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
784
|
-
path: _path + "",
|
|
785
|
-
expected: "BlockStats",
|
|
786
|
-
value: input
|
|
787
|
-
}, errorFactory);
|
|
788
|
-
})(input, "$input", true);
|
|
789
|
-
};
|
|
790
|
-
export const stringifyBlockStats = input => {
|
|
791
|
-
const $io1 = input => "string" === typeof input.message;
|
|
792
|
-
const $string = __typia.json.createStringify.string;
|
|
793
|
-
const $so0 = input => `{"position":${input.position},"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${input.size},"hash":${$string(input.hash)},"btime":${input.btime},"path":${$string(input.path)},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
794
|
-
return $so0(input);
|
|
795
|
-
};
|
|
796
|
-
export const assertStringifyBlockStats = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
797
|
-
const __is = input => {
|
|
798
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
799
|
-
const $io1 = input => "string" === typeof input.message;
|
|
800
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
801
|
-
};
|
|
802
|
-
if (false === __is(input))
|
|
803
|
-
((input, _path, _exceptionable = true) => {
|
|
804
|
-
const $guard = __typia.json.createAssertStringify.guard;
|
|
805
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
806
|
-
path: _path + ".position",
|
|
807
|
-
expected: "number & Minimum<0>",
|
|
808
|
-
value: input.position
|
|
809
|
-
}, errorFactory)) && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 18446744073709552000 || $guard(_exceptionable, {
|
|
810
|
-
path: _path + ".position",
|
|
811
|
-
expected: "number & Type<\"uint64\">",
|
|
812
|
-
value: input.position
|
|
813
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
814
|
-
path: _path + ".position",
|
|
815
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
816
|
-
value: input.position
|
|
817
|
-
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
818
|
-
path: _path + ".id",
|
|
819
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
820
|
-
value: input.id
|
|
821
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
822
|
-
path: _path + ".id",
|
|
823
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
824
|
-
value: input.id
|
|
825
|
-
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
826
|
-
path: _path + ".file",
|
|
827
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
828
|
-
value: input.file
|
|
829
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
830
|
-
path: _path + ".file",
|
|
831
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
832
|
-
value: input.file
|
|
833
|
-
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
834
|
-
path: _path + ".location",
|
|
835
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
836
|
-
value: input.location
|
|
837
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
838
|
-
path: _path + ".location",
|
|
839
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
840
|
-
value: input.location
|
|
841
|
-
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
842
|
-
path: _path + ".offset",
|
|
843
|
-
expected: "number & Minimum<0>",
|
|
844
|
-
value: input.offset
|
|
845
|
-
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000 || $guard(_exceptionable, {
|
|
846
|
-
path: _path + ".offset",
|
|
847
|
-
expected: "number & Type<\"uint64\">",
|
|
848
|
-
value: input.offset
|
|
849
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
850
|
-
path: _path + ".offset",
|
|
851
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
852
|
-
value: input.offset
|
|
853
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
854
|
-
path: _path + ".size",
|
|
855
|
-
expected: "number & Minimum<0>",
|
|
856
|
-
value: input.size
|
|
857
|
-
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000 || $guard(_exceptionable, {
|
|
858
|
-
path: _path + ".size",
|
|
859
|
-
expected: "number & Type<\"uint64\">",
|
|
860
|
-
value: input.size
|
|
861
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
862
|
-
path: _path + ".size",
|
|
863
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
864
|
-
value: input.size
|
|
865
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
866
|
-
path: _path + ".hash",
|
|
867
|
-
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
868
|
-
value: input.hash
|
|
869
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
870
|
-
path: _path + ".hash",
|
|
871
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
872
|
-
value: input.hash
|
|
873
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
874
|
-
path: _path + ".btime",
|
|
875
|
-
expected: "number & Minimum<0>",
|
|
876
|
-
value: input.btime
|
|
877
|
-
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000 || $guard(_exceptionable, {
|
|
878
|
-
path: _path + ".btime",
|
|
879
|
-
expected: "number & Type<\"uint64\">",
|
|
880
|
-
value: input.btime
|
|
881
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
882
|
-
path: _path + ".btime",
|
|
883
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
884
|
-
value: input.btime
|
|
885
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
886
|
-
path: _path + ".path",
|
|
887
|
-
expected: "string",
|
|
888
|
-
value: input.path
|
|
889
|
-
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
890
|
-
path: _path + ".error",
|
|
891
|
-
expected: "(Array<__type> | null)",
|
|
892
|
-
value: input.error
|
|
893
|
-
}, errorFactory)) && input.error.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
894
|
-
path: _path + ".error[" + _index1 + "]",
|
|
895
|
-
expected: "__type",
|
|
896
|
-
value: elem
|
|
897
|
-
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
898
|
-
path: _path + ".error[" + _index1 + "]",
|
|
899
|
-
expected: "__type",
|
|
900
|
-
value: elem
|
|
901
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
902
|
-
path: _path + ".error",
|
|
903
|
-
expected: "(Array<__type> | null)",
|
|
904
|
-
value: input.error
|
|
905
|
-
}, errorFactory));
|
|
906
|
-
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
907
|
-
path: _path + ".message",
|
|
908
|
-
expected: "string",
|
|
909
|
-
value: input.message
|
|
910
|
-
}, errorFactory);
|
|
911
|
-
return ("object" === typeof input && null !== input || $guard(true, {
|
|
912
|
-
path: _path + "",
|
|
913
|
-
expected: "BlockStats",
|
|
914
|
-
value: input
|
|
915
|
-
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
916
|
-
path: _path + "",
|
|
917
|
-
expected: "BlockStats",
|
|
918
|
-
value: input
|
|
919
|
-
}, errorFactory);
|
|
920
|
-
})(input, "$input", true);
|
|
921
|
-
return input;
|
|
922
|
-
}; const stringify = input => {
|
|
923
|
-
const $io1 = input => "string" === typeof input.message;
|
|
924
|
-
const $string = __typia.json.createAssertStringify.string;
|
|
925
|
-
const $so0 = input => `{"position":${input.position},"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${input.size},"hash":${$string(input.hash)},"btime":${input.btime},"path":${$string(input.path)},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
450
|
+
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${null !== input.size ? input.size : "null"},"hash":${null !== input.hash ? $string(input.hash) : "null"},"btime":${null !== input.btime ? input.btime : "null"},"path":${null !== input.path ? $string(input.path) : "null"},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
926
451
|
return $so0(input);
|
|
927
452
|
}; return stringify(assert(input, errorFactory)); };
|
|
928
453
|
export const isBlocks = input => {
|
|
929
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
454
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
930
455
|
const $io1 = input => "string" === typeof input.message;
|
|
931
456
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
932
457
|
};
|
|
933
458
|
export const assertBlocks = (input, errorFactory) => {
|
|
934
459
|
const __is = input => {
|
|
935
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
460
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
936
461
|
const $io1 = input => "string" === typeof input.message;
|
|
937
462
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
938
463
|
};
|
|
@@ -975,7 +500,7 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
975
500
|
path: _path + ".offset",
|
|
976
501
|
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
977
502
|
value: input.offset
|
|
978
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
503
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
979
504
|
path: _path + ".size",
|
|
980
505
|
expected: "number & Minimum<0>",
|
|
981
506
|
value: input.size
|
|
@@ -985,17 +510,17 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
985
510
|
value: input.size
|
|
986
511
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
987
512
|
path: _path + ".size",
|
|
988
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
513
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
989
514
|
value: input.size
|
|
990
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
515
|
+
}, errorFactory)) && (null === input.hash || "string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
991
516
|
path: _path + ".hash",
|
|
992
517
|
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
993
518
|
value: input.hash
|
|
994
519
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
995
520
|
path: _path + ".hash",
|
|
996
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
521
|
+
expected: "((string & Pattern<\"^([A-Fa-f0-9]{32})?$\">) | null)",
|
|
997
522
|
value: input.hash
|
|
998
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
523
|
+
}, errorFactory)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
999
524
|
path: _path + ".btime",
|
|
1000
525
|
expected: "number & Minimum<0>",
|
|
1001
526
|
value: input.btime
|
|
@@ -1005,11 +530,11 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
1005
530
|
value: input.btime
|
|
1006
531
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1007
532
|
path: _path + ".btime",
|
|
1008
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
533
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
1009
534
|
value: input.btime
|
|
1010
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
535
|
+
}, errorFactory)) && (null === input.path || "string" === typeof input.path || $guard(_exceptionable, {
|
|
1011
536
|
path: _path + ".path",
|
|
1012
|
-
expected: "string",
|
|
537
|
+
expected: "(null | string)",
|
|
1013
538
|
value: input.path
|
|
1014
539
|
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1015
540
|
path: _path + ".error",
|
|
@@ -1090,38 +615,50 @@ export const randomBlocks = generator => {
|
|
|
1090
615
|
value: "uint64"
|
|
1091
616
|
}
|
|
1092
617
|
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
1093
|
-
size:
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
618
|
+
size: $pick([
|
|
619
|
+
() => null,
|
|
620
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
621
|
+
{
|
|
622
|
+
name: "Minimum<0>",
|
|
623
|
+
kind: "minimum",
|
|
624
|
+
value: 0
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
name: "Type<\"uint64\">",
|
|
628
|
+
kind: "type",
|
|
629
|
+
value: "uint64"
|
|
630
|
+
}
|
|
631
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
632
|
+
])(),
|
|
633
|
+
hash: $pick([
|
|
634
|
+
() => null,
|
|
635
|
+
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
636
|
+
{
|
|
637
|
+
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
638
|
+
kind: "pattern",
|
|
639
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
640
|
+
}
|
|
641
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^([A-Fa-f0-9]{32})?$/)
|
|
642
|
+
])(),
|
|
643
|
+
btime: $pick([
|
|
644
|
+
() => null,
|
|
645
|
+
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
646
|
+
{
|
|
647
|
+
name: "Minimum<0>",
|
|
648
|
+
kind: "minimum",
|
|
649
|
+
value: 0
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: "Type<\"uint64\">",
|
|
653
|
+
kind: "type",
|
|
654
|
+
value: "uint64"
|
|
655
|
+
}
|
|
656
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
657
|
+
])(),
|
|
658
|
+
path: $pick([
|
|
659
|
+
() => null,
|
|
660
|
+
() => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
661
|
+
])(),
|
|
1125
662
|
error: $pick([
|
|
1126
663
|
() => null,
|
|
1127
664
|
() => (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth))
|
|
@@ -1134,7 +671,7 @@ export const randomBlocks = generator => {
|
|
|
1134
671
|
};
|
|
1135
672
|
export const assertGuardBlocks = (input, errorFactory) => {
|
|
1136
673
|
const __is = input => {
|
|
1137
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
674
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
1138
675
|
const $io1 = input => "string" === typeof input.message;
|
|
1139
676
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
1140
677
|
};
|
|
@@ -1177,7 +714,7 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1177
714
|
path: _path + ".offset",
|
|
1178
715
|
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
1179
716
|
value: input.offset
|
|
1180
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
717
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
1181
718
|
path: _path + ".size",
|
|
1182
719
|
expected: "number & Minimum<0>",
|
|
1183
720
|
value: input.size
|
|
@@ -1187,17 +724,17 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1187
724
|
value: input.size
|
|
1188
725
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1189
726
|
path: _path + ".size",
|
|
1190
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
727
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
1191
728
|
value: input.size
|
|
1192
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
729
|
+
}, errorFactory)) && (null === input.hash || "string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
1193
730
|
path: _path + ".hash",
|
|
1194
731
|
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
1195
732
|
value: input.hash
|
|
1196
733
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1197
734
|
path: _path + ".hash",
|
|
1198
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
735
|
+
expected: "((string & Pattern<\"^([A-Fa-f0-9]{32})?$\">) | null)",
|
|
1199
736
|
value: input.hash
|
|
1200
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
737
|
+
}, errorFactory)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
1201
738
|
path: _path + ".btime",
|
|
1202
739
|
expected: "number & Minimum<0>",
|
|
1203
740
|
value: input.btime
|
|
@@ -1207,11 +744,11 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1207
744
|
value: input.btime
|
|
1208
745
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1209
746
|
path: _path + ".btime",
|
|
1210
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
747
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
1211
748
|
value: input.btime
|
|
1212
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
749
|
+
}, errorFactory)) && (null === input.path || "string" === typeof input.path || $guard(_exceptionable, {
|
|
1213
750
|
path: _path + ".path",
|
|
1214
|
-
expected: "string",
|
|
751
|
+
expected: "(null | string)",
|
|
1215
752
|
value: input.path
|
|
1216
753
|
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1217
754
|
path: _path + ".error",
|
|
@@ -1257,12 +794,12 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1257
794
|
export const stringifyBlocks = input => {
|
|
1258
795
|
const $io1 = input => "string" === typeof input.message;
|
|
1259
796
|
const $string = __typia.json.createStringify.string;
|
|
1260
|
-
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${input.size},"hash":${$string(input.hash)},"btime":${input.btime},"path":${$string(input.path)},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
797
|
+
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${null !== input.size ? input.size : "null"},"hash":${null !== input.hash ? $string(input.hash) : "null"},"btime":${null !== input.btime ? input.btime : "null"},"path":${null !== input.path ? $string(input.path) : "null"},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
1261
798
|
return `[${input.map(elem => $so0(elem)).join(",")}]`;
|
|
1262
799
|
};
|
|
1263
800
|
export const assertStringifyBlocks = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
1264
801
|
const __is = input => {
|
|
1265
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && ("string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && ("number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
802
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("string" === typeof input.file && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file)) && ("string" === typeof input.location && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location)) && ("number" === typeof input.offset && (0 <= input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 18446744073709552000))) && (null === input.size || "number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 18446744073709552000))) && (null === input.hash || "string" === typeof input.hash && /^([A-Fa-f0-9]{32})?$/.test(input.hash)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 18446744073709552000))) && (null === input.path || "string" === typeof input.path) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
1266
803
|
const $io1 = input => "string" === typeof input.message;
|
|
1267
804
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
1268
805
|
};
|
|
@@ -1305,7 +842,7 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1305
842
|
path: _path + ".offset",
|
|
1306
843
|
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
1307
844
|
value: input.offset
|
|
1308
|
-
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
845
|
+
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
1309
846
|
path: _path + ".size",
|
|
1310
847
|
expected: "number & Minimum<0>",
|
|
1311
848
|
value: input.size
|
|
@@ -1315,17 +852,17 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1315
852
|
value: input.size
|
|
1316
853
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1317
854
|
path: _path + ".size",
|
|
1318
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
855
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
1319
856
|
value: input.size
|
|
1320
|
-
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
857
|
+
}, errorFactory)) && (null === input.hash || "string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
1321
858
|
path: _path + ".hash",
|
|
1322
859
|
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
1323
860
|
value: input.hash
|
|
1324
861
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1325
862
|
path: _path + ".hash",
|
|
1326
|
-
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
863
|
+
expected: "((string & Pattern<\"^([A-Fa-f0-9]{32})?$\">) | null)",
|
|
1327
864
|
value: input.hash
|
|
1328
|
-
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
865
|
+
}, errorFactory)) && (null === input.btime || "number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
1329
866
|
path: _path + ".btime",
|
|
1330
867
|
expected: "number & Minimum<0>",
|
|
1331
868
|
value: input.btime
|
|
@@ -1335,11 +872,11 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1335
872
|
value: input.btime
|
|
1336
873
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1337
874
|
path: _path + ".btime",
|
|
1338
|
-
expected: "(number & Minimum<0> & Type<\"uint64\">)",
|
|
875
|
+
expected: "((number & Minimum<0> & Type<\"uint64\">) | null)",
|
|
1339
876
|
value: input.btime
|
|
1340
|
-
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
877
|
+
}, errorFactory)) && (null === input.path || "string" === typeof input.path || $guard(_exceptionable, {
|
|
1341
878
|
path: _path + ".path",
|
|
1342
|
-
expected: "string",
|
|
879
|
+
expected: "(null | string)",
|
|
1343
880
|
value: input.path
|
|
1344
881
|
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1345
882
|
path: _path + ".error",
|
|
@@ -1385,6 +922,6 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1385
922
|
}; const stringify = input => {
|
|
1386
923
|
const $io1 = input => "string" === typeof input.message;
|
|
1387
924
|
const $string = __typia.json.createAssertStringify.string;
|
|
1388
|
-
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${input.size},"hash":${$string(input.hash)},"btime":${input.btime},"path":${$string(input.path)},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
925
|
+
const $so0 = input => `{"id":${$string(input.id)},"file":${$string(input.file)},"location":${$string(input.location)},"offset":${input.offset},"size":${null !== input.size ? input.size : "null"},"hash":${null !== input.hash ? $string(input.hash) : "null"},"btime":${null !== input.btime ? input.btime : "null"},"path":${null !== input.path ? $string(input.path) : "null"},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"}}`;
|
|
1389
926
|
return `[${input.map(elem => $so0(elem)).join(",")}]`;
|
|
1390
927
|
}; return stringify(assert(input, errorFactory)); };
|