remult 0.22.7-exp.0 → 0.22.7
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/SseSubscriptionServer.d.ts +25 -25
- package/SseSubscriptionServer.js +145 -145
- package/ably.d.ts +13 -13
- package/ably.js +59 -59
- package/assign.d.ts +1 -1
- package/assign.js +9 -9
- package/classType.d.ts +3 -3
- package/classType.js +2 -2
- package/esm/SseSubscriptionServer.d.ts +25 -25
- package/esm/SseSubscriptionServer.js +107 -104
- package/esm/ably.d.ts +13 -13
- package/esm/ably.js +30 -28
- package/esm/assign.d.ts +1 -1
- package/esm/assign.js +5 -5
- package/esm/classType.d.ts +3 -3
- package/esm/classType.js +1 -1
- package/esm/graphql.d.ts +14 -14
- package/esm/graphql.js +785 -785
- package/esm/index.d.ts +31 -31
- package/esm/index.js +25 -25
- package/esm/inputTypes.d.ts +9 -9
- package/esm/inputTypes.js +9 -9
- package/esm/live-query/data-provider-live-query-storage.d.ts +23 -23
- package/esm/live-query/data-provider-live-query-storage.js +91 -93
- package/esm/myLog.d.ts +1 -1
- package/esm/myLog.js +5 -5
- package/esm/postgres/index.d.ts +2 -2
- package/esm/postgres/index.js +2 -2
- package/esm/postgres/postgres-data-provider.d.ts +36 -36
- package/esm/postgres/postgres-data-provider.js +126 -122
- package/esm/postgres/schema-builder.d.ts +19 -19
- package/esm/postgres/schema-builder.js +197 -196
- package/esm/remult-express.d.ts +9 -9
- package/esm/remult-express.js +26 -25
- package/esm/remult-fastify.d.ts +6 -6
- package/esm/remult-fastify.js +68 -68
- package/esm/remult-fresh.d.ts +17 -17
- package/esm/remult-fresh.js +26 -26
- package/esm/remult-knex/index.d.ts +30 -30
- package/esm/remult-knex/index.js +466 -460
- package/esm/remult-mongo.d.ts +24 -24
- package/esm/remult-mongo.js +269 -262
- package/esm/remult-next.d.ts +25 -25
- package/esm/remult-next.js +114 -114
- package/esm/remult-sveltekit.d.ts +4 -4
- package/esm/remult-sveltekit.js +71 -71
- package/esm/server/JsonEntityFileStorage.d.ts +11 -11
- package/esm/server/JsonEntityFileStorage.js +27 -26
- package/esm/server/core.d.ts +4 -4
- package/esm/server/core.js +4 -4
- package/esm/server/expressBridge.d.ts +128 -128
- package/esm/server/expressBridge.js +988 -971
- package/esm/server/index.d.ts +6 -6
- package/esm/server/index.js +12 -12
- package/esm/server/initAsyncHooks.d.ts +1 -1
- package/esm/server/initAsyncHooks.js +9 -9
- package/esm/server/initDataProvider.d.ts +2 -2
- package/esm/server/initDataProvider.js +14 -14
- package/esm/src/CompoundIdField.d.ts +27 -27
- package/esm/src/CompoundIdField.js +54 -41
- package/esm/src/__EntityValueProvider.d.ts +11 -11
- package/esm/src/__EntityValueProvider.js +1 -1
- package/esm/src/__RowsOfDataForTesting.d.ts +3 -3
- package/esm/src/__RowsOfDataForTesting.js +1 -1
- package/esm/src/buildRestDataProvider.d.ts +31 -31
- package/esm/src/buildRestDataProvider.js +121 -120
- package/esm/src/column-interfaces.d.ts +160 -160
- package/esm/src/column-interfaces.js +7 -7
- package/esm/src/column.d.ts +31 -31
- package/esm/src/column.js +108 -101
- package/esm/src/context.d.ts +134 -134
- package/esm/src/context.js +287 -282
- package/esm/src/data-api.d.ts +38 -38
- package/esm/src/data-api.js +281 -279
- package/esm/src/data-interfaces.d.ts +41 -41
- package/esm/src/data-interfaces.js +12 -12
- package/esm/src/data-providers/array-entity-data-provider.d.ts +22 -22
- package/esm/src/data-providers/array-entity-data-provider.js +252 -249
- package/esm/src/data-providers/in-memory-database.d.ts +9 -9
- package/esm/src/data-providers/in-memory-database.js +16 -18
- package/esm/src/data-providers/json-data-provider.d.ts +12 -12
- package/esm/src/data-providers/json-data-provider.js +55 -52
- package/esm/src/data-providers/rest-data-provider.d.ts +39 -39
- package/esm/src/data-providers/rest-data-provider.js +272 -267
- package/esm/src/data-providers/sql-database.d.ts +33 -33
- package/esm/src/data-providers/sql-database.js +401 -394
- package/esm/src/data-providers/web-sql-data-provider.d.ts +21 -21
- package/esm/src/data-providers/web-sql-data-provider.js +145 -137
- package/esm/src/entity.d.ts +95 -95
- package/esm/src/entity.js +1 -1
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -50
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +165 -162
- package/esm/src/filter/filter-interfaces.d.ts +86 -86
- package/esm/src/filter/filter-interfaces.js +524 -515
- package/esm/src/live-query/LiveQueryClient.d.ts +1 -1
- package/esm/src/live-query/LiveQueryClient.js +196 -192
- package/esm/src/live-query/SseSubscriptionClient.d.ts +5 -5
- package/esm/src/live-query/SseSubscriptionClient.js +86 -86
- package/esm/src/live-query/SubscriptionChannel.d.ts +41 -41
- package/esm/src/live-query/SubscriptionChannel.js +126 -121
- package/esm/src/live-query/SubscriptionServer.d.ts +38 -38
- package/esm/src/live-query/SubscriptionServer.js +114 -112
- package/esm/src/remult-proxy.d.ts +2 -2
- package/esm/src/remult-proxy.js +177 -178
- package/esm/src/remult3/DecoratorReplacer.d.ts +10 -10
- package/esm/src/remult3/DecoratorReplacer.js +20 -20
- package/esm/src/remult3/RepositoryImplementation.d.ts +332 -332
- package/esm/src/remult3/RepositoryImplementation.js +2122 -2051
- package/esm/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -2
- package/esm/src/remult3/__updateEntityBasedOnWhere.js +24 -24
- package/esm/src/remult3/entity.d.ts +28 -28
- package/esm/src/remult3/entity.js +70 -70
- package/esm/src/remult3/getEntityRef.d.ts +9 -9
- package/esm/src/remult3/getEntityRef.js +27 -27
- package/esm/src/remult3/remult3.d.ts +397 -397
- package/esm/src/remult3/remult3.js +1 -1
- package/esm/src/resultCompoundIdFilter.d.ts +3 -3
- package/esm/src/resultCompoundIdFilter.js +16 -16
- package/esm/src/server-action-info.d.ts +10 -10
- package/esm/src/server-action-info.js +12 -12
- package/esm/src/server-action.d.ts +79 -79
- package/esm/src/server-action.js +397 -387
- package/esm/src/sort.d.ts +16 -16
- package/esm/src/sort.js +105 -104
- package/esm/src/sql-command.d.ts +19 -19
- package/esm/src/sql-command.js +1 -1
- package/esm/src/validators.d.ts +14 -14
- package/esm/src/validators.js +36 -36
- package/esm/src/valueConverters.d.ts +13 -13
- package/esm/src/valueConverters.js +210 -210
- package/esm/urlBuilder.d.ts +6 -6
- package/esm/urlBuilder.js +20 -19
- package/graphql.d.ts +14 -14
- package/graphql.js +953 -953
- package/index.d.ts +31 -31
- package/index.js +67 -67
- package/inputTypes.d.ts +9 -9
- package/inputTypes.js +16 -16
- package/live-query/data-provider-live-query-storage.d.ts +23 -23
- package/live-query/data-provider-live-query-storage.js +263 -263
- package/myLog.d.ts +1 -1
- package/myLog.js +20 -20
- package/package.json +1 -1
- package/postgres/index.d.ts +2 -2
- package/postgres/index.js +5 -5
- package/postgres/postgres-data-provider.d.ts +36 -36
- package/postgres/postgres-data-provider.js +191 -191
- package/postgres/schema-builder.d.ts +19 -19
- package/postgres/schema-builder.js +369 -369
- package/remult-express.d.ts +9 -9
- package/remult-express.js +34 -33
- package/remult-fastify.d.ts +6 -6
- package/remult-fastify.js +79 -79
- package/remult-fresh.d.ts +17 -17
- package/remult-fresh.js +41 -41
- package/remult-knex/index.d.ts +30 -30
- package/remult-knex/index.js +917 -915
- package/remult-mongo.d.ts +24 -24
- package/remult-mongo.js +515 -515
- package/remult-next.d.ts +25 -25
- package/remult-next.js +171 -171
- package/remult-sveltekit.d.ts +4 -4
- package/remult-sveltekit.js +110 -110
- package/server/JsonEntityFileStorage.d.ts +11 -11
- package/server/JsonEntityFileStorage.js +35 -35
- package/server/core.d.ts +4 -4
- package/server/core.js +12 -12
- package/server/expressBridge.d.ts +128 -128
- package/server/expressBridge.js +1401 -1402
- package/server/index.d.ts +6 -6
- package/server/index.js +24 -24
- package/server/initAsyncHooks.d.ts +1 -1
- package/server/initAsyncHooks.js +13 -13
- package/server/initDataProvider.d.ts +2 -2
- package/server/initDataProvider.js +26 -26
- package/src/CompoundIdField.d.ts +27 -27
- package/src/CompoundIdField.js +54 -54
- package/src/__EntityValueProvider.d.ts +11 -11
- package/src/__EntityValueProvider.js +2 -2
- package/src/__RowsOfDataForTesting.d.ts +3 -3
- package/src/__RowsOfDataForTesting.js +2 -2
- package/src/buildRestDataProvider.d.ts +31 -31
- package/src/buildRestDataProvider.js +177 -174
- package/src/column-interfaces.d.ts +160 -160
- package/src/column-interfaces.js +11 -11
- package/src/column.d.ts +31 -31
- package/src/column.js +132 -132
- package/src/context.d.ts +134 -134
- package/src/context.js +451 -451
- package/src/data-api.d.ts +38 -38
- package/src/data-api.js +524 -524
- package/src/data-interfaces.d.ts +41 -41
- package/src/data-interfaces.js +16 -16
- package/src/data-providers/array-entity-data-provider.d.ts +22 -22
- package/src/data-providers/array-entity-data-provider.js +364 -364
- package/src/data-providers/in-memory-database.d.ts +9 -9
- package/src/data-providers/in-memory-database.js +33 -33
- package/src/data-providers/json-data-provider.d.ts +12 -12
- package/src/data-providers/json-data-provider.js +106 -106
- package/src/data-providers/rest-data-provider.d.ts +39 -39
- package/src/data-providers/rest-data-provider.js +388 -388
- package/src/data-providers/sql-database.d.ts +33 -33
- package/src/data-providers/sql-database.js +653 -653
- package/src/data-providers/web-sql-data-provider.d.ts +21 -21
- package/src/data-providers/web-sql-data-provider.js +229 -229
- package/src/entity.d.ts +95 -95
- package/src/entity.js +2 -2
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -50
- package/src/filter/filter-consumer-bridge-to-sql-request.js +307 -307
- package/src/filter/filter-interfaces.d.ts +86 -86
- package/src/filter/filter-interfaces.js +693 -685
- package/src/live-query/LiveQueryClient.d.ts +1 -1
- package/src/live-query/LiveQueryClient.js +293 -293
- package/src/live-query/SseSubscriptionClient.d.ts +5 -5
- package/src/live-query/SseSubscriptionClient.js +154 -154
- package/src/live-query/SubscriptionChannel.d.ts +41 -41
- package/src/live-query/SubscriptionChannel.js +189 -189
- package/src/live-query/SubscriptionServer.d.ts +38 -38
- package/src/live-query/SubscriptionServer.js +264 -264
- package/src/remult-proxy.d.ts +2 -2
- package/src/remult-proxy.js +307 -307
- package/src/remult3/DecoratorReplacer.d.ts +10 -10
- package/src/remult3/DecoratorReplacer.js +24 -24
- package/src/remult3/RepositoryImplementation.d.ts +332 -332
- package/src/remult3/RepositoryImplementation.js +3391 -3373
- package/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -2
- package/src/remult3/__updateEntityBasedOnWhere.js +28 -28
- package/src/remult3/entity.d.ts +28 -28
- package/src/remult3/entity.js +88 -88
- package/src/remult3/getEntityRef.d.ts +9 -9
- package/src/remult3/getEntityRef.js +35 -35
- package/src/remult3/remult3.d.ts +397 -397
- package/src/remult3/remult3.js +2 -2
- package/src/resultCompoundIdFilter.d.ts +3 -3
- package/src/resultCompoundIdFilter.js +20 -20
- package/src/server-action-info.d.ts +10 -10
- package/src/server-action-info.js +15 -15
- package/src/server-action.d.ts +79 -79
- package/src/server-action.js +632 -632
- package/src/sort.d.ts +16 -16
- package/src/sort.js +161 -161
- package/src/sql-command.d.ts +19 -19
- package/src/sql-command.js +2 -2
- package/src/validators.d.ts +14 -14
- package/src/validators.js +71 -69
- package/src/valueConverters.d.ts +13 -13
- package/src/valueConverters.js +213 -213
- package/urlBuilder.d.ts +6 -6
- package/urlBuilder.js +25 -25
|
@@ -1,332 +1,332 @@
|
|
|
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, EntityFilter, EntityMetadata, EntityOrderBy, EntityRef, FieldRef, FieldsMetadata, FieldsRef, FindFirstOptions, FindFirstOptionsBase, FindOptions, IdMetadata, OmitEB, QueryOptions, QueryResult, Repository, 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
|
-
export declare class RepositoryImplementation<entityType> implements Repository<entityType> {
|
|
12
|
-
private entity;
|
|
13
|
-
remult: Remult;
|
|
14
|
-
private dataProvider;
|
|
15
|
-
createAfterFilter(orderBy: EntityOrderBy<entityType>, lastRow: entityType): Promise<EntityFilter<entityType>>;
|
|
16
|
-
private _info;
|
|
17
|
-
private __edp;
|
|
18
|
-
private get edp();
|
|
19
|
-
constructor(entity: ClassType<entityType>, remult: Remult, dataProvider: DataProvider);
|
|
20
|
-
idCache: Map<any, any>;
|
|
21
|
-
getCachedById(id: any): entityType;
|
|
22
|
-
getCachedByIdAsync(id: any): Promise<entityType>;
|
|
23
|
-
addToCache(item: entityType): void;
|
|
24
|
-
get metadata(): EntityMetadata<entityType>;
|
|
25
|
-
listeners: entityEventListener<entityType>[];
|
|
26
|
-
addEventListener(listener: entityEventListener<entityType>): () => void;
|
|
27
|
-
query(options?: QueryOptions<entityType>): QueryResult<entityType>;
|
|
28
|
-
getEntityRef(entity: entityType): EntityRef<entityType>;
|
|
29
|
-
delete(id: entityType extends {
|
|
30
|
-
id?: number;
|
|
31
|
-
} ? number : entityType extends {
|
|
32
|
-
id?: string;
|
|
33
|
-
} ? string : string | number): Promise<void>;
|
|
34
|
-
delete(item: entityType): Promise<void>;
|
|
35
|
-
insert(item: Partial<OmitEB<entityType>>[]): Promise<entityType[]>;
|
|
36
|
-
insert(item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
37
|
-
get fields(): FieldsMetadata<entityType>;
|
|
38
|
-
validate(entity: Partial<OmitEB<entityType>>, ...fields: Extract<keyof OmitEB<entityType>, string>[]): Promise<ErrorInfo<entityType> | undefined>;
|
|
39
|
-
update(id: entityType extends {
|
|
40
|
-
id?: number;
|
|
41
|
-
} ? number : entityType extends {
|
|
42
|
-
id?: string;
|
|
43
|
-
} ? string : string | number, item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
44
|
-
update(originalItem: Partial<OmitEB<entityType>>, item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
45
|
-
private getRefForExistingRow;
|
|
46
|
-
save(item: Partial<OmitEB<entityType>>[]): Promise<entityType[]>;
|
|
47
|
-
save(item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
48
|
-
liveQuery(options?: FindOptions<entityType>):
|
|
49
|
-
find(options: FindOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType[]>;
|
|
50
|
-
buildEntityDataProviderFindOptions(options: FindOptions<entityType>): Promise<EntityDataProviderFindOptions>;
|
|
51
|
-
fromJsonArray(jsonItems: any[], load?: (entity: FieldsMetadata<entityType>) => FieldMetadata[]): Promise<entityType[]>;
|
|
52
|
-
private loadManyToOneForManyRows;
|
|
53
|
-
private mapRawDataToResult;
|
|
54
|
-
toJson(item: entityType | entityType[] | Promise<entityType> | Promise<entityType[]>): any;
|
|
55
|
-
fromJson(json: any, newRow?: boolean): any;
|
|
56
|
-
count(where?: EntityFilter<entityType>): Promise<number>;
|
|
57
|
-
private cache;
|
|
58
|
-
findFirst(where?: EntityFilter<entityType>, options?: FindFirstOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType>;
|
|
59
|
-
private fieldsOf;
|
|
60
|
-
create(item?: Partial<OmitEB<entityType>>): entityType;
|
|
61
|
-
fixTypes(item: any): Promise<any>;
|
|
62
|
-
findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType>;
|
|
63
|
-
}
|
|
64
|
-
export
|
|
65
|
-
export declare const columnsOfType: Map<any, columnInfo[]>;
|
|
66
|
-
export declare function createOldEntity<T>(entity: ClassType<T>, remult: Remult): EntityFullInfo<T>;
|
|
67
|
-
declare abstract class rowHelperBase<T> {
|
|
68
|
-
protected columnsInfo: FieldOptions[];
|
|
69
|
-
protected instance: T;
|
|
70
|
-
protected remult: Remult;
|
|
71
|
-
_error: string;
|
|
72
|
-
get error(): string;
|
|
73
|
-
set error(val: string);
|
|
74
|
-
constructor(columnsInfo: FieldOptions[], instance: T, remult: Remult);
|
|
75
|
-
_subscribers: SubscribableImp;
|
|
76
|
-
subscribe(listener: RefSubscriber): Unsubscribe;
|
|
77
|
-
_isLoading: boolean;
|
|
78
|
-
initSubscribers(): void;
|
|
79
|
-
get isLoading(): boolean;
|
|
80
|
-
set isLoading(val: boolean);
|
|
81
|
-
lookups: Map<string, LookupColumn<any>>;
|
|
82
|
-
waitLoad(): Promise<void>;
|
|
83
|
-
errors: {
|
|
84
|
-
[key: string]: string;
|
|
85
|
-
};
|
|
86
|
-
protected __assertValidity(): void;
|
|
87
|
-
buildErrorInfoObject(): ErrorInfo<any>;
|
|
88
|
-
abstract get fields(): FieldsRef<T>;
|
|
89
|
-
catchSaveErrors(err: any): any;
|
|
90
|
-
__clearErrorsAndReportChanged(): void;
|
|
91
|
-
_reportChangedToEntityAndFields(): void;
|
|
92
|
-
hasErrors(): boolean;
|
|
93
|
-
copyDataToObject(): any;
|
|
94
|
-
originalValues: any;
|
|
95
|
-
saveOriginalData(): void;
|
|
96
|
-
saveMoreOriginalData(): void;
|
|
97
|
-
validate(): Promise<ErrorInfo<any>>;
|
|
98
|
-
__validateEntity(): Promise<void>;
|
|
99
|
-
__performColumnAndEntityValidations(): Promise<void>;
|
|
100
|
-
toApiJson(includeRelatedEntities?: boolean): any;
|
|
101
|
-
_updateEntityBasedOnApi(body: any): Promise<void>;
|
|
102
|
-
}
|
|
103
|
-
export declare class rowHelperImplementation<T> extends rowHelperBase<T> implements EntityRef<T> {
|
|
104
|
-
private info;
|
|
105
|
-
repository: RepositoryImplementation<T>;
|
|
106
|
-
private edp;
|
|
107
|
-
private _isNew;
|
|
108
|
-
constructor(info: EntityFullInfo<T>, instance: T, repository: RepositoryImplementation<T>, edp: EntityDataProvider, remult: Remult, _isNew: boolean);
|
|
109
|
-
get apiUpdateAllowed(): boolean;
|
|
110
|
-
get apiDeleteAllowed(): boolean;
|
|
111
|
-
get apiInsertAllowed(): boolean;
|
|
112
|
-
metadata: EntityMetadata<T>;
|
|
113
|
-
getId(): any;
|
|
114
|
-
saveMoreOriginalData(): void;
|
|
115
|
-
private _wasDeleted;
|
|
116
|
-
wasDeleted(): boolean;
|
|
117
|
-
undoChanges(): void;
|
|
118
|
-
reload(): Promise<T>;
|
|
119
|
-
private _columns;
|
|
120
|
-
get fields(): FieldsRef<T>;
|
|
121
|
-
private _saving;
|
|
122
|
-
save(onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject?: string[]): Promise<T>;
|
|
123
|
-
private getIdFilter;
|
|
124
|
-
delete(): Promise<void>;
|
|
125
|
-
loadDataFrom(data: any, loadItems?: FieldMetadata[]): Promise<void>;
|
|
126
|
-
id: any;
|
|
127
|
-
originalId: any;
|
|
128
|
-
getOriginalId(): any;
|
|
129
|
-
private calcServerExpression;
|
|
130
|
-
isNew(): boolean;
|
|
131
|
-
wasChanged(): boolean;
|
|
132
|
-
__performColumnAndEntityValidations(): Promise<void>;
|
|
133
|
-
}
|
|
134
|
-
export declare function getFields<fieldsContainerType>(container: fieldsContainerType, remult?: Remult): FieldsRef<fieldsContainerType>;
|
|
135
|
-
export declare function getControllerRef<fieldsContainerType>(container: fieldsContainerType, remultArg?: Remult): ControllerRef<fieldsContainerType>;
|
|
136
|
-
export declare class controllerRefImpl<T = any> extends rowHelperBase<T> implements ControllerRef<T> {
|
|
137
|
-
constructor(columnsInfo: FieldOptions[], instance: any, remult: Remult);
|
|
138
|
-
__performColumnAndEntityValidations(): Promise<void>;
|
|
139
|
-
fields: FieldsRef<T>;
|
|
140
|
-
}
|
|
141
|
-
export declare class FieldRefImplementation<entityType, valueType> implements FieldRef<entityType, valueType> {
|
|
142
|
-
private settings;
|
|
143
|
-
metadata: FieldMetadata;
|
|
144
|
-
container: any;
|
|
145
|
-
private helper;
|
|
146
|
-
private rowBase;
|
|
147
|
-
constructor(settings: FieldOptions, metadata: FieldMetadata, container: any, helper: EntityRef<entityType>, rowBase: rowHelperBase<entityType>);
|
|
148
|
-
_subscribers: SubscribableImp;
|
|
149
|
-
subscribe(listener: RefSubscriber): Unsubscribe;
|
|
150
|
-
valueIsNull(): boolean;
|
|
151
|
-
originalValueIsNull(): boolean;
|
|
152
|
-
load(): Promise<valueType>;
|
|
153
|
-
target: ClassType<any>;
|
|
154
|
-
reportObserved(): void;
|
|
155
|
-
reportChanged(): void;
|
|
156
|
-
get error(): string;
|
|
157
|
-
set error(error: string);
|
|
158
|
-
get displayValue(): string;
|
|
159
|
-
get value(): any;
|
|
160
|
-
set value(value: any);
|
|
161
|
-
get originalValue(): any;
|
|
162
|
-
private rawOriginalValue;
|
|
163
|
-
setId(id: string | number): void;
|
|
164
|
-
getId(): any;
|
|
165
|
-
get inputValue(): string;
|
|
166
|
-
set inputValue(val: string);
|
|
167
|
-
valueChanged(): boolean;
|
|
168
|
-
entityRef: EntityRef<any>;
|
|
169
|
-
__performValidation(): Promise<void>;
|
|
170
|
-
validate(): Promise<boolean>;
|
|
171
|
-
}
|
|
172
|
-
export declare const CaptionTransformer: {
|
|
173
|
-
transformCaption: (remult: Remult, key: string, caption: string) => string;
|
|
174
|
-
};
|
|
175
|
-
export declare function buildCaption(caption: string | ((remult: Remult) => string), key: string, remult: Remult): string;
|
|
176
|
-
export declare class columnDefsImpl implements FieldMetadata {
|
|
177
|
-
private settings;
|
|
178
|
-
private entityDefs;
|
|
179
|
-
private remult;
|
|
180
|
-
constructor(settings: FieldOptions, entityDefs: EntityFullInfo<any>, remult: Remult);
|
|
181
|
-
apiUpdateAllowed(item?: any): boolean;
|
|
182
|
-
displayValue(item: any): string;
|
|
183
|
-
get includedInApi(): boolean;
|
|
184
|
-
toInput(value: any, inputType?: string): string;
|
|
185
|
-
fromInput(inputValue: string, inputType?: string): any;
|
|
186
|
-
getDbName(): Promise<string>;
|
|
187
|
-
options: FieldOptions<any, any>;
|
|
188
|
-
target: ClassType<any>;
|
|
189
|
-
readonly: boolean;
|
|
190
|
-
valueConverter: Required<ValueConverter<any>>;
|
|
191
|
-
allowNull: boolean;
|
|
192
|
-
caption: string;
|
|
193
|
-
get dbName(): any;
|
|
194
|
-
inputType: string;
|
|
195
|
-
key: string;
|
|
196
|
-
get dbReadOnly(): boolean;
|
|
197
|
-
isServerExpression: boolean;
|
|
198
|
-
valueType: any;
|
|
199
|
-
}
|
|
200
|
-
declare class EntityFullInfo<T> implements EntityMetadata<T> {
|
|
201
|
-
columnsInfo: FieldOptions[];
|
|
202
|
-
entityInfo: EntityOptions;
|
|
203
|
-
private remult;
|
|
204
|
-
readonly entityType: ClassType<T>;
|
|
205
|
-
readonly key: string;
|
|
206
|
-
options: EntityOptions<T>;
|
|
207
|
-
constructor(columnsInfo: FieldOptions[], entityInfo: EntityOptions, remult: Remult, entityType: ClassType<T>, key: string);
|
|
208
|
-
apiUpdateAllowed(item: T): boolean;
|
|
209
|
-
get apiReadAllowed(): boolean;
|
|
210
|
-
apiDeleteAllowed(item: T): boolean;
|
|
211
|
-
apiInsertAllowed(item: T): boolean;
|
|
212
|
-
getEntityMetadataWithoutBreakingTheEntity(item: T): EntityRef<T>;
|
|
213
|
-
dbNamePromise: Promise<string>;
|
|
214
|
-
getDbName(): Promise<string>;
|
|
215
|
-
idMetadata: IdMetadata<T>;
|
|
216
|
-
fields: FieldsMetadata<T>;
|
|
217
|
-
dbName: string;
|
|
218
|
-
caption: string;
|
|
219
|
-
}
|
|
220
|
-
export declare function FieldType<valueType = any>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any, context?: any) => any;
|
|
221
|
-
export declare class Fields {
|
|
222
|
-
/**
|
|
223
|
-
* Stored as a JSON.stringify - to store as json use Fields.json
|
|
224
|
-
*/
|
|
225
|
-
static object<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
|
|
226
|
-
static json<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
|
|
227
|
-
static dateOnly<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
228
|
-
static date<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
229
|
-
static integer<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, number | undefined>, c?: any) => void;
|
|
230
|
-
static autoIncrement<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, number | undefined>, c?: any) => void;
|
|
231
|
-
static number<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, number | undefined>, c?: any) => void;
|
|
232
|
-
static createdAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
233
|
-
static updatedAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
234
|
-
static uuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, string | undefined>, c?: any) => void;
|
|
235
|
-
static cuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, string | undefined>, c?: any) => void;
|
|
236
|
-
static string<entityType = any>(...options: (StringFieldOptions<entityType> | ((options: StringFieldOptions<entityType>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, string | undefined>, c?: any) => void;
|
|
237
|
-
static boolean<entityType = any>(...options: (FieldOptions<entityType, boolean> | ((options: FieldOptions<entityType, boolean>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, boolean | undefined>, c?: any) => void;
|
|
238
|
-
}
|
|
239
|
-
export declare function isAutoIncrement(f: FieldMetadata): boolean;
|
|
240
|
-
export interface StringFieldOptions<entityType = any> extends FieldOptions<entityType, string> {
|
|
241
|
-
maxLength?: number;
|
|
242
|
-
}
|
|
243
|
-
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;
|
|
244
|
-
export interface ValueListFieldOptions<entityType, valueType> extends FieldOptions<entityType, valueType> {
|
|
245
|
-
getValues?: () => valueType[];
|
|
246
|
-
}
|
|
247
|
-
export declare class ValueListInfo<T extends ValueListItem> implements ValueConverter<T> {
|
|
248
|
-
private valueListType;
|
|
249
|
-
static get<T extends ValueListItem>(type: ClassType<T>): ValueListInfo<T>;
|
|
250
|
-
private byIdMap;
|
|
251
|
-
private values;
|
|
252
|
-
isNumeric: boolean;
|
|
253
|
-
private constructor();
|
|
254
|
-
getValues(): T[];
|
|
255
|
-
byId(key: any): T;
|
|
256
|
-
fromJson(val: any): T;
|
|
257
|
-
toJson(val: T): any;
|
|
258
|
-
fromDb(val: any): T;
|
|
259
|
-
toDb(val: T): any;
|
|
260
|
-
toInput(val: T, inputType: string): string;
|
|
261
|
-
fromInput(val: string, inputType: string): T;
|
|
262
|
-
displayValue?(val: T): string;
|
|
263
|
-
fieldTypeInDb?: string;
|
|
264
|
-
inputType?: string;
|
|
265
|
-
}
|
|
266
|
-
export declare function getValueList<T>(field: FieldRef<T>): T[];
|
|
267
|
-
export declare function getValueList<T>(field: FieldMetadata<T>): T[];
|
|
268
|
-
export declare function getValueList<T>(type: ClassType<T>): T[];
|
|
269
|
-
export interface ClassFieldDecoratorContextStub<entityType, valueType> {
|
|
270
|
-
readonly access: {
|
|
271
|
-
set(object: entityType, value: valueType): void;
|
|
272
|
-
};
|
|
273
|
-
readonly name: string;
|
|
274
|
-
}
|
|
275
|
-
export interface ClassDecoratorContextStub<Class extends new (...args: any) => any = new (...args: any) => any> {
|
|
276
|
-
readonly kind: 'class';
|
|
277
|
-
readonly name: string | undefined;
|
|
278
|
-
addInitializer(initializer: (this: Class) => void): void;
|
|
279
|
-
}
|
|
280
|
-
/**Decorates fields that should be used as fields.
|
|
281
|
-
* for more info see: [Field Types](https://remult.dev/docs/field-types.html)
|
|
282
|
-
*
|
|
283
|
-
* FieldOptions can be set in two ways:
|
|
284
|
-
* @example
|
|
285
|
-
* // as an object
|
|
286
|
-
* @Fields.string({ includeInApi:false })
|
|
287
|
-
* title='';
|
|
288
|
-
* @example
|
|
289
|
-
* // as an arrow function that receives `remult` as a parameter
|
|
290
|
-
* @Fields.string((options,remult) => options.includeInApi = true)
|
|
291
|
-
* title='';
|
|
292
|
-
*/
|
|
293
|
-
export declare function Field<entityType = any, valueType = any>(valueType: () => ClassType<valueType>, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string, c?: any) => void;
|
|
294
|
-
export declare const storableMember: unique symbol;
|
|
295
|
-
export declare function decorateColumnSettings<valueType>(settings: FieldOptions<any, valueType>, remult: Remult): FieldOptions<any, valueType>;
|
|
296
|
-
interface columnInfo {
|
|
297
|
-
key: string;
|
|
298
|
-
settings: (remult: Remult) => FieldOptions;
|
|
299
|
-
}
|
|
300
|
-
export declare class EntityBase {
|
|
301
|
-
get _(): EntityRef<this>;
|
|
302
|
-
save(): Promise<this>;
|
|
303
|
-
assign(values: Partial<Omit<this, keyof EntityBase>>): this;
|
|
304
|
-
delete(): Promise<void>;
|
|
305
|
-
isNew(): boolean;
|
|
306
|
-
get $(): FieldsRef<this>;
|
|
307
|
-
}
|
|
308
|
-
export declare class IdEntity extends EntityBase {
|
|
309
|
-
id: string;
|
|
310
|
-
}
|
|
311
|
-
export declare class ControllerBase {
|
|
312
|
-
protected remult: Remult;
|
|
313
|
-
constructor(remult?: Remult);
|
|
314
|
-
assign(values: Partial<Omit<this, keyof EntityBase>>): this;
|
|
315
|
-
get $(): FieldsRef<this>;
|
|
316
|
-
get _(): ControllerRef<this>;
|
|
317
|
-
}
|
|
318
|
-
declare class SubscribableImp implements Subscribable {
|
|
319
|
-
reportChanged(): void;
|
|
320
|
-
reportObserved(): void;
|
|
321
|
-
private _subscribers;
|
|
322
|
-
subscribe(listener: (() => void) | {
|
|
323
|
-
reportChanged: () => void;
|
|
324
|
-
reportObserved: () => void;
|
|
325
|
-
}): Unsubscribe;
|
|
326
|
-
}
|
|
327
|
-
export declare function getEntityMetadata<entityType>(entity: EntityMetadataOverloads<entityType>): EntityMetadata<entityType>;
|
|
328
|
-
export declare function getRepository<entityType>(entity: RepositoryOverloads<entityType>): Repository<entityType>;
|
|
329
|
-
export
|
|
330
|
-
export
|
|
331
|
-
export declare function checkTarget(target: any): void;
|
|
332
|
-
export {};
|
|
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, EntityFilter, EntityMetadata, EntityOrderBy, EntityRef, FieldRef, FieldsMetadata, FieldsRef, FindFirstOptions, FindFirstOptionsBase, FindOptions, IdMetadata, LiveQuery, OmitEB, QueryOptions, QueryResult, Repository, 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
|
+
export declare class RepositoryImplementation<entityType> implements Repository<entityType> {
|
|
12
|
+
private entity;
|
|
13
|
+
remult: Remult;
|
|
14
|
+
private dataProvider;
|
|
15
|
+
createAfterFilter(orderBy: EntityOrderBy<entityType>, lastRow: entityType): Promise<EntityFilter<entityType>>;
|
|
16
|
+
private _info;
|
|
17
|
+
private __edp;
|
|
18
|
+
private get edp();
|
|
19
|
+
constructor(entity: ClassType<entityType>, remult: Remult, dataProvider: DataProvider);
|
|
20
|
+
idCache: Map<any, any>;
|
|
21
|
+
getCachedById(id: any): entityType;
|
|
22
|
+
getCachedByIdAsync(id: any): Promise<entityType>;
|
|
23
|
+
addToCache(item: entityType): void;
|
|
24
|
+
get metadata(): EntityMetadata<entityType>;
|
|
25
|
+
listeners: entityEventListener<entityType>[];
|
|
26
|
+
addEventListener(listener: entityEventListener<entityType>): () => void;
|
|
27
|
+
query(options?: QueryOptions<entityType>): QueryResult<entityType>;
|
|
28
|
+
getEntityRef(entity: entityType): EntityRef<entityType>;
|
|
29
|
+
delete(id: entityType extends {
|
|
30
|
+
id?: number;
|
|
31
|
+
} ? number : entityType extends {
|
|
32
|
+
id?: string;
|
|
33
|
+
} ? string : string | number): Promise<void>;
|
|
34
|
+
delete(item: entityType): Promise<void>;
|
|
35
|
+
insert(item: Partial<OmitEB<entityType>>[]): Promise<entityType[]>;
|
|
36
|
+
insert(item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
37
|
+
get fields(): FieldsMetadata<entityType>;
|
|
38
|
+
validate(entity: Partial<OmitEB<entityType>>, ...fields: Extract<keyof OmitEB<entityType>, string>[]): Promise<ErrorInfo<entityType> | undefined>;
|
|
39
|
+
update(id: entityType extends {
|
|
40
|
+
id?: number;
|
|
41
|
+
} ? number : entityType extends {
|
|
42
|
+
id?: string;
|
|
43
|
+
} ? string : string | number, item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
44
|
+
update(originalItem: Partial<OmitEB<entityType>>, item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
45
|
+
private getRefForExistingRow;
|
|
46
|
+
save(item: Partial<OmitEB<entityType>>[]): Promise<entityType[]>;
|
|
47
|
+
save(item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
48
|
+
liveQuery(options?: FindOptions<entityType>): LiveQuery<entityType>;
|
|
49
|
+
find(options: FindOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType[]>;
|
|
50
|
+
buildEntityDataProviderFindOptions(options: FindOptions<entityType>): Promise<EntityDataProviderFindOptions>;
|
|
51
|
+
fromJsonArray(jsonItems: any[], load?: (entity: FieldsMetadata<entityType>) => FieldMetadata[]): Promise<Awaited<entityType>[]>;
|
|
52
|
+
private loadManyToOneForManyRows;
|
|
53
|
+
private mapRawDataToResult;
|
|
54
|
+
toJson(item: entityType | entityType[] | Promise<entityType> | Promise<entityType[]>): any;
|
|
55
|
+
fromJson(json: any, newRow?: boolean): any;
|
|
56
|
+
count(where?: EntityFilter<entityType>): Promise<number>;
|
|
57
|
+
private cache;
|
|
58
|
+
findFirst(where?: EntityFilter<entityType>, options?: FindFirstOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType>;
|
|
59
|
+
private fieldsOf;
|
|
60
|
+
create(item?: Partial<OmitEB<entityType>>): entityType;
|
|
61
|
+
fixTypes(item: any): Promise<any>;
|
|
62
|
+
findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType>;
|
|
63
|
+
}
|
|
64
|
+
export type EntityOptionsFactory = (remult: Remult) => EntityOptions;
|
|
65
|
+
export declare const columnsOfType: Map<any, columnInfo[]>;
|
|
66
|
+
export declare function createOldEntity<T>(entity: ClassType<T>, remult: Remult): EntityFullInfo<T>;
|
|
67
|
+
declare abstract class rowHelperBase<T> {
|
|
68
|
+
protected columnsInfo: FieldOptions[];
|
|
69
|
+
protected instance: T;
|
|
70
|
+
protected remult: Remult;
|
|
71
|
+
_error: string;
|
|
72
|
+
get error(): string;
|
|
73
|
+
set error(val: string);
|
|
74
|
+
constructor(columnsInfo: FieldOptions[], instance: T, remult: Remult);
|
|
75
|
+
_subscribers: SubscribableImp;
|
|
76
|
+
subscribe(listener: RefSubscriber): Unsubscribe;
|
|
77
|
+
_isLoading: boolean;
|
|
78
|
+
initSubscribers(): void;
|
|
79
|
+
get isLoading(): boolean;
|
|
80
|
+
set isLoading(val: boolean);
|
|
81
|
+
lookups: Map<string, LookupColumn<any>>;
|
|
82
|
+
waitLoad(): Promise<void>;
|
|
83
|
+
errors: {
|
|
84
|
+
[key: string]: string;
|
|
85
|
+
};
|
|
86
|
+
protected __assertValidity(): void;
|
|
87
|
+
buildErrorInfoObject(): ErrorInfo<any>;
|
|
88
|
+
abstract get fields(): FieldsRef<T>;
|
|
89
|
+
catchSaveErrors(err: any): any;
|
|
90
|
+
__clearErrorsAndReportChanged(): void;
|
|
91
|
+
_reportChangedToEntityAndFields(): void;
|
|
92
|
+
hasErrors(): boolean;
|
|
93
|
+
copyDataToObject(): any;
|
|
94
|
+
originalValues: any;
|
|
95
|
+
saveOriginalData(): void;
|
|
96
|
+
saveMoreOriginalData(): void;
|
|
97
|
+
validate(): Promise<ErrorInfo<any>>;
|
|
98
|
+
__validateEntity(): Promise<void>;
|
|
99
|
+
__performColumnAndEntityValidations(): Promise<void>;
|
|
100
|
+
toApiJson(includeRelatedEntities?: boolean): any;
|
|
101
|
+
_updateEntityBasedOnApi(body: any): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
export declare class rowHelperImplementation<T> extends rowHelperBase<T> implements EntityRef<T> {
|
|
104
|
+
private info;
|
|
105
|
+
repository: RepositoryImplementation<T>;
|
|
106
|
+
private edp;
|
|
107
|
+
private _isNew;
|
|
108
|
+
constructor(info: EntityFullInfo<T>, instance: T, repository: RepositoryImplementation<T>, edp: EntityDataProvider, remult: Remult, _isNew: boolean);
|
|
109
|
+
get apiUpdateAllowed(): boolean;
|
|
110
|
+
get apiDeleteAllowed(): boolean;
|
|
111
|
+
get apiInsertAllowed(): boolean;
|
|
112
|
+
metadata: EntityMetadata<T>;
|
|
113
|
+
getId(): any;
|
|
114
|
+
saveMoreOriginalData(): void;
|
|
115
|
+
private _wasDeleted;
|
|
116
|
+
wasDeleted(): boolean;
|
|
117
|
+
undoChanges(): void;
|
|
118
|
+
reload(): Promise<T>;
|
|
119
|
+
private _columns;
|
|
120
|
+
get fields(): FieldsRef<T>;
|
|
121
|
+
private _saving;
|
|
122
|
+
save(onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject?: string[]): Promise<T>;
|
|
123
|
+
private getIdFilter;
|
|
124
|
+
delete(): Promise<void>;
|
|
125
|
+
loadDataFrom(data: any, loadItems?: FieldMetadata[]): Promise<void>;
|
|
126
|
+
id: any;
|
|
127
|
+
originalId: any;
|
|
128
|
+
getOriginalId(): any;
|
|
129
|
+
private calcServerExpression;
|
|
130
|
+
isNew(): boolean;
|
|
131
|
+
wasChanged(): boolean;
|
|
132
|
+
__performColumnAndEntityValidations(): Promise<void>;
|
|
133
|
+
}
|
|
134
|
+
export declare function getFields<fieldsContainerType>(container: fieldsContainerType, remult?: Remult): FieldsRef<fieldsContainerType>;
|
|
135
|
+
export declare function getControllerRef<fieldsContainerType>(container: fieldsContainerType, remultArg?: Remult): ControllerRef<fieldsContainerType>;
|
|
136
|
+
export declare class controllerRefImpl<T = any> extends rowHelperBase<T> implements ControllerRef<T> {
|
|
137
|
+
constructor(columnsInfo: FieldOptions[], instance: any, remult: Remult);
|
|
138
|
+
__performColumnAndEntityValidations(): Promise<void>;
|
|
139
|
+
fields: FieldsRef<T>;
|
|
140
|
+
}
|
|
141
|
+
export declare class FieldRefImplementation<entityType, valueType> implements FieldRef<entityType, valueType> {
|
|
142
|
+
private settings;
|
|
143
|
+
metadata: FieldMetadata;
|
|
144
|
+
container: any;
|
|
145
|
+
private helper;
|
|
146
|
+
private rowBase;
|
|
147
|
+
constructor(settings: FieldOptions, metadata: FieldMetadata, container: any, helper: EntityRef<entityType>, rowBase: rowHelperBase<entityType>);
|
|
148
|
+
_subscribers: SubscribableImp;
|
|
149
|
+
subscribe(listener: RefSubscriber): Unsubscribe;
|
|
150
|
+
valueIsNull(): boolean;
|
|
151
|
+
originalValueIsNull(): boolean;
|
|
152
|
+
load(): Promise<valueType>;
|
|
153
|
+
target: ClassType<any>;
|
|
154
|
+
reportObserved(): void;
|
|
155
|
+
reportChanged(): void;
|
|
156
|
+
get error(): string;
|
|
157
|
+
set error(error: string);
|
|
158
|
+
get displayValue(): string;
|
|
159
|
+
get value(): any;
|
|
160
|
+
set value(value: any);
|
|
161
|
+
get originalValue(): any;
|
|
162
|
+
private rawOriginalValue;
|
|
163
|
+
setId(id: string | number): void;
|
|
164
|
+
getId(): any;
|
|
165
|
+
get inputValue(): string;
|
|
166
|
+
set inputValue(val: string);
|
|
167
|
+
valueChanged(): boolean;
|
|
168
|
+
entityRef: EntityRef<any>;
|
|
169
|
+
__performValidation(): Promise<void>;
|
|
170
|
+
validate(): Promise<boolean>;
|
|
171
|
+
}
|
|
172
|
+
export declare const CaptionTransformer: {
|
|
173
|
+
transformCaption: (remult: Remult, key: string, caption: string) => string;
|
|
174
|
+
};
|
|
175
|
+
export declare function buildCaption(caption: string | ((remult: Remult) => string), key: string, remult: Remult): string;
|
|
176
|
+
export declare class columnDefsImpl implements FieldMetadata {
|
|
177
|
+
private settings;
|
|
178
|
+
private entityDefs;
|
|
179
|
+
private remult;
|
|
180
|
+
constructor(settings: FieldOptions, entityDefs: EntityFullInfo<any>, remult: Remult);
|
|
181
|
+
apiUpdateAllowed(item?: any): boolean;
|
|
182
|
+
displayValue(item: any): string;
|
|
183
|
+
get includedInApi(): boolean;
|
|
184
|
+
toInput(value: any, inputType?: string): string;
|
|
185
|
+
fromInput(inputValue: string, inputType?: string): any;
|
|
186
|
+
getDbName(): Promise<string>;
|
|
187
|
+
options: FieldOptions<any, any>;
|
|
188
|
+
target: ClassType<any>;
|
|
189
|
+
readonly: boolean;
|
|
190
|
+
valueConverter: Required<ValueConverter<any>>;
|
|
191
|
+
allowNull: boolean;
|
|
192
|
+
caption: string;
|
|
193
|
+
get dbName(): any;
|
|
194
|
+
inputType: string;
|
|
195
|
+
key: string;
|
|
196
|
+
get dbReadOnly(): boolean;
|
|
197
|
+
isServerExpression: boolean;
|
|
198
|
+
valueType: any;
|
|
199
|
+
}
|
|
200
|
+
declare class EntityFullInfo<T> implements EntityMetadata<T> {
|
|
201
|
+
columnsInfo: FieldOptions[];
|
|
202
|
+
entityInfo: EntityOptions;
|
|
203
|
+
private remult;
|
|
204
|
+
readonly entityType: ClassType<T>;
|
|
205
|
+
readonly key: string;
|
|
206
|
+
options: EntityOptions<T>;
|
|
207
|
+
constructor(columnsInfo: FieldOptions[], entityInfo: EntityOptions, remult: Remult, entityType: ClassType<T>, key: string);
|
|
208
|
+
apiUpdateAllowed(item: T): boolean;
|
|
209
|
+
get apiReadAllowed(): boolean;
|
|
210
|
+
apiDeleteAllowed(item: T): boolean;
|
|
211
|
+
apiInsertAllowed(item: T): boolean;
|
|
212
|
+
getEntityMetadataWithoutBreakingTheEntity(item: T): EntityRef<T>;
|
|
213
|
+
dbNamePromise: Promise<string>;
|
|
214
|
+
getDbName(): Promise<string>;
|
|
215
|
+
idMetadata: IdMetadata<T>;
|
|
216
|
+
fields: FieldsMetadata<T>;
|
|
217
|
+
dbName: string;
|
|
218
|
+
caption: string;
|
|
219
|
+
}
|
|
220
|
+
export declare function FieldType<valueType = any>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any, context?: any) => any;
|
|
221
|
+
export declare class Fields {
|
|
222
|
+
/**
|
|
223
|
+
* Stored as a JSON.stringify - to store as json use Fields.json
|
|
224
|
+
*/
|
|
225
|
+
static object<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
|
|
226
|
+
static json<entityType = any, valueType = any>(...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
|
|
227
|
+
static dateOnly<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
228
|
+
static date<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
229
|
+
static integer<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, number | undefined>, c?: any) => void;
|
|
230
|
+
static autoIncrement<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, number | undefined>, c?: any) => void;
|
|
231
|
+
static number<entityType = any>(...options: (FieldOptions<entityType, Number> | ((options: FieldOptions<entityType, Number>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, number | undefined>, c?: any) => void;
|
|
232
|
+
static createdAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
233
|
+
static updatedAt<entityType = any>(...options: (FieldOptions<entityType, Date> | ((options: FieldOptions<entityType, Date>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, Date | undefined>, c?: any) => void;
|
|
234
|
+
static uuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, string | undefined>, c?: any) => void;
|
|
235
|
+
static cuid<entityType = any>(...options: (FieldOptions<entityType, string> | ((options: FieldOptions<entityType, string>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, string | undefined>, c?: any) => void;
|
|
236
|
+
static string<entityType = any>(...options: (StringFieldOptions<entityType> | ((options: StringFieldOptions<entityType>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, string | undefined>, c?: any) => void;
|
|
237
|
+
static boolean<entityType = any>(...options: (FieldOptions<entityType, boolean> | ((options: FieldOptions<entityType, boolean>, remult: Remult) => void))[]): (target: any, context: string | ClassFieldDecoratorContextStub<entityType, boolean | undefined>, c?: any) => void;
|
|
238
|
+
}
|
|
239
|
+
export declare function isAutoIncrement(f: FieldMetadata): boolean;
|
|
240
|
+
export interface StringFieldOptions<entityType = any> extends FieldOptions<entityType, string> {
|
|
241
|
+
maxLength?: number;
|
|
242
|
+
}
|
|
243
|
+
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;
|
|
244
|
+
export interface ValueListFieldOptions<entityType, valueType> extends FieldOptions<entityType, valueType> {
|
|
245
|
+
getValues?: () => valueType[];
|
|
246
|
+
}
|
|
247
|
+
export declare class ValueListInfo<T extends ValueListItem> implements ValueConverter<T> {
|
|
248
|
+
private valueListType;
|
|
249
|
+
static get<T extends ValueListItem>(type: ClassType<T>): ValueListInfo<T>;
|
|
250
|
+
private byIdMap;
|
|
251
|
+
private values;
|
|
252
|
+
isNumeric: boolean;
|
|
253
|
+
private constructor();
|
|
254
|
+
getValues(): T[];
|
|
255
|
+
byId(key: any): T;
|
|
256
|
+
fromJson(val: any): T;
|
|
257
|
+
toJson(val: T): any;
|
|
258
|
+
fromDb(val: any): T;
|
|
259
|
+
toDb(val: T): any;
|
|
260
|
+
toInput(val: T, inputType: string): string;
|
|
261
|
+
fromInput(val: string, inputType: string): T;
|
|
262
|
+
displayValue?(val: T): string;
|
|
263
|
+
fieldTypeInDb?: string;
|
|
264
|
+
inputType?: string;
|
|
265
|
+
}
|
|
266
|
+
export declare function getValueList<T>(field: FieldRef<T>): T[];
|
|
267
|
+
export declare function getValueList<T>(field: FieldMetadata<T>): T[];
|
|
268
|
+
export declare function getValueList<T>(type: ClassType<T>): T[];
|
|
269
|
+
export interface ClassFieldDecoratorContextStub<entityType, valueType> {
|
|
270
|
+
readonly access: {
|
|
271
|
+
set(object: entityType, value: valueType): void;
|
|
272
|
+
};
|
|
273
|
+
readonly name: string;
|
|
274
|
+
}
|
|
275
|
+
export interface ClassDecoratorContextStub<Class extends new (...args: any) => any = new (...args: any) => any> {
|
|
276
|
+
readonly kind: 'class';
|
|
277
|
+
readonly name: string | undefined;
|
|
278
|
+
addInitializer(initializer: (this: Class) => void): void;
|
|
279
|
+
}
|
|
280
|
+
/**Decorates fields that should be used as fields.
|
|
281
|
+
* for more info see: [Field Types](https://remult.dev/docs/field-types.html)
|
|
282
|
+
*
|
|
283
|
+
* FieldOptions can be set in two ways:
|
|
284
|
+
* @example
|
|
285
|
+
* // as an object
|
|
286
|
+
* @Fields.string({ includeInApi:false })
|
|
287
|
+
* title='';
|
|
288
|
+
* @example
|
|
289
|
+
* // as an arrow function that receives `remult` as a parameter
|
|
290
|
+
* @Fields.string((options,remult) => options.includeInApi = true)
|
|
291
|
+
* title='';
|
|
292
|
+
*/
|
|
293
|
+
export declare function Field<entityType = any, valueType = any>(valueType: () => ClassType<valueType>, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string, c?: any) => void;
|
|
294
|
+
export declare const storableMember: unique symbol;
|
|
295
|
+
export declare function decorateColumnSettings<valueType>(settings: FieldOptions<any, valueType>, remult: Remult): FieldOptions<any, valueType>;
|
|
296
|
+
interface columnInfo {
|
|
297
|
+
key: string;
|
|
298
|
+
settings: (remult: Remult) => FieldOptions;
|
|
299
|
+
}
|
|
300
|
+
export declare class EntityBase {
|
|
301
|
+
get _(): EntityRef<this>;
|
|
302
|
+
save(): Promise<this>;
|
|
303
|
+
assign(values: Partial<Omit<this, keyof EntityBase>>): this;
|
|
304
|
+
delete(): Promise<void>;
|
|
305
|
+
isNew(): boolean;
|
|
306
|
+
get $(): FieldsRef<this>;
|
|
307
|
+
}
|
|
308
|
+
export declare class IdEntity extends EntityBase {
|
|
309
|
+
id: string;
|
|
310
|
+
}
|
|
311
|
+
export declare class ControllerBase {
|
|
312
|
+
protected remult: Remult;
|
|
313
|
+
constructor(remult?: Remult);
|
|
314
|
+
assign(values: Partial<Omit<this, keyof EntityBase>>): this;
|
|
315
|
+
get $(): FieldsRef<this>;
|
|
316
|
+
get _(): ControllerRef<this>;
|
|
317
|
+
}
|
|
318
|
+
declare class SubscribableImp implements Subscribable {
|
|
319
|
+
reportChanged(): void;
|
|
320
|
+
reportObserved(): void;
|
|
321
|
+
private _subscribers;
|
|
322
|
+
subscribe(listener: (() => void) | {
|
|
323
|
+
reportChanged: () => void;
|
|
324
|
+
reportObserved: () => void;
|
|
325
|
+
}): Unsubscribe;
|
|
326
|
+
}
|
|
327
|
+
export declare function getEntityMetadata<entityType>(entity: EntityMetadataOverloads<entityType>): EntityMetadata<entityType>;
|
|
328
|
+
export declare function getRepository<entityType>(entity: RepositoryOverloads<entityType>): Repository<entityType>;
|
|
329
|
+
export type EntityMetadataOverloads<entityType> = Repository<entityType> | EntityMetadata<entityType> | ClassType<entityType>;
|
|
330
|
+
export type RepositoryOverloads<entityType> = Repository<entityType> | ClassType<entityType>;
|
|
331
|
+
export declare function checkTarget(target: any): void;
|
|
332
|
+
export {};
|