Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F12657051
email.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
989 B
Referenced Files
None
Subscribers
None
email.ts
View Options
import
{
Field
,
Context
}
from
"../../../main.js"
;
import
{
OpenApiTypes
}
from
"../../../schemas/open-api-types.js"
;
const
email
=
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
;
/** Stores an email address. Rejects values not formatted as an email address. Doesn't provide any configuration or advanced filters */
export
default
class
Email
extends
Field
<
string
>
{
typeName
=
"email"
;
open_api_type
:
OpenApiTypes
=
OpenApiTypes
.
EMAIL
;
async
isProperValue
(
context
:
Context
,
value
:
string
)
{
if
(
email
.
test
(
value
)
||
value
===
""
)
{
return
Field
.
valid
();
}
else
{
return
Field
.
invalid
(
context
.
i18n
`
${
value
}
is a not valid e-mail address.`
);
}
}
async
decode
(
_
:
Context
,
storage_value
:
string
|
null
)
:
Promise
<
string
|
null
>
{
return
storage_value
;
}
getPostgreSqlFieldDefinitions
()
:
string
[]
{
return
[
`"
${
this
.
name
}
" VARCHAR`
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Nov 28, 15:16 (11 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1061223
Default Alt Text
email.ts (989 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment