@enyo-energy/energy-app-sdk 0.0.162 → 0.0.164

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.
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnergyAppModelFeatureEnum = void 0;
4
+ /**
5
+ * Important capabilities a specific device model can support.
6
+ *
7
+ * Declared per model inside an Energy App package's compatibility section
8
+ * (see {@link EnergyAppPackageCompatibilityModel}) so the enyo Store and
9
+ * onboarding flows can surface accurate, model-level feature information to
10
+ * users. Values are grouped by device category for readability.
11
+ */
12
+ var EnergyAppModelFeatureEnum;
13
+ (function (EnergyAppModelFeatureEnum) {
14
+ // Battery / Storage
15
+ /** The battery can be charged from the grid (not only from PV surplus) */
16
+ EnergyAppModelFeatureEnum["BatteryChargingFromGrid"] = "battery-charging-from-grid";
17
+ /** The maximum charge power or target state of charge can be limited */
18
+ EnergyAppModelFeatureEnum["BatteryChargeLimitation"] = "battery-charge-limitation";
19
+ /** The maximum discharge power or minimum state of charge can be limited */
20
+ EnergyAppModelFeatureEnum["BatteryDischargeLimitation"] = "battery-discharge-limitation";
21
+ // Inverter / PV
22
+ /** The PV feed-in power into the grid can be limited (curtailment) */
23
+ EnergyAppModelFeatureEnum["PvFeedInLimitation"] = "pv-feed-in-limitation";
24
+ /** The inverter active power output can be limited */
25
+ EnergyAppModelFeatureEnum["InverterPowerLimitation"] = "inverter-power-limitation";
26
+ // Wallbox / Charging
27
+ /** Charging can be started and stopped remotely */
28
+ EnergyAppModelFeatureEnum["ChargingStartStop"] = "charging-start-stop";
29
+ /** The charging power (in Ampere or Watt) can be limited */
30
+ EnergyAppModelFeatureEnum["ChargingPowerLimitation"] = "charging-power-limitation";
31
+ /** The model supports switching between single- and three-phase charging */
32
+ EnergyAppModelFeatureEnum["ChargingPhaseSwitching"] = "charging-phase-switching";
33
+ /** The model supports charging from PV surplus */
34
+ EnergyAppModelFeatureEnum["PvSurplusCharging"] = "pv-surplus-charging";
35
+ // Heat Pump
36
+ /** Domestic hot water heating can be forced on demand (DHW boost) */
37
+ EnergyAppModelFeatureEnum["HeatpumpDhwBoost"] = "heatpump-dhw-boost";
38
+ /** The target temperature setpoint can be controlled */
39
+ EnergyAppModelFeatureEnum["HeatpumpTemperatureSetpoint"] = "heatpump-temperature-setpoint";
40
+ /** The heat pump output power can be modulated */
41
+ EnergyAppModelFeatureEnum["HeatpumpPowerModulation"] = "heatpump-power-modulation";
42
+ /** The model supports the SG Ready interface for smart-grid signalling */
43
+ EnergyAppModelFeatureEnum["HeatpumpSgReady"] = "heatpump-sg-ready";
44
+ // Climate Control / Air Conditioning
45
+ /** The target temperature setpoint can be controlled */
46
+ EnergyAppModelFeatureEnum["ClimateTemperatureSetpoint"] = "climate-temperature-setpoint";
47
+ /** The operating mode (heat / cool / fan / off) can be controlled */
48
+ EnergyAppModelFeatureEnum["ClimateModeControl"] = "climate-mode-control";
49
+ // Meter
50
+ /** The grid power (import / export) can be read out */
51
+ EnergyAppModelFeatureEnum["GridPowerReadout"] = "grid-power-readout";
52
+ /** The accumulated energy consumption can be read out */
53
+ EnergyAppModelFeatureEnum["EnergyConsumptionReadout"] = "energy-consumption-readout";
54
+ // Smart Plug
55
+ /** The plug can be switched on and off */
56
+ EnergyAppModelFeatureEnum["SwitchOnOff"] = "switch-on-off";
57
+ /** The plug can measure the connected load's power */
58
+ EnergyAppModelFeatureEnum["PowerMeasurement"] = "power-measurement";
59
+ })(EnergyAppModelFeatureEnum || (exports.EnergyAppModelFeatureEnum = EnergyAppModelFeatureEnum = {}));
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Important capabilities a specific device model can support.
3
+ *
4
+ * Declared per model inside an Energy App package's compatibility section
5
+ * (see {@link EnergyAppPackageCompatibilityModel}) so the enyo Store and
6
+ * onboarding flows can surface accurate, model-level feature information to
7
+ * users. Values are grouped by device category for readability.
8
+ */
9
+ export declare enum EnergyAppModelFeatureEnum {
10
+ /** The battery can be charged from the grid (not only from PV surplus) */
11
+ BatteryChargingFromGrid = "battery-charging-from-grid",
12
+ /** The maximum charge power or target state of charge can be limited */
13
+ BatteryChargeLimitation = "battery-charge-limitation",
14
+ /** The maximum discharge power or minimum state of charge can be limited */
15
+ BatteryDischargeLimitation = "battery-discharge-limitation",
16
+ /** The PV feed-in power into the grid can be limited (curtailment) */
17
+ PvFeedInLimitation = "pv-feed-in-limitation",
18
+ /** The inverter active power output can be limited */
19
+ InverterPowerLimitation = "inverter-power-limitation",
20
+ /** Charging can be started and stopped remotely */
21
+ ChargingStartStop = "charging-start-stop",
22
+ /** The charging power (in Ampere or Watt) can be limited */
23
+ ChargingPowerLimitation = "charging-power-limitation",
24
+ /** The model supports switching between single- and three-phase charging */
25
+ ChargingPhaseSwitching = "charging-phase-switching",
26
+ /** The model supports charging from PV surplus */
27
+ PvSurplusCharging = "pv-surplus-charging",
28
+ /** Domestic hot water heating can be forced on demand (DHW boost) */
29
+ HeatpumpDhwBoost = "heatpump-dhw-boost",
30
+ /** The target temperature setpoint can be controlled */
31
+ HeatpumpTemperatureSetpoint = "heatpump-temperature-setpoint",
32
+ /** The heat pump output power can be modulated */
33
+ HeatpumpPowerModulation = "heatpump-power-modulation",
34
+ /** The model supports the SG Ready interface for smart-grid signalling */
35
+ HeatpumpSgReady = "heatpump-sg-ready",
36
+ /** The target temperature setpoint can be controlled */
37
+ ClimateTemperatureSetpoint = "climate-temperature-setpoint",
38
+ /** The operating mode (heat / cool / fan / off) can be controlled */
39
+ ClimateModeControl = "climate-mode-control",
40
+ /** The grid power (import / export) can be read out */
41
+ GridPowerReadout = "grid-power-readout",
42
+ /** The accumulated energy consumption can be read out */
43
+ EnergyConsumptionReadout = "energy-consumption-readout",
44
+ /** The plug can be switched on and off */
45
+ SwitchOnOff = "switch-on-off",
46
+ /** The plug can measure the connected load's power */
47
+ PowerMeasurement = "power-measurement"
48
+ }
@@ -1,4 +1,5 @@
1
1
  import { EnergyAppPermissionType } from "./energy-app-permission.type.cjs";
