@nxtedition/types 1.2.0 → 1.2.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 +17 -8
- package/dist/common/block.js +815 -431
- package/dist/common/file.d.ts +21 -12
- package/dist/common/file.js +788 -241
- package/package.json +2 -2
package/dist/common/block.js
CHANGED
|
@@ -1,80 +1,86 @@
|
|
|
1
1
|
import __typia from "typia";
|
|
2
2
|
export const isBlock = input => {
|
|
3
|
-
|
|
4
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
3
|
+
return "object" === typeof input && null !== 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);
|
|
5
4
|
};
|
|
6
5
|
export const assertBlock = (input, errorFactory) => {
|
|
7
6
|
const __is = input => {
|
|
8
|
-
|
|
9
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
7
|
+
return "object" === typeof input && null !== 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);
|
|
10
8
|
};
|
|
11
9
|
if (false === __is(input))
|
|
12
10
|
((input, _path, _exceptionable = true) => {
|
|
13
11
|
const $guard = __typia.createAssert.guard;
|
|
14
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.
|
|
15
|
-
path: _path + ".
|
|
16
|
-
expected: "string &
|
|
17
|
-
value: input.
|
|
18
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
19
|
-
path: _path + ".
|
|
20
|
-
expected: "(string &
|
|
21
|
-
value: input.
|
|
22
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
23
|
-
path: _path + ".
|
|
24
|
-
expected: "string &
|
|
25
|
-
value: input.
|
|
26
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
27
|
-
path: _path + ".
|
|
28
|
-
expected: "(string &
|
|
29
|
-
value: input.
|
|
30
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
31
|
-
path: _path + ".
|
|
32
|
-
expected: "string &
|
|
33
|
-
value: input.
|
|
34
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
35
|
-
path: _path + ".
|
|
36
|
-
expected: "(string &
|
|
37
|
-
value: input.
|
|
38
|
-
}, errorFactory)) && (
|
|
12
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
13
|
+
path: _path + ".id",
|
|
14
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
15
|
+
value: input.id
|
|
16
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
17
|
+
path: _path + ".id",
|
|
18
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
19
|
+
value: input.id
|
|
20
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
21
|
+
path: _path + ".file",
|
|
22
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
23
|
+
value: input.file
|
|
24
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
25
|
+
path: _path + ".file",
|
|
26
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
27
|
+
value: input.file
|
|
28
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
29
|
+
path: _path + ".location",
|
|
30
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
31
|
+
value: input.location
|
|
32
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
33
|
+
path: _path + ".location",
|
|
34
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
35
|
+
value: input.location
|
|
36
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
39
37
|
path: _path + ".offset",
|
|
40
38
|
expected: "number & Minimum<0>",
|
|
41
39
|
value: input.offset
|
|
42
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
40
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
43
41
|
path: _path + ".offset",
|
|
44
|
-
expected: "
|
|
42
|
+
expected: "number & Type<\"uint32\">",
|
|
45
43
|
value: input.offset
|
|
46
|
-
}, errorFactory)) && (null === input.position || "number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
47
|
-
path: _path + ".position",
|
|
48
|
-
expected: "number & Minimum<0>",
|
|
49
|
-
value: input.position
|
|
50
44
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
51
|
-
path: _path + ".
|
|
52
|
-
expected: "(
|
|
53
|
-
value: input.
|
|
54
|
-
}, errorFactory)) && (
|
|
45
|
+
path: _path + ".offset",
|
|
46
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
47
|
+
value: input.offset
|
|
48
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
55
49
|
path: _path + ".size",
|
|
56
50
|
expected: "number & Minimum<0>",
|
|
57
51
|
value: input.size
|
|
52
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
53
|
+
path: _path + ".size",
|
|
54
|
+
expected: "number & Type<\"uint32\">",
|
|
55
|
+
value: input.size
|
|
58
56
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
59
57
|
path: _path + ".size",
|
|
60
|
-
expected: "(
|
|
58
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
61
59
|
value: input.size
|
|
62
|
-
}, errorFactory)) && (
|
|
60
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
63
61
|
path: _path + ".hash",
|
|
64
|
-
expected: "
|
|
62
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
65
63
|
value: input.hash
|
|
66
64
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
67
65
|
path: _path + ".hash",
|
|
68
|
-
expected: "(
|
|
66
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
69
67
|
value: input.hash
|
|
70
|
-
}, errorFactory)) && (
|
|
68
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
71
69
|
path: _path + ".btime",
|
|
72
70
|
expected: "number & Minimum<0>",
|
|
73
71
|
value: input.btime
|
|
72
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
73
|
+
path: _path + ".btime",
|
|
74
|
+
expected: "number & Type<\"uint32\">",
|
|
75
|
+
value: input.btime
|
|
74
76
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
75
77
|
path: _path + ".btime",
|
|
76
|
-
expected: "(
|
|
78
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
77
79
|
value: input.btime
|
|
80
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
81
|
+
path: _path + ".path",
|
|
82
|
+
expected: "string",
|
|
83
|
+
value: input.path
|
|
78
84
|
}, errorFactory));
|
|
79
85
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
80
86
|
path: _path + "",
|
|
@@ -90,161 +96,154 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
90
96
|
};
|
|
91
97
|
export const randomBlock = generator => {
|
|
92
98
|
const $generator = __typia.createRandom.generator;
|
|
93
|
-
const $pick = __typia.createRandom.pick;
|
|
94
99
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
95
|
-
|
|
100
|
+
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
101
|
+
{
|
|
102
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
103
|
+
kind: "pattern",
|
|
104
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
105
|
+
}
|
|
106
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
107
|
+
file: (generator?.customs ?? $generator.customs)?.string?.([
|
|
108
|
+
{
|
|
109
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
110
|
+
kind: "pattern",
|
|
111
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
112
|
+
}
|
|
113
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
114
|
+
location: (generator?.customs ?? $generator.customs)?.string?.([
|
|
96
115
|
{
|
|
97
|
-
name: "
|
|
98
|
-
kind: "
|
|
99
|
-
value:
|
|
116
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
117
|
+
kind: "pattern",
|
|
118
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
100
119
|
}
|
|
101
|
-
]) ?? (generator?.
|
|
102
|
-
|
|
120
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
121
|
+
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
103
122
|
{
|
|
104
|
-
name: "
|
|
105
|
-
kind: "
|
|
106
|
-
value:
|
|
123
|
+
name: "Minimum<0>",
|
|
124
|
+
kind: "minimum",
|
|
125
|
+
value: 0
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "Type<\"uint32\">",
|
|
129
|
+
kind: "type",
|
|
130
|
+
value: "uint32"
|
|
131
|
+
}
|
|
132
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
133
|
+
size: (generator?.customs ?? $generator.customs)?.number?.([
|
|
134
|
+
{
|
|
135
|
+
name: "Minimum<0>",
|
|
136
|
+
kind: "minimum",
|
|
137
|
+
value: 0
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "Type<\"uint32\">",
|
|
141
|
+
kind: "type",
|
|
142
|
+
value: "uint32"
|
|
143
|
+
}
|
|
144
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
145
|
+
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
146
|
+
{
|
|
147
|
+
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
148
|
+
kind: "pattern",
|
|
149
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
107
150
|
}
|
|
108
|
-
]) ?? (generator?.
|
|
109
|
-
|
|
151
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^([A-Fa-f0-9]{32})?$/),
|
|
152
|
+
btime: (generator?.customs ?? $generator.customs)?.number?.([
|
|
153
|
+
{
|
|
154
|
+
name: "Minimum<0>",
|
|
155
|
+
kind: "minimum",
|
|
156
|
+
value: 0
|
|
157
|
+
},
|
|
110
158
|
{
|
|
111
|
-
name: "
|
|
112
|
-
kind: "
|
|
113
|
-
value:
|
|
159
|
+
name: "Type<\"uint32\">",
|
|
160
|
+
kind: "type",
|
|
161
|
+
value: "uint32"
|
|
114
162
|
}
|
|
115
|
-
]) ?? (generator?.
|
|
116
|
-
|
|
117
|
-
() => null,
|
|
118
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
119
|
-
{
|
|
120
|
-
name: "Minimum<0>",
|
|
121
|
-
kind: "minimum",
|
|
122
|
-
value: 0
|
|
123
|
-
}
|
|
124
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
125
|
-
])(),
|
|
126
|
-
position: $pick([
|
|
127
|
-
() => null,
|
|
128
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
129
|
-
{
|
|
130
|
-
name: "Minimum<0>",
|
|
131
|
-
kind: "minimum",
|
|
132
|
-
value: 0
|
|
133
|
-
}
|
|
134
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
135
|
-
])(),
|
|
136
|
-
size: $pick([
|
|
137
|
-
() => null,
|
|
138
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
139
|
-
{
|
|
140
|
-
name: "Minimum<0>",
|
|
141
|
-
kind: "minimum",
|
|
142
|
-
value: 0
|
|
143
|
-
}
|
|
144
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
145
|
-
])(),
|
|
146
|
-
hash: $pick([
|
|
147
|
-
() => null,
|
|
148
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
149
|
-
{
|
|
150
|
-
name: "MaxLength<0>",
|
|
151
|
-
kind: "maxLength",
|
|
152
|
-
value: 0
|
|
153
|
-
}
|
|
154
|
-
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(0, 0)),
|
|
155
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
156
|
-
{
|
|
157
|
-
name: "Pattern<\"^[A-Fa-f0-9]{32}$\">",
|
|
158
|
-
kind: "pattern",
|
|
159
|
-
value: "^[A-Fa-f0-9]{32}$"
|
|
160
|
-
}
|
|
161
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[A-Fa-f0-9]{32}$/)
|
|
162
|
-
])(),
|
|
163
|
-
btime: $pick([
|
|
164
|
-
() => null,
|
|
165
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
166
|
-
{
|
|
167
|
-
name: "Minimum<0>",
|
|
168
|
-
kind: "minimum",
|
|
169
|
-
value: 0
|
|
170
|
-
}
|
|
171
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
172
|
-
])()
|
|
163
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
164
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
173
165
|
});
|
|
174
166
|
return $ro0();
|
|
175
167
|
};
|
|
176
168
|
export const assertGuardBlock = (input, errorFactory) => {
|
|
177
169
|
const __is = input => {
|
|
178
|
-
|
|
179
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
170
|
+
return "object" === typeof input && null !== 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);
|
|
180
171
|
};
|
|
181
172
|
if (false === __is(input))
|
|
182
173
|
((input, _path, _exceptionable = true) => {
|
|
183
174
|
const $guard = __typia.createAssertGuard.guard;
|
|
184
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.
|
|
185
|
-
path: _path + ".
|
|
186
|
-
expected: "string &
|
|
187
|
-
value: input.
|
|
188
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
189
|
-
path: _path + ".
|
|
190
|
-
expected: "(string &
|
|
191
|
-
value: input.
|
|
192
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
193
|
-
path: _path + ".
|
|
194
|
-
expected: "string &
|
|
195
|
-
value: input.
|
|
196
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
197
|
-
path: _path + ".
|
|
198
|
-
expected: "(string &
|
|
199
|
-
value: input.
|
|
200
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
201
|
-
path: _path + ".
|
|
202
|
-
expected: "string &
|
|
203
|
-
value: input.
|
|
204
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
205
|
-
path: _path + ".
|
|
206
|
-
expected: "(string &
|
|
207
|
-
value: input.
|
|
208
|
-
}, errorFactory)) && (
|
|
175
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
176
|
+
path: _path + ".id",
|
|
177
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
178
|
+
value: input.id
|
|
179
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
180
|
+
path: _path + ".id",
|
|
181
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
182
|
+
value: input.id
|
|
183
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
184
|
+
path: _path + ".file",
|
|
185
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
186
|
+
value: input.file
|
|
187
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
188
|
+
path: _path + ".file",
|
|
189
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
190
|
+
value: input.file
|
|
191
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
192
|
+
path: _path + ".location",
|
|
193
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
194
|
+
value: input.location
|
|
195
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
196
|
+
path: _path + ".location",
|
|
197
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
198
|
+
value: input.location
|
|
199
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
209
200
|
path: _path + ".offset",
|
|
210
201
|
expected: "number & Minimum<0>",
|
|
211
202
|
value: input.offset
|
|
212
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
203
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
213
204
|
path: _path + ".offset",
|
|
214
|
-
expected: "
|
|
205
|
+
expected: "number & Type<\"uint32\">",
|
|
215
206
|
value: input.offset
|
|
216
|
-
}, errorFactory)) && (null === input.position || "number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
217
|
-
path: _path + ".position",
|
|
218
|
-
expected: "number & Minimum<0>",
|
|
219
|
-
value: input.position
|
|
220
207
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
221
|
-
path: _path + ".
|
|
222
|
-
expected: "(
|
|
223
|
-
value: input.
|
|
224
|
-
}, errorFactory)) && (
|
|
208
|
+
path: _path + ".offset",
|
|
209
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
210
|
+
value: input.offset
|
|
211
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
225
212
|
path: _path + ".size",
|
|
226
213
|
expected: "number & Minimum<0>",
|
|
227
214
|
value: input.size
|
|
215
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
216
|
+
path: _path + ".size",
|
|
217
|
+
expected: "number & Type<\"uint32\">",
|
|
218
|
+
value: input.size
|
|
228
219
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
229
220
|
path: _path + ".size",
|
|
230
|
-
expected: "(
|
|
221
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
231
222
|
value: input.size
|
|
232
|
-
}, errorFactory)) && (
|
|
223
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
233
224
|
path: _path + ".hash",
|
|
234
|
-
expected: "
|
|
225
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
235
226
|
value: input.hash
|
|
236
227
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
237
228
|
path: _path + ".hash",
|
|
238
|
-
expected: "(
|
|
229
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
239
230
|
value: input.hash
|
|
240
|
-
}, errorFactory)) && (
|
|
231
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
241
232
|
path: _path + ".btime",
|
|
242
233
|
expected: "number & Minimum<0>",
|
|
243
234
|
value: input.btime
|
|
235
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
236
|
+
path: _path + ".btime",
|
|
237
|
+
expected: "number & Type<\"uint32\">",
|
|
238
|
+
value: input.btime
|
|
244
239
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
245
240
|
path: _path + ".btime",
|
|
246
|
-
expected: "(
|
|
241
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
247
242
|
value: input.btime
|
|
243
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
244
|
+
path: _path + ".path",
|
|
245
|
+
expected: "string",
|
|
246
|
+
value: input.path
|
|
248
247
|
}, errorFactory));
|
|
249
248
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
250
249
|
path: _path + "",
|
|
@@ -259,190 +258,591 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
259
258
|
};
|
|
260
259
|
export const stringifyBlock = input => {
|
|
261
260
|
const $string = __typia.json.createStringify.string;
|
|
262
|
-
|
|
263
|
-
return $so0(input);
|
|
261
|
+
return `{"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)}}`;
|
|
264
262
|
};
|
|
265
263
|
export const assertStringifyBlock = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
266
264
|
const __is = input => {
|
|
267
|
-
|
|
268
|
-
return "object" === typeof input && null !== input && $io0(input);
|
|
265
|
+
return "object" === typeof input && null !== 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);
|
|
269
266
|
};
|
|
270
267
|
if (false === __is(input))
|
|
271
268
|
((input, _path, _exceptionable = true) => {
|
|
272
269
|
const $guard = __typia.json.createAssertStringify.guard;
|
|
273
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.
|
|
274
|
-
path: _path + ".
|
|
275
|
-
expected: "string &
|
|
276
|
-
value: input.
|
|
277
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
278
|
-
path: _path + ".
|
|
279
|
-
expected: "(string &
|
|
280
|
-
value: input.
|
|
281
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
282
|
-
path: _path + ".
|
|
283
|
-
expected: "string &
|
|
284
|
-
value: input.
|
|
285
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
286
|
-
path: _path + ".
|
|
287
|
-
expected: "(string &
|
|
288
|
-
value: input.
|
|
289
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
290
|
-
path: _path + ".
|
|
291
|
-
expected: "string &
|
|
292
|
-
value: input.
|
|
293
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
294
|
-
path: _path + ".
|
|
295
|
-
expected: "(string &
|
|
296
|
-
value: input.
|
|
297
|
-
}, errorFactory)) && (
|
|
270
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
271
|
+
path: _path + ".id",
|
|
272
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
273
|
+
value: input.id
|
|
274
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
275
|
+
path: _path + ".id",
|
|
276
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
277
|
+
value: input.id
|
|
278
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
279
|
+
path: _path + ".file",
|
|
280
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
281
|
+
value: input.file
|
|
282
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
283
|
+
path: _path + ".file",
|
|
284
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
285
|
+
value: input.file
|
|
286
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
287
|
+
path: _path + ".location",
|
|
288
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
289
|
+
value: input.location
|
|
290
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
291
|
+
path: _path + ".location",
|
|
292
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
293
|
+
value: input.location
|
|
294
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
298
295
|
path: _path + ".offset",
|
|
299
|
-
expected: "number",
|
|
296
|
+
expected: "number & Minimum<0>",
|
|
300
297
|
value: input.offset
|
|
301
|
-
}, errorFactory)) && (0 <= input.offset || $guard(_exceptionable, {
|
|
298
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
302
299
|
path: _path + ".offset",
|
|
303
|
-
expected: "number &
|
|
300
|
+
expected: "number & Type<\"uint32\">",
|
|
304
301
|
value: input.offset
|
|
305
302
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
306
303
|
path: _path + ".offset",
|
|
307
|
-
expected: "(
|
|
304
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
308
305
|
value: input.offset
|
|
309
|
-
}, errorFactory)) && (
|
|
306
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
307
|
+
path: _path + ".size",
|
|
308
|
+
expected: "number & Minimum<0>",
|
|
309
|
+
value: input.size
|
|
310
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
311
|
+
path: _path + ".size",
|
|
312
|
+
expected: "number & Type<\"uint32\">",
|
|
313
|
+
value: input.size
|
|
314
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
315
|
+
path: _path + ".size",
|
|
316
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
317
|
+
value: input.size
|
|
318
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
319
|
+
path: _path + ".hash",
|
|
320
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
321
|
+
value: input.hash
|
|
322
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
323
|
+
path: _path + ".hash",
|
|
324
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
325
|
+
value: input.hash
|
|
326
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
327
|
+
path: _path + ".btime",
|
|
328
|
+
expected: "number & Minimum<0>",
|
|
329
|
+
value: input.btime
|
|
330
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
331
|
+
path: _path + ".btime",
|
|
332
|
+
expected: "number & Type<\"uint32\">",
|
|
333
|
+
value: input.btime
|
|
334
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
335
|
+
path: _path + ".btime",
|
|
336
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
337
|
+
value: input.btime
|
|
338
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
339
|
+
path: _path + ".path",
|
|
340
|
+
expected: "string",
|
|
341
|
+
value: input.path
|
|
342
|
+
}, errorFactory));
|
|
343
|
+
return ("object" === typeof input && null !== input || $guard(true, {
|
|
344
|
+
path: _path + "",
|
|
345
|
+
expected: "Block",
|
|
346
|
+
value: input
|
|
347
|
+
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
348
|
+
path: _path + "",
|
|
349
|
+
expected: "Block",
|
|
350
|
+
value: input
|
|
351
|
+
}, errorFactory);
|
|
352
|
+
})(input, "$input", true);
|
|
353
|
+
return input;
|
|
354
|
+
}; const stringify = input => {
|
|
355
|
+
const $string = __typia.json.createAssertStringify.string;
|
|
356
|
+
return `{"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)}}`;
|
|
357
|
+
}; return stringify(assert(input, errorFactory)); };
|
|
358
|
+
export const isBlockStats = input => {
|
|
359
|
+
return "object" === typeof input && null !== 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);
|
|
360
|
+
};
|
|
361
|
+
export const assertBlockStats = (input, errorFactory) => {
|
|
362
|
+
const __is = input => {
|
|
363
|
+
return "object" === typeof input && null !== 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);
|
|
364
|
+
};
|
|
365
|
+
if (false === __is(input))
|
|
366
|
+
((input, _path, _exceptionable = true) => {
|
|
367
|
+
const $guard = __typia.createAssert.guard;
|
|
368
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
310
369
|
path: _path + ".position",
|
|
311
|
-
expected: "number",
|
|
370
|
+
expected: "number & Minimum<0>",
|
|
312
371
|
value: input.position
|
|
313
|
-
}, errorFactory)) && (0 <= input.position || $guard(_exceptionable, {
|
|
372
|
+
}, errorFactory)) && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
|
|
314
373
|
path: _path + ".position",
|
|
315
|
-
expected: "number &
|
|
374
|
+
expected: "number & Type<\"uint32\">",
|
|
316
375
|
value: input.position
|
|
317
376
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
318
377
|
path: _path + ".position",
|
|
319
|
-
expected: "(
|
|
378
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
320
379
|
value: input.position
|
|
321
|
-
}, errorFactory)) && (
|
|
380
|
+
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
381
|
+
path: _path + ".id",
|
|
382
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
383
|
+
value: input.id
|
|
384
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
385
|
+
path: _path + ".id",
|
|
386
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
387
|
+
value: input.id
|
|
388
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
389
|
+
path: _path + ".file",
|
|
390
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
391
|
+
value: input.file
|
|
392
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
393
|
+
path: _path + ".file",
|
|
394
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
395
|
+
value: input.file
|
|
396
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
397
|
+
path: _path + ".location",
|
|
398
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
399
|
+
value: input.location
|
|
400
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
401
|
+
path: _path + ".location",
|
|
402
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
403
|
+
value: input.location
|
|
404
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
405
|
+
path: _path + ".offset",
|
|
406
|
+
expected: "number & Minimum<0>",
|
|
407
|
+
value: input.offset
|
|
408
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
409
|
+
path: _path + ".offset",
|
|
410
|
+
expected: "number & Type<\"uint32\">",
|
|
411
|
+
value: input.offset
|
|
412
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
413
|
+
path: _path + ".offset",
|
|
414
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
415
|
+
value: input.offset
|
|
416
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
322
417
|
path: _path + ".size",
|
|
323
|
-
expected: "number",
|
|
418
|
+
expected: "number & Minimum<0>",
|
|
324
419
|
value: input.size
|
|
325
|
-
}, errorFactory)) && (0 <= input.size || $guard(_exceptionable, {
|
|
420
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
326
421
|
path: _path + ".size",
|
|
422
|
+
expected: "number & Type<\"uint32\">",
|
|
423
|
+
value: input.size
|
|
424
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
425
|
+
path: _path + ".size",
|
|
426
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
427
|
+
value: input.size
|
|
428
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
429
|
+
path: _path + ".hash",
|
|
430
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
431
|
+
value: input.hash
|
|
432
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
433
|
+
path: _path + ".hash",
|
|
434
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
435
|
+
value: input.hash
|
|
436
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
437
|
+
path: _path + ".btime",
|
|
327
438
|
expected: "number & Minimum<0>",
|
|
439
|
+
value: input.btime
|
|
440
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
441
|
+
path: _path + ".btime",
|
|
442
|
+
expected: "number & Type<\"uint32\">",
|
|
443
|
+
value: input.btime
|
|
444
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
445
|
+
path: _path + ".btime",
|
|
446
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
447
|
+
value: input.btime
|
|
448
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
449
|
+
path: _path + ".path",
|
|
450
|
+
expected: "string",
|
|
451
|
+
value: input.path
|
|
452
|
+
}, errorFactory));
|
|
453
|
+
return ("object" === typeof input && null !== input || $guard(true, {
|
|
454
|
+
path: _path + "",
|
|
455
|
+
expected: "BlockStats",
|
|
456
|
+
value: input
|
|
457
|
+
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
458
|
+
path: _path + "",
|
|
459
|
+
expected: "BlockStats",
|
|
460
|
+
value: input
|
|
461
|
+
}, errorFactory);
|
|
462
|
+
})(input, "$input", true);
|
|
463
|
+
return input;
|
|
464
|
+
};
|
|
465
|
+
export const randomBlockStats = generator => {
|
|
466
|
+
const $generator = __typia.createRandom.generator;
|
|
467
|
+
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
468
|
+
position: (generator?.customs ?? $generator.customs)?.number?.([
|
|
469
|
+
{
|
|
470
|
+
name: "Minimum<0>",
|
|
471
|
+
kind: "minimum",
|
|
472
|
+
value: 0
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
name: "Type<\"uint32\">",
|
|
476
|
+
kind: "type",
|
|
477
|
+
value: "uint32"
|
|
478
|
+
}
|
|
479
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
480
|
+
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
481
|
+
{
|
|
482
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
483
|
+
kind: "pattern",
|
|
484
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
485
|
+
}
|
|
486
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
487
|
+
file: (generator?.customs ?? $generator.customs)?.string?.([
|
|
488
|
+
{
|
|
489
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
490
|
+
kind: "pattern",
|
|
491
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
492
|
+
}
|
|
493
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
494
|
+
location: (generator?.customs ?? $generator.customs)?.string?.([
|
|
495
|
+
{
|
|
496
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
497
|
+
kind: "pattern",
|
|
498
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
499
|
+
}
|
|
500
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
501
|
+
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
502
|
+
{
|
|
503
|
+
name: "Minimum<0>",
|
|
504
|
+
kind: "minimum",
|
|
505
|
+
value: 0
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
name: "Type<\"uint32\">",
|
|
509
|
+
kind: "type",
|
|
510
|
+
value: "uint32"
|
|
511
|
+
}
|
|
512
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
513
|
+
size: (generator?.customs ?? $generator.customs)?.number?.([
|
|
514
|
+
{
|
|
515
|
+
name: "Minimum<0>",
|
|
516
|
+
kind: "minimum",
|
|
517
|
+
value: 0
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: "Type<\"uint32\">",
|
|
521
|
+
kind: "type",
|
|
522
|
+
value: "uint32"
|
|
523
|
+
}
|
|
524
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
525
|
+
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
526
|
+
{
|
|
527
|
+
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
528
|
+
kind: "pattern",
|
|
529
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
530
|
+
}
|
|
531
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^([A-Fa-f0-9]{32})?$/),
|
|
532
|
+
btime: (generator?.customs ?? $generator.customs)?.number?.([
|
|
533
|
+
{
|
|
534
|
+
name: "Minimum<0>",
|
|
535
|
+
kind: "minimum",
|
|
536
|
+
value: 0
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: "Type<\"uint32\">",
|
|
540
|
+
kind: "type",
|
|
541
|
+
value: "uint32"
|
|
542
|
+
}
|
|
543
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
544
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
545
|
+
});
|
|
546
|
+
return $ro0();
|
|
547
|
+
};
|
|
548
|
+
export const assertGuardBlockStats = (input, errorFactory) => {
|
|
549
|
+
const __is = input => {
|
|
550
|
+
return "object" === typeof input && null !== 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);
|
|
551
|
+
};
|
|
552
|
+
if (false === __is(input))
|
|
553
|
+
((input, _path, _exceptionable = true) => {
|
|
554
|
+
const $guard = __typia.createAssertGuard.guard;
|
|
555
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
556
|
+
path: _path + ".position",
|
|
557
|
+
expected: "number & Minimum<0>",
|
|
558
|
+
value: input.position
|
|
559
|
+
}, errorFactory)) && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
|
|
560
|
+
path: _path + ".position",
|
|
561
|
+
expected: "number & Type<\"uint32\">",
|
|
562
|
+
value: input.position
|
|
563
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
564
|
+
path: _path + ".position",
|
|
565
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
566
|
+
value: input.position
|
|
567
|
+
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
568
|
+
path: _path + ".id",
|
|
569
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
570
|
+
value: input.id
|
|
571
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
572
|
+
path: _path + ".id",
|
|
573
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
574
|
+
value: input.id
|
|
575
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
576
|
+
path: _path + ".file",
|
|
577
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
578
|
+
value: input.file
|
|
579
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
580
|
+
path: _path + ".file",
|
|
581
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
582
|
+
value: input.file
|
|
583
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
584
|
+
path: _path + ".location",
|
|
585
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
586
|
+
value: input.location
|
|
587
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
588
|
+
path: _path + ".location",
|
|
589
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
590
|
+
value: input.location
|
|
591
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
592
|
+
path: _path + ".offset",
|
|
593
|
+
expected: "number & Minimum<0>",
|
|
594
|
+
value: input.offset
|
|
595
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
596
|
+
path: _path + ".offset",
|
|
597
|
+
expected: "number & Type<\"uint32\">",
|
|
598
|
+
value: input.offset
|
|
599
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
600
|
+
path: _path + ".offset",
|
|
601
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
602
|
+
value: input.offset
|
|
603
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
604
|
+
path: _path + ".size",
|
|
605
|
+
expected: "number & Minimum<0>",
|
|
606
|
+
value: input.size
|
|
607
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
608
|
+
path: _path + ".size",
|
|
609
|
+
expected: "number & Type<\"uint32\">",
|
|
328
610
|
value: input.size
|
|
329
611
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
330
612
|
path: _path + ".size",
|
|
331
|
-
expected: "(
|
|
613
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
332
614
|
value: input.size
|
|
333
|
-
}, errorFactory)) && (
|
|
615
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
334
616
|
path: _path + ".hash",
|
|
335
|
-
expected: "
|
|
617
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
336
618
|
value: input.hash
|
|
337
619
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
338
620
|
path: _path + ".hash",
|
|
339
|
-
expected: "(
|
|
621
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
340
622
|
value: input.hash
|
|
341
|
-
}, errorFactory)) && (
|
|
623
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
342
624
|
path: _path + ".btime",
|
|
343
|
-
expected: "number",
|
|
625
|
+
expected: "number & Minimum<0>",
|
|
344
626
|
value: input.btime
|
|
345
|
-
}, errorFactory)) && (0 <= input.btime || $guard(_exceptionable, {
|
|
627
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
628
|
+
path: _path + ".btime",
|
|
629
|
+
expected: "number & Type<\"uint32\">",
|
|
630
|
+
value: input.btime
|
|
631
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
632
|
+
path: _path + ".btime",
|
|
633
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
634
|
+
value: input.btime
|
|
635
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
636
|
+
path: _path + ".path",
|
|
637
|
+
expected: "string",
|
|
638
|
+
value: input.path
|
|
639
|
+
}, errorFactory));
|
|
640
|
+
return ("object" === typeof input && null !== input || $guard(true, {
|
|
641
|
+
path: _path + "",
|
|
642
|
+
expected: "BlockStats",
|
|
643
|
+
value: input
|
|
644
|
+
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
645
|
+
path: _path + "",
|
|
646
|
+
expected: "BlockStats",
|
|
647
|
+
value: input
|
|
648
|
+
}, errorFactory);
|
|
649
|
+
})(input, "$input", true);
|
|
650
|
+
};
|
|
651
|
+
export const stringifyBlockStats = input => {
|
|
652
|
+
const $string = __typia.json.createStringify.string;
|
|
653
|
+
return `{"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)}}`;
|
|
654
|
+
};
|
|
655
|
+
export const assertStringifyBlockStats = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
656
|
+
const __is = input => {
|
|
657
|
+
return "object" === typeof input && null !== 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);
|
|
658
|
+
};
|
|
659
|
+
if (false === __is(input))
|
|
660
|
+
((input, _path, _exceptionable = true) => {
|
|
661
|
+
const $guard = __typia.json.createAssertStringify.guard;
|
|
662
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
663
|
+
path: _path + ".position",
|
|
664
|
+
expected: "number & Minimum<0>",
|
|
665
|
+
value: input.position
|
|
666
|
+
}, errorFactory)) && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
|
|
667
|
+
path: _path + ".position",
|
|
668
|
+
expected: "number & Type<\"uint32\">",
|
|
669
|
+
value: input.position
|
|
670
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
671
|
+
path: _path + ".position",
|
|
672
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
673
|
+
value: input.position
|
|
674
|
+
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
675
|
+
path: _path + ".id",
|
|
676
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
677
|
+
value: input.id
|
|
678
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
679
|
+
path: _path + ".id",
|
|
680
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
681
|
+
value: input.id
|
|
682
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
683
|
+
path: _path + ".file",
|
|
684
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
685
|
+
value: input.file
|
|
686
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
687
|
+
path: _path + ".file",
|
|
688
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
689
|
+
value: input.file
|
|
690
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
691
|
+
path: _path + ".location",
|
|
692
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
693
|
+
value: input.location
|
|
694
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
695
|
+
path: _path + ".location",
|
|
696
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
697
|
+
value: input.location
|
|
698
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
699
|
+
path: _path + ".offset",
|
|
700
|
+
expected: "number & Minimum<0>",
|
|
701
|
+
value: input.offset
|
|
702
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
703
|
+
path: _path + ".offset",
|
|
704
|
+
expected: "number & Type<\"uint32\">",
|
|
705
|
+
value: input.offset
|
|
706
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
707
|
+
path: _path + ".offset",
|
|
708
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
709
|
+
value: input.offset
|
|
710
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
711
|
+
path: _path + ".size",
|
|
712
|
+
expected: "number & Minimum<0>",
|
|
713
|
+
value: input.size
|
|
714
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
715
|
+
path: _path + ".size",
|
|
716
|
+
expected: "number & Type<\"uint32\">",
|
|
717
|
+
value: input.size
|
|
718
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
719
|
+
path: _path + ".size",
|
|
720
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
721
|
+
value: input.size
|
|
722
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
723
|
+
path: _path + ".hash",
|
|
724
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
725
|
+
value: input.hash
|
|
726
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
727
|
+
path: _path + ".hash",
|
|
728
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
729
|
+
value: input.hash
|
|
730
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
346
731
|
path: _path + ".btime",
|
|
347
732
|
expected: "number & Minimum<0>",
|
|
348
733
|
value: input.btime
|
|
734
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
735
|
+
path: _path + ".btime",
|
|
736
|
+
expected: "number & Type<\"uint32\">",
|
|
737
|
+
value: input.btime
|
|
349
738
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
350
739
|
path: _path + ".btime",
|
|
351
|
-
expected: "(
|
|
740
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
352
741
|
value: input.btime
|
|
742
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
743
|
+
path: _path + ".path",
|
|
744
|
+
expected: "string",
|
|
745
|
+
value: input.path
|
|
353
746
|
}, errorFactory));
|
|
354
747
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
355
748
|
path: _path + "",
|
|
356
|
-
expected: "
|
|
749
|
+
expected: "BlockStats",
|
|
357
750
|
value: input
|
|
358
751
|
}, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
|
|
359
752
|
path: _path + "",
|
|
360
|
-
expected: "
|
|
753
|
+
expected: "BlockStats",
|
|
361
754
|
value: input
|
|
362
755
|
}, errorFactory);
|
|
363
756
|
})(input, "$input", true);
|
|
364
757
|
return input;
|
|
365
758
|
}; const stringify = input => {
|
|
366
759
|
const $string = __typia.json.createAssertStringify.string;
|
|
367
|
-
|
|
368
|
-
return $so0(input);
|
|
760
|
+
return `{"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)}}`;
|
|
369
761
|
}; return stringify(assert(input, errorFactory)); };
|
|
370
762
|
export const isBlocks = input => {
|
|
371
|
-
const $io0 = input => "string" === typeof 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;
|
|
372
764
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
373
765
|
};
|
|
374
766
|
export const assertBlocks = (input, errorFactory) => {
|
|
375
767
|
const __is = input => {
|
|
376
|
-
const $io0 = input => "string" === typeof 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;
|
|
377
769
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
378
770
|
};
|
|
379
771
|
if (false === __is(input))
|
|
380
772
|
((input, _path, _exceptionable = true) => {
|
|
381
773
|
const $guard = __typia.createAssert.guard;
|
|
382
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.
|
|
383
|
-
path: _path + ".
|
|
384
|
-
expected: "string &
|
|
385
|
-
value: input.
|
|
386
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
387
|
-
path: _path + ".
|
|
388
|
-
expected: "(string &
|
|
389
|
-
value: input.
|
|
390
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
391
|
-
path: _path + ".
|
|
392
|
-
expected: "string &
|
|
393
|
-
value: input.
|
|
394
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
395
|
-
path: _path + ".
|
|
396
|
-
expected: "(string &
|
|
397
|
-
value: input.
|
|
398
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
399
|
-
path: _path + ".
|
|
400
|
-
expected: "string &
|
|
401
|
-
value: input.
|
|
402
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
403
|
-
path: _path + ".
|
|
404
|
-
expected: "(string &
|
|
405
|
-
value: input.
|
|
406
|
-
}, errorFactory)) && (
|
|
774
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
775
|
+
path: _path + ".id",
|
|
776
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
777
|
+
value: input.id
|
|
778
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
779
|
+
path: _path + ".id",
|
|
780
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
781
|
+
value: input.id
|
|
782
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
783
|
+
path: _path + ".file",
|
|
784
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
785
|
+
value: input.file
|
|
786
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
787
|
+
path: _path + ".file",
|
|
788
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
789
|
+
value: input.file
|
|
790
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
791
|
+
path: _path + ".location",
|
|
792
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
793
|
+
value: input.location
|
|
794
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
795
|
+
path: _path + ".location",
|
|
796
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
797
|
+
value: input.location
|
|
798
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
407
799
|
path: _path + ".offset",
|
|
408
800
|
expected: "number & Minimum<0>",
|
|
409
801
|
value: input.offset
|
|
410
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
802
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
411
803
|
path: _path + ".offset",
|
|
412
|
-
expected: "
|
|
804
|
+
expected: "number & Type<\"uint32\">",
|
|
413
805
|
value: input.offset
|
|
414
|
-
}, errorFactory)) && (null === input.position || "number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
415
|
-
path: _path + ".position",
|
|
416
|
-
expected: "number & Minimum<0>",
|
|
417
|
-
value: input.position
|
|
418
806
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
419
|
-
path: _path + ".
|
|
420
|
-
expected: "(
|
|
421
|
-
value: input.
|
|
422
|
-
}, errorFactory)) && (
|
|
807
|
+
path: _path + ".offset",
|
|
808
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
809
|
+
value: input.offset
|
|
810
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
423
811
|
path: _path + ".size",
|
|
424
812
|
expected: "number & Minimum<0>",
|
|
425
813
|
value: input.size
|
|
814
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
815
|
+
path: _path + ".size",
|
|
816
|
+
expected: "number & Type<\"uint32\">",
|
|
817
|
+
value: input.size
|
|
426
818
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
427
819
|
path: _path + ".size",
|
|
428
|
-
expected: "(
|
|
820
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
429
821
|
value: input.size
|
|
430
|
-
}, errorFactory)) && (
|
|
822
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
431
823
|
path: _path + ".hash",
|
|
432
|
-
expected: "
|
|
824
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
433
825
|
value: input.hash
|
|
434
826
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
435
827
|
path: _path + ".hash",
|
|
436
|
-
expected: "(
|
|
828
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
437
829
|
value: input.hash
|
|
438
|
-
}, errorFactory)) && (
|
|
830
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
439
831
|
path: _path + ".btime",
|
|
440
832
|
expected: "number & Minimum<0>",
|
|
441
833
|
value: input.btime
|
|
834
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
835
|
+
path: _path + ".btime",
|
|
836
|
+
expected: "number & Type<\"uint32\">",
|
|
837
|
+
value: input.btime
|
|
442
838
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
443
839
|
path: _path + ".btime",
|
|
444
|
-
expected: "(
|
|
840
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
445
841
|
value: input.btime
|
|
842
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
843
|
+
path: _path + ".path",
|
|
844
|
+
expected: "string",
|
|
845
|
+
value: input.path
|
|
446
846
|
}, errorFactory));
|
|
447
847
|
return (Array.isArray(input) || $guard(true, {
|
|
448
848
|
path: _path + "",
|
|
@@ -466,161 +866,155 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
466
866
|
};
|
|
467
867
|
export const randomBlocks = generator => {
|
|
468
868
|
const $generator = __typia.createRandom.generator;
|
|
469
|
-
const $pick = __typia.createRandom.pick;
|
|
470
869
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
471
|
-
|
|
870
|
+
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
871
|
+
{
|
|
872
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
873
|
+
kind: "pattern",
|
|
874
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
875
|
+
}
|
|
876
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
877
|
+
file: (generator?.customs ?? $generator.customs)?.string?.([
|
|
878
|
+
{
|
|
879
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
880
|
+
kind: "pattern",
|
|
881
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
882
|
+
}
|
|
883
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
884
|
+
location: (generator?.customs ?? $generator.customs)?.string?.([
|
|
885
|
+
{
|
|
886
|
+
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
887
|
+
kind: "pattern",
|
|
888
|
+
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
889
|
+
}
|
|
890
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
891
|
+
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
472
892
|
{
|
|
473
|
-
name: "
|
|
474
|
-
kind: "
|
|
475
|
-
value:
|
|
893
|
+
name: "Minimum<0>",
|
|
894
|
+
kind: "minimum",
|
|
895
|
+
value: 0
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: "Type<\"uint32\">",
|
|
899
|
+
kind: "type",
|
|
900
|
+
value: "uint32"
|
|
476
901
|
}
|
|
477
|
-
]) ?? (generator?.
|
|
478
|
-
|
|
902
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
903
|
+
size: (generator?.customs ?? $generator.customs)?.number?.([
|
|
904
|
+
{
|
|
905
|
+
name: "Minimum<0>",
|
|
906
|
+
kind: "minimum",
|
|
907
|
+
value: 0
|
|
908
|
+
},
|
|
479
909
|
{
|
|
480
|
-
name: "
|
|
481
|
-
kind: "
|
|
482
|
-
value:
|
|
910
|
+
name: "Type<\"uint32\">",
|
|
911
|
+
kind: "type",
|
|
912
|
+
value: "uint32"
|
|
483
913
|
}
|
|
484
|
-
]) ?? (generator?.
|
|
485
|
-
|
|
914
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
915
|
+
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
916
|
+
{
|
|
917
|
+
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
918
|
+
kind: "pattern",
|
|
919
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
920
|
+
}
|
|
921
|
+
]) ?? (generator?.pattern ?? $generator.pattern)(/^([A-Fa-f0-9]{32})?$/),
|
|
922
|
+
btime: (generator?.customs ?? $generator.customs)?.number?.([
|
|
923
|
+
{
|
|
924
|
+
name: "Minimum<0>",
|
|
925
|
+
kind: "minimum",
|
|
926
|
+
value: 0
|
|
927
|
+
},
|
|
486
928
|
{
|
|
487
|
-
name: "
|
|
488
|
-
kind: "
|
|
489
|
-
value:
|
|
929
|
+
name: "Type<\"uint32\">",
|
|
930
|
+
kind: "type",
|
|
931
|
+
value: "uint32"
|
|
490
932
|
}
|
|
491
|
-
]) ?? (generator?.
|
|
492
|
-
|
|
493
|
-
() => null,
|
|
494
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
495
|
-
{
|
|
496
|
-
name: "Minimum<0>",
|
|
497
|
-
kind: "minimum",
|
|
498
|
-
value: 0
|
|
499
|
-
}
|
|
500
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
501
|
-
])(),
|
|
502
|
-
position: $pick([
|
|
503
|
-
() => null,
|
|
504
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
505
|
-
{
|
|
506
|
-
name: "Minimum<0>",
|
|
507
|
-
kind: "minimum",
|
|
508
|
-
value: 0
|
|
509
|
-
}
|
|
510
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
511
|
-
])(),
|
|
512
|
-
size: $pick([
|
|
513
|
-
() => null,
|
|
514
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
515
|
-
{
|
|
516
|
-
name: "Minimum<0>",
|
|
517
|
-
kind: "minimum",
|
|
518
|
-
value: 0
|
|
519
|
-
}
|
|
520
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
521
|
-
])(),
|
|
522
|
-
hash: $pick([
|
|
523
|
-
() => null,
|
|
524
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
525
|
-
{
|
|
526
|
-
name: "MaxLength<0>",
|
|
527
|
-
kind: "maxLength",
|
|
528
|
-
value: 0
|
|
529
|
-
}
|
|
530
|
-
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(0, 0)),
|
|
531
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
532
|
-
{
|
|
533
|
-
name: "Pattern<\"^[A-Fa-f0-9]{32}$\">",
|
|
534
|
-
kind: "pattern",
|
|
535
|
-
value: "^[A-Fa-f0-9]{32}$"
|
|
536
|
-
}
|
|
537
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[A-Fa-f0-9]{32}$/)
|
|
538
|
-
])(),
|
|
539
|
-
btime: $pick([
|
|
540
|
-
() => null,
|
|
541
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
542
|
-
{
|
|
543
|
-
name: "Minimum<0>",
|
|
544
|
-
kind: "minimum",
|
|
545
|
-
value: 0
|
|
546
|
-
}
|
|
547
|
-
]) ?? (generator?.number ?? $generator.number)(0, 10)
|
|
548
|
-
])()
|
|
933
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
934
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
549
935
|
});
|
|
550
936
|
return (generator?.array ?? $generator.array)(() => $ro0());
|
|
551
937
|
};
|
|
552
938
|
export const assertGuardBlocks = (input, errorFactory) => {
|
|
553
939
|
const __is = input => {
|
|
554
|
-
const $io0 = input => "string" === typeof 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;
|
|
555
941
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
556
942
|
};
|
|
557
943
|
if (false === __is(input))
|
|
558
944
|
((input, _path, _exceptionable = true) => {
|
|
559
945
|
const $guard = __typia.createAssertGuard.guard;
|
|
560
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.
|
|
561
|
-
path: _path + ".
|
|
562
|
-
expected: "string &
|
|
563
|
-
value: input.
|
|
564
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
565
|
-
path: _path + ".
|
|
566
|
-
expected: "(string &
|
|
567
|
-
value: input.
|
|
568
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
569
|
-
path: _path + ".
|
|
570
|
-
expected: "string &
|
|
571
|
-
value: input.
|
|
572
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
573
|
-
path: _path + ".
|
|
574
|
-
expected: "(string &
|
|
575
|
-
value: input.
|
|
576
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
577
|
-
path: _path + ".
|
|
578
|
-
expected: "string &
|
|
579
|
-
value: input.
|
|
580
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
581
|
-
path: _path + ".
|
|
582
|
-
expected: "(string &
|
|
583
|
-
value: input.
|
|
584
|
-
}, errorFactory)) && (
|
|
946
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
947
|
+
path: _path + ".id",
|
|
948
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
949
|
+
value: input.id
|
|
950
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
951
|
+
path: _path + ".id",
|
|
952
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
953
|
+
value: input.id
|
|
954
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
955
|
+
path: _path + ".file",
|
|
956
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
957
|
+
value: input.file
|
|
958
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
959
|
+
path: _path + ".file",
|
|
960
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
961
|
+
value: input.file
|
|
962
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
963
|
+
path: _path + ".location",
|
|
964
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
965
|
+
value: input.location
|
|
966
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
967
|
+
path: _path + ".location",
|
|
968
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
969
|
+
value: input.location
|
|
970
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
585
971
|
path: _path + ".offset",
|
|
586
972
|
expected: "number & Minimum<0>",
|
|
587
973
|
value: input.offset
|
|
588
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
974
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
589
975
|
path: _path + ".offset",
|
|
590
|
-
expected: "
|
|
976
|
+
expected: "number & Type<\"uint32\">",
|
|
591
977
|
value: input.offset
|
|
592
|
-
}, errorFactory)) && (null === input.position || "number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
593
|
-
path: _path + ".position",
|
|
594
|
-
expected: "number & Minimum<0>",
|
|
595
|
-
value: input.position
|
|
596
978
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
597
|
-
path: _path + ".
|
|
598
|
-
expected: "(
|
|
599
|
-
value: input.
|
|
600
|
-
}, errorFactory)) && (
|
|
979
|
+
path: _path + ".offset",
|
|
980
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
981
|
+
value: input.offset
|
|
982
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
601
983
|
path: _path + ".size",
|
|
602
984
|
expected: "number & Minimum<0>",
|
|
603
985
|
value: input.size
|
|
986
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
987
|
+
path: _path + ".size",
|
|
988
|
+
expected: "number & Type<\"uint32\">",
|
|
989
|
+
value: input.size
|
|
604
990
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
605
991
|
path: _path + ".size",
|
|
606
|
-
expected: "(
|
|
992
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
607
993
|
value: input.size
|
|
608
|
-
}, errorFactory)) && (
|
|
994
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
609
995
|
path: _path + ".hash",
|
|
610
|
-
expected: "
|
|
996
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
611
997
|
value: input.hash
|
|
612
998
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
613
999
|
path: _path + ".hash",
|
|
614
|
-
expected: "(
|
|
1000
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
615
1001
|
value: input.hash
|
|
616
|
-
}, errorFactory)) && (
|
|
1002
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
617
1003
|
path: _path + ".btime",
|
|
618
1004
|
expected: "number & Minimum<0>",
|
|
619
1005
|
value: input.btime
|
|
1006
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
1007
|
+
path: _path + ".btime",
|
|
1008
|
+
expected: "number & Type<\"uint32\">",
|
|
1009
|
+
value: input.btime
|
|
620
1010
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
621
1011
|
path: _path + ".btime",
|
|
622
|
-
expected: "(
|
|
1012
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
623
1013
|
value: input.btime
|
|
1014
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
1015
|
+
path: _path + ".path",
|
|
1016
|
+
expected: "string",
|
|
1017
|
+
value: input.path
|
|
624
1018
|
}, errorFactory));
|
|
625
1019
|
return (Array.isArray(input) || $guard(true, {
|
|
626
1020
|
path: _path + "",
|
|
@@ -643,97 +1037,88 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
643
1037
|
};
|
|
644
1038
|
export const stringifyBlocks = input => {
|
|
645
1039
|
const $string = __typia.json.createStringify.string;
|
|
646
|
-
|
|
647
|
-
return `[${input.map(elem => $so0(elem)).join(",")}]`;
|
|
1040
|
+
return `[${input.map(elem => `{"id":${$string(elem.id)},"file":${$string(elem.file)},"location":${$string(elem.location)},"offset":${elem.offset},"size":${elem.size},"hash":${$string(elem.hash)},"btime":${elem.btime},"path":${$string(elem.path)}}`).join(",")}]`;
|
|
648
1041
|
};
|
|
649
1042
|
export const assertStringifyBlocks = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
650
1043
|
const __is = input => {
|
|
651
|
-
const $io0 = input => "string" === typeof 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;
|
|
652
1045
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
653
1046
|
};
|
|
654
1047
|
if (false === __is(input))
|
|
655
1048
|
((input, _path, _exceptionable = true) => {
|
|
656
1049
|
const $guard = __typia.json.createAssertStringify.guard;
|
|
657
|
-
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.
|
|
658
|
-
path: _path + ".
|
|
659
|
-
expected: "string &
|
|
660
|
-
value: input.
|
|
661
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
662
|
-
path: _path + ".
|
|
663
|
-
expected: "(string &
|
|
664
|
-
value: input.
|
|
665
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
666
|
-
path: _path + ".
|
|
667
|
-
expected: "string &
|
|
668
|
-
value: input.
|
|
669
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
670
|
-
path: _path + ".
|
|
671
|
-
expected: "(string &
|
|
672
|
-
value: input.
|
|
673
|
-
}, errorFactory)) && ("string" === typeof input.
|
|
674
|
-
path: _path + ".
|
|
675
|
-
expected: "string &
|
|
676
|
-
value: input.
|
|
677
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
678
|
-
path: _path + ".
|
|
679
|
-
expected: "(string &
|
|
680
|
-
value: input.
|
|
681
|
-
}, errorFactory)) && (
|
|
1050
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
1051
|
+
path: _path + ".id",
|
|
1052
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
1053
|
+
value: input.id
|
|
1054
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
1055
|
+
path: _path + ".id",
|
|
1056
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1057
|
+
value: input.id
|
|
1058
|
+
}, errorFactory)) && ("string" === typeof input.file && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.file) || $guard(_exceptionable, {
|
|
1059
|
+
path: _path + ".file",
|
|
1060
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
1061
|
+
value: input.file
|
|
1062
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
1063
|
+
path: _path + ".file",
|
|
1064
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1065
|
+
value: input.file
|
|
1066
|
+
}, errorFactory)) && ("string" === typeof input.location && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.location) || $guard(_exceptionable, {
|
|
1067
|
+
path: _path + ".location",
|
|
1068
|
+
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
1069
|
+
value: input.location
|
|
1070
|
+
}, errorFactory)) || $guard(_exceptionable, {
|
|
1071
|
+
path: _path + ".location",
|
|
1072
|
+
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1073
|
+
value: input.location
|
|
1074
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
682
1075
|
path: _path + ".offset",
|
|
683
|
-
expected: "number",
|
|
1076
|
+
expected: "number & Minimum<0>",
|
|
684
1077
|
value: input.offset
|
|
685
|
-
}, errorFactory)) && (0 <= input.offset || $guard(_exceptionable, {
|
|
1078
|
+
}, errorFactory)) && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
|
|
686
1079
|
path: _path + ".offset",
|
|
687
|
-
expected: "number &
|
|
1080
|
+
expected: "number & Type<\"uint32\">",
|
|
688
1081
|
value: input.offset
|
|
689
1082
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
690
1083
|
path: _path + ".offset",
|
|
691
|
-
expected: "(
|
|
1084
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
692
1085
|
value: input.offset
|
|
693
|
-
}, errorFactory)) && (
|
|
694
|
-
path: _path + ".position",
|
|
695
|
-
expected: "number",
|
|
696
|
-
value: input.position
|
|
697
|
-
}, errorFactory)) && (0 <= input.position || $guard(_exceptionable, {
|
|
698
|
-
path: _path + ".position",
|
|
699
|
-
expected: "number & Minimum<0>",
|
|
700
|
-
value: input.position
|
|
701
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
702
|
-
path: _path + ".position",
|
|
703
|
-
expected: "((number & Minimum<0>) | null)",
|
|
704
|
-
value: input.position
|
|
705
|
-
}, errorFactory)) && (null === input.size || "number" === typeof input.size && (!Number.isNaN(input.size) || $guard(_exceptionable, {
|
|
1086
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
706
1087
|
path: _path + ".size",
|
|
707
|
-
expected: "number",
|
|
1088
|
+
expected: "number & Minimum<0>",
|
|
708
1089
|
value: input.size
|
|
709
|
-
}, errorFactory)) && (0 <= input.size || $guard(_exceptionable, {
|
|
1090
|
+
}, errorFactory)) && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
|
|
710
1091
|
path: _path + ".size",
|
|
711
|
-
expected: "number &
|
|
1092
|
+
expected: "number & Type<\"uint32\">",
|
|
712
1093
|
value: input.size
|
|
713
1094
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
714
1095
|
path: _path + ".size",
|
|
715
|
-
expected: "(
|
|
1096
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
716
1097
|
value: input.size
|
|
717
|
-
}, errorFactory)) && (
|
|
1098
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
718
1099
|
path: _path + ".hash",
|
|
719
|
-
expected: "
|
|
1100
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
720
1101
|
value: input.hash
|
|
721
1102
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
722
1103
|
path: _path + ".hash",
|
|
723
|
-
expected: "(
|
|
1104
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
724
1105
|
value: input.hash
|
|
725
|
-
}, errorFactory)) && (
|
|
1106
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
726
1107
|
path: _path + ".btime",
|
|
727
|
-
expected: "number",
|
|
1108
|
+
expected: "number & Minimum<0>",
|
|
728
1109
|
value: input.btime
|
|
729
|
-
}, errorFactory)) && (0 <= input.btime || $guard(_exceptionable, {
|
|
1110
|
+
}, errorFactory)) && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
|
|
730
1111
|
path: _path + ".btime",
|
|
731
|
-
expected: "number &
|
|
1112
|
+
expected: "number & Type<\"uint32\">",
|
|
732
1113
|
value: input.btime
|
|
733
1114
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
734
1115
|
path: _path + ".btime",
|
|
735
|
-
expected: "(
|
|
1116
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
736
1117
|
value: input.btime
|
|
1118
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
1119
|
+
path: _path + ".path",
|
|
1120
|
+
expected: "string",
|
|
1121
|
+
value: input.path
|
|
737
1122
|
}, errorFactory));
|
|
738
1123
|
return (Array.isArray(input) || $guard(true, {
|
|
739
1124
|
path: _path + "",
|
|
@@ -756,6 +1141,5 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
756
1141
|
return input;
|
|
757
1142
|
}; const stringify = input => {
|
|
758
1143
|
const $string = __typia.json.createAssertStringify.string;
|
|
759
|
-
|
|
760
|
-
return `[${input.map(elem => $so0(elem)).join(",")}]`;
|
|
1144
|
+
return `[${input.map(elem => `{"id":${$string(elem.id)},"file":${$string(elem.file)},"location":${$string(elem.location)},"offset":${elem.offset},"size":${elem.size},"hash":${$string(elem.hash)},"btime":${elem.btime},"path":${$string(elem.path)}}`).join(",")}]`;
|
|
761
1145
|
}; return stringify(assert(input, errorFactory)); };
|