@keetanetwork/anchor 0.0.12 → 0.0.14

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.
Files changed (81) hide show
  1. package/lib/certificates.d.ts +83 -21
  2. package/lib/certificates.d.ts.map +1 -1
  3. package/lib/certificates.generated.d.ts +3 -0
  4. package/lib/certificates.generated.d.ts.map +1 -0
  5. package/lib/certificates.generated.js +120 -0
  6. package/lib/certificates.generated.js.map +1 -0
  7. package/lib/certificates.js +579 -117
  8. package/lib/certificates.js.map +1 -1
  9. package/lib/http-server.d.ts +2 -1
  10. package/lib/http-server.d.ts.map +1 -1
  11. package/lib/http-server.js +4 -4
  12. package/lib/http-server.js.map +1 -1
  13. package/lib/resolver.d.ts +2 -1
  14. package/lib/resolver.d.ts.map +1 -1
  15. package/lib/resolver.js.map +1 -1
  16. package/lib/utils/asn1.d.ts +2 -1
  17. package/lib/utils/asn1.d.ts.map +1 -1
  18. package/lib/utils/asn1.js.map +1 -1
  19. package/lib/utils/buffer.d.ts +3 -0
  20. package/lib/utils/buffer.d.ts.map +1 -1
  21. package/lib/utils/buffer.js +26 -0
  22. package/lib/utils/buffer.js.map +1 -1
  23. package/lib/utils/guards.d.ts +14 -0
  24. package/lib/utils/guards.d.ts.map +1 -0
  25. package/lib/utils/guards.js +31 -0
  26. package/lib/utils/guards.js.map +1 -0
  27. package/lib/utils/index.d.ts +3 -1
  28. package/lib/utils/index.d.ts.map +1 -1
  29. package/lib/utils/index.js +3 -1
  30. package/lib/utils/index.js.map +1 -1
  31. package/lib/utils/json.d.ts +2 -2
  32. package/lib/utils/json.d.ts.map +1 -1
  33. package/lib/utils/json.js.map +1 -1
  34. package/lib/utils/oid.d.ts +7 -0
  35. package/lib/utils/oid.d.ts.map +1 -0
  36. package/lib/utils/oid.js +22 -0
  37. package/lib/utils/oid.js.map +1 -0
  38. package/lib/utils/signing.d.ts.map +1 -1
  39. package/lib/utils/signing.js +26 -2
  40. package/lib/utils/signing.js.map +1 -1
  41. package/npm-shrinkwrap.json +2 -8
  42. package/package.json +1 -2
  43. package/services/fx/client.d.ts +1 -0
  44. package/services/fx/client.d.ts.map +1 -1
  45. package/services/fx/client.js +72 -72
  46. package/services/fx/client.js.map +1 -1
  47. package/services/fx/common.d.ts +23 -14
  48. package/services/fx/common.d.ts.map +1 -1
  49. package/services/fx/common.js +177 -1
  50. package/services/fx/common.js.map +1 -1
  51. package/services/fx/server.d.ts +13 -4
  52. package/services/fx/server.d.ts.map +1 -1
  53. package/services/fx/server.js +58 -151
  54. package/services/fx/server.js.map +1 -1
  55. package/services/kyc/client.d.ts.map +1 -1
  56. package/services/kyc/client.js +1 -8
  57. package/services/kyc/client.js.map +1 -1
  58. package/services/kyc/common.d.ts +39 -3
  59. package/services/kyc/common.d.ts.map +1 -1
  60. package/services/kyc/common.generated.d.ts +5 -0
  61. package/services/kyc/common.generated.d.ts.map +1 -0
  62. package/services/kyc/common.generated.js +241 -0
  63. package/services/kyc/common.generated.js.map +1 -0
  64. package/services/kyc/common.js +68 -1
  65. package/services/kyc/common.js.map +1 -1
  66. package/services/kyc/iso20022.generated.d.ts +285 -0
  67. package/services/kyc/iso20022.generated.d.ts.map +1 -0
  68. package/services/kyc/iso20022.generated.js +205 -0
  69. package/services/kyc/iso20022.generated.js.map +1 -0
  70. package/services/kyc/oids.generated.d.ts +83 -0
  71. package/services/kyc/oids.generated.d.ts.map +1 -0
  72. package/services/kyc/oids.generated.js +130 -0
  73. package/services/kyc/oids.generated.js.map +1 -0
  74. package/services/kyc/server.d.ts +141 -0
  75. package/services/kyc/server.d.ts.map +1 -0
  76. package/services/kyc/server.js +183 -0
  77. package/services/kyc/server.js.map +1 -0
  78. package/services/kyc/utils/generate-kyc-schema.d.ts +3 -0
  79. package/services/kyc/utils/generate-kyc-schema.d.ts.map +1 -0
  80. package/services/kyc/utils/generate-kyc-schema.js +1154 -0
  81. package/services/kyc/utils/generate-kyc-schema.js.map +1 -0
