@twin.org/tools-core 0.0.3-next.21 → 0.0.3-next.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/utils/importTypeQuerySchemaResolver.js +36 -2
- package/dist/es/utils/importTypeQuerySchemaResolver.js.map +1 -1
- package/dist/es/utils/jsDoc.js +1 -1
- package/dist/es/utils/jsDoc.js.map +1 -1
- package/dist/es/utils/jsonSchemaBuilder.js +144 -133
- package/dist/es/utils/jsonSchemaBuilder.js.map +1 -1
- package/dist/es/utils/mappedTypeSchemaResolver.js +35 -1
- package/dist/es/utils/mappedTypeSchemaResolver.js.map +1 -1
- package/dist/es/utils/objectTransformer.js +1 -1
- package/dist/es/utils/objectTransformer.js.map +1 -1
- package/dist/es/utils/resolver.js +22 -9
- package/dist/es/utils/resolver.js.map +1 -1
- package/dist/es/utils/utilityTypeSchemaMapper.js +81 -40
- package/dist/es/utils/utilityTypeSchemaMapper.js.map +1 -1
- package/dist/types/utils/importTypeQuerySchemaResolver.d.ts +35 -0
- package/dist/types/utils/jsonSchemaBuilder.d.ts +6 -82
- package/dist/types/utils/mappedTypeSchemaResolver.d.ts +35 -0
- package/dist/types/utils/resolver.d.ts +7 -1
- package/dist/types/utils/utilityTypeSchemaMapper.d.ts +60 -13
- package/docs/changelog.md +51 -0
- package/docs/reference/classes/ImportTypeQuerySchemaResolver.md +22 -0
- package/docs/reference/classes/JsonSchemaBuilder.md +12 -304
- package/docs/reference/classes/MappedTypeSchemaResolver.md +64 -0
- package/docs/reference/classes/Resolver.md +12 -1
- package/docs/reference/classes/UtilityTypeSchemaMapper.md +64 -62
- package/package.json +2 -2
|
@@ -1484,181 +1484,17 @@ The interface declaration.
|
|
|
1484
1484
|
|
|
1485
1485
|
`void`
|
|
1486
1486
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
### mapPartialUtilityType() {#mappartialutilitytype}
|
|
1490
|
-
|
|
1491
|
-
> `static` **mapPartialUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1492
|
-
|
|
1493
|
-
Map Partial<T> to an object schema with no required properties.
|
|
1494
|
-
|
|
1495
|
-
#### Parameters
|
|
1496
|
-
|
|
1497
|
-
##### context
|
|
1498
|
-
|
|
1499
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1500
|
-
|
|
1501
|
-
The generation context.
|
|
1502
|
-
|
|
1503
|
-
##### typeNode
|
|
1504
|
-
|
|
1505
|
-
`TypeReferenceNode`
|
|
1506
|
-
|
|
1507
|
-
The Partial type reference.
|
|
1508
|
-
|
|
1509
|
-
#### Returns
|
|
1510
|
-
|
|
1511
|
-
`IJsonSchema` \| `undefined`
|
|
1512
|
-
|
|
1513
|
-
The mapped schema.
|
|
1514
|
-
|
|
1515
|
-
***
|
|
1516
|
-
|
|
1517
|
-
### mapRequiredUtilityType() {#maprequiredutilitytype}
|
|
1518
|
-
|
|
1519
|
-
> `static` **mapRequiredUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1520
|
-
|
|
1521
|
-
Map Required<T> to an object schema with all properties required.
|
|
1522
|
-
|
|
1523
|
-
#### Parameters
|
|
1524
|
-
|
|
1525
|
-
##### context
|
|
1526
|
-
|
|
1527
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1528
|
-
|
|
1529
|
-
The generation context.
|
|
1530
|
-
|
|
1531
|
-
##### typeNode
|
|
1532
|
-
|
|
1533
|
-
`TypeReferenceNode`
|
|
1534
|
-
|
|
1535
|
-
The Required type reference.
|
|
1536
|
-
|
|
1537
|
-
#### Returns
|
|
1538
|
-
|
|
1539
|
-
`IJsonSchema` \| `undefined`
|
|
1540
|
-
|
|
1541
|
-
The mapped schema.
|
|
1542
|
-
|
|
1543
|
-
***
|
|
1544
|
-
|
|
1545
|
-
### mapPickUtilityType() {#mappickutilitytype}
|
|
1546
|
-
|
|
1547
|
-
> `static` **mapPickUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1548
|
-
|
|
1549
|
-
Map Pick<T, K> to an object schema with selected keys preserved.
|
|
1550
|
-
|
|
1551
|
-
#### Parameters
|
|
1552
|
-
|
|
1553
|
-
##### context
|
|
1554
|
-
|
|
1555
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1556
|
-
|
|
1557
|
-
The generation context.
|
|
1558
|
-
|
|
1559
|
-
##### typeNode
|
|
1560
|
-
|
|
1561
|
-
`TypeReferenceNode`
|
|
1562
|
-
|
|
1563
|
-
The Pick type reference.
|
|
1564
|
-
|
|
1565
|
-
#### Returns
|
|
1566
|
-
|
|
1567
|
-
`IJsonSchema` \| `undefined`
|
|
1568
|
-
|
|
1569
|
-
The mapped schema.
|
|
1570
|
-
|
|
1571
|
-
***
|
|
1572
|
-
|
|
1573
|
-
### mapOmitUtilityType() {#mapomitutilitytype}
|
|
1574
|
-
|
|
1575
|
-
> `static` **mapOmitUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1576
|
-
|
|
1577
|
-
Map Omit<T, K> to an object schema with selected keys removed.
|
|
1578
|
-
|
|
1579
|
-
#### Parameters
|
|
1580
|
-
|
|
1581
|
-
##### context
|
|
1582
|
-
|
|
1583
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1584
|
-
|
|
1585
|
-
The generation context.
|
|
1586
|
-
|
|
1587
|
-
##### typeNode
|
|
1588
|
-
|
|
1589
|
-
`TypeReferenceNode`
|
|
1590
|
-
|
|
1591
|
-
The Omit type reference.
|
|
1592
|
-
|
|
1593
|
-
#### Returns
|
|
1594
|
-
|
|
1595
|
-
`IJsonSchema` \| `undefined`
|
|
1596
|
-
|
|
1597
|
-
The mapped schema.
|
|
1598
|
-
|
|
1599
|
-
***
|
|
1600
|
-
|
|
1601
|
-
### mapExcludeUtilityType() {#mapexcludeutilitytype}
|
|
1602
|
-
|
|
1603
|
-
> `static` **mapExcludeUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1604
|
-
|
|
1605
|
-
Map Exclude<T, U> to a schema that removes U members from T.
|
|
1606
|
-
|
|
1607
|
-
#### Parameters
|
|
1608
|
-
|
|
1609
|
-
##### context
|
|
1610
|
-
|
|
1611
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1612
|
-
|
|
1613
|
-
The generation context.
|
|
1614
|
-
|
|
1615
|
-
##### typeNode
|
|
1616
|
-
|
|
1617
|
-
`TypeReferenceNode`
|
|
1618
|
-
|
|
1619
|
-
The Exclude type reference.
|
|
1620
|
-
|
|
1621
|
-
#### Returns
|
|
1622
|
-
|
|
1623
|
-
`IJsonSchema` \| `undefined`
|
|
1624
|
-
|
|
1625
|
-
The mapped schema.
|
|
1626
|
-
|
|
1627
|
-
***
|
|
1628
|
-
|
|
1629
|
-
### mapExtractUtilityType() {#mapextractutilitytype}
|
|
1630
|
-
|
|
1631
|
-
> `static` **mapExtractUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1632
|
-
|
|
1633
|
-
Map Extract<T, U> to a schema that keeps U members from T.
|
|
1634
|
-
|
|
1635
|
-
#### Parameters
|
|
1636
|
-
|
|
1637
|
-
##### context
|
|
1638
|
-
|
|
1639
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1640
|
-
|
|
1641
|
-
The generation context.
|
|
1642
|
-
|
|
1643
|
-
##### typeNode
|
|
1644
|
-
|
|
1645
|
-
`TypeReferenceNode`
|
|
1646
|
-
|
|
1647
|
-
The Extract type reference.
|
|
1648
|
-
|
|
1649
|
-
#### Returns
|
|
1650
|
-
|
|
1651
|
-
`IJsonSchema` \| `undefined`
|
|
1487
|
+
#### Throws
|
|
1652
1488
|
|
|
1653
|
-
|
|
1489
|
+
GeneralError when an extended type cannot be resolved to a schema.
|
|
1654
1490
|
|
|
1655
1491
|
***
|
|
1656
1492
|
|
|
1657
|
-
###
|
|
1493
|
+
### resolveRefinementUtilityBaseRef() {#resolverefinementutilitybaseref}
|
|
1658
1494
|
|
|
1659
|
-
> `static` **
|
|
1495
|
+
> `static` **resolveRefinementUtilityBaseRef**(`context`, `declaration`, `extendedType`): `IJsonSchema` \| `undefined`
|
|
1660
1496
|
|
|
1661
|
-
|
|
1497
|
+
Resolve a direct base reference for refinement Omit patterns in interface extends clauses.
|
|
1662
1498
|
|
|
1663
1499
|
#### Parameters
|
|
1664
1500
|
|
|
@@ -1668,45 +1504,23 @@ Map NonNullable<T> by removing null and undefined branches from T.
|
|
|
1668
1504
|
|
|
1669
1505
|
The generation context.
|
|
1670
1506
|
|
|
1671
|
-
#####
|
|
1672
|
-
|
|
1673
|
-
`TypeReferenceNode`
|
|
1674
|
-
|
|
1675
|
-
The NonNullable type reference.
|
|
1676
|
-
|
|
1677
|
-
#### Returns
|
|
1678
|
-
|
|
1679
|
-
`IJsonSchema` \| `undefined`
|
|
1680
|
-
|
|
1681
|
-
The mapped schema.
|
|
1682
|
-
|
|
1683
|
-
***
|
|
1684
|
-
|
|
1685
|
-
### mapRecordUtilityType() {#maprecordutilitytype}
|
|
1686
|
-
|
|
1687
|
-
> `static` **mapRecordUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1688
|
-
|
|
1689
|
-
Map Record<K, V> to an object schema with key constraints where possible.
|
|
1690
|
-
|
|
1691
|
-
#### Parameters
|
|
1692
|
-
|
|
1693
|
-
##### context
|
|
1507
|
+
##### declaration
|
|
1694
1508
|
|
|
1695
|
-
|
|
1509
|
+
`InterfaceDeclaration`
|
|
1696
1510
|
|
|
1697
|
-
The
|
|
1511
|
+
The interface declaration being mapped.
|
|
1698
1512
|
|
|
1699
|
-
#####
|
|
1513
|
+
##### extendedType
|
|
1700
1514
|
|
|
1701
|
-
`
|
|
1515
|
+
`ExpressionWithTypeArguments`
|
|
1702
1516
|
|
|
1703
|
-
The
|
|
1517
|
+
The heritage type being processed.
|
|
1704
1518
|
|
|
1705
1519
|
#### Returns
|
|
1706
1520
|
|
|
1707
1521
|
`IJsonSchema` \| `undefined`
|
|
1708
1522
|
|
|
1709
|
-
|
|
1523
|
+
A direct base reference when a refinement pattern is detected.
|
|
1710
1524
|
|
|
1711
1525
|
***
|
|
1712
1526
|
|
|
@@ -1754,56 +1568,6 @@ The extracted literal keys.
|
|
|
1754
1568
|
|
|
1755
1569
|
***
|
|
1756
1570
|
|
|
1757
|
-
### mapJsonLdObjectUtilityType() {#mapjsonldobjectutilitytype}
|
|
1758
|
-
|
|
1759
|
-
> `static` **mapJsonLdObjectUtilityType**(`context`, `typeNode`, `options`): `IJsonSchema` \| `undefined`
|
|
1760
|
-
|
|
1761
|
-
Map JsonLdObject utility types using key-removal and optional key-addition rules.
|
|
1762
|
-
|
|
1763
|
-
#### Parameters
|
|
1764
|
-
|
|
1765
|
-
##### context
|
|
1766
|
-
|
|
1767
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1768
|
-
|
|
1769
|
-
The generation context.
|
|
1770
|
-
|
|
1771
|
-
##### typeNode
|
|
1772
|
-
|
|
1773
|
-
`TypeReferenceNode`
|
|
1774
|
-
|
|
1775
|
-
The JsonLdObject utility type reference.
|
|
1776
|
-
|
|
1777
|
-
##### options
|
|
1778
|
-
|
|
1779
|
-
Mapping options.
|
|
1780
|
-
|
|
1781
|
-
###### keysToRemove
|
|
1782
|
-
|
|
1783
|
-
`string`[]
|
|
1784
|
-
|
|
1785
|
-
Keys to remove from the base schema.
|
|
1786
|
-
|
|
1787
|
-
###### keyToAdd?
|
|
1788
|
-
|
|
1789
|
-
`"type"` \| `"id"` \| `"@id"` \| `"@type"` \| `"@context"`
|
|
1790
|
-
|
|
1791
|
-
Optional key to add to the base schema.
|
|
1792
|
-
|
|
1793
|
-
###### isAddedKeyRequired?
|
|
1794
|
-
|
|
1795
|
-
`boolean`
|
|
1796
|
-
|
|
1797
|
-
Whether the added key should be required.
|
|
1798
|
-
|
|
1799
|
-
#### Returns
|
|
1800
|
-
|
|
1801
|
-
`IJsonSchema` \| `undefined`
|
|
1802
|
-
|
|
1803
|
-
The mapped schema.
|
|
1804
|
-
|
|
1805
|
-
***
|
|
1806
|
-
|
|
1807
1571
|
### mapJsonLdObjectDefaultSchemaByKey() {#mapjsonldobjectdefaultschemabykey}
|
|
1808
1572
|
|
|
1809
1573
|
> `static` **mapJsonLdObjectDefaultSchemaByKey**(`baseSchema`, `keyToAdd`): `IJsonSchema`
|
|
@@ -1938,62 +1702,6 @@ The resolved schema.
|
|
|
1938
1702
|
|
|
1939
1703
|
***
|
|
1940
1704
|
|
|
1941
|
-
### mapObjectOrArrayUtilityType() {#mapobjectorarrayutilitytype}
|
|
1942
|
-
|
|
1943
|
-
> `static` **mapObjectOrArrayUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1944
|
-
|
|
1945
|
-
Map ObjectOrArray<T> to a schema accepting T or T[].
|
|
1946
|
-
|
|
1947
|
-
#### Parameters
|
|
1948
|
-
|
|
1949
|
-
##### context
|
|
1950
|
-
|
|
1951
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1952
|
-
|
|
1953
|
-
The generation context.
|
|
1954
|
-
|
|
1955
|
-
##### typeNode
|
|
1956
|
-
|
|
1957
|
-
`TypeReferenceNode`
|
|
1958
|
-
|
|
1959
|
-
The ObjectOrArray type reference.
|
|
1960
|
-
|
|
1961
|
-
#### Returns
|
|
1962
|
-
|
|
1963
|
-
`IJsonSchema` \| `undefined`
|
|
1964
|
-
|
|
1965
|
-
The mapped schema.
|
|
1966
|
-
|
|
1967
|
-
***
|
|
1968
|
-
|
|
1969
|
-
### mapSingleOccurrenceArrayUtilityType() {#mapsingleoccurrencearrayutilitytype}
|
|
1970
|
-
|
|
1971
|
-
> `static` **mapSingleOccurrenceArrayUtilityType**(`context`, `typeNode`): `IJsonSchema` \| `undefined`
|
|
1972
|
-
|
|
1973
|
-
Map SingleOccurrenceArray<T, U> to a non-empty array containing exactly one U.
|
|
1974
|
-
|
|
1975
|
-
#### Parameters
|
|
1976
|
-
|
|
1977
|
-
##### context
|
|
1978
|
-
|
|
1979
|
-
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
1980
|
-
|
|
1981
|
-
The generation context.
|
|
1982
|
-
|
|
1983
|
-
##### typeNode
|
|
1984
|
-
|
|
1985
|
-
`TypeReferenceNode`
|
|
1986
|
-
|
|
1987
|
-
The SingleOccurrenceArray type reference.
|
|
1988
|
-
|
|
1989
|
-
#### Returns
|
|
1990
|
-
|
|
1991
|
-
`IJsonSchema` \| `undefined`
|
|
1992
|
-
|
|
1993
|
-
The mapped schema.
|
|
1994
|
-
|
|
1995
|
-
***
|
|
1996
|
-
|
|
1997
1705
|
### annotateUtilityInlineSchema() {#annotateutilityinlineschema}
|
|
1998
1706
|
|
|
1999
1707
|
> `static` **annotateUtilityInlineSchema**(`schema`, `baseTypeDescription`): `IJsonSchema`
|
|
@@ -26,22 +26,32 @@ Resolve mapped type output keys, including remapped key names via `as`.
|
|
|
26
26
|
|
|
27
27
|
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
28
28
|
|
|
29
|
+
The generation context.
|
|
30
|
+
|
|
29
31
|
##### typeNode
|
|
30
32
|
|
|
31
33
|
`MappedTypeNode`
|
|
32
34
|
|
|
35
|
+
The mapped type node.
|
|
36
|
+
|
|
33
37
|
##### mappedKeys
|
|
34
38
|
|
|
35
39
|
`string`[]
|
|
36
40
|
|
|
41
|
+
The resolved source keys from the mapped type constraint.
|
|
42
|
+
|
|
37
43
|
##### mappedTypeParameterName
|
|
38
44
|
|
|
39
45
|
`string`
|
|
40
46
|
|
|
47
|
+
The mapped type parameter identifier.
|
|
48
|
+
|
|
41
49
|
#### Returns
|
|
42
50
|
|
|
43
51
|
`object`[] \| `undefined`
|
|
44
52
|
|
|
53
|
+
The resolved source-to-output mapped key entries.
|
|
54
|
+
|
|
45
55
|
***
|
|
46
56
|
|
|
47
57
|
### resolveMappedTypeRemappedKey() {#resolvemappedtyperemappedkey}
|
|
@@ -56,22 +66,32 @@ Resolve a remapped mapped-type key expression for a concrete source key.
|
|
|
56
66
|
|
|
57
67
|
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
58
68
|
|
|
69
|
+
The generation context.
|
|
70
|
+
|
|
59
71
|
##### nameTypeNode
|
|
60
72
|
|
|
61
73
|
`TypeNode`
|
|
62
74
|
|
|
75
|
+
The mapped type name remapping expression node.
|
|
76
|
+
|
|
63
77
|
##### sourceKey
|
|
64
78
|
|
|
65
79
|
`string`
|
|
66
80
|
|
|
81
|
+
The concrete source key currently being evaluated.
|
|
82
|
+
|
|
67
83
|
##### mappedTypeParameterName
|
|
68
84
|
|
|
69
85
|
`string`
|
|
70
86
|
|
|
87
|
+
The mapped type parameter identifier.
|
|
88
|
+
|
|
71
89
|
#### Returns
|
|
72
90
|
|
|
73
91
|
`string` \| `null` \| `undefined`
|
|
74
92
|
|
|
93
|
+
The remapped key, null when excluded via never, or undefined when unresolved.
|
|
94
|
+
|
|
75
95
|
***
|
|
76
96
|
|
|
77
97
|
### evaluateMappedKeyExtendsCondition() {#evaluatemappedkeyextendscondition}
|
|
@@ -86,18 +106,26 @@ Evaluate whether a concrete mapped key satisfies an `extends` condition.
|
|
|
86
106
|
|
|
87
107
|
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
88
108
|
|
|
109
|
+
The generation context.
|
|
110
|
+
|
|
89
111
|
##### sourceKey
|
|
90
112
|
|
|
91
113
|
`string`
|
|
92
114
|
|
|
115
|
+
The concrete source key being evaluated.
|
|
116
|
+
|
|
93
117
|
##### extendsTypeNode
|
|
94
118
|
|
|
95
119
|
`TypeNode`
|
|
96
120
|
|
|
121
|
+
The extends condition type node.
|
|
122
|
+
|
|
97
123
|
#### Returns
|
|
98
124
|
|
|
99
125
|
`boolean` \| `undefined`
|
|
100
126
|
|
|
127
|
+
True when the key satisfies the condition, false when it does not, otherwise undefined.
|
|
128
|
+
|
|
101
129
|
***
|
|
102
130
|
|
|
103
131
|
### buildMappedTypeFallbackSchema() {#buildmappedtypefallbackschema}
|
|
@@ -112,26 +140,38 @@ Build a conservative fallback schema for mapped types whose key remapping cannot
|
|
|
112
140
|
|
|
113
141
|
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
114
142
|
|
|
143
|
+
The generation context.
|
|
144
|
+
|
|
115
145
|
##### typeNode
|
|
116
146
|
|
|
117
147
|
`MappedTypeNode`
|
|
118
148
|
|
|
149
|
+
The mapped type node.
|
|
150
|
+
|
|
119
151
|
##### mappedKeys
|
|
120
152
|
|
|
121
153
|
`string`[]
|
|
122
154
|
|
|
155
|
+
The resolved source keys from the mapped type constraint.
|
|
156
|
+
|
|
123
157
|
##### mappedTypeParameterName
|
|
124
158
|
|
|
125
159
|
`string`
|
|
126
160
|
|
|
161
|
+
The mapped type parameter identifier.
|
|
162
|
+
|
|
127
163
|
##### sourceObjectSchema?
|
|
128
164
|
|
|
129
165
|
`IJsonSchema`
|
|
130
166
|
|
|
167
|
+
The optional source object schema for property lookups.
|
|
168
|
+
|
|
131
169
|
#### Returns
|
|
132
170
|
|
|
133
171
|
`IJsonSchema`
|
|
134
172
|
|
|
173
|
+
The fallback mapped type schema.
|
|
174
|
+
|
|
135
175
|
***
|
|
136
176
|
|
|
137
177
|
### buildMappedTypeFallbackAdditionalProperties() {#buildmappedtypefallbackadditionalproperties}
|
|
@@ -146,26 +186,38 @@ Build fallback additionalProperties for unresolved mapped key remapping.
|
|
|
146
186
|
|
|
147
187
|
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
148
188
|
|
|
189
|
+
The generation context.
|
|
190
|
+
|
|
149
191
|
##### typeNode
|
|
150
192
|
|
|
151
193
|
`MappedTypeNode`
|
|
152
194
|
|
|
195
|
+
The mapped type node.
|
|
196
|
+
|
|
153
197
|
##### mappedKeys
|
|
154
198
|
|
|
155
199
|
`string`[]
|
|
156
200
|
|
|
201
|
+
The resolved source keys from the mapped type constraint.
|
|
202
|
+
|
|
157
203
|
##### mappedTypeParameterName
|
|
158
204
|
|
|
159
205
|
`string`
|
|
160
206
|
|
|
207
|
+
The mapped type parameter identifier.
|
|
208
|
+
|
|
161
209
|
##### sourceObjectSchema?
|
|
162
210
|
|
|
163
211
|
`IJsonSchema`
|
|
164
212
|
|
|
213
|
+
The optional source object schema for property lookups.
|
|
214
|
+
|
|
165
215
|
#### Returns
|
|
166
216
|
|
|
167
217
|
`IJsonSchema` \| `undefined`
|
|
168
218
|
|
|
219
|
+
The fallback additionalProperties schema.
|
|
220
|
+
|
|
169
221
|
***
|
|
170
222
|
|
|
171
223
|
### mergeMappedTypePropertySchemas() {#mergemappedtypepropertyschemas}
|
|
@@ -180,14 +232,20 @@ Merge mapped property schemas when multiple source keys remap to the same output
|
|
|
180
232
|
|
|
181
233
|
`IJsonSchema`
|
|
182
234
|
|
|
235
|
+
The existing schema already assigned to the mapped key.
|
|
236
|
+
|
|
183
237
|
##### nextSchema
|
|
184
238
|
|
|
185
239
|
`IJsonSchema`
|
|
186
240
|
|
|
241
|
+
The next schema to merge into the mapped key.
|
|
242
|
+
|
|
187
243
|
#### Returns
|
|
188
244
|
|
|
189
245
|
`IJsonSchema`
|
|
190
246
|
|
|
247
|
+
The merged schema.
|
|
248
|
+
|
|
191
249
|
***
|
|
192
250
|
|
|
193
251
|
### resolveMappedTypeSourceRequiredPropertyKeys() {#resolvemappedtypesourcerequiredpropertykeys}
|
|
@@ -202,10 +260,16 @@ Resolve required remapped keys from the source object's required key set.
|
|
|
202
260
|
|
|
203
261
|
`object`[]
|
|
204
262
|
|
|
263
|
+
The source-to-output mapped key entries.
|
|
264
|
+
|
|
205
265
|
##### sourceObjectSchema
|
|
206
266
|
|
|
207
267
|
`IJsonSchema`
|
|
208
268
|
|
|
269
|
+
The source object schema containing required keys.
|
|
270
|
+
|
|
209
271
|
#### Returns
|
|
210
272
|
|
|
211
273
|
`string`[] \| `undefined`
|
|
274
|
+
|
|
275
|
+
The required output keys.
|
|
@@ -16,7 +16,7 @@ Resolve TypeScript type declarations from package names.
|
|
|
16
16
|
|
|
17
17
|
### resolveTypeDeclarationAst() {#resolvetypedeclarationast}
|
|
18
18
|
|
|
19
|
-
> `static` **resolveTypeDeclarationAst**(`packageName`, `typeName`): \{ `sourceFile`: `SourceFile`; `declaration`: `InterfaceDeclaration` \| `TypeAliasDeclaration`; \} \| `undefined`
|
|
19
|
+
> `static` **resolveTypeDeclarationAst**(`packageName`, `typeName`, `containingFilePath?`): \{ `sourceFile`: `SourceFile`; `declaration`: `InterfaceDeclaration` \| `TypeAliasDeclaration`; \} \| `undefined`
|
|
20
20
|
|
|
21
21
|
Resolve a type declaration AST from a package and type name.
|
|
22
22
|
|
|
@@ -34,6 +34,17 @@ The package to inspect.
|
|
|
34
34
|
|
|
35
35
|
The type to resolve.
|
|
36
36
|
|
|
37
|
+
##### containingFilePath?
|
|
38
|
+
|
|
39
|
+
`string`
|
|
40
|
+
|
|
41
|
+
An optional source file path to use as the starting point for
|
|
42
|
+
package resolution. When provided, TypeScript module resolution walks up from that file's
|
|
43
|
+
directory, which allows transitive dependencies installed alongside the source file (e.g.
|
|
44
|
+
in a sub-directory node_modules) to be found even when they are not reachable from the
|
|
45
|
+
current working directory. The path is normalised to absolute before use;
|
|
46
|
+
falls back to process.cwd() when omitted.
|
|
47
|
+
|
|
37
48
|
#### Returns
|
|
38
49
|
|
|
39
50
|
\{ `sourceFile`: `SourceFile`; `declaration`: `InterfaceDeclaration` \| `TypeAliasDeclaration`; \} \| `undefined`
|