@zeit/schemas
Advanced tools
Comparing version 2.0.2 to 2.0.3
const maxEnvLength = 100; | ||
const reservedEnvKeys = [ | ||
'NOW', | ||
// Questionable? | ||
'PATH', | ||
'HOME', | ||
'TEMP', | ||
// Legacy | ||
'AUTH_TOKEN', | ||
'DEPLOYMENT_ID', | ||
'REGISTRY_AUTH_TOKEN' | ||
]; | ||
const allowedEnvKey = [ | ||
'NOW_NPM_TOKEN' | ||
]; | ||
const EnvKey = { | ||
@@ -25,21 +7,3 @@ type: 'string', | ||
minLength: 1, | ||
maxLength: 256, | ||
allOf: [ | ||
{ | ||
not: { | ||
'enum': reservedEnvKeys | ||
} | ||
}, | ||
{ | ||
'if': { | ||
'enum': allowedEnvKey | ||
}, | ||
'then': {}, | ||
'else': { | ||
not: { | ||
pattern: '^NOW_.*$' | ||
} | ||
} | ||
} | ||
] | ||
maxLength: 256 | ||
}; | ||
@@ -46,0 +10,0 @@ |
{ | ||
"name": "@zeit/schemas", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "All schemas used for validation that are shared between our projects", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -65,29 +65,2 @@ /* eslint camelcase: 0 */ | ||
exports.test_env_keys_reserved = () => { | ||
let isValid = ajv.validate(EnvKeys, [ | ||
'FOO', | ||
'NOW' | ||
]); | ||
assert.equal(isValid, false); | ||
assert.equal(ajv.errors[0].keyword, 'not'); | ||
isValid = ajv.validate(EnvKeys, [ | ||
'NOW_DC' | ||
]); | ||
assert.equal(isValid, false); | ||
assert.equal(ajv.errors[0].keyword, 'not'); | ||
isValid = ajv.validate(EnvKeys, [ | ||
'NOW_FOO' | ||
]); | ||
assert.equal(isValid, false); | ||
assert.equal(ajv.errors[0].keyword, 'not'); | ||
isValid = ajv.validate(EnvKeys, [ | ||
'AUTH_TOKEN' | ||
]); | ||
assert.equal(isValid, false); | ||
assert.equal(ajv.errors[0].keyword, 'not'); | ||
}; | ||
// EnvObject | ||
@@ -117,9 +90,1 @@ exports.test_env_object_valid = () => { | ||
}; | ||
exports.test_env_keys_npm_token = () => { | ||
const isValid = ajv.validate(EnvKeys, [ | ||
'NOW_NPM_TOKEN' | ||
]); | ||
assert.equal(isValid, true); | ||
}; | ||
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
71703
679