@nextcloud/files 3.9.2 → 3.10.0
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/README.md +63 -26
- package/dist/chunks/dav-BBwoJ8WE.cjs +703 -0
- package/dist/chunks/dav-BBwoJ8WE.cjs.map +1 -0
- package/dist/chunks/dav-DxfiR0wZ.mjs +704 -0
- package/dist/chunks/dav-DxfiR0wZ.mjs.map +1 -0
- package/dist/dav.cjs +19 -0
- package/dist/dav.cjs.map +1 -0
- package/dist/dav.d.ts +370 -0
- package/dist/dav.mjs +19 -0
- package/dist/dav.mjs.map +1 -0
- package/dist/index.cjs +106 -692
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1099 -39
- package/dist/index.mjs +410 -995
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -10
- package/dist/dav/dav.d.ts +0 -56
- package/dist/dav/davPermissions.d.ts +0 -6
- package/dist/dav/davProperties.d.ts +0 -57
- package/dist/fileAction.d.ts +0 -79
- package/dist/fileListFilters.d.ts +0 -86
- package/dist/fileListHeaders.d.ts +0 -27
- package/dist/files/file.d.ts +0 -12
- package/dist/files/fileType.d.ts +0 -8
- package/dist/files/folder.d.ts +0 -18
- package/dist/files/node.d.ts +0 -166
- package/dist/files/nodeData.d.ts +0 -54
- package/dist/navigation/column.d.ts +0 -28
- package/dist/navigation/index.d.ts +0 -7
- package/dist/navigation/navigation.d.ts +0 -74
- package/dist/navigation/view.d.ts +0 -92
- package/dist/newFileMenu.d.ts +0 -66
- package/dist/permissions.d.ts +0 -16
- package/dist/utils/fileSize.d.ts +0 -25
- package/dist/utils/fileSorting.d.ts +0 -35
- package/dist/utils/filename-validation.d.ts +0 -51
- package/dist/utils/filename.d.ts +0 -24
- package/dist/utils/logger.d.ts +0 -2
- package/dist/utils/sorting.d.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.mjs",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./dav": {
|
|
16
|
+
"types": "./dist/dav.d.ts",
|
|
17
|
+
"import": "./dist/dav.mjs",
|
|
18
|
+
"require": "./dist/dav.cjs"
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"files": [
|
|
@@ -29,7 +34,7 @@
|
|
|
29
34
|
],
|
|
30
35
|
"scripts": {
|
|
31
36
|
"build": "vite --mode production build",
|
|
32
|
-
"build:doc": "typedoc && touch dist/doc/.nojekyll",
|
|
37
|
+
"build:doc": "typedoc --out dist/doc lib/dav/index.ts lib/index.ts && touch dist/doc/.nojekyll",
|
|
33
38
|
"dev": "vite --mode development build",
|
|
34
39
|
"watch": "vite --mode development build --watch",
|
|
35
40
|
"lint": "eslint .",
|
|
@@ -51,19 +56,19 @@
|
|
|
51
56
|
},
|
|
52
57
|
"homepage": "https://github.com/nextcloud-libraries/nextcloud-files",
|
|
53
58
|
"devDependencies": {
|
|
54
|
-
"@codecov/vite-plugin": "^
|
|
59
|
+
"@codecov/vite-plugin": "^1.2.1",
|
|
55
60
|
"@nextcloud/eslint-config": "^8.4.1",
|
|
56
61
|
"@nextcloud/event-bus": "^3.3.1",
|
|
57
62
|
"@nextcloud/typings": "^1.9.1",
|
|
58
63
|
"@nextcloud/vite-config": "^2.2.2",
|
|
59
|
-
"@types/node": "^22.
|
|
60
|
-
"@vitest/coverage-istanbul": "^2.
|
|
64
|
+
"@types/node": "^22.9.0",
|
|
65
|
+
"@vitest/coverage-istanbul": "^2.1.4",
|
|
61
66
|
"fast-xml-parser": "^4.5.0",
|
|
62
|
-
"jsdom": "^25.0.
|
|
63
|
-
"tslib": "^2.
|
|
64
|
-
"typedoc": "^0.26.
|
|
65
|
-
"typescript": "^5.
|
|
66
|
-
"vite": "^5.4.
|
|
67
|
+
"jsdom": "^25.0.1",
|
|
68
|
+
"tslib": "^2.8.1",
|
|
69
|
+
"typedoc": "^0.26.11",
|
|
70
|
+
"typescript": "^5.6.3",
|
|
71
|
+
"vite": "^5.4.10",
|
|
67
72
|
"vitest": "^2.0.2"
|
|
68
73
|
},
|
|
69
74
|
"dependencies": {
|
package/dist/dav/dav.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { FileStat, WebDAVClient } from 'webdav';
|
|
2
|
-
import { Node } from '../files/node';
|
|
3
|
-
import { CancelablePromise } from 'cancelable-promise';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get the DAV root path for the current user or public share
|
|
7
|
-
*/
|
|
8
|
-
export declare function davGetRootPath(): string;
|
|
9
|
-
/**
|
|
10
|
-
* The DAV root path for the current user
|
|
11
|
-
* This is a cached version of `davGetRemoteURL`
|
|
12
|
-
*/
|
|
13
|
-
export declare const davRootPath: string;
|
|
14
|
-
/**
|
|
15
|
-
* Get the DAV remote URL used as base URL for the WebDAV client
|
|
16
|
-
* It also handles public shares
|
|
17
|
-
*/
|
|
18
|
-
export declare function davGetRemoteURL(): string;
|
|
19
|
-
/**
|
|
20
|
-
* The DAV remote URL used as base URL for the WebDAV client
|
|
21
|
-
* This is a cached version of `davGetRemoteURL`
|
|
22
|
-
*/
|
|
23
|
-
export declare const davRemoteURL: string;
|
|
24
|
-
/**
|
|
25
|
-
* Get a WebDAV client configured to include the Nextcloud request token
|
|
26
|
-
*
|
|
27
|
-
* @param remoteURL The DAV server remote URL
|
|
28
|
-
* @param headers Optional additional headers to set for every request
|
|
29
|
-
*/
|
|
30
|
-
export declare const davGetClient: (remoteURL?: string, headers?: Record<string, string>) => WebDAVClient;
|
|
31
|
-
/**
|
|
32
|
-
* Use WebDAV to query for favorite Nodes
|
|
33
|
-
*
|
|
34
|
-
* @param davClient The WebDAV client to use for performing the request
|
|
35
|
-
* @param path Base path for the favorites, if unset all favorites are queried
|
|
36
|
-
* @param davRoot The root path for the DAV user (defaults to `davRootPath`)
|
|
37
|
-
* @example
|
|
38
|
-
* ```js
|
|
39
|
-
* import { davGetClient, davRootPath, getFavoriteNodes } from '@nextcloud/files'
|
|
40
|
-
*
|
|
41
|
-
* const client = davGetClient()
|
|
42
|
-
* // query favorites for the root
|
|
43
|
-
* const favorites = await getFavoriteNodes(client)
|
|
44
|
-
* // which is the same as writing:
|
|
45
|
-
* const favorites = await getFavoriteNodes(client, '/', davRootPath)
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare const getFavoriteNodes: (davClient: WebDAVClient, path?: string, davRoot?: string) => CancelablePromise<Node[]>;
|
|
49
|
-
/**
|
|
50
|
-
* Covert DAV result `FileStat` to `Node`
|
|
51
|
-
*
|
|
52
|
-
* @param node The DAV result
|
|
53
|
-
* @param filesRoot The DAV files root path
|
|
54
|
-
* @param remoteURL The DAV server remote URL (same as on `davGetClient`)
|
|
55
|
-
*/
|
|
56
|
-
export declare const davResultToNode: (node: FileStat, filesRoot?: string, remoteURL?: string) => Node;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export type DavProperty = {
|
|
2
|
-
[key: string]: string;
|
|
3
|
-
};
|
|
4
|
-
export declare const defaultDavProperties: string[];
|
|
5
|
-
export declare const defaultDavNamespaces: {
|
|
6
|
-
d: string;
|
|
7
|
-
nc: string;
|
|
8
|
-
oc: string;
|
|
9
|
-
ocs: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Register custom DAV properties
|
|
13
|
-
*
|
|
14
|
-
* Can be used if your app introduces custom DAV properties, so e.g. the files app can make use of it.
|
|
15
|
-
*
|
|
16
|
-
* @param prop The property
|
|
17
|
-
* @param namespace The namespace of the property
|
|
18
|
-
*/
|
|
19
|
-
export declare const registerDavProperty: (prop: string, namespace?: DavProperty) => boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Get the registered dav properties
|
|
22
|
-
*/
|
|
23
|
-
export declare const getDavProperties: () => string;
|
|
24
|
-
/**
|
|
25
|
-
* Get the registered dav namespaces
|
|
26
|
-
*/
|
|
27
|
-
export declare const getDavNameSpaces: () => string;
|
|
28
|
-
/**
|
|
29
|
-
* Get the default PROPFIND request body
|
|
30
|
-
*/
|
|
31
|
-
export declare const davGetDefaultPropfind: () => string;
|
|
32
|
-
/**
|
|
33
|
-
* Get the REPORT body to filter for favorite nodes
|
|
34
|
-
*/
|
|
35
|
-
export declare const davGetFavoritesReport: () => string;
|
|
36
|
-
/**
|
|
37
|
-
* Get the SEARCH body to search for recently modified files
|
|
38
|
-
*
|
|
39
|
-
* @param lastModified Oldest timestamp to include (Unix timestamp)
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* // SEARCH for recent files need a different DAV endpoint
|
|
43
|
-
* const client = davGetClient(generateRemoteUrl('dav'))
|
|
44
|
-
* // Timestamp of last week
|
|
45
|
-
* const lastWeek = Math.round(Date.now() / 1000) - (60 * 60 * 24 * 7)
|
|
46
|
-
* const contentsResponse = await client.getDirectoryContents(path, {
|
|
47
|
-
* details: true,
|
|
48
|
-
* data: davGetRecentSearch(lastWeek),
|
|
49
|
-
* headers: {
|
|
50
|
-
* method: 'SEARCH',
|
|
51
|
-
* 'Content-Type': 'application/xml; charset=utf-8',
|
|
52
|
-
* },
|
|
53
|
-
* deep: true,
|
|
54
|
-
* }) as ResponseDataDetailed<FileStat[]>
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export declare const davGetRecentSearch: (lastModified: number) => string;
|
package/dist/fileAction.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Node } from './files/node';
|
|
2
|
-
import { View } from './navigation/view';
|
|
3
|
-
|
|
4
|
-
export declare enum DefaultType {
|
|
5
|
-
DEFAULT = "default",
|
|
6
|
-
HIDDEN = "hidden"
|
|
7
|
-
}
|
|
8
|
-
interface FileActionData {
|
|
9
|
-
/** Unique ID */
|
|
10
|
-
id: string;
|
|
11
|
-
/** Translatable string displayed in the menu */
|
|
12
|
-
displayName: (files: Node[], view: View) => string;
|
|
13
|
-
/** Translatable title for of the action */
|
|
14
|
-
title?: (files: Node[], view: View) => string;
|
|
15
|
-
/** Svg as inline string. <svg><path fill="..." /></svg> */
|
|
16
|
-
iconSvgInline: (files: Node[], view: View) => string;
|
|
17
|
-
/** Condition wether this action is shown or not */
|
|
18
|
-
enabled?: (files: Node[], view: View) => boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Function executed on single file action
|
|
21
|
-
* @return true if the action was executed successfully,
|
|
22
|
-
* false otherwise and null if the action is silent/undefined.
|
|
23
|
-
* @throws Error if the action failed
|
|
24
|
-
*/
|
|
25
|
-
exec: (file: Node, view: View, dir: string) => Promise<boolean | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Function executed on multiple files action
|
|
28
|
-
* @return true if the action was executed successfully,
|
|
29
|
-
* false otherwise and null if the action is silent/undefined.
|
|
30
|
-
* @throws Error if the action failed
|
|
31
|
-
*/
|
|
32
|
-
execBatch?: (files: Node[], view: View, dir: string) => Promise<(boolean | null)[]>;
|
|
33
|
-
/** This action order in the list */
|
|
34
|
-
order?: number;
|
|
35
|
-
/**
|
|
36
|
-
* This action's parent id in the list.
|
|
37
|
-
* If none found, will be displayed as a top-level action.
|
|
38
|
-
*/
|
|
39
|
-
parent?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Make this action the default.
|
|
42
|
-
* If multiple actions are default, the first one
|
|
43
|
-
* will be used. The other ones will be put as first
|
|
44
|
-
* entries in the actions menu iff DefaultType.Hidden is not used.
|
|
45
|
-
* A DefaultType.Hidden action will never be shown
|
|
46
|
-
* in the actions menu even if another action takes
|
|
47
|
-
* its place as default.
|
|
48
|
-
*/
|
|
49
|
-
default?: DefaultType;
|
|
50
|
-
/**
|
|
51
|
-
* If true, the renderInline function will be called
|
|
52
|
-
*/
|
|
53
|
-
inline?: (file: Node, view: View) => boolean;
|
|
54
|
-
/**
|
|
55
|
-
* If defined, the returned html element will be
|
|
56
|
-
* appended before the actions menu.
|
|
57
|
-
*/
|
|
58
|
-
renderInline?: (file: Node, view: View) => Promise<HTMLElement | null>;
|
|
59
|
-
}
|
|
60
|
-
export declare class FileAction {
|
|
61
|
-
private _action;
|
|
62
|
-
constructor(action: FileActionData);
|
|
63
|
-
get id(): string;
|
|
64
|
-
get displayName(): (files: Node[], view: View) => string;
|
|
65
|
-
get title(): ((files: Node[], view: View) => string) | undefined;
|
|
66
|
-
get iconSvgInline(): (files: Node[], view: View) => string;
|
|
67
|
-
get enabled(): ((files: Node[], view: View) => boolean) | undefined;
|
|
68
|
-
get exec(): (file: Node, view: View, dir: string) => Promise<boolean | null>;
|
|
69
|
-
get execBatch(): ((files: Node[], view: View, dir: string) => Promise<(boolean | null)[]>) | undefined;
|
|
70
|
-
get order(): number | undefined;
|
|
71
|
-
get parent(): string | undefined;
|
|
72
|
-
get default(): DefaultType | undefined;
|
|
73
|
-
get inline(): ((file: Node, view: View) => boolean) | undefined;
|
|
74
|
-
get renderInline(): ((file: Node, view: View) => Promise<HTMLElement | null>) | undefined;
|
|
75
|
-
private validateAction;
|
|
76
|
-
}
|
|
77
|
-
export declare const registerFileAction: (action: FileAction) => void;
|
|
78
|
-
export declare const getFileActions: () => FileAction[];
|
|
79
|
-
export {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { TypedEventTarget } from 'typescript-event-target';
|
|
2
|
-
import { INode } from './files/node';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Active filters can provide one or more "chips" to show the currently active state.
|
|
6
|
-
* Must at least provide a text representing the filters state and a callback to unset that state (disable this filter).
|
|
7
|
-
*/
|
|
8
|
-
export interface IFileListFilterChip {
|
|
9
|
-
/**
|
|
10
|
-
* Text of the chip
|
|
11
|
-
*/
|
|
12
|
-
text: string;
|
|
13
|
-
/**
|
|
14
|
-
* Optional icon to be used on the chip (inline SVG as string)
|
|
15
|
-
*/
|
|
16
|
-
icon?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Handler to be called on click
|
|
19
|
-
*/
|
|
20
|
-
onclick: () => void;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* This event is emitted when the the filter value changed and the file list needs to be updated
|
|
24
|
-
*/
|
|
25
|
-
export interface FilterUpdateEvent extends CustomEvent<never> {
|
|
26
|
-
type: 'update:filter';
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* This event is emitted when the the filter value changed and the file list needs to be updated
|
|
30
|
-
*/
|
|
31
|
-
export interface FilterUpdateChipsEvent extends CustomEvent<IFileListFilterChip[]> {
|
|
32
|
-
type: 'update:chips';
|
|
33
|
-
}
|
|
34
|
-
interface IFileListFilterEvents {
|
|
35
|
-
[name: string]: CustomEvent;
|
|
36
|
-
'update:filter': FilterUpdateEvent;
|
|
37
|
-
'update:chips': FilterUpdateChipsEvent;
|
|
38
|
-
}
|
|
39
|
-
export interface IFileListFilter extends TypedEventTarget<IFileListFilterEvents> {
|
|
40
|
-
/**
|
|
41
|
-
* Unique ID of this filter
|
|
42
|
-
*/
|
|
43
|
-
readonly id: string;
|
|
44
|
-
/**
|
|
45
|
-
* Order of the filter
|
|
46
|
-
*
|
|
47
|
-
* Use a low number to make this filter ordered in front.
|
|
48
|
-
*/
|
|
49
|
-
readonly order: number;
|
|
50
|
-
/**
|
|
51
|
-
* If the filter needs a visual element for settings it can provide a function to mount it.
|
|
52
|
-
*/
|
|
53
|
-
readonly mount?: (el: HTMLElement) => void;
|
|
54
|
-
/**
|
|
55
|
-
* Filter function to decide if a node is shown
|
|
56
|
-
* @return The nodes to be shown
|
|
57
|
-
*/
|
|
58
|
-
filter(node: INode[]): INode[];
|
|
59
|
-
}
|
|
60
|
-
export declare class FileListFilter extends TypedEventTarget<IFileListFilterEvents> implements IFileListFilter {
|
|
61
|
-
id: string;
|
|
62
|
-
order: number;
|
|
63
|
-
constructor(id: string, order?: number);
|
|
64
|
-
filter(nodes: INode[]): INode[];
|
|
65
|
-
protected updateChips(chips: IFileListFilterChip[]): void;
|
|
66
|
-
protected filterUpdated(): void;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Register a new filter on the file list
|
|
70
|
-
*
|
|
71
|
-
* This only must be called once to register the filter,
|
|
72
|
-
* when the filter state changes you need to call `filterUpdated` on the filter instead.
|
|
73
|
-
*
|
|
74
|
-
* @param filter The filter to register on the file list
|
|
75
|
-
*/
|
|
76
|
-
export declare function registerFileListFilter(filter: IFileListFilter): void;
|
|
77
|
-
/**
|
|
78
|
-
* Remove a registered filter from the file list
|
|
79
|
-
* @param filterId The unique ID of the filter to remove
|
|
80
|
-
*/
|
|
81
|
-
export declare function unregisterFileListFilter(filterId: string): void;
|
|
82
|
-
/**
|
|
83
|
-
* Get all registered file list filters
|
|
84
|
-
*/
|
|
85
|
-
export declare function getFileListFilters(): IFileListFilter[];
|
|
86
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Folder } from './files/folder';
|
|
2
|
-
import { View } from './navigation/view';
|
|
3
|
-
|
|
4
|
-
export interface HeaderData {
|
|
5
|
-
/** Unique ID */
|
|
6
|
-
id: string;
|
|
7
|
-
/** Order */
|
|
8
|
-
order: number;
|
|
9
|
-
/** Condition wether this header is shown or not */
|
|
10
|
-
enabled?: (folder: Folder, view: View) => boolean;
|
|
11
|
-
/** Executed when file list is initialized */
|
|
12
|
-
render: (el: HTMLElement, folder: Folder, view: View) => void;
|
|
13
|
-
/** Executed when root folder changed */
|
|
14
|
-
updated(folder: Folder, view: View): any;
|
|
15
|
-
}
|
|
16
|
-
export declare class Header {
|
|
17
|
-
private _header;
|
|
18
|
-
constructor(header: HeaderData);
|
|
19
|
-
get id(): string;
|
|
20
|
-
get order(): number;
|
|
21
|
-
get enabled(): ((folder: Folder, view: View) => boolean) | undefined;
|
|
22
|
-
get render(): (el: HTMLElement, folder: Folder, view: View) => void;
|
|
23
|
-
get updated(): (folder: Folder, view: View) => any;
|
|
24
|
-
private validateHeader;
|
|
25
|
-
}
|
|
26
|
-
export declare const registerFileListHeaders: (header: Header) => void;
|
|
27
|
-
export declare const getFileListHeaders: () => Header[];
|
package/dist/files/file.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FileType } from './fileType';
|
|
2
|
-
import { INode, Node } from './node';
|
|
3
|
-
|
|
4
|
-
export declare class File extends Node {
|
|
5
|
-
get type(): FileType;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Interface of the File class
|
|
9
|
-
*/
|
|
10
|
-
export interface IFile extends INode {
|
|
11
|
-
readonly type: FileType.File;
|
|
12
|
-
}
|
package/dist/files/fileType.d.ts
DELETED
package/dist/files/folder.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FileType } from './fileType';
|
|
2
|
-
import { INode, Node } from './node';
|
|
3
|
-
import { NodeData } from './nodeData';
|
|
4
|
-
|
|
5
|
-
export declare class Folder extends Node {
|
|
6
|
-
constructor(data: NodeData);
|
|
7
|
-
get type(): FileType;
|
|
8
|
-
get extension(): string | null;
|
|
9
|
-
get mime(): string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Interface of the folder class
|
|
13
|
-
*/
|
|
14
|
-
export interface IFolder extends INode {
|
|
15
|
-
readonly type: FileType.Folder;
|
|
16
|
-
readonly extension: null;
|
|
17
|
-
readonly mime: 'httpd/unix-directory';
|
|
18
|
-
}
|
package/dist/files/node.d.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { Permission } from '../permissions';
|
|
2
|
-
import { FileType } from './fileType';
|
|
3
|
-
import { Attribute, NodeData } from './nodeData';
|
|
4
|
-
|
|
5
|
-
export declare enum NodeStatus {
|
|
6
|
-
/** This is a new node and it doesn't exists on the filesystem yet */
|
|
7
|
-
NEW = "new",
|
|
8
|
-
/** This node has failed and is unavailable */
|
|
9
|
-
FAILED = "failed",
|
|
10
|
-
/** This node is currently loading or have an operation in progress */
|
|
11
|
-
LOADING = "loading",
|
|
12
|
-
/** This node is locked and cannot be modified */
|
|
13
|
-
LOCKED = "locked"
|
|
14
|
-
}
|
|
15
|
-
export declare abstract class Node {
|
|
16
|
-
private _data;
|
|
17
|
-
private _attributes;
|
|
18
|
-
private _knownDavService;
|
|
19
|
-
private readonlyAttributes;
|
|
20
|
-
private handler;
|
|
21
|
-
constructor(data: NodeData, davService?: RegExp);
|
|
22
|
-
/**
|
|
23
|
-
* Get the source url to this object
|
|
24
|
-
* There is no setter as the source is not meant to be changed manually.
|
|
25
|
-
* You can use the rename or move method to change the source.
|
|
26
|
-
*/
|
|
27
|
-
get source(): string;
|
|
28
|
-
/**
|
|
29
|
-
* Get the encoded source url to this object for requests purposes
|
|
30
|
-
*/
|
|
31
|
-
get encodedSource(): string;
|
|
32
|
-
/**
|
|
33
|
-
* Get this object name
|
|
34
|
-
* There is no setter as the source is not meant to be changed manually.
|
|
35
|
-
* You can use the rename or move method to change the source.
|
|
36
|
-
*/
|
|
37
|
-
get basename(): string;
|
|
38
|
-
/**
|
|
39
|
-
* The nodes displayname
|
|
40
|
-
* By default the display name and the `basename` are identical,
|
|
41
|
-
* but it is possible to have a different name. This happens
|
|
42
|
-
* on the files app for example for shared folders.
|
|
43
|
-
*/
|
|
44
|
-
get displayname(): string;
|
|
45
|
-
/**
|
|
46
|
-
* Set the displayname
|
|
47
|
-
*/
|
|
48
|
-
set displayname(displayname: string);
|
|
49
|
-
/**
|
|
50
|
-
* Get this object's extension
|
|
51
|
-
* There is no setter as the source is not meant to be changed manually.
|
|
52
|
-
* You can use the rename or move method to change the source.
|
|
53
|
-
*/
|
|
54
|
-
get extension(): string | null;
|
|
55
|
-
/**
|
|
56
|
-
* Get the directory path leading to this object
|
|
57
|
-
* Will use the relative path to root if available
|
|
58
|
-
*
|
|
59
|
-
* There is no setter as the source is not meant to be changed manually.
|
|
60
|
-
* You can use the rename or move method to change the source.
|
|
61
|
-
*/
|
|
62
|
-
get dirname(): string;
|
|
63
|
-
/**
|
|
64
|
-
* Is it a file or a folder ?
|
|
65
|
-
*/
|
|
66
|
-
abstract get type(): FileType;
|
|
67
|
-
/**
|
|
68
|
-
* Get the file mime
|
|
69
|
-
* There is no setter as the mime is not meant to be changed
|
|
70
|
-
*/
|
|
71
|
-
get mime(): string | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Get the file modification time
|
|
74
|
-
*/
|
|
75
|
-
get mtime(): Date | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* Set the file modification time
|
|
78
|
-
*/
|
|
79
|
-
set mtime(mtime: Date | undefined);
|
|
80
|
-
/**
|
|
81
|
-
* Get the file creation time
|
|
82
|
-
* There is no setter as the creation time is not meant to be changed
|
|
83
|
-
*/
|
|
84
|
-
get crtime(): Date | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* Get the file size
|
|
87
|
-
*/
|
|
88
|
-
get size(): number | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* Set the file size
|
|
91
|
-
*/
|
|
92
|
-
set size(size: number | undefined);
|
|
93
|
-
/**
|
|
94
|
-
* Get the file attribute
|
|
95
|
-
* This contains all additional attributes not provided by the Node class
|
|
96
|
-
*/
|
|
97
|
-
get attributes(): Attribute;
|
|
98
|
-
/**
|
|
99
|
-
* Get the file permissions
|
|
100
|
-
*/
|
|
101
|
-
get permissions(): Permission;
|
|
102
|
-
/**
|
|
103
|
-
* Set the file permissions
|
|
104
|
-
*/
|
|
105
|
-
set permissions(permissions: Permission);
|
|
106
|
-
/**
|
|
107
|
-
* Get the file owner
|
|
108
|
-
* There is no setter as the owner is not meant to be changed
|
|
109
|
-
*/
|
|
110
|
-
get owner(): string | null;
|
|
111
|
-
/**
|
|
112
|
-
* Is this a dav-related ressource ?
|
|
113
|
-
*/
|
|
114
|
-
get isDavRessource(): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Get the dav root of this object
|
|
117
|
-
* There is no setter as the root is not meant to be changed
|
|
118
|
-
*/
|
|
119
|
-
get root(): string | null;
|
|
120
|
-
/**
|
|
121
|
-
* Get the absolute path of this object relative to the root
|
|
122
|
-
*/
|
|
123
|
-
get path(): string;
|
|
124
|
-
/**
|
|
125
|
-
* Get the node id if defined.
|
|
126
|
-
* There is no setter as the fileid is not meant to be changed
|
|
127
|
-
*/
|
|
128
|
-
get fileid(): number | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* Get the node status.
|
|
131
|
-
*/
|
|
132
|
-
get status(): NodeStatus | undefined;
|
|
133
|
-
/**
|
|
134
|
-
* Set the node status.
|
|
135
|
-
*/
|
|
136
|
-
set status(status: NodeStatus | undefined);
|
|
137
|
-
/**
|
|
138
|
-
* Move the node to a new destination
|
|
139
|
-
*
|
|
140
|
-
* @param {string} destination the new source.
|
|
141
|
-
* e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
|
|
142
|
-
*/
|
|
143
|
-
move(destination: string): void;
|
|
144
|
-
/**
|
|
145
|
-
* Rename the node
|
|
146
|
-
* This aliases the move method for easier usage
|
|
147
|
-
*
|
|
148
|
-
* @param basename The new name of the node
|
|
149
|
-
*/
|
|
150
|
-
rename(basename: string): void;
|
|
151
|
-
/**
|
|
152
|
-
* Update the mtime if exists
|
|
153
|
-
*/
|
|
154
|
-
updateMtime(): void;
|
|
155
|
-
/**
|
|
156
|
-
* Update the attributes of the node
|
|
157
|
-
* Warning, updating attributes will NOT automatically update the mtime.
|
|
158
|
-
*
|
|
159
|
-
* @param attributes The new attributes to update on the Node attributes
|
|
160
|
-
*/
|
|
161
|
-
update(attributes: Attribute): void;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Interface of the node class
|
|
165
|
-
*/
|
|
166
|
-
export type INode = Pick<Node, keyof Node>;
|
package/dist/files/nodeData.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Permission } from '../permissions';
|
|
2
|
-
import { NodeStatus } from './node';
|
|
3
|
-
|
|
4
|
-
export interface Attribute {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
}
|
|
7
|
-
export interface NodeData {
|
|
8
|
-
/** Unique ID */
|
|
9
|
-
id?: number;
|
|
10
|
-
/**
|
|
11
|
-
* URL to the ressource.
|
|
12
|
-
* e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
|
|
13
|
-
* or https://domain.com/Photos/picture.jpg
|
|
14
|
-
*/
|
|
15
|
-
source: string;
|
|
16
|
-
/** Last modified time */
|
|
17
|
-
mtime?: Date;
|
|
18
|
-
/** Creation time */
|
|
19
|
-
crtime?: Date;
|
|
20
|
-
/** The mime type Optional for folders only */
|
|
21
|
-
mime?: string;
|
|
22
|
-
/** The node size type */
|
|
23
|
-
size?: number;
|
|
24
|
-
/** The node permissions */
|
|
25
|
-
permissions?: Permission;
|
|
26
|
-
/** The owner UID of this node */
|
|
27
|
-
owner: string | null;
|
|
28
|
-
/** Optional the displayname of this node */
|
|
29
|
-
displayname?: string;
|
|
30
|
-
/** The node attributes */
|
|
31
|
-
attributes?: Attribute;
|
|
32
|
-
/**
|
|
33
|
-
* The absolute root of the home relative to the service.
|
|
34
|
-
* It is highly recommended to provide that information.
|
|
35
|
-
* e.g. /files/emma
|
|
36
|
-
*/
|
|
37
|
-
root?: string;
|
|
38
|
-
/** The node status */
|
|
39
|
-
status?: NodeStatus;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Check if a node source is from a specific DAV service
|
|
43
|
-
*
|
|
44
|
-
* @param source The source to check
|
|
45
|
-
* @param davService Pattern to check if source is DAV ressource
|
|
46
|
-
*/
|
|
47
|
-
export declare const isDavRessource: (source: string, davService: RegExp) => boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Validate Node construct data
|
|
50
|
-
*
|
|
51
|
-
* @param data The node data
|
|
52
|
-
* @param davService Pattern to check if source is DAV ressource
|
|
53
|
-
*/
|
|
54
|
-
export declare const validateData: (data: NodeData, davService: RegExp) => void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Node } from '../files/node';
|
|
2
|
-
import { View } from './view';
|
|
3
|
-
|
|
4
|
-
interface ColumnData {
|
|
5
|
-
/** Unique column ID */
|
|
6
|
-
id: string;
|
|
7
|
-
/** Translated column title */
|
|
8
|
-
title: string;
|
|
9
|
-
/** The content of the cell. The element will be appended within */
|
|
10
|
-
render: (node: Node, view: View) => HTMLElement;
|
|
11
|
-
/** Function used to sort Nodes between them */
|
|
12
|
-
sort?: (nodeA: Node, nodeB: Node) => number;
|
|
13
|
-
/**
|
|
14
|
-
* Custom summary of the column to display at the end of the list.
|
|
15
|
-
* Will not be displayed if nothing is provided
|
|
16
|
-
*/
|
|
17
|
-
summary?: (node: Node[], view: View) => string;
|
|
18
|
-
}
|
|
19
|
-
export declare class Column implements ColumnData {
|
|
20
|
-
private _column;
|
|
21
|
-
constructor(column: ColumnData);
|
|
22
|
-
get id(): string;
|
|
23
|
-
get title(): string;
|
|
24
|
-
get render(): (node: Node, view: View) => HTMLElement;
|
|
25
|
-
get sort(): ((nodeA: Node, nodeB: Node) => number) | undefined;
|
|
26
|
-
get summary(): ((node: Node[], view: View) => string) | undefined;
|
|
27
|
-
}
|
|
28
|
-
export {};
|