@rebasepro/server-postgres 0.11.1-canary.gfadf355 → 0.12.0

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.
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from "module";
2
2
  import "process";
3
3
  __createRequire(import.meta.url);
4
4
  import { r as __require, t as __commonJSMin } from "./chunk-DSJWtz9O.js";
5
- import { d as isPostgresCollectionConfig, f as NULL_OPS, h as EntityRelation, l as isManyToMany, m as toCanonicalOp, n as getDataSourceCapabilities, o as ANONYMOUS_USER_ID, p as REST_TO_CANONICAL, s as policy, u as getDeclaredSubcollections } from "./src-C5hyt1Um.js";
5
+ import { a as policy, c as getDeclaredSubcollections, f as getDataSourceCapabilities, g as EntityRelation, h as toCanonicalOp, i as ANONYMOUS_USER_ID, l as isPostgresCollectionConfig, m as REST_TO_CANONICAL, p as NULL_OPS, s as isManyToMany, u as isRelationalCollectionConfig } from "./src-Zqwaw3P5.js";
6
6
  //#region ../common/src/util/common.ts
7
7
  var DEFAULT_ONE_OF_TYPE = "type";
8
8
  var DEFAULT_ONE_OF_VALUE = "value";
@@ -1527,7 +1527,7 @@ var _resolvedRelationsCache = /* @__PURE__ */ new WeakMap();
1527
1527
  function resolveCollectionRelations(collection) {
1528
1528
  const cached = _resolvedRelationsCache.get(collection);
1529
1529
  if (cached) return cached;
1530
- if (!getDataSourceCapabilities(collection.engine).supportsRelations) return {};
1530
+ if (!isRelationalCollectionConfig(collection)) return {};
1531
1531
  const relations = {};
1532
1532
  for (const relation of collection.relations ?? []) {
1533
1533
  const resolved = resolveRelation(relation, collection);
@@ -1543,7 +1543,7 @@ function resolveCollectionRelations(collection) {
1543
1543
  return relations;
1544
1544
  }
1545
1545
  function getTableName(collection) {
1546
- if (getDataSourceCapabilities(collection.engine).supportsRelations) return collection.table ?? toSnakeCase(collection.slug) ?? toSnakeCase(collection.name);
1546
+ if (isRelationalCollectionConfig(collection)) return collection.table ?? toSnakeCase(collection.slug) ?? toSnakeCase(collection.name);
1547
1547
  return toSnakeCase(collection.slug) ?? toSnakeCase(collection.name);
1548
1548
  }
1549
1549
  function getTableVarName(tableName) {
@@ -2152,8 +2152,8 @@ function getIdPropertyName$1(collection) {
2152
2152
  * Collections that opt out via `disableDefaultPolicies` are returned unchanged.
2153
2153
  */
2154
2154
  function getEffectiveSecurityRules(collection) {
2155
- const explicit = [...(isPostgresCollectionConfig(collection) ? collection.securityRules : void 0) ?? []];
2156
- if (collection.disableDefaultPolicies) return explicit;
2155
+ const explicit = [...collection.securityRules ?? []];
2156
+ if (isPostgresCollectionConfig(collection) && collection.disableDefaultPolicies) return explicit;
2157
2157
  const tableName = getTableName(collection);
2158
2158
  const injected = [];
2159
2159
  injected.push({
@@ -2324,7 +2324,7 @@ function coversUpdate(rule) {
2324
2324
  * stays locked (RLS is still enabled) until they write policies for it.
2325
2325
  */
2326
2326
  function getJunctionSecurityRules(spec) {
2327
- if (spec.declaringSides.every((side) => side.collection.disableDefaultPolicies)) return [];
2327
+ if (spec.declaringSides.every((side) => isPostgresCollectionConfig(side.collection) && side.collection.disableDefaultPolicies)) return [];
2328
2328
  const rules = [];
2329
2329
  rules.push({
2330
2330
  name: `${spec.table}_default_admin_read`,
@@ -4170,4 +4170,4 @@ async function detectJunctionTables(executeSql) {
4170
4170
  //#endregion
4171
4171
  export { toSnakeCase as A, createRelationRefWithData as C, getPolicyNamesForRule as D, generateForeignKeyName as E, DEFAULT_ONE_OF_VALUE as M, mergeDeep as O, createRelationRef as S, updateDateAutoValues as T, getTableVarName as _, getJunctionCollectionConfig as a, getDeclaredPrimaryKeys as b, getEffectiveSecurityRules as c, securityRuleToConditions as d, findAnonymousGrants as f, getTableName as g, getEnumVarName as h, CollectionRegistry as i, DEFAULT_ONE_OF_TYPE as j, camelCase as k, buildPropertyCallbacks as l, getColumnName as m, detectJunctionTables as n, getJunctionSecurityRules as o, findRelation as p, buildSdkData as r, resolveJunctionSpecs as s, classifyTable as t, policyToPostgres as u, resolveCollectionRelations as v, normalizeToEntityRelation as w, parseIdValues as x, buildCompositeId as y };
4172
4172
 
4173
- //# sourceMappingURL=src-Cn0_95uv.js.map
4173
+ //# sourceMappingURL=src-BbFOPJ1S.js.map