@tstdl/base 0.93.49 → 0.93.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/ai.service.js +1 -1
- package/orm/server/repository.js +8 -9
- package/package.json +1 -1
package/ai/ai.service.js
CHANGED
|
@@ -468,7 +468,7 @@ export function mergeGenerationStreamItems(items, schema) {
|
|
|
468
468
|
parsed = JSON.parse(this.text);
|
|
469
469
|
}
|
|
470
470
|
catch (error) {
|
|
471
|
-
throw new
|
|
471
|
+
throw new SyntaxError(`Failed to parse model output as JSON. Raw text: "${this.text}"`, { cause: error });
|
|
472
472
|
}
|
|
473
473
|
return Schema.parse(schema, parsed, { coerce: true });
|
|
474
474
|
},
|
package/orm/server/repository.js
CHANGED
|
@@ -457,9 +457,12 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
457
457
|
*/
|
|
458
458
|
async hasByQuery(query) {
|
|
459
459
|
const sqlQuery = this.convertQuery(query);
|
|
460
|
-
const result = await this.session
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
const result = await this.session
|
|
461
|
+
.select({ value: sql `1` })
|
|
462
|
+
.from(this.#table)
|
|
463
|
+
.where(sqlQuery)
|
|
464
|
+
.limit(1);
|
|
465
|
+
return result.length > 0;
|
|
463
466
|
}
|
|
464
467
|
/**
|
|
465
468
|
* Checks if all entities with the given IDs exist.
|
|
@@ -471,12 +474,8 @@ let EntityRepository = class EntityRepository extends Transactional {
|
|
|
471
474
|
if (uniqueIds.length === 0) {
|
|
472
475
|
return false;
|
|
473
476
|
}
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
.from(this.#table)
|
|
477
|
-
.where(inArray(this.#table.id, uniqueIds));
|
|
478
|
-
const foundCount = result[0]?.count ?? 0;
|
|
479
|
-
return foundCount == uniqueIds.length;
|
|
477
|
+
const count = await this.countByQuery(inArray(this.#table.id, uniqueIds));
|
|
478
|
+
return count == uniqueIds.length;
|
|
480
479
|
}
|
|
481
480
|
/**
|
|
482
481
|
* Tries to insert using ON CONFLICT DO NOTHING
|