@enyo-energy/energy-app-sdk 0.0.44 → 0.0.45

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.
@@ -240,28 +240,24 @@ class ApplianceManager {
240
240
  /**
241
241
  * Updates metadata for an appliance.
242
242
  * @param applianceId The ID of the appliance
243
- * @param metadata The metadata to update
243
+ * @param attributes The attributes to update
244
244
  */
245
- async updateApplianceMetadata(applianceId, metadata) {
245
+ async updateAppliance(applianceId, attributes) {
246
246
  try {
247
247
  const appliance = await this.energyApp.useAppliances().getById(applianceId);
248
248
  if (appliance) {
249
249
  const updatedAppliance = {
250
250
  ...appliance,
251
- metadata: {
252
- ...appliance.metadata,
253
- ...metadata
254
- }
251
+ ...attributes
255
252
  };
256
253
  await this.energyApp.useAppliances().save(updatedAppliance, applianceId);
257
254
  // Update cache
258
- appliance.metadata = { ...appliance.metadata, ...metadata };
259
- this.applianceCache.set(applianceId, appliance);
260
- console.log(`Updated metadata for appliance ${applianceId}`);
255
+ this.applianceCache.set(applianceId, { id: applianceId, ...updatedAppliance });
256
+ console.log(`Updated appliance ${applianceId}`);
261
257
  }
262
258
  }
263
259
  catch (error) {
264
- console.error(`Failed to update metadata for appliance ${applianceId}: ${error}`);
260
+ console.error(`Failed to update appliance ${applianceId}: ${error}`);
265
261
  throw error;
266
262
  }
267
263
  }
@@ -132,11 +132,9 @@ export declare class ApplianceManager {
132
132
  /**
133
133
  * Updates metadata for an appliance.
134
134
  * @param applianceId The ID of the appliance
135
- * @param metadata The metadata to update
135
+ * @param attributes The attributes to update
136
136
  */
137
- updateApplianceMetadata(applianceId: string, metadata: Partial<EnyoApplianceMetadata> & {
138
- connectionType: EnyoApplianceConnectionType;
139
- }): Promise<void>;
137
+ updateAppliance(applianceId: string, attributes: Partial<EnyoAppliance>): Promise<void>;
140
138
  /**
141
139
  * Removes an appliance by its ID.
142
140
  * @param applianceId The ID of the appliance to remove
@@ -79,5 +79,5 @@ export interface EnergyAppSecretManager {
79
79
  * });
80
80
  * ```
81
81
  */
82
- saveSecret<T extends Record<string, string>>(secretName: string, encryptionKey: string, secret: T): Promise<void>;
82
+ saveSecret<T>(secretName: string, encryptionKey: string, secret: T): Promise<void>;
83
83
  }
@@ -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.44';
12
+ exports.SDK_VERSION = '0.0.45';
13
13
  /**
14
14
  * Gets the current SDK version.
15
15
  * @returns The semantic version string of the SDK
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export declare const SDK_VERSION = "0.0.44";
8
+ export declare const SDK_VERSION = "0.0.45";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -132,11 +132,9 @@ export declare class ApplianceManager {
132
132
  /**
133
133
  * Updates metadata for an appliance.
134
134
  * @param applianceId The ID of the appliance
135
- * @param metadata The metadata to update
135
+ * @param attributes The attributes to update
136
136
  */
137
- updateApplianceMetadata(applianceId: string, metadata: Partial<EnyoApplianceMetadata> & {
138
- connectionType: EnyoApplianceConnectionType;
139
- }): Promise<void>;
137
+ updateAppliance(applianceId: string, attributes: Partial<EnyoAppliance>): Promise<void>;
140
138
  /**
141
139
  * Removes an appliance by its ID.
142
140
  * @param applianceId The ID of the appliance to remove
@@ -237,28 +237,24 @@ export class ApplianceManager {
237
237
  /**
238
238
  * Updates metadata for an appliance.
239
239
  * @param applianceId The ID of the appliance
240
- * @param metadata The metadata to update
240
+ * @param attributes The attributes to update
241
241
  */
242
- async updateApplianceMetadata(applianceId, metadata) {
242
+ async updateAppliance(applianceId, attributes) {
243
243
  try {
244
244
  const appliance = await this.energyApp.useAppliances().getById(applianceId);
245
245
  if (appliance) {
246
246
  const updatedAppliance = {
247
247
  ...appliance,
248
- metadata: {
249
- ...appliance.metadata,
250
- ...metadata
251
- }
248
+ ...attributes
252
249
  };
253
250
  await this.energyApp.useAppliances().save(updatedAppliance, applianceId);
254
251
  // Update cache
255
- appliance.metadata = { ...appliance.metadata, ...metadata };
256
- this.applianceCache.set(applianceId, appliance);
257
- console.log(`Updated metadata for appliance ${applianceId}`);
252
+ this.applianceCache.set(applianceId, { id: applianceId, ...updatedAppliance });
253
+ console.log(`Updated appliance ${applianceId}`);
258
254
  }
259
255
  }
260
256
  catch (error) {
261
- console.error(`Failed to update metadata for appliance ${applianceId}: ${error}`);
257
+ console.error(`Failed to update appliance ${applianceId}: ${error}`);
262
258
  throw error;
263
259
  }
264
260
  }
@@ -79,5 +79,5 @@ export interface EnergyAppSecretManager {
79
79
  * });
80
80
  * ```
81
81
  */
82
- saveSecret<T extends Record<string, string>>(secretName: string, encryptionKey: string, secret: T): Promise<void>;
82
+ saveSecret<T>(secretName: string, encryptionKey: string, secret: T): Promise<void>;
83
83
  }
package/dist/version.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export declare const SDK_VERSION = "0.0.44";
8
+ export declare const SDK_VERSION = "0.0.45";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
package/dist/version.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Current version of the enyo Energy App SDK.
7
7
  */
8
- export const SDK_VERSION = '0.0.44';
8
+ export const SDK_VERSION = '0.0.45';
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enyo-energy/energy-app-sdk",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",