@rebasepro/types 0.5.0 → 0.6.0
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/controllers/client.d.ts +79 -32
- package/dist/controllers/customization_controller.d.ts +10 -9
- package/dist/index.es.js +249 -197
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +294 -224
- package/dist/index.umd.js.map +1 -1
- package/dist/rebase_context.d.ts +0 -16
- package/dist/types/auth_adapter.d.ts +59 -4
- package/dist/types/backend_hooks.d.ts +0 -63
- package/dist/types/breadcrumbs.d.ts +26 -0
- package/dist/types/collections.d.ts +141 -0
- package/dist/types/component_overrides.d.ts +138 -0
- package/dist/types/entity_views.d.ts +9 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/plugins.d.ts +0 -5
- package/dist/types/translations.d.ts +3 -0
- package/dist/types/user_management_delegate.d.ts +0 -70
- package/package.json +10 -10
- package/src/controllers/client.ts +85 -33
- package/src/controllers/customization_controller.tsx +11 -11
- package/src/rebase_context.tsx +0 -16
- package/src/types/auth_adapter.ts +70 -4
- package/src/types/backend_hooks.ts +0 -55
- package/src/types/breadcrumbs.ts +27 -0
- package/src/types/collections.ts +150 -1
- package/src/types/component_overrides.ts +177 -0
- package/src/types/database_adapter.ts +1 -1
- package/src/types/entity_views.tsx +10 -1
- package/src/types/index.ts +2 -0
- package/src/types/plugins.tsx +1 -5
- package/src/types/translations.ts +3 -0
- package/src/types/user_management_delegate.ts +0 -77
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { User } from "../users";
|
|
2
2
|
import type { RebaseData } from "./data";
|
|
3
3
|
import type { EmailService } from "./email";
|
|
4
|
+
import type { StorageSource } from "./storage";
|
|
5
|
+
import type { CronJobStatus, CronJobLogEntry } from "../types/cron";
|
|
4
6
|
/**
|
|
5
7
|
* Event type for authentication state changes
|
|
6
8
|
*/
|
|
@@ -14,7 +16,6 @@ export interface RebaseSession {
|
|
|
14
16
|
expiresAt: number;
|
|
15
17
|
user: User;
|
|
16
18
|
}
|
|
17
|
-
import type { StorageSource } from "./storage";
|
|
18
19
|
/**
|
|
19
20
|
* Unified Authentication Client Interface
|
|
20
21
|
* Pure functional SDK interface, decoupled from UI and React hooks
|
|
@@ -111,8 +112,65 @@ export interface AdminAPI {
|
|
|
111
112
|
}>;
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
115
|
+
* Client-side Cron job management interface.
|
|
116
|
+
* @group Cron
|
|
117
|
+
*/
|
|
118
|
+
export interface CronAPI {
|
|
119
|
+
listJobs(): Promise<{
|
|
120
|
+
jobs: CronJobStatus[];
|
|
121
|
+
}>;
|
|
122
|
+
getJob(jobId: string): Promise<{
|
|
123
|
+
job: CronJobStatus;
|
|
124
|
+
}>;
|
|
125
|
+
triggerJob(jobId: string): Promise<{
|
|
126
|
+
log: CronJobLogEntry;
|
|
127
|
+
job: CronJobStatus;
|
|
128
|
+
}>;
|
|
129
|
+
getJobLogs(jobId: string, options?: {
|
|
130
|
+
limit?: number;
|
|
131
|
+
}): Promise<{
|
|
132
|
+
logs: CronJobLogEntry[];
|
|
133
|
+
}>;
|
|
134
|
+
toggleJob(jobId: string, enabled: boolean): Promise<{
|
|
135
|
+
job: CronJobStatus;
|
|
136
|
+
}>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Options for invoking a custom backend function.
|
|
140
|
+
* @group Functions
|
|
141
|
+
*/
|
|
142
|
+
export interface FunctionInvokeOptions {
|
|
143
|
+
/** HTTP method — defaults to `"POST"`. */
|
|
144
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
145
|
+
/** Sub-path appended after the function name. */
|
|
146
|
+
path?: string;
|
|
147
|
+
/** Extra headers merged into the request. */
|
|
148
|
+
headers?: Record<string, string>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Client interface for invoking custom backend functions.
|
|
152
|
+
* @group Functions
|
|
153
|
+
*/
|
|
154
|
+
export interface FunctionsAPI {
|
|
155
|
+
/**
|
|
156
|
+
* Invoke a custom backend function by name.
|
|
157
|
+
*
|
|
158
|
+
* @typeParam T - Expected shape of the response payload.
|
|
159
|
+
* @param name - Function name (filename without extension, e.g. `"extract-job"`).
|
|
160
|
+
* @param payload - Optional JSON-serialisable body sent as POST.
|
|
161
|
+
* @param options - Optional overrides (method, sub-path, headers).
|
|
162
|
+
*/
|
|
163
|
+
invoke<T = unknown>(name: string, payload?: unknown, options?: FunctionInvokeOptions): Promise<T>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The single, canonical Rebase client interface.
|
|
167
|
+
*
|
|
168
|
+
* Used everywhere: the server-side `rebase` singleton, the SDK's
|
|
169
|
+
* `createRebaseClient()`, React context, cron job context, etc.
|
|
170
|
+
*
|
|
171
|
+
* Core fields (`data`, `auth`) are always present. Everything else
|
|
172
|
+
* is optional — which capabilities are populated depends on the
|
|
173
|
+
* runtime environment and adapter.
|
|
116
174
|
*/
|
|
117
175
|
export interface RebaseClient<DB = unknown> {
|
|
118
176
|
/** Unified Data access layer */
|
|
@@ -123,43 +181,32 @@ export interface RebaseClient<DB = unknown> {
|
|
|
123
181
|
storage?: StorageSource;
|
|
124
182
|
/**
|
|
125
183
|
* Server-side email service.
|
|
126
|
-
*
|
|
127
|
-
* Available when SMTP (or a custom `sendEmail` function) is configured
|
|
128
|
-
* in the backend auth config. `undefined` when email is not configured.
|
|
129
|
-
*
|
|
130
|
-
* > **Note:** This is only available on the server-side `rebase` singleton.
|
|
131
|
-
* > The client-side SDK does not include an email service.
|
|
184
|
+
* Available when SMTP or a custom `sendEmail` function is configured.
|
|
132
185
|
*/
|
|
133
186
|
email?: EmailService;
|
|
134
187
|
/** Admin API for user management */
|
|
135
188
|
admin?: AdminAPI;
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
189
|
+
/** Cron job management API */
|
|
190
|
+
cron?: CronAPI;
|
|
191
|
+
/** Custom backend functions API */
|
|
192
|
+
functions?: FunctionsAPI;
|
|
193
|
+
/** Base HTTP URL of the backend server */
|
|
141
194
|
baseUrl?: string;
|
|
142
|
-
/**
|
|
143
|
-
* WebSocket client for realtime subscriptions and admin capabilities.
|
|
144
|
-
* Exposed by the SDK client (`@rebasepro/client`). The shape is intentionally
|
|
145
|
-
* left as `unknown` in the base interface — callers should narrow via feature
|
|
146
|
-
* detection (e.g. `typeof ws.executeSql === "function"`).
|
|
147
|
-
*/
|
|
195
|
+
/** WebSocket client for realtime subscriptions */
|
|
148
196
|
ws?: unknown;
|
|
197
|
+
/** Set the auth token for subsequent requests */
|
|
198
|
+
setToken?(token: string | null): void;
|
|
199
|
+
/** Set a function that lazily resolves the auth token */
|
|
200
|
+
setAuthTokenGetter?(getter: () => Promise<string | null>): void;
|
|
201
|
+
/** Set handler called when a request returns 401 */
|
|
202
|
+
setOnUnauthorized?(handler: () => Promise<boolean>): void;
|
|
203
|
+
/** Resolve the current auth token */
|
|
204
|
+
resolveToken?(): Promise<string | null>;
|
|
205
|
+
/** Make a raw HTTP call to the backend */
|
|
206
|
+
call?<T = unknown>(endpoint: string, payload?: unknown): Promise<T>;
|
|
149
207
|
/**
|
|
150
208
|
* Execute raw SQL against the database.
|
|
151
|
-
*
|
|
152
|
-
* Only available server-side when the backend uses a SQL database
|
|
153
|
-
* (PostgreSQL, MySQL, etc.). `undefined` for document databases
|
|
154
|
-
* (MongoDB, Firestore) and on the client-side SDK.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```typescript
|
|
158
|
-
* // In a cron job or custom function:
|
|
159
|
-
* if (ctx.client.sql) {
|
|
160
|
-
* const rows = await ctx.client.sql("SELECT count(*) FROM orders");
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
209
|
+
* Only available server-side with a SQL database.
|
|
163
210
|
*/
|
|
164
211
|
sql?(query: string, options?: {
|
|
165
212
|
database?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import type { EntityLinkBuilder } from "../types/entity_link_builder";
|
|
3
2
|
import type { Locale } from "../types/locales";
|
|
4
3
|
import type { EntityAction } from "../types/entity_actions";
|
|
@@ -6,6 +5,7 @@ import type { EntityCustomView } from "../types/entity_views";
|
|
|
6
5
|
import type { RebasePlugin } from "../types/plugins";
|
|
7
6
|
import type { PropertyConfig } from "../types/property_config";
|
|
8
7
|
import type { SlotContribution } from "../types/slots";
|
|
8
|
+
import type { ComponentOverrideMap } from "../types/component_overrides";
|
|
9
9
|
export type CustomizationController = {
|
|
10
10
|
/**
|
|
11
11
|
* Builder for generating utility links for entities
|
|
@@ -49,12 +49,13 @@ export type CustomizationController = {
|
|
|
49
49
|
* the `propertyConfig` prop of a property in a collection.
|
|
50
50
|
*/
|
|
51
51
|
propertyConfigs: Record<string, PropertyConfig>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Global component overrides. Keys are component names from
|
|
54
|
+
* {@link OverridableComponentName}. Values replace the default
|
|
55
|
+
* implementation everywhere in the app.
|
|
56
|
+
*
|
|
57
|
+
* Collection-scoped overrides (set on individual collections)
|
|
58
|
+
* take precedence over global overrides.
|
|
59
|
+
*/
|
|
60
|
+
components?: ComponentOverrideMap;
|
|
60
61
|
};
|
package/dist/index.es.js
CHANGED
|
@@ -1,222 +1,274 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
1
|
+
//#region src/types/entities.ts
|
|
2
|
+
/**
|
|
3
|
+
* Class used to create a reference to an entity in a different path.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // Simple reference (most common case - single driver, single db)
|
|
7
|
+
* new EntityReference({ id: "123", path: "users" })
|
|
8
|
+
*
|
|
9
|
+
* // Reference to a different driver (e.g., Firestore)
|
|
10
|
+
* new EntityReference({ id: "123", path: "analytics", driver: "firestore" })
|
|
11
|
+
*
|
|
12
|
+
* // Reference to a specific database within a driver
|
|
13
|
+
* new EntityReference({ id: "123", path: "orders", driver: "postgres", databaseId: "orders_db" })
|
|
14
|
+
*/
|
|
15
|
+
var EntityReference = class {
|
|
16
|
+
__type = "reference";
|
|
17
|
+
/**
|
|
18
|
+
* ID of the entity
|
|
19
|
+
*/
|
|
20
|
+
id;
|
|
21
|
+
/**
|
|
22
|
+
* A string representing the path of the referenced document (relative
|
|
23
|
+
* to the root of the database).
|
|
24
|
+
*/
|
|
25
|
+
path;
|
|
26
|
+
/**
|
|
27
|
+
* Which driver (e.g., 'postgres', 'firestore').
|
|
28
|
+
* Defaults to "(default)" if not specified.
|
|
29
|
+
*/
|
|
30
|
+
driver;
|
|
31
|
+
/**
|
|
32
|
+
* Which database within the driver.
|
|
33
|
+
* Defaults to "(default)" if not specified.
|
|
34
|
+
*/
|
|
35
|
+
databaseId;
|
|
36
|
+
/**
|
|
37
|
+
* Create a reference to an entity.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Simple reference (most common case)
|
|
41
|
+
* new EntityReference({ id: "123", path: "users" })
|
|
42
|
+
*
|
|
43
|
+
* // With driver
|
|
44
|
+
* new EntityReference({ id: "123", path: "analytics", driver: "firestore" })
|
|
45
|
+
*/
|
|
46
|
+
constructor(props) {
|
|
47
|
+
this.id = props.id;
|
|
48
|
+
this.path = props.path;
|
|
49
|
+
this.driver = props.driver;
|
|
50
|
+
this.databaseId = props.databaseId;
|
|
51
|
+
}
|
|
52
|
+
get pathWithId() {
|
|
53
|
+
return `${this.path}/${this.id}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get the full path including driver and database prefixes if specified.
|
|
57
|
+
* For the common case (single driver, single db), this just returns pathWithId.
|
|
58
|
+
*/
|
|
59
|
+
get fullPath() {
|
|
60
|
+
const parts = [];
|
|
61
|
+
if (this.driver && this.driver !== "(default)") parts.push(this.driver);
|
|
62
|
+
if (this.databaseId && this.databaseId !== "(default)") parts.push(this.databaseId);
|
|
63
|
+
if (parts.length > 0) return `${parts.join(":")}:::${this.path}/${this.id}`;
|
|
64
|
+
return this.pathWithId;
|
|
65
|
+
}
|
|
66
|
+
isEntityReference() {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Class used to create a reference to an entity in a different path
|
|
72
|
+
*/
|
|
73
|
+
var EntityRelation = class {
|
|
74
|
+
__type = "relation";
|
|
75
|
+
/**
|
|
76
|
+
* ID of the entity
|
|
77
|
+
*/
|
|
78
|
+
id;
|
|
79
|
+
/**
|
|
80
|
+
* A string representing the path of the referenced document (relative
|
|
81
|
+
* to the root of the database).
|
|
82
|
+
*/
|
|
83
|
+
path;
|
|
84
|
+
/**
|
|
85
|
+
* Pre-fetched data payload to eliminate N+1 queries.
|
|
86
|
+
* When present, clients can use this directly instead of fetching.
|
|
87
|
+
*/
|
|
88
|
+
data;
|
|
89
|
+
constructor(id, path, data) {
|
|
90
|
+
this.id = id;
|
|
91
|
+
this.path = path;
|
|
92
|
+
this.data = data;
|
|
93
|
+
}
|
|
94
|
+
get pathWithId() {
|
|
95
|
+
return `${this.path}/${this.id}`;
|
|
96
|
+
}
|
|
97
|
+
isEntityReference() {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
isEntityRelation() {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var GeoPoint = class {
|
|
105
|
+
/**
|
|
106
|
+
* The latitude of this GeoPoint instance.
|
|
107
|
+
*/
|
|
108
|
+
latitude;
|
|
109
|
+
/**
|
|
110
|
+
* The longitude of this GeoPoint instance.
|
|
111
|
+
*/
|
|
112
|
+
longitude;
|
|
113
|
+
constructor(latitude, longitude) {
|
|
114
|
+
this.latitude = latitude;
|
|
115
|
+
this.longitude = longitude;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var Vector = class {
|
|
119
|
+
value;
|
|
120
|
+
constructor(value) {
|
|
121
|
+
this.value = value;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/types/collections.ts
|
|
126
|
+
/**
|
|
127
|
+
* Type guard for PostgreSQL collections.
|
|
128
|
+
* Returns true if the collection uses the Postgres driver (or the default driver).
|
|
129
|
+
* @group Models
|
|
130
|
+
*/
|
|
113
131
|
function isPostgresCollection(collection) {
|
|
114
|
-
|
|
132
|
+
return !collection.driver || collection.driver === "postgres";
|
|
115
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Type guard for Firebase / Firestore collections.
|
|
136
|
+
* @group Models
|
|
137
|
+
*/
|
|
116
138
|
function isFirebaseCollection(collection) {
|
|
117
|
-
|
|
139
|
+
return collection.driver === "firestore";
|
|
118
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Type guard for MongoDB collections.
|
|
143
|
+
* @group Models
|
|
144
|
+
*/
|
|
119
145
|
function isMongoDBCollection(collection) {
|
|
120
|
-
|
|
146
|
+
return collection.driver === "mongodb";
|
|
121
147
|
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/types/backend.ts
|
|
150
|
+
/**
|
|
151
|
+
* Type guard: does this admin support SQL operations?
|
|
152
|
+
* @group Admin
|
|
153
|
+
*/
|
|
122
154
|
function isSQLAdmin(admin) {
|
|
123
|
-
|
|
155
|
+
return !!admin && typeof admin.executeSql === "function";
|
|
124
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Type guard: does this admin support document operations?
|
|
159
|
+
* @group Admin
|
|
160
|
+
*/
|
|
125
161
|
function isDocumentAdmin(admin) {
|
|
126
|
-
|
|
162
|
+
return !!admin && (typeof admin.executeAggregate === "function" || typeof admin.fetchCollectionStats === "function");
|
|
127
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Type guard: does this admin support schema management?
|
|
166
|
+
* @group Admin
|
|
167
|
+
*/
|
|
128
168
|
function isSchemaAdmin(admin) {
|
|
129
|
-
|
|
169
|
+
return !!admin && (typeof admin.fetchUnmappedTables === "function" || typeof admin.fetchTableMetadata === "function");
|
|
130
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Type guard: does this admin support database branching?
|
|
173
|
+
* @group Admin
|
|
174
|
+
*/
|
|
131
175
|
function isBranchAdmin(admin) {
|
|
132
|
-
|
|
176
|
+
return !!admin && typeof admin.createBranch === "function";
|
|
133
177
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/types/data_source.ts
|
|
180
|
+
/** @group Models */
|
|
181
|
+
var POSTGRES_CAPABILITIES = {
|
|
182
|
+
key: "postgres",
|
|
183
|
+
label: "PostgreSQL",
|
|
184
|
+
supportsRelations: true,
|
|
185
|
+
supportsSubcollections: false,
|
|
186
|
+
supportsRLS: true,
|
|
187
|
+
supportsReferences: false,
|
|
188
|
+
supportsColumnTypes: true,
|
|
189
|
+
supportsRealtime: true,
|
|
190
|
+
supportsSQLAdmin: true,
|
|
191
|
+
supportsDocumentAdmin: false,
|
|
192
|
+
supportsSchemaAdmin: true
|
|
146
193
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
194
|
+
/** @group Models */
|
|
195
|
+
var FIREBASE_CAPABILITIES = {
|
|
196
|
+
key: "firestore",
|
|
197
|
+
label: "Firebase / Firestore",
|
|
198
|
+
supportsRelations: false,
|
|
199
|
+
supportsSubcollections: true,
|
|
200
|
+
supportsRLS: false,
|
|
201
|
+
supportsReferences: true,
|
|
202
|
+
supportsColumnTypes: false,
|
|
203
|
+
supportsRealtime: true,
|
|
204
|
+
supportsSQLAdmin: false,
|
|
205
|
+
supportsDocumentAdmin: false,
|
|
206
|
+
supportsSchemaAdmin: false
|
|
159
207
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
208
|
+
/** @group Models */
|
|
209
|
+
var MONGODB_CAPABILITIES = {
|
|
210
|
+
key: "mongodb",
|
|
211
|
+
label: "MongoDB",
|
|
212
|
+
supportsRelations: false,
|
|
213
|
+
supportsSubcollections: true,
|
|
214
|
+
supportsRLS: false,
|
|
215
|
+
supportsReferences: true,
|
|
216
|
+
supportsColumnTypes: false,
|
|
217
|
+
supportsRealtime: false,
|
|
218
|
+
supportsSQLAdmin: false,
|
|
219
|
+
supportsDocumentAdmin: true,
|
|
220
|
+
supportsSchemaAdmin: true
|
|
172
221
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Fallback capabilities when the driver is unknown.
|
|
224
|
+
* Enables everything so nothing is hidden unexpectedly.
|
|
225
|
+
* @group Models
|
|
226
|
+
*/
|
|
227
|
+
var DEFAULT_CAPABILITIES = {
|
|
228
|
+
key: "(default)",
|
|
229
|
+
label: "Default",
|
|
230
|
+
supportsRelations: true,
|
|
231
|
+
supportsSubcollections: true,
|
|
232
|
+
supportsRLS: true,
|
|
233
|
+
supportsReferences: true,
|
|
234
|
+
supportsColumnTypes: true,
|
|
235
|
+
supportsRealtime: true,
|
|
236
|
+
supportsSQLAdmin: true,
|
|
237
|
+
supportsDocumentAdmin: true,
|
|
238
|
+
supportsSchemaAdmin: true
|
|
185
239
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
240
|
+
var CAPABILITIES_REGISTRY = {
|
|
241
|
+
postgres: POSTGRES_CAPABILITIES,
|
|
242
|
+
firestore: FIREBASE_CAPABILITIES,
|
|
243
|
+
mongodb: MONGODB_CAPABILITIES,
|
|
244
|
+
"(default)": DEFAULT_CAPABILITIES
|
|
191
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* Look up capabilities for a given driver key.
|
|
248
|
+
* If `driver` is undefined or not found, returns `DEFAULT_CAPABILITIES`.
|
|
249
|
+
* @group Models
|
|
250
|
+
*/
|
|
192
251
|
function getDataSourceCapabilities(driver) {
|
|
193
|
-
|
|
194
|
-
|
|
252
|
+
if (!driver) return POSTGRES_CAPABILITIES;
|
|
253
|
+
return CAPABILITIES_REGISTRY[driver] ?? DEFAULT_CAPABILITIES;
|
|
195
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Register custom capabilities for a third-party driver.
|
|
257
|
+
* @group Models
|
|
258
|
+
*/
|
|
196
259
|
function registerDataSourceCapabilities(capabilities) {
|
|
197
|
-
|
|
260
|
+
CAPABILITIES_REGISTRY[capabilities.key] = capabilities;
|
|
198
261
|
}
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/types/component_ref.ts
|
|
264
|
+
/**
|
|
265
|
+
* Type guard: checks if a value is a `LazyComponentRef` produced by the
|
|
266
|
+
* Vite transform plugin.
|
|
267
|
+
*/
|
|
199
268
|
function isLazyComponentRef(ref) {
|
|
200
|
-
|
|
269
|
+
return typeof ref === "object" && ref !== null && "__rebaseLazy" in ref && ref.__rebaseLazy === true;
|
|
201
270
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
FIREBASE_CAPABILITIES,
|
|
207
|
-
GeoPoint,
|
|
208
|
-
MONGODB_CAPABILITIES,
|
|
209
|
-
POSTGRES_CAPABILITIES,
|
|
210
|
-
Vector,
|
|
211
|
-
getDataSourceCapabilities,
|
|
212
|
-
isBranchAdmin,
|
|
213
|
-
isDocumentAdmin,
|
|
214
|
-
isFirebaseCollection,
|
|
215
|
-
isLazyComponentRef,
|
|
216
|
-
isMongoDBCollection,
|
|
217
|
-
isPostgresCollection,
|
|
218
|
-
isSQLAdmin,
|
|
219
|
-
isSchemaAdmin,
|
|
220
|
-
registerDataSourceCapabilities
|
|
221
|
-
};
|
|
222
|
-
//# sourceMappingURL=index.es.js.map
|
|
271
|
+
//#endregion
|
|
272
|
+
export { DEFAULT_CAPABILITIES, EntityReference, EntityRelation, FIREBASE_CAPABILITIES, GeoPoint, MONGODB_CAPABILITIES, POSTGRES_CAPABILITIES, Vector, getDataSourceCapabilities, isBranchAdmin, isDocumentAdmin, isFirebaseCollection, isLazyComponentRef, isMongoDBCollection, isPostgresCollection, isSQLAdmin, isSchemaAdmin, registerDataSourceCapabilities };
|
|
273
|
+
|
|
274
|
+
//# sourceMappingURL=index.es.js.map
|