Fixes for tracex sandbox (#8804)

* Make possible to create with specific _id

Signed-off-by: Anna Khismatullina <anna.khismatullina@gmail.com>

* Add undefined check

Signed-off-by: Anna Khismatullina <anna.khismatullina@gmail.com>

---------

Signed-off-by: Anna Khismatullina <anna.khismatullina@gmail.com>
This commit is contained in:
Anna Khismatullina 2025-05-01 23:45:53 +07:00 committed by GitHub
parent cd0a687e47
commit 030d515ea6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -233,7 +233,7 @@ export class CardsProcessor {
const cardPath = path.join(currentDir, entry.name) const cardPath = path.join(currentDir, entry.name)
const { class: cardType, ...cardProps } = await readYamlHeader(cardPath) const { class: cardType, ...cardProps } = await readYamlHeader(cardPath)
if (cardType.startsWith('card:types:') === false) { if (cardType !== undefined && cardType.startsWith('card:types:') === false) {
throw new Error('Unsupported card type: ' + cardType + ' in ' + cardPath) throw new Error('Unsupported card type: ' + cardType + ' in ' + cardPath)
} }

View File

@ -230,7 +230,7 @@ export class WorkspaceInitializer {
vars: Record<string, any>, vars: Record<string, any>,
defaults: Map<Ref<Class<T>>, Props<T>> defaults: Map<Ref<Class<T>>, Props<T>>
): Promise<void> { ): Promise<void> {
const _id = generateId<T>() const _id = step.data._id ?? generateId<T>()
if (step.resultVariable !== undefined) { if (step.resultVariable !== undefined) {
vars[`\${${step.resultVariable}}`] = _id vars[`\${${step.resultVariable}}`] = _id
} }
@ -249,7 +249,7 @@ export class WorkspaceInitializer {
} }
} }
await this.create(step._class, data, _id) await this.create(step._class, data, _id as Ref<T>)
} }
private parseMarkdown (text: string): string { private parseMarkdown (text: string): string {