quicktype 18.0.6 → 19.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{cli/CompressedJSONFromStream.d.ts → CompressedJSONFromStream.d.ts} +1 -1
- package/dist/{cli/CompressedJSONFromStream.js → CompressedJSONFromStream.js} +2 -2
- package/dist/{cli/GraphQLIntrospection.d.ts → GraphQLIntrospection.d.ts} +0 -0
- package/dist/{cli/GraphQLIntrospection.js → GraphQLIntrospection.js} +1 -1
- package/dist/{cli/TypeSource.d.ts → TypeSource.d.ts} +2 -2
- package/dist/{cli/TypeSource.js → TypeSource.js} +0 -0
- package/dist/{cli/URLGrammar.d.ts → URLGrammar.d.ts} +0 -0
- package/dist/{cli/URLGrammar.js → URLGrammar.js} +1 -1
- package/dist/{cli/index.d.ts → index.d.ts} +1 -1
- package/dist/{cli/index.js → index.js} +4 -5
- package/package.json +61 -77
- package/dist/quicktype-core/Annotation.d.ts +0 -8
- package/dist/quicktype-core/Annotation.js +0 -16
- package/dist/quicktype-core/ConvenienceRenderer.d.ts +0 -138
- package/dist/quicktype-core/ConvenienceRenderer.js +0 -668
- package/dist/quicktype-core/DateTime.d.ts +0 -10
- package/dist/quicktype-core/DateTime.js +0 -57
- package/dist/quicktype-core/DeclarationIR.d.ts +0 -14
- package/dist/quicktype-core/DeclarationIR.js +0 -167
- package/dist/quicktype-core/EncodedMarkovChain.d.ts +0 -1
- package/dist/quicktype-core/EncodedMarkovChain.js +0 -4
- package/dist/quicktype-core/GatherNames.d.ts +0 -2
- package/dist/quicktype-core/GatherNames.js +0 -333
- package/dist/quicktype-core/Graph.d.ts +0 -12
- package/dist/quicktype-core/Graph.js +0 -220
- package/dist/quicktype-core/GraphRewriting.d.ts +0 -87
- package/dist/quicktype-core/GraphRewriting.js +0 -421
- package/dist/quicktype-core/MakeTransformations.d.ts +0 -4
- package/dist/quicktype-core/MakeTransformations.js +0 -193
- package/dist/quicktype-core/MarkovChain.d.ts +0 -15
- package/dist/quicktype-core/MarkovChain.js +0 -154
- package/dist/quicktype-core/Messages.d.ts +0 -294
- package/dist/quicktype-core/Messages.js +0 -105
- package/dist/quicktype-core/Naming.d.ts +0 -64
- package/dist/quicktype-core/Naming.js +0 -356
- package/dist/quicktype-core/Renderer.d.ts +0 -50
- package/dist/quicktype-core/Renderer.js +0 -274
- package/dist/quicktype-core/RendererOptions.d.ts +0 -71
- package/dist/quicktype-core/RendererOptions.js +0 -141
- package/dist/quicktype-core/Run.d.ts +0 -174
- package/dist/quicktype-core/Run.js +0 -393
- package/dist/quicktype-core/Source.d.ts +0 -65
- package/dist/quicktype-core/Source.js +0 -204
- package/dist/quicktype-core/TargetLanguage.d.ts +0 -34
- package/dist/quicktype-core/TargetLanguage.js +0 -66
- package/dist/quicktype-core/Transformers.d.ts +0 -209
- package/dist/quicktype-core/Transformers.js +0 -836
- package/dist/quicktype-core/Type.d.ts +0 -206
- package/dist/quicktype-core/Type.js +0 -716
- package/dist/quicktype-core/TypeBuilder.d.ts +0 -61
- package/dist/quicktype-core/TypeBuilder.js +0 -324
- package/dist/quicktype-core/TypeGraph.d.ts +0 -75
- package/dist/quicktype-core/TypeGraph.js +0 -420
- package/dist/quicktype-core/TypeUtils.d.ts +0 -33
- package/dist/quicktype-core/TypeUtils.js +0 -230
- package/dist/quicktype-core/UnifyClasses.d.ts +0 -16
- package/dist/quicktype-core/UnifyClasses.js +0 -159
- package/dist/quicktype-core/UnionBuilder.d.ts +0 -49
- package/dist/quicktype-core/UnionBuilder.js +0 -282
- package/dist/quicktype-core/attributes/AccessorNames.d.ts +0 -18
- package/dist/quicktype-core/attributes/AccessorNames.js +0 -182
- package/dist/quicktype-core/attributes/Constraints.d.ts +0 -38
- package/dist/quicktype-core/attributes/Constraints.js +0 -172
- package/dist/quicktype-core/attributes/Description.d.ts +0 -9
- package/dist/quicktype-core/attributes/Description.js +0 -97
- package/dist/quicktype-core/attributes/EnumValues.d.ts +0 -8
- package/dist/quicktype-core/attributes/EnumValues.js +0 -31
- package/dist/quicktype-core/attributes/StringTypes.d.ts +0 -28
- package/dist/quicktype-core/attributes/StringTypes.js +0 -189
- package/dist/quicktype-core/attributes/TypeAttributes.d.ts +0 -34
- package/dist/quicktype-core/attributes/TypeAttributes.js +0 -119
- package/dist/quicktype-core/attributes/TypeNames.d.ts +0 -46
- package/dist/quicktype-core/attributes/TypeNames.js +0 -274
- package/dist/quicktype-core/attributes/URIAttributes.d.ts +0 -8
- package/dist/quicktype-core/attributes/URIAttributes.js +0 -85
- package/dist/quicktype-core/index.d.ts +0 -48
- package/dist/quicktype-core/index.js +0 -180
- package/dist/quicktype-core/input/CompressedJSON.d.ts +0 -69
- package/dist/quicktype-core/input/CompressedJSON.js +0 -276
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.d.ts +0 -6
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +0 -18
- package/dist/quicktype-core/input/Inference.d.ts +0 -22
- package/dist/quicktype-core/input/Inference.js +0 -240
- package/dist/quicktype-core/input/Inputs.d.ts +0 -48
- package/dist/quicktype-core/input/Inputs.js +0 -145
- package/dist/quicktype-core/input/JSONSchemaInput.d.ts +0 -91
- package/dist/quicktype-core/input/JSONSchemaInput.js +0 -1041
- package/dist/quicktype-core/input/JSONSchemaStore.d.ts +0 -8
- package/dist/quicktype-core/input/JSONSchemaStore.js +0 -36
- package/dist/quicktype-core/input/PostmanCollection.d.ts +0 -5
- package/dist/quicktype-core/input/PostmanCollection.js +0 -60
- package/dist/quicktype-core/input/io/NodeIO.d.ts +0 -3
- package/dist/quicktype-core/input/io/NodeIO.js +0 -87
- package/dist/quicktype-core/input/io/get-stream/buffer-stream.d.ts +0 -2
- package/dist/quicktype-core/input/io/get-stream/buffer-stream.js +0 -45
- package/dist/quicktype-core/input/io/get-stream/index.d.ts +0 -9
- package/dist/quicktype-core/input/io/get-stream/index.js +0 -52
- package/dist/quicktype-core/language/All.d.ts +0 -3
- package/dist/quicktype-core/language/All.js +0 -57
- package/dist/quicktype-core/language/CPlusPlus.d.ts +0 -241
- package/dist/quicktype-core/language/CPlusPlus.js +0 -1847
- package/dist/quicktype-core/language/CSharp.d.ts +0 -201
- package/dist/quicktype-core/language/CSharp.js +0 -1850
- package/dist/quicktype-core/language/Crystal.d.ts +0 -37
- package/dist/quicktype-core/language/Crystal.js +0 -337
- package/dist/quicktype-core/language/Dart.d.ts +0 -66
- package/dist/quicktype-core/language/Dart.js +0 -576
- package/dist/quicktype-core/language/Elm.d.ts +0 -58
- package/dist/quicktype-core/language/Elm.js +0 -522
- package/dist/quicktype-core/language/Golang.d.ts +0 -51
- package/dist/quicktype-core/language/Golang.js +0 -460
- package/dist/quicktype-core/language/Haskell.d.ts +0 -56
- package/dist/quicktype-core/language/Haskell.js +0 -411
- package/dist/quicktype-core/language/JSONSchema.d.ts +0 -31
- package/dist/quicktype-core/language/JSONSchema.js +0 -169
- package/dist/quicktype-core/language/Java.d.ts +0 -125
- package/dist/quicktype-core/language/Java.js +0 -1081
- package/dist/quicktype-core/language/JavaScript.d.ts +0 -68
- package/dist/quicktype-core/language/JavaScript.js +0 -435
- package/dist/quicktype-core/language/JavaScriptPropTypes.d.ts +0 -40
- package/dist/quicktype-core/language/JavaScriptPropTypes.js +0 -213
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.d.ts +0 -2
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +0 -134
- package/dist/quicktype-core/language/Kotlin.d.ts +0 -109
- package/dist/quicktype-core/language/Kotlin.js +0 -832
- package/dist/quicktype-core/language/Objective-C.d.ts +0 -79
- package/dist/quicktype-core/language/Objective-C.js +0 -777
- package/dist/quicktype-core/language/Php.d.ts +0 -80
- package/dist/quicktype-core/language/Php.js +0 -702
- package/dist/quicktype-core/language/Pike.d.ts +0 -37
- package/dist/quicktype-core/language/Pike.js +0 -276
- package/dist/quicktype-core/language/Python.d.ts +0 -107
- package/dist/quicktype-core/language/Python.js +0 -969
- package/dist/quicktype-core/language/Rust.d.ts +0 -56
- package/dist/quicktype-core/language/Rust.js +0 -309
- package/dist/quicktype-core/language/Swift.d.ts +0 -96
- package/dist/quicktype-core/language/Swift.js +0 -1211
- package/dist/quicktype-core/language/TypeScriptFlow.d.ts +0 -77
- package/dist/quicktype-core/language/TypeScriptFlow.js +0 -286
- package/dist/quicktype-core/language/ruby/index.d.ts +0 -52
- package/dist/quicktype-core/language/ruby/index.js +0 -557
- package/dist/quicktype-core/language/ruby/keywords.d.ts +0 -3
- package/dist/quicktype-core/language/ruby/keywords.js +0 -358
- package/dist/quicktype-core/rewrites/CombineClasses.d.ts +0 -3
- package/dist/quicktype-core/rewrites/CombineClasses.js +0 -125
- package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +0 -4
- package/dist/quicktype-core/rewrites/ExpandStrings.js +0 -143
- package/dist/quicktype-core/rewrites/FlattenStrings.d.ts +0 -3
- package/dist/quicktype-core/rewrites/FlattenStrings.js +0 -45
- package/dist/quicktype-core/rewrites/FlattenUnions.d.ts +0 -3
- package/dist/quicktype-core/rewrites/FlattenUnions.js +0 -47
- package/dist/quicktype-core/rewrites/InferMaps.d.ts +0 -3
- package/dist/quicktype-core/rewrites/InferMaps.js +0 -117
- package/dist/quicktype-core/rewrites/ReplaceObjectType.d.ts +0 -3
- package/dist/quicktype-core/rewrites/ReplaceObjectType.js +0 -60
- package/dist/quicktype-core/rewrites/ResolveIntersections.d.ts +0 -3
- package/dist/quicktype-core/rewrites/ResolveIntersections.js +0 -244
- package/dist/quicktype-core/support/Acronyms.d.ts +0 -10
- package/dist/quicktype-core/support/Acronyms.js +0 -1128
- package/dist/quicktype-core/support/Chance.d.ts +0 -38
- package/dist/quicktype-core/support/Chance.js +0 -2146
- package/dist/quicktype-core/support/Converters.d.ts +0 -6
- package/dist/quicktype-core/support/Converters.js +0 -16
- package/dist/quicktype-core/support/Strings.d.ts +0 -44
- package/dist/quicktype-core/support/Strings.js +0 -525
- package/dist/quicktype-core/support/Support.d.ts +0 -29
- package/dist/quicktype-core/support/Support.js +0 -162
- package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +0 -645
- package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -39
- package/dist/quicktype-graphql-input/index.d.ts +0 -17
- package/dist/quicktype-graphql-input/index.js +0 -407
- package/dist/quicktype-typescript-input/index.d.ts +0 -2
- package/dist/quicktype-typescript-input/index.js +0 -98
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.gatherNames = void 0;
|
|
27
|
-
const pluralize = __importStar(require("pluralize"));
|
|
28
|
-
const collection_utils_1 = require("collection-utils");
|
|
29
|
-
const Type_1 = require("./Type");
|
|
30
|
-
const TypeUtils_1 = require("./TypeUtils");
|
|
31
|
-
const TypeNames_1 = require("./attributes/TypeNames");
|
|
32
|
-
const Support_1 = require("./support/Support");
|
|
33
|
-
const Transformers_1 = require("./Transformers");
|
|
34
|
-
class UniqueQueue {
|
|
35
|
-
_present = new Set();
|
|
36
|
-
_queue = [];
|
|
37
|
-
_front = 0;
|
|
38
|
-
get size() {
|
|
39
|
-
return this._queue.length - this._front;
|
|
40
|
-
}
|
|
41
|
-
get isEmpty() {
|
|
42
|
-
return this.size <= 0;
|
|
43
|
-
}
|
|
44
|
-
push(v) {
|
|
45
|
-
if (this._present.has(v))
|
|
46
|
-
return;
|
|
47
|
-
this._queue.push(v);
|
|
48
|
-
this._present.add(v);
|
|
49
|
-
}
|
|
50
|
-
unshift() {
|
|
51
|
-
(0, Support_1.assert)(!this.isEmpty, "Trying to unshift from an empty queue");
|
|
52
|
-
const v = this._queue[this._front];
|
|
53
|
-
if (v === undefined) {
|
|
54
|
-
return (0, Support_1.panic)("Value should have been present in queue");
|
|
55
|
-
}
|
|
56
|
-
this._queue[this._front] = undefined;
|
|
57
|
-
this._front += 1;
|
|
58
|
-
this._present.delete(v);
|
|
59
|
-
if (this._front > this.size) {
|
|
60
|
-
this._queue = this._queue.slice(this._front);
|
|
61
|
-
this._front = 0;
|
|
62
|
-
}
|
|
63
|
-
return v;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// `gatherNames` infers names from given names and property names.
|
|
67
|
-
//
|
|
68
|
-
// 1. Propagate type and property names down to children. Let's say
|
|
69
|
-
// we start with JSON like this, and we name the top-level `TopLevel`:
|
|
70
|
-
//
|
|
71
|
-
// {
|
|
72
|
-
// "foos": [ [ { "bar": 123 } ] ]
|
|
73
|
-
// }
|
|
74
|
-
//
|
|
75
|
-
// We use a work-list algorithm to first add the name `TopLevel` to
|
|
76
|
-
// the outermost class type. Then we propagate the property name
|
|
77
|
-
// `foos` to the outer array, which in turn propagates its singular
|
|
78
|
-
// `foo` to the inner array type. That tries to singularize `foo`,
|
|
79
|
-
// but it's already singular, so `foo` is added as a name for the
|
|
80
|
-
// inner class. We also then add `bar` to the name of the integer
|
|
81
|
-
// type.
|
|
82
|
-
//
|
|
83
|
-
// 2. Add "ancestor" alternatives and some "direct" alternatives.
|
|
84
|
-
// Direct alternatives are those that don't contain any ancestor
|
|
85
|
-
// names, whereas ancestor alternatives do. What we do here is add
|
|
86
|
-
// names of the form `TopLevel_foo` and `TopLevel_foo_class` as
|
|
87
|
-
// ancestor alternatives to the inner class, and `foo_element` as
|
|
88
|
-
// a direct alternative, the latter because it's an element in an
|
|
89
|
-
// array.
|
|
90
|
-
//
|
|
91
|
-
// 3. Add more direct alternatives to the type names. The reason we're
|
|
92
|
-
// doing this separately from step 2 is because step 2 only requires
|
|
93
|
-
// iterating over the types, wheras this step iterates over
|
|
94
|
-
// ancestor/descendant relationships. In this case we would add
|
|
95
|
-
// `TopLevel_class`, and `foo_class` to the outer and inner classes,
|
|
96
|
-
// respectively. We do similar stuff for all the other types.
|
|
97
|
-
//
|
|
98
|
-
// 4. For each type, set its inferred names to what we gathered in
|
|
99
|
-
// step 1, and its alternatives to a union of its direct and ancestor
|
|
100
|
-
// alternatives, gathered in steps 2 and 3.
|
|
101
|
-
function gatherNames(graph, destructive, debugPrint) {
|
|
102
|
-
function setNames(t, tn) {
|
|
103
|
-
graph.attributeStore.set(TypeNames_1.namesTypeAttributeKind, t, tn);
|
|
104
|
-
}
|
|
105
|
-
if (destructive) {
|
|
106
|
-
for (const t of graph.allTypesUnordered()) {
|
|
107
|
-
if (t.hasNames) {
|
|
108
|
-
setNames(t, t.getNames().clearInferred());
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const queue = new UniqueQueue();
|
|
113
|
-
// null means there are too many
|
|
114
|
-
const namesForType = new Map();
|
|
115
|
-
function addNames(t, names) {
|
|
116
|
-
// Always use the type's given names if it has some
|
|
117
|
-
if (t.hasNames) {
|
|
118
|
-
const originalNames = t.getNames();
|
|
119
|
-
if (!originalNames.areInferred) {
|
|
120
|
-
names = originalNames.names;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const oldNames = namesForType.get(t);
|
|
124
|
-
if (oldNames === null)
|
|
125
|
-
return;
|
|
126
|
-
let newNames;
|
|
127
|
-
if (oldNames === undefined) {
|
|
128
|
-
newNames = names;
|
|
129
|
-
}
|
|
130
|
-
else if (names === null) {
|
|
131
|
-
newNames = null;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
newNames = (0, collection_utils_1.setUnion)(oldNames, names);
|
|
135
|
-
}
|
|
136
|
-
if (newNames !== null && newNames.size >= TypeNames_1.tooManyNamesThreshold) {
|
|
137
|
-
newNames = null;
|
|
138
|
-
}
|
|
139
|
-
namesForType.set(t, newNames);
|
|
140
|
-
const transformation = (0, Transformers_1.transformationForType)(t);
|
|
141
|
-
if (transformation !== undefined) {
|
|
142
|
-
addNames(transformation.targetType, names);
|
|
143
|
-
}
|
|
144
|
-
if (oldNames !== undefined && newNames !== null) {
|
|
145
|
-
if (oldNames.size === newNames.size) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else if (oldNames === newNames) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
queue.push(t);
|
|
153
|
-
}
|
|
154
|
-
for (const [name, t] of graph.topLevels) {
|
|
155
|
-
addNames(t, new Set([name]));
|
|
156
|
-
}
|
|
157
|
-
while (!queue.isEmpty) {
|
|
158
|
-
const t = queue.unshift();
|
|
159
|
-
const names = (0, Support_1.defined)(namesForType.get(t));
|
|
160
|
-
if (t instanceof Type_1.ObjectType) {
|
|
161
|
-
const properties = t.getSortedProperties();
|
|
162
|
-
for (const [propertyName, property] of properties) {
|
|
163
|
-
addNames(property.type, new Set([propertyName]));
|
|
164
|
-
}
|
|
165
|
-
const values = t.getAdditionalProperties();
|
|
166
|
-
if (values !== undefined) {
|
|
167
|
-
addNames(values, names === null ? null : (0, collection_utils_1.setMap)(names, pluralize.singular));
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
(0, TypeUtils_1.matchCompoundType)(t, arrayType => {
|
|
172
|
-
addNames(arrayType.items, names === null ? null : (0, collection_utils_1.setMap)(names, pluralize.singular));
|
|
173
|
-
}, _classType => (0, Support_1.panic)("We handled this above"), _mapType => (0, Support_1.panic)("We handled this above"), _objectType => (0, Support_1.panic)("We handled this above"), unionType => {
|
|
174
|
-
const members = (0, collection_utils_1.setSortBy)(unionType.members, member => member.kind);
|
|
175
|
-
for (const memberType of members) {
|
|
176
|
-
addNames(memberType, names);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (debugPrint) {
|
|
182
|
-
for (const t of graph.allTypesUnordered()) {
|
|
183
|
-
const names = namesForType.get(t);
|
|
184
|
-
if (names === undefined)
|
|
185
|
-
return;
|
|
186
|
-
const index = t.index;
|
|
187
|
-
console.log(`${index}: ${names === null ? "*** too many ***" : Array.from(names).join(" ")}`);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
// null means there are too many
|
|
191
|
-
const directAlternativesForType = new Map();
|
|
192
|
-
const ancestorAlternativesForType = new Map();
|
|
193
|
-
const pairsProcessed = new Map();
|
|
194
|
-
function addAlternatives(existing, alternatives) {
|
|
195
|
-
if (alternatives.length === 0) {
|
|
196
|
-
return existing;
|
|
197
|
-
}
|
|
198
|
-
if (existing === undefined) {
|
|
199
|
-
existing = new Set();
|
|
200
|
-
}
|
|
201
|
-
existing = (0, collection_utils_1.setUnion)(existing, alternatives);
|
|
202
|
-
if (existing.size < TypeNames_1.tooManyNamesThreshold) {
|
|
203
|
-
return existing;
|
|
204
|
-
}
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
function processType(ancestor, t, alternativeSuffix) {
|
|
208
|
-
const names = (0, Support_1.defined)(namesForType.get(t));
|
|
209
|
-
let processedEntry = pairsProcessed.get(ancestor);
|
|
210
|
-
if (processedEntry === undefined)
|
|
211
|
-
processedEntry = new Set();
|
|
212
|
-
if (processedEntry.has(t))
|
|
213
|
-
return;
|
|
214
|
-
processedEntry.add(t);
|
|
215
|
-
pairsProcessed.set(ancestor, processedEntry);
|
|
216
|
-
const transformation = (0, Transformers_1.transformationForType)(t);
|
|
217
|
-
if (transformation !== undefined) {
|
|
218
|
-
processType(ancestor, transformation.targetType, alternativeSuffix);
|
|
219
|
-
}
|
|
220
|
-
let ancestorAlternatives = ancestorAlternativesForType.get(t);
|
|
221
|
-
let directAlternatives = directAlternativesForType.get(t);
|
|
222
|
-
if (names === null) {
|
|
223
|
-
ancestorAlternatives = null;
|
|
224
|
-
directAlternatives = null;
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
if (ancestor !== undefined && ancestorAlternatives !== null) {
|
|
228
|
-
const ancestorNames = namesForType.get(ancestor);
|
|
229
|
-
if (ancestorNames === null) {
|
|
230
|
-
ancestorAlternatives = null;
|
|
231
|
-
}
|
|
232
|
-
else if (ancestorNames !== undefined) {
|
|
233
|
-
const alternatives = [];
|
|
234
|
-
for (const name of names) {
|
|
235
|
-
alternatives.push(...Array.from(ancestorNames).map(an => `${an}_${name}`));
|
|
236
|
-
// FIXME: add alternatives with the suffix here, too?
|
|
237
|
-
alternatives.push(...Array.from(ancestorNames).map(an => `${an}_${name}_${t.kind}`));
|
|
238
|
-
// FIXME: add alternatives with the suffix here, too?
|
|
239
|
-
}
|
|
240
|
-
ancestorAlternatives = addAlternatives(ancestorAlternatives, alternatives);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
if (alternativeSuffix !== undefined && directAlternatives !== null) {
|
|
244
|
-
const alternatives = [];
|
|
245
|
-
for (const name of names) {
|
|
246
|
-
// FIXME: we should only add these for names we couldn't singularize
|
|
247
|
-
alternatives.push(`${name}_${alternativeSuffix}`);
|
|
248
|
-
}
|
|
249
|
-
directAlternatives = addAlternatives(directAlternatives, alternatives);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (ancestorAlternatives !== undefined) {
|
|
253
|
-
ancestorAlternativesForType.set(t, ancestorAlternatives);
|
|
254
|
-
}
|
|
255
|
-
if (directAlternatives !== undefined) {
|
|
256
|
-
directAlternativesForType.set(t, directAlternatives);
|
|
257
|
-
}
|
|
258
|
-
if (t instanceof Type_1.ObjectType) {
|
|
259
|
-
const properties = t.getSortedProperties();
|
|
260
|
-
for (const [, property] of properties) {
|
|
261
|
-
processType(t, property.type, undefined);
|
|
262
|
-
}
|
|
263
|
-
const values = t.getAdditionalProperties();
|
|
264
|
-
if (values !== undefined) {
|
|
265
|
-
processType(properties.size === 0 ? ancestor : t, values, "value");
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
(0, TypeUtils_1.matchCompoundType)(t, arrayType => {
|
|
270
|
-
processType(ancestor, arrayType.items, "element");
|
|
271
|
-
}, _classType => (0, Support_1.panic)("We handled this above"), _mapType => (0, Support_1.panic)("We handled this above"), _objectType => (0, Support_1.panic)("We handled this above"), unionType => {
|
|
272
|
-
const members = (0, collection_utils_1.setSortBy)(unionType.members, member => member.kind);
|
|
273
|
-
const unionHasGivenName = unionType.hasNames && !unionType.getNames().areInferred;
|
|
274
|
-
const unionIsAncestor = unionHasGivenName || (0, TypeUtils_1.nullableFromUnion)(unionType) === null;
|
|
275
|
-
const ancestorForMembers = unionIsAncestor ? unionType : ancestor;
|
|
276
|
-
for (const memberType of members) {
|
|
277
|
-
processType(ancestorForMembers, memberType, undefined);
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
for (const [, t] of graph.topLevels) {
|
|
283
|
-
processType(undefined, t, undefined);
|
|
284
|
-
}
|
|
285
|
-
for (const t of graph.allTypesUnordered()) {
|
|
286
|
-
const names = namesForType.get(t);
|
|
287
|
-
if (names === undefined)
|
|
288
|
-
continue;
|
|
289
|
-
if (names === null) {
|
|
290
|
-
directAlternativesForType.set(t, null);
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
let alternatives = directAlternativesForType.get(t);
|
|
294
|
-
if (alternatives === null)
|
|
295
|
-
continue;
|
|
296
|
-
if (alternatives === undefined) {
|
|
297
|
-
alternatives = new Set();
|
|
298
|
-
}
|
|
299
|
-
alternatives = (0, collection_utils_1.setUnion)(alternatives, (0, collection_utils_1.setMap)(names, name => `${name}_${t.kind}`));
|
|
300
|
-
directAlternativesForType.set(t, alternatives);
|
|
301
|
-
}
|
|
302
|
-
for (const t of graph.allTypesUnordered()) {
|
|
303
|
-
const names = namesForType.get(t);
|
|
304
|
-
if (names === undefined)
|
|
305
|
-
continue;
|
|
306
|
-
let typeNames;
|
|
307
|
-
if (names === null) {
|
|
308
|
-
typeNames = new TypeNames_1.TooManyTypeNames(1);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
const ancestorAlternatives = ancestorAlternativesForType.get(t);
|
|
312
|
-
const directAlternatives = directAlternativesForType.get(t);
|
|
313
|
-
let alternatives;
|
|
314
|
-
if (ancestorAlternatives === null && directAlternatives === null) {
|
|
315
|
-
alternatives = undefined;
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
if (directAlternatives !== null && directAlternatives !== undefined) {
|
|
319
|
-
alternatives = directAlternatives;
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
alternatives = new Set();
|
|
323
|
-
}
|
|
324
|
-
if (ancestorAlternatives !== null && ancestorAlternatives !== undefined) {
|
|
325
|
-
alternatives = (0, collection_utils_1.setUnion)(alternatives, ancestorAlternatives);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
typeNames = TypeNames_1.TypeNames.makeWithDistance(names, alternatives, destructive ? 1 : 10);
|
|
329
|
-
}
|
|
330
|
-
setNames(t, t.hasNames ? t.getNames().add([typeNames]) : typeNames);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
exports.gatherNames = gatherNames;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare class Graph<T> {
|
|
2
|
-
private readonly _nodes;
|
|
3
|
-
private readonly _indexByNode;
|
|
4
|
-
private readonly _successors;
|
|
5
|
-
constructor(nodes: Iterable<T>, invertDirection: boolean, edges: number[][] | ((node: T) => ReadonlySet<T>));
|
|
6
|
-
get size(): number;
|
|
7
|
-
get nodes(): ReadonlyArray<T>;
|
|
8
|
-
findRoots(): ReadonlySet<T>;
|
|
9
|
-
dfsTraversal(root: T, preOrder: boolean, process: (node: T) => void): void;
|
|
10
|
-
stronglyConnectedComponents(): Graph<ReadonlySet<T>>;
|
|
11
|
-
makeDot(includeNode: (n: T) => boolean, nodeLabel: (n: T) => string): string;
|
|
12
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Graph = void 0;
|
|
4
|
-
const collection_utils_1 = require("collection-utils");
|
|
5
|
-
const Support_1 = require("./support/Support");
|
|
6
|
-
function countComponentGraphNodes(components) {
|
|
7
|
-
if (components.length === 0)
|
|
8
|
-
return 0;
|
|
9
|
-
let largest = -1;
|
|
10
|
-
let count = 0;
|
|
11
|
-
for (const c of components) {
|
|
12
|
-
(0, Support_1.assert)(c.length > 0, "Empty component not allowed");
|
|
13
|
-
for (const v of c) {
|
|
14
|
-
(0, Support_1.assert)(v >= 0, "Negative vertex index is invalid");
|
|
15
|
-
largest = Math.max(largest, v);
|
|
16
|
-
count += 1;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
(0, Support_1.assert)(largest + 1 === count, "Vertex indexes and count don't match up");
|
|
20
|
-
return count;
|
|
21
|
-
}
|
|
22
|
-
// https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
|
|
23
|
-
function stronglyConnectedComponents(successors) {
|
|
24
|
-
let index = 0;
|
|
25
|
-
const stack = [];
|
|
26
|
-
const numNodes = successors.length;
|
|
27
|
-
const indexes = (0, Support_1.repeated)(numNodes, -1);
|
|
28
|
-
const lowLinks = (0, Support_1.repeated)(numNodes, -1);
|
|
29
|
-
const onStack = (0, Support_1.repeated)(numNodes, false);
|
|
30
|
-
const sccs = [];
|
|
31
|
-
function strongconnect(v) {
|
|
32
|
-
// Set the depth index for v to the smallest unused index
|
|
33
|
-
indexes[v] = index;
|
|
34
|
-
lowLinks[v] = index;
|
|
35
|
-
index += 1;
|
|
36
|
-
stack.push(v);
|
|
37
|
-
onStack[v] = true;
|
|
38
|
-
// Consider successors of v
|
|
39
|
-
for (const w of successors[v]) {
|
|
40
|
-
if (indexes[w] < 0) {
|
|
41
|
-
// Successor w has not yet been visited; recurse on it
|
|
42
|
-
strongconnect(w);
|
|
43
|
-
lowLinks[v] = Math.min(lowLinks[v], lowLinks[w]);
|
|
44
|
-
}
|
|
45
|
-
else if (onStack[w]) {
|
|
46
|
-
// Successor w is in stack and hence in the current SCC
|
|
47
|
-
// If w is not on stack, then (v, w) is a cross-edge in the DFS tree and must be ignored
|
|
48
|
-
// Note: The next line may look odd - but is correct.
|
|
49
|
-
// It says w.index not w.lowlink; that is deliberate and from the original paper
|
|
50
|
-
lowLinks[v] = Math.min(lowLinks[v], indexes[w]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// If v is a root node, pop the stack and generate an SCC
|
|
54
|
-
if (lowLinks[v] === indexes[v]) {
|
|
55
|
-
const scc = [];
|
|
56
|
-
let w;
|
|
57
|
-
do {
|
|
58
|
-
w = (0, Support_1.defined)(stack.pop());
|
|
59
|
-
onStack[w] = false;
|
|
60
|
-
scc.push(w);
|
|
61
|
-
} while (w !== v);
|
|
62
|
-
sccs.push(scc);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
for (let v = 0; v < numNodes; v++) {
|
|
66
|
-
if (indexes[v] < 0) {
|
|
67
|
-
strongconnect(v);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
(0, Support_1.assert)(countComponentGraphNodes(sccs) === numNodes, "We didn't put all the nodes into SCCs");
|
|
71
|
-
return sccs;
|
|
72
|
-
}
|
|
73
|
-
function buildComponentOfNodeMap(successors, components) {
|
|
74
|
-
const numComponents = components.length;
|
|
75
|
-
const numNodes = successors.length;
|
|
76
|
-
(0, Support_1.assert)(numNodes === countComponentGraphNodes(components), "Components don't match up with graph");
|
|
77
|
-
const componentOfNode = (0, Support_1.repeated)(numNodes, -1);
|
|
78
|
-
for (let c = 0; c < numComponents; c++) {
|
|
79
|
-
for (const n of components[c]) {
|
|
80
|
-
(0, Support_1.assert)(componentOfNode[n] < 0, "We have a node that's in two components");
|
|
81
|
-
componentOfNode[n] = c;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return componentOfNode;
|
|
85
|
-
}
|
|
86
|
-
function buildMetaSuccessors(successors, components) {
|
|
87
|
-
const numComponents = components.length;
|
|
88
|
-
const componentOfNode = buildComponentOfNodeMap(successors, components);
|
|
89
|
-
const componentAdded = (0, Support_1.repeated)(numComponents, false);
|
|
90
|
-
const metaSuccessors = [];
|
|
91
|
-
for (let c = 0; c < numComponents; c++) {
|
|
92
|
-
const succ = [];
|
|
93
|
-
for (const n of components[c]) {
|
|
94
|
-
for (const s of successors[n]) {
|
|
95
|
-
const ms = componentOfNode[s];
|
|
96
|
-
if (ms === c || componentAdded[ms])
|
|
97
|
-
continue;
|
|
98
|
-
succ.push(ms);
|
|
99
|
-
componentAdded[ms] = true;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// reset bookkeeping
|
|
103
|
-
for (const ms of succ) {
|
|
104
|
-
(0, Support_1.assert)(componentAdded[ms]);
|
|
105
|
-
componentAdded[ms] = false;
|
|
106
|
-
}
|
|
107
|
-
metaSuccessors.push(succ);
|
|
108
|
-
}
|
|
109
|
-
return metaSuccessors;
|
|
110
|
-
}
|
|
111
|
-
function invertEdges(successors) {
|
|
112
|
-
const numNodes = successors.length;
|
|
113
|
-
const predecessors = (0, Support_1.repeatedCall)(numNodes, () => []);
|
|
114
|
-
for (let s = 0; s < numNodes; s++) {
|
|
115
|
-
for (const v of successors[s]) {
|
|
116
|
-
predecessors[v].push(s);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return predecessors;
|
|
120
|
-
}
|
|
121
|
-
function calculateInDegrees(successors) {
|
|
122
|
-
const numNodes = successors.length;
|
|
123
|
-
const inDegrees = (0, Support_1.repeated)(numNodes, 0);
|
|
124
|
-
for (const s of successors) {
|
|
125
|
-
for (const v of s) {
|
|
126
|
-
inDegrees[v] += 1;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return inDegrees;
|
|
130
|
-
}
|
|
131
|
-
function findRoots(successors) {
|
|
132
|
-
const numNodes = successors.length;
|
|
133
|
-
const inDegrees = calculateInDegrees(successors);
|
|
134
|
-
const roots = [];
|
|
135
|
-
for (let v = 0; v < numNodes; v++) {
|
|
136
|
-
if (inDegrees[v] === 0) {
|
|
137
|
-
roots.push(v);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return roots;
|
|
141
|
-
}
|
|
142
|
-
class Graph {
|
|
143
|
-
_nodes;
|
|
144
|
-
_indexByNode;
|
|
145
|
-
_successors;
|
|
146
|
-
constructor(nodes, invertDirection, edges) {
|
|
147
|
-
this._nodes = Array.from(nodes);
|
|
148
|
-
this._indexByNode = new Map(this._nodes.map((n, i) => [n, i]));
|
|
149
|
-
let edgesArray;
|
|
150
|
-
if (Array.isArray(edges)) {
|
|
151
|
-
edgesArray = edges;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
edgesArray = this._nodes.map(n => Array.from(edges(n)).map(s => (0, Support_1.defined)(this._indexByNode.get(s))));
|
|
155
|
-
}
|
|
156
|
-
if (invertDirection) {
|
|
157
|
-
edgesArray = invertEdges(edgesArray);
|
|
158
|
-
}
|
|
159
|
-
this._successors = edgesArray;
|
|
160
|
-
}
|
|
161
|
-
get size() {
|
|
162
|
-
return this._nodes.length;
|
|
163
|
-
}
|
|
164
|
-
get nodes() {
|
|
165
|
-
return this._nodes;
|
|
166
|
-
}
|
|
167
|
-
findRoots() {
|
|
168
|
-
const roots = findRoots(this._successors);
|
|
169
|
-
return new Set(roots.map(n => this._nodes[n]));
|
|
170
|
-
}
|
|
171
|
-
// The subgraph starting at `root` must be acyclic.
|
|
172
|
-
dfsTraversal(root, preOrder, process) {
|
|
173
|
-
const visited = (0, Support_1.repeated)(this.size, false);
|
|
174
|
-
const visit = (v) => {
|
|
175
|
-
if (visited[v])
|
|
176
|
-
return;
|
|
177
|
-
visited[v] = true;
|
|
178
|
-
if (preOrder) {
|
|
179
|
-
process(this._nodes[v]);
|
|
180
|
-
}
|
|
181
|
-
for (const w of this._successors[v]) {
|
|
182
|
-
visit(w);
|
|
183
|
-
}
|
|
184
|
-
if (!preOrder) {
|
|
185
|
-
process(this._nodes[v]);
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
visit((0, Support_1.defined)(this._indexByNode.get(root)));
|
|
189
|
-
}
|
|
190
|
-
stronglyConnectedComponents() {
|
|
191
|
-
const components = stronglyConnectedComponents(this._successors);
|
|
192
|
-
const componentSuccessors = buildMetaSuccessors(this._successors, components);
|
|
193
|
-
return new Graph(components.map(ns => (0, collection_utils_1.setMap)(ns, n => this._nodes[n])), false, componentSuccessors);
|
|
194
|
-
}
|
|
195
|
-
makeDot(includeNode, nodeLabel) {
|
|
196
|
-
const lines = [];
|
|
197
|
-
lines.push("digraph G {");
|
|
198
|
-
lines.push(" ordering = out;");
|
|
199
|
-
lines.push("");
|
|
200
|
-
for (let i = 0; i < this.size; i++) {
|
|
201
|
-
const n = this._nodes[i];
|
|
202
|
-
if (!includeNode(n))
|
|
203
|
-
continue;
|
|
204
|
-
lines.push(` node${i} [label="${nodeLabel(n)}"];`);
|
|
205
|
-
}
|
|
206
|
-
for (let i = 0; i < this.size; i++) {
|
|
207
|
-
if (!includeNode(this._nodes[i]))
|
|
208
|
-
continue;
|
|
209
|
-
for (const j of this._successors[i]) {
|
|
210
|
-
if (!includeNode(this._nodes[j]))
|
|
211
|
-
continue;
|
|
212
|
-
lines.push(` node${i} -> node${j};`);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
lines.push("}");
|
|
216
|
-
lines.push("");
|
|
217
|
-
return lines.join("\n");
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
exports.Graph = Graph;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { PrimitiveTypeKind, Type, ClassProperty, MaybeTypeIdentity } from "./Type";
|
|
2
|
-
import { TypeGraph, TypeRef } from "./TypeGraph";
|
|
3
|
-
import { TypeAttributes } from "./attributes/TypeAttributes";
|
|
4
|
-
import { TypeBuilder, StringTypeMapping } from "./TypeBuilder";
|
|
5
|
-
export interface TypeLookerUp {
|
|
6
|
-
lookupTypeRefs(typeRefs: TypeRef[], forwardingRef?: TypeRef): TypeRef | undefined;
|
|
7
|
-
reconstituteTypeRef(typeRef: TypeRef, attributes?: TypeAttributes, forwardingRef?: TypeRef): TypeRef;
|
|
8
|
-
}
|
|
9
|
-
export declare class TypeReconstituter<TBuilder extends BaseGraphRewriteBuilder> {
|
|
10
|
-
private readonly _typeBuilder;
|
|
11
|
-
private readonly _makeClassUnique;
|
|
12
|
-
private readonly _typeAttributes;
|
|
13
|
-
private readonly _forwardingRef;
|
|
14
|
-
private readonly _register;
|
|
15
|
-
private _wasUsed;
|
|
16
|
-
private _typeRef;
|
|
17
|
-
constructor(_typeBuilder: TBuilder, _makeClassUnique: boolean, _typeAttributes: TypeAttributes, _forwardingRef: TypeRef | undefined, _register: (tref: TypeRef) => void);
|
|
18
|
-
private builderForNewType;
|
|
19
|
-
private builderForSetting;
|
|
20
|
-
getResult(): TypeRef;
|
|
21
|
-
private register;
|
|
22
|
-
private registerAndAddAttributes;
|
|
23
|
-
lookup(tref: TypeRef): TypeRef | undefined;
|
|
24
|
-
lookup(trefs: Iterable<TypeRef>): ReadonlyArray<TypeRef> | undefined;
|
|
25
|
-
lookupMap<K>(trefs: ReadonlyMap<K, TypeRef>): ReadonlyMap<K, TypeRef> | undefined;
|
|
26
|
-
reconstitute(tref: TypeRef): TypeRef;
|
|
27
|
-
reconstitute(trefs: Iterable<TypeRef>): ReadonlyArray<TypeRef>;
|
|
28
|
-
reconstituteMap<K>(trefs: ReadonlyMap<K, TypeRef>): ReadonlyMap<K, TypeRef>;
|
|
29
|
-
getPrimitiveType(kind: PrimitiveTypeKind): void;
|
|
30
|
-
getEnumType(cases: ReadonlySet<string>): void;
|
|
31
|
-
getUniqueMapType(): void;
|
|
32
|
-
getMapType(values: TypeRef): void;
|
|
33
|
-
getUniqueArrayType(): void;
|
|
34
|
-
getArrayType(items: TypeRef): void;
|
|
35
|
-
setArrayItems(items: TypeRef): void;
|
|
36
|
-
makeClassProperty(tref: TypeRef, isOptional: boolean): ClassProperty;
|
|
37
|
-
getObjectType(properties: ReadonlyMap<string, ClassProperty>, additionalProperties: TypeRef | undefined): void;
|
|
38
|
-
getUniqueObjectType(properties: ReadonlyMap<string, ClassProperty> | undefined, additionalProperties: TypeRef | undefined): void;
|
|
39
|
-
getClassType(properties: ReadonlyMap<string, ClassProperty>): void;
|
|
40
|
-
getUniqueClassType(isFixed: boolean, properties: ReadonlyMap<string, ClassProperty> | undefined): void;
|
|
41
|
-
setObjectProperties(properties: ReadonlyMap<string, ClassProperty>, additionalProperties: TypeRef | undefined): void;
|
|
42
|
-
getUnionType(members: ReadonlySet<TypeRef>): void;
|
|
43
|
-
getUniqueUnionType(): void;
|
|
44
|
-
getIntersectionType(members: ReadonlySet<TypeRef>): void;
|
|
45
|
-
getUniqueIntersectionType(members?: ReadonlySet<TypeRef>): void;
|
|
46
|
-
setSetOperationMembers(members: ReadonlySet<TypeRef>): void;
|
|
47
|
-
}
|
|
48
|
-
export declare abstract class BaseGraphRewriteBuilder extends TypeBuilder implements TypeLookerUp {
|
|
49
|
-
readonly originalGraph: TypeGraph;
|
|
50
|
-
protected readonly debugPrint: boolean;
|
|
51
|
-
protected readonly reconstitutedTypes: Map<number, TypeRef>;
|
|
52
|
-
private _lostTypeAttributes;
|
|
53
|
-
private _printIndent;
|
|
54
|
-
constructor(originalGraph: TypeGraph, stringTypeMapping: StringTypeMapping, alphabetizeProperties: boolean, graphHasProvenanceAttributes: boolean, debugPrint: boolean);
|
|
55
|
-
withForwardingRef(maybeForwardingRef: TypeRef | undefined, typeCreator: (forwardingRef: TypeRef) => TypeRef): TypeRef;
|
|
56
|
-
reconstituteType(t: Type, attributes?: TypeAttributes, forwardingRef?: TypeRef): TypeRef;
|
|
57
|
-
abstract lookupTypeRefs(typeRefs: TypeRef[], forwardingRef?: TypeRef, replaceSet?: boolean): TypeRef | undefined;
|
|
58
|
-
protected abstract forceReconstituteTypeRef(originalRef: TypeRef, attributes?: TypeAttributes, maybeForwardingRef?: TypeRef): TypeRef;
|
|
59
|
-
reconstituteTypeRef(originalRef: TypeRef, attributes?: TypeAttributes, maybeForwardingRef?: TypeRef): TypeRef;
|
|
60
|
-
reconstituteTypeAttributes(attributes: TypeAttributes): TypeAttributes;
|
|
61
|
-
protected assertTypeRefsToReconstitute(typeRefs: TypeRef[], forwardingRef?: TypeRef): void;
|
|
62
|
-
protected changeDebugPrintIndent(delta: number): void;
|
|
63
|
-
protected get debugPrintIndentation(): string;
|
|
64
|
-
finish(): TypeGraph;
|
|
65
|
-
setLostTypeAttributes(): void;
|
|
66
|
-
get lostTypeAttributes(): boolean;
|
|
67
|
-
}
|
|
68
|
-
export declare class GraphRemapBuilder extends BaseGraphRewriteBuilder {
|
|
69
|
-
private readonly _map;
|
|
70
|
-
private readonly _attributeSources;
|
|
71
|
-
constructor(originalGraph: TypeGraph, stringTypeMapping: StringTypeMapping, alphabetizeProperties: boolean, graphHasProvenanceAttributes: boolean, _map: ReadonlyMap<Type, Type>, debugPrintRemapping: boolean);
|
|
72
|
-
protected makeIdentity(_maker: () => MaybeTypeIdentity): MaybeTypeIdentity;
|
|
73
|
-
private getMapTarget;
|
|
74
|
-
protected addForwardingIntersection(_forwardingRef: TypeRef, _tref: TypeRef): TypeRef;
|
|
75
|
-
lookupTypeRefs(typeRefs: TypeRef[], forwardingRef?: TypeRef): TypeRef | undefined;
|
|
76
|
-
protected forceReconstituteTypeRef(originalRef: TypeRef, attributes?: TypeAttributes, maybeForwardingRef?: TypeRef): TypeRef;
|
|
77
|
-
}
|
|
78
|
-
export declare class GraphRewriteBuilder<T extends Type> extends BaseGraphRewriteBuilder {
|
|
79
|
-
private readonly _replacer;
|
|
80
|
-
private readonly _setsToReplaceByMember;
|
|
81
|
-
private readonly _reconstitutedUnions;
|
|
82
|
-
constructor(originalGraph: TypeGraph, stringTypeMapping: StringTypeMapping, alphabetizeProperties: boolean, graphHasProvenanceAttributes: boolean, setsToReplace: T[][], debugPrintReconstitution: boolean, _replacer: (typesToReplace: ReadonlySet<T>, builder: GraphRewriteBuilder<T>, forwardingRef: TypeRef) => TypeRef);
|
|
83
|
-
registerUnion(typeRefs: TypeRef[], reconstituted: TypeRef): void;
|
|
84
|
-
private replaceSet;
|
|
85
|
-
protected forceReconstituteTypeRef(originalRef: TypeRef, attributes?: TypeAttributes, maybeForwardingRef?: TypeRef): TypeRef;
|
|
86
|
-
lookupTypeRefs(typeRefs: TypeRef[], forwardingRef?: TypeRef, replaceSet?: boolean): TypeRef | undefined;
|
|
87
|
-
}
|