remult 0.22.9-exp.0 → 0.22.10

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 (56) hide show
  1. package/README.md +1 -0
  2. package/esm/index.d.ts +3 -4
  3. package/esm/index.js +1 -3
  4. package/esm/internals.d.ts +2 -1
  5. package/esm/internals.js +1 -1
  6. package/esm/live-query/data-provider-live-query-storage.js +1 -2
  7. package/esm/server/expressBridge.d.ts +1 -1
  8. package/esm/server/expressBridge.js +1 -2
  9. package/esm/src/column.d.ts +2 -3
  10. package/esm/src/column.js +5 -6
  11. package/esm/src/context.js +5 -2
  12. package/esm/src/data-providers/array-entity-data-provider.d.ts +2 -5
  13. package/esm/src/data-providers/array-entity-data-provider.js +46 -63
  14. package/esm/src/data-providers/rest-data-provider.d.ts +1 -1
  15. package/esm/src/data-providers/rest-data-provider.js +7 -51
  16. package/esm/src/remult-proxy.js +3 -2
  17. package/esm/src/remult3/Fields.d.ts +140 -21
  18. package/esm/src/remult3/Fields.js +26 -30
  19. package/esm/src/remult3/RepositoryImplementation.d.ts +49 -12
  20. package/esm/src/remult3/RepositoryImplementation.js +195 -202
  21. package/esm/src/remult3/relation-loader.js +4 -1
  22. package/esm/src/remult3/remult3.d.ts +1 -30
  23. package/esm/src/remult3/remult3.js +0 -4
  24. package/esm/src/remult3/repository-internals.d.ts +14 -0
  25. package/esm/src/remult3/repository-internals.js +7 -0
  26. package/esm/src/server-action.js +2 -3
  27. package/esm/src/sort.d.ts +1 -1
  28. package/esm/src/sort.js +3 -5
  29. package/index.d.ts +3 -4
  30. package/index.js +4 -6
  31. package/internals.d.ts +2 -1
  32. package/internals.js +3 -1
  33. package/live-query/data-provider-live-query-storage.js +4 -5
  34. package/package.json +14 -6
  35. package/server/expressBridge.d.ts +1 -1
  36. package/server/expressBridge.js +10 -11
  37. package/src/column.d.ts +2 -3
  38. package/src/column.js +4 -4
  39. package/src/context.js +4 -1
  40. package/src/data-providers/array-entity-data-provider.d.ts +2 -5
  41. package/src/data-providers/array-entity-data-provider.js +134 -192
  42. package/src/data-providers/rest-data-provider.d.ts +1 -1
  43. package/src/data-providers/rest-data-provider.js +4 -45
  44. package/src/remult-proxy.js +9 -4
  45. package/src/remult3/Fields.d.ts +140 -21
  46. package/src/remult3/Fields.js +32 -32
  47. package/src/remult3/RepositoryImplementation.d.ts +49 -12
  48. package/src/remult3/RepositoryImplementation.js +418 -423
  49. package/src/remult3/relation-loader.js +4 -1
  50. package/src/remult3/remult3.d.ts +1 -30
  51. package/src/remult3/remult3.js +0 -4
  52. package/src/remult3/repository-internals.d.ts +14 -0
  53. package/src/remult3/repository-internals.js +11 -0
  54. package/src/server-action.js +2 -3
  55. package/src/sort.d.ts +1 -1
  56. package/src/sort.js +3 -5
package/README.md CHANGED
@@ -278,6 +278,7 @@ with a Node.js Express backend.
278
278
  - [Tutorial with Angular](https://remult.dev/tutorials/angular/)
279
279
  - [Tutorial with Vue](https://remult.dev/tutorials/vue/)
280
280
  - [Tutorial with Next.js](https://remult.dev/tutorials/react-next/)
281
+ - [Tutorial with Sveltekit](https://remult.dev/tutorials/sveltekit/)
281
282
 
282
283
  ## Documentation
283
284
 
package/esm/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- export { OmitEB, FieldsMetadata, FieldRef, IdFieldRef, FieldsRef, EntityMetadata, EntityOrderBy, EntityFilter, FindOptions, QueryResult, QueryOptions, Repository, FindFirstOptions, ComparisonValueFilter, ValueFilter, IdFilter, ContainsStringValueFilter, EntityRef, SortSegments, Paginator, LiveQuery, LiveQueryChangeInfo, Subscribable, RefSubscriber, RefSubscriberBase, RelationOptions, RelationOptionsBase, ObjectMembersOnly, MembersToInclude, RepositoryRelations, } from './src/remult3/remult3';
2
- export { EntityBase, ControllerBase, FieldType, getFields, ValueListFieldType, getValueList, ValueListFieldOptions, ValueListInfo, CaptionTransformer, } from './src/remult3/RepositoryImplementation';
1
+ export { OmitEB, FieldsMetadata, FieldRef, IdFieldRef, FieldsRef, EntityMetadata, EntityOrderBy, EntityFilter, FindOptions, QueryResult, QueryOptions, Repository, FindFirstOptions, ComparisonValueFilter, ValueFilter, IdFilter, ContainsStringValueFilter, EntityRef, SortSegments, Paginator, LiveQuery, LiveQueryChangeInfo, } from './src/remult3/remult3';
2
+ export { Field, Fields, IdEntity, EntityBase, ControllerBase, FieldType, getFields, ValueListFieldType, getValueList, ValueListFieldOptions, ValueListInfo, CaptionTransformer, } from './src/remult3/RepositoryImplementation';
3
3
  export { Entity } from './src/remult3/entity';
4
4
  export { getEntityRef } from './src/remult3/getEntityRef';
5
- export { Field, Fields, StringFieldOptions } from './src/remult3/Fields';
6
- export { IdEntity } from './src/remult3/IdEntity';
5
+ export { StringFieldOptions } from './src/remult3/RepositoryImplementation';
7
6
  export { describeClass } from './src/remult3/DecoratorReplacer';
8
7
  export { EntityOptions } from './src/entity';
9
8
  export { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, ErrorInfo, RestDataProviderHttpProvider, } from './src/data-interfaces';
package/esm/index.js CHANGED
@@ -1,8 +1,6 @@
1
- export { EntityBase, ControllerBase, FieldType, getFields, ValueListFieldType, getValueList, ValueListInfo, CaptionTransformer, } from './src/remult3/RepositoryImplementation';
1
+ export { Field, Fields, IdEntity, EntityBase, ControllerBase, FieldType, getFields, ValueListFieldType, getValueList, ValueListInfo, CaptionTransformer, } from './src/remult3/RepositoryImplementation';
2
2
  export { Entity } from './src/remult3/entity';
3
3
  export { getEntityRef } from './src/remult3/getEntityRef';
4
- export { Field, Fields } from './src/remult3/Fields';
5
- export { IdEntity } from './src/remult3/IdEntity';
6
4
  export { describeClass } from './src/remult3/DecoratorReplacer';
7
5
  export { RestDataProvider } from './src/data-providers/rest-data-provider'; //V
8
6
  export { InMemoryDataProvider } from './src/data-providers/in-memory-database'; //V
@@ -1,6 +1,7 @@
1
1
  export { getRelationInfo } from './src/remult3/relationInfoMember';
2
- export { decorateColumnSettings } from './src/remult3/RepositoryImplementation';
2
+ export { decorateColumnSettings, controllerRefImpl, getControllerRef, } from './src/remult3/RepositoryImplementation';
3
3
  export { getEntitySettings } from './src/remult3/getEntityRef';
4
4
  export { __updateEntityBasedOnWhere } from './src/filter/filter-interfaces';
5
5
  export { actionInfo } from './src/server-action-info';
6
6
  export { RelationInfo } from './src/remult3/remult3';
7
+ export { ClassType } from './classType';
package/esm/internals.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { getRelationInfo } from './src/remult3/relationInfoMember';
2
- export { decorateColumnSettings } from './src/remult3/RepositoryImplementation';
2
+ export { decorateColumnSettings, controllerRefImpl, getControllerRef, } from './src/remult3/RepositoryImplementation';
3
3
  export { getEntitySettings } from './src/remult3/getEntityRef';
4
4
  export { __updateEntityBasedOnWhere } from './src/filter/filter-interfaces';
5
5
  export { actionInfo } from './src/server-action-info';
@@ -1,8 +1,7 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { initDataProvider } from '../server/initDataProvider';
3
3
  import { allEntities, Remult } from '../src/context';
4
- import { EntityBase } from '../src/remult3/RepositoryImplementation';
5
- import { Fields } from '../src/remult3/Fields';
4
+ import { EntityBase, Fields } from '../src/remult3/RepositoryImplementation';
6
5
  import { Entity } from '../src/remult3/entity';
7
6
  export class DataProviderLiveQueryStorage {
8
7
  repo;
@@ -3,7 +3,7 @@ import type { UserInfo } from '../src/context';
3
3
  import { Remult } from '../src/context';
4
4
  import type { DataProvider } from '../src/data-interfaces';
5
5
  import type { LiveQueryStorage, SubscriptionServer } from '../src/live-query/SubscriptionServer';
6
- import { IdEntity } from '../src/remult3/IdEntity';
6
+ import { IdEntity } from '../src/remult3/RepositoryImplementation';
7
7
  import type { Repository } from '../src/remult3/remult3';
8
8
  import type { queuedJobInfoResponse } from '../src/server-action';
9
9
  export interface RemultServerOptions<RequestType> {
@@ -4,8 +4,7 @@ import { Remult, RemultAsyncLocalStorage, allEntities } from '../src/context';
4
4
  import { DataApi, serializeError } from '../src/data-api';
5
5
  import { liveQueryKeepAliveRoute, streamUrl, } from '../src/live-query/SubscriptionChannel';
6
6
  import { InMemoryLiveQueryStorage, LiveQueryPublisher, } from '../src/live-query/SubscriptionServer';
7
- import { IdEntity } from '../src/remult3/IdEntity';
8
- import { Fields } from '../src/remult3/Fields';
7
+ import { Fields, IdEntity } from '../src/remult3/RepositoryImplementation';
9
8
  import { Entity } from '../src/remult3/entity';
10
9
  import { getEntityKey } from '../src/remult3/getEntityRef';
11
10
  import { Action, classBackendMethodsArray } from '../src/server-action';
@@ -3,7 +3,7 @@ import type { RepositoryImplementation } from './remult3/RepositoryImplementatio
3
3
  export declare function makeTitle(name: string): string;
4
4
  export declare class LookupColumn<T> {
5
5
  private repository;
6
- private isManyToOneRelation;
6
+ id: idType<T>;
7
7
  toJson(): any;
8
8
  setId(val: any): void;
9
9
  waitLoadOf(id: any): Promise<T>;
@@ -12,8 +12,7 @@ export declare class LookupColumn<T> {
12
12
  item: T;
13
13
  };
14
14
  set(item: T): void;
15
- id: idType<T>;
16
- constructor(repository: RepositoryImplementation<T>, isManyToOneRelation: any);
15
+ constructor(repository: RepositoryImplementation<T>, id: idType<T>);
17
16
  get item(): T;
18
17
  waitLoad(): Promise<T>;
19
18
  }
package/esm/src/column.js CHANGED
@@ -12,7 +12,7 @@ export function makeTitle(name) {
12
12
  }
13
13
  export class LookupColumn {
14
14
  repository;
15
- isManyToOneRelation;
15
+ id;
16
16
  toJson() {
17
17
  if (!this.storedItem)
18
18
  return undefined;
@@ -28,12 +28,12 @@ export class LookupColumn {
28
28
  waitLoadOf(id) {
29
29
  if (id === undefined || id === null)
30
30
  return null;
31
- return this.repository.getCachedByIdAsync(id, false);
31
+ return this.repository.getCachedByIdAsync(id);
32
32
  }
33
33
  get(id) {
34
34
  if (id === undefined || id === null)
35
35
  return null;
36
- return this.repository.getCachedById(id, this.isManyToOneRelation);
36
+ return this.repository.getCachedById(id);
37
37
  }
38
38
  storedItem;
39
39
  set(item) {
@@ -60,10 +60,9 @@ export class LookupColumn {
60
60
  this.id = undefined;
61
61
  }
62
62
  }
63
- id;
64
- constructor(repository, isManyToOneRelation) {
63
+ constructor(repository, id) {
65
64
  this.repository = repository;
66
- this.isManyToOneRelation = isManyToOneRelation;
65
+ this.id = id;
67
66
  }
68
67
  get item() {
69
68
  if (this.storedItem)
@@ -2,7 +2,7 @@ import { RestDataProvider } from './data-providers/rest-data-provider';
2
2
  import { LiveQueryClient } from './live-query/LiveQueryClient';
3
3
  import { SseSubscriptionClient } from './live-query/SseSubscriptionClient';
4
4
  import { RemultProxy, remult } from './remult-proxy';
5
- import { RepositoryImplementation, createOldEntity, } from './remult3/RepositoryImplementation';
5
+ import { RepositoryImplementation } from './remult3/RepositoryImplementation';
6
6
  import { actionInfo, serverActionField } from './server-action-info';
7
7
  import { buildRestDataProvider, isExternalHttpProvider, } from './buildRestDataProvider';
8
8
  export class RemultAsyncLocalStorage {
@@ -57,7 +57,7 @@ export class Remult {
57
57
  this.repCache.set(dataProvider, (dpCache = new Map()));
58
58
  let r = dpCache.get(entity);
59
59
  if (!r) {
60
- dpCache.set(entity, (r = new RepositoryImplementation(entity, this, dataProvider, createOldEntity(entity, this))));
60
+ dpCache.set(entity, (r = new RepositoryImplementation(entity, this, dataProvider)));
61
61
  }
62
62
  return r;
63
63
  }
@@ -285,3 +285,6 @@ class transactionLiveQueryPublisher {
285
285
  }
286
286
  }
287
287
  }
288
+ //p1 - seems that after backend methods relations are loaded for some reason - see trempim - intake doRequest backend method
289
+ //p1 - reconsider the case in tremping where create user id was updated with some user and not the actual user
290
+ //[ ] - when value changes for field with error, clear error - so the user will feel comfortable
@@ -1,5 +1,4 @@
1
1
  import type { EntityDataProvider, EntityDataProviderFindOptions } from '../data-interfaces';
2
- import { type EntityDbNamesBase } from '../filter/filter-consumer-bridge-to-sql-request';
3
2
  import { Filter } from '../filter/filter-interfaces';
4
3
  import type { EntityFilter, EntityMetadata } from '../remult3/remult3';
5
4
  export declare class ArrayEntityDataProvider implements EntityDataProvider {
@@ -7,13 +6,11 @@ export declare class ArrayEntityDataProvider implements EntityDataProvider {
7
6
  private rows?;
8
7
  static rawFilter(filter: CustomArrayFilter): EntityFilter<any>;
9
8
  constructor(entity: EntityMetadata, rows?: any[]);
10
- __names: EntityDbNamesBase;
11
- init(): Promise<EntityDbNamesBase>;
12
9
  private verifyThatRowHasAllNotNullColumns;
13
10
  count(where?: Filter): Promise<number>;
14
11
  find(options?: EntityDataProviderFindOptions): Promise<any[]>;
15
- translateFromJson(row: any, dbNames: EntityDbNamesBase): {};
16
- translateToJson(row: any, dbNames: EntityDbNamesBase): {};
12
+ translateFromJson(row: any): {};
13
+ translateToJson(row: any): {};
17
14
  private idMatches;
18
15
  update(id: any, data: any): Promise<any>;
19
16
  delete(id: any): Promise<void>;
@@ -1,5 +1,4 @@
1
1
  import { CompoundIdField } from '../CompoundIdField';
2
- import { dbNamesOf, isDbReadonly, } from '../filter/filter-consumer-bridge-to-sql-request';
3
2
  import { Filter, customDatabaseFilterToken } from '../filter/filter-interfaces';
4
3
  export class ArrayEntityDataProvider {
5
4
  entity;
@@ -17,24 +16,16 @@ export class ArrayEntityDataProvider {
17
16
  if (!rows)
18
17
  rows = [];
19
18
  else {
19
+ for (const r of rows) {
20
+ this.verifyThatRowHasAllNotNullColumns(r);
21
+ }
20
22
  }
21
23
  }
22
- __names;
23
- async init() {
24
- if (this.__names)
25
- return this.__names;
26
- this.__names = await dbNamesOf(this.entity);
27
- for (const r of this.rows) {
28
- this.verifyThatRowHasAllNotNullColumns(r, this.__names);
29
- }
30
- return this.__names;
31
- }
32
- verifyThatRowHasAllNotNullColumns(r, names) {
24
+ verifyThatRowHasAllNotNullColumns(r) {
33
25
  for (const f of this.entity.fields) {
34
- const key = names.$dbNameOf(f);
35
26
  if (!f.isServerExpression)
36
27
  if (!f.allowNull) {
37
- if (r[key] === undefined || r[key] === null) {
28
+ if (r[f.key] === undefined || r[f.key] === null) {
38
29
  let val = undefined;
39
30
  if (f.valueType === Boolean)
40
31
  val = false;
@@ -42,23 +33,22 @@ export class ArrayEntityDataProvider {
42
33
  val = 0;
43
34
  else if (f.valueType === String)
44
35
  val = '';
45
- r[key] = val;
36
+ r[f.key] = val;
46
37
  }
47
38
  }
48
- else if (r[key] === undefined)
49
- r[key] = null;
39
+ else if (r[f.key] === undefined)
40
+ r[f.key] = null;
50
41
  }
51
42
  }
52
43
  async count(where) {
53
44
  let rows = this.rows;
54
- const names = await this.init();
55
45
  let j = 0;
56
46
  for (let i = 0; i < rows.length; i++) {
57
47
  if (!where) {
58
48
  j++;
59
49
  }
60
50
  else {
61
- let x = new FilterConsumerBridgeToObject(rows[i], names);
51
+ let x = new FilterConsumerBridgeToObject(rows[i]);
62
52
  where.__applyToConsumer(x);
63
53
  if (x.ok)
64
54
  j++;
@@ -68,74 +58,70 @@ export class ArrayEntityDataProvider {
68
58
  }
69
59
  async find(options) {
70
60
  let rows = this.rows;
71
- const dbNames = await this.init();
72
61
  if (options) {
73
62
  if (options.where) {
74
63
  rows = rows.filter((i) => {
75
- let x = new FilterConsumerBridgeToObject(i, dbNames);
64
+ let x = new FilterConsumerBridgeToObject(i);
76
65
  options.where.__applyToConsumer(x);
77
66
  return x.ok;
78
67
  });
79
68
  }
80
69
  if (options.orderBy) {
81
70
  rows = rows.sort((a, b) => {
82
- return options.orderBy.compare(a, b, dbNames.$dbNameOf);
71
+ return options.orderBy.compare(a, b);
83
72
  });
84
73
  }
85
74
  rows = pageArray(rows, options);
86
75
  }
87
76
  if (rows)
88
77
  return rows.map((i) => {
89
- return this.translateFromJson(i, dbNames);
78
+ return this.translateFromJson(i);
90
79
  });
91
80
  }
92
- translateFromJson(row, dbNames) {
81
+ translateFromJson(row) {
93
82
  let result = {};
94
83
  for (const col of this.entity.fields) {
95
- result[col.key] = col.valueConverter.fromJson(row[dbNames.$dbNameOf(col)]);
84
+ result[col.key] = col.valueConverter.fromJson(row[col.key]);
96
85
  }
97
86
  return result;
98
87
  }
99
- translateToJson(row, dbNames) {
88
+ translateToJson(row) {
100
89
  let result = {};
101
90
  for (const col of this.entity.fields) {
102
- if (!isDbReadonly(col, dbNames))
103
- result[dbNames.$dbNameOf(col)] = col.valueConverter.toJson(row[col.key]);
91
+ result[col.key] = col.valueConverter.toJson(row[col.key]);
104
92
  }
105
93
  return result;
106
94
  }
107
- idMatches(id, names) {
95
+ idMatches(id) {
108
96
  return (item) => {
109
- let x = new FilterConsumerBridgeToObject(item, names);
97
+ let x = new FilterConsumerBridgeToObject(item);
110
98
  Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(x);
111
99
  return x.ok;
112
100
  };
113
101
  }
114
- async update(id, data) {
115
- const names = await this.init();
116
- let idMatches = this.idMatches(id, names);
102
+ update(id, data) {
103
+ let idMatches = this.idMatches(id);
117
104
  let keys = Object.keys(data);
118
105
  for (let i = 0; i < this.rows.length; i++) {
119
106
  let r = this.rows[i];
120
107
  if (idMatches(r)) {
121
108
  let newR = { ...r };
122
109
  for (const f of this.entity.fields) {
123
- if (!isDbReadonly(f, names)) {
110
+ if (!f.dbReadOnly && !f.isServerExpression) {
124
111
  if (keys.includes(f.key)) {
125
- newR[names.$dbNameOf(f)] = f.valueConverter.toJson(data[f.key]);
112
+ newR[f.key] = f.valueConverter.toJson(data[f.key]);
126
113
  }
127
114
  }
128
115
  }
129
- this.verifyThatRowHasAllNotNullColumns(newR, names);
116
+ this.verifyThatRowHasAllNotNullColumns(newR);
130
117
  this.rows[i] = newR;
131
- return Promise.resolve(this.translateFromJson(this.rows[i], names));
118
+ return Promise.resolve(this.translateFromJson(this.rows[i]));
132
119
  }
133
120
  }
134
121
  throw new Error("couldn't find id to update: " + id);
135
122
  }
136
- async delete(id) {
137
- const names = await this.init();
138
- let idMatches = this.idMatches(id, names);
123
+ delete(id) {
124
+ let idMatches = this.idMatches(id);
139
125
  for (let i = 0; i < this.rows.length; i++) {
140
126
  if (idMatches(this.rows[i])) {
141
127
  this.rows.splice(i, 1);
@@ -145,26 +131,25 @@ export class ArrayEntityDataProvider {
145
131
  throw new Error("couldn't find id to delete: " + id);
146
132
  }
147
133
  async insert(data) {
148
- const names = await this.init();
149
- let j = this.translateToJson(data, names);
150
134
  let idf = this.entity.idMetadata.field;
151
135
  if (!(idf instanceof CompoundIdField)) {
152
136
  if (idf.options.valueConverter?.fieldTypeInDb === 'autoincrement') {
153
- j[idf.key] = 1;
137
+ data[idf.key] = 1;
154
138
  for (const row of this.rows) {
155
- if (row[idf.key] >= j[idf.key])
156
- j[idf.key] = row[idf.key] + 1;
139
+ if (row[idf.key] >= data[idf.key])
140
+ data[idf.key] = row[idf.key] + 1;
157
141
  }
158
142
  }
159
- if (j[idf.key])
143
+ if (data[idf.key])
160
144
  this.rows.forEach((i) => {
161
- if (j[idf.key] == i[idf.key])
145
+ if (data[idf.key] == i[idf.key])
162
146
  throw Error('id already exists');
163
147
  });
164
148
  }
165
- this.verifyThatRowHasAllNotNullColumns(j, names);
149
+ let j = this.translateToJson(data);
150
+ this.verifyThatRowHasAllNotNullColumns(j);
166
151
  this.rows.push(j);
167
- return Promise.resolve(this.translateFromJson(j, names));
152
+ return Promise.resolve(this.translateFromJson(j));
168
153
  }
169
154
  }
170
155
  function pageArray(rows, options) {
@@ -187,11 +172,9 @@ function pageArray(rows, options) {
187
172
  }
188
173
  class FilterConsumerBridgeToObject {
189
174
  row;
190
- dbNames;
191
175
  ok = true;
192
- constructor(row, dbNames) {
176
+ constructor(row) {
193
177
  this.row = row;
194
- this.dbNames = dbNames;
195
178
  }
196
179
  databaseCustom(databaseCustom) {
197
180
  if (databaseCustom && databaseCustom.arrayFilter) {
@@ -204,7 +187,7 @@ class FilterConsumerBridgeToObject {
204
187
  }
205
188
  or(orElements) {
206
189
  for (const element of orElements) {
207
- let filter = new FilterConsumerBridgeToObject(this.row, this.dbNames);
190
+ let filter = new FilterConsumerBridgeToObject(this.row);
208
191
  element.__applyToConsumer(filter);
209
192
  if (filter.ok) {
210
193
  return;
@@ -213,47 +196,47 @@ class FilterConsumerBridgeToObject {
213
196
  this.ok = false;
214
197
  }
215
198
  isNull(col) {
216
- if (this.row[this.dbNames.$dbNameOf(col)] != null)
199
+ if (this.row[col.key] != null)
217
200
  this.ok = false;
218
201
  }
219
202
  isNotNull(col) {
220
- if (this.row[this.dbNames.$dbNameOf(col)] == null)
203
+ if (this.row[col.key] == null)
221
204
  this.ok = false;
222
205
  }
223
206
  isIn(col, val) {
224
207
  for (const v of val) {
225
- if (this.row[this.dbNames.$dbNameOf(col)] == col.valueConverter.toJson(v)) {
208
+ if (this.row[col.key] == col.valueConverter.toJson(v)) {
226
209
  return;
227
210
  }
228
211
  }
229
212
  this.ok = false;
230
213
  }
231
214
  isEqualTo(col, val) {
232
- if (this.row[this.dbNames.$dbNameOf(col)] != col.valueConverter.toJson(val))
215
+ if (this.row[col.key] != col.valueConverter.toJson(val))
233
216
  this.ok = false;
234
217
  }
235
218
  isDifferentFrom(col, val) {
236
- if (this.row[this.dbNames.$dbNameOf(col)] == col.valueConverter.toJson(val))
219
+ if (this.row[col.key] == col.valueConverter.toJson(val))
237
220
  this.ok = false;
238
221
  }
239
222
  isGreaterOrEqualTo(col, val) {
240
- if (this.row[this.dbNames.$dbNameOf(col)] < col.valueConverter.toJson(val))
223
+ if (this.row[col.key] < col.valueConverter.toJson(val))
241
224
  this.ok = false;
242
225
  }
243
226
  isGreaterThan(col, val) {
244
- if (this.row[this.dbNames.$dbNameOf(col)] <= col.valueConverter.toJson(val))
227
+ if (this.row[col.key] <= col.valueConverter.toJson(val))
245
228
  this.ok = false;
246
229
  }
247
230
  isLessOrEqualTo(col, val) {
248
- if (this.row[this.dbNames.$dbNameOf(col)] > col.valueConverter.toJson(val))
231
+ if (this.row[col.key] > col.valueConverter.toJson(val))
249
232
  this.ok = false;
250
233
  }
251
234
  isLessThan(col, val) {
252
- if (this.row[this.dbNames.$dbNameOf(col)] >= col.valueConverter.toJson(val))
235
+ if (this.row[col.key] >= col.valueConverter.toJson(val))
253
236
  this.ok = false;
254
237
  }
255
238
  containsCaseInsensitive(col, val) {
256
- let v = this.row[this.dbNames.$dbNameOf(col)];
239
+ let v = this.row[col.key];
257
240
  if (!v) {
258
241
  this.ok = false;
259
242
  return;
@@ -1,6 +1,6 @@
1
1
  import type { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, RestDataProviderHttpProvider } from '../data-interfaces';
2
2
  import { UrlBuilder } from '../../urlBuilder';
3
- import { type ApiClient } from '../context';
3
+ import type { ApiClient } from '../context';
4
4
  import { Filter } from '../filter/filter-interfaces';
5
5
  import type { EntityMetadata } from '../remult3/remult3';
6
6
  export declare class RestDataProvider implements DataProvider {
@@ -1,9 +1,7 @@
1
1
  import { UrlBuilder } from '../../urlBuilder';
2
2
  import { buildRestDataProvider, retry } from '../buildRestDataProvider';
3
- import { Remult } from '../context';
4
3
  import { customUrlToken, Filter } from '../filter/filter-interfaces';
5
4
  import { actionInfo } from '../server-action-info';
6
- import { getRelationInfo } from '../remult3/relationInfoMember';
7
5
  export class RestDataProvider {
8
6
  apiProvider;
9
7
  constructor(apiProvider) {
@@ -26,64 +24,22 @@ export class RestDataProvider {
26
24
  }
27
25
  //@internal
28
26
  export function findOptionsToJson(options, meta) {
29
- if (options.include) {
30
- let newInclude = {};
31
- for (const key in options.include) {
32
- if (Object.prototype.hasOwnProperty.call(options.include, key)) {
33
- let element = options.include[key];
34
- if (typeof element === 'object') {
35
- const rel = getRelationInfo(meta.fields.find(key).options);
36
- if (rel) {
37
- element = findOptionsToJson(element, new Remult().repo(rel.toType()).metadata);
38
- }
39
- }
40
- newInclude[key] = element;
41
- }
42
- }
43
- options = { ...options, include: newInclude };
44
- }
45
- if (options.where)
46
- options = {
47
- ...options,
48
- where: Filter.entityFilterToJson(meta, options.where),
49
- };
27
+ const r = {
28
+ ...options,
29
+ where: Filter.entityFilterToJson(meta, options.where),
30
+ };
50
31
  if (options.load)
51
- options = {
52
- ...options,
53
- load: options.load(meta.fields).map((y) => y.key),
54
- };
55
- return options;
32
+ r.load = options.load(meta.fields).map((y) => y.key);
33
+ return r;
56
34
  }
57
35
  //@internal
58
36
  export function findOptionsFromJson(json, meta) {
59
37
  let r = {};
60
- for (const key of [
61
- 'limit',
62
- 'page',
63
- 'where',
64
- 'orderBy',
65
- 'include',
66
- ]) {
38
+ for (const key of ['limit', 'page', 'where', 'orderBy']) {
67
39
  if (json[key] !== undefined) {
68
40
  if (key === 'where') {
69
41
  r[key] = Filter.entityFilterFromJson(meta, json.where);
70
42
  }
71
- else if (key === 'include') {
72
- let newInclude = { ...json[key] };
73
- for (const key in newInclude) {
74
- if (Object.prototype.hasOwnProperty.call(newInclude, key)) {
75
- let element = newInclude[key];
76
- if (typeof element === 'object') {
77
- const rel = getRelationInfo(meta.fields.find(key).options);
78
- if (rel) {
79
- element = findOptionsFromJson(element, new Remult().repo(rel.toType()).metadata);
80
- }
81
- }
82
- newInclude[key] = element;
83
- }
84
- }
85
- r[key] = newInclude;
86
- }
87
43
  else
88
44
  r[key] = json[key];
89
45
  }
@@ -81,10 +81,11 @@ export class RemultProxy {
81
81
  get fields() {
82
82
  return self.remultFactory().repo(...args).metadata.fields;
83
83
  },
84
- validate: (a, b) => self
84
+ validate: (a, ...b) => self
85
85
  .remultFactory()
86
86
  .repo(...args)
87
- .validate(a, b),
87
+ //@ts-ignore
88
+ .validate(a, ...b),
88
89
  addEventListener: (...args2) => self
89
90
  .remultFactory()
90
91
  .repo(...args)