@enyo-energy/energy-app-sdk 0.0.43 → 0.0.44
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/energy-app-permission.type.cjs +2 -0
- package/dist/cjs/energy-app-permission.type.d.cts +4 -2
- package/dist/cjs/enyo-energy-app-sdk.d.cts +3 -0
- package/dist/cjs/index.cjs +9 -0
- package/dist/cjs/index.d.cts +8 -0
- package/dist/cjs/packages/energy-app-location.cjs +2 -0
- package/dist/cjs/packages/energy-app-location.d.cts +43 -0
- package/dist/cjs/packages/energy-app-secret-manager.d.cts +22 -0
- package/dist/cjs/types/enyo-battery-appliance.cjs +13 -0
- package/dist/cjs/types/enyo-battery-appliance.d.cts +13 -0
- package/dist/cjs/types/enyo-location.cjs +2 -0
- package/dist/cjs/types/enyo-location.d.cts +20 -0
- package/dist/cjs/types/enyo-secret-manager.cjs +11 -1
- package/dist/cjs/types/enyo-secret-manager.d.cts +6 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/energy-app-permission.type.d.ts +4 -2
- package/dist/energy-app-permission.type.js +2 -0
- package/dist/enyo-energy-app-sdk.d.ts +3 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/packages/energy-app-location.d.ts +43 -0
- package/dist/packages/energy-app-location.js +1 -0
- package/dist/packages/energy-app-secret-manager.d.ts +22 -0
- package/dist/types/enyo-battery-appliance.d.ts +13 -0
- package/dist/types/enyo-battery-appliance.js +12 -1
- package/dist/types/enyo-location.d.ts +20 -0
- package/dist/types/enyo-location.js +1 -0
- package/dist/types/enyo-secret-manager.d.ts +6 -0
- package/dist/types/enyo-secret-manager.js +9 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -19,4 +19,6 @@ var EnergyAppPermissionTypeEnum;
|
|
|
19
19
|
EnergyAppPermissionTypeEnum["Vehicle"] = "Vehicle";
|
|
20
20
|
EnergyAppPermissionTypeEnum["Charge"] = "Charge";
|
|
21
21
|
EnergyAppPermissionTypeEnum["SecretManager"] = "SecretManager";
|
|
22
|
+
EnergyAppPermissionTypeEnum["LocationZipCode"] = "LocationZipCode";
|
|
23
|
+
EnergyAppPermissionTypeEnum["LocationCoordinates"] = "LocationCoordinates";
|
|
22
24
|
})(EnergyAppPermissionTypeEnum || (exports.EnergyAppPermissionTypeEnum = EnergyAppPermissionTypeEnum = {}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager';
|
|
1
|
+
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates';
|
|
2
2
|
export declare enum EnergyAppPermissionTypeEnum {
|
|
3
3
|
RestrictedInternetAccess = "RestrictedInternetAccess",
|
|
4
4
|
NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
|
|
@@ -15,5 +15,7 @@ export declare enum EnergyAppPermissionTypeEnum {
|
|
|
15
15
|
ChargingCard = "ChargingCard",
|
|
16
16
|
Vehicle = "Vehicle",
|
|
17
17
|
Charge = "Charge",
|
|
18
|
-
SecretManager = "SecretManager"
|
|
18
|
+
SecretManager = "SecretManager",
|
|
19
|
+
LocationZipCode = "LocationZipCode",
|
|
20
|
+
LocationCoordinates = "LocationCoordinates"
|
|
19
21
|
}
|
|
@@ -13,6 +13,7 @@ import { EnergyAppSettings } from "./packages/energy-app-settings.cjs";
|
|
|
13
13
|
import { EnergyAppElectricityPrices } from "./packages/energy-app-electricity-prices.cjs";
|
|
14
14
|
import { EnergyAppNotification } from "./packages/energy-app-notification.cjs";
|
|
15
15
|
import { EnergyAppSecretManager } from "./packages/energy-app-secret-manager.cjs";
|
|
16
|
+
import { EnergyAppLocation } from "./packages/energy-app-location.cjs";
|
|
16
17
|
export declare enum EnergyAppStateEnum {
|
|
17
18
|
Launching = "launching",
|
|
18
19
|
Running = "running",
|
|
@@ -67,4 +68,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
67
68
|
useNotification: () => EnergyAppNotification;
|
|
68
69
|
/** Get the Secret Manager API */
|
|
69
70
|
useSecretManager: () => EnergyAppSecretManager;
|
|
71
|
+
/** Get the Location API */
|
|
72
|
+
useLocation: () => EnergyAppLocation;
|
|
70
73
|
}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./types/enyo-energy-tariff.cjs"), exports);
|
|
|
27
27
|
__exportStar(require("./types/enyo-electricity-prices.cjs"), exports);
|
|
28
28
|
__exportStar(require("./types/enyo-notification.cjs"), exports);
|
|
29
29
|
__exportStar(require("./types/enyo-secret-manager.cjs"), exports);
|
|
30
|
+
__exportStar(require("./types/enyo-location.cjs"), exports);
|
|
30
31
|
__exportStar(require("./implementations/appliances/appliance-manager.cjs"), exports);
|
|
31
32
|
__exportStar(require("./implementations/appliances/identifier-strategies.cjs"), exports);
|
|
32
33
|
class EnergyApp {
|
|
@@ -114,6 +115,14 @@ class EnergyApp {
|
|
|
114
115
|
useSecretManager() {
|
|
115
116
|
return this.energyAppSdk.useSecretManager();
|
|
116
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Gets the Location API for retrieving device location information.
|
|
120
|
+
* Provides methods to fetch location with varying levels of detail based on permissions.
|
|
121
|
+
* @returns The Location API instance
|
|
122
|
+
*/
|
|
123
|
+
useLocation() {
|
|
124
|
+
return this.energyAppSdk.useLocation();
|
|
125
|
+
}
|
|
117
126
|
/**
|
|
118
127
|
* Gets the current SDK version.
|
|
119
128
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -14,6 +14,7 @@ import { EnergyAppSettings } from "./packages/energy-app-settings.cjs";
|
|
|
14
14
|
import { EnergyAppElectricityPrices } from "./packages/energy-app-electricity-prices.cjs";
|
|
15
15
|
import { EnergyAppNotification } from "./packages/energy-app-notification.cjs";
|
|
16
16
|
import { EnergyAppSecretManager } from "./packages/energy-app-secret-manager.cjs";
|
|
17
|
+
import { EnergyAppLocation } from "./packages/energy-app-location.cjs";
|
|
17
18
|
export * from './energy-app-package-definition.cjs';
|
|
18
19
|
export * from './version.cjs';
|
|
19
20
|
export * from './implementations/ocpp/ocpp16.cjs';
|
|
@@ -25,6 +26,7 @@ export * from './types/enyo-energy-tariff.cjs';
|
|
|
25
26
|
export * from './types/enyo-electricity-prices.cjs';
|
|
26
27
|
export * from './types/enyo-notification.cjs';
|
|
27
28
|
export * from './types/enyo-secret-manager.cjs';
|
|
29
|
+
export * from './types/enyo-location.cjs';
|
|
28
30
|
export * from './implementations/appliances/appliance-manager.cjs';
|
|
29
31
|
export * from './implementations/appliances/identifier-strategies.cjs';
|
|
30
32
|
export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
@@ -55,6 +57,12 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
55
57
|
* @returns The Secret Manager API instance
|
|
56
58
|
*/
|
|
57
59
|
useSecretManager(): EnergyAppSecretManager;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the Location API for retrieving device location information.
|
|
62
|
+
* Provides methods to fetch location with varying levels of detail based on permissions.
|
|
63
|
+
* @returns The Location API instance
|
|
64
|
+
*/
|
|
65
|
+
useLocation(): EnergyAppLocation;
|
|
58
66
|
/**
|
|
59
67
|
* Gets the current SDK version.
|
|
60
68
|
* @returns The semantic version string of the SDK
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EnyoLocation, EnyoZipCodeLocation } from "../types/enyo-location.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for managing location information in energy apps.
|
|
4
|
+
* Provides methods to retrieve the device's location with varying levels of detail
|
|
5
|
+
* based on granted permissions.
|
|
6
|
+
*/
|
|
7
|
+
export interface EnergyAppLocation {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the location with only the zip code.
|
|
10
|
+
* Requires the 'LocationZipCode' permission to be granted.
|
|
11
|
+
*
|
|
12
|
+
* @returns Promise that resolves to the location with zip code only, or null if not set
|
|
13
|
+
* @throws {PermissionNotGranted} If the LocationZipCode permission is not granted
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const location = energyApp.useLocation();
|
|
18
|
+
* const zipLocation = await location.getLocationByZipCode();
|
|
19
|
+
* if (zipLocation) {
|
|
20
|
+
* console.log(`Zip Code: ${zipLocation.zipCode}`);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
getLocationByZipCode(): Promise<EnyoZipCodeLocation | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the location with both zip code and geographic coordinates.
|
|
27
|
+
* Requires both 'LocationZipCode' and 'LocationCoordinates' permissions to be granted.
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise that resolves to the location with zip code and coordinates, or null if not set
|
|
30
|
+
* @throws {PermissionNotGranted} If either LocationZipCode or LocationCoordinates permission is not granted
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const location = energyApp.useLocation();
|
|
35
|
+
* const fullLocation = await location.getLocationWithCoordinates();
|
|
36
|
+
* if (fullLocation && fullLocation.coordinates) {
|
|
37
|
+
* console.log(`Location: ${fullLocation.zipCode}`);
|
|
38
|
+
* console.log(`Coordinates: ${fullLocation.coordinates.latitude}, ${fullLocation.coordinates.longitude}`);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
getLocationWithCoordinates(): Promise<EnyoLocation | null>;
|
|
43
|
+
}
|
|
@@ -58,4 +58,26 @@ export interface EnergyAppSecretManager {
|
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
listAvailableSecrets(): Promise<string[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Saves a new secret to the secret store.
|
|
63
|
+
* The secret will be encrypted using the provided encryption key.
|
|
64
|
+
*
|
|
65
|
+
* @param secretName - The name for the new secret
|
|
66
|
+
* @param encryptionKey - The encryption key to use for encrypting the secret
|
|
67
|
+
* @param secret - The secret data to save as key-value pairs
|
|
68
|
+
* @returns Promise that resolves when the secret is successfully saved
|
|
69
|
+
* @throws {SecretNameConflictException} If a secret with this name already exists and is not an installed package secret
|
|
70
|
+
* @throws {SecretRetrievalError} If there's an error saving the secret
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const secretManager = energyApp.useSecretManager();
|
|
75
|
+
* const encryptionKey = process.env.SECRET_ENCRYPTION_KEY;
|
|
76
|
+
* await secretManager.saveSecret("new_api_keys", encryptionKey, {
|
|
77
|
+
* api_key: "abc123",
|
|
78
|
+
* api_secret: "xyz789"
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
saveSecret<T extends Record<string, string>>(secretName: string, encryptionKey: string, secret: T): Promise<void>;
|
|
61
83
|
}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnyoBatteryFeature = exports.EnyoBatteryStorageMode = void 0;
|
|
4
|
+
var EnyoBatteryStorageMode;
|
|
5
|
+
(function (EnyoBatteryStorageMode) {
|
|
6
|
+
EnyoBatteryStorageMode["CHARGE"] = "charge";
|
|
7
|
+
EnyoBatteryStorageMode["DISCHARGE"] = "discharge";
|
|
8
|
+
EnyoBatteryStorageMode["HOLDING"] = "holding";
|
|
9
|
+
EnyoBatteryStorageMode["AUTO"] = "auto";
|
|
10
|
+
EnyoBatteryStorageMode["Unknown"] = "unknown";
|
|
11
|
+
})(EnyoBatteryStorageMode || (exports.EnyoBatteryStorageMode = EnyoBatteryStorageMode = {}));
|
|
12
|
+
var EnyoBatteryFeature;
|
|
13
|
+
(function (EnyoBatteryFeature) {
|
|
14
|
+
EnyoBatteryFeature["GridCharging"] = "grid-charging";
|
|
15
|
+
})(EnyoBatteryFeature || (exports.EnyoBatteryFeature = EnyoBatteryFeature = {}));
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
export declare enum EnyoBatteryStorageMode {
|
|
2
|
+
CHARGE = "charge",
|
|
3
|
+
DISCHARGE = "discharge",
|
|
4
|
+
HOLDING = "holding",
|
|
5
|
+
AUTO = "auto",
|
|
6
|
+
Unknown = "unknown"
|
|
7
|
+
}
|
|
8
|
+
export declare enum EnyoBatteryFeature {
|
|
9
|
+
GridCharging = "grid-charging"
|
|
10
|
+
}
|
|
1
11
|
export interface EnyoBatteryApplianceMetadata {
|
|
2
12
|
connectedToApplianceId?: string;
|
|
3
13
|
maxDischargePowerW?: number;
|
|
4
14
|
maxChargingPowerW?: number;
|
|
5
15
|
maxCapacityWh?: number;
|
|
16
|
+
storageMode?: EnyoBatteryStorageMode;
|
|
17
|
+
gridChargingEnabled?: boolean;
|
|
18
|
+
features?: EnyoBatteryFeature[];
|
|
6
19
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents geographic coordinates with latitude and longitude.
|
|
3
|
+
*/
|
|
4
|
+
export interface Coordinates {
|
|
5
|
+
/** Latitude in decimal degrees */
|
|
6
|
+
latitude: number;
|
|
7
|
+
/** Longitude in decimal degrees */
|
|
8
|
+
longitude: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a location with zip code and optional coordinates.
|
|
12
|
+
*/
|
|
13
|
+
export interface EnyoZipCodeLocation {
|
|
14
|
+
/** The zip/postal code of the location */
|
|
15
|
+
zipCode: string;
|
|
16
|
+
}
|
|
17
|
+
export interface EnyoLocation {
|
|
18
|
+
zipCode: string;
|
|
19
|
+
coordinates: Coordinates;
|
|
20
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SecretRetrievalError = exports.SecretNotFoundError = void 0;
|
|
3
|
+
exports.SecretNameConflictException = exports.SecretRetrievalError = exports.SecretNotFoundError = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Error that occurs when a secret cannot be found.
|
|
6
6
|
*/
|
|
@@ -13,3 +13,13 @@ exports.SecretNotFoundError = SecretNotFoundError;
|
|
|
13
13
|
class SecretRetrievalError extends Error {
|
|
14
14
|
}
|
|
15
15
|
exports.SecretRetrievalError = SecretRetrievalError;
|
|
16
|
+
/**
|
|
17
|
+
* Error that occurs when attempting to save a secret with a name that already exists.
|
|
18
|
+
*/
|
|
19
|
+
class SecretNameConflictException extends Error {
|
|
20
|
+
constructor(secretName) {
|
|
21
|
+
super(`Secret with name "${secretName}" already exists and is not an installed package secret`);
|
|
22
|
+
this.name = 'SecretNameConflictException';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.SecretNameConflictException = SecretNameConflictException;
|
|
@@ -31,3 +31,9 @@ export declare class SecretNotFoundError extends Error {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare class SecretRetrievalError extends Error {
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Error that occurs when attempting to save a secret with a name that already exists.
|
|
36
|
+
*/
|
|
37
|
+
export declare class SecretNameConflictException extends Error {
|
|
38
|
+
constructor(secretName: string);
|
|
39
|
+
}
|
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.44';
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager';
|
|
1
|
+
export type EnergyAppPermissionType = 'RestrictedInternetAccess' | 'NetworkDeviceDiscovery' | 'NetworkDeviceSearch' | 'NetworkDeviceAccess' | 'Modbus' | 'Storage' | 'Appliance' | 'AllAppliances' | 'SendDataBusValues' | 'SubscribeDataBus' | 'SendDataBusCommands' | 'OcppServer' | 'ChargingCard' | 'Vehicle' | 'Charge' | 'SecretManager' | 'LocationZipCode' | 'LocationCoordinates';
|
|
2
2
|
export declare enum EnergyAppPermissionTypeEnum {
|
|
3
3
|
RestrictedInternetAccess = "RestrictedInternetAccess",
|
|
4
4
|
NetworkDeviceDiscovery = "NetworkDeviceDiscovery",
|
|
@@ -15,5 +15,7 @@ export declare enum EnergyAppPermissionTypeEnum {
|
|
|
15
15
|
ChargingCard = "ChargingCard",
|
|
16
16
|
Vehicle = "Vehicle",
|
|
17
17
|
Charge = "Charge",
|
|
18
|
-
SecretManager = "SecretManager"
|
|
18
|
+
SecretManager = "SecretManager",
|
|
19
|
+
LocationZipCode = "LocationZipCode",
|
|
20
|
+
LocationCoordinates = "LocationCoordinates"
|
|
19
21
|
}
|
|
@@ -16,4 +16,6 @@ export var EnergyAppPermissionTypeEnum;
|
|
|
16
16
|
EnergyAppPermissionTypeEnum["Vehicle"] = "Vehicle";
|
|
17
17
|
EnergyAppPermissionTypeEnum["Charge"] = "Charge";
|
|
18
18
|
EnergyAppPermissionTypeEnum["SecretManager"] = "SecretManager";
|
|
19
|
+
EnergyAppPermissionTypeEnum["LocationZipCode"] = "LocationZipCode";
|
|
20
|
+
EnergyAppPermissionTypeEnum["LocationCoordinates"] = "LocationCoordinates";
|
|
19
21
|
})(EnergyAppPermissionTypeEnum || (EnergyAppPermissionTypeEnum = {}));
|
|
@@ -13,6 +13,7 @@ import { EnergyAppSettings } from "./packages/energy-app-settings.js";
|
|
|
13
13
|
import { EnergyAppElectricityPrices } from "./packages/energy-app-electricity-prices.js";
|
|
14
14
|
import { EnergyAppNotification } from "./packages/energy-app-notification.js";
|
|
15
15
|
import { EnergyAppSecretManager } from "./packages/energy-app-secret-manager.js";
|
|
16
|
+
import { EnergyAppLocation } from "./packages/energy-app-location.js";
|
|
16
17
|
export declare enum EnergyAppStateEnum {
|
|
17
18
|
Launching = "launching",
|
|
18
19
|
Running = "running",
|
|
@@ -67,4 +68,6 @@ export interface EnyoEnergyAppSdk {
|
|
|
67
68
|
useNotification: () => EnergyAppNotification;
|
|
68
69
|
/** Get the Secret Manager API */
|
|
69
70
|
useSecretManager: () => EnergyAppSecretManager;
|
|
71
|
+
/** Get the Location API */
|
|
72
|
+
useLocation: () => EnergyAppLocation;
|
|
70
73
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { EnergyAppSettings } from "./packages/energy-app-settings.js";
|
|
|
14
14
|
import { EnergyAppElectricityPrices } from "./packages/energy-app-electricity-prices.js";
|
|
15
15
|
import { EnergyAppNotification } from "./packages/energy-app-notification.js";
|
|
16
16
|
import { EnergyAppSecretManager } from "./packages/energy-app-secret-manager.js";
|
|
17
|
+
import { EnergyAppLocation } from "./packages/energy-app-location.js";
|
|
17
18
|
export * from './energy-app-package-definition.js';
|
|
18
19
|
export * from './version.js';
|
|
19
20
|
export * from './implementations/ocpp/ocpp16.js';
|
|
@@ -25,6 +26,7 @@ export * from './types/enyo-energy-tariff.js';
|
|
|
25
26
|
export * from './types/enyo-electricity-prices.js';
|
|
26
27
|
export * from './types/enyo-notification.js';
|
|
27
28
|
export * from './types/enyo-secret-manager.js';
|
|
29
|
+
export * from './types/enyo-location.js';
|
|
28
30
|
export * from './implementations/appliances/appliance-manager.js';
|
|
29
31
|
export * from './implementations/appliances/identifier-strategies.js';
|
|
30
32
|
export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
@@ -55,6 +57,12 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
|
|
|
55
57
|
* @returns The Secret Manager API instance
|
|
56
58
|
*/
|
|
57
59
|
useSecretManager(): EnergyAppSecretManager;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the Location API for retrieving device location information.
|
|
62
|
+
* Provides methods to fetch location with varying levels of detail based on permissions.
|
|
63
|
+
* @returns The Location API instance
|
|
64
|
+
*/
|
|
65
|
+
useLocation(): EnergyAppLocation;
|
|
58
66
|
/**
|
|
59
67
|
* Gets the current SDK version.
|
|
60
68
|
* @returns The semantic version string of the SDK
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './types/enyo-energy-tariff.js';
|
|
|
10
10
|
export * from './types/enyo-electricity-prices.js';
|
|
11
11
|
export * from './types/enyo-notification.js';
|
|
12
12
|
export * from './types/enyo-secret-manager.js';
|
|
13
|
+
export * from './types/enyo-location.js';
|
|
13
14
|
export * from './implementations/appliances/appliance-manager.js';
|
|
14
15
|
export * from './implementations/appliances/identifier-strategies.js';
|
|
15
16
|
export class EnergyApp {
|
|
@@ -97,6 +98,14 @@ export class EnergyApp {
|
|
|
97
98
|
useSecretManager() {
|
|
98
99
|
return this.energyAppSdk.useSecretManager();
|
|
99
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets the Location API for retrieving device location information.
|
|
103
|
+
* Provides methods to fetch location with varying levels of detail based on permissions.
|
|
104
|
+
* @returns The Location API instance
|
|
105
|
+
*/
|
|
106
|
+
useLocation() {
|
|
107
|
+
return this.energyAppSdk.useLocation();
|
|
108
|
+
}
|
|
100
109
|
/**
|
|
101
110
|
* Gets the current SDK version.
|
|
102
111
|
* @returns The semantic version string of the SDK
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EnyoLocation, EnyoZipCodeLocation } from "../types/enyo-location.js";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for managing location information in energy apps.
|
|
4
|
+
* Provides methods to retrieve the device's location with varying levels of detail
|
|
5
|
+
* based on granted permissions.
|
|
6
|
+
*/
|
|
7
|
+
export interface EnergyAppLocation {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the location with only the zip code.
|
|
10
|
+
* Requires the 'LocationZipCode' permission to be granted.
|
|
11
|
+
*
|
|
12
|
+
* @returns Promise that resolves to the location with zip code only, or null if not set
|
|
13
|
+
* @throws {PermissionNotGranted} If the LocationZipCode permission is not granted
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const location = energyApp.useLocation();
|
|
18
|
+
* const zipLocation = await location.getLocationByZipCode();
|
|
19
|
+
* if (zipLocation) {
|
|
20
|
+
* console.log(`Zip Code: ${zipLocation.zipCode}`);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
getLocationByZipCode(): Promise<EnyoZipCodeLocation | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the location with both zip code and geographic coordinates.
|
|
27
|
+
* Requires both 'LocationZipCode' and 'LocationCoordinates' permissions to be granted.
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise that resolves to the location with zip code and coordinates, or null if not set
|
|
30
|
+
* @throws {PermissionNotGranted} If either LocationZipCode or LocationCoordinates permission is not granted
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const location = energyApp.useLocation();
|
|
35
|
+
* const fullLocation = await location.getLocationWithCoordinates();
|
|
36
|
+
* if (fullLocation && fullLocation.coordinates) {
|
|
37
|
+
* console.log(`Location: ${fullLocation.zipCode}`);
|
|
38
|
+
* console.log(`Coordinates: ${fullLocation.coordinates.latitude}, ${fullLocation.coordinates.longitude}`);
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
getLocationWithCoordinates(): Promise<EnyoLocation | null>;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -58,4 +58,26 @@ export interface EnergyAppSecretManager {
|
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
listAvailableSecrets(): Promise<string[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Saves a new secret to the secret store.
|
|
63
|
+
* The secret will be encrypted using the provided encryption key.
|
|
64
|
+
*
|
|
65
|
+
* @param secretName - The name for the new secret
|
|
66
|
+
* @param encryptionKey - The encryption key to use for encrypting the secret
|
|
67
|
+
* @param secret - The secret data to save as key-value pairs
|
|
68
|
+
* @returns Promise that resolves when the secret is successfully saved
|
|
69
|
+
* @throws {SecretNameConflictException} If a secret with this name already exists and is not an installed package secret
|
|
70
|
+
* @throws {SecretRetrievalError} If there's an error saving the secret
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const secretManager = energyApp.useSecretManager();
|
|
75
|
+
* const encryptionKey = process.env.SECRET_ENCRYPTION_KEY;
|
|
76
|
+
* await secretManager.saveSecret("new_api_keys", encryptionKey, {
|
|
77
|
+
* api_key: "abc123",
|
|
78
|
+
* api_secret: "xyz789"
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
saveSecret<T extends Record<string, string>>(secretName: string, encryptionKey: string, secret: T): Promise<void>;
|
|
61
83
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
export declare enum EnyoBatteryStorageMode {
|
|
2
|
+
CHARGE = "charge",
|
|
3
|
+
DISCHARGE = "discharge",
|
|
4
|
+
HOLDING = "holding",
|
|
5
|
+
AUTO = "auto",
|
|
6
|
+
Unknown = "unknown"
|
|
7
|
+
}
|
|
8
|
+
export declare enum EnyoBatteryFeature {
|
|
9
|
+
GridCharging = "grid-charging"
|
|
10
|
+
}
|
|
1
11
|
export interface EnyoBatteryApplianceMetadata {
|
|
2
12
|
connectedToApplianceId?: string;
|
|
3
13
|
maxDischargePowerW?: number;
|
|
4
14
|
maxChargingPowerW?: number;
|
|
5
15
|
maxCapacityWh?: number;
|
|
16
|
+
storageMode?: EnyoBatteryStorageMode;
|
|
17
|
+
gridChargingEnabled?: boolean;
|
|
18
|
+
features?: EnyoBatteryFeature[];
|
|
6
19
|
}
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var EnyoBatteryStorageMode;
|
|
2
|
+
(function (EnyoBatteryStorageMode) {
|
|
3
|
+
EnyoBatteryStorageMode["CHARGE"] = "charge";
|
|
4
|
+
EnyoBatteryStorageMode["DISCHARGE"] = "discharge";
|
|
5
|
+
EnyoBatteryStorageMode["HOLDING"] = "holding";
|
|
6
|
+
EnyoBatteryStorageMode["AUTO"] = "auto";
|
|
7
|
+
EnyoBatteryStorageMode["Unknown"] = "unknown";
|
|
8
|
+
})(EnyoBatteryStorageMode || (EnyoBatteryStorageMode = {}));
|
|
9
|
+
export var EnyoBatteryFeature;
|
|
10
|
+
(function (EnyoBatteryFeature) {
|
|
11
|
+
EnyoBatteryFeature["GridCharging"] = "grid-charging";
|
|
12
|
+
})(EnyoBatteryFeature || (EnyoBatteryFeature = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents geographic coordinates with latitude and longitude.
|
|
3
|
+
*/
|
|
4
|
+
export interface Coordinates {
|
|
5
|
+
/** Latitude in decimal degrees */
|
|
6
|
+
latitude: number;
|
|
7
|
+
/** Longitude in decimal degrees */
|
|
8
|
+
longitude: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a location with zip code and optional coordinates.
|
|
12
|
+
*/
|
|
13
|
+
export interface EnyoZipCodeLocation {
|
|
14
|
+
/** The zip/postal code of the location */
|
|
15
|
+
zipCode: string;
|
|
16
|
+
}
|
|
17
|
+
export interface EnyoLocation {
|
|
18
|
+
zipCode: string;
|
|
19
|
+
coordinates: Coordinates;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,3 +31,9 @@ export declare class SecretNotFoundError extends Error {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare class SecretRetrievalError extends Error {
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Error that occurs when attempting to save a secret with a name that already exists.
|
|
36
|
+
*/
|
|
37
|
+
export declare class SecretNameConflictException extends Error {
|
|
38
|
+
constructor(secretName: string);
|
|
39
|
+
}
|
|
@@ -8,3 +8,12 @@ export class SecretNotFoundError extends Error {
|
|
|
8
8
|
*/
|
|
9
9
|
export class SecretRetrievalError extends Error {
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Error that occurs when attempting to save a secret with a name that already exists.
|
|
13
|
+
*/
|
|
14
|
+
export class SecretNameConflictException extends Error {
|
|
15
|
+
constructor(secretName) {
|
|
16
|
+
super(`Secret with name "${secretName}" already exists and is not an installed package secret`);
|
|
17
|
+
this.name = 'SecretNameConflictException';
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED