Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
server: Fix script execution error (closes #244)
Elian Doranab234592990c
diff --git a/src/services/backend_script_api.ts b/src/services/backend_script_api.tsindex 9b72929a4e..29acac3880 100644--- a/src/services/backend_script_api.ts+++ b/src/services/backend_script_api.ts@@ -63,7 +63,7 @@ interface Api {* Note where the script started executing (entrypoint).* As an analogy, in C this would be the file which contains the main() function of the current process.*/- startNote?: BNote;+ startNote?: BNote | null;/*** Note where the script is currently executing. This comes into play when your script is spread in multiple code@@ -76,7 +76,7 @@ interface Api {/*** Entity whose event triggered this execution*/- originEntity?: AbstractBeccaEntity<any>;+ originEntity?: AbstractBeccaEntity<any> | null;/*** Axios library for HTTP requests. See {@link https://axios-http.com} for documentationdiff --git a/src/services/backend_script_api_interface.ts b/src/services/backend_script_api_interface.tsindex f74b65ad7f..5ffdf56c51 100644--- a/src/services/backend_script_api_interface.ts+++ b/src/services/backend_script_api_interface.ts@@ -3,8 +3,8 @@ import AbstractBeccaEntity = require("../becca/entities/abstract_becca_entity");import BNote = require("../becca/entities/bnote");export interface ApiParams {- startNote?: BNote;- originEntity?: AbstractBeccaEntity<any>;+ startNote?: BNote | null;+ originEntity?: AbstractBeccaEntity<any> | null;pathParams?: string[],req?: Request,res?: Responsediff --git a/src/services/script.ts b/src/services/script.tsindex 975964b18e..1a864353ae 100644--- a/src/services/script.ts+++ b/src/services/script.ts@@ -95,10 +95,6 @@ function executeScript(script: string, params: ScriptParams, startNoteId: stringthrow new Error("Unable to determine script bundle.");}- if (!startNote || !originEntity) {- throw new Error("Missing start note or origin entity.");- }-return executeBundle(bundle, { startNote, originEntity });}