@sprucelabs/heartwood-view-controllers 118.3.2 → 119.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.
@@ -8,6 +8,7 @@ export default class SpyDevice implements Device {
8
8
  lastCommandPayload?: Record<string, any>;
9
9
  allCommands: TrackedCommand[];
10
10
  private kioskSettings;
11
+ private brightness;
11
12
  setCachedValue(key: string, value: CachedValue): void;
12
13
  openUrl(url: string): void;
13
14
  getCachedValue(key: string): CachedValue;
@@ -16,6 +17,9 @@ export default class SpyDevice implements Device {
16
17
  sendCommand(command: string, payload?: Record<string, any>): void;
17
18
  setTheatreSetting<N extends TheatreSettingName>(name: N, value: TheaterSettingValueTypes[N]): void;
18
19
  getTheatreSetting<N extends TheatreSettingName>(name: N): Promise<TheaterSettingValueTypes[N] | null>;
20
+ turnTorchOn(brightness?: number): void;
21
+ getTorchBrightness(): number;
22
+ turnTorchOff(): void;
19
23
  }
20
24
  interface TrackedCommand {
21
25
  command: string;
@@ -7,12 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { SchemaError } from '@sprucelabs/schema';
10
11
  export default class SpyDevice {
11
12
  constructor() {
12
13
  this.vibrateCount = 0;
13
14
  this.cachedValues = {};
14
15
  this.allCommands = [];
15
16
  this.kioskSettings = {};
17
+ this.brightness = 0;
16
18
  }
17
19
  setCachedValue(key, value) {
18
20
  this.cachedValues[key] = value;
@@ -43,4 +45,20 @@ export default class SpyDevice {
43
45
  return ((_a = this.kioskSettings[name]) !== null && _a !== void 0 ? _a : null);
44
46
  });
45
47
  }
48
+ turnTorchOn(brightness) {
49
+ if (brightness && (brightness > 1 || brightness < 0)) {
50
+ throw new SchemaError({
51
+ code: 'INVALID_PARAMETERS',
52
+ parameters: ['brightness'],
53
+ friendlyMessage: 'Brightness on your torch must be between 0 and 1',
54
+ });
55
+ }
56
+ this.brightness = brightness !== null && brightness !== void 0 ? brightness : 1;
57
+ }
58
+ getTorchBrightness() {
59
+ return this.brightness;
60
+ }
61
+ turnTorchOff() {
62
+ this.brightness = 0;
63
+ }
46
64
  }
@@ -550,6 +550,8 @@ export interface Device {
550
550
  setCachedValue(key: string, value: CachedValue): void;
551
551
  getCachedValue(key: string): CachedValue;
552
552
  sendCommand(command: string, payload?: Record<string, any>): void;
553
+ turnTorchOn(brightness?: number): void;
554
+ turnTorchOff(): void;
553
555
  setTheatreSetting<N extends TheatreSettingName>(name: N, value: TheaterSettingValueTypes[N]): void;
554
556
  getTheatreSetting<N extends TheatreSettingName>(name: N): Promise<TheaterSettingValueTypes[N] | null>;
555
557
  }
@@ -8,6 +8,7 @@ export default class SpyDevice implements Device {
8
8
  lastCommandPayload?: Record<string, any>;
9
9
  allCommands: TrackedCommand[];
10
10
  private kioskSettings;
11
+ private brightness;
11
12
  setCachedValue(key: string, value: CachedValue): void;
12
13
  openUrl(url: string): void;
13
14
  getCachedValue(key: string): CachedValue;
@@ -16,6 +17,9 @@ export default class SpyDevice implements Device {
16
17
  sendCommand(command: string, payload?: Record<string, any>): void;
17
18
  setTheatreSetting<N extends TheatreSettingName>(name: N, value: TheaterSettingValueTypes[N]): void;
18
19
  getTheatreSetting<N extends TheatreSettingName>(name: N): Promise<TheaterSettingValueTypes[N] | null>;
20
+ turnTorchOn(brightness?: number): void;
21
+ getTorchBrightness(): number;
22
+ turnTorchOff(): void;
19
23
  }
20
24
  interface TrackedCommand {
21
25
  command: string;
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
3
4
  class SpyDevice {
4
5
  constructor() {
5
6
  this.vibrateCount = 0;
6
7
  this.cachedValues = {};
7
8
  this.allCommands = [];
8
9
  this.kioskSettings = {};
10
+ this.brightness = 0;
9
11
  }
10
12
  setCachedValue(key, value) {
11
13
  this.cachedValues[key] = value;
@@ -34,5 +36,21 @@ class SpyDevice {
34
36
  return (this.kioskSettings[name] ??
35
37
  null);
36
38
  }
39
+ turnTorchOn(brightness) {
40
+ if (brightness && (brightness > 1 || brightness < 0)) {
41
+ throw new schema_1.SchemaError({
42
+ code: 'INVALID_PARAMETERS',
43
+ parameters: ['brightness'],
44
+ friendlyMessage: 'Brightness on your torch must be between 0 and 1',
45
+ });
46
+ }
47
+ this.brightness = brightness ?? 1;
48
+ }
49
+ getTorchBrightness() {
50
+ return this.brightness;
51
+ }
52
+ turnTorchOff() {
53
+ this.brightness = 0;
54
+ }
37
55
  }
38
56
  exports.default = SpyDevice;
@@ -550,6 +550,8 @@ export interface Device {
550
550
  setCachedValue(key: string, value: CachedValue): void;
551
551
  getCachedValue(key: string): CachedValue;
552
552
  sendCommand(command: string, payload?: Record<string, any>): void;
553
+ turnTorchOn(brightness?: number): void;
554
+ turnTorchOff(): void;
553
555
  setTheatreSetting<N extends TheatreSettingName>(name: N, value: TheaterSettingValueTypes[N]): void;
554
556
  getTheatreSetting<N extends TheatreSettingName>(name: N): Promise<TheaterSettingValueTypes[N] | null>;
555
557
  }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "sideEffects": false,
14
14
  "license": "MIT",
15
15
  "description": "All the power of Heartwood in one, convenient package.",
16
- "version": "118.3.2",
16
+ "version": "119.0.0",
17
17
  "skill": {
18
18
  "namespace": "HeartwoodViewControllers",
19
19
  "commandOverrides": {