typia 3.9.0-dev.20230603 → 3.9.0-dev.20230604

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 (52) hide show
  1. package/lib/factories/MetadataCollection.d.ts +4 -4
  2. package/lib/factories/MetadataCollection.js +12 -12
  3. package/lib/factories/MetadataCollection.js.map +1 -1
  4. package/lib/factories/internal/metadata/emplace_metadata_definition.d.ts +2 -2
  5. package/lib/factories/internal/metadata/emplace_metadata_definition.js +1 -1
  6. package/lib/factories/internal/metadata/emplace_metadata_definition.js.map +1 -1
  7. package/lib/factories/internal/metadata/iterate_metadata_collection.js +4 -4
  8. package/lib/factories/internal/metadata/iterate_metadata_collection.js.map +1 -1
  9. package/lib/factories/internal/metadata/iterate_metadata_definition.js +2 -2
  10. package/lib/factories/internal/metadata/iterate_metadata_definition.js.map +1 -1
  11. package/lib/metadata/IMetadata.d.ts +1 -1
  12. package/lib/metadata/{IMetadataDefinition.d.ts → IMetadataAlias.d.ts} +1 -1
  13. package/lib/metadata/{IMetadataDefinition.js → IMetadataAlias.js} +1 -1
  14. package/lib/metadata/IMetadataAlias.js.map +1 -0
  15. package/lib/metadata/IMetadataCollection.d.ts +2 -2
  16. package/lib/metadata/Metadata.d.ts +2 -2
  17. package/lib/metadata/Metadata.js +25 -25
  18. package/lib/metadata/Metadata.js.map +1 -1
  19. package/lib/metadata/{MetadataDefinition.d.ts → MetadataAlias.d.ts} +3 -3
  20. package/lib/metadata/{MetadataDefinition.js → MetadataAlias.js} +10 -10
  21. package/lib/metadata/MetadataAlias.js.map +1 -0
  22. package/lib/programmers/internal/application_boolean.js +1 -1
  23. package/lib/programmers/internal/application_boolean.js.map +1 -1
  24. package/lib/programmers/internal/application_constant.js +2 -2
  25. package/lib/programmers/internal/application_constant.js.map +1 -1
  26. package/lib/programmers/internal/application_default.js +3 -3
  27. package/lib/programmers/internal/application_default.js.map +1 -1
  28. package/lib/programmers/internal/application_definition.d.ts +2 -2
  29. package/lib/programmers/internal/application_definition.js +11 -11
  30. package/lib/programmers/internal/application_definition.js.map +1 -1
  31. package/lib/programmers/internal/application_schema.js +3 -3
  32. package/lib/programmers/internal/application_schema.js.map +1 -1
  33. package/lib/schemas/IJsonComponents.d.ts +2 -2
  34. package/package.json +1 -1
  35. package/src/factories/MetadataCollection.ts +14 -17
  36. package/src/factories/internal/metadata/emplace_metadata_definition.ts +3 -3
  37. package/src/factories/internal/metadata/iterate_metadata_collection.ts +4 -4
  38. package/src/factories/internal/metadata/iterate_metadata_definition.ts +5 -9
  39. package/src/metadata/IMetadata.ts +1 -1
  40. package/src/metadata/{IMetadataDefinition.ts → IMetadataAlias.ts} +1 -1
  41. package/src/metadata/IMetadataCollection.ts +2 -2
  42. package/src/metadata/IMetadataDictionary.ts +2 -2
  43. package/src/metadata/Metadata.ts +25 -318
  44. package/src/metadata/{MetadataDefinition.ts → MetadataAlias.ts} +7 -11
  45. package/src/programmers/internal/application_boolean.ts +1 -1
  46. package/src/programmers/internal/application_constant.ts +2 -2
  47. package/src/programmers/internal/application_default.ts +3 -3
  48. package/src/programmers/internal/application_definition.ts +13 -13
  49. package/src/programmers/internal/application_schema.ts +3 -3
  50. package/src/schemas/IJsonComponents.ts +2 -2
  51. package/lib/metadata/IMetadataDefinition.js.map +0 -1
  52. package/lib/metadata/MetadataDefinition.js.map +0 -1
@@ -7,9 +7,9 @@ import { ArrayUtil } from "../utils/ArrayUtil";
7
7
  import { IMetadata } from "./IMetadata";
8
8
  import { IMetadataCollection } from "./IMetadataCollection";
9
9
  import { IMetadataDictionary } from "./IMetadataDictionary";
10
+ import { MetadataAlias } from "./MetadataAlias";
10
11
  import { MetadataArray } from "./MetadataArray";
11
12
  import { MetadataConstant } from "./MetadataConstant";
12
- import { MetadataDefinition } from "./MetadataDefinition";
13
13
  import { MetadataObject } from "./MetadataObject";
14
14
  import { MetadataProperty } from "./MetadataProperty";
15
15
  import { MetadataTuple } from "./MetadataTuple";
@@ -27,10 +27,10 @@ export class Metadata {
27
27
  public templates: Metadata[][];
28
28
 
29
29
  public rest: Metadata | null;
30
+ public aliases: MetadataAlias[];
30
31
  public arrays: MetadataArray[];
31
32
  public tuples: MetadataTuple[];
32
33
  public objects: MetadataObject[];
33
- public definitions: MetadataDefinition[];
34
34
 
35
35
  public natives: string[];
36
36
  public sets: Metadata[];
@@ -62,7 +62,7 @@ export class Metadata {
62
62
  this.arrays = props.arrays;
63
63
  this.tuples = props.tuples;
64
64
  this.objects = props.objects;
65
- this.definitions = props.definitions;
65
+ this.aliases = props.aliases;
66
66
 
67
67
  this.natives = props.natives;
68
68
  this.sets = props.sets;
@@ -94,7 +94,7 @@ export class Metadata {
94
94
  arrays: [],
95
95
  tuples: [],
96
96
  objects: [],
97
- definitions: [],
97
+ aliases: [],
98
98
 
99
99
  rest: null,
100
100
  natives: [],
@@ -124,7 +124,7 @@ export class Metadata {
124
124
  arrays: this.arrays.map((array) => array.name),
125
125
  tuples: this.tuples.map((tuple) => tuple.name),
126
126
  objects: this.objects.map((obj) => obj.name),
127
- definitions: this.definitions.map((def) => def.name),
127
+ aliases: this.aliases.map((alias) => alias.name),
128
128
 
129
129
  natives: this.natives.slice(),
130
130
  sets: this.sets.map((meta) => meta.toJSON()),
@@ -146,10 +146,10 @@ export class Metadata {
146
146
  MetadataObject._From_without_properties(obj),
147
147
  ]),
148
148
  ),
149
- definitions: new Map(
150
- collection.definitions.map((def) => [
151
- def.name,
152
- MetadataDefinition._From_without_value(def),
149
+ aliases: new Map(
150
+ collection.aliases.map((alias) => [
151
+ alias.name,
152
+ MetadataAlias._From_without_value(alias),
153
153
  ]),
154
154
  ),
155
155
  arrays: new Map(
@@ -174,9 +174,9 @@ export class Metadata {
174
174
  ),
175
175
  );
176
176
  }
177
- for (const def of collection.definitions)
178
- Writable(dict.definitions.get(def.name)!).value = this._From(
179
- def.value,
177
+ for (const alias of collection.aliases)
178
+ Writable(dict.aliases.get(alias.name)!).value = this._From(
179
+ alias.value,
180
180
  dict,
181
181
  );
182
182
  for (const array of collection.arrays)
@@ -234,11 +234,11 @@ export class Metadata {
234
234
  );
235
235
  return found;
236
236
  }),
237
- definitions: meta.definitions.map((def) => {
238
- const found = dict.definitions.get(def);
237
+ aliases: meta.aliases.map((alias) => {
238
+ const found = dict.aliases.get(alias);
239
239
  if (found === undefined)
240
240
  throw new Error(
241
- `Error on Metadata.from(): failed to find definition "${def}".`,
241
+ `Error on Metadata.from(): failed to find alias "${alias}".`,
242
242
  );
243
243
  return found;
244
244
  }),
@@ -279,7 +279,7 @@ export class Metadata {
279
279
  this.maps.length +
280
280
  this.sets.length +
281
281
  this.objects.length +
282
- this.definitions.length
282
+ this.aliases.length
283
283
  );
284
284
  }
285
285
  public bucket(): number {
@@ -296,7 +296,7 @@ export class Metadata {
296
296
  (this.sets.length ? 1 : 0) +
297
297
  (this.maps.length ? 1 : 0) +
298
298
  (this.objects.length ? 1 : 0) +
299
- (this.definitions.length ? 1 : 0)
299
+ (this.aliases.length ? 1 : 0)
300
300
  );
301
301
  }
302
302
  public isConstant(): boolean {
@@ -339,299 +339,6 @@ export class Metadata {
339
339
  public isParentResolved(): boolean {
340
340
  return this.parent_resolved_;
341
341
  }
342
-
343
- // /* -----------------------------------------------------------
344
- // COMBINERS
345
- // ----------------------------------------------------------- */
346
- // public computeEmpty(): boolean {
347
- // return this.computeSize() === 0;
348
- // }
349
-
350
- // public computeSize(): number {
351
- // return (this.computed_size_ ??=
352
- // (this.computeResolved() ? 1 : 0) +
353
- // (this.computeFunctional() ? 1 : 0) +
354
- // (this.computeRest() ? 1 : 0) +
355
- // this.computeTemplates().length +
356
- // this.computeAtomics().size +
357
- // [...this.computeConstants().values()]
358
- // .map((v) => v.size)
359
- // .reduce((a, b) => a + b, 0) +
360
- // this.computeArrays().length +
361
- // this.computeTuples().length +
362
- // this.computeObjects().length +
363
- // this.computeDefinitions().length +
364
- // this.computeNatives().size +
365
- // this.computeSets().length +
366
- // this.computeMaps().length);
367
- // }
368
-
369
- // public computeBucket(): number {
370
- // return (this.computed_bucket_ ??=
371
- // (this.computeResolved() ? 1 : 0) +
372
- // (this.computeFunctional() ? 1 : 0) +
373
- // (this.computeTemplates().length ? 1 : 0) +
374
- // (this.computeAtomics().size ? 1 : 0) +
375
- // (this.computeConstants().size ? 1 : 0) +
376
- // (this.computeRest() ? 1 : 0) +
377
- // (this.computeArrays().length ? 1 : 0) +
378
- // (this.computeTuples().length ? 1 : 0) +
379
- // (this.computeObjects().length ? 1 : 0) +
380
- // (this.computeNatives().size ? 1 : 0) +
381
- // (this.computeSets().length ? 1 : 0) +
382
- // (this.computeMaps().length ? 1 : 0));
383
- // }
384
-
385
- // public computeAny(): boolean {
386
- // return (this.computed_any_ ??= Metadata._Iterate([] as boolean[])(
387
- // (flags) => (meta) => flags.push(meta.any),
388
- // )(this).reduce((x, y) => x || y));
389
- // }
390
-
391
- // public computeRequired(): boolean {
392
- // return (this.computed_required_ ??= Metadata._Iterate([] as boolean[])(
393
- // (flags) => (meta) => flags.push(meta.required),
394
- // )(this).reduce((x, y) => x && y));
395
- // }
396
-
397
- // public computeOptional(): boolean {
398
- // return (this.computed_optional_ ??= Metadata._Iterate([] as boolean[])(
399
- // (flags) => (meta) => flags.push(meta.optional),
400
- // )(this).reduce((x, y) => x || y));
401
- // }
402
-
403
- // public computeNullable(): boolean {
404
- // return (this.computed_nullable_ ??= Metadata._Iterate([] as boolean[])(
405
- // (flags) => (meta) => flags.push(meta.nullable),
406
- // )(this).reduce((x, y) => x || y));
407
- // }
408
-
409
- // public computeFunctional(): boolean {
410
- // return (this.computed_functional_ ??= Metadata._Iterate(
411
- // [] as boolean[],
412
- // )((flags) => (meta) => flags.push(meta.any))(this).reduce(
413
- // (x, y) => x || y,
414
- // ));
415
- // }
416
-
417
- // public computeAtomics(): Set<Atomic.Literal> {
418
- // return (this.computed_atomics_ ??= Metadata._Iterate(
419
- // new Set<Atomic.Literal>(),
420
- // )((values) => (meta) => {
421
- // for (const atomic of meta.atomics) values.add(atomic);
422
- // })(this));
423
- // }
424
-
425
- // public computeConstants(): Map<Atomic.Literal, Set<Atomic.Type>> {
426
- // return (this.computed_constants_ ??= Metadata._Iterate(
427
- // new Map<Atomic.Literal, Set<Atomic.Type>>(),
428
- // )((container) => (meta) => {
429
- // for (const constant of meta.constants) {
430
- // const line = MapUtil.take(container)(
431
- // constant.type,
432
- // () => new Set(),
433
- // );
434
- // for (const v of constant.values) line.add(v);
435
- // }
436
- // })(this));
437
- // }
438
-
439
- // public computeTemplates(): Metadata[][] {
440
- // return (this.computed_templates_ ??= (() => {
441
- // const dict = Metadata._Iterate(new Map<string, Metadata[]>())(
442
- // (dict) => (meta) =>
443
- // meta.templates.forEach((tpl) =>
444
- // dict.set(tpl.map((t) => t.getName).join(","), tpl),
445
- // ),
446
- // )(this);
447
- // return [...dict.values()];
448
- // })());
449
- // }
450
-
451
- // public computeResolved(): Metadata | null {
452
- // return (this.computed_resolved_ ??= this.resolved);
453
- // }
454
-
455
- // public computeRest(): Metadata | null {
456
- // return (this.computed_rest_ ??= this.rest);
457
- // }
458
-
459
- // public computeArrays(): Metadata[] {
460
- // return (this.computed_arrays_ ??= (() => {
461
- // const dict = Metadata._Iterate(new Map<string, Metadata>())(
462
- // (dict) => (meta) =>
463
- // meta.arrays.forEach((array) =>
464
- // dict.set(array.getName(), array),
465
- // ),
466
- // )(this);
467
- // return [...dict.values()];
468
- // })());
469
- // }
470
-
471
- // public computeTuples(): Metadata[][] {
472
- // return (this.computed_tuples_ ??= (() => {
473
- // const dict = Metadata._Iterate(new Map<string, Metadata[]>())(
474
- // (dict) => (meta) =>
475
- // meta.tuples.forEach((tpl) =>
476
- // dict.set(tpl.map((t) => t.getName).join(","), tpl),
477
- // ),
478
- // )(this);
479
- // return [...dict.values()];
480
- // })());
481
- // }
482
-
483
- // public computeNatives(): Set<string> {
484
- // return (this.computed_natives_ ??= Metadata._Iterate(new Set<string>())(
485
- // (values) => (meta) => {
486
- // for (const native of meta.natives) values.add(native);
487
- // },
488
- // )(this));
489
- // }
490
-
491
- // public computeSets(): Metadata[] {
492
- // return (this.computed_sets_ ??= (() => {
493
- // const dict = Metadata._Iterate(new Map<string, Metadata>())(
494
- // (dict) => (meta) =>
495
- // meta.sets.forEach((set) => dict.set(set.getName(), set)),
496
- // )(this);
497
- // return [...dict.values()];
498
- // })());
499
- // }
500
-
501
- // public computeMaps(): Metadata.Entry[] {
502
- // return (this.computed_maps_ ??= (() => {
503
- // const dict = Metadata._Iterate(new Map<string, Metadata.Entry>())(
504
- // (dict) => (meta) =>
505
- // meta.maps.forEach((m) =>
506
- // dict.set(
507
- // [m.key.getName(), m.value.getName()].join(","),
508
- // m,
509
- // ),
510
- // ),
511
- // )(this);
512
- // return [...dict.values()];
513
- // })());
514
- // }
515
-
516
- // public computeObjects(): MetadataObject[] {
517
- // return (this.computed_objects_ ??= (() => {
518
- // const dict = Metadata._Iterate(new Map<string, MetadataObject>())(
519
- // (dict) => (meta) =>
520
- // meta.objects.forEach((obj) => dict.set(obj.name, obj)),
521
- // )(this);
522
- // return [...dict.values()];
523
- // })());
524
- // }
525
-
526
- // public computeDefinitions(): MetadataDefinition[] {
527
- // return (this.computed_definitions_ ??= (() => {
528
- // const dict = Metadata._Iterate(
529
- // new Map<string, MetadataDefinition>(),
530
- // )(
531
- // (dict) => (meta) =>
532
- // meta.definitions.forEach((def) => dict.set(def.name, def)),
533
- // )(this);
534
- // return [...dict.values()];
535
- // })());
536
- // }
537
-
538
- // public absorb(): void {
539
- // this._Absorb(new Set());
540
- // }
541
-
542
- // private _Absorb(visited: Set<Metadata>): void {
543
- // if (visited.has(this)) return;
544
- // visited.add(this);
545
-
546
- // if (this.size() === 1 && this.definitions.length === 1) return;
547
-
548
- // //----
549
- // // ITERATIONS
550
- // //----
551
- // if (this.resolved) this.resolved._Absorb(visited);
552
- // if (this.rest) this.rest._Absorb(visited);
553
-
554
- // for (const array of this.arrays) array._Absorb(visited);
555
- // for (const tuple of this.tuples)
556
- // for (const elem of tuple) elem._Absorb(visited);
557
-
558
- // for (const set of this.sets) set._Absorb(visited);
559
- // for (const map of this.maps) map.value._Absorb(visited);
560
- // for (const object of this.objects)
561
- // for (const property of object.properties)
562
- // property.value._Absorb(visited);
563
- // for (const definition of this.definitions)
564
- // definition.value._Absorb(visited);
565
-
566
- // //----
567
- // // MEMBERS
568
- // //----
569
- // // FLAGS
570
- // this.any = this.computeAny();
571
- // this.required = this.computeRequired();
572
- // this.optional = this.computeOptional();
573
- // this.nullable = this.computeNullable();
574
- // this.functional = this.computeFunctional();
575
-
576
- // // ATOMICS
577
- // this.atomics = [...this.computeAtomics()];
578
- // this.constants = [...this.computeConstants()].map(([type, values]) => ({
579
- // type,
580
- // values: [...values],
581
- // })) as MetadataConstant[];
582
- // this.templates = this.computeTemplates();
583
-
584
- // // INSTANCES
585
- // this.resolved = this.computeResolved();
586
- // this.rest = this.computeRest();
587
- // this.arrays = this.computeArrays();
588
- // this.tuples = this.computeTuples();
589
- // this.natives = [...this.computeNatives()];
590
- // this.maps = this.computeMaps();
591
- // this.sets = this.computeSets();
592
- // this.objects = this.computeObjects();
593
- // this.definitions = this.computeDefinitions();
594
- // }
595
-
596
- // private static _Iterate =
597
- // <T>(container: T) =>
598
- // (closure: (container: T) => (meta: Metadata) => any) => {
599
- // const visited: Set<string> = new Set();
600
- // const iterate = (meta: Metadata): T => {
601
- // closure(container)(meta);
602
- // for (const def of meta.definitions) {
603
- // const name: string = def.value.getName();
604
- // if (visited.has(name)) continue;
605
- // visited.add(name);
606
- // iterate(def.value);
607
- // }
608
- // return container;
609
- // };
610
- // return iterate;
611
- // };
612
-
613
- // /** @internal */ private computed_size_?: number;
614
- // /** @internal */ private computed_bucket_?: number;
615
- // /** @internal */ private computed_any_?: boolean;
616
- // /** @internal */ private computed_required_?: boolean;
617
- // /** @internal */ private computed_optional_?: boolean;
618
- // /** @internal */ private computed_nullable_?: boolean;
619
- // /** @internal */ private computed_functional_?: boolean;
620
- // /** @internal */ private computed_atomics_?: Set<Atomic.Literal>;
621
- // /** @internal */ private computed_constants_?: Map<
622
- // Atomic.Literal,
623
- // Set<Atomic.Type>
624
- // >;
625
- // /** @internal */ private computed_templates_?: Metadata[][];
626
- // /** @internal */ private computed_rest_?: Metadata | null;
627
- // /** @internal */ private computed_resolved_?: Metadata | null;
628
- // /** @internal */ private computed_arrays_?: Metadata[];
629
- // /** @internal */ private computed_tuples_?: Metadata[][];
630
- // /** @internal */ private computed_natives_?: Set<string>;
631
- // /** @internal */ private computed_sets_?: Metadata[];
632
- // /** @internal */ private computed_maps_?: Metadata.Entry[];
633
- // /** @internal */ private computed_objects_?: MetadataObject[];
634
- // /** @internal */ private computed_definitions_?: MetadataDefinition[];
635
342
  }
636
343
  export namespace Metadata {
637
344
  export const intersects = (x: Metadata, y: Metadata): boolean => {
@@ -648,7 +355,7 @@ export namespace Metadata {
648
355
  if (x.arrays.length && y.arrays.length) return true;
649
356
  if (x.tuples.length && y.tuples.length) return true;
650
357
  if (x.objects.length && y.objects.length) return true;
651
- if (x.definitions.length && y.definitions.length) return true;
358
+ if (x.aliases.length && y.aliases.length) return true;
652
359
 
653
360
  //----
654
361
  // VALUES
@@ -720,9 +427,9 @@ export namespace Metadata {
720
427
  if (x.objects.some((xo) => MetadataObject.covers(xo, yo)) === false)
721
428
  return false;
722
429
 
723
- // DEFINITIONS
724
- for (const yd of y.definitions)
725
- if (x.definitions.some((xd) => xd.name === yd.name) === false)
430
+ // ALIASES
431
+ for (const yd of y.aliases)
432
+ if (x.aliases.some((xd) => xd.name === yd.name) === false)
726
433
  return false;
727
434
 
728
435
  // NATIVES
@@ -787,7 +494,7 @@ export namespace Metadata {
787
494
  arrays: x.arrays.slice(),
788
495
  tuples: x.tuples.slice(),
789
496
  objects: x.objects.slice(),
790
- definitions: x.definitions.slice(),
497
+ aliases: x.aliases.slice(),
791
498
 
792
499
  natives: [...new Set([...x.natives, ...y.natives])],
793
500
  sets: x.sets.slice(),
@@ -811,8 +518,8 @@ export namespace Metadata {
811
518
  ArrayUtil.set(output.tuples, tuple, (elem) => elem.name);
812
519
  for (const obj of y.objects)
813
520
  ArrayUtil.set(output.objects, obj, (elem) => elem.name);
814
- for (const def of y.definitions)
815
- ArrayUtil.set(output.definitions, def, (elem) => elem.name);
521
+ for (const alias of y.aliases)
522
+ ArrayUtil.set(output.aliases, alias, (elem) => elem.name);
816
523
 
817
524
  return output;
818
525
  };
@@ -860,7 +567,7 @@ const getName = (metadata: Metadata): string => {
860
567
  for (const tuple of metadata.tuples) elements.push(tuple.name);
861
568
  for (const array of metadata.arrays) elements.push(array.name);
862
569
  for (const object of metadata.objects) elements.push(object.name);
863
- for (const def of metadata.definitions) elements.push(def.name);
570
+ for (const alias of metadata.aliases) elements.push(alias.name);
864
571
  if (metadata.resolved !== null) elements.push(metadata.resolved.getName());
865
572
 
866
573
  // RETURNS
@@ -1,10 +1,10 @@
1
1
  import { ClassProperties } from "../typings/ClassProperties";
2
2
 
3
3
  import { IJsDocTagInfo } from "./IJsDocTagInfo";
4
- import { IMetadataDefinition } from "./IMetadataDefinition";
4
+ import { IMetadataAlias } from "./IMetadataAlias";
5
5
  import { Metadata } from "./Metadata";
6
6
 
7
- export class MetadataDefinition {
7
+ export class MetadataAlias {
8
8
  public readonly name: string;
9
9
  public readonly value: Metadata;
10
10
  public readonly description: string | null;
@@ -18,7 +18,7 @@ export class MetadataDefinition {
18
18
  /**
19
19
  * @hidden
20
20
  */
21
- private constructor(props: ClassProperties<MetadataDefinition>) {
21
+ private constructor(props: ClassProperties<MetadataAlias>) {
22
22
  this.name = props.name;
23
23
  this.value = props.value;
24
24
  this.description = props.description;
@@ -30,18 +30,14 @@ export class MetadataDefinition {
30
30
  /**
31
31
  * @internal
32
32
  */
33
- public static create(
34
- props: ClassProperties<MetadataDefinition>,
35
- ): MetadataDefinition {
36
- return new MetadataDefinition(props);
33
+ public static create(props: ClassProperties<MetadataAlias>): MetadataAlias {
34
+ return new MetadataAlias(props);
37
35
  }
38
36
 
39
37
  /**
40
38
  * @internal
41
39
  */
42
- public static _From_without_value(
43
- props: Omit<IMetadataDefinition, "value">,
44
- ) {
40
+ public static _From_without_value(props: Omit<IMetadataAlias, "value">) {
45
41
  return this.create({
46
42
  name: props.name,
47
43
  value: null!,
@@ -52,7 +48,7 @@ export class MetadataDefinition {
52
48
  });
53
49
  }
54
50
 
55
- public toJSON(): IMetadataDefinition {
51
+ public toJSON(): IMetadataAlias {
56
52
  return {
57
53
  name: this.name,
58
54
  value: this.value.toJSON(),
@@ -9,7 +9,7 @@ export const application_boolean = (
9
9
  ): IJsonSchema.IBoolean => ({
10
10
  ...attribute,
11
11
  default: application_default(attribute)(
12
- (def) => def === "true" || def === "false",
12
+ (alias) => alias === "true" || alias === "false",
13
13
  )((str) => Boolean(str)),
14
14
  type: "boolean",
15
15
  });
@@ -12,8 +12,8 @@ export const application_constant =
12
12
  ...attribute,
13
13
  type: constant.type,
14
14
  enum: constant.values as any,
15
- default: application_default(attribute)((def) =>
16
- constant.values.some((v) => v.toString() === def),
15
+ default: application_default(attribute)((alias) =>
16
+ constant.values.some((v) => v.toString() === alias),
17
17
  )(
18
18
  constant.type === "string"
19
19
  ? (str) => str
@@ -10,8 +10,8 @@ export const application_default =
10
10
  const defaults = (attribute["x-typia-jsDocTags"] ?? []).filter(
11
11
  (tag) => tag.name === "default",
12
12
  );
13
- for (const def of defaults)
14
- if (def.text?.length && pred(def.text[0]!.text))
15
- return caster(def.text[0]!.text);
13
+ for (const alias of defaults)
14
+ if (alias.text?.length && pred(alias.text[0]!.text))
15
+ return caster(alias.text[0]!.text);
16
16
  return undefined;
17
17
  };
@@ -1,4 +1,4 @@
1
- import { MetadataDefinition } from "../../metadata/MetadataDefinition";
1
+ import { MetadataAlias } from "../../metadata/MetadataAlias";
2
2
  import { IJsonComponents } from "../../schemas/IJsonComponents";
3
3
 
4
4
  import { IJsonSchema } from "../../module";
@@ -10,36 +10,36 @@ export const application_definition =
10
10
  (options: ApplicationProgrammer.IOptions) =>
11
11
  <BlockNever extends boolean>(blockNever: BlockNever) =>
12
12
  (components: IJsonComponents) =>
13
- (def: MetadataDefinition) =>
13
+ (alias: MetadataAlias) =>
14
14
  (
15
15
  nullable: boolean,
16
16
  ): IJsonSchema.IReference | IJsonSchema.IRecursiveReference => {
17
17
  const key: string =
18
18
  options.purpose === "ajv"
19
- ? def.name
20
- : `${def.name}${nullable ? ".Nullable" : ""}`;
21
- const $id: string = `${JSON_COMPONENTS_PREFIX}/definitions/${key}`;
19
+ ? alias.name
20
+ : `${alias.name}${nullable ? ".Nullable" : ""}`;
21
+ const $id: string = `${JSON_COMPONENTS_PREFIX}/aliases/${key}`;
22
22
 
23
23
  // TEMPORARY ASSIGNMENT
24
- if (components.definitions?.[key] === undefined) {
25
- components.definitions ??= {};
26
- components.definitions[key] = {
24
+ if (components.aliases?.[key] === undefined) {
25
+ components.aliases ??= {};
26
+ components.aliases[key] = {
27
27
  $id: key,
28
28
  } as any;
29
29
 
30
30
  // GENERATE SCHEM
31
31
  const schema: IJsonSchema = application_schema(options)(blockNever)(
32
32
  components,
33
- )(def.value)({})!;
34
- components.definitions ??= {};
35
- components.definitions[key] = {
33
+ )(alias.value)({})!;
34
+ components.aliases ??= {};
35
+ components.aliases[key] = {
36
36
  $id: options.purpose === "ajv" ? $id : undefined,
37
37
  $recursiveAnchor:
38
- (options.purpose === "ajv" && def.recursive) || undefined,
38
+ (options.purpose === "ajv" && alias.recursive) || undefined,
39
39
  ...schema,
40
40
  };
41
41
  }
42
- return options.purpose === "ajv" && def.recursive
42
+ return options.purpose === "ajv" && alias.recursive
43
43
  ? { $recursiveRef: $id }
44
44
  : { $ref: $id };
45
45
  };
@@ -139,10 +139,10 @@ export const application_schema =
139
139
  for (const obj of meta.objects)
140
140
  insert(application_object(options)(components)(obj)(meta.nullable));
141
141
 
142
- // DEFINITIONS
143
- for (const def of meta.definitions)
142
+ // ALIASES
143
+ for (const alias of meta.aliases)
144
144
  insert(
145
- application_definition(options)(blockNever)(components)(def)(
145
+ application_definition(options)(blockNever)(components)(alias)(
146
146
  meta.nullable,
147
147
  ),
148
148
  );
@@ -4,7 +4,7 @@ import { IJsonSchema } from "./IJsonSchema";
4
4
 
5
5
  export interface IJsonComponents {
6
6
  objects?: Record<string, IJsonComponents.IObject>;
7
- definitions?: Record<string, IJsonComponents.IDefinition>;
7
+ aliases?: Record<string, IJsonComponents.IAlias>;
8
8
  arrays?: Record<string, IJsonComponents.IArray>;
9
9
  tuples?: Record<string, IJsonComponents.ITuple | IJsonComponents.IArray>;
10
10
  }
@@ -38,7 +38,7 @@ export namespace IJsonComponents {
38
38
  "x-typia-additionalProperties"?: IJsonSchema;
39
39
  }
40
40
 
41
- export type IDefinition = IJsonSchema & {
41
+ export type IAlias = IJsonSchema & {
42
42
  $id?: string;
43
43
  $recursiveAnchor?: boolean;
44
44
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"IMetadataDefinition.js","sourceRoot":"","sources":["../../src/metadata/IMetadataDefinition.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MetadataDefinition.js","sourceRoot":"","sources":["../../src/metadata/MetadataDefinition.ts"],"names":[],"mappings":";;;AAMA;IAcI,4BAAoB,KAA0C;QAC1D,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IACrC,CAAC;IAKa,yBAAM,GAApB,UACI,KAA0C;QAE1C,OAAO,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAKa,sCAAmB,GAAjC,UACI,KAAyC;QAEzC,OAAO,IAAI,CAAC,MAAM,CAAC;YACf,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,IAAK;YACZ,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE;YAClC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE;SACrC,CAAC,CAAC;IACP,CAAC;IAEM,mCAAM,GAAb;QACI,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;SACpC,CAAC;IACN,CAAC;IACL,yBAAC;AAAD,CAAC,AA1DD,IA0DC;AA1DY,gDAAkB"}