{"version":3,"sources":["jsdelivr-header.js","/npm/@violinchris/graphql-custom-type-objects@1.0.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,aAAE,aAAY,KAAE,MAAS,QAAQ,WACjC,QAAU,QAAQ,yBAClB,MAAQ,QAAQ,uBAIhB,gBAAkB,CACtB,KAAM,QACN,YAAa,0EACb,UAAW,QAAS,WAAY,QAChC,YAAA,CAAa,GAEX,GAAI,EAAI,OAAS,KAAK,OACpB,MAAM,IAAI,aAAa,8CAAgD,EAAI,KAAM,CAAC,IAEpF,IAAI,QAAQ,EAAI,OACd,MAAM,IAAI,aALE,yCAKkB,CAAC,IAEjC,OAAO,EAAI,KACb,GAGI,cAAgB,CACpB,KAAM,MACN,YAAa,gDACb,UAAW,MAAO,WAAY,MAC9B,YAAA,CAAa,GAEX,GAAI,EAAI,OAAS,KAAK,OACpB,MAAM,IAAI,aAAa,8CAAgD,EAAI,KAAM,CAAC,IAEpF,IAAI,MAAM,EAAI,OACZ,MAAM,IAAI,aALE,+BAKkB,CAAC,IAEjC,OAAO,EAAI,KACb,GAGF,OAAO,QAAU,CACf,gCACA","file":"/npm/@violinchris/graphql-custom-type-objects@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@violinchris/graphql-custom-type-objects@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const { GraphQLError, Kind } = require('graphql');\nconst isEmail = require('validator/lib/isEmail');\nconst isURL = require('validator/lib/isURL');\n\n//console.log(Kind)\n\nconst emailTypeObject = {\n  name: 'Email',\n  description: 'The Email scalar type represents E-Mail addresses compliant to RFC 822.',\n  serialize: isEmail, parseValue: isEmail,\n  parseLiteral(ast) {\n    const error = 'Query error: Not a valid Email address'\n    if (ast.kind !== Kind.STRING) {\n      throw new GraphQLError('Query error: Can only parse strings got a: ' + ast.kind, [ast]);\n    }\n    if(!isEmail(ast.value)) {\n      throw new GraphQLError(error, [ast]);\n    }\n    return ast.value;\n  }\n}\n\nconst urlTypeObject = {\n  name: 'Url',\n  description: 'The URL scalar type represents URL addresses.',\n  serialize: isURL, parseValue: isURL,\n  parseLiteral(ast) {\n    const error = 'Query error: Not a valid Url'\n    if (ast.kind !== Kind.STRING) {\n      throw new GraphQLError('Query error: Can only parse strings got a: ' + ast.kind, [ast]);\n    }\n    if(!isURL(ast.value)) {\n      throw new GraphQLError(error, [ast]);\n    }\n    return ast.value;\n  }\n}\n\nmodule.exports = {\n  emailTypeObject,\n  urlTypeObject\n}\n"]}