@rebasepro/server-postgresql 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e
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/common/src/collections/CollectionRegistry.d.ts +8 -0
- package/dist/common/src/util/entities.d.ts +22 -0
- package/dist/common/src/util/relations.d.ts +14 -4
- package/dist/common/src/util/resolutions.d.ts +1 -1
- package/dist/index.es.js +1254 -591
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1254 -591
- package/dist/index.umd.js.map +1 -1
- package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +17 -29
- package/dist/server-postgresql/src/auth/services.d.ts +7 -3
- package/dist/server-postgresql/src/collections/PostgresCollectionRegistry.d.ts +1 -1
- package/dist/server-postgresql/src/connection.d.ts +34 -1
- package/dist/server-postgresql/src/data-transformer.d.ts +26 -4
- package/dist/server-postgresql/src/databasePoolManager.d.ts +2 -2
- package/dist/server-postgresql/src/schema/auth-schema.d.ts +139 -38
- package/dist/server-postgresql/src/schema/doctor-cli.d.ts +2 -0
- package/dist/server-postgresql/src/schema/doctor.d.ts +43 -0
- package/dist/server-postgresql/src/schema/generate-drizzle-schema-logic.d.ts +1 -1
- package/dist/server-postgresql/src/schema/test-schema.d.ts +24 -0
- package/dist/server-postgresql/src/services/EntityFetchService.d.ts +22 -8
- package/dist/server-postgresql/src/services/EntityPersistService.d.ts +1 -1
- package/dist/server-postgresql/src/services/RelationService.d.ts +11 -5
- package/dist/server-postgresql/src/services/entity-helpers.d.ts +16 -2
- package/dist/server-postgresql/src/services/entityService.d.ts +8 -6
- package/dist/server-postgresql/src/services/realtimeService.d.ts +2 -0
- package/dist/server-postgresql/src/utils/drizzle-conditions.d.ts +2 -2
- package/dist/types/src/controllers/auth.d.ts +2 -0
- package/dist/types/src/controllers/client.d.ts +119 -7
- package/dist/types/src/controllers/collection_registry.d.ts +4 -3
- package/dist/types/src/controllers/customization_controller.d.ts +7 -1
- package/dist/types/src/controllers/data.d.ts +34 -7
- package/dist/types/src/controllers/data_driver.d.ts +20 -28
- package/dist/types/src/controllers/database_admin.d.ts +2 -2
- package/dist/types/src/controllers/email.d.ts +34 -0
- package/dist/types/src/controllers/index.d.ts +1 -0
- package/dist/types/src/controllers/local_config_persistence.d.ts +4 -4
- package/dist/types/src/controllers/navigation.d.ts +5 -5
- package/dist/types/src/controllers/registry.d.ts +6 -3
- package/dist/types/src/controllers/side_entity_controller.d.ts +7 -6
- package/dist/types/src/controllers/storage.d.ts +24 -26
- package/dist/types/src/rebase_context.d.ts +8 -4
- package/dist/types/src/types/backend.d.ts +4 -1
- package/dist/types/src/types/builders.d.ts +5 -4
- package/dist/types/src/types/chips.d.ts +1 -1
- package/dist/types/src/types/collections.d.ts +169 -125
- package/dist/types/src/types/cron.d.ts +102 -0
- package/dist/types/src/types/data_source.d.ts +1 -1
- package/dist/types/src/types/entity_actions.d.ts +8 -8
- package/dist/types/src/types/entity_callbacks.d.ts +15 -15
- package/dist/types/src/types/entity_link_builder.d.ts +1 -1
- package/dist/types/src/types/entity_overrides.d.ts +2 -1
- package/dist/types/src/types/entity_views.d.ts +8 -8
- package/dist/types/src/types/export_import.d.ts +3 -3
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/plugins.d.ts +72 -18
- package/dist/types/src/types/properties.d.ts +118 -33
- package/dist/types/src/types/relations.d.ts +1 -1
- package/dist/types/src/types/slots.d.ts +30 -6
- package/dist/types/src/types/translations.d.ts +44 -0
- package/dist/types/src/types/user_management_delegate.d.ts +1 -0
- package/drizzle-test/0000_woozy_junta.sql +6 -0
- package/drizzle-test/0001_youthful_arachne.sql +1 -0
- package/drizzle-test/0002_lively_dragon_lord.sql +2 -0
- package/drizzle-test/0003_mean_king_cobra.sql +2 -0
- package/drizzle-test/meta/0000_snapshot.json +47 -0
- package/drizzle-test/meta/0001_snapshot.json +48 -0
- package/drizzle-test/meta/0002_snapshot.json +38 -0
- package/drizzle-test/meta/0003_snapshot.json +48 -0
- package/drizzle-test/meta/_journal.json +34 -0
- package/drizzle-test-out/0000_tan_trauma.sql +6 -0
- package/drizzle-test-out/0001_rapid_drax.sql +1 -0
- package/drizzle-test-out/meta/0000_snapshot.json +44 -0
- package/drizzle-test-out/meta/0001_snapshot.json +54 -0
- package/drizzle-test-out/meta/_journal.json +20 -0
- package/drizzle.test.config.ts +10 -0
- package/package.json +88 -89
- package/scratch.ts +41 -0
- package/src/PostgresBackendDriver.ts +63 -79
- package/src/PostgresBootstrapper.ts +7 -8
- package/src/auth/ensure-tables.ts +158 -86
- package/src/auth/services.ts +109 -50
- package/src/cli.ts +259 -16
- package/src/collections/PostgresCollectionRegistry.ts +6 -6
- package/src/connection.ts +70 -48
- package/src/data-transformer.ts +155 -116
- package/src/databasePoolManager.ts +6 -5
- package/src/history/HistoryService.ts +3 -12
- package/src/interfaces.ts +3 -3
- package/src/schema/auth-schema.ts +26 -3
- package/src/schema/doctor-cli.ts +47 -0
- package/src/schema/doctor.ts +595 -0
- package/src/schema/generate-drizzle-schema-logic.ts +204 -57
- package/src/schema/generate-drizzle-schema.ts +6 -6
- package/src/schema/test-schema.ts +11 -0
- package/src/services/BranchService.ts +5 -5
- package/src/services/EntityFetchService.ts +317 -188
- package/src/services/EntityPersistService.ts +15 -17
- package/src/services/RelationService.ts +299 -37
- package/src/services/entity-helpers.ts +39 -13
- package/src/services/entityService.ts +11 -9
- package/src/services/realtimeService.ts +58 -29
- package/src/utils/drizzle-conditions.ts +25 -24
- package/src/websocket.ts +52 -21
- package/test/auth-services.test.ts +131 -39
- package/test/batch-many-to-many-regression.test.ts +573 -0
- package/test/branchService.test.ts +22 -12
- package/test/data-transformer-hardening.test.ts +417 -0
- package/test/data-transformer.test.ts +175 -0
- package/test/doctor.test.ts +182 -0
- package/test/entityService.errors.test.ts +31 -16
- package/test/entityService.relations.test.ts +155 -59
- package/test/entityService.subcollection-search.test.ts +107 -57
- package/test/entityService.test.ts +105 -47
- package/test/generate-drizzle-schema.test.ts +262 -69
- package/test/historyService.test.ts +31 -16
- package/test/n-plus-one-regression.test.ts +314 -0
- package/test/postgresDataDriver.test.ts +260 -168
- package/test/realtimeService.test.ts +70 -39
- package/test/relation-pipeline-gaps.test.ts +637 -0
- package/test/relations.test.ts +492 -39
- package/test-drizzle-bug.ts +18 -0
- package/test-drizzle-out/0000_cultured_freak.sql +7 -0
- package/test-drizzle-out/0001_tiresome_professor_monster.sql +1 -0
- package/test-drizzle-out/meta/0000_snapshot.json +55 -0
- package/test-drizzle-out/meta/0001_snapshot.json +63 -0
- package/test-drizzle-out/meta/_journal.json +20 -0
- package/test-drizzle-prompt.sh +2 -0
- package/test-policy-prompt.sh +3 -0
- package/test-programmatic.ts +30 -0
- package/test-programmatic2.ts +59 -0
- package/test-schema-no-policies.ts +12 -0
- package/test_drizzle_mock.js +2 -2
- package/test_find_changed.mjs +3 -1
- package/test_hash.js +14 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +5 -5
|
@@ -33,17 +33,19 @@ export declare class PostgresBackendDriver implements DataDriver {
|
|
|
33
33
|
constructor(db: DrizzleClient, realtimeService: RealtimeService, registry: PostgresCollectionRegistry, user?: User, poolManager?: DatabasePoolManager | undefined, historyService?: HistoryService);
|
|
34
34
|
/**
|
|
35
35
|
* Typed admin capabilities (SQLAdmin + SchemaAdmin + BranchAdmin).
|
|
36
|
+
* Implemented as a getter so method references are resolved at call-time,
|
|
37
|
+
* allowing test spies applied after construction to take effect.
|
|
36
38
|
*/
|
|
37
|
-
admin: DatabaseAdmin;
|
|
39
|
+
get admin(): DatabaseAdmin;
|
|
38
40
|
private resolveCollectionCallbacks;
|
|
39
|
-
fetchCollection<M extends Record<string,
|
|
40
|
-
listenCollection<M extends Record<string,
|
|
41
|
-
fetchEntity<M extends Record<string,
|
|
42
|
-
listenEntity<M extends Record<string,
|
|
43
|
-
saveEntity<M extends Record<string,
|
|
44
|
-
deleteEntity<M extends Record<string,
|
|
41
|
+
fetchCollection<M extends Record<string, unknown>>({ path, collection, filter, limit, offset, startAfter, orderBy, searchString, order }: FetchCollectionProps<M>): Promise<Entity<M>[]>;
|
|
42
|
+
listenCollection<M extends Record<string, unknown>>({ path, collection, filter, limit, offset, startAfter, orderBy, searchString, order, onUpdate, onError }: ListenCollectionProps<M>): () => void;
|
|
43
|
+
fetchEntity<M extends Record<string, unknown>>({ path, entityId, databaseId, collection }: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
|
|
44
|
+
listenEntity<M extends Record<string, unknown>>({ path, entityId, collection, onUpdate, onError }: ListenEntityProps<M>): () => void;
|
|
45
|
+
saveEntity<M extends Record<string, unknown>>({ path, entityId, values, collection, status }: SaveEntityProps<M>): Promise<Entity<M>>;
|
|
46
|
+
deleteEntity<M extends Record<string, unknown>>({ entity, collection }: DeleteEntityProps<M>): Promise<void>;
|
|
45
47
|
checkUniqueField(path: string, name: string, value: unknown, entityId?: string, collection?: EntityCollection): Promise<boolean>;
|
|
46
|
-
countEntities<M extends Record<string,
|
|
48
|
+
countEntities<M extends Record<string, unknown>>({ path, collection, filter, searchString }: FetchCollectionProps<M>): Promise<number>;
|
|
47
49
|
private getTargetDb;
|
|
48
50
|
executeSql(sqlText: string, options?: {
|
|
49
51
|
database?: string;
|
|
@@ -82,31 +84,17 @@ export declare class AuthenticatedPostgresBackendDriver implements DataDriver {
|
|
|
82
84
|
*/
|
|
83
85
|
admin: DatabaseAdmin;
|
|
84
86
|
private withTransaction;
|
|
85
|
-
fetchCollection<M extends Record<string,
|
|
87
|
+
fetchCollection<M extends Record<string, unknown>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]>;
|
|
86
88
|
/**
|
|
87
89
|
* Injects the authenticated user's context into the most recently
|
|
88
90
|
* registered realtime subscription so RLS-aware polling can apply.
|
|
89
91
|
*/
|
|
90
92
|
private injectAuthContext;
|
|
91
|
-
listenCollection<M extends Record<string,
|
|
92
|
-
fetchEntity<M extends Record<string,
|
|
93
|
-
listenEntity<M extends Record<string,
|
|
94
|
-
saveEntity<M extends Record<string,
|
|
95
|
-
deleteEntity<M extends Record<string,
|
|
93
|
+
listenCollection<M extends Record<string, unknown>>(props: ListenCollectionProps<M>): () => void;
|
|
94
|
+
fetchEntity<M extends Record<string, unknown>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
|
|
95
|
+
listenEntity<M extends Record<string, unknown>>(props: ListenEntityProps<M>): () => void;
|
|
96
|
+
saveEntity<M extends Record<string, unknown>>(props: SaveEntityProps<M>): Promise<Entity<M>>;
|
|
97
|
+
deleteEntity<M extends Record<string, unknown>>(props: DeleteEntityProps<M>): Promise<void>;
|
|
96
98
|
checkUniqueField(path: string, name: string, value: unknown, entityId?: string, collection?: EntityCollection): Promise<boolean>;
|
|
97
|
-
countEntities<M extends Record<string,
|
|
98
|
-
/**
|
|
99
|
-
* Intentionally delegates to the base delegate WITHOUT RLS wrapping.
|
|
100
|
-
* executeSql is an admin-only feature; access control should be enforced
|
|
101
|
-
* at the API route level, not via database-level RLS.
|
|
102
|
-
*/
|
|
103
|
-
executeSql(sqlText: string, options?: {
|
|
104
|
-
database?: string;
|
|
105
|
-
role?: string;
|
|
106
|
-
}): Promise<Record<string, unknown>[]>;
|
|
107
|
-
fetchAvailableDatabases(): Promise<string[]>;
|
|
108
|
-
fetchAvailableRoles(): Promise<string[]>;
|
|
109
|
-
fetchCurrentDatabase(): Promise<string | undefined>;
|
|
110
|
-
fetchUnmappedTables(mappedPaths?: string[]): Promise<string[]>;
|
|
111
|
-
fetchTableMetadata(tableName: string): Promise<TableMetadata>;
|
|
99
|
+
countEntities<M extends Record<string, unknown>>(props: FetchCollectionProps<M>): Promise<number>;
|
|
112
100
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
2
2
|
import { User, NewUser } from "../schema/auth-schema";
|
|
3
|
-
import { UserRepository, RoleRepository, TokenRepository, AuthRepository, UserData, CreateUserData, RoleData, CreateRoleData, RefreshTokenInfo, PasswordResetTokenInfo, ListUsersOptions, PaginatedUsersResult, RoleData as Role } from "@rebasepro/server-core";
|
|
3
|
+
import { UserRepository, RoleRepository, TokenRepository, AuthRepository, UserData, CreateUserData, RoleData, CreateRoleData, RefreshTokenInfo, PasswordResetTokenInfo, UserIdentityData, ListUsersOptions, PaginatedUsersResult, RoleData as Role } from "@rebasepro/server-core";
|
|
4
4
|
export type { Role };
|
|
5
5
|
/**
|
|
6
6
|
* PostgreSQL implementation of UserRepository.
|
|
@@ -12,7 +12,9 @@ export declare class UserService implements UserRepository {
|
|
|
12
12
|
createUser(data: NewUser): Promise<User>;
|
|
13
13
|
getUserById(id: string): Promise<User | null>;
|
|
14
14
|
getUserByEmail(email: string): Promise<User | null>;
|
|
15
|
-
|
|
15
|
+
getUserByIdentity(provider: string, providerId: string): Promise<User | null>;
|
|
16
|
+
getUserIdentities(userId: string): Promise<UserIdentityData[]>;
|
|
17
|
+
linkUserIdentity(userId: string, provider: string, providerId: string, profileData?: Record<string, unknown>): Promise<void>;
|
|
16
18
|
updateUser(id: string, data: Partial<Omit<NewUser, "id">>): Promise<User | null>;
|
|
17
19
|
deleteUser(id: string): Promise<void>;
|
|
18
20
|
listUsers(): Promise<User[]>;
|
|
@@ -148,7 +150,9 @@ export declare class PostgresAuthRepository implements AuthRepository {
|
|
|
148
150
|
createUser(data: CreateUserData): Promise<UserData>;
|
|
149
151
|
getUserById(id: string): Promise<UserData | null>;
|
|
150
152
|
getUserByEmail(email: string): Promise<UserData | null>;
|
|
151
|
-
|
|
153
|
+
getUserByIdentity(provider: string, providerId: string): Promise<UserData | null>;
|
|
154
|
+
getUserIdentities(userId: string): Promise<UserIdentityData[]>;
|
|
155
|
+
linkUserIdentity(userId: string, provider: string, providerId: string, profileData?: Record<string, unknown>): Promise<void>;
|
|
152
156
|
updateUser(id: string, data: Partial<Omit<CreateUserData, "id">>): Promise<UserData | null>;
|
|
153
157
|
deleteUser(id: string): Promise<void>;
|
|
154
158
|
listUsers(): Promise<UserData[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionRegistry } from "@rebasepro/common";
|
|
2
|
-
import type
|
|
2
|
+
import { type EntityCollection } from "@rebasepro/types";
|
|
3
3
|
import { PgEnum, PgTable } from "drizzle-orm/pg-core";
|
|
4
4
|
import { Relations } from "drizzle-orm";
|
|
5
5
|
import { CollectionRegistryInterface } from "../interfaces";
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
import { Pool } from "pg";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for the Postgres connection pool.
|
|
4
|
+
*
|
|
5
|
+
* Sensible defaults are provided for production Cloud Run / single-instance
|
|
6
|
+
* deployments. Override via environment variables or explicit config.
|
|
7
|
+
*/
|
|
8
|
+
export interface PostgresPoolConfig {
|
|
9
|
+
/** Maximum number of connections in the pool (default: 20) */
|
|
10
|
+
max?: number;
|
|
11
|
+
/** Close idle connections after this many ms (default: 30 000) */
|
|
12
|
+
idleTimeoutMillis?: number;
|
|
13
|
+
/** Abort connection attempts after this many ms (default: 10 000) */
|
|
14
|
+
connectionTimeoutMillis?: number;
|
|
15
|
+
/** Per-query timeout in ms (default: 30 000) */
|
|
16
|
+
queryTimeout?: number;
|
|
17
|
+
/** Per-statement timeout in ms (default: 30 000) */
|
|
18
|
+
statementTimeout?: number;
|
|
19
|
+
/** Enable TCP keep-alive (default: true) */
|
|
20
|
+
keepAlive?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a Drizzle-backed Postgres connection with a production-grade
|
|
24
|
+
* connection pool.
|
|
25
|
+
*
|
|
26
|
+
* @param connectionString Postgres connection URL
|
|
27
|
+
* @param schema Optional Drizzle schema for the relational API
|
|
28
|
+
* @param poolConfig Optional pool tuning (merged over defaults)
|
|
29
|
+
*
|
|
30
|
+
* @returns `{ db, pool, connectionString }` — the `pool` is exposed so
|
|
31
|
+
* callers can register shutdown hooks (`pool.end()`) or monitor
|
|
32
|
+
* pool metrics.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createPostgresDatabaseConnection(connectionString: string, schema?: Record<string, unknown>, poolConfig?: PostgresPoolConfig): {
|
|
3
35
|
db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, unknown>> & {
|
|
4
36
|
$client: Pool;
|
|
5
37
|
};
|
|
38
|
+
pool: Pool;
|
|
6
39
|
connectionString: string;
|
|
7
40
|
};
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
2
|
-
import { EntityCollection, Properties, Property } from "@rebasepro/types";
|
|
2
|
+
import { EntityCollection, Properties, Property, Relation } from "@rebasepro/types";
|
|
3
3
|
import { PostgresCollectionRegistry } from "./collections/PostgresCollectionRegistry";
|
|
4
4
|
/**
|
|
5
5
|
* Data transformation utilities for converting between frontend and database formats.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Typed result from `serializeDataToServer`.
|
|
9
|
+
* Replaces the hidden `__inverseRelationUpdates` / `__joinPathRelationUpdates`
|
|
10
|
+
* dunder-property mutation pattern with explicit, typed state management.
|
|
11
|
+
*/
|
|
12
|
+
export interface SerializedEntityData {
|
|
13
|
+
/** Scalar column values ready for INSERT/UPDATE. */
|
|
14
|
+
scalarData: Record<string, unknown>;
|
|
15
|
+
/** Inverse relation updates that must be applied to target tables. */
|
|
16
|
+
inverseRelationUpdates: Array<{
|
|
17
|
+
relationKey: string;
|
|
18
|
+
relation: Relation;
|
|
19
|
+
newValue: unknown;
|
|
20
|
+
currentEntityId?: string | number;
|
|
21
|
+
}>;
|
|
22
|
+
/** JoinPath relation updates that require multi-hop writes. */
|
|
23
|
+
joinPathRelationUpdates: Array<{
|
|
24
|
+
relationKey: string;
|
|
25
|
+
relation: Relation;
|
|
26
|
+
newTargetId: string | number | null;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
7
29
|
/**
|
|
8
30
|
* Helper function to sanitize and convert dates to ISO strings
|
|
9
31
|
*/
|
|
@@ -11,7 +33,7 @@ export declare function sanitizeAndConvertDates(obj: unknown): unknown;
|
|
|
11
33
|
/**
|
|
12
34
|
* Transform relations for database storage (relation objects to IDs)
|
|
13
35
|
*/
|
|
14
|
-
export declare function serializeDataToServer<M extends Record<string,
|
|
36
|
+
export declare function serializeDataToServer<M extends Record<string, unknown>>(entity: M, properties: Properties, collection?: EntityCollection, registry?: PostgresCollectionRegistry): SerializedEntityData;
|
|
15
37
|
/**
|
|
16
38
|
* Serialize a single property value for database storage
|
|
17
39
|
*/
|
|
@@ -19,7 +41,7 @@ export declare function serializePropertyToServer(value: unknown, property: Prop
|
|
|
19
41
|
/**
|
|
20
42
|
* Transform IDs back to relation objects for frontend
|
|
21
43
|
*/
|
|
22
|
-
export declare function parseDataFromServer<M extends Record<string,
|
|
44
|
+
export declare function parseDataFromServer<M extends Record<string, unknown>>(data: M, collection: EntityCollection, db?: NodePgDatabase<Record<string, unknown>>, registry?: PostgresCollectionRegistry): Promise<M>;
|
|
23
45
|
/**
|
|
24
46
|
* Parse a single property value from database format to frontend format
|
|
25
47
|
*/
|
|
@@ -33,4 +55,4 @@ export declare function parsePropertyFromServer(value: unknown, property: Proper
|
|
|
33
55
|
* Use this instead of `parseDataFromServer` when processing results from
|
|
34
56
|
* `db.query.findFirst/findMany` which return pre-hydrated relation data.
|
|
35
57
|
*/
|
|
36
|
-
export declare function normalizeDbValues<M extends Record<string,
|
|
58
|
+
export declare function normalizeDbValues<M extends Record<string, unknown>>(data: M, collection: EntityCollection): M;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Pool } from
|
|
2
|
-
import { NodePgDatabase } from
|
|
1
|
+
import { Pool } from "pg";
|
|
2
|
+
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
3
3
|
export declare class DatabasePoolManager {
|
|
4
4
|
private pools;
|
|
5
5
|
private drizzleInstances;
|
|
@@ -103,44 +103,6 @@ export declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
103
103
|
}, {}, {
|
|
104
104
|
length: 500;
|
|
105
105
|
}>;
|
|
106
|
-
provider: import("drizzle-orm/pg-core").PgColumn<{
|
|
107
|
-
name: "provider";
|
|
108
|
-
tableName: "users";
|
|
109
|
-
dataType: "string";
|
|
110
|
-
columnType: "PgVarchar";
|
|
111
|
-
data: string;
|
|
112
|
-
driverParam: string;
|
|
113
|
-
notNull: true;
|
|
114
|
-
hasDefault: true;
|
|
115
|
-
isPrimaryKey: false;
|
|
116
|
-
isAutoincrement: false;
|
|
117
|
-
hasRuntimeDefault: false;
|
|
118
|
-
enumValues: [string, ...string[]];
|
|
119
|
-
baseColumn: never;
|
|
120
|
-
identity: undefined;
|
|
121
|
-
generated: undefined;
|
|
122
|
-
}, {}, {
|
|
123
|
-
length: 50;
|
|
124
|
-
}>;
|
|
125
|
-
googleId: import("drizzle-orm/pg-core").PgColumn<{
|
|
126
|
-
name: "google_id";
|
|
127
|
-
tableName: "users";
|
|
128
|
-
dataType: "string";
|
|
129
|
-
columnType: "PgVarchar";
|
|
130
|
-
data: string;
|
|
131
|
-
driverParam: string;
|
|
132
|
-
notNull: false;
|
|
133
|
-
hasDefault: false;
|
|
134
|
-
isPrimaryKey: false;
|
|
135
|
-
isAutoincrement: false;
|
|
136
|
-
hasRuntimeDefault: false;
|
|
137
|
-
enumValues: [string, ...string[]];
|
|
138
|
-
baseColumn: never;
|
|
139
|
-
identity: undefined;
|
|
140
|
-
generated: undefined;
|
|
141
|
-
}, {}, {
|
|
142
|
-
length: 255;
|
|
143
|
-
}>;
|
|
144
106
|
emailVerified: import("drizzle-orm/pg-core").PgColumn<{
|
|
145
107
|
name: "email_verified";
|
|
146
108
|
tableName: "users";
|
|
@@ -739,10 +701,144 @@ export declare const appConfig: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
739
701
|
};
|
|
740
702
|
dialect: "pg";
|
|
741
703
|
}>;
|
|
704
|
+
/**
|
|
705
|
+
* User identities - maps external OAuth profiles back to local users
|
|
706
|
+
*/
|
|
707
|
+
export declare const userIdentities: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
708
|
+
name: "user_identities";
|
|
709
|
+
schema: "rebase";
|
|
710
|
+
columns: {
|
|
711
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
712
|
+
name: "id";
|
|
713
|
+
tableName: "user_identities";
|
|
714
|
+
dataType: "string";
|
|
715
|
+
columnType: "PgUUID";
|
|
716
|
+
data: string;
|
|
717
|
+
driverParam: string;
|
|
718
|
+
notNull: true;
|
|
719
|
+
hasDefault: true;
|
|
720
|
+
isPrimaryKey: true;
|
|
721
|
+
isAutoincrement: false;
|
|
722
|
+
hasRuntimeDefault: false;
|
|
723
|
+
enumValues: undefined;
|
|
724
|
+
baseColumn: never;
|
|
725
|
+
identity: undefined;
|
|
726
|
+
generated: undefined;
|
|
727
|
+
}, {}, {}>;
|
|
728
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
729
|
+
name: "user_id";
|
|
730
|
+
tableName: "user_identities";
|
|
731
|
+
dataType: "string";
|
|
732
|
+
columnType: "PgUUID";
|
|
733
|
+
data: string;
|
|
734
|
+
driverParam: string;
|
|
735
|
+
notNull: true;
|
|
736
|
+
hasDefault: false;
|
|
737
|
+
isPrimaryKey: false;
|
|
738
|
+
isAutoincrement: false;
|
|
739
|
+
hasRuntimeDefault: false;
|
|
740
|
+
enumValues: undefined;
|
|
741
|
+
baseColumn: never;
|
|
742
|
+
identity: undefined;
|
|
743
|
+
generated: undefined;
|
|
744
|
+
}, {}, {}>;
|
|
745
|
+
provider: import("drizzle-orm/pg-core").PgColumn<{
|
|
746
|
+
name: "provider";
|
|
747
|
+
tableName: "user_identities";
|
|
748
|
+
dataType: "string";
|
|
749
|
+
columnType: "PgVarchar";
|
|
750
|
+
data: string;
|
|
751
|
+
driverParam: string;
|
|
752
|
+
notNull: true;
|
|
753
|
+
hasDefault: false;
|
|
754
|
+
isPrimaryKey: false;
|
|
755
|
+
isAutoincrement: false;
|
|
756
|
+
hasRuntimeDefault: false;
|
|
757
|
+
enumValues: [string, ...string[]];
|
|
758
|
+
baseColumn: never;
|
|
759
|
+
identity: undefined;
|
|
760
|
+
generated: undefined;
|
|
761
|
+
}, {}, {
|
|
762
|
+
length: 50;
|
|
763
|
+
}>;
|
|
764
|
+
providerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
765
|
+
name: "provider_id";
|
|
766
|
+
tableName: "user_identities";
|
|
767
|
+
dataType: "string";
|
|
768
|
+
columnType: "PgVarchar";
|
|
769
|
+
data: string;
|
|
770
|
+
driverParam: string;
|
|
771
|
+
notNull: true;
|
|
772
|
+
hasDefault: false;
|
|
773
|
+
isPrimaryKey: false;
|
|
774
|
+
isAutoincrement: false;
|
|
775
|
+
hasRuntimeDefault: false;
|
|
776
|
+
enumValues: [string, ...string[]];
|
|
777
|
+
baseColumn: never;
|
|
778
|
+
identity: undefined;
|
|
779
|
+
generated: undefined;
|
|
780
|
+
}, {}, {
|
|
781
|
+
length: 255;
|
|
782
|
+
}>;
|
|
783
|
+
profileData: import("drizzle-orm/pg-core").PgColumn<{
|
|
784
|
+
name: "profile_data";
|
|
785
|
+
tableName: "user_identities";
|
|
786
|
+
dataType: "json";
|
|
787
|
+
columnType: "PgJsonb";
|
|
788
|
+
data: unknown;
|
|
789
|
+
driverParam: unknown;
|
|
790
|
+
notNull: false;
|
|
791
|
+
hasDefault: false;
|
|
792
|
+
isPrimaryKey: false;
|
|
793
|
+
isAutoincrement: false;
|
|
794
|
+
hasRuntimeDefault: false;
|
|
795
|
+
enumValues: undefined;
|
|
796
|
+
baseColumn: never;
|
|
797
|
+
identity: undefined;
|
|
798
|
+
generated: undefined;
|
|
799
|
+
}, {}, {}>;
|
|
800
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
801
|
+
name: "created_at";
|
|
802
|
+
tableName: "user_identities";
|
|
803
|
+
dataType: "date";
|
|
804
|
+
columnType: "PgTimestamp";
|
|
805
|
+
data: Date;
|
|
806
|
+
driverParam: string;
|
|
807
|
+
notNull: true;
|
|
808
|
+
hasDefault: true;
|
|
809
|
+
isPrimaryKey: false;
|
|
810
|
+
isAutoincrement: false;
|
|
811
|
+
hasRuntimeDefault: false;
|
|
812
|
+
enumValues: undefined;
|
|
813
|
+
baseColumn: never;
|
|
814
|
+
identity: undefined;
|
|
815
|
+
generated: undefined;
|
|
816
|
+
}, {}, {}>;
|
|
817
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
818
|
+
name: "updated_at";
|
|
819
|
+
tableName: "user_identities";
|
|
820
|
+
dataType: "date";
|
|
821
|
+
columnType: "PgTimestamp";
|
|
822
|
+
data: Date;
|
|
823
|
+
driverParam: string;
|
|
824
|
+
notNull: true;
|
|
825
|
+
hasDefault: true;
|
|
826
|
+
isPrimaryKey: false;
|
|
827
|
+
isAutoincrement: false;
|
|
828
|
+
hasRuntimeDefault: false;
|
|
829
|
+
enumValues: undefined;
|
|
830
|
+
baseColumn: never;
|
|
831
|
+
identity: undefined;
|
|
832
|
+
generated: undefined;
|
|
833
|
+
}, {}, {}>;
|
|
834
|
+
};
|
|
835
|
+
dialect: "pg";
|
|
836
|
+
}>;
|
|
742
837
|
export declare const usersRelations: import("drizzle-orm").Relations<"users", {
|
|
743
838
|
userRoles: import("drizzle-orm").Many<"user_roles">;
|
|
744
839
|
refreshTokens: import("drizzle-orm").Many<"refresh_tokens">;
|
|
745
840
|
passwordResetTokens: import("drizzle-orm").Many<"password_reset_tokens">;
|
|
841
|
+
userIdentities: import("drizzle-orm").Many<"user_identities">;
|
|
746
842
|
}>;
|
|
747
843
|
export declare const rolesRelations: import("drizzle-orm").Relations<"roles", {
|
|
748
844
|
userRoles: import("drizzle-orm").Many<"user_roles">;
|
|
@@ -757,6 +853,9 @@ export declare const refreshTokensRelations: import("drizzle-orm").Relations<"re
|
|
|
757
853
|
export declare const passwordResetTokensRelations: import("drizzle-orm").Relations<"password_reset_tokens", {
|
|
758
854
|
user: import("drizzle-orm").One<"users", true>;
|
|
759
855
|
}>;
|
|
856
|
+
export declare const userIdentitiesRelations: import("drizzle-orm").Relations<"user_identities", {
|
|
857
|
+
user: import("drizzle-orm").One<"users", true>;
|
|
858
|
+
}>;
|
|
760
859
|
export type User = typeof users.$inferSelect;
|
|
761
860
|
export type NewUser = typeof users.$inferInsert;
|
|
762
861
|
export type Role = typeof roles.$inferSelect;
|
|
@@ -765,3 +864,5 @@ export type UserRole = typeof userRoles.$inferSelect;
|
|
|
765
864
|
export type RefreshToken = typeof refreshTokens.$inferSelect;
|
|
766
865
|
export type PasswordResetToken = typeof passwordResetTokens.$inferSelect;
|
|
767
866
|
export type AppConfig = typeof appConfig.$inferSelect;
|
|
867
|
+
export type UserIdentity = typeof userIdentities.$inferSelect;
|
|
868
|
+
export type NewUserIdentity = typeof userIdentities.$inferInsert;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EntityCollection, Property } from "@rebasepro/types";
|
|
2
|
+
export type IssueSeverity = "error" | "warning" | "info";
|
|
3
|
+
export interface DoctorIssue {
|
|
4
|
+
severity: IssueSeverity;
|
|
5
|
+
category: "missing_table" | "missing_column" | "type_mismatch" | "missing_constraint" | "schema_stale" | "missing_enum" | "enum_value_mismatch" | "missing_foreign_key";
|
|
6
|
+
table?: string;
|
|
7
|
+
column?: string;
|
|
8
|
+
expected?: string;
|
|
9
|
+
actual?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
fix: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DoctorReport {
|
|
14
|
+
collectionsToSchema: {
|
|
15
|
+
passed: boolean;
|
|
16
|
+
issues: DoctorIssue[];
|
|
17
|
+
};
|
|
18
|
+
schemaToDatabase: {
|
|
19
|
+
passed: boolean;
|
|
20
|
+
issues: DoctorIssue[];
|
|
21
|
+
};
|
|
22
|
+
summary: {
|
|
23
|
+
passed: number;
|
|
24
|
+
warnings: number;
|
|
25
|
+
errors: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function getExpectedColumnType(prop: Property): string | null;
|
|
29
|
+
export declare function loadCollections(collectionsPath: string): Promise<EntityCollection[]>;
|
|
30
|
+
export declare function checkCollectionsVsSchema(collections: EntityCollection[], schemaFilePath: string): Promise<{
|
|
31
|
+
passed: boolean;
|
|
32
|
+
issues: DoctorIssue[];
|
|
33
|
+
}>;
|
|
34
|
+
export declare function checkCollectionsVsDatabase(collections: EntityCollection[], databaseUrl: string): Promise<{
|
|
35
|
+
passed: boolean;
|
|
36
|
+
issues: DoctorIssue[];
|
|
37
|
+
}>;
|
|
38
|
+
export declare function renderReport(report: DoctorReport): void;
|
|
39
|
+
export declare function runDoctor(options: {
|
|
40
|
+
collectionsPath: string;
|
|
41
|
+
schemaPath: string;
|
|
42
|
+
databaseUrl?: string;
|
|
43
|
+
}): Promise<DoctorReport>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EntityCollection } from "@rebasepro/types";
|
|
2
|
-
export declare const generateSchema: (collections: EntityCollection[]) => Promise<string>;
|
|
2
|
+
export declare const generateSchema: (collections: EntityCollection[], stripPolicies?: boolean) => Promise<string>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const testTable: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "test";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "test";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "PgText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: false;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: false;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
};
|
|
23
|
+
dialect: "pg";
|
|
24
|
+
}>;
|
|
@@ -22,7 +22,12 @@ export declare class EntityFetchService {
|
|
|
22
22
|
* Build filter conditions from FilterValues
|
|
23
23
|
* Delegates to DrizzleConditionBuilder.buildFilterConditions
|
|
24
24
|
*/
|
|
25
|
-
buildFilterConditions<M extends Record<string,
|
|
25
|
+
buildFilterConditions<M extends Record<string, unknown>>(filter: FilterValues<Extract<keyof M, string>>, table: PgTable<any>, collectionPath: string): SQL[];
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the correct Drizzle column for sorting.
|
|
28
|
+
* Automatically maps owning relation property keys to their underlying foreign key column.
|
|
29
|
+
*/
|
|
30
|
+
private resolveOrderByField;
|
|
26
31
|
/**
|
|
27
32
|
* Build the `with` config for Drizzle's relational query API.
|
|
28
33
|
* Converts collection relations to a Drizzle-compatible `with` object.
|
|
@@ -63,6 +68,11 @@ export declare class EntityFetchService {
|
|
|
63
68
|
* Uses batch fetching to avoid N+1 queries for list views.
|
|
64
69
|
*/
|
|
65
70
|
private resolveJoinPathRelationsBatch;
|
|
71
|
+
/**
|
|
72
|
+
* Resolves joinPath relations for raw REST rows and directly injects them.
|
|
73
|
+
* Uses RelationService to query the database and maps results back to the flattened objects.
|
|
74
|
+
*/
|
|
75
|
+
private resolveJoinPathRelationsBatchRest;
|
|
66
76
|
/**
|
|
67
77
|
* Convert a db.query result row to a flat REST-style object with populated relations.
|
|
68
78
|
*/
|
|
@@ -79,15 +89,16 @@ export declare class EntityFetchService {
|
|
|
79
89
|
/**
|
|
80
90
|
* Fetch a single entity by ID
|
|
81
91
|
*/
|
|
82
|
-
fetchEntity<M extends Record<string,
|
|
92
|
+
fetchEntity<M extends Record<string, unknown>>(collectionPath: string, entityId: string | number, databaseId?: string): Promise<Entity<M> | undefined>;
|
|
83
93
|
/**
|
|
84
94
|
* Unified method to fetch entities with optional search functionality
|
|
85
95
|
*/
|
|
86
|
-
fetchEntitiesWithConditions<M extends Record<string,
|
|
96
|
+
fetchEntitiesWithConditions<M extends Record<string, unknown>>(collectionPath: string, options?: {
|
|
87
97
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
88
98
|
orderBy?: string;
|
|
89
99
|
order?: "desc" | "asc";
|
|
90
100
|
limit?: number;
|
|
101
|
+
offset?: number;
|
|
91
102
|
startAfter?: Record<string, unknown>;
|
|
92
103
|
searchString?: string;
|
|
93
104
|
databaseId?: string;
|
|
@@ -103,11 +114,12 @@ export declare class EntityFetchService {
|
|
|
103
114
|
/**
|
|
104
115
|
* Fetch a collection of entities
|
|
105
116
|
*/
|
|
106
|
-
fetchCollection<M extends Record<string,
|
|
117
|
+
fetchCollection<M extends Record<string, unknown>>(collectionPath: string, options?: {
|
|
107
118
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
108
119
|
orderBy?: string;
|
|
109
120
|
order?: "desc" | "asc";
|
|
110
121
|
limit?: number;
|
|
122
|
+
offset?: number;
|
|
111
123
|
startAfter?: Record<string, unknown>;
|
|
112
124
|
searchString?: string;
|
|
113
125
|
databaseId?: string;
|
|
@@ -115,7 +127,7 @@ export declare class EntityFetchService {
|
|
|
115
127
|
/**
|
|
116
128
|
* Search entities by text
|
|
117
129
|
*/
|
|
118
|
-
searchEntities<M extends Record<string,
|
|
130
|
+
searchEntities<M extends Record<string, unknown>>(collectionPath: string, searchString: string, options?: {
|
|
119
131
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
120
132
|
orderBy?: string;
|
|
121
133
|
order?: "desc" | "asc";
|
|
@@ -129,8 +141,9 @@ export declare class EntityFetchService {
|
|
|
129
141
|
/**
|
|
130
142
|
* Count entities in a collection
|
|
131
143
|
*/
|
|
132
|
-
countEntities<M extends Record<string,
|
|
144
|
+
countEntities<M extends Record<string, unknown>>(collectionPath: string, options?: {
|
|
133
145
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
146
|
+
searchString?: string;
|
|
134
147
|
databaseId?: string;
|
|
135
148
|
}): Promise<number>;
|
|
136
149
|
/**
|
|
@@ -153,11 +166,12 @@ export declare class EntityFetchService {
|
|
|
153
166
|
*
|
|
154
167
|
* @param include - Array of relation keys to populate, or ["*"] for all
|
|
155
168
|
*/
|
|
156
|
-
fetchCollectionForRest<M extends Record<string,
|
|
169
|
+
fetchCollectionForRest<M extends Record<string, unknown>>(collectionPath: string, options?: {
|
|
157
170
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
158
171
|
orderBy?: string;
|
|
159
172
|
order?: "desc" | "asc";
|
|
160
173
|
limit?: number;
|
|
174
|
+
offset?: number;
|
|
161
175
|
startAfter?: Record<string, unknown>;
|
|
162
176
|
searchString?: string;
|
|
163
177
|
databaseId?: string;
|
|
@@ -165,7 +179,7 @@ export declare class EntityFetchService {
|
|
|
165
179
|
/**
|
|
166
180
|
* Fetch a single entity with optional relation includes for REST API.
|
|
167
181
|
*/
|
|
168
|
-
fetchEntityForRest<M extends Record<string,
|
|
182
|
+
fetchEntityForRest<M extends Record<string, unknown>>(collectionPath: string, entityId: string | number, include?: string[], databaseId?: string): Promise<Record<string, unknown> | null>;
|
|
169
183
|
/**
|
|
170
184
|
* Fetch raw rows without any relation processing (for REST fast path)
|
|
171
185
|
*/
|
|
@@ -20,7 +20,7 @@ export declare class EntityPersistService {
|
|
|
20
20
|
/**
|
|
21
21
|
* Save an entity (create or update)
|
|
22
22
|
*/
|
|
23
|
-
saveEntity<M extends Record<string,
|
|
23
|
+
saveEntity<M extends Record<string, unknown>>(collectionPath: string, values: Partial<M>, entityId?: string | number, databaseId?: string): Promise<Entity<M>>;
|
|
24
24
|
/**
|
|
25
25
|
* Get the RelationService instance for external use
|
|
26
26
|
*/
|
|
@@ -12,7 +12,7 @@ export declare class RelationService {
|
|
|
12
12
|
/**
|
|
13
13
|
* Fetch entities related to a parent entity through a specific relation
|
|
14
14
|
*/
|
|
15
|
-
fetchRelatedEntities<M extends Record<string,
|
|
15
|
+
fetchRelatedEntities<M extends Record<string, unknown>>(parentCollectionPath: string, parentEntityId: string | number, relationKey: string, options?: {
|
|
16
16
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
17
17
|
orderBy?: string;
|
|
18
18
|
order?: "desc" | "asc";
|
|
@@ -24,7 +24,7 @@ export declare class RelationService {
|
|
|
24
24
|
/**
|
|
25
25
|
* Fetch entities using join paths for complex relations
|
|
26
26
|
*/
|
|
27
|
-
fetchEntitiesUsingJoins<M extends Record<string,
|
|
27
|
+
fetchEntitiesUsingJoins<M extends Record<string, unknown>>(parentCollection: EntityCollection, parentEntityId: string | number, relation: Relation, options?: {
|
|
28
28
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
29
29
|
orderBy?: string;
|
|
30
30
|
order?: "desc" | "asc";
|
|
@@ -36,18 +36,24 @@ export declare class RelationService {
|
|
|
36
36
|
/**
|
|
37
37
|
* Count related entities for a parent entity
|
|
38
38
|
*/
|
|
39
|
-
countRelatedEntities<M extends Record<string,
|
|
39
|
+
countRelatedEntities<M extends Record<string, unknown>>(parentCollectionPath: string, parentEntityId: string | number, relationKey: string, options?: {
|
|
40
40
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
41
41
|
databaseId?: string;
|
|
42
42
|
}): Promise<number>;
|
|
43
43
|
/**
|
|
44
44
|
* Batch fetch related entities for multiple parent entities to avoid N+1 queries
|
|
45
45
|
*/
|
|
46
|
-
batchFetchRelatedEntities(parentCollectionPath: string, parentEntityIds: (string | number)[], _relationKey: string, relation: Relation): Promise<Map<string
|
|
46
|
+
batchFetchRelatedEntities(parentCollectionPath: string, parentEntityIds: (string | number)[], _relationKey: string, relation: Relation): Promise<Map<string, Entity<Record<string, unknown>>>>;
|
|
47
|
+
/**
|
|
48
|
+
* Batch fetch many-cardinality related entities for multiple parent entities.
|
|
49
|
+
* Returns a Map<parentId, Entity[]> instead of Map<parentId, Entity>.
|
|
50
|
+
* Uses a single SQL query with IN clause to avoid N+1.
|
|
51
|
+
*/
|
|
52
|
+
batchFetchRelatedEntitiesMany(parentCollectionPath: string, parentEntityIds: (string | number)[], _relationKey: string, relation: Relation): Promise<Map<string, Entity<Record<string, unknown>>[]>>;
|
|
47
53
|
/**
|
|
48
54
|
* Update many-to-many and junction relations
|
|
49
55
|
*/
|
|
50
|
-
updateRelationsUsingJoins<M extends Record<string,
|
|
56
|
+
updateRelationsUsingJoins<M extends Record<string, unknown>>(tx: DrizzleClient, collection: EntityCollection, entityId: string | number, relationValues: Partial<M>): Promise<void>;
|
|
51
57
|
/**
|
|
52
58
|
* Update inverse relations (where FK is on the target table)
|
|
53
59
|
*/
|