remult 0.24.0 → 0.24.2-exp.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.
Files changed (88) hide show
  1. package/esm/index.js +3 -2
  2. package/esm/src/data-providers/ipfs-data-provider.js +22 -0
  3. package/esm/src/data-providers/json-data-provider.js +8 -8
  4. package/esm/src/remult3/remult3.js +7 -20
  5. package/index.d.ts +3 -1
  6. package/index.js +5 -3
  7. package/package.json +1 -1
  8. package/src/data-providers/ipfs-data-provider.d.ts +5 -0
  9. package/src/data-providers/ipfs-data-provider.js +60 -0
  10. package/src/data-providers/json-data-provider.d.ts +2 -2
  11. package/src/data-providers/json-data-provider.js +39 -16
  12. package/src/remult3/remult3.d.ts +0 -20
  13. package/src/remult3/remult3.js +7 -20
  14. package/esm/SseSubscriptionServer.d.ts +0 -25
  15. package/esm/ably.d.ts +0 -13
  16. package/esm/assign.d.ts +0 -1
  17. package/esm/classType.d.ts +0 -3
  18. package/esm/graphql.d.ts +0 -14
  19. package/esm/index.d.ts +0 -46
  20. package/esm/inputTypes.d.ts +0 -9
  21. package/esm/internals.d.ts +0 -7
  22. package/esm/live-query/data-provider-live-query-storage.d.ts +0 -23
  23. package/esm/myLog.d.ts +0 -1
  24. package/esm/postgres/index.d.ts +0 -2
  25. package/esm/postgres/postgres-data-provider.d.ts +0 -36
  26. package/esm/postgres/schema-builder.d.ts +0 -20
  27. package/esm/remult-express.d.ts +0 -9
  28. package/esm/remult-fastify.d.ts +0 -6
  29. package/esm/remult-fresh.d.ts +0 -17
  30. package/esm/remult-hapi.d.ts +0 -6
  31. package/esm/remult-knex/index.d.ts +0 -30
  32. package/esm/remult-mongo.d.ts +0 -24
  33. package/esm/remult-next.d.ts +0 -25
  34. package/esm/remult-sveltekit.d.ts +0 -6
  35. package/esm/server/JsonEntityFileStorage.d.ts +0 -11
  36. package/esm/server/core.d.ts +0 -4
  37. package/esm/server/expressBridge.d.ts +0 -136
  38. package/esm/server/index.d.ts +0 -6
  39. package/esm/server/initAsyncHooks.d.ts +0 -1
  40. package/esm/server/initDataProvider.d.ts +0 -2
  41. package/esm/src/CompoundIdField.d.ts +0 -27
  42. package/esm/src/__EntityValueProvider.d.ts +0 -11
  43. package/esm/src/__RowsOfDataForTesting.d.ts +0 -3
  44. package/esm/src/buildRestDataProvider.d.ts +0 -30
  45. package/esm/src/column-interfaces.d.ts +0 -172
  46. package/esm/src/column.d.ts +0 -19
  47. package/esm/src/context.d.ts +0 -134
  48. package/esm/src/data-api.d.ts +0 -39
  49. package/esm/src/data-interfaces.d.ts +0 -41
  50. package/esm/src/data-providers/array-entity-data-provider.d.ts +0 -4
  51. package/esm/src/data-providers/in-memory-database.d.ts +0 -9
  52. package/esm/src/data-providers/json-data-provider.d.ts +0 -12
  53. package/esm/src/data-providers/rest-data-provider.d.ts +0 -39
  54. package/esm/src/data-providers/sql-database.d.ts +0 -33
  55. package/esm/src/data-providers/web-sql-data-provider.d.ts +0 -21
  56. package/esm/src/entity.d.ts +0 -126
  57. package/esm/src/filter/filter-consumer-bridge-to-sql-request.d.ts +0 -51
  58. package/esm/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -0
  59. package/esm/src/filter/filter-consumer-bridge-to-url-builder.js +0 -0
  60. package/esm/src/filter/filter-interfaces.d.ts +0 -74
  61. package/esm/src/live-query/LiveQueryClient.d.ts +0 -1
  62. package/esm/src/live-query/SseSubscriptionClient.d.ts +0 -5
  63. package/esm/src/live-query/SubscriptionChannel.d.ts +0 -41
  64. package/esm/src/live-query/SubscriptionServer.d.ts +0 -38
  65. package/esm/src/remult-proxy.d.ts +0 -2
  66. package/esm/src/remult3/DecoratorReplacer.d.ts +0 -9
  67. package/esm/src/remult3/Fields.d.ts +0 -133
  68. package/esm/src/remult3/IdEntity.d.ts +0 -4
  69. package/esm/src/remult3/RepositoryImplementation.d.ts +0 -289
  70. package/esm/src/remult3/__updateEntityBasedOnWhere.d.ts +0 -2
  71. package/esm/src/remult3/columnInfo.d.ts +0 -6
  72. package/esm/src/remult3/entity.d.ts +0 -28
  73. package/esm/src/remult3/getEntityRef.d.ts +0 -9
  74. package/esm/src/remult3/relation-loader-types.d.ts +0 -7
  75. package/esm/src/remult3/relation-loader.d.ts +0 -40
  76. package/esm/src/remult3/relationInfoMember.d.ts +0 -4
  77. package/esm/src/remult3/remult3.d.ts +0 -604
  78. package/esm/src/remult3/repository-internals.d.ts +0 -14
  79. package/esm/src/resultCompoundIdFilter.d.ts +0 -3
  80. package/esm/src/server-action-info.d.ts +0 -10
  81. package/esm/src/server-action.d.ts +0 -79
  82. package/esm/src/sort.d.ts +0 -16
  83. package/esm/src/sql-command.d.ts +0 -19
  84. package/esm/src/validators.d.ts +0 -14
  85. package/esm/src/valueConverters.d.ts +0 -13
  86. package/esm/urlBuilder.d.ts +0 -6
  87. package/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -0
  88. package/src/filter/filter-consumer-bridge-to-url-builder.js +0 -0
