@graphql-inspector/core
Advanced tools
Comparing version 6.2.0-alpha-20241111152238-c5ae4cca01e177711e7f4629279aa18287d39a69 to 6.2.0-alpha-20241112103543-a90e1d92dfaa16080e66c0c89e829a11fbd5b072
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.directiveUsageArgumentDefinitionAddedFromMeta = directiveUsageArgumentDefinitionAddedFromMeta; | ||
exports.directiveUsageArgumentDefinitionRemovedFromMeta = directiveUsageArgumentDefinitionRemovedFromMeta; | ||
exports.directiveUsageInputObjectAddedFromMeta = directiveUsageInputObjectAddedFromMeta; | ||
exports.directiveUsageInputObjectRemovedFromMeta = directiveUsageInputObjectRemovedFromMeta; | ||
exports.directiveUsageInterfaceAddedFromMeta = directiveUsageInterfaceAddedFromMeta; | ||
exports.directiveUsageInterfaceRemovedFromMeta = directiveUsageInterfaceRemovedFromMeta; | ||
exports.directiveUsageInputFieldDefinitionAddedFromMeta = directiveUsageInputFieldDefinitionAddedFromMeta; | ||
exports.directiveUsageInputFieldDefinitionRemovedFromMeta = directiveUsageInputFieldDefinitionRemovedFromMeta; | ||
exports.directiveUsageObjectAddedFromMeta = directiveUsageObjectAddedFromMeta; | ||
exports.directiveUsageObjectRemovedFromMeta = directiveUsageObjectRemovedFromMeta; | ||
exports.directiveUsageEnumAddedFromMeta = directiveUsageEnumAddedFromMeta; | ||
exports.directiveUsageEnumRemovedFromMeta = directiveUsageEnumRemovedFromMeta; | ||
exports.directiveUsageFieldDefinitionAddedFromMeta = directiveUsageFieldDefinitionAddedFromMeta; | ||
exports.directiveUsageFieldDefinitionRemovedFromMeta = directiveUsageFieldDefinitionRemovedFromMeta; | ||
exports.directiveUsageUnionMemberAddedFromMeta = directiveUsageUnionMemberAddedFromMeta; | ||
exports.directiveUsageUnionMemberRemovedFromMeta = directiveUsageUnionMemberRemovedFromMeta; | ||
exports.directiveUsageEnumValueAddedFromMeta = directiveUsageEnumValueAddedFromMeta; | ||
exports.directiveUsageEnumValueRemovedFromMeta = directiveUsageEnumValueRemovedFromMeta; | ||
exports.directiveUsageSchemaAddedFromMeta = directiveUsageSchemaAddedFromMeta; | ||
exports.directiveUsageSchemaRemovedFromMeta = directiveUsageSchemaRemovedFromMeta; | ||
exports.directiveUsageScalarAddedFromMeta = directiveUsageScalarAddedFromMeta; | ||
exports.directiveUsageScalarRemovedFromMeta = directiveUsageScalarRemovedFromMeta; | ||
exports.directiveUsageAdded = directiveUsageAdded; | ||
@@ -25,80 +47,414 @@ exports.directiveUsageRemoved = directiveUsageRemoved; | ||
} | ||
function buildDirectiveUsageArgumentDefinitionAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to argument '${args.argumentName}' of field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
function directiveUsageArgumentDefinitionAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to argument '${args.meta.argumentName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageArgumentDefinitionAdded, | ||
message: buildDirectiveUsageArgumentDefinitionAddedMessage(args.meta), | ||
path: [ | ||
args.meta.typeName, | ||
args.meta.fieldName, | ||
args.meta.argumentName, | ||
args.meta.addedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageArgumentDefinitionRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from argument '${args.argumentName}' of field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
function directiveUsageArgumentDefinitionRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from argument '${args.meta.argumentName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageArgumentDefinitionRemoved, | ||
message: buildDirectiveUsageArgumentDefinitionRemovedMessage(args.meta), | ||
path: [ | ||
args.meta.typeName, | ||
args.meta.fieldName, | ||
args.meta.argumentName, | ||
args.meta.removedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInputObjectAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to input object '${args.inputObjectName}'`; | ||
} | ||
function directiveUsageInputObjectAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to input object '${args.meta.inputObjectName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageInputObjectAdded, | ||
message: buildDirectiveUsageInputObjectAddedMessage(args.meta), | ||
path: [args.meta.inputObjectName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInputObjectRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from input object '${args.inputObjectName}'`; | ||
} | ||
function directiveUsageInputObjectRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from input object '${args.meta.inputObjectName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageInputObjectRemoved, | ||
message: buildDirectiveUsageInputObjectRemovedMessage(args.meta), | ||
path: [args.meta.inputObjectName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInterfaceAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to interface '${args.interfaceName}'`; | ||
} | ||
function directiveUsageInterfaceAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to interface '${args.meta.interfaceName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageInterfaceAdded, | ||
message: buildDirectiveUsageInterfaceAddedMessage(args.meta), | ||
path: [args.meta.interfaceName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInterfaceRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from interface '${args.interfaceName}'`; | ||
} | ||
function directiveUsageInterfaceRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Breaking), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from interface '${args.meta.interfaceName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageInterfaceRemoved, | ||
message: buildDirectiveUsageInterfaceRemovedMessage(args.meta), | ||
path: [args.meta.interfaceName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageInputFieldDefinitionAdded | ||
function buildDirectiveUsageInputFieldDefinitionAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to input field '${args.inputFieldName}' in input object '${args.inputObjectName}'`; | ||
} | ||
function directiveUsageInputFieldDefinitionAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to input field '${args.meta.inputFieldName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageInputFieldDefinitionAdded, | ||
message: buildDirectiveUsageInputFieldDefinitionAddedMessage(args.meta), | ||
path: [args.meta.inputObjectName, args.meta.inputFieldName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageInputFieldDefinitionRemoved | ||
function buildDirectiveUsageInputFieldDefinitionRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from input field '${args.inputFieldName}' in input object '${args.inputObjectName}'`; | ||
} | ||
function directiveUsageInputFieldDefinitionRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from input field '${args.meta.inputFieldName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageInputFieldDefinitionRemoved, | ||
message: buildDirectiveUsageInputFieldDefinitionRemovedMessage(args.meta), | ||
path: [ | ||
args.meta.inputObjectName, | ||
args.meta.inputFieldName, | ||
args.meta.removedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageObjectAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to object '${args.objectName}'`; | ||
} | ||
function directiveUsageObjectAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to object '${args.meta.objectName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageObjectAdded, | ||
message: buildDirectiveUsageObjectAddedMessage(args.meta), | ||
path: [args.meta.objectName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageObjectRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from object '${args.objectName}'`; | ||
} | ||
function directiveUsageObjectRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from object '${args.meta.objectName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageObjectRemoved, | ||
message: buildDirectiveUsageObjectRemovedMessage(args.meta), | ||
path: [args.meta.objectName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumAdded | ||
function buildDirectiveUsageEnumAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to enum '${args.enumName}'`; | ||
} | ||
function directiveUsageEnumAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to enum '${args.meta.enumName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageEnumAdded, | ||
message: buildDirectiveUsageEnumAddedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumRemoved | ||
function buildDirectiveUsageEnumRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from enum '${args.enumName}'`; | ||
} | ||
function directiveUsageEnumRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from enum '${args.meta.enumName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageEnumRemoved, | ||
message: buildDirectiveUsageEnumRemovedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageFieldDefinitionAdded | ||
function buildDirectiveUsageFieldDefinitionAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
function directiveUsageFieldDefinitionAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to field '${args.meta.fieldName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageFieldDefinitionAdded, | ||
message: buildDirectiveUsageFieldDefinitionAddedMessage(args.meta), | ||
path: [args.meta.typeName, args.meta.fieldName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageFieldDefinitionRemoved | ||
function buildDirectiveUsageFieldDefinitionRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
function directiveUsageFieldDefinitionRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from field '${args.meta.fieldName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageFieldDefinitionRemoved, | ||
message: buildDirectiveUsageFieldDefinitionRemovedMessage(args.meta), | ||
path: [args.meta.typeName, args.meta.fieldName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageUnionMemberAdded | ||
function buildDirectiveUsageUnionMemberAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to union member '${args.addedUnionMemberTypeName}' in union '${args.unionName}'`; | ||
} | ||
function directiveUsageUnionMemberAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to union member '${args.meta.addedUnionMemberTypeName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageUnionMemberAdded, | ||
message: buildDirectiveUsageUnionMemberAddedMessage(args.meta), | ||
path: [ | ||
args.meta.unionName, | ||
args.meta.addedUnionMemberTypeName, | ||
args.meta.addedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageUnionMemberRemoved | ||
function buildDirectiveUsageUnionMemberRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from union member '${args.removedUnionMemberTypeName}' in union '${args.unionName}'`; | ||
} | ||
function directiveUsageUnionMemberRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from union member '${args.meta.removedUnionMemberTypeName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageUnionMemberRemoved, | ||
message: buildDirectiveUsageUnionMemberRemovedMessage(args.meta), | ||
path: [ | ||
args.meta.unionName, | ||
args.meta.removedUnionMemberTypeName, | ||
args.meta.removedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumValueAdded | ||
function buildDirectiveUsageEnumValueAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to enum value '${args.enumName}.${args.enumValueName}'`; | ||
} | ||
function directiveUsageEnumValueAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to enum value '${args.meta.enumName}.${args.meta.enumValueName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageEnumValueAdded, | ||
message: buildDirectiveUsageEnumValueAddedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.enumValueName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumValueRemoved | ||
function buildDirectiveUsageEnumValueRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from enum value '${args.enumName}.${args.enumValueName}'`; | ||
} | ||
function directiveUsageEnumValueRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from enum value '${args.meta.enumName}.${args.meta.enumValueName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageEnumValueRemoved, | ||
message: buildDirectiveUsageEnumValueRemovedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.enumValueName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageSchemaAdded | ||
function buildDirectiveUsageSchemaAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to schema '${args.schemaTypeName}'`; | ||
} | ||
function directiveUsageSchemaAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to schema '${args.meta.schemaTypeName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageSchemaAdded, | ||
message: buildDirectiveUsageSchemaAddedMessage(args.meta), | ||
path: [args.meta.schemaTypeName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageSchemaRemoved | ||
function buildDirectiveUsageSchemaRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from schema '${args.schemaTypeName}'`; | ||
} | ||
function directiveUsageSchemaRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from schema '${args.meta.schemaTypeName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageSchemaRemoved, | ||
message: buildDirectiveUsageSchemaRemovedMessage(args.meta), | ||
path: [args.meta.schemaTypeName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageScalarAdded | ||
function buildDirectiveUsageScalarAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to scalar '${args.scalarName}'`; | ||
} | ||
function directiveUsageScalarAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to scalar '${args.meta.scalarName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageScalarAdded, | ||
message: buildDirectiveUsageScalarAddedMessage(args.meta), | ||
path: [args.meta.scalarName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageScalarRemoved | ||
function buildDirectiveUsageScalarRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from scalar '${args.scalarName}'`; | ||
} | ||
function directiveUsageScalarRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, change_js_1.CriticalityLevel.Breaking), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from scalar '${args.meta.scalarName}'`, | ||
}, | ||
type: change_js_1.ChangeType.DirectiveUsageScalarRemoved, | ||
message: buildDirectiveUsageScalarRemovedMessage(args.meta), | ||
path: [args.meta.scalarName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function directiveUsageAdded(kind, directive, payload) { | ||
if (isOfKind(kind, graphql_1.Kind.ARGUMENT, payload)) { | ||
return { | ||
return directiveUsageArgumentDefinitionAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageArgumentDefinitionAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to argument '${payload.argument.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to argument '${payload.argument.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
argumentName: payload.argument.name, | ||
addedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.type.name, | ||
}, | ||
path: [ | ||
payload.type.name, | ||
payload.field.name, | ||
payload.argument.name, | ||
directive.name.value, | ||
].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.INPUT_VALUE_DEFINITION, payload)) { | ||
return { | ||
type: change_js_1.ChangeType.DirectiveUsageArgumentDefinitionAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to argument '${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to argument '${payload.field.name}'`, | ||
return directiveUsageInputFieldDefinitionAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageInputFieldDefinitionAdded, | ||
meta: { | ||
argumentName: payload.field.name, | ||
addedDirectiveName: directive.name.value, | ||
fieldName: payload.type.name, | ||
typeName: payload.type.name, | ||
inputFieldName: payload.field.name, | ||
inputObjectName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInputObjectAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageInputObjectAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to input object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to input object '${payload.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
addedInputFieldName: payload.getFields()[0].name, | ||
addedInputFieldType: payload.name, | ||
inputObjectName: payload.name, | ||
addedDirectiveName: directive.name.value, | ||
isAddedInputFieldTypeNullable: kind === graphql_1.Kind.INPUT_VALUE_DEFINITION, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.INTERFACE_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInterfaceAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageInterfaceAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to interface '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to interface '${payload.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
interfaceName: payload.name, | ||
addedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.OBJECT, payload)) { | ||
return { | ||
return directiveUsageObjectAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageObjectAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to object '${payload.name}'`, | ||
meta: { | ||
@@ -108,13 +464,7 @@ objectName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.ENUM_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageEnumAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to enum '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to enum '${payload.name}'`, | ||
meta: { | ||
@@ -124,45 +474,27 @@ enumName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.FIELD_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageFieldDefinitionAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageFieldDefinitionAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to field '${payload.parentType.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to field '${payload.parentType.name}.${payload.field.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.parentType.name, | ||
fieldName: payload.field.name, | ||
addedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.parentType.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.UNION_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageUnionMemberAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageUnionMemberAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to union member '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to union member '${payload.name}'`, | ||
meta: { | ||
unionName: payload.name, | ||
addedDirectiveName: directive.name.value, | ||
addedUnionMemberTypeName: payload.name, | ||
unionName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.ENUM_VALUE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumValueAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageEnumValueAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to enum value '${payload.type.name}.${payload.value.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to enum value '${payload.type.name}.${payload.value.name}'`, | ||
meta: { | ||
@@ -173,13 +505,7 @@ enumName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.value.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.SCHEMA_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageSchemaAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageSchemaAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to schema`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to schema`, | ||
meta: { | ||
@@ -189,13 +515,7 @@ addedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.getQueryType()?.name || '', directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.SCALAR_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageScalarAddedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageScalarAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to scalar '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to scalar '${payload.name}'`, | ||
meta: { | ||
@@ -205,4 +525,3 @@ scalarName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
@@ -213,78 +532,46 @@ return {}; | ||
if (isOfKind(kind, graphql_1.Kind.ARGUMENT, payload)) { | ||
return { | ||
return directiveUsageArgumentDefinitionRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageArgumentDefinitionRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from argument '${payload.type.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from argument '${payload.type.name}.${payload.field.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
argumentName: payload.argument.name, | ||
removedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.type.name, | ||
}, | ||
path: [ | ||
payload.type.name, | ||
payload.field.name, | ||
payload.argument.name, | ||
directive.name.value, | ||
].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.INPUT_VALUE_DEFINITION, payload)) { | ||
return { | ||
type: change_js_1.ChangeType.DirectiveUsageArgumentDefinitionRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from input value '${payload.type.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from input value '${payload.type.name}.${payload.field.name}'`, | ||
return directiveUsageInputFieldDefinitionRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageInputFieldDefinitionRemoved, | ||
meta: { | ||
argumentName: payload.field.name, | ||
removedDirectiveName: directive.name.value, | ||
fieldName: payload.type.name, | ||
typeName: payload.type.name, | ||
inputFieldName: payload.field.name, | ||
inputObjectName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.INPUT_OBJECT_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInputObjectRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageInputObjectRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from input object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from input object '${payload.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
removedInputFieldName: payload.getFields()[0].name, | ||
removedInputFieldType: payload.name, | ||
inputObjectName: payload.name, | ||
removedDirectiveName: directive.name.value, | ||
isRemovedInputFieldTypeNullable: kind === graphql_1.Kind.INPUT_VALUE_DEFINITION, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.INTERFACE_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInterfaceRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageInterfaceRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Breaking), | ||
reason: `Directive '${directive.name.value}' was removed from interface '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from interface '${payload.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
interfaceName: payload.name, | ||
removedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.OBJECT, payload)) { | ||
return { | ||
return directiveUsageObjectRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageObjectRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from object '${payload.name}'`, | ||
meta: { | ||
@@ -294,13 +581,7 @@ objectName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.ENUM_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageEnumRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from enum '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from enum '${payload.name}'`, | ||
meta: { | ||
@@ -310,45 +591,27 @@ enumName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.FIELD_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageFieldDefinitionRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageFieldDefinitionRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from field '${payload.parentType.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from field '${payload.parentType.name}.${payload.field.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.parentType.name, | ||
fieldName: payload.field.name, | ||
removedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.parentType.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.UNION_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageUnionMemberRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageUnionMemberRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from union member '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from union member '${payload.name}'`, | ||
meta: { | ||
unionName: payload.name, | ||
removedDirectiveName: directive.name.value, | ||
removedUnionMemberTypeName: payload.name, | ||
unionName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.ENUM_VALUE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumValueRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageEnumValueRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from enum value '${payload.type.name}.${payload.value.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from enum value '${payload.type.name}.${payload.value.name}'`, | ||
meta: { | ||
@@ -359,13 +622,7 @@ enumName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.value.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.SCHEMA_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageSchemaRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageSchemaRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from schema`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from schema`, | ||
meta: { | ||
@@ -375,13 +632,7 @@ removedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.getQueryType()?.name || '', directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, graphql_1.Kind.SCALAR_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageScalarRemovedFromMeta({ | ||
type: change_js_1.ChangeType.DirectiveUsageScalarRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, change_js_1.CriticalityLevel.Breaking), | ||
reason: `Directive '${directive.name.value}' was removed from scalar '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from scalar '${payload.name}'`, | ||
meta: { | ||
@@ -391,4 +642,3 @@ scalarName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
@@ -395,0 +645,0 @@ return {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.inputFieldDefaultValueChangedFromMeta = exports.inputFieldDescriptionChangedFromMeta = exports.inputFieldDescriptionRemovedFromMeta = exports.inputFieldDescriptionAddedFromMeta = exports.inputFieldAddedFromMeta = exports.inputFieldRemovedFromMeta = exports.fieldArgumentRemovedFromMeta = exports.fieldArgumentAddedFromMeta = exports.fieldTypeChangedFromMeta = exports.fieldDeprecationReasonRemovedFromMeta = exports.fieldDeprecationReasonAddedFromMeta = exports.fieldDeprecationReasonChangedFromMeta = exports.fieldDeprecationRemovedFromMeta = exports.fieldDeprecationAddedFromMeta = exports.fieldDescriptionRemovedFromMeta = exports.fieldDescriptionAddedFromMeta = exports.fieldDescriptionChangedFromMeta = exports.fieldAddedFromMeta = exports.fieldRemovedFromMeta = exports.enumValueDeprecationReasonRemovedFromMeta = exports.enumValueDeprecationReasonAddedFromMeta = exports.enumValueDeprecationReasonChangedFromMeta = exports.enumValueDescriptionChangedFromMeta = exports.enumValueAddedFromMeta = exports.enumValueRemovedFromMeta = exports.directiveArgumentTypeChangedFromMeta = exports.directiveArgumentDefaultValueChangedFromMeta = exports.directiveArgumentDescriptionChangedFromMeta = exports.directiveArgumentRemovedFromMeta = exports.directiveArgumentAddedFromMeta = exports.directiveLocationRemovedFromMeta = exports.directiveLocationAddedFromMeta = exports.directiveDescriptionChangedFromMeta = exports.directiveAddedFromMeta = exports.directiveRemovedFromMeta = exports.fieldArgumentTypeChangedFromMeta = exports.fieldArgumentDefaultChangedFromMeta = exports.fieldArgumentDescriptionChangedFromMeta = exports.calculateTokenCount = exports.countDepth = exports.countDirectives = exports.calculateOperationComplexity = exports.countAliases = exports.validate = exports.getTypePrefix = exports.similar = exports.CriticalityLevel = exports.ChangeType = exports.DiffRule = exports.diff = void 0; | ||
exports.buildUnionMemberAddedMessageFromMeta = exports.unionMemberRemovedFromMeta = exports.typeDescriptionAddedFromMeta = exports.typeDescriptionRemovedFromMeta = exports.typeDescriptionChangedFromMeta = exports.typeKindChangedFromMeta = exports.typeAddedFromMeta = exports.typeRemovedFromMeta = exports.schemaSubscriptionTypeChangedFromMeta = exports.schemaMutationTypeChangedFromMeta = exports.schemaQueryTypeChangedFromMeta = exports.objectTypeInterfaceRemovedFromMeta = exports.objectTypeInterfaceAddedFromMeta = exports.inputFieldTypeChangedFromMeta = void 0; | ||
exports.enumValueRemovedFromMeta = exports.directiveArgumentTypeChangedFromMeta = exports.directiveArgumentDefaultValueChangedFromMeta = exports.directiveArgumentDescriptionChangedFromMeta = exports.directiveArgumentRemovedFromMeta = exports.directiveArgumentAddedFromMeta = exports.directiveLocationRemovedFromMeta = exports.directiveLocationAddedFromMeta = exports.directiveDescriptionChangedFromMeta = exports.directiveAddedFromMeta = exports.directiveRemovedFromMeta = exports.directiveUsageUnionMemberRemovedFromMeta = exports.directiveUsageUnionMemberAddedFromMeta = exports.directiveUsageSchemaRemovedFromMeta = exports.directiveUsageSchemaAddedFromMeta = exports.directiveUsageScalarRemovedFromMeta = exports.directiveUsageScalarAddedFromMeta = exports.directiveUsageRemoved = exports.directiveUsageObjectRemovedFromMeta = exports.directiveUsageObjectAddedFromMeta = exports.directiveUsageInterfaceRemovedFromMeta = exports.directiveUsageInterfaceAddedFromMeta = exports.directiveUsageInputObjectRemovedFromMeta = exports.directiveUsageInputObjectAddedFromMeta = exports.directiveUsageInputFieldDefinitionRemovedFromMeta = exports.directiveUsageInputFieldDefinitionAddedFromMeta = exports.directiveUsageFieldDefinitionRemovedFromMeta = exports.directiveUsageAdded = exports.directiveUsageFieldDefinitionAddedFromMeta = exports.directiveUsageEnumValueRemovedFromMeta = exports.directiveUsageEnumValueAddedFromMeta = exports.directiveUsageArgumentDefinitionRemovedFromMeta = exports.directiveUsageEnumRemovedFromMeta = exports.directiveUsageEnumAddedFromMeta = exports.directiveUsageArgumentDefinitionAddedFromMeta = exports.fieldArgumentTypeChangedFromMeta = exports.fieldArgumentDefaultChangedFromMeta = exports.fieldArgumentDescriptionChangedFromMeta = exports.calculateTokenCount = exports.countDepth = exports.countDirectives = exports.calculateOperationComplexity = exports.countAliases = exports.validate = exports.getTypePrefix = exports.similar = exports.CriticalityLevel = exports.ChangeType = exports.DiffRule = exports.diff = void 0; | ||
exports.buildUnionMemberAddedMessageFromMeta = exports.unionMemberRemovedFromMeta = exports.typeDescriptionAddedFromMeta = exports.typeDescriptionRemovedFromMeta = exports.typeDescriptionChangedFromMeta = exports.typeKindChangedFromMeta = exports.typeAddedFromMeta = exports.typeRemovedFromMeta = exports.schemaSubscriptionTypeChangedFromMeta = exports.schemaMutationTypeChangedFromMeta = exports.schemaQueryTypeChangedFromMeta = exports.objectTypeInterfaceRemovedFromMeta = exports.objectTypeInterfaceAddedFromMeta = exports.inputFieldTypeChangedFromMeta = exports.inputFieldDefaultValueChangedFromMeta = exports.inputFieldDescriptionChangedFromMeta = exports.inputFieldDescriptionRemovedFromMeta = exports.inputFieldDescriptionAddedFromMeta = exports.inputFieldAddedFromMeta = exports.inputFieldRemovedFromMeta = exports.fieldArgumentRemovedFromMeta = exports.fieldArgumentAddedFromMeta = exports.fieldTypeChangedFromMeta = exports.fieldDeprecationReasonRemovedFromMeta = exports.fieldDeprecationReasonAddedFromMeta = exports.fieldDeprecationReasonChangedFromMeta = exports.fieldDeprecationRemovedFromMeta = exports.fieldDeprecationAddedFromMeta = exports.fieldDescriptionRemovedFromMeta = exports.fieldDescriptionAddedFromMeta = exports.fieldDescriptionChangedFromMeta = exports.fieldAddedFromMeta = exports.fieldRemovedFromMeta = exports.enumValueDeprecationReasonRemovedFromMeta = exports.enumValueDeprecationReasonAddedFromMeta = exports.enumValueDeprecationReasonChangedFromMeta = exports.enumValueDescriptionChangedFromMeta = exports.enumValueAddedFromMeta = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -33,2 +33,27 @@ tslib_1.__exportStar(require("./coverage/index.js"), exports); | ||
Object.defineProperty(exports, "fieldArgumentTypeChangedFromMeta", { enumerable: true, get: function () { return argument_js_1.fieldArgumentTypeChangedFromMeta; } }); | ||
var directive_usage_js_1 = require("./diff/changes/directive-usage.js"); | ||
Object.defineProperty(exports, "directiveUsageArgumentDefinitionAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageArgumentDefinitionAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageEnumAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageEnumAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageEnumRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageEnumRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageArgumentDefinitionRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageArgumentDefinitionRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageEnumValueAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageEnumValueAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageEnumValueRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageEnumValueRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageFieldDefinitionAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageFieldDefinitionAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageAdded", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageAdded; } }); | ||
Object.defineProperty(exports, "directiveUsageFieldDefinitionRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageFieldDefinitionRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageInputFieldDefinitionAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageInputFieldDefinitionAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageInputFieldDefinitionRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageInputFieldDefinitionRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageInputObjectAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageInputObjectAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageInputObjectRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageInputObjectRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageInterfaceAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageInterfaceAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageInterfaceRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageInterfaceRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageObjectAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageObjectAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageObjectRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageObjectRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageRemoved", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageRemoved; } }); | ||
Object.defineProperty(exports, "directiveUsageScalarAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageScalarAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageScalarRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageScalarRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageSchemaAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageSchemaAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageSchemaRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageSchemaRemovedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageUnionMemberAddedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageUnionMemberAddedFromMeta; } }); | ||
Object.defineProperty(exports, "directiveUsageUnionMemberRemovedFromMeta", { enumerable: true, get: function () { return directive_usage_js_1.directiveUsageUnionMemberRemovedFromMeta; } }); | ||
var directive_js_1 = require("./diff/changes/directive.js"); | ||
@@ -35,0 +60,0 @@ Object.defineProperty(exports, "directiveRemovedFromMeta", { enumerable: true, get: function () { return directive_js_1.directiveRemovedFromMeta; } }); |
@@ -21,80 +21,414 @@ import { Kind, } from 'graphql'; | ||
} | ||
function buildDirectiveUsageArgumentDefinitionAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to argument '${args.argumentName}' of field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
export function directiveUsageArgumentDefinitionAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to argument '${args.meta.argumentName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageArgumentDefinitionAdded, | ||
message: buildDirectiveUsageArgumentDefinitionAddedMessage(args.meta), | ||
path: [ | ||
args.meta.typeName, | ||
args.meta.fieldName, | ||
args.meta.argumentName, | ||
args.meta.addedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageArgumentDefinitionRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from argument '${args.argumentName}' of field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
export function directiveUsageArgumentDefinitionRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from argument '${args.meta.argumentName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageArgumentDefinitionRemoved, | ||
message: buildDirectiveUsageArgumentDefinitionRemovedMessage(args.meta), | ||
path: [ | ||
args.meta.typeName, | ||
args.meta.fieldName, | ||
args.meta.argumentName, | ||
args.meta.removedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInputObjectAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to input object '${args.inputObjectName}'`; | ||
} | ||
export function directiveUsageInputObjectAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to input object '${args.meta.inputObjectName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageInputObjectAdded, | ||
message: buildDirectiveUsageInputObjectAddedMessage(args.meta), | ||
path: [args.meta.inputObjectName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInputObjectRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from input object '${args.inputObjectName}'`; | ||
} | ||
export function directiveUsageInputObjectRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from input object '${args.meta.inputObjectName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageInputObjectRemoved, | ||
message: buildDirectiveUsageInputObjectRemovedMessage(args.meta), | ||
path: [args.meta.inputObjectName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInterfaceAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to interface '${args.interfaceName}'`; | ||
} | ||
export function directiveUsageInterfaceAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to interface '${args.meta.interfaceName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageInterfaceAdded, | ||
message: buildDirectiveUsageInterfaceAddedMessage(args.meta), | ||
path: [args.meta.interfaceName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageInterfaceRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from interface '${args.interfaceName}'`; | ||
} | ||
export function directiveUsageInterfaceRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Breaking), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from interface '${args.meta.interfaceName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageInterfaceRemoved, | ||
message: buildDirectiveUsageInterfaceRemovedMessage(args.meta), | ||
path: [args.meta.interfaceName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageInputFieldDefinitionAdded | ||
function buildDirectiveUsageInputFieldDefinitionAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to input field '${args.inputFieldName}' in input object '${args.inputObjectName}'`; | ||
} | ||
export function directiveUsageInputFieldDefinitionAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to input field '${args.meta.inputFieldName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageInputFieldDefinitionAdded, | ||
message: buildDirectiveUsageInputFieldDefinitionAddedMessage(args.meta), | ||
path: [args.meta.inputObjectName, args.meta.inputFieldName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageInputFieldDefinitionRemoved | ||
function buildDirectiveUsageInputFieldDefinitionRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from input field '${args.inputFieldName}' in input object '${args.inputObjectName}'`; | ||
} | ||
export function directiveUsageInputFieldDefinitionRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from input field '${args.meta.inputFieldName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageInputFieldDefinitionRemoved, | ||
message: buildDirectiveUsageInputFieldDefinitionRemovedMessage(args.meta), | ||
path: [ | ||
args.meta.inputObjectName, | ||
args.meta.inputFieldName, | ||
args.meta.removedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageObjectAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to object '${args.objectName}'`; | ||
} | ||
export function directiveUsageObjectAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to object '${args.meta.objectName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageObjectAdded, | ||
message: buildDirectiveUsageObjectAddedMessage(args.meta), | ||
path: [args.meta.objectName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
function buildDirectiveUsageObjectRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from object '${args.objectName}'`; | ||
} | ||
export function directiveUsageObjectRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from object '${args.meta.objectName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageObjectRemoved, | ||
message: buildDirectiveUsageObjectRemovedMessage(args.meta), | ||
path: [args.meta.objectName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumAdded | ||
function buildDirectiveUsageEnumAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to enum '${args.enumName}'`; | ||
} | ||
export function directiveUsageEnumAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to enum '${args.meta.enumName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageEnumAdded, | ||
message: buildDirectiveUsageEnumAddedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumRemoved | ||
function buildDirectiveUsageEnumRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from enum '${args.enumName}'`; | ||
} | ||
export function directiveUsageEnumRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from enum '${args.meta.enumName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageEnumRemoved, | ||
message: buildDirectiveUsageEnumRemovedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageFieldDefinitionAdded | ||
function buildDirectiveUsageFieldDefinitionAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
export function directiveUsageFieldDefinitionAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to field '${args.meta.fieldName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageFieldDefinitionAdded, | ||
message: buildDirectiveUsageFieldDefinitionAddedMessage(args.meta), | ||
path: [args.meta.typeName, args.meta.fieldName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageFieldDefinitionRemoved | ||
function buildDirectiveUsageFieldDefinitionRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from field '${args.fieldName}' in type '${args.typeName}'`; | ||
} | ||
export function directiveUsageFieldDefinitionRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from field '${args.meta.fieldName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageFieldDefinitionRemoved, | ||
message: buildDirectiveUsageFieldDefinitionRemovedMessage(args.meta), | ||
path: [args.meta.typeName, args.meta.fieldName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageUnionMemberAdded | ||
function buildDirectiveUsageUnionMemberAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to union member '${args.addedUnionMemberTypeName}' in union '${args.unionName}'`; | ||
} | ||
export function directiveUsageUnionMemberAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to union member '${args.meta.addedUnionMemberTypeName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageUnionMemberAdded, | ||
message: buildDirectiveUsageUnionMemberAddedMessage(args.meta), | ||
path: [ | ||
args.meta.unionName, | ||
args.meta.addedUnionMemberTypeName, | ||
args.meta.addedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageUnionMemberRemoved | ||
function buildDirectiveUsageUnionMemberRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from union member '${args.removedUnionMemberTypeName}' in union '${args.unionName}'`; | ||
} | ||
export function directiveUsageUnionMemberRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from union member '${args.meta.removedUnionMemberTypeName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageUnionMemberRemoved, | ||
message: buildDirectiveUsageUnionMemberRemovedMessage(args.meta), | ||
path: [ | ||
args.meta.unionName, | ||
args.meta.removedUnionMemberTypeName, | ||
args.meta.removedDirectiveName, | ||
].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumValueAdded | ||
function buildDirectiveUsageEnumValueAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to enum value '${args.enumName}.${args.enumValueName}'`; | ||
} | ||
export function directiveUsageEnumValueAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to enum value '${args.meta.enumName}.${args.meta.enumValueName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageEnumValueAdded, | ||
message: buildDirectiveUsageEnumValueAddedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.enumValueName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageEnumValueRemoved | ||
function buildDirectiveUsageEnumValueRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from enum value '${args.enumName}.${args.enumValueName}'`; | ||
} | ||
export function directiveUsageEnumValueRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from enum value '${args.meta.enumName}.${args.meta.enumValueName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageEnumValueRemoved, | ||
message: buildDirectiveUsageEnumValueRemovedMessage(args.meta), | ||
path: [args.meta.enumName, args.meta.enumValueName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageSchemaAdded | ||
function buildDirectiveUsageSchemaAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to schema '${args.schemaTypeName}'`; | ||
} | ||
export function directiveUsageSchemaAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to schema '${args.meta.schemaTypeName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageSchemaAdded, | ||
message: buildDirectiveUsageSchemaAddedMessage(args.meta), | ||
path: [args.meta.schemaTypeName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageSchemaRemoved | ||
function buildDirectiveUsageSchemaRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from schema '${args.schemaTypeName}'`; | ||
} | ||
export function directiveUsageSchemaRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from schema '${args.meta.schemaTypeName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageSchemaRemoved, | ||
message: buildDirectiveUsageSchemaRemovedMessage(args.meta), | ||
path: [args.meta.schemaTypeName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageScalarAdded | ||
function buildDirectiveUsageScalarAddedMessage(args) { | ||
return `Directive '${args.addedDirectiveName}' was added to scalar '${args.scalarName}'`; | ||
} | ||
export function directiveUsageScalarAddedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: addedSpecialDirective(args.meta.addedDirectiveName, CriticalityLevel.Dangerous), | ||
reason: `Directive '${args.meta.addedDirectiveName}' was added to scalar '${args.meta.scalarName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageScalarAdded, | ||
message: buildDirectiveUsageScalarAddedMessage(args.meta), | ||
path: [args.meta.scalarName, args.meta.addedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
// ChangeType.DirectiveUsageScalarRemoved | ||
function buildDirectiveUsageScalarRemovedMessage(args) { | ||
return `Directive '${args.removedDirectiveName}' was removed from scalar '${args.scalarName}'`; | ||
} | ||
export function directiveUsageScalarRemovedFromMeta(args) { | ||
return { | ||
criticality: { | ||
level: removedSpecialDirective(args.meta.removedDirectiveName, CriticalityLevel.Breaking), | ||
reason: `Directive '${args.meta.removedDirectiveName}' was removed from scalar '${args.meta.scalarName}'`, | ||
}, | ||
type: ChangeType.DirectiveUsageScalarRemoved, | ||
message: buildDirectiveUsageScalarRemovedMessage(args.meta), | ||
path: [args.meta.scalarName, args.meta.removedDirectiveName].join('.'), | ||
meta: args.meta, | ||
}; | ||
} | ||
export function directiveUsageAdded(kind, directive, payload) { | ||
if (isOfKind(kind, Kind.ARGUMENT, payload)) { | ||
return { | ||
return directiveUsageArgumentDefinitionAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageArgumentDefinitionAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to argument '${payload.argument.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to argument '${payload.argument.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
argumentName: payload.argument.name, | ||
addedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.type.name, | ||
}, | ||
path: [ | ||
payload.type.name, | ||
payload.field.name, | ||
payload.argument.name, | ||
directive.name.value, | ||
].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.INPUT_VALUE_DEFINITION, payload)) { | ||
return { | ||
type: ChangeType.DirectiveUsageArgumentDefinitionAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to argument '${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to argument '${payload.field.name}'`, | ||
return directiveUsageInputFieldDefinitionAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageInputFieldDefinitionAdded, | ||
meta: { | ||
argumentName: payload.field.name, | ||
addedDirectiveName: directive.name.value, | ||
fieldName: payload.type.name, | ||
typeName: payload.type.name, | ||
inputFieldName: payload.field.name, | ||
inputObjectName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.INPUT_OBJECT_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInputObjectAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageInputObjectAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to input object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to input object '${payload.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
addedInputFieldName: payload.getFields()[0].name, | ||
addedInputFieldType: payload.name, | ||
inputObjectName: payload.name, | ||
addedDirectiveName: directive.name.value, | ||
isAddedInputFieldTypeNullable: kind === Kind.INPUT_VALUE_DEFINITION, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.INTERFACE_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInterfaceAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageInterfaceAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to interface '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to interface '${payload.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
interfaceName: payload.name, | ||
addedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.OBJECT, payload)) { | ||
return { | ||
return directiveUsageObjectAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageObjectAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to object '${payload.name}'`, | ||
meta: { | ||
@@ -104,13 +438,7 @@ objectName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.ENUM_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageEnumAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to enum '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to enum '${payload.name}'`, | ||
meta: { | ||
@@ -120,45 +448,27 @@ enumName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.FIELD_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageFieldDefinitionAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageFieldDefinitionAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to field '${payload.parentType.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to field '${payload.parentType.name}.${payload.field.name}'`, | ||
meta: { | ||
addedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.parentType.name, | ||
fieldName: payload.field.name, | ||
addedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.parentType.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.UNION_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageUnionMemberAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageUnionMemberAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to union member '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to union member '${payload.name}'`, | ||
meta: { | ||
unionName: payload.name, | ||
addedDirectiveName: directive.name.value, | ||
addedUnionMemberTypeName: payload.name, | ||
unionName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.ENUM_VALUE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumValueAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageEnumValueAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to enum value '${payload.type.name}.${payload.value.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to enum value '${payload.type.name}.${payload.value.name}'`, | ||
meta: { | ||
@@ -169,13 +479,7 @@ enumName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.value.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.SCHEMA_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageSchemaAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageSchemaAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to schema`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to schema`, | ||
meta: { | ||
@@ -185,13 +489,7 @@ addedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.getQueryType()?.name || '', directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.SCALAR_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageScalarAddedFromMeta({ | ||
type: ChangeType.DirectiveUsageScalarAdded, | ||
criticality: { | ||
level: addedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was added to scalar '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was added to scalar '${payload.name}'`, | ||
meta: { | ||
@@ -201,4 +499,3 @@ scalarName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
@@ -209,78 +506,46 @@ return {}; | ||
if (isOfKind(kind, Kind.ARGUMENT, payload)) { | ||
return { | ||
return directiveUsageArgumentDefinitionRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageArgumentDefinitionRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from argument '${payload.type.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from argument '${payload.type.name}.${payload.field.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
argumentName: payload.argument.name, | ||
removedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.type.name, | ||
}, | ||
path: [ | ||
payload.type.name, | ||
payload.field.name, | ||
payload.argument.name, | ||
directive.name.value, | ||
].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.INPUT_VALUE_DEFINITION, payload)) { | ||
return { | ||
type: ChangeType.DirectiveUsageArgumentDefinitionRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from input value '${payload.type.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from input value '${payload.type.name}.${payload.field.name}'`, | ||
return directiveUsageInputFieldDefinitionRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageInputFieldDefinitionRemoved, | ||
meta: { | ||
argumentName: payload.field.name, | ||
removedDirectiveName: directive.name.value, | ||
fieldName: payload.type.name, | ||
typeName: payload.type.name, | ||
inputFieldName: payload.field.name, | ||
inputObjectName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.INPUT_OBJECT_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInputObjectRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageInputObjectRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from input object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from input object '${payload.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
removedInputFieldName: payload.getFields()[0].name, | ||
removedInputFieldType: payload.name, | ||
inputObjectName: payload.name, | ||
removedDirectiveName: directive.name.value, | ||
isRemovedInputFieldTypeNullable: kind === Kind.INPUT_VALUE_DEFINITION, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.INTERFACE_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageInterfaceRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageInterfaceRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Breaking), | ||
reason: `Directive '${directive.name.value}' was removed from interface '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from interface '${payload.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
interfaceName: payload.name, | ||
removedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.OBJECT, payload)) { | ||
return { | ||
return directiveUsageObjectRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageObjectRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from object '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from object '${payload.name}'`, | ||
meta: { | ||
@@ -290,13 +555,7 @@ objectName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.ENUM_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageEnumRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from enum '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from enum '${payload.name}'`, | ||
meta: { | ||
@@ -306,45 +565,27 @@ enumName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.FIELD_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageFieldDefinitionRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageFieldDefinitionRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from field '${payload.parentType.name}.${payload.field.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from field '${payload.parentType.name}.${payload.field.name}'`, | ||
meta: { | ||
removedDirectiveName: directive.name.value, | ||
fieldName: payload.field.name, | ||
typeName: payload.parentType.name, | ||
fieldName: payload.field.name, | ||
removedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.parentType.name, payload.field.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.UNION_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageUnionMemberRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageUnionMemberRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from union member '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from union member '${payload.name}'`, | ||
meta: { | ||
unionName: payload.name, | ||
removedDirectiveName: directive.name.value, | ||
removedUnionMemberTypeName: payload.name, | ||
unionName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.ENUM_VALUE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageEnumValueRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageEnumValueRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from enum value '${payload.type.name}.${payload.value.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from enum value '${payload.type.name}.${payload.value.name}'`, | ||
meta: { | ||
@@ -355,13 +596,7 @@ enumName: payload.type.name, | ||
}, | ||
path: [payload.type.name, payload.value.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.SCHEMA_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageSchemaRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageSchemaRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Dangerous), | ||
reason: `Directive '${directive.name.value}' was removed from schema`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from schema`, | ||
meta: { | ||
@@ -371,13 +606,7 @@ removedDirectiveName: directive.name.value, | ||
}, | ||
path: [payload.getQueryType()?.name || '', directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
if (isOfKind(kind, Kind.SCALAR_TYPE_DEFINITION, payload)) { | ||
return { | ||
return directiveUsageScalarRemovedFromMeta({ | ||
type: ChangeType.DirectiveUsageScalarRemoved, | ||
criticality: { | ||
level: removedSpecialDirective(directive.name.value, CriticalityLevel.Breaking), | ||
reason: `Directive '${directive.name.value}' was removed from scalar '${payload.name}'`, | ||
}, | ||
message: `Directive '${directive.name.value}' was removed from scalar '${payload.name}'`, | ||
meta: { | ||
@@ -387,4 +616,3 @@ scalarName: payload.name, | ||
}, | ||
path: [payload.name, directive.name.value].join('.'), | ||
}; | ||
}); | ||
} | ||
@@ -391,0 +619,0 @@ return {}; |
@@ -13,2 +13,3 @@ export * from './coverage/index.js'; | ||
export { fieldArgumentDescriptionChangedFromMeta, fieldArgumentDefaultChangedFromMeta, fieldArgumentTypeChangedFromMeta, } from './diff/changes/argument.js'; | ||
export { directiveUsageArgumentDefinitionAddedFromMeta, directiveUsageEnumAddedFromMeta, directiveUsageEnumRemovedFromMeta, directiveUsageArgumentDefinitionRemovedFromMeta, directiveUsageEnumValueAddedFromMeta, directiveUsageEnumValueRemovedFromMeta, directiveUsageFieldDefinitionAddedFromMeta, directiveUsageAdded, directiveUsageFieldDefinitionRemovedFromMeta, directiveUsageInputFieldDefinitionAddedFromMeta, directiveUsageInputFieldDefinitionRemovedFromMeta, directiveUsageInputObjectAddedFromMeta, directiveUsageInputObjectRemovedFromMeta, directiveUsageInterfaceAddedFromMeta, directiveUsageInterfaceRemovedFromMeta, directiveUsageObjectAddedFromMeta, directiveUsageObjectRemovedFromMeta, directiveUsageRemoved, directiveUsageScalarAddedFromMeta, directiveUsageScalarRemovedFromMeta, directiveUsageSchemaAddedFromMeta, directiveUsageSchemaRemovedFromMeta, directiveUsageUnionMemberAddedFromMeta, directiveUsageUnionMemberRemovedFromMeta, } from './diff/changes/directive-usage.js'; | ||
export { directiveRemovedFromMeta, directiveAddedFromMeta, directiveDescriptionChangedFromMeta, directiveLocationAddedFromMeta, directiveLocationRemovedFromMeta, directiveArgumentAddedFromMeta, directiveArgumentRemovedFromMeta, directiveArgumentDescriptionChangedFromMeta, directiveArgumentDefaultValueChangedFromMeta, directiveArgumentTypeChangedFromMeta, } from './diff/changes/directive.js'; | ||
@@ -15,0 +16,0 @@ export { enumValueRemovedFromMeta, enumValueAddedFromMeta, enumValueDescriptionChangedFromMeta, enumValueDeprecationReasonChangedFromMeta, enumValueDeprecationReasonAddedFromMeta, enumValueDeprecationReasonRemovedFromMeta, } from './diff/changes/enum.js'; |
{ | ||
"name": "@graphql-inspector/core", | ||
"version": "6.2.0-alpha-20241111152238-c5ae4cca01e177711e7f4629279aa18287d39a69", | ||
"version": "6.2.0-alpha-20241112103543-a90e1d92dfaa16080e66c0c89e829a11fbd5b072", | ||
"description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
import { ConstDirectiveNode, GraphQLArgument, GraphQLEnumType, GraphQLEnumValue, GraphQLField, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLScalarType, GraphQLSchema, GraphQLUnionType, Kind } from 'graphql'; | ||
import { Change, DirectiveUsageArgumentDefinitionChange, DirectiveUsageArgumentDefinitionRemovedChange, DirectiveUsageEnumAddedChange, DirectiveUsageEnumRemovedChange, DirectiveUsageEnumValueAddedChange, DirectiveUsageEnumValueRemovedChange, DirectiveUsageFieldDefinitionAddedChange, DirectiveUsageFieldDefinitionRemovedChange, DirectiveUsageInputObjectAddedChange, DirectiveUsageInputObjectRemovedChange, DirectiveUsageInterfaceAddedChange, DirectiveUsageInterfaceRemovedChange, DirectiveUsageObjectAddedChange, DirectiveUsageObjectRemovedChange, DirectiveUsageScalarAddedChange, DirectiveUsageScalarRemovedChange, DirectiveUsageSchemaAddedChange, DirectiveUsageSchemaRemovedChange, DirectiveUsageUnionMemberAddedChange, DirectiveUsageUnionMemberRemovedChange } from './change.js'; | ||
import { Change, CriticalityLevel, DirectiveUsageArgumentDefinitionChange, DirectiveUsageArgumentDefinitionRemovedChange, DirectiveUsageEnumAddedChange, DirectiveUsageEnumRemovedChange, DirectiveUsageEnumValueAddedChange, DirectiveUsageEnumValueRemovedChange, DirectiveUsageFieldDefinitionAddedChange, DirectiveUsageFieldDefinitionRemovedChange, DirectiveUsageInputFieldDefinitionAddedChange, DirectiveUsageInputFieldDefinitionRemovedChange, DirectiveUsageInputObjectAddedChange, DirectiveUsageInputObjectRemovedChange, DirectiveUsageInterfaceAddedChange, DirectiveUsageInterfaceRemovedChange, DirectiveUsageObjectAddedChange, DirectiveUsageObjectRemovedChange, DirectiveUsageScalarAddedChange, DirectiveUsageScalarRemovedChange, DirectiveUsageSchemaAddedChange, DirectiveUsageSchemaRemovedChange, DirectiveUsageUnionMemberAddedChange, DirectiveUsageUnionMemberRemovedChange } from './change.js'; | ||
type KindToPayload = { | ||
@@ -62,4 +62,308 @@ [Kind.ENUM_TYPE_DEFINITION]: { | ||
}; | ||
export declare function directiveUsageArgumentDefinitionAddedFromMeta(args: DirectiveUsageArgumentDefinitionChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to argument '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_ARGUMENT_DEFINITION_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
typeName: string; | ||
fieldName: string; | ||
argumentName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageArgumentDefinitionRemovedFromMeta(args: DirectiveUsageArgumentDefinitionRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from argument '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_ARGUMENT_DEFINITION_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
typeName: string; | ||
fieldName: string; | ||
argumentName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageInputObjectAddedFromMeta(args: DirectiveUsageInputObjectAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to input object '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_INPUT_OBJECT_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
inputObjectName: string; | ||
addedInputFieldName: string; | ||
isAddedInputFieldTypeNullable: boolean; | ||
addedInputFieldType: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageInputObjectRemovedFromMeta(args: DirectiveUsageInputObjectRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from input object '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_INPUT_OBJECT_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
inputObjectName: string; | ||
removedInputFieldName: string; | ||
isRemovedInputFieldTypeNullable: boolean; | ||
removedInputFieldType: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageInterfaceAddedFromMeta(args: DirectiveUsageInterfaceAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to interface '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_INTERFACE_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
interfaceName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageInterfaceRemovedFromMeta(args: DirectiveUsageInterfaceRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from interface '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_INTERFACE_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
interfaceName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageInputFieldDefinitionAddedFromMeta(args: DirectiveUsageInputFieldDefinitionAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to input field '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
inputObjectName: string; | ||
inputFieldName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageInputFieldDefinitionRemovedFromMeta(args: DirectiveUsageInputFieldDefinitionRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from input field '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_INPUT_FIELD_DEFINITION_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
inputObjectName: string; | ||
inputFieldName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageObjectAddedFromMeta(args: DirectiveUsageObjectAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to object '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_OBJECT_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
objectName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageObjectRemovedFromMeta(args: DirectiveUsageObjectRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from object '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_OBJECT_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
objectName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageEnumAddedFromMeta(args: DirectiveUsageEnumAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to enum '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_ENUM_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
enumName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageEnumRemovedFromMeta(args: DirectiveUsageEnumRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from enum '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_ENUM_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
enumName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageFieldDefinitionAddedFromMeta(args: DirectiveUsageFieldDefinitionAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to field '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_FIELD_DEFINITION_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
typeName: string; | ||
fieldName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageFieldDefinitionRemovedFromMeta(args: DirectiveUsageFieldDefinitionRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from field '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_FIELD_DEFINITION_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
typeName: string; | ||
fieldName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageUnionMemberAddedFromMeta(args: DirectiveUsageUnionMemberAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to union member '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_UNION_MEMBER_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
unionName: string; | ||
addedUnionMemberTypeName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageUnionMemberRemovedFromMeta(args: DirectiveUsageUnionMemberRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from union member '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_UNION_MEMBER_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
unionName: string; | ||
removedUnionMemberTypeName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageEnumValueAddedFromMeta(args: DirectiveUsageEnumValueAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to enum value '${string}.${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_ENUM_VALUE_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
enumName: string; | ||
enumValueName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageEnumValueRemovedFromMeta(args: DirectiveUsageEnumValueRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from enum value '${string}.${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_ENUM_VALUE_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
enumName: string; | ||
enumValueName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageSchemaAddedFromMeta(args: DirectiveUsageSchemaAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to schema '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_SCHEMA_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
addedDirectiveName: string; | ||
schemaTypeName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageSchemaRemovedFromMeta(args: DirectiveUsageSchemaRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from schema '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_SCHEMA_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
removedDirectiveName: string; | ||
schemaTypeName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageScalarAddedFromMeta(args: DirectiveUsageScalarAddedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was added to scalar '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_SCALAR_ADDED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
scalarName: string; | ||
addedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageScalarRemovedFromMeta(args: DirectiveUsageScalarRemovedChange): { | ||
readonly criticality: { | ||
readonly level: CriticalityLevel; | ||
readonly reason: `Directive '${string}' was removed from scalar '${string}'`; | ||
}; | ||
readonly type: "DIRECTIVE_USAGE_SCALAR_REMOVED"; | ||
readonly message: string; | ||
readonly path: string; | ||
readonly meta: { | ||
scalarName: string; | ||
removedDirectiveName: string; | ||
}; | ||
}; | ||
export declare function directiveUsageAdded<K extends keyof KindToPayload>(kind: K, directive: ConstDirectiveNode, payload: KindToPayload[K]['input']): Change; | ||
export declare function directiveUsageRemoved<K extends keyof KindToPayload>(kind: K, directive: ConstDirectiveNode, payload: KindToPayload[K]['input']): Change; | ||
export {}; |
@@ -14,2 +14,3 @@ export * from './coverage/index.js'; | ||
export { fieldArgumentDescriptionChangedFromMeta, fieldArgumentDefaultChangedFromMeta, fieldArgumentTypeChangedFromMeta, } from './diff/changes/argument.js'; | ||
export { directiveUsageArgumentDefinitionAddedFromMeta, directiveUsageEnumAddedFromMeta, directiveUsageEnumRemovedFromMeta, directiveUsageArgumentDefinitionRemovedFromMeta, directiveUsageEnumValueAddedFromMeta, directiveUsageEnumValueRemovedFromMeta, directiveUsageFieldDefinitionAddedFromMeta, directiveUsageAdded, directiveUsageFieldDefinitionRemovedFromMeta, directiveUsageInputFieldDefinitionAddedFromMeta, directiveUsageInputFieldDefinitionRemovedFromMeta, directiveUsageInputObjectAddedFromMeta, directiveUsageInputObjectRemovedFromMeta, directiveUsageInterfaceAddedFromMeta, directiveUsageInterfaceRemovedFromMeta, directiveUsageObjectAddedFromMeta, directiveUsageObjectRemovedFromMeta, directiveUsageRemoved, directiveUsageScalarAddedFromMeta, directiveUsageScalarRemovedFromMeta, directiveUsageSchemaAddedFromMeta, directiveUsageSchemaRemovedFromMeta, directiveUsageUnionMemberAddedFromMeta, directiveUsageUnionMemberRemovedFromMeta, } from './diff/changes/directive-usage.js'; | ||
export { directiveRemovedFromMeta, directiveAddedFromMeta, directiveDescriptionChangedFromMeta, directiveLocationAddedFromMeta, directiveLocationRemovedFromMeta, directiveArgumentAddedFromMeta, directiveArgumentRemovedFromMeta, directiveArgumentDescriptionChangedFromMeta, directiveArgumentDefaultValueChangedFromMeta, directiveArgumentTypeChangedFromMeta, } from './diff/changes/directive.js'; | ||
@@ -16,0 +17,0 @@ export { enumValueRemovedFromMeta, enumValueAddedFromMeta, enumValueDescriptionChangedFromMeta, enumValueDeprecationReasonChangedFromMeta, enumValueDeprecationReasonAddedFromMeta, enumValueDeprecationReasonRemovedFromMeta, } from './diff/changes/enum.js'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
566090
10354