@zenstackhq/orm 3.0.0-beta.32 → 3.0.0-beta.33

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/dist/index.d.cts CHANGED
@@ -335,6 +335,7 @@ interface RuntimePlugin<Schema extends SchemaDef = SchemaDef> {
335
335
  description?: string;
336
336
  /**
337
337
  * Custom function implementations.
338
+ * @private
338
339
  */
339
340
  functions?: Record<string, ZModelFunction<Schema>>;
340
341
  /**
@@ -495,6 +496,8 @@ type ClientOptions<Schema extends SchemaDef> = {
495
496
  dialect: Dialect;
496
497
  /**
497
498
  * Custom function definitions.
499
+ *
500
+ * @private
498
501
  */
499
502
  functions?: Record<string, ZModelFunction<Schema>>;
500
503
  /**
package/dist/index.d.ts CHANGED
@@ -335,6 +335,7 @@ interface RuntimePlugin<Schema extends SchemaDef = SchemaDef> {
335
335
  description?: string;
336
336
  /**
337
337
  * Custom function implementations.
338
+ * @private
338
339
  */
339
340
  functions?: Record<string, ZModelFunction<Schema>>;
340
341
  /**
@@ -495,6 +496,8 @@ type ClientOptions<Schema extends SchemaDef> = {
495
496
  dialect: Dialect;
496
497
  /**
497
498
  * Custom function definitions.
499
+ *
500
+ * @private
498
501
  */
499
502
  functions?: Record<string, ZModelFunction<Schema>>;
500
503
  /**
package/dist/index.js CHANGED
@@ -6325,7 +6325,7 @@ var ZenStackQueryExecutor = class _ZenStackQueryExecutor extends DefaultQueryExe
6325
6325
  parameters
6326
6326
  };
6327
6327
  }
6328
- return connection.executeQuery(compiled);
6328
+ return this.internalExecuteQuery(connection, compiled);
6329
6329
  }
6330
6330
  if ((InsertQueryNode.is(query) || UpdateQueryNode.is(query)) && this.hasEntityMutationPluginsWithAfterMutationHooks) {
6331
6331
  query = {
@@ -6354,7 +6354,7 @@ var ZenStackQueryExecutor = class _ZenStackQueryExecutor extends DefaultQueryExe
6354
6354
  return beforeMutationEntities;
6355
6355
  }, "loadBeforeMutationEntities");
6356
6356
  await this.callBeforeMutationHooks(finalQuery, mutationInfo, loadBeforeMutationEntities, connectionClient, queryId);
6357
- const result = await connection.executeQuery(compiled);
6357
+ const result = await this.internalExecuteQuery(connection, compiled);
6358
6358
  if (!this.driver.isTransactionConnection(connection)) {
6359
6359
  await this.callAfterMutationHooks(result, finalQuery, mutationInfo, connectionClient, "all", queryId);
6360
6360
  } else {
@@ -6491,7 +6491,7 @@ var ZenStackQueryExecutor = class _ZenStackQueryExecutor extends DefaultQueryExe
6491
6491
  where: this.andNodes(selectQueryNode.where, where)
6492
6492
  };
6493
6493
  const compiled = this.compileQuery(selectQueryNode, createQueryId2());
6494
- const result = await connection.executeQuery(compiled);
6494
+ const result = await this.internalExecuteQuery(connection, compiled);
6495
6495
  return result.rows;
6496
6496
  }
6497
6497
  andNodes(condition1, condition2) {
@@ -6503,6 +6503,13 @@ var ZenStackQueryExecutor = class _ZenStackQueryExecutor extends DefaultQueryExe
6503
6503
  return condition2;
6504
6504
  }
6505
6505
  }
6506
+ async internalExecuteQuery(connection, compiledQuery) {
6507
+ try {
6508
+ return await connection.executeQuery(compiledQuery);
6509
+ } catch (err) {
6510
+ throw createDBQueryError("Failed to execute query", err, compiledQuery.sql, compiledQuery.parameters);
6511
+ }
6512
+ }
6506
6513
  };
6507
6514
 
6508
6515
  // src/client/functions.ts