@rebasepro/server-core 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{server-core/src/api → api}/errors.d.ts +5 -2
- package/dist/{server-core/src/api → api}/rest/api-generator.d.ts +8 -2
- package/dist/{server-core/src/api → api}/types.d.ts +2 -0
- package/dist/auth/admin-user-ops.d.ts +79 -0
- package/dist/{server-core/src/auth → auth}/api-keys/index.d.ts +2 -2
- package/dist/{server-core/src/auth → auth}/auth-hooks.d.ts +37 -9
- package/dist/{server-core/src/auth → auth}/builtin-auth-adapter.d.ts +4 -4
- package/dist/{server-core/src/auth → auth}/index.d.ts +5 -2
- package/dist/auth/mfa-routes.d.ts +6 -0
- package/dist/auth/reset-password-admin.d.ts +29 -0
- package/dist/auth/session-routes.d.ts +25 -0
- package/dist/backend-CIxN4FVm.js +15 -0
- package/dist/backend-CIxN4FVm.js.map +1 -0
- package/dist/chunk-Dze3rakg.js +42 -0
- package/dist/{server-core/src/cron → cron}/cron-scheduler.d.ts +1 -1
- package/dist/dist-CZKP-Xz4.js +832 -0
- package/dist/dist-CZKP-Xz4.js.map +1 -0
- package/dist/env.d.ts +102 -0
- package/dist/from-VbwD7xRf.js +3849 -0
- package/dist/from-VbwD7xRf.js.map +1 -0
- package/dist/{server-core/src/index.d.ts → index.d.ts} +1 -0
- package/dist/index.es.js +60867 -50462
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +73151 -51298
- package/dist/index.umd.js.map +1 -1
- package/dist/init/docs.d.ts +4 -0
- package/dist/init/health.d.ts +2 -0
- package/dist/init/middlewares.d.ts +10 -0
- package/dist/init/shutdown.d.ts +11 -0
- package/dist/init/storage.d.ts +5 -0
- package/dist/{server-core/src/init.d.ts → init.d.ts} +4 -4
- package/dist/jwt-DHcQRGC3.js +4168 -0
- package/dist/jwt-DHcQRGC3.js.map +1 -0
- package/dist/logger-BYU66ENZ.js +94 -0
- package/dist/logger-BYU66ENZ.js.map +1 -0
- package/dist/ms-BeBSuOXN.js +125 -0
- package/dist/ms-BeBSuOXN.js.map +1 -0
- package/dist/multipart-parser-CedBDOeC.js +299 -0
- package/dist/multipart-parser-CedBDOeC.js.map +1 -0
- package/dist/src-COaj0G3P.js +1182 -0
- package/dist/src-COaj0G3P.js.map +1 -0
- package/dist/{server-core/src/storage → storage}/image-transform.d.ts +3 -1
- package/dist/utils/request-id.d.ts +4 -0
- package/package.json +29 -29
- package/src/api/collections_for_test/callbacks_test_collection.ts +7 -6
- package/src/api/errors.ts +75 -19
- package/src/api/graphql/graphql-schema-generator.ts +15 -10
- package/src/api/logs-routes.ts +5 -2
- package/src/api/rest/api-generator-count.test.ts +21 -10
- package/src/api/rest/api-generator.ts +83 -24
- package/src/api/rest/query-parser.ts +18 -12
- package/src/api/server.ts +12 -1
- package/src/api/types.ts +2 -0
- package/src/auth/adapter-middleware.ts +17 -10
- package/src/auth/admin-user-ops.ts +236 -0
- package/src/auth/api-keys/api-key-middleware.ts +15 -9
- package/src/auth/api-keys/api-key-permission-guard.ts +1 -1
- package/src/auth/api-keys/api-key-routes.ts +3 -3
- package/src/auth/api-keys/api-key-store.ts +14 -8
- package/src/auth/api-keys/index.ts +2 -2
- package/src/auth/apple-oauth.ts +4 -3
- package/src/auth/auth-hooks.ts +50 -10
- package/src/auth/bitbucket-oauth.ts +5 -4
- package/src/auth/builtin-auth-adapter.ts +60 -39
- package/src/auth/custom-auth-adapter.ts +4 -5
- package/src/auth/discord-oauth.ts +5 -4
- package/src/auth/facebook-oauth.ts +5 -4
- package/src/auth/github-oauth.ts +6 -5
- package/src/auth/gitlab-oauth.ts +5 -4
- package/src/auth/google-oauth.ts +2 -1
- package/src/auth/index.ts +6 -2
- package/src/auth/jwt.ts +5 -4
- package/src/auth/linkedin-oauth.ts +4 -3
- package/src/auth/mfa-routes.ts +299 -0
- package/src/auth/mfa.ts +2 -1
- package/src/auth/microsoft-oauth.ts +5 -4
- package/src/auth/middleware.ts +5 -4
- package/src/auth/rate-limiter.ts +1 -1
- package/src/auth/reset-password-admin.ts +144 -0
- package/src/auth/rls-scope.ts +1 -1
- package/src/auth/routes.ts +52 -596
- package/src/auth/session-routes.ts +341 -0
- package/src/auth/slack-oauth.ts +6 -5
- package/src/auth/spotify-oauth.ts +5 -4
- package/src/auth/twitter-oauth.ts +4 -3
- package/src/collections/loader.ts +5 -4
- package/src/cron/cron-scheduler.test.ts +23 -11
- package/src/cron/cron-scheduler.ts +14 -8
- package/src/cron/cron-store.ts +1 -1
- package/src/email/smtp-email-service.ts +3 -2
- package/src/env.ts +11 -10
- package/src/index.ts +1 -0
- package/src/init/docs.ts +47 -0
- package/src/init/health.ts +37 -0
- package/src/init/middlewares.ts +61 -0
- package/src/init/shutdown.ts +56 -0
- package/src/init/storage.ts +57 -0
- package/src/init.ts +85 -279
- package/src/serve-spa.ts +12 -5
- package/src/services/driver-registry.ts +4 -3
- package/src/storage/S3StorageController.ts +1 -2
- package/src/storage/image-transform.ts +25 -10
- package/src/storage/routes.ts +30 -11
- package/src/storage/storage-registry.ts +4 -3
- package/src/storage/tus-handler.ts +12 -12
- package/src/utils/request-id.ts +40 -0
- package/src/utils/request-logger.ts +6 -0
- package/test/api-generator.test.ts +90 -2
- package/test/api-key-permission-guard.test.ts +24 -12
- package/test/auth-routes.test.ts +5 -3
- package/test/backend-hooks-data.test.ts +99 -30
- package/test/custom-auth-adapter.test.ts +16 -15
- package/test/email-templates.test.ts +10 -5
- package/test/env.test.ts +10 -10
- package/test/function-loader.test.ts +7 -4
- package/test/graphql-schema-generator.test.ts +554 -0
- package/test/jwt-security.test.ts +1 -1
- package/test/query-parser.test.ts +0 -1
- package/test/reset-password-admin.test.ts +113 -0
- package/test/singleton.test.ts +5 -5
- package/test/smtp-email-service.test.ts +21 -21
- package/test/webhook-service.test.ts +22 -11
- package/tsconfig.json +2 -0
- package/tsconfig.prod.json +3 -0
- package/vite.config.ts +5 -5
- package/dist/common/src/collections/CollectionRegistry.d.ts +0 -56
- package/dist/common/src/collections/default-collections.d.ts +0 -9
- package/dist/common/src/collections/index.d.ts +0 -2
- package/dist/common/src/data/buildRebaseData.d.ts +0 -14
- package/dist/common/src/data/query_builder.d.ts +0 -55
- package/dist/common/src/index.d.ts +0 -4
- package/dist/common/src/util/builders.d.ts +0 -57
- package/dist/common/src/util/callbacks.d.ts +0 -6
- package/dist/common/src/util/collections.d.ts +0 -11
- package/dist/common/src/util/common.d.ts +0 -2
- package/dist/common/src/util/conditions.d.ts +0 -26
- package/dist/common/src/util/entities.d.ts +0 -58
- package/dist/common/src/util/enums.d.ts +0 -3
- package/dist/common/src/util/index.d.ts +0 -16
- package/dist/common/src/util/navigation_from_path.d.ts +0 -34
- package/dist/common/src/util/navigation_utils.d.ts +0 -20
- package/dist/common/src/util/parent_references_from_path.d.ts +0 -6
- package/dist/common/src/util/paths.d.ts +0 -14
- package/dist/common/src/util/permissions.d.ts +0 -14
- package/dist/common/src/util/references.d.ts +0 -2
- package/dist/common/src/util/relations.d.ts +0 -22
- package/dist/common/src/util/resolutions.d.ts +0 -72
- package/dist/common/src/util/storage.d.ts +0 -24
- package/dist/index-Cr1D21av.js +0 -49
- package/dist/index-Cr1D21av.js.map +0 -1
- package/dist/server-core/src/auth/admin-routes.d.ts +0 -27
- package/dist/server-core/src/env.d.ts +0 -137
- package/dist/types/src/controllers/analytics_controller.d.ts +0 -7
- package/dist/types/src/controllers/auth.d.ts +0 -104
- package/dist/types/src/controllers/client.d.ts +0 -168
- package/dist/types/src/controllers/collection_registry.d.ts +0 -46
- package/dist/types/src/controllers/customization_controller.d.ts +0 -60
- package/dist/types/src/controllers/data.d.ts +0 -207
- package/dist/types/src/controllers/data_driver.d.ts +0 -218
- package/dist/types/src/controllers/database_admin.d.ts +0 -11
- package/dist/types/src/controllers/dialogs_controller.d.ts +0 -36
- package/dist/types/src/controllers/effective_role.d.ts +0 -4
- package/dist/types/src/controllers/email.d.ts +0 -36
- package/dist/types/src/controllers/index.d.ts +0 -18
- package/dist/types/src/controllers/local_config_persistence.d.ts +0 -20
- package/dist/types/src/controllers/navigation.d.ts +0 -225
- package/dist/types/src/controllers/registry.d.ts +0 -63
- package/dist/types/src/controllers/side_dialogs_controller.d.ts +0 -67
- package/dist/types/src/controllers/side_entity_controller.d.ts +0 -97
- package/dist/types/src/controllers/snackbar.d.ts +0 -24
- package/dist/types/src/controllers/storage.d.ts +0 -171
- package/dist/types/src/index.d.ts +0 -4
- package/dist/types/src/rebase_context.d.ts +0 -122
- package/dist/types/src/types/auth_adapter.d.ts +0 -301
- package/dist/types/src/types/backend.d.ts +0 -571
- package/dist/types/src/types/backend_hooks.d.ts +0 -172
- package/dist/types/src/types/builders.d.ts +0 -15
- package/dist/types/src/types/chips.d.ts +0 -5
- package/dist/types/src/types/collections.d.ts +0 -961
- package/dist/types/src/types/component_ref.d.ts +0 -47
- package/dist/types/src/types/cron.d.ts +0 -102
- package/dist/types/src/types/data_source.d.ts +0 -64
- package/dist/types/src/types/database_adapter.d.ts +0 -94
- package/dist/types/src/types/entities.d.ts +0 -145
- package/dist/types/src/types/entity_actions.d.ts +0 -104
- package/dist/types/src/types/entity_callbacks.d.ts +0 -173
- package/dist/types/src/types/entity_link_builder.d.ts +0 -7
- package/dist/types/src/types/entity_overrides.d.ts +0 -10
- package/dist/types/src/types/entity_views.d.ts +0 -87
- package/dist/types/src/types/export_import.d.ts +0 -21
- package/dist/types/src/types/formex.d.ts +0 -40
- package/dist/types/src/types/index.d.ts +0 -28
- package/dist/types/src/types/locales.d.ts +0 -4
- package/dist/types/src/types/modify_collections.d.ts +0 -5
- package/dist/types/src/types/plugins.d.ts +0 -282
- package/dist/types/src/types/properties.d.ts +0 -1173
- package/dist/types/src/types/property_config.d.ts +0 -74
- package/dist/types/src/types/relations.d.ts +0 -336
- package/dist/types/src/types/slots.d.ts +0 -262
- package/dist/types/src/types/translations.d.ts +0 -900
- package/dist/types/src/types/user_management_delegate.d.ts +0 -86
- package/dist/types/src/types/websockets.d.ts +0 -78
- package/dist/types/src/users/index.d.ts +0 -1
- package/dist/types/src/users/user.d.ts +0 -50
- package/src/auth/admin-routes.ts +0 -534
- package/test/admin-routes.test.ts +0 -544
- package/test/backend-hooks-admin.test.ts +0 -388
- /package/dist/{server-core/src/api → api}/ast-schema-editor.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/collections_for_test/callbacks_test_collection.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/graphql/graphql-schema-generator.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/graphql/index.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/index.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/logs-routes.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/openapi-generator.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/rest/index.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/rest/query-parser.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/schema-editor-routes.d.ts +0 -0
- /package/dist/{server-core/src/api → api}/server.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/adapter-middleware.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/api-keys/api-key-middleware.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/api-keys/api-key-permission-guard.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/api-keys/api-key-routes.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/api-keys/api-key-store.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/api-keys/api-key-types.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/apple-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/bitbucket-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/crypto-utils.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/custom-auth-adapter.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/discord-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/facebook-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/github-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/gitlab-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/google-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/interfaces.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/jwt.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/linkedin-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/mfa.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/microsoft-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/middleware.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/password.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/rate-limiter.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/rls-scope.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/routes.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/slack-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/spotify-oauth.d.ts +0 -0
- /package/dist/{server-core/src/auth → auth}/twitter-oauth.d.ts +0 -0
- /package/dist/{server-core/src/collections → collections}/BackendCollectionRegistry.d.ts +0 -0
- /package/dist/{server-core/src/collections → collections}/loader.d.ts +0 -0
- /package/dist/{server-core/src/cron → cron}/cron-loader.d.ts +0 -0
- /package/dist/{server-core/src/cron → cron}/cron-routes.d.ts +0 -0
- /package/dist/{server-core/src/cron → cron}/cron-store.d.ts +0 -0
- /package/dist/{server-core/src/cron → cron}/index.d.ts +0 -0
- /package/dist/{server-core/src/db → db}/interfaces.d.ts +0 -0
- /package/dist/{server-core/src/email → email}/index.d.ts +0 -0
- /package/dist/{server-core/src/email → email}/smtp-email-service.d.ts +0 -0
- /package/dist/{server-core/src/email → email}/templates.d.ts +0 -0
- /package/dist/{server-core/src/email → email}/types.d.ts +0 -0
- /package/dist/{server-core/src/functions → functions}/function-loader.d.ts +0 -0
- /package/dist/{server-core/src/functions → functions}/function-routes.d.ts +0 -0
- /package/dist/{server-core/src/functions → functions}/index.d.ts +0 -0
- /package/dist/{server-core/src/history → history}/history-routes.d.ts +0 -0
- /package/dist/{server-core/src/history → history}/index.d.ts +0 -0
- /package/dist/{server-core/src/serve-spa.d.ts → serve-spa.d.ts} +0 -0
- /package/dist/{server-core/src/services → services}/driver-registry.d.ts +0 -0
- /package/dist/{server-core/src/services → services}/webhook-service.d.ts +0 -0
- /package/dist/{server-core/src/singleton.d.ts → singleton.d.ts} +0 -0
- /package/dist/{server-core/src/storage → storage}/LocalStorageController.d.ts +0 -0
- /package/dist/{server-core/src/storage → storage}/S3StorageController.d.ts +0 -0
- /package/dist/{server-core/src/storage → storage}/index.d.ts +0 -0
- /package/dist/{server-core/src/storage → storage}/routes.d.ts +0 -0
- /package/dist/{server-core/src/storage → storage}/storage-registry.d.ts +0 -0
- /package/dist/{server-core/src/storage → storage}/tus-handler.d.ts +0 -0
- /package/dist/{server-core/src/storage → storage}/types.d.ts +0 -0
- /package/dist/{server-core/src/types → types}/index.d.ts +0 -0
- /package/dist/{server-core/src/utils → utils}/dev-port.d.ts +0 -0
- /package/dist/{server-core/src/utils → utils}/logger.d.ts +0 -0
- /package/dist/{server-core/src/utils → utils}/logging.d.ts +0 -0
- /package/dist/{server-core/src/utils → utils}/request-logger.d.ts +0 -0
- /package/dist/{server-core/src/utils → utils}/sql.d.ts +0 -0
package/test/singleton.test.ts
CHANGED
|
@@ -9,7 +9,7 @@ describe("rebase singleton", () => {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
it("should throw when accessing properties before initialization", () => {
|
|
12
|
-
expect(() => rebase.data).
|
|
12
|
+
expect(() => rebase.data).toThrow(/server not initialized yet/);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it("should allow property access after initialization", () => {
|
|
@@ -24,7 +24,7 @@ describe("rebase singleton", () => {
|
|
|
24
24
|
|
|
25
25
|
expect(() => {
|
|
26
26
|
(rebase as Record<string, unknown>).data = "overwritten";
|
|
27
|
-
}).
|
|
27
|
+
}).toThrow(/Cannot set rebase\.data directly/);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it("should reset properly with _resetRebaseMock", () => {
|
|
@@ -32,14 +32,14 @@ describe("rebase singleton", () => {
|
|
|
32
32
|
expect(() => rebase.data).not.toThrow();
|
|
33
33
|
|
|
34
34
|
_resetRebaseMock();
|
|
35
|
-
expect(() => rebase.data).
|
|
35
|
+
expect(() => rebase.data).toThrow(/server not initialized yet/);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it("should throw if _setRebaseMock is called outside test env", () => {
|
|
39
39
|
const originalEnv = process.env.NODE_ENV;
|
|
40
40
|
process.env.NODE_ENV = "production";
|
|
41
41
|
|
|
42
|
-
expect(() => _setRebaseMock({} as Partial<RebaseClient>)).
|
|
42
|
+
expect(() => _setRebaseMock({} as Partial<RebaseClient>)).toThrow(
|
|
43
43
|
/can only be called in a test environment/
|
|
44
44
|
);
|
|
45
45
|
|
|
@@ -50,7 +50,7 @@ describe("rebase singleton", () => {
|
|
|
50
50
|
const originalEnv = process.env.NODE_ENV;
|
|
51
51
|
process.env.NODE_ENV = "production";
|
|
52
52
|
|
|
53
|
-
expect(() => _resetRebaseMock()).
|
|
53
|
+
expect(() => _resetRebaseMock()).toThrow(
|
|
54
54
|
/can only be called in a test environment/
|
|
55
55
|
);
|
|
56
56
|
|
|
@@ -4,10 +4,10 @@ import nodemailer from "nodemailer";
|
|
|
4
4
|
jest.mock("nodemailer", () => {
|
|
5
5
|
const mockTransporter = {
|
|
6
6
|
verify: jest.fn().mockResolvedValue(true),
|
|
7
|
-
sendMail: jest.fn().mockResolvedValue(true)
|
|
7
|
+
sendMail: jest.fn().mockResolvedValue(true)
|
|
8
8
|
};
|
|
9
9
|
return {
|
|
10
|
-
createTransport: jest.fn().mockReturnValue(mockTransporter)
|
|
10
|
+
createTransport: jest.fn().mockReturnValue(mockTransporter)
|
|
11
11
|
};
|
|
12
12
|
});
|
|
13
13
|
|
|
@@ -28,15 +28,15 @@ describe("SMTPEmailService", () => {
|
|
|
28
28
|
smtp: {
|
|
29
29
|
host: "smtp.example.com",
|
|
30
30
|
port: 587,
|
|
31
|
-
name: "explicit-hostname"
|
|
32
|
-
}
|
|
31
|
+
name: "explicit-hostname"
|
|
32
|
+
}
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
expect(mockCreateTransport).toHaveBeenCalledWith(
|
|
36
36
|
expect.objectContaining({
|
|
37
37
|
name: "explicit-hostname",
|
|
38
38
|
host: "smtp.example.com",
|
|
39
|
-
port: 587
|
|
39
|
+
port: 587
|
|
40
40
|
})
|
|
41
41
|
);
|
|
42
42
|
});
|
|
@@ -50,13 +50,13 @@ describe("SMTPEmailService", () => {
|
|
|
50
50
|
from: "test@example.com",
|
|
51
51
|
smtp: {
|
|
52
52
|
host: "smtp.example.com",
|
|
53
|
-
port: 587
|
|
54
|
-
}
|
|
53
|
+
port: 587
|
|
54
|
+
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
expect(mockCreateTransport).toHaveBeenCalledWith(
|
|
58
58
|
expect.objectContaining({
|
|
59
|
-
name: "frontend-url.com"
|
|
59
|
+
name: "frontend-url.com"
|
|
60
60
|
})
|
|
61
61
|
);
|
|
62
62
|
} finally {
|
|
@@ -73,14 +73,14 @@ describe("SMTPEmailService", () => {
|
|
|
73
73
|
from: "test@example.com",
|
|
74
74
|
smtp: {
|
|
75
75
|
host: "smtp.example.com",
|
|
76
|
-
port: 587
|
|
76
|
+
port: 587
|
|
77
77
|
},
|
|
78
|
-
resetPasswordUrl: "http://reset-password-url.org"
|
|
78
|
+
resetPasswordUrl: "http://reset-password-url.org"
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
expect(mockCreateTransport).toHaveBeenCalledWith(
|
|
82
82
|
expect.objectContaining({
|
|
83
|
-
name: "reset-password-url.org"
|
|
83
|
+
name: "reset-password-url.org"
|
|
84
84
|
})
|
|
85
85
|
);
|
|
86
86
|
} finally {
|
|
@@ -97,14 +97,14 @@ describe("SMTPEmailService", () => {
|
|
|
97
97
|
from: "test@example.com",
|
|
98
98
|
smtp: {
|
|
99
99
|
host: "smtp.example.com",
|
|
100
|
-
port: 587
|
|
100
|
+
port: 587
|
|
101
101
|
},
|
|
102
|
-
verifyEmailUrl: "verify-email-url.net/auth"
|
|
102
|
+
verifyEmailUrl: "verify-email-url.net/auth"
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
expect(mockCreateTransport).toHaveBeenCalledWith(
|
|
106
106
|
expect.objectContaining({
|
|
107
|
-
name: "verify-email-url.net"
|
|
107
|
+
name: "verify-email-url.net"
|
|
108
108
|
})
|
|
109
109
|
);
|
|
110
110
|
} finally {
|
|
@@ -121,13 +121,13 @@ describe("SMTPEmailService", () => {
|
|
|
121
121
|
from: "test@example.com",
|
|
122
122
|
smtp: {
|
|
123
123
|
host: "smtp.example.com",
|
|
124
|
-
port: 587
|
|
125
|
-
}
|
|
124
|
+
port: 587
|
|
125
|
+
}
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
expect(mockCreateTransport).toHaveBeenCalledWith(
|
|
129
129
|
expect.objectContaining({
|
|
130
|
-
name: undefined
|
|
130
|
+
name: undefined
|
|
131
131
|
})
|
|
132
132
|
);
|
|
133
133
|
} finally {
|
|
@@ -142,8 +142,8 @@ describe("SMTPEmailService", () => {
|
|
|
142
142
|
from: "test@example.com",
|
|
143
143
|
smtp: {
|
|
144
144
|
host: "smtp.example.com",
|
|
145
|
-
port: 587
|
|
146
|
-
}
|
|
145
|
+
port: 587
|
|
146
|
+
}
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
const verified = await service.verifyConnection();
|
|
@@ -158,8 +158,8 @@ describe("SMTPEmailService", () => {
|
|
|
158
158
|
from: "test@example.com",
|
|
159
159
|
smtp: {
|
|
160
160
|
host: "smtp.example.com",
|
|
161
|
-
port: 587
|
|
162
|
-
}
|
|
161
|
+
port: 587
|
|
162
|
+
}
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
const verified = await service.verifyConnection();
|
|
@@ -25,9 +25,12 @@ describe("WebhookDispatcher", () => {
|
|
|
25
25
|
it("filters out disabled webhooks", () => {
|
|
26
26
|
const dispatcher = new WebhookDispatcher();
|
|
27
27
|
dispatcher.setWebhooks([
|
|
28
|
-
makeWebhook({ id: "wh_1",
|
|
29
|
-
|
|
30
|
-
makeWebhook({ id: "
|
|
28
|
+
makeWebhook({ id: "wh_1",
|
|
29
|
+
enabled: true }),
|
|
30
|
+
makeWebhook({ id: "wh_2",
|
|
31
|
+
enabled: false }),
|
|
32
|
+
makeWebhook({ id: "wh_3",
|
|
33
|
+
enabled: true })
|
|
31
34
|
]);
|
|
32
35
|
|
|
33
36
|
// Disabled webhook should not trigger
|
|
@@ -46,14 +49,16 @@ describe("WebhookDispatcher", () => {
|
|
|
46
49
|
dispatcher.setWebhooks([makeWebhook({ table: "posts" })]);
|
|
47
50
|
|
|
48
51
|
const results = await dispatcher.onEntityChange(
|
|
49
|
-
"users", "INSERT", "id_1", { id: "id_1",
|
|
52
|
+
"users", "INSERT", "id_1", { id: "id_1",
|
|
53
|
+
name: "Test" }
|
|
50
54
|
);
|
|
51
55
|
expect(results).toEqual([]);
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
it("matches webhooks by table AND event", async () => {
|
|
55
59
|
const dispatcher = new WebhookDispatcher();
|
|
56
|
-
dispatcher.setWebhooks([makeWebhook({ table: "users",
|
|
60
|
+
dispatcher.setWebhooks([makeWebhook({ table: "users",
|
|
61
|
+
events: ["INSERT"] })]);
|
|
57
62
|
|
|
58
63
|
mockFetch.mockResolvedValue({
|
|
59
64
|
status: 200,
|
|
@@ -140,7 +145,8 @@ describe("WebhookDispatcher", () => {
|
|
|
140
145
|
text: () => Promise.resolve("OK")
|
|
141
146
|
});
|
|
142
147
|
|
|
143
|
-
const entity = { id: "id_1",
|
|
148
|
+
const entity = { id: "id_1",
|
|
149
|
+
name: "Test User" };
|
|
144
150
|
await dispatcher.onEntityChange("users", "INSERT", "id_1", entity);
|
|
145
151
|
|
|
146
152
|
const [, options] = mockFetch.mock.calls[0];
|
|
@@ -161,8 +167,10 @@ describe("WebhookDispatcher", () => {
|
|
|
161
167
|
text: () => Promise.resolve("OK")
|
|
162
168
|
});
|
|
163
169
|
|
|
164
|
-
const entity = { id: "id_1",
|
|
165
|
-
|
|
170
|
+
const entity = { id: "id_1",
|
|
171
|
+
name: "Updated" };
|
|
172
|
+
const previous = { id: "id_1",
|
|
173
|
+
name: "Original" };
|
|
166
174
|
await dispatcher.onEntityChange("users", "UPDATE", "id_1", entity, previous);
|
|
167
175
|
|
|
168
176
|
const [, options] = mockFetch.mock.calls[0];
|
|
@@ -208,7 +216,8 @@ describe("WebhookDispatcher", () => {
|
|
|
208
216
|
const dispatcher = new WebhookDispatcher();
|
|
209
217
|
dispatcher.setWebhooks([
|
|
210
218
|
makeWebhook({
|
|
211
|
-
headers: { "X-Custom": "my-value",
|
|
219
|
+
headers: { "X-Custom": "my-value",
|
|
220
|
+
"Authorization": "Bearer token" }
|
|
212
221
|
})
|
|
213
222
|
]);
|
|
214
223
|
|
|
@@ -228,8 +237,10 @@ describe("WebhookDispatcher", () => {
|
|
|
228
237
|
it("dispatches to multiple matching webhooks", async () => {
|
|
229
238
|
const dispatcher = new WebhookDispatcher();
|
|
230
239
|
dispatcher.setWebhooks([
|
|
231
|
-
makeWebhook({ id: "wh_1",
|
|
232
|
-
|
|
240
|
+
makeWebhook({ id: "wh_1",
|
|
241
|
+
url: "https://a.com/hook" }),
|
|
242
|
+
makeWebhook({ id: "wh_2",
|
|
243
|
+
url: "https://b.com/hook" })
|
|
233
244
|
]);
|
|
234
245
|
|
|
235
246
|
mockFetch.mockResolvedValue({
|
package/tsconfig.json
CHANGED
package/tsconfig.prod.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
1
|
import path from "path";
|
|
3
2
|
|
|
4
3
|
import { defineConfig } from "vite";
|
|
@@ -10,8 +9,8 @@ const ReactCompilerConfig = {
|
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Only externalize dependencies that the consumer app installs directly.
|
|
13
|
-
* Everything else
|
|
14
|
-
*
|
|
12
|
+
* Everything else gets inlined so linked consumers work without installing them.
|
|
13
|
+
* The createRequire banner in output config provides require() for inlined CJS deps.
|
|
15
14
|
*/
|
|
16
15
|
const CONSUMER_EXTERNALS = [
|
|
17
16
|
"hono",
|
|
@@ -34,8 +33,8 @@ const isExternal = (id: string) => {
|
|
|
34
33
|
// Externalize only deps the consumer app explicitly installs
|
|
35
34
|
if (CONSUMER_EXTERNALS.some(ext => id === ext || id.startsWith(ext + "/"))) return true;
|
|
36
35
|
// Externalize Node built-ins
|
|
37
|
-
if (["fs", "path", "url", "util", "crypto", "http", "https", "net", "tls", "stream", "events", "os", "child_process", "buffer", "assert", "dns", "zlib", "querystring", "node:"].some(b => id === b || id.startsWith("node:") || id.startsWith(b + "/"))) return true;
|
|
38
|
-
// Inline everything else (
|
|
36
|
+
if (["fs", "path", "url", "util", "crypto", "http", "https", "net", "tls", "stream", "events", "os", "child_process", "buffer", "assert", "dns", "zlib", "querystring", "process", "module", "worker_threads", "v8", "vm", "string_decoder", "node:"].some(b => id === b || id.startsWith("node:") || id.startsWith(b + "/"))) return true;
|
|
37
|
+
// Inline everything else — createRequire banner handles require() for CJS deps
|
|
39
38
|
return false;
|
|
40
39
|
};
|
|
41
40
|
|
|
@@ -55,6 +54,7 @@ export default defineConfig(() => ({
|
|
|
55
54
|
rollupOptions: {
|
|
56
55
|
external: isExternal,
|
|
57
56
|
output: {
|
|
57
|
+
banner: 'import { createRequire as __createRequire } from "module"; import process from "process"; const require = __createRequire(import.meta.url);',
|
|
58
58
|
globals: {
|
|
59
59
|
"json-logic-js": "jsonLogic",
|
|
60
60
|
"fast-equals": "fastEquals",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { EntityCollection } from "@rebasepro/types";
|
|
2
|
-
export declare class CollectionRegistry {
|
|
3
|
-
private collectionsByTableName;
|
|
4
|
-
private collectionsBySlug;
|
|
5
|
-
private rootCollections;
|
|
6
|
-
private cachedCollectionsList;
|
|
7
|
-
private rawCollectionsByTableName;
|
|
8
|
-
private rawCollectionsBySlug;
|
|
9
|
-
private rawRootCollections;
|
|
10
|
-
private cachedRawCollectionsList;
|
|
11
|
-
private lastRawInputSnapshot;
|
|
12
|
-
constructor(collections?: EntityCollection[]);
|
|
13
|
-
reset(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Registers a collection and its subcollections recursively.
|
|
16
|
-
* Returns true if the collections have changed, false otherwise.
|
|
17
|
-
*
|
|
18
|
-
* Idempotent: compares the raw input (before normalization) against a stored
|
|
19
|
-
* snapshot. Only re-normalizes and re-registers when the raw input actually changed.
|
|
20
|
-
* @param collections
|
|
21
|
-
*/
|
|
22
|
-
registerMultiple(collections: EntityCollection[]): boolean;
|
|
23
|
-
register(collection: EntityCollection, rawCollection?: EntityCollection): void;
|
|
24
|
-
private _registerRecursively;
|
|
25
|
-
normalizeCollection(collection: EntityCollection): EntityCollection;
|
|
26
|
-
/**
|
|
27
|
-
* Extract Relation[] from properties that have inline relation config (i.e. `target` is set).
|
|
28
|
-
* This allows developers to define relations directly on properties without a separate
|
|
29
|
-
* `relations[]` entry on the collection.
|
|
30
|
-
*/
|
|
31
|
-
private extractRelationsFromProperties;
|
|
32
|
-
private normalizeProperties;
|
|
33
|
-
private normalizeProperty;
|
|
34
|
-
get(path: string): EntityCollection | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Gets the pristine, un-normalized collection exactly as it was provided.
|
|
37
|
-
* Useful for the AST editor so it doesn't accidentally serialize injected metadata back to disk.
|
|
38
|
-
*/
|
|
39
|
-
getRaw(path: string): EntityCollection | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Get collection by resolving multi-segment paths through relations
|
|
42
|
-
* e.g., "authors/70/posts" resolves to the posts collection
|
|
43
|
-
*/
|
|
44
|
-
getCollectionByPath(collectionPath: string): EntityCollection | undefined;
|
|
45
|
-
getCollections(): EntityCollection[];
|
|
46
|
-
getRawCollections(): EntityCollection[];
|
|
47
|
-
/**
|
|
48
|
-
* Resolves a multi-segment path like "products/123/locales" and returns
|
|
49
|
-
* information about the collections and entity IDs along the path
|
|
50
|
-
*/
|
|
51
|
-
resolvePathToCollections(path: string): {
|
|
52
|
-
collections: EntityCollection[];
|
|
53
|
-
entityIds: (string | number)[];
|
|
54
|
-
finalCollection: EntityCollection;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PostgresCollection } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Default users collection.
|
|
4
|
-
*
|
|
5
|
-
* Prepended to the developer's collections array by the admin and server.
|
|
6
|
-
* Slug-based dedup (Map keyed by slug, last-write-wins) lets developers
|
|
7
|
-
* override by defining their own collection with `slug: "users"`.
|
|
8
|
-
*/
|
|
9
|
-
export declare const defaultUsersCollection: PostgresCollection;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DataDriver, RebaseData } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Build a `RebaseData` object from a `DataDriver` using JavaScript Proxy.
|
|
4
|
-
*
|
|
5
|
-
* This is the key bridge: any property access like `data.products` returns
|
|
6
|
-
* a `CollectionAccessor` backed by the underlying DataDriver, without
|
|
7
|
-
* needing per-collection code generation.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const data = buildRebaseData(driver);
|
|
11
|
-
* await data.products.create({ name: "Camera", price: 299 });
|
|
12
|
-
* const { data: items } = await data.products.find({ where: { status: "eq.published" } });
|
|
13
|
-
*/
|
|
14
|
-
export declare function buildRebaseData(driver: DataDriver): RebaseData;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { FindResponse, CollectionAccessor, QueryBuilderInterface, FilterOperator, LogicalCondition, WhereValue, FilterCondition } from "@rebasepro/types";
|
|
2
|
-
export declare function or(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
|
|
3
|
-
export declare function and(...conditions: (FilterCondition | LogicalCondition)[]): LogicalCondition;
|
|
4
|
-
export declare function cond(column: string, operator: FilterOperator, value: unknown): FilterCondition;
|
|
5
|
-
export declare class QueryBuilder<M extends Record<string, unknown> = Record<string, unknown>> implements QueryBuilderInterface<M> {
|
|
6
|
-
private collection;
|
|
7
|
-
private params;
|
|
8
|
-
constructor(collection: CollectionAccessor<M>);
|
|
9
|
-
/**
|
|
10
|
-
* Add a filter condition to your query.
|
|
11
|
-
* @example
|
|
12
|
-
* client.collection('users').where('age', '>=', 18).find()
|
|
13
|
-
*/
|
|
14
|
-
where<K extends keyof M & string>(column: K, operator: FilterOperator, value: WhereValue<M[K]>): this;
|
|
15
|
-
where(logicalCondition: LogicalCondition): this;
|
|
16
|
-
/**
|
|
17
|
-
* Order the results by a specific column.
|
|
18
|
-
* @example
|
|
19
|
-
* client.collection('users').orderBy('createdAt', 'desc').find()
|
|
20
|
-
*/
|
|
21
|
-
orderBy(column: keyof M & string, ascending?: "asc" | "desc"): this;
|
|
22
|
-
/**
|
|
23
|
-
* Limit the number of results returned.
|
|
24
|
-
*/
|
|
25
|
-
limit(count: number): this;
|
|
26
|
-
/**
|
|
27
|
-
* Skip the first N results.
|
|
28
|
-
*/
|
|
29
|
-
offset(count: number): this;
|
|
30
|
-
/**
|
|
31
|
-
* Set a free-text search string if supported by the backend.
|
|
32
|
-
*/
|
|
33
|
-
search(searchString: string): this;
|
|
34
|
-
/**
|
|
35
|
-
* Include related entities in the response.
|
|
36
|
-
* Relations will be populated with full entity data instead of just IDs.
|
|
37
|
-
*
|
|
38
|
-
* @param relations - Relation names to include, or "*" for all.
|
|
39
|
-
* @example
|
|
40
|
-
* // Include specific relations
|
|
41
|
-
* client.data.posts.include("tags", "author").find()
|
|
42
|
-
*
|
|
43
|
-
* // Include all relations
|
|
44
|
-
* client.data.posts.include("*").find()
|
|
45
|
-
*/
|
|
46
|
-
include(...relations: string[]): this;
|
|
47
|
-
/**
|
|
48
|
-
* Execute the find query and return the results.
|
|
49
|
-
*/
|
|
50
|
-
find(): Promise<FindResponse<M>>;
|
|
51
|
-
/**
|
|
52
|
-
* Listen to realtime updates matching this query.
|
|
53
|
-
*/
|
|
54
|
-
listen(onUpdate: (data: FindResponse<M>) => void, onError?: (error: Error) => void): () => void;
|
|
55
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { AdditionalFieldDelegate, ArrayProperty, BooleanProperty, DateProperty, EntityCallbacks, EntityCollection, EnumValueConfig, EnumValues, GeopointProperty, MapProperty, NumberProperty, Properties, Property, ReferenceProperty, StringProperty, User } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Identity function we use to defeat the type system of Typescript and build
|
|
4
|
-
* collection views with all its properties
|
|
5
|
-
* @param collection
|
|
6
|
-
* @group Builder
|
|
7
|
-
*/
|
|
8
|
-
export declare function buildCollection<M extends Record<string, unknown> = Record<string, unknown>, USER extends User = User>(collection: EntityCollection<M, USER>): EntityCollection<M, USER>;
|
|
9
|
-
/**
|
|
10
|
-
* Identity function we use to defeat the type system of Typescript and preserve
|
|
11
|
-
* the property keys.
|
|
12
|
-
* @param property
|
|
13
|
-
* @group Builder
|
|
14
|
-
*/
|
|
15
|
-
export declare function buildProperty<T, P extends Property = Property>(property: P): P extends StringProperty ? StringProperty : P extends NumberProperty ? NumberProperty : P extends BooleanProperty ? BooleanProperty : P extends DateProperty ? DateProperty : P extends GeopointProperty ? GeopointProperty : P extends ReferenceProperty ? ReferenceProperty : P extends ArrayProperty ? ArrayProperty : P extends MapProperty ? MapProperty : never;
|
|
16
|
-
/**
|
|
17
|
-
* Identity function we use to defeat the type system of Typescript and preserve
|
|
18
|
-
* the properties keys.
|
|
19
|
-
* @param properties
|
|
20
|
-
* @group Builder
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildProperties<M extends Record<string, unknown>>(properties: Properties): Properties;
|
|
23
|
-
/**
|
|
24
|
-
* Identity function we use to defeat the type system of Typescript and preserve
|
|
25
|
-
* the properties keys.
|
|
26
|
-
* @param propertiesOrBuilder
|
|
27
|
-
* @group Builder
|
|
28
|
-
*/
|
|
29
|
-
export declare function buildPropertiesOrBuilder<M extends Record<string, unknown>>(propertiesOrBuilder: Properties): Properties;
|
|
30
|
-
/**
|
|
31
|
-
* Identity function we use to defeat the type system of Typescript and preserve
|
|
32
|
-
* the properties keys.
|
|
33
|
-
* @param enumValues
|
|
34
|
-
* @group Builder
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildEnum(enumValues: EnumValues): EnumValues;
|
|
37
|
-
/**
|
|
38
|
-
* Identity function we use to defeat the type system of Typescript and preserve
|
|
39
|
-
* the properties keys.
|
|
40
|
-
* @param enumValueConfig
|
|
41
|
-
* @group Builder
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildEnumValueConfig(enumValueConfig: EnumValueConfig): EnumValueConfig;
|
|
44
|
-
/**
|
|
45
|
-
* Identity function we use to defeat the type system of Typescript and preserve
|
|
46
|
-
* the properties keys.
|
|
47
|
-
* @param callbacks
|
|
48
|
-
* @group Builder
|
|
49
|
-
*/
|
|
50
|
-
export declare function buildEntityCallbacks<M extends Record<string, unknown> = Record<string, unknown>>(callbacks: EntityCallbacks<M>): EntityCallbacks<M>;
|
|
51
|
-
/**
|
|
52
|
-
* Identity function we use to defeat the type system of Typescript and build
|
|
53
|
-
* additional field delegates views with all its properties
|
|
54
|
-
* @param additionalFieldDelegate
|
|
55
|
-
* @group Builder
|
|
56
|
-
*/
|
|
57
|
-
export declare function buildAdditionalFieldDelegate<M extends Record<string, unknown>, USER extends User = User>(additionalFieldDelegate: AdditionalFieldDelegate<M, USER>): AdditionalFieldDelegate<M, USER>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { EntityCallbacks, Properties } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Helper function to extract field-level PropertyCallbacks from a properties schema
|
|
4
|
-
* and wrap them into an EntityCallbacks object recursively.
|
|
5
|
-
*/
|
|
6
|
-
export declare const buildPropertyCallbacks: (properties: Properties) => EntityCallbacks | undefined;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DefaultSelectedViewBuilder, DefaultSelectedViewParams, EntityCollection, Properties } from "@rebasepro/types";
|
|
2
|
-
export declare function sortProperties<M extends Record<string, unknown>>(properties: Properties, propertiesOrder?: string[]): Properties;
|
|
3
|
-
export declare function resolveDefaultSelectedView(defaultSelectedView: string | DefaultSelectedViewBuilder | undefined, params: DefaultSelectedViewParams): string | undefined;
|
|
4
|
-
export declare function getLocalChangesBackup(collection: EntityCollection): "manual_apply" | "auto_apply";
|
|
5
|
-
/**
|
|
6
|
-
* Returns the primary keys for an entity collection by inspecting the properties
|
|
7
|
-
* and finding any properties with `isId`.
|
|
8
|
-
* Fallbacks to `["id"]` if no properties are marked as `isId: true`.
|
|
9
|
-
* @param collection
|
|
10
|
-
*/
|
|
11
|
-
export declare function getPrimaryKeys<M extends Record<string, unknown>>(collection: EntityCollection<M>): Extract<keyof M, string>[];
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AuthController, ConditionContext, JsonLogicRule, Property } from "@rebasepro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Register custom JSON Logic operations for Rebase.
|
|
4
|
-
* Call this once at app initialization.
|
|
5
|
-
*/
|
|
6
|
-
export declare function registerConditionOperations(): void;
|
|
7
|
-
/**
|
|
8
|
-
* Evaluate a JSON Logic rule against the given context.
|
|
9
|
-
*/
|
|
10
|
-
export declare function evaluateCondition(rule: JsonLogicRule, context: ConditionContext): unknown;
|
|
11
|
-
/**
|
|
12
|
-
* Build a ConditionContext from the current property resolution context.
|
|
13
|
-
*/
|
|
14
|
-
export declare function buildConditionContext(params: {
|
|
15
|
-
propertyKey?: string;
|
|
16
|
-
values?: Record<string, unknown>;
|
|
17
|
-
previousValues?: Record<string, unknown>;
|
|
18
|
-
path: string;
|
|
19
|
-
entityId?: string;
|
|
20
|
-
index?: number;
|
|
21
|
-
authController: AuthController;
|
|
22
|
-
}): ConditionContext;
|
|
23
|
-
/**
|
|
24
|
-
* Apply PropertyConditions to a resolved property, evaluating all JSON Logic rules.
|
|
25
|
-
*/
|
|
26
|
-
export declare function applyPropertyConditions(property: Property, context: ConditionContext): Property;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { DataType, Entity, EntityReference, EntityRelation, EntityStatus, EntityValues, Properties, Property } from "@rebasepro/types";
|
|
2
|
-
export declare function isReadOnly(property: Property): boolean;
|
|
3
|
-
export declare function isHidden(property: Property): boolean;
|
|
4
|
-
export declare function isPropertyBuilder(property?: Property): boolean;
|
|
5
|
-
export declare function getDefaultValuesFor<M extends Record<string, unknown>>(properties: Properties): Partial<EntityValues<M>>;
|
|
6
|
-
export declare function getDefaultValueFor(property?: Property): unknown;
|
|
7
|
-
export declare function getDefaultValueFortype(type: DataType): unknown;
|
|
8
|
-
/**
|
|
9
|
-
* Update the automatic values in an entity before save
|
|
10
|
-
* @group Driver
|
|
11
|
-
*/
|
|
12
|
-
export declare function updateDateAutoValues<M extends Record<string, unknown>>({ inputValues, properties, status, timestampNowValue }: {
|
|
13
|
-
inputValues: Partial<EntityValues<M>>;
|
|
14
|
-
properties: Properties;
|
|
15
|
-
status: EntityStatus;
|
|
16
|
-
timestampNowValue: unknown;
|
|
17
|
-
}): EntityValues<M>;
|
|
18
|
-
/**
|
|
19
|
-
* Add missing required fields, expected in the collection, to the values of an entity
|
|
20
|
-
* @param values
|
|
21
|
-
* @param properties
|
|
22
|
-
* @group Driver
|
|
23
|
-
*/
|
|
24
|
-
export declare function sanitizeData<M extends Record<string, unknown>>(values: EntityValues<M>, properties: Properties): Record<string, unknown>;
|
|
25
|
-
export declare function getReferenceFrom<M extends Record<string, unknown>>(entity: Entity<M>): EntityReference;
|
|
26
|
-
export declare function getRelationFrom<M extends Record<string, unknown>>(entity: Entity<M>): EntityRelation;
|
|
27
|
-
/**
|
|
28
|
-
* Normalize a value into a proper EntityRelation instance.
|
|
29
|
-
* Handles EntityRelation class instances, and plain objects
|
|
30
|
-
* with `__type === "relation"` or an `isEntityRelation()` method.
|
|
31
|
-
*
|
|
32
|
-
* Returns null if the value cannot be coerced.
|
|
33
|
-
*/
|
|
34
|
-
export declare function normalizeToEntityRelation(value: unknown): EntityRelation | null;
|
|
35
|
-
export declare function traverseValuesProperties<M extends Record<string, unknown>>(inputValues: Partial<EntityValues<M>>, properties: Properties, operation: (value: unknown, property: Property) => unknown): EntityValues<M> | undefined;
|
|
36
|
-
export declare function traverseValueProperty(inputValue: unknown, property: Property, operation: (value: unknown, property: Property) => unknown): unknown;
|
|
37
|
-
/**
|
|
38
|
-
* Relation reference types used throughout the server layer.
|
|
39
|
-
* These replace the 50+ manual `{ id, path, __type: "relation" }` constructions.
|
|
40
|
-
*/
|
|
41
|
-
export interface RelationRef {
|
|
42
|
-
readonly id: string | number;
|
|
43
|
-
readonly path: string;
|
|
44
|
-
readonly __type: "relation";
|
|
45
|
-
}
|
|
46
|
-
export interface RelationRefWithData extends RelationRef {
|
|
47
|
-
readonly data: Entity;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Create a lightweight relation stub for CMS views.
|
|
51
|
-
* Replaces inline `{ id, path, __type: "relation" }` object literals.
|
|
52
|
-
*/
|
|
53
|
-
export declare function createRelationRef(id: string | number, path: string): RelationRef;
|
|
54
|
-
/**
|
|
55
|
-
* Create a hydrated relation reference that includes the full entity data.
|
|
56
|
-
* Used when entity data has been pre-fetched (e.g., via batch loading or JOINs).
|
|
57
|
-
*/
|
|
58
|
-
export declare function createRelationRefWithData(id: string | number, path: string, data: Entity): RelationRefWithData;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { EnumValueConfig, EnumValues } from "@rebasepro/types";
|
|
2
|
-
export declare function enumToObjectEntries(enumValues: EnumValues): EnumValueConfig[];
|
|
3
|
-
export declare function getLabelOrConfigFrom(enumValues: EnumValueConfig[], key?: string | number): EnumValueConfig | undefined;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./collections";
|
|
2
|
-
export * from "./common";
|
|
3
|
-
export * from "./entities";
|
|
4
|
-
export * from "./enums";
|
|
5
|
-
export * from "./paths";
|
|
6
|
-
export * from "./resolutions";
|
|
7
|
-
export * from "./permissions";
|
|
8
|
-
export * from "./references";
|
|
9
|
-
export * from "./navigation_from_path";
|
|
10
|
-
export * from "./parent_references_from_path";
|
|
11
|
-
export * from "./builders";
|
|
12
|
-
export * from "./storage";
|
|
13
|
-
export * from "./callbacks";
|
|
14
|
-
export * from "./relations";
|
|
15
|
-
export * from "./conditions";
|
|
16
|
-
export * from "./navigation_utils";
|