@rebasepro/server-postgres 0.18.1 → 0.19.1-canary.g5a92fa9

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.es.js CHANGED
@@ -2860,7 +2860,7 @@ var RelationService = class {
2860
2860
  const relation = findRelation(resolvedRelations, relationKey);
2861
2861
  if (!relation) {
2862
2862
  const available = Object.keys(resolvedRelations).join(", ") || "(none)";
2863
- throw new Error(`Relation '${relationKey}' not found in collection '${parentCollectionPath}'. Available relations: [${available}]`);
2863
+ throw ApiError.notFound(`Relation '${relationKey}' not found in collection '${parentCollectionPath}'. Available relations: [${available}]`, "UNKNOWN_RELATION");
2864
2864
  }
2865
2865
  return this.fetchEntitiesUsingJoins(parentCollection, parentId, relation, options);
2866
2866
  }
@@ -2939,7 +2939,7 @@ var RelationService = class {
2939
2939
  const relation = findRelation(resolvedRelations, relationKey);
2940
2940
  if (!relation) {
2941
2941
  const available = Object.keys(resolvedRelations).join(", ") || "(none)";
2942
- throw new Error(`Relation '${relationKey}' not found in collection '${parentCollectionPath}'. Available relations: [${available}]`);
2942
+ throw ApiError.notFound(`Relation '${relationKey}' not found in collection '${parentCollectionPath}'. Available relations: [${available}]`, "UNKNOWN_RELATION");
2943
2943
  }
2944
2944
  return this.countRelatedRows(parentCollection, parentId, relation, []);
2945
2945
  }
@@ -3220,7 +3220,7 @@ function resolveNestedPath(path, registry) {
3220
3220
  const relation = findRelation(resolvedRelations, relationKey);
3221
3221
  if (!relation) {
3222
3222
  const available = Object.keys(resolvedRelations).join(", ") || "(none)";
3223
- throw new Error(`Relation '${relationKey}' not found in collection '${parentCollection.slug}'. Available relations: [${available}]`);
3223
+ throw ApiError.notFound(`Relation '${relationKey}' not found in collection '${parentCollection.slug}'. Available relations: [${available}]`, "UNKNOWN_RELATION");
3224
3224
  }
3225
3225
  const targetCollection = relation.target();
3226
3226
  if (i === segments.length - 1) return {
@@ -5436,6 +5436,9 @@ var PostgresBackendDriver = class PostgresBackendDriver {
5436
5436
  if (!row) return row;
5437
5437
  const [masked] = await this.applyAfterReadForRest([row], collectionPath);
5438
5438
  return masked;
5439
+ },
5440
+ aggregate: async (collectionPath, options) => {
5441
+ return raw.aggregate(collectionPath, options);
5439
5442
  }
5440
5443
  };
5441
5444
  }
@@ -6366,6 +6369,11 @@ var AuthenticatedPostgresBackendDriver = class {
6366
6369
  return this.withTransaction(async (delegate) => {
6367
6370
  return delegate.restFetchService.fetchOneForRest(collectionPath, id, include, databaseId);
6368
6371
  }, { accessMode: "read only" });
6372
+ },
6373
+ aggregate: async (collectionPath, options) => {
6374
+ return this.withTransaction(async (delegate) => {
6375
+ return delegate.restFetchService.aggregate(collectionPath, options);
6376
+ }, { accessMode: "read only" });
6369
6377
  }
6370
6378
  };
6371
6379
  }