2
+ import { EnergyAppModelFeatureEnum } from "./energy-app-model-feature.enum.cjs";
2
3
  export type EnergyAppPackageLanguage = 'de' | 'en';
3
4
  export declare enum EnergyAppPackageCategory {
4
5
  Inverter = "inverter",
@@ -161,6 +162,13 @@ export interface EnergyAppPackageCompatibilityModel {
161
162
  minimumFirmwareVersion?: string;
162
163
  /** Optional internal note explaining model-specific caveats or limitations */
163
164
  internalComment?: string;
165
+ /**
166
+ * Important capabilities this specific model supports (e.g. charging the
167
+ * battery from grid, limiting the charge, or forcing a heat pump DHW boost).
168
+ * Lets the enyo Store and onboarding flows surface accurate, model-level
169
+ * feature information.
170
+ */
171
+ features: EnergyAppModelFeatureEnum[];
164
172
  }
165
173
  /**
166
174
  * A vendor and the list of its models supported by an Energy App package.
@@ -60,8 +60,14 @@ class EnergyApp {
60
60
  await callback();
61
61
  });
62
62
  }
63
- useFetch() {
64
- return this.energyAppSdk.useFetch();
63
+ /**
64
+ * Returns a `fetch` implementation provided by the runtime.
65
+ * @param options - Optional configuration (e.g. {@link TlsClientOptions} for mutual TLS).
66
+ * When `options.tls` is set the runtime binds a TLS-configured dispatcher to the fetch.
67
+ * @returns A `fetch` function that still passes through the runtime allow-list.
68
+ */
69
+ useFetch(options) {
70
+ return this.energyAppSdk.useFetch(options);
65
71
  }
66
72
  useInterval() {
67
73
  return this.energyAppSdk.useInterval();
@@ -37,6 +37,7 @@ import { EnergyAppGridConnectionPoint } from "./packages/energy-app-grid-connect
37
37
  import { EnergyAppConfigurationManager } from "./packages/energy-app-configuration-manager.cjs";
38
38
  import { EnergyAppApplianceEnergyManagerForecast } from "./packages/energy-app-appliance-energy-manager-forecast.cjs";
39
39
  import { EnergyAppBattery } from "./packages/energy-app-battery.cjs";
40
+ import { UseFetchOptions } from "./types/enyo-fetch.cjs";
40
41
  /**
41
42
  * Concrete implementation of {@link EnyoEnergyAppSdk} that delegates every call
42
43
  * to the runtime-provided `energyAppSdkInstance` global.
@@ -68,7 +69,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
68
69
  updateEnergyAppState(state: EnergyAppStateEnum): void;
69
70
  register(callback: (packageName: string, version: number, channel: EnyoPackageChannel, deviceId: string) => void | Promise<void>): void;
70
71
  onShutdown(callback: () => void | Promise<void>): void;
71
- useFetch(): typeof fetch;
72
+ /**
73
+ * Returns a `fetch` implementation provided by the runtime.
74
+ * @param options - Optional configuration (e.g. {@link TlsClientOptions} for mutual TLS).
75
+ * When `options.tls` is set the runtime binds a TLS-configured dispatcher to the fetch.
76
+ * @returns A `fetch` function that still passes through the runtime allow-list.
77
+ */
78
+ useFetch(options?: UseFetchOptions): typeof fetch;
72
79
  useInterval(): EnergyAppInterval;
73
80
  useModbus(): EnergyAppModbus;
74
81
  useNetworkDevices(): EnergyAppNetworkDevice;
@@ -36,6 +36,7 @@ import { EnergyAppGridConnectionPoint } from "./packages/energy-app-grid-connect
36
36
  import { EnergyAppConfigurationManager } from "./packages/energy-app-configuration-manager.cjs";
37
37
  import { EnergyAppApplianceEnergyManagerForecast } from "./packages/energy-app-appliance-energy-manager-forecast.cjs";
38
38
  import { EnergyAppBattery } from "./packages/energy-app-battery.cjs";
39
+ import { UseFetchOptions } from "./types/enyo-fetch.cjs";
39
40
  export declare enum EnergyAppStateEnum {
40
41
  Launching = "launching",
41
42
  Running = "running",
@@ -60,8 +61,8 @@ export interface EnyoEnergyAppSdk {
60
61
  isSystemOnline: () => boolean;
61
62
  /** Register a listener that gets called when the network status changes */
62
63
  onNetworkStatusChanged: (listener: (online: boolean) => void | Promise<void>) => string;
63
- /** Get the fetch API for HTTP requests */
64
- useFetch: () => typeof fetch;
64
+ /** Get the fetch API for HTTP requests, optionally configured with TLS options */
65
+ useFetch: (options?: UseFetchOptions) => typeof fetch;
65
66
  /** Get the interval management API */
66
67
  useInterval: () => EnergyAppInterval;
67
68
  /** Get the Modbus communication API */
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./energy-app.cjs"), exports);
18
18
  __exportStar(require("./energy-app-appliance-type.enum.cjs"), exports);
19
19
  __exportStar(require("./energy-app-package-definition.cjs"), exports);
20
+ __exportStar(require("./energy-app-model-feature.enum.cjs"), exports);
20
21
  __exportStar(require("./version.cjs"), exports);
21
22
  __exportStar(require("./implementations/ocpp/ocpp16.cjs"), exports);
22
23
  __exportStar(require("./implementations/ocpp/ocpp201.cjs"), exports);
@@ -101,3 +102,4 @@ __exportStar(require("./implementations/appliance-command-forecast/appliance-com
101
102
  __exportStar(require("./implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.cjs"), exports);
102
103
  __exportStar(require("./types/enyo-battery-state.cjs"), exports);
103
104
  __exportStar(require("./packages/energy-app-battery.cjs"), exports);
105
+ __exportStar(require("./types/enyo-fetch.cjs"), exports);
@@ -1,6 +1,7 @@
1
1
  export * from './energy-app.cjs';
2
2
  export * from './energy-app-appliance-type.enum.cjs';
3
3
  export * from './energy-app-package-definition.cjs';
4
+ export * from './energy-app-model-feature.enum.cjs';
4
5
  export * from './version.cjs';
5
6
  export * from './implementations/ocpp/ocpp16.cjs';
6
7
  export * from './implementations/ocpp/ocpp201.cjs';
@@ -85,3 +86,4 @@ export * from './implementations/appliance-command-forecast/appliance-command-fo
85
86
  export * from './implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.cjs';
86
87
  export * from './types/enyo-battery-state.cjs';
87
88
  export * from './packages/energy-app-battery.cjs';
89
+ export * from './types/enyo-fetch.cjs';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ /**
2
+ * TLS material for an outbound HTTPS connection made through {@link UseFetchOptions}.
3
+ *
4
+ * All certificate/key fields accept PEM as a UTF-8 string or a {@link Buffer}. When passed
5
+ * to `useFetch`, the runtime uses these values to build a TLS-configured dispatcher for the
6
+ * underlying fetch (e.g. for mutual TLS, custom trust anchors, or self-signed servers).
7
+ */
8
+ export interface TlsClientOptions {
9
+ /** Client cert chain (PEM) presented during the TLS handshake (mutual TLS). */
10
+ cert?: string | Buffer;
11
+ /** Private key (PEM) for the client cert. */
12
+ key?: string | Buffer;
13
+ /** Trusted CA cert(s) (PEM) to validate the server. */
14
+ ca?: string | Buffer | Array<string | Buffer>;
15
+ /** When false, accept self-signed/untrusted server certs. Default true. */
16
+ rejectUnauthorized?: boolean;
17
+ /** Optional SNI / expected server hostname override. */
18
+ servername?: string;
19
+ }
20
+ /**
21
+ * Options accepted by `useFetch` to customize the returned `fetch` implementation.
22
+ *
23
+ * The returned fetch still passes through the runtime's origin allow-list; these options only
24
+ * add behavior (currently: TLS configuration) on top of that.
25
+ */
26
+ export interface UseFetchOptions {
27
+ /** TLS / mutual-TLS configuration for outbound HTTPS requests. */
28
+ tls?: TlsClientOptions;
29
+ }
@@ -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.162';
12
+ exports.SDK_VERSION = '0.0.164';
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.162";
8
+ export declare const SDK_VERSION = "0.0.164";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Important capabilities a specific device model can support.
3
+ *
4
+ * Declared per model inside an Energy App package's compatibility section
5
+ * (see {@link EnergyAppPackageCompatibilityModel}) so the enyo Store and
6
+ * onboarding flows can surface accurate, model-level feature information to
7
+ * users. Values are grouped by device category for readability.
8
+ */
9
+ export declare enum EnergyAppModelFeatureEnum {
10
+ /** The battery can be charged from the grid (not only from PV surplus) */
11
+ BatteryChargingFromGrid = "battery-charging-from-grid",
12
+ /** The maximum charge power or target state of charge can be limited */
13
+ BatteryChargeLimitation = "battery-charge-limitation",
14
+ /** The maximum discharge power or minimum state of charge can be limited */
15
+ BatteryDischargeLimitation = "battery-discharge-limitation",
16
+ /** The PV feed-in power into the grid can be limited (curtailment) */
17
+ PvFeedInLimitation = "pv-feed-in-limitation",
18
+ /** The inverter active power output can be limited */
19
+ InverterPowerLimitation = "inverter-power-limitation",
20
+ /** Charging can be started and stopped remotely */
21
+ ChargingStartStop = "charging-start-stop",
22
+ /** The charging power (in Ampere or Watt) can be limited */
23
+ ChargingPowerLimitation = "charging-power-limitation",
24
+ /** The model supports switching between single- and three-phase charging */
25
+ ChargingPhaseSwitching = "charging-phase-switching",
26
+ /** The model supports charging from PV surplus */
27
+ PvSurplusCharging = "pv-surplus-charging",
28
+ /** Domestic hot water heating can be forced on demand (DHW boost) */
29
+ HeatpumpDhwBoost = "heatpump-dhw-boost",
30
+ /** The target temperature setpoint can be controlled */
31
+ HeatpumpTemperatureSetpoint = "heatpump-temperature-setpoint",
32
+ /** The heat pump output power can be modulated */
33
+ HeatpumpPowerModulation = "heatpump-power-modulation",
34
+ /** The model supports the SG Ready interface for smart-grid signalling */
35
+ HeatpumpSgReady = "heatpump-sg-ready",
36
+ /** The target temperature setpoint can be controlled */
37
+ ClimateTemperatureSetpoint = "climate-temperature-setpoint",
38
+ /** The operating mode (heat / cool / fan / off) can be controlled */
39
+ ClimateModeControl = "climate-mode-control",
40
+ /** The grid power (import / export) can be read out */
41
+ GridPowerReadout = "grid-power-readout",
42
+ /** The accumulated energy consumption can be read out */
43
+ EnergyConsumptionReadout = "energy-consumption-readout",
44
+ /** The plug can be switched on and off */
45
+ SwitchOnOff = "switch-on-off",
46
+ /** The plug can measure the connected load's power */
47
+ PowerMeasurement = "power-measurement"
48
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Important capabilities a specific device model can support.
3
+ *
4
+ * Declared per model inside an Energy App package's compatibility section
5
+ * (see {@link EnergyAppPackageCompatibilityModel}) so the enyo Store and
6
+ * onboarding flows can surface accurate, model-level feature information to
7
+ * users. Values are grouped by device category for readability.
8
+ */
9
+ export var EnergyAppModelFeatureEnum;
10
+ (function (EnergyAppModelFeatureEnum) {
11
+ // Battery / Storage
12
+ /** The battery can be charged from the grid (not only from PV surplus) */
13
+ EnergyAppModelFeatureEnum["BatteryChargingFromGrid"] = "battery-charging-from-grid";
14
+ /** The maximum charge power or target state of charge can be limited */
15
+ EnergyAppModelFeatureEnum["BatteryChargeLimitation"] = "battery-charge-limitation";
16
+ /** The maximum discharge power or minimum state of charge can be limited */
17
+ EnergyAppModelFeatureEnum["BatteryDischargeLimitation"] = "battery-discharge-limitation";
18
+ // Inverter / PV
19
+ /** The PV feed-in power into the grid can be limited (curtailment) */
20
+ EnergyAppModelFeatureEnum["PvFeedInLimitation"] = "pv-feed-in-limitation";
21
+ /** The inverter active power output can be limited */
22
+ EnergyAppModelFeatureEnum["InverterPowerLimitation"] = "inverter-power-limitation";
23
+ // Wallbox / Charging
24
+ /** Charging can be started and stopped remotely */
25
+ EnergyAppModelFeatureEnum["ChargingStartStop"] = "charging-start-stop";
26
+ /** The charging power (in Ampere or Watt) can be limited */
27
+ EnergyAppModelFeatureEnum["ChargingPowerLimitation"] = "charging-power-limitation";
28
+ /** The model supports switching between single- and three-phase charging */
29
+ EnergyAppModelFeatureEnum["ChargingPhaseSwitching"] = "charging-phase-switching";
30
+ /** The model supports charging from PV surplus */
31
+ EnergyAppModelFeatureEnum["PvSurplusCharging"] = "pv-surplus-charging";
32
+ // Heat Pump
33
+ /** Domestic hot water heating can be forced on demand (DHW boost) */
34
+ EnergyAppModelFeatureEnum["HeatpumpDhwBoost"] = "heatpump-dhw-boost";
35
+ /** The target temperature setpoint can be controlled */
36
+ EnergyAppModelFeatureEnum["HeatpumpTemperatureSetpoint"] = "heatpump-temperature-setpoint";
37
+ /** The heat pump output power can be modulated */
38
+ EnergyAppModelFeatureEnum["HeatpumpPowerModulation"] = "heatpump-power-modulation";
39
+ /** The model supports the SG Ready interface for smart-grid signalling */
40
+ EnergyAppModelFeatureEnum["HeatpumpSgReady"] = "heatpump-sg-ready";
41
+ // Climate Control / Air Conditioning
42
+ /** The target temperature setpoint can be controlled */
43
+ EnergyAppModelFeatureEnum["ClimateTemperatureSetpoint"] = "climate-temperature-setpoint";
44
+ /** The operating mode (heat / cool / fan / off) can be controlled */
45
+ EnergyAppModelFeatureEnum["ClimateModeControl"] = "climate-mode-control";
46
+ // Meter
47
+ /** The grid power (import / export) can be read out */
48
+ EnergyAppModelFeatureEnum["GridPowerReadout"] = "grid-power-readout";
49
+ /** The accumulated energy consumption can be read out */
50
+ EnergyAppModelFeatureEnum["EnergyConsumptionReadout"] = "energy-consumption-readout";
51
+ // Smart Plug
52
+ /** The plug can be switched on and off */
53
+ EnergyAppModelFeatureEnum["SwitchOnOff"] = "switch-on-off";
54
+ /** The plug can measure the connected load's power */
55
+ EnergyAppModelFeatureEnum["PowerMeasurement"] = "power-measurement";
56
+ })(EnergyAppModelFeatureEnum || (EnergyAppModelFeatureEnum = {}));
@@ -1,4 +1,5 @@
1
1
  import { EnergyAppPermissionType } from "./energy-app-permission.type.js";
2
+ import { EnergyAppModelFeatureEnum } from "./energy-app-model-feature.enum.js";
2
3
  export type EnergyAppPackageLanguage = 'de' | 'en';
3
4
  export declare enum EnergyAppPackageCategory {
4
5
  Inverter = "inverter",
@@ -161,6 +162,13 @@ export interface EnergyAppPackageCompatibilityModel {
161
162
  minimumFirmwareVersion?: string;
162
163
  /** Optional internal note explaining model-specific caveats or limitations */
163
164
  internalComment?: string;
165
+ /**
166
+ * Important capabilities this specific model supports (e.g. charging the
167
+ * battery from grid, limiting the charge, or forcing a heat pump DHW boost).
168
+ * Lets the enyo Store and onboarding flows surface accurate, model-level
169
+ * feature information.
170
+ */
171
+ features: EnergyAppModelFeatureEnum[];
164
172
  }
165
173
  /**
166
174
  * A vendor and the list of its models supported by an Energy App package.
@@ -37,6 +37,7 @@ import { EnergyAppGridConnectionPoint } from "./packages/energy-app-grid-connect
37
37
  import { EnergyAppConfigurationManager } from "./packages/energy-app-configuration-manager.js";
38
38
  import { EnergyAppApplianceEnergyManagerForecast } from "./packages/energy-app-appliance-energy-manager-forecast.js";
39
39
  import { EnergyAppBattery } from "./packages/energy-app-battery.js";
40
+ import { UseFetchOptions } from "./types/enyo-fetch.js";
40
41
  /**
41
42
  * Concrete implementation of {@link EnyoEnergyAppSdk} that delegates every call
42
43
  * to the runtime-provided `energyAppSdkInstance` global.
@@ -68,7 +69,13 @@ export declare class EnergyApp implements EnyoEnergyAppSdk {
68
69
  updateEnergyAppState(state: EnergyAppStateEnum): void;
69
70
  register(callback: (packageName: string, version: number, channel: EnyoPackageChannel, deviceId: string) => void | Promise<void>): void;
70
71
  onShutdown(callback: () => void | Promise<void>): void;
71
- useFetch(): typeof fetch;
72
+ /**
73
+ * Returns a `fetch` implementation provided by the runtime.
74
+ * @param options - Optional configuration (e.g. {@link TlsClientOptions} for mutual TLS).
75
+ * When `options.tls` is set the runtime binds a TLS-configured dispatcher to the fetch.
76
+ * @returns A `fetch` function that still passes through the runtime allow-list.
77
+ */
78
+ useFetch(options?: UseFetchOptions): typeof fetch;
72
79
  useInterval(): EnergyAppInterval;
73
80
  useModbus(): EnergyAppModbus;
74
81
  useNetworkDevices(): EnergyAppNetworkDevice;
@@ -57,8 +57,14 @@ export class EnergyApp {
57
57
  await callback();
58
58
  });
59
59
  }
60
- useFetch() {
61
- return this.energyAppSdk.useFetch();
60
+ /**
61
+ * Returns a `fetch` implementation provided by the runtime.
62
+ * @param options - Optional configuration (e.g. {@link TlsClientOptions} for mutual TLS).
63
+ * When `options.tls` is set the runtime binds a TLS-configured dispatcher to the fetch.
64
+ * @returns A `fetch` function that still passes through the runtime allow-list.
65
+ */
66
+ useFetch(options) {
67
+ return this.energyAppSdk.useFetch(options);
62
68
  }
63
69
  useInterval() {
64
70
  return this.energyAppSdk.useInterval();
@@ -36,6 +36,7 @@ import { EnergyAppGridConnectionPoint } from "./packages/energy-app-grid-connect
36
36
  import { EnergyAppConfigurationManager } from "./packages/energy-app-configuration-manager.js";
37
37
  import { EnergyAppApplianceEnergyManagerForecast } from "./packages/energy-app-appliance-energy-manager-forecast.js";
38
38
  import { EnergyAppBattery } from "./packages/energy-app-battery.js";
39
+ import { UseFetchOptions } from "./types/enyo-fetch.js";
39
40
  export declare enum EnergyAppStateEnum {
40
41
  Launching = "launching",
41
42
  Running = "running",
@@ -60,8 +61,8 @@ export interface EnyoEnergyAppSdk {
60
61
  isSystemOnline: () => boolean;
61
62
  /** Register a listener that gets called when the network status changes */
62
63
  onNetworkStatusChanged: (listener: (online: boolean) => void | Promise<void>) => string;
63
- /** Get the fetch API for HTTP requests */
64
- useFetch: () => typeof fetch;
64
+ /** Get the fetch API for HTTP requests, optionally configured with TLS options */
65
+ useFetch: (options?: UseFetchOptions) => typeof fetch;
65
66
  /** Get the interval management API */
66
67
  useInterval: () => EnergyAppInterval;
67
68
  /** Get the Modbus communication API */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './energy-app.js';
2
2
  export * from './energy-app-appliance-type.enum.js';
3
3
  export * from './energy-app-package-definition.js';
4
+ export * from './energy-app-model-feature.enum.js';
4
5
  export * from './version.js';
5
6
  export * from './implementations/ocpp/ocpp16.js';
6
7
  export * from './implementations/ocpp/ocpp201.js';
@@ -85,3 +86,4 @@ export * from './implementations/appliance-command-forecast/appliance-command-fo
85
86
  export * from './implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.js';
86
87
  export * from './types/enyo-battery-state.js';
87
88
  export * from './packages/energy-app-battery.js';
89
+ export * from './types/enyo-fetch.js';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './energy-app.js';
2
2
  export * from './energy-app-appliance-type.enum.js';
3
3
  export * from './energy-app-package-definition.js';
4
+ export * from './energy-app-model-feature.enum.js';
4
5
  export * from './version.js';
5
6
  export * from './implementations/ocpp/ocpp16.js';
6
7
  export * from './implementations/ocpp/ocpp201.js';
@@ -85,3 +86,4 @@ export * from './implementations/appliance-command-forecast/appliance-command-fo
85
86
  export * from './implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.js';
86
87
  export * from './types/enyo-battery-state.js';
87
88
  export * from './packages/energy-app-battery.js';
89
+ export * from './types/enyo-fetch.js';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * TLS material for an outbound HTTPS connection made through {@link UseFetchOptions}.
3
+ *
4
+ * All certificate/key fields accept PEM as a UTF-8 string or a {@link Buffer}. When passed
5
+ * to `useFetch`, the runtime uses these values to build a TLS-configured dispatcher for the
6
+ * underlying fetch (e.g. for mutual TLS, custom trust anchors, or self-signed servers).
7
+ */
8
+ export interface TlsClientOptions {
9
+ /** Client cert chain (PEM) presented during the TLS handshake (mutual TLS). */
10
+ cert?: string | Buffer;
11
+ /** Private key (PEM) for the client cert. */
12
+ key?: string | Buffer;
13
+ /** Trusted CA cert(s) (PEM) to validate the server. */
14
+ ca?: string | Buffer | Array<string | Buffer>;
15
+ /** When false, accept self-signed/untrusted server certs. Default true. */
16
+ rejectUnauthorized?: boolean;
17
+ /** Optional SNI / expected server hostname override. */
18
+ servername?: string;
19
+ }
20
+ /**
21
+ * Options accepted by `useFetch` to customize the returned `fetch` implementation.
22
+ *
23
+ * The returned fetch still passes through the runtime's origin allow-list; these options only
24
+ * add behavior (currently: TLS configuration) on top of that.
25
+ */
26
+ export interface UseFetchOptions {
27
+ /** TLS / mutual-TLS configuration for outbound HTTPS requests. */
28
+ tls?: TlsClientOptions;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
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.162";
8
+ export declare const SDK_VERSION = "0.0.164";
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.162';
8
+ export const SDK_VERSION = '0.0.164';
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.162",
3
+ "version": "0.0.164",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",