Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7319711
value-not-existing-in-collection.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
987 B
Referenced Files
None
Subscribers
None
value-not-existing-in-collection.js
View Options
const
assert
=
require
(
"assert"
);
module
.
exports
=
app
=>
{
return
{
name
:
"value-not-existing-in-collection"
,
extends
:
"value-existing-in-collection"
,
is_proper_value
:
async
(
context
,
params
,
new_value
)
=>
{
assert
.
equal
(
typeof
params
.
field
,
"string"
);
assert
(
typeof
params
.
include_forbidden
===
"boolean"
||
params
.
include_forbidden
===
undefined
);
const
collection
=
params
.
collection
;
assert
(
collection
instanceof
app
.
Sealious
.
Collection
);
await
collection
.
fields
[
params
.
field
].
is_proper_value
(
context
,
new_value
);
if
(
params
.
include_forbidden
)
{
context
=
new
app
.
Sealious
.
SuperContext
();
}
const
matches
=
await
app
.
run_action
(
context
,
[
"collections"
,
collection
.
name
],
"show"
,
{
filter
:
{
[
params
.
field
]
:
new_value
}
}
);
if
(
matches
.
length
)
{
return
Promise
.
reject
(
`No
${
collection
.
name
}
with
${
params
.
field
}
set to
${
new_value
}
`
);
}
else
{
return
Promise
.
resolve
();
}
},
};
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 13, 06:51 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
817776
Default Alt Text
value-not-existing-in-collection.js (987 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment