remult 0.22.7 → 0.22.8
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/README.md +1 -3
- package/esm/src/column.js +2 -0
- package/esm/src/filter/filter-interfaces.js +5 -4
- package/esm/src/remult3/RepositoryImplementation.js +12 -1
- package/esm/src/remult3/remult3.d.ts +2 -1
- package/package.json +1 -1
- package/src/column.js +2 -0
- package/src/filter/filter-interfaces.js +5 -4
- package/src/remult3/RepositoryImplementation.js +13 -1
- package/src/remult3/remult3.d.ts +2 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<img src="https://github.com/remult/remult/raw/master/docs/public/logo.png" width="140" height="140">
|
|
4
4
|
</a>
|
|
5
5
|
<h1>Remult</h1>
|
|
6
|
-
<p>
|
|
6
|
+
<p>Full-stack CRUD, simplified, with SSOT TypeScript entities</p>
|
|
7
7
|
<a href="https://circleci.com/gh/remult/remult/tree/master" rel="nofollow">
|
|
8
8
|
<img alt="CircleCI" src="https://circleci.com/gh/remult/remult/tree/master.svg?style=shield">
|
|
9
9
|
</a>
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
<a href="https://discord.gg/GXHk7ZfuG5" rel="nofollow">
|
|
23
23
|
<img alt="Join Discord" src="https://badgen.net/discord/online-members/GXHk7ZfuG5?icon=discord&label=Discord"/>
|
|
24
24
|
</a>
|
|
25
|
-
<a href="https://twitter.com/intent/tweet?text=Remult%20-%20open-source%20CRUD%20framework%20for%20full-stack%20TypeScript%0A%0A%40remultjs%0A&url=https%3A%2F%2Fgithub.com%2Fremult%2Fremult">
|
|
26
|
-
<img alt="Twitter URL" src="https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Ftext%3DRemult%2520-%2520open-source%2520CRUD%2520framework%2520for%2520full-stack%2520TypeScript%250A%250A%2540remultjs%250A%26url%3Dhttps%253A%252F%252Fgithub.com%252Fremult%252Fremult">
|
|
27
25
|
</a>
|
|
28
26
|
</div>
|
|
29
27
|
|
package/esm/src/column.js
CHANGED
|
@@ -383,10 +383,11 @@ export function buildFilterFromRequestParameters(entity, filterInfo) {
|
|
|
383
383
|
})),
|
|
384
384
|
}));
|
|
385
385
|
if (or.length == 1)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
386
|
+
where.push(or[0]);
|
|
387
|
+
else
|
|
388
|
+
where.push({
|
|
389
|
+
$and: or,
|
|
390
|
+
});
|
|
390
391
|
}
|
|
391
392
|
for (const key in entity.entityType) {
|
|
392
393
|
const element = entity.entityType[key];
|
|
@@ -874,7 +874,15 @@ export class rowHelperImplementation extends rowHelperBase {
|
|
|
874
874
|
}
|
|
875
875
|
metadata;
|
|
876
876
|
getId() {
|
|
877
|
-
|
|
877
|
+
const getVal = (y) => {
|
|
878
|
+
let z = this.lookups.get(y.key);
|
|
879
|
+
if (z)
|
|
880
|
+
return z.id;
|
|
881
|
+
return this.instance[y.key];
|
|
882
|
+
};
|
|
883
|
+
if (this.metadata.idMetadata.field instanceof CompoundIdField)
|
|
884
|
+
return this.metadata.idMetadata.field.fields.map(getVal).join(',');
|
|
885
|
+
return getVal(this.metadata.idMetadata.field);
|
|
878
886
|
}
|
|
879
887
|
saveMoreOriginalData() {
|
|
880
888
|
this.originalId = this.getId();
|
|
@@ -1513,6 +1521,9 @@ class EntityFullInfo {
|
|
|
1513
1521
|
}
|
|
1514
1522
|
idMetadata = {
|
|
1515
1523
|
getId: (item) => {
|
|
1524
|
+
const ref = getEntityRef(item, false);
|
|
1525
|
+
if (ref)
|
|
1526
|
+
return ref.getId();
|
|
1516
1527
|
if (this.idMetadata.field instanceof CompoundIdField)
|
|
1517
1528
|
return this.idMetadata.field.getId(item);
|
|
1518
1529
|
else
|
|
@@ -5,6 +5,7 @@ import type { FieldMetadata } from '../column-interfaces';
|
|
|
5
5
|
import type { EntityOptions } from '../entity';
|
|
6
6
|
import type { LiveQueryChange, SubscriptionListener, Unsubscribe } from '../live-query/SubscriptionChannel';
|
|
7
7
|
import type { SortSegment } from '../sort';
|
|
8
|
+
import type { EntityBase } from './RepositoryImplementation';
|
|
8
9
|
export interface EntityRef<entityType> extends Subscribable {
|
|
9
10
|
hasErrors(): boolean;
|
|
10
11
|
undoChanges(): any;
|
|
@@ -153,7 +154,7 @@ export interface EntityMetadata<entityType = any> {
|
|
|
153
154
|
/** Metadata for the Entity's id */
|
|
154
155
|
readonly idMetadata: IdMetadata<entityType>;
|
|
155
156
|
}
|
|
156
|
-
export declare type OmitEB<T> = Omit<T, keyof
|
|
157
|
+
export declare type OmitEB<T> = Omit<T, keyof EntityBase>;
|
|
157
158
|
export declare type idType<entityType> = entityType extends {
|
|
158
159
|
id?: number;
|
|
159
160
|
} ? number : entityType extends {
|
package/package.json
CHANGED
package/src/column.js
CHANGED
|
@@ -505,10 +505,11 @@ function buildFilterFromRequestParameters(entity, filterInfo) {
|
|
|
505
505
|
}),
|
|
506
506
|
}); });
|
|
507
507
|
if (or.length == 1)
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
508
|
+
where.push(or[0]);
|
|
509
|
+
else
|
|
510
|
+
where.push({
|
|
511
|
+
$and: or,
|
|
512
|
+
});
|
|
512
513
|
}
|
|
513
514
|
var _loop_2 = function (key) {
|
|
514
515
|
var element = entity.entityType[key];
|
|
@@ -1436,7 +1436,16 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1436
1436
|
configurable: true
|
|
1437
1437
|
});
|
|
1438
1438
|
rowHelperImplementation.prototype.getId = function () {
|
|
1439
|
-
|
|
1439
|
+
var _this = this;
|
|
1440
|
+
var getVal = function (y) {
|
|
1441
|
+
var z = _this.lookups.get(y.key);
|
|
1442
|
+
if (z)
|
|
1443
|
+
return z.id;
|
|
1444
|
+
return _this.instance[y.key];
|
|
1445
|
+
};
|
|
1446
|
+
if (this.metadata.idMetadata.field instanceof CompoundIdField_1.CompoundIdField)
|
|
1447
|
+
return this.metadata.idMetadata.field.fields.map(getVal).join(',');
|
|
1448
|
+
return getVal(this.metadata.idMetadata.field);
|
|
1440
1449
|
};
|
|
1441
1450
|
rowHelperImplementation.prototype.saveMoreOriginalData = function () {
|
|
1442
1451
|
this.originalId = this.getId();
|
|
@@ -2413,6 +2422,9 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
2413
2422
|
this.key = key;
|
|
2414
2423
|
this.idMetadata = {
|
|
2415
2424
|
getId: function (item) {
|
|
2425
|
+
var ref = (0, getEntityRef_1.getEntityRef)(item, false);
|
|
2426
|
+
if (ref)
|
|
2427
|
+
return ref.getId();
|
|
2416
2428
|
if (_this.idMetadata.field instanceof CompoundIdField_1.CompoundIdField)
|
|
2417
2429
|
return _this.idMetadata.field.getId(item);
|
|
2418
2430
|
else
|
package/src/remult3/remult3.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { FieldMetadata } from '../column-interfaces';
|
|
|
5
5
|
import type { EntityOptions } from '../entity';
|
|
6
6
|
import type { LiveQueryChange, SubscriptionListener, Unsubscribe } from '../live-query/SubscriptionChannel';
|
|
7
7
|
import type { SortSegment } from '../sort';
|
|
8
|
+
import type { EntityBase } from './RepositoryImplementation';
|
|
8
9
|
export interface EntityRef<entityType> extends Subscribable {
|
|
9
10
|
hasErrors(): boolean;
|
|
10
11
|
undoChanges(): any;
|
|
@@ -153,7 +154,7 @@ export interface EntityMetadata<entityType = any> {
|
|
|
153
154
|
/** Metadata for the Entity's id */
|
|
154
155
|
readonly idMetadata: IdMetadata<entityType>;
|
|
155
156
|
}
|
|
156
|
-
export declare type OmitEB<T> = Omit<T, keyof
|
|
157
|
+
export declare type OmitEB<T> = Omit<T, keyof EntityBase>;
|
|
157
158
|
export declare type idType<entityType> = entityType extends {
|
|
158
159
|
id?: number;
|
|
159
160
|
} ? number : entityType extends {
|