microfiber
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -49,2 +49,8 @@ "use strict"; | ||
removePossibleTypesOfMissingTypes: true, | ||
// TODO: implement | ||
// removeQueriesWithMissingTypes: true, | ||
// TODO: implement | ||
// removeMutationsWithMissingTypes: true, | ||
// TODO: implement | ||
// removeSubscriptionsWithMissingTypes: true, | ||
// Remove all the types and things that are unreferenced immediately? | ||
@@ -613,27 +619,14 @@ cleanupSchemaImmediately: true | ||
types.push(type); | ||
const fields = []; | ||
for (const field of type.fields || []) { | ||
if (isUndef(field)) { | ||
continue; | ||
} | ||
if (type.fields) { | ||
const fields = []; | ||
const fieldType = digUnderlyingType(field.type); // Don't add it if its return type does not exist | ||
if (!this._hasType(fieldType)) { | ||
continue; | ||
} // Keep track of this so we know what we can remove | ||
typesEncountered.add(buildKey(fieldType)); | ||
const args = []; | ||
for (const arg of field.args || []) { | ||
if (isUndef(arg)) { | ||
for (const field of type.fields) { | ||
if (isUndef(field)) { | ||
continue; | ||
} | ||
const argType = digUnderlyingType(arg.type); // Don't add it if its return type does not exist | ||
const fieldType = digUnderlyingType(field.type); // Don't add it if its return type does not exist | ||
if (!this._hasType(argType)) { | ||
if (!this._hasType(fieldType)) { | ||
continue; | ||
@@ -643,55 +636,74 @@ } // Keep track of this so we know what we can remove | ||
typesEncountered.add(buildKey(argType)); | ||
args.push(arg); | ||
} // Args will always be an array. Possible empty, but never null | ||
typesEncountered.add(buildKey(fieldType)); | ||
const args = []; | ||
for (const arg of field.args || []) { | ||
if (isUndef(arg)) { | ||
continue; | ||
} | ||
field.args = args; | ||
fields.push(field); | ||
} // Fields will be null rather than empty array if no fields | ||
const argType = digUnderlyingType(arg.type); // Don't add it if its return type does not exist | ||
if (!this._hasType(argType)) { | ||
continue; | ||
} // Keep track of this so we know what we can remove | ||
type.fields = fields.length ? fields : null; | ||
const inputFields = []; // Don't add it in if it's undefined, or the type is gone | ||
for (const inputField of type.inputFields || []) { | ||
if (isUndef(inputField)) { | ||
continue; | ||
typesEncountered.add(buildKey(argType)); | ||
args.push(arg); | ||
} // Args will always be an array. Possible empty, but never null | ||
field.args = args; | ||
fields.push(field); | ||
} | ||
const inputFieldType = digUnderlyingType(inputField.type); // Don't add it if its return type does not exist | ||
type.fields = fields; | ||
} | ||
if (!this._hasType(inputFieldType)) { | ||
continue; | ||
} // Keep track of this so we know what we can remove | ||
if (type.inputFields) { | ||
const inputFields = []; // Don't add it in if it's undefined, or the type is gone | ||
for (const inputField of type.inputFields) { | ||
if (isUndef(inputField)) { | ||
continue; | ||
} | ||
typesEncountered.add(buildKey(inputFieldType)); | ||
inputFields.push(inputField); | ||
} // InputFields will be null rather than empty array if no inputFields | ||
const inputFieldType = digUnderlyingType(inputField.type); // Don't add it if its return type does not exist | ||
if (!this._hasType(inputFieldType)) { | ||
continue; | ||
} // Keep track of this so we know what we can remove | ||
type.inputFields = inputFields.length ? inputFields : null; | ||
const possibleTypes = []; | ||
for (const possibleType of type.possibleTypes || []) { | ||
if (isUndef(possibleType)) { | ||
continue; | ||
} // possibleTypes array entries have no envelope for the type | ||
// so do not do possibleType.type here | ||
typesEncountered.add(buildKey(inputFieldType)); | ||
inputFields.push(inputField); | ||
} | ||
type.inputFields = inputFields; | ||
} | ||
const possibleTypeType = digUnderlyingType(possibleType); // Don't add it if its return type does not exist | ||
if (type.possibleTypes) { | ||
const possibleTypes = []; | ||
if (!this._hasType(possibleTypeType)) { | ||
continue; | ||
} // Keep track of this so we know what we can remove | ||
for (const possibleType of type.possibleTypes) { | ||
if (isUndef(possibleType)) { | ||
continue; | ||
} // possibleTypes array entries have no envelope for the type | ||
// so do not do possibleType.type here | ||
typesEncountered.add(buildKey(possibleTypeType)); | ||
possibleTypes.push(possibleType); | ||
} // PossibleTypes will be null rather than emptry array if no possibleTypes | ||
const possibleTypeType = digUnderlyingType(possibleType); // Don't add it if its return type does not exist | ||
if (!this._hasType(possibleTypeType)) { | ||
continue; | ||
} // Keep track of this so we know what we can remove | ||
type.possibleTypes = possibleTypes.length ? possibleTypes : null; | ||
typesEncountered.add(buildKey(possibleTypeType)); | ||
possibleTypes.push(possibleType); | ||
} | ||
type.possibleTypes = possibleTypes; | ||
} | ||
} // Only include Types that we encountered - if the options say to do so | ||
@@ -698,0 +710,0 @@ |
{ | ||
"name": "microfiber", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "A library to query and manipulate GraphQL Introspection Query results in some useful ways.", | ||
@@ -5,0 +5,0 @@ "author": "Chris Newhouse", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38793
868
0