@firecms/core 3.0.0-canary.244 → 3.0.0-canary.245

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.umd.js CHANGED
@@ -249,31 +249,36 @@
249
249
  return item && typeof item === "object" && !Array.isArray(item);
250
250
  }
251
251
  function mergeDeep(target, source, ignoreUndefined = false) {
252
- const targetIsObject = isObject(target);
253
- const output = targetIsObject ? {
252
+ if (!isObject(target)) {
253
+ return target;
254
+ }
255
+ const output = {
254
256
  ...target
255
- } : target;
256
- if (targetIsObject && isObject(source)) {
257
- Object.keys(source).forEach((key) => {
258
- const sourceElement = source[key];
259
- if (ignoreUndefined && sourceElement === void 0) {
260
- return;
257
+ };
258
+ if (!isObject(source)) {
259
+ return output;
260
+ }
261
+ for (const key in source) {
262
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
263
+ const sourceValue = source[key];
264
+ const outputValue = output[key];
265
+ if (ignoreUndefined && sourceValue === void 0) {
266
+ continue;
261
267
  }
262
- if (sourceElement instanceof Date) {
263
- Object.assign(output, {
264
- [key]: new Date(sourceElement.getTime())
265
- });
266
- } else if (isObject(sourceElement)) {
267
- if (!(key in target)) Object.assign(output, {
268
- [key]: sourceElement
269
- });
270
- else output[key] = mergeDeep(target[key], sourceElement);
268
+ if (sourceValue instanceof Date) {
269
+ output[key] = new Date(sourceValue.getTime());
270
+ } else if (Array.isArray(sourceValue)) {
271
+ output[key] = [...sourceValue];
272
+ } else if (isObject(sourceValue)) {
273
+ if (isObject(outputValue)) {
274
+ output[key] = mergeDeep(outputValue, sourceValue, ignoreUndefined);
275
+ } else {
276
+ output[key] = sourceValue;
277
+ }
271
278
  } else {
272
- Object.assign(output, {
273
- [key]: sourceElement
274
- });
279
+ output[key] = sourceValue;
275
280
  }
276
- });
281
+ }
277
282
  }
278
283
  return output;
279
284
  }
@@ -4404,11 +4409,6 @@
4404
4409
  } else {
4405
4410
  updatedValues = values;
4406
4411
  }
4407
- console.debug("Saving entity", {
4408
- entityId,
4409
- updatedValues,
4410
- collection
4411
- });
4412
4412
  return dataSource.saveEntity({
4413
4413
  collection,
4414
4414
  path: resolvedPath,
@@ -4443,7 +4443,6 @@
4443
4443
  }
4444
4444
  if (onSaveSuccess) onSaveSuccess(entity);
4445
4445
  }).catch((e) => {
4446
- console.error("!!!", e);
4447
4446
  if (callbacks?.onSaveFailure) {
4448
4447
  const resolvedCollection = resolveCollection({
4449
4448
  collection,