feat: Add once for each item support for JS task runner (no-changelog) (#11109)

This commit is contained in:
Tomi Turtiainen
2024-10-07 21:18:32 +03:00
committed by GitHub
parent 1146c4e98d
commit 2bb1996738
23 changed files with 1104 additions and 142 deletions

View File

@@ -18,7 +18,6 @@ export class PythonSandbox extends Sandbox {
constructor(
context: SandboxContext,
private pythonCode: string,
itemIndex: number | undefined,
helpers: IExecuteFunctions['helpers'],
) {
super(
@@ -28,7 +27,6 @@ export class PythonSandbox extends Sandbox {
plural: 'dictionaries',
},
},
itemIndex,
helpers,
);
// Since python doesn't allow variable names starting with `$`,
@@ -39,8 +37,8 @@ export class PythonSandbox extends Sandbox {
}, {} as PythonSandboxContext);
}
async runCode(): Promise<unknown> {
return await this.runCodeInPython<unknown>();
async runCode<T = unknown>(): Promise<T> {
return await this.runCodeInPython<T>();
}
async runCodeAllItems() {
@@ -48,9 +46,9 @@ export class PythonSandbox extends Sandbox {
return this.validateRunCodeAllItems(executionResult);
}
async runCodeEachItem() {
async runCodeEachItem(itemIndex: number) {
const executionResult = await this.runCodeInPython<INodeExecutionData>();
return this.validateRunCodeEachItem(executionResult);
return this.validateRunCodeEachItem(executionResult, itemIndex);
}
private async runCodeInPython<T>() {