@digital-alchemy/hass 24.9.4 → 24.9.5

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.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/dist/helpers/notify.helper.d.ts +2 -2
  3. package/package.json +16 -14
  4. package/scripts/mock-assistant.sh +5 -0
  5. package/scripts/run-e2e.sh +7 -0
  6. package/scripts/test.sh +2 -0
  7. package/src/dynamic.ts +4254 -0
  8. package/src/extensions/area.extension.ts +118 -0
  9. package/src/extensions/backup.extension.ts +63 -0
  10. package/src/extensions/call-proxy.extension.ts +113 -0
  11. package/src/extensions/config.extension.ts +119 -0
  12. package/src/extensions/conversation.extension.ts +46 -0
  13. package/src/extensions/device.extension.ts +56 -0
  14. package/src/extensions/entity.extension.ts +344 -0
  15. package/src/extensions/events.extension.ts +25 -0
  16. package/src/extensions/fetch-api.extension.ts +269 -0
  17. package/src/extensions/floor.extension.ts +76 -0
  18. package/src/extensions/id-by.extension.ts +157 -0
  19. package/src/extensions/index.ts +16 -0
  20. package/src/extensions/internal.extension.ts +145 -0
  21. package/src/extensions/label.extension.ts +83 -0
  22. package/src/extensions/reference.extension.ts +330 -0
  23. package/src/extensions/registry.extension.ts +44 -0
  24. package/src/extensions/websocket-api.extension.ts +554 -0
  25. package/src/extensions/zone.extension.ts +69 -0
  26. package/src/hass.module.ts +217 -0
  27. package/src/helpers/backup.helper.ts +11 -0
  28. package/src/helpers/constants.helper.ts +30 -0
  29. package/src/helpers/device.helper.ts +25 -0
  30. package/src/helpers/entity-state.helper.ts +171 -0
  31. package/src/helpers/features.helper.ts +580 -0
  32. package/src/helpers/fetch/calendar.ts +54 -0
  33. package/src/helpers/fetch/configuration.ts +75 -0
  34. package/src/helpers/fetch/index.ts +5 -0
  35. package/src/helpers/fetch/server-log.ts +28 -0
  36. package/src/helpers/fetch/service-list.ts +64 -0
  37. package/src/helpers/fetch/weather-forecasts.ts +86 -0
  38. package/src/helpers/fetch.helper.ts +328 -0
  39. package/src/helpers/id-by.helper.ts +53 -0
  40. package/src/helpers/index.ts +13 -0
  41. package/src/helpers/interfaces.helper.ts +340 -0
  42. package/src/helpers/manifest.helper.ts +0 -0
  43. package/src/helpers/notify.helper.ts +302 -0
  44. package/src/helpers/registry.ts +281 -0
  45. package/src/helpers/utility.helper.ts +147 -0
  46. package/src/helpers/websocket.helper.ts +117 -0
  47. package/src/index.ts +5 -0
  48. package/src/mock_assistant/extensions/area.extension.ts +62 -0
  49. package/src/mock_assistant/extensions/config.extension.ts +33 -0
  50. package/src/mock_assistant/extensions/device.extension.ts +44 -0
  51. package/src/mock_assistant/extensions/entity-registry.extension.ts +41 -0
  52. package/src/mock_assistant/extensions/entity.extension.ts +114 -0
  53. package/src/mock_assistant/extensions/events.extension.ts +37 -0
  54. package/src/mock_assistant/extensions/fetch.extension.ts +3 -0
  55. package/src/mock_assistant/extensions/fixtures.extension.ts +79 -0
  56. package/src/mock_assistant/extensions/floor.extension.ts +64 -0
  57. package/src/mock_assistant/extensions/index.ts +12 -0
  58. package/src/mock_assistant/extensions/label.extension.ts +64 -0
  59. package/src/mock_assistant/extensions/services.extension.ts +25 -0
  60. package/src/mock_assistant/extensions/websocket-api.extension.ts +84 -0
  61. package/src/mock_assistant/extensions/zone.extension.ts +65 -0
  62. package/src/mock_assistant/helpers/fixtures.ts +22 -0
  63. package/src/mock_assistant/helpers/index.ts +1 -0
  64. package/src/mock_assistant/index.ts +3 -0
  65. package/src/mock_assistant/main.ts +46 -0
  66. package/src/mock_assistant/mock-assistant.module.ts +90 -0
  67. package/src/quickboot.module.ts +23 -0
  68. package/src/testing/area.spec.ts +189 -0
  69. package/src/testing/backup.spec.ts +157 -0
  70. package/src/testing/config.spec.ts +188 -0
  71. package/src/testing/device.spec.ts +89 -0
  72. package/src/testing/entity.spec.ts +171 -0
  73. package/src/testing/events.spec.ts +78 -0
  74. package/src/testing/fetch-api.spec.ts +410 -0
  75. package/src/testing/fixtures.spec.ts +158 -0
  76. package/src/testing/floor.spec.ts +186 -0
  77. package/src/testing/id-by.spec.ts +140 -0
  78. package/src/testing/label.spec.ts +186 -0
  79. package/src/testing/ref-by.spec.ts +300 -0
  80. package/src/testing/websocket.spec.ts +63 -0
  81. package/src/testing/workflow.spec.ts +195 -0
  82. package/src/testing/zone.spec.ts +109 -0
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  [![stars](https://img.shields.io/github/stars/Digital-Alchemy-TS/hass)](https://github.com/Digital-Alchemy-TS/hass)
2
2
  ![discord](https://img.shields.io/discord/1219758743848489147?label=Discord&logo=discord)
3
-
4
3
  [![codecov](https://codecov.io/gh/Digital-Alchemy-TS/hass/graph/badge.svg?token=LYUQ1FQ71D)](https://codecov.io/gh/Digital-Alchemy-TS/hass)
5
4
  [![version](https://img.shields.io/github/package-json/version/Digital-Alchemy-TS/hass)](https://www.npmjs.com/package/@digital-alchemy/hass)
5
+
6
6
  ---
7
7
 
8
8
  # 🏠 Welcome to `@digital-alchemy/hass`!
@@ -118,7 +118,7 @@ export type AppleNotificationData = {
118
118
  /**
119
119
  * iOS Supports ~10 actions.
120
120
  */
121
- actions: Array<NotificationAction & AppleNotificationActionOptions>;
121
+ actions?: Array<NotificationAction & AppleNotificationActionOptions>;
122
122
  };
123
123
  export type AndroidNotificationData = {
124
124
  /**
@@ -257,7 +257,7 @@ export type AndroidNotificationData = {
257
257
  /**
258
258
  * Android Supports 3 actions.
259
259
  */
260
- actions: Array<NotificationAction & AndroidNotificationActionOptions>;
260
+ actions?: Array<NotificationAction & AndroidNotificationActionOptions>;
261
261
  };
262
262
  export type NotificationData = {
263
263
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "@digital-alchemy/hass",
4
4
  "repository": "https://github.com/Digital-Alchemy-TS/hass",
5
5
  "homepage": "https://docs.digital-alchemy.app",
6
- "version": "24.9.4",
6
+ "version": "24.9.5",
7
7
  "description": "Typescript APIs for Home Assistant. Includes rest & websocket bindings",
8
8
  "scripts": {
9
9
  "build": "rm -rf dist/; tsc",
@@ -26,7 +26,7 @@
26
26
  "digital-alchemy"
27
27
  ],
28
28
  "bin": {
29
- "mock-assistant": "./dist/mock_assistant/main.js"
29
+ "mock-assistant": "./scripts/mock-assistant.sh"
30
30
  },
31
31
  "funding": [
32
32
  {
@@ -43,7 +43,9 @@
43
43
  "name": "Zoe Codez"
44
44
  },
45
45
  "files": [
46
- "dist/**/*"
46
+ "dist/**/*",
47
+ "scripts/**/*",
48
+ "src/**/*"
47
49
  ],
48
50
  "engines": {
49
51
  "node": ">=20"
@@ -55,36 +57,36 @@
55
57
  "license": "MIT",
56
58
  "devDependencies": {
57
59
  "@cspell/eslint-plugin": "^8.14.4",
58
- "@digital-alchemy/core": "^24.9.3",
59
- "@digital-alchemy/synapse": "^24.9.3",
60
- "@digital-alchemy/type-writer": "^24.9.2",
60
+ "@digital-alchemy/core": "^24.9.5",
61
+ "@digital-alchemy/synapse": "^24.9.4",
62
+ "@digital-alchemy/type-writer": "^24.9.7",
61
63
  "@eslint/compat": "^1.1.1",
62
64
  "@eslint/eslintrc": "^3.1.0",
63
65
  "@eslint/js": "^9.11.1",
64
- "@faker-js/faker": "^9.0.2",
66
+ "@faker-js/faker": "^9.0.3",
65
67
  "@types/jest": "^29.5.13",
66
68
  "@types/js-yaml": "^4.0.9",
67
- "@types/node": "^22.6.1",
68
- "@types/node-cron": "^3",
69
+ "@types/node": "^22.7.4",
70
+ "@types/node-cron": "^3.0.11",
69
71
  "@types/semver": "^7.5.8",
70
72
  "@types/uuid": "^10.0.0",
71
73
  "@types/ws": "^8.5.12",
72
- "@typescript-eslint/eslint-plugin": "8.7.0",
73
- "@typescript-eslint/parser": "8.7.0",
74
+ "@typescript-eslint/eslint-plugin": "8.8.0",
75
+ "@typescript-eslint/parser": "8.8.0",
74
76
  "dayjs": "^1.11.13",
75
77
  "dotenv": "^16.4.5",
76
78
  "eslint": "9.11.1",
77
79
  "eslint-config-prettier": "9.1.0",
78
80
  "eslint-plugin-import": "^2.30.0",
79
81
  "eslint-plugin-jsonc": "^2.16.0",
80
- "eslint-plugin-no-unsanitized": "^4.1.0",
82
+ "eslint-plugin-no-unsanitized": "^4.1.2",
81
83
  "eslint-plugin-prettier": "^5.2.1",
82
84
  "eslint-plugin-security": "^3.0.1",
83
85
  "eslint-plugin-simple-import-sort": "^12.1.1",
84
- "eslint-plugin-sonarjs": "^2.0.2",
86
+ "eslint-plugin-sonarjs": "^2.0.3",
85
87
  "eslint-plugin-sort-keys-fix": "^1.1.2",
86
88
  "eslint-plugin-unicorn": "^55.0.0",
87
- "globals": "^15.9.0",
89
+ "globals": "^15.10.0",
88
90
  "jest": "^29.7.0",
89
91
  "jest-environment-node": "^29.7.0",
90
92
  "node-cron": "^3.0.3",
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ FULL_PATH=$(realpath "$0")
4
+ FILE_BASE=$(dirname "$FULL_PATH")
5
+ npx tsx "$FILE_BASE/../src/mock_assistant/main.ts" "$1"
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ CONTAINER_NAME="digital_alchemy_e2e_homeassistant"
4
+
5
+ if ! docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" >/dev/null 2>&1 || [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME")" != "true" ]; then
6
+ docker-compose -f ./e2e/hass/docker-compose.yaml up -d
7
+ fi
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" npx jest --pass-with-no-tests --runInBand "$1"