@rebasepro/sdk-generator 0.0.1-canary.4d4fb3e

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.
Files changed (84) hide show
  1. package/LICENSE +6 -0
  2. package/dist/common/src/collections/CollectionRegistry.d.ts +48 -0
  3. package/dist/common/src/collections/index.d.ts +1 -0
  4. package/dist/common/src/data/buildRebaseData.d.ts +14 -0
  5. package/dist/common/src/index.d.ts +3 -0
  6. package/dist/common/src/util/builders.d.ts +57 -0
  7. package/dist/common/src/util/callbacks.d.ts +6 -0
  8. package/dist/common/src/util/collections.d.ts +11 -0
  9. package/dist/common/src/util/common.d.ts +2 -0
  10. package/dist/common/src/util/conditions.d.ts +26 -0
  11. package/dist/common/src/util/entities.d.ts +36 -0
  12. package/dist/common/src/util/enums.d.ts +3 -0
  13. package/dist/common/src/util/index.d.ts +16 -0
  14. package/dist/common/src/util/navigation_from_path.d.ts +34 -0
  15. package/dist/common/src/util/navigation_utils.d.ts +20 -0
  16. package/dist/common/src/util/parent_references_from_path.d.ts +6 -0
  17. package/dist/common/src/util/paths.d.ts +14 -0
  18. package/dist/common/src/util/permissions.d.ts +5 -0
  19. package/dist/common/src/util/references.d.ts +2 -0
  20. package/dist/common/src/util/relations.d.ts +12 -0
  21. package/dist/common/src/util/resolutions.d.ts +72 -0
  22. package/dist/common/src/util/storage.d.ts +24 -0
  23. package/dist/index.cjs +211 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.es.js +208 -0
  26. package/dist/index.es.js.map +1 -0
  27. package/dist/sdk-generator/src/generate-types.d.ts +2 -0
  28. package/dist/sdk-generator/src/index.d.ts +19 -0
  29. package/dist/sdk-generator/src/utils.d.ts +22 -0
  30. package/dist/types/src/controllers/analytics_controller.d.ts +7 -0
  31. package/dist/types/src/controllers/auth.d.ts +117 -0
  32. package/dist/types/src/controllers/client.d.ts +58 -0
  33. package/dist/types/src/controllers/collection_registry.d.ts +44 -0
  34. package/dist/types/src/controllers/customization_controller.d.ts +54 -0
  35. package/dist/types/src/controllers/data.d.ts +141 -0
  36. package/dist/types/src/controllers/data_driver.d.ts +168 -0
  37. package/dist/types/src/controllers/database_admin.d.ts +11 -0
  38. package/dist/types/src/controllers/dialogs_controller.d.ts +36 -0
  39. package/dist/types/src/controllers/effective_role.d.ts +4 -0
  40. package/dist/types/src/controllers/index.d.ts +17 -0
  41. package/dist/types/src/controllers/local_config_persistence.d.ts +20 -0
  42. package/dist/types/src/controllers/navigation.d.ts +213 -0
  43. package/dist/types/src/controllers/registry.d.ts +51 -0
  44. package/dist/types/src/controllers/side_dialogs_controller.d.ts +67 -0
  45. package/dist/types/src/controllers/side_entity_controller.d.ts +89 -0
  46. package/dist/types/src/controllers/snackbar.d.ts +24 -0
  47. package/dist/types/src/controllers/storage.d.ts +173 -0
  48. package/dist/types/src/index.d.ts +4 -0
  49. package/dist/types/src/rebase_context.d.ts +101 -0
  50. package/dist/types/src/types/backend.d.ts +533 -0
  51. package/dist/types/src/types/builders.d.ts +14 -0
  52. package/dist/types/src/types/chips.d.ts +5 -0
  53. package/dist/types/src/types/collections.d.ts +812 -0
  54. package/dist/types/src/types/data_source.d.ts +64 -0
  55. package/dist/types/src/types/entities.d.ts +145 -0
  56. package/dist/types/src/types/entity_actions.d.ts +98 -0
  57. package/dist/types/src/types/entity_callbacks.d.ts +173 -0
  58. package/dist/types/src/types/entity_link_builder.d.ts +7 -0
  59. package/dist/types/src/types/entity_overrides.d.ts +9 -0
  60. package/dist/types/src/types/entity_views.d.ts +61 -0
  61. package/dist/types/src/types/export_import.d.ts +21 -0
  62. package/dist/types/src/types/index.d.ts +22 -0
  63. package/dist/types/src/types/locales.d.ts +4 -0
  64. package/dist/types/src/types/modify_collections.d.ts +5 -0
  65. package/dist/types/src/types/plugins.d.ts +225 -0
  66. package/dist/types/src/types/properties.d.ts +1091 -0
  67. package/dist/types/src/types/property_config.d.ts +70 -0
  68. package/dist/types/src/types/relations.d.ts +336 -0
  69. package/dist/types/src/types/slots.d.ts +228 -0
  70. package/dist/types/src/types/translations.d.ts +826 -0
  71. package/dist/types/src/types/user_management_delegate.d.ts +120 -0
  72. package/dist/types/src/types/websockets.d.ts +78 -0
  73. package/dist/types/src/users/index.d.ts +2 -0
  74. package/dist/types/src/users/roles.d.ts +22 -0
  75. package/dist/types/src/users/user.d.ts +46 -0
  76. package/jest.config.cjs +13 -0
  77. package/package.json +51 -0
  78. package/src/generate-types.ts +176 -0
  79. package/src/index.ts +71 -0
  80. package/src/json-logic-js.d.ts +8 -0
  81. package/src/utils.ts +42 -0
  82. package/test/sdk-generator.test.ts +78 -0
  83. package/tsconfig.json +26 -0
  84. package/vite.config.ts +49 -0