@@ -1,38 +0,0 @@
1
- export interface SubscriptionServer {
2
- publishMessage<T>(channel: string, message: T): Promise<void>;
3
- }
4
- export interface LiveQueryStorage {
5
- add(query: StoredQuery): Promise<void>;
6
- remove(queryId: string): Promise<void>;
7
- forEach(entityKey: string, callback: (args: {
8
- query: StoredQuery;
9
- setData(data: any): Promise<void>;
10
- }) => Promise<void>): Promise<void>;
11
- keepAliveAndReturnUnknownQueryIds(queryIds: string[]): Promise<string[]>;
12
- }
13
- export declare class InMemoryLiveQueryStorage implements LiveQueryStorage {
14
- debugFileSaver: (x: any) => void;
15
- debug(): void;
16
- keepAliveAndReturnUnknownQueryIds(ids: string[]): Promise<string[]>;
17
- queries: (StoredQuery & {
18
- lastUsed: string;
19
- })[];
20
- constructor();
21
- add(query: StoredQuery): Promise<void>;
22
- removeCountForTesting: number;
23
- remove(id: any): Promise<void>;
24
- forEach(entityKey: string, handle: (args: {
25
- query: StoredQuery;
26
- setData(data: any): Promise<void>;
27
- }) => Promise<void>): Promise<void>;
28
- }
29
- export interface StoredQuery {
30
- entityKey: string;
31
- id: string;
32
- data: any;
33
- }
34
- export interface QueryData {
35
- findOptionsJson: any;
36
- requestJson: any;
37
- lastIds: any[];
38
- }
@@ -1,2 +0,0 @@
1
- import type { Remult } from './context';
2
- export declare const remult: Remult;
@@ -1,9 +0,0 @@
1
- type Decorator<T = any> = (a: T, b: string, c?: any) => void;
2
- type Decorators<T> = T extends new (...args: any[]) => infer R ? {
3
- [K in keyof R]?: Decorator;
4
- } : never;
5
- type StaticDecorators<T> = {
6
- [K in keyof T]?: Decorator;
7
- };
8
- export declare function describeClass<classType>(classType: classType, classDecorator: ((x: any, context?: any) => any) | undefined, members?: Decorators<classType> | undefined, staticMembers?: StaticDecorators<classType>): void;
9
- export {};
@@ -1,133 +0,0 @@
1
- import type { ClassType } from '../../classType';
2
- import type { FieldOptions } from '../column-interfaces';
3
- import type { Remult } from '../context';
4
- import type { FindOptions, RelationOptions, ClassFieldDecorator, ClassFieldDecoratorContextStub } from './remult3';
5
- export declare class Fields {
6
- /**
7
- * Stored as a JSON.stringify - to store as json use Fields.json
8
- */
9
- static object<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
10
- static json<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
11
- static dateOnly<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
12
- static date<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
13
- static integer<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
14
- static autoIncrement<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
15
- static number<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, number | undefined>;
16
- static createdAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
17
- static updatedAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, Date | undefined>;
18
- static uuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
19
- static cuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
20
- static string<entityType = any>(...options: (StringFieldOptions<entityType> | ((options: StringFieldOptions<entityType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, string | undefined>;
21
- static boolean<entityType = any>(...options: (FieldOptions<entityType, boolean> | ((options: FieldOptions<entityType, boolean>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, boolean | undefined>;
22
- }
23
- export declare class Relations {
24
- /**
25
- * Define a to-one relation between entities, indicating a one-to-one relationship.
26
- * If no field or fields are provided, it will automatically create a field in the database
27
- * to represent the relation.
28
- *
29
- * @param toEntityType A function that returns the target entity type.
30
- * @param options (Optional): An object containing options for configuring the to-one relation.
31
- * @returns A decorator function to apply the to-one relation to an entity field.
32
- *
33
- * Example usage:
34
- * ```
35
- * @Relations.toOne(() => Customer)
36
- * customer?: Customer;
37
- * ```
38
- * ```
39
- * Fields.string()
40
- * customerId?: string;
41
- *
42
- * @Relations.toOne(() => Customer, "customerId")
43
- * customer?: Customer;
44
- * ```
45
- * ```
46
- * Fields.string()
47
- * customerId?: string;
48
- *
49
- * @Relations.toOne(() => Customer, {
50
- * field: "customerId",
51
- * defaultIncluded: true
52
- * })
53
- * customer?: Customer;
54
- * ```
55
- * ```
56
- * Fields.string()
57
- * customerId?: string;
58
- *
59
- * @Relations.toOne(() => Customer, {
60
- * fields: {
61
- * customerId: "id",
62
- * },
63
- * })
64
- * customer?: Customer;
65
- * ```
66
- */
67
- static toOne<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, options?: FieldOptions<entityType, toEntityType> & Pick<RelationOptions<entityType, toEntityType, any, any>, 'defaultIncluded'> | RelationOptions<entityType, toEntityType, entityType> | keyof entityType): (target: any, context: string | ClassFieldDecoratorContextStub<any, toEntityType>, c?: any) => void;
68
- /**
69
- * Define a toMany relation between entities, indicating a one-to-many relationship.
70
- * This method allows you to establish a relationship where one entity can have multiple related entities.
71
- *
72
- * @param toEntityType A function that returns the target entity type.
73
- * @param fieldInToEntity (Optional) The field in the target entity that represents the relation.
74
- * Use this if you want to specify a custom field name for the relation.
75
- * @returns A decorator function to apply the toMany relation to an entity field.
76
- *
77
- * Example usage:
78
- * ```
79
- * @Relations.toMany(() => Order)
80
- * orders?: Order[];
81
- *
82
- * // or with a custom field name:
83
- * @Relations.toMany(() => Order, "customerId")
84
- * orders?: Order[];
85
- * ```
86
- */
87
- static toMany<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, fieldInToEntity?: keyof toEntityType): ClassFieldDecorator<entityType, toEntityType[] | undefined>;
88
- /**
89
- * Define a toMany relation between entities, indicating a one-to-many relationship.
90
- * This method allows you to establish a relationship where one entity can have multiple related entities.
91
- * You can also specify various options to customize the relation and control related data retrieval.
92
- *
93
- * @param toEntityType A function that returns the target entity type.
94
- * @param options An object containing options for configuring the toMany relation.
95
- * - field (Optional): The field in the target entity that represents the relation.
96
- * Use this if you want to specify a custom field name for the relation.
97
- * - findOptions (Optional): Customize the options for finding related entities.
98
- * You can set limits, order, where conditions, and more.
99
- * @returns A decorator function to apply the toMany relation to an entity field.
100
- *
101
- * Example usage:
102
- * ```
103
- * @Relations.toMany(() => Order, {
104
- * field: "customerOrders",
105
- * findOptions: {
106
- * limit: 10,
107
- * orderBy: { amount: "desc" },
108
- * where: { completed: true },
109
- * },
110
- * })
111
- * orders?: Order[];
112
- * ```
113
- */
114
- static toMany<entityType, toEntityType>(toEntityType: () => ClassType<toEntityType>, options: RelationOptions<entityType, toEntityType, toEntityType, FindOptions<toEntityType>>): ClassFieldDecorator<entityType, toEntityType[] | undefined>;
115
- }
116
- /**Decorates fields that should be used as fields.
117
- * for more info see: [Field Types](https://remult.dev/docs/field-types.html)
118
- *
119
- * FieldOptions can be set in two ways:
120
- * @example
121
- * // as an object
122
- * @Fields.string({ includeInApi:false })
123
- * title='';
124
- * @example
125
- * // as an arrow function that receives `remult` as a parameter
126
- * @Fields.string((options,remult) => options.includeInApi = true)
127
- * title='';
128
- */
129
- export declare function Field<entityType = any, valueType = any>(valueType: (() => ClassType<valueType>) | undefined, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string, c?: any) => void;
130
- export interface StringFieldOptions<entityType = any> extends FieldOptions<entityType, string> {
131
- maxLength?: number;
132
- }
133
- export declare function checkTarget(target: any): void;
@@ -1,4 +0,0 @@
1
- import { EntityBase } from './RepositoryImplementation';
2
- export declare class IdEntity extends EntityBase {
3
- id: string;
4
- }
@@ -1,289 +0,0 @@
1
- import type { ClassType } from '../../classType';
2
- import { LookupColumn } from '../column';
3
- import type { FieldMetadata, FieldOptions, ValueConverter, ValueListItem } from '../column-interfaces';
4
- import { Remult } from '../context';
5
- import type { EntityOptions } from '../entity';
6
- import type { ControllerRef, ControllerRefForControllerBase, EntityFilter, EntityMetadata, EntityOrderBy, EntityRef, EntityRefForEntityBase, FieldRef, FieldsMetadata, FieldsRef, FieldsRefForEntityBase, FindFirstOptions, FindFirstOptionsBase, FindOptions, IdMetadata, LiveQuery, LoadOptions, MembersOnly, QueryOptions, QueryResult, Repository, RepositoryRelations, Subscribable } from './remult3';
7
- import type { RefSubscriber } from './remult3';
8
- import type { entityEventListener } from '../__EntityValueProvider';
9
- import type { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, ErrorInfo } from '../data-interfaces';
10
- import type { Unsubscribe } from '../live-query/SubscriptionChannel';
11
- import type { columnInfo } from './columnInfo';
12
- import { RelationLoader } from './relation-loader';
13
- import { getInternalKey } from './repository-internals';
14
- export declare class RepositoryImplementation<entityType> implements Repository<entityType> {
15
- private entity;
16
- remult: Remult;
17
- private dataProvider;
18
- private _info;
19
- private defaultFindOptions?;
20
- [getInternalKey](): this;
21
- createAfterFilter(orderBy: EntityOrderBy<entityType>, lastRow: entityType): Promise<EntityFilter<entityType>>;
22
- relations(item: entityType): RepositoryRelations<entityType>;
23
- private __edp;
24
- private get edp();
25
- constructor(entity: ClassType<entityType>, remult: Remult, dataProvider: DataProvider, _info: EntityFullInfo<entityType>, defaultFindOptions?: FindOptions<entityType>);
26
- idCache: Map<any, any>;
27
- getCachedById(id: any, doNotLoadIfNotFound: boolean): entityType;
28
- getCachedByIdAsync(id: any, doNotLoadIfNotFound: boolean): Promise<entityType>;
29
- addToCache(item: entityType): void;
30
- get metadata(): EntityMetadata<entityType>;
31
- listeners: entityEventListener<entityType>[];
32
- addEventListener(listener: entityEventListener<entityType>): () => void;
33
- query(options?: QueryOptions<entityType>): QueryResult<entityType>;
34
- getEntityRef(entity: entityType): EntityRef<entityType>;
35
- delete(id: entityType extends {
36
- id?: number;
37
- } ? number : entityType extends {
38
- id?: string;
39
- } ? string : string | number): Promise<void>;
40
- delete(item: entityType): Promise<void>;
41
- insert(item: Partial<MembersOnly<entityType>>[]): Promise<entityType[]>;
42
- insert(item: Partial<MembersOnly<entityType>>): Promise<entityType>;
43
- get fields(): FieldsMetadata<entityType>;
44
- validate(entity: Partial<MembersOnly<entityType>>, ...fields: Extract<keyof MembersOnly<entityType>, string>[]): Promise<ErrorInfo<entityType> | undefined>;
45
- update(id: entityType extends {
46
- id?: number;
47
- } ? number : entityType extends {
48
- id?: string;
49
- } ? string : string | number, item: Partial<MembersOnly<entityType>>): Promise<entityType>;
50
- update(originalItem: Partial<MembersOnly<entityType>>, item: Partial<MembersOnly<entityType>>): Promise<entityType>;
51
- private getRefForExistingRow;
52
- save(item: Partial<MembersOnly<entityType>>[]): Promise<entityType[]>;
53
- save(item: Partial<MembersOnly<entityType>>): Promise<entityType>;
54
- liveQuery(options?: FindOptions<entityType>): LiveQuery<entityType>;
55
- rawFind(options: FindOptions<entityType>, skipOrderByAndLimit: boolean, loader: RelationLoader): Promise<entityType[]>;
56
- find(options: FindOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType[]>;
57
- buildEntityDataProviderFindOptions(options: FindOptions<entityType>): Promise<EntityDataProviderFindOptions>;
58
- fromJsonArray(jsonItems: any[], loadOptions: LoadOptions<entityType>): Promise<entityType[]>;
59
- private loadManyToOneForManyRows;
60
- private mapRawDataToResult;
61
- toJson(item: entityType | entityType[] | Promise<entityType> | Promise<entityType[]>): any;
62
- fromJson(json: any, newRow?: boolean): any;
63
- count(where?: EntityFilter<entityType>): Promise<number>;
64
- private cache;
65
- findFirst(where?: EntityFilter<entityType>, options?: FindFirstOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType>;
66
- private fieldsOf;
67
- create(item?: Partial<MembersOnly<entityType>>): entityType;
68
- fixTypes(item: any): Promise<any>;
69
- findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType>;
70
- }
71
- export type EntityOptionsFactory = (remult: Remult) => EntityOptions;
72
- export declare const columnsOfType: Map<any, columnInfo[]>;
73
- export declare function createOldEntity<T>(entity: ClassType<T>, remult: Remult): EntityFullInfo<T>;
74
- declare abstract class rowHelperBase<T> {
75
- protected columnsInfo: FieldOptions[];
76
- instance: T;
77
- protected remult: Remult;
78
- protected isNewRow: boolean;
79
- _error: string;
80
- get error(): string;
81
- set error(val: string);
82
- constructor(columnsInfo: FieldOptions[], instance: T, remult: Remult, isNewRow: boolean);
83
- _subscribers: SubscribableImp;
84
- subscribe(listener: RefSubscriber): Unsubscribe;
85
- _isLoading: boolean;
86
- initSubscribers(): void;
87
- get isLoading(): boolean;
88
- set isLoading(val: boolean);
89
- lookups: Map<string, LookupColumn<any>>;
90
- waitLoad(): Promise<void>;
91
- errors: {
92
- [key: string]: string;
93
- };
94
- protected __assertValidity(): void;
95
- buildErrorInfoObject(): ErrorInfo<any>;
96
- abstract get fields(): FieldsRef<T>;
97
- catchSaveErrors(err: any): any;
98
- __clearErrorsAndReportChanged(): void;
99
- _reportChangedToEntityAndFields(): void;
100
- hasErrors(): boolean;
101
- copyDataToObject(isNew?: boolean): any;
102
- originalValues: any;
103
- saveOriginalData(): void;
104
- saveMoreOriginalData(): void;
105
- validate(): Promise<ErrorInfo<any>>;
106
- __validateEntity(): Promise<void>;
107
- __performColumnAndEntityValidations(): Promise<void>;
108
- toApiJson(includeRelatedEntities?: boolean): any;
109
- _updateEntityBasedOnApi(body: any, ignoreApiAllowed?: boolean): Promise<void>;
110
- }
111
- export declare class rowHelperImplementation<T> extends rowHelperBase<T> implements EntityRef<T> {
112
- private info;
113
- repository: RepositoryImplementation<T>;
114
- private edp;
115
- private _isNew;
116
- constructor(info: EntityFullInfo<T>, instance: T, repository: RepositoryImplementation<T>, edp: EntityDataProvider, remult: Remult, _isNew: boolean);
117
- get relations(): RepositoryRelations<T>;
118
- get apiUpdateAllowed(): boolean;
119
- get apiDeleteAllowed(): boolean;
120
- get apiInsertAllowed(): boolean;
121
- metadata: EntityMetadata<T>;
122
- getId(): any;
123
- saveMoreOriginalData(): void;
124
- private _wasDeleted;
125
- wasDeleted(): boolean;
126
- undoChanges(): void;
127
- reload(): Promise<T>;
128
- private _columns;
129
- get fields(): FieldsRef<T>;
130
- private _saving;
131
- save(onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject?: string[]): Promise<T>;
132
- private buildLifeCycleEvent;
133
- private getIdFilter;
134
- delete(): Promise<void>;
135
- loadDataFrom(data: any, loadItems?: FieldMetadata[]): Promise<void>;
136
- id: any;
137
- originalId: any;
138
- getOriginalId(): any;
139
- private calcServerExpression;
140
- isNew(): boolean;
141
- wasChanged(): boolean;
142
- __performColumnAndEntityValidations(): Promise<void>;
143
- }
144
- export declare function getFields<fieldsContainerType>(container: fieldsContainerType, remult?: Remult): FieldsRef<fieldsContainerType>;
145
- export declare function getControllerRef<fieldsContainerType>(container: fieldsContainerType, remultArg?: Remult): ControllerRef<fieldsContainerType>;
146
- export declare class controllerRefImpl<T = any> extends rowHelperBase<T> implements ControllerRef<T> {
147
- constructor(columnsInfo: FieldOptions[], instance: any, remult: Remult);
148
- __performColumnAndEntityValidations(): Promise<void>;
149
- fields: FieldsRef<T>;
150
- }
151
- export declare class FieldRefImplementation<entityType, valueType> implements FieldRef<entityType, valueType> {
152
- private settings;
153
- metadata: FieldMetadata;
154
- container: any;
155
- private helper;
156
- private rowBase;
157
- constructor(settings: FieldOptions, metadata: FieldMetadata, container: any, helper: EntityRef<entityType>, rowBase: rowHelperBase<entityType>);
158
- _subscribers: SubscribableImp;
159
- subscribe(listener: RefSubscriber): Unsubscribe;
160
- valueIsNull(): boolean;
161
- originalValueIsNull(): boolean;
162
- load(): Promise<valueType>;
163
- target: ClassType<any>;
164
- reportObserved(): void;
165
- reportChanged(): void;
166
- get error(): string;
167
- set error(error: string);
168
- get displayValue(): string;
169
- get value(): any;
170
- set value(value: any);
171
- get originalValue(): any;
172
- private rawOriginalValue;
173
- setId(id: string | number): void;
174
- getId(): any;
175
- get inputValue(): string;
176
- set inputValue(val: string);
177
- valueChanged(): boolean;
178
- entityRef: EntityRef<any>;
179
- __performValidation(): Promise<void>;
180
- validate(): Promise<boolean>;
181
- }
182
- export declare const CaptionTransformer: {
183
- transformCaption: (remult: Remult, key: string, caption: string) => string;
184
- };
185
- export declare function buildCaption(caption: string | ((remult: Remult) => string), key: string, remult: Remult): string;
186
- export declare class columnDefsImpl implements FieldMetadata {
187
- private settings;
188
- private entityDefs;
189
- private remult;
190
- constructor(settings: FieldOptions, entityDefs: EntityFullInfo<any>, remult: Remult);
191
- apiUpdateAllowed(item?: any): boolean;
192
- displayValue(item: any): string;
193
- includedInApi(item?: any): boolean;
194
- toInput(value: any, inputType?: string): string;
195
- fromInput(inputValue: string, inputType?: string): any;
196
- getDbName(): Promise<string>;
197
- options: FieldOptions<any, any>;
198
- target: ClassType<any>;
199
- readonly: boolean;
200
- valueConverter: Required<ValueConverter<any>>;
201
- allowNull: boolean;
202
- caption: string;
203
- get dbName(): any;
204
- inputType: string;
205
- key: string;
206
- get dbReadOnly(): boolean;
207
- isServerExpression: boolean;
208
- valueType: any;
209
- }
210
- declare class EntityFullInfo<T> implements EntityMetadata<T> {
211
- columnsInfo: FieldOptions[];
212
- entityInfo: EntityOptions;
213
- private remult;
214
- readonly entityType: ClassType<T>;
215
- readonly key: string;
216
- options: EntityOptions<T>;
217
- constructor(columnsInfo: FieldOptions[], entityInfo: EntityOptions, remult: Remult, entityType: ClassType<T>, key: string);
218
- apiUpdateAllowed(item: T): boolean;
219
- get apiReadAllowed(): boolean;
220
- apiDeleteAllowed(item: T): boolean;
221
- apiInsertAllowed(item: T): boolean;
222
- getEntityMetadataWithoutBreakingTheEntity(item: T): EntityRef<T>;
223
- dbNamePromise: Promise<string>;
224
- getDbName(): Promise<string>;
225
- idMetadata: IdMetadata<T>;
226
- fields: FieldsMetadata<T>;
227
- dbName: string;
228
- caption: string;
229
- }
230
- export declare function FieldType<valueType = any>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any, context?: any) => any;
231
- export declare function isAutoIncrement(f: FieldMetadata): boolean;
232
- export declare function ValueListFieldType<valueType extends ValueListItem = any>(...options: (ValueListFieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (type: ClassType<valueType>, context?: any) => void;
233
- export interface ValueListFieldOptions<entityType, valueType> extends FieldOptions<entityType, valueType> {
234
- getValues?: () => valueType[];
235
- }
236
- export declare class ValueListInfo<T extends ValueListItem> implements ValueConverter<T> {
237
- private valueListType;
238
- static get<T extends ValueListItem>(type: ClassType<T>): ValueListInfo<T>;
239
- private byIdMap;
240
- private values;
241
- isNumeric: boolean;
242
- private constructor();
243
- getValues(): T[];
244
- byId(key: any): T;
245
- fromJson(val: any): T;
246
- toJson(val: T): any;
247
- fromDb(val: any): T;
248
- toDb(val: T): any;
249
- toInput(val: T, inputType: string): string;
250
- fromInput(val: string, inputType: string): T;
251
- displayValue?(val: T): string;
252
- fieldTypeInDb?: string;
253
- inputType?: string;
254
- }
255
- export declare function getValueList<T>(field: FieldRef<T>): T[];
256
- export declare function getValueList<T>(field: FieldMetadata<T>): T[];
257
- export declare function getValueList<T>(type: ClassType<T>): T[];
258
- export declare const storableMember: unique symbol;
259
- export declare function buildOptions<entityType = any, valueType = any>(options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[], remult: Remult): FieldOptions<entityType, valueType>;
260
- export declare function decorateColumnSettings<valueType>(settings: FieldOptions<any, valueType>, remult: Remult): FieldOptions<any, valueType>;
261
- export declare class EntityBase {
262
- get _(): EntityRefForEntityBase<this>;
263
- save(): Promise<this>;
264
- assign(values: Partial<Omit<this, keyof EntityBase>>): this;
265
- delete(): Promise<void>;
266
- isNew(): boolean;
267
- get $(): FieldsRefForEntityBase<this>;
268
- }
269
- export declare class ControllerBase {
270
- protected remult: Remult;
271
- constructor(remult?: Remult);
272
- assign(values: Partial<Omit<this, keyof EntityBase>>): this;
273
- get $(): FieldsRefForEntityBase<this>;
274
- get _(): ControllerRefForControllerBase<this>;
275
- }
276
- declare class SubscribableImp implements Subscribable {
277
- reportChanged(): void;
278
- reportObserved(): void;
279
- private _subscribers;
280
- subscribe(listener: (() => void) | {
281
- reportChanged: () => void;
282
- reportObserved: () => void;
283
- }): Unsubscribe;
284
- }
285
- export declare function getEntityMetadata<entityType>(entity: EntityMetadataOverloads<entityType>): EntityMetadata<entityType>;
286
- export declare function getRepository<entityType>(entity: RepositoryOverloads<entityType>): Repository<entityType>;
287
- export type EntityMetadataOverloads<entityType> = Repository<entityType> | EntityMetadata<entityType> | ClassType<entityType>;
288
- export type RepositoryOverloads<entityType> = Repository<entityType> | ClassType<entityType>;
289
- export {};
@@ -1,2 +0,0 @@
1
- import type { EntityFilter, EntityMetadata } from './remult3';
2
- export declare function __updateEntityBasedOnWhere<T>(entityDefs: EntityMetadata<T>, where: EntityFilter<T>, r: T): void;
@@ -1,6 +0,0 @@
1
- import type { FieldOptions } from '../column-interfaces';
2
- import { Remult } from '../context';
3
- export interface columnInfo {
4
- key: string;
5
- settings: (remult: Remult) => FieldOptions;
6
- }
@@ -1,28 +0,0 @@
1
- import type { Remult } from '../context';
2
- import type { EntityOptions } from '../entity';
3
- import type { ClassDecoratorContextStub } from './remult3';
4
- /**Decorates classes that should be used as entities.
5
- * Receives a key and an array of EntityOptions.
6
- * @example
7
- * import { Entity, Fields } from "remult";
8
- * @Entity("tasks", {
9
- * allowApiCrud: true
10
- * })
11
- * export class Task {
12
- * @Fields.uuid()
13
- * id!: string;
14
- * @Fields.string()
15
- * title = '';
16
- * @Fields.boolean()
17
- * completed = false;
18
- * }
19
- * @note
20
- * EntityOptions can be set in two ways:
21
- * @example
22
- * // as an object
23
- * @Entity("tasks",{ allowApiCrud:true })
24
- * @example
25
- * // as an arrow function that receives `remult` as a parameter
26
- * @Entity("tasks", (options,remult) => options.allowApiCrud = true)
27
- */
28
- export declare function Entity<entityType>(key: string, ...options: (EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType> | ((options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>, remult: Remult) => void))[]): (target: any, info?: ClassDecoratorContextStub<entityType extends new (...args: any) => any ? entityType : never>) => any;
@@ -1,9 +0,0 @@
1
- import type { ClassType } from '../../classType';
2
- import type { EntityOptionsFactory } from './RepositoryImplementation';
3
- import type { EntityRef } from './remult3';
4
- export declare function getEntityRef<entityType>(entity: entityType, throwException?: boolean): EntityRef<entityType>;
5
- export declare const entityMember: unique symbol;
6
- export declare const entityInfo: unique symbol;
7
- export declare const entityInfo_key: unique symbol;
8
- export declare function getEntitySettings<T>(entity: ClassType<T>, throwError?: boolean): EntityOptionsFactory | undefined;
9
- export declare function getEntityKey(entity: ClassType<any>): string;
@@ -1,7 +0,0 @@
1
- import type { ClassType } from '../../classType';
2
- import type { EntityMetadata, FindOptions } from './remult3';
3
- export interface RelationLoaderHelper<toEntity> {
4
- metadata: EntityMetadata<toEntity>;
5
- entityType: ClassType<toEntity>;
6
- find(options: FindOptions<toEntity>): Promise<toEntity[]>;
7
- }
@@ -1,40 +0,0 @@
1
- import type { RelationLoaderHelper } from './relation-loader-types';
2
- import type { FindOptions } from './remult3';
3
- export declare class RelationLoader {
4
- entityLoaders: Map<any, EntityLoader>;
5
- promises: any[];
6
- load(rel: RelationLoaderHelper<any>, findOptions: FindOptions<any>): Promise<any[]>;
7
- constructor();
8
- resolveAll(): Promise<void>;
9
- }
10
- declare class EntityLoader {
11
- private rel;
12
- queries: Map<string, QueryVariation>;
13
- find(findOptions: FindOptions<any>): Promise<any[]>;
14
- constructor(rel: RelationLoaderHelper<any>);
15
- }
16
- declare class QueryVariation {
17
- private rel;
18
- find(findOptions: FindOptions<any>, where: any): Promise<any[]>;
19
- constructor(rel: RelationLoaderHelper<any>);
20
- resolve(): void;
21
- pendingInStatements: Map<string, PendingInStatements>;
22
- whereVariations: Map<string, {
23
- result: Promise<any[]>;
24
- }>;
25
- }
26
- declare class PendingInStatements {
27
- private rel;
28
- private key;
29
- private options;
30
- resolve(): void;
31
- find(where: any): Promise<any[]>;
32
- values: Map<any, {
33
- value: any;
34
- resolve: (value: any[]) => void;
35
- reject: (error: any) => void;
36
- result: Promise<any[]>;
37
- }>;
38
- constructor(rel: RelationLoaderHelper<any>, key: string, options: FindOptions<any>);
39
- }
40
- export {};
@@ -1,4 +0,0 @@
1
- import type { FieldOptions } from '../column-interfaces';
2
- import type { RelationInfo } from './remult3';
3
- export declare const relationInfoMember: unique symbol;
4
- export declare function getRelationInfo(options: FieldOptions): RelationInfo;