Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22398303
disallow-update.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
disallow-update.ts
View Options
import
{
Field
,
Context
,
CollectionItem
}
from
"../../../main.js"
;
import
{
HybridField
,
type
ValidationResult
,
}
from
"../../../chip-types/field.js"
;
export
default
class
DisallowUpdate
<
DecodedType
,
InputType
,
StorageType
,
T
extends
Field
<
DecodedType
,
InputType
,
StorageType
>
,
>
extends
HybridField
<
DecodedType
,
InputType
,
StorageType
,
DecodedType
,
InputType
,
StorageType
,
T
>
{
typeName
=
"disallow-update"
;
async
builtinTransitionChecker
(
context
:
Context
,
old_value
:
DecodedType
|
undefined
,
new_value
:
DecodedType
)
:
Promise
<
ValidationResult
>
{
// forward to the inner type
if
(
old_value
===
undefined
)
{
return
await
this
.
virtual_field
.
builtinTransitionChecker
(
context
,
old_value
,
new_value
);
}
return
Field
.
invalid
(
context
.
i18n
`You cannot change a previously set value.`
);
}
async
isProperValue
(
context
:
Context
,
new_value
:
Parameters
<
T
[
"checkValue"
]
>
[
1
],
old_value
?:
Parameters
<
T
[
"checkValue"
]
>
[
2
],
new_value_blessing_token
:
symbol
|
null
=
null
,
item
:
CollectionItem
|
undefined
=
undefined
)
{
context
.
app
.
Logger
.
debug3
(
"DISALLOW-UPDATE"
,
"Checking if this field already has a value"
,
{
new_value
,
old_value
}
);
return
this
.
virtual_field
.
checkValue
(
context
,
new_value
,
old_value
,
new_value_blessing_token
,
item
);
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 17:21 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1212276
Default Alt Text
disallow-update.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline