@ruiapp/rapid-core 0.7.6 → 0.7.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/dist/index.js
CHANGED
|
@@ -3429,7 +3429,10 @@ async function createEntity(server, dataAccessor, options, plugin) {
|
|
|
3429
3429
|
const targetDataAccessor = server.getDataAccessor({
|
|
3430
3430
|
singularCode: property.targetSingularCode,
|
|
3431
3431
|
});
|
|
3432
|
-
|
|
3432
|
+
let relatedEntitiesToBeSaved = entity[property.code];
|
|
3433
|
+
if (relatedEntitiesToBeSaved === null) {
|
|
3434
|
+
relatedEntitiesToBeSaved = [];
|
|
3435
|
+
}
|
|
3433
3436
|
if (!lodash.isArray(relatedEntitiesToBeSaved)) {
|
|
3434
3437
|
throw new Error(`Value of field '${property.code}' should be an array.`);
|
|
3435
3438
|
}
|
|
@@ -3743,7 +3746,10 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
|
|
|
3743
3746
|
const targetDataAccessor = server.getDataAccessor({
|
|
3744
3747
|
singularCode: property.targetSingularCode,
|
|
3745
3748
|
});
|
|
3746
|
-
|
|
3749
|
+
let relatedEntitiesToBeSaved = changes[property.code];
|
|
3750
|
+
if (relatedEntitiesToBeSaved === null) {
|
|
3751
|
+
relatedEntitiesToBeSaved = [];
|
|
3752
|
+
}
|
|
3747
3753
|
if (!lodash.isArray(relatedEntitiesToBeSaved)) {
|
|
3748
3754
|
throw new Error(`Value of field '${property.code}' should be an array.`);
|
|
3749
3755
|
}
|
|
@@ -3790,7 +3796,7 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
|
|
|
3790
3796
|
relationRemoveMode = "delete";
|
|
3791
3797
|
}
|
|
3792
3798
|
else {
|
|
3793
|
-
relationRemoveMode = updateRelationPropertiesOptions
|
|
3799
|
+
relationRemoveMode = updateRelationPropertiesOptions?.relationRemoveMode || "delete";
|
|
3794
3800
|
}
|
|
3795
3801
|
const relationModel = server.getModel({
|
|
3796
3802
|
singularCode: property.targetSingularCode,
|
|
@@ -8554,7 +8560,7 @@ class CronJobPlugin {
|
|
|
8554
8560
|
}
|
|
8555
8561
|
}
|
|
8556
8562
|
catch (ex) {
|
|
8557
|
-
logger.error(
|
|
8563
|
+
logger.error('Cron job "%s" execution error: %s', job.code, ex.message, { cronJobCode: job.code });
|
|
8558
8564
|
}
|
|
8559
8565
|
}
|
|
8560
8566
|
}
|
package/package.json
CHANGED
|
@@ -951,7 +951,10 @@ async function createEntity(server: IRpdServer, dataAccessor: IRpdDataAccessor,
|
|
|
951
951
|
singularCode: property.targetSingularCode!,
|
|
952
952
|
});
|
|
953
953
|
|
|
954
|
-
|
|
954
|
+
let relatedEntitiesToBeSaved = entity[property.code];
|
|
955
|
+
if (relatedEntitiesToBeSaved === null) {
|
|
956
|
+
relatedEntitiesToBeSaved = [];
|
|
957
|
+
}
|
|
955
958
|
if (!isArray(relatedEntitiesToBeSaved)) {
|
|
956
959
|
throw new Error(`Value of field '${property.code}' should be an array.`);
|
|
957
960
|
}
|
|
@@ -1292,7 +1295,10 @@ async function updateEntityById(server: IRpdServer, dataAccessor: IRpdDataAccess
|
|
|
1292
1295
|
singularCode: property.targetSingularCode!,
|
|
1293
1296
|
});
|
|
1294
1297
|
|
|
1295
|
-
|
|
1298
|
+
let relatedEntitiesToBeSaved = changes[property.code];
|
|
1299
|
+
if (relatedEntitiesToBeSaved === null) {
|
|
1300
|
+
relatedEntitiesToBeSaved = [];
|
|
1301
|
+
}
|
|
1296
1302
|
if (!isArray(relatedEntitiesToBeSaved)) {
|
|
1297
1303
|
throw new Error(`Value of field '${property.code}' should be an array.`);
|
|
1298
1304
|
}
|
|
@@ -1353,7 +1359,7 @@ async function updateEntityById(server: IRpdServer, dataAccessor: IRpdDataAccess
|
|
|
1353
1359
|
if (updateRelationPropertiesOptions === true) {
|
|
1354
1360
|
relationRemoveMode = "delete";
|
|
1355
1361
|
} else {
|
|
1356
|
-
relationRemoveMode = updateRelationPropertiesOptions
|
|
1362
|
+
relationRemoveMode = updateRelationPropertiesOptions?.relationRemoveMode || "delete";
|
|
1357
1363
|
}
|
|
1358
1364
|
const relationModel = server.getModel({
|
|
1359
1365
|
singularCode: property.targetSingularCode,
|
|
@@ -109,7 +109,7 @@ class CronJobPlugin implements RapidPlugin {
|
|
|
109
109
|
await job.handler(handlerContext, job.handleOptions);
|
|
110
110
|
}
|
|
111
111
|
} catch (ex) {
|
|
112
|
-
logger.error(
|
|
112
|
+
logger.error('Cron job "%s" execution error: %s', job.code, ex.message, { cronJobCode: job.code });
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
}
|