@enyo-energy/energy-app-sdk 0.0.199 → 1.0.0

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.
@@ -147,6 +147,7 @@ function validateOnboardingGuideV2(guide, context) {
147
147
  `"${enyo_onboarding_v2_js_1.EnyoOnboardingV2PauseReason.EnyoTodo}" when enyo takes the setup over.`);
148
148
  }
149
149
  validateNetworkScanFlag(guide, warnings);
150
+ validateApplianceBinding(guide, errors, warnings);
150
151
  return { ok: errors.length === 0, errors, warnings };
151
152
  }
152
153
  /**
@@ -645,6 +646,41 @@ function validateAdditionalSetupBlocks(step, at, errors, warnings) {
645
646
  }
646
647
  }
647
648
  }
649
+ /**
650
+ * Checks {@link EnyoOnboardingV2Guide.applianceId} against the guide's
651
+ * {@link EnyoOnboardingV2Guide.startVariant}.
652
+ *
653
+ * The binding is required on {@link EnyoOnboardingV2StartVariant.Maintenance}
654
+ * and meaningless everywhere else. A maintenance run services an appliance that
655
+ * already exists, so a guide that does not name one cannot be bound to anything
656
+ * — that is a blocking error, not advice. The reverse is only a warning: an
657
+ * installation guide carrying an appliance id is harmless, the host ignores it,
658
+ * but it is a sign the wrong variant was chosen.
659
+ *
660
+ * @param guide - The guide being validated.
661
+ * @param errors - Collector for blocking problems.
662
+ * @param warnings - Collector for advisory problems.
663
+ */
664
+ function validateApplianceBinding(guide, errors, warnings) {
665
+ const isMaintenance = guide.startVariant === enyo_onboarding_v2_js_1.EnyoOnboardingV2StartVariant.Maintenance;
666
+ const applianceId = typeof guide.applianceId === 'string' ? guide.applianceId.trim() : undefined;
667
+ if (isMaintenance) {
668
+ if (!applianceId) {
669
+ errors.push('`applianceId` is required on a `' +
670
+ `${enyo_onboarding_v2_js_1.EnyoOnboardingV2StartVariant.Maintenance}` +
671
+ '` guide — a maintenance run services an appliance that already exists, so the ' +
672
+ 'guide must name it.');
673
+ }
674
+ return;
675
+ }
676
+ if (applianceId) {
677
+ warnings.push('`applianceId` is set on a `' +
678
+ `${guide.startVariant}` +
679
+ '` guide and is ignored — only a `' +
680
+ `${enyo_onboarding_v2_js_1.EnyoOnboardingV2StartVariant.Maintenance}` +
681
+ '` guide binds an existing appliance.');
682
+ }
683
+ }
648
684
  /**
649
685
  * Checks {@link EnyoOnboardingV2Guide.requiresNetworkScan} against what the guide
650
686
  * actually does.
@@ -39,6 +39,27 @@ var EnyoOnboardingV2StartVariant;
39
39
  EnyoOnboardingV2StartVariant["DeviceFoundConfig"] = "device-found-config";
40
40
  /** Manual setup is required by the user (e.g. enter OCPP URL). */
41
41
  EnyoOnboardingV2StartVariant["ManualSetup"] = "manual-setup";
42
+ /**
43
+ * Maintenance on an appliance that already exists — the only variant that
44
+ * does not start from an installation.
45
+ *
46
+ * The other three all describe a device on its way *into* the system: not
47
+ * found yet, found but unconfigured, or set up by hand. This one starts from
48
+ * the opposite situation — the appliance is installed, known and running,
49
+ * and the installer is coming back to it to service, reconfigure or
50
+ * reconnect it.
51
+ *
52
+ * Because the appliance is the subject of the run rather than its result, a
53
+ * maintenance guide MUST name it: see
54
+ * {@link EnyoOnboardingV2Guide.applianceId}, which
55
+ * {@link validateOnboardingGuideV2} requires on this variant and on no
56
+ * other. That binding is what fills the `applianceId` the host passes to
57
+ * {@link EnyoOnboardingV2DynamicRequest} and
58
+ * {@link EnyoOnboardingV2AdditionalSetupRequest} — on an installation
59
+ * variant those are populated only once an appliance happens to exist,
60
+ * whereas here they are known from the first step.
61
+ */
62
+ EnyoOnboardingV2StartVariant["Maintenance"] = "maintenance";
42
63
  })(EnyoOnboardingV2StartVariant || (exports.EnyoOnboardingV2StartVariant = EnyoOnboardingV2StartVariant = {}));
