@rebasepro/client-postgresql 0.2.3 → 0.2.4
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 +0 -3
- package/dist/client/src/auth.d.ts +3 -1
- package/dist/client/src/index.d.ts +7 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/controllers/auth.d.ts +2 -24
- package/dist/types/src/controllers/client.d.ts +0 -3
- package/dist/types/src/controllers/collection_registry.d.ts +1 -1
- package/dist/types/src/controllers/data_driver.d.ts +18 -0
- package/dist/types/src/controllers/registry.d.ts +5 -4
- package/dist/types/src/rebase_context.d.ts +1 -1
- package/dist/types/src/types/auth_adapter.d.ts +2 -4
- package/dist/types/src/types/collections.d.ts +0 -4
- package/dist/types/src/types/component_ref.d.ts +1 -1
- package/dist/types/src/types/cron.d.ts +1 -1
- package/dist/types/src/types/entity_views.d.ts +1 -0
- package/dist/types/src/types/export_import.d.ts +1 -1
- package/dist/types/src/types/formex.d.ts +2 -2
- package/dist/types/src/types/properties.d.ts +2 -2
- package/dist/types/src/types/translations.d.ts +28 -12
- package/dist/types/src/types/user_management_delegate.d.ts +6 -4
- package/dist/types/src/users/roles.d.ts +0 -8
- package/package.json +3 -3
- package/src/usePostgresClientDriver.ts +1 -1
|
@@ -14,7 +14,6 @@ export interface RebaseRole {
|
|
|
14
14
|
name: string;
|
|
15
15
|
isAdmin: boolean;
|
|
16
16
|
defaultPermissions: Record<string, unknown> | null;
|
|
17
|
-
config: Record<string, unknown> | null;
|
|
18
17
|
}
|
|
19
18
|
export interface CreateAdminOptions {
|
|
20
19
|
adminPath?: string;
|
|
@@ -68,7 +67,6 @@ export declare function createAdmin(transport: Transport, options?: CreateAdminO
|
|
|
68
67
|
name: string;
|
|
69
68
|
isAdmin?: boolean;
|
|
70
69
|
defaultPermissions?: Record<string, unknown>;
|
|
71
|
-
config?: Record<string, unknown>;
|
|
72
70
|
}) => Promise<{
|
|
73
71
|
role: RebaseRole;
|
|
74
72
|
}>;
|
|
@@ -76,7 +74,6 @@ export declare function createAdmin(transport: Transport, options?: CreateAdminO
|
|
|
76
74
|
name?: string;
|
|
77
75
|
isAdmin?: boolean;
|
|
78
76
|
defaultPermissions?: Record<string, unknown>;
|
|
79
|
-
config?: Record<string, unknown>;
|
|
80
77
|
}) => Promise<{
|
|
81
78
|
role: RebaseRole;
|
|
82
79
|
}>;
|
|
@@ -24,7 +24,9 @@ export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "
|
|
|
24
24
|
export interface AuthConfig {
|
|
25
25
|
needsSetup: boolean;
|
|
26
26
|
registrationEnabled: boolean;
|
|
27
|
-
emailServiceEnabled
|
|
27
|
+
emailServiceEnabled?: boolean;
|
|
28
|
+
passwordReset?: boolean;
|
|
29
|
+
emailVerification?: boolean;
|
|
28
30
|
enabledProviders: string[];
|
|
29
31
|
}
|
|
30
32
|
export interface AuthStorage {
|
|
@@ -21,7 +21,9 @@ export interface CreateRebaseClientOptions extends RebaseClientConfig {
|
|
|
21
21
|
}
|
|
22
22
|
import { RebaseWebSocketClient } from "./websocket";
|
|
23
23
|
import { RebaseClient as BaseRebaseClient, RebaseData, StorageSource } from "@rebasepro/types";
|
|
24
|
-
export type
|
|
24
|
+
export type { Entity, FindResponse } from "@rebasepro/types";
|
|
25
|
+
type KebabToCamelCase<S extends string> = S extends `${infer T}-${infer U}` ? `${T}${Capitalize<KebabToCamelCase<U>>}` : S;
|
|
26
|
+
export type RebaseClient<DB = Record<string, unknown>> = Omit<BaseRebaseClient<DB>, "data"> & {
|
|
25
27
|
setToken: (token: string | null) => void;
|
|
26
28
|
setAuthTokenGetter: (getter: () => Promise<string | null>) => void;
|
|
27
29
|
setOnUnauthorized: (handler: () => Promise<boolean>) => void;
|
|
@@ -33,14 +35,14 @@ export type RebaseClient<DB = Record<string, unknown>> = BaseRebaseClient<DB> &
|
|
|
33
35
|
ws?: RebaseWebSocketClient;
|
|
34
36
|
storage?: StorageSource;
|
|
35
37
|
call: <T = unknown>(endpoint: string, payload?: unknown) => Promise<T>;
|
|
36
|
-
data:
|
|
37
|
-
collection<
|
|
38
|
+
data: {
|
|
39
|
+
collection<S extends string>(slug: S): CollectionClient<KebabToCamelCase<S> extends keyof DB ? (DB[KebabToCamelCase<S>] extends {
|
|
38
40
|
Row: infer R extends Record<string, unknown>;
|
|
39
|
-
} ? R : Record<string, unknown>>;
|
|
41
|
+
} ? R : Record<string, unknown>) : Record<string, unknown>>;
|
|
40
42
|
} & {
|
|
41
43
|
[K in keyof DB]: CollectionClient<DB[K] extends {
|
|
42
44
|
Row: infer R extends Record<string, unknown>;
|
|
43
45
|
} ? R : Record<string, unknown>>;
|
|
44
|
-
};
|
|
46
|
+
} & RebaseData;
|
|
45
47
|
};
|
|
46
48
|
export declare function createRebaseClient<DB = Record<string, unknown>>(options: CreateRebaseClientOptions): RebaseClient<DB>;
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/usePostgresClientDriver.ts"],"sourcesContent":["import { useMemo, useEffect } from \"react\";\nimport {\n DataDriver,\n DeleteEntityProps,\n Entity,\n EntityCollection,\n EntityReference, EntityRelation,\n FetchCollectionProps,\n FetchEntityProps,\n ListenCollectionProps,\n ListenEntityProps,\n SaveEntityProps,\n BranchInfo\n} from \"@rebasepro/types\";\nimport { RebaseWebSocketClient } from \"@rebasepro/client\";\n\nexport interface PostgresDataDriverConfig {\n wsClient?: RebaseWebSocketClient;\n}\n\nexport interface PostgresDataDriver extends DataDriver {\n client?: RebaseWebSocketClient;\n}\n\n\nexport function usePostgresClientDriver(config: PostgresDataDriverConfig): PostgresDataDriver {\n const client = config.wsClient;\n\n return useMemo(() => {\n if (!client) throw new Error(\"RebaseWebSocketClient must be provided in config.wsClient\");\n\n return {\n\n key: \"postgres\",\n\n name: \"PostgreSQL\",\n\n client,\n\n async fetchCollection<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]> {\n // Pick only the fields the client needs, ignoring extra fields from the CMS layer\n const { path, filter, limit, startAfter, orderBy, searchString, order } = props;\n return client.fetchCollection({ path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder }) as Promise<Entity<M>[]>;\n },\n\n async fetchEntity<M extends Record<string, any>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined> {\n const { path, entityId, databaseId } = props;\n return client.fetchEntity({ path,\nentityId,\ndatabaseId }) as Promise<Entity<M> | undefined>;\n },\n\n async saveEntity<M extends Record<string, any>>(props: SaveEntityProps<M>): Promise<Entity<M>> {\n return client.saveEntity({\n path: props.path,\n values: props.values,\n entityId: props.entityId,\n previousValues: props.previousValues,\n status: props.status\n }) as Promise<Entity<M>>;\n },\n\n async deleteEntity<M extends Record<string, any>>(props: DeleteEntityProps<M>): Promise<void> {\n const { entity } = props;\n return client.deleteEntity({ entity });\n },\n\n async checkUniqueField(path: string, name: string, value:
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/usePostgresClientDriver.ts"],"sourcesContent":["import { useMemo, useEffect } from \"react\";\nimport {\n DataDriver,\n DeleteEntityProps,\n Entity,\n EntityCollection,\n EntityReference, EntityRelation,\n FetchCollectionProps,\n FetchEntityProps,\n ListenCollectionProps,\n ListenEntityProps,\n SaveEntityProps,\n BranchInfo\n} from \"@rebasepro/types\";\nimport { RebaseWebSocketClient } from \"@rebasepro/client\";\n\nexport interface PostgresDataDriverConfig {\n wsClient?: RebaseWebSocketClient;\n}\n\nexport interface PostgresDataDriver extends DataDriver {\n client?: RebaseWebSocketClient;\n}\n\n\nexport function usePostgresClientDriver(config: PostgresDataDriverConfig): PostgresDataDriver {\n const client = config.wsClient;\n\n return useMemo(() => {\n if (!client) throw new Error(\"RebaseWebSocketClient must be provided in config.wsClient\");\n\n return {\n\n key: \"postgres\",\n\n name: \"PostgreSQL\",\n\n client,\n\n async fetchCollection<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]> {\n // Pick only the fields the client needs, ignoring extra fields from the CMS layer\n const { path, filter, limit, startAfter, orderBy, searchString, order } = props;\n return client.fetchCollection({ path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder }) as Promise<Entity<M>[]>;\n },\n\n async fetchEntity<M extends Record<string, any>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined> {\n const { path, entityId, databaseId } = props;\n return client.fetchEntity({ path,\nentityId,\ndatabaseId }) as Promise<Entity<M> | undefined>;\n },\n\n async saveEntity<M extends Record<string, any>>(props: SaveEntityProps<M>): Promise<Entity<M>> {\n return client.saveEntity({\n path: props.path,\n values: props.values,\n entityId: props.entityId,\n previousValues: props.previousValues,\n status: props.status\n }) as Promise<Entity<M>>;\n },\n\n async deleteEntity<M extends Record<string, any>>(props: DeleteEntityProps<M>): Promise<void> {\n const { entity } = props;\n return client.deleteEntity({ entity });\n },\n\n async checkUniqueField(path: string, name: string, value: unknown, entityId?: string, collection?: EntityCollection): Promise<boolean> {\n return client.checkUniqueField(path, name, value, entityId, collection);\n },\n\n async countEntities<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<number> {\n const { path, filter, limit, startAfter, orderBy, searchString, order } = props;\n return client.countEntities({ path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder });\n },\n\n listenCollection<M extends Record<string, any>>(props: ListenCollectionProps<M>): () => void {\n const { path, filter, limit, startAfter, orderBy, searchString, order, onUpdate, onError } = props;\n return client.listenCollection(\n { path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder },\n (entities: Entity[]) => props.onUpdate(entities as Entity<M>[]),\n props.onError\n );\n },\n\n listenEntity<M extends Record<string, any>>(props: ListenEntityProps<M>): () => void {\n const { path, entityId, databaseId, onUpdate, onError } = props;\n return client.listenEntity(\n { path,\nentityId,\ndatabaseId },\n (entity: Entity | null) => {\n props.onUpdate(entity as Entity<M> | null);\n },\n props.onError\n );\n },\n\n isFilterCombinationValid(): boolean {\n return true; // PostgreSQL supports complex filter combinations\n },\n\n admin: {\n executeSql(sql: string, options?: { database?: string; role?: string }): Promise<Record<string, unknown>[]> {\n return client.executeSql(sql, options);\n },\n fetchAvailableDatabases(): Promise<string[]> {\n return client.fetchAvailableDatabases();\n },\n fetchAvailableRoles(): Promise<string[]> {\n return client.fetchAvailableRoles();\n },\n fetchCurrentDatabase(): Promise<string | undefined> {\n return client.fetchCurrentDatabase();\n },\n fetchUnmappedTables(mappedPaths?: string[]): Promise<string[]> {\n return client.fetchUnmappedTables(mappedPaths);\n },\n fetchTableMetadata(tableName: string): Promise<unknown> {\n return client.fetchTableMetadata(tableName);\n },\n createBranch(name: string, options?: { source?: string }): Promise<BranchInfo> {\n return client.createBranch(name, options);\n },\n deleteBranch(name: string): Promise<void> {\n return client.deleteBranch(name);\n },\n listBranches(): Promise<BranchInfo[]> {\n return client.listBranches();\n }\n }\n } as PostgresDataDriver;\n }, [client]);\n\n}\n"],"names":["usePostgresClientDriver","config","$","_c","client","wsClient","t0","Error","t1","key","name","fetchCollection","props","path","filter","limit","startAfter","orderBy","searchString","order","fetchEntity","props_0","path_0","entityId","databaseId","saveEntity","props_1","values","previousValues","status","deleteEntity","props_2","entity","checkUniqueField","path_1","value","entityId_0","collection","countEntities","props_3","path_2","filter_0","limit_0","startAfter_0","orderBy_0","searchString_0","order_0","listenCollection","props_4","path_3","filter_1","limit_1","startAfter_1","orderBy_1","searchString_1","order_1","entities","onUpdate","onError","listenEntity","props_5","path_4","entityId_1","databaseId_0","entity_0","isFilterCombinationValid","admin","executeSql","sql","options","fetchAvailableDatabases","fetchAvailableRoles","fetchCurrentDatabase","fetchUnmappedTables","mappedPaths","fetchTableMetadata","tableName","createBranch","name_0","options_0","deleteBranch","name_1","listBranches"],"mappings":";AAyBO,SAAAA,wBAAAC,QAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA;AACH,QAAAC,SAAeH,OAAMI;AAAU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AAAAA,QAAAA,GAAUwC,CAAAA,aAAA;AAEUpD,kBAAK6C,SAAUzB,QAA0B;AAAA,QAAC,GAE9CpB,QAAK8C,OACT;AAAA,MAAC;AAAA,MAAAO,2BAAA;AAAA,eAAA;AAAA,MAAA;AAAA,MAAAC,OAAA;AAAA,QAAAC,WAAAC,KAAAC,SAAA;AAAA,iBASUjE,OAAM+D,WAAYC,KAAKC,OAAO;AAAA,QAAC;AAAA,QAAAC,0BAAA;AAAA,iBAG/BlE,OAAMkE,wBAAAA;AAAAA,QAA0B;AAAA,QAAAC,sBAAA;AAAA,iBAGhCnE,OAAMmE,oBAAAA;AAAAA,QAAsB;AAAA,QAAAC,uBAAA;AAAA,iBAG5BpE,OAAMoE,qBAAAA;AAAAA,QAAuB;AAAA,QAAAC,oBAAAC,aAAA;AAAA,iBAG7BtE,OAAMqE,oBAAqBC,WAAW;AAAA,QAAC;AAAA,QAAAC,mBAAAC,WAAA;AAAA,iBAGvCxE,OAAMuE,mBAAoBC,SAAS;AAAA,QAAC;AAAA,QAAAC,aAAAC,QAAAC,WAAA;AAAA,iBAGpC3E,OAAMyE,aAAcnE,QAAM2D,SAAO;AAAA,QAAC;AAAA,QAAAW,aAAAC,QAAA;AAAA,iBAGlC7E,OAAM4E,aAActE,MAAI;AAAA,QAAC;AAAA,QAAAwE,eAAA;AAAA,iBAGzB9E,OAAM8E,aAAAA;AAAAA,QAAe;AAAA,MAAA;AAAA,IAAA;AAGvChF,WAAAE;AAAAF,WAAAM;AAAAA,EAAA,OAAA;AAAAA,SAAAN,EAAA,CAAA;AAAA,EAAA;AAtHGI,OAAOE;AAsHa,SAzHjBF;AA0HK;"}
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/usePostgresClientDriver.ts"],"sourcesContent":["import { useMemo, useEffect } from \"react\";\nimport {\n DataDriver,\n DeleteEntityProps,\n Entity,\n EntityCollection,\n EntityReference, EntityRelation,\n FetchCollectionProps,\n FetchEntityProps,\n ListenCollectionProps,\n ListenEntityProps,\n SaveEntityProps,\n BranchInfo\n} from \"@rebasepro/types\";\nimport { RebaseWebSocketClient } from \"@rebasepro/client\";\n\nexport interface PostgresDataDriverConfig {\n wsClient?: RebaseWebSocketClient;\n}\n\nexport interface PostgresDataDriver extends DataDriver {\n client?: RebaseWebSocketClient;\n}\n\n\nexport function usePostgresClientDriver(config: PostgresDataDriverConfig): PostgresDataDriver {\n const client = config.wsClient;\n\n return useMemo(() => {\n if (!client) throw new Error(\"RebaseWebSocketClient must be provided in config.wsClient\");\n\n return {\n\n key: \"postgres\",\n\n name: \"PostgreSQL\",\n\n client,\n\n async fetchCollection<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]> {\n // Pick only the fields the client needs, ignoring extra fields from the CMS layer\n const { path, filter, limit, startAfter, orderBy, searchString, order } = props;\n return client.fetchCollection({ path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder }) as Promise<Entity<M>[]>;\n },\n\n async fetchEntity<M extends Record<string, any>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined> {\n const { path, entityId, databaseId } = props;\n return client.fetchEntity({ path,\nentityId,\ndatabaseId }) as Promise<Entity<M> | undefined>;\n },\n\n async saveEntity<M extends Record<string, any>>(props: SaveEntityProps<M>): Promise<Entity<M>> {\n return client.saveEntity({\n path: props.path,\n values: props.values,\n entityId: props.entityId,\n previousValues: props.previousValues,\n status: props.status\n }) as Promise<Entity<M>>;\n },\n\n async deleteEntity<M extends Record<string, any>>(props: DeleteEntityProps<M>): Promise<void> {\n const { entity } = props;\n return client.deleteEntity({ entity });\n },\n\n async checkUniqueField(path: string, name: string, value:
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/usePostgresClientDriver.ts"],"sourcesContent":["import { useMemo, useEffect } from \"react\";\nimport {\n DataDriver,\n DeleteEntityProps,\n Entity,\n EntityCollection,\n EntityReference, EntityRelation,\n FetchCollectionProps,\n FetchEntityProps,\n ListenCollectionProps,\n ListenEntityProps,\n SaveEntityProps,\n BranchInfo\n} from \"@rebasepro/types\";\nimport { RebaseWebSocketClient } from \"@rebasepro/client\";\n\nexport interface PostgresDataDriverConfig {\n wsClient?: RebaseWebSocketClient;\n}\n\nexport interface PostgresDataDriver extends DataDriver {\n client?: RebaseWebSocketClient;\n}\n\n\nexport function usePostgresClientDriver(config: PostgresDataDriverConfig): PostgresDataDriver {\n const client = config.wsClient;\n\n return useMemo(() => {\n if (!client) throw new Error(\"RebaseWebSocketClient must be provided in config.wsClient\");\n\n return {\n\n key: \"postgres\",\n\n name: \"PostgreSQL\",\n\n client,\n\n async fetchCollection<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]> {\n // Pick only the fields the client needs, ignoring extra fields from the CMS layer\n const { path, filter, limit, startAfter, orderBy, searchString, order } = props;\n return client.fetchCollection({ path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder }) as Promise<Entity<M>[]>;\n },\n\n async fetchEntity<M extends Record<string, any>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined> {\n const { path, entityId, databaseId } = props;\n return client.fetchEntity({ path,\nentityId,\ndatabaseId }) as Promise<Entity<M> | undefined>;\n },\n\n async saveEntity<M extends Record<string, any>>(props: SaveEntityProps<M>): Promise<Entity<M>> {\n return client.saveEntity({\n path: props.path,\n values: props.values,\n entityId: props.entityId,\n previousValues: props.previousValues,\n status: props.status\n }) as Promise<Entity<M>>;\n },\n\n async deleteEntity<M extends Record<string, any>>(props: DeleteEntityProps<M>): Promise<void> {\n const { entity } = props;\n return client.deleteEntity({ entity });\n },\n\n async checkUniqueField(path: string, name: string, value: unknown, entityId?: string, collection?: EntityCollection): Promise<boolean> {\n return client.checkUniqueField(path, name, value, entityId, collection);\n },\n\n async countEntities<M extends Record<string, any>>(props: FetchCollectionProps<M>): Promise<number> {\n const { path, filter, limit, startAfter, orderBy, searchString, order } = props;\n return client.countEntities({ path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder });\n },\n\n listenCollection<M extends Record<string, any>>(props: ListenCollectionProps<M>): () => void {\n const { path, filter, limit, startAfter, orderBy, searchString, order, onUpdate, onError } = props;\n return client.listenCollection(\n { path,\nfilter,\nlimit,\nstartAfter,\norderBy,\nsearchString,\norder },\n (entities: Entity[]) => props.onUpdate(entities as Entity<M>[]),\n props.onError\n );\n },\n\n listenEntity<M extends Record<string, any>>(props: ListenEntityProps<M>): () => void {\n const { path, entityId, databaseId, onUpdate, onError } = props;\n return client.listenEntity(\n { path,\nentityId,\ndatabaseId },\n (entity: Entity | null) => {\n props.onUpdate(entity as Entity<M> | null);\n },\n props.onError\n );\n },\n\n isFilterCombinationValid(): boolean {\n return true; // PostgreSQL supports complex filter combinations\n },\n\n admin: {\n executeSql(sql: string, options?: { database?: string; role?: string }): Promise<Record<string, unknown>[]> {\n return client.executeSql(sql, options);\n },\n fetchAvailableDatabases(): Promise<string[]> {\n return client.fetchAvailableDatabases();\n },\n fetchAvailableRoles(): Promise<string[]> {\n return client.fetchAvailableRoles();\n },\n fetchCurrentDatabase(): Promise<string | undefined> {\n return client.fetchCurrentDatabase();\n },\n fetchUnmappedTables(mappedPaths?: string[]): Promise<string[]> {\n return client.fetchUnmappedTables(mappedPaths);\n },\n fetchTableMetadata(tableName: string): Promise<unknown> {\n return client.fetchTableMetadata(tableName);\n },\n createBranch(name: string, options?: { source?: string }): Promise<BranchInfo> {\n return client.createBranch(name, options);\n },\n deleteBranch(name: string): Promise<void> {\n return client.deleteBranch(name);\n },\n listBranches(): Promise<BranchInfo[]> {\n return client.listBranches();\n }\n }\n } as PostgresDataDriver;\n }, [client]);\n\n}\n"],"names":["usePostgresClientDriver","config","$","_c","client","wsClient","t0","Error","t1","key","name","fetchCollection","props","path","filter","limit","startAfter","orderBy","searchString","order","fetchEntity","props_0","path_0","entityId","databaseId","saveEntity","props_1","values","previousValues","status","deleteEntity","props_2","entity","checkUniqueField","path_1","value","entityId_0","collection","countEntities","props_3","path_2","filter_0","limit_0","startAfter_0","orderBy_0","searchString_0","order_0","listenCollection","props_4","path_3","filter_1","limit_1","startAfter_1","orderBy_1","searchString_1","order_1","entities","onUpdate","onError","listenEntity","props_5","path_4","entityId_1","databaseId_0","entity_0","isFilterCombinationValid","admin","executeSql","sql","options","fetchAvailableDatabases","fetchAvailableRoles","fetchCurrentDatabase","fetchUnmappedTables","mappedPaths","fetchTableMetadata","tableName","createBranch","name_0","options_0","deleteBranch","name_1","listBranches"],"mappings":";;;;AAyBO,WAAAA,wBAAAC,QAAA;AAAA,UAAAC,IAAAC,qBAAAA,EAAA,CAAA;AACH,UAAAC,SAAeH,OAAMI;AAAU,QAAAC;AAAA,QAAA,CAGtBF,QAAM;AAAA,YAAA,IAAAG,MAAkB,2DAA2D;AAAA,IAAA;AAAA,QAAAC;AAAA,QAAAN,SAAAE,QAAA;AAEjFI,WAAA;AAAA,QAAAC,KAEF;AAAA,QAAUC,MAET;AAAA,QAAYN;AAAAA,QAAA,MAAAO,gBAAAC,OAAA;AAMd,gBAAA;AAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,UAAAA,IAA0EP;AAAM,iBACzER,OAAMO,gBAAA;AAAA,YAAAE;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,UAAAA,CAMlB;AAAA,QAAyB;AAAA,QAAA,MAAAC,YAAAC,SAAA;AAIpB,gBAAA;AAAA,YAAAR,MAAAS;AAAAA,YAAAC;AAAAA,YAAAC;AAAAA,UAAAA,IAAuCZ;AAAM,iBACtCR,OAAMgB,YAAA;AAAA,YAAAP,MAAeA;AAAAA,YAAIU;AAAAA,YAAAC;AAAAA,UAAAA,CAEhC;AAAA,QAAmC;AAAA,QAAA,MAAAC,WAAAC,SAAA;AAAA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,OAAM4E,aAActE,MAAI;AAAA,UAAC;AAAA,UAAAwE,eAAA;AAAA,mBAGzB9E,OAAM8E,aAAAA;AAAAA,UAAe;AAAA,QAAA;AAAA,MAAA;AAGvChF,aAAAE;AAAAF,aAAAM;AAAAA,IAAA,OAAA;AAAAA,WAAAN,EAAA,CAAA;AAAA,IAAA;AAtHGI,SAAOE;AAsHa,WAzHjBF;AAAAA,EA0HK;;;;"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { StorageSource } from "./storage";
|
|
2
1
|
import { Role, User } from "../users";
|
|
3
|
-
import { RebaseData } from "./data";
|
|
4
2
|
/**
|
|
5
3
|
* Capabilities advertised by an auth provider.
|
|
6
4
|
* UI components use this to show/hide features dynamically
|
|
@@ -89,6 +87,8 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
89
87
|
code: string;
|
|
90
88
|
redirectUri: string;
|
|
91
89
|
}) => Promise<void>;
|
|
90
|
+
/** Generic OAuth login — works with any provider. Posts payload to /auth/{providerId}. */
|
|
91
|
+
oauthLogin?: (providerId: string, payload: Record<string, unknown>) => Promise<void>;
|
|
92
92
|
/** Register a new user */
|
|
93
93
|
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
94
94
|
/** Skip login (for anonymous access if enabled) */
|
|
@@ -102,25 +102,3 @@ export interface AuthControllerExtended<USER extends User = User, ExtraData = un
|
|
|
102
102
|
/** Update user profile */
|
|
103
103
|
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
104
104
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Implement this function to allow access to specific users.
|
|
107
|
-
* @group Hooks and utilities
|
|
108
|
-
*/
|
|
109
|
-
export type Authenticator<USER extends User = User> = (props: {
|
|
110
|
-
/**
|
|
111
|
-
* Logged-in user or null
|
|
112
|
-
*/
|
|
113
|
-
user: USER | null;
|
|
114
|
-
/**
|
|
115
|
-
* AuthController
|
|
116
|
-
*/
|
|
117
|
-
authController: AuthController<USER>;
|
|
118
|
-
/**
|
|
119
|
-
* Unified data access API
|
|
120
|
-
*/
|
|
121
|
-
data: RebaseData;
|
|
122
|
-
/**
|
|
123
|
-
* Used storage implementation
|
|
124
|
-
*/
|
|
125
|
-
storageSource: StorageSource;
|
|
126
|
-
}) => boolean | Promise<boolean>;
|
|
@@ -65,7 +65,6 @@ export interface AdminRole {
|
|
|
65
65
|
name: string;
|
|
66
66
|
isAdmin: boolean;
|
|
67
67
|
defaultPermissions: Record<string, unknown> | null;
|
|
68
|
-
config: Record<string, unknown> | null;
|
|
69
68
|
}
|
|
70
69
|
/**
|
|
71
70
|
* Client-side Admin API interface.
|
|
@@ -123,7 +122,6 @@ export interface AdminAPI {
|
|
|
123
122
|
name: string;
|
|
124
123
|
isAdmin?: boolean;
|
|
125
124
|
defaultPermissions?: Record<string, unknown>;
|
|
126
|
-
config?: Record<string, unknown>;
|
|
127
125
|
}): Promise<{
|
|
128
126
|
role: AdminRole;
|
|
129
127
|
}>;
|
|
@@ -131,7 +129,6 @@ export interface AdminAPI {
|
|
|
131
129
|
name?: string;
|
|
132
130
|
isAdmin?: boolean;
|
|
133
131
|
defaultPermissions?: Record<string, unknown>;
|
|
134
|
-
config?: Record<string, unknown>;
|
|
135
132
|
}): Promise<{
|
|
136
133
|
role: AdminRole;
|
|
137
134
|
}>;
|
|
@@ -4,7 +4,7 @@ import type { EntityReference } from "../types/entities";
|
|
|
4
4
|
* Controller that provides access to the registered entity collections.
|
|
5
5
|
* @group Models
|
|
6
6
|
*/
|
|
7
|
-
export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection
|
|
7
|
+
export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection> = {
|
|
8
8
|
/**
|
|
9
9
|
* List of the mapped collections in the CMS.
|
|
10
10
|
* Each entry relates to a collection in the root database.
|
|
@@ -17,6 +17,21 @@ export type ListenEntityProps<M extends Record<string, unknown> = Record<string,
|
|
|
17
17
|
onUpdate: (entity: Entity<M> | null) => void;
|
|
18
18
|
onError?: (error: Error) => void;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for vector similarity search queries.
|
|
22
|
+
* Vector search applies an ORDER BY distance expression and optionally
|
|
23
|
+
* filters results by a distance threshold.
|
|
24
|
+
*/
|
|
25
|
+
export interface VectorSearchParams {
|
|
26
|
+
/** Property name containing the vector column */
|
|
27
|
+
property: string;
|
|
28
|
+
/** Query vector to compare against */
|
|
29
|
+
vector: number[];
|
|
30
|
+
/** Distance function (default: "cosine") */
|
|
31
|
+
distance?: "cosine" | "l2" | "inner_product";
|
|
32
|
+
/** Only return results within this distance threshold */
|
|
33
|
+
threshold?: number;
|
|
34
|
+
}
|
|
20
35
|
/**
|
|
21
36
|
* @internal
|
|
22
37
|
*/
|
|
@@ -30,6 +45,8 @@ export interface FetchCollectionProps<M extends Record<string, unknown> = Record
|
|
|
30
45
|
orderBy?: string;
|
|
31
46
|
searchString?: string;
|
|
32
47
|
order?: "desc" | "asc";
|
|
48
|
+
/** Vector similarity search configuration */
|
|
49
|
+
vectorSearch?: VectorSearchParams;
|
|
33
50
|
}
|
|
34
51
|
/**
|
|
35
52
|
* @internal
|
|
@@ -187,6 +204,7 @@ export interface RestFetchService {
|
|
|
187
204
|
startAfter?: Record<string, unknown>;
|
|
188
205
|
searchString?: string;
|
|
189
206
|
databaseId?: string;
|
|
207
|
+
vectorSearch?: VectorSearchParams;
|
|
190
208
|
}, include?: string[]): Promise<Record<string, unknown>[]>;
|
|
191
209
|
/**
|
|
192
210
|
* Fetch a single flattened entity with optional relation includes.
|
|
@@ -4,6 +4,7 @@ import type { EntityCollectionsBuilder } from "../types/builders";
|
|
|
4
4
|
import type { EntityCustomView } from "../types/entity_views";
|
|
5
5
|
import type { EntityAction } from "../types/entity_actions";
|
|
6
6
|
import type { AppView, NavigationGroupMapping } from "./navigation";
|
|
7
|
+
import type { RebasePlugin } from "../types/plugins";
|
|
7
8
|
/**
|
|
8
9
|
* Options to enable the built-in collection editor.
|
|
9
10
|
* When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
|
|
@@ -19,12 +20,12 @@ export interface CollectionEditorOptions {
|
|
|
19
20
|
/** Suggested base paths shown when creating new collections. */
|
|
20
21
|
pathSuggestions?: string[];
|
|
21
22
|
}
|
|
22
|
-
export interface RebaseCMSConfig<EC extends EntityCollection =
|
|
23
|
+
export interface RebaseCMSConfig<EC extends EntityCollection = EntityCollection> {
|
|
23
24
|
collections?: EC[] | EntityCollectionsBuilder<EC>;
|
|
24
25
|
homePage?: ReactNode;
|
|
25
|
-
entityViews?: EntityCustomView
|
|
26
|
+
entityViews?: EntityCustomView[];
|
|
26
27
|
entityActions?: EntityAction[];
|
|
27
|
-
plugins?:
|
|
28
|
+
plugins?: RebasePlugin[];
|
|
28
29
|
/**
|
|
29
30
|
* Centralized configuration for how collections and views are grouped
|
|
30
31
|
* in the navigation sidebar and home page.
|
|
@@ -42,7 +43,7 @@ export interface RebaseCMSConfig<EC extends EntityCollection = any> {
|
|
|
42
43
|
collectionEditor?: boolean | CollectionEditorOptions;
|
|
43
44
|
}
|
|
44
45
|
export interface RebaseStudioConfig {
|
|
45
|
-
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api")[];
|
|
46
|
+
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api" | "logs")[];
|
|
46
47
|
homePage?: ReactNode;
|
|
47
48
|
devViews?: AppView[];
|
|
48
49
|
}
|
|
@@ -28,7 +28,7 @@ export type RebaseCallContext<USER extends User = User> = {
|
|
|
28
28
|
* const { client } = props.context;
|
|
29
29
|
* const result = await client.functions.invoke('extract-job', { url });
|
|
30
30
|
*/
|
|
31
|
-
client: RebaseClient
|
|
31
|
+
client: RebaseClient;
|
|
32
32
|
/**
|
|
33
33
|
* Unified data access — `context.data.products.create(...)`.
|
|
34
34
|
* Access any collection as a dynamic property.
|
|
@@ -133,7 +133,7 @@ export interface AuthUserData {
|
|
|
133
133
|
displayName?: string | null;
|
|
134
134
|
photoUrl?: string | null;
|
|
135
135
|
emailVerified?: boolean;
|
|
136
|
-
metadata?: Record<string,
|
|
136
|
+
metadata?: Record<string, unknown>;
|
|
137
137
|
createdAt?: Date;
|
|
138
138
|
updatedAt?: Date;
|
|
139
139
|
}
|
|
@@ -146,7 +146,7 @@ export interface AuthCreateUserData {
|
|
|
146
146
|
password?: string;
|
|
147
147
|
displayName?: string;
|
|
148
148
|
photoUrl?: string;
|
|
149
|
-
metadata?: Record<string,
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
* Role data exposed by the auth adapter.
|
|
@@ -168,7 +168,6 @@ export interface AuthRoleData {
|
|
|
168
168
|
edit?: boolean;
|
|
169
169
|
delete?: boolean;
|
|
170
170
|
}> | null;
|
|
171
|
-
config?: Record<string, unknown> | null;
|
|
172
171
|
}
|
|
173
172
|
/**
|
|
174
173
|
* Data for creating a role.
|
|
@@ -180,7 +179,6 @@ export interface AuthCreateRoleData {
|
|
|
180
179
|
isAdmin?: boolean;
|
|
181
180
|
defaultPermissions?: AuthRoleData["defaultPermissions"];
|
|
182
181
|
collectionPermissions?: AuthRoleData["collectionPermissions"];
|
|
183
|
-
config?: AuthRoleData["config"];
|
|
184
182
|
}
|
|
185
183
|
/**
|
|
186
184
|
* User management operations for the admin panel.
|
|
@@ -589,10 +589,6 @@ export interface FilterPreset<Key extends string = string> {
|
|
|
589
589
|
*/
|
|
590
590
|
sort?: [Key, "asc" | "desc"];
|
|
591
591
|
}
|
|
592
|
-
/**
|
|
593
|
-
* @deprecated Use {@link FilterPreset} instead.
|
|
594
|
-
*/
|
|
595
|
-
export type QuickFilter<Key extends string = string> = FilterPreset<Key>;
|
|
596
592
|
/**
|
|
597
593
|
* Used to indicate valid filter combinations (e.g. created in Firestore)
|
|
598
594
|
* If the user selects a specific filter/sort combination, the CMS checks if it's
|
|
@@ -37,7 +37,7 @@ export interface LazyComponentRef<P = unknown> {
|
|
|
37
37
|
*
|
|
38
38
|
* @group Types
|
|
39
39
|
*/
|
|
40
|
-
export type ComponentRef<P =
|
|
40
|
+
export type ComponentRef<P = any> = React.ComponentType<P> | LazyComponentRef<P> | (() => Promise<{
|
|
41
41
|
default: React.ComponentType<P>;
|
|
42
42
|
}>) | string;
|
|
43
43
|
/**
|
|
@@ -44,7 +44,7 @@ export interface CronJobContext {
|
|
|
44
44
|
/** A simple logger scoped to this job run. */
|
|
45
45
|
log: (...args: unknown[]) => void;
|
|
46
46
|
/** The RebaseClient instance to interact with the database. */
|
|
47
|
-
client: RebaseClient
|
|
47
|
+
client: RebaseClient;
|
|
48
48
|
}
|
|
49
49
|
export type CronJobRunState = "idle" | "running" | "success" | "error" | "disabled";
|
|
50
50
|
/**
|
|
@@ -50,6 +50,7 @@ export interface FormContext<M extends Record<string, unknown> = Record<string,
|
|
|
50
50
|
export type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
|
|
51
51
|
key: string;
|
|
52
52
|
name: string;
|
|
53
|
+
icon?: string | React.ReactNode;
|
|
53
54
|
tabComponent?: React.ReactNode;
|
|
54
55
|
includeActions?: boolean | "bottom";
|
|
55
56
|
Builder?: ComponentRef<EntityCustomViewParams<M>>;
|
|
@@ -15,7 +15,7 @@ export interface ExportConfig<USER extends User = User> {
|
|
|
15
15
|
export interface ExportMappingFunction<USER extends User = User> {
|
|
16
16
|
key: string;
|
|
17
17
|
builder: ({ entity, context }: {
|
|
18
|
-
entity: Entity
|
|
18
|
+
entity: Entity;
|
|
19
19
|
context: RebaseContext<USER>;
|
|
20
20
|
}) => Promise<string> | string;
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { FormEvent } from "react";
|
|
2
|
-
export type FormexController<T =
|
|
2
|
+
export type FormexController<T = unknown> = {
|
|
3
3
|
values: T;
|
|
4
4
|
initialValues: T;
|
|
5
5
|
setValues: (values: T) => void;
|
|
@@ -32,7 +32,7 @@ export type FormexController<T = any> = {
|
|
|
32
32
|
canUndo: boolean;
|
|
33
33
|
canRedo: boolean;
|
|
34
34
|
};
|
|
35
|
-
export type FormexResetProps<T =
|
|
35
|
+
export type FormexResetProps<T = unknown> = {
|
|
36
36
|
values?: T;
|
|
37
37
|
submitCount?: number;
|
|
38
38
|
errors?: Record<string, string>;
|
|
@@ -104,8 +104,8 @@ export interface BaseUIConfig<CustomProps = unknown> {
|
|
|
104
104
|
disabled?: boolean | PropertyDisabledConfig;
|
|
105
105
|
widthPercentage?: number;
|
|
106
106
|
customProps?: CustomProps;
|
|
107
|
-
Field?: ComponentRef
|
|
108
|
-
Preview?: ComponentRef
|
|
107
|
+
Field?: ComponentRef;
|
|
108
|
+
Preview?: ComponentRef;
|
|
109
109
|
}
|
|
110
110
|
export interface BaseProperty<CustomProps = unknown> {
|
|
111
111
|
ui?: BaseUIConfig<CustomProps>;
|
|
@@ -105,6 +105,12 @@ export interface RebaseTranslations {
|
|
|
105
105
|
navigation_drawer: string;
|
|
106
106
|
collapse: string;
|
|
107
107
|
expand: string;
|
|
108
|
+
/** Tooltip for the language switcher in the drawer footer */
|
|
109
|
+
change_language?: string;
|
|
110
|
+
/** Tooltip for the theme toggle in the drawer footer */
|
|
111
|
+
toggle_theme?: string;
|
|
112
|
+
/** Aria label for the user menu trigger in the drawer footer */
|
|
113
|
+
user_menu?: string;
|
|
108
114
|
error: string;
|
|
109
115
|
error_uploading_file: string;
|
|
110
116
|
error_deleting: string;
|
|
@@ -426,18 +432,28 @@ export interface RebaseTranslations {
|
|
|
426
432
|
deleted: string;
|
|
427
433
|
select_reference: string;
|
|
428
434
|
select_references: string;
|
|
429
|
-
account_settings
|
|
430
|
-
profile
|
|
431
|
-
sessions
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
435
|
+
account_settings?: string;
|
|
436
|
+
profile?: string;
|
|
437
|
+
sessions?: string;
|
|
438
|
+
security?: string;
|
|
439
|
+
change_password?: string;
|
|
440
|
+
current_password?: string;
|
|
441
|
+
new_password?: string;
|
|
442
|
+
confirm_password?: string;
|
|
443
|
+
password_changed?: string;
|
|
444
|
+
passwords_dont_match?: string;
|
|
445
|
+
password_too_short?: string;
|
|
446
|
+
password_change_not_available?: string;
|
|
447
|
+
changing_password?: string;
|
|
448
|
+
display_name?: string;
|
|
449
|
+
photo_url?: string;
|
|
450
|
+
save_profile?: string;
|
|
451
|
+
saving?: string;
|
|
452
|
+
no_active_sessions?: string;
|
|
453
|
+
revoking?: string;
|
|
454
|
+
revoke_all_sessions?: string;
|
|
455
|
+
unknown_device?: string;
|
|
456
|
+
current?: string;
|
|
441
457
|
role_id: string;
|
|
442
458
|
role_name: string;
|
|
443
459
|
add_reference: string;
|
|
@@ -104,15 +104,17 @@ export interface UserManagementDelegate<USER extends User = User> {
|
|
|
104
104
|
* If true, the UI will allow the user to create the default roles (admin, editor, viewer).
|
|
105
105
|
*/
|
|
106
106
|
allowDefaultRolesCreation?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Should collection config permissions be included?
|
|
109
|
-
*/
|
|
110
|
-
includeCollectionConfigPermissions?: boolean;
|
|
111
107
|
/**
|
|
112
108
|
* Optionally define roles for a given user. This is useful when the roles
|
|
113
109
|
* are coming from a separate provider than the one issuing the tokens.
|
|
114
110
|
*/
|
|
115
111
|
defineRolesFor?: (user: USER) => Promise<Role[] | undefined> | Role[] | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Whether any admin users exist. Used by the bootstrap banner to decide
|
|
114
|
+
* whether to prompt. Populated via a lightweight check (e.g. `limit=1`
|
|
115
|
+
* query) instead of loading all users.
|
|
116
|
+
*/
|
|
117
|
+
hasAdminUsers?: boolean;
|
|
116
118
|
/**
|
|
117
119
|
* Optional function to bootstrap an admin user.
|
|
118
120
|
* Often used when the database is empty.
|
|
@@ -11,12 +11,4 @@ export type Role = {
|
|
|
11
11
|
* If this flag is true, the user can perform any action
|
|
12
12
|
*/
|
|
13
13
|
isAdmin?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Permissions related to editing the collections
|
|
16
|
-
*/
|
|
17
|
-
config?: {
|
|
18
|
-
createCollections?: boolean;
|
|
19
|
-
editCollections?: boolean | "own";
|
|
20
|
-
deleteCollections?: boolean | "own";
|
|
21
|
-
};
|
|
22
14
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/client-postgresql",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"description": "PostgreSQL data source client for Rebase",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"./package.json": "./package.json"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@rebasepro/client": "0.2.
|
|
61
|
-
"@rebasepro/types": "0.2.
|
|
60
|
+
"@rebasepro/client": "0.2.4",
|
|
61
|
+
"@rebasepro/types": "0.2.4"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"react": ">=19.0.0",
|
|
@@ -71,7 +71,7 @@ databaseId }) as Promise<Entity<M> | undefined>;
|
|
|
71
71
|
return client.deleteEntity({ entity });
|
|
72
72
|
},
|
|
73
73
|
|
|
74
|
-
async checkUniqueField(path: string, name: string, value:
|
|
74
|
+
async checkUniqueField(path: string, name: string, value: unknown, entityId?: string, collection?: EntityCollection): Promise<boolean> {
|
|
75
75
|
return client.checkUniqueField(path, name, value, entityId, collection);
|
|
76
76
|
},
|
|
77
77
|
|