graphql-transformer-common
Advanced tools
Comparing version 4.26.0-rds.0 to 4.26.0-rds-1.0
21
API.md
@@ -61,2 +61,5 @@ ## API Report File for "graphql-transformer-common" | ||
// @public (undocumented) | ||
export const directiveExists: (definition: ObjectTypeDefinitionNode, name: string) => DirectiveNode; | ||
// @public (undocumented) | ||
export function extendFieldWithDirectives(field: FieldDefinitionNode, directives: DirectiveNode[]): FieldDefinitionNode; | ||
@@ -71,2 +74,8 @@ | ||
// @public (undocumented) | ||
export const findMatchingField: (field: FieldDefinitionNode, objectType: ObjectTypeDefinitionNode, document: DocumentNode) => FieldDefinitionNode | undefined; | ||
// @public (undocumented) | ||
export const findObjectDefinition: (document: DocumentNode, name: string) => ObjectTypeDefinitionNode | undefined; | ||
// @public (undocumented) | ||
export class FunctionResourceIDs { | ||
@@ -90,2 +99,5 @@ // (undocumented) | ||
// @public (undocumented) | ||
export const getNonModelTypes: (document: DocumentNode) => DefinitionNode[]; | ||
// @public (undocumented) | ||
export function graphqlName(val: string): string; | ||
@@ -109,5 +121,14 @@ | ||
// @public (undocumented) | ||
export const isNamedType: (type: TypeNode) => boolean; | ||
// @public (undocumented) | ||
export const isNonModelType: (definition: DefinitionNode) => boolean; | ||
// @public (undocumented) | ||
export function isNonNullType(type: TypeNode): boolean; | ||
// @public (undocumented) | ||
export const isOfType: (type: TypeNode, name: string) => boolean; | ||
// @public (undocumented) | ||
export function isScalar(type: TypeNode): any; | ||
@@ -114,0 +135,0 @@ |
@@ -6,3 +6,3 @@ # Change Log | ||
# [4.26.0-rds.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.25.0...graphql-transformer-common@4.26.0-rds.0) (2023-08-07) | ||
# [4.26.0-rds-1.0](https://github.com/aws-amplify/amplify-category-api/compare/graphql-transformer-common@4.25.0...graphql-transformer-common@4.26.0-rds-1.0) (2023-08-28) | ||
@@ -9,0 +9,0 @@ ### Features |
@@ -1,2 +0,2 @@ | ||
import { ObjectTypeDefinitionNode, InputValueDefinitionNode, FieldDefinitionNode, TypeNode, SchemaDefinitionNode, OperationTypeNode, OperationTypeDefinitionNode, ObjectTypeExtensionNode, NamedTypeNode, NonNullTypeNode, ListTypeNode, ArgumentNode, DirectiveNode, EnumTypeDefinitionNode, ValueNode, InputObjectTypeDefinitionNode, UnionTypeDefinitionNode, DocumentNode } from 'graphql'; | ||
import { ObjectTypeDefinitionNode, InputValueDefinitionNode, FieldDefinitionNode, TypeNode, SchemaDefinitionNode, OperationTypeNode, OperationTypeDefinitionNode, ObjectTypeExtensionNode, NamedTypeNode, NonNullTypeNode, ListTypeNode, ArgumentNode, DirectiveNode, EnumTypeDefinitionNode, ValueNode, InputObjectTypeDefinitionNode, UnionTypeDefinitionNode, DocumentNode, DefinitionNode } from 'graphql'; | ||
type ScalarMap = { | ||
@@ -18,3 +18,3 @@ [k: string]: 'String' | 'Int' | 'Float' | 'Boolean' | 'ID'; | ||
export declare const isArrayOrObject: (type: TypeNode, enums: EnumTypeDefinitionNode[]) => boolean; | ||
export declare function isEnum(type: TypeNode, document: DocumentNode): import("graphql").DefinitionNode; | ||
export declare function isEnum(type: TypeNode, document: DocumentNode): DefinitionNode; | ||
export declare function getBaseType(type: TypeNode): string; | ||
@@ -44,3 +44,10 @@ export declare function isListType(type: TypeNode): boolean; | ||
export declare function makeListType(type: TypeNode): ListTypeNode; | ||
export declare const findMatchingField: (field: FieldDefinitionNode, objectType: ObjectTypeDefinitionNode, document: DocumentNode) => FieldDefinitionNode | undefined; | ||
export declare const findObjectDefinition: (document: DocumentNode, name: string) => ObjectTypeDefinitionNode | undefined; | ||
export declare const isNamedType: (type: TypeNode) => boolean; | ||
export declare const getNonModelTypes: (document: DocumentNode) => DefinitionNode[]; | ||
export declare const isNonModelType: (definition: DefinitionNode) => boolean; | ||
export declare const directiveExists: (definition: ObjectTypeDefinitionNode, name: string) => DirectiveNode; | ||
export declare const isOfType: (type: TypeNode, name: string) => boolean; | ||
export {}; | ||
//# sourceMappingURL=definition.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makeListType = exports.makeNonNullType = exports.makeNamedType = exports.makeInputValueDefinition = exports.makeValueNode = exports.makeArgument = exports.makeDirective = exports.makeField = exports.makeObjectDefinition = exports.makeInputObjectDefinition = exports.defineUnionType = exports.extendFieldWithDirectives = exports.extensionWithDirectives = exports.extensionWithFields = exports.blankObjectExtension = exports.blankObject = exports.makeSchema = exports.makeOperationType = exports.wrapNonNull = exports.unwrapNonNull = exports.getDirectiveArgument = exports.isNonNullType = exports.isListType = exports.getBaseType = exports.isEnum = exports.isArrayOrObject = exports.isScalarOrEnum = exports.isScalar = exports.attributeTypeFromScalar = exports.MAP_SCALARS = exports.NUMERIC_SCALARS = exports.DEFAULT_SCALARS = exports.APPSYNC_DEFINED_SCALARS = exports.STANDARD_SCALARS = void 0; | ||
exports.isOfType = exports.directiveExists = exports.isNonModelType = exports.getNonModelTypes = exports.isNamedType = exports.findObjectDefinition = exports.findMatchingField = exports.makeListType = exports.makeNonNullType = exports.makeNamedType = exports.makeInputValueDefinition = exports.makeValueNode = exports.makeArgument = exports.makeDirective = exports.makeField = exports.makeObjectDefinition = exports.makeInputObjectDefinition = exports.defineUnionType = exports.extendFieldWithDirectives = exports.extensionWithDirectives = exports.extensionWithFields = exports.blankObjectExtension = exports.blankObject = exports.makeSchema = exports.makeOperationType = exports.wrapNonNull = exports.unwrapNonNull = exports.getDirectiveArgument = exports.isNonNullType = exports.isListType = exports.getBaseType = exports.isEnum = exports.isArrayOrObject = exports.isScalarOrEnum = exports.isScalar = exports.attributeTypeFromScalar = exports.MAP_SCALARS = exports.NUMERIC_SCALARS = exports.DEFAULT_SCALARS = exports.APPSYNC_DEFINED_SCALARS = exports.STANDARD_SCALARS = void 0; | ||
const graphql_1 = require("graphql"); | ||
@@ -394,2 +394,47 @@ exports.STANDARD_SCALARS = { | ||
exports.makeListType = makeListType; | ||
const findMatchingField = (field, objectType, document) => { | ||
var _a, _b; | ||
const matchingObject = (0, exports.findObjectDefinition)(document, (_a = objectType === null || objectType === void 0 ? void 0 : objectType.name) === null || _a === void 0 ? void 0 : _a.value); | ||
if (!matchingObject) { | ||
return; | ||
} | ||
return (_b = matchingObject === null || matchingObject === void 0 ? void 0 : matchingObject.fields) === null || _b === void 0 ? void 0 : _b.find((f) => { var _a, _b; return ((_a = f === null || f === void 0 ? void 0 : f.name) === null || _a === void 0 ? void 0 : _a.value) === ((_b = field === null || field === void 0 ? void 0 : field.name) === null || _b === void 0 ? void 0 : _b.value); }); | ||
}; | ||
exports.findMatchingField = findMatchingField; | ||
const findObjectDefinition = (document, name) => { | ||
var _a; | ||
return (_a = document.definitions) === null || _a === void 0 ? void 0 : _a.find((def) => { var _a; return (def === null || def === void 0 ? void 0 : def.kind) === 'ObjectTypeDefinition' && ((_a = def === null || def === void 0 ? void 0 : def.name) === null || _a === void 0 ? void 0 : _a.value) === name; }); | ||
}; | ||
exports.findObjectDefinition = findObjectDefinition; | ||
const isNamedType = (type) => { | ||
var _a; | ||
return (type === null || type === void 0 ? void 0 : type.kind) === graphql_1.Kind.NAMED_TYPE || ((type === null || type === void 0 ? void 0 : type.kind) === graphql_1.Kind.NON_NULL_TYPE && ((_a = type === null || type === void 0 ? void 0 : type.type) === null || _a === void 0 ? void 0 : _a.kind) === graphql_1.Kind.NAMED_TYPE); | ||
}; | ||
exports.isNamedType = isNamedType; | ||
const getNonModelTypes = (document) => { | ||
var _a; | ||
const nonModels = (_a = document.definitions) === null || _a === void 0 ? void 0 : _a.filter((def) => (0, exports.isNonModelType)(def)); | ||
return nonModels; | ||
}; | ||
exports.getNonModelTypes = getNonModelTypes; | ||
const isNonModelType = (definition) => { | ||
return (definition === null || definition === void 0 ? void 0 : definition.kind) === 'ObjectTypeDefinition' && !(0, exports.directiveExists)(definition, 'model'); | ||
}; | ||
exports.isNonModelType = isNonModelType; | ||
const directiveExists = (definition, name) => { | ||
var _a; | ||
return (_a = definition === null || definition === void 0 ? void 0 : definition.directives) === null || _a === void 0 ? void 0 : _a.find((directive) => { var _a; return ((_a = directive === null || directive === void 0 ? void 0 : directive.name) === null || _a === void 0 ? void 0 : _a.value) === name; }); | ||
}; | ||
exports.directiveExists = directiveExists; | ||
const isOfType = (type, name) => { | ||
var _a; | ||
if (type.kind === graphql_1.Kind.NON_NULL_TYPE) { | ||
return (0, exports.isOfType)(type === null || type === void 0 ? void 0 : type.type, name); | ||
} | ||
if (!(0, exports.isNamedType)(type)) { | ||
return false; | ||
} | ||
return ((_a = type.name) === null || _a === void 0 ? void 0 : _a.value) === name; | ||
}; | ||
exports.isOfType = isOfType; | ||
//# sourceMappingURL=definition.js.map |
{ | ||
"name": "graphql-transformer-common", | ||
"version": "4.26.0-rds.0", | ||
"version": "4.26.0-rds-1.0", | ||
"description": "Common code and constants for AppSync Transformers", | ||
@@ -39,5 +39,5 @@ "repository": { | ||
"global": { | ||
"branches": 80, | ||
"functions": 80, | ||
"lines": 80 | ||
"branches": 30, | ||
"functions": 19, | ||
"lines": 30 | ||
} | ||
@@ -59,3 +59,3 @@ }, | ||
}, | ||
"gitHead": "ce50129f66540242a333df9b4ca76fb90cfc00ef" | ||
"gitHead": "223cc16f30e64ab18ac1eda6a31c68db7606c8b8" | ||
} |
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
224356
1575