@enyo-energy/energy-app-sdk 0.0.164 → 0.0.166
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/types/enyo-network-device.d.cts +30 -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/types/enyo-network-device.d.ts +30 -0
- 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`)
|
|
@@ -27,8 +27,38 @@ export interface EnyoNetworkDevice {
|
|
|
27
27
|
/** Access status for the device */
|
|
28
28
|
accessStatus: EnyoNetworkDeviceAccessStatus | undefined;
|
|
29
29
|
detectedAt: EnyoNetworkDeviceDetectedAtEnum[];
|
|
30
|
+
/**
|
|
31
|
+
* Structured DNS-SD service data for mDNS-discovered devices, one entry per
|
|
32
|
+
* advertised service type. Populated only for devices found via mDNS
|
|
33
|
+
* (otherwise `undefined`) and refreshed on re-discovery. A host may advertise
|
|
34
|
+
* several service types, so this is an array. Additive to `ports` — existing
|
|
35
|
+
* fields are unchanged.
|
|
36
|
+
*/
|
|
37
|
+
mdnsServices?: EnyoMdnsService[];
|
|
30
38
|
}
|
|
31
39
|
export type EnyoNetworkDeviceAccessStatus = 'granted' | 'denied' | 'pending';
|
|
40
|
+
/**
|
|
41
|
+
* One advertised DNS-SD service for an mDNS-discovered device, retained verbatim
|
|
42
|
+
* so partner integrations can read service-specific TXT data (e.g. the
|
|
43
|
+
* Bosch/Buderus heat-pump gateway publishes its OAuth `authport` only in TXT,
|
|
44
|
+
* used to build the token URL `https://<host>:<authport>/auth/token`). `txt`
|
|
45
|
+
* values are kept as raw strings — consumers parse what they need.
|
|
46
|
+
*/
|
|
47
|
+
export interface EnyoMdnsService {
|
|
48
|
+
/** DNS-SD service type, e.g. `"_gateway-tt-local-api._tcp.local"`. */
|
|
49
|
+
serviceType: string;
|
|
50
|
+
/** DNS-SD instance name, e.g. `"k40rf-101042019"`. */
|
|
51
|
+
instanceName: string;
|
|
52
|
+
/** SRV target host. Optional — currently omitted by core. */
|
|
53
|
+
target?: string;
|
|
54
|
+
/** SRV port (the API port, e.g. 8443). Optional. */
|
|
55
|
+
port?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Full TXT key/value map (e.g. `authport`, `model`, `brand`, `uuid`,
|
|
58
|
+
* `serial`, `txtvers`). Values are raw strings and are not coerced.
|
|
59
|
+
*/
|
|
60
|
+
txt: Record<string, string>;
|
|
61
|
+
}
|
|
32
62
|
/**
|
|
33
63
|
* Represents an open network port on a device.
|
|
34
64
|
*/
|
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.166';
|
|
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) {
|
|
@@ -27,8 +27,38 @@ export interface EnyoNetworkDevice {
|
|
|
27
27
|
/** Access status for the device */
|
|
28
28
|
accessStatus: EnyoNetworkDeviceAccessStatus | undefined;
|
|
29
29
|
detectedAt: EnyoNetworkDeviceDetectedAtEnum[];
|
|
30
|
+
/**
|
|
31
|
+
* Structured DNS-SD service data for mDNS-discovered devices, one entry per
|
|
32
|
+
* advertised service type. Populated only for devices found via mDNS
|
|
33
|
+
* (otherwise `undefined`) and refreshed on re-discovery. A host may advertise
|
|
34
|
+
* several service types, so this is an array. Additive to `ports` — existing
|
|
35
|
+
* fields are unchanged.
|
|
36
|
+
*/
|
|
37
|
+
mdnsServices?: EnyoMdnsService[];
|
|
30
38
|
}
|
|
31
39
|
export type EnyoNetworkDeviceAccessStatus = 'granted' | 'denied' | 'pending';
|
|
40
|
+
/**
|
|
41
|
+
* One advertised DNS-SD service for an mDNS-discovered device, retained verbatim
|
|
42
|
+
* so partner integrations can read service-specific TXT data (e.g. the
|
|
43
|
+
* Bosch/Buderus heat-pump gateway publishes its OAuth `authport` only in TXT,
|
|
44
|
+
* used to build the token URL `https://<host>:<authport>/auth/token`). `txt`
|
|
45
|
+
* values are kept as raw strings — consumers parse what they need.
|
|
46
|
+
*/
|
|
47
|
+
export interface EnyoMdnsService {
|
|
48
|
+
/** DNS-SD service type, e.g. `"_gateway-tt-local-api._tcp.local"`. */
|
|
49
|
+
serviceType: string;
|
|
50
|
+
/** DNS-SD instance name, e.g. `"k40rf-101042019"`. */
|
|
51
|
+
instanceName: string;
|
|
52
|
+
/** SRV target host. Optional — currently omitted by core. */
|
|
53
|
+
target?: string;
|
|
54
|
+
/** SRV port (the API port, e.g. 8443). Optional. */
|
|
55
|
+
port?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Full TXT key/value map (e.g. `authport`, `model`, `brand`, `uuid`,
|
|
58
|
+
* `serial`, `txtvers`). Values are raw strings and are not coerced.
|
|
59
|
+
*/
|
|
60
|
+
txt: Record<string, string>;
|
|
61
|
+
}
|
|
32
62
|
/**
|
|
33
63
|
* Represents an open network port on a device.
|
|
34
64
|
*/
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED