/** * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ export declare const NodeStatus: Readonly<{ /** This is a new node and it doesn't exists on the filesystem yet */ NEW: "new"; /** This node has failed and is unavailable */ FAILED: "failed"; /** This node is currently loading or have an operation in progress */ LOADING: "loading"; /** This node is locked and cannot be modified */ LOCKED: "locked"; }>; export type INodeStatus = typeof NodeStatus[keyof typeof NodeStatus]; export interface Attribute { [key: string]: any; } export interface NodeData { /** * URL to the resource. * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg * or https://domain.com/Photos/picture.jpg */ source: string; /** * The absolute root of the home relative to the service. * It is highly recommended to provide that information. * e.g. /files/emma */ root: string; /** * Unique ID * * This is usually the file id from the backend where this would be a number. * For some type of nodes this is already a snowflake id and thus as string. * * Note: Passing a number is deprecated. */ id?: number | string; /** Last modified time */ mtime?: Date; /** Creation time */ crtime?: Date; /** The mime type Optional for folders only */ mime?: string; /** The node size type */ size?: number; /** * The node permissions. * * A binary mask of `Permission` values. * * @see Permission */ permissions?: number; /** The owner UID of this node */ owner: string | null; /** Optional the displayname of this node */ displayname?: string; /** The node attributes */ attributes?: Attribute; /** The node status */ status?: INodeStatus; } /** * Check if a node source is from a specific DAV service * * @param source The source to check * @param davService Pattern to check if source is DAV resource */ export declare function isDavResource(source: string, davService: RegExp): boolean; /** * Validate Node construct data * * @param data The node data * @param davService Pattern to check if source is DAV ressource */ export declare function validateData(data: NodeData, davService: RegExp): void; /** * In case we try to create a node from deserialized data, * we need to fix date types. * * @param data The internal node data */ export declare function fixDates(data: NodeData): void; /** * Fix a RegExp pattern from string or RegExp to RegExp * * @param pattern The pattern as string or RegExp */ export declare function fixRegExp(pattern: string | RegExp): RegExp;