- snapshot scenario and snippet content into version tables on every
content change; live tables keep holding the latest version
- record the scenario version on each run and copy its steps into the
run steps, so runs execute and show the version they were created with
- keep run step history when a step is deleted (FK set null)
- pin a snippet version with runSnippet('alias@N')
- add version picker to the run modal and version info across the UI
- add version list/get endpoints and MCP tools
- include version in exports and require it on import, restoring the
exact version by id + version
43 lines
994 B
TypeScript
43 lines
994 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from "typeorm";
|
|
|
|
@Entity("snippets")
|
|
export class SnippetEntity {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id: string;
|
|
|
|
/** Unique identifier used to invoke the snippet: helpers.runSnippet('mySnippet', ...) */
|
|
@Column({ unique: true, nullable: true })
|
|
alias: string;
|
|
|
|
/** Human-readable title displayed in the UI. */
|
|
@Column({ default: "" })
|
|
title: string;
|
|
|
|
@Column("text", { nullable: true })
|
|
description: string | null;
|
|
|
|
/**
|
|
* The snippet body — written as a regular async function body.
|
|
* It receives the same `page`, `context`, and `helpers` as exec code, plus
|
|
* any positional `...args` passed by the caller.
|
|
*/
|
|
@Column("text")
|
|
code: string;
|
|
|
|
/** Latest version number; incremented whenever the snippet changes. */
|
|
@Column({ type: "int", default: 1 })
|
|
version: number;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|