remult 0.25.5-exp.7 → 0.25.5-exp.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/esm/remult-knex/index.js +11 -4
- package/esm/src/remult3/remult3.js +1 -0
- package/package.json +1 -1
- package/remult-knex/index.js +11 -4
- package/src/remult3/remult3.js +1 -0
package/esm/remult-knex/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export class KnexDataProvider {
|
|
|
20
20
|
return r.knex;
|
|
21
21
|
}
|
|
22
22
|
getEntityDataProvider(entity) {
|
|
23
|
-
if (!
|
|
23
|
+
if (!supportsJsonLoadingAndSaving(this.knex))
|
|
24
24
|
for (const f of entity.fields.toArray()) {
|
|
25
25
|
if (f.valueConverter.fieldTypeInDb === 'json') {
|
|
26
26
|
//@ts-ignore
|
|
@@ -367,7 +367,7 @@ export class KnexSchemaBuilder {
|
|
|
367
367
|
if (isAutoIncrement(x))
|
|
368
368
|
b.increments(cols.get(x).name);
|
|
369
369
|
else {
|
|
370
|
-
buildColumn(x, cols.get(x).name, b,
|
|
370
|
+
buildColumn(x, cols.get(x).name, b, supportsJsonDataStorage(this.knex));
|
|
371
371
|
if (x == entity.idMetadata.field)
|
|
372
372
|
b.primary([cols.get(x).name]);
|
|
373
373
|
}
|
|
@@ -384,7 +384,7 @@ export class KnexSchemaBuilder {
|
|
|
384
384
|
let colName = e.$dbNameOf(col);
|
|
385
385
|
if (!(await this.knex.schema.hasColumn(e.$entityName, colName))) {
|
|
386
386
|
await logSql(this.knex.schema.alterTable(e.$entityName, (b) => {
|
|
387
|
-
buildColumn(col, colName, b,
|
|
387
|
+
buildColumn(col, colName, b, supportsJsonDataStorage(this.knex));
|
|
388
388
|
}));
|
|
389
389
|
}
|
|
390
390
|
}
|
|
@@ -406,10 +406,17 @@ export class KnexSchemaBuilder {
|
|
|
406
406
|
this.knex = knex;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function supportsJsonDataStorage(knex) {
|
|
410
|
+
const client = knex.client.config.client;
|
|
411
|
+
if (client?.includes('sqlite3') || client?.includes('mssql'))
|
|
412
|
+
return false;
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
function supportsJsonLoadingAndSaving(knex) {
|
|
410
416
|
const client = knex.client.config.client;
|
|
411
417
|
if (client?.includes('sqlite3') ||
|
|
412
418
|
client?.includes('mssql') ||
|
|
419
|
+
client?.includes('mysql2') ||
|
|
413
420
|
client?.includes('mysql'))
|
|
414
421
|
return false;
|
|
415
422
|
return true;
|
|
@@ -7,6 +7,7 @@ export {};
|
|
|
7
7
|
//p1 - include admin in remult
|
|
8
8
|
//p1 - new row when there are relations, looks funny (see product)
|
|
9
9
|
//p1 - the + row in the bottom should extend to the full width
|
|
10
|
+
//p1 - adjust angular starter kit for latest angular (as is in tutorial)
|
|
10
11
|
/*y2 -
|
|
11
12
|
@Fields.string<Category>({
|
|
12
13
|
allowApiUpdate: (c) => getEntityRef(c).isNew(),
|
package/package.json
CHANGED
package/remult-knex/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var KnexDataProvider = /** @class */ (function () {
|
|
|
24
24
|
};
|
|
25
25
|
KnexDataProvider.prototype.getEntityDataProvider = function (entity) {
|
|
26
26
|
var e_1, _a;
|
|
27
|
-
if (!
|
|
27
|
+
if (!supportsJsonLoadingAndSaving(this.knex))
|
|
28
28
|
try {
|
|
29
29
|
for (var _b = tslib_1.__values(entity.fields.toArray()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
30
30
|
var f = _c.value;
|
|
@@ -739,7 +739,7 @@ var KnexSchemaBuilder = /** @class */ (function () {
|
|
|
739
739
|
if ((0, RepositoryImplementation_js_1.isAutoIncrement)(x))
|
|
740
740
|
b.increments(cols_1.get(x).name);
|
|
741
741
|
else {
|
|
742
|
-
buildColumn(x, cols_1.get(x).name, b,
|
|
742
|
+
buildColumn(x, cols_1.get(x).name, b, supportsJsonDataStorage(_this.knex));
|
|
743
743
|
if (x == entity.idMetadata.field)
|
|
744
744
|
b.primary([cols_1.get(x).name]);
|
|
745
745
|
}
|
|
@@ -779,7 +779,7 @@ var KnexSchemaBuilder = /** @class */ (function () {
|
|
|
779
779
|
case 2:
|
|
780
780
|
if (!!(_a.sent())) return [3 /*break*/, 4];
|
|
781
781
|
return [4 /*yield*/, logSql(this.knex.schema.alterTable(e.$entityName, function (b) {
|
|
782
|
-
buildColumn(col, colName, b,
|
|
782
|
+
buildColumn(col, colName, b, supportsJsonDataStorage(_this.knex));
|
|
783
783
|
}))];
|
|
784
784
|
case 3:
|
|
785
785
|
_a.sent();
|
|
@@ -856,10 +856,17 @@ var KnexSchemaBuilder = /** @class */ (function () {
|
|
|
856
856
|
return KnexSchemaBuilder;
|
|
857
857
|
}());
|
|
858
858
|
exports.KnexSchemaBuilder = KnexSchemaBuilder;
|
|
859
|
-
function
|
|
859
|
+
function supportsJsonDataStorage(knex) {
|
|
860
|
+
var client = knex.client.config.client;
|
|
861
|
+
if ((client === null || client === void 0 ? void 0 : client.includes('sqlite3')) || (client === null || client === void 0 ? void 0 : client.includes('mssql')))
|
|
862
|
+
return false;
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
function supportsJsonLoadingAndSaving(knex) {
|
|
860
866
|
var client = knex.client.config.client;
|
|
861
867
|
if ((client === null || client === void 0 ? void 0 : client.includes('sqlite3')) ||
|
|
862
868
|
(client === null || client === void 0 ? void 0 : client.includes('mssql')) ||
|
|
869
|
+
(client === null || client === void 0 ? void 0 : client.includes('mysql2')) ||
|
|
863
870
|
(client === null || client === void 0 ? void 0 : client.includes('mysql')))
|
|
864
871
|
return false;
|
|
865
872
|
return true;
|
package/src/remult3/remult3.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
//p1 - include admin in remult
|
|
9
9
|
//p1 - new row when there are relations, looks funny (see product)
|
|
10
10
|
//p1 - the + row in the bottom should extend to the full width
|
|
11
|
+
//p1 - adjust angular starter kit for latest angular (as is in tutorial)
|
|
11
12
|
/*y2 -
|
|
12
13
|
@Fields.string<Category>({
|
|
13
14
|
allowApiUpdate: (c) => getEntityRef(c).isNew(),
|