@rebasepro/client-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/client/src/admin.d.ts +94 -0
- package/dist/client/src/auth.d.ts +161 -0
- package/dist/client/src/collection.d.ts +19 -0
- package/dist/client/src/cron.d.ts +25 -0
- package/dist/client/src/index.d.ts +42 -0
- package/dist/client/src/query_builder.d.ts +53 -0
- package/dist/client/src/reviver.d.ts +1 -0
- package/dist/client/src/storage.d.ts +3 -0
- package/dist/client/src/transport.d.ts +33 -0
- package/dist/client/src/websocket.d.ts +99 -0
- package/dist/index.es.js +28 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +28 -17
- package/dist/index.umd.js.map +1 -1
- 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/package.json +83 -86
- package/src/usePostgresClientDriver.ts +57 -29
- package/tsconfig.json +1 -0
- package/vite.config.ts +4 -4
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ListenCollectionProps,
|
|
11
11
|
ListenEntityProps,
|
|
12
12
|
SaveEntityProps,
|
|
13
|
-
|
|
13
|
+
BranchInfo
|
|
14
14
|
} from "@rebasepro/types";
|
|
15
15
|
import { RebaseWebSocketClient } from "@rebasepro/client";
|
|
16
16
|
|
|
@@ -28,7 +28,7 @@ export function usePostgresClientDriver(config: PostgresDataDriverConfig): Postg
|
|
|
28
28
|
|
|
29
29
|
return useMemo(() => {
|
|
30
30
|
if (!client) throw new Error("RebaseWebSocketClient must be provided in config.wsClient");
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
return {
|
|
33
33
|
|
|
34
34
|
key: "postgres",
|
|
@@ -40,12 +40,20 @@ export function usePostgresClientDriver(config: PostgresDataDriverConfig): Postg
|
|
|
40
40
|
async fetchCollection<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]> {
|
|
41
41
|
// Pick only the fields the client needs, ignoring extra fields from the CMS layer
|
|
42
42
|
const { path, filter, limit, startAfter, orderBy, searchString, order } = props;
|
|
43
|
-
return client.fetchCollection({ path,
|
|
43
|
+
return client.fetchCollection({ path,
|
|
44
|
+
filter,
|
|
45
|
+
limit,
|
|
46
|
+
startAfter,
|
|
47
|
+
orderBy,
|
|
48
|
+
searchString,
|
|
49
|
+
order }) as Promise<Entity<M>[]>;
|
|
44
50
|
},
|
|
45
51
|
|
|
46
52
|
async fetchEntity<M extends Record<string, any>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined> {
|
|
47
53
|
const { path, entityId, databaseId } = props;
|
|
48
|
-
return client.fetchEntity({ path,
|
|
54
|
+
return client.fetchEntity({ path,
|
|
55
|
+
entityId,
|
|
56
|
+
databaseId }) as Promise<Entity<M> | undefined>;
|
|
49
57
|
},
|
|
50
58
|
|
|
51
59
|
async saveEntity<M extends Record<string, any>>(props: SaveEntityProps<M>): Promise<Entity<M>> {
|
|
@@ -69,13 +77,25 @@ export function usePostgresClientDriver(config: PostgresDataDriverConfig): Postg
|
|
|
69
77
|
|
|
70
78
|
async countEntities<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<number> {
|
|
71
79
|
const { path, filter, limit, startAfter, orderBy, searchString, order } = props;
|
|
72
|
-
return client.countEntities({ path,
|
|
80
|
+
return client.countEntities({ path,
|
|
81
|
+
filter,
|
|
82
|
+
limit,
|
|
83
|
+
startAfter,
|
|
84
|
+
orderBy,
|
|
85
|
+
searchString,
|
|
86
|
+
order });
|
|
73
87
|
},
|
|
74
88
|
|
|
75
89
|
listenCollection<M extends Record<string, any>>(props: ListenCollectionProps<M>): () => void {
|
|
76
90
|
const { path, filter, limit, startAfter, orderBy, searchString, order, onUpdate, onError } = props;
|
|
77
91
|
return client.listenCollection(
|
|
78
|
-
{ path,
|
|
92
|
+
{ path,
|
|
93
|
+
filter,
|
|
94
|
+
limit,
|
|
95
|
+
startAfter,
|
|
96
|
+
orderBy,
|
|
97
|
+
searchString,
|
|
98
|
+
order },
|
|
79
99
|
(entities: Entity[]) => props.onUpdate(entities as Entity<M>[]),
|
|
80
100
|
props.onError
|
|
81
101
|
);
|
|
@@ -84,7 +104,9 @@ export function usePostgresClientDriver(config: PostgresDataDriverConfig): Postg
|
|
|
84
104
|
listenEntity<M extends Record<string, any>>(props: ListenEntityProps<M>): () => void {
|
|
85
105
|
const { path, entityId, databaseId, onUpdate, onError } = props;
|
|
86
106
|
return client.listenEntity(
|
|
87
|
-
{ path,
|
|
107
|
+
{ path,
|
|
108
|
+
entityId,
|
|
109
|
+
databaseId },
|
|
88
110
|
(entity: Entity | null) => {
|
|
89
111
|
props.onUpdate(entity as Entity<M> | null);
|
|
90
112
|
},
|
|
@@ -96,28 +118,34 @@ export function usePostgresClientDriver(config: PostgresDataDriverConfig): Postg
|
|
|
96
118
|
return true; // PostgreSQL supports complex filter combinations
|
|
97
119
|
},
|
|
98
120
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
admin: {
|
|
122
|
+
executeSql(sql: string, options?: { database?: string; role?: string }): Promise<Record<string, unknown>[]> {
|
|
123
|
+
return client.executeSql(sql, options);
|
|
124
|
+
},
|
|
125
|
+
fetchAvailableDatabases(): Promise<string[]> {
|
|
126
|
+
return client.fetchAvailableDatabases();
|
|
127
|
+
},
|
|
128
|
+
fetchAvailableRoles(): Promise<string[]> {
|
|
129
|
+
return client.fetchAvailableRoles();
|
|
130
|
+
},
|
|
131
|
+
fetchCurrentDatabase(): Promise<string | undefined> {
|
|
132
|
+
return client.fetchCurrentDatabase();
|
|
133
|
+
},
|
|
134
|
+
fetchUnmappedTables(mappedPaths?: string[]): Promise<string[]> {
|
|
135
|
+
return client.fetchUnmappedTables(mappedPaths);
|
|
136
|
+
},
|
|
137
|
+
fetchTableMetadata(tableName: string): Promise<unknown> {
|
|
138
|
+
return client.fetchTableMetadata(tableName);
|
|
139
|
+
},
|
|
140
|
+
createBranch(name: string, options?: { source?: string }): Promise<BranchInfo> {
|
|
141
|
+
return client.createBranch(name, options);
|
|
142
|
+
},
|
|
143
|
+
deleteBranch(name: string): Promise<void> {
|
|
144
|
+
return client.deleteBranch(name);
|
|
145
|
+
},
|
|
146
|
+
listBranches(): Promise<BranchInfo[]> {
|
|
147
|
+
return client.listBranches();
|
|
148
|
+
}
|
|
121
149
|
}
|
|
122
150
|
} as PostgresDataDriver;
|
|
123
151
|
}, [client]);
|
package/tsconfig.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -10,7 +10,7 @@ const ReactCompilerConfig = {
|
|
|
10
10
|
|
|
11
11
|
const isExternal = (id: string) => {
|
|
12
12
|
if (id.startsWith(".") || path.isAbsolute(id)) return false;
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
return true;
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -42,15 +42,15 @@ export default defineConfig(() => ({
|
|
|
42
42
|
alias: {
|
|
43
43
|
"@rebasepro/client": path.resolve(__dirname, "../client/src"),
|
|
44
44
|
"@rebasepro/core": path.resolve(__dirname, "../core/src"),
|
|
45
|
-
"@rebasepro/types": path.resolve(__dirname, "../types/src")
|
|
45
|
+
"@rebasepro/types": path.resolve(__dirname, "../types/src")
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
plugins: [
|
|
49
49
|
react({
|
|
50
50
|
babel: {
|
|
51
51
|
plugins: [
|
|
52
|
-
["babel-plugin-react-compiler", ReactCompilerConfig]
|
|
53
|
-
]
|
|
52
|
+
["babel-plugin-react-compiler", ReactCompilerConfig]
|
|
53
|
+
]
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
]
|