mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server: Fix script execution error (closes #244)
This commit is contained in:
parent
40363f6e8e
commit
ab23459299
@ -63,7 +63,7 @@ interface Api {
|
|||||||
* Note where the script started executing (entrypoint).
|
* 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.
|
* 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
|
* 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
|
* 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
|
* Axios library for HTTP requests. See {@link https://axios-http.com} for documentation
|
||||||
|
@ -3,8 +3,8 @@ import AbstractBeccaEntity = require("../becca/entities/abstract_becca_entity");
|
|||||||
import BNote = require("../becca/entities/bnote");
|
import BNote = require("../becca/entities/bnote");
|
||||||
|
|
||||||
export interface ApiParams {
|
export interface ApiParams {
|
||||||
startNote?: BNote;
|
startNote?: BNote | null;
|
||||||
originEntity?: AbstractBeccaEntity<any>;
|
originEntity?: AbstractBeccaEntity<any> | null;
|
||||||
pathParams?: string[],
|
pathParams?: string[],
|
||||||
req?: Request,
|
req?: Request,
|
||||||
res?: Response
|
res?: Response
|
||||||
|
@ -95,10 +95,6 @@ function executeScript(script: string, params: ScriptParams, startNoteId: string
|
|||||||
throw new Error("Unable to determine script bundle.");
|
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 });
|
return executeBundle(bundle, { startNote, originEntity });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user