mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1018 B
33 lines
1018 B
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Squidex.Domain.Apps.Core.Contents;
|
|
using Squidex.Infrastructure.Json.Objects;
|
|
|
|
namespace Squidex.Domain.Apps.Core.Scripting;
|
|
|
|
public interface IAsyncScript : IDisposable
|
|
{
|
|
ValueTask<ContentData> TransformAsync(DataScriptVars vars,
|
|
CancellationToken ct = default);
|
|
|
|
ValueTask<JsonValue> ExecuteAsync(ScriptVars vars,
|
|
CancellationToken ct = default);
|
|
|
|
async ValueTask<bool> EvaluateAsync(ScriptVars vars,
|
|
CancellationToken ct = default)
|
|
{
|
|
try
|
|
{
|
|
return (await ExecuteAsync(vars, ct)).Equals(true);
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|