@rebasepro/server-postgresql 0.0.1-canary.4d4fb3e → 0.0.1-canary.5584634
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/introspect-db-logic.d.ts +82 -0
- package/dist/server-postgresql/src/schema/introspect-db.d.ts +1 -0
- 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 +89 -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 +317 -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/introspect-db-logic.ts +592 -0
- package/src/schema/introspect-db.ts +211 -0
- 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/introspect-db-generation.test.ts +436 -0
- package/test/introspect-db-utils.test.ts +389 -0
- 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/unmapped-tables-safety.test.ts +345 -0
- 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
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { Entity,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Entity, EntityStatus, EntityValues } from "../types/entities";
|
|
2
|
+
import type { EntityCollection, FilterValues } from "../types/collections";
|
|
3
|
+
import type { RebaseContext } from "../rebase_context";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export interface FetchEntityProps<M extends Record<string,
|
|
7
|
+
export interface FetchEntityProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
8
8
|
path: string;
|
|
9
9
|
entityId: string | number;
|
|
10
10
|
databaseId?: string;
|
|
11
|
-
collection?: EntityCollection<M
|
|
11
|
+
collection?: EntityCollection<M>;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
|
-
export type ListenEntityProps<M extends Record<string,
|
|
16
|
+
export type ListenEntityProps<M extends Record<string, unknown> = Record<string, unknown>> = FetchEntityProps<M> & {
|
|
17
17
|
onUpdate: (entity: Entity<M> | null) => void;
|
|
18
18
|
onError?: (error: Error) => void;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* @internal
|
|
22
22
|
*/
|
|
23
|
-
export interface FetchCollectionProps<M extends Record<string,
|
|
23
|
+
export interface FetchCollectionProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
24
24
|
path: string;
|
|
25
25
|
collection?: EntityCollection<M>;
|
|
26
26
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
27
27
|
limit?: number;
|
|
28
|
+
offset?: number;
|
|
28
29
|
startAfter?: unknown;
|
|
29
30
|
orderBy?: string;
|
|
30
31
|
searchString?: string;
|
|
@@ -33,14 +34,14 @@ export interface FetchCollectionProps<M extends Record<string, any> = any> {
|
|
|
33
34
|
/**
|
|
34
35
|
* @internal
|
|
35
36
|
*/
|
|
36
|
-
export type ListenCollectionProps<M extends Record<string,
|
|
37
|
+
export type ListenCollectionProps<M extends Record<string, unknown> = Record<string, unknown>> = FetchCollectionProps<M> & {
|
|
37
38
|
onUpdate: (entities: Entity<M>[]) => void;
|
|
38
39
|
onError?: (error: Error) => void;
|
|
39
40
|
};
|
|
40
41
|
/**
|
|
41
42
|
* @internal
|
|
42
43
|
*/
|
|
43
|
-
export interface SaveEntityProps<M extends Record<string,
|
|
44
|
+
export interface SaveEntityProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
44
45
|
path: string;
|
|
45
46
|
values: Partial<EntityValues<M>>;
|
|
46
47
|
entityId?: string | number;
|
|
@@ -51,15 +52,15 @@ export interface SaveEntityProps<M extends Record<string, any> = any> {
|
|
|
51
52
|
/**
|
|
52
53
|
* @internal
|
|
53
54
|
*/
|
|
54
|
-
export interface DeleteEntityProps<M extends Record<string,
|
|
55
|
+
export interface DeleteEntityProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
55
56
|
entity: Entity<M>;
|
|
56
57
|
collection?: EntityCollection<M>;
|
|
57
58
|
}
|
|
58
59
|
export type FilterCombinationValidProps = {
|
|
59
60
|
path: string;
|
|
60
61
|
databaseId?: string;
|
|
61
|
-
collection: EntityCollection
|
|
62
|
-
filterValues: FilterValues<
|
|
62
|
+
collection: EntityCollection;
|
|
63
|
+
filterValues: FilterValues<string>;
|
|
63
64
|
sortBy?: [string, "asc" | "desc"];
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
@@ -81,36 +82,36 @@ export interface DataDriver {
|
|
|
81
82
|
* @param props
|
|
82
83
|
* @return Promise of entities
|
|
83
84
|
*/
|
|
84
|
-
fetchCollection<M extends Record<string,
|
|
85
|
+
fetchCollection<M extends Record<string, unknown> = Record<string, unknown>>(props: FetchCollectionProps<M>): Promise<Entity<M>[]>;
|
|
85
86
|
/**
|
|
86
87
|
* Listen to a collection in a given path. If you don't implement this method
|
|
87
88
|
* `fetchCollection` will be used instead, with no real time updates.
|
|
88
89
|
* @param props
|
|
89
90
|
* @return Function to cancel subscription
|
|
90
91
|
*/
|
|
91
|
-
listenCollection?<M extends Record<string,
|
|
92
|
+
listenCollection?<M extends Record<string, unknown> = Record<string, unknown>>(props: ListenCollectionProps<M>): () => void;
|
|
92
93
|
/**
|
|
93
94
|
* Retrieve an entity given a path and a collection
|
|
94
95
|
* @param props
|
|
95
96
|
*/
|
|
96
|
-
fetchEntity<M extends Record<string,
|
|
97
|
+
fetchEntity<M extends Record<string, unknown> = Record<string, unknown>>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
|
|
97
98
|
/**
|
|
98
99
|
* Get realtime updates on one entity.
|
|
99
100
|
* @param props
|
|
100
101
|
* @return Function to cancel subscription
|
|
101
102
|
*/
|
|
102
|
-
listenEntity?<M extends Record<string,
|
|
103
|
+
listenEntity?<M extends Record<string, unknown> = Record<string, unknown>>(props: ListenEntityProps<M>): () => void;
|
|
103
104
|
/**
|
|
104
105
|
* Save entity to the specified path
|
|
105
106
|
* @param props
|
|
106
107
|
*/
|
|
107
|
-
saveEntity<M extends Record<string,
|
|
108
|
+
saveEntity<M extends Record<string, unknown> = Record<string, unknown>>(props: SaveEntityProps<M>): Promise<Entity<M>>;
|
|
108
109
|
/**
|
|
109
110
|
* Delete an entity
|
|
110
111
|
* @param props
|
|
111
112
|
* @return was the whole deletion flow successful
|
|
112
113
|
*/
|
|
113
|
-
deleteEntity<M extends Record<string,
|
|
114
|
+
deleteEntity<M extends Record<string, unknown> = Record<string, unknown>>(props: DeleteEntityProps<M>): Promise<void>;
|
|
114
115
|
/**
|
|
115
116
|
* Check if the given property is unique in the given collection
|
|
116
117
|
* @param path Collection path
|
|
@@ -124,7 +125,7 @@ export interface DataDriver {
|
|
|
124
125
|
/**
|
|
125
126
|
* Count the number of entities in a collection
|
|
126
127
|
*/
|
|
127
|
-
countEntities?<M extends Record<string,
|
|
128
|
+
countEntities?<M extends Record<string, unknown> = Record<string, unknown>>(props: FetchCollectionProps<M>): Promise<number>;
|
|
128
129
|
/**
|
|
129
130
|
* Check if the given filter combination is valid
|
|
130
131
|
* @param props
|
|
@@ -156,13 +157,4 @@ export interface DataDriver {
|
|
|
156
157
|
* @see SchemaAdmin
|
|
157
158
|
*/
|
|
158
159
|
admin?: import("../types/backend").DatabaseAdmin;
|
|
159
|
-
executeSql?(sql: string, options?: {
|
|
160
|
-
database?: string;
|
|
161
|
-
role?: string;
|
|
162
|
-
}): Promise<Record<string, unknown>[]>;
|
|
163
|
-
fetchAvailableDatabases?(): Promise<string[]>;
|
|
164
|
-
fetchAvailableRoles?(): Promise<string[]>;
|
|
165
|
-
fetchCurrentDatabase?(): Promise<string | undefined>;
|
|
166
|
-
fetchUnmappedTables?(mappedPaths?: string[]): Promise<string[]>;
|
|
167
|
-
fetchTableMetadata?(tableName: string): Promise<TableMetadata>;
|
|
168
160
|
}
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @group Admin
|
|
9
9
|
*/
|
|
10
|
-
export type { SQLAdmin, DocumentAdmin, SchemaAdmin, DatabaseAdmin, HealthCheckResult
|
|
11
|
-
export { isSQLAdmin, isDocumentAdmin, isSchemaAdmin
|
|
10
|
+
export type { SQLAdmin, DocumentAdmin, SchemaAdmin, DatabaseAdmin, HealthCheckResult } from "../types/backend";
|
|
11
|
+
export { isSQLAdmin, isDocumentAdmin, isSchemaAdmin } from "../types/backend";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email service types — portable interface shared by RebaseClient and server-core.
|
|
3
|
+
*
|
|
4
|
+
* The concrete SMTP implementation lives in `@rebasepro/server-core/email`.
|
|
5
|
+
* This file provides only the consumer-facing contract so that it can be
|
|
6
|
+
* referenced from `RebaseClient` without dragging in nodemailer.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Options for sending an email via the Rebase email service.
|
|
10
|
+
*/
|
|
11
|
+
export interface EmailSendOptions {
|
|
12
|
+
/** Recipient email address(es). */
|
|
13
|
+
to: string | string[];
|
|
14
|
+
/** Email subject line. */
|
|
15
|
+
subject: string;
|
|
16
|
+
/** HTML body content. */
|
|
17
|
+
html: string;
|
|
18
|
+
/** Optional plain-text fallback. */
|
|
19
|
+
text?: string;
|
|
20
|
+
/** Optional reply-to address. */
|
|
21
|
+
replyTo?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Abstraction over an email delivery backend.
|
|
25
|
+
*
|
|
26
|
+
* Implementations may use SMTP, AWS SES, Resend, Postmark, or any other
|
|
27
|
+
* provider — consumers only interact through this interface.
|
|
28
|
+
*/
|
|
29
|
+
export interface EmailService {
|
|
30
|
+
/** Send a single email. */
|
|
31
|
+
send(options: EmailSendOptions): Promise<void>;
|
|
32
|
+
/** Returns `true` when the service has valid credentials / is ready to send. */
|
|
33
|
+
isConfigured(): boolean;
|
|
34
|
+
}
|
|
@@ -8,6 +8,7 @@ export * from "./local_config_persistence";
|
|
|
8
8
|
export * from "./navigation";
|
|
9
9
|
export * from "./effective_role";
|
|
10
10
|
export * from "./storage";
|
|
11
|
+
export * from "./email";
|
|
11
12
|
export * from "./client";
|
|
12
13
|
export * from "./customization_controller";
|
|
13
14
|
export * from "./side_entity_controller";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { EntityCollection } from "../types";
|
|
1
|
+
import type { EntityCollection } from "../types/collections";
|
|
2
2
|
/**
|
|
3
3
|
* @group Models
|
|
4
4
|
*/
|
|
5
|
-
export type PartialEntityCollection<M extends Record<string,
|
|
5
|
+
export type PartialEntityCollection<M extends Record<string, unknown> = Record<string, unknown>> = Partial<EntityCollection<M>>;
|
|
6
6
|
/**
|
|
7
7
|
* This interface is in charge of defining the controller that persists
|
|
8
8
|
* modifications to a collection or collection, and retrieves them back from
|
|
9
9
|
* a data source, such as local storage or Firestore.
|
|
10
10
|
*/
|
|
11
11
|
export interface UserConfigurationPersistence {
|
|
12
|
-
onCollectionModified: <M extends Record<string,
|
|
13
|
-
getCollectionConfig: <M extends Record<string,
|
|
12
|
+
onCollectionModified: <M extends Record<string, unknown> = Record<string, unknown>>(path: string, partialCollection: PartialEntityCollection<M>) => void;
|
|
13
|
+
getCollectionConfig: <M extends Record<string, unknown> = Record<string, unknown>>(path: string) => PartialEntityCollection<M>;
|
|
14
14
|
recentlyVisitedPaths: string[];
|
|
15
15
|
setRecentlyVisitedPaths: (paths: string[]) => void;
|
|
16
16
|
favouritePaths: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { EntityCollection } from "../types/collections";
|
|
3
|
-
import { RebasePlugin } from "../types/plugins";
|
|
2
|
+
import type { EntityCollection } from "../types/collections";
|
|
3
|
+
import type { RebasePlugin } from "../types/plugins";
|
|
4
4
|
/**
|
|
5
5
|
* Controller that handles URL path building and resolution.
|
|
6
6
|
* @group Models
|
|
@@ -133,9 +133,9 @@ export interface AppView {
|
|
|
133
133
|
description?: string;
|
|
134
134
|
/**
|
|
135
135
|
* Icon key to use in this view.
|
|
136
|
-
* You can use any of the icons in the
|
|
137
|
-
* https://
|
|
138
|
-
* e.g. '
|
|
136
|
+
* You can use any of the icons in the Lucide specs:
|
|
137
|
+
* https://lucide.dev/icons/
|
|
138
|
+
* e.g. 'ShoppingCart' or 'User'
|
|
139
139
|
* Find all the icons in https://rebase.pro/docs/icons
|
|
140
140
|
*/
|
|
141
141
|
icon?: string | React.ReactNode;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { EntityCollection
|
|
3
|
-
import {
|
|
2
|
+
import type { EntityCollection } from "../types/collections";
|
|
3
|
+
import type { EntityCollectionsBuilder } from "../types/builders";
|
|
4
|
+
import type { EntityCustomView } from "../types/entity_views";
|
|
5
|
+
import type { EntityAction } from "../types/entity_actions";
|
|
6
|
+
import type { AppView } from "./navigation";
|
|
4
7
|
/**
|
|
5
8
|
* Options to enable the built-in collection editor.
|
|
6
9
|
* When provided to `<RebaseCMS>`, the editor is auto-wired as a native feature.
|
|
@@ -31,7 +34,7 @@ export interface RebaseCMSConfig<EC extends EntityCollection = any> {
|
|
|
31
34
|
collectionEditor?: boolean | CollectionEditorOptions;
|
|
32
35
|
}
|
|
33
36
|
export interface RebaseStudioConfig {
|
|
34
|
-
tools?: ("sql" | "js" | "rls" | "schema" | "storage")[];
|
|
37
|
+
tools?: ("sql" | "js" | "rls" | "schema" | "storage" | "cron" | "schema-visualizer" | "branches" | "api")[];
|
|
35
38
|
homePage?: ReactNode;
|
|
36
39
|
devViews?: AppView[];
|
|
37
40
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Entity
|
|
1
|
+
import type { Entity } from "../types/entities";
|
|
2
|
+
import type { EntityCollection } from "../types/collections";
|
|
2
3
|
/**
|
|
3
4
|
* Props used to open a side dialog
|
|
4
5
|
* @group Hooks and utilities
|
|
5
6
|
*/
|
|
6
|
-
export interface EntitySidePanelProps<M extends Record<string,
|
|
7
|
+
export interface EntitySidePanelProps<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
7
8
|
/**
|
|
8
9
|
* Absolute path of the entity
|
|
9
10
|
*/
|
|
@@ -43,7 +44,7 @@ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
|
|
|
43
44
|
* @param params
|
|
44
45
|
*/
|
|
45
46
|
onUpdate?: (params: {
|
|
46
|
-
entity: Entity<
|
|
47
|
+
entity: Entity<M>;
|
|
47
48
|
}) => void;
|
|
48
49
|
/**
|
|
49
50
|
* Callback when the dialog is closed
|
|
@@ -56,7 +57,7 @@ export interface EntitySidePanelProps<M extends Record<string, any> = any> {
|
|
|
56
57
|
/**
|
|
57
58
|
* Override some form properties
|
|
58
59
|
*/
|
|
59
|
-
formProps?:
|
|
60
|
+
formProps?: Record<string, unknown>;
|
|
60
61
|
/**
|
|
61
62
|
* Allow the user to open the entity fullscreen
|
|
62
63
|
*/
|
|
@@ -80,10 +81,10 @@ export interface SideEntityController {
|
|
|
80
81
|
* (or a new one with that id).
|
|
81
82
|
* @param props
|
|
82
83
|
*/
|
|
83
|
-
open: <M extends Record<string,
|
|
84
|
+
open: <M extends Record<string, unknown> = Record<string, unknown>>(props: EntitySidePanelProps<M>) => void;
|
|
84
85
|
/**
|
|
85
86
|
* Replace the last open entity panel with the given one.
|
|
86
87
|
* @param props
|
|
87
88
|
*/
|
|
88
|
-
replace: <M extends Record<string,
|
|
89
|
+
replace: <M extends Record<string, unknown> = Record<string, unknown>>(props: EntitySidePanelProps<M>) => void;
|
|
89
90
|
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface UploadFileProps {
|
|
5
5
|
file: File;
|
|
6
|
-
|
|
7
|
-
path?: string;
|
|
6
|
+
key: string;
|
|
8
7
|
metadata?: Record<string, unknown>;
|
|
9
8
|
bucket?: string;
|
|
10
9
|
}
|
|
@@ -13,9 +12,9 @@ export interface UploadFileProps {
|
|
|
13
12
|
*/
|
|
14
13
|
export interface UploadFileResult {
|
|
15
14
|
/**
|
|
16
|
-
* Storage
|
|
15
|
+
* Storage key including the file name where the file was uploaded.
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
key: string;
|
|
19
18
|
/**
|
|
20
19
|
* Bucket where the file was uploaded
|
|
21
20
|
*/
|
|
@@ -23,7 +22,7 @@ export interface UploadFileResult {
|
|
|
23
22
|
/**
|
|
24
23
|
* Fully qualified storage URL for the uploaded file.
|
|
25
24
|
*
|
|
26
|
-
* For example: `
|
|
25
|
+
* For example: `s3://my-bucket/path/to/file.png`.
|
|
27
26
|
*
|
|
28
27
|
* This is optional for backwards compatibility.
|
|
29
28
|
*/
|
|
@@ -74,39 +73,38 @@ export declare interface DownloadMetadata {
|
|
|
74
73
|
*/
|
|
75
74
|
export interface StorageSource {
|
|
76
75
|
/**
|
|
77
|
-
* Upload
|
|
76
|
+
* Upload an object, specifying a key
|
|
78
77
|
* @param file
|
|
79
|
-
* @param
|
|
80
|
-
* @param path
|
|
78
|
+
* @param key
|
|
81
79
|
* @param metadata
|
|
82
80
|
* @param bucket
|
|
83
81
|
*/
|
|
84
|
-
|
|
82
|
+
putObject: ({ file, key, metadata, bucket }: UploadFileProps) => Promise<UploadFileResult>;
|
|
85
83
|
/**
|
|
86
|
-
* Convert a storage
|
|
87
|
-
* @param
|
|
84
|
+
* Convert a storage key or URL into a download configuration (signed URL equivalent)
|
|
85
|
+
* @param keyOrUrl
|
|
88
86
|
* @param bucket
|
|
89
87
|
*/
|
|
90
|
-
|
|
88
|
+
getSignedUrl: (keyOrUrl: string, bucket?: string) => Promise<DownloadConfig>;
|
|
91
89
|
/**
|
|
92
|
-
* Get
|
|
93
|
-
* It returns null if the
|
|
94
|
-
* @param
|
|
90
|
+
* Get an object from a storage key.
|
|
91
|
+
* It returns null if the object does not exist.
|
|
92
|
+
* @param key
|
|
95
93
|
* @param bucket
|
|
96
94
|
*/
|
|
97
|
-
|
|
95
|
+
getObject: (key: string, bucket?: string) => Promise<File | null>;
|
|
98
96
|
/**
|
|
99
|
-
* Delete
|
|
100
|
-
* @param
|
|
97
|
+
* Delete an object.
|
|
98
|
+
* @param key
|
|
101
99
|
* @param bucket
|
|
102
100
|
*/
|
|
103
|
-
|
|
101
|
+
deleteObject: (key: string, bucket?: string) => Promise<void>;
|
|
104
102
|
/**
|
|
105
|
-
* List the contents of a
|
|
106
|
-
* @param
|
|
103
|
+
* List the contents of a prefix.
|
|
104
|
+
* @param prefix
|
|
107
105
|
* @param options
|
|
108
106
|
*/
|
|
109
|
-
|
|
107
|
+
listObjects: (prefix: string, options?: {
|
|
110
108
|
bucket?: string;
|
|
111
109
|
maxResults?: number;
|
|
112
110
|
pageToken?: string;
|
|
@@ -137,15 +135,15 @@ export declare interface StorageListResult {
|
|
|
137
135
|
nextPageToken?: string;
|
|
138
136
|
}
|
|
139
137
|
/**
|
|
140
|
-
* Represents a reference to
|
|
138
|
+
* Represents a reference to an S3-compatible storage object. Developers can
|
|
141
139
|
* upload, download, and delete objects, as well as get/set object metadata.
|
|
142
140
|
* @public
|
|
143
141
|
*/
|
|
144
142
|
export declare interface StorageReference {
|
|
145
143
|
/**
|
|
146
|
-
* Returns a
|
|
147
|
-
* `
|
|
148
|
-
* @returns The
|
|
144
|
+
* Returns a s3:// URL for this object in the form
|
|
145
|
+
* `s3://<bucket>/<path>/<to>/<object>`
|
|
146
|
+
* @returns The s3:// URL.
|
|
149
147
|
*/
|
|
150
148
|
toString(): string;
|
|
151
149
|
/**
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { AnalyticsController
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { AnalyticsController } from "./controllers/analytics_controller";
|
|
2
|
+
import type { AuthController } from "./controllers/auth";
|
|
3
|
+
import type { StorageSource } from "./controllers/storage";
|
|
4
|
+
import type { UserConfigurationPersistence } from "./controllers/local_config_persistence";
|
|
5
|
+
import type { DatabaseAdmin } from "./types/backend";
|
|
6
|
+
import type { RebaseData } from "./controllers/data";
|
|
7
|
+
import type { User } from "./users";
|
|
8
|
+
import type { UserManagementDelegate } from "./types/user_management_delegate";
|
|
5
9
|
/**
|
|
6
10
|
* Context that is provided to entity callbacks (hooks).
|
|
7
11
|
* It contains only the dependencies that are available in both the frontend and the backend.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Entity
|
|
1
|
+
import type { Entity } from "./entities";
|
|
2
|
+
import type { EntityCollection, FilterValues, WhereFilterOp } from "./collections";
|
|
2
3
|
/**
|
|
3
4
|
* Abstract database connection interface.
|
|
4
5
|
* Represents a connection to any database system.
|
|
@@ -33,6 +34,7 @@ export interface FetchCollectionOptions<M extends Record<string, unknown> = Reco
|
|
|
33
34
|
orderBy?: string;
|
|
34
35
|
order?: "desc" | "asc";
|
|
35
36
|
limit?: number;
|
|
37
|
+
offset?: number;
|
|
36
38
|
startAfter?: unknown;
|
|
37
39
|
searchString?: string;
|
|
38
40
|
databaseId?: string;
|
|
@@ -54,6 +56,7 @@ export interface SearchOptions<M extends Record<string, unknown> = Record<string
|
|
|
54
56
|
*/
|
|
55
57
|
export interface CountOptions<M extends Record<string, unknown> = Record<string, unknown>> {
|
|
56
58
|
filter?: FilterValues<Extract<keyof M, string>>;
|
|
59
|
+
searchString?: string;
|
|
57
60
|
databaseId?: string;
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AuthController
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { AuthController } from "../controllers/auth";
|
|
2
|
+
import type { RebaseData } from "../controllers/data";
|
|
3
|
+
import type { User } from "../users";
|
|
4
|
+
import type { EntityCollection } from "./collections";
|
|
5
|
+
import type { AppView } from "../controllers/navigation";
|
|
5
6
|
export type EntityCollectionsBuilder<EC extends EntityCollection = EntityCollection> = (params: {
|
|
6
7
|
user: User | null;
|
|
7
8
|
authController: AuthController;
|
|
@@ -2,4 +2,4 @@ export type ColorScheme = {
|
|
|
2
2
|
color: string;
|
|
3
3
|
text: string;
|
|
4
4
|
};
|
|
5
|
-
export type ColorKey = "
|
|
5
|
+
export type ColorKey = "blue" | "cyan" | "teal" | "green" | "yellow" | "orange" | "red" | "pink" | "purple" | "gray" | "indigo" | "violet" | "fuchsia" | "rose" | "emerald";
|