@enyo-energy/energy-app-sdk 0.0.164 → 0.0.165
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/cjs/implementations/appliances/appliance-manager.cjs +15 -2
- package/dist/cjs/implementations/appliances/appliance-manager.d.cts +7 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/implementations/appliances/appliance-manager.d.ts +7 -0
- package/dist/implementations/appliances/appliance-manager.js +15 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -96,6 +96,13 @@ class ApplianceManager {
|
|
|
96
96
|
* Note: the merge is one level deep. Nested objects inside a metadata sub-object
|
|
97
97
|
* are replaced, not merged.
|
|
98
98
|
*
|
|
99
|
+
* Update contract: an omitted optional field leaves the stored value unchanged.
|
|
100
|
+
* For the {@link MERGEABLE_METADATA_KEYS} this is enforced by the per-key merge
|
|
101
|
+
* below; for the other optional top-level fields (`availableFeatures`,
|
|
102
|
+
* `cloudPackageId`) the caller-facing {@link createOrUpdateAppliance} drops the
|
|
103
|
+
* key when the value is `undefined` so this spread cannot overwrite it. To clear
|
|
104
|
+
* or replace such a field, pass an explicit value (e.g. an empty array `[]`).
|
|
105
|
+
*
|
|
99
106
|
* @param existing The existing appliance data
|
|
100
107
|
* @param update The partial update data to merge
|
|
101
108
|
* @returns The merged appliance data (without `id`)
|
|
@@ -200,8 +207,14 @@ class ApplianceManager {
|
|
|
200
207
|
inverter: appliance.inverter,
|
|
201
208
|
temperatureSensor: appliance.temperatureSensor,
|
|
202
209
|
airConditioning: appliance.airConditioning,
|
|
203
|
-
|
|
204
|
-
|
|
210
|
+
// Conditionally spread the two optional top-level fields that are NOT
|
|
211
|
+
// covered by MERGEABLE_METADATA_KEYS. If they were always materialized
|
|
212
|
+
// as explicit keys, an omitted (undefined) value would clobber the
|
|
213
|
+
// stored value during mergeApplianceData's `{...existing, ...update}`
|
|
214
|
+
// spread on an update. `!== undefined` keeps an explicit `[]` (clear)
|
|
215
|
+
// while dropping omitted fields so the existing value is preserved.
|
|
216
|
+
...(appliance.cloudPackageId !== undefined && { cloudPackageId: appliance.cloudPackageId }),
|
|
217
|
+
...(appliance.availableFeatures !== undefined && { availableFeatures: appliance.availableFeatures }),
|
|
205
218
|
};
|
|
206
219
|
let applianceData = newApplianceData;
|
|
207
220
|
if (existingApplianceId) {
|
|
@@ -129,6 +129,13 @@ export declare class ApplianceManager {
|
|
|
129
129
|
* Note: the merge is one level deep. Nested objects inside a metadata sub-object
|
|
130
130
|
* are replaced, not merged.
|
|
131
131
|
*
|
|
132
|
+
* Update contract: an omitted optional field leaves the stored value unchanged.
|
|
133
|
+
* For the {@link MERGEABLE_METADATA_KEYS} this is enforced by the per-key merge
|
|
134
|
+
* below; for the other optional top-level fields (`availableFeatures`,
|
|
135
|
+
* `cloudPackageId`) the caller-facing {@link createOrUpdateAppliance} drops the
|
|
136
|
+
* key when the value is `undefined` so this spread cannot overwrite it. To clear
|
|
137
|
+
* or replace such a field, pass an explicit value (e.g. an empty array `[]`).
|
|
138
|
+
*
|
|
132
139
|
* @param existing The existing appliance data
|
|
133
140
|
* @param update The partial update data to merge
|
|
134
141
|
* @returns The merged appliance data (without `id`)
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -9,7 +9,7 @@ exports.getSdkVersion = getSdkVersion;
|
|
|
9
9
|
/**
|
|
10
10
|
* Current version of the enyo Energy App SDK.
|
|
11
11
|
*/
|
|
12
|
-
exports.SDK_VERSION = '0.0.
|
|
12
|
+
exports.SDK_VERSION = '0.0.165';
|
|
13
13
|
/**
|
|
14
14
|
* Gets the current SDK version.
|
|
15
15
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/version.d.cts
CHANGED
|
@@ -129,6 +129,13 @@ export declare class ApplianceManager {
|
|
|
129
129
|
* Note: the merge is one level deep. Nested objects inside a metadata sub-object
|
|
130
130
|
* are replaced, not merged.
|
|
131
131
|
*
|
|
132
|
+
* Update contract: an omitted optional field leaves the stored value unchanged.
|
|
133
|
+
* For the {@link MERGEABLE_METADATA_KEYS} this is enforced by the per-key merge
|
|
134
|
+
* below; for the other optional top-level fields (`availableFeatures`,
|
|
135
|
+
* `cloudPackageId`) the caller-facing {@link createOrUpdateAppliance} drops the
|
|
136
|
+
* key when the value is `undefined` so this spread cannot overwrite it. To clear
|
|
137
|
+
* or replace such a field, pass an explicit value (e.g. an empty array `[]`).
|
|
138
|
+
*
|
|
132
139
|
* @param existing The existing appliance data
|
|
133
140
|
* @param update The partial update data to merge
|
|
134
141
|
* @returns The merged appliance data (without `id`)
|
|
@@ -90,6 +90,13 @@ export class ApplianceManager {
|
|
|
90
90
|
* Note: the merge is one level deep. Nested objects inside a metadata sub-object
|
|
91
91
|
* are replaced, not merged.
|
|
92
92
|
*
|
|
93
|
+
* Update contract: an omitted optional field leaves the stored value unchanged.
|
|
94
|
+
* For the {@link MERGEABLE_METADATA_KEYS} this is enforced by the per-key merge
|
|
95
|
+
* below; for the other optional top-level fields (`availableFeatures`,
|
|
96
|
+
* `cloudPackageId`) the caller-facing {@link createOrUpdateAppliance} drops the
|
|
97
|
+
* key when the value is `undefined` so this spread cannot overwrite it. To clear
|
|
98
|
+
* or replace such a field, pass an explicit value (e.g. an empty array `[]`).
|
|
99
|
+
*
|
|
93
100
|
* @param existing The existing appliance data
|
|
94
101
|
* @param update The partial update data to merge
|
|
95
102
|
* @returns The merged appliance data (without `id`)
|
|
@@ -194,8 +201,14 @@ export class ApplianceManager {
|
|
|
194
201
|
inverter: appliance.inverter,
|
|
195
202
|
temperatureSensor: appliance.temperatureSensor,
|
|
196
203
|
airConditioning: appliance.airConditioning,
|
|
197
|
-
|
|
198
|
-
|
|
204
|
+
// Conditionally spread the two optional top-level fields that are NOT
|
|
205
|
+
// covered by MERGEABLE_METADATA_KEYS. If they were always materialized
|
|
206
|
+
// as explicit keys, an omitted (undefined) value would clobber the
|
|
207
|
+
// stored value during mergeApplianceData's `{...existing, ...update}`
|
|
208
|
+
// spread on an update. `!== undefined` keeps an explicit `[]` (clear)
|
|
209
|
+
// while dropping omitted fields so the existing value is preserved.
|
|
210
|
+
...(appliance.cloudPackageId !== undefined && { cloudPackageId: appliance.cloudPackageId }),
|
|
211
|
+
...(appliance.availableFeatures !== undefined && { availableFeatures: appliance.availableFeatures }),
|
|
199
212
|
};
|
|
200
213
|
let applianceData = newApplianceData;
|
|
201
214
|
if (existingApplianceId) {
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED