Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphcms/validation

Package Overview
Dependencies
Maintainers
9
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphcms/validation - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

dist/component.d.ts

6

CHANGELOG.md
# @graphcms/validation
## 1.4.2
### Patch Changes
- [#38](https://github.com/GraphCMS/validation/pull/38) [`7ed0a89`](https://github.com/GraphCMS/validation/commit/7ed0a89138efd7af900bf61eb998c23454732f3d) Thanks [@Harry-027](https://github.com/Harry-027)! - component validation
## 1.4.1

@@ -4,0 +10,0 @@

3

dist/index.d.ts

@@ -12,2 +12,3 @@ import * as authtoken from './authtoken';

import * as viewGroup from './viewGroup';
export { authtoken, enumeration, field, invite, model, project, role, stage, webhook, locale, viewGroup, };
import * as component from './component';
export { authtoken, enumeration, field, invite, model, project, role, stage, webhook, locale, viewGroup, component, };

@@ -24,3 +24,3 @@ var yup = require('yup');

var name$5 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).ensure().trim('The name of an authentication token may not start or end with white space characters.');
var description$4 = yup__namespace.string().nullable(true);
var description$5 = yup__namespace.string().nullable(true);
var scope = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).oneOf(['READ', 'WRITE', 'OPEN'], "An authentication token can only be set to one of 'READ', 'WRITE' or 'OPEN'");

@@ -31,3 +31,3 @@

name: name$5,
description: description$4,
description: description$5,
scope: scope

@@ -53,3 +53,3 @@ };

var apiId$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -97,3 +97,3 @@ test: function test(value) {

var displayName$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var displayName$5 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
/**

@@ -107,3 +107,3 @@ * Matcher for model descriptions:

var description$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var description$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
/**

@@ -122,3 +122,3 @@ * Matcher for enumeration api IDs:

var valueItemApiId = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a value.').max(191, 'Use a value that is shorter than 191 characters.').matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
var valueItemDisplayName = displayName$4;
var valueItemDisplayName = displayName$5;
var enumerationId = yup__namespace.string().strict(true);

@@ -128,5 +128,5 @@

__proto__: null,
apiId: apiId$3,
displayName: displayName$4,
description: description$3,
apiId: apiId$4,
displayName: displayName$5,
description: description$4,
valueItemApiId: valueItemApiId,

@@ -149,3 +149,3 @@ valueItemDisplayName: valueItemDisplayName,

var apiId$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -188,3 +188,3 @@ test: function test(value) {

var reverseRelationFieldApiId = apiId$2.concat(yup__namespace.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
var reverseRelationFieldApiId = apiId$3.concat(yup__namespace.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
/**

@@ -201,3 +201,3 @@ * Matcher for field display names:

var displayName$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', function (value) {
var displayName$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', function (value) {
if (!value) {

@@ -221,3 +221,3 @@ return true;

var description$2 = yup__namespace.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var description$3 = yup__namespace.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var isList = yup__namespace["boolean"]().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

@@ -230,6 +230,6 @@ var isHidden = yup__namespace["boolean"]().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

__proto__: null,
apiId: apiId$2,
apiId: apiId$3,
reverseRelationFieldApiId: reverseRelationFieldApiId,
displayName: displayName$3,
description: description$2,
displayName: displayName$4,
description: description$3,
isList: isList,

@@ -261,3 +261,3 @@ isHidden: isHidden,

var apiId$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -297,3 +297,3 @@ test: function test(value) {

var displayName$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
var displayName$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**

@@ -307,3 +307,3 @@ * Matcher for model descriptions:

var description$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var description$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var modelId = yup__namespace.string().strict(true);

@@ -317,5 +317,5 @@ var previewURLs = yup__namespace.array().of(yup__namespace.object().shape({

__proto__: null,
apiId: apiId$1,
displayName: displayName$2,
description: description$1,
apiId: apiId$2,
displayName: displayName$3,
description: description$2,
modelId: modelId,

@@ -329,3 +329,3 @@ previewURLs: previewURLs

var region = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').nullable(false).strict(true).min(1).oneOf(API_REGIONS, 'The region can only be one of these values: ${values}');
var description = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var description$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var url$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).url('The custom prisma endpoint must be a valid url!').test('no-end-with-management', 'The custom prisma endpoint may not end with "/management"', function (value) {

@@ -346,3 +346,3 @@ if (!value) return false;

region: region,
description: description,
description: description$1,
customPrisma: customPrisma

@@ -359,3 +359,3 @@ };

var name$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).trim('The name of a stage may not start or end with whitespace characters!').min(1, 'Enter a Name.').max(32, 'Choose a name that is shorter than 32 letters.').matches(new RegExp('^[a-zA-Z][a-zA-Z0-9_]*$'), 'Start with a letter, and use only alphanumeric characters and "_".');
var displayName$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');
var displayName$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');

@@ -365,3 +365,3 @@ var stage = {

name: name$2,
displayName: displayName$1
displayName: displayName$2
};

@@ -555,3 +555,3 @@

var apiId = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -566,8 +566,8 @@ test: function test(value) {

}).matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
var displayName = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var displayName$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var locale = {
__proto__: null,
apiId: apiId,
displayName: displayName
apiId: apiId$1,
displayName: displayName$1
};

@@ -582,3 +582,72 @@

/**
* Matcher for component api IDs:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .min() -> Sets minimum required length of string to 1 character
* .max() -> Sets maximum required length of string to 64 characters
* .required() -> Ensures that empty strings are treated as invalid value
* .test() -> Executes an arbitrary test on the input value
* .matches(:RegExpr) -> Matches the input value against a regular expression
*/
var apiId = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',
test: function test(value) {
return !graphQlTypeNames.some(function (reservedWord) {
return value ? reservedWord === value.toLowerCase() : false;
});
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).test({
name: 'no-reserved-word',
test: function test(value) {
var options = this.options;
if (options.context && options.context.isSystem) {
return true;
}
return !reservedModelApiIds.some(function (reservedWord) {
return value ? reservedWord.toLowerCase() === value.toLowerCase() : false;
});
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).matches(/^[A-Z][a-zA-Z0-9_]*$/, 'Start with a capital letter and use only alphanumeric characters and underscores.'); // <-- Those are validations enforced by prisma: https://github.com/graphcool/prisma/blob/master/server/servers/deploy/src/main/scala/com/prisma/deploy/validation/NameConstraints.scala
/**
* Matcher for component display names:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .required() -> Ensures that empty strings are treated as invalid value
*/
var displayName = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**
* Matcher for component descriptions:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .ensure() -> Transforms the values "undefined" and "null" into empty strings
*/
var description = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var componentId = yup__namespace.string().strict(true);
var component = {
__proto__: null,
apiId: apiId,
displayName: displayName,
description: description,
componentId: componentId
};
exports.authtoken = authtoken;
exports.component = component;
exports.enumeration = enumeration;

@@ -585,0 +654,0 @@ exports.field = field;

import * as yup from 'yup';
var name$5 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).ensure().trim('The name of an authentication token may not start or end with white space characters.');
var description$4 = yup.string().nullable(true);
var description$5 = yup.string().nullable(true);
var scope = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).oneOf(['READ', 'WRITE', 'OPEN'], "An authentication token can only be set to one of 'READ', 'WRITE' or 'OPEN'");

@@ -10,3 +10,3 @@

name: name$5,
description: description$4,
description: description$5,
scope: scope

@@ -32,3 +32,3 @@ };

var apiId$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -76,3 +76,3 @@ test: function test(value) {

var displayName$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var displayName$5 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
/**

@@ -86,3 +86,3 @@ * Matcher for model descriptions:

var description$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var description$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
/**

@@ -101,3 +101,3 @@ * Matcher for enumeration api IDs:

var valueItemApiId = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a value.').max(191, 'Use a value that is shorter than 191 characters.').matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
var valueItemDisplayName = displayName$4;
var valueItemDisplayName = displayName$5;
var enumerationId = yup.string().strict(true);

@@ -107,5 +107,5 @@

__proto__: null,
apiId: apiId$3,
displayName: displayName$4,
description: description$3,
apiId: apiId$4,
displayName: displayName$5,
description: description$4,
valueItemApiId: valueItemApiId,

@@ -128,3 +128,3 @@ valueItemDisplayName: valueItemDisplayName,

var apiId$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -167,3 +167,3 @@ test: function test(value) {

var reverseRelationFieldApiId = apiId$2.concat(yup.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
var reverseRelationFieldApiId = apiId$3.concat(yup.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
/**

@@ -180,3 +180,3 @@ * Matcher for field display names:

var displayName$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', function (value) {
var displayName$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', function (value) {
if (!value) {

@@ -200,3 +200,3 @@ return true;

var description$2 = yup.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var description$3 = yup.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var isList = yup["boolean"]().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

@@ -209,6 +209,6 @@ var isHidden = yup["boolean"]().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

__proto__: null,
apiId: apiId$2,
apiId: apiId$3,
reverseRelationFieldApiId: reverseRelationFieldApiId,
displayName: displayName$3,
description: description$2,
displayName: displayName$4,
description: description$3,
isList: isList,

@@ -240,3 +240,3 @@ isHidden: isHidden,

var apiId$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -276,3 +276,3 @@ test: function test(value) {

var displayName$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
var displayName$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**

@@ -286,3 +286,3 @@ * Matcher for model descriptions:

var description$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var description$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var modelId = yup.string().strict(true);

@@ -296,5 +296,5 @@ var previewURLs = yup.array().of(yup.object().shape({

__proto__: null,
apiId: apiId$1,
displayName: displayName$2,
description: description$1,
apiId: apiId$2,
displayName: displayName$3,
description: description$2,
modelId: modelId,

@@ -308,3 +308,3 @@ previewURLs: previewURLs

var region = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').nullable(false).strict(true).min(1).oneOf(API_REGIONS, 'The region can only be one of these values: ${values}');
var description = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var description$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var url$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).url('The custom prisma endpoint must be a valid url!').test('no-end-with-management', 'The custom prisma endpoint may not end with "/management"', function (value) {

@@ -325,3 +325,3 @@ if (!value) return false;

region: region,
description: description,
description: description$1,
customPrisma: customPrisma

@@ -338,3 +338,3 @@ };

var name$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).trim('The name of a stage may not start or end with whitespace characters!').min(1, 'Enter a Name.').max(32, 'Choose a name that is shorter than 32 letters.').matches(new RegExp('^[a-zA-Z][a-zA-Z0-9_]*$'), 'Start with a letter, and use only alphanumeric characters and "_".');
var displayName$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');
var displayName$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');

@@ -344,3 +344,3 @@ var stage = {

name: name$2,
displayName: displayName$1
displayName: displayName$2
};

@@ -534,3 +534,3 @@

var apiId = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -545,8 +545,8 @@ test: function test(value) {

}).matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
var displayName = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var displayName$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var locale = {
__proto__: null,
apiId: apiId,
displayName: displayName
apiId: apiId$1,
displayName: displayName$1
};

@@ -561,3 +561,71 @@

export { authtoken, enumeration, field, invite, locale, model, project, role, stage, viewGroup, webhook };
/**
* Matcher for component api IDs:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .min() -> Sets minimum required length of string to 1 character
* .max() -> Sets maximum required length of string to 64 characters
* .required() -> Ensures that empty strings are treated as invalid value
* .test() -> Executes an arbitrary test on the input value
* .matches(:RegExpr) -> Matches the input value against a regular expression
*/
var apiId = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',
test: function test(value) {
return !graphQlTypeNames.some(function (reservedWord) {
return value ? reservedWord === value.toLowerCase() : false;
});
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).test({
name: 'no-reserved-word',
test: function test(value) {
var options = this.options;
if (options.context && options.context.isSystem) {
return true;
}
return !reservedModelApiIds.some(function (reservedWord) {
return value ? reservedWord.toLowerCase() === value.toLowerCase() : false;
});
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).matches(/^[A-Z][a-zA-Z0-9_]*$/, 'Start with a capital letter and use only alphanumeric characters and underscores.'); // <-- Those are validations enforced by prisma: https://github.com/graphcool/prisma/blob/master/server/servers/deploy/src/main/scala/com/prisma/deploy/validation/NameConstraints.scala
/**
* Matcher for component display names:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .required() -> Ensures that empty strings are treated as invalid value
*/
var displayName = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**
* Matcher for component descriptions:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .ensure() -> Transforms the values "undefined" and "null" into empty strings
*/
var description = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var componentId = yup.string().strict(true);
var component = {
__proto__: null,
apiId: apiId,
displayName: displayName,
description: description,
componentId: componentId
};
export { authtoken, component, enumeration, field, invite, locale, model, project, role, stage, viewGroup, webhook };
//# sourceMappingURL=validation.m.js.map
import * as yup from 'yup';
const name$5 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).ensure().trim('The name of an authentication token may not start or end with white space characters.');
const description$4 = yup.string().nullable(true);
const description$5 = yup.string().nullable(true);
const scope = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).oneOf(['READ', 'WRITE', 'OPEN'], "An authentication token can only be set to one of 'READ', 'WRITE' or 'OPEN'");

@@ -10,3 +10,3 @@

name: name$5,
description: description$4,
description: description$5,
scope: scope

@@ -32,3 +32,3 @@ };

