@nxtedition/types 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,571 @@
1
+ import __typia from "typia";
2
+ export const isBlock = input => {
3
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
4
+ return "object" === typeof input && null !== input && $io0(input);
5
+ };
6
+ export const assertBlock = (input, errorFactory) => {
7
+ const __is = input => {
8
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
9
+ return "object" === typeof input && null !== input && $io0(input);
10
+ };
11
+ if (false === __is(input))
12
+ ((input, _path, _exceptionable = true) => {
13
+ const $guard = __typia.createAssert.guard;
14
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.fileId || $guard(_exceptionable, {
15
+ path: _path + ".fileId",
16
+ expected: "string",
17
+ value: input.fileId
18
+ }, errorFactory)) && ("string" === typeof input.locationId || $guard(_exceptionable, {
19
+ path: _path + ".locationId",
20
+ expected: "string",
21
+ value: input.locationId
22
+ }, errorFactory)) && ("string" === typeof input.blockId || $guard(_exceptionable, {
23
+ path: _path + ".blockId",
24
+ expected: "string",
25
+ value: input.blockId
26
+ }, errorFactory)) && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
27
+ path: _path + ".offset",
28
+ expected: "number & Type<\"uint32\">",
29
+ value: input.offset
30
+ }, errorFactory)) || $guard(_exceptionable, {
31
+ path: _path + ".offset",
32
+ expected: "((number & Type<\"uint32\">) | undefined)",
33
+ value: input.offset
34
+ }, errorFactory)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
35
+ path: _path + ".position",
36
+ expected: "number & Type<\"uint32\">",
37
+ value: input.position
38
+ }, errorFactory)) || $guard(_exceptionable, {
39
+ path: _path + ".position",
40
+ expected: "((number & Type<\"uint32\">) | undefined)",
41
+ value: input.position
42
+ }, errorFactory)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
43
+ path: _path + ".size",
44
+ expected: "number & Type<\"uint32\">",
45
+ value: input.size
46
+ }, errorFactory)) || $guard(_exceptionable, {
47
+ path: _path + ".size",
48
+ expected: "((number & Type<\"uint32\">) | undefined)",
49
+ value: input.size
50
+ }, errorFactory)) && (undefined === input.hash || "string" === typeof input.hash || $guard(_exceptionable, {
51
+ path: _path + ".hash",
52
+ expected: "(string | undefined)",
53
+ value: input.hash
54
+ }, errorFactory)) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
55
+ path: _path + ".btime",
56
+ expected: "number & Type<\"uint32\">",
57
+ value: input.btime
58
+ }, errorFactory)) || $guard(_exceptionable, {
59
+ path: _path + ".btime",
60
+ expected: "((number & Type<\"uint32\">) | undefined)",
61
+ value: input.btime
62
+ }, errorFactory));
63
+ return ("object" === typeof input && null !== input || $guard(true, {
64
+ path: _path + "",
65
+ expected: "Block",
66
+ value: input
67
+ }, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
68
+ path: _path + "",
69
+ expected: "Block",
70
+ value: input
71
+ }, errorFactory);
72
+ })(input, "$input", true);
73
+ return input;
74
+ };
75
+ export const randomBlock = generator => {
76
+ const $generator = __typia.createRandom.generator;
77
+ const $pick = __typia.createRandom.pick;
78
+ const $ro0 = (_recursive = false, _depth = 0) => ({
79
+ fileId: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
80
+ locationId: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
81
+ blockId: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
82
+ offset: $pick([
83
+ () => undefined,
84
+ () => (generator?.customs ?? $generator.customs)?.number?.([
85
+ {
86
+ name: "Type<\"uint32\">",
87
+ kind: "type",
88
+ value: "uint32"
89
+ }
90
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
91
+ ])(),
92
+ position: $pick([
93
+ () => undefined,
94
+ () => (generator?.customs ?? $generator.customs)?.number?.([
95
+ {
96
+ name: "Type<\"uint32\">",
97
+ kind: "type",
98
+ value: "uint32"
99
+ }
100
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
101
+ ])(),
102
+ size: $pick([
103
+ () => undefined,
104
+ () => (generator?.customs ?? $generator.customs)?.number?.([
105
+ {
106
+ name: "Type<\"uint32\">",
107
+ kind: "type",
108
+ value: "uint32"
109
+ }
110
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
111
+ ])(),
112
+ hash: $pick([
113
+ () => undefined,
114
+ () => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
115
+ ])(),
116
+ btime: $pick([
117
+ () => undefined,
118
+ () => (generator?.customs ?? $generator.customs)?.number?.([
119
+ {
120
+ name: "Type<\"uint32\">",
121
+ kind: "type",
122
+ value: "uint32"
123
+ }
124
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
125
+ ])()
126
+ });
127
+ return $ro0();
128
+ };
129
+ export const assertGuardBlock = (input, errorFactory) => {
130
+ const __is = input => {
131
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
132
+ return "object" === typeof input && null !== input && $io0(input);
133
+ };
134
+ if (false === __is(input))
135
+ ((input, _path, _exceptionable = true) => {
136
+ const $guard = __typia.createAssertGuard.guard;
137
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.fileId || $guard(_exceptionable, {
138
+ path: _path + ".fileId",
139
+ expected: "string",
140
+ value: input.fileId
141
+ }, errorFactory)) && ("string" === typeof input.locationId || $guard(_exceptionable, {
142
+ path: _path + ".locationId",
143
+ expected: "string",
144
+ value: input.locationId
145
+ }, errorFactory)) && ("string" === typeof input.blockId || $guard(_exceptionable, {
146
+ path: _path + ".blockId",
147
+ expected: "string",
148
+ value: input.blockId
149
+ }, errorFactory)) && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
150
+ path: _path + ".offset",
151
+ expected: "number & Type<\"uint32\">",
152
+ value: input.offset
153
+ }, errorFactory)) || $guard(_exceptionable, {
154
+ path: _path + ".offset",
155
+ expected: "((number & Type<\"uint32\">) | undefined)",
156
+ value: input.offset
157
+ }, errorFactory)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
158
+ path: _path + ".position",
159
+ expected: "number & Type<\"uint32\">",
160
+ value: input.position
161
+ }, errorFactory)) || $guard(_exceptionable, {
162
+ path: _path + ".position",
163
+ expected: "((number & Type<\"uint32\">) | undefined)",
164
+ value: input.position
165
+ }, errorFactory)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
166
+ path: _path + ".size",
167
+ expected: "number & Type<\"uint32\">",
168
+ value: input.size
169
+ }, errorFactory)) || $guard(_exceptionable, {
170
+ path: _path + ".size",
171
+ expected: "((number & Type<\"uint32\">) | undefined)",
172
+ value: input.size
173
+ }, errorFactory)) && (undefined === input.hash || "string" === typeof input.hash || $guard(_exceptionable, {
174
+ path: _path + ".hash",
175
+ expected: "(string | undefined)",
176
+ value: input.hash
177
+ }, errorFactory)) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
178
+ path: _path + ".btime",
179
+ expected: "number & Type<\"uint32\">",
180
+ value: input.btime
181
+ }, errorFactory)) || $guard(_exceptionable, {
182
+ path: _path + ".btime",
183
+ expected: "((number & Type<\"uint32\">) | undefined)",
184
+ value: input.btime
185
+ }, errorFactory));
186
+ return ("object" === typeof input && null !== input || $guard(true, {
187
+ path: _path + "",
188
+ expected: "Block",
189
+ value: input
190
+ }, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
191
+ path: _path + "",
192
+ expected: "Block",
193
+ value: input
194
+ }, errorFactory);
195
+ })(input, "$input", true);
196
+ };
197
+ export const stringifyBlock = input => {
198
+ const $string = __typia.json.createStringify.string;
199
+ const $so0 = input => `{${undefined === input.offset ? "" : `"offset":${undefined !== input.offset ? input.offset : undefined},`}${undefined === input.position ? "" : `"position":${undefined !== input.position ? input.position : undefined},`}${undefined === input.size ? "" : `"size":${undefined !== input.size ? input.size : undefined},`}${undefined === input.hash ? "" : `"hash":${undefined !== input.hash ? $string(input.hash) : undefined},`}${undefined === input.btime ? "" : `"btime":${undefined !== input.btime ? input.btime : undefined},`}"fileId":${$string(input.fileId)},"locationId":${$string(input.locationId)},"blockId":${$string(input.blockId)}}`;
200
+ return $so0(input);
201
+ };
202
+ export const assertStringifyBlock = (input, errorFactory) => { const assert = (input, errorFactory) => {
203
+ const __is = input => {
204
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
205
+ return "object" === typeof input && null !== input && $io0(input);
206
+ };
207
+ if (false === __is(input))
208
+ ((input, _path, _exceptionable = true) => {
209
+ const $guard = __typia.json.createAssertStringify.guard;
210
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.fileId || $guard(_exceptionable, {
211
+ path: _path + ".fileId",
212
+ expected: "string",
213
+ value: input.fileId
214
+ }, errorFactory)) && ("string" === typeof input.locationId || $guard(_exceptionable, {
215
+ path: _path + ".locationId",
216
+ expected: "string",
217
+ value: input.locationId
218
+ }, errorFactory)) && ("string" === typeof input.blockId || $guard(_exceptionable, {
219
+ path: _path + ".blockId",
220
+ expected: "string",
221
+ value: input.blockId
222
+ }, errorFactory)) && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
223
+ path: _path + ".offset",
224
+ expected: "number & Type<\"uint32\">",
225
+ value: input.offset
226
+ }, errorFactory)) || $guard(_exceptionable, {
227
+ path: _path + ".offset",
228
+ expected: "((number & Type<\"uint32\">) | undefined)",
229
+ value: input.offset
230
+ }, errorFactory)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
231
+ path: _path + ".position",
232
+ expected: "number & Type<\"uint32\">",
233
+ value: input.position
234
+ }, errorFactory)) || $guard(_exceptionable, {
235
+ path: _path + ".position",
236
+ expected: "((number & Type<\"uint32\">) | undefined)",
237
+ value: input.position
238
+ }, errorFactory)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
239
+ path: _path + ".size",
240
+ expected: "number & Type<\"uint32\">",
241
+ value: input.size
242
+ }, errorFactory)) || $guard(_exceptionable, {
243
+ path: _path + ".size",
244
+ expected: "((number & Type<\"uint32\">) | undefined)",
245
+ value: input.size
246
+ }, errorFactory)) && (undefined === input.hash || "string" === typeof input.hash || $guard(_exceptionable, {
247
+ path: _path + ".hash",
248
+ expected: "(string | undefined)",
249
+ value: input.hash
250
+ }, errorFactory)) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
251
+ path: _path + ".btime",
252
+ expected: "number & Type<\"uint32\">",
253
+ value: input.btime
254
+ }, errorFactory)) || $guard(_exceptionable, {
255
+ path: _path + ".btime",
256
+ expected: "((number & Type<\"uint32\">) | undefined)",
257
+ value: input.btime
258
+ }, errorFactory));
259
+ return ("object" === typeof input && null !== input || $guard(true, {
260
+ path: _path + "",
261
+ expected: "Block",
262
+ value: input
263
+ }, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
264
+ path: _path + "",
265
+ expected: "Block",
266
+ value: input
267
+ }, errorFactory);
268
+ })(input, "$input", true);
269
+ return input;
270
+ }; const stringify = input => {
271
+ const $string = __typia.json.createAssertStringify.string;
272
+ const $so0 = input => `{${undefined === input.offset ? "" : `"offset":${undefined !== input.offset ? input.offset : undefined},`}${undefined === input.position ? "" : `"position":${undefined !== input.position ? input.position : undefined},`}${undefined === input.size ? "" : `"size":${undefined !== input.size ? input.size : undefined},`}${undefined === input.hash ? "" : `"hash":${undefined !== input.hash ? $string(input.hash) : undefined},`}${undefined === input.btime ? "" : `"btime":${undefined !== input.btime ? input.btime : undefined},`}"fileId":${$string(input.fileId)},"locationId":${$string(input.locationId)},"blockId":${$string(input.blockId)}}`;
273
+ return $so0(input);
274
+ }; return stringify(assert(input, errorFactory)); };
275
+ export const isBlocks = input => {
276
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
277
+ return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
278
+ };
279
+ export const assertBlocks = (input, errorFactory) => {
280
+ const __is = input => {
281
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
282
+ return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
283
+ };
284
+ if (false === __is(input))
285
+ ((input, _path, _exceptionable = true) => {
286
+ const $guard = __typia.createAssert.guard;
287
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.fileId || $guard(_exceptionable, {
288
+ path: _path + ".fileId",
289
+ expected: "string",
290
+ value: input.fileId
291
+ }, errorFactory)) && ("string" === typeof input.locationId || $guard(_exceptionable, {
292
+ path: _path + ".locationId",
293
+ expected: "string",
294
+ value: input.locationId
295
+ }, errorFactory)) && ("string" === typeof input.blockId || $guard(_exceptionable, {
296
+ path: _path + ".blockId",
297
+ expected: "string",
298
+ value: input.blockId
299
+ }, errorFactory)) && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
300
+ path: _path + ".offset",
301
+ expected: "number & Type<\"uint32\">",
302
+ value: input.offset
303
+ }, errorFactory)) || $guard(_exceptionable, {
304
+ path: _path + ".offset",
305
+ expected: "((number & Type<\"uint32\">) | undefined)",
306
+ value: input.offset
307
+ }, errorFactory)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
308
+ path: _path + ".position",
309
+ expected: "number & Type<\"uint32\">",
310
+ value: input.position
311
+ }, errorFactory)) || $guard(_exceptionable, {
312
+ path: _path + ".position",
313
+ expected: "((number & Type<\"uint32\">) | undefined)",
314
+ value: input.position
315
+ }, errorFactory)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
316
+ path: _path + ".size",
317
+ expected: "number & Type<\"uint32\">",
318
+ value: input.size
319
+ }, errorFactory)) || $guard(_exceptionable, {
320
+ path: _path + ".size",
321
+ expected: "((number & Type<\"uint32\">) | undefined)",
322
+ value: input.size
323
+ }, errorFactory)) && (undefined === input.hash || "string" === typeof input.hash || $guard(_exceptionable, {
324
+ path: _path + ".hash",
325
+ expected: "(string | undefined)",
326
+ value: input.hash
327
+ }, errorFactory)) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
328
+ path: _path + ".btime",
329
+ expected: "number & Type<\"uint32\">",
330
+ value: input.btime
331
+ }, errorFactory)) || $guard(_exceptionable, {
332
+ path: _path + ".btime",
333
+ expected: "((number & Type<\"uint32\">) | undefined)",
334
+ value: input.btime
335
+ }, errorFactory));
336
+ return (Array.isArray(input) || $guard(true, {
337
+ path: _path + "",
338
+ expected: "Blocks",
339
+ value: input
340
+ }, errorFactory)) && input.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(true, {
341
+ path: _path + "[" + _index1 + "]",
342
+ expected: "Block",
343
+ value: elem
344
+ }, errorFactory)) && $ao0(elem, _path + "[" + _index1 + "]", true) || $guard(true, {
345
+ path: _path + "[" + _index1 + "]",
346
+ expected: "Block",
347
+ value: elem
348
+ }, errorFactory)) || $guard(true, {
349
+ path: _path + "",
350
+ expected: "Blocks",
351
+ value: input
352
+ }, errorFactory);
353
+ })(input, "$input", true);
354
+ return input;
355
+ };
356
+ export const randomBlocks = generator => {
357
+ const $generator = __typia.createRandom.generator;
358
+ const $pick = __typia.createRandom.pick;
359
+ const $ro0 = (_recursive = false, _depth = 0) => ({
360
+ fileId: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
361
+ locationId: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
362
+ blockId: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
363
+ offset: $pick([
364
+ () => undefined,
365
+ () => (generator?.customs ?? $generator.customs)?.number?.([
366
+ {
367
+ name: "Type<\"uint32\">",
368
+ kind: "type",
369
+ value: "uint32"
370
+ }
371
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
372
+ ])(),
373
+ position: $pick([
374
+ () => undefined,
375
+ () => (generator?.customs ?? $generator.customs)?.number?.([
376
+ {
377
+ name: "Type<\"uint32\">",
378
+ kind: "type",
379
+ value: "uint32"
380
+ }
381
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
382
+ ])(),
383
+ size: $pick([
384
+ () => undefined,
385
+ () => (generator?.customs ?? $generator.customs)?.number?.([
386
+ {
387
+ name: "Type<\"uint32\">",
388
+ kind: "type",
389
+ value: "uint32"
390
+ }
391
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
392
+ ])(),
393
+ hash: $pick([
394
+ () => undefined,
395
+ () => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
396
+ ])(),
397
+ btime: $pick([
398
+ () => undefined,
399
+ () => (generator?.customs ?? $generator.customs)?.number?.([
400
+ {
401
+ name: "Type<\"uint32\">",
402
+ kind: "type",
403
+ value: "uint32"
404
+ }
405
+ ]) ?? (generator?.integer ?? $generator.integer)(0, 10)
406
+ ])()
407
+ });
408
+ return (generator?.array ?? $generator.array)(() => $ro0());
409
+ };
410
+ export const assertGuardBlocks = (input, errorFactory) => {
411
+ const __is = input => {
412
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
413
+ return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
414
+ };
415
+ if (false === __is(input))
416
+ ((input, _path, _exceptionable = true) => {
417
+ const $guard = __typia.createAssertGuard.guard;
418
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.fileId || $guard(_exceptionable, {
419
+ path: _path + ".fileId",
420
+ expected: "string",
421
+ value: input.fileId
422
+ }, errorFactory)) && ("string" === typeof input.locationId || $guard(_exceptionable, {
423
+ path: _path + ".locationId",
424
+ expected: "string",
425
+ value: input.locationId
426
+ }, errorFactory)) && ("string" === typeof input.blockId || $guard(_exceptionable, {
427
+ path: _path + ".blockId",
428
+ expected: "string",
429
+ value: input.blockId
430
+ }, errorFactory)) && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
431
+ path: _path + ".offset",
432
+ expected: "number & Type<\"uint32\">",
433
+ value: input.offset
434
+ }, errorFactory)) || $guard(_exceptionable, {
435
+ path: _path + ".offset",
436
+ expected: "((number & Type<\"uint32\">) | undefined)",
437
+ value: input.offset
438
+ }, errorFactory)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
439
+ path: _path + ".position",
440
+ expected: "number & Type<\"uint32\">",
441
+ value: input.position
442
+ }, errorFactory)) || $guard(_exceptionable, {
443
+ path: _path + ".position",
444
+ expected: "((number & Type<\"uint32\">) | undefined)",
445
+ value: input.position
446
+ }, errorFactory)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
447
+ path: _path + ".size",
448
+ expected: "number & Type<\"uint32\">",
449
+ value: input.size
450
+ }, errorFactory)) || $guard(_exceptionable, {
451
+ path: _path + ".size",
452
+ expected: "((number & Type<\"uint32\">) | undefined)",
453
+ value: input.size
454
+ }, errorFactory)) && (undefined === input.hash || "string" === typeof input.hash || $guard(_exceptionable, {
455
+ path: _path + ".hash",
456
+ expected: "(string | undefined)",
457
+ value: input.hash
458
+ }, errorFactory)) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
459
+ path: _path + ".btime",
460
+ expected: "number & Type<\"uint32\">",
461
+ value: input.btime
462
+ }, errorFactory)) || $guard(_exceptionable, {
463
+ path: _path + ".btime",
464
+ expected: "((number & Type<\"uint32\">) | undefined)",
465
+ value: input.btime
466
+ }, errorFactory));
467
+ return (Array.isArray(input) || $guard(true, {
468
+ path: _path + "",
469
+ expected: "Blocks",
470
+ value: input
471
+ }, errorFactory)) && input.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(true, {
472
+ path: _path + "[" + _index1 + "]",
473
+ expected: "Block",
474
+ value: elem
475
+ }, errorFactory)) && $ao0(elem, _path + "[" + _index1 + "]", true) || $guard(true, {
476
+ path: _path + "[" + _index1 + "]",
477
+ expected: "Block",
478
+ value: elem
479
+ }, errorFactory)) || $guard(true, {
480
+ path: _path + "",
481
+ expected: "Blocks",
482
+ value: input
483
+ }, errorFactory);
484
+ })(input, "$input", true);
485
+ };
486
+ export const stringifyBlocks = input => {
487
+ const $string = __typia.json.createStringify.string;
488
+ const $so0 = input => `{${undefined === input.offset ? "" : `"offset":${undefined !== input.offset ? input.offset : undefined},`}${undefined === input.position ? "" : `"position":${undefined !== input.position ? input.position : undefined},`}${undefined === input.size ? "" : `"size":${undefined !== input.size ? input.size : undefined},`}${undefined === input.hash ? "" : `"hash":${undefined !== input.hash ? $string(input.hash) : undefined},`}${undefined === input.btime ? "" : `"btime":${undefined !== input.btime ? input.btime : undefined},`}"fileId":${$string(input.fileId)},"locationId":${$string(input.locationId)},"blockId":${$string(input.blockId)}}`;
489
+ return `[${input.map(elem => $so0(elem)).join(",")}]`;
490
+ };
491
+ export const assertStringifyBlocks = (input, errorFactory) => { const assert = (input, errorFactory) => {
492
+ const __is = input => {
493
+ const $io0 = input => "string" === typeof input.fileId && "string" === typeof input.locationId && "string" === typeof input.blockId && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295)) && (undefined === input.hash || "string" === typeof input.hash) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295));
494
+ return Array.isArray(input) && input.every(elem => "object" === typeof elem && null !== elem && $io0(elem));
495
+ };
496
+ if (false === __is(input))
497
+ ((input, _path, _exceptionable = true) => {
498
+ const $guard = __typia.json.createAssertStringify.guard;
499
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.fileId || $guard(_exceptionable, {
500
+ path: _path + ".fileId",
501
+ expected: "string",
502
+ value: input.fileId
503
+ }, errorFactory)) && ("string" === typeof input.locationId || $guard(_exceptionable, {
504
+ path: _path + ".locationId",
505
+ expected: "string",
506
+ value: input.locationId
507
+ }, errorFactory)) && ("string" === typeof input.blockId || $guard(_exceptionable, {
508
+ path: _path + ".blockId",
509
+ expected: "string",
510
+ value: input.blockId
511
+ }, errorFactory)) && (undefined === input.offset || "number" === typeof input.offset && (Math.floor(input.offset) === input.offset && 0 <= input.offset && input.offset <= 4294967295 || $guard(_exceptionable, {
512
+ path: _path + ".offset",
513
+ expected: "number & Type<\"uint32\">",
514
+ value: input.offset
515
+ }, errorFactory)) || $guard(_exceptionable, {
516
+ path: _path + ".offset",
517
+ expected: "((number & Type<\"uint32\">) | undefined)",
518
+ value: input.offset
519
+ }, errorFactory)) && (undefined === input.position || "number" === typeof input.position && (Math.floor(input.position) === input.position && 0 <= input.position && input.position <= 4294967295 || $guard(_exceptionable, {
520
+ path: _path + ".position",
521
+ expected: "number & Type<\"uint32\">",
522
+ value: input.position
523
+ }, errorFactory)) || $guard(_exceptionable, {
524
+ path: _path + ".position",
525
+ expected: "((number & Type<\"uint32\">) | undefined)",
526
+ value: input.position
527
+ }, errorFactory)) && (undefined === input.size || "number" === typeof input.size && (Math.floor(input.size) === input.size && 0 <= input.size && input.size <= 4294967295 || $guard(_exceptionable, {
528
+ path: _path + ".size",
529
+ expected: "number & Type<\"uint32\">",
530
+ value: input.size
531
+ }, errorFactory)) || $guard(_exceptionable, {
532
+ path: _path + ".size",
533
+ expected: "((number & Type<\"uint32\">) | undefined)",
534
+ value: input.size
535
+ }, errorFactory)) && (undefined === input.hash || "string" === typeof input.hash || $guard(_exceptionable, {
536
+ path: _path + ".hash",
537
+ expected: "(string | undefined)",
538
+ value: input.hash
539
+ }, errorFactory)) && (undefined === input.btime || "number" === typeof input.btime && (Math.floor(input.btime) === input.btime && 0 <= input.btime && input.btime <= 4294967295 || $guard(_exceptionable, {
540
+ path: _path + ".btime",
541
+ expected: "number & Type<\"uint32\">",
542
+ value: input.btime
543
+ }, errorFactory)) || $guard(_exceptionable, {
544
+ path: _path + ".btime",
545
+ expected: "((number & Type<\"uint32\">) | undefined)",
546
+ value: input.btime
547
+ }, errorFactory));
548
+ return (Array.isArray(input) || $guard(true, {
549
+ path: _path + "",
550
+ expected: "Blocks",
551
+ value: input
552
+ }, errorFactory)) && input.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(true, {
553
+ path: _path + "[" + _index1 + "]",
554
+ expected: "Block",
555
+ value: elem
556
+ }, errorFactory)) && $ao0(elem, _path + "[" + _index1 + "]", true) || $guard(true, {
557
+ path: _path + "[" + _index1 + "]",
558
+ expected: "Block",
559
+ value: elem
560
+ }, errorFactory)) || $guard(true, {
561
+ path: _path + "",
562
+ expected: "Blocks",
563
+ value: input
564
+ }, errorFactory);
565
+ })(input, "$input", true);
566
+ return input;
567
+ }; const stringify = input => {
568
+ const $string = __typia.json.createAssertStringify.string;
569
+ const $so0 = input => `{${undefined === input.offset ? "" : `"offset":${undefined !== input.offset ? input.offset : undefined},`}${undefined === input.position ? "" : `"position":${undefined !== input.position ? input.position : undefined},`}${undefined === input.size ? "" : `"size":${undefined !== input.size ? input.size : undefined},`}${undefined === input.hash ? "" : `"hash":${undefined !== input.hash ? $string(input.hash) : undefined},`}${undefined === input.btime ? "" : `"btime":${undefined !== input.btime ? input.btime : undefined},`}"fileId":${$string(input.fileId)},"locationId":${$string(input.locationId)},"blockId":${$string(input.blockId)}}`;
570
+ return `[${input.map(elem => $so0(elem)).join(",")}]`;
571
+ }; return stringify(assert(input, errorFactory)); };
@@ -0,0 +1,32 @@
1
+ import { type AssertionGuard as __AssertionGuard } from "typia";
2
+ export * from './block.js';
3
+ export * from './lock.js';
4
+ export * from './settings.js';
5
+ export interface Message {
6
+ level: number;
7
+ code: string;
8
+ msg: string;
9
+ }
10
+ export declare const isMessage: (input: unknown) => input is Message;
11
+ export declare const assertMessage: (input: unknown) => Message;
12
+ export declare const randomMessage: () => Message;
13
+ export declare const assertGuardMessage: __AssertionGuard<Message>;
14
+ export declare const stringifyMessage: (input: Message) => string;
15
+ export declare const assertStringifyMessage: (input: unknown) => string;
16
+ export type RpcMethods = Record<string, RpcMethod>;
17
+ export declare const isRpcMethods: (input: unknown) => input is RpcMethods;
18
+ export declare const assertRpcMethods: (input: unknown) => RpcMethods;
19
+ export declare const randomRpcMethods: () => RpcMethods;
20
+ export declare const assertGuardRpcMethods: __AssertionGuard<RpcMethods>;
21
+ export declare const stringifyRpcMethods: (input: RpcMethods) => string;
22
+ export declare const assertStringifyRpcMethods: (input: unknown) => string;
23
+ export interface RpcMethod {
24
+ rpcId: string;
25
+ rpcData: Record<string, unknown>;
26
+ }
27
+ export declare const isRpcMethod: (input: unknown) => input is RpcMethod;
28
+ export declare const assertRpcMethod: (input: unknown) => RpcMethod;
29
+ export declare const randomRpcMethod: () => RpcMethod;
30
+ export declare const assertGuardRpcMethod: __AssertionGuard<RpcMethod>;
31
+ export declare const stringifyRpcMethod: (input: RpcMethod) => string;
32
+ export declare const assertStringifyRpcMethod: (input: unknown) => string;