@rebasepro/server-postgresql 0.7.0 → 0.8.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.
Files changed (56) hide show
  1. package/build-errors.txt +37 -0
  2. package/dist/PostgresAdapter.d.ts +6 -0
  3. package/dist/PostgresBackendDriver.d.ts +118 -0
  4. package/dist/PostgresBootstrapper.d.ts +46 -0
  5. package/dist/auth/ensure-tables.d.ts +10 -0
  6. package/dist/auth/services.d.ts +251 -0
  7. package/dist/cli-errors.d.ts +29 -0
  8. package/dist/cli-helpers.d.ts +7 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/collections/PostgresCollectionRegistry.d.ts +47 -0
  11. package/dist/connection.d.ts +65 -0
  12. package/dist/data-transformer.d.ts +55 -0
  13. package/dist/databasePoolManager.d.ts +20 -0
  14. package/dist/history/HistoryService.d.ts +71 -0
  15. package/dist/history/ensure-history-table.d.ts +7 -0
  16. package/dist/index.d.ts +14 -0
  17. package/dist/index.es.js +13560 -0
  18. package/dist/index.es.js.map +1 -0
  19. package/dist/interfaces.d.ts +18 -0
  20. package/dist/schema/auth-default-policies.d.ts +12 -0
  21. package/dist/schema/auth-schema.d.ts +2376 -0
  22. package/dist/schema/doctor-cli.d.ts +2 -0
  23. package/dist/schema/doctor.d.ts +52 -0
  24. package/dist/schema/generate-drizzle-schema-logic.d.ts +2 -0
  25. package/dist/schema/generate-drizzle-schema.d.ts +1 -0
  26. package/dist/schema/generate-postgres-ddl-logic.d.ts +5 -0
  27. package/dist/schema/generate-postgres-ddl.d.ts +1 -0
  28. package/dist/schema/introspect-db-inference.d.ts +5 -0
  29. package/dist/schema/introspect-db-logic.d.ts +118 -0
  30. package/dist/schema/introspect-db.d.ts +1 -0
  31. package/dist/schema/test-schema.d.ts +24 -0
  32. package/dist/services/BranchService.d.ts +47 -0
  33. package/dist/services/EntityFetchService.d.ts +214 -0
  34. package/dist/services/EntityPersistService.d.ts +40 -0
  35. package/dist/services/RelationService.d.ts +98 -0
  36. package/dist/services/entity-helpers.d.ts +38 -0
  37. package/dist/services/entityService.d.ts +110 -0
  38. package/dist/services/index.d.ts +4 -0
  39. package/dist/services/realtimeService.d.ts +220 -0
  40. package/dist/types.d.ts +3 -0
  41. package/dist/utils/drizzle-conditions.d.ts +138 -0
  42. package/dist/utils/pg-array-null-patch.d.ts +16 -0
  43. package/dist/utils/pg-error-utils.d.ts +65 -0
  44. package/dist/utils/table-classification.d.ts +8 -0
  45. package/dist/websocket.d.ts +11 -0
  46. package/package.json +17 -17
  47. package/src/PostgresBackendDriver.ts +135 -24
  48. package/src/cli.ts +73 -1
  49. package/src/collections/PostgresCollectionRegistry.ts +6 -6
  50. package/src/data-transformer.ts +2 -2
  51. package/src/schema/auth-default-policies.ts +13 -6
  52. package/src/schema/generate-drizzle-schema-logic.ts +16 -79
  53. package/src/schema/generate-postgres-ddl-logic.ts +14 -51
  54. package/src/services/realtimeService.ts +26 -2
  55. package/test/entity-callbacks-redaction.test.ts +86 -0
  56. package/test/postgresDataDriver.test.ts +2 -1
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Database Abstraction Interfaces
3
+ *
4
+ * These interfaces define the contracts that any database backend must implement
5
+ * to be used with Rebase. This allows for pluggable database backends like
6
+ * PostgreSQL, MongoDB, MySQL, etc.
7
+ */
8
+ import { DatabaseConnection, QueryFilter, FetchCollectionOptions, SearchOptions, CountOptions, ConditionBuilder, ConditionBuilderStatic, EntityRepository, CollectionSubscriptionConfig, EntitySubscriptionConfig, RealtimeProvider, CollectionRegistryInterface, DataTransformer, BackendConfig, BackendInstance, BackendFactory } from "@rebasepro/types";
9
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
10
+ import { PgTransaction } from "drizzle-orm/pg-core";
11
+ /**
12
+ * Type representing either a direct database connection or a transaction.
13
+ * Used to allow services to operate within a transaction context.
14
+ * Note: `any` is intentional here — it represents a Drizzle client with
15
+ * a dynamic schema, enabling `db.query[tableName]` access without casts.
16
+ */
17
+ export type DrizzleClient = NodePgDatabase<any> | PgTransaction<any, any, any>;
18
+ export type { DatabaseConnection, QueryFilter, FetchCollectionOptions, SearchOptions, CountOptions, ConditionBuilder, ConditionBuilderStatic, EntityRepository, CollectionSubscriptionConfig, EntitySubscriptionConfig, RealtimeProvider, CollectionRegistryInterface, DataTransformer, BackendConfig, BackendInstance, BackendFactory };
@@ -0,0 +1,12 @@
1
+ import { EntityCollection, SecurityRule } from "@rebasepro/types";
2
+ /**
3
+ * Returns the security rules that should be applied to a collection: the
4
+ * author's explicit `securityRules`, plus, for auth collections, an
5
+ * auto-injected restrictive admin gate and permissive admin grant on every
6
+ * write operation. Together these guarantee only admins (or the trusted server
7
+ * context) can write the row.
8
+ *
9
+ * Non-auth collections, and auth collections that opt out via
10
+ * `disableDefaultAuthPolicies`, are returned unchanged.
11
+ */
12
+ export declare function getEffectiveSecurityRules(collection: EntityCollection): SecurityRule[];