const apiId$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
const apiId$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -68,3 +68,3 @@ test: value => !graphQlTypeNames.some(reservedWord => value ? reservedWord === value.toLowerCase() : false),

const displayName$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
const displayName$5 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
/**

@@ -78,3 +78,3 @@ * Matcher for model descriptions:

const description$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
const description$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
/**

@@ -93,3 +93,3 @@ * Matcher for enumeration api IDs:

const valueItemApiId = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a value.').max(191, 'Use a value that is shorter than 191 characters.').matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
const valueItemDisplayName = displayName$4;
const valueItemDisplayName = displayName$5;
const enumerationId = yup.string().strict(true);

@@ -99,5 +99,5 @@

__proto__: null,
apiId: apiId$3,
displayName: displayName$4,
description: description$3,
apiId: apiId$4,
displayName: displayName$5,
description: description$4,
valueItemApiId: valueItemApiId,

@@ -120,3 +120,3 @@ valueItemDisplayName: valueItemDisplayName,

const apiId$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
const apiId$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -153,3 +153,3 @@ test: value => !graphQlTypeNames.some(reservedWord => value ? reservedWord === value.toLowerCase() : false),

const reverseRelationFieldApiId = apiId$2.concat(yup.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
const reverseRelationFieldApiId = apiId$3.concat(yup.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
/**

@@ -166,3 +166,3 @@ * Matcher for field display names:

const displayName$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', value => {
const displayName$4 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', value => {
if (!value) {

@@ -186,3 +186,3 @@ return true;

const description$2 = yup.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
const description$3 = yup.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
const isList = yup.boolean().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

@@ -195,6 +195,6 @@ const isHidden = yup.boolean().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

__proto__: null,
apiId: apiId$2,
apiId: apiId$3,
reverseRelationFieldApiId: reverseRelationFieldApiId,
displayName: displayName$3,
description: description$2,
displayName: displayName$4,
description: description$3,
isList: isList,

@@ -226,3 +226,3 @@ isHidden: isHidden,

const apiId$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
const apiId$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -256,3 +256,3 @@ test: value => !graphQlTypeNames.some(reservedWord => value ? reservedWord === value.toLowerCase() : false),

const displayName$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
const displayName$3 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**

@@ -266,3 +266,3 @@ * Matcher for model descriptions:

const description$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
const description$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
const modelId = yup.string().strict(true);

@@ -276,5 +276,5 @@ const previewURLs = yup.array().of(yup.object().shape({

__proto__: null,
apiId: apiId$1,
displayName: displayName$2,
description: description$1,
apiId: apiId$2,
displayName: displayName$3,
description: description$2,
modelId: modelId,

@@ -288,3 +288,3 @@ previewURLs: previewURLs

const region = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').nullable(false).strict(true).min(1).oneOf(API_REGIONS, 'The region can only be one of these values: ${values}');
const description = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
const description$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
const url$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).url('The custom prisma endpoint must be a valid url!').test('no-end-with-management', 'The custom prisma endpoint may not end with "/management"', value => {

@@ -305,3 +305,3 @@ if (!value) return false;

region: region,
description: description,
description: description$1,
customPrisma: customPrisma

@@ -318,3 +318,3 @@ };

const name$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).trim('The name of a stage may not start or end with whitespace characters!').min(1, 'Enter a Name.').max(32, 'Choose a name that is shorter than 32 letters.').matches(new RegExp('^[a-zA-Z][a-zA-Z0-9_]*$'), 'Start with a letter, and use only alphanumeric characters and "_".');
const displayName$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');
const displayName$2 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');

@@ -324,3 +324,3 @@ var stage = {

name: name$2,
displayName: displayName$1
displayName: displayName$2
};

@@ -512,3 +512,3 @@

const apiId = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
const apiId$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -519,8 +519,8 @@ test: value => !graphQlTypeNames.some(reservedWord => value ? reservedWord === value.toLowerCase() : false),

}).matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
const displayName = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
const displayName$1 = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var locale = {
__proto__: null,
apiId: apiId,
displayName: displayName
apiId: apiId$1,
displayName: displayName$1
};

@@ -535,3 +535,65 @@

export { authtoken, enumeration, field, invite, locale, model, project, role, stage, viewGroup, webhook };
/**
* Matcher for component api IDs:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .min() -> Sets minimum required length of string to 1 character
* .max() -> Sets maximum required length of string to 64 characters
* .required() -> Ensures that empty strings are treated as invalid value
* .test() -> Executes an arbitrary test on the input value
* .matches(:RegExpr) -> Matches the input value against a regular expression
*/
const apiId = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',
test: value => !graphQlTypeNames.some(reservedWord => value ? reservedWord === value.toLowerCase() : false),
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).test({
name: 'no-reserved-word',
test: function (value) {
const options = this.options;
if (options.context && options.context.isSystem) {
return true;
}
return !reservedModelApiIds.some(reservedWord => value ? reservedWord.toLowerCase() === value.toLowerCase() : false);
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).matches(/^[A-Z][a-zA-Z0-9_]*$/, 'Start with a capital letter and use only alphanumeric characters and underscores.'); // <-- Those are validations enforced by prisma: https://github.com/graphcool/prisma/blob/master/server/servers/deploy/src/main/scala/com/prisma/deploy/validation/NameConstraints.scala
/**
* Matcher for component display names:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .required() -> Ensures that empty strings are treated as invalid value
*/
const displayName = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**
* Matcher for component descriptions:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .ensure() -> Transforms the values "undefined" and "null" into empty strings
*/
const description = yup.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
const componentId = yup.string().strict(true);
var component = {
__proto__: null,
apiId: apiId,
displayName: displayName,
description: description,
componentId: componentId
};
export { authtoken, component, enumeration, field, invite, locale, model, project, role, stage, viewGroup, webhook };
//# sourceMappingURL=validation.modern.js.map

@@ -27,3 +27,3 @@ (function (global, factory) {

var name$5 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).ensure().trim('The name of an authentication token may not start or end with white space characters.');
var description$4 = yup__namespace.string().nullable(true);
var description$5 = yup__namespace.string().nullable(true);
var scope = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).oneOf(['READ', 'WRITE', 'OPEN'], "An authentication token can only be set to one of 'READ', 'WRITE' or 'OPEN'");

@@ -34,3 +34,3 @@

name: name$5,
description: description$4,
description: description$5,
scope: scope

@@ -56,3 +56,3 @@ };

var apiId$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -100,3 +100,3 @@ test: function test(value) {

var displayName$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var displayName$5 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
/**

@@ -110,3 +110,3 @@ * Matcher for model descriptions:

var description$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var description$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
/**

@@ -125,3 +125,3 @@ * Matcher for enumeration api IDs:

var valueItemApiId = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a value.').max(191, 'Use a value that is shorter than 191 characters.').matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
var valueItemDisplayName = displayName$4;
var valueItemDisplayName = displayName$5;
var enumerationId = yup__namespace.string().strict(true);

@@ -131,5 +131,5 @@

__proto__: null,
apiId: apiId$3,
displayName: displayName$4,
description: description$3,
apiId: apiId$4,
displayName: displayName$5,
description: description$4,
valueItemApiId: valueItemApiId,

@@ -152,3 +152,3 @@ valueItemDisplayName: valueItemDisplayName,

var apiId$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -191,3 +191,3 @@ test: function test(value) {

var reverseRelationFieldApiId = apiId$2.concat(yup__namespace.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
var reverseRelationFieldApiId = apiId$3.concat(yup__namespace.string().max(64, 'The API ID of a field may not exceed 64 characters.'));
/**

@@ -204,3 +204,3 @@ * Matcher for field display names:

var displayName$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', function (value) {
var displayName$4 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name.').max(64, 'The Display Name of a field may not exceed 64characters.').test('no-letter', 'Enter a Display Name.', function (value) {
if (!value) {

@@ -224,3 +224,3 @@ return true;

var description$2 = yup__namespace.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var description$3 = yup__namespace.string().nullable(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var isList = yup__namespace["boolean"]().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

@@ -233,6 +233,6 @@ var isHidden = yup__namespace["boolean"]().strict(true).typeError('The supplied value "${value}" of type "${type}" is not compatible with type "boolean"!');

__proto__: null,
apiId: apiId$2,
apiId: apiId$3,
reverseRelationFieldApiId: reverseRelationFieldApiId,
displayName: displayName$3,
description: description$2,
displayName: displayName$4,
description: description$3,
isList: isList,

@@ -264,3 +264,3 @@ isHidden: isHidden,

var apiId$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -300,3 +300,3 @@ test: function test(value) {

var displayName$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
var displayName$3 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**

@@ -310,3 +310,3 @@ * Matcher for model descriptions:

var description$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var description$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var modelId = yup__namespace.string().strict(true);

@@ -320,5 +320,5 @@ var previewURLs = yup__namespace.array().of(yup__namespace.object().shape({

__proto__: null,
apiId: apiId$1,
displayName: displayName$2,
description: description$1,
apiId: apiId$2,
displayName: displayName$3,
description: description$2,
modelId: modelId,

@@ -332,3 +332,3 @@ previewURLs: previewURLs

var region = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').nullable(false).strict(true).min(1).oneOf(API_REGIONS, 'The region can only be one of these values: ${values}');
var description = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var description$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!');
var url$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1).url('The custom prisma endpoint must be a valid url!').test('no-end-with-management', 'The custom prisma endpoint may not end with "/management"', function (value) {

@@ -349,3 +349,3 @@ if (!value) return false;

region: region,
description: description,
description: description$1,
customPrisma: customPrisma

@@ -362,3 +362,3 @@ };

var name$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).trim('The name of a stage may not start or end with whitespace characters!').min(1, 'Enter a Name.').max(32, 'Choose a name that is shorter than 32 letters.').matches(new RegExp('^[a-zA-Z][a-zA-Z0-9_]*$'), 'Start with a letter, and use only alphanumeric characters and "_".');
var displayName$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');
var displayName$2 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Choose a Display Name.').trim('Display names may not have leading or trailing whitespaces.');

@@ -368,3 +368,3 @@ var stage = {

name: name$2,
displayName: displayName$1
displayName: displayName$2
};

@@ -558,3 +558,3 @@

var apiId = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
var apiId$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter an Api Id.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',

@@ -569,8 +569,8 @@ test: function test(value) {

}).matches(/^[a-zA-Z][a-zA-Z0-9_]*$/, 'Start with a letter, and use only alphanumeric characters or underscores.');
var displayName = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var displayName$1 = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').min(1, 'Enter a Display Name.').trim('The display name may not have leading or trailing whitespaces.');
var locale = {
__proto__: null,
apiId: apiId,
displayName: displayName
apiId: apiId$1,
displayName: displayName$1
};

@@ -585,3 +585,72 @@

/**
* Matcher for component api IDs:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .min() -> Sets minimum required length of string to 1 character
* .max() -> Sets maximum required length of string to 64 characters
* .required() -> Ensures that empty strings are treated as invalid value
* .test() -> Executes an arbitrary test on the input value
* .matches(:RegExpr) -> Matches the input value against a regular expression
*/
var apiId = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter an Api ID.').max(64, 'Use an Api Id that is shorter than 64 characters.').test({
name: 'no-graphql-type',
test: function test(value) {
return !graphQlTypeNames.some(function (reservedWord) {
return value ? reservedWord === value.toLowerCase() : false;
});
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).test({
name: 'no-reserved-word',
test: function test(value) {
var options = this.options;
if (options.context && options.context.isSystem) {
return true;
}
return !reservedModelApiIds.some(function (reservedWord) {
return value ? reservedWord.toLowerCase() === value.toLowerCase() : false;
});
},
message: '"${value}" is a restricted word and cannot be used here.',
exclusive: false
}).matches(/^[A-Z][a-zA-Z0-9_]*$/, 'Start with a capital letter and use only alphanumeric characters and underscores.'); // <-- Those are validations enforced by prisma: https://github.com/graphcool/prisma/blob/master/server/servers/deploy/src/main/scala/com/prisma/deploy/validation/NameConstraints.scala
/**
* Matcher for component display names:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .strict(:boolean) -> Prevents manipulation of the string during validation
* .required() -> Ensures that empty strings are treated as invalid value
*/
var displayName = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').strict(true).min(1, 'Enter a Display Name').trim('Display names may not have leading or trailing whitespaces.');
/**
* Matcher for component descriptions:
*
* .string() -> Ensures that only strings can be validated with success
* .typeError(:string)-> Ensures that types other than string return false
* .ensure() -> Transforms the values "undefined" and "null" into empty strings
*/
var description = yup__namespace.string().typeError('The supplied value "${value}" of type "${type}" is not compatible with type "string"!').ensure();
var componentId = yup__namespace.string().strict(true);
var component = {
__proto__: null,
apiId: apiId,
displayName: displayName,
description: description,
componentId: componentId
};
exports.authtoken = authtoken;
exports.component = component;
exports.enumeration = enumeration;

@@ -588,0 +657,0 @@ exports.field = field;

{
"name": "@graphcms/validation",
"version": "1.4.1",
"version": "1.4.2",
"main": "dist/validation.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc