Skip to content

Commit

Permalink
server: Fix script execution error (closes #244)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Jul 19, 2024
1 parent 40363f6 commit ab23459
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/services/backend_script_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 documentation
Expand Down
4 changes: 2 additions & 2 deletions src/services/backend_script_api_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?: Response
Expand Down
4 changes: 0 additions & 4 deletions src/services/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ function executeScript(script: string, params: ScriptParams, startNoteId: string
throw new Error("Unable to determine script bundle.");
}

if (!startNote || !originEntity) {
throw new Error("Missing start note or origin entity.");
}

return executeBundle(bundle, { startNote, originEntity });
}

Expand Down

0 comments on commit ab23459

Please sign in to comment.