mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
Rename scriptApi to qqqScriptUtils, putting that into context;
This commit is contained in:
@ -142,6 +142,7 @@ public class ExecuteCodeAction
|
|||||||
executeCodeInput.setCodeReference(new QCodeReference().withInlineCode(scriptRevision.getContents()).withCodeType(QCodeType.JAVA_SCRIPT)); // todo - code type as attribute of script!!
|
executeCodeInput.setCodeReference(new QCodeReference().withInlineCode(scriptRevision.getContents()).withCodeType(QCodeType.JAVA_SCRIPT)); // todo - code type as attribute of script!!
|
||||||
|
|
||||||
ExecuteCodeAction.addApiUtilityToContext(context, scriptRevision);
|
ExecuteCodeAction.addApiUtilityToContext(context, scriptRevision);
|
||||||
|
context.put("qqq", new QqqScriptUtils());
|
||||||
ExecuteCodeAction.setExecutionLoggerInExecuteCodeInput(input, scriptRevision, executeCodeInput);
|
ExecuteCodeAction.setExecutionLoggerInExecuteCodeInput(input, scriptRevision, executeCodeInput);
|
||||||
|
|
||||||
return (executeCodeInput);
|
return (executeCodeInput);
|
||||||
|
@ -49,11 +49,15 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
|||||||
** etc, plus object constructors).
|
** etc, plus object constructors).
|
||||||
**
|
**
|
||||||
** Before scripts knew about the API, this class made sense and was used.
|
** Before scripts knew about the API, this class made sense and was used.
|
||||||
** But, now that scripts do know about the API, it feels like this class could
|
** But, when scripts gained knowledge of the API, then it felt like this class could
|
||||||
** be deleted... but, what about, a QQQ deployment without the API module...
|
** be deleted... but, what about, a QQQ deployment without the API module...
|
||||||
** In that case, we might still want this class... think about it.
|
** In that case, we might still want this class... think about it.
|
||||||
|
**
|
||||||
|
** And/Or - it turns out - sometimes using QQQ directly is "better" (?) than using
|
||||||
|
** an api - so - this object may be available for other use cases (e.g., getting
|
||||||
|
** a record's backendDetails (e.g., for full json from a source backend api)).
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public class ScriptApi implements Serializable
|
public class QqqScriptUtils implements Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
@ -81,6 +81,9 @@ public interface TestScriptActionInterface
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
default void execute(TestScriptInput input, TestScriptOutput output) throws QException
|
default void execute(TestScriptInput input, TestScriptOutput output) throws QException
|
||||||
{
|
{
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// todo - could this be merged with the various other script runners, to use ExecuteCodeAction.setupExecuteCodeInput?? //
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
ExecuteCodeInput executeCodeInput = new ExecuteCodeInput();
|
ExecuteCodeInput executeCodeInput = new ExecuteCodeInput();
|
||||||
executeCodeInput.setContext(new HashMap<>());
|
executeCodeInput.setContext(new HashMap<>());
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Unit test for com.kingsrook.qqq.backend.core.actions.scripts.ScriptApi
|
** Unit test for com.kingsrook.qqq.backend.core.actions.scripts.ScriptApi
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
class ScriptApiTest extends BaseTest
|
class QqqScriptUtilsTest extends BaseTest
|
||||||
{
|
{
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@ -49,7 +49,7 @@ class ScriptApiTest extends BaseTest
|
|||||||
@Test
|
@Test
|
||||||
void test() throws QException
|
void test() throws QException
|
||||||
{
|
{
|
||||||
ScriptApi api = new ScriptApi();
|
QqqScriptUtils api = new QqqScriptUtils();
|
||||||
assertThat(api.newFilterCriteria()).isInstanceOf(QFilterCriteria.class);
|
assertThat(api.newFilterCriteria()).isInstanceOf(QFilterCriteria.class);
|
||||||
assertThat(api.newFilterOrderBy()).isInstanceOf(QFilterOrderBy.class);
|
assertThat(api.newFilterOrderBy()).isInstanceOf(QFilterOrderBy.class);
|
||||||
assertThat(api.newQueryFilter()).isInstanceOf(QQueryFilter.class);
|
assertThat(api.newQueryFilter()).isInstanceOf(QQueryFilter.class);
|
Reference in New Issue
Block a user