@iobroker/types 5.0.18-alpha.0-20240129-1906f86c → 5.0.18

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.
@@ -1,4 +1,4 @@
1
- import type * as os from 'os';
1
+ import * as os from 'os';
2
2
 
3
3
  declare global {
4
4
  namespace ioBroker {
@@ -85,12 +85,8 @@ declare global {
85
85
  type User = `system.user.${string}`;
86
86
  // Guaranteed host objects
87
87
  type Host = `system.host.${string}`;
88
- // Guaranteed repository object
89
- type Repository = 'system.repositories';
90
88
  // Guaranteed config objects
91
- type Config = 'system.certificates';
92
- // Guaranteed system config objects
93
- type SystemConfig = 'system.config';
89
+ type Config = `system.${'certificates' | 'config' | 'repositories'}`;
94
90
  // Guaranteed design objects
95
91
  type Design = `_design/${string}`;
96
92
 
@@ -119,39 +115,35 @@ declare global {
119
115
  T extends ObjectIDs.State
120
116
  ? StateObject
121
117
  : // Instance and Adapter must come before meta or `system.adapter.admin` will resolve to MetaObject
122
- T extends ObjectIDs.Instance
123
- ? InstanceObject
124
- : T extends ObjectIDs.Adapter
125
- ? AdapterObject
126
- : T extends ObjectIDs.Channel
127
- ? ChannelObject
128
- : T extends ObjectIDs.Meta
129
- ? MetaObject
130
- : T extends ObjectIDs.Misc
131
- ? AdapterScopedObject
132
- : T extends ObjectIDs.ScriptOrChannel
133
- ? ScriptObject | ChannelObject
134
- : T extends ObjectIDs.Enum
135
- ? EnumObject
136
- : T extends ObjectIDs.Group
137
- ? GroupObject
138
- : T extends ObjectIDs.User
139
- ? UserObject
140
- : T extends ObjectIDs.Host
141
- ? HostObject
142
- : T extends ObjectIDs.Design
143
- ? DesignObject
144
- : T extends ObjectIDs.Repository
145
- ? RepositoryObject
146
- : T extends ObjectIDs.SystemConfig
147
- ? SystemConfigObject
148
- : T extends ObjectIDs.Config
149
- ? OtherObject & { type: 'config' }
150
- : T extends ObjectIDs.AdapterScoped
151
- ? AdapterScopedObject
152
- : Read extends 'read'
153
- ? ioBroker.Object
154
- : AnyObject;
118
+ T extends ObjectIDs.Instance
119
+ ? InstanceObject
120
+ : T extends ObjectIDs.Adapter
121
+ ? AdapterObject
122
+ : T extends ObjectIDs.Channel
123
+ ? ChannelObject
124
+ : T extends ObjectIDs.Meta
125
+ ? MetaObject
126
+ : T extends ObjectIDs.Misc
127
+ ? AdapterScopedObject
128
+ : T extends ObjectIDs.ScriptOrChannel
129
+ ? ScriptObject | ChannelObject
130
+ : T extends ObjectIDs.Enum
131
+ ? EnumObject
132
+ : T extends ObjectIDs.Group
133
+ ? GroupObject
134
+ : T extends ObjectIDs.User
135
+ ? UserObject
136
+ : T extends ObjectIDs.Host
137
+ ? HostObject
138
+ : T extends ObjectIDs.Design
139
+ ? DesignObject
140
+ : T extends ObjectIDs.Config
141
+ ? OtherObject & { type: 'config' }
142
+ : T extends ObjectIDs.AdapterScoped
143
+ ? AdapterScopedObject
144
+ : Read extends 'read'
145
+ ? ioBroker.Object
146
+ : AnyObject;
155
147
 
156
148
  type Languages = 'en' | 'de' | 'ru' | 'pt' | 'nl' | 'fr' | 'it' | 'es' | 'pl' | 'uk' | 'zh-cn';
157
149
  type Translated = { en: string } & { [lang in Languages]?: string };
@@ -165,9 +157,6 @@ declare global {
165
157
  /** The name of this object as a simple string or an object with translations */
166
158
  name: StringOrTranslated;
167
159
 
168
- /** Description of this object */
169
- desc?: StringOrTranslated;
170
-
171
160
  /** When set to true, this object may not be deleted */
172
161
  dontDelete?: true;
173
162
 
@@ -193,6 +182,8 @@ declare global {
193
182
  step?: number;
194
183
  /** unit of the value */
195
184
  unit?: string;
185
+ /** description of this state */
186
+ desc?: StringOrTranslated;
196
187
 
197
188
  /** if this state is readable */
198
189
  read: boolean;
@@ -273,6 +264,9 @@ declare global {
273
264
  });
274
265
  }
275
266
  interface ChannelCommon extends ObjectCommon {
267
+ /** description of this channel */
268
+ desc?: string;
269
+
276
270
  // Make it possible to narrow the object type using the custom property
277
271
  custom?: undefined;
278
272
  }
@@ -294,10 +288,6 @@ declare global {
294
288
  custom?: undefined;
295
289
  }
296
290
 
297
- interface RepositoryCommon extends ObjectCommon {
298
- custom?: undefined;
299
- }
300
-
301
291
  interface ChartCommon extends ObjectCommon {
302
292
  enabled?: boolean;
303
293
  color?: string;
@@ -539,8 +529,6 @@ declare global {
539
529
  singleton?: boolean;
540
530
  };
541
531
  allowInit?: boolean;
542
- /** If the adapter should be automatically upgraded and which version ranges are supported */
543
- automaticUpgrade?: AutoUpgradePolicy;
544
532
  /** Possible values for the instance mode (if more than one is possible) */
545
533
  availableModes?: InstanceMode[];
546
534
  /** Array which lists all blocked versions. Blocked versions will not be started. Use semver notation to specify the version ranges. The information is always used from the io-package.json in the GitHub repository. */
@@ -680,49 +668,6 @@ declare global {
680
668
  custom?: undefined;
681
669
  }
682
670
 
683
- interface SystemConfigCommon extends ObjectCommon {
684
- /** Name of all active repositories */
685
- activeRepo: string[];
686
- /** Current configured language */
687
- language: Languages;
688
- /** If floating comma is used instead of dot */
689
- isFloatComma: boolean;
690
- /** Configured longitude */
691
- longitude: string;
692
- /** Configured latitude */
693
- latitude: string;
694
- /** Default history instance */
695
- defaultHistory: string;
696
- /** Which diag data is allowed to be sent */
697
- diag: 'none' | 'extended' | 'no-city';
698
- /** If license has already been confirmed */
699
- licenseConfirmed: boolean;
700
- /** System wide default log level */
701
- defaultLogLevel?: LogLevel;
702
- /** Used date format for formatting */
703
- dateFormat: string;
704
- /** Default acl for new objects */
705
- defaultNewAcl: {
706
- object: number;
707
- state: number;
708
- file: number;
709
- owner: ObjectIDs.User;
710
- ownerGroup: ObjectIDs.Group;
711
- };
712
- /** Configured auto upgrade policy */
713
- adapterAutoUpgrade?: {
714
- /** Configuration for each repository */
715
- repositories: {
716
- [repoName: string]: boolean;
717
- };
718
- /** Default policy, if none has been set explicit for the adapter */
719
- defaultPolicy: AutoUpgradePolicy;
720
- };
721
-
722
- // Make it possible to narrow the object type using the custom property
723
- custom?: undefined;
724
- }
725
-
726
671
  interface OtherCommon extends ObjectCommon {
727
672
  [propName: string]: any;
728
673
 
@@ -835,54 +780,6 @@ declare global {
835
780
  common?: Partial<ScheduleCommon>;
836
781
  }
837
782
 
838
- interface PartialRepositoryObject extends Partial<Omit<RepositoryObject, 'common'>> {
839
- common?: Partial<RepositoryCommon>;
840
- }
841
-
842
- interface RepositoryJsonAdapterContent {
843
- /** Adapter name */
844
- name: string;
845
- /** Newest available version */
846
- version: string;
847
- /** Other Adapter related properties, not important for this implementation */
848
- [other: string]: unknown;
849
- }
850
-
851
- interface RepositoryJson {
852
- _repoInfo: {
853
- /** If it is the official stable repository */
854
- stable?: boolean;
855
- /** i18n name of the repository */
856
- name: Required<ioBroker.Translated>;
857
- /** Time of repository update */
858
- repoTime: string;
859
- };
860
- /** Information about each adapter - Record needed for _repoInfo */
861
- [adapter: string]: RepositoryJsonAdapterContent | Record<string, any>;
862
- }
863
-
864
- interface RepositoryInformation {
865
- /** Url to the repository */
866
- link: string;
867
- json: RepositoryJson | null;
868
- hash?: string;
869
- time?: string;
870
- }
871
-
872
- interface RepositoryObject extends BaseObject {
873
- _id: ObjectIDs.Repository;
874
- type: 'config';
875
- native: {
876
- repositories: {
877
- [repoName: string]: RepositoryInformation;
878
- };
879
- oldRepositories?: {
880
- [repoName: string]: RepositoryInformation;
881
- };
882
- };
883
- common: RepositoryCommon;
884
- }
885
-
886
783
  interface InstanceObject extends BaseObject {
887
784
  _id: ObjectIDs.Instance;
888
785
  type: 'instance';
@@ -968,15 +865,6 @@ declare global {
968
865
  common?: Partial<ScriptCommon>;
969
866
  }
970
867
 
971
- interface SystemConfigObject extends BaseObject {
972
- type: 'config';
973
- common: SystemConfigCommon;
974
- }
975
-
976
- interface PartialSystemConfigObject extends Partial<Omit<SystemConfigObject, 'common'>> {
977
- common?: Partial<SystemConfigCommon>;
978
- }
979
-
980
868
  interface OtherObject extends BaseObject {
981
869
  type: 'config' | 'chart';
982
870
  common: OtherCommon;
@@ -1014,7 +902,6 @@ declare global {
1014
902
  | ScriptObject
1015
903
  | ChartObject
1016
904
  | ScheduleObject
1017
- | RepositoryObject
1018
905
  | OtherObject
1019
906
  | DesignObject;
1020
907
 
@@ -1033,8 +920,6 @@ declare global {
1033
920
  | PartialScriptObject
1034
921
  | PartialChartObject
1035
922
  | PartialScheduleObject
1036
- | PartialRepositoryObject
1037
- | PartialSystemConfigObject
1038
923
  | PartialOtherObject
1039
924
  | PartialDesignObject;
1040
925
 
@@ -1077,8 +962,6 @@ declare global {
1077
962
  type SettableScheduleObject = SettableObject<ScheduleObject>;
1078
963
  type SettableChartObject = SettableObject<ChartObject>;
1079
964
  type SettableDesignObject = SettableObject<DesignObject>;
1080
- type SettableRepositoryObject = SettableObject<RepositoryObject>;
1081
- type SettableSystemConfigObject = SettableObject<SystemConfigObject>;
1082
965
  type SettableOtherObject = SettableObject<OtherObject>;
1083
966
 
1084
967
  // Used to infer the return type of GetObjectView
@@ -1086,36 +969,36 @@ declare global {
1086
969
  ? View extends 'host'
1087
970
  ? HostObject
1088
971
  : View extends 'adapter'
1089
- ? AdapterObject
1090
- : View extends 'instance'
1091
- ? InstanceObject
1092
- : View extends 'meta'
1093
- ? MetaObject
1094
- : View extends 'device'
1095
- ? DeviceObject
1096
- : View extends 'channel'
1097
- ? ChannelObject
1098
- : View extends 'state'
1099
- ? StateObject
1100
- : View extends 'folder'
1101
- ? FolderObject
1102
- : View extends 'enum'
1103
- ? EnumObject
1104
- : View extends 'script'
1105
- ? ScriptObject
1106
- : View extends 'group'
1107
- ? GroupObject
1108
- : View extends 'user'
1109
- ? UserObject
1110
- : View extends 'chart'
1111
- ? ChartObject
1112
- : View extends 'schedule'
1113
- ? ScheduleObject
1114
- : View extends 'config'
1115
- ? RepositoryObject | SystemConfigObject | (OtherObject & { type: 'config' })
1116
- : View extends 'custom'
1117
- ? NonNullable<StateObject['common']['custom']>
1118
- : ioBroker.Object
972
+ ? AdapterObject
973
+ : View extends 'instance'
974
+ ? InstanceObject
975
+ : View extends 'meta'
976
+ ? MetaObject
977
+ : View extends 'device'
978
+ ? DeviceObject
979
+ : View extends 'channel'
980
+ ? ChannelObject
981
+ : View extends 'state'
982
+ ? StateObject
983
+ : View extends 'folder'
984
+ ? FolderObject
985
+ : View extends 'enum'
986
+ ? EnumObject
987
+ : View extends 'script'
988
+ ? ScriptObject
989
+ : View extends 'group'
990
+ ? GroupObject
991
+ : View extends 'user'
992
+ ? UserObject
993
+ : View extends 'chart'
994
+ ? ChartObject
995
+ : View extends 'schedule'
996
+ ? ScheduleObject
997
+ : View extends 'config'
998
+ ? OtherObject & { type: 'config' }
999
+ : View extends 'custom'
1000
+ ? NonNullable<StateObject['common']['custom']>
1001
+ : ioBroker.Object
1119
1002
  : any;
1120
1003
  }
1121
1004
  }
package/build/shared.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Types which are safe to share within this repository AND publicly
2
2
 
3
- import type * as fs from 'fs';
3
+ import * as fs from 'fs';
4
4
  import './objects';
5
5
  import type { IoBJson, DatabaseOptions, ObjectsDatabaseOptions as ObjectsDbOptions } from './config';
6
6
 
package/build/types.d.ts CHANGED
@@ -22,10 +22,7 @@ export declare interface AdapterClass {
22
22
  /** Only emitted for compact instances */
23
23
  on(event: 'exit', listener: (exitCode: number, reason: string) => Promise<void> | void): this;
24
24
  on(event: 'log', listener: (info: any) => Promise<void> | void): this;
25
- /**
26
- * Extend an object and create it if it might not exist
27
- * @deprecated use `adapter.extendObject` without callback instead
28
- */
25
+ /** Extend an object and create it if it might not exist */
29
26
  extendObjectAsync(id: string, objPart: ioBroker.PartialObject, options?: ioBroker.ExtendObjectOptions): ioBroker.SetObjectPromise;
30
27
  /** Set capabilities of the given executable. Only works on Linux systems. */
31
28
  setExecutableCapabilities(execPath: string, capabilities: string[], modeEffective?: boolean, modePermitted?: boolean, modeInherited?: boolean): Promise<void>;
@@ -202,12 +199,9 @@ export declare interface AdapterClass {
202
199
  delFile(adapterName: string | null, path: string, options: unknown, callback: ioBroker.ErrnoCallback): void;
203
200
  /**
204
201
  * Writes a value into the states DB.
205
- * @deprecated use `adapter.setState` without callback instead
206
202
  */
207
203
  setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack?: boolean): ioBroker.SetStatePromise;
208
- /** @deprecated use `adapter.setState` without callback instead */
209
204
  setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, options?: unknown): ioBroker.SetStatePromise;
210
- /** @deprecated use `adapter.setState` without callback instead */
211
205
  setStateAsync(id: string, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, options: unknown): ioBroker.SetStatePromise;
212
206
  /**
213
207
  * Writes a value (which might not belong to this adapter) into the states DB.
@@ -378,9 +372,9 @@ export declare class AdapterClass extends EventEmitter {
378
372
  /** configured language of system.config, only available if requested via AdapterOptions `useFormatDate` */
379
373
  language?: ioBroker.Languages;
380
374
  /** longitude configured in system.config, only available if requested via AdapterOptions `useFormatDate`*/
381
- longitude?: string;
375
+ longitude?: number;
382
376
  /** latitude configured in system.config, only available if requested via AdapterOptions `useFormatDate`*/
383
- latitude?: string;
377
+ latitude?: number;
384
378
  private _defaultObjs?;
385
379
  private _aliasObjectsSubscribed?;
386
380
  config: ioBroker.AdapterConfig;
@@ -497,9 +491,7 @@ export declare class AdapterClass extends EventEmitter {
497
491
  private _setObjectWithDefaultValue;
498
492
  getAdapterObjects(callback: (objects: Record<string, ioBroker.AdapterScopedObject>) => void): Promise<Record<string, ioBroker.AdapterScopedObject> | void>;
499
493
  private _getAdapterObjects;
500
- extendObject(id: string, objPart: ioBroker.PartialObject): ioBroker.SetObjectPromise;
501
494
  extendObject(id: string, objPart: ioBroker.PartialObject, callback?: ioBroker.SetObjectCallback): void;
502
- extendObject(id: string, objPart: ioBroker.PartialObject, options: ioBroker.ExtendObjectOptions): ioBroker.SetObjectPromise;
503
495
  extendObject(id: string, objPart: ioBroker.PartialObject, options: ioBroker.ExtendObjectOptions, callback?: ioBroker.SetObjectCallback): void;
504
496
  private _extendObject;
505
497
  setForeignObject<T extends string>(id: T, obj: ioBroker.SettableObject<ioBroker.ObjectIdToObjectType<T, 'write'>>, callback?: ioBroker.SetObjectCallback): void;
package/package.json CHANGED
@@ -1,45 +1,45 @@
1
1
  {
2
- "name": "@iobroker/types",
3
- "version": "5.0.18-alpha.0-20240129-1906f86c",
4
- "engines": {
5
- "node": ">=12.0.0"
6
- },
7
- "keywords": [
8
- "ioBroker"
9
- ],
10
- "author": "foxriver76 <moritz.heusinger@gmail.com>",
11
- "contributors": [
12
- "foxriver76 <moritz.heusinger@gmail.com>"
13
- ],
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/ioBroker/ioBroker.js-controller/packages/types"
17
- },
18
- "devDependencies": {
19
- "tsd": "^0.24.1"
20
- },
21
- "scripts": {
22
- "build": "ts-node build.ts",
23
- "test": "tsd"
24
- },
25
- "main": "index.js",
26
- "types": "index.d.ts",
27
- "license": "MIT",
28
- "publishConfig": {
29
- "access": "public"
30
- },
31
- "files": [
32
- "build/",
33
- "index.d.ts",
34
- "public.d.ts",
35
- "LICENSE"
36
- ],
37
- "tsd": {
38
- "compilerOptions": {
39
- "types": [
40
- "@iobroker/types"
41
- ]
42
- }
43
- },
44
- "gitHead": "900352dade72210f1f902539e99f41ca5054955e"
2
+ "name": "@iobroker/types",
3
+ "version": "5.0.18",
4
+ "engines": {
5
+ "node": ">=12.0.0"
6
+ },
7
+ "keywords": [
8
+ "ioBroker"
9
+ ],
10
+ "author": "foxriver76 <moritz.heusinger@gmail.com>",
11
+ "contributors": [
12
+ "foxriver76 <moritz.heusinger@gmail.com>"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/ioBroker/ioBroker.js-controller/packages/types"
17
+ },
18
+ "devDependencies": {
19
+ "tsd": "^0.24.1"
20
+ },
21
+ "scripts": {
22
+ "build": "ts-node build.ts",
23
+ "test": "tsd"
24
+ },
25
+ "main": "index.js",
26
+ "types": "index.d.ts",
27
+ "license": "MIT",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "files": [
32
+ "build/",
33
+ "index.d.ts",
34
+ "public.d.ts",
35
+ "LICENSE"
36
+ ],
37
+ "tsd": {
38
+ "compilerOptions": {
39
+ "types": [
40
+ "@iobroker/types"
41
+ ]
42
+ }
43
+ },
44
+ "gitHead": "4609455d62438f63207b5ad869e54ea8b1325c0c"
45
45
  }
package/public.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Types which are only safe to share publicly
2
2
 
3
- import type { AdapterClass, AdapterOptions as _AdapterOptions } from './build/types';
3
+ import { AdapterClass, AdapterOptions as _AdapterOptions } from './build/types';
4
4
 
5
5
  declare global {
6
6
  namespace ioBroker {