import * as i0 from '@angular/core'; import { OnInit, EventEmitter, WritableSignal, ViewRef } from '@angular/core'; import * as rxjs from 'rxjs'; import { Observable, Subject } from 'rxjs'; import { HsEndpoint, HsAuthState, AccessRightsModel, HsLaymanLayerDescriptor, HsLaymanGetLayer } from 'hslayers-ng/types'; import { HttpClient } from '@angular/common/http'; import { HsLanguageService } from 'hslayers-ng/services/language'; import { HsLogService } from 'hslayers-ng/services/log'; import { HsToastService } from 'hslayers-ng/common/toast'; import { HsCommonEndpointsService } from 'hslayers-ng/services/endpoints'; import { HsProxyService } from 'hslayers-ng/services/utils'; import { HsConfig } from 'hslayers-ng/config'; import { HsDialogContainerService, HsDialogComponent } from 'hslayers-ng/common/dialogs'; import { SafeResourceUrl } from '@angular/platform-browser'; import { Layer, Vector } from 'ol/layer'; import { Source, Vector as Vector$1 } from 'ol/source'; import { Feature } from 'ol/index'; type CurrentUserResponse = { authenticated?: boolean; claims?: { email?: string; email_verified?: boolean; family_name?: string; given_name?: string; iss?: string; middle_name?: string; name?: string; preferred_username?: string; screen_name?: string; }; username?: string; code?: number; }; declare class HsCommonLaymanService { endpointService: HsCommonEndpointsService; http: HttpClient; proxyService: HsProxyService; hsToastService: HsToastService; hsLanguageService: HsLanguageService; hsLog: HsLogService; hsConfig: HsConfig; private readonly MAX_USER_POLL_ATTEMPTS; private readonly USER_POLL_DELAY; readonly layman$: Observable; readonly layman: i0.Signal; readonly version: i0.Signal; login$: Subject; logout$: Subject; authActions$: Observable<{ type: string; } | { type: string; }>; authState$: Observable; authState: i0.Signal; isAuthenticated: i0.Signal; user: i0.Signal; isAuthenticating: i0.Signal; /** * Check wether provided url belongs to Layman endpoint * @param url - URL to be checked * @param layman - Layman endpoint */ isLaymanUrl(url: string, layman: HsEndpoint): boolean; /** * Get current user from layman endpoint * @param endpoint - Layman endpoint */ getCurrentUser(endpoint_url: HsEndpoint['url']): Observable; /** * Log into existing account by opening a login endpoint in new window * and polling for the results */ pollForUser(): Observable; logout(): Promise; displayLaymanError(endpoint: HsEndpoint, errorMsg: string, responseBody: { code?: number; message?: string; detail?: string; }): void; getStyleFromUrl(styleUrl: string): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Change access rights for everyone * @param username - Username of the user. * @param screen_name - Screen name of the user. * @param given_name - Given name of the user. * @param family_name - Family name of the user * @param middle_name - Middle name of the user * @param name - Whole name of the user (given_name + middle_name + family_name). FIXME: overriden by username to align param naming with roles * @param hslDisplayName - (Optional) Carefully selected word from other user properties, that is used in Hslayers templates * @param read - (Optional) Layman read rights status * @param write - (Optional) Layman write rights status * @param role -(Optional) When in combiantion with layman proxy, user - role mapping is obtained as well */ type LaymanUser = { username: string; screen_name: string; given_name: string; family_name: string; middle_name: string; name: string; hslDisplayName?: string; read?: boolean; write?: boolean; role?: string[]; }; declare enum GrantingOptions { PERUSER = "perUser", EVERYONE = "everyone", PERROLE = "perRole" } declare enum AccessRights { READ = "access_rights.read", WRITE = "access_rights.write" } type AcessRightsActor = GrantingOptions.PERROLE | GrantingOptions.PERUSER; type LaymanRole = { name: string; read: boolean; write: boolean; }; type AccessRightsType = 'read' | 'write'; declare class HsCommonLaymanAccessRightsComponent implements OnInit { hsCommonLaymanService: HsCommonLaymanService; private $http; private hsLog; access_rights: AccessRightsModel; defaultAccessRights: AccessRightsModel; collapsed: boolean; access_rights_changed: EventEmitter; grantingOptions: GrantingOptions[]; currentOption: string; rightsOptions: AccessRightsType[]; allUsers: WritableSignal; allRoles: WritableSignal; userSearch: string; endpoint: HsEndpoint; ngOnInit(): Promise; /** * Sets up access rights based on access_rights input or reset to defaultAccessRights */ setUpAccessRights(): void; /** * Toggles access rights for all users * @param users - Username list that have access rights * @param type - Access right type (read or write) */ toggleRightsForAllUsers(type: AccessRightsType): void; /** * Change access rights for everyone * @param type - Access rights type (access_rights.read or access_rights.write) * @param value - Access rights value (private, EVERYONE, users name or user role) * @param event - Checkbox change event */ accessRightsChanged(type: AccessRightsType, value: string, event?: any): void; /** * Change each user access rights individually * @param type - Access rights type (access_rights.read or access_rights.write) * @param value - Access rights value (username for user) * @param event - Checkbox change event */ rightsChangedPerActor(type: AccessRightsType, name: LaymanUser['name'] | LaymanRole['name'], actor: AcessRightsActor, event?: any): void; /** * Based on [type] property of users/roles update access_rights value */ setAcessRightsFromActor(type: AccessRightsType, actor: AcessRightsActor): void; /** * Find user by name from all Layman users * @param name - User name provided */ findLaymanActor(name: string, actor: T): T extends GrantingOptions.PERUSER ? LaymanUser : LaymanRole; /** * Change access granting options (everyone or perUser) * @param option - Access granting option */ changeGrantingOptions(option: GrantingOptions): Promise; /** * Determine whether the role has an access or not * Inaccurate for USER to ROLE as roles might overlap */ roleHasAccess(role: string, rights: string[], type: AccessRightsType): boolean; /** * Get user roles */ getRoles(access_rights?: AccessRightsModel): Promise; /** * Check whether user list includes Wagtail user list */ private isWagtailUserArray; /** * Get users from Layman or Wagtail depending on the endpoint type. * Main difference is that Wagtail response includes user roles */ fetchUsers(): Observable; /** * Check whether user has access rights. */ userHasAccess(user: LaymanUser, rights: string[], type: AccessRightsType): boolean; /** * Get all registered users from Layman's endpoint service */ getAllUsers(access_rights?: AccessRightsModel): Promise; /** * Filter users by name * This function is passed as filter pipe function */ userFilter: (item: LaymanUser) => boolean; /** * Refresh user list, when searching for specific user */ refreshList(): void; /** * Reset to the state before user manipulation */ resetToDefault(): Promise; /** * Refresh user list, when searching for specific user * @param user - Provided Layman's service user */ getDisplayName(user: any): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class HsLaymanCurrentUserComponent { hsCommonLaymanService: HsCommonLaymanService; HsDialogContainerService: HsDialogContainerService; hsConfig: HsConfig; hsToastService: HsToastService; dropdownOpen: i0.WritableSignal; sameDomain: i0.Signal; inAppLogin: rxjs.Observable; /** * Log out the current user */ logout(): void; /** * Open login dialog or redirect to login page */ login(): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class HsLaymanLoginComponent implements HsDialogComponent, OnInit { hsCommonLaymanService: HsCommonLaymanService; hsDialogContainerService: HsDialogContainerService; private sanitizer; data: { url: string; }; viewRef: ViewRef; url: SafeResourceUrl; constructor(); ngOnInit(): void; close(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } type PostPatchLayerResponse = { name?: string; uuid?: string; url?: string; files_to_upload?: { file?: string; layman_original_parameter?: string; }[]; code?: number; detail?: any; error?: { message: string; }; message?: string; }; type GetLayersResponse = { access_rights: AccessRightsModel; bounding_box: number[]; name: string; title: string; updated_at: string; url: string; uuid: string; workspace: string; }; type DeleteAllLayersResponse = { access_rights?: { read?: string[]; write?: string[]; }; name?: string; title?: string; uuid?: string; url?: string; code?: number; detail?: any; error?: { message: string; }; message?: string; }; type DeleteSingleLayerResponse = { name?: string; uuid?: string; url?: string; code?: number; detail?: any; error?: { message: string; }; message?: string; }; declare const PREFER_RESUMABLE_SIZE_LIMIT: number; declare const SUPPORTED_SRS_LIST: string[]; /** * Get Layman friendly name for layer based on its title by * replacing spaces with underscores, converting to lowercase, etc. * see https://github.com/jirik/layman/blob/c79edab5d9be51dee0e2bfc5b2f6a380d2657cbd/src/layman/util.py#L30 * @param title - Title to get Layman-friendly name for * @returns New layer name */ declare function getLaymanFriendlyLayerName(title: string): string; /** * Get layman friendly name of layer based primary on name * and secondary on title attributes. * * @param layer - Layer to get the name for */ declare function getLayerName(layer: Layer): string; declare function wfsNotAvailable(descr: HsLaymanLayerDescriptor): boolean; declare function layerParamPendingOrStarting(descr: HsLaymanLayerDescriptor, param: string): boolean; declare function wfsFailed(descr: HsLaymanLayerDescriptor): boolean; declare function getSupportedSrsList(ep: HsEndpoint): string[]; /** * @param ep - Layman endpoint * @param version - Version which the endpoint version will be compared with */ declare function isAtLeastVersions(ep: HsEndpoint, version: string): boolean; /** * Wait until layer synchronization is complete * @param layer - OL Layer */ declare function awaitLayerSync(layer: Layer): Promise; /** * Check if the selected layer is synchronize-able * @param layer - Layer to check * @returns True if the layer can be synchronized, false otherwise */ declare function isLayerSynchronizable(layer: Vector>, instOf: (obj: any, klass: any) => boolean): boolean; /** * Check if the URL matches any exception patterns * @param url - URL to be checked * @returns true if the URL matches an exception pattern */ declare function isLaymanUrlException(url: string, exceptions: HsConfig['laymanUrlExceptions']): boolean; /** * ASCII transliterations for a wide range of European characters * commonly used in various languages. */ declare const TRANSLITERATION_MAP: { readonly À: "A"; readonly Á: "A"; readonly Â: "A"; readonly Ã: "A"; readonly Ä: "A"; readonly Å: "A"; readonly Æ: "AE"; readonly Ç: "C"; readonly È: "E"; readonly É: "E"; readonly Ê: "E"; readonly Ë: "E"; readonly Ì: "I"; readonly Í: "I"; readonly Î: "I"; readonly Ï: "I"; readonly Ð: "D"; readonly Ñ: "N"; readonly Ò: "O"; readonly Ó: "O"; readonly Ô: "O"; readonly Õ: "O"; readonly Ö: "O"; readonly '\u00D7': "x"; readonly Ø: "O"; readonly Ù: "U"; readonly Ú: "U"; readonly Û: "U"; readonly Ü: "U"; readonly Ý: "Y"; readonly Þ: "Th"; readonly ß: "ss"; readonly à: "a"; readonly á: "a"; readonly â: "a"; readonly ã: "a"; readonly ä: "a"; readonly å: "a"; readonly æ: "ae"; readonly ç: "c"; readonly è: "e"; readonly é: "e"; readonly ê: "e"; readonly ë: "e"; readonly ì: "i"; readonly í: "i"; readonly î: "i"; readonly ï: "i"; readonly ð: "d"; readonly ñ: "n"; readonly ò: "o"; readonly ó: "o"; readonly ô: "o"; readonly õ: "o"; readonly ö: "o"; readonly '\u00F7': "x"; readonly ø: "o"; readonly ù: "u"; readonly ú: "u"; readonly û: "u"; readonly ü: "u"; readonly ý: "y"; readonly þ: "th"; readonly ÿ: "y"; readonly Ā: "A"; readonly ā: "a"; readonly Ă: "A"; readonly ă: "a"; readonly Ą: "A"; readonly ą: "a"; readonly Ć: "C"; readonly ć: "c"; readonly Ĉ: "C"; readonly ĉ: "c"; readonly Ċ: "C"; readonly ċ: "c"; readonly Č: "C"; readonly č: "c"; readonly Ď: "D"; readonly ď: "d"; readonly Đ: "D"; readonly đ: "d"; readonly Ē: "E"; readonly ē: "e"; readonly Ĕ: "E"; readonly ĕ: "e"; readonly Ė: "E"; readonly ė: "e"; readonly Ę: "E"; readonly ę: "e"; readonly Ě: "E"; readonly ě: "e"; readonly Ĝ: "G"; readonly ĝ: "g"; readonly Ğ: "G"; readonly ğ: "g"; readonly Ġ: "G"; readonly ġ: "g"; readonly Ģ: "G"; readonly ģ: "g"; readonly Ĥ: "H"; readonly ĥ: "h"; readonly Ħ: "H"; readonly ħ: "h"; readonly Ĩ: "I"; readonly ĩ: "i"; readonly Ī: "I"; readonly ī: "i"; readonly Ĭ: "I"; readonly ĭ: "i"; readonly Į: "I"; readonly į: "i"; readonly İ: "I"; readonly ı: "i"; readonly IJ: "IJ"; readonly ij: "ij"; readonly Ĵ: "J"; readonly ĵ: "j"; readonly Ķ: "K"; readonly ķ: "k"; readonly ĸ: "k"; readonly Ĺ: "L"; readonly ĺ: "l"; readonly Ļ: "L"; readonly ļ: "l"; readonly Ľ: "L"; readonly ľ: "l"; readonly Ŀ: "L"; readonly ŀ: "l"; readonly Ł: "L"; readonly ł: "l"; readonly Ń: "N"; readonly ń: "n"; readonly Ņ: "N"; readonly ņ: "n"; readonly Ň: "N"; readonly ň: "n"; readonly ʼn: "n"; readonly Ŋ: "N"; readonly ŋ: "n"; readonly Ō: "O"; readonly ō: "o"; readonly Ŏ: "O"; readonly ŏ: "o"; readonly Ő: "O"; readonly ő: "o"; readonly Œ: "OE"; readonly œ: "oe"; readonly Ŕ: "R"; readonly ŕ: "r"; readonly Ŗ: "R"; readonly ŗ: "r"; readonly Ř: "R"; readonly ř: "r"; readonly Ś: "S"; readonly ś: "s"; readonly Ŝ: "S"; readonly ŝ: "s"; readonly Ş: "S"; readonly ş: "s"; readonly Š: "S"; readonly š: "s"; readonly Ţ: "T"; readonly ţ: "t"; readonly Ť: "T"; readonly ť: "t"; readonly Ŧ: "T"; readonly ŧ: "t"; readonly Ũ: "U"; readonly ũ: "u"; readonly Ū: "U"; readonly ū: "u"; readonly Ŭ: "U"; readonly ŭ: "u"; readonly Ů: "U"; readonly ů: "u"; readonly Ű: "U"; readonly ű: "u"; readonly Ų: "U"; readonly ų: "u"; readonly Ŵ: "W"; readonly ŵ: "w"; readonly Ŷ: "Y"; readonly ŷ: "y"; readonly Ÿ: "Y"; readonly Ź: "Z"; readonly ź: "z"; readonly Ż: "Z"; readonly ż: "z"; readonly Ž: "Z"; readonly ž: "z"; }; /** * Parse QML string style and make base64 symbols usable in browser by * * Look for prop elements with source attribute * and prepend its content to v while switching : with , */ declare function parseBase64Style(styleString: string): string; declare class HsCommonLaymanLayerService { http: HttpClient; hsCommonLaymanService: HsCommonLaymanService; hsLogService: HsLogService; pendingRequests: Map>; pendingLayers: WritableSignal>; layerDescriptorCache: Map; getLayersCache: Map; /** * Get layer from Layman by UUID * @param uuid - UUID of the layer * @param useCache - Whether to use cached layer description (default: false - always get fresh data) * @returns Promise which returns layer */ getLayerWithUUID(uuid: string, { useCache }?: { useCache?: boolean; }): Promise; /** * Try getting layer's description from Layman. Subsequent request with same parameters * are reused. * @param layerName - Interacted layer's name * @param workspace - Current Layman's workspace * @param ignoreStatus - Whether to ignore layer status * @param useCache - Whether to use cached layer description (default: false - always get fresh data) * @returns Promise which returns layers * description containing name, file, WMS, WFS urls etc. */ describeLayer(layerName: string, workspace: string, options?: { ignoreStatus?: boolean; useCache?: boolean; }): Promise; /** * Clear the cache for a specific layer or all layers * @param layerName - Optional layer name to clear specific cache * @param workspace - Optional workspace to clear specific cache */ clearLayerDescriptorCache(layerName?: string, workspace?: string): void; /** * Try getting layer's description from Layman. */ private makeDescribeLayerRequest; private deletePendingDescribeRequest; /** * Keep track of pending layers that are still being loaded * @param layerName - Interacted layer's name */ private managePendingLayers; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { AccessRights, GrantingOptions, HsCommonLaymanAccessRightsComponent, HsCommonLaymanLayerService, HsCommonLaymanService, HsLaymanCurrentUserComponent, HsLaymanLoginComponent, PREFER_RESUMABLE_SIZE_LIMIT, SUPPORTED_SRS_LIST, TRANSLITERATION_MAP, awaitLayerSync, getLayerName, getLaymanFriendlyLayerName, getSupportedSrsList, isAtLeastVersions, isLayerSynchronizable, isLaymanUrlException, layerParamPendingOrStarting, parseBase64Style, wfsFailed, wfsNotAvailable }; export type { AccessRightsType, CurrentUserResponse, DeleteAllLayersResponse, DeleteSingleLayerResponse, GetLayersResponse, LaymanUser, PostPatchLayerResponse };