@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,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default email templates for authentication emails
|
|
3
|
+
*/
|
|
4
|
+
interface TemplateUser {
|
|
5
|
+
email: string;
|
|
6
|
+
displayName?: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Default password reset email template
|
|
10
|
+
*/
|
|
11
|
+
export declare function getPasswordResetTemplate(resetUrl: string, user: TemplateUser, appName?: string): {
|
|
12
|
+
subject: string;
|
|
13
|
+
html: string;
|
|
14
|
+
text: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Default email verification template
|
|
18
|
+
*/
|
|
19
|
+
export declare function getEmailVerificationTemplate(verifyUrl: string, user: TemplateUser, appName?: string): {
|
|
20
|
+
subject: string;
|
|
21
|
+
html: string;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Default user invitation email template
|
|
26
|
+
* Sent when an admin creates a new user account
|
|
27
|
+
*/
|
|
28
|
+
export declare function getUserInvitationTemplate(setPasswordUrl: string, user: TemplateUser, appName?: string): {
|
|
29
|
+
subject: string;
|
|
30
|
+
html: string;
|
|
31
|
+
text: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Default welcome email template
|
|
35
|
+
* Sent automatically when a new user registers
|
|
36
|
+
*/
|
|
37
|
+
export declare function getWelcomeEmailTemplate(user: TemplateUser, appName?: string, loginUrl?: string): {
|
|
38
|
+
subject: string;
|
|
39
|
+
html: string;
|
|
40
|
+
text: string;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/email/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,UAAU,YAAY;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAkED;;GAEG;AACH,wBAAgB,wBAAwB,CACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,YAAY,EAClB,OAAO,SAAW,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAyEjD;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,YAAY,EAClB,OAAO,SAAW,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA+DjD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,YAAY,EAClB,OAAO,SAAW,GACnB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAuEjD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,YAAY,EAClB,OAAO,SAAW,EAClB,QAAQ,CAAC,EAAE,MAAM,GAClB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAuEjD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Email service types and interfaces.
|
|
3
|
+
*
|
|
4
|
+
* The canonical `EmailService` and `EmailSendOptions` live in `@rebasepro/types`
|
|
5
|
+
* so they can be used on the `RebaseClient` interface without pulling in nodemailer.
|
|
6
|
+
* This file re-exports them for backward compatibility and adds server-specific
|
|
7
|
+
* config types (SMTP, template functions, etc.).
|
|
8
|
+
*/
|
|
9
|
+
import type { EmailService, EmailSendOptions } from "@rebasepro/types";
|
|
10
|
+
export type { EmailService, EmailSendOptions };
|
|
11
|
+
/**
|
|
12
|
+
* SMTP server configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface SMTPConfig {
|
|
15
|
+
host: string;
|
|
16
|
+
port: number;
|
|
17
|
+
secure?: boolean;
|
|
18
|
+
auth?: {
|
|
19
|
+
user: string;
|
|
20
|
+
pass: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Template function for password reset emails
|
|
25
|
+
*/
|
|
26
|
+
export type PasswordResetTemplateFunction = (resetUrl: string, user: {
|
|
27
|
+
email: string;
|
|
28
|
+
displayName?: string | null;
|
|
29
|
+
}) => {
|
|
30
|
+
subject: string;
|
|
31
|
+
html: string;
|
|
32
|
+
text?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Template function for email verification emails
|
|
36
|
+
*/
|
|
37
|
+
export type EmailVerificationTemplateFunction = (verifyUrl: string, user: {
|
|
38
|
+
email: string;
|
|
39
|
+
displayName?: string | null;
|
|
40
|
+
}) => {
|
|
41
|
+
subject: string;
|
|
42
|
+
html: string;
|
|
43
|
+
text?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Template function for user invitation emails
|
|
47
|
+
*/
|
|
48
|
+
export type UserInvitationTemplateFunction = (setPasswordUrl: string, user: {
|
|
49
|
+
email: string;
|
|
50
|
+
displayName?: string | null;
|
|
51
|
+
}) => {
|
|
52
|
+
subject: string;
|
|
53
|
+
html: string;
|
|
54
|
+
text?: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Template function for welcome emails sent after registration
|
|
58
|
+
*/
|
|
59
|
+
export type WelcomeEmailTemplateFunction = (user: {
|
|
60
|
+
email: string;
|
|
61
|
+
displayName?: string | null;
|
|
62
|
+
}, appName: string) => {
|
|
63
|
+
subject: string;
|
|
64
|
+
html: string;
|
|
65
|
+
text?: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Complete email configuration
|
|
69
|
+
*/
|
|
70
|
+
export interface EmailConfig {
|
|
71
|
+
/**
|
|
72
|
+
* From address for all emails (e.g., "noreply@example.com" or "MyApp <noreply@example.com>")
|
|
73
|
+
*/
|
|
74
|
+
from: string;
|
|
75
|
+
/**
|
|
76
|
+
* SMTP configuration for sending emails via SMTP server
|
|
77
|
+
*/
|
|
78
|
+
smtp?: SMTPConfig;
|
|
79
|
+
/**
|
|
80
|
+
* Alternative: custom function to send emails
|
|
81
|
+
* Use this for custom email providers (AWS SES SDK, Resend, etc.)
|
|
82
|
+
*/
|
|
83
|
+
sendEmail?: (options: EmailSendOptions) => Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Base URL for password reset links (e.g., "https://myapp.com")
|
|
86
|
+
* The reset link will be: {baseUrl}/reset-password?token={token}
|
|
87
|
+
*/
|
|
88
|
+
resetPasswordUrl?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Base URL for email verification links (e.g., "https://myapp.com")
|
|
91
|
+
* The verification link will be: {baseUrl}/verify-email?token={token}
|
|
92
|
+
*/
|
|
93
|
+
verifyEmailUrl?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Application name to use in email templates
|
|
96
|
+
*/
|
|
97
|
+
appName?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Custom email templates (optional - defaults are provided)
|
|
100
|
+
*/
|
|
101
|
+
templates?: {
|
|
102
|
+
passwordReset?: PasswordResetTemplateFunction;
|
|
103
|
+
emailVerification?: EmailVerificationTemplateFunction;
|
|
104
|
+
userInvitation?: UserInvitationTemplateFunction;
|
|
105
|
+
welcomeEmail?: WelcomeEmailTemplateFunction;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/email/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;CACL;AAED;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,CACxC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KACnD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,CAC5C,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KACnD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CA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2
|
+
export interface LoadedFunction {
|
|
3
|
+
/** Endpoint name derived from filename (e.g., "send-invoice") */
|
|
4
|
+
name: string;
|
|
5
|
+
/** The Hono sub-app to mount */
|
|
6
|
+
app: Hono<import("hono").Env>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Auto-discover Hono route files from a directory.
|
|
10
|
+
*
|
|
11
|
+
* Each file should default-export a Hono app (or router).
|
|
12
|
+
* The filename (without extension) becomes the mount path:
|
|
13
|
+
* `functions/send-invoice.ts` → mounted at `/send-invoice`
|
|
14
|
+
*
|
|
15
|
+
* This mirrors how `loadCollectionsFromDirectory` works for collections.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadFunctionsFromDirectory(directory: string): Promise<LoadedFunction[]>;
|
|
18
|
+
//# sourceMappingURL=function-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-loader.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/functions/function-loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,WAAW,cAAc;IAC3B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,GAAG,EAAE,IAAI,CAAC,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC5C,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,EAAE,CAAC,CA+E3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { HonoEnv } from "../api/types";
|
|
3
|
+
import { LoadedFunction } from "./function-loader";
|
|
4
|
+
/**
|
|
5
|
+
* Mount all loaded function routes under a single Hono router.
|
|
6
|
+
*
|
|
7
|
+
* Each function is mounted at `/<function-name>`, preserving
|
|
8
|
+
* whatever HTTP methods and middleware the Hono sub-app defines.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFunctionRoutes(functions: LoadedFunction[]): Hono<HonoEnv>;
|
|
11
|
+
//# sourceMappingURL=function-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-routes.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/functions/function-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,cAAc,EAAE,GAC5B,IAAI,CAAC,OAAO,CAAC,CAkBf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { HonoEnv } from "../api/types";
|
|
3
|
+
import { BackendCollectionRegistry } from "../collections/BackendCollectionRegistry";
|
|
4
|
+
import { DataDriver } from "@rebasepro/types";
|
|
5
|
+
/**
|
|
6
|
+
* Create Hono routes for entity history.
|
|
7
|
+
* Mounted at `{basePath}/data/:slug/:entityId/history`.
|
|
8
|
+
*/
|
|
9
|
+
export interface HistoryService {
|
|
10
|
+
fetchHistory(tableName: string, entityId: string, options: {
|
|
11
|
+
limit: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
data: Record<string, unknown>[];
|
|
15
|
+
total: number;
|
|
16
|
+
}>;
|
|
17
|
+
fetchHistoryEntry(historyId: string): Promise<Record<string, unknown> | null>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createHistoryRoutes(params: {
|
|
20
|
+
historyService: HistoryService;
|
|
21
|
+
registry: BackendCollectionRegistry;
|
|
22
|
+
driver: DataDriver;
|
|
23
|
+
}): Hono<HonoEnv>;
|
|
24
|
+
//# sourceMappingURL=history-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-routes.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/history/history-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3J,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;CACjF;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IACxC,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,yBAAyB,CAAC;IACpC,MAAM,EAAE,UAAU,CAAC;CACtB,GAAG,IAAI,CAAC,OAAO,CAAC,CA8GhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server-core/src/history/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rebasepro/server-core
|
|
3
|
+
*
|
|
4
|
+
* Database-Agnostic Backend Core for Rebase.
|
|
5
|
+
* This package provides the core backend services, generic driver routing,
|
|
6
|
+
* and API layers. Database implementations (e.g., PostgreSQL) are provided
|
|
7
|
+
* by specialized driver packages like `@rebasepro/server-postgresql`.
|
|
8
|
+
*/
|
|
9
|
+
export * from "./db/interfaces";
|
|
10
|
+
export * from "./auth/interfaces";
|
|
11
|
+
export * from "./init";
|
|
12
|
+
export { rebase, _setRebaseMock, _resetRebaseMock } from "./singleton";
|
|
13
|
+
export * from "./services/driver-registry";
|
|
14
|
+
export * from "./api/types";
|
|
15
|
+
export * from "./api";
|
|
16
|
+
export * from "./types";
|
|
17
|
+
export * from "./types/index";
|
|
18
|
+
export * from "./auth";
|
|
19
|
+
export * from "./email";
|
|
20
|
+
export * from "./storage";
|
|
21
|
+
export * from "./utils/logging";
|
|
22
|
+
export * from "./utils/logger";
|
|
23
|
+
export * from "./utils/request-logger";
|
|
24
|
+
export * from "./utils/sql";
|
|
25
|
+
export * from "./history";
|
|
26
|
+
export * from "./functions";
|
|
27
|
+
export * from "./cron";
|
|
28
|
+
export * from "./serve-spa";
|
|
29
|
+
export * from "./utils/dev-port";
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server-core/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,QAAQ,CAAC;AAGvB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGvE,cAAc,4BAA4B,CAAC;AAG3C,cAAc,aAAa,CAAC;AAG5B,cAAc,OAAO,CAAC;AAGtB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAG9B,cAAc,QAAQ,CAAC;AAGvB,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAE1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAG5B,cAAc,WAAW,CAAC;AAG1B,cAAc,aAAa,CAAC;AAG5B,cAAc,QAAQ,CAAC;AAIvB,cAAc,aAAa,CAAC;AAG5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { DataDriver, EntityCollection, BackendBootstrapper, BootstrappedAuth, RealtimeProvider, HealthCheckResult } from "@rebasepro/types";
|
|
2
|
+
import { BackendCollectionRegistry } from "./collections/BackendCollectionRegistry";
|
|
3
|
+
import { DriverRegistry } from "./services/driver-registry";
|
|
4
|
+
import { Server } from "http";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
import { HonoEnv } from "./api/types";
|
|
7
|
+
import { BackendStorageConfig, StorageController, StorageRegistry } from "./storage";
|
|
8
|
+
import { EmailConfig } from "./email";
|
|
9
|
+
import type { OAuthProvider } from "./auth/interfaces";
|
|
10
|
+
export interface RebaseAuthConfig {
|
|
11
|
+
jwtSecret?: string;
|
|
12
|
+
accessExpiresIn?: string;
|
|
13
|
+
refreshExpiresIn?: string;
|
|
14
|
+
requireAuth?: boolean;
|
|
15
|
+
allowRegistration?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A static secret key for server-to-server / script authentication.
|
|
18
|
+
*
|
|
19
|
+
* When a request includes `Authorization: Bearer <serviceKey>`, it is
|
|
20
|
+
* granted admin-level access without JWT verification. This is the
|
|
21
|
+
* Rebase equivalent of a Firebase Service Account key.
|
|
22
|
+
*
|
|
23
|
+
* Generate with: `node -e "console.log(require('crypto').randomBytes(48).toString('base64'))"`
|
|
24
|
+
*
|
|
25
|
+
* Set via `REBASE_SERVICE_KEY` in your `.env`.
|
|
26
|
+
* Must be at least 32 characters.
|
|
27
|
+
*/
|
|
28
|
+
serviceKey?: string;
|
|
29
|
+
email?: EmailConfig;
|
|
30
|
+
google?: {
|
|
31
|
+
clientId: string;
|
|
32
|
+
};
|
|
33
|
+
linkedin?: {
|
|
34
|
+
clientId: string;
|
|
35
|
+
clientSecret: string;
|
|
36
|
+
};
|
|
37
|
+
github?: {
|
|
38
|
+
clientId: string;
|
|
39
|
+
clientSecret: string;
|
|
40
|
+
};
|
|
41
|
+
microsoft?: {
|
|
42
|
+
clientId: string;
|
|
43
|
+
clientSecret: string;
|
|
44
|
+
tenantId?: string;
|
|
45
|
+
};
|
|
46
|
+
apple?: {
|
|
47
|
+
clientId: string;
|
|
48
|
+
teamId: string;
|
|
49
|
+
keyId: string;
|
|
50
|
+
privateKey: string;
|
|
51
|
+
};
|
|
52
|
+
facebook?: {
|
|
53
|
+
clientId: string;
|
|
54
|
+
clientSecret: string;
|
|
55
|
+
};
|
|
56
|
+
twitter?: {
|
|
57
|
+
clientId: string;
|
|
58
|
+
clientSecret: string;
|
|
59
|
+
};
|
|
60
|
+
discord?: {
|
|
61
|
+
clientId: string;
|
|
62
|
+
clientSecret: string;
|
|
63
|
+
};
|
|
64
|
+
gitlab?: {
|
|
65
|
+
clientId: string;
|
|
66
|
+
clientSecret: string;
|
|
67
|
+
baseUrl?: string;
|
|
68
|
+
};
|
|
69
|
+
bitbucket?: {
|
|
70
|
+
clientId: string;
|
|
71
|
+
clientSecret: string;
|
|
72
|
+
};
|
|
73
|
+
slack?: {
|
|
74
|
+
clientId: string;
|
|
75
|
+
clientSecret: string;
|
|
76
|
+
};
|
|
77
|
+
spotify?: {
|
|
78
|
+
clientId: string;
|
|
79
|
+
clientSecret: string;
|
|
80
|
+
};
|
|
81
|
+
defaultRole?: string;
|
|
82
|
+
providers?: OAuthProvider<any>[];
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
export interface RebaseBackendConfig {
|
|
86
|
+
collections?: EntityCollection[];
|
|
87
|
+
collectionsDir?: string;
|
|
88
|
+
server: Server;
|
|
89
|
+
app: Hono<HonoEnv>;
|
|
90
|
+
basePath?: string;
|
|
91
|
+
bootstrappers: BackendBootstrapper[];
|
|
92
|
+
logging?: {
|
|
93
|
+
level?: "error" | "warn" | "info" | "debug";
|
|
94
|
+
};
|
|
95
|
+
auth?: RebaseAuthConfig;
|
|
96
|
+
/**
|
|
97
|
+
* Storage configuration. Accepts:
|
|
98
|
+
*
|
|
99
|
+
* - A `BackendStorageConfig` object (`{ type: 'local' | 's3', ... }`)
|
|
100
|
+
* - A `StorageController` instance (for custom providers like GCS, Azure, etc.)
|
|
101
|
+
* - A `Record<string, ...>` of either, for multi-backend setups
|
|
102
|
+
*/
|
|
103
|
+
storage?: BackendStorageConfig | StorageController | Record<string, BackendStorageConfig | StorageController>;
|
|
104
|
+
history?: unknown;
|
|
105
|
+
enableSwagger?: boolean;
|
|
106
|
+
functionsDir?: string;
|
|
107
|
+
cronsDir?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Maximum request body size in bytes for API routes (default: 10MB).
|
|
110
|
+
* Set to 0 to disable the global limit entirely.
|
|
111
|
+
*
|
|
112
|
+
* Note: Storage upload routes use their own limit from the storage config's
|
|
113
|
+
* `maxFileSize` property (default: 50MB), which takes precedence over this.
|
|
114
|
+
*/
|
|
115
|
+
maxBodySize?: number;
|
|
116
|
+
/**
|
|
117
|
+
* CSRF protection configuration. **Opt-in** — disabled by default.
|
|
118
|
+
*
|
|
119
|
+
* BaaS APIs are consumed by mobile apps, SPAs on different domains,
|
|
120
|
+
* and CLI tools, so CSRF is intentionally not enabled unless you
|
|
121
|
+
* explicitly configure it with allowed origins.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* csrf: { origin: ["https://myapp.com", "https://admin.myapp.com"] }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
csrf?: {
|
|
129
|
+
/** Allowed origins for CSRF validation. */
|
|
130
|
+
origin: string | string[] | ((origin: string) => boolean);
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
export interface RebaseBackendInstance {
|
|
134
|
+
driverRegistry: DriverRegistry;
|
|
135
|
+
driver: DataDriver;
|
|
136
|
+
realtimeServices: Record<string, RealtimeProvider>;
|
|
137
|
+
realtimeService: RealtimeProvider;
|
|
138
|
+
auth?: BootstrappedAuth;
|
|
139
|
+
history?: unknown;
|
|
140
|
+
storageRegistry?: StorageRegistry;
|
|
141
|
+
storageController?: StorageController;
|
|
142
|
+
collectionRegistry: BackendCollectionRegistry;
|
|
143
|
+
cronScheduler?: import("./cron").CronScheduler;
|
|
144
|
+
/**
|
|
145
|
+
* Deep health check that verifies database connectivity.
|
|
146
|
+
* Returns latency and component status.
|
|
147
|
+
*/
|
|
148
|
+
healthCheck(): Promise<HealthCheckResult>;
|
|
149
|
+
/**
|
|
150
|
+
* Graceful shutdown helper for the BaaS instance.
|
|
151
|
+
* Stops the cron scheduler and closes the HTTP server, allowing
|
|
152
|
+
* in-flight requests to drain within the given timeout.
|
|
153
|
+
*
|
|
154
|
+
* @param timeoutMs - Maximum time (ms) to wait for drain before force-exit (default: 15000).
|
|
155
|
+
* Pass 0 to skip the force-exit timer (useful in tests).
|
|
156
|
+
*/
|
|
157
|
+
shutdown(timeoutMs?: number): Promise<void>;
|
|
158
|
+
}
|
|
159
|
+
export declare function initializeRebaseBackend(config: RebaseBackendConfig): Promise<RebaseBackendInstance>;
|
|
160
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../server-core/src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,gBAA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AC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAKzG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for serving a Single Page Application
|
|
4
|
+
*/
|
|
5
|
+
export interface ServeSPAConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Absolute path to the frontend build directory
|
|
8
|
+
* @example path.join(__dirname, "../../frontend/dist")
|
|
9
|
+
*/
|
|
10
|
+
frontendPath: string;
|
|
11
|
+
/**
|
|
12
|
+
* Base path for API routes (default: "/api")
|
|
13
|
+
* Requests to this path will be passed through to API handlers
|
|
14
|
+
*/
|
|
15
|
+
apiBasePath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Additional paths to exclude from SPA handling
|
|
18
|
+
* These paths will be passed through to other handlers
|
|
19
|
+
* @example ["/health", "/ws", "/metrics"]
|
|
20
|
+
*/
|
|
21
|
+
excludePaths?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Index file to serve for SPA routes (default: "index.html")
|
|
24
|
+
*/
|
|
25
|
+
indexFile?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Serve a Single Page Application from an Hono app.
|
|
29
|
+
*/
|
|
30
|
+
export declare function serveSPA<E extends import("hono").Env>(app: Hono<E>, config: ServeSPAConfig): void;
|
|
31
|
+
//# sourceMappingURL=serve-spa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-spa.d.ts","sourceRoot":"","sources":["../../../../server-core/src/serve-spa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CA0CjG"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Driver Registry
|
|
3
|
+
*
|
|
4
|
+
* Manages multiple driver delegates for Rebase backend.
|
|
5
|
+
* Allows different databases for different collections.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* - Single DB: Pass a single DataDriver → maps to "(default)"
|
|
9
|
+
* - Multiple DBs: Pass a map of { dbId: DataDriver }
|
|
10
|
+
* - Collections use `databaseId` property to specify which driver to use
|
|
11
|
+
* - Collections without `databaseId` fallback to "(default)"
|
|
12
|
+
*/
|
|
13
|
+
import { DataDriver } from "@rebasepro/types";
|
|
14
|
+
/**
|
|
15
|
+
* The default driver identifier used when:
|
|
16
|
+
* - A single driver is provided (not a map)
|
|
17
|
+
* - A collection doesn't specify a databaseId
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_DRIVER_ID = "(default)";
|
|
20
|
+
/**
|
|
21
|
+
* Registry for managing multiple driver delegates
|
|
22
|
+
*/
|
|
23
|
+
export interface DriverRegistry {
|
|
24
|
+
/**
|
|
25
|
+
* Register a driver delegate with an ID
|
|
26
|
+
* @param id - Unique identifier for this driver (e.g., "analytics", "users")
|
|
27
|
+
* @param delegate - The DataDriver instance
|
|
28
|
+
*/
|
|
29
|
+
register(id: string, delegate: DataDriver): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get the default driver delegate (id = "(default)")
|
|
32
|
+
* @throws Error if no default driver is registered
|
|
33
|
+
*/
|
|
34
|
+
getDefault(): DataDriver;
|
|
35
|
+
/**
|
|
36
|
+
* Get a driver delegate by ID
|
|
37
|
+
* @param id - Driver identifier, or undefined/null for default
|
|
38
|
+
* @returns The DataDriver, or undefined if not found
|
|
39
|
+
*/
|
|
40
|
+
get(id: string | undefined | null): DataDriver | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get a driver delegate by ID, with fallback to default
|
|
43
|
+
* @param id - Driver identifier, or undefined/null for default
|
|
44
|
+
* @returns The DataDriver (falls back to default if id not found)
|
|
45
|
+
* @throws Error if neither the specified nor default driver exists
|
|
46
|
+
*/
|
|
47
|
+
getOrDefault(id: string | undefined | null): DataDriver;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a driver with the given ID exists
|
|
50
|
+
*/
|
|
51
|
+
has(id: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* List all registered driver IDs
|
|
54
|
+
*/
|
|
55
|
+
list(): string[];
|
|
56
|
+
/**
|
|
57
|
+
* Get the number of registered drivers
|
|
58
|
+
*/
|
|
59
|
+
size(): number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Default implementation of DriverRegistry
|
|
63
|
+
*/
|
|
64
|
+
export declare class DefaultDriverRegistry implements DriverRegistry {
|
|
65
|
+
private delegates;
|
|
66
|
+
/**
|
|
67
|
+
* Create a DriverRegistry from either a single delegate or a map
|
|
68
|
+
* @param input - Single DataDriver (maps to "(default)") or Record<string, DataDriver>
|
|
69
|
+
*/
|
|
70
|
+
static create(input: DataDriver | Record<string, DataDriver>): DefaultDriverRegistry;
|
|
71
|
+
register(id: string, delegate: DataDriver): void;
|
|
72
|
+
getDefault(): DataDriver;
|
|
73
|
+
get(id: string | undefined | null): DataDriver | undefined;
|
|
74
|
+
getOrDefault(id: string | undefined | null): DataDriver;
|
|
75
|
+
has(id: string): boolean;
|
|
76
|
+
list(): string[];
|
|
77
|
+
size(): number;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=driver-registry.d.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,IAAI,GAAG,UAAU;IAmBvD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,IAAI,IAAI,MAAM,EAAE;IAIhB,IAAI,IAAI,MAAM;CAGjB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RebaseClient } from "@rebasepro/types";
|
|
2
|
+
/**
|
|
3
|
+
* @internal Called once during server initialization to set the backing instance.
|
|
4
|
+
* This is invoked by `initializeRebaseBackend()` — never call it manually.
|
|
5
|
+
*/
|
|
6
|
+
export declare function _initRebase(client: RebaseClient): void;
|
|
7
|
+
/**
|
|
8
|
+
* @internal Allows overriding the underlying instance for unit testing.
|
|
9
|
+
* Throws an error if used in a non-test environment to prevent production abuse.
|
|
10
|
+
*/
|
|
11
|
+
export declare function _setRebaseMock(mockInstance: Partial<RebaseClient>): void;
|
|
12
|
+
/**
|
|
13
|
+
* @internal Resets the singleton instance, useful for afterEach() in test suites.
|
|
14
|
+
*/
|
|
15
|
+
export declare function _resetRebaseMock(): void;
|
|
16
|
+
/**
|
|
17
|
+
* The server-side Rebase singleton.
|
|
18
|
+
*
|
|
19
|
+
* Initialized automatically during server startup. Provides access to all
|
|
20
|
+
* app-scoped services: **data**, **auth**, **storage**, and **email**.
|
|
21
|
+
*
|
|
22
|
+
* `rebase.data` runs with **admin privileges** (no RLS). For user-scoped
|
|
23
|
+
* queries inside request handlers, continue using the handler's context
|
|
24
|
+
* or the RLS-scoped driver.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { rebase } from "@rebasepro/server-core";
|
|
29
|
+
*
|
|
30
|
+
* // In a Hono handler, cron job, hook, or service file:
|
|
31
|
+
* await rebase.email?.send({ to: "admin@co.com", subject: "Alert", html: "<p>Hi</p>" });
|
|
32
|
+
* const jobs = await rebase.data.jobs.find({ limit: 10 });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const rebase: RebaseClient;
|
|
36
|
+
//# sourceMappingURL=singleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"singleton.d.ts","sourceRoot":"","sources":["../../../../server-core/src/singleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAEtD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAMxE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,EAAE,YAgBnB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local filesystem storage controller
|
|
3
|
+
*/
|
|
4
|
+
import { StorageController, LocalStorageConfig } from "./types";
|
|
5
|
+
import { UploadFileProps, UploadFileResult, DownloadConfig, StorageListResult } from "@rebasepro/types";
|
|
6
|
+
/**
|
|
7
|
+
* Local filesystem storage implementation
|
|
8
|
+
* Stores files in a directory structure: {basePath}/{bucket}/{path}
|
|
9
|
+
*/
|
|
10
|
+
export declare class LocalStorageController implements StorageController {
|
|
11
|
+
private config;
|
|
12
|
+
private basePath;
|
|
13
|
+
constructor(config: LocalStorageConfig);
|
|
14
|
+
getType(): "local";
|
|
15
|
+
/**
|
|
16
|
+
* Ensure directory exists, creating it if necessary
|
|
17
|
+
*/
|
|
18
|
+
private ensureDir;
|
|
19
|
+
/**
|
|
20
|
+
* Get the full filesystem path for a storage path.
|
|
21
|
+
* Includes a path traversal guard to prevent escaping the base directory.
|
|
22
|
+
*/
|
|
23
|
+
private getFullPath;
|
|
24
|
+
/**
|
|
25
|
+
* Validate file before upload
|
|
26
|
+
*/
|
|
27
|
+
private validateFile;
|
|
28
|
+
putObject({ file, key, metadata, bucket }: UploadFileProps): Promise<UploadFileResult>;
|
|
29
|
+
getSignedUrl(key: string, bucket?: string): Promise<DownloadConfig>;
|
|
30
|
+
getObject(key: string, bucket?: string): Promise<File | null>;
|
|
31
|
+
deleteObject(key: string, bucket?: string): Promise<void>;
|
|
32
|
+
listObjects(prefix: string, options?: {
|
|
33
|
+
bucket?: string;
|
|
34
|
+
maxResults?: number;
|
|
35
|
+
pageToken?: string;
|
|
36
|
+
}): Promise<StorageListResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the absolute filesystem path for serving files
|
|
39
|
+
* Used by the storage routes to serve files directly
|
|
40
|
+
*/
|
|
41
|
+
getAbsolutePath(key: string, bucket?: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Get the base path for the storage
|
|
44
|
+
*/
|
|
45
|
+
getBasePath(): string;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=LocalStorageController.d.ts.map
|