@enyo-energy/energy-app-sdk 0.0.45 → 0.0.47
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 +21 -0
- package/dist/cjs/implementations/appliances/appliance-manager.d.cts +6 -0
- package/dist/cjs/types/enyo-authentication.d.cts +16 -2
- package/dist/cjs/types/enyo-inverter-appliance.d.cts +5 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/implementations/appliances/appliance-manager.d.ts +6 -0
- package/dist/implementations/appliances/appliance-manager.js +21 -0
- package/dist/types/enyo-authentication.d.ts +16 -2
- package/dist/types/enyo-inverter-appliance.d.ts +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -179,6 +179,27 @@ class ApplianceManager {
|
|
|
179
179
|
}
|
|
180
180
|
return matches;
|
|
181
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Gets an appliance by its unique ID.
|
|
184
|
+
* @param applianceId The ID of the appliance to retrieve
|
|
185
|
+
* @returns The appliance if found, null otherwise
|
|
186
|
+
*/
|
|
187
|
+
async findApplianceById(applianceId) {
|
|
188
|
+
try {
|
|
189
|
+
const appliance = await this.energyApp.useAppliances().getById(applianceId);
|
|
190
|
+
if (appliance) {
|
|
191
|
+
// Update cache with the fetched appliance
|
|
192
|
+
this.updateCache(appliance);
|
|
193
|
+
return appliance;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
if (this.config.enableLogging) {
|
|
198
|
+
console.error(`Failed to get appliance ${applianceId}: ${error}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
182
203
|
/**
|
|
183
204
|
* Finds an appliance using multiple strategies.
|
|
184
205
|
* @param searchValue The value to search for
|
|
@@ -109,6 +109,12 @@ export declare class ApplianceManager {
|
|
|
109
109
|
* @returns Array of matching appliances
|
|
110
110
|
*/
|
|
111
111
|
findByIdentifier(identifier: string): Promise<EnyoAppliance[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Gets an appliance by its unique ID.
|
|
114
|
+
* @param applianceId The ID of the appliance to retrieve
|
|
115
|
+
* @returns The appliance if found, null otherwise
|
|
116
|
+
*/
|
|
117
|
+
findApplianceById(applianceId: string): Promise<EnyoAppliance | null>;
|
|
112
118
|
/**
|
|
113
119
|
* Finds an appliance using multiple strategies.
|
|
114
120
|
* @param searchValue The value to search for
|
|
@@ -19,8 +19,16 @@ export interface EnyoOauthAuthentication {
|
|
|
19
19
|
clientIdName?: EnyoPackageConfigurationTranslatedValue[];
|
|
20
20
|
clientSecretName?: EnyoPackageConfigurationTranslatedValue[];
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* OAuth authentication start configuration
|
|
24
|
+
* Contains the required redirect URL and optional client credentials
|
|
25
|
+
*/
|
|
22
26
|
export interface EnyoOauthAuthenticationStart {
|
|
27
|
+
/** The redirect URL where the OAuth provider should send the user after authentication */
|
|
28
|
+
enyoRedirectUrl: string;
|
|
29
|
+
/** Optional client ID if the user needs to provide their own OAuth app credentials */
|
|
23
30
|
clientId?: string;
|
|
31
|
+
/** Optional client secret if the user needs to provide their own OAuth app credentials */
|
|
24
32
|
clientSecret?: string;
|
|
25
33
|
}
|
|
26
34
|
export interface EnyoOauthAuthenticationRedirectUrlResponse {
|
|
@@ -47,9 +55,15 @@ export interface EnyoUsernamePasswordAuthenticationResponse {
|
|
|
47
55
|
username: string;
|
|
48
56
|
password: string;
|
|
49
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* OAuth authentication response containing authorization code and/or additional parameters
|
|
60
|
+
* The code is optional to support different OAuth flows and providers
|
|
61
|
+
*/
|
|
50
62
|
export interface EnyoOauthAuthenticationResponse {
|
|
51
|
-
code
|
|
52
|
-
|
|
63
|
+
/** OAuth authorization code - optional to support various OAuth flows */
|
|
64
|
+
code?: string;
|
|
65
|
+
/** Additional URL parameters that may be returned by the OAuth provider */
|
|
66
|
+
urlParams?: Record<string, string>;
|
|
53
67
|
}
|
|
54
68
|
export interface EnyoAuthenticationResponse {
|
|
55
69
|
requestId: string;
|
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.47';
|
|
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
|
@@ -109,6 +109,12 @@ export declare class ApplianceManager {
|
|
|
109
109
|
* @returns Array of matching appliances
|
|
110
110
|
*/
|
|
111
111
|
findByIdentifier(identifier: string): Promise<EnyoAppliance[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Gets an appliance by its unique ID.
|
|
114
|
+
* @param applianceId The ID of the appliance to retrieve
|
|
115
|
+
* @returns The appliance if found, null otherwise
|
|
116
|
+
*/
|
|
117
|
+
findApplianceById(applianceId: string): Promise<EnyoAppliance | null>;
|
|
112
118
|
/**
|
|
113
119
|
* Finds an appliance using multiple strategies.
|
|
114
120
|
* @param searchValue The value to search for
|
|
@@ -176,6 +176,27 @@ export class ApplianceManager {
|
|
|
176
176
|
}
|
|
177
177
|
return matches;
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Gets an appliance by its unique ID.
|
|
181
|
+
* @param applianceId The ID of the appliance to retrieve
|
|
182
|
+
* @returns The appliance if found, null otherwise
|
|
183
|
+
*/
|
|
184
|
+
async findApplianceById(applianceId) {
|
|
185
|
+
try {
|
|
186
|
+
const appliance = await this.energyApp.useAppliances().getById(applianceId);
|
|
187
|
+
if (appliance) {
|
|
188
|
+
// Update cache with the fetched appliance
|
|
189
|
+
this.updateCache(appliance);
|
|
190
|
+
return appliance;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
if (this.config.enableLogging) {
|
|
195
|
+
console.error(`Failed to get appliance ${applianceId}: ${error}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
179
200
|
/**
|
|
180
201
|
* Finds an appliance using multiple strategies.
|
|
181
202
|
* @param searchValue The value to search for
|
|
@@ -19,8 +19,16 @@ export interface EnyoOauthAuthentication {
|
|
|
19
19
|
clientIdName?: EnyoPackageConfigurationTranslatedValue[];
|
|
20
20
|
clientSecretName?: EnyoPackageConfigurationTranslatedValue[];
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* OAuth authentication start configuration
|
|
24
|
+
* Contains the required redirect URL and optional client credentials
|
|
25
|
+
*/
|
|
22
26
|
export interface EnyoOauthAuthenticationStart {
|
|
27
|
+
/** The redirect URL where the OAuth provider should send the user after authentication */
|
|
28
|
+
enyoRedirectUrl: string;
|
|
29
|
+
/** Optional client ID if the user needs to provide their own OAuth app credentials */
|
|
23
30
|
clientId?: string;
|
|
31
|
+
/** Optional client secret if the user needs to provide their own OAuth app credentials */
|
|
24
32
|
clientSecret?: string;
|
|
25
33
|
}
|
|
26
34
|
export interface EnyoOauthAuthenticationRedirectUrlResponse {
|
|
@@ -47,9 +55,15 @@ export interface EnyoUsernamePasswordAuthenticationResponse {
|
|
|
47
55
|
username: string;
|
|
48
56
|
password: string;
|
|
49
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* OAuth authentication response containing authorization code and/or additional parameters
|
|
60
|
+
* The code is optional to support different OAuth flows and providers
|
|
61
|
+
*/
|
|
50
62
|
export interface EnyoOauthAuthenticationResponse {
|
|
51
|
-
code
|
|
52
|
-
|
|
63
|
+
/** OAuth authorization code - optional to support various OAuth flows */
|
|
64
|
+
code?: string;
|
|
65
|
+
/** Additional URL parameters that may be returned by the OAuth provider */
|
|
66
|
+
urlParams?: Record<string, string>;
|
|
53
67
|
}
|
|
54
68
|
export interface EnyoAuthenticationResponse {
|
|
55
69
|
requestId: string;
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED