feathers-utils 3.0.2 → 3.0.3
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.cjs +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
- package/src/hooks/setData.ts +4 -2
package/dist/index.cjs
CHANGED
|
@@ -821,7 +821,8 @@ function setData(from, to, _options) {
|
|
|
821
821
|
return context;
|
|
822
822
|
}
|
|
823
823
|
const { items } = getItemsIsArray(context);
|
|
824
|
-
|
|
824
|
+
const contextJson = toJSON(context);
|
|
825
|
+
if (!_has__default(contextJson, from)) {
|
|
825
826
|
if (!context.params?.provider || options.allowUndefined === true) {
|
|
826
827
|
return context;
|
|
827
828
|
}
|
|
@@ -830,7 +831,7 @@ function setData(from, to, _options) {
|
|
|
830
831
|
}
|
|
831
832
|
throw new errors.Forbidden(`Expected field ${from.toString()} not available`);
|
|
832
833
|
}
|
|
833
|
-
const val = _get__default(
|
|
834
|
+
const val = _get__default(contextJson, from);
|
|
834
835
|
items.forEach((item) => {
|
|
835
836
|
let overwrite;
|
|
836
837
|
if (typeof options.overwrite === "function") {
|
package/dist/index.mjs
CHANGED
|
@@ -807,7 +807,8 @@ function setData(from, to, _options) {
|
|
|
807
807
|
return context;
|
|
808
808
|
}
|
|
809
809
|
const { items } = getItemsIsArray(context);
|
|
810
|
-
|
|
810
|
+
const contextJson = toJSON(context);
|
|
811
|
+
if (!_has(contextJson, from)) {
|
|
811
812
|
if (!context.params?.provider || options.allowUndefined === true) {
|
|
812
813
|
return context;
|
|
813
814
|
}
|
|
@@ -816,7 +817,7 @@ function setData(from, to, _options) {
|
|
|
816
817
|
}
|
|
817
818
|
throw new Forbidden(`Expected field ${from.toString()} not available`);
|
|
818
819
|
}
|
|
819
|
-
const val = _get(
|
|
820
|
+
const val = _get(contextJson, from);
|
|
820
821
|
items.forEach((item) => {
|
|
821
822
|
let overwrite;
|
|
822
823
|
if (typeof options.overwrite === "function") {
|
package/package.json
CHANGED
package/src/hooks/setData.ts
CHANGED
|
@@ -39,7 +39,9 @@ export function setData<H extends HookContext = HookContext>(
|
|
|
39
39
|
|
|
40
40
|
const { items } = getItemsIsArray(context);
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
const contextJson = toJSON(context);
|
|
43
|
+
|
|
44
|
+
if (!_has(contextJson, from)) {
|
|
43
45
|
if (!context.params?.provider || options.allowUndefined === true) {
|
|
44
46
|
return context;
|
|
45
47
|
}
|
|
@@ -54,7 +56,7 @@ export function setData<H extends HookContext = HookContext>(
|
|
|
54
56
|
throw new Forbidden(`Expected field ${from.toString()} not available`);
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
const val = _get(
|
|
59
|
+
const val = _get(contextJson, from);
|
|
58
60
|
|
|
59
61
|
items.forEach((item: Record<string, unknown>) => {
|
|
60
62
|
let overwrite: boolean;
|