@nxtedition/types 1.6.3 → 1.6.6

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,19 @@
1
+ import { type AssertionGuard as __AssertionGuard } from "typia";
2
+ export interface NxtError {
3
+ message: string;
4
+ type?: string;
5
+ code?: string;
6
+ exitCode?: number;
7
+ signalCode?: number;
8
+ statusCode?: number;
9
+ headers?: Record<string, string>;
10
+ data?: object;
11
+ cause?: NxtError | null;
12
+ errors?: NxtError[] | null;
13
+ }
14
+ export declare const isNxtError: (input: unknown) => input is NxtError;
15
+ export declare const assertNxtError: (input: unknown) => NxtError;
16
+ export declare const randomNxtError: () => NxtError;
17
+ export declare const assertGuardNxtError: __AssertionGuard<NxtError>;
18
+ export declare const stringifyNxtError: (input: NxtError) => string;
19
+ export declare const assertStringifyNxtError: (input: unknown) => string;
@@ -0,0 +1,404 @@
1
+ import __typia from "typia";
2
+ export const isNxtError = input => {
3
+ const $io0 = input => "string" === typeof input.message && (undefined === input.type || "string" === typeof input.type) && (undefined === input.code || "string" === typeof input.code) && (undefined === input.exitCode || "number" === typeof input.exitCode) && (undefined === input.signalCode || "number" === typeof input.signalCode) && (undefined === input.statusCode || "number" === typeof input.statusCode) && (undefined === input.headers || "object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) && $io1(input.headers)) && (undefined === input.data || "object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) && $io2(input.data)) && (null === input.cause || undefined === input.cause || "object" === typeof input.cause && null !== input.cause && $io0(input.cause)) && (null === input.errors || undefined === input.errors || Array.isArray(input.errors) && input.errors.every(elem => "object" === typeof elem && null !== elem && $io0(elem)));
4
+ const $io1 = input => Object.keys(input).every(key => {
5
+ const value = input[key];
6
+ if (undefined === value)
7
+ return true;
8
+ return "string" === typeof value;
9
+ });
10
+ const $io2 = input => true;
11
+ return "object" === typeof input && null !== input && $io0(input);
12
+ };
13
+ export const assertNxtError = (input, errorFactory) => {
14
+ const __is = input => {
15
+ const $io0 = input => "string" === typeof input.message && (undefined === input.type || "string" === typeof input.type) && (undefined === input.code || "string" === typeof input.code) && (undefined === input.exitCode || "number" === typeof input.exitCode) && (undefined === input.signalCode || "number" === typeof input.signalCode) && (undefined === input.statusCode || "number" === typeof input.statusCode) && (undefined === input.headers || "object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) && $io1(input.headers)) && (undefined === input.data || "object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) && $io2(input.data)) && (null === input.cause || undefined === input.cause || "object" === typeof input.cause && null !== input.cause && $io0(input.cause)) && (null === input.errors || undefined === input.errors || Array.isArray(input.errors) && input.errors.every(elem => "object" === typeof elem && null !== elem && $io0(elem)));
16
+ const $io1 = input => Object.keys(input).every(key => {
17
+ const value = input[key];
18
+ if (undefined === value)
19
+ return true;
20
+ return "string" === typeof value;
21
+ });
22
+ const $io2 = input => true;
23
+ return "object" === typeof input && null !== input && $io0(input);
24
+ };
25
+ if (false === __is(input))
26
+ ((input, _path, _exceptionable = true) => {
27
+ const $guard = __typia.createAssert.guard;
28
+ const $join = __typia.createAssert.join;
29
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.message || $guard(_exceptionable, {
30
+ path: _path + ".message",
31
+ expected: "string",
32
+ value: input.message
33
+ }, errorFactory)) && (undefined === input.type || "string" === typeof input.type || $guard(_exceptionable, {
34
+ path: _path + ".type",
35
+ expected: "(string | undefined)",
36
+ value: input.type
37
+ }, errorFactory)) && (undefined === input.code || "string" === typeof input.code || $guard(_exceptionable, {
38
+ path: _path + ".code",
39
+ expected: "(string | undefined)",
40
+ value: input.code
41
+ }, errorFactory)) && (undefined === input.exitCode || "number" === typeof input.exitCode || $guard(_exceptionable, {
42
+ path: _path + ".exitCode",
43
+ expected: "(number | undefined)",
44
+ value: input.exitCode
45
+ }, errorFactory)) && (undefined === input.signalCode || "number" === typeof input.signalCode || $guard(_exceptionable, {
46
+ path: _path + ".signalCode",
47
+ expected: "(number | undefined)",
48
+ value: input.signalCode
49
+ }, errorFactory)) && (undefined === input.statusCode || "number" === typeof input.statusCode || $guard(_exceptionable, {
50
+ path: _path + ".statusCode",
51
+ expected: "(number | undefined)",
52
+ value: input.statusCode
53
+ }, errorFactory)) && (undefined === input.headers || ("object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) || $guard(_exceptionable, {
54
+ path: _path + ".headers",
55
+ expected: "(Record<string, string> | undefined)",
56
+ value: input.headers
57
+ }, errorFactory)) && $ao1(input.headers, _path + ".headers", true && _exceptionable) || $guard(_exceptionable, {
58
+ path: _path + ".headers",
59
+ expected: "(Record<string, string> | undefined)",
60
+ value: input.headers
61
+ }, errorFactory)) && (undefined === input.data || ("object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) || $guard(_exceptionable, {
62
+ path: _path + ".data",
63
+ expected: "(object | undefined)",
64
+ value: input.data
65
+ }, errorFactory)) && $ao2(input.data, _path + ".data", true && _exceptionable) || $guard(_exceptionable, {
66
+ path: _path + ".data",
67
+ expected: "(object | undefined)",
68
+ value: input.data
69
+ }, errorFactory)) && (null === input.cause || undefined === input.cause || ("object" === typeof input.cause && null !== input.cause || $guard(_exceptionable, {
70
+ path: _path + ".cause",
71
+ expected: "(NxtError | null | undefined)",
72
+ value: input.cause
73
+ }, errorFactory)) && $ao0(input.cause, _path + ".cause", true && _exceptionable) || $guard(_exceptionable, {
74
+ path: _path + ".cause",
75
+ expected: "(NxtError | null | undefined)",
76
+ value: input.cause
77
+ }, errorFactory)) && (null === input.errors || undefined === input.errors || (Array.isArray(input.errors) || $guard(_exceptionable, {
78
+ path: _path + ".errors",
79
+ expected: "(Array<NxtError> | null | undefined)",
80
+ value: input.errors
81
+ }, errorFactory)) && input.errors.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
82
+ path: _path + ".errors[" + _index1 + "]",
83
+ expected: "NxtError",
84
+ value: elem
85
+ }, errorFactory)) && $ao0(elem, _path + ".errors[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
86
+ path: _path + ".errors[" + _index1 + "]",
87
+ expected: "NxtError",
88
+ value: elem
89
+ }, errorFactory)) || $guard(_exceptionable, {
90
+ path: _path + ".errors",
91
+ expected: "(Array<NxtError> | null | undefined)",
92
+ value: input.errors
93
+ }, errorFactory));
94
+ const $ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
95
+ const value = input[key];
96
+ if (undefined === value)
97
+ return true;
98
+ return "string" === typeof value || $guard(_exceptionable, {
99
+ path: _path + $join(key),
100
+ expected: "string",
101
+ value: value
102
+ }, errorFactory);
103
+ });
104
+ const $ao2 = (input, _path, _exceptionable = true) => true;
105
+ return ("object" === typeof input && null !== input || $guard(true, {
106
+ path: _path + "",
107
+ expected: "NxtError",
108
+ value: input
109
+ }, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
110
+ path: _path + "",
111
+ expected: "NxtError",
112
+ value: input
113
+ }, errorFactory);
114
+ })(input, "$input", true);
115
+ return input;
116
+ };
117
+ export const randomNxtError = generator => {
118
+ const $generator = __typia.createRandom.generator;
119
+ const $pick = __typia.createRandom.pick;
120
+ const $ro0 = (_recursive = true, _depth = 0) => ({
121
+ message: (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(),
122
+ type: $pick([
123
+ () => undefined,
124
+ () => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
125
+ ])(),
126
+ code: $pick([
127
+ () => undefined,
128
+ () => (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()
129
+ ])(),
130
+ exitCode: $pick([
131
+ () => undefined,
132
+ () => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
133
+ ])(),
134
+ signalCode: $pick([
135
+ () => undefined,
136
+ () => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
137
+ ])(),
138
+ statusCode: $pick([
139
+ () => undefined,
140
+ () => (generator?.customs ?? $generator.customs)?.number?.([]) ?? (generator?.number ?? $generator.number)(0, 100)
141
+ ])(),
142
+ headers: $pick([
143
+ () => undefined,
144
+ () => $ro1(true, _recursive ? 1 + _depth : _depth)
145
+ ])(),
146
+ data: $pick([
147
+ () => undefined,
148
+ () => $ro2(true, _recursive ? 1 + _depth : _depth)
149
+ ])(),
150
+ cause: $pick([
151
+ () => undefined,
152
+ () => null,
153
+ () => $ro0(true, _recursive ? 1 + _depth : _depth)
154
+ ])(),
155
+ errors: $pick([
156
+ () => undefined,
157
+ () => null,
158
+ () => _recursive && 5 < _depth ? [] : 5 >= _depth ? (generator?.array ?? $generator.array)(() => $ro0(true, _recursive ? 1 + _depth : _depth)) : []
159
+ ])()
160
+ });
161
+ const $ro1 = (_recursive = false, _depth = 0) => {
162
+ const output = {};
163
+ (generator?.array ?? $generator.array)(() => output[(generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)()] = (generator?.customs ?? $generator.customs)?.string?.([]) ?? (generator?.string ?? $generator.string)(), (generator?.integer ?? $generator.integer)(0, 3));
164
+ return output;
165
+ };
166
+ const $ro2 = (_recursive = false, _depth = 0) => {};
167
+ return $ro0();
168
+ };
169
+ export const assertGuardNxtError = (input, errorFactory) => {
170
+ const __is = input => {
171
+ const $io0 = input => "string" === typeof input.message && (undefined === input.type || "string" === typeof input.type) && (undefined === input.code || "string" === typeof input.code) && (undefined === input.exitCode || "number" === typeof input.exitCode) && (undefined === input.signalCode || "number" === typeof input.signalCode) && (undefined === input.statusCode || "number" === typeof input.statusCode) && (undefined === input.headers || "object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) && $io1(input.headers)) && (undefined === input.data || "object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) && $io2(input.data)) && (null === input.cause || undefined === input.cause || "object" === typeof input.cause && null !== input.cause && $io0(input.cause)) && (null === input.errors || undefined === input.errors || Array.isArray(input.errors) && input.errors.every(elem => "object" === typeof elem && null !== elem && $io0(elem)));
172
+ const $io1 = input => Object.keys(input).every(key => {
173
+ const value = input[key];
174
+ if (undefined === value)
175
+ return true;
176
+ return "string" === typeof value;
177
+ });
178
+ const $io2 = input => true;
179
+ return "object" === typeof input && null !== input && $io0(input);
180
+ };
181
+ if (false === __is(input))
182
+ ((input, _path, _exceptionable = true) => {
183
+ const $guard = __typia.createAssertGuard.guard;
184
+ const $join = __typia.createAssertGuard.join;
185
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.message || $guard(_exceptionable, {
186
+ path: _path + ".message",
187
+ expected: "string",
188
+ value: input.message
189
+ }, errorFactory)) && (undefined === input.type || "string" === typeof input.type || $guard(_exceptionable, {
190
+ path: _path + ".type",
191
+ expected: "(string | undefined)",
192
+ value: input.type
193
+ }, errorFactory)) && (undefined === input.code || "string" === typeof input.code || $guard(_exceptionable, {
194
+ path: _path + ".code",
195
+ expected: "(string | undefined)",
196
+ value: input.code
197
+ }, errorFactory)) && (undefined === input.exitCode || "number" === typeof input.exitCode || $guard(_exceptionable, {
198
+ path: _path + ".exitCode",
199
+ expected: "(number | undefined)",
200
+ value: input.exitCode
201
+ }, errorFactory)) && (undefined === input.signalCode || "number" === typeof input.signalCode || $guard(_exceptionable, {
202
+ path: _path + ".signalCode",
203
+ expected: "(number | undefined)",
204
+ value: input.signalCode
205
+ }, errorFactory)) && (undefined === input.statusCode || "number" === typeof input.statusCode || $guard(_exceptionable, {
206
+ path: _path + ".statusCode",
207
+ expected: "(number | undefined)",
208
+ value: input.statusCode
209
+ }, errorFactory)) && (undefined === input.headers || ("object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) || $guard(_exceptionable, {
210
+ path: _path + ".headers",
211
+ expected: "(Record<string, string> | undefined)",
212
+ value: input.headers
213
+ }, errorFactory)) && $ao1(input.headers, _path + ".headers", true && _exceptionable) || $guard(_exceptionable, {
214
+ path: _path + ".headers",
215
+ expected: "(Record<string, string> | undefined)",
216
+ value: input.headers
217
+ }, errorFactory)) && (undefined === input.data || ("object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) || $guard(_exceptionable, {
218
+ path: _path + ".data",
219
+ expected: "(object | undefined)",
220
+ value: input.data
221
+ }, errorFactory)) && $ao2(input.data, _path + ".data", true && _exceptionable) || $guard(_exceptionable, {
222
+ path: _path + ".data",
223
+ expected: "(object | undefined)",
224
+ value: input.data
225
+ }, errorFactory)) && (null === input.cause || undefined === input.cause || ("object" === typeof input.cause && null !== input.cause || $guard(_exceptionable, {
226
+ path: _path + ".cause",
227
+ expected: "(NxtError | null | undefined)",
228
+ value: input.cause
229
+ }, errorFactory)) && $ao0(input.cause, _path + ".cause", true && _exceptionable) || $guard(_exceptionable, {
230
+ path: _path + ".cause",
231
+ expected: "(NxtError | null | undefined)",
232
+ value: input.cause
233
+ }, errorFactory)) && (null === input.errors || undefined === input.errors || (Array.isArray(input.errors) || $guard(_exceptionable, {
234
+ path: _path + ".errors",
235
+ expected: "(Array<NxtError> | null | undefined)",
236
+ value: input.errors
237
+ }, errorFactory)) && input.errors.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
238
+ path: _path + ".errors[" + _index1 + "]",
239
+ expected: "NxtError",
240
+ value: elem
241
+ }, errorFactory)) && $ao0(elem, _path + ".errors[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
242
+ path: _path + ".errors[" + _index1 + "]",
243
+ expected: "NxtError",
244
+ value: elem
245
+ }, errorFactory)) || $guard(_exceptionable, {
246
+ path: _path + ".errors",
247
+ expected: "(Array<NxtError> | null | undefined)",
248
+ value: input.errors
249
+ }, errorFactory));
250
+ const $ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
251
+ const value = input[key];
252
+ if (undefined === value)
253
+ return true;
254
+ return "string" === typeof value || $guard(_exceptionable, {
255
+ path: _path + $join(key),
256
+ expected: "string",
257
+ value: value
258
+ }, errorFactory);
259
+ });
260
+ const $ao2 = (input, _path, _exceptionable = true) => true;
261
+ return ("object" === typeof input && null !== input || $guard(true, {
262
+ path: _path + "",
263
+ expected: "NxtError",
264
+ value: input
265
+ }, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
266
+ path: _path + "",
267
+ expected: "NxtError",
268
+ value: input
269
+ }, errorFactory);
270
+ })(input, "$input", true);
271
+ };
272
+ export const stringifyNxtError = input => {
273
+ const $io0 = input => "string" === typeof input.message && (undefined === input.type || "string" === typeof input.type) && (undefined === input.code || "string" === typeof input.code) && (undefined === input.exitCode || "number" === typeof input.exitCode) && (undefined === input.signalCode || "number" === typeof input.signalCode) && (undefined === input.statusCode || "number" === typeof input.statusCode) && (undefined === input.headers || "object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) && $io1(input.headers)) && (undefined === input.data || "object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) && $io2(input.data)) && (null === input.cause || undefined === input.cause || "object" === typeof input.cause && null !== input.cause && $io0(input.cause)) && (null === input.errors || undefined === input.errors || Array.isArray(input.errors) && input.errors.every(elem => "object" === typeof elem && null !== elem && $io0(elem)));
274
+ const $io1 = input => Object.keys(input).every(key => {
275
+ const value = input[key];
276
+ if (undefined === value)
277
+ return true;
278
+ return "string" === typeof value;
279
+ });
280
+ const $io2 = input => true;
281
+ const $string = __typia.json.createStringify.string;
282
+ const $so0 = input => `{${undefined === input.type ? "" : `"type":${undefined !== input.type ? $string(input.type) : undefined},`}${undefined === input.code ? "" : `"code":${undefined !== input.code ? $string(input.code) : undefined},`}${undefined === input.exitCode ? "" : `"exitCode":${undefined !== input.exitCode ? input.exitCode : undefined},`}${undefined === input.signalCode ? "" : `"signalCode":${undefined !== input.signalCode ? input.signalCode : undefined},`}${undefined === input.statusCode ? "" : `"statusCode":${undefined !== input.statusCode ? input.statusCode : undefined},`}${undefined === input.headers ? "" : `"headers":${undefined !== input.headers ? $so1(input.headers) : undefined},`}${undefined === input.data ? "" : `"data":${undefined !== input.data ? "{}" : undefined},`}${undefined === input.cause ? "" : `"cause":${undefined !== input.cause ? null !== input.cause ? $so0(input.cause) : "null" : undefined},`}${undefined === input.errors ? "" : `"errors":${undefined !== input.errors ? null !== input.errors ? `[${input.errors.map(elem => $so0(elem)).join(",")}]` : "null" : undefined},`}"message":${$string(input.message)}}`;
283
+ const $so1 = input => `{${Object.entries(input).map(([key, value]) => { if (undefined === value)
284
+ return ""; return `${JSON.stringify(key)}:${$string(value)}`; }).filter(str => "" !== str).join(",")}}`;
285
+ return $so0(input);
286
+ };
287
+ export const assertStringifyNxtError = (input, errorFactory) => { const assert = (input, errorFactory) => {
288
+ const __is = input => {
289
+ const $io0 = input => "string" === typeof input.message && (undefined === input.type || "string" === typeof input.type) && (undefined === input.code || "string" === typeof input.code) && (undefined === input.exitCode || "number" === typeof input.exitCode && !Number.isNaN(input.exitCode)) && (undefined === input.signalCode || "number" === typeof input.signalCode && !Number.isNaN(input.signalCode)) && (undefined === input.statusCode || "number" === typeof input.statusCode && !Number.isNaN(input.statusCode)) && (undefined === input.headers || "object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) && $io1(input.headers)) && (undefined === input.data || "object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) && $io2(input.data)) && (null === input.cause || undefined === input.cause || "object" === typeof input.cause && null !== input.cause && $io0(input.cause)) && (null === input.errors || undefined === input.errors || Array.isArray(input.errors) && input.errors.every(elem => "object" === typeof elem && null !== elem && $io0(elem)));
290
+ const $io1 = input => Object.keys(input).every(key => {
291
+ const value = input[key];
292
+ if (undefined === value)
293
+ return true;
294
+ return "string" === typeof value;
295
+ });
296
+ const $io2 = input => true;
297
+ return "object" === typeof input && null !== input && $io0(input);
298
+ };
299
+ if (false === __is(input))
300
+ ((input, _path, _exceptionable = true) => {
301
+ const $guard = __typia.json.createAssertStringify.guard;
302
+ const $join = __typia.json.createAssertStringify.join;
303
+ const $ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.message || $guard(_exceptionable, {
304
+ path: _path + ".message",
305
+ expected: "string",
306
+ value: input.message
307
+ }, errorFactory)) && (undefined === input.type || "string" === typeof input.type || $guard(_exceptionable, {
308
+ path: _path + ".type",
309
+ expected: "(string | undefined)",
310
+ value: input.type
311
+ }, errorFactory)) && (undefined === input.code || "string" === typeof input.code || $guard(_exceptionable, {
312
+ path: _path + ".code",
313
+ expected: "(string | undefined)",
314
+ value: input.code
315
+ }, errorFactory)) && (undefined === input.exitCode || "number" === typeof input.exitCode && !Number.isNaN(input.exitCode) || $guard(_exceptionable, {
316
+ path: _path + ".exitCode",
317
+ expected: "(number | undefined)",
318
+ value: input.exitCode
319
+ }, errorFactory)) && (undefined === input.signalCode || "number" === typeof input.signalCode && !Number.isNaN(input.signalCode) || $guard(_exceptionable, {
320
+ path: _path + ".signalCode",
321
+ expected: "(number | undefined)",
322
+ value: input.signalCode
323
+ }, errorFactory)) && (undefined === input.statusCode || "number" === typeof input.statusCode && !Number.isNaN(input.statusCode) || $guard(_exceptionable, {
324
+ path: _path + ".statusCode",
325
+ expected: "(number | undefined)",
326
+ value: input.statusCode
327
+ }, errorFactory)) && (undefined === input.headers || ("object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) || $guard(_exceptionable, {
328
+ path: _path + ".headers",
329
+ expected: "(Record<string, string> | undefined)",
330
+ value: input.headers
331
+ }, errorFactory)) && $ao1(input.headers, _path + ".headers", true && _exceptionable) || $guard(_exceptionable, {
332
+ path: _path + ".headers",
333
+ expected: "(Record<string, string> | undefined)",
334
+ value: input.headers
335
+ }, errorFactory)) && (undefined === input.data || ("object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) || $guard(_exceptionable, {
336
+ path: _path + ".data",
337
+ expected: "(object | undefined)",
338
+ value: input.data
339
+ }, errorFactory)) && $ao2(input.data, _path + ".data", true && _exceptionable) || $guard(_exceptionable, {
340
+ path: _path + ".data",
341
+ expected: "(object | undefined)",
342
+ value: input.data
343
+ }, errorFactory)) && (null === input.cause || undefined === input.cause || ("object" === typeof input.cause && null !== input.cause || $guard(_exceptionable, {
344
+ path: _path + ".cause",
345
+ expected: "(NxtError | null | undefined)",
346
+ value: input.cause
347
+ }, errorFactory)) && $ao0(input.cause, _path + ".cause", true && _exceptionable) || $guard(_exceptionable, {
348
+ path: _path + ".cause",
349
+ expected: "(NxtError | null | undefined)",
350
+ value: input.cause
351
+ }, errorFactory)) && (null === input.errors || undefined === input.errors || (Array.isArray(input.errors) || $guard(_exceptionable, {
352
+ path: _path + ".errors",
353
+ expected: "(Array<NxtError> | null | undefined)",
354
+ value: input.errors
355
+ }, errorFactory)) && input.errors.every((elem, _index1) => ("object" === typeof elem && null !== elem || $guard(_exceptionable, {
356
+ path: _path + ".errors[" + _index1 + "]",
357
+ expected: "NxtError",
358
+ value: elem
359
+ }, errorFactory)) && $ao0(elem, _path + ".errors[" + _index1 + "]", true && _exceptionable) || $guard(_exceptionable, {
360
+ path: _path + ".errors[" + _index1 + "]",
361
+ expected: "NxtError",
362
+ value: elem
363
+ }, errorFactory)) || $guard(_exceptionable, {
364
+ path: _path + ".errors",
365
+ expected: "(Array<NxtError> | null | undefined)",
366
+ value: input.errors
367
+ }, errorFactory));
368
+ const $ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
369
+ const value = input[key];
370
+ if (undefined === value)
371
+ return true;
372
+ return "string" === typeof value || $guard(_exceptionable, {
373
+ path: _path + $join(key),
374
+ expected: "string",
375
+ value: value
376
+ }, errorFactory);
377
+ });
378
+ const $ao2 = (input, _path, _exceptionable = true) => true;
379
+ return ("object" === typeof input && null !== input || $guard(true, {
380
+ path: _path + "",
381
+ expected: "NxtError",
382
+ value: input
383
+ }, errorFactory)) && $ao0(input, _path + "", true) || $guard(true, {
384
+ path: _path + "",
385
+ expected: "NxtError",
386
+ value: input
387
+ }, errorFactory);
388
+ })(input, "$input", true);
389
+ return input;
390
+ }; const stringify = input => {
391
+ const $io0 = input => "string" === typeof input.message && (undefined === input.type || "string" === typeof input.type) && (undefined === input.code || "string" === typeof input.code) && (undefined === input.exitCode || "number" === typeof input.exitCode) && (undefined === input.signalCode || "number" === typeof input.signalCode) && (undefined === input.statusCode || "number" === typeof input.statusCode) && (undefined === input.headers || "object" === typeof input.headers && null !== input.headers && false === Array.isArray(input.headers) && $io1(input.headers)) && (undefined === input.data || "object" === typeof input.data && null !== input.data && false === Array.isArray(input.data) && $io2(input.data)) && (null === input.cause || undefined === input.cause || "object" === typeof input.cause && null !== input.cause && $io0(input.cause)) && (null === input.errors || undefined === input.errors || Array.isArray(input.errors) && input.errors.every(elem => "object" === typeof elem && null !== elem && $io0(elem)));
392
+ const $io1 = input => Object.keys(input).every(key => {
393
+ const value = input[key];
394
+ if (undefined === value)
395
+ return true;
396
+ return "string" === typeof value;
397
+ });
398
+ const $io2 = input => true;
399
+ const $string = __typia.json.createAssertStringify.string;
400
+ const $so0 = input => `{${undefined === input.type ? "" : `"type":${undefined !== input.type ? $string(input.type) : undefined},`}${undefined === input.code ? "" : `"code":${undefined !== input.code ? $string(input.code) : undefined},`}${undefined === input.exitCode ? "" : `"exitCode":${undefined !== input.exitCode ? input.exitCode : undefined},`}${undefined === input.signalCode ? "" : `"signalCode":${undefined !== input.signalCode ? input.signalCode : undefined},`}${undefined === input.statusCode ? "" : `"statusCode":${undefined !== input.statusCode ? input.statusCode : undefined},`}${undefined === input.headers ? "" : `"headers":${undefined !== input.headers ? $so1(input.headers) : undefined},`}${undefined === input.data ? "" : `"data":${undefined !== input.data ? "{}" : undefined},`}${undefined === input.cause ? "" : `"cause":${undefined !== input.cause ? null !== input.cause ? $so0(input.cause) : "null" : undefined},`}${undefined === input.errors ? "" : `"errors":${undefined !== input.errors ? null !== input.errors ? `[${input.errors.map(elem => $so0(elem)).join(",")}]` : "null" : undefined},`}"message":${$string(input.message)}}`;
401
+ const $so1 = input => `{${Object.entries(input).map(([key, value]) => { if (undefined === value)
402
+ return ""; return `${JSON.stringify(key)}:${$string(value)}`; }).filter(str => "" !== str).join(",")}}`;
403
+ return $so0(input);
404
+ }; return stringify(assert(input, errorFactory)); };
@@ -1,5 +1,6 @@
1
1
  import { type AssertionGuard as __AssertionGuard } from "typia";
2
2
  import { tags } from 'typia';
3
+ import { NxtError } from './error.js';
3
4
  export interface File {
4
5
  id: string & tags.Pattern<"^[0-9A-Za-z~][0-9A-Za-z~._: -]*$">;
5
6
  size: (number & tags.Minimum<0> & tags.Type<"uint64">) | null;
@@ -14,12 +15,14 @@ export interface File {
14
15
  tags: string[];
15
16
  resumable: string;
16
17
  mimeType: string;
18
+ ranges: Array<[
19
+ start: tags.Minimum<0>,
20
+ end: tags.Minimum<0>
21
+ ]>;
17
22
  hash: string & tags.Pattern<"^([A-Fa-f0-9]{32})?$">;
18
23
  btime: number & tags.Minimum<0> & tags.Type<"uint64">;
19
24
  completed: boolean;
20
- error: Array<{
21
- message: string;
22
- }> | null;
25
+ error: NxtError[] | NxtError | null;
23
26
  }
24
27
  export declare const isFile: (input: unknown) => input is File;
25
28
  export declare const assertFile: (input: unknown) => File;