@enyo-energy/energy-app-sdk 0.0.35 → 0.0.37
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/README.md +3 -17
- package/dist/cjs/packages/energy-app-authentication.d.cts +2 -2
- package/dist/cjs/types/enyo-authentication.d.cts +1 -2
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/packages/energy-app-authentication.d.ts +2 -2
- package/dist/types/enyo-authentication.d.ts +1 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -42,21 +42,7 @@ npm install @enyo-energy/energy-app-sdk
|
|
|
42
42
|
Create a basic Energy App that responds to system events:
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
|
-
import { EnergyApp, defineEnergyAppPackage, EnergyAppPackageCategory } from '@enyo-energy/energy-app-sdk';
|
|
46
|
-
|
|
47
|
-
// Define your package
|
|
48
|
-
const packageDefinition = defineEnergyAppPackage({
|
|
49
|
-
version: '1',
|
|
50
|
-
packageName: 'my-energy-app',
|
|
51
|
-
categories: [EnergyAppPackageCategory.EnergyManagement],
|
|
52
|
-
storeEntry: [{
|
|
53
|
-
language: 'en',
|
|
54
|
-
title: 'My Energy App',
|
|
55
|
-
shortDescription: 'A simple energy management app',
|
|
56
|
-
description: 'This app demonstrates basic energy management capabilities'
|
|
57
|
-
}],
|
|
58
|
-
permissions: ['Storage', 'SendDataBusValues']
|
|
59
|
-
});
|
|
45
|
+
import { EnergyApp, defineEnergyAppPackage, EnergyAppPackageCategory, EnergyAppStateEnum } from '@enyo-energy/energy-app-sdk';
|
|
60
46
|
|
|
61
47
|
// Initialize the Energy App
|
|
62
48
|
const energyApp = new EnergyApp();
|
|
@@ -66,7 +52,7 @@ energyApp.register((packageName: string, version: number) => {
|
|
|
66
52
|
console.log(`System is ${energyApp.isSystemOnline() ? 'online' : 'offline'}`);
|
|
67
53
|
|
|
68
54
|
// Set app state to running
|
|
69
|
-
energyApp.updateEnergyAppState(
|
|
55
|
+
energyApp.updateEnergyAppState(EnergyAppStateEnum.Running);
|
|
70
56
|
|
|
71
57
|
// Your app logic starts here
|
|
72
58
|
startApp();
|
|
@@ -104,7 +90,7 @@ const energyApp = new EnergyApp();
|
|
|
104
90
|
// Register startup callback
|
|
105
91
|
energyApp.register((packageName, version) => {
|
|
106
92
|
console.log(`${packageName} v${version} started`);
|
|
107
|
-
energyApp.updateEnergyAppState(
|
|
93
|
+
energyApp.updateEnergyAppState(EnergyAppStateEnum.Running);
|
|
108
94
|
});
|
|
109
95
|
|
|
110
96
|
// Register shutdown callback
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnyoAuthenticateState, EnyoAuthentication, EnyoAuthenticationResponse,
|
|
1
|
+
import { EnyoAuthenticateState, EnyoAuthentication, EnyoAuthenticationResponse, EnyoOauthAuthenticationStart, EnyoOauthAuthenticationRedirectUrlResponse } from "../types/enyo-authentication.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for requesting user authentication for appliances or the entire package.
|
|
4
4
|
* Provides methods to handle authentication requests, listen for responses, and manage authentication state.
|
|
@@ -15,7 +15,7 @@ export interface EnergyAppAuthentication {
|
|
|
15
15
|
/**
|
|
16
16
|
* If you use oauth with clientIdName and clientSecretName, you need to listen to this and respond with the redirect url
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
listenForOauthStart(listener: (response: EnyoOauthAuthenticationStart) => Promise<EnyoOauthAuthenticationRedirectUrlResponse>): string;
|
|
19
19
|
/**
|
|
20
20
|
* Adds a listener for authentication responses.
|
|
21
21
|
* The listener will be called when the user completes the authentication process.
|
|
@@ -18,9 +18,8 @@ export interface EnyoOauthAuthentication {
|
|
|
18
18
|
/** If the client id and client secret need to be provided by the user*/
|
|
19
19
|
clientIdName?: EnyoPackageConfigurationTranslatedValue[];
|
|
20
20
|
clientSecretName?: EnyoPackageConfigurationTranslatedValue[];
|
|
21
|
-
redirectUrl?: string;
|
|
22
21
|
}
|
|
23
|
-
export interface
|
|
22
|
+
export interface EnyoOauthAuthenticationStart {
|
|
24
23
|
clientId?: string;
|
|
25
24
|
clientSecret?: string;
|
|
26
25
|
}
|
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.37';
|
|
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
|
-
import { EnyoAuthenticateState, EnyoAuthentication, EnyoAuthenticationResponse,
|
|
1
|
+
import { EnyoAuthenticateState, EnyoAuthentication, EnyoAuthenticationResponse, EnyoOauthAuthenticationStart, EnyoOauthAuthenticationRedirectUrlResponse } from "../types/enyo-authentication.js";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for requesting user authentication for appliances or the entire package.
|
|
4
4
|
* Provides methods to handle authentication requests, listen for responses, and manage authentication state.
|
|
@@ -15,7 +15,7 @@ export interface EnergyAppAuthentication {
|
|
|
15
15
|
/**
|
|
16
16
|
* If you use oauth with clientIdName and clientSecretName, you need to listen to this and respond with the redirect url
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
listenForOauthStart(listener: (response: EnyoOauthAuthenticationStart) => Promise<EnyoOauthAuthenticationRedirectUrlResponse>): string;
|
|
19
19
|
/**
|
|
20
20
|
* Adds a listener for authentication responses.
|
|
21
21
|
* The listener will be called when the user completes the authentication process.
|
|
@@ -18,9 +18,8 @@ export interface EnyoOauthAuthentication {
|
|
|
18
18
|
/** If the client id and client secret need to be provided by the user*/
|
|
19
19
|
clientIdName?: EnyoPackageConfigurationTranslatedValue[];
|
|
20
20
|
clientSecretName?: EnyoPackageConfigurationTranslatedValue[];
|
|
21
|
-
redirectUrl?: string;
|
|
22
21
|
}
|
|
23
|
-
export interface
|
|
22
|
+
export interface EnyoOauthAuthenticationStart {
|
|
24
23
|
clientId?: string;
|
|
25
24
|
clientSecret?: string;
|
|
26
25
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enyo-energy/energy-app-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "enyo Energy App SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"publishConfig": {
|
|
18
|
-
"access": "
|
|
18
|
+
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|