@keetanetwork/anchor 0.0.21 → 0.0.23
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/config.d.ts +1 -1
- package/config.d.ts.map +1 -1
- package/config.js +1 -1
- package/config.js.map +1 -1
- package/lib/certificates.d.ts +4 -1
- package/lib/certificates.d.ts.map +1 -1
- package/lib/certificates.js +148 -14
- package/lib/certificates.js.map +1 -1
- package/lib/error.d.ts +35 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +203 -7
- package/lib/error.js.map +1 -1
- package/lib/http-server/common.d.ts +6 -0
- package/lib/http-server/common.d.ts.map +1 -0
- package/lib/http-server/common.js +2 -0
- package/lib/http-server/common.js.map +1 -0
- package/lib/{http-server.d.ts → http-server/index.d.ts} +30 -12
- package/lib/http-server/index.d.ts.map +1 -0
- package/lib/{http-server.js → http-server/index.js} +107 -46
- package/lib/http-server/index.js.map +1 -0
- package/lib/resolver.d.ts +5 -2
- package/lib/resolver.d.ts.map +1 -1
- package/lib/resolver.js +15 -2
- package/lib/resolver.js.map +1 -1
- package/lib/utils/asn1.d.ts +0 -13
- package/lib/utils/asn1.d.ts.map +1 -1
- package/lib/utils/asn1.js +0 -1498
- package/lib/utils/asn1.js.map +1 -1
- package/lib/utils/external.d.ts.map +1 -1
- package/lib/utils/external.js +9 -2
- package/lib/utils/external.js.map +1 -1
- package/npm-shrinkwrap.json +5 -5
- package/package.json +2 -2
- package/services/asset-movement/client.d.ts +1 -0
- package/services/asset-movement/client.d.ts.map +1 -1
- package/services/asset-movement/client.js +13 -9
- package/services/asset-movement/client.js.map +1 -1
- package/services/asset-movement/common.d.ts +1 -1
- package/services/asset-movement/common.d.ts.map +1 -1
- package/services/asset-movement/common.js.map +1 -1
- package/services/asset-movement/server.d.ts +1 -1
- package/services/asset-movement/server.d.ts.map +1 -1
- package/services/asset-movement/server.js +1 -1
- package/services/asset-movement/server.js.map +1 -1
- package/services/fx/common.d.ts +15 -5
- package/services/fx/common.d.ts.map +1 -1
- package/services/fx/common.js +29 -0
- package/services/fx/common.js.map +1 -1
- package/services/fx/server.d.ts +12 -2
- package/services/fx/server.d.ts.map +1 -1
- package/services/fx/server.js +9 -2
- package/services/fx/server.js.map +1 -1
- package/services/kyc/common.d.ts +3 -5
- package/services/kyc/common.d.ts.map +1 -1
- package/services/kyc/common.generated.js +2 -2
- package/services/kyc/common.js +1 -0
- package/services/kyc/common.js.map +1 -1
- package/services/kyc/iso20022.generated.js +54 -54
- package/services/kyc/iso20022.generated.js.map +1 -1
- package/services/kyc/server.d.ts +1 -1
- package/services/kyc/server.d.ts.map +1 -1
- package/services/kyc/server.js +1 -1
- package/services/kyc/server.js.map +1 -1
- package/services/kyc/utils/generate-kyc-schema.js +34 -6
- package/services/kyc/utils/generate-kyc-schema.js.map +1 -1
- package/lib/http-server.d.ts.map +0 -1
- package/lib/http-server.js.map +0 -1
package/lib/utils/asn1.js
CHANGED
|
@@ -1,1506 +1,8 @@
|
|
|
1
|
-
import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
|
|
2
|
-
import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
|
|
3
1
|
import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
|
|
4
|
-
import { isReferenceSchema } from './asn1.generated.js';
|
|
5
|
-
import { EncryptedContainer } from '../encrypted-container.js';
|
|
6
|
-
import { Buffer, bufferToArrayBuffer } from './buffer.js';
|
|
7
|
-
import { checkHashWithOID } from './external.js';
|
|
8
|
-
const KeetaNetAccount = KeetaNetLib.Account;
|
|
9
|
-
import { assert, createAssert, createIs } from 'typia';
|
|
10
2
|
const ASN1 = KeetaNetLib.Utils.ASN1;
|
|
11
3
|
const ASN1toJS = ASN1.ASN1toJS;
|
|
12
4
|
const JStoASN1 = ASN1.JStoASN1;
|
|
13
5
|
const BufferStorageASN1 = ASN1.BufferStorageASN1;
|
|
14
6
|
const ValidateASN1 = ASN1.ValidateASN1;
|
|
15
|
-
const ASN1CheckUtilities = ASN1.ASN1CheckUtilities;
|
|
16
|
-
const { isASN1ContextTag, isASN1Struct, isASN1String, isASN1Date, isASN1BitString, isASN1Set } = ASN1CheckUtilities;
|
|
17
|
-
const assertStructFieldSchemaMap = (() => { const _ip0 = input => {
|
|
18
|
-
const array = input;
|
|
19
|
-
const top = input[0];
|
|
20
|
-
if (0 === input.length)
|
|
21
|
-
return true;
|
|
22
|
-
const arrayPredicators = [
|
|
23
|
-
[
|
|
24
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_it0(top) || false) || "object" === typeof top && null !== top && _iu0(top))),
|
|
25
|
-
entire => entire.every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))
|
|
26
|
-
],
|
|
27
|
-
[
|
|
28
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_it0(top) || false) || "object" === typeof top && null !== top && _iu0(top))),
|
|
29
|
-
entire => entire.every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))
|
|
30
|
-
]
|
|
31
|
-
];
|
|
32
|
-
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
33
|
-
if (1 === passed.length)
|
|
34
|
-
return passed[0][1](array);
|
|
35
|
-
else if (1 < passed.length)
|
|
36
|
-
for (const pred of passed)
|
|
37
|
-
if (array.every(value => true === pred[0](value)))
|
|
38
|
-
return pred[1](array);
|
|
39
|
-
return false;
|
|
40
|
-
}; const _ap1 = (input, _path, _exceptionable = true) => {
|
|
41
|
-
const array = input;
|
|
42
|
-
const top = input[0];
|
|
43
|
-
if (0 === input.length)
|
|
44
|
-
return true;
|
|
45
|
-
const arrayPredicators = [
|
|
46
|
-
[
|
|
47
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_at0(top, _path, false && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
48
|
-
method: "createAssert",
|
|
49
|
-
path: _path,
|
|
50
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
51
|
-
value: top
|
|
52
|
-
}, _errorFactory)) || "object" === typeof top && null !== top && _au0(top, _path, false && _exceptionable))),
|
|
53
|
-
entire => entire.every((elem, _index9) => (null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
54
|
-
method: "createAssert",
|
|
55
|
-
path: _path + "[" + _index9 + "]",
|
|
56
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
57
|
-
value: elem
|
|
58
|
-
}, _errorFactory)) && (undefined !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
59
|
-
method: "createAssert",
|
|
60
|
-
path: _path + "[" + _index9 + "]",
|
|
61
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
62
|
-
value: elem
|
|
63
|
-
}, _errorFactory)) && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_at0(elem, _path + "[" + _index9 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
64
|
-
method: "createAssert",
|
|
65
|
-
path: _path + "[" + _index9 + "]",
|
|
66
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
67
|
-
value: elem
|
|
68
|
-
}, _errorFactory)) || "object" === typeof elem && null !== elem && _au0(elem, _path + "[" + _index9 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
69
|
-
method: "createAssert",
|
|
70
|
-
path: _path + "[" + _index9 + "]",
|
|
71
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
72
|
-
value: elem
|
|
73
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
74
|
-
method: "createAssert",
|
|
75
|
-
path: _path + "[" + _index9 + "]",
|
|
76
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
77
|
-
value: elem
|
|
78
|
-
}, _errorFactory)))
|
|
79
|
-
],
|
|
80
|
-
[
|
|
81
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_at0(top, _path, false && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
82
|
-
method: "createAssert",
|
|
83
|
-
path: _path,
|
|
84
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
85
|
-
value: top
|
|
86
|
-
}, _errorFactory)) || "object" === typeof top && null !== top && _au0(top, _path, false && _exceptionable))),
|
|
87
|
-
entire => entire.every((elem, _index10) => (null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
88
|
-
method: "createAssert",
|
|
89
|
-
path: _path + "[" + _index10 + "]",
|
|
90
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
91
|
-
value: elem
|
|
92
|
-
}, _errorFactory)) && (undefined !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
93
|
-
method: "createAssert",
|
|
94
|
-
path: _path + "[" + _index10 + "]",
|
|
95
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
96
|
-
value: elem
|
|
97
|
-
}, _errorFactory)) && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_at0(elem, _path + "[" + _index10 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
98
|
-
method: "createAssert",
|
|
99
|
-
path: _path + "[" + _index10 + "]",
|
|
100
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
101
|
-
value: elem
|
|
102
|
-
}, _errorFactory)) || "object" === typeof elem && null !== elem && _au0(elem, _path + "[" + _index10 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
103
|
-
method: "createAssert",
|
|
104
|
-
path: _path + "[" + _index10 + "]",
|
|
105
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
106
|
-
value: elem
|
|
107
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
108
|
-
method: "createAssert",
|
|
109
|
-
path: _path + "[" + _index10 + "]",
|
|
110
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
111
|
-
value: elem
|
|
112
|
-
}, _errorFactory)))
|
|
113
|
-
]
|
|
114
|
-
];
|
|
115
|
-
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
116
|
-
if (1 === passed.length)
|
|
117
|
-
return passed[0][1](array);
|
|
118
|
-
else if (1 < passed.length)
|
|
119
|
-
for (const pred of passed)
|
|
120
|
-
if (array.every(value => true === pred[0](value)))
|
|
121
|
-
return pred[1](array);
|
|
122
|
-
return __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
123
|
-
method: "createAssert",
|
|
124
|
-
path: _path,
|
|
125
|
-
expected: "(Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>)",
|
|
126
|
-
value: input
|
|
127
|
-
}, _errorFactory);
|
|
128
|
-
}; const _io0 = input => Object.keys(input).every(key => {
|
|
129
|
-
const value = input[key];
|
|
130
|
-
if (undefined === value)
|
|
131
|
-
return true;
|
|
132
|
-
return null !== value && undefined !== value && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_it0(value) || false) || "object" === typeof value && null !== value && _iu1(value)));
|
|
133
|
-
}); const _io1 = input => Array.isArray(input.choice) && (_ip0(input.choice) || false); const _io2 = input => null !== input.sequenceOf && undefined !== input.sequenceOf && ("function" === typeof input.sequenceOf || "bigint" === typeof input.sequenceOf || (Array.isArray(input.sequenceOf) && (_it0(input.sequenceOf) || false) || "object" === typeof input.sequenceOf && null !== input.sequenceOf && _iu0(input.sequenceOf))); const _io3 = input => null !== input.optional && undefined !== input.optional && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_it0(input.optional) || false) || "object" === typeof input.optional && null !== input.optional && _iu0(input.optional))); const _io4 = input => "context" === input.type && ("explicit" === input.kind || "implicit" === input.kind) && (null !== input.contains && undefined !== input.contains && ("function" === typeof input.contains || "bigint" === typeof input.contains || (Array.isArray(input.contains) && (_it0(input.contains) || false) || "object" === typeof input.contains && null !== input.contains && _iu0(input.contains)))) && "number" === typeof input.value; const _io5 = input => "oid" === input.type && "string" === typeof input.oid; const _io6 = input => "string" === input.type && "printable" === input.kind; const _io7 = input => "string" === input.type && "ia5" === input.kind; const _io8 = input => "string" === input.type && "utf8" === input.kind; const _io9 = input => "date" === input.type && "utc" === input.kind; const _io10 = input => "date" === input.type && "general" === input.kind; const _io11 = input => "struct" === input.type && (Array.isArray(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && ("object" === typeof input.contains && null !== input.contains && false === Array.isArray(input.contains) && _io12(input.contains)); const _io12 = input => Object.keys(input).every(key => {
|
|
134
|
-
const value = input[key];
|
|
135
|
-
if (undefined === value)
|
|
136
|
-
return true;
|
|
137
|
-
return null !== value && undefined !== value && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_it0(value) || false) || "object" === typeof value && null !== value && _iu0(value)));
|
|
138
|
-
}); const _io13 = input => null !== input.optional && undefined !== input.optional && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_it0(input.optional) || false) || "object" === typeof input.optional && null !== input.optional && _iu0(input.optional))); const _iu0 = input => (() => {
|
|
139
|
-
if (undefined !== input.choice)
|
|
140
|
-
return _io1(input);
|
|
141
|
-
else if (undefined !== input.sequenceOf)
|
|
142
|
-
return _io2(input);
|
|
143
|
-
else if (undefined !== input.optional)
|
|
144
|
-
return _io3(input);
|
|
145
|
-
else if ("context" === input.type)
|
|
146
|
-
return _io4(input);
|
|
147
|
-
else if ("oid" === input.type)
|
|
148
|
-
return _io5(input);
|
|
149
|
-
else if ("general" === input.kind)
|
|
150
|
-
return _io10(input);
|
|
151
|
-
else if ("utc" === input.kind)
|
|
152
|
-
return _io9(input);
|
|
153
|
-
else if ("utf8" === input.kind)
|
|
154
|
-
return _io8(input);
|
|
155
|
-
else if ("ia5" === input.kind)
|
|
156
|
-
return _io7(input);
|
|
157
|
-
else if ("printable" === input.kind)
|
|
158
|
-
return _io6(input);
|
|
159
|
-
else if ("struct" === input.type)
|
|
160
|
-
return _io11(input);
|
|
161
|
-
else
|
|
162
|
-
return false;
|
|
163
|
-
})(); const _iu1 = input => (() => {
|
|
164
|
-
if (undefined !== input.choice)
|
|
165
|
-
return _io1(input);
|
|
166
|
-
else if (undefined !== input.sequenceOf)
|
|
167
|
-
return _io2(input);
|
|
168
|
-
else if ("context" === input.type)
|
|
169
|
-
return _io4(input);
|
|
170
|
-
else if ("oid" === input.type)
|
|
171
|
-
return _io5(input);
|
|
172
|
-
else if ("general" === input.kind)
|
|
173
|
-
return _io10(input);
|
|
174
|
-
else if ("utc" === input.kind)
|
|
175
|
-
return _io9(input);
|
|
176
|
-
else if ("utf8" === input.kind)
|
|
177
|
-
return _io8(input);
|
|
178
|
-
else if ("ia5" === input.kind)
|
|
179
|
-
return _io7(input);
|
|
180
|
-
else if ("printable" === input.kind)
|
|
181
|
-
return _io6(input);
|
|
182
|
-
else if ("struct" === input.type)
|
|
183
|
-
return _io11(input);
|
|
184
|
-
else
|
|
185
|
-
return (() => {
|
|
186
|
-
if (_io3(input))
|
|
187
|
-
return _io3(input);
|
|
188
|
-
if (_io13(input))
|
|
189
|
-
return _io13(input);
|
|
190
|
-
return false;
|
|
191
|
-
})();
|
|
192
|
-
})(); const _it0 = input => null !== input[0] && undefined !== input[0] && ("function" === typeof input[0] || "bigint" === typeof input[0] || (Array.isArray(input[0]) && (_it0(input[0]) || false) || "object" === typeof input[0] && null !== input[0] && _iu0(input[0]))) && (Array.isArray(input.slice(1)) && input.slice(1).every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))); const _ao0 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
|
|
193
|
-
const value = input[key];
|
|
194
|
-
if (undefined === value)
|
|
195
|
-
return true;
|
|
196
|
-
return (null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
197
|
-
method: "createAssert",
|
|
198
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
199
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o12 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
200
|
-
value: value
|
|
201
|
-
}, _errorFactory)) && (undefined !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
202
|
-
method: "createAssert",
|
|
203
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
204
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o12 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
205
|
-
value: value
|
|
206
|
-
}, _errorFactory)) && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_at0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
207
|
-
method: "createAssert",
|
|
208
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
209
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
210
|
-
value: value
|
|
211
|
-
}, _errorFactory)) || "object" === typeof value && null !== value && _au1(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
212
|
-
method: "createAssert",
|
|
213
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
214
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o12 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
215
|
-
value: value
|
|
216
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
217
|
-
method: "createAssert",
|
|
218
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
219
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o12 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
220
|
-
value: value
|
|
221
|
-
}, _errorFactory));
|
|
222
|
-
}); const _ao1 = (input, _path, _exceptionable = true) => (Array.isArray(input.choice) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
223
|
-
method: "createAssert",
|
|
224
|
-
path: _path + ".choice",
|
|
225
|
-
expected: "(Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>)",
|
|
226
|
-
value: input.choice
|
|
227
|
-
}, _errorFactory)) && (_ap1(input.choice, _path + ".choice", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
228
|
-
method: "createAssert",
|
|
229
|
-
path: _path + ".choice",
|
|
230
|
-
expected: "Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>",
|
|
231
|
-
value: input.choice
|
|
232
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
233
|
-
method: "createAssert",
|
|
234
|
-
path: _path + ".choice",
|
|
235
|
-
expected: "(Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>)",
|
|
236
|
-
value: input.choice
|
|
237
|
-
}, _errorFactory); const _ao2 = (input, _path, _exceptionable = true) => (null !== input.sequenceOf || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
238
|
-
method: "createAssert",
|
|
239
|
-
path: _path + ".sequenceOf",
|
|
240
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
241
|
-
value: input.sequenceOf
|
|
242
|
-
}, _errorFactory)) && (undefined !== input.sequenceOf || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
243
|
-
method: "createAssert",
|
|
244
|
-
path: _path + ".sequenceOf",
|
|
245
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
246
|
-
value: input.sequenceOf
|
|
247
|
-
}, _errorFactory)) && ("function" === typeof input.sequenceOf || "bigint" === typeof input.sequenceOf || (Array.isArray(input.sequenceOf) && (_at0(input.sequenceOf, _path + ".sequenceOf", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
248
|
-
method: "createAssert",
|
|
249
|
-
path: _path + ".sequenceOf",
|
|
250
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
251
|
-
value: input.sequenceOf
|
|
252
|
-
}, _errorFactory)) || "object" === typeof input.sequenceOf && null !== input.sequenceOf && _au0(input.sequenceOf, _path + ".sequenceOf", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
253
|
-
method: "createAssert",
|
|
254
|
-
path: _path + ".sequenceOf",
|
|
255
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
256
|
-
value: input.sequenceOf
|
|
257
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
258
|
-
method: "createAssert",
|
|
259
|
-
path: _path + ".sequenceOf",
|
|
260
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
261
|
-
value: input.sequenceOf
|
|
262
|
-
}, _errorFactory)); const _ao3 = (input, _path, _exceptionable = true) => (null !== input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
263
|
-
method: "createAssert",
|
|
264
|
-
path: _path + ".optional",
|
|
265
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
266
|
-
value: input.optional
|
|
267
|
-
}, _errorFactory)) && (undefined !== input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
268
|
-
method: "createAssert",
|
|
269
|
-
path: _path + ".optional",
|
|
270
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
271
|
-
value: input.optional
|
|
272
|
-
}, _errorFactory)) && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_at0(input.optional, _path + ".optional", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
273
|
-
method: "createAssert",
|
|
274
|
-
path: _path + ".optional",
|
|
275
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
276
|
-
value: input.optional
|
|
277
|
-
}, _errorFactory)) || "object" === typeof input.optional && null !== input.optional && _au0(input.optional, _path + ".optional", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
278
|
-
method: "createAssert",
|
|
279
|
-
path: _path + ".optional",
|
|
280
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
281
|
-
value: input.optional
|
|
282
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
283
|
-
method: "createAssert",
|
|
284
|
-
path: _path + ".optional",
|
|
285
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
286
|
-
value: input.optional
|
|
287
|
-
}, _errorFactory)); const _ao4 = (input, _path, _exceptionable = true) => ("context" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
288
|
-
method: "createAssert",
|
|
289
|
-
path: _path + ".type",
|
|
290
|
-
expected: "\"context\"",
|
|
291
|
-
value: input.type
|
|
292
|
-
}, _errorFactory)) && ("explicit" === input.kind || "implicit" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
293
|
-
method: "createAssert",
|
|
294
|
-
path: _path + ".kind",
|
|
295
|
-
expected: "(\"explicit\" | \"implicit\")",
|
|
296
|
-
value: input.kind
|
|
297
|
-
}, _errorFactory)) && ((null !== input.contains || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
298
|
-
method: "createAssert",
|
|
299
|
-
path: _path + ".contains",
|
|
300
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
301
|
-
value: input.contains
|
|
302
|
-
}, _errorFactory)) && (undefined !== input.contains || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
303
|
-
method: "createAssert",
|
|
304
|
-
path: _path + ".contains",
|
|
305
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
306
|
-
value: input.contains
|
|
307
|
-
}, _errorFactory)) && ("function" === typeof input.contains || "bigint" === typeof input.contains || (Array.isArray(input.contains) && (_at0(input.contains, _path + ".contains", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
308
|
-
method: "createAssert",
|
|
309
|
-
path: _path + ".contains",
|
|
310
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
311
|
-
value: input.contains
|
|
312
|
-
}, _errorFactory)) || "object" === typeof input.contains && null !== input.contains && _au0(input.contains, _path + ".contains", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
313
|
-
method: "createAssert",
|
|
314
|
-
path: _path + ".contains",
|
|
315
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
316
|
-
value: input.contains
|
|
317
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
318
|
-
method: "createAssert",
|
|
319
|
-
path: _path + ".contains",
|
|
320
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
321
|
-
value: input.contains
|
|
322
|
-
}, _errorFactory))) && ("number" === typeof input.value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
323
|
-
method: "createAssert",
|
|
324
|
-
path: _path + ".value",
|
|
325
|
-
expected: "number",
|
|
326
|
-
value: input.value
|
|
327
|
-
}, _errorFactory)); const _ao5 = (input, _path, _exceptionable = true) => ("oid" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
328
|
-
method: "createAssert",
|
|
329
|
-
path: _path + ".type",
|
|
330
|
-
expected: "\"oid\"",
|
|
331
|
-
value: input.type
|
|
332
|
-
}, _errorFactory)) && ("string" === typeof input.oid || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
333
|
-
method: "createAssert",
|
|
334
|
-
path: _path + ".oid",
|
|
335
|
-
expected: "string",
|
|
336
|
-
value: input.oid
|
|
337
|
-
}, _errorFactory)); const _ao6 = (input, _path, _exceptionable = true) => ("string" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
338
|
-
method: "createAssert",
|
|
339
|
-
path: _path + ".type",
|
|
340
|
-
expected: "\"string\"",
|
|
341
|
-
value: input.type
|
|
342
|
-
}, _errorFactory)) && ("printable" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
343
|
-
method: "createAssert",
|
|
344
|
-
path: _path + ".kind",
|
|
345
|
-
expected: "\"printable\"",
|
|
346
|
-
value: input.kind
|
|
347
|
-
}, _errorFactory)); const _ao7 = (input, _path, _exceptionable = true) => ("string" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
348
|
-
method: "createAssert",
|
|
349
|
-
path: _path + ".type",
|
|
350
|
-
expected: "\"string\"",
|
|
351
|
-
value: input.type
|
|
352
|
-
}, _errorFactory)) && ("ia5" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
353
|
-
method: "createAssert",
|
|
354
|
-
path: _path + ".kind",
|
|
355
|
-
expected: "\"ia5\"",
|
|
356
|
-
value: input.kind
|
|
357
|
-
}, _errorFactory)); const _ao8 = (input, _path, _exceptionable = true) => ("string" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
358
|
-
method: "createAssert",
|
|
359
|
-
path: _path + ".type",
|
|
360
|
-
expected: "\"string\"",
|
|
361
|
-
value: input.type
|
|
362
|
-
}, _errorFactory)) && ("utf8" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
363
|
-
method: "createAssert",
|
|
364
|
-
path: _path + ".kind",
|
|
365
|
-
expected: "\"utf8\"",
|
|
366
|
-
value: input.kind
|
|
367
|
-
}, _errorFactory)); const _ao9 = (input, _path, _exceptionable = true) => ("date" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
368
|
-
method: "createAssert",
|
|
369
|
-
path: _path + ".type",
|
|
370
|
-
expected: "\"date\"",
|
|
371
|
-
value: input.type
|
|
372
|
-
}, _errorFactory)) && ("utc" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
373
|
-
method: "createAssert",
|
|
374
|
-
path: _path + ".kind",
|
|
375
|
-
expected: "\"utc\"",
|
|
376
|
-
value: input.kind
|
|
377
|
-
}, _errorFactory)); const _ao10 = (input, _path, _exceptionable = true) => ("date" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
378
|
-
method: "createAssert",
|
|
379
|
-
path: _path + ".type",
|
|
380
|
-
expected: "\"date\"",
|
|
381
|
-
value: input.type
|
|
382
|
-
}, _errorFactory)) && ("general" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
383
|
-
method: "createAssert",
|
|
384
|
-
path: _path + ".kind",
|
|
385
|
-
expected: "\"general\"",
|
|
386
|
-
value: input.kind
|
|
387
|
-
}, _errorFactory)); const _ao11 = (input, _path, _exceptionable = true) => ("struct" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
388
|
-
method: "createAssert",
|
|
389
|
-
path: _path + ".type",
|
|
390
|
-
expected: "\"struct\"",
|
|
391
|
-
value: input.type
|
|
392
|
-
}, _errorFactory)) && ((Array.isArray(input.fieldNames) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
393
|
-
method: "createAssert",
|
|
394
|
-
path: _path + ".fieldNames",
|
|
395
|
-
expected: "Array<string>",
|
|
396
|
-
value: input.fieldNames
|
|
397
|
-
}, _errorFactory)) && input.fieldNames.every((elem, _index11) => "string" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
398
|
-
method: "createAssert",
|
|
399
|
-
path: _path + ".fieldNames[" + _index11 + "]",
|
|
400
|
-
expected: "string",
|
|
401
|
-
value: elem
|
|
402
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
403
|
-
method: "createAssert",
|
|
404
|
-
path: _path + ".fieldNames",
|
|
405
|
-
expected: "Array<string>",
|
|
406
|
-
value: input.fieldNames
|
|
407
|
-
}, _errorFactory)) && (("object" === typeof input.contains && null !== input.contains && false === Array.isArray(input.contains) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
408
|
-
method: "createAssert",
|
|
409
|
-
path: _path + ".contains",
|
|
410
|
-
expected: "__type.o11",
|
|
411
|
-
value: input.contains
|
|
412
|
-
}, _errorFactory)) && _ao12(input.contains, _path + ".contains", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
413
|
-
method: "createAssert",
|
|
414
|
-
path: _path + ".contains",
|
|
415
|
-
expected: "__type.o11",
|
|
416
|
-
value: input.contains
|
|
417
|
-
}, _errorFactory)); const _ao12 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
|
|
418
|
-
const value = input[key];
|
|
419
|
-
if (undefined === value)
|
|
420
|
-
return true;
|
|
421
|
-
return (null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
422
|
-
method: "createAssert",
|
|
423
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
424
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
425
|
-
value: value
|
|
426
|
-
}, _errorFactory)) && (undefined !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
427
|
-
method: "createAssert",
|
|
428
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
429
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
430
|
-
value: value
|
|
431
|
-
}, _errorFactory)) && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_at0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
432
|
-
method: "createAssert",
|
|
433
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
434
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
435
|
-
value: value
|
|
436
|
-
}, _errorFactory)) || "object" === typeof value && null !== value && _au0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
437
|
-
method: "createAssert",
|
|
438
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
439
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
440
|
-
value: value
|
|
441
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
442
|
-
method: "createAssert",
|
|
443
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
444
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
445
|
-
value: value
|
|
446
|
-
}, _errorFactory));
|
|
447
|
-
}); const _ao13 = (input, _path, _exceptionable = true) => (null !== input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
448
|
-
method: "createAssert",
|
|
449
|
-
path: _path + ".optional",
|
|
450
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
451
|
-
value: input.optional
|
|
452
|
-
}, _errorFactory)) && (undefined !== input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
453
|
-
method: "createAssert",
|
|
454
|
-
path: _path + ".optional",
|
|
455
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
456
|
-
value: input.optional
|
|
457
|
-
}, _errorFactory)) && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_at0(input.optional, _path + ".optional", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
458
|
-
method: "createAssert",
|
|
459
|
-
path: _path + ".optional",
|
|
460
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
461
|
-
value: input.optional
|
|
462
|
-
}, _errorFactory)) || "object" === typeof input.optional && null !== input.optional && _au0(input.optional, _path + ".optional", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
463
|
-
method: "createAssert",
|
|
464
|
-
path: _path + ".optional",
|
|
465
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
466
|
-
value: input.optional
|
|
467
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
468
|
-
method: "createAssert",
|
|
469
|
-
path: _path + ".optional",
|
|
470
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
471
|
-
value: input.optional
|
|
472
|
-
}, _errorFactory)); const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
473
|
-
if (undefined !== input.choice)
|
|
474
|
-
return _ao1(input, _path, true && _exceptionable);
|
|
475
|
-
else if (undefined !== input.sequenceOf)
|
|
476
|
-
return _ao2(input, _path, true && _exceptionable);
|
|
477
|
-
else if (undefined !== input.optional)
|
|
478
|
-
return _ao3(input, _path, true && _exceptionable);
|
|
479
|
-
else if ("context" === input.type)
|
|
480
|
-
return _ao4(input, _path, true && _exceptionable);
|
|
481
|
-
else if ("oid" === input.type)
|
|
482
|
-
return _ao5(input, _path, true && _exceptionable);
|
|
483
|
-
else if ("general" === input.kind)
|
|
484
|
-
return _ao10(input, _path, true && _exceptionable);
|
|
485
|
-
else if ("utc" === input.kind)
|
|
486
|
-
return _ao9(input, _path, true && _exceptionable);
|
|
487
|
-
else if ("utf8" === input.kind)
|
|
488
|
-
return _ao8(input, _path, true && _exceptionable);
|
|
489
|
-
else if ("ia5" === input.kind)
|
|
490
|
-
return _ao7(input, _path, true && _exceptionable);
|
|
491
|
-
else if ("printable" === input.kind)
|
|
492
|
-
return _ao6(input, _path, true && _exceptionable);
|
|
493
|
-
else if ("struct" === input.type)
|
|
494
|
-
return _ao11(input, _path, true && _exceptionable);
|
|
495
|
-
else
|
|
496
|
-
return __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
497
|
-
method: "createAssert",
|
|
498
|
-
path: _path,
|
|
499
|
-
expected: "(__type | __type.o1 | __type.o2 | __type.o3 | __type.o4 | __type.o9 | __type.o8 | __type.o7 | __type.o6 | __type.o5 | __type.o10)",
|
|
500
|
-
value: input
|
|
501
|
-
}, _errorFactory);
|
|
502
|
-
})(); const _au1 = (input, _path, _exceptionable = true) => (() => {
|
|
503
|
-
if (undefined !== input.choice)
|
|
504
|
-
return _ao1(input, _path, true && _exceptionable);
|
|
505
|
-
else if (undefined !== input.sequenceOf)
|
|
506
|
-
return _ao2(input, _path, true && _exceptionable);
|
|
507
|
-
else if ("context" === input.type)
|
|
508
|
-
return _ao4(input, _path, true && _exceptionable);
|
|
509
|
-
else if ("oid" === input.type)
|
|
510
|
-
return _ao5(input, _path, true && _exceptionable);
|
|
511
|
-
else if ("general" === input.kind)
|
|
512
|
-
return _ao10(input, _path, true && _exceptionable);
|
|
513
|
-
else if ("utc" === input.kind)
|
|
514
|
-
return _ao9(input, _path, true && _exceptionable);
|
|
515
|
-
else if ("utf8" === input.kind)
|
|
516
|
-
return _ao8(input, _path, true && _exceptionable);
|
|
517
|
-
else if ("ia5" === input.kind)
|
|
518
|
-
return _ao7(input, _path, true && _exceptionable);
|
|
519
|
-
else if ("printable" === input.kind)
|
|
520
|
-
return _ao6(input, _path, true && _exceptionable);
|
|
521
|
-
else if ("struct" === input.type)
|
|
522
|
-
return _ao11(input, _path, true && _exceptionable);
|
|
523
|
-
else
|
|
524
|
-
return _ao3(input, _path, false && _exceptionable) || _ao13(input, _path, false && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
525
|
-
method: "createAssert",
|
|
526
|
-
path: _path,
|
|
527
|
-
expected: "(__type.o2 | __type.o12)",
|
|
528
|
-
value: input
|
|
529
|
-
}, _errorFactory);
|
|
530
|
-
})(); const _at0 = (input, _path, _exceptionable = true) => (null !== input[0] || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
531
|
-
method: "createAssert",
|
|
532
|
-
path: _path + "[0]",
|
|
533
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
534
|
-
value: input[0]
|
|
535
|
-
}, _errorFactory)) && (undefined !== input[0] || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
536
|
-
method: "createAssert",
|
|
537
|
-
path: _path + "[0]",
|
|
538
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
539
|
-
value: input[0]
|
|
540
|
-
}, _errorFactory)) && ("function" === typeof input[0] || "bigint" === typeof input[0] || (Array.isArray(input[0]) && (_at0(input[0], _path + "[0]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
541
|
-
method: "createAssert",
|
|
542
|
-
path: _path + "[0]",
|
|
543
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
544
|
-
value: input[0]
|
|
545
|
-
}, _errorFactory)) || "object" === typeof input[0] && null !== input[0] && _au0(input[0], _path + "[0]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
546
|
-
method: "createAssert",
|
|
547
|
-
path: _path + "[0]",
|
|
548
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
549
|
-
value: input[0]
|
|
550
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
551
|
-
method: "createAssert",
|
|
552
|
-
path: _path + "[0]",
|
|
553
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
554
|
-
value: input[0]
|
|
555
|
-
}, _errorFactory)) && ((Array.isArray(input.slice(1)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
556
|
-
method: "createAssert",
|
|
557
|
-
path: _path,
|
|
558
|
-
expected: "...(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
559
|
-
value: input.slice(1)
|
|
560
|
-
}, _errorFactory)) && input.slice(1).every((elem, _index12) => (null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
561
|
-
method: "createAssert",
|
|
562
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
563
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
564
|
-
value: elem
|
|
565
|
-
}, _errorFactory)) && (undefined !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
566
|
-
method: "createAssert",
|
|
567
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
568
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
569
|
-
value: elem
|
|
570
|
-
}, _errorFactory)) && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_at0(elem, _path + "[" + (1 + _index12) + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
571
|
-
method: "createAssert",
|
|
572
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
573
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
574
|
-
value: elem
|
|
575
|
-
}, _errorFactory)) || "object" === typeof elem && null !== elem && _au0(elem, _path + "[" + (1 + _index12) + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
576
|
-
method: "createAssert",
|
|
577
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
578
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
579
|
-
value: elem
|
|
580
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
581
|
-
method: "createAssert",
|
|
582
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
583
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
584
|
-
value: elem
|
|
585
|
-
}, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
586
|
-
method: "createAssert",
|
|
587
|
-
path: _path,
|
|
588
|
-
expected: "...(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
589
|
-
value: input.slice(1)
|
|
590
|
-
}, _errorFactory)); const __is = input => "object" === typeof input && null !== input && false === Array.isArray(input) && _io0(input); let _errorFactory; return (input, errorFactory) => {
|
|
591
|
-
if (false === __is(input)) {
|
|
592
|
-
_errorFactory = errorFactory;
|
|
593
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input && false === Array.isArray(input) || __typia_transform__assertGuard._assertGuard(true, {
|
|
594
|
-
method: "createAssert",
|
|
595
|
-
path: _path + "",
|
|
596
|
-
expected: "StructFieldSchemaMap",
|
|
597
|
-
value: input
|
|
598
|
-
}, _errorFactory)) && _ao0(input, _path + "", true) || __typia_transform__assertGuard._assertGuard(true, {
|
|
599
|
-
method: "createAssert",
|
|
600
|
-
path: _path + "",
|
|
601
|
-
expected: "StructFieldSchemaMap",
|
|
602
|
-
value: input
|
|
603
|
-
}, _errorFactory))(input, "$input", true);
|
|
604
|
-
}
|
|
605
|
-
return input;
|
|
606
|
-
}; })();
|
|
607
|
-
const structSchemaGuard = (() => { const _ip0 = input => {
|
|
608
|
-
const array = input;
|
|
609
|
-
const top = input[0];
|
|
610
|
-
if (0 === input.length)
|
|
611
|
-
return true;
|
|
612
|
-
const arrayPredicators = [
|
|
613
|
-
[
|
|
614
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_it0(top) || false) || "object" === typeof top && null !== top && _iu0(top))),
|
|
615
|
-
entire => entire.every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))
|
|
616
|
-
],
|
|
617
|
-
[
|
|
618
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_it0(top) || false) || "object" === typeof top && null !== top && _iu0(top))),
|
|
619
|
-
entire => entire.every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))
|
|
620
|
-
]
|
|
621
|
-
];
|
|
622
|
-
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
623
|
-
if (1 === passed.length)
|
|
624
|
-
return passed[0][1](array);
|
|
625
|
-
else if (1 < passed.length)
|
|
626
|
-
for (const pred of passed)
|
|
627
|
-
if (array.every(value => true === pred[0](value)))
|
|
628
|
-
return pred[1](array);
|
|
629
|
-
return false;
|
|
630
|
-
}; const _io0 = input => "struct" === input.type && (Array.isArray(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && ("object" === typeof input.contains && null !== input.contains && false === Array.isArray(input.contains) && _io1(input.contains)); const _io1 = input => Object.keys(input).every(key => {
|
|
631
|
-
const value = input[key];
|
|
632
|
-
if (undefined === value)
|
|
633
|
-
return true;
|
|
634
|
-
return null !== value && undefined !== value && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_it0(value) || false) || "object" === typeof value && null !== value && _iu0(value)));
|
|
635
|
-
}); const _io2 = input => Array.isArray(input.choice) && (_ip0(input.choice) || false); const _io3 = input => null !== input.sequenceOf && undefined !== input.sequenceOf && ("function" === typeof input.sequenceOf || "bigint" === typeof input.sequenceOf || (Array.isArray(input.sequenceOf) && (_it0(input.sequenceOf) || false) || "object" === typeof input.sequenceOf && null !== input.sequenceOf && _iu0(input.sequenceOf))); const _io4 = input => null !== input.optional && undefined !== input.optional && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_it0(input.optional) || false) || "object" === typeof input.optional && null !== input.optional && _iu0(input.optional))); const _io5 = input => "context" === input.type && ("explicit" === input.kind || "implicit" === input.kind) && (null !== input.contains && undefined !== input.contains && ("function" === typeof input.contains || "bigint" === typeof input.contains || (Array.isArray(input.contains) && (_it0(input.contains) || false) || "object" === typeof input.contains && null !== input.contains && _iu0(input.contains)))) && "number" === typeof input.value; const _io6 = input => "oid" === input.type && "string" === typeof input.oid; const _io7 = input => "string" === input.type && "printable" === input.kind; const _io8 = input => "string" === input.type && "ia5" === input.kind; const _io9 = input => "string" === input.type && "utf8" === input.kind; const _io10 = input => "date" === input.type && "utc" === input.kind; const _io11 = input => "date" === input.type && "general" === input.kind; const _iu0 = input => (() => {
|
|
636
|
-
if (undefined !== input.choice)
|
|
637
|
-
return _io2(input);
|
|
638
|
-
else if (undefined !== input.sequenceOf)
|
|
639
|
-
return _io3(input);
|
|
640
|
-
else if (undefined !== input.optional)
|
|
641
|
-
return _io4(input);
|
|
642
|
-
else if ("context" === input.type)
|
|
643
|
-
return _io5(input);
|
|
644
|
-
else if ("oid" === input.type)
|
|
645
|
-
return _io6(input);
|
|
646
|
-
else if ("general" === input.kind)
|
|
647
|
-
return _io11(input);
|
|
648
|
-
else if ("utc" === input.kind)
|
|
649
|
-
return _io10(input);
|
|
650
|
-
else if ("utf8" === input.kind)
|
|
651
|
-
return _io9(input);
|
|
652
|
-
else if ("ia5" === input.kind)
|
|
653
|
-
return _io8(input);
|
|
654
|
-
else if ("printable" === input.kind)
|
|
655
|
-
return _io7(input);
|
|
656
|
-
else if ("struct" === input.type)
|
|
657
|
-
return _io0(input);
|
|
658
|
-
else
|
|
659
|
-
return false;
|
|
660
|
-
})(); const _it0 = input => null !== input[0] && undefined !== input[0] && ("function" === typeof input[0] || "bigint" === typeof input[0] || (Array.isArray(input[0]) && (_it0(input[0]) || false) || "object" === typeof input[0] && null !== input[0] && _iu0(input[0]))) && (Array.isArray(input.slice(1)) && input.slice(1).every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))); return input => "object" === typeof input && null !== input && _io0(input); })();
|
|
661
|
-
const structSchemaCache = new WeakMap();
|
|
662
|
-
function defaultPrintValue(value) {
|
|
663
|
-
try {
|
|
664
|
-
return (JSON.stringify(value));
|
|
665
|
-
}
|
|
666
|
-
catch {
|
|
667
|
-
return (String(value));
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
function isOptionalSchema(candidate) {
|
|
671
|
-
return (typeof candidate === 'object' && candidate !== null && 'optional' in candidate);
|
|
672
|
-
}
|
|
673
|
-
function isStructSchema(candidate) {
|
|
674
|
-
return (structSchemaGuard(candidate));
|
|
675
|
-
}
|
|
676
|
-
function ensureStructContains(schema) {
|
|
677
|
-
if (!schema.contains) {
|
|
678
|
-
return ({});
|
|
679
|
-
}
|
|
680
|
-
return (assertStructFieldSchemaMap(schema.contains));
|
|
681
|
-
}
|
|
682
|
-
function isPlainObject(value) {
|
|
683
|
-
return (typeof value === 'object' && value !== null && !Array.isArray(value));
|
|
684
|
-
}
|
|
685
|
-
function getFieldNames(schema) {
|
|
686
|
-
return (Array.isArray(schema.fieldNames) && schema.fieldNames.length > 0
|
|
687
|
-
? [...schema.fieldNames]
|
|
688
|
-
: Object.keys(ensureStructContains(schema)));
|
|
689
|
-
}
|
|
690
|
-
export function contextualizeStructSchema(schema) {
|
|
691
|
-
if (!isStructSchema(schema)) {
|
|
692
|
-
return (schema);
|
|
693
|
-
}
|
|
694
|
-
const cached = structSchemaCache.get(schema);
|
|
695
|
-
if (cached) {
|
|
696
|
-
return (cached);
|
|
697
|
-
}
|
|
698
|
-
const fieldNames = getFieldNames(schema);
|
|
699
|
-
const structContains = ensureStructContains(schema);
|
|
700
|
-
const contextualizedContains = {};
|
|
701
|
-
function wrapWithExplicitContext(index, innerSchema) {
|
|
702
|
-
if (typeof innerSchema === 'object' && innerSchema !== null && 'type' in innerSchema && innerSchema.type === 'context') {
|
|
703
|
-
return (innerSchema);
|
|
704
|
-
}
|
|
705
|
-
return ({
|
|
706
|
-
type: 'context',
|
|
707
|
-
kind: 'explicit',
|
|
708
|
-
value: index,
|
|
709
|
-
contains: contextualizeStructSchema(innerSchema)
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
for (const [index, fieldName] of fieldNames.entries()) {
|
|
713
|
-
const fieldSchema = structContains[fieldName];
|
|
714
|
-
if (!fieldSchema) {
|
|
715
|
-
continue;
|
|
716
|
-
}
|
|
717
|
-
if (isOptionalSchema(fieldSchema)) {
|
|
718
|
-
contextualizedContains[fieldName] = {
|
|
719
|
-
optional: wrapWithExplicitContext(index, fieldSchema.optional)
|
|
720
|
-
};
|
|
721
|
-
continue;
|
|
722
|
-
}
|
|
723
|
-
contextualizedContains[fieldName] = wrapWithExplicitContext(index, fieldSchema);
|
|
724
|
-
}
|
|
725
|
-
const contextualized = {
|
|
726
|
-
type: 'struct',
|
|
727
|
-
fieldNames,
|
|
728
|
-
contains: contextualizedContains
|
|
729
|
-
};
|
|
730
|
-
structSchemaCache.set(schema, contextualized);
|
|
731
|
-
return (contextualized);
|
|
732
|
-
}
|
|
733
|
-
function resolveSchema(schema) {
|
|
734
|
-
let current = schema;
|
|
735
|
-
while (typeof current === 'function') {
|
|
736
|
-
current = current();
|
|
737
|
-
}
|
|
738
|
-
return (current);
|
|
739
|
-
}
|
|
740
|
-
function prepareContextValue(schema, value, prepare) {
|
|
741
|
-
if (value === undefined) {
|
|
742
|
-
return (value);
|
|
743
|
-
}
|
|
744
|
-
if (isASN1ContextTag(value)) {
|
|
745
|
-
const preparedContains = prepare(schema.contains, value.contains);
|
|
746
|
-
if (preparedContains !== value.contains) {
|
|
747
|
-
return ({
|
|
748
|
-
type: 'context',
|
|
749
|
-
kind: value.kind,
|
|
750
|
-
value: value.value,
|
|
751
|
-
contains: preparedContains
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
return (value);
|
|
755
|
-
}
|
|
756
|
-
const contains = prepare(schema.contains, value);
|
|
757
|
-
return ({
|
|
758
|
-
type: 'context',
|
|
759
|
-
kind: schema.kind,
|
|
760
|
-
value: schema.value,
|
|
761
|
-
contains
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
function prepareStructValue(schema, value) {
|
|
765
|
-
const structContains = schema.contains ?? {};
|
|
766
|
-
const fieldNames = getFieldNames(schema);
|
|
767
|
-
if (isASN1Struct(value)) {
|
|
768
|
-
const preparedContains = {};
|
|
769
|
-
for (const [fieldName, fieldValue] of Object.entries(value.contains ?? {})) {
|
|
770
|
-
const fieldSchema = structContains[fieldName];
|
|
771
|
-
if (!fieldSchema) {
|
|
772
|
-
preparedContains[fieldName] = fieldValue;
|
|
773
|
-
continue;
|
|
774
|
-
}
|
|
775
|
-
const innerSchema = isOptionalSchema(fieldSchema) ? fieldSchema.optional : fieldSchema;
|
|
776
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
777
|
-
preparedContains[fieldName] = prepareValueForSchema(innerSchema, fieldValue);
|
|
778
|
-
}
|
|
779
|
-
return ({
|
|
780
|
-
type: 'struct',
|
|
781
|
-
fieldNames: value.fieldNames ?? fieldNames,
|
|
782
|
-
contains: preparedContains
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
if (!isPlainObject(value)) {
|
|
786
|
-
return (value);
|
|
787
|
-
}
|
|
788
|
-
const preparedContains = {};
|
|
789
|
-
for (const fieldName of fieldNames) {
|
|
790
|
-
const fieldSchema = structContains[fieldName];
|
|
791
|
-
if (!fieldSchema) {
|
|
792
|
-
continue;
|
|
793
|
-
}
|
|
794
|
-
const fieldValue = value[fieldName];
|
|
795
|
-
if (fieldValue === undefined) {
|
|
796
|
-
if (!isOptionalSchema(fieldSchema)) {
|
|
797
|
-
preparedContains[fieldName] = fieldValue;
|
|
798
|
-
}
|
|
799
|
-
continue;
|
|
800
|
-
}
|
|
801
|
-
const innerSchema = isOptionalSchema(fieldSchema) ? fieldSchema.optional : fieldSchema;
|
|
802
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
803
|
-
preparedContains[fieldName] = prepareValueForSchema(innerSchema, fieldValue);
|
|
804
|
-
}
|
|
805
|
-
return ({
|
|
806
|
-
type: 'struct',
|
|
807
|
-
fieldNames,
|
|
808
|
-
contains: preparedContains
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
function prepareValueForSchema(schema, value) {
|
|
812
|
-
const resolved = resolveSchema(schema);
|
|
813
|
-
if (value === undefined || value === null) {
|
|
814
|
-
return (value);
|
|
815
|
-
}
|
|
816
|
-
if (Array.isArray(resolved)) {
|
|
817
|
-
if (!Array.isArray(value)) {
|
|
818
|
-
return (value);
|
|
819
|
-
}
|
|
820
|
-
const result = [];
|
|
821
|
-
for (let i = 0; i < resolved.length; i++) {
|
|
822
|
-
result.push(prepareValueForSchema((() => { const _ip0 = input => {
|
|
823
|
-
const array = input;
|
|
824
|
-
const top = input[0];
|
|
825
|
-
if (0 === input.length)
|
|
826
|
-
return true;
|
|
827
|
-
const arrayPredicators = [
|
|
828
|
-
[
|
|
829
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_it0(top) || false) || "object" === typeof top && null !== top && _iu0(top))),
|
|
830
|
-
entire => entire.every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))
|
|
831
|
-
],
|
|
832
|
-
[
|
|
833
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_it0(top) || false) || "object" === typeof top && null !== top && _iu0(top))),
|
|
834
|
-
entire => entire.every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))
|
|
835
|
-
]
|
|
836
|
-
];
|
|
837
|
-
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
838
|
-
if (1 === passed.length)
|
|
839
|
-
return passed[0][1](array);
|
|
840
|
-
else if (1 < passed.length)
|
|
841
|
-
for (const pred of passed)
|
|
842
|
-
if (array.every(value => true === pred[0](value)))
|
|
843
|
-
return pred[1](array);
|
|
844
|
-
return false;
|
|
845
|
-
}; const _ap1 = (input, _path, _exceptionable = true) => {
|
|
846
|
-
const array = input;
|
|
847
|
-
const top = input[0];
|
|
848
|
-
if (0 === input.length)
|
|
849
|
-
return true;
|
|
850
|
-
const arrayPredicators = [
|
|
851
|
-
[
|
|
852
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_at0(top, _path, false && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
853
|
-
method: "assert",
|
|
854
|
-
path: _path,
|
|
855
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
856
|
-
value: top
|
|
857
|
-
}, _errorFactory)) || "object" === typeof top && null !== top && _au0(top, _path, false && _exceptionable))),
|
|
858
|
-
entire => entire.every((elem, _index9) => (null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
859
|
-
method: "assert",
|
|
860
|
-
path: _path + "[" + _index9 + "]",
|
|
861
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
862
|
-
value: elem
|
|
863
|
-
}, _errorFactory)) && (undefined !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
864
|
-
method: "assert",
|
|
865
|
-
path: _path + "[" + _index9 + "]",
|
|
866
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
867
|
-
value: elem
|
|
868
|
-
}, _errorFactory)) && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_at0(elem, _path + "[" + _index9 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
869
|
-
method: "assert",
|
|
870
|
-
path: _path + "[" + _index9 + "]",
|
|
871
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
872
|
-
value: elem
|
|
873
|
-
}, _errorFactory)) || "object" === typeof elem && null !== elem && _au0(elem, _path + "[" + _index9 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
874
|
-
method: "assert",
|
|
875
|
-
path: _path + "[" + _index9 + "]",
|
|
876
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
877
|
-
value: elem
|
|
878
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
879
|
-
method: "assert",
|
|
880
|
-
path: _path + "[" + _index9 + "]",
|
|
881
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
882
|
-
value: elem
|
|
883
|
-
}, _errorFactory)))
|
|
884
|
-
],
|
|
885
|
-
[
|
|
886
|
-
top => null !== top && undefined !== top && ("function" === typeof top || "bigint" === typeof top || (Array.isArray(top) && (_at0(top, _path, false && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
887
|
-
method: "assert",
|
|
888
|
-
path: _path,
|
|
889
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
890
|
-
value: top
|
|
891
|
-
}, _errorFactory)) || "object" === typeof top && null !== top && _au0(top, _path, false && _exceptionable))),
|
|
892
|
-
entire => entire.every((elem, _index10) => (null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
893
|
-
method: "assert",
|
|
894
|
-
path: _path + "[" + _index10 + "]",
|
|
895
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
896
|
-
value: elem
|
|
897
|
-
}, _errorFactory)) && (undefined !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
898
|
-
method: "assert",
|
|
899
|
-
path: _path + "[" + _index10 + "]",
|
|
900
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
901
|
-
value: elem
|
|
902
|
-
}, _errorFactory)) && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_at0(elem, _path + "[" + _index10 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
903
|
-
method: "assert",
|
|
904
|
-
path: _path + "[" + _index10 + "]",
|
|
905
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
906
|
-
value: elem
|
|
907
|
-
}, _errorFactory)) || "object" === typeof elem && null !== elem && _au0(elem, _path + "[" + _index10 + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
908
|
-
method: "assert",
|
|
909
|
-
path: _path + "[" + _index10 + "]",
|
|
910
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
911
|
-
value: elem
|
|
912
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
913
|
-
method: "assert",
|
|
914
|
-
path: _path + "[" + _index10 + "]",
|
|
915
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
916
|
-
value: elem
|
|
917
|
-
}, _errorFactory)))
|
|
918
|
-
]
|
|
919
|
-
];
|
|
920
|
-
const passed = arrayPredicators.filter(pred => pred[0](top));
|
|
921
|
-
if (1 === passed.length)
|
|
922
|
-
return passed[0][1](array);
|
|
923
|
-
else if (1 < passed.length)
|
|
924
|
-
for (const pred of passed)
|
|
925
|
-
if (array.every(value => true === pred[0](value)))
|
|
926
|
-
return pred[1](array);
|
|
927
|
-
return __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
928
|
-
method: "assert",
|
|
929
|
-
path: _path,
|
|
930
|
-
expected: "(Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>)",
|
|
931
|
-
value: input
|
|
932
|
-
}, _errorFactory);
|
|
933
|
-
}; const _io0 = input => Array.isArray(input.choice) && (_ip0(input.choice) || false); const _io1 = input => null !== input.sequenceOf && undefined !== input.sequenceOf && ("function" === typeof input.sequenceOf || "bigint" === typeof input.sequenceOf || (Array.isArray(input.sequenceOf) && (_it0(input.sequenceOf) || false) || "object" === typeof input.sequenceOf && null !== input.sequenceOf && _iu0(input.sequenceOf))); const _io2 = input => null !== input.optional && undefined !== input.optional && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_it0(input.optional) || false) || "object" === typeof input.optional && null !== input.optional && _iu0(input.optional))); const _io3 = input => "context" === input.type && ("explicit" === input.kind || "implicit" === input.kind) && (null !== input.contains && undefined !== input.contains && ("function" === typeof input.contains || "bigint" === typeof input.contains || (Array.isArray(input.contains) && (_it0(input.contains) || false) || "object" === typeof input.contains && null !== input.contains && _iu0(input.contains)))) && "number" === typeof input.value; const _io4 = input => "oid" === input.type && "string" === typeof input.oid; const _io5 = input => "string" === input.type && "printable" === input.kind; const _io6 = input => "string" === input.type && "ia5" === input.kind; const _io7 = input => "string" === input.type && "utf8" === input.kind; const _io8 = input => "date" === input.type && "utc" === input.kind; const _io9 = input => "date" === input.type && "general" === input.kind; const _io10 = input => "struct" === input.type && (Array.isArray(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && ("object" === typeof input.contains && null !== input.contains && false === Array.isArray(input.contains) && _io11(input.contains)); const _io11 = input => Object.keys(input).every(key => {
|
|
934
|
-
const value = input[key];
|
|
935
|
-
if (undefined === value)
|
|
936
|
-
return true;
|
|
937
|
-
return null !== value && undefined !== value && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_it0(value) || false) || "object" === typeof value && null !== value && _iu0(value)));
|
|
938
|
-
}); const _iu0 = input => (() => {
|
|
939
|
-
if (undefined !== input.choice)
|
|
940
|
-
return _io0(input);
|
|
941
|
-
else if (undefined !== input.sequenceOf)
|
|
942
|
-
return _io1(input);
|
|
943
|
-
else if (undefined !== input.optional)
|
|
944
|
-
return _io2(input);
|
|
945
|
-
else if ("context" === input.type)
|
|
946
|
-
return _io3(input);
|
|
947
|
-
else if ("oid" === input.type)
|
|
948
|
-
return _io4(input);
|
|
949
|
-
else if ("general" === input.kind)
|
|
950
|
-
return _io9(input);
|
|
951
|
-
else if ("utc" === input.kind)
|
|
952
|
-
return _io8(input);
|
|
953
|
-
else if ("utf8" === input.kind)
|
|
954
|
-
return _io7(input);
|
|
955
|
-
else if ("ia5" === input.kind)
|
|
956
|
-
return _io6(input);
|
|
957
|
-
else if ("printable" === input.kind)
|
|
958
|
-
return _io5(input);
|
|
959
|
-
else if ("struct" === input.type)
|
|
960
|
-
return _io10(input);
|
|
961
|
-
else
|
|
962
|
-
return false;
|
|
963
|
-
})(); const _it0 = input => null !== input[0] && undefined !== input[0] && ("function" === typeof input[0] || "bigint" === typeof input[0] || (Array.isArray(input[0]) && (_it0(input[0]) || false) || "object" === typeof input[0] && null !== input[0] && _iu0(input[0]))) && (Array.isArray(input.slice(1)) && input.slice(1).every(elem => null !== elem && undefined !== elem && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_it0(elem) || false) || "object" === typeof elem && null !== elem && _iu0(elem))))); const _ao0 = (input, _path, _exceptionable = true) => (Array.isArray(input.choice) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
964
|
-
method: "assert",
|
|
965
|
-
path: _path + ".choice",
|
|
966
|
-
expected: "(Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>)",
|
|
967
|
-
value: input.choice
|
|
968
|
-
}, _errorFactory)) && (_ap1(input.choice, _path + ".choice", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
969
|
-
method: "assert",
|
|
970
|
-
path: _path + ".choice",
|
|
971
|
-
expected: "Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>",
|
|
972
|
-
value: input.choice
|
|
973
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
974
|
-
method: "assert",
|
|
975
|
-
path: _path + ".choice",
|
|
976
|
-
expected: "(Array<ValidateASN1.Schema> | ReadonlyArray<ValidateASN1.Schema>)",
|
|
977
|
-
value: input.choice
|
|
978
|
-
}, _errorFactory); const _ao1 = (input, _path, _exceptionable = true) => (null !== input.sequenceOf || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
979
|
-
method: "assert",
|
|
980
|
-
path: _path + ".sequenceOf",
|
|
981
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
982
|
-
value: input.sequenceOf
|
|
983
|
-
}, _errorFactory)) && (undefined !== input.sequenceOf || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
984
|
-
method: "assert",
|
|
985
|
-
path: _path + ".sequenceOf",
|
|
986
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
987
|
-
value: input.sequenceOf
|
|
988
|
-
}, _errorFactory)) && ("function" === typeof input.sequenceOf || "bigint" === typeof input.sequenceOf || (Array.isArray(input.sequenceOf) && (_at0(input.sequenceOf, _path + ".sequenceOf", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
989
|
-
method: "assert",
|
|
990
|
-
path: _path + ".sequenceOf",
|
|
991
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
992
|
-
value: input.sequenceOf
|
|
993
|
-
}, _errorFactory)) || "object" === typeof input.sequenceOf && null !== input.sequenceOf && _au0(input.sequenceOf, _path + ".sequenceOf", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
994
|
-
method: "assert",
|
|
995
|
-
path: _path + ".sequenceOf",
|
|
996
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
997
|
-
value: input.sequenceOf
|
|
998
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
999
|
-
method: "assert",
|
|
1000
|
-
path: _path + ".sequenceOf",
|
|
1001
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1002
|
-
value: input.sequenceOf
|
|
1003
|
-
}, _errorFactory)); const _ao2 = (input, _path, _exceptionable = true) => (null !== input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1004
|
-
method: "assert",
|
|
1005
|
-
path: _path + ".optional",
|
|
1006
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1007
|
-
value: input.optional
|
|
1008
|
-
}, _errorFactory)) && (undefined !== input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1009
|
-
method: "assert",
|
|
1010
|
-
path: _path + ".optional",
|
|
1011
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1012
|
-
value: input.optional
|
|
1013
|
-
}, _errorFactory)) && ("function" === typeof input.optional || "bigint" === typeof input.optional || (Array.isArray(input.optional) && (_at0(input.optional, _path + ".optional", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1014
|
-
method: "assert",
|
|
1015
|
-
path: _path + ".optional",
|
|
1016
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
1017
|
-
value: input.optional
|
|
1018
|
-
}, _errorFactory)) || "object" === typeof input.optional && null !== input.optional && _au0(input.optional, _path + ".optional", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1019
|
-
method: "assert",
|
|
1020
|
-
path: _path + ".optional",
|
|
1021
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1022
|
-
value: input.optional
|
|
1023
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1024
|
-
method: "assert",
|
|
1025
|
-
path: _path + ".optional",
|
|
1026
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1027
|
-
value: input.optional
|
|
1028
|
-
}, _errorFactory)); const _ao3 = (input, _path, _exceptionable = true) => ("context" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1029
|
-
method: "assert",
|
|
1030
|
-
path: _path + ".type",
|
|
1031
|
-
expected: "\"context\"",
|
|
1032
|
-
value: input.type
|
|
1033
|
-
}, _errorFactory)) && ("explicit" === input.kind || "implicit" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1034
|
-
method: "assert",
|
|
1035
|
-
path: _path + ".kind",
|
|
1036
|
-
expected: "(\"explicit\" | \"implicit\")",
|
|
1037
|
-
value: input.kind
|
|
1038
|
-
}, _errorFactory)) && ((null !== input.contains || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1039
|
-
method: "assert",
|
|
1040
|
-
path: _path + ".contains",
|
|
1041
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1042
|
-
value: input.contains
|
|
1043
|
-
}, _errorFactory)) && (undefined !== input.contains || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1044
|
-
method: "assert",
|
|
1045
|
-
path: _path + ".contains",
|
|
1046
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1047
|
-
value: input.contains
|
|
1048
|
-
}, _errorFactory)) && ("function" === typeof input.contains || "bigint" === typeof input.contains || (Array.isArray(input.contains) && (_at0(input.contains, _path + ".contains", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1049
|
-
method: "assert",
|
|
1050
|
-
path: _path + ".contains",
|
|
1051
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
1052
|
-
value: input.contains
|
|
1053
|
-
}, _errorFactory)) || "object" === typeof input.contains && null !== input.contains && _au0(input.contains, _path + ".contains", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1054
|
-
method: "assert",
|
|
1055
|
-
path: _path + ".contains",
|
|
1056
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1057
|
-
value: input.contains
|
|
1058
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1059
|
-
method: "assert",
|
|
1060
|
-
path: _path + ".contains",
|
|
1061
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1062
|
-
value: input.contains
|
|
1063
|
-
}, _errorFactory))) && ("number" === typeof input.value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1064
|
-
method: "assert",
|
|
1065
|
-
path: _path + ".value",
|
|
1066
|
-
expected: "number",
|
|
1067
|
-
value: input.value
|
|
1068
|
-
}, _errorFactory)); const _ao4 = (input, _path, _exceptionable = true) => ("oid" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1069
|
-
method: "assert",
|
|
1070
|
-
path: _path + ".type",
|
|
1071
|
-
expected: "\"oid\"",
|
|
1072
|
-
value: input.type
|
|
1073
|
-
}, _errorFactory)) && ("string" === typeof input.oid || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1074
|
-
method: "assert",
|
|
1075
|
-
path: _path + ".oid",
|
|
1076
|
-
expected: "string",
|
|
1077
|
-
value: input.oid
|
|
1078
|
-
}, _errorFactory)); const _ao5 = (input, _path, _exceptionable = true) => ("string" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1079
|
-
method: "assert",
|
|
1080
|
-
path: _path + ".type",
|
|
1081
|
-
expected: "\"string\"",
|
|
1082
|
-
value: input.type
|
|
1083
|
-
}, _errorFactory)) && ("printable" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1084
|
-
method: "assert",
|
|
1085
|
-
path: _path + ".kind",
|
|
1086
|
-
expected: "\"printable\"",
|
|
1087
|
-
value: input.kind
|
|
1088
|
-
}, _errorFactory)); const _ao6 = (input, _path, _exceptionable = true) => ("string" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1089
|
-
method: "assert",
|
|
1090
|
-
path: _path + ".type",
|
|
1091
|
-
expected: "\"string\"",
|
|
1092
|
-
value: input.type
|
|
1093
|
-
}, _errorFactory)) && ("ia5" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1094
|
-
method: "assert",
|
|
1095
|
-
path: _path + ".kind",
|
|
1096
|
-
expected: "\"ia5\"",
|
|
1097
|
-
value: input.kind
|
|
1098
|
-
}, _errorFactory)); const _ao7 = (input, _path, _exceptionable = true) => ("string" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1099
|
-
method: "assert",
|
|
1100
|
-
path: _path + ".type",
|
|
1101
|
-
expected: "\"string\"",
|
|
1102
|
-
value: input.type
|
|
1103
|
-
}, _errorFactory)) && ("utf8" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1104
|
-
method: "assert",
|
|
1105
|
-
path: _path + ".kind",
|
|
1106
|
-
expected: "\"utf8\"",
|
|
1107
|
-
value: input.kind
|
|
1108
|
-
}, _errorFactory)); const _ao8 = (input, _path, _exceptionable = true) => ("date" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1109
|
-
method: "assert",
|
|
1110
|
-
path: _path + ".type",
|
|
1111
|
-
expected: "\"date\"",
|
|
1112
|
-
value: input.type
|
|
1113
|
-
}, _errorFactory)) && ("utc" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1114
|
-
method: "assert",
|
|
1115
|
-
path: _path + ".kind",
|
|
1116
|
-
expected: "\"utc\"",
|
|
1117
|
-
value: input.kind
|
|
1118
|
-
}, _errorFactory)); const _ao9 = (input, _path, _exceptionable = true) => ("date" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1119
|
-
method: "assert",
|
|
1120
|
-
path: _path + ".type",
|
|
1121
|
-
expected: "\"date\"",
|
|
1122
|
-
value: input.type
|
|
1123
|
-
}, _errorFactory)) && ("general" === input.kind || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1124
|
-
method: "assert",
|
|
1125
|
-
path: _path + ".kind",
|
|
1126
|
-
expected: "\"general\"",
|
|
1127
|
-
value: input.kind
|
|
1128
|
-
}, _errorFactory)); const _ao10 = (input, _path, _exceptionable = true) => ("struct" === input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1129
|
-
method: "assert",
|
|
1130
|
-
path: _path + ".type",
|
|
1131
|
-
expected: "\"struct\"",
|
|
1132
|
-
value: input.type
|
|
1133
|
-
}, _errorFactory)) && ((Array.isArray(input.fieldNames) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1134
|
-
method: "assert",
|
|
1135
|
-
path: _path + ".fieldNames",
|
|
1136
|
-
expected: "Array<string>",
|
|
1137
|
-
value: input.fieldNames
|
|
1138
|
-
}, _errorFactory)) && input.fieldNames.every((elem, _index11) => "string" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1139
|
-
method: "assert",
|
|
1140
|
-
path: _path + ".fieldNames[" + _index11 + "]",
|
|
1141
|
-
expected: "string",
|
|
1142
|
-
value: elem
|
|
1143
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1144
|
-
method: "assert",
|
|
1145
|
-
path: _path + ".fieldNames",
|
|
1146
|
-
expected: "Array<string>",
|
|
1147
|
-
value: input.fieldNames
|
|
1148
|
-
}, _errorFactory)) && (("object" === typeof input.contains && null !== input.contains && false === Array.isArray(input.contains) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1149
|
-
method: "assert",
|
|
1150
|
-
path: _path + ".contains",
|
|
1151
|
-
expected: "__type.o11",
|
|
1152
|
-
value: input.contains
|
|
1153
|
-
}, _errorFactory)) && _ao11(input.contains, _path + ".contains", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1154
|
-
method: "assert",
|
|
1155
|
-
path: _path + ".contains",
|
|
1156
|
-
expected: "__type.o11",
|
|
1157
|
-
value: input.contains
|
|
1158
|
-
}, _errorFactory)); const _ao11 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
|
|
1159
|
-
const value = input[key];
|
|
1160
|
-
if (undefined === value)
|
|
1161
|
-
return true;
|
|
1162
|
-
return (null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1163
|
-
method: "assert",
|
|
1164
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
1165
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1166
|
-
value: value
|
|
1167
|
-
}, _errorFactory)) && (undefined !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1168
|
-
method: "assert",
|
|
1169
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
1170
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1171
|
-
value: value
|
|
1172
|
-
}, _errorFactory)) && ("function" === typeof value || "bigint" === typeof value || (Array.isArray(value) && (_at0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1173
|
-
method: "assert",
|
|
1174
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
1175
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
1176
|
-
value: value
|
|
1177
|
-
}, _errorFactory)) || "object" === typeof value && null !== value && _au0(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1178
|
-
method: "assert",
|
|
1179
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
1180
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1181
|
-
value: value
|
|
1182
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1183
|
-
method: "assert",
|
|
1184
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
1185
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1186
|
-
value: value
|
|
1187
|
-
}, _errorFactory));
|
|
1188
|
-
}); const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
1189
|
-
if (undefined !== input.choice)
|
|
1190
|
-
return _ao0(input, _path, true && _exceptionable);
|
|
1191
|
-
else if (undefined !== input.sequenceOf)
|
|
1192
|
-
return _ao1(input, _path, true && _exceptionable);
|
|
1193
|
-
else if (undefined !== input.optional)
|
|
1194
|
-
return _ao2(input, _path, true && _exceptionable);
|
|
1195
|
-
else if ("context" === input.type)
|
|
1196
|
-
return _ao3(input, _path, true && _exceptionable);
|
|
1197
|
-
else if ("oid" === input.type)
|
|
1198
|
-
return _ao4(input, _path, true && _exceptionable);
|
|
1199
|
-
else if ("general" === input.kind)
|
|
1200
|
-
return _ao9(input, _path, true && _exceptionable);
|
|
1201
|
-
else if ("utc" === input.kind)
|
|
1202
|
-
return _ao8(input, _path, true && _exceptionable);
|
|
1203
|
-
else if ("utf8" === input.kind)
|
|
1204
|
-
return _ao7(input, _path, true && _exceptionable);
|
|
1205
|
-
else if ("ia5" === input.kind)
|
|
1206
|
-
return _ao6(input, _path, true && _exceptionable);
|
|
1207
|
-
else if ("printable" === input.kind)
|
|
1208
|
-
return _ao5(input, _path, true && _exceptionable);
|
|
1209
|
-
else if ("struct" === input.type)
|
|
1210
|
-
return _ao10(input, _path, true && _exceptionable);
|
|
1211
|
-
else
|
|
1212
|
-
return __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1213
|
-
method: "assert",
|
|
1214
|
-
path: _path,
|
|
1215
|
-
expected: "(__type | __type.o1 | __type.o2 | __type.o3 | __type.o4 | __type.o9 | __type.o8 | __type.o7 | __type.o6 | __type.o5 | __type.o10)",
|
|
1216
|
-
value: input
|
|
1217
|
-
}, _errorFactory);
|
|
1218
|
-
})(); const _at0 = (input, _path, _exceptionable = true) => (null !== input[0] || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1219
|
-
method: "assert",
|
|
1220
|
-
path: _path + "[0]",
|
|
1221
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1222
|
-
value: input[0]
|
|
1223
|
-
}, _errorFactory)) && (undefined !== input[0] || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1224
|
-
method: "assert",
|
|
1225
|
-
path: _path + "[0]",
|
|
1226
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1227
|
-
value: input[0]
|
|
1228
|
-
}, _errorFactory)) && ("function" === typeof input[0] || "bigint" === typeof input[0] || (Array.isArray(input[0]) && (_at0(input[0], _path + "[0]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1229
|
-
method: "assert",
|
|
1230
|
-
path: _path + "[0]",
|
|
1231
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
1232
|
-
value: input[0]
|
|
1233
|
-
}, _errorFactory)) || "object" === typeof input[0] && null !== input[0] && _au0(input[0], _path + "[0]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1234
|
-
method: "assert",
|
|
1235
|
-
path: _path + "[0]",
|
|
1236
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1237
|
-
value: input[0]
|
|
1238
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1239
|
-
method: "assert",
|
|
1240
|
-
path: _path + "[0]",
|
|
1241
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1242
|
-
value: input[0]
|
|
1243
|
-
}, _errorFactory)) && ((Array.isArray(input.slice(1)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1244
|
-
method: "assert",
|
|
1245
|
-
path: _path,
|
|
1246
|
-
expected: "...(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1247
|
-
value: input.slice(1)
|
|
1248
|
-
}, _errorFactory)) && input.slice(1).every((elem, _index12) => (null !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1249
|
-
method: "assert",
|
|
1250
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
1251
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1252
|
-
value: elem
|
|
1253
|
-
}, _errorFactory)) && (undefined !== elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1254
|
-
method: "assert",
|
|
1255
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
1256
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1257
|
-
value: elem
|
|
1258
|
-
}, _errorFactory)) && ("function" === typeof elem || "bigint" === typeof elem || (Array.isArray(elem) && (_at0(elem, _path + "[" + (1 + _index12) + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1259
|
-
method: "assert",
|
|
1260
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
1261
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
1262
|
-
value: elem
|
|
1263
|
-
}, _errorFactory)) || "object" === typeof elem && null !== elem && _au0(elem, _path + "[" + (1 + _index12) + "]", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1264
|
-
method: "assert",
|
|
1265
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
1266
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1267
|
-
value: elem
|
|
1268
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1269
|
-
method: "assert",
|
|
1270
|
-
path: _path + "[" + (1 + _index12) + "]",
|
|
1271
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1272
|
-
value: elem
|
|
1273
|
-
}, _errorFactory))) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1274
|
-
method: "assert",
|
|
1275
|
-
path: _path,
|
|
1276
|
-
expected: "...(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1277
|
-
value: input.slice(1)
|
|
1278
|
-
}, _errorFactory)); const __is = input => null !== input && undefined !== input && ("function" === typeof input || "bigint" === typeof input || (Array.isArray(input) && (_it0(input) || false) || "object" === typeof input && null !== input && _iu0(input))); let _errorFactory; return (input, errorFactory) => {
|
|
1279
|
-
if (false === __is(input)) {
|
|
1280
|
-
_errorFactory = errorFactory;
|
|
1281
|
-
((input, _path, _exceptionable = true) => (null !== input || __typia_transform__assertGuard._assertGuard(true, {
|
|
1282
|
-
method: "assert",
|
|
1283
|
-
path: _path + "",
|
|
1284
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1285
|
-
value: input
|
|
1286
|
-
}, _errorFactory)) && (undefined !== input || __typia_transform__assertGuard._assertGuard(true, {
|
|
1287
|
-
method: "assert",
|
|
1288
|
-
path: _path + "",
|
|
1289
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1290
|
-
value: input
|
|
1291
|
-
}, _errorFactory)) && ("function" === typeof input || "bigint" === typeof input || (Array.isArray(input) && (_at0(input, _path + "", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
|
|
1292
|
-
method: "assert",
|
|
1293
|
-
path: _path + "",
|
|
1294
|
-
expected: "readonly [Schema, ...Schema[]]",
|
|
1295
|
-
value: input
|
|
1296
|
-
}, _errorFactory)) || "object" === typeof input && null !== input && _au0(input, _path + "", true) || __typia_transform__assertGuard._assertGuard(true, {
|
|
1297
|
-
method: "assert",
|
|
1298
|
-
path: _path + "",
|
|
1299
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1300
|
-
value: input
|
|
1301
|
-
}, _errorFactory)) || __typia_transform__assertGuard._assertGuard(true, {
|
|
1302
|
-
method: "assert",
|
|
1303
|
-
path: _path + "",
|
|
1304
|
-
expected: "(__type | __type.o1 | __type.o10 | __type.o2 | __type.o3 | __type.o4 | __type.o5 | __type.o6 | __type.o7 | __type.o8 | __type.o9 | bigint | readonly [Schema, ...Schema[]])",
|
|
1305
|
-
value: input
|
|
1306
|
-
}, _errorFactory)))(input, "$input", true);
|
|
1307
|
-
}
|
|
1308
|
-
return input;
|
|
1309
|
-
}; })()(resolved[i]), value[i]));
|
|
1310
|
-
}
|
|
1311
|
-
return (result);
|
|
1312
|
-
}
|
|
1313
|
-
if (typeof resolved === 'object' && resolved !== null) {
|
|
1314
|
-
if ('optional' in resolved) {
|
|
1315
|
-
if (value === undefined) {
|
|
1316
|
-
return (undefined);
|
|
1317
|
-
}
|
|
1318
|
-
return (prepareValueForSchema(resolved.optional, value));
|
|
1319
|
-
}
|
|
1320
|
-
if ('sequenceOf' in resolved) {
|
|
1321
|
-
if (!Array.isArray(value)) {
|
|
1322
|
-
return (value);
|
|
1323
|
-
}
|
|
1324
|
-
return (value.map(item => prepareValueForSchema(resolved.sequenceOf, item)));
|
|
1325
|
-
}
|
|
1326
|
-
if ('choice' in resolved) {
|
|
1327
|
-
const choices = Array.isArray(resolved.choice)
|
|
1328
|
-
? resolved.choice
|
|
1329
|
-
: Array.from(resolved.choice);
|
|
1330
|
-
for (const choiceSchema of choices) {
|
|
1331
|
-
const preparedChoice = prepareValueForSchema(choiceSchema, value);
|
|
1332
|
-
if (preparedChoice !== value) {
|
|
1333
|
-
return (preparedChoice);
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
return (value);
|
|
1337
|
-
}
|
|
1338
|
-
if ('type' in resolved) {
|
|
1339
|
-
switch (resolved.type) {
|
|
1340
|
-
case 'context':
|
|
1341
|
-
return (prepareContextValue(resolved, value, prepareValueForSchema));
|
|
1342
|
-
case 'struct':
|
|
1343
|
-
return (prepareStructValue(resolved, value));
|
|
1344
|
-
default:
|
|
1345
|
-
return (value);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
return (value);
|
|
1350
|
-
}
|
|
1351
|
-
export function encodeValueBySchema(schema, value, options) {
|
|
1352
|
-
const contextualized = contextualizeStructSchema(schema);
|
|
1353
|
-
try {
|
|
1354
|
-
const preparedUnknown = prepareValueForSchema(contextualized, value);
|
|
1355
|
-
// XXX:TODO Fix depth issue
|
|
1356
|
-
// @ts-ignore
|
|
1357
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/consistent-type-assertions
|
|
1358
|
-
return (ValidateASN1.againstSchema(preparedUnknown, contextualized));
|
|
1359
|
-
}
|
|
1360
|
-
catch (err) {
|
|
1361
|
-
const printer = options?.valuePrinter ?? defaultPrintValue;
|
|
1362
|
-
const prefix = options?.attributeName ? `Attribute ${options.attributeName}: ` : '';
|
|
1363
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1364
|
-
throw (new Error(`${prefix}${message} (value: ${printer(value)})`));
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
export function normalizeDecodedASN1(input, principals) {
|
|
1368
|
-
if (input === undefined || input === null) {
|
|
1369
|
-
return (input);
|
|
1370
|
-
}
|
|
1371
|
-
if (Array.isArray(input)) {
|
|
1372
|
-
return (input.map(function (childInput) {
|
|
1373
|
-
return (normalizeDecodedASN1(childInput, principals));
|
|
1374
|
-
}));
|
|
1375
|
-
}
|
|
1376
|
-
if (input instanceof Date) {
|
|
1377
|
-
return (input);
|
|
1378
|
-
}
|
|
1379
|
-
if (Buffer.isBuffer(input) || input instanceof ArrayBuffer) {
|
|
1380
|
-
return (input);
|
|
1381
|
-
}
|
|
1382
|
-
if (isASN1ContextTag(input)) {
|
|
1383
|
-
return (normalizeDecodedASN1(input.contains, principals));
|
|
1384
|
-
}
|
|
1385
|
-
if (isASN1String(input)) {
|
|
1386
|
-
return (normalizeDecodedASN1(input.value, principals));
|
|
1387
|
-
}
|
|
1388
|
-
if (isASN1Date(input)) {
|
|
1389
|
-
return (input.date);
|
|
1390
|
-
}
|
|
1391
|
-
if (isASN1BitString(input)) {
|
|
1392
|
-
return (input.value);
|
|
1393
|
-
}
|
|
1394
|
-
if (isASN1Struct(input)) {
|
|
1395
|
-
const contains = input.contains ?? {};
|
|
1396
|
-
const orderedNames = Array.isArray(input.fieldNames) && input.fieldNames.length > 0
|
|
1397
|
-
? input.fieldNames
|
|
1398
|
-
: Object.keys(contains);
|
|
1399
|
-
const result = {};
|
|
1400
|
-
for (const fieldName of orderedNames) {
|
|
1401
|
-
if (!Object.prototype.hasOwnProperty.call(contains, fieldName)) {
|
|
1402
|
-
continue;
|
|
1403
|
-
}
|
|
1404
|
-
const fieldValue = contains[fieldName];
|
|
1405
|
-
if (fieldValue !== undefined) {
|
|
1406
|
-
result[fieldName] = normalizeDecodedASN1(fieldValue, principals);
|
|
1407
|
-
}
|
|
1408
|
-
}
|
|
1409
|
-
if (isReferenceSchema(input)) {
|
|
1410
|
-
const url = input.contains.external.contains.url.value;
|
|
1411
|
-
const mimeType = input.contains.external.contains.contentType.value;
|
|
1412
|
-
const encryptionAlgoOID = input.contains.encryptionAlgorithm?.oid;
|
|
1413
|
-
const digestInfo = input.contains.digest.contains;
|
|
1414
|
-
let cachedValue = null;
|
|
1415
|
-
result['$blob'] = async function (additionalPrincipals) {
|
|
1416
|
-
/*
|
|
1417
|
-
* If we already have the cached value, return it
|
|
1418
|
-
*/
|
|
1419
|
-
if (cachedValue) {
|
|
1420
|
-
return (cachedValue);
|
|
1421
|
-
}
|
|
1422
|
-
/*
|
|
1423
|
-
* Fetch the remote data
|
|
1424
|
-
*/
|
|
1425
|
-
const result = await fetch(url);
|
|
1426
|
-
if (!result.ok) {
|
|
1427
|
-
throw (new Error(`Failed to fetch remote data from ${url}: ${result.status} ${result.statusText}`));
|
|
1428
|
-
}
|
|
1429
|
-
const dataBlob = await result.blob();
|
|
1430
|
-
let data = await dataBlob.arrayBuffer();
|
|
1431
|
-
/*
|
|
1432
|
-
* Sometimes people like to encode the data
|
|
1433
|
-
* in a JSON base64 string, check to see if
|
|
1434
|
-
* that's the case -- hopefully this doesn't
|
|
1435
|
-
* conflict with any legitimate use case
|
|
1436
|
-
*/
|
|
1437
|
-
if (dataBlob.type === 'application/json') {
|
|
1438
|
-
try {
|
|
1439
|
-
const asJSON = JSON.parse(Buffer.from(data).toString('utf-8'));
|
|
1440
|
-
if (isPlainObject(asJSON)) {
|
|
1441
|
-
if (Object.keys(asJSON).length === 2) {
|
|
1442
|
-
if ('data' in asJSON && typeof asJSON.data === 'string' && 'mimeType' in asJSON && typeof asJSON.mimeType === 'string') {
|
|
1443
|
-
data = bufferToArrayBuffer(Buffer.from(asJSON.data, 'base64'));
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
catch {
|
|
1449
|
-
/* Ignored */
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
/*
|
|
1453
|
-
* Decrypt the data, if encrypted
|
|
1454
|
-
*/
|
|
1455
|
-
if (encryptionAlgoOID) {
|
|
1456
|
-
switch (encryptionAlgoOID) {
|
|
1457
|
-
case '1.3.6.1.4.1.62675.2':
|
|
1458
|
-
case 'KeetaEncryptedContainerV1': {
|
|
1459
|
-
const container = EncryptedContainer.fromEncryptedBuffer(data, [
|
|
1460
|
-
...principals,
|
|
1461
|
-
...(additionalPrincipals ?? [])
|
|
1462
|
-
]);
|
|
1463
|
-
data = await container.getPlaintext();
|
|
1464
|
-
break;
|
|
1465
|
-
}
|
|
1466
|
-
default:
|
|
1467
|
-
throw (new Error(`Unsupported encryption algorithm OID: ${encryptionAlgoOID}`));
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
/*
|
|
1471
|
-
* Compute and verify the hash (of the plain text)
|
|
1472
|
-
*/
|
|
1473
|
-
if (!Buffer.isBuffer(digestInfo.digest)) {
|
|
1474
|
-
throw (new TypeError('Digest value is not a buffer'));
|
|
1475
|
-
}
|
|
1476
|
-
const validHash = await checkHashWithOID(data, {
|
|
1477
|
-
digest: digestInfo.digest,
|
|
1478
|
-
digestAlgorithm: digestInfo.digestAlgorithm
|
|
1479
|
-
});
|
|
1480
|
-
if (validHash !== true) {
|
|
1481
|
-
throw (validHash);
|
|
1482
|
-
}
|
|
1483
|
-
const blob = new Blob([data], { type: mimeType });
|
|
1484
|
-
cachedValue = blob;
|
|
1485
|
-
return (blob);
|
|
1486
|
-
};
|
|
1487
|
-
}
|
|
1488
|
-
return (result);
|
|
1489
|
-
}
|
|
1490
|
-
if (isASN1Set(input)) {
|
|
1491
|
-
return ({
|
|
1492
|
-
name: normalizeDecodedASN1(input.name, principals),
|
|
1493
|
-
value: normalizeDecodedASN1(input.value, principals)
|
|
1494
|
-
});
|
|
1495
|
-
}
|
|
1496
|
-
if (isPlainObject(input)) {
|
|
1497
|
-
const result = {};
|
|
1498
|
-
for (const [key, value] of Object.entries(input)) {
|
|
1499
|
-
result[key] = normalizeDecodedASN1(value, principals);
|
|
1500
|
-
}
|
|
1501
|
-
return (result);
|
|
1502
|
-
}
|
|
1503
|
-
return (input);
|
|
1504
|
-
}
|
|
1505
7
|
export { ASN1toJS, JStoASN1, BufferStorageASN1, ValidateASN1 };
|
|
1506
8
|
//# sourceMappingURL=asn1.js.map
|