@nxtedition/types 1.2.4 → 1.2.5
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 +3 -0
- package/dist/common/block.js +266 -21
- package/dist/common/file.d.ts +1 -1
- package/dist/common/file.js +38 -32
- package/package.json +1 -1
package/dist/common/block.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export interface Block {
|
|
|
9
9
|
hash: string & tags.Pattern<"^([A-Fa-f0-9]{32})?$">;
|
|
10
10
|
btime: number & tags.Minimum<0> & tags.Type<"uint32">;
|
|
11
11
|
path: string;
|
|
12
|
+
error: Array<{
|
|
13
|
+
message: string;
|
|
14
|
+
}> | null;
|
|
12
15
|
}
|
|
13
16
|
export declare const isBlock: (input: unknown) => input is Block;
|
|
14
17
|
export declare const assertBlock: (input: unknown) => Block;
|
package/dist/common/block.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import __typia from "typia";
|
|
2
2
|
export const isBlock = input => {
|
|
3
|
-
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
4
|
+
const $io1 = input => "string" === typeof input.message;
|
|
5
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
4
6
|
};
|
|
5
7
|
export const assertBlock = (input, errorFactory) => {
|
|
6
8
|
const __is = input => {
|
|
7
|
-
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
10
|
+
const $io1 = input => "string" === typeof input.message;
|
|
11
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
8
12
|
};
|
|
9
13
|
if (false === __is(input))
|
|
10
14
|
((input, _path, _exceptionable = true) => {
|
|
@@ -81,7 +85,28 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
81
85
|
path: _path + ".path",
|
|
82
86
|
expected: "string",
|
|
83
87
|
value: input.path
|
|
88
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
89
|
+
path: _path + ".error",
|
|
90
|
+
expected: "(Array<__type> | null)",
|
|
91
|
+
value: input.error
|
|
92
|
+
}, errorFactory)) && input.error.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
93
|
+
path: _path + ".error[" + _index1 + "]",
|
|
94
|
+
expected: "__type",
|
|
95
|
+
value: elem
|
|
96
|
+
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
97
|
+
path: _path + ".error[" + _index1 + "]",
|
|
98
|
+
expected: "__type",
|
|
99
|
+
value: elem
|
|
100
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
101
|
+
path: _path + ".error",
|
|
102
|
+
expected: "(Array<__type> | null)",
|
|
103
|
+
value: input.error
|
|
84
104
|
}, errorFactory));
|
|
105
|
+
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
106
|
+
path: _path + ".message",
|
|
107
|
+
expected: "string",
|
|
108
|
+
value: input.message
|
|
109
|
+
}, errorFactory);
|
|
85
110
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
86
111
|
path: _path + "",
|
|
87
112
|
expected: "Block",
|
|
@@ -96,6 +121,7 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
96
121
|
};
|
|
97
122
|
export const randomBlock = generator => {
|
|
98
123
|
const $generator = __typia.createRandom.generator;
|
|
124
|
+
const $pick = __typia.createRandom.pick;
|
|
99
125
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
100
126
|
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
101
127
|
{
|
|
@@ -161,13 +187,22 @@ export const randomBlock = generator => {
|
|
|
161
187
|
value: "uint32"
|
|
162
188
|
}
|
|
163
189
|
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
164
|
-
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
190
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
191
|
+
error: $pick([
|
|
192
|
+
() => null,
|
|
193
|
+
() => (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth))
|
|
194
|
+
])()
|
|
195
|
+
});
|
|
196
|
+
const $ro1 = (_recursive = false, _depth = 0) => ({
|
|
197
|
+
message: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
165
198
|
});
|
|
166
199
|
return $ro0();
|
|
167
200
|
};
|
|
168
201
|
export const assertGuardBlock = (input, errorFactory) => {
|
|
169
202
|
const __is = input => {
|
|
170
|
-
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
204
|
+
const $io1 = input => "string" === typeof input.message;
|
|
205
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
171
206
|
};
|
|
172
207
|
if (false === __is(input))
|
|
173
208
|
((input, _path, _exceptionable = true) => {
|
|
@@ -244,7 +279,28 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
244
279
|
path: _path + ".path",
|
|
245
280
|
expected: "string",
|
|
246
281
|
value: input.path
|
|
282
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
283
|
+
path: _path + ".error",
|
|
284
|
+
expected: "(Array<__type> | null)",
|
|
285
|
+
value: input.error
|
|
286
|
+
}, errorFactory)) && input.error.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
287
|
+
path: _path + ".error[" + _index1 + "]",
|
|
288
|
+
expected: "__type",
|
|
289
|
+
value: elem
|
|
290
|
+
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
291
|
+
path: _path + ".error[" + _index1 + "]",
|
|
292
|
+
expected: "__type",
|
|
293
|
+
value: elem
|
|
294
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
295
|
+
path: _path + ".error",
|
|
296
|
+
expected: "(Array<__type> | null)",
|
|
297
|
+
value: input.error
|
|
247
298
|
}, errorFactory));
|
|
299
|
+
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
300
|
+
path: _path + ".message",
|
|
301
|
+
expected: "string",
|
|
302
|
+
value: input.message
|
|
303
|
+
}, errorFactory);
|
|
248
304
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
249
305
|
path: _path + "",
|
|
250
306
|
expected: "Block",
|
|
@@ -257,12 +313,16 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
257
313
|
})(input, "$input", true);
|
|
258
314
|
};
|
|
259
315
|
export const stringifyBlock = input => {
|
|
316
|
+
const $io1 = input => "string" === typeof input.message;
|
|
260
317
|
const $string = __typia.json.createStringify.string;
|
|
261
|
-
|
|
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"}}`;
|
|
319
|
+
return $so0(input);
|
|
262
320
|
};
|
|
263
321
|
export const assertStringifyBlock = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
264
322
|
const __is = input => {
|
|
265
|
-
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
324
|
+
const $io1 = input => "string" === typeof input.message;
|
|
325
|
+
return "object" === typeof input && null !== input && $io0(input);
|
|
266
326
|
};
|
|
267
327
|
if (false === __is(input))
|
|
268
328
|
((input, _path, _exceptionable = true) => {
|
|
@@ -339,7 +399,28 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
339
399
|
path: _path + ".path",
|
|
340
400
|
expected: "string",
|
|
341
401
|
value: input.path
|
|
402
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
403
|
+
path: _path + ".error",
|
|
404
|
+
expected: "(Array<__type> | null)",
|
|
405
|
+
value: input.error
|
|
406
|
+
}, errorFactory)) && input.error.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
407
|
+
path: _path + ".error[" + _index1 + "]",
|
|
408
|
+
expected: "__type",
|
|
409
|
+
value: elem
|
|
410
|
+
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
411
|
+
path: _path + ".error[" + _index1 + "]",
|
|
412
|
+
expected: "__type",
|
|
413
|
+
value: elem
|
|
414
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
415
|
+
path: _path + ".error",
|
|
416
|
+
expected: "(Array<__type> | null)",
|
|
417
|
+
value: input.error
|
|
342
418
|
}, errorFactory));
|
|
419
|
+
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
420
|
+
path: _path + ".message",
|
|
421
|
+
expected: "string",
|
|
422
|
+
value: input.message
|
|
423
|
+
}, errorFactory);
|
|
343
424
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
344
425
|
path: _path + "",
|
|
345
426
|
expected: "Block",
|
|
@@ -352,15 +433,21 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
352
433
|
})(input, "$input", true);
|
|
353
434
|
return input;
|
|
354
435
|
}; const stringify = input => {
|
|
436
|
+
const $io1 = input => "string" === typeof input.message;
|
|
355
437
|
const $string = __typia.json.createAssertStringify.string;
|
|
356
|
-
|
|
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);
|
|
357
440
|
}; return stringify(assert(input, errorFactory)); };
|
|
358
441
|
export const isBlockStats = input => {
|
|
359
|
-
|
|
442
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && ("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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "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);
|
|
360
445
|
};
|
|
361
446
|
export const assertBlockStats = (input, errorFactory) => {
|
|
362
447
|
const __is = input => {
|
|
363
|
-
|
|
448
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && ("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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "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);
|
|
364
451
|
};
|
|
365
452
|
if (false === __is(input))
|
|
366
453
|
((input, _path, _exceptionable = true) => {
|
|
@@ -449,7 +536,28 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
449
536
|
path: _path + ".path",
|
|
450
537
|
expected: "string",
|
|
451
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
|
|
452
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);
|
|
453
561
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
454
562
|
path: _path + "",
|
|
455
563
|
expected: "BlockStats",
|
|
@@ -464,6 +572,7 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
464
572
|
};
|
|
465
573
|
export const randomBlockStats = generator => {
|
|
466
574
|
const $generator = __typia.createRandom.generator;
|
|
575
|
+
const $pick = __typia.createRandom.pick;
|
|
467
576
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
468
577
|
position: (generator?.customs ?? $generator.customs)?.number?.([
|
|
469
578
|
{
|
|
@@ -541,13 +650,22 @@ export const randomBlockStats = generator => {
|
|
|
541
650
|
value: "uint32"
|
|
542
651
|
}
|
|
543
652
|
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
544
|
-
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
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)()
|
|
545
661
|
});
|
|
546
662
|
return $ro0();
|
|
547
663
|
};
|
|
548
664
|
export const assertGuardBlockStats = (input, errorFactory) => {
|
|
549
665
|
const __is = input => {
|
|
550
|
-
|
|
666
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && ("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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "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);
|
|
551
669
|
};
|
|
552
670
|
if (false === __is(input))
|
|
553
671
|
((input, _path, _exceptionable = true) => {
|
|
@@ -636,7 +754,28 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
636
754
|
path: _path + ".path",
|
|
637
755
|
expected: "string",
|
|
638
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
|
|
639
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);
|
|
640
779
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
641
780
|
path: _path + "",
|
|
642
781
|
expected: "BlockStats",
|
|
@@ -649,12 +788,16 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
649
788
|
})(input, "$input", true);
|
|
650
789
|
};
|
|
651
790
|
export const stringifyBlockStats = input => {
|
|
791
|
+
const $io1 = input => "string" === typeof input.message;
|
|
652
792
|
const $string = __typia.json.createStringify.string;
|
|
653
|
-
|
|
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);
|
|
654
795
|
};
|
|
655
796
|
export const assertStringifyBlockStats = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
656
797
|
const __is = input => {
|
|
657
|
-
|
|
798
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && ("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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "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);
|
|
658
801
|
};
|
|
659
802
|
if (false === __is(input))
|
|
660
803
|
((input, _path, _exceptionable = true) => {
|
|
@@ -743,7 +886,28 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
743
886
|
path: _path + ".path",
|
|
744
887
|
expected: "string",
|
|
745
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
|
|
746
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);
|
|
747
911
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
748
912
|
path: _path + "",
|
|
749
913
|
expected: "BlockStats",
|
|
@@ -756,16 +920,20 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
756
920
|
})(input, "$input", true);
|
|
757
921
|
return input;
|
|
758
922
|
}; const stringify = input => {
|
|
923
|
+
const $io1 = input => "string" === typeof input.message;
|
|
759
924
|
const $string = __typia.json.createAssertStringify.string;
|
|
760
|
-
|
|
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"}}`;
|
|
926
|
+
return $so0(input);
|
|
761
927
|
}; return stringify(assert(input, errorFactory)); };
|
|
762
928
|
export const isBlocks = input => {
|
|
763
|
-
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path;
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
930
|
+
const $io1 = input => "string" === typeof input.message;
|
|
764
931
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
765
932
|
};
|
|
766
933
|
export const assertBlocks = (input, errorFactory) => {
|
|
767
934
|
const __is = input => {
|
|
768
|
-
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path;
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
936
|
+
const $io1 = input => "string" === typeof input.message;
|
|
769
937
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
770
938
|
};
|
|
771
939
|
if (false === __is(input))
|
|
@@ -843,7 +1011,28 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
843
1011
|
path: _path + ".path",
|
|
844
1012
|
expected: "string",
|
|
845
1013
|
value: input.path
|
|
1014
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1015
|
+
path: _path + ".error",
|
|
1016
|
+
expected: "(Array<__type> | null)",
|
|
1017
|
+
value: input.error
|
|
1018
|
+
}, errorFactory)) && input.error.every((elem, _index2) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
1019
|
+
path: _path + ".error[" + _index2 + "]",
|
|
1020
|
+
expected: "__type",
|
|
1021
|
+
value: elem
|
|
1022
|
+
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index2 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
1023
|
+
path: _path + ".error[" + _index2 + "]",
|
|
1024
|
+
expected: "__type",
|
|
1025
|
+
value: elem
|
|
1026
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
1027
|
+
path: _path + ".error",
|
|
1028
|
+
expected: "(Array<__type> | null)",
|
|
1029
|
+
value: input.error
|
|
846
1030
|
}, errorFactory));
|
|
1031
|
+
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
1032
|
+
path: _path + ".message",
|
|
1033
|
+
expected: "string",
|
|
1034
|
+
value: input.message
|
|
1035
|
+
}, errorFactory);
|
|
847
1036
|
return (Array.isArray(input) || $guard(true, {
|
|
848
1037
|
path: _path + "",
|
|
849
1038
|
expected: "Blocks",
|
|
@@ -866,6 +1055,7 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
866
1055
|
};
|
|
867
1056
|
export const randomBlocks = generator => {
|
|
868
1057
|
const $generator = __typia.createRandom.generator;
|
|
1058
|
+
const $pick = __typia.createRandom.pick;
|
|
869
1059
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
870
1060
|
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
871
1061
|
{
|
|
@@ -931,13 +1121,21 @@ export const randomBlocks = generator => {
|
|
|
931
1121
|
value: "uint32"
|
|
932
1122
|
}
|
|
933
1123
|
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
934
|
-
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
1124
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
1125
|
+
error: $pick([
|
|
1126
|
+
() => null,
|
|
1127
|
+
() => (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth))
|
|
1128
|
+
])()
|
|
1129
|
+
});
|
|
1130
|
+
const $ro1 = (_recursive = false, _depth = 0) => ({
|
|
1131
|
+
message: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
935
1132
|
});
|
|
936
1133
|
return (generator?.array ?? $generator.array)(() => $ro0());
|
|
937
1134
|
};
|
|
938
1135
|
export const assertGuardBlocks = (input, errorFactory) => {
|
|
939
1136
|
const __is = input => {
|
|
940
|
-
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path;
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
1138
|
+
const $io1 = input => "string" === typeof input.message;
|
|
941
1139
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
942
1140
|
};
|
|
943
1141
|
if (false === __is(input))
|
|
@@ -1015,7 +1213,28 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1015
1213
|
path: _path + ".path",
|
|
1016
1214
|
expected: "string",
|
|
1017
1215
|
value: input.path
|
|
1216
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1217
|
+
path: _path + ".error",
|
|
1218
|
+
expected: "(Array<__type> | null)",
|
|
1219
|
+
value: input.error
|
|
1220
|
+
}, errorFactory)) && input.error.every((elem, _index2) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
1221
|
+
path: _path + ".error[" + _index2 + "]",
|
|
1222
|
+
expected: "__type",
|
|
1223
|
+
value: elem
|
|
1224
|
+
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index2 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
1225
|
+
path: _path + ".error[" + _index2 + "]",
|
|
1226
|
+
expected: "__type",
|
|
1227
|
+
value: elem
|
|
1228
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
1229
|
+
path: _path + ".error",
|
|
1230
|
+
expected: "(Array<__type> | null)",
|
|
1231
|
+
value: input.error
|
|
1018
1232
|
}, errorFactory));
|
|
1233
|
+
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
1234
|
+
path: _path + ".message",
|
|
1235
|
+
expected: "string",
|
|
1236
|
+
value: input.message
|
|
1237
|
+
}, errorFactory);
|
|
1019
1238
|
return (Array.isArray(input) || $guard(true, {
|
|
1020
1239
|
path: _path + "",
|
|
1021
1240
|
expected: "Blocks",
|
|
@@ -1036,12 +1255,15 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1036
1255
|
})(input, "$input", true);
|
|
1037
1256
|
};
|
|
1038
1257
|
export const stringifyBlocks = input => {
|
|
1258
|
+
const $io1 = input => "string" === typeof input.message;
|
|
1039
1259
|
const $string = __typia.json.createStringify.string;
|
|
1040
|
-
|
|
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"}}`;
|
|
1261
|
+
return `[${input.map(elem => $so0(elem)).join(",")}]`;
|
|
1041
1262
|
};
|
|
1042
1263
|
export const assertStringifyBlocks = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
1043
1264
|
const __is = input => {
|
|
1044
|
-
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path;
|
|
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 <= 4294967295))) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && ("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 <= 4294967295))) && "string" === typeof input.path && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io1(elem)));
|
|
1266
|
+
const $io1 = input => "string" === typeof input.message;
|
|
1045
1267
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
1046
1268
|
};
|
|
1047
1269
|
if (false === __is(input))
|
|
@@ -1119,7 +1341,28 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1119
1341
|
path: _path + ".path",
|
|
1120
1342
|
expected: "string",
|
|
1121
1343
|
value: input.path
|
|
1344
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1345
|
+
path: _path + ".error",
|
|
1346
|
+
expected: "(Array<__type> | null)",
|
|
1347
|
+
value: input.error
|
|
1348
|
+
}, errorFactory)) && input.error.every((elem, _index2) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
1349
|
+
path: _path + ".error[" + _index2 + "]",
|
|
1350
|
+
expected: "__type",
|
|
1351
|
+
value: elem
|
|
1352
|
+
}, errorFactory)) && $ao1(elem, _path + ".error[" + _index2 + "]", true && _exceptionable) || $guard(_exceptionable, {
|
|
1353
|
+
path: _path + ".error[" + _index2 + "]",
|
|
1354
|
+
expected: "__type",
|
|
1355
|
+
value: elem
|
|
1356
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
1357
|
+
path: _path + ".error",
|
|
1358
|
+
expected: "(Array<__type> | null)",
|
|
1359
|
+
value: input.error
|
|
1122
1360
|
}, errorFactory));
|
|
1361
|
+
const $ao1 = (input, _path, _exceptionable = true) => "string" === typeof input.message || $guard(_exceptionable, {
|
|
1362
|
+
path: _path + ".message",
|
|
1363
|
+
expected: "string",
|
|
1364
|
+
value: input.message
|
|
1365
|
+
}, errorFactory);
|
|
1123
1366
|
return (Array.isArray(input) || $guard(true, {
|
|
1124
1367
|
path: _path + "",
|
|
1125
1368
|
expected: "Blocks",
|
|
@@ -1140,6 +1383,8 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1140
1383
|
})(input, "$input", true);
|
|
1141
1384
|
return input;
|
|
1142
1385
|
}; const stringify = input => {
|
|
1386
|
+
const $io1 = input => "string" === typeof input.message;
|
|
1143
1387
|
const $string = __typia.json.createAssertStringify.string;
|
|
1144
|
-
|
|
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"}}`;
|
|
1389
|
+
return `[${input.map(elem => $so0(elem)).join(",")}]`;
|
|
1145
1390
|
}; return stringify(assert(input, errorFactory)); };
|
package/dist/common/file.d.ts
CHANGED
package/dist/common/file.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import __typia from "typia";
|
|
2
2
|
export const isFile = input => {
|
|
3
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
3
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
4
4
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
5
5
|
const $io2 = input => "string" === typeof input.message;
|
|
6
6
|
return "object" === typeof input && null !== input && $io0(input);
|
|
7
7
|
};
|
|
8
8
|
export const assertFile = (input, errorFactory) => {
|
|
9
9
|
const __is = input => {
|
|
10
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
10
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
11
11
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
12
12
|
const $io2 = input => "string" === typeof input.message;
|
|
13
13
|
return "object" === typeof input && null !== input && $io0(input);
|
|
@@ -71,9 +71,9 @@ export const assertFile = (input, errorFactory) => {
|
|
|
71
71
|
path: _path + ".tags",
|
|
72
72
|
expected: "Array<string>",
|
|
73
73
|
value: input.tags
|
|
74
|
-
}, errorFactory)) && ((Array.isArray(input.error) || $guard(_exceptionable, {
|
|
74
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
75
75
|
path: _path + ".error",
|
|
76
|
-
expected: "Array<__type>.o1",
|
|
76
|
+
expected: "(Array<__type>.o1 | null)",
|
|
77
77
|
value: input.error
|
|
78
78
|
}, errorFactory)) && input.error.every((elem, _index3) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
79
79
|
path: _path + ".error[" + _index3 + "]",
|
|
@@ -85,7 +85,7 @@ export const assertFile = (input, errorFactory) => {
|
|
|
85
85
|
value: elem
|
|
86
86
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
87
87
|
path: _path + ".error",
|
|
88
|
-
expected: "Array<__type>.o1",
|
|
88
|
+
expected: "(Array<__type>.o1 | null)",
|
|
89
89
|
value: input.error
|
|
90
90
|
}, errorFactory)) && ("string" === typeof input.resumable || $guard(_exceptionable, {
|
|
91
91
|
path: _path + ".resumable",
|
|
@@ -165,7 +165,10 @@ export const randomFile = generator => {
|
|
|
165
165
|
deleted: (generator?.boolean ?? $generator.boolean)(),
|
|
166
166
|
refs: (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth)),
|
|
167
167
|
tags: (generator?.array ?? $generator.array)(() => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()),
|
|
168
|
-
error:
|
|
168
|
+
error: $pick([
|
|
169
|
+
() => null,
|
|
170
|
+
() => (generator?.array ?? $generator.array)(() => $ro2(_recursive, _recursive ? 1 + _depth : _depth))
|
|
171
|
+
])(),
|
|
169
172
|
resumable: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
170
173
|
mimeType: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
171
174
|
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
@@ -201,7 +204,7 @@ export const randomFile = generator => {
|
|
|
201
204
|
};
|
|
202
205
|
export const assertGuardFile = (input, errorFactory) => {
|
|
203
206
|
const __is = input => {
|
|
204
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
207
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
205
208
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
206
209
|
const $io2 = input => "string" === typeof input.message;
|
|
207
210
|
return "object" === typeof input && null !== input && $io0(input);
|
|
@@ -265,9 +268,9 @@ export const assertGuardFile = (input, errorFactory) => {
|
|
|
265
268
|
path: _path + ".tags",
|
|
266
269
|
expected: "Array<string>",
|
|
267
270
|
value: input.tags
|
|
268
|
-
}, errorFactory)) && ((Array.isArray(input.error) || $guard(_exceptionable, {
|
|
271
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
269
272
|
path: _path + ".error",
|
|
270
|
-
expected: "Array<__type>.o1",
|
|
273
|
+
expected: "(Array<__type>.o1 | null)",
|
|
271
274
|
value: input.error
|
|
272
275
|
}, errorFactory)) && input.error.every((elem, _index3) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
273
276
|
path: _path + ".error[" + _index3 + "]",
|
|
@@ -279,7 +282,7 @@ export const assertGuardFile = (input, errorFactory) => {
|
|
|
279
282
|
value: elem
|
|
280
283
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
281
284
|
path: _path + ".error",
|
|
282
|
-
expected: "Array<__type>.o1",
|
|
285
|
+
expected: "(Array<__type>.o1 | null)",
|
|
283
286
|
value: input.error
|
|
284
287
|
}, errorFactory)) && ("string" === typeof input.resumable || $guard(_exceptionable, {
|
|
285
288
|
path: _path + ".resumable",
|
|
@@ -336,13 +339,13 @@ export const stringifyFile = input => {
|
|
|
336
339
|
const $io2 = input => "string" === typeof input.message;
|
|
337
340
|
const $string = __typia.json.createStringify.string;
|
|
338
341
|
const $tail = __typia.json.createStringify.tail;
|
|
339
|
-
const $so0 = input => `{"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${`[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]`},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
342
|
+
const $so0 = input => `{"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
340
343
|
const $so1 = input => `{${$tail(`${undefined === input.file ? "" : `"file":${undefined !== input.file ? $string(input.file) : undefined}`}`)}}`;
|
|
341
344
|
return $so0(input);
|
|
342
345
|
};
|
|
343
346
|
export const assertStringifyFile = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
344
347
|
const __is = input => {
|
|
345
|
-
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
348
|
+
const $io0 = input => "string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
346
349
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
347
350
|
const $io2 = input => "string" === typeof input.message;
|
|
348
351
|
return "object" === typeof input && null !== input && $io0(input);
|
|
@@ -406,9 +409,9 @@ export const assertStringifyFile = (input, errorFactory) => { const assert = (in
|
|
|
406
409
|
path: _path + ".tags",
|
|
407
410
|
expected: "Array<string>",
|
|
408
411
|
value: input.tags
|
|
409
|
-
}, errorFactory)) && ((Array.isArray(input.error) || $guard(_exceptionable, {
|
|
412
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
410
413
|
path: _path + ".error",
|
|
411
|
-
expected: "Array<__type>.o1",
|
|
414
|
+
expected: "(Array<__type>.o1 | null)",
|
|
412
415
|
value: input.error
|
|
413
416
|
}, errorFactory)) && input.error.every((elem, _index3) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
414
417
|
path: _path + ".error[" + _index3 + "]",
|
|
@@ -420,7 +423,7 @@ export const assertStringifyFile = (input, errorFactory) => { const assert = (in
|
|
|
420
423
|
value: elem
|
|
421
424
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
422
425
|
path: _path + ".error",
|
|
423
|
-
expected: "Array<__type>.o1",
|
|
426
|
+
expected: "(Array<__type>.o1 | null)",
|
|
424
427
|
value: input.error
|
|
425
428
|
}, errorFactory)) && ("string" === typeof input.resumable || $guard(_exceptionable, {
|
|
426
429
|
path: _path + ".resumable",
|
|
@@ -477,19 +480,19 @@ export const assertStringifyFile = (input, errorFactory) => { const assert = (in
|
|
|
477
480
|
const $io2 = input => "string" === typeof input.message;
|
|
478
481
|
const $string = __typia.json.createAssertStringify.string;
|
|
479
482
|
const $tail = __typia.json.createAssertStringify.tail;
|
|
480
|
-
const $so0 = input => `{"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${`[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]`},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
483
|
+
const $so0 = input => `{"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
481
484
|
const $so1 = input => `{${$tail(`${undefined === input.file ? "" : `"file":${undefined !== input.file ? $string(input.file) : undefined}`}`)}}`;
|
|
482
485
|
return $so0(input);
|
|
483
486
|
}; return stringify(assert(input, errorFactory)); };
|
|
484
487
|
export const isFileStats = input => {
|
|
485
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
488
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
486
489
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
487
490
|
const $io2 = input => "string" === typeof input.message;
|
|
488
491
|
return "object" === typeof input && null !== input && $io0(input);
|
|
489
492
|
};
|
|
490
493
|
export const assertFileStats = (input, errorFactory) => {
|
|
491
494
|
const __is = input => {
|
|
492
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
495
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
493
496
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
494
497
|
const $io2 = input => "string" === typeof input.message;
|
|
495
498
|
return "object" === typeof input && null !== input && $io0(input);
|
|
@@ -597,9 +600,9 @@ export const assertFileStats = (input, errorFactory) => {
|
|
|
597
600
|
path: _path + ".tags",
|
|
598
601
|
expected: "Array<string>",
|
|
599
602
|
value: input.tags
|
|
600
|
-
}, errorFactory)) && ((Array.isArray(input.error) || $guard(_exceptionable, {
|
|
603
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
601
604
|
path: _path + ".error",
|
|
602
|
-
expected: "Array<__type>.o1",
|
|
605
|
+
expected: "(Array<__type>.o1 | null)",
|
|
603
606
|
value: input.error
|
|
604
607
|
}, errorFactory)) && input.error.every((elem, _index5) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
605
608
|
path: _path + ".error[" + _index5 + "]",
|
|
@@ -611,7 +614,7 @@ export const assertFileStats = (input, errorFactory) => {
|
|
|
611
614
|
value: elem
|
|
612
615
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
613
616
|
path: _path + ".error",
|
|
614
|
-
expected: "Array<__type>.o1",
|
|
617
|
+
expected: "(Array<__type>.o1 | null)",
|
|
615
618
|
value: input.error
|
|
616
619
|
}, errorFactory)) && ("string" === typeof input.resumable || $guard(_exceptionable, {
|
|
617
620
|
path: _path + ".resumable",
|
|
@@ -707,7 +710,10 @@ export const randomFileStats = generator => {
|
|
|
707
710
|
deleted: (generator?.boolean ?? $generator.boolean)(),
|
|
708
711
|
refs: (generator?.array ?? $generator.array)(() => $ro1(_recursive, _recursive ? 1 + _depth : _depth)),
|
|
709
712
|
tags: (generator?.array ?? $generator.array)(() => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()),
|
|
710
|
-
error:
|
|
713
|
+
error: $pick([
|
|
714
|
+
() => null,
|
|
715
|
+
() => (generator?.array ?? $generator.array)(() => $ro2(_recursive, _recursive ? 1 + _depth : _depth))
|
|
716
|
+
])(),
|
|
711
717
|
resumable: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
712
718
|
mimeType: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
|
|
713
719
|
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
@@ -743,7 +749,7 @@ export const randomFileStats = generator => {
|
|
|
743
749
|
};
|
|
744
750
|
export const assertGuardFileStats = (input, errorFactory) => {
|
|
745
751
|
const __is = input => {
|
|
746
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
752
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
747
753
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
748
754
|
const $io2 = input => "string" === typeof input.message;
|
|
749
755
|
return "object" === typeof input && null !== input && $io0(input);
|
|
@@ -851,9 +857,9 @@ export const assertGuardFileStats = (input, errorFactory) => {
|
|
|
851
857
|
path: _path + ".tags",
|
|
852
858
|
expected: "Array<string>",
|
|
853
859
|
value: input.tags
|
|
854
|
-
}, errorFactory)) && ((Array.isArray(input.error) || $guard(_exceptionable, {
|
|
860
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
855
861
|
path: _path + ".error",
|
|
856
|
-
expected: "Array<__type>.o1",
|
|
862
|
+
expected: "(Array<__type>.o1 | null)",
|
|
857
863
|
value: input.error
|
|
858
864
|
}, errorFactory)) && input.error.every((elem, _index5) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
859
865
|
path: _path + ".error[" + _index5 + "]",
|
|
@@ -865,7 +871,7 @@ export const assertGuardFileStats = (input, errorFactory) => {
|
|
|
865
871
|
value: elem
|
|
866
872
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
867
873
|
path: _path + ".error",
|
|
868
|
-
expected: "Array<__type>.o1",
|
|
874
|
+
expected: "(Array<__type>.o1 | null)",
|
|
869
875
|
value: input.error
|
|
870
876
|
}, errorFactory)) && ("string" === typeof input.resumable || $guard(_exceptionable, {
|
|
871
877
|
path: _path + ".resumable",
|
|
@@ -922,13 +928,13 @@ export const stringifyFileStats = input => {
|
|
|
922
928
|
const $io2 = input => "string" === typeof input.message;
|
|
923
929
|
const $string = __typia.json.createStringify.string;
|
|
924
930
|
const $tail = __typia.json.createStringify.tail;
|
|
925
|
-
const $so0 = input => `{"position":${input.position},"uploading":${input.uploading},"completed":${input.completed},"zones":${`[${input.zones.map(elem => $string(elem)).join(",")}]`},"replicas":${`[${input.replicas.map(elem => $string(elem)).join(",")}]`},"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${`[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]`},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
931
|
+
const $so0 = input => `{"position":${input.position},"uploading":${input.uploading},"completed":${input.completed},"zones":${`[${input.zones.map(elem => $string(elem)).join(",")}]`},"replicas":${`[${input.replicas.map(elem => $string(elem)).join(",")}]`},"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
926
932
|
const $so1 = input => `{${$tail(`${undefined === input.file ? "" : `"file":${undefined !== input.file ? $string(input.file) : undefined}`}`)}}`;
|
|
927
933
|
return $so0(input);
|
|
928
934
|
};
|
|
929
935
|
export const assertStringifyFileStats = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
930
936
|
const __is = input => {
|
|
931
|
-
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
937
|
+
const $io0 = input => "number" === typeof input.position && (0 <= input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && "boolean" === typeof input.uploading && "boolean" === typeof input.completed && (Array.isArray(input.zones) && input.zones.every(elem => "string" === typeof elem)) && (Array.isArray(input.replicas) && input.replicas.every(elem => "string" === typeof elem)) && ("string" === typeof input.id && /^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id)) && ("number" === typeof input.size && (0 <= input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295))) && "boolean" === typeof input.seekable && "boolean" === typeof input.deleted && (Array.isArray(input.refs) && input.refs.every(elem => "object" === typeof elem && null !== elem && false === Array.isArray(elem) && $io1(elem))) && (Array.isArray(input.tags) && input.tags.every(elem => "string" === typeof elem)) && (null === input.error || Array.isArray(input.error) && input.error.every(elem => "object" === typeof elem && null !== elem && $io2(elem))) && "string" === typeof input.resumable && "string" === typeof input.mimeType && ("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 <= 4294967295)));
|
|
932
938
|
const $io1 = input => undefined === input.file || "string" === typeof input.file;
|
|
933
939
|
const $io2 = input => "string" === typeof input.message;
|
|
934
940
|
return "object" === typeof input && null !== input && $io0(input);
|
|
@@ -1036,9 +1042,9 @@ export const assertStringifyFileStats = (input, errorFactory) => { const assert
|
|
|
1036
1042
|
path: _path + ".tags",
|
|
1037
1043
|
expected: "Array<string>",
|
|
1038
1044
|
value: input.tags
|
|
1039
|
-
}, errorFactory)) && ((Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1045
|
+
}, errorFactory)) && (null === input.error || (Array.isArray(input.error) || $guard(_exceptionable, {
|
|
1040
1046
|
path: _path + ".error",
|
|
1041
|
-
expected: "Array<__type>.o1",
|
|
1047
|
+
expected: "(Array<__type>.o1 | null)",
|
|
1042
1048
|
value: input.error
|
|
1043
1049
|
}, errorFactory)) && input.error.every((elem, _index5) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
|
|
1044
1050
|
path: _path + ".error[" + _index5 + "]",
|
|
@@ -1050,7 +1056,7 @@ export const assertStringifyFileStats = (input, errorFactory) => { const assert
|
|
|
1050
1056
|
value: elem
|
|
1051
1057
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1052
1058
|
path: _path + ".error",
|
|
1053
|
-
expected: "Array<__type>.o1",
|
|
1059
|
+
expected: "(Array<__type>.o1 | null)",
|
|
1054
1060
|
value: input.error
|
|
1055
1061
|
}, errorFactory)) && ("string" === typeof input.resumable || $guard(_exceptionable, {
|
|
1056
1062
|
path: _path + ".resumable",
|
|
@@ -1107,7 +1113,7 @@ export const assertStringifyFileStats = (input, errorFactory) => { const assert
|
|
|
1107
1113
|
const $io2 = input => "string" === typeof input.message;
|
|
1108
1114
|
const $string = __typia.json.createAssertStringify.string;
|
|
1109
1115
|
const $tail = __typia.json.createAssertStringify.tail;
|
|
1110
|
-
const $so0 = input => `{"position":${input.position},"uploading":${input.uploading},"completed":${input.completed},"zones":${`[${input.zones.map(elem => $string(elem)).join(",")}]`},"replicas":${`[${input.replicas.map(elem => $string(elem)).join(",")}]`},"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${`[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]`},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
1116
|
+
const $so0 = input => `{"position":${input.position},"uploading":${input.uploading},"completed":${input.completed},"zones":${`[${input.zones.map(elem => $string(elem)).join(",")}]`},"replicas":${`[${input.replicas.map(elem => $string(elem)).join(",")}]`},"id":${$string(input.id)},"size":${input.size},"seekable":${input.seekable},"deleted":${input.deleted},"refs":${`[${input.refs.map(elem => $so1(elem)).join(",")}]`},"tags":${`[${input.tags.map(elem => $string(elem)).join(",")}]`},"error":${null !== input.error ? `[${input.error.map(elem => `{"message":${$string(elem.message)}}`).join(",")}]` : "null"},"resumable":${$string(input.resumable)},"mimeType":${$string(input.mimeType)},"hash":${$string(input.hash)},"btime":${input.btime}}`;
|
|
1111
1117
|
const $so1 = input => `{${$tail(`${undefined === input.file ? "" : `"file":${undefined !== input.file ? $string(input.file) : undefined}`}`)}}`;
|
|
1112
1118
|
return $so0(input);
|
|
1113
1119
|
}; return stringify(assert(input, errorFactory)); };
|