@@ -0,0 +1,1154 @@
1
+ #! /usr/bin/env ts-node
2
+ import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
3
+ import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
4
+ import * as fs from 'fs';
5
+ import * as path from 'path';
6
+ import * as typia from 'typia';
7
+ /*
8
+ * Populated in `main` function
9
+ */
10
+ let oidSchema;
11
+ // --- Utility Functions ---
12
+ function oidArrayToString(oid) {
13
+ return (oid.join('.'));
14
+ }
15
+ function toConstantCase(str) {
16
+ return (str.replace(/[A-Z]/g, function (part) {
17
+ return (`_${part}`);
18
+ }).toUpperCase());
19
+ }
20
+ function toPascalCase(str) {
21
+ return (str.split(/[_-]/).map(function (part) {
22
+ return (part.charAt(0).toUpperCase() + part.slice(1));
23
+ }).join(''));
24
+ }
25
+ function toSnakeCase(str) {
26
+ return (str.replace(/([A-Z])/g, '_$1').toLowerCase().replace(/^_/, ''));
27
+ }
28
+ // --- Type Resolution ---
29
+ function resolveTypeReference(typeName) {
30
+ if (typeName.startsWith('SEQUENCE OF ')) {
31
+ return (`${resolveTypeReference(typeName.substring('SEQUENCE OF '.length).trim())}[]`);
32
+ }
33
+ switch (typeName.trim()) {
34
+ case 'UTF8String':
35
+ case 'Utf8String':
36
+ return ('string');
37
+ case 'GeneralizedTime':
38
+ return ('Date');
39
+ case 'ENUMERATED':
40
+ return ('string');
41
+ default:
42
+ return (toPascalCase(typeName));
43
+ }
44
+ }
45
+ function resolveToBaseType(typeName) {
46
+ typeName = typeName.trim();
47
+ // Check if it's a primitive type first
48
+ if (/^(UTF8String|Utf8String|GeneralizedTime)$/i.test(typeName)) {
49
+ return (typeName);
50
+ }
51
+ // Check if it's defined as a sensitive attribute
52
+ const sensitiveAttr = oidSchema.sensitive_attributes[typeName] ?? Object.values(oidSchema.sensitive_attributes).find(function (attr) {
53
+ return (attr.token === typeName);
54
+ });
55
+ if (sensitiveAttr && !sensitiveAttr.fields && !sensitiveAttr.choices) {
56
+ if (sensitiveAttr.type === undefined) {
57
+ throw (new Error(`Sensitive attribute ${typeName} has no defined type.`));
58
+ }
59
+ return (resolveToBaseType(sensitiveAttr.type));
60
+ }
61
+ // Check if it's an ISO20022 primitive
62
+ const primitive = oidSchema.iso20022_types.primitives[typeName];
63
+ if (primitive) {
64
+ return (resolveToBaseType(primitive.type));
65
+ }
66
+ // Otherwise return as-is
67
+ return (typeName);
68
+ }
69
+ function isSequenceOfChoice(config) {
70
+ const hasFields = config.fields && Object.keys(config.fields).length > 0;
71
+ const allOptional = hasFields && Object.values(config.fields).every(function (field) {
72
+ return (field.optional);
73
+ });
74
+ return (allOptional);
75
+ }
76
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
77
+ function _ignore_getPrimitiveType(type) {
78
+ if (type === 'UTF8String' || type === 'Utf8String') {
79
+ return ('string');
80
+ }
81
+ if (type === 'GeneralizedTime') {
82
+ return ('date');
83
+ }
84
+ return ('string');
85
+ }
86
+ // --- Output Generators ---
87
+ function genHeader(comment) {
88
+ return ([
89
+ '/* eslint-disable */',
90
+ '/**',
91
+ ` * ${comment}`,
92
+ ' * This file is auto-generated from oids.json.',
93
+ ' */',
94
+ ''
95
+ ].join('\n'));
96
+ }
97
+ function genTypeAlias(name, type, description, oid) {
98
+ return (`/** ${description} */\n/** OID: ${oid} */\nexport type ${name} = ${type};\n`);
99
+ }
100
+ function genEnumType(name, values, description, oid) {
101
+ return (`/** ${description} */\n/** OID: ${oid} */\nexport type ${name} = ${values.map(function (value) {
102
+ return (`'${value}'`);
103
+ }).join(' | ')};\n`);
104
+ }
105
+ function genInterface(name, fields, description, oid) {
106
+ const fieldLines = Object.entries(fields).map(function ([fieldName, fieldConfig]) {
107
+ return (`\t${fieldName}${fieldConfig.optional ? '?' : ''}: ${resolveTypeReference(fieldConfig.type)};`);
108
+ });
109
+ return (`/** ${description} */\n/** OID: ${oid} */\nexport interface ${name} {\n${fieldLines.join('\n')}\n}\n`);
110
+ }
111
+ function genSequenceOfChoice(name, config) {
112
+ const typeName = toPascalCase(name);
113
+ const fieldOrder = config.field_order ?? Object.keys(config.fields);
114
+ const choiceEntries = fieldOrder.map(function (fieldName) {
115
+ if (!(fieldName in config.fields) || config.fields[fieldName] === undefined) {
116
+ throw (new Error(`Field ${fieldName} not found in sequence of choice ${name}`));
117
+ }
118
+ return ([fieldName, config.fields[fieldName]]);
119
+ });
120
+ const choiceTypes = choiceEntries.map(function ([fieldName, fieldConfig], index) {
121
+ if (fieldConfig === undefined) {
122
+ throw (new Error(`Field ${fieldName} not found in sequence of choice ${name}`));
123
+ }
124
+ const fieldType = resolveTypeReference(fieldConfig.type);
125
+ const choiceTypeName = `${typeName}${toPascalCase(fieldName)}Choice`;
126
+ return ({
127
+ code: `export interface ${choiceTypeName} {\n\ttag: ${index};\n\tname: '${fieldName}';\n\tvalue: ${fieldType};\n}\n`,
128
+ name: choiceTypeName
129
+ });
130
+ });
131
+ let out = '';
132
+ // Individual choice interfaces
133
+ out += choiceTypes.map(function (choiceInfo) {
134
+ return (choiceInfo.code);
135
+ }).join('\n');
136
+ // Union type
137
+ out += `export type ${typeName}Choice =\n\t| ${choiceTypes.map(function (choiceInfo) {
138
+ return (choiceInfo.name);
139
+ }).join('\n\t| ')};\n\n`;
140
+ // Main type is array of choices
141
+ out += `export type ${typeName} = ${typeName}Choice[];\n\n`;
142
+ // ASN.1 schema
143
+ out += `export const ${typeName}Schema: ASN1.Schema = {\n\tsequenceOf: {\n\t\tchoice: [\n`;
144
+ out += choiceEntries.map(function ([_ignore_fieldName, _ignore_fieldConfig], index) {
145
+ return (`\t\t\t{ type: 'context', kind: 'explicit', value: ${index}, contains: { type: 'string', kind: 'utf8' }}`);
146
+ }).join(',\n');
147
+ out += `\n\t\t]\n\t}\n} as const satisfies ASN1.Schema;\n\n`;
148
+ // Field names array
149
+ out += `export const ${typeName}Fields = [\n${fieldOrder.map(function (fieldName) {
150
+ return (`\t'${fieldName}'`);
151
+ }).join(',\n')}\n] as const;\n\n`;
152
+ return (out);
153
+ }
154
+ function deleteLastCommaIfFoundGenerator(lines) {
155
+ return (function deleteLastCommaIfFound() {
156
+ let lastLine = lines.pop();
157
+ if (lastLine === undefined) {
158
+ return;
159
+ }
160
+ if (lastLine.endsWith(',')) {
161
+ lastLine = lastLine.slice(0, -1);
162
+ }
163
+ lines.push(lastLine);
164
+ });
165
+ }
166
+ // --- Main Generation ---
167
+ function generateOidConstants() {
168
+ const lines = [genHeader('Generated OID Constants')];
169
+ const deleteLastCommaIfFound = deleteLastCommaIfFoundGenerator(lines);
170
+ // Algorithm OID constants
171
+ lines.push('// Algorithm OID constants');
172
+ for (const [name, oid] of Object.entries(oidSchema.algorithms)) {
173
+ lines.push(`export const ${toConstantCase(name.replace(/-/g, '_'))} = '${oidArrayToString(oid)}';`);
174
+ }
175
+ lines.push('');
176
+ // Plain attribute OID constants
177
+ lines.push('// Plain attribute OID constants');
178
+ for (const [name, config] of Object.entries(oidSchema.plain_attributes)) {
179
+ lines.push(`/** ${config.description} */`);
180
+ lines.push(`/** @see ${config.reference} */`);
181
+ lines.push(`export const ${toConstantCase(name)} = '${oidArrayToString(config.oid)}';`);
182
+ }
183
+ lines.push('');
184
+ // Keeta namespace for sensitive attributes
185
+ lines.push('// Keeta-specific OID constants');
186
+ lines.push('// eslint-disable-next-line @typescript-eslint/no-namespace');
187
+ lines.push('export namespace keeta {');
188
+ for (const [name, config] of Object.entries(oidSchema.extensions)) {
189
+ lines.push(`\t/** ${config.description} */`);
190
+ lines.push(`\t/** @see ${config.reference} */`);
191
+ lines.push(`\texport const ${toConstantCase(name)} = '${oidArrayToString(config.oid)}';`);
192
+ }
193
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
194
+ lines.push(`\t/** ${config.description} */`);
195
+ lines.push(`\t/** @see ${config.reference} */`);
196
+ lines.push(`\texport const ${toConstantCase(name)} = '${oidArrayToString(config.oid)}';`);
197
+ }
198
+ lines.push('}');
199
+ lines.push('');
200
+ // Lookup maps
201
+ lines.push('// OID to name lookup maps');
202
+ lines.push('export const OID_TO_NAME: { [key: string]: string } = {');
203
+ for (const [name, config] of Object.entries({
204
+ ...oidSchema.plain_attributes,
205
+ ...oidSchema.sensitive_attributes
206
+ })) {
207
+ lines.push(`\t'${oidArrayToString(config.oid)}': '${name}',`);
208
+ }
209
+ deleteLastCommaIfFound();
210
+ lines.push('};');
211
+ lines.push('');
212
+ lines.push('export const NAME_TO_OID: { [key: string]: string } = {');
213
+ for (const [name, config] of Object.entries({
214
+ ...oidSchema.plain_attributes,
215
+ ...oidSchema.sensitive_attributes
216
+ })) {
217
+ lines.push(`\t'${name}': '${oidArrayToString(config.oid)}',`);
218
+ }
219
+ deleteLastCommaIfFound();
220
+ lines.push('};');
221
+ lines.push('');
222
+ return (lines.join('\n'));
223
+ }
224
+ function genSequenceSchema(typeName, fields, config) {
225
+ const fieldOrder = config?.field_order ?? Object.keys(fields);
226
+ const schemaFields = fieldOrder.map(function (fname, index) {
227
+ const fcfg = fields[fname];
228
+ if (!fcfg) {
229
+ return (null);
230
+ }
231
+ // Resolve to base type to handle aliases
232
+ const baseType = resolveToBaseType(fcfg.type);
233
+ // Check if field type is GeneralizedTime (date)
234
+ if (baseType === 'GeneralizedTime') {
235
+ if (fcfg.optional) {
236
+ return (`{ optional: { type: 'context', kind: 'explicit', value: ${index}, contains: ASN1.ValidateASN1.IsDate }}`);
237
+ }
238
+ else {
239
+ return (`{ type: 'context', kind: 'explicit', value: ${index}, contains: ASN1.ValidateASN1.IsDate }`);
240
+ }
241
+ }
242
+ // Strip SEQUENCE OF prefix and [] suffix to get the base type
243
+ let fieldType = fcfg.type.trim();
244
+ if (fieldType.startsWith('SEQUENCE OF ')) {
245
+ fieldType = fieldType.substring('SEQUENCE OF '.length).trim();
246
+ }
247
+ fieldType = fieldType.replace(/\[\]$/, '');
248
+ const fieldTypePascal = toPascalCase(fieldType);
249
+ const fieldTypeSnake = toSnakeCase(fieldType);
250
+ // Check if this is a COMPLEX type (not a primitive)
251
+ const isChoice = oidSchema.iso20022_types.choices[fieldTypeSnake] ?? oidSchema.iso20022_types.choices[fieldType];
252
+ const isSequence = oidSchema.iso20022_types.sequences[fieldTypeSnake] ?? oidSchema.iso20022_types.sequences[fieldType];
253
+ const isSensitiveSequence = oidSchema.sensitive_attributes[fieldTypeSnake]?.fields;
254
+ const isSensitiveChoice = oidSchema.sensitive_attributes[fieldTypeSnake]?.choices;
255
+ const hasSchema = isChoice ?? isSequence ?? isSensitiveSequence ?? isSensitiveChoice;
256
+ let contains;
257
+ if (hasSchema) {
258
+ contains = `${fieldTypePascal}Schema `;
259
+ }
260
+ else {
261
+ // Primitive type - use inline string schema
262
+ contains = `{ type: 'string', kind: 'utf8' }`;
263
+ }
264
+ if (fcfg.optional) {
265
+ return (`{ optional: { type: 'context', kind: 'explicit', value: ${index}, contains: ${contains}}}`);
266
+ }
267
+ else {
268
+ return (`{ type: 'context', kind: 'explicit', value: ${index}, contains: ${contains}}`);
269
+ }
270
+ }).filter(Boolean);
271
+ return (`export const ${typeName}Schema: ASN1.Schema = [\n\t${schemaFields.join(',\n\t')}\n] as const satisfies ASN1.Schema;`);
272
+ }
273
+ function generateIso20022Types() {
274
+ const lines = [genHeader('Generated ISO20022 Type Definitions'), "import * as ASN1 from '../../lib/utils/asn1.js';", ''];
275
+ const deleteLastCommaIfFound = deleteLastCommaIfFoundGenerator(lines);
276
+ // Primitives
277
+ lines.push('// ISO20022 Primitive Types');
278
+ for (const [name, config] of Object.entries(oidSchema.iso20022_types.primitives)) {
279
+ lines.push(genTypeAlias(toPascalCase(name), resolveTypeReference(config.type), config.description, oidArrayToString(config.oid)));
280
+ }
281
+ // Enumerations
282
+ lines.push('// ISO20022 Enumeration Types');
283
+ for (const [name, config] of Object.entries(oidSchema.iso20022_types.enumerations)) {
284
+ lines.push(genEnumType(toPascalCase(name), config.values, config.description, oidArrayToString(config.oid)));
285
+ }
286
+ // Choices
287
+ lines.push('// ISO20022 Choice Types');
288
+ for (const [name, config] of Object.entries(oidSchema.iso20022_types.choices)) {
289
+ const typeName = toPascalCase(name);
290
+ const choices = Object.entries(config.choices ?? {});
291
+ const hasComplexTypes = choices.some(function ([_ignore_choiceName, choiceConfig]) {
292
+ const choiceType = choiceConfig.type.trim();
293
+ return (choiceType !== 'UTF8String' && choiceType !== 'string');
294
+ });
295
+ if (hasComplexTypes) {
296
+ const unionTypes = choices.map(function ([_ignore_choiceName, choiceConfig]) {
297
+ return (toPascalCase(choiceConfig.type.trim()));
298
+ });
299
+ lines.push(genTypeAlias(typeName, unionTypes.join(' | '), config.description, oidArrayToString(config.oid)));
300
+ }
301
+ else {
302
+ lines.push(genTypeAlias(typeName, 'string', config.description, oidArrayToString(config.oid)));
303
+ }
304
+ }
305
+ // ISO20022 Sequences and Sequence-of-Choice Types
306
+ lines.push('// ISO20022 Sequence Types');
307
+ for (const [name, config] of Object.entries(oidSchema.iso20022_types.sequences)) {
308
+ if (isSequenceOfChoice(config)) {
309
+ lines.push(genSequenceOfChoice(name, config));
310
+ }
311
+ else {
312
+ lines.push(genInterface(toPascalCase(name), config.fields, config.description, oidArrayToString(config.oid)));
313
+ }
314
+ }
315
+ lines.push('');
316
+ // --- Choice Type Schemas ---
317
+ lines.push('// Generated ASN.1 schemas for ISO 20022 choice types');
318
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
319
+ for (const [name, _ignore_config] of Object.entries(oidSchema.iso20022_types.choices)) {
320
+ const typeName = toPascalCase(name);
321
+ lines.push(`/** ASN.1 schema for ${typeName} */`);
322
+ lines.push(`export const ${typeName}Schema: ASN1.Schema = { type: 'string', kind: 'utf8' };`);
323
+ lines.push('');
324
+ }
325
+ // --- Sequence Type Schemas ---
326
+ lines.push('// Generated ASN.1 schemas for ISO 20022 sequence types');
327
+ for (const [name, config] of Object.entries(oidSchema.iso20022_types.sequences)) {
328
+ const typeName = toPascalCase(name);
329
+ if (config.fields && !isSequenceOfChoice(config)) {
330
+ lines.push(`/** ASN.1 schema for ${typeName} */`);
331
+ lines.push(genSequenceSchema(typeName, config.fields, config));
332
+ lines.push('');
333
+ }
334
+ }
335
+ // --- Choice-Type Sensitive Attribute Schemas ---
336
+ lines.push('// Generated ASN.1 schemas for choice-type sensitive attributes');
337
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
338
+ const typeName = toPascalCase(name);
339
+ if (config.choices) {
340
+ const choiceSchemas = Object.values(config.choices).map(function (choice) {
341
+ const choiceTypeName = toPascalCase(choice.type.trim());
342
+ return (`${choiceTypeName}Schema`);
343
+ });
344
+ lines.push(`/** ASN.1 schema for ${typeName} */`);
345
+ lines.push(`export const ${typeName}Schema: ASN1.Schema = {`);
346
+ lines.push(`\tchoice: [`);
347
+ lines.push(`\t\t${choiceSchemas.join(',\n\t\t')}`);
348
+ lines.push(`\t]`);
349
+ lines.push(`} as const satisfies ASN1.Schema;`);
350
+ lines.push('');
351
+ }
352
+ }
353
+ // Sensitive Attribute Types
354
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
355
+ const typeName = toPascalCase(name);
356
+ if (!config.fields && !config.choices) {
357
+ // Primitive type
358
+ let baseType;
359
+ if (config.type === 'UTF8String' || config.type === 'Utf8String') {
360
+ baseType = 'string';
361
+ }
362
+ else if (config.type === 'GeneralizedTime') {
363
+ baseType = 'Date';
364
+ }
365
+ else {
366
+ if (config.type === undefined) {
367
+ throw (new Error(`Sensitive attribute ${name} has no defined type.`));
368
+ }
369
+ baseType = toPascalCase(config.type);
370
+ }
371
+ lines.push(`/** ${config.description} */`);
372
+ lines.push(`/** OID: ${oidArrayToString(config.oid)} */`);
373
+ lines.push(`export type ${typeName} = ${baseType};`);
374
+ lines.push('');
375
+ }
376
+ else if (config.fields) {
377
+ // Sequence type
378
+ lines.push(`/** ${config.description} */`);
379
+ lines.push(`/** OID: ${oidArrayToString(config.oid)} */`);
380
+ lines.push(`export interface ${typeName} {`);
381
+ for (const [fieldName, fieldConfig] of Object.entries(config.fields)) {
382
+ const optional = fieldConfig.optional ? '?' : '';
383
+ const resolvedType = resolveTypeReference(fieldConfig.type);
384
+ lines.push(`\t${fieldName}${optional}: ${resolvedType};`);
385
+ }
386
+ lines.push('}');
387
+ lines.push('');
388
+ }
389
+ else if (config.choices) {
390
+ // Choice type
391
+ lines.push(`/** ${config.description} */`);
392
+ lines.push(`/** OID: ${oidArrayToString(config.oid)} */`);
393
+ const hasComplexTypes = Object.values(config.choices).some(function (choice) {
394
+ const choiceType = choice.type.trim();
395
+ return (choiceType !== 'UTF8String' && choiceType !== 'string');
396
+ });
397
+ if (hasComplexTypes) {
398
+ const unionTypes = Object.values(config.choices).map(function (choice) {
399
+ return (toPascalCase(choice.type.trim()));
400
+ });
401
+ lines.push(`export type ${typeName} = ${unionTypes.join(' | ')};`);
402
+ }
403
+ else {
404
+ lines.push(`export type ${typeName} = string;`);
405
+ }
406
+ lines.push('');
407
+ }
408
+ }
409
+ // Token aliases for sensitive attributes
410
+ lines.push('// Token aliases for sensitive attributes');
411
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
412
+ if (config.token && config.token !== toPascalCase(name)) {
413
+ const typeName = toPascalCase(name);
414
+ const tokenName = config.token;
415
+ lines.push(`/** Alias for ${typeName} */`);
416
+ lines.push(`export type ${tokenName} = ${typeName};`);
417
+ lines.push('');
418
+ }
419
+ }
420
+ // Union type, value map, helper generic
421
+ lines.push('/** Union type of all sensitive attribute types */');
422
+ lines.push('export type SensitiveAttributeType =');
423
+ lines.push(Object.keys(oidSchema.sensitive_attributes).map(function (name) {
424
+ return (`\t| ${toPascalCase(name)}`);
425
+ }).join('\n') + ';');
426
+ lines.push('');
427
+ lines.push('/** Map of attribute name to acceptable input type for CertificateBuilder.setAttribute */');
428
+ lines.push('export interface CertificateAttributeValueMap {');
429
+ for (const [name] of Object.entries(oidSchema.sensitive_attributes)) {
430
+ lines.push(`\t'${name}': ${toPascalCase(name)};`);
431
+ }
432
+ lines.push('}');
433
+ lines.push('');
434
+ lines.push('/** Helper generic to get attribute value type by name */');
435
+ lines.push('export type CertificateAttributeValue<Name extends keyof CertificateAttributeValueMap> = CertificateAttributeValueMap[Name];');
436
+ lines.push('');
437
+ // Field arrays and schemas for sequence types
438
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
439
+ const typeName = toPascalCase(name);
440
+ if (config.fields) {
441
+ const fieldOrder = config.field_order ?? Object.keys(config.fields);
442
+ lines.push(`export const ${typeName}Fields = [${fieldOrder.map(function (field) {
443
+ return (`'${field}'`);
444
+ }).join(', ')}] as const;`);
445
+ lines.push(genSequenceSchema(typeName, config.fields, config));
446
+ }
447
+ }
448
+ // OID DB
449
+ lines.push('export const CertificateAttributeOIDDB = {');
450
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
451
+ lines.push(`\t'${name}': '${oidArrayToString(config.oid)}',`);
452
+ }
453
+ deleteLastCommaIfFound();
454
+ lines.push('} as const;');
455
+ lines.push('');
456
+ // Sensitive attribute list
457
+ lines.push('export const SENSITIVE_CERTIFICATE_ATTRIBUTES = [');
458
+ for (const name of Object.keys(oidSchema.sensitive_attributes)) {
459
+ lines.push(`\t'${name}',`);
460
+ }
461
+ deleteLastCommaIfFound();
462
+ lines.push('] as const;');
463
+ lines.push('');
464
+ lines.push('export type SensitiveCertificateAttributeNames = typeof SENSITIVE_CERTIFICATE_ATTRIBUTES[number];');
465
+ lines.push('');
466
+ // PascalCase names
467
+ lines.push('export const SensitiveCertificateAttributeNames = [');
468
+ for (const name of Object.keys(oidSchema.sensitive_attributes)) {
469
+ lines.push(`\t'${toPascalCase(name)}',`);
470
+ }
471
+ deleteLastCommaIfFound();
472
+ lines.push('] as const;');
473
+ lines.push('');
474
+ // Field name mapping
475
+ lines.push('export const CertificateAttributeFieldNames: { readonly [K in keyof typeof CertificateAttributeOIDDB]?: readonly string[] } = {');
476
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
477
+ if (config.fields) {
478
+ const typeName = toPascalCase(name);
479
+ lines.push(`\t'${name}': ${typeName}Fields,`);
480
+ }
481
+ }
482
+ deleteLastCommaIfFound();
483
+ lines.push('} as const;');
484
+ lines.push('');
485
+ // Complete schema mapping (ONCE, at the end)
486
+ lines.push('export const CertificateAttributeSchema: { readonly [K in keyof typeof CertificateAttributeOIDDB]: ASN1.Schema } = {');
487
+ for (const [name, config] of Object.entries(oidSchema.sensitive_attributes)) {
488
+ const typeName = toPascalCase(name);
489
+ let schemaRef;
490
+ if (config.fields) {
491
+ schemaRef = `${typeName}Schema`;
492
+ }
493
+ else if (config.choices) {
494
+ schemaRef = `${typeName}Schema`;
495
+ }
496
+ else {
497
+ if (config.type === undefined) {
498
+ throw (new Error(`Sensitive attribute ${name} has no defined type.`));
499
+ }
500
+ const baseType = resolveToBaseType(config.type);
501
+ if (baseType === 'GeneralizedTime') {
502
+ schemaRef = 'ASN1.ValidateASN1.IsDate';
503
+ }
504
+ else {
505
+ schemaRef = `{ type: 'string', kind: 'utf8' }`;
506
+ }
507
+ }
508
+ lines.push(`\t'${name}': ${schemaRef},`);
509
+ }
510
+ deleteLastCommaIfFound();
511
+ lines.push('} as const;');
512
+ lines.push('');
513
+ return (lines.join('\n'));
514
+ }
515
+ function parseArgs(argv) {
516
+ let oidsJSONPath = undefined;
517
+ let oidsOutputPath = undefined;
518
+ let iso20022OutputPath = undefined;
519
+ for (const arg of argv) {
520
+ if (arg.startsWith('--oids-json=')) {
521
+ oidsJSONPath = arg.substring('--oids-json='.length);
522
+ }
523
+ if (arg.startsWith('--oids-output=')) {
524
+ oidsOutputPath = arg.substring('--oids-output='.length);
525
+ }
526
+ if (arg.startsWith('--iso20022-output=')) {
527
+ iso20022OutputPath = arg.substring('--iso20022-output='.length);
528
+ }
529
+ }
530
+ if (oidsJSONPath === undefined) {
531
+ throw (new Error('Missing required argument: --oids-json=path/to/oids.json'));
532
+ }
533
+ if (oidsOutputPath === undefined) {
534
+ throw (new Error('Missing required argument: --oids-output=path/to/oids.generated.ts'));
535
+ }
536
+ if (iso20022OutputPath === undefined) {
537
+ throw (new Error('Missing required argument: --iso20022-output=path/to/iso20022.generated.ts'));
538
+ }
539
+ if (!fs.existsSync(oidsJSONPath)) {
540
+ throw (new Error(`OID JSON file not found: ${oidsJSONPath}`));
541
+ }
542
+ return ({
543
+ oidsJSONPath,
544
+ oidsOutputPath,
545
+ iso20022OutputPath
546
+ });
547
+ }
548
+ // --- Main ---
549
+ function main(argv) {
550
+ const { oidsJSONPath, oidsOutputPath, iso20022OutputPath } = parseArgs(argv);
551
+ fs.mkdirSync(path.dirname(oidsOutputPath), { recursive: true });
552
+ fs.mkdirSync(path.dirname(iso20022OutputPath), { recursive: true });
553
+ oidSchema = (() => { const _io0 = input => "object" === typeof input.algorithms && null !== input.algorithms && false === Array.isArray(input.algorithms) && _io1(input.algorithms) && ("object" === typeof input.sensitive_attributes && null !== input.sensitive_attributes && false === Array.isArray(input.sensitive_attributes) && _io2(input.sensitive_attributes)) && ("object" === typeof input.plain_attributes && null !== input.plain_attributes && false === Array.isArray(input.plain_attributes) && _io2(input.plain_attributes)) && ("object" === typeof input.iso20022_types && null !== input.iso20022_types && _io8(input.iso20022_types)) && ("object" === typeof input.extensions && null !== input.extensions && false === Array.isArray(input.extensions) && _io21(input.extensions)); const _io1 = input => Object.keys(input).every(key => {
554
+ const value = input[key];
555
+ if (undefined === value)
556
+ return true;
557
+ return Array.isArray(value) && value.every(elem => "number" === typeof elem);
558
+ }); const _io2 = input => Object.keys(input).every(key => {
559
+ const value = input[key];
560
+ if (undefined === value)
561
+ return true;
562
+ return "object" === typeof value && null !== value && _io3(value);
563
+ }); const _io3 = input => Array.isArray(input.oid) && input.oid.every(elem => "number" === typeof elem) && (undefined === input.type || "string" === typeof input.type) && (undefined === input.token || "string" === typeof input.token) && "string" === typeof input.description && "string" === typeof input.reference && (undefined === input.fields || "object" === typeof input.fields && null !== input.fields && false === Array.isArray(input.fields) && _io4(input.fields)) && (undefined === input.choices || "object" === typeof input.choices && null !== input.choices && false === Array.isArray(input.choices) && _io6(input.choices)) && (undefined === input.field_order || Array.isArray(input.field_order) && input.field_order.every(elem => "string" === typeof elem)); const _io4 = input => Object.keys(input).every(key => {
564
+ const value = input[key];
565
+ if (undefined === value)
566
+ return true;
567
+ return "object" === typeof value && null !== value && _io5(value);
568
+ }); const _io5 = input => "string" === typeof input.type && (undefined === input.optional || "boolean" === typeof input.optional); const _io6 = input => Object.keys(input).every(key => {
569
+ const value = input[key];
570
+ if (undefined === value)
571
+ return true;
572
+ return "object" === typeof value && null !== value && _io7(value);
573
+ }); const _io7 = input => "string" === typeof input.type; const _io8 = input => "object" === typeof input.primitives && null !== input.primitives && false === Array.isArray(input.primitives) && _io9(input.primitives) && ("object" === typeof input.enumerations && null !== input.enumerations && false === Array.isArray(input.enumerations) && _io11(input.enumerations)) && ("object" === typeof input.choices && null !== input.choices && false === Array.isArray(input.choices) && _io13(input.choices)) && ("object" === typeof input.sequences && null !== input.sequences && false === Array.isArray(input.sequences) && _io17(input.sequences)); const _io9 = input => Object.keys(input).every(key => {
574
+ const value = input[key];
575
+ if (undefined === value)
576
+ return true;
577
+ return "object" === typeof value && null !== value && _io10(value);
578
+ }); const _io10 = input => Array.isArray(input.oid) && input.oid.every(elem => "number" === typeof elem) && "string" === typeof input.type && "string" === typeof input.description; const _io11 = input => Object.keys(input).every(key => {
579
+ const value = input[key];
580
+ if (undefined === value)
581
+ return true;
582
+ return "object" === typeof value && null !== value && _io12(value);
583
+ }); const _io12 = input => Array.isArray(input.oid) && input.oid.every(elem => "number" === typeof elem) && (Array.isArray(input.values) && input.values.every(elem => "string" === typeof elem)) && "string" === typeof input.description; const _io13 = input => Object.keys(input).every(key => {
584
+ const value = input[key];
585
+ if (undefined === value)
586
+ return true;
587
+ return "object" === typeof value && null !== value && _io14(value);
588
+ }); const _io14 = input => Array.isArray(input.oid) && input.oid.every(elem => "number" === typeof elem) && ("object" === typeof input.choices && null !== input.choices && false === Array.isArray(input.choices) && _io15(input.choices)) && "string" === typeof input.description; const _io15 = input => Object.keys(input).every(key => {
589
+ const value = input[key];
590
+ if (undefined === value)
591
+ return true;
592
+ return "object" === typeof value && null !== value && _io16(value);
593
+ }); const _io16 = input => "string" === typeof input.type; const _io17 = input => Object.keys(input).every(key => {
594
+ const value = input[key];
595
+ if (undefined === value)
596
+ return true;
597
+ return "object" === typeof value && null !== value && _io18(value);
598
+ }); const _io18 = input => Array.isArray(input.oid) && input.oid.every(elem => "number" === typeof elem) && ("object" === typeof input.fields && null !== input.fields && false === Array.isArray(input.fields) && _io19(input.fields)) && (undefined === input.field_order || Array.isArray(input.field_order) && input.field_order.every(elem => "string" === typeof elem)) && "string" === typeof input.description; const _io19 = input => Object.keys(input).every(key => {
599
+ const value = input[key];
600
+ if (undefined === value)
601
+ return true;
602
+ return "object" === typeof value && null !== value && _io20(value);
603
+ }); const _io20 = input => "string" === typeof input.type && (undefined === input.optional || "boolean" === typeof input.optional); const _io21 = input => Object.keys(input).every(key => {
604
+ const value = input[key];
605
+ if (undefined === value)
606
+ return true;
607
+ return "object" === typeof value && null !== value && _io22(value);
608
+ }); const _io22 = input => Array.isArray(input.oid) && input.oid.every(elem => "number" === typeof elem) && (undefined === input.type || "string" === typeof input.type) && "string" === typeof input.description && "string" === typeof input.reference; const _ao0 = (input, _path, _exceptionable = true) => (("object" === typeof input.algorithms && null !== input.algorithms && false === Array.isArray(input.algorithms) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
609
+ method: "typia.assert",
610
+ path: _path + ".algorithms",
611
+ expected: "__type",
612
+ value: input.algorithms
613
+ }, _errorFactory)) && _ao1(input.algorithms, _path + ".algorithms", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
614
+ method: "typia.assert",
615
+ path: _path + ".algorithms",
616
+ expected: "__type",
617
+ value: input.algorithms
618
+ }, _errorFactory)) && (("object" === typeof input.sensitive_attributes && null !== input.sensitive_attributes && false === Array.isArray(input.sensitive_attributes) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
619
+ method: "typia.assert",
620
+ path: _path + ".sensitive_attributes",
621
+ expected: "oidSchemaContentsAttribute",
622
+ value: input.sensitive_attributes
623
+ }, _errorFactory)) && _ao2(input.sensitive_attributes, _path + ".sensitive_attributes", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
624
+ method: "typia.assert",
625
+ path: _path + ".sensitive_attributes",
626
+ expected: "oidSchemaContentsAttribute",
627
+ value: input.sensitive_attributes
628
+ }, _errorFactory)) && (("object" === typeof input.plain_attributes && null !== input.plain_attributes && false === Array.isArray(input.plain_attributes) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
629
+ method: "typia.assert",
630
+ path: _path + ".plain_attributes",
631
+ expected: "oidSchemaContentsAttribute",
632
+ value: input.plain_attributes
633
+ }, _errorFactory)) && _ao2(input.plain_attributes, _path + ".plain_attributes", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
634
+ method: "typia.assert",
635
+ path: _path + ".plain_attributes",
636
+ expected: "oidSchemaContentsAttribute",
637
+ value: input.plain_attributes
638
+ }, _errorFactory)) && (("object" === typeof input.iso20022_types && null !== input.iso20022_types || __typia_transform__assertGuard._assertGuard(_exceptionable, {
639
+ method: "typia.assert",
640
+ path: _path + ".iso20022_types",
641
+ expected: "__type.o6",
642
+ value: input.iso20022_types
643
+ }, _errorFactory)) && _ao8(input.iso20022_types, _path + ".iso20022_types", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
644
+ method: "typia.assert",
645
+ path: _path + ".iso20022_types",
646
+ expected: "__type.o6",
647
+ value: input.iso20022_types
648
+ }, _errorFactory)) && (("object" === typeof input.extensions && null !== input.extensions && false === Array.isArray(input.extensions) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
649
+ method: "typia.assert",
650
+ path: _path + ".extensions",
651
+ expected: "__type.o19",
652
+ value: input.extensions
653
+ }, _errorFactory)) && _ao21(input.extensions, _path + ".extensions", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
654
+ method: "typia.assert",
655
+ path: _path + ".extensions",
656
+ expected: "__type.o19",
657
+ value: input.extensions
658
+ }, _errorFactory)); const _ao1 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
659
+ const value = input[key];
660
+ if (undefined === value)
661
+ return true;
662
+ return (Array.isArray(value) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
663
+ method: "typia.assert",
664
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
665
+ expected: "Array<number>",
666
+ value: value
667
+ }, _errorFactory)) && value.every((elem, _index11) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
668
+ method: "typia.assert",
669
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key) + "[" + _index11 + "]",
670
+ expected: "number",
671
+ value: elem
672
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
673
+ method: "typia.assert",
674
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
675
+ expected: "Array<number>",
676
+ value: value
677
+ }, _errorFactory);
678
+ }); const _ao2 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
679
+ const value = input[key];
680
+ if (undefined === value)
681
+ return true;
682
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
683
+ method: "typia.assert",
684
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
685
+ expected: "__type.o1",
686
+ value: value
687
+ }, _errorFactory)) && _ao3(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
688
+ method: "typia.assert",
689
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
690
+ expected: "__type.o1",
691
+ value: value
692
+ }, _errorFactory);
693
+ }); const _ao3 = (input, _path, _exceptionable = true) => ((Array.isArray(input.oid) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
694
+ method: "typia.assert",
695
+ path: _path + ".oid",
696
+ expected: "Array<number>",
697
+ value: input.oid
698
+ }, _errorFactory)) && input.oid.every((elem, _index12) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
699
+ method: "typia.assert",
700
+ path: _path + ".oid[" + _index12 + "]",
701
+ expected: "number",
702
+ value: elem
703
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
704
+ method: "typia.assert",
705
+ path: _path + ".oid",
706
+ expected: "Array<number>",
707
+ value: input.oid
708
+ }, _errorFactory)) && (undefined === input.type || "string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
709
+ method: "typia.assert",
710
+ path: _path + ".type",
711
+ expected: "(string | undefined)",
712
+ value: input.type
713
+ }, _errorFactory)) && (undefined === input.token || "string" === typeof input.token || __typia_transform__assertGuard._assertGuard(_exceptionable, {
714
+ method: "typia.assert",
715
+ path: _path + ".token",
716
+ expected: "(string | undefined)",
717
+ value: input.token
718
+ }, _errorFactory)) && ("string" === typeof input.description || __typia_transform__assertGuard._assertGuard(_exceptionable, {
719
+ method: "typia.assert",
720
+ path: _path + ".description",
721
+ expected: "string",
722
+ value: input.description
723
+ }, _errorFactory)) && ("string" === typeof input.reference || __typia_transform__assertGuard._assertGuard(_exceptionable, {
724
+ method: "typia.assert",
725
+ path: _path + ".reference",
726
+ expected: "string",
727
+ value: input.reference
728
+ }, _errorFactory)) && (undefined === input.fields || ("object" === typeof input.fields && null !== input.fields && false === Array.isArray(input.fields) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
729
+ method: "typia.assert",
730
+ path: _path + ".fields",
731
+ expected: "(__type.o2 | undefined)",
732
+ value: input.fields
733
+ }, _errorFactory)) && _ao4(input.fields, _path + ".fields", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
734
+ method: "typia.assert",
735
+ path: _path + ".fields",
736
+ expected: "(__type.o2 | undefined)",
737
+ value: input.fields
738
+ }, _errorFactory)) && (undefined === input.choices || ("object" === typeof input.choices && null !== input.choices && false === Array.isArray(input.choices) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
739
+ method: "typia.assert",
740
+ path: _path + ".choices",
741
+ expected: "(__type.o4 | undefined)",
742
+ value: input.choices
743
+ }, _errorFactory)) && _ao6(input.choices, _path + ".choices", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
744
+ method: "typia.assert",
745
+ path: _path + ".choices",
746
+ expected: "(__type.o4 | undefined)",
747
+ value: input.choices
748
+ }, _errorFactory)) && (undefined === input.field_order || (Array.isArray(input.field_order) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
749
+ method: "typia.assert",
750
+ path: _path + ".field_order",
751
+ expected: "(Array<string> | undefined)",
752
+ value: input.field_order
753
+ }, _errorFactory)) && input.field_order.every((elem, _index13) => "string" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
754
+ method: "typia.assert",
755
+ path: _path + ".field_order[" + _index13 + "]",
756
+ expected: "string",
757
+ value: elem
758
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
759
+ method: "typia.assert",
760
+ path: _path + ".field_order",
761
+ expected: "(Array<string> | undefined)",
762
+ value: input.field_order
763
+ }, _errorFactory)); const _ao4 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
764
+ const value = input[key];
765
+ if (undefined === value)
766
+ return true;
767
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
768
+ method: "typia.assert",
769
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
770
+ expected: "__type.o3",
771
+ value: value
772
+ }, _errorFactory)) && _ao5(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
773
+ method: "typia.assert",
774
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
775
+ expected: "__type.o3",
776
+ value: value
777
+ }, _errorFactory);
778
+ }); const _ao5 = (input, _path, _exceptionable = true) => ("string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
779
+ method: "typia.assert",
780
+ path: _path + ".type",
781
+ expected: "string",
782
+ value: input.type
783
+ }, _errorFactory)) && (undefined === input.optional || "boolean" === typeof input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
784
+ method: "typia.assert",
785
+ path: _path + ".optional",
786
+ expected: "(boolean | undefined)",
787
+ value: input.optional
788
+ }, _errorFactory)); const _ao6 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
789
+ const value = input[key];
790
+ if (undefined === value)
791
+ return true;
792
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
793
+ method: "typia.assert",
794
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
795
+ expected: "__type.o5",
796
+ value: value
797
+ }, _errorFactory)) && _ao7(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
798
+ method: "typia.assert",
799
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
800
+ expected: "__type.o5",
801
+ value: value
802
+ }, _errorFactory);
803
+ }); const _ao7 = (input, _path, _exceptionable = true) => "string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
804
+ method: "typia.assert",
805
+ path: _path + ".type",
806
+ expected: "string",
807
+ value: input.type
808
+ }, _errorFactory); const _ao8 = (input, _path, _exceptionable = true) => (("object" === typeof input.primitives && null !== input.primitives && false === Array.isArray(input.primitives) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
809
+ method: "typia.assert",
810
+ path: _path + ".primitives",
811
+ expected: "__type.o7",
812
+ value: input.primitives
813
+ }, _errorFactory)) && _ao9(input.primitives, _path + ".primitives", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
814
+ method: "typia.assert",
815
+ path: _path + ".primitives",
816
+ expected: "__type.o7",
817
+ value: input.primitives
818
+ }, _errorFactory)) && (("object" === typeof input.enumerations && null !== input.enumerations && false === Array.isArray(input.enumerations) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
819
+ method: "typia.assert",
820
+ path: _path + ".enumerations",
821
+ expected: "__type.o9",
822
+ value: input.enumerations
823
+ }, _errorFactory)) && _ao11(input.enumerations, _path + ".enumerations", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
824
+ method: "typia.assert",
825
+ path: _path + ".enumerations",
826
+ expected: "__type.o9",
827
+ value: input.enumerations
828
+ }, _errorFactory)) && (("object" === typeof input.choices && null !== input.choices && false === Array.isArray(input.choices) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
829
+ method: "typia.assert",
830
+ path: _path + ".choices",
831
+ expected: "__type.o11",
832
+ value: input.choices
833
+ }, _errorFactory)) && _ao13(input.choices, _path + ".choices", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
834
+ method: "typia.assert",
835
+ path: _path + ".choices",
836
+ expected: "__type.o11",
837
+ value: input.choices
838
+ }, _errorFactory)) && (("object" === typeof input.sequences && null !== input.sequences && false === Array.isArray(input.sequences) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
839
+ method: "typia.assert",
840
+ path: _path + ".sequences",
841
+ expected: "__type.o15",
842
+ value: input.sequences
843
+ }, _errorFactory)) && _ao17(input.sequences, _path + ".sequences", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
844
+ method: "typia.assert",
845
+ path: _path + ".sequences",
846
+ expected: "__type.o15",
847
+ value: input.sequences
848
+ }, _errorFactory)); const _ao9 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
849
+ const value = input[key];
850
+ if (undefined === value)
851
+ return true;
852
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
853
+ method: "typia.assert",
854
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
855
+ expected: "__type.o8",
856
+ value: value
857
+ }, _errorFactory)) && _ao10(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
858
+ method: "typia.assert",
859
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
860
+ expected: "__type.o8",
861
+ value: value
862
+ }, _errorFactory);
863
+ }); const _ao10 = (input, _path, _exceptionable = true) => ((Array.isArray(input.oid) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
864
+ method: "typia.assert",
865
+ path: _path + ".oid",
866
+ expected: "Array<number>",
867
+ value: input.oid
868
+ }, _errorFactory)) && input.oid.every((elem, _index14) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
869
+ method: "typia.assert",
870
+ path: _path + ".oid[" + _index14 + "]",
871
+ expected: "number",
872
+ value: elem
873
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
874
+ method: "typia.assert",
875
+ path: _path + ".oid",
876
+ expected: "Array<number>",
877
+ value: input.oid
878
+ }, _errorFactory)) && ("string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
879
+ method: "typia.assert",
880
+ path: _path + ".type",
881
+ expected: "string",
882
+ value: input.type
883
+ }, _errorFactory)) && ("string" === typeof input.description || __typia_transform__assertGuard._assertGuard(_exceptionable, {
884
+ method: "typia.assert",
885
+ path: _path + ".description",
886
+ expected: "string",
887
+ value: input.description
888
+ }, _errorFactory)); const _ao11 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
889
+ const value = input[key];
890
+ if (undefined === value)
891
+ return true;
892
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
893
+ method: "typia.assert",
894
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
895
+ expected: "__type.o10",
896
+ value: value
897
+ }, _errorFactory)) && _ao12(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
898
+ method: "typia.assert",
899
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
900
+ expected: "__type.o10",
901
+ value: value
902
+ }, _errorFactory);
903
+ }); const _ao12 = (input, _path, _exceptionable = true) => ((Array.isArray(input.oid) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
904
+ method: "typia.assert",
905
+ path: _path + ".oid",
906
+ expected: "Array<number>",
907
+ value: input.oid
908
+ }, _errorFactory)) && input.oid.every((elem, _index15) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
909
+ method: "typia.assert",
910
+ path: _path + ".oid[" + _index15 + "]",
911
+ expected: "number",
912
+ value: elem
913
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
914
+ method: "typia.assert",
915
+ path: _path + ".oid",
916
+ expected: "Array<number>",
917
+ value: input.oid
918
+ }, _errorFactory)) && ((Array.isArray(input.values) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
919
+ method: "typia.assert",
920
+ path: _path + ".values",
921
+ expected: "Array<string>",
922
+ value: input.values
923
+ }, _errorFactory)) && input.values.every((elem, _index16) => "string" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
924
+ method: "typia.assert",
925
+ path: _path + ".values[" + _index16 + "]",
926
+ expected: "string",
927
+ value: elem
928
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
929
+ method: "typia.assert",
930
+ path: _path + ".values",
931
+ expected: "Array<string>",
932
+ value: input.values
933
+ }, _errorFactory)) && ("string" === typeof input.description || __typia_transform__assertGuard._assertGuard(_exceptionable, {
934
+ method: "typia.assert",
935
+ path: _path + ".description",
936
+ expected: "string",
937
+ value: input.description
938
+ }, _errorFactory)); const _ao13 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
939
+ const value = input[key];
940
+ if (undefined === value)
941
+ return true;
942
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
943
+ method: "typia.assert",
944
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
945
+ expected: "__type.o12",
946
+ value: value
947
+ }, _errorFactory)) && _ao14(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
948
+ method: "typia.assert",
949
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
950
+ expected: "__type.o12",
951
+ value: value
952
+ }, _errorFactory);
953
+ }); const _ao14 = (input, _path, _exceptionable = true) => ((Array.isArray(input.oid) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
954
+ method: "typia.assert",
955
+ path: _path + ".oid",
956
+ expected: "Array<number>",
957
+ value: input.oid
958
+ }, _errorFactory)) && input.oid.every((elem, _index17) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
959
+ method: "typia.assert",
960
+ path: _path + ".oid[" + _index17 + "]",
961
+ expected: "number",
962
+ value: elem
963
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
964
+ method: "typia.assert",
965
+ path: _path + ".oid",
966
+ expected: "Array<number>",
967
+ value: input.oid
968
+ }, _errorFactory)) && (("object" === typeof input.choices && null !== input.choices && false === Array.isArray(input.choices) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
969
+ method: "typia.assert",
970
+ path: _path + ".choices",
971
+ expected: "__type.o13",
972
+ value: input.choices
973
+ }, _errorFactory)) && _ao15(input.choices, _path + ".choices", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
974
+ method: "typia.assert",
975
+ path: _path + ".choices",
976
+ expected: "__type.o13",
977
+ value: input.choices
978
+ }, _errorFactory)) && ("string" === typeof input.description || __typia_transform__assertGuard._assertGuard(_exceptionable, {
979
+ method: "typia.assert",
980
+ path: _path + ".description",
981
+ expected: "string",
982
+ value: input.description
983
+ }, _errorFactory)); const _ao15 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
984
+ const value = input[key];
985
+ if (undefined === value)
986
+ return true;
987
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
988
+ method: "typia.assert",
989
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
990
+ expected: "__type.o14",
991
+ value: value
992
+ }, _errorFactory)) && _ao16(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
993
+ method: "typia.assert",
994
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
995
+ expected: "__type.o14",
996
+ value: value
997
+ }, _errorFactory);
998
+ }); const _ao16 = (input, _path, _exceptionable = true) => "string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
999
+ method: "typia.assert",
1000
+ path: _path + ".type",
1001
+ expected: "string",
1002
+ value: input.type
1003
+ }, _errorFactory); const _ao17 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
1004
+ const value = input[key];
1005
+ if (undefined === value)
1006
+ return true;
1007
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1008
+ method: "typia.assert",
1009
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
1010
+ expected: "__type.o16",
1011
+ value: value
1012
+ }, _errorFactory)) && _ao18(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1013
+ method: "typia.assert",
1014
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
1015
+ expected: "__type.o16",
1016
+ value: value
1017
+ }, _errorFactory);
1018
+ }); const _ao18 = (input, _path, _exceptionable = true) => ((Array.isArray(input.oid) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1019
+ method: "typia.assert",
1020
+ path: _path + ".oid",
1021
+ expected: "Array<number>",
1022
+ value: input.oid
1023
+ }, _errorFactory)) && input.oid.every((elem, _index18) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1024
+ method: "typia.assert",
1025
+ path: _path + ".oid[" + _index18 + "]",
1026
+ expected: "number",
1027
+ value: elem
1028
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1029
+ method: "typia.assert",
1030
+ path: _path + ".oid",
1031
+ expected: "Array<number>",
1032
+ value: input.oid
1033
+ }, _errorFactory)) && (("object" === typeof input.fields && null !== input.fields && false === Array.isArray(input.fields) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1034
+ method: "typia.assert",
1035
+ path: _path + ".fields",
1036
+ expected: "__type.o17",
1037
+ value: input.fields
1038
+ }, _errorFactory)) && _ao19(input.fields, _path + ".fields", true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1039
+ method: "typia.assert",
1040
+ path: _path + ".fields",
1041
+ expected: "__type.o17",
1042
+ value: input.fields
1043
+ }, _errorFactory)) && (undefined === input.field_order || (Array.isArray(input.field_order) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1044
+ method: "typia.assert",
1045
+ path: _path + ".field_order",
1046
+ expected: "(Array<string> | undefined)",
1047
+ value: input.field_order
1048
+ }, _errorFactory)) && input.field_order.every((elem, _index19) => "string" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1049
+ method: "typia.assert",
1050
+ path: _path + ".field_order[" + _index19 + "]",
1051
+ expected: "string",
1052
+ value: elem
1053
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1054
+ method: "typia.assert",
1055
+ path: _path + ".field_order",
1056
+ expected: "(Array<string> | undefined)",
1057
+ value: input.field_order
1058
+ }, _errorFactory)) && ("string" === typeof input.description || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1059
+ method: "typia.assert",
1060
+ path: _path + ".description",
1061
+ expected: "string",
1062
+ value: input.description
1063
+ }, _errorFactory)); const _ao19 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
1064
+ const value = input[key];
1065
+ if (undefined === value)
1066
+ return true;
1067
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1068
+ method: "typia.assert",
1069
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
1070
+ expected: "__type.o18",
1071
+ value: value
1072
+ }, _errorFactory)) && _ao20(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1073
+ method: "typia.assert",
1074
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
1075
+ expected: "__type.o18",
1076
+ value: value
1077
+ }, _errorFactory);
1078
+ }); const _ao20 = (input, _path, _exceptionable = true) => ("string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1079
+ method: "typia.assert",
1080
+ path: _path + ".type",
1081
+ expected: "string",
1082
+ value: input.type
1083
+ }, _errorFactory)) && (undefined === input.optional || "boolean" === typeof input.optional || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1084
+ method: "typia.assert",
1085
+ path: _path + ".optional",
1086
+ expected: "(boolean | undefined)",
1087
+ value: input.optional
1088
+ }, _errorFactory)); const _ao21 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every(key => {
1089
+ const value = input[key];
1090
+ if (undefined === value)
1091
+ return true;
1092
+ return ("object" === typeof value && null !== value || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1093
+ method: "typia.assert",
1094
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
1095
+ expected: "__type.o20",
1096
+ value: value
1097
+ }, _errorFactory)) && _ao22(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), true && _exceptionable) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1098
+ method: "typia.assert",
1099
+ path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
1100
+ expected: "__type.o20",
1101
+ value: value
1102
+ }, _errorFactory);
1103
+ }); const _ao22 = (input, _path, _exceptionable = true) => ((Array.isArray(input.oid) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1104
+ method: "typia.assert",
1105
+ path: _path + ".oid",
1106
+ expected: "Array<number>",
1107
+ value: input.oid
1108
+ }, _errorFactory)) && input.oid.every((elem, _index20) => "number" === typeof elem || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1109
+ method: "typia.assert",
1110
+ path: _path + ".oid[" + _index20 + "]",
1111
+ expected: "number",
1112
+ value: elem
1113
+ }, _errorFactory)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1114
+ method: "typia.assert",
1115
+ path: _path + ".oid",
1116
+ expected: "Array<number>",
1117
+ value: input.oid
1118
+ }, _errorFactory)) && (undefined === input.type || "string" === typeof input.type || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1119
+ method: "typia.assert",
1120
+ path: _path + ".type",
1121
+ expected: "(string | undefined)",
1122
+ value: input.type
1123
+ }, _errorFactory)) && ("string" === typeof input.description || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1124
+ method: "typia.assert",
1125
+ path: _path + ".description",
1126
+ expected: "string",
1127
+ value: input.description
1128
+ }, _errorFactory)) && ("string" === typeof input.reference || __typia_transform__assertGuard._assertGuard(_exceptionable, {
1129
+ method: "typia.assert",
1130
+ path: _path + ".reference",
1131
+ expected: "string",
1132
+ value: input.reference
1133
+ }, _errorFactory)); const __is = input => "object" === typeof input && null !== input && _io0(input); let _errorFactory; return (input, errorFactory) => {
1134
+ if (false === __is(input)) {
1135
+ _errorFactory = errorFactory;
1136
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || __typia_transform__assertGuard._assertGuard(true, {
1137
+ method: "typia.assert",
1138
+ path: _path + "",
1139
+ expected: "oidSchemaContents",
1140
+ value: input
1141
+ }, _errorFactory)) && _ao0(input, _path + "", true) || __typia_transform__assertGuard._assertGuard(true, {
1142
+ method: "typia.assert",
1143
+ path: _path + "",
1144
+ expected: "oidSchemaContents",
1145
+ value: input
1146
+ }, _errorFactory))(input, "$input", true);
1147
+ }
1148
+ return input;
1149
+ }; })()(JSON.parse(fs.readFileSync(oidsJSONPath, 'utf8')));
1150
+ fs.writeFileSync(oidsOutputPath, generateOidConstants(), 'utf8');
1151
+ fs.writeFileSync(iso20022OutputPath, generateIso20022Types(), 'utf8');
1152
+ }
1153
+ main(process.argv.slice(2));
1154
+ //# sourceMappingURL=generate-kyc-schema.js.map