@aws-amplify/graphql-transformer-core
Version:
A framework to transform from GraphQL SDL to AWS CloudFormation.
89 lines • 3.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphQLScalarJSONSchemaDefinition = exports.isDisallowedScalarType = exports.supportedScalarTypes = void 0;
const Boolean = {
type: 'boolean',
description: 'A boolean value.',
};
const Int = {
type: 'number',
description: 'A signed 32-bit integer value.',
};
const Float = {
type: 'number',
description: 'An IEEE 754 floating point value.',
};
const String = {
type: 'string',
description: 'A UTF-8 character sequence.',
};
const ID = {
type: 'string',
description: "A unique identifier for an object. This scalar is serialized like a String but isn't meant to be human-readable.",
};
const AWSJSON = {
type: 'string',
description: 'A JSON string. Any valid JSON construct is automatically parsed and loaded in the resolver code as maps, lists, or scalar values rather than as the literal input strings. Unquoted strings or otherwise invalid JSON result in a GraphQL validation error.',
};
const AWSEmail = {
type: 'string',
description: 'An email address in the format local-part@domain-part as defined by RFC 822.',
pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$',
};
const AWSDate = {
type: 'string',
description: 'An extended ISO 8601 date string in the format YYYY-MM-DD.',
pattern: '^\\d{4}-d{2}-d{2}$',
};
const AWSTime = {
type: 'string',
description: 'An extended ISO 8601 time string in the format hh:mm:ss.sss.',
pattern: '^\\d{2}:\\d{2}:\\d{2}\\.\\d{3}$',
};
const AWSDateTime = {
type: 'string',
description: 'An extended ISO 8601 date and time string in the format YYYY-MM-DDThh:mm:ss.sssZ.',
pattern: '^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$',
};
const AWSTimestamp = {
type: 'string',
description: 'An integer value representing the number of seconds before or after 1970-01-01-T00:00Z.',
pattern: '^\\d+$',
};
const AWSPhone = {
type: 'string',
description: 'A phone number. This value is stored as a string. Phone numbers can contain either spaces or hyphens to separate digit groups. Phone numbers without a country code are assumed to be US/North American numbers adhering to the North American Numbering Plan (NANP).',
pattern: '^\\d{3}-d{3}-d{4}$',
};
const AWSURL = {
type: 'string',
description: "A URL as defined by RFC 1738. For example, https://www.amazon.com/dp/B000NZW3KC/ or mailto:example@example.com. URLs must contain a schema (http, mailto) and can't contain two forward slashes (//) in the path part.",
pattern: '^(https?|mailto)://[^s/$.?#].[^s]*$',
};
const AWSIPAddress = {
type: 'string',
description: 'A valid IPv4 or IPv6 address. IPv4 addresses are expected in quad-dotted notation (123.12.34.56). IPv6 addresses are expected in non-bracketed, colon-separated format (1a2b:3c4b::1234:4567). You can include an optional CIDR suffix (123.45.67.89/16) to indicate subnet mask.',
};
const disallowedScalarTypes = ['AWSEmail', 'AWSDate', 'AWSTime', 'AWSDateTime', 'AWSTimestamp', 'AWSPhone', 'AWSURL', 'AWSIPAddress'];
exports.supportedScalarTypes = ['Boolean', 'Int', 'Float', 'String', 'ID', 'AWSJSON'];
const isDisallowedScalarType = (type) => {
return disallowedScalarTypes.includes(type);
};
exports.isDisallowedScalarType = isDisallowedScalarType;
exports.GraphQLScalarJSONSchemaDefinition = {
Boolean,
Int,
Float,
String,
AWSDateTime,
ID,
AWSJSON,
AWSEmail,
AWSDate,
AWSTime,
AWSTimestamp,
AWSPhone,
AWSURL,
AWSIPAddress,
};
//# sourceMappingURL=graphql-scalar-json-schema-definitions.js.map