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