From 030d515ea6136ac1206ca899e84b83169eafbe81 Mon Sep 17 00:00:00 2001 From: Anna Khismatullina Date: Thu, 1 May 2025 23:45:53 +0700 Subject: [PATCH] Fixes for tracex sandbox (#8804) * Make possible to create with specific _id Signed-off-by: Anna Khismatullina * Add undefined check Signed-off-by: Anna Khismatullina --------- Signed-off-by: Anna Khismatullina --- packages/importer/src/huly/cards.ts | 2 +- server/tool/src/initializer.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/importer/src/huly/cards.ts b/packages/importer/src/huly/cards.ts index b0b6ba3e24..dcdb8105c7 100644 --- a/packages/importer/src/huly/cards.ts +++ b/packages/importer/src/huly/cards.ts @@ -233,7 +233,7 @@ export class CardsProcessor { const cardPath = path.join(currentDir, entry.name) 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) } diff --git a/server/tool/src/initializer.ts b/server/tool/src/initializer.ts index 4d5bee8088..8c6738e548 100644 --- a/server/tool/src/initializer.ts +++ b/server/tool/src/initializer.ts @@ -230,7 +230,7 @@ export class WorkspaceInitializer { vars: Record, defaults: Map>, Props> ): Promise { - const _id = generateId() + const _id = step.data._id ?? generateId() if (step.resultVariable !== undefined) { 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) } private parseMarkdown (text: string): string {