@tangle-network/agent-interface 5.2.0 → 5.2.1

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.
@@ -96,8 +96,15 @@ function assignDefined(...sources) {
96
96
  if (source === undefined)
97
97
  continue;
98
98
  for (const [key, value] of Object.entries(source)) {
99
- if (value !== undefined)
100
- merged[key] = value;
99
+ if (value !== undefined) {
100
+ // Define own data properties like object spread, including __proto__.
101
+ Object.defineProperty(merged, key, {
102
+ value,
103
+ enumerable: true,
104
+ configurable: true,
105
+ writable: true,
106
+ });
107
+ }
101
108
  }
102
109
  }
103
110
  return merged;
@@ -119,6 +119,14 @@ function replaceChangedProfileResources(baseline, candidate, remove, set) {
119
119
  }
120
120
  return;
121
121
  }
122
+ // Resource removals prune empty sibling arrays. Restore only the candidate's
123
+ // explicit empties, without copying unchanged nonempty or external resources.
124
+ for (const axis of agentProfileResourceDiffPropertyAxes) {
125
+ const value = candidate?.[axis];
126
+ if (Array.isArray(value) && value.length === 0) {
127
+ Object.assign(resourceSet, { [axis]: [] });
128
+ }
129
+ }
122
130
  remove.resources = resourceRemove;
123
131
  const canonicalCandidate = canonicalProfileValue(candidate);
124
132
  if (Object.keys(resourceSet).length > 0 ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",