@ruiapp/rapid-core 0.1.37 → 0.1.38

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
@@ -712,7 +712,10 @@ class RapidResponse {
712
712
  this.status = init?.status;
713
713
  }
714
714
  json(obj, status, headers) {
715
- const body = JSON.stringify(obj);
715
+ let body = null;
716
+ if (obj) {
717
+ body = JSON.stringify(obj);
718
+ }
716
719
  this.headers.set("Content-Type", "application/json");
717
720
  const responseHeaders = new Headers(this.headers);
718
721
  if (headers) {
@@ -2205,7 +2208,7 @@ async function updateEntityById(server, dataAccessor, options, plugin) {
2205
2208
  before: entity,
2206
2209
  changes: options.entityToSave,
2207
2210
  }, plugin);
2208
- changes = options.entityToSave;
2211
+ changes = getEntityPartChanges(entity, options.entityToSave);
2209
2212
  const oneRelationPropertiesToUpdate = [];
2210
2213
  const manyRelationPropertiesToUpdate = [];
2211
2214
  lodash.keys(changes).forEach((propertyCode) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,7 +49,10 @@ export class RapidResponse {
49
49
  status?: HttpStatus,
50
50
  headers?: HeadersInit,
51
51
  ) {
52
- const body = JSON.stringify(obj);
52
+ let body: string | null = null;
53
+ if (obj) {
54
+ body = JSON.stringify(obj);
55
+ }
53
56
  this.headers.set("Content-Type", "application/json");
54
57
  const responseHeaders = new Headers(this.headers);
55
58
  if (headers) {
@@ -615,7 +615,7 @@ async function updateEntityById(
615
615
  plugin,
616
616
  );
617
617
 
618
- changes = options.entityToSave;
618
+ changes = getEntityPartChanges(entity, options.entityToSave);
619
619
 
620
620
  const oneRelationPropertiesToUpdate: RpdDataModelProperty[] = [];
621
621
  const manyRelationPropertiesToUpdate: RpdDataModelProperty[] = [];