package/LICENSE ADDED
@@ -0,0 +1,6 @@
1
+ Source code in this repository is variously licensed under the Business Source
2
+ License 1.1 (BSL), Apache version 2.0 and the MIT license. A copy of each
3
+ license can be found in each one of the packages under the folder packages
4
+ under a file called License. Source code in a given file is licensed under the
5
+ BSL and the copyright belongs to Rebase Authors unless otherwise noted at the
6
+ beginning of the file.
@@ -0,0 +1,48 @@
1
+ import { EntityCollection } from "@rebasepro/types";
2
+ export declare class CollectionRegistry {
3
+ private collectionsByTableName;
4
+ private collectionsBySlug;
5
+ private rootCollections;
6
+ private rawCollectionsByTableName;
7
+ private rawCollectionsBySlug;
8
+ private rawRootCollections;
9
+ private lastRawInputSnapshot;
10
+ constructor(collections?: EntityCollection[]);
11
+ reset(): void;
12
+ /**
13
+ * Registers a collection and its subcollections recursively.
14
+ * Returns true if the collections have changed, false otherwise.
15
+ *
16
+ * Idempotent: compares the raw input (before normalization) against a stored
17
+ * snapshot. Only re-normalizes and re-registers when the raw input actually changed.
18
+ * @param collections
19
+ */
20
+ registerMultiple(collections: EntityCollection[]): boolean;
21
+ register(collection: EntityCollection, rawCollection?: EntityCollection): void;
22
+ private _registerRecursively;
23
+ normalizeCollection(collection: EntityCollection): EntityCollection;
24
+ private normalizeProperties;
25
+ private normalizeProperty;
26
+ get(path: string): EntityCollection | undefined;
27
+ /**
28
+ * Gets the pristine, un-normalized collection exactly as it was provided.
29
+ * Useful for the AST editor so it doesn't accidentally serialize injected metadata back to disk.
30
+ */
31
+ getRaw(path: string): EntityCollection | undefined;
32
+ /**
33
+ * Get collection by resolving multi-segment paths through relations
34
+ * e.g., "authors/70/posts" resolves to the posts collection
35
+ */
36
+ getCollectionByPath(collectionPath: string): EntityCollection | undefined;
37
+ getCollections(): EntityCollection[];
38
+ getRawCollections(): EntityCollection[];
39
+ /**
40
+ * Resolves a multi-segment path like "products/123/locales" and returns
41
+ * information about the collections and entity IDs along the path
42
+ */
43
+ resolvePathToCollections(path: string): {
44
+ collections: EntityCollection[];
45
+ entityIds: (string | number)[];
46
+ finalCollection: EntityCollection;
47
+ };
48
+ }
@@ -0,0 +1 @@
1
+ export * from "./CollectionRegistry";
@@ -0,0 +1,14 @@
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;
@@ -0,0 +1,3 @@
1
+ export * from "./util";
2
+ export * from "./collections";
3
+ export * from "./data/buildRebaseData";
@@ -0,0 +1,57 @@
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>;
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,11 @@
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>[];
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_ONE_OF_TYPE = "type";
2
+ export declare const DEFAULT_ONE_OF_VALUE = "value";
@@ -0,0 +1,26 @@
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;
@@ -0,0 +1,36 @@
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): {} | null | undefined;
7
+ export declare function getDefaultValueFortype(type: DataType): {} | null;
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;
@@ -0,0 +1,3 @@
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;
@@ -0,0 +1,16 @@
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";
@@ -0,0 +1,34 @@
1
+ import { EntityCollection } from "@rebasepro/types";
2
+ type EntityCustomView<M extends Record<string, unknown> = Record<string, unknown>> = {
3
+ key: string;
4
+ [key: string]: unknown;
5
+ };
6
+ export type NavigationViewInternal<M extends Record<string, unknown> = Record<string, unknown>> = NavigationViewEntityInternal<M> | NavigationViewCollectionInternal<M> | NavigationViewEntityCustomInternal<M>;
7
+ export interface NavigationViewEntityInternal<M extends Record<string, unknown>> {
8
+ type: "entity";
9
+ entityId: string | number;
10
+ slug: string;
11
+ path: string;
12
+ parentCollection: EntityCollection<M>;
13
+ }
14
+ export interface NavigationViewCollectionInternal<M extends Record<string, unknown>> {
15
+ type: "collection";
16
+ id: string;
17
+ slug: string;
18
+ path: string;
19
+ collection: EntityCollection<M>;
20
+ }
21
+ export interface NavigationViewEntityCustomInternal<M extends Record<string, unknown>> {
22
+ type: "custom_view";
23
+ slug: string;
24
+ path: string;
25
+ entityId: string | number;
26
+ view: EntityCustomView<M>;
27
+ }
28
+ export declare function getNavigationEntriesFromPath(props: {
29
+ path: string;
30
+ collections: EntityCollection[] | undefined;
31
+ currentFullPath?: string;
32
+ contextEntityViews?: EntityCustomView[];
33
+ }): NavigationViewInternal[];
34
+ export {};
@@ -0,0 +1,20 @@
1
+ import { EntityCollection } from "@rebasepro/types";
2
+ export declare function removeInitialAndTrailingSlashes(s: string): string;
3
+ export declare function removeInitialSlash(s: string): string;
4
+ export declare function removeTrailingSlash(s: string): string;
5
+ export declare function addInitialSlash(s: string): string;
6
+ export declare function getLastSegment(path: string): string;
7
+ export declare function resolveCollectionPathIds(path: string, allCollections: EntityCollection[]): string;
8
+ /**
9
+ * Find the corresponding view at any depth for a given path.
10
+ * Note that path or segments of the paths can be collection aliases.
11
+ * @param slugOrPath
12
+ * @param collections
13
+ */
14
+ export declare function getCollectionBySlugWithin(slugOrPath: string, collections: EntityCollection[]): EntityCollection | undefined;
15
+ /**
16
+ * Get the subcollection combinations from a path:
17
+ * "sites/es/locales" => ["sites/es/locales", "sites"]
18
+ * @param subpaths
19
+ */
20
+ export declare function getCollectionPathsCombinations(subpaths: string[]): string[];
@@ -0,0 +1,6 @@
1
+ import { EntityCollection, EntityReference } from "@rebasepro/types";
2
+ export declare function getParentReferencesFromPath(props: {
3
+ path: string;
4
+ collections: EntityCollection[] | undefined;
5
+ currentFullPath?: string;
6
+ }): EntityReference[];
@@ -0,0 +1,14 @@
1
+ export declare const COLLECTION_PATH_SEPARATOR = "::";
2
+ /**
3
+ * Remove the entity ids from a given path
4
+ * `products/B44RG6APH/locales` => `products::locales`
5
+ * @param path
6
+ */
7
+ export declare function stripCollectionPath(path: string): string;
8
+ export declare function segmentsToStrippedPath(paths: string[]): string;
9
+ /**
10
+ * Extract the collection path routes
11
+ * `products/B44RG6APH/locales` => [`products`, `locales`]
12
+ * @param path
13
+ */
14
+ export declare function fullPathToCollectionSegments(path: string): string[];
@@ -0,0 +1,5 @@
1
+ import { AuthController, Entity, EntityCollection, User } from "@rebasepro/types";
2
+ export declare function canReadCollection<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>): boolean;
3
+ export declare function canEditEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>, path: string, entity: Entity<M> | null): boolean;
4
+ export declare function canCreateEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>, path: string, entity: Entity<M> | null): boolean;
5
+ export declare function canDeleteEntity<M extends Record<string, unknown>, USER extends User>(collection: EntityCollection<M>, authController: AuthController<USER>, path: string, entity: Entity<M> | null): boolean;
@@ -0,0 +1,2 @@
1
+ import { EntityCollection } from "@rebasepro/types";
2
+ export declare function getEntityImagePreviewPropertyKey<M extends Record<string, unknown>>(collection: EntityCollection<M>): string | undefined;
@@ -0,0 +1,12 @@
1
+ import { EntityCollection, PostgresCollection, Property, Relation } from "@rebasepro/types";
2
+ export declare function sanitizeRelation(relation: Partial<Relation>, sourceCollection: PostgresCollection): Relation;
3
+ export declare function resolveCollectionRelations(collection: PostgresCollection): Record<string, Relation>;
4
+ export declare function resolvePropertyRelation({ propertyKey, property, sourceCollection }: {
5
+ propertyKey: string;
6
+ property: Property;
7
+ sourceCollection: PostgresCollection;
8
+ }): Relation | undefined;
9
+ export declare function getTableName(collection: EntityCollection): string;
10
+ export declare function getTableVarName(tableName: string): string;
11
+ export declare function getEnumVarName(tableName: string, propName: string): string;
12
+ export declare function getColumnName(fullColumn: string): string;
@@ -0,0 +1,72 @@
1
+ import { ArrayProperty, AuthController, EntityCollection, EnumValueConfig, EnumValues, NumberProperty, Properties, Property, Relation, RelationProperty, StringProperty } from "@rebasepro/types";
2
+ type PropertyConfig = {
3
+ property: unknown;
4
+ [key: string]: unknown;
5
+ };
6
+ /**
7
+ * Resolve property builders, enums and arrays.
8
+ */
9
+ export type ResolvePropertyProps<M extends Record<string, unknown> = Record<string, unknown>> = {
10
+ property: Property;
11
+ propertyKey?: string;
12
+ values?: Partial<M>;
13
+ previousValues?: Partial<M>;
14
+ path?: string;
15
+ entityId?: string | number;
16
+ index?: number;
17
+ propertyConfigs?: Record<string, PropertyConfig>;
18
+ ignoreMissingFields?: boolean;
19
+ authController: AuthController;
20
+ };
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;
23
+ /**
24
+ * Resolve enum aliases for a string or number property
25
+ * @param property
26
+ */
27
+ export declare function resolvePropertyEnum(property: StringProperty | NumberProperty): StringProperty | NumberProperty;
28
+ /**
29
+ * Resolve enums and arrays for properties
30
+ * @param properties
31
+ * @param value
32
+ */
33
+ export declare function resolveProperties<M extends Record<string, unknown>>({ propertyKey, properties, ignoreMissingFields, ...props }: {
34
+ propertyKey?: string;
35
+ properties: Properties;
36
+ values?: Partial<M>;
37
+ previousValues?: Partial<M>;
38
+ path?: string;
39
+ entityId?: string | number;
40
+ index?: number;
41
+ propertyConfigs?: Record<string, PropertyConfig>;
42
+ ignoreMissingFields?: boolean;
43
+ authController: AuthController;
44
+ }): Properties;
45
+ export declare function resolveArrayProperties<M>({ propertyKey, property, ignoreMissingFields, ...props }: {
46
+ propertyKey?: string;
47
+ property: ArrayProperty;
48
+ values?: Partial<M>;
49
+ previousValues?: Partial<M>;
50
+ path?: string;
51
+ entityId?: string | number;
52
+ index?: number;
53
+ propertyConfigs?: Record<string, PropertyConfig>;
54
+ ignoreMissingFields?: boolean;
55
+ authController: AuthController;
56
+ }): Property[];
57
+ export declare function getArrayResolvedProperties({ propertyKey, propertyValue, property, ...props }: {
58
+ propertyValue: unknown;
59
+ propertyKey?: string;
60
+ property: ArrayProperty;
61
+ ignoreMissingFields: boolean;
62
+ values?: object;
63
+ previousValues?: object;
64
+ path?: string;
65
+ entityId?: string | number;
66
+ index?: number;
67
+ propertyConfigs?: Record<string, PropertyConfig>;
68
+ authController: AuthController;
69
+ }): Property[];
70
+ export declare function resolveEnumValues(input: EnumValues): EnumValueConfig[] | undefined;
71
+ export declare function getSubcollections<M extends Record<string, unknown> = Record<string, unknown>>(collection: EntityCollection<M>): EntityCollection<Record<string, unknown>>[];
72
+ export {};
@@ -0,0 +1,24 @@
1
+ import { ArrayProperty, EntityValues, StorageConfig, StringProperty, UploadedFileContext } from "@rebasepro/types";
2
+ interface ResolveFilenameStringParams<M extends Record<string, unknown>> {
3
+ input: string | ((context: UploadedFileContext) => (Promise<string> | string));
4
+ storage: StorageConfig;
5
+ values: EntityValues<M>;
6
+ entityId?: string | number;
7
+ path?: string;
8
+ property: StringProperty | ArrayProperty;
9
+ file: File;
10
+ propertyKey: string;
11
+ }
12
+ export declare function resolveStorageFilenameString<M extends Record<string, unknown>>({ input, storage, values, entityId, path, property, file, propertyKey }: ResolveFilenameStringParams<M>): Promise<string>;
13
+ interface ResolveStoragePathStringParams<M extends Record<string, unknown>> {
14
+ input: string | ((context: UploadedFileContext) => string);
15
+ storage: StorageConfig;
16
+ values: EntityValues<M>;
17
+ entityId?: string | number;
18
+ path?: string;
19
+ property: StringProperty | ArrayProperty;
20
+ file: File;
21
+ propertyKey: string;
22
+ }
23
+ export declare function resolveStoragePathString<M extends Record<string, unknown>>({ input, storage, values, entityId, path, property, file, propertyKey }: ResolveStoragePathStringParams<M>): string;
24
+ export {};