@openremote/core 1.0.3 → 1.2.0-snapshot.20240512154942

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.
package/dist/index.d.ts DELETED
@@ -1,224 +0,0 @@
1
- import "url-search-params-polyfill";
2
- import { Console } from "./console";
3
- import { EventProvider, EventProviderFactory, EventProviderStatus } from "./event";
4
- import i18next from "i18next";
5
- import { AssetDescriptor, AttributeDescriptor, AttributeValueDescriptor, MetaItemDescriptor, Attribute, ConsoleAppConfig } from "@openremote/model";
6
- import * as Util from "./util";
7
- export { Util };
8
- export * from "./asset-mixin";
9
- export * from "./console";
10
- export * from "./event";
11
- export * from "./defaults";
12
- export declare const DEFAULT_ICONSET: string;
13
- export declare type KeycloakPromise<T> = {
14
- success<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | KeycloakPromise<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | KeycloakPromise<TResult2>) | undefined | null): KeycloakPromise<TResult1 | TResult2>;
15
- error<TResult = never>(onrejected?: ((reason: any) => TResult | KeycloakPromise<TResult>) | undefined | null): Promise<T | TResult>;
16
- };
17
- export declare type Keycloak = {
18
- token: string;
19
- refreshToken: string;
20
- tokenParsed: any;
21
- refreshTokenParsed: any;
22
- resourceAccess: any;
23
- onAuthSuccess: () => void;
24
- onAuthError: () => void;
25
- init(options?: any): KeycloakPromise<boolean>;
26
- login(options?: any): void;
27
- hasRealmRole(role: string): boolean;
28
- logout(options?: any): void;
29
- updateToken(expiry: number): KeycloakPromise<boolean>;
30
- clearToken(): void;
31
- };
32
- export declare enum ORError {
33
- MANAGER_FAILED_TO_LOAD = "MANAGER_FAILED_TO_LOAD",
34
- AUTH_FAILED = "AUTH_FAILED",
35
- AUTH_TYPE_UNSUPPORTED = "AUTH_TYPE_UNSUPPORTED",
36
- CONSOLE_ERROR = "CONSOLE_INIT_ERROR",
37
- EVENTS_CONNECTION_ERROR = "EVENTS_CONNECTION_ERROR",
38
- TRANSLATION_ERROR = "TRANSLATION_ERROR"
39
- }
40
- export declare enum Auth {
41
- KEYCLOAK = "KEYCLOAK",
42
- BASIC = "BASIC",
43
- NONE = "NONE"
44
- }
45
- export declare enum OREvent {
46
- ERROR = "ERROR",
47
- READY = "READY",
48
- CONSOLE_INIT = "CONSOLE_INIT",
49
- CONSOLE_READY = "CONSOLE_READY",
50
- EVENTS_CONNECTED = "EVENTS_CONNECTED",
51
- EVENTS_CONNECTING = "EVENTS_CONNECTING",
52
- EVENTS_DISCONNECTED = "EVENTS_DISCONNECTED",
53
- TRANSLATE_INIT = "TRANSLATE_INIT",
54
- TRANSLATE_LANGUAGE_CHANGED = "TRANSLATE_LANGUAGE_CHANGED",
55
- DISPLAY_REALM_CHANGED = "DISPLAY_REALM_CHANGED"
56
- }
57
- export declare enum EventProviderType {
58
- WEBSOCKET = "WEBSOCKET",
59
- POLLING = "POLLING"
60
- }
61
- export interface Credentials {
62
- username: string;
63
- password: string;
64
- }
65
- export interface LoginOptions {
66
- redirectUrl?: string;
67
- credentials?: Credentials;
68
- }
69
- export interface BasicLoginResult {
70
- username: string;
71
- password: string;
72
- cancel: boolean;
73
- closeCallback: undefined | ((authenticated: boolean) => void);
74
- }
75
- export declare enum MapType {
76
- VECTOR = "VECTOR",
77
- RASTER = "RASTER"
78
- }
79
- export interface ManagerConfig {
80
- managerUrl: string;
81
- keycloakUrl?: string;
82
- appVersion?: string;
83
- auth?: Auth;
84
- realm: string;
85
- clientId?: string;
86
- autoLogin?: boolean;
87
- credentials?: Credentials;
88
- consoleAutoEnable?: boolean;
89
- eventProviderType?: EventProviderType;
90
- pollingIntervalMillis?: number;
91
- loadIcons?: boolean;
92
- loadDescriptors?: boolean;
93
- mapType?: MapType;
94
- loadTranslations?: string[];
95
- translationsLoadPath?: string;
96
- configureTranslationsOptions?: (i18next: i18next.InitOptions) => void;
97
- basicLoginProvider?: (username: string | undefined, password: string | undefined) => PromiseLike<BasicLoginResult>;
98
- }
99
- export declare class IconSetAddedEvent extends CustomEvent<void> {
100
- static readonly NAME = "or-iconset-added";
101
- constructor();
102
- }
103
- export interface OrManagerEventDetail {
104
- event: OREvent;
105
- error?: ORError;
106
- }
107
- declare global {
108
- export interface HTMLElementEventMap {
109
- [IconSetAddedEvent.NAME]: IconSetAddedEvent;
110
- }
111
- }
112
- export interface IconSetSvg {
113
- size: number;
114
- icons: {
115
- [name: string]: string;
116
- };
117
- }
118
- export declare class ORIconSets {
119
- private _icons;
120
- addIconSet(name: string, iconset: IconSetSvg): void;
121
- getIconSet(name: string): IconSetSvg;
122
- getIcon(icon: string | undefined): Element | undefined;
123
- }
124
- export declare class AssetModelUtil {
125
- static _assetDescriptors: AssetDescriptor[];
126
- static _attributeDescriptors: AttributeDescriptor[];
127
- static _attributeValueDescriptors: AttributeValueDescriptor[];
128
- static _metaItemDescriptors: MetaItemDescriptor[];
129
- static getAssetDescriptors(): AssetDescriptor[];
130
- static getAttributeDescriptors(): AttributeDescriptor[];
131
- static getAttributeValueDescriptors(): AttributeValueDescriptor[];
132
- static getMetaItemDescriptors(): MetaItemDescriptor[];
133
- static getAssetDescriptor(type?: string): AssetDescriptor | undefined;
134
- static getAttributeDescriptor(attributeName?: string, assetTypeOrDescriptor?: string | AssetDescriptor): AttributeDescriptor | undefined;
135
- static getAttributeValueDescriptor(name?: string, attributeNameOrDescriptor?: string | AttributeDescriptor, assetTypeOrDescriptor?: string | AssetDescriptor): AttributeValueDescriptor | undefined;
136
- static getAttributeAndValueDescriptors(assetType: string | undefined, attributeOrNameOrDescriptor: Attribute | string | AttributeDescriptor | undefined): [AttributeDescriptor | undefined, AttributeValueDescriptor | undefined];
137
- static getMetaItemDescriptor(urn?: string, attributeNameOrDescriptor?: string | AttributeDescriptor, assetTypeOrDescriptor?: string | AssetDescriptor): MetaItemDescriptor | undefined;
138
- static attributeValueDescriptorsMatch(attributeValueDescriptor1: AttributeValueDescriptor, attributeValueDescriptor2: AttributeValueDescriptor): boolean;
139
- static getMetaInitialValueFromMetaDescriptors(metaItemUrn: MetaItemDescriptor | string, metaItemDescriptors: MetaItemDescriptor[] | undefined): any | undefined;
140
- static getMetaItemDescriptorInitialValue(metaItemDescriptor: MetaItemDescriptor, initialValue: any): MetaItemDescriptor;
141
- static getAssetDescriptorColor(descriptor: AssetDescriptor | undefined, fallbackColor?: string): string | undefined;
142
- static getAssetDescriptorIcon(descriptor: AssetDescriptor | undefined, fallbackIcon?: string): string | undefined;
143
- static hasMetaItem(descriptor: AttributeDescriptor | undefined, name: string): boolean;
144
- }
145
- export declare type EventCallback = (event: OREvent) => any;
146
- export declare class Manager implements EventProviderFactory {
147
- get username(): string;
148
- get error(): ORError | undefined;
149
- get authenticated(): boolean;
150
- get ready(): boolean;
151
- get config(): ManagerConfig;
152
- get roles(): Map<string, string[]>;
153
- get managerVersion(): string;
154
- get isManagerAvailable(): boolean | "";
155
- get managerUrl(): string;
156
- get keycloakUrl(): string | undefined;
157
- get isError(): boolean;
158
- get connectionStatus(): EventProviderStatus | undefined;
159
- get console(): Console;
160
- get consoleAppConfig(): ConsoleAppConfig | undefined;
161
- get events(): EventProvider | undefined;
162
- get rest(): import("@openremote/rest").RestApi;
163
- get language(): string;
164
- set language(lang: string);
165
- get displayRealm(): string;
166
- set displayRealm(realm: string);
167
- getEventProvider(): EventProvider | undefined;
168
- get mapType(): MapType.VECTOR | MapType;
169
- protected static normaliseConfig(config: ManagerConfig): ManagerConfig;
170
- private _error?;
171
- private _config;
172
- private _authenticated;
173
- private _ready;
174
- private _readyCallback?;
175
- private _name;
176
- private _username;
177
- private _keycloak?;
178
- private _basicIdentity?;
179
- private _keycloakUpdateTokenInterval?;
180
- private _managerVersion;
181
- private _listeners;
182
- private _console;
183
- private _consoleAppConfig?;
184
- private _events?;
185
- private _displayRealm?;
186
- isManagerSameOrigin(): boolean;
187
- addListener(callback: EventCallback): void;
188
- removeListener(callback: EventCallback): void;
189
- init(config: ManagerConfig): Promise<boolean>;
190
- protected doInit(): Promise<boolean>;
191
- protected doTranslateInit(): Promise<boolean>;
192
- protected doDescriptorsInit(): Promise<boolean>;
193
- protected doAuthInit(): Promise<boolean>;
194
- protected doRestApiInit(): boolean;
195
- protected doEventsSubscriptionInit(): Promise<boolean>;
196
- protected _onEventProviderStatusChanged(status: EventProviderStatus): void;
197
- protected doConsoleInit(): Promise<boolean>;
198
- protected getConsoleAppConfig(): Promise<void>;
199
- logout(redirectUrl?: string): void;
200
- login(options?: LoginOptions): void;
201
- protected initialiseBasicAuth(): Promise<boolean>;
202
- protected doBasicLogin(): Promise<void>;
203
- isSuperUser(): boolean | "" | undefined;
204
- getApiBaseUrl(): string;
205
- getAppName(): string;
206
- hasRealmRole(role: string): boolean | undefined;
207
- hasRole(role: string, client?: string): boolean;
208
- getAuthorizationHeader(): string | undefined;
209
- getKeycloakToken(): string | undefined;
210
- getBasicToken(): string | undefined;
211
- getRealm(): string | undefined;
212
- protected isMobile(): boolean;
213
- isKeycloak(): boolean;
214
- protected _onAuthenticated(): void;
215
- protected loadAndInitialiseKeycloak(): Promise<boolean>;
216
- protected updateKeycloakAccessToken(): Promise<boolean>;
217
- protected _getNativeOfflineRefreshToken(): Promise<string | undefined>;
218
- protected _emitEvent(event: OREvent): void;
219
- protected _setError(error: ORError): void;
220
- protected _setAuthenticated(authenticated: boolean): void;
221
- }
222
- export declare const manager: Manager;
223
- export declare const IconSets: ORIconSets;
224
- export default manager;