Skip to content

Commit 0dac039

Browse files
[types]: Moved adminUI to AdapterCommon (#2907)
* Moved adminUI to AdapterCommon * minor typo adjustments and instanceObject now extends AdapterObject * fix the extension of adapter object --------- Co-authored-by: Max Hauser <[email protected]>
1 parent 0490d97 commit 0dac039

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

packages/controller/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4743,7 +4743,7 @@ async function startInstance(id: ioBroker.ObjectIDs.Instance, wakeUp = false): P
47434743
proc.process = cp.fork(adapterMainFile, args, {
47444744
// @ts-expect-error if mode !== extension we have ensured it exists
47454745
execArgv: [...tools.getDefaultNodeArgs(adapterMainFile), ...execArgv],
4746-
// @ts-expect-error missing from types, but we already tested it is needed
4746+
// @ts-expect-error missing from types, but we already tested it is necessary
47474747
windowsHide: true,
47484748
cwd: adapterDir!
47494749
});

packages/types-dev/objects.d.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,8 @@ declare global {
374374
nodeProcessParams?: string[];
375375
/** If adapter can consume log messages, like admin, javascript or logparser */
376376
logTransporter?: boolean;
377-
/** Type of the admin UI */
378-
adminUI?: AdminUi;
379377
/** Optional memory limit for this instance */
380378
memoryLimitMB?: number;
381-
382379
// Make it possible to narrow the object type using the custom property
383380
custom?: undefined;
384381
}
@@ -601,6 +598,8 @@ declare global {
601598
interface AdapterCommon extends ObjectCommon {
602599
/** Custom attributes to be shown in admin in the object browser */
603600
adminColumns?: string | (string | CustomAdminColumn)[];
601+
/** Type of the admin UI */
602+
adminUI?: AdminUi;
604603
/** Settings for custom Admin Tabs */
605604
adminTab?: {
606605
name?: StringOrTranslated;
@@ -617,6 +616,7 @@ declare global {
617616
/** Order number in admin tabs */
618617
order?: number;
619618
};
619+
/** If the mode is `schedule`, start one time adapter by ioBroker start, or by the configuration changes */
620620
allowInit?: boolean;
621621
/** If the adapter should be automatically upgraded and which version ranges are supported */
622622
automaticUpgrade?: AutoUpgradePolicy;
@@ -654,13 +654,15 @@ declare global {
654654
install?: boolean;
655655
/** Source, where this adapter has been installed from, to enable reinstalling on e.g., backup restore */
656656
installedFrom?: InstalledFrom;
657-
/** Which version of this adapter is installed */
657+
/** Shows which version of this adapter is installed */
658658
installedVersion: string;
659+
/** Keywords are used by search in admin. Do not write ioBroker here */
659660
keywords?: string[];
660661
/** A dictionary of links to web services this adapter provides */
661662
localLinks?: Record<string, string | LocalLink>;
662663
/** @deprecated Use @see localLinks */
663664
localLink?: string;
665+
/** Default log level for this adapter. It can be changed for every instance separately */
664666
loglevel?: LogLevel;
665667
/** Whether this adapter receives logs from other hosts and adapters (e.g., to store them somewhere) */
666668
logTransporter?: boolean;
@@ -674,6 +676,7 @@ declare global {
674676
messagebox?: true;
675677
/** Messages which are supported by the adapter, supportedMessages.custom: true is the equivalent to messagebox: true */
676678
supportedMessages?: SupportedMessages;
679+
/** Running mode: `none`, `daemon`, `schedule`, `once`, `extension` */
677680
mode: InstanceMode;
678681
/** Name of the adapter (without leading `ioBroker.`) */
679682
name: string;
@@ -702,6 +705,7 @@ declare global {
702705
};
703706
/** Which OSes this adapter supports */
704707
os?: 'linux' | 'darwin' | 'win32' | Array<'linux' | 'darwin' | 'win32'>;
708+
/** Constant */
705709
platform: 'Javascript/Node.js';
706710
/** The keys of common attributes (e.g. `history`) which are not deleted in a `setObject` call even if they are not present. Deletion must be done explicitly by setting them to `null`. */
707711
preserveSettings?: string | string[];
@@ -713,7 +717,6 @@ declare global {
713717
restartSchedule?: string;
714718
/** If the adapter runs in `schedule` mode, this contains the CRON */
715719
schedule?: string;
716-
serviceStates?: boolean | string;
717720
/** Whether this adapter may only be installed once per host */
718721
singletonHost?: boolean;
719722
/** Whether this adapter may only be installed once in the whole system */
@@ -722,6 +725,7 @@ declare global {
722725
stopBeforeUpdate?: boolean;
723726
/** Overrides the default timeout that ioBroker will wait before force-stopping the adapter */
724727
stopTimeout?: number;
728+
/** This adapter supports a special mode: if someone subscribes on its states, it starts to read them. It is done to save the bandwidth or load of the slave device */
725729
subscribable?: boolean;
726730
/** If `true`, this adapter provides custom per-state settings. Requires a `custom_m.html` file in the `admin` directory. */
727731
supportCustoms?: boolean;
@@ -765,19 +769,23 @@ declare global {
765769
unsafePerm?: true;
766770
/** The available version in the ioBroker repo. */
767771
version: string;
772+
/** Definition of the vis-2 widgets */
768773
visWidgets?: Record<string, VisWidget>;
769774
/** Include the adapter version in the URL of the web adapter, e.g. `http://ip:port/1.2.3/material` instead of `http://ip:port/material` */
770775
webByVersion?: boolean;
771776
/** Whether the web server in this adapter can be extended with plugin/extensions */
772777
webExtendable?: boolean;
773778
/** Relative path to a module that contains an extension for the web adapter. Use together with @see native.webInstance to configure which instances this affects */
774779
webExtension?: string;
775-
webPreSettings?: any; // ?
776-
webservers?: any; // ?
780+
/** List of parameters that must be included in info.js by webServer adapter. (Example material: `"webPreSettings": { "materialBackground": "native.loadingBackground" }`). Web adapter uses this setting to create a customized info.js file to provide some essential settings for index.html file before the socket connection is established to provide e.g., background color of the loading screen. */
781+
webPreSettings?: Record<string, any>;
782+
/** @deprecated (where is it necessary?) Array of web server's instances that should serve content from the adapter's www folder */
783+
webservers?: string[];
777784
/** @deprecated (use localLinks) A list of pages that should be shown on the "web" index page */
778785
welcomeScreen?: WelcomeScreenEntry[];
779786
/** @deprecated (use localLinks) A list of pages that should be shown on the ioBroker cloud index page */
780787
welcomeScreenPro?: WelcomeScreenEntry[];
788+
/** @deprecated (rename the `www` folder in e.g. `adminWww`) If true, the `www` folder will be not uploaded into DB */
781789
wwwDontUpload?: boolean;
782790
/** @deprecated Use 'common.licenseInformation' instead */
783791
license?: string;
@@ -846,7 +854,7 @@ declare global {
846854
};
847855
/** Deactivated instances, that should not be shown in admin/Intro page */
848856
intro?: string[];
849-
/** Which tabs are visible in admin in the left menu */
857+
/** Defines which tabs are visible in the left menu of the admin */
850858
tabsVisible?: {
851859
/** Name of the tab */
852860
name: string;
@@ -1005,6 +1013,7 @@ declare global {
10051013
}
10061014

10071015
interface RepositoryJson {
1016+
/** Information about the repository: creation time, name, is it stable */
10081017
_repoInfo: RepoInfo;
10091018

10101019
/** Information about each adapter */
@@ -1035,20 +1044,10 @@ declare global {
10351044
common: RepositoryCommon;
10361045
}
10371046

1038-
interface InstanceObject extends BaseObject {
1047+
interface InstanceObject extends Omit<AdapterObject, 'type'>, BaseObject {
10391048
_id: ObjectIDs.Instance;
10401049
type: 'instance';
10411050
common: InstanceCommon;
1042-
/** These properties will be removed when foreign adapters access it */
1043-
protectedNative?: string[];
1044-
/** These properties will be automatically encrypted and decrypted when used with adapter.config */
1045-
encryptedNative?: string[];
1046-
/** Register notifications for the built-in notification system */
1047-
notifications?: Notification[];
1048-
/** Objects created for each instance, inside the namespace of this adapter */
1049-
instanceObjects: (StateObject | DeviceObject | ChannelObject | FolderObject | MetaObject)[];
1050-
/** Objects created for the adapter, anywhere in the global namespace */
1051-
objects: ioBroker.AnyObject[];
10521051
}
10531052

10541053
interface PartialInstanceObject extends Partial<Omit<InstanceObject, 'common'>> {

0 commit comments

Comments
 (0)