@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.
Files changed (143) hide show
  1. package/dist/common/src/collections/CollectionRegistry.d.ts +8 -0
  2. package/dist/common/src/util/entities.d.ts +22 -0
  3. package/dist/common/src/util/relations.d.ts +14 -4
  4. package/dist/common/src/util/resolutions.d.ts +1 -1
  5. package/dist/index.es.js +1254 -591
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +1254 -591
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +17 -29
  10. package/dist/server-postgresql/src/auth/services.d.ts +7 -3
  11. package/dist/server-postgresql/src/collections/PostgresCollectionRegistry.d.ts +1 -1
  12. package/dist/server-postgresql/src/connection.d.ts +34 -1
  13. package/dist/server-postgresql/src/data-transformer.d.ts +26 -4
  14. package/dist/server-postgresql/src/databasePoolManager.d.ts +2 -2
  15. package/dist/server-postgresql/src/schema/auth-schema.d.ts +139 -38
  16. package/dist/server-postgresql/src/schema/doctor-cli.d.ts +2 -0
  17. package/dist/server-postgresql/src/schema/doctor.d.ts +43 -0
  18. package/dist/server-postgresql/src/schema/generate-drizzle-schema-logic.d.ts +1 -1
  19. package/dist/server-postgresql/src/schema/introspect-db-logic.d.ts +82 -0
  20. package/dist/server-postgresql/src/schema/introspect-db.d.ts +1 -0
  21. package/dist/server-postgresql/src/schema/test-schema.d.ts +24 -0
  22. package/dist/server-postgresql/src/services/EntityFetchService.d.ts +22 -8
  23. package/dist/server-postgresql/src/services/EntityPersistService.d.ts +1 -1
  24. package/dist/server-postgresql/src/services/RelationService.d.ts +11 -5
  25. package/dist/server-postgresql/src/services/entity-helpers.d.ts +16 -2
  26. package/dist/server-postgresql/src/services/entityService.d.ts +8 -6
  27. package/dist/server-postgresql/src/services/realtimeService.d.ts +2 -0
  28. package/dist/server-postgresql/src/utils/drizzle-conditions.d.ts +2 -2
  29. package/dist/types/src/controllers/auth.d.ts +2 -0
  30. package/dist/types/src/controllers/client.d.ts +119 -7
  31. package/dist/types/src/controllers/collection_registry.d.ts +4 -3
  32. package/dist/types/src/controllers/customization_controller.d.ts +7 -1
  33. package/dist/types/src/controllers/data.d.ts +34 -7
  34. package/dist/types/src/controllers/data_driver.d.ts +20 -28
  35. package/dist/types/src/controllers/database_admin.d.ts +2 -2
  36. package/dist/types/src/controllers/email.d.ts +34 -0
  37. package/dist/types/src/controllers/index.d.ts +1 -0
  38. package/dist/types/src/controllers/local_config_persistence.d.ts +4 -4
  39. package/dist/types/src/controllers/navigation.d.ts +5 -5
  40. package/dist/types/src/controllers/registry.d.ts +6 -3
  41. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -6
  42. package/dist/types/src/controllers/storage.d.ts +24 -26
  43. package/dist/types/src/rebase_context.d.ts +8 -4
  44. package/dist/types/src/types/backend.d.ts +4 -1
  45. package/dist/types/src/types/builders.d.ts +5 -4
  46. package/dist/types/src/types/chips.d.ts +1 -1
  47. package/dist/types/src/types/collections.d.ts +169 -125
  48. package/dist/types/src/types/cron.d.ts +102 -0
  49. package/dist/types/src/types/data_source.d.ts +1 -1
  50. package/dist/types/src/types/entity_actions.d.ts +8 -8
  51. package/dist/types/src/types/entity_callbacks.d.ts +15 -15
  52. package/dist/types/src/types/entity_link_builder.d.ts +1 -1
  53. package/dist/types/src/types/entity_overrides.d.ts +2 -1
  54. package/dist/types/src/types/entity_views.d.ts +8 -8
  55. package/dist/types/src/types/export_import.d.ts +3 -3
  56. package/dist/types/src/types/index.d.ts +1 -0
  57. package/dist/types/src/types/plugins.d.ts +72 -18
  58. package/dist/types/src/types/properties.d.ts +118 -33
  59. package/dist/types/src/types/relations.d.ts +1 -1
  60. package/dist/types/src/types/slots.d.ts +30 -6
  61. package/dist/types/src/types/translations.d.ts +44 -0
  62. package/dist/types/src/types/user_management_delegate.d.ts +1 -0
  63. package/drizzle-test/0000_woozy_junta.sql +6 -0
  64. package/drizzle-test/0001_youthful_arachne.sql +1 -0
  65. package/drizzle-test/0002_lively_dragon_lord.sql +2 -0
  66. package/drizzle-test/0003_mean_king_cobra.sql +2 -0
  67. package/drizzle-test/meta/0000_snapshot.json +47 -0
  68. package/drizzle-test/meta/0001_snapshot.json +48 -0
  69. package/drizzle-test/meta/0002_snapshot.json +38 -0
  70. package/drizzle-test/meta/0003_snapshot.json +48 -0
  71. package/drizzle-test/meta/_journal.json +34 -0
  72. package/drizzle-test-out/0000_tan_trauma.sql +6 -0
  73. package/drizzle-test-out/0001_rapid_drax.sql +1 -0
  74. package/drizzle-test-out/meta/0000_snapshot.json +44 -0
  75. package/drizzle-test-out/meta/0001_snapshot.json +54 -0
  76. package/drizzle-test-out/meta/_journal.json +20 -0
  77. package/drizzle.test.config.ts +10 -0
  78. package/package.json +89 -89
  79. package/scratch.ts +41 -0
  80. package/src/PostgresBackendDriver.ts +63 -79
  81. package/src/PostgresBootstrapper.ts +7 -8
  82. package/src/auth/ensure-tables.ts +158 -86
  83. package/src/auth/services.ts +109 -50
  84. package/src/cli.ts +317 -16
  85. package/src/collections/PostgresCollectionRegistry.ts +6 -6
  86. package/src/connection.ts +70 -48
  87. package/src/data-transformer.ts +155 -116
  88. package/src/databasePoolManager.ts +6 -5
  89. package/src/history/HistoryService.ts +3 -12
  90. package/src/interfaces.ts +3 -3
  91. package/src/schema/auth-schema.ts +26 -3
  92. package/src/schema/doctor-cli.ts +47 -0
  93. package/src/schema/doctor.ts +595 -0
  94. package/src/schema/generate-drizzle-schema-logic.ts +204 -57
  95. package/src/schema/generate-drizzle-schema.ts +6 -6
  96. package/src/schema/introspect-db-logic.ts +592 -0
  97. package/src/schema/introspect-db.ts +211 -0
  98. package/src/schema/test-schema.ts +11 -0
  99. package/src/services/BranchService.ts +5 -5
  100. package/src/services/EntityFetchService.ts +317 -188
  101. package/src/services/EntityPersistService.ts +15 -17
  102. package/src/services/RelationService.ts +299 -37
  103. package/src/services/entity-helpers.ts +39 -13
  104. package/src/services/entityService.ts +11 -9
  105. package/src/services/realtimeService.ts +58 -29
  106. package/src/utils/drizzle-conditions.ts +25 -24
  107. package/src/websocket.ts +52 -21
  108. package/test/auth-services.test.ts +131 -39
  109. package/test/batch-many-to-many-regression.test.ts +573 -0
  110. package/test/branchService.test.ts +22 -12
  111. package/test/data-transformer-hardening.test.ts +417 -0
  112. package/test/data-transformer.test.ts +175 -0
  113. package/test/doctor.test.ts +182 -0
  114. package/test/entityService.errors.test.ts +31 -16
  115. package/test/entityService.relations.test.ts +155 -59
  116. package/test/entityService.subcollection-search.test.ts +107 -57
  117. package/test/entityService.test.ts +105 -47
  118. package/test/generate-drizzle-schema.test.ts +262 -69
  119. package/test/historyService.test.ts +31 -16
  120. package/test/introspect-db-generation.test.ts +436 -0
  121. package/test/introspect-db-utils.test.ts +389 -0
  122. package/test/n-plus-one-regression.test.ts +314 -0
  123. package/test/postgresDataDriver.test.ts +260 -168
  124. package/test/realtimeService.test.ts +70 -39
  125. package/test/relation-pipeline-gaps.test.ts +637 -0
  126. package/test/relations.test.ts +492 -39
  127. package/test/unmapped-tables-safety.test.ts +345 -0
  128. package/test-drizzle-bug.ts +18 -0
  129. package/test-drizzle-out/0000_cultured_freak.sql +7 -0
  130. package/test-drizzle-out/0001_tiresome_professor_monster.sql +1 -0
  131. package/test-drizzle-out/meta/0000_snapshot.json +55 -0
  132. package/test-drizzle-out/meta/0001_snapshot.json +63 -0
  133. package/test-drizzle-out/meta/_journal.json +20 -0
  134. package/test-drizzle-prompt.sh +2 -0
  135. package/test-policy-prompt.sh +3 -0
  136. package/test-programmatic.ts +30 -0
  137. package/test-programmatic2.ts +59 -0
  138. package/test-schema-no-policies.ts +12 -0
  139. package/test_drizzle_mock.js +2 -2
  140. package/test_find_changed.mjs +3 -1
  141. package/test_hash.js +14 -0
  142. package/tsconfig.json +1 -1
  143. package/vite.config.ts +5 -5
@@ -1,30 +1,31 @@
1
- import { Entity, EntityCollection, EntityStatus, EntityValues, FilterValues } from "../types";
2
- import { RebaseContext } from "../rebase_context";
3
- import { TableMetadata } from "../types/websockets";
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, any> = any> {
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, any>;
11
+ collection?: EntityCollection<M>;
12
12
  }
13
13
  /**
14
14
  * @internal
15
15
  */
16
- export type ListenEntityProps<M extends Record<string, any> = any> = FetchEntityProps<M> & {
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, any> = any> {
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, any> = any> = FetchCollectionProps<M> & {
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, any> = any> {
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, any> = any> {
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<any>;
62
- filterValues: FilterValues<any>;
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, any> = any>(props: FetchCollectionProps<M>): Promise<Entity<M>[]>;
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, any> = any>(props: ListenCollectionProps<M>): () => void;
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, any> = any>(props: FetchEntityProps<M>): Promise<Entity<M> | undefined>;
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, any> = any>(props: ListenEntityProps<M>): () => void;
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, any> = any>(props: SaveEntityProps<M>): Promise<Entity<M>>;
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, any> = any>(props: DeleteEntityProps<M>): Promise<void>;
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, any> = any>(props: FetchCollectionProps<M>): Promise<number>;
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, } from "../types/backend";
11
- export { isSQLAdmin, isDocumentAdmin, isSchemaAdmin, } from "../types/backend";
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, any> = any> = Partial<EntityCollection<M>>;
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, any> = any>(path: string, partialCollection: PartialEntityCollection<M>) => void;
13
- getCollectionConfig: <M extends Record<string, any> = any>(path: string) => PartialEntityCollection<M>;
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 Material specs:
137
- * https://fonts.google.com/icons
138
- * e.g. 'account_tree' or 'person'
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, EntityCollectionsBuilder, EntityCustomView, EntityAction } from "../types";
3
- import { AppView } from "./navigation";
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, EntityCollection } from "../types";
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, any> = any> {
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<any>;
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?: any;
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, any> = any>(props: EntitySidePanelProps<M>) => void;
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, any> = any>(props: EntitySidePanelProps<M>) => void;
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
- fileName?: string;
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 path including the file name where the file was uploaded.
15
+ * Storage key including the file name where the file was uploaded.
17
16
  */
18
- path: string;
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: `gs://my-bucket/path/to/file.png`.
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 a file, specifying a name and a path
76
+ * Upload an object, specifying a key
78
77
  * @param file
79
- * @param fileName
80
- * @param path
78
+ * @param key
81
79
  * @param metadata
82
80
  * @param bucket
83
81
  */
84
- uploadFile: ({ file, fileName, path, metadata, bucket }: UploadFileProps) => Promise<UploadFileResult>;
82
+ putObject: ({ file, key, metadata, bucket }: UploadFileProps) => Promise<UploadFileResult>;
85
83
  /**
86
- * Convert a storage path or URL into a download configuration
87
- * @param path
84
+ * Convert a storage key or URL into a download configuration (signed URL equivalent)
85
+ * @param keyOrUrl
88
86
  * @param bucket
89
87
  */
90
- getDownloadURL: (pathOrUrl: string, bucket?: string) => Promise<DownloadConfig>;
88
+ getSignedUrl: (keyOrUrl: string, bucket?: string) => Promise<DownloadConfig>;
91
89
  /**
92
- * Get a file from a storage path.
93
- * It returns null if the file does not exist.
94
- * @param props
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
- getFile: (path: string, bucket?: string) => Promise<File | null>;
95
+ getObject: (key: string, bucket?: string) => Promise<File | null>;
98
96
  /**
99
- * Delete a file.
100
- * @param path
97
+ * Delete an object.
98
+ * @param key
101
99
  * @param bucket
102
100
  */
103
- deleteFile: (path: string, bucket?: string) => Promise<void>;
101
+ deleteObject: (key: string, bucket?: string) => Promise<void>;
104
102
  /**
105
- * List the contents of a path.
106
- * @param path
103
+ * List the contents of a prefix.
104
+ * @param prefix
107
105
  * @param options
108
106
  */
109
- list: (path: string, options?: {
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 a Google Cloud Storage object. Developers can
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 gs:// URL for this object in the form
147
- * `gs://<bucket>/<path>/<to>/<object>`
148
- * @returns The gs:// URL.
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, AuthController, StorageSource, UserConfigurationPersistence, DatabaseAdmin } from "./controllers";
2
- import { RebaseData } from "./controllers/data";
3
- import { User } from "./users";
4
- import { UserManagementDelegate } from "./types/user_management_delegate";
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, EntityCollection, FilterValues, WhereFilterOp } from "./index";
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, RebaseData } from "../controllers";
2
- import { User } from "../users";
3
- import { EntityCollection } from "./collections";
4
- import { AppView } from "../controllers/navigation";
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 = "blueLighter" | "cyanLighter" | "tealLighter" | "greenLighter" | "yellowLighter" | "orangeLighter" | "redLighter" | "pinkLighter" | "purpleLighter" | "grayLighter" | "blueLight" | "cyanLight" | "tealLight" | "greenLight" | "yellowLight" | "orangeLight" | "redLight" | "pinkLight" | "purpleLight" | "grayLight" | "blueDark" | "cyanDark" | "tealDark" | "greenDark" | "yellowDark" | "orangeDark" | "redDark" | "pinkDark" | "purpleDark" | "grayDark" | "blueDarker" | "cyanDarker" | "tealDarker" | "greenDarker" | "yellowDarker" | "orangeDarker" | "redDarker" | "pinkDarker" | "purpleDarker" | "grayDarker";
5
+ export type ColorKey = "blue" | "cyan" | "teal" | "green" | "yellow" | "orange" | "red" | "pink" | "purple" | "gray" | "indigo" | "violet" | "fuchsia" | "rose" | "emerald";