refactor(code-executor): migrate user scripts to single context argument
- replace (page, context, helpers) signature with async (context) => {}
- add ScriptContext interface exposing page, browser, env, getEnv,
getCredential, getStepOutput, runSnippet, dumpDom, log/warn/error
- rename getEnvUrl to getEnv throughout service and docs
- fix step ordering: normalizeStepOrder and run step rows are now 1-based
- migrate existing DB rows (scenario_steps, scenario_run_steps) +1
- update all tests and stored snippet/step code in DB to new API
This commit is contained in:
@@ -104,8 +104,8 @@ export class ScenarioService {
|
||||
});
|
||||
for (let i = 0; i < ordered.length; i += 1) {
|
||||
const step = ordered[i];
|
||||
if (step.order !== i) {
|
||||
step.order = i;
|
||||
if (step.order !== i + 1) {
|
||||
step.order = i + 1;
|
||||
await this.stepRepo.save(step);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ export class ScenarioService {
|
||||
const created = await this.stepRepo.save(
|
||||
this.stepRepo.create({
|
||||
...dto,
|
||||
order: currentCount,
|
||||
order: currentCount + 1,
|
||||
scenarioId,
|
||||
title: dto.title ?? null,
|
||||
execCode: dto.execCode ?? null,
|
||||
|
||||
Reference in New Issue
Block a user