43
64
  /**
44
65
  * Why an onboarding run left the flow through a {@link EnyoOnboardingV2TargetType.Pause}
@@ -32,7 +32,28 @@ export declare enum EnyoOnboardingV2StartVariant {
32
32
  /** The device is on the network but still needs configuration. */
33
33
  DeviceFoundConfig = "device-found-config",
34
34
  /** Manual setup is required by the user (e.g. enter OCPP URL). */
35
- ManualSetup = "manual-setup"
35
+ ManualSetup = "manual-setup",
36
+ /**
37
+ * Maintenance on an appliance that already exists — the only variant that
38
+ * does not start from an installation.
39
+ *
40
+ * The other three all describe a device on its way *into* the system: not
41
+ * found yet, found but unconfigured, or set up by hand. This one starts from
42
+ * the opposite situation — the appliance is installed, known and running,
43
+ * and the installer is coming back to it to service, reconfigure or
44
+ * reconnect it.
45
+ *
46
+ * Because the appliance is the subject of the run rather than its result, a
47
+ * maintenance guide MUST name it: see
48
+ * {@link EnyoOnboardingV2Guide.applianceId}, which
49
+ * {@link validateOnboardingGuideV2} requires on this variant and on no
50
+ * other. That binding is what fills the `applianceId` the host passes to
51
+ * {@link EnyoOnboardingV2DynamicRequest} and
52
+ * {@link EnyoOnboardingV2AdditionalSetupRequest} — on an installation
53
+ * variant those are populated only once an appliance happens to exist,
54
+ * whereas here they are known from the first step.
55
+ */
56
+ Maintenance = "maintenance"
36
57
  }
37
58
  /**
38
59
  * Why an onboarding run left the flow through a {@link EnyoOnboardingV2TargetType.Pause}
@@ -863,6 +884,25 @@ export interface EnyoOnboardingV2Guide {
863
884
  startStepId: string;
864
885
  /** The graph nodes (a set, not an ordered list). */
865
886
  steps: EnyoOnboardingV2Step[];
887
+ /**
888
+ * The appliance this guide is bound to — **required on**
889
+ * {@link EnyoOnboardingV2StartVariant.Maintenance}, and meaningless on every
890
+ * other variant.
891
+ *
892
+ * A maintenance run services an appliance that already exists, so the
893
+ * appliance is an input to the run rather than something it produces: the
894
+ * host binds the run to this id and passes it on as
895
+ * {@link EnyoOnboardingV2DynamicRequest.applianceId} and
896
+ * {@link EnyoOnboardingV2AdditionalSetupRequest.applianceId} from the first
897
+ * step onwards. The installation variants have nothing to bind — their
898
+ * appliance is created by the run, if it is created at all — and a guide
899
+ * that sets this anyway is warned about and the value ignored.
900
+ *
901
+ * Optional in the type because one interface serves all four variants; the
902
+ * variant-dependent requirement is enforced by
903
+ * {@link validateOnboardingGuideV2} instead of by the compiler.
904
+ */
905
+ applianceId?: string;
866
906
  /** Optional vendor binding (catalog id). Usually set at publish time. */
867
907
  vendorId?: string;
868
908
  /** Optional model bindings (catalog ids). Usually set at publish time. */
@@ -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.199';
12
+ exports.SDK_VERSION = '1.0.0';
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.199";
8
+ export declare const SDK_VERSION = "1.0.0";
9
9
  /**
10
10
  * Gets the current SDK version.
11
11
  * @returns The semantic version string of the SDK
@@ -13,7 +13,7 @@
13
13
  * {@link EnyoOnboardingV2PauseReason.EnyoTodo}) — both count, so a guide that
14
14
  * legitimately ends in a hand-off is not nagged about a missing success path.
15
15
  */
