@rebasepro/server-mongodb 0.0.1-canary.09e5ec5
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 +6 -0
- package/dist/ensure-collections-CNrcwVgY.js +74 -0
- package/dist/ensure-collections-CNrcwVgY.js.map +1 -0
- package/dist/ensure-history-collection-DBIiwmCm.js +15 -0
- package/dist/ensure-history-collection-DBIiwmCm.js.map +1 -0
- package/dist/index.es.js +1734 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +2043 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/server-core/src/api/ast-schema-editor.d.ts +22 -0
- package/dist/server-core/src/api/ast-schema-editor.d.ts.map +1 -0
- package/dist/server-core/src/api/errors.d.ts +36 -0
- package/dist/server-core/src/api/errors.d.ts.map +1 -0
- package/dist/server-core/src/api/graphql/graphql-schema-generator.d.ts +36 -0
- package/dist/server-core/src/api/graphql/graphql-schema-generator.d.ts.map +1 -0
- package/dist/server-core/src/api/graphql/index.d.ts +2 -0
- package/dist/server-core/src/api/graphql/index.d.ts.map +1 -0
- package/dist/server-core/src/api/index.d.ts +10 -0
- package/dist/server-core/src/api/index.d.ts.map +1 -0
- package/dist/server-core/src/api/openapi-generator.d.ts +17 -0
- package/dist/server-core/src/api/openapi-generator.d.ts.map +1 -0
- package/dist/server-core/src/api/rest/api-generator.d.ts +65 -0
- package/dist/server-core/src/api/rest/api-generator.d.ts.map +1 -0
- package/dist/server-core/src/api/rest/index.d.ts +2 -0
- package/dist/server-core/src/api/rest/index.d.ts.map +1 -0
- package/dist/server-core/src/api/rest/query-parser.d.ts +10 -0
- package/dist/server-core/src/api/rest/query-parser.d.ts.map +1 -0
- package/dist/server-core/src/api/schema-editor-routes.d.ts +4 -0
- package/dist/server-core/src/api/schema-editor-routes.d.ts.map +1 -0
- package/dist/server-core/src/api/server.d.ts +41 -0
- package/dist/server-core/src/api/server.d.ts.map +1 -0
- package/dist/server-core/src/api/types.d.ts +91 -0
- package/dist/server-core/src/api/types.d.ts.map +1 -0
- package/dist/server-core/src/auth/admin-routes.d.ts +17 -0
- package/dist/server-core/src/auth/admin-routes.d.ts.map +1 -0
- package/dist/server-core/src/auth/apple-oauth.d.ts +31 -0
- package/dist/server-core/src/auth/apple-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/bitbucket-oauth.d.ts +12 -0
- package/dist/server-core/src/auth/bitbucket-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/discord-oauth.d.ts +15 -0
- package/dist/server-core/src/auth/discord-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/facebook-oauth.d.ts +15 -0
- package/dist/server-core/src/auth/facebook-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/github-oauth.d.ts +16 -0
- package/dist/server-core/src/auth/github-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/gitlab-oauth.d.ts +14 -0
- package/dist/server-core/src/auth/gitlab-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/google-oauth.d.ts +15 -0
- package/dist/server-core/src/auth/google-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/index.d.ts +24 -0
- package/dist/server-core/src/auth/index.d.ts.map +1 -0
- package/dist/server-core/src/auth/interfaces.d.ts +310 -0
- package/dist/server-core/src/auth/interfaces.d.ts.map +1 -0
- package/dist/server-core/src/auth/jwt.d.ts +44 -0
- package/dist/server-core/src/auth/jwt.d.ts.map +1 -0
- package/dist/server-core/src/auth/linkedin-oauth.d.ts +19 -0
- package/dist/server-core/src/auth/linkedin-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/microsoft-oauth.d.ts +17 -0
- package/dist/server-core/src/auth/microsoft-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/middleware.d.ts +82 -0
- package/dist/server-core/src/auth/middleware.d.ts.map +1 -0
- package/dist/server-core/src/auth/password.d.ts +23 -0
- package/dist/server-core/src/auth/password.d.ts.map +1 -0
- package/dist/server-core/src/auth/rate-limiter.d.ts +32 -0
- package/dist/server-core/src/auth/rate-limiter.d.ts.map +1 -0
- package/dist/server-core/src/auth/routes.d.ts +28 -0
- package/dist/server-core/src/auth/routes.d.ts.map +1 -0
- package/dist/server-core/src/auth/slack-oauth.d.ts +13 -0
- package/dist/server-core/src/auth/slack-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/spotify-oauth.d.ts +13 -0
- package/dist/server-core/src/auth/spotify-oauth.d.ts.map +1 -0
- package/dist/server-core/src/auth/twitter-oauth.d.ts +19 -0
- package/dist/server-core/src/auth/twitter-oauth.d.ts.map +1 -0
- package/dist/server-core/src/collections/BackendCollectionRegistry.d.ts +14 -0
- package/dist/server-core/src/collections/BackendCollectionRegistry.d.ts.map +1 -0
- package/dist/server-core/src/collections/loader.d.ts +6 -0
- package/dist/server-core/src/collections/loader.d.ts.map +1 -0
- package/dist/server-core/src/cron/cron-loader.d.ts +18 -0
- package/dist/server-core/src/cron/cron-loader.d.ts.map +1 -0
- package/dist/server-core/src/cron/cron-routes.d.ts +15 -0
- package/dist/server-core/src/cron/cron-routes.d.ts.map +1 -0
- package/dist/server-core/src/cron/cron-scheduler.d.ts +62 -0
- package/dist/server-core/src/cron/cron-scheduler.d.ts.map +1 -0
- package/dist/server-core/src/cron/cron-store.d.ts +33 -0
- package/dist/server-core/src/cron/cron-store.d.ts.map +1 -0
- package/dist/server-core/src/cron/index.d.ts +7 -0
- package/dist/server-core/src/cron/index.d.ts.map +1 -0
- package/dist/server-core/src/db/interfaces.d.ts +19 -0
- package/dist/server-core/src/db/interfaces.d.ts.map +1 -0
- package/dist/server-core/src/email/index.d.ts +7 -0
- package/dist/server-core/src/email/index.d.ts.map +1 -0
- package/dist/server-core/src/email/smtp-email-service.d.ts +26 -0
- package/dist/server-core/src/email/smtp-email-service.d.ts.map +1 -0
- package/dist/server-core/src/email/templates.d.ts +43 -0
- package/dist/server-core/src/email/templates.d.ts.map +1 -0
- package/dist/server-core/src/email/types.d.ts +108 -0
- package/dist/server-core/src/email/types.d.ts.map +1 -0
- package/dist/server-core/src/functions/function-loader.d.ts +18 -0
- package/dist/server-core/src/functions/function-loader.d.ts.map +1 -0
- package/dist/server-core/src/functions/function-routes.d.ts +11 -0
- package/dist/server-core/src/functions/function-routes.d.ts.map +1 -0
- package/dist/server-core/src/functions/index.d.ts +4 -0
- package/dist/server-core/src/functions/index.d.ts.map +1 -0
- package/dist/server-core/src/history/history-routes.d.ts +24 -0
- package/dist/server-core/src/history/history-routes.d.ts.map +1 -0
- package/dist/server-core/src/history/index.d.ts +2 -0
- package/dist/server-core/src/history/index.d.ts.map +1 -0
- package/dist/server-core/src/index.d.ts +30 -0
- package/dist/server-core/src/index.d.ts.map +1 -0
- package/dist/server-core/src/init.d.ts +160 -0
- package/dist/server-core/src/init.d.ts.map +1 -0
- package/dist/server-core/src/serve-spa.d.ts +31 -0
- package/dist/server-core/src/serve-spa.d.ts.map +1 -0
- package/dist/server-core/src/services/driver-registry.d.ts +79 -0
- package/dist/server-core/src/services/driver-registry.d.ts.map +1 -0
- package/dist/server-core/src/singleton.d.ts +36 -0
- package/dist/server-core/src/singleton.d.ts.map +1 -0
- package/dist/server-core/src/storage/LocalStorageController.d.ts +47 -0
- package/dist/server-core/src/storage/LocalStorageController.d.ts.map +1 -0
- package/dist/server-core/src/storage/S3StorageController.d.ts +37 -0
- package/dist/server-core/src/storage/S3StorageController.d.ts.map +1 -0
- package/dist/server-core/src/storage/index.d.ts +26 -0
- package/dist/server-core/src/storage/index.d.ts.map +1 -0
- package/dist/server-core/src/storage/routes.d.ts +39 -0
- package/dist/server-core/src/storage/routes.d.ts.map +1 -0
- package/dist/server-core/src/storage/storage-registry.d.ts +79 -0
- package/dist/server-core/src/storage/storage-registry.d.ts.map +1 -0
- package/dist/server-core/src/storage/types.d.ts +104 -0
- package/dist/server-core/src/storage/types.d.ts.map +1 -0
- package/dist/server-core/src/types/index.d.ts +12 -0
- package/dist/server-core/src/types/index.d.ts.map +1 -0
- package/dist/server-core/src/utils/dev-port.d.ts +36 -0
- package/dist/server-core/src/utils/dev-port.d.ts.map +1 -0
- package/dist/server-core/src/utils/logger.d.ts +32 -0
- package/dist/server-core/src/utils/logger.d.ts.map +1 -0
- package/dist/server-core/src/utils/logging.d.ts +10 -0
- package/dist/server-core/src/utils/logging.d.ts.map +1 -0
- package/dist/server-core/src/utils/request-logger.d.ts +20 -0
- package/dist/server-core/src/utils/request-logger.d.ts.map +1 -0
- package/dist/server-core/src/utils/sql.d.ts +28 -0
- package/dist/server-core/src/utils/sql.d.ts.map +1 -0
- package/dist/server-mongodb/src/MongoBootstrapper.d.ts +18 -0
- package/dist/server-mongodb/src/MongoBootstrapper.d.ts.map +1 -0
- package/dist/server-mongodb/src/auth/ensure-collections.d.ts +3 -0
- package/dist/server-mongodb/src/auth/ensure-collections.d.ts.map +1 -0
- package/dist/server-mongodb/src/auth/services.d.ts +135 -0
- package/dist/server-mongodb/src/auth/services.d.ts.map +1 -0
- package/dist/server-mongodb/src/connection.d.ts +35 -0
- package/dist/server-mongodb/src/connection.d.ts.map +1 -0
- package/dist/server-mongodb/src/db/MongoConditionBuilder.d.ts +64 -0
- package/dist/server-mongodb/src/db/MongoConditionBuilder.d.ts.map +1 -0
- package/dist/server-mongodb/src/db/MongoEntityService.d.ts +98 -0
- package/dist/server-mongodb/src/db/MongoEntityService.d.ts.map +1 -0
- package/dist/server-mongodb/src/factory.d.ts +142 -0
- package/dist/server-mongodb/src/factory.d.ts.map +1 -0
- package/dist/server-mongodb/src/history/ensure-history-collection.d.ts +3 -0
- package/dist/server-mongodb/src/history/ensure-history-collection.d.ts.map +1 -0
- package/dist/server-mongodb/src/index.d.ts +18 -0
- package/dist/server-mongodb/src/index.d.ts.map +1 -0
- package/dist/server-mongodb/src/services/MongoDriver.d.ts +83 -0
- package/dist/server-mongodb/src/services/MongoDriver.d.ts.map +1 -0
- package/dist/server-mongodb/src/services/MongoHistoryService.d.ts +37 -0
- package/dist/server-mongodb/src/services/MongoHistoryService.d.ts.map +1 -0
- package/dist/server-mongodb/src/services/MongoRealtimeService.d.ts +86 -0
- package/dist/server-mongodb/src/services/MongoRealtimeService.d.ts.map +1 -0
- package/dist/server-mongodb/src/useMongoDriver.d.ts +18 -0
- package/dist/server-mongodb/src/useMongoDriver.d.ts.map +1 -0
- package/dist/server-mongodb/src/utils.d.ts +10 -0
- package/dist/server-mongodb/src/utils.d.ts.map +1 -0
- package/dist/server-mongodb/src/websocket.d.ts +7 -0
- package/dist/server-mongodb/src/websocket.d.ts.map +1 -0
- package/dist/types/src/controllers/analytics_controller.d.ts +8 -0
- package/dist/types/src/controllers/analytics_controller.d.ts.map +1 -0
- package/dist/types/src/controllers/auth.d.ts +120 -0
- package/dist/types/src/controllers/auth.d.ts.map +1 -0
- package/dist/types/src/controllers/client.d.ts +171 -0
- package/dist/types/src/controllers/client.d.ts.map +1 -0
- package/dist/types/src/controllers/collection_registry.d.ts +46 -0
- package/dist/types/src/controllers/collection_registry.d.ts.map +1 -0
- package/dist/types/src/controllers/customization_controller.d.ts +61 -0
- package/dist/types/src/controllers/customization_controller.d.ts.map +1 -0
- package/dist/types/src/controllers/data.d.ts +169 -0
- package/dist/types/src/controllers/data.d.ts.map +1 -0
- package/dist/types/src/controllers/data_driver.d.ts +161 -0
- package/dist/types/src/controllers/data_driver.d.ts.map +1 -0
- package/dist/types/src/controllers/database_admin.d.ts +12 -0
- package/dist/types/src/controllers/database_admin.d.ts.map +1 -0
- package/dist/types/src/controllers/dialogs_controller.d.ts +37 -0
- package/dist/types/src/controllers/dialogs_controller.d.ts.map +1 -0
- package/dist/types/src/controllers/effective_role.d.ts +5 -0
- package/dist/types/src/controllers/effective_role.d.ts.map +1 -0
- package/dist/types/src/controllers/email.d.ts +35 -0
- package/dist/types/src/controllers/email.d.ts.map +1 -0
- package/dist/types/src/controllers/index.d.ts +19 -0
- package/dist/types/src/controllers/index.d.ts.map +1 -0
- package/dist/types/src/controllers/local_config_persistence.d.ts +21 -0
- package/dist/types/src/controllers/local_config_persistence.d.ts.map +1 -0
- package/dist/types/src/controllers/navigation.d.ts +214 -0
- package/dist/types/src/controllers/navigation.d.ts.map +1 -0
- package/dist/types/src/controllers/registry.d.ts +55 -0
- package/dist/types/src/controllers/registry.d.ts.map +1 -0
- package/dist/types/src/controllers/side_dialogs_controller.d.ts +68 -0
- package/dist/types/src/controllers/side_dialogs_controller.d.ts.map +1 -0
- package/dist/types/src/controllers/side_entity_controller.d.ts +91 -0
- package/dist/types/src/controllers/side_entity_controller.d.ts.map +1 -0
- package/dist/types/src/controllers/snackbar.d.ts +25 -0
- package/dist/types/src/controllers/snackbar.d.ts.map +1 -0
- package/dist/types/src/controllers/storage.d.ts +172 -0
- package/dist/types/src/controllers/storage.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/rebase_context.d.ts +106 -0
- package/dist/types/src/rebase_context.d.ts.map +1 -0
- package/dist/types/src/types/backend.d.ts +537 -0
- package/dist/types/src/types/backend.d.ts.map +1 -0
- package/dist/types/src/types/builders.d.ts +16 -0
- package/dist/types/src/types/builders.d.ts.map +1 -0
- package/dist/types/src/types/chips.d.ts +6 -0
- package/dist/types/src/types/chips.d.ts.map +1 -0
- package/dist/types/src/types/collections.d.ts +857 -0
- package/dist/types/src/types/collections.d.ts.map +1 -0
- package/dist/types/src/types/cron.d.ts +103 -0
- package/dist/types/src/types/cron.d.ts.map +1 -0
- package/dist/types/src/types/data_source.d.ts +65 -0
- package/dist/types/src/types/data_source.d.ts.map +1 -0
- package/dist/types/src/types/entities.d.ts +146 -0
- package/dist/types/src/types/entities.d.ts.map +1 -0
- package/dist/types/src/types/entity_actions.d.ts +99 -0
- package/dist/types/src/types/entity_actions.d.ts.map +1 -0
- package/dist/types/src/types/entity_callbacks.d.ts +174 -0
- package/dist/types/src/types/entity_callbacks.d.ts.map +1 -0
- package/dist/types/src/types/entity_link_builder.d.ts +8 -0
- package/dist/types/src/types/entity_link_builder.d.ts.map +1 -0
- package/dist/types/src/types/entity_overrides.d.ts +11 -0
- package/dist/types/src/types/entity_overrides.d.ts.map +1 -0
- package/dist/types/src/types/entity_views.d.ts +62 -0
- package/dist/types/src/types/entity_views.d.ts.map +1 -0
- package/dist/types/src/types/export_import.d.ts +22 -0
- package/dist/types/src/types/export_import.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +24 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/locales.d.ts +5 -0
- package/dist/types/src/types/locales.d.ts.map +1 -0
- package/dist/types/src/types/modify_collections.d.ts +6 -0
- package/dist/types/src/types/modify_collections.d.ts.map +1 -0
- package/dist/types/src/types/plugins.d.ts +280 -0
- package/dist/types/src/types/plugins.d.ts.map +1 -0
- package/dist/types/src/types/properties.d.ts +1177 -0
- package/dist/types/src/types/properties.d.ts.map +1 -0
- package/dist/types/src/types/property_config.d.ts +71 -0
- package/dist/types/src/types/property_config.d.ts.map +1 -0
- package/dist/types/src/types/relations.d.ts +337 -0
- package/dist/types/src/types/relations.d.ts.map +1 -0
- package/dist/types/src/types/slots.d.ts +253 -0
- package/dist/types/src/types/slots.d.ts.map +1 -0
- package/dist/types/src/types/translations.d.ts +871 -0
- package/dist/types/src/types/translations.d.ts.map +1 -0
- package/dist/types/src/types/user_management_delegate.d.ts +122 -0
- package/dist/types/src/types/user_management_delegate.d.ts.map +1 -0
- package/dist/types/src/types/websockets.d.ts +79 -0
- package/dist/types/src/types/websockets.d.ts.map +1 -0
- package/dist/types/src/users/index.d.ts +3 -0
- package/dist/types/src/users/index.d.ts.map +1 -0
- package/dist/types/src/users/roles.d.ts +23 -0
- package/dist/types/src/users/roles.d.ts.map +1 -0
- package/dist/types/src/users/user.d.ts +47 -0
- package/dist/types/src/users/user.d.ts.map +1 -0
- package/dist/websocket-BZlPuJrt.js +220 -0
- package/dist/websocket-BZlPuJrt.js.map +1 -0
- package/package.json +79 -0
- package/src/MongoBootstrapper.ts +177 -0
- package/src/auth/ensure-collections.ts +94 -0
- package/src/auth/services.ts +638 -0
- package/src/connection.ts +60 -0
- package/src/db/MongoConditionBuilder.ts +181 -0
- package/src/db/MongoEntityService.ts +350 -0
- package/src/factory.ts +289 -0
- package/src/history/ensure-history-collection.ts +19 -0
- package/src/index.ts +25 -0
- package/src/services/MongoDriver.ts +297 -0
- package/src/services/MongoDriver.ts.backup +266 -0
- package/src/services/MongoHistoryService.ts +154 -0
- package/src/services/MongoRealtimeService.ts +394 -0
- package/src/useMongoDriver.ts +519 -0
- package/src/utils.ts +28 -0
- package/src/websocket.ts +257 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Db, ObjectId } from "mongodb";
|
|
2
|
+
/**
|
|
3
|
+
* Shallow comparison to find top-level keys that changed between two objects.
|
|
4
|
+
*/
|
|
5
|
+
export declare function findChangedFields(oldValues: Record<string, unknown>, newValues: Record<string, unknown>): string[] | null;
|
|
6
|
+
export interface HistoryEntry {
|
|
7
|
+
_id?: ObjectId;
|
|
8
|
+
id: string;
|
|
9
|
+
table_name: string;
|
|
10
|
+
entity_id: string;
|
|
11
|
+
action: "create" | "update" | "delete";
|
|
12
|
+
changed_fields: string[] | null;
|
|
13
|
+
values: Record<string, unknown> | null;
|
|
14
|
+
previous_values: Record<string, unknown> | null;
|
|
15
|
+
updated_by: string | null;
|
|
16
|
+
updated_at: Date;
|
|
17
|
+
}
|
|
18
|
+
export interface RecordHistoryParams {
|
|
19
|
+
tableName: string;
|
|
20
|
+
entityId: string;
|
|
21
|
+
action: "create" | "update" | "delete";
|
|
22
|
+
values?: Record<string, unknown> | null;
|
|
23
|
+
previousValues?: Record<string, unknown> | null;
|
|
24
|
+
updatedBy?: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface HistoryRetentionConfig {
|
|
27
|
+
maxEntries: number;
|
|
28
|
+
ttlDays: number;
|
|
29
|
+
}
|
|
30
|
+
export declare class MongoHistoryService {
|
|
31
|
+
private db;
|
|
32
|
+
retention: HistoryRetentionConfig;
|
|
33
|
+
constructor(db: Db, retention?: Partial<HistoryRetentionConfig>);
|
|
34
|
+
recordHistory(params: RecordHistoryParams): Promise<void>;
|
|
35
|
+
private pruneHistory;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=MongoHistoryService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoHistoryService.d.ts","sourceRoot":"","sources":["../../../../src/services/MongoHistoryService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvC;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,MAAM,EAAE,GAAG,IAAI,CA8BjB;AAED,MAAM,WAAW,YAAY;IACzB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvC,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB;AAOD,qBAAa,mBAAmB;IAIxB,OAAO,CAAC,EAAE;IAHP,SAAS,EAAE,sBAAsB,CAAC;gBAG7B,EAAE,EAAE,EAAE,EACd,SAAS,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAKzC,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YA0CjD,YAAY;CA6B7B"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MongoDB Realtime Service
|
|
3
|
+
*
|
|
4
|
+
* Implements RealtimeProvider interface using MongoDB Change Streams.
|
|
5
|
+
* Provides real-time subscriptions to collection and entity changes.
|
|
6
|
+
*/
|
|
7
|
+
import { Db, ChangeStream } from "mongodb";
|
|
8
|
+
import { Entity, RealtimeProvider, CollectionSubscriptionConfig, EntitySubscriptionConfig } from "@rebasepro/types";
|
|
9
|
+
import { WebSocket } from "ws";
|
|
10
|
+
interface Subscription {
|
|
11
|
+
type: "collection" | "entity";
|
|
12
|
+
config: CollectionSubscriptionConfig | EntitySubscriptionConfig;
|
|
13
|
+
changeStream?: ChangeStream;
|
|
14
|
+
callback?: (data: any) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* MongoDB Realtime Service
|
|
18
|
+
*
|
|
19
|
+
* Implements real-time subscriptions using MongoDB Change Streams.
|
|
20
|
+
* Requires MongoDB replica set for change streams to work.
|
|
21
|
+
*/
|
|
22
|
+
export declare class MongoRealtimeService implements RealtimeProvider {
|
|
23
|
+
private db;
|
|
24
|
+
private subscriptions;
|
|
25
|
+
private clients;
|
|
26
|
+
private entityService;
|
|
27
|
+
constructor(db: Db);
|
|
28
|
+
/**
|
|
29
|
+
* Get the collection name from a path
|
|
30
|
+
*/
|
|
31
|
+
private getCollectionName;
|
|
32
|
+
/**
|
|
33
|
+
* Subscribe to collection changes
|
|
34
|
+
*/
|
|
35
|
+
subscribeToCollection(subscriptionId: string, config: CollectionSubscriptionConfig, callback?: (entities: Entity[]) => void): void;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch collection and notify callback
|
|
38
|
+
*/
|
|
39
|
+
private fetchAndNotifyCollection;
|
|
40
|
+
/**
|
|
41
|
+
* Subscribe to single entity changes
|
|
42
|
+
*/
|
|
43
|
+
subscribeToEntity(subscriptionId: string, config: EntitySubscriptionConfig, callback?: (entity: Entity | null) => void): void;
|
|
44
|
+
/**
|
|
45
|
+
* Fetch entity and notify callback
|
|
46
|
+
*/
|
|
47
|
+
private fetchAndNotifyEntity;
|
|
48
|
+
/**
|
|
49
|
+
* Unsubscribe from a subscription
|
|
50
|
+
*/
|
|
51
|
+
unsubscribe(subscriptionId: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Notify all relevant subscribers of an entity update
|
|
54
|
+
* This is called after save/delete operations to push updates
|
|
55
|
+
*/
|
|
56
|
+
notifyEntityUpdate(path: string, entityId: string, entity: Entity | null, _databaseId?: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Get all active subscriptions (for debugging)
|
|
59
|
+
*/
|
|
60
|
+
getSubscriptions(): Map<string, Subscription>;
|
|
61
|
+
/**
|
|
62
|
+
* Close all subscriptions
|
|
63
|
+
*/
|
|
64
|
+
closeAll(): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Register a WebSocket client for real-time communication
|
|
67
|
+
*/
|
|
68
|
+
addClient(clientId: string, ws: WebSocket): void;
|
|
69
|
+
/**
|
|
70
|
+
* Remove a WebSocket client and clean up its subscriptions
|
|
71
|
+
*/
|
|
72
|
+
private removeClient;
|
|
73
|
+
/**
|
|
74
|
+
* Handle an incoming WebSocket message for subscription management
|
|
75
|
+
*/
|
|
76
|
+
handleClientMessage(clientId: string, message: {
|
|
77
|
+
type: string;
|
|
78
|
+
payload?: any;
|
|
79
|
+
subscriptionId?: string;
|
|
80
|
+
}, _authContext?: {
|
|
81
|
+
userId: string;
|
|
82
|
+
roles: unknown[];
|
|
83
|
+
}): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=MongoRealtimeService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoRealtimeService.d.ts","sourceRoot":"","sources":["../../../../src/services/MongoRealtimeService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,EAAE,EAAE,YAAY,EAA4C,MAAM,SAAS,CAAC;AACrF,OAAO,EACH,MAAM,EAEN,gBAAgB,EAChB,4BAA4B,EAC5B,wBAAwB,EAE3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAG/B,UAAU,YAAY;IAClB,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC;IAC9B,MAAM,EAAE,4BAA4B,GAAG,wBAAwB,CAAC;IAChE,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAClC;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAK7C,OAAO,CAAC,EAAE;IAJtB,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,aAAa,CAAqB;gBAEtB,EAAE,EAAE,EAAE;IAI1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACH,qBAAqB,CACjB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,4BAA4B,EACpC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,GACxC,IAAI;IAgEP;;OAEG;YACW,wBAAwB;IAuBtC;;OAEG;IACH,iBAAiB,CACb,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,wBAAwB,EAChC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAC3C,IAAI;IAqEP;;OAEG;YACW,oBAAoB;IAgBlC;;OAEG;IACH,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI;IAUzC;;;OAGG;IACG,kBAAkB,CACpB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,WAAW,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;IAoBhB;;OAEG;IACH,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC;IAI7C;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAU/B;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS;IAazC;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACG,mBAAmB,CACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EACjE,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,EAAE,CAAA;KAAE,GACpD,OAAO,CAAC,IAAI,CAAC;CA6DnB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { App } from "realm-web";
|
|
2
|
+
import { DataDriver, PropertyConfig } from "@rebasepro/types";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export interface UseMongoDriverProps {
|
|
7
|
+
app: App;
|
|
8
|
+
cluster: string;
|
|
9
|
+
database: string;
|
|
10
|
+
propertyConfigs?: Record<string, PropertyConfig>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Use this hook to build a {@link DataDriver} based on Firestore
|
|
14
|
+
* @param firebaseApp
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
export declare function useMongoDriver({ app, cluster, database }: UseMongoDriverProps): DataDriver;
|
|
18
|
+
//# sourceMappingURL=useMongoDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMongoDriver.d.ts","sourceRoot":"","sources":["../../../src/useMongoDriver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAA8K,cAAc,EAAkC,MAAM,kBAAkB,CAAC;AAK1Q;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACpD;AAgBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC3B,GAAG,EACH,OAAO,EACP,QAAQ,EACX,EAAE,mBAAmB,GAAG,UAAU,CA4ZlC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function getEntityIndex(entities: {
|
|
2
|
+
id: string | number;
|
|
3
|
+
}[], entity: {
|
|
4
|
+
id: string | number;
|
|
5
|
+
}): number | null;
|
|
6
|
+
export declare function removeValueAtIndex<T>(arr: T[], index: number): T[];
|
|
7
|
+
export declare function addValueAtIndex<T>(arr: T[], index: number, value: T): T[];
|
|
8
|
+
export declare function replaceValueAtIndex<T>(arr: T[], index: number, value: T): T[];
|
|
9
|
+
export declare function updateValueAtIndex<T>(arr: T[], index: number, updater: (val: T) => T): T[];
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAAE,EAAE,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAGlH;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAIlE;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,CAIzE;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,CAI7E;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAI1F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DatabaseAdmin } from "@rebasepro/types";
|
|
2
|
+
import { Server } from "http";
|
|
3
|
+
import { AuthConfig } from "@rebasepro/server-core";
|
|
4
|
+
import { MongoRealtimeService } from "./services/MongoRealtimeService";
|
|
5
|
+
import { MongoDriver } from "./services/MongoDriver";
|
|
6
|
+
export declare function createMongoWebSocket(server: Server, realtimeService: MongoRealtimeService, driver: MongoDriver, authConfig?: AuthConfig, admin?: DatabaseAdmin): void;
|
|
7
|
+
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2H,aAAa,EAAkC,MAAM,kBAAkB,CAAC;AAE1M,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,OAAO,EAA4C,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA4CrD,wBAAgB,oBAAoB,CAChC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,oBAAoB,EACrC,MAAM,EAAE,WAAW,EACnB,UAAU,CAAC,EAAE,UAAU,EACvB,KAAK,CAAC,EAAE,aAAa,QAwMxB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type AnalyticsController = {
|
|
2
|
+
/**
|
|
3
|
+
* Callback used to get analytics events from the CMS
|
|
4
|
+
*/
|
|
5
|
+
onAnalyticsEvent?: (event: AnalyticsEvent, data?: object) => void;
|
|
6
|
+
};
|
|
7
|
+
export type AnalyticsEvent = "entity_click" | "entity_click_from_reference" | "reference_selection_clear" | "reference_selection_toggle" | "reference_selected_single" | "reference_selection_new_entity" | "edit_entity_clicked" | "entity_edited" | "new_entity_click" | "new_entity_saved" | "copy_entity_click" | "entity_copied" | "single_delete_dialog_open" | "multiple_delete_dialog_open" | "single_entity_deleted" | "multiple_entities_deleted" | "drawer_navigate_to_home" | "drawer_navigate_to_collection" | "drawer_navigate_to_view" | "home_navigate_to_collection" | "home_favorite_navigate_to_collection" | "home_navigate_to_view" | "home_navigate_to_admin_view" | "home_favorite_navigate_to_view" | "home_move_card" | "home_move_group" | "home_drop_new_group" | "collection_inline_editing" | "view_mode_changed" | "kanban_card_moved" | "kanban_column_reorder" | "kanban_property_changed" | "kanban_new_entity_in_column" | "kanban_backfill_order" | "card_view_entity_click" | "unmapped_event";
|
|
8
|
+
//# sourceMappingURL=analytics_controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics_controller.d.ts","sourceRoot":"","sources":["../../../../../types/src/controllers/analytics_controller.tsx"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAE9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAErE,CAAA;AAED,MAAM,MAAM,cAAc,GACpB,cAAc,GACd,6BAA6B,GAE7B,2BAA2B,GAC3B,4BAA4B,GAC5B,2BAA2B,GAC3B,gCAAgC,GAEhC,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GAEf,2BAA2B,GAC3B,6BAA6B,GAC7B,uBAAuB,GACvB,2BAA2B,GAE3B,yBAAyB,GACzB,+BAA+B,GAC/B,yBAAyB,GAEzB,6BAA6B,GAC7B,sCAAsC,GACtC,uBAAuB,GACvB,6BAA6B,GAC7B,gCAAgC,GAChC,gBAAgB,GAChB,iBAAiB,GACjB,qBAAqB,GAErB,2BAA2B,GAE3B,mBAAmB,GAEnB,mBAAmB,GACnB,uBAAuB,GACvB,yBAAyB,GACzB,6BAA6B,GAC7B,uBAAuB,GAEvB,wBAAwB,GAExB,gBAAgB,CACjB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { StorageSource } from "./storage";
|
|
2
|
+
import { Role, User } from "../users";
|
|
3
|
+
import { RebaseData } from "./data";
|
|
4
|
+
/**
|
|
5
|
+
* Capabilities advertised by an auth provider.
|
|
6
|
+
* UI components use this to show/hide features dynamically
|
|
7
|
+
* (e.g. password reset, registration, session management).
|
|
8
|
+
* @group Hooks and utilities
|
|
9
|
+
*/
|
|
10
|
+
export interface AuthCapabilities {
|
|
11
|
+
emailPasswordLogin?: boolean;
|
|
12
|
+
googleLogin?: boolean;
|
|
13
|
+
registration?: boolean;
|
|
14
|
+
passwordReset?: boolean;
|
|
15
|
+
sessionManagement?: boolean;
|
|
16
|
+
profileUpdate?: boolean;
|
|
17
|
+
emailVerification?: boolean;
|
|
18
|
+
/** List of enabled OAuth provider IDs (e.g. ["google", "github", "discord"]) */
|
|
19
|
+
enabledProviders?: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Controller for retrieving the logged user or performing auth related operations.
|
|
23
|
+
* Note that if you are implementing your AuthController, you probably will want
|
|
24
|
+
* to do it as the result of a hook.
|
|
25
|
+
* @group Hooks and utilities
|
|
26
|
+
*/
|
|
27
|
+
export type AuthController<USER extends User = User, ExtraData = unknown> = {
|
|
28
|
+
/**
|
|
29
|
+
* The user currently logged in
|
|
30
|
+
* The values can be: the user object, null if they skipped login
|
|
31
|
+
*/
|
|
32
|
+
user: USER | null;
|
|
33
|
+
/**
|
|
34
|
+
* Initial loading flag. It is used not to display the login screen
|
|
35
|
+
* when the app first loads, and it has not been checked whether the user
|
|
36
|
+
* is logged in or not.
|
|
37
|
+
*/
|
|
38
|
+
initialLoading?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Loading flag. It is used to display a loading screen when the user is
|
|
41
|
+
* logging in or out.
|
|
42
|
+
*/
|
|
43
|
+
authLoading: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Sign out
|
|
46
|
+
*/
|
|
47
|
+
signOut: () => Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Error initializing the authentication
|
|
50
|
+
*/
|
|
51
|
+
authError?: unknown;
|
|
52
|
+
/**
|
|
53
|
+
* Error dispatched by the auth provider
|
|
54
|
+
*/
|
|
55
|
+
authProviderError?: unknown;
|
|
56
|
+
/**
|
|
57
|
+
* You can use this method to retrieve the auth token for the current user.
|
|
58
|
+
*/
|
|
59
|
+
getAuthToken: () => Promise<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Has the user skipped the login process
|
|
62
|
+
*/
|
|
63
|
+
loginSkipped: boolean;
|
|
64
|
+
extra: ExtraData;
|
|
65
|
+
setExtra: (extra: ExtraData) => void;
|
|
66
|
+
setUser?(user: USER | null): void;
|
|
67
|
+
setUserRoles?(roles: Role[]): void;
|
|
68
|
+
/**
|
|
69
|
+
* Capabilities advertised by the auth provider.
|
|
70
|
+
* UI components use this to feature-detect what the backend supports.
|
|
71
|
+
*/
|
|
72
|
+
capabilities?: AuthCapabilities;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Extended auth controller with common optional auth methods.
|
|
76
|
+
* Backend implementations (Rebase backend, Firebase, Supabase, etc.)
|
|
77
|
+
* extend this with their own backend-specific extras.
|
|
78
|
+
* @group Hooks and utilities
|
|
79
|
+
*/
|
|
80
|
+
export interface AuthControllerExtended<USER extends User = User, ExtraData = unknown> extends AuthController<USER, ExtraData> {
|
|
81
|
+
/** Login with email and password */
|
|
82
|
+
emailPasswordLogin?(email: string, password: string): Promise<void>;
|
|
83
|
+
/** Login with a Google ID token or trigger Google popup */
|
|
84
|
+
googleLogin?(idToken: string): Promise<void>;
|
|
85
|
+
/** Register a new user */
|
|
86
|
+
register?(email: string, password: string, displayName?: string): Promise<void>;
|
|
87
|
+
/** Skip login (for anonymous access if enabled) */
|
|
88
|
+
skipLogin?(): void;
|
|
89
|
+
/** Request password reset email */
|
|
90
|
+
forgotPassword?(email: string): Promise<void>;
|
|
91
|
+
/** Reset password using a token */
|
|
92
|
+
resetPassword?(token: string, password: string): Promise<void>;
|
|
93
|
+
/** Change password for the authenticated user */
|
|
94
|
+
changePassword?(oldPassword: string, newPassword: string): Promise<void>;
|
|
95
|
+
/** Update user profile */
|
|
96
|
+
updateProfile?(displayName?: string, photoURL?: string): Promise<USER>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Implement this function to allow access to specific users.
|
|
100
|
+
* @group Hooks and utilities
|
|
101
|
+
*/
|
|
102
|
+
export type Authenticator<USER extends User = User> = (props: {
|
|
103
|
+
/**
|
|
104
|
+
* Logged-in user or null
|
|
105
|
+
*/
|
|
106
|
+
user: USER | null;
|
|
107
|
+
/**
|
|
108
|
+
* AuthController
|
|
109
|
+
*/
|
|
110
|
+
authController: AuthController<USER>;
|
|
111
|
+
/**
|
|
112
|
+
* Unified data access API
|
|
113
|
+
*/
|
|
114
|
+
data: RebaseData;
|
|
115
|
+
/**
|
|
116
|
+
* Used storage implementation
|
|
117
|
+
*/
|
|
118
|
+
storageSource: StorageSource;
|
|
119
|
+
}) => boolean | Promise<boolean>;
|
|
120
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../types/src/controllers/auth.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,IAAI,GAAG,IAAI,EAAE,SAAS,GAAG,OAAO,IAAI;IAExE;;;OAGG;IACH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAElB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CA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,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,mCAAmC;IACnC,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,iDAAiD;IACjD,cAAc,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,0BAA0B;IAC1B,aAAa,CAAC,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,CAAC,IAAI,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE;IAE1D;;OAEG;IACH,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAElB;;OAEG;IACH,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IAErC;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAE,aAAa,CAAC;CAEhC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { User } from "../users";
|
|
2
|
+
import { RebaseData } from "./data";
|
|
3
|
+
import { EmailService } from "./email";
|
|
4
|
+
/**
|
|
5
|
+
* Event type for authentication state changes
|
|
6
|
+
*/
|
|
7
|
+
export type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
|
|
8
|
+
/**
|
|
9
|
+
* Standard session interface representing an authenticated state
|
|
10
|
+
*/
|
|
11
|
+
export interface RebaseSession {
|
|
12
|
+
accessToken: string;
|
|
13
|
+
refreshToken: string;
|
|
14
|
+
expiresAt: number;
|
|
15
|
+
user: User;
|
|
16
|
+
}
|
|
17
|
+
import { StorageSource } from "./storage";
|
|
18
|
+
/**
|
|
19
|
+
* Unified Authentication Client Interface
|
|
20
|
+
* Pure functional SDK interface, decoupled from UI and React hooks
|
|
21
|
+
*/
|
|
22
|
+
export interface AuthClient {
|
|
23
|
+
/**
|
|
24
|
+
* Get the current user from the server or cache
|
|
25
|
+
*/
|
|
26
|
+
getUser(): Promise<User | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the currently active session
|
|
29
|
+
*/
|
|
30
|
+
getSession(): RebaseSession | null;
|
|
31
|
+
/**
|
|
32
|
+
* Sign out the current user and clear local session
|
|
33
|
+
*/
|
|
34
|
+
signOut(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Subscribe to authentication state changes
|
|
37
|
+
*/
|
|
38
|
+
onAuthStateChange(callback: (event: AuthChangeEvent, session: RebaseSession | null) => void): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Manually refresh the session token
|
|
41
|
+
*/
|
|
42
|
+
refreshSession(): Promise<RebaseSession>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* User record as returned by the Admin API.
|
|
46
|
+
* @group Admin
|
|
47
|
+
*/
|
|
48
|
+
export interface AdminUser {
|
|
49
|
+
uid: string;
|
|
50
|
+
email: string;
|
|
51
|
+
displayName: string | null;
|
|
52
|
+
photoURL: string | null;
|
|
53
|
+
provider: string;
|
|
54
|
+
roles: string[];
|
|
55
|
+
createdAt: string;
|
|
56
|
+
updatedAt: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Role record as returned by the Admin API.
|
|
60
|
+
* @group Admin
|
|
61
|
+
*/
|
|
62
|
+
export interface AdminRole {
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
isAdmin: boolean;
|
|
66
|
+
defaultPermissions: Record<string, unknown> | null;
|
|
67
|
+
config: Record<string, unknown> | null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Client-side Admin API interface.
|
|
71
|
+
* Provides user and role management operations.
|
|
72
|
+
* @group Admin
|
|
73
|
+
*/
|
|
74
|
+
export interface AdminAPI {
|
|
75
|
+
listUsers(): Promise<{
|
|
76
|
+
users: AdminUser[];
|
|
77
|
+
}>;
|
|
78
|
+
listUsersPaginated(options?: {
|
|
79
|
+
search?: string;
|
|
80
|
+
limit?: number;
|
|
81
|
+
offset?: number;
|
|
82
|
+
orderBy?: string;
|
|
83
|
+
orderDir?: "asc" | "desc";
|
|
84
|
+
}): Promise<{
|
|
85
|
+
users: AdminUser[];
|
|
86
|
+
total: number;
|
|
87
|
+
limit: number;
|
|
88
|
+
offset: number;
|
|
89
|
+
}>;
|
|
90
|
+
getUser(userId: string): Promise<{
|
|
91
|
+
user: AdminUser;
|
|
92
|
+
}>;
|
|
93
|
+
createUser(data: {
|
|
94
|
+
email: string;
|
|
95
|
+
displayName?: string;
|
|
96
|
+
password?: string;
|
|
97
|
+
roles?: string[];
|
|
98
|
+
}): Promise<{
|
|
99
|
+
user: AdminUser;
|
|
100
|
+
}>;
|
|
101
|
+
updateUser(userId: string, data: {
|
|
102
|
+
email?: string;
|
|
103
|
+
displayName?: string;
|
|
104
|
+
password?: string;
|
|
105
|
+
roles?: string[];
|
|
106
|
+
}): Promise<{
|
|
107
|
+
user: AdminUser;
|
|
108
|
+
}>;
|
|
109
|
+
deleteUser(userId: string): Promise<{
|
|
110
|
+
success: boolean;
|
|
111
|
+
}>;
|
|
112
|
+
listRoles(): Promise<{
|
|
113
|
+
roles: AdminRole[];
|
|
114
|
+
}>;
|
|
115
|
+
getRole(roleId: string): Promise<{
|
|
116
|
+
role: AdminRole;
|
|
117
|
+
}>;
|
|
118
|
+
createRole(data: {
|
|
119
|
+
id: string;
|
|
120
|
+
name: string;
|
|
121
|
+
isAdmin?: boolean;
|
|
122
|
+
defaultPermissions?: Record<string, unknown>;
|
|
123
|
+
config?: Record<string, unknown>;
|
|
124
|
+
}): Promise<{
|
|
125
|
+
role: AdminRole;
|
|
126
|
+
}>;
|
|
127
|
+
updateRole(roleId: string, data: {
|
|
128
|
+
name?: string;
|
|
129
|
+
isAdmin?: boolean;
|
|
130
|
+
defaultPermissions?: Record<string, unknown>;
|
|
131
|
+
config?: Record<string, unknown>;
|
|
132
|
+
}): Promise<{
|
|
133
|
+
role: AdminRole;
|
|
134
|
+
}>;
|
|
135
|
+
deleteRole(roleId: string): Promise<{
|
|
136
|
+
success: boolean;
|
|
137
|
+
}>;
|
|
138
|
+
bootstrap(): Promise<{
|
|
139
|
+
success: boolean;
|
|
140
|
+
message: string;
|
|
141
|
+
user: {
|
|
142
|
+
uid: string;
|
|
143
|
+
roles: string[];
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Overarching abstraction that unites Data, Auth, Storage, and Email.
|
|
149
|
+
* Adapters for Supabase or Firebase simply need to implement this interface.
|
|
150
|
+
*/
|
|
151
|
+
export interface RebaseClient<DB = unknown> {
|
|
152
|
+
/** Unified Data access layer */
|
|
153
|
+
data: RebaseData;
|
|
154
|
+
/** Unified Authentication layer */
|
|
155
|
+
auth: AuthClient;
|
|
156
|
+
/** Unified Storage layer */
|
|
157
|
+
storage?: StorageSource;
|
|
158
|
+
/**
|
|
159
|
+
* Server-side email service.
|
|
160
|
+
*
|
|
161
|
+
* Available when SMTP (or a custom `sendEmail` function) is configured
|
|
162
|
+
* in the backend auth config. `undefined` when email is not configured.
|
|
163
|
+
*
|
|
164
|
+
* > **Note:** This is only available on the server-side `rebase` singleton.
|
|
165
|
+
* > The client-side SDK does not include an email service.
|
|
166
|
+
*/
|
|
167
|
+
email?: EmailService;
|
|
168
|
+
/** Admin API for user and role management */
|
|
169
|
+
admin?: AdminAPI;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../types/src/controllers/client.ts"],"names":[],"mappings":"AAAA,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D,SAAS,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CACvG;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,EAAE,GAAG,OAAO;IACtC,gCAAgC;IAChC,IAAI,EAAE,UAAU,CAAC;IAEjB,mCAAmC;IACnC,IAAI,EAAE,UAAU,CAAC;IAEjB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,QAAQ,CAAC;CACpB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { EntityCollection } from "../types/collections";
|
|
2
|
+
import type { EntityReference } from "../types/entities";
|
|
3
|
+
/**
|
|
4
|
+
* Controller that provides access to the registered entity collections.
|
|
5
|
+
* @group Models
|
|
6
|
+
*/
|
|
7
|
+
export type CollectionRegistryController<DB = Record<string, unknown>, EC extends EntityCollection = EntityCollection<any>> = {
|
|
8
|
+
/**
|
|
9
|
+
* List of the mapped collections in the CMS.
|
|
10
|
+
* Each entry relates to a collection in the root database.
|
|
11
|
+
* Each of the navigation entries in this field
|
|
12
|
+
* generates an entry in the main menu.
|
|
13
|
+
*/
|
|
14
|
+
collections?: EntityCollection[];
|
|
15
|
+
/**
|
|
16
|
+
* Is the registry ready to be used
|
|
17
|
+
*/
|
|
18
|
+
initialised: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Get the collection configuration for a given path.
|
|
21
|
+
* The collection is resolved from the given path or alias.
|
|
22
|
+
*/
|
|
23
|
+
getCollection: <K extends keyof DB>(slugOrPath: Extract<K, string>, includeUserOverride?: boolean) => EC | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Get the raw, un-normalized collection configuration.
|
|
26
|
+
* This bypasses the `CollectionRegistry` normalization (such as injecting `relation` instances).
|
|
27
|
+
* This is strictly for the Visual Editor to manipulate AST code without persisting runtime state.
|
|
28
|
+
*/
|
|
29
|
+
getRawCollection: (slugOrPath: string) => EC | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve all the related parent references for a given path
|
|
32
|
+
* @param path
|
|
33
|
+
*/
|
|
34
|
+
getParentReferencesFromPath: (path: string) => EntityReference[];
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve all the related parent collection ids for a given path
|
|
37
|
+
* @param path
|
|
38
|
+
*/
|
|
39
|
+
getParentCollectionIds: (path: string) => string[];
|
|
40
|
+
/**
|
|
41
|
+
* Resolve paths from a list of ids
|
|
42
|
+
* @param ids
|
|
43
|
+
*/
|
|
44
|
+
convertIdsToPaths: (ids: string[]) => string[];
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=collection_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection_registry.d.ts","sourceRoot":"","sources":["../../../../../types/src/controllers/collection_registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,CACpC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,EAAE,SAAS,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,IACnD;IAEA;;;;;OAKG;IACH,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEjC;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,aAAa,EAAE,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,mBAAmB,CAAC,EAAE,OAAO,KAAK,EAAE,GAAG,SAAS,CAAC;IAErH;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,EAAE,GAAG,SAAS,CAAC;IAEzD;;;OAGG;IACH,2BAA2B,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe,EAAE,CAAC;IAEjE;;;OAGG;IACH,sBAAsB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IAEnD;;;OAGG;IACH,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;CAElD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { EntityLinkBuilder } from "../types/entity_link_builder";
|
|
3
|
+
import type { Locale } from "../types/locales";
|
|
4
|
+
import type { EntityAction } from "../types/entity_actions";
|
|
5
|
+
import type { EntityCustomView } from "../types/entity_views";
|
|
6
|
+
import type { RebasePlugin } from "../types/plugins";
|
|
7
|
+
import type { PropertyConfig } from "../types/property_config";
|
|
8
|
+
import type { SlotContribution } from "../types/slots";
|
|
9
|
+
export type CustomizationController = {
|
|
10
|
+
/**
|
|
11
|
+
* Builder for generating utility links for entities
|
|
12
|
+
*/
|
|
13
|
+
entityLinkBuilder?: EntityLinkBuilder;
|
|
14
|
+
/**
|
|
15
|
+
* Use plugins to modify the behaviour of the CMS.
|
|
16
|
+
*/
|
|
17
|
+
plugins?: RebasePlugin[];
|
|
18
|
+
/**
|
|
19
|
+
* Pre-merged slots from plugins + direct slot contributions.
|
|
20
|
+
*/
|
|
21
|
+
resolvedSlots: SlotContribution[];
|
|
22
|
+
/**
|
|
23
|
+
* List of additional custom views for entities.
|
|
24
|
+
* You can use the key to reference the custom view in
|
|
25
|
+
* the `entityViews` prop of a collection.
|
|
26
|
+
*
|
|
27
|
+
* You can also define an entity view from the UI.
|
|
28
|
+
*/
|
|
29
|
+
entityViews?: EntityCustomView[];
|
|
30
|
+
/**
|
|
31
|
+
* List of actions that can be performed on entities.
|
|
32
|
+
* These actions are displayed in the entity view and in the collection view.
|
|
33
|
+
* You can later reuse these actions in the `entityActions` prop of a collection,
|
|
34
|
+
* by specifying the `key` of the action.
|
|
35
|
+
*/
|
|
36
|
+
entityActions?: EntityAction[];
|
|
37
|
+
/**
|
|
38
|
+
* Format of the dates in the CMS.
|
|
39
|
+
* Defaults to 'MMMM dd, yyyy, HH:mm:ss'
|
|
40
|
+
*/
|
|
41
|
+
dateTimeFormat?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Locale of the CMS, currently only affecting dates
|
|
44
|
+
*/
|
|
45
|
+
locale?: Locale;
|
|
46
|
+
/**
|
|
47
|
+
* Record of custom form fields to be used in the CMS.
|
|
48
|
+
* You can use the key to reference the custom field in
|
|
49
|
+
* the `propertyConfig` prop of a property in a collection.
|
|
50
|
+
*/
|
|
51
|
+
propertyConfigs: Record<string, PropertyConfig>;
|
|
52
|
+
components?: {
|
|
53
|
+
/**
|
|
54
|
+
* Component to render when a reference is missing
|
|
55
|
+
*/
|
|
56
|
+
missingReference?: React.ComponentType<{
|
|
57
|
+
path: string;
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=customization_controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customization_controller.d.ts","sourceRoot":"","sources":["../../../../../types/src/controllers/customization_controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,MAAM,uBAAuB,GAAG;IAElC;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IAEzB;;OAEG;IACH,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAElC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAEjC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAE/B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEhD,UAAU,CAAC,EAAE;QAET;;WAEG;QACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;YACnC,IAAI,EAAE,MAAM,CAAC;SAChB,CAAC,CAAC;KAEN,CAAC;CACL,CAAA"}
|