@rebasepro/server-core 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e
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/common/src/collections/CollectionRegistry.d.ts +8 -0
- package/dist/common/src/util/entities.d.ts +22 -0
- package/dist/common/src/util/relations.d.ts +14 -4
- package/dist/common/src/util/resolutions.d.ts +1 -1
- package/dist/index-DXVBFp5V.js +37 -0
- package/dist/index-DXVBFp5V.js.map +1 -0
- package/dist/index.es.js +49931 -55
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +28475 -34569
- package/dist/index.umd.js.map +1 -1
- package/dist/server-core/src/api/openapi-generator.d.ts +15 -1
- package/dist/server-core/src/api/types.d.ts +1 -1
- package/dist/server-core/src/auth/admin-routes.d.ts +10 -1
- package/dist/server-core/src/auth/apple-oauth.d.ts +30 -0
- package/dist/server-core/src/auth/bitbucket-oauth.d.ts +11 -0
- package/dist/server-core/src/auth/discord-oauth.d.ts +14 -0
- package/dist/server-core/src/auth/facebook-oauth.d.ts +14 -0
- package/dist/server-core/src/auth/github-oauth.d.ts +15 -0
- package/dist/server-core/src/auth/gitlab-oauth.d.ts +13 -0
- package/dist/server-core/src/auth/google-oauth.d.ts +5 -11
- package/dist/server-core/src/auth/index.d.ts +13 -2
- package/dist/server-core/src/auth/interfaces.d.ts +45 -6
- package/dist/server-core/src/auth/jwt.d.ts +1 -0
- package/dist/server-core/src/auth/linkedin-oauth.d.ts +18 -0
- package/dist/server-core/src/auth/microsoft-oauth.d.ts +16 -0
- package/dist/server-core/src/auth/middleware.d.ts +36 -11
- package/dist/server-core/src/auth/rate-limiter.d.ts +2 -2
- package/dist/server-core/src/auth/routes.d.ts +13 -3
- package/dist/server-core/src/auth/slack-oauth.d.ts +12 -0
- package/dist/server-core/src/auth/spotify-oauth.d.ts +12 -0
- package/dist/server-core/src/auth/twitter-oauth.d.ts +18 -0
- package/dist/server-core/src/cron/cron-loader.d.ts +17 -0
- package/dist/server-core/src/cron/cron-routes.d.ts +14 -0
- package/dist/server-core/src/cron/cron-scheduler.d.ts +61 -0
- package/dist/server-core/src/cron/cron-store.d.ts +32 -0
- package/dist/server-core/src/cron/index.d.ts +6 -0
- package/dist/server-core/src/email/index.d.ts +2 -2
- package/dist/server-core/src/email/templates.d.ts +9 -0
- package/dist/server-core/src/email/types.d.ts +20 -23
- package/dist/server-core/src/history/history-routes.d.ts +2 -2
- package/dist/server-core/src/index.d.ts +5 -0
- package/dist/server-core/src/init.d.ts +112 -2
- package/dist/server-core/src/singleton.d.ts +35 -0
- package/dist/server-core/src/storage/LocalStorageController.d.ts +9 -9
- package/dist/server-core/src/storage/S3StorageController.d.ts +8 -8
- package/dist/server-core/src/storage/index.d.ts +18 -11
- package/dist/server-core/src/storage/routes.d.ts +3 -3
- package/dist/server-core/src/storage/types.d.ts +28 -16
- package/dist/server-core/src/utils/dev-port.d.ts +35 -0
- package/dist/server-core/src/utils/logger.d.ts +31 -0
- package/dist/server-core/src/utils/request-logger.d.ts +19 -0
- package/dist/types/src/controllers/auth.d.ts +2 -0
- package/dist/types/src/controllers/client.d.ts +119 -7
- package/dist/types/src/controllers/collection_registry.d.ts +4 -3
- package/dist/types/src/controllers/customization_controller.d.ts +7 -1
- package/dist/types/src/controllers/data.d.ts +34 -7
- package/dist/types/src/controllers/data_driver.d.ts +20 -28
- package/dist/types/src/controllers/database_admin.d.ts +2 -2
- package/dist/types/src/controllers/email.d.ts +34 -0
- package/dist/types/src/controllers/index.d.ts +1 -0
- package/dist/types/src/controllers/local_config_persistence.d.ts +4 -4
- package/dist/types/src/controllers/navigation.d.ts +5 -5
- package/dist/types/src/controllers/registry.d.ts +6 -3
- package/dist/types/src/controllers/side_entity_controller.d.ts +7 -6
- package/dist/types/src/controllers/storage.d.ts +24 -26
- package/dist/types/src/rebase_context.d.ts +8 -4
- package/dist/types/src/types/backend.d.ts +4 -1
- package/dist/types/src/types/builders.d.ts +5 -4
- package/dist/types/src/types/chips.d.ts +1 -1
- package/dist/types/src/types/collections.d.ts +169 -125
- package/dist/types/src/types/cron.d.ts +102 -0
- package/dist/types/src/types/data_source.d.ts +1 -1
- package/dist/types/src/types/entity_actions.d.ts +8 -8
- package/dist/types/src/types/entity_callbacks.d.ts +15 -15
- package/dist/types/src/types/entity_link_builder.d.ts +1 -1
- package/dist/types/src/types/entity_overrides.d.ts +2 -1
- package/dist/types/src/types/entity_views.d.ts +8 -8
- package/dist/types/src/types/export_import.d.ts +3 -3
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/plugins.d.ts +72 -18
- package/dist/types/src/types/properties.d.ts +118 -33
- package/dist/types/src/types/relations.d.ts +1 -1
- package/dist/types/src/types/slots.d.ts +30 -6
- package/dist/types/src/types/translations.d.ts +44 -0
- package/dist/types/src/types/user_management_delegate.d.ts +1 -0
- package/package.json +84 -84
- package/scratch.ts +6 -5
- package/src/api/ast-schema-editor.ts +11 -11
- package/src/api/collections_for_test/callbacks_test_collection.ts +5 -2
- package/src/api/errors.ts +38 -14
- package/src/api/graphql/graphql-schema-generator.ts +5 -3
- package/src/api/openapi-generator.ts +613 -58
- package/src/api/rest/api-generator.ts +17 -11
- package/src/api/rest/query-parser.ts +1 -1
- package/src/api/schema-editor-routes.ts +2 -0
- package/src/api/server.ts +8 -5
- package/src/api/types.ts +1 -1
- package/src/auth/admin-routes.ts +58 -17
- package/src/auth/apple-oauth.ts +130 -0
- package/src/auth/bitbucket-oauth.ts +82 -0
- package/src/auth/discord-oauth.ts +83 -0
- package/src/auth/facebook-oauth.ts +72 -0
- package/src/auth/github-oauth.ts +110 -0
- package/src/auth/gitlab-oauth.ts +70 -0
- package/src/auth/google-oauth.ts +34 -46
- package/src/auth/index.ts +15 -2
- package/src/auth/interfaces.ts +54 -7
- package/src/auth/jwt.ts +22 -5
- package/src/auth/linkedin-oauth.ts +81 -0
- package/src/auth/microsoft-oauth.ts +88 -0
- package/src/auth/middleware.ts +194 -45
- package/src/auth/password.ts +3 -1
- package/src/auth/rate-limiter.ts +4 -4
- package/src/auth/routes.ts +197 -139
- package/src/auth/slack-oauth.ts +71 -0
- package/src/auth/spotify-oauth.ts +67 -0
- package/src/auth/twitter-oauth.ts +120 -0
- package/src/collections/loader.ts +6 -6
- package/src/cron/cron-loader.ts +89 -0
- package/src/cron/cron-routes.test.ts +265 -0
- package/src/cron/cron-routes.ts +85 -0
- package/src/cron/cron-scheduler.test.ts +421 -0
- package/src/cron/cron-scheduler.ts +413 -0
- package/src/cron/cron-store.ts +163 -0
- package/src/cron/index.ts +6 -0
- package/src/db/interfaces.ts +2 -2
- package/src/email/index.ts +3 -2
- package/src/email/smtp-email-service.ts +5 -2
- package/src/email/templates.ts +93 -6
- package/src/email/types.ts +17 -24
- package/src/functions/function-loader.ts +34 -6
- package/src/functions/function-routes.ts +2 -2
- package/src/history/history-routes.ts +4 -3
- package/src/index.ts +10 -0
- package/src/init.ts +475 -57
- package/src/services/driver-registry.ts +1 -1
- package/src/singleton.test.ts +28 -0
- package/src/singleton.ts +70 -0
- package/src/storage/LocalStorageController.ts +50 -53
- package/src/storage/S3StorageController.ts +49 -46
- package/src/storage/index.ts +27 -16
- package/src/storage/routes.ts +76 -59
- package/src/storage/storage-registry.ts +5 -5
- package/src/storage/types.ts +44 -32
- package/src/types/index.ts +4 -4
- package/src/utils/dev-port.ts +176 -0
- package/src/utils/logger.ts +143 -0
- package/src/utils/logging.ts +5 -2
- package/src/utils/request-logger.ts +66 -0
- package/test/admin-routes.test.ts +114 -65
- package/test/api-generator.test.ts +73 -30
- package/test/ast-schema-editor.test.ts +5 -3
- package/test/auth-middleware-hono.test.ts +268 -33
- package/test/auth-routes.test.ts +325 -146
- package/test/driver-registry.test.ts +4 -2
- package/test/error-propagation.test.ts +226 -0
- package/test/errors.test.ts +12 -7
- package/test/jwt-security.test.ts +18 -9
- package/test/jwt.test.ts +26 -13
- package/test/middleware.test.ts +13 -8
- package/test/query-parser.test.ts +13 -8
- package/test/rate-limiter.test.ts +7 -7
- package/test/safe-compare.test.ts +66 -0
- package/test/singleton.test.ts +59 -0
- package/test/storage-local.test.ts +36 -43
- package/test/storage-registry.test.ts +38 -36
- package/test/storage-routes.test.ts +9 -5
- package/test/storage-s3.test.ts +51 -48
- package/test.ts +6 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +7 -5
- package/dist/index-BeMqpmfQ.js +0 -239
- package/dist/index-BeMqpmfQ.js.map +0 -1
- package/dist/index-bl4J3lNb.js +0 -55823
- package/dist/index-bl4J3lNb.js.map +0 -1
- package/vite.config.ts.timestamp-1775065397568-8a853255edf6e.mjs +0 -46
|
@@ -3,9 +3,11 @@ export declare class CollectionRegistry {
|
|
|
3
3
|
private collectionsByTableName;
|
|
4
4
|
private collectionsBySlug;
|
|
5
5
|
private rootCollections;
|
|
6
|
+
private cachedCollectionsList;
|
|
6
7
|
private rawCollectionsByTableName;
|
|
7
8
|
private rawCollectionsBySlug;
|
|
8
9
|
private rawRootCollections;
|
|
10
|
+
private cachedRawCollectionsList;
|
|
9
11
|
private lastRawInputSnapshot;
|
|
10
12
|
constructor(collections?: EntityCollection[]);
|
|
11
13
|
reset(): void;
|
|
@@ -21,6 +23,12 @@ export declare class CollectionRegistry {
|
|
|
21
23
|
register(collection: EntityCollection, rawCollection?: EntityCollection): void;
|
|
22
24
|
private _registerRecursively;
|
|
23
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;
|
|
24
32
|
private normalizeProperties;
|
|
25
33
|
private normalizeProperty;
|
|
26
34
|
get(path: string): EntityCollection | undefined;
|
|
@@ -34,3 +34,25 @@ export declare function getRelationFrom<M extends Record<string, unknown>>(entit
|
|
|
34
34
|
export declare function normalizeToEntityRelation(value: unknown): EntityRelation | null;
|
|
35
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
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,12 +1,22 @@
|
|
|
1
|
-
import { EntityCollection,
|
|
2
|
-
export declare function sanitizeRelation(relation: Partial<Relation>, sourceCollection:
|
|
3
|
-
export declare function resolveCollectionRelations(collection:
|
|
1
|
+
import { EntityCollection, Property, Relation } from "@rebasepro/types";
|
|
2
|
+
export declare function sanitizeRelation(relation: Partial<Relation>, sourceCollection: EntityCollection): Relation;
|
|
3
|
+
export declare function resolveCollectionRelations(collection: EntityCollection): Record<string, Relation>;
|
|
4
4
|
export declare function resolvePropertyRelation({ propertyKey, property, sourceCollection }: {
|
|
5
5
|
propertyKey: string;
|
|
6
6
|
property: Property;
|
|
7
|
-
sourceCollection:
|
|
7
|
+
sourceCollection: EntityCollection;
|
|
8
8
|
}): Relation | undefined;
|
|
9
9
|
export declare function getTableName(collection: EntityCollection): string;
|
|
10
10
|
export declare function getTableVarName(tableName: string): string;
|
|
11
11
|
export declare function getEnumVarName(tableName: string, propName: string): string;
|
|
12
12
|
export declare function getColumnName(fullColumn: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Look up a relation by key with forgiving normalization.
|
|
15
|
+
*
|
|
16
|
+
* `resolveCollectionRelations` stores each relation under a single canonical
|
|
17
|
+
* key (no aliases). This helper tries the given key as-is, then falls back to
|
|
18
|
+
* slug form (underscores → hyphens) and snake_case form (hyphens → underscores)
|
|
19
|
+
* so that callers that receive a key from external input (URL path segments,
|
|
20
|
+
* user-provided config, etc.) can still find the right entry.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findRelation(resolvedRelations: Record<string, Relation>, key: string): Relation | undefined;
|
|
@@ -19,7 +19,7 @@ export type ResolvePropertyProps<M extends Record<string, unknown> = Record<stri
|
|
|
19
19
|
authController: AuthController;
|
|
20
20
|
};
|
|
21
21
|
export declare function resolveProperty<M extends Record<string, unknown> = Record<string, unknown>>(props: ResolvePropertyProps<M>): Property | null;
|
|
22
|
-
export declare function resolveRelationProperty(property: RelationProperty, relations: Relation[]): RelationProperty;
|
|
22
|
+
export declare function resolveRelationProperty(property: RelationProperty, relations: Relation[], propertyKey?: string): RelationProperty;
|
|
23
23
|
/**
|
|
24
24
|
* Resolve enum aliases for a string or number property
|
|
25
25
|
* @param property
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createGoogleProvider, createLinkedinProvider, createGitHubProvider, createMicrosoftProvider, createAppleProvider, createFacebookProvider, createTwitterProvider, createDiscordProvider, createGitLabProvider, createBitbucketProvider, createSlackProvider, createSpotifyProvider } from "./index.es.js";
|
|
2
|
+
import { configureJwt, createAdminRoutes, createAuthMiddleware, createAuthRoutes, createRateLimiter, defaultAuthLimiter, extractUserFromToken, generateAccessToken, generateRefreshToken, getAccessTokenExpiry, getRefreshTokenExpiry, hashPassword, hashRefreshToken, optionalAuth, requireAdmin, requireAuth, strictAuthLimiter, validatePasswordStrength, verifyAccessToken, verifyPassword } from "./index.es.js";
|
|
3
|
+
export {
|
|
4
|
+
configureJwt,
|
|
5
|
+
createAdminRoutes,
|
|
6
|
+
createAppleProvider,
|
|
7
|
+
createAuthMiddleware,
|
|
8
|
+
createAuthRoutes,
|
|
9
|
+
createBitbucketProvider,
|
|
10
|
+
createDiscordProvider,
|
|
11
|
+
createFacebookProvider,
|
|
12
|
+
createGitHubProvider,
|
|
13
|
+
createGitLabProvider,
|
|
14
|
+
createGoogleProvider,
|
|
15
|
+
createLinkedinProvider,
|
|
16
|
+
createMicrosoftProvider,
|
|
17
|
+
createRateLimiter,
|
|
18
|
+
createSlackProvider,
|
|
19
|
+
createSpotifyProvider,
|
|
20
|
+
createTwitterProvider,
|
|
21
|
+
defaultAuthLimiter,
|
|
22
|
+
extractUserFromToken,
|
|
23
|
+
generateAccessToken,
|
|
24
|
+
generateRefreshToken,
|
|
25
|
+
getAccessTokenExpiry,
|
|
26
|
+
getRefreshTokenExpiry,
|
|
27
|
+
hashPassword,
|
|
28
|
+
hashRefreshToken,
|
|
29
|
+
optionalAuth,
|
|
30
|
+
requireAdmin,
|
|
31
|
+
requireAuth,
|
|
32
|
+
strictAuthLimiter,
|
|
33
|
+
validatePasswordStrength,
|
|
34
|
+
verifyAccessToken,
|
|
35
|
+
verifyPassword
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=index-DXVBFp5V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DXVBFp5V.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|