16
- import { EnyoOnboardingV2ActionKind, EnyoOnboardingV2EebusPairOutcome, EnyoOnboardingV2BlockType, EnyoOnboardingV2DeviceSelection, EnyoOnboardingV2SetupFieldType, EnyoOnboardingV2InputValueType, EnyoOnboardingV2OcppConnectOutcome, EnyoOnboardingV2PauseReason, EnyoOnboardingV2TargetType, EnyoOnboardingV2TransitionSourceKind, } from '../../types/enyo-onboarding-v2.js';
16
+ import { EnyoOnboardingV2ActionKind, EnyoOnboardingV2EebusPairOutcome, EnyoOnboardingV2BlockType, EnyoOnboardingV2DeviceSelection, EnyoOnboardingV2SetupFieldType, EnyoOnboardingV2InputValueType, EnyoOnboardingV2OcppConnectOutcome, EnyoOnboardingV2PauseReason, EnyoOnboardingV2StartVariant, EnyoOnboardingV2TargetType, EnyoOnboardingV2TransitionSourceKind, } from '../../types/enyo-onboarding-v2.js';
17
17
  import { EnyoDeviceTestOutcomeEnum } from '../../types/enyo-device-test.js';
18
18
  import { ENYO_ONBOARDING_V2_SETUP_FAILED_OUTCOME } from '../../types/enyo-onboarding-v2-additional-setup.js';
19
19
  import { isImagePublicFile } from '../files/public-file-validators.js';
@@ -141,6 +141,7 @@ export function validateOnboardingGuideV2(guide, context) {
141
141
  `"${EnyoOnboardingV2PauseReason.EnyoTodo}" when enyo takes the setup over.`);
142
142
  }
143
143
  validateNetworkScanFlag(guide, warnings);
144
+ validateApplianceBinding(guide, errors, warnings);
144
145
  return { ok: errors.length === 0, errors, warnings };
145
146
  }
146
147
  /**
@@ -639,6 +640,41 @@ function validateAdditionalSetupBlocks(step, at, errors, warnings) {
639
640
  }
640
641
  }
641
642
  }
643
+ /**
644
+ * Checks {@link EnyoOnboardingV2Guide.applianceId} against the guide's
645
+ * {@link EnyoOnboardingV2Guide.startVariant}.
646
+ *
647
+ * The binding is required on {@link EnyoOnboardingV2StartVariant.Maintenance}
648
+ * and meaningless everywhere else. A maintenance run services an appliance that
649
+ * already exists, so a guide that does not name one cannot be bound to anything
650
+ * — that is a blocking error, not advice. The reverse is only a warning: an
651
+ * installation guide carrying an appliance id is harmless, the host ignores it,
652
+ * but it is a sign the wrong variant was chosen.
653
+ *
654
+ * @param guide - The guide being validated.
655
+ * @param errors - Collector for blocking problems.
656
+ * @param warnings - Collector for advisory problems.
657
+ */
658
+ function validateApplianceBinding(guide, errors, warnings) {
659
+ const isMaintenance = guide.startVariant === EnyoOnboardingV2StartVariant.Maintenance;
660
+ const applianceId = typeof guide.applianceId === 'string' ? guide.applianceId.trim() : undefined;
661
+ if (isMaintenance) {
662
+ if (!applianceId) {
663
+ errors.push('`applianceId` is required on a `' +
664
+ `${EnyoOnboardingV2StartVariant.Maintenance}` +
665
+ '` guide — a maintenance run services an appliance that already exists, so the ' +
666
+ 'guide must name it.');
667
+ }
668
+ return;
669
+ }
670
+ if (applianceId) {
671
+ warnings.push('`applianceId` is set on a `' +
672
+ `${guide.startVariant}` +
673
+ '` guide and is ignored — only a `' +
674
+ `${EnyoOnboardingV2StartVariant.Maintenance}` +
675
+ '` guide binds an existing appliance.');
676
+ }
677
+ }
642
678
  /**
643
679
  * Checks {@link EnyoOnboardingV2Guide.requiresNetworkScan} against what the guide
644
680
  * actually does.
@@ -32,7 +32,28 @@ export declare enum EnyoOnboardingV2StartVariant {
32
32
  /** The device is on the network but still needs configuration. */
33
33
  DeviceFoundConfig = "device-found-config",
34
34
  /** Manual setup is required by the user (e.g. enter OCPP URL). */
35
- ManualSetup = "manual-setup"
35
+ ManualSetup = "manual-setup",
36
+ /**
37
+ * Maintenance on an appliance that already exists — the only variant that
38
+ * does not start from an installation.
39
+ *
40
+ * The other three all describe a device on its way *into* the system: not
41
+ * found yet, found but unconfigured, or set up by hand. This one starts from
42
+ * the opposite situation — the appliance is installed, known and running,
43
+ * and the installer is coming back to it to service, reconfigure or
44
+ * reconnect it.
45
+ *
46
+ * Because the appliance is the subject of the run rather than its result, a
47
+ * maintenance guide MUST name it: see
48
+ * {@link EnyoOnboardingV2Guide.applianceId}, which
49
+ * {@link validateOnboardingGuideV2} requires on this variant and on no
50
+ * other. That binding is what fills the `applianceId` the host passes to
51
+ * {@link EnyoOnboardingV2DynamicRequest} and
52
+ * {@link EnyoOnboardingV2AdditionalSetupRequest} — on an installation
53
+ * variant those are populated only once an appliance happens to exist,
54
+ * whereas here they are known from the first step.
55
+ */
56
+ Maintenance = "maintenance"
36
57
  }
37
58
  /**
38
59
  * Why an onboarding run left the flow through a {@link EnyoOnboardingV2TargetType.Pause}
@@ -863,6 +884,25 @@ export interface EnyoOnboardingV2Guide {
863
884
  startStepId: string;
864
885
  /** The graph nodes (a set, not an ordered list). */
865
886
  steps: EnyoOnboardingV2Step[];
887
+ /**
888
+ * The appliance this guide is bound to — **required on**
889
+ * {@link EnyoOnboardingV2StartVariant.Maintenance}, and meaningless on every
890
+ * other variant.
891
+ *
892
+ * A maintenance run services an appliance that already exists, so the
893
+ * appliance is an input to the run rather than something it produces: the
894
+ * host binds the run to this id and passes it on as
895
+ * {@link EnyoOnboardingV2DynamicRequest.applianceId} and
896
+ * {@link EnyoOnboardingV2AdditionalSetupRequest.applianceId} from the first
897
+ * step onwards. The installation variants have nothing to bind — their
898
+ * appliance is created by the run, if it is created at all — and a guide
899
+ * that sets this anyway is warned about and the value ignored.
900
+ *
901
+ * Optional in the type because one interface serves all four variants; the
902
+ * variant-dependent requirement is enforced by
903
+ * {@link validateOnboardingGuideV2} instead of by the compiler.
904
+ */
905
+ applianceId?: string;
866
906
  /** Optional vendor binding (catalog id). Usually set at publish time. */
867
907
  vendorId?: string;
868
908
  /** Optional model bindings (catalog ids). Usually set at publish time. */
@@ -36,6 +36,27 @@ export var EnyoOnboardingV2StartVariant;
36
36
  EnyoOnboardingV2StartVariant["DeviceFoundConfig"] = "device-found-config";
37
37
  /** Manual setup is required by the user (e.g. enter OCPP URL). */
38
38
  EnyoOnboardingV2StartVariant["ManualSetup"] = "manual-setup";
39
+ /**
40
+ * Maintenance on an appliance that already exists — the only variant that
41
+ * does not start from an installation.
42
+ *
43
+ * The other three all describe a device on its way *into* the system: not
44
+ * found yet, found but unconfigured, or set up by hand. This one starts from
45
+ * the opposite situation — the appliance is installed, known and running,
46
+ * and the installer is coming back to it to service, reconfigure or
47
+ * reconnect it.
48
+ *
49
+ * Because the appliance is the subject of the run rather than its result, a
50
+ * maintenance guide MUST name it: see
51
+ * {@link EnyoOnboardingV2Guide.applianceId}, which
52
+ * {@link validateOnboardingGuideV2} requires on this variant and on no
53
+ * other. That binding is what fills the `applianceId` the host passes to
54
+ * {@link EnyoOnboardingV2DynamicRequest} and
55
+ * {@link EnyoOnboardingV2AdditionalSetupRequest} — on an installation
56
+ * variant those are populated only once an appliance happens to exist,
57
+ * whereas here they are known from the first step.
58
+ */
59
+ EnyoOnboardingV2StartVariant["Maintenance"] = "maintenance";
39
60
  })(EnyoOnboardingV2StartVariant || (EnyoOnboardingV2StartVariant = {}));
40
61
  /**
41
62
  * Why an onboarding run left the flow through a {@link EnyoOnboardingV2TargetType.Pause}
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.199";
8
+ export declare const SDK_VERSION = "1.0.0";
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.199';
8
+ export const SDK_VERSION = '1.0.0';
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.199",
3
+ "version": "1.0.0",
4
4
  "description": "enyo Energy App SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",