Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unavailable proof of concept #78

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,38 @@
"@digital-alchemy/hass": "*"
},
"devDependencies": {
"@cspell/eslint-plugin": "^8.16.0",
"@digital-alchemy/core": "^24.11.3",
"@digital-alchemy/hass": "^24.11.3",
"@cspell/eslint-plugin": "^8.16.1",
"@digital-alchemy/core": "^24.11.4",
"@digital-alchemy/hass": "^24.11.4",
"@eslint/compat": "^1.2.3",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.15.0",
"@eslint/js": "^9.16.0",
"@types/figlet": "^1.7.0",
"@types/js-yaml": "^4.0.9",
"@types/node": "^22.9.0",
"@types/node": "^22.10.1",
"@types/node-cron": "^3.0.11",
"@types/validator": "^13.12.2",
"@types/ws": "^8.5.13",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"@typescript-eslint/eslint-plugin": "8.16.0",
"@typescript-eslint/parser": "8.16.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
"eslint": "9.15.0",
"eslint": "9.16.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsonc": "^2.18.1",
"eslint-plugin-jsonc": "^2.18.2",
"eslint-plugin-no-unsanitized": "^4.1.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^2.0.4",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unicorn": "^56.0.0",
"eslint-plugin-unicorn": "^56.0.1",
"node-cron": "^3.0.3",
"prettier": "^3.3.3",
"prettier": "^3.4.1",
"tsx": "^4.19.2",
"type-fest": "^4.27.0",
"typescript": "^5.7.0-beta",
"type-fest": "^4.29.0",
"typescript": "^5.7.2",
"ws": "^8.18.0"
},
"packageManager": "[email protected]"
Expand Down
5 changes: 4 additions & 1 deletion src/domains/switch.service.mts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { TServiceParams } from "@digital-alchemy/core";

export function SwitchBuilder({ type_build }: TServiceParams) {
export function SwitchBuilder({ type_build, config }: TServiceParams) {
type_build.domain.register<"switch">({
async attributes(data) {
return type_build.ast.attributes({ data: data.attributes });
},
domain: "switch",
state() {
if (config.type_writer.INCLUDE_UNAVAILABLE_STATE) {
return type_build.ast.union(["on", "off", "unavailable"]);
}
return type_build.ast.union(["on", "off"]);
},
});
Expand Down
4 changes: 4 additions & 0 deletions src/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { LIB_TYPE_BUILD } from "./type-writer.module.mts";

const TYPE_WRITER = CreateApplication({
configuration: {
INCLUDE_UNAVAILABLE_STATE: {
default: false,
type: "boolean",
},
TARGET_FILE: {
description: "Define a file to write types to. Autodetect = default behavior",
type: "string",
Expand Down
Loading
Loading