Merge pull request #2828 from balena-io/remove-package-resin-valid-email

Remove package `@resin.io/valid-email`
This commit is contained in:
flowzone-app[bot] 2024-09-12 22:59:27 +00:00 committed by GitHub
commit c25591cb4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 31 deletions

9
npm-shrinkwrap.json generated
View File

@ -15,7 +15,6 @@
"@balena/env-parsing": "^1.1.8", "@balena/env-parsing": "^1.1.8",
"@balena/es-version": "^1.0.1", "@balena/es-version": "^1.0.1",
"@oclif/core": "^4.0.8", "@oclif/core": "^4.0.8",
"@resin.io/valid-email": "^0.1.0",
"@sentry/node": "^6.16.1", "@sentry/node": "^6.16.1",
"balena-config-json": "^4.2.0", "balena-config-json": "^4.2.0",
"balena-device-init": "^7.0.1", "balena-device-init": "^7.0.1",
@ -2562,14 +2561,6 @@
"resolved": "https://registry.npmjs.org/@resin.io/types-home-or-tmp/-/types-home-or-tmp-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@resin.io/types-home-or-tmp/-/types-home-or-tmp-3.0.0.tgz",
"integrity": "sha1-PsiRM0Nv7msb7jkC8fluJgXXnU0=" "integrity": "sha1-PsiRM0Nv7msb7jkC8fluJgXXnU0="
}, },
"node_modules/@resin.io/valid-email": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@resin.io/valid-email/-/valid-email-0.1.0.tgz",
"integrity": "sha1-DnUwmoQ8AUqAqhSC+WmQYvL6UV0=",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/@ronomon/direct-io": { "node_modules/@ronomon/direct-io": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/@ronomon/direct-io/-/direct-io-3.0.1.tgz", "resolved": "https://registry.npmjs.org/@ronomon/direct-io/-/direct-io-3.0.1.tgz",

View File

@ -196,7 +196,6 @@
"@balena/env-parsing": "^1.1.8", "@balena/env-parsing": "^1.1.8",
"@balena/es-version": "^1.0.1", "@balena/es-version": "^1.0.1",
"@oclif/core": "^4.0.8", "@oclif/core": "^4.0.8",
"@resin.io/valid-email": "^0.1.0",
"@sentry/node": "^6.16.1", "@sentry/node": "^6.16.1",
"balena-config-json": "^4.2.0", "balena-config-json": "^4.2.0",
"balena-device-init": "^7.0.1", "balena-device-init": "^7.0.1",

View File

@ -13,10 +13,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import validEmail = require('@resin.io/valid-email');
import { ExpectedError } from '../errors'; import { ExpectedError } from '../errors';
// Sufficiently good email regex in order not to bring in another dependency.
const isValidEmail = (email: string): boolean => {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
};
const APPNAME_REGEX = new RegExp(/^[a-zA-Z0-9_-]+$/); const APPNAME_REGEX = new RegExp(/^[a-zA-Z0-9_-]+$/);
// An regex to detect an IP address, from https://www.regular-expressions.info/ip.html // An regex to detect an IP address, from https://www.regular-expressions.info/ip.html
const IP_REGEX = new RegExp( const IP_REGEX = new RegExp(
@ -26,7 +29,7 @@ const DOTLOCAL_REGEX = new RegExp(/^([a-zA-Z0-9-]+\.)+local$/);
const UUID_REGEX = new RegExp(/^[0-9a-f]+$/); const UUID_REGEX = new RegExp(/^[0-9a-f]+$/);
export function validateEmail(input: string) { export function validateEmail(input: string) {
if (!validEmail(input)) { if (!isValidEmail(input)) {
return 'Email is not valid'; return 'Email is not valid';
} }

View File

@ -1,18 +0,0 @@
/**
* @license
* Copyright 2019 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare module '@resin.io/valid-email';