Skip to content

Commit

Permalink
prevent issue when values with stateNs.null exist in the database (#2580
Browse files Browse the repository at this point in the history
)

* prevent issue when values with stateNs.null exist in the database

- closes #2579

* rm log

* rm anoither log

* allow path aliases in adapter package

* rm types from validator again

* move tsc-alias to postbuild

* use lerna to build project again as npm workspaces does not use the correct build script when building dependency packages

- and using normal workspace flag works but is ineffective and can lead to errors due to still open npm/rfcs#548

* update jsonl
  • Loading branch information
foxriver76 authored Jan 28, 2024
1 parent 16ca1dc commit 1906f86
Show file tree
Hide file tree
Showing 9 changed files with 715 additions and 831 deletions.
1,248 changes: 576 additions & 672 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"@types/triple-beam": "^1.3.2",
"@types/winston-syslog": "^2.4.0",
"@types/yargs": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"cpy-cli": "^4.2.0",
"eslint": "^8.48.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"fs-extra": "^11.1.0",
"get-spdx-license-ids": "^2.1.0",
"gulp": "^4.0.2",
Expand All @@ -71,6 +71,7 @@
"sinon-chai": "^3.7.0",
"ts-json-schema-generator": "~1.2.0",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.8",
"typedoc": "^0.25.4",
"typedoc-plugin-markdown": "^3.17.1",
"typedoc-plugin-missing-exports": "^2.1.0",
Expand All @@ -79,11 +80,10 @@
"scripts": {
"clean": "rimraf packages/*/build packages/*/*.tsbuildinfo",
"build:doc": "lerna run build:doc",
"build:ts": "npm run build --workspace=iobroker.js-controller -- --verbose",
"build:ts": "lerna run build --ignore '@iobroker/types'",
"build:types": "npm run build --workspace=@iobroker/types",
"watch:ts": "npm run build:ts -- --watch",
"build": "npm run build:ts && npm run build:types",
"postbuild": "lerna run postbuild && npm run update-schema",
"postbuild": "npm run update-schema",
"preinstall": "lerna run preinstall",
"install": "lerna run install",
"release": "release-script",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"url": "https://github.com/ioBroker/ioBroker.js-controller/packages/adapter"
},
"scripts": {
"build": "tsc -b tsconfig.build.json",
"build": "tsc -b tsconfig.build.json && tsc-alias",
"postbuild": "cpy ./cert ../build/ --cwd=src",
"build:doc": "typedoc --excludeExternals --excludeProtected --excludePrivate --plugin typedoc-plugin-missing-exports --plugin typedoc-plugin-markdown src/lib/adapter/adapter.ts --out ../controller/doc"
},
Expand Down
261 changes: 118 additions & 143 deletions packages/adapter/src/lib/adapter/adapter.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/adapter/src/lib/adapter/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MAX_TIMEOUT, SYSTEM_ADMIN_USER } from './constants';
import { MAX_TIMEOUT, SYSTEM_ADMIN_USER } from '@/lib/adapter/constants';
import { tools, EXIT_CODES } from '@iobroker/js-controller-common';

type Callback = (...args: any[]) => void | Promise<void>;
Expand Down Expand Up @@ -61,7 +61,7 @@ export class Validator {
return;
}

const obj: any = await this.objects.getObjectAsync(id);
const obj = await this.objects.getObjectAsync(id);
// at first check object existence
if (!obj) {
this.log.warn(
Expand All @@ -71,7 +71,7 @@ export class Validator {
}

// for a state object, we require common.type to exist
if (obj.common && obj.common.type) {
if (obj.common?.type) {
// check if we are allowed to write (read-only can only be written with ack: true)
if (!state.ack && obj.common.write === false) {
this.log.warn(
Expand Down
7 changes: 6 additions & 1 deletion packages/adapter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "build",
"rootDir": "src"
"rootDir": "src",
"paths": {
"@/*": [
"./src/*"
]
}
},
"references": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/db-objects-jsonl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"node": ">=12.0.0"
},
"dependencies": {
"@alcalzone/jsonl-db": "~3.1.0",
"@alcalzone/jsonl-db": "~3.1.1",
"@iobroker/db-base": "file:../db-base",
"@iobroker/db-objects-file": "file:../db-objects-file",
"@iobroker/db-objects-redis": "file:../db-objects-redis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3323,7 +3323,7 @@ export class ObjectsInRedisClient {
);
}

if (options && options.acl) {
if (options?.acl) {
options.acl = null;
}
if (typeof callback === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion packages/db-states-jsonl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"node": ">=12.0.0"
},
"dependencies": {
"@alcalzone/jsonl-db": "~3.1.0",
"@alcalzone/jsonl-db": "~3.1.1",
"@iobroker/db-base": "file:../db-base",
"@iobroker/db-states-file": "file:../db-states-file",
"@iobroker/db-states-redis": "file:../db-states-redis"
Expand Down

0 comments on commit 1906f86

Please sign in to comment.