@enyo-energy/energy-app-sdk 0.0.163 → 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.
- package/dist/cjs/energy-app.cjs +8 -2
- package/dist/cjs/energy-app.d.cts +8 -1
- package/dist/cjs/enyo-energy-app-sdk.d.cts +3 -2
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/types/enyo-fetch.cjs +2 -0
- package/dist/cjs/types/enyo-fetch.d.cts +29 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/energy-app.d.ts +8 -1
- package/dist/energy-app.js +8 -2
- package/dist/enyo-energy-app-sdk.d.ts +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/enyo-fetch.d.ts +29 -0
- package/dist/types/enyo-fetch.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/cjs/energy-app.cjs
CHANGED
|
@@ -60,8 +60,14 @@ class EnergyApp {
|
|
|
60
60
|
await callback();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
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 */
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -102,3 +102,4 @@ __exportStar(require("./implementations/appliance-command-forecast/appliance-com
|
|
|
102
102
|
__exportStar(require("./implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.cjs"), exports);
|
|
103
103
|
__exportStar(require("./types/enyo-battery-state.cjs"), exports);
|
|
104
104
|
__exportStar(require("./packages/energy-app-battery.cjs"), exports);
|
|
105
|
+
__exportStar(require("./types/enyo-fetch.cjs"), exports);
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -86,3 +86,4 @@ export * from './implementations/appliance-command-forecast/appliance-command-fo
|
|
|
86
86
|
export * from './implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.cjs';
|
|
87
87
|
export * from './types/enyo-battery-state.cjs';
|
|
88
88
|
export * from './packages/energy-app-battery.cjs';
|
|
89
|
+
export * from './types/enyo-fetch.cjs';
|
|
@@ -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
|
+
}
|
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.164';
|
|
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
package/dist/energy-app.d.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/dist/energy-app.js
CHANGED
|
@@ -57,8 +57,14 @@ export class EnergyApp {
|
|
|
57
57
|
await callback();
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
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
|
@@ -86,3 +86,4 @@ export * from './implementations/appliance-command-forecast/appliance-command-fo
|
|
|
86
86
|
export * from './implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.js';
|
|
87
87
|
export * from './types/enyo-battery-state.js';
|
|
88
88
|
export * from './packages/energy-app-battery.js';
|
|
89
|
+
export * from './types/enyo-fetch.js';
|
package/dist/index.js
CHANGED
|
@@ -86,3 +86,4 @@ export * from './implementations/appliance-command-forecast/appliance-command-fo
|
|
|
86
86
|
export * from './implementations/energy-manager-diagnostics/energy-manager-diagnostics-validators.js';
|
|
87
87
|
export * from './types/enyo-battery-state.js';
|
|
88
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
package/dist/version.js
CHANGED