remult 2.7.32 → 2.7.34
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/esm/inputTypes.js +1 -0
- package/esm/remult-knex/index.js +10 -5
- package/esm/server/get-remult-admin-html.js +1 -1
- package/esm/server/remult-admin.js +3 -2
- package/esm/src/remult3/Fields.js +5 -0
- package/esm/src/valueConverters.js +2 -0
- package/inputTypes.d.ts +1 -0
- package/inputTypes.js +1 -0
- package/package.json +1 -1
- package/remult-knex/index.js +10 -5
- package/server/get-remult-admin-html.js +1 -1
- package/server/remult-admin.d.ts +1 -1
- package/server/remult-admin.js +2 -1
- package/src/remult3/Fields.js +5 -0
- package/src/valueConverters.js +2 -0
|
@@ -2,6 +2,7 @@ import { getRelationFieldInfo, } from '../src/remult3/relationInfoMember.js';
|
|
|
2
2
|
import { Filter } from '../src/filter/filter-interfaces.js';
|
|
3
3
|
import { getHtml } from './get-remult-admin-html.js';
|
|
4
4
|
import { getValueList } from '../src/remult3/RepositoryImplementation.js';
|
|
5
|
+
import { InputTypes } from '../inputTypes.js';
|
|
5
6
|
export default function remultAdminHtml(options) {
|
|
6
7
|
const { rootPath, head } = options;
|
|
7
8
|
return getHtml()
|
|
@@ -76,7 +77,7 @@ export function buildEntityInfo(options) {
|
|
|
76
77
|
caption: x.caption,
|
|
77
78
|
relationToOne: relation,
|
|
78
79
|
inputType: x.inputType,
|
|
79
|
-
type: x.
|
|
80
|
+
type: x.inputType === InputTypes.json
|
|
80
81
|
? 'json'
|
|
81
82
|
: x.valueType === Number
|
|
82
83
|
? 'number'
|
|
@@ -95,7 +96,7 @@ export function buildEntityInfo(options) {
|
|
|
95
96
|
if (metadata.apiReadAllowed) {
|
|
96
97
|
let superKey = metadata.key;
|
|
97
98
|
let caption = metadata.caption;
|
|
98
|
-
const nbOfEntities = entities.filter(e => e.key === metadata.key).length;
|
|
99
|
+
const nbOfEntities = entities.filter((e) => e.key === metadata.key).length;
|
|
99
100
|
if (nbOfEntities > 0) {
|
|
100
101
|
superKey = metadata.key + '_ext_' + nbOfEntities;
|
|
101
102
|
caption = metadata.caption + '*'.repeat(nbOfEntities);
|
|
@@ -7,6 +7,7 @@ import { relationInfoMemberInOptions } from './relationInfoMember.js';
|
|
|
7
7
|
import { remultStatic } from '../remult-static.js';
|
|
8
8
|
import { addValidator } from './addValidator.js';
|
|
9
9
|
import { isOfType } from '../isOfType.js';
|
|
10
|
+
import { InputTypes } from '../../inputTypes.js';
|
|
10
11
|
const validateNumber = createValueValidator((x) => {
|
|
11
12
|
return !isNaN(x) && isFinite(x);
|
|
12
13
|
});
|
|
@@ -22,9 +23,13 @@ export class Fields {
|
|
|
22
23
|
if (op.valueConverter && !op.valueConverter.fieldTypeInDb)
|
|
23
24
|
//@ts-ignore
|
|
24
25
|
op.valueConverter.fieldTypeInDb = 'json';
|
|
26
|
+
if (op.valueType && !op.valueType.inputType)
|
|
27
|
+
//@ts-ignore
|
|
28
|
+
op.valueType.inputType = InputTypes.json;
|
|
25
29
|
return Field(undefined, {
|
|
26
30
|
valueConverter: {
|
|
27
31
|
fieldTypeInDb: 'json',
|
|
32
|
+
inputType: InputTypes.json,
|
|
28
33
|
},
|
|
29
34
|
}, ...options);
|
|
30
35
|
}
|
package/inputTypes.d.ts
CHANGED
package/inputTypes.js
CHANGED
package/package.json
CHANGED
package/remult-knex/index.js
CHANGED
|
@@ -217,6 +217,11 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
217
217
|
});
|
|
218
218
|
});
|
|
219
219
|
};
|
|
220
|
+
KnexEntityDataProvider.prototype.getEntityFrom = function (e) {
|
|
221
|
+
if (this.entity.options.sqlExpression)
|
|
222
|
+
return this.knex.fromRaw(e.$entityName);
|
|
223
|
+
return this.knex(e.$entityName);
|
|
224
|
+
};
|
|
220
225
|
KnexEntityDataProvider.prototype.count = function (where) {
|
|
221
226
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
222
227
|
var e, br, r, result, row, key, element;
|
|
@@ -230,7 +235,7 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
230
235
|
return [4 /*yield*/, br.resolveWhere()];
|
|
231
236
|
case 2:
|
|
232
237
|
r = _a.sent();
|
|
233
|
-
return [4 /*yield*/, this.
|
|
238
|
+
return [4 /*yield*/, this.getEntityFrom(e)
|
|
234
239
|
.count()
|
|
235
240
|
.where(function (b) { return r.forEach(function (w) { return w(b); }); })];
|
|
236
241
|
case 3:
|
|
@@ -279,7 +284,7 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
279
284
|
}
|
|
280
285
|
finally { if (e_3) throw e_3.error; }
|
|
281
286
|
}
|
|
282
|
-
query = this.
|
|
287
|
+
query = this.getEntityFrom(e).select(cols);
|
|
283
288
|
if (!(options === null || options === void 0 ? void 0 : options.where)) return [3 /*break*/, 3];
|
|
284
289
|
br = new FilterConsumerBridgeToKnexRequest(e, this.rawSqlWrapIdentifier);
|
|
285
290
|
options.where.__applyToConsumer(br);
|
|
@@ -395,7 +400,7 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
395
400
|
case 10: return [4 /*yield*/, f.resolveWhere()];
|
|
396
401
|
case 11:
|
|
397
402
|
where = _d.sent();
|
|
398
|
-
return [4 /*yield*/, this.
|
|
403
|
+
return [4 /*yield*/, this.getEntityFrom(e)
|
|
399
404
|
.update(updateObject)
|
|
400
405
|
.where(function (b) { return where.forEach(function (w) { return w(b); }); })];
|
|
401
406
|
case 12:
|
|
@@ -418,7 +423,7 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
418
423
|
return [4 /*yield*/, f.resolveWhere()];
|
|
419
424
|
case 2:
|
|
420
425
|
where = _a.sent();
|
|
421
|
-
return [4 /*yield*/, this.
|
|
426
|
+
return [4 /*yield*/, this.getEntityFrom(e)
|
|
422
427
|
.delete()
|
|
423
428
|
.where(function (b) { return where.forEach(function (w) { return w(b); }); })];
|
|
424
429
|
case 3:
|
|
@@ -472,7 +477,7 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
472
477
|
finally { if (e_5) throw e_5.error; }
|
|
473
478
|
return [7 /*endfinally*/];
|
|
474
479
|
case 10:
|
|
475
|
-
insert = this.
|
|
480
|
+
insert = this.getEntityFrom(e).insert(insertObject);
|
|
476
481
|
if (!(0, RepositoryImplementation_js_1.isAutoIncrement)(this.entity.idMetadata.field)) return [3 /*break*/, 15];
|
|
477
482
|
if (!(this.knex.client.config.client === 'mysql2' ||
|
|
478
483
|
this.knex.client.config.client === 'mysql')) return [3 /*break*/, 12];
|