@rebasepro/types 0.0.1-canary.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/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/components/EntityFormActionsProps.d.ts +17 -0
- package/dist/components/EntityFormProps.d.ts +46 -0
- package/dist/components/PropertyPreviewProps.d.ts +50 -0
- package/dist/components/formex.d.ts +40 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/controllers/analytics_controller.d.ts +7 -0
- package/dist/controllers/auth.d.ts +73 -0
- package/dist/controllers/customization_controller.d.ts +50 -0
- package/dist/controllers/datasource.d.ts +179 -0
- package/dist/controllers/dialogs_controller.d.ts +36 -0
- package/dist/controllers/index.d.ts +11 -0
- package/dist/controllers/local_config_persistence.d.ts +20 -0
- package/dist/controllers/navigation.d.ts +262 -0
- package/dist/controllers/side_dialogs_controller.d.ts +67 -0
- package/dist/controllers/side_entity_controller.d.ts +90 -0
- package/dist/controllers/snackbar.d.ts +24 -0
- package/dist/controllers/storage.d.ts +173 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +113 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +117 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/rebase_context.d.ts +91 -0
- package/dist/types/backend.d.ts +254 -0
- package/dist/types/chips.d.ts +5 -0
- package/dist/types/collections.d.ts +887 -0
- package/dist/types/entities.d.ts +140 -0
- package/dist/types/entity_actions.d.ts +98 -0
- package/dist/types/entity_callbacks.d.ts +173 -0
- package/dist/types/entity_link_builder.d.ts +7 -0
- package/dist/types/entity_overrides.d.ts +5 -0
- package/dist/types/export_import.d.ts +21 -0
- package/dist/types/fields.d.ts +221 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/locales.d.ts +4 -0
- package/dist/types/modify_collections.d.ts +5 -0
- package/dist/types/plugins.d.ts +276 -0
- package/dist/types/properties.d.ts +1103 -0
- package/dist/types/property_config.d.ts +68 -0
- package/dist/types/rebase.d.ts +180 -0
- package/dist/types/relations.d.ts +336 -0
- package/dist/types/user_management_delegate.d.ts +78 -0
- package/dist/types/websockets.d.ts +33 -0
- package/dist/users/index.d.ts +2 -0
- package/dist/users/roles.d.ts +22 -0
- package/dist/users/user.d.ts +42 -0
- package/package.json +137 -0
- package/src/components/EntityFormActionsProps.tsx +18 -0
- package/src/components/EntityFormProps.tsx +52 -0
- package/src/components/PropertyPreviewProps.tsx +61 -0
- package/src/components/formex.tsx +46 -0
- package/src/components/index.ts +3 -0
- package/src/controllers/analytics_controller.tsx +57 -0
- package/src/controllers/auth.tsx +94 -0
- package/src/controllers/customization_controller.tsx +61 -0
- package/src/controllers/datasource.ts +218 -0
- package/src/controllers/dialogs_controller.tsx +37 -0
- package/src/controllers/index.ts +11 -0
- package/src/controllers/local_config_persistence.tsx +22 -0
- package/src/controllers/navigation.ts +317 -0
- package/src/controllers/side_dialogs_controller.tsx +82 -0
- package/src/controllers/side_entity_controller.tsx +104 -0
- package/src/controllers/snackbar.ts +29 -0
- package/src/controllers/storage.ts +196 -0
- package/src/index.ts +5 -0
- package/src/rebase_context.tsx +122 -0
- package/src/types/backend.ts +385 -0
- package/src/types/chips.ts +46 -0
- package/src/types/collections.ts +1013 -0
- package/src/types/entities.ts +207 -0
- package/src/types/entity_actions.tsx +118 -0
- package/src/types/entity_callbacks.ts +217 -0
- package/src/types/entity_link_builder.ts +8 -0
- package/src/types/entity_overrides.tsx +6 -0
- package/src/types/export_import.ts +26 -0
- package/src/types/fields.tsx +298 -0
- package/src/types/index.ts +20 -0
- package/src/types/locales.ts +81 -0
- package/src/types/modify_collections.tsx +6 -0
- package/src/types/plugins.tsx +328 -0
- package/src/types/properties.ts +1270 -0
- package/src/types/property_config.tsx +93 -0
- package/src/types/rebase.tsx +211 -0
- package/src/types/relations.ts +351 -0
- package/src/types/user_management_delegate.ts +98 -0
- package/src/types/websockets.ts +37 -0
- package/src/users/index.ts +2 -0
- package/src/users/roles.ts +33 -0
- package/src/users/user.ts +46 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
class EntityReference {
|
|
2
|
+
__type = "reference";
|
|
3
|
+
/**
|
|
4
|
+
* ID of the entity
|
|
5
|
+
*/
|
|
6
|
+
id;
|
|
7
|
+
/**
|
|
8
|
+
* A string representing the path of the referenced document (relative
|
|
9
|
+
* to the root of the database).
|
|
10
|
+
*/
|
|
11
|
+
path;
|
|
12
|
+
/**
|
|
13
|
+
* Which datasource (e.g., 'postgres', 'firestore').
|
|
14
|
+
* Defaults to "(default)" if not specified.
|
|
15
|
+
*/
|
|
16
|
+
datasource;
|
|
17
|
+
/**
|
|
18
|
+
* Which database within the datasource.
|
|
19
|
+
* Defaults to "(default)" if not specified.
|
|
20
|
+
*/
|
|
21
|
+
databaseId;
|
|
22
|
+
/**
|
|
23
|
+
* Create a reference to an entity.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Simple reference (most common case)
|
|
27
|
+
* new EntityReference({ id: "123", path: "users" })
|
|
28
|
+
*
|
|
29
|
+
* // With datasource
|
|
30
|
+
* new EntityReference({ id: "123", path: "analytics", datasource: "firestore" })
|
|
31
|
+
*/
|
|
32
|
+
constructor(props) {
|
|
33
|
+
this.id = props.id;
|
|
34
|
+
this.path = props.path;
|
|
35
|
+
this.datasource = props.datasource;
|
|
36
|
+
this.databaseId = props.databaseId;
|
|
37
|
+
}
|
|
38
|
+
get pathWithId() {
|
|
39
|
+
return `${this.path}/${this.id}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the full path including datasource and database prefixes if specified.
|
|
43
|
+
* For the common case (single datasource, single db), this just returns pathWithId.
|
|
44
|
+
*/
|
|
45
|
+
get fullPath() {
|
|
46
|
+
const parts = [];
|
|
47
|
+
if (this.datasource && this.datasource !== "(default)") {
|
|
48
|
+
parts.push(this.datasource);
|
|
49
|
+
}
|
|
50
|
+
if (this.databaseId && this.databaseId !== "(default)") {
|
|
51
|
+
parts.push(this.databaseId);
|
|
52
|
+
}
|
|
53
|
+
if (parts.length > 0) {
|
|
54
|
+
return `${parts.join(":")}:::${this.path}/${this.id}`;
|
|
55
|
+
}
|
|
56
|
+
return this.pathWithId;
|
|
57
|
+
}
|
|
58
|
+
isEntityReference() {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class EntityRelation {
|
|
63
|
+
__type = "relation";
|
|
64
|
+
/**
|
|
65
|
+
* ID of the entity
|
|
66
|
+
*/
|
|
67
|
+
id;
|
|
68
|
+
/**
|
|
69
|
+
* A string representing the path of the referenced document (relative
|
|
70
|
+
* to the root of the database).
|
|
71
|
+
*/
|
|
72
|
+
path;
|
|
73
|
+
constructor(id, path) {
|
|
74
|
+
this.id = id;
|
|
75
|
+
this.path = path;
|
|
76
|
+
}
|
|
77
|
+
get pathWithId() {
|
|
78
|
+
return `${this.path}/${this.id}`;
|
|
79
|
+
}
|
|
80
|
+
isEntityReference() {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
isEntityRelation() {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
class GeoPoint {
|
|
88
|
+
/**
|
|
89
|
+
* The latitude of this GeoPoint instance.
|
|
90
|
+
*/
|
|
91
|
+
latitude;
|
|
92
|
+
/**
|
|
93
|
+
* The longitude of this GeoPoint instance.
|
|
94
|
+
*/
|
|
95
|
+
longitude;
|
|
96
|
+
constructor(latitude, longitude) {
|
|
97
|
+
this.latitude = latitude;
|
|
98
|
+
this.longitude = longitude;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
class Vector {
|
|
102
|
+
value;
|
|
103
|
+
constructor(value) {
|
|
104
|
+
this.value = value;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
EntityReference,
|
|
109
|
+
EntityRelation,
|
|
110
|
+
GeoPoint,
|
|
111
|
+
Vector
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/types/entities.ts"],"sourcesContent":["/**\n * New or existing status\n * @group Models\n */\nexport type EntityStatus = \"new\" | \"existing\" | \"copy\";\n\n/**\n * Representation of an entity fetched from the datasource\n * @group Models\n */\nexport interface Entity<M extends object = object> {\n\n /**\n * ID of the entity\n */\n id: string | number;\n\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n path: string;\n\n /**\n * Current values\n */\n values: EntityValues<M>;\n\n /**\n * Which datasource this entity belongs to (e.g., 'postgres', 'firestore').\n * If not specified, the default datasource is assumed.\n */\n datasource?: string;\n\n /**\n * Which database within the datasource (e.g., for Firestore multi-database).\n * If not specified, the default database of the datasource is used.\n */\n databaseId?: string;\n}\n\n/**\n * This type represents a record of key value pairs as described in an\n * entity collection.\n * @group Models\n */\nexport type EntityValues<M extends object> = M;\n\n/**\n * Props for creating an EntityReference\n */\nexport interface EntityReferenceProps {\n /** ID of the entity */\n id: string;\n /** Path of the collection (relative to the root of the database) */\n path: string;\n /** Which datasource (e.g., 'postgres', 'firestore'). Defaults to \"(default)\" */\n datasource?: string;\n /** Which database within the datasource. Defaults to \"(default)\" */\n databaseId?: string;\n}\n\n/**\n * Class used to create a reference to an entity in a different path.\n * \n * @example\n * // Simple reference (most common case - single datasource, single db)\n * new EntityReference({ id: \"123\", path: \"users\" })\n * \n * // Reference to a different datasource (e.g., Firestore)\n * new EntityReference({ id: \"123\", path: \"analytics\", datasource: \"firestore\" })\n * \n * // Reference to a specific database within a datasource\n * new EntityReference({ id: \"123\", path: \"orders\", datasource: \"postgres\", databaseId: \"orders_db\" })\n */\nexport class EntityReference {\n\n readonly __type = \"reference\";\n /**\n * ID of the entity\n */\n readonly id: string;\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n readonly path: string;\n\n /**\n * Which datasource (e.g., 'postgres', 'firestore').\n * Defaults to \"(default)\" if not specified.\n */\n readonly datasource?: string;\n\n /**\n * Which database within the datasource.\n * Defaults to \"(default)\" if not specified.\n */\n readonly databaseId?: string;\n\n /**\n * Create a reference to an entity.\n * \n * @example\n * // Simple reference (most common case)\n * new EntityReference({ id: \"123\", path: \"users\" })\n * \n * // With datasource\n * new EntityReference({ id: \"123\", path: \"analytics\", datasource: \"firestore\" })\n */\n constructor(props: EntityReferenceProps) {\n this.id = props.id;\n this.path = props.path;\n this.datasource = props.datasource;\n this.databaseId = props.databaseId;\n }\n\n get pathWithId() {\n return `${this.path}/${this.id}`;\n }\n\n /**\n * Get the full path including datasource and database prefixes if specified.\n * For the common case (single datasource, single db), this just returns pathWithId.\n */\n get fullPath() {\n const parts: string[] = [];\n\n // Add datasource prefix if not default\n if (this.datasource && this.datasource !== \"(default)\") {\n parts.push(this.datasource);\n }\n\n // Add database prefix if specified\n if (this.databaseId && this.databaseId !== \"(default)\") {\n parts.push(this.databaseId);\n }\n\n if (parts.length > 0) {\n return `${parts.join(\":\")}:::${this.path}/${this.id}`;\n }\n return this.pathWithId;\n }\n\n isEntityReference() {\n return true;\n }\n}\n\n/**\n * Class used to create a reference to an entity in a different path\n */\nexport class EntityRelation {\n\n readonly __type = \"relation\";\n /**\n * ID of the entity\n */\n readonly id: string | number;\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n readonly path: string;\n\n constructor(id: string | number, path: string) {\n this.id = id;\n this.path = path;\n }\n\n get pathWithId() {\n return `${this.path}/${this.id}`;\n }\n\n isEntityReference() {\n return false;\n }\n\n isEntityRelation() {\n return true;\n }\n}\n\nexport class GeoPoint {\n\n /**\n * The latitude of this GeoPoint instance.\n */\n readonly latitude: number;\n /**\n * The longitude of this GeoPoint instance.\n */\n readonly longitude: number;\n\n constructor(latitude: number, longitude: number) {\n this.latitude = latitude;\n this.longitude = longitude;\n }\n}\n\nexport class Vector {\n readonly value: number[];\n\n constructor(value: number[]) {\n this.value = value;\n }\n}\n"],"names":["EntityReference","__type","id","path","datasource","databaseId","constructor","props","pathWithId","fullPath","parts","push","length","join","isEntityReference","EntityRelation","isEntityRelation","GeoPoint","latitude","longitude","Vector","value"],"mappings":"AA2EO,MAAMA,gBAAgB;AAAA,EAEhBC,SAAS;AAAA;AAAA;AAAA;AAAA,EAITC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAKAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAMAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAMAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAYTC,YAAYC,OAA6B;AACrC,SAAKL,KAAKK,MAAML;AAChB,SAAKC,OAAOI,MAAMJ;AAClB,SAAKC,aAAaG,MAAMH;AACxB,SAAKC,aAAaE,MAAMF;AAAAA,EAC5B;AAAA,EAEA,IAAIG,aAAa;AACb,WAAO,GAAG,KAAKL,IAAI,IAAI,KAAKD,EAAE;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAIO,WAAW;AACX,UAAMC,QAAkB,CAAA;AAGxB,QAAI,KAAKN,cAAc,KAAKA,eAAe,aAAa;AACpDM,YAAMC,KAAK,KAAKP,UAAU;AAAA,IAC9B;AAGA,QAAI,KAAKC,cAAc,KAAKA,eAAe,aAAa;AACpDK,YAAMC,KAAK,KAAKN,UAAU;AAAA,IAC9B;AAEA,QAAIK,MAAME,SAAS,GAAG;AAClB,aAAO,GAAGF,MAAMG,KAAK,GAAG,CAAC,MAAM,KAAKV,IAAI,IAAI,KAAKD,EAAE;AAAA,IACvD;AACA,WAAO,KAAKM;AAAAA,EAChB;AAAA,EAEAM,oBAAoB;AAChB,WAAO;AAAA,EACX;AACJ;AAKO,MAAMC,eAAe;AAAA,EAEfd,SAAS;AAAA;AAAA;AAAA;AAAA,EAITC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAKAC;AAAAA,EAETG,YAAYJ,IAAqBC,MAAc;AAC3C,SAAKD,KAAKA;AACV,SAAKC,OAAOA;AAAAA,EAChB;AAAA,EAEA,IAAIK,aAAa;AACb,WAAO,GAAG,KAAKL,IAAI,IAAI,KAAKD,EAAE;AAAA,EAClC;AAAA,EAEAY,oBAAoB;AAChB,WAAO;AAAA,EACX;AAAA,EAEAE,mBAAmB;AACf,WAAO;AAAA,EACX;AACJ;AAEO,MAAMC,SAAS;AAAA;AAAA;AAAA;AAAA,EAKTC;AAAAA;AAAAA;AAAAA;AAAAA,EAIAC;AAAAA,EAETb,YAAYY,UAAkBC,WAAmB;AAC7C,SAAKD,WAAWA;AAChB,SAAKC,YAAYA;AAAAA,EACrB;AACJ;AAEO,MAAMC,OAAO;AAAA,EACPC;AAAAA,EAETf,YAAYe,OAAiB;AACzB,SAAKA,QAAQA;AAAAA,EACjB;AACJ;"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["Rebase Types"] = {}));
|
|
3
|
+
})(this, function(exports2) {
|
|
4
|
+
"use strict";
|
|
5
|
+
class EntityReference {
|
|
6
|
+
__type = "reference";
|
|
7
|
+
/**
|
|
8
|
+
* ID of the entity
|
|
9
|
+
*/
|
|
10
|
+
id;
|
|
11
|
+
/**
|
|
12
|
+
* A string representing the path of the referenced document (relative
|
|
13
|
+
* to the root of the database).
|
|
14
|
+
*/
|
|
15
|
+
path;
|
|
16
|
+
/**
|
|
17
|
+
* Which datasource (e.g., 'postgres', 'firestore').
|
|
18
|
+
* Defaults to "(default)" if not specified.
|
|
19
|
+
*/
|
|
20
|
+
datasource;
|
|
21
|
+
/**
|
|
22
|
+
* Which database within the datasource.
|
|
23
|
+
* Defaults to "(default)" if not specified.
|
|
24
|
+
*/
|
|
25
|
+
databaseId;
|
|
26
|
+
/**
|
|
27
|
+
* Create a reference to an entity.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Simple reference (most common case)
|
|
31
|
+
* new EntityReference({ id: "123", path: "users" })
|
|
32
|
+
*
|
|
33
|
+
* // With datasource
|
|
34
|
+
* new EntityReference({ id: "123", path: "analytics", datasource: "firestore" })
|
|
35
|
+
*/
|
|
36
|
+
constructor(props) {
|
|
37
|
+
this.id = props.id;
|
|
38
|
+
this.path = props.path;
|
|
39
|
+
this.datasource = props.datasource;
|
|
40
|
+
this.databaseId = props.databaseId;
|
|
41
|
+
}
|
|
42
|
+
get pathWithId() {
|
|
43
|
+
return `${this.path}/${this.id}`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the full path including datasource and database prefixes if specified.
|
|
47
|
+
* For the common case (single datasource, single db), this just returns pathWithId.
|
|
48
|
+
*/
|
|
49
|
+
get fullPath() {
|
|
50
|
+
const parts = [];
|
|
51
|
+
if (this.datasource && this.datasource !== "(default)") {
|
|
52
|
+
parts.push(this.datasource);
|
|
53
|
+
}
|
|
54
|
+
if (this.databaseId && this.databaseId !== "(default)") {
|
|
55
|
+
parts.push(this.databaseId);
|
|
56
|
+
}
|
|
57
|
+
if (parts.length > 0) {
|
|
58
|
+
return `${parts.join(":")}:::${this.path}/${this.id}`;
|
|
59
|
+
}
|
|
60
|
+
return this.pathWithId;
|
|
61
|
+
}
|
|
62
|
+
isEntityReference() {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class EntityRelation {
|
|
67
|
+
__type = "relation";
|
|
68
|
+
/**
|
|
69
|
+
* ID of the entity
|
|
70
|
+
*/
|
|
71
|
+
id;
|
|
72
|
+
/**
|
|
73
|
+
* A string representing the path of the referenced document (relative
|
|
74
|
+
* to the root of the database).
|
|
75
|
+
*/
|
|
76
|
+
path;
|
|
77
|
+
constructor(id, path) {
|
|
78
|
+
this.id = id;
|
|
79
|
+
this.path = path;
|
|
80
|
+
}
|
|
81
|
+
get pathWithId() {
|
|
82
|
+
return `${this.path}/${this.id}`;
|
|
83
|
+
}
|
|
84
|
+
isEntityReference() {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
isEntityRelation() {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
class GeoPoint {
|
|
92
|
+
/**
|
|
93
|
+
* The latitude of this GeoPoint instance.
|
|
94
|
+
*/
|
|
95
|
+
latitude;
|
|
96
|
+
/**
|
|
97
|
+
* The longitude of this GeoPoint instance.
|
|
98
|
+
*/
|
|
99
|
+
longitude;
|
|
100
|
+
constructor(latitude, longitude) {
|
|
101
|
+
this.latitude = latitude;
|
|
102
|
+
this.longitude = longitude;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class Vector {
|
|
106
|
+
value;
|
|
107
|
+
constructor(value) {
|
|
108
|
+
this.value = value;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports2.EntityReference = EntityReference;
|
|
112
|
+
exports2.EntityRelation = EntityRelation;
|
|
113
|
+
exports2.GeoPoint = GeoPoint;
|
|
114
|
+
exports2.Vector = Vector;
|
|
115
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/types/entities.ts"],"sourcesContent":["/**\n * New or existing status\n * @group Models\n */\nexport type EntityStatus = \"new\" | \"existing\" | \"copy\";\n\n/**\n * Representation of an entity fetched from the datasource\n * @group Models\n */\nexport interface Entity<M extends object = object> {\n\n /**\n * ID of the entity\n */\n id: string | number;\n\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n path: string;\n\n /**\n * Current values\n */\n values: EntityValues<M>;\n\n /**\n * Which datasource this entity belongs to (e.g., 'postgres', 'firestore').\n * If not specified, the default datasource is assumed.\n */\n datasource?: string;\n\n /**\n * Which database within the datasource (e.g., for Firestore multi-database).\n * If not specified, the default database of the datasource is used.\n */\n databaseId?: string;\n}\n\n/**\n * This type represents a record of key value pairs as described in an\n * entity collection.\n * @group Models\n */\nexport type EntityValues<M extends object> = M;\n\n/**\n * Props for creating an EntityReference\n */\nexport interface EntityReferenceProps {\n /** ID of the entity */\n id: string;\n /** Path of the collection (relative to the root of the database) */\n path: string;\n /** Which datasource (e.g., 'postgres', 'firestore'). Defaults to \"(default)\" */\n datasource?: string;\n /** Which database within the datasource. Defaults to \"(default)\" */\n databaseId?: string;\n}\n\n/**\n * Class used to create a reference to an entity in a different path.\n * \n * @example\n * // Simple reference (most common case - single datasource, single db)\n * new EntityReference({ id: \"123\", path: \"users\" })\n * \n * // Reference to a different datasource (e.g., Firestore)\n * new EntityReference({ id: \"123\", path: \"analytics\", datasource: \"firestore\" })\n * \n * // Reference to a specific database within a datasource\n * new EntityReference({ id: \"123\", path: \"orders\", datasource: \"postgres\", databaseId: \"orders_db\" })\n */\nexport class EntityReference {\n\n readonly __type = \"reference\";\n /**\n * ID of the entity\n */\n readonly id: string;\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n readonly path: string;\n\n /**\n * Which datasource (e.g., 'postgres', 'firestore').\n * Defaults to \"(default)\" if not specified.\n */\n readonly datasource?: string;\n\n /**\n * Which database within the datasource.\n * Defaults to \"(default)\" if not specified.\n */\n readonly databaseId?: string;\n\n /**\n * Create a reference to an entity.\n * \n * @example\n * // Simple reference (most common case)\n * new EntityReference({ id: \"123\", path: \"users\" })\n * \n * // With datasource\n * new EntityReference({ id: \"123\", path: \"analytics\", datasource: \"firestore\" })\n */\n constructor(props: EntityReferenceProps) {\n this.id = props.id;\n this.path = props.path;\n this.datasource = props.datasource;\n this.databaseId = props.databaseId;\n }\n\n get pathWithId() {\n return `${this.path}/${this.id}`;\n }\n\n /**\n * Get the full path including datasource and database prefixes if specified.\n * For the common case (single datasource, single db), this just returns pathWithId.\n */\n get fullPath() {\n const parts: string[] = [];\n\n // Add datasource prefix if not default\n if (this.datasource && this.datasource !== \"(default)\") {\n parts.push(this.datasource);\n }\n\n // Add database prefix if specified\n if (this.databaseId && this.databaseId !== \"(default)\") {\n parts.push(this.databaseId);\n }\n\n if (parts.length > 0) {\n return `${parts.join(\":\")}:::${this.path}/${this.id}`;\n }\n return this.pathWithId;\n }\n\n isEntityReference() {\n return true;\n }\n}\n\n/**\n * Class used to create a reference to an entity in a different path\n */\nexport class EntityRelation {\n\n readonly __type = \"relation\";\n /**\n * ID of the entity\n */\n readonly id: string | number;\n /**\n * A string representing the path of the referenced document (relative\n * to the root of the database).\n */\n readonly path: string;\n\n constructor(id: string | number, path: string) {\n this.id = id;\n this.path = path;\n }\n\n get pathWithId() {\n return `${this.path}/${this.id}`;\n }\n\n isEntityReference() {\n return false;\n }\n\n isEntityRelation() {\n return true;\n }\n}\n\nexport class GeoPoint {\n\n /**\n * The latitude of this GeoPoint instance.\n */\n readonly latitude: number;\n /**\n * The longitude of this GeoPoint instance.\n */\n readonly longitude: number;\n\n constructor(latitude: number, longitude: number) {\n this.latitude = latitude;\n this.longitude = longitude;\n }\n}\n\nexport class Vector {\n readonly value: number[];\n\n constructor(value: number[]) {\n this.value = value;\n }\n}\n"],"names":["EntityReference","__type","id","path","datasource","databaseId","constructor","props","pathWithId","fullPath","parts","push","length","join","isEntityReference","EntityRelation","isEntityRelation","GeoPoint","latitude","longitude","Vector","value"],"mappings":";;;;EA2EO,MAAMA,gBAAgB;AAAA,IAEhBC,SAAS;AAAA;AAAA;AAAA;AAAA,IAITC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,IAKAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,IAMAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,IAMAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,IAYTC,YAAYC,OAA6B;AACrC,WAAKL,KAAKK,MAAML;AAChB,WAAKC,OAAOI,MAAMJ;AAClB,WAAKC,aAAaG,MAAMH;AACxB,WAAKC,aAAaE,MAAMF;AAAAA,IAC5B;AAAA,IAEA,IAAIG,aAAa;AACb,aAAO,GAAG,KAAKL,IAAI,IAAI,KAAKD,EAAE;AAAA,IAClC;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,IAAIO,WAAW;AACX,YAAMC,QAAkB,CAAA;AAGxB,UAAI,KAAKN,cAAc,KAAKA,eAAe,aAAa;AACpDM,cAAMC,KAAK,KAAKP,UAAU;AAAA,MAC9B;AAGA,UAAI,KAAKC,cAAc,KAAKA,eAAe,aAAa;AACpDK,cAAMC,KAAK,KAAKN,UAAU;AAAA,MAC9B;AAEA,UAAIK,MAAME,SAAS,GAAG;AAClB,eAAO,GAAGF,MAAMG,KAAK,GAAG,CAAC,MAAM,KAAKV,IAAI,IAAI,KAAKD,EAAE;AAAA,MACvD;AACA,aAAO,KAAKM;AAAAA,IAChB;AAAA,IAEAM,oBAAoB;AAChB,aAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAKO,MAAMC,eAAe;AAAA,IAEfd,SAAS;AAAA;AAAA;AAAA;AAAA,IAITC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,IAKAC;AAAAA,IAETG,YAAYJ,IAAqBC,MAAc;AAC3C,WAAKD,KAAKA;AACV,WAAKC,OAAOA;AAAAA,IAChB;AAAA,IAEA,IAAIK,aAAa;AACb,aAAO,GAAG,KAAKL,IAAI,IAAI,KAAKD,EAAE;AAAA,IAClC;AAAA,IAEAY,oBAAoB;AAChB,aAAO;AAAA,IACX;AAAA,IAEAE,mBAAmB;AACf,aAAO;AAAA,IACX;AAAA,EACJ;AAAA,EAEO,MAAMC,SAAS;AAAA;AAAA;AAAA;AAAA,IAKTC;AAAAA;AAAAA;AAAAA;AAAAA,IAIAC;AAAAA,IAETb,YAAYY,UAAkBC,WAAmB;AAC7C,WAAKD,WAAWA;AAChB,WAAKC,YAAYA;AAAAA,IACrB;AAAA,EACJ;AAAA,EAEO,MAAMC,OAAO;AAAA,IACPC;AAAAA,IAETf,YAAYe,OAAiB;AACzB,WAAKA,QAAQA;AAAAA,IACjB;AAAA,EACJ;;;;;;;"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AnalyticsController, AuthController, CustomizationController, DataSource, DialogsController, NavigationController, SideDialogsController, SideEntityController, SnackbarController, StorageSource, UserConfigurationPersistence } from "./controllers";
|
|
2
|
+
import { User } from "./users";
|
|
3
|
+
import { UserManagementDelegate, EffectiveRoleController } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Context that is provided to entity callbacks (hooks).
|
|
6
|
+
* It contains only the dependencies that are available in both the frontend and the backend.
|
|
7
|
+
* @group Hooks and utilities
|
|
8
|
+
*/
|
|
9
|
+
export type RebaseCallContext<USER extends User = User> = {
|
|
10
|
+
/**
|
|
11
|
+
* Connector to your database, e.g. your Firestore database
|
|
12
|
+
*/
|
|
13
|
+
dataSource: DataSource;
|
|
14
|
+
/**
|
|
15
|
+
* Used storage implementation
|
|
16
|
+
*/
|
|
17
|
+
storageSource: StorageSource;
|
|
18
|
+
/**
|
|
19
|
+
* Set by the backend when callbacks are executed on the server.
|
|
20
|
+
*/
|
|
21
|
+
user?: USER;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Context that includes the internal controllers and contexts used by the app.
|
|
25
|
+
* Some controllers and context included in this context can be accessed
|
|
26
|
+
* directly from their respective hooks.
|
|
27
|
+
* @group Hooks and utilities
|
|
28
|
+
* @see useRebaseContext
|
|
29
|
+
*/
|
|
30
|
+
export type RebaseContext<USER extends User = User, AuthControllerType extends AuthController<USER> = AuthController<USER>> = RebaseCallContext<USER> & {
|
|
31
|
+
/**
|
|
32
|
+
* Context that includes the resolved navigation and utility methods and
|
|
33
|
+
* attributes.
|
|
34
|
+
* @see useNavigation
|
|
35
|
+
*/
|
|
36
|
+
navigation?: NavigationController;
|
|
37
|
+
/**
|
|
38
|
+
* Controller to open the side dialog displaying entity forms
|
|
39
|
+
* @see useSideEntityController
|
|
40
|
+
*/
|
|
41
|
+
sideEntityController?: SideEntityController;
|
|
42
|
+
/**
|
|
43
|
+
* Controller used to open side dialogs
|
|
44
|
+
* This is the controller used internally by side entity dialogs
|
|
45
|
+
* or reference dialogs.
|
|
46
|
+
*/
|
|
47
|
+
sideDialogsController?: SideDialogsController;
|
|
48
|
+
/**
|
|
49
|
+
* Controller used to open regular dialogs
|
|
50
|
+
*/
|
|
51
|
+
dialogsController?: DialogsController;
|
|
52
|
+
/**
|
|
53
|
+
* Used auth controller
|
|
54
|
+
*/
|
|
55
|
+
authController?: AuthControllerType;
|
|
56
|
+
/**
|
|
57
|
+
* This controller holds the customization options for the CMS.
|
|
58
|
+
*/
|
|
59
|
+
customizationController?: CustomizationController;
|
|
60
|
+
/**
|
|
61
|
+
* Use this controller to display snackbars
|
|
62
|
+
*/
|
|
63
|
+
snackbarController?: SnackbarController;
|
|
64
|
+
/**
|
|
65
|
+
* Use this controller to access data stored in the browser for the user
|
|
66
|
+
*/
|
|
67
|
+
userConfigPersistence?: UserConfigurationPersistence;
|
|
68
|
+
/**
|
|
69
|
+
* Callback to send analytics events
|
|
70
|
+
*/
|
|
71
|
+
analyticsController?: AnalyticsController;
|
|
72
|
+
/**
|
|
73
|
+
* This section is used to manage users in the CMS.
|
|
74
|
+
* It is used to show user information in various places of the CMS,
|
|
75
|
+
* for example, to show who created or modified an entity,
|
|
76
|
+
* or to assign ownership of an entity.
|
|
77
|
+
*
|
|
78
|
+
* In the base CMS, this information is not used for access control.
|
|
79
|
+
* You can pass your own implementation of this section, to populate
|
|
80
|
+
* the dropdown of users when assigning ownership of an entity,
|
|
81
|
+
* or to show more information about the user.
|
|
82
|
+
*
|
|
83
|
+
* If you are using the Rebase user management plugin, this
|
|
84
|
+
* section will be implemented automatically.
|
|
85
|
+
*/
|
|
86
|
+
userManagement?: UserManagementDelegate<USER>;
|
|
87
|
+
/**
|
|
88
|
+
* Controller to simulate different roles when dev mode is active.
|
|
89
|
+
*/
|
|
90
|
+
effectiveRoleController?: EffectiveRoleController;
|
|
91
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Entity, EntityCollection, FilterValues, WhereFilterOp } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* Abstract database connection interface.
|
|
4
|
+
* Represents a connection to any database system.
|
|
5
|
+
*/
|
|
6
|
+
export interface DatabaseConnection {
|
|
7
|
+
/**
|
|
8
|
+
* Type identifier for this database (e.g., 'postgres', 'mongodb', 'mysql')
|
|
9
|
+
*/
|
|
10
|
+
readonly type: string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the connection is currently active
|
|
13
|
+
*/
|
|
14
|
+
readonly isConnected?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Close the database connection
|
|
17
|
+
*/
|
|
18
|
+
close?(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A single filter condition for database queries
|
|
22
|
+
*/
|
|
23
|
+
export interface QueryFilter {
|
|
24
|
+
field: string;
|
|
25
|
+
operator: WhereFilterOp;
|
|
26
|
+
value: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for fetching a collection of entities
|
|
30
|
+
*/
|
|
31
|
+
export interface FetchCollectionOptions<M extends Record<string, any> = any> {
|
|
32
|
+
filter?: FilterValues<Extract<keyof M, string>>;
|
|
33
|
+
orderBy?: string;
|
|
34
|
+
order?: "desc" | "asc";
|
|
35
|
+
limit?: number;
|
|
36
|
+
startAfter?: unknown;
|
|
37
|
+
searchString?: string;
|
|
38
|
+
databaseId?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Options for searching entities
|
|
42
|
+
*/
|
|
43
|
+
export interface SearchOptions<M extends Record<string, any> = any> {
|
|
44
|
+
filter?: FilterValues<Extract<keyof M, string>>;
|
|
45
|
+
orderBy?: string;
|
|
46
|
+
order?: "desc" | "asc";
|
|
47
|
+
limit?: number;
|
|
48
|
+
databaseId?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Options for counting entities
|
|
52
|
+
*/
|
|
53
|
+
export interface CountOptions<M extends Record<string, any> = any> {
|
|
54
|
+
filter?: FilterValues<Extract<keyof M, string>>;
|
|
55
|
+
databaseId?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Abstract condition builder interface.
|
|
59
|
+
* Implementations translate Rebase filter conditions to database-specific queries.
|
|
60
|
+
*
|
|
61
|
+
* Note: This interface can be implemented as instance methods or as a class with static methods.
|
|
62
|
+
* For static implementations (like DrizzleConditionBuilder), use the ConditionBuilderStatic type.
|
|
63
|
+
*
|
|
64
|
+
* @template T The type of condition returned by the builder (e.g., SQL for PostgreSQL, Filter<Document> for MongoDB)
|
|
65
|
+
*/
|
|
66
|
+
export interface ConditionBuilder<T = any> {
|
|
67
|
+
/**
|
|
68
|
+
* Build filter conditions from Rebase FilterValues
|
|
69
|
+
*/
|
|
70
|
+
buildFilterConditions<M extends Record<string, any>>(filter: FilterValues<Extract<keyof M, string>>, collectionPath: string, ...args: unknown[]): T[];
|
|
71
|
+
/**
|
|
72
|
+
* Build search conditions for text search
|
|
73
|
+
*/
|
|
74
|
+
buildSearchConditions(searchString: string, properties: Record<string, unknown>, ...args: unknown[]): T[];
|
|
75
|
+
/**
|
|
76
|
+
* Combine multiple conditions with AND operator
|
|
77
|
+
*/
|
|
78
|
+
combineConditionsWithAnd(conditions: T[]): T | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Combine multiple conditions with OR operator
|
|
81
|
+
*/
|
|
82
|
+
combineConditionsWithOr(conditions: T[]): T | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Static condition builder type for implementations using static methods.
|
|
86
|
+
* Use this type when the class provides static methods rather than instance methods.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // DrizzleConditionBuilder satisfies this type
|
|
90
|
+
* const builder: ConditionBuilderStatic<SQL> = DrizzleConditionBuilder;
|
|
91
|
+
*/
|
|
92
|
+
export type ConditionBuilderStatic<T = any> = {
|
|
93
|
+
buildFilterConditions<M extends Record<string, any>>(filter: FilterValues<Extract<keyof M, string>>, ...args: unknown[]): T[];
|
|
94
|
+
buildSearchConditions(searchString: string, properties: Record<string, unknown>, ...args: unknown[]): T[];
|
|
95
|
+
combineConditionsWithAnd(conditions: T[]): T | undefined;
|
|
96
|
+
combineConditionsWithOr(conditions: T[]): T | undefined;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Abstract entity repository interface.
|
|
100
|
+
* Handles all CRUD operations for entities in the database.
|
|
101
|
+
*
|
|
102
|
+
* Implementations should handle:
|
|
103
|
+
* - Entity serialization/deserialization
|
|
104
|
+
* - Relation resolution
|
|
105
|
+
* - ID generation and conversion
|
|
106
|
+
*/
|
|
107
|
+
export interface EntityRepository {
|
|
108
|
+
/**
|
|
109
|
+
* Fetch a single entity by ID
|
|
110
|
+
*/
|
|
111
|
+
fetchEntity<M extends Record<string, any>>(collectionPath: string, entityId: string | number, databaseId?: string): Promise<Entity<M> | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* Fetch a collection of entities with optional filtering, ordering, and pagination
|
|
114
|
+
*/
|
|
115
|
+
fetchCollection<M extends Record<string, any>>(collectionPath: string, options?: FetchCollectionOptions<M>): Promise<Entity<M>[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Search entities by text
|
|
118
|
+
*/
|
|
119
|
+
searchEntities<M extends Record<string, any>>(collectionPath: string, searchString: string, options?: SearchOptions<M>): Promise<Entity<M>[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Count entities in a collection
|
|
122
|
+
*/
|
|
123
|
+
countEntities<M extends Record<string, any>>(collectionPath: string, options?: CountOptions<M>): Promise<number>;
|
|
124
|
+
/**
|
|
125
|
+
* Save an entity (create or update)
|
|
126
|
+
*/
|
|
127
|
+
saveEntity<M extends Record<string, any>>(collectionPath: string, values: Partial<M>, entityId?: string | number, databaseId?: string): Promise<Entity<M>>;
|
|
128
|
+
/**
|
|
129
|
+
* Delete an entity by ID
|
|
130
|
+
*/
|
|
131
|
+
deleteEntity(collectionPath: string, entityId: string | number, databaseId?: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Check if a field value is unique in a collection
|
|
134
|
+
*/
|
|
135
|
+
checkUniqueField(collectionPath: string, fieldName: string, value: unknown, excludeEntityId?: string, databaseId?: string): Promise<boolean>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Configuration for subscribing to a collection
|
|
139
|
+
*/
|
|
140
|
+
export interface CollectionSubscriptionConfig {
|
|
141
|
+
clientId: string;
|
|
142
|
+
path: string;
|
|
143
|
+
filter?: unknown;
|
|
144
|
+
orderBy?: string;
|
|
145
|
+
order?: "desc" | "asc";
|
|
146
|
+
limit?: number;
|
|
147
|
+
startAfter?: unknown;
|
|
148
|
+
databaseId?: string;
|
|
149
|
+
searchString?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Configuration for subscribing to a single entity
|
|
153
|
+
*/
|
|
154
|
+
export interface EntitySubscriptionConfig {
|
|
155
|
+
clientId: string;
|
|
156
|
+
path: string;
|
|
157
|
+
entityId: string | number;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Abstract realtime provider interface.
|
|
161
|
+
* Handles real-time subscriptions and notifications for entity changes.
|
|
162
|
+
*/
|
|
163
|
+
export interface RealtimeProvider {
|
|
164
|
+
/**
|
|
165
|
+
* Subscribe to collection changes
|
|
166
|
+
*/
|
|
167
|
+
subscribeToCollection(subscriptionId: string, config: CollectionSubscriptionConfig, callback?: (entities: Entity[]) => void): void;
|
|
168
|
+
/**
|
|
169
|
+
* Subscribe to single entity changes
|
|
170
|
+
*/
|
|
171
|
+
subscribeToEntity(subscriptionId: string, config: EntitySubscriptionConfig, callback?: (entity: Entity | null) => void): void;
|
|
172
|
+
/**
|
|
173
|
+
* Unsubscribe from a subscription
|
|
174
|
+
*/
|
|
175
|
+
unsubscribe(subscriptionId: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* Notify all relevant subscribers of an entity update
|
|
178
|
+
*/
|
|
179
|
+
notifyEntityUpdate(path: string, entityId: string, entity: Entity | null, databaseId?: string): Promise<void>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Abstract collection registry interface.
|
|
183
|
+
* Manages registration and lookup of entity collections.
|
|
184
|
+
*/
|
|
185
|
+
export interface CollectionRegistryInterface {
|
|
186
|
+
/**
|
|
187
|
+
* Register a collection
|
|
188
|
+
*/
|
|
189
|
+
register(collection: EntityCollection): void;
|
|
190
|
+
/**
|
|
191
|
+
* Get a collection by its path
|
|
192
|
+
*/
|
|
193
|
+
getCollectionByPath(path: string): EntityCollection | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Get all registered collections
|
|
196
|
+
*/
|
|
197
|
+
getCollections(): EntityCollection[];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Abstract data transformer interface.
|
|
201
|
+
* Handles serialization/deserialization between frontend and database formats.
|
|
202
|
+
*/
|
|
203
|
+
export interface DataTransformer {
|
|
204
|
+
/**
|
|
205
|
+
* Transform entity data for storage in the database
|
|
206
|
+
*/
|
|
207
|
+
serializeToDatabase<M extends Record<string, any>>(entity: M, collection: EntityCollection): Record<string, any>;
|
|
208
|
+
/**
|
|
209
|
+
* Transform database data back to entity format
|
|
210
|
+
*/
|
|
211
|
+
deserializeFromDatabase<M extends Record<string, any>>(data: Record<string, any>, collection: EntityCollection): Promise<M>;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Configuration for creating a database backend
|
|
215
|
+
*/
|
|
216
|
+
export interface BackendConfig {
|
|
217
|
+
/**
|
|
218
|
+
* Type of database backend
|
|
219
|
+
*/
|
|
220
|
+
type: string;
|
|
221
|
+
/**
|
|
222
|
+
* Database connection (implementation-specific)
|
|
223
|
+
*/
|
|
224
|
+
connection: unknown;
|
|
225
|
+
/**
|
|
226
|
+
* Schema definition (implementation-specific, e.g., Drizzle schema for PostgreSQL)
|
|
227
|
+
*/
|
|
228
|
+
schema?: unknown;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* A complete backend instance with all required services
|
|
232
|
+
*/
|
|
233
|
+
export interface BackendInstance {
|
|
234
|
+
/**
|
|
235
|
+
* Entity repository for CRUD operations
|
|
236
|
+
*/
|
|
237
|
+
entityRepository: EntityRepository;
|
|
238
|
+
/**
|
|
239
|
+
* Realtime provider for subscriptions
|
|
240
|
+
*/
|
|
241
|
+
realtimeProvider: RealtimeProvider;
|
|
242
|
+
/**
|
|
243
|
+
* Collection registry
|
|
244
|
+
*/
|
|
245
|
+
collectionRegistry: CollectionRegistryInterface;
|
|
246
|
+
/**
|
|
247
|
+
* The underlying database connection
|
|
248
|
+
*/
|
|
249
|
+
connection: DatabaseConnection;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Factory function type for creating backend instances
|
|
253
|
+
*/
|
|
254
|
+
export type BackendFactory<TConfig extends BackendConfig = BackendConfig> = (config: TConfig) => BackendInstance;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type ColorScheme = {
|
|
2
|
+
color: string;
|
|
3
|
+
text: string;
|
|
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";
|