@nxtedition/types 1.2.1 → 1.2.3
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 +6 -6
- package/dist/common/block.js +276 -407
- package/dist/common/file.d.ts +4 -5
- package/dist/common/file.js +109 -153
- package/package.json +1 -1
package/dist/common/block.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
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) => {
|
|
@@ -35,15 +33,7 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
35
33
|
path: _path + ".location",
|
|
36
34
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
37
35
|
value: input.location
|
|
38
|
-
}, errorFactory)) && ("
|
|
39
|
-
path: _path + ".block",
|
|
40
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
41
|
-
value: input.block
|
|
42
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
43
|
-
path: _path + ".block",
|
|
44
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
45
|
-
value: input.block
|
|
46
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
36
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
47
37
|
path: _path + ".offset",
|
|
48
38
|
expected: "number & Minimum<0>",
|
|
49
39
|
value: input.offset
|
|
@@ -53,9 +43,9 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
53
43
|
value: input.offset
|
|
54
44
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
55
45
|
path: _path + ".offset",
|
|
56
|
-
expected: "(
|
|
46
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
57
47
|
value: input.offset
|
|
58
|
-
}, errorFactory)) && (
|
|
48
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
59
49
|
path: _path + ".size",
|
|
60
50
|
expected: "number & Minimum<0>",
|
|
61
51
|
value: input.size
|
|
@@ -65,17 +55,17 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
65
55
|
value: input.size
|
|
66
56
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
67
57
|
path: _path + ".size",
|
|
68
|
-
expected: "(
|
|
58
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
69
59
|
value: input.size
|
|
70
|
-
}, errorFactory)) && (
|
|
60
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
71
61
|
path: _path + ".hash",
|
|
72
|
-
expected: "
|
|
62
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
73
63
|
value: input.hash
|
|
74
64
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
75
65
|
path: _path + ".hash",
|
|
76
|
-
expected: "(
|
|
66
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
77
67
|
value: input.hash
|
|
78
|
-
}, errorFactory)) && (
|
|
68
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
79
69
|
path: _path + ".btime",
|
|
80
70
|
expected: "number & Minimum<0>",
|
|
81
71
|
value: input.btime
|
|
@@ -85,8 +75,12 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
85
75
|
value: input.btime
|
|
86
76
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
87
77
|
path: _path + ".btime",
|
|
88
|
-
expected: "(
|
|
78
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
89
79
|
value: input.btime
|
|
80
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
81
|
+
path: _path + ".path",
|
|
82
|
+
expected: "string",
|
|
83
|
+
value: input.path
|
|
90
84
|
}, errorFactory));
|
|
91
85
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
92
86
|
path: _path + "",
|
|
@@ -102,7 +96,6 @@ export const assertBlock = (input, errorFactory) => {
|
|
|
102
96
|
};
|
|
103
97
|
export const randomBlock = generator => {
|
|
104
98
|
const $generator = __typia.createRandom.generator;
|
|
105
|
-
const $pick = __typia.createRandom.pick;
|
|
106
99
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
107
100
|
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
108
101
|
{
|
|
@@ -125,82 +118,56 @@ export const randomBlock = generator => {
|
|
|
125
118
|
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
126
119
|
}
|
|
127
120
|
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
128
|
-
|
|
121
|
+
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
129
122
|
{
|
|
130
|
-
name: "
|
|
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})?$\">",
|
|
131
148
|
kind: "pattern",
|
|
132
|
-
value: "^[
|
|
149
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
133
150
|
}
|
|
134
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
149
|
-
])(),
|
|
150
|
-
size: $pick([
|
|
151
|
-
() => null,
|
|
152
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
153
|
-
{
|
|
154
|
-
name: "Minimum<0>",
|
|
155
|
-
kind: "minimum",
|
|
156
|
-
value: 0
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: "Type<\"uint32\">",
|
|
160
|
-
kind: "type",
|
|
161
|
-
value: "uint32"
|
|
162
|
-
}
|
|
163
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
164
|
-
])(),
|
|
165
|
-
hash: $pick([
|
|
166
|
-
() => null,
|
|
167
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
168
|
-
{
|
|
169
|
-
name: "MaxLength<0>",
|
|
170
|
-
kind: "maxLength",
|
|
171
|
-
value: 0
|
|
172
|
-
}
|
|
173
|
-
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(0, 0)),
|
|
174
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
175
|
-
{
|
|
176
|
-
name: "Pattern<\"^[A-Fa-f0-9]{32}$\">",
|
|
177
|
-
kind: "pattern",
|
|
178
|
-
value: "^[A-Fa-f0-9]{32}$"
|
|
179
|
-
}
|
|
180
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[A-Fa-f0-9]{32}$/)
|
|
181
|
-
])(),
|
|
182
|
-
btime: $pick([
|
|
183
|
-
() => null,
|
|
184
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
185
|
-
{
|
|
186
|
-
name: "Minimum<0>",
|
|
187
|
-
kind: "minimum",
|
|
188
|
-
value: 0
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "Type<\"uint32\">",
|
|
192
|
-
kind: "type",
|
|
193
|
-
value: "uint32"
|
|
194
|
-
}
|
|
195
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
196
|
-
])()
|
|
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
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "Type<\"uint32\">",
|
|
160
|
+
kind: "type",
|
|
161
|
+
value: "uint32"
|
|
162
|
+
}
|
|
163
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
164
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
197
165
|
});
|
|
198
166
|
return $ro0();
|
|
199
167
|
};
|
|
200
168
|
export const assertGuardBlock = (input, errorFactory) => {
|
|
201
169
|
const __is = input => {
|
|
202
|
-
|
|
203
|
-
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);
|
|
204
171
|
};
|
|
205
172
|
if (false === __is(input))
|
|
206
173
|
((input, _path, _exceptionable = true) => {
|
|
@@ -229,15 +196,7 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
229
196
|
path: _path + ".location",
|
|
230
197
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
231
198
|
value: input.location
|
|
232
|
-
}, errorFactory)) && ("
|
|
233
|
-
path: _path + ".block",
|
|
234
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
235
|
-
value: input.block
|
|
236
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
237
|
-
path: _path + ".block",
|
|
238
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
239
|
-
value: input.block
|
|
240
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
199
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
241
200
|
path: _path + ".offset",
|
|
242
201
|
expected: "number & Minimum<0>",
|
|
243
202
|
value: input.offset
|
|
@@ -247,9 +206,9 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
247
206
|
value: input.offset
|
|
248
207
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
249
208
|
path: _path + ".offset",
|
|
250
|
-
expected: "(
|
|
209
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
251
210
|
value: input.offset
|
|
252
|
-
}, errorFactory)) && (
|
|
211
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
253
212
|
path: _path + ".size",
|
|
254
213
|
expected: "number & Minimum<0>",
|
|
255
214
|
value: input.size
|
|
@@ -259,17 +218,17 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
259
218
|
value: input.size
|
|
260
219
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
261
220
|
path: _path + ".size",
|
|
262
|
-
expected: "(
|
|
221
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
263
222
|
value: input.size
|
|
264
|
-
}, errorFactory)) && (
|
|
223
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
265
224
|
path: _path + ".hash",
|
|
266
|
-
expected: "
|
|
225
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
267
226
|
value: input.hash
|
|
268
227
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
269
228
|
path: _path + ".hash",
|
|
270
|
-
expected: "(
|
|
229
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
271
230
|
value: input.hash
|
|
272
|
-
}, errorFactory)) && (
|
|
231
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
273
232
|
path: _path + ".btime",
|
|
274
233
|
expected: "number & Minimum<0>",
|
|
275
234
|
value: input.btime
|
|
@@ -279,8 +238,12 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
279
238
|
value: input.btime
|
|
280
239
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
281
240
|
path: _path + ".btime",
|
|
282
|
-
expected: "(
|
|
241
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
283
242
|
value: input.btime
|
|
243
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
244
|
+
path: _path + ".path",
|
|
245
|
+
expected: "string",
|
|
246
|
+
value: input.path
|
|
284
247
|
}, errorFactory));
|
|
285
248
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
286
249
|
path: _path + "",
|
|
@@ -295,13 +258,11 @@ export const assertGuardBlock = (input, errorFactory) => {
|
|
|
295
258
|
};
|
|
296
259
|
export const stringifyBlock = input => {
|
|
297
260
|
const $string = __typia.json.createStringify.string;
|
|
298
|
-
|
|
299
|
-
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)}}`;
|
|
300
262
|
};
|
|
301
263
|
export const assertStringifyBlock = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
302
264
|
const __is = input => {
|
|
303
|
-
|
|
304
|
-
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);
|
|
305
266
|
};
|
|
306
267
|
if (false === __is(input))
|
|
307
268
|
((input, _path, _exceptionable = true) => {
|
|
@@ -330,15 +291,7 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
330
291
|
path: _path + ".location",
|
|
331
292
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
332
293
|
value: input.location
|
|
333
|
-
}, errorFactory)) && ("
|
|
334
|
-
path: _path + ".block",
|
|
335
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
336
|
-
value: input.block
|
|
337
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
338
|
-
path: _path + ".block",
|
|
339
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
340
|
-
value: input.block
|
|
341
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
294
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
342
295
|
path: _path + ".offset",
|
|
343
296
|
expected: "number & Minimum<0>",
|
|
344
297
|
value: input.offset
|
|
@@ -348,9 +301,9 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
348
301
|
value: input.offset
|
|
349
302
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
350
303
|
path: _path + ".offset",
|
|
351
|
-
expected: "(
|
|
304
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
352
305
|
value: input.offset
|
|
353
|
-
}, errorFactory)) && (
|
|
306
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
354
307
|
path: _path + ".size",
|
|
355
308
|
expected: "number & Minimum<0>",
|
|
356
309
|
value: input.size
|
|
@@ -360,17 +313,17 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
360
313
|
value: input.size
|
|
361
314
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
362
315
|
path: _path + ".size",
|
|
363
|
-
expected: "(
|
|
316
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
364
317
|
value: input.size
|
|
365
|
-
}, errorFactory)) && (
|
|
318
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
366
319
|
path: _path + ".hash",
|
|
367
|
-
expected: "
|
|
320
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
368
321
|
value: input.hash
|
|
369
322
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
370
323
|
path: _path + ".hash",
|
|
371
|
-
expected: "(
|
|
324
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
372
325
|
value: input.hash
|
|
373
|
-
}, errorFactory)) && (
|
|
326
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
374
327
|
path: _path + ".btime",
|
|
375
328
|
expected: "number & Minimum<0>",
|
|
376
329
|
value: input.btime
|
|
@@ -380,8 +333,12 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
380
333
|
value: input.btime
|
|
381
334
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
382
335
|
path: _path + ".btime",
|
|
383
|
-
expected: "(
|
|
336
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
384
337
|
value: input.btime
|
|
338
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
339
|
+
path: _path + ".path",
|
|
340
|
+
expected: "string",
|
|
341
|
+
value: input.path
|
|
385
342
|
}, errorFactory));
|
|
386
343
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
387
344
|
path: _path + "",
|
|
@@ -396,22 +353,19 @@ export const assertStringifyBlock = (input, errorFactory) => { const assert = (i
|
|
|
396
353
|
return input;
|
|
397
354
|
}; const stringify = input => {
|
|
398
355
|
const $string = __typia.json.createAssertStringify.string;
|
|
399
|
-
|
|
400
|
-
return $so0(input);
|
|
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)}}`;
|
|
401
357
|
}; return stringify(assert(input, errorFactory)); };
|
|
402
358
|
export const isBlockStats = input => {
|
|
403
|
-
|
|
404
|
-
return "object" === typeof input && null !== input && $io0(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);
|
|
405
360
|
};
|
|
406
361
|
export const assertBlockStats = (input, errorFactory) => {
|
|
407
362
|
const __is = input => {
|
|
408
|
-
|
|
409
|
-
return "object" === typeof input && null !== input && $io0(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);
|
|
410
364
|
};
|
|
411
365
|
if (false === __is(input))
|
|
412
366
|
((input, _path, _exceptionable = true) => {
|
|
413
367
|
const $guard = __typia.createAssert.guard;
|
|
414
|
-
const $ao0 = (input, _path, _exceptionable = true) => (
|
|
368
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
415
369
|
path: _path + ".position",
|
|
416
370
|
expected: "number & Minimum<0>",
|
|
417
371
|
value: input.position
|
|
@@ -421,7 +375,7 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
421
375
|
value: input.position
|
|
422
376
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
423
377
|
path: _path + ".position",
|
|
424
|
-
expected: "(
|
|
378
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
425
379
|
value: input.position
|
|
426
380
|
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
427
381
|
path: _path + ".id",
|
|
@@ -447,15 +401,7 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
447
401
|
path: _path + ".location",
|
|
448
402
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
449
403
|
value: input.location
|
|
450
|
-
}, errorFactory)) && ("
|
|
451
|
-
path: _path + ".block",
|
|
452
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
453
|
-
value: input.block
|
|
454
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
455
|
-
path: _path + ".block",
|
|
456
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
457
|
-
value: input.block
|
|
458
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
404
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
459
405
|
path: _path + ".offset",
|
|
460
406
|
expected: "number & Minimum<0>",
|
|
461
407
|
value: input.offset
|
|
@@ -465,9 +411,9 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
465
411
|
value: input.offset
|
|
466
412
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
467
413
|
path: _path + ".offset",
|
|
468
|
-
expected: "(
|
|
414
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
469
415
|
value: input.offset
|
|
470
|
-
}, errorFactory)) && (
|
|
416
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
471
417
|
path: _path + ".size",
|
|
472
418
|
expected: "number & Minimum<0>",
|
|
473
419
|
value: input.size
|
|
@@ -477,17 +423,17 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
477
423
|
value: input.size
|
|
478
424
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
479
425
|
path: _path + ".size",
|
|
480
|
-
expected: "(
|
|
426
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
481
427
|
value: input.size
|
|
482
|
-
}, errorFactory)) && (
|
|
428
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
483
429
|
path: _path + ".hash",
|
|
484
|
-
expected: "
|
|
430
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
485
431
|
value: input.hash
|
|
486
432
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
487
433
|
path: _path + ".hash",
|
|
488
|
-
expected: "(
|
|
434
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
489
435
|
value: input.hash
|
|
490
|
-
}, errorFactory)) && (
|
|
436
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
491
437
|
path: _path + ".btime",
|
|
492
438
|
expected: "number & Minimum<0>",
|
|
493
439
|
value: input.btime
|
|
@@ -497,8 +443,12 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
497
443
|
value: input.btime
|
|
498
444
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
499
445
|
path: _path + ".btime",
|
|
500
|
-
expected: "(
|
|
446
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
501
447
|
value: input.btime
|
|
448
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
449
|
+
path: _path + ".path",
|
|
450
|
+
expected: "string",
|
|
451
|
+
value: input.path
|
|
502
452
|
}, errorFactory));
|
|
503
453
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
504
454
|
path: _path + "",
|
|
@@ -514,23 +464,19 @@ export const assertBlockStats = (input, errorFactory) => {
|
|
|
514
464
|
};
|
|
515
465
|
export const randomBlockStats = generator => {
|
|
516
466
|
const $generator = __typia.createRandom.generator;
|
|
517
|
-
const $pick = __typia.createRandom.pick;
|
|
518
467
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
519
|
-
position: $
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
533
|
-
])(),
|
|
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),
|
|
534
480
|
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
535
481
|
{
|
|
536
482
|
name: "Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
@@ -552,87 +498,61 @@ export const randomBlockStats = generator => {
|
|
|
552
498
|
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
553
499
|
}
|
|
554
500
|
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
555
|
-
|
|
501
|
+
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
556
502
|
{
|
|
557
|
-
name: "
|
|
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})?$\">",
|
|
558
528
|
kind: "pattern",
|
|
559
|
-
value: "^[
|
|
529
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
560
530
|
}
|
|
561
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
576
|
-
])(),
|
|
577
|
-
size: $pick([
|
|
578
|
-
() => null,
|
|
579
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
580
|
-
{
|
|
581
|
-
name: "Minimum<0>",
|
|
582
|
-
kind: "minimum",
|
|
583
|
-
value: 0
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
name: "Type<\"uint32\">",
|
|
587
|
-
kind: "type",
|
|
588
|
-
value: "uint32"
|
|
589
|
-
}
|
|
590
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
591
|
-
])(),
|
|
592
|
-
hash: $pick([
|
|
593
|
-
() => null,
|
|
594
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
595
|
-
{
|
|
596
|
-
name: "MaxLength<0>",
|
|
597
|
-
kind: "maxLength",
|
|
598
|
-
value: 0
|
|
599
|
-
}
|
|
600
|
-
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(0, 0)),
|
|
601
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
602
|
-
{
|
|
603
|
-
name: "Pattern<\"^[A-Fa-f0-9]{32}$\">",
|
|
604
|
-
kind: "pattern",
|
|
605
|
-
value: "^[A-Fa-f0-9]{32}$"
|
|
606
|
-
}
|
|
607
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[A-Fa-f0-9]{32}$/)
|
|
608
|
-
])(),
|
|
609
|
-
btime: $pick([
|
|
610
|
-
() => null,
|
|
611
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
612
|
-
{
|
|
613
|
-
name: "Minimum<0>",
|
|
614
|
-
kind: "minimum",
|
|
615
|
-
value: 0
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
name: "Type<\"uint32\">",
|
|
619
|
-
kind: "type",
|
|
620
|
-
value: "uint32"
|
|
621
|
-
}
|
|
622
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
623
|
-
])()
|
|
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)()
|
|
624
545
|
});
|
|
625
546
|
return $ro0();
|
|
626
547
|
};
|
|
627
548
|
export const assertGuardBlockStats = (input, errorFactory) => {
|
|
628
549
|
const __is = input => {
|
|
629
|
-
|
|
630
|
-
return "object" === typeof input && null !== input && $io0(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);
|
|
631
551
|
};
|
|
632
552
|
if (false === __is(input))
|
|
633
553
|
((input, _path, _exceptionable = true) => {
|
|
634
554
|
const $guard = __typia.createAssertGuard.guard;
|
|
635
|
-
const $ao0 = (input, _path, _exceptionable = true) => (
|
|
555
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
636
556
|
path: _path + ".position",
|
|
637
557
|
expected: "number & Minimum<0>",
|
|
638
558
|
value: input.position
|
|
@@ -642,7 +562,7 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
642
562
|
value: input.position
|
|
643
563
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
644
564
|
path: _path + ".position",
|
|
645
|
-
expected: "(
|
|
565
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
646
566
|
value: input.position
|
|
647
567
|
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
648
568
|
path: _path + ".id",
|
|
@@ -668,15 +588,7 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
668
588
|
path: _path + ".location",
|
|
669
589
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
670
590
|
value: input.location
|
|
671
|
-
}, errorFactory)) && ("
|
|
672
|
-
path: _path + ".block",
|
|
673
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
674
|
-
value: input.block
|
|
675
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
676
|
-
path: _path + ".block",
|
|
677
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
678
|
-
value: input.block
|
|
679
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
591
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
680
592
|
path: _path + ".offset",
|
|
681
593
|
expected: "number & Minimum<0>",
|
|
682
594
|
value: input.offset
|
|
@@ -686,9 +598,9 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
686
598
|
value: input.offset
|
|
687
599
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
688
600
|
path: _path + ".offset",
|
|
689
|
-
expected: "(
|
|
601
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
690
602
|
value: input.offset
|
|
691
|
-
}, errorFactory)) && (
|
|
603
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
692
604
|
path: _path + ".size",
|
|
693
605
|
expected: "number & Minimum<0>",
|
|
694
606
|
value: input.size
|
|
@@ -698,17 +610,17 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
698
610
|
value: input.size
|
|
699
611
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
700
612
|
path: _path + ".size",
|
|
701
|
-
expected: "(
|
|
613
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
702
614
|
value: input.size
|
|
703
|
-
}, errorFactory)) && (
|
|
615
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
704
616
|
path: _path + ".hash",
|
|
705
|
-
expected: "
|
|
617
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
706
618
|
value: input.hash
|
|
707
619
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
708
620
|
path: _path + ".hash",
|
|
709
|
-
expected: "(
|
|
621
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
710
622
|
value: input.hash
|
|
711
|
-
}, errorFactory)) && (
|
|
623
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
712
624
|
path: _path + ".btime",
|
|
713
625
|
expected: "number & Minimum<0>",
|
|
714
626
|
value: input.btime
|
|
@@ -718,8 +630,12 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
718
630
|
value: input.btime
|
|
719
631
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
720
632
|
path: _path + ".btime",
|
|
721
|
-
expected: "(
|
|
633
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
722
634
|
value: input.btime
|
|
635
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
636
|
+
path: _path + ".path",
|
|
637
|
+
expected: "string",
|
|
638
|
+
value: input.path
|
|
723
639
|
}, errorFactory));
|
|
724
640
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
725
641
|
path: _path + "",
|
|
@@ -734,18 +650,16 @@ export const assertGuardBlockStats = (input, errorFactory) => {
|
|
|
734
650
|
};
|
|
735
651
|
export const stringifyBlockStats = input => {
|
|
736
652
|
const $string = __typia.json.createStringify.string;
|
|
737
|
-
|
|
738
|
-
return $so0(input);
|
|
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)}}`;
|
|
739
654
|
};
|
|
740
655
|
export const assertStringifyBlockStats = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
741
656
|
const __is = input => {
|
|
742
|
-
|
|
743
|
-
return "object" === typeof input && null !== input && $io0(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);
|
|
744
658
|
};
|
|
745
659
|
if (false === __is(input))
|
|
746
660
|
((input, _path, _exceptionable = true) => {
|
|
747
661
|
const $guard = __typia.json.createAssertStringify.guard;
|
|
748
|
-
const $ao0 = (input, _path, _exceptionable = true) => (
|
|
662
|
+
const $ao0 = (input, _path, _exceptionable = true) => ("number" === typeof input.position && (0 <= input.position || $guard(_exceptionable, {
|
|
749
663
|
path: _path + ".position",
|
|
750
664
|
expected: "number & Minimum<0>",
|
|
751
665
|
value: input.position
|
|
@@ -755,7 +669,7 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
755
669
|
value: input.position
|
|
756
670
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
757
671
|
path: _path + ".position",
|
|
758
|
-
expected: "(
|
|
672
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
759
673
|
value: input.position
|
|
760
674
|
}, errorFactory)) && ("string" === typeof input.id && (/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/.test(input.id) || $guard(_exceptionable, {
|
|
761
675
|
path: _path + ".id",
|
|
@@ -781,15 +695,7 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
781
695
|
path: _path + ".location",
|
|
782
696
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
783
697
|
value: input.location
|
|
784
|
-
}, errorFactory)) && ("
|
|
785
|
-
path: _path + ".block",
|
|
786
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
787
|
-
value: input.block
|
|
788
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
789
|
-
path: _path + ".block",
|
|
790
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
791
|
-
value: input.block
|
|
792
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
698
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
793
699
|
path: _path + ".offset",
|
|
794
700
|
expected: "number & Minimum<0>",
|
|
795
701
|
value: input.offset
|
|
@@ -799,9 +705,9 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
799
705
|
value: input.offset
|
|
800
706
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
801
707
|
path: _path + ".offset",
|
|
802
|
-
expected: "(
|
|
708
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
803
709
|
value: input.offset
|
|
804
|
-
}, errorFactory)) && (
|
|
710
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
805
711
|
path: _path + ".size",
|
|
806
712
|
expected: "number & Minimum<0>",
|
|
807
713
|
value: input.size
|
|
@@ -811,17 +717,17 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
811
717
|
value: input.size
|
|
812
718
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
813
719
|
path: _path + ".size",
|
|
814
|
-
expected: "(
|
|
720
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
815
721
|
value: input.size
|
|
816
|
-
}, errorFactory)) && (
|
|
722
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
817
723
|
path: _path + ".hash",
|
|
818
|
-
expected: "
|
|
724
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
819
725
|
value: input.hash
|
|
820
726
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
821
727
|
path: _path + ".hash",
|
|
822
|
-
expected: "(
|
|
728
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
823
729
|
value: input.hash
|
|
824
|
-
}, errorFactory)) && (
|
|
730
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
825
731
|
path: _path + ".btime",
|
|
826
732
|
expected: "number & Minimum<0>",
|
|
827
733
|
value: input.btime
|
|
@@ -831,8 +737,12 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
831
737
|
value: input.btime
|
|
832
738
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
833
739
|
path: _path + ".btime",
|
|
834
|
-
expected: "(
|
|
740
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
835
741
|
value: input.btime
|
|
742
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
743
|
+
path: _path + ".path",
|
|
744
|
+
expected: "string",
|
|
745
|
+
value: input.path
|
|
836
746
|
}, errorFactory));
|
|
837
747
|
return ("object" === typeof input && null !== input || $guard(true, {
|
|
838
748
|
path: _path + "",
|
|
@@ -847,16 +757,15 @@ export const assertStringifyBlockStats = (input, errorFactory) => { const assert
|
|
|
847
757
|
return input;
|
|
848
758
|
}; const stringify = input => {
|
|
849
759
|
const $string = __typia.json.createAssertStringify.string;
|
|
850
|
-
|
|
851
|
-
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)}}`;
|
|
852
761
|
}; return stringify(assert(input, errorFactory)); };
|
|
853
762
|
export const isBlocks = input => {
|
|
854
|
-
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)) && ("
|
|
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;
|
|
855
764
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
856
765
|
};
|
|
857
766
|
export const assertBlocks = (input, errorFactory) => {
|
|
858
767
|
const __is = input => {
|
|
859
|
-
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)) && ("
|
|
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;
|
|
860
769
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
861
770
|
};
|
|
862
771
|
if (false === __is(input))
|
|
@@ -886,15 +795,7 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
886
795
|
path: _path + ".location",
|
|
887
796
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
888
797
|
value: input.location
|
|
889
|
-
}, errorFactory)) && ("
|
|
890
|
-
path: _path + ".block",
|
|
891
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
892
|
-
value: input.block
|
|
893
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
894
|
-
path: _path + ".block",
|
|
895
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
896
|
-
value: input.block
|
|
897
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
798
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
898
799
|
path: _path + ".offset",
|
|
899
800
|
expected: "number & Minimum<0>",
|
|
900
801
|
value: input.offset
|
|
@@ -904,9 +805,9 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
904
805
|
value: input.offset
|
|
905
806
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
906
807
|
path: _path + ".offset",
|
|
907
|
-
expected: "(
|
|
808
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
908
809
|
value: input.offset
|
|
909
|
-
}, errorFactory)) && (
|
|
810
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
910
811
|
path: _path + ".size",
|
|
911
812
|
expected: "number & Minimum<0>",
|
|
912
813
|
value: input.size
|
|
@@ -916,17 +817,17 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
916
817
|
value: input.size
|
|
917
818
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
918
819
|
path: _path + ".size",
|
|
919
|
-
expected: "(
|
|
820
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
920
821
|
value: input.size
|
|
921
|
-
}, errorFactory)) && (
|
|
822
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
922
823
|
path: _path + ".hash",
|
|
923
|
-
expected: "
|
|
824
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
924
825
|
value: input.hash
|
|
925
826
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
926
827
|
path: _path + ".hash",
|
|
927
|
-
expected: "(
|
|
828
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
928
829
|
value: input.hash
|
|
929
|
-
}, errorFactory)) && (
|
|
830
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
930
831
|
path: _path + ".btime",
|
|
931
832
|
expected: "number & Minimum<0>",
|
|
932
833
|
value: input.btime
|
|
@@ -936,8 +837,12 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
936
837
|
value: input.btime
|
|
937
838
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
938
839
|
path: _path + ".btime",
|
|
939
|
-
expected: "(
|
|
840
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
940
841
|
value: input.btime
|
|
842
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
843
|
+
path: _path + ".path",
|
|
844
|
+
expected: "string",
|
|
845
|
+
value: input.path
|
|
941
846
|
}, errorFactory));
|
|
942
847
|
return (Array.isArray(input) || $guard(true, {
|
|
943
848
|
path: _path + "",
|
|
@@ -961,7 +866,6 @@ export const assertBlocks = (input, errorFactory) => {
|
|
|
961
866
|
};
|
|
962
867
|
export const randomBlocks = generator => {
|
|
963
868
|
const $generator = __typia.createRandom.generator;
|
|
964
|
-
const $pick = __typia.createRandom.pick;
|
|
965
869
|
const $ro0 = (_recursive = false, _depth = 0) => ({
|
|
966
870
|
id: (generator?.customs ?? $generator.customs)?.string?.([
|
|
967
871
|
{
|
|
@@ -984,81 +888,56 @@ export const randomBlocks = generator => {
|
|
|
984
888
|
value: "^[0-9A-Za-z~][0-9A-Za-z~._: -]*$"
|
|
985
889
|
}
|
|
986
890
|
]) ?? (generator?.pattern ?? $generator.pattern)(/^[0-9A-Za-z~][0-9A-Za-z~._: -]*$/),
|
|
987
|
-
|
|
891
|
+
offset: (generator?.customs ?? $generator.customs)?.number?.([
|
|
988
892
|
{
|
|
989
|
-
name: "
|
|
893
|
+
name: "Minimum<0>",
|
|
894
|
+
kind: "minimum",
|
|
895
|
+
value: 0
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
name: "Type<\"uint32\">",
|
|
899
|
+
kind: "type",
|
|
900
|
+
value: "uint32"
|
|
901
|
+
}
|
|
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
|
+
},
|
|
909
|
+
{
|
|
910
|
+
name: "Type<\"uint32\">",
|
|
911
|
+
kind: "type",
|
|
912
|
+
value: "uint32"
|
|
913
|
+
}
|
|
914
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
915
|
+
hash: (generator?.customs ?? $generator.customs)?.string?.([
|
|
916
|
+
{
|
|
917
|
+
name: "Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
990
918
|
kind: "pattern",
|
|
991
|
-
value: "^[
|
|
919
|
+
value: "^([A-Fa-f0-9]{32})?$"
|
|
992
920
|
}
|
|
993
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
1008
|
-
])(),
|
|
1009
|
-
size: $pick([
|
|
1010
|
-
() => null,
|
|
1011
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
1012
|
-
{
|
|
1013
|
-
name: "Minimum<0>",
|
|
1014
|
-
kind: "minimum",
|
|
1015
|
-
value: 0
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
name: "Type<\"uint32\">",
|
|
1019
|
-
kind: "type",
|
|
1020
|
-
value: "uint32"
|
|
1021
|
-
}
|
|
1022
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
1023
|
-
])(),
|
|
1024
|
-
hash: $pick([
|
|
1025
|
-
() => null,
|
|
1026
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
1027
|
-
{
|
|
1028
|
-
name: "MaxLength<0>",
|
|
1029
|
-
kind: "maxLength",
|
|
1030
|
-
value: 0
|
|
1031
|
-
}
|
|
1032
|
-
]) ?? (generator?.string ?? $generator.string)((generator?.integer ?? $generator.integer)(0, 0)),
|
|
1033
|
-
() => (generator?.customs ?? $generator.customs)?.string?.([
|
|
1034
|
-
{
|
|
1035
|
-
name: "Pattern<\"^[A-Fa-f0-9]{32}$\">",
|
|
1036
|
-
kind: "pattern",
|
|
1037
|
-
value: "^[A-Fa-f0-9]{32}$"
|
|
1038
|
-
}
|
|
1039
|
-
]) ?? (generator?.pattern ?? $generator.pattern)(/^[A-Fa-f0-9]{32}$/)
|
|
1040
|
-
])(),
|
|
1041
|
-
btime: $pick([
|
|
1042
|
-
() => null,
|
|
1043
|
-
() => (generator?.customs ?? $generator.customs)?.number?.([
|
|
1044
|
-
{
|
|
1045
|
-
name: "Minimum<0>",
|
|
1046
|
-
kind: "minimum",
|
|
1047
|
-
value: 0
|
|
1048
|
-
},
|
|
1049
|
-
{
|
|
1050
|
-
name: "Type<\"uint32\">",
|
|
1051
|
-
kind: "type",
|
|
1052
|
-
value: "uint32"
|
|
1053
|
-
}
|
|
1054
|
-
]) ?? (generator?.integer ?? $generator.integer)(0, 10)
|
|
1055
|
-
])()
|
|
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
|
+
},
|
|
928
|
+
{
|
|
929
|
+
name: "Type<\"uint32\">",
|
|
930
|
+
kind: "type",
|
|
931
|
+
value: "uint32"
|
|
932
|
+
}
|
|
933
|
+
]) ?? (generator?.integer ?? $generator.integer)(0, 10),
|
|
934
|
+
path: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
|
|
1056
935
|
});
|
|
1057
936
|
return (generator?.array ?? $generator.array)(() => $ro0());
|
|
1058
937
|
};
|
|
1059
938
|
export const assertGuardBlocks = (input, errorFactory) => {
|
|
1060
939
|
const __is = input => {
|
|
1061
|
-
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)) && ("
|
|
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;
|
|
1062
941
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
1063
942
|
};
|
|
1064
943
|
if (false === __is(input))
|
|
@@ -1088,15 +967,7 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1088
967
|
path: _path + ".location",
|
|
1089
968
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1090
969
|
value: input.location
|
|
1091
|
-
}, errorFactory)) && ("
|
|
1092
|
-
path: _path + ".block",
|
|
1093
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
1094
|
-
value: input.block
|
|
1095
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
1096
|
-
path: _path + ".block",
|
|
1097
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1098
|
-
value: input.block
|
|
1099
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
970
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
1100
971
|
path: _path + ".offset",
|
|
1101
972
|
expected: "number & Minimum<0>",
|
|
1102
973
|
value: input.offset
|
|
@@ -1106,9 +977,9 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1106
977
|
value: input.offset
|
|
1107
978
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1108
979
|
path: _path + ".offset",
|
|
1109
|
-
expected: "(
|
|
980
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
1110
981
|
value: input.offset
|
|
1111
|
-
}, errorFactory)) && (
|
|
982
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
1112
983
|
path: _path + ".size",
|
|
1113
984
|
expected: "number & Minimum<0>",
|
|
1114
985
|
value: input.size
|
|
@@ -1118,17 +989,17 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1118
989
|
value: input.size
|
|
1119
990
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1120
991
|
path: _path + ".size",
|
|
1121
|
-
expected: "(
|
|
992
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
1122
993
|
value: input.size
|
|
1123
|
-
}, errorFactory)) && (
|
|
994
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
1124
995
|
path: _path + ".hash",
|
|
1125
|
-
expected: "
|
|
996
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
1126
997
|
value: input.hash
|
|
1127
998
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1128
999
|
path: _path + ".hash",
|
|
1129
|
-
expected: "(
|
|
1000
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
1130
1001
|
value: input.hash
|
|
1131
|
-
}, errorFactory)) && (
|
|
1002
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
1132
1003
|
path: _path + ".btime",
|
|
1133
1004
|
expected: "number & Minimum<0>",
|
|
1134
1005
|
value: input.btime
|
|
@@ -1138,8 +1009,12 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1138
1009
|
value: input.btime
|
|
1139
1010
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1140
1011
|
path: _path + ".btime",
|
|
1141
|
-
expected: "(
|
|
1012
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
1142
1013
|
value: input.btime
|
|
1014
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
1015
|
+
path: _path + ".path",
|
|
1016
|
+
expected: "string",
|
|
1017
|
+
value: input.path
|
|
1143
1018
|
}, errorFactory));
|
|
1144
1019
|
return (Array.isArray(input) || $guard(true, {
|
|
1145
1020
|
path: _path + "",
|
|
@@ -1162,12 +1037,11 @@ export const assertGuardBlocks = (input, errorFactory) => {
|
|
|
1162
1037
|
};
|
|
1163
1038
|
export const stringifyBlocks = input => {
|
|
1164
1039
|
const $string = __typia.json.createStringify.string;
|
|
1165
|
-
|
|
1166
|
-
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(",")}]`;
|
|
1167
1041
|
};
|
|
1168
1042
|
export const assertStringifyBlocks = (input, errorFactory) => { const assert = (input, errorFactory) => {
|
|
1169
1043
|
const __is = input => {
|
|
1170
|
-
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)) && ("
|
|
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;
|
|
1171
1045
|
return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
|
|
1172
1046
|
};
|
|
1173
1047
|
if (false === __is(input))
|
|
@@ -1197,15 +1071,7 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1197
1071
|
path: _path + ".location",
|
|
1198
1072
|
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1199
1073
|
value: input.location
|
|
1200
|
-
}, errorFactory)) && ("
|
|
1201
|
-
path: _path + ".block",
|
|
1202
|
-
expected: "string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">",
|
|
1203
|
-
value: input.block
|
|
1204
|
-
}, errorFactory)) || $guard(_exceptionable, {
|
|
1205
|
-
path: _path + ".block",
|
|
1206
|
-
expected: "(string & Pattern<\"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$\">)",
|
|
1207
|
-
value: input.block
|
|
1208
|
-
}, errorFactory)) && (null === input.offset || "number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
1074
|
+
}, errorFactory)) && ("number" === typeof input.offset && (0 <= input.offset || $guard(_exceptionable, {
|
|
1209
1075
|
path: _path + ".offset",
|
|
1210
1076
|
expected: "number & Minimum<0>",
|
|
1211
1077
|
value: input.offset
|
|
@@ -1215,9 +1081,9 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1215
1081
|
value: input.offset
|
|
1216
1082
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1217
1083
|
path: _path + ".offset",
|
|
1218
|
-
expected: "(
|
|
1084
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
1219
1085
|
value: input.offset
|
|
1220
|
-
}, errorFactory)) && (
|
|
1086
|
+
}, errorFactory)) && ("number" === typeof input.size && (0 <= input.size || $guard(_exceptionable, {
|
|
1221
1087
|
path: _path + ".size",
|
|
1222
1088
|
expected: "number & Minimum<0>",
|
|
1223
1089
|
value: input.size
|
|
@@ -1227,17 +1093,17 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1227
1093
|
value: input.size
|
|
1228
1094
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1229
1095
|
path: _path + ".size",
|
|
1230
|
-
expected: "(
|
|
1096
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
1231
1097
|
value: input.size
|
|
1232
|
-
}, errorFactory)) && (
|
|
1098
|
+
}, errorFactory)) && ("string" === typeof input.hash && (/^([A-Fa-f0-9]{32})?$/.test(input.hash) || $guard(_exceptionable, {
|
|
1233
1099
|
path: _path + ".hash",
|
|
1234
|
-
expected: "
|
|
1100
|
+
expected: "string & Pattern<\"^([A-Fa-f0-9]{32})?$\">",
|
|
1235
1101
|
value: input.hash
|
|
1236
1102
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1237
1103
|
path: _path + ".hash",
|
|
1238
|
-
expected: "(
|
|
1104
|
+
expected: "(string & Pattern<\"^([A-Fa-f0-9]{32})?$\">)",
|
|
1239
1105
|
value: input.hash
|
|
1240
|
-
}, errorFactory)) && (
|
|
1106
|
+
}, errorFactory)) && ("number" === typeof input.btime && (0 <= input.btime || $guard(_exceptionable, {
|
|
1241
1107
|
path: _path + ".btime",
|
|
1242
1108
|
expected: "number & Minimum<0>",
|
|
1243
1109
|
value: input.btime
|
|
@@ -1247,8 +1113,12 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1247
1113
|
value: input.btime
|
|
1248
1114
|
}, errorFactory)) || $guard(_exceptionable, {
|
|
1249
1115
|
path: _path + ".btime",
|
|
1250
|
-
expected: "(
|
|
1116
|
+
expected: "(number & Minimum<0> & Type<\"uint32\">)",
|
|
1251
1117
|
value: input.btime
|
|
1118
|
+
}, errorFactory)) && ("string" === typeof input.path || $guard(_exceptionable, {
|
|
1119
|
+
path: _path + ".path",
|
|
1120
|
+
expected: "string",
|
|
1121
|
+
value: input.path
|
|
1252
1122
|
}, errorFactory));
|
|
1253
1123
|
return (Array.isArray(input) || $guard(true, {
|
|
1254
1124
|
path: _path + "",
|
|
@@ -1271,6 +1141,5 @@ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (
|
|
|
1271
1141
|
return input;
|
|
1272
1142
|
}; const stringify = input => {
|
|
1273
1143
|
const $string = __typia.json.createAssertStringify.string;
|
|
1274
|
-
|
|
1275
|
-
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(",")}]`;
|
|
1276
1145
|
}; return stringify(assert(input, errorFactory)); };
|